@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amerged/ohmyhost-mcp",
3
- "version": "0.1.40",
3
+ "version": "0.1.42",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmyhost/mcp",
3
- "version": "0.1.40",
3
+ "version": "0.1.42",
4
4
  "private": true,
5
5
  "ohmyhost": {
6
6
  "deployment": "production",
@@ -12,6 +12,20 @@ import {
12
12
  } from "@ohmyhost/contracts/database-access";
13
13
  import { assertOrganizationAccount } from "@ohmyhost/contracts/credit-pricing";
14
14
  import { assertDatabaseCompute } from "@ohmyhost/contracts/database-compute";
15
+ import {
16
+ assertDatabaseExecutionUsagePage,
17
+ assertDatabaseSchedule,
18
+ assertDatabaseSchedulePage,
19
+ assertDatabaseScheduleDeleted,
20
+ assertDatabaseScheduleRunAccepted,
21
+ assertDatabaseScheduleRunPage,
22
+ assertDatabaseWebhookCreated,
23
+ assertDatabaseWebhookDeleted,
24
+ assertDatabaseWebhookDeliveryPage,
25
+ assertDatabaseWebhookPage,
26
+ assertDatabaseWebhookReplayAccepted,
27
+ assertDatabaseWebhookTest,
28
+ } from "@ohmyhost/contracts/database-events";
15
29
  import type { DatabaseComputeSelection } from "@ohmyhost/contracts/database-sizes";
16
30
  import {
17
31
  assertProjectContext,
@@ -98,6 +112,18 @@ import {
98
112
  createProjectDatabaseAccess,
99
113
  listProjectDatabaseAccess,
100
114
  revokeProjectDatabaseAccess,
115
+ createProjectDatabaseWebhook,
116
+ listProjectDatabaseWebhooks,
117
+ deleteProjectDatabaseWebhook,
118
+ testProjectDatabaseWebhook,
119
+ listProjectDatabaseWebhookDeliveries,
120
+ replayProjectDatabaseWebhookDelivery,
121
+ listProjectDatabaseSchedules,
122
+ setProjectDatabaseSchedule,
123
+ deleteProjectDatabaseSchedule,
124
+ listProjectDatabaseScheduleRuns,
125
+ runProjectDatabaseSchedule,
126
+ getProjectDatabaseExecutionUsage,
101
127
  planProjectDeletion,
102
128
  rollbackDeployment,
103
129
  reconcileOperation,
@@ -214,6 +240,11 @@ export async function createAuthenticatedLocalMcpClient(
214
240
  }
215
241
  }
216
242
 
243
+ /** A database event answer must belong to the environment and name that were asked for. */
244
+ function requireScope(matches: boolean): void {
245
+ if (!matches) throw new TypeError("Database event scope mismatch");
246
+ }
247
+
217
248
  export class GeneratedSdkLocalMcpClient implements LocalMcpProductClient {
218
249
  public readonly managedSource: ManagedSourceApi;
219
250
  public readonly productApiOrigin: string;
@@ -536,15 +567,9 @@ export class GeneratedSdkLocalMcpClient implements LocalMcpProductClient {
536
567
  assertBillingPortal(value);
537
568
  return value;
538
569
  }
539
- public async getOrganizationCreditUsage(
540
- input: Parameters<LocalMcpProductClient["getOrganizationCreditUsage"]>[0],
541
- ) {
570
+ public async getOrganizationCreditUsage(organizationId: string) {
542
571
  const value = await getOrganizationCreditUsage(
543
- {
544
- organization_id: input.organizationId,
545
- month: input.month,
546
- ...(input.cursor ? { cursor: input.cursor } : {}),
547
- },
572
+ { organization_id: organizationId },
548
573
  { client: this.#client },
549
574
  );
550
575
  assertOrganizationCreditUsage(value);
@@ -812,6 +837,194 @@ export class GeneratedSdkLocalMcpClient implements LocalMcpProductClient {
812
837
  assertProjectDatabaseAccess(value);
813
838
  return value;
814
839
  }
840
+ public async listDatabaseWebhooks(
841
+ input: Parameters<LocalMcpProductClient["listDatabaseWebhooks"]>[0],
842
+ ) {
843
+ const environment = input.environment ?? "dev";
844
+ const value = await listProjectDatabaseWebhooks(
845
+ { project_id: input.projectId, environment },
846
+ { client: this.#client },
847
+ );
848
+ assertDatabaseWebhookPage(value);
849
+ requireScope(value.items.every((webhook) => webhook.environment === environment));
850
+ return value;
851
+ }
852
+ /** The signing secret exists only in this response and is never stored by the client. */
853
+ public async createDatabaseWebhook(
854
+ input: Parameters<LocalMcpProductClient["createDatabaseWebhook"]>[0],
855
+ ) {
856
+ const value = await createProjectDatabaseWebhook(
857
+ {
858
+ project_id: input.projectId,
859
+ environment: input.environment,
860
+ "Idempotency-Key": input.idempotencyKey,
861
+ databaseWebhookCreateRequest: {
862
+ url: input.url,
863
+ event_types: [...input.eventTypes],
864
+ headers: { ...input.headers },
865
+ },
866
+ },
867
+ { client: this.#client },
868
+ );
869
+ assertDatabaseWebhookCreated(value);
870
+ requireScope(value.environment === input.environment);
871
+ return value;
872
+ }
873
+ public async testDatabaseWebhook(
874
+ input: Parameters<LocalMcpProductClient["testDatabaseWebhook"]>[0],
875
+ ) {
876
+ const value = await testProjectDatabaseWebhook(
877
+ {
878
+ project_id: input.projectId,
879
+ environment: input.environment,
880
+ webhook_id: input.webhookId,
881
+ },
882
+ { client: this.#client },
883
+ );
884
+ assertDatabaseWebhookTest(value);
885
+ return value;
886
+ }
887
+ public async deleteDatabaseWebhook(
888
+ input: Parameters<LocalMcpProductClient["deleteDatabaseWebhook"]>[0],
889
+ ) {
890
+ const value = await deleteProjectDatabaseWebhook(
891
+ {
892
+ project_id: input.projectId,
893
+ environment: input.environment,
894
+ webhook_id: input.webhookId,
895
+ },
896
+ { client: this.#client },
897
+ );
898
+ assertDatabaseWebhookDeleted(value);
899
+ requireScope(value.id === input.webhookId);
900
+ return value;
901
+ }
902
+ public async listDatabaseWebhookDeliveries(
903
+ input: Parameters<LocalMcpProductClient["listDatabaseWebhookDeliveries"]>[0],
904
+ ) {
905
+ const value = await listProjectDatabaseWebhookDeliveries(
906
+ {
907
+ project_id: input.projectId,
908
+ environment: input.environment ?? "dev",
909
+ ...(input.webhookId === undefined ? {} : { webhook_id: input.webhookId }),
910
+ ...(input.limit === undefined ? {} : { limit: input.limit }),
911
+ ...(input.cursor === undefined ? {} : { cursor: input.cursor }),
912
+ },
913
+ { client: this.#client },
914
+ );
915
+ assertDatabaseWebhookDeliveryPage(value);
916
+ requireScope(
917
+ input.webhookId === undefined ||
918
+ value.items.every((delivery) => delivery.webhook_id === input.webhookId),
919
+ );
920
+ return value;
921
+ }
922
+ public async replayDatabaseWebhookDelivery(
923
+ input: Parameters<LocalMcpProductClient["replayDatabaseWebhookDelivery"]>[0],
924
+ ) {
925
+ const value = await replayProjectDatabaseWebhookDelivery(
926
+ {
927
+ project_id: input.projectId,
928
+ environment: input.environment,
929
+ delivery_id: input.deliveryId,
930
+ },
931
+ { client: this.#client },
932
+ );
933
+ assertDatabaseWebhookReplayAccepted(value);
934
+ requireScope(value.delivery_id === input.deliveryId);
935
+ return value;
936
+ }
937
+ public async listDatabaseSchedules(
938
+ input: Parameters<LocalMcpProductClient["listDatabaseSchedules"]>[0],
939
+ ) {
940
+ const environment = input.environment ?? "dev";
941
+ const value = await listProjectDatabaseSchedules(
942
+ { project_id: input.projectId, environment },
943
+ { client: this.#client },
944
+ );
945
+ assertDatabaseSchedulePage(value);
946
+ requireScope(value.items.every((schedule) => schedule.environment === environment));
947
+ return value;
948
+ }
949
+ public async setDatabaseSchedule(
950
+ input: Parameters<LocalMcpProductClient["setDatabaseSchedule"]>[0],
951
+ ) {
952
+ const value = await setProjectDatabaseSchedule(
953
+ {
954
+ project_id: input.projectId,
955
+ name: input.name,
956
+ environment: input.environment,
957
+ databaseScheduleSetRequest: {
958
+ ...(input.cron === undefined ? {} : { cron: input.cron }),
959
+ ...(input.everySeconds === undefined ? {} : { every_seconds: input.everySeconds }),
960
+ statements: [...input.statements],
961
+ ...(input.timeoutMs === undefined ? {} : { timeout_ms: input.timeoutMs }),
962
+ ...(input.enabled === undefined ? {} : { enabled: input.enabled }),
963
+ confirm: true,
964
+ },
965
+ },
966
+ { client: this.#client },
967
+ );
968
+ assertDatabaseSchedule(value);
969
+ requireScope(value.name === input.name && value.environment === input.environment);
970
+ return value;
971
+ }
972
+ public async deleteDatabaseSchedule(
973
+ input: Parameters<LocalMcpProductClient["deleteDatabaseSchedule"]>[0],
974
+ ) {
975
+ const value = await deleteProjectDatabaseSchedule(
976
+ { project_id: input.projectId, name: input.name, environment: input.environment },
977
+ { client: this.#client },
978
+ );
979
+ assertDatabaseScheduleDeleted(value);
980
+ requireScope(value.name === input.name);
981
+ return value;
982
+ }
983
+ public async listDatabaseScheduleRuns(
984
+ input: Parameters<LocalMcpProductClient["listDatabaseScheduleRuns"]>[0],
985
+ ) {
986
+ const value = await listProjectDatabaseScheduleRuns(
987
+ {
988
+ project_id: input.projectId,
989
+ name: input.name,
990
+ environment: input.environment ?? "dev",
991
+ ...(input.limit === undefined ? {} : { limit: input.limit }),
992
+ },
993
+ { client: this.#client },
994
+ );
995
+ assertDatabaseScheduleRunPage(value);
996
+ requireScope(value.items.every((run) => run.schedule === input.name));
997
+ return value;
998
+ }
999
+ public async runDatabaseSchedule(
1000
+ input: Parameters<LocalMcpProductClient["runDatabaseSchedule"]>[0],
1001
+ ) {
1002
+ const value = await runProjectDatabaseSchedule(
1003
+ { project_id: input.projectId, name: input.name, environment: input.environment },
1004
+ { client: this.#client },
1005
+ );
1006
+ assertDatabaseScheduleRunAccepted(value);
1007
+ requireScope(value.schedule === input.name);
1008
+ return value;
1009
+ }
1010
+ public async getDatabaseExecutionUsage(
1011
+ input: Parameters<LocalMcpProductClient["getDatabaseExecutionUsage"]>[0],
1012
+ ) {
1013
+ const value = await getProjectDatabaseExecutionUsage(
1014
+ {
1015
+ project_id: input.projectId,
1016
+ environment: input.environment ?? "dev",
1017
+ from: input.from,
1018
+ to: input.to,
1019
+ granularity: input.granularity,
1020
+ ...(input.limit === undefined ? {} : { limit: input.limit }),
1021
+ ...(input.cursor === undefined ? {} : { cursor: input.cursor }),
1022
+ },
1023
+ { client: this.#client },
1024
+ );
1025
+ assertDatabaseExecutionUsagePage(value);
1026
+ return value;
1027
+ }
815
1028
  public planPromotion(input: Parameters<LocalMcpProductClient["planPromotion"]>[0]) {
816
1029
  return planDeploymentPromotion(
817
1030
  { project_id: input.projectId, source_deployment_id: input.sourceDeploymentId },