@ericminassian/platform-core 0.2.0 → 0.3.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 +947 -209
- package/dist/api.js +335 -1
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts +19 -0
- package/dist/auth.js +29 -0
- package/dist/auth.js.map +1 -1
- package/dist/bindings.d.ts +8 -2
- package/dist/bindings.js.map +1 -1
- package/dist/cloudfront-function.js +6 -0
- package/dist/cloudfront-function.js.map +1 -1
- package/dist/config.d.ts +3 -1
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js.map +1 -1
- package/dist/manifest.d.ts +96 -92
- package/dist/manifest.js +96 -66
- package/dist/manifest.js.map +1 -1
- package/dist/naming.d.ts +13 -2
- package/dist/naming.js +12 -1
- package/dist/naming.js.map +1 -1
- package/dist/platform-api.d.ts +5337 -0
- package/dist/platform-api.js +343 -0
- package/dist/platform-api.js.map +1 -0
- package/dist/router/decide.d.ts +5 -1
- package/dist/router/decide.js +7 -2
- package/dist/router.d.ts +1 -1
- package/dist/telemetry.d.ts +236 -74
- package/dist/telemetry.js +97 -0
- package/dist/telemetry.js.map +1 -1
- package/package.json +10 -2
- package/src/api.ts +427 -231
- package/src/auth.ts +33 -0
- package/src/bindings.ts +8 -2
- package/src/cloudfront-function.ts +6 -0
- package/src/config.ts +3 -1
- package/src/constants.ts +12 -0
- package/src/manifest.ts +145 -87
- package/src/naming.ts +13 -2
- package/src/platform-api.ts +504 -0
- package/src/router/decide.d.ts +5 -1
- package/src/router/decide.js +7 -2
- package/src/router.ts +1 -1
- package/src/telemetry.ts +107 -85
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The control plane's HTTP API (`/v1`) as an Effect `HttpApi`: the control
|
|
3
|
+
* plane implements it, the console calls it through a client generated from
|
|
4
|
+
* it, and its schemas describe what the CLI sends and reads.
|
|
5
|
+
*
|
|
6
|
+
* Imported from `@ericminassian/platform-core/platform-api`, never from the
|
|
7
|
+
* core index, so app runtimes don't load it.
|
|
8
|
+
*
|
|
9
|
+
* Auth is one of:
|
|
10
|
+
* - `Authorization: Bearer <platform token>` (CLI, from `plat login`)
|
|
11
|
+
* - `Authorization: Bearer <GitHub Actions OIDC token>` (CI deploys only)
|
|
12
|
+
* - the console's session cookie, plus `x-platform-csrf: 1` on writes
|
|
13
|
+
*
|
|
14
|
+
* The wire format predates this definition and published CLIs depend on it:
|
|
15
|
+
* paths, bodies and the `{ error: { code, message } }` error body stay as
|
|
16
|
+
* they are.
|
|
17
|
+
*/
|
|
18
|
+
import { Context, Schema, SchemaGetter } from 'effect';
|
|
19
|
+
import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from 'effect/http-api';
|
|
20
|
+
import { AdminOverview, ApiErrorBody, AppRecord, AppSummary, CliLoginRequest, CliLoginResponse, CostResponse, CreateAppRequest, CreateDeploymentRequest, CreateDeploymentResponse, CronRunResponse, DataCollections, DataPage, DeploymentRecord, ErrorGroup, ErrorStatus, JobsResponse, LogLine, LogsResponse, MeResponse, MetricsResponse, PutSecretRequest, QueueStats, RedriveResponse, RollbackRequest, RollbackResponse, RouteStats, SecretsResponse, StageDestroyed, StageDestroying, StageRecord, StorageResponse, TraceResponse, UpdateAppRequest, UpdateErrorRequest, UptimePoint, UrlResponse, } from './api.js';
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Errors: one class per status, each encoded as `{ error: { code, message } }`
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
const errorFields = { code: Schema.String, message: Schema.String };
|
|
25
|
+
/** The wire schema for an error class: its `code`/`message` nested under `error`, answered with `status`. */
|
|
26
|
+
const onTheWire = (tag, error, status) => ApiErrorBody.pipe(Schema.decodeTo(error, {
|
|
27
|
+
decode: SchemaGetter.transform((body) => ({ _tag: tag, ...body.error })),
|
|
28
|
+
encode: SchemaGetter.transform(({ code, message }) => ({ error: { code, message } })),
|
|
29
|
+
}), HttpApiSchema.status(status));
|
|
30
|
+
/** 400 `bad_request` (also every request that fails its schema). */
|
|
31
|
+
export class BadRequest extends Schema.TaggedError()('BadRequest', errorFields) {
|
|
32
|
+
static of = (message) => new BadRequest({ code: 'bad_request', message });
|
|
33
|
+
}
|
|
34
|
+
/** 401 `unauthenticated`: no or invalid credentials. */
|
|
35
|
+
export class Unauthenticated extends Schema.TaggedError()('Unauthenticated', errorFields) {
|
|
36
|
+
static of = (message) => new Unauthenticated({ code: 'unauthenticated', message });
|
|
37
|
+
}
|
|
38
|
+
/** 403: `forbidden`, `members_only`, `admins_only`, `not_a_member`, `csrf`. */
|
|
39
|
+
export class Forbidden extends Schema.TaggedError()('Forbidden', errorFields) {
|
|
40
|
+
}
|
|
41
|
+
/** 404 `not_found`. */
|
|
42
|
+
export class NotFound extends Schema.TaggedError()('NotFound', errorFields) {
|
|
43
|
+
static of = (what) => new NotFound({ code: 'not_found', message: `${what} not found` });
|
|
44
|
+
}
|
|
45
|
+
/** 409: `exists`, `dns_conflict`, `has_stages`, `already_started`, `rollback_failed`, `redrive_failed`. */
|
|
46
|
+
export class Conflict extends Schema.TaggedError()('Conflict', errorFields) {
|
|
47
|
+
}
|
|
48
|
+
/** 422 `invalid_manifest`: the deployment's `plat.config.ts` doesn't validate. */
|
|
49
|
+
export class InvalidManifest extends Schema.TaggedError()('InvalidManifest', errorFields) {
|
|
50
|
+
static of = (message) => new InvalidManifest({ code: 'invalid_manifest', message });
|
|
51
|
+
}
|
|
52
|
+
/** 429 `limit`: an app or stage limit from `platform.config.ts`. */
|
|
53
|
+
export class LimitReached extends Schema.TaggedError()('LimitReached', errorFields) {
|
|
54
|
+
static of = (message) => new LimitReached({ code: 'limit', message });
|
|
55
|
+
}
|
|
56
|
+
export const BadRequestError = onTheWire('BadRequest', BadRequest, 400);
|
|
57
|
+
export const UnauthenticatedError = onTheWire('Unauthenticated', Unauthenticated, 401);
|
|
58
|
+
export const ForbiddenError = onTheWire('Forbidden', Forbidden, 403);
|
|
59
|
+
export const NotFoundError = onTheWire('NotFound', NotFound, 404);
|
|
60
|
+
export const ConflictError = onTheWire('Conflict', Conflict, 409);
|
|
61
|
+
export const InvalidManifestError = onTheWire('InvalidManifest', InvalidManifest, 422);
|
|
62
|
+
export const LimitReachedError = onTheWire('LimitReached', LimitReached, 429);
|
|
63
|
+
/** Errors any endpoint may answer with. */
|
|
64
|
+
const errors = [
|
|
65
|
+
BadRequestError,
|
|
66
|
+
UnauthenticatedError,
|
|
67
|
+
ForbiddenError,
|
|
68
|
+
NotFoundError,
|
|
69
|
+
ConflictError,
|
|
70
|
+
InvalidManifestError,
|
|
71
|
+
LimitReachedError,
|
|
72
|
+
];
|
|
73
|
+
/** The caller, provided by `Authenticated`. */
|
|
74
|
+
export class CurrentPrincipal extends Context.Service()('@ericminassian/platform-core/CurrentPrincipal') {
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Requires a platform token, a GitHub Actions OIDC token or the console
|
|
78
|
+
* cookie (with the CSRF header on writes), and provides `CurrentPrincipal`.
|
|
79
|
+
* Endpoints narrow to members or admins themselves.
|
|
80
|
+
*/
|
|
81
|
+
export class Authenticated extends HttpApiMiddleware.Service()('@ericminassian/platform-core/Authenticated', { error: [UnauthenticatedError, ForbiddenError] }) {
|
|
82
|
+
}
|
|
83
|
+
/** Header the console sends on every request; cross-site forms can't set it (CSRF guard). */
|
|
84
|
+
export const CSRF_HEADER = 'x-platform-csrf';
|
|
85
|
+
/**
|
|
86
|
+
* Answers a request whose path, query or body fails its schema with a 400
|
|
87
|
+
* `bad_request` in the API's error body, where Effect would answer an empty
|
|
88
|
+
* 400. Applies to every endpoint.
|
|
89
|
+
*/
|
|
90
|
+
export class RequestValidation extends HttpApiMiddleware.Service()('@ericminassian/platform-core/RequestValidation', { error: BadRequestError }) {
|
|
91
|
+
}
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
// Endpoints
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
const app = { app: Schema.String };
|
|
96
|
+
const appStage = { app: Schema.String, stage: Schema.String };
|
|
97
|
+
/** `?stage=` defaults to prod; the server validates the name. */
|
|
98
|
+
const stageQuery = { stage: Schema.optional(Schema.String) };
|
|
99
|
+
/** `?range=1h|24h|7d|30d` or `?from=&to=` (epoch ms or ISO), and `?res=1m|1h|1d`. */
|
|
100
|
+
const rangeQuery = {
|
|
101
|
+
...stageQuery,
|
|
102
|
+
from: Schema.optional(Schema.String),
|
|
103
|
+
to: Schema.optional(Schema.String),
|
|
104
|
+
range: Schema.optional(Schema.String),
|
|
105
|
+
res: Schema.optional(Schema.String),
|
|
106
|
+
};
|
|
107
|
+
const limit = Schema.optional(Schema.Int);
|
|
108
|
+
export class SessionApi extends HttpApiGroup.make('session').add(
|
|
109
|
+
/** Exchanges a GitHub token for a platform token (`plat login`). */
|
|
110
|
+
HttpApiEndpoint.post('cliLogin', '/auth/cli', {
|
|
111
|
+
payload: CliLoginRequest,
|
|
112
|
+
success: CliLoginResponse,
|
|
113
|
+
error: errors,
|
|
114
|
+
}), HttpApiEndpoint.get('me', '/me', { success: MeResponse, error: errors }).middleware(Authenticated)) {
|
|
115
|
+
}
|
|
116
|
+
export class AppsApi extends HttpApiGroup.make('apps')
|
|
117
|
+
.add(HttpApiEndpoint.get('list', '/apps', { success: Schema.Array(AppSummary), error: errors }), HttpApiEndpoint.post('create', '/apps', {
|
|
118
|
+
payload: CreateAppRequest,
|
|
119
|
+
success: AppRecord.pipe(HttpApiSchema.status(201)),
|
|
120
|
+
error: errors,
|
|
121
|
+
}), HttpApiEndpoint.get('get', '/apps/:app', { params: app, success: AppSummary, error: errors }), HttpApiEndpoint.patch('update', '/apps/:app', {
|
|
122
|
+
params: app,
|
|
123
|
+
payload: UpdateAppRequest,
|
|
124
|
+
success: AppRecord,
|
|
125
|
+
error: errors,
|
|
126
|
+
}),
|
|
127
|
+
/** Refused (409 `has_stages`) while any stage exists. */
|
|
128
|
+
HttpApiEndpoint.delete('remove', '/apps/:app', {
|
|
129
|
+
params: app,
|
|
130
|
+
success: HttpApiSchema.NoContent,
|
|
131
|
+
error: errors,
|
|
132
|
+
}))
|
|
133
|
+
.middleware(Authenticated) {
|
|
134
|
+
}
|
|
135
|
+
export class StagesApi extends HttpApiGroup.make('stages')
|
|
136
|
+
.add(HttpApiEndpoint.get('list', '/apps/:app/stages', {
|
|
137
|
+
params: app,
|
|
138
|
+
success: Schema.Array(StageRecord),
|
|
139
|
+
error: errors,
|
|
140
|
+
}),
|
|
141
|
+
/** 202 while destroying; 200 when there was nothing left. Prod needs `?confirm=<app>`. */
|
|
142
|
+
HttpApiEndpoint.delete('destroy', '/apps/:app/stages/:stage', {
|
|
143
|
+
params: appStage,
|
|
144
|
+
query: { confirm: Schema.optional(Schema.String) },
|
|
145
|
+
success: [
|
|
146
|
+
StageDestroying.pipe(HttpApiSchema.status(202)),
|
|
147
|
+
StageDestroyed.pipe(HttpApiSchema.status(200)),
|
|
148
|
+
],
|
|
149
|
+
error: errors,
|
|
150
|
+
}), HttpApiEndpoint.post('rollback', '/apps/:app/stages/:stage/rollback', {
|
|
151
|
+
params: appStage,
|
|
152
|
+
/** No body rolls back to the previous deployment. */
|
|
153
|
+
payload: [RollbackRequest, Schema.Null],
|
|
154
|
+
success: RollbackResponse,
|
|
155
|
+
error: errors,
|
|
156
|
+
}))
|
|
157
|
+
.middleware(Authenticated) {
|
|
158
|
+
}
|
|
159
|
+
export class DeploymentsApi extends HttpApiGroup.make('deployments')
|
|
160
|
+
.add(
|
|
161
|
+
/** Newest first, without event logs or manifests. */
|
|
162
|
+
HttpApiEndpoint.get('list', '/apps/:app/deployments', {
|
|
163
|
+
params: app,
|
|
164
|
+
query: { stage: Schema.optional(Schema.String), limit },
|
|
165
|
+
success: Schema.Array(DeploymentRecord),
|
|
166
|
+
error: errors,
|
|
167
|
+
}),
|
|
168
|
+
/** Records the deployment and returns presigned upload forms; `start` runs it. */
|
|
169
|
+
HttpApiEndpoint.post('create', '/apps/:app/deployments', {
|
|
170
|
+
params: app,
|
|
171
|
+
payload: CreateDeploymentRequest,
|
|
172
|
+
success: CreateDeploymentResponse.pipe(HttpApiSchema.status(201)),
|
|
173
|
+
error: errors,
|
|
174
|
+
}), HttpApiEndpoint.get('get', '/deployments/:id', {
|
|
175
|
+
params: { id: Schema.String },
|
|
176
|
+
success: DeploymentRecord,
|
|
177
|
+
error: errors,
|
|
178
|
+
}), HttpApiEndpoint.post('start', '/deployments/:id/start', {
|
|
179
|
+
params: { id: Schema.String },
|
|
180
|
+
success: DeploymentRecord.pipe(HttpApiSchema.status(202)),
|
|
181
|
+
error: errors,
|
|
182
|
+
}))
|
|
183
|
+
.middleware(Authenticated) {
|
|
184
|
+
}
|
|
185
|
+
/** A live log line, or the error that ended the tail. */
|
|
186
|
+
export const TailEvent = Schema.Union([
|
|
187
|
+
Schema.Struct({ event: Schema.Literal('line'), data: Schema.fromJsonString(LogLine) }),
|
|
188
|
+
Schema.Struct({ event: Schema.Literal('error'), data: Schema.String }),
|
|
189
|
+
]);
|
|
190
|
+
export class ObserveApi extends HttpApiGroup.make('observe')
|
|
191
|
+
.add(HttpApiEndpoint.get('metrics', '/apps/:app/metrics', {
|
|
192
|
+
params: app,
|
|
193
|
+
query: rangeQuery,
|
|
194
|
+
success: MetricsResponse,
|
|
195
|
+
error: errors,
|
|
196
|
+
}), HttpApiEndpoint.get('routes', '/apps/:app/routes', {
|
|
197
|
+
params: app,
|
|
198
|
+
query: rangeQuery,
|
|
199
|
+
success: Schema.Array(RouteStats),
|
|
200
|
+
error: errors,
|
|
201
|
+
}), HttpApiEndpoint.get('jobs', '/apps/:app/jobs', {
|
|
202
|
+
params: app,
|
|
203
|
+
query: rangeQuery,
|
|
204
|
+
success: JobsResponse,
|
|
205
|
+
error: errors,
|
|
206
|
+
}), HttpApiEndpoint.get('queues', '/apps/:app/queues', {
|
|
207
|
+
params: app,
|
|
208
|
+
query: stageQuery,
|
|
209
|
+
success: Schema.Array(QueueStats),
|
|
210
|
+
error: errors,
|
|
211
|
+
}), HttpApiEndpoint.get('errors', '/apps/:app/errors', {
|
|
212
|
+
params: app,
|
|
213
|
+
query: { ...stageQuery, status: Schema.optional(ErrorStatus) },
|
|
214
|
+
success: Schema.Array(ErrorGroup),
|
|
215
|
+
error: errors,
|
|
216
|
+
}), HttpApiEndpoint.patch('updateError', '/apps/:app/errors/:fingerprint', {
|
|
217
|
+
params: { ...app, fingerprint: Schema.String },
|
|
218
|
+
query: stageQuery,
|
|
219
|
+
payload: UpdateErrorRequest,
|
|
220
|
+
success: UpdateErrorRequest,
|
|
221
|
+
error: errors,
|
|
222
|
+
}), HttpApiEndpoint.get('uptime', '/apps/:app/uptime', {
|
|
223
|
+
params: app,
|
|
224
|
+
query: rangeQuery,
|
|
225
|
+
success: Schema.Array(UptimePoint),
|
|
226
|
+
error: errors,
|
|
227
|
+
}), HttpApiEndpoint.get('cost', '/apps/:app/cost', {
|
|
228
|
+
params: app,
|
|
229
|
+
query: { days: Schema.optional(Schema.Int) },
|
|
230
|
+
success: CostResponse,
|
|
231
|
+
error: errors,
|
|
232
|
+
}),
|
|
233
|
+
/** Logs Insights search; `next` pages on. */
|
|
234
|
+
HttpApiEndpoint.get('logs', '/apps/:app/logs', {
|
|
235
|
+
params: app,
|
|
236
|
+
query: {
|
|
237
|
+
...rangeQuery,
|
|
238
|
+
q: Schema.optional(Schema.String),
|
|
239
|
+
stream: Schema.optional(Schema.Literals(['web', 'worker'])),
|
|
240
|
+
limit,
|
|
241
|
+
next: Schema.optional(Schema.String),
|
|
242
|
+
},
|
|
243
|
+
success: LogsResponse,
|
|
244
|
+
error: errors,
|
|
245
|
+
}),
|
|
246
|
+
/**
|
|
247
|
+
* Server-sent events: `line` (a `LogLine` as JSON) as logs arrive, `error` if
|
|
248
|
+
* the tail fails. A comment every 20 s keeps the connection open: CloudFront
|
|
249
|
+
* drops origin connections that stay idle.
|
|
250
|
+
*/
|
|
251
|
+
HttpApiEndpoint.get('tail', '/apps/:app/logs/tail', {
|
|
252
|
+
params: app,
|
|
253
|
+
query: { ...stageQuery, q: Schema.optional(Schema.String) },
|
|
254
|
+
success: HttpApiSchema.StreamSse({ events: TailEvent, keepAlive: '20 seconds' }),
|
|
255
|
+
error: errors,
|
|
256
|
+
}), HttpApiEndpoint.get('trace', '/apps/:app/traces/:trace', {
|
|
257
|
+
params: { ...app, trace: Schema.String },
|
|
258
|
+
query: rangeQuery,
|
|
259
|
+
success: TraceResponse,
|
|
260
|
+
error: errors,
|
|
261
|
+
}))
|
|
262
|
+
.middleware(Authenticated) {
|
|
263
|
+
}
|
|
264
|
+
/** `?scope=shared` targets the app-wide secret; otherwise the stage (`?stage=`, default prod). */
|
|
265
|
+
const secretQuery = { ...stageQuery, scope: Schema.optional(Schema.Literals(['shared', 'stage'])) };
|
|
266
|
+
export class ManageApi extends HttpApiGroup.make('manage')
|
|
267
|
+
.add(HttpApiEndpoint.get('collections', '/apps/:app/data/collections', {
|
|
268
|
+
params: app,
|
|
269
|
+
query: stageQuery,
|
|
270
|
+
success: DataCollections,
|
|
271
|
+
error: errors,
|
|
272
|
+
}), HttpApiEndpoint.get('items', '/apps/:app/data/items', {
|
|
273
|
+
params: app,
|
|
274
|
+
query: {
|
|
275
|
+
...stageQuery,
|
|
276
|
+
collection: Schema.String,
|
|
277
|
+
partition: Schema.optional(Schema.String),
|
|
278
|
+
cursor: Schema.optional(Schema.String),
|
|
279
|
+
limit,
|
|
280
|
+
},
|
|
281
|
+
success: DataPage,
|
|
282
|
+
error: errors,
|
|
283
|
+
}), HttpApiEndpoint.get('storage', '/apps/:app/storage', {
|
|
284
|
+
params: app,
|
|
285
|
+
query: {
|
|
286
|
+
...stageQuery,
|
|
287
|
+
store: Schema.optional(Schema.String),
|
|
288
|
+
prefix: Schema.optional(Schema.String),
|
|
289
|
+
cursor: Schema.optional(Schema.String),
|
|
290
|
+
},
|
|
291
|
+
success: StorageResponse,
|
|
292
|
+
error: errors,
|
|
293
|
+
}), HttpApiEndpoint.get('storageUrl', '/apps/:app/storage/url', {
|
|
294
|
+
params: app,
|
|
295
|
+
query: { ...stageQuery, store: Schema.String, key: Schema.String },
|
|
296
|
+
success: UrlResponse,
|
|
297
|
+
error: errors,
|
|
298
|
+
}), HttpApiEndpoint.get('secrets', '/apps/:app/secrets', {
|
|
299
|
+
params: app,
|
|
300
|
+
query: stageQuery,
|
|
301
|
+
success: SecretsResponse,
|
|
302
|
+
error: errors,
|
|
303
|
+
}), HttpApiEndpoint.put('putSecret', '/apps/:app/secrets/:name', {
|
|
304
|
+
params: { ...app, name: Schema.String },
|
|
305
|
+
query: secretQuery,
|
|
306
|
+
payload: PutSecretRequest,
|
|
307
|
+
success: HttpApiSchema.NoContent,
|
|
308
|
+
error: errors,
|
|
309
|
+
}), HttpApiEndpoint.delete('deleteSecret', '/apps/:app/secrets/:name', {
|
|
310
|
+
params: { ...app, name: Schema.String },
|
|
311
|
+
query: secretQuery,
|
|
312
|
+
success: HttpApiSchema.NoContent,
|
|
313
|
+
error: errors,
|
|
314
|
+
}), HttpApiEndpoint.post('runCron', '/apps/:app/crons/:name/run', {
|
|
315
|
+
params: { ...app, name: Schema.String },
|
|
316
|
+
query: stageQuery,
|
|
317
|
+
success: CronRunResponse.pipe(HttpApiSchema.status(202)),
|
|
318
|
+
error: errors,
|
|
319
|
+
}), HttpApiEndpoint.post('redrive', '/apps/:app/queues/:name/redrive', {
|
|
320
|
+
params: { ...app, name: Schema.String },
|
|
321
|
+
query: stageQuery,
|
|
322
|
+
success: RedriveResponse.pipe(HttpApiSchema.status(202)),
|
|
323
|
+
error: errors,
|
|
324
|
+
}))
|
|
325
|
+
.middleware(Authenticated) {
|
|
326
|
+
}
|
|
327
|
+
export class AdminApi extends HttpApiGroup.make('admin')
|
|
328
|
+
.add(HttpApiEndpoint.get('overview', '/admin/overview', { success: AdminOverview, error: errors }))
|
|
329
|
+
.middleware(Authenticated) {
|
|
330
|
+
}
|
|
331
|
+
export class PlatformApi extends HttpApi.make('platform')
|
|
332
|
+
.add(SessionApi)
|
|
333
|
+
.add(AppsApi)
|
|
334
|
+
.add(StagesApi)
|
|
335
|
+
.add(DeploymentsApi)
|
|
336
|
+
.add(ObserveApi)
|
|
337
|
+
.add(ManageApi)
|
|
338
|
+
.add(AdminApi)
|
|
339
|
+
.prefix('/v1')
|
|
340
|
+
// After every group: `middleware` only reaches the endpoints added so far.
|
|
341
|
+
.middleware(RequestValidation) {
|
|
342
|
+
}
|
|
343
|
+
//# sourceMappingURL=platform-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-api.js","sourceRoot":"","sources":["../src/platform-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EACL,aAAa,EACb,YAAY,EACZ,SAAS,EACT,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,WAAW,EACX,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,WAAW,GACZ,MAAM,UAAU,CAAC;AAGlB,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAE9E,MAAM,WAAW,GAAG,EAAE,I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,GAAG,CAAC,SAAS,CAAC;KACd,GAAG,CAAC,cAAc,CAAC;KACnB,GAAG,CAAC,UAAU,CAAC;KACf,GAAG,CAAC,SAAS,CAAC;KACd,GAAG,CAAC,QAAQ,CAAC;KACb,MAAM,CAAC,KAAK,CAAC;IACd,2EAA2E;KAC1E,UAAU,CAAC,iBAAiB,CAAC;CAAG"}
|
package/dist/router/decide.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { RouteRecord } from '../router.ts';
|
|
2
2
|
|
|
3
|
-
export type RouteDecision =
|
|
3
|
+
export type RouteDecision =
|
|
4
|
+
| { t: 'server' }
|
|
5
|
+
| { t: 'static'; key: string }
|
|
6
|
+
| { t: 'health' }
|
|
7
|
+
| { t: 'notfound' };
|
|
4
8
|
|
|
5
9
|
export declare function decide(rec: RouteRecord | null | undefined, uri: string): RouteDecision;
|
package/dist/router/decide.js
CHANGED
|
@@ -9,11 +9,16 @@
|
|
|
9
9
|
// s - static key prefix in the sites bucket, e.g. "foo/prod/d01j..." , optional
|
|
10
10
|
// r - server route prefixes when both o and s exist, e.g. ["/api/"]
|
|
11
11
|
// spa - 1 to serve index.html for unknown non-file paths
|
|
12
|
-
// returns { t: 'server' } | { t: 'static', key: '/<prefix>/<path>' } | { t: 'notfound' }
|
|
12
|
+
// returns { t: 'server' } | { t: 'static', key: '/<prefix>/<path>' } | { t: 'health' } | { t: 'notfound' }
|
|
13
|
+
// health - the router answers /__platform/health itself (HealthResponse with rec.d as the
|
|
14
|
+
// revision): a stage without a server has nothing else to report what it serves.
|
|
13
15
|
|
|
14
16
|
export function decide(rec, uri) {
|
|
15
17
|
if (!rec || (!rec.o && !rec.s)) return { t: 'notfound' };
|
|
16
|
-
if (uri.indexOf('/__platform/') === 0)
|
|
18
|
+
if (uri.indexOf('/__platform/') === 0) {
|
|
19
|
+
if (rec.o) return { t: 'server' };
|
|
20
|
+
return uri === '/__platform/health' ? { t: 'health' } : { t: 'notfound' };
|
|
21
|
+
}
|
|
17
22
|
if (!rec.s) return { t: 'server' };
|
|
18
23
|
if (rec.o) {
|
|
19
24
|
var routes = rec.r || [];
|
package/dist/router.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface RouteRecord {
|
|
|
15
15
|
/** Static prefix in the sites bucket (no leading slash). */
|
|
16
16
|
s?: string;
|
|
17
17
|
/** Server route prefixes (only meaningful when both `o` and `s` exist). */
|
|
18
|
-
r?: string[];
|
|
18
|
+
r?: readonly string[];
|
|
19
19
|
spa?: 0 | 1;
|
|
20
20
|
}
|
|
21
21
|
export declare function encodeRouteRecord(rec: RouteRecord): string;
|