{"id":20806294,"url":"https://github.com/nodesource/ah-preprocessors","last_synced_at":"2025-09-28T11:30:48.943Z","repository":{"id":57174721,"uuid":"84457572","full_name":"nodesource/ah-preprocessors","owner":"nodesource","description":"Preprocessors of data provided by ah-collector.","archived":false,"fork":false,"pushed_at":"2017-03-09T16:02:28.000Z","size":1182,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-15T00:38:36.827Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodesource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-09T15:29:25.000Z","updated_at":"2021-12-26T19:11:39.000Z","dependencies_parsed_at":"2022-09-03T09:03:15.075Z","dependency_job_id":null,"html_url":"https://github.com/nodesource/ah-preprocessors","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fah-preprocessors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fah-preprocessors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fah-preprocessors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fah-preprocessors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodesource","download_url":"https://codeload.github.com/nodesource/ah-preprocessors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234511782,"owners_count":18844734,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T19:19:07.947Z","updated_at":"2025-09-28T11:30:43.543Z","avatar_url":"https://github.com/nodesource.png","language":"JavaScript","readme":"# ah-preprocessors\n\nPreprocessors of data provided by ah-collector.\n\n## Installation\n\n    npm install ah-preprocessors\n\n## [API](https://nodesource.github.io/ah-preprocessors)\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### Cloner\n\nCreates a Cloner instance which is just a thin wrapper\non top of [facile-clone](https://github.com/thlorenz/facile-clone) and clones an object preserving Buffers and\nstrings according to the options supplied.\n\n**Parameters**\n\n-   `$0` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** options applied when cloning objects\n    -   `$0.bufferLength` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** determines how many elements of Buffers are\n        captured. By default not Buffer data is captured. (optional, default `0`)\n    -   `$0.stringLength` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** determines how much of each string is\n        captured. By default no string data is captured. (optional, default `0`)\n\n### cloner.clone\n\nClones the object according to the options supplied in the constructor.\n\n**Parameters**\n\n-   `x` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the object to clone\n\nReturns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the cloned object\n\n### ResourceProcesor\n\nCreates an instance of ResourceProcessor.\nNever call this directly, instead extend it to create a specific processor\nfor your particular resource type, i.e. `NetworkResourceProcessor`.\n\nMakes sure that each resource is only processed once.\n\n**Parameters**\n\n-   `$0` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** options specifying if arguments and function source are captured and how they are cloned\n    -   `$0.cloner` **[Cloner](#cloner)** used to clone the resource information\n    -   `$0.captureArguments` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** if `true` arguments of callbacks\n        are captured when they are processed. (optional, default `false`)\n    -   `$0.captureSource` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** if `true` the source code of callbacks\n        is captured when they are processed. (optional, default `false`)\n\n### resourceProcessor.cleanAllResources\n\nCleans up all captured resources which means that they are processed,\nmeaningful data extracted and the reference to the actual resource removed\nso it can be GCed.\n\n**Parameters**\n\n-   `activities` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the activities whose resources should be cleaned\n-   `collectFunctionInfo` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** if `true` it will collect info of all\n    functions found on the hooks resources. (optional, default `false`)\n\n### resourceProcessor.cleanupResource\n\nCleans the particular resource of the activity found by the uid as part of the activities.\nIf the uid isn't found in the activities or the activity is `null` this function returns\nwithout doing anything.\n\n**Parameters**\n\n-   `uid` **([Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) \\| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))** the id that identifies the activity whose resource should be cleaned\n-   `activities` **[Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)\u0026lt;([Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) \\| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)), [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\u003e** the activities that contain the activity whose resource should be\n    cleaned\n-   `collectFunctionInfo` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** if `true` it will collect info of all\n    functions found on the hooks resources. (optional, default `false`)\n\n### scoutFunctions\n\nScouts functions using [function-scout](https://github.com/nodesource/function-scout)\nand then adapts the data according to the supplied options.\nIn the process clones function arguments as well and appends them to the returned\nfunction info\n\nThis function is used by the `ResourceProcessor` and most likely you won't have to call\nit directly.\n\nSample return value:\n\n```js\n [ { path: [ 'owner', '_events', 'connection' ],\n     key: 'connection',\n     level: 2,\n     info:\n      FunctionOrigin {\n        file: '/Volumes/d/dev/js/async-hooks/ah-net/test/one-tcp-server.listen+close.js',\n        line: 25,\n        column: 21,\n        inferredName: '',\n        name: 'onconnection' },\n     id: 2,\n     arguments: null }]\n```\n\n**Parameters**\n\n-   `ctx` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the context that should be scouted for functions\n-   `uid` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the id which is appended to each function info\n-   `$0` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** options specifying if arguments and function source are captured and how they are cloned\n    -   `$0.captureArguments` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** if `true` arguments of callbacks\n        are captured when they are processed. (optional, default `false`)\n    -   `$0.captureSource` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** if `true` the source code of callbacks\n        is captured when they are processed. (optional, default `false`)\n    -   `$0.cloner` **[Cloner](#cloner)** used to clone the function arguments\n    -   `$0.name` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** if supplied it will be prepended to all function paths (optional, default `null`)\n\nReturns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\u003e** array of function information elements, one for each function encountered\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Fah-preprocessors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodesource%2Fah-preprocessors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Fah-preprocessors/lists"}