@fleetless/contracts 12.1.0-next.1 → 13.0.0

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 (70) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/artifacts/openapi.json +15968 -13701
  3. package/artifacts/routes.json +123 -1
  4. package/artifacts/schema/billing-decision-display-response.schema.json +749 -504
  5. package/artifacts/schema/billing-decision-period.schema.json +573 -504
  6. package/artifacts/schema/billing-decision-snapshot.schema.json +749 -504
  7. package/artifacts/schema/journal-access-proof.schema.json +342 -0
  8. package/artifacts/schema/journal-deletion-manifest.schema.json +2103 -0
  9. package/artifacts/schema/journal-evidence-ref.schema.json +596 -0
  10. package/artifacts/schema/journal-export-item.schema.json +2910 -0
  11. package/artifacts/schema/journal-final-seal-body.schema.json +160 -0
  12. package/artifacts/schema/journal-final-seal.schema.json +169 -0
  13. package/artifacts/schema/journal-first-checkpoint-body.schema.json +101 -0
  14. package/artifacts/schema/journal-first-checkpoint.schema.json +111 -0
  15. package/artifacts/schema/journal-generation-checkpoint-body.schema.json +88 -0
  16. package/artifacts/schema/journal-generation-checkpoint.schema.json +97 -0
  17. package/artifacts/schema/journal-intent-v2-body.schema.json +4166 -0
  18. package/artifacts/schema/journal-intent-v2.schema.json +4616 -0
  19. package/artifacts/schema/journal-manifest-batch.schema.json +1236 -0
  20. package/artifacts/schema/journal-manifest-binding.schema.json +3541 -0
  21. package/artifacts/schema/journal-manifest-entry.schema.json +106 -0
  22. package/artifacts/schema/journal-manifest-intent-projection.schema.json +1428 -0
  23. package/artifacts/schema/journal-manifest-row.schema.json +578 -0
  24. package/artifacts/schema/journal-manifest-scope.schema.json +135 -0
  25. package/artifacts/schema/journal-mirror-attempt.schema.json +182 -0
  26. package/artifacts/schema/journal-mixed-export.schema.json +3115 -0
  27. package/artifacts/schema/journal-registry-activation-receipt-body.schema.json +304 -0
  28. package/artifacts/schema/journal-registry-activation-receipt.schema.json +324 -0
  29. package/artifacts/schema/journal-registry-transition-body.schema.json +113 -0
  30. package/artifacts/schema/journal-registry-transition.schema.json +123 -0
  31. package/artifacts/schema/journal-replay-receipt-body.schema.json +1252 -0
  32. package/artifacts/schema/journal-replay-receipt.schema.json +1261 -0
  33. package/artifacts/schema/journal-v2-activation-checkpoint-body.schema.json +99 -0
  34. package/artifacts/schema/journal-v2-activation-checkpoint.schema.json +108 -0
  35. package/artifacts/schema/legal-acceptance-list-response.schema.json +31 -2
  36. package/artifacts/schema/legal-acceptance-version-row.schema.json +31 -2
  37. package/artifacts/schema/legal-offer-conflict-details.schema.json +32 -0
  38. package/artifacts/schema/legal-offer-decision-lookup-query.schema.json +16 -0
  39. package/artifacts/schema/legal-offer-decision-request.schema.json +37 -0
  40. package/artifacts/schema/legal-offer-decision-result.schema.json +409 -0
  41. package/artifacts/schema/legal-offer-decision-snapshot.schema.json +678 -0
  42. package/artifacts/schema/legal-offer-display-request.schema.json +16 -0
  43. package/artifacts/schema/legal-offer-display-response.schema.json +712 -0
  44. package/artifacts/schema/legal-offer-list-query.schema.json +17 -0
  45. package/artifacts/schema/legal-offer-list-response.schema.json +347 -0
  46. package/artifacts/schema/legal-offer-summary.schema.json +321 -0
  47. package/artifacts/schema/plan-change-prepare-response.schema.json +749 -504
  48. package/dist/billing.d.ts +361 -275
  49. package/dist/billing.js +25 -4
  50. package/dist/errors.d.ts +1 -1
  51. package/dist/errors.js +2 -0
  52. package/dist/index.d.ts +12 -0
  53. package/dist/index.js +6 -0
  54. package/dist/journal-controls.d.ts +228 -0
  55. package/dist/journal-controls.js +111 -0
  56. package/dist/journal-intents.d.ts +1695 -0
  57. package/dist/journal-intents.js +97 -0
  58. package/dist/journal-manifests.d.ts +1670 -0
  59. package/dist/journal-manifests.js +182 -0
  60. package/dist/journal-restore.d.ts +1871 -0
  61. package/dist/journal-restore.js +324 -0
  62. package/dist/journal-seals.d.ts +147 -0
  63. package/dist/journal-seals.js +89 -0
  64. package/dist/legal-acceptances.d.ts +4 -0
  65. package/dist/legal-acceptances.js +9 -2
  66. package/dist/legal-offers.d.ts +468 -0
  67. package/dist/legal-offers.js +91 -0
  68. package/dist/realtime.d.ts +2 -2
  69. package/dist/routes.js +54 -0
  70. package/package.json +1 -1
package/dist/billing.js CHANGED
@@ -388,7 +388,8 @@ function localDate(instant, timeZone) {
388
388
  return null;
389
389
  }
390
390
  }
391
- export const billingDecisionPeriod = z.object({
391
+ const existingBillingPeriod = z.object({
392
+ anchor: z.literal('existing_period'),
392
393
  display_time_zone: ianaTimeZone,
393
394
  starts_on: z.iso.date(),
394
395
  starts_at: utcInstant.nullable(),
@@ -406,6 +407,19 @@ export const billingDecisionPeriod = z.object({
406
407
  if (period.effective.mode === 'on_confirmation' && localDate(period.effective.quoted_as_of_at, period.display_time_zone) !== period.effective.local_date)
407
408
  ctx.addIssue({ code: 'custom', path: ['effective', 'local_date'], message: 'Quoted local date must match the display zone.' });
408
409
  });
410
+ const firstPaymentPeriod = z.discriminatedUnion('cycle', [
411
+ z.strictObject({
412
+ anchor: z.literal('on_first_successful_payment'), cycle: z.literal('monthly'),
413
+ start_statement: z.literal('Starts when your first payment succeeds'),
414
+ period_statement: z.literal('First billing period: one full month from successful payment; renews at the end of that period'),
415
+ }),
416
+ z.strictObject({
417
+ anchor: z.literal('on_first_successful_payment'), cycle: z.literal('yearly'),
418
+ start_statement: z.literal('Starts when your first payment succeeds'),
419
+ period_statement: z.literal('First billing period: one full year from successful payment; renews at the end of that period'),
420
+ }),
421
+ ]);
422
+ export const billingDecisionPeriod = z.union([existingBillingPeriod, firstPaymentPeriod]);
409
423
  const declaration = z.object({
410
424
  text_id: z.literal('DR-1374-draft-3-C.4'),
411
425
  text: z.string().min(1),
@@ -425,14 +439,18 @@ const snapshotBase = z.object({
425
439
  ...quoteIdentity,
426
440
  amounts: billingDecisionAmounts,
427
441
  period: billingDecisionPeriod,
442
+ future_price_replacement: z.strictObject({ agreement_id: z.uuid(), text: z.string().min(1).regex(/\S/) }).nullable(),
428
443
  declaration,
429
444
  expires_at: utcInstant,
430
445
  }).strict();
431
446
  export const billingDecisionSnapshot = z.discriminatedUnion('decision_kind', [
432
447
  snapshotBase.extend({ decision_kind: z.literal('checkout'), selection: purchaseSelection }).strict(),
433
- snapshotBase.extend({ decision_kind: z.literal('paid_change'), selection: purchaseSelection }).strict(),
434
- snapshotBase.extend({ decision_kind: z.literal('plan_change'), selection: planChangeSelection }).strict(),
448
+ snapshotBase.extend({ decision_kind: z.literal('paid_change'), selection: purchaseSelection, period: existingBillingPeriod }).strict(),
449
+ snapshotBase.extend({ decision_kind: z.literal('plan_change'), selection: planChangeSelection, period: existingBillingPeriod }).strict(),
435
450
  ]).superRefine((value, ctx) => {
451
+ if (value.period.anchor === 'on_first_successful_payment' && value.period.cycle !== value.selection.cycle) {
452
+ ctx.addIssue({ code: 'custom', path: ['period', 'cycle'], message: 'First-payment period must match the selected cycle.' });
453
+ }
436
454
  const expected = `By selecting “Order and pay”, you agree to the Terms of Service and the Data Processing Agreement for ${value.organization_name}.`;
437
455
  if (value.declaration.text !== expected)
438
456
  ctx.addIssue({ code: 'custom', path: ['declaration', 'text'], message: 'Declaration must match the approved C.4 sentence and organization.' });
@@ -447,7 +465,10 @@ export const billingDecisionSnapshot = z.discriminatedUnion('decision_kind', [
447
465
  const expectedAddons = addonKey.options.filter((key) => value.selection.addons[key] > 0);
448
466
  if (lines.length !== expectedAddons.length || lines.some((line, i) => line.addon !== expectedAddons[i] || line.quantity !== value.selection.addons[line.addon]))
449
467
  ctx.addIssue({ code: 'custom', path: ['amounts', 'addon_lines'], message: 'Add-on lines must match absolute selection in catalogue order.' });
450
- });
468
+ }).meta({ allOf: ['monthly', 'yearly'].map(cycle => ({
469
+ if: { properties: { period: { properties: { anchor: { const: 'on_first_successful_payment' }, cycle: { const: cycle } }, required: ['anchor', 'cycle'] } }, required: ['period'] },
470
+ then: { properties: { selection: { properties: { cycle: { const: cycle } }, required: ['cycle'] } }, required: ['selection'] },
471
+ })) });
451
472
  export const billingDecisionDisplayResponse = z.object({
452
473
  confirmation_proof: confirmationProof,
453
474
  expires_at: utcInstant,
package/dist/errors.d.ts CHANGED
@@ -246,5 +246,5 @@ export type BillingDocumentsUnavailableDetails = z.infer<typeof billingDocuments
246
246
  * list is the shared vocabulary, not a closed set, so a new refusal never
247
247
  * needs a contracts release before it can be reported honestly.
248
248
  */
249
- export declare const ERROR_CODES: readonly ["not_found", "validation_error", "bad_request", "unknown_datapoint", "invalid_token", "protocol_mismatch", "bridge_too_old", "invalid_frame", "duplicate_slug", "reserved_slug", "unknown_slug", "unknown_field_path", "unknown_type", "unknown_topic", "invalid_rate", "invalid_range", "config_conflict", "no_data", "robot_offline", "bridge_timeout", "unauthorized", "forbidden", "invalid_credentials", "token_expired", "token_revoked", "email_taken", "identifier_taken", "weak_password", "account_blocked", "busy", "parameter_invalid", "cancel_rejected", "job_lost", "operator_verified_stopped", "job_unknown_to_bridge", "action_server_lost", "action_failed", "goal_rejected", "goal_send_failed", "result_failed", "goal_uncontrollable", "bridge_disconnected", "config_changed", "publisher_busy", "unknown_command", "not_subscribable", "camera_offline", "no_snapshot_yet", "live_unavailable", "wrong_kind", "not_recorded", "not_aggregatable", "quota_exceeded", "credential_in_use", "goal_timeout", "robot_in_use", "robot_deletion_partial", "job_queue_full", "invalid_uuid", "rate_limited", "tier_required", "token_spent", "service_timeout", "asset_missing", "dynamic_registration_disabled", "client_limit_reached", "idp_unavailable", "mcp_disabled", "tool_not_available", "capability_required", "last_owner", "role_name_taken", "role_in_use", "last_role", "target_state_conflict", "job_state_conflict", "signup_closed", "draft_not_a_document", "internal_error", "not_cancellable", "unsupported_media_type", "wrong_browser", "invalid_yaml", "unstorable_yaml", "registration_closed", "domain_not_allowed", "email_unverified", "origin_not_allowed", "template_invalid", "provider_disabled", "provider_misconfigured", "invalid_redirect_uri", "interaction_expired", "invalid_code", "method_not_allowed", "plan_limit", "plan_required", "org_locked", "file_too_large", "billing_unavailable", "payment_provider_unavailable", "history_migrating", "billing_documents_unavailable", "support_read_only", "support_forbidden"];
249
+ export declare const ERROR_CODES: readonly ["not_found", "validation_error", "bad_request", "unknown_datapoint", "invalid_token", "protocol_mismatch", "bridge_too_old", "invalid_frame", "duplicate_slug", "reserved_slug", "unknown_slug", "unknown_field_path", "unknown_type", "unknown_topic", "invalid_rate", "invalid_range", "config_conflict", "no_data", "robot_offline", "bridge_timeout", "unauthorized", "forbidden", "invalid_credentials", "token_expired", "token_revoked", "email_taken", "identifier_taken", "weak_password", "account_blocked", "busy", "parameter_invalid", "cancel_rejected", "job_lost", "operator_verified_stopped", "job_unknown_to_bridge", "action_server_lost", "action_failed", "goal_rejected", "goal_send_failed", "result_failed", "goal_uncontrollable", "bridge_disconnected", "config_changed", "publisher_busy", "unknown_command", "not_subscribable", "camera_offline", "no_snapshot_yet", "live_unavailable", "wrong_kind", "not_recorded", "not_aggregatable", "quota_exceeded", "credential_in_use", "goal_timeout", "robot_in_use", "robot_deletion_partial", "job_queue_full", "invalid_uuid", "rate_limited", "tier_required", "token_spent", "service_timeout", "asset_missing", "dynamic_registration_disabled", "client_limit_reached", "idp_unavailable", "mcp_disabled", "tool_not_available", "capability_required", "last_owner", "role_name_taken", "role_in_use", "last_role", "target_state_conflict", "job_state_conflict", "signup_closed", "draft_not_a_document", "internal_error", "not_cancellable", "unsupported_media_type", "wrong_browser", "invalid_yaml", "unstorable_yaml", "registration_closed", "domain_not_allowed", "email_unverified", "origin_not_allowed", "template_invalid", "provider_disabled", "provider_misconfigured", "invalid_redirect_uri", "interaction_expired", "invalid_code", "method_not_allowed", "plan_limit", "plan_required", "org_locked", "file_too_large", "billing_unavailable", "legal_offer_unavailable", "payment_provider_unavailable", "history_migrating", "billing_documents_unavailable", "support_read_only", "support_forbidden"];
250
250
  export type ErrorCode = (typeof ERROR_CODES)[number];
package/dist/errors.js CHANGED
@@ -1068,6 +1068,8 @@ export const ERROR_CODES = [
1068
1068
  * configured.
1069
1069
  */
1070
1070
  'billing_unavailable',
1071
+ /** `503`: legal offer storage is unavailable; no successful decision is asserted. Recover using the operation-key lookup before retrying. No details payload. */
1072
+ 'legal_offer_unavailable',
1071
1073
  /**
1072
1074
  * `502`: Mollie did not answer, or answered with an error, so nothing was
1073
1075
  * charged and nothing changed. `details` is `paymentProviderUnavailableDetails`: Mollie's own
package/dist/index.d.ts CHANGED
@@ -1,4 +1,16 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
+ export { journalMirrorAttempt, journalExportItem, journalMixedExport, journalEvidenceRef, journalAccessProof, journalReplayReceiptBody, journalReplayReceipt } from './journal-restore.js';
3
+ export type { JournalMirrorAttempt, JournalExportItem, JournalMixedExport, JournalEvidenceRef, JournalAccessProof, JournalReplayReceiptBody, JournalReplayReceipt } from './journal-restore.js';
4
+ export { journalManifestScope, journalManifestRow, journalManifestEntry, journalManifestBatch, journalDeletionManifest, journalManifestIntentProjection, journalManifestBinding, } from './journal-manifests.js';
5
+ export type { JournalManifestScope, JournalManifestRow, JournalManifestEntry, JournalManifestBatch, JournalDeletionManifest, JournalManifestIntentProjection, JournalManifestBinding, } from './journal-manifests.js';
6
+ export { journalV2ActivationCheckpointBody, journalV2ActivationCheckpoint, journalGenerationCheckpointBody, journalGenerationCheckpoint, journalFinalSealBody, journalFinalSeal, } from './journal-seals.js';
7
+ export type { JournalV2ActivationCheckpointBody, JournalV2ActivationCheckpoint, JournalGenerationCheckpointBody, JournalGenerationCheckpoint, JournalFinalSealBody, JournalFinalSeal, } from './journal-seals.js';
8
+ export { journalIntentV2Body, journalIntentV2 } from './journal-intents.js';
9
+ export type { JournalIntentV2Body, JournalIntentV2 } from './journal-intents.js';
10
+ export { journalFirstCheckpointBody, journalFirstCheckpoint, journalRegistryTransitionBody, journalRegistryTransition, journalRegistryActivationReceiptBody, journalRegistryActivationReceipt, } from './journal-controls.js';
11
+ export type { JournalFirstCheckpointBody, JournalFirstCheckpoint, JournalRegistryTransitionBody, JournalRegistryTransition, JournalRegistryActivationReceiptBody, JournalRegistryActivationReceipt, } from './journal-controls.js';
12
+ export { legalOfferListQuery, legalOfferSummary, legalOfferListResponse, legalOfferDisplayRequest, legalOfferDecisionRequest, legalOfferDecisionLookupQuery, legalOfferDecisionSnapshot, legalOfferDisplayResponse, legalOfferDecisionResult, legalOfferConflictDetails, } from './legal-offers.js';
13
+ export type { LegalOfferListQuery, LegalOfferSummary, LegalOfferListResponse, LegalOfferDisplayRequest, LegalOfferDecisionRequest, LegalOfferDecisionLookupQuery, LegalOfferDecisionSnapshot, LegalOfferDisplayResponse, LegalOfferDecisionResult, LegalOfferConflictDetails, } from './legal-offers.js';
2
14
  export { SLUG_RULE, ROS_NAME_RULE, ROS_TYPE_NAME_RULE, FIELD_PATH_RULE, slug, rosName, rosTypeName, fieldPath, wireSeqCursor, wireTimestampMs, applyErrorKind, applyError, } from './common.js';
3
15
  export type { ApplyErrorKind, ApplyError } from './common.js';
4
16
  export { MCP_PROTOCOL_VERSION, MCP_ENDPOINT_PATH, mcpAppEndpointPath, MCP_APP_PATHS, MCP_TOOL_NAME_MAX, MCP_ASSET_LINK_PATH, MCP_ASSET_LINK_TTL_MS, mcpToolNamePattern, mcpToolKind, mcpExposure, mcpCapabilities, mcpRobotDatasheet, mcpRolePreviewResponse, } from './mcp.js';
package/dist/index.js CHANGED
@@ -1,4 +1,10 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
+ export { journalMirrorAttempt, journalExportItem, journalMixedExport, journalEvidenceRef, journalAccessProof, journalReplayReceiptBody, journalReplayReceipt } from './journal-restore.js';
3
+ export { journalManifestScope, journalManifestRow, journalManifestEntry, journalManifestBatch, journalDeletionManifest, journalManifestIntentProjection, journalManifestBinding, } from './journal-manifests.js';
4
+ export { journalV2ActivationCheckpointBody, journalV2ActivationCheckpoint, journalGenerationCheckpointBody, journalGenerationCheckpoint, journalFinalSealBody, journalFinalSeal, } from './journal-seals.js';
5
+ export { journalIntentV2Body, journalIntentV2 } from './journal-intents.js';
6
+ export { journalFirstCheckpointBody, journalFirstCheckpoint, journalRegistryTransitionBody, journalRegistryTransition, journalRegistryActivationReceiptBody, journalRegistryActivationReceipt, } from './journal-controls.js';
7
+ export { legalOfferListQuery, legalOfferSummary, legalOfferListResponse, legalOfferDisplayRequest, legalOfferDecisionRequest, legalOfferDecisionLookupQuery, legalOfferDecisionSnapshot, legalOfferDisplayResponse, legalOfferDecisionResult, legalOfferConflictDetails, } from './legal-offers.js';
2
8
  export { SLUG_RULE, ROS_NAME_RULE, ROS_TYPE_NAME_RULE, FIELD_PATH_RULE, slug, rosName, rosTypeName, fieldPath, wireSeqCursor, wireTimestampMs, applyErrorKind, applyError, } from './common.js';
3
9
  export { MCP_PROTOCOL_VERSION, MCP_ENDPOINT_PATH, mcpAppEndpointPath, MCP_APP_PATHS, MCP_TOOL_NAME_MAX, MCP_ASSET_LINK_PATH, MCP_ASSET_LINK_TTL_MS, mcpToolNamePattern, mcpToolKind, mcpExposure, mcpCapabilities, mcpRobotDatasheet, mcpRolePreviewResponse, } from './mcp.js';
4
10
  export { PROTOCOL_VERSION, PROTOCOL_VERSIONS, PROTOCOL_SUNSET_DAYS, LATEST_BRIDGE_VERSION, protocolStatus, minimumProtocolVersion, sunsetOf, statusFromTable, bridgeHello, cloudHelloOk, cloudHelloError, cloudPing, bridgePong, bridgeLinkMode, datapointFrame, bridgeState, cloudConfig, bridgeConfigApplied, cloudIntrospectRequest, bridgeIntrospect, cloudTypeRequest, bridgeTypeDefinitions, cloudInvoke, cloudCancel, CANCEL_RETURN_CODES, cancelReturnCode, bridgeCancelResultEntry, bridgeCancelResult, cloudPublish, bridgeJobUpdate, bridgeJobLost, cloudJobQuery, bridgeJobStatusEntry, bridgeJobStatus, snapshotHeader, cloudCameraStart, cloudCameraStop, bridgeCameraState, SNAPSHOT_MAX_BYTES, CLOSE_ROBOT_DELETED, CLOSE_TOKEN_ROTATED,
@@ -0,0 +1,228 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { z } from 'zod';
3
+ /** RFC-8785 body, signed with domain `fleetless.journal-first-checkpoint.v1` + NUL. */
4
+ export declare const journalFirstCheckpointBody: z.ZodObject<{
5
+ registry_digest: z.ZodString;
6
+ build_set_digest: z.ZodString;
7
+ registry_version_id: z.ZodString;
8
+ build_set_version_id: z.ZodString;
9
+ copy_inventory_digest: z.ZodString;
10
+ journal_primary_id: z.ZodString;
11
+ pinned_standby_id: z.ZodString;
12
+ fence_drain_evidence_hash: z.ZodString;
13
+ fence_drain_evidence_version_id: z.ZodString;
14
+ source_db_timeline: z.ZodNumber;
15
+ source_db_lsn: z.ZodString;
16
+ sequence: z.ZodLiteral<0>;
17
+ previous_hash: z.ZodLiteral<string>;
18
+ checkpoint_at: z.ZodISODateTime;
19
+ environment: z.ZodString;
20
+ generation: z.ZodString;
21
+ signing_key_id: z.ZodString;
22
+ schema: z.ZodLiteral<"fleetless.journal-first-checkpoint.v1">;
23
+ }, z.core.$strict>;
24
+ export type JournalFirstCheckpointBody = z.infer<typeof journalFirstCheckpointBody>;
25
+ export declare const journalFirstCheckpoint: z.ZodObject<{
26
+ registry_digest: z.ZodString;
27
+ build_set_digest: z.ZodString;
28
+ registry_version_id: z.ZodString;
29
+ build_set_version_id: z.ZodString;
30
+ copy_inventory_digest: z.ZodString;
31
+ journal_primary_id: z.ZodString;
32
+ pinned_standby_id: z.ZodString;
33
+ fence_drain_evidence_hash: z.ZodString;
34
+ fence_drain_evidence_version_id: z.ZodString;
35
+ source_db_timeline: z.ZodNumber;
36
+ source_db_lsn: z.ZodString;
37
+ sequence: z.ZodLiteral<0>;
38
+ previous_hash: z.ZodLiteral<string>;
39
+ checkpoint_at: z.ZodISODateTime;
40
+ environment: z.ZodString;
41
+ generation: z.ZodString;
42
+ signing_key_id: z.ZodString;
43
+ schema: z.ZodLiteral<"fleetless.journal-first-checkpoint.v1">;
44
+ checkpoint_hash: z.ZodString;
45
+ signature: z.ZodString;
46
+ }, z.core.$strict>;
47
+ export type JournalFirstCheckpoint = z.infer<typeof journalFirstCheckpoint>;
48
+ /** Shares the intent sequence; the control record itself has no customer mutation. */
49
+ export declare const journalRegistryTransitionBody: z.ZodObject<{
50
+ fence_drain_evidence_hash: z.ZodString;
51
+ fence_drain_evidence_version_id: z.ZodString;
52
+ source_db_timeline: z.ZodNumber;
53
+ source_db_lsn: z.ZodString;
54
+ sequence: z.ZodNumber;
55
+ previous_hash: z.ZodString;
56
+ deployment_epoch: z.ZodNumber;
57
+ activated_at: z.ZodISODateTime;
58
+ old_registry_digest: z.ZodString;
59
+ new_registry_digest: z.ZodString;
60
+ old_registry_version_id: z.ZodString;
61
+ new_registry_version_id: z.ZodString;
62
+ old_build_set_digest: z.ZodString;
63
+ new_build_set_digest: z.ZodString;
64
+ old_build_set_version_id: z.ZodString;
65
+ new_build_set_version_id: z.ZodString;
66
+ environment: z.ZodString;
67
+ generation: z.ZodString;
68
+ signing_key_id: z.ZodString;
69
+ schema: z.ZodLiteral<"fleetless.registry-transition.v1">;
70
+ }, z.core.$strict>;
71
+ export type JournalRegistryTransitionBody = z.infer<typeof journalRegistryTransitionBody>;
72
+ export declare const journalRegistryTransition: z.ZodObject<{
73
+ fence_drain_evidence_hash: z.ZodString;
74
+ fence_drain_evidence_version_id: z.ZodString;
75
+ source_db_timeline: z.ZodNumber;
76
+ source_db_lsn: z.ZodString;
77
+ sequence: z.ZodNumber;
78
+ previous_hash: z.ZodString;
79
+ deployment_epoch: z.ZodNumber;
80
+ activated_at: z.ZodISODateTime;
81
+ old_registry_digest: z.ZodString;
82
+ new_registry_digest: z.ZodString;
83
+ old_registry_version_id: z.ZodString;
84
+ new_registry_version_id: z.ZodString;
85
+ old_build_set_digest: z.ZodString;
86
+ new_build_set_digest: z.ZodString;
87
+ old_build_set_version_id: z.ZodString;
88
+ new_build_set_version_id: z.ZodString;
89
+ environment: z.ZodString;
90
+ generation: z.ZodString;
91
+ signing_key_id: z.ZodString;
92
+ schema: z.ZodLiteral<"fleetless.registry-transition.v1">;
93
+ record_hash: z.ZodString;
94
+ signature: z.ZodString;
95
+ }, z.core.$strict>;
96
+ export type JournalRegistryTransition = z.infer<typeof journalRegistryTransition>;
97
+ export declare const journalRegistryActivationReceiptBody: z.ZodUnion<readonly [z.ZodObject<{
98
+ control_sequence: z.ZodLiteral<0>;
99
+ old_registry_digest: z.ZodLiteral<string>;
100
+ old_registry_version_id: z.ZodLiteral<"">;
101
+ old_build_set_digest: z.ZodLiteral<string>;
102
+ old_build_set_version_id: z.ZodLiteral<"">;
103
+ previous_receipt_hash: z.ZodLiteral<string>;
104
+ fence_retain_until: z.ZodISODateTime;
105
+ new_registry_digest: z.ZodString;
106
+ new_registry_version_id: z.ZodString;
107
+ new_build_set_digest: z.ZodString;
108
+ new_build_set_version_id: z.ZodString;
109
+ standby_head_hash: z.ZodString;
110
+ standby_id: z.ZodString;
111
+ copy_inventory_digest: z.ZodString;
112
+ copy_coverage_digest: z.ZodString;
113
+ coverage_verdict: z.ZodEnum<{
114
+ covered: "covered";
115
+ gap: "gap";
116
+ }>;
117
+ fence_drain_evidence_hash: z.ZodString;
118
+ fence_drain_evidence_version_id: z.ZodString;
119
+ source_db_timeline: z.ZodNumber;
120
+ source_db_lsn: z.ZodString;
121
+ control_hash: z.ZodString;
122
+ mirror_version_id: z.ZodString;
123
+ mirror_retain_until: z.ZodISODateTime;
124
+ environment: z.ZodString;
125
+ generation: z.ZodString;
126
+ signing_key_id: z.ZodString;
127
+ schema: z.ZodLiteral<"fleetless.registry-activation-receipt.v1">;
128
+ }, z.core.$strict>, z.ZodObject<{
129
+ control_sequence: z.ZodNumber;
130
+ old_registry_digest: z.ZodString;
131
+ old_registry_version_id: z.ZodString;
132
+ old_build_set_digest: z.ZodString;
133
+ old_build_set_version_id: z.ZodString;
134
+ previous_receipt_hash: z.ZodString;
135
+ fence_retain_until: z.ZodISODateTime;
136
+ new_registry_digest: z.ZodString;
137
+ new_registry_version_id: z.ZodString;
138
+ new_build_set_digest: z.ZodString;
139
+ new_build_set_version_id: z.ZodString;
140
+ standby_head_hash: z.ZodString;
141
+ standby_id: z.ZodString;
142
+ copy_inventory_digest: z.ZodString;
143
+ copy_coverage_digest: z.ZodString;
144
+ coverage_verdict: z.ZodEnum<{
145
+ covered: "covered";
146
+ gap: "gap";
147
+ }>;
148
+ fence_drain_evidence_hash: z.ZodString;
149
+ fence_drain_evidence_version_id: z.ZodString;
150
+ source_db_timeline: z.ZodNumber;
151
+ source_db_lsn: z.ZodString;
152
+ control_hash: z.ZodString;
153
+ mirror_version_id: z.ZodString;
154
+ mirror_retain_until: z.ZodISODateTime;
155
+ environment: z.ZodString;
156
+ generation: z.ZodString;
157
+ signing_key_id: z.ZodString;
158
+ schema: z.ZodLiteral<"fleetless.registry-activation-receipt.v1">;
159
+ }, z.core.$strict>]>;
160
+ export type JournalRegistryActivationReceiptBody = z.infer<typeof journalRegistryActivationReceiptBody>;
161
+ export declare const journalRegistryActivationReceipt: z.ZodUnion<readonly [z.ZodObject<{
162
+ control_sequence: z.ZodLiteral<0>;
163
+ old_registry_digest: z.ZodLiteral<string>;
164
+ old_registry_version_id: z.ZodLiteral<"">;
165
+ old_build_set_digest: z.ZodLiteral<string>;
166
+ old_build_set_version_id: z.ZodLiteral<"">;
167
+ previous_receipt_hash: z.ZodLiteral<string>;
168
+ fence_retain_until: z.ZodISODateTime;
169
+ new_registry_digest: z.ZodString;
170
+ new_registry_version_id: z.ZodString;
171
+ new_build_set_digest: z.ZodString;
172
+ new_build_set_version_id: z.ZodString;
173
+ standby_head_hash: z.ZodString;
174
+ standby_id: z.ZodString;
175
+ copy_inventory_digest: z.ZodString;
176
+ copy_coverage_digest: z.ZodString;
177
+ coverage_verdict: z.ZodEnum<{
178
+ covered: "covered";
179
+ gap: "gap";
180
+ }>;
181
+ fence_drain_evidence_hash: z.ZodString;
182
+ fence_drain_evidence_version_id: z.ZodString;
183
+ source_db_timeline: z.ZodNumber;
184
+ source_db_lsn: z.ZodString;
185
+ control_hash: z.ZodString;
186
+ mirror_version_id: z.ZodString;
187
+ mirror_retain_until: z.ZodISODateTime;
188
+ environment: z.ZodString;
189
+ generation: z.ZodString;
190
+ signing_key_id: z.ZodString;
191
+ schema: z.ZodLiteral<"fleetless.registry-activation-receipt.v1">;
192
+ receipt_hash: z.ZodString;
193
+ signature: z.ZodString;
194
+ }, z.core.$strict>, z.ZodObject<{
195
+ control_sequence: z.ZodNumber;
196
+ old_registry_digest: z.ZodString;
197
+ old_registry_version_id: z.ZodString;
198
+ old_build_set_digest: z.ZodString;
199
+ old_build_set_version_id: z.ZodString;
200
+ previous_receipt_hash: z.ZodString;
201
+ fence_retain_until: z.ZodISODateTime;
202
+ new_registry_digest: z.ZodString;
203
+ new_registry_version_id: z.ZodString;
204
+ new_build_set_digest: z.ZodString;
205
+ new_build_set_version_id: z.ZodString;
206
+ standby_head_hash: z.ZodString;
207
+ standby_id: z.ZodString;
208
+ copy_inventory_digest: z.ZodString;
209
+ copy_coverage_digest: z.ZodString;
210
+ coverage_verdict: z.ZodEnum<{
211
+ covered: "covered";
212
+ gap: "gap";
213
+ }>;
214
+ fence_drain_evidence_hash: z.ZodString;
215
+ fence_drain_evidence_version_id: z.ZodString;
216
+ source_db_timeline: z.ZodNumber;
217
+ source_db_lsn: z.ZodString;
218
+ control_hash: z.ZodString;
219
+ mirror_version_id: z.ZodString;
220
+ mirror_retain_until: z.ZodISODateTime;
221
+ environment: z.ZodString;
222
+ generation: z.ZodString;
223
+ signing_key_id: z.ZodString;
224
+ schema: z.ZodLiteral<"fleetless.registry-activation-receipt.v1">;
225
+ receipt_hash: z.ZodString;
226
+ signature: z.ZodString;
227
+ }, z.core.$strict>]>;
228
+ export type JournalRegistryActivationReceipt = z.infer<typeof journalRegistryActivationReceipt>;
@@ -0,0 +1,111 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { z } from 'zod';
3
+ // Private Cloud/Ops wire, not customer API routes. These schemas validate
4
+ // decoded shapes only: canonical bytes, signatures and activation evidence
5
+ // must be verified by the journal/restore consumers before any mutation.
6
+ const hash = z.string().regex(/^[0-9a-f]{64}$/);
7
+ const zeroHash = z.literal('0'.repeat(64));
8
+ 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}$/);
9
+ const opaqueId = z.string().min(1);
10
+ const positiveInteger = z.number().int().min(1).max(Number.MAX_SAFE_INTEGER);
11
+ const utcMillis = z.iso.datetime({ precision: 3 });
12
+ // PostgreSQL prints each 32-bit LSN half in uppercase hex without leading zeros.
13
+ const lsn = z.string().regex(/^(?:0|[1-9A-F][0-9A-F]{0,7})\/(?:0|[1-9A-F][0-9A-F]{0,7})$/);
14
+ // 64 bytes encode to 86 base64url characters; the last four padding bits are zero.
15
+ const signature = z.string().regex(/^[A-Za-z0-9_-]{85}[AQgw]$/);
16
+ const identity = {
17
+ environment: opaqueId,
18
+ generation: uuid,
19
+ signing_key_id: opaqueId,
20
+ };
21
+ const fence = {
22
+ fence_drain_evidence_hash: hash,
23
+ fence_drain_evidence_version_id: opaqueId,
24
+ source_db_timeline: positiveInteger,
25
+ source_db_lsn: lsn,
26
+ };
27
+ /** RFC-8785 body, signed with domain `fleetless.journal-first-checkpoint.v1` + NUL. */
28
+ export const journalFirstCheckpointBody = z.strictObject({
29
+ schema: z.literal('fleetless.journal-first-checkpoint.v1'),
30
+ ...identity,
31
+ sequence: z.literal(0),
32
+ previous_hash: zeroHash,
33
+ checkpoint_at: utcMillis,
34
+ ...fence,
35
+ registry_digest: hash,
36
+ build_set_digest: hash,
37
+ registry_version_id: opaqueId,
38
+ build_set_version_id: opaqueId,
39
+ copy_inventory_digest: hash,
40
+ journal_primary_id: opaqueId,
41
+ pinned_standby_id: opaqueId,
42
+ });
43
+ export const journalFirstCheckpoint = journalFirstCheckpointBody.extend({
44
+ checkpoint_hash: hash,
45
+ signature,
46
+ });
47
+ /** Shares the intent sequence; the control record itself has no customer mutation. */
48
+ export const journalRegistryTransitionBody = z.strictObject({
49
+ schema: z.literal('fleetless.registry-transition.v1'),
50
+ ...identity,
51
+ sequence: positiveInteger,
52
+ previous_hash: hash,
53
+ deployment_epoch: positiveInteger,
54
+ activated_at: utcMillis,
55
+ old_registry_digest: hash,
56
+ new_registry_digest: hash,
57
+ old_registry_version_id: opaqueId,
58
+ new_registry_version_id: opaqueId,
59
+ old_build_set_digest: hash,
60
+ new_build_set_digest: hash,
61
+ old_build_set_version_id: opaqueId,
62
+ new_build_set_version_id: opaqueId,
63
+ ...fence,
64
+ });
65
+ export const journalRegistryTransition = journalRegistryTransitionBody.extend({
66
+ record_hash: hash,
67
+ signature,
68
+ });
69
+ const activationFields = {
70
+ schema: z.literal('fleetless.registry-activation-receipt.v1'),
71
+ ...identity,
72
+ control_hash: hash,
73
+ mirror_version_id: opaqueId,
74
+ mirror_retain_until: utcMillis,
75
+ ...fence,
76
+ fence_retain_until: utcMillis,
77
+ new_registry_digest: hash,
78
+ new_registry_version_id: opaqueId,
79
+ new_build_set_digest: hash,
80
+ new_build_set_version_id: opaqueId,
81
+ standby_head_hash: hash,
82
+ standby_id: opaqueId,
83
+ copy_inventory_digest: hash,
84
+ copy_coverage_digest: hash,
85
+ coverage_verdict: z.enum(['covered', 'gap']),
86
+ };
87
+ const firstActivationBody = z.strictObject({
88
+ ...activationFields,
89
+ control_sequence: z.literal(0),
90
+ old_registry_digest: zeroHash,
91
+ old_registry_version_id: z.literal(''),
92
+ old_build_set_digest: zeroHash,
93
+ old_build_set_version_id: z.literal(''),
94
+ previous_receipt_hash: zeroHash,
95
+ });
96
+ const laterActivationBody = z.strictObject({
97
+ ...activationFields,
98
+ control_sequence: positiveInteger,
99
+ old_registry_digest: hash,
100
+ old_registry_version_id: opaqueId,
101
+ old_build_set_digest: hash,
102
+ old_build_set_version_id: opaqueId,
103
+ previous_receipt_hash: hash,
104
+ });
105
+ // A structural union preserves the C0-only sentinels in JSON Schema too.
106
+ // `gap` is a valid report, never permission to activate or open traffic.
107
+ export const journalRegistryActivationReceiptBody = z.union([firstActivationBody, laterActivationBody]);
108
+ export const journalRegistryActivationReceipt = z.union([
109
+ firstActivationBody.extend({ receipt_hash: hash, signature }),
110
+ laterActivationBody.extend({ receipt_hash: hash, signature }),
111
+ ]);