sanoma 0.11.17 → 0.11.18

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/config.js CHANGED
@@ -47,46 +47,22 @@ export async function loadConfig(cwd = process.cwd()) {
47
47
  config.file ??= file;
48
48
  const root = config.root ?? dirname(file);
49
49
  // Imported here, not at the top: `cli.ts` loads this module before any command needs the runtime.
50
- const { filesUnder, isCollection, kindDirs } = await import("@sanoma-ai/workflows");
51
- // A `workflows` or `collections` that is no list is resolveConfig's to explain.
52
- if (config.workflows === undefined || Array.isArray(config.workflows)) {
53
- const workflows = new Set(config.workflows);
54
- const paths = kindDirs(root, "workflows").flatMap((dir) => filesUnder(dir, isSource));
55
- // Imported at once, added in the files' order.
56
- const modules = (await Promise.all(paths.map(importReal)));
57
- for (const [i, { default: wf }] of modules.entries()) {
58
- const path = paths[i];
59
- if (wf === undefined)
60
- continue;
61
- if (!isWorkflow(wf)) {
62
- throw new UsageError(`${realpathSync(path)}'s default export is not a workflow: a file of workflows/ exports one, \`export default defineWorkflow({ … })\`, or none (a helper the workflows import)`);
63
- }
64
- workflows.add(wf);
65
- }
66
- if (workflows.size > 0)
67
- config.workflows = [...workflows];
50
+ const { declarationFiles, errorMessage, joinDeclarations } = await import("@sanoma-ai/workflows");
51
+ const files = declarationFiles(root);
52
+ // The workflows' first; joined in the files' order.
53
+ const modules = { workflows: await importReal(files.workflows), data: await importReal(files.data) };
54
+ try {
55
+ joinDeclarations(config, modules);
68
56
  }
69
- if (config.collections === undefined || Array.isArray(config.collections)) {
70
- const collections = new Set(config.collections);
71
- for (const path of kindDirs(root, "resources").map((dir) => join(dir, "data.ts"))) {
72
- if (!existsSync(path))
73
- continue;
74
- for (const [name, value] of Object.entries((await importReal(path)))) {
75
- if (!isCollection(value)) {
76
- throw new UsageError(`${realpathSync(path)} exports ${name}, which is not a collection: resources/data.ts holds collections only, each \`export const ${name} = collection({ name, key, fields })\` with collection from "sanoma/data"`);
77
- }
78
- collections.add(value);
79
- }
80
- }
81
- if (collections.size > 0)
82
- config.collections = [...collections];
57
+ catch (err) {
58
+ throw new UsageError(errorMessage(err));
83
59
  }
84
60
  return { config, root };
85
61
  }
86
- /** The module at `path`, imported by its real path: the module a relative import of it is. */
87
- const importReal = (path) => import(__rewriteRelativeImportExtension(pathToFileURL(realpathSync(path)).href));
88
- /** A workflow file's name: `.ts`, but a test (`.test.ts`, `.spec.ts`) or a declaration. */
89
- const isSource = (name) => name.endsWith(".ts") && !/\.(test|spec|d)\.ts$/.test(name);
90
- const isWorkflow = (x) => typeof x === "object" && x !== null && x.kind === "workflow";
62
+ /** The modules at `paths`, at once, each by its real path (the module a relative import of it is), beside it. */
63
+ const importReal = (paths) => Promise.all(paths.map(async (path) => {
64
+ const real = realpathSync(path);
65
+ return [real, (await import(__rewriteRelativeImportExtension(pathToFileURL(real).href)))];
66
+ }));
91
67
  const isConfig = (x) => typeof x === "object" && x !== null && "connectors" in x;
92
68
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,qHAAqH;AACrH,MAAM,OAAO,UAAW,SAAQ,KAAK;CAAG;AAaxC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAClD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC9B,IAAI,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9C,IAAI,CAAC,UAAU,CA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;IACrG,IAAI,CAAC;QACH,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,GAAG,CAAC,KAAe,EAA+B,EAAE,CAClE,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAA6B,EAAE;IAClD,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,MAAM,kCAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAC,CAAW,CAAC,CAAC;AACpE,CAAC,CAAC,CACH,CAAC;AAEJ,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAqB,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,YAAY,IAAI,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanoma",
3
- "version": "0.11.17",
3
+ "version": "0.11.18",
4
4
  "description": "One command over a Sanoma repo: run the worker and the app, check it, write its .env.example, export a run's ledger",
5
5
  "keywords": [
6
6
  "approvals",
@@ -74,10 +74,10 @@
74
74
  "access": "public"
75
75
  },
76
76
  "dependencies": {
77
- "@sanoma-ai/app": "0.10.13",
77
+ "@sanoma-ai/app": "0.10.14",
78
78
  "@sanoma-ai/bridge": "0.5.6",
79
79
  "@sanoma-ai/connector-better-auth": "0.2.6",
80
- "@sanoma-ai/workflows": "0.11.16",
80
+ "@sanoma-ai/workflows": "0.11.17",
81
81
  "@types/node": "^26.6.4",
82
82
  "oxlint": "^1.87.0",
83
83
  "pg": "^8.23.1",