@wisemen/nestjs-typeorm 0.0.34 → 0.0.36

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.
@@ -1,5 +1,5 @@
1
- import assert from 'assert';
2
- import { getDataSourceToken, TypeOrmModule as TM } from '@nestjs/typeorm';
1
+ import { TypeOrmModule as TM } from '@nestjs/typeorm';
2
+ import { createConnection, DataSource } from 'typeorm';
3
3
  import { DEFAULT_DATA_SOURCE_NAME } from '@nestjs/typeorm/dist/typeorm.constants.js';
4
4
  import { EntitiesMetadataStorage } from '@nestjs/typeorm/dist/entities-metadata.storage.js';
5
5
  import { createTypeOrmProviders } from './create-providers.js';
@@ -14,30 +14,14 @@ export class TypeOrmModule extends TM {
14
14
  };
15
15
  }
16
16
  static forRootAsync(options) {
17
- const module = super.forRootAsync(options);
18
- const dataSourceToken = getDataSourceToken(options);
19
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
20
- // @ts-expect-error
21
- // eslint-disable-next-line @stylistic/max-len
22
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
23
- const dataSourceProvider = module.imports?.[0].providers?.find(provider => 'provide' in provider
24
- && 'useFactory' in provider
25
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
26
- && provider.provide === dataSourceToken);
27
- assert(dataSourceProvider !== undefined, 'unable to find datasource provider');
28
- const originalFactory = dataSourceProvider.useFactory;
29
- dataSourceProvider.useFactory = async (dataSourceOptions) => {
30
- const modifiedOptions = { ...dataSourceOptions };
31
- const dataTypes = (options.customDataTypes ?? []);
32
- modifiedOptions.driver ??= await import('pg');
33
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
34
- modifiedOptions.driver.supportedDataTypes ??= [];
35
- // eslint-disable-next-line @stylistic/max-len
36
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
37
- modifiedOptions.driver.supportedDataTypes.push(...dataTypes);
38
- return await originalFactory(dataSourceOptions);
17
+ options.dataSourceFactory = async (dataSourceOptions) => {
18
+ const source = DataSource === undefined
19
+ ? await createConnection(dataSourceOptions)
20
+ : new DataSource(dataSourceOptions);
21
+ source.driver.supportedDataTypes.push(...(options.customDataTypes ?? []));
22
+ return source;
39
23
  };
40
- return module;
24
+ return super.forRootAsync(options);
41
25
  }
42
26
  }
43
27
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../../lib/extensions/module.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,kBAAkB,EAAE,aAAa,IAAI,EAAE,EAAmD,MAAM,iBAAiB,CAAA;AAG1H,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAA;AAE3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAQ9D,MAAM,OAAO,aAAc,SAAQ,EAAE;IACnC,MAAM,CAAC,UAAU,CACf,WAAkC,EAAE,EACpC,aAGa,wBAAwB;QAErC,MAAM,SAAS,GAAG,sBAAsB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;QAE9D,uBAAuB,CAAC,uBAAuB,CAAC,UAAU,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAA;QAE1E,OAAO;YACL,MAAM,EAAE,aAAa;YACrB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,SAAS;SACnB,CAAA;IACH,CAAC;IAED,MAAM,CAAC,YAAY,CAAE,OAAwC;QAC3D,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QAC1C,MAAM,eAAe,GAAG,kBAAkB,CAAC,OAAuC,CAAC,CAAA;QAEnF,6DAA6D;QAC7D,mBAAmB;QACnB,8CAA8C;QAC9C,yGAAyG;QACzG,MAAM,kBAAkB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uB,CAAA;AAM9D,MAAM,OAAO,aAAc,SAAQ,EAAE;IACnC,MAAM,CAAC,UAAU,CACf,WAAkC,EAAE,EACpC,aAGa,wBAAwB;QAErC,MAAM,SAAS,GAAG,sBAAsB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;QAE9D,uBAAuB,CAAC,uBAAuB,CAAC,UAAU,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAA;QAE1E,OAAO;YACL,MAAM,EAAE,aAAa;YACrB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,SAAS;SACnB,CAAA;IACH,CAAC;IAED,MAAM,CAAC,YAAY,CAAE,OAAwC;QAC3D,OAAO,CAAC,iBAAiB,GAAG,KAAK,EAAE,iBAAoC,EAAE,EAAE;YACzE,MAAM,MAAM,GAAG,UAAU,KAAK,SAAS;gBACrC,CAAC,CAAC,MAAM,gBAAgB,CAAC,iBAAiB,CAAC;gBAC3C,CAAC,CAAC,IAAI,UAAU,CAAC,iBAAiB,CAAC,CAAA;YAErC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,IAAI,EAAE,CAAiB,CAAC,CAAA;YAEzF,OAAO,MAAM,CAAA;QACf,CAAC,CAAA;QAED,OAAO,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wisemen/nestjs-typeorm",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -18,10 +18,10 @@
18
18
  "release": "pnpx release-it"
19
19
  },
20
20
  "devDependencies": {
21
- "@types/node": "^24.5.2",
22
- "eslint": "^9.36.0",
23
- "expect": "^30.1.2",
24
- "typescript": "^5.9.2"
21
+ "@types/node": "^24.9.2",
22
+ "eslint": "^9.38.0",
23
+ "expect": "^30.2.0",
24
+ "typescript": "^5.9.3"
25
25
  },
26
26
  "author": "Joren Vandeweyer",
27
27
  "license": "GPL",
@@ -30,14 +30,14 @@
30
30
  "url": "git@github.com:wisemen-digital/node-core.git"
31
31
  },
32
32
  "peerDependencies": {
33
- "pg": "8.16.3",
34
- "@nestjs/common": "^11.1.6",
33
+ "@nestjs/common": "^11.1.8",
35
34
  "@nestjs/config": "^4.0.2",
36
35
  "@nestjs/typeorm": "^11.0.0",
37
- "@wisemen/coordinates": "^0.0.10",
38
- "@wisemen/time": "^0.0.26",
36
+ "@wisemen/coordinates": "^0.0.11",
37
+ "@wisemen/time": "^0.0.27",
39
38
  "change-case": "^5.4.4",
40
39
  "class-validator": "^0.14.2",
40
+ "pg": "8.16.3",
41
41
  "typeorm": "^0.3.27"
42
42
  }
43
43
  }