@openfn/language-common
Advanced tools
Comparing version 1.15.0 to 1.15.1
204
ast.json
@@ -60,6 +60,2 @@ { | ||
{ | ||
"title": "example", | ||
"description": "fn(state => {\n // do some things to state\n return state;\n});" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -70,2 +66,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "fn(state => {\n // do some things to state\n return state;\n});" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -106,6 +106,2 @@ "description": "is the function", | ||
{ | ||
"title": "example", | ||
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -116,2 +112,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -161,6 +161,2 @@ "description": "The condition that returns true", | ||
{ | ||
"title": "example", | ||
"description": "jsonValue({ a:1 }, 'a')" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -171,2 +167,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "jsonValue({ a:1 }, 'a')" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -215,6 +215,2 @@ "description": "A valid JSON object.", | ||
{ | ||
"title": "example", | ||
"description": "sourceValue('$.key')" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -225,2 +221,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "sourceValue('$.key')" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -260,6 +260,2 @@ "description": "JSONPath referencing a point in `state`.", | ||
{ | ||
"title": "example", | ||
"description": "source('$.key')" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -270,2 +266,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "source('$.key')" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -323,6 +323,2 @@ "description": "JSONPath referencing a point in `state`.", | ||
{ | ||
"title": "example", | ||
"description": "dataPath('key')" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -333,2 +329,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "dataPath('key')" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -368,6 +368,2 @@ "description": "JSONPath referencing a point in `data`.", | ||
{ | ||
"title": "example", | ||
"description": "dataValue('key')" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -378,2 +374,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "dataValue('key')" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -413,6 +413,2 @@ "description": "JSONPath referencing a point in `data`.", | ||
{ | ||
"title": "example", | ||
"description": "referencePath('key')" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -423,2 +419,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "referencePath('key')" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -458,6 +458,2 @@ "description": "JSONPath referencing a point in `references`.", | ||
{ | ||
"title": "example", | ||
"description": "lastReferenceValue('key')" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -468,2 +464,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "lastReferenceValue('key')" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -504,6 +504,2 @@ "description": "JSONPath referencing a point in `references`.", | ||
{ | ||
"title": "example", | ||
"description": "asData('$.key'| key | callback)" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -514,2 +510,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "asData('$.key'| key | callback)" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -572,6 +572,2 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -582,2 +578,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -626,6 +626,2 @@ "description": "JSONPath referencing a point in `state`.", | ||
{ | ||
"title": "example", | ||
"description": "combine(\n create('foo'),\n delete('bar')\n)" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -636,2 +632,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "combine(\n create('foo'),\n delete('bar')\n)" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -673,6 +673,2 @@ "description": "Operations to be performed.", | ||
{ | ||
"title": "example", | ||
"description": "join('$.key','$.data','newKey')" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -683,2 +679,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "join('$.key','$.data','newKey')" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -789,6 +789,2 @@ "description": "Target path", | ||
{ | ||
"title": "example", | ||
"description": "field('destination_field_name__c', 'value')" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -799,2 +795,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "field('destination_field_name__c', 'value')" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -843,6 +843,2 @@ "description": "Name of the field", | ||
{ | ||
"title": "example", | ||
"description": "fields(list_of_fields)" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -853,2 +849,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "fields(list_of_fields)" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -898,2 +898,7 @@ "description": "a list of fields", | ||
{ | ||
"title": "public", | ||
"description": null, | ||
"type": null | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -953,2 +958,7 @@ "description": null, | ||
{ | ||
"title": "public", | ||
"description": null, | ||
"type": null | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -1013,6 +1023,2 @@ "description": "The array of objects to be grouped.", | ||
{ | ||
"title": "example", | ||
"description": "index()" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -1023,2 +1029,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "index()" | ||
}, | ||
{ | ||
"title": "returns", | ||
@@ -1050,6 +1060,2 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "field(\"destination_string__c\", function(state) {\n return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -1060,2 +1066,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "field(\"destination_string__c\", function(state) {\n return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -1104,6 +1114,2 @@ "description": "Array of toString'able primatives.", | ||
{ | ||
"title": "example", | ||
"description": "each(function(state) {\n return toArray( dataValue(\"path_of_array\")(state) )\n}, ...)" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -1114,2 +1120,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "each(function(state) {\n return toArray( dataValue(\"path_of_array\")(state) )\n}, ...)" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -1150,6 +1160,2 @@ "description": "Data required to be in an array", | ||
{ | ||
"title": "example", | ||
"description": "composeNextState(state, response)" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -1160,2 +1166,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "composeNextState(state, response)" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -1204,6 +1214,2 @@ "description": "state", | ||
{ | ||
"title": "example", | ||
"description": "field(\"destination_string__c\", humanProper(state.data.path_to_string))" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -1214,2 +1220,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "field(\"destination_string__c\", humanProper(state.data.path_to_string))" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -1317,6 +1327,2 @@ "description": "String that needs converting", | ||
{ | ||
"title": "example", | ||
"description": "scrubEmojis('Dove🕊️⭐ 29')" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -1327,2 +1333,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "scrubEmojis('Dove🕊️⭐ 29')" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -1372,6 +1382,2 @@ "description": "String that needs to be cleaned", | ||
{ | ||
"title": "example", | ||
"description": "chunk([1,2,3,4,5], 2)" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -1382,2 +1388,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "chunk([1,2,3,4,5], 2)" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -1501,2 +1511,7 @@ "description": "Array to be chunked", | ||
{ | ||
"title": "function", | ||
"description": null, | ||
"name": null | ||
}, | ||
{ | ||
"title": "example", | ||
@@ -1512,7 +1527,2 @@ "description": "cursor($.cursor, { defaultValue: 'today' })", | ||
{ | ||
"title": "function", | ||
"description": null, | ||
"name": null | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -1590,6 +1600,2 @@ "description": "the cursor value. Usually an ISO date, natural language date, or page number", | ||
{ | ||
"title": "example", | ||
"description": "map(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)" | ||
}, | ||
{ | ||
"title": "function", | ||
@@ -1600,2 +1606,6 @@ "description": null, | ||
{ | ||
"title": "example", | ||
"description": "map(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)" | ||
}, | ||
{ | ||
"title": "param", | ||
@@ -1602,0 +1612,0 @@ "description": "JSONPath referencing a point in `state.data`.", |
@@ -261,3 +261,6 @@ var __defProp = Object.defineProperty; | ||
}); | ||
import { parse, format } from "date-fns"; | ||
import { | ||
parse, | ||
format | ||
} from "date-fns"; | ||
@@ -264,0 +267,0 @@ // src/Adaptor.js |
{ | ||
"name": "@openfn/language-common", | ||
"version": "1.15.0", | ||
"version": "1.15.1", | ||
"description": "Common Expressions for OpenFn", | ||
@@ -5,0 +5,0 @@ "homepage": "https://docs.openfn.org", |
@@ -25,2 +25,3 @@ /** | ||
* @public | ||
* @function | ||
* @example | ||
@@ -31,3 +32,2 @@ * fn(state => { | ||
* }); | ||
* @function | ||
* @param {Function} func is the function | ||
@@ -40,5 +40,5 @@ * @returns {Operation} | ||
* @public | ||
* @function | ||
* @example | ||
* fnIf((state) => state?.data?.name, get("https://example.com")); | ||
* @function | ||
* @param {Boolean} condition - The condition that returns true | ||
@@ -54,5 +54,5 @@ * @param {Operation} operation - The operation needed to be executed. | ||
* @public | ||
* @function | ||
* @example | ||
* jsonValue({ a:1 }, 'a') | ||
* @function | ||
* @param {object} obj - A valid JSON object. | ||
@@ -68,5 +68,5 @@ * @param {String} path - JSONPath referencing a point in given JSON object. | ||
* @public | ||
* @function | ||
* @example | ||
* sourceValue('$.key') | ||
* @function | ||
* @param {String} path - JSONPath referencing a point in `state`. | ||
@@ -81,5 +81,5 @@ * @returns {Operation} | ||
* @public | ||
* @function | ||
* @example | ||
* source('$.key') | ||
* @function | ||
* @param {String} path - JSONPath referencing a point in `state`. | ||
@@ -92,5 +92,5 @@ * @returns {Array.<String|Object>} | ||
* @public | ||
* @function | ||
* @example | ||
* dataPath('key') | ||
* @function | ||
* @param {string} path - JSONPath referencing a point in `data`. | ||
@@ -105,5 +105,5 @@ * @returns {string} | ||
* @public | ||
* @function | ||
* @example | ||
* dataValue('key') | ||
* @function | ||
* @param {String} path - JSONPath referencing a point in `data`. | ||
@@ -116,5 +116,5 @@ * @returns {Operation} | ||
* @public | ||
* @function | ||
* @example | ||
* referencePath('key') | ||
* @function | ||
* @param {string} path - JSONPath referencing a point in `references`. | ||
@@ -127,5 +127,5 @@ * @returns {string} | ||
* @public | ||
* @function | ||
* @example | ||
* lastReferenceValue('key') | ||
* @function | ||
* @param {String} path - JSONPath referencing a point in `references`. | ||
@@ -142,5 +142,5 @@ * @returns {Operation} | ||
* @public | ||
* @function | ||
* @example | ||
* asData('$.key'| key | callback) | ||
* @function | ||
* @param {String|object|function} data | ||
@@ -161,2 +161,3 @@ * @param {object} state - The current state. | ||
* @public | ||
* @function | ||
* @example | ||
@@ -168,3 +169,2 @@ * each("$.[*]", | ||
* ) | ||
* @function | ||
* @param {DataSource} dataSource - JSONPath referencing a point in `state`. | ||
@@ -178,2 +178,3 @@ * @param {Operation} operation - The operation needed to be repeated. | ||
* @public | ||
* @function | ||
* @example | ||
@@ -184,3 +185,2 @@ * combine( | ||
* ) | ||
* @function | ||
* @param {Operations} operations - Operations to be performed. | ||
@@ -193,5 +193,5 @@ * @returns {Operation} | ||
* @public | ||
* @function | ||
* @example | ||
* join('$.key','$.data','newKey') | ||
* @function | ||
* @param {String} targetPath - Target path | ||
@@ -215,5 +215,5 @@ * @param {String} sourcePath - Source path | ||
* @public | ||
* @function | ||
* @example | ||
* field('destination_field_name__c', 'value') | ||
* @function | ||
* @param {string} key - Name of the field | ||
@@ -227,5 +227,5 @@ * @param {Value} value - The value itself or a sourceable operation. | ||
* @public | ||
* @function | ||
* @example | ||
* fields(list_of_fields) | ||
* @function | ||
* @param {Fields} fields - a list of fields | ||
@@ -246,2 +246,3 @@ * @returns {Object} | ||
* @function | ||
* @public | ||
* @param {DataSource} dataSource | ||
@@ -265,2 +266,3 @@ * @param {Object} fields - Group of fields to merge in. | ||
* @function | ||
* @public | ||
* @param {Object[]} arrayOfObjects - The array of objects to be grouped. | ||
@@ -276,5 +278,5 @@ * @param {string} keyPath - The key path to group by. | ||
* @public | ||
* @function | ||
* @example | ||
* index() | ||
* @function | ||
* @returns {DataSource} | ||
@@ -286,2 +288,3 @@ */ | ||
* @public | ||
* @function | ||
* @example | ||
@@ -291,3 +294,2 @@ * field("destination_string__c", function(state) { | ||
* }) | ||
* @function | ||
* @param {array} arr - Array of toString'able primatives. | ||
@@ -302,2 +304,3 @@ * @param {string} separator - Separator string. | ||
* @public | ||
* @function | ||
* @example | ||
@@ -307,3 +310,2 @@ * each(function(state) { | ||
* }, ...) | ||
* @function | ||
* @param {any} arg - Data required to be in an array | ||
@@ -316,5 +318,5 @@ * @returns {array} | ||
* @public | ||
* @function | ||
* @example | ||
* composeNextState(state, response) | ||
* @function | ||
* @param {State} state - state | ||
@@ -328,5 +330,5 @@ * @param {Object} response - Response to be added | ||
* @public | ||
* @function | ||
* @example | ||
* field("destination_string__c", humanProper(state.data.path_to_string)) | ||
* @function | ||
* @param {string} str - String that needs converting | ||
@@ -350,5 +352,5 @@ * @returns {string} | ||
* @public | ||
* @function | ||
* @example | ||
* scrubEmojis('Dove🕊️⭐ 29') | ||
* @function | ||
* @param {string} text - String that needs to be cleaned | ||
@@ -362,5 +364,5 @@ * @param {string} replacementChars - Characters that replace the emojis | ||
* @public | ||
* @function | ||
* @example | ||
* chunk([1,2,3,4,5], 2) | ||
* @function | ||
* @param {Object} array - Array to be chunked | ||
@@ -398,2 +400,4 @@ * @param {Integer} chunkSize - The maxiumum size of each chunks | ||
* By default, schema is loaded from `state.schema` and data from `state.data`. | ||
* @pubic | ||
* @function | ||
* @param {string|object} schema - The schema, path or URL to validate against | ||
@@ -419,2 +423,3 @@ * @param {string|object} data - The data or path to validate | ||
* @public | ||
* @function | ||
* @example <caption>Use a cursor from state if present, or else use the default value</caption> | ||
@@ -424,3 +429,2 @@ * cursor($.cursor, { defaultValue: 'today' }) | ||
* cursor(22) | ||
* @function | ||
* @param {any} value - the cursor value. Usually an ISO date, natural language date, or page number | ||
@@ -448,2 +452,3 @@ * @param {object} options - options to control the cursor. | ||
* @public | ||
* @function | ||
* @example | ||
@@ -455,3 +460,2 @@ * map("$.[*]", | ||
* ) | ||
* @function | ||
* @param {string} path - JSONPath referencing a point in `state.data`. | ||
@@ -458,0 +462,0 @@ * @param {function} operation - The operation needed to be repeated. |
@@ -17,3 +17,3 @@ /** | ||
* @example <caption>Get an item with a specified id from state</caption> | ||
* get({ | ||
* http.get({ | ||
* url: state => `https://www.example.com/api/items/${state.id}, | ||
@@ -30,3 +30,3 @@ * headers: {"content-type": "application/json"} | ||
* @example <caption>Sending a payload with data that comes from state</caption> | ||
* post({ | ||
* http.post({ | ||
* url: "https://example.com", | ||
@@ -36,4 +36,4 @@ * data: (state) => state.data | ||
* @example <caption> Capturing the response for later use in state </caption> | ||
* alterState((state) => { | ||
* return post({ | ||
* fn((state) => { | ||
* return http.post({ | ||
* url: "https://example.com", | ||
@@ -54,3 +54,3 @@ * data: (state) => state.data | ||
* @example <caption>Gets the headers that would be returned if the HEAD request's URL was instead requested with the HTTP GET method</caption> | ||
* head({ | ||
* http.head({ | ||
* url: 'https://www.example.com/api/items', | ||
@@ -67,3 +67,3 @@ * }); | ||
* @example <caption>Creates a new resource or replaces a representation of the target resource with the request payload, with data from state.</caption> | ||
* put({ | ||
* http.put({ | ||
* url: state => `https://www.example.com/api/items/${state.id}`, | ||
@@ -81,3 +81,3 @@ * data: state => state.data | ||
* @example <caption>Applies partial modifications to a resource, with data from state.</caption> | ||
* patch({ | ||
* http.patch({ | ||
* url: state => `https://www.example.com/api/items/${state.id}`, | ||
@@ -95,3 +95,3 @@ * data: state => state.data | ||
* @example <caption>Requests permitted communication options for a given URL or server, with data from state.</caption> | ||
* options({ | ||
* http.options({ | ||
* url: 'https://www.example.com/api/items', | ||
@@ -109,3 +109,3 @@ * }); | ||
* @example <caption>Deleting a record with data that comes from state</caption> | ||
* delete({ | ||
* http.delete({ | ||
* url: state => `https://www.example.com/api/items/${state.id}`, | ||
@@ -112,0 +112,0 @@ * })(state); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
172664
4315