@amerged/ohmyhost-cli 0.1.55 → 0.1.57
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-4OAAJX5B.js → chunk-GODV5QDC.js} +797 -86
- package/dist/index.js +9 -1
- package/package.json +1 -1
- package/src/apps/product-cli/package.json +1 -1
- package/src/apps/product-cli/src/cli.ts +208 -11
- package/src/apps/product-cli/src/command.ts +276 -19
- package/src/apps/product-cli/src/index.ts +1 -0
- package/src/apps/product-cli/src/product-api.ts +165 -3
- package/src/apps/product-cli/src/repository-init.ts +8 -0
- package/src/apps/product-cli/src/runtime-contract.ts +81 -5
- package/src/apps/product-cli/src/user-token-file.ts +73 -0
- package/src/packages/contracts/package.json +5 -0
- package/src/packages/contracts/src/credit-pricing.ts +1 -1
- package/src/packages/contracts/src/database-events.ts +67 -0
- package/src/packages/contracts/src/framework-admission.ts +5 -4
- package/src/packages/contracts/src/framework-source-rules.ts +9 -2
- package/src/packages/contracts/src/index.ts +9 -0
- package/src/packages/contracts/src/operation-deployment-result.ts +121 -1
- package/src/packages/contracts/src/operation-failure.ts +72 -1
- package/src/packages/contracts/src/organization-mcp-connections.ts +7 -0
- package/src/packages/contracts/src/problem-policy.ts +17 -5
- package/src/packages/contracts/src/secret-names.ts +10 -2
- package/src/packages/sdk-ts/package.json +1 -1
- package/src/packages/sdk-ts/src/generated/index.ts +36 -0
- package/src/packages/sdk-ts/src/generated/sdk.gen.ts +265 -1
- package/src/packages/sdk-ts/src/generated/types.gen.ts +445 -2
- package/src/packages/sdk-ts/src/managed-mail-response.ts +12 -0
- package/src/packages/sdk-ts/src/managed-mail.ts +10 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isUserSecretName } from "@ohmyhost/contracts/secret-names";
|
|
2
|
+
import { MCP_CONNECTION_ID_PATTERN } from "@ohmyhost/contracts/organization-mcp-connections";
|
|
2
3
|
import {
|
|
3
4
|
DATABASE_PAGE_MAX_ITEMS,
|
|
4
5
|
parseDatabaseCursor,
|
|
@@ -124,6 +125,24 @@ export type ProductCliCommand =
|
|
|
124
125
|
readonly organizationId: string;
|
|
125
126
|
readonly credentialStore: "native";
|
|
126
127
|
}
|
|
128
|
+
| {
|
|
129
|
+
readonly kind: "github-disconnect";
|
|
130
|
+
readonly organizationId: string;
|
|
131
|
+
readonly yes: true;
|
|
132
|
+
readonly credentialStore: "native";
|
|
133
|
+
}
|
|
134
|
+
| {
|
|
135
|
+
readonly kind: "organization-mcp-connections-list";
|
|
136
|
+
readonly organizationId: string;
|
|
137
|
+
readonly credentialStore: "native";
|
|
138
|
+
}
|
|
139
|
+
| {
|
|
140
|
+
readonly kind: "organization-mcp-connection-revoke";
|
|
141
|
+
readonly organizationId: string;
|
|
142
|
+
readonly connectionId: string;
|
|
143
|
+
readonly yes: true;
|
|
144
|
+
readonly credentialStore: "native";
|
|
145
|
+
}
|
|
127
146
|
| ({
|
|
128
147
|
readonly kind: "database-compute-set";
|
|
129
148
|
readonly projectId: string;
|
|
@@ -330,6 +349,7 @@ export type ProductCliCommand =
|
|
|
330
349
|
readonly name: string;
|
|
331
350
|
readonly dataMode?: "shared" | "isolated";
|
|
332
351
|
readonly devAccessMode?: "protected" | "public";
|
|
352
|
+
readonly includeDevelopmentEnvironment?: boolean;
|
|
333
353
|
readonly region?: "us" | "eu";
|
|
334
354
|
readonly idempotencyKey: string;
|
|
335
355
|
readonly credentialStore: "native";
|
|
@@ -345,6 +365,12 @@ export type ProductCliCommand =
|
|
|
345
365
|
readonly projectId: string;
|
|
346
366
|
readonly credentialStore: "native";
|
|
347
367
|
}
|
|
368
|
+
| {
|
|
369
|
+
readonly kind: "project-development-add";
|
|
370
|
+
readonly projectId: string;
|
|
371
|
+
readonly idempotencyKey: string;
|
|
372
|
+
readonly credentialStore: "native";
|
|
373
|
+
}
|
|
348
374
|
| {
|
|
349
375
|
readonly kind: "project-dev-share-link";
|
|
350
376
|
readonly projectId: string;
|
|
@@ -473,6 +499,37 @@ export type ProductCliCommand =
|
|
|
473
499
|
readonly yes: true;
|
|
474
500
|
readonly credentialStore: "native";
|
|
475
501
|
}
|
|
502
|
+
| {
|
|
503
|
+
readonly kind: "database-webhook-subscription-status";
|
|
504
|
+
readonly projectId: string;
|
|
505
|
+
readonly environment: "dev" | "prod";
|
|
506
|
+
readonly subscriptionId: string;
|
|
507
|
+
readonly credentialStore: "native";
|
|
508
|
+
}
|
|
509
|
+
| {
|
|
510
|
+
readonly kind: "database-webhook-subscription-activate";
|
|
511
|
+
readonly projectId: string;
|
|
512
|
+
readonly environment: "dev" | "prod";
|
|
513
|
+
readonly subscriptionId: string;
|
|
514
|
+
readonly generation: number;
|
|
515
|
+
readonly url: string;
|
|
516
|
+
readonly eventTypes: readonly DatabaseWebhookEventPattern[];
|
|
517
|
+
readonly headersFile: string | null;
|
|
518
|
+
readonly outputPath: string;
|
|
519
|
+
readonly idempotencyKey: string;
|
|
520
|
+
readonly yes: true;
|
|
521
|
+
readonly credentialStore: "native";
|
|
522
|
+
}
|
|
523
|
+
| {
|
|
524
|
+
readonly kind: "database-webhook-subscription-deactivate";
|
|
525
|
+
readonly projectId: string;
|
|
526
|
+
readonly environment: "dev" | "prod";
|
|
527
|
+
readonly subscriptionId: string;
|
|
528
|
+
readonly generation: number;
|
|
529
|
+
readonly idempotencyKey: string;
|
|
530
|
+
readonly yes: true;
|
|
531
|
+
readonly credentialStore: "native";
|
|
532
|
+
}
|
|
476
533
|
| {
|
|
477
534
|
readonly kind: "database-webhook-list";
|
|
478
535
|
readonly projectId: string;
|
|
@@ -617,7 +674,7 @@ export type ProductCliCommand =
|
|
|
617
674
|
readonly kind: "plan";
|
|
618
675
|
readonly projectId: string;
|
|
619
676
|
readonly commitSha: string;
|
|
620
|
-
readonly environment
|
|
677
|
+
readonly environment?: "dev" | "prod";
|
|
621
678
|
readonly credentialStore: "native";
|
|
622
679
|
}
|
|
623
680
|
| {
|
|
@@ -626,7 +683,7 @@ export type ProductCliCommand =
|
|
|
626
683
|
/** Exactly one of an existing plan or a commit that is planned first. */
|
|
627
684
|
readonly planId: string | null;
|
|
628
685
|
readonly commitSha: string | null;
|
|
629
|
-
readonly environment
|
|
686
|
+
readonly environment?: "dev" | "prod";
|
|
630
687
|
readonly idempotencyKey: string;
|
|
631
688
|
readonly yes: true;
|
|
632
689
|
readonly wait: boolean;
|
|
@@ -746,6 +803,7 @@ export type ProductCliCommand =
|
|
|
746
803
|
| "mail webhook set"
|
|
747
804
|
| "mail webhook verify"
|
|
748
805
|
| "mail webhook disable"
|
|
806
|
+
| "mail webhook rotate"
|
|
749
807
|
| "mail messages list"
|
|
750
808
|
| "mail messages get"
|
|
751
809
|
| "mail messages retry";
|
|
@@ -1049,10 +1107,14 @@ export type RecognizedCommandLabel =
|
|
|
1049
1107
|
| "organization create"
|
|
1050
1108
|
| "organization list"
|
|
1051
1109
|
| "organization use"
|
|
1110
|
+
| "organization mcp-connections list"
|
|
1111
|
+
| "organization mcp-connections revoke"
|
|
1052
1112
|
| "github connect"
|
|
1053
1113
|
| "github status"
|
|
1114
|
+
| "github disconnect"
|
|
1054
1115
|
| "project list"
|
|
1055
1116
|
| "project status"
|
|
1117
|
+
| "project dev add"
|
|
1056
1118
|
| "project dev-access create"
|
|
1057
1119
|
| "project dev-share link"
|
|
1058
1120
|
| "project dev-share rotate"
|
|
@@ -1072,6 +1134,9 @@ export type RecognizedCommandLabel =
|
|
|
1072
1134
|
| "database watch delete"
|
|
1073
1135
|
| "database table create"
|
|
1074
1136
|
| "database webhook create"
|
|
1137
|
+
| "database webhook subscription activate"
|
|
1138
|
+
| "database webhook subscription deactivate"
|
|
1139
|
+
| "database webhook subscription status"
|
|
1075
1140
|
| "database webhook list"
|
|
1076
1141
|
| "database webhook get"
|
|
1077
1142
|
| "database webhook delete"
|
|
@@ -1115,6 +1180,7 @@ export type RecognizedCommandLabel =
|
|
|
1115
1180
|
| "mail webhook set"
|
|
1116
1181
|
| "mail webhook verify"
|
|
1117
1182
|
| "mail webhook disable"
|
|
1183
|
+
| "mail webhook rotate"
|
|
1118
1184
|
| "mail messages list"
|
|
1119
1185
|
| "mail messages get"
|
|
1120
1186
|
| "mail messages retry"
|
|
@@ -1175,6 +1241,7 @@ export const recognizedCommandLabel = (argv: readonly string[]): RecognizedComma
|
|
|
1175
1241
|
if (value === "profile" && values[0] === "list") return "profile list";
|
|
1176
1242
|
if (value === "github" && values[0] === "connect") return "github connect";
|
|
1177
1243
|
if (value === "github" && values[0] === "status") return "github status";
|
|
1244
|
+
if (value === "github" && values[0] === "disconnect") return "github disconnect";
|
|
1178
1245
|
if (value === "operation" && values[0] === "get") return "operation get";
|
|
1179
1246
|
if (value === "credits" && values[0] === "account") return "credits account";
|
|
1180
1247
|
if (value === "referral" && values[0] === "link") return "referral link";
|
|
@@ -1207,11 +1274,16 @@ export const recognizedCommandLabel = (argv: readonly string[]): RecognizedComma
|
|
|
1207
1274
|
if (value === "organization" && values[0] === "create") return "organization create";
|
|
1208
1275
|
if (value === "organization" && values[0] === "list") return "organization list";
|
|
1209
1276
|
if (value === "organization" && values[0] === "use") return "organization use";
|
|
1277
|
+
if (value === "organization" && values[0] === "mcp-connections") {
|
|
1278
|
+
if (values[1] === "list") return "organization mcp-connections list";
|
|
1279
|
+
if (values[1] === "revoke") return "organization mcp-connections revoke";
|
|
1280
|
+
}
|
|
1210
1281
|
if (value === "project" && values[0] === "list") return "project list";
|
|
1211
1282
|
if (value === "project" && values[0] === "context") return "project context";
|
|
1212
1283
|
if (value === "project" && values[0] === "notes" && values[1] === "set")
|
|
1213
1284
|
return "project notes set";
|
|
1214
1285
|
if (value === "project" && values[0] === "status") return "project status";
|
|
1286
|
+
if (value === "project" && values[0] === "dev" && values[1] === "add") return "project dev add";
|
|
1215
1287
|
if (value === "project" && values[0] === "handle" && values[1] === "check")
|
|
1216
1288
|
return "project handle check";
|
|
1217
1289
|
if (value === "project" && values[0] === "handle" && values[1] === "set")
|
|
@@ -1253,6 +1325,11 @@ export const recognizedCommandLabel = (argv: readonly string[]): RecognizedComma
|
|
|
1253
1325
|
if (value === "database" && values[0] === "table" && values[1] === "create")
|
|
1254
1326
|
return "database table create";
|
|
1255
1327
|
if (value === "database" && values[0] === "webhook") {
|
|
1328
|
+
if (
|
|
1329
|
+
values[1] === "subscription" &&
|
|
1330
|
+
["activate", "deactivate", "status"].includes(values[2] ?? "")
|
|
1331
|
+
)
|
|
1332
|
+
return `database webhook subscription ${values[2]}` as RecognizedCommandLabel;
|
|
1256
1333
|
if (values[1] === "create") return "database webhook create";
|
|
1257
1334
|
if (values[1] === "list") return "database webhook list";
|
|
1258
1335
|
if (values[1] === "get") return "database webhook get";
|
|
@@ -1330,6 +1407,7 @@ export const recognizedCommandLabel = (argv: readonly string[]): RecognizedComma
|
|
|
1330
1407
|
if (values[1] === "set") return "mail webhook set";
|
|
1331
1408
|
if (values[1] === "verify") return "mail webhook verify";
|
|
1332
1409
|
if (values[1] === "disable") return "mail webhook disable";
|
|
1410
|
+
if (values[1] === "rotate") return "mail webhook rotate";
|
|
1333
1411
|
}
|
|
1334
1412
|
if (values[0] === "messages") {
|
|
1335
1413
|
if (values[1] === "list") return "mail messages list";
|
|
@@ -1970,14 +2048,19 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
1970
2048
|
}
|
|
1971
2049
|
if (first === "github") {
|
|
1972
2050
|
const subcommand = values.shift();
|
|
1973
|
-
if (
|
|
1974
|
-
if (subcommand !== "connect" && subcommand !== "status"
|
|
2051
|
+
if (wait || follow || stdin) throw new InvalidCommandError();
|
|
2052
|
+
if (subcommand !== "connect" && subcommand !== "status" && subcommand !== "disconnect")
|
|
2053
|
+
throw new InvalidCommandError();
|
|
2054
|
+
// Only disconnecting is destructive, and it requires --yes; the route reads no idempotency key.
|
|
2055
|
+
if (yes !== (subcommand === "disconnect")) throw new InvalidCommandError();
|
|
1975
2056
|
const options = parseOptions(
|
|
1976
2057
|
values,
|
|
1977
2058
|
subcommand === "connect" ? ["--organization", "--idempotency-key"] : ["--organization"],
|
|
1978
2059
|
);
|
|
1979
2060
|
const organizationId = options["--organization"];
|
|
1980
2061
|
if (!ORGANIZATION_ULID.test(organizationId)) throw new InvalidCommandError();
|
|
2062
|
+
if (subcommand === "disconnect")
|
|
2063
|
+
return { kind: "github-disconnect", organizationId, yes: true, credentialStore };
|
|
1981
2064
|
return subcommand === "connect"
|
|
1982
2065
|
? {
|
|
1983
2066
|
kind: "github-connect",
|
|
@@ -1987,6 +2070,33 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
1987
2070
|
}
|
|
1988
2071
|
: { kind: "github-status", organizationId, credentialStore };
|
|
1989
2072
|
}
|
|
2073
|
+
if (first === "organization" && values[0] === "mcp-connections") {
|
|
2074
|
+
values.shift();
|
|
2075
|
+
const subcommand = values.shift();
|
|
2076
|
+
if (wait || follow || stdin) throw new InvalidCommandError();
|
|
2077
|
+
// Only disconnecting a client is destructive, and it requires --yes; the route reads no key.
|
|
2078
|
+
if (yes !== (subcommand === "revoke")) throw new InvalidCommandError();
|
|
2079
|
+
if (subcommand === "list") {
|
|
2080
|
+
const organizationId = parseOptions(values, ["--organization"])["--organization"];
|
|
2081
|
+
if (!ORGANIZATION_ULID.test(organizationId)) throw new InvalidCommandError();
|
|
2082
|
+
return { kind: "organization-mcp-connections-list", organizationId, credentialStore };
|
|
2083
|
+
}
|
|
2084
|
+
if (subcommand === "revoke") {
|
|
2085
|
+
const options = parseOptions(values, ["--organization", "--connection"]);
|
|
2086
|
+
const organizationId = options["--organization"];
|
|
2087
|
+
const connectionId = options["--connection"];
|
|
2088
|
+
if (!ORGANIZATION_ULID.test(organizationId) || !MCP_CONNECTION_ID_PATTERN.test(connectionId))
|
|
2089
|
+
throw new InvalidCommandError();
|
|
2090
|
+
return {
|
|
2091
|
+
kind: "organization-mcp-connection-revoke",
|
|
2092
|
+
organizationId,
|
|
2093
|
+
connectionId,
|
|
2094
|
+
yes: true,
|
|
2095
|
+
credentialStore,
|
|
2096
|
+
};
|
|
2097
|
+
}
|
|
2098
|
+
throw new InvalidCommandError();
|
|
2099
|
+
}
|
|
1990
2100
|
if (first === "organization") {
|
|
1991
2101
|
const subcommand = values.shift();
|
|
1992
2102
|
if (yes || wait || follow || stdin) throw new InvalidCommandError();
|
|
@@ -2019,6 +2129,16 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
2019
2129
|
}
|
|
2020
2130
|
if (first === "project") {
|
|
2021
2131
|
const subcommand = values.shift();
|
|
2132
|
+
if (subcommand === "dev" && values.shift() === "add") {
|
|
2133
|
+
if (yes || wait || follow || stdin) throw new InvalidCommandError();
|
|
2134
|
+
const options = parseOptions(values, ["--project", "--idempotency-key"]);
|
|
2135
|
+
return {
|
|
2136
|
+
kind: "project-development-add",
|
|
2137
|
+
projectId: options["--project"],
|
|
2138
|
+
idempotencyKey: options["--idempotency-key"],
|
|
2139
|
+
credentialStore,
|
|
2140
|
+
};
|
|
2141
|
+
}
|
|
2022
2142
|
if (subcommand === "data") {
|
|
2023
2143
|
const action = values.shift();
|
|
2024
2144
|
if (follow || stdin || (action !== "plan" && action !== "change"))
|
|
@@ -2184,10 +2304,12 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
2184
2304
|
"--idempotency-key",
|
|
2185
2305
|
"--data-mode",
|
|
2186
2306
|
"--dev-access-mode",
|
|
2307
|
+
"--include-development-environment",
|
|
2187
2308
|
"--region",
|
|
2188
2309
|
]);
|
|
2189
2310
|
const dataMode = options["--data-mode"];
|
|
2190
2311
|
const devAccessMode = options["--dev-access-mode"];
|
|
2312
|
+
const includeDevelopmentEnvironment = options["--include-development-environment"];
|
|
2191
2313
|
const region = options["--region"];
|
|
2192
2314
|
if (
|
|
2193
2315
|
!options["--organization"] ||
|
|
@@ -2197,6 +2319,9 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
2197
2319
|
(devAccessMode !== undefined &&
|
|
2198
2320
|
devAccessMode !== "protected" &&
|
|
2199
2321
|
devAccessMode !== "public") ||
|
|
2322
|
+
(includeDevelopmentEnvironment !== undefined &&
|
|
2323
|
+
includeDevelopmentEnvironment !== "true" &&
|
|
2324
|
+
includeDevelopmentEnvironment !== "false") ||
|
|
2200
2325
|
(region !== undefined && region !== "us" && region !== "eu")
|
|
2201
2326
|
)
|
|
2202
2327
|
throw new InvalidCommandError();
|
|
@@ -2206,6 +2331,9 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
2206
2331
|
name: options["--name"],
|
|
2207
2332
|
...(dataMode === undefined ? {} : { dataMode }),
|
|
2208
2333
|
...(devAccessMode === undefined ? {} : { devAccessMode }),
|
|
2334
|
+
...(includeDevelopmentEnvironment === undefined
|
|
2335
|
+
? {}
|
|
2336
|
+
: { includeDevelopmentEnvironment: includeDevelopmentEnvironment === "true" }),
|
|
2209
2337
|
...(region === undefined ? {} : { region }),
|
|
2210
2338
|
idempotencyKey: options["--idempotency-key"],
|
|
2211
2339
|
credentialStore,
|
|
@@ -2499,6 +2627,117 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
2499
2627
|
if (first === "database" && values[0] === "webhook") {
|
|
2500
2628
|
values.shift();
|
|
2501
2629
|
const subcommand = values.shift();
|
|
2630
|
+
if (subcommand === "subscription") {
|
|
2631
|
+
const action = values.shift();
|
|
2632
|
+
if (
|
|
2633
|
+
!["activate", "deactivate", "status"].includes(action ?? "") ||
|
|
2634
|
+
wait ||
|
|
2635
|
+
follow ||
|
|
2636
|
+
revoke ||
|
|
2637
|
+
stdin ||
|
|
2638
|
+
yes !== (action !== "status")
|
|
2639
|
+
)
|
|
2640
|
+
throw new InvalidCommandError();
|
|
2641
|
+
const options = parseOptionalOptions(values, [
|
|
2642
|
+
"--project",
|
|
2643
|
+
"--environment",
|
|
2644
|
+
"--subscription",
|
|
2645
|
+
"--generation",
|
|
2646
|
+
"--url",
|
|
2647
|
+
"--event-types",
|
|
2648
|
+
"--headers-file",
|
|
2649
|
+
"--out",
|
|
2650
|
+
"--idempotency-key",
|
|
2651
|
+
]);
|
|
2652
|
+
const projectId = options["--project"],
|
|
2653
|
+
environment = options["--environment"] ?? (action === "status" ? "dev" : undefined),
|
|
2654
|
+
subscriptionId = options["--subscription"];
|
|
2655
|
+
if (
|
|
2656
|
+
!isValue(projectId) ||
|
|
2657
|
+
!subscriptionId ||
|
|
2658
|
+
!ORGANIZATION_ULID.test(subscriptionId) ||
|
|
2659
|
+
(environment !== "dev" && environment !== "prod")
|
|
2660
|
+
)
|
|
2661
|
+
throw new InvalidCommandError();
|
|
2662
|
+
if (action === "status") {
|
|
2663
|
+
if (
|
|
2664
|
+
(
|
|
2665
|
+
[
|
|
2666
|
+
"--generation",
|
|
2667
|
+
"--url",
|
|
2668
|
+
"--event-types",
|
|
2669
|
+
"--headers-file",
|
|
2670
|
+
"--out",
|
|
2671
|
+
"--idempotency-key",
|
|
2672
|
+
] as const
|
|
2673
|
+
).some((key) => options[key] !== undefined)
|
|
2674
|
+
)
|
|
2675
|
+
throw new InvalidCommandError();
|
|
2676
|
+
return {
|
|
2677
|
+
kind: "database-webhook-subscription-status",
|
|
2678
|
+
projectId,
|
|
2679
|
+
environment,
|
|
2680
|
+
subscriptionId,
|
|
2681
|
+
credentialStore,
|
|
2682
|
+
};
|
|
2683
|
+
}
|
|
2684
|
+
const generationText = options["--generation"],
|
|
2685
|
+
idempotencyKey = options["--idempotency-key"];
|
|
2686
|
+
if (
|
|
2687
|
+
!generationText ||
|
|
2688
|
+
!/^[1-9][0-9]*$/u.test(generationText) ||
|
|
2689
|
+
Number(generationText) > 2147483647 ||
|
|
2690
|
+
!isValue(idempotencyKey)
|
|
2691
|
+
)
|
|
2692
|
+
throw new InvalidCommandError();
|
|
2693
|
+
const generation = Number(generationText);
|
|
2694
|
+
if (action === "deactivate") {
|
|
2695
|
+
if (
|
|
2696
|
+
(["--url", "--event-types", "--headers-file", "--out"] as const).some(
|
|
2697
|
+
(key) => options[key] !== undefined,
|
|
2698
|
+
)
|
|
2699
|
+
)
|
|
2700
|
+
throw new InvalidCommandError();
|
|
2701
|
+
return {
|
|
2702
|
+
kind: "database-webhook-subscription-deactivate",
|
|
2703
|
+
projectId,
|
|
2704
|
+
environment,
|
|
2705
|
+
subscriptionId,
|
|
2706
|
+
generation,
|
|
2707
|
+
idempotencyKey,
|
|
2708
|
+
yes: true,
|
|
2709
|
+
credentialStore,
|
|
2710
|
+
};
|
|
2711
|
+
}
|
|
2712
|
+
const url = options["--url"],
|
|
2713
|
+
eventTypes = options["--event-types"],
|
|
2714
|
+
headersFile = options["--headers-file"],
|
|
2715
|
+
outputPath = options["--out"];
|
|
2716
|
+
if (
|
|
2717
|
+
!isValue(url) ||
|
|
2718
|
+
!isValue(eventTypes) ||
|
|
2719
|
+
!isValue(outputPath) ||
|
|
2720
|
+
(headersFile !== undefined && !isValue(headersFile))
|
|
2721
|
+
)
|
|
2722
|
+
throw new InvalidCommandError();
|
|
2723
|
+
const request = contractValue(() =>
|
|
2724
|
+
parseDatabaseWebhookCreateRequest({ url, event_types: eventTypes.split(",") }),
|
|
2725
|
+
);
|
|
2726
|
+
return {
|
|
2727
|
+
kind: "database-webhook-subscription-activate",
|
|
2728
|
+
projectId,
|
|
2729
|
+
environment,
|
|
2730
|
+
subscriptionId,
|
|
2731
|
+
generation,
|
|
2732
|
+
url: request.url,
|
|
2733
|
+
eventTypes: request.event_types,
|
|
2734
|
+
headersFile: headersFile ?? null,
|
|
2735
|
+
outputPath,
|
|
2736
|
+
idempotencyKey,
|
|
2737
|
+
yes: true,
|
|
2738
|
+
credentialStore,
|
|
2739
|
+
};
|
|
2740
|
+
}
|
|
2502
2741
|
if (subcommand === "create") {
|
|
2503
2742
|
if (!yes || wait || follow || revoke || stdin) throw new InvalidCommandError();
|
|
2504
2743
|
const options = parseOptionalOptions(values, [
|
|
@@ -2958,7 +3197,9 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
2958
3197
|
kind: "plan",
|
|
2959
3198
|
projectId,
|
|
2960
3199
|
commitSha,
|
|
2961
|
-
|
|
3200
|
+
...(options["--environment"] === undefined
|
|
3201
|
+
? {}
|
|
3202
|
+
: { environment: deploymentEnvironment(options["--environment"]) }),
|
|
2962
3203
|
credentialStore,
|
|
2963
3204
|
};
|
|
2964
3205
|
}
|
|
@@ -2988,7 +3229,9 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
2988
3229
|
projectId,
|
|
2989
3230
|
planId,
|
|
2990
3231
|
commitSha,
|
|
2991
|
-
|
|
3232
|
+
...(options["--environment"] === undefined
|
|
3233
|
+
? {}
|
|
3234
|
+
: { environment: deploymentEnvironment(options["--environment"]) }),
|
|
2992
3235
|
idempotencyKey,
|
|
2993
3236
|
yes,
|
|
2994
3237
|
wait,
|
|
@@ -3310,20 +3553,27 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
3310
3553
|
const area = values.shift();
|
|
3311
3554
|
const sub =
|
|
3312
3555
|
area === "webhook" || area === "messages" || area === "domain" ? values.shift() : undefined;
|
|
3313
|
-
// Only retiring the mail domain
|
|
3556
|
+
// Only retiring the mail domain and rotating the webhook secret are destructive: each needs --yes.
|
|
3314
3557
|
const retiring = area === "domain" && sub === "delete";
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3558
|
+
const rotating = area === "webhook" && sub === "rotate";
|
|
3559
|
+
if (yes !== (retiring || rotating) || wait || follow || stdin) throw new InvalidCommandError();
|
|
3560
|
+
// Rotation takes only its scope and key, so any other option is refused rather than dropped.
|
|
3561
|
+
const options = parseOptionalOptions(
|
|
3562
|
+
values,
|
|
3563
|
+
rotating
|
|
3564
|
+
? ["--project", "--environment", "--idempotency-key"]
|
|
3565
|
+
: [
|
|
3566
|
+
"--project",
|
|
3567
|
+
"--environment",
|
|
3568
|
+
"--domain",
|
|
3569
|
+
"--sending",
|
|
3570
|
+
"--receiving",
|
|
3571
|
+
"--url",
|
|
3572
|
+
"--idempotency-key",
|
|
3573
|
+
"--message",
|
|
3574
|
+
"--after",
|
|
3575
|
+
],
|
|
3576
|
+
);
|
|
3327
3577
|
const required = (key: keyof typeof options) => {
|
|
3328
3578
|
const value = options[key];
|
|
3329
3579
|
if (!value) throw new InvalidCommandError();
|
|
@@ -3364,6 +3614,13 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
|
|
|
3364
3614
|
idempotencyKey: required("--idempotency-key"),
|
|
3365
3615
|
};
|
|
3366
3616
|
label = "mail webhook set";
|
|
3617
|
+
} else if (rotating) {
|
|
3618
|
+
request = {
|
|
3619
|
+
...scope,
|
|
3620
|
+
action: "webhook_rotate",
|
|
3621
|
+
idempotencyKey: required("--idempotency-key"),
|
|
3622
|
+
};
|
|
3623
|
+
label = "mail webhook rotate";
|
|
3367
3624
|
} else if (area === "webhook" && (sub === "verify" || sub === "disable")) {
|
|
3368
3625
|
request = {
|
|
3369
3626
|
...scope,
|