@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.
@@ -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,
@@ -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
+ }
@@ -93,8 +93,8 @@ export type AmplifyAppShellSiteConfig = {
93
93
  };
94
94
 
95
95
  /**
96
- * Where the site's AWS resources live, for operator tooling (`papyrus site google-secrets`). Not read by the
97
- * stack: the deploy account comes from the CDK environment. `accountId` is what the CLI asserts with STS
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
@@ -407,7 +407,7 @@
407
407
  "optional": true
408
408
  }
409
409
  },
410
- "version": "5.16.0",
410
+ "version": "5.17.0",
411
411
  "dependencies": {
412
412
  "@aws-amplify/adapter-nextjs": "^1.7.3",
413
413
  "@aws-crypto/sha256-js": "5.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.16.0",
2
+ "version": "5.17.0",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",