@amerged/ohmyhost-cli 0.1.53 → 0.1.55

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 (28) hide show
  1. package/README.md +1 -1
  2. package/dist/bin.js +1 -1
  3. package/dist/{chunk-7GS4HXFT.js → chunk-4OAAJX5B.js} +297 -54
  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 +70 -25
  8. package/src/apps/product-cli/src/command.ts +52 -5
  9. package/src/apps/product-cli/src/product-api.ts +36 -2
  10. package/src/apps/product-cli/src/repository-init.ts +46 -9
  11. package/src/apps/product-cli/src/runtime-contract.ts +14 -4
  12. package/src/packages/contracts/package.json +5 -5
  13. package/src/packages/contracts/src/database-events.ts +1 -0
  14. package/src/packages/contracts/src/database-migration-admission.ts +33 -3
  15. package/src/packages/contracts/src/database-migration-errors.ts +10 -2
  16. package/src/packages/contracts/src/feedback.ts +9 -0
  17. package/src/packages/contracts/src/framework-admission.ts +4 -0
  18. package/src/packages/contracts/src/framework-source-rules.ts +55 -0
  19. package/src/packages/contracts/src/operation-failure.ts +8 -0
  20. package/src/packages/contracts/src/problem-policy.ts +74 -2
  21. package/src/packages/contracts/src/project-exports.ts +30 -0
  22. package/src/packages/contracts/src/wfp-dispatch.ts +43 -0
  23. package/src/packages/sdk-ts/package.json +1 -1
  24. package/src/packages/sdk-ts/src/generated/index.ts +33 -0
  25. package/src/packages/sdk-ts/src/generated/sdk.gen.ts +253 -13
  26. package/src/packages/sdk-ts/src/generated/types.gen.ts +385 -11
  27. package/src/packages/workos-auth-contracts/src/webhooks.ts +7 -0
  28. package/src/packages/contracts/src/previews.ts +0 -179
@@ -38526,6 +38526,10 @@ var FRAMEWORK_CONVERSION_DETAILS = Object.freeze({
38526
38526
  paths: ["module"],
38527
38527
  template: `"{{path}}" imports a database socket driver (pg, postgres, pg-native or mysql2); customer Workers cannot open sockets. Call the database with createPrivateDatabaseClient from "@ohmyhost/customer-runtime/database". ${PUSH_AND_PLAN}`
38528
38528
  },
38529
+ socket_primitive_unsupported: {
38530
+ paths: ["module"],
38531
+ template: `"{{path}}" loads cloudflare:sockets; customer Workers cannot open sockets. Call HTTPS services through the global fetch function and declare each origin in runtime.egress.allow in ohmyhost.yaml. ${PUSH_AND_PLAN}`
38532
+ },
38529
38533
  source_syntax_invalid: {
38530
38534
  paths: ["module"],
38531
38535
  template: 'Invalid JavaScript or TypeScript in "{{path}}". Fix the file, commit and push the change, then plan the new commit.'
@@ -38977,6 +38981,14 @@ var failures = {
38977
38981
  promotion_target_stale: [
38978
38982
  "The Prod deployment changed before promotion could start.",
38979
38983
  "Read current Prod status, run 'ohmyhost deployment promote plan' again and confirm it with the new resource_etag and confirmation_token. Replaying this terminal operation cannot replace its stale target."
38984
+ ],
38985
+ project_handle_taken: [
38986
+ "The requested project handle was taken before the rename could finish. The project keeps its current handle.",
38987
+ "Run 'ohmyhost project handle check --handle NAME --json' or MCP project_handle_check, choose a handle that is still free, then submit the rename again with the current ETag and a new idempotency key. Replaying this terminal operation cannot take the handle."
38988
+ ],
38989
+ managed_source_dispatch_failed: [
38990
+ "The managed source change could not be dispatched for processing, so it was ended.",
38991
+ "Read the current source to confirm it did not change, then submit the change again with a new idempotency key."
38980
38992
  ]
38981
38993
  };
38982
38994
  function publicOperationReconciliation(observation) {
@@ -39904,6 +39916,7 @@ var detailSentence = new RegExp("^" + detailPrefix + "((?: (?:" + [
39904
39916
  "(?:title|description) must be a string\\.",
39905
39917
  "(?:title|description) must not be empty\\.",
39906
39918
  "(?:title|description) must not start or end with whitespace; trim it\\.",
39919
+ "(?:title|description) must not contain a credential, key or connection string; remove it and submit again\\.",
39907
39920
  "(?:title|description) has [1-9][0-9]{0,8} characters, over the (?:160|8000)-character limit; shorten it, it is never truncated\\.",
39908
39921
  "title must not contain line breaks, tabs or other control characters\\.",
39909
39922
  "description must not contain control characters other than tabs and line breaks, such as terminal color codes\\.",
@@ -40336,6 +40349,12 @@ var PROBLEM_POLICY = {
40336
40349
  action: "The project already answers on this address; no rename is needed.",
40337
40350
  title: "Project address is unchanged"
40338
40351
  },
40352
+ database_limit_reached: {
40353
+ status: 409,
40354
+ retryable: false,
40355
+ action: "Delete a database you no longer need, or the project whose database it is, then deploy again. The limit counts the organization's live databases.",
40356
+ title: "Database limit reached"
40357
+ },
40339
40358
  project_rename_blocked: {
40340
40359
  status: 409,
40341
40360
  retryable: true,
@@ -40410,6 +40429,12 @@ var PROBLEM_POLICY = {
40410
40429
  action: "Read the workspace sender resource and project binding. Reuse requires explicit domain-use authority, target-project editing and a current verified application identity with the same registrable main domain. Read the current revision before changing settings. Detach a shared project binding explicitly; legacy domain deletion cannot retire a resource used by another project.",
40411
40430
  title: "Mail domain conflict"
40412
40431
  },
40432
+ mail_domain_pending_limit: {
40433
+ status: 409,
40434
+ retryable: false,
40435
+ action: "This organization already holds the maximum number of unverified workspace mail domains. Verify one of them, or retire an unused one, and then add this domain again.",
40436
+ title: "Mail domain pending limit"
40437
+ },
40413
40438
  mail_domain_required: {
40414
40439
  status: 409,
40415
40440
  retryable: false,
@@ -40488,6 +40513,12 @@ var PROBLEM_POLICY = {
40488
40513
  action: "Keep the flag on, remove the custom domain with 'ohmyhost domain paid delete', or buy Paid, then switch the flag off.",
40489
40514
  title: "Powered-by flag required"
40490
40515
  },
40516
+ build_capacity_reached: {
40517
+ status: 429,
40518
+ retryable: false,
40519
+ action: "This organization already has its maximum number of open builds. Wait for an open deployment to finish, then start a new deployment with a new idempotency key.",
40520
+ title: "Build capacity reached"
40521
+ },
40491
40522
  rate_limited: {
40492
40523
  status: 429,
40493
40524
  retryable: true,
@@ -40538,6 +40569,12 @@ var PROBLEM_POLICY = {
40538
40569
  action: "Stop retries and submit feedback with this operation ID. A platform recovery review is required.",
40539
40570
  title: "Recovery attempts exhausted"
40540
40571
  },
40572
+ reconciliation_not_pending: {
40573
+ status: 409,
40574
+ retryable: false,
40575
+ action: "Do not repeat this reconciliation: no uncertain delivery or provider mutation is pending for this operation. If the operation still does not finish, submit feedback with this operation ID.",
40576
+ title: "No recovery pending"
40577
+ },
40541
40578
  service_unavailable: {
40542
40579
  status: 503,
40543
40580
  retryable: true,
@@ -40555,10 +40592,17 @@ var PROBLEM_POLICY = {
40555
40592
  domain_hostname_taken: {
40556
40593
  status: 409,
40557
40594
  retryable: false,
40558
- action: "A live project connection already holds this hostname. Remove it from the project you manage with 'ohmyhost domain paid delete --project ULID --hostname HOST --yes --json', then apply it to the new project. Repeating while that connection remains cannot work; report the request_id if you cannot manage its owning project.",
40559
- restAction: "A live project connection already holds this hostname. Remove it from the project you manage with 'ohmyhost domain paid delete --project ULID --hostname HOST --yes --json', then apply it to the new project. Repeating while that connection remains cannot work; report the request_id if you cannot manage its owning project.",
40595
+ action: "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --yes --json. To connect it here, run application_domain_identity_declare (CLI: ohmyhost mail identity declare --project ULID --hostname HOST --idempotency-key KEY --json), add the _omh-project.HOST TXT record it returns, run application_domain_identity_verify (CLI: ohmyhost mail identity verify --project ULID --expected-revision N --idempotency-key KEY --json), then apply again.",
40596
+ restAction: "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --yes --json. To connect it here, run application_domain_identity_declare (CLI: ohmyhost mail identity declare --project ULID --hostname HOST --idempotency-key KEY --json), add the _omh-project.HOST TXT record it returns, run application_domain_identity_verify (CLI: ohmyhost mail identity verify --project ULID --expected-revision N --idempotency-key KEY --json), then apply again.",
40560
40597
  title: "Domain hostname is already connected"
40561
40598
  },
40599
+ domain_ownership_required: {
40600
+ status: 409,
40601
+ retryable: false,
40602
+ action: "This hostname is not verified for this project yet. Run application_domain_identity_declare (CLI: ohmyhost mail identity declare --project ULID --hostname HOST --idempotency-key KEY --json) and add the _omh-project.HOST TXT record it returns; then application_domain_identity_verify (CLI: ohmyhost mail identity verify --project ULID --expected-revision N --idempotency-key KEY --json), then apply again. Repeating before then cannot work.",
40603
+ restAction: "This hostname is not verified for this project yet. Run application_domain_identity_declare (CLI: ohmyhost mail identity declare --project ULID --hostname HOST --idempotency-key KEY --json) and add the _omh-project.HOST TXT record it returns; then application_domain_identity_verify (CLI: ohmyhost mail identity verify --project ULID --expected-revision N --idempotency-key KEY --json), then apply again. Repeating before then cannot work.",
40604
+ title: "Verify the domain before connecting it"
40605
+ },
40562
40606
  domain_dns_conflict: {
40563
40607
  status: 409,
40564
40608
  retryable: false,
@@ -40604,6 +40648,36 @@ var PROBLEM_POLICY = {
40604
40648
  retryable: false,
40605
40649
  title: "Complete the pending domain change",
40606
40650
  action: "Read project status and Paid domain status to identify the pending change. If a Paid domain removal is pending, retry it as a current owner with a new idempotency key. If a project address change is pending, submit a fresh address change as a current owner. After it finishes, create a new project deletion plan."
40651
+ },
40652
+ native_auth_launch_unavailable: {
40653
+ status: 409,
40654
+ retryable: false,
40655
+ title: "Native Auth cannot launch yet",
40656
+ action: "Read the Native Auth configuration with 'ohmyhost auth config get --project ULID --environment ULID --json'. Its readiness shows which requirement is missing: a Paid plan, a verified sender domain, an approved canonical origin or storage. Complete that requirement, then send the change again with a new idempotency key. Repeating unchanged does not help."
40657
+ },
40658
+ native_auth_provider_unavailable: {
40659
+ status: 409,
40660
+ retryable: false,
40661
+ title: "Native Auth provider unavailable",
40662
+ action: "This sign-in provider cannot be enabled for this project's current Native Auth state. Read the provider with 'ohmyhost auth provider get --project ULID --environment ULID --provider google|github --json' and complete the Native Auth configuration it reports. Repeating unchanged does not help."
40663
+ },
40664
+ native_auth_epoch_exhausted: {
40665
+ status: 409,
40666
+ retryable: false,
40667
+ title: "Native Auth policy changes exhausted",
40668
+ 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."
40669
+ },
40670
+ project_domains_conflict: {
40671
+ status: 409,
40672
+ retryable: false,
40673
+ title: "Project domains belong to another handle",
40674
+ action: "The domains of this project were configured under another project handle. Read the project with 'ohmyhost project status --project ULID --json' to see its current handle, then repeat the domain configuration with a new idempotency key. Do not replay the earlier request."
40675
+ },
40676
+ native_user_conflict: {
40677
+ status: 409,
40678
+ retryable: false,
40679
+ title: "Native Auth user conflicts with current state",
40680
+ action: "The user already exists, or the user is not in the state this action needs (for example a pending user cannot be suspended, and only a pending invitation can be resent). Read the user with 'ohmyhost auth user get --project ULID --environment ULID --user UUID --json' and choose the action that matches its status."
40607
40681
  }
40608
40682
  };
40609
40683
 
@@ -40799,7 +40873,7 @@ var parseCloudflareDnsAuthorizationStatus = (value) => {
40799
40873
  const input = exactRecord2(value, ["status", "zone", "scopes", "expires_at"]);
40800
40874
  const status = input["status"];
40801
40875
  const scopes = input["scopes"];
40802
- if (status !== "not_authorized" && status !== "pending" && status !== "authorized" && status !== "expired" && status !== "revoked" || (status === "not_authorized" ? input["zone"] !== null : typeof input["zone"] !== "string" || !isPaidHostname(input["zone"])) || !Array.isArray(scopes) || scopes.length > 2 || scopes.some((scope) => scope !== "dns.write" && scope !== "zone.read") || new Set(scopes).size !== scopes.length || input["expires_at"] !== null && !isIsoInstant(input["expires_at"]) || status === "authorized" && [...scopes].sort().join(",") !== "dns.write,zone.read" || status === "not_authorized" && (scopes.length !== 0 || input["expires_at"] !== null)) {
40876
+ if (status !== "not_authorized" && status !== "pending" && status !== "authorized" && status !== "reauthorization_required" && status !== "expired" && status !== "revoked" || (status === "not_authorized" ? input["zone"] !== null : typeof input["zone"] !== "string" || !isPaidHostname(input["zone"])) || !Array.isArray(scopes) || scopes.length > 2 || scopes.some((scope) => scope !== "dns.write" && scope !== "zone.read") || new Set(scopes).size !== scopes.length || input["expires_at"] !== null && !isIsoInstant(input["expires_at"]) || status === "authorized" && [...scopes].sort().join(",") !== "dns.write,zone.read" || status === "not_authorized" && (scopes.length !== 0 || input["expires_at"] !== null) || status === "reauthorization_required" && (scopes.length !== 0 || input["expires_at"] !== null)) {
40803
40877
  throw new ResponseContractError();
40804
40878
  }
40805
40879
  return input;
@@ -41138,7 +41212,7 @@ var parseFunctionRun = (value) => {
41138
41212
  "status_code"
41139
41213
  ]);
41140
41214
  const nullableInstant = (candidate) => candidate === null || isIsoInstant(candidate);
41141
- if (!isUlidValue(input["id"]) || !isUlidValue(input["deployment_id"]) || typeof input["cron"] !== "string" || input["cron"].length === 0 || input["cron"].length > 64 || !isIsoInstant(input["scheduled_at"]) || !["due", "running", "retry", "succeeded", "failed"].includes(String(input["state"])) || !Number.isSafeInteger(input["attempt"]) || Number(input["attempt"]) < 0 || Number(input["attempt"]) > 3 || !(input["status_code"] === null || Number.isSafeInteger(input["status_code"]) && Number(input["status_code"]) >= 100 && Number(input["status_code"]) <= 599) || !nullableInstant(input["started_at"]) || !nullableInstant(input["finished_at"])) {
41215
+ if (!isUlidValue(input["id"]) || !isUlidValue(input["deployment_id"]) || typeof input["cron"] !== "string" || input["cron"].length === 0 || input["cron"].length > 64 || !isIsoInstant(input["scheduled_at"]) || !["due", "running", "retry", "succeeded", "failed", "skipped"].includes(String(input["state"])) || !Number.isSafeInteger(input["attempt"]) || Number(input["attempt"]) < 0 || Number(input["attempt"]) > 3 || !(input["status_code"] === null || Number.isSafeInteger(input["status_code"]) && Number(input["status_code"]) >= 100 && Number(input["status_code"]) <= 599) || !nullableInstant(input["started_at"]) || !nullableInstant(input["finished_at"])) {
41142
41216
  throw new ResponseContractError();
41143
41217
  }
41144
41218
  return input;
@@ -43375,7 +43449,7 @@ var recognizedCommandLabel = (argv) => {
43375
43449
  return "operation reconcile";
43376
43450
  if (value === "token" && ["create", "list", "revoke"].includes(values[0] ?? ""))
43377
43451
  return `token ${values[0]}`;
43378
- if (value === "export" && (values[0] === "create" || values[0] === "get"))
43452
+ if (value === "export" && (values[0] === "create" || values[0] === "get" || values[0] === "download-link"))
43379
43453
  return `export ${values[0]}`;
43380
43454
  if (value === "feedback" && values[0] === "submit")
43381
43455
  return "feedback submit";
@@ -44625,8 +44699,13 @@ var parseProductCliCommand = (argv) => {
44625
44699
  if (subcommand === "delete" || subcommand === "test") {
44626
44700
  if (!yes || wait || follow || revoke || stdin)
44627
44701
  throw new InvalidCommandError();
44628
- const options = parseOptionalOptions(values, ["--project", "--environment", "--webhook"]);
44629
- const projectId = options["--project"], environment = options["--environment"], webhookId = options["--webhook"];
44702
+ const options = parseOptionalOptions(values, [
44703
+ "--project",
44704
+ "--environment",
44705
+ "--webhook",
44706
+ "--idempotency-key"
44707
+ ]);
44708
+ const projectId = options["--project"], environment = options["--environment"], webhookId = options["--webhook"], idempotencyKey = options["--idempotency-key"] ?? null;
44630
44709
  if (!isValue(projectId))
44631
44710
  throw new InvalidCommandError();
44632
44711
  if (environment !== "dev" && environment !== "prod")
@@ -44638,6 +44717,7 @@ var parseProductCliCommand = (argv) => {
44638
44717
  projectId,
44639
44718
  environment,
44640
44719
  webhookId: target,
44720
+ idempotencyKey,
44641
44721
  yes: true,
44642
44722
  credentialStore
44643
44723
  };
@@ -44646,6 +44726,7 @@ var parseProductCliCommand = (argv) => {
44646
44726
  projectId,
44647
44727
  environment,
44648
44728
  webhookId: target,
44729
+ idempotencyKey,
44649
44730
  yes: true,
44650
44731
  credentialStore
44651
44732
  };
@@ -44676,7 +44757,12 @@ var parseProductCliCommand = (argv) => {
44676
44757
  if (subcommand === "replay") {
44677
44758
  if (!yes || wait || follow || revoke || stdin)
44678
44759
  throw new InvalidCommandError();
44679
- const options = parseOptionalOptions(values, ["--project", "--environment", "--delivery"]);
44760
+ const options = parseOptionalOptions(values, [
44761
+ "--project",
44762
+ "--environment",
44763
+ "--delivery",
44764
+ "--idempotency-key"
44765
+ ]);
44680
44766
  const projectId = options["--project"], environment = options["--environment"], deliveryId = options["--delivery"];
44681
44767
  if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
44682
44768
  throw new InvalidCommandError();
@@ -44685,6 +44771,7 @@ var parseProductCliCommand = (argv) => {
44685
44771
  projectId,
44686
44772
  environment,
44687
44773
  deliveryId: contractValue(() => parseDatabaseDeliveryId(deliveryId)),
44774
+ idempotencyKey: options["--idempotency-key"] ?? null,
44688
44775
  yes: true,
44689
44776
  credentialStore
44690
44777
  };
@@ -44761,7 +44848,7 @@ var parseProductCliCommand = (argv) => {
44761
44848
  if (subcommand === "delete" || subcommand === "run") {
44762
44849
  if (!yes || wait || follow || revoke || stdin)
44763
44850
  throw new InvalidCommandError();
44764
- const options = parseOptionalOptions(values, ["--project", "--environment", "--name"]);
44851
+ const options = parseOptionalOptions(values, subcommand === "run" ? ["--project", "--environment", "--name", "--idempotency-key"] : ["--project", "--environment", "--name"]);
44765
44852
  const projectId = options["--project"], environment = options["--environment"];
44766
44853
  if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
44767
44854
  throw new InvalidCommandError();
@@ -44778,6 +44865,7 @@ var parseProductCliCommand = (argv) => {
44778
44865
  projectId,
44779
44866
  environment,
44780
44867
  name,
44868
+ idempotencyKey: options["--idempotency-key"] ?? null,
44781
44869
  yes: true,
44782
44870
  credentialStore
44783
44871
  };
@@ -45100,6 +45188,21 @@ var parseProductCliCommand = (argv) => {
45100
45188
  const options = parseOptions(values, ["--project"]);
45101
45189
  return { kind: "export-get", projectId: options["--project"], exportId, credentialStore };
45102
45190
  }
45191
+ if (first === "export" && values[0] === "download-link") {
45192
+ if (yes || wait || follow || stdin)
45193
+ throw new InvalidCommandError();
45194
+ values.shift();
45195
+ const exportId = values.shift();
45196
+ if (!exportId)
45197
+ throw new InvalidCommandError();
45198
+ const options = parseOptions(values, ["--project"]);
45199
+ return {
45200
+ kind: "export-download-link",
45201
+ projectId: options["--project"],
45202
+ exportId,
45203
+ credentialStore
45204
+ };
45205
+ }
45103
45206
  if (first === "secret" && values[0] === "list") {
45104
45207
  if (yes || wait || follow || stdin)
45105
45208
  throw new InvalidCommandError();
@@ -45953,7 +46056,7 @@ function exact4(v, keys) {
45953
46056
  // apps/product-cli/package.json
45954
46057
  var package_default = {
45955
46058
  name: "@ohmyhost/product-cli",
45956
- version: "0.1.53",
46059
+ version: "0.1.55",
45957
46060
  private: true,
45958
46061
  ohmyhost: {
45959
46062
  deployment: "production",
@@ -46017,6 +46120,14 @@ function assertProjectContext(v) {
46017
46120
  }
46018
46121
 
46019
46122
  // packages/contracts/dist/project-exports.js
46123
+ var EXPORT_PASSWORD_MIN_CHARACTERS = 12;
46124
+ function exportPasswordMeetsMinimum(value) {
46125
+ return Array.from(value).length >= EXPORT_PASSWORD_MIN_CHARACTERS;
46126
+ }
46127
+ function assertProjectExportDownloadLink(value) {
46128
+ if (!record7(value) || Object.keys(value).sort().join(",") !== "download_expires_at,download_url,id,project_id" || typeof value["id"] !== "string" || !id.test(value["id"]) || typeof value["project_id"] !== "string" || !id.test(value["project_id"]) || typeof value["download_url"] !== "string" || !value["download_url"].startsWith("https://") || !timestamp5(value["download_expires_at"]))
46129
+ throw new TypeError("Project export download link is invalid");
46130
+ }
46020
46131
  function assertProjectExport(value) {
46021
46132
  if (!record7(value) || Object.keys(value).sort().join(",") !== "archive,error,id,next_poll_after_seconds,next_request_at,project_id,requested_at,state" || typeof value["id"] !== "string" || !id.test(value["id"]) || typeof value["project_id"] !== "string" || !id.test(value["project_id"]) || !["queued", "running", "succeeded", "failed", "cancelled"].includes(String(value["state"])) || !timestamp5(value["requested_at"]) || !timestamp5(value["next_request_at"]))
46022
46133
  invalid4();
@@ -46263,7 +46374,8 @@ var HELP_USAGE = Object.freeze({
46263
46374
  "github connect": "ohmyhost github connect --organization ULID --idempotency-key KEY --json (connect once, then link covered repositories without another browser consent)",
46264
46375
  "github status": "ohmyhost github status --organization ULID --json",
46265
46376
  "export create": "ohmyhost export create --project ULID --idempotency-key KEY --stdin --json (password on stdin only; one accepted SQL ZIP per project per 24 hours)",
46266
- "export get": "ohmyhost export get EXPORT_ULID --project ULID --json (poll the original job; signed ZIP download lasts 24 hours)",
46377
+ "export get": "ohmyhost export get EXPORT_ULID --project ULID --json (poll the original job: progress and error only, never a download URL; once it succeeds, run 'ohmyhost export download-link' for the signed 24-hour ZIP link)",
46378
+ "export download-link": "ohmyhost export download-link EXPORT_ULID --project ULID --json (signs one audited 24-hour link of a succeeded SQL ZIP; the URL is a secret, keep it out of files and notes; each call signs another link)",
46267
46379
  "credits account": "ohmyhost credits account --organization ULID --json",
46268
46380
  "referral link": "ohmyhost referral link --organization ULID --json (the workspace's link to share; a new user whose first workspace comes from it starts with 30 days of Paid and 1,000 credits, and its first payment gives this workspace 1,000 credits plus 30 days of Paid unless a subscription or an unbounded grant already covers it)",
46269
46381
  "credits balance": "ohmyhost credits balance --organization ULID --json",
@@ -46315,16 +46427,16 @@ var HELP_USAGE = Object.freeze({
46315
46427
  "database webhook create": "ohmyhost database webhook create --project ULID --environment dev|prod --url HTTPS_URL --event-types TYPE[,TYPE] [--headers-file PATH] --idempotency-key KEY --yes --json (the signing secret is shown once in this answer; types: database.created, database.ready, database.woke, database.slept, database.suspended, database.resized, database.deleted, data.<topic> for the rows of one watched table printed by database watch create, or data.* for every watched table; a bare * is not accepted and does not include data events; the headers file is a UTF-8 JSON object of at most 8 KiB)",
46316
46428
  "database webhook list": "ohmyhost database webhook list --project ULID [--environment dev|prod] --json (dev when omitted; the secret is never listed)",
46317
46429
  "database webhook get": "ohmyhost database webhook get --project ULID [--environment dev|prod] --webhook ID --json",
46318
- "database webhook delete": "ohmyhost database webhook delete --project ULID --environment dev|prod --webhook ID --yes --json",
46319
- "database webhook test": "ohmyhost database webhook test --project ULID --environment dev|prod --webhook ID --yes --json (sends one signed test request to the receiver; nothing is stored)",
46430
+ "database webhook delete": "ohmyhost database webhook delete --project ULID --environment dev|prod --webhook ID [--idempotency-key KEY] --yes --json (a retry with the same key and request returns the stored answer; without a key each call is new)",
46431
+ "database webhook test": "ohmyhost database webhook test --project ULID --environment dev|prod --webhook ID [--idempotency-key KEY] --yes --json (sends one signed test request to the receiver; nothing is stored; a retry with the same key and request returns the stored outcome without sending again)",
46320
46432
  "database webhook deliveries": "ohmyhost database webhook deliveries --project ULID [--environment dev|prod] [--webhook ID] [--limit 1..100] [--cursor CURSOR] --json",
46321
- "database webhook replay": "ohmyhost database webhook replay --project ULID --environment dev|prod --delivery ID --yes --json",
46433
+ "database webhook replay": "ohmyhost database webhook replay --project ULID --environment dev|prod --delivery ID [--idempotency-key KEY] --yes --json (a retry with the same key and request returns the stored answer without queuing another attempt)",
46322
46434
  "database schedule set": "ohmyhost database schedule set --project ULID --environment dev|prod --name NAME (--cron EXPR | --every-seconds N) --statements-file PATH [--timeout-ms N] [--enabled true|false] --yes --json (runs the statements in the file, a UTF-8 JSON array of 1 to 20 SQL strings, as the runtime role of the application; cron has five fields in UTC; every-seconds is 60 to 2678400; timeout-ms is 1000 to 30000, default 10000). A project whose Stop budget is reached has its schedules disabled automatically, within about an hour of the billed usage reaching the budget: the credit service does this after its hourly pgcf pass, and Continue budgets are never touched. While the budget is reached, schedule set with enabled true and schedule run are refused with project_budget_exceeded (HTTP 402). Re-enabling is manual: raise the budget (or wait for the next UTC month) and run database schedule set --enabled true again with the schedule body (read it with schedule get).",
46323
46435
  "database schedule list": "ohmyhost database schedule list --project ULID [--environment dev|prod] --json (dev when omitted)",
46324
46436
  "database schedule get": "ohmyhost database schedule get --project ULID [--environment dev|prod] --name NAME --json",
46325
46437
  "database schedule delete": "ohmyhost database schedule delete --project ULID --environment dev|prod --name NAME --yes --json",
46326
46438
  "database schedule runs": "ohmyhost database schedule runs --project ULID [--environment dev|prod] --name NAME [--limit 1..50] --json",
46327
- "database schedule run": "ohmyhost database schedule run --project ULID --environment dev|prod --name NAME --yes --json (queues one run now, in addition to the timer; refused with project_budget_exceeded (HTTP 402) while the project's Stop budget is reached)",
46439
+ "database schedule run": "ohmyhost database schedule run --project ULID --environment dev|prod --name NAME [--idempotency-key KEY] --yes --json (queues one run now, in addition to the timer; a retry with the same key and request returns the stored answer without a second run; refused with project_budget_exceeded (HTTP 402) while the project's Stop budget is reached)",
46328
46440
  "database executions": "ohmyhost database executions --project ULID [--environment dev|prod] --from ISO --to ISO --granularity hour|day [--limit 1..100] [--cursor CURSOR] --json (UTC timestamps like 2026-10-30T00:00:00.000Z aligned to the granularity, at most 31 days; counts schedule runs, webhook attempts and events per hour or day; these are counters only, executions have no price of their own and the awake compute time of the database is what is billed)",
46329
46441
  "database psql": "ohmyhost database psql --project ULID --environment dev|prod [--mode read|write] [--ttl 5m|1h|24h|SECONDS] [--json] (starts local psql with a temporary credential and revokes it on exit)",
46330
46442
  link: "ohmyhost link --project ULID --repository-owner OWNER --repository-name REPOSITORY --idempotency-key KEY --json (uses the workspace GitHub connection and waits for the source-link operation)",
@@ -46422,18 +46534,18 @@ var invalidCommandAction = (argv, commandPrefix) => {
46422
46534
  const linkable = /(?:^|\s)--project ULID/u.test(usage) && !argv.includes("--project");
46423
46535
  return `The arguments of '${label}' are invalid or incomplete; nothing was sent. Usage: ${usage}.${linkable ? ` --project may be omitted only inside a directory linked with '${commandPrefix} link' for this OHMYHOST_ENVIRONMENT; otherwise pass --project ULID.` : ""}`;
46424
46536
  };
46425
- var retryAdvice = (command) => {
46537
+ var retryAdvice = (command, keyed = true) => {
46426
46538
  const usage = Object.hasOwn(HELP_USAGE, command) ? HELP_USAGE[command] : "";
46427
- if (usage.includes("--idempotency-key"))
46539
+ if (keyed && usage.includes("--idempotency-key"))
46428
46540
  return "run the same command again with the same --idempotency-key; the change may already have been applied, and a new key could apply it twice";
46429
46541
  if (usage.includes("--yes"))
46430
46542
  return "this command has no idempotency key and the change may already have been applied; check its current state first with the matching list or get command (for example database access list --project ULID --json), and run the command again only if the change is not there";
46431
46543
  return "run the same command again; this command has no idempotency key, so check its current state first if it may have changed anything";
46432
46544
  };
46433
- var internalErrorAction = (command) => `The ohmyhost client stopped on an unexpected error; the stderr line starting with [ohmyhost: identifies it. Compare 'ohmyhost --version' with https://ohmyho.st/client-release.json and install the published client if it is older, then ${retryAdvice(command)}. If the current client fails the same way, report it with feedback submit (kind bug, error code internal_error) and quote that stderr line.`;
46545
+ var internalErrorAction = (command, keyed = true) => `The ohmyhost client stopped on an unexpected error; the stderr line starting with [ohmyhost: identifies it. Compare 'ohmyhost --version' with https://ohmyho.st/client-release.json and install the published client if it is older, then ${retryAdvice(command, keyed)}. If the current client fails the same way, report it with feedback submit (kind bug, error code internal_error) and quote that stderr line.`;
46434
46546
  var CREDENTIAL_STORE_UNAVAILABLE_ACTION = "This computer's credential store (for example macOS Keychain or Windows Credential Manager) or the saved-login list in ~/.ohmyhost/profiles could not be read or written; nothing was changed. If the agent runs in a sandbox, run the command with access to them before asking the customer to sign in again. If the store is locked, ask the customer to unlock it, then run the command again. On a server, container or CI runner without a credential store, do not run login: load OHMYHOST_TOKEN from a private env file with a token from the portal's API Tokens page.";
46435
- var responseContractAction = (command) => `The ohmyho.st API answered in a form this client version does not accept, usually because the client is older than the service. Compare 'ohmyhost --version' with https://ohmyho.st/client-release.json; if it is older, install the published CLI and MCP and reload MCP. Then ${retryAdvice(command)}. If the current version answers this too, report it with feedback submit (kind bug, error code response_contract_invalid).`;
46436
- var requestTimeoutAction = (command) => `The ohmyho.st API did not answer within 30 seconds; ${retryAdvice(command)}.`;
46547
+ var responseContractAction = (command, keyed = true) => `The ohmyho.st API answered in a form this client version does not accept, usually because the client is older than the service. Compare 'ohmyhost --version' with https://ohmyho.st/client-release.json; if it is older, install the published CLI and MCP and reload MCP. Then ${retryAdvice(command, keyed)}. If the current version answers this too, report it with feedback submit (kind bug, error code response_contract_invalid).`;
46548
+ var requestTimeoutAction = (command, keyed = true) => `The ohmyho.st API did not answer within 30 seconds; ${retryAdvice(command, keyed)}.`;
46437
46549
  var LOGOUT_UNCONFIRMED_ACTION = "The saved login was removed from this computer, but ohmyho.st did not confirm that its session ended. Running logout again cannot retry this, because the login is gone; do not sign in again just to revoke it. Tell the customer the session end was not confirmed.";
46438
46550
  var HEADERS_FILE_INVALID_ACTION = "Put one JSON object of header names and values in the file named by --headers-file: UTF-8, at most 8 KiB, unique names, values of visible ASCII characters. Names such as content-type, host, content-length, connection, transfer-encoding, user-agent, te, upgrade and expect, and names starting with pgcf-, cf- or x-forwarded-, are refused. Nothing was sent; fix the file and run the command again.";
46439
46551
  var SCHEDULE_STATEMENTS_FILE_INVALID_ACTION = "Put one JSON array of 1 to 20 non-empty SQL strings in the file named by --statements-file: UTF-8, at most 64 KiB in total and 16 KiB per statement, without NUL characters. Nothing was saved; fix the file and run the command again.";
@@ -46678,7 +46790,7 @@ var ProductCli = class {
46678
46790
  if (command.kind === "export-create") {
46679
46791
  const api = await this.authenticatedApi(command.credentialStore, signal);
46680
46792
  const password = await this.dependencies.readSecretValue(signal);
46681
- if (password.trim().length === 0 || new TextEncoder().encode(password).length > 1024)
46793
+ if (password.trim().length === 0 || new TextEncoder().encode(password).length > 1024 || !exportPasswordMeetsMinimum(password))
46682
46794
  throw new SecretInputError();
46683
46795
  const operation = parseOperation(await api.createProjectExport({
46684
46796
  projectId: command.projectId,
@@ -46696,6 +46808,15 @@ var ProductCli = class {
46696
46808
  assertProjectExport(result);
46697
46809
  return success("export get", { status: result.state, export: result });
46698
46810
  }
46811
+ if (command.kind === "export-download-link") {
46812
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46813
+ const link2 = await api.createProjectExportDownloadLink({
46814
+ projectId: command.projectId,
46815
+ exportId: command.exportId
46816
+ });
46817
+ assertProjectExportDownloadLink(link2);
46818
+ return success("export download-link", { status: "succeeded", download_link: link2 });
46819
+ }
46699
46820
  if (command.kind === "feedback-status") {
46700
46821
  const api = await this.authenticatedApi(command.credentialStore, signal);
46701
46822
  const feedback = await api.getFeedback(command.feedbackId, command.cursor);
@@ -46931,7 +47052,14 @@ var ProductCli = class {
46931
47052
  if (error instanceof ProfileLimitError)
46932
47053
  return failure(name, 2, "profile_limit_reached", false, profileLimitAction(this.dependencies.commandPrefix));
46933
47054
  this.recordDiagnostic(diagnosticDescriptor(error, signal));
46934
- return classifyFailure(name, error, signal, this.context());
47055
+ return classifyFailure(
47056
+ name,
47057
+ error,
47058
+ signal,
47059
+ this.context(),
47060
+ // A mutation parsed without its optional --idempotency-key has no key to repeat with.
47061
+ !("idempotencyKey" in command && command.idempotencyKey === null)
47062
+ );
46935
47063
  }
46936
47064
  }
46937
47065
  githubConnectAction(organizationId) {
@@ -47446,7 +47574,8 @@ var ProductCli = class {
47446
47574
  const deleted = await api.deleteProjectDatabaseWebhook({
47447
47575
  projectId: command.projectId,
47448
47576
  environment: command.environment,
47449
- webhookId: command.webhookId
47577
+ webhookId: command.webhookId,
47578
+ ...command.idempotencyKey === null ? {} : { idempotencyKey: command.idempotencyKey }
47450
47579
  });
47451
47580
  return success("database webhook delete", { status: "succeeded", deleted });
47452
47581
  }
@@ -47455,7 +47584,8 @@ var ProductCli = class {
47455
47584
  const result = await api.testProjectDatabaseWebhook({
47456
47585
  projectId: command.projectId,
47457
47586
  environment: command.environment,
47458
- webhookId: command.webhookId
47587
+ webhookId: command.webhookId,
47588
+ ...command.idempotencyKey === null ? {} : { idempotencyKey: command.idempotencyKey }
47459
47589
  });
47460
47590
  return success("database webhook test", { status: "succeeded", result });
47461
47591
  }
@@ -47479,7 +47609,8 @@ var ProductCli = class {
47479
47609
  const replay = await api.replayProjectDatabaseWebhookDelivery({
47480
47610
  projectId: command.projectId,
47481
47611
  environment: command.environment,
47482
- deliveryId: command.deliveryId
47612
+ deliveryId: command.deliveryId,
47613
+ ...command.idempotencyKey === null ? {} : { idempotencyKey: command.idempotencyKey }
47483
47614
  });
47484
47615
  return success("database webhook replay", { status: "succeeded", replay });
47485
47616
  }
@@ -47536,7 +47667,8 @@ var ProductCli = class {
47536
47667
  const run = await api.runProjectDatabaseSchedule({
47537
47668
  projectId: command.projectId,
47538
47669
  environment: command.environment,
47539
- name: command.name
47670
+ name: command.name,
47671
+ ...command.idempotencyKey === null ? {} : { idempotencyKey: command.idempotencyKey }
47540
47672
  });
47541
47673
  return success("database schedule run", { status: "succeeded", run });
47542
47674
  }
@@ -48158,25 +48290,25 @@ var ACCOUNT_SENSITIVE_PROBLEMS = /* @__PURE__ */ new Set([
48158
48290
  "repository_not_installed"
48159
48291
  ]);
48160
48292
  var classifyCliFailure = (command, error, signal) => classifyFailure(command, error, signal);
48161
- var classifyFailure = (command, error, signal, actingAs) => {
48293
+ var classifyFailure = (command, error, signal, actingAs, keyed = true) => {
48162
48294
  if (error instanceof LocalSourcePublicationError)
48163
48295
  return failure(command, 2, error.code, error.code === "source_publication_pending", error.message, error.operation);
48164
48296
  if (error instanceof SourceWorkspaceError)
48165
48297
  return failure(command, 2, error.code, error.code === "source_snapshot_changed", error.message);
48166
48298
  if (signal.aborted || isCancellation(error)) {
48167
- return failure(command, 130, "command_cancelled", true, `The command was stopped by an interrupt or termination signal, for example the shell's command timeout, before it finished; ${retryAdvice(command)}. Give login and commands with --wait or --follow several minutes, or run them in the background.`);
48299
+ return failure(command, 130, "command_cancelled", true, `The command was stopped by an interrupt or termination signal, for example the shell's command timeout, before it finished; ${retryAdvice(command, keyed)}. Give login and commands with --wait or --follow several minutes, or run them in the background.`);
48168
48300
  }
48169
48301
  if (isTimeout2(error)) {
48170
- return failure(command, 8, "request_timeout", true, requestTimeoutAction(command));
48302
+ return failure(command, 8, "request_timeout", true, requestTimeoutAction(command, keyed));
48171
48303
  }
48172
48304
  if (error instanceof ProductCliFailure && error.code === "request_timeout" && error.retryable) {
48173
- return failure(command, 8, "request_timeout", true, requestTimeoutAction(command));
48305
+ return failure(command, 8, "request_timeout", true, requestTimeoutAction(command, keyed));
48174
48306
  }
48175
48307
  if (error instanceof ProductCliFailure) {
48176
48308
  return failure(command, error.exitCode, error.code, error.retryable, error.suggestedAction, error.operation);
48177
48309
  }
48178
48310
  if (error instanceof SecretInputError) {
48179
- return failure(command, 2, "secret_input_invalid", false, command === "export create" ? "Pipe the ZIP password through standard input: non-blank UTF-8 of at most 1024 bytes. A final line break becomes part of the password." : "Pipe a non-empty UTF-8 value of at most 5120 bytes through standard input.");
48311
+ return failure(command, 2, "secret_input_invalid", false, command === "export create" ? `Pipe the ZIP password through standard input: at least ${EXPORT_PASSWORD_MIN_CHARACTERS} characters, non-blank UTF-8 of at most 1024 bytes. A final line break becomes part of the password.` : "Pipe a non-empty UTF-8 value of at most 5120 bytes through standard input.");
48180
48312
  }
48181
48313
  if (error instanceof WorkosContractError) {
48182
48314
  if (error.code === "access_denied") {
@@ -48191,7 +48323,7 @@ var classifyFailure = (command, error, signal, actingAs) => {
48191
48323
  return failure(command, 3, "credential_store_unavailable", false, CREDENTIAL_STORE_UNAVAILABLE_ACTION);
48192
48324
  }
48193
48325
  if (error instanceof ResponseContractError) {
48194
- return failure(command, 7, "response_contract_invalid", false, responseContractAction(command));
48326
+ return failure(command, 7, "response_contract_invalid", false, responseContractAction(command, keyed));
48195
48327
  }
48196
48328
  if (error instanceof PublicResponseTooLargeError) {
48197
48329
  return failure(command, 7, "response_too_large", false, "Retry only after the remote response is repaired.");
@@ -48201,16 +48333,16 @@ var classifyFailure = (command, error, signal, actingAs) => {
48201
48333
  const problem = parseSafeProblem(error);
48202
48334
  return failure(command, 7, problem.code, problem.retryable, problem.suggestedAction, void 0, problem.retryAfterSeconds, problem.requestId, problem.docsUrl, ACCOUNT_SENSITIVE_PROBLEMS.has(problem.code) ? actingAs : void 0, problem.message);
48203
48335
  } catch {
48204
- return failure(command, 7, "response_contract_invalid", false, responseContractAction(command));
48336
+ return failure(command, 7, "response_contract_invalid", false, responseContractAction(command, keyed));
48205
48337
  }
48206
48338
  }
48207
48339
  if (looksLikeRemoteObject(error)) {
48208
- return failure(command, 7, "response_contract_invalid", false, responseContractAction(command));
48340
+ return failure(command, 7, "response_contract_invalid", false, responseContractAction(command, keyed));
48209
48341
  }
48210
48342
  if (error instanceof NetworkTransportError) {
48211
- return failure(command, 8, "network_error", true, `The request did not reach the ohmyho.st API, or its answer was cut off. If the agent runs in a sandbox without network access, run the command with network access. Otherwise ${retryAdvice(command)}.`);
48343
+ return failure(command, 8, "network_error", true, `The request did not reach the ohmyho.st API, or its answer was cut off. If the agent runs in a sandbox without network access, run the command with network access. Otherwise ${retryAdvice(command, keyed)}.`);
48212
48344
  }
48213
- return failure(command, 1, "internal_error", false, internalErrorAction(command));
48345
+ return failure(command, 1, "internal_error", false, internalErrorAction(command, keyed));
48214
48346
  };
48215
48347
  var reusedKeyProblem = (error) => {
48216
48348
  if (!looksLikeProblem(error))
@@ -48377,6 +48509,8 @@ var parsedCommandName = (command) => {
48377
48509
  return "export create";
48378
48510
  if (command.kind === "export-get")
48379
48511
  return "export get";
48512
+ if (command.kind === "export-download-link")
48513
+ return "export download-link";
48380
48514
  if (command.kind === "token-create")
48381
48515
  return "token create";
48382
48516
  if (command.kind === "token-list")
@@ -50526,6 +50660,24 @@ var getProjectExport = (parameters, options) => {
50526
50660
  ...params
50527
50661
  });
50528
50662
  };
50663
+ var createProjectExportDownloadLink = (parameters, options) => {
50664
+ const params = buildClientParams([parameters], [
50665
+ {
50666
+ args: [
50667
+ { in: "headers", key: "X-Request-Id" },
50668
+ { in: "path", key: "project_id" },
50669
+ { in: "path", key: "export_id" }
50670
+ ]
50671
+ }
50672
+ ]);
50673
+ return (options?.client ?? client).post({
50674
+ responseStyle: "data",
50675
+ security: [{ scheme: "bearer", type: "http" }],
50676
+ url: "/v1/projects/{project_id}/exports/{export_id}/download-links",
50677
+ ...options,
50678
+ ...params
50679
+ });
50680
+ };
50529
50681
  var getProjectCreditBudget = (parameters, options) => {
50530
50682
  const params = buildClientParams([parameters], [
50531
50683
  {
@@ -50844,6 +50996,7 @@ var createProjectDevAccessTicket = (parameters, options) => {
50844
50996
  {
50845
50997
  args: [
50846
50998
  { in: "headers", key: "X-Request-Id" },
50999
+ { in: "headers", key: "Idempotency-Key" },
50847
51000
  { in: "path", key: "project_id" }
50848
51001
  ]
50849
51002
  }
@@ -51570,6 +51723,7 @@ var createProjectDatabaseAccess = (parameters, options) => {
51570
51723
  {
51571
51724
  args: [
51572
51725
  { in: "headers", key: "X-Request-Id" },
51726
+ { in: "headers", key: "Idempotency-Key" },
51573
51727
  { in: "path", key: "project_id" },
51574
51728
  { key: "projectDatabaseAccessRequest", map: "body" }
51575
51729
  ]
@@ -51740,6 +51894,7 @@ var deleteProjectDatabaseWebhook = (parameters, options) => {
51740
51894
  {
51741
51895
  args: [
51742
51896
  { in: "headers", key: "X-Request-Id" },
51897
+ { in: "headers", key: "Idempotency-Key" },
51743
51898
  { in: "path", key: "project_id" },
51744
51899
  { in: "path", key: "webhook_id" },
51745
51900
  { in: "query", key: "environment" }
@@ -51778,6 +51933,7 @@ var testProjectDatabaseWebhook = (parameters, options) => {
51778
51933
  {
51779
51934
  args: [
51780
51935
  { in: "headers", key: "X-Request-Id" },
51936
+ { in: "headers", key: "Idempotency-Key" },
51781
51937
  { in: "path", key: "project_id" },
51782
51938
  { in: "path", key: "webhook_id" },
51783
51939
  { in: "query", key: "environment" }
@@ -51818,6 +51974,7 @@ var replayProjectDatabaseWebhookDelivery = (parameters, options) => {
51818
51974
  {
51819
51975
  args: [
51820
51976
  { in: "headers", key: "X-Request-Id" },
51977
+ { in: "headers", key: "Idempotency-Key" },
51821
51978
  { in: "path", key: "project_id" },
51822
51979
  { in: "path", key: "delivery_id" },
51823
51980
  { in: "query", key: "environment" }
@@ -51938,6 +52095,7 @@ var runProjectDatabaseSchedule = (parameters, options) => {
51938
52095
  {
51939
52096
  args: [
51940
52097
  { in: "headers", key: "X-Request-Id" },
52098
+ { in: "headers", key: "Idempotency-Key" },
51941
52099
  { in: "path", key: "project_id" },
51942
52100
  { in: "path", key: "name" },
51943
52101
  { in: "query", key: "environment" }
@@ -53145,6 +53303,7 @@ function checkedResponse(kind, value) {
53145
53303
  }
53146
53304
 
53147
53305
  // apps/product-cli/dist/product-api.js
53306
+ import { randomUUID as randomUUID3 } from "node:crypto";
53148
53307
  var WEBHOOK_SCOPE_MISMATCH = "Webhook response scope mismatch";
53149
53308
  var WATCH_SCOPE_MISMATCH = "Watch response scope mismatch";
53150
53309
  var TABLE_SCOPE_MISMATCH = "Table response scope mismatch";
@@ -53219,6 +53378,11 @@ var GeneratedSdkProductApi = class {
53219
53378
  assertProjectExport(result);
53220
53379
  return result;
53221
53380
  }
53381
+ async createProjectExportDownloadLink(input) {
53382
+ const result = await createProjectExportDownloadLink({ project_id: input.projectId, export_id: input.exportId }, { client: this.#client });
53383
+ assertProjectExportDownloadLink(result);
53384
+ return result;
53385
+ }
53222
53386
  async getCurrentIdentity() {
53223
53387
  return getCurrentIdentity({}, { client: this.#client });
53224
53388
  }
@@ -53450,6 +53614,7 @@ var GeneratedSdkProductApi = class {
53450
53614
  }
53451
53615
  async deleteProjectDatabaseWebhook(input) {
53452
53616
  const value = await deleteProjectDatabaseWebhook({
53617
+ "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
53453
53618
  project_id: input.projectId,
53454
53619
  environment: input.environment,
53455
53620
  webhook_id: input.webhookId
@@ -53461,6 +53626,7 @@ var GeneratedSdkProductApi = class {
53461
53626
  }
53462
53627
  async testProjectDatabaseWebhook(input) {
53463
53628
  const value = await testProjectDatabaseWebhook({
53629
+ "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
53464
53630
  project_id: input.projectId,
53465
53631
  environment: input.environment,
53466
53632
  webhook_id: input.webhookId
@@ -53483,6 +53649,7 @@ var GeneratedSdkProductApi = class {
53483
53649
  }
53484
53650
  async replayProjectDatabaseWebhookDelivery(input) {
53485
53651
  const value = await replayProjectDatabaseWebhookDelivery({
53652
+ "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
53486
53653
  project_id: input.projectId,
53487
53654
  environment: input.environment,
53488
53655
  delivery_id: input.deliveryId
@@ -53547,7 +53714,12 @@ var GeneratedSdkProductApi = class {
53547
53714
  return value;
53548
53715
  }
53549
53716
  async runProjectDatabaseSchedule(input) {
53550
- const value = await runProjectDatabaseSchedule({ project_id: input.projectId, environment: input.environment, name: input.name }, { client: this.#client });
53717
+ const value = await runProjectDatabaseSchedule({
53718
+ "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
53719
+ project_id: input.projectId,
53720
+ environment: input.environment,
53721
+ name: input.name
53722
+ }, { client: this.#client });
53551
53723
  assertDatabaseScheduleRunAccepted(value);
53552
53724
  if (value.schedule !== input.name)
53553
53725
  throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
@@ -54635,6 +54807,18 @@ var PNPM_RESOLVED_VERSION = /^([^()]+)(?:\(.*\))?$/u;
54635
54807
  var DEFAULT_EXPORT_PATTERN = /\bexport\s+default\b/u;
54636
54808
  var FETCH_HANDLER_PATTERN = /(?:[{,;}]|\basync)\s*fetch\s*(?:\(|:|,|\})/u;
54637
54809
  var SCHEDULED_HANDLER_PATTERN = /\bscheduled\s*(?:\(|:|,|\})/u;
54810
+ var SOCKET_PRIMITIVE_SPECIFIER = "cloudflare:sockets";
54811
+ var SOCKET_PRIMITIVE_PATTERN = new RegExp(`["'\`]${SOCKET_PRIMITIVE_SPECIFIER}["'\`]`, "u");
54812
+ var STRING_ESCAPE = /\\(?:x([0-9A-Fa-f]{2})|u([0-9A-Fa-f]{4})|u\{([0-9A-Fa-f]{1,6})\}|(?:\r\n|[\n\r\u2028\u2029])|([^\n\r\u2028\u2029]))/gu;
54813
+ var SIMPLE_STRING_ESCAPES = Object.freeze({
54814
+ b: "\b",
54815
+ f: "\f",
54816
+ n: "\n",
54817
+ r: "\r",
54818
+ t: " ",
54819
+ v: "\v",
54820
+ "0": "\0"
54821
+ });
54638
54822
  var DATABASE_CONTRACT_PATTERNS = Object.freeze([
54639
54823
  [
54640
54824
  /\bHYPERDRIVE\b|\bconnectionString\b|\bDATABASE_URL\b|postgres(?:ql)?:\/\//u,
@@ -54818,6 +55002,19 @@ function databaseContractCodes(source) {
54818
55002
  const code = sourceWithoutComments(source);
54819
55003
  return Object.freeze(DATABASE_CONTRACT_PATTERNS.filter(([pattern]) => pattern.test(code)).map(([, found]) => found));
54820
55004
  }
55005
+ function importsSocketPrimitive(source) {
55006
+ return SOCKET_PRIMITIVE_PATTERN.test(decodeStringEscapes(source));
55007
+ }
55008
+ function decodeStringEscapes(source) {
55009
+ return source.replace(STRING_ESCAPE, (match, hex, unit, braces, plain) => {
55010
+ const code = hex ?? unit ?? braces;
55011
+ if (code !== void 0) {
55012
+ const point = Number.parseInt(code, 16);
55013
+ return point > 1114111 ? match : String.fromCodePoint(point);
55014
+ }
55015
+ return plain === void 0 ? "" : SIMPLE_STRING_ESCAPES[plain] ?? plain;
55016
+ });
55017
+ }
54821
55018
  function workerModuleFindings(worker) {
54822
55019
  const { path: path2 } = worker;
54823
55020
  const code = sourceWithoutComments(worker.source);
@@ -54876,6 +55073,9 @@ function sourceWithoutComments(source) {
54876
55073
  function isDatabaseContractModule(path2) {
54877
55074
  return /\.(?:astro|ts|tsx|js|jsx|mjs|mts)$/u.test(path2) && !/\.d\.[cm]?ts$/u.test(path2);
54878
55075
  }
55076
+ function isSocketPrimitiveModule(path2) {
55077
+ return /\.(?:astro|[cm]?[jt]sx?)$/u.test(path2) && !/\.d\.[cm]?ts$/u.test(path2);
55078
+ }
54879
55079
  function manifestFindings(input, versions) {
54880
55080
  const { configuration, framework, manifest: manifest2 } = input;
54881
55081
  const findings = [];
@@ -55294,8 +55494,9 @@ function astroConfigFindings(text, path2, mode) {
55294
55494
  var DatabaseMigrationAdmissionError = class extends Error {
55295
55495
  reason;
55296
55496
  code = "database_migration_not_admitted";
55297
- constructor(reason) {
55298
- super("Database migration is not admitted");
55497
+ /** `detail` names the exact requirement for a refusal whose cause the customer can change; the code and reason do not change. */
55498
+ constructor(reason, detail) {
55499
+ super(detail === void 0 ? "Database migration is not admitted" : `Database migration is not admitted: ${detail}`);
55299
55500
  this.reason = reason;
55300
55501
  this.name = "DatabaseMigrationAdmissionError";
55301
55502
  }
@@ -55768,14 +55969,37 @@ function rejectFunctionBodyReferences(sql) {
55768
55969
  throw new DatabaseMigrationAdmissionError("provider_specific");
55769
55970
  }
55770
55971
  }
55972
+ function pinsSearchPath(tokens) {
55973
+ let found = false;
55974
+ for (let index = 0; index + 2 < tokens.length; index += 1) {
55975
+ if (!isSqlKeyword(tokens[index], "set") || !isSqlKeyword(tokens[index + 1], "search_path"))
55976
+ continue;
55977
+ const operator = tokens[index + 2];
55978
+ const assigns = isSqlKeyword(operator, "to") || operator?.kind === "symbol" && operator.value === "=";
55979
+ const first = tokens[index + 3];
55980
+ if (!assigns || !first)
55981
+ return false;
55982
+ found = true;
55983
+ if (first.kind === "string") {
55984
+ const list = first.value.trim().toLowerCase();
55985
+ if (list !== "" && !/^pg_catalog(?:\s*,|$)/u.test(list))
55986
+ return false;
55987
+ } else if (first.kind === "word" || first.kind === "identifier") {
55988
+ if (first.value.toLowerCase() !== "pg_catalog")
55989
+ return false;
55990
+ } else
55991
+ return false;
55992
+ }
55993
+ return found;
55994
+ }
55771
55995
  function admitStatement(tokens, sql) {
55772
55996
  const normalized = tokens.map((token) => token.kind === "string" ? "'literal'" : token.text.toLowerCase()).join(" ").replace(/\s*\.\s*/gu, ".");
55773
55997
  if (normalized === "set check_function_bodies = false")
55774
55998
  return;
55775
55999
  if (/^create\s+function\b/u.test(normalized)) {
55776
56000
  rejectFunctionBodyReferences(sql);
55777
- if (!/\blanguage\s+(?:sql|plpgsql)\b/u.test(normalized) || /\bsecurity\s+definer\b/u.test(normalized) && !/\bset\s+search_path\s*(?:=\s*|to\s+)/u.test(normalized)) {
55778
- throw new DatabaseMigrationAdmissionError("unsupported");
56001
+ if (!/\blanguage\s+(?:sql|plpgsql)\b/u.test(normalized) || /\bsecurity\s+definer\b/u.test(normalized) && !pinsSearchPath(tokens)) {
56002
+ throw new DatabaseMigrationAdmissionError("unsupported", "a SECURITY DEFINER function needs every SET search_path to be '' or to start with pg_catalog");
55779
56003
  }
55780
56004
  return;
55781
56005
  }
@@ -55820,7 +56044,8 @@ var GATEWAY_BINDING_NAME = /^OHMYHOST_(?:MAIL|STORAGE)_GATEWAY$/u;
55820
56044
  var GATEWAY_WORD_TOKEN = /[\p{ID_Start}_$][\p{ID_Continue}$]*/uy;
55821
56045
  var UNNAMED_MODULE_MESSAGES = Object.freeze({
55822
56046
  database_binding_private: 'The module at path reads a database connection string (DATABASE_URL, HYPERDRIVE, connectionString or a postgres:// URL); none reaches a customer Worker. Call the database with createPrivateDatabaseClient from "@ohmyhost/customer-runtime/database". Commit and push the change, then plan the new commit.',
55823
- database_driver_unsupported: 'The module at path imports a database socket driver (pg, postgres, pg-native or mysql2); customer Workers cannot open sockets. Call the database with createPrivateDatabaseClient from "@ohmyhost/customer-runtime/database". Commit and push the change, then plan the new commit.'
56047
+ database_driver_unsupported: 'The module at path imports a database socket driver (pg, postgres, pg-native or mysql2); customer Workers cannot open sockets. Call the database with createPrivateDatabaseClient from "@ohmyhost/customer-runtime/database". Commit and push the change, then plan the new commit.',
56048
+ socket_primitive_unsupported: "The module at path loads cloudflare:sockets; customer Workers cannot open sockets. Call HTTPS services through the global fetch function and declare each origin in runtime.egress.allow in ohmyhost.yaml. Commit and push the change, then plan the new commit."
55824
56049
  });
55825
56050
  function callsStorageClient(source) {
55826
56051
  return STORAGE_CLIENT_CALL_PATTERN.test(sourceWithoutComments(source));
@@ -56017,6 +56242,7 @@ async function judgeSource(context) {
56017
56242
  ...source.findings.map((finding) => requiredCatalogBlocker(finding, context.applicationRoot)),
56018
56243
  ...await workerModuleBlockers(context),
56019
56244
  ...await databaseContractBlockers(context, context.provider),
56245
+ ...await socketPrimitiveBlockers(context),
56020
56246
  ...await gatewayBindingBlockers(context),
56021
56247
  ...await storageClientBlockers(context),
56022
56248
  ...await migrationSqlBlockers(context, context.provider)
@@ -56240,11 +56466,28 @@ async function databaseContractBlockers(context, provider) {
56240
56466
  if (!information.isFile() || information.size > MAXIMUM_SOURCE_BYTES)
56241
56467
  continue;
56242
56468
  for (const code of databaseContractCodes(await readFile3(absolute, "utf8")))
56243
- blockers.push(catalogBlocker({ code, path: path2 }, context.applicationRoot) ?? Object.freeze({
56244
- code,
56245
- path: repositoryPath(context.applicationRoot, path2),
56246
- message: UNNAMED_MODULE_MESSAGES[code]
56247
- }));
56469
+ blockers.push(moduleBlocker(code, path2, context.applicationRoot));
56470
+ }
56471
+ return blockers;
56472
+ }
56473
+ function moduleBlocker(code, path2, applicationRoot) {
56474
+ return catalogBlocker({ code, path: path2 }, applicationRoot) ?? Object.freeze({
56475
+ code,
56476
+ path: repositoryPath(applicationRoot, path2),
56477
+ message: UNNAMED_MODULE_MESSAGES[code]
56478
+ });
56479
+ }
56480
+ async function socketPrimitiveBlockers(context) {
56481
+ const blockers = [];
56482
+ for (const path2 of context.files) {
56483
+ if (!isSocketPrimitiveModule(path2))
56484
+ continue;
56485
+ const absolute = resolve5(context.applicationDirectory, path2);
56486
+ const information = await stat2(absolute);
56487
+ if (!information.isFile() || information.size > MAXIMUM_SOURCE_BYTES)
56488
+ continue;
56489
+ if (importsSocketPrimitive(await readFile3(absolute, "utf8")))
56490
+ blockers.push(moduleBlocker("socket_primitive_unsupported", path2, context.applicationRoot));
56248
56491
  }
56249
56492
  return blockers;
56250
56493
  }
@@ -56796,7 +57039,7 @@ function isNodeError(value) {
56796
57039
  }
56797
57040
 
56798
57041
  // apps/product-cli/dist/composition.js
56799
- import { randomUUID as randomUUID3 } from "node:crypto";
57042
+ import { randomUUID as randomUUID4 } from "node:crypto";
56800
57043
  import { join as join6, resolve as resolve6 } from "node:path";
56801
57044
 
56802
57045
  // packages/workos-auth-contracts/dist/device-flow.js
@@ -57633,7 +57876,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
57633
57876
  const result = error instanceof InvalidCommandError ? invalidCommandFailure(args, environment) : errorDocument(recognizedCommandLabel(args), 1, "internal_error", false, internalErrorAction(recognizedCommandLabel(args)));
57634
57877
  if (!(error instanceof InvalidCommandError)) {
57635
57878
  diagnostics.record({
57636
- correlationId: randomUUID3(),
57879
+ correlationId: randomUUID4(),
57637
57880
  category: "internal",
57638
57881
  subsystem: "parser",
57639
57882
  errorKind: "unexpected"
@@ -57775,7 +58018,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
57775
58018
  const result = compositionFailure(recognizedCommandLabel(args), error, signal, platform.commandPrefix, profile);
57776
58019
  if (result.exitCode === 1)
57777
58020
  diagnostics.record({
57778
- correlationId: randomUUID3(),
58021
+ correlationId: randomUUID4(),
57779
58022
  category: "internal",
57780
58023
  subsystem: "authentication",
57781
58024
  errorKind: "unexpected"
@@ -57843,7 +58086,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
57843
58086
  now,
57844
58087
  waitUntil,
57845
58088
  lifecycleTimeoutMs: REQUEST_TIMEOUT_MS,
57846
- createCorrelationId: randomUUID3,
58089
+ createCorrelationId: randomUUID4,
57847
58090
  diagnosticSink: diagnostics,
57848
58091
  operationEventSink: { write: (value) => io.writeStdout(value) },
57849
58092
  readSecretValue: overrides.readSecretValue ?? ((readSignal) => readSecretValueFromStandardInput(process.stdin, readSignal)),
@@ -57931,7 +58174,7 @@ var runOfflineInit = async (command, io, diagnostics) => {
57931
58174
  } catch (error) {
57932
58175
  const known = error instanceof RepositoryInitError;
57933
58176
  diagnostics.record({
57934
- correlationId: randomUUID3(),
58177
+ correlationId: randomUUID4(),
57935
58178
  category: known ? "configuration" : "internal",
57936
58179
  subsystem: "runtime",
57937
58180
  errorKind: known ? "invalid_response" : "unexpected"
@@ -58079,7 +58322,7 @@ var GeneratedSdkSessionRevoker = class {
58079
58322
  fetch: transport.fetch,
58080
58323
  throwOnError: true
58081
58324
  });
58082
- const result = await revokeCurrentSession({ "Idempotency-Key": randomUUID3() }, { client: client2, signal });
58325
+ const result = await revokeCurrentSession({ "Idempotency-Key": randomUUID4() }, { client: client2, signal });
58083
58326
  if (result.revoked !== true)
58084
58327
  throw new LifecycleTransportError();
58085
58328
  } catch (error) {
@@ -58258,7 +58501,7 @@ var runOfflineLogout = async (registry, request, commandPrefix, io, diagnostics)
58258
58501
  }
58259
58502
  } catch {
58260
58503
  diagnostics.record({
58261
- correlationId: randomUUID3(),
58504
+ correlationId: randomUUID4(),
58262
58505
  category: "credential_store",
58263
58506
  subsystem: "credential_store",
58264
58507
  errorKind: "unavailable"