@powerlines/plugin-prisma 0.2.77 → 0.2.78

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 (86) 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 +20 -107
  37. package/dist/index.mjs +8 -96
  38. package/dist/powerlines/src/plugin-utils/get-config-path.cjs +49 -0
  39. package/dist/powerlines/src/plugin-utils/get-config-path.mjs +48 -0
  40. package/dist/powerlines/src/plugin-utils/paths.cjs +36 -0
  41. package/dist/powerlines/src/plugin-utils/paths.mjs +35 -0
  42. package/dist/types/index.cjs +0 -3
  43. package/dist/types/index.mjs +0 -4
  44. package/dist/types/plugin.cjs +0 -1
  45. package/dist/types/plugin.mjs +0 -2
  46. package/dist/types/prisma.cjs +0 -1
  47. package/dist/types/prisma.mjs +0 -2
  48. package/package.json +6 -6
  49. package/dist/auth.gen-BFteuMTV.cjs +0 -17
  50. package/dist/auth.gen-C4FxE4_3.mjs +0 -11
  51. package/dist/bodySerializer.gen-BLtxkFoA.cjs +0 -50
  52. package/dist/bodySerializer.gen-DBXNewIA.mjs +0 -32
  53. package/dist/client-BlRUW8mL.mjs +0 -1
  54. package/dist/client-DBAc9HV1.cjs +0 -0
  55. package/dist/client.gen-COMS1glH.mjs +0 -8
  56. package/dist/client.gen-CPQm4WCv.mjs +0 -176
  57. package/dist/client.gen-DPSMNZNm.cjs +0 -181
  58. package/dist/client.gen-JhYC1fDf.cjs +0 -13
  59. package/dist/get-schema-CKw6MiKb.mjs +0 -78
  60. package/dist/get-schema-CqMBOHOd.cjs +0 -118
  61. package/dist/params.gen-BM1l95BD.mjs +0 -64
  62. package/dist/params.gen-BtCSnwiV.cjs +0 -70
  63. package/dist/pathSerializer.gen-BEbuI0Vn.cjs +0 -117
  64. package/dist/pathSerializer.gen-m7BRzH23.mjs +0 -81
  65. package/dist/plugin-DE9fKOLA.cjs +0 -0
  66. package/dist/plugin-EFmNQLKA.mjs +0 -1
  67. package/dist/prisma-BzQJneyW.cjs +0 -0
  68. package/dist/prisma-CB-m5c-j.mjs +0 -1
  69. package/dist/prisma-postgres-CAOpTtWq.mjs +0 -15
  70. package/dist/prisma-postgres-dGaLzxF3.cjs +0 -21
  71. package/dist/queryKeySerializer.gen-4TWHHXn3.cjs +0 -81
  72. package/dist/queryKeySerializer.gen-BMMZAjVN.mjs +0 -63
  73. package/dist/schema-creator-Cfian3ih.mjs +0 -60
  74. package/dist/schema-creator-zmlwh4-l.cjs +0 -66
  75. package/dist/sdk.gen-B2his2jD.mjs +0 -256
  76. package/dist/sdk.gen-CAWIQ8BM.cjs +0 -261
  77. package/dist/serverSentEvents.gen-C4apQvDl.mjs +0 -94
  78. package/dist/serverSentEvents.gen-CiMMmhyQ.cjs +0 -100
  79. package/dist/types-CmY9-4ff.cjs +0 -0
  80. package/dist/types-Dbwx-Khg.mjs +0 -1
  81. package/dist/types.gen-BN-p9nVT.cjs +0 -0
  82. package/dist/types.gen-CS2KiRfG.mjs +0 -1
  83. package/dist/utils.gen-Bk2pTkV1.cjs +0 -101
  84. package/dist/utils.gen-C-7sZa7Z.mjs +0 -180
  85. package/dist/utils.gen-DATakax-.cjs +0 -227
  86. package/dist/utils.gen-RO8GxC4i.mjs +0 -78
@@ -1,78 +0,0 @@
1
- import { getBinaryTargetForCurrentPlatform } from "@prisma/get-platform";
2
- import prismaSchemaWasm from "@prisma/prisma-schema-wasm";
3
- import * as E from "fp-ts/Either";
4
- import { pipe } from "fp-ts/lib/function";
5
- import { match } from "ts-pattern";
6
-
7
- //#region src/helpers/get-schema.ts
8
- async function resolveBinaryTargets(generator) {
9
- for (const binaryTarget of generator.binaryTargets) {
10
- if (binaryTarget.fromEnvVar && process.env[binaryTarget.fromEnvVar]) {
11
- const value = JSON.parse(process.env[binaryTarget.fromEnvVar]);
12
- if (Array.isArray(value)) {
13
- generator.binaryTargets = value.map((v) => ({
14
- fromEnvVar: null,
15
- value: v
16
- }));
17
- await resolveBinaryTargets(generator);
18
- } else binaryTarget.value = value;
19
- }
20
- if (binaryTarget.value === "native") {
21
- binaryTarget.value = await getBinaryTargetForCurrentPlatform();
22
- binaryTarget.native = true;
23
- }
24
- }
25
- if (generator.binaryTargets.length === 0) generator.binaryTargets = [{
26
- fromEnvVar: null,
27
- value: await getBinaryTargetForCurrentPlatform(),
28
- native: true
29
- }];
30
- }
31
- /**
32
- * Retrieves the Prisma schema using the provided options.
33
- *
34
- * @param options - The options to customize the schema retrieval.
35
- * @returns The Prisma schema.
36
- */
37
- async function getSchema(options) {
38
- const configEither = pipe(E.tryCatch(() => {
39
- if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) prismaSchemaWasm.debug_panic();
40
- const params = JSON.stringify({
41
- prismaSchema: options.datamodel,
42
- datasourceOverrides: {},
43
- ignoreEnvVarErrors: options.ignoreEnvVarErrors ?? false,
44
- env: process.env
45
- });
46
- return prismaSchemaWasm.get_config(params);
47
- }, (e) => ({
48
- type: "wasm-error",
49
- reason: "(get-config wasm)",
50
- error: e
51
- })), E.map((result) => ({ result })), E.chainW(({ result }) => E.tryCatch(() => JSON.parse(result), (e) => ({
52
- type: "parse-json",
53
- reason: "Unable to parse JSON",
54
- error: e
55
- }))), E.chainW((response) => {
56
- if (response.errors.length > 0) return E.left({
57
- type: "validation-error",
58
- reason: "(get-config wasm)",
59
- error: response.errors
60
- });
61
- return E.right(response.config);
62
- }));
63
- if (E.isRight(configEither)) {
64
- const { right: data } = configEither;
65
- for (const generator of data.generators) await resolveBinaryTargets(generator);
66
- return Promise.resolve(data);
67
- }
68
- throw match(configEither.left).with({ type: "wasm-error" }, (e) => {
69
- return /* @__PURE__ */ new Error(`Prisma get-config Wasm runtime error: ${e.error.message}`);
70
- }).with({ type: "validation-error" }, (e) => {
71
- return /* @__PURE__ */ new Error(`Prisma get-config validation error: ${e.error.map((err) => err.message).join(", ")}`);
72
- }).otherwise((e) => {
73
- return /* @__PURE__ */ new Error(`Prisma get-config unknown error: ${e.reason} - ${e.error.message}`);
74
- });
75
- }
76
-
77
- //#endregion
78
- export { getSchema as t };
@@ -1,118 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
- let __prisma_get_platform = require("@prisma/get-platform");
29
- let __prisma_prisma_schema_wasm = require("@prisma/prisma-schema-wasm");
30
- __prisma_prisma_schema_wasm = __toESM(__prisma_prisma_schema_wasm);
31
- let fp_ts_Either = require("fp-ts/Either");
32
- fp_ts_Either = __toESM(fp_ts_Either);
33
- let fp_ts_lib_function = require("fp-ts/lib/function");
34
- let ts_pattern = require("ts-pattern");
35
-
36
- //#region src/helpers/get-schema.ts
37
- async function resolveBinaryTargets(generator) {
38
- for (const binaryTarget of generator.binaryTargets) {
39
- if (binaryTarget.fromEnvVar && process.env[binaryTarget.fromEnvVar]) {
40
- const value = JSON.parse(process.env[binaryTarget.fromEnvVar]);
41
- if (Array.isArray(value)) {
42
- generator.binaryTargets = value.map((v) => ({
43
- fromEnvVar: null,
44
- value: v
45
- }));
46
- await resolveBinaryTargets(generator);
47
- } else binaryTarget.value = value;
48
- }
49
- if (binaryTarget.value === "native") {
50
- binaryTarget.value = await (0, __prisma_get_platform.getBinaryTargetForCurrentPlatform)();
51
- binaryTarget.native = true;
52
- }
53
- }
54
- if (generator.binaryTargets.length === 0) generator.binaryTargets = [{
55
- fromEnvVar: null,
56
- value: await (0, __prisma_get_platform.getBinaryTargetForCurrentPlatform)(),
57
- native: true
58
- }];
59
- }
60
- /**
61
- * Retrieves the Prisma schema using the provided options.
62
- *
63
- * @param options - The options to customize the schema retrieval.
64
- * @returns The Prisma schema.
65
- */
66
- async function getSchema(options) {
67
- const configEither = (0, fp_ts_lib_function.pipe)(fp_ts_Either.tryCatch(() => {
68
- if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) __prisma_prisma_schema_wasm.default.debug_panic();
69
- const params = JSON.stringify({
70
- prismaSchema: options.datamodel,
71
- datasourceOverrides: {},
72
- ignoreEnvVarErrors: options.ignoreEnvVarErrors ?? false,
73
- env: process.env
74
- });
75
- return __prisma_prisma_schema_wasm.default.get_config(params);
76
- }, (e) => ({
77
- type: "wasm-error",
78
- reason: "(get-config wasm)",
79
- error: e
80
- })), fp_ts_Either.map((result) => ({ result })), fp_ts_Either.chainW(({ result }) => fp_ts_Either.tryCatch(() => JSON.parse(result), (e) => ({
81
- type: "parse-json",
82
- reason: "Unable to parse JSON",
83
- error: e
84
- }))), fp_ts_Either.chainW((response) => {
85
- if (response.errors.length > 0) return fp_ts_Either.left({
86
- type: "validation-error",
87
- reason: "(get-config wasm)",
88
- error: response.errors
89
- });
90
- return fp_ts_Either.right(response.config);
91
- }));
92
- if (fp_ts_Either.isRight(configEither)) {
93
- const { right: data } = configEither;
94
- for (const generator of data.generators) await resolveBinaryTargets(generator);
95
- return Promise.resolve(data);
96
- }
97
- throw (0, ts_pattern.match)(configEither.left).with({ type: "wasm-error" }, (e) => {
98
- return /* @__PURE__ */ new Error(`Prisma get-config Wasm runtime error: ${e.error.message}`);
99
- }).with({ type: "validation-error" }, (e) => {
100
- return /* @__PURE__ */ new Error(`Prisma get-config validation error: ${e.error.map((err) => err.message).join(", ")}`);
101
- }).otherwise((e) => {
102
- return /* @__PURE__ */ new Error(`Prisma get-config unknown error: ${e.reason} - ${e.error.message}`);
103
- });
104
- }
105
-
106
- //#endregion
107
- Object.defineProperty(exports, '__toESM', {
108
- enumerable: true,
109
- get: function () {
110
- return __toESM;
111
- }
112
- });
113
- Object.defineProperty(exports, 'getSchema', {
114
- enumerable: true,
115
- get: function () {
116
- return getSchema;
117
- }
118
- });
@@ -1,64 +0,0 @@
1
- //#region src/api/core/params.gen.ts
2
- const extraPrefixes = Object.entries({
3
- $body_: "body",
4
- $headers_: "headers",
5
- $path_: "path",
6
- $query_: "query"
7
- });
8
- const buildKeyMap = (fields, map) => {
9
- if (!map) map = /* @__PURE__ */ new Map();
10
- for (const config of fields) if ("in" in config) {
11
- if (config.key) map.set(config.key, {
12
- in: config.in,
13
- map: config.map
14
- });
15
- } else if ("key" in config) map.set(config.key, { map: config.map });
16
- else if (config.args) buildKeyMap(config.args, map);
17
- return map;
18
- };
19
- const stripEmptySlots = (params) => {
20
- for (const [slot, value] of Object.entries(params)) if (value && typeof value === "object" && !Object.keys(value).length) delete params[slot];
21
- };
22
- const buildClientParams = (args, fields) => {
23
- const params = {
24
- body: {},
25
- headers: {},
26
- path: {},
27
- query: {}
28
- };
29
- const map = buildKeyMap(fields);
30
- let config;
31
- for (const [index, arg] of args.entries()) {
32
- if (fields[index]) config = fields[index];
33
- if (!config) continue;
34
- if ("in" in config) if (config.key) {
35
- const field = map.get(config.key);
36
- const name = field.map || config.key;
37
- if (field.in) params[field.in][name] = arg;
38
- } else params.body = arg;
39
- else for (const [key, value] of Object.entries(arg ?? {})) {
40
- const field = map.get(key);
41
- if (field) if (field.in) {
42
- const name = field.map || key;
43
- params[field.in][name] = value;
44
- } else params[field.map] = value;
45
- else {
46
- const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));
47
- if (extra) {
48
- const [prefix, slot] = extra;
49
- params[slot][key.slice(prefix.length)] = value;
50
- } else if ("allowExtra" in config && config.allowExtra) {
51
- for (const [slot, allowed] of Object.entries(config.allowExtra)) if (allowed) {
52
- params[slot][key] = value;
53
- break;
54
- }
55
- }
56
- }
57
- }
58
- }
59
- stripEmptySlots(params);
60
- return params;
61
- };
62
-
63
- //#endregion
64
- export { buildClientParams as t };
@@ -1,70 +0,0 @@
1
-
2
- //#region src/api/core/params.gen.ts
3
- const extraPrefixes = Object.entries({
4
- $body_: "body",
5
- $headers_: "headers",
6
- $path_: "path",
7
- $query_: "query"
8
- });
9
- const buildKeyMap = (fields, map) => {
10
- if (!map) map = /* @__PURE__ */ new Map();
11
- for (const config of fields) if ("in" in config) {
12
- if (config.key) map.set(config.key, {
13
- in: config.in,
14
- map: config.map
15
- });
16
- } else if ("key" in config) map.set(config.key, { map: config.map });
17
- else if (config.args) buildKeyMap(config.args, map);
18
- return map;
19
- };
20
- const stripEmptySlots = (params) => {
21
- for (const [slot, value] of Object.entries(params)) if (value && typeof value === "object" && !Object.keys(value).length) delete params[slot];
22
- };
23
- const buildClientParams = (args, fields) => {
24
- const params = {
25
- body: {},
26
- headers: {},
27
- path: {},
28
- query: {}
29
- };
30
- const map = buildKeyMap(fields);
31
- let config;
32
- for (const [index, arg] of args.entries()) {
33
- if (fields[index]) config = fields[index];
34
- if (!config) continue;
35
- if ("in" in config) if (config.key) {
36
- const field = map.get(config.key);
37
- const name = field.map || config.key;
38
- if (field.in) params[field.in][name] = arg;
39
- } else params.body = arg;
40
- else for (const [key, value] of Object.entries(arg ?? {})) {
41
- const field = map.get(key);
42
- if (field) if (field.in) {
43
- const name = field.map || key;
44
- params[field.in][name] = value;
45
- } else params[field.map] = value;
46
- else {
47
- const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));
48
- if (extra) {
49
- const [prefix, slot] = extra;
50
- params[slot][key.slice(prefix.length)] = value;
51
- } else if ("allowExtra" in config && config.allowExtra) {
52
- for (const [slot, allowed] of Object.entries(config.allowExtra)) if (allowed) {
53
- params[slot][key] = value;
54
- break;
55
- }
56
- }
57
- }
58
- }
59
- }
60
- stripEmptySlots(params);
61
- return params;
62
- };
63
-
64
- //#endregion
65
- Object.defineProperty(exports, 'buildClientParams', {
66
- enumerable: true,
67
- get: function () {
68
- return buildClientParams;
69
- }
70
- });
@@ -1,117 +0,0 @@
1
-
2
- //#region src/api/core/pathSerializer.gen.ts
3
- const separatorArrayExplode = (style) => {
4
- switch (style) {
5
- case "label": return ".";
6
- case "matrix": return ";";
7
- case "simple": return ",";
8
- default: return "&";
9
- }
10
- };
11
- const separatorArrayNoExplode = (style) => {
12
- switch (style) {
13
- case "form": return ",";
14
- case "pipeDelimited": return "|";
15
- case "spaceDelimited": return "%20";
16
- default: return ",";
17
- }
18
- };
19
- const separatorObjectExplode = (style) => {
20
- switch (style) {
21
- case "label": return ".";
22
- case "matrix": return ";";
23
- case "simple": return ",";
24
- default: return "&";
25
- }
26
- };
27
- const serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
28
- if (!explode) {
29
- const joinedValues$1 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
30
- switch (style) {
31
- case "label": return `.${joinedValues$1}`;
32
- case "matrix": return `;${name}=${joinedValues$1}`;
33
- case "simple": return joinedValues$1;
34
- default: return `${name}=${joinedValues$1}`;
35
- }
36
- }
37
- const separator = separatorArrayExplode(style);
38
- const joinedValues = value.map((v) => {
39
- if (style === "label" || style === "simple") return allowReserved ? v : encodeURIComponent(v);
40
- return serializePrimitiveParam({
41
- allowReserved,
42
- name,
43
- value: v
44
- });
45
- }).join(separator);
46
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
47
- };
48
- const serializePrimitiveParam = ({ allowReserved, name, value }) => {
49
- if (value === void 0 || value === null) return "";
50
- if (typeof value === "object") throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
51
- return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
52
- };
53
- const serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
54
- if (value instanceof Date) return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
55
- if (style !== "deepObject" && !explode) {
56
- let values = [];
57
- Object.entries(value).forEach(([key, v]) => {
58
- values = [
59
- ...values,
60
- key,
61
- allowReserved ? v : encodeURIComponent(v)
62
- ];
63
- });
64
- const joinedValues$1 = values.join(",");
65
- switch (style) {
66
- case "form": return `${name}=${joinedValues$1}`;
67
- case "label": return `.${joinedValues$1}`;
68
- case "matrix": return `;${name}=${joinedValues$1}`;
69
- default: return joinedValues$1;
70
- }
71
- }
72
- const separator = separatorObjectExplode(style);
73
- const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
74
- allowReserved,
75
- name: style === "deepObject" ? `${name}[${key}]` : key,
76
- value: v
77
- })).join(separator);
78
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
79
- };
80
-
81
- //#endregion
82
- Object.defineProperty(exports, 'separatorArrayExplode', {
83
- enumerable: true,
84
- get: function () {
85
- return separatorArrayExplode;
86
- }
87
- });
88
- Object.defineProperty(exports, 'separatorArrayNoExplode', {
89
- enumerable: true,
90
- get: function () {
91
- return separatorArrayNoExplode;
92
- }
93
- });
94
- Object.defineProperty(exports, 'separatorObjectExplode', {
95
- enumerable: true,
96
- get: function () {
97
- return separatorObjectExplode;
98
- }
99
- });
100
- Object.defineProperty(exports, 'serializeArrayParam', {
101
- enumerable: true,
102
- get: function () {
103
- return serializeArrayParam;
104
- }
105
- });
106
- Object.defineProperty(exports, 'serializeObjectParam', {
107
- enumerable: true,
108
- get: function () {
109
- return serializeObjectParam;
110
- }
111
- });
112
- Object.defineProperty(exports, 'serializePrimitiveParam', {
113
- enumerable: true,
114
- get: function () {
115
- return serializePrimitiveParam;
116
- }
117
- });
@@ -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
- });