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/dist/index.mjs
CHANGED
|
@@ -1652,6 +1652,11 @@ const createTable$1 = ({ filePath, tablePath, statements, object, content, space
|
|
|
1652
1652
|
);
|
|
1653
1653
|
if (existing.length)
|
|
1654
1654
|
return;
|
|
1655
|
+
for (const prop of object.properties) {
|
|
1656
|
+
if (key === ts.prop.getName(prop)) {
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1655
1660
|
const importPos = ts.import.getEndPos(statements);
|
|
1656
1661
|
changes.add(
|
|
1657
1662
|
importPos,
|
|
@@ -2314,16 +2319,22 @@ var __spreadValues = (a, b) => {
|
|
|
2314
2319
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2315
2320
|
class AppCodeUpdaterError extends Error {
|
|
2316
2321
|
}
|
|
2317
|
-
const appCodeUpdater = (
|
|
2322
|
+
const appCodeUpdater = ({
|
|
2323
|
+
tablePath,
|
|
2324
|
+
baseTablePath,
|
|
2325
|
+
baseTableName,
|
|
2326
|
+
mainFilePath
|
|
2327
|
+
}) => {
|
|
2318
2328
|
return async ({ ast, options, basePath, cache: cacheObject }) => {
|
|
2319
|
-
const params =
|
|
2320
|
-
baseTableName: config.baseTableName || "BaseTable",
|
|
2329
|
+
const params = {
|
|
2321
2330
|
tablePath(name) {
|
|
2322
|
-
const file =
|
|
2323
|
-
return
|
|
2331
|
+
const file = tablePath(name);
|
|
2332
|
+
return resolvePath(basePath, file);
|
|
2324
2333
|
},
|
|
2325
|
-
|
|
2326
|
-
|
|
2334
|
+
baseTablePath: resolvePath(basePath, baseTablePath),
|
|
2335
|
+
baseTableName: baseTableName || "BaseTable",
|
|
2336
|
+
mainFilePath: resolvePath(basePath, mainFilePath)
|
|
2337
|
+
};
|
|
2327
2338
|
const promises = [
|
|
2328
2339
|
updateMainFile(params.mainFilePath, params.tablePath, ast, options),
|
|
2329
2340
|
updateTableFile(__spreadProps(__spreadValues({}, params), { ast }))
|
|
@@ -2339,6 +2350,7 @@ const appCodeUpdater = (config) => {
|
|
|
2339
2350
|
await Promise.all(promises);
|
|
2340
2351
|
};
|
|
2341
2352
|
};
|
|
2353
|
+
const resolvePath = (basePath, filePath) => path.isAbsolute(filePath) ? filePath : path.resolve(basePath, filePath);
|
|
2342
2354
|
|
|
2343
2355
|
export { AppCodeUpdaterError, appCodeUpdater, createBaseTable, createRepo, orchidORM };
|
|
2344
2356
|
//# sourceMappingURL=index.mjs.map
|