@powerlines/plugin-prisma 0.2.207 → 0.2.209

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.
Files changed (82) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/api/client/client.gen.cjs +175 -8
  3. package/dist/api/client/client.gen.mjs +174 -7
  4. package/dist/api/client/index.cjs +13 -18
  5. package/dist/api/client/index.mjs +5 -10
  6. package/dist/api/client/utils.gen.cjs +186 -13
  7. package/dist/api/client/utils.gen.mjs +178 -5
  8. package/dist/api/client.gen.cjs +8 -12
  9. package/dist/api/client.gen.mjs +7 -11
  10. package/dist/api/core/auth.gen.cjs +11 -2
  11. package/dist/api/core/auth.gen.mjs +9 -1
  12. package/dist/api/core/bodySerializer.gen.cjs +34 -4
  13. package/dist/api/core/bodySerializer.gen.mjs +30 -1
  14. package/dist/api/core/params.gen.cjs +64 -2
  15. package/dist/api/core/params.gen.mjs +62 -1
  16. package/dist/api/core/pathSerializer.gen.cjs +86 -7
  17. package/dist/api/core/pathSerializer.gen.mjs +79 -1
  18. package/dist/api/core/queryKeySerializer.gen.cjs +65 -4
  19. package/dist/api/core/queryKeySerializer.gen.mjs +61 -1
  20. package/dist/api/core/serverSentEvents.gen.cjs +94 -2
  21. package/dist/api/core/serverSentEvents.gen.mjs +92 -1
  22. package/dist/api/core/utils.gen.cjs +80 -6
  23. package/dist/api/core/utils.gen.mjs +76 -2
  24. package/dist/api/sdk.gen.cjs +255 -13
  25. package/dist/api/sdk.gen.mjs +254 -12
  26. package/dist/api/types.gen.cjs +0 -1
  27. package/dist/api/types.gen.mjs +0 -2
  28. package/dist/helpers/get-schema.cjs +80 -2
  29. package/dist/helpers/get-schema.mjs +76 -1
  30. package/dist/helpers/index.cjs +6 -6
  31. package/dist/helpers/index.mjs +3 -3
  32. package/dist/helpers/prisma-postgres.cjs +15 -2
  33. package/dist/helpers/prisma-postgres.mjs +13 -1
  34. package/dist/helpers/schema-creator.cjs +60 -2
  35. package/dist/helpers/schema-creator.mjs +58 -1
  36. package/dist/index.cjs +14 -25
  37. package/dist/index.mjs +6 -18
  38. package/dist/types/index.cjs +0 -3
  39. package/dist/types/index.mjs +0 -4
  40. package/dist/types/plugin.cjs +0 -1
  41. package/dist/types/plugin.mjs +0 -2
  42. package/dist/types/prisma.cjs +0 -1
  43. package/dist/types/prisma.mjs +0 -2
  44. package/package.json +5 -5
  45. package/dist/auth.gen-BFteuMTV.cjs +0 -17
  46. package/dist/auth.gen-C4FxE4_3.mjs +0 -11
  47. package/dist/bodySerializer.gen-BLtxkFoA.cjs +0 -50
  48. package/dist/bodySerializer.gen-DBXNewIA.mjs +0 -32
  49. package/dist/client-BlRUW8mL.mjs +0 -1
  50. package/dist/client-DBAc9HV1.cjs +0 -0
  51. package/dist/client.gen-COMS1glH.mjs +0 -8
  52. package/dist/client.gen-CPQm4WCv.mjs +0 -176
  53. package/dist/client.gen-DPSMNZNm.cjs +0 -181
  54. package/dist/client.gen-JhYC1fDf.cjs +0 -13
  55. package/dist/get-schema-CKw6MiKb.mjs +0 -78
  56. package/dist/get-schema-CqMBOHOd.cjs +0 -118
  57. package/dist/params.gen-BM1l95BD.mjs +0 -64
  58. package/dist/params.gen-BtCSnwiV.cjs +0 -70
  59. package/dist/pathSerializer.gen-BEbuI0Vn.cjs +0 -117
  60. package/dist/pathSerializer.gen-m7BRzH23.mjs +0 -81
  61. package/dist/plugin-DE9fKOLA.cjs +0 -0
  62. package/dist/plugin-EFmNQLKA.mjs +0 -1
  63. package/dist/prisma-BzQJneyW.cjs +0 -0
  64. package/dist/prisma-CB-m5c-j.mjs +0 -1
  65. package/dist/prisma-postgres-CAOpTtWq.mjs +0 -15
  66. package/dist/prisma-postgres-dGaLzxF3.cjs +0 -21
  67. package/dist/queryKeySerializer.gen-4TWHHXn3.cjs +0 -81
  68. package/dist/queryKeySerializer.gen-BMMZAjVN.mjs +0 -63
  69. package/dist/schema-creator-Cfian3ih.mjs +0 -60
  70. package/dist/schema-creator-zmlwh4-l.cjs +0 -66
  71. package/dist/sdk.gen-B2his2jD.mjs +0 -256
  72. package/dist/sdk.gen-CAWIQ8BM.cjs +0 -261
  73. package/dist/serverSentEvents.gen-C4apQvDl.mjs +0 -94
  74. package/dist/serverSentEvents.gen-CiMMmhyQ.cjs +0 -100
  75. package/dist/types-CmY9-4ff.cjs +0 -0
  76. package/dist/types-Dbwx-Khg.mjs +0 -1
  77. package/dist/types.gen-BN-p9nVT.cjs +0 -0
  78. package/dist/types.gen-CS2KiRfG.mjs +0 -1
  79. package/dist/utils.gen-Bk2pTkV1.cjs +0 -101
  80. package/dist/utils.gen-C-7sZa7Z.mjs +0 -180
  81. package/dist/utils.gen-DATakax-.cjs +0 -227
  82. package/dist/utils.gen-RO8GxC4i.mjs +0 -78
@@ -1,81 +0,0 @@
1
- //#region src/api/core/pathSerializer.gen.ts
2
- const separatorArrayExplode = (style) => {
3
- switch (style) {
4
- case "label": return ".";
5
- case "matrix": return ";";
6
- case "simple": return ",";
7
- default: return "&";
8
- }
9
- };
10
- const separatorArrayNoExplode = (style) => {
11
- switch (style) {
12
- case "form": return ",";
13
- case "pipeDelimited": return "|";
14
- case "spaceDelimited": return "%20";
15
- default: return ",";
16
- }
17
- };
18
- const separatorObjectExplode = (style) => {
19
- switch (style) {
20
- case "label": return ".";
21
- case "matrix": return ";";
22
- case "simple": return ",";
23
- default: return "&";
24
- }
25
- };
26
- const serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
27
- if (!explode) {
28
- const joinedValues$1 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
29
- switch (style) {
30
- case "label": return `.${joinedValues$1}`;
31
- case "matrix": return `;${name}=${joinedValues$1}`;
32
- case "simple": return joinedValues$1;
33
- default: return `${name}=${joinedValues$1}`;
34
- }
35
- }
36
- const separator = separatorArrayExplode(style);
37
- const joinedValues = value.map((v) => {
38
- if (style === "label" || style === "simple") return allowReserved ? v : encodeURIComponent(v);
39
- return serializePrimitiveParam({
40
- allowReserved,
41
- name,
42
- value: v
43
- });
44
- }).join(separator);
45
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
46
- };
47
- const serializePrimitiveParam = ({ allowReserved, name, value }) => {
48
- if (value === void 0 || value === null) return "";
49
- if (typeof value === "object") throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
50
- return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
51
- };
52
- const serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
53
- if (value instanceof Date) return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
54
- if (style !== "deepObject" && !explode) {
55
- let values = [];
56
- Object.entries(value).forEach(([key, v]) => {
57
- values = [
58
- ...values,
59
- key,
60
- allowReserved ? v : encodeURIComponent(v)
61
- ];
62
- });
63
- const joinedValues$1 = values.join(",");
64
- switch (style) {
65
- case "form": return `${name}=${joinedValues$1}`;
66
- case "label": return `.${joinedValues$1}`;
67
- case "matrix": return `;${name}=${joinedValues$1}`;
68
- default: return joinedValues$1;
69
- }
70
- }
71
- const separator = separatorObjectExplode(style);
72
- const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
73
- allowReserved,
74
- name: style === "deepObject" ? `${name}[${key}]` : key,
75
- value: v
76
- })).join(separator);
77
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
78
- };
79
-
80
- //#endregion
81
- export { serializeObjectParam as a, serializeArrayParam as i, separatorArrayNoExplode as n, serializePrimitiveParam as o, separatorObjectExplode as r, separatorArrayExplode as t };
File without changes
@@ -1 +0,0 @@
1
- export { };
File without changes
@@ -1 +0,0 @@
1
- export { };
@@ -1,15 +0,0 @@
1
- //#region src/helpers/prisma-postgres.ts
2
- /**
3
- * Find a Postgres database by name.
4
- *
5
- * @param context - The Prisma plugin context.
6
- * @param name - The name of the database to find.
7
- * @returns The database object if found, otherwise undefined.
8
- */
9
- async function findDatabaseByName(context, name) {
10
- if (!context.config.prisma.prismaPostgres?.projectId) throw new Error(`Prisma Postgres project ID is not configured. Please set "prisma.prismaPostgres.projectId" in your Powerlines configuration.`);
11
- return (await context.prisma.api.listDatabases({ path: { projectId: context.config.prisma.prismaPostgres.projectId } })).data.data.find((db) => db.name === name);
12
- }
13
-
14
- //#endregion
15
- export { findDatabaseByName as t };
@@ -1,21 +0,0 @@
1
-
2
- //#region src/helpers/prisma-postgres.ts
3
- /**
4
- * Find a Postgres database by name.
5
- *
6
- * @param context - The Prisma plugin context.
7
- * @param name - The name of the database to find.
8
- * @returns The database object if found, otherwise undefined.
9
- */
10
- async function findDatabaseByName(context, name) {
11
- if (!context.config.prisma.prismaPostgres?.projectId) throw new Error(`Prisma Postgres project ID is not configured. Please set "prisma.prismaPostgres.projectId" in your Powerlines configuration.`);
12
- return (await context.prisma.api.listDatabases({ path: { projectId: context.config.prisma.prismaPostgres.projectId } })).data.data.find((db) => db.name === name);
13
- }
14
-
15
- //#endregion
16
- Object.defineProperty(exports, 'findDatabaseByName', {
17
- enumerable: true,
18
- get: function () {
19
- return findDatabaseByName;
20
- }
21
- });
@@ -1,81 +0,0 @@
1
-
2
- //#region src/api/core/queryKeySerializer.gen.ts
3
- /**
4
- * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
5
- */
6
- const queryKeyJsonReplacer = (_key, value) => {
7
- if (value === void 0 || typeof value === "function" || typeof value === "symbol") return;
8
- if (typeof value === "bigint") return value.toString();
9
- if (value instanceof Date) return value.toISOString();
10
- return value;
11
- };
12
- /**
13
- * Safely stringifies a value and parses it back into a JsonValue.
14
- */
15
- const stringifyToJsonValue = (input) => {
16
- try {
17
- const json = JSON.stringify(input, queryKeyJsonReplacer);
18
- if (json === void 0) return;
19
- return JSON.parse(json);
20
- } catch {
21
- return;
22
- }
23
- };
24
- /**
25
- * Detects plain objects (including objects with a null prototype).
26
- */
27
- const isPlainObject = (value) => {
28
- if (value === null || typeof value !== "object") return false;
29
- const prototype = Object.getPrototypeOf(value);
30
- return prototype === Object.prototype || prototype === null;
31
- };
32
- /**
33
- * Turns URLSearchParams into a sorted JSON object for deterministic keys.
34
- */
35
- const serializeSearchParams = (params) => {
36
- const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b));
37
- const result = {};
38
- for (const [key, value] of entries) {
39
- const existing = result[key];
40
- if (existing === void 0) {
41
- result[key] = value;
42
- continue;
43
- }
44
- if (Array.isArray(existing)) existing.push(value);
45
- else result[key] = [existing, value];
46
- }
47
- return result;
48
- };
49
- /**
50
- * Normalizes any accepted value into a JSON-friendly shape for query keys.
51
- */
52
- const serializeQueryKeyValue = (value) => {
53
- if (value === null) return null;
54
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
55
- if (value === void 0 || typeof value === "function" || typeof value === "symbol") return;
56
- if (typeof value === "bigint") return value.toString();
57
- if (value instanceof Date) return value.toISOString();
58
- if (Array.isArray(value)) return stringifyToJsonValue(value);
59
- if (typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams) return serializeSearchParams(value);
60
- if (isPlainObject(value)) return stringifyToJsonValue(value);
61
- };
62
-
63
- //#endregion
64
- Object.defineProperty(exports, 'queryKeyJsonReplacer', {
65
- enumerable: true,
66
- get: function () {
67
- return queryKeyJsonReplacer;
68
- }
69
- });
70
- Object.defineProperty(exports, 'serializeQueryKeyValue', {
71
- enumerable: true,
72
- get: function () {
73
- return serializeQueryKeyValue;
74
- }
75
- });
76
- Object.defineProperty(exports, 'stringifyToJsonValue', {
77
- enumerable: true,
78
- get: function () {
79
- return stringifyToJsonValue;
80
- }
81
- });
@@ -1,63 +0,0 @@
1
- //#region src/api/core/queryKeySerializer.gen.ts
2
- /**
3
- * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
4
- */
5
- const queryKeyJsonReplacer = (_key, value) => {
6
- if (value === void 0 || typeof value === "function" || typeof value === "symbol") return;
7
- if (typeof value === "bigint") return value.toString();
8
- if (value instanceof Date) return value.toISOString();
9
- return value;
10
- };
11
- /**
12
- * Safely stringifies a value and parses it back into a JsonValue.
13
- */
14
- const stringifyToJsonValue = (input) => {
15
- try {
16
- const json = JSON.stringify(input, queryKeyJsonReplacer);
17
- if (json === void 0) return;
18
- return JSON.parse(json);
19
- } catch {
20
- return;
21
- }
22
- };
23
- /**
24
- * Detects plain objects (including objects with a null prototype).
25
- */
26
- const isPlainObject = (value) => {
27
- if (value === null || typeof value !== "object") return false;
28
- const prototype = Object.getPrototypeOf(value);
29
- return prototype === Object.prototype || prototype === null;
30
- };
31
- /**
32
- * Turns URLSearchParams into a sorted JSON object for deterministic keys.
33
- */
34
- const serializeSearchParams = (params) => {
35
- const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b));
36
- const result = {};
37
- for (const [key, value] of entries) {
38
- const existing = result[key];
39
- if (existing === void 0) {
40
- result[key] = value;
41
- continue;
42
- }
43
- if (Array.isArray(existing)) existing.push(value);
44
- else result[key] = [existing, value];
45
- }
46
- return result;
47
- };
48
- /**
49
- * Normalizes any accepted value into a JSON-friendly shape for query keys.
50
- */
51
- const serializeQueryKeyValue = (value) => {
52
- if (value === null) return null;
53
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
54
- if (value === void 0 || typeof value === "function" || typeof value === "symbol") return;
55
- if (typeof value === "bigint") return value.toString();
56
- if (value instanceof Date) return value.toISOString();
57
- if (Array.isArray(value)) return stringifyToJsonValue(value);
58
- if (typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams) return serializeSearchParams(value);
59
- if (isPlainObject(value)) return stringifyToJsonValue(value);
60
- };
61
-
62
- //#endregion
63
- export { serializeQueryKeyValue as n, stringifyToJsonValue as r, queryKeyJsonReplacer as t };
@@ -1,60 +0,0 @@
1
- import { SchemaCreator } from "prisma-util/schema-creator";
2
-
3
- //#region src/helpers/schema-creator.ts
4
- /**
5
- * Prisma schema creator that allows building a schema via code.
6
- */
7
- var PrismaSchemaCreator = class extends SchemaCreator {
8
- /** Prisma plugin context */
9
- #context;
10
- get generators() {
11
- return this.#context.prisma.schema.generators;
12
- }
13
- set generators(value) {
14
- this.#context.prisma.schema.generators = value;
15
- }
16
- constructor(context) {
17
- super();
18
- this.#context = context;
19
- this.#context.prisma ??= {};
20
- this.#context.prisma.schema ??= {
21
- generators: [],
22
- datasources: [],
23
- warnings: []
24
- };
25
- this.#context.prisma.schema.generators.forEach((generator) => {
26
- this.pushGenerator(generator);
27
- });
28
- }
29
- pushGenerator(generator) {
30
- if (this.generators.some((gen) => gen.name === generator.name)) this.generators = [...this.generators.filter((gen) => gen.name !== generator.name), generator];
31
- else this.generators.push(generator);
32
- return this;
33
- }
34
- build() {
35
- let schema = super.build();
36
- for (const generator of this.generators) schema = `
37
- generator ${generator.name} {
38
- provider = "${generator.provider.value}"
39
- output = "${generator.output?.value}"${generator.previewFeatures && generator.previewFeatures.length > 0 ? `
40
- previewFeatures = [${generator.previewFeatures.map((feature) => `"${feature}"`).join(", ")}]` : ""}${generator.config && Object.keys(generator.config).length > 0 ? Object.entries(generator.config).map(([key, value]) => {
41
- if (Array.isArray(value)) return `${key} = [${value.map((v) => `"${v}"`).join(", ")}]`;
42
- else return `${key} = "${value}"`;
43
- }).join("\n ") : ""}${generator.binaryTargets && generator.binaryTargets.length > 0 ? `
44
- binaryTargets = [${generator.binaryTargets.map((bt) => `"${bt.value}"`).join(", ")}]` : ""}${generator.envPaths?.rootEnvPath || generator.envPaths?.schemaEnvPath ? `
45
- env = {${generator.envPaths?.rootEnvPath ? `
46
- root = "${generator.envPaths.rootEnvPath}"` : ""}${generator.envPaths?.schemaEnvPath ? `
47
- schema = "${generator.envPaths.schemaEnvPath}"` : ""}
48
- }` : ""}
49
- }
50
-
51
- ${schema}`;
52
- return schema;
53
- }
54
- async write() {
55
- await this.#context.fs.write(this.#context.config.prisma.schema, this.build());
56
- }
57
- };
58
-
59
- //#endregion
60
- export { PrismaSchemaCreator as t };
@@ -1,66 +0,0 @@
1
- const require_get_schema = require('./get-schema-CqMBOHOd.cjs');
2
- let prisma_util_schema_creator = require("prisma-util/schema-creator");
3
-
4
- //#region src/helpers/schema-creator.ts
5
- /**
6
- * Prisma schema creator that allows building a schema via code.
7
- */
8
- var PrismaSchemaCreator = class extends prisma_util_schema_creator.SchemaCreator {
9
- /** Prisma plugin context */
10
- #context;
11
- get generators() {
12
- return this.#context.prisma.schema.generators;
13
- }
14
- set generators(value) {
15
- this.#context.prisma.schema.generators = value;
16
- }
17
- constructor(context) {
18
- super();
19
- this.#context = context;
20
- this.#context.prisma ??= {};
21
- this.#context.prisma.schema ??= {
22
- generators: [],
23
- datasources: [],
24
- warnings: []
25
- };
26
- this.#context.prisma.schema.generators.forEach((generator) => {
27
- this.pushGenerator(generator);
28
- });
29
- }
30
- pushGenerator(generator) {
31
- if (this.generators.some((gen) => gen.name === generator.name)) this.generators = [...this.generators.filter((gen) => gen.name !== generator.name), generator];
32
- else this.generators.push(generator);
33
- return this;
34
- }
35
- build() {
36
- let schema = super.build();
37
- for (const generator of this.generators) schema = `
38
- generator ${generator.name} {
39
- provider = "${generator.provider.value}"
40
- output = "${generator.output?.value}"${generator.previewFeatures && generator.previewFeatures.length > 0 ? `
41
- previewFeatures = [${generator.previewFeatures.map((feature) => `"${feature}"`).join(", ")}]` : ""}${generator.config && Object.keys(generator.config).length > 0 ? Object.entries(generator.config).map(([key, value]) => {
42
- if (Array.isArray(value)) return `${key} = [${value.map((v) => `"${v}"`).join(", ")}]`;
43
- else return `${key} = "${value}"`;
44
- }).join("\n ") : ""}${generator.binaryTargets && generator.binaryTargets.length > 0 ? `
45
- binaryTargets = [${generator.binaryTargets.map((bt) => `"${bt.value}"`).join(", ")}]` : ""}${generator.envPaths?.rootEnvPath || generator.envPaths?.schemaEnvPath ? `
46
- env = {${generator.envPaths?.rootEnvPath ? `
47
- root = "${generator.envPaths.rootEnvPath}"` : ""}${generator.envPaths?.schemaEnvPath ? `
48
- schema = "${generator.envPaths.schemaEnvPath}"` : ""}
49
- }` : ""}
50
- }
51
-
52
- ${schema}`;
53
- return schema;
54
- }
55
- async write() {
56
- await this.#context.fs.write(this.#context.config.prisma.schema, this.build());
57
- }
58
- };
59
-
60
- //#endregion
61
- Object.defineProperty(exports, 'PrismaSchemaCreator', {
62
- enumerable: true,
63
- get: function () {
64
- return PrismaSchemaCreator;
65
- }
66
- });
@@ -1,256 +0,0 @@
1
- import { t as client } from "./client.gen-COMS1glH.mjs";
2
-
3
- //#region src/api/sdk.gen.ts
4
- var HeyApiClient = class {
5
- client;
6
- constructor(args) {
7
- this.client = args?.client ?? client;
8
- }
9
- };
10
- var HeyApiRegistry = class {
11
- defaultKey = "default";
12
- instances = /* @__PURE__ */ new Map();
13
- get(key) {
14
- const instance = this.instances.get(key ?? this.defaultKey);
15
- if (!instance) throw new Error(`No SDK client found. Create one with "new PrismaClient()" to fix this error.`);
16
- return instance;
17
- }
18
- set(value, key) {
19
- this.instances.set(key ?? this.defaultKey, value);
20
- }
21
- };
22
- var PrismaClient = class PrismaClient extends HeyApiClient {
23
- static __registry = new HeyApiRegistry();
24
- constructor(args) {
25
- super(args);
26
- PrismaClient.__registry.set(this, args?.key);
27
- }
28
- /**
29
- * Delete database connection string
30
- *
31
- * Deletes the database connection string with the given ID.
32
- */
33
- deleteDatabaseConnectionString(options) {
34
- return (options.client ?? this.client).delete({
35
- url: "/v1/connections/{id}",
36
- ...options
37
- });
38
- }
39
- /**
40
- * Delete database
41
- *
42
- * Deletes the database with the given ID.
43
- */
44
- deleteDatabase(options) {
45
- return (options.client ?? this.client).delete({
46
- url: "/v1/databases/{databaseId}",
47
- ...options
48
- });
49
- }
50
- /**
51
- * Get database
52
- *
53
- * Returns the database with the given ID.
54
- */
55
- getDatabase(options) {
56
- return (options.client ?? this.client).get({
57
- url: "/v1/databases/{databaseId}",
58
- ...options
59
- });
60
- }
61
- /**
62
- * Get list of database connections
63
- *
64
- * Returns all connections for the given database.
65
- */
66
- listDatabaseConnections(options) {
67
- return (options.client ?? this.client).get({
68
- url: "/v1/databases/{databaseId}/connections",
69
- ...options
70
- });
71
- }
72
- /**
73
- * Create database connection string
74
- *
75
- * Creates a new connection string for the given database.
76
- */
77
- createDatabaseConnectionString(options) {
78
- return (options.client ?? this.client).post({
79
- url: "/v1/databases/{databaseId}/connections",
80
- ...options,
81
- headers: {
82
- "Content-Type": "application/json",
83
- ...options.headers
84
- }
85
- });
86
- }
87
- /**
88
- * Get list of backups
89
- *
90
- * Returns backups for the specified database.
91
- */
92
- listBackups(options) {
93
- return (options.client ?? this.client).get({
94
- url: "/v1/databases/{databaseId}/backups",
95
- ...options
96
- });
97
- }
98
- /**
99
- * Get database usage metrics
100
- *
101
- * Returns usage metrics for the specified database.
102
- */
103
- getDatabaseUsageMetrics(options) {
104
- return (options.client ?? this.client).get({
105
- url: "/v1/databases/{databaseId}/usage",
106
- ...options
107
- });
108
- }
109
- /**
110
- * Get list of projects
111
- *
112
- * Returns the list of projects the token has access to.
113
- */
114
- listProjects(options) {
115
- return (options?.client ?? this.client).get({
116
- url: "/v1/projects",
117
- ...options
118
- });
119
- }
120
- /**
121
- * Create project with a postgres database
122
- *
123
- * Creates a new project with a postgres database.
124
- */
125
- createProjectWithPostgresDatabase(options) {
126
- return (options?.client ?? this.client).post({
127
- url: "/v1/projects",
128
- ...options,
129
- headers: {
130
- "Content-Type": "application/json",
131
- ...options?.headers
132
- }
133
- });
134
- }
135
- /**
136
- * Delete project
137
- *
138
- * Deletes the project with the given ID.
139
- */
140
- deleteProject(options) {
141
- return (options.client ?? this.client).delete({
142
- url: "/v1/projects/{id}",
143
- ...options
144
- });
145
- }
146
- /**
147
- * Get project
148
- *
149
- * Returns the project with the given ID.
150
- */
151
- getProject(options) {
152
- return (options.client ?? this.client).get({
153
- url: "/v1/projects/{id}",
154
- ...options
155
- });
156
- }
157
- /**
158
- * Transfer project
159
- *
160
- * Transfer the project with the given ID to the new owner's workspace
161
- */
162
- transferProject(options) {
163
- return (options.client ?? this.client).post({
164
- url: "/v1/projects/{id}/transfer",
165
- ...options,
166
- headers: {
167
- "Content-Type": "application/json",
168
- ...options.headers
169
- }
170
- });
171
- }
172
- /**
173
- * Get list of databases
174
- *
175
- * Returns databases for the given project.
176
- */
177
- listDatabases(options) {
178
- return (options.client ?? this.client).get({
179
- url: "/v1/projects/{projectId}/databases",
180
- ...options
181
- });
182
- }
183
- /**
184
- * Create database
185
- *
186
- * Creates a new database for the given project.
187
- */
188
- createDatabase(options) {
189
- return (options.client ?? this.client).post({
190
- url: "/v1/projects/{projectId}/databases",
191
- ...options,
192
- headers: {
193
- "Content-Type": "application/json",
194
- ...options.headers
195
- }
196
- });
197
- }
198
- /**
199
- * Get list of integrations
200
- *
201
- * Returns integrations for the given workspace.
202
- */
203
- listIntegrations(options) {
204
- return (options.client ?? this.client).get({
205
- url: "/v1/workspaces/{workspaceId}/integrations",
206
- ...options
207
- });
208
- }
209
- /**
210
- * Revoke integration tokens
211
- *
212
- * Revokes the integration tokens with the given client ID.
213
- */
214
- revokeIntegrationTokens(options) {
215
- return (options.client ?? this.client).delete({
216
- url: "/v1/workspaces/{workspaceId}/integrations/{clientId}",
217
- ...options
218
- });
219
- }
220
- /**
221
- * Get Prisma Postgres regions
222
- *
223
- * Returns all available regions for Prisma Postgres.
224
- */
225
- getPrismaPostgresRegions(options) {
226
- return (options?.client ?? this.client).get({
227
- url: "/v1/regions/postgres",
228
- ...options
229
- });
230
- }
231
- /**
232
- * Get Prisma Accelerate regions
233
- *
234
- * Returns all available regions for Prisma Accelerate.
235
- */
236
- getPrismaAccelerateRegions(options) {
237
- return (options?.client ?? this.client).get({
238
- url: "/v1/regions/accelerate",
239
- ...options
240
- });
241
- }
242
- /**
243
- * Get list of workspaces
244
- *
245
- * Returns the list of workspaces the current token can access.
246
- */
247
- listWorkspaces(options) {
248
- return (options?.client ?? this.client).get({
249
- url: "/v1/workspaces",
250
- ...options
251
- });
252
- }
253
- };
254
-
255
- //#endregion
256
- export { PrismaClient as t };