nicot 1.3.8 → 1.4.0
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.cjs +11 -11
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +11 -11
- package/dist/index.mjs.map +2 -2
- package/package.json +6 -4
package/dist/index.mjs
CHANGED
|
@@ -90,7 +90,7 @@ var require_typeorm_utils = __commonJS({
|
|
|
90
90
|
throw new circular_dependency_exception_1.CircularDependencyException("@InjectRepository()");
|
|
91
91
|
}
|
|
92
92
|
const dataSourcePrefix = getDataSourcePrefix(dataSource);
|
|
93
|
-
if (entity instanceof Function && (entity.prototype instanceof typeorm_1.Repository || entity.prototype instanceof typeorm_1.AbstractRepository)) {
|
|
93
|
+
if (entity instanceof Function && (entity.prototype instanceof typeorm_1.Repository || typeorm_1.AbstractRepository && entity.prototype instanceof typeorm_1.AbstractRepository)) {
|
|
94
94
|
if (!dataSourcePrefix) {
|
|
95
95
|
return entity;
|
|
96
96
|
}
|
|
@@ -108,7 +108,7 @@ var require_typeorm_utils = __commonJS({
|
|
|
108
108
|
return repository.name;
|
|
109
109
|
}
|
|
110
110
|
function getDataSourceToken(dataSource = typeorm_constants_1.DEFAULT_DATA_SOURCE_NAME) {
|
|
111
|
-
return typeorm_constants_1.DEFAULT_DATA_SOURCE_NAME === dataSource ? typeorm_1.DataSource
|
|
111
|
+
return typeorm_constants_1.DEFAULT_DATA_SOURCE_NAME === dataSource ? typeorm_1.DataSource : "string" === typeof dataSource ? `${dataSource}DataSource` : typeorm_constants_1.DEFAULT_DATA_SOURCE_NAME === dataSource.name || !dataSource.name ? typeorm_1.DataSource : `${dataSource.name}DataSource`;
|
|
112
112
|
}
|
|
113
113
|
exports.getConnectionToken = getDataSourceToken;
|
|
114
114
|
function getDataSourcePrefix(dataSource = typeorm_constants_1.DEFAULT_DATA_SOURCE_NAME) {
|
|
@@ -313,7 +313,7 @@ var require_typeorm_core_module = __commonJS({
|
|
|
313
313
|
typeOrmModuleOptions
|
|
314
314
|
];
|
|
315
315
|
const exports2 = [entityManagerProvider, dataSourceProvider];
|
|
316
|
-
if (dataSourceProvider.provide === typeorm_1.DataSource) {
|
|
316
|
+
if (typeorm_1.Connection && dataSourceProvider.provide === typeorm_1.DataSource) {
|
|
317
317
|
providers.push({
|
|
318
318
|
provide: typeorm_1.Connection,
|
|
319
319
|
useExisting: typeorm_1.DataSource
|
|
@@ -360,7 +360,7 @@ var require_typeorm_core_module = __commonJS({
|
|
|
360
360
|
entityManagerProvider,
|
|
361
361
|
dataSourceProvider
|
|
362
362
|
];
|
|
363
|
-
if (dataSourceProvider.provide === typeorm_1.DataSource) {
|
|
363
|
+
if (typeorm_1.Connection && dataSourceProvider.provide === typeorm_1.DataSource) {
|
|
364
364
|
providers.push({
|
|
365
365
|
provide: typeorm_1.Connection,
|
|
366
366
|
useExisting: typeorm_1.DataSource
|
|
@@ -423,9 +423,7 @@ var require_typeorm_core_module = __commonJS({
|
|
|
423
423
|
}
|
|
424
424
|
static async createDataSourceFactory(options, dataSourceFactory) {
|
|
425
425
|
const dataSourceToken = (0, typeorm_utils_1.getDataSourceName)(options);
|
|
426
|
-
const createTypeormDataSource = dataSourceFactory ?? ((options2) =>
|
|
427
|
-
return typeorm_1.DataSource === void 0 ? (0, typeorm_1.createConnection)(options2) : new typeorm_1.DataSource(options2);
|
|
428
|
-
});
|
|
426
|
+
const createTypeormDataSource = dataSourceFactory ?? ((options2) => new typeorm_1.DataSource(options2));
|
|
429
427
|
return await (0, rxjs_1.lastValueFrom)((0, rxjs_1.defer)(async () => {
|
|
430
428
|
let dataSource;
|
|
431
429
|
if (!options.autoLoadEntities) {
|
|
@@ -442,7 +440,7 @@ var require_typeorm_core_module = __commonJS({
|
|
|
442
440
|
entities
|
|
443
441
|
});
|
|
444
442
|
}
|
|
445
|
-
return
|
|
443
|
+
return !dataSource.isInitialized && !options.manualInitialization ? dataSource.initialize() : dataSource;
|
|
446
444
|
}).pipe((0, typeorm_utils_1.handleRetry)(options.retryAttempts, options.retryDelay, dataSourceToken, options.verboseRetryLog, options.toRetry)));
|
|
447
445
|
}
|
|
448
446
|
};
|
|
@@ -972,7 +970,8 @@ var FloatColumn = (type, options = {}) => {
|
|
|
972
970
|
}
|
|
973
971
|
}
|
|
974
972
|
return MergePropertyDecorators2([
|
|
975
|
-
Column(
|
|
973
|
+
Column({
|
|
974
|
+
type,
|
|
976
975
|
default: options.default,
|
|
977
976
|
unsigned: options.unsigned,
|
|
978
977
|
...columnDecoratorOptions(options)
|
|
@@ -1994,6 +1993,7 @@ async function getPaginatedResult(qb, entityClass, entityAliasName, take, cursor
|
|
|
1994
1993
|
|
|
1995
1994
|
// src/crud-base.ts
|
|
1996
1995
|
import PQueue from "p-queue";
|
|
1996
|
+
var existingEntitySelect = () => ({ id: true, deleteTime: true });
|
|
1997
1997
|
var Relation = (name, options = {}) => {
|
|
1998
1998
|
return { name, inner: false, ...options };
|
|
1999
1999
|
};
|
|
@@ -2199,7 +2199,7 @@ var CrudBase = class {
|
|
|
2199
2199
|
where: {
|
|
2200
2200
|
id: In(chunk)
|
|
2201
2201
|
},
|
|
2202
|
-
select: this.crudOptions.createOrUpdate ? void 0 :
|
|
2202
|
+
select: this.crudOptions.createOrUpdate ? void 0 : existingEntitySelect(),
|
|
2203
2203
|
withDeleted: true
|
|
2204
2204
|
})
|
|
2205
2205
|
)
|
|
@@ -2304,7 +2304,7 @@ var CrudBase = class {
|
|
|
2304
2304
|
if (ent.id != null) {
|
|
2305
2305
|
const existingEnt = await repo.findOne({
|
|
2306
2306
|
where: { id: ent.id },
|
|
2307
|
-
select: this.crudOptions.createOrUpdate ? void 0 :
|
|
2307
|
+
select: this.crudOptions.createOrUpdate ? void 0 : existingEntitySelect(),
|
|
2308
2308
|
withDeleted: true,
|
|
2309
2309
|
lock: {
|
|
2310
2310
|
mode: "pessimistic_write",
|