@openfn/project 0.14.3 → 0.14.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.d.ts CHANGED
@@ -249,4 +249,4 @@ type GenerateProjectOptions = GenerateWorkflowOptions & {
249
249
  declare function generateWorkflow(def: string, options?: Partial<GenerateWorkflowOptions>): Workflow;
250
250
  declare function generateProject(name: string, workflowDefs: string[], options?: Partial<GenerateProjectOptions>): Project;
251
251
 
252
- export { DiffType, WorkflowDiff, Workspace, Project as default, diff, generateProject, generateHash as generateVersionHash, generateWorkflow, jsonToYaml, mapWorkflow, match as versionsEqual, yamlToJson };
252
+ export { type DiffType, type WorkflowDiff, Workspace, Project as default, diff, generateProject, generateHash as generateVersionHash, generateWorkflow, jsonToYaml, mapWorkflow, match as versionsEqual, yamlToJson };
package/dist/index.js CHANGED
@@ -13,12 +13,12 @@ function slugify(text) {
13
13
  }
14
14
 
15
15
  // src/util/version.ts
16
- import crypto from "node:crypto";
16
+ import crypto from "crypto";
17
17
  import { get } from "lodash-es";
18
18
 
19
19
  // src/serialize/to-app-state.ts
20
20
  import { pick, omitBy, isNil, sortBy } from "lodash-es";
21
- import { randomUUID } from "node:crypto";
21
+ import { randomUUID } from "crypto";
22
22
 
23
23
  // src/util/rename-keys.ts
24
24
  function renameKeys(props = {}, keyMap) {
@@ -428,10 +428,8 @@ var Workflow = class {
428
428
  const step = s;
429
429
  const next = typeof step.next === "string" ? { [step.next]: true } : step.next || {};
430
430
  for (const toNode of Object.keys(next)) {
431
- if (!Array.isArray(edges[step.id]))
432
- edges[step.id] = [toNode];
433
- else
434
- edges[step.id].push(toNode);
431
+ if (!Array.isArray(edges[step.id])) edges[step.id] = [toNode];
432
+ else edges[step.id].push(toNode);
435
433
  }
436
434
  }
437
435
  return edges;
@@ -448,8 +446,7 @@ var Workflow = class {
448
446
  all_parents.push(parent);
449
447
  }
450
448
  const root = all_parents.find((parent) => !all_children.includes(parent));
451
- if (!root)
452
- return;
449
+ if (!root) return;
453
450
  return this.index.steps[root];
454
451
  }
455
452
  getUUID(id) {
@@ -490,8 +487,8 @@ import nodepath from "path";
490
487
  import { omit } from "lodash-es";
491
488
 
492
489
  // src/util/config.ts
493
- import { readFileSync } from "node:fs";
494
- import path from "node:path";
490
+ import { readFileSync } from "fs";
491
+ import path from "path";
495
492
  import { pickBy, isNil as isNil2 } from "lodash-es";
496
493
  var buildConfig = (config = {}) => ({
497
494
  credentials: "credentials.yaml",
@@ -891,8 +888,8 @@ var mapWorkflow2 = (workflow, credentials = []) => {
891
888
  };
892
889
 
893
890
  // src/parse/from-path.ts
894
- import { readFile } from "node:fs/promises";
895
- import path2 from "node:path";
891
+ import { readFile } from "fs/promises";
892
+ import path2 from "path";
896
893
 
897
894
  // src/parse/from-project.ts
898
895
  var from_project_default = (data, config) => {
@@ -927,8 +924,8 @@ var from_path_default = async (filePath, config = {}) => {
927
924
  };
928
925
 
929
926
  // src/parse/from-fs.ts
930
- import fs from "node:fs/promises";
931
- import path3 from "node:path";
927
+ import fs from "fs/promises";
928
+ import path3 from "path";
932
929
  import { glob } from "glob";
933
930
  import { omit as omit2 } from "lodash-es";
934
931
  var parseProject = async (options) => {
@@ -1164,8 +1161,7 @@ function getUnmappedCandidates(unmappedTarget, idMap) {
1164
1161
  return unmappedTarget.filter((step) => !mappedIds.has(step.id));
1165
1162
  }
1166
1163
  function findBestMatch(sourceStep, candidates, sourceEdges, targetEdges, getMappedId, isLastIteration) {
1167
- if (candidates.length === 0)
1168
- return null;
1164
+ if (candidates.length === 0) return null;
1169
1165
  let bestCandidates = candidates;
1170
1166
  let topResult = null;
1171
1167
  let didStructuralFilter = false;
@@ -1275,8 +1271,7 @@ function findByParent(parentIds, edges, steps) {
1275
1271
  const matches = [];
1276
1272
  for (const parentId of parentIds) {
1277
1273
  const children = edges[parentId];
1278
- if (!children || children.length === 0)
1279
- continue;
1274
+ if (!children || children.length === 0) continue;
1280
1275
  const matchingSteps = steps.filter((step) => children.includes(step.id));
1281
1276
  matches.push(...matchingSteps);
1282
1277
  }
@@ -1341,10 +1336,8 @@ function getDuplicates(arr) {
1341
1336
  const duplicates = /* @__PURE__ */ new Set();
1342
1337
  for (let i = 0; i < arr.length; i++) {
1343
1338
  const item = arr[i];
1344
- if (hmap[item])
1345
- duplicates.add(item);
1346
- else
1347
- hmap[item] = true;
1339
+ if (hmap[item]) duplicates.add(item);
1340
+ else hmap[item] = true;
1348
1341
  }
1349
1342
  return Array.from(duplicates);
1350
1343
  }
@@ -1703,18 +1696,16 @@ var Project_default = Project;
1703
1696
 
1704
1697
  // src/Workspace.ts
1705
1698
  import createLogger from "@openfn/logger";
1706
- import path4 from "node:path";
1707
- import fs3 from "node:fs";
1699
+ import path4 from "path";
1700
+ import fs3 from "fs";
1708
1701
 
1709
1702
  // src/util/path-exists.ts
1710
1703
  import fs2 from "fs";
1711
1704
  function pathExists(fpath, type) {
1712
1705
  try {
1713
1706
  const stat = fs2.statSync(fpath);
1714
- if (type === "file" && stat.isFile())
1715
- return true;
1716
- else if (type === "directory" && stat.isDirectory())
1717
- return true;
1707
+ if (type === "file" && stat.isFile()) return true;
1708
+ else if (type === "directory" && stat.isDirectory()) return true;
1718
1709
  return false;
1719
1710
  } catch (e) {
1720
1711
  return false;
@@ -1854,9 +1845,9 @@ var Workspace = class {
1854
1845
  };
1855
1846
 
1856
1847
  // src/gen/generator.ts
1857
- import { randomUUID as randomUUID2 } from "node:crypto";
1858
- import path5 from "node:path";
1859
- import { readFileSync as readFileSync2 } from "node:fs";
1848
+ import { randomUUID as randomUUID2 } from "crypto";
1849
+ import path5 from "path";
1850
+ import { readFileSync as readFileSync2 } from "fs";
1860
1851
  import { grammar } from "ohm-js";
1861
1852
  import { isNil as isNil5, set } from "lodash-es";
1862
1853
  var parser;
@@ -2065,10 +2056,10 @@ function generateProject(name, workflowDefs, options = {}) {
2065
2056
  }
2066
2057
 
2067
2058
  // src/index.ts
2068
- var src_default = Project;
2059
+ var index_default = Project;
2069
2060
  export {
2070
2061
  Workspace,
2071
- src_default as default,
2062
+ index_default as default,
2072
2063
  diff,
2073
2064
  generateProject,
2074
2065
  generateHash as generateVersionHash,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/project",
3
- "version": "0.14.3",
3
+ "version": "0.14.4",
4
4
  "description": "Read, serialize, replicate and sync OpenFn projects",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,25 +17,25 @@
17
17
  "author": "Open Function Group <admin@openfn.org>",
18
18
  "license": "ISC",
19
19
  "devDependencies": {
20
- "@types/lodash": "^4.17.20",
20
+ "@types/lodash": "^4.17.24",
21
21
  "@types/mock-fs": "~4.13.4",
22
22
  "ava": "5.3.1",
23
23
  "mock-fs": "^5.5.0",
24
- "rimraf": "^3.0.2",
24
+ "rimraf": "^6.1.3",
25
25
  "tslib": "^2.8.1",
26
- "tsup": "^7.2.0",
27
- "typescript": "^5.9.2"
26
+ "tsup": "^8.5.1",
27
+ "typescript": "^5.9.3"
28
28
  },
29
29
  "dependencies": {
30
30
  "@types/lodash-es": "^4.17.12",
31
- "glob": "^11.0.2",
32
- "human-id": "^4.1.1",
33
- "lodash": "^4.17.21",
34
- "lodash-es": "^4.17.21",
35
- "ohm-js": "^17.2.1",
36
- "yaml": "^2.2.2",
37
- "@openfn/lexicon": "^1.4.1",
38
- "@openfn/logger": "1.1.1"
31
+ "glob": "^13.0.6",
32
+ "human-id": "^4.1.3",
33
+ "lodash": "^4.17.23",
34
+ "lodash-es": "^4.17.23",
35
+ "ohm-js": "^17.5.0",
36
+ "yaml": "^2.8.2",
37
+ "@openfn/lexicon": "^1.4.2",
38
+ "@openfn/logger": "1.1.2"
39
39
  },
40
40
  "files": [
41
41
  "dist",