@geekmidas/cloud 10.0.0-alpha.34 → 10.0.0-alpha.36
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/cloud",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.36",
|
|
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.36",
|
|
45
|
+
"@geekmidas/manifest": "10.0.0-alpha.36"
|
|
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.36",
|
|
62
|
+
"@geekmidas/storage": "^10.0.0-alpha.36",
|
|
63
|
+
"@geekmidas/events": "^10.0.0-alpha.36",
|
|
64
|
+
"@geekmidas/db": "^10.0.0-alpha.36"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@geekmidas/manifest": {
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
PUBLIC,
|
|
4
4
|
PUBLIC_PREFIX,
|
|
5
5
|
providedKeyFor,
|
|
6
|
+
schemeBase,
|
|
6
7
|
} from '@geekmidas/manifest';
|
|
7
8
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
8
9
|
import { DatabaseNeedsVpc } from '../aws/Database';
|
|
@@ -217,6 +218,37 @@ describe('fromManifest', () => {
|
|
|
217
218
|
);
|
|
218
219
|
});
|
|
219
220
|
|
|
221
|
+
it('builds nothing for a mobile app, and has the surfaces it calls trust its scheme', async () => {
|
|
222
|
+
vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
223
|
+
|
|
224
|
+
const provisioned = fromManifest(
|
|
225
|
+
stack,
|
|
226
|
+
{
|
|
227
|
+
...manifest(),
|
|
228
|
+
App: {
|
|
229
|
+
kind: 'mobile-app',
|
|
230
|
+
id: 'App',
|
|
231
|
+
variant: 'expo',
|
|
232
|
+
app: { path: 'apps/app' },
|
|
233
|
+
dependencies: [{ target: 'Auth', kind: 'rest-api' }],
|
|
234
|
+
provides: ['APP_SCHEME'],
|
|
235
|
+
},
|
|
236
|
+
} as ConstructManifest,
|
|
237
|
+
overrides,
|
|
238
|
+
{ cache: 'db' },
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
// EAS and the stores ship it — this stack has nothing to create for it.
|
|
242
|
+
expect(provisioned.App).toBeUndefined();
|
|
243
|
+
const origins = String(
|
|
244
|
+
await settle(provisioned.Auth!.provides().trustedOrigins),
|
|
245
|
+
).split(',');
|
|
246
|
+
// The bare scheme deployed: the one the store build registers.
|
|
247
|
+
const scheme = `${schemeBase($app.name)}://`;
|
|
248
|
+
expect(origins).toContain(scheme);
|
|
249
|
+
expect(origins).toContain(`${scheme}*`);
|
|
250
|
+
});
|
|
251
|
+
|
|
220
252
|
it('prints every route and exactly what it can reach', () => {
|
|
221
253
|
const log = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
222
254
|
|
package/src/sst/fromManifest.ts
CHANGED
|
@@ -26,10 +26,12 @@ import {
|
|
|
26
26
|
cookieDomain,
|
|
27
27
|
DEFAULT_POSTGRES_VERSION,
|
|
28
28
|
dependentsOf,
|
|
29
|
+
mobileOrigins,
|
|
29
30
|
PUBLIC,
|
|
30
31
|
PUBLIC_PREFIX,
|
|
31
32
|
providedKeyFor,
|
|
32
33
|
provisionOrder,
|
|
34
|
+
schemeBase,
|
|
33
35
|
} from '@geekmidas/manifest';
|
|
34
36
|
import {
|
|
35
37
|
Cache,
|
|
@@ -648,6 +650,8 @@ async function callersOf(
|
|
|
648
650
|
id: string,
|
|
649
651
|
manifest: ConstructManifest,
|
|
650
652
|
provisioned: ProvisionedManifest,
|
|
653
|
+
/** The app's name — a mobile caller's scheme base when it gives none. */
|
|
654
|
+
project: string,
|
|
651
655
|
): Promise<{ trustedOrigins: string; cookieDomain?: string }> {
|
|
652
656
|
// Every address here is a Pulumi output, not a string — a CloudFront domain
|
|
653
657
|
// and an API Gateway endpoint are both known only after their resource
|
|
@@ -672,8 +676,17 @@ async function callersOf(
|
|
|
672
676
|
const own = await resolved(provisioned[id]?.provides().url);
|
|
673
677
|
const domain = cookieDomain([...(own ? [own] : []), ...origins]);
|
|
674
678
|
|
|
679
|
+
// A mobile caller is reached by its scheme — the bare one, deployed: what
|
|
680
|
+
// the store build registers.
|
|
681
|
+
const schemes = dependentsOf(manifest, id).flatMap((caller) => {
|
|
682
|
+
const app = manifest[caller];
|
|
683
|
+
return app?.kind === 'mobile-app'
|
|
684
|
+
? mobileOrigins(schemeBase(project, app.scheme))
|
|
685
|
+
: [];
|
|
686
|
+
});
|
|
687
|
+
|
|
675
688
|
return {
|
|
676
|
-
trustedOrigins: origins.join(','),
|
|
689
|
+
trustedOrigins: [...origins, ...schemes].join(','),
|
|
677
690
|
...(domain ? { cookieDomain: domain } : {}),
|
|
678
691
|
};
|
|
679
692
|
}
|
|
@@ -811,6 +824,10 @@ export function fromManifest(
|
|
|
811
824
|
for (const id of [...rest, ...sites]) {
|
|
812
825
|
const declaration = manifest[id];
|
|
813
826
|
if (!declaration) continue;
|
|
827
|
+
// A mobile app ships through EAS and the stores, not this stack. It is
|
|
828
|
+
// in the manifest for what it makes the surfaces trust, which
|
|
829
|
+
// `callersOf` reads off the graph.
|
|
830
|
+
if (declaration.kind === 'mobile-app') continue;
|
|
814
831
|
|
|
815
832
|
const component = provisionerFor(declaration.kind)(
|
|
816
833
|
stack,
|
|
@@ -841,7 +858,7 @@ export function fromManifest(
|
|
|
841
858
|
for (const [id, deferred] of callers) {
|
|
842
859
|
// Resolved with the promise itself: the addresses it needs are Pulumi
|
|
843
860
|
// outputs, so the answer arrives when they do.
|
|
844
|
-
deferred.resolve(callersOf(id, manifest, provisioned));
|
|
861
|
+
deferred.resolve(callersOf(id, manifest, provisioned, $app.name));
|
|
845
862
|
}
|
|
846
863
|
|
|
847
864
|
// Last, and only now: the roles exist as passwords and secrets from the
|