orchid-orm 1.5.20 → 1.5.21

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # orchid-orm
2
2
 
3
+ ## 1.5.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix baseTablePath in orm codegen
8
+
3
9
  ## 1.5.20
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -435,6 +435,6 @@ declare type AppCodeUpdaterConfig = {
435
435
  baseTableName: string;
436
436
  mainFilePath: string;
437
437
  };
438
- declare const appCodeUpdater: (config: SetOptional<AppCodeUpdaterConfig, 'baseTableName'>) => AppCodeUpdater;
438
+ declare const appCodeUpdater: ({ tablePath, baseTablePath, baseTableName, mainFilePath, }: SetOptional<AppCodeUpdaterConfig, 'baseTableName'>) => AppCodeUpdater;
439
439
 
440
440
  export { AppCodeUpdaterConfig, AppCodeUpdaterError, DbTable, MapMethods, MapQueryMethods, MethodsBase, OrchidORM, QueryMethods, Repo, Table, TableClass, TableClasses, TableToDb, appCodeUpdater, createBaseTable, createRepo, orchidORM };
package/dist/index.js CHANGED
@@ -2341,16 +2341,22 @@ var __spreadValues = (a, b) => {
2341
2341
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
2342
2342
  class AppCodeUpdaterError extends Error {
2343
2343
  }
2344
- const appCodeUpdater = (config) => {
2344
+ const appCodeUpdater = ({
2345
+ tablePath,
2346
+ baseTablePath,
2347
+ baseTableName,
2348
+ mainFilePath
2349
+ }) => {
2345
2350
  return async ({ ast, options, basePath, cache: cacheObject }) => {
2346
- const params = __spreadProps(__spreadValues({}, config), {
2347
- baseTableName: config.baseTableName || "BaseTable",
2351
+ const params = {
2348
2352
  tablePath(name) {
2349
- const file = config.tablePath(name);
2350
- return path__namespace.isAbsolute(file) ? file : path__namespace.resolve(basePath, file);
2353
+ const file = tablePath(name);
2354
+ return resolvePath(basePath, file);
2351
2355
  },
2352
- mainFilePath: path__namespace.isAbsolute(config.mainFilePath) ? config.mainFilePath : path__namespace.resolve(basePath, config.mainFilePath)
2353
- });
2356
+ baseTablePath: resolvePath(basePath, baseTablePath),
2357
+ baseTableName: baseTableName || "BaseTable",
2358
+ mainFilePath: resolvePath(basePath, mainFilePath)
2359
+ };
2354
2360
  const promises = [
2355
2361
  updateMainFile(params.mainFilePath, params.tablePath, ast, options),
2356
2362
  updateTableFile(__spreadProps(__spreadValues({}, params), { ast }))
@@ -2366,6 +2372,7 @@ const appCodeUpdater = (config) => {
2366
2372
  await Promise.all(promises);
2367
2373
  };
2368
2374
  };
2375
+ const resolvePath = (basePath, filePath) => path__namespace.isAbsolute(filePath) ? filePath : path__namespace.resolve(basePath, filePath);
2369
2376
 
2370
2377
  Object.defineProperty(exports, 'columnTypes', {
2371
2378
  enumerable: true,