@flusys/nestjs-shared 5.1.1 → 5.1.3

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.
Files changed (31) hide show
  1. package/cjs/classes/api-controller.class.js +16 -10
  2. package/cjs/classes/api-service.class.js +67 -35
  3. package/cjs/classes/index.js +0 -1
  4. package/cjs/dtos/identity-response.dto.js +4 -8
  5. package/cjs/entities/identity.js +8 -2
  6. package/cjs/modules/datasource/index.js +0 -1
  7. package/cjs/modules/datasource/multi-tenant-datasource.service.js +24 -85
  8. package/classes/api-controller.class.d.ts +1 -0
  9. package/classes/api-service.class.d.ts +13 -6
  10. package/classes/index.d.ts +0 -1
  11. package/decorators/current-user.decorator.d.ts +1 -1
  12. package/fesm/classes/api-controller.class.js +16 -10
  13. package/fesm/classes/api-service.class.js +70 -38
  14. package/fesm/classes/index.js +0 -1
  15. package/fesm/dtos/identity-response.dto.js +4 -8
  16. package/fesm/entities/identity.js +8 -2
  17. package/fesm/interfaces/datasource.interface.js +1 -20
  18. package/fesm/modules/datasource/index.js +0 -1
  19. package/fesm/modules/datasource/multi-tenant-datasource.service.js +24 -85
  20. package/guards/permission.guard.d.ts +1 -1
  21. package/interceptors/idempotency.interceptor.d.ts +1 -1
  22. package/interfaces/notification-adapter.interface.d.ts +13 -14
  23. package/modules/datasource/index.d.ts +0 -1
  24. package/modules/datasource/multi-tenant-datasource.service.d.ts +4 -13
  25. package/package.json +15 -15
  26. package/cjs/classes/request-scoped-api.service.js +0 -61
  27. package/cjs/modules/datasource/datasource.module.js +0 -117
  28. package/classes/request-scoped-api.service.d.ts +0 -14
  29. package/fesm/classes/request-scoped-api.service.js +0 -51
  30. package/fesm/modules/datasource/datasource.module.js +0 -107
  31. package/modules/datasource/datasource.module.d.ts +0 -19
@@ -1,107 +0,0 @@
1
- function _ts_decorate(decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- }
7
- import { MODULE_OPTIONS } from '@flusys/nestjs-core';
8
- import { Module } from '@nestjs/common';
9
- import { MultiTenantDataSourceService } from './multi-tenant-datasource.service';
10
- export class DataSourceModule {
11
- /**
12
- * Register with static options
13
- */ static forRoot(options) {
14
- const { global = false, ...moduleOptions } = options;
15
- return {
16
- module: DataSourceModule,
17
- global,
18
- providers: [
19
- {
20
- provide: MODULE_OPTIONS,
21
- useValue: moduleOptions
22
- },
23
- MultiTenantDataSourceService
24
- ],
25
- exports: [
26
- MODULE_OPTIONS,
27
- MultiTenantDataSourceService
28
- ]
29
- };
30
- }
31
- /**
32
- * Register with async options
33
- */ static forRootAsync(asyncOptions) {
34
- const { global = false, imports = [] } = asyncOptions;
35
- return {
36
- module: DataSourceModule,
37
- global,
38
- imports,
39
- providers: [
40
- ...this.createAsyncProviders(asyncOptions),
41
- MultiTenantDataSourceService
42
- ],
43
- exports: [
44
- MODULE_OPTIONS,
45
- MultiTenantDataSourceService
46
- ]
47
- };
48
- }
49
- /**
50
- * Import for child modules (uses existing MODULE_OPTIONS)
51
- */ static forFeature() {
52
- return {
53
- module: DataSourceModule,
54
- providers: [
55
- MultiTenantDataSourceService
56
- ],
57
- exports: [
58
- MultiTenantDataSourceService
59
- ]
60
- };
61
- }
62
- /**
63
- * Create async providers based on options
64
- */ static createAsyncProviders(options) {
65
- if (options.useFactory) {
66
- return [
67
- {
68
- provide: MODULE_OPTIONS,
69
- useFactory: options.useFactory,
70
- inject: options.inject || []
71
- }
72
- ];
73
- }
74
- if (options.useClass) {
75
- return [
76
- {
77
- provide: options.useClass,
78
- useClass: options.useClass
79
- },
80
- this.createFactoryProvider(options.useClass)
81
- ];
82
- }
83
- if (options.useExisting) {
84
- return [
85
- this.createFactoryProvider(options.useExisting)
86
- ];
87
- }
88
- return [
89
- {
90
- provide: MODULE_OPTIONS,
91
- useValue: {}
92
- }
93
- ];
94
- }
95
- static createFactoryProvider(factoryClass) {
96
- return {
97
- provide: MODULE_OPTIONS,
98
- useFactory: async (factory)=>factory.createOptions(),
99
- inject: [
100
- factoryClass
101
- ]
102
- };
103
- }
104
- }
105
- DataSourceModule = _ts_decorate([
106
- Module({})
107
- ], DataSourceModule);
@@ -1,19 +0,0 @@
1
- import { IAsyncModuleOptions, IDataSourceServiceOptions, IModuleOptionsFactory } from '@flusys/nestjs-core';
2
- import { DynamicModule, Type } from '@nestjs/common';
3
- export interface DataSourceModuleOptions extends IDataSourceServiceOptions {
4
- global?: boolean;
5
- }
6
- export interface DataSourceOptionsFactory extends IModuleOptionsFactory<IDataSourceServiceOptions> {
7
- createOptions(): Promise<IDataSourceServiceOptions> | IDataSourceServiceOptions;
8
- }
9
- export interface DataSourceModuleAsyncOptions extends IAsyncModuleOptions<IDataSourceServiceOptions> {
10
- useClass?: Type<DataSourceOptionsFactory>;
11
- useExisting?: Type<DataSourceOptionsFactory>;
12
- }
13
- export declare class DataSourceModule {
14
- static forRoot(options: DataSourceModuleOptions): DynamicModule;
15
- static forRootAsync(asyncOptions: DataSourceModuleAsyncOptions): DynamicModule;
16
- static forFeature(): DynamicModule;
17
- private static createAsyncProviders;
18
- private static createFactoryProvider;
19
- }