@syntropix/database 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,19 +1,4 @@
1
- declare class ClientConfig {
2
- apiKey?: string;
3
- baseUrl?: string;
4
- timeout?: number;
5
- retries?: number;
6
- constructor(config?: any);
7
- }
8
-
9
- declare class Client {
10
- protected config: ClientConfig;
11
- constructor(config: ClientConfig);
12
- private headers;
13
- private url;
14
- get(path: string, data?: Record<string, any>): Promise<Record<string, any>>;
15
- post(path: string, data?: Record<string, any>): Promise<Record<string, any>>;
16
- }
1
+ import { ObjectId } from 'bson';
17
2
 
18
3
  interface StringType {
19
4
  String: number;
@@ -33,54 +18,111 @@ interface MoneyType {
33
18
  interface DecimalType {
34
19
  Decimal: [number, number] | null;
35
20
  }
36
- type ArrayDataTypeMap = typeof ArrayDataType;
37
- type ArrayDataTypeValues = ArrayDataTypeMap[keyof ArrayDataTypeMap];
38
- type ArrayDataTypeReturnTypes = ReturnType<Extract<ArrayDataTypeValues, (...args: any[]) => any>>;
39
- declare const ArrayDataType: {
40
- readonly String: (maxLength: number) => StringType;
41
- readonly Text: "Text";
42
- readonly Integer: "Integer";
43
- readonly BigInteger: "BigInteger";
44
- readonly Double: "Double";
45
- readonly Decimal: (precision: number, scale: number) => DecimalType;
46
- readonly DateTime: "DateTime";
47
- readonly Timestamp: "Timestamp";
48
- readonly Date: "Date";
49
- readonly Boolean: "Boolean";
50
- readonly Money: (precision: number, scale: number) => MoneyType;
51
- readonly Uuid: "Uuid";
52
- readonly Enum: (name: string, variants: string[]) => EnumType;
53
- readonly Json: "Json";
54
- };
55
- type ArrayDataType = Exclude<ArrayDataTypeValues, (...args: any[]) => any> | ArrayDataTypeReturnTypes;
56
21
  interface ArrayType {
57
- Array: ArrayDataType;
22
+ Array: ArrayDataTypeSchema;
58
23
  }
59
- type DataTypeMap = typeof ColumnDataType;
60
- type DataTypeValues = DataTypeMap[keyof DataTypeMap];
61
- type DataTypeReturnTypes = ReturnType<Extract<DataTypeValues, (...args: any[]) => any>>;
62
- declare const ColumnDataType: {
63
- readonly Integer: "Integer";
64
- readonly String: (maxLength: number) => StringType;
65
- readonly Text: "Text";
66
- readonly Boolean: "Boolean";
67
- readonly DateTime: "DateTime";
68
- readonly Timestamp: "Timestamp";
69
- readonly Date: "Date";
70
- readonly Json: "Json";
71
- readonly Uuid: "Uuid";
72
- readonly Double: "Double";
73
- readonly Vector: (dimensions: number) => VectorType;
74
- readonly Array: (dataType: ArrayDataType) => ArrayType;
75
- readonly Enum: (name: string, variants: string[]) => EnumType;
76
- readonly Money: (precision: number, scale: number) => MoneyType;
77
- readonly Decimal: (precision: number, scale: number) => DecimalType;
24
+ type ArrayDataTypeSchema = StringType | DecimalType | MoneyType | EnumType | 'Text' | 'Integer' | 'BigInteger' | 'Double' | 'DateTime' | 'Timestamp' | 'Date' | 'Boolean' | 'Uuid' | 'Json';
25
+ type ColumnDataTypeSchema = StringType | VectorType | ArrayType | EnumType | MoneyType | DecimalType | 'Text' | 'Integer' | 'BigInteger' | 'Double' | 'DateTime' | 'Timestamp' | 'Date' | 'Boolean' | 'Uuid' | 'Json';
26
+
27
+ declare const AccessType: {
28
+ readonly None: "None";
29
+ readonly Read: "Read";
30
+ readonly Write: "Write";
31
+ readonly Admin: "Admin";
78
32
  };
79
- type ColumnDataType = Exclude<DataTypeValues, (...args: any[]) => any> | DataTypeReturnTypes;
33
+ type AccessType = (typeof AccessType)[keyof typeof AccessType];
34
+
35
+ interface SyntropixDBColumn {
36
+ id: string;
37
+ name: string;
38
+ displayName: string;
39
+ description: string;
40
+ columnType: ColumnDataTypeSchema;
41
+ isPrimaryKey: boolean;
42
+ isNullable: boolean;
43
+ autoIncrement: boolean;
44
+ default: any | null;
45
+ defaultAccess: AccessType | null;
46
+ }
47
+ interface ColumnCreateOptions {
48
+ type?: ColumnDataTypeSchema;
49
+ name?: string;
50
+ displayName?: string;
51
+ description?: string;
52
+ primary?: boolean;
53
+ nullable?: boolean;
54
+ autoIncrement?: boolean;
55
+ default?: any;
56
+ defaultAccess?: AccessType;
57
+ }
58
+
59
+ interface Index {
60
+ name?: string;
61
+ columns: string[];
62
+ unique?: boolean;
63
+ }
64
+
65
+ declare const ForeignKeyAction: {
66
+ readonly Cascade: "Cascade";
67
+ readonly Restrict: "Restrict";
68
+ readonly SetNull: "SetNull";
69
+ readonly NoAction: "NoAction";
70
+ readonly SetDefault: "SetDefault";
71
+ };
72
+ type ForeignKeyAction = (typeof ForeignKeyAction)[keyof typeof ForeignKeyAction];
73
+ interface SyntropixDBForeignKey {
74
+ name?: string;
75
+ fromTableName: string;
76
+ fromColumnName: string;
77
+ toTableName: string;
78
+ toColumnName: string;
79
+ onDelete?: ForeignKeyAction;
80
+ onUpdate?: ForeignKeyAction;
81
+ }
82
+
83
+ interface FieldOptions {
84
+ name?: string;
85
+ displayName?: string;
86
+ description?: string;
87
+ isPrimaryKey?: boolean;
88
+ isNullable?: boolean;
89
+ autoIncrement?: boolean;
90
+ default?: any;
91
+ defaultAccess?: AccessType;
92
+ }
93
+ interface ForeignKeyFieldOptions extends FieldOptions {
94
+ onDelete?: ForeignKeyAction;
95
+ onUpdate?: ForeignKeyAction;
96
+ }
80
97
 
81
- declare enum SortType {
82
- Descending = "Descending",
83
- Ascending = "Ascending"
98
+ declare const SortType: {
99
+ readonly Descending: "Descending";
100
+ readonly Ascending: "Ascending";
101
+ };
102
+ type SortType = (typeof SortType)[keyof typeof SortType];
103
+ declare enum AggregateFunction {
104
+ Count = "Count",
105
+ Sum = "Sum",
106
+ Avg = "Avg",
107
+ Min = "Min",
108
+ Max = "Max",
109
+ CountDistinct = "CountDistinct"
110
+ }
111
+ interface Join {
112
+ table: string;
113
+ on: any;
114
+ }
115
+ interface Aggregate {
116
+ column: string;
117
+ function: AggregateFunction;
118
+ alias: string;
119
+ }
120
+ interface GroupBy {
121
+ columns: string[];
122
+ }
123
+ interface Sort {
124
+ column: string;
125
+ direction: SortType;
84
126
  }
85
127
  interface SimilarityOptions {
86
128
  threshold: number;
@@ -116,7 +158,7 @@ declare enum FilterOperation {
116
158
  CosineDistance = "CosineDistance"
117
159
  }
118
160
  interface FilterItem {
119
- column: string;
161
+ columnName: string;
120
162
  operator: FilterOperation;
121
163
  staticValue?: any;
122
164
  columnValue?: string;
@@ -124,105 +166,27 @@ interface FilterItem {
124
166
  }
125
167
  type FilterGroup = FilterItem[];
126
168
  type Filter = FilterGroup[];
127
- declare const AND: (...conditions: FilterItem[]) => FilterGroup;
128
- declare const OR: (...conditions: FilterGroup[]) => Filter;
129
- declare const EQ: (field: string, value: any) => FilterItem;
130
- declare const NE: (field: string, value: any) => FilterItem;
131
- declare const GT: (field: string, value: any) => FilterItem;
132
- declare const GTE: (field: string, value: any) => FilterItem;
133
- declare const LT: (field: string, value: any) => FilterItem;
134
- declare const LTE: (field: string, value: any) => FilterItem;
135
- declare const IN: (field: string, values: any[]) => FilterItem;
136
- declare const CONTAINS: (field: string, value: any) => FilterItem;
137
- declare const OVERLAP: (field: string, value: any) => FilterItem;
138
- declare const I_LIKE: (field: string, pattern: string) => FilterItem;
139
- declare const NOT_I_LIKE: (field: string, pattern: string) => FilterItem;
140
- declare const NOT_IN: (field: string, values: any[]) => FilterItem;
141
- declare const LIKE: (field: string, pattern: string) => FilterItem;
142
- declare const NOT_LIKE: (field: string, pattern: string) => FilterItem;
143
- declare const IS_NULL: (field: string) => FilterItem;
144
- declare const IS_NOT_NULL: (field: string) => FilterItem;
145
- declare const BETWEEN: (field: string, min: any, max: any) => FilterItem;
146
- declare const EQ_COL: (field: string, otherField: string) => FilterItem;
147
- declare const NE_COL: (field: string, otherField: string) => FilterItem;
148
- declare const GT_COL: (field: string, otherField: string) => FilterItem;
149
- declare const GTE_COL: (field: string, otherField: string) => FilterItem;
150
- declare const LT_COL: (field: string, otherField: string) => FilterItem;
151
- declare const LTE_COL: (field: string, otherField: string) => FilterItem;
152
- declare const SIMILARITY: (field: string, value: any, options: SimilarityOptions) => FilterItem;
153
- declare const SIMILARITY_DISTANCE: (field: string, value: any, options: SimilarityOptions) => FilterItem;
154
- declare const WORD_SIMILARITY: (field: string, value: any, options: SimilarityOptions) => FilterItem;
155
- declare const WORD_SIMILARITY_DISTANCE: (field: string, value: any, options: SimilarityOptions) => FilterItem;
156
- declare const STRICT_WORD_SIMILARITY: (field: string, value: any, options: SimilarityOptions) => FilterItem;
157
- declare const STRICT_WORD_SIMILARITY_DISTANCE: (field: string, value: any, options: SimilarityOptions) => FilterItem;
158
- declare const EUCLIDEAN_DISTANCE: (field: string, value: any, options: SimilarityOptions) => FilterItem;
159
- declare const NEGATIVE_INNER_PRODUCT: (field: string, value: any, options: SimilarityOptions) => FilterItem;
160
- declare const COSINE_DISTANCE: (field: string, value: any, options: SimilarityOptions) => FilterItem;
161
- declare const Value: (value: any) => any;
162
- declare function FilterWrapper(filter: Filter | FilterGroup | FilterItem | undefined): Filter | undefined;
163
169
 
164
- declare enum ForeignKeyAction {
165
- Cascade = "Cascade",
166
- Restrict = "Restrict",
167
- SetNull = "SetNull",
168
- NoAction = "NoAction",
169
- SetDefault = "SetDefault"
170
- }
171
- declare enum AggregateFunction {
172
- Count = "Count",
173
- Sum = "Sum",
174
- Avg = "Avg",
175
- Min = "Min",
176
- Max = "Max",
177
- CountDistinct = "CountDistinct"
178
- }
179
- interface Sort {
180
- column: string;
181
- direction: SortType;
182
- }
183
- interface Join {
184
- table: string;
185
- on: any;
186
- }
187
- interface Aggregate {
188
- column: string;
189
- function: AggregateFunction;
190
- alias: string;
191
- }
192
- interface GroupBy {
193
- columns: string[];
194
- }
195
- interface ForeignKey$1 {
196
- name?: string;
197
- fromTableName: string;
198
- fromColumnName: string;
199
- toTableName: string;
200
- toColumnName: string;
201
- onDelete?: ForeignKeyAction;
202
- onUpdate?: ForeignKeyAction;
203
- }
204
- interface Column$1 {
205
- name: string;
206
- displayName?: string;
207
- description?: string;
208
- columnType: ColumnDataType;
209
- isPrimaryKey?: boolean;
210
- isNullable?: boolean;
211
- autoIncrement?: boolean;
212
- default?: any;
213
- defaultAccess?: SyntropixDBAccessType;
214
- }
215
- interface Index {
216
- name: string;
217
- columns: string[];
218
- unique?: boolean;
219
- }
220
170
  interface SyntropixDBTable {
221
171
  id: string;
222
172
  name: string;
173
+ displayName: string;
223
174
  description: string;
224
175
  createdAt: Date;
225
- columns: Column$1[];
176
+ schema: string;
177
+ defaultAccess: AccessType | null;
178
+ columns: SyntropixDBColumn[];
179
+ foreignKeys: SyntropixDBForeignKey[];
180
+ indexes: Index[];
181
+ }
182
+ interface SyntropixDBTableSchema {
183
+ id: string;
184
+ column_access: Record<string, AccessType>;
185
+ metadata: Record<string, any>;
186
+ path: string;
187
+ table: SyntropixDBTable;
188
+ visible: boolean;
189
+ table_access: AccessType;
226
190
  }
227
191
  interface SyntropixDBTableListItem {
228
192
  id: string;
@@ -231,84 +195,89 @@ interface SyntropixDBTableListItem {
231
195
  metadata: Record<string, any>;
232
196
  path: string;
233
197
  visible: boolean;
234
- access: SyntropixDBAccessType;
198
+ access: AccessType;
235
199
  }
236
200
 
237
- declare const SyntropixDBAccessType: {
238
- readonly None: "None";
239
- readonly Read: "Read";
240
- readonly Write: "Write";
241
- readonly Admin: "Admin";
242
- };
243
- type SyntropixDBAccessType = (typeof SyntropixDBAccessType)[keyof typeof SyntropixDBAccessType];
244
- interface TableCreate {
201
+ interface ColumnCreateDto {
245
202
  name: string;
246
203
  displayName?: string;
247
- description?: string;
248
- columns: Column$1[];
249
- foreignKeys: ForeignKey$1[];
204
+ description: string;
205
+ columnType: ColumnDataTypeSchema;
206
+ isPrimaryKey: boolean;
207
+ isNullable: boolean;
208
+ autoIncrement: boolean;
209
+ default?: any;
210
+ defaultAccess?: AccessType;
211
+ }
212
+
213
+ interface TableCreateDto {
214
+ name: string;
215
+ displayName?: string;
216
+ description: string;
217
+ columns: ColumnCreateDto[];
218
+ foreignKeys: SyntropixDBForeignKey[];
250
219
  indexes: Index[];
251
- defaultAccess?: SyntropixDBAccessType;
220
+ defaultAccess?: AccessType;
252
221
  metadata?: Record<string, any>;
253
222
  visible?: boolean;
254
223
  path?: string;
255
224
  }
256
- interface TableDrop {
225
+ interface TableGetSchemaDto {
257
226
  tableName: string;
258
227
  }
259
- interface TableRename {
228
+ interface TableDropDto {
260
229
  tableName: string;
261
- newTableName: string;
262
230
  }
263
- interface TableTruncate {
231
+ interface TableRenameDto {
264
232
  tableName: string;
233
+ newTableName: string;
265
234
  }
266
- interface TableAddColumn {
235
+ interface TableTruncateDto {
267
236
  tableName: string;
268
- column: Column$1;
269
237
  }
270
- interface TableDropColumn {
238
+ interface TableAddColumnDto {
271
239
  tableName: string;
272
- columnName: string;
240
+ column: SyntropixDBColumn;
273
241
  }
274
- interface TableModifyColumn {
242
+ interface TableDropColumnDto {
275
243
  tableName: string;
276
- column: Column$1;
244
+ columnName: string;
277
245
  }
278
- interface TableGetSchema {
246
+ interface TableModifyColumnDto {
279
247
  tableName: string;
248
+ column: SyntropixDBColumn;
280
249
  }
281
- interface TableGetList {
250
+ interface TableGetListDto {
282
251
  search?: string;
283
252
  path?: string;
284
253
  page?: number;
285
254
  pageSize?: number;
286
255
  }
287
- interface InsertData {
256
+ interface InsertDataDto {
288
257
  columns: string[];
289
258
  values: any[][];
290
259
  }
291
- interface Insert {
260
+ interface InsertDto {
292
261
  tableName: string;
293
- data: InsertData;
262
+ data: InsertDataDto;
294
263
  }
295
- interface UpdatePayload {
264
+ interface UpdatePayloadDto {
296
265
  filter: Filter;
297
266
  columns: string[];
298
267
  values: any[];
299
268
  }
300
- interface Update {
269
+ interface UpdateDto {
301
270
  tableName: string;
302
- payload: UpdatePayload;
271
+ payload: UpdatePayloadDto;
303
272
  }
304
- interface DeleteDataPayload {
273
+ interface DeleteDataPayloadDto {
305
274
  filter: Filter;
306
275
  }
307
- interface DeleteData {
276
+ interface DeleteDataDto {
308
277
  tableName: string;
309
- payload: DeleteDataPayload;
278
+ payload: DeleteDataPayloadDto;
310
279
  }
311
- interface QueryPayload {
280
+ interface QueryPayloadDto {
312
281
  filter?: Filter | FilterGroup | FilterItem;
313
282
  sort?: Sort[];
314
283
  aggregate?: Aggregate[];
@@ -318,57 +287,88 @@ interface QueryPayload {
318
287
  groupBy?: GroupBy;
319
288
  select?: string[];
320
289
  }
321
- interface Query {
290
+ interface QueryDto {
322
291
  tableName: string;
323
- query: QueryPayload;
292
+ query: QueryPayloadDto;
324
293
  }
325
294
 
326
- declare class DataClient {
327
- private client;
328
- constructor(config?: ClientConfig);
329
- insertData(data: Insert): Promise<any>;
330
- insertOne(data: Insert): Promise<any>;
331
- updateByPrimaryKey(pk: string, data: Update): Promise<any>;
332
- queryOne(data: Query, model?: any): Promise<any>;
333
- queryMany(data: Query, model?: any): Promise<any>;
334
- updateData(data: Update): Promise<any>;
335
- deleteData(data: DeleteData): Promise<any>;
295
+ interface ColumnCreateResponse {
296
+ id: string;
297
+ name: string;
298
+ displayName: string;
299
+ description: string;
300
+ columnType: ColumnDataTypeSchema;
301
+ isPrimaryKey: boolean;
302
+ isNullable: boolean;
303
+ autoIncrement: boolean;
304
+ default: any | null;
305
+ defaultAccess: AccessType | null;
336
306
  }
337
307
 
308
+ interface SyntropixSuccessResponse<T> {
309
+ status: 'success';
310
+ data: T;
311
+ }
312
+ interface SyntropixErrorResponse {
313
+ status: 'error';
314
+ message: string;
315
+ }
316
+ type SyntropixResponse<T> = SyntropixSuccessResponse<T> | SyntropixErrorResponse;
317
+
338
318
  interface TableCreateResponse {
339
- _id: {
340
- $oid: string;
341
- };
342
- table: {
343
- id: string;
344
- name: string;
345
- description: string;
346
- createdAt: any;
347
- columns: Column$1[];
348
- foreignKeys: ForeignKey$1[];
349
- indexes: Index[];
350
- schema: string;
351
- defaultAccess: string | null;
352
- };
353
- createdAt: any;
354
- updatedAt: any;
319
+ _id: ObjectId;
320
+ table: SyntropixDBTable;
321
+ createdAt: Date;
322
+ updatedAt: Date;
355
323
  createdBy: string;
356
324
  metadata: Record<string, any>;
357
- triggers: any[];
325
+ path: string;
326
+ visible: boolean;
327
+ }
328
+ type TableSchemaResponse = SyntropixDBTableSchema;
329
+ type TableListResponse = SyntropixDBTableListItem[];
330
+
331
+ declare class ClientConfig {
332
+ apiKey?: string;
333
+ baseUrl?: string;
334
+ timeout?: number;
335
+ retries?: number;
336
+ constructor(config?: any);
337
+ }
338
+
339
+ declare class BaseClient {
340
+ protected config: ClientConfig;
341
+ constructor(config: ClientConfig);
342
+ private headers;
343
+ private url;
344
+ get<T>(path: string, data?: Record<string, any>): Promise<T>;
345
+ post<T>(path: string, data?: Record<string, any>): Promise<T>;
346
+ }
347
+
348
+ declare class DataClient {
349
+ private client;
350
+ constructor(config?: ClientConfig);
351
+ insertData(data: InsertDto): Promise<any>;
352
+ insertOne(data: InsertDto): Promise<any>;
353
+ updateByPrimaryKey(pk: string, data: UpdateDto): Promise<any>;
354
+ queryOne(data: QueryDto, model?: any): Promise<any>;
355
+ queryMany(data: QueryDto, model?: any): Promise<any>;
356
+ updateData(data: UpdateDto): Promise<any>;
357
+ deleteData(data: DeleteDataDto): Promise<any>;
358
358
  }
359
359
 
360
360
  declare class TableClient {
361
361
  private client;
362
362
  constructor(config?: ClientConfig);
363
- createTable(data: TableCreate): Promise<TableCreateResponse>;
364
- dropTable(data: TableDrop): Promise<any>;
365
- renameTable(data: TableRename): Promise<any>;
366
- truncateTable(data: TableTruncate): Promise<any>;
367
- addColumn(data: TableAddColumn): Promise<any>;
368
- dropColumn(data: TableDropColumn): Promise<any>;
369
- modifyColumn(data: TableModifyColumn): Promise<any>;
370
- getTableSchema(data: TableGetSchema): Promise<SyntropixDBTable>;
371
- getTableList(data: TableGetList): Promise<SyntropixDBTableListItem[]>;
363
+ createTable(data: TableCreateDto): Promise<TableCreateResponse>;
364
+ dropTable(data: TableDropDto): Promise<any>;
365
+ renameTable(data: TableRenameDto): Promise<any>;
366
+ truncateTable(data: TableTruncateDto): Promise<any>;
367
+ addColumn(data: TableAddColumnDto): Promise<any>;
368
+ dropColumn(data: TableDropColumnDto): Promise<any>;
369
+ modifyColumn(data: TableModifyColumnDto): Promise<any>;
370
+ getTableSchema(data: TableGetSchemaDto): Promise<TableSchemaResponse>;
371
+ getTableList(data: TableGetListDto): Promise<TableListResponse>;
372
372
  }
373
373
 
374
374
  declare class SyntropixClient {
@@ -382,190 +382,78 @@ declare class SyntropixClient {
382
382
 
383
383
  declare abstract class Field {
384
384
  name: string;
385
+ displayName: string;
385
386
  description: string;
386
- columnType: ColumnDataType;
387
+ columnType: ColumnDataTypeSchema;
387
388
  isPrimaryKey: boolean;
388
389
  isNullable: boolean;
389
390
  autoIncrement: boolean;
390
391
  default?: any;
391
- defaultAccess?: SyntropixDBAccessType;
392
- constructor(columnType: ColumnDataType, options?: {
393
- name?: string;
394
- description?: string;
395
- isPrimaryKey?: boolean;
396
- isNullable?: boolean;
397
- autoIncrement?: boolean;
398
- default?: any;
399
- defaultAccess?: SyntropixDBAccessType;
400
- });
401
- into(): Column$1;
392
+ defaultAccess?: AccessType;
393
+ constructor(columnType: ColumnDataTypeSchema, options?: FieldOptions);
394
+ intoColumnCreateDto(): ColumnCreateDto;
402
395
  }
403
396
  declare class ForeignKeyField extends Field {
404
397
  tableName: string;
405
398
  columnName: string;
406
399
  onDelete: ForeignKeyAction;
407
400
  onUpdate: ForeignKeyAction;
408
- constructor(columnType: ColumnDataType, tableName: string, columnName: string, options?: {
409
- onDelete?: ForeignKeyAction;
410
- onUpdate?: ForeignKeyAction;
411
- description?: string;
412
- isPrimaryKey?: boolean;
413
- isNullable?: boolean;
414
- default?: any;
415
- defaultAccess?: SyntropixDBAccessType;
416
- });
401
+ constructor(columnType: ColumnDataTypeSchema, tableName: string, columnName: string, options?: ForeignKeyFieldOptions);
417
402
  }
418
403
  declare class StringField extends Field {
419
- constructor(maxLength: number, options?: {
420
- description?: string;
421
- isPrimaryKey?: boolean;
422
- isNullable?: boolean;
423
- default?: string;
424
- defaultAccess?: SyntropixDBAccessType;
425
- });
404
+ constructor(maxLength: number, options?: FieldOptions);
426
405
  }
427
406
  declare class TextField extends Field {
428
- constructor(options?: {
429
- description?: string;
430
- isPrimaryKey?: boolean;
431
- isNullable?: boolean;
432
- default?: string;
433
- defaultAccess?: SyntropixDBAccessType;
434
- });
407
+ constructor(options?: FieldOptions);
435
408
  }
436
409
  declare class IntegerField extends Field {
437
- constructor(options?: {
438
- description?: string;
439
- isPrimaryKey?: boolean;
440
- isNullable?: boolean;
441
- autoIncrement?: boolean;
442
- default?: number;
443
- defaultAccess?: SyntropixDBAccessType;
444
- });
410
+ constructor(options?: FieldOptions);
445
411
  }
446
412
  declare class BooleanField extends Field {
447
- constructor(options?: {
448
- description?: string;
449
- isPrimaryKey?: boolean;
450
- isNullable?: boolean;
451
- default?: boolean;
452
- defaultAccess?: SyntropixDBAccessType;
453
- });
413
+ constructor(options?: FieldOptions);
454
414
  }
455
415
  declare class DateTimeField extends Field {
456
- constructor(options?: {
457
- description?: string;
458
- isPrimaryKey?: boolean;
459
- isNullable?: boolean;
460
- default?: Date;
461
- defaultAccess?: SyntropixDBAccessType;
462
- });
416
+ constructor(options?: FieldOptions);
463
417
  }
464
418
  declare class TimestampField extends Field {
465
- constructor(options?: {
466
- description?: string;
467
- isPrimaryKey?: boolean;
468
- isNullable?: boolean;
469
- default?: Date;
470
- defaultAccess?: SyntropixDBAccessType;
471
- });
419
+ constructor(options?: FieldOptions);
472
420
  }
473
421
  declare class DateField extends Field {
474
- constructor(options?: {
475
- description?: string;
476
- isPrimaryKey?: boolean;
477
- isNullable?: boolean;
478
- default?: Date;
479
- defaultAccess?: SyntropixDBAccessType;
480
- });
422
+ constructor(options?: FieldOptions);
481
423
  }
482
424
  declare class JsonField extends Field {
483
- constructor(options?: {
484
- description?: string;
485
- isPrimaryKey?: boolean;
486
- isNullable?: boolean;
487
- default?: Record<string, any>;
488
- defaultAccess?: SyntropixDBAccessType;
489
- });
425
+ constructor(options?: FieldOptions);
490
426
  }
491
427
  declare class UuidField extends Field {
492
- constructor(options?: {
493
- description?: string;
494
- isPrimaryKey?: boolean;
495
- isNullable?: boolean;
496
- default?: string;
497
- defaultAccess?: SyntropixDBAccessType;
498
- });
428
+ constructor(options?: FieldOptions);
499
429
  }
500
430
  declare class VectorField extends Field {
501
- constructor(dimensions: number, options?: {
502
- description?: string;
503
- isPrimaryKey?: boolean;
504
- isNullable?: boolean;
505
- default?: number[];
506
- defaultAccess?: SyntropixDBAccessType;
507
- });
431
+ constructor(dimensions: number, options?: FieldOptions);
508
432
  }
509
433
  declare class ArrayField extends Field {
510
- constructor(dataType: ArrayDataType, options?: {
511
- description?: string;
512
- isPrimaryKey?: boolean;
513
- isNullable?: boolean;
514
- default?: any[];
515
- defaultAccess?: SyntropixDBAccessType;
516
- });
434
+ constructor(dataType: ArrayDataTypeSchema, options?: FieldOptions);
517
435
  }
518
436
  declare class EnumField extends Field {
519
- constructor(name: string, variants: string[], options?: {
520
- description?: string;
521
- isPrimaryKey?: boolean;
522
- isNullable?: boolean;
523
- default?: string;
524
- defaultAccess?: SyntropixDBAccessType;
525
- });
437
+ constructor(name: string, variants: string[], options?: FieldOptions);
526
438
  }
527
439
  declare class MoneyField extends Field {
528
- constructor(precision: number, scale: number, options?: {
529
- description?: string;
530
- isPrimaryKey?: boolean;
531
- isNullable?: boolean;
532
- default?: number;
533
- defaultAccess?: SyntropixDBAccessType;
534
- });
440
+ constructor(precision: number, scale: number, options?: FieldOptions);
535
441
  }
536
442
  declare class DecimalField extends Field {
537
- constructor(precision: number, scale: number, options?: {
538
- description?: string;
539
- isPrimaryKey?: boolean;
540
- isNullable?: boolean;
541
- default?: number;
542
- defaultAccess?: SyntropixDBAccessType;
543
- });
443
+ constructor(precision: number, scale: number, options?: FieldOptions);
544
444
  }
545
445
  declare class DoubleField extends Field {
546
- constructor(options?: {
547
- description?: string;
548
- isPrimaryKey?: boolean;
549
- isNullable?: boolean;
550
- default?: number;
551
- defaultAccess?: SyntropixDBAccessType;
552
- });
446
+ constructor(options?: FieldOptions);
553
447
  }
554
448
 
555
- declare function Column(options?: {
556
- type?: ColumnDataType;
557
- name?: string;
558
- description?: string;
559
- primary?: boolean;
560
- nullable?: boolean;
561
- autoIncrement?: boolean;
562
- default?: any;
563
- }): (target: any, propertyKey: string) => void;
449
+ declare function Column(options?: ColumnCreateOptions): (target: any, propertyKey: string) => void;
450
+ declare function Description(description: string): (target: any) => void;
564
451
  declare function ForeignKey(tableName: string, columnName: string, options?: {
565
- type?: ColumnDataType;
452
+ type?: ColumnDataTypeSchema;
453
+ displayName?: string;
566
454
  name?: string;
567
- onDelete?: string;
568
- onUpdate?: string;
455
+ onDelete?: ForeignKeyAction;
456
+ onUpdate?: ForeignKeyAction;
569
457
  description?: string;
570
458
  nullable?: boolean;
571
459
  default?: any;
@@ -575,6 +463,7 @@ declare class BaseModel {
575
463
  private _extra;
576
464
  constructor(data?: Record<string, any>);
577
465
  protected static getTableName(): string;
466
+ protected static getDisplayName(): string;
578
467
  static getDescription(): string;
579
468
  protected static getIndexes(): Index[];
580
469
  protected static getFields(): Record<string, Field>;
@@ -582,15 +471,17 @@ declare class BaseModel {
582
471
  protected static getAssociations(): ForeignKeyField[];
583
472
  protected getFields(): Record<string, Field>;
584
473
  protected getTableName(): string;
474
+ protected getDisplayName(): string;
585
475
  protected getPrimaryKeyName(): string;
586
476
  protected getPrimaryKey(): Field | undefined;
587
477
  protected get client(): SyntropixClient;
588
- static createTable(_client?: SyntropixClient | null): Promise<TableCreateResponse>;
589
- static dropTable(_client?: SyntropixClient | null): Promise<any>;
590
- static renameTable(newName: string, _client?: SyntropixClient | null): Promise<any>;
591
- static truncateTable(_client?: SyntropixClient | null): Promise<any>;
592
- static create<T extends BaseModel>(this: new (data?: any) => T, data: Record<string, any>, _client?: SyntropixClient | null): Promise<any>;
593
- save(_client?: SyntropixClient | null): Promise<any>;
478
+ static createTable(client?: SyntropixClient): Promise<TableCreateResponse>;
479
+ static dropTable(client?: SyntropixClient): Promise<any>;
480
+ static renameTable(newName: string, client?: SyntropixClient): Promise<any>;
481
+ static truncateTable(client?: SyntropixClient): Promise<any>;
482
+ static getTableSchema(client?: SyntropixClient): Promise<TableSchemaResponse>;
483
+ static create<T extends BaseModel>(this: new (data?: any) => T, data: Record<string, any>, client?: SyntropixClient): Promise<any>;
484
+ save(client?: SyntropixClient): Promise<any>;
594
485
  remove(filter?: Filter, _client?: SyntropixClient | null): Promise<number>;
595
486
  static bulkCreate<T extends BaseModel>(this: new (data?: any) => T, datas: Record<string, any>[], batchSize?: number, _client?: SyntropixClient | null): Promise<number>;
596
487
  static update<T extends BaseModel>(this: new (data?: any) => T, filter: Filter, data: Record<string, any>, _client?: SyntropixClient | null): Promise<number>;
@@ -617,4 +508,75 @@ declare class BaseModel {
617
508
  toJSON(): Record<string, any>;
618
509
  }
619
510
 
620
- export { AND, type Aggregate, AggregateFunction, ArrayField, BETWEEN, BaseModel, BooleanField, CONTAINS, COSINE_DISTANCE, Client, ClientConfig, Column, ColumnDataType, DateField, DateTimeField, DecimalField, type DeleteData, type DeleteDataPayload, DoubleField, EQ, EQ_COL, EUCLIDEAN_DISTANCE, EnumField, Field, type Filter, type FilterGroup, type FilterItem, FilterOperation, FilterWrapper, ForeignKey, ForeignKeyAction, ForeignKeyField, GT, GTE, GTE_COL, GT_COL, type GroupBy, IN, IS_NOT_NULL, IS_NULL, I_LIKE, type Index, type Insert, type InsertData, IntegerField, type Join, JsonField, LIKE, LT, LTE, LTE_COL, LT_COL, MoneyField, NE, NEGATIVE_INNER_PRODUCT, NE_COL, NOT_IN, NOT_I_LIKE, NOT_LIKE, OR, OVERLAP, type Query, type QueryPayload, SIMILARITY, SIMILARITY_DISTANCE, STRICT_WORD_SIMILARITY, STRICT_WORD_SIMILARITY_DISTANCE, type SimilarityOptions, type Sort, SortType, StringField, SyntropixClient, SyntropixDBAccessType, type SyntropixDBTable, type SyntropixDBTableListItem, type TableAddColumn, type TableCreate, type TableDrop, type TableDropColumn, type TableGetList, type TableGetSchema, type TableModifyColumn, type TableRename, type TableTruncate, TextField, TimestampField, type Update, type UpdatePayload, UuidField, Value, VectorField, WORD_SIMILARITY, WORD_SIMILARITY_DISTANCE };
511
+ declare const ArrayDataType: {
512
+ readonly String: (maxLength: number) => StringType;
513
+ readonly Decimal: (precision: number, scale: number) => DecimalType;
514
+ readonly Text: "Text";
515
+ readonly Integer: "Integer";
516
+ readonly BigInteger: "BigInteger";
517
+ readonly Double: "Double";
518
+ readonly DateTime: "DateTime";
519
+ readonly Timestamp: "Timestamp";
520
+ readonly Date: "Date";
521
+ readonly Boolean: "Boolean";
522
+ readonly Money: (precision: number, scale: number) => MoneyType;
523
+ readonly Uuid: "Uuid";
524
+ readonly Enum: (name: string, variants: string[]) => EnumType;
525
+ readonly Json: "Json";
526
+ };
527
+ declare const ColumnDataType: {
528
+ readonly Integer: "Integer";
529
+ readonly String: (maxLength: number) => StringType;
530
+ readonly Text: "Text";
531
+ readonly Boolean: "Boolean";
532
+ readonly DateTime: "DateTime";
533
+ readonly Timestamp: "Timestamp";
534
+ readonly Date: "Date";
535
+ readonly Json: "Json";
536
+ readonly Uuid: "Uuid";
537
+ readonly Double: "Double";
538
+ readonly Vector: (dimensions: number) => VectorType;
539
+ readonly Array: (dataType: ArrayDataTypeSchema) => ArrayType;
540
+ readonly Enum: (name: string, variants: string[]) => EnumType;
541
+ readonly Money: (precision: number, scale: number) => MoneyType;
542
+ readonly Decimal: (precision: number, scale: number) => DecimalType;
543
+ };
544
+
545
+ declare const AND: (...conditions: FilterItem[]) => FilterGroup;
546
+ declare const OR: (...conditions: FilterGroup[]) => Filter;
547
+ declare const EQ: (field: string, value: any) => FilterItem;
548
+ declare const NE: (field: string, value: any) => FilterItem;
549
+ declare const GT: (field: string, value: any) => FilterItem;
550
+ declare const GTE: (field: string, value: any) => FilterItem;
551
+ declare const LT: (field: string, value: any) => FilterItem;
552
+ declare const LTE: (field: string, value: any) => FilterItem;
553
+ declare const IN: (field: string, values: any[]) => FilterItem;
554
+ declare const CONTAINS: (field: string, value: any) => FilterItem;
555
+ declare const OVERLAP: (field: string, value: any) => FilterItem;
556
+ declare const I_LIKE: (field: string, pattern: string) => FilterItem;
557
+ declare const NOT_I_LIKE: (field: string, pattern: string) => FilterItem;
558
+ declare const NOT_IN: (field: string, values: any[]) => FilterItem;
559
+ declare const LIKE: (field: string, pattern: string) => FilterItem;
560
+ declare const NOT_LIKE: (field: string, pattern: string) => FilterItem;
561
+ declare const IS_NULL: (field: string) => FilterItem;
562
+ declare const IS_NOT_NULL: (field: string) => FilterItem;
563
+ declare const BETWEEN: (field: string, min: any, max: any) => FilterItem;
564
+ declare const EQ_COL: (field: string, otherField: string) => FilterItem;
565
+ declare const NE_COL: (field: string, otherField: string) => FilterItem;
566
+ declare const GT_COL: (field: string, otherField: string) => FilterItem;
567
+ declare const GTE_COL: (field: string, otherField: string) => FilterItem;
568
+ declare const LT_COL: (field: string, otherField: string) => FilterItem;
569
+ declare const LTE_COL: (field: string, otherField: string) => FilterItem;
570
+ declare const SIMILARITY: (field: string, value: any, options: SimilarityOptions) => FilterItem;
571
+ declare const SIMILARITY_DISTANCE: (field: string, value: any, options: SimilarityOptions) => FilterItem;
572
+ declare const WORD_SIMILARITY: (field: string, value: any, options: SimilarityOptions) => FilterItem;
573
+ declare const WORD_SIMILARITY_DISTANCE: (field: string, value: any, options: SimilarityOptions) => FilterItem;
574
+ declare const STRICT_WORD_SIMILARITY: (field: string, value: any, options: SimilarityOptions) => FilterItem;
575
+ declare const STRICT_WORD_SIMILARITY_DISTANCE: (field: string, value: any, options: SimilarityOptions) => FilterItem;
576
+ declare const EUCLIDEAN_DISTANCE: (field: string, value: any, options: SimilarityOptions) => FilterItem;
577
+ declare const NEGATIVE_INNER_PRODUCT: (field: string, value: any, options: SimilarityOptions) => FilterItem;
578
+ declare const COSINE_DISTANCE: (field: string, value: any, options: SimilarityOptions) => FilterItem;
579
+ declare const Value: (value: any) => any;
580
+ declare function FilterWrapper(filter: Filter | FilterGroup | FilterItem | undefined): Filter | undefined;
581
+
582
+ export { AND, AccessType, type Aggregate, AggregateFunction, ArrayDataType, type ArrayDataTypeSchema, ArrayField, type ArrayType, BETWEEN, BaseClient, BaseModel, BooleanField, CONTAINS, COSINE_DISTANCE, ClientConfig, Column, type ColumnCreateDto, type ColumnCreateOptions, type ColumnCreateResponse, ColumnDataType, type ColumnDataTypeSchema, DataClient, DateField, DateTimeField, DecimalField, type DecimalType, type DeleteDataDto, type DeleteDataPayloadDto, Description, DoubleField, EQ, EQ_COL, EUCLIDEAN_DISTANCE, EnumField, type EnumType, Field, type FieldOptions, type Filter, type FilterGroup, type FilterItem, FilterOperation, FilterWrapper, ForeignKey, ForeignKeyAction, ForeignKeyField, type ForeignKeyFieldOptions, GT, GTE, GTE_COL, GT_COL, type GroupBy, IN, IS_NOT_NULL, IS_NULL, I_LIKE, type Index, type InsertDataDto, type InsertDto, IntegerField, type Join, JsonField, LIKE, LT, LTE, LTE_COL, LT_COL, MoneyField, type MoneyType, NE, NEGATIVE_INNER_PRODUCT, NE_COL, NOT_IN, NOT_I_LIKE, NOT_LIKE, OR, OVERLAP, type QueryDto, type QueryPayloadDto, SIMILARITY, SIMILARITY_DISTANCE, STRICT_WORD_SIMILARITY, STRICT_WORD_SIMILARITY_DISTANCE, type SimilarityOptions, type Sort, SortType, StringField, type StringType, SyntropixClient, type SyntropixDBColumn, type SyntropixDBForeignKey, type SyntropixDBTable, type SyntropixDBTableListItem, type SyntropixDBTableSchema, type SyntropixErrorResponse, type SyntropixResponse, type SyntropixSuccessResponse, type TableAddColumnDto, TableClient, type TableCreateDto, type TableCreateResponse, type TableDropColumnDto, type TableDropDto, type TableGetListDto, type TableGetSchemaDto, type TableListResponse, type TableModifyColumnDto, type TableRenameDto, type TableSchemaResponse, type TableTruncateDto, TextField, TimestampField, type UpdateDto, type UpdatePayloadDto, UuidField, Value, VectorField, type VectorType, WORD_SIMILARITY, WORD_SIMILARITY_DISTANCE };