@amerged/ohmyhost-cli 0.1.41 → 0.1.42

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.
@@ -9012,17 +9012,17 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
9012
9012
  var VARIABLE_NAME_REGEX = /^[A-Za-z][A-Za-z-]*$/;
9013
9013
  var VARIABLE_VALUE_COMMENT_REGEX = /^(.*?)( *[#;].*)$/;
9014
9014
  var extractSectionLine = (line) => {
9015
- const matches = SECTION_LINE_REGEX.exec(line);
9016
- if (matches != null) {
9017
- const [section, subsection] = matches.slice(1);
9015
+ const matches2 = SECTION_LINE_REGEX.exec(line);
9016
+ if (matches2 != null) {
9017
+ const [section, subsection] = matches2.slice(1);
9018
9018
  return [section, subsection];
9019
9019
  }
9020
9020
  return null;
9021
9021
  };
9022
9022
  var extractVariableLine = (line) => {
9023
- const matches = VARIABLE_LINE_REGEX.exec(line);
9024
- if (matches != null) {
9025
- const [name, rawValue = "true"] = matches.slice(1);
9023
+ const matches2 = VARIABLE_LINE_REGEX.exec(line);
9024
+ if (matches2 != null) {
9025
+ const [name, rawValue = "true"] = matches2.slice(1);
9026
9026
  const valueWithoutComments = removeComments(rawValue);
9027
9027
  const valueWithoutQuotes = removeQuotes(valueWithoutComments);
9028
9028
  return [name, valueWithoutQuotes];
@@ -10641,14 +10641,14 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
10641
10641
  * @param {string} short
10642
10642
  * @param {string[]} matches
10643
10643
  */
10644
- constructor(nouns, short, matches) {
10644
+ constructor(nouns, short, matches2) {
10645
10645
  super(
10646
- `Found multiple ${nouns} matching "${short}" (${matches.join(
10646
+ `Found multiple ${nouns} matching "${short}" (${matches2.join(
10647
10647
  ", "
10648
10648
  )}). Use a longer abbreviation length to disambiguate them.`
10649
10649
  );
10650
10650
  this.code = this.name = _AmbiguousError.code;
10651
- this.data = { nouns, short, matches };
10651
+ this.data = { nouns, short, matches: matches2 };
10652
10652
  }
10653
10653
  };
10654
10654
  AmbiguousError.code = "AmbiguousError";
@@ -11021,9 +11021,9 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
11021
11021
  IndexResetError,
11022
11022
  NoCommitError
11023
11023
  });
11024
- function formatAuthor({ name, email, timestamp: timestamp6, timezoneOffset }) {
11024
+ function formatAuthor({ name, email, timestamp: timestamp7, timezoneOffset }) {
11025
11025
  timezoneOffset = formatTimezoneOffset(timezoneOffset);
11026
- return `${name} <${email}> ${timestamp6} ${timezoneOffset}`;
11026
+ return `${name} <${email}> ${timestamp7} ${timezoneOffset}`;
11027
11027
  }
11028
11028
  function formatTimezoneOffset(minutes) {
11029
11029
  const sign = simpleSign(negateExceptForZero(minutes));
@@ -11049,13 +11049,13 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
11049
11049
  return str;
11050
11050
  }
11051
11051
  function parseAuthor(author) {
11052
- const [, name, email, timestamp6, offset] = author.match(
11052
+ const [, name, email, timestamp7, offset] = author.match(
11053
11053
  /^(.*) <(.*)> (.*) (.*)$/
11054
11054
  );
11055
11055
  return {
11056
11056
  name,
11057
11057
  email,
11058
- timestamp: Number(timestamp6),
11058
+ timestamp: Number(timestamp7),
11059
11059
  timezoneOffset: parseTimezoneOffset(offset)
11060
11060
  };
11061
11061
  }
@@ -12395,13 +12395,13 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
12395
12395
  return target;
12396
12396
  }
12397
12397
  async function normalizeAuthorObject({ fs: fs3, gitdir, author, commit: commit3 }) {
12398
- const timestamp6 = Math.floor(Date.now() / 1e3);
12398
+ const timestamp7 = Math.floor(Date.now() / 1e3);
12399
12399
  const defaultAuthor = {
12400
12400
  name: await _getConfig({ fs: fs3, gitdir, path: "user.name" }),
12401
12401
  email: await _getConfig({ fs: fs3, gitdir, path: "user.email" }) || "",
12402
12402
  // author.email is allowed to be empty string
12403
- timestamp: timestamp6,
12404
- timezoneOffset: new Date(timestamp6 * 1e3).getTimezoneOffset()
12403
+ timestamp: timestamp7,
12404
+ timezoneOffset: new Date(timestamp7 * 1e3).getTimezoneOffset()
12405
12405
  };
12406
12406
  const normalizedAuthor = assignDefined(
12407
12407
  {},
@@ -12421,13 +12421,13 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
12421
12421
  committer,
12422
12422
  commit: commit3
12423
12423
  }) {
12424
- const timestamp6 = Math.floor(Date.now() / 1e3);
12424
+ const timestamp7 = Math.floor(Date.now() / 1e3);
12425
12425
  const defaultCommitter = {
12426
12426
  name: await _getConfig({ fs: fs3, gitdir, path: "user.name" }),
12427
12427
  email: await _getConfig({ fs: fs3, gitdir, path: "user.email" }) || "",
12428
12428
  // committer.email is allowed to be empty string
12429
- timestamp: timestamp6,
12430
- timezoneOffset: new Date(timestamp6 * 1e3).getTimezoneOffset()
12429
+ timestamp: timestamp7,
12430
+ timezoneOffset: new Date(timestamp7 * 1e3).getTimezoneOffset()
12431
12431
  };
12432
12432
  const normalizedCommitter = assignDefined(
12433
12433
  {},
@@ -14894,18 +14894,18 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
14894
14894
  address: url
14895
14895
  };
14896
14896
  }
14897
- const matches = url.match(/(\w+)(:\/\/|::)(.*)/);
14898
- if (matches === null) return;
14899
- if (matches[2] === "://") {
14897
+ const matches2 = url.match(/(\w+)(:\/\/|::)(.*)/);
14898
+ if (matches2 === null) return;
14899
+ if (matches2[2] === "://") {
14900
14900
  return {
14901
- transport: matches[1],
14902
- address: matches[0]
14901
+ transport: matches2[1],
14902
+ address: matches2[0]
14903
14903
  };
14904
14904
  }
14905
- if (matches[2] === "::") {
14905
+ if (matches2[2] === "::") {
14906
14906
  return {
14907
- transport: matches[1],
14908
- address: matches[3]
14907
+ transport: matches2[1],
14908
+ address: matches2[3]
14909
14909
  };
14910
14910
  }
14911
14911
  }
@@ -15530,12 +15530,12 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
15530
15530
  forAwait(lines, async (line) => {
15531
15531
  if (onMessage) await onMessage(line);
15532
15532
  if (onProgress) {
15533
- const matches = line.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);
15534
- if (matches) {
15533
+ const matches2 = line.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);
15534
+ if (matches2) {
15535
15535
  await onProgress({
15536
- phase: matches[1].trim(),
15537
- loaded: parseInt(matches[2], 10),
15538
- total: parseInt(matches[3], 10)
15536
+ phase: matches2[1].trim(),
15537
+ loaded: parseInt(matches2[2], 10),
15538
+ total: parseInt(matches2[3], 10)
15539
15539
  });
15540
15540
  }
15541
15541
  }
@@ -18604,9 +18604,9 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
18604
18604
  static createStashReflogEntry(author, stashCommit, message) {
18605
18605
  const nameNoSpace = author.name.replace(/\s/g, "");
18606
18606
  const z40 = "0000000000000000000000000000000000000000";
18607
- const timestamp6 = Math.floor(Date.now() / 1e3);
18607
+ const timestamp7 = Math.floor(Date.now() / 1e3);
18608
18608
  const timezoneOffset = _GitRefStash.timezoneOffsetForRefLogEntry;
18609
- return `${z40} ${stashCommit} ${nameNoSpace} ${author.email} ${timestamp6} ${timezoneOffset} ${message}
18609
+ return `${z40} ${stashCommit} ${nameNoSpace} ${author.email} ${timestamp7} ${timezoneOffset} ${message}
18610
18610
  `;
18611
18611
  }
18612
18612
  static getStashReflogEntry(reflogString, parsed = false) {
@@ -22487,11 +22487,11 @@ var require_validate = __commonJS({
22487
22487
  jsonPointer = $data;
22488
22488
  data = names_1.default.rootData;
22489
22489
  } else {
22490
- const matches = RELATIVE_JSON_POINTER.exec($data);
22491
- if (!matches)
22490
+ const matches2 = RELATIVE_JSON_POINTER.exec($data);
22491
+ if (!matches2)
22492
22492
  throw new Error(`Invalid JSON-pointer: ${$data}`);
22493
- const up = +matches[1];
22494
- jsonPointer = matches[2];
22493
+ const up = +matches2[1];
22494
+ jsonPointer = matches2[2];
22495
22495
  if (jsonPointer === "#") {
22496
22496
  if (up >= dataLevel)
22497
22497
  throw new Error(errorMsg("property/index", up));
@@ -23410,11 +23410,11 @@ var require_schemes = __commonJS({
23410
23410
  urnComponent.error = "URN can not be parsed";
23411
23411
  return urnComponent;
23412
23412
  }
23413
- const matches = urnComponent.path.match(URN_REG);
23414
- if (matches && matches[0] === urnComponent.path) {
23413
+ const matches2 = urnComponent.path.match(URN_REG);
23414
+ if (matches2 && matches2[0] === urnComponent.path) {
23415
23415
  const scheme = options.scheme || urnComponent.scheme || "urn";
23416
- urnComponent.nid = matches[1].toLowerCase();
23417
- urnComponent.nss = matches[2];
23416
+ urnComponent.nid = matches2[1].toLowerCase();
23417
+ urnComponent.nss = matches2[2];
23418
23418
  const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`;
23419
23419
  const schemeHandler = getSchemeHandler(urnScheme);
23420
23420
  urnComponent.path = void 0;
@@ -23735,8 +23735,8 @@ var require_fast_uri = __commonJS({
23735
23735
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
23736
23736
  var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
23737
23737
  var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
23738
- function getParseError(parsed, matches) {
23739
- if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
23738
+ function getParseError(parsed, matches2) {
23739
+ if (matches2[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
23740
23740
  return 'URI path must start with "/" when authority is present.';
23741
23741
  }
23742
23742
  if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
@@ -23758,9 +23758,9 @@ var require_fast_uri = __commonJS({
23758
23758
  function isIPLiteral(host2) {
23759
23759
  return host2[0] === "[" && host2[host2.length - 1] === "]";
23760
23760
  }
23761
- function hasMalformedComponentPercentEncoding(matches) {
23762
- const host2 = matches[4];
23763
- return hasMalformedPercentEncoding(matches[3]) || host2 !== void 0 && !isIPLiteral(host2) && hasMalformedPercentEncoding(host2) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
23761
+ function hasMalformedComponentPercentEncoding(matches2) {
23762
+ const host2 = matches2[4];
23763
+ return hasMalformedPercentEncoding(matches2[3]) || host2 !== void 0 && !isIPLiteral(host2) && hasMalformedPercentEncoding(host2) || hasMalformedPercentEncoding(matches2[6]) || hasMalformedPercentEncoding(matches2[7]) || hasMalformedPercentEncoding(matches2[8]);
23764
23764
  }
23765
23765
  function canonicalizeHost(parsed, options, schemeHandler, isIP) {
23766
23766
  if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
@@ -23835,15 +23835,15 @@ var require_fast_uri = __commonJS({
23835
23835
  }
23836
23836
  }
23837
23837
  }
23838
- const matches = uri.match(URI_PARSE);
23839
- if (matches) {
23840
- parsed.scheme = matches[1];
23841
- parsed.userinfo = matches[3];
23842
- parsed.host = matches[4];
23843
- parsed.port = parseInt(matches[5], 10);
23844
- parsed.path = matches[6] || "";
23845
- parsed.query = matches[7];
23846
- parsed.fragment = matches[8];
23838
+ const matches2 = uri.match(URI_PARSE);
23839
+ if (matches2) {
23840
+ parsed.scheme = matches2[1];
23841
+ parsed.userinfo = matches2[3];
23842
+ parsed.host = matches2[4];
23843
+ parsed.port = parseInt(matches2[5], 10);
23844
+ parsed.path = matches2[6] || "";
23845
+ parsed.query = matches2[7];
23846
+ parsed.fragment = matches2[8];
23847
23847
  if (parsed.scheme !== void 0) {
23848
23848
  if (VALID_SCHEME.test(parsed.scheme)) {
23849
23849
  parsed.scheme = parsed.scheme.toLowerCase();
@@ -23852,14 +23852,14 @@ var require_fast_uri = __commonJS({
23852
23852
  malformedScheme = true;
23853
23853
  }
23854
23854
  }
23855
- malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
23855
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches2);
23856
23856
  if (malformedPercentEncoding) {
23857
23857
  parsed.error = parsed.error || "URI contains malformed percent-encoding.";
23858
23858
  }
23859
23859
  if (isNaN(parsed.port)) {
23860
- parsed.port = matches[5];
23860
+ parsed.port = matches2[5];
23861
23861
  }
23862
- const parseError = getParseError(parsed, matches);
23862
+ const parseError = getParseError(parsed, matches2);
23863
23863
  if (parseError !== void 0) {
23864
23864
  parsed.error = parsed.error || parseError;
23865
23865
  malformedAuthorityOrPort = true;
@@ -26645,7 +26645,7 @@ var require_discriminator = __commonJS({
26645
26645
  error,
26646
26646
  code(cxt) {
26647
26647
  const { gen, data, schema, parentSchema, it } = cxt;
26648
- const { oneOf } = parentSchema;
26648
+ const { oneOf: oneOf2 } = parentSchema;
26649
26649
  if (!it.opts.discriminator) {
26650
26650
  throw new Error("discriminator: requires discriminator option");
26651
26651
  }
@@ -26654,7 +26654,7 @@ var require_discriminator = __commonJS({
26654
26654
  throw new Error("discriminator: requires propertyName");
26655
26655
  if (schema.mapping)
26656
26656
  throw new Error("discriminator: mapping is not supported");
26657
- if (!oneOf)
26657
+ if (!oneOf2)
26658
26658
  throw new Error("discriminator: requires oneOf keyword");
26659
26659
  const valid = gen.let("valid", false);
26660
26660
  const tag = gen.const("tag", (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(tagName)}`);
@@ -26682,8 +26682,8 @@ var require_discriminator = __commonJS({
26682
26682
  const oneOfMapping = {};
26683
26683
  const topRequired = hasRequired(parentSchema);
26684
26684
  let tagRequired = true;
26685
- for (let i = 0; i < oneOf.length; i++) {
26686
- let sch = oneOf[i];
26685
+ for (let i = 0; i < oneOf2.length; i++) {
26686
+ let sch = oneOf2[i];
26687
26687
  if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) {
26688
26688
  const ref = sch.$ref;
26689
26689
  sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref);
@@ -30277,7 +30277,7 @@ var require_timestamp = __commonJS({
30277
30277
  resolve: (str) => parseSexagesimal(str, false),
30278
30278
  stringify: stringifySexagesimal
30279
30279
  };
30280
- var timestamp6 = {
30280
+ var timestamp7 = {
30281
30281
  identify: (value) => value instanceof Date,
30282
30282
  default: true,
30283
30283
  tag: "tag:yaml.org,2002:timestamp",
@@ -30286,7 +30286,7 @@ var require_timestamp = __commonJS({
30286
30286
  // assumed to be 00:00:00Z (start of day, UTC).
30287
30287
  test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
30288
30288
  resolve(str) {
30289
- const match = str.match(timestamp6.test);
30289
+ const match = str.match(timestamp7.test);
30290
30290
  if (!match)
30291
30291
  throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
30292
30292
  const [, year, month, day, hour, minute, second] = match.map(Number);
@@ -30305,7 +30305,7 @@ var require_timestamp = __commonJS({
30305
30305
  };
30306
30306
  exports.floatTime = floatTime;
30307
30307
  exports.intTime = intTime;
30308
- exports.timestamp = timestamp6;
30308
+ exports.timestamp = timestamp7;
30309
30309
  }
30310
30310
  });
30311
30311
 
@@ -30325,7 +30325,7 @@ var require_schema4 = __commonJS({
30325
30325
  var omap = require_omap();
30326
30326
  var pairs = require_pairs();
30327
30327
  var set = require_set();
30328
- var timestamp6 = require_timestamp();
30328
+ var timestamp7 = require_timestamp();
30329
30329
  var schema = [
30330
30330
  map.map,
30331
30331
  seq.seq,
@@ -30345,9 +30345,9 @@ var require_schema4 = __commonJS({
30345
30345
  omap.omap,
30346
30346
  pairs.pairs,
30347
30347
  set.set,
30348
- timestamp6.intTime,
30349
- timestamp6.floatTime,
30350
- timestamp6.timestamp
30348
+ timestamp7.intTime,
30349
+ timestamp7.floatTime,
30350
+ timestamp7.timestamp
30351
30351
  ];
30352
30352
  exports.schema = schema;
30353
30353
  }
@@ -30372,7 +30372,7 @@ var require_tags = __commonJS({
30372
30372
  var pairs = require_pairs();
30373
30373
  var schema$2 = require_schema4();
30374
30374
  var set = require_set();
30375
- var timestamp6 = require_timestamp();
30375
+ var timestamp7 = require_timestamp();
30376
30376
  var schemas = /* @__PURE__ */ new Map([
30377
30377
  ["core", schema.schema],
30378
30378
  ["failsafe", [map.map, seq.seq, string.string]],
@@ -30386,11 +30386,11 @@ var require_tags = __commonJS({
30386
30386
  float: float.float,
30387
30387
  floatExp: float.floatExp,
30388
30388
  floatNaN: float.floatNaN,
30389
- floatTime: timestamp6.floatTime,
30389
+ floatTime: timestamp7.floatTime,
30390
30390
  int: int.int,
30391
30391
  intHex: int.intHex,
30392
30392
  intOct: int.intOct,
30393
- intTime: timestamp6.intTime,
30393
+ intTime: timestamp7.intTime,
30394
30394
  map: map.map,
30395
30395
  merge: merge.merge,
30396
30396
  null: _null.nullTag,
@@ -30398,7 +30398,7 @@ var require_tags = __commonJS({
30398
30398
  pairs: pairs.pairs,
30399
30399
  seq: seq.seq,
30400
30400
  set: set.set,
30401
- timestamp: timestamp6.timestamp
30401
+ timestamp: timestamp7.timestamp
30402
30402
  };
30403
30403
  var coreKnownTags = {
30404
30404
  "tag:yaml.org,2002:binary": binary.binary,
@@ -30406,7 +30406,7 @@ var require_tags = __commonJS({
30406
30406
  "tag:yaml.org,2002:omap": omap.omap,
30407
30407
  "tag:yaml.org,2002:pairs": pairs.pairs,
30408
30408
  "tag:yaml.org,2002:set": set.set,
30409
- "tag:yaml.org,2002:timestamp": timestamp6.timestamp
30409
+ "tag:yaml.org,2002:timestamp": timestamp7.timestamp
30410
30410
  };
30411
30411
  function getTags(customTags, schemaName, addMergeTag) {
30412
30412
  const schemaTags = schemas.get(schemaName);
@@ -38396,11 +38396,11 @@ function resolvePackageManager(input) {
38396
38396
  }
38397
38397
  function resolveFrameworkConfig(basename2, files) {
38398
38398
  const supported = [`${basename2}.js`, `${basename2}.mjs`, `${basename2}.ts`];
38399
- const matches = supported.filter((candidate) => files.includes(candidate));
38400
- if (matches.length > 1) {
38401
- throw new FrameworkAdmissionError("ambiguous_config", matches[0]);
38399
+ const matches2 = supported.filter((candidate) => files.includes(candidate));
38400
+ if (matches2.length > 1) {
38401
+ throw new FrameworkAdmissionError("ambiguous_config", matches2[0]);
38402
38402
  }
38403
- return matches[0] ?? null;
38403
+ return matches2[0] ?? null;
38404
38404
  }
38405
38405
  var STABLE_VERSION_SOURCE = "(?:0|[1-9][0-9]{0,5})\\.(?:0|[1-9][0-9]{0,5})\\.(?:0|[1-9][0-9]{0,5})";
38406
38406
  var VERSION_RANGE = new RegExp(`^([~^])(${STABLE_VERSION_SOURCE})$`, "u");
@@ -38776,14 +38776,14 @@ function isFrameworkConversionDiagnosticCode(value) {
38776
38776
  function parseFrameworkConversionDiagnostic(value) {
38777
38777
  if (typeof value !== "object" || value === null || Array.isArray(value))
38778
38778
  return null;
38779
- const record6 = value;
38780
- const code = Object.hasOwn(record6, "code") ? record6["code"] : void 0;
38781
- const path2 = Object.hasOwn(record6, "path") ? record6["path"] : void 0;
38779
+ const record7 = value;
38780
+ const code = Object.hasOwn(record7, "code") ? record7["code"] : void 0;
38781
+ const path2 = Object.hasOwn(record7, "path") ? record7["path"] : void 0;
38782
38782
  if (!isFrameworkConversionDiagnosticCode(code) || typeof path2 !== "string")
38783
38783
  return null;
38784
38784
  const definition = DETAIL_DEFINITIONS[code];
38785
- const fields = Object.entries(definition.fields ?? {}).map(([name, grammar]) => [name, grammar, Object.hasOwn(record6, name) ? record6[name] : void 0]);
38786
- if (Object.keys(record6).length !== fields.length + 2 || pathClassOf(definition, path2) === null || fields.some(([, grammar, field]) => !fieldMatches(grammar, field)))
38785
+ const fields = Object.entries(definition.fields ?? {}).map(([name, grammar]) => [name, grammar, Object.hasOwn(record7, name) ? record7[name] : void 0]);
38786
+ if (Object.keys(record7).length !== fields.length + 2 || pathClassOf(definition, path2) === null || fields.some(([, grammar, field]) => !fieldMatches(grammar, field)))
38787
38787
  return null;
38788
38788
  return Object.freeze(Object.fromEntries([
38789
38789
  ["code", code],
@@ -39301,8 +39301,8 @@ function ulid(value) {
39301
39301
  if (typeof value !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value))
39302
39302
  invalid();
39303
39303
  }
39304
- function commit(value, nullable = false) {
39305
- if (nullable && value === null)
39304
+ function commit(value, nullable2 = false) {
39305
+ if (nullable2 && value === null)
39306
39306
  return;
39307
39307
  if (typeof value !== "string" || !/^[a-f0-9]{40}$/u.test(value))
39308
39308
  invalid();
@@ -40057,7 +40057,7 @@ function isSaasCnameTarget(value) {
40057
40057
 
40058
40058
  // packages/contracts/dist/credit-pricing.js
40059
40059
  function assertOrganizationCreditUsage(value) {
40060
- const record6 = (input, keys) => {
40060
+ const record7 = (input, keys) => {
40061
40061
  if (!input || typeof input !== "object" || Array.isArray(input) || Object.keys(input).sort().join() !== keys.split(",").sort().join())
40062
40062
  throw new TypeError("Invalid usage fields");
40063
40063
  return input;
@@ -40065,30 +40065,30 @@ function assertOrganizationCreditUsage(value) {
40065
40065
  const identifier2 = (input) => typeof input === "string" && /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(input);
40066
40066
  const amount = (input) => typeof input === "string" && /^(0|[1-9][0-9]{0,37})$/u.test(input);
40067
40067
  const instant2 = (input) => typeof input === "string" && Number.isFinite(Date.parse(input)) && new Date(input).toISOString() === input;
40068
- const report = record6(value, "organization_id,as_of,unit,period,from,projects,days");
40068
+ const report = record7(value, "organization_id,as_of,unit,period,from,projects,days");
40069
40069
  if (!identifier2(report["organization_id"]) || !instant2(report["as_of"]) || !instant2(report["from"]) || report["unit"] !== "microcredits" || typeof report["period"] !== "string" || !/^20[0-9]{2}-(0[1-9]|1[0-2])$/u.test(report["period"]) || !Array.isArray(report["projects"]) || report["projects"].length > 1e3 || !Array.isArray(report["days"]) || report["days"].length > 15)
40070
40070
  throw new TypeError("Invalid usage report");
40071
40071
  let previous = "";
40072
40072
  for (const input of report["projects"]) {
40073
- const project = record6(input, "project_id,used_micros");
40073
+ const project = record7(input, "project_id,used_micros");
40074
40074
  if (!identifier2(project["project_id"]) || String(project["project_id"]) <= previous || !amount(project["used_micros"]))
40075
40075
  throw new TypeError("Invalid usage project");
40076
40076
  previous = String(project["project_id"]);
40077
40077
  }
40078
40078
  let previousDay = "";
40079
40079
  for (const input of report["days"]) {
40080
- const day = record6(input, "day,projects");
40080
+ const day = record7(input, "day,projects");
40081
40081
  if (typeof day["day"] !== "string" || !/^20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/u.test(day["day"]) || day["day"] <= previousDay || !Array.isArray(day["projects"]) || day["projects"].length > 1e3)
40082
40082
  throw new TypeError("Invalid usage day");
40083
40083
  previousDay = day["day"];
40084
40084
  previous = "";
40085
40085
  for (const projectInput of day["projects"]) {
40086
- const project = record6(projectInput, "project_id,meters");
40086
+ const project = record7(projectInput, "project_id,meters");
40087
40087
  if (!identifier2(project["project_id"]) || String(project["project_id"]) <= previous || !Array.isArray(project["meters"]) || project["meters"].length > 1e3)
40088
40088
  throw new TypeError("Invalid usage project");
40089
40089
  previous = String(project["project_id"]);
40090
40090
  for (const meterInput of project["meters"]) {
40091
- const meter = record6(meterInput, "environment_id,meter,unit,rate_card_id,quantity,charged_micros");
40091
+ const meter = record7(meterInput, "environment_id,meter,unit,rate_card_id,quantity,charged_micros");
40092
40092
  if (meter["environment_id"] !== null && !identifier2(meter["environment_id"]))
40093
40093
  throw new TypeError("Invalid usage environment");
40094
40094
  for (const key of ["meter", "unit", "rate_card_id"])
@@ -40301,6 +40301,30 @@ var PROBLEM_POLICY = {
40301
40301
  action: "List the project's database credentials and revoke one you no longer need, then request access again.",
40302
40302
  title: "Database access limit reached"
40303
40303
  },
40304
+ database_webhook_limit: {
40305
+ status: 409,
40306
+ retryable: false,
40307
+ action: "List the project's database webhooks for this environment and delete one you no longer need, then create the webhook again.",
40308
+ title: "Database webhook limit reached"
40309
+ },
40310
+ database_schedule_limit: {
40311
+ status: 409,
40312
+ retryable: false,
40313
+ action: "List the project's database schedules for this environment and delete one you no longer need, then set the schedule again.",
40314
+ title: "Database schedule limit reached"
40315
+ },
40316
+ database_schedule_not_runnable: {
40317
+ status: 409,
40318
+ retryable: false,
40319
+ action: "Read the schedule and its runs. Enable a disabled schedule, or wait until the run already queued has finished, then request the run again.",
40320
+ title: "Database schedule cannot run now"
40321
+ },
40322
+ database_webhook_delivery_pending: {
40323
+ status: 409,
40324
+ retryable: false,
40325
+ action: "The platform is still retrying this webhook delivery. Read the delivery in the delivery list; replay it only if it ends dead_lettered or the receiver needs the event again.",
40326
+ title: "Webhook delivery still pending"
40327
+ },
40304
40328
  project_notes_conflict: {
40305
40329
  status: 409,
40306
40330
  retryable: false,
@@ -41443,8 +41467,8 @@ var isPaidValidationRecord = (value) => {
41443
41467
  if (typeof value !== "object" || value === null || Array.isArray(value) || Object.keys(value).sort().join(",") !== "content,name,purpose,type") {
41444
41468
  return false;
41445
41469
  }
41446
- const record6 = value;
41447
- return (record6["type"] === "CNAME" || record6["type"] === "TXT") && boundedString(record6["name"], 1, 253) && boundedString(record6["content"], 1, 2048) && ["traffic", "ownership", "ssl", "dcv_delegation"].includes(String(record6["purpose"]));
41470
+ const record7 = value;
41471
+ return (record7["type"] === "CNAME" || record7["type"] === "TXT") && boundedString(record7["name"], 1, 253) && boundedString(record7["content"], 1, 2048) && ["traffic", "ownership", "ssl", "dcv_delegation"].includes(String(record7["purpose"]));
41448
41472
  };
41449
41473
  var isHttpsUrlValue = (value) => typeof value === "string" && isHttpsUrl(value);
41450
41474
 
@@ -41589,7 +41613,7 @@ async function prepareLocalSourcePublication(input) {
41589
41613
  request = { ...request, expected_commit_sha: link2.source.last_confirmed_commit_sha };
41590
41614
  }
41591
41615
  parseManagedSourceRequest("upload", request);
41592
- const record6 = {
41616
+ const record7 = {
41593
41617
  version: 1,
41594
41618
  ...scope,
41595
41619
  operation_id: null,
@@ -41598,16 +41622,16 @@ async function prepareLocalSourcePublication(input) {
41598
41622
  request
41599
41623
  };
41600
41624
  if (original !== null) {
41601
- assertSameAttempt(original, record6);
41625
+ assertSameAttempt(original, record7);
41602
41626
  } else
41603
- await writePending(record6, true);
41627
+ await writePending(record7, true);
41604
41628
  return {
41605
41629
  request,
41606
41630
  accepted: async (operation) => {
41607
41631
  const current = await readPending(scope, replay);
41608
41632
  if (current === null)
41609
41633
  throw new LocalSourcePublicationError("source_publication_missing");
41610
- assertSameAttempt(current, record6);
41634
+ assertSameAttempt(current, record7);
41611
41635
  if (current.operation_id !== null && current.operation_id !== operation.id)
41612
41636
  throw new ResponseContractError();
41613
41637
  if (!replay)
@@ -41626,7 +41650,7 @@ async function prepareLocalSourcePublication(input) {
41626
41650
  const current = await readPending(scope);
41627
41651
  if (current === null || current.operation_id !== null)
41628
41652
  return;
41629
- assertSameAttempt(current, record6);
41653
+ assertSameAttempt(current, record7);
41630
41654
  } catch (error2) {
41631
41655
  if (error2 instanceof LocalSourcePublicationError && (error2.code === "source_publication_scope_mismatch" || error2.code === "source_publication_pending"))
41632
41656
  return;
@@ -41829,12 +41853,12 @@ async function readRecord(path2) {
41829
41853
  await handle?.close();
41830
41854
  }
41831
41855
  }
41832
- async function writePending(record6, create, completed = false) {
41833
- const parent = join3(record6.directory, ".ohmyhost");
41856
+ async function writePending(record7, create, completed = false) {
41857
+ const parent = join3(record7.directory, ".ohmyhost");
41834
41858
  for (const directory of [
41835
41859
  parent,
41836
- record6.metadata_directory,
41837
- join3(record6.metadata_directory, "publications")
41860
+ record7.metadata_directory,
41861
+ join3(record7.metadata_directory, "publications")
41838
41862
  ]) {
41839
41863
  try {
41840
41864
  await fs2.mkdir(directory, { mode: 448 });
@@ -41845,10 +41869,10 @@ async function writePending(record6, create, completed = false) {
41845
41869
  await checkedDirectory(directory);
41846
41870
  await fs2.chmod(directory, 448);
41847
41871
  }
41848
- const target = completed ? completedPath(record6) : pendingPath(record6);
41872
+ const target = completed ? completedPath(record7) : pendingPath(record7);
41849
41873
  const temporary = create ? target : `${target}.${randomUUID()}.tmp`;
41850
41874
  try {
41851
- await fs2.writeFile(temporary, `${JSON.stringify(record6)}
41875
+ await fs2.writeFile(temporary, `${JSON.stringify(record7)}
41852
41876
  `, { mode: 384, flag: "wx" });
41853
41877
  if (!create)
41854
41878
  await fs2.rename(temporary, target);
@@ -42468,6 +42492,350 @@ function isUserSecretName(value, action = "set") {
42468
42492
  return action === "delete" ? !INSTALLED_PLATFORM_KEYS.has(value) : !value.startsWith("OHMYHOST_") && !FIXED_PLATFORM_NAMES.has(value);
42469
42493
  }
42470
42494
 
42495
+ // packages/contracts/dist/database-events.js
42496
+ var DATABASE_WEBHOOK_EVENT_TYPES = [
42497
+ "database.created",
42498
+ "database.ready",
42499
+ "database.woke",
42500
+ "database.slept",
42501
+ "database.suspended",
42502
+ "database.resized",
42503
+ "database.deleted"
42504
+ ];
42505
+ var DATABASE_WEBHOOK_MAX_EVENT_TYPES = 16;
42506
+ var DATABASE_WEBHOOK_MAX_HEADERS = 8;
42507
+ var DATABASE_WEBHOOK_URL_MAX_LENGTH = 2048;
42508
+ var DATABASE_SCHEDULE_MIN_EVERY_SECONDS = 60;
42509
+ var DATABASE_SCHEDULE_MAX_EVERY_SECONDS = 31 * 86400;
42510
+ var DATABASE_SCHEDULE_CRON_MIN_LENGTH = 9;
42511
+ var DATABASE_SCHEDULE_CRON_MAX_LENGTH = 120;
42512
+ var DATABASE_SCHEDULE_MAX_STATEMENTS = 20;
42513
+ var DATABASE_SCHEDULE_STATEMENT_MAX_BYTES = 16 * 1024;
42514
+ var DATABASE_SCHEDULE_STATEMENTS_MAX_BYTES = 64 * 1024;
42515
+ var DATABASE_SCHEDULE_MIN_TIMEOUT_MS = 1e3;
42516
+ var DATABASE_SCHEDULE_DEFAULT_TIMEOUT_MS = 1e4;
42517
+ var DATABASE_SCHEDULE_MAX_TIMEOUT_MS = 3e4;
42518
+ var DATABASE_SCHEDULE_OUTCOMES = [
42519
+ "succeeded",
42520
+ "failed",
42521
+ "timed_out",
42522
+ "outcome_unknown",
42523
+ "rejected",
42524
+ "skipped_capacity",
42525
+ "skipped_suspended",
42526
+ "skipped_deleted",
42527
+ "skipped_missed"
42528
+ ];
42529
+ var DATABASE_EXECUTION_METRICS = [
42530
+ "schedule_runs_succeeded",
42531
+ "schedule_runs_failed",
42532
+ "schedule_runs_timed_out",
42533
+ "schedule_runs_outcome_unknown",
42534
+ "schedule_runs_rejected",
42535
+ "schedule_runs_skipped",
42536
+ "events_emitted",
42537
+ "event_bytes",
42538
+ "webhook_attempts",
42539
+ "webhook_deliveries_delivered",
42540
+ "webhook_deliveries_dead_lettered"
42541
+ ];
42542
+ var DATABASE_PAGE_MAX_ITEMS = 100;
42543
+ var USAGE_HOUR_MS = 36e5;
42544
+ var USAGE_MAX_RANGE_MS = 31 * 24 * USAGE_HOUR_MS;
42545
+ var WEBHOOK_KEYS = ["id", "environment", "url", "event_types", "header_names", "created_at"];
42546
+ var WEBHOOK_ID_PATTERN = /^whk_[a-z0-9]{20}$/u;
42547
+ var DELIVERY_ID_PATTERN = /^dlv_[0-9a-f]{20}$/u;
42548
+ var EVENT_ID_PATTERN = /^evt_[0-9a-f]{20}$/u;
42549
+ var SCHEDULE_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,62}$/u;
42550
+ var CURSOR_PATTERN = /^[A-Za-z0-9._|:=+/-]{1,200}$/u;
42551
+ var HEADER_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9-]{0,63}$/u;
42552
+ var HEADER_VALUE_PATTERN = /^[\x21-\x7e]([\x20-\x7e]*[\x21-\x7e])?$/u;
42553
+ var HEADER_FORBIDDEN_NAMES = [
42554
+ "host",
42555
+ "content-length",
42556
+ "content-type",
42557
+ "connection",
42558
+ "transfer-encoding",
42559
+ "user-agent",
42560
+ "te",
42561
+ "upgrade",
42562
+ "expect"
42563
+ ];
42564
+ var HEADER_FORBIDDEN_PREFIXES = ["pgcf-", "cf-", "x-forwarded-"];
42565
+ function parseDatabaseWebhookId(value) {
42566
+ if (!matches(value, WEBHOOK_ID_PATTERN))
42567
+ throw new TypeError("Invalid database webhook id");
42568
+ return value;
42569
+ }
42570
+ function parseDatabaseDeliveryId(value) {
42571
+ if (!matches(value, DELIVERY_ID_PATTERN))
42572
+ throw new TypeError("Invalid database delivery id");
42573
+ return value;
42574
+ }
42575
+ function parseDatabaseScheduleName(value) {
42576
+ if (!matches(value, SCHEDULE_NAME_PATTERN))
42577
+ throw new TypeError("Invalid database schedule name");
42578
+ return value;
42579
+ }
42580
+ function parseDatabaseListLimit(value, max, fallback) {
42581
+ if (value === void 0)
42582
+ return fallback;
42583
+ const limit = typeof value === "string" && /^[1-9][0-9]{0,3}$/u.test(value) ? Number(value) : value;
42584
+ if (typeof limit !== "number" || !Number.isSafeInteger(limit) || limit < 1 || limit > max)
42585
+ throw new TypeError("Invalid database list limit");
42586
+ return limit;
42587
+ }
42588
+ function parseDatabaseCursor(value) {
42589
+ if (value === void 0 || value === null)
42590
+ return null;
42591
+ if (!matches(value, CURSOR_PATTERN))
42592
+ throw new TypeError("Invalid database cursor");
42593
+ return value;
42594
+ }
42595
+ function parseDatabaseUsageWindow(from, to, granularity) {
42596
+ if (!timestamp2(from) || !timestamp2(to) || !oneOf(["hour", "day"], granularity))
42597
+ throw new TypeError("Invalid database usage window");
42598
+ const start = Date.parse(from), end = Date.parse(to), unit = granularity === "hour" ? USAGE_HOUR_MS : 24 * USAGE_HOUR_MS;
42599
+ if (end <= start || end - start > USAGE_MAX_RANGE_MS || start % unit !== 0 || end % unit !== 0)
42600
+ throw new TypeError("Invalid database usage window");
42601
+ return { from, to, granularity };
42602
+ }
42603
+ function parseDatabaseWebhookCreateRequest(value) {
42604
+ if (!record2(value) || !onlyKeys(value, ["url", "event_types", "headers"]))
42605
+ throw new TypeError("Invalid database webhook request");
42606
+ return {
42607
+ url: parseHttpsUrl(value["url"]),
42608
+ event_types: parseEventTypes(value["event_types"]),
42609
+ headers: value["headers"] === void 0 ? {} : parseHeaders(value["headers"])
42610
+ };
42611
+ }
42612
+ function parseDatabaseScheduleSetRequest(value) {
42613
+ 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))
42614
+ throw new TypeError("Invalid database schedule request");
42615
+ const enabled = value["enabled"] === void 0 ? true : value["enabled"];
42616
+ if (typeof enabled !== "boolean")
42617
+ throw new TypeError("Invalid database schedule request");
42618
+ return {
42619
+ cron: value["cron"] === void 0 ? null : parseCron(value["cron"]),
42620
+ every_seconds: value["every_seconds"] === void 0 ? null : parseEverySeconds(value["every_seconds"]),
42621
+ statements: parseStatements(value["statements"]),
42622
+ timeout_ms: value["timeout_ms"] === void 0 ? DATABASE_SCHEDULE_DEFAULT_TIMEOUT_MS : parseTimeout(value["timeout_ms"]),
42623
+ enabled
42624
+ };
42625
+ }
42626
+ function assertDatabaseWebhook(value) {
42627
+ if (!record2(value) || !exact2(value, WEBHOOK_KEYS))
42628
+ throw new TypeError("Invalid database webhook");
42629
+ assertWebhookFields(value);
42630
+ }
42631
+ function assertDatabaseWebhookCreated(value) {
42632
+ if (!record2(value) || !exact2(value, [...WEBHOOK_KEYS, "secret"]) || typeof value["secret"] !== "string" || value["secret"].length === 0)
42633
+ throw new TypeError("Invalid database webhook");
42634
+ assertWebhookFields(value);
42635
+ }
42636
+ function assertDatabaseWebhookPage(value) {
42637
+ if (!record2(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
42638
+ throw new TypeError("Invalid database webhook page");
42639
+ for (const item of value["items"])
42640
+ assertDatabaseWebhook(item);
42641
+ }
42642
+ function assertDatabaseWebhookDeleted(value) {
42643
+ if (!record2(value) || !exact2(value, ["id", "deleted"]) || !matches(value["id"], WEBHOOK_ID_PATTERN) || value["deleted"] !== true)
42644
+ throw new TypeError("Invalid database webhook deletion");
42645
+ }
42646
+ function assertDatabaseWebhookDelivery(value) {
42647
+ if (!record2(value) || !exact2(value, [
42648
+ "id",
42649
+ "event_id",
42650
+ "event_type",
42651
+ "webhook_id",
42652
+ "state",
42653
+ "attempts",
42654
+ "created_at",
42655
+ "next_attempt_at",
42656
+ "delivered_at",
42657
+ "last_status",
42658
+ "last_error"
42659
+ ]) || !matches(value["id"], DELIVERY_ID_PATTERN) || !matches(value["event_id"], EVENT_ID_PATTERN) || !oneOf(DATABASE_WEBHOOK_EVENT_TYPES, value["event_type"]) || !matches(value["webhook_id"], WEBHOOK_ID_PATTERN) || !oneOf(["pending", "delivered", "dead_lettered"], value["state"]) || !nonNegativeInteger(value["attempts"]) || !timestamp2(value["created_at"]) || !nullable(value["next_attempt_at"], timestamp2) || !nullable(value["delivered_at"], timestamp2) || !nullable(value["last_status"], Number.isSafeInteger) || !nullable(value["last_error"], (error) => oneOf(["timeout", "network", "http", "expired", "permanent"], error)))
42660
+ throw new TypeError("Invalid database webhook delivery");
42661
+ }
42662
+ function assertDatabaseWebhookDeliveryPage(value) {
42663
+ if (!record2(value) || !exact2(value, ["items", "next_cursor"]) || !pageItems(value["items"]))
42664
+ throw new TypeError("Invalid database webhook delivery page");
42665
+ for (const item of value["items"])
42666
+ assertDatabaseWebhookDelivery(item);
42667
+ if (!nullable(value["next_cursor"], isCursor))
42668
+ throw new TypeError("Invalid database webhook delivery page");
42669
+ }
42670
+ function assertDatabaseWebhookTest(value) {
42671
+ 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"]))
42672
+ throw new TypeError("Invalid database webhook test result");
42673
+ }
42674
+ function assertDatabaseWebhookReplayAccepted(value) {
42675
+ if (!record2(value) || !exact2(value, ["delivery_id", "state"]) || !matches(value["delivery_id"], DELIVERY_ID_PATTERN) || value["state"] !== "pending")
42676
+ throw new TypeError("Invalid database webhook replay");
42677
+ }
42678
+ function assertDatabaseSchedule(value) {
42679
+ if (!record2(value) || !exact2(value, [
42680
+ "name",
42681
+ "environment",
42682
+ "cron",
42683
+ "every_seconds",
42684
+ "statements",
42685
+ "timeout_ms",
42686
+ "enabled",
42687
+ "next_run_at",
42688
+ "created_at"
42689
+ ]) || !matches(value["name"], SCHEDULE_NAME_PATTERN) || !oneOf(["dev", "prod"], value["environment"]) || value["cron"] === null === (value["every_seconds"] === null) || !nullable(value["cron"], isCronText) || !nullable(value["every_seconds"], isEverySeconds) || !Array.isArray(value["statements"]) || value["statements"].length > DATABASE_SCHEDULE_MAX_STATEMENTS || !value["statements"].every((statement) => typeof statement === "string") || !isTimeout(value["timeout_ms"]) || typeof value["enabled"] !== "boolean" || !nullable(value["next_run_at"], timestamp2) || !timestamp2(value["created_at"]))
42690
+ throw new TypeError("Invalid database schedule");
42691
+ }
42692
+ function assertDatabaseSchedulePage(value) {
42693
+ if (!record2(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
42694
+ throw new TypeError("Invalid database schedule page");
42695
+ for (const item of value["items"])
42696
+ assertDatabaseSchedule(item);
42697
+ }
42698
+ function assertDatabaseScheduleDeleted(value) {
42699
+ if (!record2(value) || !exact2(value, ["name", "deleted"]) || !matches(value["name"], SCHEDULE_NAME_PATTERN) || value["deleted"] !== true)
42700
+ throw new TypeError("Invalid database schedule deletion");
42701
+ }
42702
+ function assertDatabaseScheduleRunPage(value) {
42703
+ if (!record2(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
42704
+ throw new TypeError("Invalid database schedule run page");
42705
+ for (const item of value["items"])
42706
+ assertDatabaseScheduleRun(item);
42707
+ }
42708
+ function assertDatabaseScheduleRunAccepted(value) {
42709
+ if (!record2(value) || !exact2(value, ["schedule", "state"]) || !matches(value["schedule"], SCHEDULE_NAME_PATTERN) || value["state"] !== "queued")
42710
+ throw new TypeError("Invalid database schedule run");
42711
+ }
42712
+ function assertDatabaseExecutionUsagePage(value) {
42713
+ if (!record2(value) || !exact2(value, ["items", "next_cursor"]) || !pageItems(value["items"]))
42714
+ throw new TypeError("Invalid database execution usage page");
42715
+ for (const row of value["items"])
42716
+ assertUsageRow(row);
42717
+ if (!nullable(value["next_cursor"], isCursor))
42718
+ throw new TypeError("Invalid database execution usage page");
42719
+ }
42720
+ function assertDatabaseScheduleRun(value) {
42721
+ if (!record2(value) || !exact2(value, [
42722
+ "id",
42723
+ "schedule",
42724
+ "scheduled_at",
42725
+ "started_at",
42726
+ "finished_at",
42727
+ "outcome",
42728
+ "sqlstate",
42729
+ "attempts",
42730
+ "manual"
42731
+ ]) || !nonNegativeInteger(value["id"]) || !matches(value["schedule"], SCHEDULE_NAME_PATTERN) || !timestamp2(value["scheduled_at"]) || !nullable(value["started_at"], timestamp2) || !timestamp2(value["finished_at"]) || !oneOf(DATABASE_SCHEDULE_OUTCOMES, value["outcome"]) || !nullable(value["sqlstate"], (state) => typeof state === "string") || !nonNegativeInteger(value["attempts"]) || typeof value["manual"] !== "boolean")
42732
+ throw new TypeError("Invalid database schedule run");
42733
+ }
42734
+ function assertUsageRow(value) {
42735
+ 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))
42736
+ throw new TypeError("Invalid database execution usage row");
42737
+ const metrics = value["metrics"];
42738
+ if (!DATABASE_EXECUTION_METRICS.every((metric) => nonNegativeInteger(metrics[metric])))
42739
+ throw new TypeError("Invalid database execution usage row");
42740
+ }
42741
+ function assertWebhookFields(value) {
42742
+ if (!matches(value["id"], WEBHOOK_ID_PATTERN) || !oneOf(["dev", "prod"], value["environment"]) || !isHttpsUrl2(value["url"]) || !Array.isArray(value["event_types"]) || value["event_types"].length < 1 || value["event_types"].length > DATABASE_WEBHOOK_MAX_EVENT_TYPES || !value["event_types"].every((type) => oneOf(DATABASE_WEBHOOK_EVENT_TYPES, type)) || !Array.isArray(value["header_names"]) || value["header_names"].length > DATABASE_WEBHOOK_MAX_HEADERS || !value["header_names"].every((name) => matches(name, HEADER_NAME_PATTERN)) || !timestamp2(value["created_at"]))
42743
+ throw new TypeError("Invalid database webhook");
42744
+ }
42745
+ function parseHttpsUrl(value) {
42746
+ if (!isHttpsUrl2(value))
42747
+ throw new TypeError("Invalid database webhook url");
42748
+ return value;
42749
+ }
42750
+ function isHttpsUrl2(value) {
42751
+ if (typeof value !== "string" || value.length > DATABASE_WEBHOOK_URL_MAX_LENGTH)
42752
+ return false;
42753
+ try {
42754
+ return new URL(value).protocol === "https:";
42755
+ } catch {
42756
+ return false;
42757
+ }
42758
+ }
42759
+ function parseEventTypes(value) {
42760
+ if (!Array.isArray(value) || value.length < 1 || value.length > DATABASE_WEBHOOK_MAX_EVENT_TYPES || !value.every((type) => oneOf(DATABASE_WEBHOOK_EVENT_TYPES, type)) || new Set(value).size !== value.length)
42761
+ throw new TypeError("Invalid database webhook event types");
42762
+ return value;
42763
+ }
42764
+ function parseHeaders(value) {
42765
+ 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)
42766
+ throw new TypeError("Invalid database webhook headers");
42767
+ const headers = {};
42768
+ for (const [name, headerValue] of Object.entries(value)) {
42769
+ const lower = name.toLowerCase();
42770
+ if (!HEADER_NAME_PATTERN.test(name) || HEADER_FORBIDDEN_NAMES.includes(lower) || HEADER_FORBIDDEN_PREFIXES.some((prefix) => lower.startsWith(prefix)) || typeof headerValue !== "string" || headerValue.length > 512 || !HEADER_VALUE_PATTERN.test(headerValue))
42771
+ throw new TypeError("Invalid database webhook headers");
42772
+ headers[name] = headerValue;
42773
+ }
42774
+ return headers;
42775
+ }
42776
+ function parseCron(value) {
42777
+ if (!isCronText(value))
42778
+ throw new TypeError("Invalid database schedule cron");
42779
+ return value;
42780
+ }
42781
+ function isCronText(value) {
42782
+ return typeof value === "string" && value.length >= DATABASE_SCHEDULE_CRON_MIN_LENGTH && value.length <= DATABASE_SCHEDULE_CRON_MAX_LENGTH;
42783
+ }
42784
+ function parseEverySeconds(value) {
42785
+ if (!isEverySeconds(value))
42786
+ throw new TypeError("Invalid database schedule interval");
42787
+ return value;
42788
+ }
42789
+ function isEverySeconds(value) {
42790
+ return Number.isSafeInteger(value) && value >= DATABASE_SCHEDULE_MIN_EVERY_SECONDS && value <= DATABASE_SCHEDULE_MAX_EVERY_SECONDS;
42791
+ }
42792
+ function parseTimeout(value) {
42793
+ if (!isTimeout(value))
42794
+ throw new TypeError("Invalid database schedule timeout");
42795
+ return value;
42796
+ }
42797
+ function isTimeout(value) {
42798
+ return Number.isSafeInteger(value) && value >= DATABASE_SCHEDULE_MIN_TIMEOUT_MS && value <= DATABASE_SCHEDULE_MAX_TIMEOUT_MS;
42799
+ }
42800
+ function parseStatements(value) {
42801
+ if (!Array.isArray(value) || value.length < 1 || value.length > DATABASE_SCHEDULE_MAX_STATEMENTS || !value.every((statement) => typeof statement === "string" && statement.trim().length > 0 && !statement.includes("\0") && new TextEncoder().encode(statement).byteLength <= DATABASE_SCHEDULE_STATEMENT_MAX_BYTES) || new TextEncoder().encode(value.join("")).byteLength > DATABASE_SCHEDULE_STATEMENTS_MAX_BYTES)
42802
+ throw new TypeError("Invalid database schedule statements");
42803
+ return value;
42804
+ }
42805
+ function isCursor(value) {
42806
+ return matches(value, CURSOR_PATTERN);
42807
+ }
42808
+ function pageItems(value) {
42809
+ return Array.isArray(value) && value.length <= DATABASE_PAGE_MAX_ITEMS;
42810
+ }
42811
+ function nonNegativeInteger(value) {
42812
+ return Number.isSafeInteger(value) && value >= 0;
42813
+ }
42814
+ function nullable(value, check) {
42815
+ return value === null || check(value);
42816
+ }
42817
+ function matches(value, pattern) {
42818
+ return typeof value === "string" && pattern.test(value);
42819
+ }
42820
+ function oneOf(allowed, value) {
42821
+ return typeof value === "string" && allowed.includes(value);
42822
+ }
42823
+ function timestamp2(value) {
42824
+ if (typeof value !== "string")
42825
+ return false;
42826
+ const time3 = Date.parse(value);
42827
+ return Number.isFinite(time3) && new Date(time3).toISOString() === value;
42828
+ }
42829
+ function record2(value) {
42830
+ return typeof value === "object" && value !== null && !Array.isArray(value);
42831
+ }
42832
+ function onlyKeys(value, allowed) {
42833
+ return Object.keys(value).every((key) => allowed.includes(key));
42834
+ }
42835
+ function exact2(value, keys) {
42836
+ return Object.keys(value).sort().join(",") === [...keys].sort().join(",");
42837
+ }
42838
+
42471
42839
  // packages/contracts/dist/database-sizes.js
42472
42840
  var DATABASE_SIZES = Object.freeze([
42473
42841
  Object.freeze({
@@ -42828,6 +43196,38 @@ var recognizedCommandLabel = (argv) => {
42828
43196
  if (values[1] === "revoke")
42829
43197
  return "database access revoke";
42830
43198
  }
43199
+ if (value === "database" && values[0] === "webhook") {
43200
+ if (values[1] === "create")
43201
+ return "database webhook create";
43202
+ if (values[1] === "list")
43203
+ return "database webhook list";
43204
+ if (values[1] === "get")
43205
+ return "database webhook get";
43206
+ if (values[1] === "delete")
43207
+ return "database webhook delete";
43208
+ if (values[1] === "test")
43209
+ return "database webhook test";
43210
+ if (values[1] === "deliveries")
43211
+ return "database webhook deliveries";
43212
+ if (values[1] === "replay")
43213
+ return "database webhook replay";
43214
+ }
43215
+ if (value === "database" && values[0] === "schedule") {
43216
+ if (values[1] === "set")
43217
+ return "database schedule set";
43218
+ if (values[1] === "list")
43219
+ return "database schedule list";
43220
+ if (values[1] === "get")
43221
+ return "database schedule get";
43222
+ if (values[1] === "delete")
43223
+ return "database schedule delete";
43224
+ if (values[1] === "runs")
43225
+ return "database schedule runs";
43226
+ if (values[1] === "run")
43227
+ return "database schedule run";
43228
+ }
43229
+ if (value === "database" && values[0] === "executions")
43230
+ return "database executions";
42831
43231
  if (value === "database" && values[0] === "psql")
42832
43232
  return "database psql";
42833
43233
  if (value === "link" || value === "plan" || value === "deploy" || value === "logs")
@@ -42928,6 +43328,7 @@ var recognizedCommandLabel = (argv) => {
42928
43328
  }
42929
43329
  return "unknown";
42930
43330
  };
43331
+ var SCHEDULE_RUNS_MAX_ITEMS = 50;
42931
43332
  var parseProductCliCommand = (argv) => {
42932
43333
  const values = [...argv];
42933
43334
  removeFlag(values, "--json");
@@ -42935,9 +43336,11 @@ var parseProductCliCommand = (argv) => {
42935
43336
  if (values.length === 1 && values[0] === "help" || values.length === 0) {
42936
43337
  return { kind: "help" };
42937
43338
  }
43339
+ if (values[0] === "help")
43340
+ return parseProductCliCommand([...values.slice(1), "--help"]);
42938
43341
  if (help) {
42939
- const topic = recognizedCommandLabel(values);
42940
- if (topic === "unknown" || topic === "version" || topic !== values.join(" "))
43342
+ const topic = values.join(" ");
43343
+ if (!/^[a-z][a-z0-9 -]*$/u.test(topic) || topic === "version")
42941
43344
  throw new InvalidCommandError();
42942
43345
  return { kind: "help", topic };
42943
43346
  }
@@ -43642,6 +44045,251 @@ var parseProductCliCommand = (argv) => {
43642
44045
  }
43643
44046
  throw new InvalidCommandError();
43644
44047
  }
44048
+ if (first === "database" && values[0] === "webhook") {
44049
+ values.shift();
44050
+ const subcommand = values.shift();
44051
+ if (subcommand === "create") {
44052
+ if (!yes || wait || follow || revoke || stdin)
44053
+ throw new InvalidCommandError();
44054
+ const options = parseOptionalOptions(values, [
44055
+ "--project",
44056
+ "--environment",
44057
+ "--url",
44058
+ "--event-types",
44059
+ "--headers-file",
44060
+ "--idempotency-key"
44061
+ ]);
44062
+ const projectId = options["--project"], environment = options["--environment"], url = options["--url"], eventTypes = options["--event-types"], headersFile = options["--headers-file"], idempotencyKey = options["--idempotency-key"];
44063
+ if (!isValue(projectId) || !isValue(idempotencyKey) || !isValue(url) || !isValue(eventTypes) || headersFile !== void 0 && !isValue(headersFile) || environment !== "dev" && environment !== "prod")
44064
+ throw new InvalidCommandError();
44065
+ const request = contractValue(() => parseDatabaseWebhookCreateRequest({ url, event_types: eventTypes.split(",") }));
44066
+ return {
44067
+ kind: "database-webhook-create",
44068
+ projectId,
44069
+ environment,
44070
+ url: request.url,
44071
+ eventTypes: request.event_types,
44072
+ headersFile: headersFile ?? null,
44073
+ idempotencyKey,
44074
+ yes: true,
44075
+ credentialStore
44076
+ };
44077
+ }
44078
+ if (subcommand === "list") {
44079
+ if (yes || wait || follow || revoke || stdin)
44080
+ throw new InvalidCommandError();
44081
+ const options = parseOptionalOptions(values, ["--project", "--environment"]);
44082
+ const projectId = options["--project"], environment = options["--environment"] ?? "dev";
44083
+ if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
44084
+ throw new InvalidCommandError();
44085
+ return { kind: "database-webhook-list", projectId, environment, credentialStore };
44086
+ }
44087
+ if (subcommand === "get") {
44088
+ if (yes || wait || follow || revoke || stdin)
44089
+ throw new InvalidCommandError();
44090
+ const options = parseOptionalOptions(values, ["--project", "--environment", "--webhook"]);
44091
+ const projectId = options["--project"], environment = options["--environment"] ?? "dev", webhookId = options["--webhook"];
44092
+ if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
44093
+ throw new InvalidCommandError();
44094
+ return {
44095
+ kind: "database-webhook-get",
44096
+ projectId,
44097
+ environment,
44098
+ webhookId: contractValue(() => parseDatabaseWebhookId(webhookId)),
44099
+ credentialStore
44100
+ };
44101
+ }
44102
+ if (subcommand === "delete" || subcommand === "test") {
44103
+ if (!yes || wait || follow || revoke || stdin)
44104
+ throw new InvalidCommandError();
44105
+ const options = parseOptionalOptions(values, ["--project", "--environment", "--webhook"]);
44106
+ const projectId = options["--project"], environment = options["--environment"], webhookId = options["--webhook"];
44107
+ if (!isValue(projectId))
44108
+ throw new InvalidCommandError();
44109
+ if (environment !== "dev" && environment !== "prod")
44110
+ throw new InvalidCommandError();
44111
+ const target = contractValue(() => parseDatabaseWebhookId(webhookId));
44112
+ if (subcommand === "delete")
44113
+ return {
44114
+ kind: "database-webhook-delete",
44115
+ projectId,
44116
+ environment,
44117
+ webhookId: target,
44118
+ yes: true,
44119
+ credentialStore
44120
+ };
44121
+ return {
44122
+ kind: "database-webhook-test",
44123
+ projectId,
44124
+ environment,
44125
+ webhookId: target,
44126
+ yes: true,
44127
+ credentialStore
44128
+ };
44129
+ }
44130
+ if (subcommand === "deliveries") {
44131
+ if (yes || wait || follow || revoke || stdin)
44132
+ throw new InvalidCommandError();
44133
+ const options = parseOptionalOptions(values, [
44134
+ "--project",
44135
+ "--environment",
44136
+ "--webhook",
44137
+ "--limit",
44138
+ "--cursor"
44139
+ ]);
44140
+ const projectId = options["--project"], environment = options["--environment"] ?? "dev", webhookId = options["--webhook"], limit = options["--limit"], cursor = options["--cursor"];
44141
+ if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
44142
+ throw new InvalidCommandError();
44143
+ return {
44144
+ kind: "database-webhook-deliveries",
44145
+ projectId,
44146
+ environment,
44147
+ webhookId: webhookId === void 0 ? null : contractValue(() => parseDatabaseWebhookId(webhookId)),
44148
+ limit: limit === void 0 ? null : contractValue(() => parseDatabaseListLimit(limit, DATABASE_PAGE_MAX_ITEMS, DATABASE_PAGE_MAX_ITEMS)),
44149
+ cursor: contractValue(() => parseDatabaseCursor(cursor)),
44150
+ credentialStore
44151
+ };
44152
+ }
44153
+ if (subcommand === "replay") {
44154
+ if (!yes || wait || follow || revoke || stdin)
44155
+ throw new InvalidCommandError();
44156
+ const options = parseOptionalOptions(values, ["--project", "--environment", "--delivery"]);
44157
+ const projectId = options["--project"], environment = options["--environment"], deliveryId = options["--delivery"];
44158
+ if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
44159
+ throw new InvalidCommandError();
44160
+ return {
44161
+ kind: "database-webhook-replay",
44162
+ projectId,
44163
+ environment,
44164
+ deliveryId: contractValue(() => parseDatabaseDeliveryId(deliveryId)),
44165
+ yes: true,
44166
+ credentialStore
44167
+ };
44168
+ }
44169
+ throw new InvalidCommandError();
44170
+ }
44171
+ if (first === "database" && values[0] === "schedule") {
44172
+ values.shift();
44173
+ const subcommand = values.shift();
44174
+ if (subcommand === "set") {
44175
+ if (!yes || wait || follow || revoke || stdin)
44176
+ throw new InvalidCommandError();
44177
+ const options = parseOptionalOptions(values, [
44178
+ "--project",
44179
+ "--environment",
44180
+ "--name",
44181
+ "--cron",
44182
+ "--every-seconds",
44183
+ "--statements-file",
44184
+ "--timeout-ms",
44185
+ "--enabled"
44186
+ ]);
44187
+ const projectId = options["--project"], environment = options["--environment"], name = options["--name"], cron = options["--cron"], everySeconds = options["--every-seconds"], statementsFile = options["--statements-file"], timeoutMs = options["--timeout-ms"], enabled = options["--enabled"];
44188
+ if (!isValue(projectId) || !isValue(statementsFile) || environment !== "dev" && environment !== "prod" || cron === void 0 === (everySeconds === void 0) || everySeconds !== void 0 && !/^[0-9]{1,9}$/u.test(everySeconds) || timeoutMs !== void 0 && !/^[0-9]{1,6}$/u.test(timeoutMs) || enabled !== void 0 && enabled !== "true" && enabled !== "false")
44189
+ throw new InvalidCommandError();
44190
+ return {
44191
+ kind: "database-schedule-set",
44192
+ projectId,
44193
+ environment,
44194
+ name: contractValue(() => parseDatabaseScheduleName(name)),
44195
+ cron: cron ?? null,
44196
+ everySeconds: everySeconds === void 0 ? null : Number(everySeconds),
44197
+ statementsFile,
44198
+ timeoutMs: timeoutMs === void 0 ? null : Number(timeoutMs),
44199
+ enabled: enabled === void 0 ? null : enabled === "true",
44200
+ yes: true,
44201
+ credentialStore
44202
+ };
44203
+ }
44204
+ if (subcommand === "list") {
44205
+ if (yes || wait || follow || revoke || stdin)
44206
+ throw new InvalidCommandError();
44207
+ const options = parseOptionalOptions(values, ["--project", "--environment"]);
44208
+ const projectId = options["--project"], environment = options["--environment"] ?? "dev";
44209
+ if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
44210
+ throw new InvalidCommandError();
44211
+ return { kind: "database-schedule-list", projectId, environment, credentialStore };
44212
+ }
44213
+ if (subcommand === "get" || subcommand === "runs") {
44214
+ if (yes || wait || follow || revoke || stdin)
44215
+ throw new InvalidCommandError();
44216
+ const options = parseOptionalOptions(values, subcommand === "get" ? ["--project", "--environment", "--name"] : ["--project", "--environment", "--name", "--limit"]);
44217
+ const projectId = options["--project"], environment = options["--environment"] ?? "dev", name = options["--name"], limit = options["--limit"];
44218
+ if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
44219
+ throw new InvalidCommandError();
44220
+ const scheduleName = contractValue(() => parseDatabaseScheduleName(name));
44221
+ if (subcommand === "get")
44222
+ return {
44223
+ kind: "database-schedule-get",
44224
+ projectId,
44225
+ environment,
44226
+ name: scheduleName,
44227
+ credentialStore
44228
+ };
44229
+ return {
44230
+ kind: "database-schedule-runs",
44231
+ projectId,
44232
+ environment,
44233
+ name: scheduleName,
44234
+ limit: limit === void 0 ? null : contractValue(() => parseDatabaseListLimit(limit, SCHEDULE_RUNS_MAX_ITEMS, SCHEDULE_RUNS_MAX_ITEMS)),
44235
+ credentialStore
44236
+ };
44237
+ }
44238
+ if (subcommand === "delete" || subcommand === "run") {
44239
+ if (!yes || wait || follow || revoke || stdin)
44240
+ throw new InvalidCommandError();
44241
+ const options = parseOptionalOptions(values, ["--project", "--environment", "--name"]);
44242
+ const projectId = options["--project"], environment = options["--environment"];
44243
+ if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
44244
+ throw new InvalidCommandError();
44245
+ const name = contractValue(() => parseDatabaseScheduleName(options["--name"]));
44246
+ return subcommand === "delete" ? {
44247
+ kind: "database-schedule-delete",
44248
+ projectId,
44249
+ environment,
44250
+ name,
44251
+ yes: true,
44252
+ credentialStore
44253
+ } : {
44254
+ kind: "database-schedule-run",
44255
+ projectId,
44256
+ environment,
44257
+ name,
44258
+ yes: true,
44259
+ credentialStore
44260
+ };
44261
+ }
44262
+ throw new InvalidCommandError();
44263
+ }
44264
+ if (first === "database" && values[0] === "executions") {
44265
+ values.shift();
44266
+ if (yes || wait || follow || revoke || stdin)
44267
+ throw new InvalidCommandError();
44268
+ const options = parseOptionalOptions(values, [
44269
+ "--project",
44270
+ "--environment",
44271
+ "--from",
44272
+ "--to",
44273
+ "--granularity",
44274
+ "--limit",
44275
+ "--cursor"
44276
+ ]);
44277
+ const projectId = options["--project"], environment = options["--environment"] ?? "dev", from = options["--from"], to = options["--to"], granularity = options["--granularity"], limit = options["--limit"], cursor = options["--cursor"];
44278
+ if (!isValue(projectId) || environment !== "dev" && environment !== "prod" || !isValue(from) || !isValue(to) || granularity !== "hour" && granularity !== "day")
44279
+ throw new InvalidCommandError();
44280
+ const window = contractValue(() => parseDatabaseUsageWindow(from, to, granularity));
44281
+ return {
44282
+ kind: "database-executions",
44283
+ projectId,
44284
+ environment,
44285
+ from: window.from,
44286
+ to: window.to,
44287
+ granularity: window.granularity,
44288
+ limit: limit === void 0 ? null : contractValue(() => parseDatabaseListLimit(limit, DATABASE_PAGE_MAX_ITEMS, DATABASE_PAGE_MAX_ITEMS)),
44289
+ cursor: contractValue(() => parseDatabaseCursor(cursor)),
44290
+ credentialStore
44291
+ };
44292
+ }
43645
44293
  if (first === "database" && values[0] === "psql") {
43646
44294
  values.shift();
43647
44295
  if (yes || wait || follow || revoke || stdin)
@@ -44262,6 +44910,13 @@ var handedAccount = (userId, organizationId) => {
44262
44910
  return { userId, organizationId };
44263
44911
  };
44264
44912
  var isValue = (value) => value !== void 0 && value.length > 0 && !value.startsWith("--");
44913
+ var contractValue = (parse) => {
44914
+ try {
44915
+ return parse();
44916
+ } catch {
44917
+ throw new InvalidCommandError();
44918
+ }
44919
+ };
44265
44920
  var validGithubBranchName = (value) => !(value.length < 1 || value.length > 1024 || !/^[A-Za-z0-9]/u.test(value) || value.startsWith("-") || value.startsWith("/") || value.endsWith("/") || value.endsWith(".") || value.includes("//") || value.includes("..") || value.includes("@{") || [...value].some((character) => {
44266
44921
  const code = character.codePointAt(0) ?? 0;
44267
44922
  return code <= 32 || code === 127 || "\\~^:?*[]".includes(character);
@@ -44536,7 +45191,7 @@ import { join as join5, resolve as resolve4 } from "node:path";
44536
45191
 
44537
45192
  // packages/contracts/dist/database-access.js
44538
45193
  function parseProjectDatabaseWrite(value) {
44539
- if (!record2(value) || !exact2(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)
45194
+ if (!record3(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)
44540
45195
  throw new TypeError("Invalid database write");
44541
45196
  const budget = { nodes: 0 };
44542
45197
  for (const parameter of value["parameters"])
@@ -44550,7 +45205,7 @@ function parseProjectDatabaseWrite(value) {
44550
45205
  };
44551
45206
  }
44552
45207
  function assertProjectDatabaseWriteReceipt(value) {
44553
- if (!record2(value) || !exact2(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"])))
45208
+ if (!record3(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"])))
44554
45209
  throw new TypeError("Invalid database write receipt");
44555
45210
  if (value["state"] === "succeeded") {
44556
45211
  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)
@@ -44563,7 +45218,7 @@ function assertProjectDatabaseWriteReceipt(value) {
44563
45218
  throw new TypeError("Invalid database write result");
44564
45219
  } else {
44565
45220
  const error = value["error"];
44566
- if (!record2(error) || typeof error["code"] !== "string" || !error["code"].startsWith("database_write_") || JSON.stringify(error) !== JSON.stringify(publicOperationFailure(error["code"])))
45221
+ if (!record3(error) || typeof error["code"] !== "string" || !error["code"].startsWith("database_write_") || JSON.stringify(error) !== JSON.stringify(publicOperationFailure(error["code"])))
44567
45222
  throw new TypeError("Invalid database write error");
44568
45223
  }
44569
45224
  }
@@ -44574,6 +45229,9 @@ var ACCESS_KEYS = [
44574
45229
  "mode",
44575
45230
  "role_name",
44576
45231
  "host",
45232
+ "provider",
45233
+ "transport",
45234
+ "websocket_url",
44577
45235
  "database",
44578
45236
  "label",
44579
45237
  "state",
@@ -44584,16 +45242,16 @@ var ACCESS_KEYS = [
44584
45242
  ];
44585
45243
  var ACCESS_ROLE_PATTERN = /^ohmyho_da_[0-7][0-9a-hjkmnp-tv-z]{25}_[0-9a-z]{8}$/u;
44586
45244
  function assertProjectDatabaseAccess(value) {
44587
- if (!record2(value) || !exact2(value, accessKeys(value)))
45245
+ if (!record3(value) || !exact3(value, ACCESS_KEYS))
44588
45246
  throw new TypeError("Invalid database access");
44589
45247
  assertAccessFields(value);
44590
45248
  }
44591
45249
  function assertProjectDatabaseAccessCredential(value) {
44592
- if (!record2(value) || !exact2(value, [...accessKeys(value), "connection_uri", "psql_command"]))
45250
+ if (!record3(value) || !exact3(value, [...ACCESS_KEYS, "connection_uri", "psql_command"]))
44593
45251
  throw new TypeError("Invalid database access credential");
44594
45252
  assertAccessFields(value);
44595
45253
  const uri = value["connection_uri"];
44596
- if (typeof uri !== "string" || (value["provider"] === "pgcf" ? typeof value["psql_command"] !== "string" || !new RegExp(`^ohmyhost database psql --project [0-7][0-9A-HJKMNP-TV-Z]{25} --environment ${value["environment"]} --mode ${value["mode"]}$`, "u").test(value["psql_command"]) : value["psql_command"] !== `psql '${uri}'`))
45254
+ if (typeof uri !== "string" || typeof value["psql_command"] !== "string" || !new RegExp(`^ohmyhost database psql --project [0-7][0-9A-HJKMNP-TV-Z]{25} --environment ${value["environment"]} --mode ${value["mode"]}$`, "u").test(value["psql_command"]))
44597
45255
  throw new TypeError("Invalid database access credential");
44598
45256
  let parsed;
44599
45257
  try {
@@ -44601,21 +45259,18 @@ function assertProjectDatabaseAccessCredential(value) {
44601
45259
  } catch {
44602
45260
  throw new TypeError("Invalid database access credential");
44603
45261
  }
44604
- if ((value["provider"] === "pgcf" ? !["postgres:", "postgresql:"].includes(parsed.protocol) : parsed.protocol !== "postgresql:") || decodeURIComponent(parsed.username) !== value["role_name"] || parsed.password === "" || parsed.hostname !== value["host"] || (value["provider"] === "pgcf" ? parsed.port !== "" && parsed.port !== "5432" : parsed.host !== value["host"]) || decodeURIComponent(parsed.pathname.slice(1)) !== value["database"] || parsed.hash !== "" || (value["provider"] === "pgcf" ? !["", "?sslmode=require", "?sslmode=verify-full"].includes(parsed.search) : parsed.search !== "?sslmode=require"))
45262
+ if (!["postgres:", "postgresql:"].includes(parsed.protocol) || decodeURIComponent(parsed.username) !== value["role_name"] || parsed.password === "" || parsed.hostname !== value["host"] || parsed.port !== "" && parsed.port !== "5432" || decodeURIComponent(parsed.pathname.slice(1)) !== value["database"] || parsed.hash !== "" || !["", "?sslmode=require", "?sslmode=verify-full"].includes(parsed.search))
44605
45263
  throw new TypeError("Invalid database access credential");
44606
45264
  }
44607
45265
  function assertProjectDatabaseAccessPage(value) {
44608
- if (!record2(value) || !exact2(value, ["items"]) || !Array.isArray(value["items"]) || value["items"].length > 50)
45266
+ if (!record3(value) || !exact3(value, ["items"]) || !Array.isArray(value["items"]) || value["items"].length > 50)
44609
45267
  throw new TypeError("Invalid database access page");
44610
45268
  for (const item of value["items"])
44611
45269
  assertProjectDatabaseAccess(item);
44612
45270
  }
44613
- function accessKeys(value) {
44614
- return value["provider"] === "pgcf" ? [...ACCESS_KEYS, "provider", "transport", "websocket_url"] : ACCESS_KEYS;
44615
- }
44616
45271
  function assertAccessFields(value) {
44617
45272
  const revoked = value["revoked_at"], reason = value["revocation_reason"];
44618
- if (typeof value["access_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value["access_id"]) || !["dev", "prod"].includes(String(value["environment"])) || !["read", "write"].includes(String(value["mode"])) || typeof value["role_name"] !== "string" || !ACCESS_ROLE_PATTERN.test(value["role_name"]) || typeof value["host"] !== "string" || !/^[a-z0-9]([a-z0-9.-]{0,251}[a-z0-9])?$/u.test(value["host"]) || (value["provider"] === "pgcf" ? typeof value["database"] !== "string" || !/^[a-z][a-z0-9]{19}$/u.test(value["database"]) || value["transport"] !== "wss" || value["websocket_url"] !== `wss://${value["host"]}/` : value["database"] !== "neondb") || value["label"] !== null && accessLabel(value["label"]) !== value["label"] || !["active", "expired", "revoked"].includes(String(value["state"])) || !timestamp2(value["issued_at"]) || !timestamp2(value["expires_at"]) || Date.parse(String(value["expires_at"])) <= Date.parse(String(value["issued_at"])) || revoked !== null && !timestamp2(revoked) || revoked === null !== (reason === null) || reason !== null && !["principal", "expired", "budget", "creation_failed", "data_change"].includes(String(reason)) || value["state"] === "revoked" !== (revoked !== null))
45273
+ if (typeof value["access_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value["access_id"]) || !["dev", "prod"].includes(String(value["environment"])) || !["read", "write"].includes(String(value["mode"])) || typeof value["role_name"] !== "string" || !ACCESS_ROLE_PATTERN.test(value["role_name"]) || typeof value["host"] !== "string" || !/^[a-z0-9]([a-z0-9.-]{0,251}[a-z0-9])?$/u.test(value["host"]) || value["provider"] !== "pgcf" || value["transport"] !== "wss" || value["websocket_url"] !== `wss://${value["host"]}/` || typeof value["database"] !== "string" || !/^[a-z][a-z0-9]{19}$/u.test(value["database"]) || value["label"] !== null && accessLabel(value["label"]) !== value["label"] || !["active", "expired", "revoked"].includes(String(value["state"])) || !timestamp3(value["issued_at"]) || !timestamp3(value["expires_at"]) || Date.parse(String(value["expires_at"])) <= Date.parse(String(value["issued_at"])) || revoked !== null && !timestamp3(revoked) || revoked === null !== (reason === null) || reason !== null && !["principal", "expired", "budget", "creation_failed", "data_change"].includes(String(reason)) || value["state"] === "revoked" !== (revoked !== null))
44619
45274
  throw new TypeError("Invalid database access");
44620
45275
  }
44621
45276
  function accessLabel(value) {
@@ -44628,7 +45283,7 @@ function accessLabel(value) {
44628
45283
  throw new TypeError("Invalid database access label");
44629
45284
  return label;
44630
45285
  }
44631
- function timestamp2(value) {
45286
+ function timestamp3(value) {
44632
45287
  return typeof value === "string" && new Date(value).toISOString() === value;
44633
45288
  }
44634
45289
  function json(value, depth, budget) {
@@ -44643,32 +45298,32 @@ function json(value, depth, budget) {
44643
45298
  json(entry, depth + 1, budget);
44644
45299
  return;
44645
45300
  }
44646
- if (record2(value)) {
45301
+ if (record3(value)) {
44647
45302
  for (const entry of Object.values(value))
44648
45303
  json(entry, depth + 1, budget);
44649
45304
  return;
44650
45305
  }
44651
45306
  throw new TypeError("Invalid database parameter");
44652
45307
  }
44653
- function record2(value) {
45308
+ function record3(value) {
44654
45309
  return typeof value === "object" && value !== null && !Array.isArray(value);
44655
45310
  }
44656
- function exact2(value, keys) {
45311
+ function exact3(value, keys) {
44657
45312
  return Object.keys(value).sort().join(",") === [...keys].sort().join(",");
44658
45313
  }
44659
45314
 
44660
45315
  // packages/contracts/dist/database-compute.js
44661
45316
  function assertDatabaseCompute(value) {
44662
- if (!record3(value) || !exact3(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"])
45317
+ if (!record4(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"])
44663
45318
  throw new TypeError("Invalid database compute report");
44664
45319
  const db = value["database"];
44665
45320
  if (db === null)
44666
45321
  return;
44667
- if (record3(db) && db["provider"] === "pgcf") {
45322
+ if (record4(db) && db["provider"] === "pgcf") {
44668
45323
  assertPgcfCompute(db);
44669
45324
  return;
44670
45325
  }
44671
- if (!record3(db) || !exact3(db, [
45326
+ if (!record4(db) || !exact4(db, [
44672
45327
  "disabled",
44673
45328
  "max_cu",
44674
45329
  "max_memory_gb",
@@ -44684,7 +45339,7 @@ function assertDatabaseCompute(value) {
44684
45339
  function assertPgcfCompute(db) {
44685
45340
  const size = databaseSizeForClass(db["size_class_id"]);
44686
45341
  const states = ["provisioning", "cold", "warm", "suspended", "error"];
44687
- if (!exact3(db, [
45342
+ if (!exact4(db, [
44688
45343
  "cpu_millicores",
44689
45344
  "disabled",
44690
45345
  "max_connections",
@@ -44699,17 +45354,17 @@ function assertPgcfCompute(db) {
44699
45354
  ]) || 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"])))
44700
45355
  throw new TypeError("Invalid fixed database compute configuration");
44701
45356
  }
44702
- function record3(v) {
45357
+ function record4(v) {
44703
45358
  return typeof v === "object" && v !== null && !Array.isArray(v);
44704
45359
  }
44705
- function exact3(v, keys) {
45360
+ function exact4(v, keys) {
44706
45361
  return Object.keys(v).sort().join(",") === keys.join(",");
44707
45362
  }
44708
45363
 
44709
45364
  // apps/product-cli/package.json
44710
45365
  var package_default = {
44711
45366
  name: "@ohmyhost/product-cli",
44712
- version: "0.1.41",
45367
+ version: "0.1.42",
44713
45368
  private: true,
44714
45369
  ohmyhost: {
44715
45370
  deployment: "production",
@@ -44756,32 +45411,32 @@ var package_default = {
44756
45411
  };
44757
45412
 
44758
45413
  // packages/contracts/dist/project-context.js
44759
- var record4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
44760
- var timestamp3 = (v) => typeof v === "string" && Number.isFinite(Date.parse(v)) && new Date(v).toISOString() === v;
45414
+ var record5 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
45415
+ var timestamp4 = (v) => typeof v === "string" && Number.isFinite(Date.parse(v)) && new Date(v).toISOString() === v;
44761
45416
  var version = (v) => Number.isInteger(v) && Number(v) >= 0 && Number(v) <= 2147483647;
44762
45417
  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;
44763
45418
  function assertProjectNotesReceipt(v) {
44764
- if (!record4(v) || Object.keys(v).sort().join(",") !== "updated_at,version" || !version(v["version"]) || v["version"] === 0 || !timestamp3(v["updated_at"]))
45419
+ if (!record5(v) || Object.keys(v).sort().join(",") !== "updated_at,version" || !version(v["version"]) || v["version"] === 0 || !timestamp4(v["updated_at"]))
44765
45420
  throw new TypeError("Invalid project notes receipt");
44766
45421
  }
44767
45422
  function assertProjectContext(v) {
44768
- if (!record4(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"]) || !timestamp3(v["generated_at"]) || !["included", "not_authorized"].includes(String(v["credit_access"])) || !bounded(v["markdown"], 500, 32768))
45423
+ if (!record5(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))
44769
45424
  throw new TypeError("Invalid project context");
44770
45425
  const notes = v["notes"];
44771
- if (!record4(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"] !== "" : !timestamp3(notes["updated_at"])))
45426
+ if (!record5(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"])))
44772
45427
  throw new TypeError("Invalid project notes");
44773
45428
  }
44774
45429
 
44775
45430
  // packages/contracts/dist/project-exports.js
44776
45431
  function assertProjectExport(value) {
44777
- if (!record5(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"])) || !timestamp4(value["requested_at"]) || !timestamp4(value["next_request_at"]))
45432
+ if (!record6(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"]))
44778
45433
  invalid4();
44779
45434
  const active = value["state"] === "queued" || value["state"] === "running";
44780
45435
  if (value["next_poll_after_seconds"] !== (active ? 5 : null))
44781
45436
  invalid4();
44782
45437
  if (value["state"] === "failed") {
44783
45438
  const error = value["error"];
44784
- if (!record5(error) || Object.keys(error).sort().join(",") !== "code,message,retryable,suggested_action" || typeof error["code"] !== "string")
45439
+ if (!record6(error) || Object.keys(error).sort().join(",") !== "code,message,retryable,suggested_action" || typeof error["code"] !== "string")
44785
45440
  invalid4();
44786
45441
  const expected = publicOperationFailure(error["code"]);
44787
45442
  for (const key of Object.keys(expected))
@@ -44795,14 +45450,14 @@ function assertProjectExport(value) {
44795
45450
  invalid4();
44796
45451
  return;
44797
45452
  }
44798
- if (value["state"] !== "succeeded" || !record5(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"]) || !['["dev.sql"]', '["prod.sql"]', '["dev.sql","prod.sql"]', '["shared.sql"]'].includes(JSON.stringify(archive["sql_files"])) || !timestamp4(archive["captured_at"]) || !timestamp4(archive["expires_at"]))
45453
+ if (value["state"] !== "succeeded" || !record6(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"]) || !['["dev.sql"]', '["prod.sql"]', '["dev.sql","prod.sql"]', '["shared.sql"]'].includes(JSON.stringify(archive["sql_files"])) || !timestamp5(archive["captured_at"]) || !timestamp5(archive["expires_at"]))
44799
45454
  invalid4();
44800
45455
  if (archive["download_url"] === null) {
44801
45456
  if (archive["download_expires_at"] !== null)
44802
45457
  invalid4();
44803
45458
  return;
44804
45459
  }
44805
- if (typeof archive["download_url"] !== "string" || !timestamp4(archive["download_expires_at"]) || Date.parse(archive["download_expires_at"]) > Date.parse(archive["expires_at"]))
45460
+ if (typeof archive["download_url"] !== "string" || !timestamp5(archive["download_expires_at"]) || Date.parse(archive["download_expires_at"]) > Date.parse(archive["expires_at"]))
44806
45461
  invalid4();
44807
45462
  let url;
44808
45463
  try {
@@ -44814,10 +45469,10 @@ function assertProjectExport(value) {
44814
45469
  invalid4();
44815
45470
  }
44816
45471
  var id = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
44817
- function record5(value) {
45472
+ function record6(value) {
44818
45473
  return typeof value === "object" && value !== null && !Array.isArray(value);
44819
45474
  }
44820
- function timestamp4(value) {
45475
+ function timestamp5(value) {
44821
45476
  return typeof value === "string" && Number.isFinite(Date.parse(value)) && new Date(value).toISOString() === value;
44822
45477
  }
44823
45478
  function invalid4() {
@@ -44835,11 +45490,11 @@ function assertBillingTaxIssue(value) {
44835
45490
  "billing_tax_location_required",
44836
45491
  "billing_tax_calculation_failed",
44837
45492
  "billing_tax_configuration_required"
44838
- ].includes(String(v["code"])) || typeof v["invoice_id"] !== "string" || !/^in_[A-Za-z0-9_]{1,253}$/u.test(v["invoice_id"]) || !timestamp5(v["observed_at"]) || v["required_action"] !== (v["code"] === "billing_tax_location_required" ? "open_billing_portal" : "contact_support"))
45493
+ ].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"))
44839
45494
  throw new Error("billing_response_invalid");
44840
45495
  }
44841
45496
  var ulid4 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
44842
- var timestamp5 = (v) => typeof v === "string" && Number.isFinite(Date.parse(v)) && new Date(v).toISOString() === v;
45497
+ var timestamp6 = (v) => typeof v === "string" && Number.isFinite(Date.parse(v)) && new Date(v).toISOString() === v;
44843
45498
  function stripeUrl(value, host2) {
44844
45499
  if (typeof value !== "string" || value.length > 8192)
44845
45500
  return false;
@@ -44854,7 +45509,7 @@ function assertBillingCheckout(value) {
44854
45509
  if (!value || typeof value !== "object" || Array.isArray(value))
44855
45510
  throw new Error("billing_response_invalid");
44856
45511
  const v = value;
44857
- 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") || !timestamp5(v["expires_at"]) || v["paid_until"] !== null && !timestamp5(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)))
45512
+ 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)))
44858
45513
  throw new Error("billing_response_invalid");
44859
45514
  assertBillingTaxIssue(v["billing_issue"]);
44860
45515
  }
@@ -44862,7 +45517,7 @@ function assertBillingPortal(value) {
44862
45517
  if (!value || typeof value !== "object" || Array.isArray(value))
44863
45518
  throw new Error("billing_response_invalid");
44864
45519
  const v = value;
44865
- if (Object.keys(v).sort().join(",") !== "created_at,organization_id,url" || typeof v["organization_id"] !== "string" || !ulid4.test(v["organization_id"]) || !timestamp5(v["created_at"]) || !stripeUrl(v["url"], "billing.stripe.com"))
45520
+ 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"))
44866
45521
  throw new Error("billing_response_invalid");
44867
45522
  }
44868
45523
  function assertRecharge(value) {
@@ -45054,6 +45709,20 @@ var HELP_USAGE = Object.freeze({
45054
45709
  "database access create": "ohmyhost database access create --project ULID --environment dev|prod [--mode read|write] [--ttl 5m|1h|24h|SECONDS] [--label TEXT] --yes --json\n The connection URI is shown once. Use it immediately, never store it in files, notes or source, and revoke it when finished.",
45055
45710
  "database access list": "ohmyhost database access list --project ULID [--environment dev|prod] --json",
45056
45711
  "database access revoke": "ohmyhost database access revoke --project ULID --access ULID --yes --json",
45712
+ "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; the headers file is a UTF-8 JSON object of at most 8 KiB)",
45713
+ "database webhook list": "ohmyhost database webhook list --project ULID [--environment dev|prod] --json (dev when omitted; the secret is never listed)",
45714
+ "database webhook get": "ohmyhost database webhook get --project ULID [--environment dev|prod] --webhook ID --json",
45715
+ "database webhook delete": "ohmyhost database webhook delete --project ULID --environment dev|prod --webhook ID --yes --json",
45716
+ "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)",
45717
+ "database webhook deliveries": "ohmyhost database webhook deliveries --project ULID [--environment dev|prod] [--webhook ID] [--limit 1..100] [--cursor CURSOR] --json",
45718
+ "database webhook replay": "ohmyhost database webhook replay --project ULID --environment dev|prod --delivery ID --yes --json",
45719
+ "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)",
45720
+ "database schedule list": "ohmyhost database schedule list --project ULID [--environment dev|prod] --json (dev when omitted)",
45721
+ "database schedule get": "ohmyhost database schedule get --project ULID [--environment dev|prod] --name NAME --json",
45722
+ "database schedule delete": "ohmyhost database schedule delete --project ULID --environment dev|prod --name NAME --yes --json",
45723
+ "database schedule runs": "ohmyhost database schedule runs --project ULID [--environment dev|prod] --name NAME [--limit 1..50] --json",
45724
+ "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)",
45725
+ "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; usage counters only, nothing is charged for them until the operator prices them)",
45057
45726
  "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)",
45058
45727
  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)",
45059
45728
  "source auto-deploy set": "ohmyhost source auto-deploy set --project ULID --branch BRANCH --enabled true|false --idempotency-key KEY --json",
@@ -45120,12 +45789,19 @@ var HELP_USAGE = Object.freeze({
45120
45789
  "mail domain delete": "ohmyhost mail domain delete --project ULID --environment ULID --idempotency-key KEY --yes --json"
45121
45790
  });
45122
45791
  var HELP_COMMANDS = Object.freeze(Object.entries(HELP_USAGE).map(([command, usage]) => Object.freeze({ command, usage })));
45792
+ var helpEntries = (topic) => {
45793
+ if (topic === void 0)
45794
+ return HELP_COMMANDS;
45795
+ const exact7 = HELP_COMMANDS.filter((entry) => entry.command === topic);
45796
+ return exact7.length > 0 ? exact7 : HELP_COMMANDS.filter((entry) => entry.command.startsWith(`${topic} `));
45797
+ };
45798
+ var helpTopicKnown = (topic) => helpEntries(topic).length > 0;
45123
45799
  var cliMetadataResult = (kind, topic) => kind === "help" ? success("help", {
45124
45800
  status: "succeeded",
45125
45801
  cli_version: CLI_VERSION,
45126
45802
  usage: "ohmyhost <command> [options] [--profile-name NAME] --json",
45127
45803
  environment: "OHMYHOST_ENVIRONMENT=development|production (default: production); OHMYHOST_PROFILE=NAME binds this process to one saved login",
45128
- commands: HELP_COMMANDS.filter((entry) => !topic || entry.command === topic)
45804
+ commands: helpEntries(topic)
45129
45805
  }) : success("version", { status: "succeeded", cli_version: CLI_VERSION });
45130
45806
  var invalidCommandAction = (argv, commandPrefix) => {
45131
45807
  const label = recognizedCommandLabel(argv);
@@ -45142,11 +45818,22 @@ var invalidCommandAction = (argv, commandPrefix) => {
45142
45818
  const linkable = /(?:^|\s)--project ULID/u.test(usage) && !argv.includes("--project");
45143
45819
  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.` : ""}`;
45144
45820
  };
45145
- var INTERNAL_ERROR_ACTION = "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 run the same command again with the same --idempotency-key. If the current client fails the same way, report it with feedback submit (kind bug, error code internal_error) and quote that stderr line.";
45821
+ var retryAdvice = (command) => {
45822
+ const usage = Object.hasOwn(HELP_USAGE, command) ? HELP_USAGE[command] : "";
45823
+ if (usage.includes("--idempotency-key"))
45824
+ 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";
45825
+ if (usage.includes("--yes"))
45826
+ 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";
45827
+ return "run the same command again; this command has no idempotency key, so check its current state first if it may have changed anything";
45828
+ };
45829
+ 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.`;
45146
45830
  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.";
45147
- var RESPONSE_CONTRACT_INVALID_ACTION = "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 run the same command again with the same --idempotency-key: the change may already have been applied. If the current version answers this too, report it with feedback submit (kind bug, error code response_contract_invalid).";
45148
- var REQUEST_TIMEOUT_ACTION = "The ohmyho.st API did not answer within 30 seconds. Run the same command again with the same --idempotency-key; the change may already be under way, and a new key could apply it twice.";
45831
+ 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).`;
45832
+ var requestTimeoutAction = (command) => `The ohmyho.st API did not answer within 30 seconds; ${retryAdvice(command)}.`;
45149
45833
  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.";
45834
+ 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.";
45835
+ 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.";
45836
+ var SCHEDULE_INVALID_ACTION = "Check the schedule request: --cron takes five fields in UTC (9 to 120 characters), or --every-seconds takes 60 to 2678400, never both; --timeout-ms takes 1000 to 30000; the statements file must hold 1 to 20 non-blank SQL strings of at most 16 KiB each and 64 KiB in total. Nothing was saved; fix it and run the command again.";
45150
45837
  var STATEMENT_FILE_INVALID_ACTION = "Put one INSERT, UPDATE or DELETE statement that starts with that keyword (no leading comment or WITH), UTF-8, at most 64 KiB, in the file named by --statement-file, then rerun with the same --idempotency-key.";
45151
45838
  var signInCommand = (commandPrefix, profile) => profile === void 0 ? `${commandPrefix} login --json` : `${commandPrefix} login${profile.organizationId === null ? "" : ` --organization ${profile.organizationId}`} --user ${profile.userId} --profile-name ${profile.name} --json`;
45152
45839
  var endedLoginAction = (commandPrefix, profile) => `The sign-in of ${profile === void 0 ? "this computer's saved login" : `saved login ${profile.name} (user ${profile.userId}${profile.organizationId === null ? "" : `, organization ${profile.organizationId}`})`} ended and it was removed. Run '${signInCommand(commandPrefix, profile)}' to sign it in again.`;
@@ -45179,6 +45866,8 @@ var ProductCli = class {
45179
45866
  let command;
45180
45867
  try {
45181
45868
  command = parseProductCliCommand(argv);
45869
+ if (command.kind === "help" && command.topic !== void 0 && !helpTopicKnown(command.topic))
45870
+ throw new InvalidCommandError();
45182
45871
  } catch (error) {
45183
45872
  if (error instanceof InvalidCommandError) {
45184
45873
  return failure(recognizedCommandLabel(argv), 2, "invalid_command", false, invalidCommandAction(argv, this.dependencies.commandPrefix));
@@ -45188,7 +45877,7 @@ var ProductCli = class {
45188
45877
  subsystem: "parser",
45189
45878
  errorKind: "unexpected"
45190
45879
  });
45191
- return failure(recognizedCommandLabel(argv), 1, "internal_error", false, INTERNAL_ERROR_ACTION);
45880
+ return failure(recognizedCommandLabel(argv), 1, "internal_error", false, internalErrorAction(recognizedCommandLabel(argv)));
45192
45881
  }
45193
45882
  return this.runCommand(command, signal);
45194
45883
  }
@@ -45511,6 +46200,34 @@ var ProductCli = class {
45511
46200
  return await this.listDatabaseAccess(command, signal);
45512
46201
  if (command.kind === "database-access-revoke")
45513
46202
  return await this.revokeDatabaseAccess(command, signal);
46203
+ if (command.kind === "database-webhook-create")
46204
+ return await this.createDatabaseWebhook(command, signal);
46205
+ if (command.kind === "database-webhook-list")
46206
+ return await this.listDatabaseWebhooks(command, signal);
46207
+ if (command.kind === "database-webhook-get")
46208
+ return await this.getDatabaseWebhook(command, signal);
46209
+ if (command.kind === "database-webhook-delete")
46210
+ return await this.deleteDatabaseWebhook(command, signal);
46211
+ if (command.kind === "database-webhook-test")
46212
+ return await this.testDatabaseWebhook(command, signal);
46213
+ if (command.kind === "database-webhook-deliveries")
46214
+ return await this.listDatabaseWebhookDeliveries(command, signal);
46215
+ if (command.kind === "database-webhook-replay")
46216
+ return await this.replayDatabaseWebhookDelivery(command, signal);
46217
+ if (command.kind === "database-schedule-set")
46218
+ return await this.setDatabaseSchedule(command, signal);
46219
+ if (command.kind === "database-schedule-list")
46220
+ return await this.listDatabaseSchedules(command, signal);
46221
+ if (command.kind === "database-schedule-get")
46222
+ return await this.getDatabaseSchedule(command, signal);
46223
+ if (command.kind === "database-schedule-delete")
46224
+ return await this.deleteDatabaseSchedule(command, signal);
46225
+ if (command.kind === "database-schedule-runs")
46226
+ return await this.listDatabaseScheduleRuns(command, signal);
46227
+ if (command.kind === "database-schedule-run")
46228
+ return await this.runDatabaseSchedule(command, signal);
46229
+ if (command.kind === "database-executions")
46230
+ return await this.getDatabaseExecutionUsage(command, signal);
45514
46231
  if (command.kind === "database-psql")
45515
46232
  return await this.runProjectPsql(command, signal);
45516
46233
  if (command.kind === "link")
@@ -45860,7 +46577,7 @@ var ProductCli = class {
45860
46577
  if (revocationError instanceof ProviderCapabilityBlockedError) {
45861
46578
  throw new ProductCliFailure(9, "blocked_prerequisite", false, "Remote token revocation is not available in this release.");
45862
46579
  }
45863
- if (isTimeout(revocationError)) {
46580
+ if (isTimeout2(revocationError)) {
45864
46581
  throw new ProductCliFailure(8, "request_timeout", false, LOGOUT_UNCONFIRMED_ACTION);
45865
46582
  }
45866
46583
  if (revocationError instanceof LifecycleTransportError) {
@@ -46014,6 +46731,153 @@ var ProductCli = class {
46014
46731
  assertProjectDatabaseAccess(access);
46015
46732
  return success("database access revoke", { status: "succeeded", access });
46016
46733
  }
46734
+ /** The signing secret is returned by create only; every other answer carries no secret. */
46735
+ async createDatabaseWebhook(command, signal) {
46736
+ const request = await webhookCreateRequest(command);
46737
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46738
+ const webhook = await api.createProjectDatabaseWebhook({
46739
+ projectId: command.projectId,
46740
+ environment: command.environment,
46741
+ idempotencyKey: command.idempotencyKey,
46742
+ url: request.url,
46743
+ eventTypes: request.event_types,
46744
+ headers: request.headers
46745
+ });
46746
+ return success("database webhook create", { status: "succeeded", webhook });
46747
+ }
46748
+ async listDatabaseWebhooks(command, signal) {
46749
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46750
+ const page = await api.listProjectDatabaseWebhooks({
46751
+ projectId: command.projectId,
46752
+ environment: command.environment
46753
+ });
46754
+ return success("database webhook list", { status: "succeeded", webhook: page.items });
46755
+ }
46756
+ async getDatabaseWebhook(command, signal) {
46757
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46758
+ const webhook = await api.getProjectDatabaseWebhook({
46759
+ projectId: command.projectId,
46760
+ environment: command.environment,
46761
+ webhookId: command.webhookId
46762
+ });
46763
+ return success("database webhook get", { status: "succeeded", webhook });
46764
+ }
46765
+ async deleteDatabaseWebhook(command, signal) {
46766
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46767
+ const deleted = await api.deleteProjectDatabaseWebhook({
46768
+ projectId: command.projectId,
46769
+ environment: command.environment,
46770
+ webhookId: command.webhookId
46771
+ });
46772
+ return success("database webhook delete", { status: "succeeded", deleted });
46773
+ }
46774
+ async testDatabaseWebhook(command, signal) {
46775
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46776
+ const result = await api.testProjectDatabaseWebhook({
46777
+ projectId: command.projectId,
46778
+ environment: command.environment,
46779
+ webhookId: command.webhookId
46780
+ });
46781
+ return success("database webhook test", { status: "succeeded", result });
46782
+ }
46783
+ async listDatabaseWebhookDeliveries(command, signal) {
46784
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46785
+ const page = await api.listProjectDatabaseWebhookDeliveries({
46786
+ projectId: command.projectId,
46787
+ environment: command.environment,
46788
+ ...command.webhookId === null ? {} : { webhookId: command.webhookId },
46789
+ ...command.limit === null ? {} : { limit: command.limit },
46790
+ ...command.cursor === null ? {} : { cursor: command.cursor }
46791
+ });
46792
+ return success("database webhook deliveries", {
46793
+ status: "succeeded",
46794
+ delivery: page.items,
46795
+ next_cursor: page.next_cursor
46796
+ });
46797
+ }
46798
+ async replayDatabaseWebhookDelivery(command, signal) {
46799
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46800
+ const replay = await api.replayProjectDatabaseWebhookDelivery({
46801
+ projectId: command.projectId,
46802
+ environment: command.environment,
46803
+ deliveryId: command.deliveryId
46804
+ });
46805
+ return success("database webhook replay", { status: "succeeded", replay });
46806
+ }
46807
+ /** The statements file and the schedule fields are checked before any request is sent. */
46808
+ async setDatabaseSchedule(command, signal) {
46809
+ const request = await scheduleSetRequest(command);
46810
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46811
+ const schedule = await api.setProjectDatabaseSchedule({
46812
+ projectId: command.projectId,
46813
+ environment: command.environment,
46814
+ name: command.name,
46815
+ request
46816
+ });
46817
+ return success("database schedule set", { status: "succeeded", schedule });
46818
+ }
46819
+ async listDatabaseSchedules(command, signal) {
46820
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46821
+ const page = await api.listProjectDatabaseSchedules({
46822
+ projectId: command.projectId,
46823
+ environment: command.environment
46824
+ });
46825
+ return success("database schedule list", { status: "succeeded", schedule: page.items });
46826
+ }
46827
+ async getDatabaseSchedule(command, signal) {
46828
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46829
+ const schedule = await api.getProjectDatabaseSchedule({
46830
+ projectId: command.projectId,
46831
+ environment: command.environment,
46832
+ name: command.name
46833
+ });
46834
+ return success("database schedule get", { status: "succeeded", schedule });
46835
+ }
46836
+ async deleteDatabaseSchedule(command, signal) {
46837
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46838
+ const deleted = await api.deleteProjectDatabaseSchedule({
46839
+ projectId: command.projectId,
46840
+ environment: command.environment,
46841
+ name: command.name
46842
+ });
46843
+ return success("database schedule delete", { status: "succeeded", deleted });
46844
+ }
46845
+ async listDatabaseScheduleRuns(command, signal) {
46846
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46847
+ const page = await api.listProjectDatabaseScheduleRuns({
46848
+ projectId: command.projectId,
46849
+ environment: command.environment,
46850
+ name: command.name,
46851
+ ...command.limit === null ? {} : { limit: command.limit }
46852
+ });
46853
+ return success("database schedule runs", { status: "succeeded", schedule_run: page.items });
46854
+ }
46855
+ async runDatabaseSchedule(command, signal) {
46856
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46857
+ const run = await api.runProjectDatabaseSchedule({
46858
+ projectId: command.projectId,
46859
+ environment: command.environment,
46860
+ name: command.name
46861
+ });
46862
+ return success("database schedule run", { status: "succeeded", run });
46863
+ }
46864
+ async getDatabaseExecutionUsage(command, signal) {
46865
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46866
+ const page = await api.getProjectDatabaseExecutionUsage({
46867
+ projectId: command.projectId,
46868
+ environment: command.environment,
46869
+ from: command.from,
46870
+ to: command.to,
46871
+ granularity: command.granularity,
46872
+ ...command.limit === null ? {} : { limit: command.limit },
46873
+ ...command.cursor === null ? {} : { cursor: command.cursor }
46874
+ });
46875
+ return success("database executions", {
46876
+ status: "succeeded",
46877
+ usage: page.items,
46878
+ next_cursor: page.next_cursor
46879
+ });
46880
+ }
46017
46881
  /** psql receives the password through its own environment; the URI is never printed. */
46018
46882
  async runProjectPsql(command, signal) {
46019
46883
  const spawnPsql = this.dependencies.spawnPsql;
@@ -46037,7 +46901,7 @@ var ProductCli = class {
46037
46901
  host: credential.host,
46038
46902
  user: credential.role_name,
46039
46903
  password: decodeURIComponent(new URL(credential.connection_uri).password),
46040
- ...credential.provider === "pgcf" ? { websocketUrl: credential.websocket_url } : {},
46904
+ websocketUrl: credential.websocket_url,
46041
46905
  database: credential.database,
46042
46906
  mode: credential.mode,
46043
46907
  signal
@@ -46572,8 +47436,8 @@ var ProductCli = class {
46572
47436
  if (error instanceof ProviderCapabilityBlockedError) {
46573
47437
  throw new ProductCliFailure(9, "blocked_prerequisite", false, "Token refresh is not available in this release; run 'ohmyhost login'.");
46574
47438
  }
46575
- if (isTimeout(error)) {
46576
- throw new ProductCliFailure(8, "request_timeout", true, REQUEST_TIMEOUT_ACTION);
47439
+ if (isTimeout2(error)) {
47440
+ throw new ProductCliFailure(8, "request_timeout", true, requestTimeoutAction("unknown"));
46577
47441
  }
46578
47442
  if (error instanceof LifecycleTransportError) {
46579
47443
  throw new ProductCliFailure(5, "token_refresh_failed", true, refreshFailedAction(this.dependencies.commandPrefix, this.#profile));
@@ -46621,10 +47485,13 @@ var classifyFailure = (command, error, signal, actingAs) => {
46621
47485
  if (error instanceof SourceWorkspaceError)
46622
47486
  return failure(command, 2, error.code, error.code === "source_snapshot_changed", error.message);
46623
47487
  if (signal.aborted || isCancellation(error)) {
46624
- 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. Run it again with the same --idempotency-key; a change may already be under way. Give login and commands with --wait or --follow several minutes, or run them in the background.");
47488
+ 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.`);
47489
+ }
47490
+ if (isTimeout2(error)) {
47491
+ return failure(command, 8, "request_timeout", true, requestTimeoutAction(command));
46625
47492
  }
46626
- if (isTimeout(error)) {
46627
- return failure(command, 8, "request_timeout", true, REQUEST_TIMEOUT_ACTION);
47493
+ if (error instanceof ProductCliFailure && error.code === "request_timeout" && error.retryable) {
47494
+ return failure(command, 8, "request_timeout", true, requestTimeoutAction(command));
46628
47495
  }
46629
47496
  if (error instanceof ProductCliFailure) {
46630
47497
  return failure(command, error.exitCode, error.code, error.retryable, error.suggestedAction, error.operation);
@@ -46645,7 +47512,7 @@ var classifyFailure = (command, error, signal, actingAs) => {
46645
47512
  return failure(command, 3, "credential_store_unavailable", false, CREDENTIAL_STORE_UNAVAILABLE_ACTION);
46646
47513
  }
46647
47514
  if (error instanceof ResponseContractError) {
46648
- return failure(command, 7, "response_contract_invalid", false, RESPONSE_CONTRACT_INVALID_ACTION);
47515
+ return failure(command, 7, "response_contract_invalid", false, responseContractAction(command));
46649
47516
  }
46650
47517
  if (error instanceof PublicResponseTooLargeError) {
46651
47518
  return failure(command, 7, "response_too_large", false, "Retry only after the remote response is repaired.");
@@ -46655,16 +47522,16 @@ var classifyFailure = (command, error, signal, actingAs) => {
46655
47522
  const problem = parseSafeProblem(error);
46656
47523
  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);
46657
47524
  } catch {
46658
- return failure(command, 7, "response_contract_invalid", false, RESPONSE_CONTRACT_INVALID_ACTION);
47525
+ return failure(command, 7, "response_contract_invalid", false, responseContractAction(command));
46659
47526
  }
46660
47527
  }
46661
47528
  if (looksLikeRemoteObject(error)) {
46662
- return failure(command, 7, "response_contract_invalid", false, RESPONSE_CONTRACT_INVALID_ACTION);
47529
+ return failure(command, 7, "response_contract_invalid", false, responseContractAction(command));
46663
47530
  }
46664
47531
  if (error instanceof NetworkTransportError) {
46665
- 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 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.");
47532
+ 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)}.`);
46666
47533
  }
46667
- return failure(command, 1, "internal_error", false, INTERNAL_ERROR_ACTION);
47534
+ return failure(command, 1, "internal_error", false, internalErrorAction(command));
46668
47535
  };
46669
47536
  var reusedKeyProblem = (error) => {
46670
47537
  if (!looksLikeProblem(error))
@@ -46677,19 +47544,19 @@ var reusedKeyProblem = (error) => {
46677
47544
  }
46678
47545
  };
46679
47546
  var OPERATION_STREAM_CONNECTIONS = 4;
46680
- var readStatementFile = async (path2) => {
46681
- const invalid7 = () => new ProductCliFailure(2, "statement_file_invalid", false, STATEMENT_FILE_INVALID_ACTION);
47547
+ var readStatementFile = (path2) => readBoundedUtf8File(path2, 65536, () => new ProductCliFailure(2, "statement_file_invalid", false, STATEMENT_FILE_INVALID_ACTION));
47548
+ var readBoundedUtf8File = async (path2, maxBytes, refusal) => {
46682
47549
  let file;
46683
47550
  try {
46684
47551
  file = await open3(path2, "r");
46685
47552
  } catch {
46686
- throw invalid7();
47553
+ throw refusal();
46687
47554
  }
46688
- const buffer = Buffer.alloc(65537);
47555
+ const buffer = Buffer.alloc(maxBytes + 1);
46689
47556
  try {
46690
47557
  const stat3 = await file.stat();
46691
- if (!stat3.isFile() || stat3.size > 65536)
46692
- throw invalid7();
47558
+ if (!stat3.isFile() || stat3.size > maxBytes)
47559
+ throw refusal();
46693
47560
  let length = 0;
46694
47561
  while (length < buffer.length) {
46695
47562
  const read = await file.read(buffer, length, buffer.length - length, null);
@@ -46697,18 +47564,64 @@ var readStatementFile = async (path2) => {
46697
47564
  break;
46698
47565
  length += read.bytesRead;
46699
47566
  }
46700
- if (length > 65536)
46701
- throw invalid7();
47567
+ if (length > maxBytes)
47568
+ throw refusal();
46702
47569
  return new TextDecoder("utf-8", { fatal: true }).decode(buffer.subarray(0, length));
46703
47570
  } catch (error) {
46704
47571
  if (error instanceof ProductCliFailure)
46705
47572
  throw error;
46706
- throw invalid7();
47573
+ throw refusal();
46707
47574
  } finally {
46708
47575
  buffer.fill(0);
46709
47576
  await file.close();
46710
47577
  }
46711
47578
  };
47579
+ var webhookCreateRequest = async (command) => {
47580
+ const headersFailure = () => new ProductCliFailure(2, "headers_file_invalid", false, HEADERS_FILE_INVALID_ACTION);
47581
+ const headers = command.headersFile === null ? void 0 : await readBoundedUtf8File(command.headersFile, 8192, headersFailure).then((text) => {
47582
+ try {
47583
+ return JSON.parse(text);
47584
+ } catch {
47585
+ throw headersFailure();
47586
+ }
47587
+ });
47588
+ try {
47589
+ return parseDatabaseWebhookCreateRequest({
47590
+ url: command.url,
47591
+ event_types: command.eventTypes,
47592
+ headers
47593
+ });
47594
+ } catch {
47595
+ throw headersFailure();
47596
+ }
47597
+ };
47598
+ var scheduleSetRequest = async (command) => {
47599
+ const statementsFailure = () => new ProductCliFailure(2, "statements_file_invalid", false, SCHEDULE_STATEMENTS_FILE_INVALID_ACTION);
47600
+ const statements = await readBoundedUtf8File(command.statementsFile, 65536, statementsFailure).then((text) => {
47601
+ try {
47602
+ return JSON.parse(text);
47603
+ } catch {
47604
+ throw statementsFailure();
47605
+ }
47606
+ });
47607
+ try {
47608
+ parseDatabaseScheduleSetRequest({ every_seconds: 60, statements, confirm: true });
47609
+ } catch {
47610
+ throw statementsFailure();
47611
+ }
47612
+ try {
47613
+ return parseDatabaseScheduleSetRequest({
47614
+ ...command.cron === null ? {} : { cron: command.cron },
47615
+ ...command.everySeconds === null ? {} : { every_seconds: command.everySeconds },
47616
+ statements,
47617
+ ...command.timeoutMs === null ? {} : { timeout_ms: command.timeoutMs },
47618
+ ...command.enabled === null ? {} : { enabled: command.enabled },
47619
+ confirm: true
47620
+ });
47621
+ } catch {
47622
+ throw new ProductCliFailure(2, "schedule_invalid", false, SCHEDULE_INVALID_ACTION);
47623
+ }
47624
+ };
46712
47625
  var psqlUnavailable = () => failure("database psql", 9, "psql_unavailable", false, "Install the PostgreSQL client (psql) and make it available on PATH, or run 'ohmyhost database access create' and connect with your own SQL client.");
46713
47626
  var success = (command, body) => ({
46714
47627
  exitCode: 0,
@@ -46848,6 +47761,34 @@ var parsedCommandName = (command) => {
46848
47761
  return "database access revoke";
46849
47762
  if (command.kind === "database-psql")
46850
47763
  return "database psql";
47764
+ if (command.kind === "database-webhook-create")
47765
+ return "database webhook create";
47766
+ if (command.kind === "database-webhook-list")
47767
+ return "database webhook list";
47768
+ if (command.kind === "database-webhook-get")
47769
+ return "database webhook get";
47770
+ if (command.kind === "database-webhook-delete")
47771
+ return "database webhook delete";
47772
+ if (command.kind === "database-webhook-test")
47773
+ return "database webhook test";
47774
+ if (command.kind === "database-webhook-deliveries")
47775
+ return "database webhook deliveries";
47776
+ if (command.kind === "database-webhook-replay")
47777
+ return "database webhook replay";
47778
+ if (command.kind === "database-schedule-set")
47779
+ return "database schedule set";
47780
+ if (command.kind === "database-schedule-list")
47781
+ return "database schedule list";
47782
+ if (command.kind === "database-schedule-get")
47783
+ return "database schedule get";
47784
+ if (command.kind === "database-schedule-delete")
47785
+ return "database schedule delete";
47786
+ if (command.kind === "database-schedule-runs")
47787
+ return "database schedule runs";
47788
+ if (command.kind === "database-schedule-run")
47789
+ return "database schedule run";
47790
+ if (command.kind === "database-executions")
47791
+ return "database executions";
46851
47792
  if (command.kind === "source-auto-deploy-set")
46852
47793
  return "source auto-deploy set";
46853
47794
  if (command.kind === "source-auto-deploy-status")
@@ -46918,14 +47859,14 @@ var throwIfAborted = (signal) => {
46918
47859
  throw signal.reason;
46919
47860
  };
46920
47861
  var isCancellation = (error) => error instanceof DOMException && error.name === "AbortError";
46921
- var isTimeout = (error) => error instanceof DOMException && error.name === "TimeoutError";
47862
+ var isTimeout2 = (error) => error instanceof DOMException && error.name === "TimeoutError";
46922
47863
  var looksLikeProblem = (error) => typeof error === "object" && error !== null && ("code" in error || "status" in error || "suggested_action" in error);
46923
47864
  var looksLikeRemoteObject = (error) => typeof error === "object" && error !== null && !(error instanceof Error);
46924
47865
  var diagnosticDescriptor = (error, signal) => {
46925
47866
  if (signal.aborted || isCancellation(error)) {
46926
47867
  return { category: "cancelled", subsystem: "runtime", errorKind: "cancelled" };
46927
47868
  }
46928
- if (isTimeout(error)) {
47869
+ if (isTimeout2(error)) {
46929
47870
  return { category: "timeout", subsystem: "runtime", errorKind: "timeout" };
46930
47871
  }
46931
47872
  if (error instanceof CredentialStoreUnavailableError) {
@@ -47042,12 +47983,12 @@ function buildClientParams(args, fields) {
47042
47983
  };
47043
47984
  const map = buildKeyMap(fields);
47044
47985
  function writeSlot(slot, key, value) {
47045
- let record6 = params[slot];
47046
- if (record6 === void 0) {
47047
- record6 = /* @__PURE__ */ Object.create(null);
47048
- params[slot] = record6;
47986
+ let record7 = params[slot];
47987
+ if (record7 === void 0) {
47988
+ record7 = /* @__PURE__ */ Object.create(null);
47989
+ params[slot] = record7;
47049
47990
  }
47050
- record6[key] = value;
47991
+ record7[key] = value;
47051
47992
  }
47052
47993
  let config;
47053
47994
  for (const [index, arg] of args.entries()) {
@@ -47324,9 +48265,9 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
47324
48265
  var PATH_PARAM_RE = /\{[^{}]+\}/g;
47325
48266
  var defaultPathSerializer = ({ path: path2, url: _url }) => {
47326
48267
  let url = _url;
47327
- const matches = _url.match(PATH_PARAM_RE);
47328
- if (matches) {
47329
- for (const match of matches) {
48268
+ const matches2 = _url.match(PATH_PARAM_RE);
48269
+ if (matches2) {
48270
+ for (const match of matches2) {
47330
48271
  let explode = false;
47331
48272
  let name = match.substring(1, match.length - 1);
47332
48273
  let style = "simple";
@@ -49692,6 +50633,289 @@ var revokeProjectDatabaseAccess = (parameters, options) => {
49692
50633
  ...params
49693
50634
  });
49694
50635
  };
50636
+ var listProjectDatabaseWebhooks = (parameters, options) => {
50637
+ const params = buildClientParams([parameters], [
50638
+ {
50639
+ args: [
50640
+ { in: "headers", key: "X-Request-Id" },
50641
+ { in: "path", key: "project_id" },
50642
+ { in: "query", key: "environment" }
50643
+ ]
50644
+ }
50645
+ ]);
50646
+ return (options?.client ?? client).get({
50647
+ responseStyle: "data",
50648
+ security: [{ scheme: "bearer", type: "http" }],
50649
+ url: "/v1/projects/{project_id}/database/webhooks",
50650
+ ...options,
50651
+ ...params
50652
+ });
50653
+ };
50654
+ var createProjectDatabaseWebhook = (parameters, options) => {
50655
+ const params = buildClientParams([parameters], [
50656
+ {
50657
+ args: [
50658
+ { in: "headers", key: "X-Request-Id" },
50659
+ { in: "headers", key: "Idempotency-Key" },
50660
+ { in: "path", key: "project_id" },
50661
+ { in: "query", key: "environment" },
50662
+ { key: "databaseWebhookCreateRequest", map: "body" }
50663
+ ]
50664
+ }
50665
+ ]);
50666
+ return (options?.client ?? client).post({
50667
+ responseStyle: "data",
50668
+ security: [{ scheme: "bearer", type: "http" }],
50669
+ url: "/v1/projects/{project_id}/database/webhooks",
50670
+ ...options,
50671
+ ...params,
50672
+ headers: {
50673
+ "Content-Type": "application/json",
50674
+ ...options?.headers,
50675
+ ...params.headers
50676
+ }
50677
+ });
50678
+ };
50679
+ var deleteProjectDatabaseWebhook = (parameters, options) => {
50680
+ const params = buildClientParams([parameters], [
50681
+ {
50682
+ args: [
50683
+ { in: "headers", key: "X-Request-Id" },
50684
+ { in: "path", key: "project_id" },
50685
+ { in: "path", key: "webhook_id" },
50686
+ { in: "query", key: "environment" }
50687
+ ]
50688
+ }
50689
+ ]);
50690
+ return (options?.client ?? client).delete({
50691
+ responseStyle: "data",
50692
+ security: [{ scheme: "bearer", type: "http" }],
50693
+ url: "/v1/projects/{project_id}/database/webhooks/{webhook_id}",
50694
+ ...options,
50695
+ ...params
50696
+ });
50697
+ };
50698
+ var getProjectDatabaseWebhook = (parameters, options) => {
50699
+ const params = buildClientParams([parameters], [
50700
+ {
50701
+ args: [
50702
+ { in: "headers", key: "X-Request-Id" },
50703
+ { in: "path", key: "project_id" },
50704
+ { in: "path", key: "webhook_id" },
50705
+ { in: "query", key: "environment" }
50706
+ ]
50707
+ }
50708
+ ]);
50709
+ return (options?.client ?? client).get({
50710
+ responseStyle: "data",
50711
+ security: [{ scheme: "bearer", type: "http" }],
50712
+ url: "/v1/projects/{project_id}/database/webhooks/{webhook_id}",
50713
+ ...options,
50714
+ ...params
50715
+ });
50716
+ };
50717
+ var testProjectDatabaseWebhook = (parameters, options) => {
50718
+ const params = buildClientParams([parameters], [
50719
+ {
50720
+ args: [
50721
+ { in: "headers", key: "X-Request-Id" },
50722
+ { in: "path", key: "project_id" },
50723
+ { in: "path", key: "webhook_id" },
50724
+ { in: "query", key: "environment" }
50725
+ ]
50726
+ }
50727
+ ]);
50728
+ return (options?.client ?? client).post({
50729
+ responseStyle: "data",
50730
+ security: [{ scheme: "bearer", type: "http" }],
50731
+ url: "/v1/projects/{project_id}/database/webhooks/{webhook_id}/test",
50732
+ ...options,
50733
+ ...params
50734
+ });
50735
+ };
50736
+ var listProjectDatabaseWebhookDeliveries = (parameters, options) => {
50737
+ const params = buildClientParams([parameters], [
50738
+ {
50739
+ args: [
50740
+ { in: "headers", key: "X-Request-Id" },
50741
+ { in: "path", key: "project_id" },
50742
+ { in: "query", key: "environment" },
50743
+ { in: "query", key: "webhook_id" },
50744
+ { in: "query", key: "limit" },
50745
+ { in: "query", key: "cursor" }
50746
+ ]
50747
+ }
50748
+ ]);
50749
+ return (options?.client ?? client).get({
50750
+ responseStyle: "data",
50751
+ security: [{ scheme: "bearer", type: "http" }],
50752
+ url: "/v1/projects/{project_id}/database/webhook-deliveries",
50753
+ ...options,
50754
+ ...params
50755
+ });
50756
+ };
50757
+ var replayProjectDatabaseWebhookDelivery = (parameters, options) => {
50758
+ const params = buildClientParams([parameters], [
50759
+ {
50760
+ args: [
50761
+ { in: "headers", key: "X-Request-Id" },
50762
+ { in: "path", key: "project_id" },
50763
+ { in: "path", key: "delivery_id" },
50764
+ { in: "query", key: "environment" }
50765
+ ]
50766
+ }
50767
+ ]);
50768
+ return (options?.client ?? client).post({
50769
+ responseStyle: "data",
50770
+ security: [{ scheme: "bearer", type: "http" }],
50771
+ url: "/v1/projects/{project_id}/database/webhook-deliveries/{delivery_id}/replay",
50772
+ ...options,
50773
+ ...params
50774
+ });
50775
+ };
50776
+ var listProjectDatabaseSchedules = (parameters, options) => {
50777
+ const params = buildClientParams([parameters], [
50778
+ {
50779
+ args: [
50780
+ { in: "headers", key: "X-Request-Id" },
50781
+ { in: "path", key: "project_id" },
50782
+ { in: "query", key: "environment" }
50783
+ ]
50784
+ }
50785
+ ]);
50786
+ return (options?.client ?? client).get({
50787
+ responseStyle: "data",
50788
+ security: [{ scheme: "bearer", type: "http" }],
50789
+ url: "/v1/projects/{project_id}/database/schedules",
50790
+ ...options,
50791
+ ...params
50792
+ });
50793
+ };
50794
+ var deleteProjectDatabaseSchedule = (parameters, options) => {
50795
+ const params = buildClientParams([parameters], [
50796
+ {
50797
+ args: [
50798
+ { in: "headers", key: "X-Request-Id" },
50799
+ { in: "path", key: "project_id" },
50800
+ { in: "path", key: "name" },
50801
+ { in: "query", key: "environment" }
50802
+ ]
50803
+ }
50804
+ ]);
50805
+ return (options?.client ?? client).delete({
50806
+ responseStyle: "data",
50807
+ security: [{ scheme: "bearer", type: "http" }],
50808
+ url: "/v1/projects/{project_id}/database/schedules/{name}",
50809
+ ...options,
50810
+ ...params
50811
+ });
50812
+ };
50813
+ var getProjectDatabaseSchedule = (parameters, options) => {
50814
+ const params = buildClientParams([parameters], [
50815
+ {
50816
+ args: [
50817
+ { in: "headers", key: "X-Request-Id" },
50818
+ { in: "path", key: "project_id" },
50819
+ { in: "path", key: "name" },
50820
+ { in: "query", key: "environment" }
50821
+ ]
50822
+ }
50823
+ ]);
50824
+ return (options?.client ?? client).get({
50825
+ responseStyle: "data",
50826
+ security: [{ scheme: "bearer", type: "http" }],
50827
+ url: "/v1/projects/{project_id}/database/schedules/{name}",
50828
+ ...options,
50829
+ ...params
50830
+ });
50831
+ };
50832
+ var setProjectDatabaseSchedule = (parameters, options) => {
50833
+ const params = buildClientParams([parameters], [
50834
+ {
50835
+ args: [
50836
+ { in: "headers", key: "X-Request-Id" },
50837
+ { in: "path", key: "project_id" },
50838
+ { in: "path", key: "name" },
50839
+ { in: "query", key: "environment" },
50840
+ { key: "databaseScheduleSetRequest", map: "body" }
50841
+ ]
50842
+ }
50843
+ ]);
50844
+ return (options?.client ?? client).put({
50845
+ responseStyle: "data",
50846
+ security: [{ scheme: "bearer", type: "http" }],
50847
+ url: "/v1/projects/{project_id}/database/schedules/{name}",
50848
+ ...options,
50849
+ ...params,
50850
+ headers: {
50851
+ "Content-Type": "application/json",
50852
+ ...options?.headers,
50853
+ ...params.headers
50854
+ }
50855
+ });
50856
+ };
50857
+ var listProjectDatabaseScheduleRuns = (parameters, options) => {
50858
+ const params = buildClientParams([parameters], [
50859
+ {
50860
+ args: [
50861
+ { in: "headers", key: "X-Request-Id" },
50862
+ { in: "path", key: "project_id" },
50863
+ { in: "path", key: "name" },
50864
+ { in: "query", key: "environment" },
50865
+ { in: "query", key: "limit" }
50866
+ ]
50867
+ }
50868
+ ]);
50869
+ return (options?.client ?? client).get({
50870
+ responseStyle: "data",
50871
+ security: [{ scheme: "bearer", type: "http" }],
50872
+ url: "/v1/projects/{project_id}/database/schedules/{name}/runs",
50873
+ ...options,
50874
+ ...params
50875
+ });
50876
+ };
50877
+ var runProjectDatabaseSchedule = (parameters, options) => {
50878
+ const params = buildClientParams([parameters], [
50879
+ {
50880
+ args: [
50881
+ { in: "headers", key: "X-Request-Id" },
50882
+ { in: "path", key: "project_id" },
50883
+ { in: "path", key: "name" },
50884
+ { in: "query", key: "environment" }
50885
+ ]
50886
+ }
50887
+ ]);
50888
+ return (options?.client ?? client).post({
50889
+ responseStyle: "data",
50890
+ security: [{ scheme: "bearer", type: "http" }],
50891
+ url: "/v1/projects/{project_id}/database/schedules/{name}/run",
50892
+ ...options,
50893
+ ...params
50894
+ });
50895
+ };
50896
+ var getProjectDatabaseExecutionUsage = (parameters, options) => {
50897
+ const params = buildClientParams([parameters], [
50898
+ {
50899
+ args: [
50900
+ { in: "headers", key: "X-Request-Id" },
50901
+ { in: "path", key: "project_id" },
50902
+ { in: "query", key: "environment" },
50903
+ { in: "query", key: "from" },
50904
+ { in: "query", key: "to" },
50905
+ { in: "query", key: "granularity" },
50906
+ { in: "query", key: "limit" },
50907
+ { in: "query", key: "cursor" }
50908
+ ]
50909
+ }
50910
+ ]);
50911
+ return (options?.client ?? client).get({
50912
+ responseStyle: "data",
50913
+ security: [{ scheme: "bearer", type: "http" }],
50914
+ url: "/v1/projects/{project_id}/database/execution-usage",
50915
+ ...options,
50916
+ ...params
50917
+ });
50918
+ };
49695
50919
  var planDeploymentRollback = (parameters, options) => {
49696
50920
  const params = buildClientParams([parameters], [
49697
50921
  {
@@ -50143,7 +51367,7 @@ var ULID3 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
50143
51367
  function assertManagedMailResponse(value, input) {
50144
51368
  const r = object2(value);
50145
51369
  if (input.action === "configure" || input.action === "status" || input.action === "webhook_verify") {
50146
- exact4(r, [
51370
+ exact5(r, [
50147
51371
  "domain_id",
50148
51372
  "domain",
50149
51373
  "environment_id",
@@ -50173,14 +51397,14 @@ function assertManagedMailResponse(value, input) {
50173
51397
  invalid5();
50174
51398
  if (r["webhook"] !== null) {
50175
51399
  const hook = object2(r["webhook"]);
50176
- exact4(hook, ["url", "verified"]);
51400
+ exact5(hook, ["url", "verified"]);
50177
51401
  https(hook["url"]);
50178
51402
  if (typeof hook["verified"] !== "boolean")
50179
51403
  invalid5();
50180
51404
  }
50181
51405
  if (r["dns"] !== void 0) {
50182
51406
  const dns = object2(r["dns"]);
50183
- exact4(dns, ["status", "records"]);
51407
+ exact5(dns, ["status", "records"]);
50184
51408
  if (!["configured", "action_required", "conflict"].includes(String(dns["status"])))
50185
51409
  invalid5();
50186
51410
  records(dns["records"]);
@@ -50188,19 +51412,19 @@ function assertManagedMailResponse(value, input) {
50188
51412
  return;
50189
51413
  }
50190
51414
  if (input.action === "webhook_set") {
50191
- exact4(r, ["url", "signing_secret", "status"]);
51415
+ exact5(r, ["url", "signing_secret", "status"]);
50192
51416
  if (r["url"] !== input.url || r["status"] !== "verification_required" || typeof r["signing_secret"] !== "string" || !/^whsec_[A-Za-z0-9+/]{43}=$/u.test(r["signing_secret"]))
50193
51417
  invalid5();
50194
51418
  return;
50195
51419
  }
50196
51420
  if (input.action === "webhook_disable") {
50197
- exact4(r, ["status"]);
51421
+ exact5(r, ["status"]);
50198
51422
  if (r["status"] !== "disabled")
50199
51423
  invalid5();
50200
51424
  return;
50201
51425
  }
50202
51426
  if (input.action === "domain_delete") {
50203
- exact4(r, ["status", "domain", "dns_records"]);
51427
+ exact5(r, ["status", "domain", "dns_records"]);
50204
51428
  if (r["status"] !== "deleted")
50205
51429
  invalid5();
50206
51430
  domain(r["domain"]);
@@ -50208,12 +51432,12 @@ function assertManagedMailResponse(value, input) {
50208
51432
  return;
50209
51433
  }
50210
51434
  if (input.action === "messages_list") {
50211
- exact4(r, ["items"]);
51435
+ exact5(r, ["items"]);
50212
51436
  if (!Array.isArray(r["items"]) || r["items"].length > 50)
50213
51437
  invalid5();
50214
51438
  for (const value2 of r["items"]) {
50215
51439
  const item = object2(value2);
50216
- exact4(item, ["message_id", "received_at", "state", "attempts"]);
51440
+ exact5(item, ["message_id", "received_at", "state", "attempts"]);
50217
51441
  id2(item["message_id"]);
50218
51442
  time(item["received_at"]);
50219
51443
  if (!["pending", "delivering", "delivered", "delivery_failed", "expired"].includes(String(item["state"])) || !Number.isInteger(item["attempts"]) || Number(item["attempts"]) < 0 || Number(item["attempts"]) > 4)
@@ -50222,7 +51446,7 @@ function assertManagedMailResponse(value, input) {
50222
51446
  return;
50223
51447
  }
50224
51448
  if (input.action === "message_retry") {
50225
- exact4(r, ["attempted"], ["delivered"]);
51449
+ exact5(r, ["attempted"], ["delivered"]);
50226
51450
  if (typeof r["attempted"] !== "boolean" || r["delivered"] !== void 0 && typeof r["delivered"] !== "boolean")
50227
51451
  invalid5();
50228
51452
  return;
@@ -50230,10 +51454,10 @@ function assertManagedMailResponse(value, input) {
50230
51454
  if (input.action !== "message_get")
50231
51455
  invalid5();
50232
51456
  if (r["status"] === "expired") {
50233
- exact4(r, ["status"]);
51457
+ exact5(r, ["status"]);
50234
51458
  return;
50235
51459
  }
50236
- exact4(r, [
51460
+ exact5(r, [
50237
51461
  "id",
50238
51462
  "domain",
50239
51463
  "received_at",
@@ -50265,7 +51489,7 @@ function assertManagedMailResponse(value, input) {
50265
51489
  invalid5();
50266
51490
  for (const value2 of r["attachments"]) {
50267
51491
  const a = object2(value2);
50268
- exact4(a, ["id", "filename", "content_type", "download_path"]);
51492
+ exact5(a, ["id", "filename", "content_type", "download_path"]);
50269
51493
  if (typeof a["id"] !== "string" || !/^[A-Za-z0-9_-]{1,128}$/u.test(a["id"]) || a["filename"] !== null && typeof a["filename"] !== "string" || typeof a["content_type"] !== "string" || a["download_path"] !== `/v1/projects/${input.projectId}/environments/${input.environmentId}/mail/messages/${input.messageId}/attachments/${a["id"]}`)
50270
51494
  invalid5();
50271
51495
  }
@@ -50275,7 +51499,7 @@ function object2(v) {
50275
51499
  invalid5();
50276
51500
  return v;
50277
51501
  }
50278
- function exact4(v, required, optional = []) {
51502
+ function exact5(v, required, optional = []) {
50279
51503
  if (required.some((k) => !(k in v)) || Object.keys(v).some((k) => !required.includes(k) && !optional.includes(k)))
50280
51504
  invalid5();
50281
51505
  }
@@ -50300,7 +51524,7 @@ function records(v) {
50300
51524
  invalid5();
50301
51525
  for (const value of v) {
50302
51526
  const r = object2(value);
50303
- exact4(r, ["type", "name", "value", "purpose", "status"], ["priority"]);
51527
+ exact5(r, ["type", "name", "value", "purpose", "status"], ["priority"]);
50304
51528
  if (!["TXT", "CNAME", "MX"].includes(String(r["type"])) || ["name", "value", "purpose", "status"].some((k) => typeof r[k] !== "string") || r["type"] === "MX" && (!Number.isInteger(r["priority"]) || Number(r["priority"]) < 0 || Number(r["priority"]) > 65535))
50305
51529
  invalid5();
50306
51530
  }
@@ -50357,7 +51581,7 @@ var HOST = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}
50357
51581
  function assertSharedMailResponse(value, input) {
50358
51582
  const v = object3(value);
50359
51583
  if (input.action === "domains_list") {
50360
- exact5(v, ["items"]);
51584
+ exact6(v, ["items"]);
50361
51585
  if (!Array.isArray(v["items"]) || v["items"].length > 100)
50362
51586
  invalid6();
50363
51587
  for (const item of v["items"])
@@ -50369,7 +51593,7 @@ function assertSharedMailResponse(value, input) {
50369
51593
  return;
50370
51594
  }
50371
51595
  if (["domain_get", "domain_create", "domain_retire"].includes(input.action)) {
50372
- exact5(v, [
51596
+ exact6(v, [
50373
51597
  "domain_id",
50374
51598
  "organization_id",
50375
51599
  "domain",
@@ -50402,7 +51626,7 @@ function assertSharedMailResponse(value, input) {
50402
51626
  invalid6();
50403
51627
  for (const entry of v["dns_records"]) {
50404
51628
  const r = object3(entry);
50405
- exact5(r, ["type", "name", "value", "purpose", "status"], ["priority"]);
51629
+ exact6(r, ["type", "name", "value", "purpose", "status"], ["priority"]);
50406
51630
  member(r["type"], ["TXT", "MX", "CNAME"]);
50407
51631
  for (const k of ["name", "value", "purpose", "status"])
50408
51632
  if (typeof r[k] !== "string" || /[\r\n\0]/u.test(r[k]))
@@ -50415,7 +51639,7 @@ function assertSharedMailResponse(value, input) {
50415
51639
  return;
50416
51640
  }
50417
51641
  if (["binding_get", "binding_set", "binding_detach"].includes(input.action)) {
50418
- exact5(v, [
51642
+ exact6(v, [
50419
51643
  "mail_domain_id",
50420
51644
  "organization_id",
50421
51645
  "project_id",
@@ -50449,7 +51673,7 @@ function assertSharedMailResponse(value, input) {
50449
51673
  invalid6();
50450
51674
  if (v["application_domain_identity"] !== null) {
50451
51675
  const identity = object3(v["application_domain_identity"]);
50452
- exact5(identity, ["hostname", "registrable_domain", "revision", "status"]);
51676
+ exact6(identity, ["hostname", "registrable_domain", "revision", "status"]);
50453
51677
  host(identity["hostname"]);
50454
51678
  host(identity["registrable_domain"]);
50455
51679
  positive(identity["revision"]);
@@ -50458,7 +51682,7 @@ function assertSharedMailResponse(value, input) {
50458
51682
  return;
50459
51683
  }
50460
51684
  if (["identity_get", "identity_declare", "identity_verify", "identity_revoke"].includes(input.action)) {
50461
- exact5(v, [
51685
+ exact6(v, [
50462
51686
  "organization_id",
50463
51687
  "project_id",
50464
51688
  "hostname",
@@ -50478,7 +51702,7 @@ function assertSharedMailResponse(value, input) {
50478
51702
  positive(v["revision"]);
50479
51703
  member(v["status"], ["pending", "verified", "expired", "revoked"]);
50480
51704
  const challenge = object3(v["challenge"]);
50481
- exact5(challenge, ["type", "name", "value"]);
51705
+ exact6(challenge, ["type", "name", "value"]);
50482
51706
  if (challenge["type"] !== "TXT" || typeof challenge["name"] !== "string" || challenge["name"] !== `_omh-project.${v["hostname"]}` || typeof challenge["value"] !== "string" || challenge["value"].length < 16 || challenge["value"].length > 255 || /[\r\n\0]/u.test(challenge["value"]))
50483
51707
  invalid6();
50484
51708
  if (v["verified_at"] !== null)
@@ -50487,14 +51711,14 @@ function assertSharedMailResponse(value, input) {
50487
51711
  return;
50488
51712
  }
50489
51713
  if (input.action === "domain_dns_authorize" || input.action === "identity_authorize") {
50490
- exact5(v, ["authorization_id", "authorization_url", "expires_at"]);
51714
+ exact6(v, ["authorization_id", "authorization_url", "expires_at"]);
50491
51715
  id3(v["authorization_id"]);
50492
51716
  time2(v["expires_at"]);
50493
51717
  if (typeof v["authorization_url"] !== "string" || !/^https:\/\/dash\.cloudflare\.com\/oauth2\/auth\?/u.test(v["authorization_url"]))
50494
51718
  invalid6();
50495
51719
  return;
50496
51720
  }
50497
- exact5(v, ["status", "zone", "scopes", "expires_at"]);
51721
+ exact6(v, ["status", "zone", "scopes", "expires_at"]);
50498
51722
  member(v["status"], ["not_authorized", "pending", "authorized", "expired", "revoked"]);
50499
51723
  if (!Array.isArray(v["scopes"]) || v["scopes"].length > 2 || new Set(v["scopes"]).size !== v["scopes"].length || v["scopes"].some((s) => s !== "dns.write" && s !== "zone.read"))
50500
51724
  invalid6();
@@ -50510,7 +51734,7 @@ function object3(v) {
50510
51734
  invalid6();
50511
51735
  return v;
50512
51736
  }
50513
- function exact5(v, required, optional = []) {
51737
+ function exact6(v, required, optional = []) {
50514
51738
  if (required.some((k) => !(k in v)) || Object.keys(v).some((k) => !required.includes(k) && !optional.includes(k)))
50515
51739
  invalid6();
50516
51740
  }
@@ -50781,6 +52005,8 @@ function checkedResponse(kind, value) {
50781
52005
  }
50782
52006
 
50783
52007
  // apps/product-cli/dist/product-api.js
52008
+ var WEBHOOK_SCOPE_MISMATCH = "Webhook response scope mismatch";
52009
+ var SCHEDULE_SCOPE_MISMATCH = "Schedule response scope mismatch";
50784
52010
  var GeneratedSdkProductApi = class {
50785
52011
  #client;
50786
52012
  managedSource;
@@ -50977,6 +52203,159 @@ var GeneratedSdkProductApi = class {
50977
52203
  assertProjectDatabaseAccess(value);
50978
52204
  return value;
50979
52205
  }
52206
+ /** The signing secret exists only in this answer; the CLI prints it once and stores nothing. */
52207
+ async createProjectDatabaseWebhook(input) {
52208
+ const value = await createProjectDatabaseWebhook({
52209
+ project_id: input.projectId,
52210
+ environment: input.environment,
52211
+ "Idempotency-Key": input.idempotencyKey,
52212
+ databaseWebhookCreateRequest: {
52213
+ url: input.url,
52214
+ event_types: [...input.eventTypes],
52215
+ headers: { ...input.headers }
52216
+ }
52217
+ }, { client: this.#client });
52218
+ assertDatabaseWebhookCreated(value);
52219
+ if (value.environment !== input.environment)
52220
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
52221
+ return value;
52222
+ }
52223
+ async listProjectDatabaseWebhooks(input) {
52224
+ const value = await listProjectDatabaseWebhooks({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
52225
+ assertDatabaseWebhookPage(value);
52226
+ if (value.items.some((item) => item.environment !== input.environment))
52227
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
52228
+ return value;
52229
+ }
52230
+ async getProjectDatabaseWebhook(input) {
52231
+ const value = await getProjectDatabaseWebhook({
52232
+ project_id: input.projectId,
52233
+ environment: input.environment,
52234
+ webhook_id: input.webhookId
52235
+ }, { client: this.#client });
52236
+ assertDatabaseWebhook(value);
52237
+ if (value.id !== input.webhookId || value.environment !== input.environment)
52238
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
52239
+ return value;
52240
+ }
52241
+ async deleteProjectDatabaseWebhook(input) {
52242
+ const value = await deleteProjectDatabaseWebhook({
52243
+ project_id: input.projectId,
52244
+ environment: input.environment,
52245
+ webhook_id: input.webhookId
52246
+ }, { client: this.#client });
52247
+ assertDatabaseWebhookDeleted(value);
52248
+ if (value.id !== input.webhookId)
52249
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
52250
+ return value;
52251
+ }
52252
+ async testProjectDatabaseWebhook(input) {
52253
+ const value = await testProjectDatabaseWebhook({
52254
+ project_id: input.projectId,
52255
+ environment: input.environment,
52256
+ webhook_id: input.webhookId
52257
+ }, { client: this.#client });
52258
+ assertDatabaseWebhookTest(value);
52259
+ return value;
52260
+ }
52261
+ async listProjectDatabaseWebhookDeliveries(input) {
52262
+ const value = await listProjectDatabaseWebhookDeliveries({
52263
+ project_id: input.projectId,
52264
+ environment: input.environment,
52265
+ ...input.webhookId === void 0 ? {} : { webhook_id: input.webhookId },
52266
+ ...input.limit === void 0 ? {} : { limit: input.limit },
52267
+ ...input.cursor === void 0 ? {} : { cursor: input.cursor }
52268
+ }, { client: this.#client });
52269
+ assertDatabaseWebhookDeliveryPage(value);
52270
+ if (input.webhookId !== void 0 && value.items.some((item) => item.webhook_id !== input.webhookId))
52271
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
52272
+ return value;
52273
+ }
52274
+ async replayProjectDatabaseWebhookDelivery(input) {
52275
+ const value = await replayProjectDatabaseWebhookDelivery({
52276
+ project_id: input.projectId,
52277
+ environment: input.environment,
52278
+ delivery_id: input.deliveryId
52279
+ }, { client: this.#client });
52280
+ assertDatabaseWebhookReplayAccepted(value);
52281
+ if (value.delivery_id !== input.deliveryId)
52282
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
52283
+ return value;
52284
+ }
52285
+ /** A schedule runs the statements as the application's runtime role; the request confirms it. */
52286
+ async setProjectDatabaseSchedule(input) {
52287
+ const request = input.request;
52288
+ const value = await setProjectDatabaseSchedule({
52289
+ project_id: input.projectId,
52290
+ environment: input.environment,
52291
+ name: input.name,
52292
+ databaseScheduleSetRequest: {
52293
+ ...request.cron === null ? {} : { cron: request.cron },
52294
+ ...request.every_seconds === null ? {} : { every_seconds: request.every_seconds },
52295
+ statements: [...request.statements],
52296
+ timeout_ms: request.timeout_ms,
52297
+ enabled: request.enabled,
52298
+ confirm: true
52299
+ }
52300
+ }, { client: this.#client });
52301
+ assertDatabaseSchedule(value);
52302
+ if (value.name !== input.name || value.environment !== input.environment)
52303
+ throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
52304
+ return value;
52305
+ }
52306
+ async listProjectDatabaseSchedules(input) {
52307
+ const value = await listProjectDatabaseSchedules({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
52308
+ assertDatabaseSchedulePage(value);
52309
+ if (value.items.some((item) => item.environment !== input.environment))
52310
+ throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
52311
+ return value;
52312
+ }
52313
+ async getProjectDatabaseSchedule(input) {
52314
+ const value = await getProjectDatabaseSchedule({ project_id: input.projectId, environment: input.environment, name: input.name }, { client: this.#client });
52315
+ assertDatabaseSchedule(value);
52316
+ if (value.name !== input.name || value.environment !== input.environment)
52317
+ throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
52318
+ return value;
52319
+ }
52320
+ async deleteProjectDatabaseSchedule(input) {
52321
+ const value = await deleteProjectDatabaseSchedule({ project_id: input.projectId, environment: input.environment, name: input.name }, { client: this.#client });
52322
+ assertDatabaseScheduleDeleted(value);
52323
+ if (value.name !== input.name)
52324
+ throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
52325
+ return value;
52326
+ }
52327
+ async listProjectDatabaseScheduleRuns(input) {
52328
+ const value = await listProjectDatabaseScheduleRuns({
52329
+ project_id: input.projectId,
52330
+ environment: input.environment,
52331
+ name: input.name,
52332
+ ...input.limit === void 0 ? {} : { limit: input.limit }
52333
+ }, { client: this.#client });
52334
+ assertDatabaseScheduleRunPage(value);
52335
+ if (value.items.some((item) => item.schedule !== input.name))
52336
+ throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
52337
+ return value;
52338
+ }
52339
+ async runProjectDatabaseSchedule(input) {
52340
+ const value = await runProjectDatabaseSchedule({ project_id: input.projectId, environment: input.environment, name: input.name }, { client: this.#client });
52341
+ assertDatabaseScheduleRunAccepted(value);
52342
+ if (value.schedule !== input.name)
52343
+ throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
52344
+ return value;
52345
+ }
52346
+ async getProjectDatabaseExecutionUsage(input) {
52347
+ const value = await getProjectDatabaseExecutionUsage({
52348
+ project_id: input.projectId,
52349
+ environment: input.environment,
52350
+ from: input.from,
52351
+ to: input.to,
52352
+ granularity: input.granularity,
52353
+ ...input.limit === void 0 ? {} : { limit: input.limit },
52354
+ ...input.cursor === void 0 ? {} : { cursor: input.cursor }
52355
+ }, { client: this.#client });
52356
+ assertDatabaseExecutionUsagePage(value);
52357
+ return value;
52358
+ }
50980
52359
  async planPaidDomain(input) {
50981
52360
  return planPaidProjectDomain({ project_id: input.projectId, paidDomainRequest: { hostname: input.hostname } }, { client: this.#client });
50982
52361
  }
@@ -52430,8 +53809,8 @@ function pnpmLockedVersion(document2, packageName) {
52430
53809
  }
52431
53810
  return null;
52432
53811
  }
52433
- function ownValue(record6, key) {
52434
- return isRecord4(record6) && Object.hasOwn(record6, key) ? record6[key] : void 0;
53812
+ function ownValue(record7, key) {
53813
+ return isRecord4(record7) && Object.hasOwn(record7, key) ? record7[key] : void 0;
52435
53814
  }
52436
53815
  function isRecord4(value) {
52437
53816
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -54482,10 +55861,6 @@ async function startBridge(raw, hooks = {}) {
54482
55861
  finish();
54483
55862
  });
54484
55863
  upstream.on("ping", (data) => {
54485
- if (upstream.bufferedAmount >= STREAM_BYTES) {
54486
- finish();
54487
- return;
54488
- }
54489
55864
  upstream.pong(data, true, (error) => {
54490
55865
  if (error)
54491
55866
  finish();
@@ -54851,7 +56226,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
54851
56226
  return written(errorDocument(recognizedCommandLabel(args), 2, "linked_project_selection_required", false, `This directory is linked to projects of several organizations (${error.organizationIds.join(", ")}). Pass --project ULID, or choose the login with --profile-name NAME; '${resolveProductCliEnvironment(environment).commandPrefix} profile list --json' shows the saved logins.`));
54852
56227
  if (error instanceof CredentialStoreUnavailableError)
54853
56228
  return written(errorDocument(recognizedCommandLabel(args), 3, "credential_store_unavailable", false, CREDENTIAL_STORE_UNAVAILABLE_ACTION));
54854
- const result = error instanceof InvalidCommandError ? invalidCommandFailure(args, environment) : errorDocument(recognizedCommandLabel(args), 1, "internal_error", false, INTERNAL_ERROR_ACTION);
56229
+ const result = error instanceof InvalidCommandError ? invalidCommandFailure(args, environment) : errorDocument(recognizedCommandLabel(args), 1, "internal_error", false, internalErrorAction(recognizedCommandLabel(args)));
54855
56230
  if (!(error instanceof InvalidCommandError)) {
54856
56231
  diagnostics.record({
54857
56232
  correlationId: randomUUID3(),
@@ -54880,6 +56255,8 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
54880
56255
  return written(error instanceof SourceWorkspaceError || error instanceof LocalSourcePublicationError ? errorDocument("source inspect", 2, error.code, false, error.message) : classifyCliFailure("source inspect", error, signal));
54881
56256
  }
54882
56257
  }
56258
+ if (command.kind === "help" && command.topic !== void 0 && !helpTopicKnown(command.topic))
56259
+ return written(invalidCommandFailure(args, environment));
54883
56260
  if (command.kind === "help" || command.kind === "version") {
54884
56261
  return written(cliMetadataResult(command.kind, command.kind === "help" ? command.topic : void 0));
54885
56262
  }
@@ -55157,7 +56534,7 @@ var runOfflineInit = async (command, io, diagnostics) => {
55157
56534
  });
55158
56535
  const code = error instanceof RepositoryInitBlockedError ? "repository_init_blocked" : error instanceof RepositoryInitConflictError ? "repository_configuration_exists" : known ? error.code : "internal_error";
55159
56536
  const exitCode = error instanceof RepositoryInitBlockedError ? 9 : known ? 2 : 1;
55160
- const result = errorDocument("init", exitCode, code, false, known ? initFailureAction(error) : INTERNAL_ERROR_ACTION);
56537
+ const result = errorDocument("init", exitCode, code, false, known ? initFailureAction(error) : internalErrorAction("init"));
55161
56538
  io.writeStdout(result.stdout);
55162
56539
  return result.exitCode;
55163
56540
  }
@@ -55617,9 +56994,10 @@ export {
55617
56994
  SecretInputError,
55618
56995
  PublicResponseTooLargeError,
55619
56996
  PsqlUnavailableError,
56997
+ helpTopicKnown,
55620
56998
  cliMetadataResult,
55621
56999
  invalidCommandAction,
55622
- INTERNAL_ERROR_ACTION,
57000
+ internalErrorAction,
55623
57001
  CREDENTIAL_STORE_UNAVAILABLE_ACTION,
55624
57002
  endedLoginAction,
55625
57003
  refreshFailedAction,