@amerged/ohmyhost-cli 0.1.41 → 0.1.43
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.
- package/README.md +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-SB6RMO3M.js → chunk-5TO5I2HF.js} +1662 -333
- package/dist/index.js +5 -3
- package/package.json +1 -1
- package/src/apps/product-cli/package.json +1 -1
- package/src/apps/product-cli/src/cli.ts +438 -38
- package/src/apps/product-cli/src/command.ts +490 -3
- package/src/apps/product-cli/src/composition.ts +6 -3
- package/src/apps/product-cli/src/product-api.ts +363 -0
- package/src/apps/product-cli/src/psql-session.ts +20 -32
- package/src/apps/product-cli/src/runtime-contract.ts +1 -13
- package/src/packages/contracts/package.json +5 -0
- package/src/packages/contracts/src/credit-pricing.ts +0 -90
- package/src/packages/contracts/src/database-access.ts +24 -45
- package/src/packages/contracts/src/database-events.ts +697 -0
- package/src/packages/contracts/src/problem-policy.ts +28 -0
- package/src/packages/postgres-bridge/src/bridge.ts +0 -4
- package/src/packages/sdk-ts/package.json +1 -1
- package/src/packages/sdk-ts/src/generated/index.ts +109 -1
- package/src/packages/sdk-ts/src/generated/sdk.gen.ts +697 -1
- package/src/packages/sdk-ts/src/generated/types.gen.ts +1153 -47
|
@@ -9012,17 +9012,17 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
9012
9012
|
var VARIABLE_NAME_REGEX = /^[A-Za-z][A-Za-z-]*$/;
|
|
9013
9013
|
var VARIABLE_VALUE_COMMENT_REGEX = /^(.*?)( *[#;].*)$/;
|
|
9014
9014
|
var extractSectionLine = (line) => {
|
|
9015
|
-
const
|
|
9016
|
-
if (
|
|
9017
|
-
const [section, subsection] =
|
|
9015
|
+
const matches2 = SECTION_LINE_REGEX.exec(line);
|
|
9016
|
+
if (matches2 != null) {
|
|
9017
|
+
const [section, subsection] = matches2.slice(1);
|
|
9018
9018
|
return [section, subsection];
|
|
9019
9019
|
}
|
|
9020
9020
|
return null;
|
|
9021
9021
|
};
|
|
9022
9022
|
var extractVariableLine = (line) => {
|
|
9023
|
-
const
|
|
9024
|
-
if (
|
|
9025
|
-
const [name, rawValue = "true"] =
|
|
9023
|
+
const matches2 = VARIABLE_LINE_REGEX.exec(line);
|
|
9024
|
+
if (matches2 != null) {
|
|
9025
|
+
const [name, rawValue = "true"] = matches2.slice(1);
|
|
9026
9026
|
const valueWithoutComments = removeComments(rawValue);
|
|
9027
9027
|
const valueWithoutQuotes = removeQuotes(valueWithoutComments);
|
|
9028
9028
|
return [name, valueWithoutQuotes];
|
|
@@ -10641,14 +10641,14 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
10641
10641
|
* @param {string} short
|
|
10642
10642
|
* @param {string[]} matches
|
|
10643
10643
|
*/
|
|
10644
|
-
constructor(nouns, short,
|
|
10644
|
+
constructor(nouns, short, matches2) {
|
|
10645
10645
|
super(
|
|
10646
|
-
`Found multiple ${nouns} matching "${short}" (${
|
|
10646
|
+
`Found multiple ${nouns} matching "${short}" (${matches2.join(
|
|
10647
10647
|
", "
|
|
10648
10648
|
)}). Use a longer abbreviation length to disambiguate them.`
|
|
10649
10649
|
);
|
|
10650
10650
|
this.code = this.name = _AmbiguousError.code;
|
|
10651
|
-
this.data = { nouns, short, matches };
|
|
10651
|
+
this.data = { nouns, short, matches: matches2 };
|
|
10652
10652
|
}
|
|
10653
10653
|
};
|
|
10654
10654
|
AmbiguousError.code = "AmbiguousError";
|
|
@@ -11021,9 +11021,9 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
11021
11021
|
IndexResetError,
|
|
11022
11022
|
NoCommitError
|
|
11023
11023
|
});
|
|
11024
|
-
function formatAuthor({ name, email, timestamp:
|
|
11024
|
+
function formatAuthor({ name, email, timestamp: timestamp7, timezoneOffset }) {
|
|
11025
11025
|
timezoneOffset = formatTimezoneOffset(timezoneOffset);
|
|
11026
|
-
return `${name} <${email}> ${
|
|
11026
|
+
return `${name} <${email}> ${timestamp7} ${timezoneOffset}`;
|
|
11027
11027
|
}
|
|
11028
11028
|
function formatTimezoneOffset(minutes) {
|
|
11029
11029
|
const sign = simpleSign(negateExceptForZero(minutes));
|
|
@@ -11049,13 +11049,13 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
|
|
|
11049
11049
|
return str;
|
|
11050
11050
|
}
|
|
11051
11051
|
function parseAuthor(author) {
|
|
11052
|
-
const [, name, email,
|
|
11052
|
+
const [, name, email, timestamp7, offset] = author.match(
|
|
11053
11053
|
/^(.*) <(.*)> (.*) (.*)$/
|
|
11054
11054
|
);
|
|
11055
11055
|
return {
|
|
11056
11056
|
name,
|
|
11057
11057
|
email,
|
|
11058
|
-
timestamp: Number(
|
|
11058
|
+
timestamp: Number(timestamp7),
|
|
11059
11059
|
timezoneOffset: parseTimezoneOffset(offset)
|
|
11060
11060
|
};
|
|
11061
11061
|
}
|
|
@@ -12395,13 +12395,13 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12395
12395
|
return target;
|
|
12396
12396
|
}
|
|
12397
12397
|
async function normalizeAuthorObject({ fs: fs3, gitdir, author, commit: commit3 }) {
|
|
12398
|
-
const
|
|
12398
|
+
const timestamp7 = Math.floor(Date.now() / 1e3);
|
|
12399
12399
|
const defaultAuthor = {
|
|
12400
12400
|
name: await _getConfig({ fs: fs3, gitdir, path: "user.name" }),
|
|
12401
12401
|
email: await _getConfig({ fs: fs3, gitdir, path: "user.email" }) || "",
|
|
12402
12402
|
// author.email is allowed to be empty string
|
|
12403
|
-
timestamp:
|
|
12404
|
-
timezoneOffset: new Date(
|
|
12403
|
+
timestamp: timestamp7,
|
|
12404
|
+
timezoneOffset: new Date(timestamp7 * 1e3).getTimezoneOffset()
|
|
12405
12405
|
};
|
|
12406
12406
|
const normalizedAuthor = assignDefined(
|
|
12407
12407
|
{},
|
|
@@ -12421,13 +12421,13 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
12421
12421
|
committer,
|
|
12422
12422
|
commit: commit3
|
|
12423
12423
|
}) {
|
|
12424
|
-
const
|
|
12424
|
+
const timestamp7 = Math.floor(Date.now() / 1e3);
|
|
12425
12425
|
const defaultCommitter = {
|
|
12426
12426
|
name: await _getConfig({ fs: fs3, gitdir, path: "user.name" }),
|
|
12427
12427
|
email: await _getConfig({ fs: fs3, gitdir, path: "user.email" }) || "",
|
|
12428
12428
|
// committer.email is allowed to be empty string
|
|
12429
|
-
timestamp:
|
|
12430
|
-
timezoneOffset: new Date(
|
|
12429
|
+
timestamp: timestamp7,
|
|
12430
|
+
timezoneOffset: new Date(timestamp7 * 1e3).getTimezoneOffset()
|
|
12431
12431
|
};
|
|
12432
12432
|
const normalizedCommitter = assignDefined(
|
|
12433
12433
|
{},
|
|
@@ -14894,18 +14894,18 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
14894
14894
|
address: url
|
|
14895
14895
|
};
|
|
14896
14896
|
}
|
|
14897
|
-
const
|
|
14898
|
-
if (
|
|
14899
|
-
if (
|
|
14897
|
+
const matches2 = url.match(/(\w+)(:\/\/|::)(.*)/);
|
|
14898
|
+
if (matches2 === null) return;
|
|
14899
|
+
if (matches2[2] === "://") {
|
|
14900
14900
|
return {
|
|
14901
|
-
transport:
|
|
14902
|
-
address:
|
|
14901
|
+
transport: matches2[1],
|
|
14902
|
+
address: matches2[0]
|
|
14903
14903
|
};
|
|
14904
14904
|
}
|
|
14905
|
-
if (
|
|
14905
|
+
if (matches2[2] === "::") {
|
|
14906
14906
|
return {
|
|
14907
|
-
transport:
|
|
14908
|
-
address:
|
|
14907
|
+
transport: matches2[1],
|
|
14908
|
+
address: matches2[3]
|
|
14909
14909
|
};
|
|
14910
14910
|
}
|
|
14911
14911
|
}
|
|
@@ -15530,12 +15530,12 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
15530
15530
|
forAwait(lines, async (line) => {
|
|
15531
15531
|
if (onMessage) await onMessage(line);
|
|
15532
15532
|
if (onProgress) {
|
|
15533
|
-
const
|
|
15534
|
-
if (
|
|
15533
|
+
const matches2 = line.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);
|
|
15534
|
+
if (matches2) {
|
|
15535
15535
|
await onProgress({
|
|
15536
|
-
phase:
|
|
15537
|
-
loaded: parseInt(
|
|
15538
|
-
total: parseInt(
|
|
15536
|
+
phase: matches2[1].trim(),
|
|
15537
|
+
loaded: parseInt(matches2[2], 10),
|
|
15538
|
+
total: parseInt(matches2[3], 10)
|
|
15539
15539
|
});
|
|
15540
15540
|
}
|
|
15541
15541
|
}
|
|
@@ -18604,9 +18604,9 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18604
18604
|
static createStashReflogEntry(author, stashCommit, message) {
|
|
18605
18605
|
const nameNoSpace = author.name.replace(/\s/g, "");
|
|
18606
18606
|
const z40 = "0000000000000000000000000000000000000000";
|
|
18607
|
-
const
|
|
18607
|
+
const timestamp7 = Math.floor(Date.now() / 1e3);
|
|
18608
18608
|
const timezoneOffset = _GitRefStash.timezoneOffsetForRefLogEntry;
|
|
18609
|
-
return `${z40} ${stashCommit} ${nameNoSpace} ${author.email} ${
|
|
18609
|
+
return `${z40} ${stashCommit} ${nameNoSpace} ${author.email} ${timestamp7} ${timezoneOffset} ${message}
|
|
18610
18610
|
`;
|
|
18611
18611
|
}
|
|
18612
18612
|
static getStashReflogEntry(reflogString, parsed = false) {
|
|
@@ -22487,11 +22487,11 @@ var require_validate = __commonJS({
|
|
|
22487
22487
|
jsonPointer = $data;
|
|
22488
22488
|
data = names_1.default.rootData;
|
|
22489
22489
|
} else {
|
|
22490
|
-
const
|
|
22491
|
-
if (!
|
|
22490
|
+
const matches2 = RELATIVE_JSON_POINTER.exec($data);
|
|
22491
|
+
if (!matches2)
|
|
22492
22492
|
throw new Error(`Invalid JSON-pointer: ${$data}`);
|
|
22493
|
-
const up = +
|
|
22494
|
-
jsonPointer =
|
|
22493
|
+
const up = +matches2[1];
|
|
22494
|
+
jsonPointer = matches2[2];
|
|
22495
22495
|
if (jsonPointer === "#") {
|
|
22496
22496
|
if (up >= dataLevel)
|
|
22497
22497
|
throw new Error(errorMsg("property/index", up));
|
|
@@ -23410,11 +23410,11 @@ var require_schemes = __commonJS({
|
|
|
23410
23410
|
urnComponent.error = "URN can not be parsed";
|
|
23411
23411
|
return urnComponent;
|
|
23412
23412
|
}
|
|
23413
|
-
const
|
|
23414
|
-
if (
|
|
23413
|
+
const matches2 = urnComponent.path.match(URN_REG);
|
|
23414
|
+
if (matches2 && matches2[0] === urnComponent.path) {
|
|
23415
23415
|
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
23416
|
-
urnComponent.nid =
|
|
23417
|
-
urnComponent.nss =
|
|
23416
|
+
urnComponent.nid = matches2[1].toLowerCase();
|
|
23417
|
+
urnComponent.nss = matches2[2];
|
|
23418
23418
|
const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`;
|
|
23419
23419
|
const schemeHandler = getSchemeHandler(urnScheme);
|
|
23420
23420
|
urnComponent.path = void 0;
|
|
@@ -23735,8 +23735,8 @@ var require_fast_uri = __commonJS({
|
|
|
23735
23735
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
23736
23736
|
var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
|
|
23737
23737
|
var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
|
|
23738
|
-
function getParseError(parsed,
|
|
23739
|
-
if (
|
|
23738
|
+
function getParseError(parsed, matches2) {
|
|
23739
|
+
if (matches2[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
|
|
23740
23740
|
return 'URI path must start with "/" when authority is present.';
|
|
23741
23741
|
}
|
|
23742
23742
|
if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
|
|
@@ -23758,9 +23758,9 @@ var require_fast_uri = __commonJS({
|
|
|
23758
23758
|
function isIPLiteral(host2) {
|
|
23759
23759
|
return host2[0] === "[" && host2[host2.length - 1] === "]";
|
|
23760
23760
|
}
|
|
23761
|
-
function hasMalformedComponentPercentEncoding(
|
|
23762
|
-
const host2 =
|
|
23763
|
-
return hasMalformedPercentEncoding(
|
|
23761
|
+
function hasMalformedComponentPercentEncoding(matches2) {
|
|
23762
|
+
const host2 = matches2[4];
|
|
23763
|
+
return hasMalformedPercentEncoding(matches2[3]) || host2 !== void 0 && !isIPLiteral(host2) && hasMalformedPercentEncoding(host2) || hasMalformedPercentEncoding(matches2[6]) || hasMalformedPercentEncoding(matches2[7]) || hasMalformedPercentEncoding(matches2[8]);
|
|
23764
23764
|
}
|
|
23765
23765
|
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
23766
23766
|
if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
|
|
@@ -23835,15 +23835,15 @@ var require_fast_uri = __commonJS({
|
|
|
23835
23835
|
}
|
|
23836
23836
|
}
|
|
23837
23837
|
}
|
|
23838
|
-
const
|
|
23839
|
-
if (
|
|
23840
|
-
parsed.scheme =
|
|
23841
|
-
parsed.userinfo =
|
|
23842
|
-
parsed.host =
|
|
23843
|
-
parsed.port = parseInt(
|
|
23844
|
-
parsed.path =
|
|
23845
|
-
parsed.query =
|
|
23846
|
-
parsed.fragment =
|
|
23838
|
+
const matches2 = uri.match(URI_PARSE);
|
|
23839
|
+
if (matches2) {
|
|
23840
|
+
parsed.scheme = matches2[1];
|
|
23841
|
+
parsed.userinfo = matches2[3];
|
|
23842
|
+
parsed.host = matches2[4];
|
|
23843
|
+
parsed.port = parseInt(matches2[5], 10);
|
|
23844
|
+
parsed.path = matches2[6] || "";
|
|
23845
|
+
parsed.query = matches2[7];
|
|
23846
|
+
parsed.fragment = matches2[8];
|
|
23847
23847
|
if (parsed.scheme !== void 0) {
|
|
23848
23848
|
if (VALID_SCHEME.test(parsed.scheme)) {
|
|
23849
23849
|
parsed.scheme = parsed.scheme.toLowerCase();
|
|
@@ -23852,14 +23852,14 @@ var require_fast_uri = __commonJS({
|
|
|
23852
23852
|
malformedScheme = true;
|
|
23853
23853
|
}
|
|
23854
23854
|
}
|
|
23855
|
-
malformedPercentEncoding = hasMalformedComponentPercentEncoding(
|
|
23855
|
+
malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches2);
|
|
23856
23856
|
if (malformedPercentEncoding) {
|
|
23857
23857
|
parsed.error = parsed.error || "URI contains malformed percent-encoding.";
|
|
23858
23858
|
}
|
|
23859
23859
|
if (isNaN(parsed.port)) {
|
|
23860
|
-
parsed.port =
|
|
23860
|
+
parsed.port = matches2[5];
|
|
23861
23861
|
}
|
|
23862
|
-
const parseError = getParseError(parsed,
|
|
23862
|
+
const parseError = getParseError(parsed, matches2);
|
|
23863
23863
|
if (parseError !== void 0) {
|
|
23864
23864
|
parsed.error = parsed.error || parseError;
|
|
23865
23865
|
malformedAuthorityOrPort = true;
|
|
@@ -26645,7 +26645,7 @@ var require_discriminator = __commonJS({
|
|
|
26645
26645
|
error,
|
|
26646
26646
|
code(cxt) {
|
|
26647
26647
|
const { gen, data, schema, parentSchema, it } = cxt;
|
|
26648
|
-
const { oneOf } = parentSchema;
|
|
26648
|
+
const { oneOf: oneOf2 } = parentSchema;
|
|
26649
26649
|
if (!it.opts.discriminator) {
|
|
26650
26650
|
throw new Error("discriminator: requires discriminator option");
|
|
26651
26651
|
}
|
|
@@ -26654,7 +26654,7 @@ var require_discriminator = __commonJS({
|
|
|
26654
26654
|
throw new Error("discriminator: requires propertyName");
|
|
26655
26655
|
if (schema.mapping)
|
|
26656
26656
|
throw new Error("discriminator: mapping is not supported");
|
|
26657
|
-
if (!
|
|
26657
|
+
if (!oneOf2)
|
|
26658
26658
|
throw new Error("discriminator: requires oneOf keyword");
|
|
26659
26659
|
const valid = gen.let("valid", false);
|
|
26660
26660
|
const tag = gen.const("tag", (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(tagName)}`);
|
|
@@ -26682,8 +26682,8 @@ var require_discriminator = __commonJS({
|
|
|
26682
26682
|
const oneOfMapping = {};
|
|
26683
26683
|
const topRequired = hasRequired(parentSchema);
|
|
26684
26684
|
let tagRequired = true;
|
|
26685
|
-
for (let i = 0; i <
|
|
26686
|
-
let sch =
|
|
26685
|
+
for (let i = 0; i < oneOf2.length; i++) {
|
|
26686
|
+
let sch = oneOf2[i];
|
|
26687
26687
|
if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) {
|
|
26688
26688
|
const ref = sch.$ref;
|
|
26689
26689
|
sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref);
|
|
@@ -30277,7 +30277,7 @@ var require_timestamp = __commonJS({
|
|
|
30277
30277
|
resolve: (str) => parseSexagesimal(str, false),
|
|
30278
30278
|
stringify: stringifySexagesimal
|
|
30279
30279
|
};
|
|
30280
|
-
var
|
|
30280
|
+
var timestamp7 = {
|
|
30281
30281
|
identify: (value) => value instanceof Date,
|
|
30282
30282
|
default: true,
|
|
30283
30283
|
tag: "tag:yaml.org,2002:timestamp",
|
|
@@ -30286,7 +30286,7 @@ var require_timestamp = __commonJS({
|
|
|
30286
30286
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
30287
30287
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
30288
30288
|
resolve(str) {
|
|
30289
|
-
const match = str.match(
|
|
30289
|
+
const match = str.match(timestamp7.test);
|
|
30290
30290
|
if (!match)
|
|
30291
30291
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
30292
30292
|
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
@@ -30305,7 +30305,7 @@ var require_timestamp = __commonJS({
|
|
|
30305
30305
|
};
|
|
30306
30306
|
exports.floatTime = floatTime;
|
|
30307
30307
|
exports.intTime = intTime;
|
|
30308
|
-
exports.timestamp =
|
|
30308
|
+
exports.timestamp = timestamp7;
|
|
30309
30309
|
}
|
|
30310
30310
|
});
|
|
30311
30311
|
|
|
@@ -30325,7 +30325,7 @@ var require_schema4 = __commonJS({
|
|
|
30325
30325
|
var omap = require_omap();
|
|
30326
30326
|
var pairs = require_pairs();
|
|
30327
30327
|
var set = require_set();
|
|
30328
|
-
var
|
|
30328
|
+
var timestamp7 = require_timestamp();
|
|
30329
30329
|
var schema = [
|
|
30330
30330
|
map.map,
|
|
30331
30331
|
seq.seq,
|
|
@@ -30345,9 +30345,9 @@ var require_schema4 = __commonJS({
|
|
|
30345
30345
|
omap.omap,
|
|
30346
30346
|
pairs.pairs,
|
|
30347
30347
|
set.set,
|
|
30348
|
-
|
|
30349
|
-
|
|
30350
|
-
|
|
30348
|
+
timestamp7.intTime,
|
|
30349
|
+
timestamp7.floatTime,
|
|
30350
|
+
timestamp7.timestamp
|
|
30351
30351
|
];
|
|
30352
30352
|
exports.schema = schema;
|
|
30353
30353
|
}
|
|
@@ -30372,7 +30372,7 @@ var require_tags = __commonJS({
|
|
|
30372
30372
|
var pairs = require_pairs();
|
|
30373
30373
|
var schema$2 = require_schema4();
|
|
30374
30374
|
var set = require_set();
|
|
30375
|
-
var
|
|
30375
|
+
var timestamp7 = require_timestamp();
|
|
30376
30376
|
var schemas = /* @__PURE__ */ new Map([
|
|
30377
30377
|
["core", schema.schema],
|
|
30378
30378
|
["failsafe", [map.map, seq.seq, string.string]],
|
|
@@ -30386,11 +30386,11 @@ var require_tags = __commonJS({
|
|
|
30386
30386
|
float: float.float,
|
|
30387
30387
|
floatExp: float.floatExp,
|
|
30388
30388
|
floatNaN: float.floatNaN,
|
|
30389
|
-
floatTime:
|
|
30389
|
+
floatTime: timestamp7.floatTime,
|
|
30390
30390
|
int: int.int,
|
|
30391
30391
|
intHex: int.intHex,
|
|
30392
30392
|
intOct: int.intOct,
|
|
30393
|
-
intTime:
|
|
30393
|
+
intTime: timestamp7.intTime,
|
|
30394
30394
|
map: map.map,
|
|
30395
30395
|
merge: merge.merge,
|
|
30396
30396
|
null: _null.nullTag,
|
|
@@ -30398,7 +30398,7 @@ var require_tags = __commonJS({
|
|
|
30398
30398
|
pairs: pairs.pairs,
|
|
30399
30399
|
seq: seq.seq,
|
|
30400
30400
|
set: set.set,
|
|
30401
|
-
timestamp:
|
|
30401
|
+
timestamp: timestamp7.timestamp
|
|
30402
30402
|
};
|
|
30403
30403
|
var coreKnownTags = {
|
|
30404
30404
|
"tag:yaml.org,2002:binary": binary.binary,
|
|
@@ -30406,7 +30406,7 @@ var require_tags = __commonJS({
|
|
|
30406
30406
|
"tag:yaml.org,2002:omap": omap.omap,
|
|
30407
30407
|
"tag:yaml.org,2002:pairs": pairs.pairs,
|
|
30408
30408
|
"tag:yaml.org,2002:set": set.set,
|
|
30409
|
-
"tag:yaml.org,2002:timestamp":
|
|
30409
|
+
"tag:yaml.org,2002:timestamp": timestamp7.timestamp
|
|
30410
30410
|
};
|
|
30411
30411
|
function getTags(customTags, schemaName, addMergeTag) {
|
|
30412
30412
|
const schemaTags = schemas.get(schemaName);
|
|
@@ -38396,11 +38396,11 @@ function resolvePackageManager(input) {
|
|
|
38396
38396
|
}
|
|
38397
38397
|
function resolveFrameworkConfig(basename2, files) {
|
|
38398
38398
|
const supported = [`${basename2}.js`, `${basename2}.mjs`, `${basename2}.ts`];
|
|
38399
|
-
const
|
|
38400
|
-
if (
|
|
38401
|
-
throw new FrameworkAdmissionError("ambiguous_config",
|
|
38399
|
+
const matches2 = supported.filter((candidate) => files.includes(candidate));
|
|
38400
|
+
if (matches2.length > 1) {
|
|
38401
|
+
throw new FrameworkAdmissionError("ambiguous_config", matches2[0]);
|
|
38402
38402
|
}
|
|
38403
|
-
return
|
|
38403
|
+
return matches2[0] ?? null;
|
|
38404
38404
|
}
|
|
38405
38405
|
var STABLE_VERSION_SOURCE = "(?:0|[1-9][0-9]{0,5})\\.(?:0|[1-9][0-9]{0,5})\\.(?:0|[1-9][0-9]{0,5})";
|
|
38406
38406
|
var VERSION_RANGE = new RegExp(`^([~^])(${STABLE_VERSION_SOURCE})$`, "u");
|
|
@@ -38776,14 +38776,14 @@ function isFrameworkConversionDiagnosticCode(value) {
|
|
|
38776
38776
|
function parseFrameworkConversionDiagnostic(value) {
|
|
38777
38777
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
38778
38778
|
return null;
|
|
38779
|
-
const
|
|
38780
|
-
const code = Object.hasOwn(
|
|
38781
|
-
const path2 = Object.hasOwn(
|
|
38779
|
+
const record7 = value;
|
|
38780
|
+
const code = Object.hasOwn(record7, "code") ? record7["code"] : void 0;
|
|
38781
|
+
const path2 = Object.hasOwn(record7, "path") ? record7["path"] : void 0;
|
|
38782
38782
|
if (!isFrameworkConversionDiagnosticCode(code) || typeof path2 !== "string")
|
|
38783
38783
|
return null;
|
|
38784
38784
|
const definition = DETAIL_DEFINITIONS[code];
|
|
38785
|
-
const fields = Object.entries(definition.fields ?? {}).map(([name, grammar]) => [name, grammar, Object.hasOwn(
|
|
38786
|
-
if (Object.keys(
|
|
38785
|
+
const fields = Object.entries(definition.fields ?? {}).map(([name, grammar]) => [name, grammar, Object.hasOwn(record7, name) ? record7[name] : void 0]);
|
|
38786
|
+
if (Object.keys(record7).length !== fields.length + 2 || pathClassOf(definition, path2) === null || fields.some(([, grammar, field]) => !fieldMatches(grammar, field)))
|
|
38787
38787
|
return null;
|
|
38788
38788
|
return Object.freeze(Object.fromEntries([
|
|
38789
38789
|
["code", code],
|
|
@@ -39301,8 +39301,8 @@ function ulid(value) {
|
|
|
39301
39301
|
if (typeof value !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value))
|
|
39302
39302
|
invalid();
|
|
39303
39303
|
}
|
|
39304
|
-
function commit(value,
|
|
39305
|
-
if (
|
|
39304
|
+
function commit(value, nullable2 = false) {
|
|
39305
|
+
if (nullable2 && value === null)
|
|
39306
39306
|
return;
|
|
39307
39307
|
if (typeof value !== "string" || !/^[a-f0-9]{40}$/u.test(value))
|
|
39308
39308
|
invalid();
|
|
@@ -40055,112 +40055,6 @@ function isSaasCnameTarget(value) {
|
|
|
40055
40055
|
return value === "customers.omh.st" || value === "customers.ohmyho.st";
|
|
40056
40056
|
}
|
|
40057
40057
|
|
|
40058
|
-
// packages/contracts/dist/credit-pricing.js
|
|
40059
|
-
function assertOrganizationCreditUsage(value) {
|
|
40060
|
-
const record6 = (input, keys) => {
|
|
40061
|
-
if (!input || typeof input !== "object" || Array.isArray(input) || Object.keys(input).sort().join() !== keys.split(",").sort().join())
|
|
40062
|
-
throw new TypeError("Invalid usage fields");
|
|
40063
|
-
return input;
|
|
40064
|
-
};
|
|
40065
|
-
const identifier2 = (input) => typeof input === "string" && /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(input);
|
|
40066
|
-
const amount = (input) => typeof input === "string" && /^(0|[1-9][0-9]{0,37})$/u.test(input);
|
|
40067
|
-
const instant2 = (input) => typeof input === "string" && Number.isFinite(Date.parse(input)) && new Date(input).toISOString() === input;
|
|
40068
|
-
const report = record6(value, "organization_id,as_of,unit,period,from,projects,days");
|
|
40069
|
-
if (!identifier2(report["organization_id"]) || !instant2(report["as_of"]) || !instant2(report["from"]) || report["unit"] !== "microcredits" || typeof report["period"] !== "string" || !/^20[0-9]{2}-(0[1-9]|1[0-2])$/u.test(report["period"]) || !Array.isArray(report["projects"]) || report["projects"].length > 1e3 || !Array.isArray(report["days"]) || report["days"].length > 15)
|
|
40070
|
-
throw new TypeError("Invalid usage report");
|
|
40071
|
-
let previous = "";
|
|
40072
|
-
for (const input of report["projects"]) {
|
|
40073
|
-
const project = record6(input, "project_id,used_micros");
|
|
40074
|
-
if (!identifier2(project["project_id"]) || String(project["project_id"]) <= previous || !amount(project["used_micros"]))
|
|
40075
|
-
throw new TypeError("Invalid usage project");
|
|
40076
|
-
previous = String(project["project_id"]);
|
|
40077
|
-
}
|
|
40078
|
-
let previousDay = "";
|
|
40079
|
-
for (const input of report["days"]) {
|
|
40080
|
-
const day = record6(input, "day,projects");
|
|
40081
|
-
if (typeof day["day"] !== "string" || !/^20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/u.test(day["day"]) || day["day"] <= previousDay || !Array.isArray(day["projects"]) || day["projects"].length > 1e3)
|
|
40082
|
-
throw new TypeError("Invalid usage day");
|
|
40083
|
-
previousDay = day["day"];
|
|
40084
|
-
previous = "";
|
|
40085
|
-
for (const projectInput of day["projects"]) {
|
|
40086
|
-
const project = record6(projectInput, "project_id,meters");
|
|
40087
|
-
if (!identifier2(project["project_id"]) || String(project["project_id"]) <= previous || !Array.isArray(project["meters"]) || project["meters"].length > 1e3)
|
|
40088
|
-
throw new TypeError("Invalid usage project");
|
|
40089
|
-
previous = String(project["project_id"]);
|
|
40090
|
-
for (const meterInput of project["meters"]) {
|
|
40091
|
-
const meter = record6(meterInput, "environment_id,meter,unit,rate_card_id,quantity,charged_micros");
|
|
40092
|
-
if (meter["environment_id"] !== null && !identifier2(meter["environment_id"]))
|
|
40093
|
-
throw new TypeError("Invalid usage environment");
|
|
40094
|
-
for (const key of ["meter", "unit", "rate_card_id"])
|
|
40095
|
-
if (typeof meter[key] !== "string" || !/^[A-Za-z0-9_.:/-]{1,128}$/u.test(meter[key]))
|
|
40096
|
-
throw new TypeError("Invalid usage meter");
|
|
40097
|
-
if (typeof meter["quantity"] !== "string" || !/^(0|[1-9][0-9]{0,29})(\.[0-9]{1,12})?$/u.test(meter["quantity"]) || !amount(meter["charged_micros"]))
|
|
40098
|
-
throw new TypeError("Invalid usage amount");
|
|
40099
|
-
}
|
|
40100
|
-
}
|
|
40101
|
-
}
|
|
40102
|
-
}
|
|
40103
|
-
function assertPublishedCreditRateCards(value) {
|
|
40104
|
-
if (!Array.isArray(value) || value.length > 4)
|
|
40105
|
-
throw new TypeError("Invalid published prices");
|
|
40106
|
-
const ids = /* @__PURE__ */ new Set();
|
|
40107
|
-
for (const input of value) {
|
|
40108
|
-
if (!input || typeof input !== "object" || Array.isArray(input) || Object.keys(input).sort().join() !== "currency,effective_from,id,published_at,rates")
|
|
40109
|
-
throw new TypeError("Invalid published price fields");
|
|
40110
|
-
const card = input;
|
|
40111
|
-
if (typeof card["id"] !== "string" || !/^[a-z0-9_.-]{1,128}$/u.test(card["id"]) || ids.has(card["id"]) || card["currency"] !== "USD")
|
|
40112
|
-
throw new TypeError("Invalid price identity");
|
|
40113
|
-
ids.add(card["id"]);
|
|
40114
|
-
for (const key of ["published_at", "effective_from"]) {
|
|
40115
|
-
const date2 = card[key];
|
|
40116
|
-
if (typeof date2 !== "string" || !Number.isFinite(Date.parse(date2)) || new Date(date2).toISOString() !== date2)
|
|
40117
|
-
throw new TypeError("Invalid price dates");
|
|
40118
|
-
}
|
|
40119
|
-
if (String(card["published_at"]) > String(card["effective_from"]) || !Array.isArray(card["rates"]) || card["rates"].length < 1 || card["rates"].length > 32)
|
|
40120
|
-
throw new TypeError("Invalid price publication");
|
|
40121
|
-
const meters = /* @__PURE__ */ new Set();
|
|
40122
|
-
for (const item of card["rates"]) {
|
|
40123
|
-
if (!item || typeof item !== "object" || Array.isArray(item) || Object.keys(item).sort().join() !== "credit_micros,meter,provider_cost_micros,unit,units_per_charge")
|
|
40124
|
-
throw new TypeError("Invalid rate fields");
|
|
40125
|
-
const rate = item;
|
|
40126
|
-
for (const key of ["meter", "unit"])
|
|
40127
|
-
if (typeof rate[key] !== "string" || !/^[a-z0-9_.-]{1,128}$/u.test(String(rate[key])))
|
|
40128
|
-
throw new TypeError("Invalid rate unit");
|
|
40129
|
-
const identity = String(rate["meter"]) + "/" + String(rate["unit"]);
|
|
40130
|
-
if (meters.has(identity))
|
|
40131
|
-
throw new TypeError("Duplicate rate");
|
|
40132
|
-
meters.add(identity);
|
|
40133
|
-
for (const key of ["units_per_charge", "provider_cost_micros", "credit_micros"]) {
|
|
40134
|
-
const amount = rate[key];
|
|
40135
|
-
if (key === "provider_cost_micros" && amount === null && rate["meter"] === "pgcf.memory.active")
|
|
40136
|
-
continue;
|
|
40137
|
-
if (typeof amount !== "string" || !/^(0|[1-9][0-9]{0,18})$/u.test(amount) || BigInt(amount) > 9223372036854775807n || key === "units_per_charge" && amount === "0")
|
|
40138
|
-
throw new TypeError("Invalid rate amount");
|
|
40139
|
-
}
|
|
40140
|
-
}
|
|
40141
|
-
}
|
|
40142
|
-
}
|
|
40143
|
-
function assertOrganizationAccount(value) {
|
|
40144
|
-
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).sort().join(",") !== "as_of,available_micros,monthly_micros,name,next_expiry,one_time_micros,organization_id,paid_until,plan,plan_source,reserved_micros,workos_organization_id")
|
|
40145
|
-
throw new TypeError("Invalid account fields");
|
|
40146
|
-
const v = value;
|
|
40147
|
-
if (typeof v["organization_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(v["organization_id"]) || typeof v["name"] !== "string" || v["name"].length > 128 || typeof v["workos_organization_id"] !== "string" || !/^org_[A-Za-z0-9_]+$/u.test(v["workos_organization_id"]) || v["plan"] !== "paid" && v["plan"] !== "free" || !["free", "stripe", "granted", "manual"].includes(String(v["plan_source"])) || v["plan"] === "free" !== (v["plan_source"] === "free"))
|
|
40148
|
-
throw new TypeError("Invalid account scope");
|
|
40149
|
-
for (const field of ["available_micros", "monthly_micros", "one_time_micros", "reserved_micros"])
|
|
40150
|
-
if (typeof v[field] !== "string" || !/^(0|[1-9][0-9]{0,18})$/u.test(v[field]))
|
|
40151
|
-
throw new TypeError("Invalid account credits");
|
|
40152
|
-
const held = BigInt(String(v["reserved_micros"]));
|
|
40153
|
-
const balance = BigInt(String(v["monthly_micros"])) + BigInt(String(v["one_time_micros"]));
|
|
40154
|
-
if (BigInt(String(v["available_micros"])) !== (balance > held ? balance - held : 0n))
|
|
40155
|
-
throw new TypeError("Account credit buckets do not balance");
|
|
40156
|
-
for (const field of ["as_of", "paid_until", "next_expiry"]) {
|
|
40157
|
-
if (field !== "as_of" && v[field] === null)
|
|
40158
|
-
continue;
|
|
40159
|
-
if (typeof v[field] !== "string" || !Number.isFinite(Date.parse(v[field])) || new Date(v[field]).toISOString() !== v[field])
|
|
40160
|
-
throw new TypeError("Invalid account timestamp");
|
|
40161
|
-
}
|
|
40162
|
-
}
|
|
40163
|
-
|
|
40164
40058
|
// packages/contracts/dist/problem-policy.js
|
|
40165
40059
|
var PROBLEM_POLICY = {
|
|
40166
40060
|
source_generation_conflict: {
|
|
@@ -40301,6 +40195,30 @@ var PROBLEM_POLICY = {
|
|
|
40301
40195
|
action: "List the project's database credentials and revoke one you no longer need, then request access again.",
|
|
40302
40196
|
title: "Database access limit reached"
|
|
40303
40197
|
},
|
|
40198
|
+
database_webhook_limit: {
|
|
40199
|
+
status: 409,
|
|
40200
|
+
retryable: false,
|
|
40201
|
+
action: "List the project's database webhooks for this environment and delete one you no longer need, then create the webhook again.",
|
|
40202
|
+
title: "Database webhook limit reached"
|
|
40203
|
+
},
|
|
40204
|
+
database_schedule_limit: {
|
|
40205
|
+
status: 409,
|
|
40206
|
+
retryable: false,
|
|
40207
|
+
action: "List the project's database schedules for this environment and delete one you no longer need, then set the schedule again.",
|
|
40208
|
+
title: "Database schedule limit reached"
|
|
40209
|
+
},
|
|
40210
|
+
database_schedule_not_runnable: {
|
|
40211
|
+
status: 409,
|
|
40212
|
+
retryable: false,
|
|
40213
|
+
action: "Read the schedule and its runs. Enable a disabled schedule, or wait until the run already queued has finished, then request the run again.",
|
|
40214
|
+
title: "Database schedule cannot run now"
|
|
40215
|
+
},
|
|
40216
|
+
database_webhook_delivery_pending: {
|
|
40217
|
+
status: 409,
|
|
40218
|
+
retryable: false,
|
|
40219
|
+
action: "The platform is still retrying this webhook delivery. Read the delivery in the delivery list; replay it only if it ends dead_lettered or the receiver needs the event again.",
|
|
40220
|
+
title: "Webhook delivery still pending"
|
|
40221
|
+
},
|
|
40304
40222
|
project_notes_conflict: {
|
|
40305
40223
|
status: 409,
|
|
40306
40224
|
retryable: false,
|
|
@@ -40882,19 +40800,12 @@ function parseOrganizationCredits(value) {
|
|
|
40882
40800
|
"available_micros",
|
|
40883
40801
|
"reserved_micros",
|
|
40884
40802
|
"grace_started_at",
|
|
40885
|
-
"grace_expires_at"
|
|
40886
|
-
"active_meters",
|
|
40887
|
-
"rate_cards"
|
|
40803
|
+
"grace_expires_at"
|
|
40888
40804
|
]);
|
|
40889
|
-
try {
|
|
40890
|
-
assertPublishedCreditRateCards(input["rate_cards"]);
|
|
40891
|
-
} catch {
|
|
40892
|
-
throw new ResponseContractError();
|
|
40893
|
-
}
|
|
40894
40805
|
const graceStart = input["grace_started_at"], graceEnd = input["grace_expires_at"];
|
|
40895
40806
|
if (!(graceStart === null && graceEnd === null) && !(isIsoInstant(graceStart) && isIsoInstant(graceEnd) && Date.parse(graceEnd) - Date.parse(graceStart) === 6048e5))
|
|
40896
40807
|
throw new ResponseContractError();
|
|
40897
|
-
if (!isUlid(input["organization_id"]) || input["unit"] !== "microcredits" || !isIsoInstant(input["as_of"])
|
|
40808
|
+
if (!isUlid(input["organization_id"]) || input["unit"] !== "microcredits" || !isIsoInstant(input["as_of"]))
|
|
40898
40809
|
throw new ResponseContractError();
|
|
40899
40810
|
for (const field of ["available_micros", "reserved_micros"]) {
|
|
40900
40811
|
const amount = input[field];
|
|
@@ -41443,8 +41354,8 @@ var isPaidValidationRecord = (value) => {
|
|
|
41443
41354
|
if (typeof value !== "object" || value === null || Array.isArray(value) || Object.keys(value).sort().join(",") !== "content,name,purpose,type") {
|
|
41444
41355
|
return false;
|
|
41445
41356
|
}
|
|
41446
|
-
const
|
|
41447
|
-
return (
|
|
41357
|
+
const record7 = value;
|
|
41358
|
+
return (record7["type"] === "CNAME" || record7["type"] === "TXT") && boundedString(record7["name"], 1, 253) && boundedString(record7["content"], 1, 2048) && ["traffic", "ownership", "ssl", "dcv_delegation"].includes(String(record7["purpose"]));
|
|
41448
41359
|
};
|
|
41449
41360
|
var isHttpsUrlValue = (value) => typeof value === "string" && isHttpsUrl(value);
|
|
41450
41361
|
|
|
@@ -41589,7 +41500,7 @@ async function prepareLocalSourcePublication(input) {
|
|
|
41589
41500
|
request = { ...request, expected_commit_sha: link2.source.last_confirmed_commit_sha };
|
|
41590
41501
|
}
|
|
41591
41502
|
parseManagedSourceRequest("upload", request);
|
|
41592
|
-
const
|
|
41503
|
+
const record7 = {
|
|
41593
41504
|
version: 1,
|
|
41594
41505
|
...scope,
|
|
41595
41506
|
operation_id: null,
|
|
@@ -41598,16 +41509,16 @@ async function prepareLocalSourcePublication(input) {
|
|
|
41598
41509
|
request
|
|
41599
41510
|
};
|
|
41600
41511
|
if (original !== null) {
|
|
41601
|
-
assertSameAttempt(original,
|
|
41512
|
+
assertSameAttempt(original, record7);
|
|
41602
41513
|
} else
|
|
41603
|
-
await writePending(
|
|
41514
|
+
await writePending(record7, true);
|
|
41604
41515
|
return {
|
|
41605
41516
|
request,
|
|
41606
41517
|
accepted: async (operation) => {
|
|
41607
41518
|
const current = await readPending(scope, replay);
|
|
41608
41519
|
if (current === null)
|
|
41609
41520
|
throw new LocalSourcePublicationError("source_publication_missing");
|
|
41610
|
-
assertSameAttempt(current,
|
|
41521
|
+
assertSameAttempt(current, record7);
|
|
41611
41522
|
if (current.operation_id !== null && current.operation_id !== operation.id)
|
|
41612
41523
|
throw new ResponseContractError();
|
|
41613
41524
|
if (!replay)
|
|
@@ -41626,7 +41537,7 @@ async function prepareLocalSourcePublication(input) {
|
|
|
41626
41537
|
const current = await readPending(scope);
|
|
41627
41538
|
if (current === null || current.operation_id !== null)
|
|
41628
41539
|
return;
|
|
41629
|
-
assertSameAttempt(current,
|
|
41540
|
+
assertSameAttempt(current, record7);
|
|
41630
41541
|
} catch (error2) {
|
|
41631
41542
|
if (error2 instanceof LocalSourcePublicationError && (error2.code === "source_publication_scope_mismatch" || error2.code === "source_publication_pending"))
|
|
41632
41543
|
return;
|
|
@@ -41829,12 +41740,12 @@ async function readRecord(path2) {
|
|
|
41829
41740
|
await handle?.close();
|
|
41830
41741
|
}
|
|
41831
41742
|
}
|
|
41832
|
-
async function writePending(
|
|
41833
|
-
const parent = join3(
|
|
41743
|
+
async function writePending(record7, create, completed = false) {
|
|
41744
|
+
const parent = join3(record7.directory, ".ohmyhost");
|
|
41834
41745
|
for (const directory of [
|
|
41835
41746
|
parent,
|
|
41836
|
-
|
|
41837
|
-
join3(
|
|
41747
|
+
record7.metadata_directory,
|
|
41748
|
+
join3(record7.metadata_directory, "publications")
|
|
41838
41749
|
]) {
|
|
41839
41750
|
try {
|
|
41840
41751
|
await fs2.mkdir(directory, { mode: 448 });
|
|
@@ -41845,10 +41756,10 @@ async function writePending(record6, create, completed = false) {
|
|
|
41845
41756
|
await checkedDirectory(directory);
|
|
41846
41757
|
await fs2.chmod(directory, 448);
|
|
41847
41758
|
}
|
|
41848
|
-
const target = completed ? completedPath(
|
|
41759
|
+
const target = completed ? completedPath(record7) : pendingPath(record7);
|
|
41849
41760
|
const temporary = create ? target : `${target}.${randomUUID()}.tmp`;
|
|
41850
41761
|
try {
|
|
41851
|
-
await fs2.writeFile(temporary, `${JSON.stringify(
|
|
41762
|
+
await fs2.writeFile(temporary, `${JSON.stringify(record7)}
|
|
41852
41763
|
`, { mode: 384, flag: "wx" });
|
|
41853
41764
|
if (!create)
|
|
41854
41765
|
await fs2.rename(temporary, target);
|
|
@@ -42468,6 +42379,350 @@ function isUserSecretName(value, action = "set") {
|
|
|
42468
42379
|
return action === "delete" ? !INSTALLED_PLATFORM_KEYS.has(value) : !value.startsWith("OHMYHOST_") && !FIXED_PLATFORM_NAMES.has(value);
|
|
42469
42380
|
}
|
|
42470
42381
|
|
|
42382
|
+
// packages/contracts/dist/database-events.js
|
|
42383
|
+
var DATABASE_WEBHOOK_EVENT_TYPES = [
|
|
42384
|
+
"database.created",
|
|
42385
|
+
"database.ready",
|
|
42386
|
+
"database.woke",
|
|
42387
|
+
"database.slept",
|
|
42388
|
+
"database.suspended",
|
|
42389
|
+
"database.resized",
|
|
42390
|
+
"database.deleted"
|
|
42391
|
+
];
|
|
42392
|
+
var DATABASE_WEBHOOK_MAX_EVENT_TYPES = 16;
|
|
42393
|
+
var DATABASE_WEBHOOK_MAX_HEADERS = 8;
|
|
42394
|
+
var DATABASE_WEBHOOK_URL_MAX_LENGTH = 2048;
|
|
42395
|
+
var DATABASE_SCHEDULE_MIN_EVERY_SECONDS = 60;
|
|
42396
|
+
var DATABASE_SCHEDULE_MAX_EVERY_SECONDS = 31 * 86400;
|
|
42397
|
+
var DATABASE_SCHEDULE_CRON_MIN_LENGTH = 9;
|
|
42398
|
+
var DATABASE_SCHEDULE_CRON_MAX_LENGTH = 120;
|
|
42399
|
+
var DATABASE_SCHEDULE_MAX_STATEMENTS = 20;
|
|
42400
|
+
var DATABASE_SCHEDULE_STATEMENT_MAX_BYTES = 16 * 1024;
|
|
42401
|
+
var DATABASE_SCHEDULE_STATEMENTS_MAX_BYTES = 64 * 1024;
|
|
42402
|
+
var DATABASE_SCHEDULE_MIN_TIMEOUT_MS = 1e3;
|
|
42403
|
+
var DATABASE_SCHEDULE_DEFAULT_TIMEOUT_MS = 1e4;
|
|
42404
|
+
var DATABASE_SCHEDULE_MAX_TIMEOUT_MS = 3e4;
|
|
42405
|
+
var DATABASE_SCHEDULE_OUTCOMES = [
|
|
42406
|
+
"succeeded",
|
|
42407
|
+
"failed",
|
|
42408
|
+
"timed_out",
|
|
42409
|
+
"outcome_unknown",
|
|
42410
|
+
"rejected",
|
|
42411
|
+
"skipped_capacity",
|
|
42412
|
+
"skipped_suspended",
|
|
42413
|
+
"skipped_deleted",
|
|
42414
|
+
"skipped_missed"
|
|
42415
|
+
];
|
|
42416
|
+
var DATABASE_EXECUTION_METRICS = [
|
|
42417
|
+
"schedule_runs_succeeded",
|
|
42418
|
+
"schedule_runs_failed",
|
|
42419
|
+
"schedule_runs_timed_out",
|
|
42420
|
+
"schedule_runs_outcome_unknown",
|
|
42421
|
+
"schedule_runs_rejected",
|
|
42422
|
+
"schedule_runs_skipped",
|
|
42423
|
+
"events_emitted",
|
|
42424
|
+
"event_bytes",
|
|
42425
|
+
"webhook_attempts",
|
|
42426
|
+
"webhook_deliveries_delivered",
|
|
42427
|
+
"webhook_deliveries_dead_lettered"
|
|
42428
|
+
];
|
|
42429
|
+
var DATABASE_PAGE_MAX_ITEMS = 100;
|
|
42430
|
+
var USAGE_HOUR_MS = 36e5;
|
|
42431
|
+
var USAGE_MAX_RANGE_MS = 31 * 24 * USAGE_HOUR_MS;
|
|
42432
|
+
var WEBHOOK_KEYS = ["id", "environment", "url", "event_types", "header_names", "created_at"];
|
|
42433
|
+
var WEBHOOK_ID_PATTERN = /^whk_[a-z0-9]{20}$/u;
|
|
42434
|
+
var DELIVERY_ID_PATTERN = /^dlv_[0-9a-f]{20}$/u;
|
|
42435
|
+
var EVENT_ID_PATTERN = /^evt_[0-9a-f]{20}$/u;
|
|
42436
|
+
var SCHEDULE_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,62}$/u;
|
|
42437
|
+
var CURSOR_PATTERN = /^[A-Za-z0-9._|:=+/-]{1,200}$/u;
|
|
42438
|
+
var HEADER_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9-]{0,63}$/u;
|
|
42439
|
+
var HEADER_VALUE_PATTERN = /^[\x21-\x7e]([\x20-\x7e]*[\x21-\x7e])?$/u;
|
|
42440
|
+
var HEADER_FORBIDDEN_NAMES = [
|
|
42441
|
+
"host",
|
|
42442
|
+
"content-length",
|
|
42443
|
+
"content-type",
|
|
42444
|
+
"connection",
|
|
42445
|
+
"transfer-encoding",
|
|
42446
|
+
"user-agent",
|
|
42447
|
+
"te",
|
|
42448
|
+
"upgrade",
|
|
42449
|
+
"expect"
|
|
42450
|
+
];
|
|
42451
|
+
var HEADER_FORBIDDEN_PREFIXES = ["pgcf-", "cf-", "x-forwarded-"];
|
|
42452
|
+
function parseDatabaseWebhookId(value) {
|
|
42453
|
+
if (!matches(value, WEBHOOK_ID_PATTERN))
|
|
42454
|
+
throw new TypeError("Invalid database webhook id");
|
|
42455
|
+
return value;
|
|
42456
|
+
}
|
|
42457
|
+
function parseDatabaseDeliveryId(value) {
|
|
42458
|
+
if (!matches(value, DELIVERY_ID_PATTERN))
|
|
42459
|
+
throw new TypeError("Invalid database delivery id");
|
|
42460
|
+
return value;
|
|
42461
|
+
}
|
|
42462
|
+
function parseDatabaseScheduleName(value) {
|
|
42463
|
+
if (!matches(value, SCHEDULE_NAME_PATTERN))
|
|
42464
|
+
throw new TypeError("Invalid database schedule name");
|
|
42465
|
+
return value;
|
|
42466
|
+
}
|
|
42467
|
+
function parseDatabaseListLimit(value, max, fallback) {
|
|
42468
|
+
if (value === void 0)
|
|
42469
|
+
return fallback;
|
|
42470
|
+
const limit = typeof value === "string" && /^[1-9][0-9]{0,3}$/u.test(value) ? Number(value) : value;
|
|
42471
|
+
if (typeof limit !== "number" || !Number.isSafeInteger(limit) || limit < 1 || limit > max)
|
|
42472
|
+
throw new TypeError("Invalid database list limit");
|
|
42473
|
+
return limit;
|
|
42474
|
+
}
|
|
42475
|
+
function parseDatabaseCursor(value) {
|
|
42476
|
+
if (value === void 0 || value === null)
|
|
42477
|
+
return null;
|
|
42478
|
+
if (!matches(value, CURSOR_PATTERN))
|
|
42479
|
+
throw new TypeError("Invalid database cursor");
|
|
42480
|
+
return value;
|
|
42481
|
+
}
|
|
42482
|
+
function parseDatabaseUsageWindow(from, to, granularity) {
|
|
42483
|
+
if (!timestamp2(from) || !timestamp2(to) || !oneOf(["hour", "day"], granularity))
|
|
42484
|
+
throw new TypeError("Invalid database usage window");
|
|
42485
|
+
const start = Date.parse(from), end = Date.parse(to), unit = granularity === "hour" ? USAGE_HOUR_MS : 24 * USAGE_HOUR_MS;
|
|
42486
|
+
if (end <= start || end - start > USAGE_MAX_RANGE_MS || start % unit !== 0 || end % unit !== 0)
|
|
42487
|
+
throw new TypeError("Invalid database usage window");
|
|
42488
|
+
return { from, to, granularity };
|
|
42489
|
+
}
|
|
42490
|
+
function parseDatabaseWebhookCreateRequest(value) {
|
|
42491
|
+
if (!record2(value) || !onlyKeys(value, ["url", "event_types", "headers"]))
|
|
42492
|
+
throw new TypeError("Invalid database webhook request");
|
|
42493
|
+
return {
|
|
42494
|
+
url: parseHttpsUrl(value["url"]),
|
|
42495
|
+
event_types: parseEventTypes(value["event_types"]),
|
|
42496
|
+
headers: value["headers"] === void 0 ? {} : parseHeaders(value["headers"])
|
|
42497
|
+
};
|
|
42498
|
+
}
|
|
42499
|
+
function parseDatabaseScheduleSetRequest(value) {
|
|
42500
|
+
if (!record2(value) || !onlyKeys(value, ["cron", "every_seconds", "statements", "timeout_ms", "enabled", "confirm"]) || value["confirm"] !== true || value["cron"] === void 0 === (value["every_seconds"] === void 0))
|
|
42501
|
+
throw new TypeError("Invalid database schedule request");
|
|
42502
|
+
const enabled = value["enabled"] === void 0 ? true : value["enabled"];
|
|
42503
|
+
if (typeof enabled !== "boolean")
|
|
42504
|
+
throw new TypeError("Invalid database schedule request");
|
|
42505
|
+
return {
|
|
42506
|
+
cron: value["cron"] === void 0 ? null : parseCron(value["cron"]),
|
|
42507
|
+
every_seconds: value["every_seconds"] === void 0 ? null : parseEverySeconds(value["every_seconds"]),
|
|
42508
|
+
statements: parseStatements(value["statements"]),
|
|
42509
|
+
timeout_ms: value["timeout_ms"] === void 0 ? DATABASE_SCHEDULE_DEFAULT_TIMEOUT_MS : parseTimeout(value["timeout_ms"]),
|
|
42510
|
+
enabled
|
|
42511
|
+
};
|
|
42512
|
+
}
|
|
42513
|
+
function assertDatabaseWebhook(value) {
|
|
42514
|
+
if (!record2(value) || !exact2(value, WEBHOOK_KEYS))
|
|
42515
|
+
throw new TypeError("Invalid database webhook");
|
|
42516
|
+
assertWebhookFields(value);
|
|
42517
|
+
}
|
|
42518
|
+
function assertDatabaseWebhookCreated(value) {
|
|
42519
|
+
if (!record2(value) || !exact2(value, [...WEBHOOK_KEYS, "secret"]) || typeof value["secret"] !== "string" || value["secret"].length === 0)
|
|
42520
|
+
throw new TypeError("Invalid database webhook");
|
|
42521
|
+
assertWebhookFields(value);
|
|
42522
|
+
}
|
|
42523
|
+
function assertDatabaseWebhookPage(value) {
|
|
42524
|
+
if (!record2(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
|
|
42525
|
+
throw new TypeError("Invalid database webhook page");
|
|
42526
|
+
for (const item of value["items"])
|
|
42527
|
+
assertDatabaseWebhook(item);
|
|
42528
|
+
}
|
|
42529
|
+
function assertDatabaseWebhookDeleted(value) {
|
|
42530
|
+
if (!record2(value) || !exact2(value, ["id", "deleted"]) || !matches(value["id"], WEBHOOK_ID_PATTERN) || value["deleted"] !== true)
|
|
42531
|
+
throw new TypeError("Invalid database webhook deletion");
|
|
42532
|
+
}
|
|
42533
|
+
function assertDatabaseWebhookDelivery(value) {
|
|
42534
|
+
if (!record2(value) || !exact2(value, [
|
|
42535
|
+
"id",
|
|
42536
|
+
"event_id",
|
|
42537
|
+
"event_type",
|
|
42538
|
+
"webhook_id",
|
|
42539
|
+
"state",
|
|
42540
|
+
"attempts",
|
|
42541
|
+
"created_at",
|
|
42542
|
+
"next_attempt_at",
|
|
42543
|
+
"delivered_at",
|
|
42544
|
+
"last_status",
|
|
42545
|
+
"last_error"
|
|
42546
|
+
]) || !matches(value["id"], DELIVERY_ID_PATTERN) || !matches(value["event_id"], EVENT_ID_PATTERN) || !oneOf(DATABASE_WEBHOOK_EVENT_TYPES, value["event_type"]) || !matches(value["webhook_id"], WEBHOOK_ID_PATTERN) || !oneOf(["pending", "delivered", "dead_lettered"], value["state"]) || !nonNegativeInteger(value["attempts"]) || !timestamp2(value["created_at"]) || !nullable(value["next_attempt_at"], timestamp2) || !nullable(value["delivered_at"], timestamp2) || !nullable(value["last_status"], Number.isSafeInteger) || !nullable(value["last_error"], (error) => oneOf(["timeout", "network", "http", "expired", "permanent"], error)))
|
|
42547
|
+
throw new TypeError("Invalid database webhook delivery");
|
|
42548
|
+
}
|
|
42549
|
+
function assertDatabaseWebhookDeliveryPage(value) {
|
|
42550
|
+
if (!record2(value) || !exact2(value, ["items", "next_cursor"]) || !pageItems(value["items"]))
|
|
42551
|
+
throw new TypeError("Invalid database webhook delivery page");
|
|
42552
|
+
for (const item of value["items"])
|
|
42553
|
+
assertDatabaseWebhookDelivery(item);
|
|
42554
|
+
if (!nullable(value["next_cursor"], isCursor))
|
|
42555
|
+
throw new TypeError("Invalid database webhook delivery page");
|
|
42556
|
+
}
|
|
42557
|
+
function assertDatabaseWebhookTest(value) {
|
|
42558
|
+
if (!record2(value) || !exact2(value, ["delivered", "status", "error", "duration_ms"]) || typeof value["delivered"] !== "boolean" || !nullable(value["status"], Number.isSafeInteger) || !nullable(value["error"], (error) => oneOf(["timeout", "network", "http"], error)) || !nonNegativeInteger(value["duration_ms"]))
|
|
42559
|
+
throw new TypeError("Invalid database webhook test result");
|
|
42560
|
+
}
|
|
42561
|
+
function assertDatabaseWebhookReplayAccepted(value) {
|
|
42562
|
+
if (!record2(value) || !exact2(value, ["delivery_id", "state"]) || !matches(value["delivery_id"], DELIVERY_ID_PATTERN) || value["state"] !== "pending")
|
|
42563
|
+
throw new TypeError("Invalid database webhook replay");
|
|
42564
|
+
}
|
|
42565
|
+
function assertDatabaseSchedule(value) {
|
|
42566
|
+
if (!record2(value) || !exact2(value, [
|
|
42567
|
+
"name",
|
|
42568
|
+
"environment",
|
|
42569
|
+
"cron",
|
|
42570
|
+
"every_seconds",
|
|
42571
|
+
"statements",
|
|
42572
|
+
"timeout_ms",
|
|
42573
|
+
"enabled",
|
|
42574
|
+
"next_run_at",
|
|
42575
|
+
"created_at"
|
|
42576
|
+
]) || !matches(value["name"], SCHEDULE_NAME_PATTERN) || !oneOf(["dev", "prod"], value["environment"]) || value["cron"] === null === (value["every_seconds"] === null) || !nullable(value["cron"], isCronText) || !nullable(value["every_seconds"], isEverySeconds) || !Array.isArray(value["statements"]) || value["statements"].length > DATABASE_SCHEDULE_MAX_STATEMENTS || !value["statements"].every((statement) => typeof statement === "string") || !isTimeout(value["timeout_ms"]) || typeof value["enabled"] !== "boolean" || !nullable(value["next_run_at"], timestamp2) || !timestamp2(value["created_at"]))
|
|
42577
|
+
throw new TypeError("Invalid database schedule");
|
|
42578
|
+
}
|
|
42579
|
+
function assertDatabaseSchedulePage(value) {
|
|
42580
|
+
if (!record2(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
|
|
42581
|
+
throw new TypeError("Invalid database schedule page");
|
|
42582
|
+
for (const item of value["items"])
|
|
42583
|
+
assertDatabaseSchedule(item);
|
|
42584
|
+
}
|
|
42585
|
+
function assertDatabaseScheduleDeleted(value) {
|
|
42586
|
+
if (!record2(value) || !exact2(value, ["name", "deleted"]) || !matches(value["name"], SCHEDULE_NAME_PATTERN) || value["deleted"] !== true)
|
|
42587
|
+
throw new TypeError("Invalid database schedule deletion");
|
|
42588
|
+
}
|
|
42589
|
+
function assertDatabaseScheduleRunPage(value) {
|
|
42590
|
+
if (!record2(value) || !exact2(value, ["items"]) || !pageItems(value["items"]))
|
|
42591
|
+
throw new TypeError("Invalid database schedule run page");
|
|
42592
|
+
for (const item of value["items"])
|
|
42593
|
+
assertDatabaseScheduleRun(item);
|
|
42594
|
+
}
|
|
42595
|
+
function assertDatabaseScheduleRunAccepted(value) {
|
|
42596
|
+
if (!record2(value) || !exact2(value, ["schedule", "state"]) || !matches(value["schedule"], SCHEDULE_NAME_PATTERN) || value["state"] !== "queued")
|
|
42597
|
+
throw new TypeError("Invalid database schedule run");
|
|
42598
|
+
}
|
|
42599
|
+
function assertDatabaseExecutionUsagePage(value) {
|
|
42600
|
+
if (!record2(value) || !exact2(value, ["items", "next_cursor"]) || !pageItems(value["items"]))
|
|
42601
|
+
throw new TypeError("Invalid database execution usage page");
|
|
42602
|
+
for (const row of value["items"])
|
|
42603
|
+
assertUsageRow(row);
|
|
42604
|
+
if (!nullable(value["next_cursor"], isCursor))
|
|
42605
|
+
throw new TypeError("Invalid database execution usage page");
|
|
42606
|
+
}
|
|
42607
|
+
function assertDatabaseScheduleRun(value) {
|
|
42608
|
+
if (!record2(value) || !exact2(value, [
|
|
42609
|
+
"id",
|
|
42610
|
+
"schedule",
|
|
42611
|
+
"scheduled_at",
|
|
42612
|
+
"started_at",
|
|
42613
|
+
"finished_at",
|
|
42614
|
+
"outcome",
|
|
42615
|
+
"sqlstate",
|
|
42616
|
+
"attempts",
|
|
42617
|
+
"manual"
|
|
42618
|
+
]) || !nonNegativeInteger(value["id"]) || !matches(value["schedule"], SCHEDULE_NAME_PATTERN) || !timestamp2(value["scheduled_at"]) || !nullable(value["started_at"], timestamp2) || !timestamp2(value["finished_at"]) || !oneOf(DATABASE_SCHEDULE_OUTCOMES, value["outcome"]) || !nullable(value["sqlstate"], (state) => typeof state === "string") || !nonNegativeInteger(value["attempts"]) || typeof value["manual"] !== "boolean")
|
|
42619
|
+
throw new TypeError("Invalid database schedule run");
|
|
42620
|
+
}
|
|
42621
|
+
function assertUsageRow(value) {
|
|
42622
|
+
if (!record2(value) || !exact2(value, ["start", "end", "final", "metrics"]) || !timestamp2(value["start"]) || !timestamp2(value["end"]) || typeof value["final"] !== "boolean" || !record2(value["metrics"]) || !exact2(value["metrics"], DATABASE_EXECUTION_METRICS))
|
|
42623
|
+
throw new TypeError("Invalid database execution usage row");
|
|
42624
|
+
const metrics = value["metrics"];
|
|
42625
|
+
if (!DATABASE_EXECUTION_METRICS.every((metric) => nonNegativeInteger(metrics[metric])))
|
|
42626
|
+
throw new TypeError("Invalid database execution usage row");
|
|
42627
|
+
}
|
|
42628
|
+
function assertWebhookFields(value) {
|
|
42629
|
+
if (!matches(value["id"], WEBHOOK_ID_PATTERN) || !oneOf(["dev", "prod"], value["environment"]) || !isHttpsUrl2(value["url"]) || !Array.isArray(value["event_types"]) || value["event_types"].length < 1 || value["event_types"].length > DATABASE_WEBHOOK_MAX_EVENT_TYPES || !value["event_types"].every((type) => oneOf(DATABASE_WEBHOOK_EVENT_TYPES, type)) || !Array.isArray(value["header_names"]) || value["header_names"].length > DATABASE_WEBHOOK_MAX_HEADERS || !value["header_names"].every((name) => matches(name, HEADER_NAME_PATTERN)) || !timestamp2(value["created_at"]))
|
|
42630
|
+
throw new TypeError("Invalid database webhook");
|
|
42631
|
+
}
|
|
42632
|
+
function parseHttpsUrl(value) {
|
|
42633
|
+
if (!isHttpsUrl2(value))
|
|
42634
|
+
throw new TypeError("Invalid database webhook url");
|
|
42635
|
+
return value;
|
|
42636
|
+
}
|
|
42637
|
+
function isHttpsUrl2(value) {
|
|
42638
|
+
if (typeof value !== "string" || value.length > DATABASE_WEBHOOK_URL_MAX_LENGTH)
|
|
42639
|
+
return false;
|
|
42640
|
+
try {
|
|
42641
|
+
return new URL(value).protocol === "https:";
|
|
42642
|
+
} catch {
|
|
42643
|
+
return false;
|
|
42644
|
+
}
|
|
42645
|
+
}
|
|
42646
|
+
function parseEventTypes(value) {
|
|
42647
|
+
if (!Array.isArray(value) || value.length < 1 || value.length > DATABASE_WEBHOOK_MAX_EVENT_TYPES || !value.every((type) => oneOf(DATABASE_WEBHOOK_EVENT_TYPES, type)) || new Set(value).size !== value.length)
|
|
42648
|
+
throw new TypeError("Invalid database webhook event types");
|
|
42649
|
+
return value;
|
|
42650
|
+
}
|
|
42651
|
+
function parseHeaders(value) {
|
|
42652
|
+
if (!record2(value) || Object.keys(value).length > DATABASE_WEBHOOK_MAX_HEADERS || new Set(Object.keys(value).map((name) => name.toLowerCase())).size !== Object.keys(value).length)
|
|
42653
|
+
throw new TypeError("Invalid database webhook headers");
|
|
42654
|
+
const headers = {};
|
|
42655
|
+
for (const [name, headerValue] of Object.entries(value)) {
|
|
42656
|
+
const lower = name.toLowerCase();
|
|
42657
|
+
if (!HEADER_NAME_PATTERN.test(name) || HEADER_FORBIDDEN_NAMES.includes(lower) || HEADER_FORBIDDEN_PREFIXES.some((prefix) => lower.startsWith(prefix)) || typeof headerValue !== "string" || headerValue.length > 512 || !HEADER_VALUE_PATTERN.test(headerValue))
|
|
42658
|
+
throw new TypeError("Invalid database webhook headers");
|
|
42659
|
+
headers[name] = headerValue;
|
|
42660
|
+
}
|
|
42661
|
+
return headers;
|
|
42662
|
+
}
|
|
42663
|
+
function parseCron(value) {
|
|
42664
|
+
if (!isCronText(value))
|
|
42665
|
+
throw new TypeError("Invalid database schedule cron");
|
|
42666
|
+
return value;
|
|
42667
|
+
}
|
|
42668
|
+
function isCronText(value) {
|
|
42669
|
+
return typeof value === "string" && value.length >= DATABASE_SCHEDULE_CRON_MIN_LENGTH && value.length <= DATABASE_SCHEDULE_CRON_MAX_LENGTH;
|
|
42670
|
+
}
|
|
42671
|
+
function parseEverySeconds(value) {
|
|
42672
|
+
if (!isEverySeconds(value))
|
|
42673
|
+
throw new TypeError("Invalid database schedule interval");
|
|
42674
|
+
return value;
|
|
42675
|
+
}
|
|
42676
|
+
function isEverySeconds(value) {
|
|
42677
|
+
return Number.isSafeInteger(value) && value >= DATABASE_SCHEDULE_MIN_EVERY_SECONDS && value <= DATABASE_SCHEDULE_MAX_EVERY_SECONDS;
|
|
42678
|
+
}
|
|
42679
|
+
function parseTimeout(value) {
|
|
42680
|
+
if (!isTimeout(value))
|
|
42681
|
+
throw new TypeError("Invalid database schedule timeout");
|
|
42682
|
+
return value;
|
|
42683
|
+
}
|
|
42684
|
+
function isTimeout(value) {
|
|
42685
|
+
return Number.isSafeInteger(value) && value >= DATABASE_SCHEDULE_MIN_TIMEOUT_MS && value <= DATABASE_SCHEDULE_MAX_TIMEOUT_MS;
|
|
42686
|
+
}
|
|
42687
|
+
function parseStatements(value) {
|
|
42688
|
+
if (!Array.isArray(value) || value.length < 1 || value.length > DATABASE_SCHEDULE_MAX_STATEMENTS || !value.every((statement) => typeof statement === "string" && statement.trim().length > 0 && !statement.includes("\0") && new TextEncoder().encode(statement).byteLength <= DATABASE_SCHEDULE_STATEMENT_MAX_BYTES) || new TextEncoder().encode(value.join("")).byteLength > DATABASE_SCHEDULE_STATEMENTS_MAX_BYTES)
|
|
42689
|
+
throw new TypeError("Invalid database schedule statements");
|
|
42690
|
+
return value;
|
|
42691
|
+
}
|
|
42692
|
+
function isCursor(value) {
|
|
42693
|
+
return matches(value, CURSOR_PATTERN);
|
|
42694
|
+
}
|
|
42695
|
+
function pageItems(value) {
|
|
42696
|
+
return Array.isArray(value) && value.length <= DATABASE_PAGE_MAX_ITEMS;
|
|
42697
|
+
}
|
|
42698
|
+
function nonNegativeInteger(value) {
|
|
42699
|
+
return Number.isSafeInteger(value) && value >= 0;
|
|
42700
|
+
}
|
|
42701
|
+
function nullable(value, check) {
|
|
42702
|
+
return value === null || check(value);
|
|
42703
|
+
}
|
|
42704
|
+
function matches(value, pattern) {
|
|
42705
|
+
return typeof value === "string" && pattern.test(value);
|
|
42706
|
+
}
|
|
42707
|
+
function oneOf(allowed, value) {
|
|
42708
|
+
return typeof value === "string" && allowed.includes(value);
|
|
42709
|
+
}
|
|
42710
|
+
function timestamp2(value) {
|
|
42711
|
+
if (typeof value !== "string")
|
|
42712
|
+
return false;
|
|
42713
|
+
const time3 = Date.parse(value);
|
|
42714
|
+
return Number.isFinite(time3) && new Date(time3).toISOString() === value;
|
|
42715
|
+
}
|
|
42716
|
+
function record2(value) {
|
|
42717
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
42718
|
+
}
|
|
42719
|
+
function onlyKeys(value, allowed) {
|
|
42720
|
+
return Object.keys(value).every((key) => allowed.includes(key));
|
|
42721
|
+
}
|
|
42722
|
+
function exact2(value, keys) {
|
|
42723
|
+
return Object.keys(value).sort().join(",") === [...keys].sort().join(",");
|
|
42724
|
+
}
|
|
42725
|
+
|
|
42471
42726
|
// packages/contracts/dist/database-sizes.js
|
|
42472
42727
|
var DATABASE_SIZES = Object.freeze([
|
|
42473
42728
|
Object.freeze({
|
|
@@ -42828,6 +43083,38 @@ var recognizedCommandLabel = (argv) => {
|
|
|
42828
43083
|
if (values[1] === "revoke")
|
|
42829
43084
|
return "database access revoke";
|
|
42830
43085
|
}
|
|
43086
|
+
if (value === "database" && values[0] === "webhook") {
|
|
43087
|
+
if (values[1] === "create")
|
|
43088
|
+
return "database webhook create";
|
|
43089
|
+
if (values[1] === "list")
|
|
43090
|
+
return "database webhook list";
|
|
43091
|
+
if (values[1] === "get")
|
|
43092
|
+
return "database webhook get";
|
|
43093
|
+
if (values[1] === "delete")
|
|
43094
|
+
return "database webhook delete";
|
|
43095
|
+
if (values[1] === "test")
|
|
43096
|
+
return "database webhook test";
|
|
43097
|
+
if (values[1] === "deliveries")
|
|
43098
|
+
return "database webhook deliveries";
|
|
43099
|
+
if (values[1] === "replay")
|
|
43100
|
+
return "database webhook replay";
|
|
43101
|
+
}
|
|
43102
|
+
if (value === "database" && values[0] === "schedule") {
|
|
43103
|
+
if (values[1] === "set")
|
|
43104
|
+
return "database schedule set";
|
|
43105
|
+
if (values[1] === "list")
|
|
43106
|
+
return "database schedule list";
|
|
43107
|
+
if (values[1] === "get")
|
|
43108
|
+
return "database schedule get";
|
|
43109
|
+
if (values[1] === "delete")
|
|
43110
|
+
return "database schedule delete";
|
|
43111
|
+
if (values[1] === "runs")
|
|
43112
|
+
return "database schedule runs";
|
|
43113
|
+
if (values[1] === "run")
|
|
43114
|
+
return "database schedule run";
|
|
43115
|
+
}
|
|
43116
|
+
if (value === "database" && values[0] === "executions")
|
|
43117
|
+
return "database executions";
|
|
42831
43118
|
if (value === "database" && values[0] === "psql")
|
|
42832
43119
|
return "database psql";
|
|
42833
43120
|
if (value === "link" || value === "plan" || value === "deploy" || value === "logs")
|
|
@@ -42928,6 +43215,7 @@ var recognizedCommandLabel = (argv) => {
|
|
|
42928
43215
|
}
|
|
42929
43216
|
return "unknown";
|
|
42930
43217
|
};
|
|
43218
|
+
var SCHEDULE_RUNS_MAX_ITEMS = 50;
|
|
42931
43219
|
var parseProductCliCommand = (argv) => {
|
|
42932
43220
|
const values = [...argv];
|
|
42933
43221
|
removeFlag(values, "--json");
|
|
@@ -42935,9 +43223,11 @@ var parseProductCliCommand = (argv) => {
|
|
|
42935
43223
|
if (values.length === 1 && values[0] === "help" || values.length === 0) {
|
|
42936
43224
|
return { kind: "help" };
|
|
42937
43225
|
}
|
|
43226
|
+
if (values[0] === "help")
|
|
43227
|
+
return parseProductCliCommand([...values.slice(1), "--help"]);
|
|
42938
43228
|
if (help) {
|
|
42939
|
-
const topic =
|
|
42940
|
-
if (topic
|
|
43229
|
+
const topic = values.join(" ");
|
|
43230
|
+
if (!/^[a-z][a-z0-9 -]*$/u.test(topic) || topic === "version")
|
|
42941
43231
|
throw new InvalidCommandError();
|
|
42942
43232
|
return { kind: "help", topic };
|
|
42943
43233
|
}
|
|
@@ -43642,6 +43932,251 @@ var parseProductCliCommand = (argv) => {
|
|
|
43642
43932
|
}
|
|
43643
43933
|
throw new InvalidCommandError();
|
|
43644
43934
|
}
|
|
43935
|
+
if (first === "database" && values[0] === "webhook") {
|
|
43936
|
+
values.shift();
|
|
43937
|
+
const subcommand = values.shift();
|
|
43938
|
+
if (subcommand === "create") {
|
|
43939
|
+
if (!yes || wait || follow || revoke || stdin)
|
|
43940
|
+
throw new InvalidCommandError();
|
|
43941
|
+
const options = parseOptionalOptions(values, [
|
|
43942
|
+
"--project",
|
|
43943
|
+
"--environment",
|
|
43944
|
+
"--url",
|
|
43945
|
+
"--event-types",
|
|
43946
|
+
"--headers-file",
|
|
43947
|
+
"--idempotency-key"
|
|
43948
|
+
]);
|
|
43949
|
+
const projectId = options["--project"], environment = options["--environment"], url = options["--url"], eventTypes = options["--event-types"], headersFile = options["--headers-file"], idempotencyKey = options["--idempotency-key"];
|
|
43950
|
+
if (!isValue(projectId) || !isValue(idempotencyKey) || !isValue(url) || !isValue(eventTypes) || headersFile !== void 0 && !isValue(headersFile) || environment !== "dev" && environment !== "prod")
|
|
43951
|
+
throw new InvalidCommandError();
|
|
43952
|
+
const request = contractValue(() => parseDatabaseWebhookCreateRequest({ url, event_types: eventTypes.split(",") }));
|
|
43953
|
+
return {
|
|
43954
|
+
kind: "database-webhook-create",
|
|
43955
|
+
projectId,
|
|
43956
|
+
environment,
|
|
43957
|
+
url: request.url,
|
|
43958
|
+
eventTypes: request.event_types,
|
|
43959
|
+
headersFile: headersFile ?? null,
|
|
43960
|
+
idempotencyKey,
|
|
43961
|
+
yes: true,
|
|
43962
|
+
credentialStore
|
|
43963
|
+
};
|
|
43964
|
+
}
|
|
43965
|
+
if (subcommand === "list") {
|
|
43966
|
+
if (yes || wait || follow || revoke || stdin)
|
|
43967
|
+
throw new InvalidCommandError();
|
|
43968
|
+
const options = parseOptionalOptions(values, ["--project", "--environment"]);
|
|
43969
|
+
const projectId = options["--project"], environment = options["--environment"] ?? "dev";
|
|
43970
|
+
if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
|
|
43971
|
+
throw new InvalidCommandError();
|
|
43972
|
+
return { kind: "database-webhook-list", projectId, environment, credentialStore };
|
|
43973
|
+
}
|
|
43974
|
+
if (subcommand === "get") {
|
|
43975
|
+
if (yes || wait || follow || revoke || stdin)
|
|
43976
|
+
throw new InvalidCommandError();
|
|
43977
|
+
const options = parseOptionalOptions(values, ["--project", "--environment", "--webhook"]);
|
|
43978
|
+
const projectId = options["--project"], environment = options["--environment"] ?? "dev", webhookId = options["--webhook"];
|
|
43979
|
+
if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
|
|
43980
|
+
throw new InvalidCommandError();
|
|
43981
|
+
return {
|
|
43982
|
+
kind: "database-webhook-get",
|
|
43983
|
+
projectId,
|
|
43984
|
+
environment,
|
|
43985
|
+
webhookId: contractValue(() => parseDatabaseWebhookId(webhookId)),
|
|
43986
|
+
credentialStore
|
|
43987
|
+
};
|
|
43988
|
+
}
|
|
43989
|
+
if (subcommand === "delete" || subcommand === "test") {
|
|
43990
|
+
if (!yes || wait || follow || revoke || stdin)
|
|
43991
|
+
throw new InvalidCommandError();
|
|
43992
|
+
const options = parseOptionalOptions(values, ["--project", "--environment", "--webhook"]);
|
|
43993
|
+
const projectId = options["--project"], environment = options["--environment"], webhookId = options["--webhook"];
|
|
43994
|
+
if (!isValue(projectId))
|
|
43995
|
+
throw new InvalidCommandError();
|
|
43996
|
+
if (environment !== "dev" && environment !== "prod")
|
|
43997
|
+
throw new InvalidCommandError();
|
|
43998
|
+
const target = contractValue(() => parseDatabaseWebhookId(webhookId));
|
|
43999
|
+
if (subcommand === "delete")
|
|
44000
|
+
return {
|
|
44001
|
+
kind: "database-webhook-delete",
|
|
44002
|
+
projectId,
|
|
44003
|
+
environment,
|
|
44004
|
+
webhookId: target,
|
|
44005
|
+
yes: true,
|
|
44006
|
+
credentialStore
|
|
44007
|
+
};
|
|
44008
|
+
return {
|
|
44009
|
+
kind: "database-webhook-test",
|
|
44010
|
+
projectId,
|
|
44011
|
+
environment,
|
|
44012
|
+
webhookId: target,
|
|
44013
|
+
yes: true,
|
|
44014
|
+
credentialStore
|
|
44015
|
+
};
|
|
44016
|
+
}
|
|
44017
|
+
if (subcommand === "deliveries") {
|
|
44018
|
+
if (yes || wait || follow || revoke || stdin)
|
|
44019
|
+
throw new InvalidCommandError();
|
|
44020
|
+
const options = parseOptionalOptions(values, [
|
|
44021
|
+
"--project",
|
|
44022
|
+
"--environment",
|
|
44023
|
+
"--webhook",
|
|
44024
|
+
"--limit",
|
|
44025
|
+
"--cursor"
|
|
44026
|
+
]);
|
|
44027
|
+
const projectId = options["--project"], environment = options["--environment"] ?? "dev", webhookId = options["--webhook"], limit = options["--limit"], cursor = options["--cursor"];
|
|
44028
|
+
if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
|
|
44029
|
+
throw new InvalidCommandError();
|
|
44030
|
+
return {
|
|
44031
|
+
kind: "database-webhook-deliveries",
|
|
44032
|
+
projectId,
|
|
44033
|
+
environment,
|
|
44034
|
+
webhookId: webhookId === void 0 ? null : contractValue(() => parseDatabaseWebhookId(webhookId)),
|
|
44035
|
+
limit: limit === void 0 ? null : contractValue(() => parseDatabaseListLimit(limit, DATABASE_PAGE_MAX_ITEMS, DATABASE_PAGE_MAX_ITEMS)),
|
|
44036
|
+
cursor: contractValue(() => parseDatabaseCursor(cursor)),
|
|
44037
|
+
credentialStore
|
|
44038
|
+
};
|
|
44039
|
+
}
|
|
44040
|
+
if (subcommand === "replay") {
|
|
44041
|
+
if (!yes || wait || follow || revoke || stdin)
|
|
44042
|
+
throw new InvalidCommandError();
|
|
44043
|
+
const options = parseOptionalOptions(values, ["--project", "--environment", "--delivery"]);
|
|
44044
|
+
const projectId = options["--project"], environment = options["--environment"], deliveryId = options["--delivery"];
|
|
44045
|
+
if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
|
|
44046
|
+
throw new InvalidCommandError();
|
|
44047
|
+
return {
|
|
44048
|
+
kind: "database-webhook-replay",
|
|
44049
|
+
projectId,
|
|
44050
|
+
environment,
|
|
44051
|
+
deliveryId: contractValue(() => parseDatabaseDeliveryId(deliveryId)),
|
|
44052
|
+
yes: true,
|
|
44053
|
+
credentialStore
|
|
44054
|
+
};
|
|
44055
|
+
}
|
|
44056
|
+
throw new InvalidCommandError();
|
|
44057
|
+
}
|
|
44058
|
+
if (first === "database" && values[0] === "schedule") {
|
|
44059
|
+
values.shift();
|
|
44060
|
+
const subcommand = values.shift();
|
|
44061
|
+
if (subcommand === "set") {
|
|
44062
|
+
if (!yes || wait || follow || revoke || stdin)
|
|
44063
|
+
throw new InvalidCommandError();
|
|
44064
|
+
const options = parseOptionalOptions(values, [
|
|
44065
|
+
"--project",
|
|
44066
|
+
"--environment",
|
|
44067
|
+
"--name",
|
|
44068
|
+
"--cron",
|
|
44069
|
+
"--every-seconds",
|
|
44070
|
+
"--statements-file",
|
|
44071
|
+
"--timeout-ms",
|
|
44072
|
+
"--enabled"
|
|
44073
|
+
]);
|
|
44074
|
+
const projectId = options["--project"], environment = options["--environment"], name = options["--name"], cron = options["--cron"], everySeconds = options["--every-seconds"], statementsFile = options["--statements-file"], timeoutMs = options["--timeout-ms"], enabled = options["--enabled"];
|
|
44075
|
+
if (!isValue(projectId) || !isValue(statementsFile) || environment !== "dev" && environment !== "prod" || cron === void 0 === (everySeconds === void 0) || everySeconds !== void 0 && !/^[0-9]{1,9}$/u.test(everySeconds) || timeoutMs !== void 0 && !/^[0-9]{1,6}$/u.test(timeoutMs) || enabled !== void 0 && enabled !== "true" && enabled !== "false")
|
|
44076
|
+
throw new InvalidCommandError();
|
|
44077
|
+
return {
|
|
44078
|
+
kind: "database-schedule-set",
|
|
44079
|
+
projectId,
|
|
44080
|
+
environment,
|
|
44081
|
+
name: contractValue(() => parseDatabaseScheduleName(name)),
|
|
44082
|
+
cron: cron ?? null,
|
|
44083
|
+
everySeconds: everySeconds === void 0 ? null : Number(everySeconds),
|
|
44084
|
+
statementsFile,
|
|
44085
|
+
timeoutMs: timeoutMs === void 0 ? null : Number(timeoutMs),
|
|
44086
|
+
enabled: enabled === void 0 ? null : enabled === "true",
|
|
44087
|
+
yes: true,
|
|
44088
|
+
credentialStore
|
|
44089
|
+
};
|
|
44090
|
+
}
|
|
44091
|
+
if (subcommand === "list") {
|
|
44092
|
+
if (yes || wait || follow || revoke || stdin)
|
|
44093
|
+
throw new InvalidCommandError();
|
|
44094
|
+
const options = parseOptionalOptions(values, ["--project", "--environment"]);
|
|
44095
|
+
const projectId = options["--project"], environment = options["--environment"] ?? "dev";
|
|
44096
|
+
if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
|
|
44097
|
+
throw new InvalidCommandError();
|
|
44098
|
+
return { kind: "database-schedule-list", projectId, environment, credentialStore };
|
|
44099
|
+
}
|
|
44100
|
+
if (subcommand === "get" || subcommand === "runs") {
|
|
44101
|
+
if (yes || wait || follow || revoke || stdin)
|
|
44102
|
+
throw new InvalidCommandError();
|
|
44103
|
+
const options = parseOptionalOptions(values, subcommand === "get" ? ["--project", "--environment", "--name"] : ["--project", "--environment", "--name", "--limit"]);
|
|
44104
|
+
const projectId = options["--project"], environment = options["--environment"] ?? "dev", name = options["--name"], limit = options["--limit"];
|
|
44105
|
+
if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
|
|
44106
|
+
throw new InvalidCommandError();
|
|
44107
|
+
const scheduleName = contractValue(() => parseDatabaseScheduleName(name));
|
|
44108
|
+
if (subcommand === "get")
|
|
44109
|
+
return {
|
|
44110
|
+
kind: "database-schedule-get",
|
|
44111
|
+
projectId,
|
|
44112
|
+
environment,
|
|
44113
|
+
name: scheduleName,
|
|
44114
|
+
credentialStore
|
|
44115
|
+
};
|
|
44116
|
+
return {
|
|
44117
|
+
kind: "database-schedule-runs",
|
|
44118
|
+
projectId,
|
|
44119
|
+
environment,
|
|
44120
|
+
name: scheduleName,
|
|
44121
|
+
limit: limit === void 0 ? null : contractValue(() => parseDatabaseListLimit(limit, SCHEDULE_RUNS_MAX_ITEMS, SCHEDULE_RUNS_MAX_ITEMS)),
|
|
44122
|
+
credentialStore
|
|
44123
|
+
};
|
|
44124
|
+
}
|
|
44125
|
+
if (subcommand === "delete" || subcommand === "run") {
|
|
44126
|
+
if (!yes || wait || follow || revoke || stdin)
|
|
44127
|
+
throw new InvalidCommandError();
|
|
44128
|
+
const options = parseOptionalOptions(values, ["--project", "--environment", "--name"]);
|
|
44129
|
+
const projectId = options["--project"], environment = options["--environment"];
|
|
44130
|
+
if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
|
|
44131
|
+
throw new InvalidCommandError();
|
|
44132
|
+
const name = contractValue(() => parseDatabaseScheduleName(options["--name"]));
|
|
44133
|
+
return subcommand === "delete" ? {
|
|
44134
|
+
kind: "database-schedule-delete",
|
|
44135
|
+
projectId,
|
|
44136
|
+
environment,
|
|
44137
|
+
name,
|
|
44138
|
+
yes: true,
|
|
44139
|
+
credentialStore
|
|
44140
|
+
} : {
|
|
44141
|
+
kind: "database-schedule-run",
|
|
44142
|
+
projectId,
|
|
44143
|
+
environment,
|
|
44144
|
+
name,
|
|
44145
|
+
yes: true,
|
|
44146
|
+
credentialStore
|
|
44147
|
+
};
|
|
44148
|
+
}
|
|
44149
|
+
throw new InvalidCommandError();
|
|
44150
|
+
}
|
|
44151
|
+
if (first === "database" && values[0] === "executions") {
|
|
44152
|
+
values.shift();
|
|
44153
|
+
if (yes || wait || follow || revoke || stdin)
|
|
44154
|
+
throw new InvalidCommandError();
|
|
44155
|
+
const options = parseOptionalOptions(values, [
|
|
44156
|
+
"--project",
|
|
44157
|
+
"--environment",
|
|
44158
|
+
"--from",
|
|
44159
|
+
"--to",
|
|
44160
|
+
"--granularity",
|
|
44161
|
+
"--limit",
|
|
44162
|
+
"--cursor"
|
|
44163
|
+
]);
|
|
44164
|
+
const projectId = options["--project"], environment = options["--environment"] ?? "dev", from = options["--from"], to = options["--to"], granularity = options["--granularity"], limit = options["--limit"], cursor = options["--cursor"];
|
|
44165
|
+
if (!isValue(projectId) || environment !== "dev" && environment !== "prod" || !isValue(from) || !isValue(to) || granularity !== "hour" && granularity !== "day")
|
|
44166
|
+
throw new InvalidCommandError();
|
|
44167
|
+
const window = contractValue(() => parseDatabaseUsageWindow(from, to, granularity));
|
|
44168
|
+
return {
|
|
44169
|
+
kind: "database-executions",
|
|
44170
|
+
projectId,
|
|
44171
|
+
environment,
|
|
44172
|
+
from: window.from,
|
|
44173
|
+
to: window.to,
|
|
44174
|
+
granularity: window.granularity,
|
|
44175
|
+
limit: limit === void 0 ? null : contractValue(() => parseDatabaseListLimit(limit, DATABASE_PAGE_MAX_ITEMS, DATABASE_PAGE_MAX_ITEMS)),
|
|
44176
|
+
cursor: contractValue(() => parseDatabaseCursor(cursor)),
|
|
44177
|
+
credentialStore
|
|
44178
|
+
};
|
|
44179
|
+
}
|
|
43645
44180
|
if (first === "database" && values[0] === "psql") {
|
|
43646
44181
|
values.shift();
|
|
43647
44182
|
if (yes || wait || follow || revoke || stdin)
|
|
@@ -44262,6 +44797,13 @@ var handedAccount = (userId, organizationId) => {
|
|
|
44262
44797
|
return { userId, organizationId };
|
|
44263
44798
|
};
|
|
44264
44799
|
var isValue = (value) => value !== void 0 && value.length > 0 && !value.startsWith("--");
|
|
44800
|
+
var contractValue = (parse) => {
|
|
44801
|
+
try {
|
|
44802
|
+
return parse();
|
|
44803
|
+
} catch {
|
|
44804
|
+
throw new InvalidCommandError();
|
|
44805
|
+
}
|
|
44806
|
+
};
|
|
44265
44807
|
var validGithubBranchName = (value) => !(value.length < 1 || value.length > 1024 || !/^[A-Za-z0-9]/u.test(value) || value.startsWith("-") || value.startsWith("/") || value.endsWith("/") || value.endsWith(".") || value.includes("//") || value.includes("..") || value.includes("@{") || [...value].some((character) => {
|
|
44266
44808
|
const code = character.codePointAt(0) ?? 0;
|
|
44267
44809
|
return code <= 32 || code === 127 || "\\~^:?*[]".includes(character);
|
|
@@ -44536,7 +45078,7 @@ import { join as join5, resolve as resolve4 } from "node:path";
|
|
|
44536
45078
|
|
|
44537
45079
|
// packages/contracts/dist/database-access.js
|
|
44538
45080
|
function parseProjectDatabaseWrite(value) {
|
|
44539
|
-
if (!
|
|
45081
|
+
if (!record3(value) || !exact3(value, ["environment", "statement", "parameters"]) || !["dev", "prod"].includes(String(value["environment"])) || typeof value["statement"] !== "string" || !/^\s*(?:insert|update|delete)\b/iu.test(value["statement"]) || new TextEncoder().encode(value["statement"]).byteLength > 65536 || value["statement"].includes("\0") || !Array.isArray(value["parameters"]) || value["parameters"].length > 100)
|
|
44540
45082
|
throw new TypeError("Invalid database write");
|
|
44541
45083
|
const budget = { nodes: 0 };
|
|
44542
45084
|
for (const parameter of value["parameters"])
|
|
@@ -44550,7 +45092,7 @@ function parseProjectDatabaseWrite(value) {
|
|
|
44550
45092
|
};
|
|
44551
45093
|
}
|
|
44552
45094
|
function assertProjectDatabaseWriteReceipt(value) {
|
|
44553
|
-
if (!
|
|
45095
|
+
if (!record3(value) || !exact3(value, ["operation_id", "environment", "state", "command", "affected_rows", "error"]) || typeof value["operation_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value["operation_id"]) || !["dev", "prod"].includes(String(value["environment"])) || !["running", "succeeded", "failed"].includes(String(value["state"])))
|
|
44554
45096
|
throw new TypeError("Invalid database write receipt");
|
|
44555
45097
|
if (value["state"] === "succeeded") {
|
|
44556
45098
|
if (!["INSERT", "UPDATE", "DELETE"].includes(String(value["command"])) || !Number.isSafeInteger(value["affected_rows"]) || Number(value["affected_rows"]) < 0 || Number(value["affected_rows"]) > 1e3 || value["error"] !== null)
|
|
@@ -44563,7 +45105,7 @@ function assertProjectDatabaseWriteReceipt(value) {
|
|
|
44563
45105
|
throw new TypeError("Invalid database write result");
|
|
44564
45106
|
} else {
|
|
44565
45107
|
const error = value["error"];
|
|
44566
|
-
if (!
|
|
45108
|
+
if (!record3(error) || typeof error["code"] !== "string" || !error["code"].startsWith("database_write_") || JSON.stringify(error) !== JSON.stringify(publicOperationFailure(error["code"])))
|
|
44567
45109
|
throw new TypeError("Invalid database write error");
|
|
44568
45110
|
}
|
|
44569
45111
|
}
|
|
@@ -44574,6 +45116,9 @@ var ACCESS_KEYS = [
|
|
|
44574
45116
|
"mode",
|
|
44575
45117
|
"role_name",
|
|
44576
45118
|
"host",
|
|
45119
|
+
"provider",
|
|
45120
|
+
"transport",
|
|
45121
|
+
"websocket_url",
|
|
44577
45122
|
"database",
|
|
44578
45123
|
"label",
|
|
44579
45124
|
"state",
|
|
@@ -44584,16 +45129,16 @@ var ACCESS_KEYS = [
|
|
|
44584
45129
|
];
|
|
44585
45130
|
var ACCESS_ROLE_PATTERN = /^ohmyho_da_[0-7][0-9a-hjkmnp-tv-z]{25}_[0-9a-z]{8}$/u;
|
|
44586
45131
|
function assertProjectDatabaseAccess(value) {
|
|
44587
|
-
if (!
|
|
45132
|
+
if (!record3(value) || !exact3(value, ACCESS_KEYS))
|
|
44588
45133
|
throw new TypeError("Invalid database access");
|
|
44589
45134
|
assertAccessFields(value);
|
|
44590
45135
|
}
|
|
44591
45136
|
function assertProjectDatabaseAccessCredential(value) {
|
|
44592
|
-
if (!
|
|
45137
|
+
if (!record3(value) || !exact3(value, [...ACCESS_KEYS, "connection_uri", "psql_command"]))
|
|
44593
45138
|
throw new TypeError("Invalid database access credential");
|
|
44594
45139
|
assertAccessFields(value);
|
|
44595
45140
|
const uri = value["connection_uri"];
|
|
44596
|
-
if (typeof uri !== "string" ||
|
|
45141
|
+
if (typeof uri !== "string" || typeof value["psql_command"] !== "string" || !new RegExp(`^ohmyhost database psql --project [0-7][0-9A-HJKMNP-TV-Z]{25} --environment ${value["environment"]} --mode ${value["mode"]}$`, "u").test(value["psql_command"]))
|
|
44597
45142
|
throw new TypeError("Invalid database access credential");
|
|
44598
45143
|
let parsed;
|
|
44599
45144
|
try {
|
|
@@ -44601,21 +45146,18 @@ function assertProjectDatabaseAccessCredential(value) {
|
|
|
44601
45146
|
} catch {
|
|
44602
45147
|
throw new TypeError("Invalid database access credential");
|
|
44603
45148
|
}
|
|
44604
|
-
if (
|
|
45149
|
+
if (!["postgres:", "postgresql:"].includes(parsed.protocol) || decodeURIComponent(parsed.username) !== value["role_name"] || parsed.password === "" || parsed.hostname !== value["host"] || parsed.port !== "" && parsed.port !== "5432" || decodeURIComponent(parsed.pathname.slice(1)) !== value["database"] || parsed.hash !== "" || !["", "?sslmode=require", "?sslmode=verify-full"].includes(parsed.search))
|
|
44605
45150
|
throw new TypeError("Invalid database access credential");
|
|
44606
45151
|
}
|
|
44607
45152
|
function assertProjectDatabaseAccessPage(value) {
|
|
44608
|
-
if (!
|
|
45153
|
+
if (!record3(value) || !exact3(value, ["items"]) || !Array.isArray(value["items"]) || value["items"].length > 50)
|
|
44609
45154
|
throw new TypeError("Invalid database access page");
|
|
44610
45155
|
for (const item of value["items"])
|
|
44611
45156
|
assertProjectDatabaseAccess(item);
|
|
44612
45157
|
}
|
|
44613
|
-
function accessKeys(value) {
|
|
44614
|
-
return value["provider"] === "pgcf" ? [...ACCESS_KEYS, "provider", "transport", "websocket_url"] : ACCESS_KEYS;
|
|
44615
|
-
}
|
|
44616
45158
|
function assertAccessFields(value) {
|
|
44617
45159
|
const revoked = value["revoked_at"], reason = value["revocation_reason"];
|
|
44618
|
-
if (typeof value["access_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value["access_id"]) || !["dev", "prod"].includes(String(value["environment"])) || !["read", "write"].includes(String(value["mode"])) || typeof value["role_name"] !== "string" || !ACCESS_ROLE_PATTERN.test(value["role_name"]) || typeof value["host"] !== "string" || !/^[a-z0-9]([a-z0-9.-]{0,251}[a-z0-9])?$/u.test(value["host"]) ||
|
|
45160
|
+
if (typeof value["access_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value["access_id"]) || !["dev", "prod"].includes(String(value["environment"])) || !["read", "write"].includes(String(value["mode"])) || typeof value["role_name"] !== "string" || !ACCESS_ROLE_PATTERN.test(value["role_name"]) || typeof value["host"] !== "string" || !/^[a-z0-9]([a-z0-9.-]{0,251}[a-z0-9])?$/u.test(value["host"]) || value["provider"] !== "pgcf" || value["transport"] !== "wss" || value["websocket_url"] !== `wss://${value["host"]}/` || typeof value["database"] !== "string" || !/^[a-z][a-z0-9]{19}$/u.test(value["database"]) || value["label"] !== null && accessLabel(value["label"]) !== value["label"] || !["active", "expired", "revoked"].includes(String(value["state"])) || !timestamp3(value["issued_at"]) || !timestamp3(value["expires_at"]) || Date.parse(String(value["expires_at"])) <= Date.parse(String(value["issued_at"])) || revoked !== null && !timestamp3(revoked) || revoked === null !== (reason === null) || reason !== null && !["principal", "expired", "budget", "creation_failed", "data_change"].includes(String(reason)) || value["state"] === "revoked" !== (revoked !== null))
|
|
44619
45161
|
throw new TypeError("Invalid database access");
|
|
44620
45162
|
}
|
|
44621
45163
|
function accessLabel(value) {
|
|
@@ -44628,7 +45170,7 @@ function accessLabel(value) {
|
|
|
44628
45170
|
throw new TypeError("Invalid database access label");
|
|
44629
45171
|
return label;
|
|
44630
45172
|
}
|
|
44631
|
-
function
|
|
45173
|
+
function timestamp3(value) {
|
|
44632
45174
|
return typeof value === "string" && new Date(value).toISOString() === value;
|
|
44633
45175
|
}
|
|
44634
45176
|
function json(value, depth, budget) {
|
|
@@ -44643,32 +45185,98 @@ function json(value, depth, budget) {
|
|
|
44643
45185
|
json(entry, depth + 1, budget);
|
|
44644
45186
|
return;
|
|
44645
45187
|
}
|
|
44646
|
-
if (
|
|
45188
|
+
if (record3(value)) {
|
|
44647
45189
|
for (const entry of Object.values(value))
|
|
44648
45190
|
json(entry, depth + 1, budget);
|
|
44649
45191
|
return;
|
|
44650
45192
|
}
|
|
44651
45193
|
throw new TypeError("Invalid database parameter");
|
|
44652
45194
|
}
|
|
44653
|
-
function
|
|
45195
|
+
function record3(value) {
|
|
44654
45196
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
44655
45197
|
}
|
|
44656
|
-
function
|
|
45198
|
+
function exact3(value, keys) {
|
|
44657
45199
|
return Object.keys(value).sort().join(",") === [...keys].sort().join(",");
|
|
44658
45200
|
}
|
|
44659
45201
|
|
|
45202
|
+
// packages/contracts/dist/credit-pricing.js
|
|
45203
|
+
function assertOrganizationCreditUsage(value) {
|
|
45204
|
+
const record7 = (input, keys) => {
|
|
45205
|
+
if (!input || typeof input !== "object" || Array.isArray(input) || Object.keys(input).sort().join() !== keys.split(",").sort().join())
|
|
45206
|
+
throw new TypeError("Invalid usage fields");
|
|
45207
|
+
return input;
|
|
45208
|
+
};
|
|
45209
|
+
const identifier2 = (input) => typeof input === "string" && /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(input);
|
|
45210
|
+
const amount = (input) => typeof input === "string" && /^(0|[1-9][0-9]{0,37})$/u.test(input);
|
|
45211
|
+
const instant2 = (input) => typeof input === "string" && Number.isFinite(Date.parse(input)) && new Date(input).toISOString() === input;
|
|
45212
|
+
const report = record7(value, "organization_id,as_of,unit,period,from,projects,days");
|
|
45213
|
+
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)
|
|
45214
|
+
throw new TypeError("Invalid usage report");
|
|
45215
|
+
let previous = "";
|
|
45216
|
+
for (const input of report["projects"]) {
|
|
45217
|
+
const project = record7(input, "project_id,used_micros");
|
|
45218
|
+
if (!identifier2(project["project_id"]) || String(project["project_id"]) <= previous || !amount(project["used_micros"]))
|
|
45219
|
+
throw new TypeError("Invalid usage project");
|
|
45220
|
+
previous = String(project["project_id"]);
|
|
45221
|
+
}
|
|
45222
|
+
let previousDay = "";
|
|
45223
|
+
for (const input of report["days"]) {
|
|
45224
|
+
const day = record7(input, "day,projects");
|
|
45225
|
+
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)
|
|
45226
|
+
throw new TypeError("Invalid usage day");
|
|
45227
|
+
previousDay = day["day"];
|
|
45228
|
+
previous = "";
|
|
45229
|
+
for (const projectInput of day["projects"]) {
|
|
45230
|
+
const project = record7(projectInput, "project_id,meters");
|
|
45231
|
+
if (!identifier2(project["project_id"]) || String(project["project_id"]) <= previous || !Array.isArray(project["meters"]) || project["meters"].length > 1e3)
|
|
45232
|
+
throw new TypeError("Invalid usage project");
|
|
45233
|
+
previous = String(project["project_id"]);
|
|
45234
|
+
for (const meterInput of project["meters"]) {
|
|
45235
|
+
const meter = record7(meterInput, "environment_id,meter,unit,rate_card_id,quantity,charged_micros");
|
|
45236
|
+
if (meter["environment_id"] !== null && !identifier2(meter["environment_id"]))
|
|
45237
|
+
throw new TypeError("Invalid usage environment");
|
|
45238
|
+
for (const key of ["meter", "unit", "rate_card_id"])
|
|
45239
|
+
if (typeof meter[key] !== "string" || !/^[A-Za-z0-9_.:/-]{1,128}$/u.test(meter[key]))
|
|
45240
|
+
throw new TypeError("Invalid usage meter");
|
|
45241
|
+
if (typeof meter["quantity"] !== "string" || !/^(0|[1-9][0-9]{0,29})(\.[0-9]{1,12})?$/u.test(meter["quantity"]) || !amount(meter["charged_micros"]))
|
|
45242
|
+
throw new TypeError("Invalid usage amount");
|
|
45243
|
+
}
|
|
45244
|
+
}
|
|
45245
|
+
}
|
|
45246
|
+
}
|
|
45247
|
+
function assertOrganizationAccount(value) {
|
|
45248
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).sort().join(",") !== "as_of,available_micros,monthly_micros,name,next_expiry,one_time_micros,organization_id,paid_until,plan,plan_source,reserved_micros,workos_organization_id")
|
|
45249
|
+
throw new TypeError("Invalid account fields");
|
|
45250
|
+
const v = value;
|
|
45251
|
+
if (typeof v["organization_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(v["organization_id"]) || typeof v["name"] !== "string" || v["name"].length > 128 || typeof v["workos_organization_id"] !== "string" || !/^org_[A-Za-z0-9_]+$/u.test(v["workos_organization_id"]) || v["plan"] !== "paid" && v["plan"] !== "free" || !["free", "stripe", "granted", "manual"].includes(String(v["plan_source"])) || v["plan"] === "free" !== (v["plan_source"] === "free"))
|
|
45252
|
+
throw new TypeError("Invalid account scope");
|
|
45253
|
+
for (const field of ["available_micros", "monthly_micros", "one_time_micros", "reserved_micros"])
|
|
45254
|
+
if (typeof v[field] !== "string" || !/^(0|[1-9][0-9]{0,18})$/u.test(v[field]))
|
|
45255
|
+
throw new TypeError("Invalid account credits");
|
|
45256
|
+
const held = BigInt(String(v["reserved_micros"]));
|
|
45257
|
+
const balance = BigInt(String(v["monthly_micros"])) + BigInt(String(v["one_time_micros"]));
|
|
45258
|
+
if (BigInt(String(v["available_micros"])) !== (balance > held ? balance - held : 0n))
|
|
45259
|
+
throw new TypeError("Account credit buckets do not balance");
|
|
45260
|
+
for (const field of ["as_of", "paid_until", "next_expiry"]) {
|
|
45261
|
+
if (field !== "as_of" && v[field] === null)
|
|
45262
|
+
continue;
|
|
45263
|
+
if (typeof v[field] !== "string" || !Number.isFinite(Date.parse(v[field])) || new Date(v[field]).toISOString() !== v[field])
|
|
45264
|
+
throw new TypeError("Invalid account timestamp");
|
|
45265
|
+
}
|
|
45266
|
+
}
|
|
45267
|
+
|
|
44660
45268
|
// packages/contracts/dist/database-compute.js
|
|
44661
45269
|
function assertDatabaseCompute(value) {
|
|
44662
|
-
if (!
|
|
45270
|
+
if (!record4(value) || !exact4(value, ["data_mode", "database", "environment", "observed_at", "project_id"]) || typeof value["project_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value["project_id"]) || !["dev", "prod"].includes(String(value["environment"])) || !["shared", "isolated"].includes(String(value["data_mode"])) || typeof value["observed_at"] !== "string" || !Number.isFinite(Date.parse(value["observed_at"])) || new Date(value["observed_at"]).toISOString() !== value["observed_at"])
|
|
44663
45271
|
throw new TypeError("Invalid database compute report");
|
|
44664
45272
|
const db = value["database"];
|
|
44665
45273
|
if (db === null)
|
|
44666
45274
|
return;
|
|
44667
|
-
if (
|
|
45275
|
+
if (record4(db) && db["provider"] === "pgcf") {
|
|
44668
45276
|
assertPgcfCompute(db);
|
|
44669
45277
|
return;
|
|
44670
45278
|
}
|
|
44671
|
-
if (!
|
|
45279
|
+
if (!record4(db) || !exact4(db, [
|
|
44672
45280
|
"disabled",
|
|
44673
45281
|
"max_cu",
|
|
44674
45282
|
"max_memory_gb",
|
|
@@ -44684,7 +45292,7 @@ function assertDatabaseCompute(value) {
|
|
|
44684
45292
|
function assertPgcfCompute(db) {
|
|
44685
45293
|
const size = databaseSizeForClass(db["size_class_id"]);
|
|
44686
45294
|
const states = ["provisioning", "cold", "warm", "suspended", "error"];
|
|
44687
|
-
if (!
|
|
45295
|
+
if (!exact4(db, [
|
|
44688
45296
|
"cpu_millicores",
|
|
44689
45297
|
"disabled",
|
|
44690
45298
|
"max_connections",
|
|
@@ -44699,17 +45307,17 @@ function assertPgcfCompute(db) {
|
|
|
44699
45307
|
]) || db["memory_mib"] !== size.memoryMiB || db["cpu_millicores"] !== size.cpuMillicores || db["storage_mib"] !== size.storageMiB || db["max_connections"] !== size.maxConnections || !Number.isSafeInteger(db["suspend_timeout_seconds"]) || Number(db["suspend_timeout_seconds"]) < 60 || Number(db["suspend_timeout_seconds"]) > 900 || !states.includes(String(db["state"])) || db["pending_state"] !== null && !states.includes(String(db["pending_state"])) || typeof db["disabled"] !== "boolean" || !["us", "eu"].includes(String(db["region"])))
|
|
44700
45308
|
throw new TypeError("Invalid fixed database compute configuration");
|
|
44701
45309
|
}
|
|
44702
|
-
function
|
|
45310
|
+
function record4(v) {
|
|
44703
45311
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
44704
45312
|
}
|
|
44705
|
-
function
|
|
45313
|
+
function exact4(v, keys) {
|
|
44706
45314
|
return Object.keys(v).sort().join(",") === keys.join(",");
|
|
44707
45315
|
}
|
|
44708
45316
|
|
|
44709
45317
|
// apps/product-cli/package.json
|
|
44710
45318
|
var package_default = {
|
|
44711
45319
|
name: "@ohmyhost/product-cli",
|
|
44712
|
-
version: "0.1.
|
|
45320
|
+
version: "0.1.43",
|
|
44713
45321
|
private: true,
|
|
44714
45322
|
ohmyhost: {
|
|
44715
45323
|
deployment: "production",
|
|
@@ -44756,32 +45364,32 @@ var package_default = {
|
|
|
44756
45364
|
};
|
|
44757
45365
|
|
|
44758
45366
|
// packages/contracts/dist/project-context.js
|
|
44759
|
-
var
|
|
44760
|
-
var
|
|
45367
|
+
var record5 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
45368
|
+
var timestamp4 = (v) => typeof v === "string" && Number.isFinite(Date.parse(v)) && new Date(v).toISOString() === v;
|
|
44761
45369
|
var version = (v) => Number.isInteger(v) && Number(v) >= 0 && Number(v) <= 2147483647;
|
|
44762
45370
|
var bounded = (v, lines, bytes) => typeof v === "string" && !/[\r\u2028\u2029]/u.test(v) && !new RegExp("\\p{Cc}", "u").test(v.replace(/[\n\t]/gu, "")) && v.split("\n").length <= lines && new TextEncoder().encode(v).length <= bytes;
|
|
44763
45371
|
function assertProjectNotesReceipt(v) {
|
|
44764
|
-
if (!
|
|
45372
|
+
if (!record5(v) || Object.keys(v).sort().join(",") !== "updated_at,version" || !version(v["version"]) || v["version"] === 0 || !timestamp4(v["updated_at"]))
|
|
44765
45373
|
throw new TypeError("Invalid project notes receipt");
|
|
44766
45374
|
}
|
|
44767
45375
|
function assertProjectContext(v) {
|
|
44768
|
-
if (!
|
|
45376
|
+
if (!record5(v) || Object.keys(v).sort().join(",") !== "credit_access,generated_at,markdown,notes,project_id" || typeof v["project_id"] !== "string" || !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(v["project_id"]) || !timestamp4(v["generated_at"]) || !["included", "not_authorized"].includes(String(v["credit_access"])) || !bounded(v["markdown"], 500, 32768))
|
|
44769
45377
|
throw new TypeError("Invalid project context");
|
|
44770
45378
|
const notes = v["notes"];
|
|
44771
|
-
if (!
|
|
45379
|
+
if (!record5(notes) || Object.keys(notes).sort().join(",") !== "markdown,updated_at,version" || !version(notes["version"]) || !bounded(notes["markdown"], 250, 16384) || (notes["version"] === 0 ? notes["updated_at"] !== null || notes["markdown"] !== "" : !timestamp4(notes["updated_at"])))
|
|
44772
45380
|
throw new TypeError("Invalid project notes");
|
|
44773
45381
|
}
|
|
44774
45382
|
|
|
44775
45383
|
// packages/contracts/dist/project-exports.js
|
|
44776
45384
|
function assertProjectExport(value) {
|
|
44777
|
-
if (!
|
|
45385
|
+
if (!record6(value) || Object.keys(value).sort().join(",") !== "archive,error,id,next_poll_after_seconds,next_request_at,project_id,requested_at,state" || typeof value["id"] !== "string" || !id.test(value["id"]) || typeof value["project_id"] !== "string" || !id.test(value["project_id"]) || !["queued", "running", "succeeded", "failed", "cancelled"].includes(String(value["state"])) || !timestamp5(value["requested_at"]) || !timestamp5(value["next_request_at"]))
|
|
44778
45386
|
invalid4();
|
|
44779
45387
|
const active = value["state"] === "queued" || value["state"] === "running";
|
|
44780
45388
|
if (value["next_poll_after_seconds"] !== (active ? 5 : null))
|
|
44781
45389
|
invalid4();
|
|
44782
45390
|
if (value["state"] === "failed") {
|
|
44783
45391
|
const error = value["error"];
|
|
44784
|
-
if (!
|
|
45392
|
+
if (!record6(error) || Object.keys(error).sort().join(",") !== "code,message,retryable,suggested_action" || typeof error["code"] !== "string")
|
|
44785
45393
|
invalid4();
|
|
44786
45394
|
const expected = publicOperationFailure(error["code"]);
|
|
44787
45395
|
for (const key of Object.keys(expected))
|
|
@@ -44795,14 +45403,14 @@ function assertProjectExport(value) {
|
|
|
44795
45403
|
invalid4();
|
|
44796
45404
|
return;
|
|
44797
45405
|
}
|
|
44798
|
-
if (value["state"] !== "succeeded" || !
|
|
45406
|
+
if (value["state"] !== "succeeded" || !record6(archive) || Object.keys(archive).sort().join(",") !== "bytes,captured_at,download_expires_at,download_url,expires_at,sha256,sql_files" || !Number.isSafeInteger(archive["bytes"]) || Number(archive["bytes"]) < 1 || Number(archive["bytes"]) > 536870912 || typeof archive["sha256"] !== "string" || !/^sha256:[a-f0-9]{64}$/u.test(archive["sha256"]) || !['["dev.sql"]', '["prod.sql"]', '["dev.sql","prod.sql"]', '["shared.sql"]'].includes(JSON.stringify(archive["sql_files"])) || !timestamp5(archive["captured_at"]) || !timestamp5(archive["expires_at"]))
|
|
44799
45407
|
invalid4();
|
|
44800
45408
|
if (archive["download_url"] === null) {
|
|
44801
45409
|
if (archive["download_expires_at"] !== null)
|
|
44802
45410
|
invalid4();
|
|
44803
45411
|
return;
|
|
44804
45412
|
}
|
|
44805
|
-
if (typeof archive["download_url"] !== "string" || !
|
|
45413
|
+
if (typeof archive["download_url"] !== "string" || !timestamp5(archive["download_expires_at"]) || Date.parse(archive["download_expires_at"]) > Date.parse(archive["expires_at"]))
|
|
44806
45414
|
invalid4();
|
|
44807
45415
|
let url;
|
|
44808
45416
|
try {
|
|
@@ -44814,10 +45422,10 @@ function assertProjectExport(value) {
|
|
|
44814
45422
|
invalid4();
|
|
44815
45423
|
}
|
|
44816
45424
|
var id = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
|
|
44817
|
-
function
|
|
45425
|
+
function record6(value) {
|
|
44818
45426
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
44819
45427
|
}
|
|
44820
|
-
function
|
|
45428
|
+
function timestamp5(value) {
|
|
44821
45429
|
return typeof value === "string" && Number.isFinite(Date.parse(value)) && new Date(value).toISOString() === value;
|
|
44822
45430
|
}
|
|
44823
45431
|
function invalid4() {
|
|
@@ -44835,11 +45443,11 @@ function assertBillingTaxIssue(value) {
|
|
|
44835
45443
|
"billing_tax_location_required",
|
|
44836
45444
|
"billing_tax_calculation_failed",
|
|
44837
45445
|
"billing_tax_configuration_required"
|
|
44838
|
-
].includes(String(v["code"])) || typeof v["invoice_id"] !== "string" || !/^in_[A-Za-z0-9_]{1,253}$/u.test(v["invoice_id"]) || !
|
|
45446
|
+
].includes(String(v["code"])) || typeof v["invoice_id"] !== "string" || !/^in_[A-Za-z0-9_]{1,253}$/u.test(v["invoice_id"]) || !timestamp6(v["observed_at"]) || v["required_action"] !== (v["code"] === "billing_tax_location_required" ? "open_billing_portal" : "contact_support"))
|
|
44839
45447
|
throw new Error("billing_response_invalid");
|
|
44840
45448
|
}
|
|
44841
45449
|
var ulid4 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
|
|
44842
|
-
var
|
|
45450
|
+
var timestamp6 = (v) => typeof v === "string" && Number.isFinite(Date.parse(v)) && new Date(v).toISOString() === v;
|
|
44843
45451
|
function stripeUrl(value, host2) {
|
|
44844
45452
|
if (typeof value !== "string" || value.length > 8192)
|
|
44845
45453
|
return false;
|
|
@@ -44854,7 +45462,7 @@ function assertBillingCheckout(value) {
|
|
|
44854
45462
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
44855
45463
|
throw new Error("billing_response_invalid");
|
|
44856
45464
|
const v = value;
|
|
44857
|
-
if (Object.keys(v).sort().join(",") !== "billing_issue,checkout_id,credited_micros,expires_at,offer,organization_id,packs,paid_until,payment_confirmed,required_action,revoked_micros,state,url" || typeof v["organization_id"] !== "string" || !ulid4.test(v["organization_id"]) || typeof v["checkout_id"] !== "string" || !ulid4.test(v["checkout_id"]) || typeof v["offer"] !== "string" || !["topup", "paid"].includes(v["offer"]) || typeof v["state"] !== "string" || !["open", "complete", "expired"].includes(v["state"]) || typeof v["payment_confirmed"] !== "boolean" || typeof v["required_action"] !== "string" || !["none", "complete_checkout", "open_billing_portal", "contact_support"].includes(v["required_action"]) || v["url"] !== null && !stripeUrl(v["url"], "checkout.stripe.com") || !
|
|
45465
|
+
if (Object.keys(v).sort().join(",") !== "billing_issue,checkout_id,credited_micros,expires_at,offer,organization_id,packs,paid_until,payment_confirmed,required_action,revoked_micros,state,url" || typeof v["organization_id"] !== "string" || !ulid4.test(v["organization_id"]) || typeof v["checkout_id"] !== "string" || !ulid4.test(v["checkout_id"]) || typeof v["offer"] !== "string" || !["topup", "paid"].includes(v["offer"]) || typeof v["state"] !== "string" || !["open", "complete", "expired"].includes(v["state"]) || typeof v["payment_confirmed"] !== "boolean" || typeof v["required_action"] !== "string" || !["none", "complete_checkout", "open_billing_portal", "contact_support"].includes(v["required_action"]) || v["url"] !== null && !stripeUrl(v["url"], "checkout.stripe.com") || !timestamp6(v["expires_at"]) || v["paid_until"] !== null && !timestamp6(v["paid_until"]) || !Number.isInteger(v["packs"]) || Number(v["packs"]) < 1 || Number(v["packs"]) > 100 || v["offer"] === "paid" && v["packs"] !== 1 || ![v["credited_micros"], v["revoked_micros"]].every((x) => typeof x === "string" && /^(0|[1-9][0-9]{0,18})$/u.test(x)))
|
|
44858
45466
|
throw new Error("billing_response_invalid");
|
|
44859
45467
|
assertBillingTaxIssue(v["billing_issue"]);
|
|
44860
45468
|
}
|
|
@@ -44862,7 +45470,7 @@ function assertBillingPortal(value) {
|
|
|
44862
45470
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
44863
45471
|
throw new Error("billing_response_invalid");
|
|
44864
45472
|
const v = value;
|
|
44865
|
-
if (Object.keys(v).sort().join(",") !== "created_at,organization_id,url" || typeof v["organization_id"] !== "string" || !ulid4.test(v["organization_id"]) || !
|
|
45473
|
+
if (Object.keys(v).sort().join(",") !== "created_at,organization_id,url" || typeof v["organization_id"] !== "string" || !ulid4.test(v["organization_id"]) || !timestamp6(v["created_at"]) || !stripeUrl(v["url"], "billing.stripe.com"))
|
|
44866
45474
|
throw new Error("billing_response_invalid");
|
|
44867
45475
|
}
|
|
44868
45476
|
function assertRecharge(value) {
|
|
@@ -45054,6 +45662,20 @@ var HELP_USAGE = Object.freeze({
|
|
|
45054
45662
|
"database access create": "ohmyhost database access create --project ULID --environment dev|prod [--mode read|write] [--ttl 5m|1h|24h|SECONDS] [--label TEXT] --yes --json\n The connection URI is shown once. Use it immediately, never store it in files, notes or source, and revoke it when finished.",
|
|
45055
45663
|
"database access list": "ohmyhost database access list --project ULID [--environment dev|prod] --json",
|
|
45056
45664
|
"database access revoke": "ohmyhost database access revoke --project ULID --access ULID --yes --json",
|
|
45665
|
+
"database webhook create": "ohmyhost database webhook create --project ULID --environment dev|prod --url HTTPS_URL --event-types TYPE[,TYPE] [--headers-file PATH] --idempotency-key KEY --yes --json (the signing secret is shown once in this answer; types: database.created, database.ready, database.woke, database.slept, database.suspended, database.resized, database.deleted; the headers file is a UTF-8 JSON object of at most 8 KiB)",
|
|
45666
|
+
"database webhook list": "ohmyhost database webhook list --project ULID [--environment dev|prod] --json (dev when omitted; the secret is never listed)",
|
|
45667
|
+
"database webhook get": "ohmyhost database webhook get --project ULID [--environment dev|prod] --webhook ID --json",
|
|
45668
|
+
"database webhook delete": "ohmyhost database webhook delete --project ULID --environment dev|prod --webhook ID --yes --json",
|
|
45669
|
+
"database webhook test": "ohmyhost database webhook test --project ULID --environment dev|prod --webhook ID --yes --json (sends one signed test request to the receiver; nothing is stored)",
|
|
45670
|
+
"database webhook deliveries": "ohmyhost database webhook deliveries --project ULID [--environment dev|prod] [--webhook ID] [--limit 1..100] [--cursor CURSOR] --json",
|
|
45671
|
+
"database webhook replay": "ohmyhost database webhook replay --project ULID --environment dev|prod --delivery ID --yes --json",
|
|
45672
|
+
"database schedule set": "ohmyhost database schedule set --project ULID --environment dev|prod --name NAME (--cron EXPR | --every-seconds N) --statements-file PATH [--timeout-ms N] [--enabled true|false] --yes --json (runs the statements in the file, a UTF-8 JSON array of 1 to 20 SQL strings, as the runtime role of the application; cron has five fields in UTC; every-seconds is 60 to 2678400; timeout-ms is 1000 to 30000, default 10000)",
|
|
45673
|
+
"database schedule list": "ohmyhost database schedule list --project ULID [--environment dev|prod] --json (dev when omitted)",
|
|
45674
|
+
"database schedule get": "ohmyhost database schedule get --project ULID [--environment dev|prod] --name NAME --json",
|
|
45675
|
+
"database schedule delete": "ohmyhost database schedule delete --project ULID --environment dev|prod --name NAME --yes --json",
|
|
45676
|
+
"database schedule runs": "ohmyhost database schedule runs --project ULID [--environment dev|prod] --name NAME [--limit 1..50] --json",
|
|
45677
|
+
"database schedule run": "ohmyhost database schedule run --project ULID --environment dev|prod --name NAME --yes --json (queues one run now, in addition to the timer)",
|
|
45678
|
+
"database executions": "ohmyhost database executions --project ULID [--environment dev|prod] --from ISO --to ISO --granularity hour|day [--limit 1..100] [--cursor CURSOR] --json (UTC timestamps like 2026-10-30T00:00:00.000Z aligned to the granularity, at most 31 days; counts schedule runs, webhook attempts and events per hour or day; usage counters only, nothing is charged for them until the operator prices them)",
|
|
45057
45679
|
"database psql": "ohmyhost database psql --project ULID --environment dev|prod [--mode read|write] [--ttl 5m|1h|24h|SECONDS] [--json] (starts local psql with a temporary credential and revokes it on exit)",
|
|
45058
45680
|
link: "ohmyhost link --project ULID --repository-owner OWNER --repository-name REPOSITORY --idempotency-key KEY --json (uses the workspace GitHub connection and waits for the source-link operation)",
|
|
45059
45681
|
"source auto-deploy set": "ohmyhost source auto-deploy set --project ULID --branch BRANCH --enabled true|false --idempotency-key KEY --json",
|
|
@@ -45120,12 +45742,19 @@ var HELP_USAGE = Object.freeze({
|
|
|
45120
45742
|
"mail domain delete": "ohmyhost mail domain delete --project ULID --environment ULID --idempotency-key KEY --yes --json"
|
|
45121
45743
|
});
|
|
45122
45744
|
var HELP_COMMANDS = Object.freeze(Object.entries(HELP_USAGE).map(([command, usage]) => Object.freeze({ command, usage })));
|
|
45745
|
+
var helpEntries = (topic) => {
|
|
45746
|
+
if (topic === void 0)
|
|
45747
|
+
return HELP_COMMANDS;
|
|
45748
|
+
const exact7 = HELP_COMMANDS.filter((entry) => entry.command === topic);
|
|
45749
|
+
return exact7.length > 0 ? exact7 : HELP_COMMANDS.filter((entry) => entry.command.startsWith(`${topic} `));
|
|
45750
|
+
};
|
|
45751
|
+
var helpTopicKnown = (topic) => helpEntries(topic).length > 0;
|
|
45123
45752
|
var cliMetadataResult = (kind, topic) => kind === "help" ? success("help", {
|
|
45124
45753
|
status: "succeeded",
|
|
45125
45754
|
cli_version: CLI_VERSION,
|
|
45126
45755
|
usage: "ohmyhost <command> [options] [--profile-name NAME] --json",
|
|
45127
45756
|
environment: "OHMYHOST_ENVIRONMENT=development|production (default: production); OHMYHOST_PROFILE=NAME binds this process to one saved login",
|
|
45128
|
-
commands:
|
|
45757
|
+
commands: helpEntries(topic)
|
|
45129
45758
|
}) : success("version", { status: "succeeded", cli_version: CLI_VERSION });
|
|
45130
45759
|
var invalidCommandAction = (argv, commandPrefix) => {
|
|
45131
45760
|
const label = recognizedCommandLabel(argv);
|
|
@@ -45142,11 +45771,22 @@ var invalidCommandAction = (argv, commandPrefix) => {
|
|
|
45142
45771
|
const linkable = /(?:^|\s)--project ULID/u.test(usage) && !argv.includes("--project");
|
|
45143
45772
|
return `The arguments of '${label}' are invalid or incomplete; nothing was sent. Usage: ${usage}.${linkable ? ` --project may be omitted only inside a directory linked with '${commandPrefix} link' for this OHMYHOST_ENVIRONMENT; otherwise pass --project ULID.` : ""}`;
|
|
45144
45773
|
};
|
|
45145
|
-
var
|
|
45774
|
+
var retryAdvice = (command) => {
|
|
45775
|
+
const usage = Object.hasOwn(HELP_USAGE, command) ? HELP_USAGE[command] : "";
|
|
45776
|
+
if (usage.includes("--idempotency-key"))
|
|
45777
|
+
return "run the same command again with the same --idempotency-key; the change may already have been applied, and a new key could apply it twice";
|
|
45778
|
+
if (usage.includes("--yes"))
|
|
45779
|
+
return "this command has no idempotency key and the change may already have been applied; check its current state first with the matching list or get command (for example database access list --project ULID --json), and run the command again only if the change is not there";
|
|
45780
|
+
return "run the same command again; this command has no idempotency key, so check its current state first if it may have changed anything";
|
|
45781
|
+
};
|
|
45782
|
+
var internalErrorAction = (command) => `The ohmyhost client stopped on an unexpected error; the stderr line starting with [ohmyhost: identifies it. Compare 'ohmyhost --version' with https://ohmyho.st/client-release.json and install the published client if it is older, then ${retryAdvice(command)}. If the current client fails the same way, report it with feedback submit (kind bug, error code internal_error) and quote that stderr line.`;
|
|
45146
45783
|
var CREDENTIAL_STORE_UNAVAILABLE_ACTION = "This computer's credential store (for example macOS Keychain or Windows Credential Manager) or the saved-login list in ~/.ohmyhost/profiles could not be read or written; nothing was changed. If the agent runs in a sandbox, run the command with access to them before asking the customer to sign in again. If the store is locked, ask the customer to unlock it, then run the command again. On a server, container or CI runner without a credential store, do not run login: load OHMYHOST_TOKEN from a private env file with a token from the portal's API Tokens page.";
|
|
45147
|
-
var
|
|
45148
|
-
var
|
|
45784
|
+
var responseContractAction = (command) => `The ohmyho.st API answered in a form this client version does not accept, usually because the client is older than the service. Compare 'ohmyhost --version' with https://ohmyho.st/client-release.json; if it is older, install the published CLI and MCP and reload MCP. Then ${retryAdvice(command)}. If the current version answers this too, report it with feedback submit (kind bug, error code response_contract_invalid).`;
|
|
45785
|
+
var requestTimeoutAction = (command) => `The ohmyho.st API did not answer within 30 seconds; ${retryAdvice(command)}.`;
|
|
45149
45786
|
var LOGOUT_UNCONFIRMED_ACTION = "The saved login was removed from this computer, but ohmyho.st did not confirm that its session ended. Running logout again cannot retry this, because the login is gone; do not sign in again just to revoke it. Tell the customer the session end was not confirmed.";
|
|
45787
|
+
var HEADERS_FILE_INVALID_ACTION = "Put one JSON object of header names and values in the file named by --headers-file: UTF-8, at most 8 KiB, unique names, values of visible ASCII characters. Names such as content-type, host, content-length, connection, transfer-encoding, user-agent, te, upgrade and expect, and names starting with pgcf-, cf- or x-forwarded-, are refused. Nothing was sent; fix the file and run the command again.";
|
|
45788
|
+
var SCHEDULE_STATEMENTS_FILE_INVALID_ACTION = "Put one JSON array of 1 to 20 non-empty SQL strings in the file named by --statements-file: UTF-8, at most 64 KiB in total and 16 KiB per statement, without NUL characters. Nothing was saved; fix the file and run the command again.";
|
|
45789
|
+
var SCHEDULE_INVALID_ACTION = "Check the schedule request: --cron takes five fields in UTC (9 to 120 characters), or --every-seconds takes 60 to 2678400, never both; --timeout-ms takes 1000 to 30000; the statements file must hold 1 to 20 non-blank SQL strings of at most 16 KiB each and 64 KiB in total. Nothing was saved; fix it and run the command again.";
|
|
45150
45790
|
var STATEMENT_FILE_INVALID_ACTION = "Put one INSERT, UPDATE or DELETE statement that starts with that keyword (no leading comment or WITH), UTF-8, at most 64 KiB, in the file named by --statement-file, then rerun with the same --idempotency-key.";
|
|
45151
45791
|
var signInCommand = (commandPrefix, profile) => profile === void 0 ? `${commandPrefix} login --json` : `${commandPrefix} login${profile.organizationId === null ? "" : ` --organization ${profile.organizationId}`} --user ${profile.userId} --profile-name ${profile.name} --json`;
|
|
45152
45792
|
var endedLoginAction = (commandPrefix, profile) => `The sign-in of ${profile === void 0 ? "this computer's saved login" : `saved login ${profile.name} (user ${profile.userId}${profile.organizationId === null ? "" : `, organization ${profile.organizationId}`})`} ended and it was removed. Run '${signInCommand(commandPrefix, profile)}' to sign it in again.`;
|
|
@@ -45179,6 +45819,8 @@ var ProductCli = class {
|
|
|
45179
45819
|
let command;
|
|
45180
45820
|
try {
|
|
45181
45821
|
command = parseProductCliCommand(argv);
|
|
45822
|
+
if (command.kind === "help" && command.topic !== void 0 && !helpTopicKnown(command.topic))
|
|
45823
|
+
throw new InvalidCommandError();
|
|
45182
45824
|
} catch (error) {
|
|
45183
45825
|
if (error instanceof InvalidCommandError) {
|
|
45184
45826
|
return failure(recognizedCommandLabel(argv), 2, "invalid_command", false, invalidCommandAction(argv, this.dependencies.commandPrefix));
|
|
@@ -45188,7 +45830,7 @@ var ProductCli = class {
|
|
|
45188
45830
|
subsystem: "parser",
|
|
45189
45831
|
errorKind: "unexpected"
|
|
45190
45832
|
});
|
|
45191
|
-
return failure(recognizedCommandLabel(argv), 1, "internal_error", false,
|
|
45833
|
+
return failure(recognizedCommandLabel(argv), 1, "internal_error", false, internalErrorAction(recognizedCommandLabel(argv)));
|
|
45192
45834
|
}
|
|
45193
45835
|
return this.runCommand(command, signal);
|
|
45194
45836
|
}
|
|
@@ -45511,6 +46153,34 @@ var ProductCli = class {
|
|
|
45511
46153
|
return await this.listDatabaseAccess(command, signal);
|
|
45512
46154
|
if (command.kind === "database-access-revoke")
|
|
45513
46155
|
return await this.revokeDatabaseAccess(command, signal);
|
|
46156
|
+
if (command.kind === "database-webhook-create")
|
|
46157
|
+
return await this.createDatabaseWebhook(command, signal);
|
|
46158
|
+
if (command.kind === "database-webhook-list")
|
|
46159
|
+
return await this.listDatabaseWebhooks(command, signal);
|
|
46160
|
+
if (command.kind === "database-webhook-get")
|
|
46161
|
+
return await this.getDatabaseWebhook(command, signal);
|
|
46162
|
+
if (command.kind === "database-webhook-delete")
|
|
46163
|
+
return await this.deleteDatabaseWebhook(command, signal);
|
|
46164
|
+
if (command.kind === "database-webhook-test")
|
|
46165
|
+
return await this.testDatabaseWebhook(command, signal);
|
|
46166
|
+
if (command.kind === "database-webhook-deliveries")
|
|
46167
|
+
return await this.listDatabaseWebhookDeliveries(command, signal);
|
|
46168
|
+
if (command.kind === "database-webhook-replay")
|
|
46169
|
+
return await this.replayDatabaseWebhookDelivery(command, signal);
|
|
46170
|
+
if (command.kind === "database-schedule-set")
|
|
46171
|
+
return await this.setDatabaseSchedule(command, signal);
|
|
46172
|
+
if (command.kind === "database-schedule-list")
|
|
46173
|
+
return await this.listDatabaseSchedules(command, signal);
|
|
46174
|
+
if (command.kind === "database-schedule-get")
|
|
46175
|
+
return await this.getDatabaseSchedule(command, signal);
|
|
46176
|
+
if (command.kind === "database-schedule-delete")
|
|
46177
|
+
return await this.deleteDatabaseSchedule(command, signal);
|
|
46178
|
+
if (command.kind === "database-schedule-runs")
|
|
46179
|
+
return await this.listDatabaseScheduleRuns(command, signal);
|
|
46180
|
+
if (command.kind === "database-schedule-run")
|
|
46181
|
+
return await this.runDatabaseSchedule(command, signal);
|
|
46182
|
+
if (command.kind === "database-executions")
|
|
46183
|
+
return await this.getDatabaseExecutionUsage(command, signal);
|
|
45514
46184
|
if (command.kind === "database-psql")
|
|
45515
46185
|
return await this.runProjectPsql(command, signal);
|
|
45516
46186
|
if (command.kind === "link")
|
|
@@ -45860,7 +46530,7 @@ var ProductCli = class {
|
|
|
45860
46530
|
if (revocationError instanceof ProviderCapabilityBlockedError) {
|
|
45861
46531
|
throw new ProductCliFailure(9, "blocked_prerequisite", false, "Remote token revocation is not available in this release.");
|
|
45862
46532
|
}
|
|
45863
|
-
if (
|
|
46533
|
+
if (isTimeout2(revocationError)) {
|
|
45864
46534
|
throw new ProductCliFailure(8, "request_timeout", false, LOGOUT_UNCONFIRMED_ACTION);
|
|
45865
46535
|
}
|
|
45866
46536
|
if (revocationError instanceof LifecycleTransportError) {
|
|
@@ -46014,6 +46684,153 @@ var ProductCli = class {
|
|
|
46014
46684
|
assertProjectDatabaseAccess(access);
|
|
46015
46685
|
return success("database access revoke", { status: "succeeded", access });
|
|
46016
46686
|
}
|
|
46687
|
+
/** The signing secret is returned by create only; every other answer carries no secret. */
|
|
46688
|
+
async createDatabaseWebhook(command, signal) {
|
|
46689
|
+
const request = await webhookCreateRequest(command);
|
|
46690
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46691
|
+
const webhook = await api.createProjectDatabaseWebhook({
|
|
46692
|
+
projectId: command.projectId,
|
|
46693
|
+
environment: command.environment,
|
|
46694
|
+
idempotencyKey: command.idempotencyKey,
|
|
46695
|
+
url: request.url,
|
|
46696
|
+
eventTypes: request.event_types,
|
|
46697
|
+
headers: request.headers
|
|
46698
|
+
});
|
|
46699
|
+
return success("database webhook create", { status: "succeeded", webhook });
|
|
46700
|
+
}
|
|
46701
|
+
async listDatabaseWebhooks(command, signal) {
|
|
46702
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46703
|
+
const page = await api.listProjectDatabaseWebhooks({
|
|
46704
|
+
projectId: command.projectId,
|
|
46705
|
+
environment: command.environment
|
|
46706
|
+
});
|
|
46707
|
+
return success("database webhook list", { status: "succeeded", webhook: page.items });
|
|
46708
|
+
}
|
|
46709
|
+
async getDatabaseWebhook(command, signal) {
|
|
46710
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46711
|
+
const webhook = await api.getProjectDatabaseWebhook({
|
|
46712
|
+
projectId: command.projectId,
|
|
46713
|
+
environment: command.environment,
|
|
46714
|
+
webhookId: command.webhookId
|
|
46715
|
+
});
|
|
46716
|
+
return success("database webhook get", { status: "succeeded", webhook });
|
|
46717
|
+
}
|
|
46718
|
+
async deleteDatabaseWebhook(command, signal) {
|
|
46719
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46720
|
+
const deleted = await api.deleteProjectDatabaseWebhook({
|
|
46721
|
+
projectId: command.projectId,
|
|
46722
|
+
environment: command.environment,
|
|
46723
|
+
webhookId: command.webhookId
|
|
46724
|
+
});
|
|
46725
|
+
return success("database webhook delete", { status: "succeeded", deleted });
|
|
46726
|
+
}
|
|
46727
|
+
async testDatabaseWebhook(command, signal) {
|
|
46728
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46729
|
+
const result = await api.testProjectDatabaseWebhook({
|
|
46730
|
+
projectId: command.projectId,
|
|
46731
|
+
environment: command.environment,
|
|
46732
|
+
webhookId: command.webhookId
|
|
46733
|
+
});
|
|
46734
|
+
return success("database webhook test", { status: "succeeded", result });
|
|
46735
|
+
}
|
|
46736
|
+
async listDatabaseWebhookDeliveries(command, signal) {
|
|
46737
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46738
|
+
const page = await api.listProjectDatabaseWebhookDeliveries({
|
|
46739
|
+
projectId: command.projectId,
|
|
46740
|
+
environment: command.environment,
|
|
46741
|
+
...command.webhookId === null ? {} : { webhookId: command.webhookId },
|
|
46742
|
+
...command.limit === null ? {} : { limit: command.limit },
|
|
46743
|
+
...command.cursor === null ? {} : { cursor: command.cursor }
|
|
46744
|
+
});
|
|
46745
|
+
return success("database webhook deliveries", {
|
|
46746
|
+
status: "succeeded",
|
|
46747
|
+
delivery: page.items,
|
|
46748
|
+
next_cursor: page.next_cursor
|
|
46749
|
+
});
|
|
46750
|
+
}
|
|
46751
|
+
async replayDatabaseWebhookDelivery(command, signal) {
|
|
46752
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46753
|
+
const replay = await api.replayProjectDatabaseWebhookDelivery({
|
|
46754
|
+
projectId: command.projectId,
|
|
46755
|
+
environment: command.environment,
|
|
46756
|
+
deliveryId: command.deliveryId
|
|
46757
|
+
});
|
|
46758
|
+
return success("database webhook replay", { status: "succeeded", replay });
|
|
46759
|
+
}
|
|
46760
|
+
/** The statements file and the schedule fields are checked before any request is sent. */
|
|
46761
|
+
async setDatabaseSchedule(command, signal) {
|
|
46762
|
+
const request = await scheduleSetRequest(command);
|
|
46763
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46764
|
+
const schedule = await api.setProjectDatabaseSchedule({
|
|
46765
|
+
projectId: command.projectId,
|
|
46766
|
+
environment: command.environment,
|
|
46767
|
+
name: command.name,
|
|
46768
|
+
request
|
|
46769
|
+
});
|
|
46770
|
+
return success("database schedule set", { status: "succeeded", schedule });
|
|
46771
|
+
}
|
|
46772
|
+
async listDatabaseSchedules(command, signal) {
|
|
46773
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46774
|
+
const page = await api.listProjectDatabaseSchedules({
|
|
46775
|
+
projectId: command.projectId,
|
|
46776
|
+
environment: command.environment
|
|
46777
|
+
});
|
|
46778
|
+
return success("database schedule list", { status: "succeeded", schedule: page.items });
|
|
46779
|
+
}
|
|
46780
|
+
async getDatabaseSchedule(command, signal) {
|
|
46781
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46782
|
+
const schedule = await api.getProjectDatabaseSchedule({
|
|
46783
|
+
projectId: command.projectId,
|
|
46784
|
+
environment: command.environment,
|
|
46785
|
+
name: command.name
|
|
46786
|
+
});
|
|
46787
|
+
return success("database schedule get", { status: "succeeded", schedule });
|
|
46788
|
+
}
|
|
46789
|
+
async deleteDatabaseSchedule(command, signal) {
|
|
46790
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46791
|
+
const deleted = await api.deleteProjectDatabaseSchedule({
|
|
46792
|
+
projectId: command.projectId,
|
|
46793
|
+
environment: command.environment,
|
|
46794
|
+
name: command.name
|
|
46795
|
+
});
|
|
46796
|
+
return success("database schedule delete", { status: "succeeded", deleted });
|
|
46797
|
+
}
|
|
46798
|
+
async listDatabaseScheduleRuns(command, signal) {
|
|
46799
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46800
|
+
const page = await api.listProjectDatabaseScheduleRuns({
|
|
46801
|
+
projectId: command.projectId,
|
|
46802
|
+
environment: command.environment,
|
|
46803
|
+
name: command.name,
|
|
46804
|
+
...command.limit === null ? {} : { limit: command.limit }
|
|
46805
|
+
});
|
|
46806
|
+
return success("database schedule runs", { status: "succeeded", schedule_run: page.items });
|
|
46807
|
+
}
|
|
46808
|
+
async runDatabaseSchedule(command, signal) {
|
|
46809
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46810
|
+
const run = await api.runProjectDatabaseSchedule({
|
|
46811
|
+
projectId: command.projectId,
|
|
46812
|
+
environment: command.environment,
|
|
46813
|
+
name: command.name
|
|
46814
|
+
});
|
|
46815
|
+
return success("database schedule run", { status: "succeeded", run });
|
|
46816
|
+
}
|
|
46817
|
+
async getDatabaseExecutionUsage(command, signal) {
|
|
46818
|
+
const api = await this.authenticatedApi(command.credentialStore, signal);
|
|
46819
|
+
const page = await api.getProjectDatabaseExecutionUsage({
|
|
46820
|
+
projectId: command.projectId,
|
|
46821
|
+
environment: command.environment,
|
|
46822
|
+
from: command.from,
|
|
46823
|
+
to: command.to,
|
|
46824
|
+
granularity: command.granularity,
|
|
46825
|
+
...command.limit === null ? {} : { limit: command.limit },
|
|
46826
|
+
...command.cursor === null ? {} : { cursor: command.cursor }
|
|
46827
|
+
});
|
|
46828
|
+
return success("database executions", {
|
|
46829
|
+
status: "succeeded",
|
|
46830
|
+
usage: page.items,
|
|
46831
|
+
next_cursor: page.next_cursor
|
|
46832
|
+
});
|
|
46833
|
+
}
|
|
46017
46834
|
/** psql receives the password through its own environment; the URI is never printed. */
|
|
46018
46835
|
async runProjectPsql(command, signal) {
|
|
46019
46836
|
const spawnPsql = this.dependencies.spawnPsql;
|
|
@@ -46037,7 +46854,7 @@ var ProductCli = class {
|
|
|
46037
46854
|
host: credential.host,
|
|
46038
46855
|
user: credential.role_name,
|
|
46039
46856
|
password: decodeURIComponent(new URL(credential.connection_uri).password),
|
|
46040
|
-
|
|
46857
|
+
websocketUrl: credential.websocket_url,
|
|
46041
46858
|
database: credential.database,
|
|
46042
46859
|
mode: credential.mode,
|
|
46043
46860
|
signal
|
|
@@ -46572,8 +47389,8 @@ var ProductCli = class {
|
|
|
46572
47389
|
if (error instanceof ProviderCapabilityBlockedError) {
|
|
46573
47390
|
throw new ProductCliFailure(9, "blocked_prerequisite", false, "Token refresh is not available in this release; run 'ohmyhost login'.");
|
|
46574
47391
|
}
|
|
46575
|
-
if (
|
|
46576
|
-
throw new ProductCliFailure(8, "request_timeout", true,
|
|
47392
|
+
if (isTimeout2(error)) {
|
|
47393
|
+
throw new ProductCliFailure(8, "request_timeout", true, requestTimeoutAction("unknown"));
|
|
46577
47394
|
}
|
|
46578
47395
|
if (error instanceof LifecycleTransportError) {
|
|
46579
47396
|
throw new ProductCliFailure(5, "token_refresh_failed", true, refreshFailedAction(this.dependencies.commandPrefix, this.#profile));
|
|
@@ -46621,10 +47438,13 @@ var classifyFailure = (command, error, signal, actingAs) => {
|
|
|
46621
47438
|
if (error instanceof SourceWorkspaceError)
|
|
46622
47439
|
return failure(command, 2, error.code, error.code === "source_snapshot_changed", error.message);
|
|
46623
47440
|
if (signal.aborted || isCancellation(error)) {
|
|
46624
|
-
return failure(command, 130, "command_cancelled", true,
|
|
47441
|
+
return failure(command, 130, "command_cancelled", true, `The command was stopped by an interrupt or termination signal, for example the shell's command timeout, before it finished; ${retryAdvice(command)}. Give login and commands with --wait or --follow several minutes, or run them in the background.`);
|
|
46625
47442
|
}
|
|
46626
|
-
if (
|
|
46627
|
-
return failure(command, 8, "request_timeout", true,
|
|
47443
|
+
if (isTimeout2(error)) {
|
|
47444
|
+
return failure(command, 8, "request_timeout", true, requestTimeoutAction(command));
|
|
47445
|
+
}
|
|
47446
|
+
if (error instanceof ProductCliFailure && error.code === "request_timeout" && error.retryable) {
|
|
47447
|
+
return failure(command, 8, "request_timeout", true, requestTimeoutAction(command));
|
|
46628
47448
|
}
|
|
46629
47449
|
if (error instanceof ProductCliFailure) {
|
|
46630
47450
|
return failure(command, error.exitCode, error.code, error.retryable, error.suggestedAction, error.operation);
|
|
@@ -46645,7 +47465,7 @@ var classifyFailure = (command, error, signal, actingAs) => {
|
|
|
46645
47465
|
return failure(command, 3, "credential_store_unavailable", false, CREDENTIAL_STORE_UNAVAILABLE_ACTION);
|
|
46646
47466
|
}
|
|
46647
47467
|
if (error instanceof ResponseContractError) {
|
|
46648
|
-
return failure(command, 7, "response_contract_invalid", false,
|
|
47468
|
+
return failure(command, 7, "response_contract_invalid", false, responseContractAction(command));
|
|
46649
47469
|
}
|
|
46650
47470
|
if (error instanceof PublicResponseTooLargeError) {
|
|
46651
47471
|
return failure(command, 7, "response_too_large", false, "Retry only after the remote response is repaired.");
|
|
@@ -46655,16 +47475,16 @@ var classifyFailure = (command, error, signal, actingAs) => {
|
|
|
46655
47475
|
const problem = parseSafeProblem(error);
|
|
46656
47476
|
return failure(command, 7, problem.code, problem.retryable, problem.suggestedAction, void 0, problem.retryAfterSeconds, problem.requestId, problem.docsUrl, ACCOUNT_SENSITIVE_PROBLEMS.has(problem.code) ? actingAs : void 0, problem.message);
|
|
46657
47477
|
} catch {
|
|
46658
|
-
return failure(command, 7, "response_contract_invalid", false,
|
|
47478
|
+
return failure(command, 7, "response_contract_invalid", false, responseContractAction(command));
|
|
46659
47479
|
}
|
|
46660
47480
|
}
|
|
46661
47481
|
if (looksLikeRemoteObject(error)) {
|
|
46662
|
-
return failure(command, 7, "response_contract_invalid", false,
|
|
47482
|
+
return failure(command, 7, "response_contract_invalid", false, responseContractAction(command));
|
|
46663
47483
|
}
|
|
46664
47484
|
if (error instanceof NetworkTransportError) {
|
|
46665
|
-
return failure(command, 8, "network_error", true,
|
|
47485
|
+
return failure(command, 8, "network_error", true, `The request did not reach the ohmyho.st API, or its answer was cut off. If the agent runs in a sandbox without network access, run the command with network access. Otherwise ${retryAdvice(command)}.`);
|
|
46666
47486
|
}
|
|
46667
|
-
return failure(command, 1, "internal_error", false,
|
|
47487
|
+
return failure(command, 1, "internal_error", false, internalErrorAction(command));
|
|
46668
47488
|
};
|
|
46669
47489
|
var reusedKeyProblem = (error) => {
|
|
46670
47490
|
if (!looksLikeProblem(error))
|
|
@@ -46677,19 +47497,19 @@ var reusedKeyProblem = (error) => {
|
|
|
46677
47497
|
}
|
|
46678
47498
|
};
|
|
46679
47499
|
var OPERATION_STREAM_CONNECTIONS = 4;
|
|
46680
|
-
var readStatementFile =
|
|
46681
|
-
|
|
47500
|
+
var readStatementFile = (path2) => readBoundedUtf8File(path2, 65536, () => new ProductCliFailure(2, "statement_file_invalid", false, STATEMENT_FILE_INVALID_ACTION));
|
|
47501
|
+
var readBoundedUtf8File = async (path2, maxBytes, refusal) => {
|
|
46682
47502
|
let file;
|
|
46683
47503
|
try {
|
|
46684
47504
|
file = await open3(path2, "r");
|
|
46685
47505
|
} catch {
|
|
46686
|
-
throw
|
|
47506
|
+
throw refusal();
|
|
46687
47507
|
}
|
|
46688
|
-
const buffer = Buffer.alloc(
|
|
47508
|
+
const buffer = Buffer.alloc(maxBytes + 1);
|
|
46689
47509
|
try {
|
|
46690
47510
|
const stat3 = await file.stat();
|
|
46691
|
-
if (!stat3.isFile() || stat3.size >
|
|
46692
|
-
throw
|
|
47511
|
+
if (!stat3.isFile() || stat3.size > maxBytes)
|
|
47512
|
+
throw refusal();
|
|
46693
47513
|
let length = 0;
|
|
46694
47514
|
while (length < buffer.length) {
|
|
46695
47515
|
const read = await file.read(buffer, length, buffer.length - length, null);
|
|
@@ -46697,18 +47517,64 @@ var readStatementFile = async (path2) => {
|
|
|
46697
47517
|
break;
|
|
46698
47518
|
length += read.bytesRead;
|
|
46699
47519
|
}
|
|
46700
|
-
if (length >
|
|
46701
|
-
throw
|
|
47520
|
+
if (length > maxBytes)
|
|
47521
|
+
throw refusal();
|
|
46702
47522
|
return new TextDecoder("utf-8", { fatal: true }).decode(buffer.subarray(0, length));
|
|
46703
47523
|
} catch (error) {
|
|
46704
47524
|
if (error instanceof ProductCliFailure)
|
|
46705
47525
|
throw error;
|
|
46706
|
-
throw
|
|
47526
|
+
throw refusal();
|
|
46707
47527
|
} finally {
|
|
46708
47528
|
buffer.fill(0);
|
|
46709
47529
|
await file.close();
|
|
46710
47530
|
}
|
|
46711
47531
|
};
|
|
47532
|
+
var webhookCreateRequest = async (command) => {
|
|
47533
|
+
const headersFailure = () => new ProductCliFailure(2, "headers_file_invalid", false, HEADERS_FILE_INVALID_ACTION);
|
|
47534
|
+
const headers = command.headersFile === null ? void 0 : await readBoundedUtf8File(command.headersFile, 8192, headersFailure).then((text) => {
|
|
47535
|
+
try {
|
|
47536
|
+
return JSON.parse(text);
|
|
47537
|
+
} catch {
|
|
47538
|
+
throw headersFailure();
|
|
47539
|
+
}
|
|
47540
|
+
});
|
|
47541
|
+
try {
|
|
47542
|
+
return parseDatabaseWebhookCreateRequest({
|
|
47543
|
+
url: command.url,
|
|
47544
|
+
event_types: command.eventTypes,
|
|
47545
|
+
headers
|
|
47546
|
+
});
|
|
47547
|
+
} catch {
|
|
47548
|
+
throw headersFailure();
|
|
47549
|
+
}
|
|
47550
|
+
};
|
|
47551
|
+
var scheduleSetRequest = async (command) => {
|
|
47552
|
+
const statementsFailure = () => new ProductCliFailure(2, "statements_file_invalid", false, SCHEDULE_STATEMENTS_FILE_INVALID_ACTION);
|
|
47553
|
+
const statements = await readBoundedUtf8File(command.statementsFile, 65536, statementsFailure).then((text) => {
|
|
47554
|
+
try {
|
|
47555
|
+
return JSON.parse(text);
|
|
47556
|
+
} catch {
|
|
47557
|
+
throw statementsFailure();
|
|
47558
|
+
}
|
|
47559
|
+
});
|
|
47560
|
+
try {
|
|
47561
|
+
parseDatabaseScheduleSetRequest({ every_seconds: 60, statements, confirm: true });
|
|
47562
|
+
} catch {
|
|
47563
|
+
throw statementsFailure();
|
|
47564
|
+
}
|
|
47565
|
+
try {
|
|
47566
|
+
return parseDatabaseScheduleSetRequest({
|
|
47567
|
+
...command.cron === null ? {} : { cron: command.cron },
|
|
47568
|
+
...command.everySeconds === null ? {} : { every_seconds: command.everySeconds },
|
|
47569
|
+
statements,
|
|
47570
|
+
...command.timeoutMs === null ? {} : { timeout_ms: command.timeoutMs },
|
|
47571
|
+
...command.enabled === null ? {} : { enabled: command.enabled },
|
|
47572
|
+
confirm: true
|
|
47573
|
+
});
|
|
47574
|
+
} catch {
|
|
47575
|
+
throw new ProductCliFailure(2, "schedule_invalid", false, SCHEDULE_INVALID_ACTION);
|
|
47576
|
+
}
|
|
47577
|
+
};
|
|
46712
47578
|
var psqlUnavailable = () => failure("database psql", 9, "psql_unavailable", false, "Install the PostgreSQL client (psql) and make it available on PATH, or run 'ohmyhost database access create' and connect with your own SQL client.");
|
|
46713
47579
|
var success = (command, body) => ({
|
|
46714
47580
|
exitCode: 0,
|
|
@@ -46848,6 +47714,34 @@ var parsedCommandName = (command) => {
|
|
|
46848
47714
|
return "database access revoke";
|
|
46849
47715
|
if (command.kind === "database-psql")
|
|
46850
47716
|
return "database psql";
|
|
47717
|
+
if (command.kind === "database-webhook-create")
|
|
47718
|
+
return "database webhook create";
|
|
47719
|
+
if (command.kind === "database-webhook-list")
|
|
47720
|
+
return "database webhook list";
|
|
47721
|
+
if (command.kind === "database-webhook-get")
|
|
47722
|
+
return "database webhook get";
|
|
47723
|
+
if (command.kind === "database-webhook-delete")
|
|
47724
|
+
return "database webhook delete";
|
|
47725
|
+
if (command.kind === "database-webhook-test")
|
|
47726
|
+
return "database webhook test";
|
|
47727
|
+
if (command.kind === "database-webhook-deliveries")
|
|
47728
|
+
return "database webhook deliveries";
|
|
47729
|
+
if (command.kind === "database-webhook-replay")
|
|
47730
|
+
return "database webhook replay";
|
|
47731
|
+
if (command.kind === "database-schedule-set")
|
|
47732
|
+
return "database schedule set";
|
|
47733
|
+
if (command.kind === "database-schedule-list")
|
|
47734
|
+
return "database schedule list";
|
|
47735
|
+
if (command.kind === "database-schedule-get")
|
|
47736
|
+
return "database schedule get";
|
|
47737
|
+
if (command.kind === "database-schedule-delete")
|
|
47738
|
+
return "database schedule delete";
|
|
47739
|
+
if (command.kind === "database-schedule-runs")
|
|
47740
|
+
return "database schedule runs";
|
|
47741
|
+
if (command.kind === "database-schedule-run")
|
|
47742
|
+
return "database schedule run";
|
|
47743
|
+
if (command.kind === "database-executions")
|
|
47744
|
+
return "database executions";
|
|
46851
47745
|
if (command.kind === "source-auto-deploy-set")
|
|
46852
47746
|
return "source auto-deploy set";
|
|
46853
47747
|
if (command.kind === "source-auto-deploy-status")
|
|
@@ -46918,14 +47812,14 @@ var throwIfAborted = (signal) => {
|
|
|
46918
47812
|
throw signal.reason;
|
|
46919
47813
|
};
|
|
46920
47814
|
var isCancellation = (error) => error instanceof DOMException && error.name === "AbortError";
|
|
46921
|
-
var
|
|
47815
|
+
var isTimeout2 = (error) => error instanceof DOMException && error.name === "TimeoutError";
|
|
46922
47816
|
var looksLikeProblem = (error) => typeof error === "object" && error !== null && ("code" in error || "status" in error || "suggested_action" in error);
|
|
46923
47817
|
var looksLikeRemoteObject = (error) => typeof error === "object" && error !== null && !(error instanceof Error);
|
|
46924
47818
|
var diagnosticDescriptor = (error, signal) => {
|
|
46925
47819
|
if (signal.aborted || isCancellation(error)) {
|
|
46926
47820
|
return { category: "cancelled", subsystem: "runtime", errorKind: "cancelled" };
|
|
46927
47821
|
}
|
|
46928
|
-
if (
|
|
47822
|
+
if (isTimeout2(error)) {
|
|
46929
47823
|
return { category: "timeout", subsystem: "runtime", errorKind: "timeout" };
|
|
46930
47824
|
}
|
|
46931
47825
|
if (error instanceof CredentialStoreUnavailableError) {
|
|
@@ -47042,12 +47936,12 @@ function buildClientParams(args, fields) {
|
|
|
47042
47936
|
};
|
|
47043
47937
|
const map = buildKeyMap(fields);
|
|
47044
47938
|
function writeSlot(slot, key, value) {
|
|
47045
|
-
let
|
|
47046
|
-
if (
|
|
47047
|
-
|
|
47048
|
-
params[slot] =
|
|
47939
|
+
let record7 = params[slot];
|
|
47940
|
+
if (record7 === void 0) {
|
|
47941
|
+
record7 = /* @__PURE__ */ Object.create(null);
|
|
47942
|
+
params[slot] = record7;
|
|
47049
47943
|
}
|
|
47050
|
-
|
|
47944
|
+
record7[key] = value;
|
|
47051
47945
|
}
|
|
47052
47946
|
let config;
|
|
47053
47947
|
for (const [index, arg] of args.entries()) {
|
|
@@ -47324,9 +48218,9 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
|
|
|
47324
48218
|
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
47325
48219
|
var defaultPathSerializer = ({ path: path2, url: _url }) => {
|
|
47326
48220
|
let url = _url;
|
|
47327
|
-
const
|
|
47328
|
-
if (
|
|
47329
|
-
for (const match of
|
|
48221
|
+
const matches2 = _url.match(PATH_PARAM_RE);
|
|
48222
|
+
if (matches2) {
|
|
48223
|
+
for (const match of matches2) {
|
|
47330
48224
|
let explode = false;
|
|
47331
48225
|
let name = match.substring(1, match.length - 1);
|
|
47332
48226
|
let style = "simple";
|
|
@@ -49692,6 +50586,289 @@ var revokeProjectDatabaseAccess = (parameters, options) => {
|
|
|
49692
50586
|
...params
|
|
49693
50587
|
});
|
|
49694
50588
|
};
|
|
50589
|
+
var listProjectDatabaseWebhooks = (parameters, options) => {
|
|
50590
|
+
const params = buildClientParams([parameters], [
|
|
50591
|
+
{
|
|
50592
|
+
args: [
|
|
50593
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50594
|
+
{ in: "path", key: "project_id" },
|
|
50595
|
+
{ in: "query", key: "environment" }
|
|
50596
|
+
]
|
|
50597
|
+
}
|
|
50598
|
+
]);
|
|
50599
|
+
return (options?.client ?? client).get({
|
|
50600
|
+
responseStyle: "data",
|
|
50601
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50602
|
+
url: "/v1/projects/{project_id}/database/webhooks",
|
|
50603
|
+
...options,
|
|
50604
|
+
...params
|
|
50605
|
+
});
|
|
50606
|
+
};
|
|
50607
|
+
var createProjectDatabaseWebhook = (parameters, options) => {
|
|
50608
|
+
const params = buildClientParams([parameters], [
|
|
50609
|
+
{
|
|
50610
|
+
args: [
|
|
50611
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50612
|
+
{ in: "headers", key: "Idempotency-Key" },
|
|
50613
|
+
{ in: "path", key: "project_id" },
|
|
50614
|
+
{ in: "query", key: "environment" },
|
|
50615
|
+
{ key: "databaseWebhookCreateRequest", map: "body" }
|
|
50616
|
+
]
|
|
50617
|
+
}
|
|
50618
|
+
]);
|
|
50619
|
+
return (options?.client ?? client).post({
|
|
50620
|
+
responseStyle: "data",
|
|
50621
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50622
|
+
url: "/v1/projects/{project_id}/database/webhooks",
|
|
50623
|
+
...options,
|
|
50624
|
+
...params,
|
|
50625
|
+
headers: {
|
|
50626
|
+
"Content-Type": "application/json",
|
|
50627
|
+
...options?.headers,
|
|
50628
|
+
...params.headers
|
|
50629
|
+
}
|
|
50630
|
+
});
|
|
50631
|
+
};
|
|
50632
|
+
var deleteProjectDatabaseWebhook = (parameters, options) => {
|
|
50633
|
+
const params = buildClientParams([parameters], [
|
|
50634
|
+
{
|
|
50635
|
+
args: [
|
|
50636
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50637
|
+
{ in: "path", key: "project_id" },
|
|
50638
|
+
{ in: "path", key: "webhook_id" },
|
|
50639
|
+
{ in: "query", key: "environment" }
|
|
50640
|
+
]
|
|
50641
|
+
}
|
|
50642
|
+
]);
|
|
50643
|
+
return (options?.client ?? client).delete({
|
|
50644
|
+
responseStyle: "data",
|
|
50645
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50646
|
+
url: "/v1/projects/{project_id}/database/webhooks/{webhook_id}",
|
|
50647
|
+
...options,
|
|
50648
|
+
...params
|
|
50649
|
+
});
|
|
50650
|
+
};
|
|
50651
|
+
var getProjectDatabaseWebhook = (parameters, options) => {
|
|
50652
|
+
const params = buildClientParams([parameters], [
|
|
50653
|
+
{
|
|
50654
|
+
args: [
|
|
50655
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50656
|
+
{ in: "path", key: "project_id" },
|
|
50657
|
+
{ in: "path", key: "webhook_id" },
|
|
50658
|
+
{ in: "query", key: "environment" }
|
|
50659
|
+
]
|
|
50660
|
+
}
|
|
50661
|
+
]);
|
|
50662
|
+
return (options?.client ?? client).get({
|
|
50663
|
+
responseStyle: "data",
|
|
50664
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50665
|
+
url: "/v1/projects/{project_id}/database/webhooks/{webhook_id}",
|
|
50666
|
+
...options,
|
|
50667
|
+
...params
|
|
50668
|
+
});
|
|
50669
|
+
};
|
|
50670
|
+
var testProjectDatabaseWebhook = (parameters, options) => {
|
|
50671
|
+
const params = buildClientParams([parameters], [
|
|
50672
|
+
{
|
|
50673
|
+
args: [
|
|
50674
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50675
|
+
{ in: "path", key: "project_id" },
|
|
50676
|
+
{ in: "path", key: "webhook_id" },
|
|
50677
|
+
{ in: "query", key: "environment" }
|
|
50678
|
+
]
|
|
50679
|
+
}
|
|
50680
|
+
]);
|
|
50681
|
+
return (options?.client ?? client).post({
|
|
50682
|
+
responseStyle: "data",
|
|
50683
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50684
|
+
url: "/v1/projects/{project_id}/database/webhooks/{webhook_id}/test",
|
|
50685
|
+
...options,
|
|
50686
|
+
...params
|
|
50687
|
+
});
|
|
50688
|
+
};
|
|
50689
|
+
var listProjectDatabaseWebhookDeliveries = (parameters, options) => {
|
|
50690
|
+
const params = buildClientParams([parameters], [
|
|
50691
|
+
{
|
|
50692
|
+
args: [
|
|
50693
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50694
|
+
{ in: "path", key: "project_id" },
|
|
50695
|
+
{ in: "query", key: "environment" },
|
|
50696
|
+
{ in: "query", key: "webhook_id" },
|
|
50697
|
+
{ in: "query", key: "limit" },
|
|
50698
|
+
{ in: "query", key: "cursor" }
|
|
50699
|
+
]
|
|
50700
|
+
}
|
|
50701
|
+
]);
|
|
50702
|
+
return (options?.client ?? client).get({
|
|
50703
|
+
responseStyle: "data",
|
|
50704
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50705
|
+
url: "/v1/projects/{project_id}/database/webhook-deliveries",
|
|
50706
|
+
...options,
|
|
50707
|
+
...params
|
|
50708
|
+
});
|
|
50709
|
+
};
|
|
50710
|
+
var replayProjectDatabaseWebhookDelivery = (parameters, options) => {
|
|
50711
|
+
const params = buildClientParams([parameters], [
|
|
50712
|
+
{
|
|
50713
|
+
args: [
|
|
50714
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50715
|
+
{ in: "path", key: "project_id" },
|
|
50716
|
+
{ in: "path", key: "delivery_id" },
|
|
50717
|
+
{ in: "query", key: "environment" }
|
|
50718
|
+
]
|
|
50719
|
+
}
|
|
50720
|
+
]);
|
|
50721
|
+
return (options?.client ?? client).post({
|
|
50722
|
+
responseStyle: "data",
|
|
50723
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50724
|
+
url: "/v1/projects/{project_id}/database/webhook-deliveries/{delivery_id}/replay",
|
|
50725
|
+
...options,
|
|
50726
|
+
...params
|
|
50727
|
+
});
|
|
50728
|
+
};
|
|
50729
|
+
var listProjectDatabaseSchedules = (parameters, options) => {
|
|
50730
|
+
const params = buildClientParams([parameters], [
|
|
50731
|
+
{
|
|
50732
|
+
args: [
|
|
50733
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50734
|
+
{ in: "path", key: "project_id" },
|
|
50735
|
+
{ in: "query", key: "environment" }
|
|
50736
|
+
]
|
|
50737
|
+
}
|
|
50738
|
+
]);
|
|
50739
|
+
return (options?.client ?? client).get({
|
|
50740
|
+
responseStyle: "data",
|
|
50741
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50742
|
+
url: "/v1/projects/{project_id}/database/schedules",
|
|
50743
|
+
...options,
|
|
50744
|
+
...params
|
|
50745
|
+
});
|
|
50746
|
+
};
|
|
50747
|
+
var deleteProjectDatabaseSchedule = (parameters, options) => {
|
|
50748
|
+
const params = buildClientParams([parameters], [
|
|
50749
|
+
{
|
|
50750
|
+
args: [
|
|
50751
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50752
|
+
{ in: "path", key: "project_id" },
|
|
50753
|
+
{ in: "path", key: "name" },
|
|
50754
|
+
{ in: "query", key: "environment" }
|
|
50755
|
+
]
|
|
50756
|
+
}
|
|
50757
|
+
]);
|
|
50758
|
+
return (options?.client ?? client).delete({
|
|
50759
|
+
responseStyle: "data",
|
|
50760
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50761
|
+
url: "/v1/projects/{project_id}/database/schedules/{name}",
|
|
50762
|
+
...options,
|
|
50763
|
+
...params
|
|
50764
|
+
});
|
|
50765
|
+
};
|
|
50766
|
+
var getProjectDatabaseSchedule = (parameters, options) => {
|
|
50767
|
+
const params = buildClientParams([parameters], [
|
|
50768
|
+
{
|
|
50769
|
+
args: [
|
|
50770
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50771
|
+
{ in: "path", key: "project_id" },
|
|
50772
|
+
{ in: "path", key: "name" },
|
|
50773
|
+
{ in: "query", key: "environment" }
|
|
50774
|
+
]
|
|
50775
|
+
}
|
|
50776
|
+
]);
|
|
50777
|
+
return (options?.client ?? client).get({
|
|
50778
|
+
responseStyle: "data",
|
|
50779
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50780
|
+
url: "/v1/projects/{project_id}/database/schedules/{name}",
|
|
50781
|
+
...options,
|
|
50782
|
+
...params
|
|
50783
|
+
});
|
|
50784
|
+
};
|
|
50785
|
+
var setProjectDatabaseSchedule = (parameters, options) => {
|
|
50786
|
+
const params = buildClientParams([parameters], [
|
|
50787
|
+
{
|
|
50788
|
+
args: [
|
|
50789
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50790
|
+
{ in: "path", key: "project_id" },
|
|
50791
|
+
{ in: "path", key: "name" },
|
|
50792
|
+
{ in: "query", key: "environment" },
|
|
50793
|
+
{ key: "databaseScheduleSetRequest", map: "body" }
|
|
50794
|
+
]
|
|
50795
|
+
}
|
|
50796
|
+
]);
|
|
50797
|
+
return (options?.client ?? client).put({
|
|
50798
|
+
responseStyle: "data",
|
|
50799
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50800
|
+
url: "/v1/projects/{project_id}/database/schedules/{name}",
|
|
50801
|
+
...options,
|
|
50802
|
+
...params,
|
|
50803
|
+
headers: {
|
|
50804
|
+
"Content-Type": "application/json",
|
|
50805
|
+
...options?.headers,
|
|
50806
|
+
...params.headers
|
|
50807
|
+
}
|
|
50808
|
+
});
|
|
50809
|
+
};
|
|
50810
|
+
var listProjectDatabaseScheduleRuns = (parameters, options) => {
|
|
50811
|
+
const params = buildClientParams([parameters], [
|
|
50812
|
+
{
|
|
50813
|
+
args: [
|
|
50814
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50815
|
+
{ in: "path", key: "project_id" },
|
|
50816
|
+
{ in: "path", key: "name" },
|
|
50817
|
+
{ in: "query", key: "environment" },
|
|
50818
|
+
{ in: "query", key: "limit" }
|
|
50819
|
+
]
|
|
50820
|
+
}
|
|
50821
|
+
]);
|
|
50822
|
+
return (options?.client ?? client).get({
|
|
50823
|
+
responseStyle: "data",
|
|
50824
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50825
|
+
url: "/v1/projects/{project_id}/database/schedules/{name}/runs",
|
|
50826
|
+
...options,
|
|
50827
|
+
...params
|
|
50828
|
+
});
|
|
50829
|
+
};
|
|
50830
|
+
var runProjectDatabaseSchedule = (parameters, options) => {
|
|
50831
|
+
const params = buildClientParams([parameters], [
|
|
50832
|
+
{
|
|
50833
|
+
args: [
|
|
50834
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50835
|
+
{ in: "path", key: "project_id" },
|
|
50836
|
+
{ in: "path", key: "name" },
|
|
50837
|
+
{ in: "query", key: "environment" }
|
|
50838
|
+
]
|
|
50839
|
+
}
|
|
50840
|
+
]);
|
|
50841
|
+
return (options?.client ?? client).post({
|
|
50842
|
+
responseStyle: "data",
|
|
50843
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50844
|
+
url: "/v1/projects/{project_id}/database/schedules/{name}/run",
|
|
50845
|
+
...options,
|
|
50846
|
+
...params
|
|
50847
|
+
});
|
|
50848
|
+
};
|
|
50849
|
+
var getProjectDatabaseExecutionUsage = (parameters, options) => {
|
|
50850
|
+
const params = buildClientParams([parameters], [
|
|
50851
|
+
{
|
|
50852
|
+
args: [
|
|
50853
|
+
{ in: "headers", key: "X-Request-Id" },
|
|
50854
|
+
{ in: "path", key: "project_id" },
|
|
50855
|
+
{ in: "query", key: "environment" },
|
|
50856
|
+
{ in: "query", key: "from" },
|
|
50857
|
+
{ in: "query", key: "to" },
|
|
50858
|
+
{ in: "query", key: "granularity" },
|
|
50859
|
+
{ in: "query", key: "limit" },
|
|
50860
|
+
{ in: "query", key: "cursor" }
|
|
50861
|
+
]
|
|
50862
|
+
}
|
|
50863
|
+
]);
|
|
50864
|
+
return (options?.client ?? client).get({
|
|
50865
|
+
responseStyle: "data",
|
|
50866
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
50867
|
+
url: "/v1/projects/{project_id}/database/execution-usage",
|
|
50868
|
+
...options,
|
|
50869
|
+
...params
|
|
50870
|
+
});
|
|
50871
|
+
};
|
|
49695
50872
|
var planDeploymentRollback = (parameters, options) => {
|
|
49696
50873
|
const params = buildClientParams([parameters], [
|
|
49697
50874
|
{
|
|
@@ -50143,7 +51320,7 @@ var ULID3 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
|
|
|
50143
51320
|
function assertManagedMailResponse(value, input) {
|
|
50144
51321
|
const r = object2(value);
|
|
50145
51322
|
if (input.action === "configure" || input.action === "status" || input.action === "webhook_verify") {
|
|
50146
|
-
|
|
51323
|
+
exact5(r, [
|
|
50147
51324
|
"domain_id",
|
|
50148
51325
|
"domain",
|
|
50149
51326
|
"environment_id",
|
|
@@ -50173,14 +51350,14 @@ function assertManagedMailResponse(value, input) {
|
|
|
50173
51350
|
invalid5();
|
|
50174
51351
|
if (r["webhook"] !== null) {
|
|
50175
51352
|
const hook = object2(r["webhook"]);
|
|
50176
|
-
|
|
51353
|
+
exact5(hook, ["url", "verified"]);
|
|
50177
51354
|
https(hook["url"]);
|
|
50178
51355
|
if (typeof hook["verified"] !== "boolean")
|
|
50179
51356
|
invalid5();
|
|
50180
51357
|
}
|
|
50181
51358
|
if (r["dns"] !== void 0) {
|
|
50182
51359
|
const dns = object2(r["dns"]);
|
|
50183
|
-
|
|
51360
|
+
exact5(dns, ["status", "records"]);
|
|
50184
51361
|
if (!["configured", "action_required", "conflict"].includes(String(dns["status"])))
|
|
50185
51362
|
invalid5();
|
|
50186
51363
|
records(dns["records"]);
|
|
@@ -50188,19 +51365,19 @@ function assertManagedMailResponse(value, input) {
|
|
|
50188
51365
|
return;
|
|
50189
51366
|
}
|
|
50190
51367
|
if (input.action === "webhook_set") {
|
|
50191
|
-
|
|
51368
|
+
exact5(r, ["url", "signing_secret", "status"]);
|
|
50192
51369
|
if (r["url"] !== input.url || r["status"] !== "verification_required" || typeof r["signing_secret"] !== "string" || !/^whsec_[A-Za-z0-9+/]{43}=$/u.test(r["signing_secret"]))
|
|
50193
51370
|
invalid5();
|
|
50194
51371
|
return;
|
|
50195
51372
|
}
|
|
50196
51373
|
if (input.action === "webhook_disable") {
|
|
50197
|
-
|
|
51374
|
+
exact5(r, ["status"]);
|
|
50198
51375
|
if (r["status"] !== "disabled")
|
|
50199
51376
|
invalid5();
|
|
50200
51377
|
return;
|
|
50201
51378
|
}
|
|
50202
51379
|
if (input.action === "domain_delete") {
|
|
50203
|
-
|
|
51380
|
+
exact5(r, ["status", "domain", "dns_records"]);
|
|
50204
51381
|
if (r["status"] !== "deleted")
|
|
50205
51382
|
invalid5();
|
|
50206
51383
|
domain(r["domain"]);
|
|
@@ -50208,12 +51385,12 @@ function assertManagedMailResponse(value, input) {
|
|
|
50208
51385
|
return;
|
|
50209
51386
|
}
|
|
50210
51387
|
if (input.action === "messages_list") {
|
|
50211
|
-
|
|
51388
|
+
exact5(r, ["items"]);
|
|
50212
51389
|
if (!Array.isArray(r["items"]) || r["items"].length > 50)
|
|
50213
51390
|
invalid5();
|
|
50214
51391
|
for (const value2 of r["items"]) {
|
|
50215
51392
|
const item = object2(value2);
|
|
50216
|
-
|
|
51393
|
+
exact5(item, ["message_id", "received_at", "state", "attempts"]);
|
|
50217
51394
|
id2(item["message_id"]);
|
|
50218
51395
|
time(item["received_at"]);
|
|
50219
51396
|
if (!["pending", "delivering", "delivered", "delivery_failed", "expired"].includes(String(item["state"])) || !Number.isInteger(item["attempts"]) || Number(item["attempts"]) < 0 || Number(item["attempts"]) > 4)
|
|
@@ -50222,7 +51399,7 @@ function assertManagedMailResponse(value, input) {
|
|
|
50222
51399
|
return;
|
|
50223
51400
|
}
|
|
50224
51401
|
if (input.action === "message_retry") {
|
|
50225
|
-
|
|
51402
|
+
exact5(r, ["attempted"], ["delivered"]);
|
|
50226
51403
|
if (typeof r["attempted"] !== "boolean" || r["delivered"] !== void 0 && typeof r["delivered"] !== "boolean")
|
|
50227
51404
|
invalid5();
|
|
50228
51405
|
return;
|
|
@@ -50230,10 +51407,10 @@ function assertManagedMailResponse(value, input) {
|
|
|
50230
51407
|
if (input.action !== "message_get")
|
|
50231
51408
|
invalid5();
|
|
50232
51409
|
if (r["status"] === "expired") {
|
|
50233
|
-
|
|
51410
|
+
exact5(r, ["status"]);
|
|
50234
51411
|
return;
|
|
50235
51412
|
}
|
|
50236
|
-
|
|
51413
|
+
exact5(r, [
|
|
50237
51414
|
"id",
|
|
50238
51415
|
"domain",
|
|
50239
51416
|
"received_at",
|
|
@@ -50265,7 +51442,7 @@ function assertManagedMailResponse(value, input) {
|
|
|
50265
51442
|
invalid5();
|
|
50266
51443
|
for (const value2 of r["attachments"]) {
|
|
50267
51444
|
const a = object2(value2);
|
|
50268
|
-
|
|
51445
|
+
exact5(a, ["id", "filename", "content_type", "download_path"]);
|
|
50269
51446
|
if (typeof a["id"] !== "string" || !/^[A-Za-z0-9_-]{1,128}$/u.test(a["id"]) || a["filename"] !== null && typeof a["filename"] !== "string" || typeof a["content_type"] !== "string" || a["download_path"] !== `/v1/projects/${input.projectId}/environments/${input.environmentId}/mail/messages/${input.messageId}/attachments/${a["id"]}`)
|
|
50270
51447
|
invalid5();
|
|
50271
51448
|
}
|
|
@@ -50275,7 +51452,7 @@ function object2(v) {
|
|
|
50275
51452
|
invalid5();
|
|
50276
51453
|
return v;
|
|
50277
51454
|
}
|
|
50278
|
-
function
|
|
51455
|
+
function exact5(v, required, optional = []) {
|
|
50279
51456
|
if (required.some((k) => !(k in v)) || Object.keys(v).some((k) => !required.includes(k) && !optional.includes(k)))
|
|
50280
51457
|
invalid5();
|
|
50281
51458
|
}
|
|
@@ -50300,7 +51477,7 @@ function records(v) {
|
|
|
50300
51477
|
invalid5();
|
|
50301
51478
|
for (const value of v) {
|
|
50302
51479
|
const r = object2(value);
|
|
50303
|
-
|
|
51480
|
+
exact5(r, ["type", "name", "value", "purpose", "status"], ["priority"]);
|
|
50304
51481
|
if (!["TXT", "CNAME", "MX"].includes(String(r["type"])) || ["name", "value", "purpose", "status"].some((k) => typeof r[k] !== "string") || r["type"] === "MX" && (!Number.isInteger(r["priority"]) || Number(r["priority"]) < 0 || Number(r["priority"]) > 65535))
|
|
50305
51482
|
invalid5();
|
|
50306
51483
|
}
|
|
@@ -50357,7 +51534,7 @@ var HOST = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}
|
|
|
50357
51534
|
function assertSharedMailResponse(value, input) {
|
|
50358
51535
|
const v = object3(value);
|
|
50359
51536
|
if (input.action === "domains_list") {
|
|
50360
|
-
|
|
51537
|
+
exact6(v, ["items"]);
|
|
50361
51538
|
if (!Array.isArray(v["items"]) || v["items"].length > 100)
|
|
50362
51539
|
invalid6();
|
|
50363
51540
|
for (const item of v["items"])
|
|
@@ -50369,7 +51546,7 @@ function assertSharedMailResponse(value, input) {
|
|
|
50369
51546
|
return;
|
|
50370
51547
|
}
|
|
50371
51548
|
if (["domain_get", "domain_create", "domain_retire"].includes(input.action)) {
|
|
50372
|
-
|
|
51549
|
+
exact6(v, [
|
|
50373
51550
|
"domain_id",
|
|
50374
51551
|
"organization_id",
|
|
50375
51552
|
"domain",
|
|
@@ -50402,7 +51579,7 @@ function assertSharedMailResponse(value, input) {
|
|
|
50402
51579
|
invalid6();
|
|
50403
51580
|
for (const entry of v["dns_records"]) {
|
|
50404
51581
|
const r = object3(entry);
|
|
50405
|
-
|
|
51582
|
+
exact6(r, ["type", "name", "value", "purpose", "status"], ["priority"]);
|
|
50406
51583
|
member(r["type"], ["TXT", "MX", "CNAME"]);
|
|
50407
51584
|
for (const k of ["name", "value", "purpose", "status"])
|
|
50408
51585
|
if (typeof r[k] !== "string" || /[\r\n\0]/u.test(r[k]))
|
|
@@ -50415,7 +51592,7 @@ function assertSharedMailResponse(value, input) {
|
|
|
50415
51592
|
return;
|
|
50416
51593
|
}
|
|
50417
51594
|
if (["binding_get", "binding_set", "binding_detach"].includes(input.action)) {
|
|
50418
|
-
|
|
51595
|
+
exact6(v, [
|
|
50419
51596
|
"mail_domain_id",
|
|
50420
51597
|
"organization_id",
|
|
50421
51598
|
"project_id",
|
|
@@ -50449,7 +51626,7 @@ function assertSharedMailResponse(value, input) {
|
|
|
50449
51626
|
invalid6();
|
|
50450
51627
|
if (v["application_domain_identity"] !== null) {
|
|
50451
51628
|
const identity = object3(v["application_domain_identity"]);
|
|
50452
|
-
|
|
51629
|
+
exact6(identity, ["hostname", "registrable_domain", "revision", "status"]);
|
|
50453
51630
|
host(identity["hostname"]);
|
|
50454
51631
|
host(identity["registrable_domain"]);
|
|
50455
51632
|
positive(identity["revision"]);
|
|
@@ -50458,7 +51635,7 @@ function assertSharedMailResponse(value, input) {
|
|
|
50458
51635
|
return;
|
|
50459
51636
|
}
|
|
50460
51637
|
if (["identity_get", "identity_declare", "identity_verify", "identity_revoke"].includes(input.action)) {
|
|
50461
|
-
|
|
51638
|
+
exact6(v, [
|
|
50462
51639
|
"organization_id",
|
|
50463
51640
|
"project_id",
|
|
50464
51641
|
"hostname",
|
|
@@ -50478,7 +51655,7 @@ function assertSharedMailResponse(value, input) {
|
|
|
50478
51655
|
positive(v["revision"]);
|
|
50479
51656
|
member(v["status"], ["pending", "verified", "expired", "revoked"]);
|
|
50480
51657
|
const challenge = object3(v["challenge"]);
|
|
50481
|
-
|
|
51658
|
+
exact6(challenge, ["type", "name", "value"]);
|
|
50482
51659
|
if (challenge["type"] !== "TXT" || typeof challenge["name"] !== "string" || challenge["name"] !== `_omh-project.${v["hostname"]}` || typeof challenge["value"] !== "string" || challenge["value"].length < 16 || challenge["value"].length > 255 || /[\r\n\0]/u.test(challenge["value"]))
|
|
50483
51660
|
invalid6();
|
|
50484
51661
|
if (v["verified_at"] !== null)
|
|
@@ -50487,14 +51664,14 @@ function assertSharedMailResponse(value, input) {
|
|
|
50487
51664
|
return;
|
|
50488
51665
|
}
|
|
50489
51666
|
if (input.action === "domain_dns_authorize" || input.action === "identity_authorize") {
|
|
50490
|
-
|
|
51667
|
+
exact6(v, ["authorization_id", "authorization_url", "expires_at"]);
|
|
50491
51668
|
id3(v["authorization_id"]);
|
|
50492
51669
|
time2(v["expires_at"]);
|
|
50493
51670
|
if (typeof v["authorization_url"] !== "string" || !/^https:\/\/dash\.cloudflare\.com\/oauth2\/auth\?/u.test(v["authorization_url"]))
|
|
50494
51671
|
invalid6();
|
|
50495
51672
|
return;
|
|
50496
51673
|
}
|
|
50497
|
-
|
|
51674
|
+
exact6(v, ["status", "zone", "scopes", "expires_at"]);
|
|
50498
51675
|
member(v["status"], ["not_authorized", "pending", "authorized", "expired", "revoked"]);
|
|
50499
51676
|
if (!Array.isArray(v["scopes"]) || v["scopes"].length > 2 || new Set(v["scopes"]).size !== v["scopes"].length || v["scopes"].some((s) => s !== "dns.write" && s !== "zone.read"))
|
|
50500
51677
|
invalid6();
|
|
@@ -50510,7 +51687,7 @@ function object3(v) {
|
|
|
50510
51687
|
invalid6();
|
|
50511
51688
|
return v;
|
|
50512
51689
|
}
|
|
50513
|
-
function
|
|
51690
|
+
function exact6(v, required, optional = []) {
|
|
50514
51691
|
if (required.some((k) => !(k in v)) || Object.keys(v).some((k) => !required.includes(k) && !optional.includes(k)))
|
|
50515
51692
|
invalid6();
|
|
50516
51693
|
}
|
|
@@ -50781,6 +51958,8 @@ function checkedResponse(kind, value) {
|
|
|
50781
51958
|
}
|
|
50782
51959
|
|
|
50783
51960
|
// apps/product-cli/dist/product-api.js
|
|
51961
|
+
var WEBHOOK_SCOPE_MISMATCH = "Webhook response scope mismatch";
|
|
51962
|
+
var SCHEDULE_SCOPE_MISMATCH = "Schedule response scope mismatch";
|
|
50784
51963
|
var GeneratedSdkProductApi = class {
|
|
50785
51964
|
#client;
|
|
50786
51965
|
managedSource;
|
|
@@ -50977,6 +52156,159 @@ var GeneratedSdkProductApi = class {
|
|
|
50977
52156
|
assertProjectDatabaseAccess(value);
|
|
50978
52157
|
return value;
|
|
50979
52158
|
}
|
|
52159
|
+
/** The signing secret exists only in this answer; the CLI prints it once and stores nothing. */
|
|
52160
|
+
async createProjectDatabaseWebhook(input) {
|
|
52161
|
+
const value = await createProjectDatabaseWebhook({
|
|
52162
|
+
project_id: input.projectId,
|
|
52163
|
+
environment: input.environment,
|
|
52164
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
52165
|
+
databaseWebhookCreateRequest: {
|
|
52166
|
+
url: input.url,
|
|
52167
|
+
event_types: [...input.eventTypes],
|
|
52168
|
+
headers: { ...input.headers }
|
|
52169
|
+
}
|
|
52170
|
+
}, { client: this.#client });
|
|
52171
|
+
assertDatabaseWebhookCreated(value);
|
|
52172
|
+
if (value.environment !== input.environment)
|
|
52173
|
+
throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
|
|
52174
|
+
return value;
|
|
52175
|
+
}
|
|
52176
|
+
async listProjectDatabaseWebhooks(input) {
|
|
52177
|
+
const value = await listProjectDatabaseWebhooks({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
|
|
52178
|
+
assertDatabaseWebhookPage(value);
|
|
52179
|
+
if (value.items.some((item) => item.environment !== input.environment))
|
|
52180
|
+
throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
|
|
52181
|
+
return value;
|
|
52182
|
+
}
|
|
52183
|
+
async getProjectDatabaseWebhook(input) {
|
|
52184
|
+
const value = await getProjectDatabaseWebhook({
|
|
52185
|
+
project_id: input.projectId,
|
|
52186
|
+
environment: input.environment,
|
|
52187
|
+
webhook_id: input.webhookId
|
|
52188
|
+
}, { client: this.#client });
|
|
52189
|
+
assertDatabaseWebhook(value);
|
|
52190
|
+
if (value.id !== input.webhookId || value.environment !== input.environment)
|
|
52191
|
+
throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
|
|
52192
|
+
return value;
|
|
52193
|
+
}
|
|
52194
|
+
async deleteProjectDatabaseWebhook(input) {
|
|
52195
|
+
const value = await deleteProjectDatabaseWebhook({
|
|
52196
|
+
project_id: input.projectId,
|
|
52197
|
+
environment: input.environment,
|
|
52198
|
+
webhook_id: input.webhookId
|
|
52199
|
+
}, { client: this.#client });
|
|
52200
|
+
assertDatabaseWebhookDeleted(value);
|
|
52201
|
+
if (value.id !== input.webhookId)
|
|
52202
|
+
throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
|
|
52203
|
+
return value;
|
|
52204
|
+
}
|
|
52205
|
+
async testProjectDatabaseWebhook(input) {
|
|
52206
|
+
const value = await testProjectDatabaseWebhook({
|
|
52207
|
+
project_id: input.projectId,
|
|
52208
|
+
environment: input.environment,
|
|
52209
|
+
webhook_id: input.webhookId
|
|
52210
|
+
}, { client: this.#client });
|
|
52211
|
+
assertDatabaseWebhookTest(value);
|
|
52212
|
+
return value;
|
|
52213
|
+
}
|
|
52214
|
+
async listProjectDatabaseWebhookDeliveries(input) {
|
|
52215
|
+
const value = await listProjectDatabaseWebhookDeliveries({
|
|
52216
|
+
project_id: input.projectId,
|
|
52217
|
+
environment: input.environment,
|
|
52218
|
+
...input.webhookId === void 0 ? {} : { webhook_id: input.webhookId },
|
|
52219
|
+
...input.limit === void 0 ? {} : { limit: input.limit },
|
|
52220
|
+
...input.cursor === void 0 ? {} : { cursor: input.cursor }
|
|
52221
|
+
}, { client: this.#client });
|
|
52222
|
+
assertDatabaseWebhookDeliveryPage(value);
|
|
52223
|
+
if (input.webhookId !== void 0 && value.items.some((item) => item.webhook_id !== input.webhookId))
|
|
52224
|
+
throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
|
|
52225
|
+
return value;
|
|
52226
|
+
}
|
|
52227
|
+
async replayProjectDatabaseWebhookDelivery(input) {
|
|
52228
|
+
const value = await replayProjectDatabaseWebhookDelivery({
|
|
52229
|
+
project_id: input.projectId,
|
|
52230
|
+
environment: input.environment,
|
|
52231
|
+
delivery_id: input.deliveryId
|
|
52232
|
+
}, { client: this.#client });
|
|
52233
|
+
assertDatabaseWebhookReplayAccepted(value);
|
|
52234
|
+
if (value.delivery_id !== input.deliveryId)
|
|
52235
|
+
throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
|
|
52236
|
+
return value;
|
|
52237
|
+
}
|
|
52238
|
+
/** A schedule runs the statements as the application's runtime role; the request confirms it. */
|
|
52239
|
+
async setProjectDatabaseSchedule(input) {
|
|
52240
|
+
const request = input.request;
|
|
52241
|
+
const value = await setProjectDatabaseSchedule({
|
|
52242
|
+
project_id: input.projectId,
|
|
52243
|
+
environment: input.environment,
|
|
52244
|
+
name: input.name,
|
|
52245
|
+
databaseScheduleSetRequest: {
|
|
52246
|
+
...request.cron === null ? {} : { cron: request.cron },
|
|
52247
|
+
...request.every_seconds === null ? {} : { every_seconds: request.every_seconds },
|
|
52248
|
+
statements: [...request.statements],
|
|
52249
|
+
timeout_ms: request.timeout_ms,
|
|
52250
|
+
enabled: request.enabled,
|
|
52251
|
+
confirm: true
|
|
52252
|
+
}
|
|
52253
|
+
}, { client: this.#client });
|
|
52254
|
+
assertDatabaseSchedule(value);
|
|
52255
|
+
if (value.name !== input.name || value.environment !== input.environment)
|
|
52256
|
+
throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
|
|
52257
|
+
return value;
|
|
52258
|
+
}
|
|
52259
|
+
async listProjectDatabaseSchedules(input) {
|
|
52260
|
+
const value = await listProjectDatabaseSchedules({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
|
|
52261
|
+
assertDatabaseSchedulePage(value);
|
|
52262
|
+
if (value.items.some((item) => item.environment !== input.environment))
|
|
52263
|
+
throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
|
|
52264
|
+
return value;
|
|
52265
|
+
}
|
|
52266
|
+
async getProjectDatabaseSchedule(input) {
|
|
52267
|
+
const value = await getProjectDatabaseSchedule({ project_id: input.projectId, environment: input.environment, name: input.name }, { client: this.#client });
|
|
52268
|
+
assertDatabaseSchedule(value);
|
|
52269
|
+
if (value.name !== input.name || value.environment !== input.environment)
|
|
52270
|
+
throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
|
|
52271
|
+
return value;
|
|
52272
|
+
}
|
|
52273
|
+
async deleteProjectDatabaseSchedule(input) {
|
|
52274
|
+
const value = await deleteProjectDatabaseSchedule({ project_id: input.projectId, environment: input.environment, name: input.name }, { client: this.#client });
|
|
52275
|
+
assertDatabaseScheduleDeleted(value);
|
|
52276
|
+
if (value.name !== input.name)
|
|
52277
|
+
throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
|
|
52278
|
+
return value;
|
|
52279
|
+
}
|
|
52280
|
+
async listProjectDatabaseScheduleRuns(input) {
|
|
52281
|
+
const value = await listProjectDatabaseScheduleRuns({
|
|
52282
|
+
project_id: input.projectId,
|
|
52283
|
+
environment: input.environment,
|
|
52284
|
+
name: input.name,
|
|
52285
|
+
...input.limit === void 0 ? {} : { limit: input.limit }
|
|
52286
|
+
}, { client: this.#client });
|
|
52287
|
+
assertDatabaseScheduleRunPage(value);
|
|
52288
|
+
if (value.items.some((item) => item.schedule !== input.name))
|
|
52289
|
+
throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
|
|
52290
|
+
return value;
|
|
52291
|
+
}
|
|
52292
|
+
async runProjectDatabaseSchedule(input) {
|
|
52293
|
+
const value = await runProjectDatabaseSchedule({ project_id: input.projectId, environment: input.environment, name: input.name }, { client: this.#client });
|
|
52294
|
+
assertDatabaseScheduleRunAccepted(value);
|
|
52295
|
+
if (value.schedule !== input.name)
|
|
52296
|
+
throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
|
|
52297
|
+
return value;
|
|
52298
|
+
}
|
|
52299
|
+
async getProjectDatabaseExecutionUsage(input) {
|
|
52300
|
+
const value = await getProjectDatabaseExecutionUsage({
|
|
52301
|
+
project_id: input.projectId,
|
|
52302
|
+
environment: input.environment,
|
|
52303
|
+
from: input.from,
|
|
52304
|
+
to: input.to,
|
|
52305
|
+
granularity: input.granularity,
|
|
52306
|
+
...input.limit === void 0 ? {} : { limit: input.limit },
|
|
52307
|
+
...input.cursor === void 0 ? {} : { cursor: input.cursor }
|
|
52308
|
+
}, { client: this.#client });
|
|
52309
|
+
assertDatabaseExecutionUsagePage(value);
|
|
52310
|
+
return value;
|
|
52311
|
+
}
|
|
50980
52312
|
async planPaidDomain(input) {
|
|
50981
52313
|
return planPaidProjectDomain({ project_id: input.projectId, paidDomainRequest: { hostname: input.hostname } }, { client: this.#client });
|
|
50982
52314
|
}
|
|
@@ -52430,8 +53762,8 @@ function pnpmLockedVersion(document2, packageName) {
|
|
|
52430
53762
|
}
|
|
52431
53763
|
return null;
|
|
52432
53764
|
}
|
|
52433
|
-
function ownValue(
|
|
52434
|
-
return isRecord4(
|
|
53765
|
+
function ownValue(record7, key) {
|
|
53766
|
+
return isRecord4(record7) && Object.hasOwn(record7, key) ? record7[key] : void 0;
|
|
52435
53767
|
}
|
|
52436
53768
|
function isRecord4(value) {
|
|
52437
53769
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -54482,10 +55814,6 @@ async function startBridge(raw, hooks = {}) {
|
|
|
54482
55814
|
finish();
|
|
54483
55815
|
});
|
|
54484
55816
|
upstream.on("ping", (data) => {
|
|
54485
|
-
if (upstream.bufferedAmount >= STREAM_BYTES) {
|
|
54486
|
-
finish();
|
|
54487
|
-
return;
|
|
54488
|
-
}
|
|
54489
55817
|
upstream.pong(data, true, (error) => {
|
|
54490
55818
|
if (error)
|
|
54491
55819
|
finish();
|
|
@@ -54531,9 +55859,9 @@ async function startBridge(raw, hooks = {}) {
|
|
|
54531
55859
|
// apps/product-cli/dist/psql-session.js
|
|
54532
55860
|
var runLocalPsql = async (input) => {
|
|
54533
55861
|
input.signal.throwIfAborted();
|
|
54534
|
-
if (input.websocketUrl !==
|
|
55862
|
+
if (input.websocketUrl !== `wss://${input.host}/`)
|
|
54535
55863
|
throw new Error("Invalid PGCF transport");
|
|
54536
|
-
const bridge =
|
|
55864
|
+
const bridge = await startBridge({
|
|
54537
55865
|
endpoint: input.websocketUrl,
|
|
54538
55866
|
database: input.database,
|
|
54539
55867
|
user: input.user,
|
|
@@ -54543,18 +55871,16 @@ var runLocalPsql = async (input) => {
|
|
|
54543
55871
|
input.signal.throwIfAborted();
|
|
54544
55872
|
const environment = Object.fromEntries(Object.entries(process.env).filter(([key]) => !/^PG[A-Z_]+$/iu.test(key)));
|
|
54545
55873
|
return await new Promise((resolve7, reject) => {
|
|
54546
|
-
const child = spawn("psql", ["-h", bridge
|
|
55874
|
+
const child = spawn("psql", ["-h", bridge.host, "-U", input.user, "-d", input.database], {
|
|
54547
55875
|
stdio: "inherit",
|
|
54548
55876
|
signal: input.signal,
|
|
54549
55877
|
env: {
|
|
54550
55878
|
...environment,
|
|
54551
55879
|
PGPASSWORD: input.password,
|
|
54552
|
-
PGSSLMODE:
|
|
54553
|
-
|
|
54554
|
-
|
|
54555
|
-
|
|
54556
|
-
PGGSSENCMODE: "disable"
|
|
54557
|
-
} : {}
|
|
55880
|
+
PGSSLMODE: "disable",
|
|
55881
|
+
PGPORT: String(bridge.port),
|
|
55882
|
+
PGCHANNELBINDING: "disable",
|
|
55883
|
+
PGGSSENCMODE: "disable"
|
|
54558
55884
|
}
|
|
54559
55885
|
});
|
|
54560
55886
|
child.once("error", (error) => {
|
|
@@ -54565,7 +55891,7 @@ var runLocalPsql = async (input) => {
|
|
|
54565
55891
|
});
|
|
54566
55892
|
});
|
|
54567
55893
|
} finally {
|
|
54568
|
-
await bridge
|
|
55894
|
+
await bridge.close();
|
|
54569
55895
|
}
|
|
54570
55896
|
};
|
|
54571
55897
|
|
|
@@ -54851,7 +56177,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
|
|
|
54851
56177
|
return written(errorDocument(recognizedCommandLabel(args), 2, "linked_project_selection_required", false, `This directory is linked to projects of several organizations (${error.organizationIds.join(", ")}). Pass --project ULID, or choose the login with --profile-name NAME; '${resolveProductCliEnvironment(environment).commandPrefix} profile list --json' shows the saved logins.`));
|
|
54852
56178
|
if (error instanceof CredentialStoreUnavailableError)
|
|
54853
56179
|
return written(errorDocument(recognizedCommandLabel(args), 3, "credential_store_unavailable", false, CREDENTIAL_STORE_UNAVAILABLE_ACTION));
|
|
54854
|
-
const result = error instanceof InvalidCommandError ? invalidCommandFailure(args, environment) : errorDocument(recognizedCommandLabel(args), 1, "internal_error", false,
|
|
56180
|
+
const result = error instanceof InvalidCommandError ? invalidCommandFailure(args, environment) : errorDocument(recognizedCommandLabel(args), 1, "internal_error", false, internalErrorAction(recognizedCommandLabel(args)));
|
|
54855
56181
|
if (!(error instanceof InvalidCommandError)) {
|
|
54856
56182
|
diagnostics.record({
|
|
54857
56183
|
correlationId: randomUUID3(),
|
|
@@ -54880,6 +56206,8 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
|
|
|
54880
56206
|
return written(error instanceof SourceWorkspaceError || error instanceof LocalSourcePublicationError ? errorDocument("source inspect", 2, error.code, false, error.message) : classifyCliFailure("source inspect", error, signal));
|
|
54881
56207
|
}
|
|
54882
56208
|
}
|
|
56209
|
+
if (command.kind === "help" && command.topic !== void 0 && !helpTopicKnown(command.topic))
|
|
56210
|
+
return written(invalidCommandFailure(args, environment));
|
|
54883
56211
|
if (command.kind === "help" || command.kind === "version") {
|
|
54884
56212
|
return written(cliMetadataResult(command.kind, command.kind === "help" ? command.topic : void 0));
|
|
54885
56213
|
}
|
|
@@ -55157,7 +56485,7 @@ var runOfflineInit = async (command, io, diagnostics) => {
|
|
|
55157
56485
|
});
|
|
55158
56486
|
const code = error instanceof RepositoryInitBlockedError ? "repository_init_blocked" : error instanceof RepositoryInitConflictError ? "repository_configuration_exists" : known ? error.code : "internal_error";
|
|
55159
56487
|
const exitCode = error instanceof RepositoryInitBlockedError ? 9 : known ? 2 : 1;
|
|
55160
|
-
const result = errorDocument("init", exitCode, code, false, known ? initFailureAction(error) :
|
|
56488
|
+
const result = errorDocument("init", exitCode, code, false, known ? initFailureAction(error) : internalErrorAction("init"));
|
|
55161
56489
|
io.writeStdout(result.stdout);
|
|
55162
56490
|
return result.exitCode;
|
|
55163
56491
|
}
|
|
@@ -55617,9 +56945,10 @@ export {
|
|
|
55617
56945
|
SecretInputError,
|
|
55618
56946
|
PublicResponseTooLargeError,
|
|
55619
56947
|
PsqlUnavailableError,
|
|
56948
|
+
helpTopicKnown,
|
|
55620
56949
|
cliMetadataResult,
|
|
55621
56950
|
invalidCommandAction,
|
|
55622
|
-
|
|
56951
|
+
internalErrorAction,
|
|
55623
56952
|
CREDENTIAL_STORE_UNAVAILABLE_ACTION,
|
|
55624
56953
|
endedLoginAction,
|
|
55625
56954
|
refreshFailedAction,
|