@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/resource.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { checkHost } from "./host.js";
|
|
2
3
|
import { RESOURCE, VENDOR } from "./op.js";
|
|
4
|
+
import { isSanomaSecret, isSecret } from "./secret.js";
|
|
3
5
|
/**
|
|
4
6
|
* Where a declared resource keeps its brand, its type's `<vendor>.<type>`: a symbol, so a field
|
|
5
7
|
* holding a resource is told from data; a registered one (`Symbol.for`), so a copy of this
|
|
@@ -9,18 +11,58 @@ export const DECLARED = Symbol.for("sanoma.declared");
|
|
|
9
11
|
const importId = z.string().min(1);
|
|
10
12
|
/** What a driver keeps beside a state (an OpenTofu provider's private data and state version), passed back unchanged. */
|
|
11
13
|
const handle = z.string().optional().describe("The driver's data for the object, opaque: pass it back unchanged");
|
|
14
|
+
const record = z.record(z.string(), z.unknown());
|
|
15
|
+
/** What a plan of a change says will happen, as `PlanResponse.Action` names it. */
|
|
16
|
+
export const PLAN_ACTIONS = ["none", "create", "update", "replace", "delete"];
|
|
17
|
+
/** The operations of a writable type that change its objects: only the apply workflow calls them (`isChangeOp`). */
|
|
18
|
+
export const CHANGE_OPS = ["create", "update", "delete"];
|
|
12
19
|
const opsOf = (schema) => {
|
|
13
20
|
// Both answer `{ gone: true }` when the vendor has no such object, and its state when it has.
|
|
14
21
|
const output = z.object({ id: importId, gone: z.boolean(), state: schema.optional(), handle });
|
|
22
|
+
const known = { id: importId, state: record.optional(), handle };
|
|
23
|
+
// The declared fields, a secret marker (`{ $secret }`) at a write-only one: the driver resolves it.
|
|
24
|
+
const desired = record.describe("The declared fields; a write-only one may hold a secret marker");
|
|
25
|
+
const changed = z.object({ id: importId, state: schema, handle });
|
|
26
|
+
const action = z.enum(PLAN_ACTIONS);
|
|
27
|
+
/** Fields as dotted paths, a list item's with its index. */
|
|
28
|
+
const paths = z.array(z.string());
|
|
15
29
|
return {
|
|
16
30
|
import: { input: z.object({ id: importId }), output },
|
|
17
|
-
read: { input: z.object(
|
|
31
|
+
read: { input: z.object(known), output },
|
|
32
|
+
plan: {
|
|
33
|
+
input: z.object({ ...known, id: importId.optional(), desired: desired.optional() }),
|
|
34
|
+
output: z.object({
|
|
35
|
+
action,
|
|
36
|
+
// The new state, without write-only fields; a value known only after apply is `null`, its path in `unknown`.
|
|
37
|
+
planned: record.optional(),
|
|
38
|
+
unknown: paths,
|
|
39
|
+
replace: paths.describe("The fields whose change replaces the object: not empty exactly when `replace`"),
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
create: { input: z.object({ desired }), output: changed },
|
|
43
|
+
update: {
|
|
44
|
+
input: z.object({ ...known, desired, expect: z.object({ action, replace: paths }).optional() }),
|
|
45
|
+
output: changed,
|
|
46
|
+
},
|
|
47
|
+
delete: { input: z.object(known), output: z.object({ id: importId, gone: z.literal(true) }) },
|
|
18
48
|
};
|
|
19
49
|
};
|
|
20
50
|
/** What the ledger keeps of a resource operation's `handle`: its name, never its bytes. */
|
|
21
51
|
const opaque = ["handle"];
|
|
22
|
-
/** The policy's `target` for a resource's operations: the
|
|
52
|
+
/** The policy's `target` for a resource's operations: the id, an identity or a binding id. */
|
|
23
53
|
const target = ({ id }) => id;
|
|
54
|
+
/**
|
|
55
|
+
* True for an operation that changes a writable type's objects (`CHANGE_OPS`), which only the
|
|
56
|
+
* apply workflow may call: by its vendor, resource and name, so a copy of a connector is told too.
|
|
57
|
+
*/
|
|
58
|
+
export function isChangeOp(op, types) {
|
|
59
|
+
return (CHANGE_OPS.includes(op.name) && types.get(`${op.vendor}.${op.resource}`)?.writable === true);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* True for an operation of a declared resource type (`read`, `import`, and a writable type's
|
|
63
|
+
* `plan` and change operations), which only drift and apply call: by its vendor and resource.
|
|
64
|
+
*/
|
|
65
|
+
export const isResourceOp = (op, types) => types.has(`${op.vendor}.${op.resource}`);
|
|
24
66
|
/** True for a plain object: not null, not a list. */
|
|
25
67
|
export const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
26
68
|
/** `path.name`, or `name` at the top: a field's dotted path. */
|
|
@@ -106,19 +148,23 @@ function withAccepted(state, desired, accept) {
|
|
|
106
148
|
return state;
|
|
107
149
|
const out = structuredClone(state);
|
|
108
150
|
for (const [path, values] of paths) {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (!isObject(holder) && !Array.isArray(holder))
|
|
113
|
-
continue;
|
|
114
|
-
const at = holder;
|
|
115
|
-
if (values.includes(at[last]))
|
|
116
|
-
at[last] = valueAt(desired, path);
|
|
151
|
+
const at = holderOf(out, path);
|
|
152
|
+
if (at && values.includes(at.holder[at.key]))
|
|
153
|
+
at.holder[at.key] = valueAt(desired, path);
|
|
117
154
|
}
|
|
118
155
|
return out;
|
|
119
156
|
}
|
|
157
|
+
/** The object or list holding the value at a dotted path (a list item's by its index), and its key there. */
|
|
158
|
+
export function holderOf(value, path) {
|
|
159
|
+
const keys = path.split(".");
|
|
160
|
+
const key = keys.pop();
|
|
161
|
+
const holder = keys.reduce((v, k) => (isObject(v) || Array.isArray(v) ? v[k] : undefined), value);
|
|
162
|
+
return isObject(holder) || Array.isArray(holder) ? { holder: holder, key } : undefined;
|
|
163
|
+
}
|
|
164
|
+
/** A field's dotted path as `fields` names it, without a list item's index: `teams.0` is `teams`. */
|
|
165
|
+
export const fieldPathOf = (at) => at.replaceAll(/\.\d+(?=\.|$)/g, "");
|
|
120
166
|
/** The value at a dotted path, a list item's by its index. */
|
|
121
|
-
const valueAt = (value, path) => path.split(".").reduce((v, key) => (isObject(v) || Array.isArray(v) ? v[key] : undefined), value);
|
|
167
|
+
export const valueAt = (value, path) => path.split(".").reduce((v, key) => (isObject(v) || Array.isArray(v) ? v[key] : undefined), value);
|
|
122
168
|
/** True when the two are the same JSON, where a missing value is `null`. */
|
|
123
169
|
function same(a, b) {
|
|
124
170
|
if (a === b || (a == null && b == null))
|
|
@@ -142,9 +188,20 @@ function changes(desired, actual, unordered, path = "", at = "") {
|
|
|
142
188
|
}
|
|
143
189
|
return same(desired, actual) ? [] : [{ path: at, desired: desired ?? null, actual: actual ?? null }];
|
|
144
190
|
}
|
|
191
|
+
/** The secret markers in a write-only value, in its place: the value itself, or a map of them (none: `[]`). */
|
|
192
|
+
function markers(value) {
|
|
193
|
+
if (isSecret(value))
|
|
194
|
+
return [value];
|
|
195
|
+
if (!isObject(value))
|
|
196
|
+
return [];
|
|
197
|
+
const kept = Object.entries(value).flatMap(([name, v]) => markers(v).map((m) => [name, m]));
|
|
198
|
+
return kept.length ? [Object.fromEntries(kept)] : [];
|
|
199
|
+
}
|
|
145
200
|
/**
|
|
146
|
-
* `desired` without the fields the type marks write-only (a webhook's `secret`):
|
|
147
|
-
* record of a declaration. A list's items lose them too.
|
|
201
|
+
* `desired` without the values at the fields the type marks write-only (a webhook's `secret`):
|
|
202
|
+
* what a run may record of a declaration. A list's items lose them too. A secret marker
|
|
203
|
+
* (`secret("NAME")`) stays, there or inside a write-only map (a host's `secrets`): it names a
|
|
204
|
+
* stored secret and holds none, and the driver resolves it.
|
|
148
205
|
*/
|
|
149
206
|
export function withoutWriteOnly(fields, desired) {
|
|
150
207
|
if (!fields.writeOnly.length)
|
|
@@ -157,11 +214,13 @@ export function withoutWriteOnly(fields, desired) {
|
|
|
157
214
|
return value;
|
|
158
215
|
return Object.fromEntries(Object.entries(value).flatMap(([name, v]) => {
|
|
159
216
|
const at = joinPath(path, name);
|
|
160
|
-
return drop.has(at) ? [] : [[name, strip(v, at)]];
|
|
217
|
+
return drop.has(at) ? markers(v).map((m) => [name, m]) : [[name, strip(v, at)]];
|
|
161
218
|
}));
|
|
162
219
|
};
|
|
163
220
|
return strip(desired, "");
|
|
164
221
|
}
|
|
222
|
+
/** True when `path` is one of `paths`, or a field inside one: a secret's map (`secrets.KEY`) is as write-only as the map. */
|
|
223
|
+
const underAny = (path, paths) => path.split(".").some((_, i, keys) => paths.has(keys.slice(0, i + 1).join(".")));
|
|
165
224
|
/** The dotted paths in `value` that `paths` holds, looking into objects and lists' items. */
|
|
166
225
|
function pathsIn(value, paths, prefix = "") {
|
|
167
226
|
if (Array.isArray(value))
|
|
@@ -180,13 +239,31 @@ function pathsIn(value, paths, prefix = "") {
|
|
|
180
239
|
* derives its operations, `<vendor>.<type>.read` and `<vendor>.<type>.import`, both effect
|
|
181
240
|
* `read` and idempotent, with the import id as the policy's `target`:
|
|
182
241
|
*
|
|
183
|
-
* - `import` takes `{ id }`,
|
|
242
|
+
* - `import` takes `{ id }`, an identity (what `find` makes) or a binding id (what `bindingId`
|
|
243
|
+
* makes), and returns `{ gone: false, state }`, the object's
|
|
184
244
|
* state (with the driver's opaque `handle` when it keeps one), or `{ gone: true }` when the
|
|
185
245
|
* vendor has no such object.
|
|
186
246
|
* - `read` takes `{ id, state?, handle? }`, a state from an earlier `import` or `read`, and
|
|
187
247
|
* returns the same: `{ gone: true }` when the object no longer exists, else its fresh
|
|
188
248
|
* `state`. A driver may import first when it is given no state.
|
|
189
249
|
*
|
|
250
|
+
* A `writable` type has the change operations too, which only the apply workflow may call
|
|
251
|
+
* (`isChangeOp`): `create`, `update` and `delete` effect `write` (`delete` idempotent), and `plan`:
|
|
252
|
+
*
|
|
253
|
+
* - `plan` (`read`, idempotent) takes `{ id?, state?, handle?, desired? }`, no `desired` for a
|
|
254
|
+
* delete and no `id` for a create, and returns `{ action, planned?, unknown, replace }`:
|
|
255
|
+
* what apply would do, the new state without write-only fields, the paths known only after
|
|
256
|
+
* apply, and those whose change replaces the object.
|
|
257
|
+
* - `create` (`target` `new:<vendor>.<type>`) takes `{ desired }` and returns `{ id, state,
|
|
258
|
+
* handle? }`, `id` its binding id.
|
|
259
|
+
* - `update` takes `{ id, state?, handle?, desired, expect? }` and returns the same; given
|
|
260
|
+
* `expect` (a plan's `action` and `replace`), it refuses a fresh plan that differs
|
|
261
|
+
* (`DriverError`, `vendorCode` `plan_changed`).
|
|
262
|
+
* - `delete` takes `{ id, state?, handle? }` and returns `{ id, gone: true }`.
|
|
263
|
+
*
|
|
264
|
+
* `desired` may hold secret markers at write-only fields, which the driver resolves; no output
|
|
265
|
+
* holds a write-only value.
|
|
266
|
+
*
|
|
190
267
|
* The ledger records a `handle` as `"<handle>"`, never its bytes (the operations' `opaque`).
|
|
191
268
|
*
|
|
192
269
|
* Calling the result declares one resource, for a data file: `repository({ name: "sanoma" })`
|
|
@@ -194,17 +271,59 @@ function pathsIn(value, paths, prefix = "") {
|
|
|
194
271
|
* schema does not have, fields the vendor owns (unless the identity names them), values the
|
|
195
272
|
* schema rejects, and an empty identity. Where `fields.references` allows it, a field may name
|
|
196
273
|
* another declared resource of that type (`repository_id: site`): `desired` holds, and the
|
|
197
|
-
* schema and `find` read, that resource's `name`, and `refs` says where it was named.
|
|
274
|
+
* schema and `find` read, that resource's `name`, and `refs` says where it was named. A type
|
|
275
|
+
* without `find` declares resources without a `name`, found only by their bindings.
|
|
198
276
|
*/
|
|
199
277
|
export function defineResource(spec) {
|
|
200
|
-
const { vendor, type, schema, fields, find } = spec;
|
|
278
|
+
const { vendor, type, schema, fields, find, identity, host } = spec;
|
|
279
|
+
const writable = (spec.writable ?? false);
|
|
201
280
|
const what = `${vendor}.${type}`;
|
|
281
|
+
if (host)
|
|
282
|
+
checkHost(what, host, spec);
|
|
283
|
+
if (spec.vendorless && (writable || host))
|
|
284
|
+
throw new Error(`${what}: a vendorless type has no object to change or host`);
|
|
285
|
+
const title = spec.title.toLowerCase();
|
|
202
286
|
const io = opsOf(schema);
|
|
203
|
-
|
|
287
|
+
// The policy's `target` for a create: the type, as no object has an id yet.
|
|
288
|
+
const created = `new:${what}`;
|
|
289
|
+
const changeOps = {
|
|
290
|
+
plan: {
|
|
291
|
+
effect: "read",
|
|
292
|
+
idempotent: true,
|
|
293
|
+
description: `Plan how apply would make a ${title} match its declaration (or delete it, given none); nothing changes`,
|
|
294
|
+
...io.plan,
|
|
295
|
+
target: ({ id }) => id ?? created,
|
|
296
|
+
opaque,
|
|
297
|
+
},
|
|
298
|
+
create: {
|
|
299
|
+
effect: "write",
|
|
300
|
+
description: `Create a ${title} as declared`,
|
|
301
|
+
...io.create,
|
|
302
|
+
target: () => created,
|
|
303
|
+
opaque,
|
|
304
|
+
},
|
|
305
|
+
update: {
|
|
306
|
+
effect: "write",
|
|
307
|
+
description: `Change a ${title} to match its declaration, replacing it where a field cannot change in place`,
|
|
308
|
+
...io.update,
|
|
309
|
+
target,
|
|
310
|
+
opaque,
|
|
311
|
+
},
|
|
312
|
+
delete: {
|
|
313
|
+
effect: "write",
|
|
314
|
+
// A retry reads first, and finds the object gone.
|
|
315
|
+
idempotent: true,
|
|
316
|
+
description: `Delete a ${title}; done already when it is gone`,
|
|
317
|
+
...io.delete,
|
|
318
|
+
target,
|
|
319
|
+
opaque,
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
const base = {
|
|
204
323
|
import: {
|
|
205
324
|
effect: "read",
|
|
206
325
|
idempotent: true,
|
|
207
|
-
description: `Find a ${
|
|
326
|
+
description: `Find a ${title} by its ${identity ? `${identity} or its ` : ""}binding id and read it; gone when there is none`,
|
|
208
327
|
...io.import,
|
|
209
328
|
target,
|
|
210
329
|
opaque,
|
|
@@ -212,27 +331,44 @@ export function defineResource(spec) {
|
|
|
212
331
|
read: {
|
|
213
332
|
effect: "read",
|
|
214
333
|
idempotent: true,
|
|
215
|
-
description: `Read a ${
|
|
334
|
+
description: `Read a ${title} as it is now; gone when it no longer exists`,
|
|
216
335
|
...io.read,
|
|
217
336
|
target,
|
|
218
337
|
opaque,
|
|
219
338
|
},
|
|
220
339
|
};
|
|
221
|
-
const
|
|
340
|
+
const ops = (spec.vendorless ? {} : writable ? { ...base, ...changeOps } : base);
|
|
341
|
+
const named = new Set(identity?.match(/[A-Za-z_][\w.]*/g));
|
|
222
342
|
const owned = new Set(fields.vendorOwned.filter((path) => !named.has(path)));
|
|
223
343
|
const references = fields.references ?? {};
|
|
344
|
+
const writeOnly = new Set(fields.writeOnly);
|
|
224
345
|
const declare = (given) => {
|
|
225
346
|
const refs = {};
|
|
347
|
+
// Where a secret is given, with list items' indexes: the schema does not judge its marker.
|
|
348
|
+
const secrets = new Set();
|
|
226
349
|
// Each resource `given` names, where `references` allows one of its type, replaced by its name.
|
|
227
350
|
// `path` is the field's, as `references` names it; `at` has list items' indexes too.
|
|
228
351
|
const resolve = (value, path, at) => {
|
|
352
|
+
if (isSecret(value)) {
|
|
353
|
+
if (!underAny(path, writeOnly)) {
|
|
354
|
+
throw new Error(`${what}: ${at} is not write-only, so it takes a value, not a secret (${value.$secret})`);
|
|
355
|
+
}
|
|
356
|
+
if (isSanomaSecret(value.$secret) && !(host && underAny(path, new Set([host.inputs.secrets])))) {
|
|
357
|
+
throw new Error(`${what}: ${at} names ${value.$secret}, one of sanoma's own: only a host's secrets may`);
|
|
358
|
+
}
|
|
359
|
+
secrets.add(at);
|
|
360
|
+
return value;
|
|
361
|
+
}
|
|
229
362
|
if (isDeclared(value)) {
|
|
230
363
|
const id = value[DECLARED];
|
|
231
364
|
const wants = references[path];
|
|
232
365
|
if (wants === undefined)
|
|
233
366
|
throw new Error(`${what}: ${at} takes a value, not a resource (${id} ${value.name})`);
|
|
234
|
-
|
|
235
|
-
|
|
367
|
+
const types = [wants.type].flat();
|
|
368
|
+
if (!types.includes(id))
|
|
369
|
+
throw new Error(`${what}: ${at} names a resource of type ${types.join(" or ")}, not ${id} (${value.name})`);
|
|
370
|
+
if (value.name === undefined)
|
|
371
|
+
throw new Error(`${what}: ${at} names a ${id}, which has no identity to name it by`);
|
|
236
372
|
refs[at] = `${id}:${value.name}`;
|
|
237
373
|
return value.name;
|
|
238
374
|
}
|
|
@@ -246,27 +382,45 @@ export function defineResource(spec) {
|
|
|
246
382
|
const unknown = Object.keys(desired ?? {}).filter((name) => !Object.hasOwn(schema.shape, name));
|
|
247
383
|
if (unknown.length)
|
|
248
384
|
throw new Error(`${what}: no field ${unknown.join(", ")}`);
|
|
385
|
+
// Apply fills a host's revision from its ref: the file names a branch, never a commit.
|
|
386
|
+
if (host && pathsIn(desired, new Set([host.revision])).length) {
|
|
387
|
+
throw new Error(`${what}: leave out ${host.revision}: apply sets it from ${host.inputs.ref}`);
|
|
388
|
+
}
|
|
249
389
|
const vendors = pathsIn(desired, owned);
|
|
250
390
|
if (vendors.length) {
|
|
251
391
|
throw new Error(`${what}: leave out ${vendors.join(", ")}: the vendor sets ${vendors.length > 1 ? "them" : "it"}`);
|
|
252
392
|
}
|
|
253
393
|
const parsed = schema.safeParse(desired);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
394
|
+
const issues = parsed.error?.issues.filter((issue) => !secrets.has(issue.path.join(".")));
|
|
395
|
+
if (issues?.length)
|
|
396
|
+
throw new Error(`${what}: ${z.prettifyError(new z.ZodError(issues))}`);
|
|
397
|
+
const name = find?.(desired);
|
|
398
|
+
if (find && (typeof name !== "string" || name === ""))
|
|
399
|
+
throw new Error(`${what}: its ${identity} is missing`);
|
|
400
|
+
return Object.freeze({
|
|
401
|
+
[DECLARED]: what,
|
|
402
|
+
vendor,
|
|
403
|
+
type,
|
|
404
|
+
...(name !== undefined && { name }),
|
|
405
|
+
desired,
|
|
406
|
+
refs: Object.freeze(refs),
|
|
407
|
+
});
|
|
260
408
|
};
|
|
261
409
|
const resource = Object.assign(declare, {
|
|
262
410
|
vendor,
|
|
263
411
|
type,
|
|
264
412
|
title: spec.title,
|
|
265
|
-
identity
|
|
413
|
+
identity,
|
|
266
414
|
schema,
|
|
267
415
|
fields,
|
|
268
416
|
find,
|
|
417
|
+
bindingId: spec.bindingId ?? ((state) => String(state.id)),
|
|
269
418
|
normalize: spec.normalize ?? ((state, desired) => compareDeclared(fields, state, desired)),
|
|
419
|
+
writable,
|
|
420
|
+
...(host && { host }),
|
|
421
|
+
stateless: spec.stateless ?? host !== undefined,
|
|
422
|
+
vendorless: spec.vendorless ?? false,
|
|
423
|
+
...(spec.afterCreate && { afterCreate: spec.afterCreate }),
|
|
270
424
|
ops,
|
|
271
425
|
// A symbol, so `defineConnector` tells a resource type from a group of operations.
|
|
272
426
|
[RESOURCE]: true,
|
package/dist/resource.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.js","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA+B,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAgExE;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAkB,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAyCrE,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACnC,yHAAyH;AACzH,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kEAAkE,CAAC,CAAC;AAElH,MAAM,KAAK,GAAG,CAAwB,MAAS,EAAE,EAAE;IACjD,8FAA8F;IAC9F,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/F,OAAO;QACL,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE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G,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1D,GAAG;QACH,mFAAmF;QACnF,CAAC,QAAQ,CAAC,EAAE,IAAa;KAC1B,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,eAAe,CAAC,UAA0C;IACxE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC1C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,KAAK,MAAM,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,SAAgC;YAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5G,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/resources.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Binding, type Bindings } from "./lockfile.ts";
|
|
2
2
|
import { type Connector } from "./op.ts";
|
|
3
3
|
import type { Span } from "./outline.ts";
|
|
4
4
|
import { type Resource } from "./resource.ts";
|
|
5
|
+
import { Principal } from "./define.ts";
|
|
6
|
+
import { type PeopleResource } from "./shared.ts";
|
|
5
7
|
/** A resource a data file declares, as read from the file without running it. */
|
|
6
8
|
export interface DeclaredResource {
|
|
7
9
|
/** `<file>#<export>`, the file relative to the config's root, with `/`: `resources/identity/github.ts#website`. */
|
|
@@ -10,8 +12,12 @@ export interface DeclaredResource {
|
|
|
10
12
|
file: string;
|
|
11
13
|
vendor: string;
|
|
12
14
|
type: string;
|
|
13
|
-
/**
|
|
15
|
+
/** What people call it: its identity, else its export's name. */
|
|
14
16
|
name: string;
|
|
17
|
+
/** The import id that finds it unbound: what its type's `find` makes of its fields; absent when the type has none. */
|
|
18
|
+
identity?: string;
|
|
19
|
+
/** The vendor's id of the object the lockfile binds it to (`LOCKFILE`); absent when unbound. */
|
|
20
|
+
binding?: string;
|
|
15
21
|
/** Its `export const` statement, as UTF-16 offsets into the file's text. */
|
|
16
22
|
span: Span;
|
|
17
23
|
/** Its fields, as its type checked them: each resource it names as that resource's `name`. */
|
|
@@ -22,6 +28,21 @@ export interface DeclaredResource {
|
|
|
22
28
|
*/
|
|
23
29
|
refs: Record<string, string>;
|
|
24
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* A collection `resources/data.ts` declares, as read without running it: where it is, for the
|
|
33
|
+
* Resources page. Its fields are the collection's own (`describeConfig`'s `collections`), from
|
|
34
|
+
* the same file, which the runtime imports.
|
|
35
|
+
*/
|
|
36
|
+
export interface DeclaredCollection {
|
|
37
|
+
/** `<file>#<export>`, as a resource's: `resources/data.ts#outbound`. */
|
|
38
|
+
id: string;
|
|
39
|
+
/** `resources/data.ts`. */
|
|
40
|
+
file: string;
|
|
41
|
+
/** The collection's name, its operations' middle segment (`data.<name>.get`). */
|
|
42
|
+
name: string;
|
|
43
|
+
/** Its `export const` statement, as UTF-16 offsets into the file's text. */
|
|
44
|
+
span: Span;
|
|
45
|
+
}
|
|
25
46
|
/** Something wrong in the data files, or in finding them. */
|
|
26
47
|
export interface ResourceProblem {
|
|
27
48
|
/**
|
|
@@ -35,19 +56,55 @@ export interface ResourceProblem {
|
|
|
35
56
|
column?: number;
|
|
36
57
|
message: string;
|
|
37
58
|
}
|
|
38
|
-
/** What the data files declare: each resource read without problems, and the problems. */
|
|
59
|
+
/** What the data files declare: each resource read without problems, the lockfile's bindings, and the problems. */
|
|
39
60
|
export interface DataFiles {
|
|
40
61
|
/** By file and then in file order, less any with a problem, and any that names one. */
|
|
41
62
|
resources: DeclaredResource[];
|
|
63
|
+
/** The lockfile's bindings, by key (`<file>#<export>`), as read: none when it is missing or has a problem. */
|
|
64
|
+
bindings: Bindings;
|
|
65
|
+
/** Each binding whose key no data file declares, by key. */
|
|
66
|
+
orphans: (Binding & {
|
|
67
|
+
key: string;
|
|
68
|
+
})[];
|
|
69
|
+
/** The collections `resources/data.ts` declares, in file order. */
|
|
70
|
+
collections: DeclaredCollection[];
|
|
42
71
|
/** By file, line and column. */
|
|
43
72
|
problems: ResourceProblem[];
|
|
44
73
|
}
|
|
74
|
+
/** What the data files declare of the people: the resources `principalOf` takes, and what is wrong in their files. */
|
|
75
|
+
export interface DeclaredPeople {
|
|
76
|
+
people: DeclaredResource[];
|
|
77
|
+
/**
|
|
78
|
+
* The problems in each file that declares (or tries to declare) a person, agent or group, and
|
|
79
|
+
* an id two of them share or one of the runtime's own agents (`RUNTIME_AGENTS`) takes. While
|
|
80
|
+
* there are any, nobody is admitted: a broken file never admits more than it says.
|
|
81
|
+
*/
|
|
82
|
+
problems: ResourceProblem[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The people, agents and groups the data files under `root` declare (`sanoma.person`, `.agent`,
|
|
86
|
+
* `.group`), read without running them, as `principalOf` takes them, with what is wrong in their
|
|
87
|
+
* files; none without a root. Read again only when a data file changed (by its size and time),
|
|
88
|
+
* so a new colleague is admitted once their file is saved, and a request costs a `stat` per file.
|
|
89
|
+
*/
|
|
90
|
+
export declare function readPeople(root: string | undefined): DeclaredPeople;
|
|
45
91
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* `
|
|
92
|
+
* Who `asking` is admitted as, by the people the data files declare (`readPeople`): the declared
|
|
93
|
+
* principal (`principalOf`) of the id it names, a person's or an agent's; for a sign-in
|
|
94
|
+
* (`signIn`), of the person it matches (`personOf`: email, GitHub login, then id), never an agent.
|
|
95
|
+
* While no person is declared, whoever names an id is taken as given. Throws `NotAdmittedError`
|
|
96
|
+
* for anyone else, and for everyone while the people's files have problems.
|
|
49
97
|
*/
|
|
50
|
-
export declare function
|
|
98
|
+
export declare function admit(asking: {
|
|
99
|
+
id?: string;
|
|
100
|
+
email?: string;
|
|
101
|
+
github?: string;
|
|
102
|
+
groups?: string[];
|
|
103
|
+
onBehalfOf?: string;
|
|
104
|
+
}, { people, problems }: {
|
|
105
|
+
people: readonly PeopleResource[];
|
|
106
|
+
problems: readonly ResourceProblem[];
|
|
107
|
+
}, signIn?: boolean): Principal;
|
|
51
108
|
/**
|
|
52
109
|
* Reads `resources/` under `root`, the config's directory: each `.ts` file in it but
|
|
53
110
|
* `*.test.ts`, `*.d.ts` and `node_modules`, parsed with oxc and held to the data-file subset
|
|
@@ -57,6 +114,16 @@ export declare function readResources(config: SanomaConfig): DeclaredResource[];
|
|
|
57
114
|
*
|
|
58
115
|
* Problems: anything outside the subset, a constructor or data file the config does not know, a
|
|
59
116
|
* type the connector does not declare, a value the type refuses (a reference where its type
|
|
60
|
-
* takes none among them), a reference cycle, and two resources of one type with one
|
|
117
|
+
* takes none among them), a reference cycle, and two resources of one type with one identity.
|
|
118
|
+
*
|
|
119
|
+
* The collections `resources/data.ts` declares are listed as they are read (`collections`),
|
|
120
|
+
* never matched to a connector, a resource type or the lockfile: the runtime imports that file.
|
|
121
|
+
*
|
|
122
|
+
* Each declaration is joined to its binding in the lockfile (`readLockfile`) by its key,
|
|
123
|
+
* `<file>#<export>`; a binding no export declares is an orphan. Problems: the lockfile's, a
|
|
124
|
+
* binding of another type than its declaration's, and two declarations bound to one object.
|
|
125
|
+
*
|
|
126
|
+
* `partial` reads part of the files: only those whose source it passes, and in them, an import of
|
|
127
|
+
* a connector not in `connectors`, or of a file left out, is left unread rather than reported.
|
|
61
128
|
*/
|
|
62
|
-
export declare function readDataFiles(root: string | undefined, connectors: readonly Connector<any, any>[], types?: ReadonlyMap<string, Resource
|
|
129
|
+
export declare function readDataFiles(root: string | undefined, connectors: readonly Connector<any, any>[], types?: ReadonlyMap<string, Resource>, partial?: (source: string) => boolean): DataFiles;
|