vsrepo 1.3.3 → 1.3.5
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/README.md +142 -3
- package/README.pt-BR.md +1590 -0
- package/dist/DynamicRepository.d.ts +96 -22
- package/dist/DynamicRepository.js +3 -31
- package/dist/VSRepository.d.ts +182 -84
- package/dist/VSRepository.js +22 -0
- package/dist/internal/decorators/dynamic-method.decorator.js +1 -1
- package/dist/internal/decorators/query-method.decorator.js +20 -0
- package/dist/internal/entities/dynamic-method-metadata.entity.js +3 -1
- package/dist/internal/resolvers/dbAndPrismaArgs.resolve.js +3 -0
- package/dist/internal/utils/schemas.util.js +6 -1
- package/dist/internal/validation/method-options.validate.js +10 -3
- package/dist/internal/validation/query-method-arg.validate.js +22 -0
- package/dist/internal/validation/query-method-options.validate.js +24 -0
- package/dist/internal/validation/types/query-method-arg.type.js +2 -0
- package/dist/internal/validation/types/query-method-options.type.js +2 -0
- package/package.json +11 -2
- package/scripts/configure-prisma-import.mjs +26 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vsrepo",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "A repository pattern library for Prisma",
|
|
5
5
|
"homepage": "https://github.com/jaobrabo123/VSRepository#readme",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,11 @@
|
|
|
45
45
|
"scripts": {
|
|
46
46
|
"vsrepo": "node ./scripts/configure-prisma-import.mjs",
|
|
47
47
|
"build": "tsc -p tsconfig.build.json && node ./scripts/copy-types.mjs",
|
|
48
|
-
"prepack": "pnpm build"
|
|
48
|
+
"prepack": "pnpm build",
|
|
49
|
+
"test": "npm run test:typing && npm run test:implementation",
|
|
50
|
+
"test:implementation": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
|
51
|
+
"test:implementation:watch": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --watch",
|
|
52
|
+
"test:typing": "tsc --noEmit -p test/typing/tsconfig.json"
|
|
49
53
|
},
|
|
50
54
|
"keywords": [
|
|
51
55
|
"prisma",
|
|
@@ -62,11 +66,16 @@
|
|
|
62
66
|
"@prisma/client": "^7.8.0"
|
|
63
67
|
},
|
|
64
68
|
"devDependencies": {
|
|
69
|
+
"@jest/globals": "^30.4.1",
|
|
65
70
|
"@prisma/adapter-pg": "^7.8.0",
|
|
66
71
|
"@prisma/client": "^7.8.0",
|
|
72
|
+
"@types/jest": "^30.0.0",
|
|
67
73
|
"@types/node": "^25.6.0",
|
|
74
|
+
"cross-env": "^10.1.0",
|
|
68
75
|
"dotenv": "^17.4.2",
|
|
76
|
+
"jest": "^30.4.2",
|
|
69
77
|
"prisma": "^7.8.0",
|
|
78
|
+
"ts-jest": "^29.4.12",
|
|
70
79
|
"tsx": "^4.22.3",
|
|
71
80
|
"typescript": "^6.0.3"
|
|
72
81
|
},
|
|
@@ -137,7 +137,8 @@ const tsFiles = [
|
|
|
137
137
|
VSRepoConfigError as VSRepoConfigErrorRuntime,
|
|
138
138
|
VSRepoBuildError as VSRepoBuildErrorRuntime,
|
|
139
139
|
VSRepoExtendError as VSRepoExtendErrorRuntime,
|
|
140
|
-
VSRepoRuntimeError as VSRepoRuntimeErrorRuntime
|
|
140
|
+
VSRepoRuntimeError as VSRepoRuntimeErrorRuntime,
|
|
141
|
+
VSRepoDecoratorError as VSRepoDecoratorErrorRuntime,
|
|
141
142
|
} from 'vsrepo/VSRepoError';
|
|
142
143
|
|
|
143
144
|
import type {
|
|
@@ -145,14 +146,16 @@ import type {
|
|
|
145
146
|
VSRepoConfigError as VSRepoConfigErrorType,
|
|
146
147
|
VSRepoBuildError as VSRepoBuildErrorType,
|
|
147
148
|
VSRepoExtendError as VSRepoExtendErrorType,
|
|
148
|
-
VSRepoRuntimeError as VSRepoRuntimeErrorType
|
|
149
|
+
VSRepoRuntimeError as VSRepoRuntimeErrorType,
|
|
150
|
+
VSRepoDecoratorError as VSRepoDecoratorErrorType,
|
|
149
151
|
} from './VSRepoError.types';
|
|
150
152
|
|
|
151
|
-
export const VSRepoError
|
|
152
|
-
export const VSRepoConfigError
|
|
153
|
-
export const VSRepoBuildError
|
|
154
|
-
export const VSRepoExtendError
|
|
155
|
-
export const VSRepoRuntimeError
|
|
153
|
+
export const VSRepoError = VSRepoErrorRuntime as typeof VSRepoErrorType;
|
|
154
|
+
export const VSRepoConfigError = VSRepoConfigErrorRuntime as typeof VSRepoConfigErrorType;
|
|
155
|
+
export const VSRepoBuildError = VSRepoBuildErrorRuntime as typeof VSRepoBuildErrorType;
|
|
156
|
+
export const VSRepoExtendError = VSRepoExtendErrorRuntime as typeof VSRepoExtendErrorType;
|
|
157
|
+
export const VSRepoRuntimeError = VSRepoRuntimeErrorRuntime as typeof VSRepoRuntimeErrorType;
|
|
158
|
+
export const VSRepoDecoratorError = VSRepoDecoratorErrorRuntime as typeof VSRepoDecoratorErrorType;
|
|
156
159
|
|
|
157
160
|
export type * from './VSRepoError.types';
|
|
158
161
|
`,
|
|
@@ -179,16 +182,19 @@ export type * from './VSRepository.types';
|
|
|
179
182
|
fileName: 'DynamicRepository.ts',
|
|
180
183
|
content: `import {
|
|
181
184
|
DynamicRepository as DynamicRepositoryRuntime,
|
|
182
|
-
DynamicMethod as DynamicMethodRuntime
|
|
185
|
+
DynamicMethod as DynamicMethodRuntime,
|
|
186
|
+
QueryMethod as QueryMethodRuntime,
|
|
183
187
|
} from 'vsrepo/DynamicRepository';
|
|
184
188
|
|
|
185
189
|
import type {
|
|
186
190
|
DynamicRepository as DynamicRepositoryType,
|
|
187
|
-
DynamicMethod as DynamicMethodType
|
|
191
|
+
DynamicMethod as DynamicMethodType,
|
|
192
|
+
QueryMethod as QueryMethodType,
|
|
188
193
|
} from './DynamicRepository.types';
|
|
189
194
|
|
|
190
195
|
export const DynamicRepository = DynamicRepositoryRuntime as typeof DynamicRepositoryType;
|
|
191
196
|
export const DynamicMethod = DynamicMethodRuntime as typeof DynamicMethodType;
|
|
197
|
+
export const QueryMethod = QueryMethodRuntime as typeof QueryMethodType;
|
|
192
198
|
|
|
193
199
|
export type * from './DynamicRepository.types';
|
|
194
200
|
`,
|
|
@@ -210,7 +216,8 @@ export {
|
|
|
210
216
|
|
|
211
217
|
export {
|
|
212
218
|
DynamicRepository,
|
|
213
|
-
DynamicMethod
|
|
219
|
+
DynamicMethod,
|
|
220
|
+
QueryMethod,
|
|
214
221
|
} from './DynamicRepository.js';
|
|
215
222
|
|
|
216
223
|
export type * from './VSRepoError.types';
|
|
@@ -229,15 +236,15 @@ for (const file of tsFiles) {
|
|
|
229
236
|
}
|
|
230
237
|
|
|
231
238
|
// Copia o README.md do pacote VSRepository para o diretório de output, se existir
|
|
232
|
-
const readmeSource = path.join(packageRoot, 'README.md');
|
|
233
|
-
const readmeTarget = path.join(outputDir, 'README.md');
|
|
234
|
-
|
|
235
|
-
if (fs.existsSync(readmeSource)) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
} else {
|
|
239
|
-
|
|
240
|
-
}
|
|
239
|
+
// const readmeSource = path.join(packageRoot, 'README.md');
|
|
240
|
+
// const readmeTarget = path.join(outputDir, 'README.md');
|
|
241
|
+
|
|
242
|
+
// if (fs.existsSync(readmeSource)) {
|
|
243
|
+
// fs.copyFileSync(readmeSource, readmeTarget);
|
|
244
|
+
// console.log(`Gerado: ${path.relative(workspaceRoot, readmeTarget)}`);
|
|
245
|
+
// } else {
|
|
246
|
+
// console.warn(`README.md do VSRepository nao encontrado em: ${path.relative(workspaceRoot, readmeSource)}. Ignorando a copia.`);
|
|
247
|
+
// }
|
|
241
248
|
|
|
242
249
|
console.log('\nVSRepository gerado com tipagem do Prisma.');
|
|
243
250
|
console.log(`Output: ${path.relative(workspaceRoot, outputDir)}`);
|