@atlantjs/backend 1.2.13 → 1.3.1

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.
@@ -2,6 +2,7 @@ import { DataSource, DatabaseType } from "typeorm";
2
2
  interface DatabaseLiteConfigProps {
3
3
  type: DatabaseType;
4
4
  binaryFilePath: string;
5
+ accessKey: string;
5
6
  synchronize?: boolean;
6
7
  entities?: string[];
7
8
  migrations?: string[];
@@ -11,6 +11,10 @@ class DatabaseLiteConfigAbstract {
11
11
  type: this.props.type,
12
12
  database: this.props.binaryFilePath,
13
13
  synchronize: arch_1.Guardian.isFalsy((0, env_vars_1.isProdOrHomolog)()),
14
+ extra: {
15
+ cipher: "aes-256-cbc",
16
+ key: props.accessKey,
17
+ },
14
18
  entities: [`${__dirname}/../../../../../../**/*.schema{.ts,.js}`],
15
19
  migrations: ["./migrations/*.ts"],
16
20
  };
@@ -4,7 +4,7 @@ export declare abstract class InjectionsAbstract {
4
4
  constructor(_injections: Injections);
5
5
  private injectControllers;
6
6
  private injectMiddlewares;
7
- private injectUsecases;
7
+ private injectCommands;
8
8
  private injectServices;
9
9
  private injectRepositories;
10
10
  private injectProviders;
@@ -7,7 +7,7 @@ class InjectionsAbstract {
7
7
  this._injections = _injections;
8
8
  this.injectControllers();
9
9
  this.injectMiddlewares();
10
- this.injectUsecases();
10
+ this.injectCommands();
11
11
  this.injectServices();
12
12
  this.injectRepositories();
13
13
  this.injectProviders();
@@ -22,24 +22,24 @@ class InjectionsAbstract {
22
22
  dependency_injections_1.diContainer.bind(middleware).toSelf();
23
23
  });
24
24
  }
25
- injectUsecases() {
26
- this._injections.usecases?.map((usecase) => {
27
- dependency_injections_1.diContainer.bind(usecase.ref).to(usecase.target);
25
+ injectCommands() {
26
+ this._injections.commands?.map((command) => {
27
+ dependency_injections_1.diContainer.bind(command.token).to(command.target);
28
28
  });
29
29
  }
30
30
  injectServices() {
31
31
  this._injections.services?.map((service) => {
32
- dependency_injections_1.diContainer.bind(service.ref).to(service.target);
32
+ dependency_injections_1.diContainer.bind(service.token).to(service.target);
33
33
  });
34
34
  }
35
35
  injectRepositories() {
36
36
  this._injections.repositories?.map((repository) => {
37
- dependency_injections_1.diContainer.bind(repository.ref).to(repository.target);
37
+ dependency_injections_1.diContainer.bind(repository.token).to(repository.target);
38
38
  });
39
39
  }
40
40
  injectProviders() {
41
41
  this._injections.providers?.map((provider) => {
42
- dependency_injections_1.diContainer.bind(provider.ref).to(provider.target);
42
+ dependency_injections_1.diContainer.bind(provider.token).to(provider.target);
43
43
  });
44
44
  }
45
45
  }
@@ -7,13 +7,13 @@ import { ServiceAbstract } from "../domain/services/service.abstract";
7
7
  import { CommandAbstract } from "../domain/commands/command.abstract";
8
8
  type ServiceIdentifier<T> = interfaces.ServiceIdentifier<T>;
9
9
  interface BindTo<T> {
10
- ref: ServiceIdentifier<unknown>;
10
+ token: ServiceIdentifier<unknown>;
11
11
  target: Newable<T>;
12
12
  }
13
13
  export interface Injections {
14
14
  controllers?: ServiceIdentifier<ControllerAbstract>[];
15
15
  middlewares?: ServiceIdentifier<MiddlewareHandlerAbstract>[];
16
- usecases?: BindTo<CommandAbstract>[];
16
+ commands?: BindTo<CommandAbstract>[];
17
17
  services?: BindTo<ServiceAbstract>[];
18
18
  repositories?: BindTo<RepositoryAbstract>[];
19
19
  providers?: BindTo<RepositoryAbstract>[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlantjs/backend",
3
- "version": "1.2.13",
3
+ "version": "1.3.1",
4
4
  "main": "index.js",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -6,13 +6,13 @@ import { CommandAbstract } from "../../backend/domain/commands/command.abstract"
6
6
  import { ControllerAbstract } from "../../backend/infrastructure/controllers/controller.abstract";
7
7
  import { Newable } from "@atlantjs/arch";
8
8
  interface BindTo<T> {
9
- ref: Symbol;
9
+ token: Symbol;
10
10
  target: Newable<T>;
11
11
  }
12
12
  interface Dependencies {
13
13
  controllers: ControllerAbstract[];
14
14
  middlewares: MiddlewareHandlerAbstract[];
15
- usecases: BindTo<CommandAbstract>[];
15
+ commands: BindTo<CommandAbstract>[];
16
16
  repositories: BindTo<RepositoryAbstract>[];
17
17
  providers: BindTo<ProviderAbstract>[];
18
18
  services: BindTo<ServiceAbstract>[];
@@ -23,7 +23,7 @@ export declare abstract class DiContainerAbstract {
23
23
  private injectProviders;
24
24
  private injectServices;
25
25
  private injectRepositories;
26
- private injectUsecases;
26
+ private injectCommands;
27
27
  private injectMiddlewares;
28
28
  private injectControllers;
29
29
  }
@@ -6,29 +6,29 @@ class DiContainerAbstract {
6
6
  constructor() {
7
7
  this.injectControllers();
8
8
  this.injectMiddlewares();
9
- this.injectUsecases();
9
+ this.injectCommands();
10
10
  this.injectRepositories();
11
11
  this.injectServices();
12
12
  this.injectProviders();
13
13
  }
14
14
  injectProviders() {
15
15
  this.dependencies.providers.map((dependency) => {
16
- di_container_1.diContainer.bind(dependency.ref.valueOf).to(dependency.target);
16
+ di_container_1.diContainer.bind(dependency.token.valueOf).to(dependency.target);
17
17
  });
18
18
  }
19
19
  injectServices() {
20
20
  this.dependencies.services.map((dependency) => {
21
- di_container_1.diContainer.bind(dependency.ref.valueOf).to(dependency.target);
21
+ di_container_1.diContainer.bind(dependency.token.valueOf).to(dependency.target);
22
22
  });
23
23
  }
24
24
  injectRepositories() {
25
25
  this.dependencies.repositories.map((dependency) => {
26
- di_container_1.diContainer.bind(dependency.ref.valueOf).to(dependency.target);
26
+ di_container_1.diContainer.bind(dependency.token.valueOf).to(dependency.target);
27
27
  });
28
28
  }
29
- injectUsecases() {
30
- this.dependencies.usecases.map((dependency) => {
31
- di_container_1.diContainer.bind(dependency.ref.valueOf).to(dependency.target);
29
+ injectCommands() {
30
+ this.dependencies.commands.map((dependency) => {
31
+ di_container_1.diContainer.bind(dependency.token.valueOf).to(dependency.target);
32
32
  });
33
33
  }
34
34
  injectMiddlewares() {
package/setup/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import { DatabaseLiteConfigAbstract } from "../backend/application/databases/dat
6
6
  interface ServerProps {
7
7
  databases?: [
8
8
  {
9
- ref: interfaces.ServiceIdentifier<unknown>;
9
+ token: interfaces.ServiceIdentifier<unknown>;
10
10
  target: InstanceType<typeof DatabaseHelperAbstract>;
11
11
  configs: Newable<DatabaseConfigAbstract | DatabaseLiteConfigAbstract>;
12
12
  }
package/setup/index.js CHANGED
@@ -15,7 +15,7 @@ function initializeApi(props) {
15
15
  if (arch_1.Guardian.isNotUndefined(props.databases)) {
16
16
  Promise.all([
17
17
  props.databases.map((database) => {
18
- dependency_injections_1.diContainer.bind(database.ref).toConstantValue(database.target);
18
+ dependency_injections_1.diContainer.bind(database.token).toConstantValue(database.target);
19
19
  database.target.connect(new database.configs());
20
20
  }),
21
21
  ]);