langaro-api 1.2.6 → 1.2.7
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/lib/generators/crud.js +25 -5
- package/package.json +2 -2
package/lib/generators/crud.js
CHANGED
|
@@ -140,7 +140,7 @@ module.exports = function generateCrudDts(projectRoot, outputDir) {
|
|
|
140
140
|
|
|
141
141
|
addMethodMapping(lines, 'appendItems');
|
|
142
142
|
lines.push(' appendItems(');
|
|
143
|
-
lines.push(' items: any[], appendArr: string[], appendOptions?: Record<string,
|
|
143
|
+
lines.push(' items: any[], appendArr: string[], appendOptions?: Record<string, AppendTableOptions>, transaction?: any');
|
|
144
144
|
lines.push(' ): Promise<any[]>;');
|
|
145
145
|
addMethodMapping(lines, 'refreshCache');
|
|
146
146
|
lines.push(' refreshCache(transaction?: any): Promise<void>;');
|
|
@@ -161,12 +161,32 @@ module.exports = function generateCrudDts(projectRoot, outputDir) {
|
|
|
161
161
|
|
|
162
162
|
// Options interfaces (no source mappings needed)
|
|
163
163
|
lines.push(
|
|
164
|
+
"declare type AndWhereOperator = '=' | '>' | '>=' | '<' | '<=' | '<>' | 'in' | 'not in' | 'between' | 'not between' | 'like' | 'json_overlaps';",
|
|
165
|
+
'',
|
|
166
|
+
'/** A condition with an explicit operator: [field, operator, value] */',
|
|
167
|
+
'declare type AndWhereConditionWithOperator = [string, AndWhereOperator, any];',
|
|
168
|
+
'/** A condition using the default "=" operator: [field, value] */',
|
|
169
|
+
'declare type AndWhereConditionWithoutOperator = [string, any];',
|
|
170
|
+
'',
|
|
171
|
+
'declare type AndWhereCondition = AndWhereConditionWithOperator | AndWhereConditionWithoutOperator;',
|
|
172
|
+
'',
|
|
173
|
+
'/** Options for an appended (related) table inside appendOptions */',
|
|
174
|
+
'declare interface AppendTableOptions {',
|
|
175
|
+
' /** Filter conditions applied to the appended table */',
|
|
176
|
+
' andWhere?: AndWhereCondition[];',
|
|
177
|
+
' /** Select only these columns from the appended table */',
|
|
178
|
+
' showOnly?: string | string[];',
|
|
179
|
+
' /** Fields to show (overrides hide list) */',
|
|
180
|
+
' show?: string[];',
|
|
181
|
+
' [key: string]: any;',
|
|
182
|
+
'}',
|
|
183
|
+
'',
|
|
164
184
|
'declare interface CRUDGetOptions {',
|
|
165
185
|
' perPage?: number;',
|
|
166
186
|
' currentPage?: number;',
|
|
167
187
|
' append?: string[];',
|
|
168
|
-
' appendOptions?: Record<string,
|
|
169
|
-
' andWhere?:
|
|
188
|
+
' appendOptions?: Record<string, AppendTableOptions>;',
|
|
189
|
+
' andWhere?: AndWhereCondition[];',
|
|
170
190
|
' search?: string;',
|
|
171
191
|
' searchExactMatch?: boolean;',
|
|
172
192
|
' searchFields?: string[];',
|
|
@@ -189,7 +209,7 @@ module.exports = function generateCrudDts(projectRoot, outputDir) {
|
|
|
189
209
|
' allowForbiddenUpdates?: boolean;',
|
|
190
210
|
' extraValidations?: Array<(data: any) => void>;',
|
|
191
211
|
' where?: (query: any) => any;',
|
|
192
|
-
' andWhere?:
|
|
212
|
+
' andWhere?: AndWhereCondition[];',
|
|
193
213
|
' whenSuccess?: (data: any) => void;',
|
|
194
214
|
' /** Skip automatic Redis query cache invalidation */',
|
|
195
215
|
' skipCacheInvalidation?: boolean;',
|
|
@@ -204,7 +224,7 @@ module.exports = function generateCrudDts(projectRoot, outputDir) {
|
|
|
204
224
|
'',
|
|
205
225
|
'declare interface CRUDDeleteOptions {',
|
|
206
226
|
' where?: (query: any) => any;',
|
|
207
|
-
' andWhere?:
|
|
227
|
+
' andWhere?: AndWhereCondition[];',
|
|
208
228
|
' /** Skip automatic Redis query cache invalidation */',
|
|
209
229
|
' skipCacheInvalidation?: boolean;',
|
|
210
230
|
' [key: string]: any;',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langaro-api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "Auto-generate TypeScript types, JSDoc annotations, and boilerplate loaders for knex-extended-crud projects",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"cron": ">=3.0.0",
|
|
25
|
-
"knex-extended-crud": ">=2.1.
|
|
25
|
+
"knex-extended-crud": ">=2.1.5"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|
|
28
28
|
"cron": {
|