@openfn/language-mysql 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/ast.json +13 -2
  2. package/package.json +2 -2
package/ast.json CHANGED
@@ -528,7 +528,7 @@
528
528
  "operation"
529
529
  ],
530
530
  "docs": {
531
- "description": "Scopes an array of data based on a JSONPath.\nUseful when the source data has `n` items you would like to map to\nan operation.\nThe operation will receive a slice of the data based of each item\nof the JSONPath provided.\n\nIt also ensures the results of an operation make their way back into\nthe state's references.",
531
+ "description": "Iterates over an array of items and invokes an operation upon each one, where the state\nobject is _scoped_ so that state.data is the item under iteration.\nThe rest of the state object is untouched and can be referenced as usual.\nYou can pass an array directly, or use lazy state or a JSONPath string to\nreference a slice of state.",
532
532
  "tags": [
533
533
  {
534
534
  "title": "public",
@@ -542,7 +542,18 @@
542
542
  },
543
543
  {
544
544
  "title": "example",
545
- "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
545
+ "description": "each(\n $.data,\n // Inside the callback operation, `$.data` is scoped to the item under iteration\n insert(\"patient\", {\n patient_name: $.data.properties.case_name,\n patient_id: $.data.case_id,\n })\n);",
546
+ "caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
547
+ },
548
+ {
549
+ "title": "example",
550
+ "description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
551
+ "caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
552
+ },
553
+ {
554
+ "title": "example",
555
+ "description": "each(\n \"$.data[*]\",\n insert(\"patient\", (state) => ({\n patient_name: state.data.properties.case_name,\n patient_id: state.data.case_id,\n }))\n);",
556
+ "caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
546
557
  },
547
558
  {
548
559
  "title": "param",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-mysql",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "A MySQL Language Pack for OpenFn",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "main": "dist/index.cjs",
@@ -21,7 +21,7 @@
21
21
  "mysql": "^2.13.0",
22
22
  "squel": "^5.8.0",
23
23
  "string-escape": "^0.3.0",
24
- "@openfn/language-common": "2.1.0"
24
+ "@openfn/language-common": "2.1.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@openfn/simple-ast": "^0.4.1",