@nulledexp/translatable-criteria 1.1.0 → 1.2.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 +3 -3
- package/dist/criteria/criteria.d.ts +168 -7
- package/dist/criteria/criteria.d.ts.map +1 -1
- package/dist/criteria/criteria.js +167 -3
- package/dist/criteria/criteria.js.map +1 -1
- package/dist/criteria/cursor.js +2 -2
- package/dist/criteria/cursor.js.map +1 -1
- package/dist/criteria/join/inner.join-criteria.d.ts +5 -0
- package/dist/criteria/join/inner.join-criteria.d.ts.map +1 -1
- package/dist/criteria/join/inner.join-criteria.js +5 -0
- package/dist/criteria/join/inner.join-criteria.js.map +1 -1
- package/dist/criteria/join/left.join-criteria.d.ts +5 -0
- package/dist/criteria/join/left.join-criteria.d.ts.map +1 -1
- package/dist/criteria/join/left.join-criteria.js +5 -0
- package/dist/criteria/join/left.join-criteria.js.map +1 -1
- package/dist/criteria/join/outer.join-criteria.d.ts +5 -0
- package/dist/criteria/join/outer.join-criteria.d.ts.map +1 -1
- package/dist/criteria/join/outer.join-criteria.js +5 -0
- package/dist/criteria/join/outer.join-criteria.js.map +1 -1
- package/dist/criteria/root.criteria.d.ts +5 -0
- package/dist/criteria/root.criteria.d.ts.map +1 -1
- package/dist/criteria/root.criteria.js +5 -0
- package/dist/criteria/root.criteria.js.map +1 -1
- package/dist/criteria/types/criteria.interface.d.ts +26 -23
- package/dist/criteria/types/criteria.interface.d.ts.map +1 -1
- package/dist/criteria/types/join-parameter.types.d.ts +36 -2
- package/dist/criteria/types/join-parameter.types.d.ts.map +1 -1
- package/dist/criteria/types/join-utility.types.d.ts +5 -5
- package/dist/criteria/types/join-utility.types.d.ts.map +1 -1
- package/dist/criteria/types/schema.types.d.ts +26 -2
- package/dist/criteria/types/schema.types.d.ts.map +1 -1
- package/dist/criteria/types/schema.types.js +1 -1
- package/dist/criteria/types/schema.types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ export const UserSchema = GetTypedCriteriaSchema({
|
|
|
54
54
|
alias: ['users', 'user', 'publisher'],
|
|
55
55
|
fields: ['uuid', 'email', 'username', 'created_at'],
|
|
56
56
|
joins: [
|
|
57
|
-
{ alias: 'posts',
|
|
57
|
+
{ alias: 'posts', relation_type: 'one_to_many' },
|
|
58
58
|
// other joins like 'permissions', 'addresses' can be defined here
|
|
59
59
|
],
|
|
60
60
|
});
|
|
@@ -73,8 +73,8 @@ export const PostSchema = GetTypedCriteriaSchema({
|
|
|
73
73
|
'metadata', // Example: for JSON filters
|
|
74
74
|
],
|
|
75
75
|
joins: [
|
|
76
|
-
{ alias: 'comments',
|
|
77
|
-
{ alias: 'publisher',
|
|
76
|
+
{ alias: 'comments', relation_type: 'one_to_many' },
|
|
77
|
+
{ alias: 'publisher', relation_type: 'many_to_one' },
|
|
78
78
|
],
|
|
79
79
|
});
|
|
80
80
|
export type PostSchema = typeof PostSchema;
|
|
@@ -3,8 +3,17 @@ import { Cursor } from './cursor.js';
|
|
|
3
3
|
import { Order, OrderDirection } from './order/order.js';
|
|
4
4
|
import type { FilterPrimitive } from './filter/types/filter-primitive.types.js';
|
|
5
5
|
import type { ICriteriaBase } from './types/criteria.interface.js';
|
|
6
|
-
import type { JoinCriteriaParameterType, JoinParameterType, SpecificMatchingJoinConfig } from './types/join-utility.types.js';
|
|
6
|
+
import type { JoinCriteriaParameterType, JoinParameterType, SpecificMatchingJoinConfig, StoredJoinDetails } from './types/join-utility.types.js';
|
|
7
7
|
import { FilterOperator } from './types/operator.types.js';
|
|
8
|
+
import type { FilterGroup } from './filter/filter-group.js';
|
|
9
|
+
/**
|
|
10
|
+
* Abstract base class for constructing query criteria.
|
|
11
|
+
* It provides a fluent API for defining filters, joins, selections, ordering, and pagination.
|
|
12
|
+
* Concrete criteria types (e.g., RootCriteria, JoinCriteria) will extend this class.
|
|
13
|
+
*
|
|
14
|
+
* @template TSchema - The schema definition for the entity this criteria operates on.
|
|
15
|
+
* @template CurrentAlias - The selected alias for the entity from its schema.
|
|
16
|
+
*/
|
|
8
17
|
export declare abstract class Criteria<TSchema extends CriteriaSchema, CurrentAlias extends SelectedAliasOf<TSchema> = SelectedAliasOf<TSchema>> implements ICriteriaBase<TSchema, CurrentAlias> {
|
|
9
18
|
protected readonly schema: TSchema;
|
|
10
19
|
protected _alias: CurrentAlias;
|
|
@@ -12,25 +21,103 @@ export declare abstract class Criteria<TSchema extends CriteriaSchema, CurrentAl
|
|
|
12
21
|
private readonly _joinManager;
|
|
13
22
|
private readonly _source_name;
|
|
14
23
|
private _take;
|
|
24
|
+
/**
|
|
25
|
+
* Stores the set of fields explicitly selected by the user.
|
|
26
|
+
* This is used when `_selectAll` is false.
|
|
27
|
+
* @protected
|
|
28
|
+
*/
|
|
15
29
|
protected _select: Set<FieldOfSchema<TSchema>>;
|
|
16
30
|
private _selectAll;
|
|
31
|
+
/**
|
|
32
|
+
* Stores the cursor configuration for pagination, if set.
|
|
33
|
+
* @protected
|
|
34
|
+
*/
|
|
17
35
|
protected _cursor: Cursor<FieldOfSchema<TSchema>, FilterOperator.GREATER_THAN | FilterOperator.LESS_THAN> | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Initializes a new instance of the Criteria class.
|
|
38
|
+
* @param {TSchema} schema - The schema definition for the entity.
|
|
39
|
+
* @param {CurrentAlias} _alias - The alias to use for this entity in the query.
|
|
40
|
+
* @throws {Error} If the provided alias is not supported by the schema.
|
|
41
|
+
* @protected
|
|
42
|
+
*/
|
|
18
43
|
constructor(schema: TSchema, _alias: CurrentAlias);
|
|
19
|
-
|
|
20
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Gets the currently selected fields.
|
|
46
|
+
* If `_selectAll` is true, it returns all fields from the schema.
|
|
47
|
+
* Otherwise, it returns the fields explicitly set via `setSelect`.
|
|
48
|
+
* @returns {Array<FieldOfSchema<TSchema>>} An array of selected field names.
|
|
49
|
+
*/
|
|
50
|
+
get select(): Array<FieldOfSchema<TSchema>>;
|
|
51
|
+
/**
|
|
52
|
+
* Resets the selection to include all fields from the schema.
|
|
53
|
+
* Subsequent calls to `get select()` will return all schema fields
|
|
54
|
+
* until `setSelect()` is called again.
|
|
55
|
+
* @returns {this} The current criteria instance for chaining.
|
|
56
|
+
*/
|
|
21
57
|
resetSelect(): this;
|
|
58
|
+
/**
|
|
59
|
+
* Indicates whether all fields are currently configured to be selected.
|
|
60
|
+
* @returns {boolean} True if all fields are selected, false if specific fields are selected.
|
|
61
|
+
*/
|
|
22
62
|
get selectAll(): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Specifies which fields to select for the entity.
|
|
65
|
+
* Calling this method sets `selectAll` to false.
|
|
66
|
+
* @param {Array<FieldOfSchema<TSchema>>} selectFields - An array of field names to select.
|
|
67
|
+
* @returns {this} The current criteria instance for chaining.
|
|
68
|
+
* @throws {Error} If any of the specified fields are not defined in the schema.
|
|
69
|
+
*/
|
|
23
70
|
setSelect(selectFields: Array<FieldOfSchema<TSchema>>): this;
|
|
71
|
+
/**
|
|
72
|
+
* Gets the maximum number of records to return (LIMIT).
|
|
73
|
+
* @returns {number} The take value.
|
|
74
|
+
*/
|
|
24
75
|
get take(): number;
|
|
25
76
|
private _skip;
|
|
77
|
+
/**
|
|
78
|
+
* Gets the number of records to skip (OFFSET).
|
|
79
|
+
* @returns {number} The skip value.
|
|
80
|
+
*/
|
|
26
81
|
get skip(): number;
|
|
27
82
|
private _orders;
|
|
83
|
+
/**
|
|
84
|
+
* Gets the current ordering rules applied to this criteria.
|
|
85
|
+
* @returns {ReadonlyArray<Order<FieldOfSchema<TSchema>>>} A readonly array of order objects.
|
|
86
|
+
*/
|
|
28
87
|
get orders(): ReadonlyArray<Order<FieldOfSchema<TSchema>>>;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Gets the configured join details for this criteria.
|
|
90
|
+
* @returns {ReadonlyArray<StoredJoinDetails<TSchema>>} A readonly array of join configurations.
|
|
91
|
+
*/
|
|
92
|
+
get joins(): ReadonlyArray<StoredJoinDetails<TSchema>>;
|
|
93
|
+
/**
|
|
94
|
+
* Gets the root filter group for this criteria, which holds all filter conditions.
|
|
95
|
+
* @returns {FilterGroup} The root filter group.
|
|
96
|
+
*/
|
|
97
|
+
get rootFilterGroup(): FilterGroup;
|
|
98
|
+
/**
|
|
99
|
+
* Gets the source name (e.g., table name) for the entity of this criteria.
|
|
100
|
+
* @returns {TSchema['source_name']} The source name string.
|
|
101
|
+
*/
|
|
102
|
+
get sourceName(): TSchema['source_name'];
|
|
103
|
+
/**
|
|
104
|
+
* Gets the alias used for the entity of this criteria.
|
|
105
|
+
* @returns {CurrentAlias} The alias string.
|
|
106
|
+
*/
|
|
32
107
|
get alias(): CurrentAlias;
|
|
108
|
+
/**
|
|
109
|
+
* Sets the maximum number of records to return (LIMIT).
|
|
110
|
+
* @param {number} amount - The number of records to take. Must be non-negative.
|
|
111
|
+
* @returns {this} The current criteria instance for chaining.
|
|
112
|
+
* @throws {Error} If the amount is negative.
|
|
113
|
+
*/
|
|
33
114
|
setTake(amount: number): this;
|
|
115
|
+
/**
|
|
116
|
+
* Sets the number of records to skip before starting to return records (OFFSET).
|
|
117
|
+
* @param {number} amount - The number of records to skip. Must be non-negative.
|
|
118
|
+
* @returns {this} The current criteria instance for chaining.
|
|
119
|
+
* @throws {Error} If the amount is negative.
|
|
120
|
+
*/
|
|
34
121
|
setSkip(amount: number): this;
|
|
35
122
|
/**
|
|
36
123
|
* Asserts that a given field name is defined within the current criteria's schema.
|
|
@@ -42,18 +129,92 @@ export declare abstract class Criteria<TSchema extends CriteriaSchema, CurrentAl
|
|
|
42
129
|
* @throws {Error} If the field is not defined in the schema.
|
|
43
130
|
*/
|
|
44
131
|
protected assetFieldOnSchema(field: FieldOfSchema<TSchema>): void;
|
|
132
|
+
/**
|
|
133
|
+
* Adds an ordering rule to the criteria.
|
|
134
|
+
* Multiple calls will append new ordering rules.
|
|
135
|
+
* @param {FieldOfSchema<TSchema>} field - The field to order by.
|
|
136
|
+
* @param {OrderDirection} direction - The direction of the ordering (ASC or DESC).
|
|
137
|
+
* @returns {this} The current criteria instance for chaining.
|
|
138
|
+
* @throws {Error} If the specified field is not defined in the schema.
|
|
139
|
+
*/
|
|
45
140
|
orderBy(field: FieldOfSchema<TSchema>, direction: OrderDirection): this;
|
|
141
|
+
/**
|
|
142
|
+
* Initializes the filter criteria with a single filter primitive.
|
|
143
|
+
* This replaces any existing filters in the root filter group.
|
|
144
|
+
* @template Operator - The specific filter operator type.
|
|
145
|
+
* @param {FilterPrimitive<FieldOfSchema<TSchema>, Operator>} filterPrimitive - The filter to apply.
|
|
146
|
+
* @returns {this} The current criteria instance for chaining.
|
|
147
|
+
* @throws {Error} If the specified field in filterPrimitive is not defined in the schema.
|
|
148
|
+
*/
|
|
46
149
|
where<Operator extends FilterOperator>(filterPrimitive: FilterPrimitive<FieldOfSchema<TSchema>, Operator>): this;
|
|
150
|
+
/**
|
|
151
|
+
* Adds a filter primitive to the current filter group using an AND logical operator.
|
|
152
|
+
* Requires `where()` to have been called first to initialize the filter group.
|
|
153
|
+
* @template Operator - The specific filter operator type.
|
|
154
|
+
* @param {FilterPrimitive<FieldOfSchema<TSchema>, Operator>} filterPrimitive - The filter to add.
|
|
155
|
+
* @returns {this} The current criteria instance for chaining.
|
|
156
|
+
* @throws {Error} If the specified field in filterPrimitive is not defined in the schema.
|
|
157
|
+
* @throws {Error} If `where()` has not been called first.
|
|
158
|
+
*/
|
|
47
159
|
andWhere<Operator extends FilterOperator>(filterPrimitive: FilterPrimitive<FieldOfSchema<TSchema>, Operator>): this;
|
|
160
|
+
/**
|
|
161
|
+
* Adds a filter primitive to the current filter group using an OR logical operator.
|
|
162
|
+
* Requires `where()` to have been called first to initialize the filter group.
|
|
163
|
+
* @template Operator - The specific filter operator type.
|
|
164
|
+
* @param {FilterPrimitive<FieldOfSchema<TSchema>, Operator>} filterPrimitive - The filter to add.
|
|
165
|
+
* @returns {this} The current criteria instance for chaining.
|
|
166
|
+
* @throws {Error} If the specified field in filterPrimitive is not defined in the schema.
|
|
167
|
+
* @throws {Error} If `where()` has not been called first.
|
|
168
|
+
*/
|
|
48
169
|
orWhere<Operator extends FilterOperator>(filterPrimitive: FilterPrimitive<FieldOfSchema<TSchema>, Operator>): this;
|
|
170
|
+
/**
|
|
171
|
+
* Adds a join to another criteria.
|
|
172
|
+
* @template TJoinSchema - The schema of the entity to join.
|
|
173
|
+
* @template TJoinedCriteriaAlias - The alias for the joined entity.
|
|
174
|
+
* @template TMatchingJoinConfig - The specific join configuration from the parent schema that matches the joined
|
|
175
|
+
* alias.
|
|
176
|
+
* @param {JoinCriteriaParameterType<TSchema, TJoinSchema, TJoinedCriteriaAlias, TMatchingJoinConfig>} criteriaToJoin
|
|
177
|
+
* The criteria instance representing the entity to join (e.g., `InnerJoinCriteria`, `LeftJoinCriteria`).
|
|
178
|
+
* @param {JoinParameterType<TSchema, TJoinSchema, TMatchingJoinConfig>} joinParameter
|
|
179
|
+
* The parameters defining how the join should be performed (e.g., fields for simple join, pivot table details for
|
|
180
|
+
* many-to-many).
|
|
181
|
+
* @returns {this} The current criteria instance for chaining.
|
|
182
|
+
* @throws {Error} If `criteriaToJoin` is a string (which is invalid).
|
|
183
|
+
* @throws {Error} If `parent_field` in `joinParameter` (or `parent_field.reference` for pivot joins) is not defined
|
|
184
|
+
* in the parent schema.
|
|
185
|
+
* @throws {Error} If the join configuration for the given `criteriaToJoin.alias` is not found in the parent schema's
|
|
186
|
+
* `joins` array.
|
|
187
|
+
* @throws {Error} If `joinParameter` is invalid for the `relation_type` defined in the schema (e.g., using
|
|
188
|
+
* simple join input for many-to-many or vice-versa).
|
|
189
|
+
*/
|
|
49
190
|
join<TJoinSchema extends CriteriaSchema, TJoinedCriteriaAlias extends SelectedAliasOf<TJoinSchema>, TMatchingJoinConfig extends SpecificMatchingJoinConfig<TSchema, TJoinedCriteriaAlias>>(criteriaToJoin: JoinCriteriaParameterType<TSchema, TJoinSchema, TJoinedCriteriaAlias, TMatchingJoinConfig>, joinParameter: JoinParameterType<TSchema, TJoinSchema, TMatchingJoinConfig>): this;
|
|
50
191
|
private assertIsValidJoinOptions;
|
|
192
|
+
/**
|
|
193
|
+
* Gets the current cursor configuration, if set.
|
|
194
|
+
* @returns {Cursor<FieldOfSchema<TSchema>, FilterOperator.GREATER_THAN | FilterOperator.LESS_THAN> | undefined}
|
|
195
|
+
* The cursor object or undefined.
|
|
196
|
+
*/
|
|
51
197
|
get cursor(): Cursor<FieldOfSchema<TSchema>, FilterOperator.GREATER_THAN | FilterOperator.LESS_THAN> | undefined;
|
|
198
|
+
/**
|
|
199
|
+
* Sets the cursor for pagination.
|
|
200
|
+
* @template Operator - The specific comparison operator for the cursor.
|
|
201
|
+
* @param {readonly [Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>] | readonly
|
|
202
|
+
* [Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>,
|
|
203
|
+
* Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>]} filterPrimitives - An array of one or two
|
|
204
|
+
* filter primitives defining the cursor's fields and values.
|
|
205
|
+
* @param {Operator} operator - The comparison operator (GREATER_THAN or LESS_THAN).
|
|
206
|
+
* @param {OrderDirection} order - The primary order direction for pagination.
|
|
207
|
+
* @returns {this} The current criteria instance for chaining.
|
|
208
|
+
* @throws {Error} If filterPrimitives does not contain exactly 1 or 2 elements.
|
|
209
|
+
* @throws {Error} If any cursor field is not defined in the schema.
|
|
210
|
+
* @throws {Error} If any cursor value is undefined (null is allowed, per Cursor constructor).
|
|
211
|
+
* @throws {Error} If two cursor fields are provided and they are identical (per Cursor constructor).
|
|
212
|
+
*/
|
|
52
213
|
setCursor<Operator extends FilterOperator.GREATER_THAN | FilterOperator.LESS_THAN>(filterPrimitives: readonly [
|
|
53
214
|
Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>
|
|
54
215
|
] | readonly [
|
|
55
216
|
Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>,
|
|
56
217
|
Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>
|
|
57
|
-
], operator: Operator, order: OrderDirection):
|
|
218
|
+
], operator: Operator, order: OrderDirection): this;
|
|
58
219
|
}
|
|
59
220
|
//# sourceMappingURL=criteria.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"criteria.d.ts","sourceRoot":"","sources":["../../src/criteria/criteria.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAEb,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"criteria.d.ts","sourceRoot":"","sources":["../../src/criteria/criteria.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAEb,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc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AW,SAAS,cAAc,EAClC,oBAAoB,SAAS,eAAe,CAAC,WAAW,CAAC,EACzD,mBAAmB,SAAS,0BAA0B,CACpD,OAAO,EACP,oBAAoB,CACrB,EAED,cAAc,EAAE,yBAAyB,CACvC,OAAO,EACP,WAAW,EACX,oBAAoB,EACpB,mBAAmB,CACpB,EACD,aAAa,EAAE,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,mBAAmB,CAAC,GAC1E,IAAI;IAoCP,OAAO,CAAC,wBAAwB;IAoChC;;;;OAIG;IACH,IAAI,MAAM,IACN,MAAM,CACJ,aAAa,CAAC,OAAO,CAAC,EACtB,cAAc,CAAC,YAAY,GAAG,cAAc,CAAC,SAAS,CACvD,GACD,SAAS,CAEZ;IACD;;;;;;;;;;;;;;OAcG;IACH,SAAS,CACP,QAAQ,SAAS,cAAc,CAAC,YAAY,GAAG,cAAc,CAAC,SAAS,EAEvE,gBAAgB,EACZ,SAAS;QACP,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC;KACpE,GACD,SAAS;QACP,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC;QACnE,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC;KACpE,EACL,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,cAAc,GACpB,IAAI;CAWR"}
|
|
@@ -3,6 +3,14 @@ import { CriteriaJoinManager } from './criteria-join-manager.js';
|
|
|
3
3
|
import { Cursor } from './cursor.js';
|
|
4
4
|
import { Order, OrderDirection } from './order/order.js';
|
|
5
5
|
import { FilterOperator } from './types/operator.types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Abstract base class for constructing query criteria.
|
|
8
|
+
* It provides a fluent API for defining filters, joins, selections, ordering, and pagination.
|
|
9
|
+
* Concrete criteria types (e.g., RootCriteria, JoinCriteria) will extend this class.
|
|
10
|
+
*
|
|
11
|
+
* @template TSchema - The schema definition for the entity this criteria operates on.
|
|
12
|
+
* @template CurrentAlias - The selected alias for the entity from its schema.
|
|
13
|
+
*/
|
|
6
14
|
export class Criteria {
|
|
7
15
|
schema;
|
|
8
16
|
_alias;
|
|
@@ -10,9 +18,25 @@ export class Criteria {
|
|
|
10
18
|
_joinManager = new CriteriaJoinManager();
|
|
11
19
|
_source_name;
|
|
12
20
|
_take = 0; // 0 = no limit
|
|
21
|
+
/**
|
|
22
|
+
* Stores the set of fields explicitly selected by the user.
|
|
23
|
+
* This is used when `_selectAll` is false.
|
|
24
|
+
* @protected
|
|
25
|
+
*/
|
|
13
26
|
_select = new Set([]);
|
|
14
27
|
_selectAll = true;
|
|
28
|
+
/**
|
|
29
|
+
* Stores the cursor configuration for pagination, if set.
|
|
30
|
+
* @protected
|
|
31
|
+
*/
|
|
15
32
|
_cursor;
|
|
33
|
+
/**
|
|
34
|
+
* Initializes a new instance of the Criteria class.
|
|
35
|
+
* @param {TSchema} schema - The schema definition for the entity.
|
|
36
|
+
* @param {CurrentAlias} _alias - The alias to use for this entity in the query.
|
|
37
|
+
* @throws {Error} If the provided alias is not supported by the schema.
|
|
38
|
+
* @protected
|
|
39
|
+
*/
|
|
16
40
|
constructor(schema, _alias) {
|
|
17
41
|
this.schema = schema;
|
|
18
42
|
this._alias = _alias;
|
|
@@ -20,20 +44,43 @@ export class Criteria {
|
|
|
20
44
|
throw new Error(`Unsupported alia ${this._alias} for schema ${schema.source_name}`);
|
|
21
45
|
this._source_name = schema.source_name;
|
|
22
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Gets the currently selected fields.
|
|
49
|
+
* If `_selectAll` is true, it returns all fields from the schema.
|
|
50
|
+
* Otherwise, it returns the fields explicitly set via `setSelect`.
|
|
51
|
+
* @returns {Array<FieldOfSchema<TSchema>>} An array of selected field names.
|
|
52
|
+
*/
|
|
23
53
|
get select() {
|
|
24
54
|
if (this._selectAll) {
|
|
25
55
|
return [...this.schema.fields];
|
|
26
56
|
}
|
|
27
57
|
return Array.from(this._select);
|
|
28
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Resets the selection to include all fields from the schema.
|
|
61
|
+
* Subsequent calls to `get select()` will return all schema fields
|
|
62
|
+
* until `setSelect()` is called again.
|
|
63
|
+
* @returns {this} The current criteria instance for chaining.
|
|
64
|
+
*/
|
|
29
65
|
resetSelect() {
|
|
30
66
|
this._selectAll = true;
|
|
31
67
|
this._select.clear();
|
|
32
68
|
return this;
|
|
33
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Indicates whether all fields are currently configured to be selected.
|
|
72
|
+
* @returns {boolean} True if all fields are selected, false if specific fields are selected.
|
|
73
|
+
*/
|
|
34
74
|
get selectAll() {
|
|
35
75
|
return this._selectAll;
|
|
36
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Specifies which fields to select for the entity.
|
|
79
|
+
* Calling this method sets `selectAll` to false.
|
|
80
|
+
* @param {Array<FieldOfSchema<TSchema>>} selectFields - An array of field names to select.
|
|
81
|
+
* @returns {this} The current criteria instance for chaining.
|
|
82
|
+
* @throws {Error} If any of the specified fields are not defined in the schema.
|
|
83
|
+
*/
|
|
37
84
|
setSelect(selectFields) {
|
|
38
85
|
for (const field of selectFields) {
|
|
39
86
|
this.assetFieldOnSchema(field);
|
|
@@ -44,29 +91,63 @@ export class Criteria {
|
|
|
44
91
|
}
|
|
45
92
|
return this;
|
|
46
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Gets the maximum number of records to return (LIMIT).
|
|
96
|
+
* @returns {number} The take value.
|
|
97
|
+
*/
|
|
47
98
|
get take() {
|
|
48
99
|
return this._take;
|
|
49
100
|
}
|
|
50
101
|
_skip = 0;
|
|
102
|
+
/**
|
|
103
|
+
* Gets the number of records to skip (OFFSET).
|
|
104
|
+
* @returns {number} The skip value.
|
|
105
|
+
*/
|
|
51
106
|
get skip() {
|
|
52
107
|
return this._skip;
|
|
53
108
|
}
|
|
54
109
|
_orders = [];
|
|
110
|
+
/**
|
|
111
|
+
* Gets the current ordering rules applied to this criteria.
|
|
112
|
+
* @returns {ReadonlyArray<Order<FieldOfSchema<TSchema>>>} A readonly array of order objects.
|
|
113
|
+
*/
|
|
55
114
|
get orders() {
|
|
56
115
|
return [...this._orders];
|
|
57
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Gets the configured join details for this criteria.
|
|
119
|
+
* @returns {ReadonlyArray<StoredJoinDetails<TSchema>>} A readonly array of join configurations.
|
|
120
|
+
*/
|
|
58
121
|
get joins() {
|
|
59
122
|
return [...this._joinManager.getJoins()];
|
|
60
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Gets the root filter group for this criteria, which holds all filter conditions.
|
|
126
|
+
* @returns {FilterGroup} The root filter group.
|
|
127
|
+
*/
|
|
61
128
|
get rootFilterGroup() {
|
|
62
129
|
return this._filterManager.getRootFilterGroup();
|
|
63
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Gets the source name (e.g., table name) for the entity of this criteria.
|
|
133
|
+
* @returns {TSchema['source_name']} The source name string.
|
|
134
|
+
*/
|
|
64
135
|
get sourceName() {
|
|
65
136
|
return this._source_name;
|
|
66
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Gets the alias used for the entity of this criteria.
|
|
140
|
+
* @returns {CurrentAlias} The alias string.
|
|
141
|
+
*/
|
|
67
142
|
get alias() {
|
|
68
143
|
return this._alias;
|
|
69
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Sets the maximum number of records to return (LIMIT).
|
|
147
|
+
* @param {number} amount - The number of records to take. Must be non-negative.
|
|
148
|
+
* @returns {this} The current criteria instance for chaining.
|
|
149
|
+
* @throws {Error} If the amount is negative.
|
|
150
|
+
*/
|
|
70
151
|
setTake(amount) {
|
|
71
152
|
if (amount < 0) {
|
|
72
153
|
throw new Error(`Take value cant be negative`);
|
|
@@ -74,6 +155,12 @@ export class Criteria {
|
|
|
74
155
|
this._take = amount;
|
|
75
156
|
return this;
|
|
76
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Sets the number of records to skip before starting to return records (OFFSET).
|
|
160
|
+
* @param {number} amount - The number of records to skip. Must be non-negative.
|
|
161
|
+
* @returns {this} The current criteria instance for chaining.
|
|
162
|
+
* @throws {Error} If the amount is negative.
|
|
163
|
+
*/
|
|
77
164
|
setSkip(amount) {
|
|
78
165
|
if (amount < 0) {
|
|
79
166
|
throw new Error(`Skip value cant be negative`);
|
|
@@ -94,26 +181,80 @@ export class Criteria {
|
|
|
94
181
|
if (!this.schema.fields.includes(field))
|
|
95
182
|
throw new Error(`The field '${String(field)}' is not defined in the schema '${this.schema.source_name}'.`);
|
|
96
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Adds an ordering rule to the criteria.
|
|
186
|
+
* Multiple calls will append new ordering rules.
|
|
187
|
+
* @param {FieldOfSchema<TSchema>} field - The field to order by.
|
|
188
|
+
* @param {OrderDirection} direction - The direction of the ordering (ASC or DESC).
|
|
189
|
+
* @returns {this} The current criteria instance for chaining.
|
|
190
|
+
* @throws {Error} If the specified field is not defined in the schema.
|
|
191
|
+
*/
|
|
97
192
|
orderBy(field, direction) {
|
|
98
193
|
this.assetFieldOnSchema(field);
|
|
99
194
|
this._orders.push(new Order(direction, field));
|
|
100
195
|
return this;
|
|
101
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Initializes the filter criteria with a single filter primitive.
|
|
199
|
+
* This replaces any existing filters in the root filter group.
|
|
200
|
+
* @template Operator - The specific filter operator type.
|
|
201
|
+
* @param {FilterPrimitive<FieldOfSchema<TSchema>, Operator>} filterPrimitive - The filter to apply.
|
|
202
|
+
* @returns {this} The current criteria instance for chaining.
|
|
203
|
+
* @throws {Error} If the specified field in filterPrimitive is not defined in the schema.
|
|
204
|
+
*/
|
|
102
205
|
where(filterPrimitive) {
|
|
103
206
|
this.assetFieldOnSchema(filterPrimitive.field);
|
|
104
207
|
this._filterManager.where(filterPrimitive);
|
|
105
208
|
return this;
|
|
106
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Adds a filter primitive to the current filter group using an AND logical operator.
|
|
212
|
+
* Requires `where()` to have been called first to initialize the filter group.
|
|
213
|
+
* @template Operator - The specific filter operator type.
|
|
214
|
+
* @param {FilterPrimitive<FieldOfSchema<TSchema>, Operator>} filterPrimitive - The filter to add.
|
|
215
|
+
* @returns {this} The current criteria instance for chaining.
|
|
216
|
+
* @throws {Error} If the specified field in filterPrimitive is not defined in the schema.
|
|
217
|
+
* @throws {Error} If `where()` has not been called first.
|
|
218
|
+
*/
|
|
107
219
|
andWhere(filterPrimitive) {
|
|
108
220
|
this.assetFieldOnSchema(filterPrimitive.field);
|
|
109
221
|
this._filterManager.andWhere(filterPrimitive);
|
|
110
222
|
return this;
|
|
111
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Adds a filter primitive to the current filter group using an OR logical operator.
|
|
226
|
+
* Requires `where()` to have been called first to initialize the filter group.
|
|
227
|
+
* @template Operator - The specific filter operator type.
|
|
228
|
+
* @param {FilterPrimitive<FieldOfSchema<TSchema>, Operator>} filterPrimitive - The filter to add.
|
|
229
|
+
* @returns {this} The current criteria instance for chaining.
|
|
230
|
+
* @throws {Error} If the specified field in filterPrimitive is not defined in the schema.
|
|
231
|
+
* @throws {Error} If `where()` has not been called first.
|
|
232
|
+
*/
|
|
112
233
|
orWhere(filterPrimitive) {
|
|
113
234
|
this.assetFieldOnSchema(filterPrimitive.field);
|
|
114
235
|
this._filterManager.orWhere(filterPrimitive);
|
|
115
236
|
return this;
|
|
116
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Adds a join to another criteria.
|
|
240
|
+
* @template TJoinSchema - The schema of the entity to join.
|
|
241
|
+
* @template TJoinedCriteriaAlias - The alias for the joined entity.
|
|
242
|
+
* @template TMatchingJoinConfig - The specific join configuration from the parent schema that matches the joined
|
|
243
|
+
* alias.
|
|
244
|
+
* @param {JoinCriteriaParameterType<TSchema, TJoinSchema, TJoinedCriteriaAlias, TMatchingJoinConfig>} criteriaToJoin
|
|
245
|
+
* The criteria instance representing the entity to join (e.g., `InnerJoinCriteria`, `LeftJoinCriteria`).
|
|
246
|
+
* @param {JoinParameterType<TSchema, TJoinSchema, TMatchingJoinConfig>} joinParameter
|
|
247
|
+
* The parameters defining how the join should be performed (e.g., fields for simple join, pivot table details for
|
|
248
|
+
* many-to-many).
|
|
249
|
+
* @returns {this} The current criteria instance for chaining.
|
|
250
|
+
* @throws {Error} If `criteriaToJoin` is a string (which is invalid).
|
|
251
|
+
* @throws {Error} If `parent_field` in `joinParameter` (or `parent_field.reference` for pivot joins) is not defined
|
|
252
|
+
* in the parent schema.
|
|
253
|
+
* @throws {Error} If the join configuration for the given `criteriaToJoin.alias` is not found in the parent schema's
|
|
254
|
+
* `joins` array.
|
|
255
|
+
* @throws {Error} If `joinParameter` is invalid for the `relation_type` defined in the schema (e.g., using
|
|
256
|
+
* simple join input for many-to-many or vice-versa).
|
|
257
|
+
*/
|
|
117
258
|
join(criteriaToJoin, joinParameter) {
|
|
118
259
|
if (typeof criteriaToJoin === 'string') {
|
|
119
260
|
throw new Error(`Invalid criteriaToJoin: ${criteriaToJoin}`);
|
|
@@ -130,7 +271,10 @@ export class Criteria {
|
|
|
130
271
|
...joinParameter,
|
|
131
272
|
parent_alias: this.alias,
|
|
132
273
|
parent_source_name: this.sourceName,
|
|
133
|
-
|
|
274
|
+
relation_type: joinConfig.relation_type,
|
|
275
|
+
join_metadata: this.schema.joins.find((join) => join.alias === criteriaToJoin.alias)
|
|
276
|
+
?.metadata ?? {},
|
|
277
|
+
parent_schema_metadata: this.schema.metadata ?? {},
|
|
134
278
|
};
|
|
135
279
|
this._joinManager.addJoin(criteriaToJoin, fullJoinParameters);
|
|
136
280
|
return this;
|
|
@@ -142,7 +286,7 @@ export class Criteria {
|
|
|
142
286
|
'pivot_field' in field &&
|
|
143
287
|
'reference' in field);
|
|
144
288
|
};
|
|
145
|
-
if (joinConfig.
|
|
289
|
+
if (joinConfig.relation_type === 'many_to_many') {
|
|
146
290
|
if (!isPivotFieldObject(joinParameter.parent_field) ||
|
|
147
291
|
!isPivotFieldObject(joinParameter.join_field)) {
|
|
148
292
|
throw new Error(`Invalid JoinOptions for 'many_to_many' join. Expected parent_field and join_field to be objects with 'pivot_field' and 'reference' properties. Alias: '${String(joinConfig.alias)}'`);
|
|
@@ -151,13 +295,33 @@ export class Criteria {
|
|
|
151
295
|
else {
|
|
152
296
|
if (typeof joinParameter.parent_field !== 'string' ||
|
|
153
297
|
typeof joinParameter.join_field !== 'string') {
|
|
154
|
-
throw new Error(`Invalid JoinOptions for '${joinConfig.
|
|
298
|
+
throw new Error(`Invalid JoinOptions for '${joinConfig.relation_type}' join. Expected parent_field and join_field to be strings. Alias: '${String(joinConfig.alias)}'`);
|
|
155
299
|
}
|
|
156
300
|
}
|
|
157
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Gets the current cursor configuration, if set.
|
|
304
|
+
* @returns {Cursor<FieldOfSchema<TSchema>, FilterOperator.GREATER_THAN | FilterOperator.LESS_THAN> | undefined}
|
|
305
|
+
* The cursor object or undefined.
|
|
306
|
+
*/
|
|
158
307
|
get cursor() {
|
|
159
308
|
return this._cursor;
|
|
160
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Sets the cursor for pagination.
|
|
312
|
+
* @template Operator - The specific comparison operator for the cursor.
|
|
313
|
+
* @param {readonly [Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>] | readonly
|
|
314
|
+
* [Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>,
|
|
315
|
+
* Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>]} filterPrimitives - An array of one or two
|
|
316
|
+
* filter primitives defining the cursor's fields and values.
|
|
317
|
+
* @param {Operator} operator - The comparison operator (GREATER_THAN or LESS_THAN).
|
|
318
|
+
* @param {OrderDirection} order - The primary order direction for pagination.
|
|
319
|
+
* @returns {this} The current criteria instance for chaining.
|
|
320
|
+
* @throws {Error} If filterPrimitives does not contain exactly 1 or 2 elements.
|
|
321
|
+
* @throws {Error} If any cursor field is not defined in the schema.
|
|
322
|
+
* @throws {Error} If any cursor value is undefined (null is allowed, per Cursor constructor).
|
|
323
|
+
* @throws {Error} If two cursor fields are provided and they are identical (per Cursor constructor).
|
|
324
|
+
*/
|
|
161
325
|
setCursor(filterPrimitives, operator, order) {
|
|
162
326
|
if (filterPrimitives.length !== 1 && filterPrimitives.length !== 2) {
|
|
163
327
|
throw new Error('The cursor must have exactly 1 or 2 elements');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"criteria.js","sourceRoot":"","sources":["../../src/criteria/criteria.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"criteria.js","sourceRoot":"","sources":["../../src/criteria/criteria.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AASzD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQ3D;;;;;;;GAOG;AACH,MAAM,OAAgB,QAAQ;IAkCP;IACT;IA9BK,cAAc,GAAG,IAAI,qBAAqB,EAAW,CAAC;IACtD,YAAY,GAAG,IAAI,mBAAmB,EAAW,CAAC;IAClD,YAAY,CAAyB;IAC9C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C,OAAO,GAAG,IAAI,MAAM,CAAC,gBAAgB,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
package/dist/criteria/cursor.js
CHANGED
|
@@ -40,8 +40,8 @@ export class Cursor {
|
|
|
40
40
|
if (!filter.field) {
|
|
41
41
|
throw new Error('Cursor field must be defined');
|
|
42
42
|
}
|
|
43
|
-
if (filter.value === undefined
|
|
44
|
-
throw new Error(`Cursor value for field ${filter.field} must be defined`);
|
|
43
|
+
if (filter.value === undefined) {
|
|
44
|
+
throw new Error(`Cursor value for field ${String(filter.field)} must be explicitly defined (can be null, but not undefined)`);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
if (filterPrimitive.length === 2 &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../src/criteria/cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D;;;;;;;GAOG;AACH,MAAM,OAAO,MAAM;IAIjB;;;;;OAKG;IACM,OAAO,CAEgB;IAChC;;;;OAIG;IACM,KAAK,CAAiB;IAC/B;;;;;;;;;;;OAWG;IACH,YACE,eAKmE,EACnE,QAAkB,EAClB,KAAqB;QAErB,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;YACrC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBAClB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;YAClD,CAAC;YACD,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../src/criteria/cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MA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class InnerJoinCriteria<CSchema extends CriteriaSchema, Alias ext
|
|
|
22
22
|
* @returns {TranslationOutput} The result of the visitor processing this join.
|
|
23
23
|
*/
|
|
24
24
|
accept<TranslationContext, TranslationOutput>(visitor: ICriteriaVisitor<TranslationContext, TranslationOutput>, parameters: PivotJoin<CriteriaSchema, CSchema, JoinRelationType> | SimpleJoin<CriteriaSchema, CSchema, JoinRelationType>, context: TranslationContext): TranslationOutput;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a new instance of `RootCriteria` with the same schema and alias configuration,
|
|
27
|
+
* but with all other states (filters, joins, ordering, pagination, selection) reset to their defaults.
|
|
28
|
+
* @returns {InnerJoinCriteria<CSchema, Alias>} A new, reset `RootCriteria` instance.
|
|
29
|
+
*/
|
|
25
30
|
resetCriteria(): InnerJoinCriteria<CSchema, Alias>;
|
|
26
31
|
}
|
|
27
32
|
//# sourceMappingURL=inner.join-criteria.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inner.join-criteria.d.ts","sourceRoot":"","sources":["../../../src/criteria/join/inner.join-criteria.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAE5E;;;;;GAKG;AACH,qBAAa,iBAAiB,CAC5B,OAAO,SAAS,cAAc,EAC9B,KAAK,SAAS,eAAe,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,CACjE,SAAQ,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IAChC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,EAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,EAChE,UAAU,EACN,SAAS,CAAC,cAAc,EAAE,OAAO,EAAE,gBAAgB,CAAC,GACpD,UAAU,CAAC,cAAc,EAAE,OAAO,EAAE,gBAAgB,CAAC,EACzD,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB;
|
|
1
|
+
{"version":3,"file":"inner.join-criteria.d.ts","sourceRoot":"","sources":["../../../src/criteria/join/inner.join-criteria.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAE5E;;;;;GAKG;AACH,qBAAa,iBAAiB,CAC5B,OAAO,SAAS,cAAc,EAC9B,KAAK,SAAS,eAAe,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,CACjE,SAAQ,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IAChC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,EAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,EAChE,UAAU,EACN,SAAS,CAAC,cAAc,EAAE,OAAO,EAAE,gBAAgB,CAAC,GACpD,UAAU,CAAC,cAAc,EAAE,OAAO,EAAE,gBAAgB,CAAC,EACzD,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB;IAOpB;;;;OAIG;IACH,aAAa,IAAI,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC;CAGnD"}
|
|
@@ -24,6 +24,11 @@ export class InnerJoinCriteria extends Criteria {
|
|
|
24
24
|
: this.assetFieldOnSchema(parameters.join_field);
|
|
25
25
|
return visitor.visitInnerJoin(this, parameters, context);
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns a new instance of `RootCriteria` with the same schema and alias configuration,
|
|
29
|
+
* but with all other states (filters, joins, ordering, pagination, selection) reset to their defaults.
|
|
30
|
+
* @returns {InnerJoinCriteria<CSchema, Alias>} A new, reset `RootCriteria` instance.
|
|
31
|
+
*/
|
|
27
32
|
resetCriteria() {
|
|
28
33
|
return new InnerJoinCriteria(this.schema, this._alias);
|
|
29
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inner.join-criteria.js","sourceRoot":"","sources":["../../../src/criteria/join/inner.join-criteria.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C;;;;;GAKG;AACH,MAAM,OAAO,iBAGX,SAAQ,QAAwB;IAChC;;;;;;;;;;;OAWG;IACH,MAAM,CACJ,OAAgE,EAChE,UAEyD,EACzD,OAA2B;QAE3B,OAAO,UAAU,CAAC,UAAU,KAAK,QAAQ;YACvC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC;YAC1D,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAEnD,OAAO,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;
|
|
1
|
+
{"version":3,"file":"inner.join-criteria.js","sourceRoot":"","sources":["../../../src/criteria/join/inner.join-criteria.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C;;;;;GAKG;AACH,MAAM,OAAO,iBAGX,SAAQ,QAAwB;IAChC;;;;;;;;;;;OAWG;IACH,MAAM,CACJ,OAAgE,EAChE,UAEyD,EACzD,OAA2B;QAE3B,OAAO,UAAU,CAAC,UAAU,KAAK,QAAQ;YACvC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC;YAC1D,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAEnD,OAAO,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IACD;;;;OAIG;IACH,aAAa;QACX,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -21,6 +21,11 @@ export declare class LeftJoinCriteria<CSchema extends CriteriaSchema, Alias exte
|
|
|
21
21
|
* @returns {TranslationOutput} The result of the visitor processing this join.
|
|
22
22
|
*/
|
|
23
23
|
accept<TranslationContext, TranslationOutput>(visitor: ICriteriaVisitor<TranslationContext, TranslationOutput>, parameters: PivotJoin<CriteriaSchema, CSchema, JoinRelationType> | SimpleJoin<CriteriaSchema, CSchema, JoinRelationType>, context: TranslationContext): TranslationOutput;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a new instance of `RootCriteria` with the same schema and alias configuration,
|
|
26
|
+
* but with all other states (filters, joins, ordering, pagination, selection) reset to their defaults.
|
|
27
|
+
* @returns {LeftJoinCriteria<CSchema, Alias>} A new, reset `RootCriteria` instance.
|
|
28
|
+
*/
|
|
24
29
|
resetCriteria(): LeftJoinCriteria<CSchema, Alias>;
|
|
25
30
|
}
|
|
26
31
|
//# sourceMappingURL=left.join-criteria.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"left.join-criteria.d.ts","sourceRoot":"","sources":["../../../src/criteria/join/left.join-criteria.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM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;;;;;OAUG;IACH,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,EAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,EAChE,UAAU,EACN,SAAS,CAAC,cAAc,EAAE,OAAO,EAAE,gBAAgB,CAAC,GACpD,UAAU,CAAC,cAAc,EAAE,OAAO,EAAE,gBAAgB,CAAC,EACzD,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB;IAOpB;;;;OAIG;IACH,aAAa,IAAI,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC;CAGlD"}
|
|
@@ -23,6 +23,11 @@ export class LeftJoinCriteria extends Criteria {
|
|
|
23
23
|
: this.assetFieldOnSchema(parameters.join_field);
|
|
24
24
|
return visitor.visitLeftJoin(this, parameters, context);
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns a new instance of `RootCriteria` with the same schema and alias configuration,
|
|
28
|
+
* but with all other states (filters, joins, ordering, pagination, selection) reset to their defaults.
|
|
29
|
+
* @returns {LeftJoinCriteria<CSchema, Alias>} A new, reset `RootCriteria` instance.
|
|
30
|
+
*/
|
|
26
31
|
resetCriteria() {
|
|
27
32
|
return new LeftJoinCriteria(this.schema, this._alias);
|
|
28
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"left.join-criteria.js","sourceRoot":"","sources":["../../../src/criteria/join/left.join-criteria.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C;;;;;GAKG;AACH,MAAM,OAAO,gBAGX,SAAQ,QAAwB;IAChC;;;;;;;;;;OAUG;IACH,MAAM,CACJ,OAAgE,EAChE,UAEyD,EACzD,OAA2B;QAE3B,OAAO,UAAU,CAAC,UAAU,KAAK,QAAQ;YACvC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC;YAC1D,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAEnD,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IACD,aAAa;QACX,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"left.join-criteria.js","sourceRoot":"","sources":["../../../src/criteria/join/left.join-criteria.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C;;;;;GAKG;AACH,MAAM,OAAO,gBAGX,SAAQ,QAAwB;IAChC;;;;;;;;;;OAUG;IACH,MAAM,CACJ,OAAgE,EAChE,UAEyD,EACzD,OAA2B;QAE3B,OAAO,UAAU,CAAC,UAAU,KAAK,QAAQ;YACvC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC;YAC1D,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAEnD,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IACD;;;;OAIG;IACH,aAAa;QACX,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;CACF"}
|
|
@@ -22,6 +22,11 @@ export declare class OuterJoinCriteria<CSchema extends CriteriaSchema, Alias ext
|
|
|
22
22
|
* @returns {TranslationOutput} The result of the visitor processing this join.
|
|
23
23
|
*/
|
|
24
24
|
accept<TranslationContext, TranslationOutput>(visitor: ICriteriaVisitor<TranslationContext, TranslationOutput>, parameters: PivotJoin<CriteriaSchema, CSchema, JoinRelationType> | SimpleJoin<CriteriaSchema, CSchema, JoinRelationType>, context: TranslationContext): TranslationOutput;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a new instance of `RootCriteria` with the same schema and alias configuration,
|
|
27
|
+
* but with all other states (filters, joins, ordering, pagination, selection) reset to their defaults.
|
|
28
|
+
* @returns {OuterJoinCriteria<CSchema, Alias>} A new, reset `RootCriteria` instance.
|
|
29
|
+
*/
|
|
25
30
|
resetCriteria(): OuterJoinCriteria<CSchema, Alias>;
|
|
26
31
|
}
|
|
27
32
|
//# sourceMappingURL=outer.join-criteria.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outer.join-criteria.d.ts","sourceRoot":"","sources":["../../../src/criteria/join/outer.join-criteria.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAE5E;;;;;;GAMG;AACH,qBAAa,iBAAiB,CAC5B,OAAO,SAAS,cAAc,EAC9B,KAAK,SAAS,eAAe,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,CACjE,SAAQ,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IAChC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,EAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,EAChE,UAAU,EACN,SAAS,CAAC,cAAc,EAAE,OAAO,EAAE,gBAAgB,CAAC,GACpD,UAAU,CAAC,cAAc,EAAE,OAAO,EAAE,gBAAgB,CAAC,EACzD,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB;IAMpB,aAAa,IAAI,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC;CAGnD"}
|
|
1
|
+
{"version":3,"file":"outer.join-criteria.d.ts","sourceRoot":"","sources":["../../../src/criteria/join/outer.join-criteria.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAE5E;;;;;;GAMG;AACH,qBAAa,iBAAiB,CAC5B,OAAO,SAAS,cAAc,EAC9B,KAAK,SAAS,eAAe,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,CACjE,SAAQ,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IAChC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,EAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,EAChE,UAAU,EACN,SAAS,CAAC,cAAc,EAAE,OAAO,EAAE,gBAAgB,CAAC,GACpD,UAAU,CAAC,cAAc,EAAE,OAAO,EAAE,gBAAgB,CAAC,EACzD,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB;IAMpB;;;;OAIG;IACH,aAAa,IAAI,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC;CAGnD"}
|
|
@@ -24,6 +24,11 @@ export class OuterJoinCriteria extends Criteria {
|
|
|
24
24
|
: this.assetFieldOnSchema(parameters.join_field);
|
|
25
25
|
return visitor.visitOuterJoin(this, parameters, context);
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns a new instance of `RootCriteria` with the same schema and alias configuration,
|
|
29
|
+
* but with all other states (filters, joins, ordering, pagination, selection) reset to their defaults.
|
|
30
|
+
* @returns {OuterJoinCriteria<CSchema, Alias>} A new, reset `RootCriteria` instance.
|
|
31
|
+
*/
|
|
27
32
|
resetCriteria() {
|
|
28
33
|
return new OuterJoinCriteria(this.schema, this._alias);
|
|
29
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outer.join-criteria.js","sourceRoot":"","sources":["../../../src/criteria/join/outer.join-criteria.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C;;;;;;GAMG;AACH,MAAM,OAAO,iBAGX,SAAQ,QAAwB;IAChC;;;;;;;;;;OAUG;IACH,MAAM,CACJ,OAAgE,EAChE,UAEyD,EACzD,OAA2B;QAE3B,OAAO,UAAU,CAAC,UAAU,KAAK,QAAQ;YACvC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC;YAC1D,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACnD,OAAO,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IACD,aAAa;QACX,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"outer.join-criteria.js","sourceRoot":"","sources":["../../../src/criteria/join/outer.join-criteria.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C;;;;;;GAMG;AACH,MAAM,OAAO,iBAGX,SAAQ,QAAwB;IAChC;;;;;;;;;;OAUG;IACH,MAAM,CACJ,OAAgE,EAChE,UAEyD,EACzD,OAA2B;QAE3B,OAAO,UAAU,CAAC,UAAU,KAAK,QAAQ;YACvC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC;YAC1D,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACnD,OAAO,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IACD;;;;OAIG;IACH,aAAa;QACX,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -23,6 +23,11 @@ export declare class RootCriteria<CSchema extends CriteriaSchema, Alias extends
|
|
|
23
23
|
* @returns {TranslationOutput} The result of the visitor processing this root criteria and its components.
|
|
24
24
|
*/
|
|
25
25
|
accept<TranslationContext, TranslationOutput>(visitor: ICriteriaVisitor<TranslationContext, TranslationOutput>, context: TranslationContext): TranslationOutput;
|
|
26
|
+
/**
|
|
27
|
+
* Returns a new instance of `RootCriteria` with the same schema and alias configuration,
|
|
28
|
+
* but with all other states (filters, joins, ordering, pagination, selection) reset to their defaults.
|
|
29
|
+
* @returns {RootCriteria<CSchema, Alias>} A new, reset `RootCriteria` instance.
|
|
30
|
+
*/
|
|
26
31
|
resetCriteria(): RootCriteria<CSchema, Alias>;
|
|
27
32
|
}
|
|
28
33
|
//# sourceMappingURL=root.criteria.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.criteria.d.ts","sourceRoot":"","sources":["../../src/criteria/root.criteria.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E;;;;;;GAMG;AACH,qBAAa,YAAY,CACvB,OAAO,SAAS,cAAc,EAC9B,KAAK,SAAS,eAAe,CAAC,OAAO,CAAC,CACtC,SAAQ,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IAChC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,EAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,EAChE,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB;IAGpB,aAAa,IAAI,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;CAG9C"}
|
|
1
|
+
{"version":3,"file":"root.criteria.d.ts","sourceRoot":"","sources":["../../src/criteria/root.criteria.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E;;;;;;GAMG;AACH,qBAAa,YAAY,CACvB,OAAO,SAAS,cAAc,EAC9B,KAAK,SAAS,eAAe,CAAC,OAAO,CAAC,CACtC,SAAQ,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IAChC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,EAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,EAChE,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB;IAGpB;;;;OAIG;IACH,aAAa,IAAI,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;CAG9C"}
|
|
@@ -23,6 +23,11 @@ export class RootCriteria extends Criteria {
|
|
|
23
23
|
accept(visitor, context) {
|
|
24
24
|
return visitor.visitRoot(this, context);
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns a new instance of `RootCriteria` with the same schema and alias configuration,
|
|
28
|
+
* but with all other states (filters, joins, ordering, pagination, selection) reset to their defaults.
|
|
29
|
+
* @returns {RootCriteria<CSchema, Alias>} A new, reset `RootCriteria` instance.
|
|
30
|
+
*/
|
|
26
31
|
resetCriteria() {
|
|
27
32
|
return new RootCriteria(this.schema, this._alias);
|
|
28
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.criteria.js","sourceRoot":"","sources":["../../src/criteria/root.criteria.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC;;;;;;GAMG;AACH,MAAM,OAAO,YAGX,SAAQ,QAAwB;IAChC;;;;;;;;;;;;OAYG;IACH,MAAM,CACJ,OAAgE,EAChE,OAA2B;QAE3B,OAAO,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IACD,aAAa;QACX,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"root.criteria.js","sourceRoot":"","sources":["../../src/criteria/root.criteria.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC;;;;;;GAMG;AACH,MAAM,OAAO,YAGX,SAAQ,QAAwB;IAChC;;;;;;;;;;;;OAYG;IACH,MAAM,CACJ,OAAgE,EAChE,OAA2B;QAE3B,OAAO,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IACD;;;;OAIG;IACH,aAAa;QACX,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;CACF"}
|
|
@@ -16,9 +16,13 @@ export interface ICriteriaBase<TSchema extends CriteriaSchema, CurrentAlias exte
|
|
|
16
16
|
* Configures the criteria to select all available fields from the root entity
|
|
17
17
|
* and any joined entities that also have `selectAll()` called or by default.
|
|
18
18
|
* This overrides any previous specific selections made by `setSelect()`.
|
|
19
|
-
* @returns {
|
|
19
|
+
* @returns {this} The current criteria instance for chaining.
|
|
20
|
+
*/
|
|
21
|
+
resetSelect(): this;
|
|
22
|
+
/**
|
|
23
|
+
* Indicates whether all fields are currently selected for the root entity.
|
|
24
|
+
* @returns {boolean} True if all fields are selected, false otherwise.
|
|
20
25
|
*/
|
|
21
|
-
resetSelect(): ICriteriaBase<TSchema, CurrentAlias>;
|
|
22
26
|
get selectAll(): boolean;
|
|
23
27
|
/**
|
|
24
28
|
* Sets the cursor for pagination. A cursor defines a point from which to fetch
|
|
@@ -35,10 +39,10 @@ export interface ICriteriaBase<TSchema extends CriteriaSchema, CurrentAlias exte
|
|
|
35
39
|
* @param {OrderDirection} order - The direction of ordering that matches the cursor logic.
|
|
36
40
|
* If operator is GREATER_THAN, order should typically be ASC.
|
|
37
41
|
* If operator is LESS_THAN, order should typically be DESC.
|
|
38
|
-
* @returns {
|
|
42
|
+
* @returns {this} The current criteria instance for chaining.
|
|
39
43
|
* @throws {Error} If filterPrimitive does not contain exactly 1 or 2 elements.
|
|
40
44
|
* @throws {Error} If any cursor field is not defined in the schema.
|
|
41
|
-
* @throws {Error} If any cursor value is null
|
|
45
|
+
* @throws {Error} If any cursor value is undefined (null is allowed).
|
|
42
46
|
* @throws {Error} If the two cursor fields are identical.
|
|
43
47
|
*/
|
|
44
48
|
setCursor<Operator extends FilterOperator.GREATER_THAN | FilterOperator.LESS_THAN>(filterPrimitives: readonly [
|
|
@@ -46,8 +50,7 @@ export interface ICriteriaBase<TSchema extends CriteriaSchema, CurrentAlias exte
|
|
|
46
50
|
] | readonly [
|
|
47
51
|
Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>,
|
|
48
52
|
Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>
|
|
49
|
-
], operator: Operator, order: OrderDirection):
|
|
50
|
-
resetCriteria(): ICriteriaBase<TSchema, CurrentAlias>;
|
|
53
|
+
], operator: Operator, order: OrderDirection): this;
|
|
51
54
|
/**
|
|
52
55
|
* Gets the current cursor configuration, if set.
|
|
53
56
|
* @returns {Cursor<FieldOfSchema<TSchema>> | undefined} The cursor object or undefined.
|
|
@@ -57,10 +60,10 @@ export interface ICriteriaBase<TSchema extends CriteriaSchema, CurrentAlias exte
|
|
|
57
60
|
* Specifies which fields to select for the root entity.
|
|
58
61
|
* Calling this method disables `selectAll()` behavior.
|
|
59
62
|
* @param {Array<FieldOfSchema<TSchema>>} selectFields - An array of field names to select.
|
|
60
|
-
* @returns {
|
|
63
|
+
* @returns {this} The current criteria instance for chaining.
|
|
61
64
|
* @throws {Error} If any of the specified fields are not defined in the schema.
|
|
62
65
|
*/
|
|
63
|
-
setSelect(selectFields: Array<FieldOfSchema<TSchema>>):
|
|
66
|
+
setSelect(selectFields: Array<FieldOfSchema<TSchema>>): this;
|
|
64
67
|
/**
|
|
65
68
|
* Gets the currently selected fields. If `selectAll()` was last called or is default,
|
|
66
69
|
* it returns all fields from the schema.
|
|
@@ -72,24 +75,24 @@ export interface ICriteriaBase<TSchema extends CriteriaSchema, CurrentAlias exte
|
|
|
72
75
|
* Multiple calls to `orderBy` will append new ordering rules.
|
|
73
76
|
* @param {FieldOfSchema<TSchema>} field - The field to order by.
|
|
74
77
|
* @param {OrderDirection} direction - The direction of the ordering (ASC or DESC).
|
|
75
|
-
* @returns {
|
|
78
|
+
* @returns {this} The current criteria instance for chaining.
|
|
76
79
|
* @throws {Error} If the specified field is not defined in the schema.
|
|
77
80
|
*/
|
|
78
|
-
orderBy(field: FieldOfSchema<TSchema>, direction: OrderDirection):
|
|
81
|
+
orderBy(field: FieldOfSchema<TSchema>, direction: OrderDirection): this;
|
|
79
82
|
/**
|
|
80
83
|
* Sets the maximum number of records to return (LIMIT).
|
|
81
84
|
* @param {number} amount - The number of records to take. Must be non-negative.
|
|
82
|
-
* @returns {
|
|
85
|
+
* @returns {this} The current criteria instance for chaining.
|
|
83
86
|
* @throws {Error} If the amount is negative.
|
|
84
87
|
*/
|
|
85
|
-
setTake(amount: number):
|
|
88
|
+
setTake(amount: number): this;
|
|
86
89
|
/**
|
|
87
90
|
* Sets the number of records to skip before starting to return records (OFFSET).
|
|
88
91
|
* @param {number} amount - The number of records to skip. Must be non-negative.
|
|
89
|
-
* @returns {
|
|
92
|
+
* @returns {this} The current criteria instance for chaining.
|
|
90
93
|
* @throws {Error} If the amount is negative.
|
|
91
94
|
*/
|
|
92
|
-
setSkip(amount: number):
|
|
95
|
+
setSkip(amount: number): this;
|
|
93
96
|
/**
|
|
94
97
|
* Gets the configured join details.
|
|
95
98
|
* @returns {ReadonlyArray<StoredJoinDetails<TSchema>>} An array of join configurations.
|
|
@@ -129,26 +132,26 @@ export interface ICriteriaBase<TSchema extends CriteriaSchema, CurrentAlias exte
|
|
|
129
132
|
* Initializes the filter criteria with a single filter primitive.
|
|
130
133
|
* This replaces any existing filters.
|
|
131
134
|
* @param {FilterPrimitive<FieldOfSchema<TSchema>>} filterPrimitive - The filter to apply.
|
|
132
|
-
* @returns {
|
|
135
|
+
* @returns {this} The current criteria instance for chaining.
|
|
133
136
|
* @throws {Error} If the specified field in filterPrimitive is not defined in the schema.
|
|
134
137
|
*/
|
|
135
|
-
where<Operator extends FilterOperator>(filterPrimitive: FilterPrimitive<FieldOfSchema<TSchema>, Operator>):
|
|
138
|
+
where<Operator extends FilterOperator>(filterPrimitive: FilterPrimitive<FieldOfSchema<TSchema>, Operator>): this;
|
|
136
139
|
/**
|
|
137
140
|
* Adds a filter primitive to the current filter group using an AND logical operator.
|
|
138
141
|
* @param {FilterPrimitive<FieldOfSchema<TSchema>>} filterPrimitive - The filter to add.
|
|
139
|
-
* @returns {
|
|
142
|
+
* @returns {this} The current criteria instance for chaining.
|
|
140
143
|
* @throws {Error} If the specified field in filterPrimitive is not defined in the schema.
|
|
141
144
|
* @throws {Error} If `where()` has not been called first.
|
|
142
145
|
*/
|
|
143
|
-
andWhere<Operator extends FilterOperator>(filterPrimitive: FilterPrimitive<FieldOfSchema<TSchema>, Operator>):
|
|
146
|
+
andWhere<Operator extends FilterOperator>(filterPrimitive: FilterPrimitive<FieldOfSchema<TSchema>, Operator>): this;
|
|
144
147
|
/**
|
|
145
148
|
* Adds a filter primitive, creating a new OR group with the existing filters.
|
|
146
149
|
* @param {FilterPrimitive<FieldOfSchema<TSchema>>} filterPrimitive - The filter to add.
|
|
147
|
-
* @returns {
|
|
150
|
+
* @returns {this} The current criteria instance for chaining.
|
|
148
151
|
* @throws {Error} If the specified field in filterPrimitive is not defined in the schema.
|
|
149
152
|
* @throws {Error} If `where()` has not been called first.
|
|
150
153
|
*/
|
|
151
|
-
orWhere<Operator extends FilterOperator>(filterPrimitive: FilterPrimitive<FieldOfSchema<TSchema>, Operator>):
|
|
154
|
+
orWhere<Operator extends FilterOperator>(filterPrimitive: FilterPrimitive<FieldOfSchema<TSchema>, Operator>): this;
|
|
152
155
|
/**
|
|
153
156
|
* Adds a join to another criteria.
|
|
154
157
|
* @template TJoinSchema - The schema of the entity to join.
|
|
@@ -158,11 +161,11 @@ export interface ICriteriaBase<TSchema extends CriteriaSchema, CurrentAlias exte
|
|
|
158
161
|
* The criteria instance representing the entity to join (e.g., `InnerJoinCriteria`, `LeftJoinCriteria`).
|
|
159
162
|
* @param {JoinParameterType<TSchema, TJoinSchema, TMatchingJoinConfig>} joinParameter
|
|
160
163
|
* The parameters defining how the join should be performed (e.g., fields for simple join, pivot table details for many-to-many).
|
|
161
|
-
* @returns {
|
|
164
|
+
* @returns {this} The current criteria instance for chaining.
|
|
162
165
|
* @throws {Error} If the join configuration for the given alias is not found in the parent schema.
|
|
163
166
|
* @throws {Error} If `parent_field` in `joinParameter` is not defined in the parent schema.
|
|
164
|
-
* @throws {Error} If `joinParameter` is invalid for the `
|
|
167
|
+
* @throws {Error} If `joinParameter` is invalid for the `relation_type` defined in the schema (e.g., using simple join input for many-to-many).
|
|
165
168
|
*/
|
|
166
|
-
join<TJoinSchema extends CriteriaSchema, TJoinedCriteriaAlias extends SelectedAliasOf<TJoinSchema>, TMatchingJoinConfig extends SpecificMatchingJoinConfig<TSchema, TJoinedCriteriaAlias>>(criteriaToJoin: JoinCriteriaParameterType<TSchema, TJoinSchema, TJoinedCriteriaAlias, TMatchingJoinConfig>, joinParameter: JoinParameterType<TSchema, TJoinSchema, TMatchingJoinConfig>):
|
|
169
|
+
join<TJoinSchema extends CriteriaSchema, TJoinedCriteriaAlias extends SelectedAliasOf<TJoinSchema>, TMatchingJoinConfig extends SpecificMatchingJoinConfig<TSchema, TJoinedCriteriaAlias>>(criteriaToJoin: JoinCriteriaParameterType<TSchema, TJoinSchema, TJoinedCriteriaAlias, TMatchingJoinConfig>, joinParameter: JoinParameterType<TSchema, TJoinSchema, TMatchingJoinConfig>): this;
|
|
167
170
|
}
|
|
168
171
|
//# sourceMappingURL=criteria.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"criteria.interface.d.ts","sourceRoot":"","sources":["../../../src/criteria/types/criteria.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,WAAW,aAAa,CAC5B,OAAO,SAAS,cAAc,EAC9B,YAAY,SAAS,eAAe,CAAC,OAAO,CAAC;IAE7C;;;;;OAKG;IACH,WAAW,IAAI,
|
|
1
|
+
{"version":3,"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ACtC,eAAe,EAAE,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,GACjE,IAAI,CAAC;IAER;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,SAAS,cAAc,EACrC,eAAe,EAAE,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,GACjE,IAAI,CAAC;IAER;;;;;;;;;;;;;OAaG;IACH,IAAI,CACF,WAAW,SAAS,cAAc,EAClC,oBAAoB,SAAS,eAAe,CAAC,WAAW,CAAC,EACzD,mBAAmB,SAAS,0BAA0B,CACpD,OAAO,EACP,oBAAoB,CACrB,EAED,cAAc,EAAE,yBAAyB,CACvC,OAAO,EACP,WAAW,EACX,oBAAoB,EACpB,mBAAmB,CACpB,EACD,aAAa,EAAE,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,mBAAmB,CAAC,GAC1E,IAAI,CAAC;CACT"}
|
|
@@ -9,7 +9,7 @@ import type { CriteriaSchema, FieldOfSchema, JoinRelationType } from './schema.t
|
|
|
9
9
|
*/
|
|
10
10
|
export type PivotJoin<ParentSchema extends CriteriaSchema, JoinSchema extends CriteriaSchema, TJoinRelationType extends JoinRelationType> = {
|
|
11
11
|
/** The type of relationship from the parent to the joined entity (e.g., 'many_to_many'). */
|
|
12
|
-
|
|
12
|
+
relation_type: TJoinRelationType;
|
|
13
13
|
/** The source name (e.g., table name) of the parent entity. */
|
|
14
14
|
parent_source_name: ParentSchema['source_name'];
|
|
15
15
|
/** The alias used for the parent entity in the query. */
|
|
@@ -38,6 +38,23 @@ export type PivotJoin<ParentSchema extends CriteriaSchema, JoinSchema extends Cr
|
|
|
38
38
|
*/
|
|
39
39
|
reference: FieldOfSchema<JoinSchema>;
|
|
40
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Optional metadata associated with the parent schema definition.
|
|
43
|
+
* This can be used by translators to store or access additional,
|
|
44
|
+
* schema-specific information relevant to the join.
|
|
45
|
+
*/
|
|
46
|
+
parent_schema_metadata: {
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Optional metadata specifically associated with this join configuration
|
|
51
|
+
* as defined in the parent schema's `joins` array.
|
|
52
|
+
* This can be used by translators to store or access additional,
|
|
53
|
+
* join-specific information.
|
|
54
|
+
*/
|
|
55
|
+
join_metadata: {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
};
|
|
41
58
|
};
|
|
42
59
|
/**
|
|
43
60
|
* Represents the fully resolved parameters for a simple join (one-to-one, one-to-many, many-to-one),
|
|
@@ -49,7 +66,7 @@ export type PivotJoin<ParentSchema extends CriteriaSchema, JoinSchema extends Cr
|
|
|
49
66
|
*/
|
|
50
67
|
export type SimpleJoin<ParentSchema extends CriteriaSchema, JoinSchema extends CriteriaSchema, TJoinRelationType extends JoinRelationType> = {
|
|
51
68
|
/** The type of relationship from the parent to the joined entity (e.g., 'one_to_one', 'many_to_one'). */
|
|
52
|
-
|
|
69
|
+
relation_type: TJoinRelationType;
|
|
53
70
|
/** The source name (e.g., table name) of the parent entity. */
|
|
54
71
|
parent_source_name: ParentSchema['source_name'];
|
|
55
72
|
/** The alias used for the parent entity in the query. */
|
|
@@ -66,5 +83,22 @@ export type SimpleJoin<ParentSchema extends CriteriaSchema, JoinSchema extends C
|
|
|
66
83
|
* @see FieldOfSchema<JoinSchema>
|
|
67
84
|
*/
|
|
68
85
|
join_field: FieldOfSchema<JoinSchema>;
|
|
86
|
+
/**
|
|
87
|
+
* Optional metadata associated with the parent schema definition.
|
|
88
|
+
* This can be used by translators to store or access additional,
|
|
89
|
+
* schema-specific information relevant to the join.
|
|
90
|
+
*/
|
|
91
|
+
parent_schema_metadata: {
|
|
92
|
+
[key: string]: any;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Optional metadata specifically associated with this join configuration
|
|
96
|
+
* as defined in the parent schema's `joins` array.
|
|
97
|
+
* This can be used by translators to store or access additional,
|
|
98
|
+
* join-specific information.
|
|
99
|
+
*/
|
|
100
|
+
join_metadata: {
|
|
101
|
+
[key: string]: any;
|
|
102
|
+
};
|
|
69
103
|
};
|
|
70
104
|
//# sourceMappingURL=join-parameter.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"join-parameter.types.d.ts","sourceRoot":"","sources":["../../../src/criteria/types/join-parameter.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,CACnB,YAAY,SAAS,cAAc,EACnC,UAAU,SAAS,cAAc,EACjC,iBAAiB,SAAS,gBAAgB,IACxC;IACF,4FAA4F;IAC5F,
|
|
1
|
+
{"version":3,"file":"join-parameter.types.d.ts","sourceRoot":"","sources":["../../../src/criteria/types/join-parameter.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,CACnB,YAAY,SAAS,cAAc,EACnC,UAAU,SAAS,cAAc,EACjC,iBAAiB,SAAS,gBAAgB,IACxC;IACF,4FAA4F;IAC5F,aAAa,EAAE,iBAAiB,CAAC;IACjC,+DAA+D;IAC/D,kBAAkB,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAChD,yDAAyD;IACzD,YAAY,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;IAE5C,uDAAuD;IACvD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wFAAwF;IACxF,YAAY,EAAE;QACZ,yEAAyE;QACzE,WAAW,EAAE,MAAM,CAAC;QACpB;;;;WAIG;QACH,SAAS,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;KACxC,CAAC;IACF,wFAAwF;IACxF,UAAU,EAAE;QACV,yEAAyE;QACzE,WAAW,EAAE,MAAM,CAAC;QACpB;;;;WAIG;QACH,SAAS,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;KACtC,CAAC;IACF;;;;OAIG;IACH,sBAAsB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IAC/C;;;;;OAKG;IACH,aAAa,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACvC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,CACpB,YAAY,SAAS,cAAc,EACnC,UAAU,SAAS,cAAc,EACjC,iBAAiB,SAAS,gBAAgB,IACxC;IACF,yGAAyG;IACzG,aAAa,EAAE,iBAAiB,CAAC;IACjC,+DAA+D;IAC/D,kBAAkB,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAChD,yDAAyD;IACzD,YAAY,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5C;;;;OAIG;IACH,YAAY,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAC1C;;;;OAIG;IACH,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACtC;;;;OAIG;IACH,sBAAsB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IAC/C;;;;;OAKG;IACH,aAAa,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACvC,CAAC"}
|
|
@@ -40,7 +40,7 @@ export interface StoredJoinDetails<ParentSchema extends CriteriaSchema> {
|
|
|
40
40
|
export type JoinCriteriaParameterType<ParentSchema extends CriteriaSchema, JoinedSchema extends CriteriaSchema, ActualJoinedAlias extends SelectedAliasOf<JoinedSchema>, MatchingConfigForActualAlias extends SchemaJoins<string> | never> = [MatchingConfigForActualAlias] extends [never] ? `Error: The alias '${ActualJoinedAlias}' of schema '${JoinedSchema['source_name']}' is not configured for join in '${ParentSchema['source_name']}'.` : AnyJoinCriteria<JoinedSchema, ActualJoinedAlias>;
|
|
41
41
|
/**
|
|
42
42
|
* Determines the expected shape of the join parameters object passed to the `.join()` method,
|
|
43
|
-
* based on the `
|
|
43
|
+
* based on the `relation_type` defined in the `ParentSchema` for the `ActualJoinedAlias`.
|
|
44
44
|
* If the `ActualJoinedAlias` is not a valid join alias, this type resolves to `never`.
|
|
45
45
|
* For 'many_to_many' relations, it expects {@link PivotJoinInput}.
|
|
46
46
|
* For other relations (one-to-one, one-to-many, many-to-one), it expects {@link SimpleJoinInput}.
|
|
@@ -50,20 +50,20 @@ export type JoinCriteriaParameterType<ParentSchema extends CriteriaSchema, Joine
|
|
|
50
50
|
* @template MatchingConfigForActualAlias - The join configuration from `ParentSchema` that matches the alias of `JoinedSchema`.
|
|
51
51
|
* Should be `never` if no match is found.
|
|
52
52
|
*/
|
|
53
|
-
export type JoinParameterType<ParentSchema extends CriteriaSchema, JoinedSchema extends CriteriaSchema, MatchingConfigForActualAlias extends SchemaJoins<string> | never> = [MatchingConfigForActualAlias] extends [never] ? never : MatchingConfigForActualAlias['
|
|
53
|
+
export type JoinParameterType<ParentSchema extends CriteriaSchema, JoinedSchema extends CriteriaSchema, MatchingConfigForActualAlias extends SchemaJoins<string> | never> = [MatchingConfigForActualAlias] extends [never] ? never : MatchingConfigForActualAlias['relation_type'] extends 'many_to_many' ? PivotJoinInput<ParentSchema, JoinedSchema> : SimpleJoinInput<ParentSchema, JoinedSchema>;
|
|
54
54
|
/**
|
|
55
55
|
* Extracts the specific join configuration object from the `ParentSchema`'s `joins` array
|
|
56
56
|
* that matches the provided `JoinedSchemaSpecificAlias`.
|
|
57
|
-
* This utility type is crucial for inferring the `
|
|
57
|
+
* This utility type is crucial for inferring the `relation_type` and other
|
|
58
58
|
* join-specific details defined in the parent schema.
|
|
59
59
|
*
|
|
60
60
|
* @template ParentSchema - The {@link CriteriaSchema} of the parent entity.
|
|
61
61
|
* @template JoinedSchemaSpecificAlias - The specific alias of the joined entity,
|
|
62
62
|
* as defined in the `ParentSchema.joins` configuration.
|
|
63
63
|
* @example
|
|
64
|
-
* // Given UserSchema has a join defined as: { alias: 'posts',
|
|
64
|
+
* // Given UserSchema has a join defined as: { alias: 'posts', relation_type: 'one_to_many' }
|
|
65
65
|
* // type UserPostsJoinConfig = SpecificMatchingJoinConfig<typeof UserSchema, 'posts'>;
|
|
66
|
-
* // UserPostsJoinConfig would be: { alias: 'posts';
|
|
66
|
+
* // UserPostsJoinConfig would be: { alias: 'posts'; relation_type: 'one_to_many'; }
|
|
67
67
|
*/
|
|
68
68
|
export type SpecificMatchingJoinConfig<ParentSchema extends CriteriaSchema, JoinedSchemaSpecificAlias extends string> = Extract<ParentSchema['joins'][number], {
|
|
69
69
|
alias: JoinedSchemaSpecificAlias;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"join-utility.types.d.ts","sourceRoot":"","sources":["../../../src/criteria/types/join-utility.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7E;;;;GAIG;AACH,MAAM,MAAM,eAAe,CACzB,OAAO,SAAS,cAAc,EAC9B,KAAK,SAAS,eAAe,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,IAE/D,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,GACjC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,GAChC,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAEtC;;;;GAIG;AACH,MAAM,WAAW,iBAAiB,CAAC,YAAY,SAAS,cAAc;IACpE;;OAEG;IACH,UAAU,EACN,SAAS,CAAC,YAAY,EAAE,cAAc,EAAE,gBAAgB,CAAC,GACzD,UAAU,CAAC,YAAY,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAAC;IAC/D;;OAEG;IACH,QAAQ,EAAE,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC;CAC5E;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,yBAAyB,CACnC,YAAY,SAAS,cAAc,EACnC,YAAY,SAAS,cAAc,EACnC,iBAAiB,SAAS,eAAe,CAAC,YAAY,CAAC,EACvD,4BAA4B,SAAS,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,IAC9D,CAAC,4BAA4B,CAAC,SAAS,CAAC,KAAK,CAAC,GAC9C,qBAAqB,iBAAiB,gBAAgB,YAAY,CAAC,aAAa,CAAC,oCAAoC,YAAY,CAAC,aAAa,CAAC,IAAI,GACpJ,eAAe,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,iBAAiB,CAC3B,YAAY,SAAS,cAAc,EACnC,YAAY,SAAS,cAAc,EACnC,4BAA4B,SAAS,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,IAC9D,CAAC,4BAA4B,CAAC,SAAS,CAAC,KAAK,CAAC,GAC9C,KAAK,GACL,4BAA4B,CAAC,
|
|
1
|
+
{"version":3,"file":"join-utility.types.d.ts","sourceRoot":"","sources":["../../../src/criteria/types/join-utility.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE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Ae,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,iBAAiB,CAC3B,YAAY,SAAS,cAAc,EACnC,YAAY,SAAS,cAAc,EACnC,4BAA4B,SAAS,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,IAC9D,CAAC,4BAA4B,CAAC,SAAS,CAAC,KAAK,CAAC,GAC9C,KAAK,GACL,4BAA4B,CAAC,eAAe,CAAC,SAAS,cAAc,GAClE,cAAc,CAAC,YAAY,EAAE,YAAY,CAAC,GAC1C,eAAe,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,0BAA0B,CACpC,YAAY,SAAS,cAAc,EACnC,yBAAyB,SAAS,MAAM,IACtC,OAAO,CACT,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAC7B;IAAE,KAAK,EAAE,yBAAyB,CAAA;CAAE,CACrC,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Defines the type of relationship for a join.
|
|
3
|
+
* - `one_to_one`: Represents a one-to-one relationship.
|
|
4
|
+
* - `one_to_many`: Represents a one-to-many relationship.
|
|
5
|
+
* - `many_to_one`: Represents a many-to-one relationship.
|
|
6
|
+
* - `many_to_many`: Represents a many-to-many relationship, typically involving a pivot table.
|
|
3
7
|
*/
|
|
4
8
|
export type JoinRelationType = 'one_to_one' | 'one_to_many' | 'many_to_one' | 'many_to_many';
|
|
5
9
|
/**
|
|
@@ -10,7 +14,17 @@ export type SchemaJoins<ValidAlias extends string> = {
|
|
|
10
14
|
/** The alias used to refer to this join in criteria construction. */
|
|
11
15
|
alias: ValidAlias;
|
|
12
16
|
/** The type of relationship this join represents (e.g., 'one_to_many'). */
|
|
13
|
-
|
|
17
|
+
relation_type: JoinRelationType;
|
|
18
|
+
/**
|
|
19
|
+
* Optional metadata associated with this specific join configuration.
|
|
20
|
+
* This allows for storing arbitrary, translator-specific information
|
|
21
|
+
* or hints directly within the schema definition for a join.
|
|
22
|
+
* For example, it could hold database-specific join hints or
|
|
23
|
+
* information about how to handle the join in a particular ORM.
|
|
24
|
+
*/
|
|
25
|
+
metadata?: {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
};
|
|
14
28
|
};
|
|
15
29
|
/**
|
|
16
30
|
* Represents the schema definition for an entity, used by the Criteria system.
|
|
@@ -30,6 +44,16 @@ export type CriteriaSchema<TFields extends ReadonlyArray<string> = ReadonlyArray
|
|
|
30
44
|
fields: TFields;
|
|
31
45
|
/** An array of configurations for entities that can be joined from this entity. */
|
|
32
46
|
joins: ReadonlyArray<SchemaJoins<JoinsAlias>>;
|
|
47
|
+
/**
|
|
48
|
+
* Optional metadata associated with the entire schema definition.
|
|
49
|
+
* This can be used to store arbitrary, translator-specific information
|
|
50
|
+
* or configuration relevant to the entity this schema represents.
|
|
51
|
+
* For example, it could hold information about custom data types,
|
|
52
|
+
* default behaviors, or ORM-specific settings.
|
|
53
|
+
*/
|
|
54
|
+
metadata?: {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
};
|
|
33
57
|
};
|
|
34
58
|
/**
|
|
35
59
|
* A helper function to infer and preserve the literal types of a schema definition.
|
|
@@ -42,7 +66,7 @@ export type CriteriaSchema<TFields extends ReadonlyArray<string> = ReadonlyArray
|
|
|
42
66
|
* source_name: 'users_table',
|
|
43
67
|
* alias: ['user', 'u'],
|
|
44
68
|
* fields: ['id', 'name', 'email'],
|
|
45
|
-
* joins: [{ alias: 'posts',
|
|
69
|
+
* joins: [{ alias: 'posts', relation_type: 'one_to_many' }]
|
|
46
70
|
* });
|
|
47
71
|
*/
|
|
48
72
|
export declare function GetTypedCriteriaSchema<const TInput extends CriteriaSchema>(schema: TInput): TInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.types.d.ts","sourceRoot":"","sources":["../../../src/criteria/types/schema.types.ts"],"names":[],"mappings":"AAA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AC,SAAS,cAAc,IAChD,CAAC,CAAC,QAAQ,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,cAAc,IAClD,CAAC,CAAC,OAAO,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* source_name: 'users_table',
|
|
10
10
|
* alias: ['user', 'u'],
|
|
11
11
|
* fields: ['id', 'name', 'email'],
|
|
12
|
-
* joins: [{ alias: 'posts',
|
|
12
|
+
* joins: [{ alias: 'posts', relation_type: 'one_to_many' }]
|
|
13
13
|
* });
|
|
14
14
|
*/
|
|
15
15
|
export function GetTypedCriteriaSchema(schema) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.types.js","sourceRoot":"","sources":["../../../src/criteria/types/schema.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.types.js","sourceRoot":"","sources":["../../../src/criteria/types/schema.types.ts"],"names":[],"mappings":"AAiEA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAc;IAEd,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nulledexp/translatable-criteria",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A TypeScript library for building data-source agnostic, translatable query criteria. Define complex filtering, ordering, and join logic in a structured, type-safe way, then translate it to your specific data source using custom translators.",
|
|
6
6
|
"keywords": [
|