@openfn/language-common 1.7.5 → 1.7.7

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/ast.json CHANGED
@@ -18,9 +18,9 @@
18
18
  "description": "execute(\n create('foo'),\n delete('bar')\n )"
19
19
  },
20
20
  {
21
- "title": "function",
21
+ "title": "private",
22
22
  "description": null,
23
- "name": null
23
+ "type": null
24
24
  },
25
25
  {
26
26
  "title": "param",
package/dist/index.cjs CHANGED
@@ -93,7 +93,8 @@ __export(Adaptor_exports, {
93
93
  splitKeys: () => splitKeys,
94
94
  toArray: () => toArray
95
95
  });
96
- var import_fp = __toESM(require("lodash/fp"), 1);
96
+ var import_curry = __toESM(require("lodash/fp/curry.js"), 1);
97
+ var import_fromPairs = __toESM(require("lodash/fp/fromPairs.js"), 1);
97
98
  var import_jsonpath_plus = require("jsonpath-plus");
98
99
 
99
100
  // src/beta.js
@@ -224,7 +225,6 @@ __export(dateFns_exports, {
224
225
  var import_date_fns = require("date-fns");
225
226
 
226
227
  // src/Adaptor.js
227
- var { curry, fromPairs } = import_fp.default;
228
228
  function execute(...operations) {
229
229
  return (state) => {
230
230
  const start = Promise.resolve(state);
@@ -269,7 +269,7 @@ function lastReferenceValue(path) {
269
269
  const lastReferencePath = referencePath("[0]".concat(".", path));
270
270
  return sourceValue(lastReferencePath);
271
271
  }
272
- var map = curry(function(path, operation, state) {
272
+ var map = (0, import_curry.default)(function(path, operation, state) {
273
273
  switch (typeof path) {
274
274
  case "string":
275
275
  source(path)(state).map(function(data) {
@@ -351,7 +351,7 @@ function field(key, value) {
351
351
  return [key, value];
352
352
  }
353
353
  function fields(...fields2) {
354
- return fromPairs(fields2);
354
+ return (0, import_fromPairs.default)(fields2);
355
355
  }
356
356
  function merge(dataSource, fields2) {
357
357
  return (state) => {
package/dist/index.js CHANGED
@@ -38,7 +38,8 @@ __export(Adaptor_exports, {
38
38
  splitKeys: () => splitKeys,
39
39
  toArray: () => toArray
40
40
  });
41
- import _ from "lodash/fp";
41
+ import curry from "lodash/fp/curry.js";
42
+ import fromPairs from "lodash/fp/fromPairs.js";
42
43
  import { JSONPath } from "jsonpath-plus";
43
44
 
44
45
  // src/beta.js
@@ -169,7 +170,6 @@ __export(dateFns_exports, {
169
170
  import { parse, format } from "date-fns";
170
171
 
171
172
  // src/Adaptor.js
172
- var { curry, fromPairs } = _;
173
173
  function execute(...operations) {
174
174
  return (state) => {
175
175
  const start = Promise.resolve(state);
@@ -0,0 +1,59 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/metadata.js
20
+ var metadata_exports = {};
21
+ __export(metadata_exports, {
22
+ createEntity: () => createEntity
23
+ });
24
+ module.exports = __toCommonJS(metadata_exports);
25
+ var createEntity = (name, type, props = {}, children) => {
26
+ const { label, datatype, value, ...meta } = props;
27
+ const e = {
28
+ name,
29
+ type,
30
+ addChild: function(e2, name2) {
31
+ if (!this.children) {
32
+ this.children = name2 ? {} : [];
33
+ }
34
+ if (name2) {
35
+ if (isArray(this.children)) {
36
+ throw new Error("Cannot add a named entity to child array");
37
+ }
38
+ this.children[name2] = e2;
39
+ } else {
40
+ this.children.push(e2);
41
+ }
42
+ }
43
+ };
44
+ if (label) {
45
+ e.label = label;
46
+ }
47
+ if (datatype) {
48
+ e.datatype = datatype;
49
+ }
50
+ if (children) {
51
+ e.children = children;
52
+ }
53
+ e.meta = meta || {};
54
+ return e;
55
+ };
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ createEntity
59
+ });
@@ -0,0 +1,35 @@
1
+ // src/metadata.js
2
+ var createEntity = (name, type, props = {}, children) => {
3
+ const { label, datatype, value, ...meta } = props;
4
+ const e = {
5
+ name,
6
+ type,
7
+ addChild: function(e2, name2) {
8
+ if (!this.children) {
9
+ this.children = name2 ? {} : [];
10
+ }
11
+ if (name2) {
12
+ if (isArray(this.children)) {
13
+ throw new Error("Cannot add a named entity to child array");
14
+ }
15
+ this.children[name2] = e2;
16
+ } else {
17
+ this.children.push(e2);
18
+ }
19
+ }
20
+ };
21
+ if (label) {
22
+ e.label = label;
23
+ }
24
+ if (datatype) {
25
+ e.datatype = datatype;
26
+ }
27
+ if (children) {
28
+ e.children = children;
29
+ }
30
+ e.meta = meta || {};
31
+ return e;
32
+ };
33
+ export {
34
+ createEntity
35
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-common",
3
- "version": "1.7.5",
3
+ "version": "1.7.7",
4
4
  "description": "Common Expressions for OpenFn",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
@@ -12,7 +12,11 @@
12
12
  "import": "./dist/index.js",
13
13
  "require": "./dist/index.cjs"
14
14
  },
15
- "./package.json": "./package.json"
15
+ "./package.json": "./package.json",
16
+ "./metadata": {
17
+ "import": "./dist/metadata.js",
18
+ "require": "./dist/metadata.cjs"
19
+ }
16
20
  },
17
21
  "author": "Open Function Group",
18
22
  "license": "LGPL-3.0-or-later",
@@ -7,7 +7,7 @@
7
7
  * create('foo'),
8
8
  * delete('bar')
9
9
  * )
10
- * @function
10
+ * @private
11
11
  * @param {Operations} operations - Operations to be performed.
12
12
  * @returns {Promise}
13
13
  */
package/types/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import * as Adaptor from './Adaptor';
1
2
  export default Adaptor;
2
- export * from "./Adaptor";
3
- import * as Adaptor from "./Adaptor";
3
+ export * from './Adaptor';
4
+ import * as metadata from './metadata';
5
+ export { metadata };
@@ -0,0 +1,11 @@
1
+ declare type Entity = {
2
+ name: string;
3
+ type: string;
4
+ label?: string;
5
+ datatype?: string;
6
+ desc?: string;
7
+ children?: Entity[] | Record<string, Entity>;
8
+ meta?: Record<string, any>;
9
+ addChild: (e: Entity, name?: string) => void;
10
+ };
11
+ declare type DataType = 'string' | 'boolean' | 'date';