@midsummer-ai/sdk 0.1.0-staging.4480 → 0.1.0-staging.4486
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/auth/contract.d.mts +1 -1
- package/auth/contract.mjs +2 -2
- package/auth/index.d.mts +1 -1
- package/auth/index.mjs +1 -1
- package/auth/password.mjs +1 -1
- package/auth/react.mjs +1 -1
- package/{auth-C7yU9QWZ.mjs → auth-BH2Lfguc.mjs} +49 -3
- package/calls/contract.d.mts +23 -0
- package/calls/contract.mjs +293 -0
- package/calls/index.d.mts +147 -0
- package/calls/index.mjs +1131 -0
- package/calls/protocol.d.mts +2 -0
- package/calls/protocol.mjs +33 -0
- package/calls/react.d.mts +56 -0
- package/calls/react.mjs +225 -0
- package/calls/stand-in.d.mts +22 -0
- package/calls/stand-in.mjs +390 -0
- package/calls/ui.d.mts +76 -0
- package/calls/ui.mjs +783 -0
- package/{engine-Be7yur9O.mjs → engine-CmTP59GT.mjs} +1 -1
- package/flows/contract.d.mts +1 -1
- package/flows/index.d.mts +1 -1
- package/{guard-Br3K8CVx.mjs → guard-VPI6xq4z.mjs} +1 -1
- package/here-C2jhTheQ.mjs +1 -1
- package/{index-CkyNDcba.d.mts → index-BmjcZfRb.d.mts} +8 -0
- package/index-c616Dbux.d.mts +343 -0
- package/package.json +43 -1
- package/protocol-BeBvbfKf.d.mts +185 -0
- package/queues/contract.d.mts +1 -1
- package/queues/index.d.mts +1 -342
- package/queues/stand-in.d.mts +1 -1
- package/queues/wire.d.mts +1 -1
- package/{style-BJzVvUKV.mjs → style-DXd-0Cxo.mjs} +1 -163
- package/tokens-BpV8U5E1.mjs +164 -0
package/queues/index.d.mts
CHANGED
|
@@ -1,343 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Queues: a Team's Queues of Messages, which the SDK reaches by the name an Environment binds each one
|
|
4
|
-
* under (`midsummer env binding set`).
|
|
5
|
-
*
|
|
6
|
-
* import { queues } from "@midsummer-ai/sdk/queues"
|
|
7
|
-
* import { standIn } from "@midsummer-ai/sdk/queues/stand-in"
|
|
8
|
-
*
|
|
9
|
-
* const jobs = queues(standIn({ clock: Date.now }))
|
|
10
|
-
* const emails = jobs.queue("emails")
|
|
11
|
-
* await emails.send({ to: "ada@example.com" }, { key: `welcome:${userId}` })
|
|
12
|
-
* for (const delivery of await emails.receive({ limit: 10 })) {
|
|
13
|
-
* try { await mail(delivery.body); await emails.ack(delivery.receipt) }
|
|
14
|
-
* catch { await emails.retry(delivery.receipt) }
|
|
15
|
-
* }
|
|
16
|
-
* const { depth, oldestSentAt } = await emails.stats()
|
|
17
|
-
*
|
|
18
|
-
* In a deployment, in any framework, and under `midsummer dev`, `queue` reaches the queue the
|
|
19
|
-
* environment binds under a name, with nothing to connect:
|
|
20
|
-
*
|
|
21
|
-
* import { queue } from "@midsummer-ai/sdk/queues"
|
|
22
|
-
*
|
|
23
|
-
* await queue("emails").send({ to: "ada@example.com" })
|
|
24
|
-
*
|
|
25
|
-
* The Stand-in keeps Messages in memory, for tests and `midsummer dev`. Code can pull its Messages
|
|
26
|
-
* with `receive`, or a consumer can deliver each one to a path of your site (`midsummer queue
|
|
27
|
-
* consumer set`). Each engine is held to the cases in `@midsummer-ai/sdk/queues/contract`; a
|
|
28
|
-
* behaviour that is not a case there is not promised.
|
|
29
|
-
*
|
|
30
|
-
* Delivery is at least once. A Message received is hidden from other receivers for its visibility
|
|
31
|
-
* window; acked, it is gone; retried, or left until the window ends, it is delivered again, a later
|
|
32
|
-
* time each attempt (10 seconds after the first, doubling, at most 10 minutes). Once it has been
|
|
33
|
-
* delivered `maxAttempts` times (5 unless the receiver says), a retry or an ended window moves it
|
|
34
|
-
* to the Queue's dead-letter Queue, `queue.deadLetter`, where it waits to be read and never moves on.
|
|
35
|
-
* A receipt names one delivery: acking or retrying one whose window has ended does nothing.
|
|
36
|
-
*
|
|
37
|
-
* A send with a `key` is made once: sending the same key to the same Queue again, within a day,
|
|
38
|
-
* returns the first Message's id and sends nothing. Schedules send with one, so a Schedule's minute
|
|
39
|
-
* sends once however often it is reached.
|
|
40
|
-
*
|
|
41
|
-
* Messages sent with the same `group` are delivered one at a time, in the order sent: the next is
|
|
42
|
-
* delivered only once the one before it is acked or moved to the dead-letter Queue, and a retried one
|
|
43
|
-
* keeps its place, so order-dependent work (a customer's payments, one document's edits) never runs
|
|
44
|
-
* out of order. Each group goes on apart from the others. A Queue can let a group have more at once,
|
|
45
|
-
* and limit deliveries a period (`midsummer queue edit`); its limits hold Messages back, never drop them.
|
|
46
|
-
*
|
|
47
|
-
* A receiver whose work takes longer than its visibility window extends it with `extend`, as often as
|
|
48
|
-
* it needs, before the window ends.
|
|
49
|
-
*
|
|
50
|
-
* Names and bodies are checked here, before anything leaves the caller. Every failure is a
|
|
51
|
-
* `QueueError`, whose `code` is the one the wire carries.
|
|
52
|
-
*/
|
|
53
|
-
/** Why a Queues call failed: as Storage's codes say (`invalid`, `forbidden`, `quota`, `unavailable` …), and `not-found` for a Flow run there is none of. */
|
|
54
|
-
type QueueErrorCode = "invalid" | "forbidden" | "quota" | "unavailable" | "not-found";
|
|
55
|
-
declare const queueErrorCodes: ReadonlyArray<QueueErrorCode>;
|
|
56
|
-
declare class QueueError extends Error {
|
|
57
|
-
readonly code: QueueErrorCode;
|
|
58
|
-
constructor(code: QueueErrorCode, why: string);
|
|
59
|
-
}
|
|
60
|
-
/** Any value JSON can carry. */
|
|
61
|
-
type Json = string | number | boolean | null | ReadonlyArray<Json> | {
|
|
62
|
-
readonly [key: string]: Json;
|
|
63
|
-
};
|
|
64
|
-
/** One delivery of a Message: its body as sent, and the receipt that acks or retries it. */
|
|
65
|
-
interface Delivery<Body = Json> {
|
|
66
|
-
readonly id: string;
|
|
67
|
-
readonly body: Body;
|
|
68
|
-
/** When it was sent, in milliseconds since the epoch. */
|
|
69
|
-
readonly sentAt: number;
|
|
70
|
-
/** Which delivery this is: 1 the first time it is received. */
|
|
71
|
-
readonly attempt: number;
|
|
72
|
-
/** Names this delivery; it acks or retries it until `visibleUntil`, and does nothing after. */
|
|
73
|
-
readonly receipt: string;
|
|
74
|
-
/** When the visibility window ends and the Message may be delivered again. */
|
|
75
|
-
readonly visibleUntil: number;
|
|
76
|
-
/** The Flow run this Message carries (`@midsummer-ai/sdk/flows`); a Flow's `work` runs it. */
|
|
77
|
-
readonly run?: string;
|
|
78
|
-
}
|
|
79
|
-
interface SendOptions {
|
|
80
|
-
/** Seconds before it can be received: 0 to 31,536,000 (365 days), 0 by default. */
|
|
81
|
-
readonly delaySeconds?: number;
|
|
82
|
-
/** Makes the send once: 1 to 128 printable characters. */
|
|
83
|
-
readonly key?: string;
|
|
84
|
-
/** Delivers it after the group's earlier Messages, one at a time: 1 to 128 printable characters, such as `customer:42`. */
|
|
85
|
-
readonly group?: string;
|
|
86
|
-
}
|
|
87
|
-
interface ReceiveOptions {
|
|
88
|
-
/** At most this many: 1 to 100, 10 by default. */
|
|
89
|
-
readonly limit?: number;
|
|
90
|
-
/** Seconds each delivery is hidden from other receivers: 1 to 43,200, 30 by default. */
|
|
91
|
-
readonly visibilitySeconds?: number;
|
|
92
|
-
/** Deliveries after which a retry moves the Message to the dead-letter Queue: 1 to 100, 5 by default. */
|
|
93
|
-
readonly maxAttempts?: number;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* What a Queue holds now. Each count stops at 1,000, with `more` set when there are more: reading
|
|
97
|
-
* stats never reads a whole Queue.
|
|
98
|
-
*/
|
|
99
|
-
interface QueueStats {
|
|
100
|
-
/** Every Message not yet acked: ready, in flight and delayed. */
|
|
101
|
-
readonly depth: number;
|
|
102
|
-
/** Messages that can be received now. */
|
|
103
|
-
readonly ready: number;
|
|
104
|
-
/** Messages delivered whose visibility window has not ended. */
|
|
105
|
-
readonly inFlight: number;
|
|
106
|
-
/** Messages sent with a delay, or retried, that cannot be received yet. */
|
|
107
|
-
readonly delayed: number;
|
|
108
|
-
/** When the oldest Message not yet acked was sent; absent when there is none. */
|
|
109
|
-
readonly oldestSentAt?: number;
|
|
110
|
-
/** Messages in the dead-letter Queue. */
|
|
111
|
-
readonly dead: number;
|
|
112
|
-
readonly more?: true;
|
|
113
|
-
}
|
|
114
|
-
/** The Messages of one Queue. */
|
|
115
|
-
interface Queue {
|
|
116
|
-
readonly name: string;
|
|
117
|
-
/** Sends one Message. Its body is any JSON value, at most 128 KiB as JSON. */
|
|
118
|
-
send(body: Json, options?: SendOptions): Promise<{
|
|
119
|
-
readonly id: string;
|
|
120
|
-
}>;
|
|
121
|
-
/** Sends up to 100 Messages together, received in the order given; ids in the same order. */
|
|
122
|
-
sendBatch(messages: ReadonlyArray<{
|
|
123
|
-
readonly body: Json;
|
|
124
|
-
} & SendOptions>): Promise<{
|
|
125
|
-
readonly ids: ReadonlyArray<string>;
|
|
126
|
-
}>;
|
|
127
|
-
/**
|
|
128
|
-
* Up to `limit` Messages that can be received now, oldest first. An engine looks at a bounded
|
|
129
|
-
* number of Messages a call, so it may answer fewer, or none, while it moves exhausted ones to the
|
|
130
|
-
* dead-letter Queue: receive again.
|
|
131
|
-
*/
|
|
132
|
-
receive<Body = Json>(options?: ReceiveOptions): Promise<ReadonlyArray<Delivery<Body>>>;
|
|
133
|
-
/** Ends a Message: it is not delivered again. */
|
|
134
|
-
ack(receipt: string): Promise<void>;
|
|
135
|
-
/**
|
|
136
|
-
* Hands a Message back to be delivered again after `delaySeconds`, or after the backoff when not
|
|
137
|
-
* given: 10 seconds after the first delivery, doubling, at most 600. Past its `maxAttempts` it
|
|
138
|
-
* moves to the dead-letter Queue instead.
|
|
139
|
-
*/
|
|
140
|
-
retry(receipt: string, options?: {
|
|
141
|
-
readonly delaySeconds?: number;
|
|
142
|
-
}): Promise<void>;
|
|
143
|
-
/**
|
|
144
|
-
* Keeps a delivery hidden `visibilitySeconds` (1 to 43,200, 30 by default) from now, for work that
|
|
145
|
-
* takes longer than its window. Returns when the window now ends, or undefined when the receipt has
|
|
146
|
-
* already ended, and the work should stop: the Message may be delivered again.
|
|
147
|
-
*/
|
|
148
|
-
extend(receipt: string, options?: {
|
|
149
|
-
readonly visibilitySeconds?: number;
|
|
150
|
-
}): Promise<number | undefined>;
|
|
151
|
-
stats(): Promise<QueueStats>;
|
|
152
|
-
/** Where this Queue's Messages go once they have been delivered `maxAttempts` times. Its own Messages never move on. */
|
|
153
|
-
readonly deadLetter: Queue;
|
|
154
|
-
}
|
|
155
|
-
interface Queues {
|
|
156
|
-
/** A Queue by name: 1 to 63 lowercase letters, digits, hyphens and underscores, starting with a letter or digit. */
|
|
157
|
-
queue(name: string): Queue;
|
|
158
|
-
}
|
|
159
|
-
/** A Message as an engine is given it: its body as JSON text. */
|
|
160
|
-
interface EngineMessage {
|
|
161
|
-
readonly body: string;
|
|
162
|
-
readonly delayMs: number;
|
|
163
|
-
readonly key?: string;
|
|
164
|
-
readonly group?: string;
|
|
165
|
-
}
|
|
166
|
-
/** Where a Flow run is: delivered or ready to be (`running`), parked until it wakes, or ended. */
|
|
167
|
-
type RunStatus = "running" | "sleeping" | "waiting" | "completed" | "failed" | "cancelled";
|
|
168
|
-
/** One recorded step of a run, as an engine keeps it: its value as JSON text. A wait that timed out has none. */
|
|
169
|
-
interface EngineStep {
|
|
170
|
-
/** The step's name, with `#2`, `#3` … after it for its second and later uses in one run. */
|
|
171
|
-
readonly id: string;
|
|
172
|
-
readonly kind: "run" | "sleep" | "wait";
|
|
173
|
-
readonly state: "done" | "failed" | "retrying" | "sleeping" | "waiting";
|
|
174
|
-
readonly value?: string;
|
|
175
|
-
readonly error?: string;
|
|
176
|
-
/** How many times its work threw. */
|
|
177
|
-
readonly failures: number;
|
|
178
|
-
/** When a sleeping or waiting step wakes, or a retrying one runs again. */
|
|
179
|
-
readonly until?: number;
|
|
180
|
-
/** The signal a wait waits for. */
|
|
181
|
-
readonly event?: string;
|
|
182
|
-
readonly at: number;
|
|
183
|
-
}
|
|
184
|
-
/** A Flow run as an engine keeps it: input and output as JSON text, and its steps in the order first recorded. */
|
|
185
|
-
interface EngineRun {
|
|
186
|
-
readonly id: string;
|
|
187
|
-
readonly status: RunStatus;
|
|
188
|
-
readonly input: string;
|
|
189
|
-
readonly startedAt: number;
|
|
190
|
-
readonly endedAt?: number;
|
|
191
|
-
readonly nextAt?: number;
|
|
192
|
-
readonly output?: string;
|
|
193
|
-
readonly error?: string;
|
|
194
|
-
readonly deadline?: number;
|
|
195
|
-
readonly group?: string;
|
|
196
|
-
readonly steps: ReadonlyArray<EngineStep>;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* What a delivery of a run records about one step: a value its work returned, or the error it threw
|
|
200
|
-
* with how many retries the step allows; a sleep of `ms`; or a wait for the signal `event` of at most
|
|
201
|
-
* `timeoutMs`.
|
|
202
|
-
*/
|
|
203
|
-
type StepWrite = {
|
|
204
|
-
readonly kind: "run";
|
|
205
|
-
readonly id: string;
|
|
206
|
-
readonly value: string;
|
|
207
|
-
} | {
|
|
208
|
-
readonly kind: "run";
|
|
209
|
-
readonly id: string;
|
|
210
|
-
readonly error: string;
|
|
211
|
-
readonly retries: number;
|
|
212
|
-
} | {
|
|
213
|
-
readonly kind: "sleep";
|
|
214
|
-
readonly id: string;
|
|
215
|
-
readonly ms: number;
|
|
216
|
-
} | {
|
|
217
|
-
readonly kind: "wait";
|
|
218
|
-
readonly id: string;
|
|
219
|
-
readonly event: string;
|
|
220
|
-
readonly timeoutMs: number;
|
|
221
|
-
};
|
|
222
|
-
/** A delivery as an engine returns it: its body as JSON text. */
|
|
223
|
-
interface EngineDelivery extends Omit<Delivery, "body"> {
|
|
224
|
-
readonly body: string;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Where Messages live: the Seam under `queues()`. The Stand-in and the real Capability are its
|
|
228
|
-
* Adapters. Calls arrive checked: a Queue's name is valid (with `.dead` after it for a dead-letter
|
|
229
|
-
* Queue), bodies are JSON text, times are milliseconds and defaults are filled in.
|
|
230
|
-
*/
|
|
231
|
-
interface QueueEngine {
|
|
232
|
-
/** Sends the Messages in order and returns their ids, a keyed one's first id when it was sent before. */
|
|
233
|
-
send(queue: string, messages: ReadonlyArray<EngineMessage>): Promise<ReadonlyArray<string>>;
|
|
234
|
-
receive(queue: string, options: {
|
|
235
|
-
readonly limit: number;
|
|
236
|
-
readonly visibilityMs: number;
|
|
237
|
-
readonly maxAttempts: number;
|
|
238
|
-
}): Promise<ReadonlyArray<EngineDelivery>>;
|
|
239
|
-
ack(queue: string, receipt: string): Promise<void>;
|
|
240
|
-
/** With no `delayMs`, the backoff after the delivery's attempt (`backoffMs`). */
|
|
241
|
-
retry(queue: string, receipt: string, delayMs?: number): Promise<void>;
|
|
242
|
-
/** Moves a current delivery's window to end `visibilityMs` from now and returns that time; undefined once the receipt has ended. */
|
|
243
|
-
extend(queue: string, receipt: string, visibilityMs: number): Promise<number | undefined>;
|
|
244
|
-
stats(queue: string): Promise<QueueStats>;
|
|
245
|
-
/**
|
|
246
|
-
* Starts a Flow run with its input, as one Message of the Queue that carries it: within `timeoutMs`
|
|
247
|
-
* when given, in `group` when given. An id used before starts nothing and returns `started: false`.
|
|
248
|
-
*/
|
|
249
|
-
start(queue: string, run: {
|
|
250
|
-
readonly id: string;
|
|
251
|
-
readonly input: string;
|
|
252
|
-
readonly timeoutMs?: number;
|
|
253
|
-
readonly group?: string;
|
|
254
|
-
}): Promise<{
|
|
255
|
-
readonly id: string;
|
|
256
|
-
readonly started: boolean;
|
|
257
|
-
}>;
|
|
258
|
-
/**
|
|
259
|
-
* The run a current delivery carries, with its steps and the engine's time, for its code to run
|
|
260
|
-
* again; undefined once the receipt has ended. A run that has ended, or passed its deadline (failing
|
|
261
|
-
* it), comes back ended: its code doesn't run.
|
|
262
|
-
*/
|
|
263
|
-
load(queue: string, runId: string, receipt: string): Promise<{
|
|
264
|
-
readonly now: number;
|
|
265
|
-
readonly run: EngineRun;
|
|
266
|
-
} | undefined>;
|
|
267
|
-
/**
|
|
268
|
-
* Records one step for a current delivery and returns it as now kept: the first value recorded
|
|
269
|
-
* wins, so of two deliveries the second takes the first's. A step that sleeps, waits or retries
|
|
270
|
-
* ends the delivery, its Message delivered again when it wakes. Undefined once the delivery or the
|
|
271
|
-
* run has ended: the code stops.
|
|
272
|
-
*/
|
|
273
|
-
record(queue: string, runId: string, receipt: string, step: StepWrite): Promise<EngineStep | undefined>;
|
|
274
|
-
/** Ends a run with what its code returned, or why it failed; a delivery that has ended, or a run that has, changes nothing. */
|
|
275
|
-
finish(queue: string, runId: string, receipt: string, end: {
|
|
276
|
-
readonly output: string;
|
|
277
|
-
} | {
|
|
278
|
-
readonly error: string;
|
|
279
|
-
}): Promise<void>;
|
|
280
|
-
/**
|
|
281
|
-
* Sends a run a signal: `delivered` when the run was waiting for `event` and wakes now, `kept` when
|
|
282
|
-
* it is kept for the run's next wait for it, `ended` when the run has ended, `missing` when there is
|
|
283
|
-
* no such run. A `key` sent before keeps nothing more.
|
|
284
|
-
*/
|
|
285
|
-
signal(queue: string, runId: string, signal: {
|
|
286
|
-
readonly event: string;
|
|
287
|
-
readonly value: string;
|
|
288
|
-
readonly key?: string;
|
|
289
|
-
}): Promise<"delivered" | "kept" | "ended" | "missing">;
|
|
290
|
-
/** Cancels a run and returns it; undefined when there is none. */
|
|
291
|
-
cancel(queue: string, runId: string): Promise<EngineRun | undefined>;
|
|
292
|
-
run(queue: string, runId: string): Promise<EngineRun | undefined>;
|
|
293
|
-
}
|
|
294
|
-
/** The suffix that marks a Queue's dead-letter Queue; no Queue's own name has a dot. */
|
|
295
|
-
declare const DEAD = ".dead";
|
|
296
|
-
/** Where a run's Queues frames go with its Workload token (`workloadTransport`). */
|
|
297
|
-
declare const WORKLOAD_PATH = "/queues/workload";
|
|
298
|
-
/** The delay before a Message's next delivery after its `attempt`-th: 10 seconds, doubling, at most 10 minutes. */
|
|
299
|
-
declare function backoffMs(attempt: number): number;
|
|
300
|
-
/** Stats' counts stop at this many. */
|
|
301
|
-
declare const STATS_CAP = 1000;
|
|
302
|
-
declare function invalid(why: string): never;
|
|
303
|
-
declare function checkQueueName(name: string): void;
|
|
304
|
-
/** A name as an engine is given it: a Queue's, or its dead-letter Queue's. */
|
|
305
|
-
declare function checkEngineQueue(queue: string): void;
|
|
306
|
-
declare function checkKey(key: string): void;
|
|
307
|
-
/** A group or a run's id: 1 to 128 printable characters, without spaces. */
|
|
308
|
-
declare function checkToken(value: string, what: string): void;
|
|
309
|
-
/** A signal's event: as a step's name is, since a wait's event is its step's name unless it says. */
|
|
310
|
-
declare function checkEvent(event: string): void;
|
|
311
|
-
/** A step's name: 1 to 200 characters, without line breaks or other control characters. */
|
|
312
|
-
declare function checkStepName(name: string): void;
|
|
313
|
-
/** The longest a delay, a sleep, a wait or a run's timeout may be: 365 days. */
|
|
314
|
-
declare const MAX_WAIT_MS: number;
|
|
315
|
-
/** Bodies are at most this many bytes of JSON. */
|
|
316
|
-
declare const MAX_BODY: number;
|
|
317
|
-
/** The JSON text of `body`, which must be a JSON value of at most 128 KiB. */
|
|
318
|
-
declare function bodyText(body: unknown): string;
|
|
319
|
-
declare function checkReceipt(receipt: string): void;
|
|
320
|
-
declare function checkDelaySeconds(seconds: number): void;
|
|
321
|
-
/** A visibility window in milliseconds: whole seconds, 1 to 43,200. */
|
|
322
|
-
declare function checkVisibilityMs(ms: number): void;
|
|
323
|
-
declare function checkReceive(options: {
|
|
324
|
-
readonly limit: number;
|
|
325
|
-
readonly visibilityMs: number;
|
|
326
|
-
readonly maxAttempts: number;
|
|
327
|
-
}): void;
|
|
328
|
-
/**
|
|
329
|
-
* The engine of the environment this code runs in: the request's own in a deployment, a run's
|
|
330
|
-
* through its Workload session (a CI run, an agent's dev server, `midsummer dev --view`; a view's
|
|
331
|
-
* own queue on a view), or `midsummer dev`'s on this computer. Every call goes to the one current when it is made. Flows reach their
|
|
332
|
-
* Queues through it too.
|
|
333
|
-
*/
|
|
334
|
-
declare function hereEngine(): QueueEngine;
|
|
335
|
-
/**
|
|
336
|
-
* The queue the environment binds under `name`, from code in a deployment in any framework, or
|
|
337
|
-
* `midsummer dev`'s queue of that name.
|
|
338
|
-
*/
|
|
339
|
-
declare function queue(name: string): Queue;
|
|
340
|
-
/** Queues over `engine`: the Stand-in's in tests, or `hereEngine()`. */
|
|
341
|
-
declare function queues(engine: QueueEngine): Queues;
|
|
342
|
-
//#endregion
|
|
1
|
+
import { A as checkReceive, C as bodyText, D as checkKey, E as checkEvent, F as invalid, I as queue, L as queueErrorCodes, M as checkToken, N as checkVisibilityMs, O as checkQueueName, P as hereEngine, R as queues, S as backoffMs, T as checkEngineQueue, _ as RunStatus, a as EngineRun, b as StepWrite, c as MAX_BODY, d as QueueEngine, f as QueueError, g as ReceiveOptions, h as Queues, i as EngineMessage, j as checkStepName, k as checkReceipt, l as MAX_WAIT_MS, m as QueueStats, n as Delivery, o as EngineStep, p as QueueErrorCode, r as EngineDelivery, s as Json, t as DEAD, u as Queue, v as STATS_CAP, w as checkDelaySeconds, x as WORKLOAD_PATH, y as SendOptions } from "../index-c616Dbux.mjs";
|
|
343
2
|
export { DEAD, Delivery, EngineDelivery, EngineMessage, EngineRun, EngineStep, Json, MAX_BODY, MAX_WAIT_MS, Queue, QueueEngine, QueueError, QueueErrorCode, QueueStats, Queues, ReceiveOptions, RunStatus, STATS_CAP, SendOptions, StepWrite, WORKLOAD_PATH, backoffMs, bodyText, checkDelaySeconds, checkEngineQueue, checkEvent, checkKey, checkQueueName, checkReceipt, checkReceive, checkStepName, checkToken, checkVisibilityMs, hereEngine, invalid, queue, queueErrorCodes, queues };
|
package/queues/stand-in.d.mts
CHANGED
package/queues/wire.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { d as QueueEngine } from "../index-c616Dbux.mjs";
|
|
1
2
|
import { Transport } from "../wire.mjs";
|
|
2
|
-
import { QueueEngine } from "./index.mjs";
|
|
3
3
|
//#region src/queues/wire.d.ts
|
|
4
4
|
/** The engine on the far side of `transport`. */
|
|
5
5
|
declare function remote(transport: Transport): QueueEngine;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { a as TYPE, i as MATERIAL, n as FOUNDATION, r as LIGHT, t as DARK } from "./tokens-BpV8U5E1.mjs";
|
|
1
2
|
//#region src/auth/look.ts
|
|
2
3
|
/**
|
|
3
4
|
* What sign-in's screens say, shared by the drop-in components (`./react.ts`) and the hosted pages (`./ui.ts`), so both
|
|
@@ -267,169 +268,6 @@ const CAPTCHA_WIDGETS = {
|
|
|
267
268
|
}
|
|
268
269
|
};
|
|
269
270
|
//#endregion
|
|
270
|
-
//#region src/auth/tokens.ts
|
|
271
|
-
/**
|
|
272
|
-
* Midsummer's design tokens that sign-in's screens use, copied from the design system's foundations
|
|
273
|
-
* (`ui/packages/ui/src/foundations`) so the SDK needs nothing of it at runtime. `test/auth-look.test.ts` reads those files
|
|
274
|
-
* and fails when a value here differs from its source, so a change to the design system is a change here too.
|
|
275
|
-
*
|
|
276
|
-
* Each map is one block of the source: `LIGHT` its light theme (`:root`), `DARK` its dark theme (`[data-theme="dark"]`),
|
|
277
|
-
* `MATERIAL` the button material every button carries (`.ms-button-material`), `FOUNDATION` its `@theme` values, and
|
|
278
|
-
* `TYPE` the text roles of `typography.css`. Names and values are the source's own, so `var()` between them still works.
|
|
279
|
-
*/
|
|
280
|
-
const LIGHT = {
|
|
281
|
-
"--ms-page": "oklch(0.992 0.001 255)",
|
|
282
|
-
"--ms-surface-primary": "oklch(1 0 0)",
|
|
283
|
-
"--ms-surface-secondary": "oklch(0.97 0.003 255)",
|
|
284
|
-
"--ms-surface-raised": "oklch(0.998 0.001 255)",
|
|
285
|
-
"--ms-text-primary": "oklch(0.19 0.004 255)",
|
|
286
|
-
"--ms-text-secondary": "oklch(0.44 0.007 255)",
|
|
287
|
-
"--ms-text-tertiary": "oklch(0.55 0.006 255)",
|
|
288
|
-
"--ms-border-subtle": "oklch(0.89 0.005 255)",
|
|
289
|
-
"--ms-border-strong": "oklch(0.82 0.006 255)",
|
|
290
|
-
"--ms-gray-3": "oklch(0.962 0.003 255)",
|
|
291
|
-
"--ms-gray-4": "oklch(0.942 0.004 255)",
|
|
292
|
-
"--ms-selection-fill": "var(--ms-gray-3)",
|
|
293
|
-
"--ms-accent-fill": "oklch(0.92 0.035 254)",
|
|
294
|
-
"--ms-accent-border-hover": "oklch(0.7 0.14 254)",
|
|
295
|
-
"--ms-accent-glyph": "#0d84f2",
|
|
296
|
-
"--ms-accent-solid": "#0d84f2",
|
|
297
|
-
"--ms-focus-ring": "color-mix(in oklab, var(--ms-accent) 58%, transparent)",
|
|
298
|
-
"--ms-danger-fill": "#ffebec",
|
|
299
|
-
"--ms-danger-border": "#ffc0c5",
|
|
300
|
-
"--ms-danger-glyph": "#fb3748",
|
|
301
|
-
"--ms-danger-solid": "#fb3748",
|
|
302
|
-
"--ms-danger-on-solid": "#ffffff",
|
|
303
|
-
"--ms-danger-text": "#d02533",
|
|
304
|
-
"--ms-depth-drop": "rgba(16, 24, 40, 0.09)",
|
|
305
|
-
"--ms-shadow-well": "inset 0 1px 2px oklch(0 0 0 / 0.06)",
|
|
306
|
-
"--ms-shadow-menu": "inset 0 1px 0 oklch(1 0 0 / 0.95), 0 0 0 1px oklch(0 0 0 / 0.075), 0 3px 6px -2px oklch(0 0 0 / 0.12), 0 12px 24px -8px oklch(0 0 0 / 0.18)",
|
|
307
|
-
"--ms-avatar-rim": "oklch(0 0 0 / 0.1)",
|
|
308
|
-
"--ms-avatar-highlight": "oklch(1 0 0 / 0.7)",
|
|
309
|
-
"--ms-button-primary": "oklch(0.305 0 0)",
|
|
310
|
-
"--ms-button-primary-hover": "oklch(0.335 0 0)",
|
|
311
|
-
"--ms-button-primary-pressed": "oklch(0.275 0 0)",
|
|
312
|
-
"--ms-button-primary-sheen": "linear-gradient(180deg, oklch(1 0 0 / 0.045), transparent 48%, oklch(0 0 0 / 0.06))",
|
|
313
|
-
"--ms-button-primary-foreground": "oklch(0.985 0.001 255)",
|
|
314
|
-
"--ms-button-primary-edge": "oklch(0.25 0 0)",
|
|
315
|
-
"--ms-button-secondary": "oklch(0.995 0.001 255)",
|
|
316
|
-
"--ms-button-secondary-hover": "oklch(0.972 0.003 255)",
|
|
317
|
-
"--ms-button-secondary-pressed": "oklch(0.945 0.004 255)",
|
|
318
|
-
"--ms-button-secondary-foreground": "var(--ms-text-primary)",
|
|
319
|
-
"--ms-button-secondary-edge": "oklch(0.885 0.005 255)",
|
|
320
|
-
"--ms-button-danger": "color-mix(in oklab, var(--ms-danger-solid) 86%, black)",
|
|
321
|
-
"--ms-button-danger-hover": "color-mix(in oklab, var(--ms-button-danger) 94%, white)",
|
|
322
|
-
"--ms-button-danger-pressed": "color-mix(in oklab, var(--ms-button-danger) 88%, black)",
|
|
323
|
-
"--ms-button-danger-foreground": "var(--ms-danger-on-solid)",
|
|
324
|
-
"--ms-button-danger-edge": "color-mix(in oklab, var(--ms-button-danger) 84%, black)",
|
|
325
|
-
"--ms-shadow-button-primary": "inset 0 0 0 1px oklch(1 0 0 / 0.09), inset 0 1px 1px oklch(1 0 0 / 0.22), inset 0 -2px 3px oklch(0 0 0 / 0.28), 0 1px 1px oklch(0 0 0 / 0.16), 0 3px 5px -1px oklch(0 0 0 / 0.19)",
|
|
326
|
-
"--ms-shadow-button-primary-hover": "inset 0 0 0 1px oklch(1 0 0 / 0.11), inset 0 1px 1px oklch(1 0 0 / 0.26), inset 0 -2px 3px oklch(0 0 0 / 0.28), 0 1px 1px oklch(0 0 0 / 0.16), 0 4px 7px -2px oklch(0 0 0 / 0.22)",
|
|
327
|
-
"--ms-shadow-button-primary-pressed": "inset 0 0 0 1px oklch(0 0 0 / 0.12), inset 0 1px 2px oklch(0 0 0 / 0.3), inset 0 -1px 1px oklch(1 0 0 / 0.06), 0 0 0 transparent, 0 1px 2px oklch(0 0 0 / 0.12)",
|
|
328
|
-
"--ms-card-lift": "inset 0 1px 0 oklch(1 0 0 / 0.85), 0 0 0 1px oklch(0 0 0 / 0.1), 0 2px 3px -1px oklch(0 0 0 / 0.09), 0 8px 16px -12px oklch(0 0 0 / 0.18)",
|
|
329
|
-
"--ms-frame-fill": "color-mix(in oklab, var(--ms-surface-secondary) 72%, var(--ms-surface-primary))",
|
|
330
|
-
"--ms-shadow-card": "var(--ms-card-lift), 0 0 0 4px var(--ms-frame-fill), 0 0 0 5px var(--ms-border-subtle)"
|
|
331
|
-
};
|
|
332
|
-
const DARK = {
|
|
333
|
-
"--ms-page": "oklch(0.17 0.003 255)",
|
|
334
|
-
"--ms-surface-primary": "oklch(0.21 0.004 255)",
|
|
335
|
-
"--ms-surface-secondary": "oklch(0.25 0.005 255)",
|
|
336
|
-
"--ms-surface-raised": "oklch(0.225 0.004 255)",
|
|
337
|
-
"--ms-text-primary": "oklch(0.965 0.002 255)",
|
|
338
|
-
"--ms-text-secondary": "oklch(0.74 0.006 255)",
|
|
339
|
-
"--ms-text-tertiary": "oklch(0.64 0.006 255)",
|
|
340
|
-
"--ms-border-subtle": "oklch(0.33 0.007 255)",
|
|
341
|
-
"--ms-border-strong": "oklch(0.41 0.008 255)",
|
|
342
|
-
"--ms-gray-3": "oklch(0.265 0.005 255)",
|
|
343
|
-
"--ms-gray-4": "oklch(0.3 0.006 255)",
|
|
344
|
-
"--ms-selection-fill": "var(--ms-gray-4)",
|
|
345
|
-
"--ms-accent-fill": "oklch(0.28 0.045 254)",
|
|
346
|
-
"--ms-accent-border-hover": "oklch(0.68 0.15 254)",
|
|
347
|
-
"--ms-accent-glyph": "#3b9bff",
|
|
348
|
-
"--ms-accent-solid": "#3b9bff",
|
|
349
|
-
"--ms-focus-ring": "color-mix(in oklab, var(--ms-accent) 64%, transparent)",
|
|
350
|
-
"--ms-danger-fill": "#fb374829",
|
|
351
|
-
"--ms-danger-border": "#fb37483d",
|
|
352
|
-
"--ms-danger-glyph": "#ff6875",
|
|
353
|
-
"--ms-danger-solid": "#e93544",
|
|
354
|
-
"--ms-danger-on-solid": "#ffffff",
|
|
355
|
-
"--ms-danger-text": "var(--ms-danger-glyph)",
|
|
356
|
-
"--ms-depth-drop": "rgba(0, 0, 0, 0.45)",
|
|
357
|
-
"--ms-shadow-well": "inset 0 1px 2px oklch(0 0 0 / 0.4)",
|
|
358
|
-
"--ms-shadow-menu": "inset 0 1px 0 oklch(1 0 0 / 0.075), 0 0 0 1px oklch(1 0 0 / 0.09), 0 3px 6px -2px oklch(0 0 0 / 0.3), 0 12px 24px -8px oklch(0 0 0 / 0.45)",
|
|
359
|
-
"--ms-avatar-rim": "oklch(1 0 0 / 0.1)",
|
|
360
|
-
"--ms-avatar-highlight": "oklch(1 0 0 / 0.12)",
|
|
361
|
-
"--ms-button-primary": "oklch(0.965 0.002 255)",
|
|
362
|
-
"--ms-button-primary-sheen": "linear-gradient(180deg, oklch(1 0 0 / 0.5), transparent 48%, oklch(0 0 0 / 0.025))",
|
|
363
|
-
"--ms-button-primary-hover": "oklch(1 0 0)",
|
|
364
|
-
"--ms-button-primary-pressed": "oklch(0.9 0.004 255)",
|
|
365
|
-
"--ms-button-primary-foreground": "oklch(0.18 0.004 255)",
|
|
366
|
-
"--ms-button-primary-edge": "oklch(0.985 0.001 255)",
|
|
367
|
-
"--ms-button-secondary": "oklch(1 0 0 / 0.16)",
|
|
368
|
-
"--ms-button-secondary-hover": "oklch(1 0 0 / 0.22)",
|
|
369
|
-
"--ms-button-secondary-pressed": "oklch(1 0 0 / 0.12)",
|
|
370
|
-
"--ms-button-secondary-foreground": "var(--ms-text-primary)",
|
|
371
|
-
"--ms-button-secondary-edge": "oklch(1 0 0 / 0.26)",
|
|
372
|
-
"--ms-shadow-button-primary": "inset 0 -1px 0 oklch(0 0 0 / 0.05), 0 0 0 transparent, 0 1px 2px oklch(0 0 0 / 0.3)",
|
|
373
|
-
"--ms-shadow-button-primary-hover": "inset 0 -1px 0 oklch(0 0 0 / 0.05), 0 0 0 transparent, 0 2px 4px -1px oklch(0 0 0 / 0.34)",
|
|
374
|
-
"--ms-shadow-button-primary-pressed": "inset 0 1px 2px oklch(0 0 0 / 0.14), 0 0 0 transparent, 0 0 0 transparent",
|
|
375
|
-
"--ms-button-secondary-material-shadow": "inset 0 1px 0 oklch(1 0 0 / 0.09), 0 0 0 transparent, 0 1px 2px oklch(0 0 0 / 0.28)",
|
|
376
|
-
"--ms-button-secondary-material-shadow-hover": "inset 0 1px 0 oklch(1 0 0 / 0.12), 0 0 0 transparent, 0 2px 4px -1px oklch(0 0 0 / 0.32)",
|
|
377
|
-
"--ms-button-secondary-material-shadow-pressed": "inset 0 1px 2px oklch(0 0 0 / 0.3), 0 0 0 transparent, 0 0 0 transparent",
|
|
378
|
-
"--ms-card-lift": "inset 0 1px 0 oklch(1 0 0 / 0.065), 0 0 0 1px oklch(1 0 0 / 0.085), 0 2px 4px -2px oklch(0 0 0 / 0.35)",
|
|
379
|
-
"--ms-frame-fill": "color-mix(in oklab, var(--ms-surface-secondary) 72%, var(--ms-surface-primary))",
|
|
380
|
-
"--ms-shadow-card": "var(--ms-card-lift), 0 0 0 4px var(--ms-frame-fill), 0 0 0 5px var(--ms-border-subtle)"
|
|
381
|
-
};
|
|
382
|
-
const MATERIAL = {
|
|
383
|
-
"--ms-button-accent-sheen": "linear-gradient(180deg, oklch(1 0 0 / 0.12), transparent 48%, oklch(0 0 0 / 0.06))",
|
|
384
|
-
"--ms-button-secondary-sheen": "linear-gradient(180deg, oklch(1 0 0 / 0.06), transparent 48%, oklch(0 0 0 / 0.025))",
|
|
385
|
-
"--ms-button-danger-sheen": "var(--ms-button-accent-sheen)",
|
|
386
|
-
"--ms-shadow-button-secondary": "var(--ms-button-secondary-material-shadow, inset 0 -1px 0 oklch(0 0 0 / 0.03), 0 0 0 transparent, 0 1px 2px oklch(0 0 0 / 0.05))",
|
|
387
|
-
"--ms-shadow-button-secondary-hover": "var(--ms-button-secondary-material-shadow-hover, inset 0 -1px 0 oklch(0 0 0 / 0.04), 0 0 0 transparent, 0 2px 4px -1px oklch(0 0 0 / 0.08))",
|
|
388
|
-
"--ms-shadow-button-secondary-pressed": "var(--ms-button-secondary-material-shadow-pressed, inset 0 1px 2px oklch(0 0 0 / 0.1), 0 0 0 transparent, 0 0 0 transparent)",
|
|
389
|
-
"--ms-shadow-button-danger": "inset 0 1px 0 oklch(1 0 0 / 0.22), inset 0 -1px 2px oklch(0 0 0 / 0.1), 0 1px 2px var(--ms-depth-drop)",
|
|
390
|
-
"--ms-shadow-button-danger-hover": "inset 0 1px 0 oklch(1 0 0 / 0.28), inset 0 -1px 2px oklch(0 0 0 / 0.1), 0 2px 4px -1px var(--ms-depth-drop)",
|
|
391
|
-
"--ms-shadow-button-danger-pressed": "inset 0 1px 2px oklch(0 0 0 / 0.22), 0 0 0 transparent, 0 0 0 transparent"
|
|
392
|
-
};
|
|
393
|
-
const FOUNDATION = {
|
|
394
|
-
"--font-sans": "\"Geist Variable\", \"Geist\", ui-sans-serif, system-ui, sans-serif",
|
|
395
|
-
"--font-weight-normal": "420",
|
|
396
|
-
"--font-weight-medium": "520",
|
|
397
|
-
"--radius-control": "0.5rem",
|
|
398
|
-
"--radius-action": "0.625rem",
|
|
399
|
-
"--radius-menu": "0.625rem",
|
|
400
|
-
"--radius-menu-item": "0.375rem",
|
|
401
|
-
"--radius-card": "0.75rem",
|
|
402
|
-
"--motion-duration-quick": "150ms",
|
|
403
|
-
"--motion-duration-control": "200ms",
|
|
404
|
-
"--motion-ease-out": "cubic-bezier(0.22, 1, 0.36, 1)"
|
|
405
|
-
};
|
|
406
|
-
const TYPE = {
|
|
407
|
-
heading: {
|
|
408
|
-
"font-size": "1.25rem",
|
|
409
|
-
"font-weight": "var(--font-weight-medium)",
|
|
410
|
-
"letter-spacing": "-0.02em",
|
|
411
|
-
"line-height": "1.25"
|
|
412
|
-
},
|
|
413
|
-
"body-medium": {
|
|
414
|
-
"font-size": "0.875rem",
|
|
415
|
-
"font-weight": "var(--font-weight-medium)",
|
|
416
|
-
"letter-spacing": "-0.01em",
|
|
417
|
-
"line-height": "1.25"
|
|
418
|
-
},
|
|
419
|
-
"body-small": {
|
|
420
|
-
"font-size": "0.875rem",
|
|
421
|
-
"font-weight": "var(--font-weight-normal)",
|
|
422
|
-
"letter-spacing": "-0.006em",
|
|
423
|
-
"line-height": "1.5"
|
|
424
|
-
},
|
|
425
|
-
caption: {
|
|
426
|
-
"font-size": "0.8125rem",
|
|
427
|
-
"font-weight": "var(--font-weight-normal)",
|
|
428
|
-
"letter-spacing": "-0.005em",
|
|
429
|
-
"line-height": "1.4"
|
|
430
|
-
}
|
|
431
|
-
};
|
|
432
|
-
//#endregion
|
|
433
271
|
//#region src/auth/font.ts
|
|
434
272
|
/**
|
|
435
273
|
* Geist, the screens' typeface, for the hosted pages to serve from the app's own address (`/api/auth/ui/font.woff2`):
|