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/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import 'reflect-metadata';
1
2
  export * from 'nesties';
2
3
  export * from './src/crud-base';
3
4
  export * from './src/restful';
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 ?? typeorm_1.Connection : "string" === typeof dataSource ? `${dataSource}DataSource` : typeorm_constants_1.DEFAULT_DATA_SOURCE_NAME === dataSource.name || !dataSource.name ? typeorm_1.DataSource ?? typeorm_1.Connection : `${dataSource.name}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 dataSource.initialize && !dataSource.isInitialized && !options.manualInitialization ? dataSource.initialize() : dataSource;
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(type, {
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 : ["id", "deleteTime"],
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 : ["id", "deleteTime"],
2307
+ select: this.crudOptions.createOrUpdate ? void 0 : existingEntitySelect(),
2307
2308
  withDeleted: true,
2308
2309
  lock: {
2309
2310
  mode: "pessimistic_write",