{"_id":"@_kyletan/sftoolkit","_rev":"6-79cf8ab7c4a7c793afa21c8631e1b96a","name":"@_kyletan/sftoolkit","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.0":{"name":"@_kyletan/sftoolkit","version":"1.0.0","author":{"name":"Kyle Tan"},"license":"ISC","_id":"@_kyletan/sftoolkit@1.0.0","maintainers":[{"name":"jkyletan","email":"tanjkyle@gmail.com"}],"dist":{"shasum":"2dbf901759126f3d4f3de4e8b3c836c72044c270","tarball":"https://registry.npmjs.org/@_kyletan/sftoolkit/-/sftoolkit-1.0.0.tgz","fileCount":3,"integrity":"sha512-Pk3ADpDvhpEl77zgDQmnk3OsocGdZPLqi1hpu3cP7LQ1fAsNbzIXYO4oN/Qg43T7QHIe7omrT4rq/oz4/owqpA==","signatures":[{"sig":"MEUCIBrFHBysSTt06di3P9GVHmMgx8bKEq9yAW5OFf1CKrdmAiEA2sdMci1QK8Vqf0Qbjb3NjMNjgNgMIQdQWxs60icEQgA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7531},"main":"index.js","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"jkyletan","email":"tanjkyle@gmail.com"},"_npmVersion":"10.9.0","description":"Here's a README.md for the provided JavaScript code:","directories":{},"_nodeVersion":"22.11.0","dependencies":{"fs":"^0.0.1-security","csv-parser":"^3.1.0","json-2-csv":"^5.5.7","time-stamp":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/sftoolkit_1.0.0_1735966352305_0.3767269219964817","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@_kyletan/sftoolkit","version":"1.0.1","author":{"name":"Kyle Tan"},"license":"ISC","_id":"@_kyletan/sftoolkit@1.0.1","maintainers":[{"name":"jkyletan","email":"tanjkyle@gmail.com"}],"dist":{"shasum":"4c1da51e13f2005746ed8ddf90e0aa7a4d42794d","tarball":"https://registry.npmjs.org/@_kyletan/sftoolkit/-/sftoolkit-1.0.1.tgz","fileCount":3,"integrity":"sha512-/IQAZlIKiIBfUVWxoxu7lcxG8IhjNiwemwc/qOkakIgAz4bmixBNFYUa7iNs/Q73xkUSSA0KXSSJknjlu5M+DQ==","signatures":[{"sig":"MEQCIHjU0sPMJ/OVYfn0l6sLCcsgbHaqABuu1dBBiAPd5E0MAiBh6GIBppz4++3XzblTQycACU1HxAdH7+nOKuA/Jfz/lQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7312},"main":"index.js","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"jkyletan","email":"tanjkyle@gmail.com"},"_npmVersion":"10.9.0","description":"Here's a README.md for the provided JavaScript code:","directories":{},"_nodeVersion":"22.11.0","dependencies":{"fs":"^0.0.1-security","csv-parser":"^3.1.0","json-2-csv":"^5.5.7","time-stamp":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/sftoolkit_1.0.1_1735966772320_0.3990843650757301","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@_kyletan/sftoolkit","version":"1.0.2","author":{"name":"Kyle Tan"},"license":"ISC","_id":"@_kyletan/sftoolkit@1.0.2","maintainers":[{"name":"jkyletan","email":"tanjkyle@gmail.com"}],"dist":{"shasum":"04eaa9fc5d27e3234e1d22c320eefdb45684e6cc","tarball":"https://registry.npmjs.org/@_kyletan/sftoolkit/-/sftoolkit-1.0.2.tgz","fileCount":3,"integrity":"sha512-AwZTGvezXx86YWheGHnY5riBKRaTFZsHiSYJF4mW1btvR+M9FQeaEj/C9DhtkphvSx1GrI2VnM/C3W7ntMGlsA==","signatures":[{"sig":"MEUCIBx5AlAFiZicQuK0fSk3GW0gsqtYx4pLNNdwNlIcwIV7AiEAqArE5/fP/SEKamEhiCd5jF6WiDfbdaNEElCkcKGVwm8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7506},"main":"index.js","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"jkyletan","email":"tanjkyle@gmail.com"},"_npmVersion":"10.9.0","description":"Here's a README.md for the provided JavaScript code:","directories":{},"_nodeVersion":"22.11.0","dependencies":{"fs":"^0.0.1-security","csv-parser":"^3.1.0","json-2-csv":"^5.5.7","time-stamp":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/sftoolkit_1.0.2_1735966901521_0.8441869974942933","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@_kyletan/sftoolkit","version":"1.0.3","keywords":["salesforce","sfdx","sf","nodejs","csv","bulkapi"],"author":{"name":"Kyle Tan"},"license":"ISC","_id":"@_kyletan/sftoolkit@1.0.3","maintainers":[{"name":"jkyletan","email":"tanjkyle@gmail.com"}],"homepage":"https://github.com/jkyletan/sftoolkit#readme","bugs":{"url":"https://github.com/jkyletan/sftoolkit/issues"},"dist":{"shasum":"3aef967d9a1cb3d7c24478461499d388654f747e","tarball":"https://registry.npmjs.org/@_kyletan/sftoolkit/-/sftoolkit-1.0.3.tgz","fileCount":3,"integrity":"sha512-ZycsDRS8ARxhQnQExcuF5Sub3CuWU2cgBxLZhCt7JsdT/kTKpGw+Zxj67WFIeoIjtTHePcsDUrUi8Geznej7dA==","signatures":[{"sig":"MEUCIFHU76WIfDMco1OtBoO5g1cI6a0j/JTLNl5tUA5BWXlsAiEAtHUSuBJmdsOlj1io4WA3QNPqr+18/j7zYF4Z9X869HI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7844},"main":"index.js","type":"module","gitHead":"cb9e492a56e5f56d99c827ac02846fa1e22f9827","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"jkyletan","email":"tanjkyle@gmail.com"},"repository":{"url":"git+https://github.com/jkyletan/sftoolkit.git","type":"git"},"_npmVersion":"10.9.0","description":"Here's a README.md for the provided JavaScript code:","directories":{},"_nodeVersion":"22.11.0","dependencies":{"fs":"^0.0.1-security","csv-parser":"^3.1.0","json-2-csv":"^5.5.7","time-stamp":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/sftoolkit_1.0.3_1735968061258_0.20319381741212106","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@_kyletan/sftoolkit","version":"1.0.4","keywords":["salesforce","sfdx","sf","nodejs","csv","bulkapi"],"author":{"name":"Kyle Tan"},"license":"ISC","_id":"@_kyletan/sftoolkit@1.0.4","maintainers":[{"name":"jkyletan","email":"tanjkyle@gmail.com"}],"homepage":"https://github.com/jkyletan/sftoolkit#readme","bugs":{"url":"https://github.com/jkyletan/sftoolkit/issues"},"dist":{"shasum":"ecfab7850d83bba64d4972a0a228e1f999f3b6dd","tarball":"https://registry.npmjs.org/@_kyletan/sftoolkit/-/sftoolkit-1.0.4.tgz","fileCount":3,"integrity":"sha512-LgULwGTmX+ixtJX8tii6aY0FmB5zb9T2gIUVhKlrhOhGpS1CIwD2HorTQ6/dFLBuzRo2qjwbeUDZT4q+ejS93w==","signatures":[{"sig":"MEUCIH6K+lMUxS1KLalqzXn0tUuW9nq2XX2Tpe51Fx9y3OZAAiEAqJnylscQxCc1r64UeqXBswAs6eMSByQs0E6wnC0VU5Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7831},"main":"index.js","type":"module","gitHead":"61692b9d86688c07bf34a21cd4e814bccb615eea","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"jkyletan","email":"tanjkyle@gmail.com"},"repository":{"url":"git+https://github.com/jkyletan/sftoolkit.git","type":"git"},"_npmVersion":"10.9.0","description":"Here's a README.md for the provided JavaScript code:","directories":{},"_nodeVersion":"22.11.0","dependencies":{"fs":"^0.0.1-security","csv-parser":"^3.1.0","json-2-csv":"^5.5.7","time-stamp":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/sftoolkit_1.0.4_1735969163756_0.894091252055093","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@_kyletan/sftoolkit","version":"1.0.5","keywords":["salesforce","sfdx","sf","nodejs","csv","bulkapi"],"author":{"name":"Kyle Tan"},"license":"ISC","_id":"@_kyletan/sftoolkit@1.0.5","maintainers":[{"name":"jkyletan","email":"tanjkyle@gmail.com"}],"homepage":"https://github.com/jkyletan/sftoolkit#readme","bugs":{"url":"https://github.com/jkyletan/sftoolkit/issues"},"dist":{"shasum":"f02d6b0a6c15510e769c4b6ee23f09294e44f910","tarball":"https://registry.npmjs.org/@_kyletan/sftoolkit/-/sftoolkit-1.0.5.tgz","fileCount":3,"integrity":"sha512-9JSxRuJW2jVqTm4NmL62ecIauwDz8vviB9HpHKuyLhAdT6Z91L5FnS079cgPgfSMkyWlHcGjdg2BlfHYI2vxQA==","signatures":[{"sig":"MEYCIQDkDyp9G5cHMAsumNHga70gA2LGCYZpXTpdQM/Wei1JKgIhAPSTHHPamXLATYDoZ1yfea8+Hf1jE3zoVkfwSZPrD95E","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7896},"main":"index.js","type":"module","gitHead":"030c3ac9e6cb73235d1b9bcb839893301757c068","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"jkyletan","email":"tanjkyle@gmail.com"},"repository":{"url":"git+https://github.com/jkyletan/sftoolkit.git","type":"git"},"_npmVersion":"10.9.0","description":"Here's a README.md for the provided JavaScript code:","directories":{},"_nodeVersion":"22.11.0","dependencies":{"fs":"^0.0.1-security","csv-parser":"^3.1.0","json-2-csv":"^5.5.7","time-stamp":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/sftoolkit_1.0.5_1735979611301_0.02085015468865503","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@_kyletan/sftoolkit","version":"1.0.6","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Kyle Tan"},"license":"ISC","dependencies":{"csv-parser":"^3.1.0","fs":"^0.0.1-security","json-2-csv":"^5.5.7","time-stamp":"^2.2.0"},"type":"module","devDependencies":{},"description":"Here's a README.md for the provided JavaScript code:","repository":{"type":"git","url":"git+https://github.com/jkyletan/sftoolkit.git"},"bugs":{"url":"https://github.com/jkyletan/sftoolkit/issues"},"homepage":"https://github.com/jkyletan/sftoolkit#readme","keywords":["salesforce","sfdx","sf","nodejs","csv","bulkapi"],"_id":"@_kyletan/sftoolkit@1.0.6","gitHead":"a17290e3711a73c9dfd97bdcf5250007a43680c2","_nodeVersion":"22.11.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-4AFJAVtWxLdly7MT0HAVCmdQUHdzsRxb/qBkWvxFc1DOoAtyyNHt2UkLLZlJvp/ztIu0XkD84jsE6/nPPRAeow==","shasum":"af8457403e718bb5643e0a43439253fbed2de89e","tarball":"https://registry.npmjs.org/@_kyletan/sftoolkit/-/sftoolkit-1.0.6.tgz","fileCount":3,"unpackedSize":7913,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDFRf2tPCcotbKwlwSwMc0MGpjnPUWJULs7ipNVd8+UDgIhAMf/1Ws7ryWHkSPacbaagIkE/abM5PXfuhOs8Dps7LTU"}]},"_npmUser":{"name":"jkyletan","email":"tanjkyle@gmail.com"},"directories":{},"maintainers":[{"name":"jkyletan","email":"tanjkyle@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sftoolkit_1.0.6_1738297762526_0.3399560237878565"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-04T04:52:32.199Z","modified":"2025-01-31T04:29:22.884Z","1.0.0":"2025-01-04T04:52:32.486Z","1.0.1":"2025-01-04T04:59:32.478Z","1.0.2":"2025-01-04T05:01:41.687Z","1.0.3":"2025-01-04T05:21:01.435Z","1.0.4":"2025-01-04T05:39:23.910Z","1.0.5":"2025-01-04T08:33:31.485Z","1.0.6":"2025-01-31T04:29:22.681Z"},"bugs":{"url":"https://github.com/jkyletan/sftoolkit/issues"},"author":{"name":"Kyle Tan"},"license":"ISC","homepage":"https://github.com/jkyletan/sftoolkit#readme","keywords":["salesforce","sfdx","sf","nodejs","csv","bulkapi"],"repository":{"type":"git","url":"git+https://github.com/jkyletan/sftoolkit.git"},"description":"Here's a README.md for the provided JavaScript code:","maintainers":[{"name":"jkyletan","email":"tanjkyle@gmail.com"}],"readme":"\nHere's a README.md for the provided JavaScript code:\n\n# Salesforce Data Management Utilities\n\nThis module provides utilities for handling CSV and JSON data interactions with Salesforce. It includes functions for converting CSV to JSON, performing bulk inserts into Salesforce, running anonymous Apex scripts, and creating CSV files from JSON data.\n\n## Prerequisites\n\n- Node.js (version 14 or higher)\n- Salesforce CLI (`sf` command installed and configured with Salesforce org aliases)\n\n## Import\n\n- Import methods similar to below or reference this code: https://github.com/jkyletan/nodePhDreamin2025\n\n```javascript\nimport {getJsonDataFromCsv, createCsvFileFromJson, bulkInsertToSalesforce} from '@_kyletan/sftoolkit'\n```\n\n## Functions\n\n### `getJsonDataFromCsv(filePath)`\n- **Description:** Converts a CSV file to JSON format.\n- **Parameters:**\n  - `filePath`: Path to the CSV file.\n- **Returns:** A Promise that resolves to an array of JSON objects.\n\n### `bulkInsertToSalesforce(filePath, sObject, orgAlias)`\n- **Description:** Performs a bulk insert into Salesforce using the Salesforce CLI.\n- **Parameters:**\n  - `filePath`: Path to the CSV file to be imported.\n  - `sObject`: The Salesforce object to insert into.\n  - `orgAlias`: Alias for the Salesforce org to interact with.\n- **Returns:** A Promise that resolves with the result of the bulk insert operation.\n\n### `runAnonymousApexScript(filePathOfApexScript, orgAlias)`\n- **Description:** Executes an anonymous Apex script in Salesforce.\n- **Parameters:**\n  - `filePathOfApexScript`: Path to the Apex script file.\n  - `orgAlias`: Alias for the Salesforce org where the script will run.\n- **Returns:** A Promise that resolves with the execution results.\n\n### `createCsvFileFromJson(jsonData)`\n- **Description:** Converts JSON data to a CSV file.\n- **Parameters:**\n  - `jsonData`: JSON data to convert to CSV.\n- **Returns:** A Promise that resolves with the name of the newly created CSV file.\n\n### `insertJsonDataToSalesforce(jsonData, sObject, orgAlias)`\n- **Description:** Converts JSON data to CSV and then performs a bulk insert into Salesforce.\n- **Parameters:**\n  - `jsonData`: JSON data to insert into Salesforce.\n  - `sObject`: The Salesforce object to insert into.\n  - `orgAlias`: Alias for the Salesforce org to interact with.\n- **Returns:** A Promise that resolves with the result of the bulk insert operation.\n\n## Usage\nHere's how you might use these functions:\n\n```javascript\nconst { getJsonDataFromCsv, bulkInsertToSalesforce, runAnonymousApexScript, createCsvFileFromJson, insertJsonDataToSalesforce } = require('./path-to-your-file');\n\n// Example: Reading CSV and inserting into Salesforce\ngetJsonDataFromCsv('path/to/your/file.csv')\n  .then(json => insertJsonDataToSalesforce(json, 'Account', 'myOrgAlias'))\n  .then(result => console.log('Insertion Result:', result))\n  .catch(err => console.error('Error:', err));\n\n// Example: Running an anonymous Apex script\nrunAnonymousApexScript('path/to/your/apexScript.apex', 'myOrgAlias')\n  .then(result => console.log('Apex Execution Result:', result))\n  .catch(err => console.error('Error:', err));\n\n// Example: Creating a CSV from JSON\ncreateCsvFileFromJson([{name: 'John Doe', age: 30}])\n  .then(fileName => console.log('CSV file created:', fileName))\n  .catch(err => console.error('Error:', err));\n```\n\n### Notes\nEnsure your Salesforce CLI is set up correctly with the appropriate org aliases.\nThe time-stamp package is used for generating unique file names based on the current timestamp.\nError handling is implemented using Promises for asynchronous operations.\nThe code assumes that the Salesforce CLI (sf) commands are available in the PATH.","readmeFilename":"README.md"}