@amerged/ohmyhost-sdk 0.1.45 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amerged/ohmyhost-sdk",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmyhost/sdk-ts",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -23,6 +23,7 @@ export {
23
23
  createOrganization,
24
24
  createProject,
25
25
  createProjectDatabaseAccess,
26
+ createProjectDatabaseTable,
26
27
  createProjectDatabaseWatch,
27
28
  createProjectDatabaseWebhook,
28
29
  createProjectDataChange,
@@ -274,6 +275,11 @@ export type {
274
275
  CreateProjectDatabaseAccessErrors,
275
276
  CreateProjectDatabaseAccessResponse,
276
277
  CreateProjectDatabaseAccessResponses,
278
+ CreateProjectDatabaseTableData,
279
+ CreateProjectDatabaseTableError,
280
+ CreateProjectDatabaseTableErrors,
281
+ CreateProjectDatabaseTableResponse,
282
+ CreateProjectDatabaseTableResponses,
277
283
  CreateProjectDatabaseWatchData,
278
284
  CreateProjectDatabaseWatchError,
279
285
  CreateProjectDatabaseWatchErrors,
@@ -333,6 +339,12 @@ export type {
333
339
  DatabaseScheduleRunAccepted,
334
340
  DatabaseScheduleRunPage,
335
341
  DatabaseScheduleSetRequest,
342
+ DatabaseTable,
343
+ DatabaseTableColumn,
344
+ DatabaseTableColumnRequest,
345
+ DatabaseTableColumnType,
346
+ DatabaseTableCreated,
347
+ DatabaseTableCreateRequest,
336
348
  DatabaseWatch,
337
349
  DatabaseWatchCreateRequest,
338
350
  DatabaseWatchDeleted,
@@ -60,6 +60,8 @@ import type {
60
60
  CreateOrganizationResponses,
61
61
  CreateProjectDatabaseAccessErrors,
62
62
  CreateProjectDatabaseAccessResponses,
63
+ CreateProjectDatabaseTableErrors,
64
+ CreateProjectDatabaseTableResponses,
63
65
  CreateProjectDatabaseWatchErrors,
64
66
  CreateProjectDatabaseWatchResponses,
65
67
  CreateProjectDatabaseWebhookErrors,
@@ -79,6 +81,7 @@ import type {
79
81
  CreateWorkspaceMailDomainRequest,
80
82
  CreateWorkspaceMailDomainResponses,
81
83
  DatabaseScheduleSetRequest,
84
+ DatabaseTableCreateRequest,
82
85
  DatabaseWatchCreateRequest,
83
86
  DatabaseWebhookCreateRequest,
84
87
  DeclareApplicationDomainIdentityErrors,
@@ -4766,6 +4769,57 @@ export const revokeProjectDatabaseAccess = <ThrowOnError extends boolean = true>
4766
4769
  });
4767
4770
  };
4768
4771
 
4772
+ /**
4773
+ * Create a table in the project's database
4774
+ *
4775
+ * Creates one ordinary table in the public schema of one environment's database, with the columns and the primary key the request names. Repeating an identical request answers the existing table with 200; a table of the same name with another definition is refused with database_table_conflict (409). The request wakes a sleeping database. A reached Stop budget refuses with project_budget_exceeded (402). At most 100 tables exist per database.
4776
+ */
4777
+ export const createProjectDatabaseTable = <ThrowOnError extends boolean = true>(
4778
+ parameters: {
4779
+ "X-Request-Id"?: string;
4780
+ "Idempotency-Key": string;
4781
+ project_id: Ulid;
4782
+ databaseTableCreateRequest: DatabaseTableCreateRequest;
4783
+ },
4784
+ options?: Options<never, ThrowOnError>,
4785
+ ): RequestResult<
4786
+ CreateProjectDatabaseTableResponses,
4787
+ CreateProjectDatabaseTableErrors,
4788
+ ThrowOnError,
4789
+ "data"
4790
+ > => {
4791
+ const params = buildClientParams(
4792
+ [parameters],
4793
+ [
4794
+ {
4795
+ args: [
4796
+ { in: "headers", key: "X-Request-Id" },
4797
+ { in: "headers", key: "Idempotency-Key" },
4798
+ { in: "path", key: "project_id" },
4799
+ { key: "databaseTableCreateRequest", map: "body" },
4800
+ ],
4801
+ },
4802
+ ],
4803
+ );
4804
+ return (options?.client ?? client).post<
4805
+ CreateProjectDatabaseTableResponses,
4806
+ CreateProjectDatabaseTableErrors,
4807
+ ThrowOnError,
4808
+ "data"
4809
+ >({
4810
+ responseStyle: "data",
4811
+ security: [{ scheme: "bearer", type: "http" }],
4812
+ url: "/v1/projects/{project_id}/database/tables",
4813
+ ...options,
4814
+ ...params,
4815
+ headers: {
4816
+ "Content-Type": "application/json",
4817
+ ...options?.headers,
4818
+ ...params.headers,
4819
+ },
4820
+ });
4821
+ };
4822
+
4769
4823
  /**
4770
4824
  * List the project's database watches
4771
4825
  *
@@ -962,6 +962,75 @@ export type DatabaseWebhookEventType =
962
962
  */
963
963
  export type DatabaseWebhookEventPattern = DatabaseWebhookEventType | string;
964
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
+
965
1034
  export type DatabaseWatchCreateRequest = {
966
1035
  environment: "dev" | "prod";
967
1036
  /**
@@ -1661,6 +1730,8 @@ export type ProblemDetails = {
1661
1730
  | "database_watch_column_unavailable"
1662
1731
  | "database_watch_events_unavailable"
1663
1732
  | "database_watch_conflict"
1733
+ | "database_table_conflict"
1734
+ | "database_table_limit"
1664
1735
  | "compute_change_pending"
1665
1736
  | "compute_change_conflict"
1666
1737
  | "billing_purchase_conflict"
@@ -8182,6 +8253,76 @@ export type RevokeProjectDatabaseAccessResponses = {
8182
8253
  export type RevokeProjectDatabaseAccessResponse =
8183
8254
  RevokeProjectDatabaseAccessResponses[keyof RevokeProjectDatabaseAccessResponses];
8184
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
+
8185
8326
  export type ListProjectDatabaseWatchesData = {
8186
8327
  body?: never;
8187
8328
  headers?: {