@gadicc/loom 1.23.0 → 1.25.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.
Files changed (35) hide show
  1. package/README.md +19 -2
  2. package/db/databaseTls.js +42 -0
  3. package/db/databaseTls.test.ts +171 -0
  4. package/db/neonFull.js +2 -4
  5. package/esm/_dnt.polyfills.d.ts +11 -0
  6. package/esm/_dnt.polyfills.d.ts.map +1 -1
  7. package/esm/_dnt.polyfills.js +14 -0
  8. package/esm/src/cli/filesR2Policy.d.ts +33 -0
  9. package/esm/src/cli/filesR2Policy.d.ts.map +1 -0
  10. package/esm/src/cli/filesR2Policy.js +130 -0
  11. package/esm/src/cli/mod.d.ts.map +1 -1
  12. package/esm/src/cli/mod.js +163 -60
  13. package/esm/src/cli/releaseConfig.d.ts +10 -0
  14. package/esm/src/cli/releaseConfig.d.ts.map +1 -0
  15. package/esm/src/cli/releaseConfig.js +22 -0
  16. package/esm/src/next/pwa/mod.d.ts +10 -2
  17. package/esm/src/next/pwa/mod.d.ts.map +1 -1
  18. package/esm/src/next/pwa/mod.js +142 -31
  19. package/package.json +2 -2
  20. package/script/_dnt.polyfills.d.ts +11 -0
  21. package/script/_dnt.polyfills.d.ts.map +1 -1
  22. package/script/_dnt.polyfills.js +14 -0
  23. package/script/src/cli/filesR2Policy.d.ts +33 -0
  24. package/script/src/cli/filesR2Policy.d.ts.map +1 -0
  25. package/script/src/cli/filesR2Policy.js +135 -0
  26. package/script/src/cli/mod.d.ts.map +1 -1
  27. package/script/src/cli/mod.js +163 -60
  28. package/script/src/cli/releaseConfig.d.ts +10 -0
  29. package/script/src/cli/releaseConfig.d.ts.map +1 -0
  30. package/script/src/cli/releaseConfig.js +26 -0
  31. package/script/src/next/pwa/mod.d.ts +10 -2
  32. package/script/src/next/pwa/mod.d.ts.map +1 -1
  33. package/script/src/next/pwa/mod.js +142 -31
  34. package/skills/loom-db/SKILL.md +5 -1
  35. package/skills/loom-files/SKILL.md +12 -1
@@ -77,6 +77,8 @@ const node_module_1 = require("node:module");
77
77
  const node_path_1 = require("node:path");
78
78
  const node_process_1 = __importDefault(require("node:process"));
79
79
  const node_util_1 = require("node:util");
80
+ const filesR2Policy_js_1 = require("./filesR2Policy.js");
81
+ const releaseConfig_js_1 = require("./releaseConfig.js");
80
82
  const retention_js_1 = require("../apiKeys/retention.js");
81
83
  const projectSkills_js_1 = require("./projectSkills.js");
82
84
  const migrationEnv_js_1 = require("./migrationEnv.js");
@@ -1272,6 +1274,7 @@ function mergeDbConfig(framework, featureConfig) {
1272
1274
  ...featureConfig?.modules,
1273
1275
  },
1274
1276
  provider: featureConfig?.provider,
1277
+ release: featureConfig?.release,
1275
1278
  };
1276
1279
  }
1277
1280
  function isIdentifierLikeChar(char) {
@@ -3293,12 +3296,6 @@ function yamlListContainsToken(lines, startIndex, parentIndent, token) {
3293
3296
  }
3294
3297
  return false;
3295
3298
  }
3296
- function yamlBranchValueContainsMain(value) {
3297
- return yamlScalarValueContainsToken(value, "main");
3298
- }
3299
- function yamlListContainsMainBranch(lines, startIndex, parentIndent) {
3300
- return yamlListContainsToken(lines, startIndex, parentIndent, "main");
3301
- }
3302
3299
  function findGithubOnPushIndex(lines) {
3303
3300
  const onIndex = lines.findIndex((line) => /^\s*on:\s*(?:#.*)?$/.test(line));
3304
3301
  if (onIndex === -1) {
@@ -3321,7 +3318,7 @@ function findGithubOnPushIndex(lines) {
3321
3318
  }
3322
3319
  return -1;
3323
3320
  }
3324
- function githubWorkflowRunsOnMainPush(text) {
3321
+ function githubWorkflowRunsOnBranchPush(text, productionBranch) {
3325
3322
  const normalized = normalizeText(text);
3326
3323
  if (/^\s*on:\s*(?:push|\[\s*push\s*\])\s*(?:#.*)?$/m.test(normalized)) {
3327
3324
  return true;
@@ -3333,7 +3330,7 @@ function githubWorkflowRunsOnMainPush(text) {
3333
3330
  }
3334
3331
  const pushIndent = lines[pushIndex].match(/^(\s*)/)?.[1].length ?? 0;
3335
3332
  let hasBranchFilter = false;
3336
- let ignoresMain = false;
3333
+ let ignoresProductionBranch = false;
3337
3334
  for (let index = pushIndex + 1; index < lines.length; index++) {
3338
3335
  const line = lines[index];
3339
3336
  const indent = line.match(/^(\s*)/)?.[1].length ?? 0;
@@ -3347,20 +3344,20 @@ function githubWorkflowRunsOnMainPush(text) {
3347
3344
  const branchMatch = line.match(/^\s*branches:\s*(.*)$/);
3348
3345
  if (branchMatch) {
3349
3346
  hasBranchFilter = true;
3350
- if (yamlBranchValueContainsMain(branchMatch[1]) ||
3351
- yamlListContainsMainBranch(lines, index, indent)) {
3347
+ if (yamlScalarValueContainsToken(branchMatch[1], productionBranch) ||
3348
+ yamlListContainsToken(lines, index, indent, productionBranch)) {
3352
3349
  return true;
3353
3350
  }
3354
3351
  continue;
3355
3352
  }
3356
3353
  const branchIgnoreMatch = line.match(/^\s*branches-ignore:\s*(.*)$/);
3357
3354
  if (branchIgnoreMatch &&
3358
- (yamlBranchValueContainsMain(branchIgnoreMatch[1]) ||
3359
- yamlListContainsMainBranch(lines, index, indent))) {
3360
- ignoresMain = true;
3355
+ (yamlScalarValueContainsToken(branchIgnoreMatch[1], productionBranch) ||
3356
+ yamlListContainsToken(lines, index, indent, productionBranch))) {
3357
+ ignoresProductionBranch = true;
3361
3358
  }
3362
3359
  }
3363
- return !hasBranchFilter && !ignoresMain;
3360
+ return !hasBranchFilter && !ignoresProductionBranch;
3364
3361
  }
3365
3362
  function workflowStepRunsDbMigrate(block) {
3366
3363
  return /\b(?:deno\s+task\s+db:migrate|pnpm\s+(?:run\s+)?db:migrate|npm\s+run\s+db:migrate|yarn\s+(?:run\s+)?db:migrate|bun\s+run\s+db:migrate)\b/
@@ -3498,7 +3495,7 @@ function getGithubWorkflowJobBlocks(text) {
3498
3495
  };
3499
3496
  });
3500
3497
  }
3501
- function inspectDbMigrationWorkflow(relativePath, workflowText) {
3498
+ function inspectDbMigrationWorkflow(relativePath, workflowText, productionBranch) {
3502
3499
  const normalized = normalizeText(workflowText);
3503
3500
  const workflowEnvText = workflowPreambleBeforeJobs(normalized);
3504
3501
  const jobs = getGithubWorkflowJobBlocks(normalized).map((job) => {
@@ -3550,7 +3547,7 @@ function inspectDbMigrationWorkflow(relativePath, workflowText) {
3550
3547
  });
3551
3548
  return {
3552
3549
  jobs,
3553
- mainPush: githubWorkflowRunsOnMainPush(normalized),
3550
+ productionPush: githubWorkflowRunsOnBranchPush(normalized, productionBranch),
3554
3551
  usesGithubDatabaseUrlVariable: workflowUsesGithubDatabaseUrlVariable(normalized),
3555
3552
  relativePath,
3556
3553
  usesGithubDatabaseUrlSecret: workflowUsesGithubDatabaseUrlSecret(normalized),
@@ -3580,7 +3577,7 @@ function dbMigrationWorkflowIsValid(workflow) {
3580
3577
  function isJsonObject(value) {
3581
3578
  return typeof value === "object" && value !== null && !Array.isArray(value);
3582
3579
  }
3583
- function vercelMainDeploymentIsDisabled(vercelJson) {
3580
+ function vercelProductionDeploymentIsDisabled(vercelJson, productionBranch) {
3584
3581
  const git = vercelJson.git;
3585
3582
  if (!isJsonObject(git)) {
3586
3583
  return false;
@@ -3590,9 +3587,9 @@ function vercelMainDeploymentIsDisabled(vercelJson) {
3590
3587
  return true;
3591
3588
  }
3592
3589
  return isJsonObject(deploymentEnabled) &&
3593
- deploymentEnabled.main === false;
3590
+ deploymentEnabled[productionBranch] === false;
3594
3591
  }
3595
- async function checkDbProductionMigrationFlow(cwd, production) {
3592
+ async function checkDbProductionMigrationFlow(cwd, production, productionBranch) {
3596
3593
  const issues = [];
3597
3594
  const suggestions = new Set();
3598
3595
  const warnings = [];
@@ -3600,21 +3597,21 @@ async function checkDbProductionMigrationFlow(cwd, production) {
3600
3597
  const vercelJsonPath = (0, node_path_1.join)(cwd, "vercel.json");
3601
3598
  const vercelJsonText = await readTextIfExists(vercelJsonPath);
3602
3599
  if (!vercelJsonText) {
3603
- findings.push("DB production migration flow is missing vercel.json with automatic main deployments disabled.");
3604
- suggestions.add("Add `git.deploymentEnabled.main: false` to vercel.json so production deploys wait for the GitHub Actions migration job.");
3600
+ findings.push(`DB production migration flow is missing vercel.json with automatic ${productionBranch} deployments disabled.`);
3601
+ suggestions.add(`Add \`git.deploymentEnabled[${JSON.stringify(productionBranch)}]: false\` to vercel.json so production deploys wait for the GitHub Actions migration job.`);
3605
3602
  }
3606
3603
  else {
3607
3604
  try {
3608
3605
  const vercelJson = parseJson(vercelJsonText, "vercel.json");
3609
- if (!vercelMainDeploymentIsDisabled(vercelJson)) {
3610
- findings.push("DB production migration flow does not disable Vercel automatic deployments for main in vercel.json.");
3606
+ if (!vercelProductionDeploymentIsDisabled(vercelJson, productionBranch)) {
3607
+ findings.push(`DB production migration flow does not disable Vercel automatic deployments for ${productionBranch} in vercel.json.`);
3611
3608
  suggestions.add("Set `git.deploymentEnabled` to `false` in vercel.json so GitHub Actions owns production deployments.");
3612
3609
  }
3613
3610
  }
3614
3611
  catch (error) {
3615
3612
  findings.push("DB production migration flow could not inspect vercel.json: " +
3616
3613
  (error instanceof Error ? error.message : String(error)));
3617
- suggestions.add("Fix vercel.json so Loom can verify `git.deploymentEnabled.main: false`.");
3614
+ suggestions.add(`Fix vercel.json so Loom can verify \`git.deploymentEnabled[${JSON.stringify(productionBranch)}]: false\`.`);
3618
3615
  }
3619
3616
  }
3620
3617
  const workflowInspections = [];
@@ -3623,67 +3620,69 @@ async function checkDbProductionMigrationFlow(cwd, production) {
3623
3620
  if (!workflowText) {
3624
3621
  continue;
3625
3622
  }
3626
- workflowInspections.push(inspectDbMigrationWorkflow(relativePath, workflowText));
3623
+ workflowInspections.push(inspectDbMigrationWorkflow(relativePath, workflowText, productionBranch));
3627
3624
  }
3628
- const mainPushWorkflows = workflowInspections.filter((inspection) => inspection.mainPush);
3629
- const migrationJobs = mainPushWorkflows.flatMap((inspection) => inspection.jobs.filter((job) => job.migrateStepIndex >= 0));
3625
+ const productionPushWorkflows = workflowInspections.filter((inspection) => inspection.productionPush);
3626
+ const migrationJobs = productionPushWorkflows.flatMap((inspection) => inspection.jobs.filter((job) => job.migrateStepIndex >= 0));
3630
3627
  const migrationWorkflowPaths = [
3631
3628
  ...new Set(migrationJobs.map((inspection) => inspection.relativePath)),
3632
3629
  ];
3633
- const validMigrationWorkflow = mainPushWorkflows.find(dbMigrationWorkflowIsValid);
3634
- const oldDeployHookWorkflows = mainPushWorkflows.filter((inspection) => inspection.usesOldVercelDeployHook);
3635
- const duplicatedDatabaseUrlWorkflows = mainPushWorkflows.filter((inspection) => inspection.usesGithubDatabaseUrlSecret);
3636
- const databaseUrlVariableWorkflows = mainPushWorkflows.filter((inspection) => inspection.usesGithubDatabaseUrlVariable);
3637
- const legacyUnpooledSecretWorkflows = mainPushWorkflows.filter((inspection) => inspection.usesGithubUnpooledDatabaseUrlSecret &&
3630
+ const validMigrationWorkflow = productionPushWorkflows.find(dbMigrationWorkflowIsValid);
3631
+ const oldDeployHookWorkflows = productionPushWorkflows.filter((inspection) => inspection.usesOldVercelDeployHook);
3632
+ const duplicatedDatabaseUrlWorkflows = productionPushWorkflows.filter((inspection) => inspection.usesGithubDatabaseUrlSecret);
3633
+ const databaseUrlVariableWorkflows = productionPushWorkflows.filter((inspection) => inspection.usesGithubDatabaseUrlVariable);
3634
+ const legacyUnpooledSecretWorkflows = productionPushWorkflows.filter((inspection) => inspection.usesGithubUnpooledDatabaseUrlSecret &&
3638
3635
  !inspection.usesGithubMigrationDatabaseUrlSecret);
3639
- const invalidMigrationValidationPaths = mainPushWorkflows.flatMap((inspection) => inspection.jobs.flatMap((job) => job.migrationVerifyStepIndex >= 0 &&
3636
+ const invalidMigrationValidationPaths = productionPushWorkflows.flatMap((inspection) => inspection.jobs.flatMap((job) => job.migrationVerifyStepIndex >= 0 &&
3640
3637
  !job.migrationVerifyUsesPulledSnapshot
3641
3638
  ? [inspection.relativePath]
3642
3639
  : []));
3643
- const structuralOnlyMigrationValidationPaths = mainPushWorkflows.flatMap((inspection) => inspection.jobs.flatMap((job) => job.migrationVerifyStepIndex >= 0 && !job.migrationVerifyConnects
3640
+ const structuralOnlyMigrationValidationPaths = productionPushWorkflows
3641
+ .flatMap((inspection) => inspection.jobs.flatMap((job) => job.migrationVerifyStepIndex >= 0 && !job.migrationVerifyConnects
3644
3642
  ? [inspection.relativePath]
3645
3643
  : []));
3646
- const vercelCurlWorkflowPaths = mainPushWorkflows.flatMap((inspection) => inspection.jobs.some((job) => job.vercelCurlStepIndex >= 0)
3644
+ const vercelCurlWorkflowPaths = productionPushWorkflows.flatMap((inspection) => inspection.jobs.some((job) => job.vercelCurlStepIndex >= 0)
3647
3645
  ? [inspection.relativePath]
3648
3646
  : []);
3649
3647
  if (!validMigrationWorkflow) {
3650
- if (mainPushWorkflows.length === 0) {
3651
- findings.push("DB production migration flow is missing a GitHub Actions workflow for pushes to main.");
3648
+ if (productionPushWorkflows.length === 0) {
3649
+ findings.push(`DB production migration flow is missing a GitHub Actions workflow for pushes to ${productionBranch}.`);
3652
3650
  }
3653
3651
  else if (migrationJobs.length === 0) {
3654
- findings.push("DB production migration flow does not run `db:migrate` in the main release workflow: " +
3655
- mainPushWorkflows.map((inspection) => inspection.relativePath).join(", "));
3652
+ findings.push(`DB production migration flow does not run \`db:migrate\` in the ${productionBranch} release workflow: ` +
3653
+ productionPushWorkflows.map((inspection) => inspection.relativePath)
3654
+ .join(", "));
3656
3655
  }
3657
3656
  else if (!migrationJobs.some((inspection) => inspection.hasDatabaseUrlBinding ||
3658
3657
  inspection.migrateWithVercelProductionEnvStepIndex >= 0)) {
3659
3658
  findings.push("DB production migration flow runs migrations without Vercel production env injection: " +
3660
3659
  migrationWorkflowPaths.join(", "));
3661
3660
  }
3662
- else if (!mainPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.stageStepIndex >= 0))) {
3661
+ else if (!productionPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.stageStepIndex >= 0))) {
3663
3662
  findings.push("DB production migration flow does not stage a prebuilt production deployment before migrations: " +
3664
3663
  migrationWorkflowPaths.join(", "));
3665
3664
  }
3666
- else if (!mainPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.promoteStepIndex >= 0))) {
3665
+ else if (!productionPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.promoteStepIndex >= 0))) {
3667
3666
  findings.push("DB production migration flow does not promote the staged deployment after migrations: " +
3668
3667
  migrationWorkflowPaths.join(", "));
3669
3668
  }
3670
- else if (!mainPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.snapshotStepIndex === job.pullStepIndex &&
3669
+ else if (!productionPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.snapshotStepIndex === job.pullStepIndex &&
3671
3670
  job.metadataStepIndex > job.pullStepIndex &&
3672
3671
  job.prepareBuildEnvStepIndex > job.metadataStepIndex &&
3673
3672
  job.verifyBuildEnvStepIndex > job.buildStepIndex))) {
3674
3673
  findings.push("DB production migration flow does not preserve the pulled migration env and verify metadata-backed build placeholders: " +
3675
3674
  migrationWorkflowPaths.join(", "));
3676
3675
  }
3677
- else if (!mainPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.migrateStepRestoresPulledEnv))) {
3676
+ else if (!productionPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.migrateStepRestoresPulledEnv))) {
3678
3677
  findings.push("DB production migration flow does not restore the untouched pulled env before migrations: " +
3679
3678
  migrationWorkflowPaths.join(", "));
3680
3679
  }
3681
- else if (!mainPushWorkflows.some((inspection) => inspection.usesGithubMigrationDatabaseUrlSecret ||
3680
+ else if (!productionPushWorkflows.some((inspection) => inspection.usesGithubMigrationDatabaseUrlSecret ||
3682
3681
  inspection.usesGithubUnpooledDatabaseUrlSecret)) {
3683
3682
  findings.push("DB production migration flow is not ready for Sensitive database variables because it lacks a GitHub migration-secret binding: " +
3684
3683
  migrationWorkflowPaths.join(", "));
3685
3684
  }
3686
- else if (mainPushWorkflows.some((inspection) => inspection.jobs.some((job) => dbMigrationJobHasOrderedStagedRelease(job) &&
3685
+ else if (productionPushWorkflows.some((inspection) => inspection.jobs.some((job) => dbMigrationJobHasOrderedStagedRelease(job) &&
3687
3686
  !job.promoteStepUsesExplicitScope))) {
3688
3687
  findings.push("DB production migration flow promotes the staged deployment without an explicit Vercel team scope: " +
3689
3688
  migrationWorkflowPaths.join(", "));
@@ -6044,6 +6043,11 @@ async function setupCloudflareR2(cwd, options = {}) {
6044
6043
  const dbConfig = mergeDbConfig(framework, dbFeature.config);
6045
6044
  const config = getFilesConfig(framework, dbConfig, feature.config);
6046
6045
  const existingProvider = config.storage.provider;
6046
+ if (existingProvider) {
6047
+ const policyIssues = (0, filesR2Policy_js_1.filesR2PolicyIssues)(existingProvider);
6048
+ if (policyIssues.length)
6049
+ throw new Error(policyIssues.join(" "));
6050
+ }
6047
6051
  const wranglerCommand = await detectWranglerCommand(cwd, commandRunner, env);
6048
6052
  if (!wranglerCommand) {
6049
6053
  throw new Error("Wrangler is not available. On Arch Linux install it with `sudo pacman -S wrangler`, then run `wrangler login`.");
@@ -6165,7 +6169,13 @@ async function setupCloudflareR2(cwd, options = {}) {
6165
6169
  buckets,
6166
6170
  connectionStatus: "buckets-ready",
6167
6171
  credentialMode: "manual",
6168
- directBrowserAccess: false,
6172
+ directBrowserAccess: existingProvider?.directBrowserAccess ?? false,
6173
+ ...(existingProvider?.directUpload
6174
+ ? { directUpload: existingProvider.directUpload }
6175
+ : {}),
6176
+ ...(existingProvider?.forcePathStyle !== undefined
6177
+ ? { forcePathStyle: existingProvider.forcePathStyle }
6178
+ : {}),
6169
6179
  endpoint: cloudflareR2Endpoint(accountId, jurisdiction),
6170
6180
  jurisdiction,
6171
6181
  kind: "cloudflare-r2",
@@ -6190,6 +6200,16 @@ async function setupCloudflareR2(cwd, options = {}) {
6190
6200
  throw new Error(`R2 bucket \`${bucket}\` exists, but Loom could not verify its private-access policy: ${privacy.detail}. Rerun after Wrangler can inspect public URL and custom-domain settings.`);
6191
6201
  }
6192
6202
  }
6203
+ if (config.storage.provider.directBrowserAccess) {
6204
+ for (const bucket of new Set(Object.values(buckets))) {
6205
+ const cors = await inspectR2BucketCors(cwd, commandRunner, providerEnv, wranglerCommand, bucket, config.storage.provider, options.cloudflareProfile);
6206
+ if (cors !== "matching") {
6207
+ throw new Error(`R2 bucket \`${bucket}\` CORS ${cors === "unknown"
6208
+ ? "could not be verified"
6209
+ : "differs from the declared presigned-PUT policy"}. Review and apply its exact CORS separately, then rerun setup; Loom never applies CORS implicitly.`);
6210
+ }
6211
+ }
6212
+ }
6193
6213
  const dependencyUpdate = await (0, projectTooling_js_1.mutateProjectDependencies)(cwd, tooling.dependencies, { dependencies: FILES_S3_DEPENDENCIES });
6194
6214
  if (dependencyUpdate.changed) {
6195
6215
  changedFiles.push(dependencyUpdate.config);
@@ -6209,7 +6229,9 @@ async function setupCloudflareR2(cwd, options = {}) {
6209
6229
  const desiredLocalValues = {
6210
6230
  FILES_S3_BUCKET: localBucket,
6211
6231
  FILES_S3_ENDPOINT: localEndpoint,
6212
- FILES_S3_FORCE_PATH_STYLE: localProvider === "minio" ? "true" : "false",
6232
+ FILES_S3_FORCE_PATH_STYLE: localProvider === "minio"
6233
+ ? "true"
6234
+ : String(config.storage.provider.forcePathStyle ?? false),
6213
6235
  FILES_S3_REGION: "auto",
6214
6236
  FILES_STORAGE_PROVIDER: localProvider === "minio"
6215
6237
  ? "minio"
@@ -6257,6 +6279,7 @@ async function setupCloudflareR2(cwd, options = {}) {
6257
6279
  FILES_S3_BUCKET: buckets[environment],
6258
6280
  FILES_S3_ENDPOINT: cloudflareR2Endpoint(accountId, jurisdiction),
6259
6281
  ...FILES_S3_NON_SECRET_ENV_VALUES,
6282
+ FILES_S3_FORCE_PATH_STYLE: String(config.storage.provider.forcePathStyle ?? false),
6260
6283
  };
6261
6284
  const existingNonSecretNames = Object.keys(nonSecretValues).filter((name) => hasExactEnvName(listing, name));
6262
6285
  if (existingNonSecretNames.length) {
@@ -6465,14 +6488,14 @@ function findGithubVariableValue(name, ...collections) {
6465
6488
  }
6466
6489
  return null;
6467
6490
  }
6468
- async function hasMainPushDbMigrationWorkflow(cwd) {
6491
+ async function hasProductionPushDbMigrationWorkflow(cwd, productionBranch) {
6469
6492
  for (const relativePath of await getGithubWorkflowRelativePaths(cwd)) {
6470
6493
  const workflowText = await readTextIfExists((0, node_path_1.join)(cwd, relativePath));
6471
6494
  if (!workflowText) {
6472
6495
  continue;
6473
6496
  }
6474
- const inspection = inspectDbMigrationWorkflow(relativePath, workflowText);
6475
- if (inspection.mainPush &&
6497
+ const inspection = inspectDbMigrationWorkflow(relativePath, workflowText, productionBranch);
6498
+ if (inspection.productionPush &&
6476
6499
  inspection.jobs.some((job) => job.migrateStepIndex >= 0 ||
6477
6500
  job.stageStepIndex >= 0 ||
6478
6501
  job.promoteStepIndex >= 0)) {
@@ -6919,6 +6942,19 @@ async function checkDbNetworkFeature(context) {
6919
6942
  if (!feature || feature.status !== "active") {
6920
6943
  return [];
6921
6944
  }
6945
+ let productionBranch;
6946
+ try {
6947
+ productionBranch = (0, releaseConfig_js_1.resolveProductionBranch)(feature.config?.release);
6948
+ }
6949
+ catch (error) {
6950
+ return [{
6951
+ label: "DB release configuration",
6952
+ run: () => Promise.resolve(networkCheckResult("issue", error.message, {
6953
+ issues: [error.message],
6954
+ suggestions: ["Fix features.db.config.release in loom.json."],
6955
+ })),
6956
+ }];
6957
+ }
6922
6958
  const provider = feature.config
6923
6959
  ?.provider;
6924
6960
  const state = {
@@ -7026,7 +7062,7 @@ async function checkDbNetworkFeature(context) {
7026
7062
  createDbEnvCheckStep("Preview has Neon/Postgres env vars", "preview", "present", state, context),
7027
7063
  createDbEnvCheckStep("Development does not have Neon/Postgres env vars", "development", "absent", state, context),
7028
7064
  ];
7029
- if (await hasMainPushDbMigrationWorkflow(context.cwd)) {
7065
+ if (await hasProductionPushDbMigrationWorkflow(context.cwd, productionBranch)) {
7030
7066
  steps.push(createGithubReleaseConfigCheckStep(state, context));
7031
7067
  }
7032
7068
  return steps;
@@ -7067,6 +7103,28 @@ async function inspectR2BucketPrivacy(cwd, commandRunner, env, wranglerCommand,
7067
7103
  }
7068
7104
  return { detail: "No public endpoint detected.", status: "private" };
7069
7105
  }
7106
+ async function inspectR2BucketCors(cwd, commandRunner, env, wranglerCommand, bucket, provider, cloudflareProfile) {
7107
+ const result = await commandRunner(wranglerCommand, r2BucketCommandArgs(["r2", "bucket", "cors", "list", bucket], provider, cloudflareProfile), {
7108
+ cwd,
7109
+ env: {
7110
+ ...env,
7111
+ NO_COLOR: "1",
7112
+ FORCE_COLOR: "0",
7113
+ WRANGLER_HIDE_BANNER: "true",
7114
+ },
7115
+ stdio: "pipe",
7116
+ });
7117
+ const rules = result.code === 0
7118
+ ? (0, filesR2Policy_js_1.parseWranglerR2Cors)(result.stdout, bucket)
7119
+ : null;
7120
+ if (rules === null)
7121
+ return "unknown";
7122
+ const environments = FILES_R2_ENVIRONMENTS.filter((environment) => provider.buckets[environment] === bucket);
7123
+ return provider.directUpload &&
7124
+ (0, filesR2Policy_js_1.r2CorsMatchesPolicy)(rules, provider.directUpload, environments)
7125
+ ? "matching"
7126
+ : "drift";
7127
+ }
7070
7128
  function checkFilesNetworkFeature(context) {
7071
7129
  const feature = context.manifest.features.files;
7072
7130
  if (!feature || feature.status !== "active")
@@ -7086,6 +7144,13 @@ function checkFilesNetworkFeature(context) {
7086
7144
  })),
7087
7145
  }];
7088
7146
  }
7147
+ const policyIssues = (0, filesR2Policy_js_1.filesR2PolicyIssues)(provider);
7148
+ if (policyIssues.length) {
7149
+ return [{
7150
+ label: "Cloudflare R2 private upload policy is valid",
7151
+ run: () => Promise.resolve(networkCheckResult("issue", "Invalid Files R2 policy; provider checks were not attempted.", { issues: policyIssues })),
7152
+ }];
7153
+ }
7089
7154
  const state = {
7090
7155
  accountAvailable: false,
7091
7156
  vercelCommand: null,
@@ -7205,6 +7270,33 @@ function checkFilesNetworkFeature(context) {
7205
7270
  },
7206
7271
  });
7207
7272
  }
7273
+ if (provider.directBrowserAccess) {
7274
+ for (const bucket of new Set(Object.values(provider.buckets))) {
7275
+ steps.push({
7276
+ label: `R2 bucket ${bucket} CORS matches the private presigned-PUT policy`,
7277
+ run: async () => {
7278
+ if (!state.wranglerCommand || !state.accountAvailable) {
7279
+ return networkCheckResult("skipped", "Skipped until Wrangler account access is verified.");
7280
+ }
7281
+ const cors = await inspectR2BucketCors(context.cwd, context.commandRunner, providerEnv, state.wranglerCommand, bucket, provider, context.cloudflareProfile);
7282
+ return cors === "matching"
7283
+ ? networkCheckResult("ok", `R2 bucket \`${bucket}\` CORS matches the declared private presigned-PUT policy.`)
7284
+ : networkCheckResult("issue", `R2 bucket \`${bucket}\` CORS is ${cors === "unknown"
7285
+ ? "unverified"
7286
+ : "different from the declared policy"}.`, {
7287
+ issues: [
7288
+ `Files R2 direct-upload CORS ${cors === "unknown"
7289
+ ? "could not be read or parsed"
7290
+ : "drift detected"}: ${bucket}.`,
7291
+ ],
7292
+ suggestions: [
7293
+ "Review the bucket's exact CORS policy using Wrangler; apply changes separately, then rerun `loom files r2 check`. Loom never applies CORS implicitly.",
7294
+ ],
7295
+ });
7296
+ },
7297
+ });
7298
+ }
7299
+ }
7208
7300
  steps.push({
7209
7301
  label: "Vercel CLI authentication and project link are available",
7210
7302
  run: async () => {
@@ -7280,6 +7372,7 @@ function checkFilesNetworkFeature(context) {
7280
7372
  FILES_S3_BUCKET: provider.buckets[environment],
7281
7373
  FILES_S3_ENDPOINT: provider.endpoint,
7282
7374
  ...FILES_S3_NON_SECRET_ENV_VALUES,
7375
+ FILES_S3_FORCE_PATH_STYLE: String(provider.forcePathStyle ?? false),
7283
7376
  };
7284
7377
  const drift = Object.entries(expectedValues).filter(([name, value]) => actualValues[name] !== value).map(([name]) => name);
7285
7378
  return drift.length
@@ -7540,6 +7633,7 @@ async function setupGithubVercelRelease(cwd, options = {}) {
7540
7633
  const manifest = manifestText
7541
7634
  ? parseJson(manifestText, "loom.json")
7542
7635
  : null;
7636
+ const productionBranch = (0, releaseConfig_js_1.resolveProductionBranch)(manifest?.features.db?.config?.release);
7543
7637
  const vercelLink = await readVercelProjectLink(cwd);
7544
7638
  if (!vercelLink.linked || !vercelLink.orgId || !vercelLink.projectId) {
7545
7639
  throw new Error(`${vercelLink.detail} Run \`vercel link\` before \`loom db release setup-github\`.`);
@@ -7578,8 +7672,8 @@ async function setupGithubVercelRelease(cwd, options = {}) {
7578
7672
  `repos/:owner/:repo/environments/${environment}/deployment-branch-policies`,
7579
7673
  ], { cwd, env, stdio: "pipe" });
7580
7674
  const branchPolicies = parseJson(branchPoliciesResult.stdout || "{}", "GitHub deployment branch policies");
7581
- if (!branchPolicies.branch_policies?.some((policy) => policy.name === "main")) {
7582
- await requireCommand(`Allow main to deploy to GitHub ${environment}`, commandRunner, "gh", [
7675
+ if (!branchPolicies.branch_policies?.some((policy) => policy.name === productionBranch)) {
7676
+ await requireCommand(`Allow ${productionBranch} to deploy to GitHub ${environment}`, commandRunner, "gh", [
7583
7677
  "api",
7584
7678
  "--method",
7585
7679
  "POST",
@@ -7589,11 +7683,11 @@ async function setupGithubVercelRelease(cwd, options = {}) {
7589
7683
  ], {
7590
7684
  cwd,
7591
7685
  env,
7592
- input: JSON.stringify({ name: "main", type: "branch" }),
7686
+ input: JSON.stringify({ name: productionBranch, type: "branch" }),
7593
7687
  stdio: "pipe",
7594
7688
  });
7595
7689
  }
7596
- notes.push(`Ensured GitHub environment \`${environment}\` exists and only allows the main release branch.`);
7690
+ notes.push(`Ensured GitHub environment \`${environment}\` exists and allows the ${productionBranch} release branch; existing branch policies are preserved.`);
7597
7691
  await requireCommand("Set GitHub VERCEL_ORG_ID variable", commandRunner, "gh", [
7598
7692
  "variable",
7599
7693
  "set",
@@ -7751,6 +7845,7 @@ async function applyDbFeature(cwd, framework, manifest, activate) {
7751
7845
  const currentFeature = manifest.features.db;
7752
7846
  const currentConfig = currentFeature?.config;
7753
7847
  const config = mergeDbConfig(framework, currentConfig);
7848
+ (0, releaseConfig_js_1.resolveProductionBranch)(config.release);
7754
7849
  const feature = currentFeature
7755
7850
  ? structuredClone(currentFeature)
7756
7851
  : { status: "planned" };
@@ -8657,11 +8752,22 @@ async function checkDbFeature(cwd, framework, manifest, options) {
8657
8752
  return { issues, suggestions: [], warnings };
8658
8753
  }
8659
8754
  const config = mergeDbConfig(framework, feature.config);
8755
+ let productionBranch;
8756
+ try {
8757
+ productionBranch = (0, releaseConfig_js_1.resolveProductionBranch)(config.release);
8758
+ }
8759
+ catch (error) {
8760
+ return {
8761
+ issues: [error.message],
8762
+ suggestions: ["Fix features.db.config.release in loom.json."],
8763
+ warnings,
8764
+ };
8765
+ }
8660
8766
  const { packageJson } = await readProjectPackageJson(cwd);
8661
8767
  const tooling = await getProjectTooling(cwd, manifest);
8662
8768
  const testRunner = await getDbTestRunner(cwd, tooling);
8663
8769
  const expectedScripts = getDbExpectedScripts(config, tooling);
8664
- const migrationFlowCheck = await checkDbProductionMigrationFlow(cwd, options.production ?? false);
8770
+ const migrationFlowCheck = await checkDbProductionMigrationFlow(cwd, options.production ?? false, productionBranch);
8665
8771
  issues.push(...migrationFlowCheck.issues);
8666
8772
  warnings.push(...migrationFlowCheck.warnings);
8667
8773
  for (const suggestion of migrationFlowCheck.suggestions) {
@@ -8986,10 +9092,7 @@ async function checkFilesFeature(cwd, framework, manifest, options) {
8986
9092
  if (provider.kind !== "cloudflare-r2") {
8987
9093
  issues.push("Files storage provider kind must be cloudflare-r2.");
8988
9094
  }
8989
- if (provider.accessMode !== "private" || provider.directBrowserAccess ||
8990
- provider.publicUrl !== null) {
8991
- issues.push("Files R2 provider policy must remain private unless a future explicit public-access workflow is adopted.");
8992
- }
9095
+ issues.push(...(0, filesR2Policy_js_1.filesR2PolicyIssues)(provider));
8993
9096
  if (!provider.accountId || !provider.buckets.production ||
8994
9097
  !provider.buckets.preview) {
8995
9098
  issues.push("Files R2 provider policy is missing account or bucket identifiers.");
@@ -0,0 +1,10 @@
1
+ /** App-owned production release settings in features.db.config.release. */
2
+ export type DbReleaseConfig = {
3
+ /** Literal short Git branch name; omitted settings retain the main default. */
4
+ productionBranch?: string;
5
+ };
6
+ /** Portable literal branch names, excluding Git-invalid paths and glob syntax. */
7
+ export declare const PRODUCTION_BRANCH_PATTERN: string;
8
+ /** Resolve the release branch before writing provider configuration or checking it. */
9
+ export declare function resolveProductionBranch(release: unknown): string;
10
+ //# sourceMappingURL=releaseConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"releaseConfig.d.ts","sourceRoot":"","sources":["../../../src/src/cli/releaseConfig.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,MAAM,eAAe,GAAG;IAC5B,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,yBAAyB,QAC8E,CAAC;AAErH,uFAAuF;AACvF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAuBhE"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PRODUCTION_BRANCH_PATTERN = void 0;
4
+ exports.resolveProductionBranch = resolveProductionBranch;
5
+ /** Portable literal branch names, excluding Git-invalid paths and glob syntax. */
6
+ exports.PRODUCTION_BRANCH_PATTERN = String
7
+ .raw `^(?!HEAD$)(?!refs/)(?!.*(?:\.\.|//|/\.))(?!.*\.lock(?:/|$))(?!.*[/.]$)[A-Za-z0-9_][A-Za-z0-9._/-]*(?![\s\S])`;
8
+ /** Resolve the release branch before writing provider configuration or checking it. */
9
+ function resolveProductionBranch(release) {
10
+ if (release === undefined)
11
+ return "main";
12
+ if (typeof release !== "object" || release === null || Array.isArray(release)) {
13
+ throw new Error("features.db.config.release must be an object.");
14
+ }
15
+ if (Object.keys(release).some((key) => key !== "productionBranch")) {
16
+ throw new Error("features.db.config.release only supports productionBranch.");
17
+ }
18
+ const branch = release.productionBranch;
19
+ if (branch === undefined)
20
+ return "main";
21
+ if (typeof branch !== "string" ||
22
+ !new RegExp(exports.PRODUCTION_BRANCH_PATTERN).test(branch)) {
23
+ throw new Error("features.db.config.release.productionBranch must be a literal short Git branch name using letters, numbers, underscores, dots, hyphens or slashes; patterns and refs/ prefixes are not supported.");
24
+ }
25
+ return branch;
26
+ }
@@ -6,6 +6,10 @@ export declare const DEFAULT_LOOM_PWA_UPDATE_PROMPT = "A newer version of this w
6
6
  export interface LoomSerwistLifecycleEvent {
7
7
  /** Whether Serwist identified the event as an update to an existing worker. */
8
8
  isUpdate?: boolean;
9
+ /** Worker associated with this event, when supplied by the integration. */
10
+ sw?: ServiceWorker;
11
+ /** Whether another registration or tab initiated this lifecycle event. */
12
+ isExternal?: boolean;
9
13
  /** The Serwist lifecycle event name. */
10
14
  type: string;
11
15
  /** Whether a waiting service worker existed before registration completed. */
@@ -21,7 +25,7 @@ export type LoomSerwistEventName = "activated" | "controlling" | "installed" | "
21
25
  */
22
26
  export interface LoomWindowSerwist {
23
27
  addEventListener: (type: LoomSerwistEventName, listener: (event: LoomSerwistLifecycleEvent) => void) => void;
24
- messageSkipWaiting: () => Promise<void>;
28
+ messageSkipWaiting: () => void | Promise<void>;
25
29
  register: () => Promise<ServiceWorkerRegistration | undefined>;
26
30
  removeEventListener: (type: LoomSerwistEventName, listener: (event: LoomSerwistLifecycleEvent) => void) => void;
27
31
  }
@@ -80,6 +84,7 @@ export interface LoomPwaLifecycleOptions {
80
84
  updateMode?: LoomPwaUpdateMode;
81
85
  }
82
86
  declare global {
87
+ var serwist: LoomWindowSerwist | undefined;
83
88
  interface Window {
84
89
  serwist?: LoomWindowSerwist;
85
90
  }
@@ -87,7 +92,10 @@ declare global {
87
92
  /**
88
93
  * Registers Loom's Serwist lifecycle listeners and optional update polling.
89
94
  *
90
- * The returned cleanup function removes listeners and clears the polling timer.
95
+ * Cleanup removes this observer's listeners and polling without unregistering
96
+ * the worker or removing offline caches. Pending callbacks cannot activate or
97
+ * reload after cleanup. Registration is shared across effect remounts.
98
+ *
91
99
  * In `prompt` mode, a waiting worker is activated only after `canReloadNow` and
92
100
  * `confirmUpdate` both allow it; in `manual` mode Loom reports availability but
93
101
  * never activates the worker for the app.
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/next/pwa/mod.tsx"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AAIpC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,8BAA8B,oEACwB,CAAC;AAEpE,2EAA2E;AAC3E,MAAM,WAAW,yBAAyB;IACxC,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,+EAA+E;AAC/E,MAAM,MAAM,oBAAoB,GAC5B,WAAW,GACX,aAAa,GACb,WAAW,GACX,SAAS,GACT,WAAW,GACX,SAAS,CAAC;AAEd;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,EAAE,CAChB,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,KACjD,IAAI,CAAC;IACV,kBAAkB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,QAAQ,EAAE,MAAM,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC,CAAC;IAC/D,mBAAmB,EAAE,CACnB,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,KACjD,IAAI,CAAC;CACX;AAED,mEAAmE;AACnE,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,KAAK,EAAE,yBAAyB,CAAC;IACjC,kFAAkF;IAClF,QAAQ,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,MAAM,EAAE,aAAa,GAAG,SAAS,CAAC;IACl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