@openfn/language-common
Advanced tools
+82
-0
@@ -1410,2 +1410,84 @@ { | ||
| { | ||
| "name": "validate", | ||
| "params": [ | ||
| "schema", | ||
| "data" | ||
| ], | ||
| "docs": { | ||
| "description": "Validate against a JSON schema. Any errors are written to an array at `state.validationErrors`.\nSchema can be passed directly, loaded as a JSON path from state, or loaded from a URL\nData can be passed directly or loaded as a JSON path from state.\nBy default, schema is loaded from `state.schema` and data from `state.data`.", | ||
| "tags": [ | ||
| { | ||
| "title": "public", | ||
| "description": null, | ||
| "type": null | ||
| }, | ||
| { | ||
| "title": "function", | ||
| "description": null, | ||
| "name": null | ||
| }, | ||
| { | ||
| "title": "param", | ||
| "description": "The schema, path or URL to validate against", | ||
| "type": { | ||
| "type": "UnionType", | ||
| "elements": [ | ||
| { | ||
| "type": "NameExpression", | ||
| "name": "string" | ||
| }, | ||
| { | ||
| "type": "NameExpression", | ||
| "name": "object" | ||
| } | ||
| ] | ||
| }, | ||
| "name": "schema" | ||
| }, | ||
| { | ||
| "title": "param", | ||
| "description": "The data or path to validate", | ||
| "type": { | ||
| "type": "UnionType", | ||
| "elements": [ | ||
| { | ||
| "type": "NameExpression", | ||
| "name": "string" | ||
| }, | ||
| { | ||
| "type": "NameExpression", | ||
| "name": "object" | ||
| } | ||
| ] | ||
| }, | ||
| "name": "data" | ||
| }, | ||
| { | ||
| "title": "example", | ||
| "description": "validate()", | ||
| "caption": "Validate `state.data` with `state.schema`" | ||
| }, | ||
| { | ||
| "title": "example", | ||
| "description": "validate(\"https://www.example.com/schema/record\", \"form\")", | ||
| "caption": "Validate form data at `state.form` with a schema from a URL" | ||
| }, | ||
| { | ||
| "title": "example", | ||
| "description": "each(\"records[*]\", validate(\"https://www.example.com/schema/record\"))", | ||
| "caption": "Validate the each item in `state.records` with a schema from a URL" | ||
| }, | ||
| { | ||
| "title": "returns", | ||
| "description": null, | ||
| "type": { | ||
| "type": "NameExpression", | ||
| "name": "Operation" | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| "valid": true | ||
| }, | ||
| { | ||
| "name": "cursor", | ||
@@ -1412,0 +1494,0 @@ "params": [ |
+1
-1
@@ -919,3 +919,3 @@ var __create = Object.create; | ||
| state[cursorKey] = (format2 == null ? void 0 : format2(date)) ?? date.toISOString(); | ||
| const formatted = format2 ? state[cursorKey] : import_date_fns2.default.format(date, "HH:MM d MMM yyyy (OOO)"); | ||
| const formatted = format2 ? state[cursorKey] : import_date_fns2.default.format(date, "HH:mm d MMM yyyy (OOO)"); | ||
| console.log(`Setting ${cursorKey} "${cursor2}" to: ${formatted}`); | ||
@@ -922,0 +922,0 @@ return state; |
+1
-1
@@ -854,3 +854,3 @@ var __defProp = Object.defineProperty; | ||
| state[cursorKey] = (format2 == null ? void 0 : format2(date)) ?? date.toISOString(); | ||
| const formatted = format2 ? state[cursorKey] : dateFns.format(date, "HH:MM d MMM yyyy (OOO)"); | ||
| const formatted = format2 ? state[cursorKey] : dateFns.format(date, "HH:mm d MMM yyyy (OOO)"); | ||
| console.log(`Setting ${cursorKey} "${cursor2}" to: ${formatted}`); | ||
@@ -857,0 +857,0 @@ return state; |
+1
-1
| { | ||
| "name": "@openfn/language-common", | ||
| "label": "Common", | ||
| "version": "3.2.0", | ||
| "version": "3.2.1", | ||
| "description": "Common Expressions for OpenFn", | ||
@@ -6,0 +6,0 @@ "homepage": "https://docs.openfn.org", |
@@ -374,7 +374,7 @@ /** | ||
| /** | ||
| * Validate against a JSON schema. Any erors are written to an array at `state.validationErrors`. | ||
| * Validate against a JSON schema. Any errors are written to an array at `state.validationErrors`. | ||
| * Schema can be passed directly, loaded as a JSON path from state, or loaded from a URL | ||
| * Data can be passed directly or loaded as a JSON path from state. | ||
| * By default, schema is loaded from `state.schema` and data from `state.data`. | ||
| * @pubic | ||
| * @public | ||
| * @function | ||
@@ -381,0 +381,0 @@ * @param {string|object} schema - The schema, path or URL to validate against |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
220488
1.19%5760
1.46%