orchid-orm 1.5.20 → 1.5.22
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 +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/codegen/appCodeUpdater.test.ts +7 -3
- package/src/codegen/appCodeUpdater.ts +14 -10
- package/src/codegen/updateMainFile.test.ts +19 -4
- package/src/codegen/updateMainFile.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# orchid-orm
|
|
2
2
|
|
|
3
|
+
## 1.5.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Make codegen to not add table to the main file when the key already exist
|
|
8
|
+
|
|
9
|
+
## 1.5.21
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Fix baseTablePath in orm codegen
|
|
14
|
+
|
|
3
15
|
## 1.5.20
|
|
4
16
|
|
|
5
17
|
### 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: (
|
|
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
|
@@ -1679,6 +1679,11 @@ const createTable$1 = ({ filePath, tablePath, statements, object, content, space
|
|
|
1679
1679
|
);
|
|
1680
1680
|
if (existing.length)
|
|
1681
1681
|
return;
|
|
1682
|
+
for (const prop of object.properties) {
|
|
1683
|
+
if (key === ts.prop.getName(prop)) {
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1682
1687
|
const importPos = ts.import.getEndPos(statements);
|
|
1683
1688
|
changes.add(
|
|
1684
1689
|
importPos,
|
|
@@ -2341,16 +2346,22 @@ var __spreadValues = (a, b) => {
|
|
|
2341
2346
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2342
2347
|
class AppCodeUpdaterError extends Error {
|
|
2343
2348
|
}
|
|
2344
|
-
const appCodeUpdater = (
|
|
2349
|
+
const appCodeUpdater = ({
|
|
2350
|
+
tablePath,
|
|
2351
|
+
baseTablePath,
|
|
2352
|
+
baseTableName,
|
|
2353
|
+
mainFilePath
|
|
2354
|
+
}) => {
|
|
2345
2355
|
return async ({ ast, options, basePath, cache: cacheObject }) => {
|
|
2346
|
-
const params =
|
|
2347
|
-
baseTableName: config.baseTableName || "BaseTable",
|
|
2356
|
+
const params = {
|
|
2348
2357
|
tablePath(name) {
|
|
2349
|
-
const file =
|
|
2350
|
-
return
|
|
2358
|
+
const file = tablePath(name);
|
|
2359
|
+
return resolvePath(basePath, file);
|
|
2351
2360
|
},
|
|
2352
|
-
|
|
2353
|
-
|
|
2361
|
+
baseTablePath: resolvePath(basePath, baseTablePath),
|
|
2362
|
+
baseTableName: baseTableName || "BaseTable",
|
|
2363
|
+
mainFilePath: resolvePath(basePath, mainFilePath)
|
|
2364
|
+
};
|
|
2354
2365
|
const promises = [
|
|
2355
2366
|
updateMainFile(params.mainFilePath, params.tablePath, ast, options),
|
|
2356
2367
|
updateTableFile(__spreadProps(__spreadValues({}, params), { ast }))
|
|
@@ -2366,6 +2377,7 @@ const appCodeUpdater = (config) => {
|
|
|
2366
2377
|
await Promise.all(promises);
|
|
2367
2378
|
};
|
|
2368
2379
|
};
|
|
2380
|
+
const resolvePath = (basePath, filePath) => path__namespace.isAbsolute(filePath) ? filePath : path__namespace.resolve(basePath, filePath);
|
|
2369
2381
|
|
|
2370
2382
|
Object.defineProperty(exports, 'columnTypes', {
|
|
2371
2383
|
enumerable: true,
|