@amerged/ohmyhost-cli 0.1.65 → 0.1.67

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 (33) hide show
  1. package/README.md +1 -1
  2. package/dist/bin.js +1 -1
  3. package/dist/{chunk-GHNVKYDB.js → chunk-TTY2P5HM.js} +534 -162
  4. package/dist/index.js +1 -1
  5. package/package.json +1 -1
  6. package/src/apps/product-cli/package.json +1 -1
  7. package/src/apps/product-cli/src/cli.ts +131 -16
  8. package/src/apps/product-cli/src/command.ts +88 -13
  9. package/src/apps/product-cli/src/composition.ts +4 -4
  10. package/src/apps/product-cli/src/product-api.ts +25 -2
  11. package/src/apps/product-cli/src/psql-session.ts +31 -1
  12. package/src/apps/product-cli/src/runtime-contract.ts +65 -0
  13. package/src/packages/contracts/package.json +5 -0
  14. package/src/packages/contracts/src/browser-capabilities.ts +2 -0
  15. package/src/packages/contracts/src/credit-pricing.ts +1 -1
  16. package/src/packages/contracts/src/database-compute.ts +3 -50
  17. package/src/packages/contracts/src/database-migration-admission.ts +70 -7
  18. package/src/packages/contracts/src/database-migration-lexical.ts +20 -5
  19. package/src/packages/contracts/src/egress-origin.ts +48 -0
  20. package/src/packages/contracts/src/framework-admission.ts +7 -1
  21. package/src/packages/contracts/src/framework-source-rules.ts +132 -3
  22. package/src/packages/contracts/src/index.ts +3 -72
  23. package/src/packages/contracts/src/managed-sources.ts +16 -1
  24. package/src/packages/contracts/src/operation-deployment-result.ts +2 -2
  25. package/src/packages/contracts/src/operation-failure.ts +10 -6
  26. package/src/packages/contracts/src/problem-policy.ts +57 -2
  27. package/src/packages/contracts/src/secret-names.ts +3 -1
  28. package/src/packages/sdk-ts/package.json +1 -1
  29. package/src/packages/sdk-ts/src/generated/index.ts +2 -0
  30. package/src/packages/sdk-ts/src/generated/mcp-remote.gen.ts +205 -345
  31. package/src/packages/sdk-ts/src/generated/sdk.gen.ts +25 -8
  32. package/src/packages/sdk-ts/src/generated/types.gen.ts +96 -62
  33. package/src/packages/sdk-ts/src/managed-mail.ts +3 -0
@@ -38360,6 +38360,7 @@ var PACKAGE_MANAGER_CONTRACTS = Object.freeze({
38360
38360
  });
38361
38361
  var ALL_LOCKFILES = Object.freeze(Object.values(PACKAGE_MANAGER_CONTRACTS).flatMap(({ lockfiles }) => lockfiles));
38362
38362
  var PACKAGE_MANIFEST = "package.json";
38363
+ var YARN_MINIMUM_MAJOR = 3;
38363
38364
  var PACKAGE_MANAGER_DECLARATION = /^(bun|npm|pnpm|yarn)@((?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*))$/u;
38364
38365
  function resolvePackageManager(input) {
38365
38366
  const presentLockfiles = ALL_LOCKFILES.filter((lockfile2) => input.files.includes(lockfile2));
@@ -38386,6 +38387,9 @@ function resolvePackageManager(input) {
38386
38387
  if (manager === "bun" && version2 !== PINNED_BUN_VERSION) {
38387
38388
  throw new FrameworkAdmissionError("package_manager_version_unsupported", PACKAGE_MANIFEST);
38388
38389
  }
38390
+ if (manager === "yarn" && Number(version2.split(".")[0]) < YARN_MINIMUM_MAJOR) {
38391
+ throw new FrameworkAdmissionError("package_manager_version_unsupported", PACKAGE_MANIFEST);
38392
+ }
38389
38393
  return Object.freeze({
38390
38394
  manager,
38391
38395
  version: version2,
@@ -38637,7 +38641,7 @@ var FRAMEWORK_CONVERSION_DETAILS = Object.freeze({
38637
38641
  },
38638
38642
  package_manager_version_unsupported: {
38639
38643
  paths: ["manifest"],
38640
- template: `"{{path}}" pins a Bun version other than ${PINNED_BUN_VERSION}, the only Bun ohmyho.st builds with. Set packageManager to bun@${PINNED_BUN_VERSION}, reinstall to update the lockfile, commit and push the change, then plan the new commit.`
38644
+ template: `"{{path}}" pins a version ohmyho.st cannot build with: Bun other than ${PINNED_BUN_VERSION}, the only Bun ohmyho.st builds with, or Yarn before 3.0.0, the first that runs the frozen install flags. Set packageManager to bun@${PINNED_BUN_VERSION} or to a Yarn version from 3.0.0 on, such as yarn@4.9.4, reinstall to update the lockfile, commit and push the change, then plan the new commit.`
38641
38645
  },
38642
38646
  repository_configuration_invalid: {
38643
38647
  paths: ["repository_config"],
@@ -38872,7 +38876,7 @@ var failures = {
38872
38876
  ],
38873
38877
  operation_abandoned: [
38874
38878
  "ohmyho.st stopped this operation before it finished and ended it.",
38875
- "Repeating this operation cannot resume it. Read project status for what is live; if this operation names a deployment_id, read 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json' or MCP deployment_logs. Then submit the request once more with a new idempotency key: a deployment, promotion, rollback or deletion from a fresh plan, a rename with the ETag from project status. If it ends the same way, report both operation IDs through feedback."
38879
+ "Repeating this operation cannot resume it. Read project status for what is live; if this operation names a deployment_id, read 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --json' or MCP deployment_logs. Then submit the request once more with a new idempotency key: a deployment, promotion, rollback, deletion or data change from a fresh plan, a rename with the ETag from project status. If it ends the same way, report both operation IDs through feedback."
38876
38880
  ],
38877
38881
  database_write_rejected: [
38878
38882
  "The database rejected this write; it was not committed.",
@@ -38928,7 +38932,7 @@ var failures = {
38928
38932
  ],
38929
38933
  operation_failed: [
38930
38934
  "The operation failed.",
38931
- "Read project status and, if this operation names a deployment_id, its diagnostics with 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json'. Without one (a source link or project creation), check project status or project list, then repeat that command once with a new idempotency key. If it fails again, report the operation ID through feedback."
38935
+ "Read project status and, if this operation names a deployment_id, its diagnostics with 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --json' (next page: --cursor <next_cursor>). Without one (a source link or project creation), check project status or project list, then repeat that command once with a new idempotency key. If it fails again, report the operation ID through feedback."
38932
38936
  ],
38933
38937
  build_not_started: [
38934
38938
  "The deployment ended without starting a build.",
@@ -38936,7 +38940,7 @@ var failures = {
38936
38940
  ],
38937
38941
  build_failed: [
38938
38942
  "The build did not produce a verified deployable artifact.",
38939
- "Read the BUILD_FAILED item of its deployment_id with 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json' or MCP deployment_logs. Its excerpt shows install and build output: fix that error, save or push the corrected version and plan its commit. Without an excerpt the build printed nothing, passed the 8-minute limit or failed inside ohmyho.st: plan the same commit once more, and report the operation ID through feedback if it fails again."
38943
+ "Read the BUILD_FAILED item of its deployment_id with 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --json' or MCP deployment_logs. Its excerpt shows install and build output: fix that error, save or push the corrected version and plan its commit. Without an excerpt the build printed nothing, passed the 8-minute limit or failed inside ohmyho.st: plan the same commit once more, and report the operation ID through feedback if it fails again."
38940
38944
  ],
38941
38945
  insufficient_organization_credits: [
38942
38946
  "The organization does not have sufficient available credits for this operation.",
@@ -38952,11 +38956,11 @@ var failures = {
38952
38956
  ],
38953
38957
  database_migration_failed: [
38954
38958
  "The database migrations were not applied; none of this deployment's new migration files took effect.",
38955
- "Read the DATABASE_MIGRATION_FAILED item in 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json' and fix what it names; run 'ohmyhost init --dry-run --json' for migration_sql_not_admitted. Keep applied files unchanged, give new files later timestamps, and add to existing tables only nullable columns without default and non-unique indexes. Save or push the corrected version and plan its commit; never reset the database."
38959
+ "Read the DATABASE_MIGRATION_FAILED item in 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --json' (next page: --cursor <next_cursor>) and fix what it names; run 'ohmyhost init --dry-run --json' for migration_sql_not_admitted. Keep applied files unchanged, give new files later timestamps, and add to existing tables only nullable columns without default and non-unique indexes. Save or push the corrected version and plan its commit; never reset the database."
38956
38960
  ],
38957
38961
  runtime_candidate_failed: [
38958
38962
  "The deployed candidate failed its runtime checks.",
38959
- "Read the HEALTH_CHECK_FAILED item with 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json' or MCP deployment_logs. ohmyhost.yaml runtime.healthcheck (default /) must answer 2xx to a cookieless GET without redirect; status_code and, for owners, excerpt show the answer. After promotion or rollback, fix the environment's secrets and plan again; otherwise fix the app, save or push the corrected version and plan its commit. No item: plan once, then report."
38963
+ "Read the HEALTH_CHECK_FAILED item with 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --json' or MCP deployment_logs. ohmyhost.yaml runtime.healthcheck (default /) must answer 2xx to a cookieless GET without redirect; status_code and, for owners, excerpt show the answer. After promotion or rollback, fix the environment's secrets and plan again; otherwise fix the app, save or push the corrected version and plan its commit. No item: plan once, then report."
38960
38964
  ],
38961
38965
  runtime_candidate_rejected: [
38962
38966
  "The runtime refused to load the built Worker.",
@@ -38974,6 +38978,10 @@ var failures = {
38974
38978
  "The GitHub push could not be planned for deployment.",
38975
38979
  "Read error.detail: it names the file, the rule and the required change. Make that change, commit and push it; the next push is planned again. Without error.detail, plan the pushed commit explicitly with 'ohmyhost plan --project ULID --commit SHA --json' or MCP deployment_plan to read the reason. Replaying this failed operation cannot start a build."
38976
38980
  ],
38981
+ auto_deploy_repository_renamed: [
38982
+ "The GitHub repository was renamed after this project linked it, so the pushed commit was not deployed.",
38983
+ "Re-link the repository under its current name: run 'ohmyhost link --project PROJECT_ULID --repository-owner OWNER --repository-name NAME --idempotency-key KEY1 --json', then enable auto-deploy again with 'ohmyhost source auto-deploy set --project PROJECT_ULID --branch BRANCH --enabled true --idempotency-key KEY2 --json' and push again. Use a new idempotency key for each. Replaying this failed operation cannot deploy the commit."
38984
+ ],
38977
38985
  promotion_source_stale: [
38978
38986
  "The Dev deployment changed before promotion could start.",
38979
38987
  "Read the current Dev deployment with 'ohmyhost project status --project ULID --json', then run 'ohmyhost deployment promote plan' for that succeeded deployment and confirm the new plan. Replaying this terminal promotion cannot select another source."
@@ -39016,7 +39024,7 @@ function publicOperationReconciliation(observation) {
39016
39024
  state: observation.state,
39017
39025
  attempt_id: observation.attempt_id,
39018
39026
  observed_at: observation.observed_at,
39019
- suggested_action: observation.state === "required" ? "Confirm reconciliation of this same operation; preserve its existing build and resources. Do not submit another deployment." : "Reconciliation is running. Poll this same operation after 60 seconds; do not start another reconciliation or deployment."
39027
+ suggested_action: observation.state === "required" ? "Confirm reconciliation of this same operation with POST /v1/operations/{operation_id}:reconcile; preserve its existing build, data and resources. Do not submit another deployment or data change." : "Reconciliation is running. Poll this same operation after 60 seconds; do not start another reconciliation or deployment."
39020
39028
  });
39021
39029
  }
39022
39030
  function publicOperationFailure(internalCode, diagnostic2) {
@@ -39083,6 +39091,17 @@ function isManagedSourcePath(value) {
39083
39091
  ".dev.vars"
39084
39092
  ].includes(segment.toLowerCase()) && !(segment.toLowerCase().startsWith(".env") && (segment.toLowerCase() === ".env" || segment.toLowerCase().startsWith(".env.")) && segment.toLowerCase() !== ".env.example") && !segment.toLowerCase().startsWith(".dev.vars.") && !/^(?:id_(?:rsa|dsa|ecdsa|ed25519)(?:\.|$)|service[-_]account(?:\.|$))/iu.test(segment) && !/\.(?:pem|key|p12|pfx|jks|keystore)$/iu.test(segment));
39085
39093
  }
39094
+ function managedSourcePathConflict(paths) {
39095
+ const names = new Set(paths);
39096
+ return paths.some((candidate) => {
39097
+ const segments = candidate.split("/");
39098
+ for (let index = 1; index < segments.length; index++) {
39099
+ if (names.has(segments.slice(0, index).join("/")))
39100
+ return true;
39101
+ }
39102
+ return false;
39103
+ });
39104
+ }
39086
39105
  function managedSourceTarPath(value) {
39087
39106
  const path2 = `source/${value}`;
39088
39107
  if (path2.length <= 100)
@@ -39305,7 +39324,7 @@ function manifest(value) {
39305
39324
  seen.add(String(entry["path"]));
39306
39325
  total += Number(entry["byte_length"]);
39307
39326
  }
39308
- if (total > MANAGED_SOURCE_LIMITS.treeBytes)
39327
+ if (total > MANAGED_SOURCE_LIMITS.treeBytes || managedSourcePathConflict([...seen]))
39309
39328
  invalid();
39310
39329
  }
39311
39330
  function base64(value) {
@@ -40046,8 +40065,8 @@ var deploymentProgressActions = {
40046
40065
  queued: "The deployment is queued. Poll this same operation; do not submit another deployment.",
40047
40066
  building: "The build has not yet completed. Poll this same operation and read deployment logs if it fails.",
40048
40067
  publishing: "The build has completed. Runtime preparation or publication is still running; poll this same operation.",
40049
- waiting_for_mail: "Read 'ohmyhost mail status --project PROJECT --environment PROD_ENVIRONMENT_ULID --json' (MCP mail_status) now, with the Prod environment ID from 'ohmyhost project status', and follow its verification issue and DNS records. Keep this operation; do not rebuild or repeat correct DNS changes.",
40050
- mail_status_unavailable: "Mail readiness could not be observed. Read 'ohmyhost mail status --project PROJECT --environment PROD_ENVIRONMENT_ULID --json' (MCP mail_status) with the Prod environment ID from 'ohmyhost project status', and report a persistent error; keep this operation."
40068
+ waiting_for_mail: "Read the Prod mail status with 'ohmyhost mail status --project PROJECT --environment PROD_ENVIRONMENT_ULID --json' (MCP mail_status). An agent without that tool reads workspace_mail_domain_get or mail_binding_get, or REST GET /v1/projects/{project_id}/environments/{environment_id}/mail-domain. Use the Prod environment ID from 'ohmyhost project status', follow its verification issue and DNS records, keep this operation, and do not rebuild or repeat correct DNS changes.",
40069
+ mail_status_unavailable: "Mail readiness could not be observed. Read 'ohmyhost mail status --project PROJECT --environment PROD_ENVIRONMENT_ULID --json' (MCP mail_status). Without that tool, read REST GET /v1/projects/{project_id}/environments/{environment_id}/mail-domain. Use the Prod environment ID from 'ohmyhost project status', report a persistent error, and keep this operation."
40051
40070
  };
40052
40071
  function createOperationDeploymentProgress(input) {
40053
40072
  const project = ulid2(input.project_id);
@@ -40204,6 +40223,12 @@ var PROBLEM_POLICY = {
40204
40223
  action: "This workspace has no GitHub connection yet. Run 'ohmyhost github connect --organization ULID --idempotency-key KEY --json' for it, complete its browser link, then repeat the original source link. If the project belongs to another account, use that account's login instead; error.acting_as in the CLI and MCP names the login this ran as.",
40205
40224
  title: "GitHub connection required"
40206
40225
  },
40226
+ connection_revoked: {
40227
+ status: 403,
40228
+ retryable: false,
40229
+ action: "Remove the ohmyho.st connector from your agent and add it again to reconnect.",
40230
+ title: "Connection revoked"
40231
+ },
40207
40232
  github_connection_revoked: {
40208
40233
  status: 409,
40209
40234
  retryable: false,
@@ -40464,9 +40489,9 @@ var PROBLEM_POLICY = {
40464
40489
  confirmation_invalid: {
40465
40490
  status: 409,
40466
40491
  retryable: false,
40467
- action: "The confirmation token does not match this action or the project's current state. A deletion is also refused while a SQL export of the project is being captured, for up to about ten minutes ('ohmyhost export get'). Then create a new plan and confirm with its confirmation_token and resource_etag before the token expires.",
40492
+ action: "The confirmation token does not match this action or the project's current state. Then create a new plan and confirm with its confirmation_token and resource_etag before the token expires.",
40468
40493
  title: "Confirmation invalid",
40469
- restAction: "The confirmation token does not match this action or the project's current state. A deletion is also refused while a SQL export of the project is being captured, for up to about ten minutes ('ohmyhost export get'). Then create a new plan and confirm with its confirmation_token and resource_etag before the token expires."
40494
+ restAction: "The confirmation token does not match this action or the project's current state. Then create a new plan and confirm with its confirmation_token and resource_etag before the token expires."
40470
40495
  },
40471
40496
  etag_mismatch: {
40472
40497
  status: 409,
@@ -40697,6 +40722,18 @@ var PROBLEM_POLICY = {
40697
40722
  action: "Review DNS for the requested hostname and resolve the conflicting delegation or another project's managed records. Preserve mailbox MX, TXT and CAA records. Then repeat the original domain paid apply or delete with the same hostname and idempotency key; do not create another deployment or repeatedly resubmit unchanged conflicts.",
40698
40723
  title: "Domain DNS records conflict"
40699
40724
  },
40725
+ domain_already_configured: {
40726
+ status: 409,
40727
+ retryable: false,
40728
+ action: "This project already has one Paid domain connection, for another hostname or one a different member configured. Read it with 'ohmyhost domain paid status --project ULID --json'. Delete it with 'ohmyhost domain paid delete --project ULID --hostname CURRENT_HOST --yes --json' only to replace it, then repeat this request with a new idempotency key. Repeating it unchanged cannot work.",
40729
+ title: "Project already has a domain connection"
40730
+ },
40731
+ domain_deleting: {
40732
+ status: 409,
40733
+ retryable: false,
40734
+ action: "The Paid domain connection of this project is still being deleted. Wait until 'ohmyhost domain paid status --project ULID --json' shows it deleted, then repeat this request with a new idempotency key. Repeating it before the deletion finishes cannot work.",
40735
+ title: "Domain connection is being deleted"
40736
+ },
40700
40737
  data_change_blocked: {
40701
40738
  status: 409,
40702
40739
  retryable: true,
@@ -40755,6 +40792,36 @@ var PROBLEM_POLICY = {
40755
40792
  title: "Native Auth policy changes exhausted",
40756
40793
  action: "This project's Native Auth policy has reached its revision limit, so no further policy change is accepted. Do not retry. Contact support with the request_id of this response."
40757
40794
  },
40795
+ native_auth_revision_conflict: {
40796
+ status: 409,
40797
+ retryable: false,
40798
+ title: "Native Auth state changed",
40799
+ action: "The configuration or provider changed after your configurationRevision. Read it with 'ohmyhost auth config get --project ULID --environment ULID --json' or 'ohmyhost auth provider get --project ULID --environment ULID --provider google|github --json', then repeat the change with its current revision and a new idempotency key."
40800
+ },
40801
+ cutover_pending: {
40802
+ status: 409,
40803
+ retryable: true,
40804
+ title: "Database provider cutover is pending",
40805
+ action: "A database provider cutover of this project has not finished. Read the project with 'ohmyhost project status --project ULID --json', wait until it reports no pending cutover, then repeat the request with a new idempotency key."
40806
+ },
40807
+ project_operation_in_progress: {
40808
+ status: 409,
40809
+ retryable: true,
40810
+ title: "Project change is still running",
40811
+ action: "Another change to this project, such as a database write, a compute change or a data change, has not finished. Read the project with 'ohmyhost project status --project ULID --json', wait until it completes, then repeat the request with a new idempotency key. A deletion is also refused while a SQL export of the project is being captured, for up to about ten minutes ('ohmyhost export get')."
40812
+ },
40813
+ auto_deploy_source_unavailable: {
40814
+ status: 409,
40815
+ retryable: false,
40816
+ title: "No ready GitHub source for auto-deploy",
40817
+ action: "Auto-deploy follows a linked GitHub repository. If this workspace has no GitHub connection, run 'ohmyhost github connect --organization ULID --idempotency-key KEY --json' and complete its browser link; then link the repository with 'ohmyhost link --project ULID --repository-owner OWNER --repository-name REPOSITORY --idempotency-key KEY --json'. Then enable auto-deploy again with a new idempotency key. A platform-hosted source has no GitHub push to follow."
40818
+ },
40819
+ native_auth_provider_incomplete: {
40820
+ status: 409,
40821
+ retryable: false,
40822
+ title: "Native Auth provider is incomplete",
40823
+ action: "A sign-in provider can be enabled only with its client ID and client secret. Store them with 'ohmyhost auth provider set --project ULID --environment ULID --provider google|github --client-id ID --stdin --idempotency-key KEY --json' (the secret on stdin), then enable it with the current revision and a new idempotency key. Repeating unchanged does not help."
40824
+ },
40758
40825
  project_domains_conflict: {
40759
40826
  status: 409,
40760
40827
  retryable: false,
@@ -41364,6 +41431,36 @@ var parseEnvironmentSecretDeletion = (value) => {
41364
41431
  function validDelivery(input) {
41365
41432
  return Number.isSafeInteger(input["desired_generation"]) && Number(input["desired_generation"]) >= 0 && Number.isSafeInteger(input["applied_generation"]) && Number(input["applied_generation"]) >= 0 && Number(input["applied_generation"]) <= Number(input["desired_generation"]) && ["not_deployed", "pending", "ready", "failed"].includes(String(input["delivery_state"])) && (input["runtime_provider"] === null || input["runtime_provider"] === "wfp") && Number.isSafeInteger(input["applied_secret_count"]) && Number(input["applied_secret_count"]) >= 0 && Number(input["applied_secret_count"]) <= 100 && (input["last_error"] === null || typeof input["last_error"] === "string" && /^[A-Z][A-Z0-9_]{0,63}$/u.test(input["last_error"]));
41366
41433
  }
41434
+ var parseDeploymentPage = (value) => {
41435
+ const input = exactRecord2(value, ["items", "next_cursor"]);
41436
+ const items2 = input["items"];
41437
+ const cursor = input["next_cursor"];
41438
+ if (!Array.isArray(items2) || cursor !== void 0 && cursor !== null && (typeof cursor !== "string" || !/^[A-Za-z0-9_-]+$/u.test(cursor)))
41439
+ throw new ResponseContractError();
41440
+ return {
41441
+ items: items2.map((item) => parseDeploymentRecord(item)),
41442
+ next_cursor: typeof cursor === "string" ? cursor : null
41443
+ };
41444
+ };
41445
+ var DEPLOYMENT_RECORD_KEYS = [
41446
+ "id",
41447
+ "project_id",
41448
+ "operation_id",
41449
+ "commit_sha",
41450
+ "source_digest",
41451
+ "build_plan_digest",
41452
+ "artifact_digest",
41453
+ "status",
41454
+ "url",
41455
+ "created_at",
41456
+ "updated_at"
41457
+ ];
41458
+ var parseDeploymentRecord = (value) => {
41459
+ const record9 = exactRecord2(value, DEPLOYMENT_RECORD_KEYS);
41460
+ if (!isUlid(record9["id"]) || typeof record9["status"] !== "string")
41461
+ throw new ResponseContractError();
41462
+ return record9;
41463
+ };
41367
41464
  var parseDeploymentPlan = (value) => {
41368
41465
  const input = exactRecord2(value, [
41369
41466
  "id",
@@ -41487,6 +41584,15 @@ var parseSafeProblem = (value) => {
41487
41584
  ...retryAfter === void 0 ? {} : { retryAfterSeconds: retryAfter }
41488
41585
  };
41489
41586
  };
41587
+ var parseProjectCreateAccepted = (value) => {
41588
+ const fields = ["created_at", "id", "project_id", "state", "updated_at"];
41589
+ const input = exactRecord2(value, fields);
41590
+ const { project_id: projectId, ...operation } = input;
41591
+ if (Object.keys(input).length !== fields.length || operation["state"] !== "queued" || !isUlid(projectId)) {
41592
+ throw new ResponseContractError();
41593
+ }
41594
+ return { operation: parseOperation(operation), project_id: projectId };
41595
+ };
41490
41596
  var parseOperation = (value) => {
41491
41597
  const input = exactRecord2(value, [
41492
41598
  "blocking_operation_id",
@@ -43577,7 +43683,7 @@ function parseSourceCommand(values, wait) {
43577
43683
  const permitted = action === "status" ? ["--project"] : action === "versions" ? ["--project", "--limit", "--before"] : action === "diff" ? ["--project", "--from", "--to"] : action === "upload" ? ["--project", "--operation"] : action === "file" ? ["--project", "--commit", "--path"] : ["--project", "--commit"];
43578
43684
  if (Object.keys(options).some((key) => !permitted.includes(key)) || [commitSha, beforeCommitSha, fromCommitSha, toCommitSha].some((value) => value !== void 0 && !/^[a-f0-9]{40}$/u.test(value)) || action === "file" && !isManagedSourcePath(path2) || action === "diff" && (fromCommitSha === void 0 || toCommitSha === void 0) || action === "upload" && (operationId === void 0 || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(operationId)))
43579
43685
  throw new InvalidCommandError();
43580
- const limit = options["--limit"] === void 0 ? void 0 : Number(options["--limit"]);
43686
+ const limit = options["--limit"] === void 0 ? void 0 : decimalLimit(options["--limit"]);
43581
43687
  if (limit !== void 0 && (!Number.isSafeInteger(limit) || limit < 1 || limit > 100))
43582
43688
  throw new InvalidCommandError();
43583
43689
  return {
@@ -43808,6 +43914,10 @@ var recognizedCommandLabel = (argv) => {
43808
43914
  return values[1] === "plan" ? "deployment promote plan" : "deployment promote";
43809
43915
  if (value === "deployment" && values[0] === "logs")
43810
43916
  return "deployment logs";
43917
+ if (value === "deployment" && values[0] === "list")
43918
+ return "deployment list";
43919
+ if (value === "deployment" && values[0] === "get")
43920
+ return "deployment get";
43811
43921
  if (value === "delete")
43812
43922
  return values[0] === "plan" ? "delete plan" : "delete";
43813
43923
  if (value === "secret") {
@@ -44023,7 +44133,7 @@ var parseProductCliCommand = (argv) => {
44023
44133
  ...options["--client-id"] ? { clientId: options["--client-id"] } : {}
44024
44134
  };
44025
44135
  else if (actionKey === "users_list") {
44026
- const limit = options["--limit"] === void 0 ? void 0 : Number(options["--limit"]);
44136
+ const limit = options["--limit"] === void 0 ? void 0 : decimalLimit(options["--limit"]);
44027
44137
  if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 100))
44028
44138
  throw new InvalidCommandError();
44029
44139
  request = {
@@ -44129,7 +44239,7 @@ var parseProductCliCommand = (argv) => {
44129
44239
  throw new InvalidCommandError();
44130
44240
  if (sub === "create" && !yes) {
44131
44241
  const name = options["--name"], idempotencyKey = options["--idempotency-key"], outputPath = options["--out"];
44132
- if (!name || name.trim() !== name || name.length > 64 || new RegExp("\\p{Cc}", "u").test(name) || !idempotencyKey || !/^[A-Za-z0-9._:-]{1,128}$/u.test(idempotencyKey) || !outputPath)
44242
+ if (!name || name.trim() !== name || name.length > 64 || new RegExp("\\p{Cc}", "u").test(name) || !idempotencyKey || !IDEMPOTENCY_KEY.test(idempotencyKey) || !outputPath)
44133
44243
  throw new InvalidCommandError();
44134
44244
  return {
44135
44245
  kind: "token-create",
@@ -44341,7 +44451,7 @@ var parseProductCliCommand = (argv) => {
44341
44451
  throw new InvalidCommandError();
44342
44452
  const [whole, fraction = ""] = value.split(".");
44343
44453
  const amount = BigInt(whole ?? "0") * 1000000n + BigInt(fraction.padEnd(6, "0"));
44344
- if (amount > 9223372036854775807n)
44454
+ if (amount > 9007199254740991n)
44345
44455
  throw new InvalidCommandError();
44346
44456
  return {
44347
44457
  kind: "budget-set",
@@ -44713,7 +44823,7 @@ var parseProductCliCommand = (argv) => {
44713
44823
  if (yes || wait || follow || stdin)
44714
44824
  throw new InvalidCommandError();
44715
44825
  const options2 = parseOptionalOptions(values, ["--cursor", "--limit"]);
44716
- const limit = options2["--limit"] === void 0 ? 50 : Number(options2["--limit"]);
44826
+ const limit = options2["--limit"] === void 0 ? 50 : decimalLimit(options2["--limit"]);
44717
44827
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100) {
44718
44828
  throw new InvalidCommandError();
44719
44829
  }
@@ -45515,14 +45625,51 @@ var parseProductCliCommand = (argv) => {
45515
45625
  }
45516
45626
  if (first === "deployment" && values[0] === "logs") {
45517
45627
  values.shift();
45518
- if (!follow || yes || wait || stdin)
45628
+ if (follow || yes || wait || stdin)
45629
+ throw new InvalidCommandError();
45630
+ const options = parseOptionalOptions(values, ["--project", "--deployment", "--cursor"]);
45631
+ const projectId = options["--project"];
45632
+ const deploymentId = options["--deployment"];
45633
+ const cursor = options["--cursor"];
45634
+ if (projectId === void 0 || deploymentId === void 0 || !ORGANIZATION_ULID.test(projectId) || !ORGANIZATION_ULID.test(deploymentId) || cursor !== void 0 && !/^[A-Za-z0-9_-]+$/u.test(cursor))
45519
45635
  throw new InvalidCommandError();
45520
- const options = parseOptions(values, ["--project", "--deployment"]);
45521
45636
  return {
45522
45637
  kind: "deployment-logs",
45638
+ projectId,
45639
+ deploymentId,
45640
+ ...cursor === void 0 ? {} : { cursor },
45641
+ credentialStore
45642
+ };
45643
+ }
45644
+ if (first === "deployment" && values[0] === "list") {
45645
+ values.shift();
45646
+ if (yes || wait || follow || stdin)
45647
+ throw new InvalidCommandError();
45648
+ const options = parseOptionalOptions(values, ["--project", "--cursor", "--limit"]);
45649
+ const projectId = options["--project"];
45650
+ const cursor = options["--cursor"];
45651
+ const limit = options["--limit"] === void 0 ? void 0 : decimalLimit(options["--limit"]);
45652
+ if (projectId === void 0 || !ORGANIZATION_ULID.test(projectId) || cursor !== void 0 && !/^[A-Za-z0-9_-]+$/u.test(cursor) || limit !== void 0 && (!Number.isSafeInteger(limit) || limit < 1 || limit > 100))
45653
+ throw new InvalidCommandError();
45654
+ return {
45655
+ kind: "deployment-list",
45656
+ projectId,
45657
+ ...cursor === void 0 ? {} : { cursor },
45658
+ ...limit === void 0 ? {} : { limit },
45659
+ credentialStore
45660
+ };
45661
+ }
45662
+ if (first === "deployment" && values[0] === "get") {
45663
+ values.shift();
45664
+ if (yes || wait || follow || stdin)
45665
+ throw new InvalidCommandError();
45666
+ const options = parseOptions(values, ["--project", "--deployment"]);
45667
+ if (!ORGANIZATION_ULID.test(options["--project"]) || !ORGANIZATION_ULID.test(options["--deployment"]))
45668
+ throw new InvalidCommandError();
45669
+ return {
45670
+ kind: "deployment-get",
45523
45671
  projectId: options["--project"],
45524
45672
  deploymentId: options["--deployment"],
45525
- follow: true,
45526
45673
  credentialStore
45527
45674
  };
45528
45675
  }
@@ -45861,13 +46008,13 @@ var parseProductCliCommand = (argv) => {
45861
46008
  let request, label;
45862
46009
  if (area === "setup" || area === "domain" && sub === "set") {
45863
46010
  const sending = required("--sending"), receiving = required("--receiving");
45864
- if (!["true", "false"].includes(sending) || !["true", "false"].includes(receiving))
46011
+ if (sending !== "true" || !["true", "false"].includes(receiving))
45865
46012
  throw new InvalidCommandError();
45866
46013
  request = {
45867
46014
  ...scope,
45868
46015
  action: "configure",
45869
46016
  domain: required("--domain"),
45870
- sending: sending === "true",
46017
+ sending: true,
45871
46018
  receiving: receiving === "true",
45872
46019
  idempotencyKey: required("--idempotency-key")
45873
46020
  };
@@ -45945,7 +46092,7 @@ var parseOptions = (values, allowed) => {
45945
46092
  if (option === void 0 || !allowed.includes(option) || !isValue(value)) {
45946
46093
  throw new InvalidCommandError();
45947
46094
  }
45948
- if (option === "--idempotency-key" && value.length > 128)
46095
+ if (option === "--idempotency-key" && !IDEMPOTENCY_KEY.test(value))
45949
46096
  throw new InvalidCommandError();
45950
46097
  if (option in result)
45951
46098
  throw new InvalidCommandError();
@@ -45970,7 +46117,7 @@ var parseOptionalOptions = (values, allowed) => {
45970
46117
  if (option === void 0 || !allowed.includes(option) || !isValue(value)) {
45971
46118
  throw new InvalidCommandError();
45972
46119
  }
45973
- if (option === "--idempotency-key" && value.length > 128)
46120
+ if (option === "--idempotency-key" && !IDEMPOTENCY_KEY.test(value))
45974
46121
  throw new InvalidCommandError();
45975
46122
  if (option in result)
45976
46123
  throw new InvalidCommandError();
@@ -45991,6 +46138,8 @@ var accessTtlSeconds = (value) => {
45991
46138
  return seconds;
45992
46139
  };
45993
46140
  var ORGANIZATION_ULID = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
46141
+ var IDEMPOTENCY_KEY = /^[A-Za-z0-9._:-]{1,128}$/u;
46142
+ var decimalLimit = (value) => /^(?:0|[1-9][0-9]*)$/u.test(value) ? Number(value) : Number.NaN;
45994
46143
  var handedAccount = (userId, organizationId) => {
45995
46144
  if (userId === void 0 && organizationId === void 0)
45996
46145
  return void 0;
@@ -46475,22 +46624,9 @@ function assertDatabaseCompute(value) {
46475
46624
  const db = value["database"];
46476
46625
  if (db === null)
46477
46626
  return;
46478
- if (record5(db) && db["provider"] === "pgcf") {
46479
- assertPgcfCompute(db);
46480
- return;
46481
- }
46482
- if (!record5(db) || !exact4(db, [
46483
- "disabled",
46484
- "max_cu",
46485
- "max_memory_gb",
46486
- "min_cu",
46487
- "min_memory_gb",
46488
- "pending_state",
46489
- "region",
46490
- "state",
46491
- "suspend_timeout_seconds"
46492
- ]) || typeof db["min_cu"] !== "number" || typeof db["max_cu"] !== "number" || !Number.isFinite(db["min_cu"]) || !Number.isFinite(db["max_cu"]) || db["min_cu"] < 0.25 || db["max_cu"] < db["min_cu"] || db["max_cu"] > Number.MAX_SAFE_INTEGER / 4096 || db["min_memory_gb"] !== db["min_cu"] * 4 || db["max_memory_gb"] !== db["max_cu"] * 4 || !Number.isSafeInteger(db["suspend_timeout_seconds"]) || Number(db["suspend_timeout_seconds"]) < -1 || Number(db["suspend_timeout_seconds"]) > 604800 || !["init", "active", "idle"].includes(String(db["state"])) || db["pending_state"] !== null && !["init", "active", "idle"].includes(String(db["pending_state"])) || typeof db["disabled"] !== "boolean" || typeof db["region"] !== "string" || !/^aws-[a-z0-9]+(?:-[a-z0-9]+)*-[0-9]+$/u.test(db["region"]))
46627
+ if (!record5(db) || db["provider"] !== "pgcf")
46493
46628
  throw new TypeError("Invalid database compute configuration");
46629
+ assertPgcfCompute(db);
46494
46630
  }
46495
46631
  function assertPgcfCompute(db) {
46496
46632
  const size = databaseSizeForClass(db["size_class_id"]);
@@ -46520,7 +46656,7 @@ function exact4(v, keys) {
46520
46656
  // apps/product-cli/package.json
46521
46657
  var package_default = {
46522
46658
  name: "@ohmyhost/product-cli",
46523
- version: "0.1.65",
46659
+ version: "0.1.67",
46524
46660
  private: true,
46525
46661
  ohmyhost: {
46526
46662
  deployment: "production",
@@ -46944,7 +47080,9 @@ var HELP_USAGE = Object.freeze({
46944
47080
  plan: "ohmyhost plan --project ULID --commit SHA [--environment dev|prod] --json",
46945
47081
  deploy: "ohmyhost deploy --project ULID (--plan-id ULID | --commit SHA [--environment dev|prod]) --idempotency-key KEY --yes [--wait] --json",
46946
47082
  logs: "ohmyhost logs OPERATION_ULID --follow --json",
46947
- "deployment logs": "ohmyhost deployment logs --project ULID --deployment ULID --follow --json",
47083
+ "deployment list": "ohmyhost deployment list --project ULID [--cursor CURSOR] [--limit 1-100] --json (newest first; a returned deployment ULID is a rollback target)",
47084
+ "deployment get": "ohmyhost deployment get --project ULID --deployment ULID --json",
47085
+ "deployment logs": "ohmyhost deployment logs --project ULID --deployment ULID [--cursor CURSOR] --json (one page of diagnostics, newest first; a next_cursor in the answer reads the older page)",
46948
47086
  "rollback plan": "ohmyhost rollback plan --project ULID --deployment DEPLOYMENT_ULID --json",
46949
47087
  rollback: "ohmyhost rollback --project ULID --deployment DEPLOYMENT_ULID --if-match ETAG --confirmation-token TOKEN --idempotency-key KEY --yes --json",
46950
47088
  "deployment promote plan": "ohmyhost deployment promote plan --project ULID --deployment DEV_DEPLOYMENT_ULID --json",
@@ -46991,7 +47129,17 @@ var helpEntries = (topic) => {
46991
47129
  if (topic === void 0)
46992
47130
  return HELP_COMMANDS;
46993
47131
  const exact7 = HELP_COMMANDS.filter((entry) => entry.command === topic);
46994
- return exact7.length > 0 ? exact7 : HELP_COMMANDS.filter((entry) => entry.command.startsWith(`${topic} `));
47132
+ if (exact7.length > 0)
47133
+ return exact7;
47134
+ const under = HELP_COMMANDS.filter((entry) => entry.command.startsWith(`${topic} `));
47135
+ if (under.length > 0)
47136
+ return under;
47137
+ const words = topic.split(" ");
47138
+ const group = HELP_COMMANDS.filter((entry) => {
47139
+ const entryWords = entry.command.split(" ");
47140
+ return entryWords.length <= words.length && entryWords.every((word, index) => word === words[index]);
47141
+ }).sort((left, right) => right.command.split(" ").length - left.command.split(" ").length);
47142
+ return group.slice(0, 1);
46995
47143
  };
46996
47144
  var helpTopicKnown = (topic) => helpEntries(topic).length > 0;
46997
47145
  var cliMetadataResult = (kind, topic) => kind === "help" ? success("help", {
@@ -47011,6 +47159,8 @@ var invalidCommandAction = (argv, commandPrefix) => {
47011
47159
  return action === "set" ? "Choose a customer secret name of at most 128 uppercase letters, digits and underscores, starting with a letter. OHMYHOST_* and DATABASE_URL, HYPERDRIVE, BETTER_AUTH_SECRET, BETTER_AUTH_URL, ASSETS, FILES, IMAGES and STORAGE are reserved for the platform. Rename the application's own variable and its source references; platform bindings are installed automatically. Nothing was sent; changing only the idempotency key will not help." : "Choose an existing customer secret name of at most 128 uppercase letters, digits and underscores, starting with a letter. The installed platform keys OHMYHOST_STORAGE_KEY, OHMYHOST_MAIL_KEY, OHMYHOST_AI_KEY and BETTER_AUTH_SECRET cannot be deleted. Older reserved-name collisions can be removed with secret delete; deployed platform keys stay managed by ohmyho.st. Nothing was sent; changing only the idempotency key will not help.";
47012
47160
  }
47013
47161
  const usage = Object.hasOwn(HELP_USAGE, label) ? HELP_USAGE[label].split("\n")[0] : void 0;
47162
+ if (label === "help")
47163
+ return "Unknown help topic; nothing was sent. 'ohmyhost --help --json' lists every command with its flags.";
47014
47164
  if (usage === void 0)
47015
47165
  return "Unknown command; nothing was sent. 'ohmyhost --help --json' lists every command with its flags. If a documented command is missing, this CLI is older than https://ohmyho.st/client-release.json: install the published version.";
47016
47166
  const linkable = /(?:^|\s)--project ULID/u.test(usage) && !argv.includes("--project");
@@ -47530,6 +47680,10 @@ var ProductCli = class {
47530
47680
  return await this.logs(command, signal);
47531
47681
  if (command.kind === "deployment-logs")
47532
47682
  return await this.deploymentLogs(command, signal);
47683
+ if (command.kind === "deployment-list")
47684
+ return await this.listDeployments(command, signal);
47685
+ if (command.kind === "deployment-get")
47686
+ return await this.getDeployment(command, signal);
47533
47687
  if (command.kind === "rollback-plan")
47534
47688
  return await this.planRollback(command, signal);
47535
47689
  if (command.kind === "rollback")
@@ -47949,7 +48103,7 @@ var ProductCli = class {
47949
48103
  }
47950
48104
  async createProject(command, signal) {
47951
48105
  const api = await this.authenticatedApi(command.credentialStore, signal);
47952
- const operation = parseOperation(await api.createProject({
48106
+ const accepted = parseProjectCreateAccepted(await api.createProject({
47953
48107
  organizationId: command.organizationId,
47954
48108
  name: command.name,
47955
48109
  ...command.dataMode === void 0 ? {} : { dataMode: command.dataMode },
@@ -47958,7 +48112,12 @@ var ProductCli = class {
47958
48112
  ...command.region === void 0 ? {} : { region: command.region },
47959
48113
  idempotencyKey: command.idempotencyKey
47960
48114
  }));
47961
- return success("project create", { status: "accepted", operation });
48115
+ return success("project create", {
48116
+ status: "accepted",
48117
+ project_id: accepted.project_id,
48118
+ operation: accepted.operation,
48119
+ next_action: `Run '${this.dependencies.commandPrefix} operation get ${accepted.operation.id} --json' until it succeeds; the new project is ${accepted.project_id}. A retry with the same idempotency key returns the same project_id.`
48120
+ });
47962
48121
  }
47963
48122
  async listProjects(command, signal) {
47964
48123
  const api = await this.authenticatedApi(command.credentialStore, signal);
@@ -48297,6 +48456,9 @@ var ProductCli = class {
48297
48456
  const { connection_uri, psql_command, ...access } = credential;
48298
48457
  void connection_uri;
48299
48458
  void psql_command;
48459
+ const cleanupSignal = new AbortController().signal;
48460
+ const cleanup = this.dependencies.productApi(() => this.authenticatedToken(command.credentialStore, cleanupSignal), cleanupSignal);
48461
+ const revokeAction = `The temporary credential could not be revoked. Run '${this.dependencies.commandPrefix} database access revoke --project ${command.projectId} --access ${credential.access_id} --yes --json' now; it expires on its own at ${credential.expires_at}.`;
48300
48462
  let exitCode;
48301
48463
  try {
48302
48464
  exitCode = await spawnPsql({
@@ -48309,14 +48471,17 @@ var ProductCli = class {
48309
48471
  signal
48310
48472
  });
48311
48473
  } catch (error) {
48312
- await this.revokeIssuedAccess(api, command.projectId, credential.access_id);
48474
+ const revoked2 = await this.revokeIssuedAccess(cleanup, command.projectId, credential.access_id);
48313
48475
  if (error instanceof PsqlUnavailableError)
48314
48476
  return psqlUnavailable();
48477
+ if (!revoked2 && (signal.aborted || isCancellation(error)))
48478
+ return failure("database psql", 130, "command_cancelled", true, revokeAction);
48315
48479
  throw error;
48316
48480
  }
48317
- await this.revokeIssuedAccess(api, command.projectId, credential.access_id);
48481
+ const revoked = await this.revokeIssuedAccess(cleanup, command.projectId, credential.access_id);
48482
+ const notRevoked = revoked ? {} : { next_action: revokeAction };
48318
48483
  if (exitCode === 0)
48319
- return success("database psql", { status: "succeeded", access, exit_code: 0 });
48484
+ return success("database psql", { status: "succeeded", access, exit_code: 0, ...notRevoked });
48320
48485
  return {
48321
48486
  exitCode,
48322
48487
  stdout: `${JSON.stringify({
@@ -48326,7 +48491,7 @@ var ProductCli = class {
48326
48491
  error: {
48327
48492
  code: "psql_failed",
48328
48493
  retryable: false,
48329
- suggested_action: "Read the psql output above. The temporary credential was revoked; request a new one with 'ohmyhost database access create'."
48494
+ suggested_action: revoked ? "Read the psql output above. The temporary credential was revoked; request a new one with 'ohmyhost database access create'." : revokeAction
48330
48495
  }
48331
48496
  })}
48332
48497
  `,
@@ -48336,7 +48501,9 @@ var ProductCli = class {
48336
48501
  async revokeIssuedAccess(api, projectId, accessId) {
48337
48502
  try {
48338
48503
  await api.revokeProjectDatabaseAccess({ projectId, accessId });
48504
+ return true;
48339
48505
  } catch {
48506
+ return false;
48340
48507
  }
48341
48508
  }
48342
48509
  async planPaidDomain(command, signal) {
@@ -48612,7 +48779,9 @@ var ProductCli = class {
48612
48779
  status: command.wait ? "completed" : "accepted",
48613
48780
  operation,
48614
48781
  ...plan === null ? {} : { plan },
48615
- ...notes.length > 0 && plan?.["environment"] !== "prod" ? { notes } : {}
48782
+ // The note is conditional ("if this is a Dev deployment"), so a --plan-id deploy, whose environment the CLI
48783
+ // cannot read, gets it too. A plan known to target Prod gets none.
48784
+ ...notes.length > 0 && (plan === null || plan["environment"] === "dev") ? { notes } : {}
48616
48785
  });
48617
48786
  }
48618
48787
  async logs(command, signal) {
@@ -48640,17 +48809,36 @@ var ProductCli = class {
48640
48809
  }
48641
48810
  throw new ProductCliFailure(8, "operation_stream_ended", true, `The event stream ended before operation ${command.operationId} finished, and it is still running; nothing was cancelled. Poll 'ohmyhost operation get ${command.operationId} --json' about every 60 seconds until it is succeeded, failed or cancelled.`, operation);
48642
48811
  }
48812
+ async listDeployments(command, signal) {
48813
+ const api = await this.authenticatedApi(command.credentialStore, signal);
48814
+ const page = parseDeploymentPage(await api.listDeployments({
48815
+ projectId: command.projectId,
48816
+ ...command.cursor === void 0 ? {} : { cursor: command.cursor },
48817
+ ...command.limit === void 0 ? {} : { limit: command.limit }
48818
+ }));
48819
+ return success("deployment list", { items: page.items, next_cursor: page.next_cursor });
48820
+ }
48821
+ async getDeployment(command, signal) {
48822
+ const api = await this.authenticatedApi(command.credentialStore, signal);
48823
+ const deployment = parseDeploymentRecord(await api.getDeployment({ projectId: command.projectId, deploymentId: command.deploymentId }));
48824
+ return success("deployment get", { deployment });
48825
+ }
48643
48826
  async deploymentLogs(command, signal) {
48644
48827
  const api = await this.authenticatedApi(command.credentialStore, signal);
48645
48828
  const page = await api.getDeploymentLogs({
48646
48829
  projectId: command.projectId,
48647
48830
  deploymentId: command.deploymentId,
48648
- limit: 100
48831
+ limit: 100,
48832
+ ...command.cursor === void 0 ? {} : { cursor: command.cursor }
48649
48833
  });
48650
48834
  for (const item of page.items)
48651
48835
  this.dependencies.operationEventSink?.write(`${JSON.stringify(item)}
48652
48836
  `);
48653
- return success("deployment logs", { status: "completed", event_count: page.items.length });
48837
+ return success("deployment logs", {
48838
+ status: "completed",
48839
+ event_count: page.items.length,
48840
+ ...page.next_cursor === void 0 ? {} : { next_cursor: page.next_cursor }
48841
+ });
48654
48842
  }
48655
48843
  async planRollback(command, signal) {
48656
48844
  const api = await this.authenticatedApi(command.credentialStore, signal);
@@ -48919,6 +49107,8 @@ var classifyFailure = (command, error, signal, actingAs, keyed = true) => {
48919
49107
  if (error instanceof PublicResponseTooLargeError) {
48920
49108
  return failure(command, 7, "response_too_large", false, "Retry only after the remote response is repaired.");
48921
49109
  }
49110
+ if (isLocalFileError(error))
49111
+ return failure(command, 2, "local_state_unavailable", false, `The local CLI state could not be read or written (${error.code}). Check the permissions and free space of the local directories named in the error, then retry. A remote change that already succeeded is not undone.`);
48922
49112
  if (looksLikeProblem(error)) {
48923
49113
  try {
48924
49114
  const problem = parseSafeProblem(error);
@@ -49299,6 +49489,10 @@ var parsedCommandName = (command) => {
49299
49489
  return "deployment promote plan";
49300
49490
  if (command.kind === "deployment-logs")
49301
49491
  return "deployment logs";
49492
+ if (command.kind === "deployment-list")
49493
+ return "deployment list";
49494
+ if (command.kind === "deployment-get")
49495
+ return "deployment get";
49302
49496
  if (command.kind === "promote")
49303
49497
  return "deployment promote";
49304
49498
  if (command.kind === "delete-plan")
@@ -49349,6 +49543,21 @@ var throwIfAborted = (signal) => {
49349
49543
  var isCancellation = (error) => error instanceof DOMException && error.name === "AbortError";
49350
49544
  var isTimeout2 = (error) => error instanceof DOMException && error.name === "TimeoutError";
49351
49545
  var looksLikeProblem = (error) => typeof error === "object" && error !== null && ("code" in error || "status" in error || "suggested_action" in error);
49546
+ var LOCAL_FILE_ERROR_CODES = /* @__PURE__ */ new Set([
49547
+ "EACCES",
49548
+ "EPERM",
49549
+ "ENOSPC",
49550
+ "EROFS",
49551
+ "EDQUOT",
49552
+ "EMFILE",
49553
+ "ENFILE",
49554
+ "EEXIST",
49555
+ "EISDIR",
49556
+ "ENOTDIR",
49557
+ "EBUSY",
49558
+ "ENAMETOOLONG"
49559
+ ]);
49560
+ var isLocalFileError = (error) => error instanceof Error && "code" in error && typeof error.code === "string" && (LOCAL_FILE_ERROR_CODES.has(error.code) || error.code === "ENOENT" && "path" in error && typeof error.path === "string");
49352
49561
  var looksLikeRemoteObject = (error) => typeof error === "object" && error !== null && !(error instanceof Error);
49353
49562
  var diagnosticDescriptor = (error, signal) => {
49354
49563
  if (signal.aborted || isCancellation(error)) {
@@ -49405,6 +49614,8 @@ var diagnosticDescriptor = (error, signal) => {
49405
49614
  };
49406
49615
  }
49407
49616
  }
49617
+ if (isLocalFileError(error))
49618
+ return { category: "configuration", subsystem: "runtime", errorKind: "unavailable" };
49408
49619
  if (looksLikeProblem(error)) {
49409
49620
  try {
49410
49621
  parseSafeProblem(error);
@@ -51200,7 +51411,14 @@ var getOrganizationReferral = (parameters, options) => {
51200
51411
  });
51201
51412
  };
51202
51413
  var getOrganizationAccount = (parameters, options) => {
51203
- const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "organization_id" }] }]);
51414
+ const params = buildClientParams([parameters], [
51415
+ {
51416
+ args: [
51417
+ { in: "headers", key: "X-Request-Id" },
51418
+ { in: "path", key: "organization_id" }
51419
+ ]
51420
+ }
51421
+ ]);
51204
51422
  return (options?.client ?? client).get({
51205
51423
  responseStyle: "data",
51206
51424
  security: [{ scheme: "bearer", type: "http" }],
@@ -52459,6 +52677,25 @@ var planDeployment = (parameters, options) => {
52459
52677
  }
52460
52678
  });
52461
52679
  };
52680
+ var listDeployments = (parameters, options) => {
52681
+ const params = buildClientParams([parameters], [
52682
+ {
52683
+ args: [
52684
+ { in: "headers", key: "X-Request-Id" },
52685
+ { in: "path", key: "project_id" },
52686
+ { in: "query", key: "cursor" },
52687
+ { in: "query", key: "limit" }
52688
+ ]
52689
+ }
52690
+ ]);
52691
+ return (options?.client ?? client).get({
52692
+ responseStyle: "data",
52693
+ security: [{ scheme: "bearer", type: "http" }],
52694
+ url: "/v1/projects/{project_id}/deployments",
52695
+ ...options,
52696
+ ...params
52697
+ });
52698
+ };
52462
52699
  var createDeployment = (parameters, options) => {
52463
52700
  const params = buildClientParams([parameters], [
52464
52701
  {
@@ -53758,6 +53995,8 @@ function requestManagedMail(client2, input) {
53758
53995
  const scope = { project_id: input.projectId, environment_id: input.environmentId };
53759
53996
  switch (input.action) {
53760
53997
  case "configure":
53998
+ if (input.sending !== true)
53999
+ throw new TypeError("A managed mail domain must send: sending must be true.");
53761
54000
  return configureManagedMailDomain({
53762
54001
  ...scope,
53763
54002
  "Idempotency-Key": input.idempotencyKey,
@@ -54436,9 +54675,6 @@ var ohmyhost_schema_default = {
54436
54675
  functions: {
54437
54676
  $ref: "#/$defs/functions"
54438
54677
  },
54439
- credits: {
54440
- $ref: "#/$defs/credits"
54441
- },
54442
54678
  browser: {
54443
54679
  $ref: "#/$defs/browserRendering"
54444
54680
  }
@@ -54517,7 +54753,7 @@ var ohmyhost_schema_default = {
54517
54753
  properties: {
54518
54754
  allow: {
54519
54755
  type: "array",
54520
- maxItems: 13,
54756
+ maxItems: 11,
54521
54757
  uniqueItems: true,
54522
54758
  items: {
54523
54759
  type: "string",
@@ -54716,74 +54952,6 @@ var ohmyhost_schema_default = {
54716
54952
  }
54717
54953
  }
54718
54954
  },
54719
- credits: {
54720
- type: "object",
54721
- additionalProperties: false,
54722
- required: ["monthly_budget"],
54723
- properties: {
54724
- monthly_budget: {
54725
- type: "integer",
54726
- minimum: 0,
54727
- maximum: 1e9
54728
- },
54729
- auto_recharge: {
54730
- $ref: "#/$defs/autoRecharge"
54731
- }
54732
- }
54733
- },
54734
- autoRecharge: {
54735
- type: "object",
54736
- additionalProperties: false,
54737
- required: ["enabled"],
54738
- properties: {
54739
- enabled: {
54740
- type: "boolean"
54741
- },
54742
- threshold: {
54743
- type: "integer",
54744
- minimum: 0,
54745
- maximum: 1e6
54746
- },
54747
- amount_usd_micros: {
54748
- type: "integer",
54749
- minimum: 1,
54750
- maximum: 9007199254740991
54751
- },
54752
- monthly_cap_usd_micros: {
54753
- type: "integer",
54754
- minimum: 1,
54755
- maximum: 9007199254740991
54756
- }
54757
- },
54758
- if: {
54759
- properties: {
54760
- enabled: {
54761
- const: true
54762
- }
54763
- },
54764
- required: ["enabled"]
54765
- },
54766
- then: {
54767
- properties: {
54768
- threshold: {
54769
- type: "integer",
54770
- minimum: 0,
54771
- maximum: 1e6
54772
- },
54773
- amount_usd_micros: {
54774
- type: "integer",
54775
- minimum: 1,
54776
- maximum: 9007199254740991
54777
- },
54778
- monthly_cap_usd_micros: {
54779
- type: "integer",
54780
- minimum: 1,
54781
- maximum: 9007199254740991
54782
- }
54783
- },
54784
- required: ["threshold", "amount_usd_micros", "monthly_cap_usd_micros"]
54785
- }
54786
- },
54787
54955
  browserRendering: {
54788
54956
  type: "object",
54789
54957
  additionalProperties: false,
@@ -55031,7 +55199,8 @@ function browserOrigin(value, allowWebSocket) {
55031
55199
  return false;
55032
55200
  try {
55033
55201
  const url = new URL(value);
55034
- return (url.protocol === "https:" || allowWebSocket && url.protocol === "wss:") && url.origin === value && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname.includes(".") && !url.hostname.endsWith(".local") && !url.hostname.endsWith(".internal") && !/^\d+(?:\.\d+){3}$/u.test(url.hostname) && url.hostname.split(".").every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(label));
55202
+ return (url.protocol === "https:" || allowWebSocket && url.protocol === "wss:") && url.origin === value && // Port 0 serializes unchanged, but the 0336 browser-policy triggers require a first digit of 1 to 9.
55203
+ (url.port === "" || /^[1-9][0-9]{0,4}$/u.test(url.port)) && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname.includes(".") && !url.hostname.endsWith(".local") && !url.hostname.endsWith(".internal") && !/^\d+(?:\.\d+){3}$/u.test(url.hostname) && url.hostname.split(".").every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(label));
55035
55204
  } catch {
55036
55205
  return false;
55037
55206
  }
@@ -55040,6 +55209,30 @@ function invalidPolicy() {
55040
55209
  return new TypeError("Invalid browser capability policy");
55041
55210
  }
55042
55211
 
55212
+ // packages/contracts/dist/egress-origin.js
55213
+ var DNS_LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u;
55214
+ var LOCAL_NAME = /(?:^|\.)(?:local|localhost|localdomain|internal|lan|home\.arpa|corp)$/u;
55215
+ var IPV4_LITERAL = /^\d{1,3}(?:\.\d{1,3}){3}$/u;
55216
+ var PLATFORM_GATEWAY_NAME = /(?:^|\.)ohmyho-(?:mail|storage)-gateway-[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*\.workers\.dev$/u;
55217
+ function isDnsEgressOrigin(value) {
55218
+ if (typeof value !== "string")
55219
+ return false;
55220
+ let url;
55221
+ try {
55222
+ url = new URL(value);
55223
+ } catch {
55224
+ return false;
55225
+ }
55226
+ const { hostname } = url;
55227
+ return url.protocol === "https:" && url.origin === value && url.port === "" && hostname.length <= 253 && hostname.includes(".") && hostname.split(".").every((label) => DNS_LABEL.test(label)) && !LOCAL_NAME.test(hostname) && !IPV4_LITERAL.test(hostname);
55228
+ }
55229
+ function isCustomerEgressOrigin(value) {
55230
+ if (!isDnsEgressOrigin(value))
55231
+ return false;
55232
+ const { hostname } = new URL(value);
55233
+ return !PLATFORM_GATEWAY_NAME.test(hostname) && hostname !== "connect.ohmyho.st" && !hostname.endsWith(".connect.ohmyho.st");
55234
+ }
55235
+
55043
55236
  // packages/contracts/dist/preview-view.js
55044
55237
  function parsePreviewView(value, scope) {
55045
55238
  if (!value || typeof value !== "object" || Array.isArray(value))
@@ -55112,21 +55305,6 @@ function parseOhmyhostConfig(value) {
55112
55305
  ...input.browser === void 0 ? {} : { browser: Object.freeze({ enabled: input.browser.enabled }) },
55113
55306
  ...input.functions === void 0 ? {} : {
55114
55307
  functions: Object.freeze({ crons: normalizeCrons(input.functions.crons) })
55115
- },
55116
- ...input.credits === void 0 ? {} : {
55117
- credits: Object.freeze({
55118
- monthly_budget: input.credits.monthly_budget,
55119
- ...input.credits.auto_recharge === void 0 ? {} : {
55120
- auto_recharge: Object.freeze({
55121
- enabled: input.credits.auto_recharge.enabled,
55122
- ...input.credits.auto_recharge.threshold === void 0 ? {} : { threshold: input.credits.auto_recharge.threshold },
55123
- ...input.credits.auto_recharge.amount_usd_micros === void 0 ? {} : { amount_usd_micros: input.credits.auto_recharge.amount_usd_micros },
55124
- ...input.credits.auto_recharge.monthly_cap_usd_micros === void 0 ? {} : {
55125
- monthly_cap_usd_micros: input.credits.auto_recharge.monthly_cap_usd_micros
55126
- }
55127
- })
55128
- }
55129
- })
55130
55308
  }
55131
55309
  };
55132
55310
  return Object.freeze(config);
@@ -55141,23 +55319,13 @@ function normalizeHealthcheck(value) {
55141
55319
  function normalizeEgressOrigins(value) {
55142
55320
  const origins = [...value ?? []];
55143
55321
  for (const origin of origins) {
55144
- let parsed;
55145
- try {
55146
- parsed = new URL(origin);
55147
- } catch {
55148
- throw new TypeError("ohmyhost.yaml runtime egress origin is invalid");
55149
- }
55150
- if (parsed.protocol !== "https:" || parsed.port !== "" || parsed.username !== "" || parsed.password !== "" || parsed.origin !== origin || parsed.pathname !== "/" || parsed.search !== "" || parsed.hash !== "" || forbiddenEgressHostname(parsed.hostname)) {
55322
+ if (!isCustomerEgressOrigin(origin)) {
55151
55323
  throw new TypeError("ohmyhost.yaml runtime egress origin is invalid");
55152
55324
  }
55153
55325
  }
55154
55326
  origins.sort();
55155
55327
  return Object.freeze(origins);
55156
55328
  }
55157
- function forbiddenEgressHostname(hostname) {
55158
- const normalized = hostname.toLowerCase();
55159
- return /(?:^|\.)ohmyho-(?:mail|storage)-gateway-[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*\.workers\.dev\.?$/u.test(normalized) || normalized.replace(/\.+$/u, "") === "connect.ohmyho.st" || normalized.replace(/\.+$/u, "").endsWith(".connect.ohmyho.st") || normalized === "localhost" || normalized.endsWith(".localhost") || normalized.endsWith(".local") || normalized.endsWith(".internal") || /^\d{1,3}(?:\.\d{1,3}){3}$/u.test(normalized) || normalized.startsWith("[") || normalized.endsWith("]");
55160
- }
55161
55329
  function parseOhmyhostConfigYaml(source) {
55162
55330
  if (typeof source !== "string") {
55163
55331
  throw new TypeError("ohmyhost.yaml must be a string");
@@ -55889,6 +56057,13 @@ var GeneratedSdkProductApi = class {
55889
56057
  }
55890
56058
  })).stream;
55891
56059
  }
56060
+ async listDeployments(input) {
56061
+ return listDeployments({
56062
+ project_id: input.projectId,
56063
+ ...input.cursor === void 0 ? {} : { cursor: input.cursor },
56064
+ ...input.limit === void 0 ? {} : { limit: input.limit }
56065
+ }, { client: this.#client });
56066
+ }
55892
56067
  async getDeploymentLogs(input) {
55893
56068
  return getDeploymentLogs({
55894
56069
  project_id: input.projectId,
@@ -56272,17 +56447,69 @@ function workerModuleFindings(worker) {
56272
56447
  findings.push(diagnostic({ code: "scheduled_handler_required", path: path2 }));
56273
56448
  return Object.freeze(findings);
56274
56449
  }
56450
+ var REGEX_LITERAL_KEYWORDS = /* @__PURE__ */ new Set([
56451
+ "await",
56452
+ "case",
56453
+ "do",
56454
+ "else",
56455
+ "return",
56456
+ "throw",
56457
+ "typeof",
56458
+ "void",
56459
+ "yield"
56460
+ ]);
56461
+ function startsRegexLiteral(source, lastCode) {
56462
+ if (lastCode === -1)
56463
+ return true;
56464
+ if (/[(,=:[!&|?{};+\-*%~^]/u.test(source.charAt(lastCode)))
56465
+ return true;
56466
+ let start = lastCode + 1;
56467
+ while (start > 0 && /[\p{L}\p{N}_$]/u.test(source.charAt(start - 1)))
56468
+ start -= 1;
56469
+ return REGEX_LITERAL_KEYWORDS.has(source.slice(start, lastCode + 1));
56470
+ }
56471
+ function regexLiteralEnd(source, start, unclosed) {
56472
+ let inClass = false;
56473
+ for (let index = start + 1; index < source.length; index += 1) {
56474
+ const state = index * 2 + (inClass ? 1 : 0);
56475
+ if (unclosed[state] === 1)
56476
+ return -1;
56477
+ unclosed[state] = 1;
56478
+ const character = source[index];
56479
+ if (character === "\n" || character === "\r")
56480
+ return -1;
56481
+ if (character === "\\") {
56482
+ index += 1;
56483
+ if (source[index] === "\n" || source[index] === "\r")
56484
+ return -1;
56485
+ } else if (inClass) {
56486
+ if (character === "]")
56487
+ inClass = false;
56488
+ } else if (character === "[") {
56489
+ inClass = true;
56490
+ } else if (character === "/") {
56491
+ return index;
56492
+ }
56493
+ }
56494
+ return -1;
56495
+ }
56275
56496
  function sourceWithoutComments(source) {
56276
56497
  let result = "";
56277
56498
  let quote = null;
56499
+ let lastCode = -1;
56500
+ let unclosed = null;
56278
56501
  for (let index = 0; index < source.length; index += 1) {
56279
56502
  const character = source[index];
56280
56503
  const next = source[index + 1];
56281
56504
  if (quote !== null) {
56282
56505
  result += character;
56506
+ if (!/\s/u.test(character))
56507
+ lastCode = index;
56283
56508
  if (character === "\\") {
56284
56509
  index += 1;
56285
56510
  result += source[index] ?? "";
56511
+ if (index < source.length && !/\s/u.test(source[index]))
56512
+ lastCode = index;
56286
56513
  } else if (character === quote || character === "\n" && quote !== "`")
56287
56514
  quote = null;
56288
56515
  continue;
@@ -56290,6 +56517,7 @@ function sourceWithoutComments(source) {
56290
56517
  if (character === "'" || character === '"' || character === "`") {
56291
56518
  quote = character;
56292
56519
  result += character;
56520
+ lastCode = index;
56293
56521
  continue;
56294
56522
  }
56295
56523
  if (character === "/" && next === "/" && source[index - 1] !== "\\") {
@@ -56300,6 +56528,16 @@ function sourceWithoutComments(source) {
56300
56528
  result += "\n";
56301
56529
  continue;
56302
56530
  }
56531
+ if (character === "/" && next !== "/" && next !== "*" && startsRegexLiteral(source, lastCode)) {
56532
+ unclosed ??= new Uint8Array(source.length * 2);
56533
+ const end = regexLiteralEnd(source, index, unclosed);
56534
+ if (end !== -1) {
56535
+ result += source.slice(index, end + 1);
56536
+ lastCode = end;
56537
+ index = end;
56538
+ continue;
56539
+ }
56540
+ }
56303
56541
  if (character === "/" && next === "*" && source[index - 1] !== "\\") {
56304
56542
  result += " ";
56305
56543
  index += 2;
@@ -56312,6 +56550,8 @@ function sourceWithoutComments(source) {
56312
56550
  continue;
56313
56551
  }
56314
56552
  result += character;
56553
+ if (!/\s/u.test(character))
56554
+ lastCode = index;
56315
56555
  }
56316
56556
  return result;
56317
56557
  }
@@ -56725,13 +56965,48 @@ function hasNamedImport(tokens, name, moduleName) {
56725
56965
  function hasModuleImport(tokens, moduleName) {
56726
56966
  return tokens.some((token, index) => token.value === "from" && tokens[index + 1]?.kind === "string" && tokens[index + 1]?.value === moduleName);
56727
56967
  }
56968
+ function openBraceDepths(tokens) {
56969
+ let depth = 0;
56970
+ return tokens.map((token) => {
56971
+ const current = depth;
56972
+ if (token.value === "{")
56973
+ depth += 1;
56974
+ else if (token.value === "}")
56975
+ depth -= 1;
56976
+ return current;
56977
+ });
56978
+ }
56979
+ var BUILD_OUTPUT_OPTIONS = ["assetsPrefix", "client", "serverEntry", "server"];
56980
+ function hasBuildOutputOption(tokens) {
56981
+ const closing = closingBraces(tokens);
56982
+ const depths = openBraceDepths(tokens);
56983
+ return tokens.some((token, index) => {
56984
+ if (token.value !== "build" || depths[index] !== 1 || tokens[index - 1]?.value === ":")
56985
+ return false;
56986
+ if (tokens[index + 1]?.value !== ":" || tokens[index + 2]?.value !== "{")
56987
+ return true;
56988
+ const start = index + 2;
56989
+ const end = closing[start] ?? -1;
56990
+ if (end === -1)
56991
+ return true;
56992
+ return BUILD_OUTPUT_OPTIONS.some((name) => directProperty(tokens, closing, start, end, name) !== null) || hasDirectSpread(tokens, depths, start, end);
56993
+ });
56994
+ }
56995
+ function hasDirectSpread(tokens, depths, start, end) {
56996
+ const level = (depths[start] ?? 0) + 1;
56997
+ for (let index = start + 1; index < end; index += 1) {
56998
+ if (depths[index] === level && tokens[index]?.value === "." && tokens[index + 1]?.value === "." && tokens[index + 2]?.value === ".")
56999
+ return true;
57000
+ }
57001
+ return false;
57002
+ }
56728
57003
  function astroConfigFindings(text, path2, mode) {
56729
57004
  const lexed = lexFrameworkConfig(text, path2);
56730
57005
  if ("finding" in lexed)
56731
57006
  return [lexed.finding];
56732
57007
  const tokens = lexed.tokens;
56733
57008
  const hasPropertyKey = (items2, name) => items2.some((token, index) => token.value === name && items2[index + 1]?.value === ":");
56734
- const invalid7 = hasNonRootProperty(tokens, ["base"], ["", "/"]) || ["srcDir", "outDir", "serverEntry", "client", "server", "assetsPrefix"].some((name) => hasPropertyKey(tokens, name)) || (mode === "edge" ? !text.includes("@astrojs/cloudflare") || !hasProperty(tokens, "output", "server") || !hasProperty(tokens, "session", "false") || !hasProperty(tokens, "imageService", "passthrough") || hasPropertyKey(tokens, "cache") : text.includes("@astrojs/cloudflare") || hasPropertyKey(tokens, "adapter") || hasProperty(tokens, "output", "server"));
57009
+ const invalid7 = hasNonRootProperty(tokens, ["base"], ["", "/"]) || ["srcDir", "outDir"].some((name) => hasPropertyKey(tokens, name)) || hasBuildOutputOption(tokens) || (mode === "edge" ? !text.includes("@astrojs/cloudflare") || !hasProperty(tokens, "output", "server") || !hasProperty(tokens, "session", "false") || !hasProperty(tokens, "imageService", "passthrough") || hasPropertyKey(tokens, "cache") : text.includes("@astrojs/cloudflare") || hasPropertyKey(tokens, "adapter") || hasProperty(tokens, "output", "server"));
56735
57010
  return invalid7 ? [diagnostic({ code: "astro_config_unsupported", path: path2 })] : [];
56736
57011
  }
56737
57012
 
@@ -56748,6 +57023,9 @@ var DatabaseMigrationAdmissionError = class extends Error {
56748
57023
  };
56749
57024
 
56750
57025
  // packages/contracts/dist/database-migration-lexical.js
57026
+ var IDENTIFIER_START = new RegExp("[A-Za-z_]|\\P{ASCII}", "u");
57027
+ var IDENTIFIER_PART = new RegExp("[A-Za-z0-9_$]|\\P{ASCII}", "u");
57028
+ var DOLLAR_TAG = new RegExp("^\\$(?:(?:[A-Za-z_]|\\P{ASCII})(?:[A-Za-z0-9_]|\\P{ASCII})*)?\\$", "u");
56751
57029
  function readMigrationSql(sql) {
56752
57030
  const statements = [];
56753
57031
  let tokens = [];
@@ -56756,7 +57034,7 @@ function readMigrationSql(sql) {
56756
57034
  while (index < sql.length) {
56757
57035
  const character = sql[index] ?? "";
56758
57036
  const next = sql[index + 1];
56759
- if (/\s/u.test(character)) {
57037
+ if (/[ \t\n\r\f\v]/u.test(character)) {
56760
57038
  index += 1;
56761
57039
  continue;
56762
57040
  }
@@ -56790,20 +57068,26 @@ function readMigrationSql(sql) {
56790
57068
  index = skipQuoted(sql, quoteStart + 1, quote, escaped);
56791
57069
  kind = quote === '"' ? "identifier" : "string";
56792
57070
  value = sql.slice(quoteStart + 1, index - 1).replace(/""/gu, '"');
56793
- } else if (character === "$" && /^\$(?:[A-Za-z_][A-Za-z0-9_]*)?\$/u.test(sql.slice(index))) {
56794
- const delimiter = /^\$(?:[A-Za-z_][A-Za-z0-9_]*)?\$/u.exec(sql.slice(index))?.[0] ?? "";
57071
+ if (kind === "identifier" && new TextEncoder().encode(value).byteLength > 63) {
57072
+ throw new DatabaseMigrationAdmissionError("invalid");
57073
+ }
57074
+ } else if (character === "$" && DOLLAR_TAG.test(sql.slice(index))) {
57075
+ const delimiter = DOLLAR_TAG.exec(sql.slice(index))?.[0] ?? "";
56795
57076
  const end = sql.indexOf(delimiter, index + delimiter.length);
56796
57077
  if (end < 0)
56797
57078
  throw new DatabaseMigrationAdmissionError("invalid");
56798
57079
  index = end + delimiter.length;
56799
57080
  kind = "string";
56800
57081
  value = sql.slice(tokenStart, index);
56801
- } else if (/[\p{L}_]/u.test(character)) {
57082
+ } else if (IDENTIFIER_START.test(character)) {
56802
57083
  index += 1;
56803
- while (index < sql.length && /[\p{L}\p{N}_$]/u.test(sql[index] ?? ""))
57084
+ while (index < sql.length && IDENTIFIER_PART.test(sql[index] ?? ""))
56804
57085
  index += 1;
56805
57086
  kind = "word";
56806
57087
  value = sql.slice(tokenStart, index).toLowerCase();
57088
+ if (new TextEncoder().encode(sql.slice(tokenStart, index)).byteLength > 63) {
57089
+ throw new DatabaseMigrationAdmissionError("invalid");
57090
+ }
56807
57091
  } else {
56808
57092
  index += 1;
56809
57093
  }
@@ -57237,8 +57521,73 @@ function pinsSearchPath(tokens) {
57237
57521
  }
57238
57522
  return found;
57239
57523
  }
57524
+ function normalizeTokens(tokens) {
57525
+ let normalized = "";
57526
+ let afterDot = true;
57527
+ for (const token of tokens) {
57528
+ const isDot = token.kind === "symbol" && token.value === ".";
57529
+ if (!isDot && !afterDot)
57530
+ normalized += " ";
57531
+ normalized += token.kind === "string" ? "'literal'" : token.text.toLowerCase();
57532
+ afterDot = isDot;
57533
+ }
57534
+ return normalized;
57535
+ }
57536
+ function readAdditiveAlterTable(tokens) {
57537
+ let index = 0;
57538
+ const take = (keyword) => {
57539
+ if (!isSqlKeyword(tokens[index], keyword))
57540
+ return false;
57541
+ index += 1;
57542
+ return true;
57543
+ };
57544
+ const takeName = () => {
57545
+ const token = tokens[index];
57546
+ if (token?.kind !== "word" && token?.kind !== "identifier")
57547
+ return false;
57548
+ index += 1;
57549
+ return true;
57550
+ };
57551
+ if (!take("alter") || !take("table"))
57552
+ return false;
57553
+ if (take("if") && !take("exists"))
57554
+ return false;
57555
+ take("only");
57556
+ if (!takeName())
57557
+ return false;
57558
+ while (tokens[index]?.kind === "symbol" && tokens[index]?.value === ".") {
57559
+ index += 1;
57560
+ if (!takeName())
57561
+ return false;
57562
+ }
57563
+ if (!take("add"))
57564
+ return false;
57565
+ if (!take("column"))
57566
+ take("constraint");
57567
+ if (take("if") && (!take("not") || !take("exists")))
57568
+ return false;
57569
+ if (!takeName())
57570
+ return false;
57571
+ const expectedClosers = [];
57572
+ for (; index < tokens.length; index += 1) {
57573
+ const token = tokens[index];
57574
+ if (token?.kind !== "symbol")
57575
+ continue;
57576
+ if (token.value === "(")
57577
+ expectedClosers.push(")");
57578
+ else if (token.value === "[")
57579
+ expectedClosers.push("]");
57580
+ else if (token.value === ")" || token.value === "]") {
57581
+ if (expectedClosers.pop() !== token.value)
57582
+ return false;
57583
+ } else if (token.value === "," && expectedClosers.length === 0 && !isSqlKeyword(tokens[index + 1], "add")) {
57584
+ return false;
57585
+ }
57586
+ }
57587
+ return expectedClosers.length === 0;
57588
+ }
57240
57589
  function admitStatement(tokens, sql) {
57241
- const normalized = tokens.map((token) => token.kind === "string" ? "'literal'" : token.text.toLowerCase()).join(" ").replace(/\s*\.\s*/gu, ".");
57590
+ const normalized = normalizeTokens(tokens);
57242
57591
  if (normalized === "set check_function_bodies = false")
57243
57592
  return;
57244
57593
  if (/^create\s+function\b/u.test(normalized)) {
@@ -57248,7 +57597,7 @@ function admitStatement(tokens, sql) {
57248
57597
  }
57249
57598
  return;
57250
57599
  }
57251
- if (/^create\s+schema\s+if\s+not\s+exists\s+(?:auth|extensions|private)$/u.test(normalized) || /^create\s+extension\s+if\s+not\s+exists\s+(?:pgcrypto|btree_gist|unaccent)(?:\s+with\s+schema\s+extensions)?$/u.test(normalized) || /^create\s+(?:table|type|domain|sequence|view|materialized\s+view|(?:constraint\s+)?trigger)\b/u.test(normalized) || /^create\s+(?:unique\s+)?index\b/u.test(normalized) || /^alter\s+table\s+(?:only\s+)?[a-z0-9_."]+\s+add\s+(?:(?:column|constraint)\s+)?(?:if\s+not\s+exists\s+)?[a-z0-9_"]+/u.test(normalized) || /^comment\s+on\b/u.test(normalized)) {
57600
+ if (/^create\s+schema\s+if\s+not\s+exists\s+(?:auth|extensions|private)$/u.test(normalized) || /^create\s+extension\s+if\s+not\s+exists\s+(?:pgcrypto|btree_gist|unaccent)(?:\s+with\s+schema\s+extensions)?$/u.test(normalized) || /^create\s+(?:table|type|domain|sequence|view|materialized\s+view|(?:constraint\s+)?trigger)\b/u.test(normalized) || /^create\s+(?:unique\s+)?index\b/u.test(normalized) || readAdditiveAlterTable(tokens) || /^comment\s+on\b/u.test(normalized)) {
57252
57601
  if (/^create\s+or\s+replace\b/u.test(normalized)) {
57253
57602
  throw new DatabaseMigrationAdmissionError("destructive");
57254
57603
  }
@@ -58805,6 +59154,7 @@ async function startBridge(raw, hooks = {}) {
58805
59154
  }
58806
59155
 
58807
59156
  // apps/product-cli/dist/psql-session.js
59157
+ var KILL_AFTER_TERMINATE_MS = 5e3;
58808
59158
  var runLocalPsql = async (input) => {
58809
59159
  input.signal.throwIfAborted();
58810
59160
  if (input.websocketUrl !== `wss://${input.host}/`)
@@ -58821,7 +59171,6 @@ var runLocalPsql = async (input) => {
58821
59171
  return await new Promise((resolve7, reject) => {
58822
59172
  const child = spawn("psql", ["-h", bridge.host, "-U", input.user, "-d", input.database], {
58823
59173
  stdio: "inherit",
58824
- signal: input.signal,
58825
59174
  env: {
58826
59175
  ...environment,
58827
59176
  PGPASSWORD: input.password,
@@ -58831,10 +59180,33 @@ var runLocalPsql = async (input) => {
58831
59180
  PGGSSENCMODE: "disable"
58832
59181
  }
58833
59182
  });
59183
+ let killer;
59184
+ const forwardInterrupt = () => {
59185
+ child.kill("SIGINT");
59186
+ };
59187
+ const keepAlive = () => void 0;
59188
+ const interrupt = process.stdin.isTTY ? keepAlive : forwardInterrupt;
59189
+ const terminate = () => {
59190
+ child.kill("SIGTERM");
59191
+ killer ??= setTimeout(() => {
59192
+ child.kill("SIGKILL");
59193
+ }, KILL_AFTER_TERMINATE_MS);
59194
+ };
59195
+ const release = () => {
59196
+ clearTimeout(killer);
59197
+ process.off("SIGINT", interrupt);
59198
+ process.off("SIGTERM", terminate);
59199
+ process.off("SIGHUP", terminate);
59200
+ };
59201
+ process.on("SIGINT", interrupt);
59202
+ process.on("SIGTERM", terminate);
59203
+ process.on("SIGHUP", terminate);
58834
59204
  child.once("error", (error) => {
59205
+ release();
58835
59206
  reject(error.code === "ENOENT" ? new PsqlUnavailableError() : error);
58836
59207
  });
58837
59208
  child.once("close", (code, signalName) => {
59209
+ release();
58838
59210
  resolve7(code ?? (signalName === null ? 1 : 130));
58839
59211
  });
58840
59212
  });
@@ -59198,7 +59570,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
59198
59570
  const transport = new FetchWorkosPublicTransport(signal, REQUEST_TIMEOUT_MS);
59199
59571
  const now = () => /* @__PURE__ */ new Date();
59200
59572
  const refresher = new PublicWorkosTokenRefresher(environment);
59201
- const boundedFetch = () => createBoundedFetch(fetch, signal, REQUEST_TIMEOUT_MS, MAX_PUBLIC_RESPONSE_BYTES);
59573
+ const boundedFetch = (parentSignal = signal) => createBoundedFetch(fetch, parentSignal, REQUEST_TIMEOUT_MS, MAX_PUBLIC_RESPONSE_BYTES);
59202
59574
  let profile;
59203
59575
  try {
59204
59576
  if (apiToken !== void 0) {
@@ -59309,7 +59681,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
59309
59681
  verificationUri: platform.verificationUri
59310
59682
  }, transport, { now }),
59311
59683
  deviceAuthorizationPresenter: new StderrDeviceAuthorizationPresenter(io),
59312
- productApi: (accessToken) => new GeneratedSdkProductApi(productApiOrigin, accessToken, boundedFetch()),
59684
+ productApi: (accessToken, parentSignal) => new GeneratedSdkProductApi(productApiOrigin, accessToken, boundedFetch(parentSignal)),
59313
59685
  // Login receives read-only identity, workspace and GitHub queries instead of the product surface.
59314
59686
  accountProfile: async (accessToken) => await new GeneratedSdkProductApi(productApiOrigin, accessToken, boundedFetch()).getAccountProfile(),
59315
59687
  currentIdentity: async (accessToken) => await new GeneratedSdkProductApi(productApiOrigin, accessToken, boundedFetch()).getCurrentIdentity(),