@greatwait/contracts 0.2.3 → 0.3.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.
- package/dist/attempt-search.d.ts +235 -0
- package/dist/attempt-search.js +101 -0
- package/dist/authority.js +9 -9
- package/dist/billing.d.ts +4 -4
- package/dist/bulk-operations.d.ts +1832 -0
- package/dist/bulk-operations.js +610 -0
- package/dist/configuration-bounds.d.ts +12 -0
- package/dist/configuration-bounds.js +12 -0
- package/dist/configuration.d.ts +75 -0
- package/dist/configuration.js +242 -0
- package/dist/data-export.d.ts +3 -3
- package/dist/delivery.d.ts +1 -0
- package/dist/delivery.js +1 -0
- package/dist/effective-limits.d.ts +4 -4
- package/dist/endpoints.js +25 -25
- package/dist/execution-selection.d.ts +48 -0
- package/dist/execution-selection.js +21 -0
- package/dist/http-request.d.ts +1 -1
- package/dist/http-request.js +25 -23
- package/dist/identifiers.d.ts +2 -0
- package/dist/identifiers.js +21 -19
- package/dist/identity.d.ts +3 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/occurrence-states.d.ts +14 -0
- package/dist/occurrence-states.js +13 -0
- package/dist/operational-config.js +7 -6
- package/dist/operations.d.ts +573 -89
- package/dist/operations.js +67 -0
- package/dist/protocol.d.ts +19 -5
- package/dist/protocol.js +47 -40
- package/dist/schedule-selection.d.ts +28 -0
- package/dist/schedule-selection.js +48 -0
- package/dist/scheduling-records.d.ts +20 -20
- package/dist/scheduling.d.ts +109 -63
- package/dist/scheduling.js +101 -117
- package/dist/signatures.d.ts +6 -6
- package/dist/signatures.js +24 -24
- package/dist/stored-http.d.ts +18 -0
- package/dist/stored-http.js +106 -0
- package/dist/test-sink.d.ts +6 -6
- package/dist/time.js +7 -7
- package/dist/usage.d.ts +3 -3
- package/generated/v1/examples/attempts.search.response.json +42 -0
- package/generated/v1/examples/bulk.cancel.request.json +3 -0
- package/generated/v1/examples/bulk.cancel.response.json +59 -0
- package/generated/v1/examples/bulk.confirm.request.json +5 -0
- package/generated/v1/examples/bulk.confirm.response.json +59 -0
- package/generated/v1/examples/bulk.items.response.json +3 -0
- package/generated/v1/examples/bulk.list.response.json +63 -0
- package/generated/v1/examples/bulk.pause.request.json +3 -0
- package/generated/v1/examples/bulk.pause.response.json +59 -0
- package/generated/v1/examples/bulk.preview.request.json +12 -0
- package/generated/v1/examples/bulk.preview.response.json +59 -0
- package/generated/v1/examples/bulk.read.response.json +59 -0
- package/generated/v1/examples/bulk.resume.request.json +3 -0
- package/generated/v1/examples/bulk.resume.response.json +59 -0
- package/generated/v1/manifest.json +243 -1
- package/generated/v1/openapi.json +21569 -2418
- package/generated/v1/policy-matrix.json +63 -0
- package/generated/v1/schemas/attempts.search.query.json +96 -0
- package/generated/v1/schemas/attempts.search.response.json +271 -0
- package/generated/v1/schemas/bulk.cancel.request.json +13 -0
- package/generated/v1/schemas/bulk.cancel.response.json +1717 -0
- package/generated/v1/schemas/bulk.confirm.request-headers.json +13 -0
- package/generated/v1/schemas/bulk.confirm.request.json +19 -0
- package/generated/v1/schemas/bulk.confirm.response.json +1717 -0
- package/generated/v1/schemas/bulk.items.query.json +29 -0
- package/generated/v1/schemas/bulk.items.response.json +194 -0
- package/generated/v1/schemas/bulk.list.query.json +32 -0
- package/generated/v1/schemas/bulk.list.response.json +1789 -0
- package/generated/v1/schemas/bulk.pause.request.json +13 -0
- package/generated/v1/schemas/bulk.pause.response.json +1717 -0
- package/generated/v1/schemas/bulk.preview.request.json +1218 -0
- package/generated/v1/schemas/bulk.preview.response.json +1717 -0
- package/generated/v1/schemas/bulk.read.response.json +1717 -0
- package/generated/v1/schemas/bulk.resume.request.json +13 -0
- package/generated/v1/schemas/bulk.resume.response.json +1717 -0
- package/generated/v1/schemas/executions.list.query.json +33 -12
- package/generated/v1/schemas/schedules.list.query.json +32 -3
- package/generated/v1/snippets/attempts.search.json +6 -0
- package/generated/v1/snippets/bulk.cancel.json +6 -0
- package/generated/v1/snippets/bulk.confirm.json +6 -0
- package/generated/v1/snippets/bulk.items.json +6 -0
- package/generated/v1/snippets/bulk.list.json +6 -0
- package/generated/v1/snippets/bulk.pause.json +6 -0
- package/generated/v1/snippets/bulk.preview.json +6 -0
- package/generated/v1/snippets/bulk.read.json +6 -0
- package/generated/v1/snippets/bulk.resume.json +6 -0
- package/package.json +1 -1
package/dist/operations.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { projectAttemptPageSchema, projectAttemptSearchRequestSchema, } from "./attempt-search.js";
|
|
2
|
+
import { BULK_API_OPERATIONS } from "./bulk-operations.js";
|
|
1
3
|
import { effectiveCustomerLimitsSchema } from "./effective-limits.js";
|
|
2
4
|
import { z } from "./zod.js";
|
|
3
5
|
import { MEMBER_OPERATIONS } from "./members.js";
|
|
@@ -545,6 +547,7 @@ export const OPERATIONS = [
|
|
|
545
547
|
surfaces: ["api", "mock"],
|
|
546
548
|
},
|
|
547
549
|
...DATA_EXPORT_OPERATIONS,
|
|
550
|
+
...BULK_API_OPERATIONS,
|
|
548
551
|
...MEMBER_OPERATIONS,
|
|
549
552
|
...PROJECT_NOTIFICATION_OPERATIONS,
|
|
550
553
|
...ORGANIZATION_LIFECYCLE_OPERATIONS,
|
|
@@ -3622,6 +3625,70 @@ export const OPERATIONS = [
|
|
|
3622
3625
|
: "Read an occurrence",
|
|
3623
3626
|
surfaces: ["api", "mock"],
|
|
3624
3627
|
},
|
|
3628
|
+
{
|
|
3629
|
+
creates: false,
|
|
3630
|
+
description: globalThis.GREATWAIT_RUNTIME_CONTRACTS_ONLY
|
|
3631
|
+
? ""
|
|
3632
|
+
: "Search all retained delivery attempts by actual startedAt in the required UTC interval [startedFrom, startedBefore), newest first with attempt ID breaking ties. Combine HTTP responseStatus, statusClass, attempt outcome or diagnostic, endpoint, schedule and exact host identifier/tag filters. The matched attempt outcome remains searchable after recovery; occurrence.state is its current outcome. Follow schedule and occurrence IDs to retained details and attempts.list for the complete retry chain. Only safe metadata is returned. Retention horizons describe normal plan history and attempt-detail limits; absence after expiry is not evidence that a delivery never happened. Unavailable queries fail explicitly. Cursors are bound to the verified authority and every selected filter.",
|
|
3633
|
+
example: globalThis.GREATWAIT_RUNTIME_WITHOUT_EXAMPLES
|
|
3634
|
+
? {}
|
|
3635
|
+
: {
|
|
3636
|
+
data: [
|
|
3637
|
+
{
|
|
3638
|
+
attempt: {
|
|
3639
|
+
id: "att_01h8xyz9k2m4n6p8r0t2v4w6y8",
|
|
3640
|
+
attemptNumber: 1,
|
|
3641
|
+
occurrence: "occ_01h8xyz9k2m4n6p8r0t2v4w6y8",
|
|
3642
|
+
startedAt: "2026-07-28T15:00:00.000Z",
|
|
3643
|
+
classifiedAt: "2026-07-28T15:00:00.071Z",
|
|
3644
|
+
state: "retryable_failure",
|
|
3645
|
+
responseStatus: 503,
|
|
3646
|
+
durationMs: 71,
|
|
3647
|
+
diagnostic: "http_retryable",
|
|
3648
|
+
remediation: "review_retry_policy",
|
|
3649
|
+
trigger: { kind: "automatic" },
|
|
3650
|
+
},
|
|
3651
|
+
occurrence: {
|
|
3652
|
+
id: "occ_01h8xyz9k2m4n6p8r0t2v4w6y8",
|
|
3653
|
+
schedule: "sch_01h8xyz9k2m4n6p8r0t2v4w6y8",
|
|
3654
|
+
generation: 1,
|
|
3655
|
+
sequence: 1,
|
|
3656
|
+
attemptCount: 2,
|
|
3657
|
+
plannedFor: "2026-07-28T14:50:00.000Z",
|
|
3658
|
+
settledAt: "2026-07-28T15:00:04.000Z",
|
|
3659
|
+
state: "succeeded",
|
|
3660
|
+
},
|
|
3661
|
+
schedule: {
|
|
3662
|
+
id: "sch_01h8xyz9k2m4n6p8r0t2v4w6y8",
|
|
3663
|
+
name: "Recovered delivery",
|
|
3664
|
+
},
|
|
3665
|
+
},
|
|
3666
|
+
],
|
|
3667
|
+
freshness: { kind: "authoritative" },
|
|
3668
|
+
retention: {
|
|
3669
|
+
from: "2026-07-21T15:00:00.000Z",
|
|
3670
|
+
detailsFrom: "2026-07-21T15:00:00.000Z",
|
|
3671
|
+
},
|
|
3672
|
+
},
|
|
3673
|
+
id: "attempts.search",
|
|
3674
|
+
idempotent: true,
|
|
3675
|
+
mcp: { destructive: false, kind: "tool", openWorld: false },
|
|
3676
|
+
method: "GET",
|
|
3677
|
+
mutates: false,
|
|
3678
|
+
path: "/v1/attempts",
|
|
3679
|
+
principals: ["api-credential", "oauth", "session"],
|
|
3680
|
+
problems: ["invalid_request"],
|
|
3681
|
+
query: projectAttemptSearchRequestSchema,
|
|
3682
|
+
response: globalThis.GREATWAIT_API_REQUEST_REGISTRY
|
|
3683
|
+
? API_UNUSED_RESPONSE_SCHEMA
|
|
3684
|
+
: projectAttemptPageSchema,
|
|
3685
|
+
scopes: ["occurrences:read"],
|
|
3686
|
+
sessionAuthority: "headers",
|
|
3687
|
+
summary: globalThis.GREATWAIT_API_REQUEST_REGISTRY
|
|
3688
|
+
? ""
|
|
3689
|
+
: "Search delivery attempts by actual time",
|
|
3690
|
+
surfaces: ["api", "mock"],
|
|
3691
|
+
},
|
|
3625
3692
|
{
|
|
3626
3693
|
creates: false,
|
|
3627
3694
|
description: globalThis.GREATWAIT_RUNTIME_CONTRACTS_ONLY
|
package/dist/protocol.d.ts
CHANGED
|
@@ -54,14 +54,28 @@ export type ScheduleOrder = (typeof SCHEDULE_ORDERS)[number];
|
|
|
54
54
|
export declare const scheduleListRequestSchema: import("zod").ZodObject<{
|
|
55
55
|
cursor: import("zod").ZodOptional<import("zod").ZodString>;
|
|
56
56
|
limit: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
57
|
-
external_identifier: import("zod").ZodOptional<import("zod").ZodString>;
|
|
58
|
-
tag: import("zod").ZodOptional<import("zod").ZodString>;
|
|
59
|
-
dueBefore: import("zod").ZodOptional<import("zod").ZodString>;
|
|
60
|
-
endpoint: import("zod").ZodOptional<import("zod").ZodString>;
|
|
61
57
|
order: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
62
|
-
created: "created";
|
|
63
58
|
due: "due";
|
|
59
|
+
created: "created";
|
|
64
60
|
}>>;
|
|
61
|
+
external_identifier: import("zod").ZodOptional<import("zod").ZodString>;
|
|
62
|
+
tag: import("zod").ZodOptional<import("zod").ZodString>;
|
|
63
|
+
status: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
64
|
+
cancelled: "cancelled";
|
|
65
|
+
active: "active";
|
|
66
|
+
paused: "paused";
|
|
67
|
+
completed: "completed";
|
|
68
|
+
}>>;
|
|
69
|
+
recurrence: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
70
|
+
at: "at";
|
|
71
|
+
every: "every";
|
|
72
|
+
cron: "cron";
|
|
73
|
+
}>>;
|
|
74
|
+
endpoint: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<"none">]>>;
|
|
75
|
+
text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
76
|
+
schedule: import("zod").ZodOptional<import("zod").ZodString>;
|
|
77
|
+
dueAfter: import("zod").ZodOptional<import("zod").ZodString>;
|
|
78
|
+
dueBefore: import("zod").ZodOptional<import("zod").ZodString>;
|
|
65
79
|
}, import("zod/v4/core").$strip>;
|
|
66
80
|
export type ScheduleListRequest = z.infer<typeof scheduleListRequestSchema>;
|
|
67
81
|
/**
|
package/dist/protocol.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "./zod.js";
|
|
2
|
-
import {
|
|
2
|
+
import { scheduleSelectionSchema } from "./schedule-selection.js";
|
|
3
3
|
import { PUBLIC_PAGE_SIZE } from "./configuration-bounds.js";
|
|
4
|
-
import {
|
|
4
|
+
import { environmentIdSchema, organizationIdSchema, projectIdSchema, } from "./identifiers.js";
|
|
5
5
|
import { timestampSchema } from "./time.js";
|
|
6
6
|
/**
|
|
7
7
|
* Request and collection mechanics: paging, optimistic concurrency, and
|
|
@@ -16,7 +16,7 @@ import { timestampSchema } from "./time.js";
|
|
|
16
16
|
* exactly what they were given.
|
|
17
17
|
*/
|
|
18
18
|
export const PAGE_SIZE = PUBLIC_PAGE_SIZE;
|
|
19
|
-
export const pageRequestSchema = z.object({
|
|
19
|
+
export const pageRequestSchema = /* @__PURE__ */ (() => z.object({
|
|
20
20
|
cursor: z.string().min(1).optional(),
|
|
21
21
|
limit: z
|
|
22
22
|
.number()
|
|
@@ -24,7 +24,7 @@ export const pageRequestSchema = z.object({
|
|
|
24
24
|
.min(PAGE_SIZE.min)
|
|
25
25
|
.max(PAGE_SIZE.max)
|
|
26
26
|
.default(PAGE_SIZE.default),
|
|
27
|
-
});
|
|
27
|
+
}))();
|
|
28
28
|
/**
|
|
29
29
|
* A schedules listing: the page, and optionally one endpoint to keep to.
|
|
30
30
|
*
|
|
@@ -55,13 +55,10 @@ export const SCHEDULE_ORDERS = ["created", "due"];
|
|
|
55
55
|
* a schedule with nothing on the books matches no `dueBefore`, because it has
|
|
56
56
|
* no instant to compare and inventing one either way would be a guess.
|
|
57
57
|
*/
|
|
58
|
-
export const scheduleListRequestSchema = pageRequestSchema.extend({
|
|
59
|
-
|
|
60
|
-
tag: scheduleTagSchema.optional(),
|
|
61
|
-
dueBefore: timestampSchema.optional(),
|
|
62
|
-
endpoint: endpointIdSchema.optional(),
|
|
58
|
+
export const scheduleListRequestSchema = /* @__PURE__ */ (() => pageRequestSchema.extend({
|
|
59
|
+
...scheduleSelectionSchema.shape,
|
|
63
60
|
order: z.enum(SCHEDULE_ORDERS).default("created"),
|
|
64
|
-
});
|
|
61
|
+
}))();
|
|
65
62
|
/**
|
|
66
63
|
* Which end of a history a page walks from.
|
|
67
64
|
*
|
|
@@ -73,9 +70,9 @@ export const scheduleListRequestSchema = pageRequestSchema.extend({
|
|
|
73
70
|
*/
|
|
74
71
|
export const HISTORY_ORDERS = ["oldest", "newest"];
|
|
75
72
|
/** A page request over a history, which may be walked from either end. */
|
|
76
|
-
export const historyPageRequestSchema = pageRequestSchema.extend({
|
|
73
|
+
export const historyPageRequestSchema = /* @__PURE__ */ (() => pageRequestSchema.extend({
|
|
77
74
|
order: z.enum(HISTORY_ORDERS).default("oldest"),
|
|
78
|
-
});
|
|
75
|
+
}))();
|
|
79
76
|
/**
|
|
80
77
|
* A page of results.
|
|
81
78
|
*
|
|
@@ -85,14 +82,14 @@ export const historyPageRequestSchema = pageRequestSchema.extend({
|
|
|
85
82
|
* stale data as fact. `authoritative` means the answer came from the owning
|
|
86
83
|
* partition; `projected` means it may lag and carries the age.
|
|
87
84
|
*/
|
|
88
|
-
export const freshnessSchema = z.discriminatedUnion("kind", [
|
|
85
|
+
export const freshnessSchema = /* @__PURE__ */ (() => z.discriminatedUnion("kind", [
|
|
89
86
|
z.object({ kind: z.literal("authoritative") }),
|
|
90
87
|
z.object({
|
|
91
88
|
asOf: timestampSchema,
|
|
92
89
|
kind: z.literal("projected"),
|
|
93
90
|
lagSeconds: z.number().int().nonnegative(),
|
|
94
91
|
}),
|
|
95
|
-
]);
|
|
92
|
+
]))();
|
|
96
93
|
/**
|
|
97
94
|
* The `projected` arm alone, for a response that is never authoritative.
|
|
98
95
|
*
|
|
@@ -103,11 +100,11 @@ export const freshnessSchema = z.discriminatedUnion("kind", [
|
|
|
103
100
|
* taken, were unreachable without narrowing that no consumer could justify.
|
|
104
101
|
* Naming the narrower shape moves the claim into the type.
|
|
105
102
|
*/
|
|
106
|
-
export const projectedFreshnessSchema = z.object({
|
|
103
|
+
export const projectedFreshnessSchema = /* @__PURE__ */ (() => z.object({
|
|
107
104
|
asOf: timestampSchema,
|
|
108
105
|
kind: z.literal("projected"),
|
|
109
106
|
lagSeconds: z.number().int().nonnegative(),
|
|
110
|
-
});
|
|
107
|
+
}))();
|
|
111
108
|
export function pageSchema(item) {
|
|
112
109
|
return z.object({
|
|
113
110
|
data: z.array(item),
|
|
@@ -160,7 +157,17 @@ function authorityFingerprint(authority) {
|
|
|
160
157
|
return hash.toString(16).padStart(8, "0");
|
|
161
158
|
}
|
|
162
159
|
function base64UrlEncode(value) {
|
|
163
|
-
|
|
160
|
+
// Cursor JSON can include Unicode filter values. Escape UTF-16 units outside
|
|
161
|
+
// Latin-1 before btoa; JSON.parse restores them, including surrogate pairs.
|
|
162
|
+
// Keep the existing decoder so previously issued Latin-1 cursors still work.
|
|
163
|
+
const encodable = value
|
|
164
|
+
.split("")
|
|
165
|
+
.map((unit) => {
|
|
166
|
+
const code = unit.charCodeAt(0);
|
|
167
|
+
return code > 255 ? `\\u${code.toString(16).padStart(4, "0")}` : unit;
|
|
168
|
+
})
|
|
169
|
+
.join("");
|
|
170
|
+
return btoa(encodable)
|
|
164
171
|
.replace(/\+/gu, "-")
|
|
165
172
|
.replace(/\//gu, "_")
|
|
166
173
|
.replace(/=+$/u, "");
|
|
@@ -330,7 +337,7 @@ function parseListing(query, schema) {
|
|
|
330
337
|
* `version_conflict` rather than silently overwriting — a cancel racing a
|
|
331
338
|
* replace must not resolve by luck.
|
|
332
339
|
*/
|
|
333
|
-
export const versionSchema = z.number().int().positive();
|
|
340
|
+
export const versionSchema = /* @__PURE__ */ (() => z.number().int().positive())();
|
|
334
341
|
/**
|
|
335
342
|
* A strong entity tag over a version: a quoted decimal, and nothing else.
|
|
336
343
|
*
|
|
@@ -376,10 +383,10 @@ export function fromETag(etag) {
|
|
|
376
383
|
* refinement is the extra strictness the OpenAPI preamble already discloses
|
|
377
384
|
* that a described schema does not capture.
|
|
378
385
|
*/
|
|
379
|
-
export const etagSchema = z
|
|
386
|
+
export const etagSchema = /* @__PURE__ */ (() => z
|
|
380
387
|
.string()
|
|
381
388
|
.regex(ETAG_PATTERN, ETAG_MESSAGE)
|
|
382
|
-
.refine((value) => fromETag(value) !== undefined, ETAG_MESSAGE);
|
|
389
|
+
.refine((value) => fromETag(value) !== undefined, ETAG_MESSAGE))();
|
|
383
390
|
/* -------------------------------------------------------------------------- */
|
|
384
391
|
/* Idempotency */
|
|
385
392
|
/* -------------------------------------------------------------------------- */
|
|
@@ -393,11 +400,11 @@ export const etagSchema = z
|
|
|
393
400
|
* silent second write — that distinction is the whole point, and the legacy
|
|
394
401
|
* scheduler had no equivalent.
|
|
395
402
|
*/
|
|
396
|
-
export const idempotencyKeySchema = z
|
|
403
|
+
export const idempotencyKeySchema = /* @__PURE__ */ (() => z
|
|
397
404
|
.string()
|
|
398
405
|
.min(16, "must be at least 16 characters so keys do not collide by accident")
|
|
399
406
|
.max(255)
|
|
400
|
-
.regex(/^[\x20-\x7e]+$/u, "must be printable ASCII");
|
|
407
|
+
.regex(/^[\x20-\x7e]+$/u, "must be printable ASCII"))();
|
|
401
408
|
/**
|
|
402
409
|
* The scope a key was used in. Carried on the receipt rather than assumed,
|
|
403
410
|
* because an implementation that keys its receipt store on the idempotency key
|
|
@@ -405,13 +412,13 @@ export const idempotencyKeySchema = z
|
|
|
405
412
|
* send the same key. The scope is part of the record so that mistake cannot be
|
|
406
413
|
* made silently.
|
|
407
414
|
*/
|
|
408
|
-
export const idempotencyScopeSchema = z.object({
|
|
415
|
+
export const idempotencyScopeSchema = /* @__PURE__ */ (() => z.object({
|
|
409
416
|
environment: environmentIdSchema,
|
|
410
417
|
operation: z.string().min(1),
|
|
411
418
|
organization: organizationIdSchema,
|
|
412
419
|
project: projectIdSchema,
|
|
413
|
-
});
|
|
414
|
-
export const idempotencyReceiptSchema = z.object({
|
|
420
|
+
}))();
|
|
421
|
+
export const idempotencyReceiptSchema = /* @__PURE__ */ (() => z.object({
|
|
415
422
|
/**
|
|
416
423
|
* Hash of the canonical request the key was first used with. Canonical
|
|
417
424
|
* means: the operation name, then the request body serialized with object
|
|
@@ -424,7 +431,7 @@ export const idempotencyReceiptSchema = z.object({
|
|
|
424
431
|
replayed: z.boolean(),
|
|
425
432
|
scope: idempotencyScopeSchema,
|
|
426
433
|
storedAt: timestampSchema,
|
|
427
|
-
});
|
|
434
|
+
}))();
|
|
428
435
|
/**
|
|
429
436
|
* The canonical form of a request, as the receipt's `requestFingerprint`
|
|
430
437
|
* describes it: the operation name, then the body with object keys sorted and
|
|
@@ -528,9 +535,9 @@ export const CONCURRENCY_HEADERS = {
|
|
|
528
535
|
ifMatch: "If-Match",
|
|
529
536
|
replayed: "Idempotency-Replayed",
|
|
530
537
|
};
|
|
531
|
-
export const idempotencyRequestHeaderSchema = z.object({
|
|
538
|
+
export const idempotencyRequestHeaderSchema = /* @__PURE__ */ (() => z.object({
|
|
532
539
|
[CONCURRENCY_HEADERS.idempotencyKey]: idempotencyKeySchema.optional(),
|
|
533
|
-
});
|
|
540
|
+
}))();
|
|
534
541
|
/**
|
|
535
542
|
* A write for which idempotency is mandatory, rather than an optional
|
|
536
543
|
* protection a caller may opt into.
|
|
@@ -540,12 +547,12 @@ export const idempotencyRequestHeaderSchema = z.object({
|
|
|
540
547
|
* `idempotencyRequestHeaderSchema` lets schedule creation retain its published
|
|
541
548
|
* optional behavior without weakening the redelivery promise.
|
|
542
549
|
*/
|
|
543
|
-
export const requiredIdempotencyRequestHeaderSchema = z.object({
|
|
550
|
+
export const requiredIdempotencyRequestHeaderSchema = /* @__PURE__ */ (() => z.object({
|
|
544
551
|
[CONCURRENCY_HEADERS.idempotencyKey]: idempotencyKeySchema,
|
|
545
|
-
});
|
|
546
|
-
export const conditionalRequestHeaderSchema = z.object({
|
|
552
|
+
}))();
|
|
553
|
+
export const conditionalRequestHeaderSchema = /* @__PURE__ */ (() => z.object({
|
|
547
554
|
[CONCURRENCY_HEADERS.ifMatch]: etagSchema.optional(),
|
|
548
|
-
});
|
|
555
|
+
}))();
|
|
549
556
|
/**
|
|
550
557
|
* A conditional write that refuses an unversioned request.
|
|
551
558
|
*
|
|
@@ -554,18 +561,18 @@ export const conditionalRequestHeaderSchema = z.object({
|
|
|
554
561
|
* silently accepting a missing precondition would let a stale General page
|
|
555
562
|
* overwrite a newer decision.
|
|
556
563
|
*/
|
|
557
|
-
export const requiredConditionalRequestHeaderSchema = z.object({
|
|
564
|
+
export const requiredConditionalRequestHeaderSchema = /* @__PURE__ */ (() => z.object({
|
|
558
565
|
[CONCURRENCY_HEADERS.ifMatch]: etagSchema,
|
|
559
|
-
});
|
|
566
|
+
}))();
|
|
560
567
|
/**
|
|
561
568
|
* Required rather than optional, deliberately: an operation that declares this
|
|
562
569
|
* promises the header on every success, and a client that has to test for its
|
|
563
570
|
* presence before making a conditional write will write the untested branch
|
|
564
571
|
* wrong.
|
|
565
572
|
*/
|
|
566
|
-
export const versionResponseHeaderSchema = z.object({
|
|
573
|
+
export const versionResponseHeaderSchema = /* @__PURE__ */ (() => z.object({
|
|
567
574
|
[CONCURRENCY_HEADERS.etag]: etagSchema,
|
|
568
|
-
});
|
|
575
|
+
}))();
|
|
569
576
|
/**
|
|
570
577
|
* What a replayed write answers with, on top of the version.
|
|
571
578
|
*
|
|
@@ -581,11 +588,11 @@ export const versionResponseHeaderSchema = z.object({
|
|
|
581
588
|
* header is the ordinary case, and a client that has to read a header to learn
|
|
582
589
|
* nothing happened is a client that will not read it.
|
|
583
590
|
*/
|
|
584
|
-
export const replayedResponseHeaderSchema = z.object({
|
|
591
|
+
export const replayedResponseHeaderSchema = /* @__PURE__ */ (() => z.object({
|
|
585
592
|
[CONCURRENCY_HEADERS.etag]: etagSchema,
|
|
586
593
|
[CONCURRENCY_HEADERS.replayed]: z.literal("true").optional(),
|
|
587
|
-
});
|
|
594
|
+
}))();
|
|
588
595
|
/** Replay marker for an idempotent create whose result has no ETag. */
|
|
589
|
-
export const idempotencyReplayResponseHeaderSchema = z.object({
|
|
596
|
+
export const idempotencyReplayResponseHeaderSchema = /* @__PURE__ */ (() => z.object({
|
|
590
597
|
[CONCURRENCY_HEADERS.replayed]: z.literal("true").optional(),
|
|
591
|
-
});
|
|
598
|
+
}))();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "./zod.js";
|
|
2
|
+
/** Shared schedule predicates. Every populated field intersects before paging. */
|
|
3
|
+
export declare const scheduleSelectionSchema: import("zod").ZodObject<{
|
|
4
|
+
external_identifier: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5
|
+
tag: import("zod").ZodOptional<import("zod").ZodString>;
|
|
6
|
+
status: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
7
|
+
cancelled: "cancelled";
|
|
8
|
+
active: "active";
|
|
9
|
+
paused: "paused";
|
|
10
|
+
completed: "completed";
|
|
11
|
+
}>>;
|
|
12
|
+
recurrence: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
13
|
+
at: "at";
|
|
14
|
+
every: "every";
|
|
15
|
+
cron: "cron";
|
|
16
|
+
}>>;
|
|
17
|
+
endpoint: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<"none">]>>;
|
|
18
|
+
text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
19
|
+
schedule: import("zod").ZodOptional<import("zod").ZodString>;
|
|
20
|
+
dueAfter: import("zod").ZodOptional<import("zod").ZodString>;
|
|
21
|
+
dueBefore: import("zod").ZodOptional<import("zod").ZodString>;
|
|
22
|
+
}, import("zod/v4/core").$strip>;
|
|
23
|
+
export type ScheduleSelection = z.infer<typeof scheduleSelectionSchema>;
|
|
24
|
+
export type NormalizedScheduleSelection = {
|
|
25
|
+
readonly [Key in keyof ScheduleSelection]?: Exclude<ScheduleSelection[Key], undefined>;
|
|
26
|
+
};
|
|
27
|
+
/** Canonical predicate shape for lists, cursor bindings and bulk selections. */
|
|
28
|
+
export declare function normalizeScheduleSelection(selection: ScheduleSelection): NormalizedScheduleSelection;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "./zod.js";
|
|
2
|
+
import { endpointIdSchema, scheduleIdSchema } from "./identifiers.js";
|
|
3
|
+
import { externalIdentifierSchema, scheduleTagSchema, } from "./host-correlation.js";
|
|
4
|
+
import { timestampSchema } from "./time.js";
|
|
5
|
+
/** Shared schedule predicates. Every populated field intersects before paging. */
|
|
6
|
+
export const scheduleSelectionSchema = /* @__PURE__ */ (() => z.object({
|
|
7
|
+
external_identifier: externalIdentifierSchema.optional(),
|
|
8
|
+
tag: scheduleTagSchema.optional(),
|
|
9
|
+
status: z.enum(["active", "paused", "cancelled", "completed"]).optional(),
|
|
10
|
+
recurrence: z.enum(["at", "every", "cron"]).optional(),
|
|
11
|
+
endpoint: z.union([endpointIdSchema, z.literal("none")]).optional(),
|
|
12
|
+
text: z
|
|
13
|
+
.string()
|
|
14
|
+
.max(256)
|
|
15
|
+
.refine((value) => !value.includes("\u0000"), "must not contain NUL characters")
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Case-insensitive literal substring of schedule name, endpoint address or schedule identifier."),
|
|
18
|
+
schedule: scheduleIdSchema.optional(),
|
|
19
|
+
dueAfter: timestampSchema.optional(),
|
|
20
|
+
dueBefore: timestampSchema.optional(),
|
|
21
|
+
}))();
|
|
22
|
+
/** Canonical predicate shape for lists, cursor bindings and bulk selections. */
|
|
23
|
+
export function normalizeScheduleSelection(selection) {
|
|
24
|
+
const text = selection.text?.trim();
|
|
25
|
+
return {
|
|
26
|
+
...(selection.external_identifier === undefined
|
|
27
|
+
? {}
|
|
28
|
+
: { external_identifier: selection.external_identifier }),
|
|
29
|
+
...(selection.tag === undefined ? {} : { tag: selection.tag }),
|
|
30
|
+
...(selection.status === undefined ? {} : { status: selection.status }),
|
|
31
|
+
...(selection.recurrence === undefined
|
|
32
|
+
? {}
|
|
33
|
+
: { recurrence: selection.recurrence }),
|
|
34
|
+
...(selection.endpoint === undefined
|
|
35
|
+
? {}
|
|
36
|
+
: { endpoint: selection.endpoint }),
|
|
37
|
+
...(text === undefined || text === "" ? {} : { text }),
|
|
38
|
+
...(selection.schedule === undefined
|
|
39
|
+
? {}
|
|
40
|
+
: { schedule: selection.schedule }),
|
|
41
|
+
...(selection.dueAfter === undefined
|
|
42
|
+
? {}
|
|
43
|
+
: { dueAfter: selection.dueAfter }),
|
|
44
|
+
...(selection.dueBefore === undefined
|
|
45
|
+
? {}
|
|
46
|
+
: { dueBefore: selection.dueBefore }),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -7,9 +7,9 @@ export declare const portableScheduleRecordSchema: import("zod").ZodObject<{
|
|
|
7
7
|
GET: "GET";
|
|
8
8
|
}>;
|
|
9
9
|
bodyMode: import("zod").ZodEnum<{
|
|
10
|
+
none: "none";
|
|
10
11
|
envelope: "envelope";
|
|
11
12
|
json: "json";
|
|
12
|
-
none: "none";
|
|
13
13
|
}>;
|
|
14
14
|
headers: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
15
15
|
name: import("zod").ZodString;
|
|
@@ -132,9 +132,9 @@ export declare const portableScheduleRecordSchema: import("zod").ZodObject<{
|
|
|
132
132
|
timeZone: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
|
|
133
133
|
}, import("zod/v4/core").$strip>], "kind">;
|
|
134
134
|
status: import("zod").ZodEnum<{
|
|
135
|
-
paused: "paused";
|
|
136
|
-
active: "active";
|
|
137
135
|
cancelled: "cancelled";
|
|
136
|
+
active: "active";
|
|
137
|
+
paused: "paused";
|
|
138
138
|
completed: "completed";
|
|
139
139
|
}>;
|
|
140
140
|
updatedAt: import("zod").ZodString;
|
|
@@ -172,14 +172,14 @@ export declare const portableOccurrenceRecordSchema: import("zod").ZodObject<{
|
|
|
172
172
|
sequence: import("zod").ZodNumber;
|
|
173
173
|
settledAt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
174
174
|
state: import("zod").ZodEnum<{
|
|
175
|
-
succeeded: "succeeded";
|
|
176
|
-
ambiguous: "ambiguous";
|
|
177
|
-
due: "due";
|
|
178
|
-
cancelled: "cancelled";
|
|
179
175
|
planned: "planned";
|
|
176
|
+
due: "due";
|
|
180
177
|
dispatching: "dispatching";
|
|
181
178
|
retry_wait: "retry_wait";
|
|
179
|
+
ambiguous: "ambiguous";
|
|
180
|
+
succeeded: "succeeded";
|
|
182
181
|
terminal_failed: "terminal_failed";
|
|
182
|
+
cancelled: "cancelled";
|
|
183
183
|
skipped_stale: "skipped_stale";
|
|
184
184
|
}>;
|
|
185
185
|
firstAttemptLatenessMs: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
@@ -240,8 +240,8 @@ export declare const portableAttemptRecordSchema: import("zod").ZodObject<{
|
|
|
240
240
|
body: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
241
241
|
contentType: import("zod").ZodString;
|
|
242
242
|
encoding: import("zod").ZodEnum<{
|
|
243
|
-
utf8: "utf8";
|
|
244
243
|
base64: "base64";
|
|
244
|
+
utf8: "utf8";
|
|
245
245
|
}>;
|
|
246
246
|
content: import("zod").ZodString;
|
|
247
247
|
capturedBytes: import("zod").ZodInt;
|
|
@@ -276,8 +276,8 @@ export declare const portableAttemptRecordSchema: import("zod").ZodObject<{
|
|
|
276
276
|
responseStatus: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
277
277
|
startedAt: import("zod").ZodString;
|
|
278
278
|
state: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
279
|
-
succeeded: "succeeded";
|
|
280
279
|
ambiguous: "ambiguous";
|
|
280
|
+
succeeded: "succeeded";
|
|
281
281
|
retryable_failure: "retryable_failure";
|
|
282
282
|
terminal_failure: "terminal_failure";
|
|
283
283
|
}>>;
|
|
@@ -322,9 +322,9 @@ export declare const portableAttemptRecordSchema: import("zod").ZodObject<{
|
|
|
322
322
|
GET: "GET";
|
|
323
323
|
}>;
|
|
324
324
|
bodyMode: import("zod").ZodEnum<{
|
|
325
|
+
none: "none";
|
|
325
326
|
envelope: "envelope";
|
|
326
327
|
json: "json";
|
|
327
|
-
none: "none";
|
|
328
328
|
}>;
|
|
329
329
|
headers: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
330
330
|
name: import("zod").ZodString;
|
|
@@ -428,8 +428,8 @@ export declare const portableSchedulingRecordSetSchema: import("zod").ZodObject<
|
|
|
428
428
|
body: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
429
429
|
contentType: import("zod").ZodString;
|
|
430
430
|
encoding: import("zod").ZodEnum<{
|
|
431
|
-
utf8: "utf8";
|
|
432
431
|
base64: "base64";
|
|
432
|
+
utf8: "utf8";
|
|
433
433
|
}>;
|
|
434
434
|
content: import("zod").ZodString;
|
|
435
435
|
capturedBytes: import("zod").ZodInt;
|
|
@@ -464,8 +464,8 @@ export declare const portableSchedulingRecordSetSchema: import("zod").ZodObject<
|
|
|
464
464
|
responseStatus: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
465
465
|
startedAt: import("zod").ZodString;
|
|
466
466
|
state: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
467
|
-
succeeded: "succeeded";
|
|
468
467
|
ambiguous: "ambiguous";
|
|
468
|
+
succeeded: "succeeded";
|
|
469
469
|
retryable_failure: "retryable_failure";
|
|
470
470
|
terminal_failure: "terminal_failure";
|
|
471
471
|
}>>;
|
|
@@ -510,9 +510,9 @@ export declare const portableSchedulingRecordSetSchema: import("zod").ZodObject<
|
|
|
510
510
|
GET: "GET";
|
|
511
511
|
}>;
|
|
512
512
|
bodyMode: import("zod").ZodEnum<{
|
|
513
|
+
none: "none";
|
|
513
514
|
envelope: "envelope";
|
|
514
515
|
json: "json";
|
|
515
|
-
none: "none";
|
|
516
516
|
}>;
|
|
517
517
|
headers: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
518
518
|
name: import("zod").ZodString;
|
|
@@ -565,14 +565,14 @@ export declare const portableSchedulingRecordSetSchema: import("zod").ZodObject<
|
|
|
565
565
|
sequence: import("zod").ZodNumber;
|
|
566
566
|
settledAt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
567
567
|
state: import("zod").ZodEnum<{
|
|
568
|
-
succeeded: "succeeded";
|
|
569
|
-
ambiguous: "ambiguous";
|
|
570
|
-
due: "due";
|
|
571
|
-
cancelled: "cancelled";
|
|
572
568
|
planned: "planned";
|
|
569
|
+
due: "due";
|
|
573
570
|
dispatching: "dispatching";
|
|
574
571
|
retry_wait: "retry_wait";
|
|
572
|
+
ambiguous: "ambiguous";
|
|
573
|
+
succeeded: "succeeded";
|
|
575
574
|
terminal_failed: "terminal_failed";
|
|
575
|
+
cancelled: "cancelled";
|
|
576
576
|
skipped_stale: "skipped_stale";
|
|
577
577
|
}>;
|
|
578
578
|
firstAttemptLatenessMs: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
@@ -650,9 +650,9 @@ export declare const portableSchedulingRecordSetSchema: import("zod").ZodObject<
|
|
|
650
650
|
GET: "GET";
|
|
651
651
|
}>;
|
|
652
652
|
bodyMode: import("zod").ZodEnum<{
|
|
653
|
+
none: "none";
|
|
653
654
|
envelope: "envelope";
|
|
654
655
|
json: "json";
|
|
655
|
-
none: "none";
|
|
656
656
|
}>;
|
|
657
657
|
headers: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
658
658
|
name: import("zod").ZodString;
|
|
@@ -775,9 +775,9 @@ export declare const portableSchedulingRecordSetSchema: import("zod").ZodObject<
|
|
|
775
775
|
timeZone: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
|
|
776
776
|
}, import("zod/v4/core").$strip>], "kind">;
|
|
777
777
|
status: import("zod").ZodEnum<{
|
|
778
|
-
paused: "paused";
|
|
779
|
-
active: "active";
|
|
780
778
|
cancelled: "cancelled";
|
|
779
|
+
active: "active";
|
|
780
|
+
paused: "paused";
|
|
781
781
|
completed: "completed";
|
|
782
782
|
}>;
|
|
783
783
|
updatedAt: import("zod").ZodString;
|