@amerged/ohmyhost-cli 0.1.59 → 0.1.62

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.
@@ -8114,12 +8114,12 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
8114
8114
  return (type << 12) + permissions;
8115
8115
  }
8116
8116
  var MAX_UINT32 = 2 ** 32;
8117
- function SecondsNanoseconds(givenSeconds, givenNanoseconds, milliseconds, date2) {
8117
+ function SecondsNanoseconds(givenSeconds, givenNanoseconds, milliseconds, date3) {
8118
8118
  if (givenSeconds !== void 0 && givenNanoseconds !== void 0) {
8119
8119
  return [givenSeconds, givenNanoseconds];
8120
8120
  }
8121
8121
  if (milliseconds === void 0) {
8122
- milliseconds = date2.valueOf();
8122
+ milliseconds = date3.valueOf();
8123
8123
  }
8124
8124
  const seconds = Math.floor(milliseconds / 1e3);
8125
8125
  const nanoseconds = (milliseconds - seconds * 1e3) * 1e6;
@@ -20698,14 +20698,14 @@ var require_codegen = __commonJS({
20698
20698
  return replaceName(expr);
20699
20699
  if (!canOptimize(expr))
20700
20700
  return expr;
20701
- return new code_1._Code(expr._items.reduce((items, c) => {
20701
+ return new code_1._Code(expr._items.reduce((items2, c) => {
20702
20702
  if (c instanceof code_1.Name)
20703
20703
  c = replaceName(c);
20704
20704
  if (c instanceof code_1._Code)
20705
- items.push(...c._items);
20705
+ items2.push(...c._items);
20706
20706
  else
20707
- items.push(c);
20708
- return items;
20707
+ items2.push(c);
20708
+ return items2;
20709
20709
  }, []));
20710
20710
  function replaceName(n) {
20711
20711
  const c = constants5[n.str];
@@ -20863,7 +20863,7 @@ var require_util = __commonJS({
20863
20863
  mergeNames: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
20864
20864
  mergeToName: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._)`${to} > ${from} ? ${to} : ${from}`)),
20865
20865
  mergeValues: (from, to) => from === true ? true : Math.max(from, to),
20866
- resultToName: (gen, items) => gen.var("items", items)
20866
+ resultToName: (gen, items2) => gen.var("items", items2)
20867
20867
  })
20868
20868
  };
20869
20869
  function evaluatedPropsToName(gen, ps) {
@@ -21371,13 +21371,13 @@ var require_defaults = __commonJS({
21371
21371
  var codegen_1 = require_codegen();
21372
21372
  var util_1 = require_util();
21373
21373
  function assignDefaults(it, ty) {
21374
- const { properties, items } = it.schema;
21374
+ const { properties, items: items2 } = it.schema;
21375
21375
  if (ty === "object" && properties) {
21376
21376
  for (const key in properties) {
21377
21377
  assignDefault(it, key, properties[key].default);
21378
21378
  }
21379
- } else if (ty === "array" && Array.isArray(items)) {
21380
- items.forEach((sch, i) => assignDefault(it, i, sch.default));
21379
+ } else if (ty === "array" && Array.isArray(items2)) {
21380
+ items2.forEach((sch, i) => assignDefault(it, i, sch.default));
21381
21381
  }
21382
21382
  }
21383
21383
  exports.assignDefaults = assignDefaults;
@@ -22181,11 +22181,11 @@ var require_validate = __commonJS({
22181
22181
  gen.return((0, codegen_1._)`${names_1.default.errors} === 0`);
22182
22182
  }
22183
22183
  }
22184
- function assignEvaluated({ gen, evaluated, props, items }) {
22184
+ function assignEvaluated({ gen, evaluated, props, items: items2 }) {
22185
22185
  if (props instanceof codegen_1.Name)
22186
22186
  gen.assign((0, codegen_1._)`${evaluated}.props`, props);
22187
- if (items instanceof codegen_1.Name)
22188
- gen.assign((0, codegen_1._)`${evaluated}.items`, items);
22187
+ if (items2 instanceof codegen_1.Name)
22188
+ gen.assign((0, codegen_1._)`${evaluated}.items`, items2);
22189
22189
  }
22190
22190
  function schemaKeywords(it, types, typeErrors, errsCount) {
22191
22191
  const { gen, schema, data, allErrors, opts, self } = it;
@@ -22648,12 +22648,12 @@ var require_compile = __commonJS({
22648
22648
  validate.source = { validateName, validateCode, scopeValues: gen._values };
22649
22649
  }
22650
22650
  if (this.opts.unevaluated) {
22651
- const { props, items } = schemaCxt;
22651
+ const { props, items: items2 } = schemaCxt;
22652
22652
  validate.evaluated = {
22653
22653
  props: props instanceof codegen_1.Name ? void 0 : props,
22654
- items: items instanceof codegen_1.Name ? void 0 : items,
22654
+ items: items2 instanceof codegen_1.Name ? void 0 : items2,
22655
22655
  dynamicProps: props instanceof codegen_1.Name,
22656
- dynamicItems: items instanceof codegen_1.Name
22656
+ dynamicItems: items2 instanceof codegen_1.Name
22657
22657
  };
22658
22658
  if (validate.source)
22659
22659
  validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);
@@ -24719,8 +24719,8 @@ var require_ref2 = __commonJS({
24719
24719
  it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items);
24720
24720
  }
24721
24721
  } else {
24722
- const items = gen.var("items", (0, codegen_1._)`${source}.evaluated.items`);
24723
- it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name);
24722
+ const items2 = gen.var("items", (0, codegen_1._)`${source}.evaluated.items`);
24723
+ it.items = util_1.mergeEvaluated.items(gen, items2, it.items, codegen_1.Name);
24724
24724
  }
24725
24725
  }
24726
24726
  }
@@ -25260,28 +25260,28 @@ var require_additionalItems = __commonJS({
25260
25260
  error,
25261
25261
  code(cxt) {
25262
25262
  const { parentSchema, it } = cxt;
25263
- const { items } = parentSchema;
25264
- if (!Array.isArray(items)) {
25263
+ const { items: items2 } = parentSchema;
25264
+ if (!Array.isArray(items2)) {
25265
25265
  (0, util_1.checkStrictMode)(it, '"additionalItems" is ignored when "items" is not an array of schemas');
25266
25266
  return;
25267
25267
  }
25268
- validateAdditionalItems(cxt, items);
25268
+ validateAdditionalItems(cxt, items2);
25269
25269
  }
25270
25270
  };
25271
- function validateAdditionalItems(cxt, items) {
25271
+ function validateAdditionalItems(cxt, items2) {
25272
25272
  const { gen, schema, data, keyword, it } = cxt;
25273
25273
  it.items = true;
25274
25274
  const len = gen.const("len", (0, codegen_1._)`${data}.length`);
25275
25275
  if (schema === false) {
25276
- cxt.setParams({ len: items.length });
25277
- cxt.pass((0, codegen_1._)`${len} <= ${items.length}`);
25276
+ cxt.setParams({ len: items2.length });
25277
+ cxt.pass((0, codegen_1._)`${len} <= ${items2.length}`);
25278
25278
  } else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
25279
- const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items.length}`);
25279
+ const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items2.length}`);
25280
25280
  gen.if((0, codegen_1.not)(valid), () => validateItems(valid));
25281
25281
  cxt.ok(valid);
25282
25282
  }
25283
25283
  function validateItems(valid) {
25284
- gen.forRange("i", items.length, len, (i) => {
25284
+ gen.forRange("i", items2.length, len, (i) => {
25285
25285
  cxt.subschema({ keyword, dataProp: i, dataPropType: util_1.Type.Num }, valid);
25286
25286
  if (!it.allErrors)
25287
25287
  gen.if((0, codegen_1.not)(valid), () => gen.break());
@@ -26420,16 +26420,16 @@ var require_unevaluatedItems = __commonJS({
26420
26420
  error,
26421
26421
  code(cxt) {
26422
26422
  const { gen, schema, data, it } = cxt;
26423
- const items = it.items || 0;
26424
- if (items === true)
26423
+ const items2 = it.items || 0;
26424
+ if (items2 === true)
26425
26425
  return;
26426
26426
  const len = gen.const("len", (0, codegen_1._)`${data}.length`);
26427
26427
  if (schema === false) {
26428
- cxt.setParams({ len: items });
26429
- cxt.fail((0, codegen_1._)`${len} > ${items}`);
26428
+ cxt.setParams({ len: items2 });
26429
+ cxt.fail((0, codegen_1._)`${len} > ${items2}`);
26430
26430
  } else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
26431
- const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items}`);
26432
- gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items));
26431
+ const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items2}`);
26432
+ gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items2));
26433
26433
  cxt.ok(valid);
26434
26434
  }
26435
26435
  it.items = true;
@@ -29033,13 +29033,13 @@ var require_stringifyCollection = __commonJS({
29033
29033
  const stringify2 = flow ? stringifyFlowCollection : stringifyBlockCollection;
29034
29034
  return stringify2(collection, ctx, options);
29035
29035
  }
29036
- function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
29036
+ function stringifyBlockCollection({ comment, items: items2 }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
29037
29037
  const { indent, options: { commentString } } = ctx;
29038
29038
  const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });
29039
29039
  let chompKeep = false;
29040
29040
  const lines = [];
29041
- for (let i = 0; i < items.length; ++i) {
29042
- const item = items[i];
29041
+ for (let i = 0; i < items2.length; ++i) {
29042
+ const item = items2[i];
29043
29043
  let comment2 = null;
29044
29044
  if (identity.isNode(item)) {
29045
29045
  if (!chompKeep && item.spaceBefore)
@@ -29082,7 +29082,7 @@ ${indent}${line}` : "\n";
29082
29082
  onChompKeep();
29083
29083
  return str;
29084
29084
  }
29085
- function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
29085
+ function stringifyFlowCollection({ items: items2 }, ctx, { flowChars, itemIndent }) {
29086
29086
  const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
29087
29087
  itemIndent += indentStep;
29088
29088
  const itemCtx = Object.assign({}, ctx, {
@@ -29093,8 +29093,8 @@ ${indent}${line}` : "\n";
29093
29093
  let reqNewline = false;
29094
29094
  let linesAtValue = 0;
29095
29095
  const lines = [];
29096
- for (let i = 0; i < items.length; ++i) {
29097
- const item = items[i];
29096
+ for (let i = 0; i < items2.length; ++i) {
29097
+ const item = items2[i];
29098
29098
  let comment = null;
29099
29099
  if (identity.isNode(item)) {
29100
29100
  if (item.spaceBefore)
@@ -29125,7 +29125,7 @@ ${indent}${line}` : "\n";
29125
29125
  reqNewline = true;
29126
29126
  let str = stringify.stringify(item, itemCtx, () => comment = null);
29127
29127
  reqNewline || (reqNewline = lines.length > linesAtValue || str.includes("\n"));
29128
- if (i < items.length - 1) {
29128
+ if (i < items2.length - 1) {
29129
29129
  str += ",";
29130
29130
  } else if (ctx.options.trailingComma) {
29131
29131
  if (ctx.options.lineWidth > 0) {
@@ -29182,9 +29182,9 @@ var require_YAMLMap = __commonJS({
29182
29182
  var identity = require_identity();
29183
29183
  var Pair = require_Pair();
29184
29184
  var Scalar = require_Scalar();
29185
- function findPair(items, key) {
29185
+ function findPair(items2, key) {
29186
29186
  const k = identity.isScalar(key) ? key.value : key;
29187
- for (const it of items) {
29187
+ for (const it of items2) {
29188
29188
  if (identity.isPair(it)) {
29189
29189
  if (it.key === key || it.key === k)
29190
29190
  return it;
@@ -30291,15 +30291,15 @@ var require_timestamp = __commonJS({
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);
30293
30293
  const millisec = match[7] ? Number((match[7] + "00").substr(1, 3)) : 0;
30294
- let date2 = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
30294
+ let date3 = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
30295
30295
  const tz = match[8];
30296
30296
  if (tz && tz !== "Z") {
30297
30297
  let d = parseSexagesimal(tz, false);
30298
30298
  if (Math.abs(d) < 30)
30299
30299
  d *= 60;
30300
- date2 -= 6e4 * d;
30300
+ date3 -= 6e4 * d;
30301
30301
  }
30302
- return new Date(date2);
30302
+ return new Date(date3);
30303
30303
  },
30304
30304
  stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
30305
30305
  };
@@ -31132,12 +31132,12 @@ var require_util_map_includes = __commonJS({
31132
31132
  "node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/compose/util-map-includes.js"(exports) {
31133
31133
  "use strict";
31134
31134
  var identity = require_identity();
31135
- function mapIncludes(ctx, items, search) {
31135
+ function mapIncludes(ctx, items2, search) {
31136
31136
  const { uniqueKeys } = ctx.options;
31137
31137
  if (uniqueKeys === false)
31138
31138
  return false;
31139
31139
  const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a, b) => a === b || identity.isScalar(a) && identity.isScalar(b) && a.value === b.value;
31140
- return items.some((pair) => isEqual(pair.key, search));
31140
+ return items2.some((pair) => isEqual(pair.key, search));
31141
31141
  }
31142
31142
  exports.mapIncludes = mapIncludes;
31143
31143
  }
@@ -38206,7 +38206,7 @@ var FRAMEWORK_VERSION_POLICY = Object.freeze({
38206
38206
  floors: Object.freeze(["14.4.0"]),
38207
38207
  denied: Object.freeze([])
38208
38208
  }),
38209
- next: Object.freeze({ floors: Object.freeze(["16.4.1"]), denied: Object.freeze([]) }),
38209
+ next: Object.freeze({ floors: Object.freeze(["16.4.5"]), denied: Object.freeze([]) }),
38210
38210
  vite: Object.freeze({ floors: Object.freeze(["5.4.6"]), denied: Object.freeze([]) }),
38211
38211
  "@tanstack/react-start": Object.freeze({
38212
38212
  floors: Object.freeze(["1.168.60"]),
@@ -38784,14 +38784,14 @@ function isFrameworkConversionDiagnosticCode(value) {
38784
38784
  function parseFrameworkConversionDiagnostic(value) {
38785
38785
  if (typeof value !== "object" || value === null || Array.isArray(value))
38786
38786
  return null;
38787
- const record8 = value;
38788
- const code = Object.hasOwn(record8, "code") ? record8["code"] : void 0;
38789
- const path2 = Object.hasOwn(record8, "path") ? record8["path"] : void 0;
38787
+ const record9 = value;
38788
+ const code = Object.hasOwn(record9, "code") ? record9["code"] : void 0;
38789
+ const path2 = Object.hasOwn(record9, "path") ? record9["path"] : void 0;
38790
38790
  if (!isFrameworkConversionDiagnosticCode(code) || typeof path2 !== "string")
38791
38791
  return null;
38792
38792
  const definition = DETAIL_DEFINITIONS[code];
38793
- const fields = Object.entries(definition.fields ?? {}).map(([name, grammar]) => [name, grammar, Object.hasOwn(record8, name) ? record8[name] : void 0]);
38794
- if (Object.keys(record8).length !== fields.length + 2 || pathClassOf(definition, path2) === null || fields.some(([, grammar, field]) => !fieldMatches(grammar, field)))
38793
+ const fields = Object.entries(definition.fields ?? {}).map(([name, grammar]) => [name, grammar, Object.hasOwn(record9, name) ? record9[name] : void 0]);
38794
+ if (Object.keys(record9).length !== fields.length + 2 || pathClassOf(definition, path2) === null || fields.some(([, grammar, field]) => !fieldMatches(grammar, field)))
38795
38795
  return null;
38796
38796
  return Object.freeze(Object.fromEntries([
38797
38797
  ["code", code],
@@ -40103,10 +40103,10 @@ function parseDeploymentMailProgress(value) {
40103
40103
  if (typeof value2 !== "object" || value2 === null || Array.isArray(value2))
40104
40104
  invalid3();
40105
40105
  const item = value2;
40106
- const record8 = exactRecord(item, item["priority"] === void 0 ? ["type", "name", "value", "status"] : ["type", "name", "value", "status", "priority"]);
40107
- if (!["MX", "TXT", "CNAME"].includes(String(record8["type"])) || typeof record8["name"] !== "string" || record8["name"].length === 0 || record8["name"].length > 253 || /[\r\n\0]/u.test(record8["name"]) || !(record8["name"] === row["domain"] || record8["name"].endsWith(`.${row["domain"]}`)) || typeof record8["value"] !== "string" || record8["value"].length === 0 || record8["value"].length > 4096 || /[\r\n\0]/u.test(record8["value"]) || typeof record8["status"] !== "string" || record8["status"].length === 0 || record8["status"].length > 32 || /[\r\n\0]/u.test(record8["status"]) || record8["type"] === "MX" && (!Number.isSafeInteger(record8["priority"]) || Number(record8["priority"]) < 0 || Number(record8["priority"]) > 65535) || record8["type"] !== "MX" && record8["priority"] !== void 0)
40106
+ const record9 = exactRecord(item, item["priority"] === void 0 ? ["type", "name", "value", "status"] : ["type", "name", "value", "status", "priority"]);
40107
+ if (!["MX", "TXT", "CNAME"].includes(String(record9["type"])) || typeof record9["name"] !== "string" || record9["name"].length === 0 || record9["name"].length > 253 || /[\r\n\0]/u.test(record9["name"]) || !(record9["name"] === row["domain"] || record9["name"].endsWith(`.${row["domain"]}`)) || typeof record9["value"] !== "string" || record9["value"].length === 0 || record9["value"].length > 4096 || /[\r\n\0]/u.test(record9["value"]) || typeof record9["status"] !== "string" || record9["status"].length === 0 || record9["status"].length > 32 || /[\r\n\0]/u.test(record9["status"]) || record9["type"] === "MX" && (!Number.isSafeInteger(record9["priority"]) || Number(record9["priority"]) < 0 || Number(record9["priority"]) > 65535) || record9["type"] !== "MX" && record9["priority"] !== void 0)
40108
40108
  invalid3();
40109
- return Object.freeze({ ...record8 });
40109
+ return Object.freeze({ ...record9 });
40110
40110
  });
40111
40111
  return Object.freeze({ ...row, dns_records: records2 });
40112
40112
  }
@@ -40144,6 +40144,12 @@ function isSaasCnameTarget(value) {
40144
40144
 
40145
40145
  // packages/contracts/dist/problem-policy.js
40146
40146
  var PROBLEM_POLICY = {
40147
+ preview_version_conflict: {
40148
+ status: 409,
40149
+ retryable: true,
40150
+ action: "Read the preview state, then repeat the original request with the same idempotency key.",
40151
+ title: "Preview changed"
40152
+ },
40147
40153
  source_generation_conflict: {
40148
40154
  status: 409,
40149
40155
  retryable: false,
@@ -41604,8 +41610,8 @@ var isPaidValidationRecord = (value) => {
41604
41610
  if (typeof value !== "object" || value === null || Array.isArray(value) || Object.keys(value).sort().join(",") !== "content,name,purpose,type") {
41605
41611
  return false;
41606
41612
  }
41607
- const record8 = value;
41608
- return (record8["type"] === "CNAME" || record8["type"] === "TXT") && boundedString(record8["name"], 1, 253) && boundedString(record8["content"], 1, 2048) && ["traffic", "ownership", "ssl", "dcv_delegation"].includes(String(record8["purpose"]));
41613
+ const record9 = value;
41614
+ return (record9["type"] === "CNAME" || record9["type"] === "TXT") && boundedString(record9["name"], 1, 253) && boundedString(record9["content"], 1, 2048) && ["traffic", "ownership", "ssl", "dcv_delegation"].includes(String(record9["purpose"]));
41609
41615
  };
41610
41616
  var isHttpsUrlValue = (value) => typeof value === "string" && isHttpsUrl(value);
41611
41617
 
@@ -41750,7 +41756,7 @@ async function prepareLocalSourcePublication(input) {
41750
41756
  request = { ...request, expected_commit_sha: link2.source.last_confirmed_commit_sha };
41751
41757
  }
41752
41758
  parseManagedSourceRequest("upload", request);
41753
- const record8 = {
41759
+ const record9 = {
41754
41760
  version: 1,
41755
41761
  ...scope,
41756
41762
  operation_id: null,
@@ -41759,16 +41765,16 @@ async function prepareLocalSourcePublication(input) {
41759
41765
  request
41760
41766
  };
41761
41767
  if (original !== null) {
41762
- assertSameAttempt(original, record8);
41768
+ assertSameAttempt(original, record9);
41763
41769
  } else
41764
- await writePending(record8, true);
41770
+ await writePending(record9, true);
41765
41771
  return {
41766
41772
  request,
41767
41773
  accepted: async (operation) => {
41768
41774
  const current = await readPending(scope, replay);
41769
41775
  if (current === null)
41770
41776
  throw new LocalSourcePublicationError("source_publication_missing");
41771
- assertSameAttempt(current, record8);
41777
+ assertSameAttempt(current, record9);
41772
41778
  if (current.operation_id !== null && current.operation_id !== operation.id)
41773
41779
  throw new ResponseContractError();
41774
41780
  if (!replay)
@@ -41787,7 +41793,7 @@ async function prepareLocalSourcePublication(input) {
41787
41793
  const current = await readPending(scope);
41788
41794
  if (current === null || current.operation_id !== null)
41789
41795
  return;
41790
- assertSameAttempt(current, record8);
41796
+ assertSameAttempt(current, record9);
41791
41797
  } catch (error2) {
41792
41798
  if (error2 instanceof LocalSourcePublicationError && (error2.code === "source_publication_scope_mismatch" || error2.code === "source_publication_pending"))
41793
41799
  return;
@@ -41990,12 +41996,12 @@ async function readRecord(path2) {
41990
41996
  await handle?.close();
41991
41997
  }
41992
41998
  }
41993
- async function writePending(record8, create, completed = false) {
41994
- const parent = join3(record8.directory, ".ohmyhost");
41999
+ async function writePending(record9, create, completed = false) {
42000
+ const parent = join3(record9.directory, ".ohmyhost");
41995
42001
  for (const directory of [
41996
42002
  parent,
41997
- record8.metadata_directory,
41998
- join3(record8.metadata_directory, "publications")
42003
+ record9.metadata_directory,
42004
+ join3(record9.metadata_directory, "publications")
41999
42005
  ]) {
42000
42006
  try {
42001
42007
  await fs2.mkdir(directory, { mode: 448 });
@@ -42006,10 +42012,10 @@ async function writePending(record8, create, completed = false) {
42006
42012
  await checkedDirectory(directory);
42007
42013
  await fs2.chmod(directory, 448);
42008
42014
  }
42009
- const target = completed ? completedPath(record8) : pendingPath(record8);
42015
+ const target = completed ? completedPath(record9) : pendingPath(record9);
42010
42016
  const temporary = create ? target : `${target}.${randomUUID()}.tmp`;
42011
42017
  try {
42012
- await fs2.writeFile(temporary, `${JSON.stringify(record8)}
42018
+ await fs2.writeFile(temporary, `${JSON.stringify(record9)}
42013
42019
  `, { mode: 384, flag: "wx" });
42014
42020
  if (!create)
42015
42021
  await fs2.rename(temporary, target);
@@ -43607,6 +43613,8 @@ var recognizedCommandLabel = (argv) => {
43607
43613
  return value;
43608
43614
  if (value === "profile" && values[0] === "list")
43609
43615
  return "profile list";
43616
+ if (value === "connection" && ["begin", "list", "status", "discover", "disconnect"].includes(values[0] ?? ""))
43617
+ return `connection ${values[0]}`;
43610
43618
  if (value === "github" && values[0] === "connect")
43611
43619
  return "github connect";
43612
43620
  if (value === "github" && values[0] === "status")
@@ -43675,6 +43683,8 @@ var recognizedCommandLabel = (argv) => {
43675
43683
  return "project status";
43676
43684
  if (value === "project" && values[0] === "dev" && values[1] === "add")
43677
43685
  return "project dev add";
43686
+ if (value === "project" && values[0] === "preview" && ["get", "open", "stop", "rotate"].includes(values[1] ?? ""))
43687
+ return `project preview ${values[1]}`;
43678
43688
  if (value === "project" && values[0] === "handle" && values[1] === "check")
43679
43689
  return "project handle check";
43680
43690
  if (value === "project" && values[0] === "handle" && values[1] === "set")
@@ -44390,6 +44400,77 @@ var parseProductCliCommand = (argv) => {
44390
44400
  credentialStore
44391
44401
  } : { kind: "github-status", organizationId, credentialStore };
44392
44402
  }
44403
+ if (first === "connection") {
44404
+ const operation = values.shift();
44405
+ if (wait || follow || stdin || yes !== (operation === "disconnect"))
44406
+ throw new InvalidCommandError();
44407
+ const options = parseOptionalOptions(values, [
44408
+ "--organization",
44409
+ "--project",
44410
+ "--environment",
44411
+ "--grant",
44412
+ "--request",
44413
+ "--idempotency-key",
44414
+ "--provider-organization",
44415
+ "--team"
44416
+ ]);
44417
+ const org = options["--organization"];
44418
+ if (!org || !ORGANIZATION_ULID.test(org))
44419
+ throw new InvalidCommandError();
44420
+ const exact7 = (names) => Object.keys(options).every((k) => names.includes(k)) && names.every((k) => Object.hasOwn(options, k));
44421
+ const scoped = () => options["--project"] && options["--environment"] && ORGANIZATION_ULID.test(options["--project"]) && ORGANIZATION_ULID.test(options["--environment"]);
44422
+ if (operation === "list" && exact7(["--organization"]))
44423
+ return { kind: "connection-list", organizationId: org, credentialStore };
44424
+ if (operation === "begin" && scoped() && exact7(["--organization", "--project", "--environment", "--idempotency-key"]))
44425
+ return {
44426
+ kind: "connection-begin",
44427
+ organizationId: org,
44428
+ projectId: options["--project"] ?? "",
44429
+ environmentId: options["--environment"] ?? "",
44430
+ idempotencyKey: options["--idempotency-key"] ?? "",
44431
+ credentialStore
44432
+ };
44433
+ if (operation === "status" && exact7(["--organization", "--request"]) && /^[a-f0-9]{64}$/u.test(options["--request"] ?? ""))
44434
+ return {
44435
+ kind: "connection-status",
44436
+ organizationId: org,
44437
+ requestId: options["--request"] ?? "",
44438
+ credentialStore
44439
+ };
44440
+ if (operation === "disconnect" && exact7(["--organization", "--grant", "--idempotency-key"]) && ORGANIZATION_ULID.test(options["--grant"] ?? ""))
44441
+ return {
44442
+ kind: "connection-disconnect",
44443
+ organizationId: org,
44444
+ grantId: options["--grant"] ?? "",
44445
+ idempotencyKey: options["--idempotency-key"] ?? "",
44446
+ yes: true,
44447
+ credentialStore
44448
+ };
44449
+ if (operation === "discover" && scoped() && ORGANIZATION_ULID.test(options["--grant"] ?? "") && Object.keys(options).every((k) => [
44450
+ "--organization",
44451
+ "--project",
44452
+ "--environment",
44453
+ "--grant",
44454
+ "--provider-organization",
44455
+ "--team"
44456
+ ].includes(k))) {
44457
+ const number = (v) => v && /^[1-9][0-9]{0,14}$/u.test(v) && Number.isSafeInteger(Number(v)) ? Number(v) : void 0;
44458
+ const providerOrganizationId = number(options["--provider-organization"]), teamId = number(options["--team"]);
44459
+ if (options["--provider-organization"] && !providerOrganizationId || options["--team"] && (!teamId || !providerOrganizationId))
44460
+ throw new InvalidCommandError();
44461
+ return {
44462
+ kind: "connection-discover",
44463
+ organizationId: org,
44464
+ projectId: options["--project"] ?? "",
44465
+ environmentId: options["--environment"] ?? "",
44466
+ grantId: options["--grant"] ?? "",
44467
+ ...providerOrganizationId ? { providerOrganizationId } : {},
44468
+ ...teamId ? { teamId } : {},
44469
+ credentialStore
44470
+ };
44471
+ }
44472
+ throw new InvalidCommandError();
44473
+ }
44393
44474
  if (first === "organization" && values[0] === "mcp-connections") {
44394
44475
  values.shift();
44395
44476
  const subcommand = values.shift();
@@ -44512,6 +44593,30 @@ var parseProductCliCommand = (argv) => {
44512
44593
  const options2 = parseOptions(values, ["--handle"]);
44513
44594
  return { kind: "project-handle-check", handle: options2["--handle"], credentialStore };
44514
44595
  }
44596
+ if (subcommand === "preview") {
44597
+ const action = values.shift();
44598
+ if (!action || !["get", "open", "stop", "rotate"].includes(action) || wait || follow || stdin || (action === "stop" || action === "rotate") !== yes)
44599
+ throw new InvalidCommandError();
44600
+ const changing = action === "stop" || action === "rotate";
44601
+ const options2 = parseOptions(values, changing ? ["--project", "--environment", "--idempotency-key"] : ["--project", "--environment"]);
44602
+ const environment = options2["--environment"];
44603
+ if (environment !== "dev" && environment !== "prod")
44604
+ throw new InvalidCommandError();
44605
+ if (changing)
44606
+ return {
44607
+ kind: action === "stop" ? "project-preview-stop" : "project-preview-rotate",
44608
+ projectId: options2["--project"],
44609
+ environment,
44610
+ idempotencyKey: options2["--idempotency-key"],
44611
+ credentialStore
44612
+ };
44613
+ return {
44614
+ kind: action === "get" ? "project-preview-get" : "project-preview-open",
44615
+ projectId: options2["--project"],
44616
+ environment,
44617
+ credentialStore
44618
+ };
44619
+ }
44515
44620
  if (subcommand === "dev-share") {
44516
44621
  const action = values.shift();
44517
44622
  if (action === "link") {
@@ -46273,7 +46378,7 @@ function exact3(value, keys) {
46273
46378
 
46274
46379
  // packages/contracts/dist/credit-pricing.js
46275
46380
  function assertOrganizationCreditUsage(value) {
46276
- const record8 = (input, keys) => {
46381
+ const record9 = (input, keys) => {
46277
46382
  if (!input || typeof input !== "object" || Array.isArray(input) || Object.keys(input).sort().join() !== keys.split(",").sort().join())
46278
46383
  throw new TypeError("Invalid usage fields");
46279
46384
  return input;
@@ -46281,30 +46386,30 @@ function assertOrganizationCreditUsage(value) {
46281
46386
  const identifier2 = (input) => typeof input === "string" && /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(input);
46282
46387
  const amount = (input) => typeof input === "string" && /^(0|[1-9][0-9]{0,37})$/u.test(input);
46283
46388
  const instant2 = (input) => typeof input === "string" && Number.isFinite(Date.parse(input)) && new Date(input).toISOString() === input;
46284
- const report = record8(value, "organization_id,as_of,unit,period,from,projects,days");
46389
+ const report = record9(value, "organization_id,as_of,unit,period,from,projects,days");
46285
46390
  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)
46286
46391
  throw new TypeError("Invalid usage report");
46287
46392
  let previous = "";
46288
46393
  for (const input of report["projects"]) {
46289
- const project = record8(input, "project_id,used_micros");
46394
+ const project = record9(input, "project_id,used_micros");
46290
46395
  if (!identifier2(project["project_id"]) || String(project["project_id"]) <= previous || !amount(project["used_micros"]))
46291
46396
  throw new TypeError("Invalid usage project");
46292
46397
  previous = String(project["project_id"]);
46293
46398
  }
46294
46399
  let previousDay = "";
46295
46400
  for (const input of report["days"]) {
46296
- const day = record8(input, "day,projects");
46401
+ const day = record9(input, "day,projects");
46297
46402
  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)
46298
46403
  throw new TypeError("Invalid usage day");
46299
46404
  previousDay = day["day"];
46300
46405
  previous = "";
46301
46406
  for (const projectInput of day["projects"]) {
46302
- const project = record8(projectInput, "project_id,meters");
46407
+ const project = record9(projectInput, "project_id,meters");
46303
46408
  if (!identifier2(project["project_id"]) || String(project["project_id"]) <= previous || !Array.isArray(project["meters"]) || project["meters"].length > 1e3)
46304
46409
  throw new TypeError("Invalid usage project");
46305
46410
  previous = String(project["project_id"]);
46306
46411
  for (const meterInput of project["meters"]) {
46307
- const meter = record8(meterInput, "environment_id,meter,unit,rate_card_id,quantity,charged_micros");
46412
+ const meter = record9(meterInput, "environment_id,meter,unit,rate_card_id,quantity,charged_micros");
46308
46413
  if (meter["environment_id"] !== null && !identifier2(meter["environment_id"]))
46309
46414
  throw new TypeError("Invalid usage environment");
46310
46415
  for (const key of ["meter", "unit", "rate_card_id"])
@@ -46389,7 +46494,7 @@ function exact4(v, keys) {
46389
46494
  // apps/product-cli/package.json
46390
46495
  var package_default = {
46391
46496
  name: "@ohmyhost/product-cli",
46392
- version: "0.1.59",
46497
+ version: "0.1.62",
46393
46498
  private: true,
46394
46499
  ohmyhost: {
46395
46500
  deployment: "production",
@@ -46704,6 +46809,11 @@ var HELP_USAGE = Object.freeze({
46704
46809
  logout: "ohmyhost logout [--profile-name NAME] [--revoke] --json (removes only the selected saved login)",
46705
46810
  whoami: "ohmyhost whoami [--profile-name NAME] --json (the effective user, organization and saved login)",
46706
46811
  "profile list": "ohmyhost profile list --json (saved logins on this computer: name, user and organization, never a token; pass --profile-name NAME or set OHMYHOST_PROFILE to choose one)",
46812
+ "connection begin": "ohmyhost connection begin --organization ULID --project ULID --environment ULID --idempotency-key KEY --json",
46813
+ "connection list": "ohmyhost connection list --organization ULID --json",
46814
+ "connection status": "ohmyhost connection status --organization ULID --request HASH --json",
46815
+ "connection discover": "ohmyhost connection discover --organization ULID --project ULID --environment ULID --grant ULID [--provider-organization ID] [--team ID] --json",
46816
+ "connection disconnect": "ohmyhost connection disconnect --organization ULID --grant ULID --idempotency-key KEY --yes --json",
46707
46817
  "github connect": "ohmyhost github connect --organization ULID --idempotency-key KEY --json (connect once, then link covered repositories without another browser consent)",
46708
46818
  "github status": "ohmyhost github status --organization ULID --json",
46709
46819
  "github disconnect": "ohmyhost github disconnect --organization ULID --yes --json (Owner only; revokes the workspace GitHub connection and every repository grant under it, so auto-deploy and linked sources stop at once; the GitHub App stays installed for other workspaces, and github connect starts a new connection)",
@@ -46741,6 +46851,10 @@ var HELP_USAGE = Object.freeze({
46741
46851
  "project notes set": "ohmyhost project notes set --project ULID --version NUMBER --markdown TEXT --idempotency-key KEY --json (no credentials or signed URLs)",
46742
46852
  "project status": "ohmyhost project status --project ULID --json",
46743
46853
  "project dev add": "ohmyhost project dev add --project ULID --idempotency-key KEY --json",
46854
+ "project preview get": "ohmyhost project preview get --project ULID --environment dev|prod --json",
46855
+ "project preview open": "ohmyhost project preview open --project ULID --environment dev|prod --json",
46856
+ "project preview stop": "ohmyhost project preview stop --project ULID --environment dev|prod --idempotency-key KEY --yes --json",
46857
+ "project preview rotate": "ohmyhost project preview rotate --project ULID --environment dev|prod --idempotency-key KEY --yes --json",
46744
46858
  "project dev-access create": "ohmyhost project dev-access create --project ULID --json",
46745
46859
  "project dev-share link": "ohmyhost project dev-share link --project ULID --json",
46746
46860
  "project dev-share rotate": "ohmyhost project dev-share rotate --project ULID --idempotency-key KEY --yes --json",
@@ -46999,6 +47113,13 @@ var ProductCli = class {
46999
47113
  ...github.status === "connected" ? {} : { next_action: this.githubConnectAction(command.organizationId) }
47000
47114
  });
47001
47115
  }
47116
+ if (command.kind === "connection-begin" || command.kind === "connection-list" || command.kind === "connection-status" || command.kind === "connection-discover" || command.kind === "connection-disconnect") {
47117
+ const api = await this.authenticatedApi(command.credentialStore, signal);
47118
+ if (!api.connection)
47119
+ throw new ResponseContractError();
47120
+ const result = await api.connection(command);
47121
+ return success(name, { status: "ok", result });
47122
+ }
47002
47123
  if (command.kind === "organization-mcp-connections-list") {
47003
47124
  const api = await this.authenticatedApi(command.credentialStore, signal);
47004
47125
  const page = parseOrganizationMcpConnectionList(await api.listOrganizationMcpConnections(command.organizationId));
@@ -47243,6 +47364,21 @@ var ProductCli = class {
47243
47364
  return await this.getProjectStatus(command, signal);
47244
47365
  if (command.kind === "project-development-add")
47245
47366
  return await this.addProjectDevelopment(command, signal);
47367
+ if (command.kind === "project-preview-get" || command.kind === "project-preview-open" || command.kind === "project-preview-stop" || command.kind === "project-preview-rotate") {
47368
+ const api = await this.authenticatedApi(command.credentialStore, signal);
47369
+ if (!api.preview)
47370
+ throw new Error("Preview unavailable");
47371
+ const action = command.kind.slice("project-preview-".length);
47372
+ const preview = await api.preview(action, {
47373
+ projectId: command.projectId,
47374
+ environment: command.environment,
47375
+ ..."idempotencyKey" in command ? { idempotencyKey: command.idempotencyKey } : {}
47376
+ });
47377
+ return success(`project preview ${action}`, {
47378
+ status: "succeeded",
47379
+ preview
47380
+ });
47381
+ }
47246
47382
  if (command.kind === "project-dev-access-create")
47247
47383
  return await this.createDevAccessTicket(command, signal);
47248
47384
  if (command.kind === "project-flag-status" || command.kind === "project-flag-set") {
@@ -47418,7 +47554,9 @@ var ProductCli = class {
47418
47554
  throw new Error("Mail unavailable");
47419
47555
  return success(command.label, { mail: await api.managedMail(command.request) });
47420
47556
  }
47421
- return await this.deleteEnvironmentSecret(command, signal);
47557
+ if (command.kind === "secret-delete")
47558
+ return await this.deleteEnvironmentSecret(command, signal);
47559
+ throw new Error("Unsupported command");
47422
47560
  } catch (error) {
47423
47561
  if (error instanceof UserTokenFileError || error instanceof PrivateSecretFileError)
47424
47562
  return failure(name, 3, error.code, false, error.message);
@@ -49000,6 +49138,16 @@ var parsedCommandName = (command) => {
49000
49138
  return "github status";
49001
49139
  if (command.kind === "github-disconnect")
49002
49140
  return "github disconnect";
49141
+ if (command.kind === "connection-begin")
49142
+ return "connection begin";
49143
+ if (command.kind === "connection-list")
49144
+ return "connection list";
49145
+ if (command.kind === "connection-status")
49146
+ return "connection status";
49147
+ if (command.kind === "connection-discover")
49148
+ return "connection discover";
49149
+ if (command.kind === "connection-disconnect")
49150
+ return "connection disconnect";
49003
49151
  if (command.kind === "organization-mcp-connections-list")
49004
49152
  return "organization mcp-connections list";
49005
49153
  if (command.kind === "organization-mcp-connection-revoke")
@@ -49018,6 +49166,14 @@ var parsedCommandName = (command) => {
49018
49166
  return "project status";
49019
49167
  if (command.kind === "project-development-add")
49020
49168
  return "project dev add";
49169
+ if (command.kind === "project-preview-get")
49170
+ return "project preview get";
49171
+ if (command.kind === "project-preview-open")
49172
+ return "project preview open";
49173
+ if (command.kind === "project-preview-stop")
49174
+ return "project preview stop";
49175
+ if (command.kind === "project-preview-rotate")
49176
+ return "project preview rotate";
49021
49177
  if (command.kind === "project-dev-access-create")
49022
49178
  return "project dev-access create";
49023
49179
  if (command.kind === "project-dev-share-link")
@@ -49286,12 +49442,12 @@ function buildClientParams(args, fields) {
49286
49442
  };
49287
49443
  const map = buildKeyMap(fields);
49288
49444
  function writeSlot(slot, key, value) {
49289
- let record8 = params[slot];
49290
- if (record8 === void 0) {
49291
- record8 = /* @__PURE__ */ Object.create(null);
49292
- params[slot] = record8;
49445
+ let record9 = params[slot];
49446
+ if (record9 === void 0) {
49447
+ record9 = /* @__PURE__ */ Object.create(null);
49448
+ params[slot] = record9;
49293
49449
  }
49294
- record8[key] = value;
49450
+ record9[key] = value;
49295
49451
  }
49296
49452
  let config;
49297
49453
  for (const [index, arg] of args.entries()) {
@@ -50071,6 +50227,180 @@ var createClient = (config = {}) => {
50071
50227
  var client = createClient(createConfig({ throwOnError: true }));
50072
50228
 
50073
50229
  // packages/sdk-ts/dist/generated/sdk.gen.js
50230
+ var stopProjectPreview = (parameters, options) => {
50231
+ const params = buildClientParams([parameters], [
50232
+ {
50233
+ args: [
50234
+ { in: "headers", key: "X-Request-Id" },
50235
+ { in: "headers", key: "Idempotency-Key" },
50236
+ { in: "path", key: "project_id" },
50237
+ { in: "query", key: "environment" }
50238
+ ]
50239
+ }
50240
+ ]);
50241
+ return (options?.client ?? client).delete({
50242
+ responseStyle: "data",
50243
+ security: [{ scheme: "bearer", type: "http" }],
50244
+ url: "/v1/projects/{project_id}/preview",
50245
+ ...options,
50246
+ ...params
50247
+ });
50248
+ };
50249
+ var getProjectPreview = (parameters, options) => {
50250
+ const params = buildClientParams([parameters], [
50251
+ {
50252
+ args: [
50253
+ { in: "headers", key: "X-Request-Id" },
50254
+ { in: "path", key: "project_id" },
50255
+ { in: "query", key: "environment" }
50256
+ ]
50257
+ }
50258
+ ]);
50259
+ return (options?.client ?? client).get({
50260
+ responseStyle: "data",
50261
+ security: [{ scheme: "bearer", type: "http" }],
50262
+ url: "/v1/projects/{project_id}/preview",
50263
+ ...options,
50264
+ ...params
50265
+ });
50266
+ };
50267
+ var openProjectPreview = (parameters, options) => {
50268
+ const params = buildClientParams([parameters], [
50269
+ {
50270
+ args: [
50271
+ { in: "headers", key: "X-Request-Id" },
50272
+ { in: "path", key: "project_id" },
50273
+ { in: "query", key: "environment" }
50274
+ ]
50275
+ }
50276
+ ]);
50277
+ return (options?.client ?? client).post({
50278
+ responseStyle: "data",
50279
+ security: [{ scheme: "bearer", type: "http" }],
50280
+ url: "/v1/projects/{project_id}/preview",
50281
+ ...options,
50282
+ ...params
50283
+ });
50284
+ };
50285
+ var rotateProjectPreviewToken = (parameters, options) => {
50286
+ const params = buildClientParams([parameters], [
50287
+ {
50288
+ args: [
50289
+ { in: "headers", key: "X-Request-Id" },
50290
+ { in: "headers", key: "Idempotency-Key" },
50291
+ { in: "path", key: "project_id" },
50292
+ { in: "query", key: "environment" }
50293
+ ]
50294
+ }
50295
+ ]);
50296
+ return (options?.client ?? client).post({
50297
+ responseStyle: "data",
50298
+ security: [{ scheme: "bearer", type: "http" }],
50299
+ url: "/v1/projects/{project_id}/preview/token",
50300
+ ...options,
50301
+ ...params
50302
+ });
50303
+ };
50304
+ var listConnections = (parameters, options) => {
50305
+ const params = buildClientParams([parameters], [
50306
+ {
50307
+ args: [
50308
+ { in: "headers", key: "X-Request-Id" },
50309
+ { in: "path", key: "organization_id" }
50310
+ ]
50311
+ }
50312
+ ]);
50313
+ return (options?.client ?? client).get({
50314
+ responseStyle: "data",
50315
+ security: [{ scheme: "bearer", type: "http" }],
50316
+ url: "/v1/organizations/{organization_id}/connections",
50317
+ ...options,
50318
+ ...params
50319
+ });
50320
+ };
50321
+ var beginConnection = (parameters, options) => {
50322
+ const params = buildClientParams([parameters], [
50323
+ {
50324
+ args: [
50325
+ { in: "headers", key: "X-Request-Id" },
50326
+ { in: "headers", key: "Idempotency-Key" },
50327
+ { in: "path", key: "organization_id" },
50328
+ { key: "connectionBegin", map: "body" }
50329
+ ]
50330
+ }
50331
+ ]);
50332
+ return (options?.client ?? client).post({
50333
+ responseStyle: "data",
50334
+ security: [{ scheme: "bearer", type: "http" }],
50335
+ url: "/v1/organizations/{organization_id}/connections/begin",
50336
+ ...options,
50337
+ ...params,
50338
+ headers: {
50339
+ "Content-Type": "application/json",
50340
+ ...options?.headers,
50341
+ ...params.headers
50342
+ }
50343
+ });
50344
+ };
50345
+ var getConnectionRequest = (parameters, options) => {
50346
+ const params = buildClientParams([parameters], [
50347
+ {
50348
+ args: [
50349
+ { in: "headers", key: "X-Request-Id" },
50350
+ { in: "path", key: "organization_id" },
50351
+ { in: "path", key: "request_id" }
50352
+ ]
50353
+ }
50354
+ ]);
50355
+ return (options?.client ?? client).get({
50356
+ responseStyle: "data",
50357
+ security: [{ scheme: "bearer", type: "http" }],
50358
+ url: "/v1/organizations/{organization_id}/connections/requests/{request_id}",
50359
+ ...options,
50360
+ ...params
50361
+ });
50362
+ };
50363
+ var discoverConnection = (parameters, options) => {
50364
+ const params = buildClientParams([parameters], [
50365
+ {
50366
+ args: [
50367
+ { in: "headers", key: "X-Request-Id" },
50368
+ { in: "path", key: "organization_id" },
50369
+ { in: "path", key: "grant_id" },
50370
+ { in: "query", key: "project_id" },
50371
+ { in: "query", key: "environment_id" },
50372
+ { in: "query", key: "provider_organization_id" },
50373
+ { in: "query", key: "team_id" }
50374
+ ]
50375
+ }
50376
+ ]);
50377
+ return (options?.client ?? client).get({
50378
+ responseStyle: "data",
50379
+ security: [{ scheme: "bearer", type: "http" }],
50380
+ url: "/v1/organizations/{organization_id}/connections/{grant_id}/catalog",
50381
+ ...options,
50382
+ ...params
50383
+ });
50384
+ };
50385
+ var disconnectConnection = (parameters, options) => {
50386
+ const params = buildClientParams([parameters], [
50387
+ {
50388
+ args: [
50389
+ { in: "headers", key: "X-Request-Id" },
50390
+ { in: "headers", key: "Idempotency-Key" },
50391
+ { in: "path", key: "organization_id" },
50392
+ { in: "path", key: "grant_id" }
50393
+ ]
50394
+ }
50395
+ ]);
50396
+ return (options?.client ?? client).delete({
50397
+ responseStyle: "data",
50398
+ security: [{ scheme: "bearer", type: "http" }],
50399
+ url: "/v1/organizations/{organization_id}/connections/{grant_id}",
50400
+ ...options,
50401
+ ...params
50402
+ });
50403
+ };
50074
50404
  var getNativeAuthConfiguration = (parameters, options) => {
50075
50405
  const params = buildClientParams([parameters], [
50076
50406
  {
@@ -53922,204 +54252,1096 @@ function checkedResponse(kind, value) {
53922
54252
  }
53923
54253
  }
53924
54254
 
53925
- // apps/product-cli/dist/product-api.js
53926
- import { randomUUID as randomUUID3 } from "node:crypto";
53927
- var WEBHOOK_SCOPE_MISMATCH = "Webhook response scope mismatch";
53928
- var WATCH_SCOPE_MISMATCH = "Watch response scope mismatch";
53929
- var TABLE_SCOPE_MISMATCH = "Table response scope mismatch";
53930
- var SCHEDULE_SCOPE_MISMATCH = "Schedule response scope mismatch";
53931
- function assertDatabaseTableAnswer(value) {
53932
- const table = isRecordValue(value) ? value["table"] : void 0;
53933
- const columns = isRecordValue(table) ? table["columns"] : void 0;
53934
- const primaryKey = isRecordValue(table) ? table["primary_key"] : void 0;
53935
- if (!isRecordValue(table) || !hasExactKeys(table, ["environment", "schema", "table", "columns", "primary_key", "created"]) || table["environment"] !== "dev" && table["environment"] !== "prod" || table["schema"] !== "public" || !isDatabaseTableIdentifier(table["table"]) || typeof table["created"] !== "boolean" || !Array.isArray(columns) || columns.length < 1 || !columns.every(isDatabaseTableAnswerColumn) || !Array.isArray(primaryKey) || !primaryKey.every((name) => columns.some((column) => column["name"] === name)))
53936
- throw new TypeError("Invalid database table answer");
53937
- }
53938
- function isDatabaseTableAnswerColumn(value) {
53939
- return isRecordValue(value) && hasExactKeys(value, ["name", "type", "nullable", "identity", "default"]) && isDatabaseTableIdentifier(value["name"]) && DATABASE_TABLE_COLUMN_TYPES.includes(value["type"]) && typeof value["nullable"] === "boolean" && typeof value["identity"] === "boolean" && (value["default"] === null || DATABASE_TABLE_DEFAULTS.includes(value["default"]));
53940
- }
53941
- function isRecordValue(value) {
53942
- return typeof value === "object" && value !== null && !Array.isArray(value);
53943
- }
53944
- function hasExactKeys(value, keys) {
53945
- return Object.keys(value).sort().join(",") === [...keys].sort().join(",");
54255
+ // packages/contracts/dist/connection-management.js
54256
+ var ulid5 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
54257
+ function record8(raw, keys) {
54258
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
54259
+ throw new TypeError("Invalid connection response");
54260
+ const value = raw;
54261
+ if (Object.keys(value).length !== keys.length || keys.some((key) => !Object.hasOwn(value, key)))
54262
+ throw new TypeError("Invalid connection response");
54263
+ return value;
53946
54264
  }
53947
- var GeneratedSdkProductApi = class {
53948
- #client;
53949
- managedSource;
53950
- constructor(baseUrl, accessToken, fetch2) {
53951
- this.#client = createClient({ auth: accessToken, baseUrl, fetch: fetch2, throwOnError: true });
53952
- this.managedSource = new GeneratedSdkManagedSourceApi(() => this.#client);
53953
- }
53954
- async changeDatabaseCompute(input) {
53955
- return changeDatabaseCompute({
53956
- project_id: input.projectId,
53957
- body: {
53958
- environment: input.environment,
53959
- ...input.memoryMiB === void 0 ? { profile: input.profile } : { memory_mib: input.memoryMiB },
53960
- confirm: true
53961
- },
53962
- "Idempotency-Key": input.idempotencyKey
53963
- }, { client: this.#client });
53964
- }
53965
- async getDatabaseCompute(input) {
53966
- const value = await getDatabaseCompute({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
53967
- assertDatabaseCompute(value);
53968
- if (value.project_id !== input.projectId || value.environment !== input.environment)
53969
- throw new TypeError("Compute response scope mismatch");
53970
- return value;
53971
- }
53972
- async getProjectContext(projectId) {
53973
- const result = await getProjectContext({ project_id: projectId }, { client: this.#client });
53974
- assertProjectContext(result);
53975
- if (result.project_id !== projectId)
53976
- throw new TypeError("Project context scope mismatch");
53977
- return result;
53978
- }
53979
- async setProjectNotes(input) {
53980
- const result = await setProjectNotes({
53981
- project_id: input.projectId,
53982
- markdown: input.markdown,
53983
- expected_version: input.expectedVersion,
53984
- "Idempotency-Key": input.idempotencyKey
53985
- }, { client: this.#client });
53986
- assertProjectNotesReceipt(result);
53987
- return result;
53988
- }
53989
- createProjectExport(input) {
53990
- return createProjectExport({
53991
- project_id: input.projectId,
53992
- password: input.password,
53993
- "Idempotency-Key": input.idempotencyKey
53994
- }, { client: this.#client });
53995
- }
53996
- async getProjectExport(input) {
53997
- const result = await getProjectExport({ project_id: input.projectId, export_id: input.exportId }, { client: this.#client });
53998
- assertProjectExport(result);
53999
- return result;
54000
- }
54001
- async createProjectExportDownloadLink(input) {
54002
- const result = await createProjectExportDownloadLink({ project_id: input.projectId, export_id: input.exportId }, { client: this.#client });
54003
- assertProjectExportDownloadLink(result);
54004
- return result;
54005
- }
54006
- async getCurrentIdentity() {
54007
- return getCurrentIdentity({}, { client: this.#client });
54008
- }
54009
- async getAccountProfile() {
54010
- return parseAccountProfile(await getAccountProfile({ client: this.#client }));
54011
- }
54012
- getOrganizationReferral(organizationId) {
54013
- return getOrganizationReferral({ organization_id: organizationId }, { client: this.#client });
54014
- }
54015
- getOrganizationAccount(organizationId) {
54016
- return getOrganizationAccount({ organization_id: organizationId }, { client: this.#client });
54017
- }
54018
- getOrganizationCredits(organizationId) {
54019
- return getOrganizationCredits({ organization_id: organizationId }, { client: this.#client });
54020
- }
54021
- async createUserApiKey(input) {
54022
- return parseUserApiKeyCreation(await createUserApiKey({
54023
- organization_id: input.organizationId,
54024
- name: input.name,
54025
- "Idempotency-Key": input.idempotencyKey
54026
- }, { client: this.#client }));
54027
- }
54028
- async listUserApiKeys(input) {
54029
- return parseUserApiKeyPage(await listUserApiKeys({ organization_id: input.organizationId, ...input.after ? { after: input.after } : {} }, { client: this.#client }));
54030
- }
54031
- async revokeUserApiKey(input) {
54032
- await revokeUserApiKey({ organization_id: input.organizationId, key_id: input.keyId }, { client: this.#client });
54033
- }
54034
- createBillingCheckout(input) {
54035
- return createBillingCheckout({
54036
- organization_id: input.organizationId,
54037
- offer: input.offer,
54038
- packs: input.packs,
54039
- "Idempotency-Key": input.idempotencyKey
54040
- }, { client: this.#client });
54041
- }
54042
- getBillingCheckout(input) {
54043
- return getBillingCheckout({ organization_id: input.organizationId, checkout_id: input.checkoutId }, { client: this.#client });
54044
- }
54045
- getBillingRecharge(organizationId) {
54046
- return getBillingRecharge({ organization_id: organizationId }, { client: this.#client });
54047
- }
54048
- configureBillingRecharge(input) {
54049
- return configureBillingRecharge({
54050
- organization_id: input.organizationId,
54051
- "Idempotency-Key": input.idempotencyKey,
54052
- enabled: input.enabled,
54053
- monthly_limit_minor: input.monthlyLimitMinor,
54054
- consent: input.consent,
54055
- revision: input.revision
54056
- }, { client: this.#client });
54057
- }
54058
- createBillingPortal(organizationId) {
54059
- return createBillingPortal({ organization_id: organizationId, body: {} }, { client: this.#client });
54060
- }
54061
- getOrganizationCreditUsage(organizationId) {
54062
- return getOrganizationCreditUsage({ organization_id: organizationId }, { client: this.#client });
54063
- }
54064
- getProjectCreditBudget(projectId) {
54065
- return getProjectCreditBudget({ project_id: projectId }, { client: this.#client });
54066
- }
54067
- setProjectCreditBudget(input) {
54068
- return setProjectCreditBudget({
54069
- project_id: input.projectId,
54070
- "Idempotency-Key": input.idempotencyKey,
54071
- setProjectCreditBudgetRequest: { amount_micros: input.amountMicros, mode: input.mode }
54072
- }, { client: this.#client });
54073
- }
54074
- createOrganization(input) {
54075
- return createOrganization({
54076
- "Idempotency-Key": input.idempotencyKey,
54077
- createOrganizationRequest: {
54078
- name: input.name,
54079
- ...input.signupSource === void 0 ? {} : { signup_source: input.signupSource }
54080
- }
54081
- }, { client: this.#client });
54082
- }
54083
- async listProjects(input) {
54084
- return listProjects(input, { client: this.#client });
54085
- }
54086
- async changeProjectHandle(input) {
54087
- return changeProjectHandle({
54088
- project_id: input.projectId,
54089
- "Idempotency-Key": input.idempotencyKey,
54090
- "If-Match": input.ifMatch,
54091
- handle: input.handle
54092
- }, { client: this.#client });
54093
- }
54094
- async checkProjectHandle(input) {
54095
- return getProjectHandleAvailability({ handle: input.handle }, { client: this.#client });
54096
- }
54097
- async getProjectStatus(projectId) {
54098
- return getProjectStatus({ project_id: projectId }, { client: this.#client });
54099
- }
54100
- async writeProjectDatabase(input) {
54101
- return writeProjectDatabase({
54102
- project_id: input.projectId,
54103
- "Idempotency-Key": input.idempotencyKey,
54104
- projectDatabaseWriteRequest: {
54105
- environment: input.environment,
54106
- statement: input.statement,
54107
- parameters: [...input.parameters]
54108
- }
54109
- }, { client: this.#client });
54265
+ function date2(raw) {
54266
+ if (typeof raw !== "string" || !Number.isFinite(Date.parse(raw)))
54267
+ throw new TypeError("Invalid connection response");
54268
+ }
54269
+ function items(raw) {
54270
+ if (!Array.isArray(raw) || raw.length > 1e4)
54271
+ throw new TypeError("Invalid connection response");
54272
+ for (const row of raw) {
54273
+ const v = record8(row, ["id", "name"]);
54274
+ if (!Number.isSafeInteger(v["id"]) || Number(v["id"]) < 1 || typeof v["name"] !== "string" || !v["name"] || v["name"].length > 1024)
54275
+ throw new TypeError("Invalid connection response");
54276
+ }
54277
+ }
54278
+ function parseConnectionResponse(kind, raw, expectedOrigin) {
54279
+ if (kind === "connection-begin") {
54280
+ const v = record8(raw, ["request_id", "url", "expires_at"]);
54281
+ date2(v["expires_at"]);
54282
+ if (typeof v["request_id"] !== "string" || !/^[a-f0-9]{64}$/u.test(v["request_id"]) || typeof v["url"] !== "string")
54283
+ throw new TypeError("Invalid connection response");
54284
+ const url = new URL(v["url"]);
54285
+ if (!["https://app.ohmyho.st", "https://dev.app.ohmyho.st"].includes(url.origin) || expectedOrigin !== void 0 && url.origin !== expectedOrigin || url.pathname !== "/connections/authorize" || url.hash || url.searchParams.size !== 1 || !/^[A-Za-z0-9_-]{43}$/u.test(url.searchParams.get("request") ?? ""))
54286
+ throw new TypeError("Invalid connection response");
54287
+ } else if (kind === "connection-status") {
54288
+ const v = record8(raw, ["state", "expires_at"]);
54289
+ date2(v["expires_at"]);
54290
+ if (!["pending", "consumed", "expired"].includes(String(v["state"])))
54291
+ throw new TypeError("Invalid connection response");
54292
+ } else if (kind === "connection-disconnect") {
54293
+ const v = record8(raw, ["state"]);
54294
+ if (!["disconnected", "revocation_pending"].includes(String(v["state"])))
54295
+ throw new TypeError("Invalid connection response");
54296
+ } else if (kind === "connection-discover") {
54297
+ const v = record8(raw, ["organizations", "teams", "connections"]);
54298
+ items(v["organizations"]);
54299
+ items(v["teams"]);
54300
+ items(v["connections"]);
54301
+ } else {
54302
+ const v = record8(raw, ["connections"]);
54303
+ if (!Array.isArray(v["connections"]) || v["connections"].length > 1e4)
54304
+ throw new TypeError("Invalid connection response");
54305
+ for (const row of v["connections"]) {
54306
+ const grant = record8(row, ["id", "provider", "state", "created_at"]);
54307
+ date2(grant["created_at"]);
54308
+ if (typeof grant["id"] !== "string" || !ulid5.test(grant["id"]) || grant["provider"] !== "make" || !["active", "refreshing", "reconnect_required", "disconnecting", "disconnected"].includes(String(grant["state"])))
54309
+ throw new TypeError("Invalid connection response");
54310
+ }
54110
54311
  }
54111
- async queryProjectDatabase(input) {
54112
- return queryProjectDatabase({
54113
- project_id: input.projectId,
54114
- projectDatabaseQueryRequest: {
54115
- environment: input.environment,
54116
- statement: input.statement,
54117
- parameters: [...input.parameters]
54312
+ return raw;
54313
+ }
54314
+
54315
+ // apps/product-cli/dist/product-api.js
54316
+ import { randomUUID as randomUUID3 } from "node:crypto";
54317
+
54318
+ // packages/contracts/dist/index.js
54319
+ var import__ = __toESM(require__(), 1);
54320
+ var import_yaml = __toESM(require_dist(), 1);
54321
+
54322
+ // packages/contracts/schemas/ohmyhost.schema.json
54323
+ var ohmyhost_schema_default = {
54324
+ $schema: "https://json-schema.org/draft/2020-12/schema",
54325
+ $id: "https://schemas.ohmyho.st/ohmyhost/v1/schema.json",
54326
+ title: "ohmyhost.yaml",
54327
+ description: "Version 1 project build and runtime configuration.",
54328
+ type: "object",
54329
+ additionalProperties: false,
54330
+ required: ["version", "project", "build", "runtime"],
54331
+ properties: {
54332
+ version: {
54333
+ const: 1
54334
+ },
54335
+ project: {
54336
+ type: "string",
54337
+ minLength: 1,
54338
+ maxLength: 63,
54339
+ pattern: "^[a-z](?:[a-z0-9-]*[a-z0-9])?$"
54340
+ },
54341
+ applicationRoot: {
54342
+ $ref: "#/$defs/applicationRoot"
54343
+ },
54344
+ build: {
54345
+ $ref: "#/$defs/build"
54346
+ },
54347
+ runtime: {
54348
+ $ref: "#/$defs/runtime"
54349
+ },
54350
+ database: {
54351
+ $ref: "#/$defs/database"
54352
+ },
54353
+ auth: {
54354
+ $ref: "#/$defs/auth"
54355
+ },
54356
+ mail: {
54357
+ $ref: "#/$defs/mail"
54358
+ },
54359
+ storage: {
54360
+ $ref: "#/$defs/storage"
54361
+ },
54362
+ ai: {
54363
+ $ref: "#/$defs/ai"
54364
+ },
54365
+ functions: {
54366
+ $ref: "#/$defs/functions"
54367
+ },
54368
+ credits: {
54369
+ $ref: "#/$defs/credits"
54370
+ },
54371
+ browser: {
54372
+ $ref: "#/$defs/browserRendering"
54373
+ }
54374
+ },
54375
+ $defs: {
54376
+ applicationRoot: {
54377
+ type: "string",
54378
+ minLength: 1,
54379
+ maxLength: 64,
54380
+ pattern: "^(?:\\.|[A-Za-z0-9][A-Za-z0-9._-]*(?:/[A-Za-z0-9][A-Za-z0-9._-]*)*)$",
54381
+ allOf: [
54382
+ {
54383
+ pattern: "^(?:\\.|[A-Za-z0-9][A-Za-z0-9._-]{0,62}(?:/[A-Za-z0-9][A-Za-z0-9._-]{0,62}){0,7})$"
54384
+ }
54385
+ ]
54386
+ },
54387
+ nonEmptyCommand: {
54388
+ type: "string",
54389
+ minLength: 1,
54390
+ maxLength: 4096
54391
+ },
54392
+ relativePath: {
54393
+ type: "string",
54394
+ minLength: 1,
54395
+ maxLength: 512,
54396
+ pattern: "^(?!/)(?!.*[\\\\:])(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
54397
+ },
54398
+ build: {
54399
+ type: "object",
54400
+ additionalProperties: false,
54401
+ required: ["install"],
54402
+ properties: {
54403
+ install: {
54404
+ $ref: "#/$defs/nonEmptyCommand"
54405
+ },
54406
+ command: {
54407
+ $ref: "#/$defs/nonEmptyCommand"
54408
+ },
54409
+ output: {
54410
+ $ref: "#/$defs/relativePath"
54411
+ },
54412
+ ssg_cache_max_mib: {
54413
+ type: "integer",
54414
+ minimum: 1,
54415
+ maximum: 64,
54416
+ description: "Maximum private immutable Next.js prerender cache in MiB; defaults to 32. Cache storage costs zero credits. Public assets retain their independent limit."
54417
+ },
54418
+ next_revalidate_path: {
54419
+ type: "boolean",
54420
+ description: "Opt into deployment-scoped on-demand Next.js path revalidation."
54421
+ }
54118
54422
  }
54119
- }, { client: this.#client });
54120
- }
54121
- /** The connection URI exists only in this response; nothing in the CLI persists it. */
54122
- async createProjectDatabaseAccess(input) {
54423
+ },
54424
+ runtime: {
54425
+ type: "object",
54426
+ additionalProperties: false,
54427
+ required: ["mode"],
54428
+ properties: {
54429
+ mode: {
54430
+ type: "string",
54431
+ enum: ["static", "edge", "functions", "auto"]
54432
+ },
54433
+ healthcheck: {
54434
+ type: "string",
54435
+ minLength: 1,
54436
+ maxLength: 256,
54437
+ pattern: "^/"
54438
+ },
54439
+ browser: {
54440
+ $ref: "#/$defs/browser"
54441
+ },
54442
+ egress: {
54443
+ type: "object",
54444
+ additionalProperties: false,
54445
+ required: ["allow"],
54446
+ properties: {
54447
+ allow: {
54448
+ type: "array",
54449
+ maxItems: 13,
54450
+ uniqueItems: true,
54451
+ items: {
54452
+ type: "string",
54453
+ minLength: 1,
54454
+ maxLength: 256,
54455
+ pattern: "^https://"
54456
+ }
54457
+ }
54458
+ }
54459
+ }
54460
+ }
54461
+ },
54462
+ browserOrigins: {
54463
+ type: "array",
54464
+ maxItems: 16,
54465
+ uniqueItems: true,
54466
+ items: {
54467
+ type: "string",
54468
+ minLength: 1,
54469
+ maxLength: 256,
54470
+ pattern: "^https://"
54471
+ }
54472
+ },
54473
+ browser: {
54474
+ type: "object",
54475
+ additionalProperties: false,
54476
+ properties: {
54477
+ connect: {
54478
+ type: "array",
54479
+ maxItems: 16,
54480
+ uniqueItems: true,
54481
+ items: {
54482
+ type: "string",
54483
+ minLength: 1,
54484
+ maxLength: 256,
54485
+ pattern: "^(?:https|wss)://"
54486
+ }
54487
+ },
54488
+ scripts: {
54489
+ $ref: "#/$defs/browserOrigins"
54490
+ },
54491
+ styles: {
54492
+ $ref: "#/$defs/browserOrigins"
54493
+ },
54494
+ images: {
54495
+ $ref: "#/$defs/browserOrigins"
54496
+ },
54497
+ fonts: {
54498
+ $ref: "#/$defs/browserOrigins"
54499
+ },
54500
+ frames: {
54501
+ $ref: "#/$defs/browserOrigins"
54502
+ },
54503
+ frameAncestors: {
54504
+ $ref: "#/$defs/browserOrigins"
54505
+ },
54506
+ workers: {
54507
+ type: "object",
54508
+ additionalProperties: false,
54509
+ properties: {
54510
+ self: {
54511
+ type: "boolean"
54512
+ },
54513
+ blob: {
54514
+ type: "boolean"
54515
+ }
54516
+ }
54517
+ },
54518
+ cors: {
54519
+ type: "object",
54520
+ additionalProperties: false,
54521
+ properties: {
54522
+ origins: {
54523
+ $ref: "#/$defs/browserOrigins"
54524
+ },
54525
+ credentials: {
54526
+ type: "boolean"
54527
+ }
54528
+ }
54529
+ }
54530
+ }
54531
+ },
54532
+ database: {
54533
+ type: "object",
54534
+ additionalProperties: false,
54535
+ required: ["enabled"],
54536
+ properties: {
54537
+ enabled: {
54538
+ type: "boolean"
54539
+ },
54540
+ migrations: {
54541
+ $ref: "#/$defs/relativePath"
54542
+ }
54543
+ },
54544
+ if: {
54545
+ properties: {
54546
+ enabled: {
54547
+ const: true
54548
+ }
54549
+ },
54550
+ required: ["enabled"]
54551
+ },
54552
+ then: {
54553
+ properties: {
54554
+ migrations: {
54555
+ $ref: "#/$defs/relativePath"
54556
+ }
54557
+ },
54558
+ required: ["migrations"]
54559
+ }
54560
+ },
54561
+ mail: {
54562
+ type: "object",
54563
+ additionalProperties: false,
54564
+ required: ["enabled"],
54565
+ properties: {
54566
+ enabled: {
54567
+ type: "boolean"
54568
+ }
54569
+ }
54570
+ },
54571
+ storage: {
54572
+ type: "object",
54573
+ additionalProperties: false,
54574
+ required: ["provider", "jurisdiction", "public"],
54575
+ properties: {
54576
+ provider: {
54577
+ const: "r2"
54578
+ },
54579
+ jurisdiction: {
54580
+ type: "string",
54581
+ enum: ["us", "eu"]
54582
+ },
54583
+ public: {
54584
+ const: false
54585
+ }
54586
+ }
54587
+ },
54588
+ ai: {
54589
+ type: "object",
54590
+ additionalProperties: false,
54591
+ required: ["enabled"],
54592
+ properties: {
54593
+ enabled: {
54594
+ type: "boolean"
54595
+ },
54596
+ jurisdiction: {
54597
+ type: "string",
54598
+ enum: ["eu", "any"]
54599
+ }
54600
+ },
54601
+ if: {
54602
+ properties: {
54603
+ enabled: {
54604
+ const: true
54605
+ }
54606
+ },
54607
+ required: ["enabled"]
54608
+ },
54609
+ then: {
54610
+ properties: {
54611
+ jurisdiction: {
54612
+ type: "string",
54613
+ enum: ["eu", "any"]
54614
+ }
54615
+ },
54616
+ required: ["jurisdiction"]
54617
+ }
54618
+ },
54619
+ auth: {
54620
+ type: "object",
54621
+ additionalProperties: false,
54622
+ required: ["provider"],
54623
+ properties: {
54624
+ provider: {
54625
+ type: "string",
54626
+ enum: ["none", "better-auth", "omh-native"]
54627
+ }
54628
+ }
54629
+ },
54630
+ functions: {
54631
+ type: "object",
54632
+ additionalProperties: false,
54633
+ required: ["crons"],
54634
+ properties: {
54635
+ crons: {
54636
+ type: "array",
54637
+ minItems: 1,
54638
+ maxItems: 8,
54639
+ uniqueItems: true,
54640
+ items: {
54641
+ type: "string",
54642
+ minLength: 9,
54643
+ maxLength: 64
54644
+ }
54645
+ }
54646
+ }
54647
+ },
54648
+ credits: {
54649
+ type: "object",
54650
+ additionalProperties: false,
54651
+ required: ["monthly_budget"],
54652
+ properties: {
54653
+ monthly_budget: {
54654
+ type: "integer",
54655
+ minimum: 0,
54656
+ maximum: 1e9
54657
+ },
54658
+ auto_recharge: {
54659
+ $ref: "#/$defs/autoRecharge"
54660
+ }
54661
+ }
54662
+ },
54663
+ autoRecharge: {
54664
+ type: "object",
54665
+ additionalProperties: false,
54666
+ required: ["enabled"],
54667
+ properties: {
54668
+ enabled: {
54669
+ type: "boolean"
54670
+ },
54671
+ threshold: {
54672
+ type: "integer",
54673
+ minimum: 0,
54674
+ maximum: 1e6
54675
+ },
54676
+ amount_usd_micros: {
54677
+ type: "integer",
54678
+ minimum: 1,
54679
+ maximum: 9007199254740991
54680
+ },
54681
+ monthly_cap_usd_micros: {
54682
+ type: "integer",
54683
+ minimum: 1,
54684
+ maximum: 9007199254740991
54685
+ }
54686
+ },
54687
+ if: {
54688
+ properties: {
54689
+ enabled: {
54690
+ const: true
54691
+ }
54692
+ },
54693
+ required: ["enabled"]
54694
+ },
54695
+ then: {
54696
+ properties: {
54697
+ threshold: {
54698
+ type: "integer",
54699
+ minimum: 0,
54700
+ maximum: 1e6
54701
+ },
54702
+ amount_usd_micros: {
54703
+ type: "integer",
54704
+ minimum: 1,
54705
+ maximum: 9007199254740991
54706
+ },
54707
+ monthly_cap_usd_micros: {
54708
+ type: "integer",
54709
+ minimum: 1,
54710
+ maximum: 9007199254740991
54711
+ }
54712
+ },
54713
+ required: ["threshold", "amount_usd_micros", "monthly_cap_usd_micros"]
54714
+ }
54715
+ },
54716
+ browserRendering: {
54717
+ type: "object",
54718
+ additionalProperties: false,
54719
+ required: ["enabled"],
54720
+ properties: {
54721
+ enabled: {
54722
+ type: "boolean"
54723
+ }
54724
+ }
54725
+ }
54726
+ },
54727
+ allOf: [
54728
+ {
54729
+ if: {
54730
+ type: "object",
54731
+ properties: {
54732
+ runtime: {
54733
+ type: "object",
54734
+ properties: {
54735
+ mode: {
54736
+ const: "functions"
54737
+ }
54738
+ },
54739
+ required: ["mode"]
54740
+ }
54741
+ },
54742
+ required: ["runtime"]
54743
+ },
54744
+ then: {
54745
+ type: "object",
54746
+ properties: {
54747
+ build: {
54748
+ type: "object",
54749
+ additionalProperties: false,
54750
+ required: ["install"],
54751
+ properties: {
54752
+ install: {
54753
+ $ref: "#/$defs/nonEmptyCommand"
54754
+ }
54755
+ }
54756
+ }
54757
+ }
54758
+ },
54759
+ else: {
54760
+ type: "object",
54761
+ properties: {
54762
+ build: {
54763
+ type: "object",
54764
+ additionalProperties: false,
54765
+ required: ["install", "command", "output"],
54766
+ properties: {
54767
+ install: {
54768
+ $ref: "#/$defs/nonEmptyCommand"
54769
+ },
54770
+ command: {
54771
+ $ref: "#/$defs/nonEmptyCommand"
54772
+ },
54773
+ output: {
54774
+ $ref: "#/$defs/relativePath"
54775
+ },
54776
+ ssg_cache_max_mib: {
54777
+ $ref: "#/$defs/build/properties/ssg_cache_max_mib"
54778
+ },
54779
+ next_revalidate_path: {
54780
+ $ref: "#/$defs/build/properties/next_revalidate_path"
54781
+ }
54782
+ }
54783
+ }
54784
+ }
54785
+ }
54786
+ }
54787
+ ]
54788
+ };
54789
+
54790
+ // packages/contracts/dist/application-root.js
54791
+ var APPLICATION_ROOT_PATTERN = /^(?:\.|[A-Za-z0-9][A-Za-z0-9._-]*(?:\/[A-Za-z0-9][A-Za-z0-9._-]*)*)$/u;
54792
+ var APPLICATION_ROOT_MAX_BYTES = 64;
54793
+ var APPLICATION_ROOT_MAX_SEGMENTS = 8;
54794
+ var APPLICATION_ROOT_MAX_SEGMENT_BYTES = 63;
54795
+ var APPLICATION_ROOT_CONFORMANCE_CORPUS = Object.freeze({
54796
+ accepted: Object.freeze([
54797
+ Object.freeze({ name: "repository root", value: "." }),
54798
+ Object.freeze({ name: "single segment", value: "site" }),
54799
+ Object.freeze({ name: "portable segment punctuation", value: "apps/web.v2_test-prod" }),
54800
+ Object.freeze({ name: "maximum segment bytes", value: "a".repeat(63) }),
54801
+ Object.freeze({
54802
+ name: "maximum total bytes",
54803
+ value: `${"a".repeat(31)}/${"b".repeat(32)}`
54804
+ }),
54805
+ Object.freeze({ name: "maximum segment count", value: "a/b/c/d/e/f/g/h" })
54806
+ ]),
54807
+ rejected: Object.freeze([
54808
+ Object.freeze({ name: "empty string", value: "" }),
54809
+ Object.freeze({ name: "absolute path", value: "/site" }),
54810
+ Object.freeze({ name: "parent traversal", value: "../site" }),
54811
+ Object.freeze({ name: "embedded traversal", value: "apps/../site" }),
54812
+ Object.freeze({ name: "leading dot segment", value: "./site" }),
54813
+ Object.freeze({ name: "trailing separator", value: "site/" }),
54814
+ Object.freeze({ name: "repeated separator", value: "apps//site" }),
54815
+ Object.freeze({ name: "backslash", value: "apps\\site" }),
54816
+ Object.freeze({ name: "colon syntax", value: "C:site" }),
54817
+ Object.freeze({ name: "leading whitespace", value: " site" }),
54818
+ Object.freeze({ name: "trailing whitespace", value: "site " }),
54819
+ Object.freeze({ name: "control character", value: "site\nweb" }),
54820
+ Object.freeze({ name: "unicode", value: "caf\xE9" }),
54821
+ Object.freeze({ name: "percent ambiguity", value: "site%2fweb" }),
54822
+ Object.freeze({ name: "hidden segment", value: ".site" }),
54823
+ Object.freeze({ name: "nine segments", value: "a/b/c/d/e/f/g/h/i" }),
54824
+ Object.freeze({ name: "segment over 63 bytes", value: "a".repeat(64) }),
54825
+ Object.freeze({
54826
+ name: "path over 64 bytes",
54827
+ value: `${"a".repeat(32)}/${"b".repeat(32)}`
54828
+ }),
54829
+ Object.freeze({ name: "non-string", value: 1 })
54830
+ ]),
54831
+ ustarEnvelope: Object.freeze([
54832
+ Object.freeze({
54833
+ name: "maximum accepted application root",
54834
+ repositoryNameBytes: 100,
54835
+ separatorBytes: 3,
54836
+ commitShaBytes: 40,
54837
+ applicationRootBytes: 64,
54838
+ inspectionLeafBytes: 24,
54839
+ archivePathBytes: 231,
54840
+ ustarPathEnvelopeBytes: 255,
54841
+ fitsWithoutPax: true
54842
+ })
54843
+ ])
54844
+ });
54845
+ function normalizeApplicationRoot(value = ".") {
54846
+ if (typeof value !== "string" || !APPLICATION_ROOT_PATTERN.test(value)) {
54847
+ throw new TypeError("Application root is invalid");
54848
+ }
54849
+ const encoder = new TextEncoder();
54850
+ const encoded = encoder.encode(value);
54851
+ const segments = value === "." ? [] : value.split("/");
54852
+ if (encoded.byteLength > APPLICATION_ROOT_MAX_BYTES || segments.length > APPLICATION_ROOT_MAX_SEGMENTS || segments.some((segment) => encoder.encode(segment).byteLength > APPLICATION_ROOT_MAX_SEGMENT_BYTES)) {
54853
+ throw new TypeError("Application root is invalid");
54854
+ }
54855
+ return value;
54856
+ }
54857
+
54858
+ // packages/contracts/dist/functions.js
54859
+ function normalizeCrons(value) {
54860
+ if (!Array.isArray(value) || value.length === 0 || value.length > 8) {
54861
+ throw new TypeError("ohmyhost.yaml functions.crons must list one to eight schedules");
54862
+ }
54863
+ const crons = value.map((entry) => {
54864
+ if (typeof entry !== "string")
54865
+ throw new TypeError("ohmyhost.yaml cron is invalid");
54866
+ return normalizeCron(entry);
54867
+ });
54868
+ const sorted = [...crons].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
54869
+ for (let index = 1; index < sorted.length; index += 1) {
54870
+ if (sorted[index - 1] === sorted[index]) {
54871
+ throw new TypeError("ohmyhost.yaml functions.crons must be unique");
54872
+ }
54873
+ }
54874
+ return Object.freeze(sorted);
54875
+ }
54876
+ function normalizeCron(value) {
54877
+ if (value !== value.trim() || value.includes(" ")) {
54878
+ throw new TypeError("ohmyhost.yaml cron is invalid");
54879
+ }
54880
+ const fields = value.split(" ");
54881
+ if (fields.length !== 5)
54882
+ throw new TypeError("ohmyhost.yaml cron is invalid");
54883
+ const [minute, hour, day, month, weekday] = fields;
54884
+ if (minute === void 0 || hour === void 0 || day === void 0 || month === void 0 || weekday === void 0 || !validCronMinute(minute) || !validCronField(hour, 0, 23) || !validCronField(day, 1, 31) || !validCronField(month, 1, 12) || !validCronField(weekday, 0, 6)) {
54885
+ throw new TypeError("ohmyhost.yaml cron is invalid");
54886
+ }
54887
+ return value;
54888
+ }
54889
+ function validCronMinute(value) {
54890
+ const step = /^\*\/([1-9]|[1-5][0-9])$/u.exec(value);
54891
+ if (step !== null)
54892
+ return Number(step[1]) >= 5;
54893
+ return value !== "*" && validCronField(value, 0, 59);
54894
+ }
54895
+ function validCronField(value, minimum, maximum) {
54896
+ if (value === "*")
54897
+ return true;
54898
+ if (!/^(?:0|[1-9][0-9]?)$/u.test(value))
54899
+ return false;
54900
+ const parsed = Number(value);
54901
+ return parsed >= minimum && parsed <= maximum;
54902
+ }
54903
+
54904
+ // packages/contracts/dist/browser-capabilities.js
54905
+ var RESOURCE_GROUPS = [
54906
+ "connect",
54907
+ "scripts",
54908
+ "styles",
54909
+ "images",
54910
+ "fonts",
54911
+ "frames",
54912
+ "frameAncestors"
54913
+ ];
54914
+ var POLICY_KEYS = [...RESOURCE_GROUPS, "workers", "cors"];
54915
+ var MAX_ORIGINS = 16;
54916
+ function normalizeBrowserPolicy(value) {
54917
+ const input = value === void 0 ? {} : policyRecord(value, POLICY_KEYS);
54918
+ const workers = input["workers"] === void 0 ? {} : policyRecord(input["workers"], ["self", "blob"]);
54919
+ const cors = input["cors"] === void 0 ? {} : policyRecord(input["cors"], ["origins", "credentials"]);
54920
+ const resources = Object.fromEntries(RESOURCE_GROUPS.map((group) => [group, normalizeOrigins(input[group], group === "connect")]));
54921
+ return Object.freeze({
54922
+ ...resources,
54923
+ workers: Object.freeze({
54924
+ self: normalizeBoolean(workers["self"]),
54925
+ blob: normalizeBoolean(workers["blob"])
54926
+ }),
54927
+ cors: Object.freeze({
54928
+ origins: normalizeOrigins(cors["origins"], false),
54929
+ credentials: normalizeBoolean(cors["credentials"])
54930
+ })
54931
+ });
54932
+ }
54933
+ function policyRecord(value, keys, complete = false) {
54934
+ if (typeof value !== "object" || value === null || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value)) || Object.keys(value).some((key) => !keys.includes(key)) || complete && Object.keys(value).length !== keys.length)
54935
+ throw invalidPolicy();
54936
+ return value;
54937
+ }
54938
+ function normalizeBoolean(value) {
54939
+ if (value === void 0)
54940
+ return false;
54941
+ if (typeof value !== "boolean")
54942
+ throw invalidPolicy();
54943
+ return value;
54944
+ }
54945
+ function normalizeOrigins(value, allowWebSocket) {
54946
+ if (value === void 0)
54947
+ return Object.freeze([]);
54948
+ if (!Array.isArray(value) || value.length > MAX_ORIGINS)
54949
+ throw invalidPolicy();
54950
+ const origins = [];
54951
+ for (const origin of value) {
54952
+ if (!browserOrigin(origin, allowWebSocket) || origins.includes(origin))
54953
+ throw invalidPolicy();
54954
+ origins.push(origin);
54955
+ }
54956
+ return Object.freeze(origins.sort());
54957
+ }
54958
+ function browserOrigin(value, allowWebSocket) {
54959
+ if (typeof value !== "string" || value.length > 256)
54960
+ return false;
54961
+ try {
54962
+ const url = new URL(value);
54963
+ return (url.protocol === "https:" || allowWebSocket && url.protocol === "wss:") && url.origin === value && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname.includes(".") && !url.hostname.endsWith(".local") && !url.hostname.endsWith(".internal") && !/^\d+(?:\.\d+){3}$/u.test(url.hostname) && url.hostname.split(".").every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(label));
54964
+ } catch {
54965
+ return false;
54966
+ }
54967
+ }
54968
+ function invalidPolicy() {
54969
+ return new TypeError("Invalid browser capability policy");
54970
+ }
54971
+
54972
+ // packages/contracts/dist/preview-view.js
54973
+ function parsePreviewView(value, scope) {
54974
+ if (!value || typeof value !== "object" || Array.isArray(value))
54975
+ throw new TypeError("Invalid preview response");
54976
+ const row = value;
54977
+ const ulid6 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
54978
+ if (Object.keys(row).sort().join(",") !== "environment,id,project_id,source,status,url" || typeof row["id"] !== "string" || !ulid6.test(row["id"]) || typeof row["project_id"] !== "string" || !ulid6.test(row["project_id"]) || row["environment"] !== "dev" && row["environment"] !== "prod" || !["cold", "starting", "ready", "sleeping"].includes(String(row["status"])) || typeof row["url"] !== "string" || !/^https:\/\/[a-z2-7]{51}[aq]\.preview(?:\.dev)?\.omh\.st$/u.test(row["url"]) || scope !== void 0 && (row["project_id"] !== scope.projectId || row["environment"] !== scope.environment))
54979
+ throw new TypeError("Invalid preview response");
54980
+ if (row["source"] !== null) {
54981
+ const source = row["source"];
54982
+ if (!source || typeof source !== "object" || Array.isArray(source))
54983
+ throw new TypeError("Invalid preview response");
54984
+ const item = source;
54985
+ if (Object.keys(item).sort().join(",") !== "commit_sha,sequence" || typeof item["sequence"] !== "number" || !Number.isSafeInteger(item["sequence"]) || item["sequence"] <= 0 || typeof item["commit_sha"] !== "string" || !/^(?!0{40}$)[0-9a-f]{40}$/u.test(item["commit_sha"]))
54986
+ throw new TypeError("Invalid preview response");
54987
+ }
54988
+ return value;
54989
+ }
54990
+
54991
+ // packages/contracts/dist/index.js
54992
+ var validateOhmyhostConfig = new import__.Ajv2020({
54993
+ allErrors: true,
54994
+ strict: true
54995
+ }).compile(ohmyhost_schema_default);
54996
+ function parseOhmyhostConfig(value) {
54997
+ if (!validateOhmyhostConfig(value)) {
54998
+ throw new TypeError(`ohmyhost.yaml is invalid: ${formatErrors(validateOhmyhostConfig.errors)}`);
54999
+ }
55000
+ const input = value;
55001
+ const config = {
55002
+ version: 1,
55003
+ project: input.project,
55004
+ applicationRoot: normalizeApplicationRoot(input.applicationRoot),
55005
+ build: input.runtime.mode === "functions" ? Object.freeze({ install: input.build.install }) : Object.freeze({
55006
+ install: input.build.install,
55007
+ command: input.build.command,
55008
+ output: input.build.output,
55009
+ ...input.build.ssg_cache_max_mib === void 0 ? {} : { ssg_cache_max_mib: input.build.ssg_cache_max_mib },
55010
+ ...input.build.next_revalidate_path === true ? { next_revalidate_path: true } : {}
55011
+ }),
55012
+ runtime: Object.freeze({
55013
+ mode: input.runtime.mode,
55014
+ healthcheck: normalizeHealthcheck(input.runtime.healthcheck),
55015
+ egress: Object.freeze({
55016
+ allow: normalizeEgressOrigins(input.runtime.egress?.allow)
55017
+ }),
55018
+ ...input.runtime.browser === void 0 ? {} : { browser: normalizeBrowserPolicy(input.runtime.browser) }
55019
+ }),
55020
+ ...input.database === void 0 ? {} : {
55021
+ database: Object.freeze({
55022
+ enabled: input.database.enabled,
55023
+ ...input.database.migrations === void 0 ? {} : { migrations: input.database.migrations }
55024
+ })
55025
+ },
55026
+ ...input.auth === void 0 ? {} : { auth: Object.freeze({ provider: input.auth.provider }) },
55027
+ ...input.mail === void 0 ? {} : { mail: Object.freeze({ enabled: input.mail.enabled }) },
55028
+ ...input.storage === void 0 ? {} : {
55029
+ storage: Object.freeze({
55030
+ provider: input.storage.provider,
55031
+ jurisdiction: input.storage.jurisdiction,
55032
+ public: input.storage.public
55033
+ })
55034
+ },
55035
+ ...input.ai === void 0 ? {} : {
55036
+ ai: Object.freeze({
55037
+ enabled: input.ai.enabled,
55038
+ ...input.ai.jurisdiction === void 0 ? {} : { jurisdiction: input.ai.jurisdiction }
55039
+ })
55040
+ },
55041
+ ...input.browser === void 0 ? {} : { browser: Object.freeze({ enabled: input.browser.enabled }) },
55042
+ ...input.functions === void 0 ? {} : {
55043
+ functions: Object.freeze({ crons: normalizeCrons(input.functions.crons) })
55044
+ },
55045
+ ...input.credits === void 0 ? {} : {
55046
+ credits: Object.freeze({
55047
+ monthly_budget: input.credits.monthly_budget,
55048
+ ...input.credits.auto_recharge === void 0 ? {} : {
55049
+ auto_recharge: Object.freeze({
55050
+ enabled: input.credits.auto_recharge.enabled,
55051
+ ...input.credits.auto_recharge.threshold === void 0 ? {} : { threshold: input.credits.auto_recharge.threshold },
55052
+ ...input.credits.auto_recharge.amount_usd_micros === void 0 ? {} : { amount_usd_micros: input.credits.auto_recharge.amount_usd_micros },
55053
+ ...input.credits.auto_recharge.monthly_cap_usd_micros === void 0 ? {} : {
55054
+ monthly_cap_usd_micros: input.credits.auto_recharge.monthly_cap_usd_micros
55055
+ }
55056
+ })
55057
+ }
55058
+ })
55059
+ }
55060
+ };
55061
+ return Object.freeze(config);
55062
+ }
55063
+ function normalizeHealthcheck(value) {
55064
+ const candidate = value ?? "/";
55065
+ if (candidate !== candidate.trim() || !candidate.startsWith("/") || candidate.startsWith("//") || candidate.includes("\\") || candidate.includes("?") || candidate.includes("#") || candidate.split("/").some((segment) => segment === "." || segment === "..")) {
55066
+ throw new TypeError("ohmyhost.yaml runtime healthcheck is invalid");
55067
+ }
55068
+ return candidate;
55069
+ }
55070
+ function normalizeEgressOrigins(value) {
55071
+ const origins = [...value ?? []];
55072
+ for (const origin of origins) {
55073
+ let parsed;
55074
+ try {
55075
+ parsed = new URL(origin);
55076
+ } catch {
55077
+ throw new TypeError("ohmyhost.yaml runtime egress origin is invalid");
55078
+ }
55079
+ if (parsed.protocol !== "https:" || parsed.port !== "" || parsed.username !== "" || parsed.password !== "" || parsed.origin !== origin || parsed.pathname !== "/" || parsed.search !== "" || parsed.hash !== "" || forbiddenEgressHostname(parsed.hostname)) {
55080
+ throw new TypeError("ohmyhost.yaml runtime egress origin is invalid");
55081
+ }
55082
+ }
55083
+ origins.sort();
55084
+ return Object.freeze(origins);
55085
+ }
55086
+ function forbiddenEgressHostname(hostname) {
55087
+ const normalized = hostname.toLowerCase();
55088
+ return /(?:^|\.)ohmyho-(?:mail|storage)-gateway-[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*\.workers\.dev\.?$/u.test(normalized) || normalized.replace(/\.+$/u, "") === "connect.ohmyho.st" || normalized.replace(/\.+$/u, "").endsWith(".connect.ohmyho.st") || normalized === "localhost" || normalized.endsWith(".localhost") || normalized.endsWith(".local") || normalized.endsWith(".internal") || /^\d{1,3}(?:\.\d{1,3}){3}$/u.test(normalized) || normalized.startsWith("[") || normalized.endsWith("]");
55089
+ }
55090
+ function parseOhmyhostConfigYaml(source) {
55091
+ if (typeof source !== "string") {
55092
+ throw new TypeError("ohmyhost.yaml must be a string");
55093
+ }
55094
+ let value;
55095
+ try {
55096
+ value = (0, import_yaml.parse)(source);
55097
+ } catch {
55098
+ throw new TypeError("ohmyhost.yaml is not valid YAML");
55099
+ }
55100
+ return parseOhmyhostConfig(value);
55101
+ }
55102
+ function formatErrors(errors) {
55103
+ return (errors ?? []).map(({ instancePath, message }) => `${instancePath || "/"} ${message ?? "is invalid"}`).join("; ");
55104
+ }
55105
+
55106
+ // apps/product-cli/dist/product-api.js
55107
+ var WEBHOOK_SCOPE_MISMATCH = "Webhook response scope mismatch";
55108
+ var WATCH_SCOPE_MISMATCH = "Watch response scope mismatch";
55109
+ var TABLE_SCOPE_MISMATCH = "Table response scope mismatch";
55110
+ var SCHEDULE_SCOPE_MISMATCH = "Schedule response scope mismatch";
55111
+ function assertDatabaseTableAnswer(value) {
55112
+ const table = isRecordValue(value) ? value["table"] : void 0;
55113
+ const columns = isRecordValue(table) ? table["columns"] : void 0;
55114
+ const primaryKey = isRecordValue(table) ? table["primary_key"] : void 0;
55115
+ if (!isRecordValue(table) || !hasExactKeys(table, ["environment", "schema", "table", "columns", "primary_key", "created"]) || table["environment"] !== "dev" && table["environment"] !== "prod" || table["schema"] !== "public" || !isDatabaseTableIdentifier(table["table"]) || typeof table["created"] !== "boolean" || !Array.isArray(columns) || columns.length < 1 || !columns.every(isDatabaseTableAnswerColumn) || !Array.isArray(primaryKey) || !primaryKey.every((name) => columns.some((column) => column["name"] === name)))
55116
+ throw new TypeError("Invalid database table answer");
55117
+ }
55118
+ function isDatabaseTableAnswerColumn(value) {
55119
+ return isRecordValue(value) && hasExactKeys(value, ["name", "type", "nullable", "identity", "default"]) && isDatabaseTableIdentifier(value["name"]) && DATABASE_TABLE_COLUMN_TYPES.includes(value["type"]) && typeof value["nullable"] === "boolean" && typeof value["identity"] === "boolean" && (value["default"] === null || DATABASE_TABLE_DEFAULTS.includes(value["default"]));
55120
+ }
55121
+ function isRecordValue(value) {
55122
+ return typeof value === "object" && value !== null && !Array.isArray(value);
55123
+ }
55124
+ function hasExactKeys(value, keys) {
55125
+ return Object.keys(value).sort().join(",") === [...keys].sort().join(",");
55126
+ }
55127
+ async function executeConnectionCommand(client2, origin, command) {
55128
+ const organization_id = command.organizationId;
55129
+ let result;
55130
+ switch (command.kind) {
55131
+ case "connection-begin":
55132
+ result = await beginConnection({
55133
+ organization_id,
55134
+ "Idempotency-Key": command.idempotencyKey,
55135
+ connectionBegin: {
55136
+ provider: "make",
55137
+ project_id: command.projectId,
55138
+ environment_id: command.environmentId
55139
+ }
55140
+ }, { client: client2 });
55141
+ break;
55142
+ case "connection-list":
55143
+ result = await listConnections({ organization_id }, { client: client2 });
55144
+ break;
55145
+ case "connection-status":
55146
+ result = await getConnectionRequest({ organization_id, request_id: command.requestId }, { client: client2 });
55147
+ break;
55148
+ case "connection-discover":
55149
+ result = await discoverConnection({
55150
+ organization_id,
55151
+ grant_id: command.grantId,
55152
+ project_id: command.projectId,
55153
+ environment_id: command.environmentId,
55154
+ ...command.providerOrganizationId === void 0 ? {} : { provider_organization_id: command.providerOrganizationId },
55155
+ ...command.teamId === void 0 ? {} : { team_id: command.teamId }
55156
+ }, { client: client2 });
55157
+ break;
55158
+ case "connection-disconnect":
55159
+ result = await disconnectConnection({ organization_id, grant_id: command.grantId, "Idempotency-Key": command.idempotencyKey }, { client: client2 });
55160
+ break;
55161
+ }
55162
+ return parseConnectionResponse(command.kind, result, origin);
55163
+ }
55164
+ var GeneratedSdkProductApi = class {
55165
+ #client;
55166
+ #connectionOrigin;
55167
+ managedSource;
55168
+ constructor(baseUrl, accessToken, fetch2) {
55169
+ this.#connectionOrigin = new URL(baseUrl).origin;
55170
+ this.#client = createClient({ auth: accessToken, baseUrl, fetch: fetch2, throwOnError: true });
55171
+ this.managedSource = new GeneratedSdkManagedSourceApi(() => this.#client);
55172
+ }
55173
+ async connection(command) {
55174
+ return executeConnectionCommand(this.#client, this.#connectionOrigin, command);
55175
+ }
55176
+ async changeDatabaseCompute(input) {
55177
+ return changeDatabaseCompute({
55178
+ project_id: input.projectId,
55179
+ body: {
55180
+ environment: input.environment,
55181
+ ...input.memoryMiB === void 0 ? { profile: input.profile } : { memory_mib: input.memoryMiB },
55182
+ confirm: true
55183
+ },
55184
+ "Idempotency-Key": input.idempotencyKey
55185
+ }, { client: this.#client });
55186
+ }
55187
+ async getDatabaseCompute(input) {
55188
+ const value = await getDatabaseCompute({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
55189
+ assertDatabaseCompute(value);
55190
+ if (value.project_id !== input.projectId || value.environment !== input.environment)
55191
+ throw new TypeError("Compute response scope mismatch");
55192
+ return value;
55193
+ }
55194
+ async getProjectContext(projectId) {
55195
+ const result = await getProjectContext({ project_id: projectId }, { client: this.#client });
55196
+ assertProjectContext(result);
55197
+ if (result.project_id !== projectId)
55198
+ throw new TypeError("Project context scope mismatch");
55199
+ return result;
55200
+ }
55201
+ async setProjectNotes(input) {
55202
+ const result = await setProjectNotes({
55203
+ project_id: input.projectId,
55204
+ markdown: input.markdown,
55205
+ expected_version: input.expectedVersion,
55206
+ "Idempotency-Key": input.idempotencyKey
55207
+ }, { client: this.#client });
55208
+ assertProjectNotesReceipt(result);
55209
+ return result;
55210
+ }
55211
+ createProjectExport(input) {
55212
+ return createProjectExport({
55213
+ project_id: input.projectId,
55214
+ password: input.password,
55215
+ "Idempotency-Key": input.idempotencyKey
55216
+ }, { client: this.#client });
55217
+ }
55218
+ async getProjectExport(input) {
55219
+ const result = await getProjectExport({ project_id: input.projectId, export_id: input.exportId }, { client: this.#client });
55220
+ assertProjectExport(result);
55221
+ return result;
55222
+ }
55223
+ async createProjectExportDownloadLink(input) {
55224
+ const result = await createProjectExportDownloadLink({ project_id: input.projectId, export_id: input.exportId }, { client: this.#client });
55225
+ assertProjectExportDownloadLink(result);
55226
+ return result;
55227
+ }
55228
+ async getCurrentIdentity() {
55229
+ return getCurrentIdentity({}, { client: this.#client });
55230
+ }
55231
+ async getAccountProfile() {
55232
+ return parseAccountProfile(await getAccountProfile({ client: this.#client }));
55233
+ }
55234
+ getOrganizationReferral(organizationId) {
55235
+ return getOrganizationReferral({ organization_id: organizationId }, { client: this.#client });
55236
+ }
55237
+ getOrganizationAccount(organizationId) {
55238
+ return getOrganizationAccount({ organization_id: organizationId }, { client: this.#client });
55239
+ }
55240
+ getOrganizationCredits(organizationId) {
55241
+ return getOrganizationCredits({ organization_id: organizationId }, { client: this.#client });
55242
+ }
55243
+ async createUserApiKey(input) {
55244
+ return parseUserApiKeyCreation(await createUserApiKey({
55245
+ organization_id: input.organizationId,
55246
+ name: input.name,
55247
+ "Idempotency-Key": input.idempotencyKey
55248
+ }, { client: this.#client }));
55249
+ }
55250
+ async listUserApiKeys(input) {
55251
+ return parseUserApiKeyPage(await listUserApiKeys({ organization_id: input.organizationId, ...input.after ? { after: input.after } : {} }, { client: this.#client }));
55252
+ }
55253
+ async revokeUserApiKey(input) {
55254
+ await revokeUserApiKey({ organization_id: input.organizationId, key_id: input.keyId }, { client: this.#client });
55255
+ }
55256
+ createBillingCheckout(input) {
55257
+ return createBillingCheckout({
55258
+ organization_id: input.organizationId,
55259
+ offer: input.offer,
55260
+ packs: input.packs,
55261
+ "Idempotency-Key": input.idempotencyKey
55262
+ }, { client: this.#client });
55263
+ }
55264
+ getBillingCheckout(input) {
55265
+ return getBillingCheckout({ organization_id: input.organizationId, checkout_id: input.checkoutId }, { client: this.#client });
55266
+ }
55267
+ getBillingRecharge(organizationId) {
55268
+ return getBillingRecharge({ organization_id: organizationId }, { client: this.#client });
55269
+ }
55270
+ configureBillingRecharge(input) {
55271
+ return configureBillingRecharge({
55272
+ organization_id: input.organizationId,
55273
+ "Idempotency-Key": input.idempotencyKey,
55274
+ enabled: input.enabled,
55275
+ monthly_limit_minor: input.monthlyLimitMinor,
55276
+ consent: input.consent,
55277
+ revision: input.revision
55278
+ }, { client: this.#client });
55279
+ }
55280
+ createBillingPortal(organizationId) {
55281
+ return createBillingPortal({ organization_id: organizationId, body: {} }, { client: this.#client });
55282
+ }
55283
+ getOrganizationCreditUsage(organizationId) {
55284
+ return getOrganizationCreditUsage({ organization_id: organizationId }, { client: this.#client });
55285
+ }
55286
+ getProjectCreditBudget(projectId) {
55287
+ return getProjectCreditBudget({ project_id: projectId }, { client: this.#client });
55288
+ }
55289
+ setProjectCreditBudget(input) {
55290
+ return setProjectCreditBudget({
55291
+ project_id: input.projectId,
55292
+ "Idempotency-Key": input.idempotencyKey,
55293
+ setProjectCreditBudgetRequest: { amount_micros: input.amountMicros, mode: input.mode }
55294
+ }, { client: this.#client });
55295
+ }
55296
+ createOrganization(input) {
55297
+ return createOrganization({
55298
+ "Idempotency-Key": input.idempotencyKey,
55299
+ createOrganizationRequest: {
55300
+ name: input.name,
55301
+ ...input.signupSource === void 0 ? {} : { signup_source: input.signupSource }
55302
+ }
55303
+ }, { client: this.#client });
55304
+ }
55305
+ async listProjects(input) {
55306
+ return listProjects(input, { client: this.#client });
55307
+ }
55308
+ async changeProjectHandle(input) {
55309
+ return changeProjectHandle({
55310
+ project_id: input.projectId,
55311
+ "Idempotency-Key": input.idempotencyKey,
55312
+ "If-Match": input.ifMatch,
55313
+ handle: input.handle
55314
+ }, { client: this.#client });
55315
+ }
55316
+ async checkProjectHandle(input) {
55317
+ return getProjectHandleAvailability({ handle: input.handle }, { client: this.#client });
55318
+ }
55319
+ async getProjectStatus(projectId) {
55320
+ return getProjectStatus({ project_id: projectId }, { client: this.#client });
55321
+ }
55322
+ async writeProjectDatabase(input) {
55323
+ return writeProjectDatabase({
55324
+ project_id: input.projectId,
55325
+ "Idempotency-Key": input.idempotencyKey,
55326
+ projectDatabaseWriteRequest: {
55327
+ environment: input.environment,
55328
+ statement: input.statement,
55329
+ parameters: [...input.parameters]
55330
+ }
55331
+ }, { client: this.#client });
55332
+ }
55333
+ async queryProjectDatabase(input) {
55334
+ return queryProjectDatabase({
55335
+ project_id: input.projectId,
55336
+ projectDatabaseQueryRequest: {
55337
+ environment: input.environment,
55338
+ statement: input.statement,
55339
+ parameters: [...input.parameters]
55340
+ }
55341
+ }, { client: this.#client });
55342
+ }
55343
+ /** The connection URI exists only in this response; nothing in the CLI persists it. */
55344
+ async createProjectDatabaseAccess(input) {
54123
55345
  const value = await createProjectDatabaseAccess({
54124
55346
  project_id: input.projectId,
54125
55347
  projectDatabaseAccessRequest: {
@@ -54397,1034 +55619,272 @@ var GeneratedSdkProductApi = class {
54397
55619
  ...input.limit === void 0 ? {} : { limit: input.limit },
54398
55620
  ...input.cursor === void 0 ? {} : { cursor: input.cursor }
54399
55621
  }, { client: this.#client });
54400
- assertDatabaseExecutionUsagePage(value);
54401
- return value;
54402
- }
54403
- async planPaidDomain(input) {
54404
- return planPaidProjectDomain({ project_id: input.projectId, paidDomainRequest: { hostname: input.hostname } }, { client: this.#client });
54405
- }
54406
- async applyPaidDomain(input) {
54407
- return applyPaidProjectDomain({
54408
- "Idempotency-Key": input.idempotencyKey,
54409
- project_id: input.projectId,
54410
- paidDomainRequest: { hostname: input.hostname }
54411
- }, { client: this.#client });
54412
- }
54413
- async getPaidDomain(projectId) {
54414
- return getPaidProjectDomain({ project_id: projectId }, { client: this.#client });
54415
- }
54416
- async deletePaidDomain(input) {
54417
- return deletePaidProjectDomain({
54418
- "Idempotency-Key": input.idempotencyKey,
54419
- project_id: input.projectId,
54420
- paidDomainRequest: { hostname: input.hostname }
54421
- }, { client: this.#client });
54422
- }
54423
- async ensureDevShareLink(projectId) {
54424
- return ensureProjectDevShareLink({ project_id: projectId }, { client: this.#client });
54425
- }
54426
- async rotateDevShareLink(projectId, idempotencyKey) {
54427
- return rotateProjectDevShareLink({ project_id: projectId, "Idempotency-Key": idempotencyKey }, { client: this.#client });
54428
- }
54429
- async revokeDevShareLink(projectId, idempotencyKey) {
54430
- return revokeProjectDevShareLink({ project_id: projectId, "Idempotency-Key": idempotencyKey }, { client: this.#client });
54431
- }
54432
- async setDevAccessMode(projectId, mode, idempotencyKey) {
54433
- return setProjectDevAccessMode({
54434
- project_id: projectId,
54435
- "Idempotency-Key": idempotencyKey,
54436
- setDevAccessModeRequest: { mode }
54437
- }, { client: this.#client });
54438
- }
54439
- async getPoweredByFlag(projectId) {
54440
- return getProjectPoweredByFlag({ project_id: projectId }, { client: this.#client });
54441
- }
54442
- async setPoweredByFlag(projectId, enabled, idempotencyKey) {
54443
- return setProjectPoweredByFlag({
54444
- project_id: projectId,
54445
- "Idempotency-Key": idempotencyKey,
54446
- setPoweredByFlagRequest: { enabled }
54447
- }, { client: this.#client });
54448
- }
54449
- async createDevAccessTicket(projectId) {
54450
- return createProjectDevAccessTicket({ project_id: projectId }, { client: this.#client });
54451
- }
54452
- async submitFeedback(input) {
54453
- return parseFeedbackReceipt(await submitFeedback({ "Idempotency-Key": input.idempotencyKey, feedbackSubmission: input.report }, { client: this.#client }));
54454
- }
54455
- async getFeedback(feedbackId, cursor) {
54456
- return parseFeedbackStatus(await getFeedback({ feedback_id: feedbackId, ...cursor === void 0 ? {} : { cursor } }, { client: this.#client }));
54457
- }
54458
- async planProjectDataChange(input) {
54459
- return parseProjectDataChangePlan2(await planProjectDataChange({ project_id: input.projectId, projectDataChangeRequest: { change: input.change } }, { client: this.#client }));
54460
- }
54461
- async createProjectDataChange(input) {
54462
- return parseOperation(await createProjectDataChange({
54463
- project_id: input.projectId,
54464
- projectDataChangeRequest: { change: input.change },
54465
- "If-Match": input.ifMatch,
54466
- "X-Confirmation-Token": input.confirmationToken,
54467
- "Idempotency-Key": input.idempotencyKey
54468
- }, { client: this.#client }));
54469
- }
54470
- async createProject(input) {
54471
- return createProject({
54472
- "Idempotency-Key": input.idempotencyKey,
54473
- createProjectRequest: {
54474
- organization_id: input.organizationId,
54475
- name: input.name,
54476
- ...input.dataMode === void 0 ? {} : { data_mode: input.dataMode },
54477
- ...input.devAccessMode === void 0 ? {} : { dev_access_mode: input.devAccessMode },
54478
- ...input.includeDevelopmentEnvironment === void 0 ? {} : { include_development_environment: input.includeDevelopmentEnvironment },
54479
- ...input.region === void 0 ? {} : { region: input.region }
54480
- }
54481
- }, { client: this.#client });
54482
- }
54483
- async addProjectDevelopmentEnvironment(input) {
54484
- return addProjectDevelopmentEnvironment({ project_id: input.projectId, "Idempotency-Key": input.idempotencyKey, body: {} }, { client: this.#client });
54485
- }
54486
- async getOperation(operationId) {
54487
- return getOperation({ operation_id: operationId }, { client: this.#client });
54488
- }
54489
- async reconcileOperation(input) {
54490
- return reconcileOperation({
54491
- "Idempotency-Key": input.idempotencyKey,
54492
- operation_id: input.operationId
54493
- }, { client: this.#client });
54494
- }
54495
- async connectGithub(input) {
54496
- return connectGithubOrganization({
54497
- organization_id: input.organizationId,
54498
- "Idempotency-Key": input.idempotencyKey,
54499
- connectGithubOrganizationRequest: {}
54500
- }, { client: this.#client });
54501
- }
54502
- async getGithubConnection(organizationId) {
54503
- return getGithubOrganizationConnection({ organization_id: organizationId }, { client: this.#client });
54504
- }
54505
- async disconnectGithub(organizationId) {
54506
- return disconnectGithubOrganization({ organization_id: organizationId }, { client: this.#client });
54507
- }
54508
- async listOrganizationMcpConnections(organizationId) {
54509
- return listOrganizationMcpConnections({ organization_id: organizationId }, { client: this.#client });
54510
- }
54511
- async revokeOrganizationMcpConnection(input) {
54512
- return revokeOrganizationMcpConnection({ organization_id: input.organizationId, connection_id: input.connectionId }, { client: this.#client });
54513
- }
54514
- async linkSource(input) {
54515
- return linkProjectSource({
54516
- "Idempotency-Key": input.idempotencyKey,
54517
- project_id: input.projectId,
54518
- linkProjectSourceRequest: {
54519
- repository_owner: input.repositoryOwner,
54520
- repository_name: input.repositoryName
54521
- }
54522
- }, { client: this.#client });
54523
- }
54524
- async configureAutoDeploy(input) {
54525
- return configureProjectSourceAutoDeploy({
54526
- "Idempotency-Key": input.idempotencyKey,
54527
- project_id: input.projectId,
54528
- configureSourceAutoDeployRequest: { branch: input.branch, enabled: input.enabled }
54529
- }, { client: this.#client });
54530
- }
54531
- async getAutoDeploy(projectId) {
54532
- return getProjectSourceAutoDeploy({ project_id: projectId }, { client: this.#client });
54533
- }
54534
- async authorizeCloudflareDns(input) {
54535
- return createCloudflareDnsAuthorization({
54536
- "Idempotency-Key": input.idempotencyKey,
54537
- project_id: input.projectId,
54538
- createCloudflareDnsAuthorizationRequest: { zone: input.zone }
54539
- }, { client: this.#client });
54540
- }
54541
- async getCloudflareDnsStatus(projectId) {
54542
- return getCloudflareDnsAuthorizationStatus({ project_id: projectId }, { client: this.#client });
54543
- }
54544
- async applyProjectDomains(input) {
54545
- return configureProjectDomains({ "Idempotency-Key": input.idempotencyKey, project_id: input.projectId }, { client: this.#client });
54546
- }
54547
- async planDeployment(input) {
54548
- return planDeployment({
54549
- project_id: input.projectId,
54550
- planDeploymentRequest: {
54551
- commit_sha: input.commitSha,
54552
- ...input.environment === void 0 ? {} : { environment: input.environment }
54553
- }
54554
- }, { client: this.#client });
54555
- }
54556
- async createDeployment(input) {
54557
- return createDeployment({
54558
- "Idempotency-Key": input.idempotencyKey,
54559
- project_id: input.projectId,
54560
- createDeploymentRequest: { plan_id: input.planId }
54561
- }, { client: this.#client });
54562
- }
54563
- async getDeployment(input) {
54564
- return getDeployment({ project_id: input.projectId, deployment_id: input.deploymentId }, { client: this.#client });
54565
- }
54566
- async streamOperationEvents(operationId, signal, lastEventId) {
54567
- return (await streamOperationEvents({ operation_id: operationId }, {
54568
- client: this.#client,
54569
- signal,
54570
- // The generated client would otherwise retry a refused stream, such as a 404, forever.
54571
- sseMaxRetryAttempts: 1,
54572
- headers: {
54573
- Accept: "text/event-stream",
54574
- ...lastEventId === void 0 ? {} : { "Last-Event-ID": lastEventId }
54575
- }
54576
- })).stream;
54577
- }
54578
- async getDeploymentLogs(input) {
54579
- return getDeploymentLogs({
54580
- project_id: input.projectId,
54581
- deployment_id: input.deploymentId,
54582
- limit: input.limit,
54583
- ...input.cursor === void 0 ? {} : { cursor: input.cursor }
54584
- }, { client: this.#client });
55622
+ assertDatabaseExecutionUsagePage(value);
55623
+ return value;
54585
55624
  }
54586
- async planRollback(input) {
54587
- return planDeploymentRollback({ project_id: input.projectId, target_deployment_id: input.deploymentId }, { client: this.#client });
55625
+ async planPaidDomain(input) {
55626
+ return planPaidProjectDomain({ project_id: input.projectId, paidDomainRequest: { hostname: input.hostname } }, { client: this.#client });
54588
55627
  }
54589
- async rollback(input) {
54590
- return rollbackDeployment({
55628
+ async applyPaidDomain(input) {
55629
+ return applyPaidProjectDomain({
54591
55630
  "Idempotency-Key": input.idempotencyKey,
54592
- "If-Match": input.ifMatch,
54593
- "X-Confirmation-Token": input.confirmationToken,
54594
55631
  project_id: input.projectId,
54595
- target_deployment_id: input.deploymentId
55632
+ paidDomainRequest: { hostname: input.hostname }
54596
55633
  }, { client: this.#client });
54597
55634
  }
54598
- async planPromotion(input) {
54599
- return planDeploymentPromotion({ project_id: input.projectId, source_deployment_id: input.sourceDeploymentId }, { client: this.#client });
55635
+ async getPaidDomain(projectId) {
55636
+ return getPaidProjectDomain({ project_id: projectId }, { client: this.#client });
54600
55637
  }
54601
- async promote(input) {
54602
- return promoteDeployment({
55638
+ async deletePaidDomain(input) {
55639
+ return deletePaidProjectDomain({
54603
55640
  "Idempotency-Key": input.idempotencyKey,
54604
- "If-Match": input.ifMatch,
54605
- "X-Confirmation-Token": input.confirmationToken,
54606
55641
  project_id: input.projectId,
54607
- source_deployment_id: input.sourceDeploymentId
55642
+ paidDomainRequest: { hostname: input.hostname }
54608
55643
  }, { client: this.#client });
54609
55644
  }
54610
- async planDelete(projectId) {
54611
- return planProjectDeletion({ project_id: projectId }, { client: this.#client });
55645
+ async ensureDevShareLink(projectId) {
55646
+ return ensureProjectDevShareLink({ project_id: projectId }, { client: this.#client });
54612
55647
  }
54613
- async deleteProject(input) {
54614
- return deleteProject({
54615
- "Idempotency-Key": input.idempotencyKey,
54616
- "If-Match": input.ifMatch,
54617
- "X-Confirmation-Token": input.confirmationToken,
54618
- project_id: input.projectId
54619
- }, { client: this.#client });
55648
+ async preview(action, input) {
55649
+ const args = { project_id: input.projectId, environment: input.environment };
55650
+ const result = action === "get" ? await getProjectPreview(args, { client: this.#client }) : action === "open" ? await openProjectPreview(args, { client: this.#client }) : input.idempotencyKey === void 0 ? (() => {
55651
+ throw new TypeError("Preview idempotency key is required");
55652
+ })() : action === "stop" ? await stopProjectPreview({ ...args, "Idempotency-Key": input.idempotencyKey }, { client: this.#client }) : await rotateProjectPreviewToken({ ...args, "Idempotency-Key": input.idempotencyKey }, { client: this.#client });
55653
+ return parsePreviewView(result, input);
54620
55654
  }
54621
- async listEnvironmentSecrets(input) {
54622
- return listEnvironmentSecrets({ project_id: input.projectId, environment_id: input.environmentId }, { client: this.#client });
55655
+ async rotateDevShareLink(projectId, idempotencyKey) {
55656
+ return rotateProjectDevShareLink({ project_id: projectId, "Idempotency-Key": idempotencyKey }, { client: this.#client });
54623
55657
  }
54624
- async listFunctionRuns(input) {
54625
- return listFunctionRuns({ project_id: input.projectId, environment_id: input.environmentId, limit: input.limit }, { client: this.#client });
55658
+ async revokeDevShareLink(projectId, idempotencyKey) {
55659
+ return revokeProjectDevShareLink({ project_id: projectId, "Idempotency-Key": idempotencyKey }, { client: this.#client });
54626
55660
  }
54627
- async putEnvironmentSecret(input) {
54628
- return putEnvironmentSecret({
54629
- "Idempotency-Key": input.idempotencyKey,
54630
- project_id: input.projectId,
54631
- environment_id: input.environmentId,
54632
- secret_name: input.name,
54633
- putEnvironmentSecretRequest: { value: input.value }
55661
+ async setDevAccessMode(projectId, mode, idempotencyKey) {
55662
+ return setProjectDevAccessMode({
55663
+ project_id: projectId,
55664
+ "Idempotency-Key": idempotencyKey,
55665
+ setDevAccessModeRequest: { mode }
54634
55666
  }, { client: this.#client });
54635
55667
  }
54636
- async deleteEnvironmentSecret(input) {
54637
- return deleteEnvironmentSecret({
54638
- "Idempotency-Key": input.idempotencyKey,
54639
- project_id: input.projectId,
54640
- environment_id: input.environmentId,
54641
- secret_name: input.name
55668
+ async getPoweredByFlag(projectId) {
55669
+ return getProjectPoweredByFlag({ project_id: projectId }, { client: this.#client });
55670
+ }
55671
+ async setPoweredByFlag(projectId, enabled, idempotencyKey) {
55672
+ return setProjectPoweredByFlag({
55673
+ project_id: projectId,
55674
+ "Idempotency-Key": idempotencyKey,
55675
+ setPoweredByFlagRequest: { enabled }
54642
55676
  }, { client: this.#client });
54643
55677
  }
54644
- sharedMail(input) {
54645
- return executeSharedMail(this.#client, input);
55678
+ async createDevAccessTicket(projectId) {
55679
+ return createProjectDevAccessTicket({ project_id: projectId }, { client: this.#client });
54646
55680
  }
54647
- managedMail(input) {
54648
- return executeManagedMail(this.#client, input);
55681
+ async submitFeedback(input) {
55682
+ return parseFeedbackReceipt(await submitFeedback({ "Idempotency-Key": input.idempotencyKey, feedbackSubmission: input.report }, { client: this.#client }));
54649
55683
  }
54650
- nativeAuth(input) {
54651
- return executeNativeAuth(this.#client, input);
55684
+ async getFeedback(feedbackId, cursor) {
55685
+ return parseFeedbackStatus(await getFeedback({ feedback_id: feedbackId, ...cursor === void 0 ? {} : { cursor } }, { client: this.#client }));
54652
55686
  }
54653
- };
54654
-
54655
- // apps/product-cli/dist/repository-init.js
54656
- import { createHash as createHash4 } from "node:crypto";
54657
- import { lstat as lstat3, open as open4, readFile as readFile3, readdir as readdir3, stat as stat2 } from "node:fs/promises";
54658
- import { dirname as dirname3, posix, resolve as resolve5 } from "node:path";
54659
-
54660
- // packages/contracts/dist/application-root.js
54661
- var APPLICATION_ROOT_PATTERN = /^(?:\.|[A-Za-z0-9][A-Za-z0-9._-]*(?:\/[A-Za-z0-9][A-Za-z0-9._-]*)*)$/u;
54662
- var APPLICATION_ROOT_MAX_BYTES = 64;
54663
- var APPLICATION_ROOT_MAX_SEGMENTS = 8;
54664
- var APPLICATION_ROOT_MAX_SEGMENT_BYTES = 63;
54665
- var APPLICATION_ROOT_CONFORMANCE_CORPUS = Object.freeze({
54666
- accepted: Object.freeze([
54667
- Object.freeze({ name: "repository root", value: "." }),
54668
- Object.freeze({ name: "single segment", value: "site" }),
54669
- Object.freeze({ name: "portable segment punctuation", value: "apps/web.v2_test-prod" }),
54670
- Object.freeze({ name: "maximum segment bytes", value: "a".repeat(63) }),
54671
- Object.freeze({
54672
- name: "maximum total bytes",
54673
- value: `${"a".repeat(31)}/${"b".repeat(32)}`
54674
- }),
54675
- Object.freeze({ name: "maximum segment count", value: "a/b/c/d/e/f/g/h" })
54676
- ]),
54677
- rejected: Object.freeze([
54678
- Object.freeze({ name: "empty string", value: "" }),
54679
- Object.freeze({ name: "absolute path", value: "/site" }),
54680
- Object.freeze({ name: "parent traversal", value: "../site" }),
54681
- Object.freeze({ name: "embedded traversal", value: "apps/../site" }),
54682
- Object.freeze({ name: "leading dot segment", value: "./site" }),
54683
- Object.freeze({ name: "trailing separator", value: "site/" }),
54684
- Object.freeze({ name: "repeated separator", value: "apps//site" }),
54685
- Object.freeze({ name: "backslash", value: "apps\\site" }),
54686
- Object.freeze({ name: "colon syntax", value: "C:site" }),
54687
- Object.freeze({ name: "leading whitespace", value: " site" }),
54688
- Object.freeze({ name: "trailing whitespace", value: "site " }),
54689
- Object.freeze({ name: "control character", value: "site\nweb" }),
54690
- Object.freeze({ name: "unicode", value: "caf\xE9" }),
54691
- Object.freeze({ name: "percent ambiguity", value: "site%2fweb" }),
54692
- Object.freeze({ name: "hidden segment", value: ".site" }),
54693
- Object.freeze({ name: "nine segments", value: "a/b/c/d/e/f/g/h/i" }),
54694
- Object.freeze({ name: "segment over 63 bytes", value: "a".repeat(64) }),
54695
- Object.freeze({
54696
- name: "path over 64 bytes",
54697
- value: `${"a".repeat(32)}/${"b".repeat(32)}`
54698
- }),
54699
- Object.freeze({ name: "non-string", value: 1 })
54700
- ]),
54701
- ustarEnvelope: Object.freeze([
54702
- Object.freeze({
54703
- name: "maximum accepted application root",
54704
- repositoryNameBytes: 100,
54705
- separatorBytes: 3,
54706
- commitShaBytes: 40,
54707
- applicationRootBytes: 64,
54708
- inspectionLeafBytes: 24,
54709
- archivePathBytes: 231,
54710
- ustarPathEnvelopeBytes: 255,
54711
- fitsWithoutPax: true
54712
- })
54713
- ])
54714
- });
54715
- function normalizeApplicationRoot(value = ".") {
54716
- if (typeof value !== "string" || !APPLICATION_ROOT_PATTERN.test(value)) {
54717
- throw new TypeError("Application root is invalid");
55687
+ async planProjectDataChange(input) {
55688
+ return parseProjectDataChangePlan2(await planProjectDataChange({ project_id: input.projectId, projectDataChangeRequest: { change: input.change } }, { client: this.#client }));
54718
55689
  }
54719
- const encoder = new TextEncoder();
54720
- const encoded = encoder.encode(value);
54721
- const segments = value === "." ? [] : value.split("/");
54722
- if (encoded.byteLength > APPLICATION_ROOT_MAX_BYTES || segments.length > APPLICATION_ROOT_MAX_SEGMENTS || segments.some((segment) => encoder.encode(segment).byteLength > APPLICATION_ROOT_MAX_SEGMENT_BYTES)) {
54723
- throw new TypeError("Application root is invalid");
55690
+ async createProjectDataChange(input) {
55691
+ return parseOperation(await createProjectDataChange({
55692
+ project_id: input.projectId,
55693
+ projectDataChangeRequest: { change: input.change },
55694
+ "If-Match": input.ifMatch,
55695
+ "X-Confirmation-Token": input.confirmationToken,
55696
+ "Idempotency-Key": input.idempotencyKey
55697
+ }, { client: this.#client }));
54724
55698
  }
54725
- return value;
54726
- }
54727
-
54728
- // packages/contracts/dist/index.js
54729
- var import__ = __toESM(require__(), 1);
54730
- var import_yaml = __toESM(require_dist(), 1);
54731
-
54732
- // packages/contracts/schemas/ohmyhost.schema.json
54733
- var ohmyhost_schema_default = {
54734
- $schema: "https://json-schema.org/draft/2020-12/schema",
54735
- $id: "https://schemas.ohmyho.st/ohmyhost/v1/schema.json",
54736
- title: "ohmyhost.yaml",
54737
- description: "Version 1 project build and runtime configuration.",
54738
- type: "object",
54739
- additionalProperties: false,
54740
- required: ["version", "project", "build", "runtime"],
54741
- properties: {
54742
- version: {
54743
- const: 1
54744
- },
54745
- project: {
54746
- type: "string",
54747
- minLength: 1,
54748
- maxLength: 63,
54749
- pattern: "^[a-z](?:[a-z0-9-]*[a-z0-9])?$"
54750
- },
54751
- applicationRoot: {
54752
- $ref: "#/$defs/applicationRoot"
54753
- },
54754
- build: {
54755
- $ref: "#/$defs/build"
54756
- },
54757
- runtime: {
54758
- $ref: "#/$defs/runtime"
54759
- },
54760
- database: {
54761
- $ref: "#/$defs/database"
54762
- },
54763
- auth: {
54764
- $ref: "#/$defs/auth"
54765
- },
54766
- mail: {
54767
- $ref: "#/$defs/mail"
54768
- },
54769
- storage: {
54770
- $ref: "#/$defs/storage"
54771
- },
54772
- ai: {
54773
- $ref: "#/$defs/ai"
54774
- },
54775
- functions: {
54776
- $ref: "#/$defs/functions"
54777
- },
54778
- credits: {
54779
- $ref: "#/$defs/credits"
54780
- },
54781
- browser: {
54782
- $ref: "#/$defs/browserRendering"
54783
- }
54784
- },
54785
- $defs: {
54786
- applicationRoot: {
54787
- type: "string",
54788
- minLength: 1,
54789
- maxLength: 64,
54790
- pattern: "^(?:\\.|[A-Za-z0-9][A-Za-z0-9._-]*(?:/[A-Za-z0-9][A-Za-z0-9._-]*)*)$",
54791
- allOf: [
54792
- {
54793
- pattern: "^(?:\\.|[A-Za-z0-9][A-Za-z0-9._-]{0,62}(?:/[A-Za-z0-9][A-Za-z0-9._-]{0,62}){0,7})$"
54794
- }
54795
- ]
54796
- },
54797
- nonEmptyCommand: {
54798
- type: "string",
54799
- minLength: 1,
54800
- maxLength: 4096
54801
- },
54802
- relativePath: {
54803
- type: "string",
54804
- minLength: 1,
54805
- maxLength: 512,
54806
- pattern: "^(?!/)(?!.*[\\\\:])(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
54807
- },
54808
- build: {
54809
- type: "object",
54810
- additionalProperties: false,
54811
- required: ["install"],
54812
- properties: {
54813
- install: {
54814
- $ref: "#/$defs/nonEmptyCommand"
54815
- },
54816
- command: {
54817
- $ref: "#/$defs/nonEmptyCommand"
54818
- },
54819
- output: {
54820
- $ref: "#/$defs/relativePath"
54821
- },
54822
- ssg_cache_max_mib: {
54823
- type: "integer",
54824
- minimum: 1,
54825
- maximum: 64,
54826
- description: "Maximum private immutable Next.js prerender cache in MiB; defaults to 32. Cache storage costs zero credits. Public assets retain their independent limit."
54827
- },
54828
- next_revalidate_path: {
54829
- type: "boolean",
54830
- description: "Opt into deployment-scoped on-demand Next.js path revalidation."
54831
- }
54832
- }
54833
- },
54834
- runtime: {
54835
- type: "object",
54836
- additionalProperties: false,
54837
- required: ["mode"],
54838
- properties: {
54839
- mode: {
54840
- type: "string",
54841
- enum: ["static", "edge", "functions", "auto"]
54842
- },
54843
- healthcheck: {
54844
- type: "string",
54845
- minLength: 1,
54846
- maxLength: 256,
54847
- pattern: "^/"
54848
- },
54849
- browser: {
54850
- $ref: "#/$defs/browser"
54851
- },
54852
- egress: {
54853
- type: "object",
54854
- additionalProperties: false,
54855
- required: ["allow"],
54856
- properties: {
54857
- allow: {
54858
- type: "array",
54859
- maxItems: 13,
54860
- uniqueItems: true,
54861
- items: {
54862
- type: "string",
54863
- minLength: 1,
54864
- maxLength: 256,
54865
- pattern: "^https://"
54866
- }
54867
- }
54868
- }
54869
- }
54870
- }
54871
- },
54872
- browserOrigins: {
54873
- type: "array",
54874
- maxItems: 16,
54875
- uniqueItems: true,
54876
- items: {
54877
- type: "string",
54878
- minLength: 1,
54879
- maxLength: 256,
54880
- pattern: "^https://"
54881
- }
54882
- },
54883
- browser: {
54884
- type: "object",
54885
- additionalProperties: false,
54886
- properties: {
54887
- connect: {
54888
- type: "array",
54889
- maxItems: 16,
54890
- uniqueItems: true,
54891
- items: {
54892
- type: "string",
54893
- minLength: 1,
54894
- maxLength: 256,
54895
- pattern: "^(?:https|wss)://"
54896
- }
54897
- },
54898
- scripts: {
54899
- $ref: "#/$defs/browserOrigins"
54900
- },
54901
- styles: {
54902
- $ref: "#/$defs/browserOrigins"
54903
- },
54904
- images: {
54905
- $ref: "#/$defs/browserOrigins"
54906
- },
54907
- fonts: {
54908
- $ref: "#/$defs/browserOrigins"
54909
- },
54910
- frames: {
54911
- $ref: "#/$defs/browserOrigins"
54912
- },
54913
- frameAncestors: {
54914
- $ref: "#/$defs/browserOrigins"
54915
- },
54916
- workers: {
54917
- type: "object",
54918
- additionalProperties: false,
54919
- properties: {
54920
- self: {
54921
- type: "boolean"
54922
- },
54923
- blob: {
54924
- type: "boolean"
54925
- }
54926
- }
54927
- },
54928
- cors: {
54929
- type: "object",
54930
- additionalProperties: false,
54931
- properties: {
54932
- origins: {
54933
- $ref: "#/$defs/browserOrigins"
54934
- },
54935
- credentials: {
54936
- type: "boolean"
54937
- }
54938
- }
54939
- }
54940
- }
54941
- },
54942
- database: {
54943
- type: "object",
54944
- additionalProperties: false,
54945
- required: ["enabled"],
54946
- properties: {
54947
- enabled: {
54948
- type: "boolean"
54949
- },
54950
- migrations: {
54951
- $ref: "#/$defs/relativePath"
54952
- }
54953
- },
54954
- if: {
54955
- properties: {
54956
- enabled: {
54957
- const: true
54958
- }
54959
- },
54960
- required: ["enabled"]
54961
- },
54962
- then: {
54963
- properties: {
54964
- migrations: {
54965
- $ref: "#/$defs/relativePath"
54966
- }
54967
- },
54968
- required: ["migrations"]
54969
- }
54970
- },
54971
- mail: {
54972
- type: "object",
54973
- additionalProperties: false,
54974
- required: ["enabled"],
54975
- properties: {
54976
- enabled: {
54977
- type: "boolean"
54978
- }
54979
- }
54980
- },
54981
- storage: {
54982
- type: "object",
54983
- additionalProperties: false,
54984
- required: ["provider", "jurisdiction", "public"],
54985
- properties: {
54986
- provider: {
54987
- const: "r2"
54988
- },
54989
- jurisdiction: {
54990
- type: "string",
54991
- enum: ["us", "eu"]
54992
- },
54993
- public: {
54994
- const: false
54995
- }
54996
- }
54997
- },
54998
- ai: {
54999
- type: "object",
55000
- additionalProperties: false,
55001
- required: ["enabled"],
55002
- properties: {
55003
- enabled: {
55004
- type: "boolean"
55005
- },
55006
- jurisdiction: {
55007
- type: "string",
55008
- enum: ["eu", "any"]
55009
- }
55010
- },
55011
- if: {
55012
- properties: {
55013
- enabled: {
55014
- const: true
55015
- }
55016
- },
55017
- required: ["enabled"]
55018
- },
55019
- then: {
55020
- properties: {
55021
- jurisdiction: {
55022
- type: "string",
55023
- enum: ["eu", "any"]
55024
- }
55025
- },
55026
- required: ["jurisdiction"]
55027
- }
55028
- },
55029
- auth: {
55030
- type: "object",
55031
- additionalProperties: false,
55032
- required: ["provider"],
55033
- properties: {
55034
- provider: {
55035
- type: "string",
55036
- enum: ["none", "better-auth", "omh-native"]
55037
- }
55038
- }
55039
- },
55040
- functions: {
55041
- type: "object",
55042
- additionalProperties: false,
55043
- required: ["crons"],
55044
- properties: {
55045
- crons: {
55046
- type: "array",
55047
- minItems: 1,
55048
- maxItems: 8,
55049
- uniqueItems: true,
55050
- items: {
55051
- type: "string",
55052
- minLength: 9,
55053
- maxLength: 64
55054
- }
55055
- }
55056
- }
55057
- },
55058
- credits: {
55059
- type: "object",
55060
- additionalProperties: false,
55061
- required: ["monthly_budget"],
55062
- properties: {
55063
- monthly_budget: {
55064
- type: "integer",
55065
- minimum: 0,
55066
- maximum: 1e9
55067
- },
55068
- auto_recharge: {
55069
- $ref: "#/$defs/autoRecharge"
55070
- }
55699
+ async createProject(input) {
55700
+ return createProject({
55701
+ "Idempotency-Key": input.idempotencyKey,
55702
+ createProjectRequest: {
55703
+ organization_id: input.organizationId,
55704
+ name: input.name,
55705
+ ...input.dataMode === void 0 ? {} : { data_mode: input.dataMode },
55706
+ ...input.devAccessMode === void 0 ? {} : { dev_access_mode: input.devAccessMode },
55707
+ ...input.includeDevelopmentEnvironment === void 0 ? {} : { include_development_environment: input.includeDevelopmentEnvironment },
55708
+ ...input.region === void 0 ? {} : { region: input.region }
55071
55709
  }
55072
- },
55073
- autoRecharge: {
55074
- type: "object",
55075
- additionalProperties: false,
55076
- required: ["enabled"],
55077
- properties: {
55078
- enabled: {
55079
- type: "boolean"
55080
- },
55081
- threshold: {
55082
- type: "integer",
55083
- minimum: 0,
55084
- maximum: 1e6
55085
- },
55086
- amount_usd_micros: {
55087
- type: "integer",
55088
- minimum: 1,
55089
- maximum: 9007199254740991
55090
- },
55091
- monthly_cap_usd_micros: {
55092
- type: "integer",
55093
- minimum: 1,
55094
- maximum: 9007199254740991
55095
- }
55096
- },
55097
- if: {
55098
- properties: {
55099
- enabled: {
55100
- const: true
55101
- }
55102
- },
55103
- required: ["enabled"]
55104
- },
55105
- then: {
55106
- properties: {
55107
- threshold: {
55108
- type: "integer",
55109
- minimum: 0,
55110
- maximum: 1e6
55111
- },
55112
- amount_usd_micros: {
55113
- type: "integer",
55114
- minimum: 1,
55115
- maximum: 9007199254740991
55116
- },
55117
- monthly_cap_usd_micros: {
55118
- type: "integer",
55119
- minimum: 1,
55120
- maximum: 9007199254740991
55121
- }
55122
- },
55123
- required: ["threshold", "amount_usd_micros", "monthly_cap_usd_micros"]
55710
+ }, { client: this.#client });
55711
+ }
55712
+ async addProjectDevelopmentEnvironment(input) {
55713
+ return addProjectDevelopmentEnvironment({ project_id: input.projectId, "Idempotency-Key": input.idempotencyKey, body: {} }, { client: this.#client });
55714
+ }
55715
+ async getOperation(operationId) {
55716
+ return getOperation({ operation_id: operationId }, { client: this.#client });
55717
+ }
55718
+ async reconcileOperation(input) {
55719
+ return reconcileOperation({
55720
+ "Idempotency-Key": input.idempotencyKey,
55721
+ operation_id: input.operationId
55722
+ }, { client: this.#client });
55723
+ }
55724
+ async connectGithub(input) {
55725
+ return connectGithubOrganization({
55726
+ organization_id: input.organizationId,
55727
+ "Idempotency-Key": input.idempotencyKey,
55728
+ connectGithubOrganizationRequest: {}
55729
+ }, { client: this.#client });
55730
+ }
55731
+ async getGithubConnection(organizationId) {
55732
+ return getGithubOrganizationConnection({ organization_id: organizationId }, { client: this.#client });
55733
+ }
55734
+ async disconnectGithub(organizationId) {
55735
+ return disconnectGithubOrganization({ organization_id: organizationId }, { client: this.#client });
55736
+ }
55737
+ async listOrganizationMcpConnections(organizationId) {
55738
+ return listOrganizationMcpConnections({ organization_id: organizationId }, { client: this.#client });
55739
+ }
55740
+ async revokeOrganizationMcpConnection(input) {
55741
+ return revokeOrganizationMcpConnection({ organization_id: input.organizationId, connection_id: input.connectionId }, { client: this.#client });
55742
+ }
55743
+ async linkSource(input) {
55744
+ return linkProjectSource({
55745
+ "Idempotency-Key": input.idempotencyKey,
55746
+ project_id: input.projectId,
55747
+ linkProjectSourceRequest: {
55748
+ repository_owner: input.repositoryOwner,
55749
+ repository_name: input.repositoryName
55124
55750
  }
55125
- },
55126
- browserRendering: {
55127
- type: "object",
55128
- additionalProperties: false,
55129
- required: ["enabled"],
55130
- properties: {
55131
- enabled: {
55132
- type: "boolean"
55133
- }
55751
+ }, { client: this.#client });
55752
+ }
55753
+ async configureAutoDeploy(input) {
55754
+ return configureProjectSourceAutoDeploy({
55755
+ "Idempotency-Key": input.idempotencyKey,
55756
+ project_id: input.projectId,
55757
+ configureSourceAutoDeployRequest: { branch: input.branch, enabled: input.enabled }
55758
+ }, { client: this.#client });
55759
+ }
55760
+ async getAutoDeploy(projectId) {
55761
+ return getProjectSourceAutoDeploy({ project_id: projectId }, { client: this.#client });
55762
+ }
55763
+ async authorizeCloudflareDns(input) {
55764
+ return createCloudflareDnsAuthorization({
55765
+ "Idempotency-Key": input.idempotencyKey,
55766
+ project_id: input.projectId,
55767
+ createCloudflareDnsAuthorizationRequest: { zone: input.zone }
55768
+ }, { client: this.#client });
55769
+ }
55770
+ async getCloudflareDnsStatus(projectId) {
55771
+ return getCloudflareDnsAuthorizationStatus({ project_id: projectId }, { client: this.#client });
55772
+ }
55773
+ async applyProjectDomains(input) {
55774
+ return configureProjectDomains({ "Idempotency-Key": input.idempotencyKey, project_id: input.projectId }, { client: this.#client });
55775
+ }
55776
+ async planDeployment(input) {
55777
+ return planDeployment({
55778
+ project_id: input.projectId,
55779
+ planDeploymentRequest: {
55780
+ commit_sha: input.commitSha,
55781
+ ...input.environment === void 0 ? {} : { environment: input.environment }
55134
55782
  }
55135
- }
55136
- },
55137
- allOf: [
55138
- {
55139
- if: {
55140
- type: "object",
55141
- properties: {
55142
- runtime: {
55143
- type: "object",
55144
- properties: {
55145
- mode: {
55146
- const: "functions"
55147
- }
55148
- },
55149
- required: ["mode"]
55150
- }
55151
- },
55152
- required: ["runtime"]
55153
- },
55154
- then: {
55155
- type: "object",
55156
- properties: {
55157
- build: {
55158
- type: "object",
55159
- additionalProperties: false,
55160
- required: ["install"],
55161
- properties: {
55162
- install: {
55163
- $ref: "#/$defs/nonEmptyCommand"
55164
- }
55165
- }
55166
- }
55167
- }
55168
- },
55169
- else: {
55170
- type: "object",
55171
- properties: {
55172
- build: {
55173
- type: "object",
55174
- additionalProperties: false,
55175
- required: ["install", "command", "output"],
55176
- properties: {
55177
- install: {
55178
- $ref: "#/$defs/nonEmptyCommand"
55179
- },
55180
- command: {
55181
- $ref: "#/$defs/nonEmptyCommand"
55182
- },
55183
- output: {
55184
- $ref: "#/$defs/relativePath"
55185
- },
55186
- ssg_cache_max_mib: {
55187
- $ref: "#/$defs/build/properties/ssg_cache_max_mib"
55188
- },
55189
- next_revalidate_path: {
55190
- $ref: "#/$defs/build/properties/next_revalidate_path"
55191
- }
55192
- }
55193
- }
55194
- }
55783
+ }, { client: this.#client });
55784
+ }
55785
+ async createDeployment(input) {
55786
+ return createDeployment({
55787
+ "Idempotency-Key": input.idempotencyKey,
55788
+ project_id: input.projectId,
55789
+ createDeploymentRequest: { plan_id: input.planId }
55790
+ }, { client: this.#client });
55791
+ }
55792
+ async getDeployment(input) {
55793
+ return getDeployment({ project_id: input.projectId, deployment_id: input.deploymentId }, { client: this.#client });
55794
+ }
55795
+ async streamOperationEvents(operationId, signal, lastEventId) {
55796
+ return (await streamOperationEvents({ operation_id: operationId }, {
55797
+ client: this.#client,
55798
+ signal,
55799
+ // The generated client would otherwise retry a refused stream, such as a 404, forever.
55800
+ sseMaxRetryAttempts: 1,
55801
+ headers: {
55802
+ Accept: "text/event-stream",
55803
+ ...lastEventId === void 0 ? {} : { "Last-Event-ID": lastEventId }
55195
55804
  }
55196
- }
55197
- ]
55198
- };
55199
-
55200
- // packages/contracts/dist/functions.js
55201
- function normalizeCrons(value) {
55202
- if (!Array.isArray(value) || value.length === 0 || value.length > 8) {
55203
- throw new TypeError("ohmyhost.yaml functions.crons must list one to eight schedules");
55805
+ })).stream;
55204
55806
  }
55205
- const crons = value.map((entry) => {
55206
- if (typeof entry !== "string")
55207
- throw new TypeError("ohmyhost.yaml cron is invalid");
55208
- return normalizeCron(entry);
55209
- });
55210
- const sorted = [...crons].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
55211
- for (let index = 1; index < sorted.length; index += 1) {
55212
- if (sorted[index - 1] === sorted[index]) {
55213
- throw new TypeError("ohmyhost.yaml functions.crons must be unique");
55214
- }
55807
+ async getDeploymentLogs(input) {
55808
+ return getDeploymentLogs({
55809
+ project_id: input.projectId,
55810
+ deployment_id: input.deploymentId,
55811
+ limit: input.limit,
55812
+ ...input.cursor === void 0 ? {} : { cursor: input.cursor }
55813
+ }, { client: this.#client });
55215
55814
  }
55216
- return Object.freeze(sorted);
55217
- }
55218
- function normalizeCron(value) {
55219
- if (value !== value.trim() || value.includes(" ")) {
55220
- throw new TypeError("ohmyhost.yaml cron is invalid");
55815
+ async planRollback(input) {
55816
+ return planDeploymentRollback({ project_id: input.projectId, target_deployment_id: input.deploymentId }, { client: this.#client });
55221
55817
  }
55222
- const fields = value.split(" ");
55223
- if (fields.length !== 5)
55224
- throw new TypeError("ohmyhost.yaml cron is invalid");
55225
- const [minute, hour, day, month, weekday] = fields;
55226
- if (minute === void 0 || hour === void 0 || day === void 0 || month === void 0 || weekday === void 0 || !validCronMinute(minute) || !validCronField(hour, 0, 23) || !validCronField(day, 1, 31) || !validCronField(month, 1, 12) || !validCronField(weekday, 0, 6)) {
55227
- throw new TypeError("ohmyhost.yaml cron is invalid");
55818
+ async rollback(input) {
55819
+ return rollbackDeployment({
55820
+ "Idempotency-Key": input.idempotencyKey,
55821
+ "If-Match": input.ifMatch,
55822
+ "X-Confirmation-Token": input.confirmationToken,
55823
+ project_id: input.projectId,
55824
+ target_deployment_id: input.deploymentId
55825
+ }, { client: this.#client });
55228
55826
  }
55229
- return value;
55230
- }
55231
- function validCronMinute(value) {
55232
- const step = /^\*\/([1-9]|[1-5][0-9])$/u.exec(value);
55233
- if (step !== null)
55234
- return Number(step[1]) >= 5;
55235
- return value !== "*" && validCronField(value, 0, 59);
55236
- }
55237
- function validCronField(value, minimum, maximum) {
55238
- if (value === "*")
55239
- return true;
55240
- if (!/^(?:0|[1-9][0-9]?)$/u.test(value))
55241
- return false;
55242
- const parsed = Number(value);
55243
- return parsed >= minimum && parsed <= maximum;
55244
- }
55245
-
55246
- // packages/contracts/dist/browser-capabilities.js
55247
- var RESOURCE_GROUPS = [
55248
- "connect",
55249
- "scripts",
55250
- "styles",
55251
- "images",
55252
- "fonts",
55253
- "frames",
55254
- "frameAncestors"
55255
- ];
55256
- var POLICY_KEYS = [...RESOURCE_GROUPS, "workers", "cors"];
55257
- var MAX_ORIGINS = 16;
55258
- function normalizeBrowserPolicy(value) {
55259
- const input = value === void 0 ? {} : policyRecord(value, POLICY_KEYS);
55260
- const workers = input["workers"] === void 0 ? {} : policyRecord(input["workers"], ["self", "blob"]);
55261
- const cors = input["cors"] === void 0 ? {} : policyRecord(input["cors"], ["origins", "credentials"]);
55262
- const resources = Object.fromEntries(RESOURCE_GROUPS.map((group) => [group, normalizeOrigins(input[group], group === "connect")]));
55263
- return Object.freeze({
55264
- ...resources,
55265
- workers: Object.freeze({
55266
- self: normalizeBoolean(workers["self"]),
55267
- blob: normalizeBoolean(workers["blob"])
55268
- }),
55269
- cors: Object.freeze({
55270
- origins: normalizeOrigins(cors["origins"], false),
55271
- credentials: normalizeBoolean(cors["credentials"])
55272
- })
55273
- });
55274
- }
55275
- function policyRecord(value, keys, complete = false) {
55276
- if (typeof value !== "object" || value === null || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value)) || Object.keys(value).some((key) => !keys.includes(key)) || complete && Object.keys(value).length !== keys.length)
55277
- throw invalidPolicy();
55278
- return value;
55279
- }
55280
- function normalizeBoolean(value) {
55281
- if (value === void 0)
55282
- return false;
55283
- if (typeof value !== "boolean")
55284
- throw invalidPolicy();
55285
- return value;
55286
- }
55287
- function normalizeOrigins(value, allowWebSocket) {
55288
- if (value === void 0)
55289
- return Object.freeze([]);
55290
- if (!Array.isArray(value) || value.length > MAX_ORIGINS)
55291
- throw invalidPolicy();
55292
- const origins = [];
55293
- for (const origin of value) {
55294
- if (!browserOrigin(origin, allowWebSocket) || origins.includes(origin))
55295
- throw invalidPolicy();
55296
- origins.push(origin);
55827
+ async planPromotion(input) {
55828
+ return planDeploymentPromotion({ project_id: input.projectId, source_deployment_id: input.sourceDeploymentId }, { client: this.#client });
55297
55829
  }
55298
- return Object.freeze(origins.sort());
55299
- }
55300
- function browserOrigin(value, allowWebSocket) {
55301
- if (typeof value !== "string" || value.length > 256)
55302
- return false;
55303
- try {
55304
- const url = new URL(value);
55305
- return (url.protocol === "https:" || allowWebSocket && url.protocol === "wss:") && url.origin === value && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname.includes(".") && !url.hostname.endsWith(".local") && !url.hostname.endsWith(".internal") && !/^\d+(?:\.\d+){3}$/u.test(url.hostname) && url.hostname.split(".").every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(label));
55306
- } catch {
55307
- return false;
55830
+ async promote(input) {
55831
+ return promoteDeployment({
55832
+ "Idempotency-Key": input.idempotencyKey,
55833
+ "If-Match": input.ifMatch,
55834
+ "X-Confirmation-Token": input.confirmationToken,
55835
+ project_id: input.projectId,
55836
+ source_deployment_id: input.sourceDeploymentId
55837
+ }, { client: this.#client });
55308
55838
  }
55309
- }
55310
- function invalidPolicy() {
55311
- return new TypeError("Invalid browser capability policy");
55312
- }
55313
-
55314
- // packages/contracts/dist/index.js
55315
- var validateOhmyhostConfig = new import__.Ajv2020({
55316
- allErrors: true,
55317
- strict: true
55318
- }).compile(ohmyhost_schema_default);
55319
- function parseOhmyhostConfig(value) {
55320
- if (!validateOhmyhostConfig(value)) {
55321
- throw new TypeError(`ohmyhost.yaml is invalid: ${formatErrors(validateOhmyhostConfig.errors)}`);
55839
+ async planDelete(projectId) {
55840
+ return planProjectDeletion({ project_id: projectId }, { client: this.#client });
55322
55841
  }
55323
- const input = value;
55324
- const config = {
55325
- version: 1,
55326
- project: input.project,
55327
- applicationRoot: normalizeApplicationRoot(input.applicationRoot),
55328
- build: input.runtime.mode === "functions" ? Object.freeze({ install: input.build.install }) : Object.freeze({
55329
- install: input.build.install,
55330
- command: input.build.command,
55331
- output: input.build.output,
55332
- ...input.build.ssg_cache_max_mib === void 0 ? {} : { ssg_cache_max_mib: input.build.ssg_cache_max_mib },
55333
- ...input.build.next_revalidate_path === true ? { next_revalidate_path: true } : {}
55334
- }),
55335
- runtime: Object.freeze({
55336
- mode: input.runtime.mode,
55337
- healthcheck: normalizeHealthcheck(input.runtime.healthcheck),
55338
- egress: Object.freeze({
55339
- allow: normalizeEgressOrigins(input.runtime.egress?.allow)
55340
- }),
55341
- ...input.runtime.browser === void 0 ? {} : { browser: normalizeBrowserPolicy(input.runtime.browser) }
55342
- }),
55343
- ...input.database === void 0 ? {} : {
55344
- database: Object.freeze({
55345
- enabled: input.database.enabled,
55346
- ...input.database.migrations === void 0 ? {} : { migrations: input.database.migrations }
55347
- })
55348
- },
55349
- ...input.auth === void 0 ? {} : { auth: Object.freeze({ provider: input.auth.provider }) },
55350
- ...input.mail === void 0 ? {} : { mail: Object.freeze({ enabled: input.mail.enabled }) },
55351
- ...input.storage === void 0 ? {} : {
55352
- storage: Object.freeze({
55353
- provider: input.storage.provider,
55354
- jurisdiction: input.storage.jurisdiction,
55355
- public: input.storage.public
55356
- })
55357
- },
55358
- ...input.ai === void 0 ? {} : {
55359
- ai: Object.freeze({
55360
- enabled: input.ai.enabled,
55361
- ...input.ai.jurisdiction === void 0 ? {} : { jurisdiction: input.ai.jurisdiction }
55362
- })
55363
- },
55364
- ...input.browser === void 0 ? {} : { browser: Object.freeze({ enabled: input.browser.enabled }) },
55365
- ...input.functions === void 0 ? {} : {
55366
- functions: Object.freeze({ crons: normalizeCrons(input.functions.crons) })
55367
- },
55368
- ...input.credits === void 0 ? {} : {
55369
- credits: Object.freeze({
55370
- monthly_budget: input.credits.monthly_budget,
55371
- ...input.credits.auto_recharge === void 0 ? {} : {
55372
- auto_recharge: Object.freeze({
55373
- enabled: input.credits.auto_recharge.enabled,
55374
- ...input.credits.auto_recharge.threshold === void 0 ? {} : { threshold: input.credits.auto_recharge.threshold },
55375
- ...input.credits.auto_recharge.amount_usd_micros === void 0 ? {} : { amount_usd_micros: input.credits.auto_recharge.amount_usd_micros },
55376
- ...input.credits.auto_recharge.monthly_cap_usd_micros === void 0 ? {} : {
55377
- monthly_cap_usd_micros: input.credits.auto_recharge.monthly_cap_usd_micros
55378
- }
55379
- })
55380
- }
55381
- })
55382
- }
55383
- };
55384
- return Object.freeze(config);
55385
- }
55386
- function normalizeHealthcheck(value) {
55387
- const candidate = value ?? "/";
55388
- if (candidate !== candidate.trim() || !candidate.startsWith("/") || candidate.startsWith("//") || candidate.includes("\\") || candidate.includes("?") || candidate.includes("#") || candidate.split("/").some((segment) => segment === "." || segment === "..")) {
55389
- throw new TypeError("ohmyhost.yaml runtime healthcheck is invalid");
55842
+ async deleteProject(input) {
55843
+ return deleteProject({
55844
+ "Idempotency-Key": input.idempotencyKey,
55845
+ "If-Match": input.ifMatch,
55846
+ "X-Confirmation-Token": input.confirmationToken,
55847
+ project_id: input.projectId
55848
+ }, { client: this.#client });
55390
55849
  }
55391
- return candidate;
55392
- }
55393
- function normalizeEgressOrigins(value) {
55394
- const origins = [...value ?? []];
55395
- for (const origin of origins) {
55396
- let parsed;
55397
- try {
55398
- parsed = new URL(origin);
55399
- } catch {
55400
- throw new TypeError("ohmyhost.yaml runtime egress origin is invalid");
55401
- }
55402
- if (parsed.protocol !== "https:" || parsed.port !== "" || parsed.username !== "" || parsed.password !== "" || parsed.origin !== origin || parsed.pathname !== "/" || parsed.search !== "" || parsed.hash !== "" || forbiddenEgressHostname(parsed.hostname)) {
55403
- throw new TypeError("ohmyhost.yaml runtime egress origin is invalid");
55404
- }
55850
+ async listEnvironmentSecrets(input) {
55851
+ return listEnvironmentSecrets({ project_id: input.projectId, environment_id: input.environmentId }, { client: this.#client });
55405
55852
  }
55406
- origins.sort();
55407
- return Object.freeze(origins);
55408
- }
55409
- function forbiddenEgressHostname(hostname) {
55410
- const normalized = hostname.toLowerCase();
55411
- return /(?:^|\.)ohmyho-(?:mail|storage)-gateway-[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*\.workers\.dev\.?$/u.test(normalized) || normalized === "localhost" || normalized.endsWith(".localhost") || normalized.endsWith(".local") || normalized.endsWith(".internal") || /^\d{1,3}(?:\.\d{1,3}){3}$/u.test(normalized) || normalized.startsWith("[") || normalized.endsWith("]");
55412
- }
55413
- function parseOhmyhostConfigYaml(source) {
55414
- if (typeof source !== "string") {
55415
- throw new TypeError("ohmyhost.yaml must be a string");
55853
+ async listFunctionRuns(input) {
55854
+ return listFunctionRuns({ project_id: input.projectId, environment_id: input.environmentId, limit: input.limit }, { client: this.#client });
55416
55855
  }
55417
- let value;
55418
- try {
55419
- value = (0, import_yaml.parse)(source);
55420
- } catch {
55421
- throw new TypeError("ohmyhost.yaml is not valid YAML");
55856
+ async putEnvironmentSecret(input) {
55857
+ return putEnvironmentSecret({
55858
+ "Idempotency-Key": input.idempotencyKey,
55859
+ project_id: input.projectId,
55860
+ environment_id: input.environmentId,
55861
+ secret_name: input.name,
55862
+ putEnvironmentSecretRequest: { value: input.value }
55863
+ }, { client: this.#client });
55422
55864
  }
55423
- return parseOhmyhostConfig(value);
55424
- }
55425
- function formatErrors(errors) {
55426
- return (errors ?? []).map(({ instancePath, message }) => `${instancePath || "/"} ${message ?? "is invalid"}`).join("; ");
55427
- }
55865
+ async deleteEnvironmentSecret(input) {
55866
+ return deleteEnvironmentSecret({
55867
+ "Idempotency-Key": input.idempotencyKey,
55868
+ project_id: input.projectId,
55869
+ environment_id: input.environmentId,
55870
+ secret_name: input.name
55871
+ }, { client: this.#client });
55872
+ }
55873
+ sharedMail(input) {
55874
+ return executeSharedMail(this.#client, input);
55875
+ }
55876
+ managedMail(input) {
55877
+ return executeManagedMail(this.#client, input);
55878
+ }
55879
+ nativeAuth(input) {
55880
+ return executeNativeAuth(this.#client, input);
55881
+ }
55882
+ };
55883
+
55884
+ // apps/product-cli/dist/repository-init.js
55885
+ import { createHash as createHash4 } from "node:crypto";
55886
+ import { lstat as lstat3, open as open4, readFile as readFile3, readdir as readdir3, stat as stat2 } from "node:fs/promises";
55887
+ import { dirname as dirname3, posix, resolve as resolve5 } from "node:path";
55428
55888
 
55429
55889
  // packages/contracts/dist/framework-source-rules.js
55430
55890
  var import_yaml2 = __toESM(require_dist(), 1);
@@ -55968,8 +56428,8 @@ function pnpmLockedVersion(document2, packageName) {
55968
56428
  }
55969
56429
  return null;
55970
56430
  }
55971
- function ownValue(record8, key) {
55972
- return isRecord4(record8) && Object.hasOwn(record8, key) ? record8[key] : void 0;
56431
+ function ownValue(record9, key) {
56432
+ return isRecord4(record9) && Object.hasOwn(record9, key) ? record9[key] : void 0;
55973
56433
  }
55974
56434
  function isRecord4(value) {
55975
56435
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -56185,7 +56645,7 @@ function astroConfigFindings(text, path2, mode) {
56185
56645
  if ("finding" in lexed)
56186
56646
  return [lexed.finding];
56187
56647
  const tokens = lexed.tokens;
56188
- const hasPropertyKey = (items, name) => items.some((token, index) => token.value === name && items[index + 1]?.value === ":");
56648
+ const hasPropertyKey = (items2, name) => items2.some((token, index) => token.value === name && items2[index + 1]?.value === ":");
56189
56649
  const invalid7 = hasNonRootProperty(tokens, ["base"], ["", "/"]) || ["srcDir", "outDir", "serverEntry", "client", "server", "assetsPrefix"].some((name) => hasPropertyKey(tokens, name)) || (mode === "edge" ? !text.includes("@astrojs/cloudflare") || !hasProperty(tokens, "output", "server") || !hasProperty(tokens, "session", "false") || !hasProperty(tokens, "imageService", "passthrough") || hasPropertyKey(tokens, "cache") : text.includes("@astrojs/cloudflare") || hasPropertyKey(tokens, "adapter") || hasProperty(tokens, "output", "server"));
56190
56650
  return invalid7 ? [diagnostic({ code: "astro_config_unsupported", path: path2 })] : [];
56191
56651
  }
@@ -59365,6 +59825,7 @@ export {
59365
59825
  executeNativeAuth,
59366
59826
  GeneratedSdkManagedSourceApi,
59367
59827
  assertDatabaseTableAnswer,
59828
+ executeConnectionCommand,
59368
59829
  GeneratedSdkProductApi,
59369
59830
  RepositoryInitError,
59370
59831
  RepositoryInitBlockedError,