@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
|
|
2
|
-
import {
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
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":"
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../lib/extensions/module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,IAAI,EAAE,EAA6B,MAAM,iBAAiB,CAAA;AAEhF,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAqB,MAAM,SAAS,CAAA;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAA;AAE3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,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.
|
|
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.
|
|
22
|
-
"eslint": "^9.
|
|
23
|
-
"expect": "^30.
|
|
24
|
-
"typescript": "^5.9.
|
|
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
|
-
"
|
|
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.
|
|
38
|
-
"@wisemen/time": "^0.0.
|
|
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
|
}
|