@geekmidas/cloud 10.0.0-alpha.166 → 10.0.0-alpha.168
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/package.json +7 -7
- package/src/sst/__tests__/encryption.spec.ts +2 -2
- package/src/sst/__tests__/fromManifest.inbox.spec.ts +6 -9
- package/src/sst/__tests__/fromManifest.integration.spec.ts +1 -1
- package/src/sst/__tests__/fromManifest.spec.ts +37 -17
- package/src/sst/__tests__/surfaces.spec.ts +51 -5
- package/src/sst/aws/Inbox.ts +7 -4
- package/src/sst/aws/ObjectStorage.ts +3 -3
- package/src/sst/aws/Secret.ts +1 -1
- package/src/sst/fromManifest.ts +49 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/cloud",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.168",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"lodash.snakecase": "~4.1.1",
|
|
44
|
-
"@geekmidas/envkit": "10.0.0-alpha.
|
|
45
|
-
"@geekmidas/manifest": "10.0.0-alpha.
|
|
44
|
+
"@geekmidas/envkit": "10.0.0-alpha.168",
|
|
45
|
+
"@geekmidas/manifest": "10.0.0-alpha.168"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/lodash.get": "~4.4.9",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"@pulumi/aws": ">=7.47.0",
|
|
59
59
|
"@pulumi/random": ">=4.21.2",
|
|
60
60
|
"@pulumi/pulumi": ">=3.263.0",
|
|
61
|
-
"@geekmidas/manifest": ">=10.0.0-alpha.
|
|
62
|
-
"@geekmidas/storage": ">=10.0.0-alpha.
|
|
63
|
-
"@geekmidas/events": ">=10.0.0-alpha.
|
|
64
|
-
"@geekmidas/db": ">=10.0.0-alpha.
|
|
61
|
+
"@geekmidas/manifest": ">=10.0.0-alpha.168 <10.0.0",
|
|
62
|
+
"@geekmidas/storage": ">=10.0.0-alpha.168 <10.0.0",
|
|
63
|
+
"@geekmidas/events": ">=10.0.0-alpha.168 <10.0.0",
|
|
64
|
+
"@geekmidas/db": ">=10.0.0-alpha.168 <10.0.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@geekmidas/manifest": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResourceType } from '@geekmidas/envkit/sst';
|
|
2
|
-
import { providedKeyFor
|
|
2
|
+
import { providedKeyFor } from '@geekmidas/manifest';
|
|
3
3
|
import { describe, expect, it, vi } from 'vitest';
|
|
4
4
|
import { Encryption } from '../aws/Encryption';
|
|
5
5
|
import { provisionerFor, resolveEdges } from '../fromManifest';
|
|
@@ -51,7 +51,7 @@ describe('Encryption on AWS', () => {
|
|
|
51
51
|
Object.keys(pii.provides()).map((role) =>
|
|
52
52
|
providedKeyFor('Pii', 'encryption', role),
|
|
53
53
|
),
|
|
54
|
-
).toEqual([
|
|
54
|
+
).toEqual([providedKeyFor('Pii', 'encryption', 'url')]);
|
|
55
55
|
expect(pii._type).toBe(ResourceType.Encryption);
|
|
56
56
|
});
|
|
57
57
|
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { resolveEnvKeys } from '@geekmidas/envkit/sst';
|
|
2
2
|
import * as snsUrl from '@geekmidas/events/sns/url';
|
|
3
|
-
import {
|
|
4
|
-
type ConstructManifest,
|
|
5
|
-
providedKeyFor,
|
|
6
|
-
provideKey,
|
|
7
|
-
} from '@geekmidas/manifest';
|
|
3
|
+
import { type ConstructManifest, providedKeyFor } from '@geekmidas/manifest';
|
|
8
4
|
import { beforeEach, describe, expect, it } from 'vitest';
|
|
9
5
|
import { type Inbox, InboxNotProvisioned, InboxTopic } from '../aws/Inbox';
|
|
10
6
|
import { Topic } from '../aws/Topic';
|
|
@@ -78,10 +74,11 @@ function manifest(): ConstructManifest {
|
|
|
78
74
|
const env = {
|
|
79
75
|
REQUESTS_URL: URL,
|
|
80
76
|
REQUESTS_DOMAIN: 'shop.example',
|
|
81
|
-
[
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
[providedKeyFor('RequestsMail', 'topic', 'publisherConnectionString')]:
|
|
78
|
+
snsUrl.build({
|
|
79
|
+
topicArn: TOPIC_ARN,
|
|
80
|
+
region: 'eu-west-1',
|
|
81
|
+
}),
|
|
85
82
|
};
|
|
86
83
|
|
|
87
84
|
beforeEach(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveEnvKeys } from '@geekmidas/envkit/sst';
|
|
2
|
-
import { NoUrlForStage, providedKeyFor
|
|
2
|
+
import { NoUrlForStage, providedKeyFor } from '@geekmidas/manifest';
|
|
3
3
|
import { describe, expect, it } from 'vitest';
|
|
4
4
|
import { App } from '../App';
|
|
5
5
|
import { Cron } from '../aws/Cron';
|
|
@@ -60,17 +60,21 @@ describe('provisionerFor', () => {
|
|
|
60
60
|
describe('assertProvides', () => {
|
|
61
61
|
it('passes when declared and supplied agree', () => {
|
|
62
62
|
expect(() =>
|
|
63
|
-
assertProvides(
|
|
63
|
+
assertProvides(
|
|
64
|
+
'Uploads',
|
|
65
|
+
['UPLOADS_CONNECTION_STRING'],
|
|
66
|
+
['UPLOADS_CONNECTION_STRING'],
|
|
67
|
+
),
|
|
64
68
|
).not.toThrow();
|
|
65
69
|
});
|
|
66
70
|
|
|
67
71
|
it('catches infra supplying nothing for a declared key', () => {
|
|
68
72
|
expect.assertions(2);
|
|
69
73
|
try {
|
|
70
|
-
assertProvides('Uploads', ['
|
|
74
|
+
assertProvides('Uploads', ['UPLOADS_CONNECTION_STRING'], []);
|
|
71
75
|
} catch (error) {
|
|
72
76
|
const e = error as ProvidesMismatch;
|
|
73
|
-
expect(e.missing).toEqual(['
|
|
77
|
+
expect(e.missing).toEqual(['UPLOADS_CONNECTION_STRING']);
|
|
74
78
|
expect(e.extra).toEqual([]);
|
|
75
79
|
}
|
|
76
80
|
});
|
|
@@ -80,8 +84,8 @@ describe('assertProvides', () => {
|
|
|
80
84
|
try {
|
|
81
85
|
assertProvides(
|
|
82
86
|
'Uploads',
|
|
83
|
-
['
|
|
84
|
-
['
|
|
87
|
+
['UPLOADS_CONNECTION_STRING'],
|
|
88
|
+
['UPLOADS_CONNECTION_STRING', 'UPLOADS_CDN_URL'],
|
|
85
89
|
);
|
|
86
90
|
} catch (error) {
|
|
87
91
|
const e = error as ProvidesMismatch;
|
|
@@ -109,14 +113,16 @@ describe('ObjectStorage', () => {
|
|
|
109
113
|
const bucket = new ObjectStorage({} as never, 'Uploads');
|
|
110
114
|
|
|
111
115
|
it('composes the url from the resource, not the stack', () => {
|
|
112
|
-
expect(bucket.provides().
|
|
116
|
+
expect(bucket.provides().connectionString).toBe(
|
|
117
|
+
's3://Uploads?region=stub-region',
|
|
118
|
+
);
|
|
113
119
|
});
|
|
114
120
|
|
|
115
121
|
it('carries those values on the link, which is what reaches runtime', () => {
|
|
116
122
|
const link = bucket.getSSTLink();
|
|
117
123
|
expect(link.properties).toMatchObject({
|
|
118
124
|
name: 'Uploads',
|
|
119
|
-
|
|
125
|
+
connectionString: 's3://Uploads?region=stub-region',
|
|
120
126
|
});
|
|
121
127
|
});
|
|
122
128
|
|
|
@@ -125,13 +131,13 @@ describe('ObjectStorage', () => {
|
|
|
125
131
|
});
|
|
126
132
|
|
|
127
133
|
it('supplies exactly the key the construct declares', () => {
|
|
128
|
-
// The construct emits provides: ['
|
|
134
|
+
// The construct emits provides: ['UPLOADS_CONNECTION_STRING']; a role becomes that key.
|
|
129
135
|
expect(() =>
|
|
130
136
|
assertProvides(
|
|
131
137
|
'Uploads',
|
|
132
|
-
['
|
|
138
|
+
['UPLOADS_CONNECTION_STRING'],
|
|
133
139
|
Object.keys(bucket.provides()).map((role) =>
|
|
134
|
-
|
|
140
|
+
providedKeyFor('Uploads', 'objects', role),
|
|
135
141
|
),
|
|
136
142
|
),
|
|
137
143
|
).not.toThrow();
|
|
@@ -139,7 +145,7 @@ describe('ObjectStorage', () => {
|
|
|
139
145
|
|
|
140
146
|
it('is what envkit flattens into env', () => {
|
|
141
147
|
expect(resolveEnvKeys({ Uploads: { type: bucket._type } })).toContain(
|
|
142
|
-
'
|
|
148
|
+
'UPLOADS_CONNECTION_STRING',
|
|
143
149
|
);
|
|
144
150
|
});
|
|
145
151
|
});
|
|
@@ -191,7 +197,7 @@ describe('resolveEdges', () => {
|
|
|
191
197
|
provisioned,
|
|
192
198
|
);
|
|
193
199
|
expect(link.map((l) => l._id)).toEqual(['Uploads']);
|
|
194
|
-
expect(envKeys).toContain('
|
|
200
|
+
expect(envKeys).toContain('UPLOADS_CONNECTION_STRING');
|
|
195
201
|
});
|
|
196
202
|
|
|
197
203
|
it('links nothing more — the property least privilege depends on', () => {
|
|
@@ -235,7 +241,9 @@ describe('resolveEdges', () => {
|
|
|
235
241
|
|
|
236
242
|
describe('the key a provided role becomes', () => {
|
|
237
243
|
it('qualifies an ordinary role by its id', () => {
|
|
238
|
-
expect(providedKeyFor('Uploads', 'objects', '
|
|
244
|
+
expect(providedKeyFor('Uploads', 'objects', 'connectionString')).toBe(
|
|
245
|
+
'UPLOADS_CONNECTION_STRING',
|
|
246
|
+
);
|
|
239
247
|
});
|
|
240
248
|
|
|
241
249
|
it('leaves a secret’s name as its key', () => {
|
|
@@ -366,7 +374,11 @@ describe('a queue’s one consumer', () => {
|
|
|
366
374
|
|
|
367
375
|
subscribeConsumers(
|
|
368
376
|
{
|
|
369
|
-
Uploads: {
|
|
377
|
+
Uploads: {
|
|
378
|
+
kind: 'objects',
|
|
379
|
+
id: 'Uploads',
|
|
380
|
+
provides: ['UPLOADS_CONNECTION_STRING'],
|
|
381
|
+
},
|
|
370
382
|
Emails: {
|
|
371
383
|
kind: 'queue',
|
|
372
384
|
id: 'Emails',
|
|
@@ -417,7 +429,11 @@ describe('a surface’s endpoints', () => {
|
|
|
417
429
|
|
|
418
430
|
mountRoutes(
|
|
419
431
|
{
|
|
420
|
-
Uploads: {
|
|
432
|
+
Uploads: {
|
|
433
|
+
kind: 'objects',
|
|
434
|
+
id: 'Uploads',
|
|
435
|
+
provides: ['UPLOADS_CONNECTION_STRING'],
|
|
436
|
+
},
|
|
421
437
|
Api: {
|
|
422
438
|
kind: 'rest-api',
|
|
423
439
|
id: 'Api',
|
|
@@ -515,7 +531,11 @@ describe('functions and crons', () => {
|
|
|
515
531
|
stack,
|
|
516
532
|
{
|
|
517
533
|
Orders: { kind: 'database', id: 'Orders' },
|
|
518
|
-
Uploads: {
|
|
534
|
+
Uploads: {
|
|
535
|
+
kind: 'objects',
|
|
536
|
+
id: 'Uploads',
|
|
537
|
+
provides: ['UPLOADS_CONNECTION_STRING'],
|
|
538
|
+
},
|
|
519
539
|
Invoice: {
|
|
520
540
|
kind: 'function',
|
|
521
541
|
id: 'Invoice',
|
|
@@ -12,15 +12,23 @@ import {
|
|
|
12
12
|
const stack = {} as never;
|
|
13
13
|
|
|
14
14
|
const manifest = {
|
|
15
|
-
Uploads: {
|
|
15
|
+
Uploads: {
|
|
16
|
+
kind: 'objects',
|
|
17
|
+
id: 'Uploads',
|
|
18
|
+
provides: ['UPLOADS_CONNECTION_STRING'],
|
|
19
|
+
},
|
|
16
20
|
UploadsServer: {
|
|
17
21
|
kind: 'file-server',
|
|
18
22
|
id: 'UploadsServer',
|
|
19
23
|
of: 'Uploads',
|
|
20
24
|
open: ['brand/**'],
|
|
21
|
-
provides: ['
|
|
25
|
+
provides: ['UPLOADS_URL'],
|
|
26
|
+
},
|
|
27
|
+
Assets: {
|
|
28
|
+
kind: 'objects',
|
|
29
|
+
id: 'Assets',
|
|
30
|
+
provides: ['ASSETS_CONNECTION_STRING'],
|
|
22
31
|
},
|
|
23
|
-
Assets: { kind: 'objects', id: 'Assets', provides: ['ASSETS_URL'] },
|
|
24
32
|
Api: {
|
|
25
33
|
kind: 'rest-api',
|
|
26
34
|
id: 'Api',
|
|
@@ -106,6 +114,9 @@ describe('siteEnvironment', () => {
|
|
|
106
114
|
context({
|
|
107
115
|
Api: provided({ url: 'https://api.example.com' }),
|
|
108
116
|
Orders: provided({ url: 'postgres://user:pw@db/orders' }),
|
|
117
|
+
Uploads: provided({
|
|
118
|
+
connectionString: 's3://uploads-x1?region=eu-west-1',
|
|
119
|
+
}),
|
|
109
120
|
UploadsServer: provided({ url: 'https://files.example.com' }),
|
|
110
121
|
Mailer: provided({
|
|
111
122
|
url: 'smtp://user:pw@email-smtp.example.com:587',
|
|
@@ -121,8 +132,43 @@ describe('siteEnvironment', () => {
|
|
|
121
132
|
it('inlines a served bucket’s address, but never the bucket’s own', () => {
|
|
122
133
|
// A served URL is what a browser fetches; the bucket's presigns, and a
|
|
123
134
|
// presigner in a bundle is a credential in a bundle.
|
|
124
|
-
expect(built().
|
|
125
|
-
expect(built()).not.toHaveProperty('
|
|
135
|
+
expect(built().VITE_UPLOADS_URL).toBe('https://files.example.com');
|
|
136
|
+
expect(built()).not.toHaveProperty('VITE_UPLOADS_CONNECTION_STRING');
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it("inlines where a served bucket's signed links point", () => {
|
|
140
|
+
expect(built().VITE_UPLOADS_SIGNED_ORIGIN).toBe(
|
|
141
|
+
'https://uploads-x1.s3.eu-west-1.amazonaws.com',
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it("inlines a bucket's served address on an edge to the bucket itself", () => {
|
|
146
|
+
// A full-stack site's `.dependsOn([uploads.server])`: the server half
|
|
147
|
+
// holds the bucket, and the bundle still shows its objects from where
|
|
148
|
+
// they are served.
|
|
149
|
+
const env = siteEnvironment(
|
|
150
|
+
{
|
|
151
|
+
...manifest.Console,
|
|
152
|
+
dependencies: [{ target: 'Uploads', kind: 'objects' }],
|
|
153
|
+
},
|
|
154
|
+
context({
|
|
155
|
+
Uploads: provided({
|
|
156
|
+
connectionString: 's3://uploads-x1?region=eu-west-1',
|
|
157
|
+
}),
|
|
158
|
+
UploadsServer: provided({ url: 'https://files.example.com' }),
|
|
159
|
+
}),
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
// And where the bucket's signed links point, derived from its
|
|
163
|
+
// connection — never the connection itself.
|
|
164
|
+
expect(env).toEqual({
|
|
165
|
+
VITE_UPLOADS_SIGNED_ORIGIN:
|
|
166
|
+
'https://uploads-x1.s3.eu-west-1.amazonaws.com',
|
|
167
|
+
VITE_UPLOADS_URL: 'https://files.example.com',
|
|
168
|
+
// Both, as the one list a page's image config reads.
|
|
169
|
+
VITE_GKM_IMAGE_ORIGINS:
|
|
170
|
+
'https://files.example.com,https://uploads-x1.s3.eu-west-1.amazonaws.com',
|
|
171
|
+
});
|
|
126
172
|
});
|
|
127
173
|
|
|
128
174
|
it('keeps a connection string out of the bundle entirely', () => {
|
package/src/sst/aws/Inbox.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The codec alone — see the note in `Queue.ts`.
|
|
2
2
|
import * as snsUrl from '@geekmidas/events/sns/url';
|
|
3
|
-
import {
|
|
3
|
+
import { providedKeyFor } from '@geekmidas/manifest';
|
|
4
4
|
import { type GkmLinkable, ResourceType } from '../Linkable';
|
|
5
5
|
import { regionOfArn } from '../naming';
|
|
6
6
|
import type { StackType } from '../Stack';
|
|
@@ -53,10 +53,13 @@ export class Inbox<
|
|
|
53
53
|
return value;
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
this.url = read(props.url,
|
|
57
|
-
this.domain = read(props.domain,
|
|
56
|
+
this.url = read(props.url, providedKeyFor(name, 'inbox', 'url'));
|
|
57
|
+
this.domain = read(props.domain, providedKeyFor(name, 'inbox', 'domain'));
|
|
58
58
|
this.topicArn = snsUrl.parse(
|
|
59
|
-
read(
|
|
59
|
+
read(
|
|
60
|
+
props.topic,
|
|
61
|
+
providedKeyFor(props.topicId, 'topic', 'publisherConnectionString'),
|
|
62
|
+
),
|
|
60
63
|
).topicArn;
|
|
61
64
|
}
|
|
62
65
|
|
|
@@ -39,8 +39,8 @@ export class ObjectStorage<
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* The values this bucket resolves onto anything that depends on it, keyed by
|
|
42
|
-
* role. `
|
|
43
|
-
* `
|
|
42
|
+
* role. `providedKeyFor` turns a role into the env key the app declared, so
|
|
43
|
+
* `connectionString` here is `UPLOADS_CONNECTION_STRING` there.
|
|
44
44
|
*
|
|
45
45
|
* Composed *here* because only the resource knows its own shape: the name may
|
|
46
46
|
* be supplied through props or generated, and the region is the bucket's, not
|
|
@@ -50,7 +50,7 @@ export class ObjectStorage<
|
|
|
50
50
|
*/
|
|
51
51
|
provides(): Record<string, $util.Input<string>> {
|
|
52
52
|
return {
|
|
53
|
-
|
|
53
|
+
connectionString: $util
|
|
54
54
|
.all([this.name, this.nodes.bucket.region])
|
|
55
55
|
.apply(([bucket, region]) => s3Url.build({ bucket, region })),
|
|
56
56
|
};
|
package/src/sst/aws/Secret.ts
CHANGED
|
@@ -46,7 +46,7 @@ export class Secret<
|
|
|
46
46
|
/**
|
|
47
47
|
* The one value this secret resolves onto anything that depends on it.
|
|
48
48
|
*
|
|
49
|
-
* `value` is the role, so `
|
|
49
|
+
* `value` is the role, so `providedKeyFor` turns it into the key the app
|
|
50
50
|
* declared. Note that a secret's key is its *name* rather than
|
|
51
51
|
* `<NAME>_VALUE` — `Auth` signs with `AUTH_SECRET`, which is also what
|
|
52
52
|
* better-auth's own tooling looks for — so the manifest declares that key
|
package/src/sst/fromManifest.ts
CHANGED
|
@@ -28,16 +28,20 @@ import {
|
|
|
28
28
|
cookieDomain,
|
|
29
29
|
DEFAULT_POSTGRES_VERSION,
|
|
30
30
|
dependentsOf,
|
|
31
|
+
IMAGE_ORIGINS_KEY,
|
|
32
|
+
imageOriginSources,
|
|
33
|
+
imageOrigins,
|
|
31
34
|
isWildcardSite,
|
|
32
35
|
mobileOrigins,
|
|
33
|
-
PUBLIC,
|
|
34
36
|
PUBLIC_PREFIX,
|
|
35
37
|
providedKeyFor,
|
|
36
38
|
provisionOrder,
|
|
39
|
+
publicValues,
|
|
37
40
|
SECRET_LENGTH,
|
|
38
41
|
SECRET_SYMBOLS,
|
|
39
42
|
schemeBase,
|
|
40
43
|
} from '@geekmidas/manifest';
|
|
44
|
+
import { s3Url } from '@geekmidas/storage/aws';
|
|
41
45
|
import { RandomPassword } from '@pulumi/random';
|
|
42
46
|
import {
|
|
43
47
|
Cache,
|
|
@@ -493,30 +497,55 @@ export function siteEnvironment(
|
|
|
493
497
|
}
|
|
494
498
|
}
|
|
495
499
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
const component = context.provisioned[edge.target];
|
|
500
|
+
// The one walk of a frontend's edges every target makes (`publicValues`):
|
|
501
|
+
// each value is read off the component that provides it.
|
|
502
|
+
for (const { id, kind, role, key } of publicValues(
|
|
503
|
+
declaration,
|
|
504
|
+
context.manifest,
|
|
505
|
+
)) {
|
|
506
|
+
const component = context.provisioned[id];
|
|
504
507
|
if (!component) {
|
|
505
|
-
throw new UnresolvedDependency(
|
|
506
|
-
edge.target,
|
|
507
|
-
Object.keys(context.provisioned),
|
|
508
|
-
);
|
|
508
|
+
throw new UnresolvedDependency(id, Object.keys(context.provisioned));
|
|
509
509
|
}
|
|
510
510
|
|
|
511
511
|
const provided = component.provides();
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
512
|
+
let value = provided[role];
|
|
513
|
+
// A bucket's signed origin is derived from its connection, not
|
|
514
|
+
// provided: where its presigned links point is a function of it.
|
|
515
|
+
if (
|
|
516
|
+
value === undefined &&
|
|
517
|
+
kind === 'objects' &&
|
|
518
|
+
role === 'signedOrigin' &&
|
|
519
|
+
provided.connectionString !== undefined
|
|
520
|
+
) {
|
|
521
|
+
value = $util
|
|
522
|
+
.output(provided.connectionString)
|
|
523
|
+
.apply((connection) => s3Url.signedOrigin(s3Url.parse(connection)));
|
|
519
524
|
}
|
|
525
|
+
if (value !== undefined) environment[`${prefix}${key}`] = value;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// The origins its pages load files from, as one list: composed from the
|
|
529
|
+
// values just inlined, under the names `imageOriginSources` gives them.
|
|
530
|
+
const inlined = imageOriginSources(declaration, context.manifest).flatMap(
|
|
531
|
+
(source) => {
|
|
532
|
+
const value = environment[`${prefix}${source}`];
|
|
533
|
+
return value === undefined ? [] : [{ source, value }];
|
|
534
|
+
},
|
|
535
|
+
);
|
|
536
|
+
if (inlined.length > 0) {
|
|
537
|
+
environment[`${prefix}${IMAGE_ORIGINS_KEY}`] = $util
|
|
538
|
+
.all(inlined.map(({ value }) => value))
|
|
539
|
+
.apply((values) => {
|
|
540
|
+
const resolved = new Map(
|
|
541
|
+
inlined.map(({ source }, index) => [source, values[index]]),
|
|
542
|
+
);
|
|
543
|
+
return (
|
|
544
|
+
imageOrigins([...resolved.keys()], (source) =>
|
|
545
|
+
resolved.get(source),
|
|
546
|
+
) ?? ''
|
|
547
|
+
);
|
|
548
|
+
});
|
|
520
549
|
}
|
|
521
550
|
|
|
522
551
|
return environment;
|