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 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
  exports2.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 exports3 = [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
  };
@@ -1049,7 +1047,8 @@ var FloatColumn = (type, options = {}) => {
1049
1047
  }
1050
1048
  }
1051
1049
  return (0, import_nesties4.MergePropertyDecorators)([
1052
- (0, import_typeorm.Column)(type, {
1050
+ (0, import_typeorm.Column)({
1051
+ type,
1053
1052
  default: options.default,
1054
1053
  unsigned: options.unsigned,
1055
1054
  ...columnDecoratorOptions(options)
@@ -2060,6 +2059,7 @@ async function getPaginatedResult(qb, entityClass, entityAliasName, take, cursor
2060
2059
 
2061
2060
  // src/crud-base.ts
2062
2061
  var import_p_queue = __toESM(require("p-queue"));
2062
+ var existingEntitySelect = () => ({ id: true, deleteTime: true });
2063
2063
  var Relation = (name, options = {}) => {
2064
2064
  return { name, inner: false, ...options };
2065
2065
  };
@@ -2265,7 +2265,7 @@ var CrudBase = class {
2265
2265
  where: {
2266
2266
  id: (0, import_typeorm8.In)(chunk)
2267
2267
  },
2268
- select: this.crudOptions.createOrUpdate ? void 0 : ["id", "deleteTime"],
2268
+ select: this.crudOptions.createOrUpdate ? void 0 : existingEntitySelect(),
2269
2269
  withDeleted: true
2270
2270
  })
2271
2271
  )
@@ -2370,7 +2370,7 @@ var CrudBase = class {
2370
2370
  if (ent.id != null) {
2371
2371
  const existingEnt = await repo.findOne({
2372
2372
  where: { id: ent.id },
2373
- select: this.crudOptions.createOrUpdate ? void 0 : ["id", "deleteTime"],
2373
+ select: this.crudOptions.createOrUpdate ? void 0 : existingEntitySelect(),
2374
2374
  withDeleted: true,
2375
2375
  lock: {
2376
2376
  mode: "pessimistic_write",