@fleetless/contracts 12.1.0 → 13.0.1

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/artifacts/openapi.json +8431 -6164
  3. package/artifacts/routes.json +125 -3
  4. package/artifacts/schema/billing-change-response.schema.json +3 -3
  5. package/artifacts/schema/billing-decision-display-response.schema.json +749 -504
  6. package/artifacts/schema/billing-decision-period.schema.json +573 -504
  7. package/artifacts/schema/billing-decision-snapshot.schema.json +749 -504
  8. package/artifacts/schema/billing-invoice-pdf-query.schema.json +1 -1
  9. package/artifacts/schema/billing-invoice.schema.json +1 -1
  10. package/artifacts/schema/billing-view.schema.json +1 -1
  11. package/artifacts/schema/journal-access-proof.schema.json +342 -0
  12. package/artifacts/schema/journal-deletion-manifest.schema.json +2103 -0
  13. package/artifacts/schema/journal-evidence-ref.schema.json +596 -0
  14. package/artifacts/schema/journal-export-item.schema.json +2910 -0
  15. package/artifacts/schema/journal-final-seal-body.schema.json +160 -0
  16. package/artifacts/schema/journal-final-seal.schema.json +169 -0
  17. package/artifacts/schema/journal-first-checkpoint-body.schema.json +101 -0
  18. package/artifacts/schema/journal-first-checkpoint.schema.json +111 -0
  19. package/artifacts/schema/journal-generation-checkpoint-body.schema.json +88 -0
  20. package/artifacts/schema/journal-generation-checkpoint.schema.json +97 -0
  21. package/artifacts/schema/journal-intent-v2-body.schema.json +4166 -0
  22. package/artifacts/schema/journal-intent-v2.schema.json +4616 -0
  23. package/artifacts/schema/journal-manifest-batch.schema.json +1236 -0
  24. package/artifacts/schema/journal-manifest-binding.schema.json +3541 -0
  25. package/artifacts/schema/journal-manifest-entry.schema.json +106 -0
  26. package/artifacts/schema/journal-manifest-intent-projection.schema.json +1428 -0
  27. package/artifacts/schema/journal-manifest-row.schema.json +578 -0
  28. package/artifacts/schema/journal-manifest-scope.schema.json +135 -0
  29. package/artifacts/schema/journal-mirror-attempt.schema.json +182 -0
  30. package/artifacts/schema/journal-mixed-export.schema.json +3115 -0
  31. package/artifacts/schema/journal-registry-activation-receipt-body.schema.json +304 -0
  32. package/artifacts/schema/journal-registry-activation-receipt.schema.json +324 -0
  33. package/artifacts/schema/journal-registry-transition-body.schema.json +113 -0
  34. package/artifacts/schema/journal-registry-transition.schema.json +123 -0
  35. package/artifacts/schema/journal-replay-receipt-body.schema.json +1252 -0
  36. package/artifacts/schema/journal-replay-receipt.schema.json +1261 -0
  37. package/artifacts/schema/journal-v2-activation-checkpoint-body.schema.json +99 -0
  38. package/artifacts/schema/journal-v2-activation-checkpoint.schema.json +108 -0
  39. package/artifacts/schema/legal-acceptance-list-response.schema.json +31 -2
  40. package/artifacts/schema/legal-acceptance-version-row.schema.json +31 -2
  41. package/artifacts/schema/legal-offer-conflict-details.schema.json +32 -0
  42. package/artifacts/schema/legal-offer-decision-lookup-query.schema.json +16 -0
  43. package/artifacts/schema/legal-offer-decision-request.schema.json +37 -0
  44. package/artifacts/schema/legal-offer-decision-result.schema.json +409 -0
  45. package/artifacts/schema/legal-offer-decision-snapshot.schema.json +678 -0
  46. package/artifacts/schema/legal-offer-display-request.schema.json +16 -0
  47. package/artifacts/schema/legal-offer-display-response.schema.json +712 -0
  48. package/artifacts/schema/legal-offer-list-query.schema.json +17 -0
  49. package/artifacts/schema/legal-offer-list-response.schema.json +347 -0
  50. package/artifacts/schema/legal-offer-summary.schema.json +321 -0
  51. package/artifacts/schema/plan-change-prepare-response.schema.json +749 -504
  52. package/artifacts/schema/purchase-intent-response.schema.json +3 -3
  53. package/dist/billing.d.ts +361 -275
  54. package/dist/billing.js +27 -6
  55. package/dist/errors.d.ts +1 -1
  56. package/dist/errors.js +2 -0
  57. package/dist/index.d.ts +12 -0
  58. package/dist/index.js +6 -0
  59. package/dist/journal-controls.d.ts +228 -0
  60. package/dist/journal-controls.js +111 -0
  61. package/dist/journal-intents.d.ts +1695 -0
  62. package/dist/journal-intents.js +97 -0
  63. package/dist/journal-manifests.d.ts +1670 -0
  64. package/dist/journal-manifests.js +182 -0
  65. package/dist/journal-restore.d.ts +1871 -0
  66. package/dist/journal-restore.js +324 -0
  67. package/dist/journal-seals.d.ts +147 -0
  68. package/dist/journal-seals.js +89 -0
  69. package/dist/legal-acceptances.d.ts +4 -0
  70. package/dist/legal-acceptances.js +9 -2
  71. package/dist/legal-offers.d.ts +468 -0
  72. package/dist/legal-offers.js +91 -0
  73. package/dist/realtime.d.ts +2 -2
  74. package/dist/routes.js +57 -3
  75. package/package.json +1 -1
@@ -0,0 +1,468 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { z } from 'zod';
3
+ export declare const legalOfferListQuery: z.ZodObject<{
4
+ limit: z.ZodOptional<z.ZodString>;
5
+ cursor: z.ZodOptional<z.ZodString>;
6
+ }, z.core.$strict>;
7
+ export type LegalOfferListQuery = z.infer<typeof legalOfferListQuery>;
8
+ export declare const legalOfferSummary: z.ZodDiscriminatedUnion<[z.ZodObject<{
9
+ kind: z.ZodLiteral<"terms">;
10
+ current_terms: z.ZodObject<{
11
+ version: z.ZodString;
12
+ version_date: z.ZodISODate;
13
+ url: z.ZodURL;
14
+ }, z.core.$strict>;
15
+ proposed_terms: z.ZodObject<{
16
+ version: z.ZodString;
17
+ version_date: z.ZodISODate;
18
+ url: z.ZodURL;
19
+ }, z.core.$strict>;
20
+ published_at: z.ZodISODateTime;
21
+ acceptance_deadline_at: z.ZodISODateTime;
22
+ terms_access: z.ZodEnum<{
23
+ pending: "pending";
24
+ suspended: "suspended";
25
+ unrestricted: "unrestricted";
26
+ }>;
27
+ summary: z.ZodString;
28
+ id: z.ZodUUID;
29
+ revision: z.ZodUUID;
30
+ decision_state: z.ZodEnum<{
31
+ accepted: "accepted";
32
+ open: "open";
33
+ declined: "declined";
34
+ withdrawn: "withdrawn";
35
+ }>;
36
+ organization_name: z.ZodString;
37
+ announced_at: z.ZodNullable<z.ZodISODateTime>;
38
+ }, z.core.$strict>, z.ZodObject<{
39
+ plan: z.ZodEnum<{
40
+ plus: "plus";
41
+ pro: "pro";
42
+ }>;
43
+ cycle: z.ZodEnum<{
44
+ monthly: "monthly";
45
+ yearly: "yearly";
46
+ }>;
47
+ addons: z.ZodObject<{
48
+ seats: z.ZodNumber;
49
+ robots: z.ZodNumber;
50
+ apps: z.ZodNumber;
51
+ app_user_packs: z.ZodNumber;
52
+ live_video_packs: z.ZodNumber;
53
+ }, z.core.$strict>;
54
+ current_net_cents: z.ZodNumber;
55
+ offered_net_cents: z.ZodNumber;
56
+ offered_period_start_at: z.ZodISODateTime;
57
+ price_start_at: z.ZodISODateTime;
58
+ currency: z.ZodLiteral<"eur">;
59
+ kind: z.ZodLiteral<"price">;
60
+ id: z.ZodUUID;
61
+ revision: z.ZodUUID;
62
+ decision_state: z.ZodEnum<{
63
+ accepted: "accepted";
64
+ open: "open";
65
+ declined: "declined";
66
+ withdrawn: "withdrawn";
67
+ }>;
68
+ organization_name: z.ZodString;
69
+ announced_at: z.ZodNullable<z.ZodISODateTime>;
70
+ }, z.core.$strict>], "kind">;
71
+ export type LegalOfferSummary = z.infer<typeof legalOfferSummary>;
72
+ export declare const legalOfferListResponse: z.ZodObject<{
73
+ offers: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
74
+ kind: z.ZodLiteral<"terms">;
75
+ current_terms: z.ZodObject<{
76
+ version: z.ZodString;
77
+ version_date: z.ZodISODate;
78
+ url: z.ZodURL;
79
+ }, z.core.$strict>;
80
+ proposed_terms: z.ZodObject<{
81
+ version: z.ZodString;
82
+ version_date: z.ZodISODate;
83
+ url: z.ZodURL;
84
+ }, z.core.$strict>;
85
+ published_at: z.ZodISODateTime;
86
+ acceptance_deadline_at: z.ZodISODateTime;
87
+ terms_access: z.ZodEnum<{
88
+ pending: "pending";
89
+ suspended: "suspended";
90
+ unrestricted: "unrestricted";
91
+ }>;
92
+ summary: z.ZodString;
93
+ id: z.ZodUUID;
94
+ revision: z.ZodUUID;
95
+ decision_state: z.ZodEnum<{
96
+ accepted: "accepted";
97
+ open: "open";
98
+ declined: "declined";
99
+ withdrawn: "withdrawn";
100
+ }>;
101
+ organization_name: z.ZodString;
102
+ announced_at: z.ZodNullable<z.ZodISODateTime>;
103
+ }, z.core.$strict>, z.ZodObject<{
104
+ plan: z.ZodEnum<{
105
+ plus: "plus";
106
+ pro: "pro";
107
+ }>;
108
+ cycle: z.ZodEnum<{
109
+ monthly: "monthly";
110
+ yearly: "yearly";
111
+ }>;
112
+ addons: z.ZodObject<{
113
+ seats: z.ZodNumber;
114
+ robots: z.ZodNumber;
115
+ apps: z.ZodNumber;
116
+ app_user_packs: z.ZodNumber;
117
+ live_video_packs: z.ZodNumber;
118
+ }, z.core.$strict>;
119
+ current_net_cents: z.ZodNumber;
120
+ offered_net_cents: z.ZodNumber;
121
+ offered_period_start_at: z.ZodISODateTime;
122
+ price_start_at: z.ZodISODateTime;
123
+ currency: z.ZodLiteral<"eur">;
124
+ kind: z.ZodLiteral<"price">;
125
+ id: z.ZodUUID;
126
+ revision: z.ZodUUID;
127
+ decision_state: z.ZodEnum<{
128
+ accepted: "accepted";
129
+ open: "open";
130
+ declined: "declined";
131
+ withdrawn: "withdrawn";
132
+ }>;
133
+ organization_name: z.ZodString;
134
+ announced_at: z.ZodNullable<z.ZodISODateTime>;
135
+ }, z.core.$strict>], "kind">>;
136
+ next_cursor: z.ZodNullable<z.ZodString>;
137
+ }, z.core.$strict>;
138
+ export type LegalOfferListResponse = z.infer<typeof legalOfferListResponse>;
139
+ export declare const legalOfferDisplayRequest: z.ZodObject<{
140
+ operation_key: z.ZodUUID;
141
+ }, z.core.$strict>;
142
+ export type LegalOfferDisplayRequest = z.infer<typeof legalOfferDisplayRequest>;
143
+ export declare const legalOfferDecisionRequest: z.ZodObject<{
144
+ operation_key: z.ZodUUID;
145
+ decision: z.ZodEnum<{
146
+ accept: "accept";
147
+ decline: "decline";
148
+ }>;
149
+ confirmation_proof: z.ZodString;
150
+ }, z.core.$strict>;
151
+ export type LegalOfferDecisionRequest = z.infer<typeof legalOfferDecisionRequest>;
152
+ export declare const legalOfferDecisionLookupQuery: z.ZodObject<{
153
+ operation_key: z.ZodUUID;
154
+ }, z.core.$strict>;
155
+ export type LegalOfferDecisionLookupQuery = z.infer<typeof legalOfferDecisionLookupQuery>;
156
+ /** Shape validation cannot prove the served wording, Owner, offer or state binding. */
157
+ export declare const legalOfferDecisionSnapshot: z.ZodUnion<readonly [z.ZodObject<{
158
+ terms_access: z.ZodLiteral<"pending">;
159
+ decline_label: z.ZodLiteral<"Decline">;
160
+ kind: z.ZodLiteral<"terms">;
161
+ text_id: z.ZodLiteral<"DR-3032-2026-11-02-H.3-terms">;
162
+ accept_label: z.ZodLiteral<"Accept">;
163
+ proposed_terms: z.ZodObject<{
164
+ version: z.ZodString;
165
+ version_date: z.ZodISODate;
166
+ url: z.ZodURL;
167
+ }, z.core.$strict>;
168
+ published_at: z.ZodISODateTime;
169
+ acceptance_deadline_at: z.ZodISODateTime;
170
+ summary: z.ZodString;
171
+ read_changes_label: z.ZodString;
172
+ snapshot_id: z.ZodUUID;
173
+ offer_id: z.ZodUUID;
174
+ revision: z.ZodUUID;
175
+ operation_key: z.ZodUUID;
176
+ owner_id: z.ZodUUID;
177
+ organization_id: z.ZodUUID;
178
+ organization_name: z.ZodString;
179
+ title: z.ZodString;
180
+ text: z.ZodString;
181
+ current_terms: z.ZodObject<{
182
+ version: z.ZodString;
183
+ version_date: z.ZodISODate;
184
+ url: z.ZodURL;
185
+ }, z.core.$strict>;
186
+ dpa: z.ZodNull;
187
+ issued_at: z.ZodISODateTime;
188
+ expires_at: z.ZodISODateTime;
189
+ }, z.core.$strict>, z.ZodObject<{
190
+ terms_access: z.ZodLiteral<"suspended">;
191
+ decline_label: z.ZodNull;
192
+ kind: z.ZodLiteral<"terms">;
193
+ text_id: z.ZodLiteral<"DR-3032-2026-11-02-H.3-terms">;
194
+ accept_label: z.ZodLiteral<"Accept">;
195
+ proposed_terms: z.ZodObject<{
196
+ version: z.ZodString;
197
+ version_date: z.ZodISODate;
198
+ url: z.ZodURL;
199
+ }, z.core.$strict>;
200
+ published_at: z.ZodISODateTime;
201
+ acceptance_deadline_at: z.ZodISODateTime;
202
+ summary: z.ZodString;
203
+ read_changes_label: z.ZodString;
204
+ snapshot_id: z.ZodUUID;
205
+ offer_id: z.ZodUUID;
206
+ revision: z.ZodUUID;
207
+ operation_key: z.ZodUUID;
208
+ owner_id: z.ZodUUID;
209
+ organization_id: z.ZodUUID;
210
+ organization_name: z.ZodString;
211
+ title: z.ZodString;
212
+ text: z.ZodString;
213
+ current_terms: z.ZodObject<{
214
+ version: z.ZodString;
215
+ version_date: z.ZodISODate;
216
+ url: z.ZodURL;
217
+ }, z.core.$strict>;
218
+ dpa: z.ZodNull;
219
+ issued_at: z.ZodISODateTime;
220
+ expires_at: z.ZodISODateTime;
221
+ }, z.core.$strict>, z.ZodObject<{
222
+ current_agreed_price_id: z.ZodUUID;
223
+ offered_price_proposal_id: z.ZodUUID;
224
+ plan: z.ZodEnum<{
225
+ plus: "plus";
226
+ pro: "pro";
227
+ }>;
228
+ cycle: z.ZodEnum<{
229
+ monthly: "monthly";
230
+ yearly: "yearly";
231
+ }>;
232
+ addons: z.ZodObject<{
233
+ seats: z.ZodNumber;
234
+ robots: z.ZodNumber;
235
+ apps: z.ZodNumber;
236
+ app_user_packs: z.ZodNumber;
237
+ live_video_packs: z.ZodNumber;
238
+ }, z.core.$strict>;
239
+ current_net_cents: z.ZodNumber;
240
+ offered_net_cents: z.ZodNumber;
241
+ offered_period_start_at: z.ZodISODateTime;
242
+ price_start_at: z.ZodISODateTime;
243
+ currency: z.ZodLiteral<"eur">;
244
+ kind: z.ZodLiteral<"price">;
245
+ text_id: z.ZodLiteral<"DR-1374-draft-3-H.3-price">;
246
+ decline_label: z.ZodString;
247
+ proposed_terms: z.ZodNull;
248
+ snapshot_id: z.ZodUUID;
249
+ offer_id: z.ZodUUID;
250
+ revision: z.ZodUUID;
251
+ operation_key: z.ZodUUID;
252
+ owner_id: z.ZodUUID;
253
+ organization_id: z.ZodUUID;
254
+ organization_name: z.ZodString;
255
+ title: z.ZodString;
256
+ text: z.ZodString;
257
+ accept_label: z.ZodString;
258
+ current_terms: z.ZodObject<{
259
+ version: z.ZodString;
260
+ version_date: z.ZodISODate;
261
+ url: z.ZodURL;
262
+ }, z.core.$strict>;
263
+ dpa: z.ZodNull;
264
+ issued_at: z.ZodISODateTime;
265
+ expires_at: z.ZodISODateTime;
266
+ }, z.core.$strict>]>;
267
+ export type LegalOfferDecisionSnapshot = z.infer<typeof legalOfferDecisionSnapshot>;
268
+ export declare const legalOfferDisplayResponse: z.ZodObject<{
269
+ confirmation_proof: z.ZodString;
270
+ expires_at: z.ZodISODateTime;
271
+ snapshot: z.ZodUnion<readonly [z.ZodObject<{
272
+ terms_access: z.ZodLiteral<"pending">;
273
+ decline_label: z.ZodLiteral<"Decline">;
274
+ kind: z.ZodLiteral<"terms">;
275
+ text_id: z.ZodLiteral<"DR-3032-2026-11-02-H.3-terms">;
276
+ accept_label: z.ZodLiteral<"Accept">;
277
+ proposed_terms: z.ZodObject<{
278
+ version: z.ZodString;
279
+ version_date: z.ZodISODate;
280
+ url: z.ZodURL;
281
+ }, z.core.$strict>;
282
+ published_at: z.ZodISODateTime;
283
+ acceptance_deadline_at: z.ZodISODateTime;
284
+ summary: z.ZodString;
285
+ read_changes_label: z.ZodString;
286
+ snapshot_id: z.ZodUUID;
287
+ offer_id: z.ZodUUID;
288
+ revision: z.ZodUUID;
289
+ operation_key: z.ZodUUID;
290
+ owner_id: z.ZodUUID;
291
+ organization_id: z.ZodUUID;
292
+ organization_name: z.ZodString;
293
+ title: z.ZodString;
294
+ text: z.ZodString;
295
+ current_terms: z.ZodObject<{
296
+ version: z.ZodString;
297
+ version_date: z.ZodISODate;
298
+ url: z.ZodURL;
299
+ }, z.core.$strict>;
300
+ dpa: z.ZodNull;
301
+ issued_at: z.ZodISODateTime;
302
+ expires_at: z.ZodISODateTime;
303
+ }, z.core.$strict>, z.ZodObject<{
304
+ terms_access: z.ZodLiteral<"suspended">;
305
+ decline_label: z.ZodNull;
306
+ kind: z.ZodLiteral<"terms">;
307
+ text_id: z.ZodLiteral<"DR-3032-2026-11-02-H.3-terms">;
308
+ accept_label: z.ZodLiteral<"Accept">;
309
+ proposed_terms: z.ZodObject<{
310
+ version: z.ZodString;
311
+ version_date: z.ZodISODate;
312
+ url: z.ZodURL;
313
+ }, z.core.$strict>;
314
+ published_at: z.ZodISODateTime;
315
+ acceptance_deadline_at: z.ZodISODateTime;
316
+ summary: z.ZodString;
317
+ read_changes_label: z.ZodString;
318
+ snapshot_id: z.ZodUUID;
319
+ offer_id: z.ZodUUID;
320
+ revision: z.ZodUUID;
321
+ operation_key: z.ZodUUID;
322
+ owner_id: z.ZodUUID;
323
+ organization_id: z.ZodUUID;
324
+ organization_name: z.ZodString;
325
+ title: z.ZodString;
326
+ text: z.ZodString;
327
+ current_terms: z.ZodObject<{
328
+ version: z.ZodString;
329
+ version_date: z.ZodISODate;
330
+ url: z.ZodURL;
331
+ }, z.core.$strict>;
332
+ dpa: z.ZodNull;
333
+ issued_at: z.ZodISODateTime;
334
+ expires_at: z.ZodISODateTime;
335
+ }, z.core.$strict>, z.ZodObject<{
336
+ current_agreed_price_id: z.ZodUUID;
337
+ offered_price_proposal_id: z.ZodUUID;
338
+ plan: z.ZodEnum<{
339
+ plus: "plus";
340
+ pro: "pro";
341
+ }>;
342
+ cycle: z.ZodEnum<{
343
+ monthly: "monthly";
344
+ yearly: "yearly";
345
+ }>;
346
+ addons: z.ZodObject<{
347
+ seats: z.ZodNumber;
348
+ robots: z.ZodNumber;
349
+ apps: z.ZodNumber;
350
+ app_user_packs: z.ZodNumber;
351
+ live_video_packs: z.ZodNumber;
352
+ }, z.core.$strict>;
353
+ current_net_cents: z.ZodNumber;
354
+ offered_net_cents: z.ZodNumber;
355
+ offered_period_start_at: z.ZodISODateTime;
356
+ price_start_at: z.ZodISODateTime;
357
+ currency: z.ZodLiteral<"eur">;
358
+ kind: z.ZodLiteral<"price">;
359
+ text_id: z.ZodLiteral<"DR-1374-draft-3-H.3-price">;
360
+ decline_label: z.ZodString;
361
+ proposed_terms: z.ZodNull;
362
+ snapshot_id: z.ZodUUID;
363
+ offer_id: z.ZodUUID;
364
+ revision: z.ZodUUID;
365
+ operation_key: z.ZodUUID;
366
+ owner_id: z.ZodUUID;
367
+ organization_id: z.ZodUUID;
368
+ organization_name: z.ZodString;
369
+ title: z.ZodString;
370
+ text: z.ZodString;
371
+ accept_label: z.ZodString;
372
+ current_terms: z.ZodObject<{
373
+ version: z.ZodString;
374
+ version_date: z.ZodISODate;
375
+ url: z.ZodURL;
376
+ }, z.core.$strict>;
377
+ dpa: z.ZodNull;
378
+ issued_at: z.ZodISODateTime;
379
+ expires_at: z.ZodISODateTime;
380
+ }, z.core.$strict>]>;
381
+ }, z.core.$strict>;
382
+ export type LegalOfferDisplayResponse = z.infer<typeof legalOfferDisplayResponse>;
383
+ export declare const legalOfferDecisionResult: z.ZodUnion<readonly [z.ZodObject<{
384
+ kind: z.ZodLiteral<"terms">;
385
+ decision: z.ZodLiteral<"accept">;
386
+ effective_at: z.ZodISODateTime;
387
+ price_start_at: z.ZodNull;
388
+ terms_access: z.ZodObject<{
389
+ state: z.ZodLiteral<"unrestricted">;
390
+ acceptance_deadline_at: z.ZodISODateTime;
391
+ }, z.core.$strict>;
392
+ offer_id: z.ZodUUID;
393
+ decision_id: z.ZodUUID;
394
+ decided_at: z.ZodISODateTime;
395
+ terms: z.ZodObject<{
396
+ version: z.ZodString;
397
+ version_date: z.ZodISODate;
398
+ url: z.ZodURL;
399
+ }, z.core.$strict>;
400
+ dpa: z.ZodNull;
401
+ }, z.core.$strict>, z.ZodObject<{
402
+ kind: z.ZodLiteral<"terms">;
403
+ decision: z.ZodLiteral<"decline">;
404
+ effective_at: z.ZodNull;
405
+ price_start_at: z.ZodNull;
406
+ terms_access: z.ZodObject<{
407
+ state: z.ZodLiteral<"pending">;
408
+ acceptance_deadline_at: z.ZodISODateTime;
409
+ }, z.core.$strict>;
410
+ offer_id: z.ZodUUID;
411
+ decision_id: z.ZodUUID;
412
+ decided_at: z.ZodISODateTime;
413
+ terms: z.ZodObject<{
414
+ version: z.ZodString;
415
+ version_date: z.ZodISODate;
416
+ url: z.ZodURL;
417
+ }, z.core.$strict>;
418
+ dpa: z.ZodNull;
419
+ }, z.core.$strict>, z.ZodObject<{
420
+ kind: z.ZodLiteral<"price">;
421
+ decision: z.ZodLiteral<"accept">;
422
+ effective_at: z.ZodNull;
423
+ price_start_at: z.ZodISODateTime;
424
+ terms_access: z.ZodNull;
425
+ offer_id: z.ZodUUID;
426
+ decision_id: z.ZodUUID;
427
+ decided_at: z.ZodISODateTime;
428
+ terms: z.ZodObject<{
429
+ version: z.ZodString;
430
+ version_date: z.ZodISODate;
431
+ url: z.ZodURL;
432
+ }, z.core.$strict>;
433
+ dpa: z.ZodNull;
434
+ }, z.core.$strict>, z.ZodObject<{
435
+ kind: z.ZodLiteral<"price">;
436
+ decision: z.ZodLiteral<"decline">;
437
+ effective_at: z.ZodNull;
438
+ price_start_at: z.ZodNull;
439
+ terms_access: z.ZodNull;
440
+ offer_id: z.ZodUUID;
441
+ decision_id: z.ZodUUID;
442
+ decided_at: z.ZodISODateTime;
443
+ terms: z.ZodObject<{
444
+ version: z.ZodString;
445
+ version_date: z.ZodISODate;
446
+ url: z.ZodURL;
447
+ }, z.core.$strict>;
448
+ dpa: z.ZodNull;
449
+ }, z.core.$strict>]>;
450
+ export type LegalOfferDecisionResult = z.infer<typeof legalOfferDecisionResult>;
451
+ export declare const legalOfferConflictDetails: z.ZodObject<{
452
+ field: z.ZodEnum<{
453
+ operation_key: "operation_key";
454
+ confirmation_proof: "confirmation_proof";
455
+ period: "period";
456
+ offer: "offer";
457
+ term: "term";
458
+ }>;
459
+ rule: z.ZodEnum<{
460
+ reused: "reused";
461
+ expired: "expired";
462
+ stale: "stale";
463
+ withdrawn: "withdrawn";
464
+ boundary_changed: "boundary_changed";
465
+ deadline_unavailable: "deadline_unavailable";
466
+ }>;
467
+ }, z.core.$strict>;
468
+ export type LegalOfferConflictDetails = z.infer<typeof legalOfferConflictDetails>;
@@ -0,0 +1,91 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { z } from 'zod';
3
+ import { legalDocumentReference } from './legal.js';
4
+ import { orgAddons } from './plans.js';
5
+ import { purchaseOperationKey } from './purchase-operation-key.js';
6
+ import { confirmationProof } from './confirmation-proof.js';
7
+ const utc = z.iso.datetime().regex(/Z$/);
8
+ const text = z.string().min(1).regex(/\S/);
9
+ const cents = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
10
+ const proof = confirmationProof.regex(/^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/);
11
+ const cursorPayload = z.strictObject({ v: z.literal(1), created_at: utc, id: z.uuid() });
12
+ const cursor = z.string().min(1)
13
+ .regex(/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-][AQgw]|[A-Za-z0-9_-]{2}[AEIMQUYcgkosw048])?$/)
14
+ .refine(value => {
15
+ try {
16
+ const bytes = atob(value.replace(/-/g, '+').replace(/_/g, '/'));
17
+ const parsed = cursorPayload.safeParse(JSON.parse(bytes));
18
+ return parsed.success && bytes === JSON.stringify({ v: parsed.data.v, created_at: parsed.data.created_at, id: parsed.data.id });
19
+ }
20
+ catch {
21
+ return false;
22
+ }
23
+ }, 'Cursor must encode canonical JSON with v, created_at and id in that order.')
24
+ .meta({ description: 'Canonical unpadded base64url of UTF-8 JSON {v:1,created_at:UTC,id:UUID}, in that exact key order. Consumers must validate the decoded payload and organization scope; JSON Schema checks encoding syntax only.' });
25
+ export const legalOfferListQuery = z.strictObject({
26
+ limit: z.string().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).optional(),
27
+ cursor: cursor.optional(),
28
+ });
29
+ const price = {
30
+ plan: z.enum(['plus', 'pro']), cycle: z.enum(['monthly', 'yearly']), addons: orgAddons.strict(),
31
+ current_net_cents: cents, offered_net_cents: cents,
32
+ offered_period_start_at: utc, price_start_at: utc, currency: z.literal('eur'),
33
+ };
34
+ const summary = {
35
+ id: z.uuid(), revision: z.uuid(), decision_state: z.enum(['open', 'declined', 'accepted', 'withdrawn']),
36
+ organization_name: text, announced_at: utc.nullable(),
37
+ };
38
+ export const legalOfferSummary = z.discriminatedUnion('kind', [
39
+ z.strictObject({ ...summary, kind: z.literal('terms'), current_terms: legalDocumentReference,
40
+ proposed_terms: legalDocumentReference, published_at: utc, acceptance_deadline_at: utc,
41
+ terms_access: z.enum(['pending', 'suspended', 'unrestricted']), summary: text }),
42
+ z.strictObject({ ...summary, kind: z.literal('price'), ...price }),
43
+ ]);
44
+ export const legalOfferListResponse = z.strictObject({ offers: z.array(legalOfferSummary), next_cursor: cursor.nullable() });
45
+ export const legalOfferDisplayRequest = z.strictObject({ operation_key: purchaseOperationKey });
46
+ export const legalOfferDecisionRequest = z.strictObject({
47
+ operation_key: purchaseOperationKey, decision: z.enum(['accept', 'decline']), confirmation_proof: proof,
48
+ });
49
+ export const legalOfferDecisionLookupQuery = z.strictObject({ operation_key: purchaseOperationKey });
50
+ const snapshot = {
51
+ snapshot_id: z.uuid(), offer_id: z.uuid(), revision: z.uuid(), operation_key: purchaseOperationKey,
52
+ owner_id: z.uuid(), organization_id: z.uuid(), organization_name: text,
53
+ title: text, text, accept_label: text,
54
+ current_terms: legalDocumentReference, dpa: z.null(), issued_at: utc, expires_at: utc,
55
+ };
56
+ const termsSnapshot = {
57
+ ...snapshot, kind: z.literal('terms'), text_id: z.literal('DR-3032-2026-11-02-H.3-terms'),
58
+ accept_label: z.literal('Accept'),
59
+ proposed_terms: legalDocumentReference, published_at: utc, acceptance_deadline_at: utc,
60
+ summary: text, read_changes_label: text,
61
+ };
62
+ /** Shape validation cannot prove the served wording, Owner, offer or state binding. */
63
+ export const legalOfferDecisionSnapshot = z.union([
64
+ z.strictObject({ ...termsSnapshot, terms_access: z.literal('pending'), decline_label: z.literal('Decline') }),
65
+ z.strictObject({ ...termsSnapshot, terms_access: z.literal('suspended'), decline_label: z.null() }),
66
+ z.strictObject({ ...snapshot, kind: z.literal('price'), text_id: z.literal('DR-1374-draft-3-H.3-price'),
67
+ decline_label: text, proposed_terms: z.null(), ...price, current_agreed_price_id: z.uuid(), offered_price_proposal_id: z.uuid() }),
68
+ ]).superRefine((value, ctx) => {
69
+ const lifetime = Date.parse(value.expires_at) - Date.parse(value.issued_at);
70
+ if (lifetime <= 0 || lifetime > 600_000)
71
+ ctx.addIssue({ code: 'custom', path: ['expires_at'], message: 'Display lifetime must be positive and at most ten minutes.' });
72
+ });
73
+ export const legalOfferDisplayResponse = z.strictObject({
74
+ confirmation_proof: proof, expires_at: utc, snapshot: legalOfferDecisionSnapshot,
75
+ }).superRefine((value, ctx) => {
76
+ if (value.expires_at !== value.snapshot.expires_at)
77
+ ctx.addIssue({ code: 'custom', path: ['expires_at'], message: 'Display and snapshot expiry must match.' });
78
+ });
79
+ const result = { offer_id: z.uuid(), decision_id: z.uuid(), decided_at: utc, terms: legalDocumentReference, dpa: z.null() };
80
+ export const legalOfferDecisionResult = z.union([
81
+ z.strictObject({ ...result, kind: z.literal('terms'), decision: z.literal('accept'), effective_at: utc, price_start_at: z.null(),
82
+ terms_access: z.strictObject({ state: z.literal('unrestricted'), acceptance_deadline_at: utc }) }),
83
+ z.strictObject({ ...result, kind: z.literal('terms'), decision: z.literal('decline'), effective_at: z.null(), price_start_at: z.null(),
84
+ terms_access: z.strictObject({ state: z.literal('pending'), acceptance_deadline_at: utc }) }),
85
+ z.strictObject({ ...result, kind: z.literal('price'), decision: z.literal('accept'), effective_at: z.null(), price_start_at: utc, terms_access: z.null() }),
86
+ z.strictObject({ ...result, kind: z.literal('price'), decision: z.literal('decline'), effective_at: z.null(), price_start_at: z.null(), terms_access: z.null() }),
87
+ ]);
88
+ export const legalOfferConflictDetails = z.strictObject({
89
+ field: z.enum(['offer', 'confirmation_proof', 'operation_key', 'period', 'term']),
90
+ rule: z.enum(['withdrawn', 'stale', 'expired', 'reused', 'boundary_changed', 'deadline_unavailable']),
91
+ });
@@ -265,8 +265,8 @@ export declare const liveSessionEndReason: z.ZodEnum<{
265
265
  publish_failed: "publish_failed";
266
266
  robot_offline: "robot_offline";
267
267
  config_changed: "config_changed";
268
- released_by_peer: "released_by_peer";
269
268
  revoked: "revoked";
269
+ released_by_peer: "released_by_peer";
270
270
  robot_deleted: "robot_deleted";
271
271
  }>;
272
272
  export type LiveSessionEndReason = z.infer<typeof liveSessionEndReason>;
@@ -297,8 +297,8 @@ export declare const liveSessionEvent: z.ZodObject<{
297
297
  publish_failed: "publish_failed";
298
298
  robot_offline: "robot_offline";
299
299
  config_changed: "config_changed";
300
- released_by_peer: "released_by_peer";
301
300
  revoked: "revoked";
301
+ released_by_peer: "released_by_peer";
302
302
  robot_deleted: "robot_deleted";
303
303
  }>;
304
304
  detail: z.ZodNullable<z.ZodString>;
package/dist/routes.js CHANGED
@@ -11,6 +11,7 @@ import { controllerRegisterOrgResponse, controllerRegisterWrite } from './contro
11
11
  import { acceptTeamInviteRequest, authMeResponse, createPasskeyRequest, createPasskeyResponse, createTeamInviteRequest, developerPasskey, developerTwoFactor, fleetlessUser, fleetlessUserListResponse, passwordChangeRequest, patchAuthMeRequest, patchFleetlessUserRequest, patchOrgRequest, patchOrgResponse, pendingTeamInviteListResponse, refreshRequest, sessionTokens, teamInvite, recoveryCodesResponse, renamePasskeyRequest, tierChangeRequest, totpConfirmRequest, totpConfirmResponse, twoFactorSetupResponse, waitlistRequest, webauthnOptionsResponse, } from './identity.js';
12
12
  import { jobRunListResponse, jobRunQuery, jobRunSummary, jobRunSummaryQuery } from './jobs.js';
13
13
  import { legalAcceptanceListQuery, legalAcceptanceListResponse } from './legal-acceptances.js';
14
+ import { legalOfferListQuery, legalOfferListResponse, legalOfferDisplayRequest, legalOfferDisplayResponse, legalOfferDecisionRequest, legalOfferDecisionLookupQuery, legalOfferDecisionResult, } from './legal-offers.js';
14
15
  import { MCP_APP_PATHS, mcpRobotDatasheet, mcpRolePreviewResponse } from './mcp.js';
15
16
  import { authorizationServerMetadata, dynamicClientRegistrationRequest, dynamicClientRegistrationResponse, oauthAuthorizeQuery, oauthRedirectResponse, oauthTokenRequest, oauthTokenResponse, protectedResourceMetadata, } from './oauth.js';
16
17
  import { adminPlanChangeRequest, orgPlan, planChangeRequest, planChangePrepareRequest, planChangeDecisionLookupQuery, planChangeDecisionStatusResponse } from './plans.js';
@@ -468,6 +469,58 @@ export const ROUTES = [
468
469
  'capped by its own global ceiling, above which the row is still written and the mail is skipped.',
469
470
  },
470
471
  /* ---------------------------------------------------------------- org */
472
+ {
473
+ method: 'GET', path: '/api/org/legal/offers', section: 'org',
474
+ summary: 'Lists Terms and price notices for the authenticated organization.',
475
+ audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: false, status: 200,
476
+ params: [], query: legalOfferListQuery, request: null, response: legalOfferListResponse,
477
+ errors: [...DEVELOPER_GUARD, 'validation_error', 'legal_offer_unavailable'], transport: 'http',
478
+ notes: 'Cache-Control: no-store. Any authenticated org member may read notices; support is read-only. No proof or decision rights are returned. ' +
479
+ 'Newest first; default limit 50, maximum 100, canonical decimal strings only. Cursor is canonical unpadded base64url of UTF-8 JSON ' +
480
+ '{v:1,created_at:UTC,id:UUID} in that key order, scoped by Cloud to the active org. Terms notices expose the published deadline and developer access state for Basic and paid orgs. ' +
481
+ 'The authenticated offer read stays reachable for a Terms-suspended org so an Owner can recover the acceptance path.',
482
+ },
483
+ {
484
+ method: 'POST', path: '/api/org/legal/offers/:id/display', section: 'org',
485
+ summary: 'Issues an Owner-bound Terms or price decision display.',
486
+ audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
487
+ params: [{ name: 'id', description: 'The organization-scoped offer UUID.' }],
488
+ query: null, request: legalOfferDisplayRequest, response: legalOfferDisplayResponse,
489
+ errors: [...DEVELOPER_GUARD, 'tier_required', 'support_forbidden', 'validation_error', 'not_found', 'target_state_conflict', 'legal_offer_unavailable'], transport: 'http',
490
+ notes: 'Cache-Control: no-store. Real Owner only; support and synthetic identities cannot receive a proof. Display alone makes no decision. ' +
491
+ 'Cloud stores the complete snapshot and a hash of the 32-byte proof for at most ten minutes, bound to Owner, org, offer revision and operation key. ' +
492
+ 'Terms-suspended Owners can still read the offer and create an accept-only proof. Pending displays permit decline before the deadline; ' +
493
+ 'at or after the deadline decline_label is null and the changed consequence requires a fresh proof. Both Basic and paid Terms offers use their published deadline. ' +
494
+ 'An expired proof, withdrawn or changed offer requires a fresh display; the deadline alone never expires Terms acceptance. ' +
495
+ 'Unknown/foreign offers return 404. target_state_conflict uses legalOfferConflictDetails.',
496
+ },
497
+ {
498
+ method: 'POST', path: '/api/org/legal/offers/:id/decisions', section: 'org',
499
+ summary: 'Records an explicit Owner acceptance or decline of a served offer.',
500
+ audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
501
+ params: [{ name: 'id', description: 'The offer UUID bound to the served display.' }],
502
+ query: null, request: legalOfferDecisionRequest, response: legalOfferDecisionResult,
503
+ errors: [...DEVELOPER_GUARD, 'tier_required', 'support_forbidden', 'validation_error', 'not_found', 'target_state_conflict', 'legal_offer_unavailable'], transport: 'http',
504
+ notes: 'Cache-Control: no-store. Real Owner only; support and synthetic identities cannot decide. Cloud atomically checks the actor/org/offer/revision, wording, ' +
505
+ 'legal references, selection, prices, boundaries and expiry before consuming the proof and recording the decision. Changed-body/key replays and stale proofs conflict without mutation. ' +
506
+ 'An exact same-key retry recovers the original response even after proof expiry. Declines stay out of the acceptance list. ' +
507
+ 'Terms decline and silence share the same published deadline; neither causes contract termination. Acceptance remains available after decline ' +
508
+ 'or Terms suspension, takes effect at decision time, clears only the Terms restriction and causes no contract termination or deletion. ' +
509
+ 'At or after the deadline decline is unavailable, including with an old pending proof. Price decline causes no suspension; ' +
510
+ 'price acceptance at or after the offered boundary starts at the next full boundary. ' +
511
+ 'target_state_conflict uses legalOfferConflictDetails; unavailable/not_found/tier_required/support_forbidden omit details.',
512
+ },
513
+ {
514
+ method: 'GET', path: '/api/org/legal/offers/:id/decisions', section: 'org',
515
+ summary: 'Recovers the original offer decision by operation key.',
516
+ audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
517
+ params: [{ name: 'id', description: 'The offer UUID of the original decision.' }],
518
+ query: legalOfferDecisionLookupQuery, request: null, response: legalOfferDecisionResult,
519
+ errors: [...DEVELOPER_GUARD, 'tier_required', 'support_forbidden', 'validation_error', 'not_found', 'legal_offer_unavailable'], transport: 'http',
520
+ notes: 'Cache-Control: no-store. Real Owner only; support and synthetic identities are refused. Match the original Owner, org, offer and operation key; ' +
521
+ 'unknown/foreign keys return 404 without disclosure. Return the exact original decision arm, including a decline before later acceptance. ' +
522
+ 'Use this lookup after a lost response before asking for another display. It remains reachable for a Terms-suspended org. No proof is returned.',
523
+ },
471
524
  {
472
525
  method: 'GET', path: '/api/org/legal/acceptances', section: 'org',
473
526
  summary: "Lists the calling organization's accepted legal document versions, newest first.",
@@ -476,6 +529,7 @@ export const ROUTES = [
476
529
  errors: [...DEVELOPER_GUARD, 'tier_required', 'support_forbidden', 'validation_error'], transport: 'http',
477
530
  notes: 'A real Owner reads only the authenticated organization; Developer and support sessions cannot read it. ' +
478
531
  'Rows carry stored Terms and applicable DPA references, never the current versions substituted for history. ' +
532
+ 'Accepted amendments and price offers use amendment and price_offer; declines appear only in the separate offer decision history. ' +
479
533
  'The default page limit is 50, maximum 100. The opaque cursor is unpadded base64url of UTF-8 JSON ' +
480
534
  '`[accepted_at,id]`, with a six-digit UTC timestamp and lowercase UUID; Cloud rejects noncanonical tokens. ' +
481
535
  'Follow `next_cursor` until null. Equal timestamps sort by id descending; a new acceptance cannot displace older rows.',
@@ -3124,14 +3178,14 @@ export const ROUTES = [
3124
3178
  },
3125
3179
  {
3126
3180
  method: 'GET', path: '/api/billing/invoices/:id/pdf', section: 'billing',
3127
- summary: "Downloads an invoice's original or cancellation PDF.",
3181
+ summary: "Downloads a historical Cloud invoice's original PDF.",
3128
3182
  audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
3129
3183
  params: [{ name: 'id', description: 'The invoice id, from `billingInvoice.id` in `GET /api/billing`\'s `invoices`.' }],
3130
3184
  query: billingInvoicePdfQuery, request: null, response: null, contentType: 'application/pdf',
3131
3185
  errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
3132
3186
  notes: 'Owner-only. Omitted `kind` or `kind=invoice` returns the original PDF, rendered once with `pdfkit` when issued and stored as bytes. ' +
3133
- '`kind=cancellation` returns the stored cancellation PDF for this same invoice id; no read renders a new PDF. ' +
3134
- '`404 not_found` for an unknown id, one from another org, or a missing cancellation number or PDF. This reads historical Cloud ' +
3187
+ '`kind=cancellation` returns `404 not_found`: Cloud has no cancellation PDFs. Cancellation documents are held in Lexware. ' +
3188
+ '`404 not_found` also covers an unknown id or one from another org. This reads historical Cloud ' +
3135
3189
  "invoices only: a due charge has no PDF of its own here — its eventual Lexware invoice is a document, read through " +
3136
3190
  '`GET /api/billing/documents/:id/file`.',
3137
3191
  },