@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,97 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { z } from 'zod';
3
+ import { mailTemplateKind } from './app-users.js';
4
+ // Private scalar schemas: only complete consumer records are package exports.
5
+ const hash = z.string().regex(/^[0-9a-f]{64}$/);
6
+ const uuid = z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
7
+ const opaqueId = z.string().min(1);
8
+ const positiveInteger = z.number().int().min(1).max(Number.MAX_SAFE_INTEGER);
9
+ const utcMillis = z.iso.datetime({ precision: 3 });
10
+ const signature = z.string().regex(/^[A-Za-z0-9_-]{85}[AQgw]$/);
11
+ const common = {
12
+ schema: z.literal('fleetless.deletion-intent.v2'),
13
+ environment: opaqueId,
14
+ generation: uuid,
15
+ sequence: positiveInteger,
16
+ operation_id: uuid,
17
+ intent_at: utcMillis,
18
+ previous_hash: hash,
19
+ signing_key_id: opaqueId,
20
+ };
21
+ const manifest = { manifest_id: uuid, manifest_version_id: opaqueId, manifest_hash: hash };
22
+ const org = { org_id: uuid };
23
+ const app = { ...org, app_id: uuid };
24
+ const robot = { ...org, robot_id: uuid };
25
+ const batch = { batch_id: uuid, cutoff_at: utcMillis, policy_revision: positiveInteger };
26
+ const serial = z.strictObject({ instance_id: uuid, serial_binding_id: uuid, serial_binding_generation: positiveInteger });
27
+ const factor = { subject_id: uuid, factor_id: uuid };
28
+ function plain(kind, ids) {
29
+ return z.strictObject({ ...common, kind: z.literal(kind), ids });
30
+ }
31
+ function captured(kind, ids) {
32
+ return plain(kind, ids).extend(manifest);
33
+ }
34
+ // Each kind has one fixed signature. Adding protected dependent membership to
35
+ // a plain kind requires an agreed wire revision; optional references are unsafe.
36
+ const branches = [
37
+ captured('organization.erase', z.strictObject(org)),
38
+ captured('organization.scope_erase', z.strictObject({ ...org, scope_id: uuid, scope_generation: positiveInteger })),
39
+ captured('robot.delete', z.strictObject(robot)),
40
+ captured('app.delete', z.strictObject(app)),
41
+ captured('member.remove', z.strictObject({ ...org, user_id: uuid })),
42
+ captured('app_user.remove', z.strictObject({ ...app, app_user_id: uuid })),
43
+ captured('app_role.delete', z.discriminatedUnion('move_mode', [
44
+ z.strictObject({ ...app, role_id: uuid, move_mode: z.literal('none') }),
45
+ z.strictObject({ ...app, role_id: uuid, move_mode: z.literal('reassign'), move_to_role_id: uuid }),
46
+ ])),
47
+ plain('server_key.revoke', z.strictObject({ ...app, key_id: uuid })),
48
+ plain('billing_document_link.remove', z.strictObject({ ...org, link_id: uuid })),
49
+ captured('app_oidc_provider.delete', z.strictObject({ ...app, provider_id: uuid })),
50
+ plain('team_invitation.revoke', z.strictObject({ ...org, invitation_id: uuid })),
51
+ plain('app_invitation.revoke', z.strictObject({ ...app, invitation_id: uuid })),
52
+ plain('mcp_grant.revoke', z.strictObject({ ...app, app_user_id: uuid, grant_id: uuid, grant_generation: uuid })),
53
+ plain('mcp_central_grant.revoke', z.strictObject({ subject_id: uuid, grant_id: uuid, grant_generation: uuid })),
54
+ captured('mcp_client.revoke', z.strictObject({ ...app, client_row_id: uuid })),
55
+ captured('mcp_central_client.revoke', z.strictObject({ client_row_id: uuid })),
56
+ captured('auth_factor.remove', z.union([
57
+ z.strictObject({ ...factor, subject_kind: z.literal('developer'), factor_kind: z.literal('totp') }),
58
+ z.strictObject({ ...factor, subject_kind: z.literal('developer'), factor_kind: z.literal('passkey') }),
59
+ z.strictObject({ ...factor, subject_kind: z.literal('app_user'), factor_kind: z.literal('totp') }),
60
+ ])),
61
+ plain('app_logo.delete', z.strictObject({ ...app, logo_generation: uuid })),
62
+ plain('mail_template.reset', z.strictObject({ ...app, template_kind: mailTemplateKind, template_generation: uuid })),
63
+ captured('robot_assets.clear', z.strictObject({ ...robot, batch_id: uuid })),
64
+ captured('asset.remove', z.strictObject({ ...robot, asset_id: uuid })),
65
+ captured('asset.replace', z.strictObject({ ...robot, asset_id: uuid })),
66
+ captured('organization_export.expire', z.strictObject({ ...org, export_id: uuid, expires_at: utcMillis })),
67
+ captured('history.slug_delete', z.strictObject({ ...robot, series_id: positiveInteger, slug_generation: uuid, batch_id: uuid })),
68
+ captured('history.retention', z.strictObject({ ...org, ...batch })),
69
+ captured('audit.retention', z.strictObject({ ...org, ...batch })),
70
+ captured('job_run.retention', z.strictObject({ ...org, ...batch })),
71
+ captured('latency.retention', z.strictObject({ ...org, ...batch })),
72
+ captured('ops_event.retention', z.strictObject({ ...org, ...batch })),
73
+ captured('ops_global_event.retention', z.strictObject(batch)),
74
+ captured('operator_audit.retention', z.strictObject(batch)),
75
+ plain('org_note_text.remove', z.strictObject({ ...org, old_note_generation: uuid })),
76
+ plain('org_note_text.replace', z.strictObject({ ...org, old_note_generation: uuid })),
77
+ captured('oidc_interaction.expire', z.strictObject({ ...org, ...batch })),
78
+ captured('mcp_interaction.expire', z.strictObject({ ...app, ...batch })),
79
+ captured('mcp_central_interaction.expire', z.strictObject(batch)),
80
+ captured('mcp_client.expire', z.strictObject({ ...app, ...batch })),
81
+ captured('mcp_central_client.expire', z.strictObject(batch)),
82
+ captured('console_interaction.expire', z.strictObject(batch)),
83
+ captured('console_code.expire', z.strictObject(batch)),
84
+ plain('instance.serial_lock', serial),
85
+ plain('instance.serial_rotate_old', serial),
86
+ plain('instance.license_revoke', z.strictObject({ instance_id: uuid, license_id: uuid })),
87
+ plain('instance.reporter_key_revoke', z.strictObject({ instance_id: uuid, reporter_key_id: uuid })),
88
+ plain('instance.instance_key_revoke', z.strictObject({ instance_id: uuid, instance_key_binding_id: uuid, instance_key_binding_generation: positiveInteger })),
89
+ ];
90
+ /** Decoded v2 signable shape only; no activation, canonical-byte or signature verification. */
91
+ export const journalIntentV2Body = z.discriminatedUnion('kind', branches);
92
+ /** The hash and signature cover the domain-separated body, not these envelope fields. */
93
+ const envelope = { record_hash: hash, signature };
94
+ export const journalIntentV2 = z.discriminatedUnion('kind', [
95
+ branches[0].extend(envelope),
96
+ ...branches.slice(1).map((branch) => branch.extend(envelope)),
97
+ ]);