@openvtc/trust-tasks 0.12.1 → 0.12.2
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/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/vta/_shared/0.1/app-state-record.d.ts +17 -0
- package/dist/vta/_shared/0.1/app-state-record.d.ts.map +1 -0
- package/dist/vta/_shared/0.1/app-state-record.js +6 -0
- package/dist/vta/_shared/0.1/app-state-record.js.map +1 -0
- package/dist/vta/app-state/delete/1.0/payload.d.ts +488 -0
- package/dist/vta/app-state/delete/1.0/payload.d.ts.map +1 -0
- package/dist/vta/app-state/delete/1.0/payload.js +248 -0
- package/dist/vta/app-state/delete/1.0/payload.js.map +1 -0
- package/dist/vta/app-state/get/1.0/payload.d.ts +611 -0
- package/dist/vta/app-state/get/1.0/payload.d.ts.map +1 -0
- package/dist/vta/app-state/get/1.0/payload.js +306 -0
- package/dist/vta/app-state/get/1.0/payload.js.map +1 -0
- package/dist/vta/app-state/get-many/1.0/payload.d.ts +716 -0
- package/dist/vta/app-state/get-many/1.0/payload.d.ts.map +1 -0
- package/dist/vta/app-state/get-many/1.0/payload.js +350 -0
- package/dist/vta/app-state/get-many/1.0/payload.js.map +1 -0
- package/dist/vta/app-state/list/1.0/payload.d.ts +778 -0
- package/dist/vta/app-state/list/1.0/payload.d.ts.map +1 -0
- package/dist/vta/app-state/list/1.0/payload.js +368 -0
- package/dist/vta/app-state/list/1.0/payload.js.map +1 -0
- package/dist/vta/app-state/put/1.0/payload.d.ts +560 -0
- package/dist/vta/app-state/put/1.0/payload.d.ts.map +1 -0
- package/dist/vta/app-state/put/1.0/payload.js +291 -0
- package/dist/vta/app-state/put/1.0/payload.js.map +1 -0
- package/dist/vta/app-state/put-many/1.0/payload.d.ts +856 -0
- package/dist/vta/app-state/put-many/1.0/payload.d.ts.map +1 -0
- package/dist/vta/app-state/put-many/1.0/payload.js +455 -0
- package/dist/vta/app-state/put-many/1.0/payload.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +7 -0
- package/src/vta/_shared/0.1/app-state-record.ts +17 -0
- package/src/vta/app-state/delete/1.0/payload.ts +323 -0
- package/src/vta/app-state/get/1.0/payload.ts +404 -0
- package/src/vta/app-state/get-many/1.0/payload.ts +469 -0
- package/src/vta/app-state/list/1.0/payload.ts +509 -0
- package/src/vta/app-state/put/1.0/payload.ts +382 -0
- package/src/vta/app-state/put-many/1.0/payload.ts +584 -0
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
|
|
3
|
+
* Source: specs/vta/app-state/put/1.0/payload.schema.json
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Write one application-state record at its `(contextId, namespace, key)` address. Exactly one of `value` (whole-record replacement) or `mergePatch` (RFC 7386 partial update) is supplied. `expectedVersion` makes the write conditional: a positive value requires the record to be at exactly that version, and zero requires that no live record exists.
|
|
7
|
+
*/
|
|
8
|
+
export type VTAApplicationStatePutPayload = {
|
|
9
|
+
/**
|
|
10
|
+
* The VTA context the record is scoped to; the isolation boundary.
|
|
11
|
+
*/
|
|
12
|
+
contextId: string;
|
|
13
|
+
namespace: Namespace;
|
|
14
|
+
key: Key;
|
|
15
|
+
/**
|
|
16
|
+
* The complete new value, replacing whatever the record held. Any JSON value, including `null` — a present-and-null `value` stores the JSON literal null and is not the same as omitting the member. Mutually exclusive with `mergePatch`.
|
|
17
|
+
*/
|
|
18
|
+
value?: {
|
|
19
|
+
[k: string]: unknown | undefined;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* An RFC 7386 JSON Merge Patch applied to the record's current value. Cuts payload, and more usefully cuts conflicts: two instances editing different members of one record stop colliding entirely rather than serialising behind `expectedVersion`. Requires a live record at the address. Note RFC 7386's one sharp edge — a member set to `null` in the patch DELETES that member from the value, and there is no way to set a member to the JSON literal null through a patch; a writer that needs to do so must send a whole `value`. Mutually exclusive with `value`.
|
|
23
|
+
*/
|
|
24
|
+
mergePatch?: {};
|
|
25
|
+
expectedVersion?: ExpectedVersion;
|
|
26
|
+
ext?: Ext;
|
|
27
|
+
} & {
|
|
28
|
+
[k: string]: unknown | undefined;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Scopes one application's records within a context, so several tools can share a context without colliding — `openvtc`, `cnm`, an agent runtime. The maintainer MUST NOT interpret the value; it is an opaque partition name. Namespaces are first-come and unreserved, so an application SHOULD pick a stable, specific one: a future per-namespace ACL would grant on this exact string, which makes renaming a namespace a migration rather than an edit.
|
|
32
|
+
*/
|
|
33
|
+
export type Namespace = string;
|
|
34
|
+
/**
|
|
35
|
+
* Application-chosen identifier for a record within a namespace. Opaque to the maintainer: it MUST NOT be parsed, normalized, or case-folded, and prefix matching in `list` is a byte-prefix comparison over the UTF-8 encoding. Applications SHOULD use `/`-delimited hierarchical keys (`community/acme`, `contact/z6Mk…`) so that `prefix` can address a record family, but the delimiter is a convention between an application and itself — the maintainer attaches no meaning to it.
|
|
36
|
+
*/
|
|
37
|
+
export type Key = string;
|
|
38
|
+
/**
|
|
39
|
+
* Optional precondition. Omit for a last-writer-wins upsert. Supply the version a prior read returned to make the write conditional; supply 0 to create only.
|
|
40
|
+
*/
|
|
41
|
+
export type ExpectedVersion = number;
|
|
42
|
+
/**
|
|
43
|
+
* The version this write took. Supply it as `expectedVersion` on the next write to chain conditional updates without an intervening read.
|
|
44
|
+
*/
|
|
45
|
+
export type Version = number;
|
|
46
|
+
/**
|
|
47
|
+
* Ecosystem-defined extension members per SPEC.md §4.5.1.
|
|
48
|
+
*/
|
|
49
|
+
export interface Ext {
|
|
50
|
+
[k: string]: unknown | undefined;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Success response to vta/app-state/put. Type https://trusttasks.org/spec/vta/app-state/put/1.0#response. A failed precondition is not a success: it is a trust-task-error carrying vta/app-state/put:versionConflict, whose details carry the maintainer's current version and value.
|
|
54
|
+
*/
|
|
55
|
+
export interface VTAApplicationStatePutResponsePayload {
|
|
56
|
+
/**
|
|
57
|
+
* Echoed from the request.
|
|
58
|
+
*/
|
|
59
|
+
contextId: string;
|
|
60
|
+
namespace: Namespace;
|
|
61
|
+
key: Key;
|
|
62
|
+
version: Version;
|
|
63
|
+
/**
|
|
64
|
+
* True when no live record existed at the address beforehand — including when the address held a tombstone, since a tombstone is not a live record.
|
|
65
|
+
*/
|
|
66
|
+
created: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* When the write was applied.
|
|
69
|
+
*/
|
|
70
|
+
updatedAt: string;
|
|
71
|
+
/**
|
|
72
|
+
* Size of the stored value in bytes as the maintainer measured it against its per-record cap. Lets a writer see how close it is to the limit before it hits it.
|
|
73
|
+
*/
|
|
74
|
+
valueBytes?: number;
|
|
75
|
+
ext?: Ext1;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Ecosystem-defined extension members per SPEC.md §4.5.1.
|
|
79
|
+
*/
|
|
80
|
+
export interface Ext1 {
|
|
81
|
+
[k: string]: unknown | undefined;
|
|
82
|
+
}
|
|
83
|
+
/** Trust Task type URI. */
|
|
84
|
+
export declare const TYPE_URI: "https://trusttasks.org/spec/vta/app-state/put/1.0";
|
|
85
|
+
/** Stable alias for this specification's request payload shape. */
|
|
86
|
+
export type Payload = VTAApplicationStatePutPayload;
|
|
87
|
+
/** Trust Task response type URI (request type URI + "#response"). */
|
|
88
|
+
export declare const RESPONSE_TYPE_URI: "https://trusttasks.org/spec/vta/app-state/put/1.0#response";
|
|
89
|
+
/** Stable alias for this specification's success-response payload shape. */
|
|
90
|
+
export type Response = VTAApplicationStatePutResponsePayload;
|
|
91
|
+
/**
|
|
92
|
+
* This specification's payload schema, as a value.
|
|
93
|
+
*
|
|
94
|
+
* SPEC.md §7.2 item 2 is performed against this. It is shipped as data
|
|
95
|
+
* rather than only as a `.json` file because TypeScript types are erased
|
|
96
|
+
* at runtime: without a schema a consumer has nothing to validate, and
|
|
97
|
+
* every REQUIRED payload member is optional in practice. Cross-file
|
|
98
|
+
* `$ref`s are already inlined, so it needs no resolver.
|
|
99
|
+
*/
|
|
100
|
+
export declare const PAYLOAD_SCHEMA: {
|
|
101
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
102
|
+
readonly $id: "https://trusttasks.org/spec/vta/app-state/put/1.0";
|
|
103
|
+
readonly title: "VTA Application State Put — payload";
|
|
104
|
+
readonly description: "Write one application-state record at its `(contextId, namespace, key)` address. Exactly one of `value` (whole-record replacement) or `mergePatch` (RFC 7386 partial update) is supplied. `expectedVersion` makes the write conditional: a positive value requires the record to be at exactly that version, and zero requires that no live record exists.";
|
|
105
|
+
readonly type: "object";
|
|
106
|
+
readonly additionalProperties: false;
|
|
107
|
+
readonly required: readonly ["contextId", "namespace", "key"];
|
|
108
|
+
readonly oneOf: readonly [{
|
|
109
|
+
readonly required: readonly ["value"];
|
|
110
|
+
readonly not: {
|
|
111
|
+
readonly required: readonly ["mergePatch"];
|
|
112
|
+
};
|
|
113
|
+
}, {
|
|
114
|
+
readonly required: readonly ["mergePatch"];
|
|
115
|
+
readonly not: {
|
|
116
|
+
readonly required: readonly ["value"];
|
|
117
|
+
};
|
|
118
|
+
}];
|
|
119
|
+
readonly properties: {
|
|
120
|
+
readonly contextId: {
|
|
121
|
+
readonly type: "string";
|
|
122
|
+
readonly minLength: 1;
|
|
123
|
+
readonly description: "The VTA context the record is scoped to; the isolation boundary.";
|
|
124
|
+
};
|
|
125
|
+
readonly namespace: {
|
|
126
|
+
readonly $ref: "#/$defs/Namespace";
|
|
127
|
+
};
|
|
128
|
+
readonly key: {
|
|
129
|
+
readonly $ref: "#/$defs/Key";
|
|
130
|
+
};
|
|
131
|
+
readonly value: {
|
|
132
|
+
readonly description: "The complete new value, replacing whatever the record held. Any JSON value, including `null` — a present-and-null `value` stores the JSON literal null and is not the same as omitting the member. Mutually exclusive with `mergePatch`.";
|
|
133
|
+
};
|
|
134
|
+
readonly mergePatch: {
|
|
135
|
+
readonly description: "An RFC 7386 JSON Merge Patch applied to the record's current value. Cuts payload, and more usefully cuts conflicts: two instances editing different members of one record stop colliding entirely rather than serialising behind `expectedVersion`. Requires a live record at the address. Note RFC 7386's one sharp edge — a member set to `null` in the patch DELETES that member from the value, and there is no way to set a member to the JSON literal null through a patch; a writer that needs to do so must send a whole `value`. Mutually exclusive with `value`.";
|
|
136
|
+
readonly type: "object";
|
|
137
|
+
};
|
|
138
|
+
readonly expectedVersion: {
|
|
139
|
+
readonly $ref: "#/$defs/ExpectedVersion";
|
|
140
|
+
readonly description: "Optional precondition. Omit for a last-writer-wins upsert. Supply the version a prior read returned to make the write conditional; supply 0 to create only.";
|
|
141
|
+
};
|
|
142
|
+
readonly ext: {
|
|
143
|
+
readonly $ref: "#/$defs/Ext";
|
|
144
|
+
readonly description: "Ecosystem-defined extension members per SPEC.md §4.5.1.";
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
readonly $defs: {
|
|
148
|
+
readonly Response: {
|
|
149
|
+
readonly $anchor: "response";
|
|
150
|
+
readonly title: "VTA Application State Put — response payload";
|
|
151
|
+
readonly description: "Success response to vta/app-state/put. Type https://trusttasks.org/spec/vta/app-state/put/1.0#response. A failed precondition is not a success: it is a trust-task-error carrying vta/app-state/put:versionConflict, whose details carry the maintainer's current version and value.";
|
|
152
|
+
readonly type: "object";
|
|
153
|
+
readonly additionalProperties: false;
|
|
154
|
+
readonly required: readonly ["contextId", "namespace", "key", "version", "created", "updatedAt"];
|
|
155
|
+
readonly properties: {
|
|
156
|
+
readonly contextId: {
|
|
157
|
+
readonly type: "string";
|
|
158
|
+
readonly minLength: 1;
|
|
159
|
+
readonly description: "Echoed from the request.";
|
|
160
|
+
};
|
|
161
|
+
readonly namespace: {
|
|
162
|
+
readonly $ref: "#/$defs/Namespace";
|
|
163
|
+
};
|
|
164
|
+
readonly key: {
|
|
165
|
+
readonly $ref: "#/$defs/Key";
|
|
166
|
+
};
|
|
167
|
+
readonly version: {
|
|
168
|
+
readonly $ref: "#/$defs/Version";
|
|
169
|
+
readonly description: "The version this write took. Supply it as `expectedVersion` on the next write to chain conditional updates without an intervening read.";
|
|
170
|
+
};
|
|
171
|
+
readonly created: {
|
|
172
|
+
readonly type: "boolean";
|
|
173
|
+
readonly description: "True when no live record existed at the address beforehand — including when the address held a tombstone, since a tombstone is not a live record.";
|
|
174
|
+
};
|
|
175
|
+
readonly updatedAt: {
|
|
176
|
+
readonly type: "string";
|
|
177
|
+
readonly format: "date-time";
|
|
178
|
+
readonly description: "When the write was applied.";
|
|
179
|
+
};
|
|
180
|
+
readonly valueBytes: {
|
|
181
|
+
readonly type: "integer";
|
|
182
|
+
readonly minimum: 0;
|
|
183
|
+
readonly description: "Size of the stored value in bytes as the maintainer measured it against its per-record cap. Lets a writer see how close it is to the limit before it hits it.";
|
|
184
|
+
};
|
|
185
|
+
readonly ext: {
|
|
186
|
+
readonly $ref: "#/$defs/Ext";
|
|
187
|
+
readonly description: "Ecosystem-defined extension members per SPEC.md §4.5.1.";
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
readonly Ext: {
|
|
192
|
+
readonly title: "Ext";
|
|
193
|
+
readonly description: "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.";
|
|
194
|
+
readonly type: "object";
|
|
195
|
+
readonly minProperties: 1;
|
|
196
|
+
readonly additionalProperties: true;
|
|
197
|
+
readonly propertyNames: {
|
|
198
|
+
readonly pattern: "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$";
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
readonly Version: {
|
|
202
|
+
readonly title: "Version";
|
|
203
|
+
readonly description: "A value of the namespace's monotonic write counter (see this schema's description). Server-assigned; a producer never chooses one.";
|
|
204
|
+
readonly type: "integer";
|
|
205
|
+
readonly minimum: 1;
|
|
206
|
+
};
|
|
207
|
+
readonly Key: {
|
|
208
|
+
readonly title: "Key";
|
|
209
|
+
readonly description: "Application-chosen identifier for a record within a namespace. Opaque to the maintainer: it MUST NOT be parsed, normalized, or case-folded, and prefix matching in `list` is a byte-prefix comparison over the UTF-8 encoding. Applications SHOULD use `/`-delimited hierarchical keys (`community/acme`, `contact/z6Mk…`) so that `prefix` can address a record family, but the delimiter is a convention between an application and itself — the maintainer attaches no meaning to it.";
|
|
210
|
+
readonly type: "string";
|
|
211
|
+
readonly minLength: 1;
|
|
212
|
+
readonly maxLength: 512;
|
|
213
|
+
readonly pattern: "^[^\\u0000]+$";
|
|
214
|
+
};
|
|
215
|
+
readonly Namespace: {
|
|
216
|
+
readonly title: "Namespace";
|
|
217
|
+
readonly description: "Scopes one application's records within a context, so several tools can share a context without colliding — `openvtc`, `cnm`, an agent runtime. The maintainer MUST NOT interpret the value; it is an opaque partition name. Namespaces are first-come and unreserved, so an application SHOULD pick a stable, specific one: a future per-namespace ACL would grant on this exact string, which makes renaming a namespace a migration rather than an edit.";
|
|
218
|
+
readonly type: "string";
|
|
219
|
+
readonly minLength: 1;
|
|
220
|
+
readonly maxLength: 64;
|
|
221
|
+
readonly pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$";
|
|
222
|
+
};
|
|
223
|
+
readonly ExpectedVersion: {
|
|
224
|
+
readonly title: "ExpectedVersion";
|
|
225
|
+
readonly description: "Optimistic-concurrency precondition on a write. A positive value requires that the record's current `version` equals it exactly. Zero means \"create only\" — the write applies only if no LIVE record exists at the address, which is what makes lease acquisition safe: without it two instances can each read \"absent\", each write, and each believe it won. A tombstone is not a live record, so `expectedVersion: 0` succeeds over one; the created record takes the namespace's next counter value, which is necessarily greater than the tombstone's.";
|
|
226
|
+
readonly type: "integer";
|
|
227
|
+
readonly minimum: 0;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
/** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
|
|
232
|
+
export declare const RESPONSE_PAYLOAD_SCHEMA: {
|
|
233
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
234
|
+
readonly $ref: "#/$defs/Response";
|
|
235
|
+
readonly $defs: {
|
|
236
|
+
readonly Response: {
|
|
237
|
+
readonly $anchor: "response";
|
|
238
|
+
readonly title: "VTA Application State Put — response payload";
|
|
239
|
+
readonly description: "Success response to vta/app-state/put. Type https://trusttasks.org/spec/vta/app-state/put/1.0#response. A failed precondition is not a success: it is a trust-task-error carrying vta/app-state/put:versionConflict, whose details carry the maintainer's current version and value.";
|
|
240
|
+
readonly type: "object";
|
|
241
|
+
readonly additionalProperties: false;
|
|
242
|
+
readonly required: readonly ["contextId", "namespace", "key", "version", "created", "updatedAt"];
|
|
243
|
+
readonly properties: {
|
|
244
|
+
readonly contextId: {
|
|
245
|
+
readonly type: "string";
|
|
246
|
+
readonly minLength: 1;
|
|
247
|
+
readonly description: "Echoed from the request.";
|
|
248
|
+
};
|
|
249
|
+
readonly namespace: {
|
|
250
|
+
readonly $ref: "#/$defs/Namespace";
|
|
251
|
+
};
|
|
252
|
+
readonly key: {
|
|
253
|
+
readonly $ref: "#/$defs/Key";
|
|
254
|
+
};
|
|
255
|
+
readonly version: {
|
|
256
|
+
readonly $ref: "#/$defs/Version";
|
|
257
|
+
readonly description: "The version this write took. Supply it as `expectedVersion` on the next write to chain conditional updates without an intervening read.";
|
|
258
|
+
};
|
|
259
|
+
readonly created: {
|
|
260
|
+
readonly type: "boolean";
|
|
261
|
+
readonly description: "True when no live record existed at the address beforehand — including when the address held a tombstone, since a tombstone is not a live record.";
|
|
262
|
+
};
|
|
263
|
+
readonly updatedAt: {
|
|
264
|
+
readonly type: "string";
|
|
265
|
+
readonly format: "date-time";
|
|
266
|
+
readonly description: "When the write was applied.";
|
|
267
|
+
};
|
|
268
|
+
readonly valueBytes: {
|
|
269
|
+
readonly type: "integer";
|
|
270
|
+
readonly minimum: 0;
|
|
271
|
+
readonly description: "Size of the stored value in bytes as the maintainer measured it against its per-record cap. Lets a writer see how close it is to the limit before it hits it.";
|
|
272
|
+
};
|
|
273
|
+
readonly ext: {
|
|
274
|
+
readonly $ref: "#/$defs/Ext";
|
|
275
|
+
readonly description: "Ecosystem-defined extension members per SPEC.md §4.5.1.";
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
readonly Ext: {
|
|
280
|
+
readonly title: "Ext";
|
|
281
|
+
readonly description: "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.";
|
|
282
|
+
readonly type: "object";
|
|
283
|
+
readonly minProperties: 1;
|
|
284
|
+
readonly additionalProperties: true;
|
|
285
|
+
readonly propertyNames: {
|
|
286
|
+
readonly pattern: "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$";
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
readonly Version: {
|
|
290
|
+
readonly title: "Version";
|
|
291
|
+
readonly description: "A value of the namespace's monotonic write counter (see this schema's description). Server-assigned; a producer never chooses one.";
|
|
292
|
+
readonly type: "integer";
|
|
293
|
+
readonly minimum: 1;
|
|
294
|
+
};
|
|
295
|
+
readonly Key: {
|
|
296
|
+
readonly title: "Key";
|
|
297
|
+
readonly description: "Application-chosen identifier for a record within a namespace. Opaque to the maintainer: it MUST NOT be parsed, normalized, or case-folded, and prefix matching in `list` is a byte-prefix comparison over the UTF-8 encoding. Applications SHOULD use `/`-delimited hierarchical keys (`community/acme`, `contact/z6Mk…`) so that `prefix` can address a record family, but the delimiter is a convention between an application and itself — the maintainer attaches no meaning to it.";
|
|
298
|
+
readonly type: "string";
|
|
299
|
+
readonly minLength: 1;
|
|
300
|
+
readonly maxLength: 512;
|
|
301
|
+
readonly pattern: "^[^\\u0000]+$";
|
|
302
|
+
};
|
|
303
|
+
readonly Namespace: {
|
|
304
|
+
readonly title: "Namespace";
|
|
305
|
+
readonly description: "Scopes one application's records within a context, so several tools can share a context without colliding — `openvtc`, `cnm`, an agent runtime. The maintainer MUST NOT interpret the value; it is an opaque partition name. Namespaces are first-come and unreserved, so an application SHOULD pick a stable, specific one: a future per-namespace ACL would grant on this exact string, which makes renaming a namespace a migration rather than an edit.";
|
|
306
|
+
readonly type: "string";
|
|
307
|
+
readonly minLength: 1;
|
|
308
|
+
readonly maxLength: 64;
|
|
309
|
+
readonly pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$";
|
|
310
|
+
};
|
|
311
|
+
readonly ExpectedVersion: {
|
|
312
|
+
readonly title: "ExpectedVersion";
|
|
313
|
+
readonly description: "Optimistic-concurrency precondition on a write. A positive value requires that the record's current `version` equals it exactly. Zero means \"create only\" — the write applies only if no LIVE record exists at the address, which is what makes lease acquisition safe: without it two instances can each read \"absent\", each write, and each believe it won. A tombstone is not a live record, so `expectedVersion: 0` succeeds over one; the created record takes the namespace's next counter value, which is necessarily greater than the tombstone's.";
|
|
314
|
+
readonly type: "integer";
|
|
315
|
+
readonly minimum: 0;
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* SPEC.md §7.2 policy for the request variant, from this specification's
|
|
321
|
+
* front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
|
|
322
|
+
* per-specification and cannot be derived from the document alone, and
|
|
323
|
+
* item 2 needs the schema this carries.
|
|
324
|
+
*/
|
|
325
|
+
export declare const SPEC: {
|
|
326
|
+
readonly typeUri: "https://trusttasks.org/spec/vta/app-state/put/1.0";
|
|
327
|
+
readonly isBearer: false;
|
|
328
|
+
readonly isProofRequired: true;
|
|
329
|
+
readonly isRecipientRequired: true;
|
|
330
|
+
readonly payloadSchema: {
|
|
331
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
332
|
+
readonly $id: "https://trusttasks.org/spec/vta/app-state/put/1.0";
|
|
333
|
+
readonly title: "VTA Application State Put — payload";
|
|
334
|
+
readonly description: "Write one application-state record at its `(contextId, namespace, key)` address. Exactly one of `value` (whole-record replacement) or `mergePatch` (RFC 7386 partial update) is supplied. `expectedVersion` makes the write conditional: a positive value requires the record to be at exactly that version, and zero requires that no live record exists.";
|
|
335
|
+
readonly type: "object";
|
|
336
|
+
readonly additionalProperties: false;
|
|
337
|
+
readonly required: readonly ["contextId", "namespace", "key"];
|
|
338
|
+
readonly oneOf: readonly [{
|
|
339
|
+
readonly required: readonly ["value"];
|
|
340
|
+
readonly not: {
|
|
341
|
+
readonly required: readonly ["mergePatch"];
|
|
342
|
+
};
|
|
343
|
+
}, {
|
|
344
|
+
readonly required: readonly ["mergePatch"];
|
|
345
|
+
readonly not: {
|
|
346
|
+
readonly required: readonly ["value"];
|
|
347
|
+
};
|
|
348
|
+
}];
|
|
349
|
+
readonly properties: {
|
|
350
|
+
readonly contextId: {
|
|
351
|
+
readonly type: "string";
|
|
352
|
+
readonly minLength: 1;
|
|
353
|
+
readonly description: "The VTA context the record is scoped to; the isolation boundary.";
|
|
354
|
+
};
|
|
355
|
+
readonly namespace: {
|
|
356
|
+
readonly $ref: "#/$defs/Namespace";
|
|
357
|
+
};
|
|
358
|
+
readonly key: {
|
|
359
|
+
readonly $ref: "#/$defs/Key";
|
|
360
|
+
};
|
|
361
|
+
readonly value: {
|
|
362
|
+
readonly description: "The complete new value, replacing whatever the record held. Any JSON value, including `null` — a present-and-null `value` stores the JSON literal null and is not the same as omitting the member. Mutually exclusive with `mergePatch`.";
|
|
363
|
+
};
|
|
364
|
+
readonly mergePatch: {
|
|
365
|
+
readonly description: "An RFC 7386 JSON Merge Patch applied to the record's current value. Cuts payload, and more usefully cuts conflicts: two instances editing different members of one record stop colliding entirely rather than serialising behind `expectedVersion`. Requires a live record at the address. Note RFC 7386's one sharp edge — a member set to `null` in the patch DELETES that member from the value, and there is no way to set a member to the JSON literal null through a patch; a writer that needs to do so must send a whole `value`. Mutually exclusive with `value`.";
|
|
366
|
+
readonly type: "object";
|
|
367
|
+
};
|
|
368
|
+
readonly expectedVersion: {
|
|
369
|
+
readonly $ref: "#/$defs/ExpectedVersion";
|
|
370
|
+
readonly description: "Optional precondition. Omit for a last-writer-wins upsert. Supply the version a prior read returned to make the write conditional; supply 0 to create only.";
|
|
371
|
+
};
|
|
372
|
+
readonly ext: {
|
|
373
|
+
readonly $ref: "#/$defs/Ext";
|
|
374
|
+
readonly description: "Ecosystem-defined extension members per SPEC.md §4.5.1.";
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
readonly $defs: {
|
|
378
|
+
readonly Response: {
|
|
379
|
+
readonly $anchor: "response";
|
|
380
|
+
readonly title: "VTA Application State Put — response payload";
|
|
381
|
+
readonly description: "Success response to vta/app-state/put. Type https://trusttasks.org/spec/vta/app-state/put/1.0#response. A failed precondition is not a success: it is a trust-task-error carrying vta/app-state/put:versionConflict, whose details carry the maintainer's current version and value.";
|
|
382
|
+
readonly type: "object";
|
|
383
|
+
readonly additionalProperties: false;
|
|
384
|
+
readonly required: readonly ["contextId", "namespace", "key", "version", "created", "updatedAt"];
|
|
385
|
+
readonly properties: {
|
|
386
|
+
readonly contextId: {
|
|
387
|
+
readonly type: "string";
|
|
388
|
+
readonly minLength: 1;
|
|
389
|
+
readonly description: "Echoed from the request.";
|
|
390
|
+
};
|
|
391
|
+
readonly namespace: {
|
|
392
|
+
readonly $ref: "#/$defs/Namespace";
|
|
393
|
+
};
|
|
394
|
+
readonly key: {
|
|
395
|
+
readonly $ref: "#/$defs/Key";
|
|
396
|
+
};
|
|
397
|
+
readonly version: {
|
|
398
|
+
readonly $ref: "#/$defs/Version";
|
|
399
|
+
readonly description: "The version this write took. Supply it as `expectedVersion` on the next write to chain conditional updates without an intervening read.";
|
|
400
|
+
};
|
|
401
|
+
readonly created: {
|
|
402
|
+
readonly type: "boolean";
|
|
403
|
+
readonly description: "True when no live record existed at the address beforehand — including when the address held a tombstone, since a tombstone is not a live record.";
|
|
404
|
+
};
|
|
405
|
+
readonly updatedAt: {
|
|
406
|
+
readonly type: "string";
|
|
407
|
+
readonly format: "date-time";
|
|
408
|
+
readonly description: "When the write was applied.";
|
|
409
|
+
};
|
|
410
|
+
readonly valueBytes: {
|
|
411
|
+
readonly type: "integer";
|
|
412
|
+
readonly minimum: 0;
|
|
413
|
+
readonly description: "Size of the stored value in bytes as the maintainer measured it against its per-record cap. Lets a writer see how close it is to the limit before it hits it.";
|
|
414
|
+
};
|
|
415
|
+
readonly ext: {
|
|
416
|
+
readonly $ref: "#/$defs/Ext";
|
|
417
|
+
readonly description: "Ecosystem-defined extension members per SPEC.md §4.5.1.";
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
readonly Ext: {
|
|
422
|
+
readonly title: "Ext";
|
|
423
|
+
readonly description: "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.";
|
|
424
|
+
readonly type: "object";
|
|
425
|
+
readonly minProperties: 1;
|
|
426
|
+
readonly additionalProperties: true;
|
|
427
|
+
readonly propertyNames: {
|
|
428
|
+
readonly pattern: "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$";
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
readonly Version: {
|
|
432
|
+
readonly title: "Version";
|
|
433
|
+
readonly description: "A value of the namespace's monotonic write counter (see this schema's description). Server-assigned; a producer never chooses one.";
|
|
434
|
+
readonly type: "integer";
|
|
435
|
+
readonly minimum: 1;
|
|
436
|
+
};
|
|
437
|
+
readonly Key: {
|
|
438
|
+
readonly title: "Key";
|
|
439
|
+
readonly description: "Application-chosen identifier for a record within a namespace. Opaque to the maintainer: it MUST NOT be parsed, normalized, or case-folded, and prefix matching in `list` is a byte-prefix comparison over the UTF-8 encoding. Applications SHOULD use `/`-delimited hierarchical keys (`community/acme`, `contact/z6Mk…`) so that `prefix` can address a record family, but the delimiter is a convention between an application and itself — the maintainer attaches no meaning to it.";
|
|
440
|
+
readonly type: "string";
|
|
441
|
+
readonly minLength: 1;
|
|
442
|
+
readonly maxLength: 512;
|
|
443
|
+
readonly pattern: "^[^\\u0000]+$";
|
|
444
|
+
};
|
|
445
|
+
readonly Namespace: {
|
|
446
|
+
readonly title: "Namespace";
|
|
447
|
+
readonly description: "Scopes one application's records within a context, so several tools can share a context without colliding — `openvtc`, `cnm`, an agent runtime. The maintainer MUST NOT interpret the value; it is an opaque partition name. Namespaces are first-come and unreserved, so an application SHOULD pick a stable, specific one: a future per-namespace ACL would grant on this exact string, which makes renaming a namespace a migration rather than an edit.";
|
|
448
|
+
readonly type: "string";
|
|
449
|
+
readonly minLength: 1;
|
|
450
|
+
readonly maxLength: 64;
|
|
451
|
+
readonly pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$";
|
|
452
|
+
};
|
|
453
|
+
readonly ExpectedVersion: {
|
|
454
|
+
readonly title: "ExpectedVersion";
|
|
455
|
+
readonly description: "Optimistic-concurrency precondition on a write. A positive value requires that the record's current `version` equals it exactly. Zero means \"create only\" — the write applies only if no LIVE record exists at the address, which is what makes lease acquisition safe: without it two instances can each read \"absent\", each write, and each believe it won. A tombstone is not a live record, so `expectedVersion: 0` succeeds over one; the created record takes the namespace's next counter value, which is necessarily greater than the tombstone's.";
|
|
456
|
+
readonly type: "integer";
|
|
457
|
+
readonly minimum: 0;
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
/**
|
|
463
|
+
* SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
|
|
464
|
+
* tracks the *issuer* party's requirement because a response swaps the
|
|
465
|
+
* parties (§7.3 item 5).
|
|
466
|
+
*/
|
|
467
|
+
export declare const RESPONSE_SPEC: {
|
|
468
|
+
readonly typeUri: "https://trusttasks.org/spec/vta/app-state/put/1.0#response";
|
|
469
|
+
readonly isBearer: false;
|
|
470
|
+
readonly isProofRequired: true;
|
|
471
|
+
readonly isRecipientRequired: true;
|
|
472
|
+
readonly payloadSchema: {
|
|
473
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
474
|
+
readonly $ref: "#/$defs/Response";
|
|
475
|
+
readonly $defs: {
|
|
476
|
+
readonly Response: {
|
|
477
|
+
readonly $anchor: "response";
|
|
478
|
+
readonly title: "VTA Application State Put — response payload";
|
|
479
|
+
readonly description: "Success response to vta/app-state/put. Type https://trusttasks.org/spec/vta/app-state/put/1.0#response. A failed precondition is not a success: it is a trust-task-error carrying vta/app-state/put:versionConflict, whose details carry the maintainer's current version and value.";
|
|
480
|
+
readonly type: "object";
|
|
481
|
+
readonly additionalProperties: false;
|
|
482
|
+
readonly required: readonly ["contextId", "namespace", "key", "version", "created", "updatedAt"];
|
|
483
|
+
readonly properties: {
|
|
484
|
+
readonly contextId: {
|
|
485
|
+
readonly type: "string";
|
|
486
|
+
readonly minLength: 1;
|
|
487
|
+
readonly description: "Echoed from the request.";
|
|
488
|
+
};
|
|
489
|
+
readonly namespace: {
|
|
490
|
+
readonly $ref: "#/$defs/Namespace";
|
|
491
|
+
};
|
|
492
|
+
readonly key: {
|
|
493
|
+
readonly $ref: "#/$defs/Key";
|
|
494
|
+
};
|
|
495
|
+
readonly version: {
|
|
496
|
+
readonly $ref: "#/$defs/Version";
|
|
497
|
+
readonly description: "The version this write took. Supply it as `expectedVersion` on the next write to chain conditional updates without an intervening read.";
|
|
498
|
+
};
|
|
499
|
+
readonly created: {
|
|
500
|
+
readonly type: "boolean";
|
|
501
|
+
readonly description: "True when no live record existed at the address beforehand — including when the address held a tombstone, since a tombstone is not a live record.";
|
|
502
|
+
};
|
|
503
|
+
readonly updatedAt: {
|
|
504
|
+
readonly type: "string";
|
|
505
|
+
readonly format: "date-time";
|
|
506
|
+
readonly description: "When the write was applied.";
|
|
507
|
+
};
|
|
508
|
+
readonly valueBytes: {
|
|
509
|
+
readonly type: "integer";
|
|
510
|
+
readonly minimum: 0;
|
|
511
|
+
readonly description: "Size of the stored value in bytes as the maintainer measured it against its per-record cap. Lets a writer see how close it is to the limit before it hits it.";
|
|
512
|
+
};
|
|
513
|
+
readonly ext: {
|
|
514
|
+
readonly $ref: "#/$defs/Ext";
|
|
515
|
+
readonly description: "Ecosystem-defined extension members per SPEC.md §4.5.1.";
|
|
516
|
+
};
|
|
517
|
+
};
|
|
518
|
+
};
|
|
519
|
+
readonly Ext: {
|
|
520
|
+
readonly title: "Ext";
|
|
521
|
+
readonly description: "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.";
|
|
522
|
+
readonly type: "object";
|
|
523
|
+
readonly minProperties: 1;
|
|
524
|
+
readonly additionalProperties: true;
|
|
525
|
+
readonly propertyNames: {
|
|
526
|
+
readonly pattern: "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$";
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
readonly Version: {
|
|
530
|
+
readonly title: "Version";
|
|
531
|
+
readonly description: "A value of the namespace's monotonic write counter (see this schema's description). Server-assigned; a producer never chooses one.";
|
|
532
|
+
readonly type: "integer";
|
|
533
|
+
readonly minimum: 1;
|
|
534
|
+
};
|
|
535
|
+
readonly Key: {
|
|
536
|
+
readonly title: "Key";
|
|
537
|
+
readonly description: "Application-chosen identifier for a record within a namespace. Opaque to the maintainer: it MUST NOT be parsed, normalized, or case-folded, and prefix matching in `list` is a byte-prefix comparison over the UTF-8 encoding. Applications SHOULD use `/`-delimited hierarchical keys (`community/acme`, `contact/z6Mk…`) so that `prefix` can address a record family, but the delimiter is a convention between an application and itself — the maintainer attaches no meaning to it.";
|
|
538
|
+
readonly type: "string";
|
|
539
|
+
readonly minLength: 1;
|
|
540
|
+
readonly maxLength: 512;
|
|
541
|
+
readonly pattern: "^[^\\u0000]+$";
|
|
542
|
+
};
|
|
543
|
+
readonly Namespace: {
|
|
544
|
+
readonly title: "Namespace";
|
|
545
|
+
readonly description: "Scopes one application's records within a context, so several tools can share a context without colliding — `openvtc`, `cnm`, an agent runtime. The maintainer MUST NOT interpret the value; it is an opaque partition name. Namespaces are first-come and unreserved, so an application SHOULD pick a stable, specific one: a future per-namespace ACL would grant on this exact string, which makes renaming a namespace a migration rather than an edit.";
|
|
546
|
+
readonly type: "string";
|
|
547
|
+
readonly minLength: 1;
|
|
548
|
+
readonly maxLength: 64;
|
|
549
|
+
readonly pattern: "^[a-z][a-z0-9]*(-[a-z0-9]+)*$";
|
|
550
|
+
};
|
|
551
|
+
readonly ExpectedVersion: {
|
|
552
|
+
readonly title: "ExpectedVersion";
|
|
553
|
+
readonly description: "Optimistic-concurrency precondition on a write. A positive value requires that the record's current `version` equals it exactly. Zero means \"create only\" — the write applies only if no LIVE record exists at the address, which is what makes lease acquisition safe: without it two instances can each read \"absent\", each write, and each believe it won. A tombstone is not a live record, so `expectedVersion: 0` succeeds over one; the created record takes the namespace's next counter value, which is necessarily greater than the tombstone's.";
|
|
554
|
+
readonly type: "integer";
|
|
555
|
+
readonly minimum: 0;
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
};
|
|
560
|
+
//# sourceMappingURL=payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../../../src/vta/app-state/put/1.0/payload.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,GAAG,EAAE,GAAG,CAAC;IACT;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;KAClC,CAAC;IACF;;OAEG;IACH,UAAU,CAAC,EAAE,EAAE,CAAC;IAChB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,GAAG,CAAC,EAAE,GAAG,CAAC;CACX,GAAG;IACF,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAClC,CAAC;AACF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAC/B;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC;AACzB;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AACrC;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,GAAG;IAClB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAClC;AACD;;GAEG;AACH,MAAM,WAAW,qCAAqC;IACpD;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AACD;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAClC;AAED,2BAA2B;AAC3B,eAAO,MAAM,QAAQ,EAAG,mDAA4D,CAAC;AAErF,mEAAmE;AACnE,MAAM,MAAM,OAAO,GAAG,6BAA6B,CAAC;AAEpD,qEAAqE;AACrE,eAAO,MAAM,iBAAiB,EAAG,4DAAqE,CAAC;AAEvG,4EAA4E;AAC5E,MAAM,MAAM,QAAQ,GAAG,qCAAqC,CAAC;AAE7D;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwJjB,CAAC;AAEX,mEAAmE;AACnE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6F1B,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMP,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMhB,CAAC"}
|