@celljs/typeorm 3.9.0 → 4.1.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.md +10 -0
- package/cell.yml +8 -31
- package/esm/common/utils.d.ts +6 -0
- package/esm/common/utils.js +30 -5
- package/esm/common/utils.js.map +1 -1
- package/lib/common/utils.d.ts +6 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +31 -5
- package/lib/common/utils.js.map +1 -1
- package/lib/common/utils.spec.d.ts +2 -0
- package/lib/common/utils.spec.d.ts.map +1 -0
- package/lib/common/utils.spec.js +31 -0
- package/lib/common/utils.spec.js.map +1 -0
- package/lib/node/default-config.spec.d.ts +2 -0
- package/lib/node/default-config.spec.d.ts.map +1 -0
- package/lib/node/default-config.spec.js +37 -0
- package/lib/node/default-config.spec.js.map +1 -0
- package/package.json +47 -15
- package/src/common/utils.spec.ts +30 -0
- package/src/common/utils.ts +28 -5
- package/src/node/default-config.spec.ts +40 -0
- package/cell-fc.yml +0 -10
package/README.md
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
1
|
# Cell - typeorm Component
|
|
2
|
+
|
|
3
|
+
[TypeORM](https://typeorm.io) data sources, repositories and `@Transactional()` for Cell backends.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @celljs/typeorm mysql2
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Database drivers are not dependencies of this package: install the one your data source uses (`mysql2`, `pg`, `better-sqlite3`, …). `mysql2` is an optional peer dependency; when the driver of a configured data source is missing, the application fails at startup with `CELL_TYPEORM_DRIVER_MISSING` and the command that installs it.
|
package/cell.yml
CHANGED
|
@@ -1,34 +1,11 @@
|
|
|
1
1
|
cell:
|
|
2
|
-
webpack:
|
|
3
|
-
filterWarningsPlugin:
|
|
4
|
-
typeorm:
|
|
5
|
-
- typeorm-aurora-data-api-driver
|
|
6
|
-
- mongodb
|
|
7
|
-
- mssql
|
|
8
|
-
- mysql
|
|
9
|
-
- mysql2
|
|
10
|
-
- oracledb
|
|
11
|
-
- pg
|
|
12
|
-
- pg-native
|
|
13
|
-
- pg-query-stream
|
|
14
|
-
- sql.js
|
|
15
|
-
- redis
|
|
16
|
-
- sqlite3
|
|
17
|
-
- react-native-sqlite-storage
|
|
18
|
-
- cli-highlight
|
|
19
|
-
- Critical dependency
|
|
20
|
-
- '@sap/hdbext'
|
|
21
|
-
- '@sap/hana-client'
|
|
22
|
-
- hdb-pool
|
|
23
|
-
- ioredis
|
|
24
|
-
- better-sqlite3
|
|
25
|
-
- '@google-cloud/spanner'
|
|
26
2
|
typeorm:
|
|
27
3
|
ormConfig:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
#
|
|
34
|
-
|
|
4
|
+
# Environment variables are text: convert them, so that DB_PORT=5432 is a number and DB_SYNC=false is false.
|
|
5
|
+
- type: "${ env.DB_TYPE ?: 'mysql' }"
|
|
6
|
+
host: "${ env.DB_HOST ?: 'localhost' }"
|
|
7
|
+
port: "${ (env.DB_PORT ?: 3306) * 1 }"
|
|
8
|
+
synchronize: "${ (env.DB_SYNC ?: 'true') == 'true' }"
|
|
9
|
+
# username: "${ env.DB_USERNAME ?: 'root' }"
|
|
10
|
+
# password: "${ env.DB_PASSWORD ?: 'root' }"
|
|
11
|
+
database: "${ env.DB_DATABASE ?: 'test' }"
|
package/esm/common/utils.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { DataSource, DataSourceOptions } from 'typeorm';
|
|
2
2
|
export declare function getDataSource(name?: string): Promise<DataSource>;
|
|
3
3
|
export declare function createDataSources(options: DataSourceOptions[]): Promise<DataSource[]>;
|
|
4
|
+
/**
|
|
5
|
+
* Database drivers are peer dependencies the project installs (mysql2 for `type: mysql`). When one
|
|
6
|
+
* is missing, typeorm throws a DriverPackageNotInstalledError; this turns it into a CellError that
|
|
7
|
+
* names the package to install.
|
|
8
|
+
*/
|
|
9
|
+
export declare function toDriverMissingError(error: unknown): Promise<Error | undefined>;
|
package/esm/common/utils.js
CHANGED
|
@@ -9,12 +9,37 @@ export async function getDataSource(name) {
|
|
|
9
9
|
return dataSource;
|
|
10
10
|
}
|
|
11
11
|
export async function createDataSources(options) {
|
|
12
|
+
var _a;
|
|
12
13
|
const dataSourceManager = ContainerUtil.get(DataSourceManager);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
try {
|
|
15
|
+
const dataSources = options.map(option => dataSourceManager.create(option));
|
|
16
|
+
// Do not use Promise.all or test 8522 will produce a dangling sqlite connection
|
|
17
|
+
for (const dataSource of dataSources) {
|
|
18
|
+
await dataSource.initialize();
|
|
19
|
+
}
|
|
20
|
+
return dataSources;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw (_a = (await toDriverMissingError(error))) !== null && _a !== void 0 ? _a : error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Database drivers are peer dependencies the project installs (mysql2 for `type: mysql`). When one
|
|
28
|
+
* is missing, typeorm throws a DriverPackageNotInstalledError; this turns it into a CellError that
|
|
29
|
+
* names the package to install.
|
|
30
|
+
*/
|
|
31
|
+
export async function toDriverMissingError(error) {
|
|
32
|
+
var _a;
|
|
33
|
+
if (!(error instanceof Error) || error.name !== 'DriverPackageNotInstalledError') {
|
|
34
|
+
return undefined;
|
|
17
35
|
}
|
|
18
|
-
|
|
36
|
+
const driver = (_a = /npm install ([^\s"'`]+)/.exec(error.message)) === null || _a === void 0 ? void 0 : _a[1];
|
|
37
|
+
const { CellError } = await import('@celljs/kit');
|
|
38
|
+
return new CellError({
|
|
39
|
+
code: 'CELL_TYPEORM_DRIVER_MISSING',
|
|
40
|
+
message: `The database driver${driver ? ` ${driver}` : ''} is not installed: ${error.message}`,
|
|
41
|
+
hint: driver ? `Add it to the dependencies of the project: npm install ${driver}` : 'Install the driver package of the database type in cell.typeorm.ormConfig.',
|
|
42
|
+
cause: error,
|
|
43
|
+
});
|
|
19
44
|
}
|
|
20
45
|
//# sourceMappingURL=utils.js.map
|
package/esm/common/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAa;IAC7C,MAAM,iBAAiB,GAAG,aAAa,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;IACD,OAAO,UAAU,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAA4B
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAa;IAC7C,MAAM,iBAAiB,GAAG,aAAa,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;IACD,OAAO,UAAU,CAAC;AACtB,CA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CAAC;AACP,CAAC"}
|
package/lib/common/utils.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { DataSource, DataSourceOptions } from 'typeorm';
|
|
2
2
|
export declare function getDataSource(name?: string): Promise<DataSource>;
|
|
3
3
|
export declare function createDataSources(options: DataSourceOptions[]): Promise<DataSource[]>;
|
|
4
|
+
/**
|
|
5
|
+
* Database drivers are peer dependencies the project installs (mysql2 for `type: mysql`). When one
|
|
6
|
+
* is missing, typeorm throws a DriverPackageNotInstalledError; this turns it into a CellError that
|
|
7
|
+
* names the package to install.
|
|
8
|
+
*/
|
|
9
|
+
export declare function toDriverMissingError(error: unknown): Promise<Error | undefined>;
|
|
4
10
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGxD,wBAAsB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,uBAOhD;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGxD,wBAAsB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,uBAOhD;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAY3F;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAYrF"}
|
package/lib/common/utils.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDataSource = getDataSource;
|
|
4
4
|
exports.createDataSources = createDataSources;
|
|
5
|
+
exports.toDriverMissingError = toDriverMissingError;
|
|
5
6
|
const core_1 = require("@celljs/core");
|
|
6
7
|
const common_1 = require("../common");
|
|
7
8
|
async function getDataSource(name) {
|
|
@@ -13,12 +14,37 @@ async function getDataSource(name) {
|
|
|
13
14
|
return dataSource;
|
|
14
15
|
}
|
|
15
16
|
async function createDataSources(options) {
|
|
17
|
+
var _a;
|
|
16
18
|
const dataSourceManager = core_1.ContainerUtil.get(common_1.DataSourceManager);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
try {
|
|
20
|
+
const dataSources = options.map(option => dataSourceManager.create(option));
|
|
21
|
+
// Do not use Promise.all or test 8522 will produce a dangling sqlite connection
|
|
22
|
+
for (const dataSource of dataSources) {
|
|
23
|
+
await dataSource.initialize();
|
|
24
|
+
}
|
|
25
|
+
return dataSources;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw (_a = (await toDriverMissingError(error))) !== null && _a !== void 0 ? _a : error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Database drivers are peer dependencies the project installs (mysql2 for `type: mysql`). When one
|
|
33
|
+
* is missing, typeorm throws a DriverPackageNotInstalledError; this turns it into a CellError that
|
|
34
|
+
* names the package to install.
|
|
35
|
+
*/
|
|
36
|
+
async function toDriverMissingError(error) {
|
|
37
|
+
var _a;
|
|
38
|
+
if (!(error instanceof Error) || error.name !== 'DriverPackageNotInstalledError') {
|
|
39
|
+
return undefined;
|
|
21
40
|
}
|
|
22
|
-
|
|
41
|
+
const driver = (_a = /npm install ([^\s"'`]+)/.exec(error.message)) === null || _a === void 0 ? void 0 : _a[1];
|
|
42
|
+
const { CellError } = await import('@celljs/kit');
|
|
43
|
+
return new CellError({
|
|
44
|
+
code: 'CELL_TYPEORM_DRIVER_MISSING',
|
|
45
|
+
message: `The database driver${driver ? ` ${driver}` : ''} is not installed: ${error.message}`,
|
|
46
|
+
hint: driver ? `Add it to the dependencies of the project: npm install ${driver}` : 'Install the driver package of the database type in cell.typeorm.ormConfig.',
|
|
47
|
+
cause: error,
|
|
48
|
+
});
|
|
23
49
|
}
|
|
24
50
|
//# sourceMappingURL=utils.js.map
|
package/lib/common/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":";;;;;AAAA,uCAA6C;AAE7C,sCAA8C;AAEvC,KAAK,wBAAwB,IAAa;IAC7C,MAAM,iBAAiB,GAAG,oBAAa,CAAC,GAAG,CAAC,0BAAiB,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;IACD,OAAO,UAAU,CAAC;AACtB,CAAC;AAEM,KAAK,4BAA4B,OAA4B;;IAChE,MAAM,iBAAiB,GAAG,oBAAa,CAAC,GAAG,CAAC,0BAAiB,CAAC,CAAC;IAC/D,IAAI,CAAC;QACD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5E,gFAAgF;QAChF,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACnC,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;QAClC,CAAC;QACD,OAAO,WAAW,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,YAAM,CAAC,MAAM,oBAAoB,CAAC,KAAK,CAAC,CAAC,mCAAI,KAAK,CAAC;IACvD,CAAC;AACL,CAAC;AAED;;;;GAIG;AACI,KAAK,+BAA+B,KAAc;;IACrD,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,gCAAgC,EAAE,CAAC;QAC/E,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,MAAM,MAAM,GAAG,MAAA,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,0CAAG,CAAC,CAAC,CAAC;IAClE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IAClD,OAAO,IAAI,SAAS,CAAC;QACjB,IAAI,EAAE,6BAA6B;QACnC,OAAO,EAAE,sBAAsB,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,sBAAsB,KAAK,CAAC,OAAO,EAAE;QAC9F,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,0DAA0D,MAAM,EAAE,CAAC,CAAC,CAAC,4EAA4E;QAChK,KAAK,EAAE,KAAK;KACf,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.spec.d.ts","sourceRoot":"","sources":["../../src/common/utils.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const chai_1 = require("chai");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const DriverPackageNotInstalledError_1 = require("typeorm/error/DriverPackageNotInstalledError");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
(0, bun_test_1.describe)('toDriverMissingError', () => {
|
|
9
|
+
(0, bun_test_1.it)('turns a missing driver into a CellError naming the package', async () => {
|
|
10
|
+
const error = await (0, utils_1.toDriverMissingError)(new DriverPackageNotInstalledError_1.DriverPackageNotInstalledError('Mysql', 'mysql2'));
|
|
11
|
+
(0, chai_1.expect)(error === null || error === void 0 ? void 0 : error.name).to.equal('CellError');
|
|
12
|
+
(0, chai_1.expect)(error.code).to.equal('CELL_TYPEORM_DRIVER_MISSING');
|
|
13
|
+
(0, chai_1.expect)(error.hint).to.equal('Add it to the dependencies of the project: npm install mysql2');
|
|
14
|
+
});
|
|
15
|
+
(0, bun_test_1.it)('leaves other errors alone', async () => {
|
|
16
|
+
(0, chai_1.expect)(await (0, utils_1.toDriverMissingError)(new Error('connect ECONNREFUSED'))).to.equal(undefined);
|
|
17
|
+
(0, chai_1.expect)(await (0, utils_1.toDriverMissingError)('text')).to.equal(undefined);
|
|
18
|
+
});
|
|
19
|
+
(0, bun_test_1.it)('recognises what typeorm throws for a driver that is not installed', async () => {
|
|
20
|
+
let thrown;
|
|
21
|
+
try {
|
|
22
|
+
new typeorm_1.DataSource({ type: 'mssql', host: 'localhost' });
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
thrown = error;
|
|
26
|
+
}
|
|
27
|
+
const error = await (0, utils_1.toDriverMissingError)(thrown);
|
|
28
|
+
(0, chai_1.expect)(error.hint).to.equal('Add it to the dependencies of the project: npm install mssql');
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=utils.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.spec.js","sourceRoot":"","sources":["../../src/common/utils.spec.ts"],"names":[],"mappings":";;AAAA,uCAAwC;AACxC,+BAA8B;AAC9B,qCAAqC;AACrC,iGAA8F;AAC9F,mCAA+C;AAE/C,IAAA,mBAAQ,EAAC,sBAAsB,EAAE,GAAG,EAAE;IAClC,IAAA,aAAE,EAAC,4DAA4D,EAAE,KAAK,IAAI,EAAE;QACxE,MAAM,KAAK,GAAG,MAAM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;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-config.spec.d.ts","sourceRoot":"","sources":["../../src/node/default-config.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const js_yaml_1 = require("js-yaml");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const expression_compiler_1 = require("@celljs/core/lib/common/el/expression-compiler");
|
|
8
|
+
const jexl_engine_provider_1 = require("@celljs/core/lib/common/el/jexl-engine-provider");
|
|
9
|
+
/** The default ormConfig of cell.yml, evaluated the way the server does with `env` as the environment. */
|
|
10
|
+
function defaults(env) {
|
|
11
|
+
const compiler = new expression_compiler_1.ExpressionCompilerImpl();
|
|
12
|
+
Object.defineProperty(compiler, 'jexlEngineProvider', { value: new jexl_engine_provider_1.JexlEngineProviderImpl() });
|
|
13
|
+
const config = (0, js_yaml_1.load)((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '..', '..', 'cell.yml'), 'utf8'));
|
|
14
|
+
const [options] = config.cell.typeorm.ormConfig;
|
|
15
|
+
return Object.fromEntries(Object.entries(options).map(([key, text]) => {
|
|
16
|
+
const [section] = compiler.compileSections(text, {});
|
|
17
|
+
return [key, typeof section === 'string' ? section : section.evalSync({ env })];
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
(0, bun_test_1.describe)('typeorm default configuration', () => {
|
|
21
|
+
(0, bun_test_1.it)('connects to a local MySQL database without environment variables', () => {
|
|
22
|
+
(0, bun_test_1.expect)(defaults({})).toEqual({ type: 'mysql', host: 'localhost', port: 3306, synchronize: true, database: 'test' });
|
|
23
|
+
});
|
|
24
|
+
(0, bun_test_1.it)('takes DB_* variables with the types typeorm expects', () => {
|
|
25
|
+
const env = { DB_TYPE: 'postgres', DB_HOST: 'db.internal', DB_PORT: '5432', DB_SYNC: 'false', DB_DATABASE: 'app' };
|
|
26
|
+
(0, bun_test_1.expect)(defaults(env)).toEqual({ type: 'postgres', host: 'db.internal', port: 5432, synchronize: false, database: 'app' });
|
|
27
|
+
});
|
|
28
|
+
(0, bun_test_1.it)('synchronizes the schema only when DB_SYNC is true', () => {
|
|
29
|
+
for (const value of ['false', 'FALSE', '0', 'no']) {
|
|
30
|
+
(0, bun_test_1.expect)(defaults({ DB_SYNC: value }).synchronize).toBe(false);
|
|
31
|
+
}
|
|
32
|
+
(0, bun_test_1.expect)(defaults({ DB_SYNC: 'true' }).synchronize).toBe(true);
|
|
33
|
+
// An empty variable counts as unset, like everywhere else with `?:`.
|
|
34
|
+
(0, bun_test_1.expect)(defaults({ DB_SYNC: '' }).synchronize).toBe(true);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=default-config.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-config.spec.js","sourceRoot":"","sources":["../../src/node/default-config.spec.ts"],"names":[],"mappings":";;AAAA,uCAAgD;AAChD,2BAAkC;AAClC,qCAA+B;AAC/B,+BAA4B;AAC5B,wFAAwF;AACxF,0FAAyF;AAEzF,0GAA0G;AAC1G,SAAS,QAAQ,CAAC,GAA2B;IACzC,MAAM,QAAQ,GAAG,IAAI,4CAAsB,EAAE,CAAC;IAC9C,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,oBAAoB,EAAE,EAAE,KAAK,EAAE,IAAI,6CAAsB,EAAE,EAAE,CAAC,CAAC;IAC/F,MAAM,MAAM,GAAG,IAAA,cAAI,EAAC,IAAA,iBAAY,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,CAAQ,CAAC;IAC1F,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC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CAAC,CAAC;IAEH,IAAA,aAAE,EAAC,mDAAmD,EAAE,GAAG,EAAE;QACzD,KAAK,MAAM,KAAK,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;YAChD,IAAA,iBAAM,EAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjE,CAAC;QACD,IAAA,iBAAM,EAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7D,qEAAqE;QACrE,IAAA,iBAAM,EAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/typeorm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
"lib",
|
|
21
21
|
"esm",
|
|
22
22
|
"src",
|
|
23
|
-
"cell.yml"
|
|
24
|
-
"cell-fc.yml"
|
|
23
|
+
"cell.yml"
|
|
25
24
|
],
|
|
26
25
|
"scripts": {
|
|
27
26
|
"build": "tsc -b && bun ../../scripts/build-esm.ts",
|
|
@@ -30,54 +29,87 @@
|
|
|
30
29
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
33
|
-
"@celljs/core": "
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
32
|
+
"@celljs/core": "4.1.0",
|
|
33
|
+
"@celljs/kit": "4.1.0",
|
|
34
|
+
"typeorm": "^0.3.31"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"mysql2": "^3.24.6"
|
|
38
|
+
},
|
|
39
|
+
"peerDependenciesMeta": {
|
|
40
|
+
"mysql2": {
|
|
41
|
+
"optional": true
|
|
42
|
+
}
|
|
37
43
|
},
|
|
38
44
|
"devDependencies": {
|
|
39
|
-
"@
|
|
45
|
+
"@types/js-yaml": "^4.0.9",
|
|
46
|
+
"js-yaml": "^4.1.1"
|
|
40
47
|
},
|
|
41
48
|
"publishConfig": {
|
|
42
49
|
"access": "public"
|
|
43
50
|
},
|
|
44
51
|
"exports": {
|
|
45
52
|
".": {
|
|
46
|
-
"webpack": "./lib/common/index.js",
|
|
47
53
|
"import": "./esm/common/index.js",
|
|
48
54
|
"default": "./lib/common/index.js"
|
|
49
55
|
},
|
|
50
56
|
"./package.json": "./package.json",
|
|
51
57
|
"./lib/common": {
|
|
52
|
-
"webpack": "./lib/common/index.js",
|
|
53
58
|
"import": "./esm/common/index.js",
|
|
54
59
|
"default": "./lib/common/index.js"
|
|
55
60
|
},
|
|
56
61
|
"./lib/node": {
|
|
57
|
-
"webpack": "./lib/node/index.js",
|
|
58
62
|
"import": "./esm/node/index.js",
|
|
59
63
|
"default": "./lib/node/index.js"
|
|
60
64
|
},
|
|
61
65
|
"./lib/node/annotation": {
|
|
62
|
-
"webpack": "./lib/node/annotation/index.js",
|
|
63
66
|
"import": "./esm/node/annotation/index.js",
|
|
64
67
|
"default": "./lib/node/annotation/index.js"
|
|
65
68
|
},
|
|
66
69
|
"./lib/node/context": {
|
|
67
|
-
"webpack": "./lib/node/context/index.js",
|
|
68
70
|
"import": "./esm/node/context/index.js",
|
|
69
71
|
"default": "./lib/node/context/index.js"
|
|
70
72
|
},
|
|
71
73
|
"./lib/*.js": {
|
|
72
|
-
"webpack": "./lib/*.js",
|
|
73
74
|
"import": "./esm/*.js",
|
|
74
75
|
"default": "./lib/*.js"
|
|
75
76
|
},
|
|
76
77
|
"./lib/*": {
|
|
77
|
-
"webpack": "./lib/*.js",
|
|
78
78
|
"import": "./esm/*.js",
|
|
79
79
|
"default": "./lib/*.js"
|
|
80
80
|
},
|
|
81
81
|
"./*": "./*"
|
|
82
|
+
},
|
|
83
|
+
"cell": {
|
|
84
|
+
"modules": {
|
|
85
|
+
"frontend": [
|
|
86
|
+
"lib/browser/module"
|
|
87
|
+
],
|
|
88
|
+
"backend": [
|
|
89
|
+
"lib/node/module"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"optionalDependencies": [
|
|
93
|
+
"typeorm-aurora-data-api-driver",
|
|
94
|
+
"mongodb",
|
|
95
|
+
"mssql",
|
|
96
|
+
"mysql",
|
|
97
|
+
"mysql2",
|
|
98
|
+
"oracledb",
|
|
99
|
+
"pg",
|
|
100
|
+
"pg-native",
|
|
101
|
+
"pg-query-stream",
|
|
102
|
+
"sql.js",
|
|
103
|
+
"redis",
|
|
104
|
+
"sqlite3",
|
|
105
|
+
"react-native-sqlite-storage",
|
|
106
|
+
"cli-highlight",
|
|
107
|
+
"@sap/hdbext",
|
|
108
|
+
"@sap/hana-client",
|
|
109
|
+
"hdb-pool",
|
|
110
|
+
"ioredis",
|
|
111
|
+
"better-sqlite3",
|
|
112
|
+
"@google-cloud/spanner"
|
|
113
|
+
]
|
|
82
114
|
}
|
|
83
115
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, it } from 'bun:test';
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
import { DataSource } from 'typeorm';
|
|
4
|
+
import { DriverPackageNotInstalledError } from 'typeorm/error/DriverPackageNotInstalledError';
|
|
5
|
+
import { toDriverMissingError } from './utils';
|
|
6
|
+
|
|
7
|
+
describe('toDriverMissingError', () => {
|
|
8
|
+
it('turns a missing driver into a CellError naming the package', async () => {
|
|
9
|
+
const error = await toDriverMissingError(new DriverPackageNotInstalledError('Mysql', 'mysql2'));
|
|
10
|
+
expect(error?.name).to.equal('CellError');
|
|
11
|
+
expect((error as unknown as { code: string }).code).to.equal('CELL_TYPEORM_DRIVER_MISSING');
|
|
12
|
+
expect((error as unknown as { hint: string }).hint).to.equal('Add it to the dependencies of the project: npm install mysql2');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('leaves other errors alone', async () => {
|
|
16
|
+
expect(await toDriverMissingError(new Error('connect ECONNREFUSED'))).to.equal(undefined);
|
|
17
|
+
expect(await toDriverMissingError('text')).to.equal(undefined);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('recognises what typeorm throws for a driver that is not installed', async () => {
|
|
21
|
+
let thrown: unknown;
|
|
22
|
+
try {
|
|
23
|
+
new DataSource({ type: 'mssql', host: 'localhost' } as any);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
thrown = error;
|
|
26
|
+
}
|
|
27
|
+
const error = await toDriverMissingError(thrown);
|
|
28
|
+
expect((error as unknown as { hint: string }).hint).to.equal('Add it to the dependencies of the project: npm install mssql');
|
|
29
|
+
});
|
|
30
|
+
});
|
package/src/common/utils.ts
CHANGED
|
@@ -13,10 +13,33 @@ export async function getDataSource(name?: string) {
|
|
|
13
13
|
|
|
14
14
|
export async function createDataSources(options: DataSourceOptions[]): Promise<DataSource[]> {
|
|
15
15
|
const dataSourceManager = ContainerUtil.get(DataSourceManager);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
try {
|
|
17
|
+
const dataSources = options.map(option => dataSourceManager.create(option));
|
|
18
|
+
// Do not use Promise.all or test 8522 will produce a dangling sqlite connection
|
|
19
|
+
for (const dataSource of dataSources) {
|
|
20
|
+
await dataSource.initialize();
|
|
21
|
+
}
|
|
22
|
+
return dataSources;
|
|
23
|
+
} catch (error) {
|
|
24
|
+
throw (await toDriverMissingError(error)) ?? error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Database drivers are peer dependencies the project installs (mysql2 for `type: mysql`). When one
|
|
30
|
+
* is missing, typeorm throws a DriverPackageNotInstalledError; this turns it into a CellError that
|
|
31
|
+
* names the package to install.
|
|
32
|
+
*/
|
|
33
|
+
export async function toDriverMissingError(error: unknown): Promise<Error | undefined> {
|
|
34
|
+
if (!(error instanceof Error) || error.name !== 'DriverPackageNotInstalledError') {
|
|
35
|
+
return undefined;
|
|
20
36
|
}
|
|
21
|
-
|
|
37
|
+
const driver = /npm install ([^\s"'`]+)/.exec(error.message)?.[1];
|
|
38
|
+
const { CellError } = await import('@celljs/kit');
|
|
39
|
+
return new CellError({
|
|
40
|
+
code: 'CELL_TYPEORM_DRIVER_MISSING',
|
|
41
|
+
message: `The database driver${driver ? ` ${driver}` : ''} is not installed: ${error.message}`,
|
|
42
|
+
hint: driver ? `Add it to the dependencies of the project: npm install ${driver}` : 'Install the driver package of the database type in cell.typeorm.ormConfig.',
|
|
43
|
+
cause: error,
|
|
44
|
+
});
|
|
22
45
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { load } from 'js-yaml';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { ExpressionCompilerImpl } from '@celljs/core/lib/common/el/expression-compiler';
|
|
6
|
+
import { JexlEngineProviderImpl } from '@celljs/core/lib/common/el/jexl-engine-provider';
|
|
7
|
+
|
|
8
|
+
/** The default ormConfig of cell.yml, evaluated the way the server does with `env` as the environment. */
|
|
9
|
+
function defaults(env: Record<string, string>): Record<string, unknown> {
|
|
10
|
+
const compiler = new ExpressionCompilerImpl();
|
|
11
|
+
Object.defineProperty(compiler, 'jexlEngineProvider', { value: new JexlEngineProviderImpl() });
|
|
12
|
+
const config = load(readFileSync(join(__dirname, '..', '..', 'cell.yml'), 'utf8')) as any;
|
|
13
|
+
const [options] = config.cell.typeorm.ormConfig;
|
|
14
|
+
return Object.fromEntries(
|
|
15
|
+
Object.entries(options).map(([key, text]) => {
|
|
16
|
+
const [section] = compiler.compileSections(text as string, {});
|
|
17
|
+
return [key, typeof section === 'string' ? section : section.evalSync({ env })];
|
|
18
|
+
}),
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe('typeorm default configuration', () => {
|
|
23
|
+
it('connects to a local MySQL database without environment variables', () => {
|
|
24
|
+
expect(defaults({})).toEqual({ type: 'mysql', host: 'localhost', port: 3306, synchronize: true, database: 'test' });
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('takes DB_* variables with the types typeorm expects', () => {
|
|
28
|
+
const env = { DB_TYPE: 'postgres', DB_HOST: 'db.internal', DB_PORT: '5432', DB_SYNC: 'false', DB_DATABASE: 'app' };
|
|
29
|
+
expect(defaults(env)).toEqual({ type: 'postgres', host: 'db.internal', port: 5432, synchronize: false, database: 'app' });
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('synchronizes the schema only when DB_SYNC is true', () => {
|
|
33
|
+
for (const value of ['false', 'FALSE', '0', 'no']) {
|
|
34
|
+
expect(defaults({ DB_SYNC: value }).synchronize).toBe(false);
|
|
35
|
+
}
|
|
36
|
+
expect(defaults({ DB_SYNC: 'true' }).synchronize).toBe(true);
|
|
37
|
+
// An empty variable counts as unset, like everywhere else with `?:`.
|
|
38
|
+
expect(defaults({ DB_SYNC: '' }).synchronize).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
});
|
package/cell-fc.yml
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
cell:
|
|
2
|
-
cloud:
|
|
3
|
-
layer:
|
|
4
|
-
name: "${cell.cloud.function.runtime == 'custom' ? 'node-v16-14-2-linux-x64' : ''}"
|
|
5
|
-
compatibleRuntime:
|
|
6
|
-
- custom
|
|
7
|
-
codeUri: https://nodejs.org/dist/v16.14.2/node-v16.14.2-linux-x64.tar.gz
|
|
8
|
-
function:
|
|
9
|
-
env: "${cell.cloud.function.runtime == 'custom' ? { PATH: '/opt/node-v16.14.2-linux-x64/bin:$PATH' } : {}}"
|
|
10
|
-
layers: "${cell.cloud.function.runtime == 'custom' ? [ 'node-v16-14-2-linux-x64'] : []}"
|