@anthusai/papyrus 5.16.0 → 5.17.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/infra/amplify-app-shell.ts +1 -1
- package/infra/site-config.js +14 -0
- package/infra/site-config.ts +19 -2
- package/package.json +1 -1
- package/routes.manifest.json +1 -1
|
@@ -120,7 +120,7 @@ export class AmplifyAppShellStack extends Stack {
|
|
|
120
120
|
description: `Seals the Prospectus sign-in cookies of ${cmsAppName}; replacing it signs everyone out`,
|
|
121
121
|
})
|
|
122
122
|
: undefined;
|
|
123
|
-
const prospectusEnvironment = prospectusAccountsApiStageArn && prospectusSessionSealing
|
|
123
|
+
const prospectusEnvironment: Record<string, string> = prospectusAccountsApiStageArn && prospectusSessionSealing
|
|
124
124
|
? {
|
|
125
125
|
PAPYRUS_PROSPECTUS_ACCOUNTS_ENDPOINT: resolveProspectusAccountsEndpoint(prospectusAccountsApiStageArn),
|
|
126
126
|
PAPYRUS_PROSPECTUS_SESSION_SECRET_PARAMETER: prospectusSessionSealing.parameterName,
|
package/infra/site-config.js
CHANGED
|
@@ -452,3 +452,17 @@ export function parseSiteConfig(raw) {
|
|
|
452
452
|
validateOauthRedirectUrls(config);
|
|
453
453
|
return config;
|
|
454
454
|
}
|
|
455
|
+
/**
|
|
456
|
+
* The CDK environment for a site's app-shell stack, taken only from the site's own `aws` block. There is
|
|
457
|
+
* deliberately no default account: a deploy that guesses an account can land in, or fail against, the wrong
|
|
458
|
+
* one.
|
|
459
|
+
*/
|
|
460
|
+
export function resolveDeployEnvironment(config) {
|
|
461
|
+
const account = config.aws?.accountId;
|
|
462
|
+
const region = config.aws?.region;
|
|
463
|
+
const missing = [account ? "" : "aws.accountId", region ? "" : "aws.region"].filter(Boolean);
|
|
464
|
+
if (!account || !region) {
|
|
465
|
+
throw new Error(`site "${config.siteId}" does not say where it deploys: add ${missing.join(" and ")} to its site.json, e.g. "aws": { "accountId": "<12-digit account>", "region": "us-east-1" }. No account is assumed.`);
|
|
466
|
+
}
|
|
467
|
+
return { account, region };
|
|
468
|
+
}
|
package/infra/site-config.ts
CHANGED
|
@@ -93,8 +93,8 @@ export type AmplifyAppShellSiteConfig = {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
|
-
* Where the site's AWS resources live
|
|
97
|
-
*
|
|
96
|
+
* Where the site's AWS resources live. `bin/app-shell.ts` deploys the stack into exactly this account and
|
|
97
|
+
* region (see `resolveDeployEnvironment`), and `papyrus site google-secrets` asserts `accountId` with STS
|
|
98
98
|
* before it writes anything.
|
|
99
99
|
*/
|
|
100
100
|
export type SiteAwsConfig = {
|
|
@@ -578,3 +578,20 @@ export function parseSiteConfig(raw: unknown): AmplifyAppShellSiteConfig {
|
|
|
578
578
|
|
|
579
579
|
return config;
|
|
580
580
|
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* The CDK environment for a site's app-shell stack, taken only from the site's own `aws` block. There is
|
|
584
|
+
* deliberately no default account: a deploy that guesses an account can land in, or fail against, the wrong
|
|
585
|
+
* one.
|
|
586
|
+
*/
|
|
587
|
+
export function resolveDeployEnvironment(config: Pick<AmplifyAppShellSiteConfig, "siteId" | "aws">): { account: string; region: string } {
|
|
588
|
+
const account = config.aws?.accountId;
|
|
589
|
+
const region = config.aws?.region;
|
|
590
|
+
const missing = [account ? "" : "aws.accountId", region ? "" : "aws.region"].filter(Boolean);
|
|
591
|
+
if (!account || !region) {
|
|
592
|
+
throw new Error(
|
|
593
|
+
`site "${config.siteId}" does not say where it deploys: add ${missing.join(" and ")} to its site.json, e.g. "aws": { "accountId": "<12-digit account>", "region": "us-east-1" }. No account is assumed.`,
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
return { account, region };
|
|
597
|
+
}
|
package/package.json
CHANGED
package/routes.manifest.json
CHANGED