@substrat-run/engine-protocol 0.7.3 → 0.9.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EAAoB,CAAC,EAAE,MAAM,yBAAyB,CAAC;AAqB9D,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB,YAC/B,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,4BAA4B,EAC5B,2BAA2B,EAC3B,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,eAAe,CACP,CAAC;AAKX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyG7B;;;;;;;;;;;;;;OAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUH,CAAC"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * The protocol engine's declared operation surface (#707/#738).
3
+ *
4
+ * An engine declaring its operations is what lets a VERTICAL bind them to its
5
+ * own URLs without restating them. Before this, a vertical mounting
6
+ * `protocol/get` wrote its own `z.object({ instanceId })` — a second
7
+ * description of a shape this engine already owned — and the operation NAME was
8
+ * an unchecked string, because `ModuleRegistration` erases its keys.
9
+ *
10
+ * What is deliberately NOT here:
11
+ *
12
+ * - **`http`.** This engine is entity-agnostic and owns no URL shape: Callout
13
+ * hangs protocols off work orders and Handlebar off bikes, and both are right.
14
+ * The path is the composing vertical's decision, declared with
15
+ * `defineEngineRoutes` against these names.
16
+ * - **`emits`.** The manifest still declares the nine event types by hand, as
17
+ * engine-workorder's does. Deriving them needs `entityIdFrom` to name an
18
+ * OUTPUT field carrying the protocol's id, and three of these operations
19
+ * answer with a composite whose instance sits one level down
20
+ * (`{ instance, signature }`). Declaring the events would mean either
21
+ * flattening returns to suit the declaration or guessing the id — and #695's
22
+ * eighteen `entityId: undefined` events are what guessing that field looks
23
+ * like. It stays hand-declared until the model can say `instance.id`.
24
+ * - **The in-scope functions.** `defineTemplate`, `instantiateProtocol`,
25
+ * `fillProtocol` and the rest are composed by call, inside a vertical's own
26
+ * transaction. These fourteen names are their default HTTP-reachable
27
+ * bindings, not a second way in.
28
+ *
29
+ * ## Inputs are the handler's own schemas, with three deliberate exceptions
30
+ *
31
+ * Every `input` below is the same Zod object the in-scope function parses —
32
+ * that identity is the reason the model is TypeScript, and it is what makes a
33
+ * transcribed argument name impossible. The exceptions are the operations whose
34
+ * REGISTERED shape has always differed from the function's: `instantiate`
35
+ * takes a flattened `entityType`/`entityId` pair where `instantiateProtocol`
36
+ * takes an `EntityRef`, and `sign`/`countersign`/`get`/`void` take an id where
37
+ * the functions take richer arguments. Those shapes are declared here because
38
+ * here is where they are true.
39
+ */
40
+ import { defineOperations, z } from '@substrat-run/contracts';
41
+ import { protocolEntities, protocolInstanceRow } from './entities.js';
42
+ import { bindDocumentInput, cancelSignatureRequestsInput, declineSignatureInput, defineTemplateInput, fillProtocolInput, recordSignatureInput, requestSignaturesInput, } from './inputs.js';
43
+ import { protocolDetail, protocolResponseRow, protocolSignatureRequestRow, protocolSummary, protocolTemplateRow, requestSignaturesResult, signResult, } from './schemas.js';
44
+ /** The keys these operations check. Mirrors `PROTOCOL_PERM` in index.ts. */
45
+ export const PROTOCOL_PERMISSIONS = [
46
+ 'protocol:create',
47
+ 'protocol:fill',
48
+ 'protocol:bind',
49
+ 'protocol:request-signature',
50
+ 'protocol:record-signature',
51
+ 'protocol:sign',
52
+ 'protocol:countersign',
53
+ 'protocol:read',
54
+ 'protocol:attach',
55
+ 'protocol:void',
56
+ ];
57
+ /** The registered operations address an instance by id and nothing else. */
58
+ const instanceId = z.object({ instanceId: z.string().min(1) });
59
+ export const protocolOperations = defineOperations(protocolEntities, PROTOCOL_PERMISSIONS)({
60
+ 'protocol/define-template': {
61
+ summary: 'Define a protocol template, or version an existing one',
62
+ // A node check: a template belongs to the scope, not to any one instance.
63
+ permission: 'protocol:create',
64
+ input: defineTemplateInput,
65
+ output: protocolTemplateRow,
66
+ },
67
+ 'protocol/list-templates': {
68
+ summary: 'The latest version of every template — the instantiation picker',
69
+ permission: 'protocol:read',
70
+ output: z.array(protocolTemplateRow),
71
+ },
72
+ 'protocol/instantiate': {
73
+ summary: 'Start a protocol instance on an entity, pinning the template version',
74
+ // Also a node check, and deliberately: the entity named here belongs to the
75
+ // VERTICAL, so whether this principal may protocol *that* work order is a
76
+ // question only the vertical can ask. It asks it by composing
77
+ // `instantiateProtocol` behind its own check.
78
+ permission: 'protocol:create',
79
+ input: z.object({
80
+ templateKey: z.string().min(1),
81
+ entityType: z.string().min(1),
82
+ entityId: z.string().min(1),
83
+ }),
84
+ output: protocolInstanceRow,
85
+ },
86
+ 'protocol/fill': {
87
+ summary: 'Record a response on an open checklist protocol (append-only)',
88
+ permission: { key: 'protocol:fill', entity: 'protocol', idFrom: 'instanceId' },
89
+ input: fillProtocolInput,
90
+ output: protocolResponseRow,
91
+ },
92
+ 'protocol/bind-document': {
93
+ summary: 'Bind vertical-owned document content and its hash to an open document protocol',
94
+ permission: { key: 'protocol:bind', entity: 'protocol', idFrom: 'instanceId' },
95
+ input: bindDocumentInput,
96
+ output: protocolInstanceRow,
97
+ },
98
+ 'protocol/request-signatures': {
99
+ summary: 'Freeze the content and request signatures from named parties',
100
+ permission: { key: 'protocol:request-signature', entity: 'protocol', idFrom: 'instanceId' },
101
+ input: requestSignaturesInput,
102
+ output: requestSignaturesResult,
103
+ },
104
+ 'protocol/cancel-signatures': {
105
+ summary: 'Withdraw an outstanding request set and thaw the instance',
106
+ permission: { key: 'protocol:request-signature', entity: 'protocol', idFrom: 'instanceId' },
107
+ input: cancelSignatureRequestsInput,
108
+ output: protocolInstanceRow,
109
+ },
110
+ 'protocol/record-signature': {
111
+ // The ingress-facing pair. Both check a NODE, and both check a connector's
112
+ // key rather than a person's: the caller speaks for an external signing
113
+ // provider and arrives with a request id, not with an instance it was
114
+ // granted. The permission diff is where a deployment declares it trusts
115
+ // something to do that.
116
+ summary: 'Record a signature reported by an external signing provider',
117
+ permission: 'protocol:record-signature',
118
+ input: recordSignatureInput,
119
+ output: signResult,
120
+ },
121
+ 'protocol/decline-signature': {
122
+ summary: 'Record that a party declined, or that the provider’s window expired',
123
+ permission: 'protocol:record-signature',
124
+ input: declineSignatureInput,
125
+ output: protocolSignatureRequestRow,
126
+ },
127
+ 'protocol/sign': {
128
+ summary: 'Sign a protocol in-app — freezes its content forever',
129
+ permission: { key: 'protocol:sign', entity: 'protocol', idFrom: 'instanceId' },
130
+ input: instanceId,
131
+ output: signResult,
132
+ },
133
+ 'protocol/countersign': {
134
+ summary: 'Counter-sign an already-signed protocol, on the same frozen content',
135
+ permission: { key: 'protocol:countersign', entity: 'protocol', idFrom: 'instanceId' },
136
+ input: instanceId,
137
+ output: signResult,
138
+ },
139
+ 'protocol/void': {
140
+ summary: 'Void (supersede) a protocol — never deletes',
141
+ permission: { key: 'protocol:void', entity: 'protocol', idFrom: 'instanceId' },
142
+ input: instanceId.extend({ reason: z.string().min(1) }),
143
+ output: protocolInstanceRow,
144
+ },
145
+ 'protocol/get': {
146
+ summary: 'One protocol with its template, responses, signatures and requests',
147
+ permission: { key: 'protocol:read', entity: 'protocol', idFrom: 'instanceId' },
148
+ input: instanceId,
149
+ output: protocolDetail,
150
+ },
151
+ /**
152
+ * The one operation here whose authority cannot be stated as a leading
153
+ * `permission`, and the reason is this engine's defining property.
154
+ *
155
+ * The check is `protocol:read` against the entity the protocols hang on — a
156
+ * work order in Callout, a bike in Handlebar — so the entity's TYPE arrives as
157
+ * data. `PermissionCheck.entity` must name a type known at declaration time,
158
+ * and there is no honest value to put there: `'protocol'` would be false,
159
+ * because what is checked is the PARENT, not any protocol.
160
+ *
161
+ * So it declares `narrows` instead, which records the fact that actually
162
+ * protects anything — this is not a node check — and names the key the walk
163
+ * evaluates, so `protocol:read` still reaches the permission review. What is
164
+ * lost is the entity type, which was never available to lose.
165
+ */
166
+ 'protocol/list-for-entity': {
167
+ summary: 'Every protocol on one entity, with its progress and signatures',
168
+ narrows: {
169
+ reason: 'checked against the entity the protocols hang on, whose type is the caller’s',
170
+ checks: ['protocol:read'],
171
+ },
172
+ input: z.object({ entityType: z.string().min(1), entityId: z.string().min(1) }),
173
+ output: z.array(protocolSummary),
174
+ },
175
+ });
176
+ //# sourceMappingURL=operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;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,gEAAgE;QACzE,OAAO,EAAE;YACP,MAAM,EAAE,8EAA8E;YACtF,MAAM,EAAE,CAAC,eAAe,CAAC;SAC1B;QACD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;KACjC;CACF,CAAC,CAAC"}
@@ -0,0 +1,385 @@
1
+ /**
2
+ * The shapes this engine PUBLISHES — what a composing vertical returns from an
3
+ * operation it has bound, and what reaches its API document.
4
+ *
5
+ * These existed only as TypeScript interfaces, which is enough to implement
6
+ * against and not enough to DECLARE against: `defineOperations` takes a schema,
7
+ * so without these a vertical binding `protocol/get` had nothing to point at.
8
+ *
9
+ * **Each one is asserted against its interface, in both directions.** A schema
10
+ * that drifts from the shape the handler actually returns is worse than no
11
+ * schema — it publishes a contract nobody honours, which is exactly the defect
12
+ * #695 found eleven times. The assertions below fail to compile if either side
13
+ * gains, loses or retypes a field.
14
+ */
15
+ import { z } from '@substrat-run/contracts';
16
+ export declare const protocolTemplateRow: z.ZodObject<{
17
+ id: z.ZodString;
18
+ key: z.ZodString;
19
+ version: z.ZodNumber;
20
+ title: z.ZodString;
21
+ content_json: z.ZodString;
22
+ created_at: z.ZodString;
23
+ }, z.core.$strip>;
24
+ export declare const protocolResponseRow: z.ZodObject<{
25
+ id: z.ZodString;
26
+ instance_id: z.ZodString;
27
+ item_key: z.ZodString;
28
+ value_json: z.ZodString;
29
+ note: z.ZodNullable<z.ZodString>;
30
+ responded_by: z.ZodString;
31
+ responded_at: z.ZodString;
32
+ }, z.core.$strip>;
33
+ export declare const protocolSignatureRow: z.ZodObject<{
34
+ id: z.ZodString;
35
+ instance_id: z.ZodString;
36
+ signed_by: z.ZodString;
37
+ kind: z.ZodEnum<{
38
+ counter: "counter";
39
+ primary: "primary";
40
+ }>;
41
+ method: z.ZodString;
42
+ content_hash: z.ZodString;
43
+ evidence_ref: z.ZodNullable<z.ZodString>;
44
+ signed_at: z.ZodString;
45
+ request_id: z.ZodNullable<z.ZodString>;
46
+ signatory_kind: z.ZodEnum<{
47
+ external: "external";
48
+ principal: "principal";
49
+ }>;
50
+ signatory_label: z.ZodNullable<z.ZodString>;
51
+ }, z.core.$strip>;
52
+ export declare const protocolSignatureRequestRow: z.ZodObject<{
53
+ id: z.ZodString;
54
+ instance_id: z.ZodString;
55
+ party_label: z.ZodString;
56
+ party_kind: z.ZodEnum<{
57
+ external: "external";
58
+ principal: "principal";
59
+ }>;
60
+ party_ref: z.ZodNullable<z.ZodString>;
61
+ signature_kind: z.ZodEnum<{
62
+ counter: "counter";
63
+ primary: "primary";
64
+ }>;
65
+ method: z.ZodString;
66
+ auth_level: z.ZodNullable<z.ZodEnum<{
67
+ basic: "basic";
68
+ strong: "strong";
69
+ }>>;
70
+ contact_key_id: z.ZodNullable<z.ZodString>;
71
+ contact_ciphertext: z.ZodNullable<z.ZodString>;
72
+ status: z.ZodEnum<{
73
+ cancelled: "cancelled";
74
+ declined: "declined";
75
+ expired: "expired";
76
+ pending: "pending";
77
+ signed: "signed";
78
+ }>;
79
+ content_hash: z.ZodString;
80
+ external_ref: z.ZodNullable<z.ZodString>;
81
+ resolved_note: z.ZodNullable<z.ZodString>;
82
+ requested_by: z.ZodString;
83
+ requested_at: z.ZodString;
84
+ resolved_at: z.ZodNullable<z.ZodString>;
85
+ }, z.core.$strip>;
86
+ /**
87
+ * The COMPOSITE returns — what the operations answer with, as opposed to the
88
+ * rows above.
89
+ *
90
+ * These existed only as interfaces, and an interface is exactly as much as an
91
+ * operation cannot be declared against. `output` on a declared operation is a
92
+ * Zod schema, so without these four `protocol/get` and `protocol/sign` had
93
+ * nothing to point at and the engine could declare only the half of its surface
94
+ * that happens to return one row.
95
+ *
96
+ * They are assembled from the row schemas rather than restating their fields,
97
+ * so a column added to a row reaches every projection that carries it.
98
+ */
99
+ export declare const signResult: z.ZodObject<{
100
+ instance: z.ZodObject<{
101
+ id: z.ZodString;
102
+ template_key: z.ZodString;
103
+ template_version: z.ZodNumber;
104
+ entity_type: z.ZodString;
105
+ entity_id: z.ZodString;
106
+ status: z.ZodEnum<{
107
+ open: "open";
108
+ pending_signature: "pending_signature";
109
+ signed: "signed";
110
+ voided: "voided";
111
+ }>;
112
+ created_by: z.ZodString;
113
+ created_at: z.ZodString;
114
+ voided_by: z.ZodNullable<z.ZodString>;
115
+ voided_reason: z.ZodNullable<z.ZodString>;
116
+ voided_at: z.ZodNullable<z.ZodString>;
117
+ content_ref_type: z.ZodNullable<z.ZodString>;
118
+ content_ref_id: z.ZodNullable<z.ZodString>;
119
+ bound_hash: z.ZodNullable<z.ZodString>;
120
+ document_attachment_id: z.ZodNullable<z.ZodString>;
121
+ frozen_hash: z.ZodNullable<z.ZodString>;
122
+ frozen_at: z.ZodNullable<z.ZodString>;
123
+ }, z.core.$strip>;
124
+ signature: z.ZodObject<{
125
+ id: z.ZodString;
126
+ instance_id: z.ZodString;
127
+ signed_by: z.ZodString;
128
+ kind: z.ZodEnum<{
129
+ counter: "counter";
130
+ primary: "primary";
131
+ }>;
132
+ method: z.ZodString;
133
+ content_hash: z.ZodString;
134
+ evidence_ref: z.ZodNullable<z.ZodString>;
135
+ signed_at: z.ZodString;
136
+ request_id: z.ZodNullable<z.ZodString>;
137
+ signatory_kind: z.ZodEnum<{
138
+ external: "external";
139
+ principal: "principal";
140
+ }>;
141
+ signatory_label: z.ZodNullable<z.ZodString>;
142
+ }, z.core.$strip>;
143
+ }, z.core.$strip>;
144
+ export declare const requestSignaturesResult: z.ZodObject<{
145
+ instance: z.ZodObject<{
146
+ id: z.ZodString;
147
+ template_key: z.ZodString;
148
+ template_version: z.ZodNumber;
149
+ entity_type: z.ZodString;
150
+ entity_id: z.ZodString;
151
+ status: z.ZodEnum<{
152
+ open: "open";
153
+ pending_signature: "pending_signature";
154
+ signed: "signed";
155
+ voided: "voided";
156
+ }>;
157
+ created_by: z.ZodString;
158
+ created_at: z.ZodString;
159
+ voided_by: z.ZodNullable<z.ZodString>;
160
+ voided_reason: z.ZodNullable<z.ZodString>;
161
+ voided_at: z.ZodNullable<z.ZodString>;
162
+ content_ref_type: z.ZodNullable<z.ZodString>;
163
+ content_ref_id: z.ZodNullable<z.ZodString>;
164
+ bound_hash: z.ZodNullable<z.ZodString>;
165
+ document_attachment_id: z.ZodNullable<z.ZodString>;
166
+ frozen_hash: z.ZodNullable<z.ZodString>;
167
+ frozen_at: z.ZodNullable<z.ZodString>;
168
+ }, z.core.$strip>;
169
+ contentHash: z.ZodString;
170
+ requests: z.ZodArray<z.ZodObject<{
171
+ id: z.ZodString;
172
+ instance_id: z.ZodString;
173
+ party_label: z.ZodString;
174
+ party_kind: z.ZodEnum<{
175
+ external: "external";
176
+ principal: "principal";
177
+ }>;
178
+ party_ref: z.ZodNullable<z.ZodString>;
179
+ signature_kind: z.ZodEnum<{
180
+ counter: "counter";
181
+ primary: "primary";
182
+ }>;
183
+ method: z.ZodString;
184
+ auth_level: z.ZodNullable<z.ZodEnum<{
185
+ basic: "basic";
186
+ strong: "strong";
187
+ }>>;
188
+ contact_key_id: z.ZodNullable<z.ZodString>;
189
+ contact_ciphertext: z.ZodNullable<z.ZodString>;
190
+ status: z.ZodEnum<{
191
+ cancelled: "cancelled";
192
+ declined: "declined";
193
+ expired: "expired";
194
+ pending: "pending";
195
+ signed: "signed";
196
+ }>;
197
+ content_hash: z.ZodString;
198
+ external_ref: z.ZodNullable<z.ZodString>;
199
+ resolved_note: z.ZodNullable<z.ZodString>;
200
+ requested_by: z.ZodString;
201
+ requested_at: z.ZodString;
202
+ resolved_at: z.ZodNullable<z.ZodString>;
203
+ }, z.core.$strip>>;
204
+ }, z.core.$strip>;
205
+ export declare const protocolDetail: z.ZodObject<{
206
+ instance: z.ZodObject<{
207
+ id: z.ZodString;
208
+ template_key: z.ZodString;
209
+ template_version: z.ZodNumber;
210
+ entity_type: z.ZodString;
211
+ entity_id: z.ZodString;
212
+ status: z.ZodEnum<{
213
+ open: "open";
214
+ pending_signature: "pending_signature";
215
+ signed: "signed";
216
+ voided: "voided";
217
+ }>;
218
+ created_by: z.ZodString;
219
+ created_at: z.ZodString;
220
+ voided_by: z.ZodNullable<z.ZodString>;
221
+ voided_reason: z.ZodNullable<z.ZodString>;
222
+ voided_at: z.ZodNullable<z.ZodString>;
223
+ content_ref_type: z.ZodNullable<z.ZodString>;
224
+ content_ref_id: z.ZodNullable<z.ZodString>;
225
+ bound_hash: z.ZodNullable<z.ZodString>;
226
+ document_attachment_id: z.ZodNullable<z.ZodString>;
227
+ frozen_hash: z.ZodNullable<z.ZodString>;
228
+ frozen_at: z.ZodNullable<z.ZodString>;
229
+ }, z.core.$strip>;
230
+ template: z.ZodObject<{
231
+ key: z.ZodString;
232
+ version: z.ZodNumber;
233
+ title: z.ZodString;
234
+ content: z.ZodDiscriminatedUnion<[z.ZodObject<{
235
+ kind: z.ZodLiteral<"checklist">;
236
+ sections: z.ZodArray<z.ZodObject<{
237
+ title: z.ZodString;
238
+ items: z.ZodArray<z.ZodObject<{
239
+ key: z.ZodString;
240
+ label: z.ZodString;
241
+ type: z.ZodEnum<{
242
+ check: "check";
243
+ text: "text";
244
+ value: "value";
245
+ }>;
246
+ unit: z.ZodOptional<z.ZodString>;
247
+ }, z.core.$strip>>;
248
+ }, z.core.$strip>>;
249
+ }, z.core.$strip>, z.ZodObject<{
250
+ kind: z.ZodLiteral<"document">;
251
+ documentType: z.ZodString;
252
+ hashRecipe: z.ZodString;
253
+ description: z.ZodOptional<z.ZodString>;
254
+ }, z.core.$strip>], "kind">;
255
+ }, z.core.$strip>;
256
+ responses: z.ZodArray<z.ZodObject<{
257
+ id: z.ZodString;
258
+ instance_id: z.ZodString;
259
+ item_key: z.ZodString;
260
+ value_json: z.ZodString;
261
+ note: z.ZodNullable<z.ZodString>;
262
+ responded_by: z.ZodString;
263
+ responded_at: z.ZodString;
264
+ }, z.core.$strip>>;
265
+ latest: z.ZodRecord<z.ZodString, z.ZodObject<{
266
+ id: z.ZodString;
267
+ instance_id: z.ZodString;
268
+ item_key: z.ZodString;
269
+ value_json: z.ZodString;
270
+ note: z.ZodNullable<z.ZodString>;
271
+ responded_by: z.ZodString;
272
+ responded_at: z.ZodString;
273
+ }, z.core.$strip>>;
274
+ signature: z.ZodNullable<z.ZodObject<{
275
+ id: z.ZodString;
276
+ instance_id: z.ZodString;
277
+ signed_by: z.ZodString;
278
+ kind: z.ZodEnum<{
279
+ counter: "counter";
280
+ primary: "primary";
281
+ }>;
282
+ method: z.ZodString;
283
+ content_hash: z.ZodString;
284
+ evidence_ref: z.ZodNullable<z.ZodString>;
285
+ signed_at: z.ZodString;
286
+ request_id: z.ZodNullable<z.ZodString>;
287
+ signatory_kind: z.ZodEnum<{
288
+ external: "external";
289
+ principal: "principal";
290
+ }>;
291
+ signatory_label: z.ZodNullable<z.ZodString>;
292
+ }, z.core.$strip>>;
293
+ signatures: z.ZodArray<z.ZodObject<{
294
+ id: z.ZodString;
295
+ instance_id: z.ZodString;
296
+ signed_by: z.ZodString;
297
+ kind: z.ZodEnum<{
298
+ counter: "counter";
299
+ primary: "primary";
300
+ }>;
301
+ method: z.ZodString;
302
+ content_hash: z.ZodString;
303
+ evidence_ref: z.ZodNullable<z.ZodString>;
304
+ signed_at: z.ZodString;
305
+ request_id: z.ZodNullable<z.ZodString>;
306
+ signatory_kind: z.ZodEnum<{
307
+ external: "external";
308
+ principal: "principal";
309
+ }>;
310
+ signatory_label: z.ZodNullable<z.ZodString>;
311
+ }, z.core.$strip>>;
312
+ requests: z.ZodArray<z.ZodObject<{
313
+ id: z.ZodString;
314
+ instance_id: z.ZodString;
315
+ party_label: z.ZodString;
316
+ party_kind: z.ZodEnum<{
317
+ external: "external";
318
+ principal: "principal";
319
+ }>;
320
+ party_ref: z.ZodNullable<z.ZodString>;
321
+ signature_kind: z.ZodEnum<{
322
+ counter: "counter";
323
+ primary: "primary";
324
+ }>;
325
+ method: z.ZodString;
326
+ auth_level: z.ZodNullable<z.ZodEnum<{
327
+ basic: "basic";
328
+ strong: "strong";
329
+ }>>;
330
+ contact_key_id: z.ZodNullable<z.ZodString>;
331
+ contact_ciphertext: z.ZodNullable<z.ZodString>;
332
+ status: z.ZodEnum<{
333
+ cancelled: "cancelled";
334
+ declined: "declined";
335
+ expired: "expired";
336
+ pending: "pending";
337
+ signed: "signed";
338
+ }>;
339
+ content_hash: z.ZodString;
340
+ external_ref: z.ZodNullable<z.ZodString>;
341
+ resolved_note: z.ZodNullable<z.ZodString>;
342
+ requested_by: z.ZodString;
343
+ requested_at: z.ZodString;
344
+ resolved_at: z.ZodNullable<z.ZodString>;
345
+ }, z.core.$strip>>;
346
+ }, z.core.$strip>;
347
+ export declare const protocolSummary: z.ZodObject<{
348
+ instance: z.ZodObject<{
349
+ id: z.ZodString;
350
+ template_key: z.ZodString;
351
+ template_version: z.ZodNumber;
352
+ entity_type: z.ZodString;
353
+ entity_id: z.ZodString;
354
+ status: z.ZodEnum<{
355
+ open: "open";
356
+ pending_signature: "pending_signature";
357
+ signed: "signed";
358
+ voided: "voided";
359
+ }>;
360
+ created_by: z.ZodString;
361
+ created_at: z.ZodString;
362
+ voided_by: z.ZodNullable<z.ZodString>;
363
+ voided_reason: z.ZodNullable<z.ZodString>;
364
+ voided_at: z.ZodNullable<z.ZodString>;
365
+ content_ref_type: z.ZodNullable<z.ZodString>;
366
+ content_ref_id: z.ZodNullable<z.ZodString>;
367
+ bound_hash: z.ZodNullable<z.ZodString>;
368
+ document_attachment_id: z.ZodNullable<z.ZodString>;
369
+ frozen_hash: z.ZodNullable<z.ZodString>;
370
+ frozen_at: z.ZodNullable<z.ZodString>;
371
+ }, z.core.$strip>;
372
+ title: z.ZodString;
373
+ contentKind: z.ZodEnum<{
374
+ checklist: "checklist";
375
+ document: "document";
376
+ }>;
377
+ answered: z.ZodNumber;
378
+ total: z.ZodNumber;
379
+ signedBy: z.ZodNullable<z.ZodString>;
380
+ signedAt: z.ZodNullable<z.ZodString>;
381
+ countersignedBy: z.ZodNullable<z.ZodString>;
382
+ countersignedAt: z.ZodNullable<z.ZodString>;
383
+ pendingSignatures: z.ZodNumber;
384
+ }, z.core.$strip>;
385
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,yBAAyB,CAAC;AAc5C,eAAO,MAAM,mBAAmB;;;;;;;iBAO9B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;iBAQ9B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;iBAY/B,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkBtC,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGrB,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIlC,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiBzB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAY1B,CAAC"}