{"_id":"@dxatscale/sfdc-soup","_rev":"13-f078e32d3f4ef32e24f42d50bc2ee1e6","name":"@dxatscale/sfdc-soup","dist-tags":{"latest":"18.2.3","refs/heads/develop":"18.2.6","refs/heads/main":"19.0.0"},"versions":{"18.2.2":{"name":"@dxatscale/sfdc-soup","version":"18.2.2","description":"A simple API to view your Salesforce dependencies, powered by HappySoup.io","main":"src/index.js","scripts":{"start":"node examples/example.js","test":"echo \"Error: no test specified\" && exit 1","update-api":"npm install sfdc-happy-api@latest && npm version minor && git commit -a -m \"updated api\" && npm publish"},"repository":{"type":"git","url":"git+https://github.com/dxatscale/sfdc-soup.git"},"keywords":["salesforce"],"author":{"name":"dxatscale"},"license":"MIT","bugs":{"url":"https://github.com/dxatscale/sfdc-soup/issues"},"dependencies":{"dotenv":"^8.2.0","fast-xml-parser":"3.18.0","@dxatscale/forcemula":"0.1.2","node-fetch":"^2.6.0","sf-standard-field-dependency":"2.0.0","sfdc-happy-api":"3.0.0","strip-comments":"2.0.1"},"homepage":"https://github.com/dxatscale/sfdc-soup#readme","gitHead":"2456bb223ce5de42a02e4231bfa90f0948281ad6","_id":"@dxatscale/sfdc-soup@18.2.2","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-8issQ6k6xMWbpWD8ZGJ47hGaJnWwFl7TWELkLpVQoEH3ItyNVDnAAPMMVvCIfIemB1/0QEGaQE5hIhvetggxgg==","shasum":"d5fadcf5a098cc896677ea889384f2959896b8d9","tarball":"https://registry.npmjs.org/@dxatscale/sfdc-soup/-/sfdc-soup-18.2.2.tgz","fileCount":27,"unpackedSize":473755,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDdh5RxgF6BUqg1N+6S9jJaNs92Dk4TU7IoqjcJy4gp2gIhAI38RxDSe30EolY4FuxPAIgnQzV1PCOw/dGqABtEvs5N"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJirAp6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoJ5A//R42eTBtyKYB362tKNuh9UquwA5i4+1oTni2bi0Zo58lXRUxo\r\nRaup/fwdcrRrTJoGmm78dYxnLOXqYGHyTzQ3yS9kGYPVJQx8/jLs0zJi8NFW\r\nuCljCqnpNHSZEaM2TmrBHDs7V93KIWRVQdBU6RDlrvBJMZHqFGw8UYTxeGHg\r\ngspqGJdYgz1aDrOyHm6vELOTYRe1MasP0wez7cQakGqNi4FeaKGfcotEMadA\r\ny9HFYLgY6dlgoXvF9YVaeQO+Z2OeVq0oP+/pVhdO6KfB+i0cVSwjUaHBXbU0\r\n4HsjKP8fpldeelSxxsQyhZbQyOljUkR1lV4cjkHGHF/8nL3dtSnScYtUHhJu\r\n1iiaxNBbgtVGmBNOAT4TU+bpBuX1RPuT9wPHyFJvGAbbOfD1Q+ijIkJUpqsO\r\nkNfgbOnFrFvPsLaARjEpmS8TMvTZyDovysuqV87n6jQ78ZFND+BEECuhJfMw\r\nF+CRonaNRHzt8U1KH81jKspOdqqmUS2DYtJBVrD0RHpgQl/W1FRHo9/6Zznk\r\nuSrG67mX5n2tXbzs67FnX6hPxsrcR6SO2IDDHXxlVziO0zegxVXtDY8XJCVP\r\ny77/i7waNXhTjVh0uy4WBxW00nEEKu/Y+GPbo/sCY5LfZG8sypFjChjrrZTV\r\n6rkPCMRNsSzwwOiPqY2uuFncpl1JJHXUw3g=\r\n=zPS2\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"sfpower","email":"dxatscale@accenture.com"},"directories":{},"maintainers":[{"name":"azlamsalam","email":"azlam.salam@outlook.com"},{"name":"azlam-acn","email":"azlam.abdulsalam@accenture.com"},{"name":"sivanand.jothy","email":"sivanand.jothy@accenture.com"},{"name":"vuha","email":"vu.ha@accenture.com"},{"name":"genoud","email":"magloiredjatio@gmail.com"},{"name":"raakr","email":"ramzi.akremi@me.com"},{"name":"rawdee","email":"rodolphe.blancho@gmail.com"},{"name":"nbatterham","email":"nathan.batterham@accenture.com"},{"name":"sanjaymani654","email":"manivasaga.murugesan@accenture.com"},{"name":"alanly","email":"alan.ly@accenture.com"},{"name":"sfpower","email":"dxatscale@accenture.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfdc-soup_18.2.2_1655442041983_0.06070068203418133"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"18.2.3":{"name":"@dxatscale/sfdc-soup","version":"18.2.3","description":"A simple API to view your Salesforce dependencies, powered by HappySoup.io","main":"src/index.js","scripts":{"start":"node examples/example.js","test":"echo \"Error: no test specified\" && exit 1","update-api":"npm install sfdc-happy-api@latest && npm version minor && git commit -a -m \"updated api\" && npm publish"},"repository":{"type":"git","url":"git+https://github.com/dxatscale/sfdc-soup.git"},"keywords":["salesforce"],"author":{"name":"dxatscale"},"license":"MIT","bugs":{"url":"https://github.com/dxatscale/sfdc-soup/issues"},"dependencies":{"dotenv":"^8.2.0","fast-xml-parser":"3.18.0","@dxatscale/forcemula":"0.1.2","node-fetch":"^2.6.0","sf-standard-field-dependency":"2.0.0","sfdc-happy-api":"3.0.0","strip-comments":"2.0.1"},"homepage":"https://github.com/dxatscale/sfdc-soup#readme","gitHead":"22d61123882270958362f4dea81283d121e5b8ea","_id":"@dxatscale/sfdc-soup@18.2.3","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-aSls6UW3tkozcaa0ihqgwRuL7xvo+eGcXzh240UvkBx+TxXns2HUDgxu/ShJJcBXHBq1EtKGlxsK7DBN82iuvQ==","shasum":"6f96cedd558fadcf7b917f2f8790d27f3b8907c0","tarball":"https://registry.npmjs.org/@dxatscale/sfdc-soup/-/sfdc-soup-18.2.3.tgz","fileCount":27,"unpackedSize":473766,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD06dA0AcOOlkQT/CW5ClV29VICGXtuBBdcp4xJxwzc1QIhAIrAx/jWhj1CKjNPgBszRnuqVC+ZS90YNAzd2PSKtTOM"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJisCP9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrqRg//bTa06J+G+KdcvWqaRvS6NH0vlqxsDSzDBudfegoRPK2cfzdO\r\nLnImM7UJ1+iQf6scEAq2RpuNqPf1fxvkM9Ju40Em6bTQAovJ1l0O4ex0f1lK\r\nFnBIwqAxgUftdXRb6YjHeFfZSC0ARczZ+Ywg21FvL5NajMt5I+0lmzeVenSG\r\nRaB3qpouE8TduB1c6XPPk9x6jiGqAdt5VPBKWfcgAudAe6Y2DzTAYLolCBGU\r\nnhQDtnQcBvWZOsfOujfI+whkl8wgWi2XoEik5fNVgwHnDZGV7siYx0z2RSPm\r\nKC0UNJaDOTxVpbiAeJimue76XTYhXaSWtpB4rlyIdjt9JER45oKUbmPQDXM9\r\nu/Lqym1qY0P98rx7B2osCUVyD31JbsKHvQgbcima8PBN2309WK81wgm/G7Pe\r\nxiSvIACVlXFWIhKAwseUPbimSoIz9hBJuFy2/f3NeQ7ItZUeV6HB9UoxiF4j\r\nxZDX3220dehIRWTkp/AfgHrwpjZcTsvJ+JVKvEJthbt2kb3r5CD57BwNceRb\r\n7A2ywhC4jCPLsFwFEjTVCceCZspGRc7oCb53UmaxnsJlKq7+iG5plnVoD3+P\r\nGxiJYEATAhye3y0HEwzxSRIWaCMiqMfZuHOurlAFnaXDuPG21URXhk1oyzZx\r\nuNG8WdJmhJxAXnuN3mUjUped3RVI0cehKFg=\r\n=XY0J\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"sfpower","email":"dxatscale@accenture.com"},"directories":{},"maintainers":[{"name":"azlamsalam","email":"azlam.salam@outlook.com"},{"name":"azlam-acn","email":"azlam.abdulsalam@accenture.com"},{"name":"sivanand.jothy","email":"sivanand.jothy@accenture.com"},{"name":"vuha","email":"vu.ha@accenture.com"},{"name":"genoud","email":"magloiredjatio@gmail.com"},{"name":"raakr","email":"ramzi.akremi@me.com"},{"name":"rawdee","email":"rodolphe.blancho@gmail.com"},{"name":"nbatterham","email":"nathan.batterham@accenture.com"},{"name":"sanjaymani654","email":"manivasaga.murugesan@accenture.com"},{"name":"alanly","email":"alan.ly@accenture.com"},{"name":"sfpower","email":"dxatscale@accenture.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfdc-soup_18.2.3_1655710717102_0.04755879730476398"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"18.2.4":{"name":"@dxatscale/sfdc-soup","version":"18.2.4","description":"A simple API to view your Salesforce dependencies, powered by HappySoup.io","main":"src/index.js","scripts":{"start":"node examples/example.js","test":"echo \"Error: no test specified\"","update-api":"npm install sfdc-happy-api@latest && npm version minor && git commit -a -m \"updated api\" && npm publish"},"repository":{"type":"git","url":"git+https://github.com/dxatscale/sfdc-soup.git"},"keywords":["salesforce"],"author":{"name":"dxatscale"},"license":"MIT","bugs":{"url":"https://github.com/dxatscale/sfdc-soup/issues"},"dependencies":{"@dxatscale/forcemula":"0.1.2","dotenv":"^8.2.0","fast-xml-parser":"3.18.0","node-fetch":"^2.6.0","sf-standard-field-dependency":"2.0.0","sfdc-happy-api":"3.0.0","strip-comments":"2.0.1"},"homepage":"https://github.com/dxatscale/sfdc-soup#readme","gitHead":"73d9b85ee66de18861e909279818b30447c96e6b","readme":"# sfdc-soup\n## A simple API to understand your Salesforce dependencies\n\n### Forked from https://github.com/pgonzaleznetwork/sfdc-soup for faster dependency updates for @dxatscale libs.  Feature Requests issues will be maintained in original sfdc-soup\n\n`sfdc-soup` is the NPM library that powers the [Salesforce Happy Soup](https://github.com/pgonzaleznetwork/sfdc-happy-soup#the-best-way-to-visualize-your-salesforce-dependencies). \n\nIt is simple API that allows you to see usage (i.e \"where is this used?\") and dependency (aka [deployment boundaries](https://github.com/pgonzaleznetwork/sfdc-happy-soup#deployment-boundaries)) information of a metadata member in your Salesforce org.\n\nThis information is provided in 4 different formats:\n\n* **Excel and CSV** Perfect for sharing with other members of the team and brainstorming (for example when deciding how to optimize a page layout that has too many fields).\n* **JSON tree** Useful to build tree-like UIs like the one seen on [Salesforce Happy Soup](https://github.com/pgonzaleznetwork/sfdc-happy-soup#the-best-way-to-visualize-your-salesforce-dependencies)\n* **package.xml** So that you can immediately retrieve your deployment boundary and create a scratch org or unlocked package.\n* **Stats** A simple object counting how many members of a specific metadata type are referenced. Useful for building UI dashboards.\n\n```javascript\n\nlet standardField = {\n    name:'Opportunity.StageName',\n    type:'StandardField',\n    id:'Opportunity.StageName',\n}\n\nlet soupApi = sfdcSoup(connection,standardField);\n\nlet usageResponse = await soupApi.getUsage();\nlet dependencyResponse = await soupApi.getDependencies();\n\nfs.writeFileSync('examples/usage.json',JSON.stringify(usageResponse.usageTree));\nfs.writeFileSync('examples/dependencies.json',JSON.stringify(dependencyResponse.dependencyTree));\n\n\n```\n\n<p align=\"center\">\n  <img src=\"./github-images/sampleresponse.png\" >\n</p>\n\n## Contents\n\n- [sfdc-soup](#sfdc-soup)\n  - [A simple API to understand your Salesforce dependencies](#a-simple-api-to-understand-your-salesforce-dependencies)\n    - [Forked from https://github.com/pgonzaleznetwork/sfdc-soup for faster dependency updates for @dxatscale libs.  Feature Requests issues will be maintained in original sfdc-soup](#forked-from-httpsgithubcompgonzaleznetworksfdc-soup-for-faster-dependency-updates-for-dxatscale-libs--feature-requests-issues-will-be-maintained-in-original-sfdc-soup)\n  - [Contents](#contents)\n  - [Installation](#installation)\n  - [How to use](#how-to-use)\n  - [Exploring the response](#exploring-the-response)\n    - [`packageXml`](#packagexml)\n    - [`dependencyTree`](#dependencytree)\n    - [`stats`](#stats)\n    - [`csv` and `excel`](#csv-and-excel)\n  - [Pills](#pills)\n  - [EntryPoint Options](#entrypoint-options)\n  - [Support and help](#support-and-help)\n\n\n## Installation\n\nIn your NPM application folder, run the following command\n\n`npm install sfdc-soup`\n\nOnce you have installed the module in your own NPM project, you can import it in this way\n\n```javascript\nconst sfdcSoup = require('sfdc-soup');\n```\n\n## How to use\n\nBefore using the API, you must have an `entryPoint` and `connection` objects.\n\n**Entry Point**\n\nThe `entryPoint` is an object with 3 properties, all of which represent the entry point of the dependency tree. For example\n\n```javascript\n/**\n* @name The API name of the metadata member\n* @type The metadata type. It must match the Metadata API naming conventions\n* @id The 18-digit id. The 15 digit one will NOT work\n*/\nlet entryPoint = {\n    name:'TranslationsMerger_LEX_Controller',\n    type:'ApexClass',\n    id:'01p0O00000CBlzZQAT'\n}\n```\n\nHow your construct this object is not a concern of `sfdc-soup`. Your application must use the relevant Salesforce APIs to get this information.\n\n**Connection**\n\nThe `connection` is also an object with 3 properties that represent a valid API session with any given salesforce org. For example\n\n```javascript\n/**\n* @token A session id or oauth token with API access\n* @url Your instance url i.e login.salesforce.com or mydomain.my.salesforce.com\n* @apiVersion the version of the Salesforce API. If not specified or if it's lower than 49.0, we use 50.0 by default\n*/\nlet connection = {\n    token: '00D0O000000Z9Ab!AQMAQMRoLQKh_uBxWEvz3as7V...',\n    url:'https://resourceful-moose-448750-dev-ed.my.salesforce.com',\n    apiVersion:'49.0'\n};\n```\n\nHow your construct this object is not a concern of `sfdc-soup`. Your application must use the relevant Salesforce APIs to get this information.\n\n\n**Getting usage information**\n\nTo see where a metadata member is used, use the usageApi provided by `sfdc-soup` as follows\n\n```javascript \n//async function\nlet soupApi = sfdcSoup(connection,entryPoint);\nlet usageResponse = await soupApi.getUsage();\n```\n\n```javascript \n//standard promise syntax\nlet soupApi = sfdcSoup(connection,entryPoint);\nsoupApi.getUsage().then(response => console.log(response));\n```\n\n**Getting dependency information (deployment boundary)**\n\nTo see the [deployment boundary](https://github.com/pgonzaleznetwork/sfdc-happy-soup#deployment-boundaries) of a metadata member, use the dependencyApi provided by `sfdc-soup` as follows\n\n```javascript \n//async function\nlet soupApi = sfdcSoup(connection,standardField);\nlet dependencyResponse = await soupApi.getDependencies();\n```\n\n```javascript \n//standard promise syntax\nlet soupApi = sfdcSoup(connection,standardField);\nsoupApi.getDependencies().then(response => console.log(response));\n```\n\n[Back to top](#sfdc-soup)\n\n## Exploring the response\n\nBoth the `usageApi` and `dependencyApi` provide the exact same properties in their response. Here we'll show the response properties of the `dependencyApi` simply because that is the most interesting one.\n\n### `packageXml`\n\nThe `packageXml` property provides a string representing the package.xml required to retrieve all the metadata members from your org. The metadata members are those in the deploment boundary as well as the entry point.\n\nIt can be accessed via `dependencyResponse.packageXml`\n\n\n```javascript\n \"packageXml\": \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n        <Package xmlns=\\\"http://soap.sforce.com/2006/04/metadata\\\"><types><members>Translation_Context__c.Context_Type__c\n </members><members>Translation_Context__c.Record_Link__c</members><members>Translation_Key__c.Default_Label__c</members><members>Translation_Key__c.Key__c\n </members><members>Translation_Key__c.Translation_Context__c</members></types><version>49.0</version>\\n        </Package>\",\n```\n\n### `dependencyTree`\n\nThe `dependencyTree` property is a JSON tree reprensenting the entire deployment boundary, where the entryPoint is the top key of the tree.\n\nEvery time a metadata member references (or depends on) another set of metadata, the tree expands via a `references` property on the metadata member.\n\n```javascript\n\"dependencyTree\": {\n        \"TranslationsMerger_LEX_Controller\": {\n            \"references\": {\n                \"CustomField\": [\n                    {\n                        \"name\": \"Translation_Context__c.Context_Type__c\",\n                        \"type\": \"CustomField\",\n                        \"id\": \"00N0O00000GJnhoUAD\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhoUAD\",\n                        \"notes\": null,\n                        \"namespace\": null\n                    },\n                    {\n                        \"name\": \"Translation_Context__c.Record_Link__c\",\n                        \"type\": \"CustomField\",\n                        \"id\": \"00N0O00000GJnhjUAD\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhjUAD\",\n                        \"notes\": null,\n                        \"namespace\": null\n                    }\n                ],\n                \"CustomObject\": [\n                    {\n                        \"name\": \"Translation_Context__c\",\n                        \"type\": \"CustomObject\",\n                        \"id\": \"01I0O000000bVd8UAE\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/01I0O000000bVd8UAE\",\n                        \"notes\": null,\n                        \"namespace\": null,\n                        \"references\": {\n                            \"FlexiPage\": [\n                                {\n                                    \"name\": \"Translation_Context_Record_Page\",\n                                    \"type\": \"FlexiPage\",\n                                    \"id\": \"0M00O000000YF9SSAW\",\n                                    \"repeated\": false,\n                                    \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/0M00O000000YF9SSAW\",\n                                    \"notes\": null,\n                                    \"namespace\": null,\n                                    \"referencedBy\": {\n                                        \"name\": \"Translation_Context__c\",\n                                        \"id\": \"01I0O000000bVd8UAE\",\n                                        \"type\": \"CustomObject\"\n                                    }\n                                }\n                            ]\n                        }\n                    }\n                ],\n                \"ApexClass\": [\n                    {\n                        \"name\": \"TranslationFileBuilder\",\n                        \"type\": \"ApexClass\",\n                        \"id\": \"01p0O00000CBltlQAD\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/01p0O00000CBltlQAD\",\n                        \"notes\": null,\n                        \"namespace\": null,\n                        \"references\": {\n                            \"CustomField\": [\n                                {\n                                    \"name\": \"Translation_Key__c.Type__c\",\n                                    \"type\": \"CustomField\",\n                                    \"id\": \"00N0O00000GJmhdUAD\",\n                                    \"repeated\": false,\n                                    \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJmhdUAD\",\n                                    \"notes\": null,\n                                    \"namespace\": null,\n                                    \"referencedBy\": {\n                                        \"name\": \"TranslationFileBuilder\",\n                                        \"id\": \"01p0O00000CBltlQAD\",\n                                        \"type\": \"ApexClass\"\n                                    }\n                                }\n```\n\n**NOTE**: In the `usageApi` this property is called `usageTree`.\n\n[Back to top](#sfdc-soup)\n\n### `stats`\n\nThe  `stats` object is the output of a `reducer` function. You can use this to know how many metadata members are using or are being used by a specific metadata member.\n\n```javascript\n\"stats\": {\n        \"CustomField\": 6,\n        \"CustomObject\": 2,\n        \"ApexClass\": 2,\n        \"FlexiPage\": 1\n    }\n```\n\nYou could also use this information to build charts with javascript\n\n### `csv` and `excel`\n\nThese two properties return a string representing all the metadata members in either `csv` or `excel` format. \n\n```csv\n\"Name,Metadata Type,Id,Url,Used by,\n\"Translation_Context__c.Record_Link__c\"\"CustomField\\\",\"00N0O00000GJnhjUAD\\\",\n\"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhjUAD\\\",\n\\\"TranslationsMerger_LEX_Controller via TranslationsMerger_LEX_Controller\\\",\n\\r\\n\\\"Translation_Context__c.Context_Type__c\\\",\\\"CustomField\\\",\\\"00N0O00000GJnhoUAD\\\",\\\"https://\nresourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhoUAD\\\",\n\\\"TranslationsMerger_LEX_Controller via TranslationsMerger_LEX_Controller\\\",\n\\r\\n\\\"Translation_Context__c\\\",\\\"CustomObject\\\",\\\"01I0O000000bVd8UAE\\\",\\\"https://\nresourceful-moose-448750-dev-ed.my.salesforce.com/01I0O000000bVd8UAE\\\",\\\"TranslationsMerger_LEX_Controller via TranslationsMerger_LEX_Controller\\\"\n\n```\n\n[Back to top](#sfdc-soup)\n\n## Pills\n\nWhen using the `usageApi`, the metadata types will return a `pills` object that contains additional information about the metadata type and how it is referencing the entry point in question.\n\nYour client code should check if the `pills` object is populated (i.e if it has keys) and if so, display them in your UI.\n\nHere's an example of how the `pills` object shows whether a custom field is being used for reading or writing (assignment) in an apex class\n\n```javascript\n \"ApexClass\": [\n        {\n            \"name\": \"ClassWritingToField\",\n            \"type\": \"ApexClass\",\n            \"id\": \"01p3h00000FHNeiAAH\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/01p3h00000FHNeiAAH\",\n            \"notes\": null,\n            \"namespace\": null,\n            \"pills\": [\n                {\n                    \"label\": \"write\",\n                    \"color\": \"#d63031\"\n                }\n            ],\n            \"sortOrder\": 1\n        },\n        {\n            \"name\": \"ClassReadingField\",\n            \"type\": \"ApexClass\",\n            \"id\": \"01p3h00000FHNedAAH\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/01p3h00000FHNedAAH\",\n            \"notes\": null,\n            \"namespace\": null,\n            \"pills\": [\n                {\n                    \"label\": \"read\",\n                    \"color\": \"#3c9662\"\n                }\n            ],\n            \"sortOrder\": 2\n        }\n```\n\n[Back to top](#sfdc-soup)\n\n## EntryPoint Options\n\nWhen using the `usageApi` some metadata types support additional information that is not returned by the API unless explictly requested.\n\nConsider the following example\n\n```javascript\nlet customField = {\n    name:'Account.CustomerPriority__c',\n    type:'CustomField',\n    id:'00N3h00000DdZSIEA3',\n    options:{\n        'enhancedReportData':true,\n        'fieldInMetadataTypes':true\n    }\n}\n```\n\nWith the additional options object, the API response will provide the following info:\n\n`enhancedReportData`\n\nThis will tell you exactly how a field is used in a report; whether it's just a column, a filter or perhaps a grouping. To protect your API limits, this information is only available for the first 100 reports that are using the field. \n\n The data can be found in the `pills` object of the response. \n\nHere's an example where the field is being used as both a filter and a grouping in the same report. Notice that the filter includes information on what the actual filter value is.\n\nThis can be very useful when determining if it's safe to modify a picklist value, as doing so could break some reports. \n\n```javascript\n\"Report\": [\n        {\n            \"name\": \"Report_being_used\",\n            \"type\": \"Report\",\n            \"id\": \"00O3h0000049mk4EAA\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/00O3h0000049mk4EAA\",\n            \"notes\": null,\n            \"namespace\": null,\n            \"pills\": [\n                {\n                    \"label\": \"Grouping\",\n                    \"color\": \"#d63031\"\n                },\n                {\n                    \"label\": \"Filter: equals Low\",\n                    \"color\": \"#d63031\"\n                }\n            ],\n            \"sortOrder\": 1\n        }\n```\n\n`fieldInMetadataTypes`\n\nThis will check if the field is being referenced in custom fields of custom metadata types, where the field type is `Metadata Relationship(Field Definition)`\n\nThis particular option does not add additional information to the `pills` object but instead returns a brand new metadata type on the response. \n\n```javascript\n\"SRM_Metadata_Conflict_Warning__mdt\": [\n        {\n            \"name\": \"Default (from SRM_Field__c)\",\n            \"type\": \"SRM_Metadata_Conflict_Warning__mdt\",\n            \"id\": \"m013h000000BRlrAAG\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/m013h000000BRlrAAG\",\n            \"notes\": null,\n            \"pills\": []\n        }\n    ],\n    \"Field_referencing__mdt\": [\n        {\n            \"name\": \"my_metadata (from Related_Field__c)\",\n            \"type\": \"Field_referencing__mdt\",\n            \"id\": \"m043h000000lprZAAQ\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/m043h000000lprZAAQ\",\n            \"notes\": null,\n            \"pills\": []\n        }\n    ]\n```\n\n\n\n[Back to top](#sfdc-soup)\n\n## Support and help\n\nFeel free to contact me at pgonzaleznetwork@gmail.com or log a github issue. ","readmeFilename":"README.md","_id":"@dxatscale/sfdc-soup@18.2.4","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.1/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-rqla00eoYXqKr17KdvV61BE/acpzQxf3inCAudjoV2+jLBQ/Oy9vvyDoBljn71l8rR2FToZgXBc74oIyE2QMSw==","shasum":"e58a923e97bf0d8b9a50c59929c6f414ea40b2c8","tarball":"https://registry.npmjs.org/@dxatscale/sfdc-soup/-/sfdc-soup-18.2.4.tgz","fileCount":26,"unpackedSize":473136,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDUttyIbJ9dpucIfUi8/UAfXRstTcMQknn0OTqqIOcSEAiEAhxrPiq0SASpj54P0okrfBcCI5giRnjn+j3BCsG8NvHc="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjH9iSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo9bQ/9F4KFuMiKNU1rUTiLlrAY7HYIlI2J7IgjzrCJZ4RnTKhFNqo1\r\nGhaBXfnrzXE6pewaSFuZAil4nBUrGTtA0DtaZckC6hlL43D8Z7ZYBowdtnwX\r\nnAkH2w0hpNkX7daCglMwhjWifMSCS3BaQhz54lOTQxOT/M+xZYu31/kRiaiM\r\nBWKhzbv8N1OwC0iWF4SkG25A7TFVxJw2CcXclwOOCBiWUwI3xv6Dy1hWuTNg\r\n7r8jmXwLWxOsxUjCqMoQinRUAcolG4TlflyFn4tAnYFwRHobuOHbyOQ4tOD0\r\nfiuLx/8pe8kKLsQ/Pxz5MNsRqUNAgcbqG3xXLzsJgMP1X4SBAnr+F145DtDB\r\np/hzznOj5YOUIg2kCBDFHR+iw2DNa3pCnOIVwqBnEN6+TigGBsFm9rhRfKyd\r\nhJEN92utqnEZ3y+4hVVcjg7aEHLq6c9ac6VjHrPLNdTQLUf5pnLCl6ykkbUK\r\n3LjqtSYJhv1yFmY7/mIGCT/y+ZQwUcQXraAhQj/QgdqJKnqQJIWnqxHamXu9\r\ncU6xWcJt1Q5o5TllcGlDw+HhNm8WR9JJAcS08rxBNAfrlUXBRbZK8DuKcO2P\r\nJUaxycRYsjUa7KJxZs7w5NVv3hgVigOB6fhQzusIP4iS1ShUW9SzYPvygxaF\r\n1nuDtCMbxV+ehHoERkCN5qT3Y/++72KHmGg=\r\n=CE7j\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"sfpower","email":"dxatscale@accenture.com"},"directories":{},"maintainers":[{"name":"azlamsalam","email":"azlam.salam@outlook.com"},{"name":"azlam-acn","email":"azlam.abdulsalam@accenture.com"},{"name":"sivanand.jothy","email":"sivanand.jothy@accenture.com"},{"name":"vuha","email":"vu.ha@accenture.com"},{"name":"genoud","email":"magloiredjatio@gmail.com"},{"name":"raakr","email":"ramzi.akremi@me.com"},{"name":"rawdee","email":"rodolphe.blancho@gmail.com"},{"name":"nbatterham","email":"nathan.batterham@accenture.com"},{"name":"sanjaymani654","email":"manivasaga.murugesan@accenture.com"},{"name":"alanly","email":"alan.ly@accenture.com"},{"name":"sfpower","email":"dxatscale@accenture.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfdc-soup_18.2.4_1663031441836_0.7431248497545506"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"18.2.5":{"name":"@dxatscale/sfdc-soup","version":"18.2.5","description":"A simple API to view your Salesforce dependencies, powered by HappySoup.io","main":"src/index.js","scripts":{"start":"node examples/example.js","test":"echo \"Error: no test specified\"","update-api":"npm install sfdc-happy-api@latest && npm version minor && git commit -a -m \"updated api\" && npm publish"},"repository":{"type":"git","url":"git+https://github.com/dxatscale/sfdc-soup.git"},"keywords":["salesforce"],"author":{"name":"dxatscale"},"license":"MIT","bugs":{"url":"https://github.com/dxatscale/sfdc-soup/issues"},"dependencies":{"@dxatscale/forcemula":"0.1.2","dotenv":"^8.2.0","fast-xml-parser":"3.18.0","node-fetch":"^2.6.0","sf-standard-field-dependency":"2.0.0","sfdc-happy-api":"3.0.0","strip-comments":"2.0.1"},"homepage":"https://github.com/dxatscale/sfdc-soup#readme","gitHead":"21731f1efa04515034b61ef8599741e303442ea1","readme":"# sfdc-soup\n## A simple API to understand your Salesforce dependencies\n\n### Forked from https://github.com/pgonzaleznetwork/sfdc-soup for faster dependency updates for @dxatscale libs.  Feature Requests issues will be maintained in original sfdc-soup\n\n`sfdc-soup` is the NPM library that powers the [Salesforce Happy Soup](https://github.com/pgonzaleznetwork/sfdc-happy-soup#the-best-way-to-visualize-your-salesforce-dependencies). \n\nIt is simple API that allows you to see usage (i.e \"where is this used?\") and dependency (aka [deployment boundaries](https://github.com/pgonzaleznetwork/sfdc-happy-soup#deployment-boundaries)) information of a metadata member in your Salesforce org.\n\nThis information is provided in 4 different formats:\n\n* **Excel and CSV** Perfect for sharing with other members of the team and brainstorming (for example when deciding how to optimize a page layout that has too many fields).\n* **JSON tree** Useful to build tree-like UIs like the one seen on [Salesforce Happy Soup](https://github.com/pgonzaleznetwork/sfdc-happy-soup#the-best-way-to-visualize-your-salesforce-dependencies)\n* **package.xml** So that you can immediately retrieve your deployment boundary and create a scratch org or unlocked package.\n* **Stats** A simple object counting how many members of a specific metadata type are referenced. Useful for building UI dashboards.\n\n```javascript\n\nlet standardField = {\n    name:'Opportunity.StageName',\n    type:'StandardField',\n    id:'Opportunity.StageName',\n}\n\nlet soupApi = sfdcSoup(connection,standardField);\n\nlet usageResponse = await soupApi.getUsage();\nlet dependencyResponse = await soupApi.getDependencies();\n\nfs.writeFileSync('examples/usage.json',JSON.stringify(usageResponse.usageTree));\nfs.writeFileSync('examples/dependencies.json',JSON.stringify(dependencyResponse.dependencyTree));\n\n\n```\n\n<p align=\"center\">\n  <img src=\"./github-images/sampleresponse.png\" >\n</p>\n\n## Contents\n\n- [sfdc-soup](#sfdc-soup)\n  - [A simple API to understand your Salesforce dependencies](#a-simple-api-to-understand-your-salesforce-dependencies)\n    - [Forked from https://github.com/pgonzaleznetwork/sfdc-soup for faster dependency updates for @dxatscale libs.  Feature Requests issues will be maintained in original sfdc-soup](#forked-from-httpsgithubcompgonzaleznetworksfdc-soup-for-faster-dependency-updates-for-dxatscale-libs--feature-requests-issues-will-be-maintained-in-original-sfdc-soup)\n  - [Contents](#contents)\n  - [Installation](#installation)\n  - [How to use](#how-to-use)\n  - [Exploring the response](#exploring-the-response)\n    - [`packageXml`](#packagexml)\n    - [`dependencyTree`](#dependencytree)\n    - [`stats`](#stats)\n    - [`csv` and `excel`](#csv-and-excel)\n  - [Pills](#pills)\n  - [EntryPoint Options](#entrypoint-options)\n  - [Support and help](#support-and-help)\n\n\n## Installation\n\nIn your NPM application folder, run the following command\n\n`npm install sfdc-soup`\n\nOnce you have installed the module in your own NPM project, you can import it in this way\n\n```javascript\nconst sfdcSoup = require('sfdc-soup');\n```\n\n## How to use\n\nBefore using the API, you must have an `entryPoint` and `connection` objects.\n\n**Entry Point**\n\nThe `entryPoint` is an object with 3 properties, all of which represent the entry point of the dependency tree. For example\n\n```javascript\n/**\n* @name The API name of the metadata member\n* @type The metadata type. It must match the Metadata API naming conventions\n* @id The 18-digit id. The 15 digit one will NOT work\n*/\nlet entryPoint = {\n    name:'TranslationsMerger_LEX_Controller',\n    type:'ApexClass',\n    id:'01p0O00000CBlzZQAT'\n}\n```\n\nHow your construct this object is not a concern of `sfdc-soup`. Your application must use the relevant Salesforce APIs to get this information.\n\n**Connection**\n\nThe `connection` is also an object with 3 properties that represent a valid API session with any given salesforce org. For example\n\n```javascript\n/**\n* @token A session id or oauth token with API access\n* @url Your instance url i.e login.salesforce.com or mydomain.my.salesforce.com\n* @apiVersion the version of the Salesforce API. If not specified or if it's lower than 49.0, we use 50.0 by default\n*/\nlet connection = {\n    token: '00D0O000000Z9Ab!AQMAQMRoLQKh_uBxWEvz3as7V...',\n    url:'https://resourceful-moose-448750-dev-ed.my.salesforce.com',\n    apiVersion:'49.0'\n};\n```\n\nHow your construct this object is not a concern of `sfdc-soup`. Your application must use the relevant Salesforce APIs to get this information.\n\n\n**Getting usage information**\n\nTo see where a metadata member is used, use the usageApi provided by `sfdc-soup` as follows\n\n```javascript \n//async function\nlet soupApi = sfdcSoup(connection,entryPoint);\nlet usageResponse = await soupApi.getUsage();\n```\n\n```javascript \n//standard promise syntax\nlet soupApi = sfdcSoup(connection,entryPoint);\nsoupApi.getUsage().then(response => console.log(response));\n```\n\n**Getting dependency information (deployment boundary)**\n\nTo see the [deployment boundary](https://github.com/pgonzaleznetwork/sfdc-happy-soup#deployment-boundaries) of a metadata member, use the dependencyApi provided by `sfdc-soup` as follows\n\n```javascript \n//async function\nlet soupApi = sfdcSoup(connection,standardField);\nlet dependencyResponse = await soupApi.getDependencies();\n```\n\n```javascript \n//standard promise syntax\nlet soupApi = sfdcSoup(connection,standardField);\nsoupApi.getDependencies().then(response => console.log(response));\n```\n\n[Back to top](#sfdc-soup)\n\n## Exploring the response\n\nBoth the `usageApi` and `dependencyApi` provide the exact same properties in their response. Here we'll show the response properties of the `dependencyApi` simply because that is the most interesting one.\n\n### `packageXml`\n\nThe `packageXml` property provides a string representing the package.xml required to retrieve all the metadata members from your org. The metadata members are those in the deploment boundary as well as the entry point.\n\nIt can be accessed via `dependencyResponse.packageXml`\n\n\n```javascript\n \"packageXml\": \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n        <Package xmlns=\\\"http://soap.sforce.com/2006/04/metadata\\\"><types><members>Translation_Context__c.Context_Type__c\n </members><members>Translation_Context__c.Record_Link__c</members><members>Translation_Key__c.Default_Label__c</members><members>Translation_Key__c.Key__c\n </members><members>Translation_Key__c.Translation_Context__c</members></types><version>49.0</version>\\n        </Package>\",\n```\n\n### `dependencyTree`\n\nThe `dependencyTree` property is a JSON tree reprensenting the entire deployment boundary, where the entryPoint is the top key of the tree.\n\nEvery time a metadata member references (or depends on) another set of metadata, the tree expands via a `references` property on the metadata member.\n\n```javascript\n\"dependencyTree\": {\n        \"TranslationsMerger_LEX_Controller\": {\n            \"references\": {\n                \"CustomField\": [\n                    {\n                        \"name\": \"Translation_Context__c.Context_Type__c\",\n                        \"type\": \"CustomField\",\n                        \"id\": \"00N0O00000GJnhoUAD\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhoUAD\",\n                        \"notes\": null,\n                        \"namespace\": null\n                    },\n                    {\n                        \"name\": \"Translation_Context__c.Record_Link__c\",\n                        \"type\": \"CustomField\",\n                        \"id\": \"00N0O00000GJnhjUAD\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhjUAD\",\n                        \"notes\": null,\n                        \"namespace\": null\n                    }\n                ],\n                \"CustomObject\": [\n                    {\n                        \"name\": \"Translation_Context__c\",\n                        \"type\": \"CustomObject\",\n                        \"id\": \"01I0O000000bVd8UAE\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/01I0O000000bVd8UAE\",\n                        \"notes\": null,\n                        \"namespace\": null,\n                        \"references\": {\n                            \"FlexiPage\": [\n                                {\n                                    \"name\": \"Translation_Context_Record_Page\",\n                                    \"type\": \"FlexiPage\",\n                                    \"id\": \"0M00O000000YF9SSAW\",\n                                    \"repeated\": false,\n                                    \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/0M00O000000YF9SSAW\",\n                                    \"notes\": null,\n                                    \"namespace\": null,\n                                    \"referencedBy\": {\n                                        \"name\": \"Translation_Context__c\",\n                                        \"id\": \"01I0O000000bVd8UAE\",\n                                        \"type\": \"CustomObject\"\n                                    }\n                                }\n                            ]\n                        }\n                    }\n                ],\n                \"ApexClass\": [\n                    {\n                        \"name\": \"TranslationFileBuilder\",\n                        \"type\": \"ApexClass\",\n                        \"id\": \"01p0O00000CBltlQAD\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/01p0O00000CBltlQAD\",\n                        \"notes\": null,\n                        \"namespace\": null,\n                        \"references\": {\n                            \"CustomField\": [\n                                {\n                                    \"name\": \"Translation_Key__c.Type__c\",\n                                    \"type\": \"CustomField\",\n                                    \"id\": \"00N0O00000GJmhdUAD\",\n                                    \"repeated\": false,\n                                    \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJmhdUAD\",\n                                    \"notes\": null,\n                                    \"namespace\": null,\n                                    \"referencedBy\": {\n                                        \"name\": \"TranslationFileBuilder\",\n                                        \"id\": \"01p0O00000CBltlQAD\",\n                                        \"type\": \"ApexClass\"\n                                    }\n                                }\n```\n\n**NOTE**: In the `usageApi` this property is called `usageTree`.\n\n[Back to top](#sfdc-soup)\n\n### `stats`\n\nThe  `stats` object is the output of a `reducer` function. You can use this to know how many metadata members are using or are being used by a specific metadata member.\n\n```javascript\n\"stats\": {\n        \"CustomField\": 6,\n        \"CustomObject\": 2,\n        \"ApexClass\": 2,\n        \"FlexiPage\": 1\n    }\n```\n\nYou could also use this information to build charts with javascript\n\n### `csv` and `excel`\n\nThese two properties return a string representing all the metadata members in either `csv` or `excel` format. \n\n```csv\n\"Name,Metadata Type,Id,Url,Used by,\n\"Translation_Context__c.Record_Link__c\"\"CustomField\\\",\"00N0O00000GJnhjUAD\\\",\n\"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhjUAD\\\",\n\\\"TranslationsMerger_LEX_Controller via TranslationsMerger_LEX_Controller\\\",\n\\r\\n\\\"Translation_Context__c.Context_Type__c\\\",\\\"CustomField\\\",\\\"00N0O00000GJnhoUAD\\\",\\\"https://\nresourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhoUAD\\\",\n\\\"TranslationsMerger_LEX_Controller via TranslationsMerger_LEX_Controller\\\",\n\\r\\n\\\"Translation_Context__c\\\",\\\"CustomObject\\\",\\\"01I0O000000bVd8UAE\\\",\\\"https://\nresourceful-moose-448750-dev-ed.my.salesforce.com/01I0O000000bVd8UAE\\\",\\\"TranslationsMerger_LEX_Controller via TranslationsMerger_LEX_Controller\\\"\n\n```\n\n[Back to top](#sfdc-soup)\n\n## Pills\n\nWhen using the `usageApi`, the metadata types will return a `pills` object that contains additional information about the metadata type and how it is referencing the entry point in question.\n\nYour client code should check if the `pills` object is populated (i.e if it has keys) and if so, display them in your UI.\n\nHere's an example of how the `pills` object shows whether a custom field is being used for reading or writing (assignment) in an apex class\n\n```javascript\n \"ApexClass\": [\n        {\n            \"name\": \"ClassWritingToField\",\n            \"type\": \"ApexClass\",\n            \"id\": \"01p3h00000FHNeiAAH\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/01p3h00000FHNeiAAH\",\n            \"notes\": null,\n            \"namespace\": null,\n            \"pills\": [\n                {\n                    \"label\": \"write\",\n                    \"color\": \"#d63031\"\n                }\n            ],\n            \"sortOrder\": 1\n        },\n        {\n            \"name\": \"ClassReadingField\",\n            \"type\": \"ApexClass\",\n            \"id\": \"01p3h00000FHNedAAH\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/01p3h00000FHNedAAH\",\n            \"notes\": null,\n            \"namespace\": null,\n            \"pills\": [\n                {\n                    \"label\": \"read\",\n                    \"color\": \"#3c9662\"\n                }\n            ],\n            \"sortOrder\": 2\n        }\n```\n\n[Back to top](#sfdc-soup)\n\n## EntryPoint Options\n\nWhen using the `usageApi` some metadata types support additional information that is not returned by the API unless explictly requested.\n\nConsider the following example\n\n```javascript\nlet customField = {\n    name:'Account.CustomerPriority__c',\n    type:'CustomField',\n    id:'00N3h00000DdZSIEA3',\n    options:{\n        'enhancedReportData':true,\n        'fieldInMetadataTypes':true\n    }\n}\n```\n\nWith the additional options object, the API response will provide the following info:\n\n`enhancedReportData`\n\nThis will tell you exactly how a field is used in a report; whether it's just a column, a filter or perhaps a grouping. To protect your API limits, this information is only available for the first 100 reports that are using the field. \n\n The data can be found in the `pills` object of the response. \n\nHere's an example where the field is being used as both a filter and a grouping in the same report. Notice that the filter includes information on what the actual filter value is.\n\nThis can be very useful when determining if it's safe to modify a picklist value, as doing so could break some reports. \n\n```javascript\n\"Report\": [\n        {\n            \"name\": \"Report_being_used\",\n            \"type\": \"Report\",\n            \"id\": \"00O3h0000049mk4EAA\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/00O3h0000049mk4EAA\",\n            \"notes\": null,\n            \"namespace\": null,\n            \"pills\": [\n                {\n                    \"label\": \"Grouping\",\n                    \"color\": \"#d63031\"\n                },\n                {\n                    \"label\": \"Filter: equals Low\",\n                    \"color\": \"#d63031\"\n                }\n            ],\n            \"sortOrder\": 1\n        }\n```\n\n`fieldInMetadataTypes`\n\nThis will check if the field is being referenced in custom fields of custom metadata types, where the field type is `Metadata Relationship(Field Definition)`\n\nThis particular option does not add additional information to the `pills` object but instead returns a brand new metadata type on the response. \n\n```javascript\n\"SRM_Metadata_Conflict_Warning__mdt\": [\n        {\n            \"name\": \"Default (from SRM_Field__c)\",\n            \"type\": \"SRM_Metadata_Conflict_Warning__mdt\",\n            \"id\": \"m013h000000BRlrAAG\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/m013h000000BRlrAAG\",\n            \"notes\": null,\n            \"pills\": []\n        }\n    ],\n    \"Field_referencing__mdt\": [\n        {\n            \"name\": \"my_metadata (from Related_Field__c)\",\n            \"type\": \"Field_referencing__mdt\",\n            \"id\": \"m043h000000lprZAAQ\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/m043h000000lprZAAQ\",\n            \"notes\": null,\n            \"pills\": []\n        }\n    ]\n```\n\n\n\n[Back to top](#sfdc-soup)\n\n## Support and help\n\nFeel free to contact me at pgonzaleznetwork@gmail.com or log a github issue. ","readmeFilename":"README.md","_id":"@dxatscale/sfdc-soup@18.2.5","_nodeVersion":"16.18.1","_npmVersion":"lerna/6.1.0/node@v16.18.1+x64 (linux)","dist":{"integrity":"sha512-nF/62ENJsGEtWc2qs/yUAKu3xtQjVuI7X4no1+To5DITzjePNG9SIJjjFnTMuqTObPxlMvit4bkvHxdbNOu5Hw==","shasum":"a52c72081e5b33a95376316fc4e0100a831a77d7","tarball":"https://registry.npmjs.org/@dxatscale/sfdc-soup/-/sfdc-soup-18.2.5.tgz","fileCount":26,"unpackedSize":473136,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB+GEZU48SgizZSAJKwZ1WhjRstgVitsDczBanmfxmZpAiBtLy+OtELUD0RvAVsITURGoFQUcS9Li6OIjJUTJLJTeg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjkBO0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrzSA/5AeMWR96EehBZQ62aQOOkrlqR3zIGpp0vqQszwC3T+t76Q6CK\r\ngLQGMqh2YTr+OF+KR9BnpgHmlGUoXN7bLmVFIVWZ6JstSYcXK1vWYsXlVY/X\r\nGezIR1+tKfAQfqkFjdliPGbdHfcba8SkIQPNHjeKa6tKO8yl29vzyEQYbG97\r\nhOrknw+YCcYzbnhKbL1KudflxOzCIvja9+vrBJS2NZgyy1ujdxpeGgxPuJfv\r\npTg3QAoqo5e682Eb7ZMrMXYndtDl0Daz2N/I3aGvqcOWicGmMM30Jsk3tKfH\r\n5jp+bX0pQHptGFb6mYqhSZAV5A5jZGbkbv4VFyt3Cs2cTvlH7da1C6UfUvDr\r\nOwCescFCEAjnh0cWpsmdCjIFcYeLy8o7ofghWSXS6NWc0Rpjiei1kUqxFmzh\r\nRMzEDDumhn4GjuRKIZMt0cm8kRVFNxdiU7K2rrxodIj2z43YT+dmp1L2T+JM\r\nAPKXL6GL0QY0qJQs5Uaw+fL08maHIvPeUNr5LCQkdOdVUMuV9kiDEhIJh5IT\r\n4R4IPSI6flgRziUFa/nzE7jM4a/iNv0WK5ipVNcWXVnFwu4FUuQ86t/q3Dm7\r\nBf3G9NPTuPuzccNz5r4hRkJdB3CKZKriOrTDb4r+kIUuYjCC0rZ23qHHjaiH\r\nD7GkMMAarqLtImoA6fHwDXItHu4JYqUqL34=\r\n=A6s3\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"sfpower","email":"dxatscale@accenture.com"},"directories":{},"maintainers":[{"name":"azlamsalam","email":"azlam.salam@outlook.com"},{"name":"azlam-acn","email":"azlam.abdulsalam@accenture.com"},{"name":"sivanand.jothy","email":"sivanand.jothy@accenture.com"},{"name":"vuha","email":"vu.ha@accenture.com"},{"name":"genoud","email":"magloiredjatio@gmail.com"},{"name":"raakr","email":"ramzi.akremi@me.com"},{"name":"rawdee","email":"rodolphe.blancho@gmail.com"},{"name":"nbatterham","email":"nathan.batterham@accenture.com"},{"name":"sanjaymani654","email":"manivasaga.murugesan@accenture.com"},{"name":"alanly","email":"alan.ly@accenture.com"},{"name":"sfpower","email":"dxatscale@accenture.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfdc-soup_18.2.5_1670386612271_0.45440468240970633"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"18.2.6":{"name":"@dxatscale/sfdc-soup","version":"18.2.6","description":"A simple API to view your Salesforce dependencies, powered by HappySoup.io","main":"src/index.js","scripts":{"start":"node examples/example.js","test":"echo \"Error: no test specified\"","update-api":"npm install sfdc-happy-api@latest && npm version minor && git commit -a -m \"updated api\" && npm publish"},"repository":{"type":"git","url":"git+https://github.com/dxatscale/sfdc-soup.git"},"keywords":["salesforce"],"author":{"name":"dxatscale"},"license":"MIT","bugs":{"url":"https://github.com/dxatscale/sfdc-soup/issues"},"dependencies":{"@dxatscale/forcemula":"0.1.2","dotenv":"^8.2.0","fast-xml-parser":"3.18.0","node-fetch":"^2.6.0","sf-standard-field-dependency":"2.0.0","sfdc-happy-api":"3.0.0","strip-comments":"2.0.1"},"homepage":"https://github.com/dxatscale/sfdc-soup#readme","gitHead":"5b311c505f82753887682a2b6cc464353b2610ad","readme":"# sfdc-soup\n## A simple API to understand your Salesforce dependencies\n\n### Forked from https://github.com/pgonzaleznetwork/sfdc-soup for faster dependency updates for @dxatscale libs.  Feature Requests issues will be maintained in original sfdc-soup\n\n`sfdc-soup` is the NPM library that powers the [Salesforce Happy Soup](https://github.com/pgonzaleznetwork/sfdc-happy-soup#the-best-way-to-visualize-your-salesforce-dependencies). \n\nIt is simple API that allows you to see usage (i.e \"where is this used?\") and dependency (aka [deployment boundaries](https://github.com/pgonzaleznetwork/sfdc-happy-soup#deployment-boundaries)) information of a metadata member in your Salesforce org.\n\nThis information is provided in 4 different formats:\n\n* **Excel and CSV** Perfect for sharing with other members of the team and brainstorming (for example when deciding how to optimize a page layout that has too many fields).\n* **JSON tree** Useful to build tree-like UIs like the one seen on [Salesforce Happy Soup](https://github.com/pgonzaleznetwork/sfdc-happy-soup#the-best-way-to-visualize-your-salesforce-dependencies)\n* **package.xml** So that you can immediately retrieve your deployment boundary and create a scratch org or unlocked package.\n* **Stats** A simple object counting how many members of a specific metadata type are referenced. Useful for building UI dashboards.\n\n```javascript\n\nlet standardField = {\n    name:'Opportunity.StageName',\n    type:'StandardField',\n    id:'Opportunity.StageName',\n}\n\nlet soupApi = sfdcSoup(connection,standardField);\n\nlet usageResponse = await soupApi.getUsage();\nlet dependencyResponse = await soupApi.getDependencies();\n\nfs.writeFileSync('examples/usage.json',JSON.stringify(usageResponse.usageTree));\nfs.writeFileSync('examples/dependencies.json',JSON.stringify(dependencyResponse.dependencyTree));\n\n\n```\n\n<p align=\"center\">\n  <img src=\"./github-images/sampleresponse.png\" >\n</p>\n\n## Contents\n\n- [sfdc-soup](#sfdc-soup)\n  - [A simple API to understand your Salesforce dependencies](#a-simple-api-to-understand-your-salesforce-dependencies)\n    - [Forked from https://github.com/pgonzaleznetwork/sfdc-soup for faster dependency updates for @dxatscale libs.  Feature Requests issues will be maintained in original sfdc-soup](#forked-from-httpsgithubcompgonzaleznetworksfdc-soup-for-faster-dependency-updates-for-dxatscale-libs--feature-requests-issues-will-be-maintained-in-original-sfdc-soup)\n  - [Contents](#contents)\n  - [Installation](#installation)\n  - [How to use](#how-to-use)\n  - [Exploring the response](#exploring-the-response)\n    - [`packageXml`](#packagexml)\n    - [`dependencyTree`](#dependencytree)\n    - [`stats`](#stats)\n    - [`csv` and `excel`](#csv-and-excel)\n  - [Pills](#pills)\n  - [EntryPoint Options](#entrypoint-options)\n  - [Support and help](#support-and-help)\n\n\n## Installation\n\nIn your NPM application folder, run the following command\n\n`npm install sfdc-soup`\n\nOnce you have installed the module in your own NPM project, you can import it in this way\n\n```javascript\nconst sfdcSoup = require('sfdc-soup');\n```\n\n## How to use\n\nBefore using the API, you must have an `entryPoint` and `connection` objects.\n\n**Entry Point**\n\nThe `entryPoint` is an object with 3 properties, all of which represent the entry point of the dependency tree. For example\n\n```javascript\n/**\n* @name The API name of the metadata member\n* @type The metadata type. It must match the Metadata API naming conventions\n* @id The 18-digit id. The 15 digit one will NOT work\n*/\nlet entryPoint = {\n    name:'TranslationsMerger_LEX_Controller',\n    type:'ApexClass',\n    id:'01p0O00000CBlzZQAT'\n}\n```\n\nHow your construct this object is not a concern of `sfdc-soup`. Your application must use the relevant Salesforce APIs to get this information.\n\n**Connection**\n\nThe `connection` is also an object with 3 properties that represent a valid API session with any given salesforce org. For example\n\n```javascript\n/**\n* @token A session id or oauth token with API access\n* @url Your instance url i.e login.salesforce.com or mydomain.my.salesforce.com\n* @apiVersion the version of the Salesforce API. If not specified or if it's lower than 49.0, we use 50.0 by default\n*/\nlet connection = {\n    token: '00D0O000000Z9Ab!AQMAQMRoLQKh_uBxWEvz3as7V...',\n    url:'https://resourceful-moose-448750-dev-ed.my.salesforce.com',\n    apiVersion:'49.0'\n};\n```\n\nHow your construct this object is not a concern of `sfdc-soup`. Your application must use the relevant Salesforce APIs to get this information.\n\n\n**Getting usage information**\n\nTo see where a metadata member is used, use the usageApi provided by `sfdc-soup` as follows\n\n```javascript \n//async function\nlet soupApi = sfdcSoup(connection,entryPoint);\nlet usageResponse = await soupApi.getUsage();\n```\n\n```javascript \n//standard promise syntax\nlet soupApi = sfdcSoup(connection,entryPoint);\nsoupApi.getUsage().then(response => console.log(response));\n```\n\n**Getting dependency information (deployment boundary)**\n\nTo see the [deployment boundary](https://github.com/pgonzaleznetwork/sfdc-happy-soup#deployment-boundaries) of a metadata member, use the dependencyApi provided by `sfdc-soup` as follows\n\n```javascript \n//async function\nlet soupApi = sfdcSoup(connection,standardField);\nlet dependencyResponse = await soupApi.getDependencies();\n```\n\n```javascript \n//standard promise syntax\nlet soupApi = sfdcSoup(connection,standardField);\nsoupApi.getDependencies().then(response => console.log(response));\n```\n\n[Back to top](#sfdc-soup)\n\n## Exploring the response\n\nBoth the `usageApi` and `dependencyApi` provide the exact same properties in their response. Here we'll show the response properties of the `dependencyApi` simply because that is the most interesting one.\n\n### `packageXml`\n\nThe `packageXml` property provides a string representing the package.xml required to retrieve all the metadata members from your org. The metadata members are those in the deploment boundary as well as the entry point.\n\nIt can be accessed via `dependencyResponse.packageXml`\n\n\n```javascript\n \"packageXml\": \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n        <Package xmlns=\\\"http://soap.sforce.com/2006/04/metadata\\\"><types><members>Translation_Context__c.Context_Type__c\n </members><members>Translation_Context__c.Record_Link__c</members><members>Translation_Key__c.Default_Label__c</members><members>Translation_Key__c.Key__c\n </members><members>Translation_Key__c.Translation_Context__c</members></types><version>49.0</version>\\n        </Package>\",\n```\n\n### `dependencyTree`\n\nThe `dependencyTree` property is a JSON tree reprensenting the entire deployment boundary, where the entryPoint is the top key of the tree.\n\nEvery time a metadata member references (or depends on) another set of metadata, the tree expands via a `references` property on the metadata member.\n\n```javascript\n\"dependencyTree\": {\n        \"TranslationsMerger_LEX_Controller\": {\n            \"references\": {\n                \"CustomField\": [\n                    {\n                        \"name\": \"Translation_Context__c.Context_Type__c\",\n                        \"type\": \"CustomField\",\n                        \"id\": \"00N0O00000GJnhoUAD\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhoUAD\",\n                        \"notes\": null,\n                        \"namespace\": null\n                    },\n                    {\n                        \"name\": \"Translation_Context__c.Record_Link__c\",\n                        \"type\": \"CustomField\",\n                        \"id\": \"00N0O00000GJnhjUAD\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhjUAD\",\n                        \"notes\": null,\n                        \"namespace\": null\n                    }\n                ],\n                \"CustomObject\": [\n                    {\n                        \"name\": \"Translation_Context__c\",\n                        \"type\": \"CustomObject\",\n                        \"id\": \"01I0O000000bVd8UAE\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/01I0O000000bVd8UAE\",\n                        \"notes\": null,\n                        \"namespace\": null,\n                        \"references\": {\n                            \"FlexiPage\": [\n                                {\n                                    \"name\": \"Translation_Context_Record_Page\",\n                                    \"type\": \"FlexiPage\",\n                                    \"id\": \"0M00O000000YF9SSAW\",\n                                    \"repeated\": false,\n                                    \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/0M00O000000YF9SSAW\",\n                                    \"notes\": null,\n                                    \"namespace\": null,\n                                    \"referencedBy\": {\n                                        \"name\": \"Translation_Context__c\",\n                                        \"id\": \"01I0O000000bVd8UAE\",\n                                        \"type\": \"CustomObject\"\n                                    }\n                                }\n                            ]\n                        }\n                    }\n                ],\n                \"ApexClass\": [\n                    {\n                        \"name\": \"TranslationFileBuilder\",\n                        \"type\": \"ApexClass\",\n                        \"id\": \"01p0O00000CBltlQAD\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/01p0O00000CBltlQAD\",\n                        \"notes\": null,\n                        \"namespace\": null,\n                        \"references\": {\n                            \"CustomField\": [\n                                {\n                                    \"name\": \"Translation_Key__c.Type__c\",\n                                    \"type\": \"CustomField\",\n                                    \"id\": \"00N0O00000GJmhdUAD\",\n                                    \"repeated\": false,\n                                    \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJmhdUAD\",\n                                    \"notes\": null,\n                                    \"namespace\": null,\n                                    \"referencedBy\": {\n                                        \"name\": \"TranslationFileBuilder\",\n                                        \"id\": \"01p0O00000CBltlQAD\",\n                                        \"type\": \"ApexClass\"\n                                    }\n                                }\n```\n\n**NOTE**: In the `usageApi` this property is called `usageTree`.\n\n[Back to top](#sfdc-soup)\n\n### `stats`\n\nThe  `stats` object is the output of a `reducer` function. You can use this to know how many metadata members are using or are being used by a specific metadata member.\n\n```javascript\n\"stats\": {\n        \"CustomField\": 6,\n        \"CustomObject\": 2,\n        \"ApexClass\": 2,\n        \"FlexiPage\": 1\n    }\n```\n\nYou could also use this information to build charts with javascript\n\n### `csv` and `excel`\n\nThese two properties return a string representing all the metadata members in either `csv` or `excel` format. \n\n```csv\n\"Name,Metadata Type,Id,Url,Used by,\n\"Translation_Context__c.Record_Link__c\"\"CustomField\\\",\"00N0O00000GJnhjUAD\\\",\n\"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhjUAD\\\",\n\\\"TranslationsMerger_LEX_Controller via TranslationsMerger_LEX_Controller\\\",\n\\r\\n\\\"Translation_Context__c.Context_Type__c\\\",\\\"CustomField\\\",\\\"00N0O00000GJnhoUAD\\\",\\\"https://\nresourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhoUAD\\\",\n\\\"TranslationsMerger_LEX_Controller via TranslationsMerger_LEX_Controller\\\",\n\\r\\n\\\"Translation_Context__c\\\",\\\"CustomObject\\\",\\\"01I0O000000bVd8UAE\\\",\\\"https://\nresourceful-moose-448750-dev-ed.my.salesforce.com/01I0O000000bVd8UAE\\\",\\\"TranslationsMerger_LEX_Controller via TranslationsMerger_LEX_Controller\\\"\n\n```\n\n[Back to top](#sfdc-soup)\n\n## Pills\n\nWhen using the `usageApi`, the metadata types will return a `pills` object that contains additional information about the metadata type and how it is referencing the entry point in question.\n\nYour client code should check if the `pills` object is populated (i.e if it has keys) and if so, display them in your UI.\n\nHere's an example of how the `pills` object shows whether a custom field is being used for reading or writing (assignment) in an apex class\n\n```javascript\n \"ApexClass\": [\n        {\n            \"name\": \"ClassWritingToField\",\n            \"type\": \"ApexClass\",\n            \"id\": \"01p3h00000FHNeiAAH\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/01p3h00000FHNeiAAH\",\n            \"notes\": null,\n            \"namespace\": null,\n            \"pills\": [\n                {\n                    \"label\": \"write\",\n                    \"color\": \"#d63031\"\n                }\n            ],\n            \"sortOrder\": 1\n        },\n        {\n            \"name\": \"ClassReadingField\",\n            \"type\": \"ApexClass\",\n            \"id\": \"01p3h00000FHNedAAH\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/01p3h00000FHNedAAH\",\n            \"notes\": null,\n            \"namespace\": null,\n            \"pills\": [\n                {\n                    \"label\": \"read\",\n                    \"color\": \"#3c9662\"\n                }\n            ],\n            \"sortOrder\": 2\n        }\n```\n\n[Back to top](#sfdc-soup)\n\n## EntryPoint Options\n\nWhen using the `usageApi` some metadata types support additional information that is not returned by the API unless explictly requested.\n\nConsider the following example\n\n```javascript\nlet customField = {\n    name:'Account.CustomerPriority__c',\n    type:'CustomField',\n    id:'00N3h00000DdZSIEA3',\n    options:{\n        'enhancedReportData':true,\n        'fieldInMetadataTypes':true\n    }\n}\n```\n\nWith the additional options object, the API response will provide the following info:\n\n`enhancedReportData`\n\nThis will tell you exactly how a field is used in a report; whether it's just a column, a filter or perhaps a grouping. To protect your API limits, this information is only available for the first 100 reports that are using the field. \n\n The data can be found in the `pills` object of the response. \n\nHere's an example where the field is being used as both a filter and a grouping in the same report. Notice that the filter includes information on what the actual filter value is.\n\nThis can be very useful when determining if it's safe to modify a picklist value, as doing so could break some reports. \n\n```javascript\n\"Report\": [\n        {\n            \"name\": \"Report_being_used\",\n            \"type\": \"Report\",\n            \"id\": \"00O3h0000049mk4EAA\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/00O3h0000049mk4EAA\",\n            \"notes\": null,\n            \"namespace\": null,\n            \"pills\": [\n                {\n                    \"label\": \"Grouping\",\n                    \"color\": \"#d63031\"\n                },\n                {\n                    \"label\": \"Filter: equals Low\",\n                    \"color\": \"#d63031\"\n                }\n            ],\n            \"sortOrder\": 1\n        }\n```\n\n`fieldInMetadataTypes`\n\nThis will check if the field is being referenced in custom fields of custom metadata types, where the field type is `Metadata Relationship(Field Definition)`\n\nThis particular option does not add additional information to the `pills` object but instead returns a brand new metadata type on the response. \n\n```javascript\n\"SRM_Metadata_Conflict_Warning__mdt\": [\n        {\n            \"name\": \"Default (from SRM_Field__c)\",\n            \"type\": \"SRM_Metadata_Conflict_Warning__mdt\",\n            \"id\": \"m013h000000BRlrAAG\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/m013h000000BRlrAAG\",\n            \"notes\": null,\n            \"pills\": []\n        }\n    ],\n    \"Field_referencing__mdt\": [\n        {\n            \"name\": \"my_metadata (from Related_Field__c)\",\n            \"type\": \"Field_referencing__mdt\",\n            \"id\": \"m043h000000lprZAAQ\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/m043h000000lprZAAQ\",\n            \"notes\": null,\n            \"pills\": []\n        }\n    ]\n```\n\n\n\n[Back to top](#sfdc-soup)\n\n## Support and help\n\nFeel free to contact me at pgonzaleznetwork@gmail.com or log a github issue. ","readmeFilename":"README.md","_id":"@dxatscale/sfdc-soup@18.2.6","_nodeVersion":"16.18.1","_npmVersion":"lerna/6.1.0/node@v16.18.1+x64 (linux)","dist":{"integrity":"sha512-MqPx/degjGySCUyqtZNqPcR7k3eTNVBLqFLbIubdpDBR/kHGo6poaPCa0etoXsszSQV07v7XmNTRUpRRU+JtFg==","shasum":"6f51c75e7c44c057a8524e598dab6098e20856b0","tarball":"https://registry.npmjs.org/@dxatscale/sfdc-soup/-/sfdc-soup-18.2.6.tgz","fileCount":26,"unpackedSize":473136,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDZgs6A9Wi7WUIbJoJ/YEEkM/Ls2wW20zVwWYlDZryjUAIhAJirqjPkIR/A/7bX0FIlY3oW9gQedY2Fv0tcDx5v+jA3"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjkTVWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpwZA//YGcUMdWaIw5ATur/CJ9+hTQWpyer6NsLqrBQJYurLNGvAkkO\r\nCygbtDHCOgRduQq/nHPmOrd3r53oqMbArvtfWr9PNSLYa+flunmlAyLmrX+6\r\nFmOsBYg4K4fNckAubFV+m2bMdEw5wdxApipfXc6D22y2imVOBEjI3bV2RBvU\r\nfRXndZ2LBD5b/3PqTErIaZwkEW++wrAbMvQClyZIQh09pxDKoVMF/IX0+JRA\r\niK69+D+3gXSyh0wonzFquqwwMTOuEqV4z3XvH7Lqh7NECcruGEWSMycyJDDZ\r\n5gaBADMzfJRVE5bZEWfkq8H2T15d3a+HJxZc/qZ5Kc5cLr1xgMdRptt9glGk\r\nKN4IGEezlXG/q9p+dcvZWbn3Lbkoq9P6r6z8TBi/A+/gkk0DU0UIFWlWHE8F\r\n/00ovvo3Hxn1u58UZL+9uBn5vKKiwv4xhUD/gy+crdd7TKZpz41LlFW/aUnM\r\nD66uT8Cs3xILWmqHVmGDcLAlPPhUywLeBbT6g6fA4pEZ4lSP7Uf+C4QqrKL+\r\nJCNgjNgv+tcYNVx79NSBIipBeqUjRkQchGjkhG5gL2i7RorXMq2RsGCgfdyp\r\nz66xrmNHaPdmDm4CUl+eqpGn+wgseOXW1rgy+lzc1V/OSM8rvyFWyGr2HaSr\r\n4Pdqke/aQj1mqRJ4IFdbf90v3gwIumOmSaw=\r\n=wVmm\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"sfpower","email":"dxatscale@accenture.com"},"directories":{},"maintainers":[{"name":"azlamsalam","email":"azlam.salam@outlook.com"},{"name":"azlam-acn","email":"azlam.abdulsalam@accenture.com"},{"name":"sivanand.jothy","email":"sivanand.jothy@accenture.com"},{"name":"vuha","email":"vu.ha@accenture.com"},{"name":"genoud","email":"magloiredjatio@gmail.com"},{"name":"raakr","email":"ramzi.akremi@me.com"},{"name":"rawdee","email":"rodolphe.blancho@gmail.com"},{"name":"nbatterham","email":"nathan.batterham@accenture.com"},{"name":"sanjaymani654","email":"manivasaga.murugesan@accenture.com"},{"name":"alanly","email":"alan.ly@accenture.com"},{"name":"sfpower","email":"dxatscale@accenture.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfdc-soup_18.2.6_1670460758095_0.2072317906494494"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"19.0.0":{"name":"@dxatscale/sfdc-soup","version":"19.0.0","description":"A simple API to view your Salesforce dependencies, powered by HappySoup.io","main":"src/index.js","scripts":{"start":"node examples/example.js","test":"echo \"Error: no test specified\"","update-api":"npm install sfdc-happy-api@latest && npm version minor && git commit -a -m \"updated api\" && npm publish"},"repository":{"type":"git","url":"git+https://github.com/dxatscale/sfdc-soup.git"},"keywords":["salesforce"],"author":{"name":"dxatscale"},"license":"MIT","bugs":{"url":"https://github.com/dxatscale/sfdc-soup/issues"},"dependencies":{"@dxatscale/forcemula":"0.1.2","dotenv":"^8.2.0","fast-xml-parser":"3.18.0","node-fetch":"^2.6.0","sf-standard-field-dependency":"2.0.0","sfdc-happy-api":"3.0.0","strip-comments":"2.0.1"},"homepage":"https://github.com/dxatscale/sfdc-soup#readme","gitHead":"d2ef9efbbb247fd60adbffcd54cb91ff2a566659","readme":"# sfdc-soup\n## A simple API to understand your Salesforce dependencies\n\n### Forked from https://github.com/pgonzaleznetwork/sfdc-soup for faster dependency updates for @dxatscale libs.  Feature Requests issues will be maintained in original sfdc-soup\n\n`sfdc-soup` is the NPM library that powers the [Salesforce Happy Soup](https://github.com/pgonzaleznetwork/sfdc-happy-soup#the-best-way-to-visualize-your-salesforce-dependencies). \n\nIt is simple API that allows you to see usage (i.e \"where is this used?\") and dependency (aka [deployment boundaries](https://github.com/pgonzaleznetwork/sfdc-happy-soup#deployment-boundaries)) information of a metadata member in your Salesforce org.\n\nThis information is provided in 4 different formats:\n\n* **Excel and CSV** Perfect for sharing with other members of the team and brainstorming (for example when deciding how to optimize a page layout that has too many fields).\n* **JSON tree** Useful to build tree-like UIs like the one seen on [Salesforce Happy Soup](https://github.com/pgonzaleznetwork/sfdc-happy-soup#the-best-way-to-visualize-your-salesforce-dependencies)\n* **package.xml** So that you can immediately retrieve your deployment boundary and create a scratch org or unlocked package.\n* **Stats** A simple object counting how many members of a specific metadata type are referenced. Useful for building UI dashboards.\n\n```javascript\n\nlet standardField = {\n    name:'Opportunity.StageName',\n    type:'StandardField',\n    id:'Opportunity.StageName',\n}\n\nlet soupApi = sfdcSoup(connection,standardField);\n\nlet usageResponse = await soupApi.getUsage();\nlet dependencyResponse = await soupApi.getDependencies();\n\nfs.writeFileSync('examples/usage.json',JSON.stringify(usageResponse.usageTree));\nfs.writeFileSync('examples/dependencies.json',JSON.stringify(dependencyResponse.dependencyTree));\n\n\n```\n\n<p align=\"center\">\n  <img src=\"./github-images/sampleresponse.png\" >\n</p>\n\n## Contents\n\n- [sfdc-soup](#sfdc-soup)\n  - [A simple API to understand your Salesforce dependencies](#a-simple-api-to-understand-your-salesforce-dependencies)\n    - [Forked from https://github.com/pgonzaleznetwork/sfdc-soup for faster dependency updates for @dxatscale libs.  Feature Requests issues will be maintained in original sfdc-soup](#forked-from-httpsgithubcompgonzaleznetworksfdc-soup-for-faster-dependency-updates-for-dxatscale-libs--feature-requests-issues-will-be-maintained-in-original-sfdc-soup)\n  - [Contents](#contents)\n  - [Installation](#installation)\n  - [How to use](#how-to-use)\n  - [Exploring the response](#exploring-the-response)\n    - [`packageXml`](#packagexml)\n    - [`dependencyTree`](#dependencytree)\n    - [`stats`](#stats)\n    - [`csv` and `excel`](#csv-and-excel)\n  - [Pills](#pills)\n  - [EntryPoint Options](#entrypoint-options)\n  - [Support and help](#support-and-help)\n\n\n## Installation\n\nIn your NPM application folder, run the following command\n\n`npm install sfdc-soup`\n\nOnce you have installed the module in your own NPM project, you can import it in this way\n\n```javascript\nconst sfdcSoup = require('sfdc-soup');\n```\n\n## How to use\n\nBefore using the API, you must have an `entryPoint` and `connection` objects.\n\n**Entry Point**\n\nThe `entryPoint` is an object with 3 properties, all of which represent the entry point of the dependency tree. For example\n\n```javascript\n/**\n* @name The API name of the metadata member\n* @type The metadata type. It must match the Metadata API naming conventions\n* @id The 18-digit id. The 15 digit one will NOT work\n*/\nlet entryPoint = {\n    name:'TranslationsMerger_LEX_Controller',\n    type:'ApexClass',\n    id:'01p0O00000CBlzZQAT'\n}\n```\n\nHow your construct this object is not a concern of `sfdc-soup`. Your application must use the relevant Salesforce APIs to get this information.\n\n**Connection**\n\nThe `connection` is also an object with 3 properties that represent a valid API session with any given salesforce org. For example\n\n```javascript\n/**\n* @token A session id or oauth token with API access\n* @url Your instance url i.e login.salesforce.com or mydomain.my.salesforce.com\n* @apiVersion the version of the Salesforce API. If not specified or if it's lower than 49.0, we use 50.0 by default\n*/\nlet connection = {\n    token: '00D0O000000Z9Ab!AQMAQMRoLQKh_uBxWEvz3as7V...',\n    url:'https://resourceful-moose-448750-dev-ed.my.salesforce.com',\n    apiVersion:'49.0'\n};\n```\n\nHow your construct this object is not a concern of `sfdc-soup`. Your application must use the relevant Salesforce APIs to get this information.\n\n\n**Getting usage information**\n\nTo see where a metadata member is used, use the usageApi provided by `sfdc-soup` as follows\n\n```javascript \n//async function\nlet soupApi = sfdcSoup(connection,entryPoint);\nlet usageResponse = await soupApi.getUsage();\n```\n\n```javascript \n//standard promise syntax\nlet soupApi = sfdcSoup(connection,entryPoint);\nsoupApi.getUsage().then(response => console.log(response));\n```\n\n**Getting dependency information (deployment boundary)**\n\nTo see the [deployment boundary](https://github.com/pgonzaleznetwork/sfdc-happy-soup#deployment-boundaries) of a metadata member, use the dependencyApi provided by `sfdc-soup` as follows\n\n```javascript \n//async function\nlet soupApi = sfdcSoup(connection,standardField);\nlet dependencyResponse = await soupApi.getDependencies();\n```\n\n```javascript \n//standard promise syntax\nlet soupApi = sfdcSoup(connection,standardField);\nsoupApi.getDependencies().then(response => console.log(response));\n```\n\n[Back to top](#sfdc-soup)\n\n## Exploring the response\n\nBoth the `usageApi` and `dependencyApi` provide the exact same properties in their response. Here we'll show the response properties of the `dependencyApi` simply because that is the most interesting one.\n\n### `packageXml`\n\nThe `packageXml` property provides a string representing the package.xml required to retrieve all the metadata members from your org. The metadata members are those in the deploment boundary as well as the entry point.\n\nIt can be accessed via `dependencyResponse.packageXml`\n\n\n```javascript\n \"packageXml\": \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n        <Package xmlns=\\\"http://soap.sforce.com/2006/04/metadata\\\"><types><members>Translation_Context__c.Context_Type__c\n </members><members>Translation_Context__c.Record_Link__c</members><members>Translation_Key__c.Default_Label__c</members><members>Translation_Key__c.Key__c\n </members><members>Translation_Key__c.Translation_Context__c</members></types><version>49.0</version>\\n        </Package>\",\n```\n\n### `dependencyTree`\n\nThe `dependencyTree` property is a JSON tree reprensenting the entire deployment boundary, where the entryPoint is the top key of the tree.\n\nEvery time a metadata member references (or depends on) another set of metadata, the tree expands via a `references` property on the metadata member.\n\n```javascript\n\"dependencyTree\": {\n        \"TranslationsMerger_LEX_Controller\": {\n            \"references\": {\n                \"CustomField\": [\n                    {\n                        \"name\": \"Translation_Context__c.Context_Type__c\",\n                        \"type\": \"CustomField\",\n                        \"id\": \"00N0O00000GJnhoUAD\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhoUAD\",\n                        \"notes\": null,\n                        \"namespace\": null\n                    },\n                    {\n                        \"name\": \"Translation_Context__c.Record_Link__c\",\n                        \"type\": \"CustomField\",\n                        \"id\": \"00N0O00000GJnhjUAD\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhjUAD\",\n                        \"notes\": null,\n                        \"namespace\": null\n                    }\n                ],\n                \"CustomObject\": [\n                    {\n                        \"name\": \"Translation_Context__c\",\n                        \"type\": \"CustomObject\",\n                        \"id\": \"01I0O000000bVd8UAE\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/01I0O000000bVd8UAE\",\n                        \"notes\": null,\n                        \"namespace\": null,\n                        \"references\": {\n                            \"FlexiPage\": [\n                                {\n                                    \"name\": \"Translation_Context_Record_Page\",\n                                    \"type\": \"FlexiPage\",\n                                    \"id\": \"0M00O000000YF9SSAW\",\n                                    \"repeated\": false,\n                                    \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/0M00O000000YF9SSAW\",\n                                    \"notes\": null,\n                                    \"namespace\": null,\n                                    \"referencedBy\": {\n                                        \"name\": \"Translation_Context__c\",\n                                        \"id\": \"01I0O000000bVd8UAE\",\n                                        \"type\": \"CustomObject\"\n                                    }\n                                }\n                            ]\n                        }\n                    }\n                ],\n                \"ApexClass\": [\n                    {\n                        \"name\": \"TranslationFileBuilder\",\n                        \"type\": \"ApexClass\",\n                        \"id\": \"01p0O00000CBltlQAD\",\n                        \"repeated\": false,\n                        \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/01p0O00000CBltlQAD\",\n                        \"notes\": null,\n                        \"namespace\": null,\n                        \"references\": {\n                            \"CustomField\": [\n                                {\n                                    \"name\": \"Translation_Key__c.Type__c\",\n                                    \"type\": \"CustomField\",\n                                    \"id\": \"00N0O00000GJmhdUAD\",\n                                    \"repeated\": false,\n                                    \"url\": \"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJmhdUAD\",\n                                    \"notes\": null,\n                                    \"namespace\": null,\n                                    \"referencedBy\": {\n                                        \"name\": \"TranslationFileBuilder\",\n                                        \"id\": \"01p0O00000CBltlQAD\",\n                                        \"type\": \"ApexClass\"\n                                    }\n                                }\n```\n\n**NOTE**: In the `usageApi` this property is called `usageTree`.\n\n[Back to top](#sfdc-soup)\n\n### `stats`\n\nThe  `stats` object is the output of a `reducer` function. You can use this to know how many metadata members are using or are being used by a specific metadata member.\n\n```javascript\n\"stats\": {\n        \"CustomField\": 6,\n        \"CustomObject\": 2,\n        \"ApexClass\": 2,\n        \"FlexiPage\": 1\n    }\n```\n\nYou could also use this information to build charts with javascript\n\n### `csv` and `excel`\n\nThese two properties return a string representing all the metadata members in either `csv` or `excel` format. \n\n```csv\n\"Name,Metadata Type,Id,Url,Used by,\n\"Translation_Context__c.Record_Link__c\"\"CustomField\\\",\"00N0O00000GJnhjUAD\\\",\n\"https://resourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhjUAD\\\",\n\\\"TranslationsMerger_LEX_Controller via TranslationsMerger_LEX_Controller\\\",\n\\r\\n\\\"Translation_Context__c.Context_Type__c\\\",\\\"CustomField\\\",\\\"00N0O00000GJnhoUAD\\\",\\\"https://\nresourceful-moose-448750-dev-ed.my.salesforce.com/00N0O00000GJnhoUAD\\\",\n\\\"TranslationsMerger_LEX_Controller via TranslationsMerger_LEX_Controller\\\",\n\\r\\n\\\"Translation_Context__c\\\",\\\"CustomObject\\\",\\\"01I0O000000bVd8UAE\\\",\\\"https://\nresourceful-moose-448750-dev-ed.my.salesforce.com/01I0O000000bVd8UAE\\\",\\\"TranslationsMerger_LEX_Controller via TranslationsMerger_LEX_Controller\\\"\n\n```\n\n[Back to top](#sfdc-soup)\n\n## Pills\n\nWhen using the `usageApi`, the metadata types will return a `pills` object that contains additional information about the metadata type and how it is referencing the entry point in question.\n\nYour client code should check if the `pills` object is populated (i.e if it has keys) and if so, display them in your UI.\n\nHere's an example of how the `pills` object shows whether a custom field is being used for reading or writing (assignment) in an apex class\n\n```javascript\n \"ApexClass\": [\n        {\n            \"name\": \"ClassWritingToField\",\n            \"type\": \"ApexClass\",\n            \"id\": \"01p3h00000FHNeiAAH\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/01p3h00000FHNeiAAH\",\n            \"notes\": null,\n            \"namespace\": null,\n            \"pills\": [\n                {\n                    \"label\": \"write\",\n                    \"color\": \"#d63031\"\n                }\n            ],\n            \"sortOrder\": 1\n        },\n        {\n            \"name\": \"ClassReadingField\",\n            \"type\": \"ApexClass\",\n            \"id\": \"01p3h00000FHNedAAH\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/01p3h00000FHNedAAH\",\n            \"notes\": null,\n            \"namespace\": null,\n            \"pills\": [\n                {\n                    \"label\": \"read\",\n                    \"color\": \"#3c9662\"\n                }\n            ],\n            \"sortOrder\": 2\n        }\n```\n\n[Back to top](#sfdc-soup)\n\n## EntryPoint Options\n\nWhen using the `usageApi` some metadata types support additional information that is not returned by the API unless explictly requested.\n\nConsider the following example\n\n```javascript\nlet customField = {\n    name:'Account.CustomerPriority__c',\n    type:'CustomField',\n    id:'00N3h00000DdZSIEA3',\n    options:{\n        'enhancedReportData':true,\n        'fieldInMetadataTypes':true\n    }\n}\n```\n\nWith the additional options object, the API response will provide the following info:\n\n`enhancedReportData`\n\nThis will tell you exactly how a field is used in a report; whether it's just a column, a filter or perhaps a grouping. To protect your API limits, this information is only available for the first 100 reports that are using the field. \n\n The data can be found in the `pills` object of the response. \n\nHere's an example where the field is being used as both a filter and a grouping in the same report. Notice that the filter includes information on what the actual filter value is.\n\nThis can be very useful when determining if it's safe to modify a picklist value, as doing so could break some reports. \n\n```javascript\n\"Report\": [\n        {\n            \"name\": \"Report_being_used\",\n            \"type\": \"Report\",\n            \"id\": \"00O3h0000049mk4EAA\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/00O3h0000049mk4EAA\",\n            \"notes\": null,\n            \"namespace\": null,\n            \"pills\": [\n                {\n                    \"label\": \"Grouping\",\n                    \"color\": \"#d63031\"\n                },\n                {\n                    \"label\": \"Filter: equals Low\",\n                    \"color\": \"#d63031\"\n                }\n            ],\n            \"sortOrder\": 1\n        }\n```\n\n`fieldInMetadataTypes`\n\nThis will check if the field is being referenced in custom fields of custom metadata types, where the field type is `Metadata Relationship(Field Definition)`\n\nThis particular option does not add additional information to the `pills` object but instead returns a brand new metadata type on the response. \n\n```javascript\n\"SRM_Metadata_Conflict_Warning__mdt\": [\n        {\n            \"name\": \"Default (from SRM_Field__c)\",\n            \"type\": \"SRM_Metadata_Conflict_Warning__mdt\",\n            \"id\": \"m013h000000BRlrAAG\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/m013h000000BRlrAAG\",\n            \"notes\": null,\n            \"pills\": []\n        }\n    ],\n    \"Field_referencing__mdt\": [\n        {\n            \"name\": \"my_metadata (from Related_Field__c)\",\n            \"type\": \"Field_referencing__mdt\",\n            \"id\": \"m043h000000lprZAAQ\",\n            \"url\": \"https://brave-raccoon-mm7crl-dev-ed.my.salesforce.com/m043h000000lprZAAQ\",\n            \"notes\": null,\n            \"pills\": []\n        }\n    ]\n```\n\n\n\n[Back to top](#sfdc-soup)\n\n## Support and help\n\nFeel free to contact me at pgonzaleznetwork@gmail.com or log a github issue. ","readmeFilename":"README.md","_id":"@dxatscale/sfdc-soup@19.0.0","_nodeVersion":"16.20.1","_npmVersion":"lerna/7.1.4/node@v16.20.1+x64 (linux)","dist":{"integrity":"sha512-yKX543ZBR3tUkXlYFyZVI2RcfgnLN1Y7g6ehjS0+Jj4b1ULgn0NjoK9bs2fB7AWQMAlyAKUzvA+5X6+dFeDG5A==","shasum":"12058112bdd7ac7afbd9b746af0230720bd9ceee","tarball":"https://registry.npmjs.org/@dxatscale/sfdc-soup/-/sfdc-soup-19.0.0.tgz","fileCount":26,"unpackedSize":473228,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAtJ7yioTdkcpiqCuGpgabL/myMoXRW7cK1Bly2VGLjUAiEAkIXaOz9ed8XzmX7CNFDt+K+8tsvnafGfCt0oQJzXJM8="}]},"_npmUser":{"name":"sfpower","email":"dxatscale@accenture.com"},"directories":{},"maintainers":[{"name":"azlamsalam","email":"azlam@adiza.dev"},{"name":"vuha","email":"vuhacanada@gmail.com"},{"name":"raakr","email":"ramzi.akremi@me.com"},{"name":"rawdee","email":"rodolphe.blancho@gmail.com"},{"name":"sfpower","email":"dxatscale@accenture.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sfdc-soup_19.0.0_1691381733174_0.2708180072251707"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2022-06-17T05:00:41.919Z","18.2.2":"2022-06-17T05:00:42.370Z","modified":"2024-04-29T14:30:15.630Z","18.2.3":"2022-06-20T07:38:37.279Z","18.2.4":"2022-09-13T01:10:42.094Z","18.2.5":"2022-12-07T04:16:52.552Z","18.2.6":"2022-12-08T00:52:38.366Z","19.0.0":"2023-08-07T04:15:33.443Z"},"maintainers":[{"email":"support@npmjs.com","name":"npm-support"}],"description":"A simple API to view your Salesforce dependencies, powered by HappySoup.io","homepage":"https://github.com/dxatscale/sfdc-soup#readme","keywords":["salesforce"],"repository":{"type":"git","url":"git+https://github.com/dxatscale/sfdc-soup.git"},"author":{"name":"dxatscale"},"bugs":{"url":"https://github.com/dxatscale/sfdc-soup/issues"},"license":"MIT","readme":"","readmeFilename":""}