@ericminassian/platform-engine 0.4.0 → 0.5.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/clients.d.ts +0 -4
- package/dist/clients.js +1 -14
- package/dist/clients.js.map +1 -1
- package/dist/compat.d.ts +9 -21
- package/dist/compat.js +6 -26
- package/dist/compat.js.map +1 -1
- package/dist/drivers/cognito.d.ts +27 -3
- package/dist/drivers/cognito.js +76 -24
- package/dist/drivers/cognito.js.map +1 -1
- package/dist/drivers/index.d.ts +0 -2
- package/dist/drivers/index.js +0 -2
- package/dist/drivers/index.js.map +1 -1
- package/dist/drivers/logs.d.ts +11 -0
- package/dist/drivers/logs.js +15 -1
- package/dist/drivers/logs.js.map +1 -1
- package/dist/drivers/scheduler.d.ts +0 -21
- package/dist/drivers/scheduler.js +0 -43
- package/dist/drivers/scheduler.js.map +1 -1
- package/dist/index.d.ts +2 -81
- package/dist/index.js +0 -5
- package/dist/index.js.map +1 -1
- package/dist/local.js +2 -140
- package/dist/local.js.map +1 -1
- package/dist/login-branding.d.ts +27 -0
- package/dist/login-branding.js +329 -0
- package/dist/login-branding.js.map +1 -0
- package/dist/login-glyphs.d.ts +12 -0
- package/dist/login-glyphs.js +903 -0
- package/dist/login-glyphs.js.map +1 -0
- package/dist/policy.d.ts +2 -26
- package/dist/policy.js +2 -107
- package/dist/policy.js.map +1 -1
- package/dist/stage.d.ts +1 -2
- package/dist/stage.js +16 -87
- package/dist/stage.js.map +1 -1
- package/dist/util.d.ts +0 -22
- package/dist/util.js +0 -16
- package/dist/util.js.map +1 -1
- package/package.json +10 -7
- package/src/clients.ts +1 -15
- package/src/compat.ts +9 -32
- package/src/drivers/cognito.ts +98 -23
- package/src/drivers/index.ts +0 -2
- package/src/drivers/logs.ts +21 -0
- package/src/drivers/scheduler.ts +0 -69
- package/src/index.ts +3 -78
- package/src/local.ts +2 -152
- package/src/login-branding.ts +407 -0
- package/src/login-glyphs.ts +911 -0
- package/src/policy.ts +2 -132
- package/src/stage.ts +16 -102
- package/src/util.ts +0 -34
- package/dist/drivers/ecr.d.ts +0 -109
- package/dist/drivers/ecr.js +0 -303
- package/dist/drivers/ecr.js.map +0 -1
- package/dist/drivers/ecs.d.ts +0 -163
- package/dist/drivers/ecs.js +0 -447
- package/dist/drivers/ecs.js.map +0 -1
- package/dist/images.d.ts +0 -104
- package/dist/images.js +0 -182
- package/dist/images.js.map +0 -1
- package/dist/services.d.ts +0 -155
- package/dist/services.js +0 -464
- package/dist/services.js.map +0 -1
- package/src/drivers/ecr.ts +0 -457
- package/src/drivers/ecs.ts +0 -661
- package/src/images.ts +0 -254
- package/src/services.ts +0 -663
package/dist/index.d.ts
CHANGED
|
@@ -18,9 +18,7 @@ import type { EngineContext } from './util.ts';
|
|
|
18
18
|
export type { AwsClients } from './clients.ts';
|
|
19
19
|
export * from './drivers/index.ts';
|
|
20
20
|
export * from './emulator.ts';
|
|
21
|
-
export * as images from './images.ts';
|
|
22
21
|
export * as policies from './policy.ts';
|
|
23
|
-
export { ServiceNotFoundError } from './services.ts';
|
|
24
22
|
export { hostFor } from './stage.ts';
|
|
25
23
|
export { cacheControlFor, contentTypeFor } from './static.ts';
|
|
26
24
|
export type { EngineContext, PolicyDocument, PolicyStatement } from './util.ts';
|
|
@@ -60,15 +58,11 @@ export interface DeployStageInput {
|
|
|
60
58
|
stage: string;
|
|
61
59
|
deploymentId: string;
|
|
62
60
|
platform: PlatformRuntimeConfig;
|
|
63
|
-
/**
|
|
64
|
-
* Uploaded build artifacts (zips) in the artifacts bucket. `services` is
|
|
65
|
-
* `services.zip`: `<service>/index.mjs` (+ `.map`) for each declared service.
|
|
66
|
-
*/
|
|
61
|
+
/** Uploaded build artifacts (zips) in the artifacts bucket. */
|
|
67
62
|
artifacts: {
|
|
68
63
|
server?: S3Location;
|
|
69
64
|
worker?: S3Location;
|
|
70
65
|
static?: S3Location;
|
|
71
|
-
services?: S3Location;
|
|
72
66
|
};
|
|
73
67
|
/**
|
|
74
68
|
* `function`: create/update the Lambda Web Function + route record (AWS).
|
|
@@ -84,12 +78,6 @@ export interface DeployStageInput {
|
|
|
84
78
|
* idle) until the manifest drops `web.server` or the stage is destroyed.
|
|
85
79
|
*/
|
|
86
80
|
webCompute?: WebCompute;
|
|
87
|
-
/**
|
|
88
|
-
* `ecs`: build each service's image and run it on ECS (AWS; the default).
|
|
89
|
-
* `external`: skip images and ECS; `plat dev` runs services as local
|
|
90
|
-
* processes. Their log groups are created either way.
|
|
91
|
-
*/
|
|
92
|
-
servicesMode?: 'ecs' | 'external';
|
|
93
81
|
/** Use this role instead of creating the per-stage role (the control plane runs privileged). */
|
|
94
82
|
roleArn?: string;
|
|
95
83
|
/** Extra environment variables for web + worker (merged over manifest `env`). */
|
|
@@ -97,7 +85,7 @@ export interface DeployStageInput {
|
|
|
97
85
|
logRetentionDays?: number;
|
|
98
86
|
}
|
|
99
87
|
export interface ResourceRef {
|
|
100
|
-
/** `role`, `table`, `queue`, `bus`, `rule`, `schedule-group`, `schedule`, `log-group`, `web-function`, `function` (worker, a handler's own, or the request-mode server), `esm`, `user-pool-client`, `channel-namespace`, `email-tenant`, `configuration-set`, `route`, `static
|
|
88
|
+
/** `role`, `table`, `queue`, `bus`, `rule`, `schedule-group`, `schedule`, `log-group`, `web-function`, `function` (worker, a handler's own, or the request-mode server), `esm`, `user-pool-client`, `channel-namespace`, `email-tenant`, `configuration-set`, `route`, `static` */
|
|
101
89
|
type: string;
|
|
102
90
|
name: string;
|
|
103
91
|
arn?: string;
|
|
@@ -125,21 +113,8 @@ export interface DeployStageResult {
|
|
|
125
113
|
name: string;
|
|
126
114
|
arn: string;
|
|
127
115
|
};
|
|
128
|
-
/** Services the deploy rolled out (`servicesMode: 'ecs'`). */
|
|
129
|
-
services?: DeployedService[];
|
|
130
116
|
resources: ResourceRef[];
|
|
131
117
|
}
|
|
132
|
-
export interface DeployedService {
|
|
133
|
-
/** The key in plat.config.ts (`ais`). */
|
|
134
|
-
name: string;
|
|
135
|
-
/** `<repositoryUri>@sha256:…`. */
|
|
136
|
-
image: string;
|
|
137
|
-
taskDefinitionArn: string;
|
|
138
|
-
/** 1 running, 0 when a preview doesn't run it. */
|
|
139
|
-
desired: number;
|
|
140
|
-
/** A preview's stop schedule. */
|
|
141
|
-
stopsAt?: string;
|
|
142
|
-
}
|
|
143
118
|
export interface RollbackStageInput {
|
|
144
119
|
app: string;
|
|
145
120
|
stage: string;
|
|
@@ -153,53 +128,6 @@ export interface RollbackStageInput {
|
|
|
153
128
|
revisionId?: string;
|
|
154
129
|
/** That deployment's function version (request mode). */
|
|
155
130
|
version?: string;
|
|
156
|
-
/**
|
|
157
|
-
* Services that deployment declared. Each one the stage still runs is
|
|
158
|
-
* pointed back at that deployment's build; the rollback is refused if a
|
|
159
|
-
* build was cleaned up since.
|
|
160
|
-
*/
|
|
161
|
-
services?: readonly string[];
|
|
162
|
-
}
|
|
163
|
-
export interface StageServicesInput {
|
|
164
|
-
app: string;
|
|
165
|
-
stage: string;
|
|
166
|
-
platform: PlatformRuntimeConfig;
|
|
167
|
-
}
|
|
168
|
-
/** One service as ECS reports it right now. */
|
|
169
|
-
export interface ServiceRuntimeState {
|
|
170
|
-
name: string;
|
|
171
|
-
desired: number;
|
|
172
|
-
running: number;
|
|
173
|
-
pending: number;
|
|
174
|
-
/** The newest ECS deployment's rollout (`COMPLETED`, `IN_PROGRESS`, `FAILED`). */
|
|
175
|
-
rollout?: 'completed' | 'in_progress' | 'failed';
|
|
176
|
-
/** Deployment whose build the newest ECS deployment runs (its task definition's tag). */
|
|
177
|
-
deploymentId?: string;
|
|
178
|
-
/** When the current task started. */
|
|
179
|
-
startedAt?: string;
|
|
180
|
-
/** When a stop schedule scales it to zero. */
|
|
181
|
-
stopsAt?: string;
|
|
182
|
-
/** The task that stopped most recently. */
|
|
183
|
-
lastStop?: {
|
|
184
|
-
at: string;
|
|
185
|
-
reason: string;
|
|
186
|
-
exitCode?: number;
|
|
187
|
-
};
|
|
188
|
-
/** Recent ECS service events, newest first (at most 10). */
|
|
189
|
-
events: Array<{
|
|
190
|
-
at: string;
|
|
191
|
-
message: string;
|
|
192
|
-
}>;
|
|
193
|
-
}
|
|
194
|
-
export interface ControlServiceInput extends StageServicesInput {
|
|
195
|
-
name: string;
|
|
196
|
-
/**
|
|
197
|
-
* `start`: desired 1, stopping again after `minutes` when given (replacing
|
|
198
|
-
* any stop schedule). `stop`: desired 0 (and no stop schedule). `restart`:
|
|
199
|
-
* a fresh task on the same build.
|
|
200
|
-
*/
|
|
201
|
-
action: 'start' | 'stop' | 'restart';
|
|
202
|
-
minutes?: number;
|
|
203
131
|
}
|
|
204
132
|
export interface DestroyStageInput {
|
|
205
133
|
app: string;
|
|
@@ -242,13 +170,6 @@ export interface Engine {
|
|
|
242
170
|
* plane runs it nightly; `plat dev` serves the entry from its local router.
|
|
243
171
|
*/
|
|
244
172
|
ensureRealtimePlatform(platform: PlatformRuntimeConfig): Promise<RealtimeEdgeEntry | undefined>;
|
|
245
|
-
/** The stage's long-running services as ECS runs them now (none without container compute). */
|
|
246
|
-
describeServices(input: StageServicesInput): Promise<ServiceRuntimeState[]>;
|
|
247
|
-
/** Start, stop or restart one of the stage's services. */
|
|
248
|
-
controlService(input: ControlServiceInput): Promise<{
|
|
249
|
-
desired: number;
|
|
250
|
-
stopsAt?: string;
|
|
251
|
-
}>;
|
|
252
173
|
}
|
|
253
174
|
export declare function createEngine(opts: EngineOptions): Engine;
|
|
254
175
|
/** Driver-level access (clients, logger) for advanced callers such as `foundation/`. */
|
package/dist/index.js
CHANGED
|
@@ -18,13 +18,10 @@ import { createClients } from './clients.js';
|
|
|
18
18
|
import { ensureRealtimePlatform } from './drivers/appsync.js';
|
|
19
19
|
import { putObject } from './drivers/s3.js';
|
|
20
20
|
import { ensureLocal } from './local.js';
|
|
21
|
-
import { controlService, describeServices } from './services.js';
|
|
22
21
|
import { deployStage, destroyStage, expireStorage, listStageResources, rollbackStage } from './stage.js';
|
|
23
22
|
export * from './drivers/index.js';
|
|
24
23
|
export * from './emulator.js';
|
|
25
|
-
export * as images from './images.js';
|
|
26
24
|
export * as policies from './policy.js';
|
|
27
|
-
export { ServiceNotFoundError } from './services.js';
|
|
28
25
|
export { hostFor } from './stage.js';
|
|
29
26
|
export { cacheControlFor, contentTypeFor } from './static.js';
|
|
30
27
|
export { errorName, isNotFound, isNotImplemented, platformTags, retry, stageTags, waitFor } from './util.js';
|
|
@@ -41,8 +38,6 @@ export function createEngine(opts) {
|
|
|
41
38
|
listStageResources: (app, stage) => listStageResources(ctx, app, stage),
|
|
42
39
|
putArtifact: (platform, key, body) => putObject(ctx, { bucket: platform.artifactsBucket, key, body }),
|
|
43
40
|
ensureRealtimePlatform: (platform) => ensureRealtimePlatform(ctx, platform),
|
|
44
|
-
describeServices: (input) => describeServices(ctx, input),
|
|
45
|
-
controlService: (input) => controlService(ctx, input),
|
|
46
41
|
};
|
|
47
42
|
contexts.set(engine, ctx);
|
|
48
43
|
return engine;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAS/D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAS/D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,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AAE;YACd,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,wBAAwB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAQ,CAAC,CAAC;YACvF,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAc,EACd,IAA4D;IAE5D,OAAO,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/local.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { CreateApiCommand } from '@aws-sdk/client-appsync';
|
|
2
2
|
import { CreateFunctionCommand, GetFunctionConfigurationCommand } from '@aws-sdk/client-lambda';
|
|
3
3
|
import { emailDomain, NODE_RUNTIME, platformNames, } from '@ericminassian/platform-core';
|
|
4
|
-
import { Hash } from '@smithy/hash-node';
|
|
5
|
-
import { SignatureV4 } from '@smithy/signature-v4';
|
|
6
4
|
import { strToU8, zipSync } from 'fflate';
|
|
7
5
|
import { findEventApi } from './drivers/appsync.js';
|
|
8
6
|
import { ensureUserPool } from './drivers/cognito.js';
|
|
9
7
|
import { ensureTable } from './drivers/dynamodb.js';
|
|
10
|
-
import { ensureRepository } from './drivers/ecr.js';
|
|
11
|
-
import { ensureCluster } from './drivers/ecs.js';
|
|
12
8
|
import { ensureRole } from './drivers/iam.js';
|
|
13
9
|
import { ensureBucket } from './drivers/s3.js';
|
|
14
10
|
import { ensureEmailIdentity } from './drivers/ses.js';
|
|
15
|
-
import {
|
|
16
|
-
import { ignoreNotFound, platformTags,
|
|
11
|
+
import { serviceTrustPolicy } from './policy.js';
|
|
12
|
+
import { ignoreNotFound, platformTags, waitFor } from './util.js';
|
|
17
13
|
/**
|
|
18
14
|
* Inside a fresh AWS Emulator, create the shared resources a stage deploy
|
|
19
15
|
* expects (the ones the foundation stack holds in AWS, minus CloudFront, DNS,
|
|
@@ -64,7 +60,6 @@ export async function ensureLocal(ctx, opts) {
|
|
|
64
60
|
// associated with must exist. It never verifies and nothing is sent: local stages hand
|
|
65
61
|
// their mail to the CLI (`email.mode: 'local'`).
|
|
66
62
|
const mail = await ensureEmailIdentity(ctx, { domain: emailDomain(domain), tags });
|
|
67
|
-
const containers = await ensureLocalContainers(ctx, tags);
|
|
68
63
|
return {
|
|
69
64
|
v: 1,
|
|
70
65
|
target: 'emulator',
|
|
@@ -83,141 +78,8 @@ export async function ensureLocal(ctx, opts) {
|
|
|
83
78
|
jwksBaseUrl: opts.jwksBaseUrl,
|
|
84
79
|
realtime,
|
|
85
80
|
email: { domain: mail.domain, identityArn: mail.arn },
|
|
86
|
-
containers,
|
|
87
81
|
};
|
|
88
82
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Container compute inside the emulator, like the foundation's: a Fargate
|
|
91
|
-
* cluster, the image repository, public subnets with a security group, and
|
|
92
|
-
* the execution and scheduler roles. The emulator's ECS runs tasks
|
|
93
|
-
* (simulated: it pulls nothing and runs no code) only when their subnet
|
|
94
|
-
* routes to an internet gateway, which its default VPC lacks; this adds one.
|
|
95
|
-
*/
|
|
96
|
-
async function ensureLocalContainers(ctx, tags) {
|
|
97
|
-
const accountId = await ctx.accountId();
|
|
98
|
-
const cluster = platformNames.containerCluster;
|
|
99
|
-
await ensureCluster(ctx, { name: cluster, tags });
|
|
100
|
-
const repository = await ensureRepository(ctx, { name: platformNames.containerRepository, tags });
|
|
101
|
-
const execution = await ensureRole(ctx, {
|
|
102
|
-
name: platformNames.containerExecutionRole,
|
|
103
|
-
trust: serviceTrustPolicy('ecs-tasks.amazonaws.com'),
|
|
104
|
-
description: 'plat dev: pulls platform container images and writes their logs',
|
|
105
|
-
inlinePolicies: {
|
|
106
|
-
execution: containerExecutionPolicy({ region: ctx.region, accountId, repository: repository.name }),
|
|
107
|
-
},
|
|
108
|
-
tags,
|
|
109
|
-
});
|
|
110
|
-
const scheduler = await ensureRole(ctx, {
|
|
111
|
-
name: platformNames.containerSchedulerRole,
|
|
112
|
-
trust: serviceTrustPolicy('scheduler.amazonaws.com'),
|
|
113
|
-
description: "plat dev: scales stages' containers (preview stop schedules)",
|
|
114
|
-
inlinePolicies: { scale: containerSchedulerPolicy({ region: ctx.region, accountId, cluster }) },
|
|
115
|
-
tags,
|
|
116
|
-
});
|
|
117
|
-
const network = await ensureLocalNetwork(ctx);
|
|
118
|
-
return {
|
|
119
|
-
cluster,
|
|
120
|
-
subnets: network.subnets,
|
|
121
|
-
securityGroups: [network.securityGroup],
|
|
122
|
-
repository: repository.name,
|
|
123
|
-
// The emulator's CreateRepository answers with its own host and port, but its ECS only
|
|
124
|
-
// resolves images named the way AWS names them.
|
|
125
|
-
repositoryUri: `${repository.registryId}.dkr.ecr.${ctx.region}.amazonaws.com/${repository.name}`,
|
|
126
|
-
executionRoleArn: execution.arn,
|
|
127
|
-
schedulerRoleArn: scheduler.arn,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* The default VPC's subnets, made public (an internet gateway and a default
|
|
132
|
-
* route, which AWS's default VPCs come with), and the containers' security
|
|
133
|
-
* group in it.
|
|
134
|
-
*/
|
|
135
|
-
async function ensureLocalNetwork(ctx) {
|
|
136
|
-
const vpcs = await ec2(ctx, 'DescribeVpcs', { 'Filter.1.Name': 'is-default', 'Filter.1.Value.1': 'true' });
|
|
137
|
-
const vpcId = xmlValues(vpcs, 'vpcId')[0];
|
|
138
|
-
if (!vpcId)
|
|
139
|
-
throw new Error('the AWS Emulator has no default VPC');
|
|
140
|
-
const inVpc = { 'Filter.1.Name': 'vpc-id', 'Filter.1.Value.1': vpcId };
|
|
141
|
-
const subnets = [...new Set(xmlValues(await ec2(ctx, 'DescribeSubnets', inVpc), 'subnetId'))].toSorted();
|
|
142
|
-
if (!subnets.length)
|
|
143
|
-
throw new Error(`the AWS Emulator's default VPC ${vpcId} has no subnets`);
|
|
144
|
-
const gateways = await ec2(ctx, 'DescribeInternetGateways', {
|
|
145
|
-
'Filter.1.Name': 'attachment.vpc-id',
|
|
146
|
-
'Filter.1.Value.1': vpcId,
|
|
147
|
-
});
|
|
148
|
-
let gateway = xmlValues(gateways, 'internetGatewayId')[0];
|
|
149
|
-
if (!gateway) {
|
|
150
|
-
gateway = xmlValues(await ec2(ctx, 'CreateInternetGateway', {}), 'internetGatewayId')[0];
|
|
151
|
-
await ec2(ctx, 'AttachInternetGateway', { InternetGatewayId: gateway, VpcId: vpcId });
|
|
152
|
-
}
|
|
153
|
-
const tables = await ec2(ctx, 'DescribeRouteTables', {
|
|
154
|
-
...inVpc,
|
|
155
|
-
'Filter.2.Name': 'association.main',
|
|
156
|
-
'Filter.2.Value.1': 'true',
|
|
157
|
-
});
|
|
158
|
-
const table = xmlValues(tables, 'routeTableId')[0];
|
|
159
|
-
if (table && !xmlValues(tables, 'destinationCidrBlock').includes('0.0.0.0/0')) {
|
|
160
|
-
await ec2(ctx, 'CreateRoute', {
|
|
161
|
-
RouteTableId: table,
|
|
162
|
-
DestinationCidrBlock: '0.0.0.0/0',
|
|
163
|
-
GatewayId: gateway,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
const groups = await ec2(ctx, 'DescribeSecurityGroups', {
|
|
167
|
-
...inVpc,
|
|
168
|
-
'Filter.2.Name': 'group-name',
|
|
169
|
-
'Filter.2.Value.1': platformNames.containerNetwork,
|
|
170
|
-
});
|
|
171
|
-
const securityGroup = xmlValues(groups, 'groupId')[0] ??
|
|
172
|
-
xmlValues(await ec2(ctx, 'CreateSecurityGroup', {
|
|
173
|
-
GroupName: platformNames.containerNetwork,
|
|
174
|
-
GroupDescription: 'Platform containers: no inbound traffic, all outbound',
|
|
175
|
-
VpcId: vpcId,
|
|
176
|
-
}), 'groupId')[0];
|
|
177
|
-
return { subnets, securityGroup };
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* One EC2 Query API call against the emulator, signed with the SDK's SigV4
|
|
181
|
-
* signer and sent through an SDK client's endpoint, credentials and HTTP
|
|
182
|
-
* handler. These few VPC calls are the engine's only EC2 calls, which
|
|
183
|
-
* doesn't warrant the SDK's EC2 client, one of its largest.
|
|
184
|
-
*/
|
|
185
|
-
async function ec2(ctx, action, params) {
|
|
186
|
-
const client = ctx.clients.sts;
|
|
187
|
-
const endpoint = await client.config.endpoint();
|
|
188
|
-
const body = new URLSearchParams({ Action: action, Version: '2016-11-15', ...params }).toString();
|
|
189
|
-
const signer = new SignatureV4({
|
|
190
|
-
service: 'ec2',
|
|
191
|
-
region: ctx.region,
|
|
192
|
-
credentials: client.config.credentials,
|
|
193
|
-
sha256: Hash.bind(null, 'sha256'),
|
|
194
|
-
});
|
|
195
|
-
const request = await signer.sign({
|
|
196
|
-
method: 'POST',
|
|
197
|
-
protocol: endpoint.protocol,
|
|
198
|
-
hostname: endpoint.hostname,
|
|
199
|
-
...(endpoint.port ? { port: endpoint.port } : {}),
|
|
200
|
-
path: '/',
|
|
201
|
-
query: {},
|
|
202
|
-
headers: {
|
|
203
|
-
'content-type': 'application/x-www-form-urlencoded; charset=utf-8',
|
|
204
|
-
host: endpoint.port ? `${endpoint.hostname}:${endpoint.port}` : endpoint.hostname,
|
|
205
|
-
'content-length': String(Buffer.byteLength(body)),
|
|
206
|
-
},
|
|
207
|
-
body,
|
|
208
|
-
});
|
|
209
|
-
const res = await sendRaw(client, request);
|
|
210
|
-
const xml = new TextDecoder().decode(res.body);
|
|
211
|
-
if (res.statusCode !== 200) {
|
|
212
|
-
const [code] = xmlValues(xml, 'Code');
|
|
213
|
-
const [message] = xmlValues(xml, 'Message');
|
|
214
|
-
throw new Error(`EC2 ${action} failed in the AWS Emulator: ${code ?? res.statusCode} ${message ?? xml}`);
|
|
215
|
-
}
|
|
216
|
-
return xml;
|
|
217
|
-
}
|
|
218
|
-
function xmlValues(xml, element) {
|
|
219
|
-
return [...xml.matchAll(new RegExp(`<${element}>([^<]*)</${element}>`, 'g'))].map((m) => m[1]);
|
|
220
|
-
}
|
|
221
83
|
/**
|
|
222
84
|
* The emulator never invokes an Event API's Lambda authorizer (it accepts any
|
|
223
85
|
* token), but the API still needs one to accept the AWS_LAMBDA mode signed-in
|
package/dist/local.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../src/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,EACL,WAAW,EAEX,YAAY,EAEZ,aAAa,GAEd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACrG,OAAO,EAAsB,cAAc,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE/F;;;;GAIG;AACH,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G,MAAM,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CACvC,IAAI,qBAAqB,CAAC;QACxB,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,IAAI,CAAC,GAAG;QACd,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE;QACrE,IAAI,EAAE,IAAI;KACX,CAAC,CACH,CAAC;IACF,MAAM,OAAO,CAAC,GAAG,IAAI,mBAAmB,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,+BAA+B,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACrG,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC;IAC9B,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,WAAY,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AssetCategoryType, AssetExtensionType, ColorSchemeModeType, CreateManagedLoginBrandingRequest } from '@aws-sdk/client-cognito-identity-provider';
|
|
2
|
+
/**
|
|
3
|
+
* The managed login style every app client gets, after the console and
|
|
4
|
+
* Vercel's login page: a header with the platform's mark and domain (one
|
|
5
|
+
* account across every app), the app's name over a form without a card, the
|
|
6
|
+
* console's neutral greys, and the device's light or dark mode.
|
|
7
|
+
*
|
|
8
|
+
* Cognito takes colors and images, but no fonts or copy, so the names are
|
|
9
|
+
* drawn as Geist outlines. Its page font (Open Sans), its copy and its italic
|
|
10
|
+
* placeholders stay as they are.
|
|
11
|
+
*/
|
|
12
|
+
export interface LoginBranding {
|
|
13
|
+
/** The style's settings document, as Cognito stores and returns it. */
|
|
14
|
+
settings: Settings;
|
|
15
|
+
assets: Array<{
|
|
16
|
+
Category: AssetCategoryType;
|
|
17
|
+
ColorMode: ColorSchemeModeType;
|
|
18
|
+
Extension: AssetExtensionType;
|
|
19
|
+
Bytes: Uint8Array;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
type Settings = NonNullable<CreateManagedLoginBrandingRequest['Settings']>;
|
|
23
|
+
export declare function loginBranding(spec: {
|
|
24
|
+
app: string;
|
|
25
|
+
domain: string;
|
|
26
|
+
}): LoginBranding;
|
|
27
|
+
export {};
|