@atlantjs/backend 1.2.11 → 1.2.12
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/backend/application/databases/database-lite.config.d.ts +14 -0
- package/backend/application/databases/database-lite.config.js +20 -0
- package/backend/application/databases/database.config.d.ts +2 -2
- package/backend/application/databases/database.config.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/package.json +2 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DataSource, DatabaseType } from "typeorm";
|
|
2
|
+
interface DatabaseLiteConfigProps {
|
|
3
|
+
type: DatabaseType;
|
|
4
|
+
binaryFilePath: string;
|
|
5
|
+
synchronize?: boolean;
|
|
6
|
+
entities?: string[];
|
|
7
|
+
migrations?: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class DatabaseLiteConfigAbstract {
|
|
10
|
+
private readonly props;
|
|
11
|
+
configs: DataSource;
|
|
12
|
+
constructor(props: DatabaseLiteConfigProps);
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DatabaseLiteConfigAbstract = void 0;
|
|
4
|
+
const env_vars_1 = require("../env/env-vars");
|
|
5
|
+
const arch_1 = require("@atlantjs/arch");
|
|
6
|
+
const typeorm_1 = require("typeorm");
|
|
7
|
+
class DatabaseLiteConfigAbstract {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
this.props = props;
|
|
10
|
+
const baseConfig = {
|
|
11
|
+
type: this.props.type,
|
|
12
|
+
database: this.props.binaryFilePath,
|
|
13
|
+
synchronize: arch_1.Guardian.isFalsy((0, env_vars_1.isProdOrHomolog)()),
|
|
14
|
+
entities: [`${__dirname}/../../../../../../**/*.schema{.ts,.js}`],
|
|
15
|
+
migrations: ["./migrations/*.ts"],
|
|
16
|
+
};
|
|
17
|
+
this.configs = new typeorm_1.DataSource(baseConfig);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.DatabaseLiteConfigAbstract = DatabaseLiteConfigAbstract;
|
|
@@ -8,8 +8,8 @@ interface DatabaseConfigProps {
|
|
|
8
8
|
database: string;
|
|
9
9
|
schema: string;
|
|
10
10
|
synchronize: boolean;
|
|
11
|
-
entities
|
|
12
|
-
migrations
|
|
11
|
+
entities?: string[];
|
|
12
|
+
migrations?: string[];
|
|
13
13
|
region?: string;
|
|
14
14
|
secretArn?: string;
|
|
15
15
|
resourceArn?: string;
|
|
@@ -33,7 +33,7 @@ class DatabaseConfigAbstract {
|
|
|
33
33
|
resourceArn: this.props.resourceArn ?? "",
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
if (new arch_1.
|
|
36
|
+
if (new arch_1.Url(this.props.host).has("@")) {
|
|
37
37
|
Object.assign(baseConfig, this.productionOrHomologConfigs);
|
|
38
38
|
}
|
|
39
39
|
this.configs = new typeorm_1.DataSource(baseConfig);
|
package/index.d.ts
CHANGED
|
@@ -27,4 +27,5 @@ export { CorsMiddleware } from "./setup/server/cors-middleware";
|
|
|
27
27
|
export { DefaultErrorHandlerMiddleware } from "./setup/server/default-error-handler-middleware";
|
|
28
28
|
export { Server } from "./setup/server/server";
|
|
29
29
|
export { Container, inject, injectable } from "inversify";
|
|
30
|
+
export { DatabaseLiteConfigAbstract } from "./backend/application/databases/database-lite.config";
|
|
30
31
|
export { initializeApi } from "./setup";
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EntityAbstract = exports.InjectionsAbstract = exports.EnvVar = exports.CORS_ALLOWED_ORIGINS = exports.LOAD_MODULES = exports.APP_PORT = exports.DatabaseHelperAbstract = exports.DatabaseConfigAbstract = exports.IsPayload = exports.IsNotEmptyObject = exports.IsObject = exports.IsArray = exports.IsString = exports.IsInt = exports.IsEnum = exports.IsNumber = exports.IsDate = exports.IsBoolean = exports.IsNumberString = exports.IsUrl = exports.IsUUID = exports.IsJWT = exports.IsJSON = exports.IsPort = exports.IsIP = exports.IsCurrency = exports.IsEmail = exports.IsBase64 = exports.IsDecimal = exports.MaxDate = exports.MinDate = exports.Min = exports.Max = exports.IsNegative = exports.IsPositive = exports.IsNotEmpty = exports.IsEmpty = exports.IsLongitude = exports.IsLatitude = exports.IsLatLong = exports.ValidateInner = exports.IsOptional = exports.UseBefore = exports.Req = exports.Post = exports.Body = exports.Res = exports.JsonController = exports.Get = exports.getFromContainer = void 0;
|
|
4
|
-
exports.initializeApi = exports.injectable = exports.inject = exports.Container = exports.Server = exports.DefaultErrorHandlerMiddleware = exports.CorsMiddleware = exports.BodyParserMiddleware = exports.DiContainerAbstract = exports.diContainer = exports.startContainer = exports.SchemaAbstract = exports.ResponseAbstract = exports.ValidatorAbstract = exports.PayloadAbstract = exports.ControllerAbstract = exports.CommandAbstract = exports.ServiceAbstract = exports.RepositoryAbstract = exports.ProviderAbstract = exports.MiddlewareHandlerAbstract = void 0;
|
|
4
|
+
exports.initializeApi = exports.DatabaseLiteConfigAbstract = exports.injectable = exports.inject = exports.Container = exports.Server = exports.DefaultErrorHandlerMiddleware = exports.CorsMiddleware = exports.BodyParserMiddleware = exports.DiContainerAbstract = exports.diContainer = exports.startContainer = exports.SchemaAbstract = exports.ResponseAbstract = exports.ValidatorAbstract = exports.PayloadAbstract = exports.ControllerAbstract = exports.CommandAbstract = exports.ServiceAbstract = exports.RepositoryAbstract = exports.ProviderAbstract = exports.MiddlewareHandlerAbstract = void 0;
|
|
5
5
|
require("reflect-metadata");
|
|
6
6
|
const setup_1 = require("./setup");
|
|
7
7
|
(0, setup_1.synthesizePaths)();
|
|
@@ -101,5 +101,7 @@ var inversify_1 = require("inversify");
|
|
|
101
101
|
Object.defineProperty(exports, "Container", { enumerable: true, get: function () { return inversify_1.Container; } });
|
|
102
102
|
Object.defineProperty(exports, "inject", { enumerable: true, get: function () { return inversify_1.inject; } });
|
|
103
103
|
Object.defineProperty(exports, "injectable", { enumerable: true, get: function () { return inversify_1.injectable; } });
|
|
104
|
+
var database_lite_config_1 = require("./backend/application/databases/database-lite.config");
|
|
105
|
+
Object.defineProperty(exports, "DatabaseLiteConfigAbstract", { enumerable: true, get: function () { return database_lite_config_1.DatabaseLiteConfigAbstract; } });
|
|
104
106
|
var setup_2 = require("./setup");
|
|
105
107
|
Object.defineProperty(exports, "initializeApi", { enumerable: true, get: function () { return setup_2.initializeApi; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlantjs/backend",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.12",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"test:unit:cov": "yarn test:unit --coverage --runInBand"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@atlantjs/arch": "^4.1.
|
|
31
|
+
"@atlantjs/arch": "^4.1.11",
|
|
32
32
|
"body-parser": "^1.20.3",
|
|
33
33
|
"class-transformer": "^0.5.1",
|
|
34
34
|
"class-validator": "^0.14.1",
|