From bbedd0be7467053d85819d7dd2ee83b10deee2fe Mon Sep 17 00:00:00 2001 From: Joe Clark Date: Fri, 12 Jan 2024 12:24:20 +0000 Subject: [PATCH 1/6] Update auto-generated documentation. --- .github/workflows/docs-local.sh | 35 + docs/asana/CHANGELOG.md | 85 ++ docs/asana/README.md | 90 ++ docs/asana/index.md | 143 +++ docs/azure-storage/CHANGELOG.md | 11 + docs/azure-storage/README.md | 84 ++ docs/azure-storage/index.md | 77 ++ docs/beyonic/CHANGELOG.md | 103 +++ docs/beyonic/README.md | 74 ++ docs/beyonic/index.md | 72 ++ docs/bigquery/CHANGELOG.md | 126 +++ docs/bigquery/README.md | 62 ++ docs/bigquery/index.md | 36 + docs/cartodb/CHANGELOG.md | 64 ++ docs/cartodb/README.md | 54 ++ docs/commcare/CHANGELOG.md | 169 ++++ docs/commcare/README.md | 178 ++++ docs/commcare/index.md | 112 +++ docs/common/CHANGELOG.md | 152 ++++ docs/common/README.md | 14 + docs/common/index.md | 941 ++++++++++++++++++++ docs/dhis2/CHANGELOG.md | 149 ++++ docs/dhis2/README.md | 113 +++ docs/dhis2/index.md | 585 ++++++++++++ docs/docs.json | 50 ++ docs/dynamics/CHANGELOG.md | 122 +++ docs/dynamics/README.md | 93 ++ docs/dynamics/index.md | 0 docs/facebook/CHANGELOG.md | 63 ++ docs/facebook/README.md | 39 + docs/facebook/index.md | 26 + docs/fhir/CHANGELOG.md | 97 ++ docs/fhir/README.md | 44 + docs/fhir/index.md | 138 +++ docs/godata/CHANGELOG.md | 73 ++ docs/godata/README.md | 262 ++++++ docs/godata/index.md | 393 ++++++++ docs/googlehealthcare/CHANGELOG.md | 27 + docs/googlehealthcare/README.md | 27 + docs/googlehealthcare/index.md | 62 ++ docs/googlesheets/CHANGELOG.md | 91 ++ docs/googlesheets/README.md | 40 + docs/googlesheets/index.md | 27 + docs/hive/CHANGELOG.md | 7 + docs/hive/README.md | 31 + docs/hive/index.md | 21 + docs/http/CHANGELOG.md | 202 +++++ docs/http/README.md | 138 +++ docs/http/index.md | 207 +++++ docs/khanacademy/CHANGELOG.md | 60 ++ docs/khanacademy/README.md | 37 + docs/khanacademy/index.md | 20 + docs/kobotoolbox/CHANGELOG.md | 95 ++ docs/kobotoolbox/README.md | 47 + docs/kobotoolbox/index.md | 79 ++ docs/magpi/CHANGELOG.md | 70 ++ docs/magpi/README.md | 70 ++ docs/magpi/index.md | 52 ++ docs/mailchimp/CHANGELOG.md | 114 +++ docs/mailchimp/README.md | 24 + docs/mailchimp/index.md | 316 +++++++ docs/mailgun/CHANGELOG.md | 72 ++ docs/mailgun/README.md | 39 + docs/mailgun/index.md | 28 + docs/maximo/CHANGELOG.md | 66 ++ docs/maximo/README.md | 81 ++ docs/maximo/index.md | 77 ++ docs/medicmobile/CHANGELOG.md | 65 ++ docs/medicmobile/README.md | 61 ++ docs/medicmobile/index.md | 76 ++ docs/mogli/CHANGELOG.md | 70 ++ docs/mogli/README.md | 47 + docs/mogli/connecting_with_sms_providers.md | 24 + docs/mogli/connecting_with_telcos.md | 24 + docs/mogli/index.md | 70 ++ docs/mongodb/CHANGELOG.md | 49 + docs/mongodb/README.md | 51 ++ docs/mongodb/index.md | 144 +++ docs/msgraph/CHANGELOG.md | 86 ++ docs/msgraph/README.md | 26 + docs/msgraph/index.md | 231 +++++ docs/mssql/CHANGELOG.md | 164 ++++ docs/mssql/README.md | 241 +++++ docs/mssql/index.md | 341 +++++++ docs/mysql/CHANGELOG.md | 117 +++ docs/mysql/README.md | 111 +++ docs/mysql/index.md | 128 +++ docs/nexmo/CHANGELOG.md | 82 ++ docs/nexmo/README.md | 32 + docs/nexmo/index.md | 21 + docs/ocl/CHANGELOG.md | 155 ++++ docs/ocl/README.md | 34 + docs/ocl/index.md | 76 ++ docs/openfn/CHANGELOG.md | 122 +++ docs/openfn/README.md | 50 ++ docs/openfn/index.md | 20 + docs/openhim/CHANGELOG.md | 65 ++ docs/openhim/README.md | 157 ++++ docs/openhim/index.md | 20 + docs/openmrs/CHANGELOG.md | 162 ++++ docs/openmrs/README.md | 110 +++ docs/openmrs/index.md | 353 ++++++++ docs/openspp/CHANGELOG.md | 40 + docs/openspp/README.md | 32 + docs/openspp/index.md | 484 ++++++++++ docs/postgresql/CHANGELOG.md | 141 +++ docs/postgresql/README.md | 208 +++++ docs/postgresql/index.md | 315 +++++++ docs/primero/CHANGELOG.md | 164 ++++ docs/primero/README.md | 41 + docs/primero/index.md | 406 +++++++++ docs/progres/CHANGELOG.md | 122 +++ docs/progres/README.md | 53 ++ docs/progres/index.md | 30 + docs/rapidpro/CHANGELOG.md | 128 +++ docs/rapidpro/README.md | 83 ++ docs/rapidpro/index.md | 110 +++ docs/resourcemap/CHANGELOG.md | 54 ++ docs/resourcemap/README.md | 48 + docs/resourcemap/index.md | 20 + docs/salesforce/CHANGELOG.md | 214 +++++ docs/salesforce/README.md | 82 ++ docs/salesforce/index.md | 478 ++++++++++ docs/sftp/CHANGELOG.md | 201 +++++ docs/sftp/README.md | 170 ++++ docs/sftp/index.md | 147 +++ docs/smpp/CHANGELOG.md | 54 ++ docs/smpp/README.md | 35 + docs/smpp/index.md | 0 docs/surveycto/CHANGELOG.md | 65 ++ docs/surveycto/README.md | 49 + docs/surveycto/index.md | 20 + docs/telerivet/CHANGELOG.md | 65 ++ docs/telerivet/README.md | 70 ++ docs/telerivet/index.md | 20 + docs/template/CHANGELOG.md | 104 +++ docs/template/README.md | 32 + docs/template/index.md | 21 + docs/tutorial/index.md | 0 docs/twilio/CHANGELOG.md | 65 ++ docs/twilio/README.md | 46 + docs/twilio/index.md | 23 + docs/vtiger/CHANGELOG.md | 54 ++ docs/vtiger/README.md | 46 + docs/vtiger/index.md | 0 docs/zoho/CHANGELOG.md | 58 ++ docs/zoho/README.md | 41 + docs/zoho/index.md | 24 + packages/http/ast.json | 10 +- tools/build/src/commands/docs.ts | 3 + tools/build/src/util/docs-template.hbs | 4 +- tools/build/src/util/hbs-helpers.js | 3 + 152 files changed, 15417 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/docs-local.sh create mode 100644 docs/asana/CHANGELOG.md create mode 100644 docs/asana/README.md create mode 100644 docs/asana/index.md create mode 100644 docs/azure-storage/CHANGELOG.md create mode 100644 docs/azure-storage/README.md create mode 100644 docs/azure-storage/index.md create mode 100644 docs/beyonic/CHANGELOG.md create mode 100644 docs/beyonic/README.md create mode 100644 docs/beyonic/index.md create mode 100644 docs/bigquery/CHANGELOG.md create mode 100644 docs/bigquery/README.md create mode 100644 docs/bigquery/index.md create mode 100644 docs/cartodb/CHANGELOG.md create mode 100644 docs/cartodb/README.md create mode 100644 docs/commcare/CHANGELOG.md create mode 100644 docs/commcare/README.md create mode 100644 docs/commcare/index.md create mode 100644 docs/common/CHANGELOG.md create mode 100644 docs/common/README.md create mode 100644 docs/common/index.md create mode 100644 docs/dhis2/CHANGELOG.md create mode 100644 docs/dhis2/README.md create mode 100644 docs/dhis2/index.md create mode 100644 docs/docs.json create mode 100644 docs/dynamics/CHANGELOG.md create mode 100644 docs/dynamics/README.md create mode 100644 docs/dynamics/index.md create mode 100644 docs/facebook/CHANGELOG.md create mode 100644 docs/facebook/README.md create mode 100644 docs/facebook/index.md create mode 100644 docs/fhir/CHANGELOG.md create mode 100644 docs/fhir/README.md create mode 100644 docs/fhir/index.md create mode 100644 docs/godata/CHANGELOG.md create mode 100644 docs/godata/README.md create mode 100644 docs/godata/index.md create mode 100644 docs/googlehealthcare/CHANGELOG.md create mode 100644 docs/googlehealthcare/README.md create mode 100644 docs/googlehealthcare/index.md create mode 100644 docs/googlesheets/CHANGELOG.md create mode 100644 docs/googlesheets/README.md create mode 100644 docs/googlesheets/index.md create mode 100644 docs/hive/CHANGELOG.md create mode 100644 docs/hive/README.md create mode 100644 docs/hive/index.md create mode 100644 docs/http/CHANGELOG.md create mode 100644 docs/http/README.md create mode 100644 docs/http/index.md create mode 100644 docs/khanacademy/CHANGELOG.md create mode 100644 docs/khanacademy/README.md create mode 100644 docs/khanacademy/index.md create mode 100644 docs/kobotoolbox/CHANGELOG.md create mode 100644 docs/kobotoolbox/README.md create mode 100644 docs/kobotoolbox/index.md create mode 100644 docs/magpi/CHANGELOG.md create mode 100644 docs/magpi/README.md create mode 100644 docs/magpi/index.md create mode 100644 docs/mailchimp/CHANGELOG.md create mode 100644 docs/mailchimp/README.md create mode 100644 docs/mailchimp/index.md create mode 100644 docs/mailgun/CHANGELOG.md create mode 100644 docs/mailgun/README.md create mode 100644 docs/mailgun/index.md create mode 100644 docs/maximo/CHANGELOG.md create mode 100644 docs/maximo/README.md create mode 100644 docs/maximo/index.md create mode 100644 docs/medicmobile/CHANGELOG.md create mode 100644 docs/medicmobile/README.md create mode 100644 docs/medicmobile/index.md create mode 100644 docs/mogli/CHANGELOG.md create mode 100644 docs/mogli/README.md create mode 100644 docs/mogli/connecting_with_sms_providers.md create mode 100644 docs/mogli/connecting_with_telcos.md create mode 100644 docs/mogli/index.md create mode 100644 docs/mongodb/CHANGELOG.md create mode 100644 docs/mongodb/README.md create mode 100644 docs/mongodb/index.md create mode 100644 docs/msgraph/CHANGELOG.md create mode 100644 docs/msgraph/README.md create mode 100644 docs/msgraph/index.md create mode 100644 docs/mssql/CHANGELOG.md create mode 100644 docs/mssql/README.md create mode 100644 docs/mssql/index.md create mode 100644 docs/mysql/CHANGELOG.md create mode 100644 docs/mysql/README.md create mode 100644 docs/mysql/index.md create mode 100644 docs/nexmo/CHANGELOG.md create mode 100644 docs/nexmo/README.md create mode 100644 docs/nexmo/index.md create mode 100644 docs/ocl/CHANGELOG.md create mode 100644 docs/ocl/README.md create mode 100644 docs/ocl/index.md create mode 100644 docs/openfn/CHANGELOG.md create mode 100644 docs/openfn/README.md create mode 100644 docs/openfn/index.md create mode 100644 docs/openhim/CHANGELOG.md create mode 100644 docs/openhim/README.md create mode 100644 docs/openhim/index.md create mode 100644 docs/openmrs/CHANGELOG.md create mode 100644 docs/openmrs/README.md create mode 100644 docs/openmrs/index.md create mode 100644 docs/openspp/CHANGELOG.md create mode 100644 docs/openspp/README.md create mode 100644 docs/openspp/index.md create mode 100644 docs/postgresql/CHANGELOG.md create mode 100644 docs/postgresql/README.md create mode 100644 docs/postgresql/index.md create mode 100644 docs/primero/CHANGELOG.md create mode 100644 docs/primero/README.md create mode 100644 docs/primero/index.md create mode 100644 docs/progres/CHANGELOG.md create mode 100644 docs/progres/README.md create mode 100644 docs/progres/index.md create mode 100644 docs/rapidpro/CHANGELOG.md create mode 100644 docs/rapidpro/README.md create mode 100644 docs/rapidpro/index.md create mode 100644 docs/resourcemap/CHANGELOG.md create mode 100644 docs/resourcemap/README.md create mode 100644 docs/resourcemap/index.md create mode 100644 docs/salesforce/CHANGELOG.md create mode 100644 docs/salesforce/README.md create mode 100644 docs/salesforce/index.md create mode 100644 docs/sftp/CHANGELOG.md create mode 100644 docs/sftp/README.md create mode 100644 docs/sftp/index.md create mode 100644 docs/smpp/CHANGELOG.md create mode 100644 docs/smpp/README.md create mode 100644 docs/smpp/index.md create mode 100644 docs/surveycto/CHANGELOG.md create mode 100644 docs/surveycto/README.md create mode 100644 docs/surveycto/index.md create mode 100644 docs/telerivet/CHANGELOG.md create mode 100644 docs/telerivet/README.md create mode 100644 docs/telerivet/index.md create mode 100644 docs/template/CHANGELOG.md create mode 100644 docs/template/README.md create mode 100644 docs/template/index.md create mode 100644 docs/tutorial/index.md create mode 100644 docs/twilio/CHANGELOG.md create mode 100644 docs/twilio/README.md create mode 100644 docs/twilio/index.md create mode 100644 docs/vtiger/CHANGELOG.md create mode 100644 docs/vtiger/README.md create mode 100644 docs/vtiger/index.md create mode 100644 docs/zoho/CHANGELOG.md create mode 100644 docs/zoho/README.md create mode 100644 docs/zoho/index.md create mode 100644 tools/build/src/util/hbs-helpers.js diff --git a/.github/workflows/docs-local.sh b/.github/workflows/docs-local.sh new file mode 100644 index 000000000..65b4fac9a --- /dev/null +++ b/.github/workflows/docs-local.sh @@ -0,0 +1,35 @@ +#!/bin/sh -l + +# clean tmp directory +mkdir -p tmp +rm -rf tmp/* + +# copy new packages docs files to the root docs directory +# rsync -pr packages/*/docs/ docs/ +# rsync -av --progress packages/* docs/ --exclude node_modules --exclude src --exclude ast.json --exclude CHANGELOG.md --exclude test --exclude LICENSE --exclude LICENSE.LESSER --exclude package.json --exclude configuration-schema.json +rsync -zvr packages/ tmp/ --include="*.md" --include="*/" --exclude="*" --prune-empty-dirs + +# move index.md to root directory +find tmp/*/docs -name '*.md' -type f -execdir mv -n '{}' ../ \; +find tmp/*/* -type d -empty -delete + +# flatten json files +# jq -s 'flatten' packages/*/docs/*.json > docs/docs.json +rm tmp/*.json +# add first opening bracked +echo [ >>tmp/tmp.json +# use all json files in current folder +for i in packages/*/docs/*.json; do + # first create the key; it is the filename without the extension + # echo \"$i\": | sed 's/\.json//' >> output/tmp.json + # dump the file's content + cat "$i" >>tmp/tmp.json + # add a comma afterwards + echo , >>tmp/tmp.json +done +# remove the last comma from the file; otherwise it's not valid json +cat tmp/tmp.json | sed '$ s/.$//' >>tmp/docs.json +# remove tempfile +rm tmp/tmp.json +# add closing bracket +echo ] >>tmp/docs.json diff --git a/docs/asana/CHANGELOG.md b/docs/asana/CHANGELOG.md new file mode 100644 index 000000000..334df7fae --- /dev/null +++ b/docs/asana/CHANGELOG.md @@ -0,0 +1,85 @@ +# @openfn/language-asana + +## 3.0.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 3.0.0 + +### Major Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 2.1.6 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 2.1.5 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 2.1.4 + +### Patch Changes + +- f2aed32: add examples + +## 2.1.3 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 2.1.2 + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 2.1.1 + +### Patch Changes + +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 + +## 2.1.0 + +### Minor Changes + +- 5f40dcf: Migrated language-asana + +### Patch Changes + +- e04aa28: Rename credential-schema to configuration-schema, update descriptions diff --git a/docs/asana/README.md b/docs/asana/README.md new file mode 100644 index 000000000..2041b89e4 --- /dev/null +++ b/docs/asana/README.md @@ -0,0 +1,90 @@ +# language-asana + +Language Pack for connecting with Asana. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/asana-configuration-schema/) +definition. + +### How to create an API token + +Using Asana's API requires having an API token. To generate that token, head to +the [Asana developer console](https://app.asana.com/0/developer-console) and +enter the **Personal access tokens** section. + +There you can click on **+New access token**. A prompt will be opened allowing +you to give the token a name and then create it. + +_Note: Treat your PAT like you would with a password. Do not share it or display +it online._ + +### Sample expression + +## Find a single task of a given project using the task id. + +```js +getTask('1234', { + opt_fields: 'name,assignee', +}); +``` + +## Find the list of tasks of a given project using the project id. + +```js +getTasks('22889593722', { + opt_fields: 'name,notes,assignee', +}); +``` + +## Update a specific task + +```js +updateTask('12344', { + name: 'test', + approval_status: 'pending', + assignee: '12345', +}); +``` + +## Create a task + +```js +createTask({ + name: 'test', + approval_status: 'pending', + assignee: '12345', +}); +``` + +## Update a task or create a new one + +You can use a field name literal as `externalId` to match a specific task. If +the task does not exist, a new one will be created. The first parameter in this +function should be the `project_id`. + +```js +upsertTask('12344', { + externalId: 'name', + data: { + name: 'A new task', + projects: ['12344'], + notes: 'This is a new task', + }, +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/asana/index.md b/docs/asana/index.md new file mode 100644 index 000000000..fcbcbc35f --- /dev/null +++ b/docs/asana/index.md @@ -0,0 +1,143 @@ +## Functions + +
+
+ createTask(params, callback)
+
+ getTask(taskGid, params, callback)
+
+ getTasks(projectGid, params, callback)
+
+ updateTask(taskGid, params, callback)
+
+ upsertTask(projectGid, params, callback)
+
+ + +## createTask + +createTask(params, callback) ⇒ Operation +Create a task. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | Body parameters | +| callback | function | (Optional) callback function | + +**Example** +```js +createTask( + { + name: 'test', "approval_status": "pending", "assignee": "12345" + } +) +``` + +* * * + +## getTask + +getTask(taskGid, params, callback) ⇒ Operation +Get a single task of a given project. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| taskGid | string | Globally unique identifier for the task | +| params | object | Query params to include. | +| callback | function | (Optional) callback function | + +**Example** +```js +getTask("taskGid", + { + opt_fields: "name,notes,assignee" + }) +``` + +* * * + +## getTasks + +getTasks(projectGid, params, callback) ⇒ Operation +Get the list of tasks for a given project. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| projectGid | string | Globally unique identifier for the project | +| params | object | Query params to include. | +| callback | function | (Optional) callback function | + +**Example** +```js +getTasks("projectGid", + { + opt_fields: "name,notes,assignee" + }) +``` + +* * * + +## updateTask + +updateTask(taskGid, params, callback) ⇒ Operation +Update a specific task. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| taskGid | string | Globally unique identifier for the task | +| params | object | Body parameters | +| callback | function | (Optional) callback function | + +**Example** +```js +updateTask("taskGid", + { + name: 'test', "approval_status": "pending", "assignee": "12345" + } +) +``` + +* * * + +## upsertTask + +upsertTask(projectGid, params, callback) ⇒ Operation +Update or create a task. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| projectGid | string | Globally unique identifier for the project | +| params | object | an object with an externalId and some task data. | +| callback | function | (Optional) callback function | + +**Example** +```js +upsertTask( + "1201382240880", + { + "externalId": "name", + "data": { + name: 'test', "approval_status": "pending", "assignee": "12345" + } + + } +) +``` + +* * * + diff --git a/docs/azure-storage/CHANGELOG.md b/docs/azure-storage/CHANGELOG.md new file mode 100644 index 000000000..db0e01cad --- /dev/null +++ b/docs/azure-storage/CHANGELOG.md @@ -0,0 +1,11 @@ +# @openfn/language-azure-storage + +## 1.0.0 + +### Major Changes + +Intial adaptor release with support for Blob storage. + +- uploadBlob +- downloadBlob +- getBlobProperties diff --git a/docs/azure-storage/README.md b/docs/azure-storage/README.md new file mode 100644 index 000000000..2e2430e3a --- /dev/null +++ b/docs/azure-storage/README.md @@ -0,0 +1,84 @@ +# language-azure-storage + +An OpenFn **_adaptor_** for building integration jobs for use with the Azure +Storage APIs. At present, this adaptor only supports the Azure Blob Storage, +API, but could be expanded for future Azure Storage services (e.g., Files, +Tables, Queues, etc.). + +## Documentation + +View the [docs site](https://docs.openfn.org/adaptors/packages/azure-storage-docs) +for full technical documentation. + +### Configuration + +View the +[configuration-schema](https://docs.openfn.org/adaptors/packages/azure-storage-configuration-schema/) +for required and optional `configuration` properties. + +### An example showing multiple capabilties of this adaptor + +Assume you have a simple `state.json` file as follows: + +```json +{ + "data": { + "foo": "bar", + "bif": "baz", + "sunday": "monday", + "answer": "42" + }, + "configuration": { + "accountName": "myaccountname", + "accountKey": "myaccountkey", + "containerName": "mycontainer" + } +} +``` + +Create a file `job.js`, as shown below, to run with the OpenFn CLI. This +example uploads the blob with a year/month partitioning scheme, then +downloads the same blob and fetches the blob properties. It would be extremely +unusual to perform all of these actions in a single job. + +```js +uploadBlob( + state => { + const date = new Date(); + const id = '0e82962a-6ed0-4a88-92c1-51ae785b4126'; + return `${date.getFullYear()}/${date.getMonth() + 1}/${id}.json`; + }, + state.data, + { + blobHTTPHeaders: { blobContentType: 'application/json' } + }, + { createContainer: true, overwrite: true } +); + +downloadBlob( + dataValue('blobName'); +); + +getBlobProperties( + state => { + return state.references[1].blobName; + } +); +``` + +Run the job as follows: + +```bash +openfn job -a azure-storage -s state.json -O +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +"Getting Started" guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To build _only_ the docs run `pnpm build docs`. diff --git a/docs/azure-storage/index.md b/docs/azure-storage/index.md new file mode 100644 index 000000000..f65cca8cb --- /dev/null +++ b/docs/azure-storage/index.md @@ -0,0 +1,77 @@ +## Functions + +
+
+ downloadBlob(blobName, [options])
+
+ getBlobProperties(blobName, options)
+
+ uploadBlob(blobName, content, uploadOptions, [options])
+
+ + +## downloadBlob + +downloadBlob(blobName, [options]) ⇒ Operation +Download a blob from Azure Blob Storage. + +**Kind**: global function +**Access**: public + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| blobName | string | | Name of the blob to download. | +| [options] | Object | {} | Additional options for the download process. | + +**Example** +```js +downloadBlob('mycontainer', 'myblob.txt', { downloadAs: 'string' }) +``` + +* * * + +## getBlobProperties + +getBlobProperties(blobName, options) ⇒ Operation +Get properties of a blob in Azure Blob Storage. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| blobName | string | Name of the blob to get properties for. | +| options | string | Additional options for the getBlobProperties process. | + +**Example** +```js +getBlobProperties('mycontainer', 'myblob.txt') +``` + +* * * + +## uploadBlob + +uploadBlob(blobName, content, uploadOptions, [options]) ⇒ Operation +Upload content to Azure Blob Storage. + +**Kind**: global function +**Access**: public + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| blobName | string | | Name of the blob to create or replace. | +| content | string | | Content to upload. | +| uploadOptions | object | | See BlockBlobUploadOptions in Azure Blob Storage docs | +| [options] | Object | {} | Additional options for the upload process. | +| [options.createContainer] | boolean | false | Whether to create the container if it doesn't exist. | +| [options.overwrite] | boolean | false | Whether to overwrite an existing blob with the same name. | +| [options.containerName] | string | | Container name. Overrides state.configuration. | + +**Example** +```js +uploadBlob('mycontainer', 'myblob.txt', {foo:"bar"}, { blobHTTPHeaders: { blobContentType: 'application/json' } }) +``` + +* * * + diff --git a/docs/beyonic/CHANGELOG.md b/docs/beyonic/CHANGELOG.md new file mode 100644 index 000000000..bf4b740dc --- /dev/null +++ b/docs/beyonic/CHANGELOG.md @@ -0,0 +1,103 @@ +# @openfn/language-beyonic + +## 0.2.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.2.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.1.9 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.1.8 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.1.7 + +### Patch Changes + +- f2aed32: add examples + +## 0.1.6 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.1.5 + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 0.1.4 + +### Patch Changes + +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 + +## 0.1.3 + +### Patch Changes + +- 63080d0: Update common for build + +## 0.1.2 + +### Patch Changes + +- 0d358b6: Add ast.json for beyonic + +## 0.1.1 + +### Patch Changes + +- 06ff25f: Update superagent to v8 + +## 0.1.0 + +### Minor Changes + +- 28ceb1f: Moving language-beyonic to adaptors/packages/beyonic + +### Patch Changes + +- e04aa28: Rename credential-schema to configuration-schema, update descriptions diff --git a/docs/beyonic/README.md b/docs/beyonic/README.md new file mode 100644 index 000000000..c954919a9 --- /dev/null +++ b/docs/beyonic/README.md @@ -0,0 +1,74 @@ +# Language Beyonic + +Language Pack for building expressions and operations for working with the +[beyonic API](http://apidocs.beyonic.com/). + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/beyonic-configuration-schema/) +definition. + +## Payments API + +#### `createPayment(...)` + +```js +createPayment( + fields( + field('phonenumber', '+256773712831'), + field('first_name', 'Gideon'), + field('last_name', 'Zelalem'), + field('amount', 100.2), + field('currency', 'USD'), + field('account', 1), + field('description', 'Long-term contract for Arseal'), + field('payment_type', 'money'), + field('callback_url', 'https://my.website/payments/callback') + ) +); +``` + +## Collection Requests API + +#### `createCollectionRequest(...)` + +```js +createCollectionRequest( + fields( + field('instructions', 'Send me some money, please!'), + field('phonenumber', '+256773712831'), + field('amount', 5.0), + field('currency', 'USD') + ) +); +``` + +## Contacts API + +#### `createContact(...)` + +```js +createContact( + fields( + field('first_name', 'Granit'), + field('last_name', 'Xhaka'), + field('phone_number', '+256773712831'), + field('email', 'granit@arsenal.com') + ) +); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/beyonic/index.md b/docs/beyonic/index.md new file mode 100644 index 000000000..496e2a5c2 --- /dev/null +++ b/docs/beyonic/index.md @@ -0,0 +1,72 @@ +## Functions + +
+
+ createCollectionRequest(data)
+
+ createContact(data)
+
+ createPayment(data)
+
+ + +## createCollectionRequest + +createCollectionRequest(data) ⇒ Operation +Create a collection request + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| data | object | Payload data for the collection request | + +**Example** +```js +execute( + createCollectionRequest(data) +)(state) +``` + +* * * + +## createContact + +createContact(data) ⇒ Operation +Create a contact + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| data | object | Payload data for the contact | + +**Example** +```js +execute( + createContact(data) +)(state) +``` + +* * * + +## createPayment + +createPayment(data) ⇒ Operation +Create a payment + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| data | object | Payload data for the payment | + +**Example** +```js +execute( + createPayment(data) +)(state) +``` + +* * * + diff --git a/docs/bigquery/CHANGELOG.md b/docs/bigquery/CHANGELOG.md new file mode 100644 index 000000000..5078e9566 --- /dev/null +++ b/docs/bigquery/CHANGELOG.md @@ -0,0 +1,126 @@ +# @openfn/language-bigquery + +## 2.0.4 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 2.0.3 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 2.0.2 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 2.0.1 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 2.0.0 + +### Major Changes + +- 0b6f20b: use parseCsv from common + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 1.2.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 1.2.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 1.2.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 1.2.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 1.1.5 + +### Patch Changes + +- 5895eb9: update dependencies + +## 1.1.4 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 1.1.3 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 1.1.2 + +### Patch Changes + +- f2aed32: add examples + +## 1.1.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ +- 57f3513: Fix exports in index.js + +## 1.1.0 + +### Minor Changes + +- e4c6114: bigquery migration and build + +### Patch Changes + +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 diff --git a/docs/bigquery/README.md b/docs/bigquery/README.md new file mode 100644 index 000000000..05b146654 --- /dev/null +++ b/docs/bigquery/README.md @@ -0,0 +1,62 @@ +# Language BigQuery + +Language Pack for building expressions and operations to make HTTP calls. + +## Documentation + +### state.json + +The configuration key must be a valid GCP credential as JSON. + +```json +{ + "configuration": { + "type": "service_account", + "project_id": "some-project", + "private_key_id": "670b9e3c8c366e83aa569dd57cbfc5c575b72e42", + "private_key": "-----BEGIN PRIVATE KEY-----\nblah\nmoreblah=\n-----END PRIVATE KEY-----\n", + "client_email": "bigquery@some-project.iam.gserviceaccount.com", + "client_id": "someid", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://oauth2.googleapis.com/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/bigquery%40some-project.iam.gserviceaccount.com" + }, + "data": { "a": 1 } +} +``` + +### operations (expression.js) + +#### load(...) + +Load data to a table in bigquery from a CSV. See full +[options here](https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad). + +```js +load( + '/home/taylor/Desktop/type-C_r-ALL_ps-201012_freq-M_px-HS_pub-20200731_fmt-csv_ex-20200818.csv', + 'awesome-solutions-project', // project + 'test01', // dataset + 'mytable', // table + { + schema: + 'classification:STRING,year:STRING,period:STRING,period_desc:STRING,aggregate_level:STRING,is_leaf_code:STRING,trade_flow_code:STRING,trade_flow:STRING,reporter_code:STRING,reporter:STRING,reporter_iso:STRING,partner_code:STRING,partner:STRING,partner_iso:STRING,commodity_code:STRING,commodity:STRING,qty_unit_code:STRING,qty_unit:STRING,qty:INTEGER,netweight_kg:INTEGER,trade_value:INTEGER,flag:STRING', + schemaUpdateOptions: ['ALLOW_FIELD_ADDITION'], + // createDisposition: 'CREATE_IF_NEEDED', + writeDisposition: 'WRITE_APPEND', + skipLeadingRows: 1, + } // loadOptions +); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/bigquery/index.md b/docs/bigquery/index.md new file mode 100644 index 000000000..2ae996f4d --- /dev/null +++ b/docs/bigquery/index.md @@ -0,0 +1,36 @@ +## load + +load(dirPath, projectId, datasetId, tableId, loadOptions, callback) ⇒ Operation +Load files to BigQuery + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| dirPath | string | the path to your local directory | +| projectId | string | your bigquery project id | +| datasetId | string | your bigquery dataset id | +| tableId | string | the name of the table you'd like to load | +| loadOptions | object | options to pass to the bigquery.load() API | +| callback | function | and optional callback | + +**Example** +```js +load( + './tmp/files', + 'my-bg-project', + 'test01', + 'product-codes', + { + schema: 'FREQ:STRING,DATATYPE:STRING,PRODUCTCODE:STRING,PARTNER:STRING', + writeDisposition: 'WRITE_APPEND', + skipLeadingRows: 1, + schemaUpdateOptions: ['ALLOW_FIELD_ADDITION'], + createDisposition: 'CREATE_IF_NEEDED', + } +) +``` + +* * * + diff --git a/docs/cartodb/CHANGELOG.md b/docs/cartodb/CHANGELOG.md new file mode 100644 index 000000000..4bd7cb254 --- /dev/null +++ b/docs/cartodb/CHANGELOG.md @@ -0,0 +1,64 @@ +# @openfn/language-cartodb + +## 0.2.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.2.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.1.4 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.1.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.1.2 + +### Patch Changes + +- f2aed32: add examples + +## 0.1.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.1.0 + +### Minor Changes + +- 792d495: Migrate CartoDB + +### Patch Changes + +- e4ebcb6: Fix Large gzip Denial of Service in superagent diff --git a/docs/cartodb/README.md b/docs/cartodb/README.md new file mode 100644 index 000000000..46532b40e --- /dev/null +++ b/docs/cartodb/README.md @@ -0,0 +1,54 @@ +# Language cartodb + +Language Pack for sending messages using the +[cartodb API](http://docs.cartodb.com/cartodb-platform/sql-api/). + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/cartodb-configuration-schema/) +definition. + +## Examples + +```js +addRow( + 'your_table', + fields( + field('name', 'taylor'), + field('lat', dataValue('lat')), + field('long', dataValue('long')), + field('mookie', dataValue('form.blaylock')), + field('description', dataValue('type_description')), + field('date', dataValue('SubmissionDate')) + ) +); +``` + +```js +sql(function (state) { + return ( + `INSERT INTO untitled_table (name, the_geom) VALUES ('` + + dataValue('form.first_name')(state) + + `', ST_SetSRID(ST_Point(` + + dataValue('lat')(state) + + `, ` + + dataValue('long')(state) + + `),4326))` + ); +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/commcare/CHANGELOG.md b/docs/commcare/CHANGELOG.md new file mode 100644 index 000000000..02664bb84 --- /dev/null +++ b/docs/commcare/CHANGELOG.md @@ -0,0 +1,169 @@ +# @openfn/language-commcare + +## 1.6.10 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + - @openfn/language-http@5.0.4 + +## 1.6.9 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + - @openfn/language-http@5.0.3 + +## 1.6.8 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + - @openfn/language-http@5.0.2 + +## 1.6.7 + +### Patch Changes + +- 52c02c8: update xlsx package + +## 1.6.6 + +### Patch Changes + +- 8205673: update superagent + +## 1.6.5 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + - @openfn/language-http@5.0.1 + +## 1.6.4 + +### Patch Changes + +- Updated dependencies [0b6f20b] +- Updated dependencies [8c32eb3] + - @openfn/language-http@5.0.0 + - @openfn/language-common@1.10.1 + +## 1.6.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + - @openfn/language-http@4.3.3 + +## 1.6.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + - @openfn/language-http@4.3.2 + +## 1.6.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + - @openfn/language-http@4.3.1 + +## 1.6.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + - @openfn/language-http@4.3.0 + +## 1.5.6 + +### Patch Changes + +- e0406fa: update dependencies + +## 1.5.5 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + - @openfn/language-http@4.2.8 + +## 1.5.4 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] +- Updated dependencies [14f481e] + - @openfn/language-common@1.7.6 + - @openfn/language-http@4.2.7 + +## 1.5.3 + +### Patch Changes + +- f2aed32: add examples +- Updated dependencies [f2aed32] + - @openfn/language-http@4.2.5 + +## 1.5.2 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ +- 57f3513: Fix exports in index.js +- Updated dependencies [6d8de03] + - @openfn/language-http@4.2.4 + +## 1.5.1 + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + - @openfn/language-http@4.2.3 + +## 1.5.0 + +### Minor Changes + +- 5c050ed: Migrate CommCare + +### Patch Changes + +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- 94076b9: update dependency xlsx to ^0.18.0 +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [9a2755e] +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-http@4.2.2 + - @openfn/language-common@1.7.4 diff --git a/docs/commcare/README.md b/docs/commcare/README.md new file mode 100644 index 000000000..f5a9e04ae --- /dev/null +++ b/docs/commcare/README.md @@ -0,0 +1,178 @@ +# Language CommCare + +Language Pack for interacting with the CommCare API. + +https://confluence.dimagi.com/display/commcarepublic/Download+Report+Data + +https://confluence.dimagi.com/display/commcarepublic/Submission+API + +https://bitbucket.org/javarosa/javarosa/wiki/FormSubmissionAPI + +Accepted X-Form Spec from Dimagi: http://dimagi.github.io/xform-spec Accepted +X-Form Spec for Cases from Dimagi: +https://github.com/dimagi/commcare/wiki/casexml20 + +## Documentation + +## Configuration + +View all the required and optional properties for `state.configuration` in the official [configuration-schema](https://docs.openfn.org/adaptors/packages/commcare-configuration-schema/) definition. + +- The "appId" is the UUID which designates your commcare project as different from +everyone elses. It can be found in the URL of your application when you first +enter it from the project screen. I.e., the last part of this url: +`https://www.commcarehq.org/a/YOUR_PROJECT/apps/view/YOUR_APP_ID/` + +- Note that the username is your full email address. + +## `fetchReportData` to pull aggregate data from CommCare + +It takes 3 arguments: reportId, params, and postUrl. + +```js +fetchReportData( + 'reportId', + { limit: 10, offset: 2, state: 'Vermont' }, + 'http://www.openfn.org/inbox/secret-uuid' +); +``` + +simple body target: + +```xml + + Something + Else + 29 + +``` + +complex body target: + +```xml + + + bar + + + bar + user-xxx-eve + member + + + + A00000245706EE + 2013-04-19T16:52:41.000-04 + 2013-04-19T16:53:02.799-04 + eve + user-xxx-eve + b58df19c-efd5-4ecf-9581-65dda8b8787c + CommCare ODK, version "2.4.1"(10083). App v19. CommCare Version 2.4. Build 10083, built on: March-12-2013 + + +``` + +## Submitting data to CommCare HQ + +### Submit an XLS file + +This function bulk submit a JSON object as xls file to CommCare HQ + +```js +submitXls([{ name: 'Mamadou', phone: '000000' }], { + case_type: 'student', + search_field: 'external_id', + create_new_cases: 'on', +}); +``` + +### submit + +Here we're just building the most basic JSON object, that will be converted to +an XML object and posted as the element. + +```js +submit( + fields( + field('@', function (state) { + return { + xmlns: + 'http://openrosa.org/formdesigner/2BCC3E88-2D0D-4C07-8D4A-6B372F3799D9', + }; + }), + field('paitent_namentosh', dataValue('first_name')), + field('question2', 'Some answer here.'), + field('question3', 'HKS'), + field('question4', 'item1'), + field('question5', 69855), + field('question6', 12) + ) +); +``` + +An open rosa form submission body should look like this: + +```xml + + + Taylor + Moruki + Hks + item1 + 69855 + 12 + + 358239055789384 + 2015-08-21T16:21:59.807+02 + 2015-08-21T16:22:15.987+02 + openfn + 5fe615b3af2834cb5dca59f7466d6174 + 195e79eb-d823-46fe-9e4f-59b8327d5db2 + CommCare ODK, version "2.22.0"(370023). App v9. CommCare Version 2.22. Build 370023, built on: July-22-2015 + + +``` + +So the JSON emitted by your expression should look like this: + +```json +{ + "data": { + "name": "Patient Registration", + "uiVersion": "1", + "version": "9", + "xmlns": "http://openrosa.org/formdesigner/2BCC3E88-2D0D-4C07-8D4A-6B372F3799D9", + "xmlns:jrm": "http://dev.commcarehq.org/jr/xforms", + "paitent_namentosh": "Taylor", + "question2": " Moruki", + "question3": "Hks", + "question4": "item1", + "question5": "69855", + "question6": "12", + "n0:meta": { + "xmlns:n0": "http://openrosa.org/jr/xforms", + "n0:deviceID": "358239055789384", + "n0:timeStart": "2015-08-21T16:21:59.807+02", + "n0:timeEnd": "2015-08-21T16:22:15.987+02", + "n0:username": "openfn", + "n0:userID": "5fe615b3af2834cb5dca59f7466d6174", + "n0:instanceID": "195e79eb-d823-46fe-9e4f-59b8327d5db2", + "n1:appVersion": { + "xmlns:n1": "http://commcarehq.org/xforms", + "$t": "CommCare ODK, version \"2.22.0\"(370023). App v9. CommCare Version 2.22. Build 370023, built on: July-22-2015" + } + } + } +} +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/commcare/index.md b/docs/commcare/index.md new file mode 100644 index 000000000..82463ed41 --- /dev/null +++ b/docs/commcare/index.md @@ -0,0 +1,112 @@ +## Functions + +
+
+ clientPost(formData)
+
+ fetchReportData(reportId, params, postUrl)
+
+ submit(formData)
+
+ submitXls(formData, params)
+
+ + +## clientPost + +clientPost(formData) ⇒ State +Performs a post request + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| formData | Object | Form Data with auth params and body | + +**Example** +```js +clientPost(formData) +``` + +* * * + +## fetchReportData + +fetchReportData(reportId, params, postUrl) ⇒ Operation +Make a GET request to CommCare's Reports API +and POST the response to somewhere else. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| reportId | String | API name of the report. | +| params | Object | Query params, incl: limit, offset, and custom report filters. | +| postUrl | String | Url to which the response object will be posted. | + +**Example** +```js +fetchReportData(reportId, params, postUrl) +``` + +* * * + +## submit + +submit(formData) ⇒ Operation +Submit form data + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| formData | Object | Object including form data. | + +**Example** +```js +submit( + fields( + field("@", function(state) { + return { + "xmlns": "http://openrosa.org/formdesigner/form-id-here" + }; + }), + field("question1", dataValue("answer1")), + field("question2", "Some answer here.") + ) + ) +``` + +* * * + +## submitXls + +submitXls(formData, params) ⇒ Operation +Convert form data to xls then submit. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| formData | Object | Object including form data. | +| params | Object | Request params including case type and external id. | + +**Example** +```js +submitXls( + [ + {name: 'Mamadou', phone: '000000'}, + ], + { + case_type: 'student', + search_field: 'external_id', + create_new_cases: 'on', + } +) +``` + +* * * + diff --git a/docs/common/CHANGELOG.md b/docs/common/CHANGELOG.md new file mode 100644 index 000000000..24a0d9c96 --- /dev/null +++ b/docs/common/CHANGELOG.md @@ -0,0 +1,152 @@ +v0.4.0 + +## 1.12.0 + +### Minor Changes + +- 7f52699: New HTTP helper functions have been added to common in + `src/util/http.js` + + These are based on the `undici` library. They are functions, not operations, + so they do not get and return state, and do not expand references. + + They are designed to be used by other adaptors to make HTTP requests easier. + + ## Usage + + ``` + // Import the helper function + import { get } from '@openfn/language-common/util' + + // This is an example operation + export function get(id, callback) { + return async (state) => { + const [resolvedId] = expandReferences( + state, + id, + ); + + // Call the new common helper to fetch some json + const response = await get(`www.example.com/resource/{$resolvedId}`, { parseAs: 'json' }); + + // Return the response body as data, and also include the response object as a convenience + return { + ...state, + response, + data: response.body + } + } + } + ``` + + See the http adaptor for a reference implementation. + + ## Deprecation notice + + The existing http operations in `src/http.js` have been deprecated, and + adaptors should migrate to the new helpers. + +## 1.11.1 + +### Patch Changes + +- c19efbe: don't attempt to expand references for a buffer + +## 1.11.0 + +### Minor Changes + +- 85c35b8: Add validate function to validate data against a JSON schema + +## 1.10.3 + +### Patch Changes + +- df09270: Fix streaming interface to parseCSV + +## 1.10.2 + +### Patch Changes + +- 26a303e: add expandReferences for csvData and parsingOptions + +## 1.10.1 + +### Patch Changes + +- 8c32eb3: - update parseCsv to await callback + - Added documentation for splitKeys + +## 1.10.0 + +### Minor Changes + +- aad9549: Ensure that standard OAuth2 credentials with snake-cased + "access_token" keys can be used for OAuth2-reliant adaptors + +## 1.9.0 + +### Minor Changes + +- 111807f: Add support for `parseCsv` in common + +## 1.8.1 + +### Patch Changes + +- Update lock files + +## 1.8.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +## 1.7.7 + +### Patch Changes + +- 929bca6: Export metadata helper function + +## 1.7.6 + +### Patch Changes + +- 2b4c61a: mark execute private and ast build + +## 1.7.5 + +### Patch Changes + +- f2a91a4: Update package exports + +## 1.7.4 + +### Patch Changes + +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- b5eb665: Adjusted docs for common and built to markdown +- # ecf5d30: remove sinon since it was not being used + +Bumped all package versions to their latest. + +# v0.0.4 + +- Added `arrayToString` helper. + Allowing you to join an array of string'able primitives (strings and integers) + into a string. +- Added `toArray` helper. + This can be used to coerce certain types of data into an array, this can be + useful when the source data has an ambiguous format. For example a given key + in the data may have an object as it's value (when there is only one item), + and an array of objects when there is more than one. `toArray` can be used to + reconcile this inconsistency. diff --git a/docs/common/README.md b/docs/common/README.md new file mode 100644 index 000000000..d77837689 --- /dev/null +++ b/docs/common/README.md @@ -0,0 +1,14 @@ +# Language Common [![CircleCI](https://circleci.com/gh/OpenFn/language-common.svg?style=svg)](https://circleci.com/gh/OpenFn/language-common) + +Common and generic expressions and operations for [OpenFn](http://openfn.org). + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/common/index.md b/docs/common/index.md new file mode 100644 index 000000000..5d52ee85f --- /dev/null +++ b/docs/common/index.md @@ -0,0 +1,941 @@ +## Functions + +
+
+ alterState(func)
+
+ arrayToString(arr, separator)
+
+ asData(data, state)
+
+ chunk(array, chunkSize)
+
+ combine(operations)
+
+ composeNextState(state, response)
+
+ dataPath(path)
+
+ dataValue(path)
+
+ del(requestParams)
+
+ each(dataSource, operation)
+
+ each(dataSource, operation)
+
+ expandReferences(value, [skipFilter])
+
+ expandRequestReferences(value)
+
+ field(key, value)
+
+ fields(fields)
+
+ fn(func)
+
+ get(requestParams)
+
+ head(requestParams)
+
+ humanProper(str)
+
+ index()
+
+ join(targetPath, sourcePath, targetKey)
+
+ jsonValue(obj, path)
+
+ lastReferenceValue(path)
+
+ map(path, operation, state)
+
+ merge(dataSource, fields)
+
+ options(requestParams)
+
+ parseCsv(csvData, [parsingOptions], [callback])
+
+ patch(requestParams)
+
+ post(requestParams)
+
+ put(requestParams)
+
+ referencePath(path)
+
+ request(method, fullUrlOrPath, [options])
+
+ scrubEmojis(text, replacementChars)
+
+ source(path)
+
+ sourceValue(path)
+
+ splitKeys(obj, keys)
+
+ toArray(arg)
+
+ validate(schema, data)
+
+ withAgent(params)
+
+ + +## alterState + +alterState(func) ⇒ Operation +alias for "fn()" + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| func | function | is the function | + + +* * * + +## arrayToString + +arrayToString(arr, separator) ⇒ string +Turns an array into a string, separated by X. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| arr | array | Array of toString'able primatives. | +| separator | string | Separator string. | + +**Example** +```js +field("destination_string__c", function(state) { + return arrayToString(dataValue("path_of_array")(state), ', ') +}) +``` + +* * * + +## asData + +asData(data, state) ⇒ array +Simple switcher allowing other expressions to use either a JSONPath or +object literals as a data source. +- JSONPath referencing a point in `state` +- Object Literal of the data itself. +- Function to be called with state. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| data | String \| object \| function | | +| state | object | The current state. | + +**Example** +```js +asData('$.key'| key | callback) +``` + +* * * + +## chunk + +chunk(array, chunkSize) ⇒ Object +Chunks an array into an array of arrays, each with no more than a certain size. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| array | Object | Array to be chunked | +| chunkSize | Integer | The maxiumum size of each chunks | + +**Example** +```js +chunk([1,2,3,4,5], 2) +``` + +* * * + +## combine + +combine(operations) ⇒ Operation +Combines two operations into one + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| operations | Operations | Operations to be performed. | + +**Example** +```js +combine( + create('foo'), + delete('bar') +) +``` + +* * * + +## composeNextState + +composeNextState(state, response) ⇒ State +Prepares next state + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| state | State | state | +| response | Object | Response to be added | + +**Example** +```js +composeNextState(state, response) +``` + +* * * + +## dataPath + +dataPath(path) ⇒ string +Ensures a path points at the data. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | string | JSONPath referencing a point in `data`. | + +**Example** +```js +dataPath('key') +``` + +* * * + +## dataValue + +dataValue(path) ⇒ Operation +Picks out a single value from the source data object—usually `state.data`. +If a JSONPath returns more than one value for the reference, the first +item will be returned. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | String | JSONPath referencing a point in `data`. | + +**Example** +```js +dataValue('key') +``` + +* * * + +## del + +del(requestParams) ⇒ Operation +Make a DELETE request + +**Kind**: global function +**Returns**: Operation - - Function which takes state and returns a Promise +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | + +**Example** *(Deleting a record with data that comes from state)* +```js +delete({ + url: state => `https://www.example.com/api/items/${state.id}`, + })(state); +``` + +* * * + +## each + +each(dataSource, operation) ⇒ Operation +Scopes an array of data based on a JSONPath. +Useful when the source data has `n` items you would like to map to +an operation. +The operation will receive a slice of the data based of each item +of the JSONPath provided. + +It also ensures the results of an operation make their way back into +the state's references. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| dataSource | DataSource | JSONPath referencing a point in `state`. | +| operation | Operation | The operation needed to be repeated. | + +**Example** +```js +each("$.[*]", + create("SObject", + field("FirstName", sourceValue("$.firstName")) + ) +) +``` + +* * * + +## each + +each(dataSource, operation) ⇒ Operation +Scopes an array of data based on a JSONPath. +Useful when the source data has `n` items you would like to map to +an operation. +The operation will receive a slice of the data based of each item +of the JSONPath provided. + +It also ensures the results of an operation make their way back into +the state's references. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| dataSource | DataSource | JSONPath referencing a point in `state`. | +| operation | Operation | The operation needed to be repeated. | + +**Example** +```js +each("$.[*]", + create("SObject", + field("FirstName", sourceValue("$.firstName"))) + ) +``` + +* * * + +## expandReferences + +expandReferences(value, [skipFilter]) ⇒ Operation +Recursively resolves objects that have resolvable values (functions). + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| value | object | data | +| [skipFilter] | function | a function which returns true if a value should be skipped | + + +* * * + +## expandRequestReferences + +expandRequestReferences(value) ⇒ Operation +Recursively resolves objects that have resolvable values (functions), but +omits HTTP request specific modules like `FormData`. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| value | object | data | + + +* * * + +## field + +field(key, value) ⇒ Field +Returns a key, value pair in an array. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| key | string | Name of the field | +| value | Value | The value itself or a sourceable operation. | + +**Example** +```js +field('destination_field_name__c', 'value') +``` + +* * * + +## fields + +fields(fields) ⇒ Object +Zips key value pairs into an object. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| fields | Fields | a list of fields | + +**Example** +```js +fields(list_of_fields) +``` + +* * * + +## fn + +fn(func) ⇒ Operation +Creates a custom step (or operation) for more flexible job writing. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| func | function | is the function | + +**Example** +```js +fn(state => { + // do some things to state + return state; +}); +``` + +* * * + +## get + +get(requestParams) ⇒ Operation +Make a GET request + +**Kind**: global function +**Returns**: Operation - - Function which takes state and returns a Promise +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | + +**Example** *(Get an item with a specified id from state)* +```js + get({ + url: state => `https://www.example.com/api/items/${state.id}, + headers: {"content-type": "application/json"} +}); +``` + +* * * + +## head + +head(requestParams) ⇒ Operation +Make a HEAD request + +**Kind**: global function +**Returns**: Operation - - Function which takes state and returns a Promise +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | + +**Example** *(Gets the headers that would be returned if the HEAD request's URL was instead requested with the HTTP GET method)* +```js +head({ + url: 'https://www.example.com/api/items', +}); +``` + +* * * + +## humanProper + +humanProper(str) ⇒ string +Substitutes underscores for spaces and proper-cases a string + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| str | string | String that needs converting | + +**Example** +```js +field("destination_string__c", humanProper(state.data.path_to_string)) +``` + +* * * + +## index + +index() ⇒ DataSource +Returns the index of the current array being iterated. +To be used with `each` as a data source. + +**Kind**: global function +**Access**: public +**Example** +```js +index() +``` + +* * * + +## join + +join(targetPath, sourcePath, targetKey) ⇒ Operation +Adds data from a target object + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| targetPath | String | Target path | +| sourcePath | String | Source path | +| targetKey | String | Target Key | + +**Example** +```js +join('$.key','$.data','newKey') +``` + +* * * + +## jsonValue + +jsonValue(obj, path) ⇒ Operation +Picks out a single value from a JSON object. +If a JSONPath returns more than one value for the reference, the first +item will be returned. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| obj | object | A valid JSON object. | +| path | String | JSONPath referencing a point in given JSON object. | + +**Example** +```js +jsonValue({ a:1 }, 'a') +``` + +* * * + +## lastReferenceValue + +lastReferenceValue(path) ⇒ Operation +Picks out the last reference value from source data. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | String | JSONPath referencing a point in `references`. | + +**Example** +```js +lastReferenceValue('key') +``` + +* * * + +## map + +map(path, operation, state) ⇒ State +Scopes an array of data based on a JSONPath. +Useful when the source data has `n` items you would like to map to +an operation. +The operation will receive a slice of the data based of each item +of the JSONPath provided. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | string | JSONPath referencing a point in `state.data`. | +| operation | function | The operation needed to be repeated. | +| state | State | Runtime state. | + +**Example** +```js +map("$.[*]", + create("SObject", + field("FirstName", sourceValue("$.firstName")) + ) +) +``` + +* * * + +## merge + +merge(dataSource, fields) ⇒ DataSource +Merges fields into each item in an array. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| dataSource | DataSource | | +| fields | Object | Group of fields to merge in. | + +**Example** +```js +merge( + "$.books[*]", + fields( + field( "publisher", sourceValue("$.publisher") ) + ) +) +``` + +* * * + +## options + +options(requestParams) ⇒ Operation +Make a OPTIONS request + +**Kind**: global function +**Returns**: Operation - - Function which takes state and returns a Promise +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | + +**Example** *(Requests permitted communication options for a given URL or server, with data from state.)* +```js +options({ + url: 'https://www.example.com/api/items', +}); +``` + +* * * + +## parseCsv + +parseCsv(csvData, [parsingOptions], [callback]) ⇒ Operation +Takes a CSV file string or stream and parsing options as input, and returns a promise that +resolves to the parsed CSV data as an array of objects. +Options for `parsingOptions` include: +- `delimiter` {string/Buffer/[string/Buffer]} - Defines the character(s) used to delineate the fields inside a record. Default: `','` +- `quote` {string/Buffer/[string/Buffer]} - Defines the characters used to surround a field. Default: `'"'` +- `escape` {Buffer/string/null/boolean} - Set the escape character as one character/byte only. Default: `"` +- `columns` {boolean / array / function} - Generates record in the form of object literals. Default: `true` +- `bom` {boolean} - Strips the [byte order mark (BOM)](https://en.wikipedia.org/wiki/Byte_order_mark) from the input string or buffer. Default: `true` +- `trim` {boolean} - Ignore whitespace characters immediately around the `delimiter`. Default: `true` +- `ltrim` {boolean} - Ignore whitespace characters from the left side of a CSV field. Default: `true` +- `rtrim` {boolean} - Ignore whitespace characters from the right side of a CSV field. Default: `true` +- `chunkSize` {number} - The size of each chunk of CSV data. Default: `Infinity` +- `skip_empty_lines` {boolean} - Ignore empty lines in the CSV file. Default: `true` + +**Kind**: global function +**Returns**: Operation - The function returns a Promise that resolves to the result of parsing a CSV `stringOrStream`. +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| csvData | String \| Stream | A CSV string or a readable stream | +| [parsingOptions] | Object | Optional. Parsing options for converting CSV to JSON. | +| [callback] | function | (Optional) callback function. If used it will be called state and an array of rows. | + + +* * * + +## patch + +patch(requestParams) ⇒ Operation +Make a PATCH request + +**Kind**: global function +**Returns**: Operation - - Function which takes state and returns a Promise +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | + +**Example** *(Applies partial modifications to a resource, with data from state.)* +```js +patch({ + url: state => `https://www.example.com/api/items/${state.id}`, + data: state => state.data +}); +``` + +* * * + +## post + +post(requestParams) ⇒ Operation +Make a POST request + +**Kind**: global function +**Returns**: Operation - - Function which takes state and returns a Promise +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | + +**Example** *(Sending a payload with data that comes from state)* +```js +post({ + url: "https://example.com", + data: (state) => state.data +}); +``` +**Example** *( Capturing the response for later use in state )* +```js +alterState((state) => { + return post({ + url: "https://example.com", + data: (state) => state.data + })(state).then(({response}) => { + state.responseData = response.data + }) +}); +``` + +* * * + +## put + +put(requestParams) ⇒ Operation +Make a PUT request + +**Kind**: global function +**Returns**: Operation - - Function which takes state and returns a Promise +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | + +**Example** *(Creates a new resource or replaces a representation of the target resource with the request payload, with data from state.)* +```js +put({ + url: state => `https://www.example.com/api/items/${state.id}`, + data: state => state.data +}); +``` + +* * * + +## referencePath + +referencePath(path) ⇒ string +Ensures a path points at references. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | string | JSONPath referencing a point in `references`. | + +**Example** +```js +referencePath('key') +``` + +* * * + +## request + +request(method, fullUrlOrPath, [options]) ⇒ +`request` is a helper function that sends HTTP requests and returns the response +body, headers, and status code. +Use the error map to provide custom error messages or get hold of the response in case of errors. + +**Kind**: global function +**Returns**: an object with the following properties: +- method: the request method +- url: the request url +- code: the status code of the response +- headers: the headers of the response +- body: the body of the response +- message: the status text of the response +- duration: the response time + +| Param | Description | +| --- | --- | +| method | The HTTP method to use for the request (e.g., "GET", "POST", "PUT", "DELETE", etc.). | +| fullUrlOrPath | The full or partial URL for the request. | +| [options] | The `options` parameter is an object that contains additional configuration options for the request. | + + +* * * + +## scrubEmojis + +scrubEmojis(text, replacementChars) ⇒ string +Replaces emojis in a string. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| text | string | String that needs to be cleaned | +| replacementChars | string | Characters that replace the emojis | + +**Example** +```js +scrubEmojis('Dove🕊️⭐ 29') +``` + +* * * + +## source + +source(path) ⇒ Array.<(String\|Object)> +Picks out a value from source data. +Will return whatever JSONPath returns, which will always be an array. +If you need a single value use `sourceValue` instead. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | String | JSONPath referencing a point in `state`. | + +**Example** +```js +source('$.key') +``` + +* * * + +## sourceValue + +sourceValue(path) ⇒ Operation +Picks out a single value from source data. +If a JSONPath returns more than one value for the reference, the first +item will be returned. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | String | JSONPath referencing a point in `state`. | + +**Example** +```js +sourceValue('$.key') +``` + +* * * + +## splitKeys + +splitKeys(obj, keys) ⇒ Array.<Object> +Splits an object into two objects based on a list of keys. +The first object contains the keys that are not in the list, +and the second contains the keys that are. + +**Kind**: global function +**Returns**: Array.<Object> - - Tuple of objects, first object contains keys not in list, second contains keys that are. +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| obj | Object | The object to split. | +| keys | Array.<string> | List of keys to split on. | + + +* * * + +## toArray + +toArray(arg) ⇒ array +Ensures primitive data types are wrapped in an array. +Does not affect array objects. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| arg | any | Data required to be in an array | + +**Example** +```js +each(function(state) { + return toArray( dataValue("path_of_array")(state) ) +}, ...) +``` + +* * * + +## validate + +validate(schema, data) ⇒ Operation +Validate against a JSON schema. Any erors 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`. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| schema | string \| object | The schema, path or URL to validate against | +| data | string \| object | The data or path to validate | + +**Example** *(Validate `state.data` with `state.schema`)* +```js +validate() +``` +**Example** *(Validate form data at `state.form` with a schema from a URL)* +```js +validate("https://www.example.com/schema/record", "form") +``` +**Example** *(Validate the each item in `state.records` with a schema from a URL)* +```js +each("records[*]", validate("https://www.example.com/schema/record")) +``` + +* * * + +## withAgent + +withAgent(params) ⇒ Operation +Creates an https agent for axios from the agentOptions key passed in params. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data | + + +* * * + diff --git a/docs/dhis2/CHANGELOG.md b/docs/dhis2/CHANGELOG.md new file mode 100644 index 000000000..1f7bc3678 --- /dev/null +++ b/docs/dhis2/CHANGELOG.md @@ -0,0 +1,149 @@ +# @openfn/language-dhis2 + +## 4.0.3 + +### Patch Changes + +- 222184d: remove Class Log and replaced + + - `Log.success` with `console.log` + - `Log.warn` with `console.warn` + - `Log.error` with `console.error` + +## 4.0.2 + +### Patch Changes + +- 1bd612e: improve error logs response + +## 4.0.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 4.0.0 + +### Major Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 3.2.12 + +### Patch Changes + +- 57742d1: improve logs output + +## 3.2.11 + +### Patch Changes + +- 705caab: Remove tools as devdependencies + +## 3.2.10 + +### Patch Changes + +- 929bca6: Use metadata helper function from common +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 3.2.9 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 3.2.8 + +### Patch Changes + +- Fix metadata function export + +## 3.2.7 + +### Patch Changes + +- c09b821: Add @magic annotations + +## 3.2.6 + +### Patch Changes + +- df6098d: replace sample state with configuration + +## 3.2.5 + +### Patch Changes + +- f2aed32: add examples + +## 3.2.4 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 3.2.3 + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 3.2.2 + +### Patch Changes + +- 9a2755e: Update dependency on language-common +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 + - @openfn/buildtools@1.0.2 + +## 3.2.1 + +### Patch Changes + +- e04aa28: Rename credential-schema to configuration-schema, update descriptions + +## 3.2.0 + +### Minor Changes + +- f670bf8: Added credential schema to enable new ui + +## 3.1.0 + +### Minor Changes + +- 8d6e8ce: Migrate dhis2 into repo + +### Patch Changes + +- Updated dependencies [4671e89] +- Updated dependencies [8d6e8ce] + - @openfn/buildtools@1.0.1 diff --git a/docs/dhis2/README.md b/docs/dhis2/README.md new file mode 100644 index 000000000..9db3985d3 --- /dev/null +++ b/docs/dhis2/README.md @@ -0,0 +1,113 @@ +# Language DHIS2 + +An OpenFn language Pack for building expressions and operations for working with +the +[DHIS2 API](http://dhis2.github.io/dhis2-docs/master/en/developer/html/dhis2_developer_manual.html). +Used most commonly via OpenFn.org or by hand with +[OpenFn/core](https://github.com/OpenFn/core) from the root of this repo: + +```sh +core execute \ + -l ../language-dhis2 \ + -e ./tmp/expression.js \ + -s ./tmp/state.json \ + -o ./tmp/output.json +``` + +## Documentation + +View the [docs site](https://docs.openfn.org/adaptors/packages/dhis2-docs) for +full technical documentation. + +There are lots of **examples** for how to use the various helper functions on +the main +[Adaptor docs](https://docs.openfn.org/adaptors/packages/dhis2-docs#modules) +page. + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/dhis2-configuration-schema/) +definition. + +## Development + +Run tests using `pnpm run test` or `pnpm run test:watch`. (NB: that this repo +also contain integration tests which can be run with +`pnpm run integration-test`.) + +⚠️ NB: Make changes to the files in `src/` and then use `npm run build` to +generate output files in `lib/`. + +The documentation is autogenerated, so please **rebuild the docs** after making +changes by running `pnpm build docs` + +### Unit Tests + +Unit tests allows to test the functionalities of the adaptor helper functions +such as: + +> Does `create('events', payload)` perform a post request to the correct DHIS2 +> API? + +To run unit tests execute `pnpm run test` (they're the default tests). + +Anytime a new functionality is added to the helper functions, more unit tests +needs to be added. + +### End-to-end integration tests + +Integration tests allow us to test the end-to-end behavior of the helper +functions and also to test the examples we provide via inline documentation. + +For example with integration tests we answer the following question: + +> Does `create('events', eventPayload)` actually create a new event in a live +> DHIS2 system? + +To run integration tests, execute `npm run integration-test`. These tests use +network I/O and a public connection to a DHIS2 "play" server so their timing and +performance is unpredictable. Consider adding an increased timeout, and +modifying the orgUnit, program, etc., IDs set in `globalState`. + +#### Troubleshooting the tests + +- Depending on your internet strength please consider changing the **global + timeout** in the `test/mocha.opts` file to avoid faillures related to network + timeouts. + +- The behavior of the tests in `test/integration.js` is very unpredictable; they + depend on the **configuration of a target DHIS2 instance**. Currently you need + to have at least one organisation unit with one program, one + trackedEntityInstance and one programStage in it. These components need to be + well configured for the integration tests to work. For example: the + trackedEntityInstance need to be enrolled to the program, which should be + created in that organisation unit and contains at least that programStage. If + the tests fail, you must adjust these attributes in the + [before hook](https://github.com/OpenFn/adaptors/tree/main/packages/dhis2/test/integration.js): + +```javascript +before(done => { + fixture.initialState = { + configuration: { + username: 'admin', + password: 'district', + hostUrl: 'https://play.dhis2.org/2.36.6', + }, + program: 'IpHINAT79UW', + orgUnit: 'DiszpKrYNg8', + trackedEntityInstance: 'uhubxsfLanV', + programStage: 'eaDHS084uMp', + }; + done(); +}); +``` + +- Make sure the `update` and `upsert` integration tests don't affect those + initial organisation units, programs, programStage and trackedEntityInstance + required. Otherwise the create integration tests would be broken again; and + that's an endless faillure loop :( + +Anytime a new example is added in the documentation of a helper function, a new +integration test should be built. diff --git a/docs/dhis2/index.md b/docs/dhis2/index.md new file mode 100644 index 000000000..e92aedafc --- /dev/null +++ b/docs/dhis2/index.md @@ -0,0 +1,585 @@ +## Functions + +
+
+ attr(attribute, value)
+
+ configMigrationHelper(state)
+
+ create(resourceType, data, [options], [callback])
+
+ destroy(resourceType, path, [data], [options], [callback])
+
+ discover(httpMethod, endpoint)
+
+ dv(dataElement, value)
+
+ findAttributeValue(trackedEntityInstance, attributeDisplayName)
+
+ get(resourceType, query, [options], [callback])
+
+ patch(resourceType, path, data, [options], [callback])
+
+ request(configuration, axiosRequest)
+
+ selectId(resourceType)
+
+ update(resourceType, path, data, [options], [callback])
+
+ upsert(resourceType, query, data, [options], [callback])
+
+ + +## attr + +attr(attribute, value) ⇒ object +Converts an attribute ID and value into a DSHI2 attribute object + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| attribute | string | A tracked entity instance (TEI) attribute ID. | +| value | string | The value for that attribute. | + +**Example** +```js +attr('w75KJ2mc4zz', 'Elias') +``` + +* * * + +## configMigrationHelper + +configMigrationHelper(state) ⇒ object +Migrates `apiUrl` to `hostUrl` if `hostUrl` is `blank`. +For `OpenFn.org` users with the `old-style configuration`. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| state | object | the runtime state | + +**Example** +```js +configMigrationHelper(state) +``` + +* * * + +## create + +create(resourceType, data, [options], [callback]) ⇒ Operation +Create a record + +**Kind**: global function +**Access**: public +**Magic**: resourceType $.children.resourceTypes[*] + +| Param | Type | Description | +| --- | --- | --- | +| resourceType | string | Type of resource to create. E.g. `trackedEntityInstances`, `programs`, `events`, ... | +| data | Dhis2Data | Object which defines data that will be used to create a given instance of resource. To create a single instance of a resource, `data` must be a javascript object, and to create multiple instances of a resources, `data` must be an array of javascript objects. | +| [options] | Object | Optional `options` to define URL parameters via params (E.g. `filter`, `dimension` and other import parameters), request config (E.g. `auth`) and the DHIS2 apiVersion. | +| [callback] | function | Optional callback to handle the response | + +**Example** *(a program)* +```js +create('programs', { + name: 'name 20', + shortName: 'n20', + programType: 'WITHOUT_REGISTRATION', +}); +``` +**Example** *(an event)* +```js +create('events', { + program: 'eBAyeGv0exc', + orgUnit: 'DiszpKrYNg8', + status: 'COMPLETED', +}); +``` +**Example** *(a trackedEntityInstance)* +```js +create('trackedEntityInstances', { + orgUnit: 'TSyzvBiovKh', + trackedEntityType: 'nEenWmSyUEp', + attributes: [ + { + attribute: 'w75KJ2mc4zz', + value: 'Gigiwe', + }, + ] +}); +``` +**Example** *(a dataSet)* +```js +create('dataSets', { name: 'OpenFn Data Set', periodType: 'Monthly' }); +``` +**Example** *(a dataSetNotification)* +```js +create('dataSetNotificationTemplates', { + dataSetNotificationTrigger: 'DATA_SET_COMPLETION', + notificationRecipient: 'ORGANISATION_UNIT_CONTACT', + name: 'Notification', + messageTemplate: 'Hello', + deliveryChannels: ['SMS'], + dataSets: [], +}); +``` +**Example** *(a dataElement)* +```js +create('dataElements', { + aggregationType: 'SUM', + domainType: 'AGGREGATE', + valueType: 'NUMBER', + name: 'Paracetamol', + shortName: 'Para', +}); +``` +**Example** *(a dataElementGroup)* +```js +create('dataElementGroups', { + name: 'Data Element Group 1', + dataElements: [], +}); +``` +**Example** *(a dataElementGroupSet)* +```js +create('dataElementGroupSets', { + name: 'Data Element Group Set 4', + dataDimension: true, + shortName: 'DEGS4', + dataElementGroups: [], +}); +``` +**Example** *(a dataValueSet)* +```js +create('dataValueSets', { + dataElement: 'f7n9E0hX8qk', + period: '201401', + orgUnit: 'DiszpKrYNg8', + value: '12', +}); +``` +**Example** *(a dataValueSet with related dataValues)* +```js +create('dataValueSets', { + dataSet: 'pBOMPrpg1QX', + completeDate: '2014-02-03', + period: '201401', + orgUnit: 'DiszpKrYNg8', + dataValues: [ + { + dataElement: 'f7n9E0hX8qk', + value: '1', + }, + { + dataElement: 'Ix2HsbDMLea', + value: '2', + }, + { + dataElement: 'eY5ehpbEsB7', + value: '3', + }, + ], +}); +``` +**Example** *(an enrollment)* +```js +create('enrollments', { + trackedEntityInstance: 'bmshzEacgxa', + orgUnit: 'TSyzvBiovKh', + program: 'gZBxv9Ujxg0', + enrollmentDate: '2013-09-17', + incidentDate: '2013-09-17', +}); +``` + +* * * + +## destroy + +destroy(resourceType, path, [data], [options], [callback]) ⇒ Operation +Delete a record. A generic helper function to delete an object + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| resourceType | string | The type of resource to be deleted. E.g. `trackedEntityInstances`, `organisationUnits`, etc. | +| path | string | Can be an `id` of an `object` or `path` to the `nested object` to `delete`. | +| [data] | Object | Optional. This is useful when you want to remove multiple objects from a collection in one request. You can send `data` as, for example, `{"identifiableObjects": [{"id": "IDA"}, {"id": "IDB"}, {"id": "IDC"}]}`. See more [on DHIS2 API docs](https://docs.dhis2.org/2.34/en/dhis2_developer_manual/web-api.html#deleting-objects) | +| [options] | Object | Optional `options` for `del` operation including params e.g. `{preheatCache: true, strategy: 'UPDATE', mergeMode: 'REPLACE'}`. Run `discover` or see [DHIS2 documentation](https://docs.dhis2.org/2.34/en/dhis2_developer_manual/web-api.html#create-update-parameters). Defaults to `{operationName: 'delete', apiVersion: state.configuration.apiVersion, responseType: 'json'}` | +| [callback] | function | Optional callback to handle the response | + +**Example** *(a tracked entity instance)* +```js +destroy('trackedEntityInstances', 'LcRd6Nyaq7T'); +``` + +* * * + +## discover + +discover(httpMethod, endpoint) ⇒ Operation +Discover `DHIS2` `api` `endpoint` `query parameters` and allowed `operators` for a given resource's endpoint. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| httpMethod | string | The HTTP to inspect parameter usage for a given endpoint, e.g., `get`, `post`,`put`,`patch`,`delete` | +| endpoint | string | The path for a given endpoint. E.g. `/trackedEntityInstances` or `/dataValueSets` | + +**Example** *(a list of parameters allowed on a given endpoint for specific http method)* +```js +discover('post', '/trackedEntityInstances') +``` + +* * * + +## dv + +dv(dataElement, value) ⇒ object +Converts a dataElement and value into a DSHI2 dataValue object + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| dataElement | string | A data element ID. | +| value | string | The value for that data element. | + +**Example** +```js +dv('f7n9E0hX8qk', 12) +``` + +* * * + +## findAttributeValue + +findAttributeValue(trackedEntityInstance, attributeDisplayName) ⇒ string +Gets an attribute value by its case-insensitive display name + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| trackedEntityInstance | Object | A tracked entity instance (TEI) object | +| attributeDisplayName | string | The 'displayName' to search for in the TEI's attributes | + +**Example** +```js +findAttributeValue(state.data.trackedEntityInstances[0], 'first name') +``` + +* * * + +## get + +get(resourceType, query, [options], [callback]) ⇒ Operation +Get data. Generic helper method for getting data of any kind from DHIS2. +- This can be used to get `DataValueSets`,`events`,`trackedEntityInstances`,`etc.` + +**Kind**: global function +**Returns**: Operation - state +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| resourceType | string | The type of resource to get(use its `plural` name). E.g. `dataElements`, `trackedEntityInstances`,`organisationUnits`, etc. | +| query | Object | A query object that will limit what resources are retrieved when converted into request params. | +| [options] | Object | Optional `options` to define URL parameters via params beyond filters, request configuration (e.g. `auth`) and DHIS2 api version to use. | +| [callback] | function | Optional callback to handle the response | + +**Example** *(all data values for the 'pBOMPrpg1QX' dataset)* +```js +get('dataValueSets', { + dataSet: 'pBOMPrpg1QX', + orgUnit: 'DiszpKrYNg8', + period: '201401', + fields: '*', +}); +``` +**Example** *(all programs for an organization unit)* +```js +get('programs', { orgUnit: 'TSyzvBiovKh', fields: '*' }); +``` +**Example** *(a single tracked entity instance by a unique external ID)* +```js +get('trackedEntityInstances', { + ou: 'DiszpKrYNg8', + filter: ['flGbXLXCrEo:Eq:124', 'w75KJ2mc4zz:Eq:John'], +}); +``` + +* * * + +## patch + +patch(resourceType, path, data, [options], [callback]) ⇒ Operation +Patch a record. A generic helper function to send partial updates on one or more object properties. +- You are not required to send the full body of object properties. +- This is useful for cases where you don't want or need to update all properties on a object. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| resourceType | string | The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc. | +| path | string | The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}` | +| data | Object | Data to update. Include only the fields you want to update. E.g. `{name: "New Name"}` | +| [options] | Object | Optional configuration, including params for the update ({preheatCache: true, strategy: 'UPDATE', mergeMode: 'REPLACE'}). Defaults to `{operationName: 'patch', apiVersion: state.configuration.apiVersion, responseType: 'json'}` | +| [callback] | function | Optional callback to handle the response | + +**Example** *(a dataElement)* +```js +patch('dataElements', 'FTRrcoaog83', { name: 'New Name' }); +``` + +* * * + +## request + +request(configuration, axiosRequest) ⇒ Promise +The request client takes configuration from state and an axios request object +then (1) logs the method and URL, (2) applies standard headers and auth +before spreading the rest of the axios configuration, and (3) executes an +axios request. + +**Kind**: global function +**Returns**: Promise - a promise that will resolve to either a response object or an error object. + +| Param | Type | Description | +| --- | --- | --- | +| configuration | object | configuration must have a username and password | +| axiosRequest | object | the axiosRequest contains valid axios params: https://axios-http.com/docs/req_config | + + +* * * + +## selectId + +selectId(resourceType) ⇒ string +Determines the attribute name for a DHIS2 system ID given a resource type. + +**Kind**: global function + +| Param | Type | +| --- | --- | +| resourceType | string | + + +* * * + +## update + +update(resourceType, path, data, [options], [callback]) ⇒ Operation +Update data. A generic helper function to update a resource object of any type. +Updating an object requires to send `all required fields` or the `full body` + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| resourceType | string | The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc. | +| path | string | The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}` | +| data | Object | Data to update. It requires to send `all required fields` or the `full body`. If you want `partial updates`, use `patch` operation. | +| [options] | Object | Optional `options` to define URL parameters via params (E.g. `filter`, `dimension` and other import parameters), request config (E.g. `auth`) and the DHIS2 apiVersion. | +| [callback] | function | Optional callback to handle the response | + +**Example** *(a program)* +```js +update('programs', 'qAZJCrNJK8H', { + name: '14e1aa02c3f0a31618e096f2c6d03bed', + shortName: '14e1aa02', + programType: 'WITHOUT_REGISTRATION', +}); +``` +**Example** *(an event)* +```js +update('events', 'PVqUD2hvU4E', { + program: 'eBAyeGv0exc', + orgUnit: 'Ngelehun CHC', + status: 'COMPLETED', + storedBy: 'admin', + dataValues: [], +}); +``` +**Example** *(a trackedEntityInstance)* +```js +update('trackedEntityInstances', 'IeQfgUtGPq2', { + created: '2015-08-06T21:12:37.256', + orgUnit: 'TSyzvBiovKh', + createdAtClient: '2015-08-06T21:12:37.256', + trackedEntityInstance: 'IeQfgUtGPq2', + lastUpdated: '2015-08-06T21:12:37.257', + trackedEntityType: 'nEenWmSyUEp', + inactive: false, + deleted: false, + featureType: 'NONE', + programOwners: [ + { + ownerOrgUnit: 'TSyzvBiovKh', + program: 'IpHINAT79UW', + trackedEntityInstance: 'IeQfgUtGPq2', + }, + ], + enrollments: [], + relationships: [], + attributes: [ + { + lastUpdated: '2016-01-12T00:00:00.000', + displayName: 'Last name', + created: '2016-01-12T00:00:00.000', + valueType: 'TEXT', + attribute: 'zDhUuAYrxNC', + value: 'Russell', + }, + { + lastUpdated: '2016-01-12T00:00:00.000', + code: 'MMD_PER_NAM', + displayName: 'First name', + created: '2016-01-12T00:00:00.000', + valueType: 'TEXT', + attribute: 'w75KJ2mc4zz', + value: 'Catherine', + }, + ], +}); +``` +**Example** *(a dataSet)* +```js +update('dataSets', 'lyLU2wR22tC', { name: 'OpenFN Data Set', periodType: 'Weekly' }); +``` +**Example** *(a dataSetNotification)* +```js +update('dataSetNotificationTemplates', 'VbQBwdm1wVP', { + dataSetNotificationTrigger: 'DATA_SET_COMPLETION', + notificationRecipient: 'ORGANISATION_UNIT_CONTACT', + name: 'Notification', + messageTemplate: 'Hello Updated, + deliveryChannels: ['SMS'], + dataSets: [], +}); +``` +**Example** *(a dataElement)* +```js +update('dataElements', 'FTRrcoaog83', { + aggregationType: 'SUM', + domainType: 'AGGREGATE', + valueType: 'NUMBER', + name: 'Paracetamol', + shortName: 'Para', +}); +``` +**Example** *(a dataElementGroup)* +```js +update('dataElementGroups', 'QrprHT61XFk', { + name: 'Data Element Group 1', + dataElements: [], +}); +``` +**Example** *(a dataElementGroupSet)* +```js +update('dataElementGroupSets', 'VxWloRvAze8', { + name: 'Data Element Group Set 4', + dataDimension: true, + shortName: 'DEGS4', + dataElementGroups: [], +}); +``` +**Example** *(a dataValueSet)* +```js +update('dataValueSets', 'AsQj6cDsUq4', { + dataElement: 'f7n9E0hX8qk', + period: '201401', + orgUnit: 'DiszpKrYNg8', + value: '12', +}); +``` +**Example** *(a dataValueSet with related dataValues)* +```js +update('dataValueSets', 'Ix2HsbDMLea', { + dataSet: 'pBOMPrpg1QX', + completeDate: '2014-02-03', + period: '201401', + orgUnit: 'DiszpKrYNg8', + dataValues: [ + { + dataElement: 'f7n9E0hX8qk', + value: '1', + }, + { + dataElement: 'Ix2HsbDMLea', + value: '2', + }, + { + dataElement: 'eY5ehpbEsB7', + value: '3', + }, + ], +}); +``` +**Example** *(a single enrollment)* +```js +update('enrollments', 'CmsHzercTBa' { + trackedEntityInstance: 'bmshzEacgxa', + orgUnit: 'TSyzvBiovKh', + program: 'gZBxv9Ujxg0', + enrollmentDate: '2013-10-17', + incidentDate: '2013-10-17', +}); +``` + +* * * + +## upsert + +upsert(resourceType, query, data, [options], [callback]) ⇒ Operation +Upsert a record. A generic helper function used to atomically either insert a row, or on the basis of the row already existing, UPDATE that existing row instead. + +**Kind**: global function +**Throws**: + +- RangeError - Throws range error + +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| resourceType | string | The type of a resource to `upsert`. E.g. `trackedEntityInstances` | +| query | Object | A query object that allows to uniquely identify the resource to update. If no matches found, then the resource will be created. | +| data | Object | The data to use for update or create depending on the result of the query. | +| [options] | Object | Optional configuration that will be applied to both the `get` and the `create` or `update` operations. | +| [callback] | function | Optional callback to handle the response | + +**Example** *(Example `expression.js` of upsert)* +```js +upsert('trackedEntityInstances', { + ou: 'TSyzvBiovKh', + filter: ['w75KJ2mc4zz:Eq:Qassim'], +}, { + orgUnit: 'TSyzvBiovKh', + trackedEntityType: 'nEenWmSyUEp', + attributes: [ + { + attribute: 'w75KJ2mc4zz', + value: 'Qassim', + }, + ], +}); +``` + +* * * + diff --git a/docs/docs.json b/docs/docs.json new file mode 100644 index 000000000..7c9c38eaf --- /dev/null +++ b/docs/docs.json @@ -0,0 +1,50 @@ +[ +{"name":"asana","adaptor":"@openfn/language-asana","version":"3.0.1","docs":"\"## Functions\\n\\n
\\n
\\n createTask(params, callback)
\\n
\\n getTask(taskGid, params, callback)
\\n
\\n getTasks(projectGid, params, callback)
\\n
\\n updateTask(taskGid, params, callback)
\\n
\\n upsertTask(projectGid, params, callback)
\\n
\\n\\n\\n## createTask\\n\\ncreateTask(params, callback) ⇒ Operation\\nCreate a task.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Body parameters |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ncreateTask(\\n {\\n name: 'test', \\\"approval_status\\\": \\\"pending\\\", \\\"assignee\\\": \\\"12345\\\"\\n }\\n)\\n```\\n\\n* * *\\n\\n## getTask\\n\\ngetTask(taskGid, params, callback) ⇒ Operation\\nGet a single task of a given project.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| taskGid | string | Globally unique identifier for the task |\\n| params | object | Query params to include. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ngetTask(\\\"taskGid\\\",\\n {\\n opt_fields: \\\"name,notes,assignee\\\"\\n })\\n```\\n\\n* * *\\n\\n## getTasks\\n\\ngetTasks(projectGid, params, callback) ⇒ Operation\\nGet the list of tasks for a given project.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| projectGid | string | Globally unique identifier for the project |\\n| params | object | Query params to include. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ngetTasks(\\\"projectGid\\\",\\n {\\n opt_fields: \\\"name,notes,assignee\\\"\\n })\\n```\\n\\n* * *\\n\\n## updateTask\\n\\nupdateTask(taskGid, params, callback) ⇒ Operation\\nUpdate a specific task.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| taskGid | string | Globally unique identifier for the task |\\n| params | object | Body parameters |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nupdateTask(\\\"taskGid\\\",\\n {\\n name: 'test', \\\"approval_status\\\": \\\"pending\\\", \\\"assignee\\\": \\\"12345\\\"\\n }\\n)\\n```\\n\\n* * *\\n\\n## upsertTask\\n\\nupsertTask(projectGid, params, callback) ⇒ Operation\\nUpdate or create a task.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| projectGid | string | Globally unique identifier for the project |\\n| params | object | an object with an externalId and some task data. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nupsertTask(\\n \\\"1201382240880\\\",\\n {\\n \\\"externalId\\\": \\\"name\\\",\\n \\\"data\\\": {\\n name: 'test', \\\"approval_status\\\": \\\"pending\\\", \\\"assignee\\\": \\\"12345\\\"\\n }\\n\\n }\\n)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-asana\\n\\nLanguage Pack for connecting with Asana.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/asana-configuration-schema/)\\ndefinition.\\n\\n### How to create an API token\\n\\nUsing Asana's API requires having an API token. To generate that token, head to\\nthe [Asana developer console](https://app.asana.com/0/developer-console) and\\nenter the **Personal access tokens** section.\\n\\nThere you can click on **+New access token**. A prompt will be opened allowing\\nyou to give the token a name and then create it.\\n\\n_Note: Treat your PAT like you would with a password. Do not share it or display\\nit online._\\n\\n### Sample expression\\n\\n## Find a single task of a given project using the task id.\\n\\n```js\\ngetTask('1234', {\\n opt_fields: 'name,assignee',\\n});\\n```\\n\\n## Find the list of tasks of a given project using the project id.\\n\\n```js\\ngetTasks('22889593722', {\\n opt_fields: 'name,notes,assignee',\\n});\\n```\\n\\n## Update a specific task\\n\\n```js\\nupdateTask('12344', {\\n name: 'test',\\n approval_status: 'pending',\\n assignee: '12345',\\n});\\n```\\n\\n## Create a task\\n\\n```js\\ncreateTask({\\n name: 'test',\\n approval_status: 'pending',\\n assignee: '12345',\\n});\\n```\\n\\n## Update a task or create a new one\\n\\nYou can use a field name literal as `externalId` to match a specific task. If\\nthe task does not exist, a new one will be created. The first parameter in this\\nfunction should be the `project_id`.\\n\\n```js\\nupsertTask('12344', {\\n externalId: 'name',\\n data: {\\n name: 'A new task',\\n projects: ['12344'],\\n notes: 'This is a new task',\\n },\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-asana\\n\\n## 3.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 3.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 2.1.6\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 2.1.5\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 2.1.4\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 2.1.3\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 2.1.2\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 2.1.1\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 2.1.0\\n\\n### Minor Changes\\n\\n- 5f40dcf: Migrated language-asana\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\"","functions":["createTask","getTask","getTasks","updateTask","upsertTask"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"apiVersion":{"title":"API Version","type":"string","description":"The API version","examples":["1.0"]},"token":{"title":"Token","type":"string","description":"The API token","examples":["sample-tokenyWSJdXBACMLLWMNGgADFA"]}},"type":"object","additionalProperties":true,"required":["apiVersion","token"]}}, +{"name":"azure-storage","adaptor":"@openfn/language-azure-storage","version":"1.0.0","docs":"\"## Functions\\n\\n
\\n
\\n downloadBlob(blobName, [options])
\\n
\\n getBlobProperties(blobName, options)
\\n
\\n uploadBlob(blobName, content, uploadOptions, [options])
\\n
\\n\\n\\n## downloadBlob\\n\\ndownloadBlob(blobName, [options]) ⇒ Operation\\nDownload a blob from Azure Blob Storage.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| blobName | string | | Name of the blob to download. |\\n| [options] | Object | {} | Additional options for the download process. |\\n\\n**Example** \\n```js\\ndownloadBlob('mycontainer', 'myblob.txt', { downloadAs: 'string' })\\n```\\n\\n* * *\\n\\n## getBlobProperties\\n\\ngetBlobProperties(blobName, options) ⇒ Operation\\nGet properties of a blob in Azure Blob Storage.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| blobName | string | Name of the blob to get properties for. |\\n| options | string | Additional options for the getBlobProperties process. |\\n\\n**Example** \\n```js\\ngetBlobProperties('mycontainer', 'myblob.txt')\\n```\\n\\n* * *\\n\\n## uploadBlob\\n\\nuploadBlob(blobName, content, uploadOptions, [options]) ⇒ Operation\\nUpload content to Azure Blob Storage.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| blobName | string | | Name of the blob to create or replace. |\\n| content | string | | Content to upload. |\\n| uploadOptions | object | | See BlockBlobUploadOptions in Azure Blob Storage docs |\\n| [options] | Object | {} | Additional options for the upload process. |\\n| [options.createContainer] | boolean | false | Whether to create the container if it doesn't exist. |\\n| [options.overwrite] | boolean | false | Whether to overwrite an existing blob with the same name. |\\n| [options.containerName] | string | | Container name. Overrides state.configuration. |\\n\\n**Example** \\n```js\\nuploadBlob('mycontainer', 'myblob.txt', {foo:\\\"bar\\\"}, { blobHTTPHeaders: { blobContentType: 'application/json' } })\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-azure-storage \\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the Azure\\nStorage APIs. At present, this adaptor only supports the Azure Blob Storage,\\nAPI, but could be expanded for future Azure Storage services (e.g., Files,\\nTables, Queues, etc.).\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/azure-storage-docs)\\nfor full technical documentation.\\n\\n### Configuration\\n\\nView the\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/azure-storage-configuration-schema/)\\nfor required and optional `configuration` properties.\\n\\n### An example showing multiple capabilties of this adaptor\\n\\nAssume you have a simple `state.json` file as follows:\\n\\n```json\\n{\\n \\\"data\\\": {\\n\\t\\\"foo\\\": \\\"bar\\\",\\n\\t\\\"bif\\\": \\\"baz\\\",\\n\\t\\\"sunday\\\": \\\"monday\\\",\\n\\t\\\"answer\\\": \\\"42\\\"\\n },\\n \\\"configuration\\\": {\\n \\\"accountName\\\": \\\"myaccountname\\\",\\n \\\"accountKey\\\": \\\"myaccountkey\\\",\\n \\\"containerName\\\": \\\"mycontainer\\\"\\n }\\n}\\n```\\n\\nCreate a file `job.js`, as shown below, to run with the OpenFn CLI. This\\nexample uploads the blob with a year/month partitioning scheme, then\\ndownloads the same blob and fetches the blob properties. It would be extremely\\nunusual to perform all of these actions in a single job.\\n\\n```js\\nuploadBlob(\\n state => {\\n const date = new Date();\\n const id = '0e82962a-6ed0-4a88-92c1-51ae785b4126';\\n return `${date.getFullYear()}/${date.getMonth() + 1}/${id}.json`;\\n },\\n state.data,\\n {\\n blobHTTPHeaders: { blobContentType: 'application/json' }\\n },\\n { createContainer: true, overwrite: true }\\n);\\n\\ndownloadBlob(\\n dataValue('blobName');\\n);\\n\\ngetBlobProperties(\\n state => {\\n return state.references[1].blobName;\\n }\\n);\\n```\\n\\nRun the job as follows:\\n\\n```bash\\nopenfn job -a azure-storage -s state.json -O\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n\\\"Getting Started\\\" guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build _only_ the docs run `pnpm build docs`.\\n\"","changelog":"\"# @openfn/language-azure-storage\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\nIntial adaptor release with support for Blob storage.\\n\\n- uploadBlob\\n- downloadBlob\\n- getBlobProperties\\n\"","functions":["downloadBlob","getBlobProperties","uploadBlob"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountName":{"title":"Account Name","type":"string","description":"Azure Storage Account Name","examples":["examplestorageaccount01"]},"accountKey":{"title":"Account Key","type":"string","description":"Azure Account Key","writeOnly":true,"examples":["zzUx5rA4BZkjPet8ztLTEll7azF65Sez7WxGKsJv5B+rp/dby8ARgYpEVe93xFCQDqGBi3FUlxjP+ASt4uepZg=="]},"containerName":{"title":"Container Name","type":"string","description":"Name of Azure Blob Storage Container","writeOnly":true,"examples":["mycontainername"]}},"type":"object","additionalProperties":true,"required":["accountName","accountKey"]}}, +{"name":"beyonic","adaptor":"@openfn/language-beyonic","version":"0.2.1","docs":"\"## Functions\\n\\n
\\n
\\n createCollectionRequest(data)
\\n
\\n createContact(data)
\\n
\\n createPayment(data)
\\n
\\n\\n\\n## createCollectionRequest\\n\\ncreateCollectionRequest(data) ⇒ Operation\\nCreate a collection request\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | Payload data for the collection request |\\n\\n**Example** \\n```js\\nexecute(\\n createCollectionRequest(data)\\n)(state)\\n```\\n\\n* * *\\n\\n## createContact\\n\\ncreateContact(data) ⇒ Operation\\nCreate a contact\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | Payload data for the contact |\\n\\n**Example** \\n```js\\nexecute(\\n createContact(data)\\n)(state)\\n```\\n\\n* * *\\n\\n## createPayment\\n\\ncreatePayment(data) ⇒ Operation\\nCreate a payment\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | Payload data for the payment |\\n\\n**Example** \\n```js\\nexecute(\\n createPayment(data)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Beyonic\\n\\nLanguage Pack for building expressions and operations for working with the\\n[beyonic API](http://apidocs.beyonic.com/).\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/beyonic-configuration-schema/)\\ndefinition.\\n\\n## Payments API\\n\\n#### `createPayment(...)`\\n\\n```js\\ncreatePayment(\\n fields(\\n field('phonenumber', '+256773712831'),\\n field('first_name', 'Gideon'),\\n field('last_name', 'Zelalem'),\\n field('amount', 100.2),\\n field('currency', 'USD'),\\n field('account', 1),\\n field('description', 'Long-term contract for Arseal'),\\n field('payment_type', 'money'),\\n field('callback_url', 'https://my.website/payments/callback')\\n )\\n);\\n```\\n\\n## Collection Requests API\\n\\n#### `createCollectionRequest(...)`\\n\\n```js\\ncreateCollectionRequest(\\n fields(\\n field('instructions', 'Send me some money, please!'),\\n field('phonenumber', '+256773712831'),\\n field('amount', 5.0),\\n field('currency', 'USD')\\n )\\n);\\n```\\n\\n## Contacts API\\n\\n#### `createContact(...)`\\n\\n```js\\ncreateContact(\\n fields(\\n field('first_name', 'Granit'),\\n field('last_name', 'Xhaka'),\\n field('phone_number', '+256773712831'),\\n field('email', 'granit@arsenal.com')\\n )\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-beyonic\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.1.9\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.1.8\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.1.7\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.1.6\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.1.5\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 0.1.4\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 0.1.3\\n\\n### Patch Changes\\n\\n- 63080d0: Update common for build\\n\\n## 0.1.2\\n\\n### Patch Changes\\n\\n- 0d358b6: Add ast.json for beyonic\\n\\n## 0.1.1\\n\\n### Patch Changes\\n\\n- 06ff25f: Update superagent to v8\\n\\n## 0.1.0\\n\\n### Minor Changes\\n\\n- 28ceb1f: Moving language-beyonic to adaptors/packages/beyonic\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"apiUrl":{"title":"API URL","type":"string","description":"API URL","format":"uri","minLength":1,"examples":["https://beyonic.com/api"]},"apiToken":{"title":"API Token","type":"string","description":"API token","minLength":1,"examples":["cdjhiooiSIUJHDYSYUIHASIOHKAANOAJJjsiujhaka"]}},"type":"object","additionalProperties":true,"required":["apiUrl","apiToken"]}}, +{"name":"bigquery","adaptor":"@openfn/language-bigquery","version":"2.0.4","docs":"\"## load\\n\\nload(dirPath, projectId, datasetId, tableId, loadOptions, callback) ⇒ Operation\\nLoad files to BigQuery\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| dirPath | string | the path to your local directory |\\n| projectId | string | your bigquery project id |\\n| datasetId | string | your bigquery dataset id |\\n| tableId | string | the name of the table you'd like to load |\\n| loadOptions | object | options to pass to the bigquery.load() API |\\n| callback | function | and optional callback |\\n\\n**Example** \\n```js\\nload(\\n './tmp/files',\\n 'my-bg-project',\\n 'test01',\\n 'product-codes',\\n {\\n schema: 'FREQ:STRING,DATATYPE:STRING,PRODUCTCODE:STRING,PARTNER:STRING',\\n writeDisposition: 'WRITE_APPEND',\\n skipLeadingRows: 1,\\n schemaUpdateOptions: ['ALLOW_FIELD_ADDITION'],\\n createDisposition: 'CREATE_IF_NEEDED',\\n }\\n)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language BigQuery\\n\\nLanguage Pack for building expressions and operations to make HTTP calls.\\n\\n## Documentation\\n\\n### state.json\\n\\nThe configuration key must be a valid GCP credential as JSON.\\n\\n```json\\n{\\n \\\"configuration\\\": {\\n \\\"type\\\": \\\"service_account\\\",\\n \\\"project_id\\\": \\\"some-project\\\",\\n \\\"private_key_id\\\": \\\"670b9e3c8c366e83aa569dd57cbfc5c575b72e42\\\",\\n \\\"private_key\\\": \\\"-----BEGIN PRIVATE KEY-----\\\\nblah\\\\nmoreblah=\\\\n-----END PRIVATE KEY-----\\\\n\\\",\\n \\\"client_email\\\": \\\"bigquery@some-project.iam.gserviceaccount.com\\\",\\n \\\"client_id\\\": \\\"someid\\\",\\n \\\"auth_uri\\\": \\\"https://accounts.google.com/o/oauth2/auth\\\",\\n \\\"token_uri\\\": \\\"https://oauth2.googleapis.com/token\\\",\\n \\\"auth_provider_x509_cert_url\\\": \\\"https://www.googleapis.com/oauth2/v1/certs\\\",\\n \\\"client_x509_cert_url\\\": \\\"https://www.googleapis.com/robot/v1/metadata/x509/bigquery%40some-project.iam.gserviceaccount.com\\\"\\n },\\n \\\"data\\\": { \\\"a\\\": 1 }\\n}\\n```\\n\\n### operations (expression.js)\\n\\n#### load(...)\\n\\nLoad data to a table in bigquery from a CSV. See full\\n[options here](https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad).\\n\\n```js\\nload(\\n '/home/taylor/Desktop/type-C_r-ALL_ps-201012_freq-M_px-HS_pub-20200731_fmt-csv_ex-20200818.csv',\\n 'awesome-solutions-project', // project\\n 'test01', // dataset\\n 'mytable', // table\\n {\\n schema:\\n 'classification:STRING,year:STRING,period:STRING,period_desc:STRING,aggregate_level:STRING,is_leaf_code:STRING,trade_flow_code:STRING,trade_flow:STRING,reporter_code:STRING,reporter:STRING,reporter_iso:STRING,partner_code:STRING,partner:STRING,partner_iso:STRING,commodity_code:STRING,commodity:STRING,qty_unit_code:STRING,qty_unit:STRING,qty:INTEGER,netweight_kg:INTEGER,trade_value:INTEGER,flag:STRING',\\n schemaUpdateOptions: ['ALLOW_FIELD_ADDITION'],\\n // createDisposition: 'CREATE_IF_NEEDED',\\n writeDisposition: 'WRITE_APPEND',\\n skipLeadingRows: 1,\\n } // loadOptions\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-bigquery\\n\\n## 2.0.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 2.0.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 2.0.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 2.0.1\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 2.0.0\\n\\n### Major Changes\\n\\n- 0b6f20b: use parseCsv from common\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 1.2.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 1.2.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 1.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.1.5\\n\\n### Patch Changes\\n\\n- 5895eb9: update dependencies\\n\\n## 1.1.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 1.1.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.1.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n- 57f3513: Fix exports in index.js\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- e4c6114: bigquery migration and build\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":["load"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","additionalProperties":true,"properties":{"type":{"title":"Type","type":"string","description":"","examples":["service_acconut"]},"project_id":{"title":"Prokect id","type":"string","description":"Project id","examples":["some-project-id"]},"private_key_id":{"title":"Private Key Id","type":"string","description":"Private key id","examples":["670b9e3c8c366e83aa569dd57cbfc5c575b72e42"]},"private_key":{"title":"Private Key","type":"string","description":"Private key","examples":["-----BEGIN PRIVATE KEY-----\nblah\nmoreblah=\n-----END PRIVATE KEY-----\n"]},"client_email":{"title":"Client Email","type":"string","description":"Client email","examples":["bigquery@some-project.iam.gserviceaccount.com"]},"client_id":{"title":"Client Id","type":"string","description":"Client id","examples":["someid"]},"auth_uri":{"title":"Auth Uri","type":"string","description":"Auth Uri","examples":["https://accounts.google.com/o/oauth2/auth"]},"token_uri":{"title":"Token Uri","type":"string","description":"Token Uri","examples":["https://oauth2.googleapis.com/token"]},"auth_provider_x509_cert_url":{"title":"Auth Provider x509 Cert Url","type":"string","description":"","examples":["https://www.googleapis.com/oauth2/v1/certs"]},"client_x509_cert_url":{"title":"Client x509 Cert Url","type":"string","description":"","examples":["https://www.googleapis.com/robot/v1/metadata/x509/bigquery%40some-project.iam.gserviceaccount.com"]}},"required":["type","project_id","private_key_id","private_key","client_email","client_id","auth_uri","token_uri","auth_provider_x509_cert_url","client_x509_cert_url"]}}, +{"name":"commcare","adaptor":"@openfn/language-commcare","version":"1.6.10","docs":"\"## Functions\\n\\n
\\n
\\n clientPost(formData)
\\n
\\n fetchReportData(reportId, params, postUrl)
\\n
\\n submit(formData)
\\n
\\n submitXls(formData, params)
\\n
\\n\\n\\n## clientPost\\n\\nclientPost(formData) ⇒ State\\nPerforms a post request\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| formData | Object | Form Data with auth params and body |\\n\\n**Example** \\n```js\\nclientPost(formData)\\n```\\n\\n* * *\\n\\n## fetchReportData\\n\\nfetchReportData(reportId, params, postUrl) ⇒ Operation\\nMake a GET request to CommCare's Reports API\\nand POST the response to somewhere else.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| reportId | String | API name of the report. |\\n| params | Object | Query params, incl: limit, offset, and custom report filters. |\\n| postUrl | String | Url to which the response object will be posted. |\\n\\n**Example** \\n```js\\nfetchReportData(reportId, params, postUrl)\\n```\\n\\n* * *\\n\\n## submit\\n\\nsubmit(formData) ⇒ Operation\\nSubmit form data\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| formData | Object | Object including form data. |\\n\\n**Example** \\n```js\\nsubmit(\\n fields(\\n field(\\\"@\\\", function(state) {\\n return {\\n \\\"xmlns\\\": \\\"http://openrosa.org/formdesigner/form-id-here\\\"\\n };\\n }),\\n field(\\\"question1\\\", dataValue(\\\"answer1\\\")),\\n field(\\\"question2\\\", \\\"Some answer here.\\\")\\n )\\n )\\n```\\n\\n* * *\\n\\n## submitXls\\n\\nsubmitXls(formData, params) ⇒ Operation\\nConvert form data to xls then submit.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| formData | Object | Object including form data. |\\n| params | Object | Request params including case type and external id. |\\n\\n**Example** \\n```js\\nsubmitXls(\\n [\\n {name: 'Mamadou', phone: '000000'},\\n ],\\n {\\n case_type: 'student',\\n search_field: 'external_id',\\n create_new_cases: 'on',\\n }\\n)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language CommCare\\n\\nLanguage Pack for interacting with the CommCare API.\\n\\nhttps://confluence.dimagi.com/display/commcarepublic/Download+Report+Data\\n\\nhttps://confluence.dimagi.com/display/commcarepublic/Submission+API\\n\\nhttps://bitbucket.org/javarosa/javarosa/wiki/FormSubmissionAPI\\n\\nAccepted X-Form Spec from Dimagi: http://dimagi.github.io/xform-spec Accepted\\nX-Form Spec for Cases from Dimagi:\\nhttps://github.com/dimagi/commcare/wiki/casexml20\\n\\n## Documentation\\n\\n## Configuration\\n\\nView all the required and optional properties for `state.configuration` in the official [configuration-schema](https://docs.openfn.org/adaptors/packages/commcare-configuration-schema/) definition.\\n\\n- The \\\"appId\\\" is the UUID which designates your commcare project as different from\\neveryone elses. It can be found in the URL of your application when you first\\nenter it from the project screen. I.e., the last part of this url:\\n`https://www.commcarehq.org/a/YOUR_PROJECT/apps/view/YOUR_APP_ID/`\\n\\n- Note that the username is your full email address.\\n\\n## `fetchReportData` to pull aggregate data from CommCare\\n\\nIt takes 3 arguments: reportId, params, and postUrl.\\n\\n```js\\nfetchReportData(\\n 'reportId',\\n { limit: 10, offset: 2, state: 'Vermont' },\\n 'http://www.openfn.org/inbox/secret-uuid'\\n);\\n```\\n\\nsimple body target:\\n\\n```xml\\n\\n Something\\n Else\\n 29\\n\\n```\\n\\ncomplex body target:\\n\\n```xml\\n\\n\\n bar\\n \\n \\n bar\\n user-xxx-eve\\n member\\n \\n \\n \\n A00000245706EE\\n 2013-04-19T16:52:41.000-04\\n 2013-04-19T16:53:02.799-04\\n eve\\n user-xxx-eve\\n b58df19c-efd5-4ecf-9581-65dda8b8787c\\n CommCare ODK, version \\\"2.4.1\\\"(10083). App v19. CommCare Version 2.4. Build 10083, built on: March-12-2013\\n \\n\\n```\\n\\n## Submitting data to CommCare HQ\\n\\n### Submit an XLS file\\n\\nThis function bulk submit a JSON object as xls file to CommCare HQ\\n\\n```js\\nsubmitXls([{ name: 'Mamadou', phone: '000000' }], {\\n case_type: 'student',\\n search_field: 'external_id',\\n create_new_cases: 'on',\\n});\\n```\\n\\n### submit\\n\\nHere we're just building the most basic JSON object, that will be converted to\\nan XML object and posted as the element.\\n\\n```js\\nsubmit(\\n fields(\\n field('@', function (state) {\\n return {\\n xmlns:\\n 'http://openrosa.org/formdesigner/2BCC3E88-2D0D-4C07-8D4A-6B372F3799D9',\\n };\\n }),\\n field('paitent_namentosh', dataValue('first_name')),\\n field('question2', 'Some answer here.'),\\n field('question3', 'HKS'),\\n field('question4', 'item1'),\\n field('question5', 69855),\\n field('question6', 12)\\n )\\n);\\n```\\n\\nAn open rosa form submission body should look like this:\\n\\n```xml\\n\\n\\n Taylor\\n Moruki\\n Hks\\n item1\\n 69855\\n 12\\n \\n 358239055789384\\n 2015-08-21T16:21:59.807+02\\n 2015-08-21T16:22:15.987+02\\n openfn\\n 5fe615b3af2834cb5dca59f7466d6174\\n 195e79eb-d823-46fe-9e4f-59b8327d5db2\\n CommCare ODK, version "2.22.0"(370023). App v9. CommCare Version 2.22. Build 370023, built on: July-22-2015\\n \\n\\n```\\n\\nSo the JSON emitted by your expression should look like this:\\n\\n```json\\n{\\n \\\"data\\\": {\\n \\\"name\\\": \\\"Patient Registration\\\",\\n \\\"uiVersion\\\": \\\"1\\\",\\n \\\"version\\\": \\\"9\\\",\\n \\\"xmlns\\\": \\\"http://openrosa.org/formdesigner/2BCC3E88-2D0D-4C07-8D4A-6B372F3799D9\\\",\\n \\\"xmlns:jrm\\\": \\\"http://dev.commcarehq.org/jr/xforms\\\",\\n \\\"paitent_namentosh\\\": \\\"Taylor\\\",\\n \\\"question2\\\": \\\" Moruki\\\",\\n \\\"question3\\\": \\\"Hks\\\",\\n \\\"question4\\\": \\\"item1\\\",\\n \\\"question5\\\": \\\"69855\\\",\\n \\\"question6\\\": \\\"12\\\",\\n \\\"n0:meta\\\": {\\n \\\"xmlns:n0\\\": \\\"http://openrosa.org/jr/xforms\\\",\\n \\\"n0:deviceID\\\": \\\"358239055789384\\\",\\n \\\"n0:timeStart\\\": \\\"2015-08-21T16:21:59.807+02\\\",\\n \\\"n0:timeEnd\\\": \\\"2015-08-21T16:22:15.987+02\\\",\\n \\\"n0:username\\\": \\\"openfn\\\",\\n \\\"n0:userID\\\": \\\"5fe615b3af2834cb5dca59f7466d6174\\\",\\n \\\"n0:instanceID\\\": \\\"195e79eb-d823-46fe-9e4f-59b8327d5db2\\\",\\n \\\"n1:appVersion\\\": {\\n \\\"xmlns:n1\\\": \\\"http://commcarehq.org/xforms\\\",\\n \\\"$t\\\": \\\"CommCare ODK, version \\\\\\\"2.22.0\\\\\\\"(370023). App v9. CommCare Version 2.22. Build 370023, built on: July-22-2015\\\"\\n }\\n }\\n }\\n}\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-commcare\\n\\n## 1.6.10\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n - @openfn/language-http@5.0.4\\n\\n## 1.6.9\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n - @openfn/language-http@5.0.3\\n\\n## 1.6.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n - @openfn/language-http@5.0.2\\n\\n## 1.6.7\\n\\n### Patch Changes\\n\\n- 52c02c8: update xlsx package\\n\\n## 1.6.6\\n\\n### Patch Changes\\n\\n- 8205673: update superagent\\n\\n## 1.6.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n - @openfn/language-http@5.0.1\\n\\n## 1.6.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [0b6f20b]\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-http@5.0.0\\n - @openfn/language-common@1.10.1\\n\\n## 1.6.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n - @openfn/language-http@4.3.3\\n\\n## 1.6.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n - @openfn/language-http@4.3.2\\n\\n## 1.6.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n - @openfn/language-http@4.3.1\\n\\n## 1.6.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n - @openfn/language-http@4.3.0\\n\\n## 1.5.6\\n\\n### Patch Changes\\n\\n- e0406fa: update dependencies\\n\\n## 1.5.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n - @openfn/language-http@4.2.8\\n\\n## 1.5.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n- Updated dependencies [14f481e]\\n - @openfn/language-common@1.7.6\\n - @openfn/language-http@4.2.7\\n\\n## 1.5.3\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n- Updated dependencies [f2aed32]\\n - @openfn/language-http@4.2.5\\n\\n## 1.5.2\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n- 57f3513: Fix exports in index.js\\n- Updated dependencies [6d8de03]\\n - @openfn/language-http@4.2.4\\n\\n## 1.5.1\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n - @openfn/language-http@4.2.3\\n\\n## 1.5.0\\n\\n### Minor Changes\\n\\n- 5c050ed: Migrate CommCare\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- 94076b9: update dependency xlsx to ^0.18.0\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [9a2755e]\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-http@4.2.2\\n - @openfn/language-common@1.7.4\\n\"","functions":["fetchReportData","submit","submitXls"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"hostUrl":{"title":"Host URL","type":"string","description":"The CommCare host url","format":"uri","minLength":1,"examples":["https://www.commcarehq.org"]},"applicationName":{"title":"Application Name","type":"string","description":"The CommCare application name","minLength":1,"examples":["some-proof-of-concept"]},"appId":{"title":"App ID","type":"string","description":"Your CommCare project UUID","minLength":1,"examples":["the-long-uuid-in-the-url-that-designates-a-unique-commcare-project"]},"username":{"title":"Username","type":"string","description":"The username to log in to CommCare","minLength":1,"examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"The password to log in to CommCare","writeOnly":true,"minLength":1,"examples":["superscretepassword"]}},"type":"object","additionalProperties":true,"required":["hostUrl","applicationName","appId"]}}, +{"name":"common","adaptor":"@openfn/language-common","version":"1.12.0","docs":"\"## Functions\\n\\n
\\n
\\n alterState(func)
\\n
\\n arrayToString(arr, separator)
\\n
\\n asData(data, state)
\\n
\\n chunk(array, chunkSize)
\\n
\\n combine(operations)
\\n
\\n composeNextState(state, response)
\\n
\\n dataPath(path)
\\n
\\n dataValue(path)
\\n
\\n del(requestParams)
\\n
\\n each(dataSource, operation)
\\n
\\n each(dataSource, operation)
\\n
\\n expandReferences(value, [skipFilter])
\\n
\\n expandRequestReferences(value)
\\n
\\n field(key, value)
\\n
\\n fields(fields)
\\n
\\n fn(func)
\\n
\\n get(requestParams)
\\n
\\n head(requestParams)
\\n
\\n humanProper(str)
\\n
\\n index()
\\n
\\n join(targetPath, sourcePath, targetKey)
\\n
\\n jsonValue(obj, path)
\\n
\\n lastReferenceValue(path)
\\n
\\n map(path, operation, state)
\\n
\\n merge(dataSource, fields)
\\n
\\n options(requestParams)
\\n
\\n parseCsv(csvData, [parsingOptions], [callback])
\\n
\\n patch(requestParams)
\\n
\\n post(requestParams)
\\n
\\n put(requestParams)
\\n
\\n referencePath(path)
\\n
\\n request(method, fullUrlOrPath, [options])
\\n
\\n scrubEmojis(text, replacementChars)
\\n
\\n source(path)
\\n
\\n sourceValue(path)
\\n
\\n splitKeys(obj, keys)
\\n
\\n toArray(arg)
\\n
\\n validate(schema, data)
\\n
\\n withAgent(params)
\\n
\\n\\n\\n## alterState\\n\\nalterState(func) ⇒ Operation\\nalias for \\\"fn()\\\"\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| func | function | is the function |\\n\\n\\n* * *\\n\\n## arrayToString\\n\\narrayToString(arr, separator) ⇒ string\\nTurns an array into a string, separated by X.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| arr | array | Array of toString'able primatives. |\\n| separator | string | Separator string. |\\n\\n**Example** \\n```js\\nfield(\\\"destination_string__c\\\", function(state) {\\n return arrayToString(dataValue(\\\"path_of_array\\\")(state), ', ')\\n})\\n```\\n\\n* * *\\n\\n## asData\\n\\nasData(data, state) ⇒ array\\nSimple switcher allowing other expressions to use either a JSONPath or\\nobject literals as a data source.\\n- JSONPath referencing a point in `state`\\n- Object Literal of the data itself.\\n- Function to be called with state.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | String \\\\| object \\\\| function | |\\n| state | object | The current state. |\\n\\n**Example** \\n```js\\nasData('$.key'| key | callback)\\n```\\n\\n* * *\\n\\n## chunk\\n\\nchunk(array, chunkSize) ⇒ Object\\nChunks an array into an array of arrays, each with no more than a certain size.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| array | Object | Array to be chunked |\\n| chunkSize | Integer | The maxiumum size of each chunks |\\n\\n**Example** \\n```js\\nchunk([1,2,3,4,5], 2)\\n```\\n\\n* * *\\n\\n## combine\\n\\ncombine(operations) ⇒ Operation\\nCombines two operations into one\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| operations | Operations | Operations to be performed. |\\n\\n**Example** \\n```js\\ncombine(\\n create('foo'),\\n delete('bar')\\n)\\n```\\n\\n* * *\\n\\n## composeNextState\\n\\ncomposeNextState(state, response) ⇒ State\\nPrepares next state\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | state |\\n| response | Object | Response to be added |\\n\\n**Example** \\n```js\\ncomposeNextState(state, response)\\n```\\n\\n* * *\\n\\n## dataPath\\n\\ndataPath(path) ⇒ string\\nEnsures a path points at the data.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | JSONPath referencing a point in `data`. |\\n\\n**Example** \\n```js\\ndataPath('key')\\n```\\n\\n* * *\\n\\n## dataValue\\n\\ndataValue(path) ⇒ Operation\\nPicks out a single value from the source data object—usually `state.data`.\\nIf a JSONPath returns more than one value for the reference, the first\\nitem will be returned.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | String | JSONPath referencing a point in `data`. |\\n\\n**Example** \\n```js\\ndataValue('key')\\n```\\n\\n* * *\\n\\n## del\\n\\ndel(requestParams) ⇒ Operation\\nMake a DELETE request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Deleting a record with data that comes from state)* \\n```js\\ndelete({\\n url: state => `https://www.example.com/api/items/${state.id}`,\\n })(state);\\n```\\n\\n* * *\\n\\n## each\\n\\neach(dataSource, operation) ⇒ Operation\\nScopes 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.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| dataSource | DataSource | JSONPath referencing a point in `state`. |\\n| operation | Operation | The operation needed to be repeated. |\\n\\n**Example** \\n```js\\neach(\\\"$.[*]\\\",\\n create(\\\"SObject\\\",\\n field(\\\"FirstName\\\", sourceValue(\\\"$.firstName\\\"))\\n )\\n)\\n```\\n\\n* * *\\n\\n## each\\n\\neach(dataSource, operation) ⇒ Operation\\nScopes 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.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| dataSource | DataSource | JSONPath referencing a point in `state`. |\\n| operation | Operation | The operation needed to be repeated. |\\n\\n**Example** \\n```js\\neach(\\\"$.[*]\\\",\\n create(\\\"SObject\\\",\\n field(\\\"FirstName\\\", sourceValue(\\\"$.firstName\\\")))\\n )\\n```\\n\\n* * *\\n\\n## expandReferences\\n\\nexpandReferences(value, [skipFilter]) ⇒ Operation\\nRecursively resolves objects that have resolvable values (functions).\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| value | object | data |\\n| [skipFilter] | function | a function which returns true if a value should be skipped |\\n\\n\\n* * *\\n\\n## expandRequestReferences\\n\\nexpandRequestReferences(value) ⇒ Operation\\nRecursively resolves objects that have resolvable values (functions), but\\nomits HTTP request specific modules like `FormData`.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| value | object | data |\\n\\n\\n* * *\\n\\n## field\\n\\nfield(key, value) ⇒ Field\\nReturns a key, value pair in an array.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| key | string | Name of the field |\\n| value | Value | The value itself or a sourceable operation. |\\n\\n**Example** \\n```js\\nfield('destination_field_name__c', 'value')\\n```\\n\\n* * *\\n\\n## fields\\n\\nfields(fields) ⇒ Object\\nZips key value pairs into an object.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| fields | Fields | a list of fields |\\n\\n**Example** \\n```js\\nfields(list_of_fields)\\n```\\n\\n* * *\\n\\n## fn\\n\\nfn(func) ⇒ Operation\\nCreates a custom step (or operation) for more flexible job writing.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| func | function | is the function |\\n\\n**Example** \\n```js\\nfn(state => {\\n // do some things to state\\n return state;\\n});\\n```\\n\\n* * *\\n\\n## get\\n\\nget(requestParams) ⇒ Operation\\nMake a GET request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Get an item with a specified id from state)* \\n```js\\n get({\\n url: state => `https://www.example.com/api/items/${state.id},\\n headers: {\\\"content-type\\\": \\\"application/json\\\"}\\n});\\n```\\n\\n* * *\\n\\n## head\\n\\nhead(requestParams) ⇒ Operation\\nMake a HEAD request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Gets the headers that would be returned if the HEAD request's URL was instead requested with the HTTP GET method)* \\n```js\\nhead({\\n url: 'https://www.example.com/api/items',\\n});\\n```\\n\\n* * *\\n\\n## humanProper\\n\\nhumanProper(str) ⇒ string\\nSubstitutes underscores for spaces and proper-cases a string\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| str | string | String that needs converting |\\n\\n**Example** \\n```js\\nfield(\\\"destination_string__c\\\", humanProper(state.data.path_to_string))\\n```\\n\\n* * *\\n\\n## index\\n\\nindex() ⇒ DataSource\\nReturns the index of the current array being iterated.\\nTo be used with `each` as a data source.\\n\\n**Kind**: global function \\n**Access**: public \\n**Example** \\n```js\\nindex()\\n```\\n\\n* * *\\n\\n## join\\n\\njoin(targetPath, sourcePath, targetKey) ⇒ Operation\\nAdds data from a target object\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| targetPath | String | Target path |\\n| sourcePath | String | Source path |\\n| targetKey | String | Target Key |\\n\\n**Example** \\n```js\\njoin('$.key','$.data','newKey')\\n```\\n\\n* * *\\n\\n## jsonValue\\n\\njsonValue(obj, path) ⇒ Operation\\nPicks out a single value from a JSON object.\\nIf a JSONPath returns more than one value for the reference, the first\\nitem will be returned.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| obj | object | A valid JSON object. |\\n| path | String | JSONPath referencing a point in given JSON object. |\\n\\n**Example** \\n```js\\njsonValue({ a:1 }, 'a')\\n```\\n\\n* * *\\n\\n## lastReferenceValue\\n\\nlastReferenceValue(path) ⇒ Operation\\nPicks out the last reference value from source data.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | String | JSONPath referencing a point in `references`. |\\n\\n**Example** \\n```js\\nlastReferenceValue('key')\\n```\\n\\n* * *\\n\\n## map\\n\\nmap(path, operation, state) ⇒ State\\nScopes 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\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | JSONPath referencing a point in `state.data`. |\\n| operation | function | The operation needed to be repeated. |\\n| state | State | Runtime state. |\\n\\n**Example** \\n```js\\nmap(\\\"$.[*]\\\",\\n create(\\\"SObject\\\",\\n field(\\\"FirstName\\\", sourceValue(\\\"$.firstName\\\"))\\n )\\n)\\n```\\n\\n* * *\\n\\n## merge\\n\\nmerge(dataSource, fields) ⇒ DataSource\\nMerges fields into each item in an array.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| dataSource | DataSource | |\\n| fields | Object | Group of fields to merge in. |\\n\\n**Example** \\n```js\\nmerge(\\n \\\"$.books[*]\\\",\\n fields(\\n field( \\\"publisher\\\", sourceValue(\\\"$.publisher\\\") )\\n )\\n)\\n```\\n\\n* * *\\n\\n## options\\n\\noptions(requestParams) ⇒ Operation\\nMake a OPTIONS request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Requests permitted communication options for a given URL or server, with data from state.)* \\n```js\\noptions({\\n url: 'https://www.example.com/api/items',\\n});\\n```\\n\\n* * *\\n\\n## parseCsv\\n\\nparseCsv(csvData, [parsingOptions], [callback]) ⇒ Operation\\nTakes a CSV file string or stream and parsing options as input, and returns a promise that\\nresolves to the parsed CSV data as an array of objects.\\nOptions for `parsingOptions` include:\\n- `delimiter` {string/Buffer/[string/Buffer]} - Defines the character(s) used to delineate the fields inside a record. Default: `','`\\n- `quote` {string/Buffer/[string/Buffer]} - Defines the characters used to surround a field. Default: `'\\\"'`\\n- `escape` {Buffer/string/null/boolean} - Set the escape character as one character/byte only. Default: `\\\"`\\n- `columns` {boolean / array / function} - Generates record in the form of object literals. Default: `true`\\n- `bom` {boolean} - Strips the [byte order mark (BOM)](https://en.wikipedia.org/wiki/Byte_order_mark) from the input string or buffer. Default: `true`\\n- `trim` {boolean} - Ignore whitespace characters immediately around the `delimiter`. Default: `true`\\n- `ltrim` {boolean} - Ignore whitespace characters from the left side of a CSV field. Default: `true`\\n- `rtrim` {boolean} - Ignore whitespace characters from the right side of a CSV field. Default: `true`\\n- `chunkSize` {number} - The size of each chunk of CSV data. Default: `Infinity`\\n- `skip_empty_lines` {boolean} - Ignore empty lines in the CSV file. Default: `true`\\n\\n**Kind**: global function \\n**Returns**: Operation - The function returns a Promise that resolves to the result of parsing a CSV `stringOrStream`. \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| csvData | String \\\\| Stream | A CSV string or a readable stream |\\n| [parsingOptions] | Object | Optional. Parsing options for converting CSV to JSON. |\\n| [callback] | function | (Optional) callback function. If used it will be called state and an array of rows. |\\n\\n\\n* * *\\n\\n## patch\\n\\npatch(requestParams) ⇒ Operation\\nMake a PATCH request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Applies partial modifications to a resource, with data from state.)* \\n```js\\npatch({\\n url: state => `https://www.example.com/api/items/${state.id}`,\\n data: state => state.data\\n});\\n```\\n\\n* * *\\n\\n## post\\n\\npost(requestParams) ⇒ Operation\\nMake a POST request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Sending a payload with data that comes from state)* \\n```js\\npost({\\n url: \\\"https://example.com\\\",\\n data: (state) => state.data\\n});\\n```\\n**Example** *( Capturing the response for later use in state )* \\n```js\\nalterState((state) => {\\n return post({\\n url: \\\"https://example.com\\\",\\n data: (state) => state.data\\n })(state).then(({response}) => {\\n state.responseData = response.data\\n })\\n});\\n```\\n\\n* * *\\n\\n## put\\n\\nput(requestParams) ⇒ Operation\\nMake a PUT request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Creates a new resource or replaces a representation of the target resource with the request payload, with data from state.)* \\n```js\\nput({\\n url: state => `https://www.example.com/api/items/${state.id}`,\\n data: state => state.data\\n});\\n```\\n\\n* * *\\n\\n## referencePath\\n\\nreferencePath(path) ⇒ string\\nEnsures a path points at references.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | JSONPath referencing a point in `references`. |\\n\\n**Example** \\n```js\\nreferencePath('key')\\n```\\n\\n* * *\\n\\n## request\\n\\nrequest(method, fullUrlOrPath, [options]) ⇒\\n`request` is a helper function that sends HTTP requests and returns the response\\nbody, headers, and status code.\\nUse the error map to provide custom error messages or get hold of the response in case of errors.\\n\\n**Kind**: global function \\n**Returns**: an object with the following properties:\\n- method: the request method\\n- url: the request url\\n- code: the status code of the response\\n- headers: the headers of the response\\n- body: the body of the response\\n- message: the status text of the response\\n- duration: the response time \\n\\n| Param | Description |\\n| --- | --- |\\n| method | The HTTP method to use for the request (e.g., \\\"GET\\\", \\\"POST\\\", \\\"PUT\\\", \\\"DELETE\\\", etc.). |\\n| fullUrlOrPath | The full or partial URL for the request. |\\n| [options] | The `options` parameter is an object that contains additional configuration options for the request. |\\n\\n\\n* * *\\n\\n## scrubEmojis\\n\\nscrubEmojis(text, replacementChars) ⇒ string\\nReplaces emojis in a string.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| text | string | String that needs to be cleaned |\\n| replacementChars | string | Characters that replace the emojis |\\n\\n**Example** \\n```js\\nscrubEmojis('Dove🕊️⭐ 29')\\n```\\n\\n* * *\\n\\n## source\\n\\nsource(path) ⇒ Array.<(String\\\\|Object)>\\nPicks out a value from source data.\\nWill return whatever JSONPath returns, which will always be an array.\\nIf you need a single value use `sourceValue` instead.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | String | JSONPath referencing a point in `state`. |\\n\\n**Example** \\n```js\\nsource('$.key')\\n```\\n\\n* * *\\n\\n## sourceValue\\n\\nsourceValue(path) ⇒ Operation\\nPicks out a single value from source data.\\nIf a JSONPath returns more than one value for the reference, the first\\nitem will be returned.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | String | JSONPath referencing a point in `state`. |\\n\\n**Example** \\n```js\\nsourceValue('$.key')\\n```\\n\\n* * *\\n\\n## splitKeys\\n\\nsplitKeys(obj, keys) ⇒ Array.<Object>\\nSplits an object into two objects based on a list of keys.\\nThe first object contains the keys that are not in the list,\\nand the second contains the keys that are.\\n\\n**Kind**: global function \\n**Returns**: Array.<Object> - - Tuple of objects, first object contains keys not in list, second contains keys that are. \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| obj | Object | The object to split. |\\n| keys | Array.<string> | List of keys to split on. |\\n\\n\\n* * *\\n\\n## toArray\\n\\ntoArray(arg) ⇒ array\\nEnsures primitive data types are wrapped in an array.\\nDoes not affect array objects.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| arg | any | Data required to be in an array |\\n\\n**Example** \\n```js\\neach(function(state) {\\n return toArray( dataValue(\\\"path_of_array\\\")(state) )\\n}, ...)\\n```\\n\\n* * *\\n\\n## validate\\n\\nvalidate(schema, data) ⇒ Operation\\nValidate against a JSON schema. Any erors 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`.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| schema | string \\\\| object | The schema, path or URL to validate against |\\n| data | string \\\\| object | The data or path to validate |\\n\\n**Example** *(Validate `state.data` with `state.schema`)* \\n```js\\nvalidate()\\n```\\n**Example** *(Validate form data at `state.form` with a schema from a URL)* \\n```js\\nvalidate(\\\"https://www.example.com/schema/record\\\", \\\"form\\\")\\n```\\n**Example** *(Validate the each item in `state.records` with a schema from a URL)* \\n```js\\neach(\\\"records[*]\\\", validate(\\\"https://www.example.com/schema/record\\\"))\\n```\\n\\n* * *\\n\\n## withAgent\\n\\nwithAgent(params) ⇒ Operation\\nCreates an https agent for axios from the agentOptions key passed in params.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data |\\n\\n\\n* * *\\n\\n\"","readme":"\"# Language Common [![CircleCI](https://circleci.com/gh/OpenFn/language-common.svg?style=svg)](https://circleci.com/gh/OpenFn/language-common)\\n\\nCommon and generic expressions and operations for [OpenFn](http://openfn.org).\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"v0.4.0\\n\\n## 1.12.0\\n\\n### Minor Changes\\n\\n- 7f52699: New HTTP helper functions have been added to common in\\n `src/util/http.js`\\n\\n These are based on the `undici` library. They are functions, not operations,\\n so they do not get and return state, and do not expand references.\\n\\n They are designed to be used by other adaptors to make HTTP requests easier.\\n\\n ## Usage\\n\\n ```\\n // Import the helper function\\n import { get } from '@openfn/language-common/util'\\n\\n // This is an example operation\\n export function get(id, callback) {\\n return async (state) => {\\n const [resolvedId] = expandReferences(\\n state,\\n id,\\n );\\n\\n // Call the new common helper to fetch some json\\n const response = await get(`www.example.com/resource/{$resolvedId}`, { parseAs: 'json' });\\n\\n // Return the response body as data, and also include the response object as a convenience\\n return {\\n ...state,\\n response,\\n data: response.body\\n }\\n }\\n }\\n ```\\n\\n See the http adaptor for a reference implementation.\\n\\n ## Deprecation notice\\n\\n The existing http operations in `src/http.js` have been deprecated, and\\n adaptors should migrate to the new helpers.\\n\\n## 1.11.1\\n\\n### Patch Changes\\n\\n- c19efbe: don't attempt to expand references for a buffer\\n\\n## 1.11.0\\n\\n### Minor Changes\\n\\n- 85c35b8: Add validate function to validate data against a JSON schema\\n\\n## 1.10.3\\n\\n### Patch Changes\\n\\n- df09270: Fix streaming interface to parseCSV\\n\\n## 1.10.2\\n\\n### Patch Changes\\n\\n- 26a303e: add expandReferences for csvData and parsingOptions\\n\\n## 1.10.1\\n\\n### Patch Changes\\n\\n- 8c32eb3: - update parseCsv to await callback\\n - Added documentation for splitKeys\\n\\n## 1.10.0\\n\\n### Minor Changes\\n\\n- aad9549: Ensure that standard OAuth2 credentials with snake-cased\\n \\\"access_token\\\" keys can be used for OAuth2-reliant adaptors\\n\\n## 1.9.0\\n\\n### Minor Changes\\n\\n- 111807f: Add support for `parseCsv` in common\\n\\n## 1.8.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n\\n## 1.8.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n## 1.7.7\\n\\n### Patch Changes\\n\\n- 929bca6: Export metadata helper function\\n\\n## 1.7.6\\n\\n### Patch Changes\\n\\n- 2b4c61a: mark execute private and ast build\\n\\n## 1.7.5\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n\\n## 1.7.4\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- b5eb665: Adjusted docs for common and built to markdown\\n- # ecf5d30: remove sinon since it was not being used\\n\\nBumped all package versions to their latest.\\n\\n# v0.0.4\\n\\n- Added `arrayToString` helper. \\n Allowing you to join an array of string'able primitives (strings and integers)\\n into a string.\\n- Added `toArray` helper. \\n This can be used to coerce certain types of data into an array, this can be\\n useful when the source data has an ambiguous format. For example a given key\\n in the data may have an object as it's value (when there is only one item),\\n and an array of objects when there is more than one. `toArray` can be used to\\n reconcile this inconsistency.\\n\"","functions":["arrayToString","asData","chunk","combine","composeNextState","dataPath","dataValue","each","execute","expandReferences","field","fields","fn","humanProper","index","join","jsonValue","lastReferenceValue","map","merge","parseCsv","referencePath","scrubEmojis","source","sourceValue","splitKeys","toArray"],"configuration-schema":"No Configuration Schema"}, +{"name":"dhis2","adaptor":"@openfn/language-dhis2","version":"4.0.3","docs":"\"## Functions\\n\\n
\\n
\\n attr(attribute, value)
\\n
\\n configMigrationHelper(state)
\\n
\\n create(resourceType, data, [options], [callback])
\\n
\\n destroy(resourceType, path, [data], [options], [callback])
\\n
\\n discover(httpMethod, endpoint)
\\n
\\n dv(dataElement, value)
\\n
\\n findAttributeValue(trackedEntityInstance, attributeDisplayName)
\\n
\\n get(resourceType, query, [options], [callback])
\\n
\\n patch(resourceType, path, data, [options], [callback])
\\n
\\n request(configuration, axiosRequest)
\\n
\\n selectId(resourceType)
\\n
\\n update(resourceType, path, data, [options], [callback])
\\n
\\n upsert(resourceType, query, data, [options], [callback])
\\n
\\n\\n\\n## attr\\n\\nattr(attribute, value) ⇒ object\\nConverts an attribute ID and value into a DSHI2 attribute object\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| attribute | string | A tracked entity instance (TEI) attribute ID. |\\n| value | string | The value for that attribute. |\\n\\n**Example** \\n```js\\nattr('w75KJ2mc4zz', 'Elias')\\n```\\n\\n* * *\\n\\n## configMigrationHelper\\n\\nconfigMigrationHelper(state) ⇒ object\\nMigrates `apiUrl` to `hostUrl` if `hostUrl` is `blank`.\\nFor `OpenFn.org` users with the `old-style configuration`.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | object | the runtime state |\\n\\n**Example** \\n```js\\nconfigMigrationHelper(state)\\n```\\n\\n* * *\\n\\n## create\\n\\ncreate(resourceType, data, [options], [callback]) ⇒ Operation\\nCreate a record\\n\\n**Kind**: global function \\n**Access**: public \\n**Magic**: resourceType $.children.resourceTypes[*] \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | Type of resource to create. E.g. `trackedEntityInstances`, `programs`, `events`, ... |\\n| data | Dhis2Data | Object which defines data that will be used to create a given instance of resource. To create a single instance of a resource, `data` must be a javascript object, and to create multiple instances of a resources, `data` must be an array of javascript objects. |\\n| [options] | Object | Optional `options` to define URL parameters via params (E.g. `filter`, `dimension` and other import parameters), request config (E.g. `auth`) and the DHIS2 apiVersion. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(a program)* \\n```js\\ncreate('programs', {\\n name: 'name 20',\\n shortName: 'n20',\\n programType: 'WITHOUT_REGISTRATION',\\n});\\n```\\n**Example** *(an event)* \\n```js\\ncreate('events', {\\n program: 'eBAyeGv0exc',\\n orgUnit: 'DiszpKrYNg8',\\n status: 'COMPLETED',\\n});\\n```\\n**Example** *(a trackedEntityInstance)* \\n```js\\ncreate('trackedEntityInstances', {\\n orgUnit: 'TSyzvBiovKh',\\n trackedEntityType: 'nEenWmSyUEp',\\n attributes: [\\n {\\n attribute: 'w75KJ2mc4zz',\\n value: 'Gigiwe',\\n },\\n ]\\n});\\n```\\n**Example** *(a dataSet)* \\n```js\\ncreate('dataSets', { name: 'OpenFn Data Set', periodType: 'Monthly' });\\n```\\n**Example** *(a dataSetNotification)* \\n```js\\ncreate('dataSetNotificationTemplates', {\\n dataSetNotificationTrigger: 'DATA_SET_COMPLETION',\\n notificationRecipient: 'ORGANISATION_UNIT_CONTACT',\\n name: 'Notification',\\n messageTemplate: 'Hello',\\n deliveryChannels: ['SMS'],\\n dataSets: [],\\n});\\n```\\n**Example** *(a dataElement)* \\n```js\\ncreate('dataElements', {\\n aggregationType: 'SUM',\\n domainType: 'AGGREGATE',\\n valueType: 'NUMBER',\\n name: 'Paracetamol',\\n shortName: 'Para',\\n});\\n```\\n**Example** *(a dataElementGroup)* \\n```js\\ncreate('dataElementGroups', {\\n name: 'Data Element Group 1',\\n dataElements: [],\\n});\\n```\\n**Example** *(a dataElementGroupSet)* \\n```js\\ncreate('dataElementGroupSets', {\\n name: 'Data Element Group Set 4',\\n dataDimension: true,\\n shortName: 'DEGS4',\\n dataElementGroups: [],\\n});\\n```\\n**Example** *(a dataValueSet)* \\n```js\\ncreate('dataValueSets', {\\n dataElement: 'f7n9E0hX8qk',\\n period: '201401',\\n orgUnit: 'DiszpKrYNg8',\\n value: '12',\\n});\\n```\\n**Example** *(a dataValueSet with related dataValues)* \\n```js\\ncreate('dataValueSets', {\\n dataSet: 'pBOMPrpg1QX',\\n completeDate: '2014-02-03',\\n period: '201401',\\n orgUnit: 'DiszpKrYNg8',\\n dataValues: [\\n {\\n dataElement: 'f7n9E0hX8qk',\\n value: '1',\\n },\\n {\\n dataElement: 'Ix2HsbDMLea',\\n value: '2',\\n },\\n {\\n dataElement: 'eY5ehpbEsB7',\\n value: '3',\\n },\\n ],\\n});\\n```\\n**Example** *(an enrollment)* \\n```js\\ncreate('enrollments', {\\n trackedEntityInstance: 'bmshzEacgxa',\\n orgUnit: 'TSyzvBiovKh',\\n program: 'gZBxv9Ujxg0',\\n enrollmentDate: '2013-09-17',\\n incidentDate: '2013-09-17',\\n});\\n```\\n\\n* * *\\n\\n## destroy\\n\\ndestroy(resourceType, path, [data], [options], [callback]) ⇒ Operation\\nDelete a record. A generic helper function to delete an object\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of resource to be deleted. E.g. `trackedEntityInstances`, `organisationUnits`, etc. |\\n| path | string | Can be an `id` of an `object` or `path` to the `nested object` to `delete`. |\\n| [data] | Object | Optional. This is useful when you want to remove multiple objects from a collection in one request. You can send `data` as, for example, `{\\\"identifiableObjects\\\": [{\\\"id\\\": \\\"IDA\\\"}, {\\\"id\\\": \\\"IDB\\\"}, {\\\"id\\\": \\\"IDC\\\"}]}`. See more [on DHIS2 API docs](https://docs.dhis2.org/2.34/en/dhis2_developer_manual/web-api.html#deleting-objects) |\\n| [options] | Object | Optional `options` for `del` operation including params e.g. `{preheatCache: true, strategy: 'UPDATE', mergeMode: 'REPLACE'}`. Run `discover` or see [DHIS2 documentation](https://docs.dhis2.org/2.34/en/dhis2_developer_manual/web-api.html#create-update-parameters). Defaults to `{operationName: 'delete', apiVersion: state.configuration.apiVersion, responseType: 'json'}` |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(a tracked entity instance)* \\n```js\\ndestroy('trackedEntityInstances', 'LcRd6Nyaq7T');\\n```\\n\\n* * *\\n\\n## discover\\n\\ndiscover(httpMethod, endpoint) ⇒ Operation\\nDiscover `DHIS2` `api` `endpoint` `query parameters` and allowed `operators` for a given resource's endpoint.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| httpMethod | string | The HTTP to inspect parameter usage for a given endpoint, e.g., `get`, `post`,`put`,`patch`,`delete` |\\n| endpoint | string | The path for a given endpoint. E.g. `/trackedEntityInstances` or `/dataValueSets` |\\n\\n**Example** *(a list of parameters allowed on a given endpoint for specific http method)* \\n```js\\ndiscover('post', '/trackedEntityInstances')\\n```\\n\\n* * *\\n\\n## dv\\n\\ndv(dataElement, value) ⇒ object\\nConverts a dataElement and value into a DSHI2 dataValue object\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| dataElement | string | A data element ID. |\\n| value | string | The value for that data element. |\\n\\n**Example** \\n```js\\ndv('f7n9E0hX8qk', 12)\\n```\\n\\n* * *\\n\\n## findAttributeValue\\n\\nfindAttributeValue(trackedEntityInstance, attributeDisplayName) ⇒ string\\nGets an attribute value by its case-insensitive display name\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| trackedEntityInstance | Object | A tracked entity instance (TEI) object |\\n| attributeDisplayName | string | The 'displayName' to search for in the TEI's attributes |\\n\\n**Example** \\n```js\\nfindAttributeValue(state.data.trackedEntityInstances[0], 'first name')\\n```\\n\\n* * *\\n\\n## get\\n\\nget(resourceType, query, [options], [callback]) ⇒ Operation\\nGet data. Generic helper method for getting data of any kind from DHIS2.\\n- This can be used to get `DataValueSets`,`events`,`trackedEntityInstances`,`etc.`\\n\\n**Kind**: global function \\n**Returns**: Operation - state \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of resource to get(use its `plural` name). E.g. `dataElements`, `trackedEntityInstances`,`organisationUnits`, etc. |\\n| query | Object | A query object that will limit what resources are retrieved when converted into request params. |\\n| [options] | Object | Optional `options` to define URL parameters via params beyond filters, request configuration (e.g. `auth`) and DHIS2 api version to use. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(all data values for the 'pBOMPrpg1QX' dataset)* \\n```js\\nget('dataValueSets', {\\n dataSet: 'pBOMPrpg1QX',\\n orgUnit: 'DiszpKrYNg8',\\n period: '201401',\\n fields: '*',\\n});\\n```\\n**Example** *(all programs for an organization unit)* \\n```js\\nget('programs', { orgUnit: 'TSyzvBiovKh', fields: '*' });\\n```\\n**Example** *(a single tracked entity instance by a unique external ID)* \\n```js\\nget('trackedEntityInstances', {\\n ou: 'DiszpKrYNg8',\\n filter: ['flGbXLXCrEo:Eq:124', 'w75KJ2mc4zz:Eq:John'],\\n});\\n```\\n\\n* * *\\n\\n## patch\\n\\npatch(resourceType, path, data, [options], [callback]) ⇒ Operation\\nPatch a record. A generic helper function to send partial updates on one or more object properties.\\n- You are not required to send the full body of object properties.\\n- This is useful for cases where you don't want or need to update all properties on a object.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc. |\\n| path | string | The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}` |\\n| data | Object | Data to update. Include only the fields you want to update. E.g. `{name: \\\"New Name\\\"}` |\\n| [options] | Object | Optional configuration, including params for the update ({preheatCache: true, strategy: 'UPDATE', mergeMode: 'REPLACE'}). Defaults to `{operationName: 'patch', apiVersion: state.configuration.apiVersion, responseType: 'json'}` |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(a dataElement)* \\n```js\\npatch('dataElements', 'FTRrcoaog83', { name: 'New Name' });\\n```\\n\\n* * *\\n\\n## request\\n\\nrequest(configuration, axiosRequest) ⇒ Promise\\nThe request client takes configuration from state and an axios request object\\nthen (1) logs the method and URL, (2) applies standard headers and auth\\nbefore spreading the rest of the axios configuration, and (3) executes an\\naxios request.\\n\\n**Kind**: global function \\n**Returns**: Promise - a promise that will resolve to either a response object or an error object. \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| configuration | object | configuration must have a username and password |\\n| axiosRequest | object | the axiosRequest contains valid axios params: https://axios-http.com/docs/req_config |\\n\\n\\n* * *\\n\\n## selectId\\n\\nselectId(resourceType) ⇒ string\\nDetermines the attribute name for a DHIS2 system ID given a resource type.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| resourceType | string | \\n\\n\\n* * *\\n\\n## update\\n\\nupdate(resourceType, path, data, [options], [callback]) ⇒ Operation\\nUpdate data. A generic helper function to update a resource object of any type.\\nUpdating an object requires to send `all required fields` or the `full body`\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc. |\\n| path | string | The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}` |\\n| data | Object | Data to update. It requires to send `all required fields` or the `full body`. If you want `partial updates`, use `patch` operation. |\\n| [options] | Object | Optional `options` to define URL parameters via params (E.g. `filter`, `dimension` and other import parameters), request config (E.g. `auth`) and the DHIS2 apiVersion. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(a program)* \\n```js\\nupdate('programs', 'qAZJCrNJK8H', {\\n name: '14e1aa02c3f0a31618e096f2c6d03bed',\\n shortName: '14e1aa02',\\n programType: 'WITHOUT_REGISTRATION',\\n});\\n```\\n**Example** *(an event)* \\n```js\\nupdate('events', 'PVqUD2hvU4E', {\\n program: 'eBAyeGv0exc',\\n orgUnit: 'Ngelehun CHC',\\n status: 'COMPLETED',\\n storedBy: 'admin',\\n dataValues: [],\\n});\\n```\\n**Example** *(a trackedEntityInstance)* \\n```js\\nupdate('trackedEntityInstances', 'IeQfgUtGPq2', {\\n created: '2015-08-06T21:12:37.256',\\n orgUnit: 'TSyzvBiovKh',\\n createdAtClient: '2015-08-06T21:12:37.256',\\n trackedEntityInstance: 'IeQfgUtGPq2',\\n lastUpdated: '2015-08-06T21:12:37.257',\\n trackedEntityType: 'nEenWmSyUEp',\\n inactive: false,\\n deleted: false,\\n featureType: 'NONE',\\n programOwners: [\\n {\\n ownerOrgUnit: 'TSyzvBiovKh',\\n program: 'IpHINAT79UW',\\n trackedEntityInstance: 'IeQfgUtGPq2',\\n },\\n ],\\n enrollments: [],\\n relationships: [],\\n attributes: [\\n {\\n lastUpdated: '2016-01-12T00:00:00.000',\\n displayName: 'Last name',\\n created: '2016-01-12T00:00:00.000',\\n valueType: 'TEXT',\\n attribute: 'zDhUuAYrxNC',\\n value: 'Russell',\\n },\\n {\\n lastUpdated: '2016-01-12T00:00:00.000',\\n code: 'MMD_PER_NAM',\\n displayName: 'First name',\\n created: '2016-01-12T00:00:00.000',\\n valueType: 'TEXT',\\n attribute: 'w75KJ2mc4zz',\\n value: 'Catherine',\\n },\\n ],\\n});\\n```\\n**Example** *(a dataSet)* \\n```js\\nupdate('dataSets', 'lyLU2wR22tC', { name: 'OpenFN Data Set', periodType: 'Weekly' });\\n```\\n**Example** *(a dataSetNotification)* \\n```js\\nupdate('dataSetNotificationTemplates', 'VbQBwdm1wVP', {\\n dataSetNotificationTrigger: 'DATA_SET_COMPLETION',\\n notificationRecipient: 'ORGANISATION_UNIT_CONTACT',\\n name: 'Notification',\\n messageTemplate: 'Hello Updated,\\n deliveryChannels: ['SMS'],\\n dataSets: [],\\n});\\n```\\n**Example** *(a dataElement)* \\n```js\\nupdate('dataElements', 'FTRrcoaog83', {\\n aggregationType: 'SUM',\\n domainType: 'AGGREGATE',\\n valueType: 'NUMBER',\\n name: 'Paracetamol',\\n shortName: 'Para',\\n});\\n```\\n**Example** *(a dataElementGroup)* \\n```js\\nupdate('dataElementGroups', 'QrprHT61XFk', {\\n name: 'Data Element Group 1',\\n dataElements: [],\\n});\\n```\\n**Example** *(a dataElementGroupSet)* \\n```js\\nupdate('dataElementGroupSets', 'VxWloRvAze8', {\\n name: 'Data Element Group Set 4',\\n dataDimension: true,\\n shortName: 'DEGS4',\\n dataElementGroups: [],\\n});\\n```\\n**Example** *(a dataValueSet)* \\n```js\\nupdate('dataValueSets', 'AsQj6cDsUq4', {\\n dataElement: 'f7n9E0hX8qk',\\n period: '201401',\\n orgUnit: 'DiszpKrYNg8',\\n value: '12',\\n});\\n```\\n**Example** *(a dataValueSet with related dataValues)* \\n```js\\nupdate('dataValueSets', 'Ix2HsbDMLea', {\\n dataSet: 'pBOMPrpg1QX',\\n completeDate: '2014-02-03',\\n period: '201401',\\n orgUnit: 'DiszpKrYNg8',\\n dataValues: [\\n {\\n dataElement: 'f7n9E0hX8qk',\\n value: '1',\\n },\\n {\\n dataElement: 'Ix2HsbDMLea',\\n value: '2',\\n },\\n {\\n dataElement: 'eY5ehpbEsB7',\\n value: '3',\\n },\\n ],\\n});\\n```\\n**Example** *(a single enrollment)* \\n```js\\nupdate('enrollments', 'CmsHzercTBa' {\\n trackedEntityInstance: 'bmshzEacgxa',\\n orgUnit: 'TSyzvBiovKh',\\n program: 'gZBxv9Ujxg0',\\n enrollmentDate: '2013-10-17',\\n incidentDate: '2013-10-17',\\n});\\n```\\n\\n* * *\\n\\n## upsert\\n\\nupsert(resourceType, query, data, [options], [callback]) ⇒ Operation\\nUpsert a record. A generic helper function used to atomically either insert a row, or on the basis of the row already existing, UPDATE that existing row instead.\\n\\n**Kind**: global function \\n**Throws**:\\n\\n- RangeError - Throws range error\\n\\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of a resource to `upsert`. E.g. `trackedEntityInstances` |\\n| query | Object | A query object that allows to uniquely identify the resource to update. If no matches found, then the resource will be created. |\\n| data | Object | The data to use for update or create depending on the result of the query. |\\n| [options] | Object | Optional configuration that will be applied to both the `get` and the `create` or `update` operations. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(Example `expression.js` of upsert)* \\n```js\\nupsert('trackedEntityInstances', {\\n ou: 'TSyzvBiovKh',\\n filter: ['w75KJ2mc4zz:Eq:Qassim'],\\n}, {\\n orgUnit: 'TSyzvBiovKh',\\n trackedEntityType: 'nEenWmSyUEp',\\n attributes: [\\n {\\n attribute: 'w75KJ2mc4zz',\\n value: 'Qassim',\\n },\\n ],\\n});\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language DHIS2\\n\\nAn OpenFn language Pack for building expressions and operations for working with\\nthe\\n[DHIS2 API](http://dhis2.github.io/dhis2-docs/master/en/developer/html/dhis2_developer_manual.html).\\nUsed most commonly via OpenFn.org or by hand with\\n[OpenFn/core](https://github.com/OpenFn/core) from the root of this repo:\\n\\n```sh\\ncore execute \\\\\\n -l ../language-dhis2 \\\\\\n -e ./tmp/expression.js \\\\\\n -s ./tmp/state.json \\\\\\n -o ./tmp/output.json\\n```\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/dhis2-docs) for\\nfull technical documentation.\\n\\nThere are lots of **examples** for how to use the various helper functions on\\nthe main\\n[Adaptor docs](https://docs.openfn.org/adaptors/packages/dhis2-docs#modules)\\npage.\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/dhis2-configuration-schema/)\\ndefinition.\\n\\n## Development\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`. (NB: that this repo\\nalso contain integration tests which can be run with\\n`pnpm run integration-test`.)\\n\\n⚠️ NB: Make changes to the files in `src/` and then use `npm run build` to\\ngenerate output files in `lib/`.\\n\\nThe documentation is autogenerated, so please **rebuild the docs** after making\\nchanges by running `pnpm build docs`\\n\\n### Unit Tests\\n\\nUnit tests allows to test the functionalities of the adaptor helper functions\\nsuch as:\\n\\n> Does `create('events', payload)` perform a post request to the correct DHIS2\\n> API?\\n\\nTo run unit tests execute `pnpm run test` (they're the default tests).\\n\\nAnytime a new functionality is added to the helper functions, more unit tests\\nneeds to be added.\\n\\n### End-to-end integration tests\\n\\nIntegration tests allow us to test the end-to-end behavior of the helper\\nfunctions and also to test the examples we provide via inline documentation.\\n\\nFor example with integration tests we answer the following question:\\n\\n> Does `create('events', eventPayload)` actually create a new event in a live\\n> DHIS2 system?\\n\\nTo run integration tests, execute `npm run integration-test`. These tests use\\nnetwork I/O and a public connection to a DHIS2 \\\"play\\\" server so their timing and\\nperformance is unpredictable. Consider adding an increased timeout, and\\nmodifying the orgUnit, program, etc., IDs set in `globalState`.\\n\\n#### Troubleshooting the tests\\n\\n- Depending on your internet strength please consider changing the **global\\n timeout** in the `test/mocha.opts` file to avoid faillures related to network\\n timeouts.\\n\\n- The behavior of the tests in `test/integration.js` is very unpredictable; they\\n depend on the **configuration of a target DHIS2 instance**. Currently you need\\n to have at least one organisation unit with one program, one\\n trackedEntityInstance and one programStage in it. These components need to be\\n well configured for the integration tests to work. For example: the\\n trackedEntityInstance need to be enrolled to the program, which should be\\n created in that organisation unit and contains at least that programStage. If\\n the tests fail, you must adjust these attributes in the\\n [before hook](https://github.com/OpenFn/adaptors/tree/main/packages/dhis2/test/integration.js):\\n\\n```javascript\\nbefore(done => {\\n fixture.initialState = {\\n configuration: {\\n username: 'admin',\\n password: 'district',\\n hostUrl: 'https://play.dhis2.org/2.36.6',\\n },\\n program: 'IpHINAT79UW',\\n orgUnit: 'DiszpKrYNg8',\\n trackedEntityInstance: 'uhubxsfLanV',\\n programStage: 'eaDHS084uMp',\\n };\\n done();\\n});\\n```\\n\\n- Make sure the `update` and `upsert` integration tests don't affect those\\n initial organisation units, programs, programStage and trackedEntityInstance\\n required. Otherwise the create integration tests would be broken again; and\\n that's an endless faillure loop :(\\n\\nAnytime a new example is added in the documentation of a helper function, a new\\nintegration test should be built.\\n\"","changelog":"\"# @openfn/language-dhis2\\n\\n## 4.0.3\\n\\n### Patch Changes\\n\\n- 222184d: remove Class Log and replaced\\n\\n - `Log.success` with `console.log`\\n - `Log.warn` with `console.warn`\\n - `Log.error` with `console.error`\\n\\n## 4.0.2\\n\\n### Patch Changes\\n\\n- 1bd612e: improve error logs response\\n\\n## 4.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 4.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 3.2.12\\n\\n### Patch Changes\\n\\n- 57742d1: improve logs output\\n\\n## 3.2.11\\n\\n### Patch Changes\\n\\n- 705caab: Remove tools as devdependencies\\n\\n## 3.2.10\\n\\n### Patch Changes\\n\\n- 929bca6: Use metadata helper function from common\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 3.2.9\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 3.2.8\\n\\n### Patch Changes\\n\\n- Fix metadata function export\\n\\n## 3.2.7\\n\\n### Patch Changes\\n\\n- c09b821: Add @magic annotations\\n\\n## 3.2.6\\n\\n### Patch Changes\\n\\n- df6098d: replace sample state with configuration\\n\\n## 3.2.5\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 3.2.4\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 3.2.3\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 3.2.2\\n\\n### Patch Changes\\n\\n- 9a2755e: Update dependency on language-common\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n - @openfn/buildtools@1.0.2\\n\\n## 3.2.1\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\\n## 3.2.0\\n\\n### Minor Changes\\n\\n- f670bf8: Added credential schema to enable new ui\\n\\n## 3.1.0\\n\\n### Minor Changes\\n\\n- 8d6e8ce: Migrate dhis2 into repo\\n\\n### Patch Changes\\n\\n- Updated dependencies [4671e89]\\n- Updated dependencies [8d6e8ce]\\n - @openfn/buildtools@1.0.1\\n\"","functions":["attr","create","destroy","discover","dv","findAttributeValue","get","patch","update","upsert"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"hostUrl":{"title":"Host URL","type":"string","description":"The base DHIS2 instance URL","format":"uri","minLength":1,"examples":["https://play.dhis2.org/2.36.6"]},"username":{"title":"Username","type":"string","description":"Username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"minLength":1,"examples":["@some(!)Password"]},"apiVersion":{"title":"API Version","anyOf":[{"type":"string"},{"type":"null"}],"placeholder":"38","description":"DHIS2 api version","minLength":1,"examples":["v2"]}},"type":"object","additionalProperties":true,"required":["hostUrl","password","username"]}}, +{"name":"dynamics","adaptor":"@openfn/language-dynamics","version":"0.4.8","docs":"\"\"","readme":"\"# Language Dynamics\\n\\nLanguage Pack for building expressions and operations to make calls to the\\nMicrosoft Dynamics API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/dynamics-configuration-schema/)\\ndefinition.\\n\\n- _Dynamics uses oauth2. The language-package will expect to be given a valid\\n oauth token. If a valid token is not provided, it will fail. On OpenFn.org,\\n the `CredentialService` is responsible for making sure the the oauth token is\\n valid each time it assembles state to hand to `execute`._\\n\\n#### sample createEntity expression\\n\\n```js\\ncreateEntity({\\n entityName: 'accounts',\\n body: {\\n name: 'Open Function',\\n creditonhold: false,\\n address1_latitude: 47.639583,\\n description: 'This is the description of the sample account',\\n revenue: 5000000,\\n accountcategorycode: 1,\\n },\\n});\\n```\\n\\n#### sample query expression\\n\\n_Can be used to retrieve or query a specific Entity if an entityId is declared\\nin the expression. Otherwise it will perform a query on all data with the\\ndefined Entity Name_\\n\\n```js\\nquery({\\n entityName: 'contacts',\\n entityId: '51a0e5b9-88df-e311-b8e5-6c3be5a8b200',\\n query: {\\n fields: ['fullname', 'birthdate'],\\n limit: 10,\\n orderBy: {\\n field: 'lastname',\\n direction: 'asc',\\n },\\n filter: \\\"firstname eq 'Cat'\\\",\\n },\\n});\\n```\\n\\n#### sample update expression\\n\\n```js\\nupdateEntity({\\n entityName: 'accounts',\\n entityId: 'f4301865-c64a-e711-80f3-e0071b6fd061',\\n body: {\\n name: 'wilder 2',\\n creditonhold: true,\\n address1_latitude: 47.639583,\\n description: 'This is the description of the sample account',\\n revenue: 5000000,\\n accountcategorycode: 1,\\n },\\n});\\n```\\n\\n#### sample delete expression\\n\\n```js\\ndeleteEntity({\\n entityName: 'accounts',\\n entityId: 'aeef941b-254a-e711-80f1-e0071b685921',\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-dynamics\\n\\n## 0.4.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 0.4.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 0.4.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 0.4.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 0.4.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 0.4.3\\n\\n### Patch Changes\\n\\n- aad9549: Ensure that standard OAuth2 credentials with snake-cased\\n \\\"access_token\\\" keys can be used for OAuth2-reliant adaptors\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 0.4.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- b032b9c: Migrate Dynamics\\n\\n### Patch Changes\\n\\n- e81561f: Updated ast and package.json\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","$comment":"OAuth2","properties":{"resource":{"title":"Resource","type":"string","description":"Dynamics resource URL","format":"uri","minLength":1,"examples":["https://openfn.crm2.dynamics.com"]},"apiVersion":{"title":"API Version","type":"string","default":"8.2.0","description":"Dynamics API version to use","minLength":1,"examples":["8.2.0"]},"access_token":{"title":"Access Token","type":"string","description":"Dynamics API access token","writeOnly":true,"minLength":1,"examples":["eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRlQyU3ZRdVhoODQ2WVR3RUlCdyIsI"]}},"type":"object","additionalProperties":true,"required":["resource","apiVersion","access_token"]}}, +{"name":"facebook","adaptor":"@openfn/language-facebook","version":"0.3.2","docs":"\"## postMessage\\n\\npostMessage(params) ⇒ Operation\\nPost a message\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the fetch |\\n\\n**Example** \\n```js\\npostMessage({\\n \\\"recipient\\\": {\\n \\\"id\\\": \\\"your-psid\\\"\\n },\\n \\\"message\\\": {\\n \\\"text\\\": \\\"your-message\\\"\\n }\\n})\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Facebook\\n\\nLanguage Pack for building expressions and operations to interact with the\\nFacebook Messenger API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/facebook-configuration-schema/)\\ndefinition.\\n\\n### postMessage\\n\\n#### sample expression using operation\\n\\n```js\\npostMessage({\\n recipient: {\\n id: '',\\n },\\n message: {\\n text: '',\\n },\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-facebook\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- aad9549: Ensure that standard OAuth2 credentials with snake-cased\\n \\\"access_token\\\" keys can be used for OAuth2-reliant adaptors\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.2.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.2.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- f7669d2: migrate facebook\\n\"","functions":["postMessage"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","$comment":"OAuth2","properties":{"access_token":{"title":"Access Token","type":"string","description":"Your Facebook API access token","writeOnly":true,"minLength":1}},"type":"object","additionalProperties":true,"required":["access_token"]}}, +{"name":"fhir","adaptor":"@openfn/language-fhir","version":"3.1.0","docs":"\"## Functions\\n\\n
\\n
\\n create(path, params, callback)
\\n
\\n createTransactionBundle(params, callback)
\\n
\\n get(path, query, callback)
\\n
\\n getClaim(claimId, query, callback)
\\n
\\n\\n\\n## create\\n\\ncreate(path, params, callback) ⇒ Operation\\nCreates a resource in a destination system using a POST request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| params | object | data to create the new resource |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ncreate(\\\"Bundle\\\", {...state.data: type: \\\"collection\\\"})\\n```\\n\\n* * *\\n\\n## createTransactionBundle\\n\\ncreateTransactionBundle(params, callback) ⇒ Operation\\nCreates a transactionBundle for HAPI FHIR\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to create the new transaction |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ncreateTransactionBundle({\\n resourceType: \\\"Bundle\\\",\\n type: \\\"transaction\\\",\\n entry: [\\n {\\n fullUrl: \\\"https://hapi.fhir.org/baseR4/Patient/592442\\\",\\n resource: {\\n resourceType: \\\"Patient\\\",\\n id: \\\"592442\\\",\\n name: [{ given: \\\"Caleb\\\", family: \\\"Cushing\\\" }],\\n },\\n request: {\\n method: \\\"POST\\\",\\n url: \\\"Patient\\\",\\n },\\n },\\n ],\\n});\\n```\\n\\n* * *\\n\\n## get\\n\\nget(path, query, callback) ⇒ Operation\\nGet a resource in a FHIR system\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| query | object | data to get the new resource |\\n| callback | function | (Optional) callback function |\\n\\n**Example** *(Get Claim from FHIR with optional query)* \\n```js\\nget(\\\"Claim\\\", { _include: \\\"Claim:patient\\\", _sort: \\\"-_lastUpdated\\\", _count: 200 })\\n```\\n**Example** *(Get Patient from FHIR)* \\n```js\\nget('Patient');\\n```\\n\\n* * *\\n\\n## getClaim\\n\\ngetClaim(claimId, query, callback) ⇒ Operation\\nGet Claim in a FHIR system\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| claimId | string | (optional) claim id |\\n| query | object | (optinal) query parameters |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ngetClaim({ _include: \\\"Claim:patient\\\", _sort: \\\"-_lastUpdated\\\", _count: 200 });\\n```\\n\\n* * *\\n\\n## request\\n\\nrequest ⇒\\nThis is an asynchronous function that sends a request to a specified URL with optional parameters\\nand headers, and returns the response data in JSON format.\\n\\n**Kind**: global constant \\n**Returns**: The `request` function is returning the parsed JSON data from the response of the HTTP\\nrequest made to the specified `url` with the given `params` and `method`. If there is an error in\\nthe response, the function will throw an error. \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| url | string | | The URL of the API endpoint that the request is being made to. |\\n| [params] | object | | An object containing any additional parameters to be sent with the request, such as query parameters or request body data. It is an optional parameter and defaults to an empty object if not provided. |\\n| [method] | string | "GET" | The HTTP method to be used for the request. It defaults to 'GET' if not specified. |\\n\\n\\n* * *\\n\\n\"","readme":"\"# language-fhir\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the HAPI FHIR\\nAPI.\\n\\n## FHIR Documentation\\n\\nThe Restfull API can be seen here: https://www.hl7.org/fhir/http.html\\n\\n## Documentation\\n\\n\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/fhir-configuration-schema/)\\ndefinition.\\n\\n#### Creates a resource in a destination system using a POST request\\n\\n```js\\ncreate('/endpoint', { foo: 'bar' });\\n```\\n\\n#### Creates a transactionBundle for HAPI FHIR\\n\\n```js\\ncreateTransactionBundle({\\n entry: [transactionBundle],\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-fhir\\n\\n## 3.1.0\\n\\n### Minor Changes\\n\\n- d94e9ee: Migrate from axios to using `fetch` from `undici` and add uniti tests\\n\\n## 3.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 3.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 2.0.0\\n\\n### Major Changes\\n\\n- d4b4094: - Update configuration schema,\\n - Add `get()` function\\n - Fix `create()` axios config\\n - Remove unused code\\n - Improve error handling\\n - Improve response handling\\n\\n## 1.1.5\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.1.4\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.1.3\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.1.2\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- fee607e: Migrate FHIR, update package export\\n\\n### Patch Changes\\n\\n- cb5d0ed: Updated to @openfn/simple-ast v0.4.1\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\"","functions":["create","createTransactionBundle","get","getClaim"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"baseUrl":{"title":"Base Url","type":"string","description":"The baseUrl","examples":["https://hapi.fhir.org/baseR4"]},"apiPath":{"title":"API Path","anyOf":[{"type":"string"},{"type":"null"}],"placeholder":"R4","description":"FHIR api path","minLength":1,"examples":["baseR4","R3","R4"]},"authType":{"title":"Auth Type","type":"string","description":"The type of authentication used to authenticate into the destination system","examples":["Basic"]},"token":{"title":"Token","type":"string","description":"The token used to authenticate into the destination system","examples":["@super!scretetoken"]}},"required":["resource","authType","token"]}}, +{"name":"godata","adaptor":"@openfn/language-godata","version":"3.4.0","docs":"\"## Functions\\n\\n
\\n
\\n getCase(id, query, callback)
\\n
\\n getContact(id, query, callback)
\\n
\\n getLocation(query, callback)
\\n
\\n getOutbreak(query, callback)
\\n
\\n getReferenceData(query, callback)
\\n
\\n listCases(id, callback)
\\n
\\n listContacts(id, callback)
\\n
\\n listLocations(callback)
\\n
\\n listOutbreaks(callback)
\\n
\\n listReferenceData(callback)
\\n
\\n upsertCase(id, externalId, goDataCase, callback)
\\n
\\n upsertContact(id, externalId, goDataContact, callback)
\\n
\\n upsertLocation(externalId, goDataLocation, callback)
\\n
\\n upsertOutbreak(outbreak, callback)
\\n
\\n upsertReferenceData(externalId, goDataReferenceData, callback)
\\n
\\n\\n\\n## getCase\\n\\ngetCase(id, query, callback) ⇒ Operation\\nGet one or multiple cases within an outbreak from a query filter\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | Outbreak id |\\n| query | object | An object with a query filter parameter |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\ngetCase(\\n '3b55-cdf4',\\n { 'where.relationship': { active: true }, where: { firstName: 'Luca'} },\\n state => {\\n console.log(state);\\n return state;\\n }\\n);\\n```\\n\\n* * *\\n\\n## getContact\\n\\ngetContact(id, query, callback) ⇒ Operation\\nGet one or multiple contacts within an outbreak from a query filter\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | Outbreak id |\\n| query | object | An object with a query filter parameter |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\ngetContact(\\\"343d-dc3e\\\", {\\\"where\\\":{\\\"firstName\\\": \\\"Luca\\\"}}, state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## getLocation\\n\\ngetLocation(query, callback) ⇒ Operation\\nGet one or multiple locations from a query filter\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | An object with a query filter parameter |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\ngetLocation({\\\"where\\\":{\\\"name\\\": \\\"30 DE OCTUBRE\\\"}}, state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## getOutbreak\\n\\ngetOutbreak(query, callback) ⇒ Operation\\nGet one or multiple outbreaks from a query filter\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | An object with a query filter parameter |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\ngetOutbreak({\\\"where\\\":{\\\"name\\\": \\\"Outbreak demo\\\"}}, state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## getReferenceData\\n\\ngetReferenceData(query, callback) ⇒ Operation\\nGet one or multiple reference data from a query filter\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | An object with a query filter parameter |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\ngetReferenceData({\\\"where\\\":{\\\"categoryId\\\": \\\"LNG_REFERENCE_DATA_CATEGORY_CENTRE_NAME\\\"}}, state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## listCases\\n\\nlistCases(id, callback) ⇒ Operation\\nFetch the list of cases within a particular outbreak using its ID.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | Outbreak id |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nlistCases(\\\"343d-dc3e\\\", state => {\\n console.log(state);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## listContacts\\n\\nlistContacts(id, callback) ⇒ Operation\\nFetch the list of contacts within a particular outbreak using its ID.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | Outbreak id |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nlistContacts(\\\"343d-dc3e\\\", // Outbreak Id\\n state => {\\n console.log(state);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## listLocations\\n\\nlistLocations(callback) ⇒ Operation\\nFetch the list of locations\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nlistLocations(state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## listOutbreaks\\n\\nlistOutbreaks(callback) ⇒ Operation\\nFetch the list of outbreaks\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nlistOutbreaks(state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## listReferenceData\\n\\nlistReferenceData(callback) ⇒ Operation\\nFetch the list of reference data\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nlistReferenceData(state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## upsertCase\\n\\nupsertCase(id, externalId, goDataCase, callback) ⇒ Operation\\nUpsert case to godata using an external id to mach a specific record\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | Outbreak id |\\n| externalId | string | External Id to match |\\n| goDataCase | object | an object with some case data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nupsertCase(\\\"4dce-3eedce3-rd33\\\", 'visualId',\\n data: state => {\\n const patient = state.data.body;\\n return {\\n firstName: patient.Patient_name.split(' ')[0],\\n lastName: patient.Patient_name.split(' ')[1],\\n visualId: patient.Case_ID,\\n 'age:years': patient.Age_in_year,\\n gender: patient.Sex,\\n };\\n })\\n```\\n\\n* * *\\n\\n## upsertContact\\n\\nupsertContact(id, externalId, goDataContact, callback) ⇒ Operation\\nUpsert contact to godata using an external id to match a specific record.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | Outbreak id |\\n| externalId | string | External Id to match |\\n| goDataContact | object | an object with some case data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nupsertContact(\\\"4dce-3eedce3-rd33\\\", 'visualId',\\n {\\n firstName: 'Luca',\\n gender: 'male',\\n 'age:years': '20'\\n ...\\n }\\n )\\n```\\n\\n* * *\\n\\n## upsertLocation\\n\\nupsertLocation(externalId, goDataLocation, callback) ⇒ Operation\\nUpsert location to godata\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| externalId | string | External Id to match |\\n| goDataLocation | object | an object with some location data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nupsertLocation('name', {...})\\n```\\n\\n* * *\\n\\n## upsertOutbreak\\n\\nupsertOutbreak(outbreak, callback) ⇒ Operation\\nUpsert outbreak to godata\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| outbreak | object | an object with an externalId and some outbreak data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nupsertOutbreak({externalId: \\\"3dec33-ede3\\\", data: {...}})\\n```\\n\\n* * *\\n\\n## upsertReferenceData\\n\\nupsertReferenceData(externalId, goDataReferenceData, callback) ⇒ Operation\\nUpsert reference data to godata\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| externalId | string | External Id to match |\\n| goDataReferenceData | object | an object with some reference data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nupsertReferenceData('id', {...})\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-godata\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the WHO\\nGo.Data API.\\n\\n[Go.Data](https://www.who.int/godata) is an outbreak investigation tool for\\nfield data collection during public health emergencies. The tool includes\\nfunctionality for case investigation, contact follow-up, visualization of chains\\nof transmission including secure data exchange and is designed for flexibility\\nin the field, to adapt to the wide range of outbreak scenarios.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/godata-docs) for\\nfull technical documentation.\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/godata-configuration-schema/)\\ndefinition.\\n\\n## Helper Functions\\n\\n### post(...)\\n\\n## Fetch the list of outbreaks\\n\\nThis function is used to fetch the whole list of outbreaks in Go.Data.\\n\\n```js\\nlistOutbreaks(state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n## Get a specific outbreak\\n\\nThis function can be used to fetch one specific outbreak. A filtering mechanism\\nis used to specify a criteria to match. Mutliple outbreaks could be returned if\\nmatched by the filter.\\n\\n```js\\ngetOutbreak({ where: { name: 'Outbreak demo' } }, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n## Insert or Update an outbreak using a unique id as a key\\n\\nThis function is used to either update a record in Go.Data if matched or insert\\na new one if no record matched the unique id.\\n\\n```js\\nupsertOutbreak({\\n externalId: '3dec33-ede3',\\n data: {\\n name: 'string',\\n description: 'string',\\n disease: 'string',\\n countries: [\\n {\\n id: 'SENEGAL',\\n },\\n ],\\n startDate: '2020-12-17T14:54:19.498Z',\\n endDate: '2020-12-17T14:54:19.498Z',\\n longPeriodsBetweenCaseOnset: 0,\\n periodOfFollowup: 0,\\n },\\n});\\n```\\n\\n## Fetch the list of cases\\n\\nThis function is used to fetch the whole list of cases for a specific outbreak\\nin Go.Data.\\n\\n```js\\nlistCases('4c444f7-4e11-41d0-c1af-331dd15a892e', state => {\\n console.log(state);\\n return state;\\n});\\n```\\n\\n## Get a specific case\\n\\nThis function can be used to fetch one specific case for an outbreak. A\\nfiltering mechanism can specify a criteria to match. Mutliple cases could be\\nreturned if matched by the filter.\\n\\n```js\\ngetCase(\\n '4c444f7-4e11-41d0-c1af-331dd15a892e',\\n { 'where.relationship': { active: true }, where: { firstName: 'Luca' } },\\n state => {\\n console.log(state);\\n return state;\\n }\\n);\\n```\\n\\n## Insert or Update a case using a unique id as a key\\n\\nThis function is used to either update a case in Go.Data if matched or insert a\\nnew one if no record matched the unique id.\\n\\n```js\\nupsertCase('4dce-3eedce3-rd33', 'visualId',\\n data: state => {\\n const patient = state.data.body;\\n return {\\n firstName: patient.Patient_name.split(' ')[0],\\n lastName: patient.Patient_name.split(' ')[1],\\n visualId: patient.Case_ID,\\n 'age:years': patient.Age_in_year,\\n gender: patient.Sex,\\n };\\n });\\n```\\n\\n## Fetch the list of contacts\\n\\nThis function is used to fetch the whole list of contacts for a specific\\noutbreak in Go.Data.\\n\\n```js\\nlistContacts('4c444f7-4e11-41d0-c1af-331dd15a892e', state => {\\n console.log(state);\\n return state;\\n});\\n```\\n\\n## Get a specific contact\\n\\nThis function can be used to get one specific contact for an outbreak. A\\nfiltering mechanism can specify a criteria to match. Mutliple contacts could be\\nreturned if matched by the filter.\\n\\n```js\\ngetContact('343d-dc3e', { where: { firstName: 'Luca' } }, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n## Insert or Update a contact using a unique id as a key\\n\\nThis function is used to either update a contact in Go.Data if matched or insert\\na new one if no record matched the unique id.\\n\\n```js\\nupsertContact('4dce-3eedce3-rd33', 'visualId', {\\n firstName: 'Luca',\\n gender: 'male',\\n 'age:years': '20',\\n});\\n```\\n\\n## Fetch the list of locations\\n\\nThis function is used to fetch the list of locations.\\n\\n```js\\nlistLocations(state => {\\n console.log(state);\\n return state;\\n});\\n```\\n\\n## Get a specific location\\n\\nThis function can be used to get one specific location. A filtering mechanism\\ncan specify a criteria to match. Mutliple locations could be returned if matched\\nby the filter.\\n\\n```js\\ngetLocation({ where: { name: '30 DE MAYO' } }, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n## Insert or Update a location using a unique id as a key\\n\\nThis function is used to either update a location if matched or insert a new. A\\ncustom `externalId` can be provided.\\n\\n```js\\nupsertLocation('name', {\\n name: '30 DE DECIEMBRE',\\n synonyms: [],\\n identifiers: [],\\n active: true,\\n populationDensity: 0,\\n geoLocation: {\\n lat: -45.343244,\\n lng: -67.193873,\\n },\\n});\\n```\\n\\n## Fetch the list of reference data\\n\\nThis function is used to fetch the list of reference data.\\n\\n```js\\nlistReferenceData(state => {\\n console.log(state);\\n return state;\\n});\\n```\\n\\n## Get a specific reference data\\n\\nThis function can be used to get one specific reference data. A filtering\\nmechanism can specify a criteria to match.\\n\\n```js\\ngetReferenceData(\\n { where: { categoryId: 'LNG_REFERENCE_DATA_CATEGORY_CENTRE_NAME' } },\\n state => {\\n console.log(state.data);\\n return state;\\n }\\n);\\n```\\n\\n## Insert or Update a reference data using a unique id as a key\\n\\nThis function is used to either update a location if matched or insert a new. A\\ncustom `externalId` can be provided.\\n\\n```js\\nupsertReferenceData('id', {\\n categoryId: 'CATEGORY',\\n value: 'VALUE',\\n readOnly: false,\\n active: true,\\n id: 'ID',\\n createdAt: '2020-10-01T18:48:31.784Z',\\n createdBy: '95d31ea9',\\n updatedAt: '2020-10-01T18:48:31.784Z',\\n updatedBy: '95d31ea9',\\n createdOn: 'API',\\n deleted: false,\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-godata\\n\\n## 3.4.0\\n\\n### Minor Changes\\n\\n- df4cfca: Switch from `'writeOnly: true'` to `'format: email'` in the godata\\n configuration schema.\\n\\n## 3.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 3.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 3.2.4\\n\\n### Patch Changes\\n\\n- ef828e7: update old urls in readme\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 3.2.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 3.2.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 3.2.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 3.2.0\\n\\n### Minor Changes\\n\\n- 8e7a79e: Migrate Godata\\n\\n### Patch Changes\\n\\n- cbb8968: Fix axios Inefficient Regular Expression Complexity vulnerability\\n- e81561f: Updated ast and package.json\\n\"","functions":["getCase","getContact","getLocation","getOutbreak","getReferenceData","listCases","listContacts","listLocations","listOutbreaks","listReferenceData","upsertCase","upsertContact","upsertLocation","upsertOutbreak","upsertReferenceData"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"apiUrl":{"title":"API URL","type":"string","description":"Godata API URL","default":"https://www.who-godata.com/api","format":"uri","minLength":1,"examples":["https://www.who-godata.com/api"]},"email":{"title":"Email","type":"string","description":"Your Godata login email","format":"email","minLength":1,"examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Your Godata login password","writeOnly":true,"minLength":1,"examples":["@some(!)Strongpassword"]}},"type":"object","additionalProperties":true,"required":["apiUrl","email","password"]}}, +{"name":"googlehealthcare","adaptor":"@openfn/language-googlehealthcare","version":"1.0.0","docs":"\"## createFhirResource\\n\\ncreateFhirResource([fhirStore], resource, callback) ⇒ Operation\\nCreate some resource in Google Cloud Healthcare\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| [fhirStore] | Object | The FHIR store information. - `cloudRegion` (string): The cloud region where the FHIR store is located. - `projectId` (string): The ID of the project that contains the FHIR store. - `datasetId` (string): The ID of the dataset that contains the FHIR store. - `fhirStoreId` (string): The ID of the FHIR store. |\\n| resource | object | The FHIR resource data to be created |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ncreateFhirResource(\\n {\\n cloudRegion: \\\"us-central1\\\",\\n projectId: \\\"adjective-noun-123\\\",\\n datasetId: \\\"my-dataset\\\",\\n fhirStoreId: \\\"my-fhir-store\\\",\\n },\\n {\\n resourceType: \\\"Patient\\\",\\n name: [{ use: \\\"official\\\", family: \\\"Smith\\\", given: [\\\"Darcy\\\"] }],\\n gender: \\\"female\\\",\\n birthDate: \\\"1970-01-01\\\",\\n }\\n);\\n```\\n**Example** \\n```js\\ncreateFhirResource(\\n {\\n cloudRegion: \\\"us-central1\\\",\\n projectId: \\\"adjective-noun-123\\\",\\n datasetId: \\\"my-dataset\\\",\\n fhirStoreId: \\\"my-fhir-store\\\",\\n },\\n (state) => ({\\n resourceType: \\\"Encounter\\\",\\n status: \\\"finished\\\",\\n class: {\\n system: \\\"http://hl7.org/fhir/v3/ActCode\\\",\\n code: \\\"IMP\\\",\\n display: \\\"inpatient encounter\\\",\\n },\\n reasonCode: [\\n {\\n text: \\\"The patient had an abnormal heart rate. She was concerned about this.\\\",\\n },\\n ],\\n subject: {\\n reference: `Patient/${state.data.id}`,\\n },\\n })\\n);\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-googlehealthcare \\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the\\n[Google Cloud Healthcare API](https://cloud.google.com/healthcare-api/docs/how-tos/fhir-resources#healthcare-create-patient-nodejs).\\n\\n## Documentation\\n\\nView the\\n[docs site](https://docs.openfn.org/adaptors/packages/googlehealthcare-docs) for\\nfull technical documentation.\\n\\n### Configuration\\n\\nView the\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/googlehealthcare-configuration-schema/)\\nfor required and optional `configuration` properties.\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n\\\"Getting Started\\\" guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build _only_ the docs run `pnpm build docs`.\\n\"","changelog":"\"# @openfn/language-googlehealthcare\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\n- 7df7e20: remove `projectId`, `dataSetId`, `cloudRegion`, and `fhirStoreId` out\\n of configuration\\n\\n The new implementation of `createFhirResource(fhirStore, resource, callback)`\\n allows you to use one set of credentials to access different Google Healthcare\\n Cloud FHIR stores. `fhirStore` is an object that contains the FHIR store\\n information\\n (`{cloudRegion: string, projectId: string, datasetId: string, fhirStoreId: string}`).\\n\\n## 0.1.0\\n\\n### Minor Changes\\n\\n- 861d774: add createFhirResource function\\n\\n### Patch Changes\\n\\n- aad9549: Ensure that standard OAuth2 credentials with snake-cased\\n \\\"access_token\\\" keys can be used for OAuth2-reliant adaptors\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\"","functions":["createFhirResource"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","$comment":"OAuth2","type":"object","properties":{"access_token":{"title":"Access Token","type":"string","description":"Your Google Cloud Healthcare access token","writeOnly":true,"minLength":1,"examples":["eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRlQyU3ZRdVhoODQ2WVR3RUlCdyIsI"]},"apiVersion":{"title":"API Version","type":"string","description":"The API version","default":"v1","examples":["v1","v1beta1"]}},"required":["access_token"]}}, +{"name":"googlesheets","adaptor":"@openfn/language-googlesheets","version":"2.2.2","docs":"\"## appendValues\\n\\nappendValues(params) ⇒ Operation\\nAdd an array of rows to the spreadsheet.\\nhttps://developers.google.com/sheets/api/samples/writing#append_values\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | Object | Data object to add to the spreadsheet. |\\n\\n**Example** \\n```js\\nappendValues({\\n spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\\n range: 'Sheet1!A1:E1',\\n values: [\\n ['From expression', '$15', '2', '3/15/2016'],\\n ['Really now!', '$100', '1', '3/20/2016'],\\n ],\\n})\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Google Sheets\\n\\nLanguage Pack for building expressions and operations to make Google Sheets API\\ncalls.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/googlesheets-configuration-schema/)\\ndefinition.\\n\\n### appendValues()\\n\\nAdd rows to an existing sheet:\\n`https://sheets.googleapis.com/v4/spreadsheets/spreadsheetId/values/Sheet1!A1:E1:append?valueInputOption=USER_ENTERED`\\n\\n```js\\nappendValues({\\n spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\\n range: 'Sheet1!A1:E1',\\n values: [\\n ['From expression', '$15', '2', '3/15/2016'],\\n ['Really now!', '$100', '1', '3/20/2016'],\\n ],\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-googlesheets\\n\\n## 2.2.2\\n\\n### Patch Changes\\n\\n- aad9549: Ensure that standard OAuth2 credentials with snake-cased\\n \\\"access_token\\\" keys can be used for OAuth2-reliant adaptors\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 2.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 2.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 2.1.6\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 2.1.5\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 2.1.4\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 2.1.3\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 2.1.2\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 2.1.1\\n\\n### Patch Changes\\n\\n- 9a2755e: Update dependency on language-common\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 2.1.0\\n\\n### Minor Changes\\n\\n- 9e7d458: Migrate googlesheets\\n\"","functions":["appendValues"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","$comment":"OAuth2","properties":{"access_token":{"title":"Access Token","type":"string","description":"Your Google Sheets access token","writeOnly":true,"minLength":1,"examples":["eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRlQyU3ZRdVhoODQ2WVR3RUlCdyIsI"]}},"type":"object","additionalProperties":true,"required":["access_token"]}}, +{"name":"hive","adaptor":"@openfn/language-hive","version":"0.2.0","docs":"\"## query\\n\\nquery(qs, options, callback) ⇒ Operation\\nExecute an SQL statement\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| qs | string | SQL statement |\\n| options | object | (Optional) options for executing sql statement |\\n| callback | function | An optional callback function |\\n\\n**Example** *(Get patient count from hive database)* \\n```js\\nquery(\\\"select count(*) from patient\\\");\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-hive \\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the HIVE API.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/hive-docs) for\\nfull technical documentation.\\n\\n### Configuration\\n\\nView the\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/hive-configuration-schema/)\\nfor required and optional `configuration` properties.\\n\\n### A example expression using the `query` function\\n\\n```js\\nquery('select count(*) from patient');\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n\\\"Getting Started\\\" guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build _only_ the docs run `pnpm build docs`.\\n\"","changelog":"\"# @openfn/language-hive\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- a380347: Add query function\\n\"","functions":["query"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"host":{"title":"Host URL","type":"string","description":"The database instance host URL","format":"uri","minLength":1,"examples":["some-host-url.compute-1.amazonaws.com"]},"port":{"title":"Port","type":"integer","default":10001,"description":"Database instance port","minLength":1,"examples":[10001]},"database":{"title":"Database","type":"string","description":"The database name","minLength":1,"examples":["demo-db"]},"username":{"title":"Username","type":"string","description":"The username to log in the database","minLength":1,"examples":["admin-demo"]},"password":{"title":"Password","type":"string","description":"The password to log in the database","writeOnly":true,"minLength":1,"examples":["@super(!)Secretpass"]}},"type":"object","additionalProperties":true,"required":["host","port","username","password"]}}, +{"name":"http","adaptor":"@openfn/language-http","version":"6.0.0","docs":"\"## Functions\\n\\n
\\n
\\n del(path, params, callback)
\\n
\\n get(path, params, callback)
\\n
\\n parseXML(body, script)
\\n
\\n patch(path, params, callback)
\\n
\\n post(path, params, callback)
\\n
\\n put(path, params, callback)
\\n
\\n request(method, path, params, callback)
\\n
\\n\\n\\n## del\\n\\ndel(path, params, callback) ⇒ Operation\\nMake a DELETE request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Auth parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\ndel(`/myendpoint/${state => state.data.id}`, {\\n headers: {'content-type': 'application/json'}\\n })\\n```\\n\\n* * *\\n\\n## get\\n\\nget(path, params, callback) ⇒ Operation\\nMake a GET request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| params | [RequestOptions](#RequestOptions) | Query, Headers and Authentication parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nget('/myEndpoint', {\\n query: {foo: 'bar', a: 1},\\n headers: {'content-type': 'application/json'},\\n})\\n```\\n\\n* * *\\n\\n## parseXML\\n\\nparseXML(body, script) ⇒ Operation\\nParse XML with the Cheerio parser\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| body | String | data string to be parsed |\\n| script | function | script for extracting data |\\n\\n**Example** \\n```js\\nparseXML(body, function($){\\n return $(\\\"table[class=your_table]\\\").parsetable(true, true, true);\\n })\\n```\\n\\n* * *\\n\\n## patch\\n\\npatch(path, params, callback) ⇒ Operation\\nMake a PATCH request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Auth parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\npatch('/myEndpoint', {\\n body: {'foo': 'bar'},\\n headers: {'content-type': 'application/json'},\\n })\\n```\\n\\n* * *\\n\\n## post\\n\\npost(path, params, callback) ⇒ operation\\nMake a POST request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Authentication parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\npost('/myEndpoint', {\\n body: {'foo': 'bar'},\\n headers: {'content-type': 'application/json'},\\n })\\n```\\n\\n* * *\\n\\n## put\\n\\nput(path, params, callback) ⇒ Operation\\nMake a PUT request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Auth parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nput('/myEndpoint', {\\n body: {'foo': 'bar'},\\n headers: {'content-type': 'application/json'},\\n })\\n```\\n\\n* * *\\n\\n## request\\n\\nrequest(method, path, params, callback) ⇒ Operation\\nMake a HTTP request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| method | string | The HTTP method to use |\\n| path | string | Path to resource |\\n| params | [RequestOptions](#RequestOptions) | Query, Headers and Authentication parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nget('/myEndpoint', {\\n query: {foo: 'bar', a: 1},\\n headers: {'content-type': 'application/json'},\\n})\\n```\\n\\n* * *\\n\\n## RequestOptions\\n\\nRequestOptions : Object\\nOptions provided to the HTTP request\\n\\n**Kind**: global typedef \\n**Properties**\\n\\n| Name | Type | Description |\\n| --- | --- | --- |\\n| body | object \\\\| string | body data to append to the request |\\n| errors | object | Map of errorCodes -> error messages, ie, `{ 404: 'Resource not found;' }`. Use a falsy message value to suppress errors for thiscode. |\\n| query | object | an object of query parameters. Will be encoded into the URL. |\\n| headers | object | an object of headers to append to the request |\\n| parseAs | string | parse the response body as json, text or stream. By default will use the response headers. |\\n| timeout | number | Request timeout in ms. Default: 300 seconds. |\\n| tls | object | TLS/SSL authentication options. See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions |\\n\\n\\n* * *\\n\\n\"","readme":"\"# Language HTTP\\n\\nLanguage Pack for building expressions and operations to make HTTP calls.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/http-configuration-schema/)\\ndefinition.\\n\\n### Get data\\n\\nThis helper function allows the use of a get method to fetch data. You can\\nspecify a query string for filter.\\n\\n```js\\nget(\\n '/myendpoint',\\n {\\n query: { foo: 'bar', a: 1 },\\n headers: { 'content-type': 'application/json' },\\n authentication: { username: 'taylor', password: 'somethingsecret' },\\n },\\n state => {\\n return state;\\n }\\n);\\n```\\n\\n### Post existing data\\n\\nSend some data to an existing endpoint.\\n\\n```js\\npost('/endpoint', {\\n body: state => {\\n return {\\n field_1: 'some_data',\\n field_2: 'some_more_data',\\n field_id: dataValue('Some.Json.Object.Id')(state),\\n };\\n },\\n headers: {\\n Authorization: 'AUTH_KEY',\\n 'Content-Type': 'application/json',\\n },\\n});\\n```\\n\\n### Update existing data with PUT or PATCH\\n\\n```js\\nput(\\n '/myendpoint',\\n {\\n body: { firstname: 'taylor', lastname: 'downs' },\\n headers: { 'content-type': 'application/json' },\\n authentication: { username: 'user', password: 'pass' },\\n },\\n state => {\\n return state;\\n }\\n);\\n```\\n\\n```js\\npatch(\\n '/myendpoint',\\n {\\n body: { firstname: 'taylor', lastname: 'downs' },\\n headers: { 'content-type': 'application/json' },\\n authentication: { username: 'user', password: 'pass' },\\n },\\n state => {\\n return state;\\n }\\n);\\n```\\n\\n### Delete data\\n\\n```js\\ndel(\\n '/myendpoint',\\n {\\n query: { id: 'someId' },\\n headers: { 'content-type': 'application/json' },\\n authentication: { username: 'user', password: 'pass' },\\n },\\n state => {\\n return state;\\n }\\n);\\n```\\n\\n### Parse XML\\n\\nThis function allows you to parse some xml data. A callback function can be use\\nto store in a table.\\n\\n```js\\nparseXML(body, function ($) {\\n return $('table[class=your_table]').parsetable(true, true, true);\\n});\\n```\\n\\n### Parse CSV\\n\\n```js\\nparseCSV('someData.csv', {\\n quoteChar: '\\\"',\\n header: false,\\n});\\n```\\n\\n### Sample parse local CSV file\\n\\n```js\\nparseCSV('PatientsJan2009.csv', {\\n quoteChar: '\\\"',\\n header: false,\\n columns: true,\\n skip_empty_lines: true,\\n trim: true,\\n bom: true,\\n});\\n```\\n\\n## Development\\n\\nClone the repo, run `pnpm install`.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`.\\n\\nTo build the docs for this repo, run `pnpm build:docs`.\\n\"","changelog":"\"# @openfn/language-http\\n\\n## 6.0.0\\n\\n### Major Changes\\n\\n- f741086: The axios library has been removed and the operation API simplified.\\n\\n ### New features\\n\\n - Error mapping. Provide custom errors to response status codes, eg, Eg:\\n `{errors: {404: \\\"You don't have access\\\"}}`\\n - parseAs option. Overrides the default response type. Eg: `{parseAs: \\\"json\\\"}`\\n - Request logging. All requests are now logged to stdout.\\n - tls options. Pass SSL certificates using the `tls` option on any request.\\n\\n ### Breaking changes\\n\\n - Removed `axios` export\\n - Axios options on `get`, `post`, `put`, `patch`, and `del` are no longer\\n supported (unless otherwise stated). This includes `gzip`,`qs`, `formData`,\\n `successCodes` and `keepCookie`\\n - Option params `json` and `agentOptions` have been deprecated. They still\\n work, but you should use `body` and `tls` instead (the behaviour should be\\n the same)\\n\\n### Patch Changes\\n\\n- Updated dependencies [7f52699]\\n - @openfn/language-common@1.12.0\\n\\n## 5.1.1\\n\\n### Patch Changes\\n\\n- a8d655e: Update `parseXML` to use `expandReferences`\\n\\n## 5.1.0\\n\\n### Minor Changes\\n\\n- 8e2b79c: Clean up `state.response.request` by returning only\\n `{ method, path, host, protocol, _headers }`\\n\\n## 5.0.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 5.0.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 5.0.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 5.0.1\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 5.0.0\\n\\n### Major Changes\\n\\n- 0b6f20b: use parseCsv from common\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 4.3.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 4.3.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 4.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 4.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 4.2.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 4.2.7\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 4.2.6\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 4.2.5\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 4.2.4\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 4.2.3\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 4.2.2\\n\\n### Patch Changes\\n\\n- 9a2755e: Update dependency on language-common\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 4.2.1\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\\n## 4.2.0\\n\\n### Minor Changes\\n\\n- f670bf8: Added credential schema to enable new ui\\n\\n## 4.1.0\\n\\n### Minor Changes\\n\\n- 8e1b86d: update http to new format\\n\\n## 4.0.1\\n\\n### Patch Changes\\n\\n- 4671e89: Migrate language-http\\n\"","functions":["del","get","parseXML","patch","post","put"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"username":{"title":"Username","type":"string","description":"Username","examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"examples":["@some(!)Password"]},"baseUrl":{"title":"Base URL","anyOf":[{"type":"string"},{"type":"null"}],"description":"The base URL (http://www.example.com)","format":"uri","minLength":1,"examples":["https://instance_name.surveycto.com"]}},"type":"object","additionalProperties":true,"required":["password","username"]}}, +{"name":"khanacademy","adaptor":"@openfn/language-khanacademy","version":"0.4.1","docs":"\"## fetch\\n\\nfetch(params) ⇒ Operation\\nFetch data from the Khan Academy API\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the query |\\n\\n**Example** \\n```js\\nexecute(\\n fetch(params)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language KhanAcademy\\n\\nLanguage Pack for building expressions and operations to make HTTP calls.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/khanacademy-configuration-schema/)\\ndefinition.\\n\\n## fetch\\n\\n#### sample usage\\n\\n```js\\nfetch({\\n getEndpoint: 'user',\\n queryParams: {\\n email: 'thisoneuser@something.org',\\n },\\n postUrl: 'https://www.openfn.org/inbox/your-uuid',\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-khanacademy\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 9137655: migrate khanacademy\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"email":{"title":"Email","type":"string","description":"Your Khanacademy login email","format":"email","minLength":1,"examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Your Khanacademy login password","writeOnly":true,"minLength":1,"examples":["@some(!)Strongpassword"]},"consumerKey":{"title":"Consumer Key","type":"string","description":"Your Khanacademy consumer key","writeOnly":true,"minLength":1,"examples":["somEThINGkeyish"]},"secretKey":{"title":"Secret Key","type":"string","description":"Your Khanacademy secret key","writeOnly":true,"minLength":1,"examples":["otherThiNGfSECret"]}},"type":"object","additionalProperties":true,"required":["email","password","secretKey","consumerKey"]}}, +{"name":"kobotoolbox","adaptor":"@openfn/language-kobotoolbox","version":"2.1.0","docs":"\"## Functions\\n\\n
\\n
\\n getDeploymentInfo(params, callback)
\\n
\\n getForms(params, callback)
\\n
\\n getSubmissions(params, callback)
\\n
\\n\\n\\n## getDeploymentInfo\\n\\ngetDeploymentInfo(params, callback) ⇒ Operation\\nGet deployment information for a specific form\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Form Id and data to make the fetch or filter |\\n| callback | function | (Optional) Callback function to execute after fetching form deployment information |\\n\\n**Example** \\n```js\\ngetDeploymentInfo({formId: 'aXecHjmbATuF6iGFmvBLBX'}, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n* * *\\n\\n## getForms\\n\\ngetForms(params, callback) ⇒ Operation\\nMake a request to get the list of forms\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Query, Headers and Authentication parameters |\\n| callback | function | (Optional) Callback function to execute after fetching form list |\\n\\n**Example** \\n```js\\ngetForms({}, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n* * *\\n\\n## getSubmissions\\n\\ngetSubmissions(params, callback) ⇒ Operation\\nGet submissions for a specific form\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Form Id and data to make the fetch or filter |\\n| callback | function | (Optional) Callback function to execute after fetching form submissions |\\n\\n**Example** \\n```js\\ngetSubmissions({formId: 'aXecHjmbATuF6iGFmvBLBX'}, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language KoboToolbox\\n\\nLanguage Pack for building expressions and operations to interact with the\\n[TEMPLATE] API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/kobotoolbox-configuration-schema/)\\ndefinition.\\n\\n#### Get the list of forms\\n\\n```js\\ngetForms({}, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n### Get submissions for a specific form\\n\\nA query can be used to filter results.\\n\\n```js\\ngetSubmissions(\\n { formId: 'aXecHjmbATuF6iGFmvBLBX', query: { end: { $gte: '2020-11-20' } } },\\n state => {\\n console.log(state.data);\\n return state;\\n }\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-kobotoolbox\\n\\n## 2.1.0\\n\\n### Minor Changes\\n\\n- c85abf3: Removed the API version enum values in the credential configuration\\n json schema and added a placeholder\\n\\n## 2.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 2.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.3.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.3.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.3.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.3.0\\n\\n### Minor Changes\\n\\n- e48c30c: add getDeploymentInfo function\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- 7b5ca3e: add fn and fix adaptors export\\n\\n### Patch Changes\\n\\n- 4067c28: build ast file\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- 7fc47d8: Migrate kobotoolbox\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\"","functions":["getForms"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"baseURL":{"title":"Base URL","type":"string","default":"https://kf.kobotoolbox.org","description":"Kobotoolbox URL","format":"uri","minLength":1,"examples":["https://kf.kobotoolbox.org"]},"username":{"title":"Username","type":"string","description":"Kobotoolbox username","minLength":1,"examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Kobotoolbox password","writeOnly":true,"minLength":1,"examples":["@some(!)Strongpassword"]},"apiVersion":{"title":"API Version","type":"string","placeholder":"v2","description":"Kobotoolbox API version to use","minLength":1,"examples":["v2"]}},"type":"object","additionalProperties":true,"required":["username","baseURL","password","apiVersion"]}}, +{"name":"magpi","adaptor":"@openfn/language-magpi","version":"1.1.1","docs":"\"## Functions\\n\\n
\\n
\\n fetchSurveyData(params)
\\n
\\n submitRecord(jsonData)
\\n
\\n\\n\\n## fetchSurveyData\\n\\nfetchSurveyData(params) ⇒ Operation\\nMake a POST request to fetch Magpi data and POST it somewhere else\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the fetch |\\n\\n**Example** \\n```js\\nfetchSurveyData({\\n \\\"surveyId\\\": \\\"37479\\\",\\n \\\"afterDate\\\": \\\"2017-09-27\\\",\\n \\\"postUrl\\\": \\\"https://www.openfn.org/inbox/your-inbox-url\\\"\\n})\\n```\\n\\n* * *\\n\\n## submitRecord\\n\\nsubmitRecord(jsonData) ⇒ Operation\\nSubmit a record for a form/survey which already exists in a Magpi user account\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| jsonData | object | Payload data for the record |\\n\\n**Example** \\n```js\\nsubmitRecord(jsonData)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Magpi\\n\\nLanguage Pack for building expressions and operations for working with the\\n[Magpi inbound API](http://support.magpi.com/support/solutions/articles/4839-magpi-inbound-api)\\nand the\\n[Magpi outbound API](http://support.magpi.com/support/solutions/articles/4865-magpi-outbound-api).\\n\\n_N.B.: The Magpi API is under development and this pack may change._\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/magpi-configuration-schema/)\\ndefinition.\\n\\n## Fetch data from Magpi\\n\\nAllows you to fetch data from Magpi and post it elsewhere.\\n\\n#### Using `fetchSurveyData`:\\n\\nhttps://www.magpi.com/api/surveydata/v2?username=taylordowns2000&accesstoken=blahblahblah&surveyid=921409679070\\n\\n```js\\nfetchSurveyData({\\n surveyId: '37479',\\n afterDate: '2016-01-01',\\n beforeDate: '2100-01-01',\\n postUrl: 'https://www.openfn.org/inbox/secret-5c25-inbox-ba2c-url',\\n});\\n```\\n\\n## Submit new records\\n\\n**wip:** This will allow you to push data to Magpi to create a new record for a\\nform which exists in a user account.\\n\\n#### Using `submitRecord`:\\n\\n```js\\nsubmitRecord(1, 2);\\n```\\n\\n#### Magpi Outbound API Parameters:\\n\\n- `username`: The account username.\\n- `accesstoken`: The accesstoken generated on the site. Each accesstoken is\\n associated with the user who generated.\\n- `surveyid`: The surveyid is not the survey's name. The surveyid can be\\n obtained from the list of forms generated in 1 above.\\n- `startdate`: Start date of the data to be returned. Filtering is done based on\\n the DateStamp and is inclusive.(Optional). The date format should be the same\\n one as the one on the data tab/ The date format should be the same one as the\\n one on the data tab\\n- `enddate`: End date of the data to be returned. Filtering is done based on the\\n DateStamp and is inclusive.(Optional)\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-magpi\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.0.5\\n\\n### Patch Changes\\n\\n- 86fb813: dependencies update\\n\\n## 1.0.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.0.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.0.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.0.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\n- e6c2b4a: Update xml2js parser\\n\\n### Minor Changes\\n\\n- df5dd2e: migrate magpi\\n\"","functions":["fetchSurveyData","submitRecord"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"username":{"title":"username","type":"string","description":"Magpi username","minLength":1,"examples":["test@openfn.org"]},"accessToken":{"title":"Access Token","type":"string","description":"Magpi access token","writeOnly":true,"minLength":1,"examples":["somEThINGkeyish"]}},"type":"object","additionalProperties":true,"required":["username","accessToken"]}}, +{"name":"mailchimp","adaptor":"@openfn/language-mailchimp","version":"0.7.2","docs":"\"## Functions\\n\\n
\\n
\\n addMember(params, [callback])
\\n
\\n archiveMember(params, [callback])
\\n
\\n deleteMember(params, [callback])
\\n
\\n get(path, query, [callback])
\\n
\\n listAudienceInfo(query, [callback])
\\n
\\n listAudiences(query, [callback])
\\n
\\n listBatches(params, [callback])
\\n
\\n listMembers(params, [callback])
\\n
\\n post(path, body, query, [callback])
\\n
\\n request(method, path, options, [callback])
\\n
\\n startBatch(params, [callback])
\\n
\\n tagMembers(params, [callback])
\\n
\\n updateMember(params, [callback])
\\n
\\n updateMemberTags(params, [callback])
\\n
\\n upsertMembers(params, [callback])
\\n
\\n\\n\\n## addMember\\n\\naddMember(params, [callback]) ⇒ Operation\\naddMember to a list\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## archiveMember\\n\\narchiveMember(params, [callback]) ⇒ Operation\\narchiveMember in a list\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## deleteMember\\n\\ndeleteMember(params, [callback]) ⇒ Operation\\nPermanently delete a member from a list\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## get\\n\\nget(path, query, [callback]) ⇒ Operation\\nThe get function is used to make a GET request to the Mailchimp API.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | The endpoint of the api to which the request should be made |\\n| query | object | An object containing query parameters to be included in the request |\\n| [callback] | function | (Optional) callback to handle the response |\\n\\n**Example** *(Get a list of account exports for a given account)* \\n```js\\nget('/account-exports');\\n```\\n\\n* * *\\n\\n## listAudienceInfo\\n\\nlistAudienceInfo(query, [callback]) ⇒ Operation\\nGet information about a specific list in your Mailchimp account.\\nResults include list members who have signed up but haven't confirmed their subscription yet and unsubscribed or cleaned.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | listId and query parameters |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## listAudiences\\n\\nlistAudiences(query, [callback]) ⇒ Operation\\nGet information about all lists in the account.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | Query parameters |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## listBatches\\n\\nlistBatches(params, [callback]) ⇒ Operation\\nlistBatches\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## listMembers\\n\\nlistMembers(params, [callback]) ⇒ Operation\\nlistMembers\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## post\\n\\npost(path, body, query, [callback]) ⇒ Operation\\nThe post function is used to make a POST request to the Mailchimp API.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | The endpoint of the api to which the request should be made. |\\n| body | object | The data to be sent in the body of the request |\\n| query | object | An object containing query parameters to be included in the request |\\n| [callback] | function | (Optional) callback to handle the response |\\n\\n**Example** *(Create a new account export in your Mailchimp account)* \\n```js\\npost('/accounts-export', {include_stages:[]});\\n```\\n\\n* * *\\n\\n## request\\n\\nrequest(method, path, options, [callback]) ⇒ Operation\\nMake an HTTP request to Mailchimp API\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| method | string | The HTTP method for the request (e.g., 'GET', 'POST', 'PUT', 'DELETE'). |\\n| path | string | The endpoint of the api to which the request should be made. |\\n| options | Object | Additional options for the request (query, body only). |\\n| [callback] | function | (Optional) callback function to handle the response. |\\n\\n**Example** *(Get list to all other resources available in the API)* \\n```js\\nrequest('GET','/');\\n```\\n**Example** *(Create a new account export in your Mailchimp account)* \\n```js\\nrequest('POST','/accounts-export', {include_stages:[]});\\n```\\n\\n* * *\\n\\n## startBatch\\n\\nstartBatch(params, [callback]) ⇒ Operation\\nStart a batch with a list of operations.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | operations batch job |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\nstartBatch(params)\\n```\\n\\n* * *\\n\\n## tagMembers\\n\\ntagMembers(params, [callback]) ⇒ Operation\\nTag members with a particular tag\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a tagId, members, and a list |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\ntagMembers((state) => ({\\n listId: \\\"someId\\\", // All Subscribers list\\n tagId: \\\"someTag\\\", // User tag\\n members: state.response.body.rows.map((u) => u.email),\\n}));\\n```\\n**Example** \\n```js\\ntagMembers((state) => ({\\n listId: \\\"someId\\\",\\n tagId: \\\"someTag\\\",\\n members: state.response.body.rows\\n .filter((u) => u.allow_other_emails)\\n .map((u) => u.email),\\n}));\\n```\\n\\n* * *\\n\\n## updateMember\\n\\nupdateMember(params, [callback]) ⇒ Operation\\nupdateMember\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId,subscriberHash and member |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## updateMemberTags\\n\\nupdateMemberTags(params, [callback]) ⇒ Operation\\nupdateMemberTags\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## upsertMembers\\n\\nupsertMembers(params, [callback]) ⇒ Operation\\nAdd or update a list members\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, users, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\nupsertMembers((state) => ({\\n listId: \\\"someId\\\",\\n users: state.response.body.rows.map((u) => ({\\n email: u.email,\\n status: u.allow_other_emails ? \\\"subscribed\\\" : \\\"unsubscribed\\\",\\n mergeFields: { FNAME: u.first_name, LNAME: u.last_name },\\n })),\\n}));\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Mailchimp\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the Mailchimp\\nmarketing API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/mailchimp-configuration-schema/)\\ndefinition.\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-mailchimp\\n\\n## 0.7.2\\n\\n### Patch Changes\\n\\n- 1131c34: Remove regex pattern for validation and changed minLength to 1\\n\\n## 0.7.1\\n\\n### Patch Changes\\n\\n- 1f856c4: Update configuration schema\\n- 48394f5: - fix ast docs warnings\\n - add status code log on request\\n\\n## 0.7.0\\n\\n### Minor Changes\\n\\n- 58fcea9: - Add chunk from common\\n - Improve error logs\\n - Return `state` in request finalState\\n\\n## 0.6.0\\n\\n### Minor Changes\\n\\n- 1582873: Add request, get and post functions\\n\\n## 0.5.0\\n\\n### Minor Changes\\n\\n- 8e39ee1: Add new functions\\n\\n - addMember()\\n - listMembers()\\n - deleteMember()\\n - listAudiences()\\n - archiveMember()\\n - updateMemberTags()\\n - listAudienceInfo()\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.5\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- cbb8968: Fix axios Inefficient Regular Expression Complexity vulnerability\\n- e81561f: Updated ast and package.json\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 88fa3b5: migrate mailchimp\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"server":{"title":"Data Center","type":"string","description":"Mailchimp Data Center for your account","minLength":1,"examples":["us11","uk8","in10"]},"apiKey":{"title":"API Key","type":"string","description":"Mailchimp API Key","minLength":1,"examples":["0eb22c7b4a1c5bcd789379bf8a92902d-us13"]}},"type":"object","additionalProperties":true,"required":["server","apiKey"]}}, +{"name":"mailgun","adaptor":"@openfn/language-mailgun","version":"0.4.3","docs":"\"## send\\n\\nsend(params)\\nCreate an event\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Params for sending an email |\\n\\n**Example** \\n```js\\nsend({\\n from: 'from_email',\\n to: 'to_email',\\n subject: 'Your Subject',\\n text: 'Your message goes here',\\n attachment: {\\n url: 'www.google.com/doodle.png',\\n filename: 'forYou.png',\\n },\\n})\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Mailgun\\n\\nLanguage Pack for building expressions and operations for working with the\\nmailgun API.\\n\\n[mailgun-js on npm](https://www.npmjs.com/package/mailgun-js)\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/mailgun-configuration-schema/)\\ndefinition.\\n\\n## send\\n\\n```js\\nsend(\\n fields(\\n field('from', 'from_email'),\\n field('to', 'to_email'),\\n field('subject', 'Your Subject'),\\n field('text', 'Your message goes here')\\n )\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-mailgun\\n\\n## 0.4.3\\n\\n### Patch Changes\\n\\n- f86576d: Security update to mailgun.js\\n\\n## 0.4.2\\n\\n### Patch Changes\\n\\n- 4620079: Bump opinionator version\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 9ded25e: Migrate Mailgun\\n\"","functions":["send"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"domain":{"title":"Domain URL","type":"string","description":"Mailgun API domain URL","format":"uri","minLength":1,"examples":["https://mailgun.com/api/example"]},"apiKey":{"title":"API Key","type":"string","description":"Mailgun API Key","writeOnly":true,"minLength":1,"examples":["otherThiNGfSECret"]}},"type":"object","additionalProperties":true,"required":["domain","apiKey"]}}, +{"name":"maximo","adaptor":"@openfn/language-maximo","version":"0.4.1","docs":"\"## Functions\\n\\n
\\n
\\n fetch(params)
\\n
\\n update(params)
\\n
\\n update75(params)
\\n
\\n\\n\\n## fetch\\n\\nfetch(params) ⇒ Operation\\nMake a GET request and POST it somewhere else\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the fetch |\\n\\n**Example** \\n```js\\nfetch({\\n endpoint: 'maxrest/rest/os/mxinventory',\\n query: {\\n ITEMNUM: '01226',\\n _format: 'json',\\n },\\n postUrl: 'https://www.openfn.org/inbox/not-real',\\n});\\n```\\n\\n* * *\\n\\n## update\\n\\nupdate(params) ⇒ Operation\\nMake an update in Maximo 7.6 and beyond\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the update |\\n\\n**Example** \\n```js\\nexecute(\\n update(params)\\n)(state)\\n```\\n\\n* * *\\n\\n## update75\\n\\nupdate75(params) ⇒ Operation\\nMake an upadte in Maximo 7.5\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the update |\\n\\n**Example** \\n```js\\nexecute(\\n update75(params)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Maximo\\n\\nLanguage Pack for building expressions and operations to access IBM Maximo EAM.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/maximo-configuration-schema/)\\ndefinition.\\n\\n### Fetch\\n\\n#### sample 'fetch' expression\\n\\n```js\\nfetch({\\n endpoint: 'maxrest/rest/os/mxinventory',\\n query: {\\n ITEMNUM: '01226',\\n _format: 'json',\\n },\\n postUrl: 'https://www.openfn.org/inbox/not-real',\\n});\\n```\\n\\n### sample 'create' expression\\n\\n```js\\ncreate({\\n endpoint: 'maxrest/rest/os/mxinvbal/',\\n body: function (state) {\\n return {\\n ITEMNUM: dataValue('form.ITEMNUM')(state),\\n ITEMSETID: dataValue('form.ITEMSETID')(state),\\n SITEID: dataValue('form.SITEID')(state),\\n LOCATION: dataValue('form.LOCATION')(state),\\n ISSUEUNIT: 'FOO',\\n PHYSCNT: dataValue('PHYSCNT')(state),\\n BINNUM: dataValue('form.BINNUM')(state),\\n };\\n },\\n});\\n```\\n\\n### sample 'update75' expression\\n\\n```js\\nupdate75({\\n endpoint: state => {\\n return (\\n 'maxrest/rest/os/mxinvbal/' +\\n dataValue('form.question1.INVBALANCESID')(state)\\n );\\n },\\n body: state => {\\n return {\\n _action: 'AddChange', //this is required for the old Maximo API!\\n ITEMNUM: dataValue('form.ITEMNUM')(state),\\n ITEMSETID: dataValue('form.ITEMSETID')(state),\\n SITEID: dataValue('form.SITEID')(state),\\n LOCATION: dataValue('form.LOCATION')(state),\\n PHYSCNT: dataValue('form.PHYSCNT')(state),\\n BINNUM: dataValue('form.BINNUM')(state),\\n };\\n },\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-maximo\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.5\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- aed7e0b: fix required field in configuration schema\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 4d4be56: migrate maximo\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"baseUrl":{"title":"Base URL","type":"string","description":"Maximo instance base URL","format":"uri","minLength":1,"examples":["https://maximo-demo76.mro.com"]},"username":{"title":"Username","type":"string","description":"Maximo instance username","minLength":1,"examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Maximo instance password","writeOnly":true,"minLength":1,"examples":["@some(!)passowrd"]}},"type":"object","additionalProperties":true,"required":["baseUrl","username","password"]}}, +{"name":"medicmobile","adaptor":"@openfn/language-medicmobile","version":"0.4.2","docs":"\"## Functions\\n\\n
\\n
\\n changesApi(params, callback)
\\n
\\n fetchSubmissions(formId, params, postUrl)
\\n
\\n pickFormData(formId)
\\n
\\n\\n\\n## changesApi\\n\\nchangesApi(params, callback) ⇒ Operation\\nAccess the CouchDB Changes API\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Query parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nchangesApi(params, callback)\\n```\\n\\n* * *\\n\\n## fetchSubmissions\\n\\nfetchSubmissions(formId, params, postUrl) ⇒ Operation\\nAccess form submissions and post them as JSON.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| formId | string | Query parameters |\\n| params | object | Starting sequence id |\\n| postUrl | string | Inbox to post form data |\\n\\n**Example** \\n```js\\nfetchSubmissions(\\n \\\"pregnancy\\\", // formId\\n { \\\"last-event-id\\\": 334 }, // params\\n \\\"http://localhost:4000/inbox/abc-123-xyz\\\" // postUrl\\n);\\n```\\n\\n* * *\\n\\n## pickFormData\\n\\npickFormData(formId) ⇒ Operation\\nSelect submissions for a specific form\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| formId | string | The form ID. |\\n\\n**Example** \\n```js\\npickFormData(formId)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Medic Mobile\\n\\nLanguage Pack for building expressions and operations to make calls to the Medic\\nMobile API. \\n**For an overview of Medic's database, check out\\n[Medic's DB Schema v2](https://github.com/medic/medic-docs/blob/master/development/db-schema.md)** \\nThe exported functions in this language package can be executed by\\n[OpenFn/core](https://github.com/OpenFn/core):\\n\\n```sh\\n../core/lib/cli.js execute -l ./lib/Adaptor -s ./tmp/state.json -e ./tmp/expression.js\\n```\\n\\nFor quick-start help, clone\\n[OpenFn/openfn-devtools](https://github.com/OpenFn/openfn-devtools) and follow\\nthe README.md\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/medicmobile-configuration-schema/)\\ndefinition.\\n\\n#### sample fetchSubmissions expression\\n\\n```js\\nfetchSubmissions(\\n 'pregnancy', // formId\\n { 'last-event-id': 334 }, // params, last-event-id will be replaced by cursor\\n 'http://localhost:4000/inbox/abc-123-xyz' // postUrl\\n);\\n```\\n\\n#### sample changesApi and pickFormData usage\\n\\n```js\\n// get all the changes...\\nchangesApi({\\n include_docs: true,\\n // This only gets used the first time the job is run.\\n // Subsequent runs take the lastSeq value as their cursor.\\n // \\\"last-event-id\\\": 789,\\n});\\n\\n// Picks out the field data for a given formId.\\npickFormData('pregnancy');\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-medicmobile\\n\\n## 0.4.2\\n\\n### Patch Changes\\n\\n- 421fad3: Bump query-string\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 2cd3236: migrate medicmobile\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":["changesApi","fetchSubmissions","pickFormData"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"server":{"title":"Server URL","type":"string","description":"Medic's CouchDB api URL","format":"uri","minLength":1,"examples":["https://standard.app.medicmobile.org"]},"db":{"title":"Database","type":"string","description":"Database name","minLength":1,"examples":["medic"]},"username":{"title":"Username","type":"string","description":"Medic instance username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Medic instance password","writeOnly":true,"minLength":1,"examples":["@super(!)Secret"]}},"type":"object","additionalProperties":true,"required":["server","username","password","db"]}}, +{"name":"mogli","adaptor":"@openfn/language-mogli","version":"0.4.1","docs":"\"## Functions\\n\\n
\\n
\\n cleanupState(state)
\\n
\\n lookup(relationshipName, externalID, path)
\\n
\\n relationship(relationshipName, externalID, dataSource)
\\n
\\n\\n\\n## cleanupState\\n\\ncleanupState(state) ⇒ State\\nRemoves unserializable keys from the state.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n\\n\\n* * *\\n\\n## lookup\\n\\nlookup(relationshipName, externalID, path) ⇒ object\\nAdds a lookup or 'dome insert' to a record.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| relationshipName | string | `__r` relationship field on the record. |\\n| externalID | string | Salesforce ExternalID field. |\\n| path | string | JSONPath to data source. |\\n\\n**Example** *(Example)* \\n```js\\nlookup(\\\"relationship_name__r\\\", \\\"externalID on related object\\\", \\\"$.path\\\")\\n```\\n\\n* * *\\n\\n## relationship\\n\\nrelationship(relationshipName, externalID, dataSource) ⇒ object\\nAdds a lookup or 'dome insert' to a record.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| relationshipName | string | `__r` relationship field on the record. |\\n| externalID | string | Salesforce ExternalID field. |\\n| dataSource | string | resolvable source. |\\n\\n**Example** *(Data Sourced Value)* \\n```js\\nrelationship(\\\"relationship_name__r\\\", \\\"externalID on related object\\\", dataSource(\\\"path\\\"))\\n```\\n**Example** *(Fixed Value)* \\n```js\\nrelationship(\\\"relationship_name__r\\\", \\\"externalID on related object\\\", \\\"hello world\\\")\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Mogli\\n\\nLanguage Pack for building expressions and operations to interact with Mogli\\nSMS.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/mogli-configuration-schema/)\\ndefinition.\\n\\n### Create inbound SMS\\n\\n```js\\ncreateSMS(\\n fields(\\n field('sender', dataValue('from_number')),\\n field('receivedAt', dataValue('timestamp')),\\n field('message', dataValue('message'))\\n )\\n);\\n```\\n\\n\\n\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"v0.1.6\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- 7cc8efc: remove FakeAdaptor references\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- # c6056e8: migrate mogli\\n\\n* State gets cleaned up after the operations are finished. This means that the\\n final state is serializable.\\n\\n The JSForce connection object is provided by `createConnection`, and in turn\\n `execute` ensures it is run before the user's operations.\\n\\n The `cleanupState` reducer simply deletes the connection key from state.\\n\\n# v0.1.3\\n\\n- Bumped language-common dependency to v0.0.4.\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"loginUrl":{"title":"Login URL","type":"string","description":"Mogli instance login URL","format":"uri","minLength":1,"examples":[" https://www.orange-or-airtel-or-vodafone.com/api/"]},"username":{"title":"Username","type":"string","description":"Mogli instance username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Mogli instance password","writeOnly":true,"minLength":1,"examples":["@secret(!)Pass"]},"securityToken":{"title":"Security Token","type":"string","description":"Mogli instance security token","writeOnly":true,"minLength":1,"examples":["dGF5bG9yOnNlY3JldA=="]},"secret":{"title":"Secret","type":"string","description":"Mogli instance secret","writeOnly":true,"minLength":1,"examples":["someotherThiNGfSECret"]}},"type":"object","additionalProperties":true,"required":["loginUrl","username","password","securityToken","secret"]}}, +{"name":"mongodb","adaptor":"@openfn/language-mongodb","version":"2.0.0","docs":"\"## Functions\\n\\n
\\n
\\n connect(state)
\\n
\\n disconnect(state)
\\n
\\n execute(operations)
\\n
\\n findDocuments(params)
\\n
\\n insertDocuments(params)
\\n
\\n updateDocument(params)
\\n
\\n\\n\\n## connect\\n\\nconnect(state) ⇒ State\\nConnects to a mongoDb instance\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | Runtime state. |\\n\\n**Example** \\n```js\\nconnect(state)\\n```\\n\\n* * *\\n\\n## disconnect\\n\\ndisconnect(state) ⇒ State\\nRemoves connection from the state.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n\\n**Example** \\n```js\\ndisconnect(state)\\n```\\n\\n* * *\\n\\n## execute\\n\\nexecute(operations) ⇒ Operation\\nExecute a sequence of operations.\\nWraps `@openfn/language-common/execute`, and prepends initial state for http.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| operations | Operations | Operations to be performed. |\\n\\n**Example** \\n```js\\nexecute(\\n insertDocuments(params),\\n findDocuments(params)\\n)(state)\\n```\\n\\n* * *\\n\\n## findDocuments\\n\\nfindDocuments(params) ⇒ State\\nFind documents in a mongoDb collection\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Configuration for mongo |\\n\\n**Example** \\n```js\\nfindDocuments({\\n database: 'str',\\n collection: 'cases',\\n query: {a:3}\\n });\\n```\\n\\n* * *\\n\\n## insertDocuments\\n\\ninsertDocuments(params) ⇒ State\\nInserts documents into a mongoDb collection\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Configuration for mongo |\\n\\n**Example** \\n```js\\ninsertDocuments({\\n database: 'str',\\n collection: 'kids',\\n documents: [1,2,3]\\n });\\n```\\n\\n* * *\\n\\n## updateDocument\\n\\nupdateDocument(params) ⇒ State\\nUpdates document (optionally upserting) into a mongoDb collection\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Configuration for mongo |\\n\\n**Example** \\n```js\\nupdateDocuments({\\n database: 'str',\\n collection: 'animals',\\n filter: { type: 'fuzzy' },\\n changes: { kind: 'soft' },\\n options: { upsert: true }\\n });\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language MongoDB\\n\\nLanguage Pack for building expressions and operations for use with MongoDB.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/mongodb-configuration-schema/)\\ndefinition.\\n\\n### insertDocuments\\n\\n```js\\ninsertDocuments({\\n database: 'yourDb',\\n collection: 'yourCollection',\\n documents: state => {\\n return state.data.map(item => {\\n return { name: item.name, age: item.age };\\n });\\n },\\n // callback: (state) => state, // optional\\n});\\n```\\n\\n### findDocuments\\n\\n```js\\nfindDocuments({\\n database: 'yourDb',\\n collection: 'yourCollection',\\n query: state => {\\n return { name: 'stu' };\\n },\\n // callback: (state) => state, // optional\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-mongodb\\n\\n## 2.0.0\\n\\n### Major Changes\\n\\n- Update configuration schema for MongoDB adaptor:\\n - Rename `clusterUrl` to `clusterHostname`\\n - Change `clusterHostname` format from `uri` to `hostname`\\n - Update `Adaptor.js` and tests to use new name\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.0.6\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.0.5\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"clusterHostname":{"title":"Cluster Hostname","type":"string","description":"Your MongoDB cluster hostname","format":"hostname","minLength":1,"examples":["yourCluster-xxxyzzz.mongodb.net"]},"username":{"title":"Username","type":"string","description":"Your MongoDB instance username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Your MongoDB instance password","writeOnly":true,"minLength":1,"examples":["@secret(!)Pass"]}},"type":"object","additionalProperties":true,"required":["clusterHostname","username","password"]}}, +{"name":"msgraph","adaptor":"@openfn/language-msgraph","version":"0.4.0","docs":"\"## Functions\\n\\n
\\n
\\n create(resource, data, callback)
\\n
\\n get(path, query, callback)
\\n
\\n getDrive(specifier, name, [callback])
\\n
\\n getFile(pathOrId, options, [callback])
\\n
\\n getFolder(pathOrId, options, [callback])
\\n
\\n sheetToBuffer(rows, options)
\\n
\\n uploadFile(resource, data, callback)
\\n
\\n\\n\\n## create\\n\\ncreate(resource, data, callback) ⇒ Operation\\nCreate some resource in msgraph\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resource | string | The type of entity that will be created |\\n| data | object | The data to create the new resource |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ncreate(\\\"applications\\\", {\\\"displayName\\\": \\\"My App\\\"})\\n```\\n\\n* * *\\n\\n## get\\n\\nget(path, query, callback) ⇒ Operation\\nMake a GET request to msgraph resource\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| query | object | Query, Headers and Authentication parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nget('sites/root/lists')\\n```\\n\\n* * *\\n\\n## getDrive\\n\\ngetDrive(specifier, name, [callback]) ⇒ Operation\\nGet a Drive or SharePoint document library. The drive metadata will be written\\nto state.drives, where it can be used by other adaptor functions.\\nPass { id } to get a drive by id or { id, owner } to get default drive for\\nsome parent resource, like a group\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| specifier | Object | | A definition of the drive to retrieve - id {string} - The ID of the resource or owner. - owner {string} - The type of drive owner (e.g. sites, groups). |\\n| name | string | | The local name of the drive used to write to state.drives, ie, state.drives[name] |\\n| [callback] | function | s => s | (Optional) Callback function |\\n\\n**Example** *(Get a drive by ID)* \\n```js\\ngetDrive({ id: \\\"YXzpkoLwR06bxC8tNdg71m\\\" })\\n```\\n**Example** *(Get the default drive for a site)* \\n```js\\ngetDrive({ id: \\\"openfn.sharepoint.com\\\", owner: \\\"sites\\\" })\\n```\\n\\n* * *\\n\\n## getFile\\n\\ngetFile(pathOrId, options, [callback]) ⇒ Operation\\nGet file metadata or file content.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| pathOrId | string | | A path to a file or file id |\\n| options | object | | (Optional) Query parameters |\\n| [callback] | function | s => s | (Optional) Callback function |\\n\\n**Example** *(Get a file by ID)* \\n```js\\ngetFile('01LUM6XOGRONYNTZ26DBBJPTN5IFTQPBIW')\\n```\\n**Example** *(Get a file for a named drive by id)* \\n```js\\ngetFile(\\\"01LUM6XOGRONYNTZ26DBBJPTN5IFTQPBIW\\\",{ driveName: \\\"mydrive\\\"})\\n```\\n\\n* * *\\n\\n## getFolder\\n\\ngetFolder(pathOrId, options, [callback]) ⇒ Operation\\nGet the contents or metadata of a folder.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| pathOrId | string | | A path to a folder or folder id |\\n| options | object | | (Optional) Query parameters |\\n| [callback] | function | s => s | (Optional) Callback function |\\n\\n**Example** *(Get a folder by ID)* \\n```js\\ngetFolder('01LUM6XOCKDTZKQC7AVZF2VMHE2I3O6OY3')\\n```\\n**Example** *(Get a folder for a named drive by id)* \\n```js\\ngetFolder(\\\"01LUM6XOCKDTZKQC7AVZF2VMHE2I3O6OY3\\\",{ driveName: \\\"mydrive\\\"})\\n```\\n\\n* * *\\n\\n## request\\n\\nrequest ⇒\\nThis is an asynchronous function that sends a request to a specified URL with optional parameters\\nand headers, and returns the response data in JSON format.\\n\\n**Kind**: global constant \\n**Returns**: The `request` function is returning the parsed JSON data from the response of the HTTP\\nrequest made to the specified `url` with the given `params` and `method`. If there is an error in\\nthe response, the function will throw an error. \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| url | string | The URL of the API endpoint that the request is being made to. |\\n| [options] | object | An object containing any additional parameters to be sent with the request, such as query parameters or request body data. It is an optional parameter and defaults to an empty object if not provided. |\\n\\n\\n* * *\\n\\n## sheetToBuffer\\n\\nsheetToBuffer(rows, options) ⇒\\nThe function `sheetToBuffer` takes in rows, options and optional callback, It creates a workbook\\nand worksheet using the rows, appends the worksheet to the workbook, and returns the workbook as a\\nbuffer.\\n\\n**Kind**: global function \\n**Returns**: a buffer containing the Excel file in `state.buffer`. \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| rows | | The `rows` parameter is an array of objects representing the data to be written to the Excel sheet. Each object in the array represents a row in the sheet, and the keys of the object represent the column headers. The values of the object represent the data in each cell of the row. |\\n| options | | The `options` parameter is an object that contains additional configuration options |\\n| [options.wsName] | String | Worksheet name i.e 32 Characters |\\n| [options.bookType] | String | File format of the exported file, Default is 'xlsx'. See [here](https://docs.sheetjs.com/docs/api/write-options/#supported-output-formats) for the function. It can have the following properties: |\\n\\n**Example** *(Create a buffer containing excel file with `xlsx` output format )* \\n```js\\nsheetToBuffer('$.data[*]', {\\n wsName: 'Invalid Grant Codes',\\n bookType: 'xlsx',\\n});\\n```\\n\\n* * *\\n\\n## uploadFile\\n\\nuploadFile(resource, data, callback) ⇒ Operation\\nUpload a file to a drive\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resource | Object | Resource Object |\\n| [resource.driveId] | String | Drive Id |\\n| [resource.driveId] | String | Site Id |\\n| [resource.folderId] | String | Parent folder id |\\n| [resource.contentType] | String | Resource content-type |\\n| [resource.onConflict] | String | Specify conflict behavior if file with the same name exists. Can be \\\"rename | fail | replace\\\" |\\n| data | Object | A buffer containing the file. |\\n| callback | function | Optional callback function |\\n\\n**Example** *(Upload Excel file to a drive using `driveId` and `parantItemId`)* \\n```js\\nuploadFile(\\n state => ({\\n driveId: state.driveId,\\n folderId: state.folderId,\\n fileName: `Tracker.xlsx`,\\n }),\\n state => state.buffer\\n);\\n```\\n**Example** *(Upload Excel file to a SharePoint drive using `siteId` and `parantItemId`)* \\n```js\\nuploadFile(\\n state => ({\\n siteId: state.siteId,\\n folderId: state.folderId,\\n fileName: `Report.xlsx`,\\n }),\\n state => state.buffer\\n);\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-msgraph \\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the\\n[Microsoft Graph API](https://learn.microsoft.com/en-us/graph/use-the-api).\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/msgraph-docs) for\\nfull technical documentation.\\n\\n### Configuration\\n\\nView the\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/msgraph-configuration-schema/)\\nfor required and optional `configuration` properties.\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n\\\"Getting Started\\\" guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build _only_ the docs run `pnpm build docs`.\\n\"","changelog":"\"# @openfn/language-msgraph\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 4cd6587: Add `uploadFile` and `sheetToBuffer` function\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 0.3.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- 1c183e9: Fix getFile unit tests\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- b90e8a2: Add support for stream\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- 9cc4952: fix url in request util\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- f45f477: Clean-up state before throwing an error\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 9366e53: - Switch from `nodejs` default `fetch` to `undici` `fetch`\\n - Added the following `sharepoint` functions\\n - `getDrive()`\\n - `getFolder()`\\n - `getFile()`\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- d33c0ee: export parseCsv from common\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 0.1.1\\n\\n### Patch Changes\\n\\n- aad9549: Ensure that standard OAuth2 credentials with snake-cased\\n \\\"access_token\\\" keys can be used for OAuth2-reliant adaptors\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 0.1.0\\n\\n### Minor Changes\\n\\n- 93d82a8: Add msgraph adaptor with get() and create() functions\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\"","functions":["create","get","getDrive","getFile","getFolder","uploadFile"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","$comment":"OAuth2","properties":{"apiVersion":{"title":"API Version","anyOf":[{"type":"string"},{"type":"null"}],"placeholder":"v1.0","description":"Microsoft Graph api version","minLength":1,"examples":["v1.0","beta"]},"access_token":{"title":"Access Token","type":"string","description":"Your Microsoft Graph access token","writeOnly":true,"minLength":1,"examples":["eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRl"]}},"type":"object","additionalProperties":true,"required":["access_token"]}}, +{"name":"mssql","adaptor":"@openfn/language-mssql","version":"4.1.8","docs":"\"## Functions\\n\\n
\\n
\\n addRowsToRefs(state, rows)
\\n
\\n cleanupState(state)
\\n
\\n createConnection(state)
\\n
\\n describeTable(tableName, options)
\\n
\\n findValue(filter)
\\n
\\n flattenRows(state, rows)
\\n
\\n insert(table, record, options)
\\n
\\n insertMany(table, records, options)
\\n
\\n insertTable(tableName, columns, options)
\\n
\\n modifyTable(tableName, columns, options)
\\n
\\n sql(params)
\\n
\\n upsert(table, uuid, record, options)
\\n
\\n upsertIf(logical, table, uuid, record, options)
\\n
\\n upsertMany(table, uuid, records, options)
\\n
\\n\\n\\n## addRowsToRefs\\n\\naddRowsToRefs(state, rows) ⇒ State\\nSets the returned rows from a query as the first item in the state.references\\narray, leaving state.data unchanged between operations.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | |\\n| rows | array | the array of rows returned from the sql query |\\n\\n\\n* * *\\n\\n## cleanupState\\n\\ncleanupState(state) ⇒ State\\nRemoves unserializable keys from the state.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n\\n**Example** \\n```js\\ncleanupState(state)\\n```\\n\\n* * *\\n\\n## createConnection\\n\\ncreateConnection(state) ⇒ State\\nCreates a connection.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | Runtime state. |\\n\\n**Example** \\n```js\\ncreateConnection(state)\\n```\\n\\n* * *\\n\\n## describeTable\\n\\ndescribeTable(tableName, options) ⇒ Operation\\nList the columns of a table in a database.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| tableName | string | The name of the table to describe |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\ndescribeTable('clinic_visits')\\n```\\n\\n* * *\\n\\n## findValue\\n\\nfindValue(filter) ⇒ Operation\\nFetch a uuid key given a condition\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| filter | object | A filter object with the lookup table, a uuid and the condition |\\n\\n**Example** \\n```js\\nfindValue({\\n uuid: 'id',\\n relation: 'users',\\n where: { first_name: 'Mama%', last_name: 'Cisse'},\\n operator: { first_name: 'like', last_name: '='}\\n })\\n```\\n\\n* * *\\n\\n## flattenRows\\n\\nflattenRows(state, rows) ⇒ State\\nReturns a flatten object of the rows (array of arrays) with rowCount.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | |\\n| rows | array | the array of rows returned from the sql query |\\n\\n\\n* * *\\n\\n## insert\\n\\ninsert(table, record, options) ⇒ Operation\\nInsert a record\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| record | object | Payload data for the record as a JS object |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\ninsert(table, record, {setNull: [\\\"'undefined'\\\", \\\"''\\\"], logValues: false})\\n```\\n\\n* * *\\n\\n## insertMany\\n\\ninsertMany(table, records, options) ⇒ Operation\\nInsert many records, using the keys of the first as the column template\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| records | function | A function that takes state and returns an array of records |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\ninsertMany(table, records, { setNull: false, writeSql: true, logValues: false })\\n```\\n\\n* * *\\n\\n## insertTable\\n\\ninsertTable(tableName, columns, options) ⇒ Operation\\nCreate a table in database when given an array of columns and a table_name.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| tableName | string | The name of the table to create |\\n| columns | array | An array of form columns |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\ninsertTable('table_name', state => state.data.map(\\n column => ({\\n name: column.name,\\n type: column.type,\\n required: true, // optional\\n unique: false, // optional - to be set to true for unique constraint\\n })\\n));\\n```\\n\\n* * *\\n\\n## modifyTable\\n\\nmodifyTable(tableName, columns, options) ⇒ Operation\\nAlter an existing table in the database.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| tableName | string | The name of the table to alter |\\n| columns | array | An array of form columns |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\nmodifyTable('table_name', state => state.data.map(\\n newColumn => ({\\n name: newColumn.name,\\n type: newColumn.type,\\n required: true, // optional\\n unique: false, // optional - to be set to true for unique constraint\\n })\\n));\\n```\\n\\n* * *\\n\\n## sql\\n\\nsql(params) ⇒ Operation\\nExecute an SQL statement\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Payload data for the message |\\n\\n**Example** \\n```js\\nsql({ query, options })\\n```\\n\\n* * *\\n\\n## upsert\\n\\nupsert(table, uuid, record, options) ⇒ Operation\\nInsert or update a record using SQL MERGE\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| uuid | string | The uuid column to determine a matching/existing record |\\n| record | object | Payload data for the record as a JS object |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\nupsert(table, uuid, record, { setNull: \\\"'undefined'\\\", logValues: false})\\nupsert(table, [uuid1, uuid2], record, { setNull: \\\"'undefined'\\\", logValues: false})\\n```\\n\\n* * *\\n\\n## upsertIf\\n\\nupsertIf(logical, table, uuid, record, options) ⇒ Operation\\nInsert or update a record based on a logical condition using ON CONFLICT UPDATE\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| logical | string | a data to check existing value for. |\\n| table | string | The target table |\\n| uuid | string | The uuid column to determine a matching/existing record |\\n| record | object | Payload data for the record as a JS object or function |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\nupsertIf(\\n dataValue('name'),\\n 'users', // the DB table\\n 'uuid', // a DB column with a unique constraint\\n { name: 'Elodie', id: 7 },\\n { writeSql:true, execute: true, logValues: false }\\n)\\n```\\n\\n* * *\\n\\n## upsertMany\\n\\nupsertMany(table, uuid, records, options) ⇒ Operation\\nInsert or update multiple records using ON CONFLICT UPDATE and excluded\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| uuid | string | The uuid column to determine a matching/existing record |\\n| records | function | A function that takes state and returns an array of records |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\nupsertMany(\\n 'users', 'email', records, { logValues: false }\\n)\\nupsertMany(\\n 'users', ['email', 'phone'], records, { logValues: false }\\n)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language MSSQL\\n\\nLanguage Pack for connecting to Azure SQL Server via OpenFn.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/mssql-configuration-schema/)\\ndefinition.\\n\\n### Sample expression\\n\\n## sql query\\n\\n```js\\nsql({\\n query: `\\n SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES\\n WHERE TABLE_TYPE = 'BASE TABLE'\\n AND TABLE_CATALOG='my-demo'\\n `,\\n});\\n\\nsql({\\n query: `SELECT * FROM Household`,\\n options: {\\n writeSql: true, // Keep to true to log query (otherwise make it false).\\n execute: true, // keep to false to not alter DB\\n },\\n});\\n```\\n\\n## Find a single value for a table\\n\\nThis helper function allows to build a specific query where `sql` would not be\\nbest suited. It returns a single value and not a promise. An example of usage\\nwould be in building a mapping object with a value from a lookup table.\\n\\n```js\\nfn(async state => {\\n const user = {\\n id: 1,\\n name: 'Mamadou',\\n user_id: await findValue({\\n uuid: 'id',\\n relation: 'users',\\n where: { first_name: 'Mama%' },\\n operator: { first_name: 'like' }, // operator is optional. \\\"=\\\" is used by default.\\n })(state),\\n };\\n\\n return upsert(...)(state);\\n});\\n```\\n\\n## Insert one single record\\n\\n```js\\ninsert(\\n 'SomeDB.dbo.SupplierTest',\\n {\\n SupplierNumber: 1,\\n Name: dataValue('name'),\\n Address: 'Nunya Bihz-Nash',\\n },\\n {\\n // The optional `options` argument allows for global string replacement with\\n // NULL. This is useful if you want to map an undefined value (e.g., x.name)\\n // to NULL. It can be a single string or an array of strings.\\n // It DEFAULTS to \\\"'undefined'\\\", and can be turned off w/ `false`.\\n setNull: \\\"'undefined'\\\",\\n logValues: true,\\n }\\n);\\n```\\n\\n## Insert or Update using a unique column as a key\\n\\nThis function insert or update depending on the existence of a record in the\\ndatabase.\\n\\n```js\\nupsert(\\n 'SomeDB.dbo.Supplier',\\n 'SupplierNumber',\\n {\\n SupplierNumber: 1,\\n Name: dataValue('name'),\\n Address: 'Now I can tell!',\\n },\\n // Do NOT replace any instances of 'undefined' in the final SQL statement.\\n { setNull: false, logValues: true }\\n);\\n```\\n\\n## Insert or Update if a value exist in the record\\n\\nThis function will upsert a record only if the logical given is true. In this\\ncase we check if `dataValue('name')` exists.\\n\\n```js\\nupsertIf(\\n dataValue('name'),\\n 'users',\\n 'user_id',\\n {\\n name: 'Elodie',\\n id: 7,\\n },\\n // Replace any occurence of '' and 'undefined' to NULL\\n {\\n setNull: [\\\"''\\\", \\\"'undefined'\\\"],\\n writeSql: true,\\n execute: false,\\n logValues: true,\\n }\\n);\\n```\\n\\n## Insert Many records\\n\\nThis function allows the insert of a set of records inside a table all at once.\\nPass `logQuery` option to `true` to display the query.\\n\\n```js\\n// Note that insertMany takes a function which returns an array—this helps\\n// enforce that each item in the array has the same keys.\\ninsertMany(\\n 'SomeDB.dbo.Supplier',\\n state =>\\n state.data.supplierArray.map(s => {\\n return {\\n SupplierNumber: s.id,\\n Name: s.name,\\n Address: s.address,\\n };\\n }),\\n { writeSql: true, logValues: true }\\n);\\n```\\n\\n## Insert or Update Many records\\n\\nThis function inserts or updates many records all at once depending on their\\nexistence in the database.\\n\\n```js\\n// Note that insertMany takes a function which returns an array—this helps\\n// enforce that each item in the array has the same keys.\\nupsertMany(\\n 'SomeDB.dbo.Supplier',\\n 'SupplierNumber',\\n state =>\\n state.data.supplierArray.map(s => {\\n return {\\n SupplierNumber: s.id,\\n Name: s.name,\\n Address: s.address,\\n };\\n }),\\n { writeSql: true, execute: false, logValues: true }\\n);\\n```\\n\\nIn case we need to check on multiple columns before upserting, we can have an\\narray of `uuids`.\\n\\n```js\\nupsertMany(\\n 'SomeDB.dbo.Supplier',\\n ['SupplierNumber', 'SupplierCode'],\\n state =>\\n state.data.supplierArray.map(s => {\\n return {\\n SupplierNumber: s.id,\\n Name: s.name,\\n Address: s.address,\\n SupplierCode: s.code,\\n };\\n }),\\n { writeSql: true, execute: false, logValues: true }\\n);\\n```\\n\\n## Describe a table from mssql\\n\\nThis function is used to fetch the list of columns of a given table in the\\ndatabase.\\n\\n```js\\ndescribeTable('users', { writeSql: false, execute: true });\\n```\\n\\n## Create a table in the database\\n\\nThis function allows to create a table in a database from a given array of\\ncolumns. The key `identity` can be use for a column to auto-generate a value.\\n\\n```js\\ninsertTable('users', state =>\\n state.data.map(column => ({\\n name: column.name,\\n type: column.type,\\n required: true, // optional\\n unique: false, // optional - set to true for unique constraint\\n }))\\n);\\n```\\n\\n## Alter a table in the database\\n\\nThis function allows to add new columns to a table. Beware of the fact that you\\ncannot add new columns with names that already exist in the table.\\n\\n```js\\nmodifyTable(\\n 'users',\\n state =>\\n state.data.map(newColumn => ({\\n name: newColumn.name,\\n type: newColumn.type,\\n required: true, // optional\\n unique: false, // optional - set to true for unique constraint\\n })),\\n { writeSql: false, execute: true }\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-mssql\\n\\n## 4.1.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 4.1.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 4.1.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 4.1.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 4.1.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 4.1.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 4.1.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 4.1.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 4.1.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 4.0.8\\n\\n### Patch Changes\\n\\n- 57742d1: remove request dependency\\n\\n## 4.0.7\\n\\n### Patch Changes\\n\\n- 04ed74f: update dependencies\\n\\n## 4.0.6\\n\\n### Patch Changes\\n\\n- 43c3669: patch versions\\n\\n## 4.0.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 4.0.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 4.0.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 4.0.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 4.0.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 4.0.0\\n\\n### Major Changes\\n\\n- 3878624: Modify composeNextState function, to flattern all rows into an array\\n of rows with their corresponding column names\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 3.1.1\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 3.1.0\\n\\n### Minor Changes\\n\\n- c9b7ed7: Add language-mssql in monorepo\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\"","functions":["describeTable","findValue","insert","insertMany","insertTable","modifyTable","sql","upsert","upsertIf","upsertMany"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"server":{"title":"Server URL","type":"string","description":"The database instance server URL or IP address","format":"uri","minLength":1,"examples":["something.database.windows.net"]},"database":{"title":"Database","type":"string","description":"The database name","minLength":1,"examples":["demo-db"]},"userName":{"title":"Username","type":"string","description":"Username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"minLength":1,"examples":["@super(!)Password"]}},"type":"object","additionalProperties":true,"required":["server","database"]}}, +{"name":"mysql","adaptor":"@openfn/language-mysql","version":"1.4.8","docs":"\"## Functions\\n\\n
\\n
\\n insert(table, fields)
\\n
\\n query(options)
\\n
\\n sqlString(queryString)
\\n
\\n upsert(table, fields)
\\n
\\n upsertMany(table, data)
\\n
\\n\\n\\n## insert\\n\\ninsert(table, fields) ⇒ Operation\\nInsert a record\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| fields | object | A fields object |\\n\\n**Example** \\n```js\\nexecute(\\n insert('table', fields(\\n field('name', dataValue('name'))\\n ))\\n)(state)\\n```\\n\\n* * *\\n\\n## query\\n\\nquery(options) ⇒ Operation\\nExecute a SQL statement\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| options | object | Payload data for the message |\\n\\n**Example** \\n```js\\nexecute(\\n query({ sql: 'select * from users;' })\\n)(state)\\n```\\n\\n* * *\\n\\n## sqlString\\n\\nsqlString(queryString) ⇒ Operation\\nExecute a SQL statement\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| queryString | String | A query string (or function which takes state and returns a string) |\\n\\n**Example** \\n```js\\nexecute(\\n sqlString(state => \\\"select * from items;\\\")\\n)(state)\\n```\\n\\n* * *\\n\\n## upsert\\n\\nupsert(table, fields) ⇒ Operation\\nInsert or Update a record if matched\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| fields | object | A fields object |\\n\\n**Example** \\n```js\\nexecute(\\n upsert('table', fields(\\n field('name', dataValue('name'))\\n ))\\n)(state)\\n```\\n\\n* * *\\n\\n## upsertMany\\n\\nupsertMany(table, data) ⇒ Operation\\nInsert or update multiple records using ON DUPLICATE KEY\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| data | array | An array of objects or a function that returns an array |\\n\\n**Example** \\n```js\\nupsertMany(\\n 'users', // the DB table\\n [\\n { name: 'one', email: 'one@openfn.org' },\\n { name: 'two', email: 'two@openfn.org' },\\n ]\\n)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language MySQL\\n\\nLanguage Pack for building expressions and operations to run MySQL queries.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/mysql-docs) for\\nfull technical documentation.\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/mysql-configuration-schema/)\\ndefinition.\\n\\n## Execute a query\\n\\nExecute an sql query with the node mysql package.\\n\\n```js\\nquery({\\n sql: state => {\\n return `select * from ${state.data.table} where id = ?;`;\\n },\\n timeout: 4000,\\n values: ['007'],\\n});\\n```\\n\\n## Execute a sql query\\n\\nThis function takes either a `string` or a `function` that takes states and\\nreturns a string.\\n\\n```js\\nsqlString(state => {\\n return (\\n `INSERT INTO untitled_table (name, the_geom) VALUES ('` +\\n state.data.version +\\n `', ` +\\n dataValue('form.Choix_tache')(state) +\\n `)`\\n );\\n});\\n```\\n\\n## Insert a single record\\n\\nThis function is used to insert a single record in a MySQL database.\\n\\n```js\\ninsert(\\n 'some_table',\\n fields(\\n field('firstname', dataValue('form.patient_firstname')),\\n field('lastname', dataValue('form.patient_lastname'))\\n )\\n);\\n```\\n\\n## Insert or update a single record\\n\\nThis function is used to insert a single record in a MySQL database or update it\\nif there is a match.\\n\\n```js\\nupsert(\\n 'some_table',\\n fields(\\n field('firstname', dataValue('form.patient_firstname')),\\n field('lastname', dataValue('form.patient_lastname'))\\n )\\n);\\n```\\n\\n## Upsert many records\\n\\nThis function allows the upsert of a set of records inside a table all at once.\\n\\n```js\\nupsertMany(\\n 'users', // the DB table\\n [\\n { name: 'one', email: 'one@openfn.org' },\\n { name: 'two', email: 'two@openfn.org' },\\n ]\\n);\\n```\\n\\nor\\n\\n```js\\nupsertMany('users', state =>\\n state.data.users.map(user => {\\n name: user['name'],\\n email: user['email']\\n })\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-mysql\\n\\n## 1.4.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 1.4.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 1.4.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 1.4.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 1.4.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 1.4.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 1.4.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 1.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.3.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 1.3.4\\n\\n### Patch Changes\\n\\n- ef828e7: update old urls in readme\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.3.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.3.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.3.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.3.0\\n\\n### Minor Changes\\n\\n- 9d674c5: Migrate MySQL\\n\"","functions":["upsertMany"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"host":{"title":"Host URL","type":"string","description":"The database instance host URL","format":"uri","minLength":1,"examples":["some-host-url.compute-1.amazonaws.com"]},"port":{"title":"Port","type":"integer","default":3306,"description":"Database instance port","minLength":1,"examples":[3306]},"database":{"title":"Database","type":"string","description":"The database name","minLength":1,"examples":["demo-db"]},"user":{"title":"Username","type":"string","description":"The username to log in the database","minLength":1,"examples":["admin-demo"]},"password":{"title":"Password","type":"string","description":"The password to log in the database","writeOnly":true,"minLength":1,"examples":["@super(!)Secretpass"]}},"type":"object","additionalProperties":true,"required":["host","database"]}}, +{"name":"nexmo","adaptor":"@openfn/language-nexmo","version":"0.4.3","docs":"\"## sendSMS\\n\\nsendSMS(from, toNumber, message) ⇒ Operation\\nSends an SMS message to a specific phone number\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| from | String | Name or number the message should be sent from. |\\n| toNumber | String | Destination phone number. |\\n| message | String | Text message |\\n\\n**Example** \\n```js\\nsendSMS(\\\"OpenFn\\\", \\\"phoneNumber\\\", \\\"Hello World!\\\")\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Nexmo\\n\\nLanguage Pack for building expressions and operations to interact with the Nexmo\\nAPI.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/nexmo-configuration-schema/)\\ndefinition.\\n\\n### sendSMS\\n\\n#### sample expression\\n\\n```js\\nsendSMS('OpenFn', '0123456789', 'HelloWorld!');\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-nexmo\\n\\n## 0.4.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 0.4.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 8591b67: - update nexmo to `v2.9.1``\\n - expandReferences on sendSMS\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.2.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.2.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- f0f2495: migrate nexmo\\n\"","functions":["sendSMS"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"apiKey":{"title":"API Key","type":"string","description":"Your Nexmo API Key","minLength":1,"examples":["mYaP1K3y"]},"apiSecret":{"title":"API Secret","type":"string","description":"Your Nexmo API Secret key","writeOnly":true,"minLength":1,"examples":["supersecret"]}},"type":"object","additionalProperties":true,"required":["apiKey","apiSecret"]}}, +{"name":"ocl","adaptor":"@openfn/language-ocl","version":"1.1.7","docs":"\"## Functions\\n\\n
\\n
\\n get(path, query, callback)
\\n
\\n getMappings(ownerId, repositoryId, [options], callback)
\\n
\\n\\n\\n## get\\n\\nget(path, query, callback) ⇒ Operation\\nGet a resource in OCL\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| query | object | A query object that will limit what resources are retrieved when converted into request params. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nget(\\n \\\"orgs/MSFOCG/collections/lime-demo/HEAD/mappings\\\",\\n {\\n page: 1,\\n exact_match: \\\"off\\\",\\n limit: 200,\\n verbose: false,\\n sortDesc: \\\"_score\\\",\\n },\\n (state) => {\\n // Add state oclMappings\\n const oclMappings = state.data;\\n return { ...state, data: {}, references: [], response: {}, oclMappings };\\n }\\n);\\n```\\n\\n* * *\\n\\n## getMappings\\n\\ngetMappings(ownerId, repositoryId, [options], callback) ⇒ Operation\\nGet a source repository in OCL\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| ownerId | string | An OCL user or organization |\\n| repositoryId | string | An OCL collection id or source id |\\n| [options] | Object | Optional. `options` which can be passed to See more [on OCL swagger docs](https://api.openconceptlab.org/swagger/) |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ngetMappings(\\n \\\"MSFOCG\\\",\\n \\\"lime-demo\\\",\\n { page: 1, exact_match: \\\"off\\\", verbose: false },\\n (state) => {\\n // Add state oclMappings\\n const oclMappings = state.data;\\n return { ...state, data: {}, references: [], response: {}, oclMappings };\\n }\\n);\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language OCL\\n\\nLanguage Pack for building expressions and operations for working with the\\n[OCL API](http://ocl.github.io/ocl-docs/master/en/developer/html/ocl_developer_manual.html).\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/ocl-configuration-schema/)\\ndefinition.\\n\\n## Mapping source concepts to destination API\\n\\n#### Recieve form data from source application and convert data element keys to destination application.\\n\\n```js\\nmap( \\\"data\\\": {\\n \\\"a\\\": 1,\\n \\\"b\\\": 2},\\n {users:\\\"haftamuk\\\", sources: \\\"eCHIS-CODES\\\", concepts: \\\"fp_new_at_10_to_14\\\" }\\n );\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-ocl\\n\\n## 1.1.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 1.1.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 1.1.5\\n\\n### Patch Changes\\n\\n- 67a09fb: Add `fn` in OCL adaptor\\n\\n## 1.1.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 1.1.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 1.1.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- 3f3c0c5: update tests\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- 29e335d: remove body in get request\\n\\n## 1.0.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 1.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 63232eb: Add `get()` and `getMappings()` function\\n\\n## 0.2.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 0.2.5\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.2.4\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.2.3\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.2.2\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- 5a06d7f: Migrate OCL, update package export\\n\\n### Patch Changes\\n\\n- cb5d0ed: Updated to @openfn/simple-ast v0.4.1\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\"","functions":["get","getMappings"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"hostUrl":{"title":"Host URL","type":"string","description":"The OCL API URL","default":"https://api.openconceptlab.org/","format":"uri","minLength":1,"examples":["https://api.openconceptlab.org/"]},"username":{"title":"Username","type":"string","description":"The username to log in to OCL","minLength":1,"examples":["usernmame"]},"password":{"title":"Password","type":"string","description":"The password to log in to OCL","writeOnly":true,"minLength":1,"examples":["supersecretpassword"]}},"type":"object","additionalProperties":true,"required":["hostUrl","username","password"]}}, +{"name":"openfn","adaptor":"@openfn/language-openfn","version":"1.3.8","docs":"\"## request\\n\\nrequest(options, callback) ⇒ Operation\\nMake a POST request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| options | object | Body, Query, Headers and Authentication parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nrequest({method: 'get', path: '/jobs/});\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language OpenFn\\n\\nAdaptor for building expressions and operations to interact with the OpenFn v1\\nAPI.\\n\\n## Documentation\\n\\n## request\\n\\n```js\\nrequest({\\n method: 'get',\\n path: 'jobs',\\n params: {\\n project_id: 490,\\n },\\n});\\nrequest(\\n {\\n method: 'post',\\n path: 'jobs',\\n data: {\\n trigger_id: 1,\\n expression: 'steps()',\\n },\\n },\\n state => {\\n console.log('cool callback!');\\n return state;\\n }\\n);\\n```\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/openfn-configuration-schema/)\\ndefinition.\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-openfn\\n\\n## 1.3.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 1.3.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 1.3.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 1.3.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 1.3.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 1.3.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 1.3.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 1.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.2.6\\n\\n### Patch Changes\\n\\n- 779596f: Use native fetch (undici) in template and add icons in openfn\\n\\n## 1.2.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 1.2.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.2.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.2.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.2.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- be9d3c6: Migrate OpenFn\\n\"","functions":["request"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"host":{"title":"Host","type":"string","description":"The OpenFn host url","format":"uri","default":"https://www.openfn.org","minLength":1,"examples":["https://www.openfn.org"]},"projectId":{"title":"Project ID","type":"string","description":"Your OpenFn project ID","minLength":1,"examples":["some-id"]},"username":{"title":"Username","type":"string","description":"The username to log in to OpenFn","minLength":1,"examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"The password to log in to OpenFn","writeOnly":true,"minLength":1,"examples":["@super(!)Secretpass"]}},"type":"object","additionalProperties":true,"required":["host","username","password"]}}, +{"name":"openhim","adaptor":"@openfn/language-openhim","version":"0.2.1","docs":"\"## encounter\\n\\nencounter(encounterData) ⇒ Operation\\nCreate an encounter\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| encounterData | object | Payload data for the encounter |\\n\\n**Example** \\n```js\\nexecute(\\n encounter(data)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language OpenHIM\\n\\nLanguage Pack for building expressions and operations for working with the\\nopenhim API.\\n\\n## [HL7 FHIR Standard](https://www.hl7.org/fhir/patient-example.json.html)\\n\\n```json\\n{\\n \\\"resourceType\\\": \\\"Patient\\\",\\n \\\"id\\\": \\\"example\\\",\\n \\\"text\\\": {\\n \\\"status\\\": \\\"generated\\\",\\n \\\"div\\\": \\\"
\\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n
NamePeter James \\\\n Chalmers ("Jim")\\\\n
Address534 Erewhon, Pleasantville, Vic, 3999
ContactsHome: unknown. Work: (03) 5555 6473
IdMRN: 12345 (Acme Healthcare)
\\\\n \\\\n
\\\"\\n },\\n \\\"identifier\\\": [\\n {\\n \\\"fhir_comments\\\": [\\\" MRN assigned by ACME healthcare on 6-May 2001 \\\"],\\n \\\"use\\\": \\\"usual\\\",\\n \\\"type\\\": {\\n \\\"coding\\\": [\\n {\\n \\\"system\\\": \\\"http://hl7.org/fhir/v2/0203\\\",\\n \\\"code\\\": \\\"MR\\\"\\n }\\n ]\\n },\\n \\\"system\\\": \\\"urn:oid:1.2.36.146.595.217.0.1\\\",\\n \\\"value\\\": \\\"12345\\\",\\n \\\"period\\\": {\\n \\\"start\\\": \\\"2001-05-06\\\"\\n },\\n \\\"assigner\\\": {\\n \\\"display\\\": \\\"Acme Healthcare\\\"\\n }\\n }\\n ],\\n \\\"active\\\": true,\\n \\\"name\\\": [\\n {\\n \\\"fhir_comments\\\": [\\\" Peter James Chalmers, but called \\\\\\\"Jim\\\\\\\" \\\"],\\n \\\"use\\\": \\\"official\\\",\\n \\\"family\\\": [\\\"Chalmers\\\"],\\n \\\"given\\\": [\\\"Peter\\\", \\\"James\\\"]\\n },\\n {\\n \\\"use\\\": \\\"usual\\\",\\n \\\"given\\\": [\\\"Jim\\\"]\\n }\\n ],\\n \\\"telecom\\\": [\\n {\\n \\\"fhir_comments\\\": [\\\" home communication details aren't known \\\"],\\n \\\"use\\\": \\\"home\\\"\\n },\\n {\\n \\\"system\\\": \\\"phone\\\",\\n \\\"value\\\": \\\"(03) 5555 6473\\\",\\n \\\"use\\\": \\\"work\\\"\\n }\\n ],\\n \\\"gender\\\": \\\"male\\\",\\n \\\"_gender\\\": {\\n \\\"fhir_comments\\\": [\\\" use FHIR code system for male / female \\\"]\\n },\\n \\\"birthDate\\\": \\\"1974-12-25\\\",\\n \\\"_birthDate\\\": {\\n \\\"extension\\\": [\\n {\\n \\\"url\\\": \\\"http://hl7.org/fhir/StructureDefinition/patient-birthTime\\\",\\n \\\"valueDateTime\\\": \\\"1974-12-25T14:35:45-05:00\\\"\\n }\\n ]\\n },\\n \\\"deceasedBoolean\\\": false,\\n \\\"address\\\": [\\n {\\n \\\"use\\\": \\\"home\\\",\\n \\\"type\\\": \\\"both\\\",\\n \\\"line\\\": [\\\"534 Erewhon St\\\"],\\n \\\"city\\\": \\\"PleasantVille\\\",\\n \\\"district\\\": \\\"Rainbow\\\",\\n \\\"state\\\": \\\"Vic\\\",\\n \\\"postalCode\\\": \\\"3999\\\",\\n \\\"period\\\": {\\n \\\"start\\\": \\\"1974-12-25\\\"\\n }\\n }\\n ],\\n \\\"contact\\\": [\\n {\\n \\\"relationship\\\": [\\n {\\n \\\"coding\\\": [\\n {\\n \\\"system\\\": \\\"http://hl7.org/fhir/patient-contact-relationship\\\",\\n \\\"code\\\": \\\"partner\\\"\\n }\\n ]\\n }\\n ],\\n \\\"name\\\": {\\n \\\"family\\\": [\\\"du\\\", \\\"Marché\\\"],\\n \\\"_family\\\": [\\n {\\n \\\"extension\\\": [\\n {\\n \\\"fhir_comments\\\": [\\n \\\" the \\\\\\\"du\\\\\\\" part is a family name prefix (VV in iso 21090) \\\"\\n ],\\n \\\"url\\\": \\\"http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier\\\",\\n \\\"valueCode\\\": \\\"VV\\\"\\n }\\n ]\\n },\\n null\\n ],\\n \\\"given\\\": [\\\"Bénédicte\\\"]\\n },\\n \\\"telecom\\\": [\\n {\\n \\\"system\\\": \\\"phone\\\",\\n \\\"value\\\": \\\"+33 (237) 998327\\\"\\n }\\n ],\\n \\\"gender\\\": \\\"female\\\",\\n \\\"period\\\": {\\n \\\"start\\\": \\\"2012\\\",\\n \\\"_start\\\": {\\n \\\"fhir_comments\\\": [\\\" The contact relationship started in 2012 \\\"]\\n }\\n }\\n }\\n ],\\n \\\"managingOrganization\\\": {\\n \\\"reference\\\": \\\"Organization/1\\\"\\n }\\n}\\n```\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/openhim-configuration-schema/)\\ndefinition.\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-openhim\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.1.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.1.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.1.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.1.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.1.0\\n\\n### Minor Changes\\n\\n- 1fd9b3b: Migrate OpenHIM\\n\\n### Patch Changes\\n\\n- e4ebcb6: Fix Large gzip Denial of Service in superagent\\n- e81561f: Updated ast and package.json\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"apiUrl":{"title":"API URL","type":"string","description":"The OpenHIM API url","format":"uri","minLength":1,"examples":["http://openhim.com/api"]},"username":{"title":"Username","type":"string","description":"The username to log in to OpenHIM","minLength":1,"examples":["admin@openhim.org"]},"password":{"title":"Password","type":"string","description":"The password to log in to OpenHIM","writeOnly":true,"minLength":1,"examples":["@super(!)Secretpass"]}},"type":"object","additionalProperties":true,"required":["apiUrl"]}}, +{"name":"openmrs","adaptor":"@openfn/language-openmrs","version":"2.0.8","docs":"\"## Functions\\n\\n
\\n
\\n create(resourceType, data, [callback])
\\n
\\n createEncounter(data, [callback])
\\n
\\n createPatient(data, [callback])
\\n
\\n get(path, query, [callback])
\\n
\\n getEncounter(uuid, [callback])
\\n
\\n getEncounters(query, [callback])
\\n
\\n getPatient(uuid, [callback])
\\n
\\n post(path, data, [callback])
\\n
\\n searchPatient(query, [callback])
\\n
\\n searchPerson(query, [callback])
\\n
\\n update(resourceType, path, data, [callback])
\\n
\\n upsert(resourceType, query, data, [callback])
\\n
\\n\\n\\n## create\\n\\ncreate(resourceType, data, [callback]) ⇒ Operation\\nCreate a record\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | Type of resource to create. E.g. `person`, `patient`, `encounter`, ... |\\n| data | OpenMRSData | Object which defines data that will be used to create a given instance of resource. To create a single instance of a resource, `data` must be a javascript object, and to create multiple instances of a resources, `data` must be an array of javascript objects. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(Create a person)* \\n```js\\ncreate(\\\"person\\\", {\\n names: [\\n {\\n givenName: \\\"Mohit\\\",\\n familyName: \\\"Kumar\\\",\\n },\\n ],\\n gender: \\\"M\\\",\\n birthdate: \\\"1997-09-02\\\",\\n addresses: [\\n {\\n address1: \\\"30, Vivekananda Layout, Munnekolal,Marathahalli\\\",\\n cityVillage: \\\"Bengaluru\\\",\\n country: \\\"India\\\",\\n postalCode: \\\"560037\\\",\\n },\\n ],\\n});\\n```\\n\\n* * *\\n\\n## createEncounter\\n\\ncreateEncounter(data, [callback]) ⇒ Operation\\nCreates an encounter\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | Data parameters of the encounter |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(Create an encounter)* \\n```js\\ncreateEncounter({\\n encounterDatetime: '2023-05-25T06:08:25.000+0000',\\n patient: '1fdaa696-e759-4a7d-a066-f1ae557c151b',\\n encounterType: 'dd528487-82a5-4082-9c72-ed246bd49591',\\n location: 'ba685651-ed3b-4e63-9b35-78893060758a',\\n encounterProviders: [],\\n visit: {\\n patient: '1fdaa696-e759-4a7d-a066-f1ae557c151b',\\n visitType: '7b0f5697-27e3-40c4-8bae-f4049abfb4ed',\\n startDatetime: '2023-05-25T06:08:25.000+0000',\\n stopDatetime: '2023-05-25T06:09:25.000+0000',\\n },\\n})\\n```\\n\\n* * *\\n\\n## createPatient\\n\\ncreatePatient(data, [callback]) ⇒ Operation\\nCreates a new patient\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | Object parameters of the patient |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\ncreatePatient({\\n identifiers: [\\n {\\n identifier: '4023287',\\n identifierType: '05a29f94-c0ed-11e2-94be-8c13b969e334',\\n preferred: true,\\n },\\n ],\\n person: {\\n gender: 'M',\\n age: 42,\\n birthdate: '1970-01-01T00:00:00.000+0100',\\n birthdateEstimated: false,\\n names: [\\n {\\n givenName: 'Doe',\\n familyName: 'John',\\n },\\n ],\\n },\\n})\\n```\\n\\n* * *\\n\\n## get\\n\\nget(path, query, [callback]) ⇒ Operation\\nMake a get request to any OpenMRS endpoint\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| query | object | parameters for the request |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\nget(\\\"patient\\\", {\\n q: \\\"Patient\\\",\\n limit: 1,\\n});\\n```\\n\\n* * *\\n\\n## getEncounter\\n\\ngetEncounter(uuid, [callback]) ⇒ Operation\\nGets encounter matching a uuid\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| uuid | object | A uuid for the encounter |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\ngetEncounter(\\\"123\\\")\\n```\\n\\n* * *\\n\\n## getEncounters\\n\\ngetEncounters(query, [callback]) ⇒ Operation\\nGets encounters matching params\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | Object for the patient |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\ngetEncounters({patient: \\\"123\\\", fromdate: \\\"2023-05-18\\\"})\\n```\\n\\n* * *\\n\\n## getPatient\\n\\ngetPatient(uuid, [callback]) ⇒ Operation\\nGets patient matching a uuid\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| uuid | string | A uuid for the patient |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\ngetPatient(\\\"123\\\")\\n```\\n**Example** *(Get a patient by uuid)* \\n```js\\ngetPatient('681f8785-c9ca-4dc8-a091-7b869316ff93')\\n```\\n\\n* * *\\n\\n## post\\n\\npost(path, data, [callback]) ⇒ Operation\\nMake a post request to any OpenMRS endpoint\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| data | object | Object which defines data that will be used to create a given instance of resource |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\npost(\\n \\\"idgen/identifiersource/8549f706-7e85-4c1d-9424-217d50a2988b/identifier\\\",\\n {}\\n);\\n```\\n\\n* * *\\n\\n## searchPatient\\n\\nsearchPatient(query, [callback]) ⇒ Operation\\nFetch all non-retired patients that match any specified parameters\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | Object with query for the patient |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\nsearchPatient({ q: Sarah })\\n```\\n\\n* * *\\n\\n## searchPerson\\n\\nsearchPerson(query, [callback]) ⇒ Operation\\nFetch all non-retired persons that match any specified parameters\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | object with query for the person |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\nsearchPerson({ q: Sarah })\\n```\\n\\n* * *\\n\\n## update\\n\\nupdate(resourceType, path, data, [callback]) ⇒ Operation\\nUpdate data. A generic helper function to update a resource object of any type.\\nUpdating an object requires to send `all required fields` or the `full body`\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of resource to be updated. E.g. `person`, `patient`, etc. |\\n| path | string | The `id` or `path` to the `object` to be updated. E.g. `e739808f-f166-42ae-aaf3-8b3e8fa13fda` or `e739808f-f166-42ae-aaf3-8b3e8fa13fda/{collection-name}/{object-id}` |\\n| data | Object | Data to update. It requires to send `all required fields` or the `full body`. If you want `partial updates`, use `patch` operation. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(a person)* \\n```js\\nupdate(\\\"person\\\", '3cad37ad-984d-4c65-a019-3eb120c9c373',{\\\"gender\\\":\\\"M\\\",\\\"birthdate\\\":\\\"1997-01-13\\\"})\\n```\\n\\n* * *\\n\\n## upsert\\n\\nupsert(resourceType, query, data, [callback]) ⇒ Operation\\nUpsert a record. A generic helper function used to atomically either insert a row, or on the basis of the row already existing, UPDATE that existing row instead.\\n\\n**Kind**: global function \\n**Throws**:\\n\\n- RangeError - Throws range error\\n\\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of a resource to `upsert`. E.g. `trackedEntityInstances` |\\n| query | Object | A query object that allows to uniquely identify the resource to update. If no matches found, then the resource will be created. |\\n| data | Object | The data to use for update or create depending on the result of the query. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(For an existing patient using upsert)* \\n```js\\nupsert('patient', { q: '10007JJ' }, { person: { age: 50 } });\\n```\\n**Example** *(For non existing patient creating a patient record using upsert )* \\n```js\\nupsert(\\n \\\"patient\\\",\\n { q: \\\"1000EHE\\\" },\\n {\\n identifiers: [\\n {\\n identifier: \\\"1000EHE\\\",\\n identifierType: \\\"05a29f94-c0ed-11e2-94be-8c13b969e334\\\",\\n location: \\\"44c3efb0-2583-4c80-a79e-1f756a03c0a1\\\",\\n preferred: true,\\n },\\n ],\\n person: {\\n gender: \\\"M\\\",\\n age: 42,\\n },\\n }\\n);\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language OpenMRS\\n\\nLanguage Pack for building expressions and operations for working with the\\n[OpenMRS API](https://wiki.openmrs.org/display/docs/API).\\n\\n[OpenMRS Data Model Explorer](http://burkeware.com/openmrs-data-model/openmrs-data-model-1.11.html#)\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/openmrs-configuration-schema/)\\ndefinition.\\n\\n### Get a patient by some criteria\\n\\n```js\\n// getPatient({ uuid: '516af9aa-0402-4e11-ad79-e394fdec0c91' });\\n// getPatient({ uuid: dataValue('patientId')(state) });\\ngetPatient({\\n uuid: state => state.data[0].uuid,\\n});\\n```\\n\\n#### Example of searching for patients based on their `EMR Id`\\n\\n```js\\ngetPatients(\\n {\\n identifier: state => state.data.emrId,\\n v: 'full',\\n },\\n {\\n exactlyOne: true,\\n }\\n);\\n```\\n\\n### Create an Encounter\\n\\n```js\\ncreateEncounter({\\n encounterDatetime: dataValue('visit_date'), //dynamically fill with source app data\\n patient: dataValue('uuid'),\\n encounterType: dataValue('visit_type'),\\n location: dataValue('location.uuid'),\\n encounterProviders: [\\n {\\n provider: dataValue('provider_name'),\\n encounterRole: '240b26f9-dd88-4172-823d-4a8bfeb7841f', //hardcoded value\\n },\\n ],\\n});\\n```\\n\\n### Make a request to any OpenMRS endpoint\\n\\n```js\\nreq({ method: 'GET', url: '/ws/rest/v1/concept' }, state => {\\n console.log(JSON.stringify(state, null, 2));\\n return state;\\n});\\n```\\n\\n\\n\\n## Create new patient\\n\\n```js\\npatient(\\n fields(\\n field('gender', 'M'),\\n field('names', function (state) {\\n return [\\n {\\n patient_id: dataValue('form.patientId')(state),\\n creator: dataValue('form.user')(state),\\n },\\n ];\\n })\\n )\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-openmrs\\n\\n## 2.0.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 2.0.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 2.0.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 2.0.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 2.0.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 2.0.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 2.0.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 2.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 2.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- 2390129: - replace throw new Error with console.log\\n - improve Log function\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- d124f67: - Add create, update and upsert function\\n - Add callback support and improve examples for\\n - get()\\n - post()\\n - getPatient()\\n - searchPerson()\\n - getEncounter()\\n - searchPatient()\\n - createPatient()\\n - getEncounters()\\n - createEncounter()\\n\\n## 1.0.1\\n\\n### Patch Changes\\n\\n- 97cc7ce: - Fix checking for empty response\\n - Style logs output\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\n- b6478c0: - Removed `request` in favour of `superagent`\\n - Improve error handling\\n - Moved `login` to execute function\\n - Added\\n - `createPatient`\\n - `searchPatient`\\n - `searchPerson`\\n - `getEncounters`\\n - `getEncounter`\\n - `get`\\n - `post`\\n\\n## 0.10.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 0.10.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.10.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.10.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.10.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.10.0\\n\\n### Minor Changes\\n\\n- 6786949: Migrate OpenMRS\\n\"","functions":["create","update","upsert"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"instanceUrl":{"title":"Instance URL","type":"string","description":"The OpenMRS host url","format":"uri","minLength":1,"examples":["http://openmrs.com/instance/url"]},"username":{"title":"Username","type":"string","description":"The username to log in to OpenMRS","minLength":1,"examples":["admin@openmrs.org"]},"password":{"title":"Password","type":"string","description":"The password to log in to OpenMRS","writeOnly":true,"minLength":1,"examples":["@super(!)Secretpass"]}},"type":"object","additionalProperties":true,"required":["instanceUrl"]}}, +{"name":"openspp","adaptor":"@openfn/language-openspp","version":"1.2.0","docs":"\"## Functions\\n\\n
\\n
\\n addToGroup(group_id, individual_id, role)
\\n
\\n createGroup(data, callback)
\\n
\\n createIndividual(data, callback)
\\n
\\n enroll(spp_id, program_id)
\\n
\\n getArea(spp_id, callback)
\\n
\\n getEnrolledPrograms(spp_id, callback)
\\n
\\n getGroup(spp_id, callback)
\\n
\\n getGroupMembers(spp_id, [options], callback)
\\n
\\n getIndividual(spp_id, callback)
\\n
\\n getProgram(program_id, callback)
\\n
\\n getPrograms([options], callback)
\\n
\\n getServicePoint(spp_id, callback)
\\n
\\n removeFromGroup(group_id, individual_id)
\\n
\\n searchArea(domain, [options], callback)
\\n
\\n searchGroup(domain, [options], callback)
\\n
\\n searchIndividual(domain, [options], callback)
\\n
\\n searchServicePoint(domain, [options], callback)
\\n
\\n unenroll(spp_id, program_id)
\\n
\\n updateGroup(group_id, data)
\\n
\\n updateIndividual(individual_id, data)
\\n
\\n\\n\\n## addToGroup\\n\\naddToGroup(group_id, individual_id, role) ⇒ Operation\\nadd individual to group in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| group_id | string | group registrant id |\\n| individual_id | string | individual registrant id |\\n| role | string | individual role in group |\\n\\n**Example** *(create a new head for group)* \\n```js\\naddToGroup(\\\"GRP_B2BRHJN2\\\", \\\"IND_8DUQL4M4\\\", \\\"Head\\\")\\n```\\n**Example** *(create a new ordinary member for group)* \\n```js\\naddToGroup(\\\"GRP_B2BRHJN2\\\", \\\"IND_8DUQL4M4\\\")\\n```\\n**Example** *(create a new member with new role for group)* \\n```js\\naddToGroup(\\\"GRP_B2BRHJN2\\\", \\\"IND_8DUQL4M4\\\", \\\"new-role-name\\\")\\n```\\n\\n* * *\\n\\n## createGroup\\n\\ncreateGroup(data, callback) ⇒ Operation\\ncreate new group for OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | registrant create data |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ncreateGroup({ name: \\\"Group 1\\\" })\\n```\\n\\n* * *\\n\\n## createIndividual\\n\\ncreateIndividual(data, callback) ⇒ Operation\\ncreate new individual for OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | registrant create data |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ncreateIndividual({ name: \\\"Individual 1\\\" })\\n```\\n\\n* * *\\n\\n## enroll\\n\\nenroll(spp_id, program_id)\\nenroll registrant to program in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | spp_id of group / individual wanted to enroll |\\n| program_id | string | program_id of program |\\n\\n**Example** \\n```js\\nenroll(\\\"IND_Q4VGGZPF\\\", \\\"PROG_2023_00000001\\\")\\n```\\n\\n* * *\\n\\n## getArea\\n\\ngetArea(spp_id, callback) ⇒ Operation\\nget area by id in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | spp_id of area |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ngetArea(\\\"LOC_7M92NLDH\\\")\\n```\\n\\n* * *\\n\\n## getEnrolledPrograms\\n\\ngetEnrolledPrograms(spp_id, callback) ⇒ Operation\\nget programs list for specific registrant from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | spp_id of group / individual wanted to search |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ngetEnrolledPrograms(\\\"IND_Q4VGGZPF\\\")\\n```\\n\\n* * *\\n\\n## getGroup\\n\\ngetGroup(spp_id, callback) ⇒ Operation\\nget group information from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | The spp_id of the group |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ngetGroup(\\\"GRP_Q4VGGZPF\\\")\\n```\\n\\n* * *\\n\\n## getGroupMembers\\n\\ngetGroupMembers(spp_id, [options], callback) ⇒ Operation\\nget group members information from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| spp_id | string | | The name of the group |\\n| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records |\\n| callback | function | | An optional callback function |\\n\\n**Example** \\n```js\\ngetGroupMembers(\\\"GRP_Q4VGGZPF\\\")\\n```\\n\\n* * *\\n\\n## getIndividual\\n\\ngetIndividual(spp_id, callback) ⇒ Operation\\nget individual information from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | The spp_id of the individual |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ngetIndividual(\\\"IND_Q4VGGZPF\\\")\\n```\\n\\n* * *\\n\\n## getProgram\\n\\ngetProgram(program_id, callback) ⇒ Operation\\nget program information from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| program_id | string | searching domain |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ngetProgram(\\\"PROG_2023_00000001\\\")\\n```\\n\\n* * *\\n\\n## getPrograms\\n\\ngetPrograms([options], callback) ⇒ Operation\\nget programs list from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| [options] | number | {} | offset from start |\\n| callback | function | | An optional callback function |\\n\\n**Example** \\n```js\\ngetPrograms(100)\\n```\\n\\n* * *\\n\\n## getServicePoint\\n\\ngetServicePoint(spp_id, callback) ⇒ Operation\\nget service points information from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | The spp_id of the agent |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ngetServicePoint(\\\"SVP_8P4KP4RT\\\")\\n```\\n\\n* * *\\n\\n## removeFromGroup\\n\\nremoveFromGroup(group_id, individual_id) ⇒ Operation\\nremove individual from group in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| group_id | string | group registrant id |\\n| individual_id | string | individual registrant id |\\n\\n**Example** \\n```js\\nremoveFromGroup(\\\"GRP_B2BRHJN2\\\", \\\"IND_8DUQL4M4\\\")\\n```\\n\\n* * *\\n\\n## searchArea\\n\\nsearchArea(domain, [options], callback) ⇒ Operation\\nsearching for service point in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| domain | Array | | searching domain |\\n| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records |\\n| callback | function | | An optional callback function |\\n\\n**Example** *(search without offset)* \\n```js\\nsearchArea([[\\\"code\\\", \\\"=\\\", \\\"10732\\\"]])\\n```\\n**Example** *(search with offset)* \\n```js\\nsearchArea([[\\\"kind\\\", \\\"=\\\", 1]], { offset: 10 }})\\n```\\n\\n* * *\\n\\n## searchGroup\\n\\nsearchGroup(domain, [options], callback) ⇒ Operation\\nget groups from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| domain | Array | | searching domain |\\n| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for ordering search, offset for skipping records |\\n| callback | function | | An optional callback function |\\n\\n**Example** *(search group by domain)* \\n```js\\nsearchGroup([[\\\"spp_id\\\", \\\"=\\\", \\\"GRP_Q4VGGZPF\\\"]])\\n```\\n**Example** *(search group by domain with offset)* \\n```js\\nsearchGroup([[\\\"spp_id\\\", \\\"ilike\\\", \\\"GRP\\\"]], { offset: 100 }})\\n```\\n**Example** *(search group by complex domain for more accuracy)* \\n```js\\nsearchGroup([[\\\"address\\\", \\\"!=\\\", false], [\\\"phone\\\", \\\"!=\\\", false]])\\n```\\n\\n* * *\\n\\n## searchIndividual\\n\\nsearchIndividual(domain, [options], callback) ⇒ Operation\\nget individuals from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| domain | Array | | searching domain |\\n| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records |\\n| callback | function | | An optional callback function |\\n\\n**Example** *(search individual by domain)* \\n```js\\nsearchIndividual([[\\\"spp_id\\\", \\\"=\\\", \\\"IND_Q4VGGZPF\\\"]])\\n```\\n**Example** *(search individual by domain with offset)* \\n```js\\nsearchIndividual([[\\\"spp_id\\\", \\\"ilike\\\", \\\"IND\\\"]], { offset: 100 })\\n```\\n**Example** *(search individual by complex domain for more accuracy)* \\n```js\\nsearchIndividual([[\\\"address\\\", \\\"!=\\\", false], [\\\"birthdate\\\", \\\"=\\\", false]])\\n```\\n\\n* * *\\n\\n## searchServicePoint\\n\\nsearchServicePoint(domain, [options], callback) ⇒ Operation\\nsearching for service point in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| domain | Array | | searching domain |\\n| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records |\\n| callback | function | | An optional callback function |\\n\\n**Example** *(search without offset)* \\n```js\\nsearchServicePoint([[\\\"name\\\", \\\"ilike\\\", \\\"agent 1\\\"]])\\n```\\n**Example** *(search with offset)* \\n```js\\nsearchServicePoint([[\\\"name\\\", \\\"ilike\\\", \\\"agent 1\\\"]], { offset: 100 })\\n```\\n\\n* * *\\n\\n## unenroll\\n\\nunenroll(spp_id, program_id)\\nunenroll registrant from program in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | spp_id of group / individual wanted to unenroll |\\n| program_id | string | program_id of program |\\n\\n**Example** \\n```js\\nunenroll(\\\"IND_Q4VGGZPF\\\", \\\"PROG_2023_00000001\\\")\\n```\\n\\n* * *\\n\\n## updateGroup\\n\\nupdateGroup(group_id, data) ⇒ Operation\\nupdate group for OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| group_id | string | group registrant id |\\n| data | object | registrant update data |\\n\\n**Example** \\n```js\\nupdateGroup(\\\"GRP_B2BRHJN2\\\", { name: \\\"Group 1\\\" })\\n```\\n\\n* * *\\n\\n## updateIndividual\\n\\nupdateIndividual(individual_id, data) ⇒ Operation\\nupdate individual for OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| individual_id | string | individual registrant id |\\n| data | object | registrant update data |\\n\\n**Example** \\n```js\\nupdateIndividual(\\\"IND_8DUQL4M4\\\", { name: \\\"Individual 1\\\" })\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-openspp \\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with OpenSPP\\nAPI.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/openspp-docs)\\nfor full technical documentation.\\n\\n### Configuration\\n\\nView the\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/openspp-configuration-schema/)\\nfor required and optional `configuration` properties.\\n\\n### A example expression using the `getServicePoint` function\\n\\n```js\\ngetServicePoint(\\\"newagentflour\\\");\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n\\\"Getting Started\\\" guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build _only_ the docs run `pnpm build docs`.\\n\"","changelog":"\"# @openfn/language-openspp\\n\\n## 1.2.0\\n\\n### Changes\\n\\n- 05defd2: add new functions, correcting docstring and add more examples\\n - correcting docstring input parameters type\\n - changing getServicePoint() from get by name into get by unique id\\n - add more examples in docstring\\n - getArea(): get existing area by id\\n - searchArea(): search existing area by domain\\n - searchServicePoint(): search existing service point by domain\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- 48b4e97: update `spp date time now string` format\\n\\n## 1.1.0\\n\\n- Create OpenSPP adaptor with these functions:\\n - getGroup(): get existing group information\\n - getIndividual(): get existing individual information\\n - searchGroup(): search existing group by domain\\n - searchIndividual(): search existing individual by domain\\n - getGroupMembers(): get members from group\\n - getServicePoint(): get service points by name\\n - getPrograms(): get single program\\n - getPrograms(): get program list\\n - getEnrolledPrograms(): get list of enrolled program for each beneficiary\\n - enroll(): enroll beneficiary to a program\\n - unenroll(): unenroll beneficiary from program\\n - createIndividual(): create new individual\\n - updateIndividual(): update existing individual\\n - createGroup(): create new group\\n - updateGroup(): update existing group\\n - addToGroup(): add individual to group with(out) role\\n - removeFromGroup(): end membership of individual to group\\n\"","functions":["addToGroup","createGroup","createIndividual","enroll","getArea","getEnrolledPrograms","getGroup","getGroupMembers","getIndividual","getProgram","getPrograms","getServicePoint","removeFromGroup","searchArea","searchGroup","searchIndividual","searchServicePoint","unenroll","updateGroup","updateIndividual"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"baseUrl":{"title":"Base URL","anyOf":[{"type":"string"},{"type":"null"}],"description":"The base URL (http://www.example.com)","format":"uri","minLength":1,"default":"http://localhost","examples":["https://dev.newlogic-demo.com"]},"username":{"title":"Username","type":"string","description":"Username","default":"admin","examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Password","default":"admin","writeOnly":true,"examples":["@some(!)Str0ngp4ss0w0rd"]},"database":{"title":"Database Name","type":"string","default":"devel","description":"Database Name","examples":["devel"]}},"type":"object","additionalProperties":true,"required":["password","username","database","baseUrl"]}}, +{"name":"postgresql","adaptor":"@openfn/language-postgresql","version":"4.1.8","docs":"\"## Functions\\n\\n
\\n
\\n describeTable(tableName, [options], callback)
\\n
\\n findValue([filter])
\\n
\\n insert(table, record, [options], callback)
\\n
\\n insertMany(table, records, [options], callback)
\\n
\\n insertTable(tableName, columns, [options], callback)
\\n
\\n modifyTable(tableName, columns, [options], callback)
\\n
\\n sql(sqlQuery, [options], callback)
\\n
\\n upsert(table, uuid, record, [options], callback)
\\n
\\n upsertIf(logical, table, uuid, record, [options], callback)
\\n
\\n upsertMany(table, uuid, data, [options], callback)
\\n
\\n\\n\\n## describeTable\\n\\ndescribeTable(tableName, [options], callback) ⇒ Operation\\nList the columns of a table in a database.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| tableName | string | The name of the table to describe |\\n| [options] | object | Optional options argument |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ndescribeTable('clinic_visits')\\n```\\n\\n* * *\\n\\n## findValue\\n\\nfindValue([filter]) ⇒ value\\nFetch a uuid key given a condition\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| [filter] | object | A filter object with the lookup table, a uuid and the condition |\\n| [filter.uuid] | string | The uuid value to search for in the specified relation. |\\n| [filter.relation] | string | The name of the relation to search for the uuid value. |\\n| [filter.where] | object | An object that contains key-value pairs to filter the search results. |\\n| [filter.operator] | object | An object that contains key-value pairs to specify the type of comparison to perform on the where clause. |\\n\\n**Example** \\n```js\\nfindValue({\\n uuid: 'id',\\n relation: 'users',\\n where: { first_name: 'Mamadou' },\\n operator: { first_name: 'like' }\\n })\\n```\\n\\n* * *\\n\\n## insert\\n\\ninsert(table, record, [options], callback) ⇒ Operation\\nInsert a record\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| record | object | Payload data for the record as a JS object or function |\\n| [options] | object | Optional options argument |\\n| [options.setNull] | string | A string value that specifies the behavior for inserting null values. |\\n| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ninsert('users', { name: 'Elodie', id: 7 }, { setNull: \\\"'NaN'\\\", logValues: true });\\n```\\n\\n* * *\\n\\n## insertMany\\n\\ninsertMany(table, records, [options], callback) ⇒ Operation\\nInsert many records, using the keys of the first as the column template\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| records | array | An array or a function that takes state and returns an array |\\n| [options] | object | Optional options argument |\\n| [options.setNull] | string | A string value that specifies the behavior for inserting null values. |\\n| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ninsertMany('users', state => state.data.recordArray, { setNull: \\\"'undefined'\\\", logValues: true });\\n```\\n\\n* * *\\n\\n## insertTable\\n\\ninsertTable(tableName, columns, [options], callback) ⇒ Operation\\nCreate a table in database when given an array of columns and a table_name.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| tableName | string | The name of the table to create |\\n| columns | array | An array of form columns |\\n| [options] | object | Optional options argument |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ninsertTable('table_name', state => state.data.map(\\n column => ({\\n name: column.name,\\n type: column.type,\\n required: true, // optional\\n unique: false, // optional - to be set to true for unique constraint\\n })\\n));\\n```\\n\\n* * *\\n\\n## modifyTable\\n\\nmodifyTable(tableName, columns, [options], callback) ⇒ Operation\\nAlter an existing table in the database.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| tableName | string | The name of the table to alter |\\n| columns | array | An array of form columns |\\n| [options] | object | Optional options argument |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nmodifyTable('table_name', state => state.data.map(\\n newColumn => ({\\n name: newColumn.name,\\n type: newColumn.type,\\n required: true, // optional\\n unique: false, // optional - to be set to true for unique constraint\\n })\\n));\\n```\\n\\n* * *\\n\\n## sql\\n\\nsql(sqlQuery, [options], callback) ⇒ Operation\\nExecute an SQL statement\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sqlQuery | function | a function which takes state and returns a string of SQL. |\\n| [options] | object | Optional options argument |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nsql(state => `select(*) from ${state.data.tableName};`, { writeSql: true })\\n```\\n\\n* * *\\n\\n## upsert\\n\\nupsert(table, uuid, record, [options], callback) ⇒ Operation\\nInsert or update a record using ON CONFLICT UPDATE\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| uuid | string | The uuid column to determine a matching/existing record |\\n| record | object | Payload data for the record as a JS object or function |\\n| [options] | object | Optional options argument |\\n| [options.setNull] | string | A string value that specifies the behavior for inserting null values. |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nupsert(\\n 'users', // the DB table\\n 'ON CONSTRAINT users_pkey', // a DB column with a unique constraint OR a CONSTRAINT NAME\\n { name: 'Elodie', id: 7 },\\n { setNull: [\\\"''\\\", \\\"'undefined'\\\"], writeSql:true, execute: true, logValues: true }\\n)\\n```\\n\\n* * *\\n\\n## upsertIf\\n\\nupsertIf(logical, table, uuid, record, [options], callback) ⇒ Operation\\nInsert or update a record based on a logical condition using ON CONFLICT UPDATE\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| logical | string | a data to check existing value for. |\\n| table | string | The target table |\\n| uuid | string | The uuid column to determine a matching/existing record |\\n| record | object | Payload data for the record as a JS object or function |\\n| [options] | object | Optional options argument |\\n| [options.setNull] | string | A string value that specifies the behavior for inserting null values. |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nupsertIf(\\n dataValue('name'),\\n 'users', // the DB table\\n 'ON CONSTRAINT users_pkey', // a DB column with a unique constraint OR a CONSTRAINT NAME\\n { name: 'Elodie', id: 7 },\\n { writeSql:true, execute: true }\\n)\\n```\\n\\n* * *\\n\\n## upsertMany\\n\\nupsertMany(table, uuid, data, [options], callback) ⇒ Operation\\nInsert or update multiple records using ON CONFLICT UPDATE and excluded\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| uuid | string | The uuid column to determine a matching/existing record |\\n| data | array | An array of objects or a function that returns an array |\\n| [options] | object | Optional options argument |\\n| [options.setNull] | string | A string value that specifies the behavior for inserting null values. |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nupsertMany(\\n 'users', // the DB table\\n 'email', // a DB column with a unique constraint OR a CONSTRAINT NAME\\n [\\n { name: 'one', email: 'one@openfn.org' },\\n { name: 'two', email: 'two@openfn.org' },\\n ]\\n { logValues: true }\\n)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language PostgreSQL\\n\\nLanguage Pack for building expressions and operations to run PostgreSQL queries.\\n\\n## Documentation\\n\\n## required configuration for Heroku postgres\\n\\n```json\\n{\\n \\\"host\\\": \\\"some-host-url.compute-1.amazonaws.com\\\",\\n \\\"port\\\": \\\"5432\\\",\\n \\\"database\\\": \\\"wouldntyouliketoknow\\\",\\n \\\"user\\\": \\\"me\\\",\\n \\\"password\\\": \\\"noway\\\",\\n \\\"ssl\\\": true,\\n \\\"allowSelfSignedCert\\\": true\\n}\\n```\\n\\n## `sql(query)`\\n\\nExecute an sql query. An option can be added to either log the query or not and\\neither execute the query or no. The options can be omitted as well.\\n\\n#### sample usage\\n\\n```js\\nsql(\\n state =>\\n `INSERT INTO untitled_table (name, the_geom) VALUES ('` +\\n dataValue('form.first_name')(state) +\\n `', ST_SetSRID(ST_Point(` +\\n dataValue('lat')(state) +\\n `, ` +\\n dataValue('long')(state) +\\n `),4326))`,\\n { writeSql: true, execute: true }\\n);\\n```\\n\\n## Find a single value for a table\\n\\nThis helper function allows to build a specific query where `sql` would not be\\nbest suited. It returns a single value and not a promise. An example of usage\\nwould be in building a mapping object with a value from a lookup table.\\n\\n```js\\nalterState(async state => {\\n const user = {\\n id: 1,\\n name: 'Mamadou',\\n user_id: await findValue({\\n uuid: 'id',\\n relation: 'users',\\n where: { first_name: 'Mama%' },\\n operator: { first_name: 'like' }, // operator is optional. \\\"=\\\" is used by default.\\n })(state),\\n };\\n\\n return upsert(...)(state);\\n});\\n```\\n\\n## Insert a single record\\n\\nThis functions is used to insert a single record in postgres database. An option\\n`writeSql` allows to log the generated sql query. The `setNull` option allows to\\nreplace the specified elements with `NULL`.\\n\\n```js\\ninsert(\\n 'users',\\n {\\n email: 'antony@gmail.com',\\n first_name: 'Antony',\\n inserted_at: '2020-08-27 00:00:00',\\n updated_at: '2020-08-27 00:00:00',\\n },\\n { setNull: [\\\"''\\\", \\\"'undefined'\\\"], writeSql: true, logValues: true }\\n);\\n```\\n\\n## Insert or Update using a unique column as a key\\n\\nInsert or Update if matched. An option, `execute`, allows to either run the\\ngenerated query or no.\\n\\n```js\\nupsert(\\n 'users',\\n 'email',\\n {\\n email: 'luca@openfn.org',\\n first_name: 'Luca',\\n inserted_at: '2010-01-01 00:00:00',\\n updated_at: '2010-01-01 00:00:00',\\n },\\n {\\n setNull: [\\\"'NaN'\\\", \\\"'undefined'\\\"],\\n writeSql: false,\\n execute: true,\\n logValues: true,\\n }\\n);\\n```\\n\\n## Insert or Update if a value exist in the record\\n\\nThis function will upsert a record only if the logical given is true. In this\\ncase we check if `dataValue('name')` exists.\\n\\n```js\\nupsertIf(dataValue('name'), 'users', 'ON CONSTRAINT users_pkey', {\\n name: 'Elodie',\\n id: 7,\\n});\\n```\\n\\n## Insert many records in postgresql\\n\\nThis function allows the insert of a set of records inside a table all at once.\\n\\n```js\\ninsertMany(\\n 'users',\\n state =>\\n state.data.people.map(s => {\\n return {\\n first_name: ['Luca', 'Mohamed', 'Elodie'],\\n inserted_at: '2020-01-01 00:00:00',\\n updated_at: '2020-01-01 00:00:00',\\n };\\n }),\\n { logValues: true }\\n);\\n```\\n\\n## Upsert many records in postgresql\\n\\nThis function allows the upsert of a set of records inside a table all at once.\\n\\n```js\\nupsertMany('users', 'ON CONSTRAINT users_pkey', state =>\\n state.data.people.map(s => {\\n return {\\n first_name: ['Luca', 'Mohamed', 'Elodie'],\\n inserted_at: '2020-01-01 00:00:00',\\n updated_at: '2020-01-01 00:00:00',\\n };\\n })\\n);\\n```\\n\\n## Describe a table from postgres\\n\\nThis function is used to fetch the list of columns of a given table in the\\ndatabase.\\n\\n```js\\ndescribeTable('users', { writeSql: true, execute: false });\\n```\\n\\n## Create a table in the database\\n\\nThis function allows to create a table in a database from a given array of\\ncolumns. The key `identity` can be use for a column to auto-generate a value.\\n\\n```js\\ninsertTable('users', state =>\\n state.data.map(column => ({\\n name: column.name,\\n type: column.type,\\n required: true, // optional\\n unique: false, // optional - set to true for unique constraint\\n }))\\n);\\n```\\n\\n## Alter a table in the database\\n\\nThis function allows to add new columns to a table. Beware of the fact that you\\ncannot add new columns with names that already exist in the table.\\n\\n```js\\nmodifyTable(\\n 'users',\\n state =>\\n state.data.map(newColumn => ({\\n name: newColumn.name,\\n type: newColumn.type,\\n required: true, // optional\\n unique: false, // optional - set to true for unique constraint\\n })),\\n { writeSql: false, execute: true }\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-postgresql\\n\\n## 4.1.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 4.1.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 4.1.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 4.1.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 4.1.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 4.1.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 4.1.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 4.1.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 4.1.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 4.0.0\\n\\n### Major Changes\\n\\n- ecd0b53: add optional callback in sql and update response structure\\n\\n## 3.4.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 3.4.5\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 3.4.4\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 3.4.3\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 3.4.2\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 3.4.1\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 3.4.0\\n\\n### Minor Changes\\n\\n- 44ae341: Migrate postgresql\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\"","functions":["describeTable","findValue","insert","insertMany","insertTable","modifyTable","sql","upsert","upsertIf","upsertMany"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"host":{"title":"Host","type":"string","description":"Postgres instance host URL or IP address","minLength":1,"anyOf":[{"format":"uri"},{"format":"ipv4"}],"examples":["https://some-host.compute-1.amazonaws.com","201.220.61.246"]},"port":{"title":"Port","type":"integer","default":5432,"description":"Database instance port","minLength":1,"examples":[5432]},"database":{"title":"Database","type":"string","description":"The database name","minLength":1,"examples":["demo-db"]},"user":{"title":"User","type":"string","description":"User name","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"minLength":1,"examples":["@super(!)Secretpass"]},"ssl":{"title":"Use SSL","type":"boolean","examples":[true]},"allowSelfSignedCert":{"title":"Allow self-signed certificate","type":"boolean","examples":[true]}},"type":"object","additionalProperties":true,"required":["host","port","database"]}}, +{"name":"primero","adaptor":"@openfn/language-primero","version":"2.11.8","docs":"\"## Functions\\n\\n
\\n
\\n cleanupState(state)
\\n
\\n createCase(params, callback)
\\n
\\n createReferrals(params, callback)
\\n
\\n generateAuthString(state)
\\n
\\n getCases(query, options, callback)
\\n
\\n getForms(query, callback)
\\n
\\n getLocations(query, callback)
\\n
\\n getLookups(query, callback)
\\n
\\n getReferrals(params, callback)
\\n
\\n login(state)
\\n
\\n queryHandler(state, params, callback)
\\n
\\n updateCase(id, params, callback)
\\n
\\n updateReferral(params, callback)
\\n
\\n upsertCase(params, callback)
\\n
\\n\\n\\n## cleanupState\\n\\ncleanupState(state) ⇒ State\\nRemoves unserializable keys from the state.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n\\n**Example** \\n```js\\ncleanupState(state)\\n```\\n\\n* * *\\n\\n## createCase\\n\\ncreateCase(params, callback) ⇒ Operation\\nCreate a new case in Primero\\n\\nUse this function to create a new case in Primero based on a set of Data.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | an object with some case data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Create a new case in Primero based on a set of Data)* \\n```js\\ncreateCase({\\n data: {\\n age: 16,\\n sex: \\\"female\\\",\\n name: \\\"Edwine Edgemont\\\",\\n },\\n});\\n```\\n\\n* * *\\n\\n## createReferrals\\n\\ncreateReferrals(params, callback) ⇒ Operation\\nCreate referrals in Primero\\n\\nUse this function to bulk refer to one or multiple cases from Primero to a single user\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | an object with referral data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Create referrals for multiple cases in Primero)* \\n```js\\ncreateReferrals({\\n data: {\\n ids: [\\n \\\"749e9c6e-60db-45ec-8f5a-69da7c223a79\\\",\\n \\\"dcea6052-07d9-4cfa-9abf-9a36987cdd25\\\",\\n ],\\n transitioned_to: \\\"primero_cp\\\",\\n notes: \\\"This is a bulk referral\\\",\\n },\\n});\\n```\\n\\n* * *\\n\\n## generateAuthString\\n\\ngenerateAuthString(state) ⇒ string\\nGenerate an auth string to support multiple types of auth credentials.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n\\n**Example** \\n```js\\ngenerateAuthString(state)\\n```\\n\\n* * *\\n\\n## getCases\\n\\ngetCases(query, options, callback) ⇒ Operation\\nGet cases from Primero\\n\\nUse this function to get cases from Primero based on a set of query parameters.\\nNote that in many implementations, the `remote` attribute should be set to `true` to ensure that only cases marked for remote access will be retrieved.\\nYou can specify a `case_id` value to fetch a unique case and a query string to filter result.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | an object with a query param at minimum, option to getReferrals |\\n| options | object | (Optional) an object with a getReferrals key to fetch referrals |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *( Get cases from Primero with query parameters)* \\n```js\\ngetCases({\\n remote: true,\\n query: \\\"sex=male\\\",\\n});\\n```\\n**Example** *(Get case from Primero for a specific case id)* \\n```js\\ngetCases({\\n remote: true,\\n case_id: \\\"6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz\\\",\\n});\\n```\\n\\n* * *\\n\\n## getForms\\n\\ngetForms(query, callback) ⇒ Operation\\nGet forms from Primero\\n\\nUse this function to get forms from Primero that are accessible to this user based on a set of query parameters.\\nThe user can filter the form list by record type and module.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | an object with a query param at minimum |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Get the list of all forms)* \\n```js\\ngetForms();\\n```\\n**Example** *(Get the list of all forms for a specific module)* \\n```js\\ngetForms({\\n module_id: \\\"6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz\\\",\\n});\\n```\\n\\n* * *\\n\\n## getLocations\\n\\ngetLocations(query, callback) ⇒ Operation\\nGet locations from Primero\\n\\nUse this function to get a paginated list of all locations that are accessible to this user from Primero.\\nNote: You can specify a `per` value to fetch records per page(Defaults to 20).\\nAlso you can specify `page` value to fetch pagination (Defaults to 1).\\nAnother parameter is `hierarchy: true` (Defaults to false)\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | an object with a query param at minimum |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Get loocations from Primero with query parameters)* \\n```js\\ngetLocations({\\n page: 1,\\n per: 20\\n})\\n```\\n\\n* * *\\n\\n## getLookups\\n\\ngetLookups(query, callback) ⇒ Operation\\nGet lookups from Primero\\n\\nUse this function to get a paginated list of all lookups that are accessible to this user from Primero.\\nNote: You can specify a `per` value to fetch records per page(Defaults to 20).\\nAlso you can specify `page` value to fetch pagination (Defaults to 1)\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | an object with a query param at minimum |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Get lookups from Primero with query parameters)* \\n```js\\ngetLookups({\\n per: 10000,\\n page: 5\\n});\\n```\\n\\n* * *\\n\\n## getReferrals\\n\\ngetReferrals(params, callback) ⇒ Operation\\nGet referrals for a specific case in Primero\\n\\nUse this function to get the list of referrals of one case from Primero.\\nThe search can be done using either `record id` or `case id`.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | an object with an externalId field to select the attribute to use for matching on case and an externalId value for that case. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Get referrals for a case in Primero by record id)* \\n```js\\ngetReferrals({\\n externalId: \\\"record_id\\\",\\n id: \\\"6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz\\\",\\n});\\n```\\n**Example** *(Get referrals for a case in Primero by case id)* \\n```js\\n getReferrals({\\n id: \\\"6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz\\\",\\n});\\n```\\n\\n* * *\\n\\n## login\\n\\nlogin(state) ⇒ State\\nLogs in to Primero.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | Runtime state. |\\n\\n**Example** \\n```js\\nlogin(state)\\n```\\n\\n* * *\\n\\n## queryHandler\\n\\nqueryHandler(state, params, callback) ⇒ State\\nExecute custom query\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n| params | object | \\n| callback | function | \\n\\n\\n* * *\\n\\n## updateCase\\n\\nupdateCase(id, params, callback) ⇒ Operation\\nUpdate an existing case in Primero\\n\\nUse this function to update an existing case from Primero.\\nIn this implementation, the function uses a case ID to check for the case to update,\\nThen merge the values submitted in this call into an existing case.\\nFields not specified in this request will not be modified.\\nFor nested subform fields, the subform arrays will be recursively merged,\\nkeeping both the existing values and appending the new\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | A case ID to use for the update. |\\n| params | object | an object with some case data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Update case for a specific case id)* \\n```js\\nupdateCase(\\\"6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz\\\", {\\n data: {\\n age: 16,\\n sex: \\\"female\\\",\\n name: \\\"Fiona Edgemont\\\",\\n },\\n});\\n```\\n\\n* * *\\n\\n## updateReferral\\n\\nupdateReferral(params, callback) ⇒ Operation\\nUpdate a single referral for a specific case in Primero\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | an object with an caseExternalId value to use, the id and the referral id to update. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Update referral by record id)* \\n```js\\nupdateReferral({\\n caseExternalId: \\\"record_id\\\",\\n id: \\\"749e9c6e-60db-45ec-8f5a-69da7c223a79\\\",\\n caseId: \\\"dcea6052-07d9-4cfa-9abf-9a36987cdd25\\\",\\n data: (state) => state.data,\\n});\\n```\\n\\n* * *\\n\\n## upsertCase\\n\\nupsertCase(params, callback) ⇒ Operation\\nUpsert case to Primero\\n\\nUse this function to update an existing case from Primero or to create it otherwise.\\nIn this implementation, we first fetch the list of cases,\\nthen we check if the case exist before choosing the right operation to do.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | an object with an externalIds and some case data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Upsert case for a specific case id)* \\n```js\\nupsertCase({\\n externalIds: [\\\"case_id\\\"],\\n data: state => ({\\n age: 20,\\n sex: \\\"male\\\",\\n name: \\\"Alex\\\",\\n status: \\\"open\\\",\\n case_id: \\\"6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz\\\",\\n }),\\n});\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-primero\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with UNICEF's\\nPrimero API.\\n\\n**See Update Docs Site: https://docs.openfn.org/adaptors/packages/primero-docs**\\n\\n## Primero API Versions\\n\\n### Adaptor for Primero v2.0\\n\\nThis documentation outlines the functions available for Primero `v2.0` in the\\nmain branch. The API documentation is available at:\\nhttps://github.com/primeroIMS/primero/tree/development_v2/app/controllers/api\\n\\n### Adaptor for Primero v1.0 still available on the `v1` branch.\\n\\n`v1.0.7` of this adaptor was built for the Primero `v1.1` API:\\nhttps://github.com/OpenFn/language-primero/blob/v1/README.md\\n\\n[Primero API v1.1 Documentation](https://docs.google.com/document/d/1jpaT2_UBBnc3PxPYlLMBEzNUkyfuxRZiksywG5MKM0Q/edit)\\n\\n#### Primero Authentication Strategies\\n\\nThe Primero team is considering a shift to Microsoft Azure Active Directory B2C\\nfor auth. We can likely accommodate this with a similar pattern as has been used\\nin our Microsoft Dynamics, Github, or Google Sheets adaptors, but we'll need to\\nawait final doucmentation for Primero's `v2` API before making changes.\\n\\n[Azure Active Directory B2C](https://docs.microsoft.com/en-us/azure/active-directory-b2c/)\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-primero\\n\\n## 2.11.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 2.11.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 2.11.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 2.11.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 2.11.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 2.11.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 2.11.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 2.11.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 2.11.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 2.10.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 2.10.5\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 2.10.4\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 2.10.3\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n- 059c956: added examples in docstring\\n\\n## 2.10.2\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 2.10.1\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 2.10.0\\n\\n### Minor Changes\\n\\n- 33742bf: Modify `composeNextState` so that `getCases` can pass it a third\\n argument: the metadata from Primero's response.\\n\\n `getCases` will now not only return an array of `cases` in `state.data`, but\\n metadata related to pagination in `state.metadata`.\\n\\n### Patch Changes\\n\\n- 2014694: remove travis url in readme\\n- bb764db: Conditionally check for 'withReferrals' in case no options are\\n provided\\\"\\n\\n## 2.9.2\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\\n## 2.9.1\\n\\n### Patch Changes\\n\\n- d4ac748: Skipped failing test until we have a new strat (it's working)\\n\\n## 2.9.0\\n\\n### Minor Changes\\n\\n- b37a4ad: add language primero into monorepo\\n\\n### Patch Changes\\n\\n- adb97a0: Fixed issue where upsertCase always took state.data for main params\\n\"","functions":["createCase","createReferrals","getCases","getForms","getLocations","getLookups","getReferrals","updateCase","updateReferral","upsertCase"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"url":{"title":"URL","type":"string","description":"The Primero host url","format":"uri","minLength":1,"examples":["https://primero.org/some-org"]},"user":{"title":"User","type":"string","description":"The username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"minLength":1,"examples":["@super(!)Superpass"]},"basicAuth":{"title":"Use Basic Auth","type":"boolean","examples":[true]}},"type":"object","additionalProperties":true,"required":["url"]}}, +{"name":"progres","adaptor":"@openfn/language-progres","version":"1.3.8","docs":"\"## postData\\n\\npostData(params, callback) ⇒ Operation\\nMake a POST request with a certificate\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Url, Headers and Body parameters |\\n| callback | function | (Optional) A callback function |\\n\\n**Example** \\n```js\\npostData({\\n url: urlDTP,\\n body: obj,\\n headers: {\\n 'Ocp-Apim-Subscription-Key': configuration['Ocp-Apim-Subscription-Key'],\\n },\\n agentOptions: {\\n key,\\n cert,\\n },\\n}, callback)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-progres\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the UNHCR\\nProGres v4 API.\\n\\n## Design notes\\n\\n- Integration must run through UNHCR's DTP, a middleware layer that provides a\\n public API for UNHCR internal software.\\n- An API token _and_ a self-signed certificate must be provided for\\n communication with UNHCR's DTP.\\n- Two-way sync must be possible between Primero and ProGres\\n- Teams still in discussion about whether the most common use-case will be a\\n timed sync or real-time/event-based sync.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/progres-docs) for\\nfull technical documentation.\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/progres-configuration-schema/)\\ndefinition.\\n\\n### Posting data to an endpoint with SSL cert authentication\\n\\n```js\\npostData({\\n url: urlDTP,\\n body: { a: 1 },\\n headers: {\\n 'Subscription-Key': configuration['token'],\\n },\\n agentOptions: {\\n key,\\n cert,\\n },\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-progres\\n\\n## 1.3.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 1.3.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 1.3.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 1.3.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 1.3.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 1.3.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 1.3.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 1.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.2.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 1.2.4\\n\\n### Patch Changes\\n\\n- ef828e7: update old urls in readme\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.2.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.2.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.2.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- 039ca0b: Migrate Progres\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":["postData"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"url":{"title":"URL","type":"string","description":"The Progres URL","format":"uri","minLength":1,"examples":["https://endpoint/To/DTP"]},"key":{"title":"Private Key","type":"string","description":"Your Progres private key","minLength":1,"examples":["-----BEGIN PRIVATE KEY-----SOMETYPEOFPRIVATEVALUE-----END PRIVATE KEY-----"]},"cert":{"title":"Certificate","type":"string","description":"Your Progres certificate","minLength":1,"examples":["-----BEGIN CERTIFICATE-----SOMETYPEOFVALUE-----END CERTIFICATE-----"]},"token":{"title":"Token","type":"string","description":"Your Progres token","writeOnly":true,"minLength":1,"examples":["[REDACTED]"]}},"type":"object","additionalProperties":true,"required":["url","key","cert","token"]}}, +{"name":"rapidpro","adaptor":"@openfn/language-rapidpro","version":"1.0.8","docs":"\"## Functions\\n\\n
\\n
\\n addContact(params, callback)
\\n
\\n sendBroadcast(params, callback)
\\n
\\n startFlow(params, callback)
\\n
\\n upsertContact(params, callback)
\\n
\\n\\n\\n## addContact\\n\\naddContact(params, callback) ⇒ Operation\\nAdds a new contact to RapidPro\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to create the new resource |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\naddContact({\\n name: \\\"Mamadou\\\",\\n language: \\\"ENG\\\",\\n urns: [\\\"tel:+250788123123\\\"]\\n});\\n```\\n\\n* * *\\n\\n## sendBroadcast\\n\\nsendBroadcast(params, callback) ⇒ Operation\\nSends a message to a list of contacts and/or URNs\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to create the new resource |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nsendBroadcast({\\n text: \\\"Hello world\\\",\\n urns: [\\\"twitter:sirmixalot\\\"],\\n contacts: [\\\"a052b00c-15b3-48e6-9771-edbaa277a353\\\"]\\n});\\n```\\n\\n* * *\\n\\n## startFlow\\n\\nstartFlow(params, callback) ⇒ Operation\\nStart a RapidPro flow for a number of contacts\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to create the new resource |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nstartFlow({\\n flow: \\\"f5901b62-ba76-4003-9c62-72fdacc1b7b7\\\",\\n restart_participants: false,\\n contacts: [\\\"a052b00c-15b3-48e6-9771-edbaa277a353\\\"]\\n});\\n```\\n\\n* * *\\n\\n## upsertContact\\n\\nupsertContact(params, callback) ⇒ Operation\\nUpserts a contact to RapidPro by URN\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to upsert a contact |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nupsertContact({\\n name: \\\"Mamadou\\\",\\n language: \\\"ENG\\\",\\n urns: [\\\"tel:+250788123123\\\"]\\n});\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-rapidpro\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the\\n[RapidPro API](https://rapidpro.io/api/v2/).\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/rapidpro-docs)\\nfor full technical documentation.\\n\\n## Usage\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/rapidpro-configuration-schema/)\\ndefinition.\\n\\n#### sample job expression using operation\\n\\n```js\\nsendBroadcast({\\n \\\"text\\\": \\\"Hello friends.\\\",\\n \\\"urns\\\": [],\\n \\\"contacts\\\": [],\\n \\\"groups\\\", [],\\n});\\n```\\n\\n### Key helper functions\\n\\n**sendBroadcast(...) to send broadcast message to multiple contacts**\\n\\n```js\\nsendBroadcast({\\n text: 'Hello world',\\n urns: ['twitter:sirmixalot'],\\n contacts: ['a052b00c-15b3-48e6-9771-edbaa277a353'],\\n});\\n```\\n\\n**startFlow(...) to trigger an automation flow in RapidPro**\\n\\n```js\\nstartFlow({\\n flow: 'f5901b62-ba76-4003-9c62-72fdacc1b7b7',\\n restart_participants: false,\\n contacts: ['a052b00c-15b3-48e6-9771-edbaa277a353'],\\n});\\n```\\n\\n**upsertContact(...) to update/insert a Contact (and check if exists using\\nexternal identifiers)**\\n\\n```js\\nupsertContact({\\n name: 'Mamadou',\\n language: 'ENG',\\n urns: ['tel:+250788123123'],\\n});\\n```\\n\\n**addContact(...) to insert a Contact**\\n\\n```js\\naddContact({\\n name: 'Mamadou',\\n language: 'ENG',\\n urns: ['tel:+250788123123'],\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-rapidpro\\n\\n## 1.0.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 1.0.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 1.0.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 1.0.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 1.0.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 1.0.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 1.0.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 1.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.5.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 0.5.5\\n\\n### Patch Changes\\n\\n- ef828e7: update old urls in readme\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.5.4\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.5.3\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.5.2\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.5.1\\n\\n### Patch Changes\\n\\n- cbb8968: Fix axios Inefficient Regular Expression Complexity vulnerability\\n\\n## 0.5.0\\n\\n### Minor Changes\\n\\n- 11f83ff: Migrate RapidPro\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":["addContact","sendBroadcast","startFlow","upsertContact"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"host":{"title":"Host","type":"string","default":"https://app.rapidpro.io/","description":"instance host URL","format":"uri","minLength":1,"examples":["https://app.rapidpro.io/"]},"token":{"title":"Token","type":"string","description":"instance access token","writeOnly":true,"minLength":1,"examples":["#Super-sSCrecrete-token"]},"apiVersion":{"title":"API Version","type":"string","description":"API version to use. Leave this empty to use the default v2","minLength":1,"examples":["v2"]}},"type":"object","additionalProperties":true,"required":["host","token"]}}, +{"name":"resourcemap","adaptor":"@openfn/language-resourcemap","version":"0.3.1","docs":"\"## submitSite\\n\\nsubmitSite(eventData) ⇒ Operation\\nCreate an event\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| eventData | object | Payload data for the event |\\n\\n**Example** \\n```js\\nexecute(\\n event(eventData)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language ResourceMap\\n\\nLanguage Pack for building expressions and operations for working with the\\n[resourcemap API](https://github.com/instedd/resourcemap/wiki/REST_API).\\n\\n## Documentation\\n\\nWe are working towards this to start:\\nhttps://github.com/instedd/resourcemap/wiki/REST_API#create-site\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/resourcemap-configuration-schema/)\\ndefinition.\\n\\n## Expressions\\n\\n## `submitSite(collectionId, fields)`\\n\\n```js\\nsubmitSite(\\n 303,\\n fields(\\n field('name', dataValue('sampleText')),\\n field('lat', 48.86),\\n field('lon', 2.35),\\n field('properties', function (state) {\\n return {\\n Comment: state.data.sampleText,\\n phone: '85512345678',\\n };\\n })\\n )\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-resourcemap\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.2.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.2.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- 664dc7f: migrate resourcemap\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"baseUrl":{"title":"Base URL","type":"string","default":"http://some-site-of-yours.com:8080","description":"ResourceMap base URL","format":"uri","minLength":1,"examples":["http://some-site-of-yours.com:8080"]},"username":{"title":"Username","type":"string","description":"Your ResourceMap username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Your ResourceMap password","writeOnly":true,"minLength":1,"examples":["@super(!)Secret"]}},"type":"object","additionalProperties":true,"required":["baseUrl"]}}, +{"name":"salesforce","adaptor":"@openfn/language-salesforce","version":"4.3.1","docs":"\"## Functions\\n\\n
\\n
\\n bulk(sObject, operation, options, fun)
\\n
\\n bulkQuery(qs, options, callback)
\\n
\\n cleanupState(state)
\\n
\\n create(sObject, attrs)
\\n
\\n createConnection(state)
\\n
\\n createIf(logical, sObject, attrs)
\\n
\\n describe(sObject)
\\n
\\n describeAll()
\\n
\\n destroy(sObject, attrs, options)
\\n
\\n execute(operations)
\\n
\\n login(state)
\\n
\\n query(qs)
\\n
\\n reference(position)
\\n
\\n relationship(relationshipName, externalId, dataSource)
\\n
\\n retrieve(sObject, id, callback)
\\n
\\n steps()
\\n
\\n toUTF8(input)
\\n
\\n update(sObject, attrs)
\\n
\\n upsert(sObject, externalId, attrs)
\\n
\\n upsertIf(logical, sObject, externalId, attrs)
\\n
\\n\\n\\n## bulk\\n\\nbulk(sObject, operation, options, fun) ⇒ Operation\\nCreate and execute a bulk job.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | API name of the sObject. |\\n| operation | String | The bulk operation to be performed |\\n| options | Object | Options passed to the bulk api. |\\n| fun | function | A function which takes state and returns an array. |\\n\\n**Example** \\n```js\\nbulk('Patient__c', 'insert', { failOnError: true, pollInterval: 3000, pollTimeout: 240000 }, state => {\\n return state.data.someArray.map(x => {\\n return { 'Age__c': x.age, 'Name': x.name }\\n })\\n});\\n```\\n\\n* * *\\n\\n## bulkQuery\\n\\nbulkQuery(qs, options, callback) ⇒ Operation\\nExecute an SOQL Bulk Query.\\nThis function uses bulk query to efficiently query large data sets and reduce the number of API requests.\\nNote that in an event of a query error,\\nerror logs will be printed but the operation will not throw the error.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| qs | String | A query string. |\\n| options | Object | Options passed to the bulk api. |\\n| [options.pollTimeout] | integer | Polling timeout in milliseconds. |\\n| [options.pollInterval] | integer | Polling interval in milliseconds. |\\n| callback | function | A callback to execute once the record is retrieved |\\n\\n**Example** *(The results will be available on `state.data`)* \\n```js\\nbulkQuery(state=> `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`);\\n```\\n**Example** \\n```js\\nbulkQuery(\\n (state) =>\\n `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`,\\n { pollTimeout: 10000, pollInterval: 6000 }\\n);\\n```\\n\\n* * *\\n\\n## cleanupState\\n\\ncleanupState(state) ⇒ State\\nRemoves unserializable keys from the state.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n\\n**Example** \\n```js\\ncleanupState(state)\\n```\\n\\n* * *\\n\\n## create\\n\\ncreate(sObject, attrs) ⇒ Operation\\nCreate a new object.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | API name of the sObject. |\\n| attrs | Object | Field attributes for the new object. |\\n\\n**Example** \\n```js\\ncreate('obj_name', {\\n attr1: \\\"foo\\\",\\n attr2: \\\"bar\\\"\\n})\\n```\\n\\n* * *\\n\\n## createConnection\\n\\ncreateConnection(state) ⇒ State\\nCreates a connection.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | Runtime state. |\\n\\n**Example** \\n```js\\ncreateConnection(state)\\n```\\n\\n* * *\\n\\n## createIf\\n\\ncreateIf(logical, sObject, attrs) ⇒ Operation\\nCreate a new object if conditions are met.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| logical | boolean | a logical statement that will be evaluated. |\\n| sObject | String | API name of the sObject. |\\n| attrs | Object | Field attributes for the new object. |\\n\\n**Example** \\n```js\\ncreateIf(true, 'obj_name', {\\n attr1: \\\"foo\\\",\\n attr2: \\\"bar\\\"\\n})\\n```\\n\\n* * *\\n\\n## describe\\n\\ndescribe(sObject) ⇒ Operation\\nOutputs basic information about an sObject to `STDOUT`.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | API name of the sObject. |\\n\\n**Example** \\n```js\\ndescribe('obj_name')\\n```\\n\\n* * *\\n\\n## describeAll\\n\\ndescribeAll() ⇒ Operation\\nOutputs basic information about available sObjects.\\n\\n**Kind**: global function \\n**Access**: public \\n**Example** \\n```js\\ndescribeAll()\\n```\\n\\n* * *\\n\\n## destroy\\n\\ndestroy(sObject, attrs, options) ⇒ Operation\\nDelete records of an object.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | API name of the sObject. |\\n| attrs | Object | Array of IDs of records to delete. |\\n| options | Object | Options for the destroy delete operation. |\\n\\n**Example** \\n```js\\ndestroy('obj_name', [\\n '0060n00000JQWHYAA5',\\n '0090n00000JQEWHYAA5\\n], { failOnError: true })\\n```\\n\\n* * *\\n\\n## execute\\n\\nexecute(operations) ⇒ State\\nExecutes an operation.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| operations | Operation | Operations |\\n\\n\\n* * *\\n\\n## login\\n\\nlogin(state) ⇒ State\\nPerforms a login.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | Runtime state. |\\n\\n**Example** \\n```js\\nlogin(state)\\n```\\n\\n* * *\\n\\n## query\\n\\nquery(qs) ⇒ Operation\\nExecute an SOQL query.\\nNote that in an event of a query error,\\nerror logs will be printed but the operation will not throw the error.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| qs | String | A query string. |\\n\\n**Example** \\n```js\\nquery(`SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`);\\n```\\n\\n* * *\\n\\n## reference\\n\\nreference(position) ⇒ State\\nGet a reference ID by an index.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| position | number | Position for references array. |\\n\\n**Example** \\n```js\\nreference(0)\\n```\\n\\n* * *\\n\\n## relationship\\n\\nrelationship(relationshipName, externalId, dataSource) ⇒ object\\nAdds a lookup relation or 'dome insert' to a record.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| relationshipName | string | `__r` relationship field on the record. |\\n| externalId | string | Salesforce ExternalID field. |\\n| dataSource | string | resolvable source. |\\n\\n**Example** \\n```js\\nData Sourced Value:\\n relationship(\\\"relationship_name__r\\\", \\\"externalID on related object\\\", dataSource(\\\"path\\\"))\\nFixed Value:\\n relationship(\\\"relationship_name__r\\\", \\\"externalID on related object\\\", \\\"hello world\\\")\\n```\\n\\n* * *\\n\\n## retrieve\\n\\nretrieve(sObject, id, callback) ⇒ Operation\\nRetrieves a Salesforce sObject(s).\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | The sObject to retrieve |\\n| id | String | The id of the record |\\n| callback | function | A callback to execute once the record is retrieved |\\n\\n**Example** \\n```js\\nretrieve('ContentVersion', '0684K0000020Au7QAE/VersionData');\\n```\\n\\n* * *\\n\\n## steps\\n\\nsteps() ⇒ Array\\nFlattens an array of operations.\\n\\n**Kind**: global function \\n**Example** \\n```js\\nsteps(\\n createIf(params),\\n update(params)\\n)\\n```\\n\\n* * *\\n\\n## toUTF8\\n\\ntoUTF8(input) ⇒ String\\nTransliterates unicode characters to their best ASCII representation\\n\\n**Kind**: global function \\n**Returns**: String - - ASCII representation of input string \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| input | string | A string with unicode characters |\\n\\n**Example** \\n```js\\nfn((state) => {\\n const s = toUTF8(\\\"άνθρωποι\\\");\\n console.log(s); // anthropoi\\n return state;\\n});\\n```\\n\\n* * *\\n\\n## update\\n\\nupdate(sObject, attrs) ⇒ Operation\\nUpdate an object.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | API name of the sObject. |\\n| attrs | Object | Field attributes for the new object. |\\n\\n**Example** \\n```js\\nupdate('obj_name', {\\n attr1: \\\"foo\\\",\\n attr2: \\\"bar\\\"\\n})\\n```\\n\\n* * *\\n\\n## upsert\\n\\nupsert(sObject, externalId, attrs) ⇒ Operation\\nUpsert an object.\\n\\n**Kind**: global function \\n**Access**: public \\n**Magic**: sObject - $.children[?(!@.meta.system)].name \\n**Magic**: externalId - $.children[?(@.name==\\\"{{args.sObject}}\\\")].children[?(@.meta.externalId)].name \\n**Magic**: attrs - $.children[?(@.name==\\\"{{args.sObject}}\\\")].children[?(!@.meta.externalId)] \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | API name of the sObject. |\\n| externalId | String | ID. |\\n| attrs | Object | Field attributes for the new object. |\\n\\n**Example** \\n```js\\nupsert('obj_name', 'ext_id', {\\n attr1: \\\"foo\\\",\\n attr2: \\\"bar\\\"\\n})\\n```\\n\\n* * *\\n\\n## upsertIf\\n\\nupsertIf(logical, sObject, externalId, attrs) ⇒ Operation\\nUpsert if conditions are met.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| logical | boolean | a logical statement that will be evaluated. |\\n| sObject | String | API name of the sObject. |\\n| externalId | String | ID. |\\n| attrs | Object | Field attributes for the new object. |\\n\\n**Example** \\n```js\\nupsertIf(true, 'obj_name', 'ext_id', {\\n attr1: \\\"foo\\\",\\n attr2: \\\"bar\\\"\\n})\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Salesforce\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the\\nSalesforce API.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/salesforce-docs)\\nfor full technical documentation.\\n\\n## Release notes and deprecated CHANGELOG.md\\n\\nSee [releases](https://docs.openfn.org/adaptors/packages/salesforce-changelog)\\nfor all changes.\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/saleforce-configuration-schema/)\\ndefinition.\\n\\n## Intent\\n\\n---\\n\\nAllow communication with Salesforce using a set of Lisp compatible expressions.\\n\\nUsing simple functions we can create a simplified API, simple enough to generate\\ncode from data.\\n\\n## Expressions\\n\\n---\\n\\nExpressions are a simplified set of function calls. Outlining the operations\\nneeded to be performed.\\n\\nAn uncompiled expression has no knowledge of the internals of the adaptor,\\ncredentials or runtime environment.\\n\\nIt's the responsibility of the build process to provide a wrapper that will\\ninject the functions in.\\n\\nFor example:\\n\\n```javascript\\ndescribe('vera__Test_Event__c'),\\n create('vera__Test_Event__c', {\\n vera__Test_Event_Name_Unique__c: 'hello from jsforce',\\n }),\\n create('vera__Boat__c', {\\n Name: 'Catatafish redux!',\\n vera__Test_Event__c: reference(0),\\n });\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\\n## Other\\n\\nCreate SOAP session\\n\\n```sh\\ncurl https://test.salesforce.com/services/Soap/u/47.0 -H \\\"Content-Type: text/xml; charset=UTF-8\\\" -H \\\"SOAPAction: login\\\" -d @tmp/login.txt | xmllint --format -\\n```\\n\\nClose jobs\\n\\n```sh\\ncurl\\nhttps://openfn.my.salesforce.com/services/async/47.0/job/some_id -H 'X-SFDC-Session: abc123sessionID456xyz' -H \\\"Content-Type: application/xml; charset=UTF-8\\\" -d @tmp/close_job.txt | xmllint --format -\\n```\\n\"","changelog":"\"# @openfn/language-salesforce\\n\\n## 4.3.1\\n\\n### Patch Changes\\n\\n- 1131c34: Remove regex pattern for validation and changed minLength to 1\\n\\n## 4.3.0\\n\\n### Minor Changes\\n\\n- 1d5b62f: Add `toUTF8` function\\n\\n## 4.2.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 4.2.1\\n\\n### Patch Changes\\n\\n- 07debe9: Update bulkQuery to use bulkv2\\n\\n## 4.2.0\\n\\n### Minor Changes\\n\\n- fc58f1c: add options in bulkQuery\\n\\n## 4.1.0\\n\\n### Minor Changes\\n\\n- 1e3a083: add bulkQuery function\\n\\n## 4.0.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 4.0.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 4.0.6\\n\\n### Patch Changes\\n\\n- aceedd2: update jsforce and remove unused packages\\n\\n## 4.0.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 4.0.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 4.0.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 4.0.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 4.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 4.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 3.0.7\\n\\n### Patch Changes\\n\\n- 7cc8efc: remove FakeAdaptor references\\n\\n## 3.0.6\\n\\n### Patch Changes\\n\\n- 705caab: Remove tools as devdependencies\\n\\n## 3.0.5\\n\\n### Patch Changes\\n\\n- 929bca6: Use metadata helper function from common\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 3.0.4\\n\\n### Patch Changes\\n\\n- ef828e7: update old urls in readme\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 3.0.3\\n\\n### Patch Changes\\n\\n- 06aced8: Fix dependencies\\n\\n## 3.0.2\\n\\n### Patch Changes\\n\\n- aed7e0b: fix required field in configuration schema\\n\\n## 3.0.1\\n\\n### Patch Changes\\n\\n- c09b821: Add @magic annotations\\n\\n## 3.0.0\\n\\n### Major Changes\\n\\n- 190f667: Remove curry from salesforce\\n\\n## 2.12.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 2.12.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 2.12.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 2.12.0\\n\\n### Minor Changes\\n\\n- 5c883c6: Allow expansion for describe(), add describeAll()\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 2.11.1\\n\\n### Patch Changes\\n\\n- e7bf865: chore(deps): update dependency sinon to v14\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 2.11.0\\n\\n### Minor Changes\\n\\n- edff578: Migrate salesforce\\n\"","functions":["bulk","bulkQuery","create","createIf","describe","describeAll","destroy","query","reference","relationship","retrieve","toUTF8","update","upsert","upsertIf"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"loginUrl":{"title":"Login URL","type":"string","description":"The Salesforce instance login URL","format":"uri","minLength":1,"examples":["https://somesalesforcelogin.url"]},"username":{"title":"Username","type":"string","description":"The username to log in the Salesforce instance","minLength":1,"examples":["someusername"]},"password":{"title":"Password","type":"string","description":"The password to log in the Salesforce instance","writeOnly":true,"minLength":1,"examples":["@super(!)SecretPass"]},"securityToken":{"title":"Security Token","type":"string","description":"The security token to access the Salesforce instance","minLength":1,"examples":["salesforcesecuritytoken"]},"apiVersion":{"title":"API Version","type":"string","placeholder":"52.0","description":"Salesforce API Version","minLength":1,"examples":["59.0"]}},"type":"object","additionalProperties":true,"required":["loginUrl","username","password","securityToken"]}}, +{"name":"sftp","adaptor":"@openfn/language-sftp","version":"1.0.2","docs":"\"## Functions\\n\\n
\\n
\\n getCSV(filePath, [parsingOptions])
\\n
\\n getJSON(filePath, encoding)
\\n
\\n list(dirPath, filter, [callback])
\\n
\\n normalizeCSVarray(options, callback)
\\n
\\n putCSV(localFilePath, remoteFilePath, parsingOptions)
\\n
\\n\\n\\n## getCSV\\n\\ngetCSV(filePath, [parsingOptions]) ⇒ Operation\\nGet a CSV and return a JSON array of strings for each item separated by the delimiter\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| filePath | string | Path to resource |\\n| [parsingOptions] | Object | Optional. `parsingOptions` Parsing options which can be passed to convert csv to json See more [on csvtojson docs](https://github.com/Keyang/node-csvtojson#parameters) |\\n\\n**Example** \\n```js\\ngetCSV(\\n '/some/path/to_file.csv',\\n {delimiter: \\\";\\\", flatKeys: true }\\n);\\n```\\n\\n* * *\\n\\n## getJSON\\n\\ngetJSON(filePath, encoding) ⇒ Operation\\nFetch a json file from an FTP server\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| filePath | string | Path to resource |\\n| encoding | string | Character encoding for the json |\\n\\n**Example** \\n```js\\ngetJSON(\\n '/path/To/File',\\n 'utf8',\\n);\\n```\\n\\n* * *\\n\\n## list\\n\\nlist(dirPath, filter, [callback]) ⇒ Operation\\nList files present in a directory\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| dirPath | string | Path to remote directory |\\n| filter | function | a filter function used to select return entries |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(basic files listing)* \\n```js\\nlist('/some/path/')\\n```\\n**Example** *(list files with filters)* \\n```js\\nlist('/some/path/', file=> {\\n return /foo.\\\\.txt/.test(file.name);\\n})\\n```\\n**Example** *(list files with filters and use callback)* \\n```js\\nlist(\\n \\\"/some/path/\\\",\\n (file) => /foo.\\\\.txt/.test(file.name),\\n (state) => {\\n const latestFile = state.data.filter(\\n (file) => file.modifyTime <= new Date()\\n );\\n return { ...state, latestFile };\\n }\\n);\\n```\\n\\n* * *\\n\\n## normalizeCSVarray\\n\\nnormalizeCSVarray(options, callback) ⇒ Operation\\nConvert JSON array of strings into a normalized object\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| options | options | Options passed to csvtojson parser |\\n| callback | callback | Options passed to csvtojson parser |\\n\\n**Example** \\n```js\\nnormalizeCSVarray({ delimiter: ';', noheader: true });\\n```\\n\\n* * *\\n\\n## putCSV\\n\\nputCSV(localFilePath, remoteFilePath, parsingOptions) ⇒ Operation\\nConvert JSON to CSV and upload to an FTP server\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| localFilePath | string | Data source for data to copy to the remote server. |\\n| remoteFilePath | string | Path to the remote file to be created on the server. |\\n| parsingOptions | object | Options which can be passed to adjust the read and write stream used in sending the data to the remote server |\\n\\n**Example** \\n```js\\nputCSV(\\n '/some/path/to_local_file.csv',\\n '/some/path/to_remove_file.csv',\\n { delimiter: ';', noheader: true }\\n);\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language SFTP\\n\\nLanguage Pack for building expressions and operations to work with SFTP servers.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/sftp-configuration-schema/)\\ndefinition.\\n\\n## List the content of a directory\\n\\n```js\\nalterState(state => {\\n return list('/path/To/Directory')(state).then(response => {\\n console.log(`There are ${response.data.length} files.`);\\n return response;\\n });\\n});\\n```\\n\\n## sample getCSV expression\\n\\n```js\\ngetCSV('path/to/file.csv', 'utf8', {\\n quote: 'off',\\n delimiter: ';',\\n noheader: true,\\n filter: {\\n type: 'startsWith',\\n key: 'field1',\\n value: 'JO',\\n },\\n});\\n```\\n\\nA more complex example that breaks up the CSV file into multiple payloads for\\nquicker processing.\\n\\n```js\\nfn(state => {\\n return list('/')(state).then(state => {\\n const targetNames = [\\n 'exportContacts', //example fileName\\n ];\\n console.log(`Fetching files: ${targetNames}`);\\n const files = state.data\\n .filter(file => file.name.split('.')[1] === 'csv')\\n .filter(file =>\\n targetNames.some(targetName =>\\n file.name.toLowerCase().includes(targetName)\\n )\\n );\\n\\n if (files.length === 0) console.log('No new CSV files found.');\\n return { ...state, data: {}, files };\\n });\\n});\\n\\neach(\\n '$.files[*]',\\n fn(state => {\\n const { configuration, data } = state;\\n\\n return getCSV(`/${data.name}`)(state).then(async state => {\\n const headers = state.data\\n .shift()\\n .split(';')\\n .map(h => (h = h.replace(/\\\"/g, '')));\\n\\n function toObject(item) {\\n const values = item.split(';');\\n\\n return Object.fromEntries(\\n headers.map((k, i) => {\\n return values[i]\\n ? [k, values[i].replace(/\\\"/g, '')]\\n : [k, values[i]];\\n })\\n );\\n }\\n\\n let countInbox = 0;\\n\\n //to post CSV data as individual Messages to OpenFn Inbox\\n const postToInbox = async data => {\\n countInbox++;\\n\\n console.log(`Sending request ${countInbox} to inbox`);\\n\\n await new Promise(resolve => setTimeout(resolve, 200));\\n\\n await http.post({\\n url: configuration.openfnInboxUrl,\\n data: data,\\n maxContentLength: Infinity,\\n maxBodyLength: Infinity,\\n })(state);\\n };\\n\\n //To split up into multiple, smaller payloads before send to OpenFn Inbox\\n const chunkSize = 500;\\n\\n console.log(\\n state.data.length,\\n 'rows will be sent in',\\n Math.ceil(state.data.length / chunkSize),\\n 'requests of',\\n chunkSize,\\n 'rows each.'\\n );\\n\\n while (state.data.length > 0) {\\n console.log('data.length', state.data.length);\\n await postToInbox({\\n fileName: data.name,\\n fileType: data.name.split('-')[0],\\n uploadDate: new Date(data.modifyTime).toISOString(),\\n json: state.data.splice(0, chunkSize).map(toObject),\\n });\\n }\\n\\n return { configuration, references: [], data: {} };\\n });\\n })\\n);\\n```\\n\\n## sample putCSV expression\\n\\nThis function converts JSON to CSV and post to a server\\n\\n```js\\nputCSV('/some/path/to_file.csv', 'utf8', { delimiter: ';', noheader: true });\\n```\\n\\n### Get JSON from FTP server\\n\\n```js\\ngetJSON('path/to/file.json', 'utf8');\\n```\\n\\n### Custom request to an http endpoint\\n\\nThis adaptor exports `http` from `language-common`. Here, we outline the usage\\nin order to make custom requests to an endpoint. It returns a promise\\n\\n```js\\nalterState(state => {\\n return http\\n .post({ url: 'yourURL', data: { name: 'Mamadou' } })(state)\\n .then(response => {\\n // do something with response;\\n return response;\\n });\\n});\\n```\\n\\n## Development\\n\\nClone the repo, run `pnpm install`.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build the docs for this repo, `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-sftp\\n\\n## 1.0.2\\n\\n### Patch Changes\\n\\n- a666a63: On error disconnect then throw\\n\\n## 1.0.1\\n\\n### Patch Changes\\n\\n- 771c814: - Properly disconnect on error\\n - Improve operation logs\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\n- e52ba66: add `filter` option in `list()` function\\n\\n## 0.8.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 0.8.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 0.8.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 0.8.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 0.8.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 0.8.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 0.8.2\\n\\n### Patch Changes\\n\\n- d2c980e: Use `parseCsv` from language-common\\n- c5d3ce1: improve connection handling\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 0.8.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.8.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.7.3\\n\\n### Patch Changes\\n\\n- 432dd0a: fix sftp connection wqautoclose\\n\\n## 0.7.2\\n\\n### Patch Changes\\n\\n- 205b806: remove asObjects key before parsing\\n\\n## 0.7.1\\n\\n### Patch Changes\\n\\n- 827c627: error handling\\n\\n## 0.7.0\\n\\n### Minor Changes\\n\\n- fa58216: Add csvtojson convertion option\\n\\n## 0.6.9\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 0.6.8\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.6.7\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.6.6\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.6.5\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.6.4\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 0.6.3\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- 4126a62: Fix built bundle\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 0.6.2\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\\n## 0.6.1\\n\\n### Patch Changes\\n\\n- 28dfbfa: add todo, fix build pack\\n\\n## 0.6.0\\n\\n### Minor Changes\\n\\n- f294a62: Added credential-schema.json for new ui\\n\\n## 0.5.0\\n\\n### Minor Changes\\n\\n- 2c04894: added sftp package\\n\"","functions":["getCSV","getJSON","list","normalizeCSVarray","putCSV"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"host":{"title":"Host URL","type":"string","description":"The SFTP server host url or ip address","format":"uri","minLength":1,"examples":["191.173.128.88"]},"port":{"title":"Port","type":"integer","default":21,"description":"The SFTP server port","minLength":1,"examples":[22]},"username":{"title":"Username","type":"string","description":"Username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"minLength":1,"examples":["@some(!)Strongpassword"]}},"type":"object","additionalProperties":true,"required":["host"]}}, +{"name":"smpp","adaptor":"@openfn/language-smpp","version":"1.3.1","docs":"\"\"","readme":"\"# Language SMPP\\n\\nLanguage Pack for building expressions and operations to make calls to an OpenFn\\nSMPP client API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/smpp-configuration-schema/)\\ndefinition.\\n\\n#### sample send expression\\n\\n```js\\nsend({\\n text: dataValue('text'),\\n smsId: dataValue('messageId'),\\n recipient: dataValue('to'),\\n sender: dataValue('from'),\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-smpp\\n\\n## 1.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.2.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.2.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.2.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- 3aedd05: migrate smpp\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"clientHost":{"title":"Client host","type":"string","description":"Your SMPP client host URL","format":"uri","minLength":1,"examples":["https://some-smpp.com:3000"]},"systemId":{"title":"System ID","type":"string","description":"Your SMPP client name","minLength":1,"examples":["some_smpp_client_name"]},"inboxId":{"title":"Inbox ID","type":"string","description":"Your SMPP client inbox ID","minLength":1,"examples":["1c908151-8273-431c-b1d4-blah"]},"password":{"title":"Password","type":"string","description":"Your SMPP client password","writeOnly":true,"minLength":1,"examples":["@some(!)StrongPassword"]}},"type":"object","additionalProperties":true,"required":["clientHost","systemId","inboxId","password"]}}, +{"name":"surveycto","adaptor":"@openfn/language-surveycto","version":"1.2.1","docs":"\"## fetchSubmissions\\n\\nfetchSubmissions(params) ⇒ Operation\\nMake a GET request and POST it somewhere else\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the fetch |\\n\\n**Example** \\n```js\\nexecute(\\n fetch(params)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language SurveyCTO\\n\\nLanguage Pack for building expressions and operations to make HTTP calls to\\nSurveyCTO.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/surveycto-configuration-schema/)\\ndefinition.\\n\\n## fetchSubmissions\\n\\n`fetchSubmissions(1,2,3)` takes three arguments:\\n\\n1. the `formId` of the form on SurveyCTO\\n\\n2. the `initialAfterDate`, a date string or UNIX timestamp which instructs the\\n job to only fetch submissions after a certain date. After the first run of\\n the job, subsequent runs will only fetch _NEW_ submissions.\\n\\n3. the `postUrl` is where the wide-format JSON representation of each form\\n submission should be sent. Note that a `formId` key will be added to each\\n form submission for later filtering/routing.\\n\\n### sample `fetchSubmissions` expression\\n\\n```js\\nfetchSubmissions(\\n // formId on SurveyCTO server\\n 'household_survey',\\n // initialAfterDate: this will only be accessed if \\\"lastSubmissionDate\\\" is empty in your job_state\\\".\\n // After the initial run of the job, OpenFn will only pull new submissions from SurveyCTO.\\n 'Aug 29, 2016 4:44:26 PM',\\n // postUrl is where you want to send the JSON submissions, appended with a new \\\"formId\\\" key\\n 'https://www.openfn.org/inbox/secret-inbox-uuid'\\n);\\n```\\n\\n## Development\\n\\nClone the repo, run `npm install`.\\n\\nRun tests using `npm run test` or `npm run test:watch`\\n\\nBuild the project using `make`.\\n\"","changelog":"\"# @openfn/language-surveycto\\n\\n## 1.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.1.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.1.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.1.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- 776bb13: migrate surveycto\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"instanceName":{"title":"Instance name","type":"string","description":"Your Surveycto instance name","minLength":1,"examples":["openfn_test"]},"username":{"title":"Username","type":"string","description":"Your Surveycto instance username","minLength":1,"examples":["someusername"]},"password":{"title":"Password","type":"string","description":"Your Surveycto instance password","writeOnly":true,"minLength":1,"examples":["@some(%)!Password"]}},"type":"object","additionalProperties":true,"required":["instanceName","username","password"]}}, +{"name":"telerivet","adaptor":"@openfn/language-telerivet","version":"0.2.1","docs":"\"## send\\n\\nsend(sendData) ⇒ Operation\\nSend a message\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sendData | object | Payload data for the message |\\n\\n**Example** \\n```js\\nexecute(\\n send(data)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Telerivet\\n\\nLanguage Pack for sending messages using the\\n[telerivet API](https://telerivet.com/api/rest/curl).\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/telerivet-configuration-schema/)\\ndefinition.\\n\\n## Send message\\n\\n#### Current `send` expression:\\n\\n```js\\nsend(\\n fields(\\n field('to_number', dataValue('recipient_number')),\\n field('content', dataValue('recipient_text')),\\n // Lots of optional parameters...\\n field('message_type', 'sms'),\\n field('route_id', dataValue('some_route'))\\n )\\n);\\n```\\n\\n## sendBulk messages - WIP\\n\\n#### Current `sendBulk` expression:\\n\\n```js\\nsend(fields(\\n field(\\\"content\\\", dataValue(\\\"recipient_text\\\")),\\n field(\\\"to_numbers\\\", [\\n \\\"+14155550123\\\",\\n \\\"+14255550234\\\",\\n \\\"+16505550345\\\"\\n ]\\n // Lots of optional parameters...\\n field(\\\"message_type\\\", \\\"sms\\\"),\\n field(\\\"route_id\\\", dataValue(\\\"some_route\\\"))\\n))\\n```\\n\\nNote that \\\"recipient_text\\\" may be a concatenation like this:\\n\\n```js\\nfield('content', function (state) {\\n return dataValue('salutation')(state).concat(\\n '. ',\\n dataValue('last_name')(state),\\n ', )'\\n );\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-telerivet\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.1.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.1.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.1.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.1.1\\n\\n### Patch Changes\\n\\n- e4ebcb6: Fix Large gzip Denial of Service in superagent\\n\\n## 0.1.0\\n\\n### Minor Changes\\n\\n- 83ede44: migrate telerivet\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"projectId":{"title":"Project ID","type":"string","description":"Your Telerivet project id","minLength":1,"examples":["telerivet_project_id"]},"apiKey":{"title":"API Key","type":"string","description":"Your Telerivet API Key","writeOnly":true,"minLength":1,"examples":["telerivet_api_key"]}},"type":"object","additionalProperties":true,"required":["projectId","apiKey"]}}, +{"name":"template","adaptor":"@openfn/language-template","version":"3.0.1","docs":"\"## create\\n\\ncreate(resource, data, callback) ⇒ Operation\\nCreate some resource in some system\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resource | string | The type of entity that will be created |\\n| data | object | The data to create the new resource |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ncreate(\\\"patient\\\", {\\\"name\\\": \\\"Bukayo\\\"})\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-template \\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the \\\\_\\\\_\\\\_\\\\_\\nAPI.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/template-docs)\\nfor full technical documentation.\\n\\n### Configuration\\n\\nView the\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/template-configuration-schema/)\\nfor required and optional `configuration` properties.\\n\\n### A example expression using the `create` function\\n\\n```js\\ncreate('patient', { name: 'Bukayo' });\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n\\\"Getting Started\\\" guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build _only_ the docs run `pnpm build docs`.\\n\"","changelog":"\"# @openfn/language-template\\n\\n## 3.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 3.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 2.0.0\\n\\n### Major Changes\\n\\n- 779596f: Use native fetch (undici) in template and add icons in openfn\\n\\n### Minor Changes\\n\\n- 1af9cd5: Better docs and resource names\\n\\n## 1.7.8\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.7.7\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.7.6\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.7.5\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.7.4\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 1.7.3\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- b5eb665: Adjusted docs for common and built to markdown\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 1.7.2\\n\\n### Patch Changes\\n\\n- f4b3dd6: remove travis build url\\n\\n## 1.7.1\\n\\n### Patch Changes\\n\\n- Fixed package.json for template adaptor\\n\\n## 1.7.0\\n\\n### Minor Changes\\n\\n- 554e905: Migrated to monorepo\\n\"","functions":["create"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"baseUrl":{"title":"Base URL","anyOf":[{"type":"string"},{"type":"null"}],"description":"The base URL (http://www.example.com)","format":"uri","minLength":1,"examples":["https://example.com"]},"username":{"title":"Username","type":"string","description":"Username","examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"examples":["@some(!)Str0ngp4ss0w0rd"]}},"type":"object","additionalProperties":true,"required":["password","username"]}}, +{"name":"tutorial","adaptor":"@openfn/language-tutorial","version":"1.0.0","docs":"\"\"","readme":"\"# language-tutorial\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the tutorial\\nAPI.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/tutorial-docs)\\nfor full technical documentation.\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/tutorial-configuration-schema/)\\ndefinition.\\n\\n#### sample expression using operation\\n\\n```js\\n// TODO\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"### CHANGELOG\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"baseUrl":{"title":"Base URL","anyOf":[{"type":"string"},{"type":"null"}],"description":"The base URL (http://www.example.com)","format":"uri","minLength":1,"examples":["https://example.com"]},"username":{"title":"Username","type":"string","description":"Username","examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"examples":["@some(!)Str0ngp4ss0w0rd"]}},"type":"object","additionalProperties":true,"required":["password","username"]}}, +{"name":"twilio","adaptor":"@openfn/language-twilio","version":"0.4.1","docs":"\"## sendSMS\\n\\nsendSMS(params) ⇒ Operation\\nSends an SMS message to a specific phone number\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | Object | an object containing 'body', 'from', and 'to' keys. |\\n\\n**Example** \\n```js\\nsendSMS({\\n body: dataValue('sampleText'),\\n from: dataValue('myFromNumber'),\\n to: dataValue('ukMobile'),\\n});\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language twilio\\n\\nLanguage Pack for building expressions and operations to interact with the\\ntwilio API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/twilio-configuration-schema/)\\ndefinition.\\n\\n### sendSMS\\n\\n#### sample expression, sending an sms\\n\\n```js\\nsendSMS({\\n body: dataValue('text'),\\n from: '+15005550006',\\n to: dataValue('recipient'),\\n});\\n```\\n\\n## local usage\\n\\n```sh\\n~/devtools/core/bin/core execute \\\\\\n -l ~/devtools/adaptors/language-twilio \\\\\\n -s ./tmp/state.json \\\\\\n -o ./tmp/output.json \\\\\\n -e ./tmp/expression.js\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-twilio\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- a22daa6: rename credential-schema to configuration-schemawq\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- a36a072: ymigrated twilio to monorepo\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":["sendSMS"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountSid":{"title":"Account ID","type":"string","description":"Your Twilio account id","writeOnly":true,"minLength":1,"examples":["account_id"]},"authToken":{"title":"Auth Token","type":"string","description":"Your Twilio auth token","writeOnly":true,"minLength":1,"examples":["evenMoreSecret"]}},"type":"object","additionalProperties":true,"required":["accountSid","authToken"]}}, +{"name":"vtiger","adaptor":"@openfn/language-vtiger","version":"1.2.1","docs":"\"\"","readme":"\"# Language Vtiger\\n\\nLanguage Pack for building expressions and operations to make calls to the\\nVtiger API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/vtiger-configuration-schema/)\\ndefinition.\\n\\n#### sample listTypes expression\\n\\n```js\\nlistTypes();\\n```\\n\\n#### sample postElement expression\\n\\n```js\\npostElement({\\n operation: \\\"create\\\"\\n elementType: \\\"leads\\\",\\n element: {\\n \\\"name\\\": dataValue(\\\"name\\\")(state),\\n \\\"surname\\\": dataValue(\\\"surname\\\")(state),\\n \\\"email\\\": dataValue(\\\"email\\\")(state)\\n }\\n});\\n\\n\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-vtiger\\n\\n## 1.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.1.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.1.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- b4a13ff: migrate vtiger\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"hostUrl":{"title":"Host URL","type":"string","description":"VTiger instance host URL","format":"uri","minLength":1,"examples":["https://openfunction.od2.vtiger.com"]},"username":{"title":"Username","type":"string","description":"VTiger instance username","minLength":1,"examples":["test@openfn.org"]},"accessToken":{"title":"Access Token","type":"string","description":"VTiger instance access token","writeOnly":true,"minLength":1,"examples":["@some()!veryHugeToke"]}},"type":"object","additionalProperties":true,"required":["hostUrl","username","accessToken"]}}, +{"name":"zoho","adaptor":"@openfn/language-zoho","version":"0.3.1","docs":"\"## addRow\\n\\naddRow(db, table, rowData) ⇒ Operation\\nTo add a row data to a database table\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| db | string | Database |\\n| table | string | Database table |\\n| rowData | object | row data to be added into the database |\\n\\n**Example** \\n```js\\naddRow(\\n'testing_openfn',\\n'Customers',\\nfields(field('Subject', dataValue('formId')), field('Status', 'Closed'))\\n);\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Zoho\\n\\nLanguage Pack for sending messages using the Zoho API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/zoho-configuration-schema/)\\ndefinition.\\n\\n### addRow\\n\\nTo add a row to the \\\"Customers\\\" table in the \\\"testing_openfn\\\" database, use the\\nfollowing `addRow` function.\\n\\n```js\\naddRow(\\n 'testing_openfn',\\n 'Customers',\\n fields(field('Subject', dataValue('formId')), field('Status', 'Closed'))\\n);\\n```\\n\\n### updateRow\\n\\nComing soon. Want to help?\\nhttps://zohoreportsapi.wiki.zoho.com/Updating-Data.html\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-zoho\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.2.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.2.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- f9ac74a: migrate zoho\\n\\n### Patch Changes\\n\\n- e4ebcb6: Fix Large gzip Denial of Service in superagent\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"account":{"title":"Account","type":"string","description":"Your Zoho account","minLength":1,"examples":["yourzohoaccount"]},"authToken":{"title":"Auth Token","type":"string","description":"Your Zoho authentication token","writeOnly":true,"minLength":1,"examples":["secreauthtoken"]},"apiVersion":{"title":"API Version","type":"string","default":"v2","enum":["v1","v2"],"description":"Zoho API version","minLength":1,"examples":["v2","v1"]}},"type":"object","additionalProperties":true,"required":["account","authToken","apiVersion"]}} +] diff --git a/docs/dynamics/CHANGELOG.md b/docs/dynamics/CHANGELOG.md new file mode 100644 index 000000000..6307ef5d6 --- /dev/null +++ b/docs/dynamics/CHANGELOG.md @@ -0,0 +1,122 @@ +# @openfn/language-dynamics + +## 0.4.8 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 0.4.7 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 0.4.6 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 0.4.5 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 0.4.4 + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 0.4.3 + +### Patch Changes + +- aad9549: Ensure that standard OAuth2 credentials with snake-cased + "access_token" keys can be used for OAuth2-reliant adaptors +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 0.4.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 0.4.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.4.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.3.5 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 0.3.4 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.3.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.3.2 + +### Patch Changes + +- f2aed32: add examples + +## 0.3.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.3.0 + +### Minor Changes + +- b032b9c: Migrate Dynamics + +### Patch Changes + +- e81561f: Updated ast and package.json diff --git a/docs/dynamics/README.md b/docs/dynamics/README.md new file mode 100644 index 000000000..b6dad412a --- /dev/null +++ b/docs/dynamics/README.md @@ -0,0 +1,93 @@ +# Language Dynamics + +Language Pack for building expressions and operations to make calls to the +Microsoft Dynamics API. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/dynamics-configuration-schema/) +definition. + +- _Dynamics uses oauth2. The language-package will expect to be given a valid + oauth token. If a valid token is not provided, it will fail. On OpenFn.org, + the `CredentialService` is responsible for making sure the the oauth token is + valid each time it assembles state to hand to `execute`._ + +#### sample createEntity expression + +```js +createEntity({ + entityName: 'accounts', + body: { + name: 'Open Function', + creditonhold: false, + address1_latitude: 47.639583, + description: 'This is the description of the sample account', + revenue: 5000000, + accountcategorycode: 1, + }, +}); +``` + +#### sample query expression + +_Can be used to retrieve or query a specific Entity if an entityId is declared +in the expression. Otherwise it will perform a query on all data with the +defined Entity Name_ + +```js +query({ + entityName: 'contacts', + entityId: '51a0e5b9-88df-e311-b8e5-6c3be5a8b200', + query: { + fields: ['fullname', 'birthdate'], + limit: 10, + orderBy: { + field: 'lastname', + direction: 'asc', + }, + filter: "firstname eq 'Cat'", + }, +}); +``` + +#### sample update expression + +```js +updateEntity({ + entityName: 'accounts', + entityId: 'f4301865-c64a-e711-80f3-e0071b6fd061', + body: { + name: 'wilder 2', + creditonhold: true, + address1_latitude: 47.639583, + description: 'This is the description of the sample account', + revenue: 5000000, + accountcategorycode: 1, + }, +}); +``` + +#### sample delete expression + +```js +deleteEntity({ + entityName: 'accounts', + entityId: 'aeef941b-254a-e711-80f1-e0071b685921', +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/dynamics/index.md b/docs/dynamics/index.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/facebook/CHANGELOG.md b/docs/facebook/CHANGELOG.md new file mode 100644 index 000000000..41f421098 --- /dev/null +++ b/docs/facebook/CHANGELOG.md @@ -0,0 +1,63 @@ +# @openfn/language-facebook + +## 0.3.2 + +### Patch Changes + +- aad9549: Ensure that standard OAuth2 credentials with snake-cased + "access_token" keys can be used for OAuth2-reliant adaptors +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 0.3.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.3.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.2.3 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.2.2 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.2.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.2.0 + +### Minor Changes + +- f7669d2: migrate facebook diff --git a/docs/facebook/README.md b/docs/facebook/README.md new file mode 100644 index 000000000..c82bb8344 --- /dev/null +++ b/docs/facebook/README.md @@ -0,0 +1,39 @@ +# Language Facebook + +Language Pack for building expressions and operations to interact with the +Facebook Messenger API. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/facebook-configuration-schema/) +definition. + +### postMessage + +#### sample expression using operation + +```js +postMessage({ + recipient: { + id: '', + }, + message: { + text: '', + }, +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/facebook/index.md b/docs/facebook/index.md new file mode 100644 index 000000000..0295a0b5b --- /dev/null +++ b/docs/facebook/index.md @@ -0,0 +1,26 @@ +## postMessage + +postMessage(params) ⇒ Operation +Post a message + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data to make the fetch | + +**Example** +```js +postMessage({ + "recipient": { + "id": "your-psid" + }, + "message": { + "text": "your-message" + } +}) +``` + +* * * + diff --git a/docs/fhir/CHANGELOG.md b/docs/fhir/CHANGELOG.md new file mode 100644 index 000000000..0c0bb4440 --- /dev/null +++ b/docs/fhir/CHANGELOG.md @@ -0,0 +1,97 @@ +# @openfn/language-fhir + +## 3.1.0 + +### Minor Changes + +- d94e9ee: Migrate from axios to using `fetch` from `undici` and add uniti tests + +## 3.0.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 3.0.0 + +### Major Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 2.0.0 + +### Major Changes + +- d4b4094: - Update configuration schema, + - Add `get()` function + - Fix `create()` axios config + - Remove unused code + - Improve error handling + - Improve response handling + +## 1.1.5 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 1.1.4 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 1.1.3 + +### Patch Changes + +- f2aed32: add examples + +## 1.1.2 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 1.1.1 + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 1.1.0 + +### Minor Changes + +- fee607e: Migrate FHIR, update package export + +### Patch Changes + +- cb5d0ed: Updated to @openfn/simple-ast v0.4.1 +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 diff --git a/docs/fhir/README.md b/docs/fhir/README.md new file mode 100644 index 000000000..7ab2b7592 --- /dev/null +++ b/docs/fhir/README.md @@ -0,0 +1,44 @@ +# language-fhir + +An OpenFn **_adaptor_** for building integration jobs for use with the HAPI FHIR +API. + +## FHIR Documentation + +The Restfull API can be seen here: https://www.hl7.org/fhir/http.html + +## Documentation + + + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/fhir-configuration-schema/) +definition. + +#### Creates a resource in a destination system using a POST request + +```js +create('/endpoint', { foo: 'bar' }); +``` + +#### Creates a transactionBundle for HAPI FHIR + +```js +createTransactionBundle({ + entry: [transactionBundle], +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/fhir/index.md b/docs/fhir/index.md new file mode 100644 index 000000000..bf09e55f1 --- /dev/null +++ b/docs/fhir/index.md @@ -0,0 +1,138 @@ +## Functions + +
+
+ create(path, params, callback)
+
+ createTransactionBundle(params, callback)
+
+ get(path, query, callback)
+
+ getClaim(claimId, query, callback)
+
+ + +## create + +create(path, params, callback) ⇒ Operation +Creates a resource in a destination system using a POST request + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | string | Path to resource | +| params | object | data to create the new resource | +| callback | function | (Optional) callback function | + +**Example** +```js +create("Bundle", {...state.data: type: "collection"}) +``` + +* * * + +## createTransactionBundle + +createTransactionBundle(params, callback) ⇒ Operation +Creates a transactionBundle for HAPI FHIR + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data to create the new transaction | +| callback | function | (Optional) callback function | + +**Example** +```js +createTransactionBundle({ + resourceType: "Bundle", + type: "transaction", + entry: [ + { + fullUrl: "https://hapi.fhir.org/baseR4/Patient/592442", + resource: { + resourceType: "Patient", + id: "592442", + name: [{ given: "Caleb", family: "Cushing" }], + }, + request: { + method: "POST", + url: "Patient", + }, + }, + ], +}); +``` + +* * * + +## get + +get(path, query, callback) ⇒ Operation +Get a resource in a FHIR system + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | string | Path to resource | +| query | object | data to get the new resource | +| callback | function | (Optional) callback function | + +**Example** *(Get Claim from FHIR with optional query)* +```js +get("Claim", { _include: "Claim:patient", _sort: "-_lastUpdated", _count: 200 }) +``` +**Example** *(Get Patient from FHIR)* +```js +get('Patient'); +``` + +* * * + +## getClaim + +getClaim(claimId, query, callback) ⇒ Operation +Get Claim in a FHIR system + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| claimId | string | (optional) claim id | +| query | object | (optinal) query parameters | +| callback | function | (Optional) callback function | + +**Example** +```js +getClaim({ _include: "Claim:patient", _sort: "-_lastUpdated", _count: 200 }); +``` + +* * * + +## request + +request ⇒ +This is an asynchronous function that sends a request to a specified URL with optional parameters +and headers, and returns the response data in JSON format. + +**Kind**: global constant +**Returns**: The `request` function is returning the parsed JSON data from the response of the HTTP +request made to the specified `url` with the given `params` and `method`. If there is an error in +the response, the function will throw an error. + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| url | string | | The URL of the API endpoint that the request is being made to. | +| [params] | object | | An object containing any additional parameters to be sent with the request, such as query parameters or request body data. It is an optional parameter and defaults to an empty object if not provided. | +| [method] | string | "GET" | The HTTP method to be used for the request. It defaults to 'GET' if not specified. | + + +* * * + diff --git a/docs/godata/CHANGELOG.md b/docs/godata/CHANGELOG.md new file mode 100644 index 000000000..724d6e886 --- /dev/null +++ b/docs/godata/CHANGELOG.md @@ -0,0 +1,73 @@ +# @openfn/language-godata + +## 3.4.0 + +### Minor Changes + +- df4cfca: Switch from `'writeOnly: true'` to `'format: email'` in the godata + configuration schema. + +## 3.3.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 3.3.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 3.2.4 + +### Patch Changes + +- ef828e7: update old urls in readme +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 3.2.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 3.2.2 + +### Patch Changes + +- f2aed32: add examples + +## 3.2.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 3.2.0 + +### Minor Changes + +- 8e7a79e: Migrate Godata + +### Patch Changes + +- cbb8968: Fix axios Inefficient Regular Expression Complexity vulnerability +- e81561f: Updated ast and package.json diff --git a/docs/godata/README.md b/docs/godata/README.md new file mode 100644 index 000000000..6038eae63 --- /dev/null +++ b/docs/godata/README.md @@ -0,0 +1,262 @@ +# language-godata + +An OpenFn **_adaptor_** for building integration jobs for use with the WHO +Go.Data API. + +[Go.Data](https://www.who.int/godata) is an outbreak investigation tool for +field data collection during public health emergencies. The tool includes +functionality for case investigation, contact follow-up, visualization of chains +of transmission including secure data exchange and is designed for flexibility +in the field, to adapt to the wide range of outbreak scenarios. + +## Documentation + +View the [docs site](https://docs.openfn.org/adaptors/packages/godata-docs) for +full technical documentation. + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/godata-configuration-schema/) +definition. + +## Helper Functions + +### post(...) + +## Fetch the list of outbreaks + +This function is used to fetch the whole list of outbreaks in Go.Data. + +```js +listOutbreaks(state => { + console.log(state.data); + return state; +}); +``` + +## Get a specific outbreak + +This function can be used to fetch one specific outbreak. A filtering mechanism +is used to specify a criteria to match. Mutliple outbreaks could be returned if +matched by the filter. + +```js +getOutbreak({ where: { name: 'Outbreak demo' } }, state => { + console.log(state.data); + return state; +}); +``` + +## Insert or Update an outbreak using a unique id as a key + +This function is used to either update a record in Go.Data if matched or insert +a new one if no record matched the unique id. + +```js +upsertOutbreak({ + externalId: '3dec33-ede3', + data: { + name: 'string', + description: 'string', + disease: 'string', + countries: [ + { + id: 'SENEGAL', + }, + ], + startDate: '2020-12-17T14:54:19.498Z', + endDate: '2020-12-17T14:54:19.498Z', + longPeriodsBetweenCaseOnset: 0, + periodOfFollowup: 0, + }, +}); +``` + +## Fetch the list of cases + +This function is used to fetch the whole list of cases for a specific outbreak +in Go.Data. + +```js +listCases('4c444f7-4e11-41d0-c1af-331dd15a892e', state => { + console.log(state); + return state; +}); +``` + +## Get a specific case + +This function can be used to fetch one specific case for an outbreak. A +filtering mechanism can specify a criteria to match. Mutliple cases could be +returned if matched by the filter. + +```js +getCase( + '4c444f7-4e11-41d0-c1af-331dd15a892e', + { 'where.relationship': { active: true }, where: { firstName: 'Luca' } }, + state => { + console.log(state); + return state; + } +); +``` + +## Insert or Update a case using a unique id as a key + +This function is used to either update a case in Go.Data if matched or insert a +new one if no record matched the unique id. + +```js +upsertCase('4dce-3eedce3-rd33', 'visualId', + data: state => { + const patient = state.data.body; + return { + firstName: patient.Patient_name.split(' ')[0], + lastName: patient.Patient_name.split(' ')[1], + visualId: patient.Case_ID, + 'age:years': patient.Age_in_year, + gender: patient.Sex, + }; + }); +``` + +## Fetch the list of contacts + +This function is used to fetch the whole list of contacts for a specific +outbreak in Go.Data. + +```js +listContacts('4c444f7-4e11-41d0-c1af-331dd15a892e', state => { + console.log(state); + return state; +}); +``` + +## Get a specific contact + +This function can be used to get one specific contact for an outbreak. A +filtering mechanism can specify a criteria to match. Mutliple contacts could be +returned if matched by the filter. + +```js +getContact('343d-dc3e', { where: { firstName: 'Luca' } }, state => { + console.log(state.data); + return state; +}); +``` + +## Insert or Update a contact using a unique id as a key + +This function is used to either update a contact in Go.Data if matched or insert +a new one if no record matched the unique id. + +```js +upsertContact('4dce-3eedce3-rd33', 'visualId', { + firstName: 'Luca', + gender: 'male', + 'age:years': '20', +}); +``` + +## Fetch the list of locations + +This function is used to fetch the list of locations. + +```js +listLocations(state => { + console.log(state); + return state; +}); +``` + +## Get a specific location + +This function can be used to get one specific location. A filtering mechanism +can specify a criteria to match. Mutliple locations could be returned if matched +by the filter. + +```js +getLocation({ where: { name: '30 DE MAYO' } }, state => { + console.log(state.data); + return state; +}); +``` + +## Insert or Update a location using a unique id as a key + +This function is used to either update a location if matched or insert a new. A +custom `externalId` can be provided. + +```js +upsertLocation('name', { + name: '30 DE DECIEMBRE', + synonyms: [], + identifiers: [], + active: true, + populationDensity: 0, + geoLocation: { + lat: -45.343244, + lng: -67.193873, + }, +}); +``` + +## Fetch the list of reference data + +This function is used to fetch the list of reference data. + +```js +listReferenceData(state => { + console.log(state); + return state; +}); +``` + +## Get a specific reference data + +This function can be used to get one specific reference data. A filtering +mechanism can specify a criteria to match. + +```js +getReferenceData( + { where: { categoryId: 'LNG_REFERENCE_DATA_CATEGORY_CENTRE_NAME' } }, + state => { + console.log(state.data); + return state; + } +); +``` + +## Insert or Update a reference data using a unique id as a key + +This function is used to either update a location if matched or insert a new. A +custom `externalId` can be provided. + +```js +upsertReferenceData('id', { + categoryId: 'CATEGORY', + value: 'VALUE', + readOnly: false, + active: true, + id: 'ID', + createdAt: '2020-10-01T18:48:31.784Z', + createdBy: '95d31ea9', + updatedAt: '2020-10-01T18:48:31.784Z', + updatedBy: '95d31ea9', + createdOn: 'API', + deleted: false, +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/godata/index.md b/docs/godata/index.md new file mode 100644 index 000000000..29bd9ff20 --- /dev/null +++ b/docs/godata/index.md @@ -0,0 +1,393 @@ +## Functions + +
+
+ getCase(id, query, callback)
+
+ getContact(id, query, callback)
+
+ getLocation(query, callback)
+
+ getOutbreak(query, callback)
+
+ getReferenceData(query, callback)
+
+ listCases(id, callback)
+
+ listContacts(id, callback)
+
+ listLocations(callback)
+
+ listOutbreaks(callback)
+
+ listReferenceData(callback)
+
+ upsertCase(id, externalId, goDataCase, callback)
+
+ upsertContact(id, externalId, goDataContact, callback)
+
+ upsertLocation(externalId, goDataLocation, callback)
+
+ upsertOutbreak(outbreak, callback)
+
+ upsertReferenceData(externalId, goDataReferenceData, callback)
+
+ + +## getCase + +getCase(id, query, callback) ⇒ Operation +Get one or multiple cases within an outbreak from a query filter + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| id | string | Outbreak id | +| query | object | An object with a query filter parameter | +| callback | function | (Optional) Callback function | + +**Example** +```js +getCase( + '3b55-cdf4', + { 'where.relationship': { active: true }, where: { firstName: 'Luca'} }, + state => { + console.log(state); + return state; + } +); +``` + +* * * + +## getContact + +getContact(id, query, callback) ⇒ Operation +Get one or multiple contacts within an outbreak from a query filter + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| id | string | Outbreak id | +| query | object | An object with a query filter parameter | +| callback | function | (Optional) Callback function | + +**Example** +```js +getContact("343d-dc3e", {"where":{"firstName": "Luca"}}, state => { + console.log(state.data); + return state; + }); +``` + +* * * + +## getLocation + +getLocation(query, callback) ⇒ Operation +Get one or multiple locations from a query filter + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| query | object | An object with a query filter parameter | +| callback | function | (Optional) Callback function | + +**Example** +```js +getLocation({"where":{"name": "30 DE OCTUBRE"}}, state => { + console.log(state.data); + return state; + }); +``` + +* * * + +## getOutbreak + +getOutbreak(query, callback) ⇒ Operation +Get one or multiple outbreaks from a query filter + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| query | object | An object with a query filter parameter | +| callback | function | (Optional) Callback function | + +**Example** +```js +getOutbreak({"where":{"name": "Outbreak demo"}}, state => { + console.log(state.data); + return state; + }); +``` + +* * * + +## getReferenceData + +getReferenceData(query, callback) ⇒ Operation +Get one or multiple reference data from a query filter + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| query | object | An object with a query filter parameter | +| callback | function | (Optional) Callback function | + +**Example** +```js +getReferenceData({"where":{"categoryId": "LNG_REFERENCE_DATA_CATEGORY_CENTRE_NAME"}}, state => { + console.log(state.data); + return state; + }); +``` + +* * * + +## listCases + +listCases(id, callback) ⇒ Operation +Fetch the list of cases within a particular outbreak using its ID. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| id | string | Outbreak id | +| callback | function | (Optional) Callback function | + +**Example** +```js +listCases("343d-dc3e", state => { + console.log(state); + return state; + }); +``` + +* * * + +## listContacts + +listContacts(id, callback) ⇒ Operation +Fetch the list of contacts within a particular outbreak using its ID. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| id | string | Outbreak id | +| callback | function | (Optional) Callback function | + +**Example** +```js +listContacts("343d-dc3e", // Outbreak Id + state => { + console.log(state); + return state; + }); +``` + +* * * + +## listLocations + +listLocations(callback) ⇒ Operation +Fetch the list of locations + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| callback | function | (Optional) Callback function | + +**Example** +```js +listLocations(state => { + console.log(state.data); + return state; + }); +``` + +* * * + +## listOutbreaks + +listOutbreaks(callback) ⇒ Operation +Fetch the list of outbreaks + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| callback | function | (Optional) Callback function | + +**Example** +```js +listOutbreaks(state => { + console.log(state.data); + return state; + }); +``` + +* * * + +## listReferenceData + +listReferenceData(callback) ⇒ Operation +Fetch the list of reference data + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| callback | function | (Optional) Callback function | + +**Example** +```js +listReferenceData(state => { + console.log(state.data); + return state; + }); +``` + +* * * + +## upsertCase + +upsertCase(id, externalId, goDataCase, callback) ⇒ Operation +Upsert case to godata using an external id to mach a specific record + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| id | string | Outbreak id | +| externalId | string | External Id to match | +| goDataCase | object | an object with some case data. | +| callback | function | (Optional) Callback function | + +**Example** +```js +upsertCase("4dce-3eedce3-rd33", 'visualId', + data: state => { + const patient = state.data.body; + return { + firstName: patient.Patient_name.split(' ')[0], + lastName: patient.Patient_name.split(' ')[1], + visualId: patient.Case_ID, + 'age:years': patient.Age_in_year, + gender: patient.Sex, + }; + }) +``` + +* * * + +## upsertContact + +upsertContact(id, externalId, goDataContact, callback) ⇒ Operation +Upsert contact to godata using an external id to match a specific record. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| id | string | Outbreak id | +| externalId | string | External Id to match | +| goDataContact | object | an object with some case data. | +| callback | function | (Optional) Callback function | + +**Example** +```js +upsertContact("4dce-3eedce3-rd33", 'visualId', + { + firstName: 'Luca', + gender: 'male', + 'age:years': '20' + ... + } + ) +``` + +* * * + +## upsertLocation + +upsertLocation(externalId, goDataLocation, callback) ⇒ Operation +Upsert location to godata + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| externalId | string | External Id to match | +| goDataLocation | object | an object with some location data. | +| callback | function | (Optional) Callback function | + +**Example** +```js +upsertLocation('name', {...}) +``` + +* * * + +## upsertOutbreak + +upsertOutbreak(outbreak, callback) ⇒ Operation +Upsert outbreak to godata + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| outbreak | object | an object with an externalId and some outbreak data. | +| callback | function | (Optional) Callback function | + +**Example** +```js +upsertOutbreak({externalId: "3dec33-ede3", data: {...}}) +``` + +* * * + +## upsertReferenceData + +upsertReferenceData(externalId, goDataReferenceData, callback) ⇒ Operation +Upsert reference data to godata + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| externalId | string | External Id to match | +| goDataReferenceData | object | an object with some reference data. | +| callback | function | (Optional) Callback function | + +**Example** +```js +upsertReferenceData('id', {...}) +``` + +* * * + diff --git a/docs/googlehealthcare/CHANGELOG.md b/docs/googlehealthcare/CHANGELOG.md new file mode 100644 index 000000000..f781801c3 --- /dev/null +++ b/docs/googlehealthcare/CHANGELOG.md @@ -0,0 +1,27 @@ +# @openfn/language-googlehealthcare + +## 1.0.0 + +### Major Changes + +- 7df7e20: remove `projectId`, `dataSetId`, `cloudRegion`, and `fhirStoreId` out + of configuration + + The new implementation of `createFhirResource(fhirStore, resource, callback)` + allows you to use one set of credentials to access different Google Healthcare + Cloud FHIR stores. `fhirStore` is an object that contains the FHIR store + information + (`{cloudRegion: string, projectId: string, datasetId: string, fhirStoreId: string}`). + +## 0.1.0 + +### Minor Changes + +- 861d774: add createFhirResource function + +### Patch Changes + +- aad9549: Ensure that standard OAuth2 credentials with snake-cased + "access_token" keys can be used for OAuth2-reliant adaptors +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 diff --git a/docs/googlehealthcare/README.md b/docs/googlehealthcare/README.md new file mode 100644 index 000000000..27a46561f --- /dev/null +++ b/docs/googlehealthcare/README.md @@ -0,0 +1,27 @@ +# language-googlehealthcare + +An OpenFn **_adaptor_** for building integration jobs for use with the +[Google Cloud Healthcare API](https://cloud.google.com/healthcare-api/docs/how-tos/fhir-resources#healthcare-create-patient-nodejs). + +## Documentation + +View the +[docs site](https://docs.openfn.org/adaptors/packages/googlehealthcare-docs) for +full technical documentation. + +### Configuration + +View the +[configuration-schema](https://docs.openfn.org/adaptors/packages/googlehealthcare-configuration-schema/) +for required and optional `configuration` properties. + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +"Getting Started" guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To build _only_ the docs run `pnpm build docs`. diff --git a/docs/googlehealthcare/index.md b/docs/googlehealthcare/index.md new file mode 100644 index 000000000..eb69e7c1b --- /dev/null +++ b/docs/googlehealthcare/index.md @@ -0,0 +1,62 @@ +## createFhirResource + +createFhirResource([fhirStore], resource, callback) ⇒ Operation +Create some resource in Google Cloud Healthcare + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| [fhirStore] | Object | The FHIR store information. - `cloudRegion` (string): The cloud region where the FHIR store is located. - `projectId` (string): The ID of the project that contains the FHIR store. - `datasetId` (string): The ID of the dataset that contains the FHIR store. - `fhirStoreId` (string): The ID of the FHIR store. | +| resource | object | The FHIR resource data to be created | +| callback | function | An optional callback function | + +**Example** +```js +createFhirResource( + { + cloudRegion: "us-central1", + projectId: "adjective-noun-123", + datasetId: "my-dataset", + fhirStoreId: "my-fhir-store", + }, + { + resourceType: "Patient", + name: [{ use: "official", family: "Smith", given: ["Darcy"] }], + gender: "female", + birthDate: "1970-01-01", + } +); +``` +**Example** +```js +createFhirResource( + { + cloudRegion: "us-central1", + projectId: "adjective-noun-123", + datasetId: "my-dataset", + fhirStoreId: "my-fhir-store", + }, + (state) => ({ + resourceType: "Encounter", + status: "finished", + class: { + system: "http://hl7.org/fhir/v3/ActCode", + code: "IMP", + display: "inpatient encounter", + }, + reasonCode: [ + { + text: "The patient had an abnormal heart rate. She was concerned about this.", + }, + ], + subject: { + reference: `Patient/${state.data.id}`, + }, + }) +); +``` + +* * * + diff --git a/docs/googlesheets/CHANGELOG.md b/docs/googlesheets/CHANGELOG.md new file mode 100644 index 000000000..c6ab58c70 --- /dev/null +++ b/docs/googlesheets/CHANGELOG.md @@ -0,0 +1,91 @@ +# @openfn/language-googlesheets + +## 2.2.2 + +### Patch Changes + +- aad9549: Ensure that standard OAuth2 credentials with snake-cased + "access_token" keys can be used for OAuth2-reliant adaptors +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 2.2.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 2.2.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 2.1.6 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 2.1.5 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 2.1.4 + +### Patch Changes + +- f2aed32: add examples + +## 2.1.3 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 2.1.2 + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 2.1.1 + +### Patch Changes + +- 9a2755e: Update dependency on language-common +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 + +## 2.1.0 + +### Minor Changes + +- 9e7d458: Migrate googlesheets diff --git a/docs/googlesheets/README.md b/docs/googlesheets/README.md new file mode 100644 index 000000000..67ed1db1c --- /dev/null +++ b/docs/googlesheets/README.md @@ -0,0 +1,40 @@ +# Language Google Sheets + +Language Pack for building expressions and operations to make Google Sheets API +calls. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/googlesheets-configuration-schema/) +definition. + +### appendValues() + +Add rows to an existing sheet: +`https://sheets.googleapis.com/v4/spreadsheets/spreadsheetId/values/Sheet1!A1:E1:append?valueInputOption=USER_ENTERED` + +```js +appendValues({ + spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos', + range: 'Sheet1!A1:E1', + values: [ + ['From expression', '$15', '2', '3/15/2016'], + ['Really now!', '$100', '1', '3/20/2016'], + ], +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/googlesheets/index.md b/docs/googlesheets/index.md new file mode 100644 index 000000000..3197ec687 --- /dev/null +++ b/docs/googlesheets/index.md @@ -0,0 +1,27 @@ +## appendValues + +appendValues(params) ⇒ Operation +Add an array of rows to the spreadsheet. +https://developers.google.com/sheets/api/samples/writing#append_values + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | Object | Data object to add to the spreadsheet. | + +**Example** +```js +appendValues({ + spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos', + range: 'Sheet1!A1:E1', + values: [ + ['From expression', '$15', '2', '3/15/2016'], + ['Really now!', '$100', '1', '3/20/2016'], + ], +}) +``` + +* * * + diff --git a/docs/hive/CHANGELOG.md b/docs/hive/CHANGELOG.md new file mode 100644 index 000000000..06f825d24 --- /dev/null +++ b/docs/hive/CHANGELOG.md @@ -0,0 +1,7 @@ +# @openfn/language-hive + +## 0.2.0 + +### Minor Changes + +- a380347: Add query function diff --git a/docs/hive/README.md b/docs/hive/README.md new file mode 100644 index 000000000..d587e5dff --- /dev/null +++ b/docs/hive/README.md @@ -0,0 +1,31 @@ +# language-hive + +An OpenFn **_adaptor_** for building integration jobs for use with the HIVE API. + +## Documentation + +View the [docs site](https://docs.openfn.org/adaptors/packages/hive-docs) for +full technical documentation. + +### Configuration + +View the +[configuration-schema](https://docs.openfn.org/adaptors/packages/hive-configuration-schema/) +for required and optional `configuration` properties. + +### A example expression using the `query` function + +```js +query('select count(*) from patient'); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +"Getting Started" guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To build _only_ the docs run `pnpm build docs`. diff --git a/docs/hive/index.md b/docs/hive/index.md new file mode 100644 index 000000000..c33cf302a --- /dev/null +++ b/docs/hive/index.md @@ -0,0 +1,21 @@ +## query + +query(qs, options, callback) ⇒ Operation +Execute an SQL statement + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| qs | string | SQL statement | +| options | object | (Optional) options for executing sql statement | +| callback | function | An optional callback function | + +**Example** *(Get patient count from hive database)* +```js +query("select count(*) from patient"); +``` + +* * * + diff --git a/docs/http/CHANGELOG.md b/docs/http/CHANGELOG.md new file mode 100644 index 000000000..e0c528675 --- /dev/null +++ b/docs/http/CHANGELOG.md @@ -0,0 +1,202 @@ +# @openfn/language-http + +## 6.0.0 + +### Major Changes + +- f741086: The axios library has been removed and the operation API simplified. + + ### New features + + - Error mapping. Provide custom errors to response status codes, eg, Eg: + `{errors: {404: "You don't have access"}}` + - parseAs option. Overrides the default response type. Eg: `{parseAs: "json"}` + - Request logging. All requests are now logged to stdout. + - tls options. Pass SSL certificates using the `tls` option on any request. + + ### Breaking changes + + - Removed `axios` export + - Axios options on `get`, `post`, `put`, `patch`, and `del` are no longer + supported (unless otherwise stated). This includes `gzip`,`qs`, `formData`, + `successCodes` and `keepCookie` + - Option params `json` and `agentOptions` have been deprecated. They still + work, but you should use `body` and `tls` instead (the behaviour should be + the same) + +### Patch Changes + +- Updated dependencies [7f52699] + - @openfn/language-common@1.12.0 + +## 5.1.1 + +### Patch Changes + +- a8d655e: Update `parseXML` to use `expandReferences` + +## 5.1.0 + +### Minor Changes + +- 8e2b79c: Clean up `state.response.request` by returning only + `{ method, path, host, protocol, _headers }` + +## 5.0.4 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 5.0.3 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 5.0.2 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 5.0.1 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 5.0.0 + +### Major Changes + +- 0b6f20b: use parseCsv from common + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 4.3.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 4.3.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 4.3.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 4.3.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 4.2.8 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 4.2.7 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 4.2.6 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 4.2.5 + +### Patch Changes + +- f2aed32: add examples + +## 4.2.4 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 4.2.3 + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 4.2.2 + +### Patch Changes + +- 9a2755e: Update dependency on language-common +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 + +## 4.2.1 + +### Patch Changes + +- e04aa28: Rename credential-schema to configuration-schema, update descriptions + +## 4.2.0 + +### Minor Changes + +- f670bf8: Added credential schema to enable new ui + +## 4.1.0 + +### Minor Changes + +- 8e1b86d: update http to new format + +## 4.0.1 + +### Patch Changes + +- 4671e89: Migrate language-http diff --git a/docs/http/README.md b/docs/http/README.md new file mode 100644 index 000000000..2e840324c --- /dev/null +++ b/docs/http/README.md @@ -0,0 +1,138 @@ +# Language HTTP + +Language Pack for building expressions and operations to make HTTP calls. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/http-configuration-schema/) +definition. + +### Get data + +This helper function allows the use of a get method to fetch data. You can +specify a query string for filter. + +```js +get( + '/myendpoint', + { + query: { foo: 'bar', a: 1 }, + headers: { 'content-type': 'application/json' }, + authentication: { username: 'taylor', password: 'somethingsecret' }, + }, + state => { + return state; + } +); +``` + +### Post existing data + +Send some data to an existing endpoint. + +```js +post('/endpoint', { + body: state => { + return { + field_1: 'some_data', + field_2: 'some_more_data', + field_id: dataValue('Some.Json.Object.Id')(state), + }; + }, + headers: { + Authorization: 'AUTH_KEY', + 'Content-Type': 'application/json', + }, +}); +``` + +### Update existing data with PUT or PATCH + +```js +put( + '/myendpoint', + { + body: { firstname: 'taylor', lastname: 'downs' }, + headers: { 'content-type': 'application/json' }, + authentication: { username: 'user', password: 'pass' }, + }, + state => { + return state; + } +); +``` + +```js +patch( + '/myendpoint', + { + body: { firstname: 'taylor', lastname: 'downs' }, + headers: { 'content-type': 'application/json' }, + authentication: { username: 'user', password: 'pass' }, + }, + state => { + return state; + } +); +``` + +### Delete data + +```js +del( + '/myendpoint', + { + query: { id: 'someId' }, + headers: { 'content-type': 'application/json' }, + authentication: { username: 'user', password: 'pass' }, + }, + state => { + return state; + } +); +``` + +### Parse XML + +This function allows you to parse some xml data. A callback function can be use +to store in a table. + +```js +parseXML(body, function ($) { + return $('table[class=your_table]').parsetable(true, true, true); +}); +``` + +### Parse CSV + +```js +parseCSV('someData.csv', { + quoteChar: '"', + header: false, +}); +``` + +### Sample parse local CSV file + +```js +parseCSV('PatientsJan2009.csv', { + quoteChar: '"', + header: false, + columns: true, + skip_empty_lines: true, + trim: true, + bom: true, +}); +``` + +## Development + +Clone the repo, run `pnpm install`. + +Run tests using `pnpm run test` or `pnpm run test:watch`. + +To build the docs for this repo, run `pnpm build:docs`. diff --git a/docs/http/index.md b/docs/http/index.md new file mode 100644 index 000000000..1446a686e --- /dev/null +++ b/docs/http/index.md @@ -0,0 +1,207 @@ +## Functions + +
+
+ del(path, params, callback)
+
+ get(path, params, callback)
+
+ parseXML(body, script)
+
+ patch(path, params, callback)
+
+ post(path, params, callback)
+
+ put(path, params, callback)
+
+ request(method, path, params, callback)
+
+ + +## del + +del(path, params, callback) ⇒ Operation +Make a DELETE request + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | string | Path to resource | +| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Auth parameters | +| callback | function | (Optional) Callback function | + +**Example** +```js +del(`/myendpoint/${state => state.data.id}`, { + headers: {'content-type': 'application/json'} + }) +``` + +* * * + +## get + +get(path, params, callback) ⇒ Operation +Make a GET request + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | string | Path to resource | +| params | [RequestOptions](#RequestOptions) | Query, Headers and Authentication parameters | +| callback | function | (Optional) Callback function | + +**Example** +```js +get('/myEndpoint', { + query: {foo: 'bar', a: 1}, + headers: {'content-type': 'application/json'}, +}) +``` + +* * * + +## parseXML + +parseXML(body, script) ⇒ Operation +Parse XML with the Cheerio parser + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| body | String | data string to be parsed | +| script | function | script for extracting data | + +**Example** +```js +parseXML(body, function($){ + return $("table[class=your_table]").parsetable(true, true, true); + }) +``` + +* * * + +## patch + +patch(path, params, callback) ⇒ Operation +Make a PATCH request + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | string | Path to resource | +| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Auth parameters | +| callback | function | (Optional) Callback function | + +**Example** +```js +patch('/myEndpoint', { + body: {'foo': 'bar'}, + headers: {'content-type': 'application/json'}, + }) +``` + +* * * + +## post + +post(path, params, callback) ⇒ operation +Make a POST request + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | string | Path to resource | +| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Authentication parameters | +| callback | function | (Optional) Callback function | + +**Example** +```js +post('/myEndpoint', { + body: {'foo': 'bar'}, + headers: {'content-type': 'application/json'}, + }) +``` + +* * * + +## put + +put(path, params, callback) ⇒ Operation +Make a PUT request + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | string | Path to resource | +| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Auth parameters | +| callback | function | (Optional) Callback function | + +**Example** +```js +put('/myEndpoint', { + body: {'foo': 'bar'}, + headers: {'content-type': 'application/json'}, + }) +``` + +* * * + +## request + +request(method, path, params, callback) ⇒ Operation +Make a HTTP request + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| method | string | The HTTP method to use | +| path | string | Path to resource | +| params | [RequestOptions](#RequestOptions) | Query, Headers and Authentication parameters | +| callback | function | (Optional) Callback function | + +**Example** +```js +get('/myEndpoint', { + query: {foo: 'bar', a: 1}, + headers: {'content-type': 'application/json'}, +}) +``` + +* * * + +## RequestOptions + +RequestOptions : Object +Options provided to the HTTP request + +**Kind**: global typedef +**Properties** + +| Name | Type | Description | +| --- | --- | --- | +| body | object \| string | body data to append to the request | +| errors | object | Map of errorCodes -> error messages, ie, `{ 404: 'Resource not found;' }`. Use a falsy message value to suppress errors for thiscode. | +| query | object | an object of query parameters. Will be encoded into the URL. | +| headers | object | an object of headers to append to the request | +| parseAs | string | parse the response body as json, text or stream. By default will use the response headers. | +| timeout | number | Request timeout in ms. Default: 300 seconds. | +| tls | object | TLS/SSL authentication options. See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions | + + +* * * + diff --git a/docs/khanacademy/CHANGELOG.md b/docs/khanacademy/CHANGELOG.md new file mode 100644 index 000000000..7848aeb79 --- /dev/null +++ b/docs/khanacademy/CHANGELOG.md @@ -0,0 +1,60 @@ +# @openfn/language-khanacademy + +## 0.4.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.4.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.3.4 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.3.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.3.2 + +### Patch Changes + +- f2aed32: add examples + +## 0.3.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.3.0 + +### Minor Changes + +- 9137655: migrate khanacademy diff --git a/docs/khanacademy/README.md b/docs/khanacademy/README.md new file mode 100644 index 000000000..0f2587a86 --- /dev/null +++ b/docs/khanacademy/README.md @@ -0,0 +1,37 @@ +# Language KhanAcademy + +Language Pack for building expressions and operations to make HTTP calls. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/khanacademy-configuration-schema/) +definition. + +## fetch + +#### sample usage + +```js +fetch({ + getEndpoint: 'user', + queryParams: { + email: 'thisoneuser@something.org', + }, + postUrl: 'https://www.openfn.org/inbox/your-uuid', +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/khanacademy/index.md b/docs/khanacademy/index.md new file mode 100644 index 000000000..d456db21d --- /dev/null +++ b/docs/khanacademy/index.md @@ -0,0 +1,20 @@ +## fetch + +fetch(params) ⇒ Operation +Fetch data from the Khan Academy API + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data to make the query | + +**Example** +```js +execute( + fetch(params) +)(state) +``` + +* * * + diff --git a/docs/kobotoolbox/CHANGELOG.md b/docs/kobotoolbox/CHANGELOG.md new file mode 100644 index 000000000..776e7c515 --- /dev/null +++ b/docs/kobotoolbox/CHANGELOG.md @@ -0,0 +1,95 @@ +# @openfn/language-kobotoolbox + +## 2.1.0 + +### Minor Changes + +- c85abf3: Removed the API version enum values in the credential configuration + json schema and added a placeholder + +## 2.0.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 2.0.0 + +### Major Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 1.3.3 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 1.3.2 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 1.3.1 + +### Patch Changes + +- f2aed32: add examples + +## 1.3.0 + +### Minor Changes + +- e48c30c: add getDeploymentInfo function + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 1.2.0 + +### Minor Changes + +- 7b5ca3e: add fn and fix adaptors export + +### Patch Changes + +- 4067c28: build ast file +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 1.1.0 + +### Minor Changes + +- 7fc47d8: Migrate kobotoolbox + +### Patch Changes + +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 diff --git a/docs/kobotoolbox/README.md b/docs/kobotoolbox/README.md new file mode 100644 index 000000000..9211248b5 --- /dev/null +++ b/docs/kobotoolbox/README.md @@ -0,0 +1,47 @@ +# Language KoboToolbox + +Language Pack for building expressions and operations to interact with the +[TEMPLATE] API. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/kobotoolbox-configuration-schema/) +definition. + +#### Get the list of forms + +```js +getForms({}, state => { + console.log(state.data); + return state; +}); +``` + +### Get submissions for a specific form + +A query can be used to filter results. + +```js +getSubmissions( + { formId: 'aXecHjmbATuF6iGFmvBLBX', query: { end: { $gte: '2020-11-20' } } }, + state => { + console.log(state.data); + return state; + } +); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/kobotoolbox/index.md b/docs/kobotoolbox/index.md new file mode 100644 index 000000000..74c80d391 --- /dev/null +++ b/docs/kobotoolbox/index.md @@ -0,0 +1,79 @@ +## Functions + +
+
+ getDeploymentInfo(params, callback)
+
+ getForms(params, callback)
+
+ getSubmissions(params, callback)
+
+ + +## getDeploymentInfo + +getDeploymentInfo(params, callback) ⇒ Operation +Get deployment information for a specific form + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | Form Id and data to make the fetch or filter | +| callback | function | (Optional) Callback function to execute after fetching form deployment information | + +**Example** +```js +getDeploymentInfo({formId: 'aXecHjmbATuF6iGFmvBLBX'}, state => { + console.log(state.data); + return state; +}); +``` + +* * * + +## getForms + +getForms(params, callback) ⇒ Operation +Make a request to get the list of forms + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | Query, Headers and Authentication parameters | +| callback | function | (Optional) Callback function to execute after fetching form list | + +**Example** +```js +getForms({}, state => { + console.log(state.data); + return state; +}); +``` + +* * * + +## getSubmissions + +getSubmissions(params, callback) ⇒ Operation +Get submissions for a specific form + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | Form Id and data to make the fetch or filter | +| callback | function | (Optional) Callback function to execute after fetching form submissions | + +**Example** +```js +getSubmissions({formId: 'aXecHjmbATuF6iGFmvBLBX'}, state => { + console.log(state.data); + return state; +}); +``` + +* * * + diff --git a/docs/magpi/CHANGELOG.md b/docs/magpi/CHANGELOG.md new file mode 100644 index 000000000..0f7ac3ff5 --- /dev/null +++ b/docs/magpi/CHANGELOG.md @@ -0,0 +1,70 @@ +# @openfn/language-magpi + +## 1.1.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 1.1.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 1.0.5 + +### Patch Changes + +- 86fb813: dependencies update + +## 1.0.4 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 1.0.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 1.0.2 + +### Patch Changes + +- f2aed32: add examples + +## 1.0.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 1.0.0 + +### Major Changes + +- e6c2b4a: Update xml2js parser + +### Minor Changes + +- df5dd2e: migrate magpi diff --git a/docs/magpi/README.md b/docs/magpi/README.md new file mode 100644 index 000000000..c62fff58d --- /dev/null +++ b/docs/magpi/README.md @@ -0,0 +1,70 @@ +# Language Magpi + +Language Pack for building expressions and operations for working with the +[Magpi inbound API](http://support.magpi.com/support/solutions/articles/4839-magpi-inbound-api) +and the +[Magpi outbound API](http://support.magpi.com/support/solutions/articles/4865-magpi-outbound-api). + +_N.B.: The Magpi API is under development and this pack may change._ + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/magpi-configuration-schema/) +definition. + +## Fetch data from Magpi + +Allows you to fetch data from Magpi and post it elsewhere. + +#### Using `fetchSurveyData`: + +https://www.magpi.com/api/surveydata/v2?username=taylordowns2000&accesstoken=blahblahblah&surveyid=921409679070 + +```js +fetchSurveyData({ + surveyId: '37479', + afterDate: '2016-01-01', + beforeDate: '2100-01-01', + postUrl: 'https://www.openfn.org/inbox/secret-5c25-inbox-ba2c-url', +}); +``` + +## Submit new records + +**wip:** This will allow you to push data to Magpi to create a new record for a +form which exists in a user account. + +#### Using `submitRecord`: + +```js +submitRecord(1, 2); +``` + +#### Magpi Outbound API Parameters: + +- `username`: The account username. +- `accesstoken`: The accesstoken generated on the site. Each accesstoken is + associated with the user who generated. +- `surveyid`: The surveyid is not the survey's name. The surveyid can be + obtained from the list of forms generated in 1 above. +- `startdate`: Start date of the data to be returned. Filtering is done based on + the DateStamp and is inclusive.(Optional). The date format should be the same + one as the one on the data tab/ The date format should be the same one as the + one on the data tab +- `enddate`: End date of the data to be returned. Filtering is done based on the + DateStamp and is inclusive.(Optional) + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/magpi/index.md b/docs/magpi/index.md new file mode 100644 index 000000000..9a9ce548d --- /dev/null +++ b/docs/magpi/index.md @@ -0,0 +1,52 @@ +## Functions + +
+
+ fetchSurveyData(params)
+
+ submitRecord(jsonData)
+
+ + +## fetchSurveyData + +fetchSurveyData(params) ⇒ Operation +Make a POST request to fetch Magpi data and POST it somewhere else + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data to make the fetch | + +**Example** +```js +fetchSurveyData({ + "surveyId": "37479", + "afterDate": "2017-09-27", + "postUrl": "https://www.openfn.org/inbox/your-inbox-url" +}) +``` + +* * * + +## submitRecord + +submitRecord(jsonData) ⇒ Operation +Submit a record for a form/survey which already exists in a Magpi user account + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| jsonData | object | Payload data for the record | + +**Example** +```js +submitRecord(jsonData) +``` + +* * * + diff --git a/docs/mailchimp/CHANGELOG.md b/docs/mailchimp/CHANGELOG.md new file mode 100644 index 000000000..fb1f3315e --- /dev/null +++ b/docs/mailchimp/CHANGELOG.md @@ -0,0 +1,114 @@ +# @openfn/language-mailchimp + +## 0.7.2 + +### Patch Changes + +- 1131c34: Remove regex pattern for validation and changed minLength to 1 + +## 0.7.1 + +### Patch Changes + +- 1f856c4: Update configuration schema +- 48394f5: - fix ast docs warnings + - add status code log on request + +## 0.7.0 + +### Minor Changes + +- 58fcea9: - Add chunk from common + - Improve error logs + - Return `state` in request finalState + +## 0.6.0 + +### Minor Changes + +- 1582873: Add request, get and post functions + +## 0.5.0 + +### Minor Changes + +- 8e39ee1: Add new functions + + - addMember() + - listMembers() + - deleteMember() + - listAudiences() + - archiveMember() + - updateMemberTags() + - listAudienceInfo() + +## 0.4.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.4.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.3.5 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.3.4 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.3.3 + +### Patch Changes + +- f2aed32: add examples + +## 0.3.2 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.3.1 + +### Patch Changes + +- cbb8968: Fix axios Inefficient Regular Expression Complexity vulnerability +- e81561f: Updated ast and package.json + +## 0.3.0 + +### Minor Changes + +- 88fa3b5: migrate mailchimp + +### Patch Changes + +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 diff --git a/docs/mailchimp/README.md b/docs/mailchimp/README.md new file mode 100644 index 000000000..b2d1ae7d9 --- /dev/null +++ b/docs/mailchimp/README.md @@ -0,0 +1,24 @@ +# Language Mailchimp + +An OpenFn **_adaptor_** for building integration jobs for use with the Mailchimp +marketing API. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/mailchimp-configuration-schema/) +definition. + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/mailchimp/index.md b/docs/mailchimp/index.md new file mode 100644 index 000000000..88fbc1648 --- /dev/null +++ b/docs/mailchimp/index.md @@ -0,0 +1,316 @@ +## Functions + +
+
+ addMember(params, [callback])
+
+ archiveMember(params, [callback])
+
+ deleteMember(params, [callback])
+
+ get(path, query, [callback])
+
+ listAudienceInfo(query, [callback])
+
+ listAudiences(query, [callback])
+
+ listBatches(params, [callback])
+
+ listMembers(params, [callback])
+
+ post(path, body, query, [callback])
+
+ request(method, path, options, [callback])
+
+ startBatch(params, [callback])
+
+ tagMembers(params, [callback])
+
+ updateMember(params, [callback])
+
+ updateMemberTags(params, [callback])
+
+ upsertMembers(params, [callback])
+
+ + +## addMember + +addMember(params, [callback]) ⇒ Operation +addMember to a list + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | a listId, and options | +| [callback] | function | Optional callback to handle the response | + + +* * * + +## archiveMember + +archiveMember(params, [callback]) ⇒ Operation +archiveMember in a list + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | a listId, and options | +| [callback] | function | Optional callback to handle the response | + + +* * * + +## deleteMember + +deleteMember(params, [callback]) ⇒ Operation +Permanently delete a member from a list + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | a listId, and options | +| [callback] | function | Optional callback to handle the response | + + +* * * + +## get + +get(path, query, [callback]) ⇒ Operation +The get function is used to make a GET request to the Mailchimp API. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| path | string | The endpoint of the api to which the request should be made | +| query | object | An object containing query parameters to be included in the request | +| [callback] | function | (Optional) callback to handle the response | + +**Example** *(Get a list of account exports for a given account)* +```js +get('/account-exports'); +``` + +* * * + +## listAudienceInfo + +listAudienceInfo(query, [callback]) ⇒ Operation +Get information about a specific list in your Mailchimp account. +Results include list members who have signed up but haven't confirmed their subscription yet and unsubscribed or cleaned. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| query | object | listId and query parameters | +| [callback] | function | Optional callback to handle the response | + + +* * * + +## listAudiences + +listAudiences(query, [callback]) ⇒ Operation +Get information about all lists in the account. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| query | object | Query parameters | +| [callback] | function | Optional callback to handle the response | + + +* * * + +## listBatches + +listBatches(params, [callback]) ⇒ Operation +listBatches + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | a listId, and options | +| [callback] | function | Optional callback to handle the response | + + +* * * + +## listMembers + +listMembers(params, [callback]) ⇒ Operation +listMembers + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | a listId, and options | +| [callback] | function | Optional callback to handle the response | + + +* * * + +## post + +post(path, body, query, [callback]) ⇒ Operation +The post function is used to make a POST request to the Mailchimp API. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| path | string | The endpoint of the api to which the request should be made. | +| body | object | The data to be sent in the body of the request | +| query | object | An object containing query parameters to be included in the request | +| [callback] | function | (Optional) callback to handle the response | + +**Example** *(Create a new account export in your Mailchimp account)* +```js +post('/accounts-export', {include_stages:[]}); +``` + +* * * + +## request + +request(method, path, options, [callback]) ⇒ Operation +Make an HTTP request to Mailchimp API + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| method | string | The HTTP method for the request (e.g., 'GET', 'POST', 'PUT', 'DELETE'). | +| path | string | The endpoint of the api to which the request should be made. | +| options | Object | Additional options for the request (query, body only). | +| [callback] | function | (Optional) callback function to handle the response. | + +**Example** *(Get list to all other resources available in the API)* +```js +request('GET','/'); +``` +**Example** *(Create a new account export in your Mailchimp account)* +```js +request('POST','/accounts-export', {include_stages:[]}); +``` + +* * * + +## startBatch + +startBatch(params, [callback]) ⇒ Operation +Start a batch with a list of operations. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | operations batch job | +| [callback] | function | Optional callback to handle the response | + +**Example** +```js +startBatch(params) +``` + +* * * + +## tagMembers + +tagMembers(params, [callback]) ⇒ Operation +Tag members with a particular tag + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | a tagId, members, and a list | +| [callback] | function | Optional callback to handle the response | + +**Example** +```js +tagMembers((state) => ({ + listId: "someId", // All Subscribers list + tagId: "someTag", // User tag + members: state.response.body.rows.map((u) => u.email), +})); +``` +**Example** +```js +tagMembers((state) => ({ + listId: "someId", + tagId: "someTag", + members: state.response.body.rows + .filter((u) => u.allow_other_emails) + .map((u) => u.email), +})); +``` + +* * * + +## updateMember + +updateMember(params, [callback]) ⇒ Operation +updateMember + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | a listId,subscriberHash and member | +| [callback] | function | Optional callback to handle the response | + + +* * * + +## updateMemberTags + +updateMemberTags(params, [callback]) ⇒ Operation +updateMemberTags + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | a listId, and options | +| [callback] | function | Optional callback to handle the response | + + +* * * + +## upsertMembers + +upsertMembers(params, [callback]) ⇒ Operation +Add or update a list members + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | a listId, users, and options | +| [callback] | function | Optional callback to handle the response | + +**Example** +```js +upsertMembers((state) => ({ + listId: "someId", + users: state.response.body.rows.map((u) => ({ + email: u.email, + status: u.allow_other_emails ? "subscribed" : "unsubscribed", + mergeFields: { FNAME: u.first_name, LNAME: u.last_name }, + })), +})); +``` + +* * * + diff --git a/docs/mailgun/CHANGELOG.md b/docs/mailgun/CHANGELOG.md new file mode 100644 index 000000000..1ed4ff334 --- /dev/null +++ b/docs/mailgun/CHANGELOG.md @@ -0,0 +1,72 @@ +# @openfn/language-mailgun + +## 0.4.3 + +### Patch Changes + +- f86576d: Security update to mailgun.js + +## 0.4.2 + +### Patch Changes + +- 4620079: Bump opinionator version + +## 0.4.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.4.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.3.4 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.3.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.3.2 + +### Patch Changes + +- f2aed32: add examples + +## 0.3.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.3.0 + +### Minor Changes + +- 9ded25e: Migrate Mailgun diff --git a/docs/mailgun/README.md b/docs/mailgun/README.md new file mode 100644 index 000000000..18a05b402 --- /dev/null +++ b/docs/mailgun/README.md @@ -0,0 +1,39 @@ +# Language Mailgun + +Language Pack for building expressions and operations for working with the +mailgun API. + +[mailgun-js on npm](https://www.npmjs.com/package/mailgun-js) + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/mailgun-configuration-schema/) +definition. + +## send + +```js +send( + fields( + field('from', 'from_email'), + field('to', 'to_email'), + field('subject', 'Your Subject'), + field('text', 'Your message goes here') + ) +); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/mailgun/index.md b/docs/mailgun/index.md new file mode 100644 index 000000000..6af50f398 --- /dev/null +++ b/docs/mailgun/index.md @@ -0,0 +1,28 @@ +## send + +send(params) +Create an event + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | Params for sending an email | + +**Example** +```js +send({ + from: 'from_email', + to: 'to_email', + subject: 'Your Subject', + text: 'Your message goes here', + attachment: { + url: 'www.google.com/doodle.png', + filename: 'forYou.png', + }, +}) +``` + +* * * + diff --git a/docs/maximo/CHANGELOG.md b/docs/maximo/CHANGELOG.md new file mode 100644 index 000000000..02c3d3fb3 --- /dev/null +++ b/docs/maximo/CHANGELOG.md @@ -0,0 +1,66 @@ +# @openfn/language-maximo + +## 0.4.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.4.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.3.5 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.3.4 + +### Patch Changes + +- aed7e0b: fix required field in configuration schema + +## 0.3.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.3.2 + +### Patch Changes + +- f2aed32: add examples + +## 0.3.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.3.0 + +### Minor Changes + +- 4d4be56: migrate maximo diff --git a/docs/maximo/README.md b/docs/maximo/README.md new file mode 100644 index 000000000..1c64fdfc9 --- /dev/null +++ b/docs/maximo/README.md @@ -0,0 +1,81 @@ +# Language Maximo + +Language Pack for building expressions and operations to access IBM Maximo EAM. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/maximo-configuration-schema/) +definition. + +### Fetch + +#### sample 'fetch' expression + +```js +fetch({ + endpoint: 'maxrest/rest/os/mxinventory', + query: { + ITEMNUM: '01226', + _format: 'json', + }, + postUrl: 'https://www.openfn.org/inbox/not-real', +}); +``` + +### sample 'create' expression + +```js +create({ + endpoint: 'maxrest/rest/os/mxinvbal/', + body: function (state) { + return { + ITEMNUM: dataValue('form.ITEMNUM')(state), + ITEMSETID: dataValue('form.ITEMSETID')(state), + SITEID: dataValue('form.SITEID')(state), + LOCATION: dataValue('form.LOCATION')(state), + ISSUEUNIT: 'FOO', + PHYSCNT: dataValue('PHYSCNT')(state), + BINNUM: dataValue('form.BINNUM')(state), + }; + }, +}); +``` + +### sample 'update75' expression + +```js +update75({ + endpoint: state => { + return ( + 'maxrest/rest/os/mxinvbal/' + + dataValue('form.question1.INVBALANCESID')(state) + ); + }, + body: state => { + return { + _action: 'AddChange', //this is required for the old Maximo API! + ITEMNUM: dataValue('form.ITEMNUM')(state), + ITEMSETID: dataValue('form.ITEMSETID')(state), + SITEID: dataValue('form.SITEID')(state), + LOCATION: dataValue('form.LOCATION')(state), + PHYSCNT: dataValue('form.PHYSCNT')(state), + BINNUM: dataValue('form.BINNUM')(state), + }; + }, +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/maximo/index.md b/docs/maximo/index.md new file mode 100644 index 000000000..8137151e7 --- /dev/null +++ b/docs/maximo/index.md @@ -0,0 +1,77 @@ +## Functions + +
+
+ fetch(params)
+
+ update(params)
+
+ update75(params)
+
+ + +## fetch + +fetch(params) ⇒ Operation +Make a GET request and POST it somewhere else + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data to make the fetch | + +**Example** +```js +fetch({ + endpoint: 'maxrest/rest/os/mxinventory', + query: { + ITEMNUM: '01226', + _format: 'json', + }, + postUrl: 'https://www.openfn.org/inbox/not-real', +}); +``` + +* * * + +## update + +update(params) ⇒ Operation +Make an update in Maximo 7.6 and beyond + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data to make the update | + +**Example** +```js +execute( + update(params) +)(state) +``` + +* * * + +## update75 + +update75(params) ⇒ Operation +Make an upadte in Maximo 7.5 + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data to make the update | + +**Example** +```js +execute( + update75(params) +)(state) +``` + +* * * + diff --git a/docs/medicmobile/CHANGELOG.md b/docs/medicmobile/CHANGELOG.md new file mode 100644 index 000000000..e1f48370b --- /dev/null +++ b/docs/medicmobile/CHANGELOG.md @@ -0,0 +1,65 @@ +# @openfn/language-medicmobile + +## 0.4.2 + +### Patch Changes + +- 421fad3: Bump query-string + +## 0.4.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.4.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.3.3 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.3.2 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.3.1 + +### Patch Changes + +- f2aed32: add examples + +## 0.3.0 + +### Minor Changes + +- 2cd3236: migrate medicmobile + +### Patch Changes + +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 diff --git a/docs/medicmobile/README.md b/docs/medicmobile/README.md new file mode 100644 index 000000000..09e59693d --- /dev/null +++ b/docs/medicmobile/README.md @@ -0,0 +1,61 @@ +# Language Medic Mobile + +Language Pack for building expressions and operations to make calls to the Medic +Mobile API. +**For an overview of Medic's database, check out +[Medic's DB Schema v2](https://github.com/medic/medic-docs/blob/master/development/db-schema.md)** +The exported functions in this language package can be executed by +[OpenFn/core](https://github.com/OpenFn/core): + +```sh +../core/lib/cli.js execute -l ./lib/Adaptor -s ./tmp/state.json -e ./tmp/expression.js +``` + +For quick-start help, clone +[OpenFn/openfn-devtools](https://github.com/OpenFn/openfn-devtools) and follow +the README.md + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/medicmobile-configuration-schema/) +definition. + +#### sample fetchSubmissions expression + +```js +fetchSubmissions( + 'pregnancy', // formId + { 'last-event-id': 334 }, // params, last-event-id will be replaced by cursor + 'http://localhost:4000/inbox/abc-123-xyz' // postUrl +); +``` + +#### sample changesApi and pickFormData usage + +```js +// get all the changes... +changesApi({ + include_docs: true, + // This only gets used the first time the job is run. + // Subsequent runs take the lastSeq value as their cursor. + // "last-event-id": 789, +}); + +// Picks out the field data for a given formId. +pickFormData('pregnancy'); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/medicmobile/index.md b/docs/medicmobile/index.md new file mode 100644 index 000000000..e3834ec4e --- /dev/null +++ b/docs/medicmobile/index.md @@ -0,0 +1,76 @@ +## Functions + +
+
+ changesApi(params, callback)
+
+ fetchSubmissions(formId, params, postUrl)
+
+ pickFormData(formId)
+
+ + +## changesApi + +changesApi(params, callback) ⇒ Operation +Access the CouchDB Changes API + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | Query parameters | +| callback | function | (Optional) Callback function | + +**Example** +```js +changesApi(params, callback) +``` + +* * * + +## fetchSubmissions + +fetchSubmissions(formId, params, postUrl) ⇒ Operation +Access form submissions and post them as JSON. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| formId | string | Query parameters | +| params | object | Starting sequence id | +| postUrl | string | Inbox to post form data | + +**Example** +```js +fetchSubmissions( + "pregnancy", // formId + { "last-event-id": 334 }, // params + "http://localhost:4000/inbox/abc-123-xyz" // postUrl +); +``` + +* * * + +## pickFormData + +pickFormData(formId) ⇒ Operation +Select submissions for a specific form + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| formId | string | The form ID. | + +**Example** +```js +pickFormData(formId) +``` + +* * * + diff --git a/docs/mogli/CHANGELOG.md b/docs/mogli/CHANGELOG.md new file mode 100644 index 000000000..bdb916564 --- /dev/null +++ b/docs/mogli/CHANGELOG.md @@ -0,0 +1,70 @@ +v0.1.6 + +## 0.4.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.4.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.3.4 + +### Patch Changes + +- 7cc8efc: remove FakeAdaptor references + +## 0.3.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.3.2 + +### Patch Changes + +- f2aed32: add examples + +## 0.3.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.3.0 + +### Minor Changes + +- # c6056e8: migrate mogli + +* State gets cleaned up after the operations are finished. This means that the + final state is serializable. + + The JSForce connection object is provided by `createConnection`, and in turn + `execute` ensures it is run before the user's operations. + + The `cleanupState` reducer simply deletes the connection key from state. + +# v0.1.3 + +- Bumped language-common dependency to v0.0.4. diff --git a/docs/mogli/README.md b/docs/mogli/README.md new file mode 100644 index 000000000..50b4dd87f --- /dev/null +++ b/docs/mogli/README.md @@ -0,0 +1,47 @@ +# Language Mogli + +Language Pack for building expressions and operations to interact with Mogli +SMS. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/mogli-configuration-schema/) +definition. + +### Create inbound SMS + +```js +createSMS( + fields( + field('sender', dataValue('from_number')), + field('receivedAt', dataValue('timestamp')), + field('message', dataValue('message')) + ) +); +``` + + + + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/mogli/connecting_with_sms_providers.md b/docs/mogli/connecting_with_sms_providers.md new file mode 100644 index 000000000..1413ad5e2 --- /dev/null +++ b/docs/mogli/connecting_with_sms_providers.md @@ -0,0 +1,24 @@ +# Connecting with SMS providers +This document outlines the basic requests that should be made of telcom providers when we approach them to integrate with their systems. We we _can_ connect in other ways, JSON-based REST API (for sending) and a webhooks API (for receiving) is the web standard and it is what we look for. + +At a high level, no matter how they allow connections, what we need is their `SMS API documentation`. + +## Sending SMS from Mogli to local recipients +In order to send SMS messages, we will make an HTTP post to a URL that you specify with basic authentication and a content type of application/json. It will contain the recipient address and text as key:value pairs. Using CURL for testing purposes, the post will look like this: + +```sh +curl -X POST \ + https://www.orange-or-airtel-or-vodafone.com/api/send \ + -H 'authorization: Basic dGF5bG9yOnNlY3JldA==' \ + -H 'cache-control: no-cache' \ + -H 'content-type: application/json' \ + -d '{"recipient":959011728, " text": "Bonjour le monde!"}' +``` + +For additional clarity here, see a great example of Orange's API documentation in Niger: https://developer.orange.com/apis/sms-ne/api-reference + +## Receiving SMS from local recipients + +We will expect that Orange will make a similar HTTP post to our url (https://www.openfn.org/inbox/something-secret) with the content of the message and the sender whenever an SMS is received. + +Note that these posts are delivered over HTTPS and use modern standard authentication ("Basic Auth") but that there is no VPN connection required. diff --git a/docs/mogli/connecting_with_telcos.md b/docs/mogli/connecting_with_telcos.md new file mode 100644 index 000000000..1413ad5e2 --- /dev/null +++ b/docs/mogli/connecting_with_telcos.md @@ -0,0 +1,24 @@ +# Connecting with SMS providers +This document outlines the basic requests that should be made of telcom providers when we approach them to integrate with their systems. We we _can_ connect in other ways, JSON-based REST API (for sending) and a webhooks API (for receiving) is the web standard and it is what we look for. + +At a high level, no matter how they allow connections, what we need is their `SMS API documentation`. + +## Sending SMS from Mogli to local recipients +In order to send SMS messages, we will make an HTTP post to a URL that you specify with basic authentication and a content type of application/json. It will contain the recipient address and text as key:value pairs. Using CURL for testing purposes, the post will look like this: + +```sh +curl -X POST \ + https://www.orange-or-airtel-or-vodafone.com/api/send \ + -H 'authorization: Basic dGF5bG9yOnNlY3JldA==' \ + -H 'cache-control: no-cache' \ + -H 'content-type: application/json' \ + -d '{"recipient":959011728, " text": "Bonjour le monde!"}' +``` + +For additional clarity here, see a great example of Orange's API documentation in Niger: https://developer.orange.com/apis/sms-ne/api-reference + +## Receiving SMS from local recipients + +We will expect that Orange will make a similar HTTP post to our url (https://www.openfn.org/inbox/something-secret) with the content of the message and the sender whenever an SMS is received. + +Note that these posts are delivered over HTTPS and use modern standard authentication ("Basic Auth") but that there is no VPN connection required. diff --git a/docs/mogli/index.md b/docs/mogli/index.md new file mode 100644 index 000000000..7c6fea17c --- /dev/null +++ b/docs/mogli/index.md @@ -0,0 +1,70 @@ +## Functions + +
+
+ cleanupState(state)
+
+ lookup(relationshipName, externalID, path)
+
+ relationship(relationshipName, externalID, dataSource)
+
+ + +## cleanupState + +cleanupState(state) ⇒ State +Removes unserializable keys from the state. + +**Kind**: global function + +| Param | Type | +| --- | --- | +| state | State | + + +* * * + +## lookup + +lookup(relationshipName, externalID, path) ⇒ object +Adds a lookup or 'dome insert' to a record. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| relationshipName | string | `__r` relationship field on the record. | +| externalID | string | Salesforce ExternalID field. | +| path | string | JSONPath to data source. | + +**Example** *(Example)* +```js +lookup("relationship_name__r", "externalID on related object", "$.path") +``` + +* * * + +## relationship + +relationship(relationshipName, externalID, dataSource) ⇒ object +Adds a lookup or 'dome insert' to a record. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| relationshipName | string | `__r` relationship field on the record. | +| externalID | string | Salesforce ExternalID field. | +| dataSource | string | resolvable source. | + +**Example** *(Data Sourced Value)* +```js +relationship("relationship_name__r", "externalID on related object", dataSource("path")) +``` +**Example** *(Fixed Value)* +```js +relationship("relationship_name__r", "externalID on related object", "hello world") +``` + +* * * + diff --git a/docs/mongodb/CHANGELOG.md b/docs/mongodb/CHANGELOG.md new file mode 100644 index 000000000..1b4561755 --- /dev/null +++ b/docs/mongodb/CHANGELOG.md @@ -0,0 +1,49 @@ +# @openfn/language-mongodb + +## 2.0.0 + +### Major Changes + +- Update configuration schema for MongoDB adaptor: + - Rename `clusterUrl` to `clusterHostname` + - Change `clusterHostname` format from `uri` to `hostname` + - Update `Adaptor.js` and tests to use new name + +## 1.1.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 1.1.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 1.0.6 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 1.0.5 + +### Patch Changes + +- f2aed32: add examples diff --git a/docs/mongodb/README.md b/docs/mongodb/README.md new file mode 100644 index 000000000..c1bfaefe9 --- /dev/null +++ b/docs/mongodb/README.md @@ -0,0 +1,51 @@ +# Language MongoDB + +Language Pack for building expressions and operations for use with MongoDB. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/mongodb-configuration-schema/) +definition. + +### insertDocuments + +```js +insertDocuments({ + database: 'yourDb', + collection: 'yourCollection', + documents: state => { + return state.data.map(item => { + return { name: item.name, age: item.age }; + }); + }, + // callback: (state) => state, // optional +}); +``` + +### findDocuments + +```js +findDocuments({ + database: 'yourDb', + collection: 'yourCollection', + query: state => { + return { name: 'stu' }; + }, + // callback: (state) => state, // optional +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/mongodb/index.md b/docs/mongodb/index.md new file mode 100644 index 000000000..a3b42ee76 --- /dev/null +++ b/docs/mongodb/index.md @@ -0,0 +1,144 @@ +## Functions + +
+
+ connect(state)
+
+ disconnect(state)
+
+ execute(operations)
+
+ findDocuments(params)
+
+ insertDocuments(params)
+
+ updateDocument(params)
+
+ + +## connect + +connect(state) ⇒ State +Connects to a mongoDb instance + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| state | State | Runtime state. | + +**Example** +```js +connect(state) +``` + +* * * + +## disconnect + +disconnect(state) ⇒ State +Removes connection from the state. + +**Kind**: global function + +| Param | Type | +| --- | --- | +| state | State | + +**Example** +```js +disconnect(state) +``` + +* * * + +## execute + +execute(operations) ⇒ Operation +Execute a sequence of operations. +Wraps `@openfn/language-common/execute`, and prepends initial state for http. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| operations | Operations | Operations to be performed. | + +**Example** +```js +execute( + insertDocuments(params), + findDocuments(params) +)(state) +``` + +* * * + +## findDocuments + +findDocuments(params) ⇒ State +Find documents in a mongoDb collection + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | Configuration for mongo | + +**Example** +```js +findDocuments({ + database: 'str', + collection: 'cases', + query: {a:3} + }); +``` + +* * * + +## insertDocuments + +insertDocuments(params) ⇒ State +Inserts documents into a mongoDb collection + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | Configuration for mongo | + +**Example** +```js +insertDocuments({ + database: 'str', + collection: 'kids', + documents: [1,2,3] + }); +``` + +* * * + +## updateDocument + +updateDocument(params) ⇒ State +Updates document (optionally upserting) into a mongoDb collection + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | Configuration for mongo | + +**Example** +```js +updateDocuments({ + database: 'str', + collection: 'animals', + filter: { type: 'fuzzy' }, + changes: { kind: 'soft' }, + options: { upsert: true } + }); +``` + +* * * + diff --git a/docs/msgraph/CHANGELOG.md b/docs/msgraph/CHANGELOG.md new file mode 100644 index 000000000..dcbd622eb --- /dev/null +++ b/docs/msgraph/CHANGELOG.md @@ -0,0 +1,86 @@ +# @openfn/language-msgraph + +## 0.4.0 + +### Minor Changes + +- 4cd6587: Add `uploadFile` and `sheetToBuffer` function + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 0.3.5 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 0.3.4 + +### Patch Changes + +- 1c183e9: Fix getFile unit tests + +## 0.3.3 + +### Patch Changes + +- b90e8a2: Add support for stream +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 0.3.2 + +### Patch Changes + +- 9cc4952: fix url in request util + +## 0.3.1 + +### Patch Changes + +- f45f477: Clean-up state before throwing an error + +## 0.3.0 + +### Minor Changes + +- 9366e53: - Switch from `nodejs` default `fetch` to `undici` `fetch` + - Added the following `sharepoint` functions + - `getDrive()` + - `getFolder()` + - `getFile()` + +## 0.2.0 + +### Minor Changes + +- d33c0ee: export parseCsv from common + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 0.1.1 + +### Patch Changes + +- aad9549: Ensure that standard OAuth2 credentials with snake-cased + "access_token" keys can be used for OAuth2-reliant adaptors +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 0.1.0 + +### Minor Changes + +- 93d82a8: Add msgraph adaptor with get() and create() functions + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 diff --git a/docs/msgraph/README.md b/docs/msgraph/README.md new file mode 100644 index 000000000..2dbceacd3 --- /dev/null +++ b/docs/msgraph/README.md @@ -0,0 +1,26 @@ +# language-msgraph + +An OpenFn **_adaptor_** for building integration jobs for use with the +[Microsoft Graph API](https://learn.microsoft.com/en-us/graph/use-the-api). + +## Documentation + +View the [docs site](https://docs.openfn.org/adaptors/packages/msgraph-docs) for +full technical documentation. + +### Configuration + +View the +[configuration-schema](https://docs.openfn.org/adaptors/packages/msgraph-configuration-schema/) +for required and optional `configuration` properties. + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +"Getting Started" guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To build _only_ the docs run `pnpm build docs`. diff --git a/docs/msgraph/index.md b/docs/msgraph/index.md new file mode 100644 index 000000000..6b09c288d --- /dev/null +++ b/docs/msgraph/index.md @@ -0,0 +1,231 @@ +## Functions + +
+
+ create(resource, data, callback)
+
+ get(path, query, callback)
+
+ getDrive(specifier, name, [callback])
+
+ getFile(pathOrId, options, [callback])
+
+ getFolder(pathOrId, options, [callback])
+
+ sheetToBuffer(rows, options)
+
+ uploadFile(resource, data, callback)
+
+ + +## create + +create(resource, data, callback) ⇒ Operation +Create some resource in msgraph + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| resource | string | The type of entity that will be created | +| data | object | The data to create the new resource | +| callback | function | An optional callback function | + +**Example** +```js +create("applications", {"displayName": "My App"}) +``` + +* * * + +## get + +get(path, query, callback) ⇒ Operation +Make a GET request to msgraph resource + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | string | Path to resource | +| query | object | Query, Headers and Authentication parameters | +| callback | function | (Optional) Callback function | + +**Example** +```js +get('sites/root/lists') +``` + +* * * + +## getDrive + +getDrive(specifier, name, [callback]) ⇒ Operation +Get a Drive or SharePoint document library. The drive metadata will be written +to state.drives, where it can be used by other adaptor functions. +Pass { id } to get a drive by id or { id, owner } to get default drive for +some parent resource, like a group + +**Kind**: global function +**Access**: public + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| specifier | Object | | A definition of the drive to retrieve - id {string} - The ID of the resource or owner. - owner {string} - The type of drive owner (e.g. sites, groups). | +| name | string | | The local name of the drive used to write to state.drives, ie, state.drives[name] | +| [callback] | function | s => s | (Optional) Callback function | + +**Example** *(Get a drive by ID)* +```js +getDrive({ id: "YXzpkoLwR06bxC8tNdg71m" }) +``` +**Example** *(Get the default drive for a site)* +```js +getDrive({ id: "openfn.sharepoint.com", owner: "sites" }) +``` + +* * * + +## getFile + +getFile(pathOrId, options, [callback]) ⇒ Operation +Get file metadata or file content. + +**Kind**: global function +**Access**: public + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| pathOrId | string | | A path to a file or file id | +| options | object | | (Optional) Query parameters | +| [callback] | function | s => s | (Optional) Callback function | + +**Example** *(Get a file by ID)* +```js +getFile('01LUM6XOGRONYNTZ26DBBJPTN5IFTQPBIW') +``` +**Example** *(Get a file for a named drive by id)* +```js +getFile("01LUM6XOGRONYNTZ26DBBJPTN5IFTQPBIW",{ driveName: "mydrive"}) +``` + +* * * + +## getFolder + +getFolder(pathOrId, options, [callback]) ⇒ Operation +Get the contents or metadata of a folder. + +**Kind**: global function +**Access**: public + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| pathOrId | string | | A path to a folder or folder id | +| options | object | | (Optional) Query parameters | +| [callback] | function | s => s | (Optional) Callback function | + +**Example** *(Get a folder by ID)* +```js +getFolder('01LUM6XOCKDTZKQC7AVZF2VMHE2I3O6OY3') +``` +**Example** *(Get a folder for a named drive by id)* +```js +getFolder("01LUM6XOCKDTZKQC7AVZF2VMHE2I3O6OY3",{ driveName: "mydrive"}) +``` + +* * * + +## request + +request ⇒ +This is an asynchronous function that sends a request to a specified URL with optional parameters +and headers, and returns the response data in JSON format. + +**Kind**: global constant +**Returns**: The `request` function is returning the parsed JSON data from the response of the HTTP +request made to the specified `url` with the given `params` and `method`. If there is an error in +the response, the function will throw an error. + +| Param | Type | Description | +| --- | --- | --- | +| url | string | The URL of the API endpoint that the request is being made to. | +| [options] | object | An object containing any additional parameters to be sent with the request, such as query parameters or request body data. It is an optional parameter and defaults to an empty object if not provided. | + + +* * * + +## sheetToBuffer + +sheetToBuffer(rows, options) ⇒ +The function `sheetToBuffer` takes in rows, options and optional callback, It creates a workbook +and worksheet using the rows, appends the worksheet to the workbook, and returns the workbook as a +buffer. + +**Kind**: global function +**Returns**: a buffer containing the Excel file in `state.buffer`. +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| rows | | The `rows` parameter is an array of objects representing the data to be written to the Excel sheet. Each object in the array represents a row in the sheet, and the keys of the object represent the column headers. The values of the object represent the data in each cell of the row. | +| options | | The `options` parameter is an object that contains additional configuration options | +| [options.wsName] | String | Worksheet name i.e 32 Characters | +| [options.bookType] | String | File format of the exported file, Default is 'xlsx'. See [here](https://docs.sheetjs.com/docs/api/write-options/#supported-output-formats) for the function. It can have the following properties: | + +**Example** *(Create a buffer containing excel file with `xlsx` output format )* +```js +sheetToBuffer('$.data[*]', { + wsName: 'Invalid Grant Codes', + bookType: 'xlsx', +}); +``` + +* * * + +## uploadFile + +uploadFile(resource, data, callback) ⇒ Operation +Upload a file to a drive + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| resource | Object | Resource Object | +| [resource.driveId] | String | Drive Id | +| [resource.driveId] | String | Site Id | +| [resource.folderId] | String | Parent folder id | +| [resource.contentType] | String | Resource content-type | +| [resource.onConflict] | String | Specify conflict behavior if file with the same name exists. Can be "rename | fail | replace" | +| data | Object | A buffer containing the file. | +| callback | function | Optional callback function | + +**Example** *(Upload Excel file to a drive using `driveId` and `parantItemId`)* +```js +uploadFile( + state => ({ + driveId: state.driveId, + folderId: state.folderId, + fileName: `Tracker.xlsx`, + }), + state => state.buffer +); +``` +**Example** *(Upload Excel file to a SharePoint drive using `siteId` and `parantItemId`)* +```js +uploadFile( + state => ({ + siteId: state.siteId, + folderId: state.folderId, + fileName: `Report.xlsx`, + }), + state => state.buffer +); +``` + +* * * + diff --git a/docs/mssql/CHANGELOG.md b/docs/mssql/CHANGELOG.md new file mode 100644 index 000000000..b07f6beb1 --- /dev/null +++ b/docs/mssql/CHANGELOG.md @@ -0,0 +1,164 @@ +# @openfn/language-mssql + +## 4.1.8 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 4.1.7 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 4.1.6 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 4.1.5 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 4.1.4 + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 4.1.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 4.1.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 4.1.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 4.1.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 4.0.8 + +### Patch Changes + +- 57742d1: remove request dependency + +## 4.0.7 + +### Patch Changes + +- 04ed74f: update dependencies + +## 4.0.6 + +### Patch Changes + +- 43c3669: patch versions + +## 4.0.5 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 4.0.4 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 4.0.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 4.0.2 + +### Patch Changes + +- f2aed32: add examples + +## 4.0.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 4.0.0 + +### Major Changes + +- 3878624: Modify composeNextState function, to flattern all rows into an array + of rows with their corresponding column names + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 3.1.1 + +### Patch Changes + +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 + +## 3.1.0 + +### Minor Changes + +- c9b7ed7: Add language-mssql in monorepo + +### Patch Changes + +- e04aa28: Rename credential-schema to configuration-schema, update descriptions diff --git a/docs/mssql/README.md b/docs/mssql/README.md new file mode 100644 index 000000000..842a900b6 --- /dev/null +++ b/docs/mssql/README.md @@ -0,0 +1,241 @@ +# Language MSSQL + +Language Pack for connecting to Azure SQL Server via OpenFn. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/mssql-configuration-schema/) +definition. + +### Sample expression + +## sql query + +```js +sql({ + query: ` + SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_TYPE = 'BASE TABLE' + AND TABLE_CATALOG='my-demo' + `, +}); + +sql({ + query: `SELECT * FROM Household`, + options: { + writeSql: true, // Keep to true to log query (otherwise make it false). + execute: true, // keep to false to not alter DB + }, +}); +``` + +## Find a single value for a table + +This helper function allows to build a specific query where `sql` would not be +best suited. It returns a single value and not a promise. An example of usage +would be in building a mapping object with a value from a lookup table. + +```js +fn(async state => { + const user = { + id: 1, + name: 'Mamadou', + user_id: await findValue({ + uuid: 'id', + relation: 'users', + where: { first_name: 'Mama%' }, + operator: { first_name: 'like' }, // operator is optional. "=" is used by default. + })(state), + }; + + return upsert(...)(state); +}); +``` + +## Insert one single record + +```js +insert( + 'SomeDB.dbo.SupplierTest', + { + SupplierNumber: 1, + Name: dataValue('name'), + Address: 'Nunya Bihz-Nash', + }, + { + // The optional `options` argument allows for global string replacement with + // NULL. This is useful if you want to map an undefined value (e.g., x.name) + // to NULL. It can be a single string or an array of strings. + // It DEFAULTS to "'undefined'", and can be turned off w/ `false`. + setNull: "'undefined'", + logValues: true, + } +); +``` + +## Insert or Update using a unique column as a key + +This function insert or update depending on the existence of a record in the +database. + +```js +upsert( + 'SomeDB.dbo.Supplier', + 'SupplierNumber', + { + SupplierNumber: 1, + Name: dataValue('name'), + Address: 'Now I can tell!', + }, + // Do NOT replace any instances of 'undefined' in the final SQL statement. + { setNull: false, logValues: true } +); +``` + +## Insert or Update if a value exist in the record + +This function will upsert a record only if the logical given is true. In this +case we check if `dataValue('name')` exists. + +```js +upsertIf( + dataValue('name'), + 'users', + 'user_id', + { + name: 'Elodie', + id: 7, + }, + // Replace any occurence of '' and 'undefined' to NULL + { + setNull: ["''", "'undefined'"], + writeSql: true, + execute: false, + logValues: true, + } +); +``` + +## Insert Many records + +This function allows the insert of a set of records inside a table all at once. +Pass `logQuery` option to `true` to display the query. + +```js +// Note that insertMany takes a function which returns an array—this helps +// enforce that each item in the array has the same keys. +insertMany( + 'SomeDB.dbo.Supplier', + state => + state.data.supplierArray.map(s => { + return { + SupplierNumber: s.id, + Name: s.name, + Address: s.address, + }; + }), + { writeSql: true, logValues: true } +); +``` + +## Insert or Update Many records + +This function inserts or updates many records all at once depending on their +existence in the database. + +```js +// Note that insertMany takes a function which returns an array—this helps +// enforce that each item in the array has the same keys. +upsertMany( + 'SomeDB.dbo.Supplier', + 'SupplierNumber', + state => + state.data.supplierArray.map(s => { + return { + SupplierNumber: s.id, + Name: s.name, + Address: s.address, + }; + }), + { writeSql: true, execute: false, logValues: true } +); +``` + +In case we need to check on multiple columns before upserting, we can have an +array of `uuids`. + +```js +upsertMany( + 'SomeDB.dbo.Supplier', + ['SupplierNumber', 'SupplierCode'], + state => + state.data.supplierArray.map(s => { + return { + SupplierNumber: s.id, + Name: s.name, + Address: s.address, + SupplierCode: s.code, + }; + }), + { writeSql: true, execute: false, logValues: true } +); +``` + +## Describe a table from mssql + +This function is used to fetch the list of columns of a given table in the +database. + +```js +describeTable('users', { writeSql: false, execute: true }); +``` + +## Create a table in the database + +This function allows to create a table in a database from a given array of +columns. The key `identity` can be use for a column to auto-generate a value. + +```js +insertTable('users', state => + state.data.map(column => ({ + name: column.name, + type: column.type, + required: true, // optional + unique: false, // optional - set to true for unique constraint + })) +); +``` + +## Alter a table in the database + +This function allows to add new columns to a table. Beware of the fact that you +cannot add new columns with names that already exist in the table. + +```js +modifyTable( + 'users', + state => + state.data.map(newColumn => ({ + name: newColumn.name, + type: newColumn.type, + required: true, // optional + unique: false, // optional - set to true for unique constraint + })), + { writeSql: false, execute: true } +); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/mssql/index.md b/docs/mssql/index.md new file mode 100644 index 000000000..cf020c939 --- /dev/null +++ b/docs/mssql/index.md @@ -0,0 +1,341 @@ +## Functions + +
+
+ addRowsToRefs(state, rows)
+
+ cleanupState(state)
+
+ createConnection(state)
+
+ describeTable(tableName, options)
+
+ findValue(filter)
+
+ flattenRows(state, rows)
+
+ insert(table, record, options)
+
+ insertMany(table, records, options)
+
+ insertTable(tableName, columns, options)
+
+ modifyTable(tableName, columns, options)
+
+ sql(params)
+
+ upsert(table, uuid, record, options)
+
+ upsertIf(logical, table, uuid, record, options)
+
+ upsertMany(table, uuid, records, options)
+
+ + +## addRowsToRefs + +addRowsToRefs(state, rows) ⇒ State +Sets the returned rows from a query as the first item in the state.references +array, leaving state.data unchanged between operations. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| state | State | | +| rows | array | the array of rows returned from the sql query | + + +* * * + +## cleanupState + +cleanupState(state) ⇒ State +Removes unserializable keys from the state. + +**Kind**: global function + +| Param | Type | +| --- | --- | +| state | State | + +**Example** +```js +cleanupState(state) +``` + +* * * + +## createConnection + +createConnection(state) ⇒ State +Creates a connection. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| state | State | Runtime state. | + +**Example** +```js +createConnection(state) +``` + +* * * + +## describeTable + +describeTable(tableName, options) ⇒ Operation +List the columns of a table in a database. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| tableName | string | The name of the table to describe | +| options | object | Optional options argument | + +**Example** +```js +describeTable('clinic_visits') +``` + +* * * + +## findValue + +findValue(filter) ⇒ Operation +Fetch a uuid key given a condition + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| filter | object | A filter object with the lookup table, a uuid and the condition | + +**Example** +```js +findValue({ + uuid: 'id', + relation: 'users', + where: { first_name: 'Mama%', last_name: 'Cisse'}, + operator: { first_name: 'like', last_name: '='} + }) +``` + +* * * + +## flattenRows + +flattenRows(state, rows) ⇒ State +Returns a flatten object of the rows (array of arrays) with rowCount. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| state | State | | +| rows | array | the array of rows returned from the sql query | + + +* * * + +## insert + +insert(table, record, options) ⇒ Operation +Insert a record + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| table | string | The target table | +| record | object | Payload data for the record as a JS object | +| options | object | Optional options argument | + +**Example** +```js +insert(table, record, {setNull: ["'undefined'", "''"], logValues: false}) +``` + +* * * + +## insertMany + +insertMany(table, records, options) ⇒ Operation +Insert many records, using the keys of the first as the column template + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| table | string | The target table | +| records | function | A function that takes state and returns an array of records | +| options | object | Optional options argument | + +**Example** +```js +insertMany(table, records, { setNull: false, writeSql: true, logValues: false }) +``` + +* * * + +## insertTable + +insertTable(tableName, columns, options) ⇒ Operation +Create a table in database when given an array of columns and a table_name. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| tableName | string | The name of the table to create | +| columns | array | An array of form columns | +| options | object | Optional options argument | + +**Example** +```js +insertTable('table_name', state => state.data.map( + column => ({ + name: column.name, + type: column.type, + required: true, // optional + unique: false, // optional - to be set to true for unique constraint + }) +)); +``` + +* * * + +## modifyTable + +modifyTable(tableName, columns, options) ⇒ Operation +Alter an existing table in the database. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| tableName | string | The name of the table to alter | +| columns | array | An array of form columns | +| options | object | Optional options argument | + +**Example** +```js +modifyTable('table_name', state => state.data.map( + newColumn => ({ + name: newColumn.name, + type: newColumn.type, + required: true, // optional + unique: false, // optional - to be set to true for unique constraint + }) +)); +``` + +* * * + +## sql + +sql(params) ⇒ Operation +Execute an SQL statement + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | Payload data for the message | + +**Example** +```js +sql({ query, options }) +``` + +* * * + +## upsert + +upsert(table, uuid, record, options) ⇒ Operation +Insert or update a record using SQL MERGE + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| table | string | The target table | +| uuid | string | The uuid column to determine a matching/existing record | +| record | object | Payload data for the record as a JS object | +| options | object | Optional options argument | + +**Example** +```js +upsert(table, uuid, record, { setNull: "'undefined'", logValues: false}) +upsert(table, [uuid1, uuid2], record, { setNull: "'undefined'", logValues: false}) +``` + +* * * + +## upsertIf + +upsertIf(logical, table, uuid, record, options) ⇒ Operation +Insert or update a record based on a logical condition using ON CONFLICT UPDATE + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| logical | string | a data to check existing value for. | +| table | string | The target table | +| uuid | string | The uuid column to determine a matching/existing record | +| record | object | Payload data for the record as a JS object or function | +| options | object | Optional options argument | + +**Example** +```js +upsertIf( + dataValue('name'), + 'users', // the DB table + 'uuid', // a DB column with a unique constraint + { name: 'Elodie', id: 7 }, + { writeSql:true, execute: true, logValues: false } +) +``` + +* * * + +## upsertMany + +upsertMany(table, uuid, records, options) ⇒ Operation +Insert or update multiple records using ON CONFLICT UPDATE and excluded + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| table | string | The target table | +| uuid | string | The uuid column to determine a matching/existing record | +| records | function | A function that takes state and returns an array of records | +| options | object | Optional options argument | + +**Example** +```js +upsertMany( + 'users', 'email', records, { logValues: false } +) +upsertMany( + 'users', ['email', 'phone'], records, { logValues: false } +) +``` + +* * * + diff --git a/docs/mysql/CHANGELOG.md b/docs/mysql/CHANGELOG.md new file mode 100644 index 000000000..e9c12ba73 --- /dev/null +++ b/docs/mysql/CHANGELOG.md @@ -0,0 +1,117 @@ +# @openfn/language-mysql + +## 1.4.8 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 1.4.7 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 1.4.6 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 1.4.5 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 1.4.4 + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 1.4.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 1.4.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 1.4.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 1.4.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 1.3.5 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 1.3.4 + +### Patch Changes + +- ef828e7: update old urls in readme +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 1.3.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 1.3.2 + +### Patch Changes + +- f2aed32: add examples + +## 1.3.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 1.3.0 + +### Minor Changes + +- 9d674c5: Migrate MySQL diff --git a/docs/mysql/README.md b/docs/mysql/README.md new file mode 100644 index 000000000..d8ca91463 --- /dev/null +++ b/docs/mysql/README.md @@ -0,0 +1,111 @@ +# Language MySQL + +Language Pack for building expressions and operations to run MySQL queries. + +## Documentation + +View the [docs site](https://docs.openfn.org/adaptors/packages/mysql-docs) for +full technical documentation. + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/mysql-configuration-schema/) +definition. + +## Execute a query + +Execute an sql query with the node mysql package. + +```js +query({ + sql: state => { + return `select * from ${state.data.table} where id = ?;`; + }, + timeout: 4000, + values: ['007'], +}); +``` + +## Execute a sql query + +This function takes either a `string` or a `function` that takes states and +returns a string. + +```js +sqlString(state => { + return ( + `INSERT INTO untitled_table (name, the_geom) VALUES ('` + + state.data.version + + `', ` + + dataValue('form.Choix_tache')(state) + + `)` + ); +}); +``` + +## Insert a single record + +This function is used to insert a single record in a MySQL database. + +```js +insert( + 'some_table', + fields( + field('firstname', dataValue('form.patient_firstname')), + field('lastname', dataValue('form.patient_lastname')) + ) +); +``` + +## Insert or update a single record + +This function is used to insert a single record in a MySQL database or update it +if there is a match. + +```js +upsert( + 'some_table', + fields( + field('firstname', dataValue('form.patient_firstname')), + field('lastname', dataValue('form.patient_lastname')) + ) +); +``` + +## Upsert many records + +This function allows the upsert of a set of records inside a table all at once. + +```js +upsertMany( + 'users', // the DB table + [ + { name: 'one', email: 'one@openfn.org' }, + { name: 'two', email: 'two@openfn.org' }, + ] +); +``` + +or + +```js +upsertMany('users', state => + state.data.users.map(user => { + name: user['name'], + email: user['email'] + }) +); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/mysql/index.md b/docs/mysql/index.md new file mode 100644 index 000000000..74b359510 --- /dev/null +++ b/docs/mysql/index.md @@ -0,0 +1,128 @@ +## Functions + +
+
+ insert(table, fields)
+
+ query(options)
+
+ sqlString(queryString)
+
+ upsert(table, fields)
+
+ upsertMany(table, data)
+
+ + +## insert + +insert(table, fields) ⇒ Operation +Insert a record + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| table | string | The target table | +| fields | object | A fields object | + +**Example** +```js +execute( + insert('table', fields( + field('name', dataValue('name')) + )) +)(state) +``` + +* * * + +## query + +query(options) ⇒ Operation +Execute a SQL statement + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| options | object | Payload data for the message | + +**Example** +```js +execute( + query({ sql: 'select * from users;' }) +)(state) +``` + +* * * + +## sqlString + +sqlString(queryString) ⇒ Operation +Execute a SQL statement + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| queryString | String | A query string (or function which takes state and returns a string) | + +**Example** +```js +execute( + sqlString(state => "select * from items;") +)(state) +``` + +* * * + +## upsert + +upsert(table, fields) ⇒ Operation +Insert or Update a record if matched + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| table | string | The target table | +| fields | object | A fields object | + +**Example** +```js +execute( + upsert('table', fields( + field('name', dataValue('name')) + )) +)(state) +``` + +* * * + +## upsertMany + +upsertMany(table, data) ⇒ Operation +Insert or update multiple records using ON DUPLICATE KEY + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| table | string | The target table | +| data | array | An array of objects or a function that returns an array | + +**Example** +```js +upsertMany( + 'users', // the DB table + [ + { name: 'one', email: 'one@openfn.org' }, + { name: 'two', email: 'two@openfn.org' }, + ] +) +``` + +* * * + diff --git a/docs/nexmo/CHANGELOG.md b/docs/nexmo/CHANGELOG.md new file mode 100644 index 000000000..bd1729d8f --- /dev/null +++ b/docs/nexmo/CHANGELOG.md @@ -0,0 +1,82 @@ +# @openfn/language-nexmo + +## 0.4.3 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 0.4.2 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 0.4.1 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 0.4.0 + +### Minor Changes + +- 8591b67: - update nexmo to `v2.9.1`` + - expandReferences on sendSMS + +## 0.3.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.3.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.2.3 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.2.2 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.2.1 + +### Patch Changes + +- f2aed32: add examples + +## 0.2.0 + +### Minor Changes + +- f0f2495: migrate nexmo diff --git a/docs/nexmo/README.md b/docs/nexmo/README.md new file mode 100644 index 000000000..aef7ef21e --- /dev/null +++ b/docs/nexmo/README.md @@ -0,0 +1,32 @@ +# Language Nexmo + +Language Pack for building expressions and operations to interact with the Nexmo +API. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/nexmo-configuration-schema/) +definition. + +### sendSMS + +#### sample expression + +```js +sendSMS('OpenFn', '0123456789', 'HelloWorld!'); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/nexmo/index.md b/docs/nexmo/index.md new file mode 100644 index 000000000..3ed71f689 --- /dev/null +++ b/docs/nexmo/index.md @@ -0,0 +1,21 @@ +## sendSMS + +sendSMS(from, toNumber, message) ⇒ Operation +Sends an SMS message to a specific phone number + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| from | String | Name or number the message should be sent from. | +| toNumber | String | Destination phone number. | +| message | String | Text message | + +**Example** +```js +sendSMS("OpenFn", "phoneNumber", "Hello World!") +``` + +* * * + diff --git a/docs/ocl/CHANGELOG.md b/docs/ocl/CHANGELOG.md new file mode 100644 index 000000000..636209074 --- /dev/null +++ b/docs/ocl/CHANGELOG.md @@ -0,0 +1,155 @@ +# @openfn/language-ocl + +## 1.1.7 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 1.1.6 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 1.1.5 + +### Patch Changes + +- 67a09fb: Add `fn` in OCL adaptor + +## 1.1.4 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 1.1.3 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 1.1.2 + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 1.1.1 + +### Patch Changes + +- 3f3c0c5: update tests +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 1.1.0 + +### Minor Changes + +- 29e335d: remove body in get request + +## 1.0.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 1.0.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 1.0.0 + +### Major Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.3.0 + +### Minor Changes + +- 63232eb: Add `get()` and `getMappings()` function + +## 0.2.6 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 0.2.5 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.2.4 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.2.3 + +### Patch Changes + +- f2aed32: add examples + +## 0.2.2 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.2.1 + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 0.2.0 + +### Minor Changes + +- 5a06d7f: Migrate OCL, update package export + +### Patch Changes + +- cb5d0ed: Updated to @openfn/simple-ast v0.4.1 +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 diff --git a/docs/ocl/README.md b/docs/ocl/README.md new file mode 100644 index 000000000..7ee4b009b --- /dev/null +++ b/docs/ocl/README.md @@ -0,0 +1,34 @@ +# Language OCL + +Language Pack for building expressions and operations for working with the +[OCL API](http://ocl.github.io/ocl-docs/master/en/developer/html/ocl_developer_manual.html). + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/ocl-configuration-schema/) +definition. + +## Mapping source concepts to destination API + +#### Recieve form data from source application and convert data element keys to destination application. + +```js +map( "data": { + "a": 1, + "b": 2}, + {users:"haftamuk", sources: "eCHIS-CODES", concepts: "fp_new_at_10_to_14" } + ); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/ocl/index.md b/docs/ocl/index.md new file mode 100644 index 000000000..b5a5277f5 --- /dev/null +++ b/docs/ocl/index.md @@ -0,0 +1,76 @@ +## Functions + +
+
+ get(path, query, callback)
+
+ getMappings(ownerId, repositoryId, [options], callback)
+
+ + +## get + +get(path, query, callback) ⇒ Operation +Get a resource in OCL + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| path | string | Path to resource | +| query | object | A query object that will limit what resources are retrieved when converted into request params. | +| callback | function | (Optional) callback function | + +**Example** +```js +get( + "orgs/MSFOCG/collections/lime-demo/HEAD/mappings", + { + page: 1, + exact_match: "off", + limit: 200, + verbose: false, + sortDesc: "_score", + }, + (state) => { + // Add state oclMappings + const oclMappings = state.data; + return { ...state, data: {}, references: [], response: {}, oclMappings }; + } +); +``` + +* * * + +## getMappings + +getMappings(ownerId, repositoryId, [options], callback) ⇒ Operation +Get a source repository in OCL + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| ownerId | string | An OCL user or organization | +| repositoryId | string | An OCL collection id or source id | +| [options] | Object | Optional. `options` which can be passed to See more [on OCL swagger docs](https://api.openconceptlab.org/swagger/) | +| callback | function | (Optional) callback function | + +**Example** +```js +getMappings( + "MSFOCG", + "lime-demo", + { page: 1, exact_match: "off", verbose: false }, + (state) => { + // Add state oclMappings + const oclMappings = state.data; + return { ...state, data: {}, references: [], response: {}, oclMappings }; + } +); +``` + +* * * + diff --git a/docs/openfn/CHANGELOG.md b/docs/openfn/CHANGELOG.md new file mode 100644 index 000000000..fb52bda25 --- /dev/null +++ b/docs/openfn/CHANGELOG.md @@ -0,0 +1,122 @@ +# @openfn/language-openfn + +## 1.3.8 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 1.3.7 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 1.3.6 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 1.3.5 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 1.3.4 + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 1.3.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 1.3.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 1.3.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 1.3.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 1.2.6 + +### Patch Changes + +- 779596f: Use native fetch (undici) in template and add icons in openfn + +## 1.2.5 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 1.2.4 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 1.2.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 1.2.2 + +### Patch Changes + +- f2aed32: add examples + +## 1.2.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 1.2.0 + +### Minor Changes + +- be9d3c6: Migrate OpenFn diff --git a/docs/openfn/README.md b/docs/openfn/README.md new file mode 100644 index 000000000..e31d530ad --- /dev/null +++ b/docs/openfn/README.md @@ -0,0 +1,50 @@ +# Language OpenFn + +Adaptor for building expressions and operations to interact with the OpenFn v1 +API. + +## Documentation + +## request + +```js +request({ + method: 'get', + path: 'jobs', + params: { + project_id: 490, + }, +}); +request( + { + method: 'post', + path: 'jobs', + data: { + trigger_id: 1, + expression: 'steps()', + }, + }, + state => { + console.log('cool callback!'); + return state; + } +); +``` + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/openfn-configuration-schema/) +definition. + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/openfn/index.md b/docs/openfn/index.md new file mode 100644 index 000000000..04a3fd3cd --- /dev/null +++ b/docs/openfn/index.md @@ -0,0 +1,20 @@ +## request + +request(options, callback) ⇒ Operation +Make a POST request + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| options | object | Body, Query, Headers and Authentication parameters | +| callback | function | (Optional) Callback function | + +**Example** +```js +request({method: 'get', path: '/jobs/}); +``` + +* * * + diff --git a/docs/openhim/CHANGELOG.md b/docs/openhim/CHANGELOG.md new file mode 100644 index 000000000..53ecec6b2 --- /dev/null +++ b/docs/openhim/CHANGELOG.md @@ -0,0 +1,65 @@ +# @openfn/language-openhim + +## 0.2.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.2.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.1.4 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.1.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.1.2 + +### Patch Changes + +- f2aed32: add examples + +## 0.1.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.1.0 + +### Minor Changes + +- 1fd9b3b: Migrate OpenHIM + +### Patch Changes + +- e4ebcb6: Fix Large gzip Denial of Service in superagent +- e81561f: Updated ast and package.json diff --git a/docs/openhim/README.md b/docs/openhim/README.md new file mode 100644 index 000000000..d395cd45f --- /dev/null +++ b/docs/openhim/README.md @@ -0,0 +1,157 @@ +# Language OpenHIM + +Language Pack for building expressions and operations for working with the +openhim API. + +## [HL7 FHIR Standard](https://www.hl7.org/fhir/patient-example.json.html) + +```json +{ + "resourceType": "Patient", + "id": "example", + "text": { + "status": "generated", + "div": "
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
NamePeter James \n Chalmers ("Jim")\n
Address534 Erewhon, Pleasantville, Vic, 3999
ContactsHome: unknown. Work: (03) 5555 6473
IdMRN: 12345 (Acme Healthcare)
\n \n
" + }, + "identifier": [ + { + "fhir_comments": [" MRN assigned by ACME healthcare on 6-May 2001 "], + "use": "usual", + "type": { + "coding": [ + { + "system": "http://hl7.org/fhir/v2/0203", + "code": "MR" + } + ] + }, + "system": "urn:oid:1.2.36.146.595.217.0.1", + "value": "12345", + "period": { + "start": "2001-05-06" + }, + "assigner": { + "display": "Acme Healthcare" + } + } + ], + "active": true, + "name": [ + { + "fhir_comments": [" Peter James Chalmers, but called \"Jim\" "], + "use": "official", + "family": ["Chalmers"], + "given": ["Peter", "James"] + }, + { + "use": "usual", + "given": ["Jim"] + } + ], + "telecom": [ + { + "fhir_comments": [" home communication details aren't known "], + "use": "home" + }, + { + "system": "phone", + "value": "(03) 5555 6473", + "use": "work" + } + ], + "gender": "male", + "_gender": { + "fhir_comments": [" use FHIR code system for male / female "] + }, + "birthDate": "1974-12-25", + "_birthDate": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime", + "valueDateTime": "1974-12-25T14:35:45-05:00" + } + ] + }, + "deceasedBoolean": false, + "address": [ + { + "use": "home", + "type": "both", + "line": ["534 Erewhon St"], + "city": "PleasantVille", + "district": "Rainbow", + "state": "Vic", + "postalCode": "3999", + "period": { + "start": "1974-12-25" + } + } + ], + "contact": [ + { + "relationship": [ + { + "coding": [ + { + "system": "http://hl7.org/fhir/patient-contact-relationship", + "code": "partner" + } + ] + } + ], + "name": { + "family": ["du", "Marché"], + "_family": [ + { + "extension": [ + { + "fhir_comments": [ + " the \"du\" part is a family name prefix (VV in iso 21090) " + ], + "url": "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier", + "valueCode": "VV" + } + ] + }, + null + ], + "given": ["Bénédicte"] + }, + "telecom": [ + { + "system": "phone", + "value": "+33 (237) 998327" + } + ], + "gender": "female", + "period": { + "start": "2012", + "_start": { + "fhir_comments": [" The contact relationship started in 2012 "] + } + } + } + ], + "managingOrganization": { + "reference": "Organization/1" + } +} +``` + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/openhim-configuration-schema/) +definition. + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/openhim/index.md b/docs/openhim/index.md new file mode 100644 index 000000000..6ea907e16 --- /dev/null +++ b/docs/openhim/index.md @@ -0,0 +1,20 @@ +## encounter + +encounter(encounterData) ⇒ Operation +Create an encounter + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| encounterData | object | Payload data for the encounter | + +**Example** +```js +execute( + encounter(data) +)(state) +``` + +* * * + diff --git a/docs/openmrs/CHANGELOG.md b/docs/openmrs/CHANGELOG.md new file mode 100644 index 000000000..7d6c5c738 --- /dev/null +++ b/docs/openmrs/CHANGELOG.md @@ -0,0 +1,162 @@ +# @openfn/language-openmrs + +## 2.0.8 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 2.0.7 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 2.0.6 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 2.0.5 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 2.0.4 + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 2.0.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 2.0.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 2.0.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 2.0.0 + +### Major Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 1.1.1 + +### Patch Changes + +- 2390129: - replace throw new Error with console.log + - improve Log function + +## 1.1.0 + +### Minor Changes + +- d124f67: - Add create, update and upsert function + - Add callback support and improve examples for + - get() + - post() + - getPatient() + - searchPerson() + - getEncounter() + - searchPatient() + - createPatient() + - getEncounters() + - createEncounter() + +## 1.0.1 + +### Patch Changes + +- 97cc7ce: - Fix checking for empty response + - Style logs output + +## 1.0.0 + +### Major Changes + +- b6478c0: - Removed `request` in favour of `superagent` + - Improve error handling + - Moved `login` to execute function + - Added + - `createPatient` + - `searchPatient` + - `searchPerson` + - `getEncounters` + - `getEncounter` + - `get` + - `post` + +## 0.10.5 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 0.10.4 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.10.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.10.2 + +### Patch Changes + +- f2aed32: add examples + +## 0.10.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.10.0 + +### Minor Changes + +- 6786949: Migrate OpenMRS diff --git a/docs/openmrs/README.md b/docs/openmrs/README.md new file mode 100644 index 000000000..55e92970d --- /dev/null +++ b/docs/openmrs/README.md @@ -0,0 +1,110 @@ +# Language OpenMRS + +Language Pack for building expressions and operations for working with the +[OpenMRS API](https://wiki.openmrs.org/display/docs/API). + +[OpenMRS Data Model Explorer](http://burkeware.com/openmrs-data-model/openmrs-data-model-1.11.html#) + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/openmrs-configuration-schema/) +definition. + +### Get a patient by some criteria + +```js +// getPatient({ uuid: '516af9aa-0402-4e11-ad79-e394fdec0c91' }); +// getPatient({ uuid: dataValue('patientId')(state) }); +getPatient({ + uuid: state => state.data[0].uuid, +}); +``` + +#### Example of searching for patients based on their `EMR Id` + +```js +getPatients( + { + identifier: state => state.data.emrId, + v: 'full', + }, + { + exactlyOne: true, + } +); +``` + +### Create an Encounter + +```js +createEncounter({ + encounterDatetime: dataValue('visit_date'), //dynamically fill with source app data + patient: dataValue('uuid'), + encounterType: dataValue('visit_type'), + location: dataValue('location.uuid'), + encounterProviders: [ + { + provider: dataValue('provider_name'), + encounterRole: '240b26f9-dd88-4172-823d-4a8bfeb7841f', //hardcoded value + }, + ], +}); +``` + +### Make a request to any OpenMRS endpoint + +```js +req({ method: 'GET', url: '/ws/rest/v1/concept' }, state => { + console.log(JSON.stringify(state, null, 2)); + return state; +}); +``` + + + +## Create new patient + +```js +patient( + fields( + field('gender', 'M'), + field('names', function (state) { + return [ + { + patient_id: dataValue('form.patientId')(state), + creator: dataValue('form.user')(state), + }, + ]; + }) + ) +); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/openmrs/index.md b/docs/openmrs/index.md new file mode 100644 index 000000000..d8538cbaf --- /dev/null +++ b/docs/openmrs/index.md @@ -0,0 +1,353 @@ +## Functions + +
+
+ create(resourceType, data, [callback])
+
+ createEncounter(data, [callback])
+
+ createPatient(data, [callback])
+
+ get(path, query, [callback])
+
+ getEncounter(uuid, [callback])
+
+ getEncounters(query, [callback])
+
+ getPatient(uuid, [callback])
+
+ post(path, data, [callback])
+
+ searchPatient(query, [callback])
+
+ searchPerson(query, [callback])
+
+ update(resourceType, path, data, [callback])
+
+ upsert(resourceType, query, data, [callback])
+
+ + +## create + +create(resourceType, data, [callback]) ⇒ Operation +Create a record + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| resourceType | string | Type of resource to create. E.g. `person`, `patient`, `encounter`, ... | +| data | OpenMRSData | Object which defines data that will be used to create a given instance of resource. To create a single instance of a resource, `data` must be a javascript object, and to create multiple instances of a resources, `data` must be an array of javascript objects. | +| [callback] | function | Optional callback to handle the response | + +**Example** *(Create a person)* +```js +create("person", { + names: [ + { + givenName: "Mohit", + familyName: "Kumar", + }, + ], + gender: "M", + birthdate: "1997-09-02", + addresses: [ + { + address1: "30, Vivekananda Layout, Munnekolal,Marathahalli", + cityVillage: "Bengaluru", + country: "India", + postalCode: "560037", + }, + ], +}); +``` + +* * * + +## createEncounter + +createEncounter(data, [callback]) ⇒ Operation +Creates an encounter + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| data | object | Data parameters of the encounter | +| [callback] | function | Optional callback to handle the response | + +**Example** *(Create an encounter)* +```js +createEncounter({ + encounterDatetime: '2023-05-25T06:08:25.000+0000', + patient: '1fdaa696-e759-4a7d-a066-f1ae557c151b', + encounterType: 'dd528487-82a5-4082-9c72-ed246bd49591', + location: 'ba685651-ed3b-4e63-9b35-78893060758a', + encounterProviders: [], + visit: { + patient: '1fdaa696-e759-4a7d-a066-f1ae557c151b', + visitType: '7b0f5697-27e3-40c4-8bae-f4049abfb4ed', + startDatetime: '2023-05-25T06:08:25.000+0000', + stopDatetime: '2023-05-25T06:09:25.000+0000', + }, +}) +``` + +* * * + +## createPatient + +createPatient(data, [callback]) ⇒ Operation +Creates a new patient + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| data | object | Object parameters of the patient | +| [callback] | function | Optional callback to handle the response | + +**Example** +```js +createPatient({ + identifiers: [ + { + identifier: '4023287', + identifierType: '05a29f94-c0ed-11e2-94be-8c13b969e334', + preferred: true, + }, + ], + person: { + gender: 'M', + age: 42, + birthdate: '1970-01-01T00:00:00.000+0100', + birthdateEstimated: false, + names: [ + { + givenName: 'Doe', + familyName: 'John', + }, + ], + }, +}) +``` + +* * * + +## get + +get(path, query, [callback]) ⇒ Operation +Make a get request to any OpenMRS endpoint + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| path | string | Path to resource | +| query | object | parameters for the request | +| [callback] | function | Optional callback to handle the response | + +**Example** +```js +get("patient", { + q: "Patient", + limit: 1, +}); +``` + +* * * + +## getEncounter + +getEncounter(uuid, [callback]) ⇒ Operation +Gets encounter matching a uuid + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| uuid | object | A uuid for the encounter | +| [callback] | function | Optional callback to handle the response | + +**Example** +```js +getEncounter("123") +``` + +* * * + +## getEncounters + +getEncounters(query, [callback]) ⇒ Operation +Gets encounters matching params + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| query | object | Object for the patient | +| [callback] | function | Optional callback to handle the response | + +**Example** +```js +getEncounters({patient: "123", fromdate: "2023-05-18"}) +``` + +* * * + +## getPatient + +getPatient(uuid, [callback]) ⇒ Operation +Gets patient matching a uuid + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| uuid | string | A uuid for the patient | +| [callback] | function | Optional callback to handle the response | + +**Example** +```js +getPatient("123") +``` +**Example** *(Get a patient by uuid)* +```js +getPatient('681f8785-c9ca-4dc8-a091-7b869316ff93') +``` + +* * * + +## post + +post(path, data, [callback]) ⇒ Operation +Make a post request to any OpenMRS endpoint + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| path | string | Path to resource | +| data | object | Object which defines data that will be used to create a given instance of resource | +| [callback] | function | Optional callback to handle the response | + +**Example** +```js +post( + "idgen/identifiersource/8549f706-7e85-4c1d-9424-217d50a2988b/identifier", + {} +); +``` + +* * * + +## searchPatient + +searchPatient(query, [callback]) ⇒ Operation +Fetch all non-retired patients that match any specified parameters + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| query | object | Object with query for the patient | +| [callback] | function | Optional callback to handle the response | + +**Example** +```js +searchPatient({ q: Sarah }) +``` + +* * * + +## searchPerson + +searchPerson(query, [callback]) ⇒ Operation +Fetch all non-retired persons that match any specified parameters + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| query | object | object with query for the person | +| [callback] | function | Optional callback to handle the response | + +**Example** +```js +searchPerson({ q: Sarah }) +``` + +* * * + +## update + +update(resourceType, path, data, [callback]) ⇒ Operation +Update data. A generic helper function to update a resource object of any type. +Updating an object requires to send `all required fields` or the `full body` + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| resourceType | string | The type of resource to be updated. E.g. `person`, `patient`, etc. | +| path | string | The `id` or `path` to the `object` to be updated. E.g. `e739808f-f166-42ae-aaf3-8b3e8fa13fda` or `e739808f-f166-42ae-aaf3-8b3e8fa13fda/{collection-name}/{object-id}` | +| data | Object | Data to update. It requires to send `all required fields` or the `full body`. If you want `partial updates`, use `patch` operation. | +| [callback] | function | Optional callback to handle the response | + +**Example** *(a person)* +```js +update("person", '3cad37ad-984d-4c65-a019-3eb120c9c373',{"gender":"M","birthdate":"1997-01-13"}) +``` + +* * * + +## upsert + +upsert(resourceType, query, data, [callback]) ⇒ Operation +Upsert a record. A generic helper function used to atomically either insert a row, or on the basis of the row already existing, UPDATE that existing row instead. + +**Kind**: global function +**Throws**: + +- RangeError - Throws range error + +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| resourceType | string | The type of a resource to `upsert`. E.g. `trackedEntityInstances` | +| query | Object | A query object that allows to uniquely identify the resource to update. If no matches found, then the resource will be created. | +| data | Object | The data to use for update or create depending on the result of the query. | +| [callback] | function | Optional callback to handle the response | + +**Example** *(For an existing patient using upsert)* +```js +upsert('patient', { q: '10007JJ' }, { person: { age: 50 } }); +``` +**Example** *(For non existing patient creating a patient record using upsert )* +```js +upsert( + "patient", + { q: "1000EHE" }, + { + identifiers: [ + { + identifier: "1000EHE", + identifierType: "05a29f94-c0ed-11e2-94be-8c13b969e334", + location: "44c3efb0-2583-4c80-a79e-1f756a03c0a1", + preferred: true, + }, + ], + person: { + gender: "M", + age: 42, + }, + } +); +``` + +* * * + diff --git a/docs/openspp/CHANGELOG.md b/docs/openspp/CHANGELOG.md new file mode 100644 index 000000000..863ab4ae6 --- /dev/null +++ b/docs/openspp/CHANGELOG.md @@ -0,0 +1,40 @@ +# @openfn/language-openspp + +## 1.2.0 + +### Changes + +- 05defd2: add new functions, correcting docstring and add more examples + - correcting docstring input parameters type + - changing getServicePoint() from get by name into get by unique id + - add more examples in docstring + - getArea(): get existing area by id + - searchArea(): search existing area by domain + - searchServicePoint(): search existing service point by domain + +## 1.1.1 + +### Patch Changes + +- 48b4e97: update `spp date time now string` format + +## 1.1.0 + +- Create OpenSPP adaptor with these functions: + - getGroup(): get existing group information + - getIndividual(): get existing individual information + - searchGroup(): search existing group by domain + - searchIndividual(): search existing individual by domain + - getGroupMembers(): get members from group + - getServicePoint(): get service points by name + - getPrograms(): get single program + - getPrograms(): get program list + - getEnrolledPrograms(): get list of enrolled program for each beneficiary + - enroll(): enroll beneficiary to a program + - unenroll(): unenroll beneficiary from program + - createIndividual(): create new individual + - updateIndividual(): update existing individual + - createGroup(): create new group + - updateGroup(): update existing group + - addToGroup(): add individual to group with(out) role + - removeFromGroup(): end membership of individual to group diff --git a/docs/openspp/README.md b/docs/openspp/README.md new file mode 100644 index 000000000..1a5419834 --- /dev/null +++ b/docs/openspp/README.md @@ -0,0 +1,32 @@ +# language-openspp + +An OpenFn **_adaptor_** for building integration jobs for use with OpenSPP +API. + +## Documentation + +View the [docs site](https://docs.openfn.org/adaptors/packages/openspp-docs) +for full technical documentation. + +### Configuration + +View the +[configuration-schema](https://docs.openfn.org/adaptors/packages/openspp-configuration-schema/) +for required and optional `configuration` properties. + +### A example expression using the `getServicePoint` function + +```js +getServicePoint("newagentflour"); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +"Getting Started" guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To build _only_ the docs run `pnpm build docs`. diff --git a/docs/openspp/index.md b/docs/openspp/index.md new file mode 100644 index 000000000..70dd5908c --- /dev/null +++ b/docs/openspp/index.md @@ -0,0 +1,484 @@ +## Functions + +
+
+ addToGroup(group_id, individual_id, role)
+
+ createGroup(data, callback)
+
+ createIndividual(data, callback)
+
+ enroll(spp_id, program_id)
+
+ getArea(spp_id, callback)
+
+ getEnrolledPrograms(spp_id, callback)
+
+ getGroup(spp_id, callback)
+
+ getGroupMembers(spp_id, [options], callback)
+
+ getIndividual(spp_id, callback)
+
+ getProgram(program_id, callback)
+
+ getPrograms([options], callback)
+
+ getServicePoint(spp_id, callback)
+
+ removeFromGroup(group_id, individual_id)
+
+ searchArea(domain, [options], callback)
+
+ searchGroup(domain, [options], callback)
+
+ searchIndividual(domain, [options], callback)
+
+ searchServicePoint(domain, [options], callback)
+
+ unenroll(spp_id, program_id)
+
+ updateGroup(group_id, data)
+
+ updateIndividual(individual_id, data)
+
+ + +## addToGroup + +addToGroup(group_id, individual_id, role) ⇒ Operation +add individual to group in OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| group_id | string | group registrant id | +| individual_id | string | individual registrant id | +| role | string | individual role in group | + +**Example** *(create a new head for group)* +```js +addToGroup("GRP_B2BRHJN2", "IND_8DUQL4M4", "Head") +``` +**Example** *(create a new ordinary member for group)* +```js +addToGroup("GRP_B2BRHJN2", "IND_8DUQL4M4") +``` +**Example** *(create a new member with new role for group)* +```js +addToGroup("GRP_B2BRHJN2", "IND_8DUQL4M4", "new-role-name") +``` + +* * * + +## createGroup + +createGroup(data, callback) ⇒ Operation +create new group for OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| data | object | registrant create data | +| callback | function | An optional callback function | + +**Example** +```js +createGroup({ name: "Group 1" }) +``` + +* * * + +## createIndividual + +createIndividual(data, callback) ⇒ Operation +create new individual for OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| data | object | registrant create data | +| callback | function | An optional callback function | + +**Example** +```js +createIndividual({ name: "Individual 1" }) +``` + +* * * + +## enroll + +enroll(spp_id, program_id) +enroll registrant to program in OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| spp_id | string | spp_id of group / individual wanted to enroll | +| program_id | string | program_id of program | + +**Example** +```js +enroll("IND_Q4VGGZPF", "PROG_2023_00000001") +``` + +* * * + +## getArea + +getArea(spp_id, callback) ⇒ Operation +get area by id in OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| spp_id | string | spp_id of area | +| callback | function | An optional callback function | + +**Example** +```js +getArea("LOC_7M92NLDH") +``` + +* * * + +## getEnrolledPrograms + +getEnrolledPrograms(spp_id, callback) ⇒ Operation +get programs list for specific registrant from OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| spp_id | string | spp_id of group / individual wanted to search | +| callback | function | An optional callback function | + +**Example** +```js +getEnrolledPrograms("IND_Q4VGGZPF") +``` + +* * * + +## getGroup + +getGroup(spp_id, callback) ⇒ Operation +get group information from OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| spp_id | string | The spp_id of the group | +| callback | function | An optional callback function | + +**Example** +```js +getGroup("GRP_Q4VGGZPF") +``` + +* * * + +## getGroupMembers + +getGroupMembers(spp_id, [options], callback) ⇒ Operation +get group members information from OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| spp_id | string | | The name of the group | +| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records | +| callback | function | | An optional callback function | + +**Example** +```js +getGroupMembers("GRP_Q4VGGZPF") +``` + +* * * + +## getIndividual + +getIndividual(spp_id, callback) ⇒ Operation +get individual information from OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| spp_id | string | The spp_id of the individual | +| callback | function | An optional callback function | + +**Example** +```js +getIndividual("IND_Q4VGGZPF") +``` + +* * * + +## getProgram + +getProgram(program_id, callback) ⇒ Operation +get program information from OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| program_id | string | searching domain | +| callback | function | An optional callback function | + +**Example** +```js +getProgram("PROG_2023_00000001") +``` + +* * * + +## getPrograms + +getPrograms([options], callback) ⇒ Operation +get programs list from OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| [options] | number | {} | offset from start | +| callback | function | | An optional callback function | + +**Example** +```js +getPrograms(100) +``` + +* * * + +## getServicePoint + +getServicePoint(spp_id, callback) ⇒ Operation +get service points information from OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| spp_id | string | The spp_id of the agent | +| callback | function | An optional callback function | + +**Example** +```js +getServicePoint("SVP_8P4KP4RT") +``` + +* * * + +## removeFromGroup + +removeFromGroup(group_id, individual_id) ⇒ Operation +remove individual from group in OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| group_id | string | group registrant id | +| individual_id | string | individual registrant id | + +**Example** +```js +removeFromGroup("GRP_B2BRHJN2", "IND_8DUQL4M4") +``` + +* * * + +## searchArea + +searchArea(domain, [options], callback) ⇒ Operation +searching for service point in OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| domain | Array | | searching domain | +| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records | +| callback | function | | An optional callback function | + +**Example** *(search without offset)* +```js +searchArea([["code", "=", "10732"]]) +``` +**Example** *(search with offset)* +```js +searchArea([["kind", "=", 1]], { offset: 10 }}) +``` + +* * * + +## searchGroup + +searchGroup(domain, [options], callback) ⇒ Operation +get groups from OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| domain | Array | | searching domain | +| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for ordering search, offset for skipping records | +| callback | function | | An optional callback function | + +**Example** *(search group by domain)* +```js +searchGroup([["spp_id", "=", "GRP_Q4VGGZPF"]]) +``` +**Example** *(search group by domain with offset)* +```js +searchGroup([["spp_id", "ilike", "GRP"]], { offset: 100 }}) +``` +**Example** *(search group by complex domain for more accuracy)* +```js +searchGroup([["address", "!=", false], ["phone", "!=", false]]) +``` + +* * * + +## searchIndividual + +searchIndividual(domain, [options], callback) ⇒ Operation +get individuals from OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| domain | Array | | searching domain | +| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records | +| callback | function | | An optional callback function | + +**Example** *(search individual by domain)* +```js +searchIndividual([["spp_id", "=", "IND_Q4VGGZPF"]]) +``` +**Example** *(search individual by domain with offset)* +```js +searchIndividual([["spp_id", "ilike", "IND"]], { offset: 100 }) +``` +**Example** *(search individual by complex domain for more accuracy)* +```js +searchIndividual([["address", "!=", false], ["birthdate", "=", false]]) +``` + +* * * + +## searchServicePoint + +searchServicePoint(domain, [options], callback) ⇒ Operation +searching for service point in OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| domain | Array | | searching domain | +| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records | +| callback | function | | An optional callback function | + +**Example** *(search without offset)* +```js +searchServicePoint([["name", "ilike", "agent 1"]]) +``` +**Example** *(search with offset)* +```js +searchServicePoint([["name", "ilike", "agent 1"]], { offset: 100 }) +``` + +* * * + +## unenroll + +unenroll(spp_id, program_id) +unenroll registrant from program in OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| spp_id | string | spp_id of group / individual wanted to unenroll | +| program_id | string | program_id of program | + +**Example** +```js +unenroll("IND_Q4VGGZPF", "PROG_2023_00000001") +``` + +* * * + +## updateGroup + +updateGroup(group_id, data) ⇒ Operation +update group for OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| group_id | string | group registrant id | +| data | object | registrant update data | + +**Example** +```js +updateGroup("GRP_B2BRHJN2", { name: "Group 1" }) +``` + +* * * + +## updateIndividual + +updateIndividual(individual_id, data) ⇒ Operation +update individual for OpenSPP + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| individual_id | string | individual registrant id | +| data | object | registrant update data | + +**Example** +```js +updateIndividual("IND_8DUQL4M4", { name: "Individual 1" }) +``` + +* * * + diff --git a/docs/postgresql/CHANGELOG.md b/docs/postgresql/CHANGELOG.md new file mode 100644 index 000000000..50f4adb02 --- /dev/null +++ b/docs/postgresql/CHANGELOG.md @@ -0,0 +1,141 @@ +# @openfn/language-postgresql + +## 4.1.8 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 4.1.7 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 4.1.6 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 4.1.5 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 4.1.4 + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 4.1.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 4.1.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 4.1.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 4.1.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 4.0.0 + +### Major Changes + +- ecd0b53: add optional callback in sql and update response structure + +## 3.4.6 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 3.4.5 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 3.4.4 + +### Patch Changes + +- f2aed32: add examples + +## 3.4.3 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 3.4.2 + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 3.4.1 + +### Patch Changes + +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 + +## 3.4.0 + +### Minor Changes + +- 44ae341: Migrate postgresql + +### Patch Changes + +- e04aa28: Rename credential-schema to configuration-schema, update descriptions diff --git a/docs/postgresql/README.md b/docs/postgresql/README.md new file mode 100644 index 000000000..444718fba --- /dev/null +++ b/docs/postgresql/README.md @@ -0,0 +1,208 @@ +# Language PostgreSQL + +Language Pack for building expressions and operations to run PostgreSQL queries. + +## Documentation + +## required configuration for Heroku postgres + +```json +{ + "host": "some-host-url.compute-1.amazonaws.com", + "port": "5432", + "database": "wouldntyouliketoknow", + "user": "me", + "password": "noway", + "ssl": true, + "allowSelfSignedCert": true +} +``` + +## `sql(query)` + +Execute an sql query. An option can be added to either log the query or not and +either execute the query or no. The options can be omitted as well. + +#### sample usage + +```js +sql( + state => + `INSERT INTO untitled_table (name, the_geom) VALUES ('` + + dataValue('form.first_name')(state) + + `', ST_SetSRID(ST_Point(` + + dataValue('lat')(state) + + `, ` + + dataValue('long')(state) + + `),4326))`, + { writeSql: true, execute: true } +); +``` + +## Find a single value for a table + +This helper function allows to build a specific query where `sql` would not be +best suited. It returns a single value and not a promise. An example of usage +would be in building a mapping object with a value from a lookup table. + +```js +alterState(async state => { + const user = { + id: 1, + name: 'Mamadou', + user_id: await findValue({ + uuid: 'id', + relation: 'users', + where: { first_name: 'Mama%' }, + operator: { first_name: 'like' }, // operator is optional. "=" is used by default. + })(state), + }; + + return upsert(...)(state); +}); +``` + +## Insert a single record + +This functions is used to insert a single record in postgres database. An option +`writeSql` allows to log the generated sql query. The `setNull` option allows to +replace the specified elements with `NULL`. + +```js +insert( + 'users', + { + email: 'antony@gmail.com', + first_name: 'Antony', + inserted_at: '2020-08-27 00:00:00', + updated_at: '2020-08-27 00:00:00', + }, + { setNull: ["''", "'undefined'"], writeSql: true, logValues: true } +); +``` + +## Insert or Update using a unique column as a key + +Insert or Update if matched. An option, `execute`, allows to either run the +generated query or no. + +```js +upsert( + 'users', + 'email', + { + email: 'luca@openfn.org', + first_name: 'Luca', + inserted_at: '2010-01-01 00:00:00', + updated_at: '2010-01-01 00:00:00', + }, + { + setNull: ["'NaN'", "'undefined'"], + writeSql: false, + execute: true, + logValues: true, + } +); +``` + +## Insert or Update if a value exist in the record + +This function will upsert a record only if the logical given is true. In this +case we check if `dataValue('name')` exists. + +```js +upsertIf(dataValue('name'), 'users', 'ON CONSTRAINT users_pkey', { + name: 'Elodie', + id: 7, +}); +``` + +## Insert many records in postgresql + +This function allows the insert of a set of records inside a table all at once. + +```js +insertMany( + 'users', + state => + state.data.people.map(s => { + return { + first_name: ['Luca', 'Mohamed', 'Elodie'], + inserted_at: '2020-01-01 00:00:00', + updated_at: '2020-01-01 00:00:00', + }; + }), + { logValues: true } +); +``` + +## Upsert many records in postgresql + +This function allows the upsert of a set of records inside a table all at once. + +```js +upsertMany('users', 'ON CONSTRAINT users_pkey', state => + state.data.people.map(s => { + return { + first_name: ['Luca', 'Mohamed', 'Elodie'], + inserted_at: '2020-01-01 00:00:00', + updated_at: '2020-01-01 00:00:00', + }; + }) +); +``` + +## Describe a table from postgres + +This function is used to fetch the list of columns of a given table in the +database. + +```js +describeTable('users', { writeSql: true, execute: false }); +``` + +## Create a table in the database + +This function allows to create a table in a database from a given array of +columns. The key `identity` can be use for a column to auto-generate a value. + +```js +insertTable('users', state => + state.data.map(column => ({ + name: column.name, + type: column.type, + required: true, // optional + unique: false, // optional - set to true for unique constraint + })) +); +``` + +## Alter a table in the database + +This function allows to add new columns to a table. Beware of the fact that you +cannot add new columns with names that already exist in the table. + +```js +modifyTable( + 'users', + state => + state.data.map(newColumn => ({ + name: newColumn.name, + type: newColumn.type, + required: true, // optional + unique: false, // optional - set to true for unique constraint + })), + { writeSql: false, execute: true } +); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/postgresql/index.md b/docs/postgresql/index.md new file mode 100644 index 000000000..837341735 --- /dev/null +++ b/docs/postgresql/index.md @@ -0,0 +1,315 @@ +## Functions + +
+
+ describeTable(tableName, [options], callback)
+
+ findValue([filter])
+
+ insert(table, record, [options], callback)
+
+ insertMany(table, records, [options], callback)
+
+ insertTable(tableName, columns, [options], callback)
+
+ modifyTable(tableName, columns, [options], callback)
+
+ sql(sqlQuery, [options], callback)
+
+ upsert(table, uuid, record, [options], callback)
+
+ upsertIf(logical, table, uuid, record, [options], callback)
+
+ upsertMany(table, uuid, data, [options], callback)
+
+ + +## describeTable + +describeTable(tableName, [options], callback) ⇒ Operation +List the columns of a table in a database. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| tableName | string | The name of the table to describe | +| [options] | object | Optional options argument | +| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | +| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | +| callback | function | (Optional) callback function | + +**Example** +```js +describeTable('clinic_visits') +``` + +* * * + +## findValue + +findValue([filter]) ⇒ value +Fetch a uuid key given a condition + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| [filter] | object | A filter object with the lookup table, a uuid and the condition | +| [filter.uuid] | string | The uuid value to search for in the specified relation. | +| [filter.relation] | string | The name of the relation to search for the uuid value. | +| [filter.where] | object | An object that contains key-value pairs to filter the search results. | +| [filter.operator] | object | An object that contains key-value pairs to specify the type of comparison to perform on the where clause. | + +**Example** +```js +findValue({ + uuid: 'id', + relation: 'users', + where: { first_name: 'Mamadou' }, + operator: { first_name: 'like' } + }) +``` + +* * * + +## insert + +insert(table, record, [options], callback) ⇒ Operation +Insert a record + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| table | string | The target table | +| record | object | Payload data for the record as a JS object or function | +| [options] | object | Optional options argument | +| [options.setNull] | string | A string value that specifies the behavior for inserting null values. | +| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. | +| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | +| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | +| callback | function | (Optional) callback function | + +**Example** +```js +insert('users', { name: 'Elodie', id: 7 }, { setNull: "'NaN'", logValues: true }); +``` + +* * * + +## insertMany + +insertMany(table, records, [options], callback) ⇒ Operation +Insert many records, using the keys of the first as the column template + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| table | string | The target table | +| records | array | An array or a function that takes state and returns an array | +| [options] | object | Optional options argument | +| [options.setNull] | string | A string value that specifies the behavior for inserting null values. | +| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. | +| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | +| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | +| callback | function | (Optional) callback function | + +**Example** +```js +insertMany('users', state => state.data.recordArray, { setNull: "'undefined'", logValues: true }); +``` + +* * * + +## insertTable + +insertTable(tableName, columns, [options], callback) ⇒ Operation +Create a table in database when given an array of columns and a table_name. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| tableName | string | The name of the table to create | +| columns | array | An array of form columns | +| [options] | object | Optional options argument | +| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | +| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | +| callback | function | (Optional) callback function | + +**Example** +```js +insertTable('table_name', state => state.data.map( + column => ({ + name: column.name, + type: column.type, + required: true, // optional + unique: false, // optional - to be set to true for unique constraint + }) +)); +``` + +* * * + +## modifyTable + +modifyTable(tableName, columns, [options], callback) ⇒ Operation +Alter an existing table in the database. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| tableName | string | The name of the table to alter | +| columns | array | An array of form columns | +| [options] | object | Optional options argument | +| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | +| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | +| callback | function | (Optional) callback function | + +**Example** +```js +modifyTable('table_name', state => state.data.map( + newColumn => ({ + name: newColumn.name, + type: newColumn.type, + required: true, // optional + unique: false, // optional - to be set to true for unique constraint + }) +)); +``` + +* * * + +## sql + +sql(sqlQuery, [options], callback) ⇒ Operation +Execute an SQL statement + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| sqlQuery | function | a function which takes state and returns a string of SQL. | +| [options] | object | Optional options argument | +| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | +| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | +| callback | function | (Optional) callback function | + +**Example** +```js +sql(state => `select(*) from ${state.data.tableName};`, { writeSql: true }) +``` + +* * * + +## upsert + +upsert(table, uuid, record, [options], callback) ⇒ Operation +Insert or update a record using ON CONFLICT UPDATE + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| table | string | The target table | +| uuid | string | The uuid column to determine a matching/existing record | +| record | object | Payload data for the record as a JS object or function | +| [options] | object | Optional options argument | +| [options.setNull] | string | A string value that specifies the behavior for inserting null values. | +| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | +| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | +| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. | +| callback | function | (Optional) callback function | + +**Example** +```js +upsert( + 'users', // the DB table + 'ON CONSTRAINT users_pkey', // a DB column with a unique constraint OR a CONSTRAINT NAME + { name: 'Elodie', id: 7 }, + { setNull: ["''", "'undefined'"], writeSql:true, execute: true, logValues: true } +) +``` + +* * * + +## upsertIf + +upsertIf(logical, table, uuid, record, [options], callback) ⇒ Operation +Insert or update a record based on a logical condition using ON CONFLICT UPDATE + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| logical | string | a data to check existing value for. | +| table | string | The target table | +| uuid | string | The uuid column to determine a matching/existing record | +| record | object | Payload data for the record as a JS object or function | +| [options] | object | Optional options argument | +| [options.setNull] | string | A string value that specifies the behavior for inserting null values. | +| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | +| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | +| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. | +| callback | function | (Optional) callback function | + +**Example** +```js +upsertIf( + dataValue('name'), + 'users', // the DB table + 'ON CONSTRAINT users_pkey', // a DB column with a unique constraint OR a CONSTRAINT NAME + { name: 'Elodie', id: 7 }, + { writeSql:true, execute: true } +) +``` + +* * * + +## upsertMany + +upsertMany(table, uuid, data, [options], callback) ⇒ Operation +Insert or update multiple records using ON CONFLICT UPDATE and excluded + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| table | string | The target table | +| uuid | string | The uuid column to determine a matching/existing record | +| data | array | An array of objects or a function that returns an array | +| [options] | object | Optional options argument | +| [options.setNull] | string | A string value that specifies the behavior for inserting null values. | +| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | +| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | +| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. | +| callback | function | (Optional) callback function | + +**Example** +```js +upsertMany( + 'users', // the DB table + 'email', // a DB column with a unique constraint OR a CONSTRAINT NAME + [ + { name: 'one', email: 'one@openfn.org' }, + { name: 'two', email: 'two@openfn.org' }, + ] + { logValues: true } +) +``` + +* * * + diff --git a/docs/primero/CHANGELOG.md b/docs/primero/CHANGELOG.md new file mode 100644 index 000000000..63a32428d --- /dev/null +++ b/docs/primero/CHANGELOG.md @@ -0,0 +1,164 @@ +# @openfn/language-primero + +## 2.11.8 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 2.11.7 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 2.11.6 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 2.11.5 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 2.11.4 + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 2.11.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 2.11.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 2.11.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 2.11.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 2.10.6 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 2.10.5 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 2.10.4 + +### Patch Changes + +- f2aed32: add examples + +## 2.10.3 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ +- 059c956: added examples in docstring + +## 2.10.2 + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 2.10.1 + +### Patch Changes + +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 + +## 2.10.0 + +### Minor Changes + +- 33742bf: Modify `composeNextState` so that `getCases` can pass it a third + argument: the metadata from Primero's response. + + `getCases` will now not only return an array of `cases` in `state.data`, but + metadata related to pagination in `state.metadata`. + +### Patch Changes + +- 2014694: remove travis url in readme +- bb764db: Conditionally check for 'withReferrals' in case no options are + provided" + +## 2.9.2 + +### Patch Changes + +- e04aa28: Rename credential-schema to configuration-schema, update descriptions + +## 2.9.1 + +### Patch Changes + +- d4ac748: Skipped failing test until we have a new strat (it's working) + +## 2.9.0 + +### Minor Changes + +- b37a4ad: add language primero into monorepo + +### Patch Changes + +- adb97a0: Fixed issue where upsertCase always took state.data for main params diff --git a/docs/primero/README.md b/docs/primero/README.md new file mode 100644 index 000000000..339adb211 --- /dev/null +++ b/docs/primero/README.md @@ -0,0 +1,41 @@ +# language-primero + +An OpenFn **_adaptor_** for building integration jobs for use with UNICEF's +Primero API. + +**See Update Docs Site: https://docs.openfn.org/adaptors/packages/primero-docs** + +## Primero API Versions + +### Adaptor for Primero v2.0 + +This documentation outlines the functions available for Primero `v2.0` in the +main branch. The API documentation is available at: +https://github.com/primeroIMS/primero/tree/development_v2/app/controllers/api + +### Adaptor for Primero v1.0 still available on the `v1` branch. + +`v1.0.7` of this adaptor was built for the Primero `v1.1` API: +https://github.com/OpenFn/language-primero/blob/v1/README.md + +[Primero API v1.1 Documentation](https://docs.google.com/document/d/1jpaT2_UBBnc3PxPYlLMBEzNUkyfuxRZiksywG5MKM0Q/edit) + +#### Primero Authentication Strategies + +The Primero team is considering a shift to Microsoft Azure Active Directory B2C +for auth. We can likely accommodate this with a similar pattern as has been used +in our Microsoft Dynamics, Github, or Google Sheets adaptors, but we'll need to +await final doucmentation for Primero's `v2` API before making changes. + +[Azure Active Directory B2C](https://docs.microsoft.com/en-us/azure/active-directory-b2c/) + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/primero/index.md b/docs/primero/index.md new file mode 100644 index 000000000..a6a485155 --- /dev/null +++ b/docs/primero/index.md @@ -0,0 +1,406 @@ +## Functions + +
+
+ cleanupState(state)
+
+ createCase(params, callback)
+
+ createReferrals(params, callback)
+
+ generateAuthString(state)
+
+ getCases(query, options, callback)
+
+ getForms(query, callback)
+
+ getLocations(query, callback)
+
+ getLookups(query, callback)
+
+ getReferrals(params, callback)
+
+ login(state)
+
+ queryHandler(state, params, callback)
+
+ updateCase(id, params, callback)
+
+ updateReferral(params, callback)
+
+ upsertCase(params, callback)
+
+ + +## cleanupState + +cleanupState(state) ⇒ State +Removes unserializable keys from the state. + +**Kind**: global function + +| Param | Type | +| --- | --- | +| state | State | + +**Example** +```js +cleanupState(state) +``` + +* * * + +## createCase + +createCase(params, callback) ⇒ Operation +Create a new case in Primero + +Use this function to create a new case in Primero based on a set of Data. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | an object with some case data. | +| callback | function | (Optional) Callback function | + +**Example** *(Create a new case in Primero based on a set of Data)* +```js +createCase({ + data: { + age: 16, + sex: "female", + name: "Edwine Edgemont", + }, +}); +``` + +* * * + +## createReferrals + +createReferrals(params, callback) ⇒ Operation +Create referrals in Primero + +Use this function to bulk refer to one or multiple cases from Primero to a single user + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | an object with referral data. | +| callback | function | (Optional) Callback function | + +**Example** *(Create referrals for multiple cases in Primero)* +```js +createReferrals({ + data: { + ids: [ + "749e9c6e-60db-45ec-8f5a-69da7c223a79", + "dcea6052-07d9-4cfa-9abf-9a36987cdd25", + ], + transitioned_to: "primero_cp", + notes: "This is a bulk referral", + }, +}); +``` + +* * * + +## generateAuthString + +generateAuthString(state) ⇒ string +Generate an auth string to support multiple types of auth credentials. + +**Kind**: global function + +| Param | Type | +| --- | --- | +| state | State | + +**Example** +```js +generateAuthString(state) +``` + +* * * + +## getCases + +getCases(query, options, callback) ⇒ Operation +Get cases from Primero + +Use this function to get cases from Primero based on a set of query parameters. +Note that in many implementations, the `remote` attribute should be set to `true` to ensure that only cases marked for remote access will be retrieved. +You can specify a `case_id` value to fetch a unique case and a query string to filter result. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| query | object | an object with a query param at minimum, option to getReferrals | +| options | object | (Optional) an object with a getReferrals key to fetch referrals | +| callback | function | (Optional) Callback function | + +**Example** *( Get cases from Primero with query parameters)* +```js +getCases({ + remote: true, + query: "sex=male", +}); +``` +**Example** *(Get case from Primero for a specific case id)* +```js +getCases({ + remote: true, + case_id: "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz", +}); +``` + +* * * + +## getForms + +getForms(query, callback) ⇒ Operation +Get forms from Primero + +Use this function to get forms from Primero that are accessible to this user based on a set of query parameters. +The user can filter the form list by record type and module. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| query | object | an object with a query param at minimum | +| callback | function | (Optional) Callback function | + +**Example** *(Get the list of all forms)* +```js +getForms(); +``` +**Example** *(Get the list of all forms for a specific module)* +```js +getForms({ + module_id: "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz", +}); +``` + +* * * + +## getLocations + +getLocations(query, callback) ⇒ Operation +Get locations from Primero + +Use this function to get a paginated list of all locations that are accessible to this user from Primero. +Note: You can specify a `per` value to fetch records per page(Defaults to 20). +Also you can specify `page` value to fetch pagination (Defaults to 1). +Another parameter is `hierarchy: true` (Defaults to false) + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| query | object | an object with a query param at minimum | +| callback | function | (Optional) Callback function | + +**Example** *(Get loocations from Primero with query parameters)* +```js +getLocations({ + page: 1, + per: 20 +}) +``` + +* * * + +## getLookups + +getLookups(query, callback) ⇒ Operation +Get lookups from Primero + +Use this function to get a paginated list of all lookups that are accessible to this user from Primero. +Note: You can specify a `per` value to fetch records per page(Defaults to 20). +Also you can specify `page` value to fetch pagination (Defaults to 1) + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| query | object | an object with a query param at minimum | +| callback | function | (Optional) Callback function | + +**Example** *(Get lookups from Primero with query parameters)* +```js +getLookups({ + per: 10000, + page: 5 +}); +``` + +* * * + +## getReferrals + +getReferrals(params, callback) ⇒ Operation +Get referrals for a specific case in Primero + +Use this function to get the list of referrals of one case from Primero. +The search can be done using either `record id` or `case id`. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | an object with an externalId field to select the attribute to use for matching on case and an externalId value for that case. | +| callback | function | (Optional) Callback function | + +**Example** *(Get referrals for a case in Primero by record id)* +```js +getReferrals({ + externalId: "record_id", + id: "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz", +}); +``` +**Example** *(Get referrals for a case in Primero by case id)* +```js + getReferrals({ + id: "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz", +}); +``` + +* * * + +## login + +login(state) ⇒ State +Logs in to Primero. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| state | State | Runtime state. | + +**Example** +```js +login(state) +``` + +* * * + +## queryHandler + +queryHandler(state, params, callback) ⇒ State +Execute custom query + +**Kind**: global function + +| Param | Type | +| --- | --- | +| state | State | +| params | object | +| callback | function | + + +* * * + +## updateCase + +updateCase(id, params, callback) ⇒ Operation +Update an existing case in Primero + +Use this function to update an existing case from Primero. +In this implementation, the function uses a case ID to check for the case to update, +Then merge the values submitted in this call into an existing case. +Fields not specified in this request will not be modified. +For nested subform fields, the subform arrays will be recursively merged, +keeping both the existing values and appending the new + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| id | string | A case ID to use for the update. | +| params | object | an object with some case data. | +| callback | function | (Optional) Callback function | + +**Example** *(Update case for a specific case id)* +```js +updateCase("6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz", { + data: { + age: 16, + sex: "female", + name: "Fiona Edgemont", + }, +}); +``` + +* * * + +## updateReferral + +updateReferral(params, callback) ⇒ Operation +Update a single referral for a specific case in Primero + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | an object with an caseExternalId value to use, the id and the referral id to update. | +| callback | function | (Optional) Callback function | + +**Example** *(Update referral by record id)* +```js +updateReferral({ + caseExternalId: "record_id", + id: "749e9c6e-60db-45ec-8f5a-69da7c223a79", + caseId: "dcea6052-07d9-4cfa-9abf-9a36987cdd25", + data: (state) => state.data, +}); +``` + +* * * + +## upsertCase + +upsertCase(params, callback) ⇒ Operation +Upsert case to Primero + +Use this function to update an existing case from Primero or to create it otherwise. +In this implementation, we first fetch the list of cases, +then we check if the case exist before choosing the right operation to do. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | an object with an externalIds and some case data. | +| callback | function | (Optional) Callback function | + +**Example** *(Upsert case for a specific case id)* +```js +upsertCase({ + externalIds: ["case_id"], + data: state => ({ + age: 20, + sex: "male", + name: "Alex", + status: "open", + case_id: "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz", + }), +}); +``` + +* * * + diff --git a/docs/progres/CHANGELOG.md b/docs/progres/CHANGELOG.md new file mode 100644 index 000000000..38fa9afb2 --- /dev/null +++ b/docs/progres/CHANGELOG.md @@ -0,0 +1,122 @@ +# @openfn/language-progres + +## 1.3.8 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 1.3.7 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 1.3.6 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 1.3.5 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 1.3.4 + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 1.3.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 1.3.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 1.3.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 1.3.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 1.2.5 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 1.2.4 + +### Patch Changes + +- ef828e7: update old urls in readme +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 1.2.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 1.2.2 + +### Patch Changes + +- f2aed32: add examples + +## 1.2.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 1.2.0 + +### Minor Changes + +- 039ca0b: Migrate Progres + +### Patch Changes + +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 diff --git a/docs/progres/README.md b/docs/progres/README.md new file mode 100644 index 000000000..e6929320b --- /dev/null +++ b/docs/progres/README.md @@ -0,0 +1,53 @@ +# language-progres + +An OpenFn **_adaptor_** for building integration jobs for use with the UNHCR +ProGres v4 API. + +## Design notes + +- Integration must run through UNHCR's DTP, a middleware layer that provides a + public API for UNHCR internal software. +- An API token _and_ a self-signed certificate must be provided for + communication with UNHCR's DTP. +- Two-way sync must be possible between Primero and ProGres +- Teams still in discussion about whether the most common use-case will be a + timed sync or real-time/event-based sync. + +## Documentation + +View the [docs site](https://docs.openfn.org/adaptors/packages/progres-docs) for +full technical documentation. + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/progres-configuration-schema/) +definition. + +### Posting data to an endpoint with SSL cert authentication + +```js +postData({ + url: urlDTP, + body: { a: 1 }, + headers: { + 'Subscription-Key': configuration['token'], + }, + agentOptions: { + key, + cert, + }, +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/progres/index.md b/docs/progres/index.md new file mode 100644 index 000000000..2998e8de7 --- /dev/null +++ b/docs/progres/index.md @@ -0,0 +1,30 @@ +## postData + +postData(params, callback) ⇒ Operation +Make a POST request with a certificate + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | Url, Headers and Body parameters | +| callback | function | (Optional) A callback function | + +**Example** +```js +postData({ + url: urlDTP, + body: obj, + headers: { + 'Ocp-Apim-Subscription-Key': configuration['Ocp-Apim-Subscription-Key'], + }, + agentOptions: { + key, + cert, + }, +}, callback)(state) +``` + +* * * + diff --git a/docs/rapidpro/CHANGELOG.md b/docs/rapidpro/CHANGELOG.md new file mode 100644 index 000000000..009873f62 --- /dev/null +++ b/docs/rapidpro/CHANGELOG.md @@ -0,0 +1,128 @@ +# @openfn/language-rapidpro + +## 1.0.8 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 1.0.7 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 1.0.6 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 1.0.5 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 1.0.4 + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 1.0.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 1.0.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 1.0.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 1.0.0 + +### Major Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.5.6 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 0.5.5 + +### Patch Changes + +- ef828e7: update old urls in readme +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.5.4 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.5.3 + +### Patch Changes + +- f2aed32: add examples + +## 0.5.2 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.5.1 + +### Patch Changes + +- cbb8968: Fix axios Inefficient Regular Expression Complexity vulnerability + +## 0.5.0 + +### Minor Changes + +- 11f83ff: Migrate RapidPro + +### Patch Changes + +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 diff --git a/docs/rapidpro/README.md b/docs/rapidpro/README.md new file mode 100644 index 000000000..f44efec9d --- /dev/null +++ b/docs/rapidpro/README.md @@ -0,0 +1,83 @@ +# language-rapidpro + +An OpenFn **_adaptor_** for building integration jobs for use with the +[RapidPro API](https://rapidpro.io/api/v2/). + +## Documentation + +View the [docs site](https://docs.openfn.org/adaptors/packages/rapidpro-docs) +for full technical documentation. + +## Usage + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/rapidpro-configuration-schema/) +definition. + +#### sample job expression using operation + +```js +sendBroadcast({ + "text": "Hello friends.", + "urns": [], + "contacts": [], + "groups", [], +}); +``` + +### Key helper functions + +**sendBroadcast(...) to send broadcast message to multiple contacts** + +```js +sendBroadcast({ + text: 'Hello world', + urns: ['twitter:sirmixalot'], + contacts: ['a052b00c-15b3-48e6-9771-edbaa277a353'], +}); +``` + +**startFlow(...) to trigger an automation flow in RapidPro** + +```js +startFlow({ + flow: 'f5901b62-ba76-4003-9c62-72fdacc1b7b7', + restart_participants: false, + contacts: ['a052b00c-15b3-48e6-9771-edbaa277a353'], +}); +``` + +**upsertContact(...) to update/insert a Contact (and check if exists using +external identifiers)** + +```js +upsertContact({ + name: 'Mamadou', + language: 'ENG', + urns: ['tel:+250788123123'], +}); +``` + +**addContact(...) to insert a Contact** + +```js +addContact({ + name: 'Mamadou', + language: 'ENG', + urns: ['tel:+250788123123'], +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/rapidpro/index.md b/docs/rapidpro/index.md new file mode 100644 index 000000000..7d80cb866 --- /dev/null +++ b/docs/rapidpro/index.md @@ -0,0 +1,110 @@ +## Functions + +
+
+ addContact(params, callback)
+
+ sendBroadcast(params, callback)
+
+ startFlow(params, callback)
+
+ upsertContact(params, callback)
+
+ + +## addContact + +addContact(params, callback) ⇒ Operation +Adds a new contact to RapidPro + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data to create the new resource | +| callback | function | (Optional) callback function | + +**Example** +```js +addContact({ + name: "Mamadou", + language: "ENG", + urns: ["tel:+250788123123"] +}); +``` + +* * * + +## sendBroadcast + +sendBroadcast(params, callback) ⇒ Operation +Sends a message to a list of contacts and/or URNs + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data to create the new resource | +| callback | function | (Optional) callback function | + +**Example** +```js +sendBroadcast({ + text: "Hello world", + urns: ["twitter:sirmixalot"], + contacts: ["a052b00c-15b3-48e6-9771-edbaa277a353"] +}); +``` + +* * * + +## startFlow + +startFlow(params, callback) ⇒ Operation +Start a RapidPro flow for a number of contacts + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data to create the new resource | +| callback | function | (Optional) callback function | + +**Example** +```js +startFlow({ + flow: "f5901b62-ba76-4003-9c62-72fdacc1b7b7", + restart_participants: false, + contacts: ["a052b00c-15b3-48e6-9771-edbaa277a353"] +}); +``` + +* * * + +## upsertContact + +upsertContact(params, callback) ⇒ Operation +Upserts a contact to RapidPro by URN + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data to upsert a contact | +| callback | function | (Optional) callback function | + +**Example** +```js +upsertContact({ + name: "Mamadou", + language: "ENG", + urns: ["tel:+250788123123"] +}); +``` + +* * * + diff --git a/docs/resourcemap/CHANGELOG.md b/docs/resourcemap/CHANGELOG.md new file mode 100644 index 000000000..4338b6f9c --- /dev/null +++ b/docs/resourcemap/CHANGELOG.md @@ -0,0 +1,54 @@ +# @openfn/language-resourcemap + +## 0.3.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.3.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.2.3 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.2.2 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.2.1 + +### Patch Changes + +- f2aed32: add examples + +## 0.2.0 + +### Minor Changes + +- 664dc7f: migrate resourcemap diff --git a/docs/resourcemap/README.md b/docs/resourcemap/README.md new file mode 100644 index 000000000..3bf4026fc --- /dev/null +++ b/docs/resourcemap/README.md @@ -0,0 +1,48 @@ +# Language ResourceMap + +Language Pack for building expressions and operations for working with the +[resourcemap API](https://github.com/instedd/resourcemap/wiki/REST_API). + +## Documentation + +We are working towards this to start: +https://github.com/instedd/resourcemap/wiki/REST_API#create-site + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/resourcemap-configuration-schema/) +definition. + +## Expressions + +## `submitSite(collectionId, fields)` + +```js +submitSite( + 303, + fields( + field('name', dataValue('sampleText')), + field('lat', 48.86), + field('lon', 2.35), + field('properties', function (state) { + return { + Comment: state.data.sampleText, + phone: '85512345678', + }; + }) + ) +); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/resourcemap/index.md b/docs/resourcemap/index.md new file mode 100644 index 000000000..ff1ff83d6 --- /dev/null +++ b/docs/resourcemap/index.md @@ -0,0 +1,20 @@ +## submitSite + +submitSite(eventData) ⇒ Operation +Create an event + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| eventData | object | Payload data for the event | + +**Example** +```js +execute( + event(eventData) +)(state) +``` + +* * * + diff --git a/docs/salesforce/CHANGELOG.md b/docs/salesforce/CHANGELOG.md new file mode 100644 index 000000000..7dde7928f --- /dev/null +++ b/docs/salesforce/CHANGELOG.md @@ -0,0 +1,214 @@ +# @openfn/language-salesforce + +## 4.3.1 + +### Patch Changes + +- 1131c34: Remove regex pattern for validation and changed minLength to 1 + +## 4.3.0 + +### Minor Changes + +- 1d5b62f: Add `toUTF8` function + +## 4.2.2 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 4.2.1 + +### Patch Changes + +- 07debe9: Update bulkQuery to use bulkv2 + +## 4.2.0 + +### Minor Changes + +- fc58f1c: add options in bulkQuery + +## 4.1.0 + +### Minor Changes + +- 1e3a083: add bulkQuery function + +## 4.0.8 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 4.0.7 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 4.0.6 + +### Patch Changes + +- aceedd2: update jsforce and remove unused packages + +## 4.0.5 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 4.0.4 + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 4.0.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 4.0.2 + +### Patch Changes + +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 4.0.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 4.0.0 + +### Major Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 3.0.7 + +### Patch Changes + +- 7cc8efc: remove FakeAdaptor references + +## 3.0.6 + +### Patch Changes + +- 705caab: Remove tools as devdependencies + +## 3.0.5 + +### Patch Changes + +- 929bca6: Use metadata helper function from common +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 3.0.4 + +### Patch Changes + +- ef828e7: update old urls in readme +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 3.0.3 + +### Patch Changes + +- 06aced8: Fix dependencies + +## 3.0.2 + +### Patch Changes + +- aed7e0b: fix required field in configuration schema + +## 3.0.1 + +### Patch Changes + +- c09b821: Add @magic annotations + +## 3.0.0 + +### Major Changes + +- 190f667: Remove curry from salesforce + +## 2.12.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 2.12.2 + +### Patch Changes + +- f2aed32: add examples + +## 2.12.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 2.12.0 + +### Minor Changes + +- 5c883c6: Allow expansion for describe(), add describeAll() + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 2.11.1 + +### Patch Changes + +- e7bf865: chore(deps): update dependency sinon to v14 +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 + +## 2.11.0 + +### Minor Changes + +- edff578: Migrate salesforce diff --git a/docs/salesforce/README.md b/docs/salesforce/README.md new file mode 100644 index 000000000..cec12051b --- /dev/null +++ b/docs/salesforce/README.md @@ -0,0 +1,82 @@ +# Language Salesforce + +An OpenFn **_adaptor_** for building integration jobs for use with the +Salesforce API. + +## Documentation + +View the [docs site](https://docs.openfn.org/adaptors/packages/salesforce-docs) +for full technical documentation. + +## Release notes and deprecated CHANGELOG.md + +See [releases](https://docs.openfn.org/adaptors/packages/salesforce-changelog) +for all changes. + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/saleforce-configuration-schema/) +definition. + +## Intent + +--- + +Allow communication with Salesforce using a set of Lisp compatible expressions. + +Using simple functions we can create a simplified API, simple enough to generate +code from data. + +## Expressions + +--- + +Expressions are a simplified set of function calls. Outlining the operations +needed to be performed. + +An uncompiled expression has no knowledge of the internals of the adaptor, +credentials or runtime environment. + +It's the responsibility of the build process to provide a wrapper that will +inject the functions in. + +For example: + +```javascript +describe('vera__Test_Event__c'), + create('vera__Test_Event__c', { + vera__Test_Event_Name_Unique__c: 'hello from jsforce', + }), + create('vera__Boat__c', { + Name: 'Catatafish redux!', + vera__Test_Event__c: reference(0), + }); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` + +## Other + +Create SOAP session + +```sh +curl https://test.salesforce.com/services/Soap/u/47.0 -H "Content-Type: text/xml; charset=UTF-8" -H "SOAPAction: login" -d @tmp/login.txt | xmllint --format - +``` + +Close jobs + +```sh +curl +https://openfn.my.salesforce.com/services/async/47.0/job/some_id -H 'X-SFDC-Session: abc123sessionID456xyz' -H "Content-Type: application/xml; charset=UTF-8" -d @tmp/close_job.txt | xmllint --format - +``` diff --git a/docs/salesforce/index.md b/docs/salesforce/index.md new file mode 100644 index 000000000..8664b2429 --- /dev/null +++ b/docs/salesforce/index.md @@ -0,0 +1,478 @@ +## Functions + +
+
+ bulk(sObject, operation, options, fun)
+
+ bulkQuery(qs, options, callback)
+
+ cleanupState(state)
+
+ create(sObject, attrs)
+
+ createConnection(state)
+
+ createIf(logical, sObject, attrs)
+
+ describe(sObject)
+
+ describeAll()
+
+ destroy(sObject, attrs, options)
+
+ execute(operations)
+
+ login(state)
+
+ query(qs)
+
+ reference(position)
+
+ relationship(relationshipName, externalId, dataSource)
+
+ retrieve(sObject, id, callback)
+
+ steps()
+
+ toUTF8(input)
+
+ update(sObject, attrs)
+
+ upsert(sObject, externalId, attrs)
+
+ upsertIf(logical, sObject, externalId, attrs)
+
+ + +## bulk + +bulk(sObject, operation, options, fun) ⇒ Operation +Create and execute a bulk job. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| sObject | String | API name of the sObject. | +| operation | String | The bulk operation to be performed | +| options | Object | Options passed to the bulk api. | +| fun | function | A function which takes state and returns an array. | + +**Example** +```js +bulk('Patient__c', 'insert', { failOnError: true, pollInterval: 3000, pollTimeout: 240000 }, state => { + return state.data.someArray.map(x => { + return { 'Age__c': x.age, 'Name': x.name } + }) +}); +``` + +* * * + +## bulkQuery + +bulkQuery(qs, options, callback) ⇒ Operation +Execute an SOQL Bulk Query. +This function uses bulk query to efficiently query large data sets and reduce the number of API requests. +Note that in an event of a query error, +error logs will be printed but the operation will not throw the error. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| qs | String | A query string. | +| options | Object | Options passed to the bulk api. | +| [options.pollTimeout] | integer | Polling timeout in milliseconds. | +| [options.pollInterval] | integer | Polling interval in milliseconds. | +| callback | function | A callback to execute once the record is retrieved | + +**Example** *(The results will be available on `state.data`)* +```js +bulkQuery(state=> `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`); +``` +**Example** +```js +bulkQuery( + (state) => + `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`, + { pollTimeout: 10000, pollInterval: 6000 } +); +``` + +* * * + +## cleanupState + +cleanupState(state) ⇒ State +Removes unserializable keys from the state. + +**Kind**: global function + +| Param | Type | +| --- | --- | +| state | State | + +**Example** +```js +cleanupState(state) +``` + +* * * + +## create + +create(sObject, attrs) ⇒ Operation +Create a new object. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| sObject | String | API name of the sObject. | +| attrs | Object | Field attributes for the new object. | + +**Example** +```js +create('obj_name', { + attr1: "foo", + attr2: "bar" +}) +``` + +* * * + +## createConnection + +createConnection(state) ⇒ State +Creates a connection. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| state | State | Runtime state. | + +**Example** +```js +createConnection(state) +``` + +* * * + +## createIf + +createIf(logical, sObject, attrs) ⇒ Operation +Create a new object if conditions are met. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| logical | boolean | a logical statement that will be evaluated. | +| sObject | String | API name of the sObject. | +| attrs | Object | Field attributes for the new object. | + +**Example** +```js +createIf(true, 'obj_name', { + attr1: "foo", + attr2: "bar" +}) +``` + +* * * + +## describe + +describe(sObject) ⇒ Operation +Outputs basic information about an sObject to `STDOUT`. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| sObject | String | API name of the sObject. | + +**Example** +```js +describe('obj_name') +``` + +* * * + +## describeAll + +describeAll() ⇒ Operation +Outputs basic information about available sObjects. + +**Kind**: global function +**Access**: public +**Example** +```js +describeAll() +``` + +* * * + +## destroy + +destroy(sObject, attrs, options) ⇒ Operation +Delete records of an object. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| sObject | String | API name of the sObject. | +| attrs | Object | Array of IDs of records to delete. | +| options | Object | Options for the destroy delete operation. | + +**Example** +```js +destroy('obj_name', [ + '0060n00000JQWHYAA5', + '0090n00000JQEWHYAA5 +], { failOnError: true }) +``` + +* * * + +## execute + +execute(operations) ⇒ State +Executes an operation. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| operations | Operation | Operations | + + +* * * + +## login + +login(state) ⇒ State +Performs a login. + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| state | State | Runtime state. | + +**Example** +```js +login(state) +``` + +* * * + +## query + +query(qs) ⇒ Operation +Execute an SOQL query. +Note that in an event of a query error, +error logs will be printed but the operation will not throw the error. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| qs | String | A query string. | + +**Example** +```js +query(`SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`); +``` + +* * * + +## reference + +reference(position) ⇒ State +Get a reference ID by an index. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| position | number | Position for references array. | + +**Example** +```js +reference(0) +``` + +* * * + +## relationship + +relationship(relationshipName, externalId, dataSource) ⇒ object +Adds a lookup relation or 'dome insert' to a record. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| relationshipName | string | `__r` relationship field on the record. | +| externalId | string | Salesforce ExternalID field. | +| dataSource | string | resolvable source. | + +**Example** +```js +Data Sourced Value: + relationship("relationship_name__r", "externalID on related object", dataSource("path")) +Fixed Value: + relationship("relationship_name__r", "externalID on related object", "hello world") +``` + +* * * + +## retrieve + +retrieve(sObject, id, callback) ⇒ Operation +Retrieves a Salesforce sObject(s). + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| sObject | String | The sObject to retrieve | +| id | String | The id of the record | +| callback | function | A callback to execute once the record is retrieved | + +**Example** +```js +retrieve('ContentVersion', '0684K0000020Au7QAE/VersionData'); +``` + +* * * + +## steps + +steps() ⇒ Array +Flattens an array of operations. + +**Kind**: global function +**Example** +```js +steps( + createIf(params), + update(params) +) +``` + +* * * + +## toUTF8 + +toUTF8(input) ⇒ String +Transliterates unicode characters to their best ASCII representation + +**Kind**: global function +**Returns**: String - - ASCII representation of input string +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| input | string | A string with unicode characters | + +**Example** +```js +fn((state) => { + const s = toUTF8("άνθρωποι"); + console.log(s); // anthropoi + return state; +}); +``` + +* * * + +## update + +update(sObject, attrs) ⇒ Operation +Update an object. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| sObject | String | API name of the sObject. | +| attrs | Object | Field attributes for the new object. | + +**Example** +```js +update('obj_name', { + attr1: "foo", + attr2: "bar" +}) +``` + +* * * + +## upsert + +upsert(sObject, externalId, attrs) ⇒ Operation +Upsert an object. + +**Kind**: global function +**Access**: public +**Magic**: sObject - $.children[?(!@.meta.system)].name +**Magic**: externalId - $.children[?(@.name=="{{args.sObject}}")].children[?(@.meta.externalId)].name +**Magic**: attrs - $.children[?(@.name=="{{args.sObject}}")].children[?(!@.meta.externalId)] + +| Param | Type | Description | +| --- | --- | --- | +| sObject | String | API name of the sObject. | +| externalId | String | ID. | +| attrs | Object | Field attributes for the new object. | + +**Example** +```js +upsert('obj_name', 'ext_id', { + attr1: "foo", + attr2: "bar" +}) +``` + +* * * + +## upsertIf + +upsertIf(logical, sObject, externalId, attrs) ⇒ Operation +Upsert if conditions are met. + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| logical | boolean | a logical statement that will be evaluated. | +| sObject | String | API name of the sObject. | +| externalId | String | ID. | +| attrs | Object | Field attributes for the new object. | + +**Example** +```js +upsertIf(true, 'obj_name', 'ext_id', { + attr1: "foo", + attr2: "bar" +}) +``` + +* * * + diff --git a/docs/sftp/CHANGELOG.md b/docs/sftp/CHANGELOG.md new file mode 100644 index 000000000..cf4986151 --- /dev/null +++ b/docs/sftp/CHANGELOG.md @@ -0,0 +1,201 @@ +# @openfn/language-sftp + +## 1.0.2 + +### Patch Changes + +- a666a63: On error disconnect then throw + +## 1.0.1 + +### Patch Changes + +- 771c814: - Properly disconnect on error + - Improve operation logs + +## 1.0.0 + +### Major Changes + +- e52ba66: add `filter` option in `list()` function + +## 0.8.8 + +### Patch Changes + +- Updated dependencies [c19efbe] + - @openfn/language-common@1.11.1 + +## 0.8.7 + +### Patch Changes + +- Updated dependencies [85c35b8] + - @openfn/language-common@1.11.0 + +## 0.8.6 + +### Patch Changes + +- Updated dependencies [df09270] + - @openfn/language-common@1.10.3 + +## 0.8.5 + +### Patch Changes + +- Updated dependencies [26a303e] + - @openfn/language-common@1.10.2 + +## 0.8.4 + +### Patch Changes + +- Updated dependencies [8c32eb3] + - @openfn/language-common@1.10.1 + +## 0.8.3 + +### Patch Changes + +- Updated dependencies [aad9549] + - @openfn/language-common@1.10.0 + +## 0.8.2 + +### Patch Changes + +- d2c980e: Use `parseCsv` from language-common +- c5d3ce1: improve connection handling +- Updated dependencies [111807f] + - @openfn/language-common@1.9.0 + +## 0.8.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.8.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.7.3 + +### Patch Changes + +- 432dd0a: fix sftp connection wqautoclose + +## 0.7.2 + +### Patch Changes + +- 205b806: remove asObjects key before parsing + +## 0.7.1 + +### Patch Changes + +- 827c627: error handling + +## 0.7.0 + +### Minor Changes + +- fa58216: Add csvtojson convertion option + +## 0.6.9 + +### Patch Changes + +- Updated dependencies [929bca6] + - @openfn/language-common@1.7.7 + +## 0.6.8 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.6.7 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.6.6 + +### Patch Changes + +- f2aed32: add examples + +## 0.6.5 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 0.6.4 + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 0.6.3 + +### Patch Changes + +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- 4126a62: Fix built bundle +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 + +## 0.6.2 + +### Patch Changes + +- e04aa28: Rename credential-schema to configuration-schema, update descriptions + +## 0.6.1 + +### Patch Changes + +- 28dfbfa: add todo, fix build pack + +## 0.6.0 + +### Minor Changes + +- f294a62: Added credential-schema.json for new ui + +## 0.5.0 + +### Minor Changes + +- 2c04894: added sftp package diff --git a/docs/sftp/README.md b/docs/sftp/README.md new file mode 100644 index 000000000..03a537524 --- /dev/null +++ b/docs/sftp/README.md @@ -0,0 +1,170 @@ +# Language SFTP + +Language Pack for building expressions and operations to work with SFTP servers. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/sftp-configuration-schema/) +definition. + +## List the content of a directory + +```js +alterState(state => { + return list('/path/To/Directory')(state).then(response => { + console.log(`There are ${response.data.length} files.`); + return response; + }); +}); +``` + +## sample getCSV expression + +```js +getCSV('path/to/file.csv', 'utf8', { + quote: 'off', + delimiter: ';', + noheader: true, + filter: { + type: 'startsWith', + key: 'field1', + value: 'JO', + }, +}); +``` + +A more complex example that breaks up the CSV file into multiple payloads for +quicker processing. + +```js +fn(state => { + return list('/')(state).then(state => { + const targetNames = [ + 'exportContacts', //example fileName + ]; + console.log(`Fetching files: ${targetNames}`); + const files = state.data + .filter(file => file.name.split('.')[1] === 'csv') + .filter(file => + targetNames.some(targetName => + file.name.toLowerCase().includes(targetName) + ) + ); + + if (files.length === 0) console.log('No new CSV files found.'); + return { ...state, data: {}, files }; + }); +}); + +each( + '$.files[*]', + fn(state => { + const { configuration, data } = state; + + return getCSV(`/${data.name}`)(state).then(async state => { + const headers = state.data + .shift() + .split(';') + .map(h => (h = h.replace(/"/g, ''))); + + function toObject(item) { + const values = item.split(';'); + + return Object.fromEntries( + headers.map((k, i) => { + return values[i] + ? [k, values[i].replace(/"/g, '')] + : [k, values[i]]; + }) + ); + } + + let countInbox = 0; + + //to post CSV data as individual Messages to OpenFn Inbox + const postToInbox = async data => { + countInbox++; + + console.log(`Sending request ${countInbox} to inbox`); + + await new Promise(resolve => setTimeout(resolve, 200)); + + await http.post({ + url: configuration.openfnInboxUrl, + data: data, + maxContentLength: Infinity, + maxBodyLength: Infinity, + })(state); + }; + + //To split up into multiple, smaller payloads before send to OpenFn Inbox + const chunkSize = 500; + + console.log( + state.data.length, + 'rows will be sent in', + Math.ceil(state.data.length / chunkSize), + 'requests of', + chunkSize, + 'rows each.' + ); + + while (state.data.length > 0) { + console.log('data.length', state.data.length); + await postToInbox({ + fileName: data.name, + fileType: data.name.split('-')[0], + uploadDate: new Date(data.modifyTime).toISOString(), + json: state.data.splice(0, chunkSize).map(toObject), + }); + } + + return { configuration, references: [], data: {} }; + }); + }) +); +``` + +## sample putCSV expression + +This function converts JSON to CSV and post to a server + +```js +putCSV('/some/path/to_file.csv', 'utf8', { delimiter: ';', noheader: true }); +``` + +### Get JSON from FTP server + +```js +getJSON('path/to/file.json', 'utf8'); +``` + +### Custom request to an http endpoint + +This adaptor exports `http` from `language-common`. Here, we outline the usage +in order to make custom requests to an endpoint. It returns a promise + +```js +alterState(state => { + return http + .post({ url: 'yourURL', data: { name: 'Mamadou' } })(state) + .then(response => { + // do something with response; + return response; + }); +}); +``` + +## Development + +Clone the repo, run `pnpm install`. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To build the docs for this repo, `pnpm build docs` diff --git a/docs/sftp/index.md b/docs/sftp/index.md new file mode 100644 index 000000000..37a07a0e5 --- /dev/null +++ b/docs/sftp/index.md @@ -0,0 +1,147 @@ +## Functions + +
+
+ getCSV(filePath, [parsingOptions])
+
+ getJSON(filePath, encoding)
+
+ list(dirPath, filter, [callback])
+
+ normalizeCSVarray(options, callback)
+
+ putCSV(localFilePath, remoteFilePath, parsingOptions)
+
+ + +## getCSV + +getCSV(filePath, [parsingOptions]) ⇒ Operation +Get a CSV and return a JSON array of strings for each item separated by the delimiter + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| filePath | string | Path to resource | +| [parsingOptions] | Object | Optional. `parsingOptions` Parsing options which can be passed to convert csv to json See more [on csvtojson docs](https://github.com/Keyang/node-csvtojson#parameters) | + +**Example** +```js +getCSV( + '/some/path/to_file.csv', + {delimiter: ";", flatKeys: true } +); +``` + +* * * + +## getJSON + +getJSON(filePath, encoding) ⇒ Operation +Fetch a json file from an FTP server + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| filePath | string | Path to resource | +| encoding | string | Character encoding for the json | + +**Example** +```js +getJSON( + '/path/To/File', + 'utf8', +); +``` + +* * * + +## list + +list(dirPath, filter, [callback]) ⇒ Operation +List files present in a directory + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| dirPath | string | Path to remote directory | +| filter | function | a filter function used to select return entries | +| [callback] | function | Optional callback to handle the response | + +**Example** *(basic files listing)* +```js +list('/some/path/') +``` +**Example** *(list files with filters)* +```js +list('/some/path/', file=> { + return /foo.\.txt/.test(file.name); +}) +``` +**Example** *(list files with filters and use callback)* +```js +list( + "/some/path/", + (file) => /foo.\.txt/.test(file.name), + (state) => { + const latestFile = state.data.filter( + (file) => file.modifyTime <= new Date() + ); + return { ...state, latestFile }; + } +); +``` + +* * * + +## normalizeCSVarray + +normalizeCSVarray(options, callback) ⇒ Operation +Convert JSON array of strings into a normalized object + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| options | options | Options passed to csvtojson parser | +| callback | callback | Options passed to csvtojson parser | + +**Example** +```js +normalizeCSVarray({ delimiter: ';', noheader: true }); +``` + +* * * + +## putCSV + +putCSV(localFilePath, remoteFilePath, parsingOptions) ⇒ Operation +Convert JSON to CSV and upload to an FTP server + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| localFilePath | string | Data source for data to copy to the remote server. | +| remoteFilePath | string | Path to the remote file to be created on the server. | +| parsingOptions | object | Options which can be passed to adjust the read and write stream used in sending the data to the remote server | + +**Example** +```js +putCSV( + '/some/path/to_local_file.csv', + '/some/path/to_remove_file.csv', + { delimiter: ';', noheader: true } +); +``` + +* * * + diff --git a/docs/smpp/CHANGELOG.md b/docs/smpp/CHANGELOG.md new file mode 100644 index 000000000..0c83adf1e --- /dev/null +++ b/docs/smpp/CHANGELOG.md @@ -0,0 +1,54 @@ +# @openfn/language-smpp + +## 1.3.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 1.3.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 1.2.3 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 1.2.2 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 1.2.1 + +### Patch Changes + +- f2aed32: add examples + +## 1.2.0 + +### Minor Changes + +- 3aedd05: migrate smpp diff --git a/docs/smpp/README.md b/docs/smpp/README.md new file mode 100644 index 000000000..13a89fe99 --- /dev/null +++ b/docs/smpp/README.md @@ -0,0 +1,35 @@ +# Language SMPP + +Language Pack for building expressions and operations to make calls to an OpenFn +SMPP client API. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/smpp-configuration-schema/) +definition. + +#### sample send expression + +```js +send({ + text: dataValue('text'), + smsId: dataValue('messageId'), + recipient: dataValue('to'), + sender: dataValue('from'), +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/smpp/index.md b/docs/smpp/index.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/surveycto/CHANGELOG.md b/docs/surveycto/CHANGELOG.md new file mode 100644 index 000000000..68a8c91cd --- /dev/null +++ b/docs/surveycto/CHANGELOG.md @@ -0,0 +1,65 @@ +# @openfn/language-surveycto + +## 1.2.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 1.2.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 1.1.4 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 1.1.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 1.1.2 + +### Patch Changes + +- f2aed32: add examples + +## 1.1.1 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 1.1.0 + +### Minor Changes + +- 776bb13: migrate surveycto + +### Patch Changes + +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 diff --git a/docs/surveycto/README.md b/docs/surveycto/README.md new file mode 100644 index 000000000..56f1285b5 --- /dev/null +++ b/docs/surveycto/README.md @@ -0,0 +1,49 @@ +# Language SurveyCTO + +Language Pack for building expressions and operations to make HTTP calls to +SurveyCTO. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/surveycto-configuration-schema/) +definition. + +## fetchSubmissions + +`fetchSubmissions(1,2,3)` takes three arguments: + +1. the `formId` of the form on SurveyCTO + +2. the `initialAfterDate`, a date string or UNIX timestamp which instructs the + job to only fetch submissions after a certain date. After the first run of + the job, subsequent runs will only fetch _NEW_ submissions. + +3. the `postUrl` is where the wide-format JSON representation of each form + submission should be sent. Note that a `formId` key will be added to each + form submission for later filtering/routing. + +### sample `fetchSubmissions` expression + +```js +fetchSubmissions( + // formId on SurveyCTO server + 'household_survey', + // initialAfterDate: this will only be accessed if "lastSubmissionDate" is empty in your job_state". + // After the initial run of the job, OpenFn will only pull new submissions from SurveyCTO. + 'Aug 29, 2016 4:44:26 PM', + // postUrl is where you want to send the JSON submissions, appended with a new "formId" key + 'https://www.openfn.org/inbox/secret-inbox-uuid' +); +``` + +## Development + +Clone the repo, run `npm install`. + +Run tests using `npm run test` or `npm run test:watch` + +Build the project using `make`. diff --git a/docs/surveycto/index.md b/docs/surveycto/index.md new file mode 100644 index 000000000..656cb9eec --- /dev/null +++ b/docs/surveycto/index.md @@ -0,0 +1,20 @@ +## fetchSubmissions + +fetchSubmissions(params) ⇒ Operation +Make a GET request and POST it somewhere else + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| params | object | data to make the fetch | + +**Example** +```js +execute( + fetch(params) +)(state) +``` + +* * * + diff --git a/docs/telerivet/CHANGELOG.md b/docs/telerivet/CHANGELOG.md new file mode 100644 index 000000000..6faf06a5d --- /dev/null +++ b/docs/telerivet/CHANGELOG.md @@ -0,0 +1,65 @@ +# @openfn/language-telerivet + +## 0.2.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.2.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.1.4 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.1.3 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.1.2 + +### Patch Changes + +- f2aed32: add examples + +## 0.1.1 + +### Patch Changes + +- e4ebcb6: Fix Large gzip Denial of Service in superagent + +## 0.1.0 + +### Minor Changes + +- 83ede44: migrate telerivet + +### Patch Changes + +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 diff --git a/docs/telerivet/README.md b/docs/telerivet/README.md new file mode 100644 index 000000000..bbdc2caf3 --- /dev/null +++ b/docs/telerivet/README.md @@ -0,0 +1,70 @@ +# Language Telerivet + +Language Pack for sending messages using the +[telerivet API](https://telerivet.com/api/rest/curl). + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/telerivet-configuration-schema/) +definition. + +## Send message + +#### Current `send` expression: + +```js +send( + fields( + field('to_number', dataValue('recipient_number')), + field('content', dataValue('recipient_text')), + // Lots of optional parameters... + field('message_type', 'sms'), + field('route_id', dataValue('some_route')) + ) +); +``` + +## sendBulk messages - WIP + +#### Current `sendBulk` expression: + +```js +send(fields( + field("content", dataValue("recipient_text")), + field("to_numbers", [ + "+14155550123", + "+14255550234", + "+16505550345" + ] + // Lots of optional parameters... + field("message_type", "sms"), + field("route_id", dataValue("some_route")) +)) +``` + +Note that "recipient_text" may be a concatenation like this: + +```js +field('content', function (state) { + return dataValue('salutation')(state).concat( + '. ', + dataValue('last_name')(state), + ', )' + ); +}); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/telerivet/index.md b/docs/telerivet/index.md new file mode 100644 index 000000000..4e65a725a --- /dev/null +++ b/docs/telerivet/index.md @@ -0,0 +1,20 @@ +## send + +send(sendData) ⇒ Operation +Send a message + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| sendData | object | Payload data for the message | + +**Example** +```js +execute( + send(data) +)(state) +``` + +* * * + diff --git a/docs/template/CHANGELOG.md b/docs/template/CHANGELOG.md new file mode 100644 index 000000000..086b896d0 --- /dev/null +++ b/docs/template/CHANGELOG.md @@ -0,0 +1,104 @@ +# @openfn/language-template + +## 3.0.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 3.0.0 + +### Major Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 2.0.0 + +### Major Changes + +- 779596f: Use native fetch (undici) in template and add icons in openfn + +### Minor Changes + +- 1af9cd5: Better docs and resource names + +## 1.7.8 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 1.7.7 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 1.7.6 + +### Patch Changes + +- f2aed32: add examples + +## 1.7.5 + +### Patch Changes + +- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ + +## 1.7.4 + +### Patch Changes + +- f2a91a4: Update package exports +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 + +## 1.7.3 + +### Patch Changes + +- 8566b26: Fix typings +- b3d45ff: Fix CJS export of npm package. +- b5eb665: Adjusted docs for common and built to markdown +- ecf5d30: remove sinon since it was not being used +- Updated dependencies [8566b26] +- Updated dependencies [b3d45ff] +- Updated dependencies [b5eb665] +- Updated dependencies [ecf5d30] + - @openfn/language-common@1.7.4 + +## 1.7.2 + +### Patch Changes + +- f4b3dd6: remove travis build url + +## 1.7.1 + +### Patch Changes + +- Fixed package.json for template adaptor + +## 1.7.0 + +### Minor Changes + +- 554e905: Migrated to monorepo diff --git a/docs/template/README.md b/docs/template/README.md new file mode 100644 index 000000000..325b655ea --- /dev/null +++ b/docs/template/README.md @@ -0,0 +1,32 @@ +# language-template + +An OpenFn **_adaptor_** for building integration jobs for use with the \_\_\_\_ +API. + +## Documentation + +View the [docs site](https://docs.openfn.org/adaptors/packages/template-docs) +for full technical documentation. + +### Configuration + +View the +[configuration-schema](https://docs.openfn.org/adaptors/packages/template-configuration-schema/) +for required and optional `configuration` properties. + +### A example expression using the `create` function + +```js +create('patient', { name: 'Bukayo' }); +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +"Getting Started" guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To build _only_ the docs run `pnpm build docs`. diff --git a/docs/template/index.md b/docs/template/index.md new file mode 100644 index 000000000..4b0df871a --- /dev/null +++ b/docs/template/index.md @@ -0,0 +1,21 @@ +## create + +create(resource, data, callback) ⇒ Operation +Create some resource in some system + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| resource | string | The type of entity that will be created | +| data | object | The data to create the new resource | +| callback | function | An optional callback function | + +**Example** +```js +create("patient", {"name": "Bukayo"}) +``` + +* * * + diff --git a/docs/tutorial/index.md b/docs/tutorial/index.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/twilio/CHANGELOG.md b/docs/twilio/CHANGELOG.md new file mode 100644 index 000000000..fcbd7b7a5 --- /dev/null +++ b/docs/twilio/CHANGELOG.md @@ -0,0 +1,65 @@ +# @openfn/language-twilio + +## 0.4.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.4.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.3.4 + +### Patch Changes + +- a22daa6: rename credential-schema to configuration-schemawq + +## 0.3.3 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.3.2 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.3.1 + +### Patch Changes + +- f2aed32: add examples + +## 0.3.0 + +### Minor Changes + +- a36a072: ymigrated twilio to monorepo + +### Patch Changes + +- Updated dependencies [f2a91a4] + - @openfn/language-common@1.7.5 diff --git a/docs/twilio/README.md b/docs/twilio/README.md new file mode 100644 index 000000000..1c11e9555 --- /dev/null +++ b/docs/twilio/README.md @@ -0,0 +1,46 @@ +# Language twilio + +Language Pack for building expressions and operations to interact with the +twilio API. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/twilio-configuration-schema/) +definition. + +### sendSMS + +#### sample expression, sending an sms + +```js +sendSMS({ + body: dataValue('text'), + from: '+15005550006', + to: dataValue('recipient'), +}); +``` + +## local usage + +```sh +~/devtools/core/bin/core execute \ + -l ~/devtools/adaptors/language-twilio \ + -s ./tmp/state.json \ + -o ./tmp/output.json \ + -e ./tmp/expression.js +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/twilio/index.md b/docs/twilio/index.md new file mode 100644 index 000000000..875acd9a8 --- /dev/null +++ b/docs/twilio/index.md @@ -0,0 +1,23 @@ +## sendSMS + +sendSMS(params) ⇒ Operation +Sends an SMS message to a specific phone number + +**Kind**: global function +**Access**: public + +| Param | Type | Description | +| --- | --- | --- | +| params | Object | an object containing 'body', 'from', and 'to' keys. | + +**Example** +```js +sendSMS({ + body: dataValue('sampleText'), + from: dataValue('myFromNumber'), + to: dataValue('ukMobile'), +}); +``` + +* * * + diff --git a/docs/vtiger/CHANGELOG.md b/docs/vtiger/CHANGELOG.md new file mode 100644 index 000000000..662a222f9 --- /dev/null +++ b/docs/vtiger/CHANGELOG.md @@ -0,0 +1,54 @@ +# @openfn/language-vtiger + +## 1.2.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 1.2.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 1.1.3 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 1.1.2 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 1.1.1 + +### Patch Changes + +- f2aed32: add examples + +## 1.1.0 + +### Minor Changes + +- b4a13ff: migrate vtiger diff --git a/docs/vtiger/README.md b/docs/vtiger/README.md new file mode 100644 index 000000000..bf9111ce7 --- /dev/null +++ b/docs/vtiger/README.md @@ -0,0 +1,46 @@ +# Language Vtiger + +Language Pack for building expressions and operations to make calls to the +Vtiger API. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/vtiger-configuration-schema/) +definition. + +#### sample listTypes expression + +```js +listTypes(); +``` + +#### sample postElement expression + +```js +postElement({ + operation: "create" + elementType: "leads", + element: { + "name": dataValue("name")(state), + "surname": dataValue("surname")(state), + "email": dataValue("email")(state) + } +}); + + +``` + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/vtiger/index.md b/docs/vtiger/index.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/zoho/CHANGELOG.md b/docs/zoho/CHANGELOG.md new file mode 100644 index 000000000..e9805097b --- /dev/null +++ b/docs/zoho/CHANGELOG.md @@ -0,0 +1,58 @@ +# @openfn/language-zoho + +## 0.3.1 + +### Patch Changes + +- Update lock files +- Updated dependencies + - @openfn/language-common@1.8.1 + +## 0.3.0 + +### Minor Changes + +- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an + `each` block; add eslint + + The packages receiving a major bump here exposed functions that didn't work as + expected inside `each` blocks. Users were previously wrapping these functions + inside their own custom `fn` blocks, and this change will ensure that they can + be used inside a standard each. + + See https://github.com/OpenFn/adaptors/issues/275 for more details. + +### Patch Changes + +- Updated dependencies [2c1d603] + - @openfn/language-common@1.8.0 + +## 0.2.3 + +### Patch Changes + +- 14f481e: mark execute as private +- Updated dependencies [2b4c61a] + - @openfn/language-common@1.7.6 + +## 0.2.2 + +### Patch Changes + +- f7ebd3c: remove sample configuration + +## 0.2.1 + +### Patch Changes + +- f2aed32: add examples + +## 0.2.0 + +### Minor Changes + +- f9ac74a: migrate zoho + +### Patch Changes + +- e4ebcb6: Fix Large gzip Denial of Service in superagent diff --git a/docs/zoho/README.md b/docs/zoho/README.md new file mode 100644 index 000000000..762213033 --- /dev/null +++ b/docs/zoho/README.md @@ -0,0 +1,41 @@ +# Language Zoho + +Language Pack for sending messages using the Zoho API. + +## Documentation + +### Configuration + +View all the required and optional properties for `state.configuration` in the +official +[configuration-schema](https://docs.openfn.org/adaptors/packages/zoho-configuration-schema/) +definition. + +### addRow + +To add a row to the "Customers" table in the "testing_openfn" database, use the +following `addRow` function. + +```js +addRow( + 'testing_openfn', + 'Customers', + fields(field('Subject', dataValue('formId')), field('Status', 'Closed')) +); +``` + +### updateRow + +Coming soon. Want to help? +https://zohoreportsapi.wiki.zoho.com/Updating-Data.html + +## Development + +Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the +`Getting Started` guide inside to get set up. + +Run tests using `pnpm run test` or `pnpm run test:watch` + +Build the project using `pnpm build`. + +To just build the docs run `pnpm build docs` diff --git a/docs/zoho/index.md b/docs/zoho/index.md new file mode 100644 index 000000000..dc2a71501 --- /dev/null +++ b/docs/zoho/index.md @@ -0,0 +1,24 @@ +## addRow + +addRow(db, table, rowData) ⇒ Operation +To add a row data to a database table + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| db | string | Database | +| table | string | Database table | +| rowData | object | row data to be added into the database | + +**Example** +```js +addRow( +'testing_openfn', +'Customers', +fields(field('Subject', dataValue('formId')), field('Status', 'Closed')) +); +``` + +* * * + diff --git a/packages/http/ast.json b/packages/http/ast.json index 9207c89d9..7b0a15df0 100644 --- a/packages/http/ast.json +++ b/packages/http/ast.json @@ -38,7 +38,7 @@ "description": "Query, Headers and Authentication parameters", "type": { "type": "NameExpression", - "name": "object" + "name": "RequestOptions" }, "name": "params" }, @@ -101,7 +101,7 @@ "description": "Body, Query, Headers and Authentication parameters", "type": { "type": "NameExpression", - "name": "object" + "name": "RequestOptions" }, "name": "params" }, @@ -164,7 +164,7 @@ "description": "Body, Query, Headers and Auth parameters", "type": { "type": "NameExpression", - "name": "object" + "name": "RequestOptions" }, "name": "params" }, @@ -227,7 +227,7 @@ "description": "Body, Query, Headers and Auth parameters", "type": { "type": "NameExpression", - "name": "object" + "name": "RequestOptions" }, "name": "params" }, @@ -290,7 +290,7 @@ "description": "Body, Query, Headers and Auth parameters", "type": { "type": "NameExpression", - "name": "object" + "name": "RequestOptions" }, "name": "params" }, diff --git a/tools/build/src/commands/docs.ts b/tools/build/src/commands/docs.ts index d0704717a..635fdc432 100644 --- a/tools/build/src/commands/docs.ts +++ b/tools/build/src/commands/docs.ts @@ -1,6 +1,7 @@ import jsdoc2md from 'jsdoc-to-markdown'; import fs from 'node:fs/promises'; import { existsSync } from 'node:fs'; +import path from 'node:path'; import { writeFile, mkdir } from 'node:fs/promises'; import resolvePath from '../util/resolve-path'; @@ -33,8 +34,10 @@ export default async (lang: string) => { return 0; }); + const helper = path.resolve('../../tools/build/src/util/hbs-helpers.js'); const renderOpts = { template: `${template}`, + helper, data: templateData, separators: true, 'name-format': false, diff --git a/tools/build/src/util/docs-template.hbs b/tools/build/src/util/docs-template.hbs index 8199fcccc..82c4c8b83 100644 --- a/tools/build/src/util/docs-template.hbs +++ b/tools/build/src/util/docs-template.hbs @@ -7,7 +7,7 @@ {{/if~}}
{{#if name}}{{#sig no-gfm=true ~}} - + {{~{@codeOpen}~}} {{#if @prefix}}{{@prefix}} {{/if~}} {{@accessSymbol}}{{#if (isEvent)}}"{{{name}}}"{{else}}{{{name}}}{{/if~}} @@ -22,7 +22,7 @@ {{/if~}} {{/globals~}} -{{>global-index-kinds kind="typedef" title="Typedefs" ~}} +{{!-- {{>global-index-kinds kind="typedef" title="Typedefs" ~}} --}} {{/if~}} {{#orphans ~}} diff --git a/tools/build/src/util/hbs-helpers.js b/tools/build/src/util/hbs-helpers.js new file mode 100644 index 000000000..256e8d9a0 --- /dev/null +++ b/tools/build/src/util/hbs-helpers.js @@ -0,0 +1,3 @@ +exports.toLowerCase = function (str) { + return str ? str.toLowerCase() : str; +}; From 69e038afe3870320baa3d20816977bbd10c5e26a Mon Sep 17 00:00:00 2001 From: Joe Clark Date: Fri, 12 Jan 2024 13:13:21 +0000 Subject: [PATCH 2/6] docs: improve markdown templates --- tools/build/src/commands/docs.ts | 5 ++++ tools/build/src/partials/body.hbs | 29 ++++++++++++++++++++++++ tools/build/src/partials/description.hbs | 5 ++++ tools/build/src/partials/link.hbs | 26 +++++++++++++++++++++ tools/build/src/util/docs-template.hbs | 2 +- 5 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tools/build/src/partials/body.hbs create mode 100644 tools/build/src/partials/description.hbs create mode 100644 tools/build/src/partials/link.hbs diff --git a/tools/build/src/commands/docs.ts b/tools/build/src/commands/docs.ts index 635fdc432..2c7e665ac 100644 --- a/tools/build/src/commands/docs.ts +++ b/tools/build/src/commands/docs.ts @@ -39,6 +39,11 @@ export default async (lang: string) => { template: `${template}`, helper, data: templateData, + partial: [ + path.resolve('../../tools/build/src/partials/body.hbs'), + path.resolve('../../tools/build/src/partials/description.hbs'), + path.resolve('../../tools/build/src/partials/link.hbs'), + ], separators: true, 'name-format': false, 'no-gfm': false, diff --git a/tools/build/src/partials/body.hbs b/tools/build/src/partials/body.hbs new file mode 100644 index 000000000..bff52d1c7 --- /dev/null +++ b/tools/build/src/partials/body.hbs @@ -0,0 +1,29 @@ +{{>deprecated~}} +{{>description~}} +{{!-- {{>scope~}} --}} +{{>summary~}} +{{>augments~}} +{{>implements~}} +{{>mixes~}} +{{>default~}} +{{>chainable~}} +{{>overrides~}} +{{>returns~}} +{{>category~}} +{{>throws~}} +{{>fires~}} +{{>this~}} +{{!-- {{>access~}} --}} +{{>readOnly~}} +{{>requires~}} +{{>customTags~}} +{{>see~}} +{{>since~}} +{{>version~}} +{{>authors~}} +{{>license~}} +{{>copyright~}} +{{>todo~}} +{{>params~}} +{{>properties~}} +{{>examples~}} \ No newline at end of file diff --git a/tools/build/src/partials/description.hbs b/tools/build/src/partials/description.hbs new file mode 100644 index 000000000..870f0a617 --- /dev/null +++ b/tools/build/src/partials/description.hbs @@ -0,0 +1,5 @@ +{{#if description}} + +{{{inlineLinks description}}} + +{{/if}} \ No newline at end of file diff --git a/tools/build/src/partials/link.hbs b/tools/build/src/partials/link.hbs new file mode 100644 index 000000000..b186f7fbf --- /dev/null +++ b/tools/build/src/partials/link.hbs @@ -0,0 +1,26 @@ +{{! usage: link to="namepath" html=true/false caption="optional caption"~}} + +{{~#if html~}} + + +{{~#link to~}} +{{#if url~}} +{{#if ../../caption}}{{../../../caption}}{{else}}{{name}}{{/if}} +{{~else~}} +{{#if ../../caption}}{{../../../caption}}{{else}}{{name}}{{/if~}} +{{/if~}} +{{/link~}} + + +{{~else~}} + +{{#link to~}} +{{#if url~}} +{{! lowercase the url}} +[{{#if ../../caption}}{{escape ../../../caption}}{{else}}{{escape name}}{{/if}}]({{toLowerCase url}}) +{{~else~}} +{{#if ../../caption}}{{escape ../../../caption}}{{else}}{{escape name}}{{/if~}} +{{~/if~}} +{{/link~}} + +{{/if~}} \ No newline at end of file diff --git a/tools/build/src/util/docs-template.hbs b/tools/build/src/util/docs-template.hbs index 82c4c8b83..d1dc4cf5b 100644 --- a/tools/build/src/util/docs-template.hbs +++ b/tools/build/src/util/docs-template.hbs @@ -7,7 +7,7 @@ {{/if~}}
{{#if name}}{{#sig no-gfm=true ~}} - + {{~{@codeOpen}~}} {{#if @prefix}}{{@prefix}} {{/if~}} {{@accessSymbol}}{{#if (isEvent)}}"{{{name}}}"{{else}}{{{name}}}{{/if~}} From cd5a2788c0381e8d83000ba99d62c02032009b3c Mon Sep 17 00:00:00 2001 From: Joe Clark Date: Fri, 12 Jan 2024 14:34:24 +0000 Subject: [PATCH 3/6] tools: update docs --- README.md | 19 +++++++++++++++++++ tools/build/src/commands/docs.ts | 1 + 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 356eb14e4..20cb9afdd 100644 --- a/README.md +++ b/README.md @@ -291,6 +291,25 @@ Examples: pnpm -C packages/salesforce build --watch ``` +### Docs + +Docs are generated from the JSDoc annotations in adaptors. They are output as +markdown files in the `./docs` directly and not checked in to source control. + +The markdown output can be customised by overriding the built-in handlebars +templates in jsoc2md. + +- Find the template you want to customise in [j2sdoc2md source() + https://github.com/jsdoc2md/dmd/tree/master/partials) (this can be tricky) +- Copy the template contents +- Paste into a file with the same name (this is important) in + `tools/build/src/partials` +- Edit `tools/build/src/commands/docs.ts` and add the path to your new template + to jsdoc2md's `renderOpts` (see how the other .hbs files are loaded in) +- Make your changes +- Run `pnpm build docs` from root (or just one adaptor folder) and inspect the + generated `docs/index/md` file. + ## Metadata Check the Wiki for the metadata creation guide: diff --git a/tools/build/src/commands/docs.ts b/tools/build/src/commands/docs.ts index 2c7e665ac..67551b8a2 100644 --- a/tools/build/src/commands/docs.ts +++ b/tools/build/src/commands/docs.ts @@ -40,6 +40,7 @@ export default async (lang: string) => { helper, data: templateData, partial: [ + // TODO we should be able to automate this path.resolve('../../tools/build/src/partials/body.hbs'), path.resolve('../../tools/build/src/partials/description.hbs'), path.resolve('../../tools/build/src/partials/link.hbs'), From 64debfec7e65a73b97f20ec5682d4ce75012e970 Mon Sep 17 00:00:00 2001 From: Joe Clark Date: Fri, 12 Jan 2024 14:39:06 +0000 Subject: [PATCH 4/6] Update http docs --- packages/http/src/Adaptor.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/http/src/Adaptor.js b/packages/http/src/Adaptor.js index 629b72636..3190b78b8 100644 --- a/packages/http/src/Adaptor.js +++ b/packages/http/src/Adaptor.js @@ -10,11 +10,12 @@ import { request as sendRequest } from './Utils'; /** * Options provided to the HTTP request * @typedef {Object} RequestOptions - * @property {object|string} body - body data to append to the request - * @property {object} errors - Map of errorCodes -> error messages, ie, `{ 404: 'Resource not found;' }`. Use a falsy message value to suppress errors for thiscode. - * @property {object} query - an object of query parameters. Will be encoded into the URL. - * @property {object} headers - an object of headers to append to the request - * @property {string} parseAs - parse the response body as json, text or stream. By default will use the response headers. + * @property {object|string} body - body data to append to the request. JSON will be converted to a string (but a content-type header will not be attached to the request). + * @property {object} errors - Map of errorCodes -> error messages, ie, `{ 404: 'Resource not found;' }`. Pass `false` to suppress errors for this code. + * @property {object} form - Pass a JSON object to be serialised into a multipart HTML form (as FormData) in the body. + * @property {object} query - An object of query parameters to be encoded into the URL. + * @property {object} headers - An object of headers to append to the request. + * @property {string} parseAs - Parse the response body as json, text or stream. By default will use the response headers. * @property {number} timeout - Request timeout in ms. Default: 300 seconds. * @property {object} tls - TLS/SSL authentication options. See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions */ From 7094b2ef8621d33ae6539feb25e78d02a298ffd9 Mon Sep 17 00:00:00 2001 From: Joe Clark Date: Fri, 12 Jan 2024 14:40:07 +0000 Subject: [PATCH 5/6] http: update request example --- packages/http/src/Adaptor.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/http/src/Adaptor.js b/packages/http/src/Adaptor.js index 3190b78b8..8ef6fe36b 100644 --- a/packages/http/src/Adaptor.js +++ b/packages/http/src/Adaptor.js @@ -47,10 +47,14 @@ export function execute(...operations) { * Make a HTTP request * @public * @example - * get('/myEndpoint', { - * query: {foo: 'bar', a: 1}, - * headers: {'content-type': 'application/json'}, - * }) + * request( + * 'GET', + * '/myEndpoint', + * { + * query: {foo: 'bar', a: 1}, + * headers: {'content-type': 'application/json'}, + * } + * ) * @function * @param {string} method - The HTTP method to use * @param {string} path - Path to resource From 5134a1f051b7341854bb4fb8411d661e3effe95d Mon Sep 17 00:00:00 2001 From: Joe Clark Date: Fri, 12 Jan 2024 14:49:55 +0000 Subject: [PATCH 6/6] remove build artefacts --- .github/workflows/docs-local.sh | 35 - docs/asana/CHANGELOG.md | 85 -- docs/asana/README.md | 90 -- docs/asana/index.md | 143 --- docs/azure-storage/CHANGELOG.md | 11 - docs/azure-storage/README.md | 84 -- docs/azure-storage/index.md | 77 -- docs/beyonic/CHANGELOG.md | 103 --- docs/beyonic/README.md | 74 -- docs/beyonic/index.md | 72 -- docs/bigquery/CHANGELOG.md | 126 --- docs/bigquery/README.md | 62 -- docs/bigquery/index.md | 36 - docs/cartodb/CHANGELOG.md | 64 -- docs/cartodb/README.md | 54 -- docs/commcare/CHANGELOG.md | 169 ---- docs/commcare/README.md | 178 ---- docs/commcare/index.md | 112 --- docs/common/CHANGELOG.md | 152 ---- docs/common/README.md | 14 - docs/common/index.md | 941 -------------------- docs/dhis2/CHANGELOG.md | 149 ---- docs/dhis2/README.md | 113 --- docs/dhis2/index.md | 585 ------------ docs/docs.json | 50 -- docs/dynamics/CHANGELOG.md | 122 --- docs/dynamics/README.md | 93 -- docs/dynamics/index.md | 0 docs/facebook/CHANGELOG.md | 63 -- docs/facebook/README.md | 39 - docs/facebook/index.md | 26 - docs/fhir/CHANGELOG.md | 97 -- docs/fhir/README.md | 44 - docs/fhir/index.md | 138 --- docs/godata/CHANGELOG.md | 73 -- docs/godata/README.md | 262 ------ docs/godata/index.md | 393 -------- docs/googlehealthcare/CHANGELOG.md | 27 - docs/googlehealthcare/README.md | 27 - docs/googlehealthcare/index.md | 62 -- docs/googlesheets/CHANGELOG.md | 91 -- docs/googlesheets/README.md | 40 - docs/googlesheets/index.md | 27 - docs/hive/CHANGELOG.md | 7 - docs/hive/README.md | 31 - docs/hive/index.md | 21 - docs/http/CHANGELOG.md | 202 ----- docs/http/README.md | 138 --- docs/http/index.md | 207 ----- docs/khanacademy/CHANGELOG.md | 60 -- docs/khanacademy/README.md | 37 - docs/khanacademy/index.md | 20 - docs/kobotoolbox/CHANGELOG.md | 95 -- docs/kobotoolbox/README.md | 47 - docs/kobotoolbox/index.md | 79 -- docs/magpi/CHANGELOG.md | 70 -- docs/magpi/README.md | 70 -- docs/magpi/index.md | 52 -- docs/mailchimp/CHANGELOG.md | 114 --- docs/mailchimp/README.md | 24 - docs/mailchimp/index.md | 316 ------- docs/mailgun/CHANGELOG.md | 72 -- docs/mailgun/README.md | 39 - docs/mailgun/index.md | 28 - docs/maximo/CHANGELOG.md | 66 -- docs/maximo/README.md | 81 -- docs/maximo/index.md | 77 -- docs/medicmobile/CHANGELOG.md | 65 -- docs/medicmobile/README.md | 61 -- docs/medicmobile/index.md | 76 -- docs/mogli/CHANGELOG.md | 70 -- docs/mogli/README.md | 47 - docs/mogli/connecting_with_sms_providers.md | 24 - docs/mogli/connecting_with_telcos.md | 24 - docs/mogli/index.md | 70 -- docs/mongodb/CHANGELOG.md | 49 - docs/mongodb/README.md | 51 -- docs/mongodb/index.md | 144 --- docs/msgraph/CHANGELOG.md | 86 -- docs/msgraph/README.md | 26 - docs/msgraph/index.md | 231 ----- docs/mssql/CHANGELOG.md | 164 ---- docs/mssql/README.md | 241 ----- docs/mssql/index.md | 341 ------- docs/mysql/CHANGELOG.md | 117 --- docs/mysql/README.md | 111 --- docs/mysql/index.md | 128 --- docs/nexmo/CHANGELOG.md | 82 -- docs/nexmo/README.md | 32 - docs/nexmo/index.md | 21 - docs/ocl/CHANGELOG.md | 155 ---- docs/ocl/README.md | 34 - docs/ocl/index.md | 76 -- docs/openfn/CHANGELOG.md | 122 --- docs/openfn/README.md | 50 -- docs/openfn/index.md | 20 - docs/openhim/CHANGELOG.md | 65 -- docs/openhim/README.md | 157 ---- docs/openhim/index.md | 20 - docs/openmrs/CHANGELOG.md | 162 ---- docs/openmrs/README.md | 110 --- docs/openmrs/index.md | 353 -------- docs/openspp/CHANGELOG.md | 40 - docs/openspp/README.md | 32 - docs/openspp/index.md | 484 ---------- docs/postgresql/CHANGELOG.md | 141 --- docs/postgresql/README.md | 208 ----- docs/postgresql/index.md | 315 ------- docs/primero/CHANGELOG.md | 164 ---- docs/primero/README.md | 41 - docs/primero/index.md | 406 --------- docs/progres/CHANGELOG.md | 122 --- docs/progres/README.md | 53 -- docs/progres/index.md | 30 - docs/rapidpro/CHANGELOG.md | 128 --- docs/rapidpro/README.md | 83 -- docs/rapidpro/index.md | 110 --- docs/resourcemap/CHANGELOG.md | 54 -- docs/resourcemap/README.md | 48 - docs/resourcemap/index.md | 20 - docs/salesforce/CHANGELOG.md | 214 ----- docs/salesforce/README.md | 82 -- docs/salesforce/index.md | 478 ---------- docs/sftp/CHANGELOG.md | 201 ----- docs/sftp/README.md | 170 ---- docs/sftp/index.md | 147 --- docs/smpp/CHANGELOG.md | 54 -- docs/smpp/README.md | 35 - docs/smpp/index.md | 0 docs/surveycto/CHANGELOG.md | 65 -- docs/surveycto/README.md | 49 - docs/surveycto/index.md | 20 - docs/telerivet/CHANGELOG.md | 65 -- docs/telerivet/README.md | 70 -- docs/telerivet/index.md | 20 - docs/template/CHANGELOG.md | 104 --- docs/template/README.md | 32 - docs/template/index.md | 21 - docs/tutorial/index.md | 0 docs/twilio/CHANGELOG.md | 65 -- docs/twilio/README.md | 46 - docs/twilio/index.md | 23 - docs/vtiger/CHANGELOG.md | 54 -- docs/vtiger/README.md | 46 - docs/vtiger/index.md | 0 docs/zoho/CHANGELOG.md | 58 -- docs/zoho/README.md | 41 - docs/zoho/index.md | 24 - 148 files changed, 15404 deletions(-) delete mode 100644 .github/workflows/docs-local.sh delete mode 100644 docs/asana/CHANGELOG.md delete mode 100644 docs/asana/README.md delete mode 100644 docs/asana/index.md delete mode 100644 docs/azure-storage/CHANGELOG.md delete mode 100644 docs/azure-storage/README.md delete mode 100644 docs/azure-storage/index.md delete mode 100644 docs/beyonic/CHANGELOG.md delete mode 100644 docs/beyonic/README.md delete mode 100644 docs/beyonic/index.md delete mode 100644 docs/bigquery/CHANGELOG.md delete mode 100644 docs/bigquery/README.md delete mode 100644 docs/bigquery/index.md delete mode 100644 docs/cartodb/CHANGELOG.md delete mode 100644 docs/cartodb/README.md delete mode 100644 docs/commcare/CHANGELOG.md delete mode 100644 docs/commcare/README.md delete mode 100644 docs/commcare/index.md delete mode 100644 docs/common/CHANGELOG.md delete mode 100644 docs/common/README.md delete mode 100644 docs/common/index.md delete mode 100644 docs/dhis2/CHANGELOG.md delete mode 100644 docs/dhis2/README.md delete mode 100644 docs/dhis2/index.md delete mode 100644 docs/docs.json delete mode 100644 docs/dynamics/CHANGELOG.md delete mode 100644 docs/dynamics/README.md delete mode 100644 docs/dynamics/index.md delete mode 100644 docs/facebook/CHANGELOG.md delete mode 100644 docs/facebook/README.md delete mode 100644 docs/facebook/index.md delete mode 100644 docs/fhir/CHANGELOG.md delete mode 100644 docs/fhir/README.md delete mode 100644 docs/fhir/index.md delete mode 100644 docs/godata/CHANGELOG.md delete mode 100644 docs/godata/README.md delete mode 100644 docs/godata/index.md delete mode 100644 docs/googlehealthcare/CHANGELOG.md delete mode 100644 docs/googlehealthcare/README.md delete mode 100644 docs/googlehealthcare/index.md delete mode 100644 docs/googlesheets/CHANGELOG.md delete mode 100644 docs/googlesheets/README.md delete mode 100644 docs/googlesheets/index.md delete mode 100644 docs/hive/CHANGELOG.md delete mode 100644 docs/hive/README.md delete mode 100644 docs/hive/index.md delete mode 100644 docs/http/CHANGELOG.md delete mode 100644 docs/http/README.md delete mode 100644 docs/http/index.md delete mode 100644 docs/khanacademy/CHANGELOG.md delete mode 100644 docs/khanacademy/README.md delete mode 100644 docs/khanacademy/index.md delete mode 100644 docs/kobotoolbox/CHANGELOG.md delete mode 100644 docs/kobotoolbox/README.md delete mode 100644 docs/kobotoolbox/index.md delete mode 100644 docs/magpi/CHANGELOG.md delete mode 100644 docs/magpi/README.md delete mode 100644 docs/magpi/index.md delete mode 100644 docs/mailchimp/CHANGELOG.md delete mode 100644 docs/mailchimp/README.md delete mode 100644 docs/mailchimp/index.md delete mode 100644 docs/mailgun/CHANGELOG.md delete mode 100644 docs/mailgun/README.md delete mode 100644 docs/mailgun/index.md delete mode 100644 docs/maximo/CHANGELOG.md delete mode 100644 docs/maximo/README.md delete mode 100644 docs/maximo/index.md delete mode 100644 docs/medicmobile/CHANGELOG.md delete mode 100644 docs/medicmobile/README.md delete mode 100644 docs/medicmobile/index.md delete mode 100644 docs/mogli/CHANGELOG.md delete mode 100644 docs/mogli/README.md delete mode 100644 docs/mogli/connecting_with_sms_providers.md delete mode 100644 docs/mogli/connecting_with_telcos.md delete mode 100644 docs/mogli/index.md delete mode 100644 docs/mongodb/CHANGELOG.md delete mode 100644 docs/mongodb/README.md delete mode 100644 docs/mongodb/index.md delete mode 100644 docs/msgraph/CHANGELOG.md delete mode 100644 docs/msgraph/README.md delete mode 100644 docs/msgraph/index.md delete mode 100644 docs/mssql/CHANGELOG.md delete mode 100644 docs/mssql/README.md delete mode 100644 docs/mssql/index.md delete mode 100644 docs/mysql/CHANGELOG.md delete mode 100644 docs/mysql/README.md delete mode 100644 docs/mysql/index.md delete mode 100644 docs/nexmo/CHANGELOG.md delete mode 100644 docs/nexmo/README.md delete mode 100644 docs/nexmo/index.md delete mode 100644 docs/ocl/CHANGELOG.md delete mode 100644 docs/ocl/README.md delete mode 100644 docs/ocl/index.md delete mode 100644 docs/openfn/CHANGELOG.md delete mode 100644 docs/openfn/README.md delete mode 100644 docs/openfn/index.md delete mode 100644 docs/openhim/CHANGELOG.md delete mode 100644 docs/openhim/README.md delete mode 100644 docs/openhim/index.md delete mode 100644 docs/openmrs/CHANGELOG.md delete mode 100644 docs/openmrs/README.md delete mode 100644 docs/openmrs/index.md delete mode 100644 docs/openspp/CHANGELOG.md delete mode 100644 docs/openspp/README.md delete mode 100644 docs/openspp/index.md delete mode 100644 docs/postgresql/CHANGELOG.md delete mode 100644 docs/postgresql/README.md delete mode 100644 docs/postgresql/index.md delete mode 100644 docs/primero/CHANGELOG.md delete mode 100644 docs/primero/README.md delete mode 100644 docs/primero/index.md delete mode 100644 docs/progres/CHANGELOG.md delete mode 100644 docs/progres/README.md delete mode 100644 docs/progres/index.md delete mode 100644 docs/rapidpro/CHANGELOG.md delete mode 100644 docs/rapidpro/README.md delete mode 100644 docs/rapidpro/index.md delete mode 100644 docs/resourcemap/CHANGELOG.md delete mode 100644 docs/resourcemap/README.md delete mode 100644 docs/resourcemap/index.md delete mode 100644 docs/salesforce/CHANGELOG.md delete mode 100644 docs/salesforce/README.md delete mode 100644 docs/salesforce/index.md delete mode 100644 docs/sftp/CHANGELOG.md delete mode 100644 docs/sftp/README.md delete mode 100644 docs/sftp/index.md delete mode 100644 docs/smpp/CHANGELOG.md delete mode 100644 docs/smpp/README.md delete mode 100644 docs/smpp/index.md delete mode 100644 docs/surveycto/CHANGELOG.md delete mode 100644 docs/surveycto/README.md delete mode 100644 docs/surveycto/index.md delete mode 100644 docs/telerivet/CHANGELOG.md delete mode 100644 docs/telerivet/README.md delete mode 100644 docs/telerivet/index.md delete mode 100644 docs/template/CHANGELOG.md delete mode 100644 docs/template/README.md delete mode 100644 docs/template/index.md delete mode 100644 docs/tutorial/index.md delete mode 100644 docs/twilio/CHANGELOG.md delete mode 100644 docs/twilio/README.md delete mode 100644 docs/twilio/index.md delete mode 100644 docs/vtiger/CHANGELOG.md delete mode 100644 docs/vtiger/README.md delete mode 100644 docs/vtiger/index.md delete mode 100644 docs/zoho/CHANGELOG.md delete mode 100644 docs/zoho/README.md delete mode 100644 docs/zoho/index.md diff --git a/.github/workflows/docs-local.sh b/.github/workflows/docs-local.sh deleted file mode 100644 index 65b4fac9a..000000000 --- a/.github/workflows/docs-local.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -l - -# clean tmp directory -mkdir -p tmp -rm -rf tmp/* - -# copy new packages docs files to the root docs directory -# rsync -pr packages/*/docs/ docs/ -# rsync -av --progress packages/* docs/ --exclude node_modules --exclude src --exclude ast.json --exclude CHANGELOG.md --exclude test --exclude LICENSE --exclude LICENSE.LESSER --exclude package.json --exclude configuration-schema.json -rsync -zvr packages/ tmp/ --include="*.md" --include="*/" --exclude="*" --prune-empty-dirs - -# move index.md to root directory -find tmp/*/docs -name '*.md' -type f -execdir mv -n '{}' ../ \; -find tmp/*/* -type d -empty -delete - -# flatten json files -# jq -s 'flatten' packages/*/docs/*.json > docs/docs.json -rm tmp/*.json -# add first opening bracked -echo [ >>tmp/tmp.json -# use all json files in current folder -for i in packages/*/docs/*.json; do - # first create the key; it is the filename without the extension - # echo \"$i\": | sed 's/\.json//' >> output/tmp.json - # dump the file's content - cat "$i" >>tmp/tmp.json - # add a comma afterwards - echo , >>tmp/tmp.json -done -# remove the last comma from the file; otherwise it's not valid json -cat tmp/tmp.json | sed '$ s/.$//' >>tmp/docs.json -# remove tempfile -rm tmp/tmp.json -# add closing bracket -echo ] >>tmp/docs.json diff --git a/docs/asana/CHANGELOG.md b/docs/asana/CHANGELOG.md deleted file mode 100644 index 334df7fae..000000000 --- a/docs/asana/CHANGELOG.md +++ /dev/null @@ -1,85 +0,0 @@ -# @openfn/language-asana - -## 3.0.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 3.0.0 - -### Major Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 2.1.6 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 2.1.5 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 2.1.4 - -### Patch Changes - -- f2aed32: add examples - -## 2.1.3 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 2.1.2 - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 2.1.1 - -### Patch Changes - -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 - -## 2.1.0 - -### Minor Changes - -- 5f40dcf: Migrated language-asana - -### Patch Changes - -- e04aa28: Rename credential-schema to configuration-schema, update descriptions diff --git a/docs/asana/README.md b/docs/asana/README.md deleted file mode 100644 index 2041b89e4..000000000 --- a/docs/asana/README.md +++ /dev/null @@ -1,90 +0,0 @@ -# language-asana - -Language Pack for connecting with Asana. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/asana-configuration-schema/) -definition. - -### How to create an API token - -Using Asana's API requires having an API token. To generate that token, head to -the [Asana developer console](https://app.asana.com/0/developer-console) and -enter the **Personal access tokens** section. - -There you can click on **+New access token**. A prompt will be opened allowing -you to give the token a name and then create it. - -_Note: Treat your PAT like you would with a password. Do not share it or display -it online._ - -### Sample expression - -## Find a single task of a given project using the task id. - -```js -getTask('1234', { - opt_fields: 'name,assignee', -}); -``` - -## Find the list of tasks of a given project using the project id. - -```js -getTasks('22889593722', { - opt_fields: 'name,notes,assignee', -}); -``` - -## Update a specific task - -```js -updateTask('12344', { - name: 'test', - approval_status: 'pending', - assignee: '12345', -}); -``` - -## Create a task - -```js -createTask({ - name: 'test', - approval_status: 'pending', - assignee: '12345', -}); -``` - -## Update a task or create a new one - -You can use a field name literal as `externalId` to match a specific task. If -the task does not exist, a new one will be created. The first parameter in this -function should be the `project_id`. - -```js -upsertTask('12344', { - externalId: 'name', - data: { - name: 'A new task', - projects: ['12344'], - notes: 'This is a new task', - }, -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/asana/index.md b/docs/asana/index.md deleted file mode 100644 index fcbcbc35f..000000000 --- a/docs/asana/index.md +++ /dev/null @@ -1,143 +0,0 @@ -## Functions - -
-
- createTask(params, callback)
-
- getTask(taskGid, params, callback)
-
- getTasks(projectGid, params, callback)
-
- updateTask(taskGid, params, callback)
-
- upsertTask(projectGid, params, callback)
-
- - -## createTask - -createTask(params, callback) ⇒ Operation -Create a task. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | Body parameters | -| callback | function | (Optional) callback function | - -**Example** -```js -createTask( - { - name: 'test', "approval_status": "pending", "assignee": "12345" - } -) -``` - -* * * - -## getTask - -getTask(taskGid, params, callback) ⇒ Operation -Get a single task of a given project. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| taskGid | string | Globally unique identifier for the task | -| params | object | Query params to include. | -| callback | function | (Optional) callback function | - -**Example** -```js -getTask("taskGid", - { - opt_fields: "name,notes,assignee" - }) -``` - -* * * - -## getTasks - -getTasks(projectGid, params, callback) ⇒ Operation -Get the list of tasks for a given project. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| projectGid | string | Globally unique identifier for the project | -| params | object | Query params to include. | -| callback | function | (Optional) callback function | - -**Example** -```js -getTasks("projectGid", - { - opt_fields: "name,notes,assignee" - }) -``` - -* * * - -## updateTask - -updateTask(taskGid, params, callback) ⇒ Operation -Update a specific task. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| taskGid | string | Globally unique identifier for the task | -| params | object | Body parameters | -| callback | function | (Optional) callback function | - -**Example** -```js -updateTask("taskGid", - { - name: 'test', "approval_status": "pending", "assignee": "12345" - } -) -``` - -* * * - -## upsertTask - -upsertTask(projectGid, params, callback) ⇒ Operation -Update or create a task. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| projectGid | string | Globally unique identifier for the project | -| params | object | an object with an externalId and some task data. | -| callback | function | (Optional) callback function | - -**Example** -```js -upsertTask( - "1201382240880", - { - "externalId": "name", - "data": { - name: 'test', "approval_status": "pending", "assignee": "12345" - } - - } -) -``` - -* * * - diff --git a/docs/azure-storage/CHANGELOG.md b/docs/azure-storage/CHANGELOG.md deleted file mode 100644 index db0e01cad..000000000 --- a/docs/azure-storage/CHANGELOG.md +++ /dev/null @@ -1,11 +0,0 @@ -# @openfn/language-azure-storage - -## 1.0.0 - -### Major Changes - -Intial adaptor release with support for Blob storage. - -- uploadBlob -- downloadBlob -- getBlobProperties diff --git a/docs/azure-storage/README.md b/docs/azure-storage/README.md deleted file mode 100644 index 2e2430e3a..000000000 --- a/docs/azure-storage/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# language-azure-storage - -An OpenFn **_adaptor_** for building integration jobs for use with the Azure -Storage APIs. At present, this adaptor only supports the Azure Blob Storage, -API, but could be expanded for future Azure Storage services (e.g., Files, -Tables, Queues, etc.). - -## Documentation - -View the [docs site](https://docs.openfn.org/adaptors/packages/azure-storage-docs) -for full technical documentation. - -### Configuration - -View the -[configuration-schema](https://docs.openfn.org/adaptors/packages/azure-storage-configuration-schema/) -for required and optional `configuration` properties. - -### An example showing multiple capabilties of this adaptor - -Assume you have a simple `state.json` file as follows: - -```json -{ - "data": { - "foo": "bar", - "bif": "baz", - "sunday": "monday", - "answer": "42" - }, - "configuration": { - "accountName": "myaccountname", - "accountKey": "myaccountkey", - "containerName": "mycontainer" - } -} -``` - -Create a file `job.js`, as shown below, to run with the OpenFn CLI. This -example uploads the blob with a year/month partitioning scheme, then -downloads the same blob and fetches the blob properties. It would be extremely -unusual to perform all of these actions in a single job. - -```js -uploadBlob( - state => { - const date = new Date(); - const id = '0e82962a-6ed0-4a88-92c1-51ae785b4126'; - return `${date.getFullYear()}/${date.getMonth() + 1}/${id}.json`; - }, - state.data, - { - blobHTTPHeaders: { blobContentType: 'application/json' } - }, - { createContainer: true, overwrite: true } -); - -downloadBlob( - dataValue('blobName'); -); - -getBlobProperties( - state => { - return state.references[1].blobName; - } -); -``` - -Run the job as follows: - -```bash -openfn job -a azure-storage -s state.json -O -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -"Getting Started" guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To build _only_ the docs run `pnpm build docs`. diff --git a/docs/azure-storage/index.md b/docs/azure-storage/index.md deleted file mode 100644 index f65cca8cb..000000000 --- a/docs/azure-storage/index.md +++ /dev/null @@ -1,77 +0,0 @@ -## Functions - -
-
- downloadBlob(blobName, [options])
-
- getBlobProperties(blobName, options)
-
- uploadBlob(blobName, content, uploadOptions, [options])
-
- - -## downloadBlob - -downloadBlob(blobName, [options]) ⇒ Operation -Download a blob from Azure Blob Storage. - -**Kind**: global function -**Access**: public - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| blobName | string | | Name of the blob to download. | -| [options] | Object | {} | Additional options for the download process. | - -**Example** -```js -downloadBlob('mycontainer', 'myblob.txt', { downloadAs: 'string' }) -``` - -* * * - -## getBlobProperties - -getBlobProperties(blobName, options) ⇒ Operation -Get properties of a blob in Azure Blob Storage. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| blobName | string | Name of the blob to get properties for. | -| options | string | Additional options for the getBlobProperties process. | - -**Example** -```js -getBlobProperties('mycontainer', 'myblob.txt') -``` - -* * * - -## uploadBlob - -uploadBlob(blobName, content, uploadOptions, [options]) ⇒ Operation -Upload content to Azure Blob Storage. - -**Kind**: global function -**Access**: public - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| blobName | string | | Name of the blob to create or replace. | -| content | string | | Content to upload. | -| uploadOptions | object | | See BlockBlobUploadOptions in Azure Blob Storage docs | -| [options] | Object | {} | Additional options for the upload process. | -| [options.createContainer] | boolean | false | Whether to create the container if it doesn't exist. | -| [options.overwrite] | boolean | false | Whether to overwrite an existing blob with the same name. | -| [options.containerName] | string | | Container name. Overrides state.configuration. | - -**Example** -```js -uploadBlob('mycontainer', 'myblob.txt', {foo:"bar"}, { blobHTTPHeaders: { blobContentType: 'application/json' } }) -``` - -* * * - diff --git a/docs/beyonic/CHANGELOG.md b/docs/beyonic/CHANGELOG.md deleted file mode 100644 index bf4b740dc..000000000 --- a/docs/beyonic/CHANGELOG.md +++ /dev/null @@ -1,103 +0,0 @@ -# @openfn/language-beyonic - -## 0.2.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.2.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.1.9 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.1.8 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.1.7 - -### Patch Changes - -- f2aed32: add examples - -## 0.1.6 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.1.5 - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 0.1.4 - -### Patch Changes - -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 - -## 0.1.3 - -### Patch Changes - -- 63080d0: Update common for build - -## 0.1.2 - -### Patch Changes - -- 0d358b6: Add ast.json for beyonic - -## 0.1.1 - -### Patch Changes - -- 06ff25f: Update superagent to v8 - -## 0.1.0 - -### Minor Changes - -- 28ceb1f: Moving language-beyonic to adaptors/packages/beyonic - -### Patch Changes - -- e04aa28: Rename credential-schema to configuration-schema, update descriptions diff --git a/docs/beyonic/README.md b/docs/beyonic/README.md deleted file mode 100644 index c954919a9..000000000 --- a/docs/beyonic/README.md +++ /dev/null @@ -1,74 +0,0 @@ -# Language Beyonic - -Language Pack for building expressions and operations for working with the -[beyonic API](http://apidocs.beyonic.com/). - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/beyonic-configuration-schema/) -definition. - -## Payments API - -#### `createPayment(...)` - -```js -createPayment( - fields( - field('phonenumber', '+256773712831'), - field('first_name', 'Gideon'), - field('last_name', 'Zelalem'), - field('amount', 100.2), - field('currency', 'USD'), - field('account', 1), - field('description', 'Long-term contract for Arseal'), - field('payment_type', 'money'), - field('callback_url', 'https://my.website/payments/callback') - ) -); -``` - -## Collection Requests API - -#### `createCollectionRequest(...)` - -```js -createCollectionRequest( - fields( - field('instructions', 'Send me some money, please!'), - field('phonenumber', '+256773712831'), - field('amount', 5.0), - field('currency', 'USD') - ) -); -``` - -## Contacts API - -#### `createContact(...)` - -```js -createContact( - fields( - field('first_name', 'Granit'), - field('last_name', 'Xhaka'), - field('phone_number', '+256773712831'), - field('email', 'granit@arsenal.com') - ) -); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/beyonic/index.md b/docs/beyonic/index.md deleted file mode 100644 index 496e2a5c2..000000000 --- a/docs/beyonic/index.md +++ /dev/null @@ -1,72 +0,0 @@ -## Functions - -
-
- createCollectionRequest(data)
-
- createContact(data)
-
- createPayment(data)
-
- - -## createCollectionRequest - -createCollectionRequest(data) ⇒ Operation -Create a collection request - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| data | object | Payload data for the collection request | - -**Example** -```js -execute( - createCollectionRequest(data) -)(state) -``` - -* * * - -## createContact - -createContact(data) ⇒ Operation -Create a contact - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| data | object | Payload data for the contact | - -**Example** -```js -execute( - createContact(data) -)(state) -``` - -* * * - -## createPayment - -createPayment(data) ⇒ Operation -Create a payment - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| data | object | Payload data for the payment | - -**Example** -```js -execute( - createPayment(data) -)(state) -``` - -* * * - diff --git a/docs/bigquery/CHANGELOG.md b/docs/bigquery/CHANGELOG.md deleted file mode 100644 index 5078e9566..000000000 --- a/docs/bigquery/CHANGELOG.md +++ /dev/null @@ -1,126 +0,0 @@ -# @openfn/language-bigquery - -## 2.0.4 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 2.0.3 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 2.0.2 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 2.0.1 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 2.0.0 - -### Major Changes - -- 0b6f20b: use parseCsv from common - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 1.2.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 1.2.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 1.2.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 1.2.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 1.1.5 - -### Patch Changes - -- 5895eb9: update dependencies - -## 1.1.4 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 1.1.3 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 1.1.2 - -### Patch Changes - -- f2aed32: add examples - -## 1.1.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ -- 57f3513: Fix exports in index.js - -## 1.1.0 - -### Minor Changes - -- e4c6114: bigquery migration and build - -### Patch Changes - -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 diff --git a/docs/bigquery/README.md b/docs/bigquery/README.md deleted file mode 100644 index 05b146654..000000000 --- a/docs/bigquery/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# Language BigQuery - -Language Pack for building expressions and operations to make HTTP calls. - -## Documentation - -### state.json - -The configuration key must be a valid GCP credential as JSON. - -```json -{ - "configuration": { - "type": "service_account", - "project_id": "some-project", - "private_key_id": "670b9e3c8c366e83aa569dd57cbfc5c575b72e42", - "private_key": "-----BEGIN PRIVATE KEY-----\nblah\nmoreblah=\n-----END PRIVATE KEY-----\n", - "client_email": "bigquery@some-project.iam.gserviceaccount.com", - "client_id": "someid", - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "token_uri": "https://oauth2.googleapis.com/token", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/bigquery%40some-project.iam.gserviceaccount.com" - }, - "data": { "a": 1 } -} -``` - -### operations (expression.js) - -#### load(...) - -Load data to a table in bigquery from a CSV. See full -[options here](https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad). - -```js -load( - '/home/taylor/Desktop/type-C_r-ALL_ps-201012_freq-M_px-HS_pub-20200731_fmt-csv_ex-20200818.csv', - 'awesome-solutions-project', // project - 'test01', // dataset - 'mytable', // table - { - schema: - 'classification:STRING,year:STRING,period:STRING,period_desc:STRING,aggregate_level:STRING,is_leaf_code:STRING,trade_flow_code:STRING,trade_flow:STRING,reporter_code:STRING,reporter:STRING,reporter_iso:STRING,partner_code:STRING,partner:STRING,partner_iso:STRING,commodity_code:STRING,commodity:STRING,qty_unit_code:STRING,qty_unit:STRING,qty:INTEGER,netweight_kg:INTEGER,trade_value:INTEGER,flag:STRING', - schemaUpdateOptions: ['ALLOW_FIELD_ADDITION'], - // createDisposition: 'CREATE_IF_NEEDED', - writeDisposition: 'WRITE_APPEND', - skipLeadingRows: 1, - } // loadOptions -); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/bigquery/index.md b/docs/bigquery/index.md deleted file mode 100644 index 2ae996f4d..000000000 --- a/docs/bigquery/index.md +++ /dev/null @@ -1,36 +0,0 @@ -## load - -load(dirPath, projectId, datasetId, tableId, loadOptions, callback) ⇒ Operation -Load files to BigQuery - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| dirPath | string | the path to your local directory | -| projectId | string | your bigquery project id | -| datasetId | string | your bigquery dataset id | -| tableId | string | the name of the table you'd like to load | -| loadOptions | object | options to pass to the bigquery.load() API | -| callback | function | and optional callback | - -**Example** -```js -load( - './tmp/files', - 'my-bg-project', - 'test01', - 'product-codes', - { - schema: 'FREQ:STRING,DATATYPE:STRING,PRODUCTCODE:STRING,PARTNER:STRING', - writeDisposition: 'WRITE_APPEND', - skipLeadingRows: 1, - schemaUpdateOptions: ['ALLOW_FIELD_ADDITION'], - createDisposition: 'CREATE_IF_NEEDED', - } -) -``` - -* * * - diff --git a/docs/cartodb/CHANGELOG.md b/docs/cartodb/CHANGELOG.md deleted file mode 100644 index 4bd7cb254..000000000 --- a/docs/cartodb/CHANGELOG.md +++ /dev/null @@ -1,64 +0,0 @@ -# @openfn/language-cartodb - -## 0.2.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.2.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.1.4 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.1.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.1.2 - -### Patch Changes - -- f2aed32: add examples - -## 0.1.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.1.0 - -### Minor Changes - -- 792d495: Migrate CartoDB - -### Patch Changes - -- e4ebcb6: Fix Large gzip Denial of Service in superagent diff --git a/docs/cartodb/README.md b/docs/cartodb/README.md deleted file mode 100644 index 46532b40e..000000000 --- a/docs/cartodb/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# Language cartodb - -Language Pack for sending messages using the -[cartodb API](http://docs.cartodb.com/cartodb-platform/sql-api/). - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/cartodb-configuration-schema/) -definition. - -## Examples - -```js -addRow( - 'your_table', - fields( - field('name', 'taylor'), - field('lat', dataValue('lat')), - field('long', dataValue('long')), - field('mookie', dataValue('form.blaylock')), - field('description', dataValue('type_description')), - field('date', dataValue('SubmissionDate')) - ) -); -``` - -```js -sql(function (state) { - return ( - `INSERT INTO untitled_table (name, the_geom) VALUES ('` + - dataValue('form.first_name')(state) + - `', ST_SetSRID(ST_Point(` + - dataValue('lat')(state) + - `, ` + - dataValue('long')(state) + - `),4326))` - ); -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/commcare/CHANGELOG.md b/docs/commcare/CHANGELOG.md deleted file mode 100644 index 02664bb84..000000000 --- a/docs/commcare/CHANGELOG.md +++ /dev/null @@ -1,169 +0,0 @@ -# @openfn/language-commcare - -## 1.6.10 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - - @openfn/language-http@5.0.4 - -## 1.6.9 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - - @openfn/language-http@5.0.3 - -## 1.6.8 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - - @openfn/language-http@5.0.2 - -## 1.6.7 - -### Patch Changes - -- 52c02c8: update xlsx package - -## 1.6.6 - -### Patch Changes - -- 8205673: update superagent - -## 1.6.5 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - - @openfn/language-http@5.0.1 - -## 1.6.4 - -### Patch Changes - -- Updated dependencies [0b6f20b] -- Updated dependencies [8c32eb3] - - @openfn/language-http@5.0.0 - - @openfn/language-common@1.10.1 - -## 1.6.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - - @openfn/language-http@4.3.3 - -## 1.6.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - - @openfn/language-http@4.3.2 - -## 1.6.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - - @openfn/language-http@4.3.1 - -## 1.6.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - - @openfn/language-http@4.3.0 - -## 1.5.6 - -### Patch Changes - -- e0406fa: update dependencies - -## 1.5.5 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - - @openfn/language-http@4.2.8 - -## 1.5.4 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] -- Updated dependencies [14f481e] - - @openfn/language-common@1.7.6 - - @openfn/language-http@4.2.7 - -## 1.5.3 - -### Patch Changes - -- f2aed32: add examples -- Updated dependencies [f2aed32] - - @openfn/language-http@4.2.5 - -## 1.5.2 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ -- 57f3513: Fix exports in index.js -- Updated dependencies [6d8de03] - - @openfn/language-http@4.2.4 - -## 1.5.1 - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - - @openfn/language-http@4.2.3 - -## 1.5.0 - -### Minor Changes - -- 5c050ed: Migrate CommCare - -### Patch Changes - -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- 94076b9: update dependency xlsx to ^0.18.0 -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [9a2755e] -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-http@4.2.2 - - @openfn/language-common@1.7.4 diff --git a/docs/commcare/README.md b/docs/commcare/README.md deleted file mode 100644 index f5a9e04ae..000000000 --- a/docs/commcare/README.md +++ /dev/null @@ -1,178 +0,0 @@ -# Language CommCare - -Language Pack for interacting with the CommCare API. - -https://confluence.dimagi.com/display/commcarepublic/Download+Report+Data - -https://confluence.dimagi.com/display/commcarepublic/Submission+API - -https://bitbucket.org/javarosa/javarosa/wiki/FormSubmissionAPI - -Accepted X-Form Spec from Dimagi: http://dimagi.github.io/xform-spec Accepted -X-Form Spec for Cases from Dimagi: -https://github.com/dimagi/commcare/wiki/casexml20 - -## Documentation - -## Configuration - -View all the required and optional properties for `state.configuration` in the official [configuration-schema](https://docs.openfn.org/adaptors/packages/commcare-configuration-schema/) definition. - -- The "appId" is the UUID which designates your commcare project as different from -everyone elses. It can be found in the URL of your application when you first -enter it from the project screen. I.e., the last part of this url: -`https://www.commcarehq.org/a/YOUR_PROJECT/apps/view/YOUR_APP_ID/` - -- Note that the username is your full email address. - -## `fetchReportData` to pull aggregate data from CommCare - -It takes 3 arguments: reportId, params, and postUrl. - -```js -fetchReportData( - 'reportId', - { limit: 10, offset: 2, state: 'Vermont' }, - 'http://www.openfn.org/inbox/secret-uuid' -); -``` - -simple body target: - -```xml - - Something - Else - 29 - -``` - -complex body target: - -```xml - - - bar - - - bar - user-xxx-eve - member - - - - A00000245706EE - 2013-04-19T16:52:41.000-04 - 2013-04-19T16:53:02.799-04 - eve - user-xxx-eve - b58df19c-efd5-4ecf-9581-65dda8b8787c - CommCare ODK, version "2.4.1"(10083). App v19. CommCare Version 2.4. Build 10083, built on: March-12-2013 - - -``` - -## Submitting data to CommCare HQ - -### Submit an XLS file - -This function bulk submit a JSON object as xls file to CommCare HQ - -```js -submitXls([{ name: 'Mamadou', phone: '000000' }], { - case_type: 'student', - search_field: 'external_id', - create_new_cases: 'on', -}); -``` - -### submit - -Here we're just building the most basic JSON object, that will be converted to -an XML object and posted as the element. - -```js -submit( - fields( - field('@', function (state) { - return { - xmlns: - 'http://openrosa.org/formdesigner/2BCC3E88-2D0D-4C07-8D4A-6B372F3799D9', - }; - }), - field('paitent_namentosh', dataValue('first_name')), - field('question2', 'Some answer here.'), - field('question3', 'HKS'), - field('question4', 'item1'), - field('question5', 69855), - field('question6', 12) - ) -); -``` - -An open rosa form submission body should look like this: - -```xml - - - Taylor - Moruki - Hks - item1 - 69855 - 12 - - 358239055789384 - 2015-08-21T16:21:59.807+02 - 2015-08-21T16:22:15.987+02 - openfn - 5fe615b3af2834cb5dca59f7466d6174 - 195e79eb-d823-46fe-9e4f-59b8327d5db2 - CommCare ODK, version "2.22.0"(370023). App v9. CommCare Version 2.22. Build 370023, built on: July-22-2015 - - -``` - -So the JSON emitted by your expression should look like this: - -```json -{ - "data": { - "name": "Patient Registration", - "uiVersion": "1", - "version": "9", - "xmlns": "http://openrosa.org/formdesigner/2BCC3E88-2D0D-4C07-8D4A-6B372F3799D9", - "xmlns:jrm": "http://dev.commcarehq.org/jr/xforms", - "paitent_namentosh": "Taylor", - "question2": " Moruki", - "question3": "Hks", - "question4": "item1", - "question5": "69855", - "question6": "12", - "n0:meta": { - "xmlns:n0": "http://openrosa.org/jr/xforms", - "n0:deviceID": "358239055789384", - "n0:timeStart": "2015-08-21T16:21:59.807+02", - "n0:timeEnd": "2015-08-21T16:22:15.987+02", - "n0:username": "openfn", - "n0:userID": "5fe615b3af2834cb5dca59f7466d6174", - "n0:instanceID": "195e79eb-d823-46fe-9e4f-59b8327d5db2", - "n1:appVersion": { - "xmlns:n1": "http://commcarehq.org/xforms", - "$t": "CommCare ODK, version \"2.22.0\"(370023). App v9. CommCare Version 2.22. Build 370023, built on: July-22-2015" - } - } - } -} -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/commcare/index.md b/docs/commcare/index.md deleted file mode 100644 index 82463ed41..000000000 --- a/docs/commcare/index.md +++ /dev/null @@ -1,112 +0,0 @@ -## Functions - -
-
- clientPost(formData)
-
- fetchReportData(reportId, params, postUrl)
-
- submit(formData)
-
- submitXls(formData, params)
-
- - -## clientPost - -clientPost(formData) ⇒ State -Performs a post request - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| formData | Object | Form Data with auth params and body | - -**Example** -```js -clientPost(formData) -``` - -* * * - -## fetchReportData - -fetchReportData(reportId, params, postUrl) ⇒ Operation -Make a GET request to CommCare's Reports API -and POST the response to somewhere else. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| reportId | String | API name of the report. | -| params | Object | Query params, incl: limit, offset, and custom report filters. | -| postUrl | String | Url to which the response object will be posted. | - -**Example** -```js -fetchReportData(reportId, params, postUrl) -``` - -* * * - -## submit - -submit(formData) ⇒ Operation -Submit form data - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| formData | Object | Object including form data. | - -**Example** -```js -submit( - fields( - field("@", function(state) { - return { - "xmlns": "http://openrosa.org/formdesigner/form-id-here" - }; - }), - field("question1", dataValue("answer1")), - field("question2", "Some answer here.") - ) - ) -``` - -* * * - -## submitXls - -submitXls(formData, params) ⇒ Operation -Convert form data to xls then submit. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| formData | Object | Object including form data. | -| params | Object | Request params including case type and external id. | - -**Example** -```js -submitXls( - [ - {name: 'Mamadou', phone: '000000'}, - ], - { - case_type: 'student', - search_field: 'external_id', - create_new_cases: 'on', - } -) -``` - -* * * - diff --git a/docs/common/CHANGELOG.md b/docs/common/CHANGELOG.md deleted file mode 100644 index 24a0d9c96..000000000 --- a/docs/common/CHANGELOG.md +++ /dev/null @@ -1,152 +0,0 @@ -v0.4.0 - -## 1.12.0 - -### Minor Changes - -- 7f52699: New HTTP helper functions have been added to common in - `src/util/http.js` - - These are based on the `undici` library. They are functions, not operations, - so they do not get and return state, and do not expand references. - - They are designed to be used by other adaptors to make HTTP requests easier. - - ## Usage - - ``` - // Import the helper function - import { get } from '@openfn/language-common/util' - - // This is an example operation - export function get(id, callback) { - return async (state) => { - const [resolvedId] = expandReferences( - state, - id, - ); - - // Call the new common helper to fetch some json - const response = await get(`www.example.com/resource/{$resolvedId}`, { parseAs: 'json' }); - - // Return the response body as data, and also include the response object as a convenience - return { - ...state, - response, - data: response.body - } - } - } - ``` - - See the http adaptor for a reference implementation. - - ## Deprecation notice - - The existing http operations in `src/http.js` have been deprecated, and - adaptors should migrate to the new helpers. - -## 1.11.1 - -### Patch Changes - -- c19efbe: don't attempt to expand references for a buffer - -## 1.11.0 - -### Minor Changes - -- 85c35b8: Add validate function to validate data against a JSON schema - -## 1.10.3 - -### Patch Changes - -- df09270: Fix streaming interface to parseCSV - -## 1.10.2 - -### Patch Changes - -- 26a303e: add expandReferences for csvData and parsingOptions - -## 1.10.1 - -### Patch Changes - -- 8c32eb3: - update parseCsv to await callback - - Added documentation for splitKeys - -## 1.10.0 - -### Minor Changes - -- aad9549: Ensure that standard OAuth2 credentials with snake-cased - "access_token" keys can be used for OAuth2-reliant adaptors - -## 1.9.0 - -### Minor Changes - -- 111807f: Add support for `parseCsv` in common - -## 1.8.1 - -### Patch Changes - -- Update lock files - -## 1.8.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -## 1.7.7 - -### Patch Changes - -- 929bca6: Export metadata helper function - -## 1.7.6 - -### Patch Changes - -- 2b4c61a: mark execute private and ast build - -## 1.7.5 - -### Patch Changes - -- f2a91a4: Update package exports - -## 1.7.4 - -### Patch Changes - -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- b5eb665: Adjusted docs for common and built to markdown -- # ecf5d30: remove sinon since it was not being used - -Bumped all package versions to their latest. - -# v0.0.4 - -- Added `arrayToString` helper. - Allowing you to join an array of string'able primitives (strings and integers) - into a string. -- Added `toArray` helper. - This can be used to coerce certain types of data into an array, this can be - useful when the source data has an ambiguous format. For example a given key - in the data may have an object as it's value (when there is only one item), - and an array of objects when there is more than one. `toArray` can be used to - reconcile this inconsistency. diff --git a/docs/common/README.md b/docs/common/README.md deleted file mode 100644 index d77837689..000000000 --- a/docs/common/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Language Common [![CircleCI](https://circleci.com/gh/OpenFn/language-common.svg?style=svg)](https://circleci.com/gh/OpenFn/language-common) - -Common and generic expressions and operations for [OpenFn](http://openfn.org). - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/common/index.md b/docs/common/index.md deleted file mode 100644 index 5d52ee85f..000000000 --- a/docs/common/index.md +++ /dev/null @@ -1,941 +0,0 @@ -## Functions - -
-
- alterState(func)
-
- arrayToString(arr, separator)
-
- asData(data, state)
-
- chunk(array, chunkSize)
-
- combine(operations)
-
- composeNextState(state, response)
-
- dataPath(path)
-
- dataValue(path)
-
- del(requestParams)
-
- each(dataSource, operation)
-
- each(dataSource, operation)
-
- expandReferences(value, [skipFilter])
-
- expandRequestReferences(value)
-
- field(key, value)
-
- fields(fields)
-
- fn(func)
-
- get(requestParams)
-
- head(requestParams)
-
- humanProper(str)
-
- index()
-
- join(targetPath, sourcePath, targetKey)
-
- jsonValue(obj, path)
-
- lastReferenceValue(path)
-
- map(path, operation, state)
-
- merge(dataSource, fields)
-
- options(requestParams)
-
- parseCsv(csvData, [parsingOptions], [callback])
-
- patch(requestParams)
-
- post(requestParams)
-
- put(requestParams)
-
- referencePath(path)
-
- request(method, fullUrlOrPath, [options])
-
- scrubEmojis(text, replacementChars)
-
- source(path)
-
- sourceValue(path)
-
- splitKeys(obj, keys)
-
- toArray(arg)
-
- validate(schema, data)
-
- withAgent(params)
-
- - -## alterState - -alterState(func) ⇒ Operation -alias for "fn()" - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| func | function | is the function | - - -* * * - -## arrayToString - -arrayToString(arr, separator) ⇒ string -Turns an array into a string, separated by X. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| arr | array | Array of toString'able primatives. | -| separator | string | Separator string. | - -**Example** -```js -field("destination_string__c", function(state) { - return arrayToString(dataValue("path_of_array")(state), ', ') -}) -``` - -* * * - -## asData - -asData(data, state) ⇒ array -Simple switcher allowing other expressions to use either a JSONPath or -object literals as a data source. -- JSONPath referencing a point in `state` -- Object Literal of the data itself. -- Function to be called with state. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| data | String \| object \| function | | -| state | object | The current state. | - -**Example** -```js -asData('$.key'| key | callback) -``` - -* * * - -## chunk - -chunk(array, chunkSize) ⇒ Object -Chunks an array into an array of arrays, each with no more than a certain size. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| array | Object | Array to be chunked | -| chunkSize | Integer | The maxiumum size of each chunks | - -**Example** -```js -chunk([1,2,3,4,5], 2) -``` - -* * * - -## combine - -combine(operations) ⇒ Operation -Combines two operations into one - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| operations | Operations | Operations to be performed. | - -**Example** -```js -combine( - create('foo'), - delete('bar') -) -``` - -* * * - -## composeNextState - -composeNextState(state, response) ⇒ State -Prepares next state - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| state | State | state | -| response | Object | Response to be added | - -**Example** -```js -composeNextState(state, response) -``` - -* * * - -## dataPath - -dataPath(path) ⇒ string -Ensures a path points at the data. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | string | JSONPath referencing a point in `data`. | - -**Example** -```js -dataPath('key') -``` - -* * * - -## dataValue - -dataValue(path) ⇒ Operation -Picks out a single value from the source data object—usually `state.data`. -If a JSONPath returns more than one value for the reference, the first -item will be returned. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | String | JSONPath referencing a point in `data`. | - -**Example** -```js -dataValue('key') -``` - -* * * - -## del - -del(requestParams) ⇒ Operation -Make a DELETE request - -**Kind**: global function -**Returns**: Operation - - Function which takes state and returns a Promise -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | - -**Example** *(Deleting a record with data that comes from state)* -```js -delete({ - url: state => `https://www.example.com/api/items/${state.id}`, - })(state); -``` - -* * * - -## each - -each(dataSource, operation) ⇒ Operation -Scopes an array of data based on a JSONPath. -Useful when the source data has `n` items you would like to map to -an operation. -The operation will receive a slice of the data based of each item -of the JSONPath provided. - -It also ensures the results of an operation make their way back into -the state's references. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| dataSource | DataSource | JSONPath referencing a point in `state`. | -| operation | Operation | The operation needed to be repeated. | - -**Example** -```js -each("$.[*]", - create("SObject", - field("FirstName", sourceValue("$.firstName")) - ) -) -``` - -* * * - -## each - -each(dataSource, operation) ⇒ Operation -Scopes an array of data based on a JSONPath. -Useful when the source data has `n` items you would like to map to -an operation. -The operation will receive a slice of the data based of each item -of the JSONPath provided. - -It also ensures the results of an operation make their way back into -the state's references. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| dataSource | DataSource | JSONPath referencing a point in `state`. | -| operation | Operation | The operation needed to be repeated. | - -**Example** -```js -each("$.[*]", - create("SObject", - field("FirstName", sourceValue("$.firstName"))) - ) -``` - -* * * - -## expandReferences - -expandReferences(value, [skipFilter]) ⇒ Operation -Recursively resolves objects that have resolvable values (functions). - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| value | object | data | -| [skipFilter] | function | a function which returns true if a value should be skipped | - - -* * * - -## expandRequestReferences - -expandRequestReferences(value) ⇒ Operation -Recursively resolves objects that have resolvable values (functions), but -omits HTTP request specific modules like `FormData`. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| value | object | data | - - -* * * - -## field - -field(key, value) ⇒ Field -Returns a key, value pair in an array. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| key | string | Name of the field | -| value | Value | The value itself or a sourceable operation. | - -**Example** -```js -field('destination_field_name__c', 'value') -``` - -* * * - -## fields - -fields(fields) ⇒ Object -Zips key value pairs into an object. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| fields | Fields | a list of fields | - -**Example** -```js -fields(list_of_fields) -``` - -* * * - -## fn - -fn(func) ⇒ Operation -Creates a custom step (or operation) for more flexible job writing. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| func | function | is the function | - -**Example** -```js -fn(state => { - // do some things to state - return state; -}); -``` - -* * * - -## get - -get(requestParams) ⇒ Operation -Make a GET request - -**Kind**: global function -**Returns**: Operation - - Function which takes state and returns a Promise -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | - -**Example** *(Get an item with a specified id from state)* -```js - get({ - url: state => `https://www.example.com/api/items/${state.id}, - headers: {"content-type": "application/json"} -}); -``` - -* * * - -## head - -head(requestParams) ⇒ Operation -Make a HEAD request - -**Kind**: global function -**Returns**: Operation - - Function which takes state and returns a Promise -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | - -**Example** *(Gets the headers that would be returned if the HEAD request's URL was instead requested with the HTTP GET method)* -```js -head({ - url: 'https://www.example.com/api/items', -}); -``` - -* * * - -## humanProper - -humanProper(str) ⇒ string -Substitutes underscores for spaces and proper-cases a string - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| str | string | String that needs converting | - -**Example** -```js -field("destination_string__c", humanProper(state.data.path_to_string)) -``` - -* * * - -## index - -index() ⇒ DataSource -Returns the index of the current array being iterated. -To be used with `each` as a data source. - -**Kind**: global function -**Access**: public -**Example** -```js -index() -``` - -* * * - -## join - -join(targetPath, sourcePath, targetKey) ⇒ Operation -Adds data from a target object - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| targetPath | String | Target path | -| sourcePath | String | Source path | -| targetKey | String | Target Key | - -**Example** -```js -join('$.key','$.data','newKey') -``` - -* * * - -## jsonValue - -jsonValue(obj, path) ⇒ Operation -Picks out a single value from a JSON object. -If a JSONPath returns more than one value for the reference, the first -item will be returned. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| obj | object | A valid JSON object. | -| path | String | JSONPath referencing a point in given JSON object. | - -**Example** -```js -jsonValue({ a:1 }, 'a') -``` - -* * * - -## lastReferenceValue - -lastReferenceValue(path) ⇒ Operation -Picks out the last reference value from source data. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | String | JSONPath referencing a point in `references`. | - -**Example** -```js -lastReferenceValue('key') -``` - -* * * - -## map - -map(path, operation, state) ⇒ State -Scopes an array of data based on a JSONPath. -Useful when the source data has `n` items you would like to map to -an operation. -The operation will receive a slice of the data based of each item -of the JSONPath provided. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | string | JSONPath referencing a point in `state.data`. | -| operation | function | The operation needed to be repeated. | -| state | State | Runtime state. | - -**Example** -```js -map("$.[*]", - create("SObject", - field("FirstName", sourceValue("$.firstName")) - ) -) -``` - -* * * - -## merge - -merge(dataSource, fields) ⇒ DataSource -Merges fields into each item in an array. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| dataSource | DataSource | | -| fields | Object | Group of fields to merge in. | - -**Example** -```js -merge( - "$.books[*]", - fields( - field( "publisher", sourceValue("$.publisher") ) - ) -) -``` - -* * * - -## options - -options(requestParams) ⇒ Operation -Make a OPTIONS request - -**Kind**: global function -**Returns**: Operation - - Function which takes state and returns a Promise -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | - -**Example** *(Requests permitted communication options for a given URL or server, with data from state.)* -```js -options({ - url: 'https://www.example.com/api/items', -}); -``` - -* * * - -## parseCsv - -parseCsv(csvData, [parsingOptions], [callback]) ⇒ Operation -Takes a CSV file string or stream and parsing options as input, and returns a promise that -resolves to the parsed CSV data as an array of objects. -Options for `parsingOptions` include: -- `delimiter` {string/Buffer/[string/Buffer]} - Defines the character(s) used to delineate the fields inside a record. Default: `','` -- `quote` {string/Buffer/[string/Buffer]} - Defines the characters used to surround a field. Default: `'"'` -- `escape` {Buffer/string/null/boolean} - Set the escape character as one character/byte only. Default: `"` -- `columns` {boolean / array / function} - Generates record in the form of object literals. Default: `true` -- `bom` {boolean} - Strips the [byte order mark (BOM)](https://en.wikipedia.org/wiki/Byte_order_mark) from the input string or buffer. Default: `true` -- `trim` {boolean} - Ignore whitespace characters immediately around the `delimiter`. Default: `true` -- `ltrim` {boolean} - Ignore whitespace characters from the left side of a CSV field. Default: `true` -- `rtrim` {boolean} - Ignore whitespace characters from the right side of a CSV field. Default: `true` -- `chunkSize` {number} - The size of each chunk of CSV data. Default: `Infinity` -- `skip_empty_lines` {boolean} - Ignore empty lines in the CSV file. Default: `true` - -**Kind**: global function -**Returns**: Operation - The function returns a Promise that resolves to the result of parsing a CSV `stringOrStream`. -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| csvData | String \| Stream | A CSV string or a readable stream | -| [parsingOptions] | Object | Optional. Parsing options for converting CSV to JSON. | -| [callback] | function | (Optional) callback function. If used it will be called state and an array of rows. | - - -* * * - -## patch - -patch(requestParams) ⇒ Operation -Make a PATCH request - -**Kind**: global function -**Returns**: Operation - - Function which takes state and returns a Promise -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | - -**Example** *(Applies partial modifications to a resource, with data from state.)* -```js -patch({ - url: state => `https://www.example.com/api/items/${state.id}`, - data: state => state.data -}); -``` - -* * * - -## post - -post(requestParams) ⇒ Operation -Make a POST request - -**Kind**: global function -**Returns**: Operation - - Function which takes state and returns a Promise -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | - -**Example** *(Sending a payload with data that comes from state)* -```js -post({ - url: "https://example.com", - data: (state) => state.data -}); -``` -**Example** *( Capturing the response for later use in state )* -```js -alterState((state) => { - return post({ - url: "https://example.com", - data: (state) => state.data - })(state).then(({response}) => { - state.responseData = response.data - }) -}); -``` - -* * * - -## put - -put(requestParams) ⇒ Operation -Make a PUT request - -**Kind**: global function -**Returns**: Operation - - Function which takes state and returns a Promise -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) | - -**Example** *(Creates a new resource or replaces a representation of the target resource with the request payload, with data from state.)* -```js -put({ - url: state => `https://www.example.com/api/items/${state.id}`, - data: state => state.data -}); -``` - -* * * - -## referencePath - -referencePath(path) ⇒ string -Ensures a path points at references. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | string | JSONPath referencing a point in `references`. | - -**Example** -```js -referencePath('key') -``` - -* * * - -## request - -request(method, fullUrlOrPath, [options]) ⇒ -`request` is a helper function that sends HTTP requests and returns the response -body, headers, and status code. -Use the error map to provide custom error messages or get hold of the response in case of errors. - -**Kind**: global function -**Returns**: an object with the following properties: -- method: the request method -- url: the request url -- code: the status code of the response -- headers: the headers of the response -- body: the body of the response -- message: the status text of the response -- duration: the response time - -| Param | Description | -| --- | --- | -| method | The HTTP method to use for the request (e.g., "GET", "POST", "PUT", "DELETE", etc.). | -| fullUrlOrPath | The full or partial URL for the request. | -| [options] | The `options` parameter is an object that contains additional configuration options for the request. | - - -* * * - -## scrubEmojis - -scrubEmojis(text, replacementChars) ⇒ string -Replaces emojis in a string. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| text | string | String that needs to be cleaned | -| replacementChars | string | Characters that replace the emojis | - -**Example** -```js -scrubEmojis('Dove🕊️⭐ 29') -``` - -* * * - -## source - -source(path) ⇒ Array.<(String\|Object)> -Picks out a value from source data. -Will return whatever JSONPath returns, which will always be an array. -If you need a single value use `sourceValue` instead. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | String | JSONPath referencing a point in `state`. | - -**Example** -```js -source('$.key') -``` - -* * * - -## sourceValue - -sourceValue(path) ⇒ Operation -Picks out a single value from source data. -If a JSONPath returns more than one value for the reference, the first -item will be returned. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | String | JSONPath referencing a point in `state`. | - -**Example** -```js -sourceValue('$.key') -``` - -* * * - -## splitKeys - -splitKeys(obj, keys) ⇒ Array.<Object> -Splits an object into two objects based on a list of keys. -The first object contains the keys that are not in the list, -and the second contains the keys that are. - -**Kind**: global function -**Returns**: Array.<Object> - - Tuple of objects, first object contains keys not in list, second contains keys that are. -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| obj | Object | The object to split. | -| keys | Array.<string> | List of keys to split on. | - - -* * * - -## toArray - -toArray(arg) ⇒ array -Ensures primitive data types are wrapped in an array. -Does not affect array objects. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| arg | any | Data required to be in an array | - -**Example** -```js -each(function(state) { - return toArray( dataValue("path_of_array")(state) ) -}, ...) -``` - -* * * - -## validate - -validate(schema, data) ⇒ Operation -Validate against a JSON schema. Any erors 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`. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| schema | string \| object | The schema, path or URL to validate against | -| data | string \| object | The data or path to validate | - -**Example** *(Validate `state.data` with `state.schema`)* -```js -validate() -``` -**Example** *(Validate form data at `state.form` with a schema from a URL)* -```js -validate("https://www.example.com/schema/record", "form") -``` -**Example** *(Validate the each item in `state.records` with a schema from a URL)* -```js -each("records[*]", validate("https://www.example.com/schema/record")) -``` - -* * * - -## withAgent - -withAgent(params) ⇒ Operation -Creates an https agent for axios from the agentOptions key passed in params. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data | - - -* * * - diff --git a/docs/dhis2/CHANGELOG.md b/docs/dhis2/CHANGELOG.md deleted file mode 100644 index 1f7bc3678..000000000 --- a/docs/dhis2/CHANGELOG.md +++ /dev/null @@ -1,149 +0,0 @@ -# @openfn/language-dhis2 - -## 4.0.3 - -### Patch Changes - -- 222184d: remove Class Log and replaced - - - `Log.success` with `console.log` - - `Log.warn` with `console.warn` - - `Log.error` with `console.error` - -## 4.0.2 - -### Patch Changes - -- 1bd612e: improve error logs response - -## 4.0.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 4.0.0 - -### Major Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 3.2.12 - -### Patch Changes - -- 57742d1: improve logs output - -## 3.2.11 - -### Patch Changes - -- 705caab: Remove tools as devdependencies - -## 3.2.10 - -### Patch Changes - -- 929bca6: Use metadata helper function from common -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 3.2.9 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 3.2.8 - -### Patch Changes - -- Fix metadata function export - -## 3.2.7 - -### Patch Changes - -- c09b821: Add @magic annotations - -## 3.2.6 - -### Patch Changes - -- df6098d: replace sample state with configuration - -## 3.2.5 - -### Patch Changes - -- f2aed32: add examples - -## 3.2.4 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 3.2.3 - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 3.2.2 - -### Patch Changes - -- 9a2755e: Update dependency on language-common -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 - - @openfn/buildtools@1.0.2 - -## 3.2.1 - -### Patch Changes - -- e04aa28: Rename credential-schema to configuration-schema, update descriptions - -## 3.2.0 - -### Minor Changes - -- f670bf8: Added credential schema to enable new ui - -## 3.1.0 - -### Minor Changes - -- 8d6e8ce: Migrate dhis2 into repo - -### Patch Changes - -- Updated dependencies [4671e89] -- Updated dependencies [8d6e8ce] - - @openfn/buildtools@1.0.1 diff --git a/docs/dhis2/README.md b/docs/dhis2/README.md deleted file mode 100644 index 9db3985d3..000000000 --- a/docs/dhis2/README.md +++ /dev/null @@ -1,113 +0,0 @@ -# Language DHIS2 - -An OpenFn language Pack for building expressions and operations for working with -the -[DHIS2 API](http://dhis2.github.io/dhis2-docs/master/en/developer/html/dhis2_developer_manual.html). -Used most commonly via OpenFn.org or by hand with -[OpenFn/core](https://github.com/OpenFn/core) from the root of this repo: - -```sh -core execute \ - -l ../language-dhis2 \ - -e ./tmp/expression.js \ - -s ./tmp/state.json \ - -o ./tmp/output.json -``` - -## Documentation - -View the [docs site](https://docs.openfn.org/adaptors/packages/dhis2-docs) for -full technical documentation. - -There are lots of **examples** for how to use the various helper functions on -the main -[Adaptor docs](https://docs.openfn.org/adaptors/packages/dhis2-docs#modules) -page. - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/dhis2-configuration-schema/) -definition. - -## Development - -Run tests using `pnpm run test` or `pnpm run test:watch`. (NB: that this repo -also contain integration tests which can be run with -`pnpm run integration-test`.) - -⚠️ NB: Make changes to the files in `src/` and then use `npm run build` to -generate output files in `lib/`. - -The documentation is autogenerated, so please **rebuild the docs** after making -changes by running `pnpm build docs` - -### Unit Tests - -Unit tests allows to test the functionalities of the adaptor helper functions -such as: - -> Does `create('events', payload)` perform a post request to the correct DHIS2 -> API? - -To run unit tests execute `pnpm run test` (they're the default tests). - -Anytime a new functionality is added to the helper functions, more unit tests -needs to be added. - -### End-to-end integration tests - -Integration tests allow us to test the end-to-end behavior of the helper -functions and also to test the examples we provide via inline documentation. - -For example with integration tests we answer the following question: - -> Does `create('events', eventPayload)` actually create a new event in a live -> DHIS2 system? - -To run integration tests, execute `npm run integration-test`. These tests use -network I/O and a public connection to a DHIS2 "play" server so their timing and -performance is unpredictable. Consider adding an increased timeout, and -modifying the orgUnit, program, etc., IDs set in `globalState`. - -#### Troubleshooting the tests - -- Depending on your internet strength please consider changing the **global - timeout** in the `test/mocha.opts` file to avoid faillures related to network - timeouts. - -- The behavior of the tests in `test/integration.js` is very unpredictable; they - depend on the **configuration of a target DHIS2 instance**. Currently you need - to have at least one organisation unit with one program, one - trackedEntityInstance and one programStage in it. These components need to be - well configured for the integration tests to work. For example: the - trackedEntityInstance need to be enrolled to the program, which should be - created in that organisation unit and contains at least that programStage. If - the tests fail, you must adjust these attributes in the - [before hook](https://github.com/OpenFn/adaptors/tree/main/packages/dhis2/test/integration.js): - -```javascript -before(done => { - fixture.initialState = { - configuration: { - username: 'admin', - password: 'district', - hostUrl: 'https://play.dhis2.org/2.36.6', - }, - program: 'IpHINAT79UW', - orgUnit: 'DiszpKrYNg8', - trackedEntityInstance: 'uhubxsfLanV', - programStage: 'eaDHS084uMp', - }; - done(); -}); -``` - -- Make sure the `update` and `upsert` integration tests don't affect those - initial organisation units, programs, programStage and trackedEntityInstance - required. Otherwise the create integration tests would be broken again; and - that's an endless faillure loop :( - -Anytime a new example is added in the documentation of a helper function, a new -integration test should be built. diff --git a/docs/dhis2/index.md b/docs/dhis2/index.md deleted file mode 100644 index e92aedafc..000000000 --- a/docs/dhis2/index.md +++ /dev/null @@ -1,585 +0,0 @@ -## Functions - -
-
- attr(attribute, value)
-
- configMigrationHelper(state)
-
- create(resourceType, data, [options], [callback])
-
- destroy(resourceType, path, [data], [options], [callback])
-
- discover(httpMethod, endpoint)
-
- dv(dataElement, value)
-
- findAttributeValue(trackedEntityInstance, attributeDisplayName)
-
- get(resourceType, query, [options], [callback])
-
- patch(resourceType, path, data, [options], [callback])
-
- request(configuration, axiosRequest)
-
- selectId(resourceType)
-
- update(resourceType, path, data, [options], [callback])
-
- upsert(resourceType, query, data, [options], [callback])
-
- - -## attr - -attr(attribute, value) ⇒ object -Converts an attribute ID and value into a DSHI2 attribute object - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| attribute | string | A tracked entity instance (TEI) attribute ID. | -| value | string | The value for that attribute. | - -**Example** -```js -attr('w75KJ2mc4zz', 'Elias') -``` - -* * * - -## configMigrationHelper - -configMigrationHelper(state) ⇒ object -Migrates `apiUrl` to `hostUrl` if `hostUrl` is `blank`. -For `OpenFn.org` users with the `old-style configuration`. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| state | object | the runtime state | - -**Example** -```js -configMigrationHelper(state) -``` - -* * * - -## create - -create(resourceType, data, [options], [callback]) ⇒ Operation -Create a record - -**Kind**: global function -**Access**: public -**Magic**: resourceType $.children.resourceTypes[*] - -| Param | Type | Description | -| --- | --- | --- | -| resourceType | string | Type of resource to create. E.g. `trackedEntityInstances`, `programs`, `events`, ... | -| data | Dhis2Data | Object which defines data that will be used to create a given instance of resource. To create a single instance of a resource, `data` must be a javascript object, and to create multiple instances of a resources, `data` must be an array of javascript objects. | -| [options] | Object | Optional `options` to define URL parameters via params (E.g. `filter`, `dimension` and other import parameters), request config (E.g. `auth`) and the DHIS2 apiVersion. | -| [callback] | function | Optional callback to handle the response | - -**Example** *(a program)* -```js -create('programs', { - name: 'name 20', - shortName: 'n20', - programType: 'WITHOUT_REGISTRATION', -}); -``` -**Example** *(an event)* -```js -create('events', { - program: 'eBAyeGv0exc', - orgUnit: 'DiszpKrYNg8', - status: 'COMPLETED', -}); -``` -**Example** *(a trackedEntityInstance)* -```js -create('trackedEntityInstances', { - orgUnit: 'TSyzvBiovKh', - trackedEntityType: 'nEenWmSyUEp', - attributes: [ - { - attribute: 'w75KJ2mc4zz', - value: 'Gigiwe', - }, - ] -}); -``` -**Example** *(a dataSet)* -```js -create('dataSets', { name: 'OpenFn Data Set', periodType: 'Monthly' }); -``` -**Example** *(a dataSetNotification)* -```js -create('dataSetNotificationTemplates', { - dataSetNotificationTrigger: 'DATA_SET_COMPLETION', - notificationRecipient: 'ORGANISATION_UNIT_CONTACT', - name: 'Notification', - messageTemplate: 'Hello', - deliveryChannels: ['SMS'], - dataSets: [], -}); -``` -**Example** *(a dataElement)* -```js -create('dataElements', { - aggregationType: 'SUM', - domainType: 'AGGREGATE', - valueType: 'NUMBER', - name: 'Paracetamol', - shortName: 'Para', -}); -``` -**Example** *(a dataElementGroup)* -```js -create('dataElementGroups', { - name: 'Data Element Group 1', - dataElements: [], -}); -``` -**Example** *(a dataElementGroupSet)* -```js -create('dataElementGroupSets', { - name: 'Data Element Group Set 4', - dataDimension: true, - shortName: 'DEGS4', - dataElementGroups: [], -}); -``` -**Example** *(a dataValueSet)* -```js -create('dataValueSets', { - dataElement: 'f7n9E0hX8qk', - period: '201401', - orgUnit: 'DiszpKrYNg8', - value: '12', -}); -``` -**Example** *(a dataValueSet with related dataValues)* -```js -create('dataValueSets', { - dataSet: 'pBOMPrpg1QX', - completeDate: '2014-02-03', - period: '201401', - orgUnit: 'DiszpKrYNg8', - dataValues: [ - { - dataElement: 'f7n9E0hX8qk', - value: '1', - }, - { - dataElement: 'Ix2HsbDMLea', - value: '2', - }, - { - dataElement: 'eY5ehpbEsB7', - value: '3', - }, - ], -}); -``` -**Example** *(an enrollment)* -```js -create('enrollments', { - trackedEntityInstance: 'bmshzEacgxa', - orgUnit: 'TSyzvBiovKh', - program: 'gZBxv9Ujxg0', - enrollmentDate: '2013-09-17', - incidentDate: '2013-09-17', -}); -``` - -* * * - -## destroy - -destroy(resourceType, path, [data], [options], [callback]) ⇒ Operation -Delete a record. A generic helper function to delete an object - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| resourceType | string | The type of resource to be deleted. E.g. `trackedEntityInstances`, `organisationUnits`, etc. | -| path | string | Can be an `id` of an `object` or `path` to the `nested object` to `delete`. | -| [data] | Object | Optional. This is useful when you want to remove multiple objects from a collection in one request. You can send `data` as, for example, `{"identifiableObjects": [{"id": "IDA"}, {"id": "IDB"}, {"id": "IDC"}]}`. See more [on DHIS2 API docs](https://docs.dhis2.org/2.34/en/dhis2_developer_manual/web-api.html#deleting-objects) | -| [options] | Object | Optional `options` for `del` operation including params e.g. `{preheatCache: true, strategy: 'UPDATE', mergeMode: 'REPLACE'}`. Run `discover` or see [DHIS2 documentation](https://docs.dhis2.org/2.34/en/dhis2_developer_manual/web-api.html#create-update-parameters). Defaults to `{operationName: 'delete', apiVersion: state.configuration.apiVersion, responseType: 'json'}` | -| [callback] | function | Optional callback to handle the response | - -**Example** *(a tracked entity instance)* -```js -destroy('trackedEntityInstances', 'LcRd6Nyaq7T'); -``` - -* * * - -## discover - -discover(httpMethod, endpoint) ⇒ Operation -Discover `DHIS2` `api` `endpoint` `query parameters` and allowed `operators` for a given resource's endpoint. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| httpMethod | string | The HTTP to inspect parameter usage for a given endpoint, e.g., `get`, `post`,`put`,`patch`,`delete` | -| endpoint | string | The path for a given endpoint. E.g. `/trackedEntityInstances` or `/dataValueSets` | - -**Example** *(a list of parameters allowed on a given endpoint for specific http method)* -```js -discover('post', '/trackedEntityInstances') -``` - -* * * - -## dv - -dv(dataElement, value) ⇒ object -Converts a dataElement and value into a DSHI2 dataValue object - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| dataElement | string | A data element ID. | -| value | string | The value for that data element. | - -**Example** -```js -dv('f7n9E0hX8qk', 12) -``` - -* * * - -## findAttributeValue - -findAttributeValue(trackedEntityInstance, attributeDisplayName) ⇒ string -Gets an attribute value by its case-insensitive display name - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| trackedEntityInstance | Object | A tracked entity instance (TEI) object | -| attributeDisplayName | string | The 'displayName' to search for in the TEI's attributes | - -**Example** -```js -findAttributeValue(state.data.trackedEntityInstances[0], 'first name') -``` - -* * * - -## get - -get(resourceType, query, [options], [callback]) ⇒ Operation -Get data. Generic helper method for getting data of any kind from DHIS2. -- This can be used to get `DataValueSets`,`events`,`trackedEntityInstances`,`etc.` - -**Kind**: global function -**Returns**: Operation - state -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| resourceType | string | The type of resource to get(use its `plural` name). E.g. `dataElements`, `trackedEntityInstances`,`organisationUnits`, etc. | -| query | Object | A query object that will limit what resources are retrieved when converted into request params. | -| [options] | Object | Optional `options` to define URL parameters via params beyond filters, request configuration (e.g. `auth`) and DHIS2 api version to use. | -| [callback] | function | Optional callback to handle the response | - -**Example** *(all data values for the 'pBOMPrpg1QX' dataset)* -```js -get('dataValueSets', { - dataSet: 'pBOMPrpg1QX', - orgUnit: 'DiszpKrYNg8', - period: '201401', - fields: '*', -}); -``` -**Example** *(all programs for an organization unit)* -```js -get('programs', { orgUnit: 'TSyzvBiovKh', fields: '*' }); -``` -**Example** *(a single tracked entity instance by a unique external ID)* -```js -get('trackedEntityInstances', { - ou: 'DiszpKrYNg8', - filter: ['flGbXLXCrEo:Eq:124', 'w75KJ2mc4zz:Eq:John'], -}); -``` - -* * * - -## patch - -patch(resourceType, path, data, [options], [callback]) ⇒ Operation -Patch a record. A generic helper function to send partial updates on one or more object properties. -- You are not required to send the full body of object properties. -- This is useful for cases where you don't want or need to update all properties on a object. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| resourceType | string | The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc. | -| path | string | The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}` | -| data | Object | Data to update. Include only the fields you want to update. E.g. `{name: "New Name"}` | -| [options] | Object | Optional configuration, including params for the update ({preheatCache: true, strategy: 'UPDATE', mergeMode: 'REPLACE'}). Defaults to `{operationName: 'patch', apiVersion: state.configuration.apiVersion, responseType: 'json'}` | -| [callback] | function | Optional callback to handle the response | - -**Example** *(a dataElement)* -```js -patch('dataElements', 'FTRrcoaog83', { name: 'New Name' }); -``` - -* * * - -## request - -request(configuration, axiosRequest) ⇒ Promise -The request client takes configuration from state and an axios request object -then (1) logs the method and URL, (2) applies standard headers and auth -before spreading the rest of the axios configuration, and (3) executes an -axios request. - -**Kind**: global function -**Returns**: Promise - a promise that will resolve to either a response object or an error object. - -| Param | Type | Description | -| --- | --- | --- | -| configuration | object | configuration must have a username and password | -| axiosRequest | object | the axiosRequest contains valid axios params: https://axios-http.com/docs/req_config | - - -* * * - -## selectId - -selectId(resourceType) ⇒ string -Determines the attribute name for a DHIS2 system ID given a resource type. - -**Kind**: global function - -| Param | Type | -| --- | --- | -| resourceType | string | - - -* * * - -## update - -update(resourceType, path, data, [options], [callback]) ⇒ Operation -Update data. A generic helper function to update a resource object of any type. -Updating an object requires to send `all required fields` or the `full body` - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| resourceType | string | The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc. | -| path | string | The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}` | -| data | Object | Data to update. It requires to send `all required fields` or the `full body`. If you want `partial updates`, use `patch` operation. | -| [options] | Object | Optional `options` to define URL parameters via params (E.g. `filter`, `dimension` and other import parameters), request config (E.g. `auth`) and the DHIS2 apiVersion. | -| [callback] | function | Optional callback to handle the response | - -**Example** *(a program)* -```js -update('programs', 'qAZJCrNJK8H', { - name: '14e1aa02c3f0a31618e096f2c6d03bed', - shortName: '14e1aa02', - programType: 'WITHOUT_REGISTRATION', -}); -``` -**Example** *(an event)* -```js -update('events', 'PVqUD2hvU4E', { - program: 'eBAyeGv0exc', - orgUnit: 'Ngelehun CHC', - status: 'COMPLETED', - storedBy: 'admin', - dataValues: [], -}); -``` -**Example** *(a trackedEntityInstance)* -```js -update('trackedEntityInstances', 'IeQfgUtGPq2', { - created: '2015-08-06T21:12:37.256', - orgUnit: 'TSyzvBiovKh', - createdAtClient: '2015-08-06T21:12:37.256', - trackedEntityInstance: 'IeQfgUtGPq2', - lastUpdated: '2015-08-06T21:12:37.257', - trackedEntityType: 'nEenWmSyUEp', - inactive: false, - deleted: false, - featureType: 'NONE', - programOwners: [ - { - ownerOrgUnit: 'TSyzvBiovKh', - program: 'IpHINAT79UW', - trackedEntityInstance: 'IeQfgUtGPq2', - }, - ], - enrollments: [], - relationships: [], - attributes: [ - { - lastUpdated: '2016-01-12T00:00:00.000', - displayName: 'Last name', - created: '2016-01-12T00:00:00.000', - valueType: 'TEXT', - attribute: 'zDhUuAYrxNC', - value: 'Russell', - }, - { - lastUpdated: '2016-01-12T00:00:00.000', - code: 'MMD_PER_NAM', - displayName: 'First name', - created: '2016-01-12T00:00:00.000', - valueType: 'TEXT', - attribute: 'w75KJ2mc4zz', - value: 'Catherine', - }, - ], -}); -``` -**Example** *(a dataSet)* -```js -update('dataSets', 'lyLU2wR22tC', { name: 'OpenFN Data Set', periodType: 'Weekly' }); -``` -**Example** *(a dataSetNotification)* -```js -update('dataSetNotificationTemplates', 'VbQBwdm1wVP', { - dataSetNotificationTrigger: 'DATA_SET_COMPLETION', - notificationRecipient: 'ORGANISATION_UNIT_CONTACT', - name: 'Notification', - messageTemplate: 'Hello Updated, - deliveryChannels: ['SMS'], - dataSets: [], -}); -``` -**Example** *(a dataElement)* -```js -update('dataElements', 'FTRrcoaog83', { - aggregationType: 'SUM', - domainType: 'AGGREGATE', - valueType: 'NUMBER', - name: 'Paracetamol', - shortName: 'Para', -}); -``` -**Example** *(a dataElementGroup)* -```js -update('dataElementGroups', 'QrprHT61XFk', { - name: 'Data Element Group 1', - dataElements: [], -}); -``` -**Example** *(a dataElementGroupSet)* -```js -update('dataElementGroupSets', 'VxWloRvAze8', { - name: 'Data Element Group Set 4', - dataDimension: true, - shortName: 'DEGS4', - dataElementGroups: [], -}); -``` -**Example** *(a dataValueSet)* -```js -update('dataValueSets', 'AsQj6cDsUq4', { - dataElement: 'f7n9E0hX8qk', - period: '201401', - orgUnit: 'DiszpKrYNg8', - value: '12', -}); -``` -**Example** *(a dataValueSet with related dataValues)* -```js -update('dataValueSets', 'Ix2HsbDMLea', { - dataSet: 'pBOMPrpg1QX', - completeDate: '2014-02-03', - period: '201401', - orgUnit: 'DiszpKrYNg8', - dataValues: [ - { - dataElement: 'f7n9E0hX8qk', - value: '1', - }, - { - dataElement: 'Ix2HsbDMLea', - value: '2', - }, - { - dataElement: 'eY5ehpbEsB7', - value: '3', - }, - ], -}); -``` -**Example** *(a single enrollment)* -```js -update('enrollments', 'CmsHzercTBa' { - trackedEntityInstance: 'bmshzEacgxa', - orgUnit: 'TSyzvBiovKh', - program: 'gZBxv9Ujxg0', - enrollmentDate: '2013-10-17', - incidentDate: '2013-10-17', -}); -``` - -* * * - -## upsert - -upsert(resourceType, query, data, [options], [callback]) ⇒ Operation -Upsert a record. A generic helper function used to atomically either insert a row, or on the basis of the row already existing, UPDATE that existing row instead. - -**Kind**: global function -**Throws**: - -- RangeError - Throws range error - -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| resourceType | string | The type of a resource to `upsert`. E.g. `trackedEntityInstances` | -| query | Object | A query object that allows to uniquely identify the resource to update. If no matches found, then the resource will be created. | -| data | Object | The data to use for update or create depending on the result of the query. | -| [options] | Object | Optional configuration that will be applied to both the `get` and the `create` or `update` operations. | -| [callback] | function | Optional callback to handle the response | - -**Example** *(Example `expression.js` of upsert)* -```js -upsert('trackedEntityInstances', { - ou: 'TSyzvBiovKh', - filter: ['w75KJ2mc4zz:Eq:Qassim'], -}, { - orgUnit: 'TSyzvBiovKh', - trackedEntityType: 'nEenWmSyUEp', - attributes: [ - { - attribute: 'w75KJ2mc4zz', - value: 'Qassim', - }, - ], -}); -``` - -* * * - diff --git a/docs/docs.json b/docs/docs.json deleted file mode 100644 index 7c9c38eaf..000000000 --- a/docs/docs.json +++ /dev/null @@ -1,50 +0,0 @@ -[ -{"name":"asana","adaptor":"@openfn/language-asana","version":"3.0.1","docs":"\"## Functions\\n\\n
\\n
\\n createTask(params, callback)
\\n
\\n getTask(taskGid, params, callback)
\\n
\\n getTasks(projectGid, params, callback)
\\n
\\n updateTask(taskGid, params, callback)
\\n
\\n upsertTask(projectGid, params, callback)
\\n
\\n\\n\\n## createTask\\n\\ncreateTask(params, callback) ⇒ Operation\\nCreate a task.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Body parameters |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ncreateTask(\\n {\\n name: 'test', \\\"approval_status\\\": \\\"pending\\\", \\\"assignee\\\": \\\"12345\\\"\\n }\\n)\\n```\\n\\n* * *\\n\\n## getTask\\n\\ngetTask(taskGid, params, callback) ⇒ Operation\\nGet a single task of a given project.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| taskGid | string | Globally unique identifier for the task |\\n| params | object | Query params to include. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ngetTask(\\\"taskGid\\\",\\n {\\n opt_fields: \\\"name,notes,assignee\\\"\\n })\\n```\\n\\n* * *\\n\\n## getTasks\\n\\ngetTasks(projectGid, params, callback) ⇒ Operation\\nGet the list of tasks for a given project.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| projectGid | string | Globally unique identifier for the project |\\n| params | object | Query params to include. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ngetTasks(\\\"projectGid\\\",\\n {\\n opt_fields: \\\"name,notes,assignee\\\"\\n })\\n```\\n\\n* * *\\n\\n## updateTask\\n\\nupdateTask(taskGid, params, callback) ⇒ Operation\\nUpdate a specific task.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| taskGid | string | Globally unique identifier for the task |\\n| params | object | Body parameters |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nupdateTask(\\\"taskGid\\\",\\n {\\n name: 'test', \\\"approval_status\\\": \\\"pending\\\", \\\"assignee\\\": \\\"12345\\\"\\n }\\n)\\n```\\n\\n* * *\\n\\n## upsertTask\\n\\nupsertTask(projectGid, params, callback) ⇒ Operation\\nUpdate or create a task.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| projectGid | string | Globally unique identifier for the project |\\n| params | object | an object with an externalId and some task data. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nupsertTask(\\n \\\"1201382240880\\\",\\n {\\n \\\"externalId\\\": \\\"name\\\",\\n \\\"data\\\": {\\n name: 'test', \\\"approval_status\\\": \\\"pending\\\", \\\"assignee\\\": \\\"12345\\\"\\n }\\n\\n }\\n)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-asana\\n\\nLanguage Pack for connecting with Asana.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/asana-configuration-schema/)\\ndefinition.\\n\\n### How to create an API token\\n\\nUsing Asana's API requires having an API token. To generate that token, head to\\nthe [Asana developer console](https://app.asana.com/0/developer-console) and\\nenter the **Personal access tokens** section.\\n\\nThere you can click on **+New access token**. A prompt will be opened allowing\\nyou to give the token a name and then create it.\\n\\n_Note: Treat your PAT like you would with a password. Do not share it or display\\nit online._\\n\\n### Sample expression\\n\\n## Find a single task of a given project using the task id.\\n\\n```js\\ngetTask('1234', {\\n opt_fields: 'name,assignee',\\n});\\n```\\n\\n## Find the list of tasks of a given project using the project id.\\n\\n```js\\ngetTasks('22889593722', {\\n opt_fields: 'name,notes,assignee',\\n});\\n```\\n\\n## Update a specific task\\n\\n```js\\nupdateTask('12344', {\\n name: 'test',\\n approval_status: 'pending',\\n assignee: '12345',\\n});\\n```\\n\\n## Create a task\\n\\n```js\\ncreateTask({\\n name: 'test',\\n approval_status: 'pending',\\n assignee: '12345',\\n});\\n```\\n\\n## Update a task or create a new one\\n\\nYou can use a field name literal as `externalId` to match a specific task. If\\nthe task does not exist, a new one will be created. The first parameter in this\\nfunction should be the `project_id`.\\n\\n```js\\nupsertTask('12344', {\\n externalId: 'name',\\n data: {\\n name: 'A new task',\\n projects: ['12344'],\\n notes: 'This is a new task',\\n },\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-asana\\n\\n## 3.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 3.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 2.1.6\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 2.1.5\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 2.1.4\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 2.1.3\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 2.1.2\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 2.1.1\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 2.1.0\\n\\n### Minor Changes\\n\\n- 5f40dcf: Migrated language-asana\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\"","functions":["createTask","getTask","getTasks","updateTask","upsertTask"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"apiVersion":{"title":"API Version","type":"string","description":"The API version","examples":["1.0"]},"token":{"title":"Token","type":"string","description":"The API token","examples":["sample-tokenyWSJdXBACMLLWMNGgADFA"]}},"type":"object","additionalProperties":true,"required":["apiVersion","token"]}}, -{"name":"azure-storage","adaptor":"@openfn/language-azure-storage","version":"1.0.0","docs":"\"## Functions\\n\\n
\\n
\\n downloadBlob(blobName, [options])
\\n
\\n getBlobProperties(blobName, options)
\\n
\\n uploadBlob(blobName, content, uploadOptions, [options])
\\n
\\n\\n\\n## downloadBlob\\n\\ndownloadBlob(blobName, [options]) ⇒ Operation\\nDownload a blob from Azure Blob Storage.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| blobName | string | | Name of the blob to download. |\\n| [options] | Object | {} | Additional options for the download process. |\\n\\n**Example** \\n```js\\ndownloadBlob('mycontainer', 'myblob.txt', { downloadAs: 'string' })\\n```\\n\\n* * *\\n\\n## getBlobProperties\\n\\ngetBlobProperties(blobName, options) ⇒ Operation\\nGet properties of a blob in Azure Blob Storage.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| blobName | string | Name of the blob to get properties for. |\\n| options | string | Additional options for the getBlobProperties process. |\\n\\n**Example** \\n```js\\ngetBlobProperties('mycontainer', 'myblob.txt')\\n```\\n\\n* * *\\n\\n## uploadBlob\\n\\nuploadBlob(blobName, content, uploadOptions, [options]) ⇒ Operation\\nUpload content to Azure Blob Storage.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| blobName | string | | Name of the blob to create or replace. |\\n| content | string | | Content to upload. |\\n| uploadOptions | object | | See BlockBlobUploadOptions in Azure Blob Storage docs |\\n| [options] | Object | {} | Additional options for the upload process. |\\n| [options.createContainer] | boolean | false | Whether to create the container if it doesn't exist. |\\n| [options.overwrite] | boolean | false | Whether to overwrite an existing blob with the same name. |\\n| [options.containerName] | string | | Container name. Overrides state.configuration. |\\n\\n**Example** \\n```js\\nuploadBlob('mycontainer', 'myblob.txt', {foo:\\\"bar\\\"}, { blobHTTPHeaders: { blobContentType: 'application/json' } })\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-azure-storage \\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the Azure\\nStorage APIs. At present, this adaptor only supports the Azure Blob Storage,\\nAPI, but could be expanded for future Azure Storage services (e.g., Files,\\nTables, Queues, etc.).\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/azure-storage-docs)\\nfor full technical documentation.\\n\\n### Configuration\\n\\nView the\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/azure-storage-configuration-schema/)\\nfor required and optional `configuration` properties.\\n\\n### An example showing multiple capabilties of this adaptor\\n\\nAssume you have a simple `state.json` file as follows:\\n\\n```json\\n{\\n \\\"data\\\": {\\n\\t\\\"foo\\\": \\\"bar\\\",\\n\\t\\\"bif\\\": \\\"baz\\\",\\n\\t\\\"sunday\\\": \\\"monday\\\",\\n\\t\\\"answer\\\": \\\"42\\\"\\n },\\n \\\"configuration\\\": {\\n \\\"accountName\\\": \\\"myaccountname\\\",\\n \\\"accountKey\\\": \\\"myaccountkey\\\",\\n \\\"containerName\\\": \\\"mycontainer\\\"\\n }\\n}\\n```\\n\\nCreate a file `job.js`, as shown below, to run with the OpenFn CLI. This\\nexample uploads the blob with a year/month partitioning scheme, then\\ndownloads the same blob and fetches the blob properties. It would be extremely\\nunusual to perform all of these actions in a single job.\\n\\n```js\\nuploadBlob(\\n state => {\\n const date = new Date();\\n const id = '0e82962a-6ed0-4a88-92c1-51ae785b4126';\\n return `${date.getFullYear()}/${date.getMonth() + 1}/${id}.json`;\\n },\\n state.data,\\n {\\n blobHTTPHeaders: { blobContentType: 'application/json' }\\n },\\n { createContainer: true, overwrite: true }\\n);\\n\\ndownloadBlob(\\n dataValue('blobName');\\n);\\n\\ngetBlobProperties(\\n state => {\\n return state.references[1].blobName;\\n }\\n);\\n```\\n\\nRun the job as follows:\\n\\n```bash\\nopenfn job -a azure-storage -s state.json -O\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n\\\"Getting Started\\\" guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build _only_ the docs run `pnpm build docs`.\\n\"","changelog":"\"# @openfn/language-azure-storage\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\nIntial adaptor release with support for Blob storage.\\n\\n- uploadBlob\\n- downloadBlob\\n- getBlobProperties\\n\"","functions":["downloadBlob","getBlobProperties","uploadBlob"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountName":{"title":"Account Name","type":"string","description":"Azure Storage Account Name","examples":["examplestorageaccount01"]},"accountKey":{"title":"Account Key","type":"string","description":"Azure Account Key","writeOnly":true,"examples":["zzUx5rA4BZkjPet8ztLTEll7azF65Sez7WxGKsJv5B+rp/dby8ARgYpEVe93xFCQDqGBi3FUlxjP+ASt4uepZg=="]},"containerName":{"title":"Container Name","type":"string","description":"Name of Azure Blob Storage Container","writeOnly":true,"examples":["mycontainername"]}},"type":"object","additionalProperties":true,"required":["accountName","accountKey"]}}, -{"name":"beyonic","adaptor":"@openfn/language-beyonic","version":"0.2.1","docs":"\"## Functions\\n\\n
\\n
\\n createCollectionRequest(data)
\\n
\\n createContact(data)
\\n
\\n createPayment(data)
\\n
\\n\\n\\n## createCollectionRequest\\n\\ncreateCollectionRequest(data) ⇒ Operation\\nCreate a collection request\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | Payload data for the collection request |\\n\\n**Example** \\n```js\\nexecute(\\n createCollectionRequest(data)\\n)(state)\\n```\\n\\n* * *\\n\\n## createContact\\n\\ncreateContact(data) ⇒ Operation\\nCreate a contact\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | Payload data for the contact |\\n\\n**Example** \\n```js\\nexecute(\\n createContact(data)\\n)(state)\\n```\\n\\n* * *\\n\\n## createPayment\\n\\ncreatePayment(data) ⇒ Operation\\nCreate a payment\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | Payload data for the payment |\\n\\n**Example** \\n```js\\nexecute(\\n createPayment(data)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Beyonic\\n\\nLanguage Pack for building expressions and operations for working with the\\n[beyonic API](http://apidocs.beyonic.com/).\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/beyonic-configuration-schema/)\\ndefinition.\\n\\n## Payments API\\n\\n#### `createPayment(...)`\\n\\n```js\\ncreatePayment(\\n fields(\\n field('phonenumber', '+256773712831'),\\n field('first_name', 'Gideon'),\\n field('last_name', 'Zelalem'),\\n field('amount', 100.2),\\n field('currency', 'USD'),\\n field('account', 1),\\n field('description', 'Long-term contract for Arseal'),\\n field('payment_type', 'money'),\\n field('callback_url', 'https://my.website/payments/callback')\\n )\\n);\\n```\\n\\n## Collection Requests API\\n\\n#### `createCollectionRequest(...)`\\n\\n```js\\ncreateCollectionRequest(\\n fields(\\n field('instructions', 'Send me some money, please!'),\\n field('phonenumber', '+256773712831'),\\n field('amount', 5.0),\\n field('currency', 'USD')\\n )\\n);\\n```\\n\\n## Contacts API\\n\\n#### `createContact(...)`\\n\\n```js\\ncreateContact(\\n fields(\\n field('first_name', 'Granit'),\\n field('last_name', 'Xhaka'),\\n field('phone_number', '+256773712831'),\\n field('email', 'granit@arsenal.com')\\n )\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-beyonic\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.1.9\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.1.8\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.1.7\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.1.6\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.1.5\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 0.1.4\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 0.1.3\\n\\n### Patch Changes\\n\\n- 63080d0: Update common for build\\n\\n## 0.1.2\\n\\n### Patch Changes\\n\\n- 0d358b6: Add ast.json for beyonic\\n\\n## 0.1.1\\n\\n### Patch Changes\\n\\n- 06ff25f: Update superagent to v8\\n\\n## 0.1.0\\n\\n### Minor Changes\\n\\n- 28ceb1f: Moving language-beyonic to adaptors/packages/beyonic\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"apiUrl":{"title":"API URL","type":"string","description":"API URL","format":"uri","minLength":1,"examples":["https://beyonic.com/api"]},"apiToken":{"title":"API Token","type":"string","description":"API token","minLength":1,"examples":["cdjhiooiSIUJHDYSYUIHASIOHKAANOAJJjsiujhaka"]}},"type":"object","additionalProperties":true,"required":["apiUrl","apiToken"]}}, -{"name":"bigquery","adaptor":"@openfn/language-bigquery","version":"2.0.4","docs":"\"## load\\n\\nload(dirPath, projectId, datasetId, tableId, loadOptions, callback) ⇒ Operation\\nLoad files to BigQuery\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| dirPath | string | the path to your local directory |\\n| projectId | string | your bigquery project id |\\n| datasetId | string | your bigquery dataset id |\\n| tableId | string | the name of the table you'd like to load |\\n| loadOptions | object | options to pass to the bigquery.load() API |\\n| callback | function | and optional callback |\\n\\n**Example** \\n```js\\nload(\\n './tmp/files',\\n 'my-bg-project',\\n 'test01',\\n 'product-codes',\\n {\\n schema: 'FREQ:STRING,DATATYPE:STRING,PRODUCTCODE:STRING,PARTNER:STRING',\\n writeDisposition: 'WRITE_APPEND',\\n skipLeadingRows: 1,\\n schemaUpdateOptions: ['ALLOW_FIELD_ADDITION'],\\n createDisposition: 'CREATE_IF_NEEDED',\\n }\\n)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language BigQuery\\n\\nLanguage Pack for building expressions and operations to make HTTP calls.\\n\\n## Documentation\\n\\n### state.json\\n\\nThe configuration key must be a valid GCP credential as JSON.\\n\\n```json\\n{\\n \\\"configuration\\\": {\\n \\\"type\\\": \\\"service_account\\\",\\n \\\"project_id\\\": \\\"some-project\\\",\\n \\\"private_key_id\\\": \\\"670b9e3c8c366e83aa569dd57cbfc5c575b72e42\\\",\\n \\\"private_key\\\": \\\"-----BEGIN PRIVATE KEY-----\\\\nblah\\\\nmoreblah=\\\\n-----END PRIVATE KEY-----\\\\n\\\",\\n \\\"client_email\\\": \\\"bigquery@some-project.iam.gserviceaccount.com\\\",\\n \\\"client_id\\\": \\\"someid\\\",\\n \\\"auth_uri\\\": \\\"https://accounts.google.com/o/oauth2/auth\\\",\\n \\\"token_uri\\\": \\\"https://oauth2.googleapis.com/token\\\",\\n \\\"auth_provider_x509_cert_url\\\": \\\"https://www.googleapis.com/oauth2/v1/certs\\\",\\n \\\"client_x509_cert_url\\\": \\\"https://www.googleapis.com/robot/v1/metadata/x509/bigquery%40some-project.iam.gserviceaccount.com\\\"\\n },\\n \\\"data\\\": { \\\"a\\\": 1 }\\n}\\n```\\n\\n### operations (expression.js)\\n\\n#### load(...)\\n\\nLoad data to a table in bigquery from a CSV. See full\\n[options here](https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad).\\n\\n```js\\nload(\\n '/home/taylor/Desktop/type-C_r-ALL_ps-201012_freq-M_px-HS_pub-20200731_fmt-csv_ex-20200818.csv',\\n 'awesome-solutions-project', // project\\n 'test01', // dataset\\n 'mytable', // table\\n {\\n schema:\\n 'classification:STRING,year:STRING,period:STRING,period_desc:STRING,aggregate_level:STRING,is_leaf_code:STRING,trade_flow_code:STRING,trade_flow:STRING,reporter_code:STRING,reporter:STRING,reporter_iso:STRING,partner_code:STRING,partner:STRING,partner_iso:STRING,commodity_code:STRING,commodity:STRING,qty_unit_code:STRING,qty_unit:STRING,qty:INTEGER,netweight_kg:INTEGER,trade_value:INTEGER,flag:STRING',\\n schemaUpdateOptions: ['ALLOW_FIELD_ADDITION'],\\n // createDisposition: 'CREATE_IF_NEEDED',\\n writeDisposition: 'WRITE_APPEND',\\n skipLeadingRows: 1,\\n } // loadOptions\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-bigquery\\n\\n## 2.0.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 2.0.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 2.0.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 2.0.1\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 2.0.0\\n\\n### Major Changes\\n\\n- 0b6f20b: use parseCsv from common\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 1.2.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 1.2.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 1.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.1.5\\n\\n### Patch Changes\\n\\n- 5895eb9: update dependencies\\n\\n## 1.1.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 1.1.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.1.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n- 57f3513: Fix exports in index.js\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- e4c6114: bigquery migration and build\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":["load"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","additionalProperties":true,"properties":{"type":{"title":"Type","type":"string","description":"","examples":["service_acconut"]},"project_id":{"title":"Prokect id","type":"string","description":"Project id","examples":["some-project-id"]},"private_key_id":{"title":"Private Key Id","type":"string","description":"Private key id","examples":["670b9e3c8c366e83aa569dd57cbfc5c575b72e42"]},"private_key":{"title":"Private Key","type":"string","description":"Private key","examples":["-----BEGIN PRIVATE KEY-----\nblah\nmoreblah=\n-----END PRIVATE KEY-----\n"]},"client_email":{"title":"Client Email","type":"string","description":"Client email","examples":["bigquery@some-project.iam.gserviceaccount.com"]},"client_id":{"title":"Client Id","type":"string","description":"Client id","examples":["someid"]},"auth_uri":{"title":"Auth Uri","type":"string","description":"Auth Uri","examples":["https://accounts.google.com/o/oauth2/auth"]},"token_uri":{"title":"Token Uri","type":"string","description":"Token Uri","examples":["https://oauth2.googleapis.com/token"]},"auth_provider_x509_cert_url":{"title":"Auth Provider x509 Cert Url","type":"string","description":"","examples":["https://www.googleapis.com/oauth2/v1/certs"]},"client_x509_cert_url":{"title":"Client x509 Cert Url","type":"string","description":"","examples":["https://www.googleapis.com/robot/v1/metadata/x509/bigquery%40some-project.iam.gserviceaccount.com"]}},"required":["type","project_id","private_key_id","private_key","client_email","client_id","auth_uri","token_uri","auth_provider_x509_cert_url","client_x509_cert_url"]}}, -{"name":"commcare","adaptor":"@openfn/language-commcare","version":"1.6.10","docs":"\"## Functions\\n\\n
\\n
\\n clientPost(formData)
\\n
\\n fetchReportData(reportId, params, postUrl)
\\n
\\n submit(formData)
\\n
\\n submitXls(formData, params)
\\n
\\n\\n\\n## clientPost\\n\\nclientPost(formData) ⇒ State\\nPerforms a post request\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| formData | Object | Form Data with auth params and body |\\n\\n**Example** \\n```js\\nclientPost(formData)\\n```\\n\\n* * *\\n\\n## fetchReportData\\n\\nfetchReportData(reportId, params, postUrl) ⇒ Operation\\nMake a GET request to CommCare's Reports API\\nand POST the response to somewhere else.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| reportId | String | API name of the report. |\\n| params | Object | Query params, incl: limit, offset, and custom report filters. |\\n| postUrl | String | Url to which the response object will be posted. |\\n\\n**Example** \\n```js\\nfetchReportData(reportId, params, postUrl)\\n```\\n\\n* * *\\n\\n## submit\\n\\nsubmit(formData) ⇒ Operation\\nSubmit form data\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| formData | Object | Object including form data. |\\n\\n**Example** \\n```js\\nsubmit(\\n fields(\\n field(\\\"@\\\", function(state) {\\n return {\\n \\\"xmlns\\\": \\\"http://openrosa.org/formdesigner/form-id-here\\\"\\n };\\n }),\\n field(\\\"question1\\\", dataValue(\\\"answer1\\\")),\\n field(\\\"question2\\\", \\\"Some answer here.\\\")\\n )\\n )\\n```\\n\\n* * *\\n\\n## submitXls\\n\\nsubmitXls(formData, params) ⇒ Operation\\nConvert form data to xls then submit.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| formData | Object | Object including form data. |\\n| params | Object | Request params including case type and external id. |\\n\\n**Example** \\n```js\\nsubmitXls(\\n [\\n {name: 'Mamadou', phone: '000000'},\\n ],\\n {\\n case_type: 'student',\\n search_field: 'external_id',\\n create_new_cases: 'on',\\n }\\n)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language CommCare\\n\\nLanguage Pack for interacting with the CommCare API.\\n\\nhttps://confluence.dimagi.com/display/commcarepublic/Download+Report+Data\\n\\nhttps://confluence.dimagi.com/display/commcarepublic/Submission+API\\n\\nhttps://bitbucket.org/javarosa/javarosa/wiki/FormSubmissionAPI\\n\\nAccepted X-Form Spec from Dimagi: http://dimagi.github.io/xform-spec Accepted\\nX-Form Spec for Cases from Dimagi:\\nhttps://github.com/dimagi/commcare/wiki/casexml20\\n\\n## Documentation\\n\\n## Configuration\\n\\nView all the required and optional properties for `state.configuration` in the official [configuration-schema](https://docs.openfn.org/adaptors/packages/commcare-configuration-schema/) definition.\\n\\n- The \\\"appId\\\" is the UUID which designates your commcare project as different from\\neveryone elses. It can be found in the URL of your application when you first\\nenter it from the project screen. I.e., the last part of this url:\\n`https://www.commcarehq.org/a/YOUR_PROJECT/apps/view/YOUR_APP_ID/`\\n\\n- Note that the username is your full email address.\\n\\n## `fetchReportData` to pull aggregate data from CommCare\\n\\nIt takes 3 arguments: reportId, params, and postUrl.\\n\\n```js\\nfetchReportData(\\n 'reportId',\\n { limit: 10, offset: 2, state: 'Vermont' },\\n 'http://www.openfn.org/inbox/secret-uuid'\\n);\\n```\\n\\nsimple body target:\\n\\n```xml\\n\\n Something\\n Else\\n 29\\n\\n```\\n\\ncomplex body target:\\n\\n```xml\\n\\n\\n bar\\n \\n \\n bar\\n user-xxx-eve\\n member\\n \\n \\n \\n A00000245706EE\\n 2013-04-19T16:52:41.000-04\\n 2013-04-19T16:53:02.799-04\\n eve\\n user-xxx-eve\\n b58df19c-efd5-4ecf-9581-65dda8b8787c\\n CommCare ODK, version \\\"2.4.1\\\"(10083). App v19. CommCare Version 2.4. Build 10083, built on: March-12-2013\\n \\n\\n```\\n\\n## Submitting data to CommCare HQ\\n\\n### Submit an XLS file\\n\\nThis function bulk submit a JSON object as xls file to CommCare HQ\\n\\n```js\\nsubmitXls([{ name: 'Mamadou', phone: '000000' }], {\\n case_type: 'student',\\n search_field: 'external_id',\\n create_new_cases: 'on',\\n});\\n```\\n\\n### submit\\n\\nHere we're just building the most basic JSON object, that will be converted to\\nan XML object and posted as the element.\\n\\n```js\\nsubmit(\\n fields(\\n field('@', function (state) {\\n return {\\n xmlns:\\n 'http://openrosa.org/formdesigner/2BCC3E88-2D0D-4C07-8D4A-6B372F3799D9',\\n };\\n }),\\n field('paitent_namentosh', dataValue('first_name')),\\n field('question2', 'Some answer here.'),\\n field('question3', 'HKS'),\\n field('question4', 'item1'),\\n field('question5', 69855),\\n field('question6', 12)\\n )\\n);\\n```\\n\\nAn open rosa form submission body should look like this:\\n\\n```xml\\n\\n\\n Taylor\\n Moruki\\n Hks\\n item1\\n 69855\\n 12\\n \\n 358239055789384\\n 2015-08-21T16:21:59.807+02\\n 2015-08-21T16:22:15.987+02\\n openfn\\n 5fe615b3af2834cb5dca59f7466d6174\\n 195e79eb-d823-46fe-9e4f-59b8327d5db2\\n CommCare ODK, version "2.22.0"(370023). App v9. CommCare Version 2.22. Build 370023, built on: July-22-2015\\n \\n\\n```\\n\\nSo the JSON emitted by your expression should look like this:\\n\\n```json\\n{\\n \\\"data\\\": {\\n \\\"name\\\": \\\"Patient Registration\\\",\\n \\\"uiVersion\\\": \\\"1\\\",\\n \\\"version\\\": \\\"9\\\",\\n \\\"xmlns\\\": \\\"http://openrosa.org/formdesigner/2BCC3E88-2D0D-4C07-8D4A-6B372F3799D9\\\",\\n \\\"xmlns:jrm\\\": \\\"http://dev.commcarehq.org/jr/xforms\\\",\\n \\\"paitent_namentosh\\\": \\\"Taylor\\\",\\n \\\"question2\\\": \\\" Moruki\\\",\\n \\\"question3\\\": \\\"Hks\\\",\\n \\\"question4\\\": \\\"item1\\\",\\n \\\"question5\\\": \\\"69855\\\",\\n \\\"question6\\\": \\\"12\\\",\\n \\\"n0:meta\\\": {\\n \\\"xmlns:n0\\\": \\\"http://openrosa.org/jr/xforms\\\",\\n \\\"n0:deviceID\\\": \\\"358239055789384\\\",\\n \\\"n0:timeStart\\\": \\\"2015-08-21T16:21:59.807+02\\\",\\n \\\"n0:timeEnd\\\": \\\"2015-08-21T16:22:15.987+02\\\",\\n \\\"n0:username\\\": \\\"openfn\\\",\\n \\\"n0:userID\\\": \\\"5fe615b3af2834cb5dca59f7466d6174\\\",\\n \\\"n0:instanceID\\\": \\\"195e79eb-d823-46fe-9e4f-59b8327d5db2\\\",\\n \\\"n1:appVersion\\\": {\\n \\\"xmlns:n1\\\": \\\"http://commcarehq.org/xforms\\\",\\n \\\"$t\\\": \\\"CommCare ODK, version \\\\\\\"2.22.0\\\\\\\"(370023). App v9. CommCare Version 2.22. Build 370023, built on: July-22-2015\\\"\\n }\\n }\\n }\\n}\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-commcare\\n\\n## 1.6.10\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n - @openfn/language-http@5.0.4\\n\\n## 1.6.9\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n - @openfn/language-http@5.0.3\\n\\n## 1.6.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n - @openfn/language-http@5.0.2\\n\\n## 1.6.7\\n\\n### Patch Changes\\n\\n- 52c02c8: update xlsx package\\n\\n## 1.6.6\\n\\n### Patch Changes\\n\\n- 8205673: update superagent\\n\\n## 1.6.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n - @openfn/language-http@5.0.1\\n\\n## 1.6.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [0b6f20b]\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-http@5.0.0\\n - @openfn/language-common@1.10.1\\n\\n## 1.6.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n - @openfn/language-http@4.3.3\\n\\n## 1.6.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n - @openfn/language-http@4.3.2\\n\\n## 1.6.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n - @openfn/language-http@4.3.1\\n\\n## 1.6.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n - @openfn/language-http@4.3.0\\n\\n## 1.5.6\\n\\n### Patch Changes\\n\\n- e0406fa: update dependencies\\n\\n## 1.5.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n - @openfn/language-http@4.2.8\\n\\n## 1.5.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n- Updated dependencies [14f481e]\\n - @openfn/language-common@1.7.6\\n - @openfn/language-http@4.2.7\\n\\n## 1.5.3\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n- Updated dependencies [f2aed32]\\n - @openfn/language-http@4.2.5\\n\\n## 1.5.2\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n- 57f3513: Fix exports in index.js\\n- Updated dependencies [6d8de03]\\n - @openfn/language-http@4.2.4\\n\\n## 1.5.1\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n - @openfn/language-http@4.2.3\\n\\n## 1.5.0\\n\\n### Minor Changes\\n\\n- 5c050ed: Migrate CommCare\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- 94076b9: update dependency xlsx to ^0.18.0\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [9a2755e]\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-http@4.2.2\\n - @openfn/language-common@1.7.4\\n\"","functions":["fetchReportData","submit","submitXls"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"hostUrl":{"title":"Host URL","type":"string","description":"The CommCare host url","format":"uri","minLength":1,"examples":["https://www.commcarehq.org"]},"applicationName":{"title":"Application Name","type":"string","description":"The CommCare application name","minLength":1,"examples":["some-proof-of-concept"]},"appId":{"title":"App ID","type":"string","description":"Your CommCare project UUID","minLength":1,"examples":["the-long-uuid-in-the-url-that-designates-a-unique-commcare-project"]},"username":{"title":"Username","type":"string","description":"The username to log in to CommCare","minLength":1,"examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"The password to log in to CommCare","writeOnly":true,"minLength":1,"examples":["superscretepassword"]}},"type":"object","additionalProperties":true,"required":["hostUrl","applicationName","appId"]}}, -{"name":"common","adaptor":"@openfn/language-common","version":"1.12.0","docs":"\"## Functions\\n\\n
\\n
\\n alterState(func)
\\n
\\n arrayToString(arr, separator)
\\n
\\n asData(data, state)
\\n
\\n chunk(array, chunkSize)
\\n
\\n combine(operations)
\\n
\\n composeNextState(state, response)
\\n
\\n dataPath(path)
\\n
\\n dataValue(path)
\\n
\\n del(requestParams)
\\n
\\n each(dataSource, operation)
\\n
\\n each(dataSource, operation)
\\n
\\n expandReferences(value, [skipFilter])
\\n
\\n expandRequestReferences(value)
\\n
\\n field(key, value)
\\n
\\n fields(fields)
\\n
\\n fn(func)
\\n
\\n get(requestParams)
\\n
\\n head(requestParams)
\\n
\\n humanProper(str)
\\n
\\n index()
\\n
\\n join(targetPath, sourcePath, targetKey)
\\n
\\n jsonValue(obj, path)
\\n
\\n lastReferenceValue(path)
\\n
\\n map(path, operation, state)
\\n
\\n merge(dataSource, fields)
\\n
\\n options(requestParams)
\\n
\\n parseCsv(csvData, [parsingOptions], [callback])
\\n
\\n patch(requestParams)
\\n
\\n post(requestParams)
\\n
\\n put(requestParams)
\\n
\\n referencePath(path)
\\n
\\n request(method, fullUrlOrPath, [options])
\\n
\\n scrubEmojis(text, replacementChars)
\\n
\\n source(path)
\\n
\\n sourceValue(path)
\\n
\\n splitKeys(obj, keys)
\\n
\\n toArray(arg)
\\n
\\n validate(schema, data)
\\n
\\n withAgent(params)
\\n
\\n\\n\\n## alterState\\n\\nalterState(func) ⇒ Operation\\nalias for \\\"fn()\\\"\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| func | function | is the function |\\n\\n\\n* * *\\n\\n## arrayToString\\n\\narrayToString(arr, separator) ⇒ string\\nTurns an array into a string, separated by X.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| arr | array | Array of toString'able primatives. |\\n| separator | string | Separator string. |\\n\\n**Example** \\n```js\\nfield(\\\"destination_string__c\\\", function(state) {\\n return arrayToString(dataValue(\\\"path_of_array\\\")(state), ', ')\\n})\\n```\\n\\n* * *\\n\\n## asData\\n\\nasData(data, state) ⇒ array\\nSimple switcher allowing other expressions to use either a JSONPath or\\nobject literals as a data source.\\n- JSONPath referencing a point in `state`\\n- Object Literal of the data itself.\\n- Function to be called with state.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | String \\\\| object \\\\| function | |\\n| state | object | The current state. |\\n\\n**Example** \\n```js\\nasData('$.key'| key | callback)\\n```\\n\\n* * *\\n\\n## chunk\\n\\nchunk(array, chunkSize) ⇒ Object\\nChunks an array into an array of arrays, each with no more than a certain size.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| array | Object | Array to be chunked |\\n| chunkSize | Integer | The maxiumum size of each chunks |\\n\\n**Example** \\n```js\\nchunk([1,2,3,4,5], 2)\\n```\\n\\n* * *\\n\\n## combine\\n\\ncombine(operations) ⇒ Operation\\nCombines two operations into one\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| operations | Operations | Operations to be performed. |\\n\\n**Example** \\n```js\\ncombine(\\n create('foo'),\\n delete('bar')\\n)\\n```\\n\\n* * *\\n\\n## composeNextState\\n\\ncomposeNextState(state, response) ⇒ State\\nPrepares next state\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | state |\\n| response | Object | Response to be added |\\n\\n**Example** \\n```js\\ncomposeNextState(state, response)\\n```\\n\\n* * *\\n\\n## dataPath\\n\\ndataPath(path) ⇒ string\\nEnsures a path points at the data.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | JSONPath referencing a point in `data`. |\\n\\n**Example** \\n```js\\ndataPath('key')\\n```\\n\\n* * *\\n\\n## dataValue\\n\\ndataValue(path) ⇒ Operation\\nPicks out a single value from the source data object—usually `state.data`.\\nIf a JSONPath returns more than one value for the reference, the first\\nitem will be returned.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | String | JSONPath referencing a point in `data`. |\\n\\n**Example** \\n```js\\ndataValue('key')\\n```\\n\\n* * *\\n\\n## del\\n\\ndel(requestParams) ⇒ Operation\\nMake a DELETE request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Deleting a record with data that comes from state)* \\n```js\\ndelete({\\n url: state => `https://www.example.com/api/items/${state.id}`,\\n })(state);\\n```\\n\\n* * *\\n\\n## each\\n\\neach(dataSource, operation) ⇒ Operation\\nScopes 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.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| dataSource | DataSource | JSONPath referencing a point in `state`. |\\n| operation | Operation | The operation needed to be repeated. |\\n\\n**Example** \\n```js\\neach(\\\"$.[*]\\\",\\n create(\\\"SObject\\\",\\n field(\\\"FirstName\\\", sourceValue(\\\"$.firstName\\\"))\\n )\\n)\\n```\\n\\n* * *\\n\\n## each\\n\\neach(dataSource, operation) ⇒ Operation\\nScopes 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.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| dataSource | DataSource | JSONPath referencing a point in `state`. |\\n| operation | Operation | The operation needed to be repeated. |\\n\\n**Example** \\n```js\\neach(\\\"$.[*]\\\",\\n create(\\\"SObject\\\",\\n field(\\\"FirstName\\\", sourceValue(\\\"$.firstName\\\")))\\n )\\n```\\n\\n* * *\\n\\n## expandReferences\\n\\nexpandReferences(value, [skipFilter]) ⇒ Operation\\nRecursively resolves objects that have resolvable values (functions).\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| value | object | data |\\n| [skipFilter] | function | a function which returns true if a value should be skipped |\\n\\n\\n* * *\\n\\n## expandRequestReferences\\n\\nexpandRequestReferences(value) ⇒ Operation\\nRecursively resolves objects that have resolvable values (functions), but\\nomits HTTP request specific modules like `FormData`.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| value | object | data |\\n\\n\\n* * *\\n\\n## field\\n\\nfield(key, value) ⇒ Field\\nReturns a key, value pair in an array.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| key | string | Name of the field |\\n| value | Value | The value itself or a sourceable operation. |\\n\\n**Example** \\n```js\\nfield('destination_field_name__c', 'value')\\n```\\n\\n* * *\\n\\n## fields\\n\\nfields(fields) ⇒ Object\\nZips key value pairs into an object.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| fields | Fields | a list of fields |\\n\\n**Example** \\n```js\\nfields(list_of_fields)\\n```\\n\\n* * *\\n\\n## fn\\n\\nfn(func) ⇒ Operation\\nCreates a custom step (or operation) for more flexible job writing.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| func | function | is the function |\\n\\n**Example** \\n```js\\nfn(state => {\\n // do some things to state\\n return state;\\n});\\n```\\n\\n* * *\\n\\n## get\\n\\nget(requestParams) ⇒ Operation\\nMake a GET request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Get an item with a specified id from state)* \\n```js\\n get({\\n url: state => `https://www.example.com/api/items/${state.id},\\n headers: {\\\"content-type\\\": \\\"application/json\\\"}\\n});\\n```\\n\\n* * *\\n\\n## head\\n\\nhead(requestParams) ⇒ Operation\\nMake a HEAD request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Gets the headers that would be returned if the HEAD request's URL was instead requested with the HTTP GET method)* \\n```js\\nhead({\\n url: 'https://www.example.com/api/items',\\n});\\n```\\n\\n* * *\\n\\n## humanProper\\n\\nhumanProper(str) ⇒ string\\nSubstitutes underscores for spaces and proper-cases a string\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| str | string | String that needs converting |\\n\\n**Example** \\n```js\\nfield(\\\"destination_string__c\\\", humanProper(state.data.path_to_string))\\n```\\n\\n* * *\\n\\n## index\\n\\nindex() ⇒ DataSource\\nReturns the index of the current array being iterated.\\nTo be used with `each` as a data source.\\n\\n**Kind**: global function \\n**Access**: public \\n**Example** \\n```js\\nindex()\\n```\\n\\n* * *\\n\\n## join\\n\\njoin(targetPath, sourcePath, targetKey) ⇒ Operation\\nAdds data from a target object\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| targetPath | String | Target path |\\n| sourcePath | String | Source path |\\n| targetKey | String | Target Key |\\n\\n**Example** \\n```js\\njoin('$.key','$.data','newKey')\\n```\\n\\n* * *\\n\\n## jsonValue\\n\\njsonValue(obj, path) ⇒ Operation\\nPicks out a single value from a JSON object.\\nIf a JSONPath returns more than one value for the reference, the first\\nitem will be returned.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| obj | object | A valid JSON object. |\\n| path | String | JSONPath referencing a point in given JSON object. |\\n\\n**Example** \\n```js\\njsonValue({ a:1 }, 'a')\\n```\\n\\n* * *\\n\\n## lastReferenceValue\\n\\nlastReferenceValue(path) ⇒ Operation\\nPicks out the last reference value from source data.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | String | JSONPath referencing a point in `references`. |\\n\\n**Example** \\n```js\\nlastReferenceValue('key')\\n```\\n\\n* * *\\n\\n## map\\n\\nmap(path, operation, state) ⇒ State\\nScopes 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\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | JSONPath referencing a point in `state.data`. |\\n| operation | function | The operation needed to be repeated. |\\n| state | State | Runtime state. |\\n\\n**Example** \\n```js\\nmap(\\\"$.[*]\\\",\\n create(\\\"SObject\\\",\\n field(\\\"FirstName\\\", sourceValue(\\\"$.firstName\\\"))\\n )\\n)\\n```\\n\\n* * *\\n\\n## merge\\n\\nmerge(dataSource, fields) ⇒ DataSource\\nMerges fields into each item in an array.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| dataSource | DataSource | |\\n| fields | Object | Group of fields to merge in. |\\n\\n**Example** \\n```js\\nmerge(\\n \\\"$.books[*]\\\",\\n fields(\\n field( \\\"publisher\\\", sourceValue(\\\"$.publisher\\\") )\\n )\\n)\\n```\\n\\n* * *\\n\\n## options\\n\\noptions(requestParams) ⇒ Operation\\nMake a OPTIONS request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Requests permitted communication options for a given URL or server, with data from state.)* \\n```js\\noptions({\\n url: 'https://www.example.com/api/items',\\n});\\n```\\n\\n* * *\\n\\n## parseCsv\\n\\nparseCsv(csvData, [parsingOptions], [callback]) ⇒ Operation\\nTakes a CSV file string or stream and parsing options as input, and returns a promise that\\nresolves to the parsed CSV data as an array of objects.\\nOptions for `parsingOptions` include:\\n- `delimiter` {string/Buffer/[string/Buffer]} - Defines the character(s) used to delineate the fields inside a record. Default: `','`\\n- `quote` {string/Buffer/[string/Buffer]} - Defines the characters used to surround a field. Default: `'\\\"'`\\n- `escape` {Buffer/string/null/boolean} - Set the escape character as one character/byte only. Default: `\\\"`\\n- `columns` {boolean / array / function} - Generates record in the form of object literals. Default: `true`\\n- `bom` {boolean} - Strips the [byte order mark (BOM)](https://en.wikipedia.org/wiki/Byte_order_mark) from the input string or buffer. Default: `true`\\n- `trim` {boolean} - Ignore whitespace characters immediately around the `delimiter`. Default: `true`\\n- `ltrim` {boolean} - Ignore whitespace characters from the left side of a CSV field. Default: `true`\\n- `rtrim` {boolean} - Ignore whitespace characters from the right side of a CSV field. Default: `true`\\n- `chunkSize` {number} - The size of each chunk of CSV data. Default: `Infinity`\\n- `skip_empty_lines` {boolean} - Ignore empty lines in the CSV file. Default: `true`\\n\\n**Kind**: global function \\n**Returns**: Operation - The function returns a Promise that resolves to the result of parsing a CSV `stringOrStream`. \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| csvData | String \\\\| Stream | A CSV string or a readable stream |\\n| [parsingOptions] | Object | Optional. Parsing options for converting CSV to JSON. |\\n| [callback] | function | (Optional) callback function. If used it will be called state and an array of rows. |\\n\\n\\n* * *\\n\\n## patch\\n\\npatch(requestParams) ⇒ Operation\\nMake a PATCH request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Applies partial modifications to a resource, with data from state.)* \\n```js\\npatch({\\n url: state => `https://www.example.com/api/items/${state.id}`,\\n data: state => state.data\\n});\\n```\\n\\n* * *\\n\\n## post\\n\\npost(requestParams) ⇒ Operation\\nMake a POST request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Sending a payload with data that comes from state)* \\n```js\\npost({\\n url: \\\"https://example.com\\\",\\n data: (state) => state.data\\n});\\n```\\n**Example** *( Capturing the response for later use in state )* \\n```js\\nalterState((state) => {\\n return post({\\n url: \\\"https://example.com\\\",\\n data: (state) => state.data\\n })(state).then(({response}) => {\\n state.responseData = response.data\\n })\\n});\\n```\\n\\n* * *\\n\\n## put\\n\\nput(requestParams) ⇒ Operation\\nMake a PUT request\\n\\n**Kind**: global function \\n**Returns**: Operation - - Function which takes state and returns a Promise \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| requestParams | object | Supports the exact parameters as Axios. See [here](https://github.com/axios/axios#axios-api) |\\n\\n**Example** *(Creates a new resource or replaces a representation of the target resource with the request payload, with data from state.)* \\n```js\\nput({\\n url: state => `https://www.example.com/api/items/${state.id}`,\\n data: state => state.data\\n});\\n```\\n\\n* * *\\n\\n## referencePath\\n\\nreferencePath(path) ⇒ string\\nEnsures a path points at references.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | JSONPath referencing a point in `references`. |\\n\\n**Example** \\n```js\\nreferencePath('key')\\n```\\n\\n* * *\\n\\n## request\\n\\nrequest(method, fullUrlOrPath, [options]) ⇒\\n`request` is a helper function that sends HTTP requests and returns the response\\nbody, headers, and status code.\\nUse the error map to provide custom error messages or get hold of the response in case of errors.\\n\\n**Kind**: global function \\n**Returns**: an object with the following properties:\\n- method: the request method\\n- url: the request url\\n- code: the status code of the response\\n- headers: the headers of the response\\n- body: the body of the response\\n- message: the status text of the response\\n- duration: the response time \\n\\n| Param | Description |\\n| --- | --- |\\n| method | The HTTP method to use for the request (e.g., \\\"GET\\\", \\\"POST\\\", \\\"PUT\\\", \\\"DELETE\\\", etc.). |\\n| fullUrlOrPath | The full or partial URL for the request. |\\n| [options] | The `options` parameter is an object that contains additional configuration options for the request. |\\n\\n\\n* * *\\n\\n## scrubEmojis\\n\\nscrubEmojis(text, replacementChars) ⇒ string\\nReplaces emojis in a string.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| text | string | String that needs to be cleaned |\\n| replacementChars | string | Characters that replace the emojis |\\n\\n**Example** \\n```js\\nscrubEmojis('Dove🕊️⭐ 29')\\n```\\n\\n* * *\\n\\n## source\\n\\nsource(path) ⇒ Array.<(String\\\\|Object)>\\nPicks out a value from source data.\\nWill return whatever JSONPath returns, which will always be an array.\\nIf you need a single value use `sourceValue` instead.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | String | JSONPath referencing a point in `state`. |\\n\\n**Example** \\n```js\\nsource('$.key')\\n```\\n\\n* * *\\n\\n## sourceValue\\n\\nsourceValue(path) ⇒ Operation\\nPicks out a single value from source data.\\nIf a JSONPath returns more than one value for the reference, the first\\nitem will be returned.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | String | JSONPath referencing a point in `state`. |\\n\\n**Example** \\n```js\\nsourceValue('$.key')\\n```\\n\\n* * *\\n\\n## splitKeys\\n\\nsplitKeys(obj, keys) ⇒ Array.<Object>\\nSplits an object into two objects based on a list of keys.\\nThe first object contains the keys that are not in the list,\\nand the second contains the keys that are.\\n\\n**Kind**: global function \\n**Returns**: Array.<Object> - - Tuple of objects, first object contains keys not in list, second contains keys that are. \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| obj | Object | The object to split. |\\n| keys | Array.<string> | List of keys to split on. |\\n\\n\\n* * *\\n\\n## toArray\\n\\ntoArray(arg) ⇒ array\\nEnsures primitive data types are wrapped in an array.\\nDoes not affect array objects.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| arg | any | Data required to be in an array |\\n\\n**Example** \\n```js\\neach(function(state) {\\n return toArray( dataValue(\\\"path_of_array\\\")(state) )\\n}, ...)\\n```\\n\\n* * *\\n\\n## validate\\n\\nvalidate(schema, data) ⇒ Operation\\nValidate against a JSON schema. Any erors 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`.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| schema | string \\\\| object | The schema, path or URL to validate against |\\n| data | string \\\\| object | The data or path to validate |\\n\\n**Example** *(Validate `state.data` with `state.schema`)* \\n```js\\nvalidate()\\n```\\n**Example** *(Validate form data at `state.form` with a schema from a URL)* \\n```js\\nvalidate(\\\"https://www.example.com/schema/record\\\", \\\"form\\\")\\n```\\n**Example** *(Validate the each item in `state.records` with a schema from a URL)* \\n```js\\neach(\\\"records[*]\\\", validate(\\\"https://www.example.com/schema/record\\\"))\\n```\\n\\n* * *\\n\\n## withAgent\\n\\nwithAgent(params) ⇒ Operation\\nCreates an https agent for axios from the agentOptions key passed in params.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data |\\n\\n\\n* * *\\n\\n\"","readme":"\"# Language Common [![CircleCI](https://circleci.com/gh/OpenFn/language-common.svg?style=svg)](https://circleci.com/gh/OpenFn/language-common)\\n\\nCommon and generic expressions and operations for [OpenFn](http://openfn.org).\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"v0.4.0\\n\\n## 1.12.0\\n\\n### Minor Changes\\n\\n- 7f52699: New HTTP helper functions have been added to common in\\n `src/util/http.js`\\n\\n These are based on the `undici` library. They are functions, not operations,\\n so they do not get and return state, and do not expand references.\\n\\n They are designed to be used by other adaptors to make HTTP requests easier.\\n\\n ## Usage\\n\\n ```\\n // Import the helper function\\n import { get } from '@openfn/language-common/util'\\n\\n // This is an example operation\\n export function get(id, callback) {\\n return async (state) => {\\n const [resolvedId] = expandReferences(\\n state,\\n id,\\n );\\n\\n // Call the new common helper to fetch some json\\n const response = await get(`www.example.com/resource/{$resolvedId}`, { parseAs: 'json' });\\n\\n // Return the response body as data, and also include the response object as a convenience\\n return {\\n ...state,\\n response,\\n data: response.body\\n }\\n }\\n }\\n ```\\n\\n See the http adaptor for a reference implementation.\\n\\n ## Deprecation notice\\n\\n The existing http operations in `src/http.js` have been deprecated, and\\n adaptors should migrate to the new helpers.\\n\\n## 1.11.1\\n\\n### Patch Changes\\n\\n- c19efbe: don't attempt to expand references for a buffer\\n\\n## 1.11.0\\n\\n### Minor Changes\\n\\n- 85c35b8: Add validate function to validate data against a JSON schema\\n\\n## 1.10.3\\n\\n### Patch Changes\\n\\n- df09270: Fix streaming interface to parseCSV\\n\\n## 1.10.2\\n\\n### Patch Changes\\n\\n- 26a303e: add expandReferences for csvData and parsingOptions\\n\\n## 1.10.1\\n\\n### Patch Changes\\n\\n- 8c32eb3: - update parseCsv to await callback\\n - Added documentation for splitKeys\\n\\n## 1.10.0\\n\\n### Minor Changes\\n\\n- aad9549: Ensure that standard OAuth2 credentials with snake-cased\\n \\\"access_token\\\" keys can be used for OAuth2-reliant adaptors\\n\\n## 1.9.0\\n\\n### Minor Changes\\n\\n- 111807f: Add support for `parseCsv` in common\\n\\n## 1.8.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n\\n## 1.8.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n## 1.7.7\\n\\n### Patch Changes\\n\\n- 929bca6: Export metadata helper function\\n\\n## 1.7.6\\n\\n### Patch Changes\\n\\n- 2b4c61a: mark execute private and ast build\\n\\n## 1.7.5\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n\\n## 1.7.4\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- b5eb665: Adjusted docs for common and built to markdown\\n- # ecf5d30: remove sinon since it was not being used\\n\\nBumped all package versions to their latest.\\n\\n# v0.0.4\\n\\n- Added `arrayToString` helper. \\n Allowing you to join an array of string'able primitives (strings and integers)\\n into a string.\\n- Added `toArray` helper. \\n This can be used to coerce certain types of data into an array, this can be\\n useful when the source data has an ambiguous format. For example a given key\\n in the data may have an object as it's value (when there is only one item),\\n and an array of objects when there is more than one. `toArray` can be used to\\n reconcile this inconsistency.\\n\"","functions":["arrayToString","asData","chunk","combine","composeNextState","dataPath","dataValue","each","execute","expandReferences","field","fields","fn","humanProper","index","join","jsonValue","lastReferenceValue","map","merge","parseCsv","referencePath","scrubEmojis","source","sourceValue","splitKeys","toArray"],"configuration-schema":"No Configuration Schema"}, -{"name":"dhis2","adaptor":"@openfn/language-dhis2","version":"4.0.3","docs":"\"## Functions\\n\\n
\\n
\\n attr(attribute, value)
\\n
\\n configMigrationHelper(state)
\\n
\\n create(resourceType, data, [options], [callback])
\\n
\\n destroy(resourceType, path, [data], [options], [callback])
\\n
\\n discover(httpMethod, endpoint)
\\n
\\n dv(dataElement, value)
\\n
\\n findAttributeValue(trackedEntityInstance, attributeDisplayName)
\\n
\\n get(resourceType, query, [options], [callback])
\\n
\\n patch(resourceType, path, data, [options], [callback])
\\n
\\n request(configuration, axiosRequest)
\\n
\\n selectId(resourceType)
\\n
\\n update(resourceType, path, data, [options], [callback])
\\n
\\n upsert(resourceType, query, data, [options], [callback])
\\n
\\n\\n\\n## attr\\n\\nattr(attribute, value) ⇒ object\\nConverts an attribute ID and value into a DSHI2 attribute object\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| attribute | string | A tracked entity instance (TEI) attribute ID. |\\n| value | string | The value for that attribute. |\\n\\n**Example** \\n```js\\nattr('w75KJ2mc4zz', 'Elias')\\n```\\n\\n* * *\\n\\n## configMigrationHelper\\n\\nconfigMigrationHelper(state) ⇒ object\\nMigrates `apiUrl` to `hostUrl` if `hostUrl` is `blank`.\\nFor `OpenFn.org` users with the `old-style configuration`.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | object | the runtime state |\\n\\n**Example** \\n```js\\nconfigMigrationHelper(state)\\n```\\n\\n* * *\\n\\n## create\\n\\ncreate(resourceType, data, [options], [callback]) ⇒ Operation\\nCreate a record\\n\\n**Kind**: global function \\n**Access**: public \\n**Magic**: resourceType $.children.resourceTypes[*] \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | Type of resource to create. E.g. `trackedEntityInstances`, `programs`, `events`, ... |\\n| data | Dhis2Data | Object which defines data that will be used to create a given instance of resource. To create a single instance of a resource, `data` must be a javascript object, and to create multiple instances of a resources, `data` must be an array of javascript objects. |\\n| [options] | Object | Optional `options` to define URL parameters via params (E.g. `filter`, `dimension` and other import parameters), request config (E.g. `auth`) and the DHIS2 apiVersion. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(a program)* \\n```js\\ncreate('programs', {\\n name: 'name 20',\\n shortName: 'n20',\\n programType: 'WITHOUT_REGISTRATION',\\n});\\n```\\n**Example** *(an event)* \\n```js\\ncreate('events', {\\n program: 'eBAyeGv0exc',\\n orgUnit: 'DiszpKrYNg8',\\n status: 'COMPLETED',\\n});\\n```\\n**Example** *(a trackedEntityInstance)* \\n```js\\ncreate('trackedEntityInstances', {\\n orgUnit: 'TSyzvBiovKh',\\n trackedEntityType: 'nEenWmSyUEp',\\n attributes: [\\n {\\n attribute: 'w75KJ2mc4zz',\\n value: 'Gigiwe',\\n },\\n ]\\n});\\n```\\n**Example** *(a dataSet)* \\n```js\\ncreate('dataSets', { name: 'OpenFn Data Set', periodType: 'Monthly' });\\n```\\n**Example** *(a dataSetNotification)* \\n```js\\ncreate('dataSetNotificationTemplates', {\\n dataSetNotificationTrigger: 'DATA_SET_COMPLETION',\\n notificationRecipient: 'ORGANISATION_UNIT_CONTACT',\\n name: 'Notification',\\n messageTemplate: 'Hello',\\n deliveryChannels: ['SMS'],\\n dataSets: [],\\n});\\n```\\n**Example** *(a dataElement)* \\n```js\\ncreate('dataElements', {\\n aggregationType: 'SUM',\\n domainType: 'AGGREGATE',\\n valueType: 'NUMBER',\\n name: 'Paracetamol',\\n shortName: 'Para',\\n});\\n```\\n**Example** *(a dataElementGroup)* \\n```js\\ncreate('dataElementGroups', {\\n name: 'Data Element Group 1',\\n dataElements: [],\\n});\\n```\\n**Example** *(a dataElementGroupSet)* \\n```js\\ncreate('dataElementGroupSets', {\\n name: 'Data Element Group Set 4',\\n dataDimension: true,\\n shortName: 'DEGS4',\\n dataElementGroups: [],\\n});\\n```\\n**Example** *(a dataValueSet)* \\n```js\\ncreate('dataValueSets', {\\n dataElement: 'f7n9E0hX8qk',\\n period: '201401',\\n orgUnit: 'DiszpKrYNg8',\\n value: '12',\\n});\\n```\\n**Example** *(a dataValueSet with related dataValues)* \\n```js\\ncreate('dataValueSets', {\\n dataSet: 'pBOMPrpg1QX',\\n completeDate: '2014-02-03',\\n period: '201401',\\n orgUnit: 'DiszpKrYNg8',\\n dataValues: [\\n {\\n dataElement: 'f7n9E0hX8qk',\\n value: '1',\\n },\\n {\\n dataElement: 'Ix2HsbDMLea',\\n value: '2',\\n },\\n {\\n dataElement: 'eY5ehpbEsB7',\\n value: '3',\\n },\\n ],\\n});\\n```\\n**Example** *(an enrollment)* \\n```js\\ncreate('enrollments', {\\n trackedEntityInstance: 'bmshzEacgxa',\\n orgUnit: 'TSyzvBiovKh',\\n program: 'gZBxv9Ujxg0',\\n enrollmentDate: '2013-09-17',\\n incidentDate: '2013-09-17',\\n});\\n```\\n\\n* * *\\n\\n## destroy\\n\\ndestroy(resourceType, path, [data], [options], [callback]) ⇒ Operation\\nDelete a record. A generic helper function to delete an object\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of resource to be deleted. E.g. `trackedEntityInstances`, `organisationUnits`, etc. |\\n| path | string | Can be an `id` of an `object` or `path` to the `nested object` to `delete`. |\\n| [data] | Object | Optional. This is useful when you want to remove multiple objects from a collection in one request. You can send `data` as, for example, `{\\\"identifiableObjects\\\": [{\\\"id\\\": \\\"IDA\\\"}, {\\\"id\\\": \\\"IDB\\\"}, {\\\"id\\\": \\\"IDC\\\"}]}`. See more [on DHIS2 API docs](https://docs.dhis2.org/2.34/en/dhis2_developer_manual/web-api.html#deleting-objects) |\\n| [options] | Object | Optional `options` for `del` operation including params e.g. `{preheatCache: true, strategy: 'UPDATE', mergeMode: 'REPLACE'}`. Run `discover` or see [DHIS2 documentation](https://docs.dhis2.org/2.34/en/dhis2_developer_manual/web-api.html#create-update-parameters). Defaults to `{operationName: 'delete', apiVersion: state.configuration.apiVersion, responseType: 'json'}` |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(a tracked entity instance)* \\n```js\\ndestroy('trackedEntityInstances', 'LcRd6Nyaq7T');\\n```\\n\\n* * *\\n\\n## discover\\n\\ndiscover(httpMethod, endpoint) ⇒ Operation\\nDiscover `DHIS2` `api` `endpoint` `query parameters` and allowed `operators` for a given resource's endpoint.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| httpMethod | string | The HTTP to inspect parameter usage for a given endpoint, e.g., `get`, `post`,`put`,`patch`,`delete` |\\n| endpoint | string | The path for a given endpoint. E.g. `/trackedEntityInstances` or `/dataValueSets` |\\n\\n**Example** *(a list of parameters allowed on a given endpoint for specific http method)* \\n```js\\ndiscover('post', '/trackedEntityInstances')\\n```\\n\\n* * *\\n\\n## dv\\n\\ndv(dataElement, value) ⇒ object\\nConverts a dataElement and value into a DSHI2 dataValue object\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| dataElement | string | A data element ID. |\\n| value | string | The value for that data element. |\\n\\n**Example** \\n```js\\ndv('f7n9E0hX8qk', 12)\\n```\\n\\n* * *\\n\\n## findAttributeValue\\n\\nfindAttributeValue(trackedEntityInstance, attributeDisplayName) ⇒ string\\nGets an attribute value by its case-insensitive display name\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| trackedEntityInstance | Object | A tracked entity instance (TEI) object |\\n| attributeDisplayName | string | The 'displayName' to search for in the TEI's attributes |\\n\\n**Example** \\n```js\\nfindAttributeValue(state.data.trackedEntityInstances[0], 'first name')\\n```\\n\\n* * *\\n\\n## get\\n\\nget(resourceType, query, [options], [callback]) ⇒ Operation\\nGet data. Generic helper method for getting data of any kind from DHIS2.\\n- This can be used to get `DataValueSets`,`events`,`trackedEntityInstances`,`etc.`\\n\\n**Kind**: global function \\n**Returns**: Operation - state \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of resource to get(use its `plural` name). E.g. `dataElements`, `trackedEntityInstances`,`organisationUnits`, etc. |\\n| query | Object | A query object that will limit what resources are retrieved when converted into request params. |\\n| [options] | Object | Optional `options` to define URL parameters via params beyond filters, request configuration (e.g. `auth`) and DHIS2 api version to use. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(all data values for the 'pBOMPrpg1QX' dataset)* \\n```js\\nget('dataValueSets', {\\n dataSet: 'pBOMPrpg1QX',\\n orgUnit: 'DiszpKrYNg8',\\n period: '201401',\\n fields: '*',\\n});\\n```\\n**Example** *(all programs for an organization unit)* \\n```js\\nget('programs', { orgUnit: 'TSyzvBiovKh', fields: '*' });\\n```\\n**Example** *(a single tracked entity instance by a unique external ID)* \\n```js\\nget('trackedEntityInstances', {\\n ou: 'DiszpKrYNg8',\\n filter: ['flGbXLXCrEo:Eq:124', 'w75KJ2mc4zz:Eq:John'],\\n});\\n```\\n\\n* * *\\n\\n## patch\\n\\npatch(resourceType, path, data, [options], [callback]) ⇒ Operation\\nPatch a record. A generic helper function to send partial updates on one or more object properties.\\n- You are not required to send the full body of object properties.\\n- This is useful for cases where you don't want or need to update all properties on a object.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc. |\\n| path | string | The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}` |\\n| data | Object | Data to update. Include only the fields you want to update. E.g. `{name: \\\"New Name\\\"}` |\\n| [options] | Object | Optional configuration, including params for the update ({preheatCache: true, strategy: 'UPDATE', mergeMode: 'REPLACE'}). Defaults to `{operationName: 'patch', apiVersion: state.configuration.apiVersion, responseType: 'json'}` |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(a dataElement)* \\n```js\\npatch('dataElements', 'FTRrcoaog83', { name: 'New Name' });\\n```\\n\\n* * *\\n\\n## request\\n\\nrequest(configuration, axiosRequest) ⇒ Promise\\nThe request client takes configuration from state and an axios request object\\nthen (1) logs the method and URL, (2) applies standard headers and auth\\nbefore spreading the rest of the axios configuration, and (3) executes an\\naxios request.\\n\\n**Kind**: global function \\n**Returns**: Promise - a promise that will resolve to either a response object or an error object. \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| configuration | object | configuration must have a username and password |\\n| axiosRequest | object | the axiosRequest contains valid axios params: https://axios-http.com/docs/req_config |\\n\\n\\n* * *\\n\\n## selectId\\n\\nselectId(resourceType) ⇒ string\\nDetermines the attribute name for a DHIS2 system ID given a resource type.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| resourceType | string | \\n\\n\\n* * *\\n\\n## update\\n\\nupdate(resourceType, path, data, [options], [callback]) ⇒ Operation\\nUpdate data. A generic helper function to update a resource object of any type.\\nUpdating an object requires to send `all required fields` or the `full body`\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc. |\\n| path | string | The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}` |\\n| data | Object | Data to update. It requires to send `all required fields` or the `full body`. If you want `partial updates`, use `patch` operation. |\\n| [options] | Object | Optional `options` to define URL parameters via params (E.g. `filter`, `dimension` and other import parameters), request config (E.g. `auth`) and the DHIS2 apiVersion. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(a program)* \\n```js\\nupdate('programs', 'qAZJCrNJK8H', {\\n name: '14e1aa02c3f0a31618e096f2c6d03bed',\\n shortName: '14e1aa02',\\n programType: 'WITHOUT_REGISTRATION',\\n});\\n```\\n**Example** *(an event)* \\n```js\\nupdate('events', 'PVqUD2hvU4E', {\\n program: 'eBAyeGv0exc',\\n orgUnit: 'Ngelehun CHC',\\n status: 'COMPLETED',\\n storedBy: 'admin',\\n dataValues: [],\\n});\\n```\\n**Example** *(a trackedEntityInstance)* \\n```js\\nupdate('trackedEntityInstances', 'IeQfgUtGPq2', {\\n created: '2015-08-06T21:12:37.256',\\n orgUnit: 'TSyzvBiovKh',\\n createdAtClient: '2015-08-06T21:12:37.256',\\n trackedEntityInstance: 'IeQfgUtGPq2',\\n lastUpdated: '2015-08-06T21:12:37.257',\\n trackedEntityType: 'nEenWmSyUEp',\\n inactive: false,\\n deleted: false,\\n featureType: 'NONE',\\n programOwners: [\\n {\\n ownerOrgUnit: 'TSyzvBiovKh',\\n program: 'IpHINAT79UW',\\n trackedEntityInstance: 'IeQfgUtGPq2',\\n },\\n ],\\n enrollments: [],\\n relationships: [],\\n attributes: [\\n {\\n lastUpdated: '2016-01-12T00:00:00.000',\\n displayName: 'Last name',\\n created: '2016-01-12T00:00:00.000',\\n valueType: 'TEXT',\\n attribute: 'zDhUuAYrxNC',\\n value: 'Russell',\\n },\\n {\\n lastUpdated: '2016-01-12T00:00:00.000',\\n code: 'MMD_PER_NAM',\\n displayName: 'First name',\\n created: '2016-01-12T00:00:00.000',\\n valueType: 'TEXT',\\n attribute: 'w75KJ2mc4zz',\\n value: 'Catherine',\\n },\\n ],\\n});\\n```\\n**Example** *(a dataSet)* \\n```js\\nupdate('dataSets', 'lyLU2wR22tC', { name: 'OpenFN Data Set', periodType: 'Weekly' });\\n```\\n**Example** *(a dataSetNotification)* \\n```js\\nupdate('dataSetNotificationTemplates', 'VbQBwdm1wVP', {\\n dataSetNotificationTrigger: 'DATA_SET_COMPLETION',\\n notificationRecipient: 'ORGANISATION_UNIT_CONTACT',\\n name: 'Notification',\\n messageTemplate: 'Hello Updated,\\n deliveryChannels: ['SMS'],\\n dataSets: [],\\n});\\n```\\n**Example** *(a dataElement)* \\n```js\\nupdate('dataElements', 'FTRrcoaog83', {\\n aggregationType: 'SUM',\\n domainType: 'AGGREGATE',\\n valueType: 'NUMBER',\\n name: 'Paracetamol',\\n shortName: 'Para',\\n});\\n```\\n**Example** *(a dataElementGroup)* \\n```js\\nupdate('dataElementGroups', 'QrprHT61XFk', {\\n name: 'Data Element Group 1',\\n dataElements: [],\\n});\\n```\\n**Example** *(a dataElementGroupSet)* \\n```js\\nupdate('dataElementGroupSets', 'VxWloRvAze8', {\\n name: 'Data Element Group Set 4',\\n dataDimension: true,\\n shortName: 'DEGS4',\\n dataElementGroups: [],\\n});\\n```\\n**Example** *(a dataValueSet)* \\n```js\\nupdate('dataValueSets', 'AsQj6cDsUq4', {\\n dataElement: 'f7n9E0hX8qk',\\n period: '201401',\\n orgUnit: 'DiszpKrYNg8',\\n value: '12',\\n});\\n```\\n**Example** *(a dataValueSet with related dataValues)* \\n```js\\nupdate('dataValueSets', 'Ix2HsbDMLea', {\\n dataSet: 'pBOMPrpg1QX',\\n completeDate: '2014-02-03',\\n period: '201401',\\n orgUnit: 'DiszpKrYNg8',\\n dataValues: [\\n {\\n dataElement: 'f7n9E0hX8qk',\\n value: '1',\\n },\\n {\\n dataElement: 'Ix2HsbDMLea',\\n value: '2',\\n },\\n {\\n dataElement: 'eY5ehpbEsB7',\\n value: '3',\\n },\\n ],\\n});\\n```\\n**Example** *(a single enrollment)* \\n```js\\nupdate('enrollments', 'CmsHzercTBa' {\\n trackedEntityInstance: 'bmshzEacgxa',\\n orgUnit: 'TSyzvBiovKh',\\n program: 'gZBxv9Ujxg0',\\n enrollmentDate: '2013-10-17',\\n incidentDate: '2013-10-17',\\n});\\n```\\n\\n* * *\\n\\n## upsert\\n\\nupsert(resourceType, query, data, [options], [callback]) ⇒ Operation\\nUpsert a record. A generic helper function used to atomically either insert a row, or on the basis of the row already existing, UPDATE that existing row instead.\\n\\n**Kind**: global function \\n**Throws**:\\n\\n- RangeError - Throws range error\\n\\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of a resource to `upsert`. E.g. `trackedEntityInstances` |\\n| query | Object | A query object that allows to uniquely identify the resource to update. If no matches found, then the resource will be created. |\\n| data | Object | The data to use for update or create depending on the result of the query. |\\n| [options] | Object | Optional configuration that will be applied to both the `get` and the `create` or `update` operations. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(Example `expression.js` of upsert)* \\n```js\\nupsert('trackedEntityInstances', {\\n ou: 'TSyzvBiovKh',\\n filter: ['w75KJ2mc4zz:Eq:Qassim'],\\n}, {\\n orgUnit: 'TSyzvBiovKh',\\n trackedEntityType: 'nEenWmSyUEp',\\n attributes: [\\n {\\n attribute: 'w75KJ2mc4zz',\\n value: 'Qassim',\\n },\\n ],\\n});\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language DHIS2\\n\\nAn OpenFn language Pack for building expressions and operations for working with\\nthe\\n[DHIS2 API](http://dhis2.github.io/dhis2-docs/master/en/developer/html/dhis2_developer_manual.html).\\nUsed most commonly via OpenFn.org or by hand with\\n[OpenFn/core](https://github.com/OpenFn/core) from the root of this repo:\\n\\n```sh\\ncore execute \\\\\\n -l ../language-dhis2 \\\\\\n -e ./tmp/expression.js \\\\\\n -s ./tmp/state.json \\\\\\n -o ./tmp/output.json\\n```\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/dhis2-docs) for\\nfull technical documentation.\\n\\nThere are lots of **examples** for how to use the various helper functions on\\nthe main\\n[Adaptor docs](https://docs.openfn.org/adaptors/packages/dhis2-docs#modules)\\npage.\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/dhis2-configuration-schema/)\\ndefinition.\\n\\n## Development\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`. (NB: that this repo\\nalso contain integration tests which can be run with\\n`pnpm run integration-test`.)\\n\\n⚠️ NB: Make changes to the files in `src/` and then use `npm run build` to\\ngenerate output files in `lib/`.\\n\\nThe documentation is autogenerated, so please **rebuild the docs** after making\\nchanges by running `pnpm build docs`\\n\\n### Unit Tests\\n\\nUnit tests allows to test the functionalities of the adaptor helper functions\\nsuch as:\\n\\n> Does `create('events', payload)` perform a post request to the correct DHIS2\\n> API?\\n\\nTo run unit tests execute `pnpm run test` (they're the default tests).\\n\\nAnytime a new functionality is added to the helper functions, more unit tests\\nneeds to be added.\\n\\n### End-to-end integration tests\\n\\nIntegration tests allow us to test the end-to-end behavior of the helper\\nfunctions and also to test the examples we provide via inline documentation.\\n\\nFor example with integration tests we answer the following question:\\n\\n> Does `create('events', eventPayload)` actually create a new event in a live\\n> DHIS2 system?\\n\\nTo run integration tests, execute `npm run integration-test`. These tests use\\nnetwork I/O and a public connection to a DHIS2 \\\"play\\\" server so their timing and\\nperformance is unpredictable. Consider adding an increased timeout, and\\nmodifying the orgUnit, program, etc., IDs set in `globalState`.\\n\\n#### Troubleshooting the tests\\n\\n- Depending on your internet strength please consider changing the **global\\n timeout** in the `test/mocha.opts` file to avoid faillures related to network\\n timeouts.\\n\\n- The behavior of the tests in `test/integration.js` is very unpredictable; they\\n depend on the **configuration of a target DHIS2 instance**. Currently you need\\n to have at least one organisation unit with one program, one\\n trackedEntityInstance and one programStage in it. These components need to be\\n well configured for the integration tests to work. For example: the\\n trackedEntityInstance need to be enrolled to the program, which should be\\n created in that organisation unit and contains at least that programStage. If\\n the tests fail, you must adjust these attributes in the\\n [before hook](https://github.com/OpenFn/adaptors/tree/main/packages/dhis2/test/integration.js):\\n\\n```javascript\\nbefore(done => {\\n fixture.initialState = {\\n configuration: {\\n username: 'admin',\\n password: 'district',\\n hostUrl: 'https://play.dhis2.org/2.36.6',\\n },\\n program: 'IpHINAT79UW',\\n orgUnit: 'DiszpKrYNg8',\\n trackedEntityInstance: 'uhubxsfLanV',\\n programStage: 'eaDHS084uMp',\\n };\\n done();\\n});\\n```\\n\\n- Make sure the `update` and `upsert` integration tests don't affect those\\n initial organisation units, programs, programStage and trackedEntityInstance\\n required. Otherwise the create integration tests would be broken again; and\\n that's an endless faillure loop :(\\n\\nAnytime a new example is added in the documentation of a helper function, a new\\nintegration test should be built.\\n\"","changelog":"\"# @openfn/language-dhis2\\n\\n## 4.0.3\\n\\n### Patch Changes\\n\\n- 222184d: remove Class Log and replaced\\n\\n - `Log.success` with `console.log`\\n - `Log.warn` with `console.warn`\\n - `Log.error` with `console.error`\\n\\n## 4.0.2\\n\\n### Patch Changes\\n\\n- 1bd612e: improve error logs response\\n\\n## 4.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 4.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 3.2.12\\n\\n### Patch Changes\\n\\n- 57742d1: improve logs output\\n\\n## 3.2.11\\n\\n### Patch Changes\\n\\n- 705caab: Remove tools as devdependencies\\n\\n## 3.2.10\\n\\n### Patch Changes\\n\\n- 929bca6: Use metadata helper function from common\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 3.2.9\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 3.2.8\\n\\n### Patch Changes\\n\\n- Fix metadata function export\\n\\n## 3.2.7\\n\\n### Patch Changes\\n\\n- c09b821: Add @magic annotations\\n\\n## 3.2.6\\n\\n### Patch Changes\\n\\n- df6098d: replace sample state with configuration\\n\\n## 3.2.5\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 3.2.4\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 3.2.3\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 3.2.2\\n\\n### Patch Changes\\n\\n- 9a2755e: Update dependency on language-common\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n - @openfn/buildtools@1.0.2\\n\\n## 3.2.1\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\\n## 3.2.0\\n\\n### Minor Changes\\n\\n- f670bf8: Added credential schema to enable new ui\\n\\n## 3.1.0\\n\\n### Minor Changes\\n\\n- 8d6e8ce: Migrate dhis2 into repo\\n\\n### Patch Changes\\n\\n- Updated dependencies [4671e89]\\n- Updated dependencies [8d6e8ce]\\n - @openfn/buildtools@1.0.1\\n\"","functions":["attr","create","destroy","discover","dv","findAttributeValue","get","patch","update","upsert"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"hostUrl":{"title":"Host URL","type":"string","description":"The base DHIS2 instance URL","format":"uri","minLength":1,"examples":["https://play.dhis2.org/2.36.6"]},"username":{"title":"Username","type":"string","description":"Username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"minLength":1,"examples":["@some(!)Password"]},"apiVersion":{"title":"API Version","anyOf":[{"type":"string"},{"type":"null"}],"placeholder":"38","description":"DHIS2 api version","minLength":1,"examples":["v2"]}},"type":"object","additionalProperties":true,"required":["hostUrl","password","username"]}}, -{"name":"dynamics","adaptor":"@openfn/language-dynamics","version":"0.4.8","docs":"\"\"","readme":"\"# Language Dynamics\\n\\nLanguage Pack for building expressions and operations to make calls to the\\nMicrosoft Dynamics API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/dynamics-configuration-schema/)\\ndefinition.\\n\\n- _Dynamics uses oauth2. The language-package will expect to be given a valid\\n oauth token. If a valid token is not provided, it will fail. On OpenFn.org,\\n the `CredentialService` is responsible for making sure the the oauth token is\\n valid each time it assembles state to hand to `execute`._\\n\\n#### sample createEntity expression\\n\\n```js\\ncreateEntity({\\n entityName: 'accounts',\\n body: {\\n name: 'Open Function',\\n creditonhold: false,\\n address1_latitude: 47.639583,\\n description: 'This is the description of the sample account',\\n revenue: 5000000,\\n accountcategorycode: 1,\\n },\\n});\\n```\\n\\n#### sample query expression\\n\\n_Can be used to retrieve or query a specific Entity if an entityId is declared\\nin the expression. Otherwise it will perform a query on all data with the\\ndefined Entity Name_\\n\\n```js\\nquery({\\n entityName: 'contacts',\\n entityId: '51a0e5b9-88df-e311-b8e5-6c3be5a8b200',\\n query: {\\n fields: ['fullname', 'birthdate'],\\n limit: 10,\\n orderBy: {\\n field: 'lastname',\\n direction: 'asc',\\n },\\n filter: \\\"firstname eq 'Cat'\\\",\\n },\\n});\\n```\\n\\n#### sample update expression\\n\\n```js\\nupdateEntity({\\n entityName: 'accounts',\\n entityId: 'f4301865-c64a-e711-80f3-e0071b6fd061',\\n body: {\\n name: 'wilder 2',\\n creditonhold: true,\\n address1_latitude: 47.639583,\\n description: 'This is the description of the sample account',\\n revenue: 5000000,\\n accountcategorycode: 1,\\n },\\n});\\n```\\n\\n#### sample delete expression\\n\\n```js\\ndeleteEntity({\\n entityName: 'accounts',\\n entityId: 'aeef941b-254a-e711-80f1-e0071b685921',\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-dynamics\\n\\n## 0.4.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 0.4.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 0.4.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 0.4.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 0.4.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 0.4.3\\n\\n### Patch Changes\\n\\n- aad9549: Ensure that standard OAuth2 credentials with snake-cased\\n \\\"access_token\\\" keys can be used for OAuth2-reliant adaptors\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 0.4.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- b032b9c: Migrate Dynamics\\n\\n### Patch Changes\\n\\n- e81561f: Updated ast and package.json\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","$comment":"OAuth2","properties":{"resource":{"title":"Resource","type":"string","description":"Dynamics resource URL","format":"uri","minLength":1,"examples":["https://openfn.crm2.dynamics.com"]},"apiVersion":{"title":"API Version","type":"string","default":"8.2.0","description":"Dynamics API version to use","minLength":1,"examples":["8.2.0"]},"access_token":{"title":"Access Token","type":"string","description":"Dynamics API access token","writeOnly":true,"minLength":1,"examples":["eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRlQyU3ZRdVhoODQ2WVR3RUlCdyIsI"]}},"type":"object","additionalProperties":true,"required":["resource","apiVersion","access_token"]}}, -{"name":"facebook","adaptor":"@openfn/language-facebook","version":"0.3.2","docs":"\"## postMessage\\n\\npostMessage(params) ⇒ Operation\\nPost a message\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the fetch |\\n\\n**Example** \\n```js\\npostMessage({\\n \\\"recipient\\\": {\\n \\\"id\\\": \\\"your-psid\\\"\\n },\\n \\\"message\\\": {\\n \\\"text\\\": \\\"your-message\\\"\\n }\\n})\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Facebook\\n\\nLanguage Pack for building expressions and operations to interact with the\\nFacebook Messenger API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/facebook-configuration-schema/)\\ndefinition.\\n\\n### postMessage\\n\\n#### sample expression using operation\\n\\n```js\\npostMessage({\\n recipient: {\\n id: '',\\n },\\n message: {\\n text: '',\\n },\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-facebook\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- aad9549: Ensure that standard OAuth2 credentials with snake-cased\\n \\\"access_token\\\" keys can be used for OAuth2-reliant adaptors\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.2.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.2.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- f7669d2: migrate facebook\\n\"","functions":["postMessage"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","$comment":"OAuth2","properties":{"access_token":{"title":"Access Token","type":"string","description":"Your Facebook API access token","writeOnly":true,"minLength":1}},"type":"object","additionalProperties":true,"required":["access_token"]}}, -{"name":"fhir","adaptor":"@openfn/language-fhir","version":"3.1.0","docs":"\"## Functions\\n\\n
\\n
\\n create(path, params, callback)
\\n
\\n createTransactionBundle(params, callback)
\\n
\\n get(path, query, callback)
\\n
\\n getClaim(claimId, query, callback)
\\n
\\n\\n\\n## create\\n\\ncreate(path, params, callback) ⇒ Operation\\nCreates a resource in a destination system using a POST request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| params | object | data to create the new resource |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ncreate(\\\"Bundle\\\", {...state.data: type: \\\"collection\\\"})\\n```\\n\\n* * *\\n\\n## createTransactionBundle\\n\\ncreateTransactionBundle(params, callback) ⇒ Operation\\nCreates a transactionBundle for HAPI FHIR\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to create the new transaction |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ncreateTransactionBundle({\\n resourceType: \\\"Bundle\\\",\\n type: \\\"transaction\\\",\\n entry: [\\n {\\n fullUrl: \\\"https://hapi.fhir.org/baseR4/Patient/592442\\\",\\n resource: {\\n resourceType: \\\"Patient\\\",\\n id: \\\"592442\\\",\\n name: [{ given: \\\"Caleb\\\", family: \\\"Cushing\\\" }],\\n },\\n request: {\\n method: \\\"POST\\\",\\n url: \\\"Patient\\\",\\n },\\n },\\n ],\\n});\\n```\\n\\n* * *\\n\\n## get\\n\\nget(path, query, callback) ⇒ Operation\\nGet a resource in a FHIR system\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| query | object | data to get the new resource |\\n| callback | function | (Optional) callback function |\\n\\n**Example** *(Get Claim from FHIR with optional query)* \\n```js\\nget(\\\"Claim\\\", { _include: \\\"Claim:patient\\\", _sort: \\\"-_lastUpdated\\\", _count: 200 })\\n```\\n**Example** *(Get Patient from FHIR)* \\n```js\\nget('Patient');\\n```\\n\\n* * *\\n\\n## getClaim\\n\\ngetClaim(claimId, query, callback) ⇒ Operation\\nGet Claim in a FHIR system\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| claimId | string | (optional) claim id |\\n| query | object | (optinal) query parameters |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ngetClaim({ _include: \\\"Claim:patient\\\", _sort: \\\"-_lastUpdated\\\", _count: 200 });\\n```\\n\\n* * *\\n\\n## request\\n\\nrequest ⇒\\nThis is an asynchronous function that sends a request to a specified URL with optional parameters\\nand headers, and returns the response data in JSON format.\\n\\n**Kind**: global constant \\n**Returns**: The `request` function is returning the parsed JSON data from the response of the HTTP\\nrequest made to the specified `url` with the given `params` and `method`. If there is an error in\\nthe response, the function will throw an error. \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| url | string | | The URL of the API endpoint that the request is being made to. |\\n| [params] | object | | An object containing any additional parameters to be sent with the request, such as query parameters or request body data. It is an optional parameter and defaults to an empty object if not provided. |\\n| [method] | string | "GET" | The HTTP method to be used for the request. It defaults to 'GET' if not specified. |\\n\\n\\n* * *\\n\\n\"","readme":"\"# language-fhir\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the HAPI FHIR\\nAPI.\\n\\n## FHIR Documentation\\n\\nThe Restfull API can be seen here: https://www.hl7.org/fhir/http.html\\n\\n## Documentation\\n\\n\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/fhir-configuration-schema/)\\ndefinition.\\n\\n#### Creates a resource in a destination system using a POST request\\n\\n```js\\ncreate('/endpoint', { foo: 'bar' });\\n```\\n\\n#### Creates a transactionBundle for HAPI FHIR\\n\\n```js\\ncreateTransactionBundle({\\n entry: [transactionBundle],\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-fhir\\n\\n## 3.1.0\\n\\n### Minor Changes\\n\\n- d94e9ee: Migrate from axios to using `fetch` from `undici` and add uniti tests\\n\\n## 3.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 3.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 2.0.0\\n\\n### Major Changes\\n\\n- d4b4094: - Update configuration schema,\\n - Add `get()` function\\n - Fix `create()` axios config\\n - Remove unused code\\n - Improve error handling\\n - Improve response handling\\n\\n## 1.1.5\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.1.4\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.1.3\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.1.2\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- fee607e: Migrate FHIR, update package export\\n\\n### Patch Changes\\n\\n- cb5d0ed: Updated to @openfn/simple-ast v0.4.1\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\"","functions":["create","createTransactionBundle","get","getClaim"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"baseUrl":{"title":"Base Url","type":"string","description":"The baseUrl","examples":["https://hapi.fhir.org/baseR4"]},"apiPath":{"title":"API Path","anyOf":[{"type":"string"},{"type":"null"}],"placeholder":"R4","description":"FHIR api path","minLength":1,"examples":["baseR4","R3","R4"]},"authType":{"title":"Auth Type","type":"string","description":"The type of authentication used to authenticate into the destination system","examples":["Basic"]},"token":{"title":"Token","type":"string","description":"The token used to authenticate into the destination system","examples":["@super!scretetoken"]}},"required":["resource","authType","token"]}}, -{"name":"godata","adaptor":"@openfn/language-godata","version":"3.4.0","docs":"\"## Functions\\n\\n
\\n
\\n getCase(id, query, callback)
\\n
\\n getContact(id, query, callback)
\\n
\\n getLocation(query, callback)
\\n
\\n getOutbreak(query, callback)
\\n
\\n getReferenceData(query, callback)
\\n
\\n listCases(id, callback)
\\n
\\n listContacts(id, callback)
\\n
\\n listLocations(callback)
\\n
\\n listOutbreaks(callback)
\\n
\\n listReferenceData(callback)
\\n
\\n upsertCase(id, externalId, goDataCase, callback)
\\n
\\n upsertContact(id, externalId, goDataContact, callback)
\\n
\\n upsertLocation(externalId, goDataLocation, callback)
\\n
\\n upsertOutbreak(outbreak, callback)
\\n
\\n upsertReferenceData(externalId, goDataReferenceData, callback)
\\n
\\n\\n\\n## getCase\\n\\ngetCase(id, query, callback) ⇒ Operation\\nGet one or multiple cases within an outbreak from a query filter\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | Outbreak id |\\n| query | object | An object with a query filter parameter |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\ngetCase(\\n '3b55-cdf4',\\n { 'where.relationship': { active: true }, where: { firstName: 'Luca'} },\\n state => {\\n console.log(state);\\n return state;\\n }\\n);\\n```\\n\\n* * *\\n\\n## getContact\\n\\ngetContact(id, query, callback) ⇒ Operation\\nGet one or multiple contacts within an outbreak from a query filter\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | Outbreak id |\\n| query | object | An object with a query filter parameter |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\ngetContact(\\\"343d-dc3e\\\", {\\\"where\\\":{\\\"firstName\\\": \\\"Luca\\\"}}, state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## getLocation\\n\\ngetLocation(query, callback) ⇒ Operation\\nGet one or multiple locations from a query filter\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | An object with a query filter parameter |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\ngetLocation({\\\"where\\\":{\\\"name\\\": \\\"30 DE OCTUBRE\\\"}}, state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## getOutbreak\\n\\ngetOutbreak(query, callback) ⇒ Operation\\nGet one or multiple outbreaks from a query filter\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | An object with a query filter parameter |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\ngetOutbreak({\\\"where\\\":{\\\"name\\\": \\\"Outbreak demo\\\"}}, state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## getReferenceData\\n\\ngetReferenceData(query, callback) ⇒ Operation\\nGet one or multiple reference data from a query filter\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | An object with a query filter parameter |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\ngetReferenceData({\\\"where\\\":{\\\"categoryId\\\": \\\"LNG_REFERENCE_DATA_CATEGORY_CENTRE_NAME\\\"}}, state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## listCases\\n\\nlistCases(id, callback) ⇒ Operation\\nFetch the list of cases within a particular outbreak using its ID.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | Outbreak id |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nlistCases(\\\"343d-dc3e\\\", state => {\\n console.log(state);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## listContacts\\n\\nlistContacts(id, callback) ⇒ Operation\\nFetch the list of contacts within a particular outbreak using its ID.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | Outbreak id |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nlistContacts(\\\"343d-dc3e\\\", // Outbreak Id\\n state => {\\n console.log(state);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## listLocations\\n\\nlistLocations(callback) ⇒ Operation\\nFetch the list of locations\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nlistLocations(state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## listOutbreaks\\n\\nlistOutbreaks(callback) ⇒ Operation\\nFetch the list of outbreaks\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nlistOutbreaks(state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## listReferenceData\\n\\nlistReferenceData(callback) ⇒ Operation\\nFetch the list of reference data\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nlistReferenceData(state => {\\n console.log(state.data);\\n return state;\\n });\\n```\\n\\n* * *\\n\\n## upsertCase\\n\\nupsertCase(id, externalId, goDataCase, callback) ⇒ Operation\\nUpsert case to godata using an external id to mach a specific record\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | Outbreak id |\\n| externalId | string | External Id to match |\\n| goDataCase | object | an object with some case data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nupsertCase(\\\"4dce-3eedce3-rd33\\\", 'visualId',\\n data: state => {\\n const patient = state.data.body;\\n return {\\n firstName: patient.Patient_name.split(' ')[0],\\n lastName: patient.Patient_name.split(' ')[1],\\n visualId: patient.Case_ID,\\n 'age:years': patient.Age_in_year,\\n gender: patient.Sex,\\n };\\n })\\n```\\n\\n* * *\\n\\n## upsertContact\\n\\nupsertContact(id, externalId, goDataContact, callback) ⇒ Operation\\nUpsert contact to godata using an external id to match a specific record.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | Outbreak id |\\n| externalId | string | External Id to match |\\n| goDataContact | object | an object with some case data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nupsertContact(\\\"4dce-3eedce3-rd33\\\", 'visualId',\\n {\\n firstName: 'Luca',\\n gender: 'male',\\n 'age:years': '20'\\n ...\\n }\\n )\\n```\\n\\n* * *\\n\\n## upsertLocation\\n\\nupsertLocation(externalId, goDataLocation, callback) ⇒ Operation\\nUpsert location to godata\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| externalId | string | External Id to match |\\n| goDataLocation | object | an object with some location data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nupsertLocation('name', {...})\\n```\\n\\n* * *\\n\\n## upsertOutbreak\\n\\nupsertOutbreak(outbreak, callback) ⇒ Operation\\nUpsert outbreak to godata\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| outbreak | object | an object with an externalId and some outbreak data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nupsertOutbreak({externalId: \\\"3dec33-ede3\\\", data: {...}})\\n```\\n\\n* * *\\n\\n## upsertReferenceData\\n\\nupsertReferenceData(externalId, goDataReferenceData, callback) ⇒ Operation\\nUpsert reference data to godata\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| externalId | string | External Id to match |\\n| goDataReferenceData | object | an object with some reference data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nupsertReferenceData('id', {...})\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-godata\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the WHO\\nGo.Data API.\\n\\n[Go.Data](https://www.who.int/godata) is an outbreak investigation tool for\\nfield data collection during public health emergencies. The tool includes\\nfunctionality for case investigation, contact follow-up, visualization of chains\\nof transmission including secure data exchange and is designed for flexibility\\nin the field, to adapt to the wide range of outbreak scenarios.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/godata-docs) for\\nfull technical documentation.\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/godata-configuration-schema/)\\ndefinition.\\n\\n## Helper Functions\\n\\n### post(...)\\n\\n## Fetch the list of outbreaks\\n\\nThis function is used to fetch the whole list of outbreaks in Go.Data.\\n\\n```js\\nlistOutbreaks(state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n## Get a specific outbreak\\n\\nThis function can be used to fetch one specific outbreak. A filtering mechanism\\nis used to specify a criteria to match. Mutliple outbreaks could be returned if\\nmatched by the filter.\\n\\n```js\\ngetOutbreak({ where: { name: 'Outbreak demo' } }, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n## Insert or Update an outbreak using a unique id as a key\\n\\nThis function is used to either update a record in Go.Data if matched or insert\\na new one if no record matched the unique id.\\n\\n```js\\nupsertOutbreak({\\n externalId: '3dec33-ede3',\\n data: {\\n name: 'string',\\n description: 'string',\\n disease: 'string',\\n countries: [\\n {\\n id: 'SENEGAL',\\n },\\n ],\\n startDate: '2020-12-17T14:54:19.498Z',\\n endDate: '2020-12-17T14:54:19.498Z',\\n longPeriodsBetweenCaseOnset: 0,\\n periodOfFollowup: 0,\\n },\\n});\\n```\\n\\n## Fetch the list of cases\\n\\nThis function is used to fetch the whole list of cases for a specific outbreak\\nin Go.Data.\\n\\n```js\\nlistCases('4c444f7-4e11-41d0-c1af-331dd15a892e', state => {\\n console.log(state);\\n return state;\\n});\\n```\\n\\n## Get a specific case\\n\\nThis function can be used to fetch one specific case for an outbreak. A\\nfiltering mechanism can specify a criteria to match. Mutliple cases could be\\nreturned if matched by the filter.\\n\\n```js\\ngetCase(\\n '4c444f7-4e11-41d0-c1af-331dd15a892e',\\n { 'where.relationship': { active: true }, where: { firstName: 'Luca' } },\\n state => {\\n console.log(state);\\n return state;\\n }\\n);\\n```\\n\\n## Insert or Update a case using a unique id as a key\\n\\nThis function is used to either update a case in Go.Data if matched or insert a\\nnew one if no record matched the unique id.\\n\\n```js\\nupsertCase('4dce-3eedce3-rd33', 'visualId',\\n data: state => {\\n const patient = state.data.body;\\n return {\\n firstName: patient.Patient_name.split(' ')[0],\\n lastName: patient.Patient_name.split(' ')[1],\\n visualId: patient.Case_ID,\\n 'age:years': patient.Age_in_year,\\n gender: patient.Sex,\\n };\\n });\\n```\\n\\n## Fetch the list of contacts\\n\\nThis function is used to fetch the whole list of contacts for a specific\\noutbreak in Go.Data.\\n\\n```js\\nlistContacts('4c444f7-4e11-41d0-c1af-331dd15a892e', state => {\\n console.log(state);\\n return state;\\n});\\n```\\n\\n## Get a specific contact\\n\\nThis function can be used to get one specific contact for an outbreak. A\\nfiltering mechanism can specify a criteria to match. Mutliple contacts could be\\nreturned if matched by the filter.\\n\\n```js\\ngetContact('343d-dc3e', { where: { firstName: 'Luca' } }, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n## Insert or Update a contact using a unique id as a key\\n\\nThis function is used to either update a contact in Go.Data if matched or insert\\na new one if no record matched the unique id.\\n\\n```js\\nupsertContact('4dce-3eedce3-rd33', 'visualId', {\\n firstName: 'Luca',\\n gender: 'male',\\n 'age:years': '20',\\n});\\n```\\n\\n## Fetch the list of locations\\n\\nThis function is used to fetch the list of locations.\\n\\n```js\\nlistLocations(state => {\\n console.log(state);\\n return state;\\n});\\n```\\n\\n## Get a specific location\\n\\nThis function can be used to get one specific location. A filtering mechanism\\ncan specify a criteria to match. Mutliple locations could be returned if matched\\nby the filter.\\n\\n```js\\ngetLocation({ where: { name: '30 DE MAYO' } }, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n## Insert or Update a location using a unique id as a key\\n\\nThis function is used to either update a location if matched or insert a new. A\\ncustom `externalId` can be provided.\\n\\n```js\\nupsertLocation('name', {\\n name: '30 DE DECIEMBRE',\\n synonyms: [],\\n identifiers: [],\\n active: true,\\n populationDensity: 0,\\n geoLocation: {\\n lat: -45.343244,\\n lng: -67.193873,\\n },\\n});\\n```\\n\\n## Fetch the list of reference data\\n\\nThis function is used to fetch the list of reference data.\\n\\n```js\\nlistReferenceData(state => {\\n console.log(state);\\n return state;\\n});\\n```\\n\\n## Get a specific reference data\\n\\nThis function can be used to get one specific reference data. A filtering\\nmechanism can specify a criteria to match.\\n\\n```js\\ngetReferenceData(\\n { where: { categoryId: 'LNG_REFERENCE_DATA_CATEGORY_CENTRE_NAME' } },\\n state => {\\n console.log(state.data);\\n return state;\\n }\\n);\\n```\\n\\n## Insert or Update a reference data using a unique id as a key\\n\\nThis function is used to either update a location if matched or insert a new. A\\ncustom `externalId` can be provided.\\n\\n```js\\nupsertReferenceData('id', {\\n categoryId: 'CATEGORY',\\n value: 'VALUE',\\n readOnly: false,\\n active: true,\\n id: 'ID',\\n createdAt: '2020-10-01T18:48:31.784Z',\\n createdBy: '95d31ea9',\\n updatedAt: '2020-10-01T18:48:31.784Z',\\n updatedBy: '95d31ea9',\\n createdOn: 'API',\\n deleted: false,\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-godata\\n\\n## 3.4.0\\n\\n### Minor Changes\\n\\n- df4cfca: Switch from `'writeOnly: true'` to `'format: email'` in the godata\\n configuration schema.\\n\\n## 3.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 3.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 3.2.4\\n\\n### Patch Changes\\n\\n- ef828e7: update old urls in readme\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 3.2.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 3.2.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 3.2.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 3.2.0\\n\\n### Minor Changes\\n\\n- 8e7a79e: Migrate Godata\\n\\n### Patch Changes\\n\\n- cbb8968: Fix axios Inefficient Regular Expression Complexity vulnerability\\n- e81561f: Updated ast and package.json\\n\"","functions":["getCase","getContact","getLocation","getOutbreak","getReferenceData","listCases","listContacts","listLocations","listOutbreaks","listReferenceData","upsertCase","upsertContact","upsertLocation","upsertOutbreak","upsertReferenceData"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"apiUrl":{"title":"API URL","type":"string","description":"Godata API URL","default":"https://www.who-godata.com/api","format":"uri","minLength":1,"examples":["https://www.who-godata.com/api"]},"email":{"title":"Email","type":"string","description":"Your Godata login email","format":"email","minLength":1,"examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Your Godata login password","writeOnly":true,"minLength":1,"examples":["@some(!)Strongpassword"]}},"type":"object","additionalProperties":true,"required":["apiUrl","email","password"]}}, -{"name":"googlehealthcare","adaptor":"@openfn/language-googlehealthcare","version":"1.0.0","docs":"\"## createFhirResource\\n\\ncreateFhirResource([fhirStore], resource, callback) ⇒ Operation\\nCreate some resource in Google Cloud Healthcare\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| [fhirStore] | Object | The FHIR store information. - `cloudRegion` (string): The cloud region where the FHIR store is located. - `projectId` (string): The ID of the project that contains the FHIR store. - `datasetId` (string): The ID of the dataset that contains the FHIR store. - `fhirStoreId` (string): The ID of the FHIR store. |\\n| resource | object | The FHIR resource data to be created |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ncreateFhirResource(\\n {\\n cloudRegion: \\\"us-central1\\\",\\n projectId: \\\"adjective-noun-123\\\",\\n datasetId: \\\"my-dataset\\\",\\n fhirStoreId: \\\"my-fhir-store\\\",\\n },\\n {\\n resourceType: \\\"Patient\\\",\\n name: [{ use: \\\"official\\\", family: \\\"Smith\\\", given: [\\\"Darcy\\\"] }],\\n gender: \\\"female\\\",\\n birthDate: \\\"1970-01-01\\\",\\n }\\n);\\n```\\n**Example** \\n```js\\ncreateFhirResource(\\n {\\n cloudRegion: \\\"us-central1\\\",\\n projectId: \\\"adjective-noun-123\\\",\\n datasetId: \\\"my-dataset\\\",\\n fhirStoreId: \\\"my-fhir-store\\\",\\n },\\n (state) => ({\\n resourceType: \\\"Encounter\\\",\\n status: \\\"finished\\\",\\n class: {\\n system: \\\"http://hl7.org/fhir/v3/ActCode\\\",\\n code: \\\"IMP\\\",\\n display: \\\"inpatient encounter\\\",\\n },\\n reasonCode: [\\n {\\n text: \\\"The patient had an abnormal heart rate. She was concerned about this.\\\",\\n },\\n ],\\n subject: {\\n reference: `Patient/${state.data.id}`,\\n },\\n })\\n);\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-googlehealthcare \\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the\\n[Google Cloud Healthcare API](https://cloud.google.com/healthcare-api/docs/how-tos/fhir-resources#healthcare-create-patient-nodejs).\\n\\n## Documentation\\n\\nView the\\n[docs site](https://docs.openfn.org/adaptors/packages/googlehealthcare-docs) for\\nfull technical documentation.\\n\\n### Configuration\\n\\nView the\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/googlehealthcare-configuration-schema/)\\nfor required and optional `configuration` properties.\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n\\\"Getting Started\\\" guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build _only_ the docs run `pnpm build docs`.\\n\"","changelog":"\"# @openfn/language-googlehealthcare\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\n- 7df7e20: remove `projectId`, `dataSetId`, `cloudRegion`, and `fhirStoreId` out\\n of configuration\\n\\n The new implementation of `createFhirResource(fhirStore, resource, callback)`\\n allows you to use one set of credentials to access different Google Healthcare\\n Cloud FHIR stores. `fhirStore` is an object that contains the FHIR store\\n information\\n (`{cloudRegion: string, projectId: string, datasetId: string, fhirStoreId: string}`).\\n\\n## 0.1.0\\n\\n### Minor Changes\\n\\n- 861d774: add createFhirResource function\\n\\n### Patch Changes\\n\\n- aad9549: Ensure that standard OAuth2 credentials with snake-cased\\n \\\"access_token\\\" keys can be used for OAuth2-reliant adaptors\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\"","functions":["createFhirResource"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","$comment":"OAuth2","type":"object","properties":{"access_token":{"title":"Access Token","type":"string","description":"Your Google Cloud Healthcare access token","writeOnly":true,"minLength":1,"examples":["eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRlQyU3ZRdVhoODQ2WVR3RUlCdyIsI"]},"apiVersion":{"title":"API Version","type":"string","description":"The API version","default":"v1","examples":["v1","v1beta1"]}},"required":["access_token"]}}, -{"name":"googlesheets","adaptor":"@openfn/language-googlesheets","version":"2.2.2","docs":"\"## appendValues\\n\\nappendValues(params) ⇒ Operation\\nAdd an array of rows to the spreadsheet.\\nhttps://developers.google.com/sheets/api/samples/writing#append_values\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | Object | Data object to add to the spreadsheet. |\\n\\n**Example** \\n```js\\nappendValues({\\n spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\\n range: 'Sheet1!A1:E1',\\n values: [\\n ['From expression', '$15', '2', '3/15/2016'],\\n ['Really now!', '$100', '1', '3/20/2016'],\\n ],\\n})\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Google Sheets\\n\\nLanguage Pack for building expressions and operations to make Google Sheets API\\ncalls.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/googlesheets-configuration-schema/)\\ndefinition.\\n\\n### appendValues()\\n\\nAdd rows to an existing sheet:\\n`https://sheets.googleapis.com/v4/spreadsheets/spreadsheetId/values/Sheet1!A1:E1:append?valueInputOption=USER_ENTERED`\\n\\n```js\\nappendValues({\\n spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\\n range: 'Sheet1!A1:E1',\\n values: [\\n ['From expression', '$15', '2', '3/15/2016'],\\n ['Really now!', '$100', '1', '3/20/2016'],\\n ],\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-googlesheets\\n\\n## 2.2.2\\n\\n### Patch Changes\\n\\n- aad9549: Ensure that standard OAuth2 credentials with snake-cased\\n \\\"access_token\\\" keys can be used for OAuth2-reliant adaptors\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 2.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 2.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 2.1.6\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 2.1.5\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 2.1.4\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 2.1.3\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 2.1.2\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 2.1.1\\n\\n### Patch Changes\\n\\n- 9a2755e: Update dependency on language-common\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 2.1.0\\n\\n### Minor Changes\\n\\n- 9e7d458: Migrate googlesheets\\n\"","functions":["appendValues"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","$comment":"OAuth2","properties":{"access_token":{"title":"Access Token","type":"string","description":"Your Google Sheets access token","writeOnly":true,"minLength":1,"examples":["eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRlQyU3ZRdVhoODQ2WVR3RUlCdyIsI"]}},"type":"object","additionalProperties":true,"required":["access_token"]}}, -{"name":"hive","adaptor":"@openfn/language-hive","version":"0.2.0","docs":"\"## query\\n\\nquery(qs, options, callback) ⇒ Operation\\nExecute an SQL statement\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| qs | string | SQL statement |\\n| options | object | (Optional) options for executing sql statement |\\n| callback | function | An optional callback function |\\n\\n**Example** *(Get patient count from hive database)* \\n```js\\nquery(\\\"select count(*) from patient\\\");\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-hive \\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the HIVE API.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/hive-docs) for\\nfull technical documentation.\\n\\n### Configuration\\n\\nView the\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/hive-configuration-schema/)\\nfor required and optional `configuration` properties.\\n\\n### A example expression using the `query` function\\n\\n```js\\nquery('select count(*) from patient');\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n\\\"Getting Started\\\" guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build _only_ the docs run `pnpm build docs`.\\n\"","changelog":"\"# @openfn/language-hive\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- a380347: Add query function\\n\"","functions":["query"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"host":{"title":"Host URL","type":"string","description":"The database instance host URL","format":"uri","minLength":1,"examples":["some-host-url.compute-1.amazonaws.com"]},"port":{"title":"Port","type":"integer","default":10001,"description":"Database instance port","minLength":1,"examples":[10001]},"database":{"title":"Database","type":"string","description":"The database name","minLength":1,"examples":["demo-db"]},"username":{"title":"Username","type":"string","description":"The username to log in the database","minLength":1,"examples":["admin-demo"]},"password":{"title":"Password","type":"string","description":"The password to log in the database","writeOnly":true,"minLength":1,"examples":["@super(!)Secretpass"]}},"type":"object","additionalProperties":true,"required":["host","port","username","password"]}}, -{"name":"http","adaptor":"@openfn/language-http","version":"6.0.0","docs":"\"## Functions\\n\\n
\\n
\\n del(path, params, callback)
\\n
\\n get(path, params, callback)
\\n
\\n parseXML(body, script)
\\n
\\n patch(path, params, callback)
\\n
\\n post(path, params, callback)
\\n
\\n put(path, params, callback)
\\n
\\n request(method, path, params, callback)
\\n
\\n\\n\\n## del\\n\\ndel(path, params, callback) ⇒ Operation\\nMake a DELETE request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Auth parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\ndel(`/myendpoint/${state => state.data.id}`, {\\n headers: {'content-type': 'application/json'}\\n })\\n```\\n\\n* * *\\n\\n## get\\n\\nget(path, params, callback) ⇒ Operation\\nMake a GET request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| params | [RequestOptions](#RequestOptions) | Query, Headers and Authentication parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nget('/myEndpoint', {\\n query: {foo: 'bar', a: 1},\\n headers: {'content-type': 'application/json'},\\n})\\n```\\n\\n* * *\\n\\n## parseXML\\n\\nparseXML(body, script) ⇒ Operation\\nParse XML with the Cheerio parser\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| body | String | data string to be parsed |\\n| script | function | script for extracting data |\\n\\n**Example** \\n```js\\nparseXML(body, function($){\\n return $(\\\"table[class=your_table]\\\").parsetable(true, true, true);\\n })\\n```\\n\\n* * *\\n\\n## patch\\n\\npatch(path, params, callback) ⇒ Operation\\nMake a PATCH request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Auth parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\npatch('/myEndpoint', {\\n body: {'foo': 'bar'},\\n headers: {'content-type': 'application/json'},\\n })\\n```\\n\\n* * *\\n\\n## post\\n\\npost(path, params, callback) ⇒ operation\\nMake a POST request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Authentication parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\npost('/myEndpoint', {\\n body: {'foo': 'bar'},\\n headers: {'content-type': 'application/json'},\\n })\\n```\\n\\n* * *\\n\\n## put\\n\\nput(path, params, callback) ⇒ Operation\\nMake a PUT request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Auth parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nput('/myEndpoint', {\\n body: {'foo': 'bar'},\\n headers: {'content-type': 'application/json'},\\n })\\n```\\n\\n* * *\\n\\n## request\\n\\nrequest(method, path, params, callback) ⇒ Operation\\nMake a HTTP request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| method | string | The HTTP method to use |\\n| path | string | Path to resource |\\n| params | [RequestOptions](#RequestOptions) | Query, Headers and Authentication parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nget('/myEndpoint', {\\n query: {foo: 'bar', a: 1},\\n headers: {'content-type': 'application/json'},\\n})\\n```\\n\\n* * *\\n\\n## RequestOptions\\n\\nRequestOptions : Object\\nOptions provided to the HTTP request\\n\\n**Kind**: global typedef \\n**Properties**\\n\\n| Name | Type | Description |\\n| --- | --- | --- |\\n| body | object \\\\| string | body data to append to the request |\\n| errors | object | Map of errorCodes -> error messages, ie, `{ 404: 'Resource not found;' }`. Use a falsy message value to suppress errors for thiscode. |\\n| query | object | an object of query parameters. Will be encoded into the URL. |\\n| headers | object | an object of headers to append to the request |\\n| parseAs | string | parse the response body as json, text or stream. By default will use the response headers. |\\n| timeout | number | Request timeout in ms. Default: 300 seconds. |\\n| tls | object | TLS/SSL authentication options. See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions |\\n\\n\\n* * *\\n\\n\"","readme":"\"# Language HTTP\\n\\nLanguage Pack for building expressions and operations to make HTTP calls.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/http-configuration-schema/)\\ndefinition.\\n\\n### Get data\\n\\nThis helper function allows the use of a get method to fetch data. You can\\nspecify a query string for filter.\\n\\n```js\\nget(\\n '/myendpoint',\\n {\\n query: { foo: 'bar', a: 1 },\\n headers: { 'content-type': 'application/json' },\\n authentication: { username: 'taylor', password: 'somethingsecret' },\\n },\\n state => {\\n return state;\\n }\\n);\\n```\\n\\n### Post existing data\\n\\nSend some data to an existing endpoint.\\n\\n```js\\npost('/endpoint', {\\n body: state => {\\n return {\\n field_1: 'some_data',\\n field_2: 'some_more_data',\\n field_id: dataValue('Some.Json.Object.Id')(state),\\n };\\n },\\n headers: {\\n Authorization: 'AUTH_KEY',\\n 'Content-Type': 'application/json',\\n },\\n});\\n```\\n\\n### Update existing data with PUT or PATCH\\n\\n```js\\nput(\\n '/myendpoint',\\n {\\n body: { firstname: 'taylor', lastname: 'downs' },\\n headers: { 'content-type': 'application/json' },\\n authentication: { username: 'user', password: 'pass' },\\n },\\n state => {\\n return state;\\n }\\n);\\n```\\n\\n```js\\npatch(\\n '/myendpoint',\\n {\\n body: { firstname: 'taylor', lastname: 'downs' },\\n headers: { 'content-type': 'application/json' },\\n authentication: { username: 'user', password: 'pass' },\\n },\\n state => {\\n return state;\\n }\\n);\\n```\\n\\n### Delete data\\n\\n```js\\ndel(\\n '/myendpoint',\\n {\\n query: { id: 'someId' },\\n headers: { 'content-type': 'application/json' },\\n authentication: { username: 'user', password: 'pass' },\\n },\\n state => {\\n return state;\\n }\\n);\\n```\\n\\n### Parse XML\\n\\nThis function allows you to parse some xml data. A callback function can be use\\nto store in a table.\\n\\n```js\\nparseXML(body, function ($) {\\n return $('table[class=your_table]').parsetable(true, true, true);\\n});\\n```\\n\\n### Parse CSV\\n\\n```js\\nparseCSV('someData.csv', {\\n quoteChar: '\\\"',\\n header: false,\\n});\\n```\\n\\n### Sample parse local CSV file\\n\\n```js\\nparseCSV('PatientsJan2009.csv', {\\n quoteChar: '\\\"',\\n header: false,\\n columns: true,\\n skip_empty_lines: true,\\n trim: true,\\n bom: true,\\n});\\n```\\n\\n## Development\\n\\nClone the repo, run `pnpm install`.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`.\\n\\nTo build the docs for this repo, run `pnpm build:docs`.\\n\"","changelog":"\"# @openfn/language-http\\n\\n## 6.0.0\\n\\n### Major Changes\\n\\n- f741086: The axios library has been removed and the operation API simplified.\\n\\n ### New features\\n\\n - Error mapping. Provide custom errors to response status codes, eg, Eg:\\n `{errors: {404: \\\"You don't have access\\\"}}`\\n - parseAs option. Overrides the default response type. Eg: `{parseAs: \\\"json\\\"}`\\n - Request logging. All requests are now logged to stdout.\\n - tls options. Pass SSL certificates using the `tls` option on any request.\\n\\n ### Breaking changes\\n\\n - Removed `axios` export\\n - Axios options on `get`, `post`, `put`, `patch`, and `del` are no longer\\n supported (unless otherwise stated). This includes `gzip`,`qs`, `formData`,\\n `successCodes` and `keepCookie`\\n - Option params `json` and `agentOptions` have been deprecated. They still\\n work, but you should use `body` and `tls` instead (the behaviour should be\\n the same)\\n\\n### Patch Changes\\n\\n- Updated dependencies [7f52699]\\n - @openfn/language-common@1.12.0\\n\\n## 5.1.1\\n\\n### Patch Changes\\n\\n- a8d655e: Update `parseXML` to use `expandReferences`\\n\\n## 5.1.0\\n\\n### Minor Changes\\n\\n- 8e2b79c: Clean up `state.response.request` by returning only\\n `{ method, path, host, protocol, _headers }`\\n\\n## 5.0.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 5.0.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 5.0.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 5.0.1\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 5.0.0\\n\\n### Major Changes\\n\\n- 0b6f20b: use parseCsv from common\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 4.3.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 4.3.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 4.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 4.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 4.2.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 4.2.7\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 4.2.6\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 4.2.5\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 4.2.4\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 4.2.3\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 4.2.2\\n\\n### Patch Changes\\n\\n- 9a2755e: Update dependency on language-common\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 4.2.1\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\\n## 4.2.0\\n\\n### Minor Changes\\n\\n- f670bf8: Added credential schema to enable new ui\\n\\n## 4.1.0\\n\\n### Minor Changes\\n\\n- 8e1b86d: update http to new format\\n\\n## 4.0.1\\n\\n### Patch Changes\\n\\n- 4671e89: Migrate language-http\\n\"","functions":["del","get","parseXML","patch","post","put"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"username":{"title":"Username","type":"string","description":"Username","examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"examples":["@some(!)Password"]},"baseUrl":{"title":"Base URL","anyOf":[{"type":"string"},{"type":"null"}],"description":"The base URL (http://www.example.com)","format":"uri","minLength":1,"examples":["https://instance_name.surveycto.com"]}},"type":"object","additionalProperties":true,"required":["password","username"]}}, -{"name":"khanacademy","adaptor":"@openfn/language-khanacademy","version":"0.4.1","docs":"\"## fetch\\n\\nfetch(params) ⇒ Operation\\nFetch data from the Khan Academy API\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the query |\\n\\n**Example** \\n```js\\nexecute(\\n fetch(params)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language KhanAcademy\\n\\nLanguage Pack for building expressions and operations to make HTTP calls.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/khanacademy-configuration-schema/)\\ndefinition.\\n\\n## fetch\\n\\n#### sample usage\\n\\n```js\\nfetch({\\n getEndpoint: 'user',\\n queryParams: {\\n email: 'thisoneuser@something.org',\\n },\\n postUrl: 'https://www.openfn.org/inbox/your-uuid',\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-khanacademy\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 9137655: migrate khanacademy\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"email":{"title":"Email","type":"string","description":"Your Khanacademy login email","format":"email","minLength":1,"examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Your Khanacademy login password","writeOnly":true,"minLength":1,"examples":["@some(!)Strongpassword"]},"consumerKey":{"title":"Consumer Key","type":"string","description":"Your Khanacademy consumer key","writeOnly":true,"minLength":1,"examples":["somEThINGkeyish"]},"secretKey":{"title":"Secret Key","type":"string","description":"Your Khanacademy secret key","writeOnly":true,"minLength":1,"examples":["otherThiNGfSECret"]}},"type":"object","additionalProperties":true,"required":["email","password","secretKey","consumerKey"]}}, -{"name":"kobotoolbox","adaptor":"@openfn/language-kobotoolbox","version":"2.1.0","docs":"\"## Functions\\n\\n
\\n
\\n getDeploymentInfo(params, callback)
\\n
\\n getForms(params, callback)
\\n
\\n getSubmissions(params, callback)
\\n
\\n\\n\\n## getDeploymentInfo\\n\\ngetDeploymentInfo(params, callback) ⇒ Operation\\nGet deployment information for a specific form\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Form Id and data to make the fetch or filter |\\n| callback | function | (Optional) Callback function to execute after fetching form deployment information |\\n\\n**Example** \\n```js\\ngetDeploymentInfo({formId: 'aXecHjmbATuF6iGFmvBLBX'}, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n* * *\\n\\n## getForms\\n\\ngetForms(params, callback) ⇒ Operation\\nMake a request to get the list of forms\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Query, Headers and Authentication parameters |\\n| callback | function | (Optional) Callback function to execute after fetching form list |\\n\\n**Example** \\n```js\\ngetForms({}, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n* * *\\n\\n## getSubmissions\\n\\ngetSubmissions(params, callback) ⇒ Operation\\nGet submissions for a specific form\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Form Id and data to make the fetch or filter |\\n| callback | function | (Optional) Callback function to execute after fetching form submissions |\\n\\n**Example** \\n```js\\ngetSubmissions({formId: 'aXecHjmbATuF6iGFmvBLBX'}, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language KoboToolbox\\n\\nLanguage Pack for building expressions and operations to interact with the\\n[TEMPLATE] API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/kobotoolbox-configuration-schema/)\\ndefinition.\\n\\n#### Get the list of forms\\n\\n```js\\ngetForms({}, state => {\\n console.log(state.data);\\n return state;\\n});\\n```\\n\\n### Get submissions for a specific form\\n\\nA query can be used to filter results.\\n\\n```js\\ngetSubmissions(\\n { formId: 'aXecHjmbATuF6iGFmvBLBX', query: { end: { $gte: '2020-11-20' } } },\\n state => {\\n console.log(state.data);\\n return state;\\n }\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-kobotoolbox\\n\\n## 2.1.0\\n\\n### Minor Changes\\n\\n- c85abf3: Removed the API version enum values in the credential configuration\\n json schema and added a placeholder\\n\\n## 2.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 2.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.3.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.3.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.3.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.3.0\\n\\n### Minor Changes\\n\\n- e48c30c: add getDeploymentInfo function\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- 7b5ca3e: add fn and fix adaptors export\\n\\n### Patch Changes\\n\\n- 4067c28: build ast file\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- 7fc47d8: Migrate kobotoolbox\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\"","functions":["getForms"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"baseURL":{"title":"Base URL","type":"string","default":"https://kf.kobotoolbox.org","description":"Kobotoolbox URL","format":"uri","minLength":1,"examples":["https://kf.kobotoolbox.org"]},"username":{"title":"Username","type":"string","description":"Kobotoolbox username","minLength":1,"examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Kobotoolbox password","writeOnly":true,"minLength":1,"examples":["@some(!)Strongpassword"]},"apiVersion":{"title":"API Version","type":"string","placeholder":"v2","description":"Kobotoolbox API version to use","minLength":1,"examples":["v2"]}},"type":"object","additionalProperties":true,"required":["username","baseURL","password","apiVersion"]}}, -{"name":"magpi","adaptor":"@openfn/language-magpi","version":"1.1.1","docs":"\"## Functions\\n\\n
\\n
\\n fetchSurveyData(params)
\\n
\\n submitRecord(jsonData)
\\n
\\n\\n\\n## fetchSurveyData\\n\\nfetchSurveyData(params) ⇒ Operation\\nMake a POST request to fetch Magpi data and POST it somewhere else\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the fetch |\\n\\n**Example** \\n```js\\nfetchSurveyData({\\n \\\"surveyId\\\": \\\"37479\\\",\\n \\\"afterDate\\\": \\\"2017-09-27\\\",\\n \\\"postUrl\\\": \\\"https://www.openfn.org/inbox/your-inbox-url\\\"\\n})\\n```\\n\\n* * *\\n\\n## submitRecord\\n\\nsubmitRecord(jsonData) ⇒ Operation\\nSubmit a record for a form/survey which already exists in a Magpi user account\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| jsonData | object | Payload data for the record |\\n\\n**Example** \\n```js\\nsubmitRecord(jsonData)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Magpi\\n\\nLanguage Pack for building expressions and operations for working with the\\n[Magpi inbound API](http://support.magpi.com/support/solutions/articles/4839-magpi-inbound-api)\\nand the\\n[Magpi outbound API](http://support.magpi.com/support/solutions/articles/4865-magpi-outbound-api).\\n\\n_N.B.: The Magpi API is under development and this pack may change._\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/magpi-configuration-schema/)\\ndefinition.\\n\\n## Fetch data from Magpi\\n\\nAllows you to fetch data from Magpi and post it elsewhere.\\n\\n#### Using `fetchSurveyData`:\\n\\nhttps://www.magpi.com/api/surveydata/v2?username=taylordowns2000&accesstoken=blahblahblah&surveyid=921409679070\\n\\n```js\\nfetchSurveyData({\\n surveyId: '37479',\\n afterDate: '2016-01-01',\\n beforeDate: '2100-01-01',\\n postUrl: 'https://www.openfn.org/inbox/secret-5c25-inbox-ba2c-url',\\n});\\n```\\n\\n## Submit new records\\n\\n**wip:** This will allow you to push data to Magpi to create a new record for a\\nform which exists in a user account.\\n\\n#### Using `submitRecord`:\\n\\n```js\\nsubmitRecord(1, 2);\\n```\\n\\n#### Magpi Outbound API Parameters:\\n\\n- `username`: The account username.\\n- `accesstoken`: The accesstoken generated on the site. Each accesstoken is\\n associated with the user who generated.\\n- `surveyid`: The surveyid is not the survey's name. The surveyid can be\\n obtained from the list of forms generated in 1 above.\\n- `startdate`: Start date of the data to be returned. Filtering is done based on\\n the DateStamp and is inclusive.(Optional). The date format should be the same\\n one as the one on the data tab/ The date format should be the same one as the\\n one on the data tab\\n- `enddate`: End date of the data to be returned. Filtering is done based on the\\n DateStamp and is inclusive.(Optional)\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-magpi\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.0.5\\n\\n### Patch Changes\\n\\n- 86fb813: dependencies update\\n\\n## 1.0.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.0.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.0.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.0.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\n- e6c2b4a: Update xml2js parser\\n\\n### Minor Changes\\n\\n- df5dd2e: migrate magpi\\n\"","functions":["fetchSurveyData","submitRecord"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"username":{"title":"username","type":"string","description":"Magpi username","minLength":1,"examples":["test@openfn.org"]},"accessToken":{"title":"Access Token","type":"string","description":"Magpi access token","writeOnly":true,"minLength":1,"examples":["somEThINGkeyish"]}},"type":"object","additionalProperties":true,"required":["username","accessToken"]}}, -{"name":"mailchimp","adaptor":"@openfn/language-mailchimp","version":"0.7.2","docs":"\"## Functions\\n\\n
\\n
\\n addMember(params, [callback])
\\n
\\n archiveMember(params, [callback])
\\n
\\n deleteMember(params, [callback])
\\n
\\n get(path, query, [callback])
\\n
\\n listAudienceInfo(query, [callback])
\\n
\\n listAudiences(query, [callback])
\\n
\\n listBatches(params, [callback])
\\n
\\n listMembers(params, [callback])
\\n
\\n post(path, body, query, [callback])
\\n
\\n request(method, path, options, [callback])
\\n
\\n startBatch(params, [callback])
\\n
\\n tagMembers(params, [callback])
\\n
\\n updateMember(params, [callback])
\\n
\\n updateMemberTags(params, [callback])
\\n
\\n upsertMembers(params, [callback])
\\n
\\n\\n\\n## addMember\\n\\naddMember(params, [callback]) ⇒ Operation\\naddMember to a list\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## archiveMember\\n\\narchiveMember(params, [callback]) ⇒ Operation\\narchiveMember in a list\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## deleteMember\\n\\ndeleteMember(params, [callback]) ⇒ Operation\\nPermanently delete a member from a list\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## get\\n\\nget(path, query, [callback]) ⇒ Operation\\nThe get function is used to make a GET request to the Mailchimp API.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | The endpoint of the api to which the request should be made |\\n| query | object | An object containing query parameters to be included in the request |\\n| [callback] | function | (Optional) callback to handle the response |\\n\\n**Example** *(Get a list of account exports for a given account)* \\n```js\\nget('/account-exports');\\n```\\n\\n* * *\\n\\n## listAudienceInfo\\n\\nlistAudienceInfo(query, [callback]) ⇒ Operation\\nGet information about a specific list in your Mailchimp account.\\nResults include list members who have signed up but haven't confirmed their subscription yet and unsubscribed or cleaned.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | listId and query parameters |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## listAudiences\\n\\nlistAudiences(query, [callback]) ⇒ Operation\\nGet information about all lists in the account.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | Query parameters |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## listBatches\\n\\nlistBatches(params, [callback]) ⇒ Operation\\nlistBatches\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## listMembers\\n\\nlistMembers(params, [callback]) ⇒ Operation\\nlistMembers\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## post\\n\\npost(path, body, query, [callback]) ⇒ Operation\\nThe post function is used to make a POST request to the Mailchimp API.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | The endpoint of the api to which the request should be made. |\\n| body | object | The data to be sent in the body of the request |\\n| query | object | An object containing query parameters to be included in the request |\\n| [callback] | function | (Optional) callback to handle the response |\\n\\n**Example** *(Create a new account export in your Mailchimp account)* \\n```js\\npost('/accounts-export', {include_stages:[]});\\n```\\n\\n* * *\\n\\n## request\\n\\nrequest(method, path, options, [callback]) ⇒ Operation\\nMake an HTTP request to Mailchimp API\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| method | string | The HTTP method for the request (e.g., 'GET', 'POST', 'PUT', 'DELETE'). |\\n| path | string | The endpoint of the api to which the request should be made. |\\n| options | Object | Additional options for the request (query, body only). |\\n| [callback] | function | (Optional) callback function to handle the response. |\\n\\n**Example** *(Get list to all other resources available in the API)* \\n```js\\nrequest('GET','/');\\n```\\n**Example** *(Create a new account export in your Mailchimp account)* \\n```js\\nrequest('POST','/accounts-export', {include_stages:[]});\\n```\\n\\n* * *\\n\\n## startBatch\\n\\nstartBatch(params, [callback]) ⇒ Operation\\nStart a batch with a list of operations.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | operations batch job |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\nstartBatch(params)\\n```\\n\\n* * *\\n\\n## tagMembers\\n\\ntagMembers(params, [callback]) ⇒ Operation\\nTag members with a particular tag\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a tagId, members, and a list |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\ntagMembers((state) => ({\\n listId: \\\"someId\\\", // All Subscribers list\\n tagId: \\\"someTag\\\", // User tag\\n members: state.response.body.rows.map((u) => u.email),\\n}));\\n```\\n**Example** \\n```js\\ntagMembers((state) => ({\\n listId: \\\"someId\\\",\\n tagId: \\\"someTag\\\",\\n members: state.response.body.rows\\n .filter((u) => u.allow_other_emails)\\n .map((u) => u.email),\\n}));\\n```\\n\\n* * *\\n\\n## updateMember\\n\\nupdateMember(params, [callback]) ⇒ Operation\\nupdateMember\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId,subscriberHash and member |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## updateMemberTags\\n\\nupdateMemberTags(params, [callback]) ⇒ Operation\\nupdateMemberTags\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n\\n* * *\\n\\n## upsertMembers\\n\\nupsertMembers(params, [callback]) ⇒ Operation\\nAdd or update a list members\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | a listId, users, and options |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\nupsertMembers((state) => ({\\n listId: \\\"someId\\\",\\n users: state.response.body.rows.map((u) => ({\\n email: u.email,\\n status: u.allow_other_emails ? \\\"subscribed\\\" : \\\"unsubscribed\\\",\\n mergeFields: { FNAME: u.first_name, LNAME: u.last_name },\\n })),\\n}));\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Mailchimp\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the Mailchimp\\nmarketing API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/mailchimp-configuration-schema/)\\ndefinition.\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-mailchimp\\n\\n## 0.7.2\\n\\n### Patch Changes\\n\\n- 1131c34: Remove regex pattern for validation and changed minLength to 1\\n\\n## 0.7.1\\n\\n### Patch Changes\\n\\n- 1f856c4: Update configuration schema\\n- 48394f5: - fix ast docs warnings\\n - add status code log on request\\n\\n## 0.7.0\\n\\n### Minor Changes\\n\\n- 58fcea9: - Add chunk from common\\n - Improve error logs\\n - Return `state` in request finalState\\n\\n## 0.6.0\\n\\n### Minor Changes\\n\\n- 1582873: Add request, get and post functions\\n\\n## 0.5.0\\n\\n### Minor Changes\\n\\n- 8e39ee1: Add new functions\\n\\n - addMember()\\n - listMembers()\\n - deleteMember()\\n - listAudiences()\\n - archiveMember()\\n - updateMemberTags()\\n - listAudienceInfo()\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.5\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- cbb8968: Fix axios Inefficient Regular Expression Complexity vulnerability\\n- e81561f: Updated ast and package.json\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 88fa3b5: migrate mailchimp\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"server":{"title":"Data Center","type":"string","description":"Mailchimp Data Center for your account","minLength":1,"examples":["us11","uk8","in10"]},"apiKey":{"title":"API Key","type":"string","description":"Mailchimp API Key","minLength":1,"examples":["0eb22c7b4a1c5bcd789379bf8a92902d-us13"]}},"type":"object","additionalProperties":true,"required":["server","apiKey"]}}, -{"name":"mailgun","adaptor":"@openfn/language-mailgun","version":"0.4.3","docs":"\"## send\\n\\nsend(params)\\nCreate an event\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Params for sending an email |\\n\\n**Example** \\n```js\\nsend({\\n from: 'from_email',\\n to: 'to_email',\\n subject: 'Your Subject',\\n text: 'Your message goes here',\\n attachment: {\\n url: 'www.google.com/doodle.png',\\n filename: 'forYou.png',\\n },\\n})\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Mailgun\\n\\nLanguage Pack for building expressions and operations for working with the\\nmailgun API.\\n\\n[mailgun-js on npm](https://www.npmjs.com/package/mailgun-js)\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/mailgun-configuration-schema/)\\ndefinition.\\n\\n## send\\n\\n```js\\nsend(\\n fields(\\n field('from', 'from_email'),\\n field('to', 'to_email'),\\n field('subject', 'Your Subject'),\\n field('text', 'Your message goes here')\\n )\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-mailgun\\n\\n## 0.4.3\\n\\n### Patch Changes\\n\\n- f86576d: Security update to mailgun.js\\n\\n## 0.4.2\\n\\n### Patch Changes\\n\\n- 4620079: Bump opinionator version\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 9ded25e: Migrate Mailgun\\n\"","functions":["send"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"domain":{"title":"Domain URL","type":"string","description":"Mailgun API domain URL","format":"uri","minLength":1,"examples":["https://mailgun.com/api/example"]},"apiKey":{"title":"API Key","type":"string","description":"Mailgun API Key","writeOnly":true,"minLength":1,"examples":["otherThiNGfSECret"]}},"type":"object","additionalProperties":true,"required":["domain","apiKey"]}}, -{"name":"maximo","adaptor":"@openfn/language-maximo","version":"0.4.1","docs":"\"## Functions\\n\\n
\\n
\\n fetch(params)
\\n
\\n update(params)
\\n
\\n update75(params)
\\n
\\n\\n\\n## fetch\\n\\nfetch(params) ⇒ Operation\\nMake a GET request and POST it somewhere else\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the fetch |\\n\\n**Example** \\n```js\\nfetch({\\n endpoint: 'maxrest/rest/os/mxinventory',\\n query: {\\n ITEMNUM: '01226',\\n _format: 'json',\\n },\\n postUrl: 'https://www.openfn.org/inbox/not-real',\\n});\\n```\\n\\n* * *\\n\\n## update\\n\\nupdate(params) ⇒ Operation\\nMake an update in Maximo 7.6 and beyond\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the update |\\n\\n**Example** \\n```js\\nexecute(\\n update(params)\\n)(state)\\n```\\n\\n* * *\\n\\n## update75\\n\\nupdate75(params) ⇒ Operation\\nMake an upadte in Maximo 7.5\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the update |\\n\\n**Example** \\n```js\\nexecute(\\n update75(params)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Maximo\\n\\nLanguage Pack for building expressions and operations to access IBM Maximo EAM.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/maximo-configuration-schema/)\\ndefinition.\\n\\n### Fetch\\n\\n#### sample 'fetch' expression\\n\\n```js\\nfetch({\\n endpoint: 'maxrest/rest/os/mxinventory',\\n query: {\\n ITEMNUM: '01226',\\n _format: 'json',\\n },\\n postUrl: 'https://www.openfn.org/inbox/not-real',\\n});\\n```\\n\\n### sample 'create' expression\\n\\n```js\\ncreate({\\n endpoint: 'maxrest/rest/os/mxinvbal/',\\n body: function (state) {\\n return {\\n ITEMNUM: dataValue('form.ITEMNUM')(state),\\n ITEMSETID: dataValue('form.ITEMSETID')(state),\\n SITEID: dataValue('form.SITEID')(state),\\n LOCATION: dataValue('form.LOCATION')(state),\\n ISSUEUNIT: 'FOO',\\n PHYSCNT: dataValue('PHYSCNT')(state),\\n BINNUM: dataValue('form.BINNUM')(state),\\n };\\n },\\n});\\n```\\n\\n### sample 'update75' expression\\n\\n```js\\nupdate75({\\n endpoint: state => {\\n return (\\n 'maxrest/rest/os/mxinvbal/' +\\n dataValue('form.question1.INVBALANCESID')(state)\\n );\\n },\\n body: state => {\\n return {\\n _action: 'AddChange', //this is required for the old Maximo API!\\n ITEMNUM: dataValue('form.ITEMNUM')(state),\\n ITEMSETID: dataValue('form.ITEMSETID')(state),\\n SITEID: dataValue('form.SITEID')(state),\\n LOCATION: dataValue('form.LOCATION')(state),\\n PHYSCNT: dataValue('form.PHYSCNT')(state),\\n BINNUM: dataValue('form.BINNUM')(state),\\n };\\n },\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-maximo\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.5\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- aed7e0b: fix required field in configuration schema\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 4d4be56: migrate maximo\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"baseUrl":{"title":"Base URL","type":"string","description":"Maximo instance base URL","format":"uri","minLength":1,"examples":["https://maximo-demo76.mro.com"]},"username":{"title":"Username","type":"string","description":"Maximo instance username","minLength":1,"examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Maximo instance password","writeOnly":true,"minLength":1,"examples":["@some(!)passowrd"]}},"type":"object","additionalProperties":true,"required":["baseUrl","username","password"]}}, -{"name":"medicmobile","adaptor":"@openfn/language-medicmobile","version":"0.4.2","docs":"\"## Functions\\n\\n
\\n
\\n changesApi(params, callback)
\\n
\\n fetchSubmissions(formId, params, postUrl)
\\n
\\n pickFormData(formId)
\\n
\\n\\n\\n## changesApi\\n\\nchangesApi(params, callback) ⇒ Operation\\nAccess the CouchDB Changes API\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Query parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nchangesApi(params, callback)\\n```\\n\\n* * *\\n\\n## fetchSubmissions\\n\\nfetchSubmissions(formId, params, postUrl) ⇒ Operation\\nAccess form submissions and post them as JSON.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| formId | string | Query parameters |\\n| params | object | Starting sequence id |\\n| postUrl | string | Inbox to post form data |\\n\\n**Example** \\n```js\\nfetchSubmissions(\\n \\\"pregnancy\\\", // formId\\n { \\\"last-event-id\\\": 334 }, // params\\n \\\"http://localhost:4000/inbox/abc-123-xyz\\\" // postUrl\\n);\\n```\\n\\n* * *\\n\\n## pickFormData\\n\\npickFormData(formId) ⇒ Operation\\nSelect submissions for a specific form\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| formId | string | The form ID. |\\n\\n**Example** \\n```js\\npickFormData(formId)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Medic Mobile\\n\\nLanguage Pack for building expressions and operations to make calls to the Medic\\nMobile API. \\n**For an overview of Medic's database, check out\\n[Medic's DB Schema v2](https://github.com/medic/medic-docs/blob/master/development/db-schema.md)** \\nThe exported functions in this language package can be executed by\\n[OpenFn/core](https://github.com/OpenFn/core):\\n\\n```sh\\n../core/lib/cli.js execute -l ./lib/Adaptor -s ./tmp/state.json -e ./tmp/expression.js\\n```\\n\\nFor quick-start help, clone\\n[OpenFn/openfn-devtools](https://github.com/OpenFn/openfn-devtools) and follow\\nthe README.md\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/medicmobile-configuration-schema/)\\ndefinition.\\n\\n#### sample fetchSubmissions expression\\n\\n```js\\nfetchSubmissions(\\n 'pregnancy', // formId\\n { 'last-event-id': 334 }, // params, last-event-id will be replaced by cursor\\n 'http://localhost:4000/inbox/abc-123-xyz' // postUrl\\n);\\n```\\n\\n#### sample changesApi and pickFormData usage\\n\\n```js\\n// get all the changes...\\nchangesApi({\\n include_docs: true,\\n // This only gets used the first time the job is run.\\n // Subsequent runs take the lastSeq value as their cursor.\\n // \\\"last-event-id\\\": 789,\\n});\\n\\n// Picks out the field data for a given formId.\\npickFormData('pregnancy');\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-medicmobile\\n\\n## 0.4.2\\n\\n### Patch Changes\\n\\n- 421fad3: Bump query-string\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 2cd3236: migrate medicmobile\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":["changesApi","fetchSubmissions","pickFormData"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"server":{"title":"Server URL","type":"string","description":"Medic's CouchDB api URL","format":"uri","minLength":1,"examples":["https://standard.app.medicmobile.org"]},"db":{"title":"Database","type":"string","description":"Database name","minLength":1,"examples":["medic"]},"username":{"title":"Username","type":"string","description":"Medic instance username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Medic instance password","writeOnly":true,"minLength":1,"examples":["@super(!)Secret"]}},"type":"object","additionalProperties":true,"required":["server","username","password","db"]}}, -{"name":"mogli","adaptor":"@openfn/language-mogli","version":"0.4.1","docs":"\"## Functions\\n\\n
\\n
\\n cleanupState(state)
\\n
\\n lookup(relationshipName, externalID, path)
\\n
\\n relationship(relationshipName, externalID, dataSource)
\\n
\\n\\n\\n## cleanupState\\n\\ncleanupState(state) ⇒ State\\nRemoves unserializable keys from the state.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n\\n\\n* * *\\n\\n## lookup\\n\\nlookup(relationshipName, externalID, path) ⇒ object\\nAdds a lookup or 'dome insert' to a record.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| relationshipName | string | `__r` relationship field on the record. |\\n| externalID | string | Salesforce ExternalID field. |\\n| path | string | JSONPath to data source. |\\n\\n**Example** *(Example)* \\n```js\\nlookup(\\\"relationship_name__r\\\", \\\"externalID on related object\\\", \\\"$.path\\\")\\n```\\n\\n* * *\\n\\n## relationship\\n\\nrelationship(relationshipName, externalID, dataSource) ⇒ object\\nAdds a lookup or 'dome insert' to a record.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| relationshipName | string | `__r` relationship field on the record. |\\n| externalID | string | Salesforce ExternalID field. |\\n| dataSource | string | resolvable source. |\\n\\n**Example** *(Data Sourced Value)* \\n```js\\nrelationship(\\\"relationship_name__r\\\", \\\"externalID on related object\\\", dataSource(\\\"path\\\"))\\n```\\n**Example** *(Fixed Value)* \\n```js\\nrelationship(\\\"relationship_name__r\\\", \\\"externalID on related object\\\", \\\"hello world\\\")\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Mogli\\n\\nLanguage Pack for building expressions and operations to interact with Mogli\\nSMS.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/mogli-configuration-schema/)\\ndefinition.\\n\\n### Create inbound SMS\\n\\n```js\\ncreateSMS(\\n fields(\\n field('sender', dataValue('from_number')),\\n field('receivedAt', dataValue('timestamp')),\\n field('message', dataValue('message'))\\n )\\n);\\n```\\n\\n\\n\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"v0.1.6\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- 7cc8efc: remove FakeAdaptor references\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- # c6056e8: migrate mogli\\n\\n* State gets cleaned up after the operations are finished. This means that the\\n final state is serializable.\\n\\n The JSForce connection object is provided by `createConnection`, and in turn\\n `execute` ensures it is run before the user's operations.\\n\\n The `cleanupState` reducer simply deletes the connection key from state.\\n\\n# v0.1.3\\n\\n- Bumped language-common dependency to v0.0.4.\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"loginUrl":{"title":"Login URL","type":"string","description":"Mogli instance login URL","format":"uri","minLength":1,"examples":[" https://www.orange-or-airtel-or-vodafone.com/api/"]},"username":{"title":"Username","type":"string","description":"Mogli instance username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Mogli instance password","writeOnly":true,"minLength":1,"examples":["@secret(!)Pass"]},"securityToken":{"title":"Security Token","type":"string","description":"Mogli instance security token","writeOnly":true,"minLength":1,"examples":["dGF5bG9yOnNlY3JldA=="]},"secret":{"title":"Secret","type":"string","description":"Mogli instance secret","writeOnly":true,"minLength":1,"examples":["someotherThiNGfSECret"]}},"type":"object","additionalProperties":true,"required":["loginUrl","username","password","securityToken","secret"]}}, -{"name":"mongodb","adaptor":"@openfn/language-mongodb","version":"2.0.0","docs":"\"## Functions\\n\\n
\\n
\\n connect(state)
\\n
\\n disconnect(state)
\\n
\\n execute(operations)
\\n
\\n findDocuments(params)
\\n
\\n insertDocuments(params)
\\n
\\n updateDocument(params)
\\n
\\n\\n\\n## connect\\n\\nconnect(state) ⇒ State\\nConnects to a mongoDb instance\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | Runtime state. |\\n\\n**Example** \\n```js\\nconnect(state)\\n```\\n\\n* * *\\n\\n## disconnect\\n\\ndisconnect(state) ⇒ State\\nRemoves connection from the state.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n\\n**Example** \\n```js\\ndisconnect(state)\\n```\\n\\n* * *\\n\\n## execute\\n\\nexecute(operations) ⇒ Operation\\nExecute a sequence of operations.\\nWraps `@openfn/language-common/execute`, and prepends initial state for http.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| operations | Operations | Operations to be performed. |\\n\\n**Example** \\n```js\\nexecute(\\n insertDocuments(params),\\n findDocuments(params)\\n)(state)\\n```\\n\\n* * *\\n\\n## findDocuments\\n\\nfindDocuments(params) ⇒ State\\nFind documents in a mongoDb collection\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Configuration for mongo |\\n\\n**Example** \\n```js\\nfindDocuments({\\n database: 'str',\\n collection: 'cases',\\n query: {a:3}\\n });\\n```\\n\\n* * *\\n\\n## insertDocuments\\n\\ninsertDocuments(params) ⇒ State\\nInserts documents into a mongoDb collection\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Configuration for mongo |\\n\\n**Example** \\n```js\\ninsertDocuments({\\n database: 'str',\\n collection: 'kids',\\n documents: [1,2,3]\\n });\\n```\\n\\n* * *\\n\\n## updateDocument\\n\\nupdateDocument(params) ⇒ State\\nUpdates document (optionally upserting) into a mongoDb collection\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Configuration for mongo |\\n\\n**Example** \\n```js\\nupdateDocuments({\\n database: 'str',\\n collection: 'animals',\\n filter: { type: 'fuzzy' },\\n changes: { kind: 'soft' },\\n options: { upsert: true }\\n });\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language MongoDB\\n\\nLanguage Pack for building expressions and operations for use with MongoDB.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/mongodb-configuration-schema/)\\ndefinition.\\n\\n### insertDocuments\\n\\n```js\\ninsertDocuments({\\n database: 'yourDb',\\n collection: 'yourCollection',\\n documents: state => {\\n return state.data.map(item => {\\n return { name: item.name, age: item.age };\\n });\\n },\\n // callback: (state) => state, // optional\\n});\\n```\\n\\n### findDocuments\\n\\n```js\\nfindDocuments({\\n database: 'yourDb',\\n collection: 'yourCollection',\\n query: state => {\\n return { name: 'stu' };\\n },\\n // callback: (state) => state, // optional\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-mongodb\\n\\n## 2.0.0\\n\\n### Major Changes\\n\\n- Update configuration schema for MongoDB adaptor:\\n - Rename `clusterUrl` to `clusterHostname`\\n - Change `clusterHostname` format from `uri` to `hostname`\\n - Update `Adaptor.js` and tests to use new name\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.0.6\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.0.5\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"clusterHostname":{"title":"Cluster Hostname","type":"string","description":"Your MongoDB cluster hostname","format":"hostname","minLength":1,"examples":["yourCluster-xxxyzzz.mongodb.net"]},"username":{"title":"Username","type":"string","description":"Your MongoDB instance username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Your MongoDB instance password","writeOnly":true,"minLength":1,"examples":["@secret(!)Pass"]}},"type":"object","additionalProperties":true,"required":["clusterHostname","username","password"]}}, -{"name":"msgraph","adaptor":"@openfn/language-msgraph","version":"0.4.0","docs":"\"## Functions\\n\\n
\\n
\\n create(resource, data, callback)
\\n
\\n get(path, query, callback)
\\n
\\n getDrive(specifier, name, [callback])
\\n
\\n getFile(pathOrId, options, [callback])
\\n
\\n getFolder(pathOrId, options, [callback])
\\n
\\n sheetToBuffer(rows, options)
\\n
\\n uploadFile(resource, data, callback)
\\n
\\n\\n\\n## create\\n\\ncreate(resource, data, callback) ⇒ Operation\\nCreate some resource in msgraph\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resource | string | The type of entity that will be created |\\n| data | object | The data to create the new resource |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ncreate(\\\"applications\\\", {\\\"displayName\\\": \\\"My App\\\"})\\n```\\n\\n* * *\\n\\n## get\\n\\nget(path, query, callback) ⇒ Operation\\nMake a GET request to msgraph resource\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| query | object | Query, Headers and Authentication parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nget('sites/root/lists')\\n```\\n\\n* * *\\n\\n## getDrive\\n\\ngetDrive(specifier, name, [callback]) ⇒ Operation\\nGet a Drive or SharePoint document library. The drive metadata will be written\\nto state.drives, where it can be used by other adaptor functions.\\nPass { id } to get a drive by id or { id, owner } to get default drive for\\nsome parent resource, like a group\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| specifier | Object | | A definition of the drive to retrieve - id {string} - The ID of the resource or owner. - owner {string} - The type of drive owner (e.g. sites, groups). |\\n| name | string | | The local name of the drive used to write to state.drives, ie, state.drives[name] |\\n| [callback] | function | s => s | (Optional) Callback function |\\n\\n**Example** *(Get a drive by ID)* \\n```js\\ngetDrive({ id: \\\"YXzpkoLwR06bxC8tNdg71m\\\" })\\n```\\n**Example** *(Get the default drive for a site)* \\n```js\\ngetDrive({ id: \\\"openfn.sharepoint.com\\\", owner: \\\"sites\\\" })\\n```\\n\\n* * *\\n\\n## getFile\\n\\ngetFile(pathOrId, options, [callback]) ⇒ Operation\\nGet file metadata or file content.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| pathOrId | string | | A path to a file or file id |\\n| options | object | | (Optional) Query parameters |\\n| [callback] | function | s => s | (Optional) Callback function |\\n\\n**Example** *(Get a file by ID)* \\n```js\\ngetFile('01LUM6XOGRONYNTZ26DBBJPTN5IFTQPBIW')\\n```\\n**Example** *(Get a file for a named drive by id)* \\n```js\\ngetFile(\\\"01LUM6XOGRONYNTZ26DBBJPTN5IFTQPBIW\\\",{ driveName: \\\"mydrive\\\"})\\n```\\n\\n* * *\\n\\n## getFolder\\n\\ngetFolder(pathOrId, options, [callback]) ⇒ Operation\\nGet the contents or metadata of a folder.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| pathOrId | string | | A path to a folder or folder id |\\n| options | object | | (Optional) Query parameters |\\n| [callback] | function | s => s | (Optional) Callback function |\\n\\n**Example** *(Get a folder by ID)* \\n```js\\ngetFolder('01LUM6XOCKDTZKQC7AVZF2VMHE2I3O6OY3')\\n```\\n**Example** *(Get a folder for a named drive by id)* \\n```js\\ngetFolder(\\\"01LUM6XOCKDTZKQC7AVZF2VMHE2I3O6OY3\\\",{ driveName: \\\"mydrive\\\"})\\n```\\n\\n* * *\\n\\n## request\\n\\nrequest ⇒\\nThis is an asynchronous function that sends a request to a specified URL with optional parameters\\nand headers, and returns the response data in JSON format.\\n\\n**Kind**: global constant \\n**Returns**: The `request` function is returning the parsed JSON data from the response of the HTTP\\nrequest made to the specified `url` with the given `params` and `method`. If there is an error in\\nthe response, the function will throw an error. \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| url | string | The URL of the API endpoint that the request is being made to. |\\n| [options] | object | An object containing any additional parameters to be sent with the request, such as query parameters or request body data. It is an optional parameter and defaults to an empty object if not provided. |\\n\\n\\n* * *\\n\\n## sheetToBuffer\\n\\nsheetToBuffer(rows, options) ⇒\\nThe function `sheetToBuffer` takes in rows, options and optional callback, It creates a workbook\\nand worksheet using the rows, appends the worksheet to the workbook, and returns the workbook as a\\nbuffer.\\n\\n**Kind**: global function \\n**Returns**: a buffer containing the Excel file in `state.buffer`. \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| rows | | The `rows` parameter is an array of objects representing the data to be written to the Excel sheet. Each object in the array represents a row in the sheet, and the keys of the object represent the column headers. The values of the object represent the data in each cell of the row. |\\n| options | | The `options` parameter is an object that contains additional configuration options |\\n| [options.wsName] | String | Worksheet name i.e 32 Characters |\\n| [options.bookType] | String | File format of the exported file, Default is 'xlsx'. See [here](https://docs.sheetjs.com/docs/api/write-options/#supported-output-formats) for the function. It can have the following properties: |\\n\\n**Example** *(Create a buffer containing excel file with `xlsx` output format )* \\n```js\\nsheetToBuffer('$.data[*]', {\\n wsName: 'Invalid Grant Codes',\\n bookType: 'xlsx',\\n});\\n```\\n\\n* * *\\n\\n## uploadFile\\n\\nuploadFile(resource, data, callback) ⇒ Operation\\nUpload a file to a drive\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resource | Object | Resource Object |\\n| [resource.driveId] | String | Drive Id |\\n| [resource.driveId] | String | Site Id |\\n| [resource.folderId] | String | Parent folder id |\\n| [resource.contentType] | String | Resource content-type |\\n| [resource.onConflict] | String | Specify conflict behavior if file with the same name exists. Can be \\\"rename | fail | replace\\\" |\\n| data | Object | A buffer containing the file. |\\n| callback | function | Optional callback function |\\n\\n**Example** *(Upload Excel file to a drive using `driveId` and `parantItemId`)* \\n```js\\nuploadFile(\\n state => ({\\n driveId: state.driveId,\\n folderId: state.folderId,\\n fileName: `Tracker.xlsx`,\\n }),\\n state => state.buffer\\n);\\n```\\n**Example** *(Upload Excel file to a SharePoint drive using `siteId` and `parantItemId`)* \\n```js\\nuploadFile(\\n state => ({\\n siteId: state.siteId,\\n folderId: state.folderId,\\n fileName: `Report.xlsx`,\\n }),\\n state => state.buffer\\n);\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-msgraph \\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the\\n[Microsoft Graph API](https://learn.microsoft.com/en-us/graph/use-the-api).\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/msgraph-docs) for\\nfull technical documentation.\\n\\n### Configuration\\n\\nView the\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/msgraph-configuration-schema/)\\nfor required and optional `configuration` properties.\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n\\\"Getting Started\\\" guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build _only_ the docs run `pnpm build docs`.\\n\"","changelog":"\"# @openfn/language-msgraph\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 4cd6587: Add `uploadFile` and `sheetToBuffer` function\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 0.3.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- 1c183e9: Fix getFile unit tests\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- b90e8a2: Add support for stream\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- 9cc4952: fix url in request util\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- f45f477: Clean-up state before throwing an error\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 9366e53: - Switch from `nodejs` default `fetch` to `undici` `fetch`\\n - Added the following `sharepoint` functions\\n - `getDrive()`\\n - `getFolder()`\\n - `getFile()`\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- d33c0ee: export parseCsv from common\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 0.1.1\\n\\n### Patch Changes\\n\\n- aad9549: Ensure that standard OAuth2 credentials with snake-cased\\n \\\"access_token\\\" keys can be used for OAuth2-reliant adaptors\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 0.1.0\\n\\n### Minor Changes\\n\\n- 93d82a8: Add msgraph adaptor with get() and create() functions\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\"","functions":["create","get","getDrive","getFile","getFolder","uploadFile"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","$comment":"OAuth2","properties":{"apiVersion":{"title":"API Version","anyOf":[{"type":"string"},{"type":"null"}],"placeholder":"v1.0","description":"Microsoft Graph api version","minLength":1,"examples":["v1.0","beta"]},"access_token":{"title":"Access Token","type":"string","description":"Your Microsoft Graph access token","writeOnly":true,"minLength":1,"examples":["eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRl"]}},"type":"object","additionalProperties":true,"required":["access_token"]}}, -{"name":"mssql","adaptor":"@openfn/language-mssql","version":"4.1.8","docs":"\"## Functions\\n\\n
\\n
\\n addRowsToRefs(state, rows)
\\n
\\n cleanupState(state)
\\n
\\n createConnection(state)
\\n
\\n describeTable(tableName, options)
\\n
\\n findValue(filter)
\\n
\\n flattenRows(state, rows)
\\n
\\n insert(table, record, options)
\\n
\\n insertMany(table, records, options)
\\n
\\n insertTable(tableName, columns, options)
\\n
\\n modifyTable(tableName, columns, options)
\\n
\\n sql(params)
\\n
\\n upsert(table, uuid, record, options)
\\n
\\n upsertIf(logical, table, uuid, record, options)
\\n
\\n upsertMany(table, uuid, records, options)
\\n
\\n\\n\\n## addRowsToRefs\\n\\naddRowsToRefs(state, rows) ⇒ State\\nSets the returned rows from a query as the first item in the state.references\\narray, leaving state.data unchanged between operations.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | |\\n| rows | array | the array of rows returned from the sql query |\\n\\n\\n* * *\\n\\n## cleanupState\\n\\ncleanupState(state) ⇒ State\\nRemoves unserializable keys from the state.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n\\n**Example** \\n```js\\ncleanupState(state)\\n```\\n\\n* * *\\n\\n## createConnection\\n\\ncreateConnection(state) ⇒ State\\nCreates a connection.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | Runtime state. |\\n\\n**Example** \\n```js\\ncreateConnection(state)\\n```\\n\\n* * *\\n\\n## describeTable\\n\\ndescribeTable(tableName, options) ⇒ Operation\\nList the columns of a table in a database.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| tableName | string | The name of the table to describe |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\ndescribeTable('clinic_visits')\\n```\\n\\n* * *\\n\\n## findValue\\n\\nfindValue(filter) ⇒ Operation\\nFetch a uuid key given a condition\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| filter | object | A filter object with the lookup table, a uuid and the condition |\\n\\n**Example** \\n```js\\nfindValue({\\n uuid: 'id',\\n relation: 'users',\\n where: { first_name: 'Mama%', last_name: 'Cisse'},\\n operator: { first_name: 'like', last_name: '='}\\n })\\n```\\n\\n* * *\\n\\n## flattenRows\\n\\nflattenRows(state, rows) ⇒ State\\nReturns a flatten object of the rows (array of arrays) with rowCount.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | |\\n| rows | array | the array of rows returned from the sql query |\\n\\n\\n* * *\\n\\n## insert\\n\\ninsert(table, record, options) ⇒ Operation\\nInsert a record\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| record | object | Payload data for the record as a JS object |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\ninsert(table, record, {setNull: [\\\"'undefined'\\\", \\\"''\\\"], logValues: false})\\n```\\n\\n* * *\\n\\n## insertMany\\n\\ninsertMany(table, records, options) ⇒ Operation\\nInsert many records, using the keys of the first as the column template\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| records | function | A function that takes state and returns an array of records |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\ninsertMany(table, records, { setNull: false, writeSql: true, logValues: false })\\n```\\n\\n* * *\\n\\n## insertTable\\n\\ninsertTable(tableName, columns, options) ⇒ Operation\\nCreate a table in database when given an array of columns and a table_name.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| tableName | string | The name of the table to create |\\n| columns | array | An array of form columns |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\ninsertTable('table_name', state => state.data.map(\\n column => ({\\n name: column.name,\\n type: column.type,\\n required: true, // optional\\n unique: false, // optional - to be set to true for unique constraint\\n })\\n));\\n```\\n\\n* * *\\n\\n## modifyTable\\n\\nmodifyTable(tableName, columns, options) ⇒ Operation\\nAlter an existing table in the database.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| tableName | string | The name of the table to alter |\\n| columns | array | An array of form columns |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\nmodifyTable('table_name', state => state.data.map(\\n newColumn => ({\\n name: newColumn.name,\\n type: newColumn.type,\\n required: true, // optional\\n unique: false, // optional - to be set to true for unique constraint\\n })\\n));\\n```\\n\\n* * *\\n\\n## sql\\n\\nsql(params) ⇒ Operation\\nExecute an SQL statement\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Payload data for the message |\\n\\n**Example** \\n```js\\nsql({ query, options })\\n```\\n\\n* * *\\n\\n## upsert\\n\\nupsert(table, uuid, record, options) ⇒ Operation\\nInsert or update a record using SQL MERGE\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| uuid | string | The uuid column to determine a matching/existing record |\\n| record | object | Payload data for the record as a JS object |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\nupsert(table, uuid, record, { setNull: \\\"'undefined'\\\", logValues: false})\\nupsert(table, [uuid1, uuid2], record, { setNull: \\\"'undefined'\\\", logValues: false})\\n```\\n\\n* * *\\n\\n## upsertIf\\n\\nupsertIf(logical, table, uuid, record, options) ⇒ Operation\\nInsert or update a record based on a logical condition using ON CONFLICT UPDATE\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| logical | string | a data to check existing value for. |\\n| table | string | The target table |\\n| uuid | string | The uuid column to determine a matching/existing record |\\n| record | object | Payload data for the record as a JS object or function |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\nupsertIf(\\n dataValue('name'),\\n 'users', // the DB table\\n 'uuid', // a DB column with a unique constraint\\n { name: 'Elodie', id: 7 },\\n { writeSql:true, execute: true, logValues: false }\\n)\\n```\\n\\n* * *\\n\\n## upsertMany\\n\\nupsertMany(table, uuid, records, options) ⇒ Operation\\nInsert or update multiple records using ON CONFLICT UPDATE and excluded\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| uuid | string | The uuid column to determine a matching/existing record |\\n| records | function | A function that takes state and returns an array of records |\\n| options | object | Optional options argument |\\n\\n**Example** \\n```js\\nupsertMany(\\n 'users', 'email', records, { logValues: false }\\n)\\nupsertMany(\\n 'users', ['email', 'phone'], records, { logValues: false }\\n)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language MSSQL\\n\\nLanguage Pack for connecting to Azure SQL Server via OpenFn.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/mssql-configuration-schema/)\\ndefinition.\\n\\n### Sample expression\\n\\n## sql query\\n\\n```js\\nsql({\\n query: `\\n SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES\\n WHERE TABLE_TYPE = 'BASE TABLE'\\n AND TABLE_CATALOG='my-demo'\\n `,\\n});\\n\\nsql({\\n query: `SELECT * FROM Household`,\\n options: {\\n writeSql: true, // Keep to true to log query (otherwise make it false).\\n execute: true, // keep to false to not alter DB\\n },\\n});\\n```\\n\\n## Find a single value for a table\\n\\nThis helper function allows to build a specific query where `sql` would not be\\nbest suited. It returns a single value and not a promise. An example of usage\\nwould be in building a mapping object with a value from a lookup table.\\n\\n```js\\nfn(async state => {\\n const user = {\\n id: 1,\\n name: 'Mamadou',\\n user_id: await findValue({\\n uuid: 'id',\\n relation: 'users',\\n where: { first_name: 'Mama%' },\\n operator: { first_name: 'like' }, // operator is optional. \\\"=\\\" is used by default.\\n })(state),\\n };\\n\\n return upsert(...)(state);\\n});\\n```\\n\\n## Insert one single record\\n\\n```js\\ninsert(\\n 'SomeDB.dbo.SupplierTest',\\n {\\n SupplierNumber: 1,\\n Name: dataValue('name'),\\n Address: 'Nunya Bihz-Nash',\\n },\\n {\\n // The optional `options` argument allows for global string replacement with\\n // NULL. This is useful if you want to map an undefined value (e.g., x.name)\\n // to NULL. It can be a single string or an array of strings.\\n // It DEFAULTS to \\\"'undefined'\\\", and can be turned off w/ `false`.\\n setNull: \\\"'undefined'\\\",\\n logValues: true,\\n }\\n);\\n```\\n\\n## Insert or Update using a unique column as a key\\n\\nThis function insert or update depending on the existence of a record in the\\ndatabase.\\n\\n```js\\nupsert(\\n 'SomeDB.dbo.Supplier',\\n 'SupplierNumber',\\n {\\n SupplierNumber: 1,\\n Name: dataValue('name'),\\n Address: 'Now I can tell!',\\n },\\n // Do NOT replace any instances of 'undefined' in the final SQL statement.\\n { setNull: false, logValues: true }\\n);\\n```\\n\\n## Insert or Update if a value exist in the record\\n\\nThis function will upsert a record only if the logical given is true. In this\\ncase we check if `dataValue('name')` exists.\\n\\n```js\\nupsertIf(\\n dataValue('name'),\\n 'users',\\n 'user_id',\\n {\\n name: 'Elodie',\\n id: 7,\\n },\\n // Replace any occurence of '' and 'undefined' to NULL\\n {\\n setNull: [\\\"''\\\", \\\"'undefined'\\\"],\\n writeSql: true,\\n execute: false,\\n logValues: true,\\n }\\n);\\n```\\n\\n## Insert Many records\\n\\nThis function allows the insert of a set of records inside a table all at once.\\nPass `logQuery` option to `true` to display the query.\\n\\n```js\\n// Note that insertMany takes a function which returns an array—this helps\\n// enforce that each item in the array has the same keys.\\ninsertMany(\\n 'SomeDB.dbo.Supplier',\\n state =>\\n state.data.supplierArray.map(s => {\\n return {\\n SupplierNumber: s.id,\\n Name: s.name,\\n Address: s.address,\\n };\\n }),\\n { writeSql: true, logValues: true }\\n);\\n```\\n\\n## Insert or Update Many records\\n\\nThis function inserts or updates many records all at once depending on their\\nexistence in the database.\\n\\n```js\\n// Note that insertMany takes a function which returns an array—this helps\\n// enforce that each item in the array has the same keys.\\nupsertMany(\\n 'SomeDB.dbo.Supplier',\\n 'SupplierNumber',\\n state =>\\n state.data.supplierArray.map(s => {\\n return {\\n SupplierNumber: s.id,\\n Name: s.name,\\n Address: s.address,\\n };\\n }),\\n { writeSql: true, execute: false, logValues: true }\\n);\\n```\\n\\nIn case we need to check on multiple columns before upserting, we can have an\\narray of `uuids`.\\n\\n```js\\nupsertMany(\\n 'SomeDB.dbo.Supplier',\\n ['SupplierNumber', 'SupplierCode'],\\n state =>\\n state.data.supplierArray.map(s => {\\n return {\\n SupplierNumber: s.id,\\n Name: s.name,\\n Address: s.address,\\n SupplierCode: s.code,\\n };\\n }),\\n { writeSql: true, execute: false, logValues: true }\\n);\\n```\\n\\n## Describe a table from mssql\\n\\nThis function is used to fetch the list of columns of a given table in the\\ndatabase.\\n\\n```js\\ndescribeTable('users', { writeSql: false, execute: true });\\n```\\n\\n## Create a table in the database\\n\\nThis function allows to create a table in a database from a given array of\\ncolumns. The key `identity` can be use for a column to auto-generate a value.\\n\\n```js\\ninsertTable('users', state =>\\n state.data.map(column => ({\\n name: column.name,\\n type: column.type,\\n required: true, // optional\\n unique: false, // optional - set to true for unique constraint\\n }))\\n);\\n```\\n\\n## Alter a table in the database\\n\\nThis function allows to add new columns to a table. Beware of the fact that you\\ncannot add new columns with names that already exist in the table.\\n\\n```js\\nmodifyTable(\\n 'users',\\n state =>\\n state.data.map(newColumn => ({\\n name: newColumn.name,\\n type: newColumn.type,\\n required: true, // optional\\n unique: false, // optional - set to true for unique constraint\\n })),\\n { writeSql: false, execute: true }\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-mssql\\n\\n## 4.1.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 4.1.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 4.1.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 4.1.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 4.1.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 4.1.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 4.1.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 4.1.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 4.1.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 4.0.8\\n\\n### Patch Changes\\n\\n- 57742d1: remove request dependency\\n\\n## 4.0.7\\n\\n### Patch Changes\\n\\n- 04ed74f: update dependencies\\n\\n## 4.0.6\\n\\n### Patch Changes\\n\\n- 43c3669: patch versions\\n\\n## 4.0.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 4.0.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 4.0.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 4.0.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 4.0.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 4.0.0\\n\\n### Major Changes\\n\\n- 3878624: Modify composeNextState function, to flattern all rows into an array\\n of rows with their corresponding column names\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 3.1.1\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 3.1.0\\n\\n### Minor Changes\\n\\n- c9b7ed7: Add language-mssql in monorepo\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\"","functions":["describeTable","findValue","insert","insertMany","insertTable","modifyTable","sql","upsert","upsertIf","upsertMany"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"server":{"title":"Server URL","type":"string","description":"The database instance server URL or IP address","format":"uri","minLength":1,"examples":["something.database.windows.net"]},"database":{"title":"Database","type":"string","description":"The database name","minLength":1,"examples":["demo-db"]},"userName":{"title":"Username","type":"string","description":"Username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"minLength":1,"examples":["@super(!)Password"]}},"type":"object","additionalProperties":true,"required":["server","database"]}}, -{"name":"mysql","adaptor":"@openfn/language-mysql","version":"1.4.8","docs":"\"## Functions\\n\\n
\\n
\\n insert(table, fields)
\\n
\\n query(options)
\\n
\\n sqlString(queryString)
\\n
\\n upsert(table, fields)
\\n
\\n upsertMany(table, data)
\\n
\\n\\n\\n## insert\\n\\ninsert(table, fields) ⇒ Operation\\nInsert a record\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| fields | object | A fields object |\\n\\n**Example** \\n```js\\nexecute(\\n insert('table', fields(\\n field('name', dataValue('name'))\\n ))\\n)(state)\\n```\\n\\n* * *\\n\\n## query\\n\\nquery(options) ⇒ Operation\\nExecute a SQL statement\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| options | object | Payload data for the message |\\n\\n**Example** \\n```js\\nexecute(\\n query({ sql: 'select * from users;' })\\n)(state)\\n```\\n\\n* * *\\n\\n## sqlString\\n\\nsqlString(queryString) ⇒ Operation\\nExecute a SQL statement\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| queryString | String | A query string (or function which takes state and returns a string) |\\n\\n**Example** \\n```js\\nexecute(\\n sqlString(state => \\\"select * from items;\\\")\\n)(state)\\n```\\n\\n* * *\\n\\n## upsert\\n\\nupsert(table, fields) ⇒ Operation\\nInsert or Update a record if matched\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| fields | object | A fields object |\\n\\n**Example** \\n```js\\nexecute(\\n upsert('table', fields(\\n field('name', dataValue('name'))\\n ))\\n)(state)\\n```\\n\\n* * *\\n\\n## upsertMany\\n\\nupsertMany(table, data) ⇒ Operation\\nInsert or update multiple records using ON DUPLICATE KEY\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| data | array | An array of objects or a function that returns an array |\\n\\n**Example** \\n```js\\nupsertMany(\\n 'users', // the DB table\\n [\\n { name: 'one', email: 'one@openfn.org' },\\n { name: 'two', email: 'two@openfn.org' },\\n ]\\n)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language MySQL\\n\\nLanguage Pack for building expressions and operations to run MySQL queries.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/mysql-docs) for\\nfull technical documentation.\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/mysql-configuration-schema/)\\ndefinition.\\n\\n## Execute a query\\n\\nExecute an sql query with the node mysql package.\\n\\n```js\\nquery({\\n sql: state => {\\n return `select * from ${state.data.table} where id = ?;`;\\n },\\n timeout: 4000,\\n values: ['007'],\\n});\\n```\\n\\n## Execute a sql query\\n\\nThis function takes either a `string` or a `function` that takes states and\\nreturns a string.\\n\\n```js\\nsqlString(state => {\\n return (\\n `INSERT INTO untitled_table (name, the_geom) VALUES ('` +\\n state.data.version +\\n `', ` +\\n dataValue('form.Choix_tache')(state) +\\n `)`\\n );\\n});\\n```\\n\\n## Insert a single record\\n\\nThis function is used to insert a single record in a MySQL database.\\n\\n```js\\ninsert(\\n 'some_table',\\n fields(\\n field('firstname', dataValue('form.patient_firstname')),\\n field('lastname', dataValue('form.patient_lastname'))\\n )\\n);\\n```\\n\\n## Insert or update a single record\\n\\nThis function is used to insert a single record in a MySQL database or update it\\nif there is a match.\\n\\n```js\\nupsert(\\n 'some_table',\\n fields(\\n field('firstname', dataValue('form.patient_firstname')),\\n field('lastname', dataValue('form.patient_lastname'))\\n )\\n);\\n```\\n\\n## Upsert many records\\n\\nThis function allows the upsert of a set of records inside a table all at once.\\n\\n```js\\nupsertMany(\\n 'users', // the DB table\\n [\\n { name: 'one', email: 'one@openfn.org' },\\n { name: 'two', email: 'two@openfn.org' },\\n ]\\n);\\n```\\n\\nor\\n\\n```js\\nupsertMany('users', state =>\\n state.data.users.map(user => {\\n name: user['name'],\\n email: user['email']\\n })\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-mysql\\n\\n## 1.4.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 1.4.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 1.4.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 1.4.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 1.4.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 1.4.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 1.4.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 1.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.3.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 1.3.4\\n\\n### Patch Changes\\n\\n- ef828e7: update old urls in readme\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.3.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.3.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.3.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.3.0\\n\\n### Minor Changes\\n\\n- 9d674c5: Migrate MySQL\\n\"","functions":["upsertMany"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"host":{"title":"Host URL","type":"string","description":"The database instance host URL","format":"uri","minLength":1,"examples":["some-host-url.compute-1.amazonaws.com"]},"port":{"title":"Port","type":"integer","default":3306,"description":"Database instance port","minLength":1,"examples":[3306]},"database":{"title":"Database","type":"string","description":"The database name","minLength":1,"examples":["demo-db"]},"user":{"title":"Username","type":"string","description":"The username to log in the database","minLength":1,"examples":["admin-demo"]},"password":{"title":"Password","type":"string","description":"The password to log in the database","writeOnly":true,"minLength":1,"examples":["@super(!)Secretpass"]}},"type":"object","additionalProperties":true,"required":["host","database"]}}, -{"name":"nexmo","adaptor":"@openfn/language-nexmo","version":"0.4.3","docs":"\"## sendSMS\\n\\nsendSMS(from, toNumber, message) ⇒ Operation\\nSends an SMS message to a specific phone number\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| from | String | Name or number the message should be sent from. |\\n| toNumber | String | Destination phone number. |\\n| message | String | Text message |\\n\\n**Example** \\n```js\\nsendSMS(\\\"OpenFn\\\", \\\"phoneNumber\\\", \\\"Hello World!\\\")\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Nexmo\\n\\nLanguage Pack for building expressions and operations to interact with the Nexmo\\nAPI.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/nexmo-configuration-schema/)\\ndefinition.\\n\\n### sendSMS\\n\\n#### sample expression\\n\\n```js\\nsendSMS('OpenFn', '0123456789', 'HelloWorld!');\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-nexmo\\n\\n## 0.4.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 0.4.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 8591b67: - update nexmo to `v2.9.1``\\n - expandReferences on sendSMS\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.2.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.2.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- f0f2495: migrate nexmo\\n\"","functions":["sendSMS"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"apiKey":{"title":"API Key","type":"string","description":"Your Nexmo API Key","minLength":1,"examples":["mYaP1K3y"]},"apiSecret":{"title":"API Secret","type":"string","description":"Your Nexmo API Secret key","writeOnly":true,"minLength":1,"examples":["supersecret"]}},"type":"object","additionalProperties":true,"required":["apiKey","apiSecret"]}}, -{"name":"ocl","adaptor":"@openfn/language-ocl","version":"1.1.7","docs":"\"## Functions\\n\\n
\\n
\\n get(path, query, callback)
\\n
\\n getMappings(ownerId, repositoryId, [options], callback)
\\n
\\n\\n\\n## get\\n\\nget(path, query, callback) ⇒ Operation\\nGet a resource in OCL\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| query | object | A query object that will limit what resources are retrieved when converted into request params. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nget(\\n \\\"orgs/MSFOCG/collections/lime-demo/HEAD/mappings\\\",\\n {\\n page: 1,\\n exact_match: \\\"off\\\",\\n limit: 200,\\n verbose: false,\\n sortDesc: \\\"_score\\\",\\n },\\n (state) => {\\n // Add state oclMappings\\n const oclMappings = state.data;\\n return { ...state, data: {}, references: [], response: {}, oclMappings };\\n }\\n);\\n```\\n\\n* * *\\n\\n## getMappings\\n\\ngetMappings(ownerId, repositoryId, [options], callback) ⇒ Operation\\nGet a source repository in OCL\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| ownerId | string | An OCL user or organization |\\n| repositoryId | string | An OCL collection id or source id |\\n| [options] | Object | Optional. `options` which can be passed to See more [on OCL swagger docs](https://api.openconceptlab.org/swagger/) |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ngetMappings(\\n \\\"MSFOCG\\\",\\n \\\"lime-demo\\\",\\n { page: 1, exact_match: \\\"off\\\", verbose: false },\\n (state) => {\\n // Add state oclMappings\\n const oclMappings = state.data;\\n return { ...state, data: {}, references: [], response: {}, oclMappings };\\n }\\n);\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language OCL\\n\\nLanguage Pack for building expressions and operations for working with the\\n[OCL API](http://ocl.github.io/ocl-docs/master/en/developer/html/ocl_developer_manual.html).\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/ocl-configuration-schema/)\\ndefinition.\\n\\n## Mapping source concepts to destination API\\n\\n#### Recieve form data from source application and convert data element keys to destination application.\\n\\n```js\\nmap( \\\"data\\\": {\\n \\\"a\\\": 1,\\n \\\"b\\\": 2},\\n {users:\\\"haftamuk\\\", sources: \\\"eCHIS-CODES\\\", concepts: \\\"fp_new_at_10_to_14\\\" }\\n );\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-ocl\\n\\n## 1.1.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 1.1.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 1.1.5\\n\\n### Patch Changes\\n\\n- 67a09fb: Add `fn` in OCL adaptor\\n\\n## 1.1.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 1.1.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 1.1.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- 3f3c0c5: update tests\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- 29e335d: remove body in get request\\n\\n## 1.0.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 1.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 63232eb: Add `get()` and `getMappings()` function\\n\\n## 0.2.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 0.2.5\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.2.4\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.2.3\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.2.2\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- 5a06d7f: Migrate OCL, update package export\\n\\n### Patch Changes\\n\\n- cb5d0ed: Updated to @openfn/simple-ast v0.4.1\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\"","functions":["get","getMappings"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"hostUrl":{"title":"Host URL","type":"string","description":"The OCL API URL","default":"https://api.openconceptlab.org/","format":"uri","minLength":1,"examples":["https://api.openconceptlab.org/"]},"username":{"title":"Username","type":"string","description":"The username to log in to OCL","minLength":1,"examples":["usernmame"]},"password":{"title":"Password","type":"string","description":"The password to log in to OCL","writeOnly":true,"minLength":1,"examples":["supersecretpassword"]}},"type":"object","additionalProperties":true,"required":["hostUrl","username","password"]}}, -{"name":"openfn","adaptor":"@openfn/language-openfn","version":"1.3.8","docs":"\"## request\\n\\nrequest(options, callback) ⇒ Operation\\nMake a POST request\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| options | object | Body, Query, Headers and Authentication parameters |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** \\n```js\\nrequest({method: 'get', path: '/jobs/});\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language OpenFn\\n\\nAdaptor for building expressions and operations to interact with the OpenFn v1\\nAPI.\\n\\n## Documentation\\n\\n## request\\n\\n```js\\nrequest({\\n method: 'get',\\n path: 'jobs',\\n params: {\\n project_id: 490,\\n },\\n});\\nrequest(\\n {\\n method: 'post',\\n path: 'jobs',\\n data: {\\n trigger_id: 1,\\n expression: 'steps()',\\n },\\n },\\n state => {\\n console.log('cool callback!');\\n return state;\\n }\\n);\\n```\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/openfn-configuration-schema/)\\ndefinition.\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-openfn\\n\\n## 1.3.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 1.3.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 1.3.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 1.3.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 1.3.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 1.3.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 1.3.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 1.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.2.6\\n\\n### Patch Changes\\n\\n- 779596f: Use native fetch (undici) in template and add icons in openfn\\n\\n## 1.2.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 1.2.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.2.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.2.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.2.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- be9d3c6: Migrate OpenFn\\n\"","functions":["request"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"host":{"title":"Host","type":"string","description":"The OpenFn host url","format":"uri","default":"https://www.openfn.org","minLength":1,"examples":["https://www.openfn.org"]},"projectId":{"title":"Project ID","type":"string","description":"Your OpenFn project ID","minLength":1,"examples":["some-id"]},"username":{"title":"Username","type":"string","description":"The username to log in to OpenFn","minLength":1,"examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"The password to log in to OpenFn","writeOnly":true,"minLength":1,"examples":["@super(!)Secretpass"]}},"type":"object","additionalProperties":true,"required":["host","username","password"]}}, -{"name":"openhim","adaptor":"@openfn/language-openhim","version":"0.2.1","docs":"\"## encounter\\n\\nencounter(encounterData) ⇒ Operation\\nCreate an encounter\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| encounterData | object | Payload data for the encounter |\\n\\n**Example** \\n```js\\nexecute(\\n encounter(data)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language OpenHIM\\n\\nLanguage Pack for building expressions and operations for working with the\\nopenhim API.\\n\\n## [HL7 FHIR Standard](https://www.hl7.org/fhir/patient-example.json.html)\\n\\n```json\\n{\\n \\\"resourceType\\\": \\\"Patient\\\",\\n \\\"id\\\": \\\"example\\\",\\n \\\"text\\\": {\\n \\\"status\\\": \\\"generated\\\",\\n \\\"div\\\": \\\"
\\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n
NamePeter James \\\\n Chalmers ("Jim")\\\\n
Address534 Erewhon, Pleasantville, Vic, 3999
ContactsHome: unknown. Work: (03) 5555 6473
IdMRN: 12345 (Acme Healthcare)
\\\\n \\\\n
\\\"\\n },\\n \\\"identifier\\\": [\\n {\\n \\\"fhir_comments\\\": [\\\" MRN assigned by ACME healthcare on 6-May 2001 \\\"],\\n \\\"use\\\": \\\"usual\\\",\\n \\\"type\\\": {\\n \\\"coding\\\": [\\n {\\n \\\"system\\\": \\\"http://hl7.org/fhir/v2/0203\\\",\\n \\\"code\\\": \\\"MR\\\"\\n }\\n ]\\n },\\n \\\"system\\\": \\\"urn:oid:1.2.36.146.595.217.0.1\\\",\\n \\\"value\\\": \\\"12345\\\",\\n \\\"period\\\": {\\n \\\"start\\\": \\\"2001-05-06\\\"\\n },\\n \\\"assigner\\\": {\\n \\\"display\\\": \\\"Acme Healthcare\\\"\\n }\\n }\\n ],\\n \\\"active\\\": true,\\n \\\"name\\\": [\\n {\\n \\\"fhir_comments\\\": [\\\" Peter James Chalmers, but called \\\\\\\"Jim\\\\\\\" \\\"],\\n \\\"use\\\": \\\"official\\\",\\n \\\"family\\\": [\\\"Chalmers\\\"],\\n \\\"given\\\": [\\\"Peter\\\", \\\"James\\\"]\\n },\\n {\\n \\\"use\\\": \\\"usual\\\",\\n \\\"given\\\": [\\\"Jim\\\"]\\n }\\n ],\\n \\\"telecom\\\": [\\n {\\n \\\"fhir_comments\\\": [\\\" home communication details aren't known \\\"],\\n \\\"use\\\": \\\"home\\\"\\n },\\n {\\n \\\"system\\\": \\\"phone\\\",\\n \\\"value\\\": \\\"(03) 5555 6473\\\",\\n \\\"use\\\": \\\"work\\\"\\n }\\n ],\\n \\\"gender\\\": \\\"male\\\",\\n \\\"_gender\\\": {\\n \\\"fhir_comments\\\": [\\\" use FHIR code system for male / female \\\"]\\n },\\n \\\"birthDate\\\": \\\"1974-12-25\\\",\\n \\\"_birthDate\\\": {\\n \\\"extension\\\": [\\n {\\n \\\"url\\\": \\\"http://hl7.org/fhir/StructureDefinition/patient-birthTime\\\",\\n \\\"valueDateTime\\\": \\\"1974-12-25T14:35:45-05:00\\\"\\n }\\n ]\\n },\\n \\\"deceasedBoolean\\\": false,\\n \\\"address\\\": [\\n {\\n \\\"use\\\": \\\"home\\\",\\n \\\"type\\\": \\\"both\\\",\\n \\\"line\\\": [\\\"534 Erewhon St\\\"],\\n \\\"city\\\": \\\"PleasantVille\\\",\\n \\\"district\\\": \\\"Rainbow\\\",\\n \\\"state\\\": \\\"Vic\\\",\\n \\\"postalCode\\\": \\\"3999\\\",\\n \\\"period\\\": {\\n \\\"start\\\": \\\"1974-12-25\\\"\\n }\\n }\\n ],\\n \\\"contact\\\": [\\n {\\n \\\"relationship\\\": [\\n {\\n \\\"coding\\\": [\\n {\\n \\\"system\\\": \\\"http://hl7.org/fhir/patient-contact-relationship\\\",\\n \\\"code\\\": \\\"partner\\\"\\n }\\n ]\\n }\\n ],\\n \\\"name\\\": {\\n \\\"family\\\": [\\\"du\\\", \\\"Marché\\\"],\\n \\\"_family\\\": [\\n {\\n \\\"extension\\\": [\\n {\\n \\\"fhir_comments\\\": [\\n \\\" the \\\\\\\"du\\\\\\\" part is a family name prefix (VV in iso 21090) \\\"\\n ],\\n \\\"url\\\": \\\"http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier\\\",\\n \\\"valueCode\\\": \\\"VV\\\"\\n }\\n ]\\n },\\n null\\n ],\\n \\\"given\\\": [\\\"Bénédicte\\\"]\\n },\\n \\\"telecom\\\": [\\n {\\n \\\"system\\\": \\\"phone\\\",\\n \\\"value\\\": \\\"+33 (237) 998327\\\"\\n }\\n ],\\n \\\"gender\\\": \\\"female\\\",\\n \\\"period\\\": {\\n \\\"start\\\": \\\"2012\\\",\\n \\\"_start\\\": {\\n \\\"fhir_comments\\\": [\\\" The contact relationship started in 2012 \\\"]\\n }\\n }\\n }\\n ],\\n \\\"managingOrganization\\\": {\\n \\\"reference\\\": \\\"Organization/1\\\"\\n }\\n}\\n```\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/openhim-configuration-schema/)\\ndefinition.\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-openhim\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.1.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.1.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.1.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.1.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.1.0\\n\\n### Minor Changes\\n\\n- 1fd9b3b: Migrate OpenHIM\\n\\n### Patch Changes\\n\\n- e4ebcb6: Fix Large gzip Denial of Service in superagent\\n- e81561f: Updated ast and package.json\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"apiUrl":{"title":"API URL","type":"string","description":"The OpenHIM API url","format":"uri","minLength":1,"examples":["http://openhim.com/api"]},"username":{"title":"Username","type":"string","description":"The username to log in to OpenHIM","minLength":1,"examples":["admin@openhim.org"]},"password":{"title":"Password","type":"string","description":"The password to log in to OpenHIM","writeOnly":true,"minLength":1,"examples":["@super(!)Secretpass"]}},"type":"object","additionalProperties":true,"required":["apiUrl"]}}, -{"name":"openmrs","adaptor":"@openfn/language-openmrs","version":"2.0.8","docs":"\"## Functions\\n\\n
\\n
\\n create(resourceType, data, [callback])
\\n
\\n createEncounter(data, [callback])
\\n
\\n createPatient(data, [callback])
\\n
\\n get(path, query, [callback])
\\n
\\n getEncounter(uuid, [callback])
\\n
\\n getEncounters(query, [callback])
\\n
\\n getPatient(uuid, [callback])
\\n
\\n post(path, data, [callback])
\\n
\\n searchPatient(query, [callback])
\\n
\\n searchPerson(query, [callback])
\\n
\\n update(resourceType, path, data, [callback])
\\n
\\n upsert(resourceType, query, data, [callback])
\\n
\\n\\n\\n## create\\n\\ncreate(resourceType, data, [callback]) ⇒ Operation\\nCreate a record\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | Type of resource to create. E.g. `person`, `patient`, `encounter`, ... |\\n| data | OpenMRSData | Object which defines data that will be used to create a given instance of resource. To create a single instance of a resource, `data` must be a javascript object, and to create multiple instances of a resources, `data` must be an array of javascript objects. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(Create a person)* \\n```js\\ncreate(\\\"person\\\", {\\n names: [\\n {\\n givenName: \\\"Mohit\\\",\\n familyName: \\\"Kumar\\\",\\n },\\n ],\\n gender: \\\"M\\\",\\n birthdate: \\\"1997-09-02\\\",\\n addresses: [\\n {\\n address1: \\\"30, Vivekananda Layout, Munnekolal,Marathahalli\\\",\\n cityVillage: \\\"Bengaluru\\\",\\n country: \\\"India\\\",\\n postalCode: \\\"560037\\\",\\n },\\n ],\\n});\\n```\\n\\n* * *\\n\\n## createEncounter\\n\\ncreateEncounter(data, [callback]) ⇒ Operation\\nCreates an encounter\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | Data parameters of the encounter |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(Create an encounter)* \\n```js\\ncreateEncounter({\\n encounterDatetime: '2023-05-25T06:08:25.000+0000',\\n patient: '1fdaa696-e759-4a7d-a066-f1ae557c151b',\\n encounterType: 'dd528487-82a5-4082-9c72-ed246bd49591',\\n location: 'ba685651-ed3b-4e63-9b35-78893060758a',\\n encounterProviders: [],\\n visit: {\\n patient: '1fdaa696-e759-4a7d-a066-f1ae557c151b',\\n visitType: '7b0f5697-27e3-40c4-8bae-f4049abfb4ed',\\n startDatetime: '2023-05-25T06:08:25.000+0000',\\n stopDatetime: '2023-05-25T06:09:25.000+0000',\\n },\\n})\\n```\\n\\n* * *\\n\\n## createPatient\\n\\ncreatePatient(data, [callback]) ⇒ Operation\\nCreates a new patient\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | Object parameters of the patient |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\ncreatePatient({\\n identifiers: [\\n {\\n identifier: '4023287',\\n identifierType: '05a29f94-c0ed-11e2-94be-8c13b969e334',\\n preferred: true,\\n },\\n ],\\n person: {\\n gender: 'M',\\n age: 42,\\n birthdate: '1970-01-01T00:00:00.000+0100',\\n birthdateEstimated: false,\\n names: [\\n {\\n givenName: 'Doe',\\n familyName: 'John',\\n },\\n ],\\n },\\n})\\n```\\n\\n* * *\\n\\n## get\\n\\nget(path, query, [callback]) ⇒ Operation\\nMake a get request to any OpenMRS endpoint\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| query | object | parameters for the request |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\nget(\\\"patient\\\", {\\n q: \\\"Patient\\\",\\n limit: 1,\\n});\\n```\\n\\n* * *\\n\\n## getEncounter\\n\\ngetEncounter(uuid, [callback]) ⇒ Operation\\nGets encounter matching a uuid\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| uuid | object | A uuid for the encounter |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\ngetEncounter(\\\"123\\\")\\n```\\n\\n* * *\\n\\n## getEncounters\\n\\ngetEncounters(query, [callback]) ⇒ Operation\\nGets encounters matching params\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | Object for the patient |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\ngetEncounters({patient: \\\"123\\\", fromdate: \\\"2023-05-18\\\"})\\n```\\n\\n* * *\\n\\n## getPatient\\n\\ngetPatient(uuid, [callback]) ⇒ Operation\\nGets patient matching a uuid\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| uuid | string | A uuid for the patient |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\ngetPatient(\\\"123\\\")\\n```\\n**Example** *(Get a patient by uuid)* \\n```js\\ngetPatient('681f8785-c9ca-4dc8-a091-7b869316ff93')\\n```\\n\\n* * *\\n\\n## post\\n\\npost(path, data, [callback]) ⇒ Operation\\nMake a post request to any OpenMRS endpoint\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| path | string | Path to resource |\\n| data | object | Object which defines data that will be used to create a given instance of resource |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\npost(\\n \\\"idgen/identifiersource/8549f706-7e85-4c1d-9424-217d50a2988b/identifier\\\",\\n {}\\n);\\n```\\n\\n* * *\\n\\n## searchPatient\\n\\nsearchPatient(query, [callback]) ⇒ Operation\\nFetch all non-retired patients that match any specified parameters\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | Object with query for the patient |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\nsearchPatient({ q: Sarah })\\n```\\n\\n* * *\\n\\n## searchPerson\\n\\nsearchPerson(query, [callback]) ⇒ Operation\\nFetch all non-retired persons that match any specified parameters\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | object with query for the person |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** \\n```js\\nsearchPerson({ q: Sarah })\\n```\\n\\n* * *\\n\\n## update\\n\\nupdate(resourceType, path, data, [callback]) ⇒ Operation\\nUpdate data. A generic helper function to update a resource object of any type.\\nUpdating an object requires to send `all required fields` or the `full body`\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of resource to be updated. E.g. `person`, `patient`, etc. |\\n| path | string | The `id` or `path` to the `object` to be updated. E.g. `e739808f-f166-42ae-aaf3-8b3e8fa13fda` or `e739808f-f166-42ae-aaf3-8b3e8fa13fda/{collection-name}/{object-id}` |\\n| data | Object | Data to update. It requires to send `all required fields` or the `full body`. If you want `partial updates`, use `patch` operation. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(a person)* \\n```js\\nupdate(\\\"person\\\", '3cad37ad-984d-4c65-a019-3eb120c9c373',{\\\"gender\\\":\\\"M\\\",\\\"birthdate\\\":\\\"1997-01-13\\\"})\\n```\\n\\n* * *\\n\\n## upsert\\n\\nupsert(resourceType, query, data, [callback]) ⇒ Operation\\nUpsert a record. A generic helper function used to atomically either insert a row, or on the basis of the row already existing, UPDATE that existing row instead.\\n\\n**Kind**: global function \\n**Throws**:\\n\\n- RangeError - Throws range error\\n\\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resourceType | string | The type of a resource to `upsert`. E.g. `trackedEntityInstances` |\\n| query | Object | A query object that allows to uniquely identify the resource to update. If no matches found, then the resource will be created. |\\n| data | Object | The data to use for update or create depending on the result of the query. |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(For an existing patient using upsert)* \\n```js\\nupsert('patient', { q: '10007JJ' }, { person: { age: 50 } });\\n```\\n**Example** *(For non existing patient creating a patient record using upsert )* \\n```js\\nupsert(\\n \\\"patient\\\",\\n { q: \\\"1000EHE\\\" },\\n {\\n identifiers: [\\n {\\n identifier: \\\"1000EHE\\\",\\n identifierType: \\\"05a29f94-c0ed-11e2-94be-8c13b969e334\\\",\\n location: \\\"44c3efb0-2583-4c80-a79e-1f756a03c0a1\\\",\\n preferred: true,\\n },\\n ],\\n person: {\\n gender: \\\"M\\\",\\n age: 42,\\n },\\n }\\n);\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language OpenMRS\\n\\nLanguage Pack for building expressions and operations for working with the\\n[OpenMRS API](https://wiki.openmrs.org/display/docs/API).\\n\\n[OpenMRS Data Model Explorer](http://burkeware.com/openmrs-data-model/openmrs-data-model-1.11.html#)\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/openmrs-configuration-schema/)\\ndefinition.\\n\\n### Get a patient by some criteria\\n\\n```js\\n// getPatient({ uuid: '516af9aa-0402-4e11-ad79-e394fdec0c91' });\\n// getPatient({ uuid: dataValue('patientId')(state) });\\ngetPatient({\\n uuid: state => state.data[0].uuid,\\n});\\n```\\n\\n#### Example of searching for patients based on their `EMR Id`\\n\\n```js\\ngetPatients(\\n {\\n identifier: state => state.data.emrId,\\n v: 'full',\\n },\\n {\\n exactlyOne: true,\\n }\\n);\\n```\\n\\n### Create an Encounter\\n\\n```js\\ncreateEncounter({\\n encounterDatetime: dataValue('visit_date'), //dynamically fill with source app data\\n patient: dataValue('uuid'),\\n encounterType: dataValue('visit_type'),\\n location: dataValue('location.uuid'),\\n encounterProviders: [\\n {\\n provider: dataValue('provider_name'),\\n encounterRole: '240b26f9-dd88-4172-823d-4a8bfeb7841f', //hardcoded value\\n },\\n ],\\n});\\n```\\n\\n### Make a request to any OpenMRS endpoint\\n\\n```js\\nreq({ method: 'GET', url: '/ws/rest/v1/concept' }, state => {\\n console.log(JSON.stringify(state, null, 2));\\n return state;\\n});\\n```\\n\\n\\n\\n## Create new patient\\n\\n```js\\npatient(\\n fields(\\n field('gender', 'M'),\\n field('names', function (state) {\\n return [\\n {\\n patient_id: dataValue('form.patientId')(state),\\n creator: dataValue('form.user')(state),\\n },\\n ];\\n })\\n )\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-openmrs\\n\\n## 2.0.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 2.0.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 2.0.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 2.0.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 2.0.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 2.0.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 2.0.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 2.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 2.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- 2390129: - replace throw new Error with console.log\\n - improve Log function\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- d124f67: - Add create, update and upsert function\\n - Add callback support and improve examples for\\n - get()\\n - post()\\n - getPatient()\\n - searchPerson()\\n - getEncounter()\\n - searchPatient()\\n - createPatient()\\n - getEncounters()\\n - createEncounter()\\n\\n## 1.0.1\\n\\n### Patch Changes\\n\\n- 97cc7ce: - Fix checking for empty response\\n - Style logs output\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\n- b6478c0: - Removed `request` in favour of `superagent`\\n - Improve error handling\\n - Moved `login` to execute function\\n - Added\\n - `createPatient`\\n - `searchPatient`\\n - `searchPerson`\\n - `getEncounters`\\n - `getEncounter`\\n - `get`\\n - `post`\\n\\n## 0.10.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 0.10.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.10.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.10.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.10.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.10.0\\n\\n### Minor Changes\\n\\n- 6786949: Migrate OpenMRS\\n\"","functions":["create","update","upsert"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"instanceUrl":{"title":"Instance URL","type":"string","description":"The OpenMRS host url","format":"uri","minLength":1,"examples":["http://openmrs.com/instance/url"]},"username":{"title":"Username","type":"string","description":"The username to log in to OpenMRS","minLength":1,"examples":["admin@openmrs.org"]},"password":{"title":"Password","type":"string","description":"The password to log in to OpenMRS","writeOnly":true,"minLength":1,"examples":["@super(!)Secretpass"]}},"type":"object","additionalProperties":true,"required":["instanceUrl"]}}, -{"name":"openspp","adaptor":"@openfn/language-openspp","version":"1.2.0","docs":"\"## Functions\\n\\n
\\n
\\n addToGroup(group_id, individual_id, role)
\\n
\\n createGroup(data, callback)
\\n
\\n createIndividual(data, callback)
\\n
\\n enroll(spp_id, program_id)
\\n
\\n getArea(spp_id, callback)
\\n
\\n getEnrolledPrograms(spp_id, callback)
\\n
\\n getGroup(spp_id, callback)
\\n
\\n getGroupMembers(spp_id, [options], callback)
\\n
\\n getIndividual(spp_id, callback)
\\n
\\n getProgram(program_id, callback)
\\n
\\n getPrograms([options], callback)
\\n
\\n getServicePoint(spp_id, callback)
\\n
\\n removeFromGroup(group_id, individual_id)
\\n
\\n searchArea(domain, [options], callback)
\\n
\\n searchGroup(domain, [options], callback)
\\n
\\n searchIndividual(domain, [options], callback)
\\n
\\n searchServicePoint(domain, [options], callback)
\\n
\\n unenroll(spp_id, program_id)
\\n
\\n updateGroup(group_id, data)
\\n
\\n updateIndividual(individual_id, data)
\\n
\\n\\n\\n## addToGroup\\n\\naddToGroup(group_id, individual_id, role) ⇒ Operation\\nadd individual to group in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| group_id | string | group registrant id |\\n| individual_id | string | individual registrant id |\\n| role | string | individual role in group |\\n\\n**Example** *(create a new head for group)* \\n```js\\naddToGroup(\\\"GRP_B2BRHJN2\\\", \\\"IND_8DUQL4M4\\\", \\\"Head\\\")\\n```\\n**Example** *(create a new ordinary member for group)* \\n```js\\naddToGroup(\\\"GRP_B2BRHJN2\\\", \\\"IND_8DUQL4M4\\\")\\n```\\n**Example** *(create a new member with new role for group)* \\n```js\\naddToGroup(\\\"GRP_B2BRHJN2\\\", \\\"IND_8DUQL4M4\\\", \\\"new-role-name\\\")\\n```\\n\\n* * *\\n\\n## createGroup\\n\\ncreateGroup(data, callback) ⇒ Operation\\ncreate new group for OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | registrant create data |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ncreateGroup({ name: \\\"Group 1\\\" })\\n```\\n\\n* * *\\n\\n## createIndividual\\n\\ncreateIndividual(data, callback) ⇒ Operation\\ncreate new individual for OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| data | object | registrant create data |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ncreateIndividual({ name: \\\"Individual 1\\\" })\\n```\\n\\n* * *\\n\\n## enroll\\n\\nenroll(spp_id, program_id)\\nenroll registrant to program in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | spp_id of group / individual wanted to enroll |\\n| program_id | string | program_id of program |\\n\\n**Example** \\n```js\\nenroll(\\\"IND_Q4VGGZPF\\\", \\\"PROG_2023_00000001\\\")\\n```\\n\\n* * *\\n\\n## getArea\\n\\ngetArea(spp_id, callback) ⇒ Operation\\nget area by id in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | spp_id of area |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ngetArea(\\\"LOC_7M92NLDH\\\")\\n```\\n\\n* * *\\n\\n## getEnrolledPrograms\\n\\ngetEnrolledPrograms(spp_id, callback) ⇒ Operation\\nget programs list for specific registrant from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | spp_id of group / individual wanted to search |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ngetEnrolledPrograms(\\\"IND_Q4VGGZPF\\\")\\n```\\n\\n* * *\\n\\n## getGroup\\n\\ngetGroup(spp_id, callback) ⇒ Operation\\nget group information from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | The spp_id of the group |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ngetGroup(\\\"GRP_Q4VGGZPF\\\")\\n```\\n\\n* * *\\n\\n## getGroupMembers\\n\\ngetGroupMembers(spp_id, [options], callback) ⇒ Operation\\nget group members information from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| spp_id | string | | The name of the group |\\n| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records |\\n| callback | function | | An optional callback function |\\n\\n**Example** \\n```js\\ngetGroupMembers(\\\"GRP_Q4VGGZPF\\\")\\n```\\n\\n* * *\\n\\n## getIndividual\\n\\ngetIndividual(spp_id, callback) ⇒ Operation\\nget individual information from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | The spp_id of the individual |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ngetIndividual(\\\"IND_Q4VGGZPF\\\")\\n```\\n\\n* * *\\n\\n## getProgram\\n\\ngetProgram(program_id, callback) ⇒ Operation\\nget program information from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| program_id | string | searching domain |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ngetProgram(\\\"PROG_2023_00000001\\\")\\n```\\n\\n* * *\\n\\n## getPrograms\\n\\ngetPrograms([options], callback) ⇒ Operation\\nget programs list from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| [options] | number | {} | offset from start |\\n| callback | function | | An optional callback function |\\n\\n**Example** \\n```js\\ngetPrograms(100)\\n```\\n\\n* * *\\n\\n## getServicePoint\\n\\ngetServicePoint(spp_id, callback) ⇒ Operation\\nget service points information from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | The spp_id of the agent |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ngetServicePoint(\\\"SVP_8P4KP4RT\\\")\\n```\\n\\n* * *\\n\\n## removeFromGroup\\n\\nremoveFromGroup(group_id, individual_id) ⇒ Operation\\nremove individual from group in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| group_id | string | group registrant id |\\n| individual_id | string | individual registrant id |\\n\\n**Example** \\n```js\\nremoveFromGroup(\\\"GRP_B2BRHJN2\\\", \\\"IND_8DUQL4M4\\\")\\n```\\n\\n* * *\\n\\n## searchArea\\n\\nsearchArea(domain, [options], callback) ⇒ Operation\\nsearching for service point in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| domain | Array | | searching domain |\\n| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records |\\n| callback | function | | An optional callback function |\\n\\n**Example** *(search without offset)* \\n```js\\nsearchArea([[\\\"code\\\", \\\"=\\\", \\\"10732\\\"]])\\n```\\n**Example** *(search with offset)* \\n```js\\nsearchArea([[\\\"kind\\\", \\\"=\\\", 1]], { offset: 10 }})\\n```\\n\\n* * *\\n\\n## searchGroup\\n\\nsearchGroup(domain, [options], callback) ⇒ Operation\\nget groups from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| domain | Array | | searching domain |\\n| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for ordering search, offset for skipping records |\\n| callback | function | | An optional callback function |\\n\\n**Example** *(search group by domain)* \\n```js\\nsearchGroup([[\\\"spp_id\\\", \\\"=\\\", \\\"GRP_Q4VGGZPF\\\"]])\\n```\\n**Example** *(search group by domain with offset)* \\n```js\\nsearchGroup([[\\\"spp_id\\\", \\\"ilike\\\", \\\"GRP\\\"]], { offset: 100 }})\\n```\\n**Example** *(search group by complex domain for more accuracy)* \\n```js\\nsearchGroup([[\\\"address\\\", \\\"!=\\\", false], [\\\"phone\\\", \\\"!=\\\", false]])\\n```\\n\\n* * *\\n\\n## searchIndividual\\n\\nsearchIndividual(domain, [options], callback) ⇒ Operation\\nget individuals from OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| domain | Array | | searching domain |\\n| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records |\\n| callback | function | | An optional callback function |\\n\\n**Example** *(search individual by domain)* \\n```js\\nsearchIndividual([[\\\"spp_id\\\", \\\"=\\\", \\\"IND_Q4VGGZPF\\\"]])\\n```\\n**Example** *(search individual by domain with offset)* \\n```js\\nsearchIndividual([[\\\"spp_id\\\", \\\"ilike\\\", \\\"IND\\\"]], { offset: 100 })\\n```\\n**Example** *(search individual by complex domain for more accuracy)* \\n```js\\nsearchIndividual([[\\\"address\\\", \\\"!=\\\", false], [\\\"birthdate\\\", \\\"=\\\", false]])\\n```\\n\\n* * *\\n\\n## searchServicePoint\\n\\nsearchServicePoint(domain, [options], callback) ⇒ Operation\\nsearching for service point in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Default | Description |\\n| --- | --- | --- | --- |\\n| domain | Array | | searching domain |\\n| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records |\\n| callback | function | | An optional callback function |\\n\\n**Example** *(search without offset)* \\n```js\\nsearchServicePoint([[\\\"name\\\", \\\"ilike\\\", \\\"agent 1\\\"]])\\n```\\n**Example** *(search with offset)* \\n```js\\nsearchServicePoint([[\\\"name\\\", \\\"ilike\\\", \\\"agent 1\\\"]], { offset: 100 })\\n```\\n\\n* * *\\n\\n## unenroll\\n\\nunenroll(spp_id, program_id)\\nunenroll registrant from program in OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| spp_id | string | spp_id of group / individual wanted to unenroll |\\n| program_id | string | program_id of program |\\n\\n**Example** \\n```js\\nunenroll(\\\"IND_Q4VGGZPF\\\", \\\"PROG_2023_00000001\\\")\\n```\\n\\n* * *\\n\\n## updateGroup\\n\\nupdateGroup(group_id, data) ⇒ Operation\\nupdate group for OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| group_id | string | group registrant id |\\n| data | object | registrant update data |\\n\\n**Example** \\n```js\\nupdateGroup(\\\"GRP_B2BRHJN2\\\", { name: \\\"Group 1\\\" })\\n```\\n\\n* * *\\n\\n## updateIndividual\\n\\nupdateIndividual(individual_id, data) ⇒ Operation\\nupdate individual for OpenSPP\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| individual_id | string | individual registrant id |\\n| data | object | registrant update data |\\n\\n**Example** \\n```js\\nupdateIndividual(\\\"IND_8DUQL4M4\\\", { name: \\\"Individual 1\\\" })\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-openspp \\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with OpenSPP\\nAPI.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/openspp-docs)\\nfor full technical documentation.\\n\\n### Configuration\\n\\nView the\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/openspp-configuration-schema/)\\nfor required and optional `configuration` properties.\\n\\n### A example expression using the `getServicePoint` function\\n\\n```js\\ngetServicePoint(\\\"newagentflour\\\");\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n\\\"Getting Started\\\" guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build _only_ the docs run `pnpm build docs`.\\n\"","changelog":"\"# @openfn/language-openspp\\n\\n## 1.2.0\\n\\n### Changes\\n\\n- 05defd2: add new functions, correcting docstring and add more examples\\n - correcting docstring input parameters type\\n - changing getServicePoint() from get by name into get by unique id\\n - add more examples in docstring\\n - getArea(): get existing area by id\\n - searchArea(): search existing area by domain\\n - searchServicePoint(): search existing service point by domain\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- 48b4e97: update `spp date time now string` format\\n\\n## 1.1.0\\n\\n- Create OpenSPP adaptor with these functions:\\n - getGroup(): get existing group information\\n - getIndividual(): get existing individual information\\n - searchGroup(): search existing group by domain\\n - searchIndividual(): search existing individual by domain\\n - getGroupMembers(): get members from group\\n - getServicePoint(): get service points by name\\n - getPrograms(): get single program\\n - getPrograms(): get program list\\n - getEnrolledPrograms(): get list of enrolled program for each beneficiary\\n - enroll(): enroll beneficiary to a program\\n - unenroll(): unenroll beneficiary from program\\n - createIndividual(): create new individual\\n - updateIndividual(): update existing individual\\n - createGroup(): create new group\\n - updateGroup(): update existing group\\n - addToGroup(): add individual to group with(out) role\\n - removeFromGroup(): end membership of individual to group\\n\"","functions":["addToGroup","createGroup","createIndividual","enroll","getArea","getEnrolledPrograms","getGroup","getGroupMembers","getIndividual","getProgram","getPrograms","getServicePoint","removeFromGroup","searchArea","searchGroup","searchIndividual","searchServicePoint","unenroll","updateGroup","updateIndividual"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"baseUrl":{"title":"Base URL","anyOf":[{"type":"string"},{"type":"null"}],"description":"The base URL (http://www.example.com)","format":"uri","minLength":1,"default":"http://localhost","examples":["https://dev.newlogic-demo.com"]},"username":{"title":"Username","type":"string","description":"Username","default":"admin","examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Password","default":"admin","writeOnly":true,"examples":["@some(!)Str0ngp4ss0w0rd"]},"database":{"title":"Database Name","type":"string","default":"devel","description":"Database Name","examples":["devel"]}},"type":"object","additionalProperties":true,"required":["password","username","database","baseUrl"]}}, -{"name":"postgresql","adaptor":"@openfn/language-postgresql","version":"4.1.8","docs":"\"## Functions\\n\\n
\\n
\\n describeTable(tableName, [options], callback)
\\n
\\n findValue([filter])
\\n
\\n insert(table, record, [options], callback)
\\n
\\n insertMany(table, records, [options], callback)
\\n
\\n insertTable(tableName, columns, [options], callback)
\\n
\\n modifyTable(tableName, columns, [options], callback)
\\n
\\n sql(sqlQuery, [options], callback)
\\n
\\n upsert(table, uuid, record, [options], callback)
\\n
\\n upsertIf(logical, table, uuid, record, [options], callback)
\\n
\\n upsertMany(table, uuid, data, [options], callback)
\\n
\\n\\n\\n## describeTable\\n\\ndescribeTable(tableName, [options], callback) ⇒ Operation\\nList the columns of a table in a database.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| tableName | string | The name of the table to describe |\\n| [options] | object | Optional options argument |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ndescribeTable('clinic_visits')\\n```\\n\\n* * *\\n\\n## findValue\\n\\nfindValue([filter]) ⇒ value\\nFetch a uuid key given a condition\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| [filter] | object | A filter object with the lookup table, a uuid and the condition |\\n| [filter.uuid] | string | The uuid value to search for in the specified relation. |\\n| [filter.relation] | string | The name of the relation to search for the uuid value. |\\n| [filter.where] | object | An object that contains key-value pairs to filter the search results. |\\n| [filter.operator] | object | An object that contains key-value pairs to specify the type of comparison to perform on the where clause. |\\n\\n**Example** \\n```js\\nfindValue({\\n uuid: 'id',\\n relation: 'users',\\n where: { first_name: 'Mamadou' },\\n operator: { first_name: 'like' }\\n })\\n```\\n\\n* * *\\n\\n## insert\\n\\ninsert(table, record, [options], callback) ⇒ Operation\\nInsert a record\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| record | object | Payload data for the record as a JS object or function |\\n| [options] | object | Optional options argument |\\n| [options.setNull] | string | A string value that specifies the behavior for inserting null values. |\\n| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ninsert('users', { name: 'Elodie', id: 7 }, { setNull: \\\"'NaN'\\\", logValues: true });\\n```\\n\\n* * *\\n\\n## insertMany\\n\\ninsertMany(table, records, [options], callback) ⇒ Operation\\nInsert many records, using the keys of the first as the column template\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| records | array | An array or a function that takes state and returns an array |\\n| [options] | object | Optional options argument |\\n| [options.setNull] | string | A string value that specifies the behavior for inserting null values. |\\n| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ninsertMany('users', state => state.data.recordArray, { setNull: \\\"'undefined'\\\", logValues: true });\\n```\\n\\n* * *\\n\\n## insertTable\\n\\ninsertTable(tableName, columns, [options], callback) ⇒ Operation\\nCreate a table in database when given an array of columns and a table_name.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| tableName | string | The name of the table to create |\\n| columns | array | An array of form columns |\\n| [options] | object | Optional options argument |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\ninsertTable('table_name', state => state.data.map(\\n column => ({\\n name: column.name,\\n type: column.type,\\n required: true, // optional\\n unique: false, // optional - to be set to true for unique constraint\\n })\\n));\\n```\\n\\n* * *\\n\\n## modifyTable\\n\\nmodifyTable(tableName, columns, [options], callback) ⇒ Operation\\nAlter an existing table in the database.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| tableName | string | The name of the table to alter |\\n| columns | array | An array of form columns |\\n| [options] | object | Optional options argument |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nmodifyTable('table_name', state => state.data.map(\\n newColumn => ({\\n name: newColumn.name,\\n type: newColumn.type,\\n required: true, // optional\\n unique: false, // optional - to be set to true for unique constraint\\n })\\n));\\n```\\n\\n* * *\\n\\n## sql\\n\\nsql(sqlQuery, [options], callback) ⇒ Operation\\nExecute an SQL statement\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sqlQuery | function | a function which takes state and returns a string of SQL. |\\n| [options] | object | Optional options argument |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nsql(state => `select(*) from ${state.data.tableName};`, { writeSql: true })\\n```\\n\\n* * *\\n\\n## upsert\\n\\nupsert(table, uuid, record, [options], callback) ⇒ Operation\\nInsert or update a record using ON CONFLICT UPDATE\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| uuid | string | The uuid column to determine a matching/existing record |\\n| record | object | Payload data for the record as a JS object or function |\\n| [options] | object | Optional options argument |\\n| [options.setNull] | string | A string value that specifies the behavior for inserting null values. |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nupsert(\\n 'users', // the DB table\\n 'ON CONSTRAINT users_pkey', // a DB column with a unique constraint OR a CONSTRAINT NAME\\n { name: 'Elodie', id: 7 },\\n { setNull: [\\\"''\\\", \\\"'undefined'\\\"], writeSql:true, execute: true, logValues: true }\\n)\\n```\\n\\n* * *\\n\\n## upsertIf\\n\\nupsertIf(logical, table, uuid, record, [options], callback) ⇒ Operation\\nInsert or update a record based on a logical condition using ON CONFLICT UPDATE\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| logical | string | a data to check existing value for. |\\n| table | string | The target table |\\n| uuid | string | The uuid column to determine a matching/existing record |\\n| record | object | Payload data for the record as a JS object or function |\\n| [options] | object | Optional options argument |\\n| [options.setNull] | string | A string value that specifies the behavior for inserting null values. |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nupsertIf(\\n dataValue('name'),\\n 'users', // the DB table\\n 'ON CONSTRAINT users_pkey', // a DB column with a unique constraint OR a CONSTRAINT NAME\\n { name: 'Elodie', id: 7 },\\n { writeSql:true, execute: true }\\n)\\n```\\n\\n* * *\\n\\n## upsertMany\\n\\nupsertMany(table, uuid, data, [options], callback) ⇒ Operation\\nInsert or update multiple records using ON CONFLICT UPDATE and excluded\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| table | string | The target table |\\n| uuid | string | The uuid column to determine a matching/existing record |\\n| data | array | An array of objects or a function that returns an array |\\n| [options] | object | Optional options argument |\\n| [options.setNull] | string | A string value that specifies the behavior for inserting null values. |\\n| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. |\\n| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. |\\n| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nupsertMany(\\n 'users', // the DB table\\n 'email', // a DB column with a unique constraint OR a CONSTRAINT NAME\\n [\\n { name: 'one', email: 'one@openfn.org' },\\n { name: 'two', email: 'two@openfn.org' },\\n ]\\n { logValues: true }\\n)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language PostgreSQL\\n\\nLanguage Pack for building expressions and operations to run PostgreSQL queries.\\n\\n## Documentation\\n\\n## required configuration for Heroku postgres\\n\\n```json\\n{\\n \\\"host\\\": \\\"some-host-url.compute-1.amazonaws.com\\\",\\n \\\"port\\\": \\\"5432\\\",\\n \\\"database\\\": \\\"wouldntyouliketoknow\\\",\\n \\\"user\\\": \\\"me\\\",\\n \\\"password\\\": \\\"noway\\\",\\n \\\"ssl\\\": true,\\n \\\"allowSelfSignedCert\\\": true\\n}\\n```\\n\\n## `sql(query)`\\n\\nExecute an sql query. An option can be added to either log the query or not and\\neither execute the query or no. The options can be omitted as well.\\n\\n#### sample usage\\n\\n```js\\nsql(\\n state =>\\n `INSERT INTO untitled_table (name, the_geom) VALUES ('` +\\n dataValue('form.first_name')(state) +\\n `', ST_SetSRID(ST_Point(` +\\n dataValue('lat')(state) +\\n `, ` +\\n dataValue('long')(state) +\\n `),4326))`,\\n { writeSql: true, execute: true }\\n);\\n```\\n\\n## Find a single value for a table\\n\\nThis helper function allows to build a specific query where `sql` would not be\\nbest suited. It returns a single value and not a promise. An example of usage\\nwould be in building a mapping object with a value from a lookup table.\\n\\n```js\\nalterState(async state => {\\n const user = {\\n id: 1,\\n name: 'Mamadou',\\n user_id: await findValue({\\n uuid: 'id',\\n relation: 'users',\\n where: { first_name: 'Mama%' },\\n operator: { first_name: 'like' }, // operator is optional. \\\"=\\\" is used by default.\\n })(state),\\n };\\n\\n return upsert(...)(state);\\n});\\n```\\n\\n## Insert a single record\\n\\nThis functions is used to insert a single record in postgres database. An option\\n`writeSql` allows to log the generated sql query. The `setNull` option allows to\\nreplace the specified elements with `NULL`.\\n\\n```js\\ninsert(\\n 'users',\\n {\\n email: 'antony@gmail.com',\\n first_name: 'Antony',\\n inserted_at: '2020-08-27 00:00:00',\\n updated_at: '2020-08-27 00:00:00',\\n },\\n { setNull: [\\\"''\\\", \\\"'undefined'\\\"], writeSql: true, logValues: true }\\n);\\n```\\n\\n## Insert or Update using a unique column as a key\\n\\nInsert or Update if matched. An option, `execute`, allows to either run the\\ngenerated query or no.\\n\\n```js\\nupsert(\\n 'users',\\n 'email',\\n {\\n email: 'luca@openfn.org',\\n first_name: 'Luca',\\n inserted_at: '2010-01-01 00:00:00',\\n updated_at: '2010-01-01 00:00:00',\\n },\\n {\\n setNull: [\\\"'NaN'\\\", \\\"'undefined'\\\"],\\n writeSql: false,\\n execute: true,\\n logValues: true,\\n }\\n);\\n```\\n\\n## Insert or Update if a value exist in the record\\n\\nThis function will upsert a record only if the logical given is true. In this\\ncase we check if `dataValue('name')` exists.\\n\\n```js\\nupsertIf(dataValue('name'), 'users', 'ON CONSTRAINT users_pkey', {\\n name: 'Elodie',\\n id: 7,\\n});\\n```\\n\\n## Insert many records in postgresql\\n\\nThis function allows the insert of a set of records inside a table all at once.\\n\\n```js\\ninsertMany(\\n 'users',\\n state =>\\n state.data.people.map(s => {\\n return {\\n first_name: ['Luca', 'Mohamed', 'Elodie'],\\n inserted_at: '2020-01-01 00:00:00',\\n updated_at: '2020-01-01 00:00:00',\\n };\\n }),\\n { logValues: true }\\n);\\n```\\n\\n## Upsert many records in postgresql\\n\\nThis function allows the upsert of a set of records inside a table all at once.\\n\\n```js\\nupsertMany('users', 'ON CONSTRAINT users_pkey', state =>\\n state.data.people.map(s => {\\n return {\\n first_name: ['Luca', 'Mohamed', 'Elodie'],\\n inserted_at: '2020-01-01 00:00:00',\\n updated_at: '2020-01-01 00:00:00',\\n };\\n })\\n);\\n```\\n\\n## Describe a table from postgres\\n\\nThis function is used to fetch the list of columns of a given table in the\\ndatabase.\\n\\n```js\\ndescribeTable('users', { writeSql: true, execute: false });\\n```\\n\\n## Create a table in the database\\n\\nThis function allows to create a table in a database from a given array of\\ncolumns. The key `identity` can be use for a column to auto-generate a value.\\n\\n```js\\ninsertTable('users', state =>\\n state.data.map(column => ({\\n name: column.name,\\n type: column.type,\\n required: true, // optional\\n unique: false, // optional - set to true for unique constraint\\n }))\\n);\\n```\\n\\n## Alter a table in the database\\n\\nThis function allows to add new columns to a table. Beware of the fact that you\\ncannot add new columns with names that already exist in the table.\\n\\n```js\\nmodifyTable(\\n 'users',\\n state =>\\n state.data.map(newColumn => ({\\n name: newColumn.name,\\n type: newColumn.type,\\n required: true, // optional\\n unique: false, // optional - set to true for unique constraint\\n })),\\n { writeSql: false, execute: true }\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-postgresql\\n\\n## 4.1.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 4.1.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 4.1.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 4.1.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 4.1.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 4.1.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 4.1.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 4.1.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 4.1.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 4.0.0\\n\\n### Major Changes\\n\\n- ecd0b53: add optional callback in sql and update response structure\\n\\n## 3.4.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 3.4.5\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 3.4.4\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 3.4.3\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 3.4.2\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 3.4.1\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 3.4.0\\n\\n### Minor Changes\\n\\n- 44ae341: Migrate postgresql\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\"","functions":["describeTable","findValue","insert","insertMany","insertTable","modifyTable","sql","upsert","upsertIf","upsertMany"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"host":{"title":"Host","type":"string","description":"Postgres instance host URL or IP address","minLength":1,"anyOf":[{"format":"uri"},{"format":"ipv4"}],"examples":["https://some-host.compute-1.amazonaws.com","201.220.61.246"]},"port":{"title":"Port","type":"integer","default":5432,"description":"Database instance port","minLength":1,"examples":[5432]},"database":{"title":"Database","type":"string","description":"The database name","minLength":1,"examples":["demo-db"]},"user":{"title":"User","type":"string","description":"User name","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"minLength":1,"examples":["@super(!)Secretpass"]},"ssl":{"title":"Use SSL","type":"boolean","examples":[true]},"allowSelfSignedCert":{"title":"Allow self-signed certificate","type":"boolean","examples":[true]}},"type":"object","additionalProperties":true,"required":["host","port","database"]}}, -{"name":"primero","adaptor":"@openfn/language-primero","version":"2.11.8","docs":"\"## Functions\\n\\n
\\n
\\n cleanupState(state)
\\n
\\n createCase(params, callback)
\\n
\\n createReferrals(params, callback)
\\n
\\n generateAuthString(state)
\\n
\\n getCases(query, options, callback)
\\n
\\n getForms(query, callback)
\\n
\\n getLocations(query, callback)
\\n
\\n getLookups(query, callback)
\\n
\\n getReferrals(params, callback)
\\n
\\n login(state)
\\n
\\n queryHandler(state, params, callback)
\\n
\\n updateCase(id, params, callback)
\\n
\\n updateReferral(params, callback)
\\n
\\n upsertCase(params, callback)
\\n
\\n\\n\\n## cleanupState\\n\\ncleanupState(state) ⇒ State\\nRemoves unserializable keys from the state.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n\\n**Example** \\n```js\\ncleanupState(state)\\n```\\n\\n* * *\\n\\n## createCase\\n\\ncreateCase(params, callback) ⇒ Operation\\nCreate a new case in Primero\\n\\nUse this function to create a new case in Primero based on a set of Data.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | an object with some case data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Create a new case in Primero based on a set of Data)* \\n```js\\ncreateCase({\\n data: {\\n age: 16,\\n sex: \\\"female\\\",\\n name: \\\"Edwine Edgemont\\\",\\n },\\n});\\n```\\n\\n* * *\\n\\n## createReferrals\\n\\ncreateReferrals(params, callback) ⇒ Operation\\nCreate referrals in Primero\\n\\nUse this function to bulk refer to one or multiple cases from Primero to a single user\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | an object with referral data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Create referrals for multiple cases in Primero)* \\n```js\\ncreateReferrals({\\n data: {\\n ids: [\\n \\\"749e9c6e-60db-45ec-8f5a-69da7c223a79\\\",\\n \\\"dcea6052-07d9-4cfa-9abf-9a36987cdd25\\\",\\n ],\\n transitioned_to: \\\"primero_cp\\\",\\n notes: \\\"This is a bulk referral\\\",\\n },\\n});\\n```\\n\\n* * *\\n\\n## generateAuthString\\n\\ngenerateAuthString(state) ⇒ string\\nGenerate an auth string to support multiple types of auth credentials.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n\\n**Example** \\n```js\\ngenerateAuthString(state)\\n```\\n\\n* * *\\n\\n## getCases\\n\\ngetCases(query, options, callback) ⇒ Operation\\nGet cases from Primero\\n\\nUse this function to get cases from Primero based on a set of query parameters.\\nNote that in many implementations, the `remote` attribute should be set to `true` to ensure that only cases marked for remote access will be retrieved.\\nYou can specify a `case_id` value to fetch a unique case and a query string to filter result.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | an object with a query param at minimum, option to getReferrals |\\n| options | object | (Optional) an object with a getReferrals key to fetch referrals |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *( Get cases from Primero with query parameters)* \\n```js\\ngetCases({\\n remote: true,\\n query: \\\"sex=male\\\",\\n});\\n```\\n**Example** *(Get case from Primero for a specific case id)* \\n```js\\ngetCases({\\n remote: true,\\n case_id: \\\"6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz\\\",\\n});\\n```\\n\\n* * *\\n\\n## getForms\\n\\ngetForms(query, callback) ⇒ Operation\\nGet forms from Primero\\n\\nUse this function to get forms from Primero that are accessible to this user based on a set of query parameters.\\nThe user can filter the form list by record type and module.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | an object with a query param at minimum |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Get the list of all forms)* \\n```js\\ngetForms();\\n```\\n**Example** *(Get the list of all forms for a specific module)* \\n```js\\ngetForms({\\n module_id: \\\"6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz\\\",\\n});\\n```\\n\\n* * *\\n\\n## getLocations\\n\\ngetLocations(query, callback) ⇒ Operation\\nGet locations from Primero\\n\\nUse this function to get a paginated list of all locations that are accessible to this user from Primero.\\nNote: You can specify a `per` value to fetch records per page(Defaults to 20).\\nAlso you can specify `page` value to fetch pagination (Defaults to 1).\\nAnother parameter is `hierarchy: true` (Defaults to false)\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | an object with a query param at minimum |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Get loocations from Primero with query parameters)* \\n```js\\ngetLocations({\\n page: 1,\\n per: 20\\n})\\n```\\n\\n* * *\\n\\n## getLookups\\n\\ngetLookups(query, callback) ⇒ Operation\\nGet lookups from Primero\\n\\nUse this function to get a paginated list of all lookups that are accessible to this user from Primero.\\nNote: You can specify a `per` value to fetch records per page(Defaults to 20).\\nAlso you can specify `page` value to fetch pagination (Defaults to 1)\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| query | object | an object with a query param at minimum |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Get lookups from Primero with query parameters)* \\n```js\\ngetLookups({\\n per: 10000,\\n page: 5\\n});\\n```\\n\\n* * *\\n\\n## getReferrals\\n\\ngetReferrals(params, callback) ⇒ Operation\\nGet referrals for a specific case in Primero\\n\\nUse this function to get the list of referrals of one case from Primero.\\nThe search can be done using either `record id` or `case id`.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | an object with an externalId field to select the attribute to use for matching on case and an externalId value for that case. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Get referrals for a case in Primero by record id)* \\n```js\\ngetReferrals({\\n externalId: \\\"record_id\\\",\\n id: \\\"6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz\\\",\\n});\\n```\\n**Example** *(Get referrals for a case in Primero by case id)* \\n```js\\n getReferrals({\\n id: \\\"6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz\\\",\\n});\\n```\\n\\n* * *\\n\\n## login\\n\\nlogin(state) ⇒ State\\nLogs in to Primero.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | Runtime state. |\\n\\n**Example** \\n```js\\nlogin(state)\\n```\\n\\n* * *\\n\\n## queryHandler\\n\\nqueryHandler(state, params, callback) ⇒ State\\nExecute custom query\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n| params | object | \\n| callback | function | \\n\\n\\n* * *\\n\\n## updateCase\\n\\nupdateCase(id, params, callback) ⇒ Operation\\nUpdate an existing case in Primero\\n\\nUse this function to update an existing case from Primero.\\nIn this implementation, the function uses a case ID to check for the case to update,\\nThen merge the values submitted in this call into an existing case.\\nFields not specified in this request will not be modified.\\nFor nested subform fields, the subform arrays will be recursively merged,\\nkeeping both the existing values and appending the new\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| id | string | A case ID to use for the update. |\\n| params | object | an object with some case data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Update case for a specific case id)* \\n```js\\nupdateCase(\\\"6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz\\\", {\\n data: {\\n age: 16,\\n sex: \\\"female\\\",\\n name: \\\"Fiona Edgemont\\\",\\n },\\n});\\n```\\n\\n* * *\\n\\n## updateReferral\\n\\nupdateReferral(params, callback) ⇒ Operation\\nUpdate a single referral for a specific case in Primero\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | an object with an caseExternalId value to use, the id and the referral id to update. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Update referral by record id)* \\n```js\\nupdateReferral({\\n caseExternalId: \\\"record_id\\\",\\n id: \\\"749e9c6e-60db-45ec-8f5a-69da7c223a79\\\",\\n caseId: \\\"dcea6052-07d9-4cfa-9abf-9a36987cdd25\\\",\\n data: (state) => state.data,\\n});\\n```\\n\\n* * *\\n\\n## upsertCase\\n\\nupsertCase(params, callback) ⇒ Operation\\nUpsert case to Primero\\n\\nUse this function to update an existing case from Primero or to create it otherwise.\\nIn this implementation, we first fetch the list of cases,\\nthen we check if the case exist before choosing the right operation to do.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | an object with an externalIds and some case data. |\\n| callback | function | (Optional) Callback function |\\n\\n**Example** *(Upsert case for a specific case id)* \\n```js\\nupsertCase({\\n externalIds: [\\\"case_id\\\"],\\n data: state => ({\\n age: 20,\\n sex: \\\"male\\\",\\n name: \\\"Alex\\\",\\n status: \\\"open\\\",\\n case_id: \\\"6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz\\\",\\n }),\\n});\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-primero\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with UNICEF's\\nPrimero API.\\n\\n**See Update Docs Site: https://docs.openfn.org/adaptors/packages/primero-docs**\\n\\n## Primero API Versions\\n\\n### Adaptor for Primero v2.0\\n\\nThis documentation outlines the functions available for Primero `v2.0` in the\\nmain branch. The API documentation is available at:\\nhttps://github.com/primeroIMS/primero/tree/development_v2/app/controllers/api\\n\\n### Adaptor for Primero v1.0 still available on the `v1` branch.\\n\\n`v1.0.7` of this adaptor was built for the Primero `v1.1` API:\\nhttps://github.com/OpenFn/language-primero/blob/v1/README.md\\n\\n[Primero API v1.1 Documentation](https://docs.google.com/document/d/1jpaT2_UBBnc3PxPYlLMBEzNUkyfuxRZiksywG5MKM0Q/edit)\\n\\n#### Primero Authentication Strategies\\n\\nThe Primero team is considering a shift to Microsoft Azure Active Directory B2C\\nfor auth. We can likely accommodate this with a similar pattern as has been used\\nin our Microsoft Dynamics, Github, or Google Sheets adaptors, but we'll need to\\nawait final doucmentation for Primero's `v2` API before making changes.\\n\\n[Azure Active Directory B2C](https://docs.microsoft.com/en-us/azure/active-directory-b2c/)\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-primero\\n\\n## 2.11.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 2.11.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 2.11.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 2.11.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 2.11.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 2.11.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 2.11.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 2.11.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 2.11.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 2.10.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 2.10.5\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 2.10.4\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 2.10.3\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n- 059c956: added examples in docstring\\n\\n## 2.10.2\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 2.10.1\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 2.10.0\\n\\n### Minor Changes\\n\\n- 33742bf: Modify `composeNextState` so that `getCases` can pass it a third\\n argument: the metadata from Primero's response.\\n\\n `getCases` will now not only return an array of `cases` in `state.data`, but\\n metadata related to pagination in `state.metadata`.\\n\\n### Patch Changes\\n\\n- 2014694: remove travis url in readme\\n- bb764db: Conditionally check for 'withReferrals' in case no options are\\n provided\\\"\\n\\n## 2.9.2\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\\n## 2.9.1\\n\\n### Patch Changes\\n\\n- d4ac748: Skipped failing test until we have a new strat (it's working)\\n\\n## 2.9.0\\n\\n### Minor Changes\\n\\n- b37a4ad: add language primero into monorepo\\n\\n### Patch Changes\\n\\n- adb97a0: Fixed issue where upsertCase always took state.data for main params\\n\"","functions":["createCase","createReferrals","getCases","getForms","getLocations","getLookups","getReferrals","updateCase","updateReferral","upsertCase"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"url":{"title":"URL","type":"string","description":"The Primero host url","format":"uri","minLength":1,"examples":["https://primero.org/some-org"]},"user":{"title":"User","type":"string","description":"The username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"minLength":1,"examples":["@super(!)Superpass"]},"basicAuth":{"title":"Use Basic Auth","type":"boolean","examples":[true]}},"type":"object","additionalProperties":true,"required":["url"]}}, -{"name":"progres","adaptor":"@openfn/language-progres","version":"1.3.8","docs":"\"## postData\\n\\npostData(params, callback) ⇒ Operation\\nMake a POST request with a certificate\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | Url, Headers and Body parameters |\\n| callback | function | (Optional) A callback function |\\n\\n**Example** \\n```js\\npostData({\\n url: urlDTP,\\n body: obj,\\n headers: {\\n 'Ocp-Apim-Subscription-Key': configuration['Ocp-Apim-Subscription-Key'],\\n },\\n agentOptions: {\\n key,\\n cert,\\n },\\n}, callback)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-progres\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the UNHCR\\nProGres v4 API.\\n\\n## Design notes\\n\\n- Integration must run through UNHCR's DTP, a middleware layer that provides a\\n public API for UNHCR internal software.\\n- An API token _and_ a self-signed certificate must be provided for\\n communication with UNHCR's DTP.\\n- Two-way sync must be possible between Primero and ProGres\\n- Teams still in discussion about whether the most common use-case will be a\\n timed sync or real-time/event-based sync.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/progres-docs) for\\nfull technical documentation.\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/progres-configuration-schema/)\\ndefinition.\\n\\n### Posting data to an endpoint with SSL cert authentication\\n\\n```js\\npostData({\\n url: urlDTP,\\n body: { a: 1 },\\n headers: {\\n 'Subscription-Key': configuration['token'],\\n },\\n agentOptions: {\\n key,\\n cert,\\n },\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-progres\\n\\n## 1.3.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 1.3.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 1.3.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 1.3.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 1.3.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 1.3.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 1.3.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 1.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.2.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 1.2.4\\n\\n### Patch Changes\\n\\n- ef828e7: update old urls in readme\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.2.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.2.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.2.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- 039ca0b: Migrate Progres\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":["postData"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"url":{"title":"URL","type":"string","description":"The Progres URL","format":"uri","minLength":1,"examples":["https://endpoint/To/DTP"]},"key":{"title":"Private Key","type":"string","description":"Your Progres private key","minLength":1,"examples":["-----BEGIN PRIVATE KEY-----SOMETYPEOFPRIVATEVALUE-----END PRIVATE KEY-----"]},"cert":{"title":"Certificate","type":"string","description":"Your Progres certificate","minLength":1,"examples":["-----BEGIN CERTIFICATE-----SOMETYPEOFVALUE-----END CERTIFICATE-----"]},"token":{"title":"Token","type":"string","description":"Your Progres token","writeOnly":true,"minLength":1,"examples":["[REDACTED]"]}},"type":"object","additionalProperties":true,"required":["url","key","cert","token"]}}, -{"name":"rapidpro","adaptor":"@openfn/language-rapidpro","version":"1.0.8","docs":"\"## Functions\\n\\n
\\n
\\n addContact(params, callback)
\\n
\\n sendBroadcast(params, callback)
\\n
\\n startFlow(params, callback)
\\n
\\n upsertContact(params, callback)
\\n
\\n\\n\\n## addContact\\n\\naddContact(params, callback) ⇒ Operation\\nAdds a new contact to RapidPro\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to create the new resource |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\naddContact({\\n name: \\\"Mamadou\\\",\\n language: \\\"ENG\\\",\\n urns: [\\\"tel:+250788123123\\\"]\\n});\\n```\\n\\n* * *\\n\\n## sendBroadcast\\n\\nsendBroadcast(params, callback) ⇒ Operation\\nSends a message to a list of contacts and/or URNs\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to create the new resource |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nsendBroadcast({\\n text: \\\"Hello world\\\",\\n urns: [\\\"twitter:sirmixalot\\\"],\\n contacts: [\\\"a052b00c-15b3-48e6-9771-edbaa277a353\\\"]\\n});\\n```\\n\\n* * *\\n\\n## startFlow\\n\\nstartFlow(params, callback) ⇒ Operation\\nStart a RapidPro flow for a number of contacts\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to create the new resource |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nstartFlow({\\n flow: \\\"f5901b62-ba76-4003-9c62-72fdacc1b7b7\\\",\\n restart_participants: false,\\n contacts: [\\\"a052b00c-15b3-48e6-9771-edbaa277a353\\\"]\\n});\\n```\\n\\n* * *\\n\\n## upsertContact\\n\\nupsertContact(params, callback) ⇒ Operation\\nUpserts a contact to RapidPro by URN\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to upsert a contact |\\n| callback | function | (Optional) callback function |\\n\\n**Example** \\n```js\\nupsertContact({\\n name: \\\"Mamadou\\\",\\n language: \\\"ENG\\\",\\n urns: [\\\"tel:+250788123123\\\"]\\n});\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-rapidpro\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the\\n[RapidPro API](https://rapidpro.io/api/v2/).\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/rapidpro-docs)\\nfor full technical documentation.\\n\\n## Usage\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/rapidpro-configuration-schema/)\\ndefinition.\\n\\n#### sample job expression using operation\\n\\n```js\\nsendBroadcast({\\n \\\"text\\\": \\\"Hello friends.\\\",\\n \\\"urns\\\": [],\\n \\\"contacts\\\": [],\\n \\\"groups\\\", [],\\n});\\n```\\n\\n### Key helper functions\\n\\n**sendBroadcast(...) to send broadcast message to multiple contacts**\\n\\n```js\\nsendBroadcast({\\n text: 'Hello world',\\n urns: ['twitter:sirmixalot'],\\n contacts: ['a052b00c-15b3-48e6-9771-edbaa277a353'],\\n});\\n```\\n\\n**startFlow(...) to trigger an automation flow in RapidPro**\\n\\n```js\\nstartFlow({\\n flow: 'f5901b62-ba76-4003-9c62-72fdacc1b7b7',\\n restart_participants: false,\\n contacts: ['a052b00c-15b3-48e6-9771-edbaa277a353'],\\n});\\n```\\n\\n**upsertContact(...) to update/insert a Contact (and check if exists using\\nexternal identifiers)**\\n\\n```js\\nupsertContact({\\n name: 'Mamadou',\\n language: 'ENG',\\n urns: ['tel:+250788123123'],\\n});\\n```\\n\\n**addContact(...) to insert a Contact**\\n\\n```js\\naddContact({\\n name: 'Mamadou',\\n language: 'ENG',\\n urns: ['tel:+250788123123'],\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-rapidpro\\n\\n## 1.0.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 1.0.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 1.0.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 1.0.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 1.0.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 1.0.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 1.0.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 1.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.5.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 0.5.5\\n\\n### Patch Changes\\n\\n- ef828e7: update old urls in readme\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.5.4\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.5.3\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.5.2\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.5.1\\n\\n### Patch Changes\\n\\n- cbb8968: Fix axios Inefficient Regular Expression Complexity vulnerability\\n\\n## 0.5.0\\n\\n### Minor Changes\\n\\n- 11f83ff: Migrate RapidPro\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":["addContact","sendBroadcast","startFlow","upsertContact"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"host":{"title":"Host","type":"string","default":"https://app.rapidpro.io/","description":"instance host URL","format":"uri","minLength":1,"examples":["https://app.rapidpro.io/"]},"token":{"title":"Token","type":"string","description":"instance access token","writeOnly":true,"minLength":1,"examples":["#Super-sSCrecrete-token"]},"apiVersion":{"title":"API Version","type":"string","description":"API version to use. Leave this empty to use the default v2","minLength":1,"examples":["v2"]}},"type":"object","additionalProperties":true,"required":["host","token"]}}, -{"name":"resourcemap","adaptor":"@openfn/language-resourcemap","version":"0.3.1","docs":"\"## submitSite\\n\\nsubmitSite(eventData) ⇒ Operation\\nCreate an event\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| eventData | object | Payload data for the event |\\n\\n**Example** \\n```js\\nexecute(\\n event(eventData)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language ResourceMap\\n\\nLanguage Pack for building expressions and operations for working with the\\n[resourcemap API](https://github.com/instedd/resourcemap/wiki/REST_API).\\n\\n## Documentation\\n\\nWe are working towards this to start:\\nhttps://github.com/instedd/resourcemap/wiki/REST_API#create-site\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/resourcemap-configuration-schema/)\\ndefinition.\\n\\n## Expressions\\n\\n## `submitSite(collectionId, fields)`\\n\\n```js\\nsubmitSite(\\n 303,\\n fields(\\n field('name', dataValue('sampleText')),\\n field('lat', 48.86),\\n field('lon', 2.35),\\n field('properties', function (state) {\\n return {\\n Comment: state.data.sampleText,\\n phone: '85512345678',\\n };\\n })\\n )\\n);\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-resourcemap\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.2.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.2.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- 664dc7f: migrate resourcemap\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"baseUrl":{"title":"Base URL","type":"string","default":"http://some-site-of-yours.com:8080","description":"ResourceMap base URL","format":"uri","minLength":1,"examples":["http://some-site-of-yours.com:8080"]},"username":{"title":"Username","type":"string","description":"Your ResourceMap username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Your ResourceMap password","writeOnly":true,"minLength":1,"examples":["@super(!)Secret"]}},"type":"object","additionalProperties":true,"required":["baseUrl"]}}, -{"name":"salesforce","adaptor":"@openfn/language-salesforce","version":"4.3.1","docs":"\"## Functions\\n\\n
\\n
\\n bulk(sObject, operation, options, fun)
\\n
\\n bulkQuery(qs, options, callback)
\\n
\\n cleanupState(state)
\\n
\\n create(sObject, attrs)
\\n
\\n createConnection(state)
\\n
\\n createIf(logical, sObject, attrs)
\\n
\\n describe(sObject)
\\n
\\n describeAll()
\\n
\\n destroy(sObject, attrs, options)
\\n
\\n execute(operations)
\\n
\\n login(state)
\\n
\\n query(qs)
\\n
\\n reference(position)
\\n
\\n relationship(relationshipName, externalId, dataSource)
\\n
\\n retrieve(sObject, id, callback)
\\n
\\n steps()
\\n
\\n toUTF8(input)
\\n
\\n update(sObject, attrs)
\\n
\\n upsert(sObject, externalId, attrs)
\\n
\\n upsertIf(logical, sObject, externalId, attrs)
\\n
\\n\\n\\n## bulk\\n\\nbulk(sObject, operation, options, fun) ⇒ Operation\\nCreate and execute a bulk job.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | API name of the sObject. |\\n| operation | String | The bulk operation to be performed |\\n| options | Object | Options passed to the bulk api. |\\n| fun | function | A function which takes state and returns an array. |\\n\\n**Example** \\n```js\\nbulk('Patient__c', 'insert', { failOnError: true, pollInterval: 3000, pollTimeout: 240000 }, state => {\\n return state.data.someArray.map(x => {\\n return { 'Age__c': x.age, 'Name': x.name }\\n })\\n});\\n```\\n\\n* * *\\n\\n## bulkQuery\\n\\nbulkQuery(qs, options, callback) ⇒ Operation\\nExecute an SOQL Bulk Query.\\nThis function uses bulk query to efficiently query large data sets and reduce the number of API requests.\\nNote that in an event of a query error,\\nerror logs will be printed but the operation will not throw the error.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| qs | String | A query string. |\\n| options | Object | Options passed to the bulk api. |\\n| [options.pollTimeout] | integer | Polling timeout in milliseconds. |\\n| [options.pollInterval] | integer | Polling interval in milliseconds. |\\n| callback | function | A callback to execute once the record is retrieved |\\n\\n**Example** *(The results will be available on `state.data`)* \\n```js\\nbulkQuery(state=> `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`);\\n```\\n**Example** \\n```js\\nbulkQuery(\\n (state) =>\\n `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`,\\n { pollTimeout: 10000, pollInterval: 6000 }\\n);\\n```\\n\\n* * *\\n\\n## cleanupState\\n\\ncleanupState(state) ⇒ State\\nRemoves unserializable keys from the state.\\n\\n**Kind**: global function \\n\\n| Param | Type |\\n| --- | --- |\\n| state | State | \\n\\n**Example** \\n```js\\ncleanupState(state)\\n```\\n\\n* * *\\n\\n## create\\n\\ncreate(sObject, attrs) ⇒ Operation\\nCreate a new object.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | API name of the sObject. |\\n| attrs | Object | Field attributes for the new object. |\\n\\n**Example** \\n```js\\ncreate('obj_name', {\\n attr1: \\\"foo\\\",\\n attr2: \\\"bar\\\"\\n})\\n```\\n\\n* * *\\n\\n## createConnection\\n\\ncreateConnection(state) ⇒ State\\nCreates a connection.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | Runtime state. |\\n\\n**Example** \\n```js\\ncreateConnection(state)\\n```\\n\\n* * *\\n\\n## createIf\\n\\ncreateIf(logical, sObject, attrs) ⇒ Operation\\nCreate a new object if conditions are met.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| logical | boolean | a logical statement that will be evaluated. |\\n| sObject | String | API name of the sObject. |\\n| attrs | Object | Field attributes for the new object. |\\n\\n**Example** \\n```js\\ncreateIf(true, 'obj_name', {\\n attr1: \\\"foo\\\",\\n attr2: \\\"bar\\\"\\n})\\n```\\n\\n* * *\\n\\n## describe\\n\\ndescribe(sObject) ⇒ Operation\\nOutputs basic information about an sObject to `STDOUT`.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | API name of the sObject. |\\n\\n**Example** \\n```js\\ndescribe('obj_name')\\n```\\n\\n* * *\\n\\n## describeAll\\n\\ndescribeAll() ⇒ Operation\\nOutputs basic information about available sObjects.\\n\\n**Kind**: global function \\n**Access**: public \\n**Example** \\n```js\\ndescribeAll()\\n```\\n\\n* * *\\n\\n## destroy\\n\\ndestroy(sObject, attrs, options) ⇒ Operation\\nDelete records of an object.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | API name of the sObject. |\\n| attrs | Object | Array of IDs of records to delete. |\\n| options | Object | Options for the destroy delete operation. |\\n\\n**Example** \\n```js\\ndestroy('obj_name', [\\n '0060n00000JQWHYAA5',\\n '0090n00000JQEWHYAA5\\n], { failOnError: true })\\n```\\n\\n* * *\\n\\n## execute\\n\\nexecute(operations) ⇒ State\\nExecutes an operation.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| operations | Operation | Operations |\\n\\n\\n* * *\\n\\n## login\\n\\nlogin(state) ⇒ State\\nPerforms a login.\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| state | State | Runtime state. |\\n\\n**Example** \\n```js\\nlogin(state)\\n```\\n\\n* * *\\n\\n## query\\n\\nquery(qs) ⇒ Operation\\nExecute an SOQL query.\\nNote that in an event of a query error,\\nerror logs will be printed but the operation will not throw the error.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| qs | String | A query string. |\\n\\n**Example** \\n```js\\nquery(`SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`);\\n```\\n\\n* * *\\n\\n## reference\\n\\nreference(position) ⇒ State\\nGet a reference ID by an index.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| position | number | Position for references array. |\\n\\n**Example** \\n```js\\nreference(0)\\n```\\n\\n* * *\\n\\n## relationship\\n\\nrelationship(relationshipName, externalId, dataSource) ⇒ object\\nAdds a lookup relation or 'dome insert' to a record.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| relationshipName | string | `__r` relationship field on the record. |\\n| externalId | string | Salesforce ExternalID field. |\\n| dataSource | string | resolvable source. |\\n\\n**Example** \\n```js\\nData Sourced Value:\\n relationship(\\\"relationship_name__r\\\", \\\"externalID on related object\\\", dataSource(\\\"path\\\"))\\nFixed Value:\\n relationship(\\\"relationship_name__r\\\", \\\"externalID on related object\\\", \\\"hello world\\\")\\n```\\n\\n* * *\\n\\n## retrieve\\n\\nretrieve(sObject, id, callback) ⇒ Operation\\nRetrieves a Salesforce sObject(s).\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | The sObject to retrieve |\\n| id | String | The id of the record |\\n| callback | function | A callback to execute once the record is retrieved |\\n\\n**Example** \\n```js\\nretrieve('ContentVersion', '0684K0000020Au7QAE/VersionData');\\n```\\n\\n* * *\\n\\n## steps\\n\\nsteps() ⇒ Array\\nFlattens an array of operations.\\n\\n**Kind**: global function \\n**Example** \\n```js\\nsteps(\\n createIf(params),\\n update(params)\\n)\\n```\\n\\n* * *\\n\\n## toUTF8\\n\\ntoUTF8(input) ⇒ String\\nTransliterates unicode characters to their best ASCII representation\\n\\n**Kind**: global function \\n**Returns**: String - - ASCII representation of input string \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| input | string | A string with unicode characters |\\n\\n**Example** \\n```js\\nfn((state) => {\\n const s = toUTF8(\\\"άνθρωποι\\\");\\n console.log(s); // anthropoi\\n return state;\\n});\\n```\\n\\n* * *\\n\\n## update\\n\\nupdate(sObject, attrs) ⇒ Operation\\nUpdate an object.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | API name of the sObject. |\\n| attrs | Object | Field attributes for the new object. |\\n\\n**Example** \\n```js\\nupdate('obj_name', {\\n attr1: \\\"foo\\\",\\n attr2: \\\"bar\\\"\\n})\\n```\\n\\n* * *\\n\\n## upsert\\n\\nupsert(sObject, externalId, attrs) ⇒ Operation\\nUpsert an object.\\n\\n**Kind**: global function \\n**Access**: public \\n**Magic**: sObject - $.children[?(!@.meta.system)].name \\n**Magic**: externalId - $.children[?(@.name==\\\"{{args.sObject}}\\\")].children[?(@.meta.externalId)].name \\n**Magic**: attrs - $.children[?(@.name==\\\"{{args.sObject}}\\\")].children[?(!@.meta.externalId)] \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sObject | String | API name of the sObject. |\\n| externalId | String | ID. |\\n| attrs | Object | Field attributes for the new object. |\\n\\n**Example** \\n```js\\nupsert('obj_name', 'ext_id', {\\n attr1: \\\"foo\\\",\\n attr2: \\\"bar\\\"\\n})\\n```\\n\\n* * *\\n\\n## upsertIf\\n\\nupsertIf(logical, sObject, externalId, attrs) ⇒ Operation\\nUpsert if conditions are met.\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| logical | boolean | a logical statement that will be evaluated. |\\n| sObject | String | API name of the sObject. |\\n| externalId | String | ID. |\\n| attrs | Object | Field attributes for the new object. |\\n\\n**Example** \\n```js\\nupsertIf(true, 'obj_name', 'ext_id', {\\n attr1: \\\"foo\\\",\\n attr2: \\\"bar\\\"\\n})\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Salesforce\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the\\nSalesforce API.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/salesforce-docs)\\nfor full technical documentation.\\n\\n## Release notes and deprecated CHANGELOG.md\\n\\nSee [releases](https://docs.openfn.org/adaptors/packages/salesforce-changelog)\\nfor all changes.\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/saleforce-configuration-schema/)\\ndefinition.\\n\\n## Intent\\n\\n---\\n\\nAllow communication with Salesforce using a set of Lisp compatible expressions.\\n\\nUsing simple functions we can create a simplified API, simple enough to generate\\ncode from data.\\n\\n## Expressions\\n\\n---\\n\\nExpressions are a simplified set of function calls. Outlining the operations\\nneeded to be performed.\\n\\nAn uncompiled expression has no knowledge of the internals of the adaptor,\\ncredentials or runtime environment.\\n\\nIt's the responsibility of the build process to provide a wrapper that will\\ninject the functions in.\\n\\nFor example:\\n\\n```javascript\\ndescribe('vera__Test_Event__c'),\\n create('vera__Test_Event__c', {\\n vera__Test_Event_Name_Unique__c: 'hello from jsforce',\\n }),\\n create('vera__Boat__c', {\\n Name: 'Catatafish redux!',\\n vera__Test_Event__c: reference(0),\\n });\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\\n## Other\\n\\nCreate SOAP session\\n\\n```sh\\ncurl https://test.salesforce.com/services/Soap/u/47.0 -H \\\"Content-Type: text/xml; charset=UTF-8\\\" -H \\\"SOAPAction: login\\\" -d @tmp/login.txt | xmllint --format -\\n```\\n\\nClose jobs\\n\\n```sh\\ncurl\\nhttps://openfn.my.salesforce.com/services/async/47.0/job/some_id -H 'X-SFDC-Session: abc123sessionID456xyz' -H \\\"Content-Type: application/xml; charset=UTF-8\\\" -d @tmp/close_job.txt | xmllint --format -\\n```\\n\"","changelog":"\"# @openfn/language-salesforce\\n\\n## 4.3.1\\n\\n### Patch Changes\\n\\n- 1131c34: Remove regex pattern for validation and changed minLength to 1\\n\\n## 4.3.0\\n\\n### Minor Changes\\n\\n- 1d5b62f: Add `toUTF8` function\\n\\n## 4.2.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 4.2.1\\n\\n### Patch Changes\\n\\n- 07debe9: Update bulkQuery to use bulkv2\\n\\n## 4.2.0\\n\\n### Minor Changes\\n\\n- fc58f1c: add options in bulkQuery\\n\\n## 4.1.0\\n\\n### Minor Changes\\n\\n- 1e3a083: add bulkQuery function\\n\\n## 4.0.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 4.0.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 4.0.6\\n\\n### Patch Changes\\n\\n- aceedd2: update jsforce and remove unused packages\\n\\n## 4.0.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 4.0.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 4.0.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 4.0.2\\n\\n### Patch Changes\\n\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 4.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 4.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 3.0.7\\n\\n### Patch Changes\\n\\n- 7cc8efc: remove FakeAdaptor references\\n\\n## 3.0.6\\n\\n### Patch Changes\\n\\n- 705caab: Remove tools as devdependencies\\n\\n## 3.0.5\\n\\n### Patch Changes\\n\\n- 929bca6: Use metadata helper function from common\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 3.0.4\\n\\n### Patch Changes\\n\\n- ef828e7: update old urls in readme\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 3.0.3\\n\\n### Patch Changes\\n\\n- 06aced8: Fix dependencies\\n\\n## 3.0.2\\n\\n### Patch Changes\\n\\n- aed7e0b: fix required field in configuration schema\\n\\n## 3.0.1\\n\\n### Patch Changes\\n\\n- c09b821: Add @magic annotations\\n\\n## 3.0.0\\n\\n### Major Changes\\n\\n- 190f667: Remove curry from salesforce\\n\\n## 2.12.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 2.12.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 2.12.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 2.12.0\\n\\n### Minor Changes\\n\\n- 5c883c6: Allow expansion for describe(), add describeAll()\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 2.11.1\\n\\n### Patch Changes\\n\\n- e7bf865: chore(deps): update dependency sinon to v14\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 2.11.0\\n\\n### Minor Changes\\n\\n- edff578: Migrate salesforce\\n\"","functions":["bulk","bulkQuery","create","createIf","describe","describeAll","destroy","query","reference","relationship","retrieve","toUTF8","update","upsert","upsertIf"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"loginUrl":{"title":"Login URL","type":"string","description":"The Salesforce instance login URL","format":"uri","minLength":1,"examples":["https://somesalesforcelogin.url"]},"username":{"title":"Username","type":"string","description":"The username to log in the Salesforce instance","minLength":1,"examples":["someusername"]},"password":{"title":"Password","type":"string","description":"The password to log in the Salesforce instance","writeOnly":true,"minLength":1,"examples":["@super(!)SecretPass"]},"securityToken":{"title":"Security Token","type":"string","description":"The security token to access the Salesforce instance","minLength":1,"examples":["salesforcesecuritytoken"]},"apiVersion":{"title":"API Version","type":"string","placeholder":"52.0","description":"Salesforce API Version","minLength":1,"examples":["59.0"]}},"type":"object","additionalProperties":true,"required":["loginUrl","username","password","securityToken"]}}, -{"name":"sftp","adaptor":"@openfn/language-sftp","version":"1.0.2","docs":"\"## Functions\\n\\n
\\n
\\n getCSV(filePath, [parsingOptions])
\\n
\\n getJSON(filePath, encoding)
\\n
\\n list(dirPath, filter, [callback])
\\n
\\n normalizeCSVarray(options, callback)
\\n
\\n putCSV(localFilePath, remoteFilePath, parsingOptions)
\\n
\\n\\n\\n## getCSV\\n\\ngetCSV(filePath, [parsingOptions]) ⇒ Operation\\nGet a CSV and return a JSON array of strings for each item separated by the delimiter\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| filePath | string | Path to resource |\\n| [parsingOptions] | Object | Optional. `parsingOptions` Parsing options which can be passed to convert csv to json See more [on csvtojson docs](https://github.com/Keyang/node-csvtojson#parameters) |\\n\\n**Example** \\n```js\\ngetCSV(\\n '/some/path/to_file.csv',\\n {delimiter: \\\";\\\", flatKeys: true }\\n);\\n```\\n\\n* * *\\n\\n## getJSON\\n\\ngetJSON(filePath, encoding) ⇒ Operation\\nFetch a json file from an FTP server\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| filePath | string | Path to resource |\\n| encoding | string | Character encoding for the json |\\n\\n**Example** \\n```js\\ngetJSON(\\n '/path/To/File',\\n 'utf8',\\n);\\n```\\n\\n* * *\\n\\n## list\\n\\nlist(dirPath, filter, [callback]) ⇒ Operation\\nList files present in a directory\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| dirPath | string | Path to remote directory |\\n| filter | function | a filter function used to select return entries |\\n| [callback] | function | Optional callback to handle the response |\\n\\n**Example** *(basic files listing)* \\n```js\\nlist('/some/path/')\\n```\\n**Example** *(list files with filters)* \\n```js\\nlist('/some/path/', file=> {\\n return /foo.\\\\.txt/.test(file.name);\\n})\\n```\\n**Example** *(list files with filters and use callback)* \\n```js\\nlist(\\n \\\"/some/path/\\\",\\n (file) => /foo.\\\\.txt/.test(file.name),\\n (state) => {\\n const latestFile = state.data.filter(\\n (file) => file.modifyTime <= new Date()\\n );\\n return { ...state, latestFile };\\n }\\n);\\n```\\n\\n* * *\\n\\n## normalizeCSVarray\\n\\nnormalizeCSVarray(options, callback) ⇒ Operation\\nConvert JSON array of strings into a normalized object\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| options | options | Options passed to csvtojson parser |\\n| callback | callback | Options passed to csvtojson parser |\\n\\n**Example** \\n```js\\nnormalizeCSVarray({ delimiter: ';', noheader: true });\\n```\\n\\n* * *\\n\\n## putCSV\\n\\nputCSV(localFilePath, remoteFilePath, parsingOptions) ⇒ Operation\\nConvert JSON to CSV and upload to an FTP server\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| localFilePath | string | Data source for data to copy to the remote server. |\\n| remoteFilePath | string | Path to the remote file to be created on the server. |\\n| parsingOptions | object | Options which can be passed to adjust the read and write stream used in sending the data to the remote server |\\n\\n**Example** \\n```js\\nputCSV(\\n '/some/path/to_local_file.csv',\\n '/some/path/to_remove_file.csv',\\n { delimiter: ';', noheader: true }\\n);\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language SFTP\\n\\nLanguage Pack for building expressions and operations to work with SFTP servers.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/sftp-configuration-schema/)\\ndefinition.\\n\\n## List the content of a directory\\n\\n```js\\nalterState(state => {\\n return list('/path/To/Directory')(state).then(response => {\\n console.log(`There are ${response.data.length} files.`);\\n return response;\\n });\\n});\\n```\\n\\n## sample getCSV expression\\n\\n```js\\ngetCSV('path/to/file.csv', 'utf8', {\\n quote: 'off',\\n delimiter: ';',\\n noheader: true,\\n filter: {\\n type: 'startsWith',\\n key: 'field1',\\n value: 'JO',\\n },\\n});\\n```\\n\\nA more complex example that breaks up the CSV file into multiple payloads for\\nquicker processing.\\n\\n```js\\nfn(state => {\\n return list('/')(state).then(state => {\\n const targetNames = [\\n 'exportContacts', //example fileName\\n ];\\n console.log(`Fetching files: ${targetNames}`);\\n const files = state.data\\n .filter(file => file.name.split('.')[1] === 'csv')\\n .filter(file =>\\n targetNames.some(targetName =>\\n file.name.toLowerCase().includes(targetName)\\n )\\n );\\n\\n if (files.length === 0) console.log('No new CSV files found.');\\n return { ...state, data: {}, files };\\n });\\n});\\n\\neach(\\n '$.files[*]',\\n fn(state => {\\n const { configuration, data } = state;\\n\\n return getCSV(`/${data.name}`)(state).then(async state => {\\n const headers = state.data\\n .shift()\\n .split(';')\\n .map(h => (h = h.replace(/\\\"/g, '')));\\n\\n function toObject(item) {\\n const values = item.split(';');\\n\\n return Object.fromEntries(\\n headers.map((k, i) => {\\n return values[i]\\n ? [k, values[i].replace(/\\\"/g, '')]\\n : [k, values[i]];\\n })\\n );\\n }\\n\\n let countInbox = 0;\\n\\n //to post CSV data as individual Messages to OpenFn Inbox\\n const postToInbox = async data => {\\n countInbox++;\\n\\n console.log(`Sending request ${countInbox} to inbox`);\\n\\n await new Promise(resolve => setTimeout(resolve, 200));\\n\\n await http.post({\\n url: configuration.openfnInboxUrl,\\n data: data,\\n maxContentLength: Infinity,\\n maxBodyLength: Infinity,\\n })(state);\\n };\\n\\n //To split up into multiple, smaller payloads before send to OpenFn Inbox\\n const chunkSize = 500;\\n\\n console.log(\\n state.data.length,\\n 'rows will be sent in',\\n Math.ceil(state.data.length / chunkSize),\\n 'requests of',\\n chunkSize,\\n 'rows each.'\\n );\\n\\n while (state.data.length > 0) {\\n console.log('data.length', state.data.length);\\n await postToInbox({\\n fileName: data.name,\\n fileType: data.name.split('-')[0],\\n uploadDate: new Date(data.modifyTime).toISOString(),\\n json: state.data.splice(0, chunkSize).map(toObject),\\n });\\n }\\n\\n return { configuration, references: [], data: {} };\\n });\\n })\\n);\\n```\\n\\n## sample putCSV expression\\n\\nThis function converts JSON to CSV and post to a server\\n\\n```js\\nputCSV('/some/path/to_file.csv', 'utf8', { delimiter: ';', noheader: true });\\n```\\n\\n### Get JSON from FTP server\\n\\n```js\\ngetJSON('path/to/file.json', 'utf8');\\n```\\n\\n### Custom request to an http endpoint\\n\\nThis adaptor exports `http` from `language-common`. Here, we outline the usage\\nin order to make custom requests to an endpoint. It returns a promise\\n\\n```js\\nalterState(state => {\\n return http\\n .post({ url: 'yourURL', data: { name: 'Mamadou' } })(state)\\n .then(response => {\\n // do something with response;\\n return response;\\n });\\n});\\n```\\n\\n## Development\\n\\nClone the repo, run `pnpm install`.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build the docs for this repo, `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-sftp\\n\\n## 1.0.2\\n\\n### Patch Changes\\n\\n- a666a63: On error disconnect then throw\\n\\n## 1.0.1\\n\\n### Patch Changes\\n\\n- 771c814: - Properly disconnect on error\\n - Improve operation logs\\n\\n## 1.0.0\\n\\n### Major Changes\\n\\n- e52ba66: add `filter` option in `list()` function\\n\\n## 0.8.8\\n\\n### Patch Changes\\n\\n- Updated dependencies [c19efbe]\\n - @openfn/language-common@1.11.1\\n\\n## 0.8.7\\n\\n### Patch Changes\\n\\n- Updated dependencies [85c35b8]\\n - @openfn/language-common@1.11.0\\n\\n## 0.8.6\\n\\n### Patch Changes\\n\\n- Updated dependencies [df09270]\\n - @openfn/language-common@1.10.3\\n\\n## 0.8.5\\n\\n### Patch Changes\\n\\n- Updated dependencies [26a303e]\\n - @openfn/language-common@1.10.2\\n\\n## 0.8.4\\n\\n### Patch Changes\\n\\n- Updated dependencies [8c32eb3]\\n - @openfn/language-common@1.10.1\\n\\n## 0.8.3\\n\\n### Patch Changes\\n\\n- Updated dependencies [aad9549]\\n - @openfn/language-common@1.10.0\\n\\n## 0.8.2\\n\\n### Patch Changes\\n\\n- d2c980e: Use `parseCsv` from language-common\\n- c5d3ce1: improve connection handling\\n- Updated dependencies [111807f]\\n - @openfn/language-common@1.9.0\\n\\n## 0.8.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.8.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.7.3\\n\\n### Patch Changes\\n\\n- 432dd0a: fix sftp connection wqautoclose\\n\\n## 0.7.2\\n\\n### Patch Changes\\n\\n- 205b806: remove asObjects key before parsing\\n\\n## 0.7.1\\n\\n### Patch Changes\\n\\n- 827c627: error handling\\n\\n## 0.7.0\\n\\n### Minor Changes\\n\\n- fa58216: Add csvtojson convertion option\\n\\n## 0.6.9\\n\\n### Patch Changes\\n\\n- Updated dependencies [929bca6]\\n - @openfn/language-common@1.7.7\\n\\n## 0.6.8\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.6.7\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.6.6\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.6.5\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 0.6.4\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 0.6.3\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- 4126a62: Fix built bundle\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 0.6.2\\n\\n### Patch Changes\\n\\n- e04aa28: Rename credential-schema to configuration-schema, update descriptions\\n\\n## 0.6.1\\n\\n### Patch Changes\\n\\n- 28dfbfa: add todo, fix build pack\\n\\n## 0.6.0\\n\\n### Minor Changes\\n\\n- f294a62: Added credential-schema.json for new ui\\n\\n## 0.5.0\\n\\n### Minor Changes\\n\\n- 2c04894: added sftp package\\n\"","functions":["getCSV","getJSON","list","normalizeCSVarray","putCSV"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"host":{"title":"Host URL","type":"string","description":"The SFTP server host url or ip address","format":"uri","minLength":1,"examples":["191.173.128.88"]},"port":{"title":"Port","type":"integer","default":21,"description":"The SFTP server port","minLength":1,"examples":[22]},"username":{"title":"Username","type":"string","description":"Username","minLength":1,"examples":["admin"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"minLength":1,"examples":["@some(!)Strongpassword"]}},"type":"object","additionalProperties":true,"required":["host"]}}, -{"name":"smpp","adaptor":"@openfn/language-smpp","version":"1.3.1","docs":"\"\"","readme":"\"# Language SMPP\\n\\nLanguage Pack for building expressions and operations to make calls to an OpenFn\\nSMPP client API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/smpp-configuration-schema/)\\ndefinition.\\n\\n#### sample send expression\\n\\n```js\\nsend({\\n text: dataValue('text'),\\n smsId: dataValue('messageId'),\\n recipient: dataValue('to'),\\n sender: dataValue('from'),\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-smpp\\n\\n## 1.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.2.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.2.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.2.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- 3aedd05: migrate smpp\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"clientHost":{"title":"Client host","type":"string","description":"Your SMPP client host URL","format":"uri","minLength":1,"examples":["https://some-smpp.com:3000"]},"systemId":{"title":"System ID","type":"string","description":"Your SMPP client name","minLength":1,"examples":["some_smpp_client_name"]},"inboxId":{"title":"Inbox ID","type":"string","description":"Your SMPP client inbox ID","minLength":1,"examples":["1c908151-8273-431c-b1d4-blah"]},"password":{"title":"Password","type":"string","description":"Your SMPP client password","writeOnly":true,"minLength":1,"examples":["@some(!)StrongPassword"]}},"type":"object","additionalProperties":true,"required":["clientHost","systemId","inboxId","password"]}}, -{"name":"surveycto","adaptor":"@openfn/language-surveycto","version":"1.2.1","docs":"\"## fetchSubmissions\\n\\nfetchSubmissions(params) ⇒ Operation\\nMake a GET request and POST it somewhere else\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | object | data to make the fetch |\\n\\n**Example** \\n```js\\nexecute(\\n fetch(params)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language SurveyCTO\\n\\nLanguage Pack for building expressions and operations to make HTTP calls to\\nSurveyCTO.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/surveycto-configuration-schema/)\\ndefinition.\\n\\n## fetchSubmissions\\n\\n`fetchSubmissions(1,2,3)` takes three arguments:\\n\\n1. the `formId` of the form on SurveyCTO\\n\\n2. the `initialAfterDate`, a date string or UNIX timestamp which instructs the\\n job to only fetch submissions after a certain date. After the first run of\\n the job, subsequent runs will only fetch _NEW_ submissions.\\n\\n3. the `postUrl` is where the wide-format JSON representation of each form\\n submission should be sent. Note that a `formId` key will be added to each\\n form submission for later filtering/routing.\\n\\n### sample `fetchSubmissions` expression\\n\\n```js\\nfetchSubmissions(\\n // formId on SurveyCTO server\\n 'household_survey',\\n // initialAfterDate: this will only be accessed if \\\"lastSubmissionDate\\\" is empty in your job_state\\\".\\n // After the initial run of the job, OpenFn will only pull new submissions from SurveyCTO.\\n 'Aug 29, 2016 4:44:26 PM',\\n // postUrl is where you want to send the JSON submissions, appended with a new \\\"formId\\\" key\\n 'https://www.openfn.org/inbox/secret-inbox-uuid'\\n);\\n```\\n\\n## Development\\n\\nClone the repo, run `npm install`.\\n\\nRun tests using `npm run test` or `npm run test:watch`\\n\\nBuild the project using `make`.\\n\"","changelog":"\"# @openfn/language-surveycto\\n\\n## 1.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.1.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.1.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.1.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- 776bb13: migrate surveycto\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"instanceName":{"title":"Instance name","type":"string","description":"Your Surveycto instance name","minLength":1,"examples":["openfn_test"]},"username":{"title":"Username","type":"string","description":"Your Surveycto instance username","minLength":1,"examples":["someusername"]},"password":{"title":"Password","type":"string","description":"Your Surveycto instance password","writeOnly":true,"minLength":1,"examples":["@some(%)!Password"]}},"type":"object","additionalProperties":true,"required":["instanceName","username","password"]}}, -{"name":"telerivet","adaptor":"@openfn/language-telerivet","version":"0.2.1","docs":"\"## send\\n\\nsend(sendData) ⇒ Operation\\nSend a message\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| sendData | object | Payload data for the message |\\n\\n**Example** \\n```js\\nexecute(\\n send(data)\\n)(state)\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Telerivet\\n\\nLanguage Pack for sending messages using the\\n[telerivet API](https://telerivet.com/api/rest/curl).\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/telerivet-configuration-schema/)\\ndefinition.\\n\\n## Send message\\n\\n#### Current `send` expression:\\n\\n```js\\nsend(\\n fields(\\n field('to_number', dataValue('recipient_number')),\\n field('content', dataValue('recipient_text')),\\n // Lots of optional parameters...\\n field('message_type', 'sms'),\\n field('route_id', dataValue('some_route'))\\n )\\n);\\n```\\n\\n## sendBulk messages - WIP\\n\\n#### Current `sendBulk` expression:\\n\\n```js\\nsend(fields(\\n field(\\\"content\\\", dataValue(\\\"recipient_text\\\")),\\n field(\\\"to_numbers\\\", [\\n \\\"+14155550123\\\",\\n \\\"+14255550234\\\",\\n \\\"+16505550345\\\"\\n ]\\n // Lots of optional parameters...\\n field(\\\"message_type\\\", \\\"sms\\\"),\\n field(\\\"route_id\\\", dataValue(\\\"some_route\\\"))\\n))\\n```\\n\\nNote that \\\"recipient_text\\\" may be a concatenation like this:\\n\\n```js\\nfield('content', function (state) {\\n return dataValue('salutation')(state).concat(\\n '. ',\\n dataValue('last_name')(state),\\n ', )'\\n );\\n});\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-telerivet\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.1.4\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.1.3\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.1.2\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.1.1\\n\\n### Patch Changes\\n\\n- e4ebcb6: Fix Large gzip Denial of Service in superagent\\n\\n## 0.1.0\\n\\n### Minor Changes\\n\\n- 83ede44: migrate telerivet\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"projectId":{"title":"Project ID","type":"string","description":"Your Telerivet project id","minLength":1,"examples":["telerivet_project_id"]},"apiKey":{"title":"API Key","type":"string","description":"Your Telerivet API Key","writeOnly":true,"minLength":1,"examples":["telerivet_api_key"]}},"type":"object","additionalProperties":true,"required":["projectId","apiKey"]}}, -{"name":"template","adaptor":"@openfn/language-template","version":"3.0.1","docs":"\"## create\\n\\ncreate(resource, data, callback) ⇒ Operation\\nCreate some resource in some system\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| resource | string | The type of entity that will be created |\\n| data | object | The data to create the new resource |\\n| callback | function | An optional callback function |\\n\\n**Example** \\n```js\\ncreate(\\\"patient\\\", {\\\"name\\\": \\\"Bukayo\\\"})\\n```\\n\\n* * *\\n\\n\"","readme":"\"# language-template \\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the \\\\_\\\\_\\\\_\\\\_\\nAPI.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/template-docs)\\nfor full technical documentation.\\n\\n### Configuration\\n\\nView the\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/template-configuration-schema/)\\nfor required and optional `configuration` properties.\\n\\n### A example expression using the `create` function\\n\\n```js\\ncreate('patient', { name: 'Bukayo' });\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n\\\"Getting Started\\\" guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo build _only_ the docs run `pnpm build docs`.\\n\"","changelog":"\"# @openfn/language-template\\n\\n## 3.0.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 3.0.0\\n\\n### Major Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 2.0.0\\n\\n### Major Changes\\n\\n- 779596f: Use native fetch (undici) in template and add icons in openfn\\n\\n### Minor Changes\\n\\n- 1af9cd5: Better docs and resource names\\n\\n## 1.7.8\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.7.7\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.7.6\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.7.5\\n\\n### Patch Changes\\n\\n- 6d8de03: change @constructor to @function and remove /\\\\*_ @module Adaptor _/\\n\\n## 1.7.4\\n\\n### Patch Changes\\n\\n- f2a91a4: Update package exports\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\\n## 1.7.3\\n\\n### Patch Changes\\n\\n- 8566b26: Fix typings\\n- b3d45ff: Fix CJS export of npm package.\\n- b5eb665: Adjusted docs for common and built to markdown\\n- ecf5d30: remove sinon since it was not being used\\n- Updated dependencies [8566b26]\\n- Updated dependencies [b3d45ff]\\n- Updated dependencies [b5eb665]\\n- Updated dependencies [ecf5d30]\\n - @openfn/language-common@1.7.4\\n\\n## 1.7.2\\n\\n### Patch Changes\\n\\n- f4b3dd6: remove travis build url\\n\\n## 1.7.1\\n\\n### Patch Changes\\n\\n- Fixed package.json for template adaptor\\n\\n## 1.7.0\\n\\n### Minor Changes\\n\\n- 554e905: Migrated to monorepo\\n\"","functions":["create"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"baseUrl":{"title":"Base URL","anyOf":[{"type":"string"},{"type":"null"}],"description":"The base URL (http://www.example.com)","format":"uri","minLength":1,"examples":["https://example.com"]},"username":{"title":"Username","type":"string","description":"Username","examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"examples":["@some(!)Str0ngp4ss0w0rd"]}},"type":"object","additionalProperties":true,"required":["password","username"]}}, -{"name":"tutorial","adaptor":"@openfn/language-tutorial","version":"1.0.0","docs":"\"\"","readme":"\"# language-tutorial\\n\\nAn OpenFn **_adaptor_** for building integration jobs for use with the tutorial\\nAPI.\\n\\n## Documentation\\n\\nView the [docs site](https://docs.openfn.org/adaptors/packages/tutorial-docs)\\nfor full technical documentation.\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/tutorial-configuration-schema/)\\ndefinition.\\n\\n#### sample expression using operation\\n\\n```js\\n// TODO\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"### CHANGELOG\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"baseUrl":{"title":"Base URL","anyOf":[{"type":"string"},{"type":"null"}],"description":"The base URL (http://www.example.com)","format":"uri","minLength":1,"examples":["https://example.com"]},"username":{"title":"Username","type":"string","description":"Username","examples":["test@openfn.org"]},"password":{"title":"Password","type":"string","description":"Password","writeOnly":true,"examples":["@some(!)Str0ngp4ss0w0rd"]}},"type":"object","additionalProperties":true,"required":["password","username"]}}, -{"name":"twilio","adaptor":"@openfn/language-twilio","version":"0.4.1","docs":"\"## sendSMS\\n\\nsendSMS(params) ⇒ Operation\\nSends an SMS message to a specific phone number\\n\\n**Kind**: global function \\n**Access**: public \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| params | Object | an object containing 'body', 'from', and 'to' keys. |\\n\\n**Example** \\n```js\\nsendSMS({\\n body: dataValue('sampleText'),\\n from: dataValue('myFromNumber'),\\n to: dataValue('ukMobile'),\\n});\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language twilio\\n\\nLanguage Pack for building expressions and operations to interact with the\\ntwilio API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/twilio-configuration-schema/)\\ndefinition.\\n\\n### sendSMS\\n\\n#### sample expression, sending an sms\\n\\n```js\\nsendSMS({\\n body: dataValue('text'),\\n from: '+15005550006',\\n to: dataValue('recipient'),\\n});\\n```\\n\\n## local usage\\n\\n```sh\\n~/devtools/core/bin/core execute \\\\\\n -l ~/devtools/adaptors/language-twilio \\\\\\n -s ./tmp/state.json \\\\\\n -o ./tmp/output.json \\\\\\n -e ./tmp/expression.js\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-twilio\\n\\n## 0.4.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.4.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.3.4\\n\\n### Patch Changes\\n\\n- a22daa6: rename credential-schema to configuration-schemawq\\n\\n## 0.3.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.3.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- a36a072: ymigrated twilio to monorepo\\n\\n### Patch Changes\\n\\n- Updated dependencies [f2a91a4]\\n - @openfn/language-common@1.7.5\\n\"","functions":["sendSMS"],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountSid":{"title":"Account ID","type":"string","description":"Your Twilio account id","writeOnly":true,"minLength":1,"examples":["account_id"]},"authToken":{"title":"Auth Token","type":"string","description":"Your Twilio auth token","writeOnly":true,"minLength":1,"examples":["evenMoreSecret"]}},"type":"object","additionalProperties":true,"required":["accountSid","authToken"]}}, -{"name":"vtiger","adaptor":"@openfn/language-vtiger","version":"1.2.1","docs":"\"\"","readme":"\"# Language Vtiger\\n\\nLanguage Pack for building expressions and operations to make calls to the\\nVtiger API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/vtiger-configuration-schema/)\\ndefinition.\\n\\n#### sample listTypes expression\\n\\n```js\\nlistTypes();\\n```\\n\\n#### sample postElement expression\\n\\n```js\\npostElement({\\n operation: \\\"create\\\"\\n elementType: \\\"leads\\\",\\n element: {\\n \\\"name\\\": dataValue(\\\"name\\\")(state),\\n \\\"surname\\\": dataValue(\\\"surname\\\")(state),\\n \\\"email\\\": dataValue(\\\"email\\\")(state)\\n }\\n});\\n\\n\\n```\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-vtiger\\n\\n## 1.2.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 1.2.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 1.1.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 1.1.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 1.1.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 1.1.0\\n\\n### Minor Changes\\n\\n- b4a13ff: migrate vtiger\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"hostUrl":{"title":"Host URL","type":"string","description":"VTiger instance host URL","format":"uri","minLength":1,"examples":["https://openfunction.od2.vtiger.com"]},"username":{"title":"Username","type":"string","description":"VTiger instance username","minLength":1,"examples":["test@openfn.org"]},"accessToken":{"title":"Access Token","type":"string","description":"VTiger instance access token","writeOnly":true,"minLength":1,"examples":["@some()!veryHugeToke"]}},"type":"object","additionalProperties":true,"required":["hostUrl","username","accessToken"]}}, -{"name":"zoho","adaptor":"@openfn/language-zoho","version":"0.3.1","docs":"\"## addRow\\n\\naddRow(db, table, rowData) ⇒ Operation\\nTo add a row data to a database table\\n\\n**Kind**: global function \\n\\n| Param | Type | Description |\\n| --- | --- | --- |\\n| db | string | Database |\\n| table | string | Database table |\\n| rowData | object | row data to be added into the database |\\n\\n**Example** \\n```js\\naddRow(\\n'testing_openfn',\\n'Customers',\\nfields(field('Subject', dataValue('formId')), field('Status', 'Closed'))\\n);\\n```\\n\\n* * *\\n\\n\"","readme":"\"# Language Zoho\\n\\nLanguage Pack for sending messages using the Zoho API.\\n\\n## Documentation\\n\\n### Configuration\\n\\nView all the required and optional properties for `state.configuration` in the\\nofficial\\n[configuration-schema](https://docs.openfn.org/adaptors/packages/zoho-configuration-schema/)\\ndefinition.\\n\\n### addRow\\n\\nTo add a row to the \\\"Customers\\\" table in the \\\"testing_openfn\\\" database, use the\\nfollowing `addRow` function.\\n\\n```js\\naddRow(\\n 'testing_openfn',\\n 'Customers',\\n fields(field('Subject', dataValue('formId')), field('Status', 'Closed'))\\n);\\n```\\n\\n### updateRow\\n\\nComing soon. Want to help?\\nhttps://zohoreportsapi.wiki.zoho.com/Updating-Data.html\\n\\n## Development\\n\\nClone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the\\n`Getting Started` guide inside to get set up.\\n\\nRun tests using `pnpm run test` or `pnpm run test:watch`\\n\\nBuild the project using `pnpm build`.\\n\\nTo just build the docs run `pnpm build docs`\\n\"","changelog":"\"# @openfn/language-zoho\\n\\n## 0.3.1\\n\\n### Patch Changes\\n\\n- Update lock files\\n- Updated dependencies\\n - @openfn/language-common@1.8.1\\n\\n## 0.3.0\\n\\n### Minor Changes\\n\\n- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an\\n `each` block; add eslint\\n\\n The packages receiving a major bump here exposed functions that didn't work as\\n expected inside `each` blocks. Users were previously wrapping these functions\\n inside their own custom `fn` blocks, and this change will ensure that they can\\n be used inside a standard each.\\n\\n See https://github.com/OpenFn/adaptors/issues/275 for more details.\\n\\n### Patch Changes\\n\\n- Updated dependencies [2c1d603]\\n - @openfn/language-common@1.8.0\\n\\n## 0.2.3\\n\\n### Patch Changes\\n\\n- 14f481e: mark execute as private\\n- Updated dependencies [2b4c61a]\\n - @openfn/language-common@1.7.6\\n\\n## 0.2.2\\n\\n### Patch Changes\\n\\n- f7ebd3c: remove sample configuration\\n\\n## 0.2.1\\n\\n### Patch Changes\\n\\n- f2aed32: add examples\\n\\n## 0.2.0\\n\\n### Minor Changes\\n\\n- f9ac74a: migrate zoho\\n\\n### Patch Changes\\n\\n- e4ebcb6: Fix Large gzip Denial of Service in superagent\\n\"","functions":[],"configuration-schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"account":{"title":"Account","type":"string","description":"Your Zoho account","minLength":1,"examples":["yourzohoaccount"]},"authToken":{"title":"Auth Token","type":"string","description":"Your Zoho authentication token","writeOnly":true,"minLength":1,"examples":["secreauthtoken"]},"apiVersion":{"title":"API Version","type":"string","default":"v2","enum":["v1","v2"],"description":"Zoho API version","minLength":1,"examples":["v2","v1"]}},"type":"object","additionalProperties":true,"required":["account","authToken","apiVersion"]}} -] diff --git a/docs/dynamics/CHANGELOG.md b/docs/dynamics/CHANGELOG.md deleted file mode 100644 index 6307ef5d6..000000000 --- a/docs/dynamics/CHANGELOG.md +++ /dev/null @@ -1,122 +0,0 @@ -# @openfn/language-dynamics - -## 0.4.8 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 0.4.7 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 0.4.6 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 0.4.5 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 0.4.4 - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 0.4.3 - -### Patch Changes - -- aad9549: Ensure that standard OAuth2 credentials with snake-cased - "access_token" keys can be used for OAuth2-reliant adaptors -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 0.4.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 0.4.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.4.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.3.5 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 0.3.4 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.3.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.3.2 - -### Patch Changes - -- f2aed32: add examples - -## 0.3.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.3.0 - -### Minor Changes - -- b032b9c: Migrate Dynamics - -### Patch Changes - -- e81561f: Updated ast and package.json diff --git a/docs/dynamics/README.md b/docs/dynamics/README.md deleted file mode 100644 index b6dad412a..000000000 --- a/docs/dynamics/README.md +++ /dev/null @@ -1,93 +0,0 @@ -# Language Dynamics - -Language Pack for building expressions and operations to make calls to the -Microsoft Dynamics API. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/dynamics-configuration-schema/) -definition. - -- _Dynamics uses oauth2. The language-package will expect to be given a valid - oauth token. If a valid token is not provided, it will fail. On OpenFn.org, - the `CredentialService` is responsible for making sure the the oauth token is - valid each time it assembles state to hand to `execute`._ - -#### sample createEntity expression - -```js -createEntity({ - entityName: 'accounts', - body: { - name: 'Open Function', - creditonhold: false, - address1_latitude: 47.639583, - description: 'This is the description of the sample account', - revenue: 5000000, - accountcategorycode: 1, - }, -}); -``` - -#### sample query expression - -_Can be used to retrieve or query a specific Entity if an entityId is declared -in the expression. Otherwise it will perform a query on all data with the -defined Entity Name_ - -```js -query({ - entityName: 'contacts', - entityId: '51a0e5b9-88df-e311-b8e5-6c3be5a8b200', - query: { - fields: ['fullname', 'birthdate'], - limit: 10, - orderBy: { - field: 'lastname', - direction: 'asc', - }, - filter: "firstname eq 'Cat'", - }, -}); -``` - -#### sample update expression - -```js -updateEntity({ - entityName: 'accounts', - entityId: 'f4301865-c64a-e711-80f3-e0071b6fd061', - body: { - name: 'wilder 2', - creditonhold: true, - address1_latitude: 47.639583, - description: 'This is the description of the sample account', - revenue: 5000000, - accountcategorycode: 1, - }, -}); -``` - -#### sample delete expression - -```js -deleteEntity({ - entityName: 'accounts', - entityId: 'aeef941b-254a-e711-80f1-e0071b685921', -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/dynamics/index.md b/docs/dynamics/index.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/docs/facebook/CHANGELOG.md b/docs/facebook/CHANGELOG.md deleted file mode 100644 index 41f421098..000000000 --- a/docs/facebook/CHANGELOG.md +++ /dev/null @@ -1,63 +0,0 @@ -# @openfn/language-facebook - -## 0.3.2 - -### Patch Changes - -- aad9549: Ensure that standard OAuth2 credentials with snake-cased - "access_token" keys can be used for OAuth2-reliant adaptors -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 0.3.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.3.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.2.3 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.2.2 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.2.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.2.0 - -### Minor Changes - -- f7669d2: migrate facebook diff --git a/docs/facebook/README.md b/docs/facebook/README.md deleted file mode 100644 index c82bb8344..000000000 --- a/docs/facebook/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Language Facebook - -Language Pack for building expressions and operations to interact with the -Facebook Messenger API. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/facebook-configuration-schema/) -definition. - -### postMessage - -#### sample expression using operation - -```js -postMessage({ - recipient: { - id: '', - }, - message: { - text: '', - }, -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/facebook/index.md b/docs/facebook/index.md deleted file mode 100644 index 0295a0b5b..000000000 --- a/docs/facebook/index.md +++ /dev/null @@ -1,26 +0,0 @@ -## postMessage - -postMessage(params) ⇒ Operation -Post a message - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data to make the fetch | - -**Example** -```js -postMessage({ - "recipient": { - "id": "your-psid" - }, - "message": { - "text": "your-message" - } -}) -``` - -* * * - diff --git a/docs/fhir/CHANGELOG.md b/docs/fhir/CHANGELOG.md deleted file mode 100644 index 0c0bb4440..000000000 --- a/docs/fhir/CHANGELOG.md +++ /dev/null @@ -1,97 +0,0 @@ -# @openfn/language-fhir - -## 3.1.0 - -### Minor Changes - -- d94e9ee: Migrate from axios to using `fetch` from `undici` and add uniti tests - -## 3.0.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 3.0.0 - -### Major Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 2.0.0 - -### Major Changes - -- d4b4094: - Update configuration schema, - - Add `get()` function - - Fix `create()` axios config - - Remove unused code - - Improve error handling - - Improve response handling - -## 1.1.5 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 1.1.4 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 1.1.3 - -### Patch Changes - -- f2aed32: add examples - -## 1.1.2 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 1.1.1 - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 1.1.0 - -### Minor Changes - -- fee607e: Migrate FHIR, update package export - -### Patch Changes - -- cb5d0ed: Updated to @openfn/simple-ast v0.4.1 -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 diff --git a/docs/fhir/README.md b/docs/fhir/README.md deleted file mode 100644 index 7ab2b7592..000000000 --- a/docs/fhir/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# language-fhir - -An OpenFn **_adaptor_** for building integration jobs for use with the HAPI FHIR -API. - -## FHIR Documentation - -The Restfull API can be seen here: https://www.hl7.org/fhir/http.html - -## Documentation - - - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/fhir-configuration-schema/) -definition. - -#### Creates a resource in a destination system using a POST request - -```js -create('/endpoint', { foo: 'bar' }); -``` - -#### Creates a transactionBundle for HAPI FHIR - -```js -createTransactionBundle({ - entry: [transactionBundle], -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/fhir/index.md b/docs/fhir/index.md deleted file mode 100644 index bf09e55f1..000000000 --- a/docs/fhir/index.md +++ /dev/null @@ -1,138 +0,0 @@ -## Functions - -
-
- create(path, params, callback)
-
- createTransactionBundle(params, callback)
-
- get(path, query, callback)
-
- getClaim(claimId, query, callback)
-
- - -## create - -create(path, params, callback) ⇒ Operation -Creates a resource in a destination system using a POST request - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | string | Path to resource | -| params | object | data to create the new resource | -| callback | function | (Optional) callback function | - -**Example** -```js -create("Bundle", {...state.data: type: "collection"}) -``` - -* * * - -## createTransactionBundle - -createTransactionBundle(params, callback) ⇒ Operation -Creates a transactionBundle for HAPI FHIR - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data to create the new transaction | -| callback | function | (Optional) callback function | - -**Example** -```js -createTransactionBundle({ - resourceType: "Bundle", - type: "transaction", - entry: [ - { - fullUrl: "https://hapi.fhir.org/baseR4/Patient/592442", - resource: { - resourceType: "Patient", - id: "592442", - name: [{ given: "Caleb", family: "Cushing" }], - }, - request: { - method: "POST", - url: "Patient", - }, - }, - ], -}); -``` - -* * * - -## get - -get(path, query, callback) ⇒ Operation -Get a resource in a FHIR system - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | string | Path to resource | -| query | object | data to get the new resource | -| callback | function | (Optional) callback function | - -**Example** *(Get Claim from FHIR with optional query)* -```js -get("Claim", { _include: "Claim:patient", _sort: "-_lastUpdated", _count: 200 }) -``` -**Example** *(Get Patient from FHIR)* -```js -get('Patient'); -``` - -* * * - -## getClaim - -getClaim(claimId, query, callback) ⇒ Operation -Get Claim in a FHIR system - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| claimId | string | (optional) claim id | -| query | object | (optinal) query parameters | -| callback | function | (Optional) callback function | - -**Example** -```js -getClaim({ _include: "Claim:patient", _sort: "-_lastUpdated", _count: 200 }); -``` - -* * * - -## request - -request ⇒ -This is an asynchronous function that sends a request to a specified URL with optional parameters -and headers, and returns the response data in JSON format. - -**Kind**: global constant -**Returns**: The `request` function is returning the parsed JSON data from the response of the HTTP -request made to the specified `url` with the given `params` and `method`. If there is an error in -the response, the function will throw an error. - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| url | string | | The URL of the API endpoint that the request is being made to. | -| [params] | object | | An object containing any additional parameters to be sent with the request, such as query parameters or request body data. It is an optional parameter and defaults to an empty object if not provided. | -| [method] | string | "GET" | The HTTP method to be used for the request. It defaults to 'GET' if not specified. | - - -* * * - diff --git a/docs/godata/CHANGELOG.md b/docs/godata/CHANGELOG.md deleted file mode 100644 index 724d6e886..000000000 --- a/docs/godata/CHANGELOG.md +++ /dev/null @@ -1,73 +0,0 @@ -# @openfn/language-godata - -## 3.4.0 - -### Minor Changes - -- df4cfca: Switch from `'writeOnly: true'` to `'format: email'` in the godata - configuration schema. - -## 3.3.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 3.3.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 3.2.4 - -### Patch Changes - -- ef828e7: update old urls in readme -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 3.2.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 3.2.2 - -### Patch Changes - -- f2aed32: add examples - -## 3.2.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 3.2.0 - -### Minor Changes - -- 8e7a79e: Migrate Godata - -### Patch Changes - -- cbb8968: Fix axios Inefficient Regular Expression Complexity vulnerability -- e81561f: Updated ast and package.json diff --git a/docs/godata/README.md b/docs/godata/README.md deleted file mode 100644 index 6038eae63..000000000 --- a/docs/godata/README.md +++ /dev/null @@ -1,262 +0,0 @@ -# language-godata - -An OpenFn **_adaptor_** for building integration jobs for use with the WHO -Go.Data API. - -[Go.Data](https://www.who.int/godata) is an outbreak investigation tool for -field data collection during public health emergencies. The tool includes -functionality for case investigation, contact follow-up, visualization of chains -of transmission including secure data exchange and is designed for flexibility -in the field, to adapt to the wide range of outbreak scenarios. - -## Documentation - -View the [docs site](https://docs.openfn.org/adaptors/packages/godata-docs) for -full technical documentation. - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/godata-configuration-schema/) -definition. - -## Helper Functions - -### post(...) - -## Fetch the list of outbreaks - -This function is used to fetch the whole list of outbreaks in Go.Data. - -```js -listOutbreaks(state => { - console.log(state.data); - return state; -}); -``` - -## Get a specific outbreak - -This function can be used to fetch one specific outbreak. A filtering mechanism -is used to specify a criteria to match. Mutliple outbreaks could be returned if -matched by the filter. - -```js -getOutbreak({ where: { name: 'Outbreak demo' } }, state => { - console.log(state.data); - return state; -}); -``` - -## Insert or Update an outbreak using a unique id as a key - -This function is used to either update a record in Go.Data if matched or insert -a new one if no record matched the unique id. - -```js -upsertOutbreak({ - externalId: '3dec33-ede3', - data: { - name: 'string', - description: 'string', - disease: 'string', - countries: [ - { - id: 'SENEGAL', - }, - ], - startDate: '2020-12-17T14:54:19.498Z', - endDate: '2020-12-17T14:54:19.498Z', - longPeriodsBetweenCaseOnset: 0, - periodOfFollowup: 0, - }, -}); -``` - -## Fetch the list of cases - -This function is used to fetch the whole list of cases for a specific outbreak -in Go.Data. - -```js -listCases('4c444f7-4e11-41d0-c1af-331dd15a892e', state => { - console.log(state); - return state; -}); -``` - -## Get a specific case - -This function can be used to fetch one specific case for an outbreak. A -filtering mechanism can specify a criteria to match. Mutliple cases could be -returned if matched by the filter. - -```js -getCase( - '4c444f7-4e11-41d0-c1af-331dd15a892e', - { 'where.relationship': { active: true }, where: { firstName: 'Luca' } }, - state => { - console.log(state); - return state; - } -); -``` - -## Insert or Update a case using a unique id as a key - -This function is used to either update a case in Go.Data if matched or insert a -new one if no record matched the unique id. - -```js -upsertCase('4dce-3eedce3-rd33', 'visualId', - data: state => { - const patient = state.data.body; - return { - firstName: patient.Patient_name.split(' ')[0], - lastName: patient.Patient_name.split(' ')[1], - visualId: patient.Case_ID, - 'age:years': patient.Age_in_year, - gender: patient.Sex, - }; - }); -``` - -## Fetch the list of contacts - -This function is used to fetch the whole list of contacts for a specific -outbreak in Go.Data. - -```js -listContacts('4c444f7-4e11-41d0-c1af-331dd15a892e', state => { - console.log(state); - return state; -}); -``` - -## Get a specific contact - -This function can be used to get one specific contact for an outbreak. A -filtering mechanism can specify a criteria to match. Mutliple contacts could be -returned if matched by the filter. - -```js -getContact('343d-dc3e', { where: { firstName: 'Luca' } }, state => { - console.log(state.data); - return state; -}); -``` - -## Insert or Update a contact using a unique id as a key - -This function is used to either update a contact in Go.Data if matched or insert -a new one if no record matched the unique id. - -```js -upsertContact('4dce-3eedce3-rd33', 'visualId', { - firstName: 'Luca', - gender: 'male', - 'age:years': '20', -}); -``` - -## Fetch the list of locations - -This function is used to fetch the list of locations. - -```js -listLocations(state => { - console.log(state); - return state; -}); -``` - -## Get a specific location - -This function can be used to get one specific location. A filtering mechanism -can specify a criteria to match. Mutliple locations could be returned if matched -by the filter. - -```js -getLocation({ where: { name: '30 DE MAYO' } }, state => { - console.log(state.data); - return state; -}); -``` - -## Insert or Update a location using a unique id as a key - -This function is used to either update a location if matched or insert a new. A -custom `externalId` can be provided. - -```js -upsertLocation('name', { - name: '30 DE DECIEMBRE', - synonyms: [], - identifiers: [], - active: true, - populationDensity: 0, - geoLocation: { - lat: -45.343244, - lng: -67.193873, - }, -}); -``` - -## Fetch the list of reference data - -This function is used to fetch the list of reference data. - -```js -listReferenceData(state => { - console.log(state); - return state; -}); -``` - -## Get a specific reference data - -This function can be used to get one specific reference data. A filtering -mechanism can specify a criteria to match. - -```js -getReferenceData( - { where: { categoryId: 'LNG_REFERENCE_DATA_CATEGORY_CENTRE_NAME' } }, - state => { - console.log(state.data); - return state; - } -); -``` - -## Insert or Update a reference data using a unique id as a key - -This function is used to either update a location if matched or insert a new. A -custom `externalId` can be provided. - -```js -upsertReferenceData('id', { - categoryId: 'CATEGORY', - value: 'VALUE', - readOnly: false, - active: true, - id: 'ID', - createdAt: '2020-10-01T18:48:31.784Z', - createdBy: '95d31ea9', - updatedAt: '2020-10-01T18:48:31.784Z', - updatedBy: '95d31ea9', - createdOn: 'API', - deleted: false, -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/godata/index.md b/docs/godata/index.md deleted file mode 100644 index 29bd9ff20..000000000 --- a/docs/godata/index.md +++ /dev/null @@ -1,393 +0,0 @@ -## Functions - -
-
- getCase(id, query, callback)
-
- getContact(id, query, callback)
-
- getLocation(query, callback)
-
- getOutbreak(query, callback)
-
- getReferenceData(query, callback)
-
- listCases(id, callback)
-
- listContacts(id, callback)
-
- listLocations(callback)
-
- listOutbreaks(callback)
-
- listReferenceData(callback)
-
- upsertCase(id, externalId, goDataCase, callback)
-
- upsertContact(id, externalId, goDataContact, callback)
-
- upsertLocation(externalId, goDataLocation, callback)
-
- upsertOutbreak(outbreak, callback)
-
- upsertReferenceData(externalId, goDataReferenceData, callback)
-
- - -## getCase - -getCase(id, query, callback) ⇒ Operation -Get one or multiple cases within an outbreak from a query filter - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| id | string | Outbreak id | -| query | object | An object with a query filter parameter | -| callback | function | (Optional) Callback function | - -**Example** -```js -getCase( - '3b55-cdf4', - { 'where.relationship': { active: true }, where: { firstName: 'Luca'} }, - state => { - console.log(state); - return state; - } -); -``` - -* * * - -## getContact - -getContact(id, query, callback) ⇒ Operation -Get one or multiple contacts within an outbreak from a query filter - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| id | string | Outbreak id | -| query | object | An object with a query filter parameter | -| callback | function | (Optional) Callback function | - -**Example** -```js -getContact("343d-dc3e", {"where":{"firstName": "Luca"}}, state => { - console.log(state.data); - return state; - }); -``` - -* * * - -## getLocation - -getLocation(query, callback) ⇒ Operation -Get one or multiple locations from a query filter - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| query | object | An object with a query filter parameter | -| callback | function | (Optional) Callback function | - -**Example** -```js -getLocation({"where":{"name": "30 DE OCTUBRE"}}, state => { - console.log(state.data); - return state; - }); -``` - -* * * - -## getOutbreak - -getOutbreak(query, callback) ⇒ Operation -Get one or multiple outbreaks from a query filter - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| query | object | An object with a query filter parameter | -| callback | function | (Optional) Callback function | - -**Example** -```js -getOutbreak({"where":{"name": "Outbreak demo"}}, state => { - console.log(state.data); - return state; - }); -``` - -* * * - -## getReferenceData - -getReferenceData(query, callback) ⇒ Operation -Get one or multiple reference data from a query filter - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| query | object | An object with a query filter parameter | -| callback | function | (Optional) Callback function | - -**Example** -```js -getReferenceData({"where":{"categoryId": "LNG_REFERENCE_DATA_CATEGORY_CENTRE_NAME"}}, state => { - console.log(state.data); - return state; - }); -``` - -* * * - -## listCases - -listCases(id, callback) ⇒ Operation -Fetch the list of cases within a particular outbreak using its ID. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| id | string | Outbreak id | -| callback | function | (Optional) Callback function | - -**Example** -```js -listCases("343d-dc3e", state => { - console.log(state); - return state; - }); -``` - -* * * - -## listContacts - -listContacts(id, callback) ⇒ Operation -Fetch the list of contacts within a particular outbreak using its ID. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| id | string | Outbreak id | -| callback | function | (Optional) Callback function | - -**Example** -```js -listContacts("343d-dc3e", // Outbreak Id - state => { - console.log(state); - return state; - }); -``` - -* * * - -## listLocations - -listLocations(callback) ⇒ Operation -Fetch the list of locations - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| callback | function | (Optional) Callback function | - -**Example** -```js -listLocations(state => { - console.log(state.data); - return state; - }); -``` - -* * * - -## listOutbreaks - -listOutbreaks(callback) ⇒ Operation -Fetch the list of outbreaks - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| callback | function | (Optional) Callback function | - -**Example** -```js -listOutbreaks(state => { - console.log(state.data); - return state; - }); -``` - -* * * - -## listReferenceData - -listReferenceData(callback) ⇒ Operation -Fetch the list of reference data - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| callback | function | (Optional) Callback function | - -**Example** -```js -listReferenceData(state => { - console.log(state.data); - return state; - }); -``` - -* * * - -## upsertCase - -upsertCase(id, externalId, goDataCase, callback) ⇒ Operation -Upsert case to godata using an external id to mach a specific record - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| id | string | Outbreak id | -| externalId | string | External Id to match | -| goDataCase | object | an object with some case data. | -| callback | function | (Optional) Callback function | - -**Example** -```js -upsertCase("4dce-3eedce3-rd33", 'visualId', - data: state => { - const patient = state.data.body; - return { - firstName: patient.Patient_name.split(' ')[0], - lastName: patient.Patient_name.split(' ')[1], - visualId: patient.Case_ID, - 'age:years': patient.Age_in_year, - gender: patient.Sex, - }; - }) -``` - -* * * - -## upsertContact - -upsertContact(id, externalId, goDataContact, callback) ⇒ Operation -Upsert contact to godata using an external id to match a specific record. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| id | string | Outbreak id | -| externalId | string | External Id to match | -| goDataContact | object | an object with some case data. | -| callback | function | (Optional) Callback function | - -**Example** -```js -upsertContact("4dce-3eedce3-rd33", 'visualId', - { - firstName: 'Luca', - gender: 'male', - 'age:years': '20' - ... - } - ) -``` - -* * * - -## upsertLocation - -upsertLocation(externalId, goDataLocation, callback) ⇒ Operation -Upsert location to godata - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| externalId | string | External Id to match | -| goDataLocation | object | an object with some location data. | -| callback | function | (Optional) Callback function | - -**Example** -```js -upsertLocation('name', {...}) -``` - -* * * - -## upsertOutbreak - -upsertOutbreak(outbreak, callback) ⇒ Operation -Upsert outbreak to godata - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| outbreak | object | an object with an externalId and some outbreak data. | -| callback | function | (Optional) Callback function | - -**Example** -```js -upsertOutbreak({externalId: "3dec33-ede3", data: {...}}) -``` - -* * * - -## upsertReferenceData - -upsertReferenceData(externalId, goDataReferenceData, callback) ⇒ Operation -Upsert reference data to godata - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| externalId | string | External Id to match | -| goDataReferenceData | object | an object with some reference data. | -| callback | function | (Optional) Callback function | - -**Example** -```js -upsertReferenceData('id', {...}) -``` - -* * * - diff --git a/docs/googlehealthcare/CHANGELOG.md b/docs/googlehealthcare/CHANGELOG.md deleted file mode 100644 index f781801c3..000000000 --- a/docs/googlehealthcare/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -# @openfn/language-googlehealthcare - -## 1.0.0 - -### Major Changes - -- 7df7e20: remove `projectId`, `dataSetId`, `cloudRegion`, and `fhirStoreId` out - of configuration - - The new implementation of `createFhirResource(fhirStore, resource, callback)` - allows you to use one set of credentials to access different Google Healthcare - Cloud FHIR stores. `fhirStore` is an object that contains the FHIR store - information - (`{cloudRegion: string, projectId: string, datasetId: string, fhirStoreId: string}`). - -## 0.1.0 - -### Minor Changes - -- 861d774: add createFhirResource function - -### Patch Changes - -- aad9549: Ensure that standard OAuth2 credentials with snake-cased - "access_token" keys can be used for OAuth2-reliant adaptors -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 diff --git a/docs/googlehealthcare/README.md b/docs/googlehealthcare/README.md deleted file mode 100644 index 27a46561f..000000000 --- a/docs/googlehealthcare/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# language-googlehealthcare - -An OpenFn **_adaptor_** for building integration jobs for use with the -[Google Cloud Healthcare API](https://cloud.google.com/healthcare-api/docs/how-tos/fhir-resources#healthcare-create-patient-nodejs). - -## Documentation - -View the -[docs site](https://docs.openfn.org/adaptors/packages/googlehealthcare-docs) for -full technical documentation. - -### Configuration - -View the -[configuration-schema](https://docs.openfn.org/adaptors/packages/googlehealthcare-configuration-schema/) -for required and optional `configuration` properties. - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -"Getting Started" guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To build _only_ the docs run `pnpm build docs`. diff --git a/docs/googlehealthcare/index.md b/docs/googlehealthcare/index.md deleted file mode 100644 index eb69e7c1b..000000000 --- a/docs/googlehealthcare/index.md +++ /dev/null @@ -1,62 +0,0 @@ -## createFhirResource - -createFhirResource([fhirStore], resource, callback) ⇒ Operation -Create some resource in Google Cloud Healthcare - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| [fhirStore] | Object | The FHIR store information. - `cloudRegion` (string): The cloud region where the FHIR store is located. - `projectId` (string): The ID of the project that contains the FHIR store. - `datasetId` (string): The ID of the dataset that contains the FHIR store. - `fhirStoreId` (string): The ID of the FHIR store. | -| resource | object | The FHIR resource data to be created | -| callback | function | An optional callback function | - -**Example** -```js -createFhirResource( - { - cloudRegion: "us-central1", - projectId: "adjective-noun-123", - datasetId: "my-dataset", - fhirStoreId: "my-fhir-store", - }, - { - resourceType: "Patient", - name: [{ use: "official", family: "Smith", given: ["Darcy"] }], - gender: "female", - birthDate: "1970-01-01", - } -); -``` -**Example** -```js -createFhirResource( - { - cloudRegion: "us-central1", - projectId: "adjective-noun-123", - datasetId: "my-dataset", - fhirStoreId: "my-fhir-store", - }, - (state) => ({ - resourceType: "Encounter", - status: "finished", - class: { - system: "http://hl7.org/fhir/v3/ActCode", - code: "IMP", - display: "inpatient encounter", - }, - reasonCode: [ - { - text: "The patient had an abnormal heart rate. She was concerned about this.", - }, - ], - subject: { - reference: `Patient/${state.data.id}`, - }, - }) -); -``` - -* * * - diff --git a/docs/googlesheets/CHANGELOG.md b/docs/googlesheets/CHANGELOG.md deleted file mode 100644 index c6ab58c70..000000000 --- a/docs/googlesheets/CHANGELOG.md +++ /dev/null @@ -1,91 +0,0 @@ -# @openfn/language-googlesheets - -## 2.2.2 - -### Patch Changes - -- aad9549: Ensure that standard OAuth2 credentials with snake-cased - "access_token" keys can be used for OAuth2-reliant adaptors -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 2.2.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 2.2.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 2.1.6 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 2.1.5 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 2.1.4 - -### Patch Changes - -- f2aed32: add examples - -## 2.1.3 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 2.1.2 - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 2.1.1 - -### Patch Changes - -- 9a2755e: Update dependency on language-common -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 - -## 2.1.0 - -### Minor Changes - -- 9e7d458: Migrate googlesheets diff --git a/docs/googlesheets/README.md b/docs/googlesheets/README.md deleted file mode 100644 index 67ed1db1c..000000000 --- a/docs/googlesheets/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Language Google Sheets - -Language Pack for building expressions and operations to make Google Sheets API -calls. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/googlesheets-configuration-schema/) -definition. - -### appendValues() - -Add rows to an existing sheet: -`https://sheets.googleapis.com/v4/spreadsheets/spreadsheetId/values/Sheet1!A1:E1:append?valueInputOption=USER_ENTERED` - -```js -appendValues({ - spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos', - range: 'Sheet1!A1:E1', - values: [ - ['From expression', '$15', '2', '3/15/2016'], - ['Really now!', '$100', '1', '3/20/2016'], - ], -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/googlesheets/index.md b/docs/googlesheets/index.md deleted file mode 100644 index 3197ec687..000000000 --- a/docs/googlesheets/index.md +++ /dev/null @@ -1,27 +0,0 @@ -## appendValues - -appendValues(params) ⇒ Operation -Add an array of rows to the spreadsheet. -https://developers.google.com/sheets/api/samples/writing#append_values - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | Object | Data object to add to the spreadsheet. | - -**Example** -```js -appendValues({ - spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos', - range: 'Sheet1!A1:E1', - values: [ - ['From expression', '$15', '2', '3/15/2016'], - ['Really now!', '$100', '1', '3/20/2016'], - ], -}) -``` - -* * * - diff --git a/docs/hive/CHANGELOG.md b/docs/hive/CHANGELOG.md deleted file mode 100644 index 06f825d24..000000000 --- a/docs/hive/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -# @openfn/language-hive - -## 0.2.0 - -### Minor Changes - -- a380347: Add query function diff --git a/docs/hive/README.md b/docs/hive/README.md deleted file mode 100644 index d587e5dff..000000000 --- a/docs/hive/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# language-hive - -An OpenFn **_adaptor_** for building integration jobs for use with the HIVE API. - -## Documentation - -View the [docs site](https://docs.openfn.org/adaptors/packages/hive-docs) for -full technical documentation. - -### Configuration - -View the -[configuration-schema](https://docs.openfn.org/adaptors/packages/hive-configuration-schema/) -for required and optional `configuration` properties. - -### A example expression using the `query` function - -```js -query('select count(*) from patient'); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -"Getting Started" guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To build _only_ the docs run `pnpm build docs`. diff --git a/docs/hive/index.md b/docs/hive/index.md deleted file mode 100644 index c33cf302a..000000000 --- a/docs/hive/index.md +++ /dev/null @@ -1,21 +0,0 @@ -## query - -query(qs, options, callback) ⇒ Operation -Execute an SQL statement - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| qs | string | SQL statement | -| options | object | (Optional) options for executing sql statement | -| callback | function | An optional callback function | - -**Example** *(Get patient count from hive database)* -```js -query("select count(*) from patient"); -``` - -* * * - diff --git a/docs/http/CHANGELOG.md b/docs/http/CHANGELOG.md deleted file mode 100644 index e0c528675..000000000 --- a/docs/http/CHANGELOG.md +++ /dev/null @@ -1,202 +0,0 @@ -# @openfn/language-http - -## 6.0.0 - -### Major Changes - -- f741086: The axios library has been removed and the operation API simplified. - - ### New features - - - Error mapping. Provide custom errors to response status codes, eg, Eg: - `{errors: {404: "You don't have access"}}` - - parseAs option. Overrides the default response type. Eg: `{parseAs: "json"}` - - Request logging. All requests are now logged to stdout. - - tls options. Pass SSL certificates using the `tls` option on any request. - - ### Breaking changes - - - Removed `axios` export - - Axios options on `get`, `post`, `put`, `patch`, and `del` are no longer - supported (unless otherwise stated). This includes `gzip`,`qs`, `formData`, - `successCodes` and `keepCookie` - - Option params `json` and `agentOptions` have been deprecated. They still - work, but you should use `body` and `tls` instead (the behaviour should be - the same) - -### Patch Changes - -- Updated dependencies [7f52699] - - @openfn/language-common@1.12.0 - -## 5.1.1 - -### Patch Changes - -- a8d655e: Update `parseXML` to use `expandReferences` - -## 5.1.0 - -### Minor Changes - -- 8e2b79c: Clean up `state.response.request` by returning only - `{ method, path, host, protocol, _headers }` - -## 5.0.4 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 5.0.3 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 5.0.2 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 5.0.1 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 5.0.0 - -### Major Changes - -- 0b6f20b: use parseCsv from common - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 4.3.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 4.3.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 4.3.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 4.3.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 4.2.8 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 4.2.7 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 4.2.6 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 4.2.5 - -### Patch Changes - -- f2aed32: add examples - -## 4.2.4 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 4.2.3 - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 4.2.2 - -### Patch Changes - -- 9a2755e: Update dependency on language-common -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 - -## 4.2.1 - -### Patch Changes - -- e04aa28: Rename credential-schema to configuration-schema, update descriptions - -## 4.2.0 - -### Minor Changes - -- f670bf8: Added credential schema to enable new ui - -## 4.1.0 - -### Minor Changes - -- 8e1b86d: update http to new format - -## 4.0.1 - -### Patch Changes - -- 4671e89: Migrate language-http diff --git a/docs/http/README.md b/docs/http/README.md deleted file mode 100644 index 2e840324c..000000000 --- a/docs/http/README.md +++ /dev/null @@ -1,138 +0,0 @@ -# Language HTTP - -Language Pack for building expressions and operations to make HTTP calls. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/http-configuration-schema/) -definition. - -### Get data - -This helper function allows the use of a get method to fetch data. You can -specify a query string for filter. - -```js -get( - '/myendpoint', - { - query: { foo: 'bar', a: 1 }, - headers: { 'content-type': 'application/json' }, - authentication: { username: 'taylor', password: 'somethingsecret' }, - }, - state => { - return state; - } -); -``` - -### Post existing data - -Send some data to an existing endpoint. - -```js -post('/endpoint', { - body: state => { - return { - field_1: 'some_data', - field_2: 'some_more_data', - field_id: dataValue('Some.Json.Object.Id')(state), - }; - }, - headers: { - Authorization: 'AUTH_KEY', - 'Content-Type': 'application/json', - }, -}); -``` - -### Update existing data with PUT or PATCH - -```js -put( - '/myendpoint', - { - body: { firstname: 'taylor', lastname: 'downs' }, - headers: { 'content-type': 'application/json' }, - authentication: { username: 'user', password: 'pass' }, - }, - state => { - return state; - } -); -``` - -```js -patch( - '/myendpoint', - { - body: { firstname: 'taylor', lastname: 'downs' }, - headers: { 'content-type': 'application/json' }, - authentication: { username: 'user', password: 'pass' }, - }, - state => { - return state; - } -); -``` - -### Delete data - -```js -del( - '/myendpoint', - { - query: { id: 'someId' }, - headers: { 'content-type': 'application/json' }, - authentication: { username: 'user', password: 'pass' }, - }, - state => { - return state; - } -); -``` - -### Parse XML - -This function allows you to parse some xml data. A callback function can be use -to store in a table. - -```js -parseXML(body, function ($) { - return $('table[class=your_table]').parsetable(true, true, true); -}); -``` - -### Parse CSV - -```js -parseCSV('someData.csv', { - quoteChar: '"', - header: false, -}); -``` - -### Sample parse local CSV file - -```js -parseCSV('PatientsJan2009.csv', { - quoteChar: '"', - header: false, - columns: true, - skip_empty_lines: true, - trim: true, - bom: true, -}); -``` - -## Development - -Clone the repo, run `pnpm install`. - -Run tests using `pnpm run test` or `pnpm run test:watch`. - -To build the docs for this repo, run `pnpm build:docs`. diff --git a/docs/http/index.md b/docs/http/index.md deleted file mode 100644 index 1446a686e..000000000 --- a/docs/http/index.md +++ /dev/null @@ -1,207 +0,0 @@ -## Functions - -
-
- del(path, params, callback)
-
- get(path, params, callback)
-
- parseXML(body, script)
-
- patch(path, params, callback)
-
- post(path, params, callback)
-
- put(path, params, callback)
-
- request(method, path, params, callback)
-
- - -## del - -del(path, params, callback) ⇒ Operation -Make a DELETE request - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | string | Path to resource | -| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Auth parameters | -| callback | function | (Optional) Callback function | - -**Example** -```js -del(`/myendpoint/${state => state.data.id}`, { - headers: {'content-type': 'application/json'} - }) -``` - -* * * - -## get - -get(path, params, callback) ⇒ Operation -Make a GET request - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | string | Path to resource | -| params | [RequestOptions](#RequestOptions) | Query, Headers and Authentication parameters | -| callback | function | (Optional) Callback function | - -**Example** -```js -get('/myEndpoint', { - query: {foo: 'bar', a: 1}, - headers: {'content-type': 'application/json'}, -}) -``` - -* * * - -## parseXML - -parseXML(body, script) ⇒ Operation -Parse XML with the Cheerio parser - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| body | String | data string to be parsed | -| script | function | script for extracting data | - -**Example** -```js -parseXML(body, function($){ - return $("table[class=your_table]").parsetable(true, true, true); - }) -``` - -* * * - -## patch - -patch(path, params, callback) ⇒ Operation -Make a PATCH request - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | string | Path to resource | -| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Auth parameters | -| callback | function | (Optional) Callback function | - -**Example** -```js -patch('/myEndpoint', { - body: {'foo': 'bar'}, - headers: {'content-type': 'application/json'}, - }) -``` - -* * * - -## post - -post(path, params, callback) ⇒ operation -Make a POST request - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | string | Path to resource | -| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Authentication parameters | -| callback | function | (Optional) Callback function | - -**Example** -```js -post('/myEndpoint', { - body: {'foo': 'bar'}, - headers: {'content-type': 'application/json'}, - }) -``` - -* * * - -## put - -put(path, params, callback) ⇒ Operation -Make a PUT request - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | string | Path to resource | -| params | [RequestOptions](#RequestOptions) | Body, Query, Headers and Auth parameters | -| callback | function | (Optional) Callback function | - -**Example** -```js -put('/myEndpoint', { - body: {'foo': 'bar'}, - headers: {'content-type': 'application/json'}, - }) -``` - -* * * - -## request - -request(method, path, params, callback) ⇒ Operation -Make a HTTP request - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| method | string | The HTTP method to use | -| path | string | Path to resource | -| params | [RequestOptions](#RequestOptions) | Query, Headers and Authentication parameters | -| callback | function | (Optional) Callback function | - -**Example** -```js -get('/myEndpoint', { - query: {foo: 'bar', a: 1}, - headers: {'content-type': 'application/json'}, -}) -``` - -* * * - -## RequestOptions - -RequestOptions : Object -Options provided to the HTTP request - -**Kind**: global typedef -**Properties** - -| Name | Type | Description | -| --- | --- | --- | -| body | object \| string | body data to append to the request | -| errors | object | Map of errorCodes -> error messages, ie, `{ 404: 'Resource not found;' }`. Use a falsy message value to suppress errors for thiscode. | -| query | object | an object of query parameters. Will be encoded into the URL. | -| headers | object | an object of headers to append to the request | -| parseAs | string | parse the response body as json, text or stream. By default will use the response headers. | -| timeout | number | Request timeout in ms. Default: 300 seconds. | -| tls | object | TLS/SSL authentication options. See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions | - - -* * * - diff --git a/docs/khanacademy/CHANGELOG.md b/docs/khanacademy/CHANGELOG.md deleted file mode 100644 index 7848aeb79..000000000 --- a/docs/khanacademy/CHANGELOG.md +++ /dev/null @@ -1,60 +0,0 @@ -# @openfn/language-khanacademy - -## 0.4.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.4.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.3.4 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.3.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.3.2 - -### Patch Changes - -- f2aed32: add examples - -## 0.3.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.3.0 - -### Minor Changes - -- 9137655: migrate khanacademy diff --git a/docs/khanacademy/README.md b/docs/khanacademy/README.md deleted file mode 100644 index 0f2587a86..000000000 --- a/docs/khanacademy/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Language KhanAcademy - -Language Pack for building expressions and operations to make HTTP calls. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/khanacademy-configuration-schema/) -definition. - -## fetch - -#### sample usage - -```js -fetch({ - getEndpoint: 'user', - queryParams: { - email: 'thisoneuser@something.org', - }, - postUrl: 'https://www.openfn.org/inbox/your-uuid', -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/khanacademy/index.md b/docs/khanacademy/index.md deleted file mode 100644 index d456db21d..000000000 --- a/docs/khanacademy/index.md +++ /dev/null @@ -1,20 +0,0 @@ -## fetch - -fetch(params) ⇒ Operation -Fetch data from the Khan Academy API - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data to make the query | - -**Example** -```js -execute( - fetch(params) -)(state) -``` - -* * * - diff --git a/docs/kobotoolbox/CHANGELOG.md b/docs/kobotoolbox/CHANGELOG.md deleted file mode 100644 index 776e7c515..000000000 --- a/docs/kobotoolbox/CHANGELOG.md +++ /dev/null @@ -1,95 +0,0 @@ -# @openfn/language-kobotoolbox - -## 2.1.0 - -### Minor Changes - -- c85abf3: Removed the API version enum values in the credential configuration - json schema and added a placeholder - -## 2.0.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 2.0.0 - -### Major Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 1.3.3 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 1.3.2 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 1.3.1 - -### Patch Changes - -- f2aed32: add examples - -## 1.3.0 - -### Minor Changes - -- e48c30c: add getDeploymentInfo function - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 1.2.0 - -### Minor Changes - -- 7b5ca3e: add fn and fix adaptors export - -### Patch Changes - -- 4067c28: build ast file -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 1.1.0 - -### Minor Changes - -- 7fc47d8: Migrate kobotoolbox - -### Patch Changes - -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 diff --git a/docs/kobotoolbox/README.md b/docs/kobotoolbox/README.md deleted file mode 100644 index 9211248b5..000000000 --- a/docs/kobotoolbox/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Language KoboToolbox - -Language Pack for building expressions and operations to interact with the -[TEMPLATE] API. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/kobotoolbox-configuration-schema/) -definition. - -#### Get the list of forms - -```js -getForms({}, state => { - console.log(state.data); - return state; -}); -``` - -### Get submissions for a specific form - -A query can be used to filter results. - -```js -getSubmissions( - { formId: 'aXecHjmbATuF6iGFmvBLBX', query: { end: { $gte: '2020-11-20' } } }, - state => { - console.log(state.data); - return state; - } -); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/kobotoolbox/index.md b/docs/kobotoolbox/index.md deleted file mode 100644 index 74c80d391..000000000 --- a/docs/kobotoolbox/index.md +++ /dev/null @@ -1,79 +0,0 @@ -## Functions - -
-
- getDeploymentInfo(params, callback)
-
- getForms(params, callback)
-
- getSubmissions(params, callback)
-
- - -## getDeploymentInfo - -getDeploymentInfo(params, callback) ⇒ Operation -Get deployment information for a specific form - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | Form Id and data to make the fetch or filter | -| callback | function | (Optional) Callback function to execute after fetching form deployment information | - -**Example** -```js -getDeploymentInfo({formId: 'aXecHjmbATuF6iGFmvBLBX'}, state => { - console.log(state.data); - return state; -}); -``` - -* * * - -## getForms - -getForms(params, callback) ⇒ Operation -Make a request to get the list of forms - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | Query, Headers and Authentication parameters | -| callback | function | (Optional) Callback function to execute after fetching form list | - -**Example** -```js -getForms({}, state => { - console.log(state.data); - return state; -}); -``` - -* * * - -## getSubmissions - -getSubmissions(params, callback) ⇒ Operation -Get submissions for a specific form - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | Form Id and data to make the fetch or filter | -| callback | function | (Optional) Callback function to execute after fetching form submissions | - -**Example** -```js -getSubmissions({formId: 'aXecHjmbATuF6iGFmvBLBX'}, state => { - console.log(state.data); - return state; -}); -``` - -* * * - diff --git a/docs/magpi/CHANGELOG.md b/docs/magpi/CHANGELOG.md deleted file mode 100644 index 0f7ac3ff5..000000000 --- a/docs/magpi/CHANGELOG.md +++ /dev/null @@ -1,70 +0,0 @@ -# @openfn/language-magpi - -## 1.1.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 1.1.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 1.0.5 - -### Patch Changes - -- 86fb813: dependencies update - -## 1.0.4 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 1.0.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 1.0.2 - -### Patch Changes - -- f2aed32: add examples - -## 1.0.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 1.0.0 - -### Major Changes - -- e6c2b4a: Update xml2js parser - -### Minor Changes - -- df5dd2e: migrate magpi diff --git a/docs/magpi/README.md b/docs/magpi/README.md deleted file mode 100644 index c62fff58d..000000000 --- a/docs/magpi/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# Language Magpi - -Language Pack for building expressions and operations for working with the -[Magpi inbound API](http://support.magpi.com/support/solutions/articles/4839-magpi-inbound-api) -and the -[Magpi outbound API](http://support.magpi.com/support/solutions/articles/4865-magpi-outbound-api). - -_N.B.: The Magpi API is under development and this pack may change._ - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/magpi-configuration-schema/) -definition. - -## Fetch data from Magpi - -Allows you to fetch data from Magpi and post it elsewhere. - -#### Using `fetchSurveyData`: - -https://www.magpi.com/api/surveydata/v2?username=taylordowns2000&accesstoken=blahblahblah&surveyid=921409679070 - -```js -fetchSurveyData({ - surveyId: '37479', - afterDate: '2016-01-01', - beforeDate: '2100-01-01', - postUrl: 'https://www.openfn.org/inbox/secret-5c25-inbox-ba2c-url', -}); -``` - -## Submit new records - -**wip:** This will allow you to push data to Magpi to create a new record for a -form which exists in a user account. - -#### Using `submitRecord`: - -```js -submitRecord(1, 2); -``` - -#### Magpi Outbound API Parameters: - -- `username`: The account username. -- `accesstoken`: The accesstoken generated on the site. Each accesstoken is - associated with the user who generated. -- `surveyid`: The surveyid is not the survey's name. The surveyid can be - obtained from the list of forms generated in 1 above. -- `startdate`: Start date of the data to be returned. Filtering is done based on - the DateStamp and is inclusive.(Optional). The date format should be the same - one as the one on the data tab/ The date format should be the same one as the - one on the data tab -- `enddate`: End date of the data to be returned. Filtering is done based on the - DateStamp and is inclusive.(Optional) - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/magpi/index.md b/docs/magpi/index.md deleted file mode 100644 index 9a9ce548d..000000000 --- a/docs/magpi/index.md +++ /dev/null @@ -1,52 +0,0 @@ -## Functions - -
-
- fetchSurveyData(params)
-
- submitRecord(jsonData)
-
- - -## fetchSurveyData - -fetchSurveyData(params) ⇒ Operation -Make a POST request to fetch Magpi data and POST it somewhere else - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data to make the fetch | - -**Example** -```js -fetchSurveyData({ - "surveyId": "37479", - "afterDate": "2017-09-27", - "postUrl": "https://www.openfn.org/inbox/your-inbox-url" -}) -``` - -* * * - -## submitRecord - -submitRecord(jsonData) ⇒ Operation -Submit a record for a form/survey which already exists in a Magpi user account - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| jsonData | object | Payload data for the record | - -**Example** -```js -submitRecord(jsonData) -``` - -* * * - diff --git a/docs/mailchimp/CHANGELOG.md b/docs/mailchimp/CHANGELOG.md deleted file mode 100644 index fb1f3315e..000000000 --- a/docs/mailchimp/CHANGELOG.md +++ /dev/null @@ -1,114 +0,0 @@ -# @openfn/language-mailchimp - -## 0.7.2 - -### Patch Changes - -- 1131c34: Remove regex pattern for validation and changed minLength to 1 - -## 0.7.1 - -### Patch Changes - -- 1f856c4: Update configuration schema -- 48394f5: - fix ast docs warnings - - add status code log on request - -## 0.7.0 - -### Minor Changes - -- 58fcea9: - Add chunk from common - - Improve error logs - - Return `state` in request finalState - -## 0.6.0 - -### Minor Changes - -- 1582873: Add request, get and post functions - -## 0.5.0 - -### Minor Changes - -- 8e39ee1: Add new functions - - - addMember() - - listMembers() - - deleteMember() - - listAudiences() - - archiveMember() - - updateMemberTags() - - listAudienceInfo() - -## 0.4.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.4.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.3.5 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.3.4 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.3.3 - -### Patch Changes - -- f2aed32: add examples - -## 0.3.2 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.3.1 - -### Patch Changes - -- cbb8968: Fix axios Inefficient Regular Expression Complexity vulnerability -- e81561f: Updated ast and package.json - -## 0.3.0 - -### Minor Changes - -- 88fa3b5: migrate mailchimp - -### Patch Changes - -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 diff --git a/docs/mailchimp/README.md b/docs/mailchimp/README.md deleted file mode 100644 index b2d1ae7d9..000000000 --- a/docs/mailchimp/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Language Mailchimp - -An OpenFn **_adaptor_** for building integration jobs for use with the Mailchimp -marketing API. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/mailchimp-configuration-schema/) -definition. - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/mailchimp/index.md b/docs/mailchimp/index.md deleted file mode 100644 index 88fbc1648..000000000 --- a/docs/mailchimp/index.md +++ /dev/null @@ -1,316 +0,0 @@ -## Functions - -
-
- addMember(params, [callback])
-
- archiveMember(params, [callback])
-
- deleteMember(params, [callback])
-
- get(path, query, [callback])
-
- listAudienceInfo(query, [callback])
-
- listAudiences(query, [callback])
-
- listBatches(params, [callback])
-
- listMembers(params, [callback])
-
- post(path, body, query, [callback])
-
- request(method, path, options, [callback])
-
- startBatch(params, [callback])
-
- tagMembers(params, [callback])
-
- updateMember(params, [callback])
-
- updateMemberTags(params, [callback])
-
- upsertMembers(params, [callback])
-
- - -## addMember - -addMember(params, [callback]) ⇒ Operation -addMember to a list - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | a listId, and options | -| [callback] | function | Optional callback to handle the response | - - -* * * - -## archiveMember - -archiveMember(params, [callback]) ⇒ Operation -archiveMember in a list - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | a listId, and options | -| [callback] | function | Optional callback to handle the response | - - -* * * - -## deleteMember - -deleteMember(params, [callback]) ⇒ Operation -Permanently delete a member from a list - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | a listId, and options | -| [callback] | function | Optional callback to handle the response | - - -* * * - -## get - -get(path, query, [callback]) ⇒ Operation -The get function is used to make a GET request to the Mailchimp API. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| path | string | The endpoint of the api to which the request should be made | -| query | object | An object containing query parameters to be included in the request | -| [callback] | function | (Optional) callback to handle the response | - -**Example** *(Get a list of account exports for a given account)* -```js -get('/account-exports'); -``` - -* * * - -## listAudienceInfo - -listAudienceInfo(query, [callback]) ⇒ Operation -Get information about a specific list in your Mailchimp account. -Results include list members who have signed up but haven't confirmed their subscription yet and unsubscribed or cleaned. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| query | object | listId and query parameters | -| [callback] | function | Optional callback to handle the response | - - -* * * - -## listAudiences - -listAudiences(query, [callback]) ⇒ Operation -Get information about all lists in the account. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| query | object | Query parameters | -| [callback] | function | Optional callback to handle the response | - - -* * * - -## listBatches - -listBatches(params, [callback]) ⇒ Operation -listBatches - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | a listId, and options | -| [callback] | function | Optional callback to handle the response | - - -* * * - -## listMembers - -listMembers(params, [callback]) ⇒ Operation -listMembers - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | a listId, and options | -| [callback] | function | Optional callback to handle the response | - - -* * * - -## post - -post(path, body, query, [callback]) ⇒ Operation -The post function is used to make a POST request to the Mailchimp API. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| path | string | The endpoint of the api to which the request should be made. | -| body | object | The data to be sent in the body of the request | -| query | object | An object containing query parameters to be included in the request | -| [callback] | function | (Optional) callback to handle the response | - -**Example** *(Create a new account export in your Mailchimp account)* -```js -post('/accounts-export', {include_stages:[]}); -``` - -* * * - -## request - -request(method, path, options, [callback]) ⇒ Operation -Make an HTTP request to Mailchimp API - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| method | string | The HTTP method for the request (e.g., 'GET', 'POST', 'PUT', 'DELETE'). | -| path | string | The endpoint of the api to which the request should be made. | -| options | Object | Additional options for the request (query, body only). | -| [callback] | function | (Optional) callback function to handle the response. | - -**Example** *(Get list to all other resources available in the API)* -```js -request('GET','/'); -``` -**Example** *(Create a new account export in your Mailchimp account)* -```js -request('POST','/accounts-export', {include_stages:[]}); -``` - -* * * - -## startBatch - -startBatch(params, [callback]) ⇒ Operation -Start a batch with a list of operations. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | operations batch job | -| [callback] | function | Optional callback to handle the response | - -**Example** -```js -startBatch(params) -``` - -* * * - -## tagMembers - -tagMembers(params, [callback]) ⇒ Operation -Tag members with a particular tag - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | a tagId, members, and a list | -| [callback] | function | Optional callback to handle the response | - -**Example** -```js -tagMembers((state) => ({ - listId: "someId", // All Subscribers list - tagId: "someTag", // User tag - members: state.response.body.rows.map((u) => u.email), -})); -``` -**Example** -```js -tagMembers((state) => ({ - listId: "someId", - tagId: "someTag", - members: state.response.body.rows - .filter((u) => u.allow_other_emails) - .map((u) => u.email), -})); -``` - -* * * - -## updateMember - -updateMember(params, [callback]) ⇒ Operation -updateMember - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | a listId,subscriberHash and member | -| [callback] | function | Optional callback to handle the response | - - -* * * - -## updateMemberTags - -updateMemberTags(params, [callback]) ⇒ Operation -updateMemberTags - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | a listId, and options | -| [callback] | function | Optional callback to handle the response | - - -* * * - -## upsertMembers - -upsertMembers(params, [callback]) ⇒ Operation -Add or update a list members - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | a listId, users, and options | -| [callback] | function | Optional callback to handle the response | - -**Example** -```js -upsertMembers((state) => ({ - listId: "someId", - users: state.response.body.rows.map((u) => ({ - email: u.email, - status: u.allow_other_emails ? "subscribed" : "unsubscribed", - mergeFields: { FNAME: u.first_name, LNAME: u.last_name }, - })), -})); -``` - -* * * - diff --git a/docs/mailgun/CHANGELOG.md b/docs/mailgun/CHANGELOG.md deleted file mode 100644 index 1ed4ff334..000000000 --- a/docs/mailgun/CHANGELOG.md +++ /dev/null @@ -1,72 +0,0 @@ -# @openfn/language-mailgun - -## 0.4.3 - -### Patch Changes - -- f86576d: Security update to mailgun.js - -## 0.4.2 - -### Patch Changes - -- 4620079: Bump opinionator version - -## 0.4.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.4.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.3.4 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.3.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.3.2 - -### Patch Changes - -- f2aed32: add examples - -## 0.3.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.3.0 - -### Minor Changes - -- 9ded25e: Migrate Mailgun diff --git a/docs/mailgun/README.md b/docs/mailgun/README.md deleted file mode 100644 index 18a05b402..000000000 --- a/docs/mailgun/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Language Mailgun - -Language Pack for building expressions and operations for working with the -mailgun API. - -[mailgun-js on npm](https://www.npmjs.com/package/mailgun-js) - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/mailgun-configuration-schema/) -definition. - -## send - -```js -send( - fields( - field('from', 'from_email'), - field('to', 'to_email'), - field('subject', 'Your Subject'), - field('text', 'Your message goes here') - ) -); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/mailgun/index.md b/docs/mailgun/index.md deleted file mode 100644 index 6af50f398..000000000 --- a/docs/mailgun/index.md +++ /dev/null @@ -1,28 +0,0 @@ -## send - -send(params) -Create an event - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | Params for sending an email | - -**Example** -```js -send({ - from: 'from_email', - to: 'to_email', - subject: 'Your Subject', - text: 'Your message goes here', - attachment: { - url: 'www.google.com/doodle.png', - filename: 'forYou.png', - }, -}) -``` - -* * * - diff --git a/docs/maximo/CHANGELOG.md b/docs/maximo/CHANGELOG.md deleted file mode 100644 index 02c3d3fb3..000000000 --- a/docs/maximo/CHANGELOG.md +++ /dev/null @@ -1,66 +0,0 @@ -# @openfn/language-maximo - -## 0.4.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.4.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.3.5 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.3.4 - -### Patch Changes - -- aed7e0b: fix required field in configuration schema - -## 0.3.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.3.2 - -### Patch Changes - -- f2aed32: add examples - -## 0.3.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.3.0 - -### Minor Changes - -- 4d4be56: migrate maximo diff --git a/docs/maximo/README.md b/docs/maximo/README.md deleted file mode 100644 index 1c64fdfc9..000000000 --- a/docs/maximo/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# Language Maximo - -Language Pack for building expressions and operations to access IBM Maximo EAM. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/maximo-configuration-schema/) -definition. - -### Fetch - -#### sample 'fetch' expression - -```js -fetch({ - endpoint: 'maxrest/rest/os/mxinventory', - query: { - ITEMNUM: '01226', - _format: 'json', - }, - postUrl: 'https://www.openfn.org/inbox/not-real', -}); -``` - -### sample 'create' expression - -```js -create({ - endpoint: 'maxrest/rest/os/mxinvbal/', - body: function (state) { - return { - ITEMNUM: dataValue('form.ITEMNUM')(state), - ITEMSETID: dataValue('form.ITEMSETID')(state), - SITEID: dataValue('form.SITEID')(state), - LOCATION: dataValue('form.LOCATION')(state), - ISSUEUNIT: 'FOO', - PHYSCNT: dataValue('PHYSCNT')(state), - BINNUM: dataValue('form.BINNUM')(state), - }; - }, -}); -``` - -### sample 'update75' expression - -```js -update75({ - endpoint: state => { - return ( - 'maxrest/rest/os/mxinvbal/' + - dataValue('form.question1.INVBALANCESID')(state) - ); - }, - body: state => { - return { - _action: 'AddChange', //this is required for the old Maximo API! - ITEMNUM: dataValue('form.ITEMNUM')(state), - ITEMSETID: dataValue('form.ITEMSETID')(state), - SITEID: dataValue('form.SITEID')(state), - LOCATION: dataValue('form.LOCATION')(state), - PHYSCNT: dataValue('form.PHYSCNT')(state), - BINNUM: dataValue('form.BINNUM')(state), - }; - }, -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/maximo/index.md b/docs/maximo/index.md deleted file mode 100644 index 8137151e7..000000000 --- a/docs/maximo/index.md +++ /dev/null @@ -1,77 +0,0 @@ -## Functions - -
-
- fetch(params)
-
- update(params)
-
- update75(params)
-
- - -## fetch - -fetch(params) ⇒ Operation -Make a GET request and POST it somewhere else - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data to make the fetch | - -**Example** -```js -fetch({ - endpoint: 'maxrest/rest/os/mxinventory', - query: { - ITEMNUM: '01226', - _format: 'json', - }, - postUrl: 'https://www.openfn.org/inbox/not-real', -}); -``` - -* * * - -## update - -update(params) ⇒ Operation -Make an update in Maximo 7.6 and beyond - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data to make the update | - -**Example** -```js -execute( - update(params) -)(state) -``` - -* * * - -## update75 - -update75(params) ⇒ Operation -Make an upadte in Maximo 7.5 - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data to make the update | - -**Example** -```js -execute( - update75(params) -)(state) -``` - -* * * - diff --git a/docs/medicmobile/CHANGELOG.md b/docs/medicmobile/CHANGELOG.md deleted file mode 100644 index e1f48370b..000000000 --- a/docs/medicmobile/CHANGELOG.md +++ /dev/null @@ -1,65 +0,0 @@ -# @openfn/language-medicmobile - -## 0.4.2 - -### Patch Changes - -- 421fad3: Bump query-string - -## 0.4.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.4.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.3.3 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.3.2 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.3.1 - -### Patch Changes - -- f2aed32: add examples - -## 0.3.0 - -### Minor Changes - -- 2cd3236: migrate medicmobile - -### Patch Changes - -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 diff --git a/docs/medicmobile/README.md b/docs/medicmobile/README.md deleted file mode 100644 index 09e59693d..000000000 --- a/docs/medicmobile/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# Language Medic Mobile - -Language Pack for building expressions and operations to make calls to the Medic -Mobile API. -**For an overview of Medic's database, check out -[Medic's DB Schema v2](https://github.com/medic/medic-docs/blob/master/development/db-schema.md)** -The exported functions in this language package can be executed by -[OpenFn/core](https://github.com/OpenFn/core): - -```sh -../core/lib/cli.js execute -l ./lib/Adaptor -s ./tmp/state.json -e ./tmp/expression.js -``` - -For quick-start help, clone -[OpenFn/openfn-devtools](https://github.com/OpenFn/openfn-devtools) and follow -the README.md - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/medicmobile-configuration-schema/) -definition. - -#### sample fetchSubmissions expression - -```js -fetchSubmissions( - 'pregnancy', // formId - { 'last-event-id': 334 }, // params, last-event-id will be replaced by cursor - 'http://localhost:4000/inbox/abc-123-xyz' // postUrl -); -``` - -#### sample changesApi and pickFormData usage - -```js -// get all the changes... -changesApi({ - include_docs: true, - // This only gets used the first time the job is run. - // Subsequent runs take the lastSeq value as their cursor. - // "last-event-id": 789, -}); - -// Picks out the field data for a given formId. -pickFormData('pregnancy'); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/medicmobile/index.md b/docs/medicmobile/index.md deleted file mode 100644 index e3834ec4e..000000000 --- a/docs/medicmobile/index.md +++ /dev/null @@ -1,76 +0,0 @@ -## Functions - -
-
- changesApi(params, callback)
-
- fetchSubmissions(formId, params, postUrl)
-
- pickFormData(formId)
-
- - -## changesApi - -changesApi(params, callback) ⇒ Operation -Access the CouchDB Changes API - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | Query parameters | -| callback | function | (Optional) Callback function | - -**Example** -```js -changesApi(params, callback) -``` - -* * * - -## fetchSubmissions - -fetchSubmissions(formId, params, postUrl) ⇒ Operation -Access form submissions and post them as JSON. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| formId | string | Query parameters | -| params | object | Starting sequence id | -| postUrl | string | Inbox to post form data | - -**Example** -```js -fetchSubmissions( - "pregnancy", // formId - { "last-event-id": 334 }, // params - "http://localhost:4000/inbox/abc-123-xyz" // postUrl -); -``` - -* * * - -## pickFormData - -pickFormData(formId) ⇒ Operation -Select submissions for a specific form - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| formId | string | The form ID. | - -**Example** -```js -pickFormData(formId) -``` - -* * * - diff --git a/docs/mogli/CHANGELOG.md b/docs/mogli/CHANGELOG.md deleted file mode 100644 index bdb916564..000000000 --- a/docs/mogli/CHANGELOG.md +++ /dev/null @@ -1,70 +0,0 @@ -v0.1.6 - -## 0.4.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.4.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.3.4 - -### Patch Changes - -- 7cc8efc: remove FakeAdaptor references - -## 0.3.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.3.2 - -### Patch Changes - -- f2aed32: add examples - -## 0.3.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.3.0 - -### Minor Changes - -- # c6056e8: migrate mogli - -* State gets cleaned up after the operations are finished. This means that the - final state is serializable. - - The JSForce connection object is provided by `createConnection`, and in turn - `execute` ensures it is run before the user's operations. - - The `cleanupState` reducer simply deletes the connection key from state. - -# v0.1.3 - -- Bumped language-common dependency to v0.0.4. diff --git a/docs/mogli/README.md b/docs/mogli/README.md deleted file mode 100644 index 50b4dd87f..000000000 --- a/docs/mogli/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Language Mogli - -Language Pack for building expressions and operations to interact with Mogli -SMS. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/mogli-configuration-schema/) -definition. - -### Create inbound SMS - -```js -createSMS( - fields( - field('sender', dataValue('from_number')), - field('receivedAt', dataValue('timestamp')), - field('message', dataValue('message')) - ) -); -``` - - - - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/mogli/connecting_with_sms_providers.md b/docs/mogli/connecting_with_sms_providers.md deleted file mode 100644 index 1413ad5e2..000000000 --- a/docs/mogli/connecting_with_sms_providers.md +++ /dev/null @@ -1,24 +0,0 @@ -# Connecting with SMS providers -This document outlines the basic requests that should be made of telcom providers when we approach them to integrate with their systems. We we _can_ connect in other ways, JSON-based REST API (for sending) and a webhooks API (for receiving) is the web standard and it is what we look for. - -At a high level, no matter how they allow connections, what we need is their `SMS API documentation`. - -## Sending SMS from Mogli to local recipients -In order to send SMS messages, we will make an HTTP post to a URL that you specify with basic authentication and a content type of application/json. It will contain the recipient address and text as key:value pairs. Using CURL for testing purposes, the post will look like this: - -```sh -curl -X POST \ - https://www.orange-or-airtel-or-vodafone.com/api/send \ - -H 'authorization: Basic dGF5bG9yOnNlY3JldA==' \ - -H 'cache-control: no-cache' \ - -H 'content-type: application/json' \ - -d '{"recipient":959011728, " text": "Bonjour le monde!"}' -``` - -For additional clarity here, see a great example of Orange's API documentation in Niger: https://developer.orange.com/apis/sms-ne/api-reference - -## Receiving SMS from local recipients - -We will expect that Orange will make a similar HTTP post to our url (https://www.openfn.org/inbox/something-secret) with the content of the message and the sender whenever an SMS is received. - -Note that these posts are delivered over HTTPS and use modern standard authentication ("Basic Auth") but that there is no VPN connection required. diff --git a/docs/mogli/connecting_with_telcos.md b/docs/mogli/connecting_with_telcos.md deleted file mode 100644 index 1413ad5e2..000000000 --- a/docs/mogli/connecting_with_telcos.md +++ /dev/null @@ -1,24 +0,0 @@ -# Connecting with SMS providers -This document outlines the basic requests that should be made of telcom providers when we approach them to integrate with their systems. We we _can_ connect in other ways, JSON-based REST API (for sending) and a webhooks API (for receiving) is the web standard and it is what we look for. - -At a high level, no matter how they allow connections, what we need is their `SMS API documentation`. - -## Sending SMS from Mogli to local recipients -In order to send SMS messages, we will make an HTTP post to a URL that you specify with basic authentication and a content type of application/json. It will contain the recipient address and text as key:value pairs. Using CURL for testing purposes, the post will look like this: - -```sh -curl -X POST \ - https://www.orange-or-airtel-or-vodafone.com/api/send \ - -H 'authorization: Basic dGF5bG9yOnNlY3JldA==' \ - -H 'cache-control: no-cache' \ - -H 'content-type: application/json' \ - -d '{"recipient":959011728, " text": "Bonjour le monde!"}' -``` - -For additional clarity here, see a great example of Orange's API documentation in Niger: https://developer.orange.com/apis/sms-ne/api-reference - -## Receiving SMS from local recipients - -We will expect that Orange will make a similar HTTP post to our url (https://www.openfn.org/inbox/something-secret) with the content of the message and the sender whenever an SMS is received. - -Note that these posts are delivered over HTTPS and use modern standard authentication ("Basic Auth") but that there is no VPN connection required. diff --git a/docs/mogli/index.md b/docs/mogli/index.md deleted file mode 100644 index 7c6fea17c..000000000 --- a/docs/mogli/index.md +++ /dev/null @@ -1,70 +0,0 @@ -## Functions - -
-
- cleanupState(state)
-
- lookup(relationshipName, externalID, path)
-
- relationship(relationshipName, externalID, dataSource)
-
- - -## cleanupState - -cleanupState(state) ⇒ State -Removes unserializable keys from the state. - -**Kind**: global function - -| Param | Type | -| --- | --- | -| state | State | - - -* * * - -## lookup - -lookup(relationshipName, externalID, path) ⇒ object -Adds a lookup or 'dome insert' to a record. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| relationshipName | string | `__r` relationship field on the record. | -| externalID | string | Salesforce ExternalID field. | -| path | string | JSONPath to data source. | - -**Example** *(Example)* -```js -lookup("relationship_name__r", "externalID on related object", "$.path") -``` - -* * * - -## relationship - -relationship(relationshipName, externalID, dataSource) ⇒ object -Adds a lookup or 'dome insert' to a record. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| relationshipName | string | `__r` relationship field on the record. | -| externalID | string | Salesforce ExternalID field. | -| dataSource | string | resolvable source. | - -**Example** *(Data Sourced Value)* -```js -relationship("relationship_name__r", "externalID on related object", dataSource("path")) -``` -**Example** *(Fixed Value)* -```js -relationship("relationship_name__r", "externalID on related object", "hello world") -``` - -* * * - diff --git a/docs/mongodb/CHANGELOG.md b/docs/mongodb/CHANGELOG.md deleted file mode 100644 index 1b4561755..000000000 --- a/docs/mongodb/CHANGELOG.md +++ /dev/null @@ -1,49 +0,0 @@ -# @openfn/language-mongodb - -## 2.0.0 - -### Major Changes - -- Update configuration schema for MongoDB adaptor: - - Rename `clusterUrl` to `clusterHostname` - - Change `clusterHostname` format from `uri` to `hostname` - - Update `Adaptor.js` and tests to use new name - -## 1.1.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 1.1.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 1.0.6 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 1.0.5 - -### Patch Changes - -- f2aed32: add examples diff --git a/docs/mongodb/README.md b/docs/mongodb/README.md deleted file mode 100644 index c1bfaefe9..000000000 --- a/docs/mongodb/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# Language MongoDB - -Language Pack for building expressions and operations for use with MongoDB. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/mongodb-configuration-schema/) -definition. - -### insertDocuments - -```js -insertDocuments({ - database: 'yourDb', - collection: 'yourCollection', - documents: state => { - return state.data.map(item => { - return { name: item.name, age: item.age }; - }); - }, - // callback: (state) => state, // optional -}); -``` - -### findDocuments - -```js -findDocuments({ - database: 'yourDb', - collection: 'yourCollection', - query: state => { - return { name: 'stu' }; - }, - // callback: (state) => state, // optional -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/mongodb/index.md b/docs/mongodb/index.md deleted file mode 100644 index a3b42ee76..000000000 --- a/docs/mongodb/index.md +++ /dev/null @@ -1,144 +0,0 @@ -## Functions - -
-
- connect(state)
-
- disconnect(state)
-
- execute(operations)
-
- findDocuments(params)
-
- insertDocuments(params)
-
- updateDocument(params)
-
- - -## connect - -connect(state) ⇒ State -Connects to a mongoDb instance - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| state | State | Runtime state. | - -**Example** -```js -connect(state) -``` - -* * * - -## disconnect - -disconnect(state) ⇒ State -Removes connection from the state. - -**Kind**: global function - -| Param | Type | -| --- | --- | -| state | State | - -**Example** -```js -disconnect(state) -``` - -* * * - -## execute - -execute(operations) ⇒ Operation -Execute a sequence of operations. -Wraps `@openfn/language-common/execute`, and prepends initial state for http. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| operations | Operations | Operations to be performed. | - -**Example** -```js -execute( - insertDocuments(params), - findDocuments(params) -)(state) -``` - -* * * - -## findDocuments - -findDocuments(params) ⇒ State -Find documents in a mongoDb collection - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | Configuration for mongo | - -**Example** -```js -findDocuments({ - database: 'str', - collection: 'cases', - query: {a:3} - }); -``` - -* * * - -## insertDocuments - -insertDocuments(params) ⇒ State -Inserts documents into a mongoDb collection - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | Configuration for mongo | - -**Example** -```js -insertDocuments({ - database: 'str', - collection: 'kids', - documents: [1,2,3] - }); -``` - -* * * - -## updateDocument - -updateDocument(params) ⇒ State -Updates document (optionally upserting) into a mongoDb collection - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | Configuration for mongo | - -**Example** -```js -updateDocuments({ - database: 'str', - collection: 'animals', - filter: { type: 'fuzzy' }, - changes: { kind: 'soft' }, - options: { upsert: true } - }); -``` - -* * * - diff --git a/docs/msgraph/CHANGELOG.md b/docs/msgraph/CHANGELOG.md deleted file mode 100644 index dcbd622eb..000000000 --- a/docs/msgraph/CHANGELOG.md +++ /dev/null @@ -1,86 +0,0 @@ -# @openfn/language-msgraph - -## 0.4.0 - -### Minor Changes - -- 4cd6587: Add `uploadFile` and `sheetToBuffer` function - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 0.3.5 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 0.3.4 - -### Patch Changes - -- 1c183e9: Fix getFile unit tests - -## 0.3.3 - -### Patch Changes - -- b90e8a2: Add support for stream -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 0.3.2 - -### Patch Changes - -- 9cc4952: fix url in request util - -## 0.3.1 - -### Patch Changes - -- f45f477: Clean-up state before throwing an error - -## 0.3.0 - -### Minor Changes - -- 9366e53: - Switch from `nodejs` default `fetch` to `undici` `fetch` - - Added the following `sharepoint` functions - - `getDrive()` - - `getFolder()` - - `getFile()` - -## 0.2.0 - -### Minor Changes - -- d33c0ee: export parseCsv from common - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 0.1.1 - -### Patch Changes - -- aad9549: Ensure that standard OAuth2 credentials with snake-cased - "access_token" keys can be used for OAuth2-reliant adaptors -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 0.1.0 - -### Minor Changes - -- 93d82a8: Add msgraph adaptor with get() and create() functions - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 diff --git a/docs/msgraph/README.md b/docs/msgraph/README.md deleted file mode 100644 index 2dbceacd3..000000000 --- a/docs/msgraph/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# language-msgraph - -An OpenFn **_adaptor_** for building integration jobs for use with the -[Microsoft Graph API](https://learn.microsoft.com/en-us/graph/use-the-api). - -## Documentation - -View the [docs site](https://docs.openfn.org/adaptors/packages/msgraph-docs) for -full technical documentation. - -### Configuration - -View the -[configuration-schema](https://docs.openfn.org/adaptors/packages/msgraph-configuration-schema/) -for required and optional `configuration` properties. - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -"Getting Started" guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To build _only_ the docs run `pnpm build docs`. diff --git a/docs/msgraph/index.md b/docs/msgraph/index.md deleted file mode 100644 index 6b09c288d..000000000 --- a/docs/msgraph/index.md +++ /dev/null @@ -1,231 +0,0 @@ -## Functions - -
-
- create(resource, data, callback)
-
- get(path, query, callback)
-
- getDrive(specifier, name, [callback])
-
- getFile(pathOrId, options, [callback])
-
- getFolder(pathOrId, options, [callback])
-
- sheetToBuffer(rows, options)
-
- uploadFile(resource, data, callback)
-
- - -## create - -create(resource, data, callback) ⇒ Operation -Create some resource in msgraph - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| resource | string | The type of entity that will be created | -| data | object | The data to create the new resource | -| callback | function | An optional callback function | - -**Example** -```js -create("applications", {"displayName": "My App"}) -``` - -* * * - -## get - -get(path, query, callback) ⇒ Operation -Make a GET request to msgraph resource - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | string | Path to resource | -| query | object | Query, Headers and Authentication parameters | -| callback | function | (Optional) Callback function | - -**Example** -```js -get('sites/root/lists') -``` - -* * * - -## getDrive - -getDrive(specifier, name, [callback]) ⇒ Operation -Get a Drive or SharePoint document library. The drive metadata will be written -to state.drives, where it can be used by other adaptor functions. -Pass { id } to get a drive by id or { id, owner } to get default drive for -some parent resource, like a group - -**Kind**: global function -**Access**: public - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| specifier | Object | | A definition of the drive to retrieve - id {string} - The ID of the resource or owner. - owner {string} - The type of drive owner (e.g. sites, groups). | -| name | string | | The local name of the drive used to write to state.drives, ie, state.drives[name] | -| [callback] | function | s => s | (Optional) Callback function | - -**Example** *(Get a drive by ID)* -```js -getDrive({ id: "YXzpkoLwR06bxC8tNdg71m" }) -``` -**Example** *(Get the default drive for a site)* -```js -getDrive({ id: "openfn.sharepoint.com", owner: "sites" }) -``` - -* * * - -## getFile - -getFile(pathOrId, options, [callback]) ⇒ Operation -Get file metadata or file content. - -**Kind**: global function -**Access**: public - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| pathOrId | string | | A path to a file or file id | -| options | object | | (Optional) Query parameters | -| [callback] | function | s => s | (Optional) Callback function | - -**Example** *(Get a file by ID)* -```js -getFile('01LUM6XOGRONYNTZ26DBBJPTN5IFTQPBIW') -``` -**Example** *(Get a file for a named drive by id)* -```js -getFile("01LUM6XOGRONYNTZ26DBBJPTN5IFTQPBIW",{ driveName: "mydrive"}) -``` - -* * * - -## getFolder - -getFolder(pathOrId, options, [callback]) ⇒ Operation -Get the contents or metadata of a folder. - -**Kind**: global function -**Access**: public - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| pathOrId | string | | A path to a folder or folder id | -| options | object | | (Optional) Query parameters | -| [callback] | function | s => s | (Optional) Callback function | - -**Example** *(Get a folder by ID)* -```js -getFolder('01LUM6XOCKDTZKQC7AVZF2VMHE2I3O6OY3') -``` -**Example** *(Get a folder for a named drive by id)* -```js -getFolder("01LUM6XOCKDTZKQC7AVZF2VMHE2I3O6OY3",{ driveName: "mydrive"}) -``` - -* * * - -## request - -request ⇒ -This is an asynchronous function that sends a request to a specified URL with optional parameters -and headers, and returns the response data in JSON format. - -**Kind**: global constant -**Returns**: The `request` function is returning the parsed JSON data from the response of the HTTP -request made to the specified `url` with the given `params` and `method`. If there is an error in -the response, the function will throw an error. - -| Param | Type | Description | -| --- | --- | --- | -| url | string | The URL of the API endpoint that the request is being made to. | -| [options] | object | An object containing any additional parameters to be sent with the request, such as query parameters or request body data. It is an optional parameter and defaults to an empty object if not provided. | - - -* * * - -## sheetToBuffer - -sheetToBuffer(rows, options) ⇒ -The function `sheetToBuffer` takes in rows, options and optional callback, It creates a workbook -and worksheet using the rows, appends the worksheet to the workbook, and returns the workbook as a -buffer. - -**Kind**: global function -**Returns**: a buffer containing the Excel file in `state.buffer`. -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| rows | | The `rows` parameter is an array of objects representing the data to be written to the Excel sheet. Each object in the array represents a row in the sheet, and the keys of the object represent the column headers. The values of the object represent the data in each cell of the row. | -| options | | The `options` parameter is an object that contains additional configuration options | -| [options.wsName] | String | Worksheet name i.e 32 Characters | -| [options.bookType] | String | File format of the exported file, Default is 'xlsx'. See [here](https://docs.sheetjs.com/docs/api/write-options/#supported-output-formats) for the function. It can have the following properties: | - -**Example** *(Create a buffer containing excel file with `xlsx` output format )* -```js -sheetToBuffer('$.data[*]', { - wsName: 'Invalid Grant Codes', - bookType: 'xlsx', -}); -``` - -* * * - -## uploadFile - -uploadFile(resource, data, callback) ⇒ Operation -Upload a file to a drive - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| resource | Object | Resource Object | -| [resource.driveId] | String | Drive Id | -| [resource.driveId] | String | Site Id | -| [resource.folderId] | String | Parent folder id | -| [resource.contentType] | String | Resource content-type | -| [resource.onConflict] | String | Specify conflict behavior if file with the same name exists. Can be "rename | fail | replace" | -| data | Object | A buffer containing the file. | -| callback | function | Optional callback function | - -**Example** *(Upload Excel file to a drive using `driveId` and `parantItemId`)* -```js -uploadFile( - state => ({ - driveId: state.driveId, - folderId: state.folderId, - fileName: `Tracker.xlsx`, - }), - state => state.buffer -); -``` -**Example** *(Upload Excel file to a SharePoint drive using `siteId` and `parantItemId`)* -```js -uploadFile( - state => ({ - siteId: state.siteId, - folderId: state.folderId, - fileName: `Report.xlsx`, - }), - state => state.buffer -); -``` - -* * * - diff --git a/docs/mssql/CHANGELOG.md b/docs/mssql/CHANGELOG.md deleted file mode 100644 index b07f6beb1..000000000 --- a/docs/mssql/CHANGELOG.md +++ /dev/null @@ -1,164 +0,0 @@ -# @openfn/language-mssql - -## 4.1.8 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 4.1.7 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 4.1.6 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 4.1.5 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 4.1.4 - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 4.1.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 4.1.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 4.1.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 4.1.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 4.0.8 - -### Patch Changes - -- 57742d1: remove request dependency - -## 4.0.7 - -### Patch Changes - -- 04ed74f: update dependencies - -## 4.0.6 - -### Patch Changes - -- 43c3669: patch versions - -## 4.0.5 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 4.0.4 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 4.0.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 4.0.2 - -### Patch Changes - -- f2aed32: add examples - -## 4.0.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 4.0.0 - -### Major Changes - -- 3878624: Modify composeNextState function, to flattern all rows into an array - of rows with their corresponding column names - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 3.1.1 - -### Patch Changes - -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 - -## 3.1.0 - -### Minor Changes - -- c9b7ed7: Add language-mssql in monorepo - -### Patch Changes - -- e04aa28: Rename credential-schema to configuration-schema, update descriptions diff --git a/docs/mssql/README.md b/docs/mssql/README.md deleted file mode 100644 index 842a900b6..000000000 --- a/docs/mssql/README.md +++ /dev/null @@ -1,241 +0,0 @@ -# Language MSSQL - -Language Pack for connecting to Azure SQL Server via OpenFn. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/mssql-configuration-schema/) -definition. - -### Sample expression - -## sql query - -```js -sql({ - query: ` - SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES - WHERE TABLE_TYPE = 'BASE TABLE' - AND TABLE_CATALOG='my-demo' - `, -}); - -sql({ - query: `SELECT * FROM Household`, - options: { - writeSql: true, // Keep to true to log query (otherwise make it false). - execute: true, // keep to false to not alter DB - }, -}); -``` - -## Find a single value for a table - -This helper function allows to build a specific query where `sql` would not be -best suited. It returns a single value and not a promise. An example of usage -would be in building a mapping object with a value from a lookup table. - -```js -fn(async state => { - const user = { - id: 1, - name: 'Mamadou', - user_id: await findValue({ - uuid: 'id', - relation: 'users', - where: { first_name: 'Mama%' }, - operator: { first_name: 'like' }, // operator is optional. "=" is used by default. - })(state), - }; - - return upsert(...)(state); -}); -``` - -## Insert one single record - -```js -insert( - 'SomeDB.dbo.SupplierTest', - { - SupplierNumber: 1, - Name: dataValue('name'), - Address: 'Nunya Bihz-Nash', - }, - { - // The optional `options` argument allows for global string replacement with - // NULL. This is useful if you want to map an undefined value (e.g., x.name) - // to NULL. It can be a single string or an array of strings. - // It DEFAULTS to "'undefined'", and can be turned off w/ `false`. - setNull: "'undefined'", - logValues: true, - } -); -``` - -## Insert or Update using a unique column as a key - -This function insert or update depending on the existence of a record in the -database. - -```js -upsert( - 'SomeDB.dbo.Supplier', - 'SupplierNumber', - { - SupplierNumber: 1, - Name: dataValue('name'), - Address: 'Now I can tell!', - }, - // Do NOT replace any instances of 'undefined' in the final SQL statement. - { setNull: false, logValues: true } -); -``` - -## Insert or Update if a value exist in the record - -This function will upsert a record only if the logical given is true. In this -case we check if `dataValue('name')` exists. - -```js -upsertIf( - dataValue('name'), - 'users', - 'user_id', - { - name: 'Elodie', - id: 7, - }, - // Replace any occurence of '' and 'undefined' to NULL - { - setNull: ["''", "'undefined'"], - writeSql: true, - execute: false, - logValues: true, - } -); -``` - -## Insert Many records - -This function allows the insert of a set of records inside a table all at once. -Pass `logQuery` option to `true` to display the query. - -```js -// Note that insertMany takes a function which returns an array—this helps -// enforce that each item in the array has the same keys. -insertMany( - 'SomeDB.dbo.Supplier', - state => - state.data.supplierArray.map(s => { - return { - SupplierNumber: s.id, - Name: s.name, - Address: s.address, - }; - }), - { writeSql: true, logValues: true } -); -``` - -## Insert or Update Many records - -This function inserts or updates many records all at once depending on their -existence in the database. - -```js -// Note that insertMany takes a function which returns an array—this helps -// enforce that each item in the array has the same keys. -upsertMany( - 'SomeDB.dbo.Supplier', - 'SupplierNumber', - state => - state.data.supplierArray.map(s => { - return { - SupplierNumber: s.id, - Name: s.name, - Address: s.address, - }; - }), - { writeSql: true, execute: false, logValues: true } -); -``` - -In case we need to check on multiple columns before upserting, we can have an -array of `uuids`. - -```js -upsertMany( - 'SomeDB.dbo.Supplier', - ['SupplierNumber', 'SupplierCode'], - state => - state.data.supplierArray.map(s => { - return { - SupplierNumber: s.id, - Name: s.name, - Address: s.address, - SupplierCode: s.code, - }; - }), - { writeSql: true, execute: false, logValues: true } -); -``` - -## Describe a table from mssql - -This function is used to fetch the list of columns of a given table in the -database. - -```js -describeTable('users', { writeSql: false, execute: true }); -``` - -## Create a table in the database - -This function allows to create a table in a database from a given array of -columns. The key `identity` can be use for a column to auto-generate a value. - -```js -insertTable('users', state => - state.data.map(column => ({ - name: column.name, - type: column.type, - required: true, // optional - unique: false, // optional - set to true for unique constraint - })) -); -``` - -## Alter a table in the database - -This function allows to add new columns to a table. Beware of the fact that you -cannot add new columns with names that already exist in the table. - -```js -modifyTable( - 'users', - state => - state.data.map(newColumn => ({ - name: newColumn.name, - type: newColumn.type, - required: true, // optional - unique: false, // optional - set to true for unique constraint - })), - { writeSql: false, execute: true } -); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/mssql/index.md b/docs/mssql/index.md deleted file mode 100644 index cf020c939..000000000 --- a/docs/mssql/index.md +++ /dev/null @@ -1,341 +0,0 @@ -## Functions - -
-
- addRowsToRefs(state, rows)
-
- cleanupState(state)
-
- createConnection(state)
-
- describeTable(tableName, options)
-
- findValue(filter)
-
- flattenRows(state, rows)
-
- insert(table, record, options)
-
- insertMany(table, records, options)
-
- insertTable(tableName, columns, options)
-
- modifyTable(tableName, columns, options)
-
- sql(params)
-
- upsert(table, uuid, record, options)
-
- upsertIf(logical, table, uuid, record, options)
-
- upsertMany(table, uuid, records, options)
-
- - -## addRowsToRefs - -addRowsToRefs(state, rows) ⇒ State -Sets the returned rows from a query as the first item in the state.references -array, leaving state.data unchanged between operations. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| state | State | | -| rows | array | the array of rows returned from the sql query | - - -* * * - -## cleanupState - -cleanupState(state) ⇒ State -Removes unserializable keys from the state. - -**Kind**: global function - -| Param | Type | -| --- | --- | -| state | State | - -**Example** -```js -cleanupState(state) -``` - -* * * - -## createConnection - -createConnection(state) ⇒ State -Creates a connection. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| state | State | Runtime state. | - -**Example** -```js -createConnection(state) -``` - -* * * - -## describeTable - -describeTable(tableName, options) ⇒ Operation -List the columns of a table in a database. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| tableName | string | The name of the table to describe | -| options | object | Optional options argument | - -**Example** -```js -describeTable('clinic_visits') -``` - -* * * - -## findValue - -findValue(filter) ⇒ Operation -Fetch a uuid key given a condition - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| filter | object | A filter object with the lookup table, a uuid and the condition | - -**Example** -```js -findValue({ - uuid: 'id', - relation: 'users', - where: { first_name: 'Mama%', last_name: 'Cisse'}, - operator: { first_name: 'like', last_name: '='} - }) -``` - -* * * - -## flattenRows - -flattenRows(state, rows) ⇒ State -Returns a flatten object of the rows (array of arrays) with rowCount. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| state | State | | -| rows | array | the array of rows returned from the sql query | - - -* * * - -## insert - -insert(table, record, options) ⇒ Operation -Insert a record - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| table | string | The target table | -| record | object | Payload data for the record as a JS object | -| options | object | Optional options argument | - -**Example** -```js -insert(table, record, {setNull: ["'undefined'", "''"], logValues: false}) -``` - -* * * - -## insertMany - -insertMany(table, records, options) ⇒ Operation -Insert many records, using the keys of the first as the column template - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| table | string | The target table | -| records | function | A function that takes state and returns an array of records | -| options | object | Optional options argument | - -**Example** -```js -insertMany(table, records, { setNull: false, writeSql: true, logValues: false }) -``` - -* * * - -## insertTable - -insertTable(tableName, columns, options) ⇒ Operation -Create a table in database when given an array of columns and a table_name. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| tableName | string | The name of the table to create | -| columns | array | An array of form columns | -| options | object | Optional options argument | - -**Example** -```js -insertTable('table_name', state => state.data.map( - column => ({ - name: column.name, - type: column.type, - required: true, // optional - unique: false, // optional - to be set to true for unique constraint - }) -)); -``` - -* * * - -## modifyTable - -modifyTable(tableName, columns, options) ⇒ Operation -Alter an existing table in the database. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| tableName | string | The name of the table to alter | -| columns | array | An array of form columns | -| options | object | Optional options argument | - -**Example** -```js -modifyTable('table_name', state => state.data.map( - newColumn => ({ - name: newColumn.name, - type: newColumn.type, - required: true, // optional - unique: false, // optional - to be set to true for unique constraint - }) -)); -``` - -* * * - -## sql - -sql(params) ⇒ Operation -Execute an SQL statement - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | Payload data for the message | - -**Example** -```js -sql({ query, options }) -``` - -* * * - -## upsert - -upsert(table, uuid, record, options) ⇒ Operation -Insert or update a record using SQL MERGE - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| table | string | The target table | -| uuid | string | The uuid column to determine a matching/existing record | -| record | object | Payload data for the record as a JS object | -| options | object | Optional options argument | - -**Example** -```js -upsert(table, uuid, record, { setNull: "'undefined'", logValues: false}) -upsert(table, [uuid1, uuid2], record, { setNull: "'undefined'", logValues: false}) -``` - -* * * - -## upsertIf - -upsertIf(logical, table, uuid, record, options) ⇒ Operation -Insert or update a record based on a logical condition using ON CONFLICT UPDATE - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| logical | string | a data to check existing value for. | -| table | string | The target table | -| uuid | string | The uuid column to determine a matching/existing record | -| record | object | Payload data for the record as a JS object or function | -| options | object | Optional options argument | - -**Example** -```js -upsertIf( - dataValue('name'), - 'users', // the DB table - 'uuid', // a DB column with a unique constraint - { name: 'Elodie', id: 7 }, - { writeSql:true, execute: true, logValues: false } -) -``` - -* * * - -## upsertMany - -upsertMany(table, uuid, records, options) ⇒ Operation -Insert or update multiple records using ON CONFLICT UPDATE and excluded - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| table | string | The target table | -| uuid | string | The uuid column to determine a matching/existing record | -| records | function | A function that takes state and returns an array of records | -| options | object | Optional options argument | - -**Example** -```js -upsertMany( - 'users', 'email', records, { logValues: false } -) -upsertMany( - 'users', ['email', 'phone'], records, { logValues: false } -) -``` - -* * * - diff --git a/docs/mysql/CHANGELOG.md b/docs/mysql/CHANGELOG.md deleted file mode 100644 index e9c12ba73..000000000 --- a/docs/mysql/CHANGELOG.md +++ /dev/null @@ -1,117 +0,0 @@ -# @openfn/language-mysql - -## 1.4.8 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 1.4.7 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 1.4.6 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 1.4.5 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 1.4.4 - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 1.4.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 1.4.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 1.4.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 1.4.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 1.3.5 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 1.3.4 - -### Patch Changes - -- ef828e7: update old urls in readme -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 1.3.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 1.3.2 - -### Patch Changes - -- f2aed32: add examples - -## 1.3.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 1.3.0 - -### Minor Changes - -- 9d674c5: Migrate MySQL diff --git a/docs/mysql/README.md b/docs/mysql/README.md deleted file mode 100644 index d8ca91463..000000000 --- a/docs/mysql/README.md +++ /dev/null @@ -1,111 +0,0 @@ -# Language MySQL - -Language Pack for building expressions and operations to run MySQL queries. - -## Documentation - -View the [docs site](https://docs.openfn.org/adaptors/packages/mysql-docs) for -full technical documentation. - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/mysql-configuration-schema/) -definition. - -## Execute a query - -Execute an sql query with the node mysql package. - -```js -query({ - sql: state => { - return `select * from ${state.data.table} where id = ?;`; - }, - timeout: 4000, - values: ['007'], -}); -``` - -## Execute a sql query - -This function takes either a `string` or a `function` that takes states and -returns a string. - -```js -sqlString(state => { - return ( - `INSERT INTO untitled_table (name, the_geom) VALUES ('` + - state.data.version + - `', ` + - dataValue('form.Choix_tache')(state) + - `)` - ); -}); -``` - -## Insert a single record - -This function is used to insert a single record in a MySQL database. - -```js -insert( - 'some_table', - fields( - field('firstname', dataValue('form.patient_firstname')), - field('lastname', dataValue('form.patient_lastname')) - ) -); -``` - -## Insert or update a single record - -This function is used to insert a single record in a MySQL database or update it -if there is a match. - -```js -upsert( - 'some_table', - fields( - field('firstname', dataValue('form.patient_firstname')), - field('lastname', dataValue('form.patient_lastname')) - ) -); -``` - -## Upsert many records - -This function allows the upsert of a set of records inside a table all at once. - -```js -upsertMany( - 'users', // the DB table - [ - { name: 'one', email: 'one@openfn.org' }, - { name: 'two', email: 'two@openfn.org' }, - ] -); -``` - -or - -```js -upsertMany('users', state => - state.data.users.map(user => { - name: user['name'], - email: user['email'] - }) -); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/mysql/index.md b/docs/mysql/index.md deleted file mode 100644 index 74b359510..000000000 --- a/docs/mysql/index.md +++ /dev/null @@ -1,128 +0,0 @@ -## Functions - -
-
- insert(table, fields)
-
- query(options)
-
- sqlString(queryString)
-
- upsert(table, fields)
-
- upsertMany(table, data)
-
- - -## insert - -insert(table, fields) ⇒ Operation -Insert a record - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| table | string | The target table | -| fields | object | A fields object | - -**Example** -```js -execute( - insert('table', fields( - field('name', dataValue('name')) - )) -)(state) -``` - -* * * - -## query - -query(options) ⇒ Operation -Execute a SQL statement - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| options | object | Payload data for the message | - -**Example** -```js -execute( - query({ sql: 'select * from users;' }) -)(state) -``` - -* * * - -## sqlString - -sqlString(queryString) ⇒ Operation -Execute a SQL statement - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| queryString | String | A query string (or function which takes state and returns a string) | - -**Example** -```js -execute( - sqlString(state => "select * from items;") -)(state) -``` - -* * * - -## upsert - -upsert(table, fields) ⇒ Operation -Insert or Update a record if matched - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| table | string | The target table | -| fields | object | A fields object | - -**Example** -```js -execute( - upsert('table', fields( - field('name', dataValue('name')) - )) -)(state) -``` - -* * * - -## upsertMany - -upsertMany(table, data) ⇒ Operation -Insert or update multiple records using ON DUPLICATE KEY - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| table | string | The target table | -| data | array | An array of objects or a function that returns an array | - -**Example** -```js -upsertMany( - 'users', // the DB table - [ - { name: 'one', email: 'one@openfn.org' }, - { name: 'two', email: 'two@openfn.org' }, - ] -) -``` - -* * * - diff --git a/docs/nexmo/CHANGELOG.md b/docs/nexmo/CHANGELOG.md deleted file mode 100644 index bd1729d8f..000000000 --- a/docs/nexmo/CHANGELOG.md +++ /dev/null @@ -1,82 +0,0 @@ -# @openfn/language-nexmo - -## 0.4.3 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 0.4.2 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 0.4.1 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 0.4.0 - -### Minor Changes - -- 8591b67: - update nexmo to `v2.9.1`` - - expandReferences on sendSMS - -## 0.3.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.3.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.2.3 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.2.2 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.2.1 - -### Patch Changes - -- f2aed32: add examples - -## 0.2.0 - -### Minor Changes - -- f0f2495: migrate nexmo diff --git a/docs/nexmo/README.md b/docs/nexmo/README.md deleted file mode 100644 index aef7ef21e..000000000 --- a/docs/nexmo/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# Language Nexmo - -Language Pack for building expressions and operations to interact with the Nexmo -API. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/nexmo-configuration-schema/) -definition. - -### sendSMS - -#### sample expression - -```js -sendSMS('OpenFn', '0123456789', 'HelloWorld!'); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/nexmo/index.md b/docs/nexmo/index.md deleted file mode 100644 index 3ed71f689..000000000 --- a/docs/nexmo/index.md +++ /dev/null @@ -1,21 +0,0 @@ -## sendSMS - -sendSMS(from, toNumber, message) ⇒ Operation -Sends an SMS message to a specific phone number - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| from | String | Name or number the message should be sent from. | -| toNumber | String | Destination phone number. | -| message | String | Text message | - -**Example** -```js -sendSMS("OpenFn", "phoneNumber", "Hello World!") -``` - -* * * - diff --git a/docs/ocl/CHANGELOG.md b/docs/ocl/CHANGELOG.md deleted file mode 100644 index 636209074..000000000 --- a/docs/ocl/CHANGELOG.md +++ /dev/null @@ -1,155 +0,0 @@ -# @openfn/language-ocl - -## 1.1.7 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 1.1.6 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 1.1.5 - -### Patch Changes - -- 67a09fb: Add `fn` in OCL adaptor - -## 1.1.4 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 1.1.3 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 1.1.2 - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 1.1.1 - -### Patch Changes - -- 3f3c0c5: update tests -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 1.1.0 - -### Minor Changes - -- 29e335d: remove body in get request - -## 1.0.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 1.0.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 1.0.0 - -### Major Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.3.0 - -### Minor Changes - -- 63232eb: Add `get()` and `getMappings()` function - -## 0.2.6 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 0.2.5 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.2.4 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.2.3 - -### Patch Changes - -- f2aed32: add examples - -## 0.2.2 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.2.1 - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 0.2.0 - -### Minor Changes - -- 5a06d7f: Migrate OCL, update package export - -### Patch Changes - -- cb5d0ed: Updated to @openfn/simple-ast v0.4.1 -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 diff --git a/docs/ocl/README.md b/docs/ocl/README.md deleted file mode 100644 index 7ee4b009b..000000000 --- a/docs/ocl/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Language OCL - -Language Pack for building expressions and operations for working with the -[OCL API](http://ocl.github.io/ocl-docs/master/en/developer/html/ocl_developer_manual.html). - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/ocl-configuration-schema/) -definition. - -## Mapping source concepts to destination API - -#### Recieve form data from source application and convert data element keys to destination application. - -```js -map( "data": { - "a": 1, - "b": 2}, - {users:"haftamuk", sources: "eCHIS-CODES", concepts: "fp_new_at_10_to_14" } - ); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/ocl/index.md b/docs/ocl/index.md deleted file mode 100644 index b5a5277f5..000000000 --- a/docs/ocl/index.md +++ /dev/null @@ -1,76 +0,0 @@ -## Functions - -
-
- get(path, query, callback)
-
- getMappings(ownerId, repositoryId, [options], callback)
-
- - -## get - -get(path, query, callback) ⇒ Operation -Get a resource in OCL - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| path | string | Path to resource | -| query | object | A query object that will limit what resources are retrieved when converted into request params. | -| callback | function | (Optional) callback function | - -**Example** -```js -get( - "orgs/MSFOCG/collections/lime-demo/HEAD/mappings", - { - page: 1, - exact_match: "off", - limit: 200, - verbose: false, - sortDesc: "_score", - }, - (state) => { - // Add state oclMappings - const oclMappings = state.data; - return { ...state, data: {}, references: [], response: {}, oclMappings }; - } -); -``` - -* * * - -## getMappings - -getMappings(ownerId, repositoryId, [options], callback) ⇒ Operation -Get a source repository in OCL - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| ownerId | string | An OCL user or organization | -| repositoryId | string | An OCL collection id or source id | -| [options] | Object | Optional. `options` which can be passed to See more [on OCL swagger docs](https://api.openconceptlab.org/swagger/) | -| callback | function | (Optional) callback function | - -**Example** -```js -getMappings( - "MSFOCG", - "lime-demo", - { page: 1, exact_match: "off", verbose: false }, - (state) => { - // Add state oclMappings - const oclMappings = state.data; - return { ...state, data: {}, references: [], response: {}, oclMappings }; - } -); -``` - -* * * - diff --git a/docs/openfn/CHANGELOG.md b/docs/openfn/CHANGELOG.md deleted file mode 100644 index fb52bda25..000000000 --- a/docs/openfn/CHANGELOG.md +++ /dev/null @@ -1,122 +0,0 @@ -# @openfn/language-openfn - -## 1.3.8 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 1.3.7 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 1.3.6 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 1.3.5 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 1.3.4 - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 1.3.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 1.3.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 1.3.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 1.3.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 1.2.6 - -### Patch Changes - -- 779596f: Use native fetch (undici) in template and add icons in openfn - -## 1.2.5 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 1.2.4 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 1.2.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 1.2.2 - -### Patch Changes - -- f2aed32: add examples - -## 1.2.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 1.2.0 - -### Minor Changes - -- be9d3c6: Migrate OpenFn diff --git a/docs/openfn/README.md b/docs/openfn/README.md deleted file mode 100644 index e31d530ad..000000000 --- a/docs/openfn/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Language OpenFn - -Adaptor for building expressions and operations to interact with the OpenFn v1 -API. - -## Documentation - -## request - -```js -request({ - method: 'get', - path: 'jobs', - params: { - project_id: 490, - }, -}); -request( - { - method: 'post', - path: 'jobs', - data: { - trigger_id: 1, - expression: 'steps()', - }, - }, - state => { - console.log('cool callback!'); - return state; - } -); -``` - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/openfn-configuration-schema/) -definition. - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/openfn/index.md b/docs/openfn/index.md deleted file mode 100644 index 04a3fd3cd..000000000 --- a/docs/openfn/index.md +++ /dev/null @@ -1,20 +0,0 @@ -## request - -request(options, callback) ⇒ Operation -Make a POST request - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| options | object | Body, Query, Headers and Authentication parameters | -| callback | function | (Optional) Callback function | - -**Example** -```js -request({method: 'get', path: '/jobs/}); -``` - -* * * - diff --git a/docs/openhim/CHANGELOG.md b/docs/openhim/CHANGELOG.md deleted file mode 100644 index 53ecec6b2..000000000 --- a/docs/openhim/CHANGELOG.md +++ /dev/null @@ -1,65 +0,0 @@ -# @openfn/language-openhim - -## 0.2.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.2.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.1.4 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.1.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.1.2 - -### Patch Changes - -- f2aed32: add examples - -## 0.1.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.1.0 - -### Minor Changes - -- 1fd9b3b: Migrate OpenHIM - -### Patch Changes - -- e4ebcb6: Fix Large gzip Denial of Service in superagent -- e81561f: Updated ast and package.json diff --git a/docs/openhim/README.md b/docs/openhim/README.md deleted file mode 100644 index d395cd45f..000000000 --- a/docs/openhim/README.md +++ /dev/null @@ -1,157 +0,0 @@ -# Language OpenHIM - -Language Pack for building expressions and operations for working with the -openhim API. - -## [HL7 FHIR Standard](https://www.hl7.org/fhir/patient-example.json.html) - -```json -{ - "resourceType": "Patient", - "id": "example", - "text": { - "status": "generated", - "div": "
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
NamePeter James \n Chalmers ("Jim")\n
Address534 Erewhon, Pleasantville, Vic, 3999
ContactsHome: unknown. Work: (03) 5555 6473
IdMRN: 12345 (Acme Healthcare)
\n \n
" - }, - "identifier": [ - { - "fhir_comments": [" MRN assigned by ACME healthcare on 6-May 2001 "], - "use": "usual", - "type": { - "coding": [ - { - "system": "http://hl7.org/fhir/v2/0203", - "code": "MR" - } - ] - }, - "system": "urn:oid:1.2.36.146.595.217.0.1", - "value": "12345", - "period": { - "start": "2001-05-06" - }, - "assigner": { - "display": "Acme Healthcare" - } - } - ], - "active": true, - "name": [ - { - "fhir_comments": [" Peter James Chalmers, but called \"Jim\" "], - "use": "official", - "family": ["Chalmers"], - "given": ["Peter", "James"] - }, - { - "use": "usual", - "given": ["Jim"] - } - ], - "telecom": [ - { - "fhir_comments": [" home communication details aren't known "], - "use": "home" - }, - { - "system": "phone", - "value": "(03) 5555 6473", - "use": "work" - } - ], - "gender": "male", - "_gender": { - "fhir_comments": [" use FHIR code system for male / female "] - }, - "birthDate": "1974-12-25", - "_birthDate": { - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime", - "valueDateTime": "1974-12-25T14:35:45-05:00" - } - ] - }, - "deceasedBoolean": false, - "address": [ - { - "use": "home", - "type": "both", - "line": ["534 Erewhon St"], - "city": "PleasantVille", - "district": "Rainbow", - "state": "Vic", - "postalCode": "3999", - "period": { - "start": "1974-12-25" - } - } - ], - "contact": [ - { - "relationship": [ - { - "coding": [ - { - "system": "http://hl7.org/fhir/patient-contact-relationship", - "code": "partner" - } - ] - } - ], - "name": { - "family": ["du", "Marché"], - "_family": [ - { - "extension": [ - { - "fhir_comments": [ - " the \"du\" part is a family name prefix (VV in iso 21090) " - ], - "url": "http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier", - "valueCode": "VV" - } - ] - }, - null - ], - "given": ["Bénédicte"] - }, - "telecom": [ - { - "system": "phone", - "value": "+33 (237) 998327" - } - ], - "gender": "female", - "period": { - "start": "2012", - "_start": { - "fhir_comments": [" The contact relationship started in 2012 "] - } - } - } - ], - "managingOrganization": { - "reference": "Organization/1" - } -} -``` - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/openhim-configuration-schema/) -definition. - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/openhim/index.md b/docs/openhim/index.md deleted file mode 100644 index 6ea907e16..000000000 --- a/docs/openhim/index.md +++ /dev/null @@ -1,20 +0,0 @@ -## encounter - -encounter(encounterData) ⇒ Operation -Create an encounter - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| encounterData | object | Payload data for the encounter | - -**Example** -```js -execute( - encounter(data) -)(state) -``` - -* * * - diff --git a/docs/openmrs/CHANGELOG.md b/docs/openmrs/CHANGELOG.md deleted file mode 100644 index 7d6c5c738..000000000 --- a/docs/openmrs/CHANGELOG.md +++ /dev/null @@ -1,162 +0,0 @@ -# @openfn/language-openmrs - -## 2.0.8 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 2.0.7 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 2.0.6 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 2.0.5 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 2.0.4 - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 2.0.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 2.0.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 2.0.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 2.0.0 - -### Major Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 1.1.1 - -### Patch Changes - -- 2390129: - replace throw new Error with console.log - - improve Log function - -## 1.1.0 - -### Minor Changes - -- d124f67: - Add create, update and upsert function - - Add callback support and improve examples for - - get() - - post() - - getPatient() - - searchPerson() - - getEncounter() - - searchPatient() - - createPatient() - - getEncounters() - - createEncounter() - -## 1.0.1 - -### Patch Changes - -- 97cc7ce: - Fix checking for empty response - - Style logs output - -## 1.0.0 - -### Major Changes - -- b6478c0: - Removed `request` in favour of `superagent` - - Improve error handling - - Moved `login` to execute function - - Added - - `createPatient` - - `searchPatient` - - `searchPerson` - - `getEncounters` - - `getEncounter` - - `get` - - `post` - -## 0.10.5 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 0.10.4 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.10.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.10.2 - -### Patch Changes - -- f2aed32: add examples - -## 0.10.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.10.0 - -### Minor Changes - -- 6786949: Migrate OpenMRS diff --git a/docs/openmrs/README.md b/docs/openmrs/README.md deleted file mode 100644 index 55e92970d..000000000 --- a/docs/openmrs/README.md +++ /dev/null @@ -1,110 +0,0 @@ -# Language OpenMRS - -Language Pack for building expressions and operations for working with the -[OpenMRS API](https://wiki.openmrs.org/display/docs/API). - -[OpenMRS Data Model Explorer](http://burkeware.com/openmrs-data-model/openmrs-data-model-1.11.html#) - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/openmrs-configuration-schema/) -definition. - -### Get a patient by some criteria - -```js -// getPatient({ uuid: '516af9aa-0402-4e11-ad79-e394fdec0c91' }); -// getPatient({ uuid: dataValue('patientId')(state) }); -getPatient({ - uuid: state => state.data[0].uuid, -}); -``` - -#### Example of searching for patients based on their `EMR Id` - -```js -getPatients( - { - identifier: state => state.data.emrId, - v: 'full', - }, - { - exactlyOne: true, - } -); -``` - -### Create an Encounter - -```js -createEncounter({ - encounterDatetime: dataValue('visit_date'), //dynamically fill with source app data - patient: dataValue('uuid'), - encounterType: dataValue('visit_type'), - location: dataValue('location.uuid'), - encounterProviders: [ - { - provider: dataValue('provider_name'), - encounterRole: '240b26f9-dd88-4172-823d-4a8bfeb7841f', //hardcoded value - }, - ], -}); -``` - -### Make a request to any OpenMRS endpoint - -```js -req({ method: 'GET', url: '/ws/rest/v1/concept' }, state => { - console.log(JSON.stringify(state, null, 2)); - return state; -}); -``` - - - -## Create new patient - -```js -patient( - fields( - field('gender', 'M'), - field('names', function (state) { - return [ - { - patient_id: dataValue('form.patientId')(state), - creator: dataValue('form.user')(state), - }, - ]; - }) - ) -); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/openmrs/index.md b/docs/openmrs/index.md deleted file mode 100644 index d8538cbaf..000000000 --- a/docs/openmrs/index.md +++ /dev/null @@ -1,353 +0,0 @@ -## Functions - -
-
- create(resourceType, data, [callback])
-
- createEncounter(data, [callback])
-
- createPatient(data, [callback])
-
- get(path, query, [callback])
-
- getEncounter(uuid, [callback])
-
- getEncounters(query, [callback])
-
- getPatient(uuid, [callback])
-
- post(path, data, [callback])
-
- searchPatient(query, [callback])
-
- searchPerson(query, [callback])
-
- update(resourceType, path, data, [callback])
-
- upsert(resourceType, query, data, [callback])
-
- - -## create - -create(resourceType, data, [callback]) ⇒ Operation -Create a record - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| resourceType | string | Type of resource to create. E.g. `person`, `patient`, `encounter`, ... | -| data | OpenMRSData | Object which defines data that will be used to create a given instance of resource. To create a single instance of a resource, `data` must be a javascript object, and to create multiple instances of a resources, `data` must be an array of javascript objects. | -| [callback] | function | Optional callback to handle the response | - -**Example** *(Create a person)* -```js -create("person", { - names: [ - { - givenName: "Mohit", - familyName: "Kumar", - }, - ], - gender: "M", - birthdate: "1997-09-02", - addresses: [ - { - address1: "30, Vivekananda Layout, Munnekolal,Marathahalli", - cityVillage: "Bengaluru", - country: "India", - postalCode: "560037", - }, - ], -}); -``` - -* * * - -## createEncounter - -createEncounter(data, [callback]) ⇒ Operation -Creates an encounter - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| data | object | Data parameters of the encounter | -| [callback] | function | Optional callback to handle the response | - -**Example** *(Create an encounter)* -```js -createEncounter({ - encounterDatetime: '2023-05-25T06:08:25.000+0000', - patient: '1fdaa696-e759-4a7d-a066-f1ae557c151b', - encounterType: 'dd528487-82a5-4082-9c72-ed246bd49591', - location: 'ba685651-ed3b-4e63-9b35-78893060758a', - encounterProviders: [], - visit: { - patient: '1fdaa696-e759-4a7d-a066-f1ae557c151b', - visitType: '7b0f5697-27e3-40c4-8bae-f4049abfb4ed', - startDatetime: '2023-05-25T06:08:25.000+0000', - stopDatetime: '2023-05-25T06:09:25.000+0000', - }, -}) -``` - -* * * - -## createPatient - -createPatient(data, [callback]) ⇒ Operation -Creates a new patient - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| data | object | Object parameters of the patient | -| [callback] | function | Optional callback to handle the response | - -**Example** -```js -createPatient({ - identifiers: [ - { - identifier: '4023287', - identifierType: '05a29f94-c0ed-11e2-94be-8c13b969e334', - preferred: true, - }, - ], - person: { - gender: 'M', - age: 42, - birthdate: '1970-01-01T00:00:00.000+0100', - birthdateEstimated: false, - names: [ - { - givenName: 'Doe', - familyName: 'John', - }, - ], - }, -}) -``` - -* * * - -## get - -get(path, query, [callback]) ⇒ Operation -Make a get request to any OpenMRS endpoint - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| path | string | Path to resource | -| query | object | parameters for the request | -| [callback] | function | Optional callback to handle the response | - -**Example** -```js -get("patient", { - q: "Patient", - limit: 1, -}); -``` - -* * * - -## getEncounter - -getEncounter(uuid, [callback]) ⇒ Operation -Gets encounter matching a uuid - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| uuid | object | A uuid for the encounter | -| [callback] | function | Optional callback to handle the response | - -**Example** -```js -getEncounter("123") -``` - -* * * - -## getEncounters - -getEncounters(query, [callback]) ⇒ Operation -Gets encounters matching params - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| query | object | Object for the patient | -| [callback] | function | Optional callback to handle the response | - -**Example** -```js -getEncounters({patient: "123", fromdate: "2023-05-18"}) -``` - -* * * - -## getPatient - -getPatient(uuid, [callback]) ⇒ Operation -Gets patient matching a uuid - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| uuid | string | A uuid for the patient | -| [callback] | function | Optional callback to handle the response | - -**Example** -```js -getPatient("123") -``` -**Example** *(Get a patient by uuid)* -```js -getPatient('681f8785-c9ca-4dc8-a091-7b869316ff93') -``` - -* * * - -## post - -post(path, data, [callback]) ⇒ Operation -Make a post request to any OpenMRS endpoint - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| path | string | Path to resource | -| data | object | Object which defines data that will be used to create a given instance of resource | -| [callback] | function | Optional callback to handle the response | - -**Example** -```js -post( - "idgen/identifiersource/8549f706-7e85-4c1d-9424-217d50a2988b/identifier", - {} -); -``` - -* * * - -## searchPatient - -searchPatient(query, [callback]) ⇒ Operation -Fetch all non-retired patients that match any specified parameters - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| query | object | Object with query for the patient | -| [callback] | function | Optional callback to handle the response | - -**Example** -```js -searchPatient({ q: Sarah }) -``` - -* * * - -## searchPerson - -searchPerson(query, [callback]) ⇒ Operation -Fetch all non-retired persons that match any specified parameters - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| query | object | object with query for the person | -| [callback] | function | Optional callback to handle the response | - -**Example** -```js -searchPerson({ q: Sarah }) -``` - -* * * - -## update - -update(resourceType, path, data, [callback]) ⇒ Operation -Update data. A generic helper function to update a resource object of any type. -Updating an object requires to send `all required fields` or the `full body` - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| resourceType | string | The type of resource to be updated. E.g. `person`, `patient`, etc. | -| path | string | The `id` or `path` to the `object` to be updated. E.g. `e739808f-f166-42ae-aaf3-8b3e8fa13fda` or `e739808f-f166-42ae-aaf3-8b3e8fa13fda/{collection-name}/{object-id}` | -| data | Object | Data to update. It requires to send `all required fields` or the `full body`. If you want `partial updates`, use `patch` operation. | -| [callback] | function | Optional callback to handle the response | - -**Example** *(a person)* -```js -update("person", '3cad37ad-984d-4c65-a019-3eb120c9c373',{"gender":"M","birthdate":"1997-01-13"}) -``` - -* * * - -## upsert - -upsert(resourceType, query, data, [callback]) ⇒ Operation -Upsert a record. A generic helper function used to atomically either insert a row, or on the basis of the row already existing, UPDATE that existing row instead. - -**Kind**: global function -**Throws**: - -- RangeError - Throws range error - -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| resourceType | string | The type of a resource to `upsert`. E.g. `trackedEntityInstances` | -| query | Object | A query object that allows to uniquely identify the resource to update. If no matches found, then the resource will be created. | -| data | Object | The data to use for update or create depending on the result of the query. | -| [callback] | function | Optional callback to handle the response | - -**Example** *(For an existing patient using upsert)* -```js -upsert('patient', { q: '10007JJ' }, { person: { age: 50 } }); -``` -**Example** *(For non existing patient creating a patient record using upsert )* -```js -upsert( - "patient", - { q: "1000EHE" }, - { - identifiers: [ - { - identifier: "1000EHE", - identifierType: "05a29f94-c0ed-11e2-94be-8c13b969e334", - location: "44c3efb0-2583-4c80-a79e-1f756a03c0a1", - preferred: true, - }, - ], - person: { - gender: "M", - age: 42, - }, - } -); -``` - -* * * - diff --git a/docs/openspp/CHANGELOG.md b/docs/openspp/CHANGELOG.md deleted file mode 100644 index 863ab4ae6..000000000 --- a/docs/openspp/CHANGELOG.md +++ /dev/null @@ -1,40 +0,0 @@ -# @openfn/language-openspp - -## 1.2.0 - -### Changes - -- 05defd2: add new functions, correcting docstring and add more examples - - correcting docstring input parameters type - - changing getServicePoint() from get by name into get by unique id - - add more examples in docstring - - getArea(): get existing area by id - - searchArea(): search existing area by domain - - searchServicePoint(): search existing service point by domain - -## 1.1.1 - -### Patch Changes - -- 48b4e97: update `spp date time now string` format - -## 1.1.0 - -- Create OpenSPP adaptor with these functions: - - getGroup(): get existing group information - - getIndividual(): get existing individual information - - searchGroup(): search existing group by domain - - searchIndividual(): search existing individual by domain - - getGroupMembers(): get members from group - - getServicePoint(): get service points by name - - getPrograms(): get single program - - getPrograms(): get program list - - getEnrolledPrograms(): get list of enrolled program for each beneficiary - - enroll(): enroll beneficiary to a program - - unenroll(): unenroll beneficiary from program - - createIndividual(): create new individual - - updateIndividual(): update existing individual - - createGroup(): create new group - - updateGroup(): update existing group - - addToGroup(): add individual to group with(out) role - - removeFromGroup(): end membership of individual to group diff --git a/docs/openspp/README.md b/docs/openspp/README.md deleted file mode 100644 index 1a5419834..000000000 --- a/docs/openspp/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# language-openspp - -An OpenFn **_adaptor_** for building integration jobs for use with OpenSPP -API. - -## Documentation - -View the [docs site](https://docs.openfn.org/adaptors/packages/openspp-docs) -for full technical documentation. - -### Configuration - -View the -[configuration-schema](https://docs.openfn.org/adaptors/packages/openspp-configuration-schema/) -for required and optional `configuration` properties. - -### A example expression using the `getServicePoint` function - -```js -getServicePoint("newagentflour"); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -"Getting Started" guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To build _only_ the docs run `pnpm build docs`. diff --git a/docs/openspp/index.md b/docs/openspp/index.md deleted file mode 100644 index 70dd5908c..000000000 --- a/docs/openspp/index.md +++ /dev/null @@ -1,484 +0,0 @@ -## Functions - -
-
- addToGroup(group_id, individual_id, role)
-
- createGroup(data, callback)
-
- createIndividual(data, callback)
-
- enroll(spp_id, program_id)
-
- getArea(spp_id, callback)
-
- getEnrolledPrograms(spp_id, callback)
-
- getGroup(spp_id, callback)
-
- getGroupMembers(spp_id, [options], callback)
-
- getIndividual(spp_id, callback)
-
- getProgram(program_id, callback)
-
- getPrograms([options], callback)
-
- getServicePoint(spp_id, callback)
-
- removeFromGroup(group_id, individual_id)
-
- searchArea(domain, [options], callback)
-
- searchGroup(domain, [options], callback)
-
- searchIndividual(domain, [options], callback)
-
- searchServicePoint(domain, [options], callback)
-
- unenroll(spp_id, program_id)
-
- updateGroup(group_id, data)
-
- updateIndividual(individual_id, data)
-
- - -## addToGroup - -addToGroup(group_id, individual_id, role) ⇒ Operation -add individual to group in OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| group_id | string | group registrant id | -| individual_id | string | individual registrant id | -| role | string | individual role in group | - -**Example** *(create a new head for group)* -```js -addToGroup("GRP_B2BRHJN2", "IND_8DUQL4M4", "Head") -``` -**Example** *(create a new ordinary member for group)* -```js -addToGroup("GRP_B2BRHJN2", "IND_8DUQL4M4") -``` -**Example** *(create a new member with new role for group)* -```js -addToGroup("GRP_B2BRHJN2", "IND_8DUQL4M4", "new-role-name") -``` - -* * * - -## createGroup - -createGroup(data, callback) ⇒ Operation -create new group for OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| data | object | registrant create data | -| callback | function | An optional callback function | - -**Example** -```js -createGroup({ name: "Group 1" }) -``` - -* * * - -## createIndividual - -createIndividual(data, callback) ⇒ Operation -create new individual for OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| data | object | registrant create data | -| callback | function | An optional callback function | - -**Example** -```js -createIndividual({ name: "Individual 1" }) -``` - -* * * - -## enroll - -enroll(spp_id, program_id) -enroll registrant to program in OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| spp_id | string | spp_id of group / individual wanted to enroll | -| program_id | string | program_id of program | - -**Example** -```js -enroll("IND_Q4VGGZPF", "PROG_2023_00000001") -``` - -* * * - -## getArea - -getArea(spp_id, callback) ⇒ Operation -get area by id in OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| spp_id | string | spp_id of area | -| callback | function | An optional callback function | - -**Example** -```js -getArea("LOC_7M92NLDH") -``` - -* * * - -## getEnrolledPrograms - -getEnrolledPrograms(spp_id, callback) ⇒ Operation -get programs list for specific registrant from OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| spp_id | string | spp_id of group / individual wanted to search | -| callback | function | An optional callback function | - -**Example** -```js -getEnrolledPrograms("IND_Q4VGGZPF") -``` - -* * * - -## getGroup - -getGroup(spp_id, callback) ⇒ Operation -get group information from OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| spp_id | string | The spp_id of the group | -| callback | function | An optional callback function | - -**Example** -```js -getGroup("GRP_Q4VGGZPF") -``` - -* * * - -## getGroupMembers - -getGroupMembers(spp_id, [options], callback) ⇒ Operation -get group members information from OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| spp_id | string | | The name of the group | -| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records | -| callback | function | | An optional callback function | - -**Example** -```js -getGroupMembers("GRP_Q4VGGZPF") -``` - -* * * - -## getIndividual - -getIndividual(spp_id, callback) ⇒ Operation -get individual information from OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| spp_id | string | The spp_id of the individual | -| callback | function | An optional callback function | - -**Example** -```js -getIndividual("IND_Q4VGGZPF") -``` - -* * * - -## getProgram - -getProgram(program_id, callback) ⇒ Operation -get program information from OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| program_id | string | searching domain | -| callback | function | An optional callback function | - -**Example** -```js -getProgram("PROG_2023_00000001") -``` - -* * * - -## getPrograms - -getPrograms([options], callback) ⇒ Operation -get programs list from OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | number | {} | offset from start | -| callback | function | | An optional callback function | - -**Example** -```js -getPrograms(100) -``` - -* * * - -## getServicePoint - -getServicePoint(spp_id, callback) ⇒ Operation -get service points information from OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| spp_id | string | The spp_id of the agent | -| callback | function | An optional callback function | - -**Example** -```js -getServicePoint("SVP_8P4KP4RT") -``` - -* * * - -## removeFromGroup - -removeFromGroup(group_id, individual_id) ⇒ Operation -remove individual from group in OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| group_id | string | group registrant id | -| individual_id | string | individual registrant id | - -**Example** -```js -removeFromGroup("GRP_B2BRHJN2", "IND_8DUQL4M4") -``` - -* * * - -## searchArea - -searchArea(domain, [options], callback) ⇒ Operation -searching for service point in OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| domain | Array | | searching domain | -| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records | -| callback | function | | An optional callback function | - -**Example** *(search without offset)* -```js -searchArea([["code", "=", "10732"]]) -``` -**Example** *(search with offset)* -```js -searchArea([["kind", "=", 1]], { offset: 10 }}) -``` - -* * * - -## searchGroup - -searchGroup(domain, [options], callback) ⇒ Operation -get groups from OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| domain | Array | | searching domain | -| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for ordering search, offset for skipping records | -| callback | function | | An optional callback function | - -**Example** *(search group by domain)* -```js -searchGroup([["spp_id", "=", "GRP_Q4VGGZPF"]]) -``` -**Example** *(search group by domain with offset)* -```js -searchGroup([["spp_id", "ilike", "GRP"]], { offset: 100 }}) -``` -**Example** *(search group by complex domain for more accuracy)* -```js -searchGroup([["address", "!=", false], ["phone", "!=", false]]) -``` - -* * * - -## searchIndividual - -searchIndividual(domain, [options], callback) ⇒ Operation -get individuals from OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| domain | Array | | searching domain | -| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records | -| callback | function | | An optional callback function | - -**Example** *(search individual by domain)* -```js -searchIndividual([["spp_id", "=", "IND_Q4VGGZPF"]]) -``` -**Example** *(search individual by domain with offset)* -```js -searchIndividual([["spp_id", "ilike", "IND"]], { offset: 100 }) -``` -**Example** *(search individual by complex domain for more accuracy)* -```js -searchIndividual([["address", "!=", false], ["birthdate", "=", false]]) -``` - -* * * - -## searchServicePoint - -searchServicePoint(domain, [options], callback) ⇒ Operation -searching for service point in OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| domain | Array | | searching domain | -| [options] | object | {} | Searching options, eg: limit for limiting number of records returning, order for searching order, offset for skipping records | -| callback | function | | An optional callback function | - -**Example** *(search without offset)* -```js -searchServicePoint([["name", "ilike", "agent 1"]]) -``` -**Example** *(search with offset)* -```js -searchServicePoint([["name", "ilike", "agent 1"]], { offset: 100 }) -``` - -* * * - -## unenroll - -unenroll(spp_id, program_id) -unenroll registrant from program in OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| spp_id | string | spp_id of group / individual wanted to unenroll | -| program_id | string | program_id of program | - -**Example** -```js -unenroll("IND_Q4VGGZPF", "PROG_2023_00000001") -``` - -* * * - -## updateGroup - -updateGroup(group_id, data) ⇒ Operation -update group for OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| group_id | string | group registrant id | -| data | object | registrant update data | - -**Example** -```js -updateGroup("GRP_B2BRHJN2", { name: "Group 1" }) -``` - -* * * - -## updateIndividual - -updateIndividual(individual_id, data) ⇒ Operation -update individual for OpenSPP - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| individual_id | string | individual registrant id | -| data | object | registrant update data | - -**Example** -```js -updateIndividual("IND_8DUQL4M4", { name: "Individual 1" }) -``` - -* * * - diff --git a/docs/postgresql/CHANGELOG.md b/docs/postgresql/CHANGELOG.md deleted file mode 100644 index 50f4adb02..000000000 --- a/docs/postgresql/CHANGELOG.md +++ /dev/null @@ -1,141 +0,0 @@ -# @openfn/language-postgresql - -## 4.1.8 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 4.1.7 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 4.1.6 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 4.1.5 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 4.1.4 - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 4.1.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 4.1.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 4.1.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 4.1.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 4.0.0 - -### Major Changes - -- ecd0b53: add optional callback in sql and update response structure - -## 3.4.6 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 3.4.5 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 3.4.4 - -### Patch Changes - -- f2aed32: add examples - -## 3.4.3 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 3.4.2 - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 3.4.1 - -### Patch Changes - -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 - -## 3.4.0 - -### Minor Changes - -- 44ae341: Migrate postgresql - -### Patch Changes - -- e04aa28: Rename credential-schema to configuration-schema, update descriptions diff --git a/docs/postgresql/README.md b/docs/postgresql/README.md deleted file mode 100644 index 444718fba..000000000 --- a/docs/postgresql/README.md +++ /dev/null @@ -1,208 +0,0 @@ -# Language PostgreSQL - -Language Pack for building expressions and operations to run PostgreSQL queries. - -## Documentation - -## required configuration for Heroku postgres - -```json -{ - "host": "some-host-url.compute-1.amazonaws.com", - "port": "5432", - "database": "wouldntyouliketoknow", - "user": "me", - "password": "noway", - "ssl": true, - "allowSelfSignedCert": true -} -``` - -## `sql(query)` - -Execute an sql query. An option can be added to either log the query or not and -either execute the query or no. The options can be omitted as well. - -#### sample usage - -```js -sql( - state => - `INSERT INTO untitled_table (name, the_geom) VALUES ('` + - dataValue('form.first_name')(state) + - `', ST_SetSRID(ST_Point(` + - dataValue('lat')(state) + - `, ` + - dataValue('long')(state) + - `),4326))`, - { writeSql: true, execute: true } -); -``` - -## Find a single value for a table - -This helper function allows to build a specific query where `sql` would not be -best suited. It returns a single value and not a promise. An example of usage -would be in building a mapping object with a value from a lookup table. - -```js -alterState(async state => { - const user = { - id: 1, - name: 'Mamadou', - user_id: await findValue({ - uuid: 'id', - relation: 'users', - where: { first_name: 'Mama%' }, - operator: { first_name: 'like' }, // operator is optional. "=" is used by default. - })(state), - }; - - return upsert(...)(state); -}); -``` - -## Insert a single record - -This functions is used to insert a single record in postgres database. An option -`writeSql` allows to log the generated sql query. The `setNull` option allows to -replace the specified elements with `NULL`. - -```js -insert( - 'users', - { - email: 'antony@gmail.com', - first_name: 'Antony', - inserted_at: '2020-08-27 00:00:00', - updated_at: '2020-08-27 00:00:00', - }, - { setNull: ["''", "'undefined'"], writeSql: true, logValues: true } -); -``` - -## Insert or Update using a unique column as a key - -Insert or Update if matched. An option, `execute`, allows to either run the -generated query or no. - -```js -upsert( - 'users', - 'email', - { - email: 'luca@openfn.org', - first_name: 'Luca', - inserted_at: '2010-01-01 00:00:00', - updated_at: '2010-01-01 00:00:00', - }, - { - setNull: ["'NaN'", "'undefined'"], - writeSql: false, - execute: true, - logValues: true, - } -); -``` - -## Insert or Update if a value exist in the record - -This function will upsert a record only if the logical given is true. In this -case we check if `dataValue('name')` exists. - -```js -upsertIf(dataValue('name'), 'users', 'ON CONSTRAINT users_pkey', { - name: 'Elodie', - id: 7, -}); -``` - -## Insert many records in postgresql - -This function allows the insert of a set of records inside a table all at once. - -```js -insertMany( - 'users', - state => - state.data.people.map(s => { - return { - first_name: ['Luca', 'Mohamed', 'Elodie'], - inserted_at: '2020-01-01 00:00:00', - updated_at: '2020-01-01 00:00:00', - }; - }), - { logValues: true } -); -``` - -## Upsert many records in postgresql - -This function allows the upsert of a set of records inside a table all at once. - -```js -upsertMany('users', 'ON CONSTRAINT users_pkey', state => - state.data.people.map(s => { - return { - first_name: ['Luca', 'Mohamed', 'Elodie'], - inserted_at: '2020-01-01 00:00:00', - updated_at: '2020-01-01 00:00:00', - }; - }) -); -``` - -## Describe a table from postgres - -This function is used to fetch the list of columns of a given table in the -database. - -```js -describeTable('users', { writeSql: true, execute: false }); -``` - -## Create a table in the database - -This function allows to create a table in a database from a given array of -columns. The key `identity` can be use for a column to auto-generate a value. - -```js -insertTable('users', state => - state.data.map(column => ({ - name: column.name, - type: column.type, - required: true, // optional - unique: false, // optional - set to true for unique constraint - })) -); -``` - -## Alter a table in the database - -This function allows to add new columns to a table. Beware of the fact that you -cannot add new columns with names that already exist in the table. - -```js -modifyTable( - 'users', - state => - state.data.map(newColumn => ({ - name: newColumn.name, - type: newColumn.type, - required: true, // optional - unique: false, // optional - set to true for unique constraint - })), - { writeSql: false, execute: true } -); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/postgresql/index.md b/docs/postgresql/index.md deleted file mode 100644 index 837341735..000000000 --- a/docs/postgresql/index.md +++ /dev/null @@ -1,315 +0,0 @@ -## Functions - -
-
- describeTable(tableName, [options], callback)
-
- findValue([filter])
-
- insert(table, record, [options], callback)
-
- insertMany(table, records, [options], callback)
-
- insertTable(tableName, columns, [options], callback)
-
- modifyTable(tableName, columns, [options], callback)
-
- sql(sqlQuery, [options], callback)
-
- upsert(table, uuid, record, [options], callback)
-
- upsertIf(logical, table, uuid, record, [options], callback)
-
- upsertMany(table, uuid, data, [options], callback)
-
- - -## describeTable - -describeTable(tableName, [options], callback) ⇒ Operation -List the columns of a table in a database. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| tableName | string | The name of the table to describe | -| [options] | object | Optional options argument | -| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | -| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | -| callback | function | (Optional) callback function | - -**Example** -```js -describeTable('clinic_visits') -``` - -* * * - -## findValue - -findValue([filter]) ⇒ value -Fetch a uuid key given a condition - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| [filter] | object | A filter object with the lookup table, a uuid and the condition | -| [filter.uuid] | string | The uuid value to search for in the specified relation. | -| [filter.relation] | string | The name of the relation to search for the uuid value. | -| [filter.where] | object | An object that contains key-value pairs to filter the search results. | -| [filter.operator] | object | An object that contains key-value pairs to specify the type of comparison to perform on the where clause. | - -**Example** -```js -findValue({ - uuid: 'id', - relation: 'users', - where: { first_name: 'Mamadou' }, - operator: { first_name: 'like' } - }) -``` - -* * * - -## insert - -insert(table, record, [options], callback) ⇒ Operation -Insert a record - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| table | string | The target table | -| record | object | Payload data for the record as a JS object or function | -| [options] | object | Optional options argument | -| [options.setNull] | string | A string value that specifies the behavior for inserting null values. | -| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. | -| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | -| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | -| callback | function | (Optional) callback function | - -**Example** -```js -insert('users', { name: 'Elodie', id: 7 }, { setNull: "'NaN'", logValues: true }); -``` - -* * * - -## insertMany - -insertMany(table, records, [options], callback) ⇒ Operation -Insert many records, using the keys of the first as the column template - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| table | string | The target table | -| records | array | An array or a function that takes state and returns an array | -| [options] | object | Optional options argument | -| [options.setNull] | string | A string value that specifies the behavior for inserting null values. | -| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. | -| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | -| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | -| callback | function | (Optional) callback function | - -**Example** -```js -insertMany('users', state => state.data.recordArray, { setNull: "'undefined'", logValues: true }); -``` - -* * * - -## insertTable - -insertTable(tableName, columns, [options], callback) ⇒ Operation -Create a table in database when given an array of columns and a table_name. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| tableName | string | The name of the table to create | -| columns | array | An array of form columns | -| [options] | object | Optional options argument | -| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | -| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | -| callback | function | (Optional) callback function | - -**Example** -```js -insertTable('table_name', state => state.data.map( - column => ({ - name: column.name, - type: column.type, - required: true, // optional - unique: false, // optional - to be set to true for unique constraint - }) -)); -``` - -* * * - -## modifyTable - -modifyTable(tableName, columns, [options], callback) ⇒ Operation -Alter an existing table in the database. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| tableName | string | The name of the table to alter | -| columns | array | An array of form columns | -| [options] | object | Optional options argument | -| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | -| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | -| callback | function | (Optional) callback function | - -**Example** -```js -modifyTable('table_name', state => state.data.map( - newColumn => ({ - name: newColumn.name, - type: newColumn.type, - required: true, // optional - unique: false, // optional - to be set to true for unique constraint - }) -)); -``` - -* * * - -## sql - -sql(sqlQuery, [options], callback) ⇒ Operation -Execute an SQL statement - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| sqlQuery | function | a function which takes state and returns a string of SQL. | -| [options] | object | Optional options argument | -| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | -| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | -| callback | function | (Optional) callback function | - -**Example** -```js -sql(state => `select(*) from ${state.data.tableName};`, { writeSql: true }) -``` - -* * * - -## upsert - -upsert(table, uuid, record, [options], callback) ⇒ Operation -Insert or update a record using ON CONFLICT UPDATE - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| table | string | The target table | -| uuid | string | The uuid column to determine a matching/existing record | -| record | object | Payload data for the record as a JS object or function | -| [options] | object | Optional options argument | -| [options.setNull] | string | A string value that specifies the behavior for inserting null values. | -| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | -| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | -| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. | -| callback | function | (Optional) callback function | - -**Example** -```js -upsert( - 'users', // the DB table - 'ON CONSTRAINT users_pkey', // a DB column with a unique constraint OR a CONSTRAINT NAME - { name: 'Elodie', id: 7 }, - { setNull: ["''", "'undefined'"], writeSql:true, execute: true, logValues: true } -) -``` - -* * * - -## upsertIf - -upsertIf(logical, table, uuid, record, [options], callback) ⇒ Operation -Insert or update a record based on a logical condition using ON CONFLICT UPDATE - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| logical | string | a data to check existing value for. | -| table | string | The target table | -| uuid | string | The uuid column to determine a matching/existing record | -| record | object | Payload data for the record as a JS object or function | -| [options] | object | Optional options argument | -| [options.setNull] | string | A string value that specifies the behavior for inserting null values. | -| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | -| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | -| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. | -| callback | function | (Optional) callback function | - -**Example** -```js -upsertIf( - dataValue('name'), - 'users', // the DB table - 'ON CONSTRAINT users_pkey', // a DB column with a unique constraint OR a CONSTRAINT NAME - { name: 'Elodie', id: 7 }, - { writeSql:true, execute: true } -) -``` - -* * * - -## upsertMany - -upsertMany(table, uuid, data, [options], callback) ⇒ Operation -Insert or update multiple records using ON CONFLICT UPDATE and excluded - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| table | string | The target table | -| uuid | string | The uuid column to determine a matching/existing record | -| data | array | An array of objects or a function that returns an array | -| [options] | object | Optional options argument | -| [options.setNull] | string | A string value that specifies the behavior for inserting null values. | -| [options.writeSql] | boolean | A boolean value that specifies whether to log the generated SQL statement. Defaults to false. | -| [options.execute] | boolean | A boolean value that specifies whether to execute the generated SQL statement. Defaults to false. | -| [options.logValues] | boolean | A boolean value that specifies whether to log the inserted values to the console. Defaults to false. | -| callback | function | (Optional) callback function | - -**Example** -```js -upsertMany( - 'users', // the DB table - 'email', // a DB column with a unique constraint OR a CONSTRAINT NAME - [ - { name: 'one', email: 'one@openfn.org' }, - { name: 'two', email: 'two@openfn.org' }, - ] - { logValues: true } -) -``` - -* * * - diff --git a/docs/primero/CHANGELOG.md b/docs/primero/CHANGELOG.md deleted file mode 100644 index 63a32428d..000000000 --- a/docs/primero/CHANGELOG.md +++ /dev/null @@ -1,164 +0,0 @@ -# @openfn/language-primero - -## 2.11.8 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 2.11.7 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 2.11.6 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 2.11.5 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 2.11.4 - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 2.11.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 2.11.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 2.11.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 2.11.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 2.10.6 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 2.10.5 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 2.10.4 - -### Patch Changes - -- f2aed32: add examples - -## 2.10.3 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ -- 059c956: added examples in docstring - -## 2.10.2 - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 2.10.1 - -### Patch Changes - -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 - -## 2.10.0 - -### Minor Changes - -- 33742bf: Modify `composeNextState` so that `getCases` can pass it a third - argument: the metadata from Primero's response. - - `getCases` will now not only return an array of `cases` in `state.data`, but - metadata related to pagination in `state.metadata`. - -### Patch Changes - -- 2014694: remove travis url in readme -- bb764db: Conditionally check for 'withReferrals' in case no options are - provided" - -## 2.9.2 - -### Patch Changes - -- e04aa28: Rename credential-schema to configuration-schema, update descriptions - -## 2.9.1 - -### Patch Changes - -- d4ac748: Skipped failing test until we have a new strat (it's working) - -## 2.9.0 - -### Minor Changes - -- b37a4ad: add language primero into monorepo - -### Patch Changes - -- adb97a0: Fixed issue where upsertCase always took state.data for main params diff --git a/docs/primero/README.md b/docs/primero/README.md deleted file mode 100644 index 339adb211..000000000 --- a/docs/primero/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# language-primero - -An OpenFn **_adaptor_** for building integration jobs for use with UNICEF's -Primero API. - -**See Update Docs Site: https://docs.openfn.org/adaptors/packages/primero-docs** - -## Primero API Versions - -### Adaptor for Primero v2.0 - -This documentation outlines the functions available for Primero `v2.0` in the -main branch. The API documentation is available at: -https://github.com/primeroIMS/primero/tree/development_v2/app/controllers/api - -### Adaptor for Primero v1.0 still available on the `v1` branch. - -`v1.0.7` of this adaptor was built for the Primero `v1.1` API: -https://github.com/OpenFn/language-primero/blob/v1/README.md - -[Primero API v1.1 Documentation](https://docs.google.com/document/d/1jpaT2_UBBnc3PxPYlLMBEzNUkyfuxRZiksywG5MKM0Q/edit) - -#### Primero Authentication Strategies - -The Primero team is considering a shift to Microsoft Azure Active Directory B2C -for auth. We can likely accommodate this with a similar pattern as has been used -in our Microsoft Dynamics, Github, or Google Sheets adaptors, but we'll need to -await final doucmentation for Primero's `v2` API before making changes. - -[Azure Active Directory B2C](https://docs.microsoft.com/en-us/azure/active-directory-b2c/) - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/primero/index.md b/docs/primero/index.md deleted file mode 100644 index a6a485155..000000000 --- a/docs/primero/index.md +++ /dev/null @@ -1,406 +0,0 @@ -## Functions - -
-
- cleanupState(state)
-
- createCase(params, callback)
-
- createReferrals(params, callback)
-
- generateAuthString(state)
-
- getCases(query, options, callback)
-
- getForms(query, callback)
-
- getLocations(query, callback)
-
- getLookups(query, callback)
-
- getReferrals(params, callback)
-
- login(state)
-
- queryHandler(state, params, callback)
-
- updateCase(id, params, callback)
-
- updateReferral(params, callback)
-
- upsertCase(params, callback)
-
- - -## cleanupState - -cleanupState(state) ⇒ State -Removes unserializable keys from the state. - -**Kind**: global function - -| Param | Type | -| --- | --- | -| state | State | - -**Example** -```js -cleanupState(state) -``` - -* * * - -## createCase - -createCase(params, callback) ⇒ Operation -Create a new case in Primero - -Use this function to create a new case in Primero based on a set of Data. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | an object with some case data. | -| callback | function | (Optional) Callback function | - -**Example** *(Create a new case in Primero based on a set of Data)* -```js -createCase({ - data: { - age: 16, - sex: "female", - name: "Edwine Edgemont", - }, -}); -``` - -* * * - -## createReferrals - -createReferrals(params, callback) ⇒ Operation -Create referrals in Primero - -Use this function to bulk refer to one or multiple cases from Primero to a single user - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | an object with referral data. | -| callback | function | (Optional) Callback function | - -**Example** *(Create referrals for multiple cases in Primero)* -```js -createReferrals({ - data: { - ids: [ - "749e9c6e-60db-45ec-8f5a-69da7c223a79", - "dcea6052-07d9-4cfa-9abf-9a36987cdd25", - ], - transitioned_to: "primero_cp", - notes: "This is a bulk referral", - }, -}); -``` - -* * * - -## generateAuthString - -generateAuthString(state) ⇒ string -Generate an auth string to support multiple types of auth credentials. - -**Kind**: global function - -| Param | Type | -| --- | --- | -| state | State | - -**Example** -```js -generateAuthString(state) -``` - -* * * - -## getCases - -getCases(query, options, callback) ⇒ Operation -Get cases from Primero - -Use this function to get cases from Primero based on a set of query parameters. -Note that in many implementations, the `remote` attribute should be set to `true` to ensure that only cases marked for remote access will be retrieved. -You can specify a `case_id` value to fetch a unique case and a query string to filter result. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| query | object | an object with a query param at minimum, option to getReferrals | -| options | object | (Optional) an object with a getReferrals key to fetch referrals | -| callback | function | (Optional) Callback function | - -**Example** *( Get cases from Primero with query parameters)* -```js -getCases({ - remote: true, - query: "sex=male", -}); -``` -**Example** *(Get case from Primero for a specific case id)* -```js -getCases({ - remote: true, - case_id: "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz", -}); -``` - -* * * - -## getForms - -getForms(query, callback) ⇒ Operation -Get forms from Primero - -Use this function to get forms from Primero that are accessible to this user based on a set of query parameters. -The user can filter the form list by record type and module. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| query | object | an object with a query param at minimum | -| callback | function | (Optional) Callback function | - -**Example** *(Get the list of all forms)* -```js -getForms(); -``` -**Example** *(Get the list of all forms for a specific module)* -```js -getForms({ - module_id: "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz", -}); -``` - -* * * - -## getLocations - -getLocations(query, callback) ⇒ Operation -Get locations from Primero - -Use this function to get a paginated list of all locations that are accessible to this user from Primero. -Note: You can specify a `per` value to fetch records per page(Defaults to 20). -Also you can specify `page` value to fetch pagination (Defaults to 1). -Another parameter is `hierarchy: true` (Defaults to false) - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| query | object | an object with a query param at minimum | -| callback | function | (Optional) Callback function | - -**Example** *(Get loocations from Primero with query parameters)* -```js -getLocations({ - page: 1, - per: 20 -}) -``` - -* * * - -## getLookups - -getLookups(query, callback) ⇒ Operation -Get lookups from Primero - -Use this function to get a paginated list of all lookups that are accessible to this user from Primero. -Note: You can specify a `per` value to fetch records per page(Defaults to 20). -Also you can specify `page` value to fetch pagination (Defaults to 1) - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| query | object | an object with a query param at minimum | -| callback | function | (Optional) Callback function | - -**Example** *(Get lookups from Primero with query parameters)* -```js -getLookups({ - per: 10000, - page: 5 -}); -``` - -* * * - -## getReferrals - -getReferrals(params, callback) ⇒ Operation -Get referrals for a specific case in Primero - -Use this function to get the list of referrals of one case from Primero. -The search can be done using either `record id` or `case id`. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | an object with an externalId field to select the attribute to use for matching on case and an externalId value for that case. | -| callback | function | (Optional) Callback function | - -**Example** *(Get referrals for a case in Primero by record id)* -```js -getReferrals({ - externalId: "record_id", - id: "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz", -}); -``` -**Example** *(Get referrals for a case in Primero by case id)* -```js - getReferrals({ - id: "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz", -}); -``` - -* * * - -## login - -login(state) ⇒ State -Logs in to Primero. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| state | State | Runtime state. | - -**Example** -```js -login(state) -``` - -* * * - -## queryHandler - -queryHandler(state, params, callback) ⇒ State -Execute custom query - -**Kind**: global function - -| Param | Type | -| --- | --- | -| state | State | -| params | object | -| callback | function | - - -* * * - -## updateCase - -updateCase(id, params, callback) ⇒ Operation -Update an existing case in Primero - -Use this function to update an existing case from Primero. -In this implementation, the function uses a case ID to check for the case to update, -Then merge the values submitted in this call into an existing case. -Fields not specified in this request will not be modified. -For nested subform fields, the subform arrays will be recursively merged, -keeping both the existing values and appending the new - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| id | string | A case ID to use for the update. | -| params | object | an object with some case data. | -| callback | function | (Optional) Callback function | - -**Example** *(Update case for a specific case id)* -```js -updateCase("6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz", { - data: { - age: 16, - sex: "female", - name: "Fiona Edgemont", - }, -}); -``` - -* * * - -## updateReferral - -updateReferral(params, callback) ⇒ Operation -Update a single referral for a specific case in Primero - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | an object with an caseExternalId value to use, the id and the referral id to update. | -| callback | function | (Optional) Callback function | - -**Example** *(Update referral by record id)* -```js -updateReferral({ - caseExternalId: "record_id", - id: "749e9c6e-60db-45ec-8f5a-69da7c223a79", - caseId: "dcea6052-07d9-4cfa-9abf-9a36987cdd25", - data: (state) => state.data, -}); -``` - -* * * - -## upsertCase - -upsertCase(params, callback) ⇒ Operation -Upsert case to Primero - -Use this function to update an existing case from Primero or to create it otherwise. -In this implementation, we first fetch the list of cases, -then we check if the case exist before choosing the right operation to do. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | an object with an externalIds and some case data. | -| callback | function | (Optional) Callback function | - -**Example** *(Upsert case for a specific case id)* -```js -upsertCase({ - externalIds: ["case_id"], - data: state => ({ - age: 20, - sex: "male", - name: "Alex", - status: "open", - case_id: "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz", - }), -}); -``` - -* * * - diff --git a/docs/progres/CHANGELOG.md b/docs/progres/CHANGELOG.md deleted file mode 100644 index 38fa9afb2..000000000 --- a/docs/progres/CHANGELOG.md +++ /dev/null @@ -1,122 +0,0 @@ -# @openfn/language-progres - -## 1.3.8 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 1.3.7 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 1.3.6 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 1.3.5 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 1.3.4 - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 1.3.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 1.3.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 1.3.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 1.3.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 1.2.5 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 1.2.4 - -### Patch Changes - -- ef828e7: update old urls in readme -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 1.2.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 1.2.2 - -### Patch Changes - -- f2aed32: add examples - -## 1.2.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 1.2.0 - -### Minor Changes - -- 039ca0b: Migrate Progres - -### Patch Changes - -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 diff --git a/docs/progres/README.md b/docs/progres/README.md deleted file mode 100644 index e6929320b..000000000 --- a/docs/progres/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# language-progres - -An OpenFn **_adaptor_** for building integration jobs for use with the UNHCR -ProGres v4 API. - -## Design notes - -- Integration must run through UNHCR's DTP, a middleware layer that provides a - public API for UNHCR internal software. -- An API token _and_ a self-signed certificate must be provided for - communication with UNHCR's DTP. -- Two-way sync must be possible between Primero and ProGres -- Teams still in discussion about whether the most common use-case will be a - timed sync or real-time/event-based sync. - -## Documentation - -View the [docs site](https://docs.openfn.org/adaptors/packages/progres-docs) for -full technical documentation. - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/progres-configuration-schema/) -definition. - -### Posting data to an endpoint with SSL cert authentication - -```js -postData({ - url: urlDTP, - body: { a: 1 }, - headers: { - 'Subscription-Key': configuration['token'], - }, - agentOptions: { - key, - cert, - }, -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/progres/index.md b/docs/progres/index.md deleted file mode 100644 index 2998e8de7..000000000 --- a/docs/progres/index.md +++ /dev/null @@ -1,30 +0,0 @@ -## postData - -postData(params, callback) ⇒ Operation -Make a POST request with a certificate - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | Url, Headers and Body parameters | -| callback | function | (Optional) A callback function | - -**Example** -```js -postData({ - url: urlDTP, - body: obj, - headers: { - 'Ocp-Apim-Subscription-Key': configuration['Ocp-Apim-Subscription-Key'], - }, - agentOptions: { - key, - cert, - }, -}, callback)(state) -``` - -* * * - diff --git a/docs/rapidpro/CHANGELOG.md b/docs/rapidpro/CHANGELOG.md deleted file mode 100644 index 009873f62..000000000 --- a/docs/rapidpro/CHANGELOG.md +++ /dev/null @@ -1,128 +0,0 @@ -# @openfn/language-rapidpro - -## 1.0.8 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 1.0.7 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 1.0.6 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 1.0.5 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 1.0.4 - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 1.0.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 1.0.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 1.0.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 1.0.0 - -### Major Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.5.6 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 0.5.5 - -### Patch Changes - -- ef828e7: update old urls in readme -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.5.4 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.5.3 - -### Patch Changes - -- f2aed32: add examples - -## 0.5.2 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.5.1 - -### Patch Changes - -- cbb8968: Fix axios Inefficient Regular Expression Complexity vulnerability - -## 0.5.0 - -### Minor Changes - -- 11f83ff: Migrate RapidPro - -### Patch Changes - -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 diff --git a/docs/rapidpro/README.md b/docs/rapidpro/README.md deleted file mode 100644 index f44efec9d..000000000 --- a/docs/rapidpro/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# language-rapidpro - -An OpenFn **_adaptor_** for building integration jobs for use with the -[RapidPro API](https://rapidpro.io/api/v2/). - -## Documentation - -View the [docs site](https://docs.openfn.org/adaptors/packages/rapidpro-docs) -for full technical documentation. - -## Usage - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/rapidpro-configuration-schema/) -definition. - -#### sample job expression using operation - -```js -sendBroadcast({ - "text": "Hello friends.", - "urns": [], - "contacts": [], - "groups", [], -}); -``` - -### Key helper functions - -**sendBroadcast(...) to send broadcast message to multiple contacts** - -```js -sendBroadcast({ - text: 'Hello world', - urns: ['twitter:sirmixalot'], - contacts: ['a052b00c-15b3-48e6-9771-edbaa277a353'], -}); -``` - -**startFlow(...) to trigger an automation flow in RapidPro** - -```js -startFlow({ - flow: 'f5901b62-ba76-4003-9c62-72fdacc1b7b7', - restart_participants: false, - contacts: ['a052b00c-15b3-48e6-9771-edbaa277a353'], -}); -``` - -**upsertContact(...) to update/insert a Contact (and check if exists using -external identifiers)** - -```js -upsertContact({ - name: 'Mamadou', - language: 'ENG', - urns: ['tel:+250788123123'], -}); -``` - -**addContact(...) to insert a Contact** - -```js -addContact({ - name: 'Mamadou', - language: 'ENG', - urns: ['tel:+250788123123'], -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/rapidpro/index.md b/docs/rapidpro/index.md deleted file mode 100644 index 7d80cb866..000000000 --- a/docs/rapidpro/index.md +++ /dev/null @@ -1,110 +0,0 @@ -## Functions - -
-
- addContact(params, callback)
-
- sendBroadcast(params, callback)
-
- startFlow(params, callback)
-
- upsertContact(params, callback)
-
- - -## addContact - -addContact(params, callback) ⇒ Operation -Adds a new contact to RapidPro - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data to create the new resource | -| callback | function | (Optional) callback function | - -**Example** -```js -addContact({ - name: "Mamadou", - language: "ENG", - urns: ["tel:+250788123123"] -}); -``` - -* * * - -## sendBroadcast - -sendBroadcast(params, callback) ⇒ Operation -Sends a message to a list of contacts and/or URNs - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data to create the new resource | -| callback | function | (Optional) callback function | - -**Example** -```js -sendBroadcast({ - text: "Hello world", - urns: ["twitter:sirmixalot"], - contacts: ["a052b00c-15b3-48e6-9771-edbaa277a353"] -}); -``` - -* * * - -## startFlow - -startFlow(params, callback) ⇒ Operation -Start a RapidPro flow for a number of contacts - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data to create the new resource | -| callback | function | (Optional) callback function | - -**Example** -```js -startFlow({ - flow: "f5901b62-ba76-4003-9c62-72fdacc1b7b7", - restart_participants: false, - contacts: ["a052b00c-15b3-48e6-9771-edbaa277a353"] -}); -``` - -* * * - -## upsertContact - -upsertContact(params, callback) ⇒ Operation -Upserts a contact to RapidPro by URN - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data to upsert a contact | -| callback | function | (Optional) callback function | - -**Example** -```js -upsertContact({ - name: "Mamadou", - language: "ENG", - urns: ["tel:+250788123123"] -}); -``` - -* * * - diff --git a/docs/resourcemap/CHANGELOG.md b/docs/resourcemap/CHANGELOG.md deleted file mode 100644 index 4338b6f9c..000000000 --- a/docs/resourcemap/CHANGELOG.md +++ /dev/null @@ -1,54 +0,0 @@ -# @openfn/language-resourcemap - -## 0.3.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.3.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.2.3 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.2.2 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.2.1 - -### Patch Changes - -- f2aed32: add examples - -## 0.2.0 - -### Minor Changes - -- 664dc7f: migrate resourcemap diff --git a/docs/resourcemap/README.md b/docs/resourcemap/README.md deleted file mode 100644 index 3bf4026fc..000000000 --- a/docs/resourcemap/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Language ResourceMap - -Language Pack for building expressions and operations for working with the -[resourcemap API](https://github.com/instedd/resourcemap/wiki/REST_API). - -## Documentation - -We are working towards this to start: -https://github.com/instedd/resourcemap/wiki/REST_API#create-site - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/resourcemap-configuration-schema/) -definition. - -## Expressions - -## `submitSite(collectionId, fields)` - -```js -submitSite( - 303, - fields( - field('name', dataValue('sampleText')), - field('lat', 48.86), - field('lon', 2.35), - field('properties', function (state) { - return { - Comment: state.data.sampleText, - phone: '85512345678', - }; - }) - ) -); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/resourcemap/index.md b/docs/resourcemap/index.md deleted file mode 100644 index ff1ff83d6..000000000 --- a/docs/resourcemap/index.md +++ /dev/null @@ -1,20 +0,0 @@ -## submitSite - -submitSite(eventData) ⇒ Operation -Create an event - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| eventData | object | Payload data for the event | - -**Example** -```js -execute( - event(eventData) -)(state) -``` - -* * * - diff --git a/docs/salesforce/CHANGELOG.md b/docs/salesforce/CHANGELOG.md deleted file mode 100644 index 7dde7928f..000000000 --- a/docs/salesforce/CHANGELOG.md +++ /dev/null @@ -1,214 +0,0 @@ -# @openfn/language-salesforce - -## 4.3.1 - -### Patch Changes - -- 1131c34: Remove regex pattern for validation and changed minLength to 1 - -## 4.3.0 - -### Minor Changes - -- 1d5b62f: Add `toUTF8` function - -## 4.2.2 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 4.2.1 - -### Patch Changes - -- 07debe9: Update bulkQuery to use bulkv2 - -## 4.2.0 - -### Minor Changes - -- fc58f1c: add options in bulkQuery - -## 4.1.0 - -### Minor Changes - -- 1e3a083: add bulkQuery function - -## 4.0.8 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 4.0.7 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 4.0.6 - -### Patch Changes - -- aceedd2: update jsforce and remove unused packages - -## 4.0.5 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 4.0.4 - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 4.0.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 4.0.2 - -### Patch Changes - -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 4.0.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 4.0.0 - -### Major Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 3.0.7 - -### Patch Changes - -- 7cc8efc: remove FakeAdaptor references - -## 3.0.6 - -### Patch Changes - -- 705caab: Remove tools as devdependencies - -## 3.0.5 - -### Patch Changes - -- 929bca6: Use metadata helper function from common -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 3.0.4 - -### Patch Changes - -- ef828e7: update old urls in readme -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 3.0.3 - -### Patch Changes - -- 06aced8: Fix dependencies - -## 3.0.2 - -### Patch Changes - -- aed7e0b: fix required field in configuration schema - -## 3.0.1 - -### Patch Changes - -- c09b821: Add @magic annotations - -## 3.0.0 - -### Major Changes - -- 190f667: Remove curry from salesforce - -## 2.12.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 2.12.2 - -### Patch Changes - -- f2aed32: add examples - -## 2.12.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 2.12.0 - -### Minor Changes - -- 5c883c6: Allow expansion for describe(), add describeAll() - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 2.11.1 - -### Patch Changes - -- e7bf865: chore(deps): update dependency sinon to v14 -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 - -## 2.11.0 - -### Minor Changes - -- edff578: Migrate salesforce diff --git a/docs/salesforce/README.md b/docs/salesforce/README.md deleted file mode 100644 index cec12051b..000000000 --- a/docs/salesforce/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# Language Salesforce - -An OpenFn **_adaptor_** for building integration jobs for use with the -Salesforce API. - -## Documentation - -View the [docs site](https://docs.openfn.org/adaptors/packages/salesforce-docs) -for full technical documentation. - -## Release notes and deprecated CHANGELOG.md - -See [releases](https://docs.openfn.org/adaptors/packages/salesforce-changelog) -for all changes. - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/saleforce-configuration-schema/) -definition. - -## Intent - ---- - -Allow communication with Salesforce using a set of Lisp compatible expressions. - -Using simple functions we can create a simplified API, simple enough to generate -code from data. - -## Expressions - ---- - -Expressions are a simplified set of function calls. Outlining the operations -needed to be performed. - -An uncompiled expression has no knowledge of the internals of the adaptor, -credentials or runtime environment. - -It's the responsibility of the build process to provide a wrapper that will -inject the functions in. - -For example: - -```javascript -describe('vera__Test_Event__c'), - create('vera__Test_Event__c', { - vera__Test_Event_Name_Unique__c: 'hello from jsforce', - }), - create('vera__Boat__c', { - Name: 'Catatafish redux!', - vera__Test_Event__c: reference(0), - }); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` - -## Other - -Create SOAP session - -```sh -curl https://test.salesforce.com/services/Soap/u/47.0 -H "Content-Type: text/xml; charset=UTF-8" -H "SOAPAction: login" -d @tmp/login.txt | xmllint --format - -``` - -Close jobs - -```sh -curl -https://openfn.my.salesforce.com/services/async/47.0/job/some_id -H 'X-SFDC-Session: abc123sessionID456xyz' -H "Content-Type: application/xml; charset=UTF-8" -d @tmp/close_job.txt | xmllint --format - -``` diff --git a/docs/salesforce/index.md b/docs/salesforce/index.md deleted file mode 100644 index 8664b2429..000000000 --- a/docs/salesforce/index.md +++ /dev/null @@ -1,478 +0,0 @@ -## Functions - -
-
- bulk(sObject, operation, options, fun)
-
- bulkQuery(qs, options, callback)
-
- cleanupState(state)
-
- create(sObject, attrs)
-
- createConnection(state)
-
- createIf(logical, sObject, attrs)
-
- describe(sObject)
-
- describeAll()
-
- destroy(sObject, attrs, options)
-
- execute(operations)
-
- login(state)
-
- query(qs)
-
- reference(position)
-
- relationship(relationshipName, externalId, dataSource)
-
- retrieve(sObject, id, callback)
-
- steps()
-
- toUTF8(input)
-
- update(sObject, attrs)
-
- upsert(sObject, externalId, attrs)
-
- upsertIf(logical, sObject, externalId, attrs)
-
- - -## bulk - -bulk(sObject, operation, options, fun) ⇒ Operation -Create and execute a bulk job. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| sObject | String | API name of the sObject. | -| operation | String | The bulk operation to be performed | -| options | Object | Options passed to the bulk api. | -| fun | function | A function which takes state and returns an array. | - -**Example** -```js -bulk('Patient__c', 'insert', { failOnError: true, pollInterval: 3000, pollTimeout: 240000 }, state => { - return state.data.someArray.map(x => { - return { 'Age__c': x.age, 'Name': x.name } - }) -}); -``` - -* * * - -## bulkQuery - -bulkQuery(qs, options, callback) ⇒ Operation -Execute an SOQL Bulk Query. -This function uses bulk query to efficiently query large data sets and reduce the number of API requests. -Note that in an event of a query error, -error logs will be printed but the operation will not throw the error. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| qs | String | A query string. | -| options | Object | Options passed to the bulk api. | -| [options.pollTimeout] | integer | Polling timeout in milliseconds. | -| [options.pollInterval] | integer | Polling interval in milliseconds. | -| callback | function | A callback to execute once the record is retrieved | - -**Example** *(The results will be available on `state.data`)* -```js -bulkQuery(state=> `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`); -``` -**Example** -```js -bulkQuery( - (state) => - `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`, - { pollTimeout: 10000, pollInterval: 6000 } -); -``` - -* * * - -## cleanupState - -cleanupState(state) ⇒ State -Removes unserializable keys from the state. - -**Kind**: global function - -| Param | Type | -| --- | --- | -| state | State | - -**Example** -```js -cleanupState(state) -``` - -* * * - -## create - -create(sObject, attrs) ⇒ Operation -Create a new object. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| sObject | String | API name of the sObject. | -| attrs | Object | Field attributes for the new object. | - -**Example** -```js -create('obj_name', { - attr1: "foo", - attr2: "bar" -}) -``` - -* * * - -## createConnection - -createConnection(state) ⇒ State -Creates a connection. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| state | State | Runtime state. | - -**Example** -```js -createConnection(state) -``` - -* * * - -## createIf - -createIf(logical, sObject, attrs) ⇒ Operation -Create a new object if conditions are met. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| logical | boolean | a logical statement that will be evaluated. | -| sObject | String | API name of the sObject. | -| attrs | Object | Field attributes for the new object. | - -**Example** -```js -createIf(true, 'obj_name', { - attr1: "foo", - attr2: "bar" -}) -``` - -* * * - -## describe - -describe(sObject) ⇒ Operation -Outputs basic information about an sObject to `STDOUT`. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| sObject | String | API name of the sObject. | - -**Example** -```js -describe('obj_name') -``` - -* * * - -## describeAll - -describeAll() ⇒ Operation -Outputs basic information about available sObjects. - -**Kind**: global function -**Access**: public -**Example** -```js -describeAll() -``` - -* * * - -## destroy - -destroy(sObject, attrs, options) ⇒ Operation -Delete records of an object. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| sObject | String | API name of the sObject. | -| attrs | Object | Array of IDs of records to delete. | -| options | Object | Options for the destroy delete operation. | - -**Example** -```js -destroy('obj_name', [ - '0060n00000JQWHYAA5', - '0090n00000JQEWHYAA5 -], { failOnError: true }) -``` - -* * * - -## execute - -execute(operations) ⇒ State -Executes an operation. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| operations | Operation | Operations | - - -* * * - -## login - -login(state) ⇒ State -Performs a login. - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| state | State | Runtime state. | - -**Example** -```js -login(state) -``` - -* * * - -## query - -query(qs) ⇒ Operation -Execute an SOQL query. -Note that in an event of a query error, -error logs will be printed but the operation will not throw the error. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| qs | String | A query string. | - -**Example** -```js -query(`SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`); -``` - -* * * - -## reference - -reference(position) ⇒ State -Get a reference ID by an index. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| position | number | Position for references array. | - -**Example** -```js -reference(0) -``` - -* * * - -## relationship - -relationship(relationshipName, externalId, dataSource) ⇒ object -Adds a lookup relation or 'dome insert' to a record. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| relationshipName | string | `__r` relationship field on the record. | -| externalId | string | Salesforce ExternalID field. | -| dataSource | string | resolvable source. | - -**Example** -```js -Data Sourced Value: - relationship("relationship_name__r", "externalID on related object", dataSource("path")) -Fixed Value: - relationship("relationship_name__r", "externalID on related object", "hello world") -``` - -* * * - -## retrieve - -retrieve(sObject, id, callback) ⇒ Operation -Retrieves a Salesforce sObject(s). - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| sObject | String | The sObject to retrieve | -| id | String | The id of the record | -| callback | function | A callback to execute once the record is retrieved | - -**Example** -```js -retrieve('ContentVersion', '0684K0000020Au7QAE/VersionData'); -``` - -* * * - -## steps - -steps() ⇒ Array -Flattens an array of operations. - -**Kind**: global function -**Example** -```js -steps( - createIf(params), - update(params) -) -``` - -* * * - -## toUTF8 - -toUTF8(input) ⇒ String -Transliterates unicode characters to their best ASCII representation - -**Kind**: global function -**Returns**: String - - ASCII representation of input string -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| input | string | A string with unicode characters | - -**Example** -```js -fn((state) => { - const s = toUTF8("άνθρωποι"); - console.log(s); // anthropoi - return state; -}); -``` - -* * * - -## update - -update(sObject, attrs) ⇒ Operation -Update an object. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| sObject | String | API name of the sObject. | -| attrs | Object | Field attributes for the new object. | - -**Example** -```js -update('obj_name', { - attr1: "foo", - attr2: "bar" -}) -``` - -* * * - -## upsert - -upsert(sObject, externalId, attrs) ⇒ Operation -Upsert an object. - -**Kind**: global function -**Access**: public -**Magic**: sObject - $.children[?(!@.meta.system)].name -**Magic**: externalId - $.children[?(@.name=="{{args.sObject}}")].children[?(@.meta.externalId)].name -**Magic**: attrs - $.children[?(@.name=="{{args.sObject}}")].children[?(!@.meta.externalId)] - -| Param | Type | Description | -| --- | --- | --- | -| sObject | String | API name of the sObject. | -| externalId | String | ID. | -| attrs | Object | Field attributes for the new object. | - -**Example** -```js -upsert('obj_name', 'ext_id', { - attr1: "foo", - attr2: "bar" -}) -``` - -* * * - -## upsertIf - -upsertIf(logical, sObject, externalId, attrs) ⇒ Operation -Upsert if conditions are met. - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| logical | boolean | a logical statement that will be evaluated. | -| sObject | String | API name of the sObject. | -| externalId | String | ID. | -| attrs | Object | Field attributes for the new object. | - -**Example** -```js -upsertIf(true, 'obj_name', 'ext_id', { - attr1: "foo", - attr2: "bar" -}) -``` - -* * * - diff --git a/docs/sftp/CHANGELOG.md b/docs/sftp/CHANGELOG.md deleted file mode 100644 index cf4986151..000000000 --- a/docs/sftp/CHANGELOG.md +++ /dev/null @@ -1,201 +0,0 @@ -# @openfn/language-sftp - -## 1.0.2 - -### Patch Changes - -- a666a63: On error disconnect then throw - -## 1.0.1 - -### Patch Changes - -- 771c814: - Properly disconnect on error - - Improve operation logs - -## 1.0.0 - -### Major Changes - -- e52ba66: add `filter` option in `list()` function - -## 0.8.8 - -### Patch Changes - -- Updated dependencies [c19efbe] - - @openfn/language-common@1.11.1 - -## 0.8.7 - -### Patch Changes - -- Updated dependencies [85c35b8] - - @openfn/language-common@1.11.0 - -## 0.8.6 - -### Patch Changes - -- Updated dependencies [df09270] - - @openfn/language-common@1.10.3 - -## 0.8.5 - -### Patch Changes - -- Updated dependencies [26a303e] - - @openfn/language-common@1.10.2 - -## 0.8.4 - -### Patch Changes - -- Updated dependencies [8c32eb3] - - @openfn/language-common@1.10.1 - -## 0.8.3 - -### Patch Changes - -- Updated dependencies [aad9549] - - @openfn/language-common@1.10.0 - -## 0.8.2 - -### Patch Changes - -- d2c980e: Use `parseCsv` from language-common -- c5d3ce1: improve connection handling -- Updated dependencies [111807f] - - @openfn/language-common@1.9.0 - -## 0.8.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.8.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.7.3 - -### Patch Changes - -- 432dd0a: fix sftp connection wqautoclose - -## 0.7.2 - -### Patch Changes - -- 205b806: remove asObjects key before parsing - -## 0.7.1 - -### Patch Changes - -- 827c627: error handling - -## 0.7.0 - -### Minor Changes - -- fa58216: Add csvtojson convertion option - -## 0.6.9 - -### Patch Changes - -- Updated dependencies [929bca6] - - @openfn/language-common@1.7.7 - -## 0.6.8 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.6.7 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.6.6 - -### Patch Changes - -- f2aed32: add examples - -## 0.6.5 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 0.6.4 - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 0.6.3 - -### Patch Changes - -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- 4126a62: Fix built bundle -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 - -## 0.6.2 - -### Patch Changes - -- e04aa28: Rename credential-schema to configuration-schema, update descriptions - -## 0.6.1 - -### Patch Changes - -- 28dfbfa: add todo, fix build pack - -## 0.6.0 - -### Minor Changes - -- f294a62: Added credential-schema.json for new ui - -## 0.5.0 - -### Minor Changes - -- 2c04894: added sftp package diff --git a/docs/sftp/README.md b/docs/sftp/README.md deleted file mode 100644 index 03a537524..000000000 --- a/docs/sftp/README.md +++ /dev/null @@ -1,170 +0,0 @@ -# Language SFTP - -Language Pack for building expressions and operations to work with SFTP servers. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/sftp-configuration-schema/) -definition. - -## List the content of a directory - -```js -alterState(state => { - return list('/path/To/Directory')(state).then(response => { - console.log(`There are ${response.data.length} files.`); - return response; - }); -}); -``` - -## sample getCSV expression - -```js -getCSV('path/to/file.csv', 'utf8', { - quote: 'off', - delimiter: ';', - noheader: true, - filter: { - type: 'startsWith', - key: 'field1', - value: 'JO', - }, -}); -``` - -A more complex example that breaks up the CSV file into multiple payloads for -quicker processing. - -```js -fn(state => { - return list('/')(state).then(state => { - const targetNames = [ - 'exportContacts', //example fileName - ]; - console.log(`Fetching files: ${targetNames}`); - const files = state.data - .filter(file => file.name.split('.')[1] === 'csv') - .filter(file => - targetNames.some(targetName => - file.name.toLowerCase().includes(targetName) - ) - ); - - if (files.length === 0) console.log('No new CSV files found.'); - return { ...state, data: {}, files }; - }); -}); - -each( - '$.files[*]', - fn(state => { - const { configuration, data } = state; - - return getCSV(`/${data.name}`)(state).then(async state => { - const headers = state.data - .shift() - .split(';') - .map(h => (h = h.replace(/"/g, ''))); - - function toObject(item) { - const values = item.split(';'); - - return Object.fromEntries( - headers.map((k, i) => { - return values[i] - ? [k, values[i].replace(/"/g, '')] - : [k, values[i]]; - }) - ); - } - - let countInbox = 0; - - //to post CSV data as individual Messages to OpenFn Inbox - const postToInbox = async data => { - countInbox++; - - console.log(`Sending request ${countInbox} to inbox`); - - await new Promise(resolve => setTimeout(resolve, 200)); - - await http.post({ - url: configuration.openfnInboxUrl, - data: data, - maxContentLength: Infinity, - maxBodyLength: Infinity, - })(state); - }; - - //To split up into multiple, smaller payloads before send to OpenFn Inbox - const chunkSize = 500; - - console.log( - state.data.length, - 'rows will be sent in', - Math.ceil(state.data.length / chunkSize), - 'requests of', - chunkSize, - 'rows each.' - ); - - while (state.data.length > 0) { - console.log('data.length', state.data.length); - await postToInbox({ - fileName: data.name, - fileType: data.name.split('-')[0], - uploadDate: new Date(data.modifyTime).toISOString(), - json: state.data.splice(0, chunkSize).map(toObject), - }); - } - - return { configuration, references: [], data: {} }; - }); - }) -); -``` - -## sample putCSV expression - -This function converts JSON to CSV and post to a server - -```js -putCSV('/some/path/to_file.csv', 'utf8', { delimiter: ';', noheader: true }); -``` - -### Get JSON from FTP server - -```js -getJSON('path/to/file.json', 'utf8'); -``` - -### Custom request to an http endpoint - -This adaptor exports `http` from `language-common`. Here, we outline the usage -in order to make custom requests to an endpoint. It returns a promise - -```js -alterState(state => { - return http - .post({ url: 'yourURL', data: { name: 'Mamadou' } })(state) - .then(response => { - // do something with response; - return response; - }); -}); -``` - -## Development - -Clone the repo, run `pnpm install`. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To build the docs for this repo, `pnpm build docs` diff --git a/docs/sftp/index.md b/docs/sftp/index.md deleted file mode 100644 index 37a07a0e5..000000000 --- a/docs/sftp/index.md +++ /dev/null @@ -1,147 +0,0 @@ -## Functions - -
-
- getCSV(filePath, [parsingOptions])
-
- getJSON(filePath, encoding)
-
- list(dirPath, filter, [callback])
-
- normalizeCSVarray(options, callback)
-
- putCSV(localFilePath, remoteFilePath, parsingOptions)
-
- - -## getCSV - -getCSV(filePath, [parsingOptions]) ⇒ Operation -Get a CSV and return a JSON array of strings for each item separated by the delimiter - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| filePath | string | Path to resource | -| [parsingOptions] | Object | Optional. `parsingOptions` Parsing options which can be passed to convert csv to json See more [on csvtojson docs](https://github.com/Keyang/node-csvtojson#parameters) | - -**Example** -```js -getCSV( - '/some/path/to_file.csv', - {delimiter: ";", flatKeys: true } -); -``` - -* * * - -## getJSON - -getJSON(filePath, encoding) ⇒ Operation -Fetch a json file from an FTP server - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| filePath | string | Path to resource | -| encoding | string | Character encoding for the json | - -**Example** -```js -getJSON( - '/path/To/File', - 'utf8', -); -``` - -* * * - -## list - -list(dirPath, filter, [callback]) ⇒ Operation -List files present in a directory - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| dirPath | string | Path to remote directory | -| filter | function | a filter function used to select return entries | -| [callback] | function | Optional callback to handle the response | - -**Example** *(basic files listing)* -```js -list('/some/path/') -``` -**Example** *(list files with filters)* -```js -list('/some/path/', file=> { - return /foo.\.txt/.test(file.name); -}) -``` -**Example** *(list files with filters and use callback)* -```js -list( - "/some/path/", - (file) => /foo.\.txt/.test(file.name), - (state) => { - const latestFile = state.data.filter( - (file) => file.modifyTime <= new Date() - ); - return { ...state, latestFile }; - } -); -``` - -* * * - -## normalizeCSVarray - -normalizeCSVarray(options, callback) ⇒ Operation -Convert JSON array of strings into a normalized object - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| options | options | Options passed to csvtojson parser | -| callback | callback | Options passed to csvtojson parser | - -**Example** -```js -normalizeCSVarray({ delimiter: ';', noheader: true }); -``` - -* * * - -## putCSV - -putCSV(localFilePath, remoteFilePath, parsingOptions) ⇒ Operation -Convert JSON to CSV and upload to an FTP server - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| localFilePath | string | Data source for data to copy to the remote server. | -| remoteFilePath | string | Path to the remote file to be created on the server. | -| parsingOptions | object | Options which can be passed to adjust the read and write stream used in sending the data to the remote server | - -**Example** -```js -putCSV( - '/some/path/to_local_file.csv', - '/some/path/to_remove_file.csv', - { delimiter: ';', noheader: true } -); -``` - -* * * - diff --git a/docs/smpp/CHANGELOG.md b/docs/smpp/CHANGELOG.md deleted file mode 100644 index 0c83adf1e..000000000 --- a/docs/smpp/CHANGELOG.md +++ /dev/null @@ -1,54 +0,0 @@ -# @openfn/language-smpp - -## 1.3.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 1.3.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 1.2.3 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 1.2.2 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 1.2.1 - -### Patch Changes - -- f2aed32: add examples - -## 1.2.0 - -### Minor Changes - -- 3aedd05: migrate smpp diff --git a/docs/smpp/README.md b/docs/smpp/README.md deleted file mode 100644 index 13a89fe99..000000000 --- a/docs/smpp/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# Language SMPP - -Language Pack for building expressions and operations to make calls to an OpenFn -SMPP client API. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/smpp-configuration-schema/) -definition. - -#### sample send expression - -```js -send({ - text: dataValue('text'), - smsId: dataValue('messageId'), - recipient: dataValue('to'), - sender: dataValue('from'), -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/smpp/index.md b/docs/smpp/index.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/docs/surveycto/CHANGELOG.md b/docs/surveycto/CHANGELOG.md deleted file mode 100644 index 68a8c91cd..000000000 --- a/docs/surveycto/CHANGELOG.md +++ /dev/null @@ -1,65 +0,0 @@ -# @openfn/language-surveycto - -## 1.2.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 1.2.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 1.1.4 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 1.1.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 1.1.2 - -### Patch Changes - -- f2aed32: add examples - -## 1.1.1 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 1.1.0 - -### Minor Changes - -- 776bb13: migrate surveycto - -### Patch Changes - -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 diff --git a/docs/surveycto/README.md b/docs/surveycto/README.md deleted file mode 100644 index 56f1285b5..000000000 --- a/docs/surveycto/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# Language SurveyCTO - -Language Pack for building expressions and operations to make HTTP calls to -SurveyCTO. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/surveycto-configuration-schema/) -definition. - -## fetchSubmissions - -`fetchSubmissions(1,2,3)` takes three arguments: - -1. the `formId` of the form on SurveyCTO - -2. the `initialAfterDate`, a date string or UNIX timestamp which instructs the - job to only fetch submissions after a certain date. After the first run of - the job, subsequent runs will only fetch _NEW_ submissions. - -3. the `postUrl` is where the wide-format JSON representation of each form - submission should be sent. Note that a `formId` key will be added to each - form submission for later filtering/routing. - -### sample `fetchSubmissions` expression - -```js -fetchSubmissions( - // formId on SurveyCTO server - 'household_survey', - // initialAfterDate: this will only be accessed if "lastSubmissionDate" is empty in your job_state". - // After the initial run of the job, OpenFn will only pull new submissions from SurveyCTO. - 'Aug 29, 2016 4:44:26 PM', - // postUrl is where you want to send the JSON submissions, appended with a new "formId" key - 'https://www.openfn.org/inbox/secret-inbox-uuid' -); -``` - -## Development - -Clone the repo, run `npm install`. - -Run tests using `npm run test` or `npm run test:watch` - -Build the project using `make`. diff --git a/docs/surveycto/index.md b/docs/surveycto/index.md deleted file mode 100644 index 656cb9eec..000000000 --- a/docs/surveycto/index.md +++ /dev/null @@ -1,20 +0,0 @@ -## fetchSubmissions - -fetchSubmissions(params) ⇒ Operation -Make a GET request and POST it somewhere else - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| params | object | data to make the fetch | - -**Example** -```js -execute( - fetch(params) -)(state) -``` - -* * * - diff --git a/docs/telerivet/CHANGELOG.md b/docs/telerivet/CHANGELOG.md deleted file mode 100644 index 6faf06a5d..000000000 --- a/docs/telerivet/CHANGELOG.md +++ /dev/null @@ -1,65 +0,0 @@ -# @openfn/language-telerivet - -## 0.2.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.2.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.1.4 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.1.3 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.1.2 - -### Patch Changes - -- f2aed32: add examples - -## 0.1.1 - -### Patch Changes - -- e4ebcb6: Fix Large gzip Denial of Service in superagent - -## 0.1.0 - -### Minor Changes - -- 83ede44: migrate telerivet - -### Patch Changes - -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 diff --git a/docs/telerivet/README.md b/docs/telerivet/README.md deleted file mode 100644 index bbdc2caf3..000000000 --- a/docs/telerivet/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# Language Telerivet - -Language Pack for sending messages using the -[telerivet API](https://telerivet.com/api/rest/curl). - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/telerivet-configuration-schema/) -definition. - -## Send message - -#### Current `send` expression: - -```js -send( - fields( - field('to_number', dataValue('recipient_number')), - field('content', dataValue('recipient_text')), - // Lots of optional parameters... - field('message_type', 'sms'), - field('route_id', dataValue('some_route')) - ) -); -``` - -## sendBulk messages - WIP - -#### Current `sendBulk` expression: - -```js -send(fields( - field("content", dataValue("recipient_text")), - field("to_numbers", [ - "+14155550123", - "+14255550234", - "+16505550345" - ] - // Lots of optional parameters... - field("message_type", "sms"), - field("route_id", dataValue("some_route")) -)) -``` - -Note that "recipient_text" may be a concatenation like this: - -```js -field('content', function (state) { - return dataValue('salutation')(state).concat( - '. ', - dataValue('last_name')(state), - ', )' - ); -}); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/telerivet/index.md b/docs/telerivet/index.md deleted file mode 100644 index 4e65a725a..000000000 --- a/docs/telerivet/index.md +++ /dev/null @@ -1,20 +0,0 @@ -## send - -send(sendData) ⇒ Operation -Send a message - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| sendData | object | Payload data for the message | - -**Example** -```js -execute( - send(data) -)(state) -``` - -* * * - diff --git a/docs/template/CHANGELOG.md b/docs/template/CHANGELOG.md deleted file mode 100644 index 086b896d0..000000000 --- a/docs/template/CHANGELOG.md +++ /dev/null @@ -1,104 +0,0 @@ -# @openfn/language-template - -## 3.0.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 3.0.0 - -### Major Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 2.0.0 - -### Major Changes - -- 779596f: Use native fetch (undici) in template and add icons in openfn - -### Minor Changes - -- 1af9cd5: Better docs and resource names - -## 1.7.8 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 1.7.7 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 1.7.6 - -### Patch Changes - -- f2aed32: add examples - -## 1.7.5 - -### Patch Changes - -- 6d8de03: change @constructor to @function and remove /\*_ @module Adaptor _/ - -## 1.7.4 - -### Patch Changes - -- f2a91a4: Update package exports -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 - -## 1.7.3 - -### Patch Changes - -- 8566b26: Fix typings -- b3d45ff: Fix CJS export of npm package. -- b5eb665: Adjusted docs for common and built to markdown -- ecf5d30: remove sinon since it was not being used -- Updated dependencies [8566b26] -- Updated dependencies [b3d45ff] -- Updated dependencies [b5eb665] -- Updated dependencies [ecf5d30] - - @openfn/language-common@1.7.4 - -## 1.7.2 - -### Patch Changes - -- f4b3dd6: remove travis build url - -## 1.7.1 - -### Patch Changes - -- Fixed package.json for template adaptor - -## 1.7.0 - -### Minor Changes - -- 554e905: Migrated to monorepo diff --git a/docs/template/README.md b/docs/template/README.md deleted file mode 100644 index 325b655ea..000000000 --- a/docs/template/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# language-template - -An OpenFn **_adaptor_** for building integration jobs for use with the \_\_\_\_ -API. - -## Documentation - -View the [docs site](https://docs.openfn.org/adaptors/packages/template-docs) -for full technical documentation. - -### Configuration - -View the -[configuration-schema](https://docs.openfn.org/adaptors/packages/template-configuration-schema/) -for required and optional `configuration` properties. - -### A example expression using the `create` function - -```js -create('patient', { name: 'Bukayo' }); -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -"Getting Started" guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To build _only_ the docs run `pnpm build docs`. diff --git a/docs/template/index.md b/docs/template/index.md deleted file mode 100644 index 4b0df871a..000000000 --- a/docs/template/index.md +++ /dev/null @@ -1,21 +0,0 @@ -## create - -create(resource, data, callback) ⇒ Operation -Create some resource in some system - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| resource | string | The type of entity that will be created | -| data | object | The data to create the new resource | -| callback | function | An optional callback function | - -**Example** -```js -create("patient", {"name": "Bukayo"}) -``` - -* * * - diff --git a/docs/tutorial/index.md b/docs/tutorial/index.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/docs/twilio/CHANGELOG.md b/docs/twilio/CHANGELOG.md deleted file mode 100644 index fcbd7b7a5..000000000 --- a/docs/twilio/CHANGELOG.md +++ /dev/null @@ -1,65 +0,0 @@ -# @openfn/language-twilio - -## 0.4.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.4.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.3.4 - -### Patch Changes - -- a22daa6: rename credential-schema to configuration-schemawq - -## 0.3.3 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.3.2 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.3.1 - -### Patch Changes - -- f2aed32: add examples - -## 0.3.0 - -### Minor Changes - -- a36a072: ymigrated twilio to monorepo - -### Patch Changes - -- Updated dependencies [f2a91a4] - - @openfn/language-common@1.7.5 diff --git a/docs/twilio/README.md b/docs/twilio/README.md deleted file mode 100644 index 1c11e9555..000000000 --- a/docs/twilio/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Language twilio - -Language Pack for building expressions and operations to interact with the -twilio API. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/twilio-configuration-schema/) -definition. - -### sendSMS - -#### sample expression, sending an sms - -```js -sendSMS({ - body: dataValue('text'), - from: '+15005550006', - to: dataValue('recipient'), -}); -``` - -## local usage - -```sh -~/devtools/core/bin/core execute \ - -l ~/devtools/adaptors/language-twilio \ - -s ./tmp/state.json \ - -o ./tmp/output.json \ - -e ./tmp/expression.js -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/twilio/index.md b/docs/twilio/index.md deleted file mode 100644 index 875acd9a8..000000000 --- a/docs/twilio/index.md +++ /dev/null @@ -1,23 +0,0 @@ -## sendSMS - -sendSMS(params) ⇒ Operation -Sends an SMS message to a specific phone number - -**Kind**: global function -**Access**: public - -| Param | Type | Description | -| --- | --- | --- | -| params | Object | an object containing 'body', 'from', and 'to' keys. | - -**Example** -```js -sendSMS({ - body: dataValue('sampleText'), - from: dataValue('myFromNumber'), - to: dataValue('ukMobile'), -}); -``` - -* * * - diff --git a/docs/vtiger/CHANGELOG.md b/docs/vtiger/CHANGELOG.md deleted file mode 100644 index 662a222f9..000000000 --- a/docs/vtiger/CHANGELOG.md +++ /dev/null @@ -1,54 +0,0 @@ -# @openfn/language-vtiger - -## 1.2.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 1.2.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 1.1.3 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 1.1.2 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 1.1.1 - -### Patch Changes - -- f2aed32: add examples - -## 1.1.0 - -### Minor Changes - -- b4a13ff: migrate vtiger diff --git a/docs/vtiger/README.md b/docs/vtiger/README.md deleted file mode 100644 index bf9111ce7..000000000 --- a/docs/vtiger/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Language Vtiger - -Language Pack for building expressions and operations to make calls to the -Vtiger API. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/vtiger-configuration-schema/) -definition. - -#### sample listTypes expression - -```js -listTypes(); -``` - -#### sample postElement expression - -```js -postElement({ - operation: "create" - elementType: "leads", - element: { - "name": dataValue("name")(state), - "surname": dataValue("surname")(state), - "email": dataValue("email")(state) - } -}); - - -``` - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/vtiger/index.md b/docs/vtiger/index.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/docs/zoho/CHANGELOG.md b/docs/zoho/CHANGELOG.md deleted file mode 100644 index e9805097b..000000000 --- a/docs/zoho/CHANGELOG.md +++ /dev/null @@ -1,58 +0,0 @@ -# @openfn/language-zoho - -## 0.3.1 - -### Patch Changes - -- Update lock files -- Updated dependencies - - @openfn/language-common@1.8.1 - -## 0.3.0 - -### Minor Changes - -- 2c1d603: Remove parameter reassignment to ensure proper functioning inside an - `each` block; add eslint - - The packages receiving a major bump here exposed functions that didn't work as - expected inside `each` blocks. Users were previously wrapping these functions - inside their own custom `fn` blocks, and this change will ensure that they can - be used inside a standard each. - - See https://github.com/OpenFn/adaptors/issues/275 for more details. - -### Patch Changes - -- Updated dependencies [2c1d603] - - @openfn/language-common@1.8.0 - -## 0.2.3 - -### Patch Changes - -- 14f481e: mark execute as private -- Updated dependencies [2b4c61a] - - @openfn/language-common@1.7.6 - -## 0.2.2 - -### Patch Changes - -- f7ebd3c: remove sample configuration - -## 0.2.1 - -### Patch Changes - -- f2aed32: add examples - -## 0.2.0 - -### Minor Changes - -- f9ac74a: migrate zoho - -### Patch Changes - -- e4ebcb6: Fix Large gzip Denial of Service in superagent diff --git a/docs/zoho/README.md b/docs/zoho/README.md deleted file mode 100644 index 762213033..000000000 --- a/docs/zoho/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Language Zoho - -Language Pack for sending messages using the Zoho API. - -## Documentation - -### Configuration - -View all the required and optional properties for `state.configuration` in the -official -[configuration-schema](https://docs.openfn.org/adaptors/packages/zoho-configuration-schema/) -definition. - -### addRow - -To add a row to the "Customers" table in the "testing_openfn" database, use the -following `addRow` function. - -```js -addRow( - 'testing_openfn', - 'Customers', - fields(field('Subject', dataValue('formId')), field('Status', 'Closed')) -); -``` - -### updateRow - -Coming soon. Want to help? -https://zohoreportsapi.wiki.zoho.com/Updating-Data.html - -## Development - -Clone the [adaptors monorepo](https://github.com/OpenFn/adaptors). Follow the -`Getting Started` guide inside to get set up. - -Run tests using `pnpm run test` or `pnpm run test:watch` - -Build the project using `pnpm build`. - -To just build the docs run `pnpm build docs` diff --git a/docs/zoho/index.md b/docs/zoho/index.md deleted file mode 100644 index dc2a71501..000000000 --- a/docs/zoho/index.md +++ /dev/null @@ -1,24 +0,0 @@ -## addRow - -addRow(db, table, rowData) ⇒ Operation -To add a row data to a database table - -**Kind**: global function - -| Param | Type | Description | -| --- | --- | --- | -| db | string | Database | -| table | string | Database table | -| rowData | object | row data to be added into the database | - -**Example** -```js -addRow( -'testing_openfn', -'Customers', -fields(field('Subject', dataValue('formId')), field('Status', 'Closed')) -); -``` - -* * * -