Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mtuchi committed Nov 12, 2024
1 parent 3173811 commit 5353794
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 27 deletions.
80 changes: 70 additions & 10 deletions packages/salesforce/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
"description": "bulk(\n \"vera__Beneficiary__c\",\n \"upsert\",\n [\n {\n vera__Reporting_Period__c: 2023,\n vera__Geographic_Area__c: \"Uganda\",\n \"vera__Indicator__r.vera__ExtId__c\": 1001,\n vera__Result_UID__c: \"1001_2023_Uganda\",\n },\n ],\n { extIdField: \"vera__Result_UID__c\" }\n);",
"caption": "Bulk upsert"
},
{
"title": "example",
"description": "fn((state) => {\n state.accounts = state.data.map((a) => ({ Id: a.id, Name: a.name }));\n return state;\n});\nbulk(\"Account\", \"update\", { failOnError: true }, $.accounts);",
"caption": "Bulk update Account records using a lazy state reference"
},
{
"title": "function",
"description": null,
Expand Down Expand Up @@ -131,6 +136,10 @@
"name": "options.pollTimeout",
"default": "240000"
},
{
"title": "state",
"description": "{SalesforceState}"
},
{
"title": "returns",
"description": null,
Expand Down Expand Up @@ -159,12 +168,18 @@
},
{
"title": "example",
"description": "bulkQuery(state=> `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`);",
"caption": "The results will be available on `state.data`"
"description": "bulkQuery(state=> `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.healthId}'`);",
"caption": "Bulk query patient records where `Health_ID__c` is equal to the value in `state.data.healthId`"
},
{
"title": "example",
"description": "bulkQuery(`SELECT Id FROM Patient__c WHERE Health_ID__c = '${$.data.healthId}'`);",
"caption": "Bulk query patient records using a lazy state reference"
},
{
"title": "example",
"description": "bulkQuery(\n (state) =>\n `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`,\n { pollTimeout: 10000, pollInterval: 6000 }\n);"
"description": "bulkQuery(\n (state) =>\n `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`,\n { pollTimeout: 10000, pollInterval: 6000 }\n);",
"caption": "Bulk query with custom polling options"
},
{
"title": "function",
Expand Down Expand Up @@ -215,6 +230,10 @@
"name": "options.pollInterval",
"default": "3000"
},
{
"title": "state",
"description": "{SalesforceState}"
},
{
"title": "returns",
"description": null,
Expand Down Expand Up @@ -274,6 +293,10 @@
},
"name": "records"
},
{
"title": "state",
"description": "{SalesforceState}"
},
{
"title": "returns",
"description": null,
Expand Down Expand Up @@ -326,6 +349,10 @@
},
"name": "sObjectName"
},
{
"title": "state",
"description": "{SalesforceState}"
},
{
"title": "returns",
"description": null,
Expand Down Expand Up @@ -355,7 +382,8 @@
},
{
"title": "example",
"description": "destroy('obj_name', [\n '0060n00000JQWHYAA5',\n '0090n00000JQEWHYAA5'\n], { failOnError: true })"
"description": "destroy(\"Account\", [\"001XXXXXXXXXXXXXXX\", \"001YYYYYYYYYYYYYYY\"], {\n failOnError: true,\n});",
"caption": "Delete multiple Account records"
},
{
"title": "function",
Expand Down Expand Up @@ -389,6 +417,10 @@
},
"name": "options"
},
{
"title": "state",
"description": "{SalesforceState}"
},
{
"title": "returns",
"description": null,
Expand Down Expand Up @@ -448,6 +480,10 @@
},
"name": "records"
},
{
"title": "state",
"description": "{SalesforceState}"
},
{
"title": "returns",
"description": null,
Expand Down Expand Up @@ -477,12 +513,18 @@
},
{
"title": "example",
"description": "query(state=> `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`);"
"description": "query('SELECT Id FROM Patient__c', { autoFetch: true });",
"caption": "Query more records if next records are available"
},
{
"title": "example",
"description": "query(state=> `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`, { autoFetch: true });",
"caption": "Query more records if next records are available"
"description": "query(state=> `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.healthId}'`);",
"caption": "Query patients by Health ID"
},
{
"title": "example",
"description": "query(`SELECT Id FROM Patient__c WHERE Health_ID__c = '${$.data.healthId}'`);",
"caption": "Query patients by Health ID using a lazy state reference"
},
{
"title": "function",
Expand Down Expand Up @@ -522,13 +564,17 @@
},
{
"title": "param",
"description": "A callback to execute once the record is retrieved",
"description": "A callback to execute once the record is retrieved\n<<<<<<< HEAD\n=======",
"type": {
"type": "NameExpression",
"name": "function"
},
"name": "callback"
},
{
"title": "state",
"description": "{SalesforceState}\n>>>>>>> 1ece1ff1 (update examples)"
},
{
"title": "returns",
"description": null,
Expand Down Expand Up @@ -628,6 +674,10 @@
"title": "magic",
"description": "records - $.children[?(@.name==\"{{args.sObject}}\")].children[?([email protected])]"
},
{
"title": "state",
"description": "{SalesforceState}"
},
{
"title": "returns",
"description": null,
Expand Down Expand Up @@ -705,6 +755,10 @@
},
"name": "records"
},
{
"title": "state",
"description": "{SalesforceState}"
},
{
"title": "returns",
"description": null,
Expand Down Expand Up @@ -732,7 +786,8 @@
},
{
"title": "example",
"description": "fn((state) => {\n const s = toUTF8(\"άνθρωποι\");\n console.log(s); // anthropoi\n return state;\n});"
"description": "fn((state) => {\n const s = toUTF8(\"άνθρωποι\");\n console.log(s); // anthropoi\n return state;\n});",
"caption": "Transliterate `άνθρωποι` to `anthropoi`"
},
{
"title": "param",
Expand Down Expand Up @@ -771,7 +826,8 @@
},
{
"title": "example",
"description": "retrieve('ContentVersion', '0684K0000020Au7QAE/VersionData');"
"description": "retrieve('ContentVersion', '0684K0000020Au7QAE/VersionData');",
"caption": "Retrieve a specific ContentVersion record"
},
{
"title": "function",
Expand All @@ -796,6 +852,10 @@
},
"name": "id"
},
{
"title": "state",
"description": "{SalesforceState}"
},
{
"title": "returns",
"description": null,
Expand Down
Loading

0 comments on commit 5353794

Please sign in to comment.