@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/attempt-search.js
CHANGED
|
@@ -3,9 +3,9 @@ import { pageRequestSchema, pageSchema } from "./protocol.js";
|
|
|
3
3
|
import { endpointIdSchema, scheduleIdSchema } from "./identifiers.js";
|
|
4
4
|
import { externalIdentifierSchema, scheduleTagSchema, scheduleTagsSchema, } from "./host-correlation.js";
|
|
5
5
|
import { timestampSchema } from "./time.js";
|
|
6
|
-
import {
|
|
6
|
+
import { attemptSearchSummaryShape, attemptStateSchema, attemptDiagnosticSchema, occurrenceSchema, scheduleNameSchema, } from "./scheduling.js";
|
|
7
7
|
/** Actual attempt start, never occurrence planned time. Boundaries are [start, end). */
|
|
8
|
-
export const projectAttemptSearchRequestSchema = pageRequestSchema
|
|
8
|
+
export const projectAttemptSearchRequestSchema = /* @__PURE__ */ (() => pageRequestSchema
|
|
9
9
|
.extend({
|
|
10
10
|
startedFrom: timestampSchema,
|
|
11
11
|
startedBefore: timestampSchema,
|
|
@@ -21,7 +21,7 @@ export const projectAttemptSearchRequestSchema = pageRequestSchema
|
|
|
21
21
|
.refine((value) => Date.parse(value.startedFrom) < Date.parse(value.startedBefore), {
|
|
22
22
|
message: "must be later than startedFrom",
|
|
23
23
|
path: ["startedBefore"],
|
|
24
|
-
});
|
|
24
|
+
}))();
|
|
25
25
|
export function normalizeAttemptSelection(request) {
|
|
26
26
|
return Object.fromEntries(Object.entries(request).filter(([key, value]) => key !== "cursor" && key !== "limit" && value !== undefined));
|
|
27
27
|
}
|
|
@@ -68,19 +68,19 @@ export function parseProjectAttemptSearchRequest(query) {
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
/** Safe search summary: content and secret-bearing HTTP evidence is detail-only. */
|
|
71
|
-
export const projectAttemptSearchResultSchema = z.object({
|
|
71
|
+
export const projectAttemptSearchResultSchema = /* @__PURE__ */ (() => z.object({
|
|
72
72
|
attempt: z.object({
|
|
73
|
-
id:
|
|
74
|
-
attemptNumber:
|
|
75
|
-
occurrence:
|
|
76
|
-
startedAt:
|
|
77
|
-
state:
|
|
78
|
-
classifiedAt:
|
|
79
|
-
durationMs:
|
|
80
|
-
responseStatus:
|
|
81
|
-
diagnostic:
|
|
82
|
-
remediation:
|
|
83
|
-
trigger:
|
|
73
|
+
id: attemptSearchSummaryShape.id,
|
|
74
|
+
attemptNumber: attemptSearchSummaryShape.attemptNumber,
|
|
75
|
+
occurrence: attemptSearchSummaryShape.occurrence,
|
|
76
|
+
startedAt: attemptSearchSummaryShape.startedAt,
|
|
77
|
+
state: attemptSearchSummaryShape.state,
|
|
78
|
+
classifiedAt: attemptSearchSummaryShape.classifiedAt,
|
|
79
|
+
durationMs: attemptSearchSummaryShape.durationMs,
|
|
80
|
+
responseStatus: attemptSearchSummaryShape.responseStatus,
|
|
81
|
+
diagnostic: attemptSearchSummaryShape.diagnostic,
|
|
82
|
+
remediation: attemptSearchSummaryShape.remediation,
|
|
83
|
+
trigger: attemptSearchSummaryShape.trigger,
|
|
84
84
|
}),
|
|
85
85
|
occurrence: occurrenceSchema,
|
|
86
86
|
schedule: z.object({
|
|
@@ -90,9 +90,12 @@ export const projectAttemptSearchResultSchema = z.object({
|
|
|
90
90
|
external_identifier: externalIdentifierSchema.optional(),
|
|
91
91
|
tags: scheduleTagsSchema.optional(),
|
|
92
92
|
}),
|
|
93
|
-
});
|
|
94
|
-
export const projectAttemptPageSchema = pageSchema(projectAttemptSearchResultSchema).extend({
|
|
93
|
+
}))();
|
|
94
|
+
export const projectAttemptPageSchema = /* @__PURE__ */ (() => pageSchema(projectAttemptSearchResultSchema).extend({
|
|
95
95
|
freshness: z.object({ kind: z.literal("authoritative") }),
|
|
96
96
|
/** Normal plan horizons; older live/retained records may still be returned. */
|
|
97
|
-
retention: z.object({
|
|
98
|
-
|
|
97
|
+
retention: z.object({
|
|
98
|
+
from: timestampSchema,
|
|
99
|
+
detailsFrom: timestampSchema,
|
|
100
|
+
}),
|
|
101
|
+
}))();
|
package/dist/authority.js
CHANGED
|
@@ -26,13 +26,13 @@ import { environmentIdSchema, organizationIdSchema, projectIdSchema, } from "./i
|
|
|
26
26
|
* third if one is ever added.
|
|
27
27
|
*/
|
|
28
28
|
export const ENVIRONMENT_KINDS_IN_ORDER = ["test", "live"];
|
|
29
|
-
export const environmentKindSchema = z.enum(ENVIRONMENT_KINDS_IN_ORDER);
|
|
30
|
-
export const authoritySchema = z.object({
|
|
29
|
+
export const environmentKindSchema = /* @__PURE__ */ (() => z.enum(ENVIRONMENT_KINDS_IN_ORDER))();
|
|
30
|
+
export const authoritySchema = /* @__PURE__ */ (() => z.object({
|
|
31
31
|
environment: environmentIdSchema,
|
|
32
32
|
environmentKind: environmentKindSchema,
|
|
33
33
|
organization: organizationIdSchema,
|
|
34
34
|
project: projectIdSchema,
|
|
35
|
-
});
|
|
35
|
+
}))();
|
|
36
36
|
/**
|
|
37
37
|
* The initial scope vocabulary. Scopes are `resource:action`, lower case, and
|
|
38
38
|
* additive — a new scope is a compatible change, removing or narrowing one is
|
|
@@ -126,7 +126,7 @@ export const SCOPES = [
|
|
|
126
126
|
*/
|
|
127
127
|
"usage:read",
|
|
128
128
|
];
|
|
129
|
-
export const scopeSchema = z.enum(SCOPES);
|
|
129
|
+
export const scopeSchema = /* @__PURE__ */ (() => z.enum(SCOPES))();
|
|
130
130
|
/** Read scopes implied by the matching write scope. */
|
|
131
131
|
const IMPLIED_BY_WRITE = {
|
|
132
132
|
"credentials:write": "credentials:read",
|
|
@@ -170,13 +170,13 @@ export function effectiveScopes(granted) {
|
|
|
170
170
|
* gives for one that does not exist.
|
|
171
171
|
*/
|
|
172
172
|
export const PRINCIPAL_KINDS = ["api-credential", "oauth", "session"];
|
|
173
|
-
export const principalKindSchema = z.enum(PRINCIPAL_KINDS);
|
|
174
|
-
export const principalSchema = z.object({
|
|
173
|
+
export const principalKindSchema = /* @__PURE__ */ (() => z.enum(PRINCIPAL_KINDS))();
|
|
174
|
+
export const principalSchema = /* @__PURE__ */ (() => z.object({
|
|
175
175
|
authority: authoritySchema,
|
|
176
176
|
scopes: z.array(scopeSchema).min(1),
|
|
177
177
|
/** How the principal was established, for audit and refusal messages. */
|
|
178
178
|
via: principalKindSchema,
|
|
179
|
-
});
|
|
179
|
+
}))();
|
|
180
180
|
/**
|
|
181
181
|
* Whether a principal may act on an already-resolved resource.
|
|
182
182
|
*
|
|
@@ -298,10 +298,10 @@ export const SESSION_AUTHORITY_HEADERS = {
|
|
|
298
298
|
* know whether a scope is implied can apply the same published expansion the
|
|
299
299
|
* service does.
|
|
300
300
|
*/
|
|
301
|
-
export const credentialContextSchema = z.object({
|
|
301
|
+
export const credentialContextSchema = /* @__PURE__ */ (() => z.object({
|
|
302
302
|
environmentKind: environmentKindSchema,
|
|
303
303
|
/** How this credential authenticated. Never `session`: see the operation. */
|
|
304
304
|
principal: z.enum(["api-credential", "oauth"]),
|
|
305
305
|
project: projectIdSchema,
|
|
306
306
|
scopes: z.array(scopeSchema).min(1),
|
|
307
|
-
});
|
|
307
|
+
}))();
|
package/dist/configuration.d.ts
CHANGED
|
@@ -51,6 +51,10 @@ export interface ConfigurationSetting {
|
|
|
51
51
|
readonly exhaustion: string;
|
|
52
52
|
readonly visibility: "customer";
|
|
53
53
|
}
|
|
54
|
+
/** Bounds and edit authority shared by validation and the descriptive catalog. */
|
|
55
|
+
export type ConfigurationRule = Pick<ConfigurationSetting, "key" | "unit" | "minimum" | "maximum" | "layers">;
|
|
56
|
+
export declare const CONFIGURATION_RULES: readonly ConfigurationRule[];
|
|
57
|
+
/** Descriptive metadata is only initialized by catalog consumers. */
|
|
54
58
|
export declare const CONFIGURATION_CATALOG: readonly ConfigurationSetting[];
|
|
55
59
|
export declare function validateConfigurationValues(value: unknown, scope: ConfigurationScope): ConfigurationValues;
|
|
56
60
|
export interface EffectiveConfiguration {
|
package/dist/configuration.js
CHANGED
|
@@ -24,7 +24,7 @@ export const CONFIGURATION_DEFAULTS = Object.freeze({
|
|
|
24
24
|
});
|
|
25
25
|
const allowanceLayers = ["default", "global", "organization"];
|
|
26
26
|
const deploymentLayers = ["default", "deployment"];
|
|
27
|
-
export const
|
|
27
|
+
export const CONFIGURATION_RULES = Object.freeze([
|
|
28
28
|
...[
|
|
29
29
|
"bulkMaxTargets",
|
|
30
30
|
"bulkExecutionLifetimeSeconds",
|
|
@@ -37,72 +37,38 @@ export const CONFIGURATION_CATALOG = Object.freeze([
|
|
|
37
37
|
"bulkCarrierBatchSize",
|
|
38
38
|
].map((key) => ({
|
|
39
39
|
key,
|
|
40
|
-
type: "integer",
|
|
41
40
|
unit: key.endsWith("Seconds") ? "seconds" : "count",
|
|
42
|
-
default: CONFIGURATION_DEFAULTS[key],
|
|
43
41
|
minimum: 1,
|
|
44
42
|
maximum: BULK_CONFIGURATION_MAXIMA[key],
|
|
45
43
|
layers: allowanceLayers,
|
|
46
|
-
change: "live",
|
|
47
|
-
visibility: "customer",
|
|
48
|
-
rationale: "Owner-approved bounded bulk preparation and execution. Backlog limits do not increase in-flight work or ordinary delivery quotas; result retention is additionally capped by effective history retention.",
|
|
49
|
-
enforcement: ["bulk-operations"],
|
|
50
|
-
exhaustion: "Oversized selections refuse; deadlines expire remaining work; durable checkpoints preserve completed effects.",
|
|
51
44
|
})),
|
|
52
45
|
{
|
|
53
46
|
key: "inlinePayloadBytes",
|
|
54
|
-
type: "integer",
|
|
55
47
|
unit: "bytes",
|
|
56
|
-
default: CONFIGURATION_DEFAULTS.inlinePayloadBytes,
|
|
57
48
|
minimum: 0,
|
|
58
49
|
maximum: MAX_INLINE_PAYLOAD_BYTES,
|
|
59
50
|
layers: allowanceLayers,
|
|
60
|
-
change: "live",
|
|
61
|
-
rationale: "The operator removed the lower storage allowance. Default is the existing public payload envelope; a deliberate override may narrow it. Unbounded bodies would exceed the existing SQL and receiver representations.",
|
|
62
|
-
enforcement: ["authority-service", "schedule-draft"],
|
|
63
|
-
exhaustion: "Local validation and authoritative plan-limit-reached",
|
|
64
|
-
visibility: "customer",
|
|
65
51
|
},
|
|
66
52
|
{
|
|
67
53
|
key: "partitionKeyCeiling",
|
|
68
|
-
type: "integer",
|
|
69
54
|
unit: "count",
|
|
70
55
|
minimum: 1,
|
|
71
56
|
maximum: MAX_PARTITION_KEY_CEILING,
|
|
72
57
|
layers: allowanceLayers,
|
|
73
|
-
change: "live",
|
|
74
|
-
rationale: "No inherited count cap. A deliberate override uses indexed successor seeks bounded to ceiling plus one; its supported bound preserves the existing transaction work envelope.",
|
|
75
|
-
enforcement: ["authority-service", "postgres-repository"],
|
|
76
|
-
exhaustion: "New keys refused; existing keys and committed schedules preserved",
|
|
77
|
-
visibility: "customer",
|
|
78
58
|
},
|
|
79
59
|
{
|
|
80
60
|
key: "forecastHorizonSeconds",
|
|
81
|
-
type: "integer",
|
|
82
61
|
unit: "seconds",
|
|
83
|
-
default: CONFIGURATION_DEFAULTS.forecastHorizonSeconds,
|
|
84
62
|
minimum: 60,
|
|
85
63
|
maximum: MAX_FORECAST_HORIZON_SECONDS,
|
|
86
64
|
layers: allowanceLayers,
|
|
87
|
-
change: "live",
|
|
88
|
-
rationale: "The operator removed the six-hour allowance. Default is the existing public forecast horizon; explicit work exhaustion cannot masquerade as complete coverage.",
|
|
89
|
-
enforcement: ["authority-reads"],
|
|
90
|
-
exhaustion: "Window clipped; exhausted work returns explicit incomplete refusal",
|
|
91
|
-
visibility: "customer",
|
|
92
65
|
},
|
|
93
66
|
{
|
|
94
67
|
key: "usageWindowDays",
|
|
95
|
-
type: "integer",
|
|
96
68
|
unit: "days",
|
|
97
|
-
default: CONFIGURATION_DEFAULTS.usageWindowDays,
|
|
98
69
|
minimum: 1,
|
|
99
70
|
maximum: MAX_USAGE_WINDOW_DAYS,
|
|
100
71
|
layers: allowanceLayers,
|
|
101
|
-
change: "live",
|
|
102
|
-
rationale: "The operator removed the 31-day allowance. Default is the existing public usage envelope; it does not extend retention or restore purged data.",
|
|
103
|
-
enforcement: ["authority-reads"],
|
|
104
|
-
exhaustion: "Read window constrained to effective policy",
|
|
105
|
-
visibility: "customer",
|
|
106
72
|
},
|
|
107
73
|
...[
|
|
108
74
|
"attemptDetailRetentionSeconds",
|
|
@@ -110,32 +76,104 @@ export const CONFIGURATION_CATALOG = Object.freeze([
|
|
|
110
76
|
"payloadRetentionSeconds",
|
|
111
77
|
].map((key) => ({
|
|
112
78
|
key,
|
|
113
|
-
type: "integer",
|
|
114
79
|
unit: "seconds",
|
|
115
|
-
default: CONFIGURATION_DEFAULTS[key],
|
|
116
80
|
minimum: 0,
|
|
117
81
|
maximum: 9_007_199_254_740,
|
|
118
82
|
layers: deploymentLayers,
|
|
119
|
-
change: "deployment",
|
|
120
|
-
rationale: "Accepted retention policy, separately governed. Stored schedule durations preserve committed policy; increases cannot restore purged data.",
|
|
121
|
-
enforcement: ["authority-service", "authority-reads", "retention"],
|
|
122
|
-
exhaustion: "Read cutoff and bounded purge; no organization override",
|
|
123
|
-
visibility: "customer",
|
|
124
83
|
})),
|
|
125
84
|
{
|
|
126
85
|
key: "pageLimit",
|
|
127
|
-
type: "integer",
|
|
128
86
|
unit: "count",
|
|
129
87
|
minimum: PUBLIC_PAGE_SIZE.min,
|
|
130
88
|
maximum: PUBLIC_PAGE_SIZE.max,
|
|
131
89
|
layers: deploymentLayers,
|
|
132
|
-
change: "deployment",
|
|
133
|
-
rationale: "Public page protocol maximum; continuation preserves completeness.",
|
|
134
|
-
enforcement: ["authority-reads"],
|
|
135
|
-
exhaustion: "Bounded page with continuation",
|
|
136
|
-
visibility: "customer",
|
|
137
90
|
},
|
|
138
91
|
]);
|
|
92
|
+
/** Descriptive metadata is only initialized by catalog consumers. */
|
|
93
|
+
export const CONFIGURATION_CATALOG =
|
|
94
|
+
/* @__PURE__ */ (() => {
|
|
95
|
+
const metadata = [
|
|
96
|
+
...[
|
|
97
|
+
"bulkMaxTargets",
|
|
98
|
+
"bulkExecutionLifetimeSeconds",
|
|
99
|
+
"bulkPreviewLifetimeSeconds",
|
|
100
|
+
"bulkResultRetentionSeconds",
|
|
101
|
+
"bulkBatchSize",
|
|
102
|
+
"bulkWorkerConcurrency",
|
|
103
|
+
"bulkActiveJobLimit",
|
|
104
|
+
"bulkWorkBudgetSeconds",
|
|
105
|
+
"bulkCarrierBatchSize",
|
|
106
|
+
].map((key) => ({
|
|
107
|
+
key,
|
|
108
|
+
change: "live",
|
|
109
|
+
visibility: "customer",
|
|
110
|
+
rationale: "Owner-approved bounded bulk preparation and execution. Backlog limits do not increase in-flight work or ordinary delivery quotas; result retention is additionally capped by effective history retention.",
|
|
111
|
+
enforcement: ["bulk-operations"],
|
|
112
|
+
exhaustion: "Oversized selections refuse; deadlines expire remaining work; durable checkpoints preserve completed effects.",
|
|
113
|
+
})),
|
|
114
|
+
{
|
|
115
|
+
key: "inlinePayloadBytes",
|
|
116
|
+
change: "live",
|
|
117
|
+
rationale: "The operator removed the lower storage allowance. Default is the existing public payload envelope; a deliberate override may narrow it. Unbounded bodies would exceed the existing SQL and receiver representations.",
|
|
118
|
+
enforcement: ["authority-service", "schedule-draft"],
|
|
119
|
+
exhaustion: "Local validation and authoritative plan-limit-reached",
|
|
120
|
+
visibility: "customer",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
key: "partitionKeyCeiling",
|
|
124
|
+
change: "live",
|
|
125
|
+
rationale: "No inherited count cap. A deliberate override uses indexed successor seeks bounded to ceiling plus one; its supported bound preserves the existing transaction work envelope.",
|
|
126
|
+
enforcement: ["authority-service", "postgres-repository"],
|
|
127
|
+
exhaustion: "New keys refused; existing keys and committed schedules preserved",
|
|
128
|
+
visibility: "customer",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
key: "forecastHorizonSeconds",
|
|
132
|
+
change: "live",
|
|
133
|
+
rationale: "The operator removed the six-hour allowance. Default is the existing public forecast horizon; explicit work exhaustion cannot masquerade as complete coverage.",
|
|
134
|
+
enforcement: ["authority-reads"],
|
|
135
|
+
exhaustion: "Window clipped; exhausted work returns explicit incomplete refusal",
|
|
136
|
+
visibility: "customer",
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
key: "usageWindowDays",
|
|
140
|
+
change: "live",
|
|
141
|
+
rationale: "The operator removed the 31-day allowance. Default is the existing public usage envelope; it does not extend retention or restore purged data.",
|
|
142
|
+
enforcement: ["authority-reads"],
|
|
143
|
+
exhaustion: "Read window constrained to effective policy",
|
|
144
|
+
visibility: "customer",
|
|
145
|
+
},
|
|
146
|
+
...[
|
|
147
|
+
"attemptDetailRetentionSeconds",
|
|
148
|
+
"historyRetentionSeconds",
|
|
149
|
+
"payloadRetentionSeconds",
|
|
150
|
+
].map((key) => ({
|
|
151
|
+
key,
|
|
152
|
+
change: "deployment",
|
|
153
|
+
rationale: "Accepted retention policy, separately governed. Stored schedule durations preserve committed policy; increases cannot restore purged data.",
|
|
154
|
+
enforcement: ["authority-service", "authority-reads", "retention"],
|
|
155
|
+
exhaustion: "Read cutoff and bounded purge; no organization override",
|
|
156
|
+
visibility: "customer",
|
|
157
|
+
})),
|
|
158
|
+
{
|
|
159
|
+
key: "pageLimit",
|
|
160
|
+
change: "deployment",
|
|
161
|
+
rationale: "Public page protocol maximum; continuation preserves completeness.",
|
|
162
|
+
enforcement: ["authority-reads"],
|
|
163
|
+
exhaustion: "Bounded page with continuation",
|
|
164
|
+
visibility: "customer",
|
|
165
|
+
},
|
|
166
|
+
];
|
|
167
|
+
const defaults = CONFIGURATION_DEFAULTS;
|
|
168
|
+
return Object.freeze(metadata.map((entry) => ({
|
|
169
|
+
...CONFIGURATION_RULES.find((rule) => rule.key === entry.key),
|
|
170
|
+
type: "integer",
|
|
171
|
+
...(defaults[entry.key] === undefined
|
|
172
|
+
? {}
|
|
173
|
+
: { default: defaults[entry.key] }),
|
|
174
|
+
...entry,
|
|
175
|
+
})));
|
|
176
|
+
})();
|
|
139
177
|
export function validateConfigurationValues(value, scope) {
|
|
140
178
|
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
141
179
|
throw new TypeError("configuration values must be an object");
|
|
@@ -143,7 +181,7 @@ export function validateConfigurationValues(value, scope) {
|
|
|
143
181
|
throw new TypeError("unsupported configuration scope");
|
|
144
182
|
const parsed = {};
|
|
145
183
|
for (const [key, candidate] of Object.entries(value)) {
|
|
146
|
-
const definition =
|
|
184
|
+
const definition = CONFIGURATION_RULES.find((entry) => entry.key === key);
|
|
147
185
|
if (definition === undefined || !definition.layers.includes(scope))
|
|
148
186
|
throw new TypeError(`configuration setting ${key} does not support ${scope} edits`);
|
|
149
187
|
if (typeof candidate !== "number" ||
|
|
@@ -170,7 +208,7 @@ export function resolveEffectiveConfiguration(input) {
|
|
|
170
208
|
};
|
|
171
209
|
if (input.baseline !== undefined) {
|
|
172
210
|
for (const [key, candidate] of Object.entries(input.baseline)) {
|
|
173
|
-
const setting =
|
|
211
|
+
const setting = CONFIGURATION_RULES.find((entry) => entry.key === key);
|
|
174
212
|
if (setting === undefined ||
|
|
175
213
|
typeof candidate !== "number" ||
|
|
176
214
|
!Number.isSafeInteger(candidate) ||
|
package/dist/delivery.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export interface StoredHttpRequest {
|
|
|
45
45
|
readonly encryptedTemplate?: EncryptedSchedulePayload;
|
|
46
46
|
}
|
|
47
47
|
export declare const HTTP_HEADER_AAD_VERSION: "greatwait.http-header.v1";
|
|
48
|
+
export { mergeStoredHttpHeaders, validScheduleHttp, validStoredHttpHeaders, } from "./stored-http.js";
|
|
48
49
|
export declare const HTTP_TEMPLATE_AAD_VERSION: "greatwait.http-template.v1";
|
|
49
50
|
/**
|
|
50
51
|
* One immutable delivery attempt, minted by the Scheduler Partition from its
|
package/dist/delivery.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export const SCHEDULE_PAYLOAD_AAD_VERSION = "greatwait.schedule-payload.v1";
|
|
10
10
|
export const HTTP_HEADER_AAD_VERSION = "greatwait.http-header.v1";
|
|
11
|
+
export { mergeStoredHttpHeaders, validScheduleHttp, validStoredHttpHeaders, } from "./stored-http.js";
|
|
11
12
|
export const HTTP_TEMPLATE_AAD_VERSION = "greatwait.http-template.v1";
|
|
12
13
|
/**
|
|
13
14
|
* What a receiver says about work it acknowledged and then finished.
|
package/dist/endpoints.js
CHANGED
|
@@ -20,7 +20,7 @@ import { timestampSchema } from "./time.js";
|
|
|
20
20
|
* nothing to prove.
|
|
21
21
|
*/
|
|
22
22
|
export const CALLBACK_ENDPOINT_STATUSES = ["active", "disabled"];
|
|
23
|
-
export const callbackEndpointStatusSchema = z.enum(CALLBACK_ENDPOINT_STATUSES);
|
|
23
|
+
export const callbackEndpointStatusSchema = /* @__PURE__ */ (() => z.enum(CALLBACK_ENDPOINT_STATUSES))();
|
|
24
24
|
/**
|
|
25
25
|
* Why an address could not be resolved or reached: the classification the
|
|
26
26
|
* DNS inspection at create and update, and the delivery egress, share. It
|
|
@@ -37,7 +37,7 @@ export const CALLBACK_EGRESS_FAILURES = [
|
|
|
37
37
|
"timed_out",
|
|
38
38
|
"unexpected_status",
|
|
39
39
|
];
|
|
40
|
-
export const callbackEgressFailureSchema = z.enum(CALLBACK_EGRESS_FAILURES);
|
|
40
|
+
export const callbackEgressFailureSchema = /* @__PURE__ */ (() => z.enum(CALLBACK_EGRESS_FAILURES))();
|
|
41
41
|
/**
|
|
42
42
|
* @deprecated The former retained endpoint count ceiling. W0-15 removes count
|
|
43
43
|
* enforcement after the operator's decision; DNS/mutation admission and paged
|
|
@@ -56,7 +56,7 @@ export const CALLBACK_ADMISSION_RATE_LIMITS = {
|
|
|
56
56
|
};
|
|
57
57
|
/** Longest period during which a receiver may accept current and next keys. */
|
|
58
58
|
export const CALLBACK_SIGNING_KEY_ROTATION_OVERLAP_SECONDS = 86_400;
|
|
59
|
-
export const callbackSigningKeysSchema = z.object({
|
|
59
|
+
export const callbackSigningKeysSchema = /* @__PURE__ */ (() => z.object({
|
|
60
60
|
current: callbackSigningKeyIdSchema,
|
|
61
61
|
next: z
|
|
62
62
|
.object({
|
|
@@ -66,7 +66,7 @@ export const callbackSigningKeysSchema = z.object({
|
|
|
66
66
|
overlapEndsAt: timestampSchema,
|
|
67
67
|
})
|
|
68
68
|
.optional(),
|
|
69
|
-
});
|
|
69
|
+
}))();
|
|
70
70
|
/**
|
|
71
71
|
* An endpoint's name: unique within its project and environment, compared
|
|
72
72
|
* exactly (W4-14, FXO-2255).
|
|
@@ -80,16 +80,16 @@ export const callbackSigningKeysSchema = z.object({
|
|
|
80
80
|
* "Prod receiver" and "prod receiver" are both allowed. Deliberately unlike a
|
|
81
81
|
* project's name, which ignores case and spacing.
|
|
82
82
|
*/
|
|
83
|
-
export const callbackEndpointNameSchema = z
|
|
83
|
+
export const callbackEndpointNameSchema = /* @__PURE__ */ (() => z
|
|
84
84
|
.string()
|
|
85
85
|
.trim()
|
|
86
86
|
.min(1, "must not be blank")
|
|
87
|
-
.max(2_048, "must be at most 2048 characters");
|
|
87
|
+
.max(2_048, "must be at most 2048 characters"))();
|
|
88
88
|
/**
|
|
89
89
|
* A metadata-only endpoint shape. The sealed signing secret has no public
|
|
90
90
|
* field, so list/get/update/disable/enable cannot accidentally recover it.
|
|
91
91
|
*/
|
|
92
|
-
export const callbackEndpointSchema = z.object({
|
|
92
|
+
export const callbackEndpointSchema = /* @__PURE__ */ (() => z.object({
|
|
93
93
|
headers: z.array(publicHttpHeaderSchema).optional(),
|
|
94
94
|
createdAt: timestampSchema,
|
|
95
95
|
disabledAt: timestampSchema.optional(),
|
|
@@ -107,33 +107,33 @@ export const callbackEndpointSchema = z.object({
|
|
|
107
107
|
updatedAt: timestampSchema,
|
|
108
108
|
url: z.string().url(),
|
|
109
109
|
version: z.number().int().positive(),
|
|
110
|
-
});
|
|
111
|
-
export const callbackEndpointPageSchema = pageSchema(callbackEndpointSchema);
|
|
110
|
+
}))();
|
|
111
|
+
export const callbackEndpointPageSchema = /* @__PURE__ */ (() => pageSchema(callbackEndpointSchema))();
|
|
112
112
|
/** The one response that carries the per-endpoint secret. */
|
|
113
|
-
export const callbackEndpointCreatedSchema = callbackEndpointSchema.extend({
|
|
113
|
+
export const callbackEndpointCreatedSchema = /* @__PURE__ */ (() => callbackEndpointSchema.extend({
|
|
114
114
|
keyId: callbackSigningKeyIdSchema,
|
|
115
115
|
secret: z.string().min(1),
|
|
116
116
|
shownOnce: z.literal(true),
|
|
117
|
-
});
|
|
118
|
-
export const callbackSigningKeyRotationRequestSchema = z.object({
|
|
117
|
+
}))();
|
|
118
|
+
export const callbackSigningKeyRotationRequestSchema = /* @__PURE__ */ (() => z.object({
|
|
119
119
|
overlapSeconds: z
|
|
120
120
|
.number()
|
|
121
121
|
.int()
|
|
122
122
|
.min(0)
|
|
123
123
|
.max(CALLBACK_SIGNING_KEY_ROTATION_OVERLAP_SECONDS, "must not exceed the maximum endpoint-key overlap")
|
|
124
124
|
.optional(),
|
|
125
|
-
});
|
|
126
|
-
export const callbackEndpointRotatedSchema = z.object({
|
|
125
|
+
}))();
|
|
126
|
+
export const callbackEndpointRotatedSchema = /* @__PURE__ */ (() => z.object({
|
|
127
127
|
endpoint: callbackEndpointSchema,
|
|
128
128
|
keyId: callbackSigningKeyIdSchema,
|
|
129
129
|
secret: z.string().min(1),
|
|
130
130
|
shownOnce: z.literal(true),
|
|
131
|
-
});
|
|
131
|
+
}))();
|
|
132
132
|
/** One signing key and the secret behind it, as a signed-in person may see it. */
|
|
133
|
-
export const callbackEndpointSigningSecretSchema = z.object({
|
|
133
|
+
export const callbackEndpointSigningSecretSchema = /* @__PURE__ */ (() => z.object({
|
|
134
134
|
keyId: callbackSigningKeyIdSchema,
|
|
135
135
|
secret: z.string().min(1),
|
|
136
|
-
});
|
|
136
|
+
}))();
|
|
137
137
|
/**
|
|
138
138
|
* What `endpoints.revealSigningSecret` answers (FXO-2244).
|
|
139
139
|
*
|
|
@@ -142,14 +142,14 @@ export const callbackEndpointSigningSecretSchema = z.object({
|
|
|
142
142
|
* rotation both keys are here, with the instant the overlap ends, because a
|
|
143
143
|
* receiver being moved to the new key needs both until then.
|
|
144
144
|
*/
|
|
145
|
-
export const callbackEndpointSigningSecretsSchema = z.object({
|
|
145
|
+
export const callbackEndpointSigningSecretsSchema = /* @__PURE__ */ (() => z.object({
|
|
146
146
|
current: callbackEndpointSigningSecretSchema,
|
|
147
147
|
/** The endpoint these belong to, so an answer names what it is about. */
|
|
148
148
|
id: endpointIdSchema,
|
|
149
149
|
next: callbackEndpointSigningSecretSchema
|
|
150
150
|
.extend({ overlapEndsAt: timestampSchema })
|
|
151
151
|
.optional(),
|
|
152
|
-
});
|
|
152
|
+
}))();
|
|
153
153
|
/**
|
|
154
154
|
* Where an endpoint's signing secret is, for a result that does not carry it
|
|
155
155
|
* (W9-44, FXO-2907).
|
|
@@ -166,7 +166,7 @@ export const callbackEndpointSigningSecretsSchema = z.object({
|
|
|
166
166
|
* reader deciding whether it holds a secret should be told so, not left to
|
|
167
167
|
* infer it from what is missing.
|
|
168
168
|
*/
|
|
169
|
-
export const signingSecretNoticeSchema = z.object({
|
|
169
|
+
export const signingSecretNoticeSchema = /* @__PURE__ */ (() => z.object({
|
|
170
170
|
/** One sentence an agent can relay to the person it is working for. */
|
|
171
171
|
guidance: z.string().min(1),
|
|
172
172
|
/** Never `true`: these results do not carry the secret. */
|
|
@@ -176,7 +176,7 @@ export const signingSecretNoticeSchema = z.object({
|
|
|
176
176
|
* reveals the secret. Absent only where this deployment has no dashboard.
|
|
177
177
|
*/
|
|
178
178
|
revealUrl: z.string().url().optional(),
|
|
179
|
-
});
|
|
179
|
+
}))();
|
|
180
180
|
/**
|
|
181
181
|
* The dashboard path of one endpoint's page, beneath the project and
|
|
182
182
|
* environment it belongs to. The dashboard's router serves it; a test there
|
|
@@ -208,11 +208,11 @@ export function signingSecretNotice(target, dashboardOrigin) {
|
|
|
208
208
|
* Metadata only, like every endpoint read. There is no `secret` field to fill
|
|
209
209
|
* by mistake; the shape is what keeps it out of an agent's history.
|
|
210
210
|
*/
|
|
211
|
-
export const callbackEndpointEnsuredSchema = callbackEndpointSchema.extend({
|
|
211
|
+
export const callbackEndpointEnsuredSchema = /* @__PURE__ */ (() => callbackEndpointSchema.extend({
|
|
212
212
|
/** Whether this call created the endpoint, or found one already there. */
|
|
213
213
|
created: z.boolean(),
|
|
214
214
|
signingSecret: signingSecretNoticeSchema,
|
|
215
|
-
});
|
|
215
|
+
}))();
|
|
216
216
|
/**
|
|
217
217
|
* A callback destination as a caller types it: HTTPS on port 443, no
|
|
218
218
|
* credentials or fragment, a public name or address. The DNS half of the
|
|
@@ -233,7 +233,7 @@ export function callbackUrlSchema() {
|
|
|
233
233
|
}
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
|
-
export const callbackEndpointRequestSchema = z.object({
|
|
236
|
+
export const callbackEndpointRequestSchema = /* @__PURE__ */ (() => z.object({
|
|
237
237
|
headers: endpointHeaderChangesSchema.optional(),
|
|
238
238
|
/**
|
|
239
239
|
* A name for people (W4-14, FXO-2255). Omitted on a create, the endpoint
|
|
@@ -243,4 +243,4 @@ export const callbackEndpointRequestSchema = z.object({
|
|
|
243
243
|
*/
|
|
244
244
|
name: callbackEndpointNameSchema.optional(),
|
|
245
245
|
url: callbackUrlSchema(),
|
|
246
|
-
});
|
|
246
|
+
}))();
|