@greatwait/contracts 0.1.0-alpha.4 → 0.1.0-alpha.6

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 (190) hide show
  1. package/README.md +1 -1
  2. package/dist/authority.d.ts +4 -1
  3. package/dist/authority.js +1 -0
  4. package/dist/billing.d.ts +231 -1
  5. package/dist/billing.js +150 -1
  6. package/dist/callback-safety.js +13 -3
  7. package/dist/configuration-bounds.d.ts +13 -0
  8. package/dist/configuration-bounds.js +13 -0
  9. package/dist/data-export.d.ts +2 -0
  10. package/dist/delivery.d.ts +26 -0
  11. package/dist/delivery.js +2 -0
  12. package/dist/effective-limits.d.ts +40 -0
  13. package/dist/effective-limits.js +42 -0
  14. package/dist/endpoints.d.ts +173 -5
  15. package/dist/endpoints.js +77 -6
  16. package/dist/first-value-journey.d.ts +1 -1
  17. package/dist/first-value-journey.js +11 -7
  18. package/dist/forecast.d.ts +111 -21
  19. package/dist/forecast.js +87 -24
  20. package/dist/http-request.d.ts +193 -0
  21. package/dist/http-request.js +305 -0
  22. package/dist/identity.d.ts +4 -4
  23. package/dist/index.d.ts +9 -6
  24. package/dist/index.js +8 -5
  25. package/dist/mcp.d.ts +2 -1
  26. package/dist/mcp.js +1 -1
  27. package/dist/members.d.ts +141 -0
  28. package/dist/members.js +223 -0
  29. package/dist/oauth.d.ts +7 -0
  30. package/dist/operation-definitions.d.ts +20 -4
  31. package/dist/operation-definitions.js +9 -1
  32. package/dist/operational-config.d.ts +101 -0
  33. package/dist/operational-config.js +341 -0
  34. package/dist/operations.d.ts +1299 -52
  35. package/dist/operations.js +466 -32
  36. package/dist/organization-lifecycle.d.ts +10 -0
  37. package/dist/partition.d.ts +17 -9
  38. package/dist/partition.js +3 -3
  39. package/dist/policy.js +5 -2
  40. package/dist/problems.d.ts +25 -2
  41. package/dist/problems.js +49 -1
  42. package/dist/protocol.d.ts +5 -5
  43. package/dist/protocol.js +2 -1
  44. package/dist/scheduling-records.d.ts +226 -0
  45. package/dist/scheduling-records.js +5 -0
  46. package/dist/scheduling.d.ts +273 -1
  47. package/dist/scheduling.js +91 -4
  48. package/dist/secrets.d.ts +7 -0
  49. package/dist/tenancy.d.ts +1 -1
  50. package/dist/tenancy.js +1 -1
  51. package/dist/usage.js +6 -21
  52. package/dist/zod-values.d.ts +2 -2
  53. package/dist/zod-values.js +1 -1
  54. package/generated/v1/examples/attempts.list.response.json +2 -0
  55. package/generated/v1/examples/attempts.read.response.json +2 -0
  56. package/generated/v1/examples/billing.fundingconfirm.response.json +120 -0
  57. package/generated/v1/examples/billing.invoicehistory.response.json +6 -0
  58. package/generated/v1/examples/billing.invoices.response.json +15 -0
  59. package/generated/v1/examples/billing.paymenthistory.response.json +6 -0
  60. package/generated/v1/examples/billing.paymentmethod.response.json +16 -0
  61. package/generated/v1/examples/billing.paymentmethodconfirm.request.json +3 -0
  62. package/generated/v1/examples/billing.paymentmethodconfirm.response.json +16 -0
  63. package/generated/v1/examples/billing.paymentmethodremove.request.json +3 -0
  64. package/generated/v1/examples/billing.paymentmethodremove.response.json +4 -0
  65. package/generated/v1/examples/billing.paymentmethodsetup.request.json +1 -0
  66. package/generated/v1/examples/billing.paymentmethodsetup.response.json +3 -0
  67. package/generated/v1/examples/endpoints.ensure.request.json +3 -0
  68. package/generated/v1/examples/endpoints.ensure.response.json +20 -0
  69. package/generated/v1/examples/invitations.create.request.json +5 -0
  70. package/generated/v1/examples/invitations.create.response.json +7 -0
  71. package/generated/v1/examples/invitations.list.response.json +11 -0
  72. package/generated/v1/examples/invitations.resend.request.json +1 -0
  73. package/generated/v1/examples/invitations.resend.response.json +4 -0
  74. package/generated/v1/examples/invitations.revoke.request.json +3 -0
  75. package/generated/v1/examples/invitations.revoke.response.json +4 -0
  76. package/generated/v1/examples/limits.read.response.json +16 -0
  77. package/generated/v1/examples/members.list.response.json +13 -0
  78. package/generated/v1/examples/members.remove.request.json +3 -0
  79. package/generated/v1/examples/members.remove.response.json +4 -0
  80. package/generated/v1/examples/members.role.request.json +3 -0
  81. package/generated/v1/examples/members.role.response.json +4 -0
  82. package/generated/v1/examples/occurrences.redeliver.response.json +2 -0
  83. package/generated/v1/examples/projectmembers.add.request.json +1 -0
  84. package/generated/v1/examples/projectmembers.add.response.json +4 -0
  85. package/generated/v1/examples/projectmembers.remove.request.json +3 -0
  86. package/generated/v1/examples/projectmembers.remove.response.json +4 -0
  87. package/generated/v1/first-value-journey.json +24 -8
  88. package/generated/v1/manifest.json +627 -10
  89. package/generated/v1/openapi.json +29081 -15663
  90. package/generated/v1/policy-matrix.json +137 -2
  91. package/generated/v1/schemas/attempts.list.response.json +15 -0
  92. package/generated/v1/schemas/attempts.read.response.json +15 -0
  93. package/generated/v1/schemas/billing.fundingconfirm.response.json +552 -0
  94. package/generated/v1/schemas/billing.invoicehistory.query.json +16 -0
  95. package/generated/v1/schemas/billing.invoicehistory.response.json +88 -0
  96. package/generated/v1/schemas/billing.invoices.response.json +51 -0
  97. package/generated/v1/schemas/billing.ledger.response.json +5 -0
  98. package/generated/v1/schemas/billing.notificationsettingsupdate.request.json +24 -17
  99. package/generated/v1/schemas/billing.paymenthistory.query.json +16 -0
  100. package/generated/v1/schemas/billing.paymenthistory.response.json +182 -0
  101. package/generated/v1/schemas/billing.paymentmethod.response.json +137 -0
  102. package/generated/v1/schemas/billing.paymentmethodconfirm.request.json +14 -0
  103. package/generated/v1/schemas/billing.paymentmethodconfirm.response.json +137 -0
  104. package/generated/v1/schemas/billing.paymentmethodremove.request.json +12 -0
  105. package/generated/v1/schemas/billing.paymentmethodremove.response.json +137 -0
  106. package/generated/v1/schemas/billing.paymentmethodsetup.request.json +12 -0
  107. package/generated/v1/schemas/billing.paymentmethodsetup.response.json +11 -0
  108. package/generated/v1/schemas/billing.purchase.request.json +4 -0
  109. package/generated/v1/schemas/context.read.response.json +1 -0
  110. package/generated/v1/schemas/credentials.connection.response.json +1 -0
  111. package/generated/v1/schemas/credentials.create.request.json +1 -0
  112. package/generated/v1/schemas/credentials.create.response.json +1 -0
  113. package/generated/v1/schemas/credentials.list.response.json +1 -0
  114. package/generated/v1/schemas/credentials.revoke.response.json +1 -0
  115. package/generated/v1/schemas/credentials.rotate.response.json +2 -0
  116. package/generated/v1/schemas/endpoints.acknowledgeSigningKeyRotation.response.json +59 -0
  117. package/generated/v1/schemas/endpoints.create.request.json +74 -0
  118. package/generated/v1/schemas/endpoints.create.response.json +59 -0
  119. package/generated/v1/schemas/endpoints.disable.response.json +59 -0
  120. package/generated/v1/schemas/endpoints.enable.response.json +59 -0
  121. package/generated/v1/schemas/endpoints.ensure.request.json +91 -0
  122. package/generated/v1/schemas/endpoints.ensure.response.json +169 -0
  123. package/generated/v1/schemas/endpoints.list.response.json +59 -0
  124. package/generated/v1/schemas/endpoints.read.response.json +59 -0
  125. package/generated/v1/schemas/endpoints.rotateSigningKey.response.json +59 -0
  126. package/generated/v1/schemas/endpoints.update.request.json +74 -0
  127. package/generated/v1/schemas/endpoints.update.response.json +59 -0
  128. package/generated/v1/schemas/forecast.read.request-headers.json +10 -0
  129. package/generated/v1/schemas/forecast.read.response.json +148 -0
  130. package/generated/v1/schemas/grants.list.response.json +1 -0
  131. package/generated/v1/schemas/grants.revoke.response.json +1 -0
  132. package/generated/v1/schemas/invitations.create.request-headers.json +13 -0
  133. package/generated/v1/schemas/invitations.create.request.json +24 -0
  134. package/generated/v1/schemas/invitations.create.response.json +31 -0
  135. package/generated/v1/schemas/invitations.list.response.json +40 -0
  136. package/generated/v1/schemas/invitations.resend.request-headers.json +13 -0
  137. package/generated/v1/schemas/invitations.resend.request.json +6 -0
  138. package/generated/v1/schemas/invitations.resend.response.json +27 -0
  139. package/generated/v1/schemas/invitations.revoke.request-headers.json +13 -0
  140. package/generated/v1/schemas/invitations.revoke.request.json +12 -0
  141. package/generated/v1/schemas/invitations.revoke.response.json +27 -0
  142. package/generated/v1/schemas/limits.read.response.json +79 -0
  143. package/generated/v1/schemas/members.list.response.json +53 -0
  144. package/generated/v1/schemas/members.remove.request-headers.json +13 -0
  145. package/generated/v1/schemas/members.remove.request.json +12 -0
  146. package/generated/v1/schemas/members.remove.response.json +27 -0
  147. package/generated/v1/schemas/members.role.request-headers.json +13 -0
  148. package/generated/v1/schemas/members.role.request.json +12 -0
  149. package/generated/v1/schemas/members.role.response.json +27 -0
  150. package/generated/v1/schemas/occurrences.redeliver.response.json +15 -0
  151. package/generated/v1/schemas/projectmembers.add.request-headers.json +13 -0
  152. package/generated/v1/schemas/projectmembers.add.request.json +6 -0
  153. package/generated/v1/schemas/projectmembers.add.response.json +27 -0
  154. package/generated/v1/schemas/projectmembers.remove.request-headers.json +13 -0
  155. package/generated/v1/schemas/projectmembers.remove.request.json +12 -0
  156. package/generated/v1/schemas/projectmembers.remove.response.json +27 -0
  157. package/generated/v1/schemas/schedules.archive.response.json +138 -1
  158. package/generated/v1/schemas/schedules.cancel.response.json +138 -1
  159. package/generated/v1/schemas/schedules.create.request.json +150 -1
  160. package/generated/v1/schemas/schedules.create.response.json +156 -1
  161. package/generated/v1/schemas/schedules.list.response.json +138 -1
  162. package/generated/v1/schemas/schedules.pause.response.json +138 -1
  163. package/generated/v1/schemas/schedules.read.response.json +138 -1
  164. package/generated/v1/schemas/schedules.replace.request.json +150 -1
  165. package/generated/v1/schemas/schedules.replace.response.json +156 -1
  166. package/generated/v1/schemas/schedules.resume.response.json +138 -1
  167. package/generated/v1/snippets/billing.fundingconfirm.json +6 -0
  168. package/generated/v1/snippets/billing.invoicehistory.json +6 -0
  169. package/generated/v1/snippets/billing.invoices.json +6 -0
  170. package/generated/v1/snippets/billing.notificationsettingsupdate.json +1 -1
  171. package/generated/v1/snippets/billing.paymenthistory.json +6 -0
  172. package/generated/v1/snippets/billing.paymentmethod.json +6 -0
  173. package/generated/v1/snippets/billing.paymentmethodconfirm.json +6 -0
  174. package/generated/v1/snippets/billing.paymentmethodremove.json +6 -0
  175. package/generated/v1/snippets/billing.paymentmethodsetup.json +6 -0
  176. package/generated/v1/snippets/endpoints.create.json +1 -1
  177. package/generated/v1/snippets/endpoints.ensure.json +6 -0
  178. package/generated/v1/snippets/forecast.windows.json +1 -1
  179. package/generated/v1/snippets/invitations.create.json +6 -0
  180. package/generated/v1/snippets/invitations.list.json +6 -0
  181. package/generated/v1/snippets/invitations.resend.json +6 -0
  182. package/generated/v1/snippets/invitations.revoke.json +6 -0
  183. package/generated/v1/snippets/journey/create-destination.json +1 -1
  184. package/generated/v1/snippets/limits.read.json +6 -0
  185. package/generated/v1/snippets/members.list.json +6 -0
  186. package/generated/v1/snippets/members.remove.json +6 -0
  187. package/generated/v1/snippets/members.role.json +6 -0
  188. package/generated/v1/snippets/projectmembers.add.json +6 -0
  189. package/generated/v1/snippets/projectmembers.remove.json +6 -0
  190. package/package.json +7 -2
@@ -29,6 +29,16 @@ export declare const ORGANIZATION_LIFECYCLE_OPERATIONS: readonly [import("./oper
29
29
  readonly id: "organizations.lifecycle";
30
30
  }, import("./operations.js").OperationDefinition & {
31
31
  readonly id: "organizations.close";
32
+ } & {
33
+ readonly request: import("zod").ZodObject<{
34
+ expectedGeneration: import("zod").ZodNumber;
35
+ immediate: import("zod").ZodBoolean;
36
+ confirmation: import("zod").ZodLiteral<"delete organization">;
37
+ }, import("zod/v4/core").$strict>;
32
38
  }, import("./operations.js").OperationDefinition & {
33
39
  readonly id: "organizations.restore";
40
+ } & {
41
+ readonly request: import("zod").ZodObject<{
42
+ expectedGeneration: import("zod").ZodNumber;
43
+ }, import("zod/v4/core").$strict>;
34
44
  }];
@@ -53,7 +53,7 @@ export declare const SINGLE_SHARD = "0";
53
53
  * produced by two constants drifting apart. The test-gap audit named exactly
54
54
  * that, and the fix is one declaration rather than a test comparing two.
55
55
  *
56
- * Thirty-two is one D1 batch's worth of work and a few kilobytes of response.
56
+ * Thirty-two is one control-plane batch's worth of work and a few kilobytes of response.
57
57
  * The caller comes back for the rest, and `RetainedProjections.pending` is how
58
58
  * it knows to.
59
59
  */
@@ -93,8 +93,8 @@ export declare const MAX_PARTITION_SHARDS = 8;
93
93
  * only under a precondition, and that is the most important thing to know about
94
94
  * it.** A schedule's shard is derived from its identifier. Before W2-06 that was
95
95
  * the only answer, so raising the count stranded every schedule already stored.
96
- * Now the shard a schedule was actually stored in is *recorded* in the D1
97
- * directory, and `resolveSchedule` falls back to it whenever the derived
96
+ * Now the shard a schedule was actually stored in is *recorded* in the
97
+ * control-plane directory, and `resolveSchedule` falls back to it whenever the derived
98
98
  * partition has nothing — so a schedule created under an older count keeps
99
99
  * working, because its route was written down rather than recomputed.
100
100
  *
@@ -295,7 +295,7 @@ export interface DrainProjectionsQuery {
295
295
  *
296
296
  * **Nothing is deleted here.** The intents stay until `settleProjections` says
297
297
  * the control plane has them, which is acceptance criterion 1: an intent
298
- * survives a drain whose D1 write never landed, and a partition that has never
298
+ * survives a drain whose control-plane write never landed, and a partition that has never
299
299
  * been initialized answers an empty drain rather than a refusal — a shard nobody
300
300
  * has written to owes the directory nothing.
301
301
  */
@@ -304,9 +304,10 @@ export type DrainProjectionsOutcome = PartitionRefused | RetainedProjections;
304
304
  * Retire the intents the control plane accepted, and postpone the rest.
305
305
  *
306
306
  * Both halves in one call rather than two, because a drain has exactly one of
307
- * these outcomes and the failing half must not need a healthy D1 to be recorded:
308
- * the deferral is what stops a control-plane outage from making every subsequent
309
- * request pay a D1 timeout for the same intent.
307
+ * these outcomes and the failing half must not need a healthy control plane
308
+ * to be recorded: the deferral is what stops a control-plane outage from
309
+ * making every subsequent request pay a control-plane timeout for the same
310
+ * intent.
310
311
  */
311
312
  export interface SettleProjectionsCommand {
312
313
  /** Intents the control plane has durably applied, or cannot route. */
@@ -470,7 +471,7 @@ export interface CreateScheduleCommand {
470
471
  readonly partitionKey?: string;
471
472
  /**
472
473
  * Authenticated encrypted customer JSON. The plaintext never crosses this
473
- * seam and is never stored in a D1 projection.
474
+ * seam and is never stored in a control-plane projection.
474
475
  */
475
476
  readonly payloadEnvelope?: string;
476
477
  /** UTF-8 byte length of the plaintext JSON, before encryption. */
@@ -479,7 +480,7 @@ export interface CreateScheduleCommand {
479
480
  * The verified endpoint URL captured for durable host routing.
480
481
  *
481
482
  * This is internal metadata, not a public response field. The Host Executor
482
- * re-reads the D1 endpoint row before signing and reroutes if the URL has
483
+ * re-reads the control-plane endpoint row before signing and reroutes if the URL has
483
484
  * changed. It does not resolve or revalidate the address: that boundary was
484
485
  * removed by FXO-1566 and FXO-1581, and this comment claimed it afterwards.
485
486
  */
@@ -700,6 +701,8 @@ export interface ForecastQuery {
700
701
  readonly authority: Authority;
701
702
  readonly bucketMs: number;
702
703
  readonly fromMs: number;
704
+ /** Omit named-key cells when the public caller only needs totals/classes. */
705
+ readonly includePartitionKeys?: boolean;
703
706
  readonly toMs: number;
704
707
  }
705
708
  /** One bucket, as one partition sees it. */
@@ -709,6 +712,8 @@ export interface ForecastPartitionBucket {
709
712
  readonly count: number;
710
713
  /** Occurrences here that are the next firing of their schedule. */
711
714
  readonly nextFireCount: number;
715
+ /** Named-key counts folded into the public remainder after exact ranking. */
716
+ readonly omittedPartitionKeyCount?: number;
712
717
  /**
713
718
  * Named customer keys and their counts, ascending by key.
714
719
  *
@@ -748,6 +753,9 @@ export type ForecastOutcome = PartitionRefused | {
748
753
  */
749
754
  readonly asOfMs?: number;
750
755
  readonly buckets: readonly ForecastPartitionBucket[];
756
+ /** Operator work budget that prevented a complete answer, never a count. */
757
+ readonly exhaustedBudget?: string;
758
+ readonly coverage?: import("./forecast.js").ForecastCoverage;
751
759
  /**
752
760
  * The instant this answer actually reached, when it is not the one asked
753
761
  * for.
package/dist/partition.js CHANGED
@@ -51,7 +51,7 @@ export const SINGLE_SHARD = "0";
51
51
  * produced by two constants drifting apart. The test-gap audit named exactly
52
52
  * that, and the fix is one declaration rather than a test comparing two.
53
53
  *
54
- * Thirty-two is one D1 batch's worth of work and a few kilobytes of response.
54
+ * Thirty-two is one control-plane batch's worth of work and a few kilobytes of response.
55
55
  * The caller comes back for the rest, and `RetainedProjections.pending` is how
56
56
  * it knows to.
57
57
  */
@@ -110,8 +110,8 @@ function fnv1a32(input) {
110
110
  * only under a precondition, and that is the most important thing to know about
111
111
  * it.** A schedule's shard is derived from its identifier. Before W2-06 that was
112
112
  * the only answer, so raising the count stranded every schedule already stored.
113
- * Now the shard a schedule was actually stored in is *recorded* in the D1
114
- * directory, and `resolveSchedule` falls back to it whenever the derived
113
+ * Now the shard a schedule was actually stored in is *recorded* in the
114
+ * control-plane directory, and `resolveSchedule` falls back to it whenever the derived
115
115
  * partition has nothing — so a schedule created under an older count keeps
116
116
  * working, because its route was written down rather than recomputed.
117
117
  *
package/dist/policy.js CHANGED
@@ -50,10 +50,13 @@ function allOperations() {
50
50
  * Clerk's and this product does not do it, so this is the whole of what `admin`
51
51
  * means here.
52
52
  */
53
- const MEMBER_SCOPES = SCOPES.filter((scope) => scope !== "billing:write" &&
53
+ const MEMBER_SCOPES = SCOPES.filter((scope) => scope !== "members:manage" &&
54
+ scope !== "billing:write" &&
55
+ scope !== "credentials:administer" &&
56
+ scope !== "projects:administer");
57
+ const BILLING_SCOPES = SCOPES.filter((scope) => scope !== "members:manage" &&
54
58
  scope !== "credentials:administer" &&
55
59
  scope !== "projects:administer");
56
- const BILLING_SCOPES = SCOPES.filter((scope) => scope !== "credentials:administer" && scope !== "projects:administer");
57
60
  export const ROLE_SCOPE_CEILINGS = {
58
61
  admin: SCOPES,
59
62
  billing: BILLING_SCOPES,
@@ -12,12 +12,13 @@ import { z } from "./zod.js";
12
12
  * `code` is the contract. `title` and `detail` are prose and may change without
13
13
  * being a breaking change; clients must never branch on them.
14
14
  */
15
- export declare const PROBLEM_CATEGORIES: readonly ["authentication", "authorization", "conflict", "invalid-request", "not-found", "rate-limited", "unavailable"];
15
+ export declare const PROBLEM_CATEGORIES: readonly ["authentication", "authorization", "conflict", "invalid-request", "not-configured", "not-found", "rate-limited", "unavailable"];
16
16
  export declare const problemCategorySchema: import("zod").ZodEnum<{
17
17
  authentication: "authentication";
18
18
  authorization: "authorization";
19
19
  conflict: "conflict";
20
20
  "invalid-request": "invalid-request";
21
+ "not-configured": "not-configured";
21
22
  "not-found": "not-found";
22
23
  "rate-limited": "rate-limited";
23
24
  unavailable: "unavailable";
@@ -32,6 +33,14 @@ export declare const PROBLEM_CODES: {
32
33
  readonly category: "authentication";
33
34
  readonly status: 401;
34
35
  };
36
+ readonly billing_not_ready: {
37
+ readonly category: "unavailable";
38
+ readonly status: 503;
39
+ };
40
+ readonly capability_not_configured: {
41
+ readonly category: "not-configured";
42
+ readonly status: 503;
43
+ };
35
44
  readonly credential_expired: {
36
45
  readonly category: "authentication";
37
46
  readonly status: 401;
@@ -96,6 +105,8 @@ export declare const PROBLEM_CODES: {
96
105
  export type ProblemCode = keyof typeof PROBLEM_CODES;
97
106
  export declare const problemCodeSchema: import("zod").ZodEnum<{
98
107
  authentication_required: "authentication_required";
108
+ billing_not_ready: "billing_not_ready";
109
+ capability_not_configured: "capability_not_configured";
99
110
  credential_expired: "credential_expired";
100
111
  credential_revoked: "credential_revoked";
101
112
  idempotency_key_reused: "idempotency_key_reused";
@@ -112,7 +123,17 @@ export declare const problemCodeSchema: import("zod").ZodEnum<{
112
123
  test_to_live_escalation: "test_to_live_escalation";
113
124
  version_conflict: "version_conflict";
114
125
  }>;
115
- /** Whether repeating the identical request could succeed later. */
126
+ /**
127
+ * Whether repeating the identical request could succeed later.
128
+ *
129
+ * **Two 5xx categories, opposite answers, and that is the point.**
130
+ * `unavailable` is something that has gone wrong and will come back;
131
+ * `not-configured` is something that was never turned on and will not turn
132
+ * itself on. Reading the status alone cannot tell them apart, which is how a
133
+ * permanent refusal came to be published to customers as retryable — in the
134
+ * SDK's `retryable`, in the CLI's exit class, and as a "Try again" control the
135
+ * dashboard offered for a condition no amount of trying clears.
136
+ */
116
137
  export declare function isRetryable(code: ProblemCode): boolean;
117
138
  export declare const fieldErrorSchema: import("zod").ZodObject<{
118
139
  pointer: import("zod").ZodString;
@@ -122,6 +143,8 @@ export type FieldError = z.infer<typeof fieldErrorSchema>;
122
143
  export declare const problemSchema: import("zod").ZodObject<{
123
144
  code: import("zod").ZodEnum<{
124
145
  authentication_required: "authentication_required";
146
+ billing_not_ready: "billing_not_ready";
147
+ capability_not_configured: "capability_not_configured";
125
148
  credential_expired: "credential_expired";
126
149
  credential_revoked: "credential_revoked";
127
150
  idempotency_key_reused: "idempotency_key_reused";
package/dist/problems.js CHANGED
@@ -17,6 +17,14 @@ export const PROBLEM_CATEGORIES = [
17
17
  "authorization",
18
18
  "conflict",
19
19
  "invalid-request",
20
+ // **A capability this deployment was never given, which is not an outage.**
21
+ // Separate from `unavailable` for one reason: `isRetryable` is a function of
22
+ // the category, and these two answer the retry question oppositely. An
23
+ // outage clears by itself and repeating is the right move; an unconfigured
24
+ // capability clears when somebody changes configuration and never otherwise,
25
+ // so telling a client "the identical request is safe to repeat" is false and
26
+ // it is false forever. Both are 5xx because the caller's request was fine.
27
+ "not-configured",
20
28
  "not-found",
21
29
  "rate-limited",
22
30
  "unavailable",
@@ -34,6 +42,36 @@ export const PROBLEM_CODES = {
34
42
  // now. One code for both would make a missed rotation window indistinguishable
35
43
  // from a security event, and the client's remedy differs — rotate again
36
44
  // versus find out who revoked it.
45
+ // **"Still being set up" is not "broken", and a first screen should not say
46
+ // the second when it means the first.** An organization's billing account row
47
+ // is written by a projection that runs every minute rather than synchronously
48
+ // at sign-up, so a member who creates their project immediately can read
49
+ // billing before the row exists. That used to answer `service_unavailable`,
50
+ // which the dashboard renders as "The service is not answering right now" —
51
+ // the sentence W9-06 blocked the invited cohort over, and the one a new member
52
+ // met on first contact.
53
+ //
54
+ // Deliberately still `unavailable`, and therefore still retryable: repeating
55
+ // the request is exactly the right move, and it succeeds within about a
56
+ // minute. What changes is what the reader is told, not what a client does.
57
+ billing_not_ready: { category: "unavailable", status: 503 },
58
+ // **The environment was never given this capability.** A configuration fact,
59
+ // not a fault and not a fluctuation: the Worker holds no provider, no secret
60
+ // or no binding for the thing being asked about, and it will hold none until
61
+ // somebody deploys different configuration.
62
+ //
63
+ // It exists because `service_unavailable` was carrying both meanings, and
64
+ // the retry answer differs between them. W9-06 blocked the invited cohort
65
+ // over billing panels that said "The service is not answering right now" for
66
+ // capabilities production had deliberately not turned on; W9-08 found the
67
+ // other half still live — the same refusal reaching a customer as
68
+ // `retryable`, and the CLI printing "The identical request is safe to
69
+ // repeat" about a condition no repetition can clear.
70
+ //
71
+ // Deliberately **not** `billing_not_ready`, which is the opposite case: that
72
+ // one is provisioning already in flight, finishes on its own within a
73
+ // minute, and is correctly retryable.
74
+ capability_not_configured: { category: "not-configured", status: 503 },
37
75
  credential_expired: { category: "authentication", status: 401 },
38
76
  credential_revoked: { category: "authentication", status: 401 },
39
77
  idempotency_key_reused: { category: "conflict", status: 409 },
@@ -61,7 +99,17 @@ export const PROBLEM_CODES = {
61
99
  version_conflict: { category: "conflict", status: 409 },
62
100
  };
63
101
  export const problemCodeSchema = z.enum(Object.keys(PROBLEM_CODES));
64
- /** Whether repeating the identical request could succeed later. */
102
+ /**
103
+ * Whether repeating the identical request could succeed later.
104
+ *
105
+ * **Two 5xx categories, opposite answers, and that is the point.**
106
+ * `unavailable` is something that has gone wrong and will come back;
107
+ * `not-configured` is something that was never turned on and will not turn
108
+ * itself on. Reading the status alone cannot tell them apart, which is how a
109
+ * permanent refusal came to be published to customers as retryable — in the
110
+ * SDK's `retryable`, in the CLI's exit class, and as a "Try again" control the
111
+ * dashboard offered for a condition no amount of trying clears.
112
+ */
65
113
  export function isRetryable(code) {
66
114
  const category = PROBLEM_CODES[code].category;
67
115
  return category === "rate-limited" || category === "unavailable";
@@ -10,11 +10,11 @@ import type { FieldError } from "./problems.js";
10
10
  * scheduling book changes constantly. The cursor is opaque: clients pass back
11
11
  * exactly what they were given.
12
12
  */
13
- export declare const PAGE_SIZE: {
14
- readonly default: 25;
15
- readonly max: 100;
16
- readonly min: 1;
17
- };
13
+ export declare const PAGE_SIZE: Readonly<{
14
+ default: 25;
15
+ max: 100;
16
+ min: 1;
17
+ }>;
18
18
  export declare const pageRequestSchema: import("zod").ZodObject<{
19
19
  cursor: import("zod").ZodOptional<import("zod").ZodString>;
20
20
  limit: import("zod").ZodDefault<import("zod").ZodNumber>;
package/dist/protocol.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from "./zod.js";
2
+ import { PUBLIC_PAGE_SIZE } from "./configuration-bounds.js";
2
3
  import { endpointIdSchema, environmentIdSchema, organizationIdSchema, projectIdSchema, } from "./identifiers.js";
3
4
  import { timestampSchema } from "./time.js";
4
5
  /**
@@ -13,7 +14,7 @@ import { timestampSchema } from "./time.js";
13
14
  * scheduling book changes constantly. The cursor is opaque: clients pass back
14
15
  * exactly what they were given.
15
16
  */
16
- export const PAGE_SIZE = { default: 25, max: 100, min: 1 };
17
+ export const PAGE_SIZE = PUBLIC_PAGE_SIZE;
17
18
  export const pageRequestSchema = z.object({
18
19
  cursor: z.string().min(1).optional(),
19
20
  limit: z
@@ -1,5 +1,46 @@
1
1
  import { z } from "./zod.js";
2
2
  export declare const portableScheduleRecordSchema: import("zod").ZodObject<{
3
+ storedHttp: import("zod").ZodOptional<import("zod").ZodObject<{
4
+ method: import("zod").ZodEnum<{
5
+ POST: "POST";
6
+ PUT: "PUT";
7
+ GET: "GET";
8
+ }>;
9
+ bodyMode: import("zod").ZodEnum<{
10
+ envelope: "envelope";
11
+ json: "json";
12
+ none: "none";
13
+ }>;
14
+ headers: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
15
+ name: import("zod").ZodString;
16
+ secret: import("zod").ZodLiteral<false>;
17
+ value: import("zod").ZodString;
18
+ valueBytes: import("zod").ZodNumber;
19
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
20
+ name: import("zod").ZodString;
21
+ secret: import("zod").ZodLiteral<true>;
22
+ envelope: import("zod").ZodObject<{
23
+ keyId: import("zod").ZodLiteral<"v1">;
24
+ nonce: import("zod").ZodString;
25
+ ciphertext: import("zod").ZodString;
26
+ }, import("zod/v4/core").$strict>;
27
+ valueBytes: import("zod").ZodNumber;
28
+ ownerKind: import("zod").ZodEnum<{
29
+ endpoint: "endpoint";
30
+ schedule: "schedule";
31
+ }>;
32
+ ownerId: import("zod").ZodString;
33
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
34
+ name: import("zod").ZodString;
35
+ suppressed: import("zod").ZodLiteral<true>;
36
+ }, import("zod/v4/core").$strict>]>>;
37
+ encryptedTemplate: import("zod").ZodOptional<import("zod").ZodObject<{
38
+ keyId: import("zod").ZodLiteral<"v1">;
39
+ nonce: import("zod").ZodString;
40
+ ciphertext: import("zod").ZodString;
41
+ }, import("zod/v4/core").$strict>>;
42
+ }, import("zod/v4/core").$strict>>;
43
+ httpTemplateRetentionDueAt: import("zod").ZodOptional<import("zod").ZodString>;
3
44
  authority: import("zod").ZodObject<{
4
45
  environment: import("zod").ZodString;
5
46
  environmentKind: import("zod").ZodEnum<{
@@ -10,6 +51,34 @@ export declare const portableScheduleRecordSchema: import("zod").ZodObject<{
10
51
  project: import("zod").ZodString;
11
52
  }, import("zod/v4/core").$strict>;
12
53
  retentionClass: import("zod").ZodString;
54
+ http: import("zod").ZodOptional<import("zod").ZodObject<{
55
+ method: import("zod").ZodEnum<{
56
+ POST: "POST";
57
+ PUT: "PUT";
58
+ GET: "GET";
59
+ }>;
60
+ body: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
61
+ mode: import("zod").ZodLiteral<"envelope">;
62
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
63
+ mode: import("zod").ZodLiteral<"none">;
64
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
65
+ mode: import("zod").ZodLiteral<"json">;
66
+ value: import("zod").ZodOptional<import("zod").ZodJSONSchema>;
67
+ }, import("zod/v4/core").$strict>], "mode">;
68
+ headers: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
69
+ name: import("zod").ZodString;
70
+ secret: import("zod").ZodLiteral<false>;
71
+ value: import("zod").ZodString;
72
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
73
+ name: import("zod").ZodString;
74
+ secret: import("zod").ZodLiteral<true>;
75
+ configured: import("zod").ZodLiteral<true>;
76
+ value: import("zod").ZodOptional<import("zod").ZodNever>;
77
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
78
+ name: import("zod").ZodString;
79
+ suppressed: import("zod").ZodLiteral<true>;
80
+ }, import("zod/v4/core").$strict>]>>;
81
+ }, import("zod/v4/core").$strict>>;
13
82
  archivedAt: import("zod").ZodOptional<import("zod").ZodString>;
14
83
  data: import("zod").ZodOptional<import("zod").ZodJSONSchema>;
15
84
  createdAt: import("zod").ZodString;
@@ -129,7 +198,9 @@ export declare const portableOccurrenceRecordSchema: import("zod").ZodObject<{
129
198
  export type PortableOccurrenceRecord = z.infer<typeof portableOccurrenceRecordSchema>;
130
199
  export declare const portableAttemptRecordSchema: import("zod").ZodObject<{
131
200
  id: import("zod").ZodString;
201
+ localReceiptRecoveries: import("zod").ZodOptional<import("zod").ZodInt>;
132
202
  occurrence: import("zod").ZodString;
203
+ rescues: import("zod").ZodOptional<import("zod").ZodInt>;
133
204
  remediation: import("zod").ZodOptional<import("zod").ZodEnum<{
134
205
  none: "none";
135
206
  review_retry_policy: "review_retry_policy";
@@ -188,7 +259,49 @@ export declare const portableAttemptRecordSchema: import("zod").ZodObject<{
188
259
  network_ambiguous: "network_ambiguous";
189
260
  payload_unavailable: "payload_unavailable";
190
261
  }>>;
262
+ dispatchRecoveries: import("zod").ZodOptional<import("zod").ZodInt>;
191
263
  durationMs: import("zod").ZodOptional<import("zod").ZodNumber>;
264
+ storedHttp: import("zod").ZodOptional<import("zod").ZodObject<{
265
+ method: import("zod").ZodEnum<{
266
+ POST: "POST";
267
+ PUT: "PUT";
268
+ GET: "GET";
269
+ }>;
270
+ bodyMode: import("zod").ZodEnum<{
271
+ envelope: "envelope";
272
+ json: "json";
273
+ none: "none";
274
+ }>;
275
+ headers: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
276
+ name: import("zod").ZodString;
277
+ secret: import("zod").ZodLiteral<false>;
278
+ value: import("zod").ZodString;
279
+ valueBytes: import("zod").ZodNumber;
280
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
281
+ name: import("zod").ZodString;
282
+ secret: import("zod").ZodLiteral<true>;
283
+ envelope: import("zod").ZodObject<{
284
+ keyId: import("zod").ZodLiteral<"v1">;
285
+ nonce: import("zod").ZodString;
286
+ ciphertext: import("zod").ZodString;
287
+ }, import("zod/v4/core").$strict>;
288
+ valueBytes: import("zod").ZodNumber;
289
+ ownerKind: import("zod").ZodEnum<{
290
+ endpoint: "endpoint";
291
+ schedule: "schedule";
292
+ }>;
293
+ ownerId: import("zod").ZodString;
294
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
295
+ name: import("zod").ZodString;
296
+ suppressed: import("zod").ZodLiteral<true>;
297
+ }, import("zod/v4/core").$strict>]>>;
298
+ encryptedTemplate: import("zod").ZodOptional<import("zod").ZodObject<{
299
+ keyId: import("zod").ZodLiteral<"v1">;
300
+ nonce: import("zod").ZodString;
301
+ ciphertext: import("zod").ZodString;
302
+ }, import("zod/v4/core").$strict>>;
303
+ }, import("zod/v4/core").$strict>>;
304
+ httpPayloadRetentionDueAt: import("zod").ZodOptional<import("zod").ZodString>;
192
305
  authority: import("zod").ZodObject<{
193
306
  environment: import("zod").ZodString;
194
307
  environmentKind: import("zod").ZodEnum<{
@@ -229,7 +342,9 @@ export type PortableEncryptedPayloadRecord = z.infer<typeof portableEncryptedPay
229
342
  export declare const portableSchedulingRecordSetSchema: import("zod").ZodObject<{
230
343
  attempts: import("zod").ZodArray<import("zod").ZodObject<{
231
344
  id: import("zod").ZodString;
345
+ localReceiptRecoveries: import("zod").ZodOptional<import("zod").ZodInt>;
232
346
  occurrence: import("zod").ZodString;
347
+ rescues: import("zod").ZodOptional<import("zod").ZodInt>;
233
348
  remediation: import("zod").ZodOptional<import("zod").ZodEnum<{
234
349
  none: "none";
235
350
  review_retry_policy: "review_retry_policy";
@@ -288,7 +403,49 @@ export declare const portableSchedulingRecordSetSchema: import("zod").ZodObject<
288
403
  network_ambiguous: "network_ambiguous";
289
404
  payload_unavailable: "payload_unavailable";
290
405
  }>>;
406
+ dispatchRecoveries: import("zod").ZodOptional<import("zod").ZodInt>;
291
407
  durationMs: import("zod").ZodOptional<import("zod").ZodNumber>;
408
+ storedHttp: import("zod").ZodOptional<import("zod").ZodObject<{
409
+ method: import("zod").ZodEnum<{
410
+ POST: "POST";
411
+ PUT: "PUT";
412
+ GET: "GET";
413
+ }>;
414
+ bodyMode: import("zod").ZodEnum<{
415
+ envelope: "envelope";
416
+ json: "json";
417
+ none: "none";
418
+ }>;
419
+ headers: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
420
+ name: import("zod").ZodString;
421
+ secret: import("zod").ZodLiteral<false>;
422
+ value: import("zod").ZodString;
423
+ valueBytes: import("zod").ZodNumber;
424
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
425
+ name: import("zod").ZodString;
426
+ secret: import("zod").ZodLiteral<true>;
427
+ envelope: import("zod").ZodObject<{
428
+ keyId: import("zod").ZodLiteral<"v1">;
429
+ nonce: import("zod").ZodString;
430
+ ciphertext: import("zod").ZodString;
431
+ }, import("zod/v4/core").$strict>;
432
+ valueBytes: import("zod").ZodNumber;
433
+ ownerKind: import("zod").ZodEnum<{
434
+ endpoint: "endpoint";
435
+ schedule: "schedule";
436
+ }>;
437
+ ownerId: import("zod").ZodString;
438
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
439
+ name: import("zod").ZodString;
440
+ suppressed: import("zod").ZodLiteral<true>;
441
+ }, import("zod/v4/core").$strict>]>>;
442
+ encryptedTemplate: import("zod").ZodOptional<import("zod").ZodObject<{
443
+ keyId: import("zod").ZodLiteral<"v1">;
444
+ nonce: import("zod").ZodString;
445
+ ciphertext: import("zod").ZodString;
446
+ }, import("zod/v4/core").$strict>>;
447
+ }, import("zod/v4/core").$strict>>;
448
+ httpPayloadRetentionDueAt: import("zod").ZodOptional<import("zod").ZodString>;
292
449
  authority: import("zod").ZodObject<{
293
450
  environment: import("zod").ZodString;
294
451
  environmentKind: import("zod").ZodEnum<{
@@ -388,6 +545,47 @@ export declare const portableSchedulingRecordSetSchema: import("zod").ZodObject<
388
545
  storedAt: import("zod").ZodString;
389
546
  }, import("zod/v4/core").$strict>>;
390
547
  schedule: import("zod").ZodObject<{
548
+ storedHttp: import("zod").ZodOptional<import("zod").ZodObject<{
549
+ method: import("zod").ZodEnum<{
550
+ POST: "POST";
551
+ PUT: "PUT";
552
+ GET: "GET";
553
+ }>;
554
+ bodyMode: import("zod").ZodEnum<{
555
+ envelope: "envelope";
556
+ json: "json";
557
+ none: "none";
558
+ }>;
559
+ headers: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
560
+ name: import("zod").ZodString;
561
+ secret: import("zod").ZodLiteral<false>;
562
+ value: import("zod").ZodString;
563
+ valueBytes: import("zod").ZodNumber;
564
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
565
+ name: import("zod").ZodString;
566
+ secret: import("zod").ZodLiteral<true>;
567
+ envelope: import("zod").ZodObject<{
568
+ keyId: import("zod").ZodLiteral<"v1">;
569
+ nonce: import("zod").ZodString;
570
+ ciphertext: import("zod").ZodString;
571
+ }, import("zod/v4/core").$strict>;
572
+ valueBytes: import("zod").ZodNumber;
573
+ ownerKind: import("zod").ZodEnum<{
574
+ endpoint: "endpoint";
575
+ schedule: "schedule";
576
+ }>;
577
+ ownerId: import("zod").ZodString;
578
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
579
+ name: import("zod").ZodString;
580
+ suppressed: import("zod").ZodLiteral<true>;
581
+ }, import("zod/v4/core").$strict>]>>;
582
+ encryptedTemplate: import("zod").ZodOptional<import("zod").ZodObject<{
583
+ keyId: import("zod").ZodLiteral<"v1">;
584
+ nonce: import("zod").ZodString;
585
+ ciphertext: import("zod").ZodString;
586
+ }, import("zod/v4/core").$strict>>;
587
+ }, import("zod/v4/core").$strict>>;
588
+ httpTemplateRetentionDueAt: import("zod").ZodOptional<import("zod").ZodString>;
391
589
  authority: import("zod").ZodObject<{
392
590
  environment: import("zod").ZodString;
393
591
  environmentKind: import("zod").ZodEnum<{
@@ -398,6 +596,34 @@ export declare const portableSchedulingRecordSetSchema: import("zod").ZodObject<
398
596
  project: import("zod").ZodString;
399
597
  }, import("zod/v4/core").$strict>;
400
598
  retentionClass: import("zod").ZodString;
599
+ http: import("zod").ZodOptional<import("zod").ZodObject<{
600
+ method: import("zod").ZodEnum<{
601
+ POST: "POST";
602
+ PUT: "PUT";
603
+ GET: "GET";
604
+ }>;
605
+ body: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
606
+ mode: import("zod").ZodLiteral<"envelope">;
607
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
608
+ mode: import("zod").ZodLiteral<"none">;
609
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
610
+ mode: import("zod").ZodLiteral<"json">;
611
+ value: import("zod").ZodOptional<import("zod").ZodJSONSchema>;
612
+ }, import("zod/v4/core").$strict>], "mode">;
613
+ headers: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
614
+ name: import("zod").ZodString;
615
+ secret: import("zod").ZodLiteral<false>;
616
+ value: import("zod").ZodString;
617
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
618
+ name: import("zod").ZodString;
619
+ secret: import("zod").ZodLiteral<true>;
620
+ configured: import("zod").ZodLiteral<true>;
621
+ value: import("zod").ZodOptional<import("zod").ZodNever>;
622
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
623
+ name: import("zod").ZodString;
624
+ suppressed: import("zod").ZodLiteral<true>;
625
+ }, import("zod/v4/core").$strict>]>>;
626
+ }, import("zod/v4/core").$strict>>;
401
627
  archivedAt: import("zod").ZodOptional<import("zod").ZodString>;
402
628
  data: import("zod").ZodOptional<import("zod").ZodJSONSchema>;
403
629
  createdAt: import("zod").ZodString;
@@ -1,3 +1,4 @@
1
+ import { storedHttpRequestSchema } from "./http-request.js";
1
2
  import { z } from "./zod.js";
2
3
  import { authoritySchema } from "./authority.js";
3
4
  import { SCHEDULE_PAYLOAD_AAD_VERSION } from "./delivery.js";
@@ -12,6 +13,8 @@ const retentionClassSchema = z
12
13
  export const portableScheduleRecordSchema = z
13
14
  .strictObject({
14
15
  ...scheduleSchema.shape,
16
+ storedHttp: storedHttpRequestSchema.optional(),
17
+ httpTemplateRetentionDueAt: timestampSchema.optional(),
15
18
  authority: portableAuthoritySchema,
16
19
  retentionClass: retentionClassSchema,
17
20
  })
@@ -92,6 +95,8 @@ export const portableOccurrenceRecordSchema = occurrenceSchema
92
95
  });
93
96
  export const portableAttemptRecordSchema = attemptSchema
94
97
  .safeExtend({
98
+ storedHttp: storedHttpRequestSchema.optional(),
99
+ httpPayloadRetentionDueAt: timestampSchema.optional(),
95
100
  authority: portableAuthoritySchema,
96
101
  dispatchEpoch: z.number().int().positive(),
97
102
  schedule: scheduleIdSchema,