orchid-orm 1.13.1 → 1.13.2

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.ts CHANGED
@@ -209,14 +209,16 @@ type Table = {
209
209
  columnTypes: ColumnTypesBase;
210
210
  noPrimaryKey?: boolean;
211
211
  filePath: string;
212
+ language?: string;
212
213
  };
213
214
  type TableType<T extends Pick<Table, 'columns'>> = T['columns']['type'];
214
- declare const createBaseTable: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>({ columnTypes, snakeCase, filePath, nowSQL, exportAs, }?: {
215
+ declare const createBaseTable: <CT extends Record<string, orchid_core.AnyColumnTypeCreator>>({ columnTypes, snakeCase, filePath, nowSQL, exportAs, language, }?: {
215
216
  columnTypes?: CT | ((t: DefaultColumnTypes) => CT) | undefined;
216
217
  snakeCase?: boolean | undefined;
217
218
  filePath?: string | undefined;
218
219
  nowSQL?: string | undefined;
219
220
  exportAs?: string | undefined;
221
+ language?: string | undefined;
220
222
  }) => {
221
223
  new (): {
222
224
  table: string;
@@ -359,7 +361,8 @@ declare const createBaseTable: <CT extends Record<string, orchid_core.AnyColumnT
359
361
  name?: string | undefined;
360
362
  } | undefined): {};
361
363
  index(columns: orchid_core.MaybeArray<string | pqb.IndexColumnOptions>, options?: pqb.IndexOptions): {};
362
- unique(columns: orchid_core.MaybeArray<string | pqb.IndexColumnOptions>, options?: pqb.IndexOptions): {};
364
+ unique(columns: orchid_core.MaybeArray<string | pqb.IndexColumnOptions>, options?: pqb.IndexOptions | undefined): {};
365
+ searchIndex(columns: orchid_core.MaybeArray<string | pqb.IndexColumnOptions>, options?: pqb.IndexOptions | undefined): {};
363
366
  constraint<Table_1 extends string | (() => orchid_core.ForeignKeyTable), Columns extends Table_1 extends () => orchid_core.ForeignKeyTable ? [orchid_core.ColumnNameOfTable<ReturnType<Table_1>>, ...orchid_core.ColumnNameOfTable<ReturnType<Table_1>>[]] : [string, ...string[]]>({ name, references, check, dropMode, }: {
364
367
  name?: string | undefined;
365
368
  references?: [columns: string[], fnOrTable: Table_1, foreignColumns: Columns, options?: pqb.ForeignKeyOptions | undefined] | undefined;
@@ -373,6 +376,7 @@ declare const createBaseTable: <CT extends Record<string, orchid_core.AnyColumnT
373
376
  check(check: orchid_core.RawSQLBase<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>, {}>): {};
374
377
  } : CT;
375
378
  q: QueryData;
379
+ language: string | undefined;
376
380
  filePath: string;
377
381
  result: ColumnsShapeBase;
378
382
  clone<T_20 extends QueryBase>(this: T_20): T_20;
@@ -512,7 +516,8 @@ declare const createBaseTable: <CT extends Record<string, orchid_core.AnyColumnT
512
516
  name?: string | undefined;
513
517
  } | undefined): {};
514
518
  index(columns: orchid_core.MaybeArray<string | pqb.IndexColumnOptions>, options?: pqb.IndexOptions): {};
515
- unique(columns: orchid_core.MaybeArray<string | pqb.IndexColumnOptions>, options?: pqb.IndexOptions): {};
519
+ unique(columns: orchid_core.MaybeArray<string | pqb.IndexColumnOptions>, options?: pqb.IndexOptions | undefined): {};
520
+ searchIndex(columns: orchid_core.MaybeArray<string | pqb.IndexColumnOptions>, options?: pqb.IndexOptions | undefined): {};
516
521
  constraint<Table_1 extends string | (() => orchid_core.ForeignKeyTable), Columns extends Table_1 extends () => orchid_core.ForeignKeyTable ? [orchid_core.ColumnNameOfTable<ReturnType<Table_1>>, ...orchid_core.ColumnNameOfTable<ReturnType<Table_1>>[]] : [string, ...string[]]>({ name, references, check, dropMode, }: {
517
522
  name?: string | undefined;
518
523
  references?: [columns: string[], fnOrTable: Table_1, foreignColumns: Columns, options?: pqb.ForeignKeyOptions | undefined] | undefined;
package/dist/index.js CHANGED
@@ -9,7 +9,8 @@ const createBaseTable = ({
9
9
  snakeCase,
10
10
  filePath,
11
11
  nowSQL,
12
- exportAs
12
+ exportAs,
13
+ language
13
14
  } = { columnTypes: pqb.columnTypes }) => {
14
15
  const ct = typeof columnTypes === "function" ? columnTypes(pqb.columnTypes) : columnTypes || pqb.columnTypes;
15
16
  return create(
@@ -18,10 +19,11 @@ const createBaseTable = ({
18
19
  filePath || orchidCore.getStackTrace(),
19
20
  snakeCase,
20
21
  nowSQL,
21
- exportAs
22
+ exportAs,
23
+ language
22
24
  );
23
25
  };
24
- const create = (columnTypes, filePathOrStack, snakeCase, nowSQL, exportAs = "BaseTable") => {
26
+ const create = (columnTypes, filePathOrStack, snakeCase, nowSQL, exportAs = "BaseTable", language) => {
25
27
  var _a;
26
28
  let filePath;
27
29
  const base = (_a = class {
@@ -29,6 +31,7 @@ const create = (columnTypes, filePathOrStack, snakeCase, nowSQL, exportAs = "Bas
29
31
  this.snakeCase = snakeCase;
30
32
  this.columnTypes = columnTypes;
31
33
  this.q = {};
34
+ this.language = language;
32
35
  }
33
36
  static getFilePath() {
34
37
  if (filePath)
@@ -59,7 +62,7 @@ const create = (columnTypes, filePathOrStack, snakeCase, nowSQL, exportAs = "Bas
59
62
  }
60
63
  setColumns(fn) {
61
64
  columnTypes[orchidCore.snakeCaseKey] = this.snakeCase;
62
- const shape = pqb.getColumnTypes(columnTypes, fn, nowSQL);
65
+ const shape = pqb.getColumnTypes(columnTypes, fn, nowSQL, this.language);
63
66
  if (this.snakeCase) {
64
67
  for (const key in shape) {
65
68
  const column = shape[key];
@@ -1428,7 +1431,8 @@ const orchidORM = (_a, tables) => {
1428
1431
  const table = new tables[key]();
1429
1432
  tableInstances[key] = table;
1430
1433
  const options2 = __spreadProps(__spreadValues$1({}, commonOptions), {
1431
- schema: table.schema
1434
+ schema: table.schema,
1435
+ language: table.language
1432
1436
  });
1433
1437
  if (table.noPrimaryKey)
1434
1438
  options2.noPrimaryKey = "ignore";