Skip to content

Commit

Permalink
update each function examples (#796)
Browse files Browse the repository at this point in the history
* update each docs

* build docs

* update caption

* common: update each docs

* update asts

* versions

* revert patches for packages which don't export each

---------

Co-authored-by: Joe Clark <[email protected]>
  • Loading branch information
mtuchi and josephjclark authored Oct 28, 2024
1 parent 3cff54d commit 1a8017f
Show file tree
Hide file tree
Showing 138 changed files with 1,033 additions and 165 deletions.
8 changes: 8 additions & 0 deletions packages/asana/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @openfn/language-asana

## 4.0.5

### Patch Changes

- Updated docs for each()
- Updated dependencies
- @openfn/language-common@2.1.1

## 4.0.4

### Patch Changes
Expand Down
15 changes: 13 additions & 2 deletions packages/asana/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@
"operation"
],
"docs": {
"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.",
"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.",
"tags": [
{
"title": "public",
Expand All @@ -734,7 +734,18 @@
},
{
"title": "example",
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
"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);",
"caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
},
{
"title": "example",
"description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
"caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "example",
"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);",
"caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "param",
Expand Down
2 changes: 1 addition & 1 deletion packages/asana/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/language-asana",
"version": "4.0.4",
"version": "4.0.5",
"description": "An adaptor to access objects in Asana",
"homepage": "https://docs.openfn.org",
"repository": {
Expand Down
8 changes: 8 additions & 0 deletions packages/azure-storage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @openfn/language-azure-storage

## 2.0.5

### Patch Changes

- Updated docs for each()
- Updated dependencies
- @openfn/language-common@2.1.1

## 2.0.4

### Patch Changes
Expand Down
15 changes: 13 additions & 2 deletions packages/azure-storage/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@
"operation"
],
"docs": {
"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.",
"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.",
"tags": [
{
"title": "public",
Expand All @@ -517,7 +517,18 @@
},
{
"title": "example",
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
"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);",
"caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
},
{
"title": "example",
"description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
"caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "example",
"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);",
"caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "param",
Expand Down
2 changes: 1 addition & 1 deletion packages/azure-storage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/language-azure-storage",
"version": "2.0.4",
"version": "2.0.5",
"description": "OpenFn adaptor for Azure Storage",
"type": "module",
"exports": {
Expand Down
8 changes: 8 additions & 0 deletions packages/bigquery/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @openfn/language-bigquery

## 3.0.6

### Patch Changes

- Updated docs for each()
- Updated dependencies
- @openfn/language-common@2.1.1

## 3.0.5

### Patch Changes
Expand Down
15 changes: 13 additions & 2 deletions packages/bigquery/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@
"operation"
],
"docs": {
"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.",
"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.",
"tags": [
{
"title": "public",
Expand All @@ -385,7 +385,18 @@
},
{
"title": "example",
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
"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);",
"caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
},
{
"title": "example",
"description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
"caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "example",
"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);",
"caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "param",
Expand Down
2 changes: 1 addition & 1 deletion packages/bigquery/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/language-bigquery",
"version": "3.0.5",
"version": "3.0.6",
"description": "A Google BigQuery language package for use with Open Function",
"main": "dist/index.cjs",
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions packages/cartodb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @openfn/language-cartodb

## 0.4.7

### Patch Changes

- Updated docs for each()
- Updated dependencies
- @openfn/language-common@2.1.1

## 0.4.6

### Patch Changes
Expand Down
15 changes: 13 additions & 2 deletions packages/cartodb/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
"operation"
],
"docs": {
"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.",
"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.",
"tags": [
{
"title": "public",
Expand All @@ -388,7 +388,18 @@
},
{
"title": "example",
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
"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);",
"caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
},
{
"title": "example",
"description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
"caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "example",
"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);",
"caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "param",
Expand Down
2 changes: 1 addition & 1 deletion packages/cartodb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/language-cartodb",
"version": "0.4.6",
"version": "0.4.7",
"description": "cartodb Language Pack for OpenFn",
"main": "dist/index.cjs",
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions packages/cht/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @openfn/language-cht

## 1.0.5

### Patch Changes

- Updated docs for each()
- Updated dependencies
- @openfn/language-common@2.1.1

## 1.0.4

### Patch Changes
Expand Down
15 changes: 13 additions & 2 deletions packages/cht/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@
"operation"
],
"docs": {
"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.",
"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.",
"tags": [
{
"title": "public",
Expand All @@ -481,7 +481,18 @@
},
{
"title": "example",
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
"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);",
"caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
},
{
"title": "example",
"description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
"caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "example",
"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);",
"caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "param",
Expand Down
2 changes: 1 addition & 1 deletion packages/cht/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/language-cht",
"version": "1.0.4",
"version": "1.0.5",
"description": "OpenFn CHT adaptor",
"type": "module",
"exports": {
Expand Down
8 changes: 8 additions & 0 deletions packages/commcare/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @openfn/language-commcare

## 3.2.4

### Patch Changes

- Updated docs for each()
- Updated dependencies
- @openfn/language-common@2.1.1

## 3.2.3

### Patch Changes
Expand Down
15 changes: 13 additions & 2 deletions packages/commcare/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@
"operation"
],
"docs": {
"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.",
"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.",
"tags": [
{
"title": "public",
Expand All @@ -813,7 +813,18 @@
},
{
"title": "example",
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
"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);",
"caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
},
{
"title": "example",
"description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
"caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "example",
"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);",
"caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "param",
Expand Down
2 changes: 1 addition & 1 deletion packages/commcare/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/language-commcare",
"version": "3.2.3",
"version": "3.2.4",
"description": "Commcare Language Pack for OpenFn",
"homepage": "https://docs.openfn.org",
"repository": {
Expand Down
6 changes: 6 additions & 0 deletions packages/common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## 2.0.0

## 2.1.1

### Patch Changes

- Updated docs for each()

## 2.1.0

### Minor Changes
Expand Down
15 changes: 13 additions & 2 deletions packages/common/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@
"operation"
],
"docs": {
"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.",
"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.",
"tags": [
{
"title": "public",
Expand All @@ -555,7 +555,18 @@
},
{
"title": "example",
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
"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);",
"caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
},
{
"title": "example",
"description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
"caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "example",
"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);",
"caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
},
{
"title": "param",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/language-common",
"version": "2.1.0",
"version": "2.1.1",
"description": "Common Expressions for OpenFn",
"homepage": "https://docs.openfn.org",
"repository": {
Expand Down
Loading

0 comments on commit 1a8017f

Please sign in to comment.