@amerged/ohmyhost-mcp 0.1.40 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-OW4IDEWK.js → chunk-OD4R3WMQ.js} +6 -6
- package/dist/index.js +1 -1
- package/dist/licenses/pgcf-bridge-NOTICE +1 -1
- package/dist/stdio-main.js +1130 -167
- package/package.json +1 -1
- package/src/apps/mcp/package.json +1 -1
- package/src/apps/mcp/src/local-client.ts +221 -8
- package/src/apps/mcp/src/local-server.ts +366 -25
- package/src/apps/product-cli/package.json +1 -1
- package/src/apps/product-cli/src/cli.ts +440 -40
- package/src/apps/product-cli/src/command.ts +492 -19
- package/src/apps/product-cli/src/composition.ts +6 -3
- package/src/apps/product-cli/src/product-api.ts +366 -13
- package/src/apps/product-cli/src/runtime-contract.ts +1 -10
- package/src/packages/agent-skills/src/generated-skill-resources.ts +5 -5
- package/src/packages/contracts/package.json +5 -0
- package/src/packages/contracts/src/credit-pricing.ts +78 -50
- 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/feedback.ts +0 -5
- package/src/packages/contracts/src/problem-policy.ts +28 -0
- package/src/packages/postgres-bridge/NOTICE +1 -1
- 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 -0
- package/src/packages/sdk-ts/src/generated/sdk.gen.ts +702 -10
- package/src/packages/sdk-ts/src/generated/types.gen.ts +1205 -49
|
@@ -20,6 +20,36 @@ import {
|
|
|
20
20
|
type ProjectDatabaseWriteReceipt,
|
|
21
21
|
} from "@ohmyhost/contracts/database-access";
|
|
22
22
|
import { assertDatabaseCompute, type DatabaseCompute } from "@ohmyhost/contracts/database-compute";
|
|
23
|
+
import {
|
|
24
|
+
assertDatabaseExecutionUsagePage,
|
|
25
|
+
assertDatabaseSchedule,
|
|
26
|
+
assertDatabaseSchedulePage,
|
|
27
|
+
assertDatabaseScheduleDeleted,
|
|
28
|
+
assertDatabaseScheduleRunAccepted,
|
|
29
|
+
assertDatabaseScheduleRunPage,
|
|
30
|
+
assertDatabaseWebhook,
|
|
31
|
+
assertDatabaseWebhookCreated,
|
|
32
|
+
assertDatabaseWebhookDeleted,
|
|
33
|
+
assertDatabaseWebhookDeliveryPage,
|
|
34
|
+
assertDatabaseWebhookPage,
|
|
35
|
+
assertDatabaseWebhookReplayAccepted,
|
|
36
|
+
assertDatabaseWebhookTest,
|
|
37
|
+
type DatabaseExecutionUsagePage,
|
|
38
|
+
type DatabaseSchedule,
|
|
39
|
+
type DatabaseScheduleDeleted,
|
|
40
|
+
type DatabaseSchedulePage,
|
|
41
|
+
type DatabaseScheduleRunAccepted,
|
|
42
|
+
type DatabaseScheduleRunPage,
|
|
43
|
+
type DatabaseScheduleSetRequest,
|
|
44
|
+
type DatabaseWebhook,
|
|
45
|
+
type DatabaseWebhookCreated,
|
|
46
|
+
type DatabaseWebhookDeleted,
|
|
47
|
+
type DatabaseWebhookDeliveryPage,
|
|
48
|
+
type DatabaseWebhookEventType,
|
|
49
|
+
type DatabaseWebhookPage,
|
|
50
|
+
type DatabaseWebhookReplayAccepted,
|
|
51
|
+
type DatabaseWebhookTestResult,
|
|
52
|
+
} from "@ohmyhost/contracts/database-events";
|
|
23
53
|
import type { DatabaseComputeSelection } from "@ohmyhost/contracts/database-sizes";
|
|
24
54
|
import {
|
|
25
55
|
assertProjectContext,
|
|
@@ -117,6 +147,20 @@ import {
|
|
|
117
147
|
createProjectDatabaseAccess,
|
|
118
148
|
listProjectDatabaseAccess,
|
|
119
149
|
revokeProjectDatabaseAccess,
|
|
150
|
+
createProjectDatabaseWebhook,
|
|
151
|
+
listProjectDatabaseWebhooks,
|
|
152
|
+
getProjectDatabaseWebhook,
|
|
153
|
+
deleteProjectDatabaseWebhook,
|
|
154
|
+
testProjectDatabaseWebhook,
|
|
155
|
+
listProjectDatabaseWebhookDeliveries,
|
|
156
|
+
replayProjectDatabaseWebhookDelivery,
|
|
157
|
+
setProjectDatabaseSchedule,
|
|
158
|
+
listProjectDatabaseSchedules,
|
|
159
|
+
getProjectDatabaseSchedule,
|
|
160
|
+
deleteProjectDatabaseSchedule,
|
|
161
|
+
listProjectDatabaseScheduleRuns,
|
|
162
|
+
runProjectDatabaseSchedule,
|
|
163
|
+
getProjectDatabaseExecutionUsage,
|
|
120
164
|
reconcileOperation,
|
|
121
165
|
streamOperationEvents,
|
|
122
166
|
type DeploymentPlan,
|
|
@@ -230,11 +274,7 @@ export interface ProductApi {
|
|
|
230
274
|
organizationId: string,
|
|
231
275
|
): Promise<import("@ohmyhost/sdk-ts").OrganizationReferral>;
|
|
232
276
|
getOrganizationCredits(organizationId: string): Promise<OrganizationCredits>;
|
|
233
|
-
getOrganizationCreditUsage(
|
|
234
|
-
organizationId: string;
|
|
235
|
-
month: string;
|
|
236
|
-
cursor?: string;
|
|
237
|
-
}): Promise<OrganizationCreditUsage>;
|
|
277
|
+
getOrganizationCreditUsage(organizationId: string): Promise<OrganizationCreditUsage>;
|
|
238
278
|
getProjectCreditBudget(projectId: string): Promise<ProjectCreditBudget>;
|
|
239
279
|
setProjectCreditBudget(input: {
|
|
240
280
|
projectId: string;
|
|
@@ -283,6 +323,85 @@ export interface ProductApi {
|
|
|
283
323
|
readonly projectId: string;
|
|
284
324
|
readonly accessId: string;
|
|
285
325
|
}): Promise<ProjectDatabaseAccess>;
|
|
326
|
+
createProjectDatabaseWebhook(input: {
|
|
327
|
+
readonly projectId: string;
|
|
328
|
+
readonly environment: "dev" | "prod";
|
|
329
|
+
readonly idempotencyKey: string;
|
|
330
|
+
readonly url: string;
|
|
331
|
+
readonly eventTypes: readonly DatabaseWebhookEventType[];
|
|
332
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
333
|
+
}): Promise<DatabaseWebhookCreated>;
|
|
334
|
+
listProjectDatabaseWebhooks(input: {
|
|
335
|
+
readonly projectId: string;
|
|
336
|
+
readonly environment: "dev" | "prod";
|
|
337
|
+
}): Promise<DatabaseWebhookPage>;
|
|
338
|
+
getProjectDatabaseWebhook(input: {
|
|
339
|
+
readonly projectId: string;
|
|
340
|
+
readonly environment: "dev" | "prod";
|
|
341
|
+
readonly webhookId: string;
|
|
342
|
+
}): Promise<DatabaseWebhook>;
|
|
343
|
+
deleteProjectDatabaseWebhook(input: {
|
|
344
|
+
readonly projectId: string;
|
|
345
|
+
readonly environment: "dev" | "prod";
|
|
346
|
+
readonly webhookId: string;
|
|
347
|
+
}): Promise<DatabaseWebhookDeleted>;
|
|
348
|
+
testProjectDatabaseWebhook(input: {
|
|
349
|
+
readonly projectId: string;
|
|
350
|
+
readonly environment: "dev" | "prod";
|
|
351
|
+
readonly webhookId: string;
|
|
352
|
+
}): Promise<DatabaseWebhookTestResult>;
|
|
353
|
+
listProjectDatabaseWebhookDeliveries(input: {
|
|
354
|
+
readonly projectId: string;
|
|
355
|
+
readonly environment: "dev" | "prod";
|
|
356
|
+
readonly webhookId?: string;
|
|
357
|
+
readonly limit?: number;
|
|
358
|
+
readonly cursor?: string;
|
|
359
|
+
}): Promise<DatabaseWebhookDeliveryPage>;
|
|
360
|
+
replayProjectDatabaseWebhookDelivery(input: {
|
|
361
|
+
readonly projectId: string;
|
|
362
|
+
readonly environment: "dev" | "prod";
|
|
363
|
+
readonly deliveryId: string;
|
|
364
|
+
}): Promise<DatabaseWebhookReplayAccepted>;
|
|
365
|
+
setProjectDatabaseSchedule(input: {
|
|
366
|
+
readonly projectId: string;
|
|
367
|
+
readonly environment: "dev" | "prod";
|
|
368
|
+
readonly name: string;
|
|
369
|
+
readonly request: DatabaseScheduleSetRequest;
|
|
370
|
+
}): Promise<DatabaseSchedule>;
|
|
371
|
+
listProjectDatabaseSchedules(input: {
|
|
372
|
+
readonly projectId: string;
|
|
373
|
+
readonly environment: "dev" | "prod";
|
|
374
|
+
}): Promise<DatabaseSchedulePage>;
|
|
375
|
+
getProjectDatabaseSchedule(input: {
|
|
376
|
+
readonly projectId: string;
|
|
377
|
+
readonly environment: "dev" | "prod";
|
|
378
|
+
readonly name: string;
|
|
379
|
+
}): Promise<DatabaseSchedule>;
|
|
380
|
+
deleteProjectDatabaseSchedule(input: {
|
|
381
|
+
readonly projectId: string;
|
|
382
|
+
readonly environment: "dev" | "prod";
|
|
383
|
+
readonly name: string;
|
|
384
|
+
}): Promise<DatabaseScheduleDeleted>;
|
|
385
|
+
listProjectDatabaseScheduleRuns(input: {
|
|
386
|
+
readonly projectId: string;
|
|
387
|
+
readonly environment: "dev" | "prod";
|
|
388
|
+
readonly name: string;
|
|
389
|
+
readonly limit?: number;
|
|
390
|
+
}): Promise<DatabaseScheduleRunPage>;
|
|
391
|
+
runProjectDatabaseSchedule(input: {
|
|
392
|
+
readonly projectId: string;
|
|
393
|
+
readonly environment: "dev" | "prod";
|
|
394
|
+
readonly name: string;
|
|
395
|
+
}): Promise<DatabaseScheduleRunAccepted>;
|
|
396
|
+
getProjectDatabaseExecutionUsage(input: {
|
|
397
|
+
readonly projectId: string;
|
|
398
|
+
readonly environment: "dev" | "prod";
|
|
399
|
+
readonly from: string;
|
|
400
|
+
readonly to: string;
|
|
401
|
+
readonly granularity: "hour" | "day";
|
|
402
|
+
readonly limit?: number;
|
|
403
|
+
readonly cursor?: string;
|
|
404
|
+
}): Promise<DatabaseExecutionUsagePage>;
|
|
286
405
|
planPaidDomain(input: {
|
|
287
406
|
readonly projectId: string;
|
|
288
407
|
readonly hostname: string;
|
|
@@ -445,6 +564,11 @@ export interface ProductApi {
|
|
|
445
564
|
managedMail?(input: ManagedMailCommand): Promise<unknown>;
|
|
446
565
|
}
|
|
447
566
|
|
|
567
|
+
/** A webhook answer that names another environment, webhook or delivery than the request did. */
|
|
568
|
+
const WEBHOOK_SCOPE_MISMATCH = "Webhook response scope mismatch";
|
|
569
|
+
/** A schedule answer that names another environment or schedule than the request did. */
|
|
570
|
+
const SCHEDULE_SCOPE_MISMATCH = "Schedule response scope mismatch";
|
|
571
|
+
|
|
448
572
|
export class GeneratedSdkProductApi implements ProductApi {
|
|
449
573
|
readonly #client: OhMyHostClient;
|
|
450
574
|
public readonly managedSource: ManagedSourceApi;
|
|
@@ -614,15 +738,9 @@ export class GeneratedSdkProductApi implements ProductApi {
|
|
|
614
738
|
{ client: this.#client },
|
|
615
739
|
);
|
|
616
740
|
}
|
|
617
|
-
public getOrganizationCreditUsage(
|
|
618
|
-
input: Parameters<ProductApi["getOrganizationCreditUsage"]>[0],
|
|
619
|
-
) {
|
|
741
|
+
public getOrganizationCreditUsage(organizationId: string) {
|
|
620
742
|
return getOrganizationCreditUsage(
|
|
621
|
-
{
|
|
622
|
-
organization_id: input.organizationId,
|
|
623
|
-
month: input.month,
|
|
624
|
-
...(input.cursor ? { cursor: input.cursor } : {}),
|
|
625
|
-
},
|
|
743
|
+
{ organization_id: organizationId },
|
|
626
744
|
{ client: this.#client },
|
|
627
745
|
);
|
|
628
746
|
}
|
|
@@ -771,6 +889,241 @@ export class GeneratedSdkProductApi implements ProductApi {
|
|
|
771
889
|
return value;
|
|
772
890
|
}
|
|
773
891
|
|
|
892
|
+
/** The signing secret exists only in this answer; the CLI prints it once and stores nothing. */
|
|
893
|
+
public async createProjectDatabaseWebhook(
|
|
894
|
+
input: Parameters<ProductApi["createProjectDatabaseWebhook"]>[0],
|
|
895
|
+
): Promise<DatabaseWebhookCreated> {
|
|
896
|
+
const value = await createProjectDatabaseWebhook(
|
|
897
|
+
{
|
|
898
|
+
project_id: input.projectId,
|
|
899
|
+
environment: input.environment,
|
|
900
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
901
|
+
databaseWebhookCreateRequest: {
|
|
902
|
+
url: input.url,
|
|
903
|
+
event_types: [...input.eventTypes],
|
|
904
|
+
headers: { ...input.headers },
|
|
905
|
+
},
|
|
906
|
+
},
|
|
907
|
+
{ client: this.#client },
|
|
908
|
+
);
|
|
909
|
+
assertDatabaseWebhookCreated(value);
|
|
910
|
+
if (value.environment !== input.environment) throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
|
|
911
|
+
return value;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
public async listProjectDatabaseWebhooks(
|
|
915
|
+
input: Parameters<ProductApi["listProjectDatabaseWebhooks"]>[0],
|
|
916
|
+
): Promise<DatabaseWebhookPage> {
|
|
917
|
+
const value = await listProjectDatabaseWebhooks(
|
|
918
|
+
{ project_id: input.projectId, environment: input.environment },
|
|
919
|
+
{ client: this.#client },
|
|
920
|
+
);
|
|
921
|
+
assertDatabaseWebhookPage(value);
|
|
922
|
+
if (value.items.some((item) => item.environment !== input.environment))
|
|
923
|
+
throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
|
|
924
|
+
return value;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
public async getProjectDatabaseWebhook(
|
|
928
|
+
input: Parameters<ProductApi["getProjectDatabaseWebhook"]>[0],
|
|
929
|
+
): Promise<DatabaseWebhook> {
|
|
930
|
+
const value = await getProjectDatabaseWebhook(
|
|
931
|
+
{
|
|
932
|
+
project_id: input.projectId,
|
|
933
|
+
environment: input.environment,
|
|
934
|
+
webhook_id: input.webhookId,
|
|
935
|
+
},
|
|
936
|
+
{ client: this.#client },
|
|
937
|
+
);
|
|
938
|
+
assertDatabaseWebhook(value);
|
|
939
|
+
if (value.id !== input.webhookId || value.environment !== input.environment)
|
|
940
|
+
throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
|
|
941
|
+
return value;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
public async deleteProjectDatabaseWebhook(
|
|
945
|
+
input: Parameters<ProductApi["deleteProjectDatabaseWebhook"]>[0],
|
|
946
|
+
): Promise<DatabaseWebhookDeleted> {
|
|
947
|
+
const value = await deleteProjectDatabaseWebhook(
|
|
948
|
+
{
|
|
949
|
+
project_id: input.projectId,
|
|
950
|
+
environment: input.environment,
|
|
951
|
+
webhook_id: input.webhookId,
|
|
952
|
+
},
|
|
953
|
+
{ client: this.#client },
|
|
954
|
+
);
|
|
955
|
+
assertDatabaseWebhookDeleted(value);
|
|
956
|
+
if (value.id !== input.webhookId) throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
|
|
957
|
+
return value;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
public async testProjectDatabaseWebhook(
|
|
961
|
+
input: Parameters<ProductApi["testProjectDatabaseWebhook"]>[0],
|
|
962
|
+
): Promise<DatabaseWebhookTestResult> {
|
|
963
|
+
const value = await testProjectDatabaseWebhook(
|
|
964
|
+
{
|
|
965
|
+
project_id: input.projectId,
|
|
966
|
+
environment: input.environment,
|
|
967
|
+
webhook_id: input.webhookId,
|
|
968
|
+
},
|
|
969
|
+
{ client: this.#client },
|
|
970
|
+
);
|
|
971
|
+
assertDatabaseWebhookTest(value);
|
|
972
|
+
return value;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
public async listProjectDatabaseWebhookDeliveries(
|
|
976
|
+
input: Parameters<ProductApi["listProjectDatabaseWebhookDeliveries"]>[0],
|
|
977
|
+
): Promise<DatabaseWebhookDeliveryPage> {
|
|
978
|
+
const value = await listProjectDatabaseWebhookDeliveries(
|
|
979
|
+
{
|
|
980
|
+
project_id: input.projectId,
|
|
981
|
+
environment: input.environment,
|
|
982
|
+
...(input.webhookId === undefined ? {} : { webhook_id: input.webhookId }),
|
|
983
|
+
...(input.limit === undefined ? {} : { limit: input.limit }),
|
|
984
|
+
...(input.cursor === undefined ? {} : { cursor: input.cursor }),
|
|
985
|
+
},
|
|
986
|
+
{ client: this.#client },
|
|
987
|
+
);
|
|
988
|
+
assertDatabaseWebhookDeliveryPage(value);
|
|
989
|
+
if (
|
|
990
|
+
input.webhookId !== undefined &&
|
|
991
|
+
value.items.some((item) => item.webhook_id !== input.webhookId)
|
|
992
|
+
)
|
|
993
|
+
throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
|
|
994
|
+
return value;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
public async replayProjectDatabaseWebhookDelivery(
|
|
998
|
+
input: Parameters<ProductApi["replayProjectDatabaseWebhookDelivery"]>[0],
|
|
999
|
+
): Promise<DatabaseWebhookReplayAccepted> {
|
|
1000
|
+
const value = await replayProjectDatabaseWebhookDelivery(
|
|
1001
|
+
{
|
|
1002
|
+
project_id: input.projectId,
|
|
1003
|
+
environment: input.environment,
|
|
1004
|
+
delivery_id: input.deliveryId,
|
|
1005
|
+
},
|
|
1006
|
+
{ client: this.#client },
|
|
1007
|
+
);
|
|
1008
|
+
assertDatabaseWebhookReplayAccepted(value);
|
|
1009
|
+
if (value.delivery_id !== input.deliveryId) throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
|
|
1010
|
+
return value;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
/** A schedule runs the statements as the application's runtime role; the request confirms it. */
|
|
1014
|
+
public async setProjectDatabaseSchedule(
|
|
1015
|
+
input: Parameters<ProductApi["setProjectDatabaseSchedule"]>[0],
|
|
1016
|
+
): Promise<DatabaseSchedule> {
|
|
1017
|
+
const request = input.request;
|
|
1018
|
+
const value = await setProjectDatabaseSchedule(
|
|
1019
|
+
{
|
|
1020
|
+
project_id: input.projectId,
|
|
1021
|
+
environment: input.environment,
|
|
1022
|
+
name: input.name,
|
|
1023
|
+
databaseScheduleSetRequest: {
|
|
1024
|
+
...(request.cron === null ? {} : { cron: request.cron }),
|
|
1025
|
+
...(request.every_seconds === null ? {} : { every_seconds: request.every_seconds }),
|
|
1026
|
+
statements: [...request.statements],
|
|
1027
|
+
timeout_ms: request.timeout_ms,
|
|
1028
|
+
enabled: request.enabled,
|
|
1029
|
+
confirm: true,
|
|
1030
|
+
},
|
|
1031
|
+
},
|
|
1032
|
+
{ client: this.#client },
|
|
1033
|
+
);
|
|
1034
|
+
assertDatabaseSchedule(value);
|
|
1035
|
+
if (value.name !== input.name || value.environment !== input.environment)
|
|
1036
|
+
throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
|
|
1037
|
+
return value;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
public async listProjectDatabaseSchedules(
|
|
1041
|
+
input: Parameters<ProductApi["listProjectDatabaseSchedules"]>[0],
|
|
1042
|
+
): Promise<DatabaseSchedulePage> {
|
|
1043
|
+
const value = await listProjectDatabaseSchedules(
|
|
1044
|
+
{ project_id: input.projectId, environment: input.environment },
|
|
1045
|
+
{ client: this.#client },
|
|
1046
|
+
);
|
|
1047
|
+
assertDatabaseSchedulePage(value);
|
|
1048
|
+
if (value.items.some((item) => item.environment !== input.environment))
|
|
1049
|
+
throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
|
|
1050
|
+
return value;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
public async getProjectDatabaseSchedule(
|
|
1054
|
+
input: Parameters<ProductApi["getProjectDatabaseSchedule"]>[0],
|
|
1055
|
+
): Promise<DatabaseSchedule> {
|
|
1056
|
+
const value = await getProjectDatabaseSchedule(
|
|
1057
|
+
{ project_id: input.projectId, environment: input.environment, name: input.name },
|
|
1058
|
+
{ client: this.#client },
|
|
1059
|
+
);
|
|
1060
|
+
assertDatabaseSchedule(value);
|
|
1061
|
+
if (value.name !== input.name || value.environment !== input.environment)
|
|
1062
|
+
throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
|
|
1063
|
+
return value;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
public async deleteProjectDatabaseSchedule(
|
|
1067
|
+
input: Parameters<ProductApi["deleteProjectDatabaseSchedule"]>[0],
|
|
1068
|
+
): Promise<DatabaseScheduleDeleted> {
|
|
1069
|
+
const value = await deleteProjectDatabaseSchedule(
|
|
1070
|
+
{ project_id: input.projectId, environment: input.environment, name: input.name },
|
|
1071
|
+
{ client: this.#client },
|
|
1072
|
+
);
|
|
1073
|
+
assertDatabaseScheduleDeleted(value);
|
|
1074
|
+
if (value.name !== input.name) throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
|
|
1075
|
+
return value;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
public async listProjectDatabaseScheduleRuns(
|
|
1079
|
+
input: Parameters<ProductApi["listProjectDatabaseScheduleRuns"]>[0],
|
|
1080
|
+
): Promise<DatabaseScheduleRunPage> {
|
|
1081
|
+
const value = await listProjectDatabaseScheduleRuns(
|
|
1082
|
+
{
|
|
1083
|
+
project_id: input.projectId,
|
|
1084
|
+
environment: input.environment,
|
|
1085
|
+
name: input.name,
|
|
1086
|
+
...(input.limit === undefined ? {} : { limit: input.limit }),
|
|
1087
|
+
},
|
|
1088
|
+
{ client: this.#client },
|
|
1089
|
+
);
|
|
1090
|
+
assertDatabaseScheduleRunPage(value);
|
|
1091
|
+
if (value.items.some((item) => item.schedule !== input.name))
|
|
1092
|
+
throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
|
|
1093
|
+
return value;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
public async runProjectDatabaseSchedule(
|
|
1097
|
+
input: Parameters<ProductApi["runProjectDatabaseSchedule"]>[0],
|
|
1098
|
+
): Promise<DatabaseScheduleRunAccepted> {
|
|
1099
|
+
const value = await runProjectDatabaseSchedule(
|
|
1100
|
+
{ project_id: input.projectId, environment: input.environment, name: input.name },
|
|
1101
|
+
{ client: this.#client },
|
|
1102
|
+
);
|
|
1103
|
+
assertDatabaseScheduleRunAccepted(value);
|
|
1104
|
+
if (value.schedule !== input.name) throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
|
|
1105
|
+
return value;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
public async getProjectDatabaseExecutionUsage(
|
|
1109
|
+
input: Parameters<ProductApi["getProjectDatabaseExecutionUsage"]>[0],
|
|
1110
|
+
): Promise<DatabaseExecutionUsagePage> {
|
|
1111
|
+
const value = await getProjectDatabaseExecutionUsage(
|
|
1112
|
+
{
|
|
1113
|
+
project_id: input.projectId,
|
|
1114
|
+
environment: input.environment,
|
|
1115
|
+
from: input.from,
|
|
1116
|
+
to: input.to,
|
|
1117
|
+
granularity: input.granularity,
|
|
1118
|
+
...(input.limit === undefined ? {} : { limit: input.limit }),
|
|
1119
|
+
...(input.cursor === undefined ? {} : { cursor: input.cursor }),
|
|
1120
|
+
},
|
|
1121
|
+
{ client: this.#client },
|
|
1122
|
+
);
|
|
1123
|
+
assertDatabaseExecutionUsagePage(value);
|
|
1124
|
+
return value;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
774
1127
|
public async planPaidDomain(input: {
|
|
775
1128
|
readonly projectId: string;
|
|
776
1129
|
readonly hostname: string;
|
|
@@ -552,9 +552,6 @@ export function parseOrganizationCredits(value: unknown): OrganizationCredits {
|
|
|
552
552
|
"as_of",
|
|
553
553
|
"available_micros",
|
|
554
554
|
"reserved_micros",
|
|
555
|
-
"spent_micros",
|
|
556
|
-
"expired_micros",
|
|
557
|
-
"platform_overrun_micros",
|
|
558
555
|
"grace_started_at",
|
|
559
556
|
"grace_expires_at",
|
|
560
557
|
"active_meters",
|
|
@@ -586,13 +583,7 @@ export function parseOrganizationCredits(value: unknown): OrganizationCredits {
|
|
|
586
583
|
)
|
|
587
584
|
)
|
|
588
585
|
throw new ResponseContractError();
|
|
589
|
-
for (const field of [
|
|
590
|
-
"available_micros",
|
|
591
|
-
"reserved_micros",
|
|
592
|
-
"spent_micros",
|
|
593
|
-
"expired_micros",
|
|
594
|
-
"platform_overrun_micros",
|
|
595
|
-
]) {
|
|
586
|
+
for (const field of ["available_micros", "reserved_micros"]) {
|
|
596
587
|
const amount = input[field];
|
|
597
588
|
if (
|
|
598
589
|
typeof amount !== "string" ||
|