@fleetless/contracts 15.0.1 → 15.1.0-next.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/CHANGELOG.md +22 -0
- package/artifacts/schema/journal-deletion-manifest.schema.json +285 -4
- package/artifacts/schema/journal-intent-v2-body.schema.json +180 -0
- package/artifacts/schema/journal-intent-v2.schema.json +200 -0
- package/artifacts/schema/journal-manifest-batch.schema.json +182 -3
- package/artifacts/schema/journal-manifest-binding.schema.json +361 -4
- package/artifacts/schema/journal-manifest-intent-projection.schema.json +76 -0
- package/artifacts/schema/journal-manifest-row.schema.json +90 -1
- package/artifacts/schema/journal-manifest-scope.schema.json +13 -0
- package/artifacts/schema/journal-replay-receipt-body.schema.json +2 -0
- package/artifacts/schema/journal-replay-receipt.schema.json +2 -0
- package/dist/journal-intents.d.ts +72 -0
- package/dist/journal-intents.js +4 -0
- package/dist/journal-manifests.d.ts +297 -0
- package/dist/journal-manifests.js +46 -1
- package/package.json +1 -1
|
@@ -17,12 +17,21 @@ export const journalManifestScope = z.union([
|
|
|
17
17
|
z.strictObject({ kind: z.literal('console_oauth') }),
|
|
18
18
|
z.strictObject({ kind: z.literal('global_ops_event') }),
|
|
19
19
|
z.strictObject({ kind: z.literal('operator_audit') }),
|
|
20
|
+
z.strictObject({ kind: z.literal('waitlist') }),
|
|
20
21
|
z.strictObject({ kind: z.literal('subject'), subject_kind: z.enum(['developer', 'app_user']), subject_id: uuid }),
|
|
21
22
|
]);
|
|
22
23
|
const uuidRowTable = z.enum([
|
|
23
24
|
'assets', 'audit_events', 'job_runs', 'oidc_interactions',
|
|
24
25
|
'organization_exports', 'ops_notification_jobs', 'console_oauth_codes',
|
|
26
|
+
'waitlist', 'waitlist_invitations', 'waitlist_invitation_proofs', 'waitlist_consents',
|
|
25
27
|
]);
|
|
28
|
+
/**
|
|
29
|
+
* The operator mail effects that concern the waiting list. The outbox and its
|
|
30
|
+
* deliveries are shared with billing and plan-change effects, so a waiting-list
|
|
31
|
+
* member names the effect's source action and replay deletes a row only when
|
|
32
|
+
* it still has it: no manifest can make a restore delete another effect.
|
|
33
|
+
*/
|
|
34
|
+
const waitlistMailAction = z.enum(['waitlist_invite', 'waitlist_reinvite', 'waitlist_decline', 'waitlist_confirm']);
|
|
26
35
|
const member = { membership_kind: membership };
|
|
27
36
|
// Retention sweeps name an expired time range instead of every deleted row.
|
|
28
37
|
const retentionRangeTable = z.enum(['datapoint_series_samples', 'bridge_latency_buckets']);
|
|
@@ -46,6 +55,15 @@ export const journalManifestRow = z.union([
|
|
|
46
55
|
z.strictObject({ ...member, type: z.literal('global_ops_event'), event_id: uuid }),
|
|
47
56
|
z.strictObject({ ...member, type: z.literal('org_operator_audit'), org_id: uuid, audit_id: uuid }),
|
|
48
57
|
z.strictObject({ ...member, type: z.literal('global_operator_audit'), audit_id: uuid }),
|
|
58
|
+
z.strictObject({
|
|
59
|
+
...member, type: z.literal('waitlist_mail_effect'), effect_id: uuid,
|
|
60
|
+
source_action: waitlistMailAction.meta({ description: 'The source action the operator_effect_outbox row had when it was frozen; replay deletes the row only if it still has it.' }),
|
|
61
|
+
}),
|
|
62
|
+
z.strictObject({
|
|
63
|
+
...member, type: z.literal('waitlist_mail_delivery'), delivery_id: uuid, effect_id: uuid,
|
|
64
|
+
entry_id: uuid.meta({ description: 'The waiting-list entry the delivery was addressed for (its target); the entry itself may already be gone.' }),
|
|
65
|
+
source_action: waitlistMailAction.meta({ description: 'The source action of the delivery\'s effect when it was frozen; replay deletes the delivery only if its effect still has it.' }),
|
|
66
|
+
}),
|
|
49
67
|
z.strictObject({
|
|
50
68
|
type: z.literal('retention_range'),
|
|
51
69
|
membership_kind: z.literal('affected'),
|
|
@@ -85,7 +103,7 @@ const sweepKinds = [
|
|
|
85
103
|
'ops_event.retention', 'ops_global_event.retention', 'operator_audit.retention',
|
|
86
104
|
'oidc_interaction.expire', 'mcp_interaction.expire', 'mcp_central_interaction.expire',
|
|
87
105
|
'mcp_client.expire', 'mcp_central_client.expire', 'console_interaction.expire',
|
|
88
|
-
'console_code.expire',
|
|
106
|
+
'console_code.expire', 'waitlist.retention',
|
|
89
107
|
];
|
|
90
108
|
const explicitKinds = ['history.slug_delete', 'robot_assets.clear'];
|
|
91
109
|
export const journalManifestBatch = z.union([
|
|
@@ -113,6 +131,8 @@ function rowKey(row) {
|
|
|
113
131
|
case 'global_ops_event': return JSON.stringify(['ops_events', row.event_id]);
|
|
114
132
|
case 'org_operator_audit':
|
|
115
133
|
case 'global_operator_audit': return JSON.stringify(['operator_audit', row.audit_id]);
|
|
134
|
+
case 'waitlist_mail_effect': return JSON.stringify(['operator_effect_outbox', row.effect_id]);
|
|
135
|
+
case 'waitlist_mail_delivery': return JSON.stringify(['operator_effect_mail_deliveries', row.delivery_id]);
|
|
116
136
|
case 'retention_range': return JSON.stringify([row.table, 'range', row.robot_id, row.series_id ?? null, row.from]);
|
|
117
137
|
}
|
|
118
138
|
}
|
|
@@ -140,6 +160,10 @@ const backedBranches = journalIntentV2Body.options.filter((branch) => 'manifest_
|
|
|
140
160
|
export const journalManifestIntentProjection = z.union(backedBranches.map((branch) => z.strictObject({
|
|
141
161
|
operation_id: branch.shape.operation_id, kind: branch.shape.kind, ids: branch.shape.ids,
|
|
142
162
|
})));
|
|
163
|
+
/** The waiting list's own tables. Their rows, and the waiting-list mail members, belong to the `waitlist` scope and to no other. */
|
|
164
|
+
const waitlistTables = new Set(['waitlist', 'waitlist_invitations', 'waitlist_invitation_proofs', 'waitlist_consents']);
|
|
165
|
+
const isWaitlistMember = (row) => (row.type === 'uuid_row' && waitlistTables.has(row.table))
|
|
166
|
+
|| row.type === 'waitlist_mail_effect' || row.type === 'waitlist_mail_delivery';
|
|
143
167
|
const nonOrganizationScope = {
|
|
144
168
|
'mcp_central_client.revoke': 'central_mcp',
|
|
145
169
|
'mcp_central_interaction.expire': 'central_mcp',
|
|
@@ -148,6 +172,8 @@ const nonOrganizationScope = {
|
|
|
148
172
|
'console_code.expire': 'console_oauth',
|
|
149
173
|
'ops_global_event.retention': 'global_ops_event',
|
|
150
174
|
'operator_audit.retention': 'operator_audit',
|
|
175
|
+
'waitlist.retention': 'waitlist',
|
|
176
|
+
'waitlist.withdrawal': 'waitlist',
|
|
151
177
|
'auth_factor.remove': 'subject',
|
|
152
178
|
};
|
|
153
179
|
const rangeTableOfKind = {
|
|
@@ -224,10 +250,29 @@ export const journalManifestBinding = z.strictObject({
|
|
|
224
250
|
console_oauth: (row) => row.type === 'console_interaction' || (row.type === 'uuid_row' && row.table === 'console_oauth_codes'),
|
|
225
251
|
global_ops_event: (row) => row.type === 'global_ops_event' || (row.type === 'uuid_row' && row.table === 'ops_notification_jobs'),
|
|
226
252
|
operator_audit: (row) => row.type === 'global_operator_audit' || row.type === 'org_operator_audit',
|
|
253
|
+
waitlist: isWaitlistMember,
|
|
227
254
|
};
|
|
228
255
|
const allows = allowedRows[manifest.scope.kind];
|
|
229
256
|
if (allows && !manifest.rows.every(allows))
|
|
230
257
|
problem('Row outside closed source scope', ['manifest', 'rows']);
|
|
258
|
+
if (manifest.scope.kind !== 'waitlist' && manifest.rows.some(isWaitlistMember))
|
|
259
|
+
problem('Waiting-list row outside the waitlist scope', ['manifest', 'rows']);
|
|
260
|
+
if (manifest.scope.kind === 'waitlist') {
|
|
261
|
+
// The waiting list has no objects: no mapping, so no free string can carry an address into this manifest.
|
|
262
|
+
if (manifest.entries.length !== 0)
|
|
263
|
+
problem('A waitlist manifest has no object entries', ['manifest', 'entries']);
|
|
264
|
+
if (intent.kind === 'waitlist.withdrawal') {
|
|
265
|
+
// One entry: exactly its own row, and mail deliveries addressed for it alone.
|
|
266
|
+
const entries = manifest.rows.filter((row) => row.type === 'uuid_row' && row.table === 'waitlist');
|
|
267
|
+
const only = entries[0];
|
|
268
|
+
if (entries.length !== 1 || only?.type !== 'uuid_row' || only.id !== ids.entry_id || only.membership_kind !== 'affected') {
|
|
269
|
+
problem('A withdrawal names exactly its own entry', ['manifest', 'rows']);
|
|
270
|
+
}
|
|
271
|
+
if (manifest.rows.some((row) => row.type === 'waitlist_mail_delivery' && row.entry_id !== ids.entry_id)) {
|
|
272
|
+
problem('A withdrawal deletes only its own entry\'s deliveries', ['manifest', 'rows']);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
231
276
|
const ranges = manifest.rows.filter((row) => row.type === 'retention_range');
|
|
232
277
|
if (ranges.length > 0)
|
|
233
278
|
for (const message of new Set(retentionRangeProblems(intent.kind, ids, ranges)))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetless/contracts",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.1.0-next.2",
|
|
4
4
|
"description": "Fleetless wire contracts: the bridge-cloud protocol, the REST API schemas and the error codes, as zod schemas with generated JSON Schema and OpenAPI artifacts.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Dehne Robotik GmbH",
|