diff --git a/.changeset/stale-islands-see.md b/.changeset/stale-islands-see.md new file mode 100644 index 0000000000..edfa29dca4 --- /dev/null +++ b/.changeset/stale-islands-see.md @@ -0,0 +1,99 @@ +--- +'@openfn/language-puntosolidario-rd': minor +'@openfn/language-googlehealthcare': minor +'@openfn/language-azure-storage': minor +'@openfn/language-googlesheets': minor +'@openfn/language-browserless': minor +'@openfn/language-fhir-ndr-et': minor +'@openfn/language-googledrive': minor +'@openfn/language-khanacademy': minor +'@openfn/language-kobotoolbox': minor +'@openfn/language-medicmobile': minor +'@openfn/language-resourcemap': minor +'@openfn/language-motherduck': minor +'@openfn/language-postgresql': minor +'@openfn/language-salesforce': minor +'@openfn/language-sunbird-rc': minor +'@openfn/language-ghana-bdr': minor +'@openfn/language-ghana-nia': minor +'@openfn/language-lamisplus': minor +'@openfn/language-mailchimp': minor +'@openfn/language-openboxes': minor +'@openfn/language-satusehat': minor +'@openfn/language-siuben-rd': minor +'@openfn/language-surveycto': minor +'@openfn/language-telerivet': minor +'@openfn/language-wigal-sms': minor +'@openfn/language-bigquery': minor +'@openfn/language-commcare': minor +'@openfn/language-dynamics': minor +'@openfn/language-facebook': minor +'@openfn/language-mtn-momo': minor +'@openfn/language-opencrvs': minor +'@openfn/language-openelis': minor +'@openfn/language-openimis': minor +'@openfn/language-openlmis': minor +'@openfn/language-pdfshift': minor +'@openfn/language-rapidpro': minor +'@openfn/language-whatsapp': minor +'@openfn/language-beyonic': minor +'@openfn/language-cartodb': minor +'@openfn/language-chatgpt': minor +'@openfn/language-erpnext': minor +'@openfn/language-fhir-fr': minor +'@openfn/language-ibipimo': minor +'@openfn/language-mailgun': minor +'@openfn/language-memento': minor +'@openfn/language-mojatax': minor +'@openfn/language-mongodb': minor +'@openfn/language-monnify': minor +'@openfn/language-msgraph': minor +'@openfn/language-msupply': minor +'@openfn/language-openhim': minor +'@openfn/language-openmrs': minor +'@openfn/language-openspp': minor +'@openfn/language-pesapal': minor +'@openfn/language-primero': minor +'@openfn/language-progres': minor +'@openfn/language-senaite': minor +'@openfn/language-arcgis': minor +'@openfn/language-aws-s3': minor +'@openfn/language-claude': minor +'@openfn/language-godata': minor +'@openfn/language-hubtel': minor +'@openfn/language-inform': minor +'@openfn/language-intuit': minor +'@openfn/language-maximo': minor +'@openfn/language-openfn': minor +'@openfn/language-stripe': minor +'@openfn/language-twilio': minor +'@openfn/language-vtiger': minor +'@openfn/language-asana': minor +'@openfn/language-dhis2': minor +'@openfn/language-divoc': minor +'@openfn/language-gmail': minor +'@openfn/language-ihris': minor +'@openfn/language-magpi': minor +'@openfn/language-minio': minor +'@openfn/language-mogli': minor +'@openfn/language-mpesa': minor +'@openfn/language-mssql': minor +'@openfn/language-mysql': minor +'@openfn/language-nexmo': minor +'@openfn/language-redis': minor +'@openfn/language-dagu': minor +'@openfn/language-fhir': minor +'@openfn/language-hive': minor +'@openfn/language-http': minor +'@openfn/language-odoo': minor +'@openfn/language-ping': minor +'@openfn/language-sftp': minor +'@openfn/language-varo': minor +'@openfn/language-zata': minor +'@openfn/language-zoho': minor +'@openfn/language-cht': minor +'@openfn/language-ocl': minor +'@openfn/language-odk': minor +--- + +export `log` function from common diff --git a/packages/arcgis/ast.json b/packages/arcgis/ast.json index 61b1598158..e4878da674 100644 --- a/packages/arcgis/ast.json +++ b/packages/arcgis/ast.json @@ -747,6 +747,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/arcgis/src/Adaptor.js b/packages/arcgis/src/Adaptor.js index a24d139643..30bdfec611 100644 --- a/packages/arcgis/src/Adaptor.js +++ b/packages/arcgis/src/Adaptor.js @@ -21,6 +21,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/asana/ast.json b/packages/asana/ast.json index b18757f91c..3a425196ae 100644 --- a/packages/asana/ast.json +++ b/packages/asana/ast.json @@ -1227,6 +1227,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/asana/src/Adaptor.js b/packages/asana/src/Adaptor.js index edc2dccf9c..42a136da48 100644 --- a/packages/asana/src/Adaptor.js +++ b/packages/asana/src/Adaptor.js @@ -50,13 +50,13 @@ export function getTask(taskGid, params, callback) { const [resolvedTaskGid, resolvedParams] = expandReferences( state, taskGid, - params + params, ); const response = await util.request( state, `tasks/${resolvedTaskGid}`, { query: resolvedParams }, - callback + callback, ); return util.prepareNextState(state, response); }; @@ -87,14 +87,14 @@ export function getTasks(projectGid, params, callback) { const [resolvedProjectGid, resolvedParams] = expandReferences( state, projectGid, - params + params, ); const results = await util.requestWithPagination( state, `projects/${resolvedProjectGid}/tasks`, { query: resolvedParams }, - callback + callback, ); console.log(`Fetched ${results.length} tasks`); return composeNextState(state, results); @@ -121,14 +121,14 @@ export function updateTask(taskGid, data, callback) { const [resolvedTaskGid, resolvedData] = expandReferences( state, taskGid, - data + data, ); const response = await util.request( state, `tasks/${resolvedTaskGid}`, { body: { data: resolvedData }, method: 'PUT' }, - callback + callback, ); return util.prepareNextState(state, response); }; @@ -157,7 +157,7 @@ export function createTask(params, callback) { state, 'tasks', { body: { data: resolvedParams }, method: 'POST' }, - callback + callback, ); return util.prepareNextState(state, response); }; @@ -189,7 +189,7 @@ export function upsertTask(projectGid, params, callback) { const [resolvedProjectGid, { externalId, data }] = expandReferences( state, projectGid, - params + params, ); return util @@ -198,7 +198,7 @@ export function upsertTask(projectGid, params, callback) { }) .then(next => { const matchingTask = next.find( - task => task[externalId] === data[externalId] + task => task[externalId] === data[externalId], ); if (matchingTask) { console.log('Matching task found. Performing update.'); @@ -247,7 +247,7 @@ export function searchTask(task, query = {}, options = {}) { state, task, query, - options + options, ); const { workspaceGid = state.configuration.workspaceGid } = resolvedOptions; const { resource_subtype = 'default_task', ...restQuery } = resolvedQuery; @@ -263,7 +263,7 @@ export function searchTask(task, query = {}, options = {}) { text: resolvedTask, ...restQuery, }, - } + }, ); return util.prepareNextState(state, response); @@ -322,7 +322,7 @@ export function createTaskStory(taskGid, params, callback) { query: { opt_fields, opt_pretty }, method: 'POST', }, - callback + callback, ); return util.prepareNextState(state, response); }; @@ -362,7 +362,7 @@ export function request(path, params = {}, callback) { const [resolvedPath, resolvedParams] = expandReferences( state, path, - params + params, ); const { body, query, method } = resolvedParams; @@ -371,7 +371,7 @@ export function request(path, params = {}, callback) { state, resolvedPath, { method, body, query }, - callback + callback, ); return util.prepareNextState(state, response); @@ -380,6 +380,7 @@ export function request(path, params = {}, callback) { export { alterState, + as, combine, cursor, dataPath, @@ -391,7 +392,7 @@ export { fn, fnIf, lastReferenceValue, + log, merge, sourceValue, - as, } from '@openfn/language-common'; diff --git a/packages/aws-s3/ast.json b/packages/aws-s3/ast.json index 1e11141797..914d695bbb 100644 --- a/packages/aws-s3/ast.json +++ b/packages/aws-s3/ast.json @@ -870,6 +870,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/aws-s3/src/Adaptor.js b/packages/aws-s3/src/Adaptor.js index 4d84e59136..e686171840 100644 --- a/packages/aws-s3/src/Adaptor.js +++ b/packages/aws-s3/src/Adaptor.js @@ -137,6 +137,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/azure-storage/ast.json b/packages/azure-storage/ast.json index 7747c62f60..cb8adcb4bb 100644 --- a/packages/azure-storage/ast.json +++ b/packages/azure-storage/ast.json @@ -756,6 +756,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/azure-storage/src/Adaptor.js b/packages/azure-storage/src/Adaptor.js index ae45d90358..f8260f17cb 100644 --- a/packages/azure-storage/src/Adaptor.js +++ b/packages/azure-storage/src/Adaptor.js @@ -242,6 +242,7 @@ export { fn, fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/beyonic/ast.json b/packages/beyonic/ast.json index e225e8be66..0a0432b94a 100644 --- a/packages/beyonic/ast.json +++ b/packages/beyonic/ast.json @@ -599,6 +599,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/beyonic/src/Adaptor.js b/packages/beyonic/src/Adaptor.js index 649dac6654..bb836f4477 100644 --- a/packages/beyonic/src/Adaptor.js +++ b/packages/beyonic/src/Adaptor.js @@ -104,13 +104,14 @@ export function createCollectionRequest(data) { export { combine, - fn, - fnIf, - field, - fields, - sourceValue, - merge, dataPath, dataValue, + field, + fields, + fn, + fnIf, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/bigquery/ast.json b/packages/bigquery/ast.json index bb6d8eeb8f..07ad18d2f7 100644 --- a/packages/bigquery/ast.json +++ b/packages/bigquery/ast.json @@ -698,6 +698,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/bigquery/src/Adaptor.js b/packages/bigquery/src/Adaptor.js index 3da27059d8..0249d968ac 100644 --- a/packages/bigquery/src/Adaptor.js +++ b/packages/bigquery/src/Adaptor.js @@ -116,17 +116,18 @@ export function load( } export { - fn, - fnIf, alterState, - dataPath, combine, + dataPath, dataValue, each, field, fields, + fn, + fnIf, lastReferenceValue, + log, merge, - sourceValue, parseCsv, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/browserless/ast.json b/packages/browserless/ast.json index 858bbb13f8..8ec58e0471 100644 --- a/packages/browserless/ast.json +++ b/packages/browserless/ast.json @@ -853,6 +853,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/browserless/src/Adaptor.js b/packages/browserless/src/Adaptor.js index 7d0e5e61fd..e98a1f909f 100644 --- a/packages/browserless/src/Adaptor.js +++ b/packages/browserless/src/Adaptor.js @@ -52,6 +52,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/cartodb/ast.json b/packages/cartodb/ast.json index c0d117d77b..954e1cc491 100644 --- a/packages/cartodb/ast.json +++ b/packages/cartodb/ast.json @@ -629,6 +629,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/cartodb/src/Adaptor.js b/packages/cartodb/src/Adaptor.js index 60747a2699..858004fe6b 100644 --- a/packages/cartodb/src/Adaptor.js +++ b/packages/cartodb/src/Adaptor.js @@ -92,14 +92,15 @@ export function addRow(table, rowData) { export { combine, - fn, - fnIf, - field, - fields, - sourceValue, - each, - merge, dataPath, dataValue, + each, + field, + fields, + fn, + fnIf, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/chatgpt/ast.json b/packages/chatgpt/ast.json index d846887be5..a4a99f6d92 100644 --- a/packages/chatgpt/ast.json +++ b/packages/chatgpt/ast.json @@ -670,6 +670,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/chatgpt/src/Adaptor.js b/packages/chatgpt/src/Adaptor.js index 6c44149c1f..d8aa64648d 100644 --- a/packages/chatgpt/src/Adaptor.js +++ b/packages/chatgpt/src/Adaptor.js @@ -57,7 +57,7 @@ export function execute(...operations) { return state => { return commonExecute( createClient, - ...operations + ...operations, )({ ...initialState, ...state, @@ -80,7 +80,7 @@ export function prompt(message, opts) { const [resolvedMessage, resolvedOpts] = expandReferences( state, message, - opts + opts, ); const payload = { @@ -124,7 +124,7 @@ export function deepResearch(message, opts) { const [resolvedMessage, resolvedOpts] = expandReferences( state, message, - opts + opts, ); const payload = { @@ -144,15 +144,16 @@ export function deepResearch(message, opts) { export { combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/cht/ast.json b/packages/cht/ast.json index 28e2a97774..40b02ac4f3 100644 --- a/packages/cht/ast.json +++ b/packages/cht/ast.json @@ -883,6 +883,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/cht/src/Adaptor.js b/packages/cht/src/Adaptor.js index 020d229d5f..854e2b6839 100644 --- a/packages/cht/src/Adaptor.js +++ b/packages/cht/src/Adaptor.js @@ -111,7 +111,7 @@ export function request(method, path, body, options = {}, callback = s => s) { { data: resolvedData, ...resolvedoptions, - } + }, ); return util.prepareNextState(state, response, callback); @@ -119,17 +119,18 @@ export function request(method, path, body, options = {}, callback = s => s) { } export { + as, combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, lastReferenceValue, + log, merge, sourceValue, - as } from '@openfn/language-common'; diff --git a/packages/claude/ast.json b/packages/claude/ast.json index 492b64aa1a..e6bcc73805 100644 --- a/packages/claude/ast.json +++ b/packages/claude/ast.json @@ -617,6 +617,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/claude/src/Adaptor.js b/packages/claude/src/Adaptor.js index 525d736867..1003c1edbe 100644 --- a/packages/claude/src/Adaptor.js +++ b/packages/claude/src/Adaptor.js @@ -47,7 +47,7 @@ export function execute(...operations) { return state => { return commonExecute( createClient, - ...operations + ...operations, )({ ...initialState, ...state, @@ -74,7 +74,7 @@ export function prompt(message, opts) { const [resolvedMessage, resolvedOpts] = expandReferences( state, message, - opts + opts, ); const payload = { @@ -91,15 +91,16 @@ export function prompt(message, opts) { export { combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/commcare/ast.json b/packages/commcare/ast.json index fa290a7ae0..da0de4b0db 100644 --- a/packages/commcare/ast.json +++ b/packages/commcare/ast.json @@ -1196,6 +1196,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/commcare/src/Adaptor.js b/packages/commcare/src/Adaptor.js index 38f2e0aee7..b1a0475b09 100644 --- a/packages/commcare/src/Adaptor.js +++ b/packages/commcare/src/Adaptor.js @@ -463,6 +463,7 @@ export { fn, fnIf, lastReferenceValue, + log, map, merge, sourceValue, diff --git a/packages/dagu/ast.json b/packages/dagu/ast.json index acfe2034bd..52231c8930 100644 --- a/packages/dagu/ast.json +++ b/packages/dagu/ast.json @@ -956,6 +956,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/dagu/src/Adaptor.js b/packages/dagu/src/Adaptor.js index 3c9e2360f0..4fbb937d10 100644 --- a/packages/dagu/src/Adaptor.js +++ b/packages/dagu/src/Adaptor.js @@ -102,6 +102,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/dhis2/ast.json b/packages/dhis2/ast.json index 164d198333..844a6ee6db 100644 --- a/packages/dhis2/ast.json +++ b/packages/dhis2/ast.json @@ -1194,6 +1194,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/dhis2/src/Adaptor.js b/packages/dhis2/src/Adaptor.js index 582b338a1c..66a1de2ceb 100644 --- a/packages/dhis2/src/Adaptor.js +++ b/packages/dhis2/src/Adaptor.js @@ -663,6 +663,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, sourceValue, diff --git a/packages/divoc/ast.json b/packages/divoc/ast.json index 0def9f4213..03a5d0224b 100644 --- a/packages/divoc/ast.json +++ b/packages/divoc/ast.json @@ -612,6 +612,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/divoc/src/Adaptor.js b/packages/divoc/src/Adaptor.js index 7208292a48..c63f69cead 100644 --- a/packages/divoc/src/Adaptor.js +++ b/packages/divoc/src/Adaptor.js @@ -2,7 +2,6 @@ import { execute as commonExecute } from '@openfn/language-common'; import { expandReferences } from '@openfn/language-common/util'; import * as util from './Utils.js'; - /** * State object * @typedef {Object} DivocHttpState @@ -18,7 +17,7 @@ import * as util from './Utils.js'; * @private * @example * execute(certifyVaccination({}))(state) - * @param {Operations} operations + * @param {Operations} operations * @returns {operation} */ export function execute(...operations) { @@ -28,11 +27,10 @@ export function execute(...operations) { }; return state => { - return commonExecute(...operations)({...initialState,...state}) - } + return commonExecute(...operations)({ ...initialState, ...state }); + }; } - /** * Certify a vaccination * @public @@ -89,34 +87,36 @@ export function execute(...operations) { */ export function certifyVaccination(data) { return async state => { - const [resolvedData] = expandReferences(state, data); const { baseUrl } = state.configuration; const options = { method: 'POST', data: resolvedData, - } - + }; + + const response = await util.request( + { ...state.configuration }, + '/v1/certify', + options, + ); - const response = await util.request({...state.configuration}, '/v1/certify', options); - return util.prepareNextState(state, response); - } + }; } - export { combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/dynamics/ast.json b/packages/dynamics/ast.json index 79cf0f7b2a..29f5e3a6ff 100644 --- a/packages/dynamics/ast.json +++ b/packages/dynamics/ast.json @@ -530,6 +530,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/dynamics/src/Adaptor.js b/packages/dynamics/src/Adaptor.js index 53d7307922..a3dc8337db 100644 --- a/packages/dynamics/src/Adaptor.js +++ b/packages/dynamics/src/Adaptor.js @@ -73,7 +73,7 @@ export function createEntity(params) { console.log('Create entity succeeded.'); resolve(response); } - } + }, ); }).then(data => { const nextState = { @@ -148,7 +148,7 @@ export function query(params) { console.log(JSON.parse(body)); resolve(response); } - } + }, ); }).then(data => { const nextState = { @@ -201,7 +201,7 @@ export function updateEntity(params) { console.log('Update succeeded.'); resolve(response); } - } + }, ); }).then(data => { const nextState = { @@ -252,7 +252,7 @@ export function deleteEntity(params) { console.log('Delete succeeded.'); resolve(response); } - } + }, ); }).then(data => { const nextState = { @@ -265,16 +265,17 @@ export function deleteEntity(params) { } export { + alterState, combine, + dataPath, + dataValue, + each, field, fields, - sourceValue, - alterState, fn, fnIf, - each, - merge, - dataPath, - dataValue, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/erpnext/ast.json b/packages/erpnext/ast.json index 542c164d81..e32684b11f 100644 --- a/packages/erpnext/ast.json +++ b/packages/erpnext/ast.json @@ -954,6 +954,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/erpnext/src/Adaptor.js b/packages/erpnext/src/Adaptor.js index f5a38313b8..b2f826e962 100644 --- a/packages/erpnext/src/Adaptor.js +++ b/packages/erpnext/src/Adaptor.js @@ -373,6 +373,7 @@ export { fn, fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/facebook/ast.json b/packages/facebook/ast.json index 29692fe992..6fe8e32383 100644 --- a/packages/facebook/ast.json +++ b/packages/facebook/ast.json @@ -574,6 +574,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/facebook/src/Adaptor.js b/packages/facebook/src/Adaptor.js index dd769b2eb3..cb70378320 100644 --- a/packages/facebook/src/Adaptor.js +++ b/packages/facebook/src/Adaptor.js @@ -93,7 +93,7 @@ export function postMessage(params) { console.log('Post Message succeeded.'); resolve(body); } - } + }, ); }).then(response => { const nextState = composeNextState(state, response); @@ -103,16 +103,17 @@ export function postMessage(params) { } export { + alterState, combine, + dataPath, + dataValue, + each, field, fields, - sourceValue, fn, fnIf, - alterState, - each, - merge, - dataPath, - dataValue, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/fhir-fr/ast.json b/packages/fhir-fr/ast.json index 540b4e3653..70624756ac 100644 --- a/packages/fhir-fr/ast.json +++ b/packages/fhir-fr/ast.json @@ -563,6 +563,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/fhir-fr/src/Adaptor.js b/packages/fhir-fr/src/Adaptor.js index 8c7dfcb689..f71a7d3e8c 100644 --- a/packages/fhir-fr/src/Adaptor.js +++ b/packages/fhir-fr/src/Adaptor.js @@ -6,15 +6,16 @@ import * as util from './Utils'; export { combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/fhir-ndr-et/ast.json b/packages/fhir-ndr-et/ast.json index f4c872727a..2add3ee3af 100644 --- a/packages/fhir-ndr-et/ast.json +++ b/packages/fhir-ndr-et/ast.json @@ -637,6 +637,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/fhir-ndr-et/src/Adaptor.js b/packages/fhir-ndr-et/src/Adaptor.js index a6587c642b..6245fbe11e 100644 --- a/packages/fhir-ndr-et/src/Adaptor.js +++ b/packages/fhir-ndr-et/src/Adaptor.js @@ -54,7 +54,7 @@ export const create = (resourceType, resource, params, callback = s => s) => { state.configuration, 'POST', resolvedResourceType, - opts + opts, ); return util.prepareNextState(state, response, callback); }; @@ -62,14 +62,15 @@ export const create = (resourceType, resource, params, callback = s => s) => { export { combine, + cursor, dataPath, dataValue, - cursor, each, field, fields, fn, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/fhir/ast.json b/packages/fhir/ast.json index 0e14c20ea1..d13aa71c5c 100644 --- a/packages/fhir/ast.json +++ b/packages/fhir/ast.json @@ -894,6 +894,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/fhir/src/Adaptor.js b/packages/fhir/src/Adaptor.js index 2d9187cd8a..fb416960b5 100644 --- a/packages/fhir/src/Adaptor.js +++ b/packages/fhir/src/Adaptor.js @@ -278,6 +278,7 @@ export { fn, fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/ghana-bdr/ast.json b/packages/ghana-bdr/ast.json index 057325b587..554534ffac 100644 --- a/packages/ghana-bdr/ast.json +++ b/packages/ghana-bdr/ast.json @@ -778,6 +778,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/ghana-bdr/src/Adaptor.js b/packages/ghana-bdr/src/Adaptor.js index f108e8d21f..e3123ca9ec 100644 --- a/packages/ghana-bdr/src/Adaptor.js +++ b/packages/ghana-bdr/src/Adaptor.js @@ -89,16 +89,17 @@ export function sendBirthNotification(data) { export { combine, - fn, - fnIf, - each, - merge, - field, - fields, cursor, - dateFns, dataPath, dataValue, - sourceValue, + dateFns, + each, + field, + fields, + fn, + fnIf, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/ghana-nia/ast.json b/packages/ghana-nia/ast.json index fae83e875f..4d7ccd63b0 100644 --- a/packages/ghana-nia/ast.json +++ b/packages/ghana-nia/ast.json @@ -778,6 +778,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/ghana-nia/src/Adaptor.js b/packages/ghana-nia/src/Adaptor.js index 50d1d66dc4..9e80a4c909 100644 --- a/packages/ghana-nia/src/Adaptor.js +++ b/packages/ghana-nia/src/Adaptor.js @@ -106,16 +106,17 @@ export function registerChild(data) { export { combine, - fn, - fnIf, - each, - merge, - field, - fields, cursor, - dateFns, dataPath, dataValue, - sourceValue, + dateFns, + each, + field, + fields, + fn, + fnIf, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/gmail/ast.json b/packages/gmail/ast.json index ee592b3fc5..441452541f 100644 --- a/packages/gmail/ast.json +++ b/packages/gmail/ast.json @@ -739,6 +739,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/gmail/src/Adaptor.js b/packages/gmail/src/Adaptor.js index 179482b145..2520579af5 100644 --- a/packages/gmail/src/Adaptor.js +++ b/packages/gmail/src/Adaptor.js @@ -240,6 +240,7 @@ export { fn, fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/godata/ast.json b/packages/godata/ast.json index 45dac62752..db20167128 100644 --- a/packages/godata/ast.json +++ b/packages/godata/ast.json @@ -1376,6 +1376,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/godata/src/Adaptor.js b/packages/godata/src/Adaptor.js index 7432f0a81a..08b33692b0 100644 --- a/packages/godata/src/Adaptor.js +++ b/packages/godata/src/Adaptor.js @@ -26,7 +26,7 @@ export function execute(...operations) { return state => { return commonExecute( login, - ...operations + ...operations, /* logout */ )({ ...initialState, ...state }).catch(e => { console.error(e); @@ -324,7 +324,7 @@ export function upsertOutbreak(outbreak, callback) { const { apiUrl, access_token } = state.configuration; const [resolvedOutbreak] = expandReferences(state, outbreak); - const {externalId, data} = resolvedOutbreak; + const { externalId, data } = resolvedOutbreak; const filter = JSON.stringify({ where: { id: externalId } }); @@ -668,7 +668,7 @@ export function upsertLocation(externalId, goDataLocation, callback) { if (response.data.length > 1) { console.log( response.data.length, - 'locations found; aborting upsert.' + 'locations found; aborting upsert.', ); return response; } else if (response.data.length === 1) { @@ -827,7 +827,7 @@ export function upsertReferenceData(externalId, goDataReferenceData, callback) { if (response.data.length > 1) { console.log( response.data.length, - 'reference data found; aborting upsert.' + 'reference data found; aborting upsert.', ); return response; } else if (response.data.length === 1) { @@ -883,16 +883,17 @@ export { axios }; // What functions do you want from the common adaptor? export { - combine, - fn, - fnIf, alterState, + combine, dataPath, dataValue, each, field, fields, + fn, + fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/googledrive/ast.json b/packages/googledrive/ast.json index 61e96e2cfb..59f1646532 100644 --- a/packages/googledrive/ast.json +++ b/packages/googledrive/ast.json @@ -1040,6 +1040,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/googledrive/src/Adaptor.js b/packages/googledrive/src/Adaptor.js index 233840ad33..19a326aad8 100644 --- a/packages/googledrive/src/Adaptor.js +++ b/packages/googledrive/src/Adaptor.js @@ -238,23 +238,24 @@ export function update(fileId, content) { } export { + alterState, + arrayToString, as, - fn, - fnIf, - util, - each, - field, - merge, chunk, - fields, - cursor, combine, - dateFns, - parseCsv, + cursor, dataPath, dataValue, - alterState, - sourceValue, - arrayToString, + dateFns, + each, + field, + fields, + fn, + fnIf, lastReferenceValue, + log, + merge, + parseCsv, + sourceValue, + util, } from '@openfn/language-common'; diff --git a/packages/googlehealthcare/ast.json b/packages/googlehealthcare/ast.json index 54f122e32d..f27791bac5 100644 --- a/packages/googlehealthcare/ast.json +++ b/packages/googlehealthcare/ast.json @@ -634,6 +634,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/googlehealthcare/src/Adaptor.js b/packages/googlehealthcare/src/Adaptor.js index 2f8c34ab6d..ddb34e9758 100644 --- a/packages/googlehealthcare/src/Adaptor.js +++ b/packages/googlehealthcare/src/Adaptor.js @@ -158,6 +158,7 @@ export { fn, fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/googlesheets/ast.json b/packages/googlesheets/ast.json index 9d269ab4d1..26ba70e92b 100644 --- a/packages/googlesheets/ast.json +++ b/packages/googlesheets/ast.json @@ -870,6 +870,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/googlesheets/src/Adaptor.js b/packages/googlesheets/src/Adaptor.js index 9a17e0cb4f..5efe55924f 100644 --- a/packages/googlesheets/src/Adaptor.js +++ b/packages/googlesheets/src/Adaptor.js @@ -245,6 +245,7 @@ export { fn, fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/hive/ast.json b/packages/hive/ast.json index 763390ae8c..485aab203e 100644 --- a/packages/hive/ast.json +++ b/packages/hive/ast.json @@ -669,6 +669,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/hive/src/Adaptor.js b/packages/hive/src/Adaptor.js index e017812846..3762a0f3bf 100644 --- a/packages/hive/src/Adaptor.js +++ b/packages/hive/src/Adaptor.js @@ -132,8 +132,9 @@ export { fields, fn, fnIf, - parseCsv, lastReferenceValue, + log, merge, + parseCsv, sourceValue, } from '@openfn/language-common'; diff --git a/packages/http/ast.json b/packages/http/ast.json index 31ea46e893..c383e78b5c 100644 --- a/packages/http/ast.json +++ b/packages/http/ast.json @@ -1556,6 +1556,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/http/src/Adaptor.js b/packages/http/src/Adaptor.js index 6555886c4e..1806f55e8c 100644 --- a/packages/http/src/Adaptor.js +++ b/packages/http/src/Adaptor.js @@ -209,6 +209,7 @@ export { group, humanProper, lastReferenceValue, + log, map, merge, parseCsv, diff --git a/packages/hubtel/ast.json b/packages/hubtel/ast.json index 19cbfbd30f..2dd276f8d5 100644 --- a/packages/hubtel/ast.json +++ b/packages/hubtel/ast.json @@ -698,6 +698,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/hubtel/src/Adaptor.js b/packages/hubtel/src/Adaptor.js index 128f716fe7..02b4291ac7 100644 --- a/packages/hubtel/src/Adaptor.js +++ b/packages/hubtel/src/Adaptor.js @@ -45,7 +45,7 @@ export function request(method, path, body, options = {}) { { body: resolvedData, ...resolvedoptions, - } + }, ); return util.prepareNextState(state, response); @@ -77,15 +77,16 @@ export function request(method, path, body, options = {}) { export { combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/ibipimo/ast.json b/packages/ibipimo/ast.json index 8847e155ff..a1952b77e9 100644 --- a/packages/ibipimo/ast.json +++ b/packages/ibipimo/ast.json @@ -1151,6 +1151,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/ibipimo/src/Adaptor.js b/packages/ibipimo/src/Adaptor.js index 2418e59953..0577e98f6d 100644 --- a/packages/ibipimo/src/Adaptor.js +++ b/packages/ibipimo/src/Adaptor.js @@ -243,6 +243,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/ihris/ast.json b/packages/ihris/ast.json index 61b1598158..e4878da674 100644 --- a/packages/ihris/ast.json +++ b/packages/ihris/ast.json @@ -747,6 +747,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/ihris/src/Adaptor.js b/packages/ihris/src/Adaptor.js index 0c98c69fc5..10a0e79789 100644 --- a/packages/ihris/src/Adaptor.js +++ b/packages/ihris/src/Adaptor.js @@ -14,6 +14,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/inform/ast.json b/packages/inform/ast.json index e6c0b7858b..f0b5c46747 100644 --- a/packages/inform/ast.json +++ b/packages/inform/ast.json @@ -1103,6 +1103,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/inform/src/Adaptor.js b/packages/inform/src/Adaptor.js index 1d2406788c..961bc49519 100644 --- a/packages/inform/src/Adaptor.js +++ b/packages/inform/src/Adaptor.js @@ -235,6 +235,7 @@ export function downloadAttachment(attachmentId, options = {}) { } export { + as, combine, cursor, dataPath, @@ -247,9 +248,9 @@ export { fnIf, group, lastReferenceValue, + log, merge, scrubEmojis, sourceValue, util, - as, } from '@openfn/language-common'; diff --git a/packages/intuit/ast.json b/packages/intuit/ast.json index 540b4e3653..70624756ac 100644 --- a/packages/intuit/ast.json +++ b/packages/intuit/ast.json @@ -563,6 +563,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/intuit/src/Adaptor.js b/packages/intuit/src/Adaptor.js index 0e7ff9cbd6..933f6cc6ac 100644 --- a/packages/intuit/src/Adaptor.js +++ b/packages/intuit/src/Adaptor.js @@ -1,16 +1,16 @@ - // More functions can be added here as needed export { combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/khanacademy/ast.json b/packages/khanacademy/ast.json index f5abc45050..46f6a4607c 100644 --- a/packages/khanacademy/ast.json +++ b/packages/khanacademy/ast.json @@ -511,6 +511,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/khanacademy/src/Adaptor.js b/packages/khanacademy/src/Adaptor.js index 8cd7b606f1..00f91a2aa0 100644 --- a/packages/khanacademy/src/Adaptor.js +++ b/packages/khanacademy/src/Adaptor.js @@ -43,13 +43,13 @@ export function fetch(params) { const { email, password, consumerKey, secretKey } = state.configuration; const [resolvedParams] = expandReferences(state, params); - const {getEndpoint, queryParams, postUrl} = resolvedParams; + const { getEndpoint, queryParams, postUrl } = resolvedParams; const query = qs.stringify(queryParams); const getUrl = resolveUrl( 'https://www.khanacademy.org/api/v1' + '/', - getEndpoint + '?' + query + getEndpoint + '?' + query, ); console.log('Fetching data from URL: ' + getUrl); @@ -79,7 +79,7 @@ export function fetch(params) { console.log('Token request successful.'); resolve(qs.parse(body)); } - } + }, ); }) @@ -114,7 +114,7 @@ export function fetch(params) { console.log('Token auhorization successful.'); resolve(auth); } - } + }, ); }); }) @@ -144,7 +144,7 @@ export function fetch(params) { console.log('Token exchange successful.'); resolve(qs.parse(body)); } - } + }, ); }); }) @@ -175,7 +175,7 @@ export function fetch(params) { console.log(body); resolve(body); } - } + }, ); }); }) @@ -197,7 +197,7 @@ export function fetch(params) { console.log('POST succeeded.'); resolve(body); } - } + }, ); }); }) @@ -206,15 +206,16 @@ export function fetch(params) { } export { - combine, - fn, - fnIf, - field, - sourceValue, - fields, alterState, - merge, + combine, dataPath, dataValue, + field, + fields, + fn, + fnIf, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/kobotoolbox/ast.json b/packages/kobotoolbox/ast.json index d70b5a9a50..e487ab21bb 100644 --- a/packages/kobotoolbox/ast.json +++ b/packages/kobotoolbox/ast.json @@ -923,6 +923,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/kobotoolbox/src/Adaptor.js b/packages/kobotoolbox/src/Adaptor.js index dee446cfb5..c4c6f561a1 100644 --- a/packages/kobotoolbox/src/Adaptor.js +++ b/packages/kobotoolbox/src/Adaptor.js @@ -147,6 +147,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, sourceValue, diff --git a/packages/lamisplus/ast.json b/packages/lamisplus/ast.json index 3886983c94..8a28edf5fc 100644 --- a/packages/lamisplus/ast.json +++ b/packages/lamisplus/ast.json @@ -795,6 +795,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/lamisplus/src/Adaptor.js b/packages/lamisplus/src/Adaptor.js index 5e0dfb50d1..e49ed1ae8c 100644 --- a/packages/lamisplus/src/Adaptor.js +++ b/packages/lamisplus/src/Adaptor.js @@ -99,6 +99,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/magpi/ast.json b/packages/magpi/ast.json index 203de1c7a4..c81cf428cf 100644 --- a/packages/magpi/ast.json +++ b/packages/magpi/ast.json @@ -617,6 +617,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/magpi/src/Adaptor.js b/packages/magpi/src/Adaptor.js index cec2a1df58..847764277d 100644 --- a/packages/magpi/src/Adaptor.js +++ b/packages/magpi/src/Adaptor.js @@ -100,18 +100,18 @@ export function fetchSurveyData(params) { } console.log( - `Converted ${submissions.length} submission(s) to JSON:` + `Converted ${submissions.length} submission(s) to JSON:`, ); // console.log(submissions); resolve(submissions); } else { console.log( - 'There is no survey data matching the current parameters.' + 'There is no survey data matching the current parameters.', ); resolve([]); } } - } + }, ); }) .then(submissions => { @@ -132,7 +132,7 @@ export function fetchSurveyData(params) { } else { console.log('POST succeeded.'); } - } + }, ); }); return submissions; @@ -142,7 +142,7 @@ export function fetchSurveyData(params) { // TODO: if Magpi API does not return in date order, find oldest... state.lastSubmissionDate = submissions[0].LastSubmissionDate; console.log( - `Set \"lastSubmissionDate\" for next run to: ${submissions[0].LastSubmissionDate}` + `Set \"lastSubmissionDate\" for next run to: ${submissions[0].LastSubmissionDate}`, ); } // Set the lastSubmissionDate for the next time the job runs. @@ -183,16 +183,17 @@ export function submitRecord(jsonData) { } export { - combine, - fn, - fnIf, alterState, - field, - fields, - sourceValue, - each, - merge, + combine, dataPath, dataValue, + each, + field, + fields, + fn, + fnIf, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/mailchimp/ast.json b/packages/mailchimp/ast.json index 89129d30dd..c9a853f1b4 100644 --- a/packages/mailchimp/ast.json +++ b/packages/mailchimp/ast.json @@ -1450,6 +1450,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/mailchimp/src/Adaptor.js b/packages/mailchimp/src/Adaptor.js index fc17727d1f..1b58d681e4 100644 --- a/packages/mailchimp/src/Adaptor.js +++ b/packages/mailchimp/src/Adaptor.js @@ -462,17 +462,18 @@ export { axios, md5 }; // What functions do you want from the common adaptor? export { - combine, - fn, - fnIf, alterState, + chunk, + combine, dataPath, dataValue, each, field, fields, + fn, + fnIf, lastReferenceValue, + log, merge, - chunk, sourceValue, } from '@openfn/language-common'; diff --git a/packages/mailgun/ast.json b/packages/mailgun/ast.json index d95d0c5789..a15716aa6a 100644 --- a/packages/mailgun/ast.json +++ b/packages/mailgun/ast.json @@ -570,6 +570,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/mailgun/src/Adaptor.js b/packages/mailgun/src/Adaptor.js index 81b92da141..e29ea8c166 100644 --- a/packages/mailgun/src/Adaptor.js +++ b/packages/mailgun/src/Adaptor.js @@ -44,7 +44,7 @@ export function execute(...operations) { return commonExecute( setupClient, ...operations, - teardownClient + teardownClient, )({ ...initialState, ...state }); }; } @@ -113,17 +113,18 @@ export function send(params) { } export { - combine, - fn, - fnIf, - field, alterState, - fields, - sourceValue, - merge, - each, + beta, + combine, dataPath, dataValue, + each, + field, + fields, + fn, + fnIf, lastReferenceValue, - beta, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/maximo/ast.json b/packages/maximo/ast.json index acd96b8ca8..efbdb48fe6 100644 --- a/packages/maximo/ast.json +++ b/packages/maximo/ast.json @@ -662,6 +662,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/maximo/src/Adaptor.js b/packages/maximo/src/Adaptor.js index 0a39a2aa11..55d0fd70a3 100644 --- a/packages/maximo/src/Adaptor.js +++ b/packages/maximo/src/Adaptor.js @@ -98,10 +98,10 @@ export function fetch(params) { console.log('POST succeeded.'); resolve(getResponseBody); } - } + }, ); } - } + }, ); }) .then(response => { @@ -168,7 +168,7 @@ export function create(params) { console.log('POST succeeded.'); resolve(body); } - } + }, ); }).then(data => { const nextState = { ...state, response: { body: data } }; @@ -236,7 +236,7 @@ export function update(params) { console.log('Update succeeded.'); resolve(body); } - } + }, ); }).then(data => { const nextState = { ...state, response: { body: data } }; @@ -304,7 +304,7 @@ export function update75(params) { console.log('Update succeeded.'); resolve(body); } - } + }, ); }).then(data => { const nextState = { ...state, response: { body: data } }; @@ -314,16 +314,17 @@ export function update75(params) { } export { + alterState, combine, + dataPath, + dataValue, + each, field, fields, - sourceValue, fn, fnIf, - alterState, - each, - merge, - dataPath, - dataValue, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/medicmobile/ast.json b/packages/medicmobile/ast.json index fe422f95e3..1d79bf7558 100644 --- a/packages/medicmobile/ast.json +++ b/packages/medicmobile/ast.json @@ -690,6 +690,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/medicmobile/src/Adaptor.js b/packages/medicmobile/src/Adaptor.js index aa04ed416d..d2e977ca89 100644 --- a/packages/medicmobile/src/Adaptor.js +++ b/packages/medicmobile/src/Adaptor.js @@ -61,7 +61,7 @@ export function fetchSubmissions(formId, params, postUrl) { json: submissions[i], }); console.log( - `Posted submission ${submissions[i].fields.meta.instanceID} ✓` + `Posted submission ${submissions[i].fields.meta.instanceID} ✓`, ); } return state; @@ -93,7 +93,7 @@ export function changesApi(params, callback) { if (error) return error; console.log(response); return new Error( - `Server responded with ${response.statusCode}:\n ${response.body}` + `Server responded with ${response.statusCode}:\n ${response.body}`, ); } @@ -142,7 +142,7 @@ export function changesApi(params, callback) { console.log('Request Success ✓'); resolve(body); } - } + }, ) .auth(username, password); }).then(response => { @@ -198,16 +198,17 @@ export function pickFormData(formId) { } export { - combine, - fn, - fnIf, alterState, + combine, dataPath, dataValue, each, field, fields, + fn, + fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/memento/ast.json b/packages/memento/ast.json index e39e0f2569..362a01dba3 100644 --- a/packages/memento/ast.json +++ b/packages/memento/ast.json @@ -1131,6 +1131,55 @@ }, "valid": true }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/memento/src/Adaptor.js b/packages/memento/src/Adaptor.js index f6c0c1b6fa..41f837267b 100644 --- a/packages/memento/src/Adaptor.js +++ b/packages/memento/src/Adaptor.js @@ -232,6 +232,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/minio/ast.json b/packages/minio/ast.json index 80739bb073..222b5cf597 100644 --- a/packages/minio/ast.json +++ b/packages/minio/ast.json @@ -1383,6 +1383,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/minio/src/Adaptor.js b/packages/minio/src/Adaptor.js index 13f9892b2c..d8109e9e5c 100644 --- a/packages/minio/src/Adaptor.js +++ b/packages/minio/src/Adaptor.js @@ -363,7 +363,6 @@ export { cursor, dataPath, dataValue, - parseCsv, dateFns, each, field, @@ -372,8 +371,10 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, + parseCsv, scrubEmojis, sourceValue, util, diff --git a/packages/mogli/ast.json b/packages/mogli/ast.json index 474870cf75..dd3aa8e8ea 100644 --- a/packages/mogli/ast.json +++ b/packages/mogli/ast.json @@ -825,6 +825,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/mogli/src/Adaptor.js b/packages/mogli/src/Adaptor.js index 740741c4a0..3a1b08f666 100644 --- a/packages/mogli/src/Adaptor.js +++ b/packages/mogli/src/Adaptor.js @@ -199,23 +199,24 @@ function expandReferences(state, attrs) { export { lookup, relationship } from './sourceHelpers.js'; export { - each, - join, - fields, - field, - source, - sourceValue, + alterState, + arrayToString, + beta, combine, - merge, dataPath, dataValue, - referencePath, - lastReferenceValue, - index, - beta, - toArray, - arrayToString, - alterState, + each, + field, + fields, fn, fnIf, + index, + join, + lastReferenceValue, + log, + merge, + referencePath, + source, + sourceValue, + toArray, } from '@openfn/language-common'; diff --git a/packages/mojatax/ast.json b/packages/mojatax/ast.json index e1121dfa29..e3d051c22f 100644 --- a/packages/mojatax/ast.json +++ b/packages/mojatax/ast.json @@ -736,6 +736,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/mojatax/src/Adaptor.js b/packages/mojatax/src/Adaptor.js index 28c6f3820b..a9644f8f70 100644 --- a/packages/mojatax/src/Adaptor.js +++ b/packages/mojatax/src/Adaptor.js @@ -45,7 +45,7 @@ export function execute(...operations) { return state => { return commonExecute( util.authorize, - ...operations + ...operations, )({ ...initialState, ...state, @@ -103,7 +103,7 @@ export function request(method, path, body, options = {}, callback = s => s) { { data: resolvedData, ...resolvedoptions, - } + }, ); return util.prepareNextState(state, response, callback); @@ -112,15 +112,16 @@ export function request(method, path, body, options = {}, callback = s => s) { export { combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/mongodb/ast.json b/packages/mongodb/ast.json index 88472a52e9..42e2507b54 100644 --- a/packages/mongodb/ast.json +++ b/packages/mongodb/ast.json @@ -660,6 +660,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/mongodb/src/Adaptor.js b/packages/mongodb/src/Adaptor.js index 2f373e39a3..6aae132028 100644 --- a/packages/mongodb/src/Adaptor.js +++ b/packages/mongodb/src/Adaptor.js @@ -29,7 +29,7 @@ export function execute(...operations) { return commonExecute( connect, ...operations, - disconnect + disconnect, )({ ...initialState, ...state }); }; } @@ -43,17 +43,19 @@ export function execute(...operations) { * @returns {State} */ function connect(state) { - const { clusterHostname, username, password, protocol = "mongodb+srv", options = { "retryWrites": true, "w": "majority" } } = state.configuration; - + const { + clusterHostname, + username, + password, + protocol = 'mongodb+srv', + options = { retryWrites: true, w: 'majority' }, + } = state.configuration; + const uri = `${protocol}://${encodeURIComponent( - username - )}:${encodeURIComponent( - password - )}@${clusterHostname}/test${ - Object.keys(options).length ? "?" : "" - }${ - encodeURIComponent(new URLSearchParams(options).toString()) - }`; + username, + )}:${encodeURIComponent(password)}@${clusterHostname}/test${ + Object.keys(options).length ? '?' : '' + }${encodeURIComponent(new URLSearchParams(options).toString())}`; const client = new MongoClient(uri, { useNewUrlParser: true }); @@ -114,7 +116,7 @@ export function insertDocuments(params) { state.client.close(); } else { console.log( - `Inserted ${documents.length} documents into the collection` + `Inserted ${documents.length} documents into the collection`, ); console.log(JSON.stringify(result, null, 2)); const nextState = composeNextState(state, result); @@ -213,15 +215,15 @@ export function updateDocument(params) { } else { console.log( `Updated a document matching ${JSON.stringify( - filter - )} in the collection.` + filter, + )} in the collection.`, ); console.log(JSON.stringify(result, null, 2)); const nextState = composeNextState(state, result); if (callback) resolve(callback(nextState)); resolve(nextState); } - } + }, ); }); } catch (error) { @@ -232,16 +234,17 @@ export function updateDocument(params) { } export { + alterState, combine, + dataPath, + dataValue, + each, field, fields, - sourceValue, fn, fnIf, - alterState, - each, - merge, - dataPath, - dataValue, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/monnify/ast.json b/packages/monnify/ast.json index 35d215b3b5..0c23cf6613 100644 --- a/packages/monnify/ast.json +++ b/packages/monnify/ast.json @@ -1005,6 +1005,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/monnify/src/Adaptor.js b/packages/monnify/src/Adaptor.js index d2f445cb08..75c2eda34c 100644 --- a/packages/monnify/src/Adaptor.js +++ b/packages/monnify/src/Adaptor.js @@ -182,6 +182,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/motherduck/ast.json b/packages/motherduck/ast.json index 9e00fdb417..8e68d36af3 100644 --- a/packages/motherduck/ast.json +++ b/packages/motherduck/ast.json @@ -988,6 +988,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/motherduck/src/Adaptor.js b/packages/motherduck/src/Adaptor.js index 991e5e0ed9..0cc673e096 100644 --- a/packages/motherduck/src/Adaptor.js +++ b/packages/motherduck/src/Adaptor.js @@ -269,6 +269,7 @@ export function insert(table, records, options = {}) { export { alterState, arrayToString, + as, combine, cursor, dataPath, @@ -281,10 +282,10 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, sourceValue, - as, } from '@openfn/language-common'; export { util }; diff --git a/packages/mpesa/ast.json b/packages/mpesa/ast.json index 4903230b92..264fd5cdf4 100644 --- a/packages/mpesa/ast.json +++ b/packages/mpesa/ast.json @@ -303,7 +303,7 @@ "tags": [ { "title": "example", - "description": "request(\"POST\", \"/mpesa/c2b/v1/registerurl\", \n {\n \"ShortCode\": 600426,\n \"ResponseType\": \"Completed\",\n \"ConfirmationURL\": \"https://mydomain.com/confirmation\",\n \"ValidationURL\": \"https://mydomain.com/validation\"\n });", + "description": "request(\"POST\", \"/mpesa/c2b/v1/registerurl\",\n {\n \"ShortCode\": 600426,\n \"ResponseType\": \"Completed\",\n \"ConfirmationURL\": \"https://mydomain.com/confirmation\",\n \"ValidationURL\": \"https://mydomain.com/validation\"\n });", "caption": "Register a URL to receive payment notifications" }, { @@ -933,6 +933,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/mpesa/src/Adaptor.js b/packages/mpesa/src/Adaptor.js index 8b82a3a43e..d81291db18 100644 --- a/packages/mpesa/src/Adaptor.js +++ b/packages/mpesa/src/Adaptor.js @@ -19,7 +19,6 @@ import * as util from './Utils.js'; * @property {object} headers - An object of headers to append to the request. */ - /** * STKPush request data object * @typedef {Object} STKPushObject @@ -33,7 +32,6 @@ import * as util from './Utils.js'; * @property {string} TransactionDesc - Any additional information/comment that can be sent along with the request from you system. */ - /** * Initiate a STK pin prompt to a Safaricom mobile number. * @function @@ -55,10 +53,9 @@ import * as util from './Utils.js'; */ export function stkPush(data, options = {}) { return async state => { - const { short_code, pass_key } = state.configuration; - const timestamp = util.getTimestamp() + const timestamp = util.getTimestamp(); const password = short_code + pass_key + timestamp; @@ -72,17 +69,21 @@ export function stkPush(data, options = {}) { console.log('Initiating STK Push request...'); - const response = await util.request(state, 'POST', '/mpesa/stkpush/v1/processrequest', { ...options, body }) - return util.prepareNextState(state, response) - } + const response = await util.request( + state, + 'POST', + '/mpesa/stkpush/v1/processrequest', + { ...options, body }, + ); + return util.prepareNextState(state, response); + }; } - /** * Check transaction status data object. * @typedef {Object} TransactionStatusObject * @public - * @property {string} Initiator - The name of the initiator initiating the request. + * @property {string} Initiator - The name of the initiator initiating the request. * @property {string} SecurityCredential - Encrypted credential of the user getting transaction status. * @property {string} TransactionID - Unique identifier to identify a transaction on Mpesa. * @property {number} PartyA - Organization/MSISDN receiving the transaction. @@ -93,7 +94,6 @@ export function stkPush(data, options = {}) { * @property {string} Occassion - Optional parameter. */ - /** * Check the status of the transaction * @function @@ -117,7 +117,6 @@ export function stkPush(data, options = {}) { */ export function checkTransactionStatus(data, options = {}) { return async state => { - const { short_code, pass_key } = state.configuration; const timestamp = util.getTimestamp(); @@ -129,14 +128,19 @@ export function checkTransactionStatus(data, options = {}) { Password: Buffer.from(password).toString('base64'), Timestamp: timestamp, CommandID: 'TransactionStatusQuery', - ...data + ...data, }; console.log('Initiating check transaction request...'); - const response = await util.request(state, 'POST', '/mpesa/transactionstatus/v1/query', { ...options, body }); - return util.prepareNextState(state, response) - } + const response = await util.request( + state, + 'POST', + '/mpesa/transactionstatus/v1/query', + { ...options, body }, + ); + return util.prepareNextState(state, response); + }; } /** @@ -146,7 +150,7 @@ export function checkTransactionStatus(data, options = {}) { * @property {numeric} ShortCode - Usually, a unique number is tagged to an M-PESA pay bill/till number of the organization. * @property {string} ResponseType - This parameter specifies what is to happen if for any reason the validation URL is not reachable. Sample values: 'Canceled', 'Completed' * @property {URL} ConfirmationURL - This is the URL that receives the confirmation request from API upon payment completion. - * @property {URL} ValidationURL - This is the URL that receives the validation request from the API upon payment submission. + * @property {URL} ValidationURL - This is the URL that receives the validation request from the API upon payment submission. */ /** @@ -167,15 +171,18 @@ export function checkTransactionStatus(data, options = {}) { */ export function registerUrl(data, options) { return async state => { - console.log('Initiating register URL request...'); - const response = await util.request(state, 'POST', '/mpesa/c2b/v1/registerurl', { ...options, body: { ...data } }); - return util.prepareNextState(state, response) - } + const response = await util.request( + state, + 'POST', + '/mpesa/c2b/v1/registerurl', + { ...options, body: { ...data } }, + ); + return util.prepareNextState(state, response); + }; } - /** * Remit tax parameter definition * @typedef {Object} RemitTaxObject @@ -212,20 +219,24 @@ export function registerUrl(data, options) { */ export function remitTax(data, options = {}) { return async state => { - const body = { SenderIdentifierType: '4', RecieverIdentifierType: '4', PartyB: 572572, CommandID: 'PayTaxToKRA', ...data, - } + }; console.log('Initiating remit tax request...'); - const response = await util.request(state, 'POST', '/mpesa/b2b/v1/remittax', { ...options, body }); - return util.prepareNextState(state, response) - } + const response = await util.request( + state, + 'POST', + '/mpesa/b2b/v1/remittax', + { ...options, body }, + ); + return util.prepareNextState(state, response); + }; } /** @@ -242,7 +253,6 @@ export function remitTax(data, options = {}) { * @property {URL} ResultURL - A URL that will be used to send transaction results after processing. */ - /** * Pay for goods and services directly from your business account to a till number, merchant store number or Merchant HO * @function @@ -267,25 +277,29 @@ export function remitTax(data, options = {}) { */ export function buyGoods(data, options = {}) { return async state => { - const body = { CommandID: 'BusinessBuyGoods', SenderIdentifierType: '4', RecieverIdentifierType: '4', ...data, - } + }; console.log('Initiating buy goods request...'); - const response = await util.request(state, 'POST', '/mpesa/b2b/v1/paymentrequest', { ...options, body }); - return util.prepareNextState(state, response) - } + const response = await util.request( + state, + 'POST', + '/mpesa/b2b/v1/paymentrequest', + { ...options, body }, + ); + return util.prepareNextState(state, response); + }; } /** * Make a general HTTP request * @example Register a URL to receive payment notifications - * request("POST", "/mpesa/c2b/v1/registerurl", + * request("POST", "/mpesa/c2b/v1/registerurl", * { * "ShortCode": 600426, * "ResponseType": "Completed", @@ -306,35 +320,30 @@ export function request(method, path, body, options = {}) { const [resolvedMethod, resolvedPath, resolvedBody, resolvedoptions] = expandReferences(state, method, path, body, options); - console.log(`Initiating ${method} request to: ${resolvedPath}`); - const response = await util.request( - state, - resolvedMethod, - resolvedPath, - { - body: resolvedBody, - ...resolvedoptions, - } - ); + const response = await util.request(state, resolvedMethod, resolvedPath, { + body: resolvedBody, + ...resolvedoptions, + }); return util.prepareNextState(state, response); }; } export { + as, combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, lastReferenceValue, + log, merge, sourceValue, - as } from '@openfn/language-common'; diff --git a/packages/msgraph/ast.json b/packages/msgraph/ast.json index d41f64b9b1..e60526f006 100644 --- a/packages/msgraph/ast.json +++ b/packages/msgraph/ast.json @@ -1148,6 +1148,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/msgraph/src/Adaptor.js b/packages/msgraph/src/Adaptor.js index e0b0df9e0d..ebacde7ab5 100644 --- a/packages/msgraph/src/Adaptor.js +++ b/packages/msgraph/src/Adaptor.js @@ -72,7 +72,7 @@ export function create(resource, data, callback) { const [resolvedResource, resolvedData] = expandReferences( state, resource, - data + data, ); const { accessToken, apiVersion } = state.configuration; @@ -86,7 +86,7 @@ export function create(resource, data, callback) { }; return request(url, options).then(response => - handleResponse(response, state, callback) + handleResponse(response, state, callback), ); }; } @@ -110,7 +110,7 @@ export function get(path, query, callback = false) { const url = setUrl(resolvedPath, apiVersion); return request(url, { query: resolvedQuery, accessToken }).then(response => - handleResponse(response, state, callback) + handleResponse(response, state, callback), ); }; } @@ -138,7 +138,7 @@ export function getDrive(specifier, name = 'default', callback = s => s) { const [resolvedSpecifier, resolvedName] = expandReferences( state, specifier, - name + name, ); const { id, owner = 'drive' } = resolvedSpecifier; @@ -182,7 +182,7 @@ export function getFolder(pathOrId, options, callback = s => s) { const [resolvedPathOrId, resolvedOptions] = expandReferences( state, pathOrId, - options + options, ); const { driveName, metadata } = { ...defaultOptions, ...resolvedOptions }; @@ -195,7 +195,7 @@ export function getFolder(pathOrId, options, callback = s => s) { if (resolvedPathOrId.startsWith('/')) { resource = `drives/${driveId}/root:/${encodeURIComponent( - resolvedPathOrId + resolvedPathOrId, )}`; } else { resource = `drives/${driveId}/items/${resolvedPathOrId}`; @@ -208,7 +208,7 @@ export function getFolder(pathOrId, options, callback = s => s) { const url = setUrl(resource, apiVersion); return request(url, { accessToken }).then(response => - handleResponse(response, state, callback) + handleResponse(response, state, callback), ); }; } @@ -237,7 +237,7 @@ export function getFile(pathOrId, options, callback = s => s) { const [resolvedPathOrId, resolvedOptions] = expandReferences( state, pathOrId, - options + options, ); const { driveName, metadata } = { @@ -253,7 +253,7 @@ export function getFile(pathOrId, options, callback = s => s) { if (resolvedPathOrId.startsWith('/')) { resource = `drives/${driveId}/root:/${encodeURIComponent( - resolvedPathOrId + resolvedPathOrId, )}`; } else { resource = `drives/${driveId}/items/${resolvedPathOrId}`; @@ -323,7 +323,7 @@ export function uploadFile(resource, data, callback) { const [resolvedResource, resolvedData] = expandReferences( state, resource, - data + data, ); const { contentType, driveId, siteId, folderId, onConflict, fileName } = { @@ -374,6 +374,7 @@ export function uploadFile(resource, data, callback) { export { request, sheetToBuffer } from './Utils.js'; export { + as, combine, cursor, dataPath, @@ -385,8 +386,8 @@ export { fn, fnIf, lastReferenceValue, + log, merge, - sourceValue, parseCsv, - as + sourceValue, } from '@openfn/language-common'; diff --git a/packages/mssql/ast.json b/packages/mssql/ast.json index 2515142dbc..3b2d92de11 100644 --- a/packages/mssql/ast.json +++ b/packages/mssql/ast.json @@ -1295,6 +1295,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/mssql/src/Adaptor.js b/packages/mssql/src/Adaptor.js index 0b7ed7f87f..0cdbdef78b 100644 --- a/packages/mssql/src/Adaptor.js +++ b/packages/mssql/src/Adaptor.js @@ -856,7 +856,9 @@ export function modifyTable(tableName, columns, options) { export { alterState, + as, combine, + cursor, dataPath, dataValue, dateFns, @@ -866,8 +868,7 @@ export { fn, fnIf, lastReferenceValue, - cursor, + log, merge, sourceValue, - as, } from '@openfn/language-common'; diff --git a/packages/msupply/ast.json b/packages/msupply/ast.json index feb65ab030..83bafd15b6 100644 --- a/packages/msupply/ast.json +++ b/packages/msupply/ast.json @@ -948,6 +948,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/msupply/src/Adaptor.js b/packages/msupply/src/Adaptor.js index a39a7bb8a2..c6c1cb0f6b 100644 --- a/packages/msupply/src/Adaptor.js +++ b/packages/msupply/src/Adaptor.js @@ -182,6 +182,7 @@ export { fnIf, group, lastReferenceValue, + log, merge, scrubEmojis, sourceValue, diff --git a/packages/mtn-momo/ast.json b/packages/mtn-momo/ast.json index 86f58bd01f..9c141b3eeb 100644 --- a/packages/mtn-momo/ast.json +++ b/packages/mtn-momo/ast.json @@ -831,6 +831,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/mtn-momo/src/Adaptor.js b/packages/mtn-momo/src/Adaptor.js index 1e764cf459..2122688d20 100644 --- a/packages/mtn-momo/src/Adaptor.js +++ b/packages/mtn-momo/src/Adaptor.js @@ -79,6 +79,7 @@ export function request(method, path, body, options = {}) { } export { + as, combine, cursor, dataPath, @@ -91,9 +92,9 @@ export { fnIf, group, lastReferenceValue, + log, merge, scrubEmojis, sourceValue, util, - as } from '@openfn/language-common'; diff --git a/packages/mysql/ast.json b/packages/mysql/ast.json index 63a4e6dead..efe72a8b11 100644 --- a/packages/mysql/ast.json +++ b/packages/mysql/ast.json @@ -968,6 +968,55 @@ }, "valid": true }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/mysql/src/Adaptor.js b/packages/mysql/src/Adaptor.js index 885fb32c57..f0107675b4 100644 --- a/packages/mysql/src/Adaptor.js +++ b/packages/mysql/src/Adaptor.js @@ -310,21 +310,22 @@ export function upsertMany(table, data) { } export { - fn, - fnIf, - each, - merge, - field, - fields, + alterState, + arrayToString, + as, assert, - cursor, - dateFns, combine, + cursor, dataPath, dataValue, - alterState, - sourceValue, - arrayToString, + dateFns, + each, + field, + fields, + fn, + fnIf, lastReferenceValue, - as, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/nexmo/ast.json b/packages/nexmo/ast.json index ef16f9f12f..70965b82ad 100644 --- a/packages/nexmo/ast.json +++ b/packages/nexmo/ast.json @@ -594,6 +594,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/nexmo/src/Adaptor.js b/packages/nexmo/src/Adaptor.js index 65042b960b..b42c06e50c 100644 --- a/packages/nexmo/src/Adaptor.js +++ b/packages/nexmo/src/Adaptor.js @@ -49,7 +49,7 @@ export function sendSMS(from, toNumber, message) { state, from, toNumber, - message + message, ); const nexmo = new Nexmo({ @@ -74,7 +74,7 @@ export function sendSMS(from, toNumber, message) { console.log(response); resolve(response); } - } + }, ); }).then(response => { const nextState = composeNextState(state, response); @@ -84,16 +84,17 @@ export function sendSMS(from, toNumber, message) { } export { + alterState, combine, + dataPath, + dataValue, + each, field, fields, - sourceValue, fn, fnIf, - alterState, - each, - merge, - dataPath, - dataValue, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/ocl/ast.json b/packages/ocl/ast.json index 46e474029f..b982b5565c 100644 --- a/packages/ocl/ast.json +++ b/packages/ocl/ast.json @@ -703,6 +703,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/ocl/src/Adaptor.js b/packages/ocl/src/Adaptor.js index 05d69359ab..aabc818d4c 100644 --- a/packages/ocl/src/Adaptor.js +++ b/packages/ocl/src/Adaptor.js @@ -73,7 +73,7 @@ export function getMappings(ownerId, repositoryId, options, callback = false) { }); return request(url, query).then(response => - handleResponse(response, state, callback) + handleResponse(response, state, callback), ); }; } @@ -112,7 +112,7 @@ export function get(path, query, callback = false) { const url = `${baseUrl}/${resolvedPath}`; return request(url, resolvedQuery).then(response => - handleResponse(response, state, callback) + handleResponse(response, state, callback), ); }; } @@ -128,6 +128,7 @@ export { field, fields, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/odk/ast.json b/packages/odk/ast.json index bf065fd8b2..2b0c67aab1 100644 --- a/packages/odk/ast.json +++ b/packages/odk/ast.json @@ -955,6 +955,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/odk/src/Adaptor.js b/packages/odk/src/Adaptor.js index e65b88797e..f2fabe64d6 100644 --- a/packages/odk/src/Adaptor.js +++ b/packages/odk/src/Adaptor.js @@ -50,7 +50,7 @@ export function getSubmissions(projectId, xmlFormId, query = {}) { 'GET', path, null, - { query: resolvedQuery } + { query: resolvedQuery }, ); responseWithoutBody['@odata.context'] = body['@odata.context']; @@ -60,7 +60,7 @@ export function getSubmissions(projectId, xmlFormId, query = {}) { ...state, response: responseWithoutBody, }, - body.value + body.value, ); }; } @@ -146,7 +146,7 @@ export function request(method, path, body, options = {}) { resolvedMethod, resolvedPath, resolvedBody, - resolvedOptions + resolvedOptions, ); return util.prepareNextState(state, response); @@ -169,16 +169,17 @@ export function execute(...operations) { export { combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/odoo/ast.json b/packages/odoo/ast.json index 532f0995a5..feb38da1ce 100644 --- a/packages/odoo/ast.json +++ b/packages/odoo/ast.json @@ -958,6 +958,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/odoo/src/Adaptor.js b/packages/odoo/src/Adaptor.js index 0431326aaa..c862a53c80 100644 --- a/packages/odoo/src/Adaptor.js +++ b/packages/odoo/src/Adaptor.js @@ -361,6 +361,7 @@ export { fields, fn, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/openboxes/ast.json b/packages/openboxes/ast.json index b8b711dc74..4f9ef8b8ad 100644 --- a/packages/openboxes/ast.json +++ b/packages/openboxes/ast.json @@ -762,6 +762,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/openboxes/src/Adaptor.js b/packages/openboxes/src/Adaptor.js index 4d35c03f22..0524b222e2 100644 --- a/packages/openboxes/src/Adaptor.js +++ b/packages/openboxes/src/Adaptor.js @@ -35,7 +35,7 @@ export function get(path, options) { return async state => { const response = await util.request(state, 'GET', path, options); return util.prepareNextState(state, response); - } + }; } /** @@ -64,9 +64,12 @@ export function get(path, options) { */ export function post(path, body, options) { return async state => { - const response = await util.request(state, 'POST', path, { ...options, body }); + const response = await util.request(state, 'POST', path, { + ...options, + body, + }); return util.prepareNextState(state, response); - } + }; } /** @@ -95,14 +98,18 @@ export function post(path, body, options) { */ export function request(method, path, options = {}) { return async state => { - const [resolvedMethod, resolvedPath, resolvedoptions] = expandReferences(state, method, path, options); + const [resolvedMethod, resolvedPath, resolvedoptions] = expandReferences( + state, + method, + path, + options, + ); const response = await util.request( state, resolvedMethod, resolvedPath, resolvedoptions, - ); return util.prepareNextState(state, response); @@ -111,15 +118,16 @@ export function request(method, path, options = {}) { export { combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/opencrvs/ast.json b/packages/opencrvs/ast.json index f56679688a..3b2abb6968 100644 --- a/packages/opencrvs/ast.json +++ b/packages/opencrvs/ast.json @@ -1154,6 +1154,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/opencrvs/src/Adaptor.js b/packages/opencrvs/src/Adaptor.js index d61adfeaec..fc588e669d 100644 --- a/packages/opencrvs/src/Adaptor.js +++ b/packages/opencrvs/src/Adaptor.js @@ -388,6 +388,7 @@ export { fnIf, group, lastReferenceValue, + log, merge, scrubEmojis, sourceValue, diff --git a/packages/openelis/ast.json b/packages/openelis/ast.json index 61b1598158..e4878da674 100644 --- a/packages/openelis/ast.json +++ b/packages/openelis/ast.json @@ -747,6 +747,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/openelis/src/Adaptor.js b/packages/openelis/src/Adaptor.js index b9a52bbf14..6bac55d588 100644 --- a/packages/openelis/src/Adaptor.js +++ b/packages/openelis/src/Adaptor.js @@ -14,6 +14,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/openfn/ast.json b/packages/openfn/ast.json index cdd282ff71..9759ec20e3 100644 --- a/packages/openfn/ast.json +++ b/packages/openfn/ast.json @@ -821,6 +821,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/openfn/src/Adaptor.js b/packages/openfn/src/Adaptor.js index fdadcb738c..b518dfdbf3 100644 --- a/packages/openfn/src/Adaptor.js +++ b/packages/openfn/src/Adaptor.js @@ -114,18 +114,19 @@ export function post(path, data, options) { export { alterState, - cursor, - dateFns, beta, combine, + cursor, dataPath, dataValue, + dateFns, each, field, + fields, fn, fnIf, - fields, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/openhim/ast.json b/packages/openhim/ast.json index 7006e29e73..6a59469dde 100644 --- a/packages/openhim/ast.json +++ b/packages/openhim/ast.json @@ -984,6 +984,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/openhim/src/Adaptor.js b/packages/openhim/src/Adaptor.js index fcd41f80cf..89bc26355e 100644 --- a/packages/openhim/src/Adaptor.js +++ b/packages/openhim/src/Adaptor.js @@ -53,7 +53,7 @@ export function createEncounter(encounterData) { { body, parseAs: 'text', - } + }, ); return util.prepareNextState(state, response); @@ -105,7 +105,7 @@ export function getTransactions(options = {}) { query: { ...resolvedoptions, }, - } + }, ); return util.prepareNextState(state, response); @@ -132,7 +132,7 @@ export function getClients(clientId) { state.configuration, 'GET', resolvedClientId ? `/clients/${resolvedClientId}` : '/clients', - {} + {}, ); return util.prepareNextState(state, response); @@ -168,7 +168,7 @@ export function createClient(body) { { body: resolvedBody, parseAs: 'text', - } + }, ); return util.prepareNextState(state, response); @@ -195,7 +195,7 @@ export function getChannels(channelId) { state.configuration, 'GET', resolvedChannelId ? `/channels/${resolvedChannelId}` : '/channels', - {} + {}, ); return util.prepareNextState(state, response); @@ -244,7 +244,7 @@ export function createChannel(body) { { body: resolvedBody, parseAs: 'text', - } + }, ); return util.prepareNextState(state, response); @@ -298,7 +298,7 @@ export function getTasks(options) { taskId ? `/tasks/${taskId}` : '/tasks', { query: resolvedoptions, - } + }, ); return util.prepareNextState(state, response); @@ -337,19 +337,20 @@ export function createTask(body) { } export { + as, combine, - fnIf, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, + fnIf, lastReferenceValue, + log, + map, merge, sourceValue, - as, - map, } from '@openfn/language-common'; diff --git a/packages/openimis/ast.json b/packages/openimis/ast.json index f77b668f0c..b8807aa6d2 100644 --- a/packages/openimis/ast.json +++ b/packages/openimis/ast.json @@ -595,6 +595,55 @@ }, "valid": true }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/openimis/src/Adaptor.js b/packages/openimis/src/Adaptor.js index 555855adf7..2f2ae872ec 100644 --- a/packages/openimis/src/Adaptor.js +++ b/packages/openimis/src/Adaptor.js @@ -21,7 +21,7 @@ export function execute(...operations) { return commonExecute( login, ...operations, - cleanupState + cleanupState, )({ ...initialState, ...state, @@ -86,7 +86,7 @@ export function getFHIR(path, params, callback = s => s) { const [resolvedPath, resolvedParams] = expandReferences( state, path, - params + params, ); const { baseUrl, auth } = state.configuration; @@ -108,6 +108,7 @@ export function getFHIR(path, params, callback = s => s) { export { alterState, combine, + as, dataPath, dataValue, dateFns, @@ -117,7 +118,7 @@ export { fn, fnIf, lastReferenceValue, + log, merge, sourceValue, - as, } from '@openfn/language-common'; diff --git a/packages/openlmis/ast.json b/packages/openlmis/ast.json index 1fc930eb81..defd3889e0 100644 --- a/packages/openlmis/ast.json +++ b/packages/openlmis/ast.json @@ -921,6 +921,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/openlmis/src/Adaptor.js b/packages/openlmis/src/Adaptor.js index 239014f474..eb1777ff0c 100644 --- a/packages/openlmis/src/Adaptor.js +++ b/packages/openlmis/src/Adaptor.js @@ -109,7 +109,7 @@ export function request(method, path, body, options = {}, callback = s => s) { { body: resolvedBody, ...resolvedoptions, - } + }, ); return util.prepareNextState(state, response, callback); @@ -117,18 +117,19 @@ export function request(method, path, body, options = {}, callback = s => s) { } export { + as, combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, fnIf, + lastReferenceValue, + log, merge, sourceValue, - lastReferenceValue, - as } from '@openfn/language-common'; diff --git a/packages/openmrs/ast.json b/packages/openmrs/ast.json index 8c1870c9f1..48cc1b3553 100644 --- a/packages/openmrs/ast.json +++ b/packages/openmrs/ast.json @@ -1057,6 +1057,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/openmrs/src/Adaptor.js b/packages/openmrs/src/Adaptor.js index b19784b72e..59da8a146c 100644 --- a/packages/openmrs/src/Adaptor.js +++ b/packages/openmrs/src/Adaptor.js @@ -436,6 +436,7 @@ export { fn, fnIf, lastReferenceValue, + log, map, merge, sourceValue, diff --git a/packages/openspp/ast.json b/packages/openspp/ast.json index 0a9488c81f..e13fc1b006 100644 --- a/packages/openspp/ast.json +++ b/packages/openspp/ast.json @@ -1704,6 +1704,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/openspp/src/Adaptor.js b/packages/openspp/src/Adaptor.js index 38eaaeda48..c714e140ab 100644 --- a/packages/openspp/src/Adaptor.js +++ b/packages/openspp/src/Adaptor.js @@ -1037,6 +1037,7 @@ export { fn, fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/pdfshift/ast.json b/packages/pdfshift/ast.json index 0e40538ffd..a8c8f2b91a 100644 --- a/packages/pdfshift/ast.json +++ b/packages/pdfshift/ast.json @@ -955,6 +955,55 @@ }, "valid": true }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/pdfshift/src/Adaptor.js b/packages/pdfshift/src/Adaptor.js index 5d1c11d120..2c105b9aef 100644 --- a/packages/pdfshift/src/Adaptor.js +++ b/packages/pdfshift/src/Adaptor.js @@ -164,6 +164,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/pesapal/ast.json b/packages/pesapal/ast.json index 3d455a562a..4f97da2a7c 100644 --- a/packages/pesapal/ast.json +++ b/packages/pesapal/ast.json @@ -774,6 +774,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/pesapal/src/Adaptor.js b/packages/pesapal/src/Adaptor.js index 30c51e7023..aabba2e642 100644 --- a/packages/pesapal/src/Adaptor.js +++ b/packages/pesapal/src/Adaptor.js @@ -104,7 +104,7 @@ export function request(method, path, body, options = {}) { { body: resolvedBody, ...resolvedoptions, - } + }, ); return util.prepareNextState(state, response); @@ -112,17 +112,18 @@ export function request(method, path, body, options = {}) { } export { + as, combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, lastReferenceValue, + log, merge, sourceValue, - as } from '@openfn/language-common'; diff --git a/packages/ping/ast.json b/packages/ping/ast.json index 61b1598158..e4878da674 100644 --- a/packages/ping/ast.json +++ b/packages/ping/ast.json @@ -747,6 +747,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/ping/src/Adaptor.js b/packages/ping/src/Adaptor.js index 6b4e5aeaed..714d6211d7 100644 --- a/packages/ping/src/Adaptor.js +++ b/packages/ping/src/Adaptor.js @@ -49,6 +49,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/postgresql/ast.json b/packages/postgresql/ast.json index 8ef5af46d3..7e4df53a5d 100644 --- a/packages/postgresql/ast.json +++ b/packages/postgresql/ast.json @@ -1539,6 +1539,55 @@ }, "valid": true }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/postgresql/src/Adaptor.js b/packages/postgresql/src/Adaptor.js index b1259c6c44..a26dda958b 100644 --- a/packages/postgresql/src/Adaptor.js +++ b/packages/postgresql/src/Adaptor.js @@ -694,12 +694,13 @@ export function modifyTable(tableName, columns, options) { export { alterState, arrayToString, + as, + assert, combine, + cursor, dataPath, dataValue, dateFns, - cursor, - assert, each, field, fields, @@ -707,7 +708,7 @@ export { fnIf, group, lastReferenceValue, + log, merge, sourceValue, - as, } from '@openfn/language-common'; diff --git a/packages/primero/ast.json b/packages/primero/ast.json index d3d421ce7c..dc9cba3b2d 100644 --- a/packages/primero/ast.json +++ b/packages/primero/ast.json @@ -1126,6 +1126,55 @@ }, "valid": true }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/primero/src/Adaptor.js b/packages/primero/src/Adaptor.js index 1c840fad45..3068e29357 100644 --- a/packages/primero/src/Adaptor.js +++ b/packages/primero/src/Adaptor.js @@ -903,6 +903,7 @@ export function getLocations(query, callback) { export { alterState, + as, beta, combine, dataPath, @@ -914,7 +915,7 @@ export { fn, fnIf, lastReferenceValue, + log, merge, sourceValue, - as, } from '@openfn/language-common'; diff --git a/packages/progres/ast.json b/packages/progres/ast.json index 6bb0bf198e..aa563999a0 100644 --- a/packages/progres/ast.json +++ b/packages/progres/ast.json @@ -584,6 +584,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/progres/src/Adaptor.js b/packages/progres/src/Adaptor.js index 3fc7b25486..6b8bdbfab8 100644 --- a/packages/progres/src/Adaptor.js +++ b/packages/progres/src/Adaptor.js @@ -72,16 +72,17 @@ export function postData(params, callback = s => s) { } export { - combine, - fn, - fnIf, alterState, + combine, dataPath, dataValue, each, field, fields, + fn, + fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/puntosolidario-rd/ast.json b/packages/puntosolidario-rd/ast.json index 61b1598158..e4878da674 100644 --- a/packages/puntosolidario-rd/ast.json +++ b/packages/puntosolidario-rd/ast.json @@ -747,6 +747,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/puntosolidario-rd/src/Adaptor.js b/packages/puntosolidario-rd/src/Adaptor.js index 34c88863f5..2ba35c5ecd 100644 --- a/packages/puntosolidario-rd/src/Adaptor.js +++ b/packages/puntosolidario-rd/src/Adaptor.js @@ -44,6 +44,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/rapidpro/ast.json b/packages/rapidpro/ast.json index d80c583899..778251a8d5 100644 --- a/packages/rapidpro/ast.json +++ b/packages/rapidpro/ast.json @@ -743,6 +743,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/rapidpro/src/Adaptor.js b/packages/rapidpro/src/Adaptor.js index 1ea8334d2e..7ff98364ab 100644 --- a/packages/rapidpro/src/Adaptor.js +++ b/packages/rapidpro/src/Adaptor.js @@ -224,6 +224,7 @@ export { fn, fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/redis/ast.json b/packages/redis/ast.json index c44a460b79..3e4a945643 100644 --- a/packages/redis/ast.json +++ b/packages/redis/ast.json @@ -1218,6 +1218,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/redis/src/Adaptor.js b/packages/redis/src/Adaptor.js index 9a29fff1e8..ab2dcc9318 100644 --- a/packages/redis/src/Adaptor.js +++ b/packages/redis/src/Adaptor.js @@ -314,7 +314,7 @@ export function scan(pattern, options = {}) { const [resolvedPattern, resolvedOptions] = expandReferences( state, pattern, - options + options, ); console.log(`Scanning for keys matching '${resolvedPattern}'`); @@ -343,16 +343,17 @@ export function scan(pattern, options = {}) { export { combine, + cursor, dataPath, dataValue, dateFns, - cursor, each, field, fields, fn, fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/resourcemap/ast.json b/packages/resourcemap/ast.json index 79cf0f7b2a..29f5e3a6ff 100644 --- a/packages/resourcemap/ast.json +++ b/packages/resourcemap/ast.json @@ -530,6 +530,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/resourcemap/src/Adaptor.js b/packages/resourcemap/src/Adaptor.js index c16f94dd45..4224e71dc6 100644 --- a/packages/resourcemap/src/Adaptor.js +++ b/packages/resourcemap/src/Adaptor.js @@ -33,7 +33,7 @@ export function submitSite(collection_id, submissionData) { if ([200, 201, 202].indexOf(response.statusCode) > -1) return false; if (error) return error; return new Error( - `Server responded with ${response.statusCode} \n ${response.body}` + `Server responded with ${response.statusCode} \n ${response.body}`, ); } @@ -45,7 +45,7 @@ export function submitSite(collection_id, submissionData) { ':' + '\n' + JSON.stringify(body, null, 4) + - '\n' + '\n', ); const { username, password, baseUrl } = state.configuration; @@ -78,7 +78,7 @@ export function submitSite(collection_id, submissionData) { console.log('Site submission succeeded.'); resolve(body); } - } + }, ); }); @@ -92,16 +92,17 @@ export function submitSite(collection_id, submissionData) { } export { - combine, - fn, - fnIf, alterState, - field, - fields, - sourceValue, - merge, - each, + combine, dataPath, dataValue, + each, + field, + fields, + fn, + fnIf, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/salesforce/ast.json b/packages/salesforce/ast.json index 57c00a2ab2..6d863cf28d 100644 --- a/packages/salesforce/ast.json +++ b/packages/salesforce/ast.json @@ -1797,6 +1797,55 @@ }, "valid": true }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/salesforce/src/Adaptor.js b/packages/salesforce/src/Adaptor.js index 44d5499f3f..26592fe282 100644 --- a/packages/salesforce/src/Adaptor.js +++ b/packages/salesforce/src/Adaptor.js @@ -499,6 +499,7 @@ export { join, jsonValue, lastReferenceValue, + log, map, merge, referencePath, diff --git a/packages/satusehat/ast.json b/packages/satusehat/ast.json index 88f7bf73a0..ab75e5fc8f 100644 --- a/packages/satusehat/ast.json +++ b/packages/satusehat/ast.json @@ -901,6 +901,55 @@ }, "valid": true }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/satusehat/src/Adaptor.js b/packages/satusehat/src/Adaptor.js index 19857eb1f2..9e80d0dc9b 100644 --- a/packages/satusehat/src/Adaptor.js +++ b/packages/satusehat/src/Adaptor.js @@ -212,6 +212,7 @@ export { fn, fnIf, lastReferenceValue, + log, map, merge, sourceValue, diff --git a/packages/senaite/ast.json b/packages/senaite/ast.json index 95c0994d36..37945b6b50 100644 --- a/packages/senaite/ast.json +++ b/packages/senaite/ast.json @@ -814,6 +814,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/senaite/src/Adaptor.js b/packages/senaite/src/Adaptor.js index 832c620c7b..e57942a89a 100644 --- a/packages/senaite/src/Adaptor.js +++ b/packages/senaite/src/Adaptor.js @@ -60,6 +60,7 @@ export { fnIf, group, lastReferenceValue, + log, merge, scrubEmojis, sourceValue, diff --git a/packages/sftp/ast.json b/packages/sftp/ast.json index e619cae455..ccb79dd20b 100644 --- a/packages/sftp/ast.json +++ b/packages/sftp/ast.json @@ -1017,6 +1017,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/sftp/src/Adaptor.js b/packages/sftp/src/Adaptor.js index d5ea529ad2..f48f1a6b55 100644 --- a/packages/sftp/src/Adaptor.js +++ b/packages/sftp/src/Adaptor.js @@ -30,7 +30,7 @@ export function execute(...operations) { commonExecute( connect, ...operations, - disconnect + disconnect, )({ ...initialState, ...state }).catch(e => { disconnect(state); throw e; @@ -121,7 +121,7 @@ export function getCSV(filePath, parsingOptions = {}) { if (useParser) { const stream = sftp.createReadStream(filePath, readStreamOptions); return parseCsv(stream, { ...csvDefaultOptions, ...parsingOptions })( - state + state, ); } else { return sftp @@ -264,20 +264,20 @@ export function normalizeCSVarray(options, callback) { export * from 'lodash/fp.js'; - export { alterState, + chunk, combine, - fn, - fnIf, dataPath, dataValue, each, field, fields, + fn, + fnIf, lastReferenceValue, + log, merge, - sourceValue, - chunk, parseCsv, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/siuben-rd/ast.json b/packages/siuben-rd/ast.json index 61b1598158..e4878da674 100644 --- a/packages/siuben-rd/ast.json +++ b/packages/siuben-rd/ast.json @@ -747,6 +747,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/siuben-rd/src/Adaptor.js b/packages/siuben-rd/src/Adaptor.js index 34c88863f5..2ba35c5ecd 100644 --- a/packages/siuben-rd/src/Adaptor.js +++ b/packages/siuben-rd/src/Adaptor.js @@ -44,6 +44,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/stripe/ast.json b/packages/stripe/ast.json index aed0996256..b376eba1ac 100644 --- a/packages/stripe/ast.json +++ b/packages/stripe/ast.json @@ -927,6 +927,55 @@ }, "valid": true }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/stripe/src/Adaptor.js b/packages/stripe/src/Adaptor.js index 8fe2668a03..0a2a94054b 100644 --- a/packages/stripe/src/Adaptor.js +++ b/packages/stripe/src/Adaptor.js @@ -84,6 +84,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/sunbird-rc/ast.json b/packages/sunbird-rc/ast.json index 5ee8c93de5..4be5aaf541 100644 --- a/packages/sunbird-rc/ast.json +++ b/packages/sunbird-rc/ast.json @@ -1252,6 +1252,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/sunbird-rc/src/Adaptor.js b/packages/sunbird-rc/src/Adaptor.js index 7909493a17..d79d2a9b7e 100644 --- a/packages/sunbird-rc/src/Adaptor.js +++ b/packages/sunbird-rc/src/Adaptor.js @@ -227,6 +227,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/surveycto/ast.json b/packages/surveycto/ast.json index 85808fcc6e..3c9eddf3bc 100644 --- a/packages/surveycto/ast.json +++ b/packages/surveycto/ast.json @@ -1078,6 +1078,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/surveycto/src/Adaptor.js b/packages/surveycto/src/Adaptor.js index 2984ba5143..54d3eb143a 100644 --- a/packages/surveycto/src/Adaptor.js +++ b/packages/surveycto/src/Adaptor.js @@ -88,7 +88,7 @@ export function fetchSubmissions(formId, options = {}) { const [resolvedFormId, resolvedOptions] = expandReferences( state, formId, - options + options, ); let { date = 0, format = 'json', status } = resolvedOptions; @@ -150,13 +150,13 @@ export function list(resource, options = {}) { const [resolvedResource, resolvedOptions] = expandReferences( state, resource, - options + options, ); const result = await requestWithPagination( state, resolvedResource, - resolvedOptions + resolvedOptions, ); return result; }; @@ -243,7 +243,7 @@ export function upsertRecord(datasetId, data) { const [resolvedDatasetId, resolvedData] = expandReferences( state, datasetId, - data + data, ); const resultId = resolvedData?.id; @@ -260,7 +260,7 @@ export function upsertRecord(datasetId, data) { headers: { 'content-type': 'application/json', }, - } + }, ); return prepareNextState(state, response); }; @@ -327,7 +327,7 @@ export function uploadCsvRecords(datasetId, rows, metadata = {}) { new Blob([JSON.stringify(resolvedMetadata)], { type: 'application/json', }), - 'metadata.json' + 'metadata.json', ); } @@ -337,7 +337,7 @@ export function uploadCsvRecords(datasetId, rows, metadata = {}) { { method: 'POST', body: data, - } + }, ); return prepareNextState(state, response); @@ -399,18 +399,19 @@ export function jsonToCSVBuffer(rows) { } export { + alterState, + chunk, combine, + dataPath, + dataValue, + dateFns, + field, + fields, fn, fnIf, - chunk, + lastReferenceValue, + log, merge, - field, - fields, - dateFns, - dataPath, parseCsv, - dataValue, - alterState, sourceValue, - lastReferenceValue, } from '@openfn/language-common'; diff --git a/packages/telerivet/ast.json b/packages/telerivet/ast.json index bef1af517c..08538be4d1 100644 --- a/packages/telerivet/ast.json +++ b/packages/telerivet/ast.json @@ -466,6 +466,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/telerivet/src/Adaptor.js b/packages/telerivet/src/Adaptor.js index 384ab6a0e6..03f0787a20 100644 --- a/packages/telerivet/src/Adaptor.js +++ b/packages/telerivet/src/Adaptor.js @@ -40,7 +40,7 @@ export function send(sendData) { const url = 'https://api.telerivet.com/v1/projects/'.concat( projectId, - '/messages/send' + '/messages/send', ); console.log(url); @@ -55,15 +55,16 @@ export function send(sendData) { } export { - combine, - fn, - fnIf, alterState, - field, - fields, - sourceValue, - merge, + combine, dataPath, dataValue, + field, + fields, + fn, + fnIf, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/testing/src/Adaptor.js b/packages/testing/src/Adaptor.js index 4584361838..d26784326a 100644 --- a/packages/testing/src/Adaptor.js +++ b/packages/testing/src/Adaptor.js @@ -8,5 +8,4 @@ export function version() { }); } -export { combine, - fn } from '@openfn/language-common'; +export { combine, fn, log } from '@openfn/language-common'; diff --git a/packages/twilio/ast.json b/packages/twilio/ast.json index eb67151d8e..3191c6af5d 100644 --- a/packages/twilio/ast.json +++ b/packages/twilio/ast.json @@ -574,6 +574,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/twilio/src/Adaptor.js b/packages/twilio/src/Adaptor.js index aece55422d..3096752f4d 100644 --- a/packages/twilio/src/Adaptor.js +++ b/packages/twilio/src/Adaptor.js @@ -1,4 +1,7 @@ -import { execute as commonExecute, composeNextState } from '@openfn/language-common'; +import { + execute as commonExecute, + composeNextState, +} from '@openfn/language-common'; import { expandReferences } from '@openfn/language-common/util'; import twilio from 'twilio'; @@ -49,14 +52,12 @@ export function sendSMS(params) { const client = twilio(accountSid, authToken); - return client.messages - .create({ body, from, to }) - .then(response => { - if (response.errorCode) { - throw response.errorCode; - } - return composeNextState(state, response); - }); + return client.messages.create({ body, from, to }).then(response => { + if (response.errorCode) { + throw response.errorCode; + } + return composeNextState(state, response); + }); }; } @@ -64,16 +65,17 @@ export function sendSMS(params) { // export function bulkSMS(params) {} export { + alterState, combine, + dataPath, + dataValue, + each, field, fields, - sourceValue, - alterState, fn, fnIf, - each, - merge, - dataPath, - dataValue, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/varo/ast.json b/packages/varo/ast.json index 3199ab1a89..110dd436c9 100644 --- a/packages/varo/ast.json +++ b/packages/varo/ast.json @@ -902,6 +902,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/varo/src/Adaptor.js b/packages/varo/src/Adaptor.js index d3672a1f70..0906afeeab 100644 --- a/packages/varo/src/Adaptor.js +++ b/packages/varo/src/Adaptor.js @@ -275,6 +275,7 @@ export { fn, fnIf, lastReferenceValue, + log, merge, sourceValue, } from '@openfn/language-common'; diff --git a/packages/vtiger/ast.json b/packages/vtiger/ast.json index 79cf0f7b2a..29f5e3a6ff 100644 --- a/packages/vtiger/ast.json +++ b/packages/vtiger/ast.json @@ -530,6 +530,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/vtiger/src/Adaptor.js b/packages/vtiger/src/Adaptor.js index aa72e9140f..b45442036e 100644 --- a/packages/vtiger/src/Adaptor.js +++ b/packages/vtiger/src/Adaptor.js @@ -35,7 +35,7 @@ export function execute(...operations) { return commonExecute( challenge, login, - ...flatten(operations) + ...flatten(operations), )({ ...initialState, ...state }); }; } @@ -57,7 +57,7 @@ function challenge(state) { const parsedBody = JSON.parse(body); resolve(parsedBody.result.token); } - } + }, ); }).then(value => { return { ...state, token: value }; @@ -91,7 +91,7 @@ export function login(state) { const parsedBody = JSON.parse(body); resolve(parsedBody); } - } + }, ); }).then(result => { return { ...state, session: result }; @@ -117,7 +117,7 @@ export function listTypes() { console.log(body); resolve(body); } - } + }, ); }).then(data => { const nextState = { ...state, response: { body: data } }; @@ -132,7 +132,7 @@ export function postElement(params) { const { sessionName } = state.session.result; const [resolvedParams] = expandReferences(state, params); - const {elementType, element, operation} = resolvedParams; + const { elementType, element, operation } = resolvedParams; const url = `${hostUrl}/webservice.php`; // const url = 'https://requestb.in/1irtrgz1'; @@ -161,7 +161,7 @@ export function postElement(params) { console.log(body); resolve(body); } - } + }, ); }).then(data => { const nextState = { ...state, response: { body: data } }; @@ -171,16 +171,17 @@ export function postElement(params) { } export { + alterState, combine, + dataPath, + dataValue, + each, field, fields, - sourceValue, - alterState, fn, fnIf, - each, - merge, - dataPath, - dataValue, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/whatsapp/ast.json b/packages/whatsapp/ast.json index 4fe7322d84..c783898d1e 100644 --- a/packages/whatsapp/ast.json +++ b/packages/whatsapp/ast.json @@ -825,6 +825,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/whatsapp/src/Adaptor.js b/packages/whatsapp/src/Adaptor.js index a4d10a0ae7..f1888208fc 100644 --- a/packages/whatsapp/src/Adaptor.js +++ b/packages/whatsapp/src/Adaptor.js @@ -82,6 +82,7 @@ export { fnIf, group, lastReferenceValue, + log, merge, scrubEmojis, sourceValue, diff --git a/packages/wigal-sms/ast.json b/packages/wigal-sms/ast.json index c43474a8a3..dfc108ab1f 100644 --- a/packages/wigal-sms/ast.json +++ b/packages/wigal-sms/ast.json @@ -670,6 +670,55 @@ ] }, "valid": false + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/wigal-sms/src/Adaptor.js b/packages/wigal-sms/src/Adaptor.js index f61c2f846f..cba66caaeb 100644 --- a/packages/wigal-sms/src/Adaptor.js +++ b/packages/wigal-sms/src/Adaptor.js @@ -79,16 +79,17 @@ export function sendSms(data) { export { combine, - fn, - fnIf, - each, - merge, - field, - fields, cursor, - dateFns, dataPath, dataValue, - sourceValue, + dateFns, + each, + field, + fields, + fn, + fnIf, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common'; diff --git a/packages/zata/ast.json b/packages/zata/ast.json index e77962e0f2..8343b04695 100644 --- a/packages/zata/ast.json +++ b/packages/zata/ast.json @@ -1000,6 +1000,55 @@ }, "valid": false }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true + }, { "name": "as", "params": [ diff --git a/packages/zata/src/Adaptor.js b/packages/zata/src/Adaptor.js index eb37d32657..54c7dd657e 100644 --- a/packages/zata/src/Adaptor.js +++ b/packages/zata/src/Adaptor.js @@ -220,6 +220,7 @@ export { fnIf, group, lastReferenceValue, + log, map, merge, scrubEmojis, diff --git a/packages/zoho/ast.json b/packages/zoho/ast.json index 79cf0f7b2a..29f5e3a6ff 100644 --- a/packages/zoho/ast.json +++ b/packages/zoho/ast.json @@ -530,6 +530,55 @@ ] }, "valid": true + }, + { + "name": "log", + "params": [ + "args" + ], + "docs": { + "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.", + "tags": [ + { + "title": "public", + "description": null, + "type": null + }, + { + "title": "function", + "description": null, + "name": null + }, + { + "title": "example", + "description": "log('Patient List::', $.patients);", + "caption": "Log values from state" + }, + { + "title": "example", + "description": "fn((state) => {\n console.log(state.data);\n return state;\n})", + "caption": "Use console.log inside a callback or fn block" + }, + { + "title": "param", + "description": "A value or message to display in the logs", + "type": { + "type": "NameExpression", + "name": "any" + }, + "name": "args" + }, + { + "title": "returns", + "description": null, + "type": { + "type": "NameExpression", + "name": "Operation" + } + } + ] + }, + "valid": true } ] } \ No newline at end of file diff --git a/packages/zoho/src/Adaptor.js b/packages/zoho/src/Adaptor.js index 2171639b71..aaf5360ebe 100644 --- a/packages/zoho/src/Adaptor.js +++ b/packages/zoho/src/Adaptor.js @@ -51,7 +51,7 @@ export function addRow(db, table, rowData) { '/', db, '/', - table + table, ); console.log('POST URL:'); @@ -67,16 +67,17 @@ export function addRow(db, table, rowData) { } export { - combine, - fn, - fnIf, alterState, - field, - fields, - sourceValue, - each, - merge, + combine, dataPath, dataValue, + each, + field, + fields, + fn, + fnIf, lastReferenceValue, + log, + merge, + sourceValue, } from '@openfn/language-common';