@openfn/language-mssql 5.0.5 → 5.0.7

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.
package/ast.json CHANGED
@@ -898,7 +898,7 @@
898
898
  "operation"
899
899
  ],
900
900
  "docs": {
901
- "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.",
901
+ "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.",
902
902
  "tags": [
903
903
  {
904
904
  "title": "public",
@@ -912,7 +912,18 @@
912
912
  },
913
913
  {
914
914
  "title": "example",
915
- "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
915
+ "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);",
916
+ "caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
917
+ },
918
+ {
919
+ "title": "example",
920
+ "description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
921
+ "caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
922
+ },
923
+ {
924
+ "title": "example",
925
+ "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);",
926
+ "caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
916
927
  },
917
928
  {
918
929
  "title": "param",
package/dist/index.cjs CHANGED
@@ -184,7 +184,7 @@ function queryHandler(state, query, callback, options) {
184
184
  }
185
185
  const request = new import_tedious.Request(query, (err, rowCount, rows) => {
186
186
  if (err) {
187
- console.error(err.message);
187
+ console.error(err);
188
188
  reject(err);
189
189
  } else {
190
190
  console.log(`Finished: ${rowCount} row(s).`);
package/dist/index.js CHANGED
@@ -158,7 +158,7 @@ function queryHandler(state, query, callback, options) {
158
158
  }
159
159
  const request = new Request(query, (err, rowCount, rows) => {
160
160
  if (err) {
161
- console.error(err.message);
161
+ console.error(err);
162
162
  reject(err);
163
163
  } else {
164
164
  console.log(`Finished: ${rowCount} row(s).`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-mssql",
3
- "version": "5.0.5",
3
+ "version": "5.0.7",
4
4
  "description": "A Microsoft SQL language pack for OpenFn",
5
5
  "exports": {
6
6
  ".": {
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "tedious": "15.1.0",
28
- "@openfn/language-common": "2.0.3"
28
+ "@openfn/language-common": "2.1.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@openfn/simple-ast": "0.4.1",