@ericminassian/platform-core 0.3.0 → 0.4.0
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/api.d.ts +942 -45
- package/dist/api.js +372 -13
- package/dist/api.js.map +1 -1
- package/dist/auth.js +5 -2
- package/dist/auth.js.map +1 -1
- package/dist/base64url.d.ts +3 -0
- package/dist/base64url.js +15 -0
- package/dist/base64url.js.map +1 -0
- package/dist/bindings.d.ts +62 -12
- package/dist/bindings.js +1 -1
- package/dist/bindings.js.map +1 -1
- package/dist/cloudfront-function.d.ts +5 -1
- package/dist/cloudfront-function.js +64 -2
- package/dist/cloudfront-function.js.map +1 -1
- package/dist/compute.d.ts +52 -0
- package/dist/compute.js +65 -0
- package/dist/compute.js.map +1 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.js +9 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +56 -1
- package/dist/constants.js +56 -1
- package/dist/constants.js.map +1 -1
- package/dist/email.d.ts +84 -0
- package/dist/email.js +111 -0
- package/dist/email.js.map +1 -0
- package/dist/fingerprint.d.ts +9 -0
- package/dist/fingerprint.js +19 -0
- package/dist/fingerprint.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/jobs.d.ts +111 -0
- package/dist/jobs.js +214 -0
- package/dist/jobs.js.map +1 -0
- package/dist/manifest.d.ts +270 -29
- package/dist/manifest.js +190 -22
- package/dist/manifest.js.map +1 -1
- package/dist/naming.d.ts +83 -7
- package/dist/naming.js +89 -8
- package/dist/naming.js.map +1 -1
- package/dist/platform-api.d.ts +3733 -1278
- package/dist/platform-api.js +120 -8
- package/dist/platform-api.js.map +1 -1
- package/dist/realtime.d.ts +139 -0
- package/dist/realtime.js +201 -0
- package/dist/realtime.js.map +1 -0
- package/dist/router/decide.d.ts +2 -0
- package/dist/router/decide.js +38 -6
- package/dist/router.d.ts +35 -13
- package/dist/router.js +36 -0
- package/dist/router.js.map +1 -1
- package/dist/runtime-config.d.ts +57 -0
- package/dist/runtime-config.js +12 -0
- package/dist/runtime-config.js.map +1 -1
- package/dist/storage.d.ts +55 -0
- package/dist/storage.js +112 -0
- package/dist/storage.js.map +1 -0
- package/dist/telemetry.d.ts +124 -19
- package/dist/telemetry.js +97 -21
- package/dist/telemetry.js.map +1 -1
- package/dist/web-compute.d.ts +191 -0
- package/dist/web-compute.js +257 -0
- package/dist/web-compute.js.map +1 -0
- package/package.json +19 -7
- package/src/api.ts +445 -15
- package/src/auth.ts +6 -2
- package/src/base64url.ts +13 -0
- package/src/bindings.ts +67 -6
- package/src/cloudfront-function.ts +64 -2
- package/src/compute.ts +86 -0
- package/src/config.ts +31 -1
- package/src/constants.ts +64 -1
- package/src/email.ts +168 -0
- package/src/fingerprint.ts +20 -0
- package/src/index.ts +6 -0
- package/src/jobs.ts +281 -0
- package/src/manifest.ts +415 -45
- package/src/naming.ts +93 -9
- package/src/platform-api.ts +134 -8
- package/src/realtime.ts +298 -0
- package/src/router/decide.d.ts +2 -0
- package/src/router/decide.js +38 -6
- package/src/router.ts +33 -13
- package/src/runtime-config.ts +70 -0
- package/src/storage.ts +120 -0
- package/src/telemetry.ts +104 -21
- package/src/web-compute.ts +342 -0
package/dist/manifest.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
|
+
import { type FargateCpu } from './compute.ts';
|
|
3
|
+
import { type WebComputeSetting } from './web-compute.ts';
|
|
2
4
|
/**
|
|
3
5
|
* The app's config file, at the app root. `plat` evaluates it and sends the
|
|
4
6
|
* result to the platform as JSON; the control plane never runs app code.
|
|
@@ -19,6 +21,9 @@ export declare const ManifestSchema: Schema.Struct<{
|
|
|
19
21
|
readonly serverRoutes: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
20
22
|
readonly timeoutSeconds: Schema.withDecodingDefault<Schema.Int, never>;
|
|
21
23
|
readonly concurrency: Schema.withDecodingDefault<Schema.Int, never>;
|
|
24
|
+
readonly compute: Schema.withDecodingDefault<Schema.Literals<readonly ["auto", "request", "instance"]>, never>;
|
|
25
|
+
readonly memoryMb: Schema.withDecodingDefault<Schema.Int, never>;
|
|
26
|
+
readonly maxEnvironments: Schema.optional<Schema.Int>;
|
|
22
27
|
}>>;
|
|
23
28
|
readonly worker: Schema.optional<Schema.Struct<{
|
|
24
29
|
readonly entry: Schema.withDecodingDefault<Schema.String, never>;
|
|
@@ -30,19 +35,47 @@ export declare const ManifestSchema: Schema.Struct<{
|
|
|
30
35
|
}>]>, never>;
|
|
31
36
|
readonly db: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
32
37
|
readonly queues: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Struct<{
|
|
33
|
-
readonly
|
|
34
|
-
readonly
|
|
35
|
-
readonly
|
|
38
|
+
readonly timeoutSeconds: Schema.optional<Schema.Int>;
|
|
39
|
+
readonly memoryMb: Schema.optional<Schema.Int>;
|
|
40
|
+
readonly maxAttempts: Schema.withDecodingDefault<Schema.Int, never>;
|
|
36
41
|
readonly concurrency: Schema.optional<Schema.Int>;
|
|
42
|
+
readonly batchSize: Schema.optional<Schema.Unknown>;
|
|
43
|
+
readonly visibilityTimeoutSeconds: Schema.optional<Schema.Unknown>;
|
|
44
|
+
readonly maxReceiveCount: Schema.optional<Schema.Unknown>;
|
|
37
45
|
}>>, never>;
|
|
38
|
-
readonly events: Schema.withDecodingDefault<Schema.Union<readonly [Schema.$Array<Schema.String>, Schema.$Record<Schema.String, Schema.Struct<{
|
|
46
|
+
readonly events: Schema.withDecodingDefault<Schema.Union<readonly [Schema.$Array<Schema.String>, Schema.$Record<Schema.String, Schema.Struct<{
|
|
47
|
+
readonly timeoutSeconds: Schema.optional<Schema.Int>;
|
|
48
|
+
readonly memoryMb: Schema.optional<Schema.Int>;
|
|
49
|
+
readonly maxAttempts: Schema.optional<Schema.Int>;
|
|
50
|
+
}>>]>, never>;
|
|
39
51
|
readonly crons: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
52
|
+
readonly timeoutSeconds: Schema.optional<Schema.Int>;
|
|
53
|
+
readonly memoryMb: Schema.optional<Schema.Int>;
|
|
40
54
|
readonly schedule: Schema.String;
|
|
41
55
|
readonly timezone: Schema.optional<Schema.String>;
|
|
56
|
+
readonly maxAttempts: Schema.optional<Schema.Int>;
|
|
42
57
|
}>]>>, never>;
|
|
43
|
-
readonly storage: Schema.withDecodingDefault<Schema.$Array<Schema.String>,
|
|
58
|
+
readonly storage: Schema.withDecodingDefault<Schema.Union<readonly [Schema.$Array<Schema.String>, Schema.$Record<Schema.String, Schema.Struct<{
|
|
59
|
+
readonly public: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
60
|
+
readonly expireAfterDays: Schema.optional<Schema.Int>;
|
|
61
|
+
}>>]>, never>;
|
|
44
62
|
readonly secrets: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
45
63
|
readonly env: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.String>, never>;
|
|
64
|
+
readonly realtime: Schema.optional<Schema.Struct<{
|
|
65
|
+
readonly subscribe: Schema.withDecodingDefault<Schema.Literals<readonly ["public", "signed-in"]>, never>;
|
|
66
|
+
readonly channels: Schema.$Record<Schema.String, Schema.Struct<{}>>;
|
|
67
|
+
}>>;
|
|
68
|
+
readonly email: Schema.withDecodingDefault<Schema.Union<readonly [Schema.Boolean, Schema.Struct<{
|
|
69
|
+
readonly name: Schema.optional<Schema.String>;
|
|
70
|
+
readonly dailyLimit: Schema.optional<Schema.Int>;
|
|
71
|
+
}>]>, never>;
|
|
72
|
+
readonly services: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Struct<{
|
|
73
|
+
readonly entry: Schema.String;
|
|
74
|
+
readonly cpu: Schema.withDecodingDefault<Schema.Literals<readonly [0.25, 0.5, 1, 2, 4]>, never>;
|
|
75
|
+
readonly memoryMb: Schema.withDecodingDefault<Schema.Int, never>;
|
|
76
|
+
readonly spot: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
77
|
+
readonly previewMinutes: Schema.withDecodingDefault<Schema.Int, never>;
|
|
78
|
+
}>>, never>;
|
|
46
79
|
}>;
|
|
47
80
|
/** The evaluated config as JSON: what the CLI sends and deployments store. */
|
|
48
81
|
export type ManifestInput = typeof ManifestSchema.Encoded;
|
|
@@ -76,35 +109,152 @@ export interface WebConfig {
|
|
|
76
109
|
serverRoutes?: readonly string[];
|
|
77
110
|
/** 3-900. Default 30. */
|
|
78
111
|
timeoutSeconds?: number;
|
|
79
|
-
/** Max concurrent requests per Web Function environment, 1-128. Default 64. */
|
|
112
|
+
/** Max concurrent requests per Web Function environment (instance mode), 1-128. Default 64. */
|
|
80
113
|
concurrency?: number;
|
|
114
|
+
/**
|
|
115
|
+
* How the server runs. `request`: one invocation per request, billed by the
|
|
116
|
+
* millisecond and nothing while idle. `instance`: a Web Function, whose
|
|
117
|
+
* environments serve many requests at once and are billed for their memory
|
|
118
|
+
* while they live (until about five minutes after the last request).
|
|
119
|
+
* `auto` (default): previews run `request`; prod starts on `request` and
|
|
120
|
+
* moves to whichever mode its traffic makes cheaper, checked daily.
|
|
121
|
+
*/
|
|
122
|
+
compute?: WebComputeSetting;
|
|
123
|
+
/** Memory of the server in request mode, 128-10240 MB (CPU grows with it). Default 1024. */
|
|
124
|
+
memoryMb?: number;
|
|
125
|
+
/** Most environments prod's Web Function (instance mode) runs at once, 2-10000. Default 10; previews 2. */
|
|
126
|
+
maxEnvironments?: number;
|
|
81
127
|
}
|
|
82
128
|
export interface WorkerConfig {
|
|
83
129
|
/** Module whose default export is `defineWorker(...)`. Default `src/worker.ts`. */
|
|
84
130
|
entry?: string;
|
|
85
|
-
/** 1-900. Default 60. */
|
|
131
|
+
/** 1-900. Default 60. Handlers can set their own (`HandlerConfig`). */
|
|
132
|
+
timeoutSeconds?: number;
|
|
133
|
+
/** 128-10240. Default 512. Handlers can set their own (`HandlerConfig`). */
|
|
134
|
+
memoryMb?: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* A queue, event or cron handler's own Lambda settings, for handlers whose
|
|
138
|
+
* needs differ from the rest (a big parse, a long idle wait). A handler that
|
|
139
|
+
* sets either runs in a function of its own, from the same worker bundle;
|
|
140
|
+
* the one it doesn't set is the worker's.
|
|
141
|
+
*/
|
|
142
|
+
export interface HandlerConfig {
|
|
143
|
+
/** 1-900. Default: the worker's `timeoutSeconds`. */
|
|
86
144
|
timeoutSeconds?: number;
|
|
87
|
-
/** 128-10240. Default
|
|
145
|
+
/** 128-10240. Default: the worker's `memoryMb`. */
|
|
88
146
|
memoryMb?: number;
|
|
89
147
|
}
|
|
90
|
-
/**
|
|
91
|
-
export interface
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
148
|
+
/** How often a failed run is tried again, for every kind of handler. */
|
|
149
|
+
export interface RetryConfig {
|
|
150
|
+
/**
|
|
151
|
+
* Runs before the job goes to the stage's dead-letter queue, 1-100: the
|
|
152
|
+
* first, then retries 1, 2, 4 … minutes apart (at most an hour). Default 5
|
|
153
|
+
* for queues, 3 for events and crons.
|
|
154
|
+
*/
|
|
155
|
+
maxAttempts?: number;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Declare one with `queue<Body>({ ... })` to type what is sent and received.
|
|
159
|
+
* Each message is one run of its handler, at least once and in no set order.
|
|
160
|
+
*/
|
|
161
|
+
export interface QueueConfig<Body = unknown> extends Payload<Body>, HandlerConfig, RetryConfig {
|
|
162
|
+
/**
|
|
163
|
+
* At most this many runs at once, 1-1000. Setting it runs the handler in a
|
|
164
|
+
* function of its own with that much reserved Lambda concurrency; messages
|
|
165
|
+
* past it wait (up to six hours) instead of failing.
|
|
166
|
+
*/
|
|
99
167
|
concurrency?: number;
|
|
100
168
|
}
|
|
169
|
+
/** Event handler options. */
|
|
170
|
+
export type EventOptions = HandlerConfig & RetryConfig;
|
|
101
171
|
/** Declare one with `event<Detail>()` to type what is published and handled. */
|
|
102
|
-
export type EventConfig<Detail = unknown> = Payload<Detail
|
|
103
|
-
/**
|
|
104
|
-
|
|
172
|
+
export type EventConfig<Detail = unknown> = Payload<Detail> & EventOptions;
|
|
173
|
+
/**
|
|
174
|
+
* 5-field cron in UTC (`0 3 * * *`) or `rate(5 minutes)`; the object form adds
|
|
175
|
+
* a timezone or the handler's own settings.
|
|
176
|
+
*/
|
|
177
|
+
export type CronConfig = string | CronSchedule;
|
|
178
|
+
export interface CronSchedule extends HandlerConfig, RetryConfig {
|
|
105
179
|
schedule: string;
|
|
180
|
+
/** IANA name, e.g. `America/Los_Angeles`. Default UTC. */
|
|
106
181
|
timezone?: string;
|
|
107
|
-
}
|
|
182
|
+
}
|
|
183
|
+
/** Declare one with `channel<Event>()` to type what is published and received. */
|
|
184
|
+
export type ChannelConfig<Event = unknown> = Payload<Event>;
|
|
185
|
+
/** A file store. `{}` is a private store whose files are kept until deleted. */
|
|
186
|
+
export interface StoreConfig {
|
|
187
|
+
/**
|
|
188
|
+
* Serve the store's files from the edge at `/__platform/storage/<store>/<key>`
|
|
189
|
+
* on the app's host, to anyone with the URL (`auth.required` doesn't cover
|
|
190
|
+
* it), with no server in the path. Files are cached as their `cacheControl`
|
|
191
|
+
* says; without one, browsers revalidate on each use. Default `false`.
|
|
192
|
+
*/
|
|
193
|
+
public?: boolean;
|
|
194
|
+
/** Delete files not written for this many days, 1-3650. Checked daily. Default: kept until deleted. */
|
|
195
|
+
expireAfterDays?: number;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* A long-running process: it holds connections open (WebSocket or
|
|
199
|
+
* server-sent-event sources) and writes what it receives to the db, storage,
|
|
200
|
+
* queues or realtime. One instance per stage, restarted when it crashes and
|
|
201
|
+
* replaced on each deploy. Unlike everything else it is billed while it runs:
|
|
202
|
+
* about $6 a month at the default size on Spot.
|
|
203
|
+
*/
|
|
204
|
+
export interface ServiceConfig {
|
|
205
|
+
/** Module whose default export is `defineService(...)` from `@ericminassian/platform`. */
|
|
206
|
+
entry: string;
|
|
207
|
+
/** vCPUs: 0.25 (default), 0.5, 1, 2 or 4. */
|
|
208
|
+
cpu?: FargateCpu;
|
|
209
|
+
/**
|
|
210
|
+
* Memory in MB, one of the sizes Fargate pairs with `cpu`: 512, 1024 or
|
|
211
|
+
* 2048 for 0.25 vCPU; 1024-4096 for 0.5; 2048-8192 for 1; 4096-16384 for 2;
|
|
212
|
+
* 8192-30720 for 4 (steps of 1024). Default 512.
|
|
213
|
+
*/
|
|
214
|
+
memoryMb?: number;
|
|
215
|
+
/**
|
|
216
|
+
* Run on Fargate Spot, about 70% cheaper. AWS may reclaim it with two
|
|
217
|
+
* minutes' notice (the service gets SIGTERM) and the platform starts a
|
|
218
|
+
* replacement. Default `true`.
|
|
219
|
+
*/
|
|
220
|
+
spot?: boolean;
|
|
221
|
+
/** Minutes a preview stage runs it after each deploy before stopping it; 0 means never. Default 30. */
|
|
222
|
+
previewMinutes?: number;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Live updates pushed to browsers. The server and worker publish; browsers
|
|
226
|
+
* subscribe (they never publish). Events aren't stored: a browser that was
|
|
227
|
+
* away re-reads what it shows after reconnecting.
|
|
228
|
+
*/
|
|
229
|
+
export interface RealtimeConfig {
|
|
230
|
+
/**
|
|
231
|
+
* Who may subscribe: anyone (`public`, the default), or signed-in users of
|
|
232
|
+
* this app (`signed-in`, needs `auth` and `web.server`).
|
|
233
|
+
*/
|
|
234
|
+
subscribe?: 'public' | 'signed-in';
|
|
235
|
+
/**
|
|
236
|
+
* Channels and their event types: `board: channel<BoardEvent>()`, or
|
|
237
|
+
* `'boards/*': channel<BoardEvent>()` for every channel below `boards/`.
|
|
238
|
+
* Names are 1-4 segments of a-z, 0-9 and hyphens. `'user/*'` channels
|
|
239
|
+
* (`user/<user id>/...`) are private to that user (`signed-in` only).
|
|
240
|
+
*/
|
|
241
|
+
channels: {
|
|
242
|
+
readonly [pattern: string]: ChannelConfig;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Transactional email, sent from `<app>@mail.<platform zone>` (previews from
|
|
247
|
+
* `<app>--<stage>@…`). Replies need `replyTo`: the sending address takes no mail.
|
|
248
|
+
*/
|
|
249
|
+
export interface EmailConfig {
|
|
250
|
+
/** Display name recipients see, e.g. `Todo` → `"Todo" <todo@mail…>`. */
|
|
251
|
+
name?: string;
|
|
252
|
+
/**
|
|
253
|
+
* Recipients per UTC day (default 200), up to the platform's
|
|
254
|
+
* `limits.emailsPerDay`. Previews and `plat dev` get at most 50.
|
|
255
|
+
*/
|
|
256
|
+
dailyLimit?: number;
|
|
257
|
+
}
|
|
108
258
|
export interface AppConfig {
|
|
109
259
|
/** 3-30 chars of a-z, 0-9 and single hyphens; also the app's host name. */
|
|
110
260
|
name: string;
|
|
@@ -130,14 +280,29 @@ export interface AppConfig {
|
|
|
130
280
|
crons?: {
|
|
131
281
|
readonly [name: string]: CronConfig;
|
|
132
282
|
};
|
|
133
|
-
/**
|
|
134
|
-
|
|
283
|
+
/**
|
|
284
|
+
* Named file stores: `{ uploads: {}, snapshots: { public: true, expireAfterDays: 7 } }`.
|
|
285
|
+
* A list of names (`['uploads']`) declares private stores. Keys are 1-20
|
|
286
|
+
* chars of a-z, 0-9 and hyphens. A store can't switch between public and
|
|
287
|
+
* private once it has files: declare a new one instead.
|
|
288
|
+
*/
|
|
289
|
+
storage?: readonly string[] | {
|
|
290
|
+
readonly [name: string]: StoreConfig;
|
|
291
|
+
};
|
|
135
292
|
/** Secret names like `STRIPE_KEY`; values are set with `plat secrets set`. */
|
|
136
293
|
secrets?: readonly string[];
|
|
137
294
|
/** Plain, non-secret configuration exposed as environment variables. */
|
|
138
295
|
env?: {
|
|
139
296
|
readonly [name: string]: string;
|
|
140
297
|
};
|
|
298
|
+
/** Live updates pushed to browsers on typed channels. */
|
|
299
|
+
realtime?: RealtimeConfig;
|
|
300
|
+
/** Send email with the SDK's `Email` service: `true`, or `{ name, dailyLimit }`. */
|
|
301
|
+
email?: boolean | EmailConfig;
|
|
302
|
+
/** Long-running processes, e.g. stream ingest. Keys are 1-20 chars of a-z, 0-9 and hyphens. */
|
|
303
|
+
services?: {
|
|
304
|
+
readonly [name: string]: ServiceConfig;
|
|
305
|
+
};
|
|
141
306
|
}
|
|
142
307
|
/**
|
|
143
308
|
* Maps every key `T` has but `Shape` doesn't to `never`, recursively, so a
|
|
@@ -153,10 +318,12 @@ type Exact<T, Shape> = Shape extends readonly (infer S)[] ? T extends readonly (
|
|
|
153
318
|
* store and secret names (and payload types) are checked in app code.
|
|
154
319
|
*/
|
|
155
320
|
export declare function defineApp<const T extends AppConfig>(config: T & Exact<T, AppConfig>): T;
|
|
156
|
-
/** A queue whose messages are `Body`: `queues: { emails: queue<EmailJob>({
|
|
321
|
+
/** A queue whose messages are `Body`: `queues: { emails: queue<EmailJob>({ maxAttempts: 3 }) }`. */
|
|
157
322
|
export declare function queue<Body>(options?: QueueConfig): QueueConfig<Body>;
|
|
158
323
|
/** An event subscription whose detail is `Detail`: `events: { 'todo.created': event<TodoCreated>() }`. */
|
|
159
|
-
export declare function event<Detail>(): EventConfig<Detail>;
|
|
324
|
+
export declare function event<Detail>(options?: EventOptions): EventConfig<Detail>;
|
|
325
|
+
/** A realtime channel whose events are `Event`: `realtime: { channels: { board: channel<BoardEvent>() } }`. */
|
|
326
|
+
export declare function channel<Event>(): ChannelConfig<Event>;
|
|
160
327
|
/**
|
|
161
328
|
* Manifest with defaults applied and derived fields normalized: what
|
|
162
329
|
* deployments store. Decoding fills defaults for fields added since a stored
|
|
@@ -177,6 +344,9 @@ export declare const ResolvedManifest: Schema.Struct<{
|
|
|
177
344
|
readonly serverRoutes: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
178
345
|
readonly timeoutSeconds: Schema.withDecodingDefault<Schema.Int, never>;
|
|
179
346
|
readonly concurrency: Schema.withDecodingDefault<Schema.Int, never>;
|
|
347
|
+
readonly compute: Schema.withDecodingDefault<Schema.Literals<readonly ["auto", "request", "instance"]>, never>;
|
|
348
|
+
readonly memoryMb: Schema.withDecodingDefault<Schema.Int, never>;
|
|
349
|
+
readonly maxEnvironments: Schema.optional<Schema.Int>;
|
|
180
350
|
}>>;
|
|
181
351
|
/** Present when any queue, event subscription or cron exists. */
|
|
182
352
|
readonly worker: Schema.optional<Schema.Struct<{
|
|
@@ -190,19 +360,60 @@ export declare const ResolvedManifest: Schema.Struct<{
|
|
|
190
360
|
}>;
|
|
191
361
|
readonly db: Schema.Boolean;
|
|
192
362
|
readonly queues: Schema.$Record<Schema.String, Schema.Struct<{
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
363
|
+
timeoutSeconds: Schema.optional<Schema.Int>;
|
|
364
|
+
memoryMb: Schema.optional<Schema.Int>;
|
|
365
|
+
maxAttempts: Schema.withDecodingDefault<Schema.Int, never>;
|
|
366
|
+
concurrency: Schema.optional<Schema.Int>;
|
|
197
367
|
}>>;
|
|
198
368
|
readonly events: Schema.$Array<Schema.String>;
|
|
369
|
+
/**
|
|
370
|
+
* Each event handler's own settings, by type. Absent from deployments
|
|
371
|
+
* recorded before handlers had any. A field of its own, so clients that
|
|
372
|
+
* know only `events` keep decoding manifests.
|
|
373
|
+
*/
|
|
374
|
+
readonly eventOptions: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Struct<{
|
|
375
|
+
readonly timeoutSeconds: Schema.optional<Schema.Int>;
|
|
376
|
+
readonly memoryMb: Schema.optional<Schema.Int>;
|
|
377
|
+
readonly maxAttempts: Schema.optional<Schema.Int>;
|
|
378
|
+
}>>, never>;
|
|
199
379
|
readonly crons: Schema.$Record<Schema.String, Schema.Struct<{
|
|
380
|
+
readonly timeoutSeconds: Schema.optional<Schema.Int>;
|
|
381
|
+
readonly memoryMb: Schema.optional<Schema.Int>;
|
|
200
382
|
readonly schedule: Schema.String;
|
|
201
383
|
readonly timezone: Schema.optional<Schema.String>;
|
|
384
|
+
readonly maxAttempts: Schema.optional<Schema.Int>;
|
|
202
385
|
}>>;
|
|
386
|
+
/** Every store's name. */
|
|
203
387
|
readonly storage: Schema.$Array<Schema.String>;
|
|
388
|
+
/**
|
|
389
|
+
* Each store's options, by name. Absent from deployments recorded before
|
|
390
|
+
* stores had any: those stores are private and kept until deleted. A field
|
|
391
|
+
* of its own, so clients that know only `storage` keep decoding manifests.
|
|
392
|
+
*/
|
|
393
|
+
readonly storageOptions: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Struct<{
|
|
394
|
+
readonly public: Schema.Boolean;
|
|
395
|
+
readonly expireAfterDays: Schema.optional<Schema.Finite>;
|
|
396
|
+
}>>, never>;
|
|
204
397
|
readonly secrets: Schema.$Array<Schema.String>;
|
|
205
398
|
readonly env: Schema.$Record<Schema.String, Schema.String>;
|
|
399
|
+
/** Present when the stage has a channel namespace. `channels` are the declared patterns. */
|
|
400
|
+
readonly realtime: Schema.optional<Schema.Struct<{
|
|
401
|
+
readonly subscribe: Schema.Literals<readonly ["public", "signed-in"]>;
|
|
402
|
+
readonly channels: Schema.$Array<Schema.String>;
|
|
403
|
+
}>>;
|
|
404
|
+
/** Present when the stage sends email. `dailyLimit` is the declared one (prod's). */
|
|
405
|
+
readonly email: Schema.optional<Schema.Struct<{
|
|
406
|
+
readonly name: Schema.optional<Schema.String>;
|
|
407
|
+
readonly dailyLimit: Schema.Finite;
|
|
408
|
+
}>>;
|
|
409
|
+
/** Long-running services, with defaults applied. */
|
|
410
|
+
readonly services: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.Struct<{
|
|
411
|
+
readonly entry: Schema.String;
|
|
412
|
+
readonly cpu: Schema.withDecodingDefault<Schema.Literals<readonly [0.25, 0.5, 1, 2, 4]>, never>;
|
|
413
|
+
readonly memoryMb: Schema.withDecodingDefault<Schema.Int, never>;
|
|
414
|
+
readonly spot: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
415
|
+
readonly previewMinutes: Schema.withDecodingDefault<Schema.Int, never>;
|
|
416
|
+
}>>, never>;
|
|
206
417
|
}>;
|
|
207
418
|
export type ResolvedManifest = typeof ResolvedManifest.Type;
|
|
208
419
|
export declare class ManifestError extends Error {
|
|
@@ -211,4 +422,34 @@ export declare class ManifestError extends Error {
|
|
|
211
422
|
}
|
|
212
423
|
export declare function parseManifest(input: unknown): ResolvedManifest;
|
|
213
424
|
export declare function resolveManifest(m: Manifest): ResolvedManifest;
|
|
425
|
+
/** The stores the edge serves (`public: true`). */
|
|
426
|
+
export declare function publicStores(m: Pick<ResolvedManifest, 'storage' | 'storageOptions'>): string[];
|
|
427
|
+
declare const HANDLER_KINDS: readonly ['queue', 'event', 'cron'];
|
|
428
|
+
export type HandlerKind = (typeof HANDLER_KINDS)[number];
|
|
429
|
+
/** A queue, event or cron handler and the settings it runs with. */
|
|
430
|
+
export interface HandlerSettings {
|
|
431
|
+
kind: HandlerKind;
|
|
432
|
+
/** The queue or cron key, or the event type. */
|
|
433
|
+
name: string;
|
|
434
|
+
timeoutSeconds: number;
|
|
435
|
+
memoryMb: number;
|
|
436
|
+
/** Runs before its job is dead-lettered. */
|
|
437
|
+
maxAttempts: number;
|
|
438
|
+
/** Reserved concurrency of its function (queues that set `concurrency`). */
|
|
439
|
+
concurrency?: number;
|
|
440
|
+
/**
|
|
441
|
+
* It sets its own memory, timeout or (a queue) concurrency, so it runs in a
|
|
442
|
+
* function of its own (`names.handlerFunction`).
|
|
443
|
+
*/
|
|
444
|
+
own: boolean;
|
|
445
|
+
}
|
|
446
|
+
type WorkerManifest = Pick<ResolvedManifest, 'worker' | 'queues' | 'eventOptions' | 'crons'>;
|
|
447
|
+
/** A handler's settings: its own, and the worker's for any it doesn't set. */
|
|
448
|
+
export declare function handlerSettings(m: WorkerManifest, kind: HandlerKind, name: string): HandlerSettings;
|
|
449
|
+
/** Every queue, event and cron handler with its settings. */
|
|
450
|
+
export declare function workerHandlers(m: WorkerManifest): HandlerSettings[];
|
|
451
|
+
/** The handlers that run in functions of their own. The worker's function runs the rest. */
|
|
452
|
+
export declare function ownFunctionHandlers(m: WorkerManifest): HandlerSettings[];
|
|
453
|
+
/** The Lambda function a handler runs in: its own, or the worker's. */
|
|
454
|
+
export declare function handlerFunctionName(app: string, stage: string, m: WorkerManifest, kind: HandlerKind, name: string): string;
|
|
214
455
|
export {};
|