@ericminassian/platform-core 0.2.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.
Files changed (89) hide show
  1. package/dist/api.d.ts +1847 -212
  2. package/dist/api.js +694 -1
  3. package/dist/api.js.map +1 -1
  4. package/dist/auth.d.ts +19 -0
  5. package/dist/auth.js +32 -0
  6. package/dist/auth.js.map +1 -1
  7. package/dist/base64url.d.ts +3 -0
  8. package/dist/base64url.js +15 -0
  9. package/dist/base64url.js.map +1 -0
  10. package/dist/bindings.d.ts +69 -13
  11. package/dist/bindings.js +1 -1
  12. package/dist/bindings.js.map +1 -1
  13. package/dist/cloudfront-function.d.ts +5 -1
  14. package/dist/cloudfront-function.js +70 -2
  15. package/dist/cloudfront-function.js.map +1 -1
  16. package/dist/compute.d.ts +52 -0
  17. package/dist/compute.js +65 -0
  18. package/dist/compute.js.map +1 -0
  19. package/dist/config.d.ts +21 -1
  20. package/dist/config.js +16 -0
  21. package/dist/config.js.map +1 -1
  22. package/dist/constants.d.ts +67 -1
  23. package/dist/constants.js +56 -1
  24. package/dist/constants.js.map +1 -1
  25. package/dist/email.d.ts +84 -0
  26. package/dist/email.js +111 -0
  27. package/dist/email.js.map +1 -0
  28. package/dist/fingerprint.d.ts +9 -0
  29. package/dist/fingerprint.js +19 -0
  30. package/dist/fingerprint.js.map +1 -0
  31. package/dist/index.d.ts +6 -0
  32. package/dist/index.js +6 -0
  33. package/dist/index.js.map +1 -1
  34. package/dist/jobs.d.ts +111 -0
  35. package/dist/jobs.js +214 -0
  36. package/dist/jobs.js.map +1 -0
  37. package/dist/manifest.d.ts +357 -112
  38. package/dist/manifest.js +270 -72
  39. package/dist/manifest.js.map +1 -1
  40. package/dist/naming.d.ts +93 -6
  41. package/dist/naming.js +98 -6
  42. package/dist/naming.js.map +1 -1
  43. package/dist/platform-api.d.ts +7792 -0
  44. package/dist/platform-api.js +455 -0
  45. package/dist/platform-api.js.map +1 -0
  46. package/dist/realtime.d.ts +139 -0
  47. package/dist/realtime.js +201 -0
  48. package/dist/realtime.js.map +1 -0
  49. package/dist/router/decide.d.ts +7 -1
  50. package/dist/router/decide.js +42 -5
  51. package/dist/router.d.ts +35 -13
  52. package/dist/router.js +36 -0
  53. package/dist/router.js.map +1 -1
  54. package/dist/runtime-config.d.ts +57 -0
  55. package/dist/runtime-config.js +12 -0
  56. package/dist/runtime-config.js.map +1 -1
  57. package/dist/storage.d.ts +55 -0
  58. package/dist/storage.js +112 -0
  59. package/dist/storage.js.map +1 -0
  60. package/dist/telemetry.d.ts +350 -83
  61. package/dist/telemetry.js +188 -15
  62. package/dist/telemetry.js.map +1 -1
  63. package/dist/web-compute.d.ts +191 -0
  64. package/dist/web-compute.js +257 -0
  65. package/dist/web-compute.js.map +1 -0
  66. package/package.json +28 -8
  67. package/src/api.ts +864 -238
  68. package/src/auth.ts +37 -0
  69. package/src/base64url.ts +13 -0
  70. package/src/bindings.ts +74 -7
  71. package/src/cloudfront-function.ts +70 -2
  72. package/src/compute.ts +86 -0
  73. package/src/config.ts +34 -2
  74. package/src/constants.ts +76 -1
  75. package/src/email.ts +168 -0
  76. package/src/fingerprint.ts +20 -0
  77. package/src/index.ts +6 -0
  78. package/src/jobs.ts +281 -0
  79. package/src/manifest.ts +542 -114
  80. package/src/naming.ts +103 -8
  81. package/src/platform-api.ts +630 -0
  82. package/src/realtime.ts +298 -0
  83. package/src/router/decide.d.ts +7 -1
  84. package/src/router/decide.js +42 -5
  85. package/src/router.ts +33 -13
  86. package/src/runtime-config.ts +70 -0
  87. package/src/storage.ts +120 -0
  88. package/src/telemetry.ts +198 -93
  89. package/src/web-compute.ts +342 -0
package/dist/manifest.js CHANGED
@@ -1,6 +1,11 @@
1
- import { z } from 'zod';
1
+ import { Effect, Schema } from 'effect';
2
+ import { FARGATE_CPUS, fargateSizeIssue } from './compute.js';
2
3
  import { validateCron } from './cron.js';
3
- import { APP_NAME_PATTERN, ENV_NAME_PATTERN, EVENT_TYPE_PATTERN, RESOURCE_KEY_PATTERN } from './naming.js';
4
+ import { EMAIL_DEFAULT_DAILY_LIMIT, EMAIL_NAME_MESSAGE, EMAIL_NAME_PATTERN } from './email.js';
5
+ import { DEFAULT_ATTEMPTS, MAX_ATTEMPTS } from './jobs.js';
6
+ import { APP_NAME_PATTERN, ENV_NAME_PATTERN, EVENT_TYPE_PATTERN, names, RESOURCE_KEY_PATTERN, } from './naming.js';
7
+ import { CHANNEL_DECLARATION_PATTERN, CHANNEL_MESSAGE, realtimeIssues } from './realtime.js';
8
+ import { WEB_COMPUTE_SETTINGS, WEB_REQUEST_MEMORY_MB } from './web-compute.js';
4
9
  /**
5
10
  * The app's config file, at the app root. `plat` evaluates it and sends the
6
11
  * result to the platform as JSON; the control plane never runs app code.
@@ -15,61 +20,138 @@ export const APP_CONFIG_FILE = 'plat.config.ts';
15
20
  * below is the same shape written for authors. `test/manifest-types.test.ts`
16
21
  * keeps the two in step.
17
22
  */
18
- const resourceKey = z.string().regex(RESOURCE_KEY_PATTERN, 'must be 1-20 chars of a-z, 0-9, hyphens');
19
- const eventType = z.string().regex(EVENT_TYPE_PATTERN);
20
- const WebSchema = z
21
- .object({
22
- server: z.string().optional(),
23
- static: z.string().optional(),
24
- build: z.string().optional(),
25
- dev: z.object({ command: z.string(), port: z.number().int().positive() }).optional(),
26
- spa: z.boolean().default(true),
27
- serverRoutes: z.array(z.string().startsWith('/')).default(['/api/']),
28
- timeoutSeconds: z.number().int().min(3).max(900).default(30),
29
- concurrency: z.number().int().min(1).max(128).default(64),
30
- })
31
- .refine((w) => w.server || w.static, { message: 'web needs a server, a static directory, or both' });
32
- const WorkerSchema = z.object({
33
- entry: z.string().default('src/worker.ts'),
34
- timeoutSeconds: z.number().int().min(1).max(900).default(60),
35
- memoryMb: z.number().int().min(128).max(10240).default(512),
23
+ const RESOURCE_KEY_MESSAGE = 'must be 1-20 chars of a-z, 0-9, hyphens';
24
+ const resourceKey = Schema.String.check(Schema.isPattern(RESOURCE_KEY_PATTERN, { message: RESOURCE_KEY_MESSAGE }));
25
+ const eventType = Schema.String.check(Schema.isPattern(EVENT_TYPE_PATTERN));
26
+ const envName = Schema.String.check(Schema.isPattern(ENV_NAME_PATTERN));
27
+ /**
28
+ * A record whose keys must match `pattern`. `Schema.Record` drops keys that fail
29
+ * its key schema, which would make a misnamed queue silently disappear, so
30
+ * keys are checked here and reported at their path instead.
31
+ */
32
+ const recordOf = (pattern, value, message = `must match ${pattern}`) => Schema.Record(Schema.String, value).check(Schema.makeFilter((record) => Object.keys(record)
33
+ .filter((key) => !pattern.test(key))
34
+ .map((key) => ({ path: [key], issue: message }))));
35
+ const intBetween = (minimum, maximum) => Schema.Int.check(Schema.isBetween({ minimum, maximum }));
36
+ /** Absent (or `undefined`) decodes to `value`. */
37
+ const orElse = (value) => (schema) => schema.pipe(Schema.withDecodingDefault(Effect.succeed(value)));
38
+ const WebSchema = Schema.Struct({
39
+ server: Schema.optional(Schema.String),
40
+ static: Schema.optional(Schema.String),
41
+ build: Schema.optional(Schema.String),
42
+ dev: Schema.optional(Schema.Struct({ command: Schema.String, port: Schema.optional(intBetween(1, 65535)) })),
43
+ spa: Schema.Boolean.pipe(orElse(true)),
44
+ serverRoutes: Schema.Array(Schema.String.check(Schema.isStartingWith('/'))).pipe(orElse(['/api/'])),
45
+ timeoutSeconds: intBetween(3, 900).pipe(orElse(30)),
46
+ concurrency: intBetween(1, 128).pipe(orElse(64)),
47
+ compute: Schema.Literals(WEB_COMPUTE_SETTINGS).pipe(orElse('auto')),
48
+ memoryMb: intBetween(128, 10240).pipe(orElse(WEB_REQUEST_MEMORY_MB)),
49
+ maxEnvironments: Schema.optional(intBetween(2, 10000)),
50
+ }).check(Schema.makeFilter((w) => w.server || w.static ? undefined : 'web needs a server, a static directory, or both'));
51
+ const WORKER_TIMEOUT_SECONDS = 60;
52
+ const WORKER_MEMORY_MB = 512;
53
+ const timeoutSeconds = intBetween(1, 900);
54
+ const memoryMb = intBetween(128, 10240);
55
+ const WorkerSchema = Schema.Struct({
56
+ entry: Schema.String.pipe(orElse('src/worker.ts')),
57
+ timeoutSeconds: timeoutSeconds.pipe(orElse(WORKER_TIMEOUT_SECONDS)),
58
+ memoryMb: memoryMb.pipe(orElse(WORKER_MEMORY_MB)),
59
+ });
60
+ /** A queue, event or cron handler's own settings; unset ones are the worker's. */
61
+ const HandlerFields = {
62
+ timeoutSeconds: Schema.optional(timeoutSeconds),
63
+ memoryMb: Schema.optional(memoryMb),
64
+ };
65
+ const attempts = intBetween(1, MAX_ATTEMPTS);
66
+ /** An event handler's settings. Unset attempts are `DEFAULT_ATTEMPTS.event`. */
67
+ const HandlerSchema = Schema.Struct({ ...HandlerFields, maxAttempts: Schema.optional(attempts) });
68
+ const QueueFields = {
69
+ maxAttempts: attempts.pipe(orElse(DEFAULT_ATTEMPTS.queue)),
70
+ concurrency: Schema.optional(intBetween(1, 1000)),
71
+ ...HandlerFields,
72
+ };
73
+ /** A field that was removed: present at all, it fails with `message`. */
74
+ const removed = (message) => Schema.optional(Schema.Unknown.check(Schema.makeFilter(() => message)));
75
+ // Queues were SQS queues polled by Lambda until 0.4.0; these settings had no meaning after.
76
+ const QueueSchema = Schema.Struct({
77
+ ...QueueFields,
78
+ batchSize: removed('removed in 0.4.0: a queue delivers one message per run'),
79
+ visibilityTimeoutSeconds: removed("removed in 0.4.0: a run has its handler's timeoutSeconds"),
80
+ maxReceiveCount: removed('renamed to maxAttempts in 0.4.0'),
36
81
  });
37
- const QueueSchema = z.object({
38
- batchSize: z.number().int().min(1).max(10).default(10),
39
- visibilityTimeoutSeconds: z.number().int().min(0).max(43200).optional(),
40
- maxReceiveCount: z.number().int().min(1).max(1000).default(5),
41
- concurrency: z.number().int().min(2).max(1000).optional(),
82
+ const CronScheduleSchema = Schema.Struct({
83
+ schedule: Schema.String,
84
+ timezone: Schema.optional(Schema.String),
85
+ maxAttempts: Schema.optional(attempts),
86
+ ...HandlerFields,
42
87
  });
43
- const CronSchema = z.union([z.string(), z.object({ schedule: z.string(), timezone: z.string().optional() })]);
44
- const AuthSchema = z.union([z.boolean(), z.object({ required: z.boolean().default(false) })]);
45
- export const ManifestSchema = z
46
- .object({
47
- name: z
48
- .string()
49
- // Reserved names are enforced when an app is registered (API), not here:
50
- // the control plane itself is the app named `platform`.
51
- .regex(APP_NAME_PATTERN, 'must be 3-30 chars of a-z, 0-9, single hyphens'),
52
- description: z.string().max(200).optional(),
53
- web: WebSchema.optional(),
54
- worker: WorkerSchema.optional(),
55
- auth: AuthSchema.default(false),
56
- db: z.boolean().default(false),
57
- queues: z.record(resourceKey, QueueSchema).default({}),
88
+ const CronSchema = Schema.Union([Schema.String, CronScheduleSchema]).check(Schema.makeFilter((cron) => validateCron(typeof cron === 'string' ? cron : cron.schedule) ?? undefined));
89
+ const AuthSchema = Schema.Union([
90
+ Schema.Boolean,
91
+ Schema.Struct({ required: Schema.Boolean.pipe(orElse(false)) }),
92
+ ]);
93
+ const StoreSchema = Schema.Struct({
94
+ public: Schema.Boolean.pipe(orElse(false)),
95
+ expireAfterDays: Schema.optional(intBetween(1, 3650)),
96
+ });
97
+ const ServiceSchema = Schema.Struct({
98
+ entry: Schema.String,
99
+ cpu: Schema.Literals(FARGATE_CPUS).pipe(orElse(0.25)),
100
+ memoryMb: Schema.Int.pipe(orElse(512)),
101
+ spot: Schema.Boolean.pipe(orElse(true)),
102
+ previewMinutes: intBetween(0, 1440).pipe(orElse(30)),
103
+ }).check(Schema.makeFilter((s) => {
104
+ const issue = fargateSizeIssue(s.cpu, s.memoryMb);
105
+ return issue ? [{ path: ['memoryMb'], issue }] : undefined;
106
+ }));
107
+ const RealtimeSubscribeSchema = Schema.Literals(['public', 'signed-in']);
108
+ const EmailSchema = Schema.Union([
109
+ Schema.Boolean,
110
+ Schema.Struct({
111
+ name: Schema.optional(Schema.String.check(Schema.isPattern(EMAIL_NAME_PATTERN, { message: EMAIL_NAME_MESSAGE }))),
112
+ // The platform's ceiling (`limits.emailsPerDay`) is checked when a deployment is created.
113
+ dailyLimit: Schema.optional(intBetween(1, 1_000_000)),
114
+ }),
115
+ ]);
116
+ const RealtimeSchema = Schema.Struct({
117
+ subscribe: RealtimeSubscribeSchema.pipe(orElse('public')),
118
+ channels: recordOf(CHANNEL_DECLARATION_PATTERN, Schema.Struct({}), CHANNEL_MESSAGE),
119
+ });
120
+ export const ManifestSchema = Schema.Struct({
121
+ // Reserved names are enforced when an app is registered (API), not here:
122
+ // the control plane itself is the app named `platform`.
123
+ name: Schema.String.check(Schema.isPattern(APP_NAME_PATTERN, { message: 'must be 3-30 chars of a-z, 0-9, single hyphens' })),
124
+ description: Schema.optional(Schema.String.check(Schema.isMaxLength(200))),
125
+ web: Schema.optional(WebSchema),
126
+ worker: Schema.optional(WorkerSchema),
127
+ auth: AuthSchema.pipe(orElse(false)),
128
+ db: Schema.Boolean.pipe(orElse(false)),
129
+ queues: recordOf(RESOURCE_KEY_PATTERN, QueueSchema, RESOURCE_KEY_MESSAGE).pipe(orElse({})),
58
130
  // The array form predates typed event payloads; deployments recorded
59
131
  // before then still store it.
60
- events: z.union([z.array(eventType), z.record(eventType, z.object({}))]).default([]),
61
- crons: z.record(resourceKey, CronSchema).default({}),
62
- storage: z.array(resourceKey).default([]),
63
- secrets: z.array(z.string().regex(ENV_NAME_PATTERN)).default([]),
64
- env: z.record(z.string().regex(ENV_NAME_PATTERN), z.string()).default({}),
65
- })
66
- .superRefine((m, ctx) => {
67
- for (const [key, cron] of Object.entries(m.crons)) {
68
- const err = validateCron(typeof cron === 'string' ? cron : cron.schedule);
69
- if (err)
70
- ctx.addIssue({ code: 'custom', path: ['crons', key], message: err });
71
- }
72
- });
132
+ events: Schema.Union([Schema.Array(eventType), recordOf(EVENT_TYPE_PATTERN, HandlerSchema)]).pipe(orElse([])),
133
+ crons: recordOf(RESOURCE_KEY_PATTERN, CronSchema, RESOURCE_KEY_MESSAGE).pipe(orElse({})),
134
+ // The array form (every store private, kept forever) is still accepted.
135
+ storage: Schema.Union([
136
+ Schema.Array(resourceKey),
137
+ recordOf(RESOURCE_KEY_PATTERN, StoreSchema, RESOURCE_KEY_MESSAGE),
138
+ ]).pipe(orElse([])),
139
+ secrets: Schema.Array(envName).pipe(orElse([])),
140
+ env: recordOf(ENV_NAME_PATTERN, Schema.String).pipe(orElse({})),
141
+ realtime: Schema.optional(RealtimeSchema),
142
+ email: EmailSchema.pipe(orElse(false)),
143
+ services: recordOf(RESOURCE_KEY_PATTERN, ServiceSchema, RESOURCE_KEY_MESSAGE).pipe(orElse({})),
144
+ }).check(Schema.makeFilter((m) => {
145
+ if (!m.realtime)
146
+ return undefined;
147
+ const issues = realtimeIssues({
148
+ subscribe: m.realtime.subscribe,
149
+ channels: Object.keys(m.realtime.channels),
150
+ auth: m.auth !== false,
151
+ server: Boolean(m.web?.server),
152
+ });
153
+ return issues.map((i) => ({ path: ['realtime', ...i.path], issue: i.message }));
154
+ }));
73
155
  /**
74
156
  * The default export of `plat.config.ts`. Returns the config unchanged with
75
157
  * its literal names, which `Register` hands to the SDK so queue, event, cron,
@@ -78,14 +160,58 @@ export const ManifestSchema = z
78
160
  export function defineApp(config) {
79
161
  return config;
80
162
  }
81
- /** A queue whose messages are `Body`: `queues: { emails: queue<EmailJob>({ batchSize: 5 }) }`. */
163
+ /** A queue whose messages are `Body`: `queues: { emails: queue<EmailJob>({ maxAttempts: 3 }) }`. */
82
164
  export function queue(options = {}) {
83
165
  return options;
84
166
  }
85
167
  /** An event subscription whose detail is `Detail`: `events: { 'todo.created': event<TodoCreated>() }`. */
86
- export function event() {
168
+ export function event(options = {}) {
169
+ return options;
170
+ }
171
+ /** A realtime channel whose events are `Event`: `realtime: { channels: { board: channel<BoardEvent>() } }`. */
172
+ export function channel() {
87
173
  return {};
88
174
  }
175
+ // ---------------------------------------------------------------------------
176
+ /**
177
+ * Manifest with defaults applied and derived fields normalized: what
178
+ * deployments store. Decoding fills defaults for fields added since a stored
179
+ * manifest was written, so earlier deployments keep decoding.
180
+ */
181
+ export const ResolvedManifest = Schema.Struct({
182
+ name: Schema.String,
183
+ description: Schema.optional(Schema.String),
184
+ web: Schema.optional(WebSchema),
185
+ /** Present when any queue, event subscription or cron exists. */
186
+ worker: Schema.optional(WorkerSchema),
187
+ auth: Schema.Struct({ enabled: Schema.Boolean, required: Schema.Boolean }),
188
+ db: Schema.Boolean,
189
+ queues: Schema.Record(Schema.String, Schema.Struct(QueueFields)),
190
+ events: Schema.Array(Schema.String),
191
+ /**
192
+ * Each event handler's own settings, by type. Absent from deployments
193
+ * recorded before handlers had any. A field of its own, so clients that
194
+ * know only `events` keep decoding manifests.
195
+ */
196
+ eventOptions: Schema.Record(Schema.String, HandlerSchema).pipe(orElse({})),
197
+ crons: Schema.Record(Schema.String, CronScheduleSchema),
198
+ /** Every store's name. */
199
+ storage: Schema.Array(Schema.String),
200
+ /**
201
+ * Each store's options, by name. Absent from deployments recorded before
202
+ * stores had any: those stores are private and kept until deleted. A field
203
+ * of its own, so clients that know only `storage` keep decoding manifests.
204
+ */
205
+ storageOptions: Schema.Record(Schema.String, Schema.Struct({ public: Schema.Boolean, expireAfterDays: Schema.optional(Schema.Finite) })).pipe(orElse({})),
206
+ secrets: Schema.Array(Schema.String),
207
+ env: Schema.Record(Schema.String, Schema.String),
208
+ /** Present when the stage has a channel namespace. `channels` are the declared patterns. */
209
+ realtime: Schema.optional(Schema.Struct({ subscribe: RealtimeSubscribeSchema, channels: Schema.Array(Schema.String) })),
210
+ /** Present when the stage sends email. `dailyLimit` is the declared one (prod's). */
211
+ email: Schema.optional(Schema.Struct({ name: Schema.optional(Schema.String), dailyLimit: Schema.Finite })),
212
+ /** Long-running services, with defaults applied. */
213
+ services: Schema.Record(Schema.String, ServiceSchema).pipe(orElse({})),
214
+ });
89
215
  export class ManifestError extends Error {
90
216
  issues;
91
217
  constructor(issues) {
@@ -93,30 +219,50 @@ export class ManifestError extends Error {
93
219
  this.issues = issues;
94
220
  }
95
221
  }
222
+ const validateManifest = Schema.toStandardSchemaV1(ManifestSchema, { parseOptions: { errors: 'all' } })['~standard'].validate;
96
223
  export function parseManifest(input) {
97
- const parsed = ManifestSchema.safeParse(input);
98
- if (!parsed.success) {
99
- throw new ManifestError(parsed.error.issues.map((i) => `${i.path.join('.') || '(root)'}: ${i.message}`));
224
+ const result = validateManifest(input);
225
+ // The schema has no asynchronous checks, so validation is synchronous.
226
+ if (result instanceof Promise)
227
+ throw new Error('manifest validation must be synchronous');
228
+ if (result.issues) {
229
+ throw new ManifestError(result.issues.map((i) => {
230
+ const path = (i.path ?? []).map((p) => String(typeof p === 'object' ? p.key : p)).join('.');
231
+ return `${path || '(root)'}: ${i.message}`;
232
+ }));
100
233
  }
101
- return resolveManifest(parsed.data);
234
+ return resolveManifest(result.value);
102
235
  }
103
236
  export function resolveManifest(m) {
104
- const events = Array.isArray(m.events) ? m.events : Object.keys(m.events);
237
+ const eventOptions = isEventList(m.events)
238
+ ? Object.fromEntries(m.events.map((type) => [type, {}]))
239
+ : m.events;
240
+ const events = Object.keys(eventOptions);
105
241
  const needsWorker = Object.keys(m.queues).length > 0 || events.length > 0 || Object.keys(m.crons).length > 0;
106
- const worker = m.worker ?? (needsWorker ? WorkerSchema.parse({}) : undefined);
242
+ const worker = m.worker ?? (needsWorker ? Schema.decodeUnknownSync(WorkerSchema)({}) : undefined);
107
243
  const auth = typeof m.auth === 'boolean'
108
244
  ? { enabled: m.auth, required: false }
109
245
  : { enabled: true, required: m.auth.required };
110
- const queues = {};
111
- for (const [key, q] of Object.entries(m.queues)) {
112
- queues[key] = {
113
- ...q,
114
- visibilityTimeoutSeconds: q.visibilityTimeoutSeconds ?? (worker?.timeoutSeconds ?? 60) * 6,
246
+ // Validation refused the removed queue settings, so only the current ones remain.
247
+ const queues = Object.fromEntries(Object.entries(m.queues).map(([key, q]) => [
248
+ key,
249
+ {
250
+ maxAttempts: q.maxAttempts,
251
+ ...(q.concurrency !== undefined ? { concurrency: q.concurrency } : {}),
252
+ ...(q.timeoutSeconds !== undefined ? { timeoutSeconds: q.timeoutSeconds } : {}),
253
+ ...(q.memoryMb !== undefined ? { memoryMb: q.memoryMb } : {}),
254
+ },
255
+ ]));
256
+ const email = m.email === false
257
+ ? undefined
258
+ : {
259
+ ...(m.email !== true && m.email.name ? { name: m.email.name } : {}),
260
+ dailyLimit: (m.email !== true && m.email.dailyLimit) || EMAIL_DEFAULT_DAILY_LIMIT,
115
261
  };
116
- }
117
- const crons = {};
118
- for (const [key, c] of Object.entries(m.crons))
119
- crons[key] = typeof c === 'string' ? { schedule: c } : c;
262
+ const crons = Object.fromEntries(Object.entries(m.crons).map(([key, c]) => [key, typeof c === 'string' ? { schedule: c } : c]));
263
+ const stores = isStoreList(m.storage)
264
+ ? Object.fromEntries(m.storage.map((name) => [name, { public: false }]))
265
+ : m.storage;
120
266
  return {
121
267
  name: m.name,
122
268
  ...(m.description ? { description: m.description } : {}),
@@ -125,11 +271,63 @@ export function resolveManifest(m) {
125
271
  auth,
126
272
  db: m.db,
127
273
  queues,
128
- events: [...new Set(events)],
274
+ events,
275
+ eventOptions,
129
276
  crons,
130
- storage: [...new Set(m.storage)],
277
+ storage: Object.keys(stores),
278
+ storageOptions: stores,
131
279
  secrets: [...new Set(m.secrets)],
132
280
  env: m.env,
281
+ ...(m.realtime
282
+ ? { realtime: { subscribe: m.realtime.subscribe, channels: Object.keys(m.realtime.channels) } }
283
+ : {}),
284
+ ...(email ? { email } : {}),
285
+ services: m.services,
286
+ };
287
+ }
288
+ const isStoreList = (storage) => Array.isArray(storage);
289
+ const isEventList = (events) => Array.isArray(events);
290
+ /** The stores the edge serves (`public: true`). */
291
+ export function publicStores(m) {
292
+ return m.storage.filter((name) => m.storageOptions[name]?.public === true);
293
+ }
294
+ // ---------------------------------------------------------------------------
295
+ // Worker functions
296
+ const HANDLER_KINDS = ['queue', 'event', 'cron'];
297
+ /** Each kind's handlers, by name, with what they set. */
298
+ const declaredHandlers = (m) => ({
299
+ queue: m.queues,
300
+ event: m.eventOptions,
301
+ cron: m.crons,
302
+ });
303
+ /** A handler's settings: its own, and the worker's for any it doesn't set. */
304
+ export function handlerSettings(m, kind, name) {
305
+ const own = declaredHandlers(m)[kind][name] ?? {};
306
+ // Reserved concurrency is per function, so a queue that caps it needs one to itself.
307
+ const concurrency = kind === 'queue' ? own.concurrency : undefined;
308
+ return {
309
+ kind,
310
+ name,
311
+ timeoutSeconds: own.timeoutSeconds ?? m.worker?.timeoutSeconds ?? WORKER_TIMEOUT_SECONDS,
312
+ memoryMb: own.memoryMb ?? m.worker?.memoryMb ?? WORKER_MEMORY_MB,
313
+ maxAttempts: own.maxAttempts ?? DEFAULT_ATTEMPTS[kind],
314
+ ...(concurrency !== undefined ? { concurrency } : {}),
315
+ own: own.timeoutSeconds !== undefined || own.memoryMb !== undefined || concurrency !== undefined,
133
316
  };
134
317
  }
318
+ /** Every queue, event and cron handler with its settings. */
319
+ export function workerHandlers(m) {
320
+ const declared = declaredHandlers(m);
321
+ return HANDLER_KINDS.flatMap((kind) => Object.keys(declared[kind]).map((name) => handlerSettings(m, kind, name)));
322
+ }
323
+ /** The handlers that run in functions of their own. The worker's function runs the rest. */
324
+ export function ownFunctionHandlers(m) {
325
+ return workerHandlers(m).filter((h) => h.own);
326
+ }
327
+ /** The Lambda function a handler runs in: its own, or the worker's. */
328
+ export function handlerFunctionName(app, stage, m, kind, name) {
329
+ return handlerSettings(m, kind, name).own
330
+ ? names.handlerFunction(app, stage, kind, name)
331
+ : names.workerFunction(app, stage);
332
+ }
135
333
  //# sourceMappingURL=manifest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE3G;;;GAGG;AACH,MAA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AC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAChD,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,mBAAmB,CACjC,GAAW,EACX,KAAa,EACb,CAAiB,EACjB,IAAiB,EACjB,IAAY;IAEZ,OAAO,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG;QACvC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC;QAC/C,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC"}
package/dist/naming.d.ts CHANGED
@@ -35,25 +35,80 @@ export declare function parseStageHost(host: string, domain: string): {
35
35
  export declare const names: {
36
36
  readonly base: (app: string, stage: string) => string;
37
37
  readonly table: (app: string, stage: string) => string;
38
+ /** The server's Lambda Web Function (instance mode). */
38
39
  readonly webFunction: (app: string, stage: string) => string;
39
- readonly webEndpoint: () => string;
40
+ /**
41
+ * The server's Lambda function in request mode. Not a worker function,
42
+ * though it shares their `<app>--<stage>--` prefix: a handler's own
43
+ * function is `…--worker--…`, or a cut of that ending in `-<hash>`.
44
+ */
45
+ readonly requestFunction: (app: string, stage: string) => string;
46
+ /**
47
+ * The Web Function's two endpoints, and the request-mode function's two
48
+ * aliases (each with a function URL), each pinned to one revision or
49
+ * version. Neither name means "current": a deploy uses whichever the live
50
+ * route doesn't (`live` predates the second one).
51
+ */
52
+ readonly webEndpoints: () => readonly ['live', 'live-b'];
40
53
  readonly workerFunction: (app: string, stage: string) => string;
54
+ /**
55
+ * The function a queue, event or cron handler with its own memory or timeout
56
+ * runs in, from the worker's bundle. Function names are ≤ 64 chars of
57
+ * A-Z, a-z, 0-9, `-` and `_`: long names are hashed, and an event type's
58
+ * `.` becomes `_` (which no event type contains). `:` has no such stand-in,
59
+ * so a type with one always carries a hash of the type.
60
+ */
61
+ readonly handlerFunction: (app: string, stage: string, kind: 'queue' | 'event' | 'cron', name: string) => string;
41
62
  /** IAM role name; created under {@link IAM_APP_PATH}. */
42
63
  readonly role: (app: string, stage: string) => string;
43
- readonly queue: (app: string, stage: string, key: string) => string;
44
- readonly deadLetterQueue: (app: string, stage: string, key: string) => string;
64
+ /**
65
+ * The stage's dead-letter queue (SQS, never polled): every job that failed
66
+ * its last attempt. Queue keys can't contain `--` and the old dead-letter
67
+ * queues end in `--dlq`, so this can't be a pre-0.4.0 queue's name.
68
+ */
69
+ readonly deadLetters: (app: string, stage: string) => string;
70
+ /** The SQS queue `plat dev` points the stage's event rules at, to run events in the local worker. */
71
+ readonly devEventTap: (app: string, stage: string) => string;
72
+ /** A queue's SQS queue and its dead-letter queue, before queues were pushed (0.4.0). */
73
+ readonly legacyQueue: (app: string, stage: string, key: string) => string;
74
+ readonly legacyDeadLetterQueue: (app: string, stage: string, key: string) => string;
45
75
  readonly eventBus: (app: string, stage: string) => string;
46
76
  /** EventBridge rule names are ≤ 64 chars; long event types are hashed. */
47
77
  readonly eventRule: (app: string, stage: string, eventType: string) => string;
48
78
  readonly scheduleGroup: (app: string, stage: string) => string;
49
79
  readonly schedule: (cronKey: string) => string;
80
+ /**
81
+ * A long-running service's ECS service and task definition family (ECS
82
+ * names are their own namespace, so `worker` can't clash with the Lambda).
83
+ */
84
+ readonly service: (app: string, stage: string, key: string) => string;
85
+ readonly serviceLogGroup: (app: string, stage: string, key: string) => string;
86
+ /** Tag of a service's image for one deployment in the container repository (≤ 103 of ECR's 128 chars). */
87
+ readonly serviceImageTag: (app: string, stage: string, key: string, deploymentId: string) => string;
88
+ /**
89
+ * One-shot schedule, in the stage's schedule group, that stops a preview's
90
+ * service. Cron keys can't contain `--`, so it never clashes with a cron.
91
+ */
92
+ readonly serviceStopSchedule: (key: string) => string;
50
93
  readonly userPoolClient: (app: string, stage: string) => string;
51
- readonly logGroup: (app: string, stage: string, component: 'web' | 'worker') => string;
94
+ /** SES tenant and its configuration set (≤ 64 chars each; the base is ≤ 52). */
95
+ readonly emailTenant: (app: string, stage: string) => string;
96
+ /** AppSync Events channel namespace; names are ≤ 50 chars, so long ones are hashed. */
97
+ readonly realtimeNamespace: (app: string, stage: string) => string;
98
+ /**
99
+ * A stage's log groups. Lambda also writes a Web Function's environments to
100
+ * `<web group>.local`, so the engine creates that one too.
101
+ */
102
+ readonly logGroup: (app: string, stage: string, component: 'web' | 'web.local' | 'worker') => string;
52
103
  readonly logGroupPrefix: (app: string, stage?: string) => string;
53
104
  readonly secretsPath: (app: string, stage: string) => string;
54
105
  readonly sharedSecretsPath: (app: string) => string;
55
- /** Prefix inside the shared storage bucket: `<app>/<stage>/<bucket>/`. */
56
- readonly storagePrefix: (app: string, stage: string, bucket?: string) => string;
106
+ /** SSM SecureString holding the stage key (see `Bindings.stageKey`); outside the secrets path. */
107
+ readonly stageKeyParameter: (app: string, stage: string) => string;
108
+ /** A private store's prefix in the shared storage bucket: `<app>/<stage>/<store>/`. */
109
+ readonly storagePrefix: (app: string, stage: string, store?: string) => string;
110
+ /** A public store's prefix in the shared storage bucket: `_public/<app>/<stage>/<store>/` (see `storage.ts`). */
111
+ readonly publicStoragePrefix: (app: string, stage: string, store?: string) => string;
57
112
  /** Prefix inside the shared sites bucket for one deployment's static files. */
58
113
  readonly sitePrefix: (app: string, stage: string, deploymentId: string) => string;
59
114
  readonly artifactKey: (app: string, stage: string, deploymentId: string, file: string) => string;
@@ -71,9 +126,41 @@ export declare const platformNames: {
71
126
  readonly routerFunction: 'platform-router';
72
127
  readonly userPool: 'platform-users';
73
128
  readonly boundaryPolicy: 'platform-app-boundary';
129
+ /** The AppSync Event API every stage's channel namespace lives in. */
130
+ readonly realtimeApi: 'platform-realtime';
131
+ /** Its Lambda authorizer (signed-in subscribe tokens). */
132
+ readonly realtimeAuthorizer: 'platform-realtime-authorizer';
133
+ /** ECS cluster every stage's containers run in (long-running services). */
134
+ readonly containerCluster: 'platform';
135
+ /** VPC and security group containers run in: public subnets, no NAT, egress only. */
136
+ readonly containerNetwork: 'platform-containers';
137
+ /** ECR repository of every container image the platform builds; tags name app, stage and deployment. */
138
+ readonly containerRepository: 'platform-containers';
139
+ /** Role ECS uses to pull images and ship container logs (the app's code runs as its stage role). */
140
+ readonly containerExecutionRole: 'platform-container-execution';
141
+ /** Role EventBridge Scheduler uses to scale containers (a preview's stop schedule). */
142
+ readonly containerSchedulerRole: 'platform-container-scheduler';
143
+ /** Description of the API's subscribe-only key for `public` stages (how the control plane finds it). */
144
+ readonly realtimePublicKey: 'platform-public-subscribe';
145
+ /** The control plane's own app name (services/control-plane/plat.config.ts), stage prod. */
146
+ readonly controlPlaneApp: 'platform';
74
147
  readonly controlPlaneRole: 'platform-control-plane';
75
148
  readonly ciRole: 'platform-ci';
76
149
  readonly alertsTopic: 'platform-alerts';
150
+ /**
151
+ * The edge floor's AWS WAF web ACL, which the control plane creates and attaches to the router
152
+ * while the floor is on; also its CloudWatch metric name. Not `platform-edge`, the always-on web
153
+ * ACL the foundation stack used to own: the stack deletes that one only after updating the
154
+ * distribution, so the two names can't collide while it goes.
155
+ */
156
+ readonly edgeWebAcl: 'platform-edge-floor';
157
+ /** Its rate-based rule, and that rule's metric name. */
158
+ readonly edgeFloorRule: 'requests-per-client';
159
+ /**
160
+ * The CloudWatch alarm on the router's requests per minute (`limits.edgeFloorAt`) that turns the
161
+ * floor on, and the EventBridge rule that tells the control plane when it goes off.
162
+ */
163
+ readonly edgeFloorAlarm: 'platform-edge-floor';
77
164
  readonly runtimeConfigParameter: '/platform/config/runtime';
78
165
  readonly sessionKeyParameter: '/platform/config/session-key';
79
166
  readonly githubAppParameterPrefix: '/platform/config/github-app/';