@geekmidas/cloud 10.0.0-alpha.167 → 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.spec.ts +2 -2
- package/src/sst/aws/Inbox.ts +7 -4
- package/src/sst/aws/ObjectStorage.ts +1 -1
- package/src/sst/aws/Secret.ts +1 -1
- package/src/sst/fromManifest.ts +17 -38
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';
|
|
@@ -137,7 +137,7 @@ describe('ObjectStorage', () => {
|
|
|
137
137
|
'Uploads',
|
|
138
138
|
['UPLOADS_CONNECTION_STRING'],
|
|
139
139
|
Object.keys(bucket.provides()).map((role) =>
|
|
140
|
-
|
|
140
|
+
providedKeyFor('Uploads', 'objects', role),
|
|
141
141
|
),
|
|
142
142
|
),
|
|
143
143
|
).not.toThrow();
|
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,7 +39,7 @@ export class ObjectStorage<
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* The values this bucket resolves onto anything that depends on it, keyed by
|
|
42
|
-
* role. `
|
|
42
|
+
* role. `providedKeyFor` turns a role into the env key the app declared, so
|
|
43
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
|
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
|
@@ -33,10 +33,10 @@ import {
|
|
|
33
33
|
imageOrigins,
|
|
34
34
|
isWildcardSite,
|
|
35
35
|
mobileOrigins,
|
|
36
|
-
PUBLIC,
|
|
37
36
|
PUBLIC_PREFIX,
|
|
38
37
|
providedKeyFor,
|
|
39
38
|
provisionOrder,
|
|
39
|
+
publicValues,
|
|
40
40
|
SECRET_LENGTH,
|
|
41
41
|
SECRET_SYMBOLS,
|
|
42
42
|
schemeBase,
|
|
@@ -497,53 +497,32 @@ export function siteEnvironment(
|
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
499
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
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
|
+
)) {
|
|
504
506
|
const component = context.provisioned[id];
|
|
505
507
|
if (!component) {
|
|
506
508
|
throw new UnresolvedDependency(id, Object.keys(context.provisioned));
|
|
507
509
|
}
|
|
508
510
|
|
|
509
|
-
const provided =
|
|
511
|
+
const provided = component.provides();
|
|
512
|
+
let value = provided[role];
|
|
510
513
|
// A bucket's signed origin is derived from its connection, not
|
|
511
514
|
// provided: where its presigned links point is a function of it.
|
|
512
|
-
if (
|
|
513
|
-
|
|
515
|
+
if (
|
|
516
|
+
value === undefined &&
|
|
517
|
+
kind === 'objects' &&
|
|
518
|
+
role === 'signedOrigin' &&
|
|
519
|
+
provided.connectionString !== undefined
|
|
520
|
+
) {
|
|
521
|
+
value = $util
|
|
514
522
|
.output(provided.connectionString)
|
|
515
523
|
.apply((connection) => s3Url.signedOrigin(s3Url.parse(connection)));
|
|
516
524
|
}
|
|
517
|
-
|
|
518
|
-
const value = provided[role as string];
|
|
519
|
-
if (value === undefined) continue;
|
|
520
|
-
|
|
521
|
-
environment[
|
|
522
|
-
`${prefix}${providedKeyFor(id, target.kind, role as string)}`
|
|
523
|
-
] = value;
|
|
524
|
-
}
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
for (const edge of declaration.dependencies) {
|
|
528
|
-
const target = context.manifest[edge.target];
|
|
529
|
-
if (!target) continue;
|
|
530
|
-
inline(edge.target, target);
|
|
531
|
-
|
|
532
|
-
// An edge to a bucket still shows its objects from where they are
|
|
533
|
-
// served — the same rule `publicEnvFor` follows.
|
|
534
|
-
if (target.kind === 'objects') {
|
|
535
|
-
for (const [id, other] of Object.entries(context.manifest)) {
|
|
536
|
-
if (other.kind === 'file-server' && other.of === edge.target) {
|
|
537
|
-
inline(id, other);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
// And an edge to a file server gets where its bucket's signed links
|
|
542
|
-
// point.
|
|
543
|
-
if (target.kind === 'file-server') {
|
|
544
|
-
const bucket = context.manifest[target.of];
|
|
545
|
-
if (bucket) inline(target.of, bucket);
|
|
546
|
-
}
|
|
525
|
+
if (value !== undefined) environment[`${prefix}${key}`] = value;
|
|
547
526
|
}
|
|
548
527
|
|
|
549
528
|
// The origins its pages load files from, as one list: composed from the
|