@openfn/language-mogli 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -25,7 +25,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
25
25
  // src/index.js
26
26
  var src_exports = {};
27
27
  __export(src_exports, {
28
- FakeAdaptor: () => FakeAdaptor_exports,
29
28
  alterState: () => import_language_common3.alterState,
30
29
  arrayToString: () => import_language_common3.arrayToString,
31
30
  beta: () => import_language_common3.beta,
@@ -254,118 +253,10 @@ function expandReferences(state, attrs) {
254
253
  })(attrs);
255
254
  }
256
255
 
257
- // src/FakeAdaptor.js
258
- var FakeAdaptor_exports = {};
259
- __export(FakeAdaptor_exports, {
260
- arrayToString: () => import_language_common5.arrayToString,
261
- beta: () => import_language_common5.beta,
262
- combine: () => import_language_common5.combine,
263
- create: () => create,
264
- dataPath: () => import_language_common5.dataPath,
265
- dataValue: () => import_language_common5.dataValue,
266
- each: () => import_language_common5.each,
267
- execute: () => execute2,
268
- field: () => import_language_common5.field,
269
- fields: () => import_language_common5.fields,
270
- index: () => import_language_common5.index,
271
- join: () => import_language_common5.join,
272
- lastReferenceValue: () => import_language_common5.lastReferenceValue,
273
- lookup: () => lookup,
274
- map: () => import_language_common5.map,
275
- merge: () => import_language_common5.merge,
276
- reference: () => reference2,
277
- referencePath: () => import_language_common5.referencePath,
278
- relationship: () => relationship,
279
- source: () => import_language_common5.source,
280
- sourceValue: () => import_language_common5.sourceValue,
281
- steps: () => steps2,
282
- toArray: () => import_language_common5.toArray,
283
- update: () => update,
284
- upsert: () => upsert
285
- });
286
- var import_language_common4 = require("@openfn/language-common");
287
- var import_lodash_fp2 = __toESM(require("lodash-fp"), 1);
288
- var import_language_common5 = require("@openfn/language-common");
289
- var { curry: curry2, mapValues: mapValues2, flatten: flatten2 } = import_lodash_fp2.default;
290
- function steps2(...operations) {
291
- return flatten2(operations);
292
- }
293
- function expandReferences2(attrs, state) {
294
- return mapValues2(function(value) {
295
- return typeof value == "function" ? value(state) : value;
296
- })(attrs);
297
- }
298
- function create(sObject, fields3) {
299
- return (state) => {
300
- state.logger.debug(`Creating ${sObject}`);
301
- state.logger.debug(JSON.stringify(state.data, null, 2));
302
- state.logger.debug("===================");
303
- let id = state.references.length + 1;
304
- let result = { sObject, fields: expandReferences2(fields3, state), id };
305
- return {
306
- ...state,
307
- references: [result, ...state.references]
308
- };
309
- };
310
- }
311
- function update(sObject, fields3) {
312
- return (state) => {
313
- state.logger.debug(`Updating ${sObject}`);
314
- state.logger.debug(JSON.stringify(state.data, null, 2));
315
- state.logger.debug("===================");
316
- let id = state.references.length + 1;
317
- let result = { sObject, fields: expandReferences2(fields3, state), id };
318
- return {
319
- ...state,
320
- references: [result, ...state.references]
321
- };
322
- };
323
- }
324
- function upsert(sObject, externalId, fields3) {
325
- return (state) => {
326
- state.logger.debug(`Upserting ${sObject} with externalId:`, externalId);
327
- state.logger.debug(JSON.stringify(state.data, null, 2));
328
- state.logger.debug("===================");
329
- let id = state.references.length + 1;
330
- let result = { sObject, fields: expandReferences2(fields3, state), id };
331
- return {
332
- ...state,
333
- references: [result, ...state.references]
334
- };
335
- };
336
- }
337
- var reference2 = curry2(function(position, { references }) {
338
- return references[position].id;
339
- });
340
- function execute2(...operations) {
341
- const initialState = {
342
- logger: {
343
- info: console.info.bind(console),
344
- debug: console.log.bind(console)
345
- },
346
- references: [],
347
- data: null
348
- };
349
- return (state) => {
350
- return (0, import_language_common4.execute)(...flatten2(operations), function(state2) {
351
- delete state2.connection;
352
- return state2;
353
- })({ ...initialState, ...state }).then(function(state2) {
354
- state2.logger.info(JSON.stringify(state2.references, null, 2));
355
- console.info("Finished Successfully");
356
- return state2;
357
- }).catch(function(err) {
358
- console.error(err.stack);
359
- console.info("Job failed.");
360
- });
361
- };
362
- }
363
-
364
256
  // src/index.js
365
257
  var src_default = Adaptor_exports;
366
258
  // Annotate the CommonJS export names for ESM import in node:
367
259
  0 && (module.exports = {
368
- FakeAdaptor,
369
260
  alterState,
370
261
  arrayToString,
371
262
  beta,
package/dist/index.js CHANGED
@@ -222,135 +222,9 @@ function expandReferences(state, attrs) {
222
222
  })(attrs);
223
223
  }
224
224
 
225
- // src/FakeAdaptor.js
226
- var FakeAdaptor_exports = {};
227
- __export(FakeAdaptor_exports, {
228
- arrayToString: () => arrayToString2,
229
- beta: () => beta2,
230
- combine: () => combine2,
231
- create: () => create,
232
- dataPath: () => dataPath2,
233
- dataValue: () => dataValue2,
234
- each: () => each2,
235
- execute: () => execute2,
236
- field: () => field3,
237
- fields: () => fields2,
238
- index: () => index2,
239
- join: () => join2,
240
- lastReferenceValue: () => lastReferenceValue2,
241
- lookup: () => lookup,
242
- map: () => map2,
243
- merge: () => merge2,
244
- reference: () => reference2,
245
- referencePath: () => referencePath2,
246
- relationship: () => relationship,
247
- source: () => source2,
248
- sourceValue: () => sourceValue3,
249
- steps: () => steps2,
250
- toArray: () => toArray2,
251
- update: () => update,
252
- upsert: () => upsert
253
- });
254
- import { execute as commonExecute2 } from "@openfn/language-common";
255
- import pkg2 from "lodash-fp";
256
- import {
257
- each as each2,
258
- join as join2,
259
- fields as fields2,
260
- field as field3,
261
- source as source2,
262
- sourceValue as sourceValue3,
263
- map as map2,
264
- combine as combine2,
265
- merge as merge2,
266
- dataPath as dataPath2,
267
- dataValue as dataValue2,
268
- referencePath as referencePath2,
269
- lastReferenceValue as lastReferenceValue2,
270
- index as index2,
271
- beta as beta2,
272
- toArray as toArray2,
273
- arrayToString as arrayToString2
274
- } from "@openfn/language-common";
275
- var { curry: curry2, mapValues: mapValues2, flatten: flatten2 } = pkg2;
276
- function steps2(...operations) {
277
- return flatten2(operations);
278
- }
279
- function expandReferences2(attrs, state) {
280
- return mapValues2(function(value) {
281
- return typeof value == "function" ? value(state) : value;
282
- })(attrs);
283
- }
284
- function create(sObject, fields3) {
285
- return (state) => {
286
- state.logger.debug(`Creating ${sObject}`);
287
- state.logger.debug(JSON.stringify(state.data, null, 2));
288
- state.logger.debug("===================");
289
- let id = state.references.length + 1;
290
- let result = { sObject, fields: expandReferences2(fields3, state), id };
291
- return {
292
- ...state,
293
- references: [result, ...state.references]
294
- };
295
- };
296
- }
297
- function update(sObject, fields3) {
298
- return (state) => {
299
- state.logger.debug(`Updating ${sObject}`);
300
- state.logger.debug(JSON.stringify(state.data, null, 2));
301
- state.logger.debug("===================");
302
- let id = state.references.length + 1;
303
- let result = { sObject, fields: expandReferences2(fields3, state), id };
304
- return {
305
- ...state,
306
- references: [result, ...state.references]
307
- };
308
- };
309
- }
310
- function upsert(sObject, externalId, fields3) {
311
- return (state) => {
312
- state.logger.debug(`Upserting ${sObject} with externalId:`, externalId);
313
- state.logger.debug(JSON.stringify(state.data, null, 2));
314
- state.logger.debug("===================");
315
- let id = state.references.length + 1;
316
- let result = { sObject, fields: expandReferences2(fields3, state), id };
317
- return {
318
- ...state,
319
- references: [result, ...state.references]
320
- };
321
- };
322
- }
323
- var reference2 = curry2(function(position, { references }) {
324
- return references[position].id;
325
- });
326
- function execute2(...operations) {
327
- const initialState = {
328
- logger: {
329
- info: console.info.bind(console),
330
- debug: console.log.bind(console)
331
- },
332
- references: [],
333
- data: null
334
- };
335
- return (state) => {
336
- return commonExecute2(...flatten2(operations), function(state2) {
337
- delete state2.connection;
338
- return state2;
339
- })({ ...initialState, ...state }).then(function(state2) {
340
- state2.logger.info(JSON.stringify(state2.references, null, 2));
341
- console.info("Finished Successfully");
342
- return state2;
343
- }).catch(function(err) {
344
- console.error(err.stack);
345
- console.info("Job failed.");
346
- });
347
- };
348
- }
349
-
350
225
  // src/index.js
351
226
  var src_default = Adaptor_exports;
352
227
  export {
353
- FakeAdaptor_exports as FakeAdaptor,
354
228
  alterState,
355
229
  arrayToString,
356
230
  beta,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-mogli",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "A Mogli SMS Language Pack for OpenFn",
5
5
  "main": "dist/index.cjs",
6
6
  "author": "Open Function Group",
@@ -4,10 +4,12 @@ export function steps(...operations: any[]): any;
4
4
  * @typedef {Object} State
5
5
  * @property {object} data JSON Data.
6
6
  * @property {Array<Reference>} references History of all previous operations.
7
+ * @ignore
7
8
  */
8
9
  /**
9
10
  * @typedef {Function} Operation
10
11
  * @param {State} state
12
+ * @ignore
11
13
  */
12
14
  export const createSMS: any;
13
15
  export const updateSMS: any;
package/types/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
1
  export default Adaptor;
2
- export { FakeAdaptor };
3
2
  export * from "./Adaptor";
4
3
  import * as Adaptor from "./Adaptor";
5
- import * as FakeAdaptor from "./FakeAdaptor";
@@ -1,9 +0,0 @@
1
- export function create(sObject: any, fields: any): (state: any) => any;
2
- export function execute(...operations: any[]): (state: any) => any;
3
- export const reference: any;
4
- /** @module FakeAdaptor */
5
- export function steps(...operations: any[]): any;
6
- export function update(sObject: any, fields: any): (state: any) => any;
7
- export function upsert(sObject: any, externalId: any, fields: any): (state: any) => any;
8
- export { lookup, relationship } from "./sourceHelpers";
9
- export { each, join, fields, field, source, sourceValue, map, combine, merge, dataPath, dataValue, referencePath, lastReferenceValue, index, beta, toArray, arrayToString } from "@openfn/language-common";