@syntropix/database 0.0.4 → 0.0.6

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 (49) hide show
  1. package/dist/core/dataClient.js +3 -0
  2. package/dist/core/syntropix.d.ts +1 -1
  3. package/dist/core/syntropix.js +2 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/types/basemodel.d.ts +4 -3
  7. package/dist/types/basemodel.js +36 -35
  8. package/dist/types/common.d.ts +32 -28
  9. package/dist/types/common.js +11 -12
  10. package/dist/types/data-type.d.ts +48 -38
  11. package/dist/types/data-type.js +17 -18
  12. package/dist/types/dto/table.d.ts +6 -6
  13. package/dist/types/field.d.ts +60 -41
  14. package/dist/types/field.js +35 -32
  15. package/dist/types/filter.d.ts +43 -44
  16. package/dist/types/filter.js +56 -41
  17. package/dist/types/requests.d.ts +25 -14
  18. package/dist/types/requests.js +6 -1
  19. package/package.json +5 -2
  20. package/.editorconfig +0 -8
  21. package/.env +0 -2
  22. package/.gitattributes +0 -4
  23. package/.husky/pre-commit +0 -1
  24. package/.prettierrc +0 -8
  25. package/.vscode/settings.json +0 -1
  26. package/.yarnrc.yml +0 -1
  27. package/eslint.config.mjs +0 -23
  28. package/examples/advanced-usage.ts +0 -214
  29. package/examples/tsconfig.json +0 -13
  30. package/examples/usage.ts +0 -94
  31. package/jest.config.ts +0 -9
  32. package/src/core/client.ts +0 -41
  33. package/src/core/config.ts +0 -29
  34. package/src/core/dataClient.ts +0 -78
  35. package/src/core/syntropix.ts +0 -27
  36. package/src/core/tableClient.ts +0 -86
  37. package/src/index.ts +0 -10
  38. package/src/types/basemodel.ts +0 -558
  39. package/src/types/common.ts +0 -83
  40. package/src/types/data-type.ts +0 -23
  41. package/src/types/dto/base.ts +0 -4
  42. package/src/types/dto/table.ts +0 -21
  43. package/src/types/field.ts +0 -277
  44. package/src/types/filter.ts +0 -281
  45. package/src/types/requests.ts +0 -91
  46. package/test.json +0 -48
  47. package/tests/basic.test.ts +0 -141
  48. package/tests/tsconfig.json +0 -8
  49. package/tsconfig.json +0 -18
@@ -1,3 +1,4 @@
1
+ import { FilterWrapper } from '../types/filter';
1
2
  import { Client } from './client';
2
3
  import { ClientConfig } from './config';
3
4
  export class DataClient {
@@ -27,6 +28,7 @@ export class DataClient {
27
28
  throw new Error(response.message);
28
29
  }
29
30
  async queryOne(data, model) {
31
+ data.query.filter = FilterWrapper(data.query.filter);
30
32
  const response = await this.client.post('/query', { One: data });
31
33
  if (response.status === 'success') {
32
34
  const responseData = response.data;
@@ -38,6 +40,7 @@ export class DataClient {
38
40
  throw new Error(response.message);
39
41
  }
40
42
  async queryMany(data, model) {
43
+ data.query.filter = FilterWrapper(data.query.filter);
41
44
  const response = await this.client.post('/query', { Many: data });
42
45
  if (response.status === 'success') {
43
46
  const responseData = response.data;
@@ -5,7 +5,7 @@ export declare class SyntropixClient {
5
5
  private config;
6
6
  private _tableClient?;
7
7
  private _dataClient?;
8
- constructor(config: ClientConfig);
8
+ constructor(config?: ClientConfig);
9
9
  get table(): TableClient;
10
10
  get data(): DataClient;
11
11
  }
@@ -1,10 +1,11 @@
1
+ import { ClientConfig } from './config';
1
2
  import { DataClient } from './dataClient';
2
3
  import { TableClient } from './tableClient';
3
4
  export class SyntropixClient {
4
5
  config;
5
6
  _tableClient;
6
7
  _dataClient;
7
- constructor(config) {
8
+ constructor(config = new ClientConfig()) {
8
9
  this.config = config;
9
10
  }
10
11
  get table() {
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export * from './core/config';
3
3
  export { SyntropixClient } from './core/syntropix';
4
4
  export { BaseModel, Column, ForeignKey } from './types/basemodel';
5
5
  export * from './types/common';
6
- export { DataType } from './types/data-type';
6
+ export { ColumnType } from './types/data-type';
7
7
  export * from './types/field';
8
8
  export * from './types/filter';
9
9
  export * from './types/requests';
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ export * from './core/config';
4
4
  export { SyntropixClient } from './core/syntropix';
5
5
  export { BaseModel, Column, ForeignKey } from './types/basemodel';
6
6
  export * from './types/common';
7
- export { DataType } from './types/data-type';
7
+ export { ColumnType } from './types/data-type';
8
8
  export * from './types/field';
9
9
  export * from './types/filter';
10
10
  export * from './types/requests';
@@ -1,21 +1,22 @@
1
1
  import 'reflect-metadata';
2
2
  import { SyntropixClient } from '../core/syntropix';
3
3
  import { Aggregate, GroupBy, Index, Join, Sort } from './common';
4
+ import { ColumnType } from './data-type';
4
5
  import { TableCreateResponse } from './dto/table';
5
6
  import { Field, ForeignKeyField } from './field';
6
7
  import { Filter } from './filter';
7
8
  export declare function Column(options?: {
8
- type?: string | Record<string, any>;
9
+ type?: ColumnType;
9
10
  name?: string;
10
11
  description?: string;
11
12
  primary?: boolean;
12
13
  nullable?: boolean;
13
- auto_increment?: boolean;
14
+ autoIncrement?: boolean;
14
15
  default?: any;
15
16
  }): (target: any, propertyKey: string) => void;
16
17
  export declare function Description(description: string): (target: any) => void;
17
18
  export declare function ForeignKey(tableName: string, columnName: string, options?: {
18
- type?: string | Record<string, any>;
19
+ type?: ColumnType;
19
20
  name?: string;
20
21
  onDelete?: string;
21
22
  onUpdate?: string;
@@ -3,6 +3,7 @@ import 'reflect-metadata';
3
3
  import { ClientConfig } from '../core/config';
4
4
  import { SyntropixClient } from '../core/syntropix';
5
5
  import { AggregateFunction } from './common';
6
+ import { ColumnType } from './data-type';
6
7
  import { Field, ForeignKeyField, IntegerField } from './field';
7
8
  import { AND, EQ, GTE, OR, Value } from './filter';
8
9
  // Metadata keys
@@ -15,15 +16,15 @@ export function Column(options = {}) {
15
16
  return function (target, propertyKey) {
16
17
  const fields = Reflect.getMetadata(FIELDS_KEY, target.constructor) || {};
17
18
  const fieldName = options.name || propertyKey.toLowerCase();
18
- const column_type = options.type || 'Text';
19
+ const columnType = options.type || ColumnType.Text;
19
20
  const field = new (class extends Field {
20
21
  constructor() {
21
- super(column_type, {
22
+ super(columnType, {
22
23
  name: fieldName,
23
24
  description: options.description,
24
- is_primary_key: options.primary,
25
- is_nullable: options.nullable,
26
- auto_increment: options.auto_increment,
25
+ isPrimaryKey: options.primary,
26
+ isNullable: options.nullable,
27
+ autoIncrement: options.autoIncrement,
27
28
  default: options.default,
28
29
  });
29
30
  }
@@ -42,11 +43,11 @@ export function Description(description) {
42
43
  export function ForeignKey(tableName, columnName, options = {}) {
43
44
  return function (target, propertyKey) {
44
45
  const fields = Reflect.getMetadata(FIELDS_KEY, target.constructor) || {};
45
- const field = new ForeignKeyField(options.type || 'Integer', tableName, columnName, {
46
+ const field = new ForeignKeyField(options.type || ColumnType.Integer, tableName, columnName, {
46
47
  onDelete: options.onDelete,
47
48
  onUpdate: options.onUpdate,
48
49
  description: options.description,
49
- is_nullable: options.nullable,
50
+ isNullable: options.nullable,
50
51
  default: options.default,
51
52
  });
52
53
  field.name = options.name || propertyKey.toLowerCase();
@@ -108,18 +109,18 @@ export class BaseModel {
108
109
  // Check if there's a primary key
109
110
  let hasPrimaryKey = false;
110
111
  for (const field of Object.values(fields)) {
111
- if (field.is_primary_key) {
112
+ if (field.isPrimaryKey) {
112
113
  hasPrimaryKey = true;
113
- field.is_nullable = false;
114
+ field.isNullable = false;
114
115
  break;
115
116
  }
116
117
  }
117
118
  // If no primary key, add default 'id' field
118
119
  if (!hasPrimaryKey && !('id' in fields)) {
119
120
  fields['id'] = new IntegerField({
120
- is_primary_key: true,
121
- is_nullable: false,
122
- auto_increment: true,
121
+ isPrimaryKey: true,
122
+ isNullable: false,
123
+ autoIncrement: true,
123
124
  description: 'Primary key',
124
125
  });
125
126
  fields['id'].name = 'id';
@@ -129,7 +130,7 @@ export class BaseModel {
129
130
  static getPrimaryKeyName() {
130
131
  const fields = this.getFields();
131
132
  for (const [key, field] of Object.entries(fields)) {
132
- if (field.is_primary_key) {
133
+ if (field.isPrimaryKey) {
133
134
  return field.name;
134
135
  }
135
136
  }
@@ -152,7 +153,7 @@ export class BaseModel {
152
153
  getPrimaryKey() {
153
154
  const fields = this.getFields();
154
155
  for (const field of Object.values(fields)) {
155
- if (field.is_primary_key) {
156
+ if (field.isPrimaryKey) {
156
157
  return field;
157
158
  }
158
159
  }
@@ -170,12 +171,12 @@ export class BaseModel {
170
171
  const fields = this.getFields();
171
172
  const columns = Object.values(fields).map((f) => f.into());
172
173
  const foreignKeys = this.getAssociations().map((f) => ({
173
- from_table: this.getTableName(),
174
- from_column: f.name,
175
- to_table: f.tableName,
176
- to_column: f.columnName,
177
- on_delete: f.onDelete,
178
- on_update: f.onUpdate,
174
+ fromTable: this.getTableName(),
175
+ fromColumn: f.name,
176
+ toTable: f.tableName,
177
+ toColumn: f.columnName,
178
+ onDelete: f.onDelete,
179
+ onUpdate: f.onUpdate,
179
180
  }));
180
181
  const indexes = this.getIndexes();
181
182
  const client = _client || new SyntropixClient(new ClientConfig());
@@ -183,7 +184,7 @@ export class BaseModel {
183
184
  name: this.getTableName(),
184
185
  description: this.getDescription() || 'No description',
185
186
  columns,
186
- foreign_keys: foreignKeys,
187
+ foreignKeys: foreignKeys,
187
188
  indexes,
188
189
  });
189
190
  }
@@ -195,7 +196,7 @@ export class BaseModel {
195
196
  const client = _client || new SyntropixClient(new ClientConfig());
196
197
  return client.table.renameTable({
197
198
  name: this.getTableName(),
198
- new_name: newName,
199
+ newName: newName,
199
200
  });
200
201
  }
201
202
  static async truncateTable(_client) {
@@ -219,7 +220,7 @@ export class BaseModel {
219
220
  }
220
221
  const client = _client || new SyntropixClient(new ClientConfig());
221
222
  return client.data.insertOne({
222
- table_name: model.getTableName(),
223
+ tableName: model.getTableName(),
223
224
  data: {
224
225
  columns,
225
226
  values: [values],
@@ -247,7 +248,7 @@ export class BaseModel {
247
248
  }
248
249
  return (_client ||
249
250
  this.client.data.updateByPrimaryKey(pkValue, {
250
- table_name: this.getTableName(),
251
+ tableName: this.getTableName(),
251
252
  payload: {
252
253
  filter: [[]],
253
254
  columns,
@@ -261,7 +262,7 @@ export class BaseModel {
261
262
  const finalFilter = filter || OR(AND(EQ(pk?.name || 'id', pkValue)));
262
263
  return (_client ||
263
264
  this.client.data.deleteData({
264
- table_name: this.getTableName(),
265
+ tableName: this.getTableName(),
265
266
  payload: {
266
267
  filter: finalFilter,
267
268
  },
@@ -292,7 +293,7 @@ export class BaseModel {
292
293
  values.push(columns.map((c) => data[c]));
293
294
  if (values.length === batchSize) {
294
295
  cnt += await client.data.insertData({
295
- table_name: model.getTableName(),
296
+ tableName: model.getTableName(),
296
297
  data: { columns: columns.map((c) => fields[c].name), values },
297
298
  });
298
299
  values = [];
@@ -300,7 +301,7 @@ export class BaseModel {
300
301
  }
301
302
  if (values.length > 0) {
302
303
  cnt += await client.data.insertData({
303
- table_name: model.getTableName(),
304
+ tableName: model.getTableName(),
304
305
  data: { columns: columns.map((c) => fields[c].name), values },
305
306
  });
306
307
  }
@@ -321,7 +322,7 @@ export class BaseModel {
321
322
  const values = columns.map((c) => data[c]);
322
323
  const client = _client || new SyntropixClient(new ClientConfig());
323
324
  return client.data.updateData({
324
- table_name: model.getTableName(),
325
+ tableName: model.getTableName(),
325
326
  payload: {
326
327
  filter,
327
328
  columns: columns.map((c) => fields[c].name),
@@ -333,7 +334,7 @@ export class BaseModel {
333
334
  const model = this;
334
335
  const client = _client || new SyntropixClient(new ClientConfig());
335
336
  return client.data.deleteData({
336
- table_name: model.getTableName(),
337
+ tableName: model.getTableName(),
337
338
  payload: { filter },
338
339
  });
339
340
  }
@@ -342,7 +343,7 @@ export class BaseModel {
342
343
  const fields = model.getFields();
343
344
  const client = _client || new SyntropixClient(new ClientConfig());
344
345
  const data = await client.data.queryOne({
345
- table_name: model.getTableName(),
346
+ tableName: model.getTableName(),
346
347
  query: {
347
348
  filter,
348
349
  select: select || Object.values(fields).map((f) => f.name),
@@ -355,7 +356,7 @@ export class BaseModel {
355
356
  const model = this;
356
357
  const client = options._client || new SyntropixClient(new ClientConfig());
357
358
  const data = await client.data.queryMany({
358
- table_name: model.getTableName(),
359
+ tableName: model.getTableName(),
359
360
  query: {
360
361
  filter: options.filter,
361
362
  sort: options.sort,
@@ -363,7 +364,7 @@ export class BaseModel {
363
364
  join: options.join ? [options.join] : undefined,
364
365
  limit: options.limit,
365
366
  offset: options.offset,
366
- group_by: options.groupBy,
367
+ groupBy: options.groupBy,
367
368
  select: options.select,
368
369
  },
369
370
  });
@@ -373,20 +374,20 @@ export class BaseModel {
373
374
  const model = this;
374
375
  const client = options._client || new SyntropixClient(new ClientConfig());
375
376
  const data = await client.data.queryMany({
376
- table_name: model.getTableName(),
377
+ tableName: model.getTableName(),
377
378
  query: {
378
379
  filter: options.filter || [[GTE('id', Value(0))]],
379
380
  aggregate: [
380
381
  {
381
382
  column: 'id',
382
- function: AggregateFunction.COUNT,
383
+ function: AggregateFunction.Count,
383
384
  alias: 'count',
384
385
  },
385
386
  ],
386
387
  join: options.join ? [options.join] : undefined,
387
388
  limit: 1,
388
389
  offset: 0,
389
- group_by: options.groupBy,
390
+ groupBy: options.groupBy,
390
391
  select: ['count'],
391
392
  },
392
393
  });
@@ -1,24 +1,25 @@
1
+ import { SortType } from './filter';
2
+ import { SyntropixDBAccessType } from './requests';
1
3
  export declare enum ForeignKeyAction {
2
- CASCADE = "Cascade",
3
- RESTRICT = "Restrict",
4
- SET_NULL = "SetNull",
5
- NO_ACTION = "NoAction",
6
- SET_DEFAULT = "SetDefault"
4
+ Cascade = "Cascade",
5
+ Restrict = "Restrict",
6
+ SetNull = "SetNull",
7
+ NoAction = "NoAction",
8
+ SetDefault = "SetDefault"
7
9
  }
8
10
  export declare enum AggregateFunction {
9
- COUNT = "Count",
10
- SUM = "Sum",
11
- AVG = "AVG",
12
- MIN = "Min",
13
- MAX = "Max",
14
- COUNT_DISTINCT = "CountDistinct"
11
+ Count = "Count",
12
+ Sum = "Sum",
13
+ Avg = "Avg",
14
+ Min = "Min",
15
+ Max = "Max",
16
+ CountDistinct = "CountDistinct"
15
17
  }
16
18
  export interface Sort {
17
19
  column: string;
18
- direction: 'ASCENDING' | 'DESCENDING';
20
+ direction: SortType;
19
21
  }
20
22
  export interface Join {
21
- type: 'INNER' | 'LEFT' | 'RIGHT' | 'FULL';
22
23
  table: string;
23
24
  on: any;
24
25
  }
@@ -31,21 +32,23 @@ export interface GroupBy {
31
32
  columns: string[];
32
33
  }
33
34
  export interface ForeignKey {
34
- from_table: string;
35
- from_column: string;
36
- to_table: string;
37
- to_column: string;
38
- on_delete?: ForeignKeyAction;
39
- on_update?: ForeignKeyAction;
35
+ name?: string;
36
+ fromTable: string;
37
+ fromColumn: string;
38
+ toTable: string;
39
+ toColumn: string;
40
+ onDelete?: ForeignKeyAction;
41
+ onUpdate?: ForeignKeyAction;
40
42
  }
41
43
  export interface Column {
42
44
  name: string;
43
- column_type: string | Record<string, any>;
45
+ columnType: string | Record<string, any>;
44
46
  description?: string;
45
- is_primary_key?: boolean;
46
- is_nullable?: boolean;
47
- auto_increment?: boolean;
47
+ isPrimaryKey?: boolean;
48
+ isNullable?: boolean;
49
+ autoIncrement?: boolean;
48
50
  default?: any;
51
+ defaultAccess?: SyntropixDBAccessType;
49
52
  }
50
53
  export interface Index {
51
54
  name: string;
@@ -56,16 +59,17 @@ export interface SyntropixDBColumn {
56
59
  id: string;
57
60
  name: string;
58
61
  description: string;
59
- column_type: string | Record<string, any>;
60
- is_nullable: boolean;
61
- is_primary_key: boolean;
62
- auto_increment: boolean;
62
+ columnType: string | Record<string, any>;
63
+ isNullable: boolean;
64
+ isPrimaryKey: boolean;
65
+ autoIncrement: boolean;
63
66
  default?: any;
67
+ defaultAccess?: SyntropixDBAccessType;
64
68
  }
65
69
  export interface SyntropixDBTable {
66
70
  id: string;
67
71
  name: string;
68
72
  description: string;
69
- created_at: Date;
73
+ createdAt: Date;
70
74
  columns: SyntropixDBColumn[];
71
75
  }
@@ -1,18 +1,17 @@
1
- // Common types used across the SDK
2
1
  export var ForeignKeyAction;
3
2
  (function (ForeignKeyAction) {
4
- ForeignKeyAction["CASCADE"] = "Cascade";
5
- ForeignKeyAction["RESTRICT"] = "Restrict";
6
- ForeignKeyAction["SET_NULL"] = "SetNull";
7
- ForeignKeyAction["NO_ACTION"] = "NoAction";
8
- ForeignKeyAction["SET_DEFAULT"] = "SetDefault";
3
+ ForeignKeyAction["Cascade"] = "Cascade";
4
+ ForeignKeyAction["Restrict"] = "Restrict";
5
+ ForeignKeyAction["SetNull"] = "SetNull";
6
+ ForeignKeyAction["NoAction"] = "NoAction";
7
+ ForeignKeyAction["SetDefault"] = "SetDefault";
9
8
  })(ForeignKeyAction || (ForeignKeyAction = {}));
10
9
  export var AggregateFunction;
11
10
  (function (AggregateFunction) {
12
- AggregateFunction["COUNT"] = "Count";
13
- AggregateFunction["SUM"] = "Sum";
14
- AggregateFunction["AVG"] = "AVG";
15
- AggregateFunction["MIN"] = "Min";
16
- AggregateFunction["MAX"] = "Max";
17
- AggregateFunction["COUNT_DISTINCT"] = "CountDistinct";
11
+ AggregateFunction["Count"] = "Count";
12
+ AggregateFunction["Sum"] = "Sum";
13
+ AggregateFunction["Avg"] = "Avg";
14
+ AggregateFunction["Min"] = "Min";
15
+ AggregateFunction["Max"] = "Max";
16
+ AggregateFunction["CountDistinct"] = "CountDistinct";
18
17
  })(AggregateFunction || (AggregateFunction = {}));
@@ -1,39 +1,49 @@
1
- export declare class DataType {
2
- static readonly Integer = "Integer";
3
- static readonly String: (maxLength: number) => {
4
- type: string;
5
- maxLength: number;
6
- };
7
- static readonly Text = "Text";
8
- static readonly Boolean = "Boolean";
9
- static readonly DateTime = "DateTime";
10
- static readonly Timestamp = "Timestamp";
11
- static readonly Date = "Date";
12
- static readonly Json = "Json";
13
- static readonly Uuid = "Uuid";
14
- static readonly Double = "Double";
15
- static readonly Vector: (dimensions: number) => {
16
- type: string;
17
- dimensions: number;
18
- };
19
- static readonly Array: (dataType: string | Record<string, any>) => {
20
- type: string;
21
- dataType: string | Record<string, any>;
22
- };
23
- static readonly Enum: (name: string, variants: string[]) => {
24
- type: string;
25
- name: string;
26
- variants: string[];
27
- };
28
- static readonly Money: (precision: number, scale: number) => {
29
- type: string;
30
- precision: number;
31
- scale: number;
32
- };
33
- static readonly Decimal: (precision: number, scale: number) => {
34
- type: string;
35
- precision: number;
36
- scale: number;
37
- };
1
+ interface StringType {
2
+ type: 'String';
3
+ maxLength: number;
38
4
  }
39
- export type ColumnType = string | Record<string, any>;
5
+ interface VectorType {
6
+ type: 'Vector';
7
+ dimensions: number;
8
+ }
9
+ interface ArrayType {
10
+ type: 'Array';
11
+ dataType: string | Record<string, any>;
12
+ }
13
+ interface EnumType {
14
+ type: 'Enum';
15
+ name: string;
16
+ variants: string[];
17
+ }
18
+ interface MoneyType {
19
+ type: 'Money';
20
+ precision: number;
21
+ scale: number;
22
+ }
23
+ interface DecimalType {
24
+ type: 'Decimal';
25
+ precision: number;
26
+ scale: number;
27
+ }
28
+ export declare const ColumnType: {
29
+ readonly Integer: "Integer";
30
+ readonly String: (maxLength: number) => StringType;
31
+ readonly Text: "Text";
32
+ readonly Boolean: "Boolean";
33
+ readonly DateTime: "DateTime";
34
+ readonly Timestamp: "Timestamp";
35
+ readonly Date: "Date";
36
+ readonly Json: "Json";
37
+ readonly Uuid: "Uuid";
38
+ readonly Double: "Double";
39
+ readonly Vector: (dimensions: number) => VectorType;
40
+ readonly Array: (dataType: string | Record<string, any>) => ArrayType;
41
+ readonly Enum: (name: string, variants: string[]) => EnumType;
42
+ readonly Money: (precision: number, scale: number) => MoneyType;
43
+ readonly Decimal: (precision: number, scale: number) => DecimalType;
44
+ };
45
+ type DataTypeMap = typeof ColumnType;
46
+ type DataTypeValues = DataTypeMap[keyof DataTypeMap];
47
+ type DataTypeReturnTypes = ReturnType<Extract<DataTypeValues, (...args: any[]) => any>>;
48
+ export type ColumnType = Exclude<DataTypeValues, (...args: any[]) => any> | DataTypeReturnTypes;
49
+ export {};
@@ -1,20 +1,19 @@
1
- // Data type definitions for database columns
2
- export class DataType {
1
+ export const ColumnType = {
3
2
  // Basic types
4
- static Integer = 'Integer';
5
- static String = (maxLength) => ({ type: 'String', maxLength });
6
- static Text = 'Text';
7
- static Boolean = 'Boolean';
8
- static DateTime = 'DateTime';
9
- static Timestamp = 'Timestamp';
10
- static Date = 'Date';
11
- static Json = 'Json';
12
- static Uuid = 'Uuid';
13
- static Double = 'Double';
3
+ Integer: 'Integer',
4
+ String: (maxLength) => ({ type: 'String', maxLength }),
5
+ Text: 'Text',
6
+ Boolean: 'Boolean',
7
+ DateTime: 'DateTime',
8
+ Timestamp: 'Timestamp',
9
+ Date: 'Date',
10
+ Json: 'Json',
11
+ Uuid: 'Uuid',
12
+ Double: 'Double',
14
13
  // Complex types
15
- static Vector = (dimensions) => ({ type: 'Vector', dimensions });
16
- static Array = (dataType) => ({ type: 'Array', dataType });
17
- static Enum = (name, variants) => ({ type: 'Enum', name, variants });
18
- static Money = (precision, scale) => ({ type: 'Money', precision, scale });
19
- static Decimal = (precision, scale) => ({ type: 'Decimal', precision, scale });
20
- }
14
+ Vector: (dimensions) => ({ type: 'Vector', dimensions }),
15
+ Array: (dataType) => ({ type: 'Array', dataType }),
16
+ Enum: (name, variants) => ({ type: 'Enum', name, variants }),
17
+ Money: (precision, scale) => ({ type: 'Money', precision, scale }),
18
+ Decimal: (precision, scale) => ({ type: 'Decimal', precision, scale }),
19
+ };
@@ -7,16 +7,16 @@ export interface TableCreateResponse {
7
7
  id: string;
8
8
  name: string;
9
9
  description: string;
10
- created_at: any;
10
+ createdAt: any;
11
11
  columns: Column[];
12
- foreign_keys: ForeignKey[];
12
+ foreignKeys: ForeignKey[];
13
13
  indexes: Index[];
14
14
  schema: string;
15
- default_access: string | null;
15
+ defaultAccess: string | null;
16
16
  };
17
- created_at: any;
18
- updated_at: any;
19
- created_by: string;
17
+ createdAt: any;
18
+ updatedAt: any;
19
+ createdBy: string;
20
20
  metadata: Record<string, any>;
21
21
  triggers: any[];
22
22
  }