@prisma/client-common 6.6.0-integration-push-xmzqvqxpztks.1

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 (60) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +5 -0
  3. package/dist/Cache.d.ts +6 -0
  4. package/dist/Cache.js +45 -0
  5. package/dist/Cache.mjs +21 -0
  6. package/dist/Cache.test.d.ts +1 -0
  7. package/dist/Cache.test.js +34 -0
  8. package/dist/Cache.test.mjs +33 -0
  9. package/dist/Dictionary.d.ts +6 -0
  10. package/dist/Dictionary.js +35 -0
  11. package/dist/Dictionary.mjs +11 -0
  12. package/dist/QueryCompiler.d.ts +29 -0
  13. package/dist/QueryCompiler.js +16 -0
  14. package/dist/QueryCompiler.mjs +0 -0
  15. package/dist/QueryEngine.d.ts +50 -0
  16. package/dist/QueryEngine.js +16 -0
  17. package/dist/QueryEngine.mjs +0 -0
  18. package/dist/casing.d.ts +6 -0
  19. package/dist/casing.js +36 -0
  20. package/dist/casing.mjs +11 -0
  21. package/dist/casing.test.d.ts +1 -0
  22. package/dist/casing.test.js +34 -0
  23. package/dist/casing.test.mjs +33 -0
  24. package/dist/client-config.d.ts +83 -0
  25. package/dist/client-config.js +16 -0
  26. package/dist/client-config.mjs +0 -0
  27. package/dist/dmmf.d.ts +4 -0
  28. package/dist/dmmf.js +16 -0
  29. package/dist/dmmf.mjs +0 -0
  30. package/dist/enums.d.ts +8 -0
  31. package/dist/enums.js +31 -0
  32. package/dist/enums.mjs +6 -0
  33. package/dist/index.d.ts +13 -0
  34. package/dist/index.js +46 -0
  35. package/dist/index.mjs +13 -0
  36. package/dist/lazyProperty.d.ts +4 -0
  37. package/dist/lazyProperty.js +39 -0
  38. package/dist/lazyProperty.mjs +15 -0
  39. package/dist/lazyProperty.test.d.ts +1 -0
  40. package/dist/lazyProperty.test.js +28 -0
  41. package/dist/lazyProperty.test.mjs +27 -0
  42. package/dist/omit.d.ts +1 -0
  43. package/dist/omit.js +30 -0
  44. package/dist/omit.mjs +6 -0
  45. package/dist/omit.test.d.ts +1 -0
  46. package/dist/omit.test.js +46 -0
  47. package/dist/omit.test.mjs +45 -0
  48. package/dist/operations.d.ts +3 -0
  49. package/dist/operations.js +16 -0
  50. package/dist/operations.mjs +0 -0
  51. package/dist/runtimeDataModel.d.ts +28 -0
  52. package/dist/runtimeDataModel.js +53 -0
  53. package/dist/runtimeDataModel.mjs +28 -0
  54. package/dist/uniqueBy.d.ts +5 -0
  55. package/dist/uniqueBy.js +37 -0
  56. package/dist/uniqueBy.mjs +13 -0
  57. package/dist/uniqueBy.test.d.ts +1 -0
  58. package/dist/uniqueBy.test.js +61 -0
  59. package/dist/uniqueBy.test.mjs +60 -0
  60. package/package.json +44 -0
@@ -0,0 +1,83 @@
1
+ import { ActiveConnectorType, EnvValue, GeneratorConfig } from '@prisma/generator';
2
+ import { LoadedEnv } from '@prisma/internals';
3
+ import { CompilerWasmLoadingConfig } from './QueryCompiler';
4
+ import { EngineWasmLoadingConfig } from './QueryEngine';
5
+ import { RuntimeDataModel } from './runtimeDataModel';
6
+ /**
7
+ * Config that is stored into the generated client. When the generated client is
8
+ * loaded, this same config is passed to {@link getPrismaClient} which creates a
9
+ * closure with that config around a non-instantiated [[PrismaClient]].
10
+ */
11
+ export type GetPrismaClientConfig = {
12
+ runtimeDataModel: RuntimeDataModel;
13
+ generator?: GeneratorConfig;
14
+ relativeEnvPaths: {
15
+ rootEnvPath?: string | null;
16
+ schemaEnvPath?: string | null;
17
+ };
18
+ relativePath: string;
19
+ dirname: string;
20
+ filename?: string;
21
+ clientVersion: string;
22
+ engineVersion: string;
23
+ datasourceNames: string[];
24
+ activeProvider: ActiveConnectorType;
25
+ /**
26
+ * The contents of the schema encoded into a string
27
+ * @remarks only used for the purpose of data proxy
28
+ */
29
+ inlineSchema: string;
30
+ /**
31
+ * A special env object just for the data proxy edge runtime.
32
+ * Allows bundlers to inject their own env variables (Vercel).
33
+ * Allows platforms to declare global variables as env (Workers).
34
+ * @remarks only used for the purpose of data proxy
35
+ */
36
+ injectableEdgeEnv?: () => LoadedEnv;
37
+ /**
38
+ * The contents of the datasource url saved in a string.
39
+ * This can either be an env var name or connection string.
40
+ * It is needed by the client to connect to the Data Proxy.
41
+ * @remarks only used for the purpose of data proxy
42
+ */
43
+ inlineDatasources: {
44
+ [name in string]: {
45
+ url: EnvValue;
46
+ };
47
+ };
48
+ /**
49
+ * The string hash that was produced for a given schema
50
+ * @remarks only used for the purpose of data proxy
51
+ */
52
+ inlineSchemaHash: string;
53
+ /**
54
+ * A marker to indicate that the client was not generated via `prisma
55
+ * generate` but was generated via `generate --postinstall` script instead.
56
+ * @remarks used to error for Vercel/Netlify for schema caching issues
57
+ */
58
+ postinstall?: boolean;
59
+ /**
60
+ * Information about the CI where the Prisma Client has been generated. The
61
+ * name of the CI environment is stored at generation time because CI
62
+ * information is not always available at runtime. Moreover, the edge client
63
+ * has no notion of environment variables, so this works around that.
64
+ * @remarks used to error for Vercel/Netlify for schema caching issues
65
+ */
66
+ ciName?: string;
67
+ /**
68
+ * Information about whether we have not found a schema.prisma file in the
69
+ * default location, and that we fell back to finding the schema.prisma file
70
+ * in the current working directory. This usually means it has been bundled.
71
+ */
72
+ isBundled?: boolean;
73
+ /**
74
+ * A boolean that is `false` when the client was generated with --no-engine. At
75
+ * runtime, this means the client will be bound to be using the Data Proxy.
76
+ */
77
+ copyEngine?: boolean;
78
+ /**
79
+ * Optional wasm loading configuration
80
+ */
81
+ engineWasm?: EngineWasmLoadingConfig;
82
+ compilerWasm?: CompilerWasmLoadingConfig;
83
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var client_config_exports = {};
16
+ module.exports = __toCommonJS(client_config_exports);
File without changes
package/dist/dmmf.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import * as DMMF from '@prisma/dmmf';
2
+ export type BaseDMMF = {
3
+ readonly datamodel: Omit<DMMF.Datamodel, 'indexes'>;
4
+ };
package/dist/dmmf.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var dmmf_exports = {};
16
+ module.exports = __toCommonJS(dmmf_exports);
package/dist/dmmf.mjs ADDED
File without changes
@@ -0,0 +1,8 @@
1
+ /**
2
+ * List of Prisma enums that must be strict enums because they can be used in optional fields.
3
+ */
4
+ export declare const strictEnumNames: string[];
5
+ /**
6
+ * List of Prisma enums that must use unique objects instead of strings as their values.
7
+ */
8
+ export declare const objectEnumNames: string[];
package/dist/enums.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var enums_exports = {};
20
+ __export(enums_exports, {
21
+ objectEnumNames: () => objectEnumNames,
22
+ strictEnumNames: () => strictEnumNames
23
+ });
24
+ module.exports = __toCommonJS(enums_exports);
25
+ const strictEnumNames = ["TransactionIsolationLevel"];
26
+ const objectEnumNames = ["JsonNullValueInput", "NullableJsonNullValueInput", "JsonNullValueFilter"];
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ objectEnumNames,
30
+ strictEnumNames
31
+ });
package/dist/enums.mjs ADDED
@@ -0,0 +1,6 @@
1
+ const strictEnumNames = ["TransactionIsolationLevel"];
2
+ const objectEnumNames = ["JsonNullValueInput", "NullableJsonNullValueInput", "JsonNullValueFilter"];
3
+ export {
4
+ objectEnumNames,
5
+ strictEnumNames
6
+ };
@@ -0,0 +1,13 @@
1
+ export * from './Cache';
2
+ export * from './casing';
3
+ export * from './client-config';
4
+ export * from './Dictionary';
5
+ export * from './dmmf';
6
+ export * from './enums';
7
+ export * from './lazyProperty';
8
+ export * from './omit';
9
+ export * from './operations';
10
+ export * from './QueryCompiler';
11
+ export * from './QueryEngine';
12
+ export * from './runtimeDataModel';
13
+ export * from './uniqueBy';
package/dist/index.js ADDED
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var index_exports = {};
17
+ module.exports = __toCommonJS(index_exports);
18
+ __reExport(index_exports, require("./Cache"), module.exports);
19
+ __reExport(index_exports, require("./casing"), module.exports);
20
+ __reExport(index_exports, require("./client-config"), module.exports);
21
+ __reExport(index_exports, require("./Dictionary"), module.exports);
22
+ __reExport(index_exports, require("./dmmf"), module.exports);
23
+ __reExport(index_exports, require("./enums"), module.exports);
24
+ __reExport(index_exports, require("./lazyProperty"), module.exports);
25
+ __reExport(index_exports, require("./omit"), module.exports);
26
+ __reExport(index_exports, require("./operations"), module.exports);
27
+ __reExport(index_exports, require("./QueryCompiler"), module.exports);
28
+ __reExport(index_exports, require("./QueryEngine"), module.exports);
29
+ __reExport(index_exports, require("./runtimeDataModel"), module.exports);
30
+ __reExport(index_exports, require("./uniqueBy"), module.exports);
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ ...require("./Cache"),
34
+ ...require("./casing"),
35
+ ...require("./client-config"),
36
+ ...require("./Dictionary"),
37
+ ...require("./dmmf"),
38
+ ...require("./enums"),
39
+ ...require("./lazyProperty"),
40
+ ...require("./omit"),
41
+ ...require("./operations"),
42
+ ...require("./QueryCompiler"),
43
+ ...require("./QueryEngine"),
44
+ ...require("./runtimeDataModel"),
45
+ ...require("./uniqueBy")
46
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,13 @@
1
+ export * from "./Cache";
2
+ export * from "./casing";
3
+ export * from "./client-config";
4
+ export * from "./Dictionary";
5
+ export * from "./dmmf";
6
+ export * from "./enums";
7
+ export * from "./lazyProperty";
8
+ export * from "./omit";
9
+ export * from "./operations";
10
+ export * from "./QueryCompiler";
11
+ export * from "./QueryEngine";
12
+ export * from "./runtimeDataModel";
13
+ export * from "./uniqueBy";
@@ -0,0 +1,4 @@
1
+ export type LazyProperty<T> = {
2
+ get: () => T;
3
+ };
4
+ export declare function lazyProperty<T>(compute: () => T): LazyProperty<T>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var lazyProperty_exports = {};
20
+ __export(lazyProperty_exports, {
21
+ lazyProperty: () => lazyProperty
22
+ });
23
+ module.exports = __toCommonJS(lazyProperty_exports);
24
+ function lazyProperty(compute) {
25
+ let resultContainer;
26
+ return {
27
+ get() {
28
+ if (resultContainer) {
29
+ return resultContainer.value;
30
+ }
31
+ resultContainer = { value: compute() };
32
+ return resultContainer.value;
33
+ }
34
+ };
35
+ }
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ lazyProperty
39
+ });
@@ -0,0 +1,15 @@
1
+ function lazyProperty(compute) {
2
+ let resultContainer;
3
+ return {
4
+ get() {
5
+ if (resultContainer) {
6
+ return resultContainer.value;
7
+ }
8
+ resultContainer = { value: compute() };
9
+ return resultContainer.value;
10
+ }
11
+ };
12
+ }
13
+ export {
14
+ lazyProperty
15
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var import_vitest = require("vitest");
3
+ var import_lazyProperty = require("./lazyProperty");
4
+ (0, import_vitest.test)("returns callback value", () => {
5
+ const prop = (0, import_lazyProperty.lazyProperty)(import_vitest.vi.fn().mockReturnValue(123));
6
+ (0, import_vitest.expect)(prop.get()).toBe(123);
7
+ });
8
+ (0, import_vitest.test)("computes property only once", () => {
9
+ const compute = import_vitest.vi.fn().mockReturnValue(123);
10
+ const prop = (0, import_lazyProperty.lazyProperty)(compute);
11
+ prop.get();
12
+ prop.get();
13
+ (0, import_vitest.expect)(compute).toHaveBeenCalledTimes(1);
14
+ });
15
+ (0, import_vitest.test)("caches undefined values", () => {
16
+ const compute = import_vitest.vi.fn().mockReturnValue(void 0);
17
+ const prop = (0, import_lazyProperty.lazyProperty)(compute);
18
+ prop.get();
19
+ prop.get();
20
+ (0, import_vitest.expect)(compute).toHaveBeenCalledTimes(1);
21
+ });
22
+ (0, import_vitest.test)("caches null values", () => {
23
+ const compute = import_vitest.vi.fn().mockReturnValue(null);
24
+ const prop = (0, import_lazyProperty.lazyProperty)(compute);
25
+ prop.get();
26
+ prop.get();
27
+ (0, import_vitest.expect)(compute).toHaveBeenCalledTimes(1);
28
+ });
@@ -0,0 +1,27 @@
1
+ import { expect, test, vi } from "vitest";
2
+ import { lazyProperty } from "./lazyProperty";
3
+ test("returns callback value", () => {
4
+ const prop = lazyProperty(vi.fn().mockReturnValue(123));
5
+ expect(prop.get()).toBe(123);
6
+ });
7
+ test("computes property only once", () => {
8
+ const compute = vi.fn().mockReturnValue(123);
9
+ const prop = lazyProperty(compute);
10
+ prop.get();
11
+ prop.get();
12
+ expect(compute).toHaveBeenCalledTimes(1);
13
+ });
14
+ test("caches undefined values", () => {
15
+ const compute = vi.fn().mockReturnValue(void 0);
16
+ const prop = lazyProperty(compute);
17
+ prop.get();
18
+ prop.get();
19
+ expect(compute).toHaveBeenCalledTimes(1);
20
+ });
21
+ test("caches null values", () => {
22
+ const compute = vi.fn().mockReturnValue(null);
23
+ const prop = lazyProperty(compute);
24
+ prop.get();
25
+ prop.get();
26
+ expect(compute).toHaveBeenCalledTimes(1);
27
+ });
package/dist/omit.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
package/dist/omit.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var omit_exports = {};
20
+ __export(omit_exports, {
21
+ omit: () => omit
22
+ });
23
+ module.exports = __toCommonJS(omit_exports);
24
+ function omit(obj, keys) {
25
+ return Object.fromEntries(Object.entries(obj).filter(([key, _]) => !keys.includes(key)));
26
+ }
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ omit
30
+ });
package/dist/omit.mjs ADDED
@@ -0,0 +1,6 @@
1
+ function omit(obj, keys) {
2
+ return Object.fromEntries(Object.entries(obj).filter(([key, _]) => !keys.includes(key)));
3
+ }
4
+ export {
5
+ omit
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var import_vitest = require("vitest");
3
+ var import_omit = require("./omit");
4
+ (0, import_vitest.describe)("omit", () => {
5
+ (0, import_vitest.it)("should remove specified keys from an object", () => {
6
+ const obj = { a: 1, b: 2, c: 3 };
7
+ const result = (0, import_omit.omit)(obj, ["a", "c"]);
8
+ (0, import_vitest.expect)(result).toEqual({ b: 2 });
9
+ (0, import_vitest.expect)(result).not.toHaveProperty("a");
10
+ (0, import_vitest.expect)(result).not.toHaveProperty("c");
11
+ });
12
+ (0, import_vitest.it)("should return the original object when no keys are provided", () => {
13
+ const obj = { a: 1, b: 2, c: 3 };
14
+ const result = (0, import_omit.omit)(obj, []);
15
+ (0, import_vitest.expect)(result).toEqual(obj);
16
+ });
17
+ (0, import_vitest.it)("should handle when keys to omit do not exist in the object", () => {
18
+ const obj = { a: 1, b: 2 };
19
+ const result = (0, import_omit.omit)(obj, ["c"]);
20
+ (0, import_vitest.expect)(result).toEqual(obj);
21
+ });
22
+ (0, import_vitest.it)("should work with complex object values", () => {
23
+ const obj = {
24
+ a: { nested: true },
25
+ b: [1, 2, 3],
26
+ c: "string",
27
+ d: null
28
+ };
29
+ const result = (0, import_omit.omit)(obj, ["b", "d"]);
30
+ (0, import_vitest.expect)(result).toEqual({
31
+ a: { nested: true },
32
+ c: "string"
33
+ });
34
+ });
35
+ (0, import_vitest.it)("should preserve the reference of non-primitive values", () => {
36
+ const nestedObj = { nested: true };
37
+ const obj = { a: nestedObj, b: 2 };
38
+ const result = (0, import_omit.omit)(obj, ["b"]);
39
+ (0, import_vitest.expect)(result.a).toBe(nestedObj);
40
+ });
41
+ (0, import_vitest.it)("should handle empty objects", () => {
42
+ const obj = {};
43
+ const result = (0, import_omit.omit)(obj, ["a"]);
44
+ (0, import_vitest.expect)(result).toEqual({});
45
+ });
46
+ });
@@ -0,0 +1,45 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { omit } from "./omit";
3
+ describe("omit", () => {
4
+ it("should remove specified keys from an object", () => {
5
+ const obj = { a: 1, b: 2, c: 3 };
6
+ const result = omit(obj, ["a", "c"]);
7
+ expect(result).toEqual({ b: 2 });
8
+ expect(result).not.toHaveProperty("a");
9
+ expect(result).not.toHaveProperty("c");
10
+ });
11
+ it("should return the original object when no keys are provided", () => {
12
+ const obj = { a: 1, b: 2, c: 3 };
13
+ const result = omit(obj, []);
14
+ expect(result).toEqual(obj);
15
+ });
16
+ it("should handle when keys to omit do not exist in the object", () => {
17
+ const obj = { a: 1, b: 2 };
18
+ const result = omit(obj, ["c"]);
19
+ expect(result).toEqual(obj);
20
+ });
21
+ it("should work with complex object values", () => {
22
+ const obj = {
23
+ a: { nested: true },
24
+ b: [1, 2, 3],
25
+ c: "string",
26
+ d: null
27
+ };
28
+ const result = omit(obj, ["b", "d"]);
29
+ expect(result).toEqual({
30
+ a: { nested: true },
31
+ c: "string"
32
+ });
33
+ });
34
+ it("should preserve the reference of non-primitive values", () => {
35
+ const nestedObj = { nested: true };
36
+ const obj = { a: nestedObj, b: 2 };
37
+ const result = omit(obj, ["b"]);
38
+ expect(result.a).toBe(nestedObj);
39
+ });
40
+ it("should handle empty objects", () => {
41
+ const obj = {};
42
+ const result = omit(obj, ["a"]);
43
+ expect(result).toEqual({});
44
+ });
45
+ });
@@ -0,0 +1,3 @@
1
+ export type Operation = 'findFirst' | 'findFirstOrThrow' | 'findUnique' | 'findUniqueOrThrow' | 'findMany' | 'create' | 'createMany' | 'createManyAndReturn' | 'update' | 'updateMany' | 'updateManyAndReturn' | 'upsert' | 'delete' | 'deleteMany' | 'aggregate' | 'count' | 'groupBy' | '$queryRaw' | '$executeRaw' | '$queryRawUnsafe' | '$executeRawUnsafe' | 'findRaw' | 'aggregateRaw' | '$runCommandRaw';
2
+ export type FluentOperation = 'findUnique' | 'findUniqueOrThrow' | 'findFirst' | 'findFirstOrThrow' | 'create' | 'update' | 'upsert' | 'delete';
3
+ export type NonModelOperation = '$queryRaw' | '$queryRawTyped' | '$queryRawUnsafe' | '$executeRaw' | '$executeRawUnsafe' | '$runCommandRaw';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var operations_exports = {};
16
+ module.exports = __toCommonJS(operations_exports);
File without changes
@@ -0,0 +1,28 @@
1
+ import type * as DMMF from '@prisma/dmmf';
2
+ export type RuntimeModel = Omit<DMMF.Model, 'name'>;
3
+ export type RuntimeEnum = Omit<DMMF.DatamodelEnum, 'name'>;
4
+ export type RuntimeDataModel = {
5
+ readonly models: Record<string, RuntimeModel>;
6
+ readonly enums: Record<string, RuntimeEnum>;
7
+ readonly types: Record<string, RuntimeModel>;
8
+ };
9
+ export type PrunedRuntimeModel = {
10
+ readonly dbName: RuntimeModel['dbName'];
11
+ readonly fields: Pick<RuntimeModel['fields'][number], 'name' | 'kind' | 'type' | 'relationName' | 'dbName'>[];
12
+ };
13
+ export type PrunedRuntimeDataModel = {
14
+ readonly models: Record<string, PrunedRuntimeModel>;
15
+ readonly enums: {};
16
+ readonly types: {};
17
+ };
18
+ export declare function dmmfToRuntimeDataModel(dmmfDataModel: DMMF.Datamodel): RuntimeDataModel;
19
+ /**
20
+ * Minimal version of the runtime datamodel for the Client to work
21
+ * @param runtimeDataModel
22
+ * @returns
23
+ */
24
+ export declare function pruneRuntimeDataModel({ models }: RuntimeDataModel): {
25
+ models: Record<string, PrunedRuntimeModel>;
26
+ enums: {};
27
+ types: {};
28
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var runtimeDataModel_exports = {};
20
+ __export(runtimeDataModel_exports, {
21
+ dmmfToRuntimeDataModel: () => dmmfToRuntimeDataModel,
22
+ pruneRuntimeDataModel: () => pruneRuntimeDataModel
23
+ });
24
+ module.exports = __toCommonJS(runtimeDataModel_exports);
25
+ function dmmfToRuntimeDataModel(dmmfDataModel) {
26
+ return {
27
+ models: buildMapForRuntime(dmmfDataModel.models),
28
+ enums: buildMapForRuntime(dmmfDataModel.enums),
29
+ types: buildMapForRuntime(dmmfDataModel.types)
30
+ };
31
+ }
32
+ function pruneRuntimeDataModel({ models }) {
33
+ const prunedModels = {};
34
+ for (const modelName of Object.keys(models)) {
35
+ prunedModels[modelName] = { fields: [], dbName: models[modelName].dbName };
36
+ for (const { name, kind, type, relationName, dbName } of models[modelName].fields) {
37
+ prunedModels[modelName].fields.push({ name, kind, type, relationName, dbName });
38
+ }
39
+ }
40
+ return { models: prunedModels, enums: {}, types: {} };
41
+ }
42
+ function buildMapForRuntime(list) {
43
+ const result = {};
44
+ for (const { name, ...rest } of list) {
45
+ result[name] = rest;
46
+ }
47
+ return result;
48
+ }
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ dmmfToRuntimeDataModel,
52
+ pruneRuntimeDataModel
53
+ });
@@ -0,0 +1,28 @@
1
+ function dmmfToRuntimeDataModel(dmmfDataModel) {
2
+ return {
3
+ models: buildMapForRuntime(dmmfDataModel.models),
4
+ enums: buildMapForRuntime(dmmfDataModel.enums),
5
+ types: buildMapForRuntime(dmmfDataModel.types)
6
+ };
7
+ }
8
+ function pruneRuntimeDataModel({ models }) {
9
+ const prunedModels = {};
10
+ for (const modelName of Object.keys(models)) {
11
+ prunedModels[modelName] = { fields: [], dbName: models[modelName].dbName };
12
+ for (const { name, kind, type, relationName, dbName } of models[modelName].fields) {
13
+ prunedModels[modelName].fields.push({ name, kind, type, relationName, dbName });
14
+ }
15
+ }
16
+ return { models: prunedModels, enums: {}, types: {} };
17
+ }
18
+ function buildMapForRuntime(list) {
19
+ const result = {};
20
+ for (const { name, ...rest } of list) {
21
+ result[name] = rest;
22
+ }
23
+ return result;
24
+ }
25
+ export {
26
+ dmmfToRuntimeDataModel,
27
+ pruneRuntimeDataModel
28
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Returns unique elements of array
3
+ * @param arr Array
4
+ */
5
+ export declare function uniqueBy<T>(arr: readonly T[], callee: (element: T) => string): T[];