@nulledexp/translatable-criteria 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/criteria/criteria-factory.d.ts +70 -0
  2. package/dist/criteria/criteria-factory.d.ts.map +1 -0
  3. package/dist/criteria/criteria-factory.js +77 -0
  4. package/dist/criteria/criteria-factory.js.map +1 -0
  5. package/dist/criteria/criteria-filter-manager.d.ts +13 -0
  6. package/dist/criteria/criteria-filter-manager.d.ts.map +1 -0
  7. package/dist/criteria/criteria-filter-manager.js +21 -0
  8. package/dist/criteria/criteria-filter-manager.js.map +1 -0
  9. package/dist/criteria/criteria-join-manager.d.ts +10 -0
  10. package/dist/criteria/criteria-join-manager.d.ts.map +1 -0
  11. package/dist/criteria/criteria-join-manager.js +14 -0
  12. package/dist/criteria/criteria-join-manager.js.map +1 -0
  13. package/dist/criteria/criteria.d.ts +48 -0
  14. package/dist/criteria/criteria.d.ts.map +1 -0
  15. package/dist/criteria/criteria.js +162 -0
  16. package/dist/criteria/criteria.js.map +1 -0
  17. package/dist/criteria/cursor.d.ts +13 -0
  18. package/dist/criteria/cursor.d.ts.map +1 -0
  19. package/dist/criteria/cursor.js +31 -0
  20. package/dist/criteria/cursor.js.map +1 -0
  21. package/dist/criteria/filter/filter-group.d.ts +18 -0
  22. package/dist/criteria/filter/filter-group.d.ts.map +1 -0
  23. package/dist/criteria/filter/filter-group.js +104 -0
  24. package/dist/criteria/filter/filter-group.js.map +1 -0
  25. package/dist/criteria/filter/filter-utils.d.ts +5 -0
  26. package/dist/criteria/filter/filter-utils.d.ts.map +1 -0
  27. package/dist/criteria/filter/filter-utils.js +74 -0
  28. package/dist/criteria/filter/filter-utils.js.map +1 -0
  29. package/dist/criteria/filter/filter.d.ts +23 -0
  30. package/dist/criteria/filter/filter.d.ts.map +1 -0
  31. package/dist/criteria/filter/filter.js +126 -0
  32. package/dist/criteria/filter/filter.js.map +1 -0
  33. package/dist/criteria/filter/types/filter-primitive.types.d.ts +66 -0
  34. package/dist/criteria/filter/types/filter-primitive.types.d.ts.map +1 -0
  35. package/dist/criteria/filter/types/filter-primitive.types.js +2 -0
  36. package/dist/criteria/filter/types/filter-primitive.types.js.map +1 -0
  37. package/dist/criteria/index.d.ts +22 -0
  38. package/dist/criteria/index.d.ts.map +1 -0
  39. package/dist/criteria/index.js +16 -0
  40. package/dist/criteria/index.js.map +1 -0
  41. package/dist/criteria/join/inner.join-criteria.d.ts +27 -0
  42. package/dist/criteria/join/inner.join-criteria.d.ts.map +1 -0
  43. package/dist/criteria/join/inner.join-criteria.js +31 -0
  44. package/dist/criteria/join/inner.join-criteria.js.map +1 -0
  45. package/dist/criteria/join/left.join-criteria.d.ts +26 -0
  46. package/dist/criteria/join/left.join-criteria.d.ts.map +1 -0
  47. package/dist/criteria/join/left.join-criteria.js +30 -0
  48. package/dist/criteria/join/left.join-criteria.js.map +1 -0
  49. package/dist/criteria/join/outer.join-criteria.d.ts +27 -0
  50. package/dist/criteria/join/outer.join-criteria.d.ts.map +1 -0
  51. package/dist/criteria/join/outer.join-criteria.js +31 -0
  52. package/dist/criteria/join/outer.join-criteria.js.map +1 -0
  53. package/dist/criteria/order/order.d.ts +20 -0
  54. package/dist/criteria/order/order.d.ts.map +1 -0
  55. package/dist/criteria/order/order.js +32 -0
  56. package/dist/criteria/order/order.js.map +1 -0
  57. package/dist/criteria/root.criteria.d.ts +28 -0
  58. package/dist/criteria/root.criteria.d.ts.map +1 -0
  59. package/dist/criteria/root.criteria.js +30 -0
  60. package/dist/criteria/root.criteria.js.map +1 -0
  61. package/dist/criteria/translator/criteria-translator.d.ts +45 -0
  62. package/dist/criteria/translator/criteria-translator.d.ts.map +1 -0
  63. package/dist/criteria/translator/criteria-translator.js +30 -0
  64. package/dist/criteria/translator/criteria-translator.js.map +1 -0
  65. package/dist/criteria/types/criteria.interface.d.ts +166 -0
  66. package/dist/criteria/types/criteria.interface.d.ts.map +1 -0
  67. package/dist/criteria/types/criteria.interface.js +2 -0
  68. package/dist/criteria/types/criteria.interface.js.map +1 -0
  69. package/dist/criteria/types/filter-expression.interface.d.ts +7 -0
  70. package/dist/criteria/types/filter-expression.interface.d.ts.map +1 -0
  71. package/dist/criteria/types/filter-expression.interface.js +2 -0
  72. package/dist/criteria/types/filter-expression.interface.js.map +1 -0
  73. package/dist/criteria/types/join-input.types.d.ts +54 -0
  74. package/dist/criteria/types/join-input.types.d.ts.map +1 -0
  75. package/dist/criteria/types/join-input.types.js +2 -0
  76. package/dist/criteria/types/join-input.types.js.map +1 -0
  77. package/dist/criteria/types/join-parameter.types.d.ts +70 -0
  78. package/dist/criteria/types/join-parameter.types.d.ts.map +1 -0
  79. package/dist/criteria/types/join-parameter.types.js +2 -0
  80. package/dist/criteria/types/join-parameter.types.js.map +1 -0
  81. package/dist/criteria/types/join-utility.types.d.ts +71 -0
  82. package/dist/criteria/types/join-utility.types.d.ts.map +1 -0
  83. package/dist/criteria/types/join-utility.types.js +2 -0
  84. package/dist/criteria/types/join-utility.types.js.map +1 -0
  85. package/dist/criteria/types/manager.interface.d.ts +59 -0
  86. package/dist/criteria/types/manager.interface.d.ts.map +1 -0
  87. package/dist/criteria/types/manager.interface.js +2 -0
  88. package/dist/criteria/types/manager.interface.js.map +1 -0
  89. package/dist/criteria/types/operator.types.d.ts +92 -0
  90. package/dist/criteria/types/operator.types.d.ts.map +1 -0
  91. package/dist/criteria/types/operator.types.js +95 -0
  92. package/dist/criteria/types/operator.types.js.map +1 -0
  93. package/dist/criteria/types/schema.types.d.ts +61 -0
  94. package/dist/criteria/types/schema.types.d.ts.map +1 -0
  95. package/dist/criteria/types/schema.types.js +18 -0
  96. package/dist/criteria/types/schema.types.js.map +1 -0
  97. package/dist/criteria/types/visitor-interface.types.d.ts +24 -0
  98. package/dist/criteria/types/visitor-interface.types.d.ts.map +1 -0
  99. package/dist/criteria/types/visitor-interface.types.js +2 -0
  100. package/dist/criteria/types/visitor-interface.types.js.map +1 -0
  101. package/dist/index.d.ts +2 -0
  102. package/dist/index.d.ts.map +1 -0
  103. package/dist/index.js +2 -0
  104. package/dist/index.js.map +1 -0
  105. package/package.json +1 -1
@@ -0,0 +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"}
@@ -0,0 +1,27 @@
1
+ import type { CriteriaSchema, JoinRelationType, SelectedAliasOf } from '../types/schema.types.js';
2
+ import type { PivotJoin, SimpleJoin } from '../types/join-parameter.types.js';
3
+ import { Criteria } from '../criteria.js';
4
+ import type { ICriteriaVisitor } from '../types/visitor-interface.types.js';
5
+ /**
6
+ * Represents an OUTER JOIN (typically FULL OUTER JOIN) criteria.
7
+ * It extends the base {@link Criteria} and defines how it's visited by a {@link ICriteriaVisitor}.
8
+ * Note: Full OUTER JOIN support can vary between database systems.
9
+ * @template CSchema - The {@link CriteriaSchema} of the entity being joined.
10
+ * @template Alias - The selected alias for the joined entity from its schema.
11
+ */
12
+ export declare class OuterJoinCriteria<CSchema extends CriteriaSchema, Alias extends SelectedAliasOf<CSchema> = SelectedAliasOf<CSchema>> extends Criteria<CSchema, Alias> {
13
+ /**
14
+ * Accepts a criteria visitor to process this outer join criteria.
15
+ * It first validates the join field against the schema before dispatching to the visitor.
16
+ * @template TranslationContext - The type of the context object passed during traversal.
17
+ * @template TranslationOutput - The type of the result returned by visitor methods.
18
+ * @param {ICriteriaVisitor<TranslationContext, TranslationOutput>} visitor - The visitor instance.
19
+ * @param {PivotJoin<CriteriaSchema, CSchema, JoinRelationType> | SimpleJoin<CriteriaSchema, CSchema, JoinRelationType>} parameters -
20
+ * The fully resolved parameters for this join, including parent and join field details.
21
+ * @param {TranslationContext} context - The context object to be passed to the visitor.
22
+ * @returns {TranslationOutput} The result of the visitor processing this join.
23
+ */
24
+ accept<TranslationContext, TranslationOutput>(visitor: ICriteriaVisitor<TranslationContext, TranslationOutput>, parameters: PivotJoin<CriteriaSchema, CSchema, JoinRelationType> | SimpleJoin<CriteriaSchema, CSchema, JoinRelationType>, context: TranslationContext): TranslationOutput;
25
+ resetCriteria(): OuterJoinCriteria<CSchema, Alias>;
26
+ }
27
+ //# sourceMappingURL=outer.join-criteria.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,31 @@
1
+ import { Criteria } from '../criteria.js';
2
+ /**
3
+ * Represents an OUTER JOIN (typically FULL OUTER JOIN) criteria.
4
+ * It extends the base {@link Criteria} and defines how it's visited by a {@link ICriteriaVisitor}.
5
+ * Note: Full OUTER JOIN support can vary between database systems.
6
+ * @template CSchema - The {@link CriteriaSchema} of the entity being joined.
7
+ * @template Alias - The selected alias for the joined entity from its schema.
8
+ */
9
+ export class OuterJoinCriteria extends Criteria {
10
+ /**
11
+ * Accepts a criteria visitor to process this outer join criteria.
12
+ * It first validates the join field against the schema before dispatching to the visitor.
13
+ * @template TranslationContext - The type of the context object passed during traversal.
14
+ * @template TranslationOutput - The type of the result returned by visitor methods.
15
+ * @param {ICriteriaVisitor<TranslationContext, TranslationOutput>} visitor - The visitor instance.
16
+ * @param {PivotJoin<CriteriaSchema, CSchema, JoinRelationType> | SimpleJoin<CriteriaSchema, CSchema, JoinRelationType>} parameters -
17
+ * The fully resolved parameters for this join, including parent and join field details.
18
+ * @param {TranslationContext} context - The context object to be passed to the visitor.
19
+ * @returns {TranslationOutput} The result of the visitor processing this join.
20
+ */
21
+ accept(visitor, parameters, context) {
22
+ typeof parameters.join_field === 'object'
23
+ ? this.assetFieldOnSchema(parameters.join_field.reference)
24
+ : this.assetFieldOnSchema(parameters.join_field);
25
+ return visitor.visitOuterJoin(this, parameters, context);
26
+ }
27
+ resetCriteria() {
28
+ return new OuterJoinCriteria(this.schema, this._alias);
29
+ }
30
+ }
31
+ //# sourceMappingURL=outer.join-criteria.js.map
@@ -0,0 +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"}
@@ -0,0 +1,20 @@
1
+ export declare const OrderDirection: {
2
+ readonly ASC: "ASC";
3
+ readonly DESC: "DESC";
4
+ };
5
+ export type OrderDirection = keyof typeof OrderDirection;
6
+ export type OrderByPrimitive<T extends string = string> = {
7
+ direction: OrderDirection;
8
+ field: T;
9
+ };
10
+ export declare class Order<T extends string = string> {
11
+ protected readonly _direction: OrderDirection;
12
+ protected readonly _field: T;
13
+ protected _sequenceId: number;
14
+ constructor(_direction: OrderDirection, _field: T);
15
+ get sequenceId(): number;
16
+ get field(): T;
17
+ get direction(): OrderDirection;
18
+ toPrimitive(): OrderByPrimitive<T>;
19
+ }
20
+ //# sourceMappingURL=order.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../src/criteria/order/order.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,cAAc,CAAC;AAGzD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IACxD,SAAS,EAAE,cAAc,CAAC;IAC1B,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,qBAAa,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAGxC,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,cAAc;IAC7C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAH9B,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;gBAET,UAAU,EAAE,cAAc,EAC1B,MAAM,EAAE,CAAC;IAM9B,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,KAAK,IAAI,CAAC,CAEb;IAED,IAAI,SAAS,IAAI,cAAc,CAE9B;IAED,WAAW,IAAI,gBAAgB,CAAC,CAAC,CAAC;CAMnC"}
@@ -0,0 +1,32 @@
1
+ export const OrderDirection = {
2
+ ASC: 'ASC',
3
+ DESC: 'DESC',
4
+ };
5
+ let globalOrderSequence = 0;
6
+ export class Order {
7
+ _direction;
8
+ _field;
9
+ _sequenceId;
10
+ constructor(_direction, _field) {
11
+ this._direction = _direction;
12
+ this._field = _field;
13
+ globalOrderSequence++;
14
+ this._sequenceId = globalOrderSequence;
15
+ }
16
+ get sequenceId() {
17
+ return this._sequenceId;
18
+ }
19
+ get field() {
20
+ return this._field;
21
+ }
22
+ get direction() {
23
+ return this._direction;
24
+ }
25
+ toPrimitive() {
26
+ return {
27
+ direction: this._direction,
28
+ field: this._field,
29
+ };
30
+ }
31
+ }
32
+ //# sourceMappingURL=order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.js","sourceRoot":"","sources":["../../../src/criteria/order/order.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACJ,CAAC;AAGX,IAAI,mBAAmB,GAAW,CAAC,CAAC;AAMpC,MAAM,OAAO,KAAK;IAGK;IACA;IAHX,WAAW,CAAS;IAC9B,YACqB,UAA0B,EAC1B,MAAS;QADT,eAAU,GAAV,UAAU,CAAgB;QAC1B,WAAM,GAAN,MAAM,CAAG;QAE5B,mBAAmB,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAC;IACzC,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,WAAW;QACT,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,UAAU;YAC1B,KAAK,EAAE,IAAI,CAAC,MAAM;SACnB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,28 @@
1
+ import { Criteria } from './criteria.js';
2
+ import type { CriteriaSchema, SelectedAliasOf } from './types/schema.types.js';
3
+ import type { ICriteriaVisitor } from './types/visitor-interface.types.js';
4
+ /**
5
+ * Represents the root criteria for a query.
6
+ * This is the main entry point for building a query and defines the primary entity being queried.
7
+ * It extends the base {@link Criteria} and defines how it's visited by a {@link ICriteriaVisitor}.
8
+ * @template CSchema - The {@link CriteriaSchema} of the root entity.
9
+ * @template Alias - The selected alias for the root entity from its schema.
10
+ */
11
+ export declare class RootCriteria<CSchema extends CriteriaSchema, Alias extends SelectedAliasOf<CSchema>> extends Criteria<CSchema, Alias> {
12
+ /**
13
+ * Accepts a criteria visitor to process this root criteria.
14
+ * This method is the entry point for the visitor pattern to traverse the criteria tree.
15
+ * @template TranslationContext - The type of the context object passed during traversal (e.g., a query builder
16
+ * instance).
17
+ * @template TranslationOutput - The type of the result returned by visitor methods (e.g., the modified query builder
18
+ * or a query string).
19
+ * @param {ICriteriaVisitor<TranslationContext, TranslationOutput>} visitor - The visitor instance responsible for
20
+ * translating criteria parts.
21
+ * @param {TranslationContext} context - The context object to be passed to the visitor (e.g., an initial query
22
+ * builder or an empty string for SQL).
23
+ * @returns {TranslationOutput} The result of the visitor processing this root criteria and its components.
24
+ */
25
+ accept<TranslationContext, TranslationOutput>(visitor: ICriteriaVisitor<TranslationContext, TranslationOutput>, context: TranslationContext): TranslationOutput;
26
+ resetCriteria(): RootCriteria<CSchema, Alias>;
27
+ }
28
+ //# sourceMappingURL=root.criteria.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,30 @@
1
+ import { Criteria } from './criteria.js';
2
+ /**
3
+ * Represents the root criteria for a query.
4
+ * This is the main entry point for building a query and defines the primary entity being queried.
5
+ * It extends the base {@link Criteria} and defines how it's visited by a {@link ICriteriaVisitor}.
6
+ * @template CSchema - The {@link CriteriaSchema} of the root entity.
7
+ * @template Alias - The selected alias for the root entity from its schema.
8
+ */
9
+ export class RootCriteria extends Criteria {
10
+ /**
11
+ * Accepts a criteria visitor to process this root criteria.
12
+ * This method is the entry point for the visitor pattern to traverse the criteria tree.
13
+ * @template TranslationContext - The type of the context object passed during traversal (e.g., a query builder
14
+ * instance).
15
+ * @template TranslationOutput - The type of the result returned by visitor methods (e.g., the modified query builder
16
+ * or a query string).
17
+ * @param {ICriteriaVisitor<TranslationContext, TranslationOutput>} visitor - The visitor instance responsible for
18
+ * translating criteria parts.
19
+ * @param {TranslationContext} context - The context object to be passed to the visitor (e.g., an initial query
20
+ * builder or an empty string for SQL).
21
+ * @returns {TranslationOutput} The result of the visitor processing this root criteria and its components.
22
+ */
23
+ accept(visitor, context) {
24
+ return visitor.visitRoot(this, context);
25
+ }
26
+ resetCriteria() {
27
+ return new RootCriteria(this.schema, this._alias);
28
+ }
29
+ }
30
+ //# sourceMappingURL=root.criteria.js.map
@@ -0,0 +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"}
@@ -0,0 +1,45 @@
1
+ import type { CriteriaSchema, JoinRelationType, SelectedAliasOf } from '../types/schema.types.js';
2
+ import type { RootCriteria } from '../root.criteria.js';
3
+ import type { PivotJoin, SimpleJoin } from '../types/join-parameter.types.js';
4
+ import type { FilterGroup } from '../filter/filter-group.js';
5
+ import type { InnerJoinCriteria } from '../join/inner.join-criteria.js';
6
+ import type { LeftJoinCriteria } from '../join/left.join-criteria.js';
7
+ import type { OuterJoinCriteria } from '../join/outer.join-criteria.js';
8
+ import type { Filter } from '../filter/filter.js';
9
+ import type { ICriteriaVisitor } from '../types/visitor-interface.types.js';
10
+ import type { FilterOperator } from '../types/operator.types.js';
11
+ /**
12
+ * Abstract Class for translating criteria into various query formats
13
+ * @template TranslationContext - The target format (e.g., QueryBuilder, raw SQL string, etc.)
14
+ * @template TranslationOutput - The output format by default its Source (Only specify this if
15
+ * you really need something like a memory translator and the output would be different
16
+ * from the TranslationContext itself)
17
+ * @template RootSchema - The schema type for the root criteria
18
+ * @example
19
+ * // TypeORM QueryBuilder translator
20
+ * class TypeORMTranslator implements CriteriaTranslator<SelectQueryBuilder<Entity>> {
21
+ * ...Concrete implementation
22
+ * }
23
+ *
24
+ * // Raw MySQL translator
25
+ * export class MysqlTranslator extends CriteriaTranslator<string, string> { {
26
+ * ...Concrete implementation
27
+ * }
28
+ */
29
+ export declare abstract class CriteriaTranslator<TranslationContext, TranslationOutput = TranslationContext, TFilterVisitorOutput extends any = any> implements ICriteriaVisitor<TranslationContext, TranslationOutput, TFilterVisitorOutput> {
30
+ /**
31
+ * Translates a criteria into the target source format
32
+ * @param criteria - The criteria to translate
33
+ * @param source - The source object to translate into (e.g., QueryBuilder instance, or raw SQL string)
34
+ * @returns The modified source or the output format if specified
35
+ */
36
+ translate<RootCriteriaSchema extends CriteriaSchema>(criteria: RootCriteria<RootCriteriaSchema, SelectedAliasOf<RootCriteriaSchema>>, source: TranslationContext): TranslationOutput;
37
+ abstract visitRoot<RootCriteriaSchema extends CriteriaSchema, RootAlias extends SelectedAliasOf<RootCriteriaSchema>>(criteria: RootCriteria<RootCriteriaSchema, RootAlias>, context: TranslationContext): TranslationOutput;
38
+ abstract visitInnerJoin<ParentCSchema extends CriteriaSchema, JoinCriteriaSchema extends CriteriaSchema, JoinAlias extends SelectedAliasOf<JoinCriteriaSchema>>(criteria: InnerJoinCriteria<JoinCriteriaSchema, JoinAlias>, parameters: PivotJoin<ParentCSchema, JoinCriteriaSchema, JoinRelationType> | SimpleJoin<ParentCSchema, JoinCriteriaSchema, JoinRelationType>, context: TranslationContext): TranslationOutput;
39
+ abstract visitLeftJoin<ParentCSchema extends CriteriaSchema, JoinCriteriaSchema extends CriteriaSchema, JoinAlias extends SelectedAliasOf<JoinCriteriaSchema>>(criteria: LeftJoinCriteria<JoinCriteriaSchema, JoinAlias>, parameters: PivotJoin<ParentCSchema, JoinCriteriaSchema, JoinRelationType> | SimpleJoin<ParentCSchema, JoinCriteriaSchema, JoinRelationType>, context: TranslationContext): TranslationOutput;
40
+ abstract visitOuterJoin<ParentCSchema extends CriteriaSchema, JoinCriteriaSchema extends CriteriaSchema, JoinAlias extends SelectedAliasOf<JoinCriteriaSchema>>(criteria: OuterJoinCriteria<JoinCriteriaSchema, JoinAlias>, parameters: PivotJoin<ParentCSchema, JoinCriteriaSchema, JoinRelationType> | SimpleJoin<ParentCSchema, JoinCriteriaSchema, JoinRelationType>, context: TranslationContext): TranslationOutput;
41
+ abstract visitFilter<FieldType extends string, Operator extends FilterOperator>(filter: Filter<FieldType, Operator>, currentAlias: string): TFilterVisitorOutput;
42
+ abstract visitAndGroup<FieldType extends string>(group: FilterGroup<FieldType>, currentAlias: string, context: TranslationContext): TranslationOutput;
43
+ abstract visitOrGroup<FieldType extends string>(group: FilterGroup<FieldType>, currentAlias: string, context: TranslationContext): TranslationOutput;
44
+ }
45
+ //# sourceMappingURL=criteria-translator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"criteria-translator.d.ts","sourceRoot":"","sources":["../../../src/criteria/translator/criteria-translator.ts"],"names":[],"mappings":"AA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,MAAM,EAC7C,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,EAC7B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB;IAEpB,QAAQ,CAAC,YAAY,CAAC,SAAS,SAAS,MAAM,EAC5C,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,EAC7B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB;CACrB"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Abstract Class for translating criteria into various query formats
3
+ * @template TranslationContext - The target format (e.g., QueryBuilder, raw SQL string, etc.)
4
+ * @template TranslationOutput - The output format by default its Source (Only specify this if
5
+ * you really need something like a memory translator and the output would be different
6
+ * from the TranslationContext itself)
7
+ * @template RootSchema - The schema type for the root criteria
8
+ * @example
9
+ * // TypeORM QueryBuilder translator
10
+ * class TypeORMTranslator implements CriteriaTranslator<SelectQueryBuilder<Entity>> {
11
+ * ...Concrete implementation
12
+ * }
13
+ *
14
+ * // Raw MySQL translator
15
+ * export class MysqlTranslator extends CriteriaTranslator<string, string> { {
16
+ * ...Concrete implementation
17
+ * }
18
+ */
19
+ export class CriteriaTranslator {
20
+ /**
21
+ * Translates a criteria into the target source format
22
+ * @param criteria - The criteria to translate
23
+ * @param source - The source object to translate into (e.g., QueryBuilder instance, or raw SQL string)
24
+ * @returns The modified source or the output format if specified
25
+ */
26
+ translate(criteria, source) {
27
+ return criteria.accept(this, source);
28
+ }
29
+ }
30
+ //# sourceMappingURL=criteria-translator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"criteria-translator.js","sourceRoot":"","sources":["../../../src/criteria/translator/criteria-translator.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAgB,kBAAkB;IAWtC;;;;;OAKG;IACH,SAAS,CACP,QAGC,EACD,MAA0B;QAE1B,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;CAiEF"}
@@ -0,0 +1,166 @@
1
+ import type { CriteriaSchema, FieldOfSchema, SelectedAliasOf } from './schema.types.js';
2
+ import type { FilterGroup } from '../filter/filter-group.js';
3
+ import type { Cursor } from '../cursor.js';
4
+ import type { Order, OrderDirection } from '../order/order.js';
5
+ import { FilterOperator } from './operator.types.js';
6
+ import type { StoredJoinDetails, JoinCriteriaParameterType, JoinParameterType, SpecificMatchingJoinConfig } from './join-utility.types.js';
7
+ import type { FilterPrimitive } from '../filter/types/filter-primitive.types.js';
8
+ /**
9
+ * Base interface for defining query criteria.
10
+ * It provides methods for filtering, joining, selecting fields, ordering, and paginating results.
11
+ * @template TSchema - The schema definition for the primary entity.
12
+ * @template CurrentAlias - The selected alias for the primary entity from its schema.
13
+ */
14
+ export interface ICriteriaBase<TSchema extends CriteriaSchema, CurrentAlias extends SelectedAliasOf<TSchema>> {
15
+ /**
16
+ * Configures the criteria to select all available fields from the root entity
17
+ * and any joined entities that also have `selectAll()` called or by default.
18
+ * This overrides any previous specific selections made by `setSelect()`.
19
+ * @returns {ICriteriaBase<TSchema, CurrentAlias>} The current criteria instance for chaining.
20
+ */
21
+ resetSelect(): ICriteriaBase<TSchema, CurrentAlias>;
22
+ get selectAll(): boolean;
23
+ /**
24
+ * Sets the cursor for pagination. A cursor defines a point from which to fetch
25
+ * the next or previous set of results. It typically uses a combination of
26
+ * unique and ordered fields.
27
+ *
28
+ * @param {Array<Omit<FilterPrimitive<FieldOfSchema<TSchema>>, 'operator'>>} filterPrimitive -
29
+ * An array of exactly two filter primitives (without the operator)
30
+ * defining the fields and their values for the cursor.
31
+ * Example: `[{ field: 'created_at', value: '2023-10-26T10:00:00Z' }, { field: 'uuid', value: 'some-uuid' }]`
32
+ * @param {FilterOperator.GREATER_THAN | FilterOperator.LESS_THAN} operator -
33
+ * The comparison operator to apply to the cursor fields (e.g., fetch records
34
+ * greater than or less than the cursor values).
35
+ * @param {OrderDirection} order - The direction of ordering that matches the cursor logic.
36
+ * If operator is GREATER_THAN, order should typically be ASC.
37
+ * If operator is LESS_THAN, order should typically be DESC.
38
+ * @returns {ICriteriaBase<TSchema, CurrentAlias>} The current criteria instance for chaining.
39
+ * @throws {Error} If filterPrimitive does not contain exactly 2 elements.
40
+ * @throws {Error} If any cursor field is not defined in the schema.
41
+ * @throws {Error} If any cursor value is null or undefined.
42
+ * @throws {Error} If the two cursor fields are identical.
43
+ */
44
+ setCursor<Operator extends FilterOperator.GREATER_THAN | FilterOperator.LESS_THAN>(filterPrimitive: [
45
+ Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>,
46
+ Omit<FilterPrimitive<FieldOfSchema<TSchema>, Operator>, 'operator'>
47
+ ], operator: Operator, order: OrderDirection): ICriteriaBase<TSchema, CurrentAlias>;
48
+ resetCriteria(): ICriteriaBase<TSchema, CurrentAlias>;
49
+ /**
50
+ * Gets the current cursor configuration, if set.
51
+ * @returns {Cursor<FieldOfSchema<TSchema>> | undefined} The cursor object or undefined.
52
+ */
53
+ get cursor(): Cursor<FieldOfSchema<TSchema>, FilterOperator.GREATER_THAN | FilterOperator.LESS_THAN> | undefined;
54
+ /**
55
+ * Specifies which fields to select for the root entity.
56
+ * Calling this method disables `selectAll()` behavior.
57
+ * @param {Array<FieldOfSchema<TSchema>>} selectFields - An array of field names to select.
58
+ * @returns {ICriteriaBase<TSchema, CurrentAlias>} The current criteria instance for chaining.
59
+ * @throws {Error} If any of the specified fields are not defined in the schema.
60
+ */
61
+ setSelect(selectFields: Array<FieldOfSchema<TSchema>>): ICriteriaBase<TSchema, CurrentAlias>;
62
+ /**
63
+ * Gets the currently selected fields. If `selectAll()` was last called or is default,
64
+ * it returns all fields from the schema.
65
+ * @returns {Array<FieldOfSchema<TSchema>>} An array of selected field names.
66
+ */
67
+ get select(): Array<FieldOfSchema<TSchema>>;
68
+ /**
69
+ * Adds an ordering rule to the criteria.
70
+ * Multiple calls to `orderBy` will append new ordering rules.
71
+ * @param {FieldOfSchema<TSchema>} field - The field to order by.
72
+ * @param {OrderDirection} direction - The direction of the ordering (ASC or DESC).
73
+ * @returns {ICriteriaBase<TSchema, CurrentAlias>} The current criteria instance for chaining.
74
+ * @throws {Error} If the specified field is not defined in the schema.
75
+ */
76
+ orderBy(field: FieldOfSchema<TSchema>, direction: OrderDirection): ICriteriaBase<TSchema, CurrentAlias>;
77
+ /**
78
+ * Sets the maximum number of records to return (LIMIT).
79
+ * @param {number} amount - The number of records to take. Must be non-negative.
80
+ * @returns {ICriteriaBase<TSchema, CurrentAlias>} The current criteria instance for chaining.
81
+ * @throws {Error} If the amount is negative.
82
+ */
83
+ setTake(amount: number): ICriteriaBase<TSchema, CurrentAlias>;
84
+ /**
85
+ * Sets the number of records to skip before starting to return records (OFFSET).
86
+ * @param {number} amount - The number of records to skip. Must be non-negative.
87
+ * @returns {ICriteriaBase<TSchema, CurrentAlias>} The current criteria instance for chaining.
88
+ * @throws {Error} If the amount is negative.
89
+ */
90
+ setSkip(amount: number): ICriteriaBase<TSchema, CurrentAlias>;
91
+ /**
92
+ * Gets the configured join details.
93
+ * @returns {ReadonlyArray<StoredJoinDetails<TSchema>>} An array of join configurations.
94
+ */
95
+ get joins(): ReadonlyArray<StoredJoinDetails<TSchema>>;
96
+ /**
97
+ * Gets the root filter group for this criteria.
98
+ * @returns {FilterGroup} The root filter group.
99
+ */
100
+ get rootFilterGroup(): FilterGroup;
101
+ /**
102
+ * Gets the alias for the root entity of this criteria.
103
+ * @returns {CurrentAlias} The alias string.
104
+ */
105
+ get alias(): CurrentAlias;
106
+ /**
107
+ * Gets the source name (e.g., table name) for the root entity of this criteria.
108
+ * @returns {TSchema['source_name']} The source name string.
109
+ */
110
+ get sourceName(): TSchema['source_name'];
111
+ /**
112
+ * Gets the current take value (LIMIT).
113
+ * @returns {number} The take value.
114
+ */
115
+ get take(): number;
116
+ /**
117
+ * Gets the current skip value (OFFSET).
118
+ * @returns {number} The skip value.
119
+ */
120
+ get skip(): number;
121
+ /**
122
+ * Gets the current ordering rules.
123
+ * @returns {readonly Order[]} An array of order objects.
124
+ */
125
+ get orders(): readonly Order[];
126
+ /**
127
+ * Initializes the filter criteria with a single filter primitive.
128
+ * This replaces any existing filters.
129
+ * @param {FilterPrimitive<FieldOfSchema<TSchema>>} filterPrimitive - The filter to apply.
130
+ * @returns {ICriteriaBase<TSchema, CurrentAlias>} The current criteria instance for chaining.
131
+ * @throws {Error} If the specified field in filterPrimitive is not defined in the schema.
132
+ */
133
+ where<Operator extends FilterOperator>(filterPrimitive: FilterPrimitive<FieldOfSchema<TSchema>, Operator>): ICriteriaBase<TSchema, CurrentAlias>;
134
+ /**
135
+ * Adds a filter primitive to the current filter group using an AND logical operator.
136
+ * @param {FilterPrimitive<FieldOfSchema<TSchema>>} filterPrimitive - The filter to add.
137
+ * @returns {ICriteriaBase<TSchema, CurrentAlias>} The current criteria instance for chaining.
138
+ * @throws {Error} If the specified field in filterPrimitive is not defined in the schema.
139
+ * @throws {Error} If `where()` has not been called first.
140
+ */
141
+ andWhere<Operator extends FilterOperator>(filterPrimitive: FilterPrimitive<FieldOfSchema<TSchema>, Operator>): ICriteriaBase<TSchema, CurrentAlias>;
142
+ /**
143
+ * Adds a filter primitive, creating a new OR group with the existing filters.
144
+ * @param {FilterPrimitive<FieldOfSchema<TSchema>>} filterPrimitive - The filter to add.
145
+ * @returns {ICriteriaBase<TSchema, CurrentAlias>} The current criteria instance for chaining.
146
+ * @throws {Error} If the specified field in filterPrimitive is not defined in the schema.
147
+ * @throws {Error} If `where()` has not been called first.
148
+ */
149
+ orWhere<Operator extends FilterOperator>(filterPrimitive: FilterPrimitive<FieldOfSchema<TSchema>, Operator>): ICriteriaBase<TSchema, CurrentAlias>;
150
+ /**
151
+ * Adds a join to another criteria.
152
+ * @template TJoinSchema - The schema of the entity to join.
153
+ * @template TJoinedCriteriaAlias - The alias for the joined entity.
154
+ * @template TMatchingJoinConfig - The specific join configuration from the parent schema that matches the joined alias.
155
+ * @param {JoinCriteriaParameterType<TSchema, TJoinSchema, TJoinedCriteriaAlias, TMatchingJoinConfig>} criteriaToJoin
156
+ * The criteria instance representing the entity to join (e.g., `InnerJoinCriteria`, `LeftJoinCriteria`).
157
+ * @param {JoinParameterType<TSchema, TJoinSchema, TMatchingJoinConfig>} joinParameter
158
+ * The parameters defining how the join should be performed (e.g., fields for simple join, pivot table details for many-to-many).
159
+ * @returns {ICriteriaBase<TSchema, CurrentAlias>} The current criteria instance for chaining.
160
+ * @throws {Error} If the join configuration for the given alias is not found in the parent schema.
161
+ * @throws {Error} If `parent_field` in `joinParameter` is not defined in the parent schema.
162
+ * @throws {Error} If `joinParameter` is invalid for the `join_relation_type` defined in the schema (e.g., using simple join input for many-to-many).
163
+ */
164
+ join<TJoinSchema extends CriteriaSchema, TJoinedCriteriaAlias extends SelectedAliasOf<TJoinSchema>, TMatchingJoinConfig extends SpecificMatchingJoinConfig<TSchema, TJoinedCriteriaAlias>>(criteriaToJoin: JoinCriteriaParameterType<TSchema, TJoinSchema, TJoinedCriteriaAlias, TMatchingJoinConfig>, joinParameter: JoinParameterType<TSchema, TJoinSchema, TMatchingJoinConfig>): ICriteriaBase<TSchema, CurrentAlias>;
165
+ }
166
+ //# sourceMappingURL=criteria.interface.d.ts.map
@@ -0,0 +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,yB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AY,CAAC,CAAC;IAExC;;;;;;;;;;;;;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,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;CACzC"}
@@ -0,0 +1,2 @@
1
+ import { FilterOperator } from './operator.types.js';
2
+ //# sourceMappingURL=criteria.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"criteria.interface.js","sourceRoot":"","sources":["../../../src/criteria/types/criteria.interface.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { FilterGroupPrimitive, FilterPrimitive } from '../filter/types/filter-primitive.types.js';
2
+ import type { CriteriaSchema, FieldOfSchema } from './schema.types.js';
3
+ import type { FilterOperator } from './operator.types.js';
4
+ export interface IFilterExpression {
5
+ toPrimitive(): FilterPrimitive<FieldOfSchema<CriteriaSchema>, FilterOperator> | FilterGroupPrimitive;
6
+ }
7
+ //# sourceMappingURL=filter-expression.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-expression.interface.d.ts","sourceRoot":"","sources":["../../../src/criteria/types/filter-expression.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,WAAW,iBAAiB;IAChC,WAAW,IACP,eAAe,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,GAC9D,oBAAoB,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=filter-expression.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-expression.interface.js","sourceRoot":"","sources":["../../../src/criteria/types/filter-expression.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,54 @@
1
+ import type { CriteriaSchema, FieldOfSchema } from './schema.types.js';
2
+ /**
3
+ * Represents the input parameters for a many-to-many join via a pivot table.
4
+ * This is the shape the user provides to the .join() method.
5
+ * @template ParentSchema - The {@link CriteriaSchema} of the parent entity.
6
+ * @template JoinSchema - The {@link CriteriaSchema} of the entity to be joined.
7
+ */
8
+ export type PivotJoinInput<ParentSchema extends CriteriaSchema, JoinSchema extends CriteriaSchema> = {
9
+ /** The source name (table name) of the pivot table. */
10
+ pivot_source_name: string;
11
+ /** Configuration for the join field on the parent side, referencing the pivot table. */
12
+ parent_field: {
13
+ /** The field name in the pivot table that links to the parent schema. */
14
+ pivot_field: string;
15
+ /**
16
+ * The field name in the parent schema that the pivot table field references.
17
+ * Must be a valid field defined in `ParentSchema['fields']`.
18
+ * @see FieldOfSchema<ParentSchema>
19
+ */
20
+ reference: FieldOfSchema<ParentSchema>;
21
+ };
22
+ /** Configuration for the join field on the joined side, referencing the pivot table. */
23
+ join_field: {
24
+ /** The field name in the pivot table that links to the joined schema. */
25
+ pivot_field: string;
26
+ /**
27
+ * The field name in the joined schema that the pivot table field references.
28
+ * Must be a valid field defined in `JoinSchema['fields']`.
29
+ * @see FieldOfSchema<JoinSchema>
30
+ */
31
+ reference: FieldOfSchema<JoinSchema>;
32
+ };
33
+ };
34
+ /**
35
+ * Represents the input parameters for a simple join (one-to-one, one-to-many, many-to-one).
36
+ * This is the shape the user provides to the .join() method.
37
+ * @template ParentSchema - The {@link CriteriaSchema} of the parent entity.
38
+ * @template JoinSchema - The {@link CriteriaSchema} of the entity to be joined.
39
+ */
40
+ export type SimpleJoinInput<ParentSchema extends CriteriaSchema, JoinSchema extends CriteriaSchema> = {
41
+ /**
42
+ * The field name in the parent schema used for the join condition.
43
+ * Must be a valid field defined in `ParentSchema['fields']`.
44
+ * @see FieldOfSchema<ParentSchema>
45
+ */
46
+ parent_field: FieldOfSchema<ParentSchema>;
47
+ /**
48
+ * The field name in the joined schema used for the join condition.
49
+ * Must be a valid field defined in `JoinSchema['fields']`.
50
+ * @see FieldOfSchema<JoinSchema>
51
+ */
52
+ join_field: FieldOfSchema<JoinSchema>;
53
+ };
54
+ //# sourceMappingURL=join-input.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"join-input.types.d.ts","sourceRoot":"","sources":["../../../src/criteria/types/join-input.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CACxB,YAAY,SAAS,cAAc,EACnC,UAAU,SAAS,cAAc,IAC/B;IACF,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;CACH,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,CACzB,YAAY,SAAS,cAAc,EACnC,UAAU,SAAS,cAAc,IAC/B;IACF;;;;OAIG;IACH,YAAY,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAC1C;;;;OAIG;IACH,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;CACvC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=join-input.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"join-input.types.js","sourceRoot":"","sources":["../../../src/criteria/types/join-input.types.ts"],"names":[],"mappings":""}