### Build sfpowerscripts Source: https://github.com/dxatscale/sfpowerscripts/blob/main/packages/sfpowerscripts-cli/README.md Execute the build process for sfpowerscripts by installing Lerna, navigating to the directory, installing dependencies, and running the build command. ```bash npm i -g lerna #Install Lerna Globally cd # Navigate to the checked out directory npm i lerna run build ``` -------------------------------- ### Install sfpowerscripts Locally Source: https://github.com/dxatscale/sfpowerscripts/blob/main/README.md Install the sfpowerscripts CLI globally on your local machine using npm. This allows you to use the commands directly from your terminal. ```bash npm i -g @dxatscale/sfpowerscripts ``` -------------------------------- ### Install Forcemula Source: https://github.com/dxatscale/sfpowerscripts/blob/main/packages/forcemula/README.md Install the forcemula package using npm. ```javascript npm install forcemula ``` -------------------------------- ### Build sfpowerscripts Source: https://github.com/dxatscale/sfpowerscripts/blob/main/README.md Instructions to build the sfpowerscripts project from its source code. This involves installing Lerna, navigating to the directory, installing dependencies with pnpm, and running the build script. ```bash npm i -g lerna #Install Lerna Globally cd # Navigate to the checked out directory pnpm i lerna run build ``` -------------------------------- ### Example Aliasified Package Structure (Pre-Decision) Source: https://github.com/dxatscale/sfpowerscripts/blob/main/decision records/deployments/001-aliasified-data-sourcepackages.md Illustrates the directory structure of an aliasified package before the 'default' folder was introduced. Each environment (dev, sit, st) had its own content directory. ```plaintext src-env-specicific-alias-post ├── README.md ├── dev │ └── ├── sit │ └── └── st └── ``` -------------------------------- ### Simple Salesforce Formula Example Source: https://github.com/dxatscale/sfpowerscripts/blob/main/packages/forcemula/README.md A basic Salesforce formula demonstrating a simple conditional check. ```javascript IF(ISPICKVAL(CustomerPriority__c,"High"),"Now","Later") ``` -------------------------------- ### Debug and Test Plugin Source: https://github.com/dxatscale/sfpowerscripts/blob/main/README.md Link a local sfpowerscripts plugin for debugging and testing purposes. This command makes the plugin available globally as if it were installed via npm. ```bash cd packages/sfpowerscripts-cli npm link ``` -------------------------------- ### Example Aliasified Package Structure (Post-Decision) Source: https://github.com/dxatscale/sfpowerscripts/blob/main/decision records/deployments/001-aliasified-data-sourcepackages.md Shows the revised directory structure for aliasified packages, incorporating a 'default' folder. This structure allows for shared content and environment-specific overrides. ```plaintext src-env-specific-alias-post ├── README.md └── main ├── default | └── ├── dev │ └── ├── sit │ └── └── st └── ``` -------------------------------- ### Release Definition Schema Example Source: https://github.com/dxatscale/sfpowerscripts/blob/main/decision records/release/006-release-defn-generator.md This schema defines the configuration options for generating a release definition file. Use these properties to include/exclude artifacts, dependencies, and set release-specific properties. ```yaml --- # Include only the below artifacts includeOnlyArtifacts: - Package1 - Package2 # Exclude the following artifacts while creating definition excludeArtifacts: - Package1 - Package2 # Include the following package dependencies while creating definition includeOnlyPackageDependencies: - Pkg1 # Include any artifacts that have the following tags includeOnlyArtifactsWithTag: - tag1 # Exclude any artifacts that have the following tags excludeArtifactsWithTag: - tag1 # Exclude the following package dependecies from the generated definition excludePackageDependencies: - Pkg1 # set below properties in generated release definition baselineOrg: << org >> promotePackagesBeforeDeploymentToOrg: << org >> skipIfAlreadyInstalled: <> changelog: workItemFilters: - <> - <> workItemUrl: <> limit: <> ``` -------------------------------- ### Complex Salesforce Formula Example Source: https://github.com/dxatscale/sfpowerscripts/blob/main/packages/forcemula/README.md A complex Salesforce formula showcasing various metadata extractions including custom metadata, labels, object fields, and user information. ```javascript IF(Owner.Contact.CreatedBy.Manager.Profile.Id = "03d3h000000khEQ",TRUE,false) && IF(($CustomMetadata.Trigger_Context_Status__mdt.by_handler.Enable_After_Insert__c || $CustomMetadata.Trigger_Context_Status__mdt.by_class.DeveloperName = "Default"),true,FALSE) && IF( ($Label.Details = "Value" || Opportunity.Account.Parent.Parent.Parent.LastModifiedBy.Contact.AssistantName = "Marie"), true ,false) && IF((Opportunity__r.Related_Asset__r.Name), true ,false) && IF (($ObjectType.Center__c.Fields.My_text_field__c = "My_Text_Field__c") ,true,false) && IF (($ObjectType.SRM_API_Metadata_Client_Setting__mdt.Fields.CreatedDate = "My_Text_Field__c") ,true,false) && IF ((TEXT($Organization.UiSkin) = "lex" ) ,true,false) && IF (($Setup.Customer_Support_Setting__c.Email_Address__c = "test@gmail.com" ) ,true,false) && IF (( $User.CompanyName = "acme" ) ,true,false) ``` -------------------------------- ### Initialize Forcemula Parser Source: https://github.com/dxatscale/sfpowerscripts/blob/main/packages/forcemula/README.md Import and initialize the forcemula parser. Use jsforce, tooling API, or other methods to retrieve the actual formula body from Salesforce. ```javascript let parse = require('forcemula'); //use jsforce, tooling API, etc to get the actual formula body let formulaText = getFromSalesforceApi(...); ``` -------------------------------- ### Apache License Boilerplate Source: https://github.com/dxatscale/sfpowerscripts/blob/main/Third Party Notices.md Apply the Apache License to your work by replacing bracketed fields with your information. Enclose the text in appropriate comment syntax. ```text Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` -------------------------------- ### Run Unit Tests Source: https://github.com/dxatscale/sfpowerscripts/blob/main/README.md Execute the unit tests for the sfpowerscripts project using Lerna. This command runs the test scripts defined for each package. ```bash lerna run test ``` -------------------------------- ### Transform Custom Metadata Types Source: https://github.com/dxatscale/sfpowerscripts/blob/main/packages/forcemula/README.md Demonstrates how custom metadata types in Salesforce formulas are transformed for use with forcemula. Use this to understand the mapping of custom metadata references. ```mysql $CustomMetadata.Trigger_Context_Status__mdt.by_handler.Enable_After_Insert__c ``` ```javascript customFields: [ 'Trigger_Context_Status__mdt.Enable_After_Insert__c', ... ] ``` ```javascript customMetadataTypeRecords: [ 'Trigger_Context_Status__mdt.by_handler', 'Trigger_Context_Status__mdt.by_class' ], customMetadataTypes: [ 'Trigger_Context_Status__mdt' ], ``` -------------------------------- ### MIT License for @types/marked Source: https://github.com/dxatscale/sfpowerscripts/blob/main/Third Party Notices.md This is the MIT license text for the @types/marked package. It grants broad permissions for use, modification, and distribution. ```plaintext MIT License Copyright (c) Microsoft Corporation. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE ``` -------------------------------- ### MIT License Text Source: https://github.com/dxatscale/sfpowerscripts/blob/main/Third Party Notices.md This is the standard MIT license text. It grants broad permissions for use, modification, and distribution, with a disclaimer of warranty. ```text MIT License Copyright (c) 2012 Another-D-Mention Software and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` -------------------------------- ### Extract Objects, Labels, and Settings Source: https://github.com/dxatscale/sfpowerscripts/blob/main/packages/forcemula/README.md Forcemula extracts standard objects, custom objects, custom labels, and custom settings from formulas. This provides a comprehensive list of Salesforce metadata used. ```javascript standardObjects: [ 'OpportunityLineItem', 'User', 'Contact', 'Profile', 'Opportunity', 'Account', 'Organization' ] customLabels: [ 'Details' ], customObjects: [ 'Center__c' ], customSettings: [ 'Customer_Support_Setting__c' ] ``` -------------------------------- ### CPQ Custom Relationship Support Source: https://github.com/dxatscale/sfpowerscripts/blob/main/packages/forcemula/README.md Forcemula provides special support for CPQ custom relationship fields within the `SBQQ__` namespace, making safe assumptions about their target objects. ```javascript SBQQ__Quote__c.SBQQ__Distributor__r ``` -------------------------------- ### BSD-3-Clause License Text Source: https://github.com/dxatscale/sfpowerscripts/blob/main/Third Party Notices.md This is the BSD 3-Clause license text. It permits redistribution and use in source and binary forms, with specific conditions regarding copyright notices and disclaimers. ```text Copyright (c) 2019 Kevin Jones . All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ``` -------------------------------- ### Extract Functions and Operators Source: https://github.com/dxatscale/sfpowerscripts/blob/main/packages/forcemula/README.md Identifies all functions and operators used within a formula, useful for complexity analysis or sorting. ```javascript functions: [ 'IF', 'TRUE', 'FALSE', 'TEXT' ] operators: [ '=', '&', '|' ] ``` -------------------------------- ### Parse Formula Request Source: https://github.com/dxatscale/sfpowerscripts/blob/main/packages/forcemula/README.md Create a parse request object containing the object type and formula text, then pass it to the forcemula parser. The result contains detailed analysis of the formula. ```javascript let parseRequest = { //this is the object that the formula belongs to object:'OpportunityLineItem', formula:formulaText } let result = parse(parseRequest); console.log(result); ``` -------------------------------- ### MIT License Text for ajv Source: https://github.com/dxatscale/sfpowerscripts/blob/main/Third Party Notices.md This is the MIT license text specific to the ajv package. It is functionally identical to other MIT licenses, granting permissions with a warranty disclaimer. ```text The MIT License (MIT) Copyright (c) 2015-2021 Evgeny Poberezkin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` -------------------------------- ### Extract Standard and Custom Fields Source: https://github.com/dxatscale/sfpowerscripts/blob/main/packages/forcemula/README.md Extracts both standard and custom fields from various Salesforce entity types, including standard objects, custom objects, custom settings, and custom metadata types. ```javascript customFields: [ 'Trigger_Context_Status__mdt.Enable_After_Insert__c', 'OpportunityLineItem.Opportunity__c', 'Center__c.My_text_field__c', 'Customer_Support_Setting__c.Email_Address__c' ] standardFields: [ ... 'Trigger_Context_Status__mdt.DeveloperName', 'OpportunityLineItem.OpportunityId' ] ``` -------------------------------- ### Transform Standard Relationship Fields Source: https://github.com/dxatscale/sfpowerscripts/blob/main/packages/forcemula/README.md Shows how standard relationship fields in Salesforce formulas are transformed back to their original API names. Useful for identifying standard object relationships. ```mysql Opportunity.Account.Name ``` ```javascript standardFields: [ 'Opportunity.AccountId', ... ] ``` -------------------------------- ### ISC License for ts-loader Contributors Source: https://github.com/dxatscale/sfpowerscripts/blob/main/Third Party Notices.md This is an ISC license for ts-loader Contributors. It grants permission to use, copy, modify, and distribute the software for any purpose, provided the copyright notice and permission notice are included. ```text Copyright (c) 2023, ts-loader Contributors Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ```