Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update each function examples #796

Merged
merged 8 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[email protected]

## 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/[email protected]

## 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/[email protected]

## 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/[email protected]

## 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/[email protected]

## 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/[email protected]

## 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
Loading