vsrepo 1.4.2 → 2.1.0
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 +827 -1322
- package/README.pt-BR.md +833 -1325
- package/dist/VSRepoAdapter.d.ts +109 -0
- package/dist/VSRepoAdapter.js +18 -0
- package/dist/VSRepository.d.ts +166 -1201
- package/dist/VSRepository.js +327 -237
- package/dist/decorators/dynamic-method.decorator.d.ts +25 -0
- package/dist/decorators/dynamic-method.decorator.js +38 -0
- package/dist/decorators/query-method.decorator.d.ts +27 -0
- package/dist/decorators/query-method.decorator.js +45 -0
- package/dist/errors/VSRepoAdapterError.d.ts +22 -0
- package/dist/errors/VSRepoAdapterError.js +31 -0
- package/dist/errors/VSRepoError.d.ts +15 -0
- package/dist/errors/VSRepoError.js +21 -0
- package/dist/index.d.ts +38 -1
- package/dist/index.js +28 -15
- package/dist/internal/constants/debug-arg-symbol.constant.d.ts +1 -0
- package/dist/internal/constants/debug-arg-symbol.constant.js +4 -0
- package/dist/internal/constants/dynamic-methods-key.constant.d.ts +1 -0
- package/dist/internal/constants/query-methods-key.constant.d.ts +1 -0
- package/dist/internal/constants/query-methods-key.constant.js +4 -0
- package/dist/internal/enums/adapter-error-code.enum.d.ts +125 -0
- package/dist/internal/enums/adapter-error-code.enum.js +129 -0
- package/dist/internal/enums/transaction-isolation-level.enum.d.ts +16 -0
- package/dist/internal/enums/transaction-isolation-level.enum.js +20 -0
- package/dist/internal/enums/vs-log-level.enum.d.ts +18 -0
- package/dist/internal/enums/vs-log-level.enum.js +22 -0
- package/dist/internal/enums/vsrepo-error-type.enum.d.ts +19 -0
- package/dist/internal/enums/vsrepo-error-type.enum.js +23 -0
- package/dist/internal/resolvers/dynamic-methods.resolver.d.ts +23 -0
- package/dist/internal/resolvers/dynamic-methods.resolver.js +910 -0
- package/dist/internal/resolvers/merge-wheres.resolver.d.ts +7 -0
- package/dist/internal/resolvers/merge-wheres.resolver.js +26 -0
- package/dist/internal/utils/uncapitalize.util.d.ts +1 -0
- package/dist/internal/utils/vs-logger.util.d.ts +25 -0
- package/dist/internal/utils/vs-logger.util.js +139 -0
- package/dist/internal/validators/decorators.validator.d.ts +8 -0
- package/dist/internal/validators/decorators.validator.js +75 -0
- package/dist/internal/validators/schemas/ordering.schema.d.ts +3 -0
- package/dist/internal/validators/schemas/ordering.schema.js +38 -0
- package/dist/internal/validators/schemas/pagination.schema.d.ts +6 -0
- package/dist/internal/validators/schemas/pagination.schema.js +40 -0
- package/dist/internal/validators/schemas/where.schema.d.ts +7 -0
- package/dist/internal/validators/schemas/where.schema.js +42 -0
- package/dist/internal/validators/vsrepo.validator.d.ts +40 -0
- package/dist/internal/validators/vsrepo.validator.js +182 -0
- package/dist/types/adapter/adapter-method-options.type.d.ts +24 -0
- package/dist/types/adapter/adapter-query-options.type.d.ts +5 -0
- package/dist/types/decorators/dynamic-method-options.type.d.ts +14 -0
- package/dist/types/decorators/query-method-options.type.d.ts +15 -0
- package/dist/types/dynamic-methods/dynamic-method-customization.type.d.ts +7 -0
- package/dist/types/dynamic-methods/dynamic-method-info.type.d.ts +18 -0
- package/dist/types/dynamic-methods/dynamic-method-where-ops.type.d.ts +6 -0
- package/dist/types/utils/count-result.type.d.ts +9 -0
- package/dist/types/utils/decimal-like.type.d.ts +23 -0
- package/dist/types/utils/deep-partial.type.d.ts +14 -0
- package/dist/types/utils/keys-of-type.type.d.ts +20 -0
- package/dist/types/utils/methods-options.type.d.ts +23 -0
- package/dist/types/utils/numeric-keys.type.d.ts +24 -0
- package/dist/types/utils/numeric-like.type.d.ts +10 -0
- package/dist/types/utils/ordering.type.d.ts +39 -0
- package/dist/types/utils/pagination.type.d.ts +11 -0
- package/dist/types/utils/perform-data.type.d.ts +4 -0
- package/dist/types/utils/primitive.type.d.ts +7 -0
- package/dist/types/utils/query-method-arg.type.d.ts +27 -0
- package/dist/types/utils/restrict-method-options.type.d.ts +14 -0
- package/dist/types/utils/see-mode.type.d.ts +12 -0
- package/dist/types/vsrepo/vsrepo-args.type.d.ts +9 -0
- package/dist/types/vsrepo/vsrepo-method.type.d.ts +4 -0
- package/dist/types/vsrepo/vsrepo-method.type.js +2 -0
- package/dist/types/vsrepo/vsrepo-options.type.d.ts +34 -0
- package/dist/types/vsrepo/vsrepo-options.type.js +2 -0
- package/dist/types/vsrepo/vsrepo-orm-types.type.d.ts +17 -0
- package/dist/types/vsrepo/vsrepo-orm-types.type.js +2 -0
- package/dist/types/vsrepo/vsrepo-pretty-where.type.d.ts +7 -0
- package/dist/types/vsrepo/vsrepo-pretty-where.type.js +2 -0
- package/dist/types/vsrepo/vsrepo-query-options.type.d.ts +17 -0
- package/dist/types/vsrepo/vsrepo-query-options.type.js +2 -0
- package/dist/types/vsrepo/vsrepo-query.type.d.ts +5 -0
- package/dist/types/vsrepo/vsrepo-query.type.js +2 -0
- package/dist/types/vsrepo/vsrepo-relations.type.d.ts +26 -0
- package/dist/types/vsrepo/vsrepo-relations.type.js +2 -0
- package/dist/types/vsrepo/vsrepo-resolve-args-data.type.d.ts +19 -0
- package/dist/types/vsrepo/vsrepo-resolve-args-data.type.js +2 -0
- package/dist/types/vsrepo/vsrepo-select.type.d.ts +15 -0
- package/dist/types/vsrepo/vsrepo-select.type.js +2 -0
- package/dist/types/vsrepo/vsrepo-transaction-options.type.d.ts +12 -0
- package/dist/types/vsrepo/vsrepo-transaction-options.type.js +2 -0
- package/dist/types/vsrepo/vsrepo-ugly-where.type.d.ts +9 -0
- package/dist/types/vsrepo/vsrepo-ugly-where.type.js +2 -0
- package/dist/types/vsrepo/vsrepo-where.type.d.ts +99 -0
- package/dist/types/vsrepo/vsrepo-where.type.js +2 -0
- package/package.json +16 -37
- package/README-DynamicRepo.md +0 -625
- package/README-DynamicRepo.pt-BR.md +0 -625
- package/dist/DynamicRepository.d.ts +0 -497
- package/dist/DynamicRepository.js +0 -26
- package/dist/VSRepoError.d.ts +0 -83
- package/dist/VSRepoError.js +0 -17
- package/dist/internal/decorators/dynamic-method.decorator.js +0 -14
- package/dist/internal/decorators/query-method.decorator.js +0 -20
- package/dist/internal/entities/dynamic-method-metadata.entity.js +0 -26
- package/dist/internal/errors/vs-repo.error.js +0 -31
- package/dist/internal/resolvers/base-methods.resolve.js +0 -541
- package/dist/internal/resolvers/create-update-payloads-with-relations.resolve.js +0 -143
- package/dist/internal/resolvers/data-payload-with-relations.resolve.js +0 -60
- package/dist/internal/resolvers/dbAndPrismaArgs.resolve.js +0 -63
- package/dist/internal/resolvers/dynamic-method-customization.resolve.js +0 -57
- package/dist/internal/resolvers/dynamic-method-info.resolve.js +0 -279
- package/dist/internal/resolvers/dynamic-methods-metadata.resolve.js +0 -15
- package/dist/internal/resolvers/merge-wheres.resolve.js +0 -22
- package/dist/internal/resolvers/pretty-wheres.resolve.js +0 -87
- package/dist/internal/resolvers/select.resolve.js +0 -7
- package/dist/internal/resolvers/specific-where.resolve.js +0 -84
- package/dist/internal/resolvers/ugly-where.resolve.js +0 -178
- package/dist/internal/utils/logger.util.js +0 -21
- package/dist/internal/utils/schemas.util.js +0 -31
- package/dist/internal/validation/build-config.validate.js +0 -84
- package/dist/internal/validation/constructor-config.validate.js +0 -64
- package/dist/internal/validation/dynamic-method-config.validate.js +0 -19
- package/dist/internal/validation/extension.validate.js +0 -15
- package/dist/internal/validation/is-object.validate.js +0 -6
- package/dist/internal/validation/method-options.validate.js +0 -42
- package/dist/internal/validation/obj-with-relations.validate.js +0 -37
- package/dist/internal/validation/prisma-client.validate.js +0 -10
- package/dist/internal/validation/query-method-arg.validate.js +0 -22
- package/dist/internal/validation/query-method-options.validate.js +0 -24
- package/scripts/configure-prisma-import.mjs +0 -283
- package/scripts/copy-types.mjs +0 -24
- /package/dist/{internal/decorators/types/dynamic-method-config.type.js → types/adapter/adapter-method-options.type.js} +0 -0
- /package/dist/{internal/errors/types/vs-repo-error-type.type.js → types/adapter/adapter-query-options.type.js} +0 -0
- /package/dist/{internal/errors/types/vs-repo-runtime-error-code.type.js → types/decorators/dynamic-method-options.type.js} +0 -0
- /package/dist/{internal/validation/types → types/decorators}/query-method-options.type.js +0 -0
- /package/dist/{internal/resolvers/types → types/dynamic-methods}/dynamic-method-customization.type.js +0 -0
- /package/dist/{internal/resolvers/types → types/dynamic-methods}/dynamic-method-info.type.js +0 -0
- /package/dist/{internal/resolvers/types → types/dynamic-methods}/dynamic-method-where-ops.type.js +0 -0
- /package/dist/{internal/resolvers/types/base-method-function.type.js → types/utils/count-result.type.js} +0 -0
- /package/dist/{internal/resolvers/types/pretty-where.type.js → types/utils/decimal-like.type.js} +0 -0
- /package/dist/{internal/resolvers/types/prisma-args.type.js → types/utils/deep-partial.type.js} +0 -0
- /package/dist/{internal/resolvers/types/repository-build-instance.type.js → types/utils/keys-of-type.type.js} +0 -0
- /package/dist/{internal/resolvers/types/resolve-db-and-prisma-args-data.type.js → types/utils/methods-options.type.js} +0 -0
- /package/dist/{internal/resolvers/types/ugly-where.type.js → types/utils/numeric-keys.type.js} +0 -0
- /package/dist/{internal/validation/types/base-methods.type.js → types/utils/numeric-like.type.js} +0 -0
- /package/dist/{internal/validation/types/build-config.type.js → types/utils/ordering.type.js} +0 -0
- /package/dist/{internal/validation/types → types/utils}/pagination.type.js +0 -0
- /package/dist/{internal/validation/types/constructor-config.type.js → types/utils/perform-data.type.js} +0 -0
- /package/dist/{internal/validation/types/method-options.type.js → types/utils/primitive.type.js} +0 -0
- /package/dist/{internal/validation/types → types/utils}/query-method-arg.type.js +0 -0
- /package/dist/{internal/validation/types/method.type.js → types/utils/restrict-method-options.type.js} +0 -0
- /package/dist/{internal/validation/types → types/utils}/see-mode.type.js +0 -0
- /package/dist/{internal/validation/types/relation.type.js → types/vsrepo/vsrepo-args.type.js} +0 -0
|
@@ -0,0 +1,910 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DynamicMethodsResolver = void 0;
|
|
7
|
+
const VSRepoError_1 = require("../../errors/VSRepoError");
|
|
8
|
+
const dynamic_methods_key_constant_1 = require("../constants/dynamic-methods-key.constant");
|
|
9
|
+
const query_methods_key_constant_1 = require("../constants/query-methods-key.constant");
|
|
10
|
+
const vs_log_level_enum_1 = require("../enums/vs-log-level.enum");
|
|
11
|
+
const uncapitalize_util_1 = require("../utils/uncapitalize.util");
|
|
12
|
+
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
13
|
+
const vsrepo_error_type_enum_1 = require("../enums/vsrepo-error-type.enum");
|
|
14
|
+
const debug_arg_symbol_constant_1 = require("../constants/debug-arg-symbol.constant");
|
|
15
|
+
class DynamicMethodsResolver {
|
|
16
|
+
logger;
|
|
17
|
+
adapter;
|
|
18
|
+
mergeWheresResolver;
|
|
19
|
+
validator;
|
|
20
|
+
defaultOrdering;
|
|
21
|
+
constructor(logger, adapter, mergeWheresResolver, validator, defaultOrdering) {
|
|
22
|
+
this.logger = logger;
|
|
23
|
+
this.adapter = adapter;
|
|
24
|
+
this.mergeWheresResolver = mergeWheresResolver;
|
|
25
|
+
this.validator = validator;
|
|
26
|
+
this.defaultOrdering = defaultOrdering;
|
|
27
|
+
}
|
|
28
|
+
validateIndexedArg(args, positionIndex, validate, parseDebugToString = true) {
|
|
29
|
+
const value = args.at(positionIndex);
|
|
30
|
+
if (value === debug_arg_symbol_constant_1.DEBUG_ARG_SYMBOL) {
|
|
31
|
+
return (parseDebugToString
|
|
32
|
+
? `<args>[${positionIndex < 0 ? args.length + positionIndex : positionIndex}]`
|
|
33
|
+
: value);
|
|
34
|
+
}
|
|
35
|
+
return validate(value);
|
|
36
|
+
}
|
|
37
|
+
resolveDynamicMethodInfo(dynamicMethod) {
|
|
38
|
+
const dynamicMethodInfo = {
|
|
39
|
+
onlyBaseWheres: false,
|
|
40
|
+
ignoreWhere: false,
|
|
41
|
+
ignoreOrderByAndPagination: true,
|
|
42
|
+
ignoreSelect: false,
|
|
43
|
+
keyToMapReplaced: "",
|
|
44
|
+
argsCount: 0,
|
|
45
|
+
method: "unknown",
|
|
46
|
+
existsMode: false,
|
|
47
|
+
ignoreIgnoreConflicts: true,
|
|
48
|
+
ignoreDistinct: true,
|
|
49
|
+
whereParams: [],
|
|
50
|
+
otherParams: [],
|
|
51
|
+
};
|
|
52
|
+
if (dynamicMethod.startsWith("findOneBy")) {
|
|
53
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("findOneBy", "");
|
|
54
|
+
dynamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
55
|
+
dynamicMethodInfo.method = "findOne";
|
|
56
|
+
}
|
|
57
|
+
else if (dynamicMethod.startsWith("findBy")) {
|
|
58
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("findBy", "");
|
|
59
|
+
dynamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
60
|
+
dynamicMethodInfo.ignoreDistinct = false;
|
|
61
|
+
dynamicMethodInfo.method = "findMany";
|
|
62
|
+
}
|
|
63
|
+
// else if (dynamicMethod === "groupBy") {
|
|
64
|
+
// dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("groupBy", "");
|
|
65
|
+
// dynamicMethodInfo.ignoreSelect = true;
|
|
66
|
+
// dynamicMethodInfo.ignoreWhere = true;
|
|
67
|
+
// dynamicMethodInfo.method = "groupBy";
|
|
68
|
+
// dynamicMethodInfo.otherParams.push("prismaArgs"); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
69
|
+
// dynamicMethodInfo.argsCount++;
|
|
70
|
+
// }
|
|
71
|
+
else if (dynamicMethod.startsWith("findOneOrThrowBy")) {
|
|
72
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("findOneOrThrowBy", "");
|
|
73
|
+
dynamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
74
|
+
dynamicMethodInfo.method = "findOneOrThrow";
|
|
75
|
+
}
|
|
76
|
+
else if (dynamicMethod.startsWith("findOneOrThrowWhere")) {
|
|
77
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("findOneOrThrowWhere", "");
|
|
78
|
+
dynamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
79
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
80
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
81
|
+
dynamicMethodInfo.whereIndex = 0;
|
|
82
|
+
dynamicMethodInfo.otherParams.push("where");
|
|
83
|
+
dynamicMethodInfo.argsCount += 1;
|
|
84
|
+
dynamicMethodInfo.method = "findOneOrThrow";
|
|
85
|
+
}
|
|
86
|
+
else if (dynamicMethod.startsWith("findOneOrThrow")) {
|
|
87
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("findOneOrThrow", "");
|
|
88
|
+
dynamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
89
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
90
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
91
|
+
dynamicMethodInfo.method = "findOneOrThrow";
|
|
92
|
+
}
|
|
93
|
+
else if (dynamicMethod.startsWith("countBy")) {
|
|
94
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("countBy", "");
|
|
95
|
+
dynamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
96
|
+
dynamicMethodInfo.ignoreSelect = true;
|
|
97
|
+
dynamicMethodInfo.method = "count";
|
|
98
|
+
}
|
|
99
|
+
else if (dynamicMethod.startsWith("countWhere")) {
|
|
100
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("countWhere", "");
|
|
101
|
+
dynamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
102
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
103
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
104
|
+
dynamicMethodInfo.ignoreSelect = true;
|
|
105
|
+
dynamicMethodInfo.method = "count";
|
|
106
|
+
dynamicMethodInfo.whereIndex = 0;
|
|
107
|
+
dynamicMethodInfo.otherParams.push("where");
|
|
108
|
+
dynamicMethodInfo.argsCount += 1;
|
|
109
|
+
}
|
|
110
|
+
else if (dynamicMethod.startsWith("count")) {
|
|
111
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("count", "");
|
|
112
|
+
dynamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
113
|
+
dynamicMethodInfo.ignoreSelect = true;
|
|
114
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
115
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
116
|
+
dynamicMethodInfo.method = "count";
|
|
117
|
+
}
|
|
118
|
+
else if (dynamicMethod.startsWith("existsBy")) {
|
|
119
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("existsBy", "");
|
|
120
|
+
dynamicMethodInfo.ignoreSelect = true;
|
|
121
|
+
dynamicMethodInfo.existsMode = true;
|
|
122
|
+
dynamicMethodInfo.method = "exists";
|
|
123
|
+
}
|
|
124
|
+
else if (dynamicMethod.startsWith("existsWhere")) {
|
|
125
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("existsWhere", "");
|
|
126
|
+
dynamicMethodInfo.ignoreSelect = true;
|
|
127
|
+
dynamicMethodInfo.existsMode = true;
|
|
128
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
129
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
130
|
+
dynamicMethodInfo.method = "exists";
|
|
131
|
+
dynamicMethodInfo.whereIndex = 0;
|
|
132
|
+
dynamicMethodInfo.otherParams.push("where");
|
|
133
|
+
dynamicMethodInfo.argsCount += 1;
|
|
134
|
+
}
|
|
135
|
+
else if (dynamicMethod.startsWith("createManyReturning")) {
|
|
136
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("createManyReturning", "");
|
|
137
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
138
|
+
dynamicMethodInfo.ignoreIgnoreConflicts = false;
|
|
139
|
+
dynamicMethodInfo.method = "createManyReturning";
|
|
140
|
+
dynamicMethodInfo.dataIndex = 0;
|
|
141
|
+
dynamicMethodInfo.otherParams.push("data");
|
|
142
|
+
dynamicMethodInfo.argsCount++;
|
|
143
|
+
}
|
|
144
|
+
else if (dynamicMethod.startsWith("createMany")) {
|
|
145
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("createMany", "");
|
|
146
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
147
|
+
dynamicMethodInfo.ignoreSelect = true;
|
|
148
|
+
dynamicMethodInfo.ignoreIgnoreConflicts = false;
|
|
149
|
+
dynamicMethodInfo.method = "createMany";
|
|
150
|
+
dynamicMethodInfo.dataIndex = 0;
|
|
151
|
+
dynamicMethodInfo.otherParams.push("data");
|
|
152
|
+
dynamicMethodInfo.argsCount++;
|
|
153
|
+
}
|
|
154
|
+
else if (dynamicMethod.startsWith("create")) {
|
|
155
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("create", "");
|
|
156
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
157
|
+
dynamicMethodInfo.method = "create";
|
|
158
|
+
dynamicMethodInfo.dataIndex = 0;
|
|
159
|
+
dynamicMethodInfo.otherParams.push("data");
|
|
160
|
+
dynamicMethodInfo.argsCount++;
|
|
161
|
+
}
|
|
162
|
+
else if (dynamicMethod.startsWith("updateManyReturningBy")) {
|
|
163
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("updateManyReturningBy", "");
|
|
164
|
+
dynamicMethodInfo.method = "updateManyReturning";
|
|
165
|
+
dynamicMethodInfo.dataIndex = -2;
|
|
166
|
+
dynamicMethodInfo.otherParams.push("data");
|
|
167
|
+
dynamicMethodInfo.argsCount++;
|
|
168
|
+
}
|
|
169
|
+
else if (dynamicMethod.startsWith("updateManyReturningWhere")) {
|
|
170
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("updateManyReturningWhere", "");
|
|
171
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
172
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
173
|
+
dynamicMethodInfo.method = "updateManyReturning";
|
|
174
|
+
dynamicMethodInfo.dataIndex = -2;
|
|
175
|
+
dynamicMethodInfo.whereIndex = 0;
|
|
176
|
+
dynamicMethodInfo.otherParams.push("where", "data");
|
|
177
|
+
dynamicMethodInfo.argsCount += 2;
|
|
178
|
+
}
|
|
179
|
+
else if (dynamicMethod.startsWith("updateManyBy")) {
|
|
180
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("updateManyBy", "");
|
|
181
|
+
dynamicMethodInfo.ignoreSelect = true;
|
|
182
|
+
dynamicMethodInfo.method = "updateMany";
|
|
183
|
+
dynamicMethodInfo.dataIndex = -2;
|
|
184
|
+
dynamicMethodInfo.otherParams.push("data");
|
|
185
|
+
dynamicMethodInfo.argsCount++;
|
|
186
|
+
}
|
|
187
|
+
else if (dynamicMethod.startsWith("updateManyWhere")) {
|
|
188
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("updateManyWhere", "");
|
|
189
|
+
dynamicMethodInfo.ignoreSelect = true;
|
|
190
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
191
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
192
|
+
dynamicMethodInfo.method = "updateMany";
|
|
193
|
+
dynamicMethodInfo.dataIndex = -2;
|
|
194
|
+
dynamicMethodInfo.whereIndex = 0;
|
|
195
|
+
dynamicMethodInfo.otherParams.push("where", "data");
|
|
196
|
+
dynamicMethodInfo.argsCount += 2;
|
|
197
|
+
}
|
|
198
|
+
else if (dynamicMethod.startsWith("updateBy")) {
|
|
199
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("updateBy", "");
|
|
200
|
+
dynamicMethodInfo.method = "update";
|
|
201
|
+
dynamicMethodInfo.dataIndex = -2;
|
|
202
|
+
dynamicMethodInfo.otherParams.push("data");
|
|
203
|
+
dynamicMethodInfo.argsCount++;
|
|
204
|
+
}
|
|
205
|
+
else if (dynamicMethod.startsWith("updateWhere")) {
|
|
206
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("updateWhere", "");
|
|
207
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
208
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
209
|
+
dynamicMethodInfo.method = "update";
|
|
210
|
+
dynamicMethodInfo.dataIndex = -2;
|
|
211
|
+
dynamicMethodInfo.whereIndex = 0;
|
|
212
|
+
dynamicMethodInfo.otherParams.push("where", "data");
|
|
213
|
+
dynamicMethodInfo.argsCount += 2;
|
|
214
|
+
}
|
|
215
|
+
else if (dynamicMethod.startsWith("upsertBy")) {
|
|
216
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("upsertBy", "");
|
|
217
|
+
dynamicMethodInfo.method = "upsert";
|
|
218
|
+
dynamicMethodInfo.createIndex = -3;
|
|
219
|
+
dynamicMethodInfo.updateIndex = -2;
|
|
220
|
+
dynamicMethodInfo.otherParams.push("create", "update");
|
|
221
|
+
dynamicMethodInfo.argsCount += 2;
|
|
222
|
+
}
|
|
223
|
+
else if (dynamicMethod.startsWith("upsertWhere")) {
|
|
224
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("upsertWhere", "");
|
|
225
|
+
dynamicMethodInfo.method = "upsert";
|
|
226
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
227
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
228
|
+
dynamicMethodInfo.createIndex = -3;
|
|
229
|
+
dynamicMethodInfo.updateIndex = -2;
|
|
230
|
+
dynamicMethodInfo.whereIndex = 0;
|
|
231
|
+
dynamicMethodInfo.otherParams.push("where", "create", "update");
|
|
232
|
+
dynamicMethodInfo.argsCount += 3;
|
|
233
|
+
}
|
|
234
|
+
else if (dynamicMethod.startsWith("deleteManyReturningBy")) {
|
|
235
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("deleteManyReturningBy", "");
|
|
236
|
+
dynamicMethodInfo.method = "deleteManyReturning";
|
|
237
|
+
}
|
|
238
|
+
else if (dynamicMethod.startsWith("deleteManyReturningWhere")) {
|
|
239
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("deleteManyReturningWhere", "");
|
|
240
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
241
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
242
|
+
dynamicMethodInfo.method = "deleteManyReturning";
|
|
243
|
+
dynamicMethodInfo.whereIndex = 0;
|
|
244
|
+
dynamicMethodInfo.otherParams.push("where");
|
|
245
|
+
dynamicMethodInfo.argsCount += 1;
|
|
246
|
+
}
|
|
247
|
+
else if (dynamicMethod.startsWith("deleteManyBy")) {
|
|
248
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("deleteManyBy", "");
|
|
249
|
+
dynamicMethodInfo.ignoreSelect = true;
|
|
250
|
+
dynamicMethodInfo.method = "deleteMany";
|
|
251
|
+
}
|
|
252
|
+
else if (dynamicMethod.startsWith("deleteManyWhere")) {
|
|
253
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("deleteManyWhere", "");
|
|
254
|
+
dynamicMethodInfo.ignoreSelect = true;
|
|
255
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
256
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
257
|
+
dynamicMethodInfo.method = "deleteMany";
|
|
258
|
+
dynamicMethodInfo.whereIndex = 0;
|
|
259
|
+
dynamicMethodInfo.otherParams.push("where");
|
|
260
|
+
dynamicMethodInfo.argsCount += 1;
|
|
261
|
+
}
|
|
262
|
+
else if (dynamicMethod.startsWith("deleteBy")) {
|
|
263
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("deleteBy", "");
|
|
264
|
+
dynamicMethodInfo.method = "delete";
|
|
265
|
+
}
|
|
266
|
+
else if (dynamicMethod.startsWith("deleteWhere")) {
|
|
267
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("deleteWhere", "");
|
|
268
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
269
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
270
|
+
dynamicMethodInfo.whereIndex = 0;
|
|
271
|
+
dynamicMethodInfo.otherParams.push("where");
|
|
272
|
+
dynamicMethodInfo.argsCount += 1;
|
|
273
|
+
dynamicMethodInfo.method = "delete";
|
|
274
|
+
}
|
|
275
|
+
else if (dynamicMethod.startsWith("findWhere")) {
|
|
276
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("findWhere", "");
|
|
277
|
+
dynamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
278
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
279
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
280
|
+
dynamicMethodInfo.ignoreDistinct = false;
|
|
281
|
+
dynamicMethodInfo.method = "findMany";
|
|
282
|
+
dynamicMethodInfo.whereIndex = 0;
|
|
283
|
+
dynamicMethodInfo.otherParams.push("where");
|
|
284
|
+
dynamicMethodInfo.argsCount += 1;
|
|
285
|
+
}
|
|
286
|
+
else if (dynamicMethod.startsWith("findOneWhere")) {
|
|
287
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("findOneWhere", "");
|
|
288
|
+
dynamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
289
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
290
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
291
|
+
dynamicMethodInfo.method = "findOne";
|
|
292
|
+
dynamicMethodInfo.whereIndex = 0;
|
|
293
|
+
dynamicMethodInfo.otherParams.push("where");
|
|
294
|
+
dynamicMethodInfo.argsCount += 1;
|
|
295
|
+
}
|
|
296
|
+
else if (dynamicMethod.startsWith("findOne")) {
|
|
297
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethod.replace("findOne", "");
|
|
298
|
+
dynamicMethodInfo.ignoreOrderByAndPagination = false;
|
|
299
|
+
dynamicMethodInfo.ignoreWhere = true;
|
|
300
|
+
dynamicMethodInfo.onlyBaseWheres = true;
|
|
301
|
+
dynamicMethodInfo.method = "findOne";
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
const errorMessage = `Unknown dynamic method: ${dynamicMethod}.`;
|
|
305
|
+
this.logger.logError(errorMessage);
|
|
306
|
+
throw new VSRepoError_1.VSRepoError(errorMessage, vsrepo_error_type_enum_1.VSRepoErrorType.RESOLVER);
|
|
307
|
+
}
|
|
308
|
+
return dynamicMethodInfo;
|
|
309
|
+
}
|
|
310
|
+
resolveDynamicMethodCustomization(dynamicMethodInfo, methodData) {
|
|
311
|
+
const dynamicMethodCustomization = {};
|
|
312
|
+
if (!dynamicMethodInfo.ignoreIgnoreConflicts) {
|
|
313
|
+
if (dynamicMethodInfo.keyToMapReplaced.endsWith("IgnoreConflicts")) {
|
|
314
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethodInfo.keyToMapReplaced.replace("IgnoreConflicts", "");
|
|
315
|
+
dynamicMethodCustomization.ignoreConflicts = true;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (!dynamicMethodInfo.ignoreOrderByAndPagination) {
|
|
319
|
+
if (dynamicMethodInfo.keyToMapReplaced.endsWith("PaginatedAndOrdered")) {
|
|
320
|
+
dynamicMethodCustomization.orderPosition = -2;
|
|
321
|
+
dynamicMethodCustomization.paginationPosition = -3;
|
|
322
|
+
dynamicMethodInfo.otherParams.push("pagination");
|
|
323
|
+
dynamicMethodInfo.otherParams.push("order");
|
|
324
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethodInfo.keyToMapReplaced.replace("PaginatedAndOrdered", "");
|
|
325
|
+
dynamicMethodInfo.argsCount += 2;
|
|
326
|
+
}
|
|
327
|
+
else if (dynamicMethodInfo.keyToMapReplaced.endsWith("OrderedAndPaginated")) {
|
|
328
|
+
dynamicMethodCustomization.orderPosition = -3;
|
|
329
|
+
dynamicMethodCustomization.paginationPosition = -2;
|
|
330
|
+
dynamicMethodInfo.otherParams.push("order");
|
|
331
|
+
dynamicMethodInfo.otherParams.push("pagination");
|
|
332
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethodInfo.keyToMapReplaced.replace("OrderedAndPaginated", "");
|
|
333
|
+
dynamicMethodInfo.argsCount += 2;
|
|
334
|
+
}
|
|
335
|
+
else if (dynamicMethodInfo.keyToMapReplaced.endsWith("Paginated")) {
|
|
336
|
+
dynamicMethodCustomization.paginationPosition = -2;
|
|
337
|
+
dynamicMethodInfo.otherParams.push("pagination");
|
|
338
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethodInfo.keyToMapReplaced.replace("Paginated", "");
|
|
339
|
+
dynamicMethodInfo.argsCount++;
|
|
340
|
+
}
|
|
341
|
+
else if (dynamicMethodInfo.keyToMapReplaced.endsWith("Ordered")) {
|
|
342
|
+
dynamicMethodCustomization.orderPosition = -2;
|
|
343
|
+
dynamicMethodInfo.otherParams.push("order");
|
|
344
|
+
dynamicMethodInfo.keyToMapReplaced = dynamicMethodInfo.keyToMapReplaced.replace("Ordered", "");
|
|
345
|
+
dynamicMethodInfo.argsCount++;
|
|
346
|
+
}
|
|
347
|
+
const keySplitedOrderBy = dynamicMethodInfo.keyToMapReplaced.split("OrderBy");
|
|
348
|
+
if (keySplitedOrderBy[1]) {
|
|
349
|
+
const orderByFields = keySplitedOrderBy[1].split("And").map(uncapitalize_util_1.uncapitalize);
|
|
350
|
+
dynamicMethodCustomization.injectOrdering = orderByFields.map(field => {
|
|
351
|
+
if (field.endsWith("Asc")) {
|
|
352
|
+
field = field.replace("Asc", "");
|
|
353
|
+
return { [field]: "ASC" };
|
|
354
|
+
}
|
|
355
|
+
else if (field.endsWith("Desc")) {
|
|
356
|
+
field = field.replace("Desc", "");
|
|
357
|
+
return { [field]: "DESC" };
|
|
358
|
+
}
|
|
359
|
+
return { [field]: "ASC" };
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
dynamicMethodInfo.keyToMapReplaced = keySplitedOrderBy[0];
|
|
363
|
+
dynamicMethodCustomization.injectOrdering ??= methodData.injectOrdering;
|
|
364
|
+
}
|
|
365
|
+
if (!dynamicMethodInfo.ignoreDistinct) {
|
|
366
|
+
const keySplitedDistinct = dynamicMethodInfo.keyToMapReplaced.split("Distinct");
|
|
367
|
+
if (keySplitedDistinct[1]) {
|
|
368
|
+
dynamicMethodCustomization.distinctKeys = keySplitedDistinct[1]
|
|
369
|
+
.split("And")
|
|
370
|
+
.map(uncapitalize_util_1.uncapitalize);
|
|
371
|
+
}
|
|
372
|
+
dynamicMethodInfo.keyToMapReplaced = keySplitedDistinct[0];
|
|
373
|
+
}
|
|
374
|
+
return dynamicMethodCustomization;
|
|
375
|
+
}
|
|
376
|
+
resolveUglyWhere(keySplitedAnd) {
|
|
377
|
+
const uglyWhere = { name: "", pushProperty: "$$$" };
|
|
378
|
+
let nullMode = undefined;
|
|
379
|
+
if (keySplitedAnd.includes("IsNull")) {
|
|
380
|
+
uglyWhere.pushProperty = "$$$";
|
|
381
|
+
uglyWhere.autoInjectVal = null;
|
|
382
|
+
nullMode = "is";
|
|
383
|
+
keySplitedAnd = keySplitedAnd.replace("IsNull", "");
|
|
384
|
+
}
|
|
385
|
+
else if (keySplitedAnd.includes("IsNotNull")) {
|
|
386
|
+
uglyWhere.pushProperty = "not";
|
|
387
|
+
uglyWhere.autoInjectVal = null;
|
|
388
|
+
nullMode = "not";
|
|
389
|
+
keySplitedAnd = keySplitedAnd.replace("IsNotNull", "");
|
|
390
|
+
}
|
|
391
|
+
else if (keySplitedAnd.includes("IsTrue")) {
|
|
392
|
+
uglyWhere.pushProperty = "$$$";
|
|
393
|
+
uglyWhere.autoInjectVal = true;
|
|
394
|
+
keySplitedAnd = keySplitedAnd.replace("IsTrue", "");
|
|
395
|
+
}
|
|
396
|
+
else if (keySplitedAnd.includes("IsFalse")) {
|
|
397
|
+
uglyWhere.pushProperty = "$$$";
|
|
398
|
+
uglyWhere.autoInjectVal = false;
|
|
399
|
+
keySplitedAnd = keySplitedAnd.replace("IsFalse", "");
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
if (keySplitedAnd.includes("IgnoreCase")) {
|
|
403
|
+
uglyWhere.properties = {};
|
|
404
|
+
uglyWhere.properties.ignoreCase = true;
|
|
405
|
+
keySplitedAnd = keySplitedAnd.replace("IgnoreCase", "");
|
|
406
|
+
}
|
|
407
|
+
if (keySplitedAnd.includes("Optional")) {
|
|
408
|
+
keySplitedAnd = keySplitedAnd.replace("Optional", "");
|
|
409
|
+
}
|
|
410
|
+
if (keySplitedAnd.includes("NotBetween")) {
|
|
411
|
+
uglyWhere.pushProperty = "not";
|
|
412
|
+
uglyWhere.betweenMode = true;
|
|
413
|
+
keySplitedAnd = keySplitedAnd.replace("NotBetween", "");
|
|
414
|
+
}
|
|
415
|
+
else if (keySplitedAnd.includes("Between")) {
|
|
416
|
+
uglyWhere.pushProperty = "$$$";
|
|
417
|
+
uglyWhere.betweenMode = true;
|
|
418
|
+
keySplitedAnd = keySplitedAnd.replace("Between", "");
|
|
419
|
+
}
|
|
420
|
+
else if (keySplitedAnd.includes("NotStartsWith")) {
|
|
421
|
+
uglyWhere.pushProperty = "not.startsWith";
|
|
422
|
+
keySplitedAnd = keySplitedAnd.replace("NotStartsWith", "");
|
|
423
|
+
}
|
|
424
|
+
else if (keySplitedAnd.includes("StartsWith")) {
|
|
425
|
+
uglyWhere.pushProperty = "startsWith";
|
|
426
|
+
keySplitedAnd = keySplitedAnd.replace("StartsWith", "");
|
|
427
|
+
}
|
|
428
|
+
else if (keySplitedAnd.includes("NotEndsWith")) {
|
|
429
|
+
uglyWhere.pushProperty = "not.endsWith";
|
|
430
|
+
keySplitedAnd = keySplitedAnd.replace("NotEndsWith", "");
|
|
431
|
+
}
|
|
432
|
+
else if (keySplitedAnd.includes("EndsWith")) {
|
|
433
|
+
uglyWhere.pushProperty = "endsWith";
|
|
434
|
+
keySplitedAnd = keySplitedAnd.replace("EndsWith", "");
|
|
435
|
+
}
|
|
436
|
+
else if (keySplitedAnd.includes("NotContains")) {
|
|
437
|
+
uglyWhere.pushProperty = "not.contains";
|
|
438
|
+
keySplitedAnd = keySplitedAnd.replace("NotContains", "");
|
|
439
|
+
}
|
|
440
|
+
else if (keySplitedAnd.includes("Contains")) {
|
|
441
|
+
uglyWhere.pushProperty = "contains";
|
|
442
|
+
keySplitedAnd = keySplitedAnd.replace("Contains", "");
|
|
443
|
+
}
|
|
444
|
+
else if (keySplitedAnd.includes("LessThanEqual")) {
|
|
445
|
+
uglyWhere.pushProperty = "lte";
|
|
446
|
+
keySplitedAnd = keySplitedAnd.replace("LessThanEqual", "");
|
|
447
|
+
}
|
|
448
|
+
else if (keySplitedAnd.includes("LessThan")) {
|
|
449
|
+
uglyWhere.pushProperty = "lt";
|
|
450
|
+
keySplitedAnd = keySplitedAnd.replace("LessThan", "");
|
|
451
|
+
}
|
|
452
|
+
else if (keySplitedAnd.includes("GreaterThanEqual")) {
|
|
453
|
+
uglyWhere.pushProperty = "gte";
|
|
454
|
+
keySplitedAnd = keySplitedAnd.replace("GreaterThanEqual", "");
|
|
455
|
+
}
|
|
456
|
+
else if (keySplitedAnd.includes("GreaterThan")) {
|
|
457
|
+
uglyWhere.pushProperty = "gt";
|
|
458
|
+
keySplitedAnd = keySplitedAnd.replace("GreaterThan", "");
|
|
459
|
+
}
|
|
460
|
+
else if (keySplitedAnd.includes("NotIn")) {
|
|
461
|
+
uglyWhere.pushProperty = "notIn";
|
|
462
|
+
keySplitedAnd = keySplitedAnd.replace("NotIn", "");
|
|
463
|
+
}
|
|
464
|
+
else if (keySplitedAnd.includes("In")) {
|
|
465
|
+
uglyWhere.pushProperty = "in";
|
|
466
|
+
keySplitedAnd = keySplitedAnd.replace("In", "");
|
|
467
|
+
}
|
|
468
|
+
else if (keySplitedAnd.includes("Not")) {
|
|
469
|
+
uglyWhere.pushProperty = "not";
|
|
470
|
+
keySplitedAnd = keySplitedAnd.replace("Not", "");
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
uglyWhere.pushProperty = "$$$";
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
if (keySplitedAnd.includes("Without")) {
|
|
477
|
+
const keySplitedConector = keySplitedAnd.split("Without");
|
|
478
|
+
const specificField = keySplitedConector[1];
|
|
479
|
+
if (!specificField) {
|
|
480
|
+
if (nullMode) {
|
|
481
|
+
uglyWhere.pushProperty = nullMode === "not" ? "_with" : "_without";
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
uglyWhere.pushProperty = "_without";
|
|
485
|
+
uglyWhere.autoInjectVal = {};
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
uglyWhere.pushProperty = `_without.${(0, uncapitalize_util_1.uncapitalize)(specificField)}${uglyWhere.pushProperty === "$$$" ? "" : `.${uglyWhere.pushProperty}`}`;
|
|
490
|
+
}
|
|
491
|
+
keySplitedAnd = keySplitedConector[0];
|
|
492
|
+
}
|
|
493
|
+
else if (keySplitedAnd.includes("With")) {
|
|
494
|
+
const keySplitedConector = keySplitedAnd.split("With");
|
|
495
|
+
const specificField = keySplitedConector[1];
|
|
496
|
+
if (!specificField) {
|
|
497
|
+
if (nullMode) {
|
|
498
|
+
uglyWhere.pushProperty = nullMode === "not" ? "_without" : "_with";
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
uglyWhere.pushProperty = "_with";
|
|
502
|
+
uglyWhere.autoInjectVal = {};
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
uglyWhere.pushProperty = `_with.${(0, uncapitalize_util_1.uncapitalize)(specificField)}${uglyWhere.pushProperty === "$$$" ? "" : `.${uglyWhere.pushProperty}`}`;
|
|
507
|
+
}
|
|
508
|
+
keySplitedAnd = keySplitedConector[0];
|
|
509
|
+
}
|
|
510
|
+
else if (keySplitedAnd.includes("Some")) {
|
|
511
|
+
const keySplitedConector = keySplitedAnd.split("Some");
|
|
512
|
+
const specificField = keySplitedConector[1];
|
|
513
|
+
if (!specificField) {
|
|
514
|
+
uglyWhere.pushProperty = "_some";
|
|
515
|
+
uglyWhere.autoInjectVal = {};
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
uglyWhere.pushProperty = `_some.${(0, uncapitalize_util_1.uncapitalize)(specificField)}${uglyWhere.pushProperty === "$$$" ? "" : `.${uglyWhere.pushProperty}`}`;
|
|
519
|
+
}
|
|
520
|
+
keySplitedAnd = keySplitedConector[0];
|
|
521
|
+
}
|
|
522
|
+
else if (keySplitedAnd.includes("Every")) {
|
|
523
|
+
const keySplitedConector = keySplitedAnd.split("Every");
|
|
524
|
+
const specificField = keySplitedConector[1];
|
|
525
|
+
if (!specificField) {
|
|
526
|
+
uglyWhere.pushProperty = "_every";
|
|
527
|
+
uglyWhere.autoInjectVal = {};
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
uglyWhere.pushProperty = `_every.${(0, uncapitalize_util_1.uncapitalize)(specificField)}${uglyWhere.pushProperty === "$$$" ? "" : `.${uglyWhere.pushProperty}`}`;
|
|
531
|
+
}
|
|
532
|
+
keySplitedAnd = keySplitedConector[0];
|
|
533
|
+
}
|
|
534
|
+
else if (keySplitedAnd.includes("None")) {
|
|
535
|
+
const keySplitedConector = keySplitedAnd.split("None");
|
|
536
|
+
const specificField = keySplitedConector[1];
|
|
537
|
+
if (!specificField) {
|
|
538
|
+
uglyWhere.pushProperty = "_none";
|
|
539
|
+
uglyWhere.autoInjectVal = {};
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
uglyWhere.pushProperty = `_none.${(0, uncapitalize_util_1.uncapitalize)(specificField)}${uglyWhere.pushProperty === "$$$" ? "" : `.${uglyWhere.pushProperty}`}`;
|
|
543
|
+
}
|
|
544
|
+
keySplitedAnd = keySplitedConector[0];
|
|
545
|
+
}
|
|
546
|
+
keySplitedAnd = (0, uncapitalize_util_1.uncapitalize)(keySplitedAnd);
|
|
547
|
+
uglyWhere.name = keySplitedAnd;
|
|
548
|
+
return uglyWhere;
|
|
549
|
+
}
|
|
550
|
+
resolvePrettyWheres(dynamicMethodInfo) {
|
|
551
|
+
const dynamicMethodWhereOps = {
|
|
552
|
+
uglyWheres: [],
|
|
553
|
+
prettyWheres: [],
|
|
554
|
+
};
|
|
555
|
+
let ANDMode = false;
|
|
556
|
+
let keysSplitedAND = dynamicMethodInfo.keyToMapReplaced.split("AND");
|
|
557
|
+
if (keysSplitedAND.length > 1) {
|
|
558
|
+
ANDMode = true;
|
|
559
|
+
}
|
|
560
|
+
keysSplitedAND.forEach((keySplitedAND, idx) => {
|
|
561
|
+
let orMode = false;
|
|
562
|
+
let keysSplitedOr = idx === 0 ? keySplitedAND.split("Or") : [keySplitedAND];
|
|
563
|
+
if (keysSplitedOr.length > 1) {
|
|
564
|
+
orMode = true;
|
|
565
|
+
}
|
|
566
|
+
for (let i = 0; i < keysSplitedOr.length; i++) {
|
|
567
|
+
if (keysSplitedOr[i] === "")
|
|
568
|
+
continue;
|
|
569
|
+
const keysSplitedAnd = keysSplitedOr[i].split("And");
|
|
570
|
+
for (const keySplitedAnd of keysSplitedAnd) {
|
|
571
|
+
if (keySplitedAnd === "")
|
|
572
|
+
continue;
|
|
573
|
+
const uglyWhere = this.resolveUglyWhere(keySplitedAnd);
|
|
574
|
+
if (!orMode) {
|
|
575
|
+
if (idx === 1 && ANDMode) {
|
|
576
|
+
uglyWhere.name = `AND.${i}idx.${uglyWhere.name}`;
|
|
577
|
+
}
|
|
578
|
+
dynamicMethodWhereOps.uglyWheres.push(uglyWhere);
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
uglyWhere.name = `OR.${i}idx.${uglyWhere.name}`;
|
|
582
|
+
dynamicMethodWhereOps.uglyWheres.push(uglyWhere);
|
|
583
|
+
}
|
|
584
|
+
if (uglyWhere.autoInjectVal === undefined)
|
|
585
|
+
dynamicMethodInfo.argsCount++;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
const prettyWheres = dynamicMethodWhereOps.uglyWheres.map(arg => {
|
|
590
|
+
let context = [];
|
|
591
|
+
let otherProps = undefined;
|
|
592
|
+
let argName = arg.name;
|
|
593
|
+
const agrNameSplitedOr = argName.split("OR.");
|
|
594
|
+
if (agrNameSplitedOr.length > 1) {
|
|
595
|
+
const agrNameSplitedOrIdx = agrNameSplitedOr[1].split("idx.");
|
|
596
|
+
context.push("OR");
|
|
597
|
+
context.push(Number(agrNameSplitedOrIdx[0]));
|
|
598
|
+
argName = agrNameSplitedOrIdx[1];
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
const agrNameSplitedAND = argName.split("AND.");
|
|
602
|
+
if (agrNameSplitedAND.length > 1) {
|
|
603
|
+
const agrNameSplitedANDIdx = agrNameSplitedAND[1].split("idx.");
|
|
604
|
+
context.push("AND");
|
|
605
|
+
context.push(Number(agrNameSplitedANDIdx[0]));
|
|
606
|
+
argName = agrNameSplitedANDIdx[1];
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
context.push(argName);
|
|
610
|
+
if (arg.pushProperty !== "$$$") {
|
|
611
|
+
const pushProperty = arg.pushProperty;
|
|
612
|
+
const pushPropertySplitedDot = pushProperty.split(".");
|
|
613
|
+
pushPropertySplitedDot.forEach(prop => context.push(prop));
|
|
614
|
+
}
|
|
615
|
+
if (arg.properties !== undefined) {
|
|
616
|
+
const propertiesKeys = Object.keys(arg.properties);
|
|
617
|
+
otherProps = {};
|
|
618
|
+
for (let i = 0; i < propertiesKeys.length; i++) {
|
|
619
|
+
const key = propertiesKeys[i];
|
|
620
|
+
otherProps[key] = arg.properties[key];
|
|
621
|
+
}
|
|
622
|
+
if (arg.pushProperty === "$$$") {
|
|
623
|
+
context.push("equals");
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
dynamicMethodInfo.whereParams.push(argName);
|
|
627
|
+
return {
|
|
628
|
+
context,
|
|
629
|
+
otherProps,
|
|
630
|
+
argName,
|
|
631
|
+
autoVal: arg.autoInjectVal,
|
|
632
|
+
betweenMode: arg.betweenMode,
|
|
633
|
+
};
|
|
634
|
+
});
|
|
635
|
+
dynamicMethodWhereOps.prettyWheres = prettyWheres;
|
|
636
|
+
return dynamicMethodWhereOps;
|
|
637
|
+
}
|
|
638
|
+
resolveVSRepoArgs(data) {
|
|
639
|
+
const { instance: _, options, withoutSelect, withoutWhere, specificSelect, dataPayload, createPayload, updatePayload, specificWhere, ordering, pagination, withOrderingAndPagination, ignoreConflicts, distinctKeys, } = data;
|
|
640
|
+
// console.log(this.adapter)
|
|
641
|
+
const vsrepoArgs = {};
|
|
642
|
+
vsrepoArgs.options = { db: options.db ?? this.adapter.getDbClient() };
|
|
643
|
+
if (!withoutWhere) {
|
|
644
|
+
vsrepoArgs.where =
|
|
645
|
+
// * Essa validação é so para o debug mode
|
|
646
|
+
specificWhere === debug_arg_symbol_constant_1.DEBUG_ARG_SYMBOL
|
|
647
|
+
? // * 0 pois o whereIndex sempre vem no 0, se algum dia ele puder aparecer em outro lugar irá precisar corrigir isso
|
|
648
|
+
"<args>[0]"
|
|
649
|
+
: this.mergeWheresResolver.resolve(options.see, specificWhere);
|
|
650
|
+
}
|
|
651
|
+
if (!withoutSelect) {
|
|
652
|
+
vsrepoArgs.options.select = specificSelect ?? options.select;
|
|
653
|
+
vsrepoArgs.options.relations = options.relations;
|
|
654
|
+
}
|
|
655
|
+
if (dataPayload) {
|
|
656
|
+
vsrepoArgs.obj = dataPayload;
|
|
657
|
+
}
|
|
658
|
+
if (createPayload) {
|
|
659
|
+
vsrepoArgs.create = createPayload;
|
|
660
|
+
}
|
|
661
|
+
if (updatePayload) {
|
|
662
|
+
vsrepoArgs.update = updatePayload;
|
|
663
|
+
}
|
|
664
|
+
if (withOrderingAndPagination) {
|
|
665
|
+
if (ordering) {
|
|
666
|
+
vsrepoArgs.options.order = ordering;
|
|
667
|
+
}
|
|
668
|
+
if (pagination) {
|
|
669
|
+
vsrepoArgs.options.pagination = pagination;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
if (ignoreConflicts !== undefined) {
|
|
673
|
+
// * Usado no createMany
|
|
674
|
+
vsrepoArgs.options.ignoreConflicts = ignoreConflicts;
|
|
675
|
+
}
|
|
676
|
+
if (distinctKeys !== undefined) {
|
|
677
|
+
// * Usado no findMany
|
|
678
|
+
vsrepoArgs.options.distinct = distinctKeys;
|
|
679
|
+
}
|
|
680
|
+
return vsrepoArgs;
|
|
681
|
+
}
|
|
682
|
+
resolveSpecificWhere(args, prettyWheres) {
|
|
683
|
+
let specificWhere = {};
|
|
684
|
+
let OR;
|
|
685
|
+
let AND;
|
|
686
|
+
let adjust = 0;
|
|
687
|
+
for (let j = 0; j < prettyWheres.length; j++) {
|
|
688
|
+
let path = {};
|
|
689
|
+
let current = path;
|
|
690
|
+
let ormode = false;
|
|
691
|
+
let andmode = false;
|
|
692
|
+
let modeIdx;
|
|
693
|
+
const currentWhereRslvd = prettyWheres[j];
|
|
694
|
+
const context = currentWhereRslvd.context;
|
|
695
|
+
const contextLength = context.length;
|
|
696
|
+
const contextLengthM1 = contextLength - 1;
|
|
697
|
+
for (let i = 0; i < contextLength; i++) {
|
|
698
|
+
if (i < contextLengthM1) {
|
|
699
|
+
if (context[i] === "OR") {
|
|
700
|
+
ormode = true;
|
|
701
|
+
}
|
|
702
|
+
else if (context[i] === "AND") {
|
|
703
|
+
andmode = true;
|
|
704
|
+
}
|
|
705
|
+
else if (typeof context[i] === "number") {
|
|
706
|
+
modeIdx = context[i];
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
if (!current[context[i]])
|
|
710
|
+
current[context[i]] = {};
|
|
711
|
+
current = current[context[i]];
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
else {
|
|
715
|
+
if (currentWhereRslvd.autoVal !== undefined) {
|
|
716
|
+
current[context[i]] = currentWhereRslvd.autoVal;
|
|
717
|
+
adjust++;
|
|
718
|
+
continue;
|
|
719
|
+
}
|
|
720
|
+
const arg = args[j - adjust] === debug_arg_symbol_constant_1.DEBUG_ARG_SYMBOL
|
|
721
|
+
? `<args>[${j - adjust}]`
|
|
722
|
+
: args[j - adjust];
|
|
723
|
+
// ? Avaliar necessidade dessa validação; era usada por compatibilidade direta com o prisma
|
|
724
|
+
if (currentWhereRslvd.betweenMode && arg !== undefined) {
|
|
725
|
+
current[context[i]] = { between: arg };
|
|
726
|
+
// current[context[i]!]["gte"] = arg[0];
|
|
727
|
+
// current[context[i]!]["lte"] = arg[1];
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
current[context[i]] = arg;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
if (currentWhereRslvd.otherProps !== undefined) {
|
|
735
|
+
Object.assign(current, currentWhereRslvd.otherProps);
|
|
736
|
+
}
|
|
737
|
+
if (ormode) {
|
|
738
|
+
if (!OR)
|
|
739
|
+
OR = [];
|
|
740
|
+
if (!OR[modeIdx])
|
|
741
|
+
OR[modeIdx] = {};
|
|
742
|
+
OR[modeIdx] = (0, deepmerge_1.default)(OR[modeIdx], path);
|
|
743
|
+
// Object.assign(OR[modeIdx!], path);
|
|
744
|
+
}
|
|
745
|
+
else if (andmode) {
|
|
746
|
+
if (!AND)
|
|
747
|
+
AND = [];
|
|
748
|
+
if (!AND[modeIdx])
|
|
749
|
+
AND[modeIdx] = {};
|
|
750
|
+
AND[modeIdx] = (0, deepmerge_1.default)(AND[modeIdx], path);
|
|
751
|
+
// Object.assign(AND[modeIdx!], path);
|
|
752
|
+
}
|
|
753
|
+
else {
|
|
754
|
+
specificWhere = (0, deepmerge_1.default)(specificWhere, path);
|
|
755
|
+
// Object.assign(specificWhere, path);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
if (OR)
|
|
759
|
+
specificWhere.OR = OR.filter(x => x !== undefined);
|
|
760
|
+
if (AND)
|
|
761
|
+
specificWhere.AND = AND.filter(x => x !== undefined);
|
|
762
|
+
return specificWhere;
|
|
763
|
+
}
|
|
764
|
+
resolve(instance) {
|
|
765
|
+
const dynamicMethods = Reflect.getMetadata(dynamic_methods_key_constant_1.DYNAMIC_METHODS_KEY, instance.constructor.prototype) ?? [];
|
|
766
|
+
this.logger.logDebug(`Resolving ${dynamicMethods.length} dynamic method(s):`, dynamicMethods);
|
|
767
|
+
for (const method of dynamicMethods) {
|
|
768
|
+
if (typeof method.propertyKey === "symbol") {
|
|
769
|
+
const errorMessage = `The propertyKey must be a string`;
|
|
770
|
+
this.logger.logError(errorMessage);
|
|
771
|
+
throw new VSRepoError_1.VSRepoError(errorMessage, vsrepo_error_type_enum_1.VSRepoErrorType.RESOLVER);
|
|
772
|
+
}
|
|
773
|
+
const originalKey = method.propertyKey;
|
|
774
|
+
const methodToMap = method.proxyTo ?? originalKey;
|
|
775
|
+
const dynamicMethodInfo = this.resolveDynamicMethodInfo(methodToMap);
|
|
776
|
+
const dynamicMethodCustomization = this.resolveDynamicMethodCustomization(dynamicMethodInfo, method);
|
|
777
|
+
let dynamicMethodWhereOps = {
|
|
778
|
+
uglyWheres: [],
|
|
779
|
+
prettyWheres: [],
|
|
780
|
+
};
|
|
781
|
+
if (!dynamicMethodInfo.ignoreWhere) {
|
|
782
|
+
dynamicMethodWhereOps = this.resolvePrettyWheres(dynamicMethodInfo);
|
|
783
|
+
}
|
|
784
|
+
instance.$vsrepocache.set(originalKey, (args, methodOptions) => {
|
|
785
|
+
const vsrepoResolveArgsData = {
|
|
786
|
+
instance,
|
|
787
|
+
options: methodOptions ?? {},
|
|
788
|
+
withoutWhere: dynamicMethodInfo.ignoreWhere && !dynamicMethodInfo.onlyBaseWheres,
|
|
789
|
+
specificSelect: undefined, // ? Avaliar quando vai precisar
|
|
790
|
+
withoutSelect: dynamicMethodInfo.ignoreSelect,
|
|
791
|
+
ignoreConflicts: dynamicMethodCustomization.ignoreConflicts,
|
|
792
|
+
ordering: dynamicMethodCustomization.orderPosition !== undefined
|
|
793
|
+
? this.validateIndexedArg(args, dynamicMethodCustomization.orderPosition, value => this.validator.validateOrdering(value))
|
|
794
|
+
: (dynamicMethodCustomization.injectOrdering ?? this.defaultOrdering),
|
|
795
|
+
pagination: dynamicMethodCustomization.paginationPosition !== undefined
|
|
796
|
+
? this.validateIndexedArg(args, dynamicMethodCustomization.paginationPosition, value => this.validator.validatePagination(value))
|
|
797
|
+
: undefined,
|
|
798
|
+
dataPayload: dynamicMethodInfo.dataIndex !== undefined
|
|
799
|
+
? args.at(dynamicMethodInfo.dataIndex)
|
|
800
|
+
: undefined,
|
|
801
|
+
createPayload: dynamicMethodInfo.createIndex !== undefined
|
|
802
|
+
? args.at(dynamicMethodInfo.createIndex)
|
|
803
|
+
: undefined,
|
|
804
|
+
updatePayload: dynamicMethodInfo.updateIndex !== undefined
|
|
805
|
+
? args.at(dynamicMethodInfo.updateIndex)
|
|
806
|
+
: undefined,
|
|
807
|
+
withOrderingAndPagination: !dynamicMethodInfo.ignoreOrderByAndPagination,
|
|
808
|
+
distinctKeys: dynamicMethodCustomization.distinctKeys,
|
|
809
|
+
};
|
|
810
|
+
if (!dynamicMethodInfo.ignoreWhere) {
|
|
811
|
+
vsrepoResolveArgsData.specificWhere = this.resolveSpecificWhere(args, dynamicMethodWhereOps.prettyWheres);
|
|
812
|
+
}
|
|
813
|
+
else if (dynamicMethodInfo.onlyBaseWheres) {
|
|
814
|
+
vsrepoResolveArgsData.specificWhere =
|
|
815
|
+
dynamicMethodInfo.whereIndex !== undefined
|
|
816
|
+
? this.validateIndexedArg(args, dynamicMethodInfo.whereIndex, value => this.validator.validateWhere(value), false)
|
|
817
|
+
: {};
|
|
818
|
+
}
|
|
819
|
+
return this.resolveVSRepoArgs(vsrepoResolveArgsData);
|
|
820
|
+
});
|
|
821
|
+
// * If para evitar cálculo desnecessário
|
|
822
|
+
if (this.logger.getLogLevel() === vs_log_level_enum_1.VSLogLevel.DEBUG) {
|
|
823
|
+
const argsSimulation = [];
|
|
824
|
+
for (let i = 0; i <= dynamicMethodInfo.argsCount; i++) {
|
|
825
|
+
argsSimulation.push(debug_arg_symbol_constant_1.DEBUG_ARG_SYMBOL);
|
|
826
|
+
}
|
|
827
|
+
const vsrepoArgs = instance.$vsrepocache.get(originalKey)(argsSimulation);
|
|
828
|
+
const { db: _, ...options } = vsrepoArgs.options ?? {};
|
|
829
|
+
this.logger.logDebug(`Args preview for ${originalKey}:`, {
|
|
830
|
+
...vsrepoArgs,
|
|
831
|
+
options,
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
instance[originalKey] = async (...args) => {
|
|
835
|
+
let db = this.adapter.getDbClient();
|
|
836
|
+
let methodOptions;
|
|
837
|
+
if (args.length < dynamicMethodInfo.argsCount) {
|
|
838
|
+
const missingParams = dynamicMethodInfo.whereParams
|
|
839
|
+
.concat(dynamicMethodInfo.otherParams)
|
|
840
|
+
.slice(args.length);
|
|
841
|
+
const errorMessage = `Missing parameters: ${missingParams.join(", ")}`;
|
|
842
|
+
this.logger.logError(`Cannot run '${originalKey}': ${errorMessage}`);
|
|
843
|
+
throw new VSRepoError_1.VSRepoError(errorMessage, vsrepo_error_type_enum_1.VSRepoErrorType.DYNAMIC);
|
|
844
|
+
}
|
|
845
|
+
else if (args.length > dynamicMethodInfo.argsCount) {
|
|
846
|
+
const optionsArg = args[args.length - 1];
|
|
847
|
+
methodOptions = this.validator.validateMethodOptions(optionsArg);
|
|
848
|
+
db = methodOptions.db ?? db;
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
args.push("1");
|
|
852
|
+
}
|
|
853
|
+
const vsrepoArgs = instance.$vsrepocache.get(originalKey)(args, methodOptions);
|
|
854
|
+
const start = this.logger.startPerformLog(`run ${String(originalKey)} (-> ${dynamicMethodInfo.method})`);
|
|
855
|
+
try {
|
|
856
|
+
// * Todos os métodos do adapter seguem essa precedencia de parametros
|
|
857
|
+
const argsOrdered = [
|
|
858
|
+
vsrepoArgs.where,
|
|
859
|
+
vsrepoArgs.obj,
|
|
860
|
+
vsrepoArgs.create,
|
|
861
|
+
vsrepoArgs.update,
|
|
862
|
+
vsrepoArgs.options,
|
|
863
|
+
].filter(arg => arg !== undefined);
|
|
864
|
+
const result = await this.adapter[dynamicMethodInfo.method](...argsOrdered);
|
|
865
|
+
this.logger.endPerformLog(start);
|
|
866
|
+
return result;
|
|
867
|
+
}
|
|
868
|
+
catch (err) {
|
|
869
|
+
// ? Deixar o catch para se quiser fazer algum tratamento antes de lançar o erro
|
|
870
|
+
this.logger.endPerformLog(start);
|
|
871
|
+
this.logger.logError(`Failed to run dynamic method '${String(originalKey)}' (-> ${dynamicMethodInfo.method})`, err);
|
|
872
|
+
throw err;
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
return dynamicMethods.length;
|
|
877
|
+
}
|
|
878
|
+
resolveQueries(instance) {
|
|
879
|
+
const queryMethods = Reflect.getMetadata(query_methods_key_constant_1.QUERY_METHODS_KEY, instance.constructor.prototype) ?? [];
|
|
880
|
+
this.logger.logDebug(`Resolving ${queryMethods.length} query method(s):`, queryMethods);
|
|
881
|
+
for (const method of queryMethods) {
|
|
882
|
+
const originalKey = method.propertyKey;
|
|
883
|
+
const modifyingQueryMethod = method.modifying;
|
|
884
|
+
const valueQueryMethod = method.value;
|
|
885
|
+
instance[originalKey] = async (arg) => {
|
|
886
|
+
const queryArgValidated = this.validator.validateQueryMethodArg(arg);
|
|
887
|
+
queryArgValidated.db ??= this.adapter.getDbClient();
|
|
888
|
+
const start = this.logger.startPerformLog(`run ${String(originalKey)} (Modifying: ${modifyingQueryMethod})`);
|
|
889
|
+
try {
|
|
890
|
+
const result = await this.adapter.query(valueQueryMethod, {
|
|
891
|
+
...queryArgValidated,
|
|
892
|
+
modifying: modifyingQueryMethod,
|
|
893
|
+
});
|
|
894
|
+
this.logger.endPerformLog(start);
|
|
895
|
+
return result;
|
|
896
|
+
}
|
|
897
|
+
catch (err) {
|
|
898
|
+
this.logger.endPerformLog(start);
|
|
899
|
+
// this.logger.logError(
|
|
900
|
+
// `Failed to run query method '${String(originalKey)}'`,
|
|
901
|
+
// err,
|
|
902
|
+
// );
|
|
903
|
+
throw err;
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
return queryMethods.length;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
exports.DynamicMethodsResolver = DynamicMethodsResolver;
|