orchid-orm 1.7.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { columnTypes, getColumnTypes, addQueryOn, VirtualColumn, pushQueryValue, isQueryReturnsAll, getQueryAs, toSqlCacheKey, NotFoundError, relationQueryKey, Adapter, Db, anyShape, getClonedQueryData, columnsShapeToCode, primaryKeyToCode, indexToCode, constraintToCode, columnIndexesToCode, columnForeignKeysToCode, columnCheckToCode, identityToCode } from 'pqb';
2
2
  export { OrchidOrmError, OrchidOrmInternalError, columnTypes } from 'pqb';
3
- import { snakeCaseKey, toSnakeCase, emptyObject, pathToLog, toCamelCase, toPascalCase, singleQuote, codeToString, quoteObjectKey, addCode, columnDefaultArgumentToCode, deepCompare } from 'orchid-core';
3
+ import { snakeCaseKey, toSnakeCase, emptyObject, pathToLog, toCamelCase, toPascalCase, getImportPath, singleQuote, codeToString, quoteObjectKey, addCode, columnDefaultArgumentToCode, deepCompare } from 'orchid-core';
4
4
  import { AsyncLocalStorage } from 'node:async_hooks';
5
5
  import * as path from 'path';
6
6
  import path__default from 'path';
@@ -18,7 +18,7 @@ const createBaseTable = ({
18
18
  );
19
19
  };
20
20
  const create = (columnTypes, snakeCase) => {
21
- return class BaseTable {
21
+ const base = class BaseTable {
22
22
  constructor() {
23
23
  this.snakeCase = snakeCase;
24
24
  this.setColumns = (fn) => {
@@ -75,6 +75,8 @@ const create = (columnTypes, snakeCase) => {
75
75
  };
76
76
  }
77
77
  };
78
+ base.prototype.columnTypes = columnTypes;
79
+ return base;
78
80
  };
79
81
 
80
82
  class BelongsToVirtualColumn extends VirtualColumn {
@@ -1596,12 +1598,6 @@ const ts = {
1596
1598
  }
1597
1599
  };
1598
1600
 
1599
- const getImportPath = (from, to) => {
1600
- const rel = path__default.relative(path__default.dirname(from), to).split(path__default.sep).join(path__default.posix.sep);
1601
- const importPath = rel.startsWith("./") || rel.startsWith("../") ? rel : `./${rel}`;
1602
- return importPath.replace(/\.[tj]s$/, "");
1603
- };
1604
-
1605
1601
  const libraryName = "orchid-orm";
1606
1602
  const importKey = "orchidORM";
1607
1603
  const newFile = (options) => `import { orchidORM } from 'orchid-orm';