@void/platform 1.9.1 → 1.10.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/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { BUILD_INSTANCE_FREE, BUILD_INSTANCE_LARGE, BuildInstanceType, BuiltinPlanId, EditablePlanLimit, PLAN_EDITABLE_LIMIT_KEYS, PLAN_LIMITS, PlanId, PlanLimits, PlanLimitsPatch, PlatformPlanCatalog, PlatformPlanDefinition, PlatformPlanReconciliation, createDefaultPlanCatalog, parseBuildInstanceType, parsePlanLimitsPatch, parsePlanName, parsePlatformPlanCatalog, parsePlatformPlanId, validatePlanLimits } from "./plans.mjs";
2
+ import { R2LocationHint } from "@void/deploy-core";
2
3
  /** An exact email domain, such as `example.com`, without wildcards or an `@`. */
3
4
  export declare function isPlatformAccessEmailDomain(value: unknown): value is string;
4
5
  /** Whether signing in with this Access identity provider proves a company identity. */
@@ -245,7 +246,9 @@ type PlatformDeploymentManifest = Readonly<{
245
246
  resources: PlatformResourceNames;
246
247
  /** Requires schema version 5, so an older CLI refuses the manifest instead of dropping it. */
247
248
  runtimeLogs?: PlatformRuntimeLogs;
248
- schemaVersion: typeof PLATFORM_DEPLOYMENT_SCHEMA_VERSION | 2 | 3 | 4 | 5;
249
+ /** Requires schema version 6 so older CLIs cannot silently drop this setting. */
250
+ storageLocationHint?: R2LocationHint;
251
+ schemaVersion: typeof PLATFORM_DEPLOYMENT_SCHEMA_VERSION | 2 | 3 | 4 | 5 | 6;
249
252
  }>;
250
253
  type PlatformDeploymentManifestInput = Readonly<{
251
254
  appAccess?: PlatformAppAccess;
@@ -269,6 +272,7 @@ type PlatformDeploymentManifestInput = Readonly<{
269
272
  installationSlug: string;
270
273
  resources?: Partial<PlatformResourceNames>;
271
274
  runtimeLogs?: PlatformRuntimeLogs;
275
+ storageLocationHint?: R2LocationHint;
272
276
  }>;
273
277
  type PlatformApplicationRoute = Readonly<{
274
278
  pattern: string;
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { a as isSourceRevision, c as requiredString, i as isSandboxDrainProtocol, n as isPrintableText, o as isUsageProtocolVersion, s as record, t as assertRecord } from "./validate-CTKcW3Vp.mjs";
2
2
  import { BUILD_INSTANCE_FREE, BUILD_INSTANCE_LARGE, PLAN_EDITABLE_LIMIT_KEYS, PLAN_LIMITS, createDefaultPlanCatalog, parseBuildInstanceType, parsePlanLimitsPatch, parsePlanName, parsePlatformPlanCatalog, parsePlatformPlanId, validatePlanLimits } from "./plans.mjs";
3
+ import { isR2LocationHint } from "@void/deploy-core";
3
4
  // src/access-policy.ts
4
5
  const COMPANY_IDENTITY_RULES = [
5
6
  "email_list",
@@ -412,6 +413,7 @@ function createPlatformDeploymentManifest(input) {
412
413
  "custom"
413
414
  ].includes(input.appAccess)) throw new Error("appAccess must be public, platform, or custom.");
414
415
  if (input.runtimeLogs !== void 0 && input.runtimeLogs !== "minimal") throw new Error("runtimeLogs must be minimal when set.");
416
+ if (input.storageLocationHint !== void 0 && !isR2LocationHint(input.storageLocationHint)) throw new Error("Invalid storageLocationHint.");
415
417
  const providers = input.authentication?.providers ?? ["github"];
416
418
  if (providers.some((provider) => !PLATFORM_LOGIN_KINDS.includes(provider)) || new Set(providers).size !== providers.length) throw new Error("Authentication providers must be unique supported login kinds.");
417
419
  const configurable = input.authentication?.configurable === true || input.authentication?.accessProtection === true || providers.some((provider) => provider === "oidc" || provider === "cloudflare-access");
@@ -448,7 +450,8 @@ function createPlatformDeploymentManifest(input) {
448
450
  installationSlug,
449
451
  resources,
450
452
  ...input.runtimeLogs ? { runtimeLogs: input.runtimeLogs } : {},
451
- schemaVersion: input.runtimeLogs ? 5 : input.appAccess !== void 0 ? 4 : configurable ? 3 : workersDev ? 2 : 1
453
+ ...input.storageLocationHint ? { storageLocationHint: input.storageLocationHint } : {},
454
+ schemaVersion: input.storageLocationHint ? 6 : input.runtimeLogs ? 5 : input.appAccess !== void 0 ? 4 : configurable ? 3 : workersDev ? 2 : 1
452
455
  };
453
456
  createApplicationRoutes(manifest.application);
454
457
  for (const [key, value] of Object.entries(manifest.controlPlane)) {
@@ -464,7 +467,7 @@ function createPlatformDeploymentManifest(input) {
464
467
  }
465
468
  function parsePlatformDeploymentManifest(value) {
466
469
  assertRecord(value, "Platform deployment manifest");
467
- if (value.schemaVersion !== 1 && value.schemaVersion !== 2 && value.schemaVersion !== 3 && value.schemaVersion !== 4 && value.schemaVersion !== 5) throw new Error(`Unsupported platform deployment schema version: ${String(value.schemaVersion)}.`);
470
+ if (value.schemaVersion !== 1 && value.schemaVersion !== 2 && value.schemaVersion !== 3 && value.schemaVersion !== 4 && value.schemaVersion !== 5 && value.schemaVersion !== 6) throw new Error(`Unsupported platform deployment schema version: ${String(value.schemaVersion)}.`);
468
471
  const application = value.application;
469
472
  const authentication = value.authentication;
470
473
  const rawCapabilities = value.capabilities;
@@ -497,13 +500,14 @@ function parsePlatformDeploymentManifest(value) {
497
500
  "public",
498
501
  "platform",
499
502
  "custom"
500
- ].includes(String(value.appAccess)) : value.schemaVersion === 5 ? value.appAccess !== void 0 && ![
503
+ ].includes(String(value.appAccess)) : Number(value.schemaVersion) >= 5 ? value.appAccess !== void 0 && ![
501
504
  "public",
502
505
  "platform",
503
506
  "custom"
504
507
  ].includes(String(value.appAccess)) : value.appAccess !== void 0) throw new Error("Guided app access requires deployment schema version 4 and a valid appAccess choice.");
505
508
  if (authentication.configurable !== void 0 && authentication.configurable !== true) throw new Error("Invalid configurable authentication flag.");
506
- if (value.schemaVersion === 5 ? value.runtimeLogs !== "minimal" : value.runtimeLogs !== void 0) throw new Error("Minimal runtime logs require deployment schema version 5.");
509
+ if (value.schemaVersion === 5 ? value.runtimeLogs !== "minimal" : value.schemaVersion === 6 ? value.runtimeLogs !== void 0 && value.runtimeLogs !== "minimal" : value.runtimeLogs !== void 0) throw new Error("Minimal runtime logs require deployment schema version 5.");
510
+ if (value.schemaVersion === 6 ? !isR2LocationHint(value.storageLocationHint) : value.storageLocationHint !== void 0) throw new Error("storageLocationHint requires deployment schema version 6 and a valid R2 location hint.");
507
511
  const resourceDefaults = createPlatformResourceNames(requiredString(value.installationSlug, "installationSlug"));
508
512
  const resources = {};
509
513
  for (const key of Object.keys(resourceDefaults)) resources[key] = requiredString(rawResources[key] ?? (key === "emailGatewayWorker" || key === "deploymentQueue" ? resourceDefaults[key] : void 0), `resources.${key}`);
@@ -537,7 +541,8 @@ function parsePlatformDeploymentManifest(value) {
537
541
  displayName: requiredString(value.displayName, "displayName"),
538
542
  installationSlug: requiredString(value.installationSlug, "installationSlug"),
539
543
  resources,
540
- ...value.schemaVersion === 5 ? { runtimeLogs: "minimal" } : {}
544
+ ...value.runtimeLogs === "minimal" ? { runtimeLogs: "minimal" } : {},
545
+ ...value.schemaVersion === 6 ? { storageLocationHint: value.storageLocationHint } : {}
541
546
  });
542
547
  }
543
548
  // src/installation.ts
@@ -1285,6 +1290,7 @@ function createPlatformWorkerConfigs(input) {
1285
1290
  ...deployment.appAccess ? { PLATFORM_APP_ACCESS: deployment.appAccess } : {},
1286
1291
  PLATFORM_INSTALLATION_ID: installationId,
1287
1292
  ...runtimeLogs,
1293
+ ...deployment.storageLocationHint ? { R2_LOCATION_HINT: deployment.storageLocationHint } : {},
1288
1294
  PLATFORM_TRAFFIC_STATE: trafficState,
1289
1295
  ...ownershipVars("api-worker", names.apiWorker),
1290
1296
  PLATFORM_VERSION: platformVersion,
@@ -28,6 +28,7 @@ export type PlatformRuntimeManifest = Readonly<{
28
28
  appAccessSetup?: 1;
29
29
  /** The runtime honours `runtimeLogs: minimal` (PLATFORM_RUNTIME_LOGS). */
30
30
  runtimeLogs?: 1;
31
+ storageLocationHint?: 1;
31
32
  /** Durable deployment Queue payload and PostgreSQL operation journal contract. */
32
33
  deploymentExecution?: 1;
33
34
  authenticationProtocolVersion?: 1;
@@ -25,6 +25,7 @@ function parsePlatformRuntimeManifest(value) {
25
25
  if (root.privatePreviews !== void 0 && root.privatePreviews !== 1) throw new Error("Unsupported private preview protocol.");
26
26
  if (root.schemaVersion !== 2) throw new Error("runtime manifest schemaVersion must be 2");
27
27
  if (root.appAccessSetup !== void 0 && root.appAccessSetup !== 1) throw new Error("Unsupported app access setup protocol.");
28
+ if (root.storageLocationHint !== void 0 && root.storageLocationHint !== 1) throw new Error("Unsupported storage location hint protocol.");
28
29
  if (root.runtimeLogs !== void 0 && root.runtimeLogs !== 1) throw new Error("Unsupported runtime logs protocol.");
29
30
  if (root.deploymentExecution !== void 0 && root.deploymentExecution !== 1) throw new Error("Unsupported deployment execution protocol.");
30
31
  if (root.authenticationProtocolVersion !== void 0 && root.authenticationProtocolVersion !== 1) throw new Error("Unsupported authentication protocol version.");
@@ -86,6 +87,7 @@ function parsePlatformRuntimeManifest(value) {
86
87
  return {
87
88
  artifacts,
88
89
  ...root.appAccessSetup === 1 ? { appAccessSetup: 1 } : {},
90
+ ...root.storageLocationHint === 1 ? { storageLocationHint: 1 } : {},
89
91
  ...root.runtimeLogs === 1 ? { runtimeLogs: 1 } : {},
90
92
  ...root.deploymentExecution === 1 ? { deploymentExecution: 1 } : {},
91
93
  ...assets ? { assets } : {},