@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.
- package/LICENSE +201 -0
- package/README.md +5 -0
- package/dist/Cache.d.ts +6 -0
- package/dist/Cache.js +45 -0
- package/dist/Cache.mjs +21 -0
- package/dist/Cache.test.d.ts +1 -0
- package/dist/Cache.test.js +34 -0
- package/dist/Cache.test.mjs +33 -0
- package/dist/Dictionary.d.ts +6 -0
- package/dist/Dictionary.js +35 -0
- package/dist/Dictionary.mjs +11 -0
- package/dist/QueryCompiler.d.ts +29 -0
- package/dist/QueryCompiler.js +16 -0
- package/dist/QueryCompiler.mjs +0 -0
- package/dist/QueryEngine.d.ts +50 -0
- package/dist/QueryEngine.js +16 -0
- package/dist/QueryEngine.mjs +0 -0
- package/dist/casing.d.ts +6 -0
- package/dist/casing.js +36 -0
- package/dist/casing.mjs +11 -0
- package/dist/casing.test.d.ts +1 -0
- package/dist/casing.test.js +34 -0
- package/dist/casing.test.mjs +33 -0
- package/dist/client-config.d.ts +83 -0
- package/dist/client-config.js +16 -0
- package/dist/client-config.mjs +0 -0
- package/dist/dmmf.d.ts +4 -0
- package/dist/dmmf.js +16 -0
- package/dist/dmmf.mjs +0 -0
- package/dist/enums.d.ts +8 -0
- package/dist/enums.js +31 -0
- package/dist/enums.mjs +6 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +46 -0
- package/dist/index.mjs +13 -0
- package/dist/lazyProperty.d.ts +4 -0
- package/dist/lazyProperty.js +39 -0
- package/dist/lazyProperty.mjs +15 -0
- package/dist/lazyProperty.test.d.ts +1 -0
- package/dist/lazyProperty.test.js +28 -0
- package/dist/lazyProperty.test.mjs +27 -0
- package/dist/omit.d.ts +1 -0
- package/dist/omit.js +30 -0
- package/dist/omit.mjs +6 -0
- package/dist/omit.test.d.ts +1 -0
- package/dist/omit.test.js +46 -0
- package/dist/omit.test.mjs +45 -0
- package/dist/operations.d.ts +3 -0
- package/dist/operations.js +16 -0
- package/dist/operations.mjs +0 -0
- package/dist/runtimeDataModel.d.ts +28 -0
- package/dist/runtimeDataModel.js +53 -0
- package/dist/runtimeDataModel.mjs +28 -0
- package/dist/uniqueBy.d.ts +5 -0
- package/dist/uniqueBy.js +37 -0
- package/dist/uniqueBy.mjs +13 -0
- package/dist/uniqueBy.test.d.ts +1 -0
- package/dist/uniqueBy.test.js +61 -0
- package/dist/uniqueBy.test.mjs +60 -0
- package/package.json +44 -0
package/dist/uniqueBy.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
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 uniqueBy_exports = {};
|
|
20
|
+
__export(uniqueBy_exports, {
|
|
21
|
+
uniqueBy: () => uniqueBy
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(uniqueBy_exports);
|
|
24
|
+
function uniqueBy(arr, callee) {
|
|
25
|
+
const result = {};
|
|
26
|
+
for (const value of arr) {
|
|
27
|
+
const hash = callee(value);
|
|
28
|
+
if (!result[hash]) {
|
|
29
|
+
result[hash] = value;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return Object.values(result);
|
|
33
|
+
}
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
uniqueBy
|
|
37
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_vitest = require("vitest");
|
|
3
|
+
var import_uniqueBy = require("./uniqueBy");
|
|
4
|
+
(0, import_vitest.describe)("uniqueBy", () => {
|
|
5
|
+
(0, import_vitest.it)("should return an empty array when given an empty array", () => {
|
|
6
|
+
(0, import_vitest.expect)((0, import_uniqueBy.uniqueBy)([], (item) => item)).toEqual([]);
|
|
7
|
+
});
|
|
8
|
+
(0, import_vitest.it)("should return unique elements based on the hash function", () => {
|
|
9
|
+
const input = [1, 2, 3, 2, 1];
|
|
10
|
+
const result = (0, import_uniqueBy.uniqueBy)(input, (item) => item.toString());
|
|
11
|
+
(0, import_vitest.expect)(result).toEqual([1, 2, 3]);
|
|
12
|
+
});
|
|
13
|
+
(0, import_vitest.it)("should work with objects using custom hash functions", () => {
|
|
14
|
+
const input = [
|
|
15
|
+
{ id: 1, name: "Alice" },
|
|
16
|
+
{ id: 2, name: "Bob" },
|
|
17
|
+
{ id: 1, name: "Charlie" },
|
|
18
|
+
// Duplicate id
|
|
19
|
+
{ id: 3, name: "Dave" }
|
|
20
|
+
];
|
|
21
|
+
const result = (0, import_uniqueBy.uniqueBy)(input, (item) => item.id.toString());
|
|
22
|
+
(0, import_vitest.expect)(result).toEqual([
|
|
23
|
+
{ id: 1, name: "Alice" },
|
|
24
|
+
{ id: 2, name: "Bob" },
|
|
25
|
+
{ id: 3, name: "Dave" }
|
|
26
|
+
]);
|
|
27
|
+
});
|
|
28
|
+
(0, import_vitest.it)("should handle string inputs", () => {
|
|
29
|
+
const input = ["a", "b", "a", "c", "b"];
|
|
30
|
+
const result = (0, import_uniqueBy.uniqueBy)(input, (item) => item);
|
|
31
|
+
(0, import_vitest.expect)(result).toEqual(["a", "b", "c"]);
|
|
32
|
+
});
|
|
33
|
+
(0, import_vitest.it)("should work with more complex hash functions", () => {
|
|
34
|
+
const input = [
|
|
35
|
+
{ firstName: "John", lastName: "Doe" },
|
|
36
|
+
{ firstName: "Jane", lastName: "Doe" },
|
|
37
|
+
{ firstName: "John", lastName: "Smith" },
|
|
38
|
+
{ firstName: "John", lastName: "Doe" }
|
|
39
|
+
// Duplicate
|
|
40
|
+
];
|
|
41
|
+
const result = (0, import_uniqueBy.uniqueBy)(input, (item) => `${item.firstName}-${item.lastName}`);
|
|
42
|
+
(0, import_vitest.expect)(result).toEqual([
|
|
43
|
+
{ firstName: "John", lastName: "Doe" },
|
|
44
|
+
{ firstName: "Jane", lastName: "Doe" },
|
|
45
|
+
{ firstName: "John", lastName: "Smith" }
|
|
46
|
+
]);
|
|
47
|
+
});
|
|
48
|
+
(0, import_vitest.it)("should preserve the first occurrence when duplicates exist", () => {
|
|
49
|
+
const input = [
|
|
50
|
+
{ id: 1, value: "first" },
|
|
51
|
+
{ id: 2, value: "second" },
|
|
52
|
+
{ id: 1, value: "duplicate" }
|
|
53
|
+
];
|
|
54
|
+
const result = (0, import_uniqueBy.uniqueBy)(input, (item) => item.id.toString());
|
|
55
|
+
(0, import_vitest.expect)(result).toEqual([
|
|
56
|
+
{ id: 1, value: "first" },
|
|
57
|
+
{ id: 2, value: "second" }
|
|
58
|
+
]);
|
|
59
|
+
(0, import_vitest.expect)(result[0].value).toBe("first");
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { uniqueBy } from "./uniqueBy";
|
|
3
|
+
describe("uniqueBy", () => {
|
|
4
|
+
it("should return an empty array when given an empty array", () => {
|
|
5
|
+
expect(uniqueBy([], (item) => item)).toEqual([]);
|
|
6
|
+
});
|
|
7
|
+
it("should return unique elements based on the hash function", () => {
|
|
8
|
+
const input = [1, 2, 3, 2, 1];
|
|
9
|
+
const result = uniqueBy(input, (item) => item.toString());
|
|
10
|
+
expect(result).toEqual([1, 2, 3]);
|
|
11
|
+
});
|
|
12
|
+
it("should work with objects using custom hash functions", () => {
|
|
13
|
+
const input = [
|
|
14
|
+
{ id: 1, name: "Alice" },
|
|
15
|
+
{ id: 2, name: "Bob" },
|
|
16
|
+
{ id: 1, name: "Charlie" },
|
|
17
|
+
// Duplicate id
|
|
18
|
+
{ id: 3, name: "Dave" }
|
|
19
|
+
];
|
|
20
|
+
const result = uniqueBy(input, (item) => item.id.toString());
|
|
21
|
+
expect(result).toEqual([
|
|
22
|
+
{ id: 1, name: "Alice" },
|
|
23
|
+
{ id: 2, name: "Bob" },
|
|
24
|
+
{ id: 3, name: "Dave" }
|
|
25
|
+
]);
|
|
26
|
+
});
|
|
27
|
+
it("should handle string inputs", () => {
|
|
28
|
+
const input = ["a", "b", "a", "c", "b"];
|
|
29
|
+
const result = uniqueBy(input, (item) => item);
|
|
30
|
+
expect(result).toEqual(["a", "b", "c"]);
|
|
31
|
+
});
|
|
32
|
+
it("should work with more complex hash functions", () => {
|
|
33
|
+
const input = [
|
|
34
|
+
{ firstName: "John", lastName: "Doe" },
|
|
35
|
+
{ firstName: "Jane", lastName: "Doe" },
|
|
36
|
+
{ firstName: "John", lastName: "Smith" },
|
|
37
|
+
{ firstName: "John", lastName: "Doe" }
|
|
38
|
+
// Duplicate
|
|
39
|
+
];
|
|
40
|
+
const result = uniqueBy(input, (item) => `${item.firstName}-${item.lastName}`);
|
|
41
|
+
expect(result).toEqual([
|
|
42
|
+
{ firstName: "John", lastName: "Doe" },
|
|
43
|
+
{ firstName: "Jane", lastName: "Doe" },
|
|
44
|
+
{ firstName: "John", lastName: "Smith" }
|
|
45
|
+
]);
|
|
46
|
+
});
|
|
47
|
+
it("should preserve the first occurrence when duplicates exist", () => {
|
|
48
|
+
const input = [
|
|
49
|
+
{ id: 1, value: "first" },
|
|
50
|
+
{ id: 2, value: "second" },
|
|
51
|
+
{ id: 1, value: "duplicate" }
|
|
52
|
+
];
|
|
53
|
+
const result = uniqueBy(input, (item) => item.id.toString());
|
|
54
|
+
expect(result).toEqual([
|
|
55
|
+
{ id: 1, value: "first" },
|
|
56
|
+
{ id: 2, value: "second" }
|
|
57
|
+
]);
|
|
58
|
+
expect(result[0].value).toBe("first");
|
|
59
|
+
});
|
|
60
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prisma/client-common",
|
|
3
|
+
"version": "6.6.0-integration-push-xmzqvqxpztks.1",
|
|
4
|
+
"description": "This package is intended for Prisma's internal use",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"require": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"import": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.mjs"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/prisma/prisma.git",
|
|
23
|
+
"directory": "packages/client-common"
|
|
24
|
+
},
|
|
25
|
+
"license": "Apache-2.0",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@prisma/dmmf": "6.6.0-integration-push-xmzqvqxpztks.1",
|
|
28
|
+
"@prisma/driver-adapter-utils": "6.6.0-integration-push-xmzqvqxpztks.1",
|
|
29
|
+
"@prisma/internals": "6.6.0-integration-push-xmzqvqxpztks.1",
|
|
30
|
+
"@prisma/generator": "6.6.0-integration-push-xmzqvqxpztks.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"vitest": "3.0.9"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist"
|
|
37
|
+
],
|
|
38
|
+
"sideEffects": false,
|
|
39
|
+
"scripts": {
|
|
40
|
+
"dev": "DEV=true tsx helpers/build.ts",
|
|
41
|
+
"build": "tsx helpers/build.ts",
|
|
42
|
+
"test": "vitest run"
|
|
43
|
+
}
|
|
44
|
+
}
|