@pkgverse/prismock 2.0.0-beta.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 +21 -0
- package/README.md +277 -0
- package/dist/index.cjs +5337 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +5289 -0
- package/dist/lib/client.d.ts +19 -0
- package/dist/lib/delegate.d.ts +42 -0
- package/dist/lib/extensions/index.d.ts +8 -0
- package/dist/lib/extensions/model.d.ts +5 -0
- package/dist/lib/extensions/query.d.ts +4 -0
- package/dist/lib/extensions/result.d.ts +3 -0
- package/dist/lib/helpers.d.ts +11 -0
- package/dist/lib/operations/aggregate.d.ts +11 -0
- package/dist/lib/operations/create.d.ts +34 -0
- package/dist/lib/operations/delete.d.ts +13 -0
- package/dist/lib/operations/find/find.d.ts +155 -0
- package/dist/lib/operations/find/index.d.ts +1 -0
- package/dist/lib/operations/find/match.d.ts +4 -0
- package/dist/lib/operations/groupBy/groupBy.d.ts +10 -0
- package/dist/lib/operations/groupBy/index.d.ts +1 -0
- package/dist/lib/operations/index.d.ts +6 -0
- package/dist/lib/operations/update.d.ts +14 -0
- package/dist/lib/prismock.d.ts +290 -0
- package/dist/lib/types/Aggregate.d.ts +9 -0
- package/dist/lib/types/Create.d.ts +16 -0
- package/dist/lib/types/Find.d.ts +35 -0
- package/dist/lib/types/GroupBy.d.ts +42 -0
- package/dist/lib/types/Upsert.d.ts +9 -0
- package/dist/lib/types/index.d.ts +5 -0
- package/package.json +112 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FindWhereFieldArg } from './Find';
|
|
2
|
+
export type AggregateArgs = {
|
|
3
|
+
_avg?: Record<string, boolean>;
|
|
4
|
+
_count?: true | Record<string, boolean>;
|
|
5
|
+
_max?: Record<string, boolean>;
|
|
6
|
+
_min?: Record<string, boolean>;
|
|
7
|
+
_sum?: Record<string, boolean>;
|
|
8
|
+
cursor?: Record<string, FindWhereFieldArg>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Item } from '../delegate';
|
|
2
|
+
import { FindWhereArgs, SelectArgs } from './Find';
|
|
3
|
+
export type CreateArgs = {
|
|
4
|
+
data: Item;
|
|
5
|
+
include?: Record<string, boolean> | null;
|
|
6
|
+
select?: SelectArgs | null;
|
|
7
|
+
};
|
|
8
|
+
export type CreateManyArgs = {
|
|
9
|
+
data: Item[];
|
|
10
|
+
include?: Record<string, boolean> | null;
|
|
11
|
+
select?: SelectArgs | null;
|
|
12
|
+
};
|
|
13
|
+
export type ConnectOrCreate = {
|
|
14
|
+
create: Item;
|
|
15
|
+
where: FindWhereArgs;
|
|
16
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Prisma } from '@prisma/client';
|
|
2
|
+
export type SelectArgs = Record<string, boolean | Record<string, boolean>>;
|
|
3
|
+
export type FindWhereFieldRelationArg = {
|
|
4
|
+
equals?: FindWhereFieldArg;
|
|
5
|
+
in?: Prisma.Enumerable<FindWhereFieldArg>;
|
|
6
|
+
notIn?: Prisma.Enumerable<FindWhereFieldArg>;
|
|
7
|
+
not?: FindWhereFieldRelationArg | FindWhereFieldArg;
|
|
8
|
+
};
|
|
9
|
+
export type FindWhereFieldArg = Buffer | null | Date | boolean | string | number | bigint | FindWhereFieldRelationArg | FindArgs;
|
|
10
|
+
export type FindWhereArgs = {
|
|
11
|
+
AND?: Prisma.Enumerable<FindWhereArgs>;
|
|
12
|
+
OR?: Prisma.Enumerable<FindWhereArgs>;
|
|
13
|
+
NOT?: Prisma.Enumerable<FindWhereArgs>;
|
|
14
|
+
} & Record<string, FindWhereFieldArg>;
|
|
15
|
+
export type FindArgs = {
|
|
16
|
+
select?: SelectArgs | null;
|
|
17
|
+
include?: Record<string, boolean> | null;
|
|
18
|
+
where?: FindWhereArgs;
|
|
19
|
+
orderBy?: Prisma.Enumerable<Record<string, Prisma.SortOrder>>;
|
|
20
|
+
cursor?: Record<string, unknown>;
|
|
21
|
+
take?: number;
|
|
22
|
+
skip?: number;
|
|
23
|
+
distinct?: Prisma.Enumerable<string[]>;
|
|
24
|
+
};
|
|
25
|
+
export type Order = 'asc' | 'desc';
|
|
26
|
+
export type OrderWithNulls = {
|
|
27
|
+
sort: 'asc' | 'desc';
|
|
28
|
+
nulls: 'first' | 'last';
|
|
29
|
+
};
|
|
30
|
+
export type OrderByRelation = {
|
|
31
|
+
[x: string]: {
|
|
32
|
+
_count: 'asc' | 'desc';
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type OrderedValue = Order | OrderWithNulls | OrderByRelation;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Prisma } from '@prisma/client';
|
|
2
|
+
import { FindWhereArgs } from './Find';
|
|
3
|
+
export type GroupByArgs = {
|
|
4
|
+
by: string | string[];
|
|
5
|
+
where?: FindWhereArgs;
|
|
6
|
+
orderBy?: Prisma.Enumerable<GroupByOrderBy>;
|
|
7
|
+
having?: GroupByHavingInput;
|
|
8
|
+
cursor?: Record<string, unknown>;
|
|
9
|
+
take?: number;
|
|
10
|
+
skip?: number;
|
|
11
|
+
_count?: Record<string, boolean>;
|
|
12
|
+
_avg?: Record<string, boolean>;
|
|
13
|
+
_max?: Record<string, boolean>;
|
|
14
|
+
_min?: Record<string, boolean>;
|
|
15
|
+
_sum?: Record<string, boolean>;
|
|
16
|
+
};
|
|
17
|
+
export type GroupByOrderBy = Record<string, Prisma.SortOrder> & {
|
|
18
|
+
_count?: Record<string, Prisma.SortOrder>;
|
|
19
|
+
_avg?: Record<string, Prisma.SortOrder>;
|
|
20
|
+
_max?: Record<string, Prisma.SortOrder>;
|
|
21
|
+
_min?: Record<string, Prisma.SortOrder>;
|
|
22
|
+
_sum?: Record<string, Prisma.SortOrder>;
|
|
23
|
+
};
|
|
24
|
+
export type GroupByHavingInput = {
|
|
25
|
+
AND?: Prisma.Enumerable<GroupByHavingInput>;
|
|
26
|
+
OR?: Prisma.Enumerable<GroupByHavingInput>;
|
|
27
|
+
NOT?: Prisma.Enumerable<GroupByHavingInput>;
|
|
28
|
+
} & Record<string, any>;
|
|
29
|
+
export type GroupByFieldRelationArgWithAggrates = GroupByFieldRelationArg & {
|
|
30
|
+
_count?: GroupByFieldRelationArg;
|
|
31
|
+
_avg?: GroupByFieldRelationArg;
|
|
32
|
+
_sum?: GroupByFieldRelationArg;
|
|
33
|
+
_min?: GroupByFieldRelationArg;
|
|
34
|
+
_max?: GroupByFieldRelationArg;
|
|
35
|
+
};
|
|
36
|
+
export type GroupByFieldRelationArg = {
|
|
37
|
+
equals?: GroupByFieldArg;
|
|
38
|
+
in?: Prisma.Enumerable<GroupByFieldArg>;
|
|
39
|
+
notIn?: Prisma.Enumerable<GroupByFieldArg>;
|
|
40
|
+
not?: GroupByFieldRelationArg | GroupByFieldArg;
|
|
41
|
+
};
|
|
42
|
+
export type GroupByFieldArg = Buffer | null | Date | boolean | string | number | bigint | GroupByFieldRelationArg;
|
package/package.json
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pkgverse/prismock",
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
|
+
"description": "A mock for PrismaClient, dedicated to unit testing.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"url": "https://github.com/JQuezada0/prismock"
|
|
7
|
+
},
|
|
8
|
+
"author": "Johnil Quezada <johnilquezada@gmail.com>",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"packageManager": "bun@1.2.16",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "dist/index.cjs",
|
|
13
|
+
"typings": "dist/index.d.ts",
|
|
14
|
+
"module": "dist/index.mjs",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./": {
|
|
17
|
+
"import": "./dist/index.mjs",
|
|
18
|
+
"require": "./dist/index.cjs",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"test",
|
|
25
|
+
"prisma",
|
|
26
|
+
"in-memory",
|
|
27
|
+
"mock"
|
|
28
|
+
],
|
|
29
|
+
"prisma": {
|
|
30
|
+
"seed": "tsx prisma/seed.ts"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "bun build:main & bun build:module & bun build:types",
|
|
34
|
+
"build:main": "bun build src/index.ts --outfile=dist/index.cjs --format=cjs --target=node --external=@prisma/*",
|
|
35
|
+
"build:module": "bun build src/index.ts --outfile=dist/index.mjs --format=esm --target=node --external=@prisma/*",
|
|
36
|
+
"build:types": "tsgo -p tsconfig.json",
|
|
37
|
+
"lint": "eslint",
|
|
38
|
+
"test": "jest",
|
|
39
|
+
"db:init": "prisma migrate dev --name init",
|
|
40
|
+
"db:reset": "bun prisma migrate reset -f",
|
|
41
|
+
"test:coverage": "jest --coverage"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@commitlint/cli": "19.8.1",
|
|
45
|
+
"@commitlint/config-conventional": "19.8.1",
|
|
46
|
+
"@prisma/client": "5.22.0",
|
|
47
|
+
"@semantic-release/changelog": "6.0.3",
|
|
48
|
+
"@semantic-release/commit-analyzer": "13.0.1",
|
|
49
|
+
"@semantic-release/git": "10.0.1",
|
|
50
|
+
"@semantic-release/github": "11.0.5",
|
|
51
|
+
"@semantic-release/npm": "12.0.2",
|
|
52
|
+
"@semantic-release/release-notes-generator": "14.1.0",
|
|
53
|
+
"@types/jest": "30.0.0",
|
|
54
|
+
"@types/node": "22.18.1",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "8.43.0",
|
|
56
|
+
"@typescript-eslint/parser": "8.43.0",
|
|
57
|
+
"@typescript/native-preview": "7.0.0-dev.20250910.1",
|
|
58
|
+
"cspell": "9.2.1",
|
|
59
|
+
"cz-conventional-changelog": "3.3.0",
|
|
60
|
+
"dotenv": "17.2.2",
|
|
61
|
+
"eslint": "9.37.0",
|
|
62
|
+
"eslint-config-prettier": "10.1.8",
|
|
63
|
+
"eslint-config-standard": "17.1.0",
|
|
64
|
+
"eslint-plugin-import": "2.32.0",
|
|
65
|
+
"eslint-plugin-jest": "29.1.0",
|
|
66
|
+
"eslint-plugin-n": "17.21.3",
|
|
67
|
+
"eslint-plugin-prettier": "5.5.4",
|
|
68
|
+
"eslint-plugin-promise": "7.2.1",
|
|
69
|
+
"eslint-plugin-react": "7.37.5",
|
|
70
|
+
"eslint-plugin-testing-library": "7.6.8",
|
|
71
|
+
"fp-ts": "2.16.11",
|
|
72
|
+
"fs-jetpack": "5.1.0",
|
|
73
|
+
"husky": "9.1.7",
|
|
74
|
+
"jest": "30.1.3",
|
|
75
|
+
"jest-mock-extended": "4.0.0",
|
|
76
|
+
"lint-staged": "16.1.6",
|
|
77
|
+
"prettier": "2.8.8",
|
|
78
|
+
"prisma": "5.22.0",
|
|
79
|
+
"semantic-release": "24.2.7",
|
|
80
|
+
"ts-jest": "29.4.1",
|
|
81
|
+
"ts-node": "10.9.2",
|
|
82
|
+
"ts-toolbelt": "9.6.0",
|
|
83
|
+
"tsx": "4.20.6",
|
|
84
|
+
"typescript-eslint": "8.46.0"
|
|
85
|
+
},
|
|
86
|
+
"files": [
|
|
87
|
+
"dist/**/*.{cjs,mjs,d.ts}",
|
|
88
|
+
"!**/*.spec.*",
|
|
89
|
+
"!**/*.json",
|
|
90
|
+
"CHANGELOG.md",
|
|
91
|
+
"LICENSE",
|
|
92
|
+
"README.md"
|
|
93
|
+
],
|
|
94
|
+
"publishConfig": {
|
|
95
|
+
"access": "public"
|
|
96
|
+
},
|
|
97
|
+
"lint-staged": {
|
|
98
|
+
"*.{ts,tsx}": [
|
|
99
|
+
"eslint --fix"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"dependencies": {
|
|
103
|
+
"@paralleldrive/cuid2": "2.2.2",
|
|
104
|
+
"@prisma/generator-helper": "5.22.0",
|
|
105
|
+
"@prisma/internals": "5.22.0",
|
|
106
|
+
"bson": "6.10.4"
|
|
107
|
+
},
|
|
108
|
+
"peerDependencies": {
|
|
109
|
+
"@prisma/client": "*",
|
|
110
|
+
"prisma": "*"
|
|
111
|
+
}
|
|
112
|
+
}
|