@greatwait/contracts 0.3.0 → 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.js +22 -19
- package/dist/authority.js +9 -9
- package/dist/configuration.d.ts +4 -0
- package/dist/configuration.js +88 -50
- package/dist/delivery.d.ts +1 -0
- package/dist/delivery.js +1 -0
- package/dist/endpoints.js +25 -25
- package/dist/http-request.js +25 -23
- package/dist/identifiers.js +20 -20
- package/dist/operational-config.js +7 -6
- package/dist/protocol.js +33 -33
- package/dist/schedule-selection.js +2 -2
- package/dist/scheduling.d.ts +45 -0
- package/dist/scheduling.js +92 -81
- 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/time.js +7 -7
- package/package.json +1 -1
package/dist/scheduling.js
CHANGED
|
@@ -51,18 +51,18 @@ export const SCHEDULE_STATUSES = [
|
|
|
51
51
|
"cancelled",
|
|
52
52
|
"completed",
|
|
53
53
|
];
|
|
54
|
-
export const scheduleStatusSchema = z.enum(SCHEDULE_STATUSES);
|
|
54
|
+
export const scheduleStatusSchema = /* @__PURE__ */ (() => z.enum(SCHEDULE_STATUSES))();
|
|
55
55
|
/** A recurring schedule pauses after this many failed runs; "never" disables it. */
|
|
56
56
|
export const DEFAULT_AUTO_PAUSE_AFTER_FAILURES = 5;
|
|
57
|
-
export const autoPauseAfterFailuresSchema = z
|
|
57
|
+
export const autoPauseAfterFailuresSchema = /* @__PURE__ */ (() => z
|
|
58
58
|
.union([z.number().int().min(1).max(100), z.literal("never")])
|
|
59
|
-
.describe('Consecutive failed runs before automatic pause: 1–100 or "never". Defaults to 5 on create; omission on replace preserves the setting. One-shot schedules are unaffected.');
|
|
60
|
-
export const autoPauseReasonSchema = z.object({
|
|
59
|
+
.describe('Consecutive failed runs before automatic pause: 1–100 or "never". Defaults to 5 on create; omission on replace preserves the setting. One-shot schedules are unaffected.'))();
|
|
60
|
+
export const autoPauseReasonSchema = /* @__PURE__ */ (() => z.object({
|
|
61
61
|
failedRuns: z.number().int().positive(),
|
|
62
62
|
status: z.number().int().min(100).max(599).optional(),
|
|
63
63
|
diagnostic: z.string().max(500),
|
|
64
64
|
pausedAt: timestampSchema,
|
|
65
|
-
});
|
|
65
|
+
}))();
|
|
66
66
|
/**
|
|
67
67
|
* The statuses a schedule never leaves, and from which it never fires again on
|
|
68
68
|
* its own.
|
|
@@ -103,7 +103,7 @@ export function isTerminalScheduleStatus(status) {
|
|
|
103
103
|
* anything to anybody. `realtime` gets preference without starving `bulk`.
|
|
104
104
|
*/
|
|
105
105
|
export const LATENCY_CLASSES = ["realtime", "bulk"];
|
|
106
|
-
export const latencyClassSchema = z.enum(LATENCY_CLASSES);
|
|
106
|
+
export const latencyClassSchema = /* @__PURE__ */ (() => z.enum(LATENCY_CLASSES))();
|
|
107
107
|
/**
|
|
108
108
|
* What happens when an occurrence reaches its first attempt after its planned
|
|
109
109
|
* instant.
|
|
@@ -118,7 +118,7 @@ export const latencyClassSchema = z.enum(LATENCY_CLASSES);
|
|
|
118
118
|
* it started under.
|
|
119
119
|
*/
|
|
120
120
|
export const LATENESS_POLICIES = ["skipAhead", "catchUp"];
|
|
121
|
-
export const latenessPolicySchema = z.enum(LATENESS_POLICIES);
|
|
121
|
+
export const latenessPolicySchema = /* @__PURE__ */ (() => z.enum(LATENESS_POLICIES))();
|
|
122
122
|
/** The inherited one-shot staleness window: twenty-four hours. */
|
|
123
123
|
export const DEFAULT_ONE_SHOT_MAX_STALENESS_SECONDS = 86_400;
|
|
124
124
|
/**
|
|
@@ -129,7 +129,7 @@ export const DEFAULT_ONE_SHOT_MAX_STALENESS_SECONDS = 86_400;
|
|
|
129
129
|
* staleness bound uses the recurrence's own default: twenty-four hours for a
|
|
130
130
|
* one-shot, and one recurrence interval for a recurring schedule.
|
|
131
131
|
*/
|
|
132
|
-
export const scheduleLatenessRequestSchema = z
|
|
132
|
+
export const scheduleLatenessRequestSchema = /* @__PURE__ */ (() => z
|
|
133
133
|
.object({
|
|
134
134
|
maxStalenessSeconds: durationSecondsSchema
|
|
135
135
|
.positive("must be at least 1 second")
|
|
@@ -137,7 +137,7 @@ export const scheduleLatenessRequestSchema = z
|
|
|
137
137
|
.optional(),
|
|
138
138
|
policy: latenessPolicySchema.optional(),
|
|
139
139
|
})
|
|
140
|
-
.strict();
|
|
140
|
+
.strict())();
|
|
141
141
|
/**
|
|
142
142
|
* Lateness settings as a schedule reads back.
|
|
143
143
|
*
|
|
@@ -145,9 +145,9 @@ export const scheduleLatenessRequestSchema = z
|
|
|
145
145
|
* remains optional because it records a per-schedule override, not a duplicated
|
|
146
146
|
* copy of a default that can be derived from the recurrence.
|
|
147
147
|
*/
|
|
148
|
-
export const scheduleLatenessSchema = scheduleLatenessRequestSchema.extend({
|
|
148
|
+
export const scheduleLatenessSchema = /* @__PURE__ */ (() => scheduleLatenessRequestSchema.extend({
|
|
149
149
|
policy: latenessPolicySchema,
|
|
150
|
-
});
|
|
150
|
+
}))();
|
|
151
151
|
/* -------------------------------------------------------------------------- */
|
|
152
152
|
/* Delivery duration */
|
|
153
153
|
/* -------------------------------------------------------------------------- */
|
|
@@ -256,12 +256,12 @@ export const RESPONSE_DELIVERY_MAX_DURATION_SECONDS = 1_800;
|
|
|
256
256
|
* a relation between two fields), and above
|
|
257
257
|
* {@link FREE_DELIVERY_DURATION_SECONDS} it needs a plan that allows it.
|
|
258
258
|
*/
|
|
259
|
-
export const deliveryDurationSecondsSchema = z
|
|
259
|
+
export const deliveryDurationSecondsSchema = /* @__PURE__ */ (() => z
|
|
260
260
|
.number()
|
|
261
261
|
.int("must be a whole number of seconds")
|
|
262
262
|
.positive("must be at least 1 second")
|
|
263
263
|
.max(MAX_DELIVERY_DURATION_SECONDS, `must be at most ${String(MAX_DELIVERY_DURATION_SECONDS)} seconds`)
|
|
264
|
-
.describe("How long the receiver may take to answer, in seconds");
|
|
264
|
+
.describe("How long the receiver may take to answer, in seconds"))();
|
|
265
265
|
/** Whether a duration is past the point where it needs a plan that allows it. */
|
|
266
266
|
export function isLongRunningDuration(seconds) {
|
|
267
267
|
return seconds > FREE_DELIVERY_DURATION_SECONDS;
|
|
@@ -291,7 +291,7 @@ export function isLongRunningDuration(seconds) {
|
|
|
291
291
|
* untouched, and so is what a rung costs.
|
|
292
292
|
*/
|
|
293
293
|
export const DELIVERY_COMPLETION_MODES = ["response", "callback"];
|
|
294
|
-
export const deliveryCompletionModeSchema = z.enum(DELIVERY_COMPLETION_MODES);
|
|
294
|
+
export const deliveryCompletionModeSchema = /* @__PURE__ */ (() => z.enum(DELIVERY_COMPLETION_MODES))();
|
|
295
295
|
/**
|
|
296
296
|
* What to do when a recurring schedule comes due and its previous run has not
|
|
297
297
|
* finished.
|
|
@@ -313,7 +313,7 @@ export const deliveryCompletionModeSchema = z.enum(DELIVERY_COMPLETION_MODES);
|
|
|
313
313
|
* - `queue` — run it when the previous one finishes.
|
|
314
314
|
*/
|
|
315
315
|
export const DELIVERY_OVERLAP_POLICIES = ["skip", "queue"];
|
|
316
|
-
export const deliveryOverlapPolicySchema = z.enum(DELIVERY_OVERLAP_POLICIES);
|
|
316
|
+
export const deliveryOverlapPolicySchema = /* @__PURE__ */ (() => z.enum(DELIVERY_OVERLAP_POLICIES))();
|
|
317
317
|
export const DEFAULT_DELIVERY_OVERLAP_POLICY = "skip";
|
|
318
318
|
/**
|
|
319
319
|
* A definition generation. Starts at 1 and increases on every replacement.
|
|
@@ -324,10 +324,7 @@ export const DEFAULT_DELIVERY_OVERLAP_POLICY = "skip";
|
|
|
324
324
|
* would make pausing and resuming a schedule invalidate occurrences that are
|
|
325
325
|
* still perfectly valid.
|
|
326
326
|
*/
|
|
327
|
-
export const generationSchema = z
|
|
328
|
-
.number()
|
|
329
|
-
.int("must be a whole number")
|
|
330
|
-
.positive("must be at least 1");
|
|
327
|
+
export const generationSchema = /* @__PURE__ */ (() => z.number().int("must be a whole number").positive("must be at least 1"))();
|
|
331
328
|
/**
|
|
332
329
|
* A customer-supplied fairness key.
|
|
333
330
|
*
|
|
@@ -339,11 +336,11 @@ export const generationSchema = z
|
|
|
339
336
|
* another Durable Object namespace.
|
|
340
337
|
*/
|
|
341
338
|
export const PARTITION_KEY_MAX_LENGTH = 64;
|
|
342
|
-
export const partitionKeySchema = z
|
|
339
|
+
export const partitionKeySchema = /* @__PURE__ */ (() => z
|
|
343
340
|
.string()
|
|
344
341
|
.min(1, "must not be empty")
|
|
345
342
|
.max(PARTITION_KEY_MAX_LENGTH, `must be at most ${String(PARTITION_KEY_MAX_LENGTH)} characters`)
|
|
346
|
-
.regex(/^[A-Za-z0-9._:-]+$/u, "must use only letters, digits, dot, underscore, colon, or hyphen");
|
|
343
|
+
.regex(/^[A-Za-z0-9._:-]+$/u, "must use only letters, digits, dot, underscore, colon, or hyphen"))();
|
|
347
344
|
/* -------------------------------------------------------------------------- */
|
|
348
345
|
/* Occurrence state */
|
|
349
346
|
/* -------------------------------------------------------------------------- */
|
|
@@ -369,11 +366,11 @@ export { OCCURRENCE_STATES, occurrenceStateSchema, } from "./occurrence-states.j
|
|
|
369
366
|
* the same thing. The date range is half-open, like every other time window in
|
|
370
367
|
* this contract, so adjacent requests neither overlap nor leave a gap.
|
|
371
368
|
*/
|
|
372
|
-
export const projectOccurrenceListRequestSchema = pageRequestSchema
|
|
369
|
+
export const projectOccurrenceListRequestSchema = /* @__PURE__ */ (() => pageRequestSchema
|
|
373
370
|
.extend(executionSelectionSchema.shape)
|
|
374
371
|
.refine((request) => request.from === undefined ||
|
|
375
372
|
request.to === undefined ||
|
|
376
|
-
Date.parse(request.from) < Date.parse(request.to), { message: "must be later than from", path: ["to"] });
|
|
373
|
+
Date.parse(request.from) < Date.parse(request.to), { message: "must be later than from", path: ["to"] }))();
|
|
377
374
|
const PROJECT_OCCURRENCE_LIST_PARAMETERS = [
|
|
378
375
|
"cursor",
|
|
379
376
|
"limit",
|
|
@@ -468,9 +465,9 @@ export const ATTEMPT_STATES = [
|
|
|
468
465
|
"terminal_failure",
|
|
469
466
|
"ambiguous",
|
|
470
467
|
];
|
|
471
|
-
export const attemptStateSchema = z.enum(ATTEMPT_STATES);
|
|
468
|
+
export const attemptStateSchema = /* @__PURE__ */ (() => z.enum(ATTEMPT_STATES))();
|
|
472
469
|
/** Safe diagnostic codes produced by the W3-03 delivery classifier. */
|
|
473
|
-
export const attemptDiagnosticSchema = z.enum(CALLBACK_ATTEMPT_DIAGNOSTICS);
|
|
470
|
+
export const attemptDiagnosticSchema = /* @__PURE__ */ (() => z.enum(CALLBACK_ATTEMPT_DIAGNOSTICS))();
|
|
474
471
|
/**
|
|
475
472
|
* Bounded next-action hints for an attempt timeline.
|
|
476
473
|
*
|
|
@@ -499,7 +496,7 @@ export const ATTEMPT_REMEDIATIONS = [
|
|
|
499
496
|
export const ATTEMPT_RESPONSE_HEADER_MAX_LENGTH = 256;
|
|
500
497
|
/** How much of a failed receiver's body is published, in characters. */
|
|
501
498
|
export const ATTEMPT_FAILURE_SNIPPET_MAX_LENGTH = 4_096;
|
|
502
|
-
export const attemptRemediationSchema = z.enum(ATTEMPT_REMEDIATIONS);
|
|
499
|
+
export const attemptRemediationSchema = /* @__PURE__ */ (() => z.enum(ATTEMPT_REMEDIATIONS))();
|
|
503
500
|
/** Derive the one safe next-action code a public attempt may expose. */
|
|
504
501
|
export function remediationForAttempt(diagnostic) {
|
|
505
502
|
switch (diagnostic) {
|
|
@@ -735,12 +732,12 @@ export const CRON_EXPRESSION_MAX_LENGTH = 120;
|
|
|
735
732
|
* fire on a second boundary is refused by the partition, because a minute is
|
|
736
733
|
* the granularity both arms of recurrence promise.
|
|
737
734
|
*/
|
|
738
|
-
export const cronExpressionSchema = z
|
|
735
|
+
export const cronExpressionSchema = /* @__PURE__ */ (() => z
|
|
739
736
|
.string()
|
|
740
737
|
.min(1, "must not be empty")
|
|
741
738
|
.max(CRON_EXPRESSION_MAX_LENGTH, `must be at most ${String(CRON_EXPRESSION_MAX_LENGTH)} characters`)
|
|
742
739
|
.refine((expression) => expression.startsWith("@") ||
|
|
743
|
-
[5, 6].includes(expression.trim().split(/\s+/u).length), { message: "must be five cron fields, six fields, or an @-nickname" });
|
|
740
|
+
[5, 6].includes(expression.trim().split(/\s+/u).length), { message: "must be five cron fields, six fields, or an @-nickname" }))();
|
|
744
741
|
/**
|
|
745
742
|
* How a schedule recurs, as a caller reads it back.
|
|
746
743
|
*
|
|
@@ -757,7 +754,7 @@ export const cronExpressionSchema = z
|
|
|
757
754
|
* on that arm rather than optional, so a read always says which wall clock a
|
|
758
755
|
* cron schedule is on instead of leaving the caller to assume UTC.
|
|
759
756
|
*/
|
|
760
|
-
export const recurrenceSchema = z.discriminatedUnion("kind", [
|
|
757
|
+
export const recurrenceSchema = /* @__PURE__ */ (() => z.discriminatedUnion("kind", [
|
|
761
758
|
/**
|
|
762
759
|
* A one-shot, which carries no instant of its own.
|
|
763
760
|
*
|
|
@@ -779,7 +776,7 @@ export const recurrenceSchema = z.discriminatedUnion("kind", [
|
|
|
779
776
|
kind: z.literal("cron"),
|
|
780
777
|
timeZone: timeZoneSchema,
|
|
781
778
|
}),
|
|
782
|
-
]);
|
|
779
|
+
]))();
|
|
783
780
|
/** The customer-safe default for a schedule's recurrence kind. */
|
|
784
781
|
export function defaultLatenessPolicyForRecurrence(kind) {
|
|
785
782
|
return kind === "at" ? "catchUp" : "skipAhead";
|
|
@@ -807,12 +804,12 @@ export function defaultLatenessPolicyForRecurrence(kind) {
|
|
|
807
804
|
*/
|
|
808
805
|
/** The most a schedule's name may hold; the generated one is cut to fit it. */
|
|
809
806
|
export const SCHEDULE_NAME_MAX_LENGTH = 120;
|
|
810
|
-
export const scheduleNameSchema = z
|
|
807
|
+
export const scheduleNameSchema = /* @__PURE__ */ (() => z
|
|
811
808
|
.string()
|
|
812
809
|
.trim()
|
|
813
810
|
.min(1, "must not be blank")
|
|
814
|
-
.max(SCHEDULE_NAME_MAX_LENGTH, `must be at most ${String(SCHEDULE_NAME_MAX_LENGTH)} characters`);
|
|
815
|
-
export const scheduleSchema = z.object({
|
|
811
|
+
.max(SCHEDULE_NAME_MAX_LENGTH, `must be at most ${String(SCHEDULE_NAME_MAX_LENGTH)} characters`))();
|
|
812
|
+
export const scheduleSchema = /* @__PURE__ */ (() => z.object({
|
|
816
813
|
autoPauseAfterFailures: autoPauseAfterFailuresSchema.optional(),
|
|
817
814
|
consecutiveFailedRuns: z.number().int().nonnegative().optional(),
|
|
818
815
|
autoPauseReason: autoPauseReasonSchema.nullable().optional(),
|
|
@@ -937,7 +934,7 @@ export const scheduleSchema = z.object({
|
|
|
937
934
|
status: scheduleStatusSchema,
|
|
938
935
|
updatedAt: timestampSchema,
|
|
939
936
|
version: versionSchema,
|
|
940
|
-
});
|
|
937
|
+
}))();
|
|
941
938
|
/**
|
|
942
939
|
* A page of schedules.
|
|
943
940
|
*
|
|
@@ -948,7 +945,7 @@ export const scheduleSchema = z.object({
|
|
|
948
945
|
* listing back through every partition it spans. Detail is where the occurrence
|
|
949
946
|
* is authoritative, and detail is one call away.
|
|
950
947
|
*/
|
|
951
|
-
export const schedulePageSchema = pageSchema(scheduleSchema);
|
|
948
|
+
export const schedulePageSchema = /* @__PURE__ */ (() => pageSchema(scheduleSchema))();
|
|
952
949
|
function hasCompleteTimingEvidence(value) {
|
|
953
950
|
return ((value.firstAttemptStartedAt === undefined) ===
|
|
954
951
|
(value.firstAttemptLatenessMs === undefined) &&
|
|
@@ -983,7 +980,7 @@ const timingEvidenceShape = {
|
|
|
983
980
|
* numbering starts again. Together `(schedule, generation, sequence)` is what
|
|
984
981
|
* makes an occurrence identifiable without depending on when it was written.
|
|
985
982
|
*/
|
|
986
|
-
export const occurrenceSchema = z
|
|
983
|
+
export const occurrenceSchema = /* @__PURE__ */ (() => z
|
|
987
984
|
.object({
|
|
988
985
|
attemptCount: z.number().int().nonnegative(),
|
|
989
986
|
...timingEvidenceShape,
|
|
@@ -1014,7 +1011,7 @@ export const occurrenceSchema = z
|
|
|
1014
1011
|
.refine(hasConsistentTimingEligibility, {
|
|
1015
1012
|
message: "timingEligibilityReason is required for a blocked population and absent otherwise",
|
|
1016
1013
|
path: ["timingEligibilityReason"],
|
|
1017
|
-
});
|
|
1014
|
+
}))();
|
|
1018
1015
|
/**
|
|
1019
1016
|
* One delivery attempt against one occurrence.
|
|
1020
1017
|
*
|
|
@@ -1039,11 +1036,11 @@ export const occurrenceSchema = z
|
|
|
1039
1036
|
* can look up in their own logs. Cookies, `Authorization` and
|
|
1040
1037
|
* `WWW-Authenticate` have no representation here at all.
|
|
1041
1038
|
*/
|
|
1042
|
-
export const attemptResponseHeaderSchema = z.object({
|
|
1039
|
+
export const attemptResponseHeaderSchema = /* @__PURE__ */ (() => z.object({
|
|
1043
1040
|
/** Lowercase, from the published allowlist. */
|
|
1044
1041
|
name: z.string().min(1).max(64),
|
|
1045
1042
|
value: z.string().max(ATTEMPT_RESPONSE_HEADER_MAX_LENGTH),
|
|
1046
|
-
});
|
|
1043
|
+
}))();
|
|
1047
1044
|
/**
|
|
1048
1045
|
* What a failing receiver said, bounded and access-controlled.
|
|
1049
1046
|
*
|
|
@@ -1057,14 +1054,14 @@ export const attemptResponseHeaderSchema = z.object({
|
|
|
1057
1054
|
* that is exactly the bound and a body that was cut at the bound are different
|
|
1058
1055
|
* facts and only one of them should show a customer an ellipsis.
|
|
1059
1056
|
*/
|
|
1060
|
-
export const attemptFailureSnippetSchema = z.object({
|
|
1057
|
+
export const attemptFailureSnippetSchema = /* @__PURE__ */ (() => z.object({
|
|
1061
1058
|
/** The media type it was captured from. Not customer content. */
|
|
1062
1059
|
contentType: z.string().min(1).max(128),
|
|
1063
1060
|
text: z.string().max(ATTEMPT_FAILURE_SNIPPET_MAX_LENGTH),
|
|
1064
1061
|
truncated: z.boolean(),
|
|
1065
|
-
});
|
|
1062
|
+
}))();
|
|
1066
1063
|
/** Stored diagnostic content, available only under the attempt's verified authority. */
|
|
1067
|
-
export const attemptCapturedBodySchema = z.object({
|
|
1064
|
+
export const attemptCapturedBodySchema = /* @__PURE__ */ (() => z.object({
|
|
1068
1065
|
contentType: z.string(),
|
|
1069
1066
|
encoding: z.enum(["utf8", "base64"]),
|
|
1070
1067
|
// Up to 10 KiB received bytes; credential masking can expand the representation.
|
|
@@ -1074,27 +1071,46 @@ export const attemptCapturedBodySchema = z.object({
|
|
|
1074
1071
|
truncated: z.boolean(),
|
|
1075
1072
|
redacted: z.boolean().optional(),
|
|
1076
1073
|
incomplete: z.boolean().optional(),
|
|
1077
|
-
});
|
|
1078
|
-
export const attemptResponseSchema = z.object({
|
|
1074
|
+
}))();
|
|
1075
|
+
export const attemptResponseSchema = /* @__PURE__ */ (() => z.object({
|
|
1079
1076
|
statusText: z.string(),
|
|
1080
1077
|
headers: z.array(z.object({ name: z.string(), value: z.string() })),
|
|
1081
1078
|
bodyState: z.enum(["captured", "empty", "expired", "not_captured"]),
|
|
1082
1079
|
body: attemptCapturedBodySchema.optional(),
|
|
1083
|
-
});
|
|
1084
|
-
export const attemptRequestSchema = z.object({
|
|
1080
|
+
}))();
|
|
1081
|
+
export const attemptRequestSchema = /* @__PURE__ */ (() => z.object({
|
|
1085
1082
|
method: z.enum(["GET", "POST", "PUT"]),
|
|
1086
1083
|
url: z.string(),
|
|
1087
1084
|
headers: z.array(z.object({ name: z.string(), value: z.string() })),
|
|
1088
1085
|
body: z.string(),
|
|
1089
|
-
});
|
|
1090
|
-
|
|
1091
|
-
|
|
1086
|
+
}))();
|
|
1087
|
+
/** Shared validators for attempt search summaries and full attempt details. */
|
|
1088
|
+
export const attemptSearchSummaryShape = /* @__PURE__ */ (() => ({
|
|
1092
1089
|
attemptNumber: z.number().int().positive(),
|
|
1093
|
-
/** Present exactly when the attempt has been classified. */
|
|
1094
1090
|
classifiedAt: timestampSchema.optional(),
|
|
1091
|
+
diagnostic: attemptDiagnosticSchema.optional(),
|
|
1092
|
+
durationMs: z
|
|
1093
|
+
.number()
|
|
1094
|
+
.int()
|
|
1095
|
+
.nonnegative()
|
|
1096
|
+
.max(ATTEMPT_DURATION_MAX_MS)
|
|
1097
|
+
.optional(),
|
|
1098
|
+
id: attemptIdSchema,
|
|
1099
|
+
occurrence: occurrenceIdSchema,
|
|
1100
|
+
remediation: attemptRemediationSchema.optional(),
|
|
1101
|
+
responseStatus: z.number().int().min(100).max(599).optional(),
|
|
1102
|
+
startedAt: timestampSchema,
|
|
1103
|
+
state: attemptStateSchema.optional(),
|
|
1104
|
+
trigger: attemptTriggerSchema,
|
|
1105
|
+
}))();
|
|
1106
|
+
export const attemptSchema = /* @__PURE__ */ (() => z
|
|
1107
|
+
.object({
|
|
1108
|
+
attemptNumber: attemptSearchSummaryShape.attemptNumber,
|
|
1109
|
+
/** Present exactly when the attempt has been classified. */
|
|
1110
|
+
classifiedAt: attemptSearchSummaryShape.classifiedAt,
|
|
1095
1111
|
delivery: deliveryIdSchema,
|
|
1096
1112
|
/** Safe classifier code; absent when durable evidence predates diagnostics. */
|
|
1097
|
-
diagnostic:
|
|
1113
|
+
diagnostic: attemptSearchSummaryShape.diagnostic,
|
|
1098
1114
|
/**
|
|
1099
1115
|
* Instrumented re-drives of the same dispatching occurrence under a new
|
|
1100
1116
|
* dispatch epoch. Includes deliberate admission deferrals; this is not a
|
|
@@ -1102,14 +1118,9 @@ export const attemptSchema = z
|
|
|
1102
1118
|
*/
|
|
1103
1119
|
dispatchRecoveries: z.int().nonnegative().optional(),
|
|
1104
1120
|
/** Executor-observed elapsed time; absent when no durable timing survived. */
|
|
1105
|
-
durationMs:
|
|
1106
|
-
.number()
|
|
1107
|
-
.int()
|
|
1108
|
-
.nonnegative()
|
|
1109
|
-
.max(ATTEMPT_DURATION_MAX_MS)
|
|
1110
|
-
.optional(),
|
|
1121
|
+
durationMs: attemptSearchSummaryShape.durationMs,
|
|
1111
1122
|
...timingEvidenceShape,
|
|
1112
|
-
id:
|
|
1123
|
+
id: attemptSearchSummaryShape.id,
|
|
1113
1124
|
/**
|
|
1114
1125
|
* Instrumented send authorizations granted after a later local alarm
|
|
1115
1126
|
* replayed the original wake receipt. Preserves the attempt and delivery
|
|
@@ -1118,7 +1129,7 @@ export const attemptSchema = z
|
|
|
1118
1129
|
* older responses.
|
|
1119
1130
|
*/
|
|
1120
1131
|
localReceiptRecoveries: z.int().nonnegative().optional(),
|
|
1121
|
-
occurrence:
|
|
1132
|
+
occurrence: attemptSearchSummaryShape.occurrence,
|
|
1122
1133
|
/**
|
|
1123
1134
|
* How many times the watchdog took this attempt's send back and sent it
|
|
1124
1135
|
* again: the send was authorized, and its outcome was never recorded
|
|
@@ -1129,7 +1140,7 @@ export const attemptSchema = z
|
|
|
1129
1140
|
*/
|
|
1130
1141
|
rescues: z.int().positive().optional(),
|
|
1131
1142
|
/** Stable next-action code paired with a diagnostic when one is known. */
|
|
1132
|
-
remediation:
|
|
1143
|
+
remediation: attemptSearchSummaryShape.remediation,
|
|
1133
1144
|
/**
|
|
1134
1145
|
* Compatibility text prefix, up to 4 KiB, derived from the retained
|
|
1135
1146
|
* response when its media type is supported by legacy clients. Use
|
|
@@ -1143,10 +1154,10 @@ export const attemptSchema = z
|
|
|
1143
1154
|
/** The fixed diagnostic-header allowlist, when a response carried any. */
|
|
1144
1155
|
responseHeaders: z.array(attemptResponseHeaderSchema).max(8).optional(),
|
|
1145
1156
|
/** Absent when no response was received at all. */
|
|
1146
|
-
responseStatus:
|
|
1147
|
-
startedAt:
|
|
1148
|
-
state:
|
|
1149
|
-
trigger:
|
|
1157
|
+
responseStatus: attemptSearchSummaryShape.responseStatus,
|
|
1158
|
+
startedAt: attemptSearchSummaryShape.startedAt,
|
|
1159
|
+
state: attemptSearchSummaryShape.state,
|
|
1160
|
+
trigger: attemptSearchSummaryShape.trigger,
|
|
1150
1161
|
})
|
|
1151
1162
|
// Classification and its timestamp arrive together or not at all — the same
|
|
1152
1163
|
// pairing the partition's CHECK constraint enforces. Independently optional
|
|
@@ -1185,30 +1196,30 @@ export const attemptSchema = z
|
|
|
1185
1196
|
.refine(hasConsistentTimingEligibility, {
|
|
1186
1197
|
message: "timingEligibilityReason is required for a blocked population and absent otherwise",
|
|
1187
1198
|
path: ["timingEligibilityReason"],
|
|
1188
|
-
});
|
|
1199
|
+
}))();
|
|
1189
1200
|
/** An authoritative page over one schedule's retained occurrences. */
|
|
1190
|
-
export const occurrencePageSchema = pageSchema(occurrenceSchema).extend({
|
|
1201
|
+
export const occurrencePageSchema = /* @__PURE__ */ (() => pageSchema(occurrenceSchema).extend({
|
|
1191
1202
|
freshness: z.object({ kind: z.literal("authoritative") }),
|
|
1192
|
-
});
|
|
1203
|
+
}))();
|
|
1193
1204
|
/** A project-wide occurrence page and its plan's normal history boundary. */
|
|
1194
|
-
export const projectOccurrencePageSchema = pageSchema(occurrenceSchema).extend({
|
|
1205
|
+
export const projectOccurrencePageSchema = /* @__PURE__ */ (() => pageSchema(occurrenceSchema).extend({
|
|
1195
1206
|
freshness: z.object({ kind: z.literal("authoritative") }),
|
|
1196
1207
|
retention: z.object({ from: timestampSchema }),
|
|
1197
|
-
});
|
|
1208
|
+
}))();
|
|
1198
1209
|
/** An authoritative occurrence detail response. */
|
|
1199
|
-
export const occurrenceViewSchema = z.object({
|
|
1210
|
+
export const occurrenceViewSchema = /* @__PURE__ */ (() => z.object({
|
|
1200
1211
|
freshness: z.object({ kind: z.literal("authoritative") }),
|
|
1201
1212
|
occurrence: occurrenceSchema,
|
|
1202
|
-
});
|
|
1213
|
+
}))();
|
|
1203
1214
|
/** An authoritative page over one retained occurrence's immutable attempts. */
|
|
1204
|
-
export const attemptPageSchema = pageSchema(attemptSchema).extend({
|
|
1215
|
+
export const attemptPageSchema = /* @__PURE__ */ (() => pageSchema(attemptSchema).extend({
|
|
1205
1216
|
freshness: z.object({ kind: z.literal("authoritative") }),
|
|
1206
|
-
});
|
|
1217
|
+
}))();
|
|
1207
1218
|
/** An authoritative attempt detail or redelivery response. */
|
|
1208
|
-
export const attemptViewSchema = z.object({
|
|
1219
|
+
export const attemptViewSchema = /* @__PURE__ */ (() => z.object({
|
|
1209
1220
|
attempt: attemptSchema,
|
|
1210
1221
|
freshness: z.object({ kind: z.literal("authoritative") }),
|
|
1211
|
-
});
|
|
1222
|
+
}))();
|
|
1212
1223
|
/**
|
|
1213
1224
|
* A schedule together with the occurrence that is next to happen.
|
|
1214
1225
|
*
|
|
@@ -1217,19 +1228,19 @@ export const attemptViewSchema = z.object({
|
|
|
1217
1228
|
* that has to make a second request to answer it will cache the first answer and
|
|
1218
1229
|
* be wrong.
|
|
1219
1230
|
*/
|
|
1220
|
-
export const scheduleViewSchema = z.object({
|
|
1231
|
+
export const scheduleViewSchema = /* @__PURE__ */ (() => z.object({
|
|
1221
1232
|
occurrence: occurrenceSchema,
|
|
1222
1233
|
schedule: scheduleSchema,
|
|
1223
|
-
});
|
|
1234
|
+
}))();
|
|
1224
1235
|
/**
|
|
1225
1236
|
* What a schedule create or replace answers: the schedule view, and — when the
|
|
1226
1237
|
* request named its destination by `url` — where that endpoint's signing
|
|
1227
1238
|
* secret is (W9-44). Present only then, because only then can the caller have
|
|
1228
1239
|
* an endpoint whose secret it never held.
|
|
1229
1240
|
*/
|
|
1230
|
-
export const scheduleWrittenViewSchema = scheduleViewSchema.extend({
|
|
1241
|
+
export const scheduleWrittenViewSchema = /* @__PURE__ */ (() => scheduleViewSchema.extend({
|
|
1231
1242
|
endpointSigningSecret: signingSecretNoticeSchema.optional(),
|
|
1232
|
-
});
|
|
1243
|
+
}))();
|
|
1233
1244
|
/**
|
|
1234
1245
|
* The four ways a caller may say when a schedule happens.
|
|
1235
1246
|
*
|
|
@@ -1259,7 +1270,7 @@ export const RECURRENCE_REQUEST_FIELDS = [
|
|
|
1259
1270
|
* `ambiguous_schedule`, and a scheduler that silently picks one of two instants
|
|
1260
1271
|
* a customer named is the worst kind of helpful.
|
|
1261
1272
|
*/
|
|
1262
|
-
export const scheduleRequestSchema = z
|
|
1273
|
+
export const scheduleRequestSchema = /* @__PURE__ */ (() => z
|
|
1263
1274
|
.object({
|
|
1264
1275
|
autoPauseAfterFailures: autoPauseAfterFailuresSchema.optional(),
|
|
1265
1276
|
http: httpRequestSchema.optional(),
|
|
@@ -1493,7 +1504,7 @@ export const scheduleRequestSchema = z
|
|
|
1493
1504
|
path: ["delivery", "completion"],
|
|
1494
1505
|
});
|
|
1495
1506
|
}
|
|
1496
|
-
});
|
|
1507
|
+
}))();
|
|
1497
1508
|
/** Resolve the lateness settings a create or replacement request runs under. */
|
|
1498
1509
|
export function deriveLatenessSettings(request) {
|
|
1499
1510
|
const recurrenceKind = request.cron !== undefined
|
package/dist/signatures.d.ts
CHANGED
|
@@ -409,7 +409,7 @@ export declare const CALLBACK_DELIVERY_PROTOCOL: {
|
|
|
409
409
|
};
|
|
410
410
|
readonly secret: "greatwait-signature-vector-key-not-a-credential";
|
|
411
411
|
readonly signingInputBase64: "MjAyNi0wNy0yOFQxNTowMDowMC4wMDBaLmRsdl8wMTIzNDU2Nzg5YWJjZGVmZ2hqa21ucHFycy57InZlcnNpb24iOiIyMDI2LTA3LTAxIiwidHlwZSI6InNjaGVkdWxlLm9jY3VycmVuY2UiLCJzY2hlZHVsZUlkIjoic2NoXzAxMjM0NTY3ODlhYmNkZWZnaGprbW5wcXJzIiwib2NjdXJyZW5jZUlkIjoib2NjXzAxMjM0NTY3ODlhYmNkZWZnaGprbW5wcXJzIiwicGxhbm5lZEZvciI6IjIwMjYtMDctMjhUMTU6MDA6MDAuMDAwWiIsImF0dGVtcHQiOjEsImRhdGEiOnt9fQ==";
|
|
412
|
-
readonly signingInputUtf8:
|
|
412
|
+
readonly signingInputUtf8: string;
|
|
413
413
|
};
|
|
414
414
|
/**
|
|
415
415
|
* The retired `2026-08-08` envelope **without** `completion`, kept as a known
|
|
@@ -445,7 +445,7 @@ export declare const CALLBACK_DELIVERY_PROTOCOL: {
|
|
|
445
445
|
};
|
|
446
446
|
readonly secret: "greatwait-signature-vector-key-not-a-credential";
|
|
447
447
|
readonly signingInputBase64: "MjAyNi0wNy0yOFQxNTowMDowMC4wMDBaLmRsdl8wMTIzNDU2Nzg5YWJjZGVmZ2hqa21ucHFycy57InZlcnNpb24iOiIyMDI2LTA4LTA4IiwidHlwZSI6InNjaGVkdWxlLm9jY3VycmVuY2UiLCJzY2hlZHVsZUlkIjoic2NoXzAxMjM0NTY3ODlhYmNkZWZnaGprbW5wcXJzIiwib2NjdXJyZW5jZUlkIjoib2NjXzAxMjM0NTY3ODlhYmNkZWZnaGprbW5wcXJzIiwicGxhbm5lZEZvciI6IjIwMjYtMDctMjhUMTU6MDA6MDAuMDAwWiIsImF0dGVtcHQiOjEsInRyaWdnZXIiOnsia2luZCI6ImF1dG9tYXRpYyJ9LCJkYXRhIjp7fX0=";
|
|
448
|
-
readonly signingInputUtf8:
|
|
448
|
+
readonly signingInputUtf8: string;
|
|
449
449
|
};
|
|
450
450
|
/**
|
|
451
451
|
* The retired `2026-08-08` envelope **with** `completion`, kept as a known
|
|
@@ -489,7 +489,7 @@ export declare const CALLBACK_DELIVERY_PROTOCOL: {
|
|
|
489
489
|
};
|
|
490
490
|
readonly secret: "greatwait-signature-vector-key-not-a-credential";
|
|
491
491
|
readonly signingInputBase64: "MjAyNi0wNy0yOFQxNTowMDowMC4wMDBaLmRsdl8wMTIzNDU2Nzg5YWJjZGVmZ2hqa21ucHFycy57InZlcnNpb24iOiIyMDI2LTA4LTA4IiwidHlwZSI6InNjaGVkdWxlLm9jY3VycmVuY2UiLCJzY2hlZHVsZUlkIjoic2NoXzAxMjM0NTY3ODlhYmNkZWZnaGprbW5wcXJzIiwib2NjdXJyZW5jZUlkIjoib2NjXzAxMjM0NTY3ODlhYmNkZWZnaGprbW5wcXJzIiwicGxhbm5lZEZvciI6IjIwMjYtMDctMjhUMTU6MDA6MDAuMDAwWiIsImF0dGVtcHQiOjEsImNvbXBsZXRpb24iOnsidG9rZW4iOiJ2MS5leGFtcGxlLWNsYWltLW5vdC1hLXJlYWwtdG9rZW4uZXhhbXBsZS1tYWMiLCJ1cmwiOiJodHRwczovL2dyZWF0d2FpdC1zY2hlZHVsZXIuZXhhbXBsZS9jYWxsYmFja3MvY29tcGxldGlvbiJ9LCJ0cmlnZ2VyIjp7ImtpbmQiOiJhdXRvbWF0aWMifSwiZGF0YSI6e319";
|
|
492
|
-
readonly signingInputUtf8:
|
|
492
|
+
readonly signingInputUtf8: string;
|
|
493
493
|
};
|
|
494
494
|
/**
|
|
495
495
|
* A redelivery, which is the only vector that discriminates this change.
|
|
@@ -530,7 +530,7 @@ export declare const CALLBACK_DELIVERY_PROTOCOL: {
|
|
|
530
530
|
};
|
|
531
531
|
readonly secret: "greatwait-signature-vector-key-not-a-credential";
|
|
532
532
|
readonly signingInputBase64: "MjAyNi0wNy0yOFQxNTowMDowMC4wMDBaLmRsdl8wMTIzNDU2Nzg5YWJjZGVmZ2hqa21ucHFycy57InZlcnNpb24iOiIyMDI2LTA4LTIzIiwidHlwZSI6InNjaGVkdWxlLm9jY3VycmVuY2UiLCJzY2hlZHVsZUlkIjoic2NoXzAxMjM0NTY3ODlhYmNkZWZnaGprbW5wcXJzIiwib2NjdXJyZW5jZUlkIjoib2NjXzAxMjM0NTY3ODlhYmNkZWZnaGprbW5wcXJzIiwicGxhbm5lZEZvciI6IjIwMjYtMDctMjhUMTU6MDA6MDAuMDAwWiIsImF0dGVtcHQiOjIsImNvbXBsZXRpb24iOnsidG9rZW4iOiJ2Mi5leGFtcGxlLWNsYWltLW5vdC1hLXJlYWwtdG9rZW4uZXhhbXBsZS1tYWMiLCJ1cmwiOiJodHRwczovL2dyZWF0d2FpdC1zY2hlZHVsZXIuZXhhbXBsZS9jYWxsYmFja3MvY29tcGxldGlvbiIsImRlYWRsaW5lIjoiMjAyNi0wNy0yOFQxNTowMDowNS4wMDBaIn0sInRyaWdnZXIiOnsia2luZCI6InJlZGVsaXZlcnkiLCJzb3VyY2VBdHRlbXB0SWQiOiJhdHRfMDEyMzQ1Njc4OWFiY2RlZmdoamttbnBxcnMifSwiZGF0YSI6e319";
|
|
533
|
-
readonly signingInputUtf8:
|
|
533
|
+
readonly signingInputUtf8: string;
|
|
534
534
|
};
|
|
535
535
|
/**
|
|
536
536
|
* The ordinary current-version delivery: automatic, and carrying completion
|
|
@@ -566,7 +566,7 @@ export declare const CALLBACK_DELIVERY_PROTOCOL: {
|
|
|
566
566
|
};
|
|
567
567
|
readonly secret: "greatwait-signature-vector-key-not-a-credential";
|
|
568
568
|
readonly signingInputBase64: "MjAyNi0wNy0yOFQxNTowMDowMC4wMDBaLmRsdl8wMTIzNDU2Nzg5YWJjZGVmZ2hqa21ucHFycy57InZlcnNpb24iOiIyMDI2LTA4LTIzIiwidHlwZSI6InNjaGVkdWxlLm9jY3VycmVuY2UiLCJzY2hlZHVsZUlkIjoic2NoXzAxMjM0NTY3ODlhYmNkZWZnaGprbW5wcXJzIiwib2NjdXJyZW5jZUlkIjoib2NjXzAxMjM0NTY3ODlhYmNkZWZnaGprbW5wcXJzIiwicGxhbm5lZEZvciI6IjIwMjYtMDctMjhUMTU6MDA6MDAuMDAwWiIsImF0dGVtcHQiOjEsImNvbXBsZXRpb24iOnsidG9rZW4iOiJ2Mi5leGFtcGxlLWNsYWltLW5vdC1hLXJlYWwtdG9rZW4uZXhhbXBsZS1tYWMiLCJ1cmwiOiJodHRwczovL2dyZWF0d2FpdC1zY2hlZHVsZXIuZXhhbXBsZS9jYWxsYmFja3MvY29tcGxldGlvbiIsImRlYWRsaW5lIjoiMjAyNi0wNy0yOFQxNTowMDowNS4wMDBaIn0sInRyaWdnZXIiOnsia2luZCI6ImF1dG9tYXRpYyJ9LCJkYXRhIjp7fX0=";
|
|
569
|
-
readonly signingInputUtf8:
|
|
569
|
+
readonly signingInputUtf8: string;
|
|
570
570
|
};
|
|
571
571
|
readonly unicodeTestVector: {
|
|
572
572
|
readonly envelope: {
|
|
@@ -600,7 +600,7 @@ export declare const CALLBACK_DELIVERY_PROTOCOL: {
|
|
|
600
600
|
};
|
|
601
601
|
readonly secret: "greatwait-signature-vector-key-not-a-credential";
|
|
602
602
|
readonly signingInputBase64: "MjAyNi0wNy0yOFQxNTowMDowMC4wMDBaLmRsdl8wMTIzNDU2Nzg5YWJjZGVmZ2hqa21ucHFycy57InZlcnNpb24iOiIyMDI2LTA4LTIzIiwidHlwZSI6InNjaGVkdWxlLm9jY3VycmVuY2UiLCJzY2hlZHVsZUlkIjoic2NoXzAxMjM0NTY3ODlhYmNkZWZnaGprbW5wcXJzIiwib2NjdXJyZW5jZUlkIjoib2NjXzAxMjM0NTY3ODlhYmNkZWZnaGprbW5wcXJzIiwicGxhbm5lZEZvciI6IjIwMjYtMDctMjhUMTU6MDA6MDAuMDAwWiIsImF0dGVtcHQiOjEsImNvbXBsZXRpb24iOnsidG9rZW4iOiJ2Mi5leGFtcGxlLWNsYWltLW5vdC1hLXJlYWwtdG9rZW4uZXhhbXBsZS1tYWMiLCJ1cmwiOiJodHRwczovL2dyZWF0d2FpdC1zY2hlZHVsZXIuZXhhbXBsZS9jYWxsYmFja3MvY29tcGxldGlvbiIsImRlYWRsaW5lIjoiMjAyNi0wNy0yOFQxNTowMDowNS4wMDBaIn0sInRyaWdnZXIiOnsia2luZCI6ImF1dG9tYXRpYyJ9LCJkYXRhIjp7Im5vdGUiOiJjYWbDqSDimIMifX0=";
|
|
603
|
-
readonly signingInputUtf8:
|
|
603
|
+
readonly signingInputUtf8: string;
|
|
604
604
|
};
|
|
605
605
|
readonly version: "2026-08-23";
|
|
606
606
|
};
|