@amerged/ohmyhost-sdk 0.1.44 → 0.1.46

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.
@@ -957,12 +957,132 @@ export type DatabaseWebhookEventType =
957
957
  | "database.resized"
958
958
  | "database.deleted";
959
959
 
960
+ /**
961
+ * A platform event type, data.<topic> for the rows of one watched table, or data.* for every watched table. A bare * is not accepted and never matches data events.
962
+ */
963
+ export type DatabaseWebhookEventPattern = DatabaseWebhookEventType | string;
964
+
965
+ export type DatabaseTableCreateRequest = {
966
+ environment: "dev" | "prod";
967
+ /**
968
+ * Name of the new table in the public schema. Lower-case, not a PostgreSQL reserved word and not starting with pg_.
969
+ */
970
+ table: string;
971
+ /**
972
+ * Columns in the order written. Names are unique, and at most one column is an identity column.
973
+ */
974
+ columns: Array<DatabaseTableColumnRequest>;
975
+ /**
976
+ * Columns of the primary key, each one of the table's columns. Identity and primary key columns are NOT NULL; omitted when the table has no primary key.
977
+ */
978
+ primary_key?: Array<string>;
979
+ };
980
+
981
+ export type DatabaseTableColumnRequest = {
982
+ name: string;
983
+ type: DatabaseTableColumnType;
984
+ /**
985
+ * Whether the column accepts NULL. Identity and primary key columns never do.
986
+ */
987
+ nullable?: boolean;
988
+ /**
989
+ * Generated always as identity. Only integer and bigint columns can be identity columns, and an identity column has no default.
990
+ */
991
+ identity?: boolean;
992
+ /**
993
+ * now is now() on a timestamptz column; uuid is gen_random_uuid() on a uuid column. Omitted when the column has no default.
994
+ */
995
+ default?: "now" | "uuid";
996
+ };
997
+
998
+ export type DatabaseTableColumnType =
999
+ | "text"
1000
+ | "integer"
1001
+ | "bigint"
1002
+ | "boolean"
1003
+ | "numeric"
1004
+ | "double precision"
1005
+ | "timestamptz"
1006
+ | "date"
1007
+ | "uuid"
1008
+ | "jsonb";
1009
+
1010
+ export type DatabaseTableColumn = {
1011
+ name: string;
1012
+ type: DatabaseTableColumnType;
1013
+ nullable: boolean;
1014
+ identity: boolean;
1015
+ default: "now" | "uuid" | null;
1016
+ };
1017
+
1018
+ export type DatabaseTable = {
1019
+ environment: "dev" | "prod";
1020
+ schema: "public";
1021
+ table: string;
1022
+ columns: Array<DatabaseTableColumn>;
1023
+ primary_key: Array<string>;
1024
+ /**
1025
+ * true when this request created the table, false when an identical table already existed.
1026
+ */
1027
+ created: boolean;
1028
+ };
1029
+
1030
+ export type DatabaseTableCreated = {
1031
+ table: DatabaseTable;
1032
+ };
1033
+
1034
+ export type DatabaseWatchCreateRequest = {
1035
+ environment: "dev" | "prod";
1036
+ /**
1037
+ * Schema of the table, public when omitted. The schemas pgcf, ohmyhost, information_schema and pg_* cannot be watched.
1038
+ */
1039
+ schema?: string;
1040
+ /**
1041
+ * Ordinary table owned by the application, created by a deployed migration.
1042
+ */
1043
+ table: string;
1044
+ /**
1045
+ * Columns published with every event, exactly as written; names are case-sensitive.
1046
+ */
1047
+ columns: Array<string>;
1048
+ /**
1049
+ * Row changes that publish an event; all three when omitted.
1050
+ */
1051
+ operations?: Array<"insert" | "update" | "delete">;
1052
+ };
1053
+
1054
+ export type DatabaseWatch = {
1055
+ id: string;
1056
+ environment: "dev" | "prod";
1057
+ schema: string;
1058
+ table: string;
1059
+ columns: Array<string>;
1060
+ operations: Array<"insert" | "update" | "delete">;
1061
+ /**
1062
+ * Topic of the watched table, derived by the platform from its name.
1063
+ */
1064
+ topic: string;
1065
+ /**
1066
+ * Event type of the rows of the table; pass it to a database webhook.
1067
+ */
1068
+ event_type: string;
1069
+ };
1070
+
1071
+ export type DatabaseWatchPage = {
1072
+ items: Array<DatabaseWatch>;
1073
+ };
1074
+
1075
+ export type DatabaseWatchDeleted = {
1076
+ id: string;
1077
+ deleted: true;
1078
+ };
1079
+
960
1080
  export type DatabaseWebhookCreateRequest = {
961
1081
  /**
962
1082
  * HTTPS receiver URL.
963
1083
  */
964
1084
  url: string;
965
- event_types: Array<DatabaseWebhookEventType>;
1085
+ event_types: Array<DatabaseWebhookEventPattern>;
966
1086
  /**
967
1087
  * Extra headers sent with every delivery. Names are case-insensitive and must be unique; content-type, host, content-length, connection, transfer-encoding, user-agent, te, upgrade, expect and any name starting with pgcf-, cf- or x-forwarded- are refused.
968
1088
  */
@@ -975,7 +1095,7 @@ export type DatabaseWebhook = {
975
1095
  id: string;
976
1096
  environment: "dev" | "prod";
977
1097
  url: string;
978
- event_types: Array<DatabaseWebhookEventType>;
1098
+ event_types: Array<DatabaseWebhookEventPattern>;
979
1099
  /**
980
1100
  * Names of the extra headers only; their values are never returned.
981
1101
  */
@@ -987,7 +1107,7 @@ export type DatabaseWebhookCreated = {
987
1107
  id: string;
988
1108
  environment: "dev" | "prod";
989
1109
  url: string;
990
- event_types: Array<DatabaseWebhookEventType>;
1110
+ event_types: Array<DatabaseWebhookEventPattern>;
991
1111
  header_names: Array<string>;
992
1112
  created_at: string;
993
1113
  /**
@@ -1008,7 +1128,7 @@ export type DatabaseWebhookDeleted = {
1008
1128
  export type DatabaseWebhookDelivery = {
1009
1129
  id: string;
1010
1130
  event_id: string;
1011
- event_type: DatabaseWebhookEventType;
1131
+ event_type: DatabaseWebhookEventType | string;
1012
1132
  webhook_id: string;
1013
1133
  state: "pending" | "delivered" | "dead_lettered";
1014
1134
  attempts: number;
@@ -1605,6 +1725,13 @@ export type ProblemDetails = {
1605
1725
  | "database_schedule_limit"
1606
1726
  | "database_schedule_not_runnable"
1607
1727
  | "database_webhook_delivery_pending"
1728
+ | "database_watch_limit"
1729
+ | "database_watch_table_unavailable"
1730
+ | "database_watch_column_unavailable"
1731
+ | "database_watch_events_unavailable"
1732
+ | "database_watch_conflict"
1733
+ | "database_table_conflict"
1734
+ | "database_table_limit"
1608
1735
  | "compute_change_pending"
1609
1736
  | "compute_change_conflict"
1610
1737
  | "billing_purchase_conflict"
@@ -1910,6 +2037,11 @@ export type ProjectDataChangePlan = {
1910
2037
  expires_at: string;
1911
2038
  };
1912
2039
 
2040
+ /**
2041
+ * A platform event type, data.<topic> for the rows of one watched table, or data.* for every watched table. A bare * is not accepted and never matches data events.
2042
+ */
2043
+ export type DatabaseWebhookEventPatternWritable = DatabaseWebhookEventType | string;
2044
+
1913
2045
  /**
1914
2046
  * Immutable pre-build deployment plan. It expires exactly 24 hours after creation.
1915
2047
  */
@@ -2004,6 +2136,11 @@ export type DatabaseWebhookId = string;
2004
2136
  */
2005
2137
  export type DatabaseWebhookDeliveryId = string;
2006
2138
 
2139
+ /**
2140
+ * Database watch identifier, derived from the watched schema and table.
2141
+ */
2142
+ export type DatabaseWatchId = string;
2143
+
2007
2144
  /**
2008
2145
  * Database schedule name, unique per project environment.
2009
2146
  */
@@ -8116,6 +8253,272 @@ export type RevokeProjectDatabaseAccessResponses = {
8116
8253
  export type RevokeProjectDatabaseAccessResponse =
8117
8254
  RevokeProjectDatabaseAccessResponses[keyof RevokeProjectDatabaseAccessResponses];
8118
8255
 
8256
+ export type CreateProjectDatabaseTableData = {
8257
+ body: DatabaseTableCreateRequest;
8258
+ headers: {
8259
+ /**
8260
+ * Optional caller-provided correlation identifier.
8261
+ */
8262
+ "X-Request-Id"?: string;
8263
+ /**
8264
+ * Identifies one mutation and its canonical request payload.
8265
+ */
8266
+ "Idempotency-Key": string;
8267
+ };
8268
+ path: {
8269
+ /**
8270
+ * Project identifier.
8271
+ */
8272
+ project_id: Ulid;
8273
+ };
8274
+ query?: never;
8275
+ url: "/v1/projects/{project_id}/database/tables";
8276
+ };
8277
+
8278
+ export type CreateProjectDatabaseTableErrors = {
8279
+ /**
8280
+ * The request failed.
8281
+ */
8282
+ 400: ProblemDetails;
8283
+ /**
8284
+ * The request failed.
8285
+ */
8286
+ 401: ProblemDetails;
8287
+ /**
8288
+ * The request failed.
8289
+ */
8290
+ 402: ProblemDetails;
8291
+ /**
8292
+ * The resource does not exist or is not visible to the authenticated principal.
8293
+ */
8294
+ 404: ProblemDetails;
8295
+ /**
8296
+ * The request failed.
8297
+ */
8298
+ 409: ProblemDetails;
8299
+ /**
8300
+ * The request failed.
8301
+ */
8302
+ 429: ProblemDetails;
8303
+ /**
8304
+ * The request failed.
8305
+ */
8306
+ 503: ProblemDetails;
8307
+ };
8308
+
8309
+ export type CreateProjectDatabaseTableError =
8310
+ CreateProjectDatabaseTableErrors[keyof CreateProjectDatabaseTableErrors];
8311
+
8312
+ export type CreateProjectDatabaseTableResponses = {
8313
+ /**
8314
+ * The table already exists with the same columns, types, nullability, identity, defaults and primary key.
8315
+ */
8316
+ 200: DatabaseTableCreated;
8317
+ /**
8318
+ * The table this request created.
8319
+ */
8320
+ 201: DatabaseTableCreated;
8321
+ };
8322
+
8323
+ export type CreateProjectDatabaseTableResponse =
8324
+ CreateProjectDatabaseTableResponses[keyof CreateProjectDatabaseTableResponses];
8325
+
8326
+ export type ListProjectDatabaseWatchesData = {
8327
+ body?: never;
8328
+ headers?: {
8329
+ /**
8330
+ * Optional caller-provided correlation identifier.
8331
+ */
8332
+ "X-Request-Id"?: string;
8333
+ };
8334
+ path: {
8335
+ /**
8336
+ * Project identifier.
8337
+ */
8338
+ project_id: Ulid;
8339
+ };
8340
+ query?: {
8341
+ /**
8342
+ * Application environment to read; dev when omitted.
8343
+ */
8344
+ environment?: "dev" | "prod";
8345
+ };
8346
+ url: "/v1/projects/{project_id}/database/watches";
8347
+ };
8348
+
8349
+ export type ListProjectDatabaseWatchesErrors = {
8350
+ /**
8351
+ * The request failed.
8352
+ */
8353
+ 400: ProblemDetails;
8354
+ /**
8355
+ * The request failed.
8356
+ */
8357
+ 401: ProblemDetails;
8358
+ /**
8359
+ * The resource does not exist or is not visible to the authenticated principal.
8360
+ */
8361
+ 404: ProblemDetails;
8362
+ /**
8363
+ * The request failed.
8364
+ */
8365
+ 429: ProblemDetails;
8366
+ /**
8367
+ * The request failed.
8368
+ */
8369
+ 503: ProblemDetails;
8370
+ };
8371
+
8372
+ export type ListProjectDatabaseWatchesError =
8373
+ ListProjectDatabaseWatchesErrors[keyof ListProjectDatabaseWatchesErrors];
8374
+
8375
+ export type ListProjectDatabaseWatchesResponses = {
8376
+ /**
8377
+ * The database watches of the environment.
8378
+ */
8379
+ 200: DatabaseWatchPage;
8380
+ };
8381
+
8382
+ export type ListProjectDatabaseWatchesResponse =
8383
+ ListProjectDatabaseWatchesResponses[keyof ListProjectDatabaseWatchesResponses];
8384
+
8385
+ export type CreateProjectDatabaseWatchData = {
8386
+ body: DatabaseWatchCreateRequest;
8387
+ headers: {
8388
+ /**
8389
+ * Optional caller-provided correlation identifier.
8390
+ */
8391
+ "X-Request-Id"?: string;
8392
+ /**
8393
+ * Identifies one mutation and its canonical request payload.
8394
+ */
8395
+ "Idempotency-Key": string;
8396
+ };
8397
+ path: {
8398
+ /**
8399
+ * Project identifier.
8400
+ */
8401
+ project_id: Ulid;
8402
+ };
8403
+ query?: never;
8404
+ url: "/v1/projects/{project_id}/database/watches";
8405
+ };
8406
+
8407
+ export type CreateProjectDatabaseWatchErrors = {
8408
+ /**
8409
+ * The request failed.
8410
+ */
8411
+ 400: ProblemDetails;
8412
+ /**
8413
+ * The request failed.
8414
+ */
8415
+ 401: ProblemDetails;
8416
+ /**
8417
+ * The request failed.
8418
+ */
8419
+ 402: ProblemDetails;
8420
+ /**
8421
+ * The resource does not exist or is not visible to the authenticated principal.
8422
+ */
8423
+ 404: ProblemDetails;
8424
+ /**
8425
+ * The request failed.
8426
+ */
8427
+ 409: ProblemDetails;
8428
+ /**
8429
+ * The request failed.
8430
+ */
8431
+ 429: ProblemDetails;
8432
+ /**
8433
+ * The request failed.
8434
+ */
8435
+ 503: ProblemDetails;
8436
+ };
8437
+
8438
+ export type CreateProjectDatabaseWatchError =
8439
+ CreateProjectDatabaseWatchErrors[keyof CreateProjectDatabaseWatchErrors];
8440
+
8441
+ export type CreateProjectDatabaseWatchResponses = {
8442
+ /**
8443
+ * The watch with the event type its deliveries carry.
8444
+ */
8445
+ 201: DatabaseWatch;
8446
+ };
8447
+
8448
+ export type CreateProjectDatabaseWatchResponse =
8449
+ CreateProjectDatabaseWatchResponses[keyof CreateProjectDatabaseWatchResponses];
8450
+
8451
+ export type DeleteProjectDatabaseWatchData = {
8452
+ body?: never;
8453
+ headers: {
8454
+ /**
8455
+ * Optional caller-provided correlation identifier.
8456
+ */
8457
+ "X-Request-Id"?: string;
8458
+ /**
8459
+ * Identifies one mutation and its canonical request payload.
8460
+ */
8461
+ "Idempotency-Key": string;
8462
+ };
8463
+ path: {
8464
+ /**
8465
+ * Project identifier.
8466
+ */
8467
+ project_id: Ulid;
8468
+ /**
8469
+ * Database watch identifier, derived from the watched schema and table.
8470
+ */
8471
+ watch_id: string;
8472
+ };
8473
+ query: {
8474
+ /**
8475
+ * Application environment the mutation applies to.
8476
+ */
8477
+ environment: "dev" | "prod";
8478
+ };
8479
+ url: "/v1/projects/{project_id}/database/watches/{watch_id}";
8480
+ };
8481
+
8482
+ export type DeleteProjectDatabaseWatchErrors = {
8483
+ /**
8484
+ * The request failed.
8485
+ */
8486
+ 400: ProblemDetails;
8487
+ /**
8488
+ * The request failed.
8489
+ */
8490
+ 401: ProblemDetails;
8491
+ /**
8492
+ * The request failed.
8493
+ */
8494
+ 402: ProblemDetails;
8495
+ /**
8496
+ * The resource does not exist or is not visible to the authenticated principal.
8497
+ */
8498
+ 404: ProblemDetails;
8499
+ /**
8500
+ * The request failed.
8501
+ */
8502
+ 429: ProblemDetails;
8503
+ /**
8504
+ * The request failed.
8505
+ */
8506
+ 503: ProblemDetails;
8507
+ };
8508
+
8509
+ export type DeleteProjectDatabaseWatchError =
8510
+ DeleteProjectDatabaseWatchErrors[keyof DeleteProjectDatabaseWatchErrors];
8511
+
8512
+ export type DeleteProjectDatabaseWatchResponses = {
8513
+ /**
8514
+ * The identifier of the deleted watch.
8515
+ */
8516
+ 200: DatabaseWatchDeleted;
8517
+ };
8518
+
8519
+ export type DeleteProjectDatabaseWatchResponse =
8520
+ DeleteProjectDatabaseWatchResponses[keyof DeleteProjectDatabaseWatchResponses];
8521
+
8119
8522
  export type ListProjectDatabaseWebhooksData = {
8120
8523
  body?: never;
8121
8524
  headers?: {