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