@amerged/ohmyhost-cli 0.1.71 → 0.1.73

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.
@@ -38966,6 +38966,10 @@ var failures = {
38966
38966
  "The runtime refused to load the built Worker.",
38967
38967
  "The built Worker could not be loaded: top-level code throws or calls fetch, timers or random values outside a handler, an import cannot be resolved, a Worker module such as src/ohmyhost/companion.ts has no default export, or the bundle is too large. Fix that, save or push the corrected version and plan its commit; replaying this operation cannot pass. If none of this applies, report the operation ID through feedback."
38968
38968
  ],
38969
+ native_auth_launch_unavailable: [
38970
+ "Native Auth rollout access is unavailable for this project.",
38971
+ "Ask ohmyho.st support to check Native Auth rollout access for this workspace and project. Once access is enabled, plan the saved commit again. Then check the project\u2019s Paid access, verified sender and approved application origin."
38972
+ ],
38969
38973
  storage_jurisdiction_conflict: [
38970
38974
  "storage.jurisdiction must match the project's recorded storage jurisdiction.",
38971
38975
  "Read 'Storage jurisdiction' in 'ohmyhost project context --project ULID --json' and set storage.jurisdiction in ohmyhost.yaml to that recorded value (us or eu). Existing R2 buckets and reservations keep their jurisdiction after a project-region migration; only new storage without a recorded bucket uses the project region. If context reports unavailable, report the request ID through feedback rather than guessing. Save or push the corrected version and plan its commit; for promotion, deploy it to Dev and promote again. Do not delete or recreate the project to move files."
@@ -40778,7 +40782,7 @@ var PROBLEM_POLICY = {
40778
40782
  status: 409,
40779
40783
  retryable: false,
40780
40784
  title: "Native Auth cannot launch yet",
40781
- 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."
40785
+ action: "Ask ohmyho.st support to check Native Auth rollout access for this workspace and project. Once access is enabled, read the Native Auth configuration for the target environment to check Paid access, the verified sender, the approved application origin and storage. Retry after the missing requirement is satisfied."
40782
40786
  },
40783
40787
  native_auth_provider_unavailable: {
40784
40788
  status: 409,
@@ -42791,6 +42795,128 @@ function isUserSecretName(value, action = "set") {
42791
42795
  return action === "delete" ? !INSTALLED_PLATFORM_KEYS.has(value) : !value.startsWith("OHMYHOST_") && !FIXED_PLATFORM_NAMES.has(value);
42792
42796
  }
42793
42797
 
42798
+ // packages/contracts/dist/connection-management.js
42799
+ var ulid4 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
42800
+ var requestId = /^[a-f0-9]{64}$/u;
42801
+ var appName = /^[A-Za-z0-9_-]{1,128}$/u;
42802
+ var moduleId = /^[A-Za-z0-9_.:-]{1,128}$/u;
42803
+ var makeOrigins = /* @__PURE__ */ new Set([
42804
+ "https://eu1.make.com",
42805
+ "https://eu2.make.com",
42806
+ "https://us1.make.com",
42807
+ "https://us2.make.com",
42808
+ "https://we.make.com",
42809
+ "https://eu1.make.celonis.com",
42810
+ "https://us1.make.celonis.com"
42811
+ ]);
42812
+ function selectors(raw, format) {
42813
+ return Array.isArray(raw) && raw.length >= 1 && raw.length <= 64 && raw.every((value) => typeof value === "string" && format.test(value) && value.replaceAll(/[-_.:]/gu, "").toLowerCase() !== "arbitrarycall") && new Set(raw).size === raw.length;
42814
+ }
42815
+ function parseMakeCredentialSelections(raw) {
42816
+ if (!Array.isArray(raw) || raw.length < 1 || raw.length > 64)
42817
+ throw new TypeError("Invalid Make credential selections");
42818
+ for (const entry of raw) {
42819
+ if (!entry || typeof entry !== "object" || Array.isArray(entry))
42820
+ throw new TypeError("Invalid Make credential selection");
42821
+ const value = entry;
42822
+ if (Object.keys(value).some((key) => !["app_name", "app_version", "module_ids", "endpoint_names"].includes(key)) || typeof value["app_name"] !== "string" || !appName.test(value["app_name"]) || !Number.isSafeInteger(value["app_version"]) || Number(value["app_version"]) < 1 || !(Object.hasOwn(value, "module_ids") || Object.hasOwn(value, "endpoint_names")) || Object.hasOwn(value, "module_ids") && !selectors(value["module_ids"], moduleId) || Object.hasOwn(value, "endpoint_names") && !selectors(value["endpoint_names"], appName))
42823
+ throw new TypeError("Invalid Make credential selection");
42824
+ }
42825
+ return raw;
42826
+ }
42827
+ function parseMakeCredentialResult(raw, create) {
42828
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
42829
+ throw new TypeError("Invalid connection response");
42830
+ const value = raw;
42831
+ const state = value["state"];
42832
+ if (Object.keys(value).some((key) => !["state", "request_id", "provider_status", "authorization_url", "expires_at"].includes(key)) || !["created", "running", "uncertain", "reconnect_required"].includes(String(state)) || (state === "created" || value["request_id"] !== void 0) && (typeof value["request_id"] !== "string" || !requestId.test(value["request_id"])) || (state === "created" ? typeof value["provider_status"] !== "string" || !/^[a-z_]{1,64}$/u.test(value["provider_status"]) : value["provider_status"] !== void 0 || value["expires_at"] !== void 0))
42833
+ throw new TypeError("Invalid connection response");
42834
+ if (value["expires_at"] !== null && value["expires_at"] !== void 0)
42835
+ date2(value["expires_at"]);
42836
+ if (value["authorization_url"] === void 0)
42837
+ return;
42838
+ if (!create || state !== "created" || typeof value["authorization_url"] !== "string")
42839
+ throw new TypeError("Invalid connection response");
42840
+ const url = new URL(value["authorization_url"]);
42841
+ if (!makeOrigins.has(url.origin) || url.username || url.password || url.hash || !/^\/[1-9][0-9]*\/credentials-requests\/inbox$/u.test(url.pathname) || url.searchParams.size !== 1 || !/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/u.test(url.searchParams.get("requestId") ?? ""))
42842
+ throw new TypeError("Invalid connection response");
42843
+ }
42844
+ function record2(raw, keys) {
42845
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
42846
+ throw new TypeError("Invalid connection response");
42847
+ const value = raw;
42848
+ if (Object.keys(value).length !== keys.length || keys.some((key) => !Object.hasOwn(value, key)))
42849
+ throw new TypeError("Invalid connection response");
42850
+ return value;
42851
+ }
42852
+ function date2(raw) {
42853
+ if (typeof raw !== "string" || !Number.isFinite(Date.parse(raw)))
42854
+ throw new TypeError("Invalid connection response");
42855
+ }
42856
+ function items(raw) {
42857
+ if (!Array.isArray(raw) || raw.length > 1e4)
42858
+ throw new TypeError("Invalid connection response");
42859
+ for (const row of raw) {
42860
+ const v = record2(row, ["id", "name"]);
42861
+ if (!Number.isSafeInteger(v["id"]) || Number(v["id"]) < 1 || typeof v["name"] !== "string" || !v["name"] || v["name"].length > 1024)
42862
+ throw new TypeError("Invalid connection response");
42863
+ }
42864
+ }
42865
+ function parseConnectionResponse(kind, raw, expectedOrigin) {
42866
+ if (kind === "connection-credential-request-create" || kind === "connection-credential-request-status") {
42867
+ parseMakeCredentialResult(raw, kind === "connection-credential-request-create");
42868
+ } else if (kind === "connection-begin") {
42869
+ const v = record2(raw, ["request_id", "url", "expires_at"]);
42870
+ date2(v["expires_at"]);
42871
+ if (typeof v["request_id"] !== "string" || !/^[a-f0-9]{64}$/u.test(v["request_id"]) || typeof v["url"] !== "string")
42872
+ throw new TypeError("Invalid connection response");
42873
+ const url = new URL(v["url"]);
42874
+ if (!["https://app.ohmyho.st", "https://dev.app.ohmyho.st"].includes(url.origin) || expectedOrigin !== void 0 && url.origin !== expectedOrigin || url.pathname !== "/connections/authorize" || url.hash || url.searchParams.size !== 1 || !/^[A-Za-z0-9_-]{43}$/u.test(url.searchParams.get("request") ?? ""))
42875
+ throw new TypeError("Invalid connection response");
42876
+ } else if (kind === "connection-status") {
42877
+ const v = record2(raw, ["state", "expires_at"]);
42878
+ date2(v["expires_at"]);
42879
+ if (!["pending", "consumed", "expired"].includes(String(v["state"])))
42880
+ throw new TypeError("Invalid connection response");
42881
+ } else if (kind === "connection-disconnect") {
42882
+ const v = record2(raw, ["state"]);
42883
+ if (!["disconnected", "revocation_pending"].includes(String(v["state"])))
42884
+ throw new TypeError("Invalid connection response");
42885
+ } else if (kind === "connection-import") {
42886
+ const v = record2(raw, [
42887
+ "id",
42888
+ "grant_id",
42889
+ "project_id",
42890
+ "environment_id",
42891
+ "provider_organization_id",
42892
+ "team_id",
42893
+ "connection_id"
42894
+ ]);
42895
+ for (const key of ["id", "grant_id", "project_id", "environment_id"])
42896
+ if (typeof v[key] !== "string" || !ulid4.test(v[key]))
42897
+ throw new TypeError("Invalid connection response");
42898
+ for (const key of ["provider_organization_id", "team_id", "connection_id"])
42899
+ if (!Number.isSafeInteger(v[key]) || Number(v[key]) < 1)
42900
+ throw new TypeError("Invalid connection response");
42901
+ } else if (kind === "connection-discover") {
42902
+ const v = record2(raw, ["organizations", "teams", "connections"]);
42903
+ items(v["organizations"]);
42904
+ items(v["teams"]);
42905
+ items(v["connections"]);
42906
+ } else {
42907
+ const v = record2(raw, ["connections"]);
42908
+ if (!Array.isArray(v["connections"]) || v["connections"].length > 1e4)
42909
+ throw new TypeError("Invalid connection response");
42910
+ for (const row of v["connections"]) {
42911
+ const grant = record2(row, ["id", "provider", "state", "created_at"]);
42912
+ date2(grant["created_at"]);
42913
+ if (typeof grant["id"] !== "string" || !ulid4.test(grant["id"]) || grant["provider"] !== "make" || !["active", "refreshing", "reconnect_required", "disconnecting", "disconnected"].includes(String(grant["state"])))
42914
+ throw new TypeError("Invalid connection response");
42915
+ }
42916
+ }
42917
+ return raw;
42918
+ }
42919
+
42794
42920
  // packages/contracts/dist/database-events.js
42795
42921
  var DATABASE_WEBHOOK_EVENT_TYPES = [
42796
42922
  "database.created",
@@ -42915,7 +43041,7 @@ function dataEventTopic(tableName) {
42915
43041
  return topic.slice(0, 48);
42916
43042
  }
42917
43043
  function parseDatabaseWatchCreateRequest(value) {
42918
- if (!record2(value) || !onlyKeys(value, ["schema", "table", "columns", "operations"]) || !isDatabaseWatchIdentifier(value["table"]) || !Array.isArray(value["columns"]) || value["columns"].length < 1 || value["columns"].length > DATABASE_WATCH_MAX_COLUMNS || !value["columns"].every(isDatabaseWatchIdentifier) || new Set(value["columns"]).size !== value["columns"].length)
43044
+ if (!record3(value) || !onlyKeys(value, ["schema", "table", "columns", "operations"]) || !isDatabaseWatchIdentifier(value["table"]) || !Array.isArray(value["columns"]) || value["columns"].length < 1 || value["columns"].length > DATABASE_WATCH_MAX_COLUMNS || !value["columns"].every(isDatabaseWatchIdentifier) || new Set(value["columns"]).size !== value["columns"].length)
42919
43045
  throw new TypeError("Invalid database watch request");
42920
43046
  return {
42921
43047
  ...parseDatabaseWatchTarget({ schema: value["schema"], table: value["table"] }),
@@ -42924,7 +43050,7 @@ function parseDatabaseWatchCreateRequest(value) {
42924
43050
  };
42925
43051
  }
42926
43052
  function parseDatabaseWatchTarget(value) {
42927
- if (!record2(value) || !onlyKeys(value, ["schema", "table"]) || !isDatabaseWatchIdentifier(value["table"]))
43053
+ if (!record3(value) || !onlyKeys(value, ["schema", "table"]) || !isDatabaseWatchIdentifier(value["table"]))
42928
43054
  throw new TypeError("Invalid database watch target");
42929
43055
  const schema = value["schema"] === void 0 ? DATABASE_WATCH_DEFAULT_SCHEMA : value["schema"];
42930
43056
  if (!isDatabaseWatchSchema(schema))
@@ -42960,7 +43086,7 @@ function parseDatabaseUsageWindow(from, to, granularity) {
42960
43086
  return { from, to, granularity };
42961
43087
  }
42962
43088
  function parseDatabaseWebhookCreateRequest(value) {
42963
- if (!record2(value) || !onlyKeys(value, ["url", "event_types", "headers"]))
43089
+ if (!record3(value) || !onlyKeys(value, ["url", "event_types", "headers"]))
42964
43090
  throw new TypeError("Invalid database webhook request");
42965
43091
  return {
42966
43092
  url: parseHttpsUrl(value["url"]),
@@ -42969,7 +43095,7 @@ function parseDatabaseWebhookCreateRequest(value) {
42969
43095
  };
42970
43096
  }
42971
43097
  function parseDatabaseScheduleSetRequest(value) {
42972
- if (!record2(value) || !onlyKeys(value, ["cron", "every_seconds", "statements", "timeout_ms", "enabled", "confirm"]) || value["confirm"] !== true || value["cron"] === void 0 === (value["every_seconds"] === void 0))
43098
+ if (!record3(value) || !onlyKeys(value, ["cron", "every_seconds", "statements", "timeout_ms", "enabled", "confirm"]) || value["confirm"] !== true || value["cron"] === void 0 === (value["every_seconds"] === void 0))
42973
43099
  throw new TypeError("Invalid database schedule request");
42974
43100
  const enabled = value["enabled"] === void 0 ? true : value["enabled"];
42975
43101
  if (typeof enabled !== "boolean")
@@ -42983,7 +43109,7 @@ function parseDatabaseScheduleSetRequest(value) {
42983
43109
  };
42984
43110
  }
42985
43111
  function assertDatabaseWebhook(value) {
42986
- if (!record2(value) || !exact2(value, WEBHOOK_KEYS))
43112
+ if (!record3(value) || !exact2(value, WEBHOOK_KEYS))
42987
43113
  throw new TypeError("Invalid database webhook");
42988
43114
  assertWebhookFields(value);
42989
43115
  }
@@ -42993,48 +43119,48 @@ function assertSubscriptionFields(value) {
42993
43119
  throw new TypeError("Invalid database webhook subscription");
42994
43120
  }
42995
43121
  function assertDatabaseWebhookSubscription(value) {
42996
- if (!record2(value) || !exact2(value, SUBSCRIPTION_KEYS))
43122
+ if (!record3(value) || !exact2(value, SUBSCRIPTION_KEYS))
42997
43123
  throw new TypeError("Invalid database webhook subscription");
42998
43124
  assertSubscriptionFields(value);
42999
43125
  }
43000
43126
  function assertDatabaseWebhookSubscriptionActivation(value) {
43001
- if (!record2(value) || !exact2(value, [...SUBSCRIPTION_KEYS, "secret"]))
43127
+ if (!record3(value) || !exact2(value, [...SUBSCRIPTION_KEYS, "secret"]))
43002
43128
  throw new TypeError("Invalid database webhook subscription activation");
43003
43129
  assertSubscriptionFields(value);
43004
43130
  if (value["state"] !== "active" || value["provider_id"] === null || typeof value["secret"] !== "string" || !/^[\x21-\x7e]{16,512}$/u.test(value["secret"]))
43005
43131
  throw new TypeError("Invalid database webhook subscription activation");
43006
43132
  }
43007
43133
  function assertDatabaseWatch(value) {
43008
- if (!record2(value) || !exact2(value, DATABASE_WATCH_KEYS) || !matches(value["id"], DATABASE_WATCH_ID_PATTERN) || !oneOf(["dev", "prod"], value["environment"]) || !isDatabaseWatchSchema(value["schema"]) || !isDatabaseWatchIdentifier(value["table"]) || !Array.isArray(value["columns"]) || value["columns"].length < 1 || value["columns"].length > DATABASE_WATCH_MAX_COLUMNS || !value["columns"].every(isDatabaseWatchIdentifier) || !isCanonicalOperations(value["operations"]) || value["topic"] !== dataEventTopic(value["table"]) || value["event_type"] !== `data.${value["topic"]}`)
43134
+ if (!record3(value) || !exact2(value, DATABASE_WATCH_KEYS) || !matches(value["id"], DATABASE_WATCH_ID_PATTERN) || !oneOf(["dev", "prod"], value["environment"]) || !isDatabaseWatchSchema(value["schema"]) || !isDatabaseWatchIdentifier(value["table"]) || !Array.isArray(value["columns"]) || value["columns"].length < 1 || value["columns"].length > DATABASE_WATCH_MAX_COLUMNS || !value["columns"].every(isDatabaseWatchIdentifier) || !isCanonicalOperations(value["operations"]) || value["topic"] !== dataEventTopic(value["table"]) || value["event_type"] !== `data.${value["topic"]}`)
43009
43135
  throw new TypeError("Invalid database watch");
43010
43136
  }
43011
43137
  function assertDatabaseWatchPage(value) {
43012
- if (!record2(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
43138
+ if (!record3(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
43013
43139
  throw new TypeError("Invalid database watch page");
43014
43140
  for (const item of value["items"])
43015
43141
  assertDatabaseWatch(item);
43016
43142
  }
43017
43143
  function assertDatabaseWatchDeleted(value) {
43018
- if (!record2(value) || !exact2(value, ["id", "deleted"]) || !matches(value["id"], DATABASE_WATCH_ID_PATTERN) || value["deleted"] !== true)
43144
+ if (!record3(value) || !exact2(value, ["id", "deleted"]) || !matches(value["id"], DATABASE_WATCH_ID_PATTERN) || value["deleted"] !== true)
43019
43145
  throw new TypeError("Invalid database watch deletion");
43020
43146
  }
43021
43147
  function assertDatabaseWebhookCreated(value) {
43022
- if (!record2(value) || !exact2(value, [...WEBHOOK_KEYS, "secret"]) || typeof value["secret"] !== "string" || value["secret"].length === 0)
43148
+ if (!record3(value) || !exact2(value, [...WEBHOOK_KEYS, "secret"]) || typeof value["secret"] !== "string" || value["secret"].length === 0)
43023
43149
  throw new TypeError("Invalid database webhook");
43024
43150
  assertWebhookFields(value);
43025
43151
  }
43026
43152
  function assertDatabaseWebhookPage(value) {
43027
- if (!record2(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
43153
+ if (!record3(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
43028
43154
  throw new TypeError("Invalid database webhook page");
43029
43155
  for (const item of value["items"])
43030
43156
  assertDatabaseWebhook(item);
43031
43157
  }
43032
43158
  function assertDatabaseWebhookDeleted(value) {
43033
- if (!record2(value) || !exact2(value, ["id", "deleted"]) || !matches(value["id"], WEBHOOK_ID_PATTERN) || value["deleted"] !== true)
43159
+ if (!record3(value) || !exact2(value, ["id", "deleted"]) || !matches(value["id"], WEBHOOK_ID_PATTERN) || value["deleted"] !== true)
43034
43160
  throw new TypeError("Invalid database webhook deletion");
43035
43161
  }
43036
43162
  function assertDatabaseWebhookDelivery(value) {
43037
- if (!record2(value) || !exact2(value, [
43163
+ if (!record3(value) || !exact2(value, [
43038
43164
  "id",
43039
43165
  "event_id",
43040
43166
  "event_type",
@@ -43050,7 +43176,7 @@ function assertDatabaseWebhookDelivery(value) {
43050
43176
  throw new TypeError("Invalid database webhook delivery");
43051
43177
  }
43052
43178
  function assertDatabaseWebhookDeliveryPage(value) {
43053
- if (!record2(value) || !exact2(value, ["items", "next_cursor"]) || !pageItems(value["items"]))
43179
+ if (!record3(value) || !exact2(value, ["items", "next_cursor"]) || !pageItems(value["items"]))
43054
43180
  throw new TypeError("Invalid database webhook delivery page");
43055
43181
  for (const item of value["items"])
43056
43182
  assertDatabaseWebhookDelivery(item);
@@ -43058,15 +43184,15 @@ function assertDatabaseWebhookDeliveryPage(value) {
43058
43184
  throw new TypeError("Invalid database webhook delivery page");
43059
43185
  }
43060
43186
  function assertDatabaseWebhookTest(value) {
43061
- if (!record2(value) || !exact2(value, ["delivered", "status", "error", "duration_ms"]) || typeof value["delivered"] !== "boolean" || !nullable(value["status"], Number.isSafeInteger) || !nullable(value["error"], (error) => oneOf(["timeout", "network", "http"], error)) || !nonNegativeInteger(value["duration_ms"]))
43187
+ if (!record3(value) || !exact2(value, ["delivered", "status", "error", "duration_ms"]) || typeof value["delivered"] !== "boolean" || !nullable(value["status"], Number.isSafeInteger) || !nullable(value["error"], (error) => oneOf(["timeout", "network", "http"], error)) || !nonNegativeInteger(value["duration_ms"]))
43062
43188
  throw new TypeError("Invalid database webhook test result");
43063
43189
  }
43064
43190
  function assertDatabaseWebhookReplayAccepted(value) {
43065
- if (!record2(value) || !exact2(value, ["delivery_id", "state"]) || !matches(value["delivery_id"], DELIVERY_ID_PATTERN) || value["state"] !== "pending")
43191
+ if (!record3(value) || !exact2(value, ["delivery_id", "state"]) || !matches(value["delivery_id"], DELIVERY_ID_PATTERN) || value["state"] !== "pending")
43066
43192
  throw new TypeError("Invalid database webhook replay");
43067
43193
  }
43068
43194
  function assertDatabaseSchedule(value) {
43069
- if (!record2(value) || !exact2(value, [
43195
+ if (!record3(value) || !exact2(value, [
43070
43196
  "name",
43071
43197
  "environment",
43072
43198
  "cron",
@@ -43080,27 +43206,27 @@ function assertDatabaseSchedule(value) {
43080
43206
  throw new TypeError("Invalid database schedule");
43081
43207
  }
43082
43208
  function assertDatabaseSchedulePage(value) {
43083
- if (!record2(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
43209
+ if (!record3(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
43084
43210
  throw new TypeError("Invalid database schedule page");
43085
43211
  for (const item of value["items"])
43086
43212
  assertDatabaseSchedule(item);
43087
43213
  }
43088
43214
  function assertDatabaseScheduleDeleted(value) {
43089
- if (!record2(value) || !exact2(value, ["name", "deleted"]) || !matches(value["name"], SCHEDULE_NAME_PATTERN) || value["deleted"] !== true)
43215
+ if (!record3(value) || !exact2(value, ["name", "deleted"]) || !matches(value["name"], SCHEDULE_NAME_PATTERN) || value["deleted"] !== true)
43090
43216
  throw new TypeError("Invalid database schedule deletion");
43091
43217
  }
43092
43218
  function assertDatabaseScheduleRunPage(value) {
43093
- if (!record2(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
43219
+ if (!record3(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
43094
43220
  throw new TypeError("Invalid database schedule run page");
43095
43221
  for (const item of value["items"])
43096
43222
  assertDatabaseScheduleRun(item);
43097
43223
  }
43098
43224
  function assertDatabaseScheduleRunAccepted(value) {
43099
- if (!record2(value) || !exact2(value, ["schedule", "state"]) || !matches(value["schedule"], SCHEDULE_NAME_PATTERN) || value["state"] !== "queued")
43225
+ if (!record3(value) || !exact2(value, ["schedule", "state"]) || !matches(value["schedule"], SCHEDULE_NAME_PATTERN) || value["state"] !== "queued")
43100
43226
  throw new TypeError("Invalid database schedule run");
43101
43227
  }
43102
43228
  function assertDatabaseExecutionUsagePage(value) {
43103
- if (!record2(value) || !exact2(value, ["items", "next_cursor"]) || !pageItems(value["items"]))
43229
+ if (!record3(value) || !exact2(value, ["items", "next_cursor"]) || !pageItems(value["items"]))
43104
43230
  throw new TypeError("Invalid database execution usage page");
43105
43231
  for (const row of value["items"])
43106
43232
  assertUsageRow(row);
@@ -43108,7 +43234,7 @@ function assertDatabaseExecutionUsagePage(value) {
43108
43234
  throw new TypeError("Invalid database execution usage page");
43109
43235
  }
43110
43236
  function assertDatabaseScheduleRun(value) {
43111
- if (!record2(value) || !exact2(value, [
43237
+ if (!record3(value) || !exact2(value, [
43112
43238
  "id",
43113
43239
  "schedule",
43114
43240
  "scheduled_at",
@@ -43122,7 +43248,7 @@ function assertDatabaseScheduleRun(value) {
43122
43248
  throw new TypeError("Invalid database schedule run");
43123
43249
  }
43124
43250
  function assertUsageRow(value) {
43125
- if (!record2(value) || !exact2(value, ["start", "end", "final", "metrics"]) || !timestamp2(value["start"]) || !timestamp2(value["end"]) || typeof value["final"] !== "boolean" || !record2(value["metrics"]) || !exact2(value["metrics"], DATABASE_EXECUTION_METRICS))
43251
+ if (!record3(value) || !exact2(value, ["start", "end", "final", "metrics"]) || !timestamp2(value["start"]) || !timestamp2(value["end"]) || typeof value["final"] !== "boolean" || !record3(value["metrics"]) || !exact2(value["metrics"], DATABASE_EXECUTION_METRICS))
43126
43252
  throw new TypeError("Invalid database execution usage row");
43127
43253
  const metrics = value["metrics"];
43128
43254
  if (!DATABASE_EXECUTION_METRICS.every((metric) => nonNegativeInteger(metrics[metric])))
@@ -43174,7 +43300,7 @@ function isCanonicalOperations(value) {
43174
43300
  return canonical.length === value.length && canonical.every((op, index) => op === value[index]);
43175
43301
  }
43176
43302
  function parseHeaders(value) {
43177
- if (!record2(value) || Object.keys(value).length > DATABASE_WEBHOOK_MAX_HEADERS || new Set(Object.keys(value).map((name) => name.toLowerCase())).size !== Object.keys(value).length)
43303
+ if (!record3(value) || Object.keys(value).length > DATABASE_WEBHOOK_MAX_HEADERS || new Set(Object.keys(value).map((name) => name.toLowerCase())).size !== Object.keys(value).length)
43178
43304
  throw new TypeError("Invalid database webhook headers");
43179
43305
  const headers = {};
43180
43306
  for (const [name, headerValue] of Object.entries(value)) {
@@ -43238,7 +43364,7 @@ function timestamp2(value) {
43238
43364
  const time3 = Date.parse(value);
43239
43365
  return Number.isFinite(time3) && new Date(time3).toISOString() === value;
43240
43366
  }
43241
- function record2(value) {
43367
+ function record3(value) {
43242
43368
  return typeof value === "object" && value !== null && !Array.isArray(value);
43243
43369
  }
43244
43370
  function onlyKeys(value, allowed) {
@@ -43348,7 +43474,7 @@ function isDatabaseTableIdentifier(value) {
43348
43474
  return typeof value === "string" && DATABASE_TABLE_IDENTIFIER_PATTERN.test(value) && !value.startsWith("pg_") && !RESERVED_WORDS.has(value);
43349
43475
  }
43350
43476
  function parseDatabaseTableCreateRequest(value) {
43351
- if (!record3(value) || !onlyKeys2(value, ["table", "columns", "primaryKey"]) || !isDatabaseTableIdentifier(value["table"]) || !Array.isArray(value["columns"]) || value["columns"].length < 1 || value["columns"].length > DATABASE_TABLE_MAX_COLUMNS)
43477
+ if (!record4(value) || !onlyKeys2(value, ["table", "columns", "primaryKey"]) || !isDatabaseTableIdentifier(value["table"]) || !Array.isArray(value["columns"]) || value["columns"].length < 1 || value["columns"].length > DATABASE_TABLE_MAX_COLUMNS)
43352
43478
  throw new TypeError("Invalid database table request");
43353
43479
  const inputs = value["columns"].map(parseColumn);
43354
43480
  const names = inputs.map((column) => column.name);
@@ -43362,7 +43488,7 @@ function parseDatabaseTableCreateRequest(value) {
43362
43488
  };
43363
43489
  }
43364
43490
  function parseColumn(value) {
43365
- if (!record3(value) || !onlyKeys2(value, ["name", "type", "nullable", "identity", "default"]) || !isDatabaseTableIdentifier(value["name"]) || !oneOf2(DATABASE_TABLE_COLUMN_TYPES, value["type"]) || value["nullable"] !== void 0 && typeof value["nullable"] !== "boolean" || value["identity"] !== void 0 && typeof value["identity"] !== "boolean" || value["default"] !== void 0 && !oneOf2(DATABASE_TABLE_DEFAULTS, value["default"]))
43491
+ if (!record4(value) || !onlyKeys2(value, ["name", "type", "nullable", "identity", "default"]) || !isDatabaseTableIdentifier(value["name"]) || !oneOf2(DATABASE_TABLE_COLUMN_TYPES, value["type"]) || value["nullable"] !== void 0 && typeof value["nullable"] !== "boolean" || value["identity"] !== void 0 && typeof value["identity"] !== "boolean" || value["default"] !== void 0 && !oneOf2(DATABASE_TABLE_DEFAULTS, value["default"]))
43366
43492
  throw new TypeError("Invalid database table request");
43367
43493
  const type = value["type"];
43368
43494
  const identity = value["identity"] === true;
@@ -43405,7 +43531,7 @@ function completeColumn(column, keyed) {
43405
43531
  function oneOf2(allowed, value) {
43406
43532
  return typeof value === "string" && allowed.includes(value);
43407
43533
  }
43408
- function record3(value) {
43534
+ function record4(value) {
43409
43535
  return typeof value === "object" && value !== null && !Array.isArray(value);
43410
43536
  }
43411
43537
  function onlyKeys2(value, allowed) {
@@ -43719,7 +43845,16 @@ var recognizedCommandLabel = (argv) => {
43719
43845
  return value;
43720
43846
  if (value === "profile" && values[0] === "list")
43721
43847
  return "profile list";
43722
- if (value === "connection" && ["begin", "list", "status", "discover", "import", "disconnect"].includes(values[0] ?? ""))
43848
+ if (value === "connection" && [
43849
+ "begin",
43850
+ "list",
43851
+ "status",
43852
+ "discover",
43853
+ "import",
43854
+ "disconnect",
43855
+ "credential-request-create",
43856
+ "credential-request-status"
43857
+ ].includes(values[0] ?? ""))
43723
43858
  return `connection ${values[0]}`;
43724
43859
  if (value === "github" && values[0] === "connect")
43725
43860
  return "github connect";
@@ -44523,13 +44658,52 @@ var parseProductCliCommand = (argv) => {
44523
44658
  "--idempotency-key",
44524
44659
  "--provider-organization",
44525
44660
  "--team",
44526
- "--connection"
44661
+ "--connection",
44662
+ "--selections"
44527
44663
  ]);
44528
44664
  const org = options["--organization"];
44529
44665
  if (!org || !ORGANIZATION_ULID.test(org))
44530
44666
  throw new InvalidCommandError();
44531
44667
  const exact7 = (names) => Object.keys(options).every((k) => names.includes(k)) && names.every((k) => Object.hasOwn(options, k));
44532
44668
  const scoped = () => options["--project"] && options["--environment"] && ORGANIZATION_ULID.test(options["--project"]) && ORGANIZATION_ULID.test(options["--environment"]);
44669
+ if (operation === "credential-request-create" && exact7([
44670
+ "--organization",
44671
+ "--grant",
44672
+ "--provider-organization",
44673
+ "--team",
44674
+ "--selections",
44675
+ "--idempotency-key"
44676
+ ])) {
44677
+ const grantId = options["--grant"] ?? "";
44678
+ const idempotencyKey = options["--idempotency-key"] ?? "";
44679
+ const providerOrganization = options["--provider-organization"] ?? "";
44680
+ const team = options["--team"] ?? "";
44681
+ if (!ORGANIZATION_ULID.test(grantId) || !/^[A-Za-z0-9._:-]{1,128}$/u.test(idempotencyKey) || [providerOrganization, team].some((id4) => !/^[1-9][0-9]{0,15}$/u.test(id4) || !Number.isSafeInteger(Number(id4))))
44682
+ throw new InvalidCommandError();
44683
+ try {
44684
+ const json2 = options["--selections"] ?? "";
44685
+ return {
44686
+ kind: "connection-credential-request-create",
44687
+ organizationId: org,
44688
+ grantId,
44689
+ providerOrganizationId: Number(providerOrganization),
44690
+ teamId: Number(team),
44691
+ selections: parseMakeCredentialSelections(JSON.parse(json2)),
44692
+ idempotencyKey,
44693
+ credentialStore
44694
+ };
44695
+ } catch {
44696
+ throw new InvalidCommandError();
44697
+ }
44698
+ }
44699
+ if (operation === "credential-request-status" && exact7(["--organization", "--grant", "--request"]) && ORGANIZATION_ULID.test(options["--grant"] ?? "") && /^[a-f0-9]{64}$/u.test(options["--request"] ?? ""))
44700
+ return {
44701
+ kind: "connection-credential-request-status",
44702
+ organizationId: org,
44703
+ grantId: options["--grant"] ?? "",
44704
+ requestId: options["--request"] ?? "",
44705
+ credentialStore
44706
+ };
44533
44707
  if (operation === "list" && exact7(["--organization"]))
44534
44708
  return { kind: "connection-list", organizationId: org, credentialStore };
44535
44709
  if (operation === "begin" && (exact7(["--organization", "--idempotency-key"]) || scoped() && exact7(["--organization", "--project", "--environment", "--idempotency-key"])))
@@ -46430,7 +46604,7 @@ import { isAbsolute as isAbsolute2, join as join5, resolve as resolve4 } from "n
46430
46604
 
46431
46605
  // packages/contracts/dist/database-access.js
46432
46606
  function parseProjectDatabaseWrite(value) {
46433
- if (!record4(value) || !exact3(value, ["environment", "statement", "parameters"]) || !["dev", "prod"].includes(String(value["environment"])) || typeof value["statement"] !== "string" || !/^\s*(?:insert|update|delete)\b/iu.test(value["statement"]) || new TextEncoder().encode(value["statement"]).byteLength > 65536 || value["statement"].includes("\0") || !Array.isArray(value["parameters"]) || value["parameters"].length > 100)
46607
+ if (!record5(value) || !exact3(value, ["environment", "statement", "parameters"]) || !["dev", "prod"].includes(String(value["environment"])) || typeof value["statement"] !== "string" || !/^\s*(?:insert|update|delete)\b/iu.test(value["statement"]) || new TextEncoder().encode(value["statement"]).byteLength > 65536 || value["statement"].includes("\0") || !Array.isArray(value["parameters"]) || value["parameters"].length > 100)
46434
46608
  throw new TypeError("Invalid database write");
46435
46609
  const budget = { nodes: 0 };
46436
46610
  for (const parameter of value["parameters"])
@@ -46444,7 +46618,7 @@ function parseProjectDatabaseWrite(value) {
46444
46618
  };
46445
46619
  }
46446
46620
  function assertProjectDatabaseWriteReceipt(value) {
46447
- if (!record4(value) || !exact3(value, ["operation_id", "environment", "state", "command", "affected_rows", "error"]) || typeof value["operation_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value["operation_id"]) || !["dev", "prod"].includes(String(value["environment"])) || !["running", "succeeded", "failed"].includes(String(value["state"])))
46621
+ if (!record5(value) || !exact3(value, ["operation_id", "environment", "state", "command", "affected_rows", "error"]) || typeof value["operation_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value["operation_id"]) || !["dev", "prod"].includes(String(value["environment"])) || !["running", "succeeded", "failed"].includes(String(value["state"])))
46448
46622
  throw new TypeError("Invalid database write receipt");
46449
46623
  if (value["state"] === "succeeded") {
46450
46624
  if (!["INSERT", "UPDATE", "DELETE"].includes(String(value["command"])) || !Number.isSafeInteger(value["affected_rows"]) || Number(value["affected_rows"]) < 0 || Number(value["affected_rows"]) > 1e3 || value["error"] !== null)
@@ -46457,7 +46631,7 @@ function assertProjectDatabaseWriteReceipt(value) {
46457
46631
  throw new TypeError("Invalid database write result");
46458
46632
  } else {
46459
46633
  const error = value["error"];
46460
- if (!record4(error) || typeof error["code"] !== "string" || !error["code"].startsWith("database_write_") || JSON.stringify(error) !== JSON.stringify(publicOperationFailure(error["code"])))
46634
+ if (!record5(error) || typeof error["code"] !== "string" || !error["code"].startsWith("database_write_") || JSON.stringify(error) !== JSON.stringify(publicOperationFailure(error["code"])))
46461
46635
  throw new TypeError("Invalid database write error");
46462
46636
  }
46463
46637
  }
@@ -46481,12 +46655,12 @@ var ACCESS_KEYS = [
46481
46655
  ];
46482
46656
  var ACCESS_ROLE_PATTERN = /^ohmyho_da_[0-7][0-9a-hjkmnp-tv-z]{25}_[0-9a-z]{8}$/u;
46483
46657
  function assertProjectDatabaseAccess(value) {
46484
- if (!record4(value) || !exact3(value, ACCESS_KEYS))
46658
+ if (!record5(value) || !exact3(value, ACCESS_KEYS))
46485
46659
  throw new TypeError("Invalid database access");
46486
46660
  assertAccessFields(value);
46487
46661
  }
46488
46662
  function assertProjectDatabaseAccessCredential(value) {
46489
- if (!record4(value) || !exact3(value, [...ACCESS_KEYS, "connection_uri", "psql_command"]))
46663
+ if (!record5(value) || !exact3(value, [...ACCESS_KEYS, "connection_uri", "psql_command"]))
46490
46664
  throw new TypeError("Invalid database access credential");
46491
46665
  assertAccessFields(value);
46492
46666
  const uri = value["connection_uri"];
@@ -46502,7 +46676,7 @@ function assertProjectDatabaseAccessCredential(value) {
46502
46676
  throw new TypeError("Invalid database access credential");
46503
46677
  }
46504
46678
  function assertProjectDatabaseAccessPage(value) {
46505
- if (!record4(value) || !exact3(value, ["items"]) || !Array.isArray(value["items"]) || value["items"].length > 50)
46679
+ if (!record5(value) || !exact3(value, ["items"]) || !Array.isArray(value["items"]) || value["items"].length > 50)
46506
46680
  throw new TypeError("Invalid database access page");
46507
46681
  for (const item of value["items"])
46508
46682
  assertProjectDatabaseAccess(item);
@@ -46537,14 +46711,14 @@ function json(value, depth, budget) {
46537
46711
  json(entry, depth + 1, budget);
46538
46712
  return;
46539
46713
  }
46540
- if (record4(value)) {
46714
+ if (record5(value)) {
46541
46715
  for (const entry of Object.values(value))
46542
46716
  json(entry, depth + 1, budget);
46543
46717
  return;
46544
46718
  }
46545
46719
  throw new TypeError("Invalid database parameter");
46546
46720
  }
46547
- function record4(value) {
46721
+ function record5(value) {
46548
46722
  return typeof value === "object" && value !== null && !Array.isArray(value);
46549
46723
  }
46550
46724
  function exact3(value, keys) {
@@ -46619,12 +46793,12 @@ function assertOrganizationAccount(value) {
46619
46793
 
46620
46794
  // packages/contracts/dist/database-compute.js
46621
46795
  function assertDatabaseCompute(value) {
46622
- if (!record5(value) || !exact4(value, ["data_mode", "database", "environment", "observed_at", "project_id"]) || typeof value["project_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value["project_id"]) || !["dev", "prod"].includes(String(value["environment"])) || !["shared", "isolated"].includes(String(value["data_mode"])) || typeof value["observed_at"] !== "string" || !Number.isFinite(Date.parse(value["observed_at"])) || new Date(value["observed_at"]).toISOString() !== value["observed_at"])
46796
+ if (!record6(value) || !exact4(value, ["data_mode", "database", "environment", "observed_at", "project_id"]) || typeof value["project_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value["project_id"]) || !["dev", "prod"].includes(String(value["environment"])) || !["shared", "isolated"].includes(String(value["data_mode"])) || typeof value["observed_at"] !== "string" || !Number.isFinite(Date.parse(value["observed_at"])) || new Date(value["observed_at"]).toISOString() !== value["observed_at"])
46623
46797
  throw new TypeError("Invalid database compute report");
46624
46798
  const db = value["database"];
46625
46799
  if (db === null)
46626
46800
  return;
46627
- if (!record5(db) || db["provider"] !== "pgcf")
46801
+ if (!record6(db) || db["provider"] !== "pgcf")
46628
46802
  throw new TypeError("Invalid database compute configuration");
46629
46803
  assertPgcfCompute(db);
46630
46804
  }
@@ -46646,7 +46820,7 @@ function assertPgcfCompute(db) {
46646
46820
  ]) || db["memory_mib"] !== size.memoryMiB || db["cpu_millicores"] !== size.cpuMillicores || db["storage_mib"] !== size.storageMiB || db["max_connections"] !== size.maxConnections || !Number.isSafeInteger(db["suspend_timeout_seconds"]) || Number(db["suspend_timeout_seconds"]) < 60 || Number(db["suspend_timeout_seconds"]) > 900 || !states.includes(String(db["state"])) || db["pending_state"] !== null && !states.includes(String(db["pending_state"])) || typeof db["disabled"] !== "boolean" || !["us", "eu"].includes(String(db["region"])))
46647
46821
  throw new TypeError("Invalid fixed database compute configuration");
46648
46822
  }
46649
- function record5(v) {
46823
+ function record6(v) {
46650
46824
  return typeof v === "object" && v !== null && !Array.isArray(v);
46651
46825
  }
46652
46826
  function exact4(v, keys) {
@@ -46656,7 +46830,7 @@ function exact4(v, keys) {
46656
46830
  // apps/product-cli/package.json
46657
46831
  var package_default = {
46658
46832
  name: "@ohmyhost/product-cli",
46659
- version: "0.1.71",
46833
+ version: "0.1.73",
46660
46834
  private: true,
46661
46835
  ohmyhost: {
46662
46836
  deployment: "production",
@@ -46703,19 +46877,19 @@ var package_default = {
46703
46877
  };
46704
46878
 
46705
46879
  // packages/contracts/dist/project-context.js
46706
- var record6 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
46880
+ var record7 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
46707
46881
  var timestamp4 = (v) => typeof v === "string" && Number.isFinite(Date.parse(v)) && new Date(v).toISOString() === v;
46708
46882
  var version = (v) => Number.isInteger(v) && Number(v) >= 0 && Number(v) <= 2147483647;
46709
46883
  var bounded = (v, lines, bytes) => typeof v === "string" && !/[\r\u2028\u2029]/u.test(v) && !new RegExp("\\p{Cc}", "u").test(v.replace(/[\n\t]/gu, "")) && v.split("\n").length <= lines && new TextEncoder().encode(v).length <= bytes;
46710
46884
  function assertProjectNotesReceipt(v) {
46711
- if (!record6(v) || Object.keys(v).sort().join(",") !== "updated_at,version" || !version(v["version"]) || v["version"] === 0 || !timestamp4(v["updated_at"]))
46885
+ if (!record7(v) || Object.keys(v).sort().join(",") !== "updated_at,version" || !version(v["version"]) || v["version"] === 0 || !timestamp4(v["updated_at"]))
46712
46886
  throw new TypeError("Invalid project notes receipt");
46713
46887
  }
46714
46888
  function assertProjectContext(v) {
46715
- if (!record6(v) || Object.keys(v).sort().join(",") !== "credit_access,generated_at,markdown,notes,project_id" || typeof v["project_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(v["project_id"]) || !timestamp4(v["generated_at"]) || !["included", "not_authorized"].includes(String(v["credit_access"])) || !bounded(v["markdown"], 500, 32768))
46889
+ if (!record7(v) || Object.keys(v).sort().join(",") !== "credit_access,generated_at,markdown,notes,project_id" || typeof v["project_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(v["project_id"]) || !timestamp4(v["generated_at"]) || !["included", "not_authorized"].includes(String(v["credit_access"])) || !bounded(v["markdown"], 500, 32768))
46716
46890
  throw new TypeError("Invalid project context");
46717
46891
  const notes = v["notes"];
46718
- if (!record6(notes) || Object.keys(notes).sort().join(",") !== "markdown,updated_at,version" || !version(notes["version"]) || !bounded(notes["markdown"], 250, 16384) || (notes["version"] === 0 ? notes["updated_at"] !== null || notes["markdown"] !== "" : !timestamp4(notes["updated_at"])))
46892
+ if (!record7(notes) || Object.keys(notes).sort().join(",") !== "markdown,updated_at,version" || !version(notes["version"]) || !bounded(notes["markdown"], 250, 16384) || (notes["version"] === 0 ? notes["updated_at"] !== null || notes["markdown"] !== "" : !timestamp4(notes["updated_at"])))
46719
46893
  throw new TypeError("Invalid project notes");
46720
46894
  }
46721
46895
 
@@ -46725,18 +46899,18 @@ function exportPasswordMeetsMinimum(value) {
46725
46899
  return Array.from(value).length >= EXPORT_PASSWORD_MIN_CHARACTERS;
46726
46900
  }
46727
46901
  function assertProjectExportDownloadLink(value) {
46728
- 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"]))
46902
+ if (!record8(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"]))
46729
46903
  throw new TypeError("Project export download link is invalid");
46730
46904
  }
46731
46905
  function assertProjectExport(value) {
46732
- 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"]))
46906
+ if (!record8(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"]))
46733
46907
  invalid4();
46734
46908
  const active = value["state"] === "queued" || value["state"] === "running";
46735
46909
  if (value["next_poll_after_seconds"] !== (active ? 5 : null))
46736
46910
  invalid4();
46737
46911
  if (value["state"] === "failed") {
46738
46912
  const error = value["error"];
46739
- if (!record7(error) || Object.keys(error).sort().join(",") !== "code,message,retryable,suggested_action" || typeof error["code"] !== "string")
46913
+ if (!record8(error) || Object.keys(error).sort().join(",") !== "code,message,retryable,suggested_action" || typeof error["code"] !== "string")
46740
46914
  invalid4();
46741
46915
  const expected = publicOperationFailure(error["code"]);
46742
46916
  for (const key of Object.keys(expected))
@@ -46750,7 +46924,7 @@ function assertProjectExport(value) {
46750
46924
  invalid4();
46751
46925
  return;
46752
46926
  }
46753
- if (value["state"] !== "succeeded" || !record7(archive) || Object.keys(archive).sort().join(",") !== "bytes,captured_at,download_expires_at,download_url,expires_at,sha256,sql_files" || !Number.isSafeInteger(archive["bytes"]) || Number(archive["bytes"]) < 1 || Number(archive["bytes"]) > 536870912 || typeof archive["sha256"] !== "string" || !/^sha256:[a-f0-9]{64}$/u.test(archive["sha256"]) || ![
46927
+ if (value["state"] !== "succeeded" || !record8(archive) || Object.keys(archive).sort().join(",") !== "bytes,captured_at,download_expires_at,download_url,expires_at,sha256,sql_files" || !Number.isSafeInteger(archive["bytes"]) || Number(archive["bytes"]) < 1 || Number(archive["bytes"]) > 536870912 || typeof archive["sha256"] !== "string" || !/^sha256:[a-f0-9]{64}$/u.test(archive["sha256"]) || ![
46754
46928
  '["dev.sql"]',
46755
46929
  '["prod.sql"]',
46756
46930
  '["dev.sql","prod.sql"]',
@@ -46779,7 +46953,7 @@ function assertProjectExport(value) {
46779
46953
  invalid4();
46780
46954
  }
46781
46955
  var id = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
46782
- function record7(value) {
46956
+ function record8(value) {
46783
46957
  return typeof value === "object" && value !== null && !Array.isArray(value);
46784
46958
  }
46785
46959
  function timestamp5(value) {
@@ -46803,7 +46977,7 @@ function assertBillingTaxIssue(value) {
46803
46977
  ].includes(String(v["code"])) || typeof v["invoice_id"] !== "string" || !/^in_[A-Za-z0-9_]{1,253}$/u.test(v["invoice_id"]) || !timestamp6(v["observed_at"]) || v["required_action"] !== (v["code"] === "billing_tax_location_required" ? "open_billing_portal" : "contact_support"))
46804
46978
  throw new Error("billing_response_invalid");
46805
46979
  }
46806
- var ulid4 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
46980
+ var ulid5 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
46807
46981
  var timestamp6 = (v) => typeof v === "string" && Number.isFinite(Date.parse(v)) && new Date(v).toISOString() === v;
46808
46982
  function stripeUrl(value, host2) {
46809
46983
  if (typeof value !== "string" || value.length > 8192)
@@ -46819,7 +46993,7 @@ function assertBillingCheckout(value) {
46819
46993
  if (!value || typeof value !== "object" || Array.isArray(value))
46820
46994
  throw new Error("billing_response_invalid");
46821
46995
  const v = value;
46822
- if (Object.keys(v).sort().join(",") !== "billing_issue,checkout_id,credited_micros,expires_at,offer,organization_id,packs,paid_until,payment_confirmed,required_action,revoked_micros,state,url" || typeof v["organization_id"] !== "string" || !ulid4.test(v["organization_id"]) || typeof v["checkout_id"] !== "string" || !ulid4.test(v["checkout_id"]) || typeof v["offer"] !== "string" || !["topup", "paid"].includes(v["offer"]) || typeof v["state"] !== "string" || !["open", "complete", "expired"].includes(v["state"]) || typeof v["payment_confirmed"] !== "boolean" || typeof v["required_action"] !== "string" || !["none", "complete_checkout", "open_billing_portal", "contact_support"].includes(v["required_action"]) || v["url"] !== null && !stripeUrl(v["url"], "checkout.stripe.com") || !timestamp6(v["expires_at"]) || v["paid_until"] !== null && !timestamp6(v["paid_until"]) || !Number.isInteger(v["packs"]) || Number(v["packs"]) < 1 || Number(v["packs"]) > 100 || v["offer"] === "paid" && v["packs"] !== 1 || ![v["credited_micros"], v["revoked_micros"]].every((x) => typeof x === "string" && /^(0|[1-9][0-9]{0,18})$/u.test(x)))
46996
+ if (Object.keys(v).sort().join(",") !== "billing_issue,checkout_id,credited_micros,expires_at,offer,organization_id,packs,paid_until,payment_confirmed,required_action,revoked_micros,state,url" || typeof v["organization_id"] !== "string" || !ulid5.test(v["organization_id"]) || typeof v["checkout_id"] !== "string" || !ulid5.test(v["checkout_id"]) || typeof v["offer"] !== "string" || !["topup", "paid"].includes(v["offer"]) || typeof v["state"] !== "string" || !["open", "complete", "expired"].includes(v["state"]) || typeof v["payment_confirmed"] !== "boolean" || typeof v["required_action"] !== "string" || !["none", "complete_checkout", "open_billing_portal", "contact_support"].includes(v["required_action"]) || v["url"] !== null && !stripeUrl(v["url"], "checkout.stripe.com") || !timestamp6(v["expires_at"]) || v["paid_until"] !== null && !timestamp6(v["paid_until"]) || !Number.isInteger(v["packs"]) || Number(v["packs"]) < 1 || Number(v["packs"]) > 100 || v["offer"] === "paid" && v["packs"] !== 1 || ![v["credited_micros"], v["revoked_micros"]].every((x) => typeof x === "string" && /^(0|[1-9][0-9]{0,18})$/u.test(x)))
46823
46997
  throw new Error("billing_response_invalid");
46824
46998
  assertBillingTaxIssue(v["billing_issue"]);
46825
46999
  }
@@ -46827,14 +47001,14 @@ function assertBillingPortal(value) {
46827
47001
  if (!value || typeof value !== "object" || Array.isArray(value))
46828
47002
  throw new Error("billing_response_invalid");
46829
47003
  const v = value;
46830
- if (Object.keys(v).sort().join(",") !== "created_at,organization_id,url" || typeof v["organization_id"] !== "string" || !ulid4.test(v["organization_id"]) || !timestamp6(v["created_at"]) || !stripeUrl(v["url"], "billing.stripe.com"))
47004
+ if (Object.keys(v).sort().join(",") !== "created_at,organization_id,url" || typeof v["organization_id"] !== "string" || !ulid5.test(v["organization_id"]) || !timestamp6(v["created_at"]) || !stripeUrl(v["url"], "billing.stripe.com"))
46831
47005
  throw new Error("billing_response_invalid");
46832
47006
  }
46833
47007
  function assertRecharge(value) {
46834
47008
  if (!value || typeof value !== "object" || Array.isArray(value))
46835
47009
  throw new Error("billing_response_invalid");
46836
47010
  const v = value;
46837
- if (Object.keys(v).sort().join(",") !== "amount_minor,billing_issue,credits,currency,enabled,invoice_url,monthly_limit_minor,organization_id,portal_available,revision,setup_url,spent_minor,status,threshold_credits" || typeof v["organization_id"] !== "string" || !ulid4.test(v["organization_id"]) || typeof v["portal_available"] !== "boolean" || typeof v["enabled"] !== "boolean" || !Number.isSafeInteger(v["revision"]) || Number(v["revision"]) < 0 || !Number.isSafeInteger(v["monthly_limit_minor"]) || Number(v["monthly_limit_minor"]) < 1e3 || Number(v["monthly_limit_minor"]) > 1e5 || !Number.isSafeInteger(v["spent_minor"]) || Number(v["spent_minor"]) < 0 || v["currency"] !== "usd" || v["amount_minor"] !== 900 || v["credits"] !== 1e3 || v["threshold_credits"] !== 100 || typeof v["status"] !== "string" || ![
47011
+ if (Object.keys(v).sort().join(",") !== "amount_minor,billing_issue,credits,currency,enabled,invoice_url,monthly_limit_minor,organization_id,portal_available,revision,setup_url,spent_minor,status,threshold_credits" || typeof v["organization_id"] !== "string" || !ulid5.test(v["organization_id"]) || typeof v["portal_available"] !== "boolean" || typeof v["enabled"] !== "boolean" || !Number.isSafeInteger(v["revision"]) || Number(v["revision"]) < 0 || !Number.isSafeInteger(v["monthly_limit_minor"]) || Number(v["monthly_limit_minor"]) < 1e3 || Number(v["monthly_limit_minor"]) > 1e5 || !Number.isSafeInteger(v["spent_minor"]) || Number(v["spent_minor"]) < 0 || v["currency"] !== "usd" || v["amount_minor"] !== 900 || v["credits"] !== 1e3 || v["threshold_credits"] !== 100 || typeof v["status"] !== "string" || ![
46838
47012
  "off",
46839
47013
  "setup_required",
46840
47014
  "on",
@@ -46977,6 +47151,8 @@ var HELP_USAGE = Object.freeze({
46977
47151
  "connection discover": "ohmyhost connection discover --organization ULID [--project ULID --environment ULID] --grant ULID [--provider-organization ID] [--team ID] --json",
46978
47152
  "connection import": "ohmyhost connection import --organization ULID --grant ULID --project ULID --environment ULID --provider-organization ID --team ID --connection ID --idempotency-key KEY --json",
46979
47153
  "connection disconnect": "ohmyhost connection disconnect --organization ULID --grant ULID --idempotency-key KEY --yes --json",
47154
+ "connection credential-request-create": "ohmyhost connection credential-request-create --organization ULID --grant ULID --provider-organization ID --team ID --selections JSON --idempotency-key KEY --json",
47155
+ "connection credential-request-status": "ohmyhost connection credential-request-status --organization ULID --grant ULID --request HASH --json",
46980
47156
  "github connect": "ohmyhost github connect --organization ULID --idempotency-key KEY --json (connect once, then link covered repositories without another browser consent)",
46981
47157
  "github status": "ohmyhost github status --organization ULID --json",
46982
47158
  "github disconnect": "ohmyhost github disconnect --organization ULID --yes --json (Owner only; revokes the workspace GitHub connection and every repository grant under it, so auto-deploy and linked sources stop at once; the GitHub App stays installed for other workspaces, and github connect starts a new connection)",
@@ -47290,7 +47466,7 @@ var ProductCli = class {
47290
47466
  ...github.status === "connected" ? {} : { next_action: this.githubConnectAction(command.organizationId) }
47291
47467
  });
47292
47468
  }
47293
- if (command.kind === "connection-begin" || command.kind === "connection-list" || command.kind === "connection-status" || command.kind === "connection-discover" || command.kind === "connection-import" || command.kind === "connection-disconnect") {
47469
+ if (command.kind === "connection-begin" || command.kind === "connection-list" || command.kind === "connection-status" || command.kind === "connection-discover" || command.kind === "connection-import" || command.kind === "connection-disconnect" || command.kind === "connection-credential-request-create" || command.kind === "connection-credential-request-status") {
47294
47470
  const api = await this.authenticatedApi(command.credentialStore, signal);
47295
47471
  if (!api.connection)
47296
47472
  throw new ResponseContractError();
@@ -49261,7 +49437,7 @@ var success = (command, body) => ({
49261
49437
  `,
49262
49438
  stderr: ""
49263
49439
  });
49264
- var failure = (command, exitCode, code, retryable, suggestedAction, operation, retryAfterSeconds, requestId, docsUrl, actingAs, message) => {
49440
+ var failure = (command, exitCode, code, retryable, suggestedAction, operation, retryAfterSeconds, requestId2, docsUrl, actingAs, message) => {
49265
49441
  const document2 = {
49266
49442
  version: 1,
49267
49443
  command,
@@ -49272,7 +49448,7 @@ var failure = (command, exitCode, code, retryable, suggestedAction, operation, r
49272
49448
  retryable,
49273
49449
  suggested_action: suggestedAction,
49274
49450
  ...retryAfterSeconds === void 0 ? {} : { retry_after_seconds: retryAfterSeconds },
49275
- ...requestId === void 0 ? {} : { request_id: requestId },
49451
+ ...requestId2 === void 0 ? {} : { request_id: requestId2 },
49276
49452
  ...docsUrl === void 0 ? {} : { docs_url: docsUrl },
49277
49453
  ...operation?.error === void 0 ? {} : { message: operation.error.message },
49278
49454
  ...message === void 0 ? {} : { message },
@@ -49367,6 +49543,10 @@ var parsedCommandName = (command) => {
49367
49543
  return "connection import";
49368
49544
  if (command.kind === "connection-disconnect")
49369
49545
  return "connection disconnect";
49546
+ if (command.kind === "connection-credential-request-create")
49547
+ return "connection credential-request-create";
49548
+ if (command.kind === "connection-credential-request-status")
49549
+ return "connection credential-request-status";
49370
49550
  if (command.kind === "organization-mcp-connections-list")
49371
49551
  return "organization mcp-connections list";
49372
49552
  if (command.kind === "organization-mcp-connection-revoke")
@@ -50671,6 +50851,62 @@ var discoverConnection = (parameters, options) => {
50671
50851
  ...params
50672
50852
  });
50673
50853
  };
50854
+ var createMakeCredentialRequest = (parameters, options) => {
50855
+ const params = buildClientParams([parameters], [
50856
+ {
50857
+ args: [
50858
+ { in: "headers", key: "X-Request-Id" },
50859
+ { in: "headers", key: "Idempotency-Key" },
50860
+ { in: "path", key: "organization_id" },
50861
+ { in: "path", key: "grant_id" },
50862
+ { key: "makeCredentialRequestCreate", map: "body" }
50863
+ ]
50864
+ }
50865
+ ]);
50866
+ return (options?.client ?? client).post({
50867
+ responseStyle: "data",
50868
+ security: [
50869
+ {
50870
+ key: "BearerAuth",
50871
+ scheme: "bearer",
50872
+ type: "http"
50873
+ }
50874
+ ],
50875
+ url: "/v1/organizations/{organization_id}/connections/{grant_id}/credential-requests",
50876
+ ...options,
50877
+ ...params,
50878
+ headers: {
50879
+ "Content-Type": "application/json",
50880
+ ...options?.headers,
50881
+ ...params.headers
50882
+ }
50883
+ });
50884
+ };
50885
+ var getMakeCredentialRequest = (parameters, options) => {
50886
+ const params = buildClientParams([parameters], [
50887
+ {
50888
+ args: [
50889
+ { in: "headers", key: "X-Request-Id" },
50890
+ { in: "path", key: "organization_id" },
50891
+ { in: "path", key: "grant_id" },
50892
+ { in: "path", key: "request_id" }
50893
+ ]
50894
+ }
50895
+ ]);
50896
+ return (options?.client ?? client).get({
50897
+ responseStyle: "data",
50898
+ security: [
50899
+ {
50900
+ key: "BearerAuth",
50901
+ scheme: "bearer",
50902
+ type: "http"
50903
+ }
50904
+ ],
50905
+ url: "/v1/organizations/{organization_id}/connections/{grant_id}/credential-requests/{request_id}",
50906
+ ...options,
50907
+ ...params
50908
+ });
50909
+ };
50674
50910
  var importConnection = (parameters, options) => {
50675
50911
  const params = buildClientParams([parameters], [
50676
50912
  {
@@ -55524,82 +55760,6 @@ function checkedResponse(kind, value) {
55524
55760
  }
55525
55761
  }
55526
55762
 
55527
- // packages/contracts/dist/connection-management.js
55528
- var ulid5 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
55529
- function record8(raw, keys) {
55530
- if (!raw || typeof raw !== "object" || Array.isArray(raw))
55531
- throw new TypeError("Invalid connection response");
55532
- const value = raw;
55533
- if (Object.keys(value).length !== keys.length || keys.some((key) => !Object.hasOwn(value, key)))
55534
- throw new TypeError("Invalid connection response");
55535
- return value;
55536
- }
55537
- function date2(raw) {
55538
- if (typeof raw !== "string" || !Number.isFinite(Date.parse(raw)))
55539
- throw new TypeError("Invalid connection response");
55540
- }
55541
- function items(raw) {
55542
- if (!Array.isArray(raw) || raw.length > 1e4)
55543
- throw new TypeError("Invalid connection response");
55544
- for (const row of raw) {
55545
- const v = record8(row, ["id", "name"]);
55546
- if (!Number.isSafeInteger(v["id"]) || Number(v["id"]) < 1 || typeof v["name"] !== "string" || !v["name"] || v["name"].length > 1024)
55547
- throw new TypeError("Invalid connection response");
55548
- }
55549
- }
55550
- function parseConnectionResponse(kind, raw, expectedOrigin) {
55551
- if (kind === "connection-begin") {
55552
- const v = record8(raw, ["request_id", "url", "expires_at"]);
55553
- date2(v["expires_at"]);
55554
- if (typeof v["request_id"] !== "string" || !/^[a-f0-9]{64}$/u.test(v["request_id"]) || typeof v["url"] !== "string")
55555
- throw new TypeError("Invalid connection response");
55556
- const url = new URL(v["url"]);
55557
- if (!["https://app.ohmyho.st", "https://dev.app.ohmyho.st"].includes(url.origin) || expectedOrigin !== void 0 && url.origin !== expectedOrigin || url.pathname !== "/connections/authorize" || url.hash || url.searchParams.size !== 1 || !/^[A-Za-z0-9_-]{43}$/u.test(url.searchParams.get("request") ?? ""))
55558
- throw new TypeError("Invalid connection response");
55559
- } else if (kind === "connection-status") {
55560
- const v = record8(raw, ["state", "expires_at"]);
55561
- date2(v["expires_at"]);
55562
- if (!["pending", "consumed", "expired"].includes(String(v["state"])))
55563
- throw new TypeError("Invalid connection response");
55564
- } else if (kind === "connection-disconnect") {
55565
- const v = record8(raw, ["state"]);
55566
- if (!["disconnected", "revocation_pending"].includes(String(v["state"])))
55567
- throw new TypeError("Invalid connection response");
55568
- } else if (kind === "connection-import") {
55569
- const v = record8(raw, [
55570
- "id",
55571
- "grant_id",
55572
- "project_id",
55573
- "environment_id",
55574
- "provider_organization_id",
55575
- "team_id",
55576
- "connection_id"
55577
- ]);
55578
- for (const key of ["id", "grant_id", "project_id", "environment_id"])
55579
- if (typeof v[key] !== "string" || !ulid5.test(v[key]))
55580
- throw new TypeError("Invalid connection response");
55581
- for (const key of ["provider_organization_id", "team_id", "connection_id"])
55582
- if (!Number.isSafeInteger(v[key]) || Number(v[key]) < 1)
55583
- throw new TypeError("Invalid connection response");
55584
- } else if (kind === "connection-discover") {
55585
- const v = record8(raw, ["organizations", "teams", "connections"]);
55586
- items(v["organizations"]);
55587
- items(v["teams"]);
55588
- items(v["connections"]);
55589
- } else {
55590
- const v = record8(raw, ["connections"]);
55591
- if (!Array.isArray(v["connections"]) || v["connections"].length > 1e4)
55592
- throw new TypeError("Invalid connection response");
55593
- for (const row of v["connections"]) {
55594
- const grant = record8(row, ["id", "provider", "state", "created_at"]);
55595
- date2(grant["created_at"]);
55596
- if (typeof grant["id"] !== "string" || !ulid5.test(grant["id"]) || grant["provider"] !== "make" || !["active", "refreshing", "reconnect_required", "disconnecting", "disconnected"].includes(String(grant["state"])))
55597
- throw new TypeError("Invalid connection response");
55598
- }
55599
- }
55600
- return raw;
55601
- }
55602
-
55603
55763
  // apps/product-cli/dist/product-api.js
55604
55764
  import { randomUUID as randomUUID3 } from "node:crypto";
55605
55765
 
@@ -56389,6 +56549,21 @@ async function executeConnectionCommand(client2, origin, command) {
56389
56549
  case "connection-disconnect":
56390
56550
  result = await disconnectConnection({ organization_id, grant_id: command.grantId, "Idempotency-Key": command.idempotencyKey }, { client: client2 });
56391
56551
  break;
56552
+ case "connection-credential-request-create":
56553
+ result = await createMakeCredentialRequest({
56554
+ organization_id,
56555
+ grant_id: command.grantId,
56556
+ "Idempotency-Key": command.idempotencyKey,
56557
+ makeCredentialRequestCreate: {
56558
+ provider_organization_id: command.providerOrganizationId,
56559
+ team_id: command.teamId,
56560
+ selections: command.selections
56561
+ }
56562
+ }, { client: client2 });
56563
+ break;
56564
+ case "connection-credential-request-status":
56565
+ result = await getMakeCredentialRequest({ organization_id, grant_id: command.grantId, request_id: command.requestId }, { client: client2 });
56566
+ break;
56392
56567
  }
56393
56568
  return parseConnectionResponse(command.kind, result, origin);
56394
56569
  }