@aeolus-fleet/common 0.31.0 → 0.32.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/fleet/index.d.ts +29 -6
- package/dist/fleet/index.js +27 -4
- package/dist/fleet/index.js.map +1 -1
- package/dist/ids/index.d.ts +3 -0
- package/dist/ids/index.js +2 -0
- package/dist/ids/index.js.map +1 -1
- package/dist/rules/duration.d.ts +2 -0
- package/dist/rules/duration.js +22 -0
- package/dist/rules/duration.js.map +1 -0
- package/dist/rules/index.d.ts +1 -0
- package/dist/rules/index.js +1 -0
- package/dist/rules/index.js.map +1 -1
- package/dist/schemas/apps-list.d.ts +4 -4
- package/dist/schemas/console.d.ts +3 -25
- package/dist/schemas/console.js +4 -3
- package/dist/schemas/console.js.map +1 -1
- package/dist/schemas/delivery.d.ts +26 -5
- package/dist/schemas/delivery.js +19 -7
- package/dist/schemas/delivery.js.map +1 -1
- package/dist/schemas/fleet.d.ts +36 -2
- package/dist/schemas/fleet.js +9 -2
- package/dist/schemas/fleet.js.map +1 -1
- package/dist/schemas/follow.d.ts +11 -0
- package/dist/schemas/history.d.ts +138 -2
- package/dist/schemas/history.js +25 -2
- package/dist/schemas/history.js.map +1 -1
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/installation.d.ts +118 -4
- package/dist/schemas/installation.js +34 -5
- package/dist/schemas/installation.js.map +1 -1
- package/dist/schemas/label.d.ts +4 -4
- package/dist/schemas/message.d.ts +38 -2
- package/dist/schemas/message.js +34 -5
- package/dist/schemas/message.js.map +1 -1
- package/dist/schemas/needs-attention.d.ts +14 -0
- package/dist/schemas/schedule.d.ts +372 -0
- package/dist/schemas/schedule.js +132 -0
- package/dist/schemas/schedule.js.map +1 -0
- package/dist/schemas/scopes.d.ts +29 -3
- package/dist/schemas/scopes.js +17 -3
- package/dist/schemas/scopes.js.map +1 -1
- package/dist/schemas/ship.js +1 -1
- package/dist/schemas/statement.d.ts +5 -0
- package/dist/schemas/statement.js +3 -1
- package/dist/schemas/statement.js.map +1 -1
- package/dist/trierarch/report-details.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Inputs and outputs of scheduled messages (decision 0062): making a schedule
|
|
4
|
+
* (`ship.schedule`), listing a ship's schedules (`ship.schedules`,
|
|
5
|
+
* `fleet.schedules`), pausing one (`ship.pauseSchedule`,
|
|
6
|
+
* `fleet.pauseSchedule`), resuming one (`ship.resumeSchedule`) and cancelling
|
|
7
|
+
* one (`ship.cancelSchedule`, `fleet.cancelSchedule`).
|
|
8
|
+
*/
|
|
9
|
+
export { durationMs } from '../rules/duration.js';
|
|
10
|
+
/** The prefix of the idempotency key of every message a schedule sends: no live send may use it. */
|
|
11
|
+
export declare const SCHEDULE_IDEMPOTENCY_KEY_PREFIX = "schedule:";
|
|
12
|
+
/** A schedule's state: it sends while active, and an ended or cancelled one never sends again. */
|
|
13
|
+
export declare const SCHEDULE_STATES: readonly ["active", "paused", "ended", "cancelled"];
|
|
14
|
+
export declare const scheduleStateSchema: z.ZodEnum<{
|
|
15
|
+
active: "active";
|
|
16
|
+
paused: "paused";
|
|
17
|
+
ended: "ended";
|
|
18
|
+
cancelled: "cancelled";
|
|
19
|
+
}>;
|
|
20
|
+
export type ScheduleState = z.infer<typeof scheduleStateSchema>;
|
|
21
|
+
/** What a refused send time does, the creator's choice (S7): record it and go on, try again within the retry window, or pause. */
|
|
22
|
+
export declare const REFUSAL_STRATEGIES: readonly ["skip", "retry", "pause"];
|
|
23
|
+
export declare const refusalStrategySchema: z.ZodEnum<{
|
|
24
|
+
skip: "skip";
|
|
25
|
+
retry: "retry";
|
|
26
|
+
pause: "pause";
|
|
27
|
+
}>;
|
|
28
|
+
export type RefusalStrategy = z.infer<typeof refusalStrategySchema>;
|
|
29
|
+
/** What a send time the pass reaches later than its grace does, the creator's choice (S6): send every missed one, the latest only, or none. */
|
|
30
|
+
export declare const MISSED_STRATEGIES: readonly ["each", "once", "skip"];
|
|
31
|
+
export declare const missedStrategySchema: z.ZodEnum<{
|
|
32
|
+
skip: "skip";
|
|
33
|
+
each: "each";
|
|
34
|
+
once: "once";
|
|
35
|
+
}>;
|
|
36
|
+
export type MissedStrategy = z.infer<typeof missedStrategySchema>;
|
|
37
|
+
/** An ISO 8601 duration of a fixed length, such as PT30M or P1D. */
|
|
38
|
+
export declare const durationSchema: z.ZodString;
|
|
39
|
+
/**
|
|
40
|
+
* When a schedule sends (S1): once, at an instant with its offset; every an
|
|
41
|
+
* ISO 8601 duration of a fixed length; or at the wall times of a cron of five
|
|
42
|
+
* fields in an IANA time zone, UTC unless given. A repeat takes an optional
|
|
43
|
+
* start, end and count, either of the last two ending it.
|
|
44
|
+
*/
|
|
45
|
+
export declare const scheduleTimingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
46
|
+
kind: z.ZodLiteral<"once">;
|
|
47
|
+
at: z.ZodISODateTime;
|
|
48
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
49
|
+
start: z.ZodOptional<z.ZodISODateTime>;
|
|
50
|
+
end: z.ZodOptional<z.ZodISODateTime>;
|
|
51
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
kind: z.ZodLiteral<"every">;
|
|
53
|
+
every: z.ZodString;
|
|
54
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
55
|
+
start: z.ZodOptional<z.ZodISODateTime>;
|
|
56
|
+
end: z.ZodOptional<z.ZodISODateTime>;
|
|
57
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
kind: z.ZodLiteral<"cron">;
|
|
59
|
+
cron: z.ZodString;
|
|
60
|
+
timeZone: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$strict>], "kind">;
|
|
62
|
+
export type ScheduleTiming = z.infer<typeof scheduleTimingSchema>;
|
|
63
|
+
/**
|
|
64
|
+
* Input of `ship.schedule` (messages:send, and messages:force when forced): a
|
|
65
|
+
* whole send input, stored as given, the model the ship states, the timing,
|
|
66
|
+
* what a refused send time does and the ship's idempotency key.
|
|
67
|
+
*/
|
|
68
|
+
export declare const scheduleInputSchema: z.ZodObject<{
|
|
69
|
+
selector: z.ZodUnion<readonly [z.ZodObject<{
|
|
70
|
+
kind: z.ZodLiteral<"ship">;
|
|
71
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
72
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
73
|
+
kind: z.ZodLiteral<"ship">;
|
|
74
|
+
name: z.ZodString;
|
|
75
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
76
|
+
kind: z.ZodLiteral<"type">;
|
|
77
|
+
type: z.ZodString;
|
|
78
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
79
|
+
kind: z.ZodLiteral<"label">;
|
|
80
|
+
valueIds: z.ZodArray<z.ZodType<`lbv_${string}`, unknown, z.core.$ZodTypeInternals<`lbv_${string}`, unknown>>>;
|
|
81
|
+
}, z.core.$strict>]>;
|
|
82
|
+
payload: z.ZodString;
|
|
83
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
84
|
+
model: z.ZodOptional<z.ZodString>;
|
|
85
|
+
idempotencyKey: z.ZodString;
|
|
86
|
+
inReplyTo: z.ZodOptional<z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>>;
|
|
87
|
+
isForced: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
timing: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
89
|
+
kind: z.ZodLiteral<"once">;
|
|
90
|
+
at: z.ZodISODateTime;
|
|
91
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
92
|
+
start: z.ZodOptional<z.ZodISODateTime>;
|
|
93
|
+
end: z.ZodOptional<z.ZodISODateTime>;
|
|
94
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
kind: z.ZodLiteral<"every">;
|
|
96
|
+
every: z.ZodString;
|
|
97
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
98
|
+
start: z.ZodOptional<z.ZodISODateTime>;
|
|
99
|
+
end: z.ZodOptional<z.ZodISODateTime>;
|
|
100
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
kind: z.ZodLiteral<"cron">;
|
|
102
|
+
cron: z.ZodString;
|
|
103
|
+
timeZone: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strict>], "kind">;
|
|
105
|
+
onRefused: z.ZodOptional<z.ZodEnum<{
|
|
106
|
+
skip: "skip";
|
|
107
|
+
retry: "retry";
|
|
108
|
+
pause: "pause";
|
|
109
|
+
}>>;
|
|
110
|
+
retryWindow: z.ZodOptional<z.ZodString>;
|
|
111
|
+
onMissed: z.ZodOptional<z.ZodEnum<{
|
|
112
|
+
skip: "skip";
|
|
113
|
+
each: "each";
|
|
114
|
+
once: "once";
|
|
115
|
+
}>>;
|
|
116
|
+
grace: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
export type ScheduleInput = z.infer<typeof scheduleInputSchema>;
|
|
119
|
+
/** Output of `ship.schedule`: the schedule's id, the original one when the key was used before. */
|
|
120
|
+
export declare const scheduleOutputSchema: z.ZodObject<{
|
|
121
|
+
scheduleId: z.ZodType<`sch_${string}`, unknown, z.core.$ZodTypeInternals<`sch_${string}`, unknown>>;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
/** A send time's outcome: the message it stored, the code it was refused with, or missed. */
|
|
124
|
+
export declare const scheduleOutcomeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
125
|
+
kind: z.ZodLiteral<"sent">;
|
|
126
|
+
messageId: z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>;
|
|
127
|
+
sendTime: z.ZodISODateTime;
|
|
128
|
+
at: z.ZodISODateTime;
|
|
129
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
130
|
+
kind: z.ZodLiteral<"refused">;
|
|
131
|
+
code: z.ZodString;
|
|
132
|
+
sendTime: z.ZodISODateTime;
|
|
133
|
+
at: z.ZodISODateTime;
|
|
134
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
135
|
+
kind: z.ZodLiteral<"missed">;
|
|
136
|
+
sendTime: z.ZodISODateTime;
|
|
137
|
+
at: z.ZodISODateTime;
|
|
138
|
+
}, z.core.$strip>], "kind">;
|
|
139
|
+
/** A schedule's timing as stored, its defaults filled in. */
|
|
140
|
+
export declare const scheduleTimingItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
141
|
+
kind: z.ZodLiteral<"once">;
|
|
142
|
+
at: z.ZodISODateTime;
|
|
143
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
144
|
+
start: z.ZodNullable<z.ZodISODateTime>;
|
|
145
|
+
end: z.ZodNullable<z.ZodISODateTime>;
|
|
146
|
+
count: z.ZodNullable<z.ZodNumber>;
|
|
147
|
+
kind: z.ZodLiteral<"every">;
|
|
148
|
+
every: z.ZodString;
|
|
149
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
150
|
+
start: z.ZodNullable<z.ZodISODateTime>;
|
|
151
|
+
end: z.ZodNullable<z.ZodISODateTime>;
|
|
152
|
+
count: z.ZodNullable<z.ZodNumber>;
|
|
153
|
+
kind: z.ZodLiteral<"cron">;
|
|
154
|
+
cron: z.ZodString;
|
|
155
|
+
timeZone: z.ZodString;
|
|
156
|
+
}, z.core.$strip>], "kind">;
|
|
157
|
+
export type ScheduleTimingItem = z.infer<typeof scheduleTimingItemSchema>;
|
|
158
|
+
/** One schedule as a list shows it: its send input but the payload, its timing and strategies, its state, next send time and last outcome. */
|
|
159
|
+
export declare const scheduleItemSchema: z.ZodObject<{
|
|
160
|
+
scheduleId: z.ZodType<`sch_${string}`, unknown, z.core.$ZodTypeInternals<`sch_${string}`, unknown>>;
|
|
161
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
162
|
+
state: z.ZodEnum<{
|
|
163
|
+
active: "active";
|
|
164
|
+
paused: "paused";
|
|
165
|
+
ended: "ended";
|
|
166
|
+
cancelled: "cancelled";
|
|
167
|
+
}>;
|
|
168
|
+
selector: z.ZodUnion<readonly [z.ZodObject<{
|
|
169
|
+
kind: z.ZodLiteral<"ship">;
|
|
170
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
171
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
172
|
+
kind: z.ZodLiteral<"ship">;
|
|
173
|
+
name: z.ZodString;
|
|
174
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
175
|
+
kind: z.ZodLiteral<"type">;
|
|
176
|
+
type: z.ZodString;
|
|
177
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
178
|
+
kind: z.ZodLiteral<"label">;
|
|
179
|
+
valueIds: z.ZodArray<z.ZodType<`lbv_${string}`, unknown, z.core.$ZodTypeInternals<`lbv_${string}`, unknown>>>;
|
|
180
|
+
values: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
181
|
+
valueId: z.ZodType<`lbv_${string}`, unknown, z.core.$ZodTypeInternals<`lbv_${string}`, unknown>>;
|
|
182
|
+
key: z.ZodNullable<z.ZodString>;
|
|
183
|
+
value: z.ZodNullable<z.ZodString>;
|
|
184
|
+
}, z.core.$strip>>>;
|
|
185
|
+
}, z.core.$strip>]>;
|
|
186
|
+
contentType: z.ZodString;
|
|
187
|
+
inReplyTo: z.ZodNullable<z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>>;
|
|
188
|
+
isForced: z.ZodBoolean;
|
|
189
|
+
timing: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
190
|
+
kind: z.ZodLiteral<"once">;
|
|
191
|
+
at: z.ZodISODateTime;
|
|
192
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
193
|
+
start: z.ZodNullable<z.ZodISODateTime>;
|
|
194
|
+
end: z.ZodNullable<z.ZodISODateTime>;
|
|
195
|
+
count: z.ZodNullable<z.ZodNumber>;
|
|
196
|
+
kind: z.ZodLiteral<"every">;
|
|
197
|
+
every: z.ZodString;
|
|
198
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
199
|
+
start: z.ZodNullable<z.ZodISODateTime>;
|
|
200
|
+
end: z.ZodNullable<z.ZodISODateTime>;
|
|
201
|
+
count: z.ZodNullable<z.ZodNumber>;
|
|
202
|
+
kind: z.ZodLiteral<"cron">;
|
|
203
|
+
cron: z.ZodString;
|
|
204
|
+
timeZone: z.ZodString;
|
|
205
|
+
}, z.core.$strip>], "kind">;
|
|
206
|
+
onRefused: z.ZodEnum<{
|
|
207
|
+
skip: "skip";
|
|
208
|
+
retry: "retry";
|
|
209
|
+
pause: "pause";
|
|
210
|
+
}>;
|
|
211
|
+
retryWindow: z.ZodString;
|
|
212
|
+
onMissed: z.ZodEnum<{
|
|
213
|
+
skip: "skip";
|
|
214
|
+
each: "each";
|
|
215
|
+
once: "once";
|
|
216
|
+
}>;
|
|
217
|
+
grace: z.ZodString;
|
|
218
|
+
nextSendTime: z.ZodNullable<z.ZodISODateTime>;
|
|
219
|
+
lastOutcome: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
220
|
+
kind: z.ZodLiteral<"sent">;
|
|
221
|
+
messageId: z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>;
|
|
222
|
+
sendTime: z.ZodISODateTime;
|
|
223
|
+
at: z.ZodISODateTime;
|
|
224
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
225
|
+
kind: z.ZodLiteral<"refused">;
|
|
226
|
+
code: z.ZodString;
|
|
227
|
+
sendTime: z.ZodISODateTime;
|
|
228
|
+
at: z.ZodISODateTime;
|
|
229
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
230
|
+
kind: z.ZodLiteral<"missed">;
|
|
231
|
+
sendTime: z.ZodISODateTime;
|
|
232
|
+
at: z.ZodISODateTime;
|
|
233
|
+
}, z.core.$strip>], "kind">>;
|
|
234
|
+
createdAt: z.ZodISODateTime;
|
|
235
|
+
endedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
236
|
+
cancelledAt: z.ZodNullable<z.ZodISODateTime>;
|
|
237
|
+
}, z.core.$strip>;
|
|
238
|
+
export type ScheduleItem = z.infer<typeof scheduleItemSchema>;
|
|
239
|
+
/** Input of `ship.schedules`: a page, newest first; active and paused ones unless `states` names others. */
|
|
240
|
+
export declare const schedulesInputSchema: z.ZodObject<{
|
|
241
|
+
cursor: z.ZodOptional<z.ZodType<`sch_${string}`, unknown, z.core.$ZodTypeInternals<`sch_${string}`, unknown>>>;
|
|
242
|
+
limit: z.ZodOptional<z.ZodInt>;
|
|
243
|
+
states: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
244
|
+
active: "active";
|
|
245
|
+
paused: "paused";
|
|
246
|
+
ended: "ended";
|
|
247
|
+
cancelled: "cancelled";
|
|
248
|
+
}>>>;
|
|
249
|
+
}, z.core.$strip>;
|
|
250
|
+
export type SchedulesInput = z.infer<typeof schedulesInputSchema>;
|
|
251
|
+
/** Input of `fleet.schedules` (fleet:manage): the ship whose schedules to list, as `ship.schedules` lists them. */
|
|
252
|
+
export declare const fleetSchedulesInputSchema: z.ZodObject<{
|
|
253
|
+
cursor: z.ZodOptional<z.ZodType<`sch_${string}`, unknown, z.core.$ZodTypeInternals<`sch_${string}`, unknown>>>;
|
|
254
|
+
limit: z.ZodOptional<z.ZodInt>;
|
|
255
|
+
states: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
256
|
+
active: "active";
|
|
257
|
+
paused: "paused";
|
|
258
|
+
ended: "ended";
|
|
259
|
+
cancelled: "cancelled";
|
|
260
|
+
}>>>;
|
|
261
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
262
|
+
}, z.core.$strip>;
|
|
263
|
+
export declare const schedulesOutputSchema: z.ZodObject<{
|
|
264
|
+
items: z.ZodArray<z.ZodObject<{
|
|
265
|
+
scheduleId: z.ZodType<`sch_${string}`, unknown, z.core.$ZodTypeInternals<`sch_${string}`, unknown>>;
|
|
266
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
267
|
+
state: z.ZodEnum<{
|
|
268
|
+
active: "active";
|
|
269
|
+
paused: "paused";
|
|
270
|
+
ended: "ended";
|
|
271
|
+
cancelled: "cancelled";
|
|
272
|
+
}>;
|
|
273
|
+
selector: z.ZodUnion<readonly [z.ZodObject<{
|
|
274
|
+
kind: z.ZodLiteral<"ship">;
|
|
275
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
276
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
277
|
+
kind: z.ZodLiteral<"ship">;
|
|
278
|
+
name: z.ZodString;
|
|
279
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
280
|
+
kind: z.ZodLiteral<"type">;
|
|
281
|
+
type: z.ZodString;
|
|
282
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
283
|
+
kind: z.ZodLiteral<"label">;
|
|
284
|
+
valueIds: z.ZodArray<z.ZodType<`lbv_${string}`, unknown, z.core.$ZodTypeInternals<`lbv_${string}`, unknown>>>;
|
|
285
|
+
values: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
286
|
+
valueId: z.ZodType<`lbv_${string}`, unknown, z.core.$ZodTypeInternals<`lbv_${string}`, unknown>>;
|
|
287
|
+
key: z.ZodNullable<z.ZodString>;
|
|
288
|
+
value: z.ZodNullable<z.ZodString>;
|
|
289
|
+
}, z.core.$strip>>>;
|
|
290
|
+
}, z.core.$strip>]>;
|
|
291
|
+
contentType: z.ZodString;
|
|
292
|
+
inReplyTo: z.ZodNullable<z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>>;
|
|
293
|
+
isForced: z.ZodBoolean;
|
|
294
|
+
timing: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
295
|
+
kind: z.ZodLiteral<"once">;
|
|
296
|
+
at: z.ZodISODateTime;
|
|
297
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
298
|
+
start: z.ZodNullable<z.ZodISODateTime>;
|
|
299
|
+
end: z.ZodNullable<z.ZodISODateTime>;
|
|
300
|
+
count: z.ZodNullable<z.ZodNumber>;
|
|
301
|
+
kind: z.ZodLiteral<"every">;
|
|
302
|
+
every: z.ZodString;
|
|
303
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
304
|
+
start: z.ZodNullable<z.ZodISODateTime>;
|
|
305
|
+
end: z.ZodNullable<z.ZodISODateTime>;
|
|
306
|
+
count: z.ZodNullable<z.ZodNumber>;
|
|
307
|
+
kind: z.ZodLiteral<"cron">;
|
|
308
|
+
cron: z.ZodString;
|
|
309
|
+
timeZone: z.ZodString;
|
|
310
|
+
}, z.core.$strip>], "kind">;
|
|
311
|
+
onRefused: z.ZodEnum<{
|
|
312
|
+
skip: "skip";
|
|
313
|
+
retry: "retry";
|
|
314
|
+
pause: "pause";
|
|
315
|
+
}>;
|
|
316
|
+
retryWindow: z.ZodString;
|
|
317
|
+
onMissed: z.ZodEnum<{
|
|
318
|
+
skip: "skip";
|
|
319
|
+
each: "each";
|
|
320
|
+
once: "once";
|
|
321
|
+
}>;
|
|
322
|
+
grace: z.ZodString;
|
|
323
|
+
nextSendTime: z.ZodNullable<z.ZodISODateTime>;
|
|
324
|
+
lastOutcome: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
325
|
+
kind: z.ZodLiteral<"sent">;
|
|
326
|
+
messageId: z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>;
|
|
327
|
+
sendTime: z.ZodISODateTime;
|
|
328
|
+
at: z.ZodISODateTime;
|
|
329
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
330
|
+
kind: z.ZodLiteral<"refused">;
|
|
331
|
+
code: z.ZodString;
|
|
332
|
+
sendTime: z.ZodISODateTime;
|
|
333
|
+
at: z.ZodISODateTime;
|
|
334
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
335
|
+
kind: z.ZodLiteral<"missed">;
|
|
336
|
+
sendTime: z.ZodISODateTime;
|
|
337
|
+
at: z.ZodISODateTime;
|
|
338
|
+
}, z.core.$strip>], "kind">>;
|
|
339
|
+
createdAt: z.ZodISODateTime;
|
|
340
|
+
endedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
341
|
+
cancelledAt: z.ZodNullable<z.ZodISODateTime>;
|
|
342
|
+
}, z.core.$strip>>;
|
|
343
|
+
nextCursor: z.ZodNullable<z.ZodType<`sch_${string}`, unknown, z.core.$ZodTypeInternals<`sch_${string}`, unknown>>>;
|
|
344
|
+
}, z.core.$strip>;
|
|
345
|
+
/** Input of `ship.pauseSchedule` and `fleet.pauseSchedule`. */
|
|
346
|
+
export declare const pauseScheduleInputSchema: z.ZodObject<{
|
|
347
|
+
scheduleId: z.ZodType<`sch_${string}`, unknown, z.core.$ZodTypeInternals<`sch_${string}`, unknown>>;
|
|
348
|
+
}, z.core.$strip>;
|
|
349
|
+
export declare const pauseScheduleOutputSchema: z.ZodObject<{
|
|
350
|
+
scheduleId: z.ZodType<`sch_${string}`, unknown, z.core.$ZodTypeInternals<`sch_${string}`, unknown>>;
|
|
351
|
+
state: z.ZodLiteral<"paused">;
|
|
352
|
+
}, z.core.$strip>;
|
|
353
|
+
/** Input of `ship.resumeSchedule`. */
|
|
354
|
+
export declare const resumeScheduleInputSchema: z.ZodObject<{
|
|
355
|
+
scheduleId: z.ZodType<`sch_${string}`, unknown, z.core.$ZodTypeInternals<`sch_${string}`, unknown>>;
|
|
356
|
+
}, z.core.$strip>;
|
|
357
|
+
/** Active again, or ended when no send time is left after now. */
|
|
358
|
+
export declare const resumeScheduleOutputSchema: z.ZodObject<{
|
|
359
|
+
scheduleId: z.ZodType<`sch_${string}`, unknown, z.core.$ZodTypeInternals<`sch_${string}`, unknown>>;
|
|
360
|
+
state: z.ZodEnum<{
|
|
361
|
+
active: "active";
|
|
362
|
+
ended: "ended";
|
|
363
|
+
}>;
|
|
364
|
+
}, z.core.$strip>;
|
|
365
|
+
/** Input of `ship.cancelSchedule` and `fleet.cancelSchedule`. */
|
|
366
|
+
export declare const cancelScheduleInputSchema: z.ZodObject<{
|
|
367
|
+
scheduleId: z.ZodType<`sch_${string}`, unknown, z.core.$ZodTypeInternals<`sch_${string}`, unknown>>;
|
|
368
|
+
}, z.core.$strip>;
|
|
369
|
+
export declare const cancelScheduleOutputSchema: z.ZodObject<{
|
|
370
|
+
scheduleId: z.ZodType<`sch_${string}`, unknown, z.core.$ZodTypeInternals<`sch_${string}`, unknown>>;
|
|
371
|
+
state: z.ZodLiteral<"cancelled">;
|
|
372
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { idSchema } from '../ids/index.js';
|
|
3
|
+
import { durationMs } from '../rules/duration.js';
|
|
4
|
+
import { idempotencyKeySchema } from './idempotency-key.js';
|
|
5
|
+
import { labelValueTextSchema } from './history.js';
|
|
6
|
+
import { contentTypeSchema, modelSchema, payloadSchema, scheduleSelectorSchema } from './message.js';
|
|
7
|
+
import { pageInputOf, pageOutputOf } from './page.js';
|
|
8
|
+
/**
|
|
9
|
+
* Inputs and outputs of scheduled messages (decision 0062): making a schedule
|
|
10
|
+
* (`ship.schedule`), listing a ship's schedules (`ship.schedules`,
|
|
11
|
+
* `fleet.schedules`), pausing one (`ship.pauseSchedule`,
|
|
12
|
+
* `fleet.pauseSchedule`), resuming one (`ship.resumeSchedule`) and cancelling
|
|
13
|
+
* one (`ship.cancelSchedule`, `fleet.cancelSchedule`).
|
|
14
|
+
*/
|
|
15
|
+
export { durationMs } from '../rules/duration.js';
|
|
16
|
+
/** ISO 8601 in UTC. */
|
|
17
|
+
const isoTime = z.iso.datetime();
|
|
18
|
+
/** The prefix of the idempotency key of every message a schedule sends: no live send may use it. */
|
|
19
|
+
export const SCHEDULE_IDEMPOTENCY_KEY_PREFIX = 'schedule:';
|
|
20
|
+
/** A schedule's state: it sends while active, and an ended or cancelled one never sends again. */
|
|
21
|
+
export const SCHEDULE_STATES = ['active', 'paused', 'ended', 'cancelled'];
|
|
22
|
+
export const scheduleStateSchema = z.enum(SCHEDULE_STATES);
|
|
23
|
+
/** What a refused send time does, the creator's choice (S7): record it and go on, try again within the retry window, or pause. */
|
|
24
|
+
export const REFUSAL_STRATEGIES = ['skip', 'retry', 'pause'];
|
|
25
|
+
export const refusalStrategySchema = z.enum(REFUSAL_STRATEGIES);
|
|
26
|
+
/** What a send time the pass reaches later than its grace does, the creator's choice (S6): send every missed one, the latest only, or none. */
|
|
27
|
+
export const MISSED_STRATEGIES = ['each', 'once', 'skip'];
|
|
28
|
+
export const missedStrategySchema = z.enum(MISSED_STRATEGIES);
|
|
29
|
+
/** An ISO 8601 duration of a fixed length, such as PT30M or P1D. */
|
|
30
|
+
export const durationSchema = z.string().refine((text) => durationMs(text) !== undefined, 'A duration is ISO 8601 of weeks, or days, hours, minutes and seconds, such as PT30M or P1D');
|
|
31
|
+
/** An instant with its offset. */
|
|
32
|
+
const instant = z.iso.datetime({ offset: true });
|
|
33
|
+
/** A repeat's bounds (S1): its first send time at or after start, its last at or before end, and at most count sends. */
|
|
34
|
+
const repeatBounds = { start: instant.optional(), end: instant.optional(), count: z.number().int().optional() };
|
|
35
|
+
/**
|
|
36
|
+
* When a schedule sends (S1): once, at an instant with its offset; every an
|
|
37
|
+
* ISO 8601 duration of a fixed length; or at the wall times of a cron of five
|
|
38
|
+
* fields in an IANA time zone, UTC unless given. A repeat takes an optional
|
|
39
|
+
* start, end and count, either of the last two ending it.
|
|
40
|
+
*/
|
|
41
|
+
export const scheduleTimingSchema = z.discriminatedUnion('kind', [
|
|
42
|
+
z.strictObject({ kind: z.literal('once'), at: instant }),
|
|
43
|
+
z.strictObject({ kind: z.literal('every'), every: z.string(), ...repeatBounds }),
|
|
44
|
+
z.strictObject({ kind: z.literal('cron'), cron: z.string(), timeZone: z.string().optional(), ...repeatBounds }),
|
|
45
|
+
]);
|
|
46
|
+
/**
|
|
47
|
+
* Input of `ship.schedule` (messages:send, and messages:force when forced): a
|
|
48
|
+
* whole send input, stored as given, the model the ship states, the timing,
|
|
49
|
+
* what a refused send time does and the ship's idempotency key.
|
|
50
|
+
*/
|
|
51
|
+
export const scheduleInputSchema = z.object({
|
|
52
|
+
selector: scheduleSelectorSchema,
|
|
53
|
+
payload: payloadSchema,
|
|
54
|
+
/** Without it, the payload is text/plain. */
|
|
55
|
+
contentType: contentTypeSchema.optional(),
|
|
56
|
+
model: modelSchema.optional(),
|
|
57
|
+
idempotencyKey: idempotencyKeySchema,
|
|
58
|
+
inReplyTo: idSchema('message').optional(),
|
|
59
|
+
isForced: z.boolean().optional(),
|
|
60
|
+
timing: scheduleTimingSchema,
|
|
61
|
+
/** skip unless given. */
|
|
62
|
+
onRefused: refusalStrategySchema.optional(),
|
|
63
|
+
/** How long after its send time a refused send is tried again under retry; PT1H unless given. */
|
|
64
|
+
retryWindow: durationSchema.optional(),
|
|
65
|
+
/** each unless given. */
|
|
66
|
+
onMissed: missedStrategySchema.optional(),
|
|
67
|
+
/** How late a pass may reach a send time before it is missed; PT5M unless given. */
|
|
68
|
+
grace: durationSchema.optional(),
|
|
69
|
+
});
|
|
70
|
+
/** Output of `ship.schedule`: the schedule's id, the original one when the key was used before. */
|
|
71
|
+
export const scheduleOutputSchema = z.object({ scheduleId: idSchema('schedule') });
|
|
72
|
+
/** A send time's outcome: the message it stored, the code it was refused with, or missed. */
|
|
73
|
+
export const scheduleOutcomeSchema = z.discriminatedUnion('kind', [
|
|
74
|
+
z.object({ kind: z.literal('sent'), messageId: idSchema('message'), sendTime: isoTime, at: isoTime }),
|
|
75
|
+
z.object({ kind: z.literal('refused'), code: z.string(), sendTime: isoTime, at: isoTime }),
|
|
76
|
+
z.object({ kind: z.literal('missed'), sendTime: isoTime, at: isoTime }),
|
|
77
|
+
]);
|
|
78
|
+
const storedRepeatBounds = { start: isoTime.nullable(), end: isoTime.nullable(), count: z.number().int().nullable() };
|
|
79
|
+
/** A schedule's timing as stored, its defaults filled in. */
|
|
80
|
+
export const scheduleTimingItemSchema = z.discriminatedUnion('kind', [
|
|
81
|
+
z.object({ kind: z.literal('once'), at: isoTime }),
|
|
82
|
+
z.object({ kind: z.literal('every'), every: z.string(), ...storedRepeatBounds }),
|
|
83
|
+
z.object({ kind: z.literal('cron'), cron: z.string(), timeZone: z.string(), ...storedRepeatBounds }),
|
|
84
|
+
]);
|
|
85
|
+
/**
|
|
86
|
+
* What a schedule sends to, as a list shows it: as the creator gave it, a
|
|
87
|
+
* label selection with each value by its texts for a caller holding
|
|
88
|
+
* fleet:read (decision 0065, R10).
|
|
89
|
+
*/
|
|
90
|
+
const scheduleItemSelectorSchema = z.union([
|
|
91
|
+
z.object({ kind: z.literal('ship'), shipId: idSchema('ship') }),
|
|
92
|
+
z.object({ kind: z.literal('ship'), name: z.string() }),
|
|
93
|
+
z.object({ kind: z.literal('type'), type: z.string() }),
|
|
94
|
+
z.object({ kind: z.literal('label'), valueIds: z.array(idSchema('labelValue')), values: z.array(labelValueTextSchema).optional() }),
|
|
95
|
+
]);
|
|
96
|
+
/** One schedule as a list shows it: its send input but the payload, its timing and strategies, its state, next send time and last outcome. */
|
|
97
|
+
export const scheduleItemSchema = z.object({
|
|
98
|
+
scheduleId: idSchema('schedule'),
|
|
99
|
+
shipId: idSchema('ship'),
|
|
100
|
+
state: scheduleStateSchema,
|
|
101
|
+
selector: scheduleItemSelectorSchema,
|
|
102
|
+
contentType: z.string(),
|
|
103
|
+
inReplyTo: idSchema('message').nullable(),
|
|
104
|
+
isForced: z.boolean(),
|
|
105
|
+
timing: scheduleTimingItemSchema,
|
|
106
|
+
onRefused: refusalStrategySchema,
|
|
107
|
+
retryWindow: z.string(),
|
|
108
|
+
onMissed: missedStrategySchema,
|
|
109
|
+
grace: z.string(),
|
|
110
|
+
/** None once it ended or was cancelled. */
|
|
111
|
+
nextSendTime: isoTime.nullable(),
|
|
112
|
+
lastOutcome: scheduleOutcomeSchema.nullable(),
|
|
113
|
+
createdAt: isoTime,
|
|
114
|
+
endedAt: isoTime.nullable(),
|
|
115
|
+
cancelledAt: isoTime.nullable(),
|
|
116
|
+
});
|
|
117
|
+
/** Input of `ship.schedules`: a page, newest first; active and paused ones unless `states` names others. */
|
|
118
|
+
export const schedulesInputSchema = pageInputOf(idSchema('schedule')).extend({ states: z.array(scheduleStateSchema).min(1).optional() });
|
|
119
|
+
/** Input of `fleet.schedules` (fleet:manage): the ship whose schedules to list, as `ship.schedules` lists them. */
|
|
120
|
+
export const fleetSchedulesInputSchema = schedulesInputSchema.extend({ shipId: idSchema('ship') });
|
|
121
|
+
export const schedulesOutputSchema = pageOutputOf(scheduleItemSchema, idSchema('schedule'));
|
|
122
|
+
/** Input of `ship.pauseSchedule` and `fleet.pauseSchedule`. */
|
|
123
|
+
export const pauseScheduleInputSchema = z.object({ scheduleId: idSchema('schedule') });
|
|
124
|
+
export const pauseScheduleOutputSchema = z.object({ scheduleId: idSchema('schedule'), state: z.literal('paused') });
|
|
125
|
+
/** Input of `ship.resumeSchedule`. */
|
|
126
|
+
export const resumeScheduleInputSchema = z.object({ scheduleId: idSchema('schedule') });
|
|
127
|
+
/** Active again, or ended when no send time is left after now. */
|
|
128
|
+
export const resumeScheduleOutputSchema = z.object({ scheduleId: idSchema('schedule'), state: z.enum(['active', 'ended']) });
|
|
129
|
+
/** Input of `ship.cancelSchedule` and `fleet.cancelSchedule`. */
|
|
130
|
+
export const cancelScheduleInputSchema = z.object({ scheduleId: idSchema('schedule') });
|
|
131
|
+
export const cancelScheduleOutputSchema = z.object({ scheduleId: idSchema('schedule'), state: z.literal('cancelled') });
|
|
132
|
+
//# sourceMappingURL=schedule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../src/schemas/schedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEtD;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,uBAAuB;AACvB,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAEjC,oGAAoG;AACpG,MAAM,CAAC,MAAM,+BAA+B,GAAG,WAAW,CAAC;AAE3D,kGAAkG;AAClG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAU,CAAC;AAEnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAI3D,kIAAkI;AAClI,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAU,CAAC;AAEtE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,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AK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AAE7H,iEAAiE;AACjE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC"}
|
package/dist/schemas/scopes.d.ts
CHANGED
|
@@ -25,12 +25,18 @@ export declare const declareScopesOutputSchema: z.ZodObject<{
|
|
|
25
25
|
}, z.core.$strip>>;
|
|
26
26
|
}, z.core.$strip>;
|
|
27
27
|
/**
|
|
28
|
-
* Output of `fleet.scopes` (fleet:read): every namespace of the fleet,
|
|
29
|
-
* core ones first, declared by no ship, then
|
|
30
|
-
*
|
|
28
|
+
* Output of `fleet.scopes` (fleet:read): every namespace of the fleet,
|
|
29
|
+
* saying whose it is: the core ones first, declared by no ship, then the
|
|
30
|
+
* plugins' and the fleet's own by namespace, a plugin's with its declarer by
|
|
31
|
+
* id and name (decision 0046).
|
|
31
32
|
*/
|
|
32
33
|
export declare const scopesOutputSchema: z.ZodArray<z.ZodObject<{
|
|
33
34
|
namespace: z.ZodString;
|
|
35
|
+
kind: z.ZodEnum<{
|
|
36
|
+
core: "core";
|
|
37
|
+
fleet: "fleet";
|
|
38
|
+
plugin: "plugin";
|
|
39
|
+
}>;
|
|
34
40
|
declaredBy: z.ZodNullable<z.ZodObject<{
|
|
35
41
|
id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
36
42
|
name: z.ZodString;
|
|
@@ -54,3 +60,23 @@ export declare const grantScopesInputSchema: z.ZodObject<{
|
|
|
54
60
|
export declare const grantScopesOutputSchema: z.ZodObject<{
|
|
55
61
|
scopes: z.ZodArray<z.ZodString>;
|
|
56
62
|
}, z.core.$strip>;
|
|
63
|
+
/**
|
|
64
|
+
* Input of `fleet.defineScope` and `fleet.describeScope` (scopes:define):
|
|
65
|
+
* one of the fleet's own scopes and its one-line description (design
|
|
66
|
+
* gateway-scopes, 4.1). Core checks each rule and names its refusal.
|
|
67
|
+
*/
|
|
68
|
+
export declare const defineScopeInputSchema: z.ZodObject<{
|
|
69
|
+
scope: z.ZodString;
|
|
70
|
+
description: z.ZodString;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
/** Output of `fleet.defineScope` and `fleet.describeScope`: the scope as the fleet has it now. */
|
|
73
|
+
export declare const definedScopeOutputSchema: z.ZodObject<{
|
|
74
|
+
scope: z.ZodString;
|
|
75
|
+
description: z.ZodString;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
/** Input of `fleet.removeScope` (scopes:define): one of the fleet's own scopes. */
|
|
78
|
+
export declare const removeScopeInputSchema: z.ZodObject<{
|
|
79
|
+
scope: z.ZodString;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
/** Output of `fleet.removeScope`: nothing, once the scope is gone. */
|
|
82
|
+
export declare const removeScopeOutputSchema: z.ZodObject<{}, z.core.$strip>;
|
package/dist/schemas/scopes.js
CHANGED
|
@@ -15,12 +15,14 @@ export const declareScopesInputSchema = z.object({
|
|
|
15
15
|
/** Output of `fleet.declareScopes`: the namespace as declared. */
|
|
16
16
|
export const declareScopesOutputSchema = z.object({ namespace: z.string(), scopes: z.array(declaredScopeSchema) });
|
|
17
17
|
/**
|
|
18
|
-
* Output of `fleet.scopes` (fleet:read): every namespace of the fleet,
|
|
19
|
-
* core ones first, declared by no ship, then
|
|
20
|
-
*
|
|
18
|
+
* Output of `fleet.scopes` (fleet:read): every namespace of the fleet,
|
|
19
|
+
* saying whose it is: the core ones first, declared by no ship, then the
|
|
20
|
+
* plugins' and the fleet's own by namespace, a plugin's with its declarer by
|
|
21
|
+
* id and name (decision 0046).
|
|
21
22
|
*/
|
|
22
23
|
export const scopesOutputSchema = z.array(z.object({
|
|
23
24
|
namespace: z.string(),
|
|
25
|
+
kind: z.enum(['core', 'plugin', 'fleet']),
|
|
24
26
|
declaredBy: z.object({ id: idSchema('ship'), name: z.string() }).nullable(),
|
|
25
27
|
scopes: z.array(declaredScopeSchema),
|
|
26
28
|
}));
|
|
@@ -32,4 +34,16 @@ export const scopesOutputSchema = z.array(z.object({
|
|
|
32
34
|
export const grantScopesInputSchema = z.object({ shipId: idSchema('ship'), grant: z.array(z.string()), revoke: z.array(z.string()) });
|
|
33
35
|
/** Output of `fleet.grantScopes`: every scope the ship holds now. */
|
|
34
36
|
export const grantScopesOutputSchema = z.object({ scopes: z.array(scopeNameSchema) });
|
|
37
|
+
/**
|
|
38
|
+
* Input of `fleet.defineScope` and `fleet.describeScope` (scopes:define):
|
|
39
|
+
* one of the fleet's own scopes and its one-line description (design
|
|
40
|
+
* gateway-scopes, 4.1). Core checks each rule and names its refusal.
|
|
41
|
+
*/
|
|
42
|
+
export const defineScopeInputSchema = z.object({ scope: z.string(), description: z.string() });
|
|
43
|
+
/** Output of `fleet.defineScope` and `fleet.describeScope`: the scope as the fleet has it now. */
|
|
44
|
+
export const definedScopeOutputSchema = declaredScopeSchema;
|
|
45
|
+
/** Input of `fleet.removeScope` (scopes:define): one of the fleet's own scopes. */
|
|
46
|
+
export const removeScopeInputSchema = z.object({ scope: z.string() });
|
|
47
|
+
/** Output of `fleet.removeScope`: nothing, once the scope is gone. */
|
|
48
|
+
export const removeScopeOutputSchema = z.object({});
|
|
35
49
|
//# sourceMappingURL=scopes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scopes.js","sourceRoot":"","sources":["../../src/schemas/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EA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AC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAEtF;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAE/F,kGAAkG;AAClG,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;AAE5D,mFAAmF;AACnF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAEtE,sEAAsE;AACtE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC"}
|
package/dist/schemas/ship.js
CHANGED
|
@@ -64,7 +64,7 @@ export const whoamiOutputSchema = z.object({
|
|
|
64
64
|
type: z.string(),
|
|
65
65
|
/**
|
|
66
66
|
* Its owner's id and name, both null for argo and the viewer (decision
|
|
67
|
-
* 0045). Keys of their own: the
|
|
67
|
+
* 0045). Keys of their own: the Aeolus Fleet plugin's scripts read name, shipId
|
|
68
68
|
* and type as the last such key in the answer.
|
|
69
69
|
*/
|
|
70
70
|
ownerShipId: idSchema('ship').nullable(),
|