@openvtc/trust-tasks 0.12.1 → 0.12.3
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,509 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
|
|
3
|
+
* Source: specs/vta/app-state/list/1.0/payload.schema.json
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Restrict to one namespace. Optional in snapshot mode, where omitting it enumerates every namespace the caller can read in the context. REQUIRED in change-feed mode, because the version counter `sinceVersion` is compared against is maintained per (contextId, namespace) and a watermark spanning namespaces would name no single point in time.
|
|
8
|
+
*/
|
|
9
|
+
export type Namespace = string;
|
|
10
|
+
/**
|
|
11
|
+
* 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.
|
|
12
|
+
*/
|
|
13
|
+
export type Namespace1 = string;
|
|
14
|
+
/**
|
|
15
|
+
* 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.
|
|
16
|
+
*/
|
|
17
|
+
export type Key = string;
|
|
18
|
+
/**
|
|
19
|
+
* The namespace counter value this record's most recent write took. Supply it as `expectedVersion` on the next write to make that write conditional on nothing having changed in between.
|
|
20
|
+
*/
|
|
21
|
+
export type Version = number;
|
|
22
|
+
/**
|
|
23
|
+
* The namespace's current counter value. Present whenever `namespace` was supplied. This is what a consumer stores as its next `sinceVersion` — NOT the maximum version among `records`, which is wrong whenever a `prefix` filtered a later change out, and undefined when the page is empty. A paginating consumer MUST NOT advance its stored watermark until it has drained the final page, because the pages of one feed share this value and adopting it early would skip the records still to come.
|
|
24
|
+
*/
|
|
25
|
+
export type Version1 = number;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Enumerate application-state records in a context. Two modes, distinguished by whether `sinceVersion` is supplied. Without it this is a SNAPSHOT of live records, optionally narrowed by `prefix`. With it this is a CHANGE FEED: every record in the namespace whose version exceeds the watermark, tombstones included, which is what lets an incremental consumer converge. Pagination is opaque-cursor based.
|
|
29
|
+
*/
|
|
30
|
+
export interface VTAApplicationStateListPayload {
|
|
31
|
+
/**
|
|
32
|
+
* The VTA context to enumerate; the isolation boundary.
|
|
33
|
+
*/
|
|
34
|
+
contextId: string;
|
|
35
|
+
namespace?: Namespace;
|
|
36
|
+
/**
|
|
37
|
+
* Restrict to records whose `key` begins with this byte prefix, compared over the UTF-8 encoding. Lets a consumer read one record family — `community/`, `contact/` — without dragging every record in the namespace through the response.
|
|
38
|
+
*/
|
|
39
|
+
prefix?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Watermark. Selects change-feed mode: only records whose `version` is strictly greater are returned, tombstones included. Supply the `highWatermark` from the previous sync, or 0 for a first full pull in change-feed form. Requires `namespace`.
|
|
42
|
+
*/
|
|
43
|
+
sinceVersion?: number;
|
|
44
|
+
/**
|
|
45
|
+
* When true, each returned record carries its `value`. Defaults to false, which returns the metadata view — address, version, timestamps, `valueBytes` — so a prefix scan is cheap. Setting it makes a scan one round trip rather than a scan plus N gets, at the cost of the response carrying every value.
|
|
46
|
+
*/
|
|
47
|
+
includeValues?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Snapshot mode only: when true, tombstones still inside the retention window are returned alongside live records. Defaults to false. In change-feed mode tombstones are always returned and this member MUST NOT be set to false — a change feed that omits deletions cannot converge, so asking for one is a contradiction rather than a preference.
|
|
50
|
+
*/
|
|
51
|
+
includeDeleted?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Caller's upper bound on records per page. The maintainer applies its own ceiling and MAY return fewer — notably when `includeValues` is set and the values are large.
|
|
54
|
+
*/
|
|
55
|
+
pageSize?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Opaque continuation token from a previous response. Consumers MUST treat it as opaque: never construct, decode, mutate, or infer meaning from one.
|
|
58
|
+
*/
|
|
59
|
+
cursor?: string;
|
|
60
|
+
ext?: Ext;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Ecosystem-defined extension members per SPEC.md §4.5.1.
|
|
64
|
+
*/
|
|
65
|
+
export interface Ext {
|
|
66
|
+
[k: string]: unknown | undefined;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Success response to vta/app-state/list. Type https://trusttasks.org/spec/vta/app-state/list/1.0#response.
|
|
70
|
+
*/
|
|
71
|
+
export interface VTAApplicationStateListResponsePayload {
|
|
72
|
+
/**
|
|
73
|
+
* Matching records in ascending key order in snapshot mode, and ascending version order in change-feed mode — the latter so that a consumer applying them in order reaches the same state as the maintainer. May be empty.
|
|
74
|
+
*/
|
|
75
|
+
records: AppStateRecord[];
|
|
76
|
+
/**
|
|
77
|
+
* True when more matching records exist beyond this page.
|
|
78
|
+
*/
|
|
79
|
+
truncated: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Opaque continuation token for the next page. Present only when `truncated` is true.
|
|
82
|
+
*/
|
|
83
|
+
cursor?: string;
|
|
84
|
+
highWatermark?: Version1;
|
|
85
|
+
/**
|
|
86
|
+
* How long this maintainer retains tombstones before reaping them. Advisory, and present at the maintainer's discretion, so a consumer can schedule its syncs to stay inside the window rather than discovering it has fallen out of it via vta/app-state/list:watermarkTooOld.
|
|
87
|
+
*/
|
|
88
|
+
tombstoneRetentionSeconds?: number;
|
|
89
|
+
ext?: Ext1;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* A record as the maintainer holds it. `value` is absent in three distinct situations and a consumer MUST NOT conflate them: the record is a tombstone (`deleted` is true); the caller asked for a metadata-only view (`list` without `includeValues`); or the value genuinely is the JSON literal `null`, in which case `value` is PRESENT and null. This is why `deleted` is required rather than defaulted — a consumer that has to infer deletion from an absent value gets the tombstone case wrong exactly when convergence depends on it.
|
|
93
|
+
*/
|
|
94
|
+
export interface AppStateRecord {
|
|
95
|
+
/**
|
|
96
|
+
* The VTA context the record is scoped to; the isolation boundary.
|
|
97
|
+
*/
|
|
98
|
+
contextId: string;
|
|
99
|
+
namespace: Namespace1;
|
|
100
|
+
key: Key;
|
|
101
|
+
version: Version;
|
|
102
|
+
/**
|
|
103
|
+
* The stored JSON, in whatever shape the owning application chose. Any JSON value, including `null`. The maintainer neither validates nor interprets it. Absent when this is a tombstone or a metadata-only view — see this definition's description for why that is not the same as a null value.
|
|
104
|
+
*/
|
|
105
|
+
value?: {
|
|
106
|
+
[k: string]: unknown | undefined;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Size of the stored value in bytes, measured as the maintainer measures it for the per-record cap (see `vta/app-state/put`). Present in metadata-only views so a consumer can decide what to fetch without fetching it; absent on a tombstone.
|
|
110
|
+
*/
|
|
111
|
+
valueBytes?: number;
|
|
112
|
+
/**
|
|
113
|
+
* True when this is a tombstone: the record was deleted, and this entry exists so that a consumer syncing incrementally learns of the deletion. Tombstones are reaped after the maintainer's retention window; see `vta/app-state/list`.
|
|
114
|
+
*/
|
|
115
|
+
deleted: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* When the record was first created at this address. MAY be absent on a tombstone whose body has been discarded.
|
|
118
|
+
*/
|
|
119
|
+
createdAt?: string;
|
|
120
|
+
/**
|
|
121
|
+
* When the write that produced this `version` was applied. For a tombstone, when the delete was applied.
|
|
122
|
+
*/
|
|
123
|
+
updatedAt: string;
|
|
124
|
+
/**
|
|
125
|
+
* When the record was deleted. Present only when `deleted` is true; equal to `updatedAt` for a tombstone the maintainer has not since rewritten.
|
|
126
|
+
*/
|
|
127
|
+
deletedAt?: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Ecosystem-defined extension members per SPEC.md §4.5.1.
|
|
131
|
+
*/
|
|
132
|
+
export interface Ext1 {
|
|
133
|
+
[k: string]: unknown | undefined;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** Trust Task type URI. */
|
|
137
|
+
export const TYPE_URI = "https://trusttasks.org/spec/vta/app-state/list/1.0" as const;
|
|
138
|
+
|
|
139
|
+
/** Stable alias for this specification's request payload shape. */
|
|
140
|
+
export type Payload = VTAApplicationStateListPayload;
|
|
141
|
+
|
|
142
|
+
/** Trust Task response type URI (request type URI + "#response"). */
|
|
143
|
+
export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/vta/app-state/list/1.0#response" as const;
|
|
144
|
+
|
|
145
|
+
/** Stable alias for this specification's success-response payload shape. */
|
|
146
|
+
export type Response = VTAApplicationStateListResponsePayload;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* This specification's payload schema, as a value.
|
|
150
|
+
*
|
|
151
|
+
* SPEC.md §7.2 item 2 is performed against this. It is shipped as data
|
|
152
|
+
* rather than only as a `.json` file because TypeScript types are erased
|
|
153
|
+
* at runtime: without a schema a consumer has nothing to validate, and
|
|
154
|
+
* every REQUIRED payload member is optional in practice. Cross-file
|
|
155
|
+
* `$ref`s are already inlined, so it needs no resolver.
|
|
156
|
+
*/
|
|
157
|
+
export const PAYLOAD_SCHEMA = {
|
|
158
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
159
|
+
"$id": "https://trusttasks.org/spec/vta/app-state/list/1.0",
|
|
160
|
+
"title": "VTA Application State List — payload",
|
|
161
|
+
"description": "Enumerate application-state records in a context. Two modes, distinguished by whether `sinceVersion` is supplied. Without it this is a SNAPSHOT of live records, optionally narrowed by `prefix`. With it this is a CHANGE FEED: every record in the namespace whose version exceeds the watermark, tombstones included, which is what lets an incremental consumer converge. Pagination is opaque-cursor based.",
|
|
162
|
+
"type": "object",
|
|
163
|
+
"additionalProperties": false,
|
|
164
|
+
"required": [
|
|
165
|
+
"contextId"
|
|
166
|
+
],
|
|
167
|
+
"properties": {
|
|
168
|
+
"contextId": {
|
|
169
|
+
"type": "string",
|
|
170
|
+
"minLength": 1,
|
|
171
|
+
"description": "The VTA context to enumerate; the isolation boundary."
|
|
172
|
+
},
|
|
173
|
+
"namespace": {
|
|
174
|
+
"$ref": "#/$defs/Namespace",
|
|
175
|
+
"description": "Restrict to one namespace. Optional in snapshot mode, where omitting it enumerates every namespace the caller can read in the context. REQUIRED in change-feed mode, because the version counter `sinceVersion` is compared against is maintained per (contextId, namespace) and a watermark spanning namespaces would name no single point in time."
|
|
176
|
+
},
|
|
177
|
+
"prefix": {
|
|
178
|
+
"type": "string",
|
|
179
|
+
"maxLength": 512,
|
|
180
|
+
"description": "Restrict to records whose `key` begins with this byte prefix, compared over the UTF-8 encoding. Lets a consumer read one record family — `community/`, `contact/` — without dragging every record in the namespace through the response."
|
|
181
|
+
},
|
|
182
|
+
"sinceVersion": {
|
|
183
|
+
"type": "integer",
|
|
184
|
+
"minimum": 0,
|
|
185
|
+
"description": "Watermark. Selects change-feed mode: only records whose `version` is strictly greater are returned, tombstones included. Supply the `highWatermark` from the previous sync, or 0 for a first full pull in change-feed form. Requires `namespace`."
|
|
186
|
+
},
|
|
187
|
+
"includeValues": {
|
|
188
|
+
"type": "boolean",
|
|
189
|
+
"description": "When true, each returned record carries its `value`. Defaults to false, which returns the metadata view — address, version, timestamps, `valueBytes` — so a prefix scan is cheap. Setting it makes a scan one round trip rather than a scan plus N gets, at the cost of the response carrying every value."
|
|
190
|
+
},
|
|
191
|
+
"includeDeleted": {
|
|
192
|
+
"type": "boolean",
|
|
193
|
+
"description": "Snapshot mode only: when true, tombstones still inside the retention window are returned alongside live records. Defaults to false. In change-feed mode tombstones are always returned and this member MUST NOT be set to false — a change feed that omits deletions cannot converge, so asking for one is a contradiction rather than a preference."
|
|
194
|
+
},
|
|
195
|
+
"pageSize": {
|
|
196
|
+
"type": "integer",
|
|
197
|
+
"minimum": 1,
|
|
198
|
+
"maximum": 1000,
|
|
199
|
+
"description": "Caller's upper bound on records per page. The maintainer applies its own ceiling and MAY return fewer — notably when `includeValues` is set and the values are large."
|
|
200
|
+
},
|
|
201
|
+
"cursor": {
|
|
202
|
+
"type": "string",
|
|
203
|
+
"description": "Opaque continuation token from a previous response. Consumers MUST treat it as opaque: never construct, decode, mutate, or infer meaning from one."
|
|
204
|
+
},
|
|
205
|
+
"ext": {
|
|
206
|
+
"$ref": "#/$defs/Ext",
|
|
207
|
+
"description": "Ecosystem-defined extension members per SPEC.md §4.5.1."
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"$defs": {
|
|
211
|
+
"Response": {
|
|
212
|
+
"$anchor": "response",
|
|
213
|
+
"title": "VTA Application State List — response payload",
|
|
214
|
+
"description": "Success response to vta/app-state/list. Type https://trusttasks.org/spec/vta/app-state/list/1.0#response.",
|
|
215
|
+
"type": "object",
|
|
216
|
+
"additionalProperties": false,
|
|
217
|
+
"required": [
|
|
218
|
+
"records",
|
|
219
|
+
"truncated"
|
|
220
|
+
],
|
|
221
|
+
"properties": {
|
|
222
|
+
"records": {
|
|
223
|
+
"type": "array",
|
|
224
|
+
"items": {
|
|
225
|
+
"$ref": "#/$defs/AppStateRecord"
|
|
226
|
+
},
|
|
227
|
+
"description": "Matching records in ascending key order in snapshot mode, and ascending version order in change-feed mode — the latter so that a consumer applying them in order reaches the same state as the maintainer. May be empty."
|
|
228
|
+
},
|
|
229
|
+
"truncated": {
|
|
230
|
+
"type": "boolean",
|
|
231
|
+
"description": "True when more matching records exist beyond this page."
|
|
232
|
+
},
|
|
233
|
+
"cursor": {
|
|
234
|
+
"type": "string",
|
|
235
|
+
"description": "Opaque continuation token for the next page. Present only when `truncated` is true."
|
|
236
|
+
},
|
|
237
|
+
"highWatermark": {
|
|
238
|
+
"$ref": "#/$defs/Version",
|
|
239
|
+
"description": "The namespace's current counter value. Present whenever `namespace` was supplied. This is what a consumer stores as its next `sinceVersion` — NOT the maximum version among `records`, which is wrong whenever a `prefix` filtered a later change out, and undefined when the page is empty. A paginating consumer MUST NOT advance its stored watermark until it has drained the final page, because the pages of one feed share this value and adopting it early would skip the records still to come."
|
|
240
|
+
},
|
|
241
|
+
"tombstoneRetentionSeconds": {
|
|
242
|
+
"type": "integer",
|
|
243
|
+
"minimum": 0,
|
|
244
|
+
"description": "How long this maintainer retains tombstones before reaping them. Advisory, and present at the maintainer's discretion, so a consumer can schedule its syncs to stay inside the window rather than discovering it has fallen out of it via vta/app-state/list:watermarkTooOld."
|
|
245
|
+
},
|
|
246
|
+
"ext": {
|
|
247
|
+
"$ref": "#/$defs/Ext",
|
|
248
|
+
"description": "Ecosystem-defined extension members per SPEC.md §4.5.1."
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"Ext": {
|
|
253
|
+
"title": "Ext",
|
|
254
|
+
"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.",
|
|
255
|
+
"type": "object",
|
|
256
|
+
"minProperties": 1,
|
|
257
|
+
"additionalProperties": true,
|
|
258
|
+
"propertyNames": {
|
|
259
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"Version": {
|
|
263
|
+
"title": "Version",
|
|
264
|
+
"description": "A value of the namespace's monotonic write counter (see this schema's description). Server-assigned; a producer never chooses one.",
|
|
265
|
+
"type": "integer",
|
|
266
|
+
"minimum": 1
|
|
267
|
+
},
|
|
268
|
+
"AppStateRecord": {
|
|
269
|
+
"title": "AppStateRecord",
|
|
270
|
+
"description": "A record as the maintainer holds it. `value` is absent in three distinct situations and a consumer MUST NOT conflate them: the record is a tombstone (`deleted` is true); the caller asked for a metadata-only view (`list` without `includeValues`); or the value genuinely is the JSON literal `null`, in which case `value` is PRESENT and null. This is why `deleted` is required rather than defaulted — a consumer that has to infer deletion from an absent value gets the tombstone case wrong exactly when convergence depends on it.",
|
|
271
|
+
"type": "object",
|
|
272
|
+
"additionalProperties": false,
|
|
273
|
+
"required": [
|
|
274
|
+
"contextId",
|
|
275
|
+
"namespace",
|
|
276
|
+
"key",
|
|
277
|
+
"version",
|
|
278
|
+
"deleted",
|
|
279
|
+
"updatedAt"
|
|
280
|
+
],
|
|
281
|
+
"properties": {
|
|
282
|
+
"contextId": {
|
|
283
|
+
"type": "string",
|
|
284
|
+
"minLength": 1,
|
|
285
|
+
"description": "The VTA context the record is scoped to; the isolation boundary."
|
|
286
|
+
},
|
|
287
|
+
"namespace": {
|
|
288
|
+
"$ref": "#/$defs/Namespace"
|
|
289
|
+
},
|
|
290
|
+
"key": {
|
|
291
|
+
"$ref": "#/$defs/Key"
|
|
292
|
+
},
|
|
293
|
+
"version": {
|
|
294
|
+
"$ref": "#/$defs/Version",
|
|
295
|
+
"description": "The namespace counter value this record's most recent write took. Supply it as `expectedVersion` on the next write to make that write conditional on nothing having changed in between."
|
|
296
|
+
},
|
|
297
|
+
"value": {
|
|
298
|
+
"description": "The stored JSON, in whatever shape the owning application chose. Any JSON value, including `null`. The maintainer neither validates nor interprets it. Absent when this is a tombstone or a metadata-only view — see this definition's description for why that is not the same as a null value."
|
|
299
|
+
},
|
|
300
|
+
"valueBytes": {
|
|
301
|
+
"type": "integer",
|
|
302
|
+
"minimum": 0,
|
|
303
|
+
"description": "Size of the stored value in bytes, measured as the maintainer measures it for the per-record cap (see `vta/app-state/put`). Present in metadata-only views so a consumer can decide what to fetch without fetching it; absent on a tombstone."
|
|
304
|
+
},
|
|
305
|
+
"deleted": {
|
|
306
|
+
"type": "boolean",
|
|
307
|
+
"description": "True when this is a tombstone: the record was deleted, and this entry exists so that a consumer syncing incrementally learns of the deletion. Tombstones are reaped after the maintainer's retention window; see `vta/app-state/list`."
|
|
308
|
+
},
|
|
309
|
+
"createdAt": {
|
|
310
|
+
"type": "string",
|
|
311
|
+
"format": "date-time",
|
|
312
|
+
"description": "When the record was first created at this address. MAY be absent on a tombstone whose body has been discarded."
|
|
313
|
+
},
|
|
314
|
+
"updatedAt": {
|
|
315
|
+
"type": "string",
|
|
316
|
+
"format": "date-time",
|
|
317
|
+
"description": "When the write that produced this `version` was applied. For a tombstone, when the delete was applied."
|
|
318
|
+
},
|
|
319
|
+
"deletedAt": {
|
|
320
|
+
"type": "string",
|
|
321
|
+
"format": "date-time",
|
|
322
|
+
"description": "When the record was deleted. Present only when `deleted` is true; equal to `updatedAt` for a tombstone the maintainer has not since rewritten."
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
"Key": {
|
|
327
|
+
"title": "Key",
|
|
328
|
+
"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.",
|
|
329
|
+
"type": "string",
|
|
330
|
+
"minLength": 1,
|
|
331
|
+
"maxLength": 512,
|
|
332
|
+
"pattern": "^[^\\u0000]+$"
|
|
333
|
+
},
|
|
334
|
+
"Namespace": {
|
|
335
|
+
"title": "Namespace",
|
|
336
|
+
"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.",
|
|
337
|
+
"type": "string",
|
|
338
|
+
"minLength": 1,
|
|
339
|
+
"maxLength": 64,
|
|
340
|
+
"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
} as const;
|
|
344
|
+
|
|
345
|
+
/** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
|
|
346
|
+
export const RESPONSE_PAYLOAD_SCHEMA = {
|
|
347
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
348
|
+
"$ref": "#/$defs/Response",
|
|
349
|
+
"$defs": {
|
|
350
|
+
"Response": {
|
|
351
|
+
"$anchor": "response",
|
|
352
|
+
"title": "VTA Application State List — response payload",
|
|
353
|
+
"description": "Success response to vta/app-state/list. Type https://trusttasks.org/spec/vta/app-state/list/1.0#response.",
|
|
354
|
+
"type": "object",
|
|
355
|
+
"additionalProperties": false,
|
|
356
|
+
"required": [
|
|
357
|
+
"records",
|
|
358
|
+
"truncated"
|
|
359
|
+
],
|
|
360
|
+
"properties": {
|
|
361
|
+
"records": {
|
|
362
|
+
"type": "array",
|
|
363
|
+
"items": {
|
|
364
|
+
"$ref": "#/$defs/AppStateRecord"
|
|
365
|
+
},
|
|
366
|
+
"description": "Matching records in ascending key order in snapshot mode, and ascending version order in change-feed mode — the latter so that a consumer applying them in order reaches the same state as the maintainer. May be empty."
|
|
367
|
+
},
|
|
368
|
+
"truncated": {
|
|
369
|
+
"type": "boolean",
|
|
370
|
+
"description": "True when more matching records exist beyond this page."
|
|
371
|
+
},
|
|
372
|
+
"cursor": {
|
|
373
|
+
"type": "string",
|
|
374
|
+
"description": "Opaque continuation token for the next page. Present only when `truncated` is true."
|
|
375
|
+
},
|
|
376
|
+
"highWatermark": {
|
|
377
|
+
"$ref": "#/$defs/Version",
|
|
378
|
+
"description": "The namespace's current counter value. Present whenever `namespace` was supplied. This is what a consumer stores as its next `sinceVersion` — NOT the maximum version among `records`, which is wrong whenever a `prefix` filtered a later change out, and undefined when the page is empty. A paginating consumer MUST NOT advance its stored watermark until it has drained the final page, because the pages of one feed share this value and adopting it early would skip the records still to come."
|
|
379
|
+
},
|
|
380
|
+
"tombstoneRetentionSeconds": {
|
|
381
|
+
"type": "integer",
|
|
382
|
+
"minimum": 0,
|
|
383
|
+
"description": "How long this maintainer retains tombstones before reaping them. Advisory, and present at the maintainer's discretion, so a consumer can schedule its syncs to stay inside the window rather than discovering it has fallen out of it via vta/app-state/list:watermarkTooOld."
|
|
384
|
+
},
|
|
385
|
+
"ext": {
|
|
386
|
+
"$ref": "#/$defs/Ext",
|
|
387
|
+
"description": "Ecosystem-defined extension members per SPEC.md §4.5.1."
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
"Ext": {
|
|
392
|
+
"title": "Ext",
|
|
393
|
+
"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.",
|
|
394
|
+
"type": "object",
|
|
395
|
+
"minProperties": 1,
|
|
396
|
+
"additionalProperties": true,
|
|
397
|
+
"propertyNames": {
|
|
398
|
+
"pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
"Version": {
|
|
402
|
+
"title": "Version",
|
|
403
|
+
"description": "A value of the namespace's monotonic write counter (see this schema's description). Server-assigned; a producer never chooses one.",
|
|
404
|
+
"type": "integer",
|
|
405
|
+
"minimum": 1
|
|
406
|
+
},
|
|
407
|
+
"AppStateRecord": {
|
|
408
|
+
"title": "AppStateRecord",
|
|
409
|
+
"description": "A record as the maintainer holds it. `value` is absent in three distinct situations and a consumer MUST NOT conflate them: the record is a tombstone (`deleted` is true); the caller asked for a metadata-only view (`list` without `includeValues`); or the value genuinely is the JSON literal `null`, in which case `value` is PRESENT and null. This is why `deleted` is required rather than defaulted — a consumer that has to infer deletion from an absent value gets the tombstone case wrong exactly when convergence depends on it.",
|
|
410
|
+
"type": "object",
|
|
411
|
+
"additionalProperties": false,
|
|
412
|
+
"required": [
|
|
413
|
+
"contextId",
|
|
414
|
+
"namespace",
|
|
415
|
+
"key",
|
|
416
|
+
"version",
|
|
417
|
+
"deleted",
|
|
418
|
+
"updatedAt"
|
|
419
|
+
],
|
|
420
|
+
"properties": {
|
|
421
|
+
"contextId": {
|
|
422
|
+
"type": "string",
|
|
423
|
+
"minLength": 1,
|
|
424
|
+
"description": "The VTA context the record is scoped to; the isolation boundary."
|
|
425
|
+
},
|
|
426
|
+
"namespace": {
|
|
427
|
+
"$ref": "#/$defs/Namespace"
|
|
428
|
+
},
|
|
429
|
+
"key": {
|
|
430
|
+
"$ref": "#/$defs/Key"
|
|
431
|
+
},
|
|
432
|
+
"version": {
|
|
433
|
+
"$ref": "#/$defs/Version",
|
|
434
|
+
"description": "The namespace counter value this record's most recent write took. Supply it as `expectedVersion` on the next write to make that write conditional on nothing having changed in between."
|
|
435
|
+
},
|
|
436
|
+
"value": {
|
|
437
|
+
"description": "The stored JSON, in whatever shape the owning application chose. Any JSON value, including `null`. The maintainer neither validates nor interprets it. Absent when this is a tombstone or a metadata-only view — see this definition's description for why that is not the same as a null value."
|
|
438
|
+
},
|
|
439
|
+
"valueBytes": {
|
|
440
|
+
"type": "integer",
|
|
441
|
+
"minimum": 0,
|
|
442
|
+
"description": "Size of the stored value in bytes, measured as the maintainer measures it for the per-record cap (see `vta/app-state/put`). Present in metadata-only views so a consumer can decide what to fetch without fetching it; absent on a tombstone."
|
|
443
|
+
},
|
|
444
|
+
"deleted": {
|
|
445
|
+
"type": "boolean",
|
|
446
|
+
"description": "True when this is a tombstone: the record was deleted, and this entry exists so that a consumer syncing incrementally learns of the deletion. Tombstones are reaped after the maintainer's retention window; see `vta/app-state/list`."
|
|
447
|
+
},
|
|
448
|
+
"createdAt": {
|
|
449
|
+
"type": "string",
|
|
450
|
+
"format": "date-time",
|
|
451
|
+
"description": "When the record was first created at this address. MAY be absent on a tombstone whose body has been discarded."
|
|
452
|
+
},
|
|
453
|
+
"updatedAt": {
|
|
454
|
+
"type": "string",
|
|
455
|
+
"format": "date-time",
|
|
456
|
+
"description": "When the write that produced this `version` was applied. For a tombstone, when the delete was applied."
|
|
457
|
+
},
|
|
458
|
+
"deletedAt": {
|
|
459
|
+
"type": "string",
|
|
460
|
+
"format": "date-time",
|
|
461
|
+
"description": "When the record was deleted. Present only when `deleted` is true; equal to `updatedAt` for a tombstone the maintainer has not since rewritten."
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
"Key": {
|
|
466
|
+
"title": "Key",
|
|
467
|
+
"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.",
|
|
468
|
+
"type": "string",
|
|
469
|
+
"minLength": 1,
|
|
470
|
+
"maxLength": 512,
|
|
471
|
+
"pattern": "^[^\\u0000]+$"
|
|
472
|
+
},
|
|
473
|
+
"Namespace": {
|
|
474
|
+
"title": "Namespace",
|
|
475
|
+
"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.",
|
|
476
|
+
"type": "string",
|
|
477
|
+
"minLength": 1,
|
|
478
|
+
"maxLength": 64,
|
|
479
|
+
"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
} as const;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* SPEC.md §7.2 policy for the request variant, from this specification's
|
|
486
|
+
* front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
|
|
487
|
+
* per-specification and cannot be derived from the document alone, and
|
|
488
|
+
* item 2 needs the schema this carries.
|
|
489
|
+
*/
|
|
490
|
+
export const SPEC = {
|
|
491
|
+
typeUri: TYPE_URI,
|
|
492
|
+
isBearer: false,
|
|
493
|
+
isProofRequired: false,
|
|
494
|
+
isRecipientRequired: true,
|
|
495
|
+
payloadSchema: PAYLOAD_SCHEMA,
|
|
496
|
+
} as const;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
|
|
500
|
+
* tracks the *issuer* party's requirement because a response swaps the
|
|
501
|
+
* parties (§7.3 item 5).
|
|
502
|
+
*/
|
|
503
|
+
export const RESPONSE_SPEC = {
|
|
504
|
+
typeUri: RESPONSE_TYPE_URI,
|
|
505
|
+
isBearer: false,
|
|
506
|
+
isProofRequired: false,
|
|
507
|
+
isRecipientRequired: true,
|
|
508
|
+
payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
|
|
509
|
+
} as const;
|