@substrat-run/contracts 0.71.0 → 0.73.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/dist/connections.d.ts +44 -0
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +43 -0
- package/dist/connections.js.map +1 -1
- package/dist/model.d.ts +16 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js.map +1 -1
- package/dist/openapi.d.ts +37 -0
- package/dist/openapi.d.ts.map +1 -1
- package/dist/openapi.js +56 -2
- package/dist/openapi.js.map +1 -1
- package/dist/operations.d.ts +163 -3
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +108 -1
- package/dist/operations.js.map +1 -1
- package/package.json +6 -5
package/dist/connections.d.ts
CHANGED
|
@@ -224,4 +224,48 @@ export declare const connectionCredential: z.ZodObject<{
|
|
|
224
224
|
}, z.core.$strip>>;
|
|
225
225
|
}, z.core.$strip>;
|
|
226
226
|
export type ConnectionCredential = z.infer<typeof connectionCredential>;
|
|
227
|
+
/**
|
|
228
|
+
* A cell sealed to a recipient's public key (#687) — the shape a
|
|
229
|
+
* `SealedSecret` takes when it travels as DATA rather than as a kernel type.
|
|
230
|
+
*
|
|
231
|
+
* Structurally identical to the kernel's `SealedSecret`, and declared here for
|
|
232
|
+
* the reason every other travelling shape is: an engine and a connector both
|
|
233
|
+
* have to parse it at their own boundary ("parse, don't trust"), and neither may
|
|
234
|
+
* depend on the other. `ciphertext` is opaque to everything but the holder of
|
|
235
|
+
* the named private half — the console, the timeline and every future consumer
|
|
236
|
+
* of a payload carrying one read it as bytes and nothing more.
|
|
237
|
+
*
|
|
238
|
+
* `keyId` is not decoration: a cell that cannot name its key can only ever have
|
|
239
|
+
* one key, and rotating retroactively becomes impossible the day a second exists
|
|
240
|
+
* (signature-contact-carrier.md D-4).
|
|
241
|
+
*/
|
|
242
|
+
export declare const sealedCell: z.ZodObject<{
|
|
243
|
+
keyId: z.ZodString;
|
|
244
|
+
ciphertext: z.ZodString;
|
|
245
|
+
}, z.core.$strip>;
|
|
246
|
+
export type SealedCell = z.infer<typeof sealedCell>;
|
|
247
|
+
/**
|
|
248
|
+
* A connection's PUBLIC sealing key as it travels into a deployment (#687) —
|
|
249
|
+
* delivered with provision/reconcile exactly as entitlements (#310), identity
|
|
250
|
+
* links (#406) and connection grants (#592) are, and projected into the scope so
|
|
251
|
+
* module code can seal a value TO the connector before emitting it.
|
|
252
|
+
*
|
|
253
|
+
* **The private half is never here and can never be.** Projecting a secret key
|
|
254
|
+
* into a scope is precisely the failure kernel-design §13.1 names — a key
|
|
255
|
+
* restored by the same dump that restores its ciphertext reverses every erasure
|
|
256
|
+
* the restore rolled past. §2 of the carrier design closes that door; it says
|
|
257
|
+
* nothing about a public key, and that gap is the whole mechanism. Projecting
|
|
258
|
+
* this leaks nothing: it lets a scope WRITE to the connector, never read.
|
|
259
|
+
*
|
|
260
|
+
* Keyed by `provider` as well as `connectionId` because that is what module code
|
|
261
|
+
* knows. An engine emitting `method: 'scrive'` has no connection id and must not
|
|
262
|
+
* acquire one — connection identity is the host's business.
|
|
263
|
+
*/
|
|
264
|
+
export declare const projectedConnectionKey: z.ZodObject<{
|
|
265
|
+
connectionId: z.ZodString;
|
|
266
|
+
provider: z.ZodString;
|
|
267
|
+
keyId: z.ZodString;
|
|
268
|
+
publicKey: z.ZodString;
|
|
269
|
+
}, z.core.$strip>;
|
|
270
|
+
export type ProjectedConnectionKey = z.infer<typeof projectedConnectionKey>;
|
|
227
271
|
//# sourceMappingURL=connections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,YAAY,wDAAiD,CAAC;AAC3E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEx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AC,OAAO,uBAAuB,CAAC,CAAC;AAE9E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB;;;EAAiC,CAAC;AACvE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEhF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;iBAU7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,yBAAyB;;;;;iBAOpC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF,eAAO,MAAM,oBAAoB;;;;;;;iBAAmE,CAAC;AACrG,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,UAAU;;;iBAGrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB;;;;;iBAMjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
package/dist/connections.js
CHANGED
|
@@ -241,4 +241,47 @@ export const connectionCredentialField = z.object({
|
|
|
241
241
|
masked: z.boolean(),
|
|
242
242
|
});
|
|
243
243
|
export const connectionCredential = z.object({ fields: z.array(connectionCredentialField).max(16) });
|
|
244
|
+
/**
|
|
245
|
+
* A cell sealed to a recipient's public key (#687) — the shape a
|
|
246
|
+
* `SealedSecret` takes when it travels as DATA rather than as a kernel type.
|
|
247
|
+
*
|
|
248
|
+
* Structurally identical to the kernel's `SealedSecret`, and declared here for
|
|
249
|
+
* the reason every other travelling shape is: an engine and a connector both
|
|
250
|
+
* have to parse it at their own boundary ("parse, don't trust"), and neither may
|
|
251
|
+
* depend on the other. `ciphertext` is opaque to everything but the holder of
|
|
252
|
+
* the named private half — the console, the timeline and every future consumer
|
|
253
|
+
* of a payload carrying one read it as bytes and nothing more.
|
|
254
|
+
*
|
|
255
|
+
* `keyId` is not decoration: a cell that cannot name its key can only ever have
|
|
256
|
+
* one key, and rotating retroactively becomes impossible the day a second exists
|
|
257
|
+
* (signature-contact-carrier.md D-4).
|
|
258
|
+
*/
|
|
259
|
+
export const sealedCell = z.object({
|
|
260
|
+
keyId: z.string().min(1),
|
|
261
|
+
ciphertext: z.string().min(1),
|
|
262
|
+
});
|
|
263
|
+
/**
|
|
264
|
+
* A connection's PUBLIC sealing key as it travels into a deployment (#687) —
|
|
265
|
+
* delivered with provision/reconcile exactly as entitlements (#310), identity
|
|
266
|
+
* links (#406) and connection grants (#592) are, and projected into the scope so
|
|
267
|
+
* module code can seal a value TO the connector before emitting it.
|
|
268
|
+
*
|
|
269
|
+
* **The private half is never here and can never be.** Projecting a secret key
|
|
270
|
+
* into a scope is precisely the failure kernel-design §13.1 names — a key
|
|
271
|
+
* restored by the same dump that restores its ciphertext reverses every erasure
|
|
272
|
+
* the restore rolled past. §2 of the carrier design closes that door; it says
|
|
273
|
+
* nothing about a public key, and that gap is the whole mechanism. Projecting
|
|
274
|
+
* this leaks nothing: it lets a scope WRITE to the connector, never read.
|
|
275
|
+
*
|
|
276
|
+
* Keyed by `provider` as well as `connectionId` because that is what module code
|
|
277
|
+
* knows. An engine emitting `method: 'scrive'` has no connection id and must not
|
|
278
|
+
* acquire one — connection identity is the host's business.
|
|
279
|
+
*/
|
|
280
|
+
export const projectedConnectionKey = z.object({
|
|
281
|
+
connectionId: z.string().min(1),
|
|
282
|
+
provider: z.string().min(1),
|
|
283
|
+
keyId: z.string().min(1),
|
|
284
|
+
/** SEC1 uncompressed P-256 point, base64. Public by construction. */
|
|
285
|
+
publicKey: z.string().min(1),
|
|
286
|
+
});
|
|
244
287
|
//# sourceMappingURL=connections.js.map
|
package/dist/connections.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connections.js","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;;GAOG;AAEH,MAAM,IAAI,GAAG,0BAA0B,CAAC;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAkB,CAAC;AAG3E,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,KAAK,CAAC,sBAAsB,EAAE,8BAA8B,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC;IACrC,cAAc;IACd,QAAQ;IACR,yEAAyE;IACzE,SAAS;IACT,2EAA2E;IAC3E,SAAS;IACT,6EAA6E;IAC7E,OAAO;CACR,CAAC,CAAC;AAGH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,EAAE,EAAE,YAAY;IAChB,QAAQ;IACR,uEAAuE;IACvE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,QAAQ,EAAE,kBAAkB;IAC5B,2DAA2D;IAC3D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,MAAM,EAAE,gBAAgB;IACxB;;;;OAIG;IACH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C,CAAC,OAAO,EAAE;CACpB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAGrG;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC9B,CAAC,CAAC;AAGH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,qEAAqE;IACrE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC7B,CAAC,CAAC"}
|
package/dist/model.d.ts
CHANGED
|
@@ -48,6 +48,21 @@ export interface EntityDef<Names extends string = string> {
|
|
|
48
48
|
readonly key?: readonly string[];
|
|
49
49
|
/** Fields an erasure must be able to reach (§12). Must name fields that exist. */
|
|
50
50
|
readonly erasable?: readonly string[];
|
|
51
|
+
/**
|
|
52
|
+
* Fields that used to be called something else — `{ current: previous }`.
|
|
53
|
+
*
|
|
54
|
+
* **The one thing a migration diff cannot derive.** A diff sees a field gone
|
|
55
|
+
* and a field arrived and cannot tell a rename from a drop-plus-add; guessing
|
|
56
|
+
* wrong drops the column and the data in it. So this is declared, and it is
|
|
57
|
+
* the ONLY declaration in the journal that is not derived — everything else,
|
|
58
|
+
* including the version number, comes from the diff.
|
|
59
|
+
*
|
|
60
|
+
* **Deletable after use.** It exists to survive one diff, not forever. Once
|
|
61
|
+
* the rename has shipped, the old name is gone from the journal and the entry
|
|
62
|
+
* becomes a no-op that can be removed. A model that accumulates these is
|
|
63
|
+
* carrying gravestones.
|
|
64
|
+
*/
|
|
65
|
+
readonly renamedFrom?: Readonly<Record<string, string>>;
|
|
51
66
|
}
|
|
52
67
|
/** The field names of one entity, read off its own `fields` schema. */
|
|
53
68
|
export type EntityFields<E> = E extends {
|
|
@@ -67,6 +82,7 @@ export declare function defineEntities<T extends {
|
|
|
67
82
|
readonly [K in keyof T]: EntityDef<keyof T & string> & {
|
|
68
83
|
key?: readonly EntityFields<T[K]>[];
|
|
69
84
|
erasable?: readonly EntityFields<T[K]>[];
|
|
85
|
+
renamedFrom?: Readonly<Partial<Record<EntityFields<T[K]>, string>>>;
|
|
70
86
|
};
|
|
71
87
|
}>(entities: T): T;
|
|
72
88
|
/** The declared entity names. */
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,WAAW,SAAS,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM;IACtD,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yFAAyF;IACzF,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IAC5C;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;IACpC,wDAAwD;I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AAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;IAC3F,MAAM,EAAE,MAAM,CAAC,CAAC;CACjB,GACG,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,GAClC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GACV,KAAK,GACP,KAAK,CAAC;AAGV,6EAA6E;AAC7E,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAE5C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,CAGrD"}
|
package/dist/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoDxB;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAiB5B,QAAW;IACX,OAAO,QAAQ,CAAC;AAClB,CAAC;AA8BD;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAsC,QAAW;IACxE,MAAM,GAAG,GAAkC,EAAE,CAAC;IAC9C,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAChD,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,CAAC;YAAE,SAAS;QACjB,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE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AAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;AACP,CAAC;AAuED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,gBAAgB,CAI9B,QAAW,EACX,IAAO;IAOP,OAAO;QACL,iBAAiB,EAAE,CAAC,IAAI,CAAC,iBAAiB,IAAI,EAAE,CAA6C;QAC7F,WAAW,EAAE,IAAI,CAAC,WAA+B;QACjD,+DAA+D;QAC/D,4EAA4E;QAC5E,uEAAuE;QACvE,eAAe,EAAE,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QAC5E,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,WAA+B,EAAE;KAC1D,CAAC;AACJ,CAAC;AAuBD,6EAA6E;AAC7E,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAE5C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACpG,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,GAAG,WAAW,GAAG,OAAO,EAAE,CAAC,CAAC;AAC1D,CAAC"}
|
package/dist/openapi.d.ts
CHANGED
|
@@ -30,6 +30,19 @@ export interface ApiOperationDoc {
|
|
|
30
30
|
inputOptional?: boolean;
|
|
31
31
|
/** The response schema, when the vertical declares one (adopted incrementally). */
|
|
32
32
|
output?: z.ZodType;
|
|
33
|
+
/**
|
|
34
|
+
* Where this operation is actually served, when the model declares it.
|
|
35
|
+
*
|
|
36
|
+
* Absent, the document describes the platform's `/api/op/{name}` invoke
|
|
37
|
+
* convention (api-surface.md §2.2) — which was the only shape available
|
|
38
|
+
* before operations declared `http`. Present, the document describes the REST
|
|
39
|
+
* route the server derives from that same declaration, so the document and
|
|
40
|
+
* the router cannot describe different surfaces.
|
|
41
|
+
*/
|
|
42
|
+
http?: {
|
|
43
|
+
method: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
44
|
+
path: string;
|
|
45
|
+
};
|
|
33
46
|
}
|
|
34
47
|
/** operation name (module-namespaced, e.g. 'hr/create-employee') → its doc. */
|
|
35
48
|
export type ApiCatalog = Record<string, ApiOperationDoc>;
|
|
@@ -45,4 +58,28 @@ export interface ApiDocumentInfo {
|
|
|
45
58
|
* is what lets the checked-in artifact double as a drift check.
|
|
46
59
|
*/
|
|
47
60
|
export declare function buildOpenApiDocument(info: ApiDocumentInfo, catalog: ApiCatalog): Record<string, unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* The API catalog, derived from the declared operations.
|
|
63
|
+
*
|
|
64
|
+
* Every field `ApiOperationDoc` needs — summary, input, output — is already on
|
|
65
|
+
* the operation, declared once and compile-checked there. Writing the catalog by
|
|
66
|
+
* hand is the same duplication as writing the route table by hand, and drifts
|
|
67
|
+
* the same way: Meridian's catalog is 226 lines and Manyfold's 184, all of it
|
|
68
|
+
* restating what the model says.
|
|
69
|
+
*
|
|
70
|
+
* **Why not Hono's OpenAPI support.** It would make the document a function of
|
|
71
|
+
* the route registration rather than of the model, and route registration is
|
|
72
|
+
* itself derived from the model — so the document would be derived from a
|
|
73
|
+
* derivation, one step further from the thing a human approved. It also needs
|
|
74
|
+
* the Zod schemas passed in anyway, which is the part we already have. The
|
|
75
|
+
* usual reason to reach for it is that it gives you validation middleware for
|
|
76
|
+
* free; we do not need that, because `input` IS the schema the handler parses.
|
|
77
|
+
*
|
|
78
|
+
* `tag` and `description` are prose, so they are supplied — the same split as
|
|
79
|
+
* permission descriptions in `manifestOperations`.
|
|
80
|
+
*/
|
|
81
|
+
export declare function apiCatalogFrom(operations: Readonly<Record<string, object>>, prose?: Readonly<Record<string, {
|
|
82
|
+
tag?: string;
|
|
83
|
+
description?: string;
|
|
84
|
+
}>>): ApiCatalog;
|
|
48
85
|
//# sourceMappingURL=openapi.d.ts.map
|
package/dist/openapi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oFAAoF;IACpF,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IAClB,8EAA8E;IAC9E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mFAAmF;IACnF,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oFAAoF;IACpF,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IAClB,8EAA8E;IAC9E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mFAAmF;IACnF,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IACnB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE;QAAE,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACtE;AAED,+EAA+E;AAC/E,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAgBD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,UAAU,GAClB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiEzB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC5C,KAAK,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAM,GAC3E,UAAU,CAwBZ"}
|
package/dist/openapi.js
CHANGED
|
@@ -19,10 +19,23 @@ const jsonSchema = (schema, io) => {
|
|
|
19
19
|
export function buildOpenApiDocument(info, catalog) {
|
|
20
20
|
const paths = {};
|
|
21
21
|
for (const [name, op] of Object.entries(catalog)) {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const url = op.http ? `/api${op.http.path}` : `/api/op/${name}`;
|
|
23
|
+
const verb = op.http ? op.http.method.toLowerCase() : 'post';
|
|
24
|
+
// `{listId}` in the path is a path PARAMETER, and OpenAPI requires it
|
|
25
|
+
// declared or the document is invalid — a renderer will not infer it.
|
|
26
|
+
const params = [...url.matchAll(/\{(\w+)\}/g)].map((m) => ({
|
|
27
|
+
name: m[1],
|
|
28
|
+
in: 'path',
|
|
29
|
+
required: true,
|
|
30
|
+
schema: { type: 'string' },
|
|
31
|
+
}));
|
|
32
|
+
const existing = (paths[url] ?? {});
|
|
33
|
+
paths[url] = {
|
|
34
|
+
...existing,
|
|
35
|
+
[verb]: {
|
|
24
36
|
operationId: name.replace(/[^a-zA-Z0-9]+/g, '-'),
|
|
25
37
|
summary: op.summary,
|
|
38
|
+
...(params.length > 0 ? { parameters: params } : {}),
|
|
26
39
|
...(op.description ? { description: op.description } : {}),
|
|
27
40
|
...(op.tag ? { tags: [op.tag] } : {}),
|
|
28
41
|
...(op.input
|
|
@@ -68,4 +81,45 @@ export function buildOpenApiDocument(info, catalog) {
|
|
|
68
81
|
security: [{ session: [] }, { bearer: [] }],
|
|
69
82
|
};
|
|
70
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* The API catalog, derived from the declared operations.
|
|
86
|
+
*
|
|
87
|
+
* Every field `ApiOperationDoc` needs — summary, input, output — is already on
|
|
88
|
+
* the operation, declared once and compile-checked there. Writing the catalog by
|
|
89
|
+
* hand is the same duplication as writing the route table by hand, and drifts
|
|
90
|
+
* the same way: Meridian's catalog is 226 lines and Manyfold's 184, all of it
|
|
91
|
+
* restating what the model says.
|
|
92
|
+
*
|
|
93
|
+
* **Why not Hono's OpenAPI support.** It would make the document a function of
|
|
94
|
+
* the route registration rather than of the model, and route registration is
|
|
95
|
+
* itself derived from the model — so the document would be derived from a
|
|
96
|
+
* derivation, one step further from the thing a human approved. It also needs
|
|
97
|
+
* the Zod schemas passed in anyway, which is the part we already have. The
|
|
98
|
+
* usual reason to reach for it is that it gives you validation middleware for
|
|
99
|
+
* free; we do not need that, because `input` IS the schema the handler parses.
|
|
100
|
+
*
|
|
101
|
+
* `tag` and `description` are prose, so they are supplied — the same split as
|
|
102
|
+
* permission descriptions in `manifestOperations`.
|
|
103
|
+
*/
|
|
104
|
+
export function apiCatalogFrom(operations, prose = {}) {
|
|
105
|
+
const catalog = {};
|
|
106
|
+
for (const name of Object.keys(operations).sort()) {
|
|
107
|
+
const op = operations[name];
|
|
108
|
+
if (typeof op?.summary !== 'string')
|
|
109
|
+
continue;
|
|
110
|
+
const extra = prose[name] ?? {};
|
|
111
|
+
catalog[name] = {
|
|
112
|
+
summary: op.summary,
|
|
113
|
+
...(extra.tag ? { tag: extra.tag } : {}),
|
|
114
|
+
...(extra.description ? { description: extra.description } : {}),
|
|
115
|
+
...(op.input ? { input: op.input } : {}),
|
|
116
|
+
...(op.inputOptional ? { inputOptional: true } : {}),
|
|
117
|
+
...(op.output ? { output: op.output } : {}),
|
|
118
|
+
...(op.http
|
|
119
|
+
? { http: op.http }
|
|
120
|
+
: {}),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return catalog;
|
|
124
|
+
}
|
|
71
125
|
//# sourceMappingURL=openapi.js.map
|
package/dist/openapi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwDxB,MAAM,eAAe,GAAG;IACtB,KAAK,EAAE,EAAE,WAAW,EAAE,2EAA2E,EAAE;IACnG,KAAK,EAAE,EAAE,WAAW,EAAE,yDAAyD,EAAE;IACjF,KAAK,EAAE,EAAE,WAAW,EAAE,4EAA4E,EAAE;IACpG,KAAK,EAAE,EAAE,WAAW,EAAE,oEAAoE,EAAE;CACpF,CAAC;AAEX,+EAA+E;AAC/E,yEAAyE;AACzE,MAAM,UAAU,GAAG,CAAC,MAAiB,EAAE,EAAsB,EAAE,EAAE;IAC/D,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IACxF,OAAO,IAAI,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EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,GAAG,CAAE,EAAyC,CAAC,IAAI;gBACjD,CAAC,CAAC,EAAE,IAAI,EAAG,EAAqD,CAAC,IAAI,EAAE;gBACvE,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/operations.d.ts
CHANGED
|
@@ -78,15 +78,72 @@ type PiiShape<O, OutKeys extends string> = O extends {
|
|
|
78
78
|
* per-row proof walk: a salesperson listing their own customers must get their
|
|
79
79
|
* list, not a denial.
|
|
80
80
|
*/
|
|
81
|
-
|
|
81
|
+
/**
|
|
82
|
+
* What a leading `permission` actually checks — the node, or one entity.
|
|
83
|
+
*
|
|
84
|
+
* A bare key was ambiguous, and ambiguous in the direction that fails OPEN.
|
|
85
|
+
* These two read identically in the model and behave completely differently:
|
|
86
|
+
*
|
|
87
|
+
* ```ts
|
|
88
|
+
* 'todo/create-list': { permission: 'list:create', … } // checked at the scope
|
|
89
|
+
* 'todo/rename-list': { permission: 'list:manage', … } // checked on ONE list
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* Only the handler decided which, via `ctx.check(perm)` versus
|
|
93
|
+
* `ctx.check(perm, entityRef)`. Get it wrong in the second case and the
|
|
94
|
+
* operation passes for anyone holding the key anywhere in the scope — in a
|
|
95
|
+
* sharing app, any member editing any record — with every test still green,
|
|
96
|
+
* because a seed that grants nothing scope-wide is the only thing that would
|
|
97
|
+
* have caught it.
|
|
98
|
+
*
|
|
99
|
+
* So an entity-narrowed check says so, and says what it narrows to:
|
|
100
|
+
*
|
|
101
|
+
* ```ts
|
|
102
|
+
* permission: { key: 'list:manage', entity: 'list', idFrom: 'listId' }
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* `idFrom` names the input field carrying the entity's id, so the check is
|
|
106
|
+
* derivable. When the id is not in the input — `set-item-done` takes an item and
|
|
107
|
+
* checks the LIST it sits on — say `resolved` instead with the reason. That
|
|
108
|
+
* still records the thing that matters (this is not a node check) while being
|
|
109
|
+
* honest that the handler has to find the entity itself.
|
|
110
|
+
*/
|
|
111
|
+
type PermissionCheck<O, Entities, Engines, PermKey extends string> = {
|
|
112
|
+
readonly key: PermKey;
|
|
113
|
+
/** The entity type the check narrows to — this module's, or a composed engine's. */
|
|
114
|
+
readonly entity: (keyof Entities & string) | (Engines extends readonly (infer R)[] ? (R extends Record<string, EntityDef> ? keyof R & string : never) : never);
|
|
115
|
+
} & ({
|
|
116
|
+
readonly idFrom: InputKeys<O>;
|
|
117
|
+
readonly resolved?: never;
|
|
118
|
+
} | {
|
|
119
|
+
readonly resolved: string;
|
|
120
|
+
readonly idFrom?: never;
|
|
121
|
+
});
|
|
122
|
+
type OpAuthority<O, Entities, Engines, PermKey extends string> = O extends {
|
|
82
123
|
narrows: unknown;
|
|
83
124
|
} ? {
|
|
84
125
|
readonly narrows: {
|
|
85
126
|
readonly reason: string;
|
|
127
|
+
/**
|
|
128
|
+
* THIS module's permission keys the walk evaluates per entity.
|
|
129
|
+
*
|
|
130
|
+
* Required, and empty is a legitimate answer — the point is that it is
|
|
131
|
+
* stated. Without it a key reached only by a proof walk contributes
|
|
132
|
+
* nothing to the derived permission list and vanishes from the review
|
|
133
|
+
* artifact, which is the one place a widened permission is supposed to
|
|
134
|
+
* be impossible to miss.
|
|
135
|
+
*
|
|
136
|
+
* A walk may also check a COMPOSED ENGINE's key (Callout's portal walk
|
|
137
|
+
* checks `workorder:read`). Those are deliberately not listed: the
|
|
138
|
+
* engine's own manifest declares them, and a vertical restating another
|
|
139
|
+
* module's permissions is the same two-descriptions defect this exists
|
|
140
|
+
* to prevent.
|
|
141
|
+
*/
|
|
142
|
+
readonly checks: readonly PermKey[];
|
|
86
143
|
};
|
|
87
144
|
readonly permission?: never;
|
|
88
145
|
} : {
|
|
89
|
-
readonly permission: PermKey
|
|
146
|
+
readonly permission: PermKey | PermissionCheck<O, Entities, Engines, PermKey>;
|
|
90
147
|
readonly narrows?: never;
|
|
91
148
|
};
|
|
92
149
|
/**
|
|
@@ -167,7 +224,7 @@ type OperationShape<O, Entities, Engines, PermKey extends string> = {
|
|
|
167
224
|
readonly gates?: {
|
|
168
225
|
readonly [F in OutputKeys<O>]?: PermKey;
|
|
169
226
|
};
|
|
170
|
-
} & OpAuthority<O, PermKey>;
|
|
227
|
+
} & OpAuthority<O, Entities, Engines, PermKey>;
|
|
171
228
|
/**
|
|
172
229
|
* Declare a module's operations against its entities and permission keys.
|
|
173
230
|
*
|
|
@@ -233,5 +290,108 @@ type ImplInput<O> = O extends {
|
|
|
233
290
|
} ? I extends z.ZodType ? O extends {
|
|
234
291
|
inputOptional: true;
|
|
235
292
|
} ? z.infer<I> | undefined : z.infer<I> : undefined : undefined;
|
|
293
|
+
/** Every permission key some operation declares, as a type. */
|
|
294
|
+
export type PermissionsDeclaredBy<Ops> = {
|
|
295
|
+
[K in keyof Ops]: Ops[K] extends {
|
|
296
|
+
permission: infer P;
|
|
297
|
+
} ? (P extends string ? P : never) : never;
|
|
298
|
+
}[keyof Ops];
|
|
299
|
+
/**
|
|
300
|
+
* The operation half of a module's manifest — derived, not written twice.
|
|
301
|
+
*
|
|
302
|
+
* `manifestEntities` already derives the entity-shaped fragments from the
|
|
303
|
+
* registry; this is its counterpart for the operation surface. Together they
|
|
304
|
+
* leave the hand-written manifest holding only what is genuinely a fact about
|
|
305
|
+
* *this deployment* rather than about the app: id, version, migrations dir,
|
|
306
|
+
* entitlement, env spec.
|
|
307
|
+
*
|
|
308
|
+
* ```ts
|
|
309
|
+
* export const manifest = moduleManifest.parse({
|
|
310
|
+
* id: '@acme/vertical', version: '0.1.0', kernelContract: '^0.0.1',
|
|
311
|
+
* migrations: { journalDir: './migrations', compatibleFrom: '0.1.0' },
|
|
312
|
+
* ...manifestOperations(operations, {
|
|
313
|
+
* permissions: { 'list:manage': 'Own and manage your lists' },
|
|
314
|
+
* }),
|
|
315
|
+
* ...manifestEntities(entities, {}),
|
|
316
|
+
* });
|
|
317
|
+
* ```
|
|
318
|
+
*
|
|
319
|
+
* **Descriptions are supplied, keys are derived.** The prose feeds the human
|
|
320
|
+
* permission diff and belongs beside the manifest; the key SET is a fact about
|
|
321
|
+
* what the operations check, and deriving it is what stops the two disagreeing.
|
|
322
|
+
* A key some operation checks but nobody described is an error rather than a
|
|
323
|
+
* silently undocumented permission.
|
|
324
|
+
*
|
|
325
|
+
* Extra descriptions are allowed on purpose: a `narrows` operation walks with a
|
|
326
|
+
* permission the model does not name (it declares only the reason), so a key
|
|
327
|
+
* reached solely by a proof walk has to be declarable here or it would vanish
|
|
328
|
+
* from the review artifact.
|
|
329
|
+
*/
|
|
330
|
+
export declare function manifestOperations<const Ops extends Record<string, object>>(operations: Ops, spec: {
|
|
331
|
+
readonly permissions: Readonly<Record<PermissionsDeclaredBy<Ops>, string>> & Readonly<Record<string, string>>;
|
|
332
|
+
/** Event types this module consumes — not derivable from its own operations. */
|
|
333
|
+
readonly consumes?: readonly {
|
|
334
|
+
readonly type: string;
|
|
335
|
+
readonly schemaVersion: number;
|
|
336
|
+
}[];
|
|
337
|
+
}): {
|
|
338
|
+
permissions: {
|
|
339
|
+
key: string;
|
|
340
|
+
description: string;
|
|
341
|
+
}[];
|
|
342
|
+
events: {
|
|
343
|
+
emits: {
|
|
344
|
+
type: string;
|
|
345
|
+
schemaVersion: number;
|
|
346
|
+
}[];
|
|
347
|
+
consumes: {
|
|
348
|
+
type: string;
|
|
349
|
+
schemaVersion: number;
|
|
350
|
+
}[];
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* Where one composed-engine operation lives in THIS vertical's HTTP surface.
|
|
355
|
+
*
|
|
356
|
+
* `{var}` is checked against the ENGINE's own declared input, so a path naming a
|
|
357
|
+
* field the engine does not accept is a compile error.
|
|
358
|
+
*/
|
|
359
|
+
type EngineRouteBinding<Op, B> = {
|
|
360
|
+
readonly method: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
361
|
+
readonly path: B extends {
|
|
362
|
+
readonly path: infer P;
|
|
363
|
+
} ? PathAgainst<Op, P> : never;
|
|
364
|
+
};
|
|
365
|
+
/** Every `{var}` in the path must name a field of the engine operation's input. */
|
|
366
|
+
type PathAgainst<Op, P> = P extends string ? [PathParams<P>] extends [InputKeys<Op>] ? P : never : never;
|
|
367
|
+
/**
|
|
368
|
+
* Declare where a composed engine's operations live in this vertical's API.
|
|
369
|
+
*
|
|
370
|
+
* An engine declares no `http`, and should not: it is entity-agnostic and does
|
|
371
|
+
* not own a URL shape — a bike shop calls the same work order a repair, and both
|
|
372
|
+
* are right. The path is the vertical's decision, and this is where it gets
|
|
373
|
+
* declared instead of buried in a hand-written route table (Callout: 17 of 27
|
|
374
|
+
* routes).
|
|
375
|
+
*
|
|
376
|
+
* ```ts
|
|
377
|
+
* export const engineRoutes = defineEngineRoutes(workorderOperations)({
|
|
378
|
+
* 'workorder/get': { method: 'GET', path: '/workorders/{orderId}' },
|
|
379
|
+
* });
|
|
380
|
+
* ```
|
|
381
|
+
*
|
|
382
|
+
* Curried, so the engine's operations are given explicitly while each binding is
|
|
383
|
+
* still checked against its own operation. The result MERGES the engine's
|
|
384
|
+
* declaration with the path, so `mountOperations` and `apiCatalogFrom` read it
|
|
385
|
+
* exactly as they read a vertical's own operations — the engine's real input and
|
|
386
|
+
* output schemas reach the router and the API document, rather than a
|
|
387
|
+
* restatement the vertical had to write.
|
|
388
|
+
*
|
|
389
|
+
* A `{var}` naming a field the engine's input does not accept is a compile
|
|
390
|
+
* error. An operation the engine does not have throws when the module loads —
|
|
391
|
+
* see the note in the body for why that one is not a type error.
|
|
392
|
+
*/
|
|
393
|
+
export declare function defineEngineRoutes<const Ops extends Record<string, object>>(operations: Ops): <const R extends { readonly [K in keyof R]: K extends keyof Ops ? EngineRouteBinding<Ops[K], R[K]> : never; }>(routes: R) => { [K in keyof R]: (K extends keyof Ops ? Ops[K] : never) & {
|
|
394
|
+
http: R[K];
|
|
395
|
+
}; };
|
|
236
396
|
export {};
|
|
237
397
|
//# sourceMappingURL=operations.d.ts.map
|
package/dist/operations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAM5C,uCAAuC;AACvC,KAAK,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,MAAM,IAAI,EAAE,GAC9E,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,GACpB,KAAK,CAAC;AAEV,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAErH,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAEvH,0EAA0E;AAC1E,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC,CAAA;KAAE,CAAA;CAAE,GACvD,CAAC,SAAS,MAAM,GACd,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC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CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,GAAE,UACzG,CAAC,KACR,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG;IAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;CAAE,GAAE,CAoB/E"}
|
package/dist/operations.js
CHANGED
|
@@ -61,7 +61,19 @@ export function defineOperations(_entities, _permissions, _engines) {
|
|
|
61
61
|
export function permissionsUsedBy(operations) {
|
|
62
62
|
const keys = Object.values(operations).flatMap((op) => {
|
|
63
63
|
const permission = op.permission;
|
|
64
|
-
|
|
64
|
+
if (typeof permission === 'string')
|
|
65
|
+
return [permission];
|
|
66
|
+
// An entity-narrowed check carries the key in `.key`; it is no less part of
|
|
67
|
+
// this module's permission surface for being narrowed.
|
|
68
|
+
if (permission && typeof permission === 'object') {
|
|
69
|
+
const key = permission.key;
|
|
70
|
+
if (typeof key === 'string')
|
|
71
|
+
return [key];
|
|
72
|
+
}
|
|
73
|
+
// A proof walk checks per entity rather than up front, but the keys it
|
|
74
|
+
// evaluates are just as much part of this module's permission surface.
|
|
75
|
+
const checks = op.narrows?.checks;
|
|
76
|
+
return Array.isArray(checks) ? checks.filter((k) => typeof k === 'string') : [];
|
|
65
77
|
});
|
|
66
78
|
return [...new Set(keys)].sort();
|
|
67
79
|
}
|
|
@@ -78,4 +90,99 @@ export function eventsEmittedBy(operations) {
|
|
|
78
90
|
.sort(([a], [b]) => a.localeCompare(b))
|
|
79
91
|
.map(([type, schemaVersion]) => ({ type, schemaVersion }));
|
|
80
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* The operation half of a module's manifest — derived, not written twice.
|
|
95
|
+
*
|
|
96
|
+
* `manifestEntities` already derives the entity-shaped fragments from the
|
|
97
|
+
* registry; this is its counterpart for the operation surface. Together they
|
|
98
|
+
* leave the hand-written manifest holding only what is genuinely a fact about
|
|
99
|
+
* *this deployment* rather than about the app: id, version, migrations dir,
|
|
100
|
+
* entitlement, env spec.
|
|
101
|
+
*
|
|
102
|
+
* ```ts
|
|
103
|
+
* export const manifest = moduleManifest.parse({
|
|
104
|
+
* id: '@acme/vertical', version: '0.1.0', kernelContract: '^0.0.1',
|
|
105
|
+
* migrations: { journalDir: './migrations', compatibleFrom: '0.1.0' },
|
|
106
|
+
* ...manifestOperations(operations, {
|
|
107
|
+
* permissions: { 'list:manage': 'Own and manage your lists' },
|
|
108
|
+
* }),
|
|
109
|
+
* ...manifestEntities(entities, {}),
|
|
110
|
+
* });
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* **Descriptions are supplied, keys are derived.** The prose feeds the human
|
|
114
|
+
* permission diff and belongs beside the manifest; the key SET is a fact about
|
|
115
|
+
* what the operations check, and deriving it is what stops the two disagreeing.
|
|
116
|
+
* A key some operation checks but nobody described is an error rather than a
|
|
117
|
+
* silently undocumented permission.
|
|
118
|
+
*
|
|
119
|
+
* Extra descriptions are allowed on purpose: a `narrows` operation walks with a
|
|
120
|
+
* permission the model does not name (it declares only the reason), so a key
|
|
121
|
+
* reached solely by a proof walk has to be declarable here or it would vanish
|
|
122
|
+
* from the review artifact.
|
|
123
|
+
*/
|
|
124
|
+
export function manifestOperations(operations, spec) {
|
|
125
|
+
const described = spec.permissions;
|
|
126
|
+
const used = permissionsUsedBy(operations);
|
|
127
|
+
const undescribed = used.filter((key) => !described[key]);
|
|
128
|
+
if (undescribed.length > 0) {
|
|
129
|
+
throw new Error(`manifestOperations: no description for permission(s) ${undescribed.join(', ')} — ` +
|
|
130
|
+
'every key an operation checks appears in the permission review, so it needs prose');
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
permissions: Object.keys(described)
|
|
134
|
+
.sort()
|
|
135
|
+
.map((key) => ({ key, description: described[key] })),
|
|
136
|
+
events: {
|
|
137
|
+
emits: eventsEmittedBy(operations),
|
|
138
|
+
consumes: [...(spec.consumes ?? [])].sort((a, b) => a.type.localeCompare(b.type)),
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Declare where a composed engine's operations live in this vertical's API.
|
|
144
|
+
*
|
|
145
|
+
* An engine declares no `http`, and should not: it is entity-agnostic and does
|
|
146
|
+
* not own a URL shape — a bike shop calls the same work order a repair, and both
|
|
147
|
+
* are right. The path is the vertical's decision, and this is where it gets
|
|
148
|
+
* declared instead of buried in a hand-written route table (Callout: 17 of 27
|
|
149
|
+
* routes).
|
|
150
|
+
*
|
|
151
|
+
* ```ts
|
|
152
|
+
* export const engineRoutes = defineEngineRoutes(workorderOperations)({
|
|
153
|
+
* 'workorder/get': { method: 'GET', path: '/workorders/{orderId}' },
|
|
154
|
+
* });
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* Curried, so the engine's operations are given explicitly while each binding is
|
|
158
|
+
* still checked against its own operation. The result MERGES the engine's
|
|
159
|
+
* declaration with the path, so `mountOperations` and `apiCatalogFrom` read it
|
|
160
|
+
* exactly as they read a vertical's own operations — the engine's real input and
|
|
161
|
+
* output schemas reach the router and the API document, rather than a
|
|
162
|
+
* restatement the vertical had to write.
|
|
163
|
+
*
|
|
164
|
+
* A `{var}` naming a field the engine's input does not accept is a compile
|
|
165
|
+
* error. An operation the engine does not have throws when the module loads —
|
|
166
|
+
* see the note in the body for why that one is not a type error.
|
|
167
|
+
*/
|
|
168
|
+
export function defineEngineRoutes(operations) {
|
|
169
|
+
return (routes) => {
|
|
170
|
+
const out = {};
|
|
171
|
+
for (const [name, http] of Object.entries(routes)) {
|
|
172
|
+
const op = operations[name];
|
|
173
|
+
// Checked HERE rather than by the type. The constraint is self-referential
|
|
174
|
+
// in `R`, and inference degrades: an unknown key resolves to `never` in
|
|
175
|
+
// the constraint and TypeScript accepts it anyway. A constraint that reads
|
|
176
|
+
// like a check and enforces nothing is worse than no constraint, so this
|
|
177
|
+
// is not claimed at the type level — it throws when the module loads,
|
|
178
|
+
// which is still long before anything serves a request.
|
|
179
|
+
if (!op) {
|
|
180
|
+
throw new Error(`defineEngineRoutes: '${name}' is not an operation of this engine — it declares ` +
|
|
181
|
+
`${Object.keys(operations).sort().join(', ')}`);
|
|
182
|
+
}
|
|
183
|
+
out[name] = { ...op, http };
|
|
184
|
+
}
|
|
185
|
+
return out;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
81
188
|
//# sourceMappingURL=operations.js.map
|
package/dist/operations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0NxB,8EAA8E;AAC9E,gBAAgB;AAChB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,gBAAgB,CAI9B,SAAmB,EAAE,YAAmB,EAAE,QAAkB;IAC5D,OAAO,CAKL,UAAe,EACV,EAAE,CAAC,UAAU,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAA4C;IAC5E,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QACpD,MAAM,UAAU,GAAI,EAA+B,CAAC,UAAU,CAAC;QAC/D,IAAI,OAAO,UAAU,KAAK,QAAQ;YAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QACxD,4EAA4E;QAC5E,uDAAuD;QACvD,IAAI,UAAU,IA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AAM,GAAG,GAA4B,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,MAAM,EAAE,GAAG,UAAU,CAAC,IAAiB,CAAC,CAAC;YACzC,2EAA2E;YAC3E,wEAAwE;YACxE,2EAA2E;YAC3E,yEAAyE;YACzE,sEAAsE;YACtE,wDAAwD;YACxD,IAAI,CAAC,EAAE,EAAE,CAAC;gBACR,MAAM,IAAI,KAAK,CACb,wBAAwB,IAAI,qDAAqD;oBAC/E,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACjD,CAAC;YACJ,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAI,EAAa,EAAE,IAAI,EAAE,CAAC;QAC1C,CAAC;QACD,OAAO,GAAkF,CAAC;IAC5F,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrat-run/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.73.0",
|
|
4
4
|
"description": "Substrat kernel contract schemas — Zod is the source of truth (master plan D-22); OAS/JSON Schema are emitted artifacts",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -21,16 +21,17 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"zod": "^4.4.3"
|
|
26
|
-
},
|
|
27
24
|
"devDependencies": {
|
|
28
25
|
"typescript": "^7.0.0",
|
|
29
|
-
"vitest": "^3.
|
|
26
|
+
"vitest": "^3.2.7",
|
|
27
|
+
"zod": "^4.4.3"
|
|
30
28
|
},
|
|
31
29
|
"publishConfig": {
|
|
32
30
|
"access": "public"
|
|
33
31
|
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"zod": "^4.4.0"
|
|
34
|
+
},
|
|
34
35
|
"scripts": {
|
|
35
36
|
"build": "tsc -p tsconfig.json",
|
|
36
37
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|