nicot 1.3.7 → 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/README-CN.md +19 -0
- package/README.md +16 -0
- package/dist/index.cjs +12 -11
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +12 -11
- package/dist/index.mjs.map +2 -2
- package/dist/src/utility/metadata.d.ts +2 -2
- package/index.ts +2 -0
- package/package.json +12 -6
package/dist/index.d.ts
CHANGED
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
|
};
|
|
@@ -572,6 +570,7 @@ var require_typeorm = __commonJS({
|
|
|
572
570
|
});
|
|
573
571
|
|
|
574
572
|
// index.ts
|
|
573
|
+
import "reflect-metadata";
|
|
575
574
|
export * from "nesties";
|
|
576
575
|
|
|
577
576
|
// src/dto/import-entry.ts
|
|
@@ -971,7 +970,8 @@ var FloatColumn = (type, options = {}) => {
|
|
|
971
970
|
}
|
|
972
971
|
}
|
|
973
972
|
return MergePropertyDecorators2([
|
|
974
|
-
Column(
|
|
973
|
+
Column({
|
|
974
|
+
type,
|
|
975
975
|
default: options.default,
|
|
976
976
|
unsigned: options.unsigned,
|
|
977
977
|
...columnDecoratorOptions(options)
|
|
@@ -1993,6 +1993,7 @@ async function getPaginatedResult(qb, entityClass, entityAliasName, take, cursor
|
|
|
1993
1993
|
|
|
1994
1994
|
// src/crud-base.ts
|
|
1995
1995
|
import PQueue from "p-queue";
|
|
1996
|
+
var existingEntitySelect = () => ({ id: true, deleteTime: true });
|
|
1996
1997
|
var Relation = (name, options = {}) => {
|
|
1997
1998
|
return { name, inner: false, ...options };
|
|
1998
1999
|
};
|
|
@@ -2198,7 +2199,7 @@ var CrudBase = class {
|
|
|
2198
2199
|
where: {
|
|
2199
2200
|
id: In(chunk)
|
|
2200
2201
|
},
|
|
2201
|
-
select: this.crudOptions.createOrUpdate ? void 0 :
|
|
2202
|
+
select: this.crudOptions.createOrUpdate ? void 0 : existingEntitySelect(),
|
|
2202
2203
|
withDeleted: true
|
|
2203
2204
|
})
|
|
2204
2205
|
)
|
|
@@ -2303,7 +2304,7 @@ var CrudBase = class {
|
|
|
2303
2304
|
if (ent.id != null) {
|
|
2304
2305
|
const existingEnt = await repo.findOne({
|
|
2305
2306
|
where: { id: ent.id },
|
|
2306
|
-
select: this.crudOptions.createOrUpdate ? void 0 :
|
|
2307
|
+
select: this.crudOptions.createOrUpdate ? void 0 : existingEntitySelect(),
|
|
2307
2308
|
withDeleted: true,
|
|
2308
2309
|
lock: {
|
|
2309
2310
|
mode: "pessimistic_write",
|