@proofkit/fmodata 0.1.0-alpha.8 → 0.1.0-beta.23

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 (163) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +651 -449
  3. package/dist/esm/client/batch-builder.d.ts +10 -9
  4. package/dist/esm/client/batch-builder.js +119 -56
  5. package/dist/esm/client/batch-builder.js.map +1 -1
  6. package/dist/esm/client/batch-request.js +16 -21
  7. package/dist/esm/client/batch-request.js.map +1 -1
  8. package/dist/esm/client/builders/default-select.d.ts +10 -0
  9. package/dist/esm/client/builders/default-select.js +41 -0
  10. package/dist/esm/client/builders/default-select.js.map +1 -0
  11. package/dist/esm/client/builders/expand-builder.d.ts +45 -0
  12. package/dist/esm/client/builders/expand-builder.js +185 -0
  13. package/dist/esm/client/builders/expand-builder.js.map +1 -0
  14. package/dist/esm/client/builders/index.d.ts +9 -0
  15. package/dist/esm/client/builders/query-string-builder.d.ts +18 -0
  16. package/dist/esm/client/builders/query-string-builder.js +21 -0
  17. package/dist/esm/client/builders/query-string-builder.js.map +1 -0
  18. package/dist/esm/client/builders/response-processor.d.ts +43 -0
  19. package/dist/esm/client/builders/response-processor.js +175 -0
  20. package/dist/esm/client/builders/response-processor.js.map +1 -0
  21. package/dist/esm/client/builders/select-mixin.d.ts +25 -0
  22. package/dist/esm/client/builders/select-mixin.js +28 -0
  23. package/dist/esm/client/builders/select-mixin.js.map +1 -0
  24. package/dist/esm/client/builders/select-utils.d.ts +18 -0
  25. package/dist/esm/client/builders/select-utils.js +30 -0
  26. package/dist/esm/client/builders/select-utils.js.map +1 -0
  27. package/dist/esm/client/builders/shared-types.d.ts +40 -0
  28. package/dist/esm/client/builders/table-utils.d.ts +35 -0
  29. package/dist/esm/client/builders/table-utils.js +44 -0
  30. package/dist/esm/client/builders/table-utils.js.map +1 -0
  31. package/dist/esm/client/database.d.ts +34 -22
  32. package/dist/esm/client/database.js +48 -84
  33. package/dist/esm/client/database.js.map +1 -1
  34. package/dist/esm/client/delete-builder.d.ts +25 -30
  35. package/dist/esm/client/delete-builder.js +45 -30
  36. package/dist/esm/client/delete-builder.js.map +1 -1
  37. package/dist/esm/client/entity-set.d.ts +35 -43
  38. package/dist/esm/client/entity-set.js +110 -52
  39. package/dist/esm/client/entity-set.js.map +1 -1
  40. package/dist/esm/client/error-parser.d.ts +12 -0
  41. package/dist/esm/client/error-parser.js +25 -0
  42. package/dist/esm/client/error-parser.js.map +1 -0
  43. package/dist/esm/client/filemaker-odata.d.ts +26 -7
  44. package/dist/esm/client/filemaker-odata.js +65 -42
  45. package/dist/esm/client/filemaker-odata.js.map +1 -1
  46. package/dist/esm/client/insert-builder.d.ts +19 -24
  47. package/dist/esm/client/insert-builder.js +94 -58
  48. package/dist/esm/client/insert-builder.js.map +1 -1
  49. package/dist/esm/client/query/expand-builder.d.ts +35 -0
  50. package/dist/esm/client/query/index.d.ts +4 -0
  51. package/dist/esm/client/query/query-builder.d.ts +132 -0
  52. package/dist/esm/client/query/query-builder.js +456 -0
  53. package/dist/esm/client/query/query-builder.js.map +1 -0
  54. package/dist/esm/client/query/response-processor.d.ts +25 -0
  55. package/dist/esm/client/query/types.d.ts +77 -0
  56. package/dist/esm/client/query/url-builder.d.ts +71 -0
  57. package/dist/esm/client/query/url-builder.js +100 -0
  58. package/dist/esm/client/query/url-builder.js.map +1 -0
  59. package/dist/esm/client/query-builder.d.ts +2 -115
  60. package/dist/esm/client/record-builder.d.ts +108 -36
  61. package/dist/esm/client/record-builder.js +284 -119
  62. package/dist/esm/client/record-builder.js.map +1 -1
  63. package/dist/esm/client/response-processor.d.ts +4 -9
  64. package/dist/esm/client/sanitize-json.d.ts +35 -0
  65. package/dist/esm/client/sanitize-json.js +27 -0
  66. package/dist/esm/client/sanitize-json.js.map +1 -0
  67. package/dist/esm/client/schema-manager.d.ts +5 -5
  68. package/dist/esm/client/schema-manager.js +45 -31
  69. package/dist/esm/client/schema-manager.js.map +1 -1
  70. package/dist/esm/client/update-builder.d.ts +34 -40
  71. package/dist/esm/client/update-builder.js +99 -58
  72. package/dist/esm/client/update-builder.js.map +1 -1
  73. package/dist/esm/client/webhook-builder.d.ts +126 -0
  74. package/dist/esm/client/webhook-builder.js +189 -0
  75. package/dist/esm/client/webhook-builder.js.map +1 -0
  76. package/dist/esm/errors.d.ts +19 -2
  77. package/dist/esm/errors.js +39 -4
  78. package/dist/esm/errors.js.map +1 -1
  79. package/dist/esm/index.d.ts +10 -8
  80. package/dist/esm/index.js +40 -10
  81. package/dist/esm/index.js.map +1 -1
  82. package/dist/esm/logger.d.ts +47 -0
  83. package/dist/esm/logger.js +69 -0
  84. package/dist/esm/logger.js.map +1 -0
  85. package/dist/esm/logger.test.d.ts +1 -0
  86. package/dist/esm/orm/column.d.ts +62 -0
  87. package/dist/esm/orm/column.js +63 -0
  88. package/dist/esm/orm/column.js.map +1 -0
  89. package/dist/esm/orm/field-builders.d.ts +164 -0
  90. package/dist/esm/orm/field-builders.js +158 -0
  91. package/dist/esm/orm/field-builders.js.map +1 -0
  92. package/dist/esm/orm/index.d.ts +5 -0
  93. package/dist/esm/orm/operators.d.ts +173 -0
  94. package/dist/esm/orm/operators.js +260 -0
  95. package/dist/esm/orm/operators.js.map +1 -0
  96. package/dist/esm/orm/table.d.ts +355 -0
  97. package/dist/esm/orm/table.js +202 -0
  98. package/dist/esm/orm/table.js.map +1 -0
  99. package/dist/esm/transform.d.ts +20 -21
  100. package/dist/esm/transform.js +44 -45
  101. package/dist/esm/transform.js.map +1 -1
  102. package/dist/esm/types.d.ts +96 -30
  103. package/dist/esm/types.js +7 -0
  104. package/dist/esm/types.js.map +1 -0
  105. package/dist/esm/validation.d.ts +22 -12
  106. package/dist/esm/validation.js +132 -85
  107. package/dist/esm/validation.js.map +1 -1
  108. package/package.json +28 -20
  109. package/src/client/batch-builder.ts +153 -89
  110. package/src/client/batch-request.ts +25 -41
  111. package/src/client/builders/default-select.ts +75 -0
  112. package/src/client/builders/expand-builder.ts +246 -0
  113. package/src/client/builders/index.ts +11 -0
  114. package/src/client/builders/query-string-builder.ts +46 -0
  115. package/src/client/builders/response-processor.ts +279 -0
  116. package/src/client/builders/select-mixin.ts +65 -0
  117. package/src/client/builders/select-utils.ts +59 -0
  118. package/src/client/builders/shared-types.ts +45 -0
  119. package/src/client/builders/table-utils.ts +83 -0
  120. package/src/client/database.ts +89 -183
  121. package/src/client/delete-builder.ts +74 -84
  122. package/src/client/entity-set.ts +266 -293
  123. package/src/client/error-parser.ts +41 -0
  124. package/src/client/filemaker-odata.ts +98 -66
  125. package/src/client/insert-builder.ts +157 -118
  126. package/src/client/query/expand-builder.ts +160 -0
  127. package/src/client/query/index.ts +14 -0
  128. package/src/client/query/query-builder.ts +729 -0
  129. package/src/client/query/response-processor.ts +226 -0
  130. package/src/client/query/types.ts +126 -0
  131. package/src/client/query/url-builder.ts +151 -0
  132. package/src/client/query-builder.ts +10 -1455
  133. package/src/client/record-builder.ts +575 -240
  134. package/src/client/response-processor.ts +15 -42
  135. package/src/client/sanitize-json.ts +64 -0
  136. package/src/client/schema-manager.ts +61 -76
  137. package/src/client/update-builder.ts +161 -143
  138. package/src/client/webhook-builder.ts +265 -0
  139. package/src/errors.ts +49 -16
  140. package/src/index.ts +99 -54
  141. package/src/logger.test.ts +34 -0
  142. package/src/logger.ts +116 -0
  143. package/src/orm/column.ts +106 -0
  144. package/src/orm/field-builders.ts +250 -0
  145. package/src/orm/index.ts +61 -0
  146. package/src/orm/operators.ts +473 -0
  147. package/src/orm/table.ts +741 -0
  148. package/src/transform.ts +90 -70
  149. package/src/types.ts +154 -113
  150. package/src/validation.ts +200 -115
  151. package/dist/esm/client/base-table.d.ts +0 -125
  152. package/dist/esm/client/base-table.js +0 -57
  153. package/dist/esm/client/base-table.js.map +0 -1
  154. package/dist/esm/client/query-builder.js +0 -896
  155. package/dist/esm/client/query-builder.js.map +0 -1
  156. package/dist/esm/client/table-occurrence.d.ts +0 -72
  157. package/dist/esm/client/table-occurrence.js +0 -74
  158. package/dist/esm/client/table-occurrence.js.map +0 -1
  159. package/dist/esm/filter-types.d.ts +0 -76
  160. package/src/client/base-table.ts +0 -166
  161. package/src/client/query-builder.ts.bak +0 -1457
  162. package/src/client/table-occurrence.ts +0 -175
  163. package/src/filter-types.ts +0 -97
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,62 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
+ /**
3
+ * Column represents a type-safe reference to a table field.
4
+ * Used in queries, filters, and operators to provide autocomplete and type checking.
5
+ *
6
+ * @template TOutput - The TypeScript type when reading from the database (output type)
7
+ * @template TInput - The TypeScript type when writing to the database (input type, for filters)
8
+ * @template TableName - The table name as a string literal type (for validation)
9
+ * @template IsContainer - Whether this column represents a container field (cannot be selected)
10
+ */
11
+ export declare class Column<TOutput = any, TInput = TOutput, TableName extends string = string, IsContainer extends boolean = false> {
12
+ readonly fieldName: string;
13
+ readonly entityId?: `FMFID:${string}`;
14
+ readonly tableName: TableName;
15
+ readonly tableEntityId?: `FMTID:${string}`;
16
+ readonly inputValidator?: StandardSchemaV1<TInput, any>;
17
+ readonly _phantomOutput: TOutput;
18
+ readonly _phantomInput: TInput;
19
+ readonly _isContainer: IsContainer;
20
+ constructor(config: {
21
+ fieldName: string;
22
+ entityId?: `FMFID:${string}`;
23
+ tableName: TableName;
24
+ tableEntityId?: `FMTID:${string}`;
25
+ inputValidator?: StandardSchemaV1<TInput, any>;
26
+ });
27
+ /**
28
+ * Get the field identifier (entity ID if available, otherwise field name).
29
+ * Used when building OData queries.
30
+ */
31
+ getFieldIdentifier(useEntityIds?: boolean): string;
32
+ /**
33
+ * Get the table identifier (entity ID if available, otherwise table name).
34
+ * Used when building OData queries.
35
+ */
36
+ getTableIdentifier(useEntityIds?: boolean): string;
37
+ /**
38
+ * Check if this column is from a specific table.
39
+ * Useful for validation in cross-table operations.
40
+ */
41
+ isFromTable(tableName: string): boolean;
42
+ /**
43
+ * Create a string representation for debugging.
44
+ */
45
+ toString(): string;
46
+ }
47
+ /**
48
+ * Type guard to check if a value is a Column instance.
49
+ */
50
+ export declare function isColumn(value: any): value is Column<any, any, any, any>;
51
+ /**
52
+ * Create a Column with proper type inference from the inputValidator.
53
+ * This helper ensures TypeScript can infer TInput from the validator's input type.
54
+ * @internal
55
+ */
56
+ export declare function createColumn<TOutput, TInput, TName extends string, IsContainer extends boolean = false>(config: {
57
+ fieldName: string;
58
+ entityId?: `FMFID:${string}`;
59
+ tableName: TName;
60
+ tableEntityId?: `FMTID:${string}`;
61
+ inputValidator?: StandardSchemaV1<TInput, any>;
62
+ }): Column<TOutput, TInput, TName, IsContainer>;
@@ -0,0 +1,63 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ class Column {
5
+ constructor(config) {
6
+ __publicField(this, "fieldName");
7
+ __publicField(this, "entityId");
8
+ __publicField(this, "tableName");
9
+ __publicField(this, "tableEntityId");
10
+ // biome-ignore lint/suspicious/noExplicitAny: Required for type inference with infer
11
+ __publicField(this, "inputValidator");
12
+ // Phantom types for TypeScript inference - never actually hold values
13
+ __publicField(this, "_phantomOutput");
14
+ __publicField(this, "_phantomInput");
15
+ __publicField(this, "_isContainer");
16
+ this.fieldName = config.fieldName;
17
+ this.entityId = config.entityId;
18
+ this.tableName = config.tableName;
19
+ this.tableEntityId = config.tableEntityId;
20
+ this.inputValidator = config.inputValidator;
21
+ }
22
+ /**
23
+ * Get the field identifier (entity ID if available, otherwise field name).
24
+ * Used when building OData queries.
25
+ */
26
+ getFieldIdentifier(useEntityIds) {
27
+ if (useEntityIds && this.entityId) {
28
+ return this.entityId;
29
+ }
30
+ return this.fieldName;
31
+ }
32
+ /**
33
+ * Get the table identifier (entity ID if available, otherwise table name).
34
+ * Used when building OData queries.
35
+ */
36
+ getTableIdentifier(useEntityIds) {
37
+ if (useEntityIds && this.tableEntityId) {
38
+ return this.tableEntityId;
39
+ }
40
+ return this.tableName;
41
+ }
42
+ /**
43
+ * Check if this column is from a specific table.
44
+ * Useful for validation in cross-table operations.
45
+ */
46
+ isFromTable(tableName) {
47
+ return this.tableName === tableName;
48
+ }
49
+ /**
50
+ * Create a string representation for debugging.
51
+ */
52
+ toString() {
53
+ return `${this.tableName}.${this.fieldName}`;
54
+ }
55
+ }
56
+ function isColumn(value) {
57
+ return value instanceof Column;
58
+ }
59
+ export {
60
+ Column,
61
+ isColumn
62
+ };
63
+ //# sourceMappingURL=column.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column.js","sources":["../../../src/orm/column.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n/**\n * Column represents a type-safe reference to a table field.\n * Used in queries, filters, and operators to provide autocomplete and type checking.\n *\n * @template TOutput - The TypeScript type when reading from the database (output type)\n * @template TInput - The TypeScript type when writing to the database (input type, for filters)\n * @template TableName - The table name as a string literal type (for validation)\n * @template IsContainer - Whether this column represents a container field (cannot be selected)\n */\nexport class Column<\n // biome-ignore lint/suspicious/noExplicitAny: Default type parameter for flexibility\n TOutput = any,\n TInput = TOutput,\n TableName extends string = string,\n IsContainer extends boolean = false,\n> {\n readonly fieldName: string;\n readonly entityId?: `FMFID:${string}`;\n readonly tableName: TableName;\n readonly tableEntityId?: `FMTID:${string}`;\n // biome-ignore lint/suspicious/noExplicitAny: Required for type inference with infer\n readonly inputValidator?: StandardSchemaV1<TInput, any>;\n\n // Phantom types for TypeScript inference - never actually hold values\n readonly _phantomOutput!: TOutput;\n readonly _phantomInput!: TInput;\n readonly _isContainer!: IsContainer;\n\n constructor(config: {\n fieldName: string;\n entityId?: `FMFID:${string}`;\n tableName: TableName;\n tableEntityId?: `FMTID:${string}`;\n // biome-ignore lint/suspicious/noExplicitAny: Required for type inference with infer\n inputValidator?: StandardSchemaV1<TInput, any>;\n }) {\n this.fieldName = config.fieldName;\n this.entityId = config.entityId;\n this.tableName = config.tableName;\n this.tableEntityId = config.tableEntityId;\n this.inputValidator = config.inputValidator;\n }\n\n /**\n * Get the field identifier (entity ID if available, otherwise field name).\n * Used when building OData queries.\n */\n getFieldIdentifier(useEntityIds?: boolean): string {\n if (useEntityIds && this.entityId) {\n return this.entityId;\n }\n return this.fieldName;\n }\n\n /**\n * Get the table identifier (entity ID if available, otherwise table name).\n * Used when building OData queries.\n */\n getTableIdentifier(useEntityIds?: boolean): string {\n if (useEntityIds && this.tableEntityId) {\n return this.tableEntityId;\n }\n return this.tableName;\n }\n\n /**\n * Check if this column is from a specific table.\n * Useful for validation in cross-table operations.\n */\n isFromTable(tableName: string): boolean {\n return this.tableName === tableName;\n }\n\n /**\n * Create a string representation for debugging.\n */\n toString(): string {\n return `${this.tableName}.${this.fieldName}`;\n }\n}\n\n/**\n * Type guard to check if a value is a Column instance.\n */\n// biome-ignore lint/suspicious/noExplicitAny: Type guard accepting any value type, generic constraint accepting any Column configuration\nexport function isColumn(value: any): value is Column<any, any, any, any> {\n return value instanceof Column;\n}\n\n/**\n * Create a Column with proper type inference from the inputValidator.\n * This helper ensures TypeScript can infer TInput from the validator's input type.\n * @internal\n */\nexport function createColumn<TOutput, TInput, TName extends string, IsContainer extends boolean = false>(config: {\n fieldName: string;\n entityId?: `FMFID:${string}`;\n tableName: TName;\n tableEntityId?: `FMTID:${string}`;\n // biome-ignore lint/suspicious/noExplicitAny: Required for type inference with infer\n inputValidator?: StandardSchemaV1<TInput, any>;\n}): Column<TOutput, TInput, TName, IsContainer> {\n return new Column(config) as Column<TOutput, TInput, TName, IsContainer>;\n}\n"],"names":[],"mappings":";;;AAWO,MAAM,OAMX;AAAA,EAaA,YAAY,QAOT;AAnBM;AACA;AACA;AACA;AAEA;AAAA;AAGA;AAAA;AACA;AACA;AAUP,SAAK,YAAY,OAAO;AACxB,SAAK,WAAW,OAAO;AACvB,SAAK,YAAY,OAAO;AACxB,SAAK,gBAAgB,OAAO;AAC5B,SAAK,iBAAiB,OAAO;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/B,mBAAmB,cAAgC;AAC7C,QAAA,gBAAgB,KAAK,UAAU;AACjC,aAAO,KAAK;AAAA,IAAA;AAEd,WAAO,KAAK;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOd,mBAAmB,cAAgC;AAC7C,QAAA,gBAAgB,KAAK,eAAe;AACtC,aAAO,KAAK;AAAA,IAAA;AAEd,WAAO,KAAK;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOd,YAAY,WAA4B;AACtC,WAAO,KAAK,cAAc;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAM5B,WAAmB;AACjB,WAAO,GAAG,KAAK,SAAS,IAAI,KAAK,SAAS;AAAA,EAAA;AAE9C;AAMO,SAAS,SAAS,OAAiD;AACxE,SAAO,iBAAiB;AAC1B;"}
@@ -0,0 +1,164 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
+ /**
3
+ * Branded type for container field's database type.
4
+ * This allows TypeScript to distinguish container fields from regular string fields
5
+ * at the type level, enabling compile-time exclusion from select operations.
6
+ */
7
+ export type ContainerDbType = string & {
8
+ readonly __container: true;
9
+ };
10
+ /**
11
+ * FieldBuilder provides a fluent API for defining table fields with type-safe metadata.
12
+ * Supports chaining methods to configure primary keys, nullability, read-only status, entity IDs, and validators.
13
+ *
14
+ * @template TOutput - The output type after applying outputValidator (what you get when reading)
15
+ * @template TInput - The input type after applying inputValidator (what you pass when writing)
16
+ * @template TDbType - The database type (what FileMaker stores/expects)
17
+ * @template TReadOnly - Whether this field is read-only (for type-level exclusion from insert/update)
18
+ */
19
+ export declare class FieldBuilder<TOutput = any, TInput = TOutput, TDbType = TOutput, TReadOnly extends boolean = false> {
20
+ private _primaryKey;
21
+ private _notNull;
22
+ private _readOnly;
23
+ private _entityId?;
24
+ private _outputValidator?;
25
+ private _inputValidator?;
26
+ private readonly _fieldType;
27
+ private _comment?;
28
+ constructor(fieldType: string);
29
+ /**
30
+ * Mark this field as the primary key for the table.
31
+ * Primary keys are automatically read-only and non-nullable.
32
+ */
33
+ primaryKey(): FieldBuilder<NonNullable<TOutput>, NonNullable<TInput>, NonNullable<TDbType>, true>;
34
+ /**
35
+ * Mark this field as non-nullable.
36
+ * Updates the type to exclude null/undefined.
37
+ */
38
+ notNull(): FieldBuilder<NonNullable<TOutput>, NonNullable<TInput>, NonNullable<TDbType>, TReadOnly>;
39
+ /**
40
+ * Mark this field as read-only.
41
+ * Read-only fields are excluded from insert and update operations.
42
+ */
43
+ readOnly(): FieldBuilder<TOutput, TInput, TDbType, true>;
44
+ /**
45
+ * Assign a FileMaker field ID (FMFID) to this field.
46
+ * When useEntityIds is enabled, this ID will be used in API requests instead of the field name.
47
+ */
48
+ entityId(id: `FMFID:${string}`): FieldBuilder<TOutput, TInput, TDbType, TReadOnly>;
49
+ /**
50
+ * Set a validator for the output (reading from database).
51
+ * The output validator transforms/validates data coming FROM the database in list or get operations.
52
+ *
53
+ * @example
54
+ * numberField().readValidator(z.coerce.boolean())
55
+ * // FileMaker returns 0/1, you get true/false
56
+ */
57
+ readValidator<O, VInput = TDbType>(validator: StandardSchemaV1<VInput, O>): FieldBuilder<O, TInput, TDbType, TReadOnly>;
58
+ /**
59
+ * Set a validator for the input (writing to database).
60
+ * The input validator transforms/validates data going TO the database in insert, update, and filter operations.
61
+ *
62
+ * @example
63
+ * numberField().writeValidator(z.boolean().transform(v => v ? 1 : 0))
64
+ * // You pass true/false, FileMaker gets 1/0
65
+ */
66
+ writeValidator<I>(validator: StandardSchemaV1<I, TDbType>): FieldBuilder<TOutput, I, TDbType, TReadOnly>;
67
+ /**
68
+ * Add a comment to this field for metadata purposes.
69
+ * This helps future developers understand the purpose of the field.
70
+ *
71
+ * @example
72
+ * textField().comment("Account name of the user who last modified each record")
73
+ */
74
+ comment(comment: string): FieldBuilder<TOutput, TInput, TDbType, TReadOnly>;
75
+ /**
76
+ * Get the metadata configuration for this field.
77
+ * @internal Used by fmTableOccurrence to extract field configuration
78
+ */
79
+ _getConfig(): {
80
+ fieldType: string;
81
+ primaryKey: boolean;
82
+ notNull: boolean;
83
+ readOnly: boolean;
84
+ entityId: `FMFID:${string}` | undefined;
85
+ outputValidator: StandardSchemaV1<any, TOutput> | undefined;
86
+ inputValidator: StandardSchemaV1<TInput, any> | undefined;
87
+ comment: string | undefined;
88
+ };
89
+ /**
90
+ * Clone this builder to allow immutable chaining.
91
+ * @private
92
+ */
93
+ private _clone;
94
+ }
95
+ /**
96
+ * Create a text field (Edm.String in FileMaker OData).
97
+ * By default, text fields are nullable.
98
+ *
99
+ * @example
100
+ * textField() // string | null
101
+ * textField().notNull() // string
102
+ * textField().entityId("FMFID:1") // with entity ID
103
+ */
104
+ export declare function textField(): FieldBuilder<string | null, string | null, string | null, false>;
105
+ /**
106
+ * Create a number field (Edm.Decimal in FileMaker OData).
107
+ * By default, number fields are nullable.
108
+ *
109
+ * @example
110
+ * numberField() // number | null
111
+ * numberField().notNull() // number
112
+ * numberField().outputValidator(z.coerce.boolean()) // transform to boolean on read
113
+ */
114
+ export declare function numberField(): FieldBuilder<number | null, number | null, number | null, false>;
115
+ /**
116
+ * Create a date field (Edm.Date in FileMaker OData).
117
+ * By default, date fields are nullable and represented as ISO date strings (YYYY-MM-DD).
118
+ *
119
+ * @example
120
+ * dateField() // string | null (ISO date format)
121
+ * dateField().notNull() // string
122
+ */
123
+ export declare function dateField(): FieldBuilder<string | null, string | null, string | null, false>;
124
+ /**
125
+ * Create a time field (Edm.TimeOfDay in FileMaker OData).
126
+ * By default, time fields are nullable and represented as ISO time strings (HH:mm:ss).
127
+ *
128
+ * @example
129
+ * timeField() // string | null (ISO time format)
130
+ * timeField().notNull() // string
131
+ */
132
+ export declare function timeField(): FieldBuilder<string | null, string | null, string | null, false>;
133
+ /**
134
+ * Create a timestamp field (Edm.DateTimeOffset in FileMaker OData).
135
+ * By default, timestamp fields are nullable and represented as ISO 8601 strings.
136
+ *
137
+ * @example
138
+ * timestampField() // string | null (ISO 8601 format)
139
+ * timestampField().notNull() // string
140
+ * timestampField().readOnly() // typical for CreationTimestamp
141
+ */
142
+ export declare function timestampField(): FieldBuilder<string | null, string | null, string | null, false>;
143
+ /**
144
+ * Create a container field (Edm.Stream in FileMaker OData).
145
+ * Container fields store binary data and are represented as base64 strings in the API.
146
+ * By default, container fields are nullable.
147
+ *
148
+ * Note: Container fields cannot be selected via .select() - they can only be accessed
149
+ * via .getSingleField() due to FileMaker OData API limitations.
150
+ *
151
+ * @example
152
+ * containerField() // string | null (base64 encoded)
153
+ * containerField().notNull() // string
154
+ */
155
+ export declare function containerField(): FieldBuilder<string | null, string | null, ContainerDbType | null, false>;
156
+ /**
157
+ * Create a calculated field (read-only field computed by FileMaker).
158
+ * Calculated fields are automatically marked as read-only.
159
+ *
160
+ * @example
161
+ * calcField() // string | null
162
+ * calcField().notNull() // string
163
+ */
164
+ export declare function calcField(): FieldBuilder<string | null, string | null, string | null, true>;
@@ -0,0 +1,158 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ class FieldBuilder {
5
+ constructor(fieldType) {
6
+ __publicField(this, "_primaryKey", false);
7
+ __publicField(this, "_notNull", false);
8
+ __publicField(this, "_readOnly", false);
9
+ __publicField(this, "_entityId");
10
+ // biome-ignore lint/suspicious/noExplicitAny: Required for type inference with infer
11
+ __publicField(this, "_outputValidator");
12
+ // biome-ignore lint/suspicious/noExplicitAny: Required for type inference with infer
13
+ __publicField(this, "_inputValidator");
14
+ __publicField(this, "_fieldType");
15
+ __publicField(this, "_comment");
16
+ this._fieldType = fieldType;
17
+ }
18
+ /**
19
+ * Mark this field as the primary key for the table.
20
+ * Primary keys are automatically read-only and non-nullable.
21
+ */
22
+ primaryKey() {
23
+ const builder = this._clone();
24
+ builder._primaryKey = true;
25
+ builder._notNull = true;
26
+ builder._readOnly = true;
27
+ return builder;
28
+ }
29
+ /**
30
+ * Mark this field as non-nullable.
31
+ * Updates the type to exclude null/undefined.
32
+ */
33
+ notNull() {
34
+ const builder = this._clone();
35
+ builder._notNull = true;
36
+ return builder;
37
+ }
38
+ /**
39
+ * Mark this field as read-only.
40
+ * Read-only fields are excluded from insert and update operations.
41
+ */
42
+ readOnly() {
43
+ const builder = this._clone();
44
+ builder._readOnly = true;
45
+ return builder;
46
+ }
47
+ /**
48
+ * Assign a FileMaker field ID (FMFID) to this field.
49
+ * When useEntityIds is enabled, this ID will be used in API requests instead of the field name.
50
+ */
51
+ entityId(id) {
52
+ const builder = this._clone();
53
+ builder._entityId = id;
54
+ return builder;
55
+ }
56
+ /**
57
+ * Set a validator for the output (reading from database).
58
+ * The output validator transforms/validates data coming FROM the database in list or get operations.
59
+ *
60
+ * @example
61
+ * numberField().readValidator(z.coerce.boolean())
62
+ * // FileMaker returns 0/1, you get true/false
63
+ */
64
+ readValidator(validator) {
65
+ const builder = this._clone();
66
+ builder._outputValidator = validator;
67
+ return builder;
68
+ }
69
+ /**
70
+ * Set a validator for the input (writing to database).
71
+ * The input validator transforms/validates data going TO the database in insert, update, and filter operations.
72
+ *
73
+ * @example
74
+ * numberField().writeValidator(z.boolean().transform(v => v ? 1 : 0))
75
+ * // You pass true/false, FileMaker gets 1/0
76
+ */
77
+ writeValidator(validator) {
78
+ const builder = this._clone();
79
+ builder._inputValidator = validator;
80
+ return builder;
81
+ }
82
+ /**
83
+ * Add a comment to this field for metadata purposes.
84
+ * This helps future developers understand the purpose of the field.
85
+ *
86
+ * @example
87
+ * textField().comment("Account name of the user who last modified each record")
88
+ */
89
+ comment(comment) {
90
+ const builder = this._clone();
91
+ builder._comment = comment;
92
+ return builder;
93
+ }
94
+ /**
95
+ * Get the metadata configuration for this field.
96
+ * @internal Used by fmTableOccurrence to extract field configuration
97
+ */
98
+ _getConfig() {
99
+ return {
100
+ fieldType: this._fieldType,
101
+ primaryKey: this._primaryKey,
102
+ notNull: this._notNull,
103
+ readOnly: this._readOnly,
104
+ entityId: this._entityId,
105
+ outputValidator: this._outputValidator,
106
+ inputValidator: this._inputValidator,
107
+ comment: this._comment
108
+ };
109
+ }
110
+ /**
111
+ * Clone this builder to allow immutable chaining.
112
+ * @private
113
+ */
114
+ _clone() {
115
+ const builder = new FieldBuilder(this._fieldType);
116
+ builder._primaryKey = this._primaryKey;
117
+ builder._notNull = this._notNull;
118
+ builder._readOnly = this._readOnly;
119
+ builder._entityId = this._entityId;
120
+ builder._outputValidator = this._outputValidator;
121
+ builder._inputValidator = this._inputValidator;
122
+ builder._comment = this._comment;
123
+ return builder;
124
+ }
125
+ }
126
+ function textField() {
127
+ return new FieldBuilder("text");
128
+ }
129
+ function numberField() {
130
+ return new FieldBuilder("number");
131
+ }
132
+ function dateField() {
133
+ return new FieldBuilder("date");
134
+ }
135
+ function timeField() {
136
+ return new FieldBuilder("time");
137
+ }
138
+ function timestampField() {
139
+ return new FieldBuilder("timestamp");
140
+ }
141
+ function containerField() {
142
+ return new FieldBuilder("container");
143
+ }
144
+ function calcField() {
145
+ const builder = new FieldBuilder("calculated");
146
+ return builder.readOnly();
147
+ }
148
+ export {
149
+ FieldBuilder,
150
+ calcField,
151
+ containerField,
152
+ dateField,
153
+ numberField,
154
+ textField,
155
+ timeField,
156
+ timestampField
157
+ };
158
+ //# sourceMappingURL=field-builders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-builders.js","sources":["../../../src/orm/field-builders.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n/**\n * Branded type for container field's database type.\n * This allows TypeScript to distinguish container fields from regular string fields\n * at the type level, enabling compile-time exclusion from select operations.\n */\nexport type ContainerDbType = string & { readonly __container: true };\n\n/**\n * FieldBuilder provides a fluent API for defining table fields with type-safe metadata.\n * Supports chaining methods to configure primary keys, nullability, read-only status, entity IDs, and validators.\n *\n * @template TOutput - The output type after applying outputValidator (what you get when reading)\n * @template TInput - The input type after applying inputValidator (what you pass when writing)\n * @template TDbType - The database type (what FileMaker stores/expects)\n * @template TReadOnly - Whether this field is read-only (for type-level exclusion from insert/update)\n */\n// biome-ignore lint/suspicious/noExplicitAny: Default type parameter for flexibility\nexport class FieldBuilder<TOutput = any, TInput = TOutput, TDbType = TOutput, TReadOnly extends boolean = false> {\n private _primaryKey = false;\n private _notNull = false;\n private _readOnly = false;\n private _entityId?: `FMFID:${string}`;\n // biome-ignore lint/suspicious/noExplicitAny: Required for type inference with infer\n private _outputValidator?: StandardSchemaV1<any, TOutput>;\n // biome-ignore lint/suspicious/noExplicitAny: Required for type inference with infer\n private _inputValidator?: StandardSchemaV1<TInput, any>;\n private readonly _fieldType: string;\n private _comment?: string;\n\n constructor(fieldType: string) {\n this._fieldType = fieldType;\n }\n\n /**\n * Mark this field as the primary key for the table.\n * Primary keys are automatically read-only and non-nullable.\n */\n primaryKey(): FieldBuilder<NonNullable<TOutput>, NonNullable<TInput>, NonNullable<TDbType>, true> {\n // biome-ignore lint/suspicious/noExplicitAny: Type assertion for internal class mutation\n const builder = this._clone() as any;\n builder._primaryKey = true;\n builder._notNull = true; // Primary keys are automatically non-nullable\n builder._readOnly = true; // Primary keys are automatically read-only\n return builder;\n }\n\n /**\n * Mark this field as non-nullable.\n * Updates the type to exclude null/undefined.\n */\n notNull(): FieldBuilder<NonNullable<TOutput>, NonNullable<TInput>, NonNullable<TDbType>, TReadOnly> {\n // biome-ignore lint/suspicious/noExplicitAny: Type assertion for internal class mutation\n const builder = this._clone() as any;\n builder._notNull = true;\n return builder;\n }\n\n /**\n * Mark this field as read-only.\n * Read-only fields are excluded from insert and update operations.\n */\n readOnly(): FieldBuilder<TOutput, TInput, TDbType, true> {\n // biome-ignore lint/suspicious/noExplicitAny: Type assertion for internal class mutation\n const builder = this._clone() as any;\n builder._readOnly = true;\n return builder;\n }\n\n /**\n * Assign a FileMaker field ID (FMFID) to this field.\n * When useEntityIds is enabled, this ID will be used in API requests instead of the field name.\n */\n entityId(id: `FMFID:${string}`): FieldBuilder<TOutput, TInput, TDbType, TReadOnly> {\n const builder = this._clone();\n builder._entityId = id;\n return builder;\n }\n\n /**\n * Set a validator for the output (reading from database).\n * The output validator transforms/validates data coming FROM the database in list or get operations.\n *\n * @example\n * numberField().readValidator(z.coerce.boolean())\n * // FileMaker returns 0/1, you get true/false\n */\n readValidator<O, VInput = TDbType>(\n validator: StandardSchemaV1<VInput, O>,\n ): FieldBuilder<O, TInput, TDbType, TReadOnly> {\n // biome-ignore lint/suspicious/noExplicitAny: Type assertion for internal class mutation\n const builder = this._clone() as any;\n builder._outputValidator = validator;\n return builder;\n }\n\n /**\n * Set a validator for the input (writing to database).\n * The input validator transforms/validates data going TO the database in insert, update, and filter operations.\n *\n * @example\n * numberField().writeValidator(z.boolean().transform(v => v ? 1 : 0))\n * // You pass true/false, FileMaker gets 1/0\n */\n writeValidator<I>(validator: StandardSchemaV1<I, TDbType>): FieldBuilder<TOutput, I, TDbType, TReadOnly> {\n // biome-ignore lint/suspicious/noExplicitAny: Type assertion for internal class mutation\n const builder = this._clone() as any;\n builder._inputValidator = validator;\n return builder;\n }\n\n /**\n * Add a comment to this field for metadata purposes.\n * This helps future developers understand the purpose of the field.\n *\n * @example\n * textField().comment(\"Account name of the user who last modified each record\")\n */\n comment(comment: string): FieldBuilder<TOutput, TInput, TDbType, TReadOnly> {\n const builder = this._clone();\n builder._comment = comment;\n return builder;\n }\n\n /**\n * Get the metadata configuration for this field.\n * @internal Used by fmTableOccurrence to extract field configuration\n */\n _getConfig() {\n return {\n fieldType: this._fieldType,\n primaryKey: this._primaryKey,\n notNull: this._notNull,\n readOnly: this._readOnly,\n entityId: this._entityId,\n outputValidator: this._outputValidator,\n inputValidator: this._inputValidator,\n comment: this._comment,\n };\n }\n\n /**\n * Clone this builder to allow immutable chaining.\n * @private\n */\n private _clone(): FieldBuilder<TOutput, TInput, TDbType, TReadOnly> {\n const builder = new FieldBuilder<TOutput, TInput, TDbType, TReadOnly>(this._fieldType);\n builder._primaryKey = this._primaryKey;\n builder._notNull = this._notNull;\n builder._readOnly = this._readOnly;\n builder._entityId = this._entityId;\n builder._outputValidator = this._outputValidator;\n builder._inputValidator = this._inputValidator;\n builder._comment = this._comment;\n return builder;\n }\n}\n\n/**\n * Create a text field (Edm.String in FileMaker OData).\n * By default, text fields are nullable.\n *\n * @example\n * textField() // string | null\n * textField().notNull() // string\n * textField().entityId(\"FMFID:1\") // with entity ID\n */\nexport function textField(): FieldBuilder<string | null, string | null, string | null, false> {\n return new FieldBuilder<string | null, string | null, string | null, false>(\"text\");\n}\n\n/**\n * Create a number field (Edm.Decimal in FileMaker OData).\n * By default, number fields are nullable.\n *\n * @example\n * numberField() // number | null\n * numberField().notNull() // number\n * numberField().outputValidator(z.coerce.boolean()) // transform to boolean on read\n */\nexport function numberField(): FieldBuilder<number | null, number | null, number | null, false> {\n return new FieldBuilder<number | null, number | null, number | null, false>(\"number\");\n}\n\n/**\n * Create a date field (Edm.Date in FileMaker OData).\n * By default, date fields are nullable and represented as ISO date strings (YYYY-MM-DD).\n *\n * @example\n * dateField() // string | null (ISO date format)\n * dateField().notNull() // string\n */\nexport function dateField(): FieldBuilder<string | null, string | null, string | null, false> {\n return new FieldBuilder<string | null, string | null, string | null, false>(\"date\");\n}\n\n/**\n * Create a time field (Edm.TimeOfDay in FileMaker OData).\n * By default, time fields are nullable and represented as ISO time strings (HH:mm:ss).\n *\n * @example\n * timeField() // string | null (ISO time format)\n * timeField().notNull() // string\n */\nexport function timeField(): FieldBuilder<string | null, string | null, string | null, false> {\n return new FieldBuilder<string | null, string | null, string | null, false>(\"time\");\n}\n\n/**\n * Create a timestamp field (Edm.DateTimeOffset in FileMaker OData).\n * By default, timestamp fields are nullable and represented as ISO 8601 strings.\n *\n * @example\n * timestampField() // string | null (ISO 8601 format)\n * timestampField().notNull() // string\n * timestampField().readOnly() // typical for CreationTimestamp\n */\nexport function timestampField(): FieldBuilder<string | null, string | null, string | null, false> {\n return new FieldBuilder<string | null, string | null, string | null, false>(\"timestamp\");\n}\n\n/**\n * Create a container field (Edm.Stream in FileMaker OData).\n * Container fields store binary data and are represented as base64 strings in the API.\n * By default, container fields are nullable.\n *\n * Note: Container fields cannot be selected via .select() - they can only be accessed\n * via .getSingleField() due to FileMaker OData API limitations.\n *\n * @example\n * containerField() // string | null (base64 encoded)\n * containerField().notNull() // string\n */\nexport function containerField(): FieldBuilder<string | null, string | null, ContainerDbType | null, false> {\n return new FieldBuilder<string | null, string | null, ContainerDbType | null, false>(\"container\");\n}\n\n/**\n * Create a calculated field (read-only field computed by FileMaker).\n * Calculated fields are automatically marked as read-only.\n *\n * @example\n * calcField() // string | null\n * calcField().notNull() // string\n */\nexport function calcField(): FieldBuilder<string | null, string | null, string | null, true> {\n const builder = new FieldBuilder<string | null, string | null, string | null, false>(\"calculated\");\n return builder.readOnly();\n}\n"],"names":[],"mappings":";;;AAmBO,MAAM,aAAoG;AAAA,EAY/G,YAAY,WAAmB;AAXvB,uCAAc;AACd,oCAAW;AACX,qCAAY;AACZ;AAEA;AAAA;AAEA;AAAA;AACS;AACT;AAGN,SAAK,aAAa;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpB,aAAkG;AAE1F,UAAA,UAAU,KAAK,OAAO;AAC5B,YAAQ,cAAc;AACtB,YAAQ,WAAW;AACnB,YAAQ,YAAY;AACb,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,UAAoG;AAE5F,UAAA,UAAU,KAAK,OAAO;AAC5B,YAAQ,WAAW;AACZ,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAyD;AAEjD,UAAA,UAAU,KAAK,OAAO;AAC5B,YAAQ,YAAY;AACb,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,SAAS,IAA0E;AAC3E,UAAA,UAAU,KAAK,OAAO;AAC5B,YAAQ,YAAY;AACb,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWT,cACE,WAC6C;AAEvC,UAAA,UAAU,KAAK,OAAO;AAC5B,YAAQ,mBAAmB;AACpB,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWT,eAAkB,WAAuF;AAEjG,UAAA,UAAU,KAAK,OAAO;AAC5B,YAAQ,kBAAkB;AACnB,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUT,QAAQ,SAAoE;AACpE,UAAA,UAAU,KAAK,OAAO;AAC5B,YAAQ,WAAW;AACZ,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,aAAa;AACJ,WAAA;AAAA,MACL,WAAW,KAAK;AAAA,MAChB,YAAY,KAAK;AAAA,MACjB,SAAS,KAAK;AAAA,MACd,UAAU,KAAK;AAAA,MACf,UAAU,KAAK;AAAA,MACf,iBAAiB,KAAK;AAAA,MACtB,gBAAgB,KAAK;AAAA,MACrB,SAAS,KAAK;AAAA,IAChB;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOM,SAA4D;AAClE,UAAM,UAAU,IAAI,aAAkD,KAAK,UAAU;AACrF,YAAQ,cAAc,KAAK;AAC3B,YAAQ,WAAW,KAAK;AACxB,YAAQ,YAAY,KAAK;AACzB,YAAQ,YAAY,KAAK;AACzB,YAAQ,mBAAmB,KAAK;AAChC,YAAQ,kBAAkB,KAAK;AAC/B,YAAQ,WAAW,KAAK;AACjB,WAAA;AAAA,EAAA;AAEX;AAWO,SAAS,YAA8E;AACrF,SAAA,IAAI,aAAiE,MAAM;AACpF;AAWO,SAAS,cAAgF;AACvF,SAAA,IAAI,aAAiE,QAAQ;AACtF;AAUO,SAAS,YAA8E;AACrF,SAAA,IAAI,aAAiE,MAAM;AACpF;AAUO,SAAS,YAA8E;AACrF,SAAA,IAAI,aAAiE,MAAM;AACpF;AAWO,SAAS,iBAAmF;AAC1F,SAAA,IAAI,aAAiE,WAAW;AACzF;AAcO,SAAS,iBAA4F;AACnG,SAAA,IAAI,aAA0E,WAAW;AAClG;AAUO,SAAS,YAA6E;AACrF,QAAA,UAAU,IAAI,aAAiE,YAAY;AACjG,SAAO,QAAQ,SAAS;AAC1B;"}
@@ -0,0 +1,5 @@
1
+ /** biome-ignore-all lint/performance/noBarrelFile: Re-exporting all ORM utilities */
2
+ export { Column, isColumn } from './column.js';
3
+ export { type ContainerDbType, calcField, containerField, dateField, FieldBuilder, numberField, textField, timeField, timestampField, } from './field-builders.js';
4
+ export { and, asc, contains, desc, endsWith, eq, FilterExpression, gt, gte, inArray, isNotNull, isNull, isOrderByExpression, lt, lte, ne, not, notInArray, OrderByExpression, or, startsWith, } from './operators.js';
5
+ export { FMTable, type FMTableWithColumns, fmTableOccurrence, getBaseTableConfig, getDefaultSelect, getFieldId, getFieldName, getTableColumns, getTableEntityId, getTableId, getTableName, type InferTableSchema, isUsingEntityIds, } from './table.js';
@@ -0,0 +1,173 @@
1
+ import { Column } from './column.js';
2
+ /**
3
+ * FilterExpression represents a filter condition that can be used in where() clauses.
4
+ * Internal representation of operator expressions that get converted to OData filter syntax.
5
+ */
6
+ export declare class FilterExpression {
7
+ readonly operator: string;
8
+ readonly operands: (Column | any | FilterExpression)[];
9
+ constructor(operator: string, operands: (Column | any | FilterExpression)[]);
10
+ /**
11
+ * Convert this expression to OData filter syntax.
12
+ * @internal Used by QueryBuilder
13
+ */
14
+ toODataFilter(useEntityIds?: boolean): string;
15
+ private _binaryOp;
16
+ private _functionOp;
17
+ private _inOp;
18
+ private _notInOp;
19
+ private _isNullOp;
20
+ private _isNotNullOp;
21
+ private _logicalOp;
22
+ private _notOp;
23
+ private _operandToString;
24
+ }
25
+ /**
26
+ * Equal operator - checks if column equals a value or another column.
27
+ *
28
+ * @example
29
+ * eq(users.name, "John") // name equals "John"
30
+ * eq(users.id, contacts.id_user) // cross-table comparison
31
+ */
32
+ export declare function eq<TOutput, TInput>(column1: Column<TOutput, TInput>, column2: Column<TOutput, TInput> | NoInfer<TInput>): FilterExpression;
33
+ /**
34
+ * Not equal operator - checks if column does not equal a value or another column.
35
+ *
36
+ * @example
37
+ * ne(users.status, "inactive") // status not equal to "inactive"
38
+ * ne(users.id, contacts.id_user) // cross-table comparison
39
+ */
40
+ export declare function ne<TOutput, TInput>(column1: Column<TOutput, TInput>, column2: Column<TOutput, TInput> | NoInfer<TInput>): FilterExpression;
41
+ /**
42
+ * Greater than operator - checks if column is greater than a value.
43
+ *
44
+ * @example
45
+ * gt(users.age, 18) // age greater than 18
46
+ */
47
+ export declare function gt<TOutput extends number | string | Date | null, TInput>(column: Column<TOutput, TInput>, value: NoInfer<TInput>): FilterExpression;
48
+ /**
49
+ * Greater than or equal operator - checks if column is >= a value.
50
+ *
51
+ * @example
52
+ * gte(users.age, 18) // age >= 18
53
+ */
54
+ export declare function gte<TOutput extends number | string | Date | null, TInput>(column: Column<TOutput, TInput>, value: NoInfer<TInput>): FilterExpression;
55
+ /**
56
+ * Less than operator - checks if column is less than a value.
57
+ *
58
+ * @example
59
+ * lt(users.age, 65) // age less than 65
60
+ */
61
+ export declare function lt<TOutput extends number | string | Date | null, TInput>(column: Column<TOutput, TInput>, value: NoInfer<TInput>): FilterExpression;
62
+ /**
63
+ * Less than or equal operator - checks if column is <= a value.
64
+ *
65
+ * @example
66
+ * lte(users.age, 65) // age <= 65
67
+ */
68
+ export declare function lte<TOutput extends number | string | Date | null, TInput>(column: Column<TOutput, TInput>, value: NoInfer<TInput>): FilterExpression;
69
+ /**
70
+ * Contains operator - checks if a string column contains a substring.
71
+ *
72
+ * @example
73
+ * contains(users.name, "John") // name contains "John"
74
+ */
75
+ export declare function contains<TOutput, TInput>(column: Column<TOutput, TInput>, value: NoInfer<TInput>): FilterExpression;
76
+ /**
77
+ * Starts with operator - checks if a string column starts with a prefix.
78
+ *
79
+ * @example
80
+ * startsWith(users.email, "admin") // email starts with "admin"
81
+ */
82
+ export declare function startsWith<TOutput, TInput>(column: Column<TOutput, TInput>, value: NoInfer<TInput>): FilterExpression;
83
+ /**
84
+ * Ends with operator - checks if a string column ends with a suffix.
85
+ *
86
+ * @example
87
+ * endsWith(users.email, "@example.com") // email ends with "@example.com"
88
+ */
89
+ export declare function endsWith<TOutput, TInput>(column: Column<TOutput, TInput>, value: NoInfer<TInput>): FilterExpression;
90
+ /**
91
+ * In array operator - checks if column value is in an array of values.
92
+ *
93
+ * @example
94
+ * inArray(users.status, ["active", "pending"]) // status is "active" or "pending"
95
+ */
96
+ export declare function inArray<TOutput, TInput>(column: Column<TOutput, TInput>, values: NoInfer<TInput>[]): FilterExpression;
97
+ /**
98
+ * Not in array operator - checks if column value is not in an array of values.
99
+ *
100
+ * @example
101
+ * notInArray(users.status, ["deleted", "banned"]) // status is neither "deleted" nor "banned"
102
+ */
103
+ export declare function notInArray<TOutput, TInput>(column: Column<TOutput, TInput>, values: NoInfer<TInput>[]): FilterExpression;
104
+ /**
105
+ * Is null operator - checks if column value is null.
106
+ *
107
+ * @example
108
+ * isNull(users.deletedAt) // deletedAt is null
109
+ */
110
+ export declare function isNull<TOutput, TInput>(column: Column<TOutput, TInput>): FilterExpression;
111
+ /**
112
+ * Is not null operator - checks if column value is not null.
113
+ *
114
+ * @example
115
+ * isNotNull(users.email) // email is not null
116
+ */
117
+ export declare function isNotNull<TOutput, TInput>(column: Column<TOutput, TInput>): FilterExpression;
118
+ /**
119
+ * AND operator - combines multiple filter expressions with logical AND.
120
+ * All expressions must be true for the record to match.
121
+ *
122
+ * @example
123
+ * and(
124
+ * eq(users.active, true),
125
+ * gt(users.age, 18)
126
+ * ) // active is true AND age > 18
127
+ */
128
+ export declare function and(...expressions: FilterExpression[]): FilterExpression;
129
+ /**
130
+ * OR operator - combines multiple filter expressions with logical OR.
131
+ * At least one expression must be true for the record to match.
132
+ *
133
+ * @example
134
+ * or(
135
+ * eq(users.role, "admin"),
136
+ * eq(users.role, "moderator")
137
+ * ) // role is "admin" OR "moderator"
138
+ */
139
+ export declare function or(...expressions: FilterExpression[]): FilterExpression;
140
+ /**
141
+ * NOT operator - negates a filter expression.
142
+ *
143
+ * @example
144
+ * not(eq(users.status, "deleted")) // status is NOT "deleted"
145
+ */
146
+ export declare function not(expression: FilterExpression): FilterExpression;
147
+ /**
148
+ * OrderByExpression represents a sort order specification for a column.
149
+ * Used in orderBy() clauses to provide type-safe sorting with direction.
150
+ */
151
+ export declare class OrderByExpression<TableName extends string = string> {
152
+ readonly column: Column<any, any, TableName>;
153
+ readonly direction: "asc" | "desc";
154
+ constructor(column: Column<any, any, TableName>, direction: "asc" | "desc");
155
+ }
156
+ /**
157
+ * Type guard to check if a value is an OrderByExpression instance.
158
+ */
159
+ export declare function isOrderByExpression(value: any): value is OrderByExpression;
160
+ /**
161
+ * Ascending order operator - sorts a column in ascending order.
162
+ *
163
+ * @example
164
+ * asc(users.name) // Sort by name ascending
165
+ */
166
+ export declare function asc<TableName extends string>(column: Column<any, any, TableName>): OrderByExpression<TableName>;
167
+ /**
168
+ * Descending order operator - sorts a column in descending order.
169
+ *
170
+ * @example
171
+ * desc(users.age) // Sort by age descending
172
+ */
173
+ export declare function desc<TableName extends string>(column: Column<any, any, TableName>): OrderByExpression<TableName>;