@sanoma-ai/workflows 0.1.0 → 0.4.0
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/README.md +186 -76
- package/dist/apply-steps.d.ts +6 -0
- package/dist/apply-steps.js +93 -0
- package/dist/apply-steps.js.map +1 -0
- package/dist/apply.d.ts +197 -0
- package/dist/apply.js +470 -0
- package/dist/apply.js.map +1 -0
- package/dist/approvals.d.ts +11 -6
- package/dist/approvals.js +38 -10
- package/dist/approvals.js.map +1 -1
- package/dist/call-workflow.d.ts +16 -0
- package/dist/call-workflow.js +35 -0
- package/dist/call-workflow.js.map +1 -0
- package/dist/call.d.ts +35 -2
- package/dist/call.js +123 -43
- package/dist/call.js.map +1 -1
- package/dist/cedar.d.ts +87 -0
- package/dist/cedar.js +365 -0
- package/dist/cedar.js.map +1 -0
- package/dist/client.d.ts +123 -9
- package/dist/client.js +355 -34
- package/dist/client.js.map +1 -1
- package/dist/collection.d.ts +107 -0
- package/dist/collection.js +306 -0
- package/dist/collection.js.map +1 -0
- package/dist/config.d.ts +42 -14
- package/dist/config.js +109 -28
- package/dist/config.js.map +1 -1
- package/dist/constructors.d.ts +2 -0
- package/dist/constructors.js +5 -0
- package/dist/constructors.js.map +1 -0
- package/dist/credentials.d.ts +25 -0
- package/dist/credentials.js +73 -5
- package/dist/credentials.js.map +1 -1
- package/dist/data.d.ts +2 -0
- package/dist/data.js +3 -0
- package/dist/data.js.map +1 -0
- package/dist/datafile.d.ts +38 -3
- package/dist/datafile.js +166 -13
- package/dist/datafile.js.map +1 -1
- package/dist/db.d.ts +5 -3
- package/dist/db.js +88 -21
- package/dist/db.js.map +1 -1
- package/dist/define.d.ts +10 -4
- package/dist/define.js +1 -5
- package/dist/define.js.map +1 -1
- package/dist/describe.d.ts +54 -8
- package/dist/describe.js +84 -11
- package/dist/describe.js.map +1 -1
- package/dist/direct.d.ts +9 -0
- package/dist/direct.js +11 -0
- package/dist/direct.js.map +1 -0
- package/dist/drift.d.ts +64 -12
- package/dist/drift.js +118 -41
- package/dist/drift.js.map +1 -1
- package/dist/errors.d.ts +16 -1
- package/dist/errors.js +30 -1
- package/dist/errors.js.map +1 -1
- package/dist/expectations.d.ts +4 -4
- package/dist/expectations.js +43 -9
- package/dist/expectations.js.map +1 -1
- package/dist/host.d.ts +56 -0
- package/dist/host.js +45 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +13 -5
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/ledger.d.ts +12 -1
- package/dist/ledger.js +18 -11
- package/dist/ledger.js.map +1 -1
- package/dist/lint.d.ts +5 -4
- package/dist/lint.js +24 -7
- package/dist/lint.js.map +1 -1
- package/dist/lockfile.d.ts +36 -0
- package/dist/lockfile.js +69 -0
- package/dist/lockfile.js.map +1 -0
- package/dist/op.d.ts +9 -0
- package/dist/op.js.map +1 -1
- package/dist/outline.d.ts +2 -0
- package/dist/outline.js +1 -1
- package/dist/outline.js.map +1 -1
- package/dist/paths.d.ts +4 -0
- package/dist/paths.js +17 -3
- package/dist/paths.js.map +1 -1
- package/dist/person.d.ts +61 -0
- package/dist/person.js +69 -0
- package/dist/person.js.map +1 -0
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/policy.d.ts +51 -55
- package/dist/policy.js +14 -36
- package/dist/policy.js.map +1 -1
- package/dist/resource.d.ts +207 -25
- package/dist/resource.js +184 -30
- package/dist/resource.js.map +1 -1
- package/dist/resources.d.ts +76 -9
- package/dist/resources.js +170 -30
- package/dist/resources.js.map +1 -1
- package/dist/run.d.ts +31 -1
- package/dist/run.js +6 -1
- package/dist/run.js.map +1 -1
- package/dist/sandbox.js +5 -1
- package/dist/sandbox.js.map +1 -1
- package/dist/scenario.d.ts +25 -9
- package/dist/scenario.js +125 -27
- package/dist/scenario.js.map +1 -1
- package/dist/scenarios.d.ts +10 -6
- package/dist/scenarios.js +8 -4
- package/dist/scenarios.js.map +1 -1
- package/dist/schema.d.ts +32 -0
- package/dist/schema.js +225 -0
- package/dist/schema.js.map +1 -0
- package/dist/sdk.d.ts +34 -0
- package/dist/sdk.js +168 -0
- package/dist/sdk.js.map +1 -0
- package/dist/secret.d.ts +42 -0
- package/dist/secret.js +58 -0
- package/dist/secret.js.map +1 -0
- package/dist/shared.d.ts +188 -4
- package/dist/shared.js +165 -5
- package/dist/shared.js.map +1 -1
- package/dist/sites.d.ts +52 -0
- package/dist/sites.js +174 -0
- package/dist/sites.js.map +1 -0
- package/dist/source.d.ts +58 -0
- package/dist/source.js +54 -0
- package/dist/source.js.map +1 -0
- package/dist/version.d.ts +3 -2
- package/dist/version.js +3 -2
- package/dist/version.js.map +1 -1
- package/dist/worker.d.ts +6 -2
- package/dist/worker.js +37 -8
- package/dist/worker.js.map +1 -1
- package/dist/writer.d.ts +35 -0
- package/dist/writer.js +201 -0
- package/dist/writer.js.map +1 -0
- package/oxlint.json +5 -16
- package/package.json +11 -1
- package/src/apply-steps.ts +110 -0
- package/src/apply.ts +626 -0
- package/src/approvals.ts +49 -13
- package/src/call-workflow.ts +44 -0
- package/src/call.ts +173 -46
- package/src/cedar.ts +493 -0
- package/src/client.ts +450 -49
- package/src/collection.ts +431 -0
- package/src/config.ts +168 -48
- package/src/constructors.ts +4 -0
- package/src/credentials.ts +90 -5
- package/src/data.ts +10 -0
- package/src/datafile.ts +207 -15
- package/src/db.ts +90 -22
- package/src/define.ts +11 -9
- package/src/describe.ts +146 -23
- package/src/direct.ts +15 -0
- package/src/drift.ts +155 -45
- package/src/errors.ts +36 -1
- package/src/expectations.ts +46 -11
- package/src/host.ts +96 -0
- package/src/index.ts +56 -2
- package/src/ledger.ts +35 -17
- package/src/lint.ts +29 -12
- package/src/lockfile.ts +95 -0
- package/src/op.ts +9 -0
- package/src/outline.ts +1 -1
- package/src/paths.ts +18 -3
- package/src/person.ts +75 -0
- package/src/plugin.ts +1 -1
- package/src/policy.ts +59 -63
- package/src/resource.ts +302 -52
- package/src/resources.ts +226 -30
- package/src/run.ts +33 -1
- package/src/sandbox.ts +5 -1
- package/src/scenario.ts +175 -43
- package/src/scenarios.ts +15 -8
- package/src/schema.ts +261 -0
- package/src/sdk.ts +211 -0
- package/src/secret.ts +92 -0
- package/src/shared.ts +279 -6
- package/src/sites.ts +220 -0
- package/src/source.ts +82 -0
- package/src/version.ts +3 -2
- package/src/worker.ts +45 -11
- package/src/writer.ts +225 -0
package/dist/sites.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
2
|
+
import { join, relative, sep } from "node:path";
|
|
3
|
+
import { childrenOf, readSource } from "./ast.js";
|
|
4
|
+
import { keyName } from "./datafile.js";
|
|
5
|
+
import { stringValue, unwrap } from "./outline.js";
|
|
6
|
+
import { filesUnder, isDirectory } from "./paths.js";
|
|
7
|
+
import { apiNameOf, DATA_VENDOR, SITE_NAME } from "./shared.js";
|
|
8
|
+
/** Where a site's code is: its pages and its components. */
|
|
9
|
+
const SITE_DIRS = ["routes", "components"];
|
|
10
|
+
/** Where `api` and `defineSite` come from: `sanoma/site`, which re-exports the app's. */
|
|
11
|
+
const SITE_SOURCES = new Set(["sanoma/site", "@sanoma-ai/app/site"]);
|
|
12
|
+
const UI_SOURCES = new Set(["@sanoma-ai/app/ui"]);
|
|
13
|
+
const KIND_NAMES = { workflow: "workflow", collection: "collection", op: "operation" };
|
|
14
|
+
/** What makes a route from its id, whose first argument is the id. */
|
|
15
|
+
const ROUTE_MAKERS = new Set(["createFileRoute", "createLazyFileRoute"]);
|
|
16
|
+
/**
|
|
17
|
+
* The sites under `root`: each folder of `sites/` with a `routes/` whose name is a URL segment,
|
|
18
|
+
* by name (as `@sanoma-ai/app/build`'s `sitesOf` mounts them). Reads `routes/**` and
|
|
19
|
+
* `components/**` (`.ts` and `.tsx`, less tests and declarations) of each with oxc, never running
|
|
20
|
+
* them: each `<RunForm workflow="…" />` whose `RunForm` is imported from `@sanoma-ai/app/ui`, and
|
|
21
|
+
* each use of `api` imported from `sanoma/site`, called or passed on (`queryFn: api.data.leads.list`):
|
|
22
|
+
* `api.<name>` and `api.<name>.<method>` are a workflow, `api.data.<collection>.<op>` a collection,
|
|
23
|
+
* and `api.<vendor>.<resource>.<op>` an operation. A name that is not written out (a variable, a
|
|
24
|
+
* template with holes, a computed member) is skipped, as is a use through a namespace import or a
|
|
25
|
+
* destructured `api`. A call to what `description` does not have, or to an operation a page may
|
|
26
|
+
* not call directly, is a problem.
|
|
27
|
+
*/
|
|
28
|
+
export function readSites(root, description) {
|
|
29
|
+
if (root === undefined)
|
|
30
|
+
return [];
|
|
31
|
+
const dir = join(root, "sites");
|
|
32
|
+
if (!isDirectory(dir))
|
|
33
|
+
return [];
|
|
34
|
+
const workflows = new Set(description.workflows.map((wf) => wf.name));
|
|
35
|
+
const collections = new Set(description.collections.map((c) => c.name));
|
|
36
|
+
const ops = new Map(description.ops.map((op) => [op.id, op]));
|
|
37
|
+
// A workflow's api name to its name: two of one api name are a problem on the workflows.
|
|
38
|
+
const byApiName = new Map(description.workflows.map((wf) => [apiNameOf(wf.name), wf.name]));
|
|
39
|
+
/** A call as written, resolved as the app's `callApi` resolves it, with why it would fail. */
|
|
40
|
+
const resolve = ({ kind, name, via, ...at }) => {
|
|
41
|
+
const target = kind === "workflow" && via === "api" ? (byApiName.get(name) ?? name) : name;
|
|
42
|
+
const found = kind === "workflow"
|
|
43
|
+
? via === "api"
|
|
44
|
+
? byApiName.has(name)
|
|
45
|
+
: workflows.has(name)
|
|
46
|
+
: kind === "collection"
|
|
47
|
+
? collections.has(name)
|
|
48
|
+
: ops.has(name);
|
|
49
|
+
const problem = !found
|
|
50
|
+
? `calls ${KIND_NAMES[kind]} "${target}", which does not exist`
|
|
51
|
+
: kind === "op" && !ops.get(name).direct
|
|
52
|
+
? `calls operation "${target}", which a page may not call directly: start a workflow that calls it`
|
|
53
|
+
: undefined;
|
|
54
|
+
return { call: { kind, target, via, ...at }, ...(problem && { problem }) };
|
|
55
|
+
};
|
|
56
|
+
return readdirSync(dir, { withFileTypes: true })
|
|
57
|
+
.filter((d) => d.isDirectory() && SITE_NAME.test(d.name) && existsSync(join(dir, d.name, "routes")))
|
|
58
|
+
.map((d) => d.name)
|
|
59
|
+
.toSorted()
|
|
60
|
+
.map((name) => {
|
|
61
|
+
const files = SITE_DIRS.flatMap((sub) => filesUnder(join(dir, name, sub), isSource)).toSorted();
|
|
62
|
+
const resolved = files.flatMap((path) => {
|
|
63
|
+
const file = readSource(path);
|
|
64
|
+
return typeof file === "string" ? [] : usesIn(file, relative(root, path).split(sep).join("/")).map(resolve);
|
|
65
|
+
});
|
|
66
|
+
const title = titleOf(join(dir, name, "site.ts"));
|
|
67
|
+
const calls = resolved.map((r) => r.call);
|
|
68
|
+
const problems = resolved.flatMap(({ call: { file, line, column }, problem }) => problem === undefined ? [] : [{ file, line, column, message: problem }]);
|
|
69
|
+
return { name, ...(title !== undefined && { title }), calls, problems };
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/** The uses in one file, in its order. */
|
|
73
|
+
function usesIn({ program, at }, file) {
|
|
74
|
+
const api = importedAs(program, SITE_SOURCES, "api");
|
|
75
|
+
const runForm = importedAs(program, UI_SOURCES, "RunForm");
|
|
76
|
+
if (!api.size && !runForm.size)
|
|
77
|
+
return [];
|
|
78
|
+
const found = [];
|
|
79
|
+
let page;
|
|
80
|
+
const visit = (node) => {
|
|
81
|
+
if (!node)
|
|
82
|
+
return;
|
|
83
|
+
if (node.type === "MemberExpression") {
|
|
84
|
+
const named = apiPath(node, api);
|
|
85
|
+
// The outermost member of a path on `api`: what it names, called or not; its inner members are not visited.
|
|
86
|
+
if (named)
|
|
87
|
+
return void found.push({ ...named, via: "api", file, ...at(node.start) });
|
|
88
|
+
}
|
|
89
|
+
else if (node.type === "CallExpression" && page === undefined) {
|
|
90
|
+
const callee = unwrap(node.callee);
|
|
91
|
+
if (callee?.type === "Identifier" && ROUTE_MAKERS.has(callee.name)) {
|
|
92
|
+
const id = stringValue(node.arguments[0]);
|
|
93
|
+
if (id !== undefined)
|
|
94
|
+
page = pageOf(id);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else if (node.type === "JSXOpeningElement" && node.name.type === "JSXIdentifier" && runForm.has(node.name.name)) {
|
|
98
|
+
const attribute = node.attributes.find((a) => a.type === "JSXAttribute" && a.name.type === "JSXIdentifier" && a.name.name === "workflow");
|
|
99
|
+
const value = attribute?.value?.type === "JSXExpressionContainer" ? attribute.value.expression : attribute?.value;
|
|
100
|
+
const name = stringValue(value);
|
|
101
|
+
if (name !== undefined)
|
|
102
|
+
found.push({ kind: "workflow", name, via: "RunForm", file, ...at(node.start) });
|
|
103
|
+
}
|
|
104
|
+
for (const child of childrenOf(node))
|
|
105
|
+
visit(child);
|
|
106
|
+
};
|
|
107
|
+
visit(program);
|
|
108
|
+
return found.map((use) => (page === undefined ? use : { ...use, page }));
|
|
109
|
+
}
|
|
110
|
+
/** What a member path on `api` names; undefined for a path on anything else, a name not written out, or no name. */
|
|
111
|
+
function apiPath(member, api) {
|
|
112
|
+
const path = [];
|
|
113
|
+
let node = member;
|
|
114
|
+
while (node?.type === "MemberExpression") {
|
|
115
|
+
const key = node.computed ? stringValue(node.property) : node.property.name;
|
|
116
|
+
if (key === undefined)
|
|
117
|
+
return undefined;
|
|
118
|
+
path.unshift(key);
|
|
119
|
+
node = unwrap(node.object);
|
|
120
|
+
}
|
|
121
|
+
if (node?.type !== "Identifier" || !api.has(node.name))
|
|
122
|
+
return undefined;
|
|
123
|
+
const [first, second] = path;
|
|
124
|
+
if (first === DATA_VENDOR)
|
|
125
|
+
return path.length === 3 ? { kind: "collection", name: second } : undefined;
|
|
126
|
+
if (path.length === 3)
|
|
127
|
+
return { kind: "op", name: path.join(".") };
|
|
128
|
+
return path.length <= 2 ? { kind: "workflow", name: first } : undefined;
|
|
129
|
+
}
|
|
130
|
+
/** The local names `imported` has in the file, imported as a value from one of `sources`. */
|
|
131
|
+
function importedAs(program, sources, imported) {
|
|
132
|
+
const names = new Set();
|
|
133
|
+
for (const statement of program.body) {
|
|
134
|
+
if (statement.type !== "ImportDeclaration" || statement.importKind === "type")
|
|
135
|
+
continue;
|
|
136
|
+
if (!sources.has(statement.source.value))
|
|
137
|
+
continue;
|
|
138
|
+
for (const s of statement.specifiers) {
|
|
139
|
+
if (s.type === "ImportSpecifier" && s.importKind !== "type" && keyName(s.imported) === imported) {
|
|
140
|
+
names.add(s.local.name);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return names;
|
|
145
|
+
}
|
|
146
|
+
/** A site's title: the string `title` its `site.ts` exports by default through `defineSite`. */
|
|
147
|
+
function titleOf(path) {
|
|
148
|
+
const file = readSource(path);
|
|
149
|
+
if (typeof file === "string")
|
|
150
|
+
return undefined;
|
|
151
|
+
const defineSite = importedAs(file.program, SITE_SOURCES, "defineSite");
|
|
152
|
+
const exported = file.program.body.find((s) => s.type === "ExportDefaultDeclaration")?.declaration;
|
|
153
|
+
const call = unwrap(exported);
|
|
154
|
+
const callee = unwrap(call?.callee);
|
|
155
|
+
const options = unwrap(call?.arguments?.[0]);
|
|
156
|
+
if (call?.type !== "CallExpression" || callee?.type !== "Identifier" || !defineSite.has(callee.name))
|
|
157
|
+
return undefined;
|
|
158
|
+
if (options?.type !== "ObjectExpression")
|
|
159
|
+
return undefined;
|
|
160
|
+
const title = options.properties.find((p) => p.type === "Property" && !p.computed && keyName(p.key) === "title");
|
|
161
|
+
return stringValue(title?.value);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* A route's path from its id, as the router serves it: `(group)` and `_pathless` segments left
|
|
165
|
+
* out, a `_` that ends a segment dropped, and no trailing slash.
|
|
166
|
+
*/
|
|
167
|
+
const pageOf = (id) => `/${id
|
|
168
|
+
.split("/")
|
|
169
|
+
.filter((s) => s && !/^\(.*\)$/.test(s) && !s.startsWith("_"))
|
|
170
|
+
.map((s) => s.replace(/_$/, ""))
|
|
171
|
+
.join("/")}`;
|
|
172
|
+
/** A site's source file: `.ts` or `.tsx`, but a test or a declaration. */
|
|
173
|
+
const isSource = (name) => /\.tsx?$/.test(name) && !/\.(test|d)\.tsx?$/.test(name);
|
|
174
|
+
//# sourceMappingURL=sites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sites.js","sourceRoot":"","sources":["../src/sites.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,UAAU,EAA+B,UAAU,EAAmB,MAAM,UAAU,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA0ChE,4DAA4D;AAC5D,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AAC3C,yFAAyF;AACzF,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAC1F,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC;AACvE,MAAM,UAAU,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,EAAW,CAAC;AAChG,sEAAsE;AACtE,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAE9F;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,SAAS,CACvB,IAA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AK,gBAAgB,IAAI,MAAM,EAAE,IAAI,KAAK,YAAY,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAClG,OAAO,SAAS,CAAC;IACnB,IAAI,OAAO,EAAE,IAAI,KAAK,kBAAkB;QAAE,OAAO,SAAS,CAAC;IAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CACnC,CAAC,CAAO,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,OAAO,CAChF,CAAC;IACF,OAAO,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,MAAM,MAAM,GAAG,CAAC,EAAU,EAAU,EAAE,CACpC,IAAI,EAAE;KACH,KAAK,CAAC,GAAG,CAAC;KACV,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;KAC7D,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;KAC/B,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAEjB,0EAA0E;AAC1E,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/source.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** A company's repository, as the runtime writes to it. */
|
|
3
|
+
export interface Source {
|
|
4
|
+
/** The repository's root directory. */
|
|
5
|
+
root: string;
|
|
6
|
+
/**
|
|
7
|
+
* Records the files at `paths`, relative to `root`, as one change by `author` (who made it, as
|
|
8
|
+
* the app names them: a login or a typed name). Its revision; undefined when nothing changed.
|
|
9
|
+
*/
|
|
10
|
+
commit(change: {
|
|
11
|
+
paths: string[];
|
|
12
|
+
message: string;
|
|
13
|
+
author: string;
|
|
14
|
+
}): {
|
|
15
|
+
revision: string;
|
|
16
|
+
} | undefined | Promise<{
|
|
17
|
+
revision: string;
|
|
18
|
+
} | undefined>;
|
|
19
|
+
/** The revision `ref` names, the checked-out one by default. */
|
|
20
|
+
head(ref?: string): string | Promise<string>;
|
|
21
|
+
/** Pushes `ref` to the repository at `url`, signed in with `token`. */
|
|
22
|
+
push?(target: {
|
|
23
|
+
url: string;
|
|
24
|
+
token: string;
|
|
25
|
+
ref: string;
|
|
26
|
+
}): void | Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The built-in operation `sanoma.source.resolve`: the commit `ref` names in the repository at
|
|
30
|
+
* `url` now, by `git ls-remote` (a branch first, then a tag, peeled; a full commit id is itself).
|
|
31
|
+
* Apply calls it to fill a host's revision before it plans, and drift to see a merge. `resolveConfig`
|
|
32
|
+
* registers it when a connector declares a host type.
|
|
33
|
+
*/
|
|
34
|
+
export declare const sourceOps: import("./op.ts").Connector<"sanoma", {
|
|
35
|
+
readonly source: {
|
|
36
|
+
readonly resolve: {
|
|
37
|
+
readonly effect: "read";
|
|
38
|
+
readonly idempotent: true;
|
|
39
|
+
readonly description: "Resolve a branch or tag of a git repository to the commit it names now";
|
|
40
|
+
readonly input: z.ZodObject<{
|
|
41
|
+
url: z.ZodString;
|
|
42
|
+
ref: z.ZodString;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
readonly output: z.ZodObject<{
|
|
45
|
+
revision: z.ZodString;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
readonly target: ({ url, ref }: {
|
|
48
|
+
url: string;
|
|
49
|
+
ref: string;
|
|
50
|
+
}) => string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
export declare const SOURCE_RESOLVE = "sanoma.source.resolve";
|
|
55
|
+
/** The driver of `sanoma.source.resolve`: git on this machine, with its own credential helpers. */
|
|
56
|
+
export declare const sourceDriver: import("./op.ts").Driver;
|
|
57
|
+
/** The commit `ref` (a branch, a tag, `HEAD`, a full ref or a commit id) names in the repository at `url`. */
|
|
58
|
+
export declare function resolveRevision(url: string, ref: string): Promise<string>;
|
package/dist/source.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { defineConnector, defineDriver, DriverError } from "./op.js";
|
|
5
|
+
/**
|
|
6
|
+
* The built-in operation `sanoma.source.resolve`: the commit `ref` names in the repository at
|
|
7
|
+
* `url` now, by `git ls-remote` (a branch first, then a tag, peeled; a full commit id is itself).
|
|
8
|
+
* Apply calls it to fill a host's revision before it plans, and drift to see a merge. `resolveConfig`
|
|
9
|
+
* registers it when a connector declares a host type.
|
|
10
|
+
*/
|
|
11
|
+
export const sourceOps = defineConnector("sanoma", {
|
|
12
|
+
source: {
|
|
13
|
+
resolve: {
|
|
14
|
+
effect: "read",
|
|
15
|
+
idempotent: true,
|
|
16
|
+
description: "Resolve a branch or tag of a git repository to the commit it names now",
|
|
17
|
+
input: z.object({ url: z.string().min(1), ref: z.string().min(1) }),
|
|
18
|
+
output: z.object({ revision: z.string() }),
|
|
19
|
+
target: ({ url, ref }) => `${url}#${ref}`,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export const SOURCE_RESOLVE = "sanoma.source.resolve";
|
|
24
|
+
/** The driver of `sanoma.source.resolve`: git on this machine, with its own credential helpers. */
|
|
25
|
+
export const sourceDriver = defineDriver(sourceOps, {
|
|
26
|
+
source: { resolve: async ({ url, ref }) => ({ revision: await resolveRevision(url, ref) }) },
|
|
27
|
+
});
|
|
28
|
+
const COMMIT = /^[0-9a-f]{40}([0-9a-f]{24})?$/;
|
|
29
|
+
/** The commit `ref` (a branch, a tag, `HEAD`, a full ref or a commit id) names in the repository at `url`. */
|
|
30
|
+
export async function resolveRevision(url, ref) {
|
|
31
|
+
if (COMMIT.test(ref))
|
|
32
|
+
return ref;
|
|
33
|
+
const { stdout } = await promisify(execFile)("git", ["ls-remote", "--", url, ref, `${ref}^{}`], {
|
|
34
|
+
// Never a prompt for credentials: a repository that needs them and has none fails.
|
|
35
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" },
|
|
36
|
+
timeout: 30_000,
|
|
37
|
+
}).catch((err) => {
|
|
38
|
+
throw new DriverError(`git ls-remote ${url} failed: ${err.stderr?.trim() || err.message}`, {
|
|
39
|
+
retryable: true,
|
|
40
|
+
cause: err,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
const refs = new Map(stdout.split("\n").flatMap((line) => {
|
|
44
|
+
const [sha, name] = line.split("\t");
|
|
45
|
+
return sha && name ? [[name, sha]] : [];
|
|
46
|
+
}));
|
|
47
|
+
for (const name of [`refs/heads/${ref}`, `refs/tags/${ref}^{}`, `refs/tags/${ref}`, ref]) {
|
|
48
|
+
const sha = refs.get(name);
|
|
49
|
+
if (sha)
|
|
50
|
+
return sha;
|
|
51
|
+
}
|
|
52
|
+
throw new DriverError(`${url} has no branch or tag ${ref}`, { retryable: false, vendorCode: "no_such_ref" });
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE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Aa,EAAE,CAAC,CAAC;AAC/G,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { type WorkflowDefinition } from "./define.ts";
|
|
2
2
|
/** This package's version. A unit test keeps it equal to package.json. */
|
|
3
|
-
export declare const RUNTIME_VERSION = "0.
|
|
3
|
+
export declare const RUNTIME_VERSION = "0.4.0";
|
|
4
4
|
/**
|
|
5
5
|
* The sequence of DBOS calls the runtime makes around each `ctx` call: policy step, approval
|
|
6
6
|
* events and messages, the driver step. Bump it whenever that sequence changes, even without a
|
|
7
7
|
* package release, so a run in flight on the old layout is not replayed against the new one.
|
|
8
8
|
* 2: calls run in program order; a decision event per approval (2026-10-07).
|
|
9
|
+
* 3: a start the policy holds waits on its approval before the body (2026-10-21).
|
|
9
10
|
*/
|
|
10
|
-
export declare const STEP_LAYOUT =
|
|
11
|
+
export declare const STEP_LAYOUT = 3;
|
|
11
12
|
/**
|
|
12
13
|
* The application version DBOS stamps on every run, always `<appName>@…`: DBOS version names
|
|
13
14
|
* are unique per system database across apps. A worker recovers and dequeues only runs of its
|
package/dist/version.js
CHANGED
|
@@ -5,14 +5,15 @@ import { dirname, join } from "node:path";
|
|
|
5
5
|
import { jsonSchemaOf, opIdsOf } from "./define.js";
|
|
6
6
|
import { upFrom } from "./paths.js";
|
|
7
7
|
/** This package's version. A unit test keeps it equal to package.json. */
|
|
8
|
-
export const RUNTIME_VERSION = "0.
|
|
8
|
+
export const RUNTIME_VERSION = "0.4.0";
|
|
9
9
|
/**
|
|
10
10
|
* The sequence of DBOS calls the runtime makes around each `ctx` call: policy step, approval
|
|
11
11
|
* events and messages, the driver step. Bump it whenever that sequence changes, even without a
|
|
12
12
|
* package release, so a run in flight on the old layout is not replayed against the new one.
|
|
13
13
|
* 2: calls run in program order; a decision event per approval (2026-10-07).
|
|
14
|
+
* 3: a start the policy holds waits on its approval before the body (2026-10-21).
|
|
14
15
|
*/
|
|
15
|
-
export const STEP_LAYOUT =
|
|
16
|
+
export const STEP_LAYOUT = 3;
|
|
16
17
|
let dbosVersion;
|
|
17
18
|
/** The installed DBOS SDK's version, read from its package.json (which its exports don't expose). */
|
|
18
19
|
function installedDbosVersion() {
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,OAAO,EAA2B,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEvC
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,OAAO,EAA2B,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE7B,IAAI,WAA+B,CAAC;AAEpC,qGAAqG;AACrG,SAAS,oBAAoB;IAC3B,WAAW,KAAK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AC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC;SAC9B,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAE,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;SACrG,MAAM,CAAC,KAAK,CAAC,CAAC;IACjB,OAAO,GAAG,OAAO,IAAI,IAAI,EAAE,CAAC;AAC9B,CAAC;AAED,+GAA+G;AAC/G,SAAS,aAAa,CAAC,EAAgC;IACrD,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC"}
|
package/dist/worker.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type SanomaConfig } from "./config.ts";
|
|
2
|
+
import type { Source } from "./source.ts";
|
|
2
3
|
export interface Worker {
|
|
3
4
|
/**
|
|
4
5
|
* The vendors whose drivers could not run when the worker started, in the config's order: a
|
|
@@ -12,8 +13,9 @@ export interface WorkerOptions {
|
|
|
12
13
|
/** The least severe level of the runtime's and DBOS's messages to show, for the whole process: `warn` by default. */
|
|
13
14
|
logLevel?: string;
|
|
14
15
|
/**
|
|
15
|
-
* Start without naming the vendors not configured yet (`unconfigured` still does)
|
|
16
|
-
* whose runs use the fakes alone, as `runScenarios`'s
|
|
16
|
+
* Start without naming the vendors not configured yet (`unconfigured` still does), or the
|
|
17
|
+
* policies' problems: for a worker whose runs use the fakes alone, as `runScenarios`'s, which
|
|
18
|
+
* `sanoma check` reports them beside.
|
|
17
19
|
*/
|
|
18
20
|
quiet?: boolean;
|
|
19
21
|
/**
|
|
@@ -23,6 +25,8 @@ export interface WorkerOptions {
|
|
|
23
25
|
* restarting during a rolling deploy would otherwise take the new workers' runs.
|
|
24
26
|
*/
|
|
25
27
|
promote?: boolean;
|
|
28
|
+
/** The company's repository, which apply commits the lockfile to; the launcher passes its checkout. */
|
|
29
|
+
source?: Source;
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
32
|
* Registers the workflows, connects to Postgres and recovers any runs that were interrupted.
|
package/dist/worker.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { DBOS } from "@dbos-inc/dbos-sdk";
|
|
2
|
-
import {
|
|
2
|
+
import { awaitApproval } from "./approvals.js";
|
|
3
|
+
import { buildCtx, decideStart, isInfrastructureError, startHoldOf } from "./call.js";
|
|
3
4
|
import { dbosStatusesOf } from "./client.js";
|
|
4
5
|
import { resolveConfig } from "./config.js";
|
|
5
|
-
import { watchCredentials } from "./credentials.js";
|
|
6
|
-
import { DBOS_DATABASE_OPTIONS, prepareDatabase } from "./db.js";
|
|
6
|
+
import { storedSecrets, watchCredentials } from "./credentials.js";
|
|
7
|
+
import { DBOS_DATABASE_OPTIONS, lazyPool, prepareDatabase } from "./db.js";
|
|
7
8
|
import { credentialsOf, unconfigured, unconfiguredSummary } from "./env.js";
|
|
8
|
-
import { errorInfo, parseOrThrow } from "./errors.js";
|
|
9
|
+
import { errorInfo, parseOrThrow, PolicyDeniedError } from "./errors.js";
|
|
9
10
|
import { entry, ownedLedger, skipped, write, writeFailure } from "./ledger.js";
|
|
10
11
|
import { dbosLogger, quietIfSandbox, setLogLevel, warn } from "./log.js";
|
|
11
12
|
import { lineStartsOf, readSource } from "./ast.js";
|
|
12
13
|
import { callsOf, outlineWithSource } from "./outline.js";
|
|
13
|
-
import {
|
|
14
|
+
import { currentRun } from "./run.js";
|
|
15
|
+
import { errorMessage, WORKFLOW_ACTION } from "./shared.js";
|
|
14
16
|
// DBOS registrations are process-wide and survive shutdown, so a name is registered once, and
|
|
15
17
|
// its function reads the state of the worker running when a run starts, definition and all; the
|
|
16
18
|
// run keeps that state.
|
|
@@ -29,16 +31,21 @@ export async function startWorker(config, options = {}) {
|
|
|
29
31
|
setLogLevel(options.logLevel);
|
|
30
32
|
// The config's own, or a Postgres store made for this worker, which `stop` then closes.
|
|
31
33
|
const ledger = ownedLedger(resolved);
|
|
34
|
+
const secrets = lazyPool(resolved.databaseUrl, "secrets");
|
|
32
35
|
const state = {
|
|
33
36
|
app: resolved.appName,
|
|
34
37
|
ops: resolved.ops,
|
|
35
38
|
drivers: resolved.drivers,
|
|
36
39
|
fakes: resolved.fakes,
|
|
37
40
|
...(resolved.scenarios && { scenarios: resolved.scenarios }),
|
|
41
|
+
...(options.source && { source: options.source }),
|
|
38
42
|
types: resolved.types,
|
|
43
|
+
collections: resolved.collections,
|
|
39
44
|
steps: resolved.steps,
|
|
40
45
|
policy: resolved.policy,
|
|
46
|
+
...(resolved.root !== undefined && { root: resolved.root }),
|
|
41
47
|
ledger: ledger.store,
|
|
48
|
+
secrets: storedSecrets(() => secrets.db(), "sanoma"),
|
|
42
49
|
workflows: resolved.workflows,
|
|
43
50
|
outlines: new Map([...resolved.workflows].map(([name, wf]) => [name, outlineOf(wf)])),
|
|
44
51
|
stopped: false,
|
|
@@ -52,7 +59,13 @@ export async function startWorker(config, options = {}) {
|
|
|
52
59
|
state.stopped = true;
|
|
53
60
|
// Each is closed whatever the one before did; the first failure is what stop throws.
|
|
54
61
|
let failed;
|
|
55
|
-
for (const close of [
|
|
62
|
+
for (const close of [
|
|
63
|
+
() => DBOS.shutdown(),
|
|
64
|
+
() => credentials.close(),
|
|
65
|
+
() => secrets.close(),
|
|
66
|
+
() => ledger.close(),
|
|
67
|
+
async () => resolved.dataStore?.close(),
|
|
68
|
+
]) {
|
|
56
69
|
await close().catch((error) => (failed ??= { error }));
|
|
57
70
|
}
|
|
58
71
|
if (failed)
|
|
@@ -102,6 +115,9 @@ export async function startWorker(config, options = {}) {
|
|
|
102
115
|
const summary = unconfiguredSummary(worker.unconfigured, resolved.driversByVendor.size);
|
|
103
116
|
if (summary && !options.quiet)
|
|
104
117
|
warn(summary);
|
|
118
|
+
if (resolved.policyProblems.length && !options.quiet) {
|
|
119
|
+
warn(`the policies do not hold, so every call and start is refused:\n ${resolved.policyProblems.join("\n ")}`);
|
|
120
|
+
}
|
|
105
121
|
}
|
|
106
122
|
catch (err) {
|
|
107
123
|
// Once DBOS is launched, the caller gets no worker to stop: stop it here, so no run goes on
|
|
@@ -164,7 +180,7 @@ function register(name) {
|
|
|
164
180
|
});
|
|
165
181
|
}
|
|
166
182
|
/** One run of the workflow registered as `name`, on the state of the worker running when it starts. */
|
|
167
|
-
async function runWorkflow(name, { input, startedBy, sandbox }) {
|
|
183
|
+
async function runWorkflow(name, { input, startedBy, sandbox, hold }) {
|
|
168
184
|
const state = current;
|
|
169
185
|
// A stopped worker's state stays current while DBOS shuts down.
|
|
170
186
|
if (!state || state.stopped)
|
|
@@ -193,12 +209,25 @@ async function runWorkflow(name, { input, startedBy, sandbox }) {
|
|
|
193
209
|
try {
|
|
194
210
|
// The one parse of the input: the client checked it, but sent it as given.
|
|
195
211
|
const parsed = parseOrThrow(wf.input, input, `The input does not match ${wf.name}'s schema`);
|
|
212
|
+
// The policy held the start: the body waits for each hold's approval in turn, the policy
|
|
213
|
+
// asked again once one is approved, and a rejection or a deny fails the run.
|
|
214
|
+
const action = `${WORKFLOW_ACTION}${wf.name}`;
|
|
215
|
+
for (let next = hold; next;) {
|
|
216
|
+
const held = { op: action, input, reasons: next.reasons };
|
|
217
|
+
await awaitApproval(run, next.title, { approver: next.approver, covers: [action] }, undefined, held);
|
|
218
|
+
const decision = await DBOS.runStep(async () => decideStart(state.policy, wf.name, parsed, startedBy, run.approvals), {
|
|
219
|
+
name: `policy:${action}`,
|
|
220
|
+
});
|
|
221
|
+
if (decision.kind === "deny")
|
|
222
|
+
throw new PolicyDeniedError(action, decision.reason);
|
|
223
|
+
next = decision.kind === "approve" ? startHoldOf(wf.name, decision) : undefined;
|
|
224
|
+
}
|
|
196
225
|
if (sandbox !== undefined) {
|
|
197
226
|
// Imported here, so a live worker never loads the Gherkin parser or faker.
|
|
198
227
|
const { seedSandbox } = await import("./sandbox.js");
|
|
199
228
|
await seedSandbox(run, sandbox);
|
|
200
229
|
}
|
|
201
|
-
output = await wf.run(buildCtx(wf, run), parsed);
|
|
230
|
+
output = await currentRun.run(run, () => wf.run(buildCtx(wf, run), parsed));
|
|
202
231
|
}
|
|
203
232
|
finally {
|
|
204
233
|
// Before the outcome is written: a call still queued must find the run ended.
|
package/dist/worker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAuB,aAAa,EAAqB,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CA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O,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/writer.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { FormatConfig } from "oxfmt";
|
|
2
|
+
import { type DataFileExport, type DataFileImport, type DataValue } from "./datafile.ts";
|
|
3
|
+
/** A whole data file to render: its imports and its resources, in order. */
|
|
4
|
+
export interface DataFileContent {
|
|
5
|
+
imports: readonly Pick<DataFileImport, "source" | "imported" | "local">[];
|
|
6
|
+
exports: readonly Pick<DataFileExport, "name" | "vendor" | "type" | "desired">[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* oxfmt's options from `<root>/.oxfmtrc.json`, what `oxfmt` itself reads there, less what only
|
|
10
|
+
* its CLI uses (`ignorePatterns`, `overrides`); none, oxfmt's defaults, without the file.
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatOptions(root: string): FormatConfig;
|
|
13
|
+
/**
|
|
14
|
+
* `source`, a data file's text, with fields of its resource `exportName` set to new values:
|
|
15
|
+
* `fields` by dotted path, a list item's with its index, as a drift report names them
|
|
16
|
+
* (`required_pull_request_reviews.0.dismiss_stale_reviews`). A field the declaration does not
|
|
17
|
+
* have is added at the end of the object that should hold it. Only that `export const` changes:
|
|
18
|
+
* it is formatted with oxfmt under `options` (`formatOptions`), and every other byte of the file
|
|
19
|
+
* stays as it was.
|
|
20
|
+
*
|
|
21
|
+
* A value naming a secret adds `import { secret } from "sanoma/resources"` after the file's
|
|
22
|
+
* imports when it has none.
|
|
23
|
+
*
|
|
24
|
+
* Throws when the file does not parse, declares no such resource, or a path cannot be set: it
|
|
25
|
+
* runs through a value that is not an object or a list, or ends at a reference to another
|
|
26
|
+
* resource (a person changes a reference; a vendor's value never replaces one).
|
|
27
|
+
*/
|
|
28
|
+
export declare function setFields(source: string, exportName: string, fields: Readonly<Record<string, DataValue>>, options?: FormatConfig): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* A whole data file: the imports, one per source, then each resource as `export const`, then
|
|
31
|
+
* `export default` naming them all, formatted with oxfmt under `options`. `readDataFile` reads it
|
|
32
|
+
* back as it was given: what `readDataFile` returns renders the file again. A file whose values
|
|
33
|
+
* name a secret also imports `secret` from "sanoma/resources".
|
|
34
|
+
*/
|
|
35
|
+
export declare function renderDataFile({ imports, exports }: DataFileContent, options?: FormatConfig): Promise<string>;
|