@mbc-cqrs-serverless/survey-template 1.3.5 → 1.4.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 CHANGED
@@ -34,6 +34,38 @@ npm install @mbc-cqrs-serverless/survey-template
34
34
  - `PUT /api/survey-template/:id` - Update a survey template
35
35
  - `DELETE /api/survey-template/:id` - Delete a survey template
36
36
 
37
+ ## Configurable table name
38
+
39
+ `SurveyTemplateModule` uses the `survey` DynamoDB table by default. Pass
40
+ `tableName` to override it (backward compatible). Both `register` and
41
+ `registerAsync` accept it:
42
+
43
+ ```ts
44
+ SurveyTemplateModule.register({
45
+ enableController: true,
46
+ prismaService: PrismaService,
47
+ tableName: 'questionnaire', // default: 'survey'
48
+ })
49
+
50
+ SurveyTemplateModule.registerAsync({
51
+ tableName: 'questionnaire',
52
+ imports: [PrismaModule],
53
+ inject: [PrismaService], // resolve and return the PrismaService INSTANCE
54
+ useFactory: (prisma) => ({ prismaService: prisma }),
55
+ })
56
+ ```
57
+
58
+ > **Provisioning:** Add **only the raw base name** (e.g. `"questionnaire"`) to
59
+ > `prisma/dynamodbs/cqrs.json`; the CLI creates the `-command` / `-data` /
60
+ > `-history` physical tables, and your IaC must define the same three.
61
+ >
62
+ > **Unique table name:** give `SurveyTemplateModule` its own `tableName`. Sharing
63
+ > one physical table across modules is only wired for `MasterModule` + ui-setting's
64
+ > `SettingModule`. Because survey registers default data-sync handlers, sharing its
65
+ > table with another module registers a duplicate
66
+ > `<tableName>_CommandEventHandler` alias (the app warns and handler ownership
67
+ > becomes import-order dependent).
68
+
37
69
  ## Documentation
38
70
 
39
71
  Visit https://mbc-cqrs-serverless.mbc-net.com/ to view the full documentation.
@@ -1,9 +1,30 @@
1
1
  import { IDataSyncHandler } from '@mbc-cqrs-serverless/core';
2
- import { Type } from '@nestjs/common';
2
+ import { ModuleMetadata, Type } from '@nestjs/common';
3
3
  export declare const PRISMA_SERVICE = "PrismaServiceInjectToken";
4
+ export declare const DEFAULT_SURVEY_TABLE_NAME = "survey";
4
5
  export interface SurveyTemplateModuleOptions {
5
6
  enableController?: boolean;
6
7
  dataSyncHandlers?: Type<IDataSyncHandler>[];
7
8
  prismaService?: Type<any>;
9
+ /** DynamoDB base table name. Default: 'survey'. */
10
+ tableName?: string;
11
+ }
12
+ export interface SurveyTemplateModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
13
+ enableController?: boolean;
14
+ dataSyncHandlers?: Type<IDataSyncHandler>[];
15
+ tableName?: string;
16
+ inject?: any[];
17
+ /**
18
+ * Resolves the runtime module options. Must return the resolved PrismaService
19
+ * **instance** under `prismaService` (typically by injecting it), so the survey
20
+ * services (which inject PRISMA_SERVICE) can be constructed. Optional only to
21
+ * stay assignment-compatible with the inherited `registerAsync` signature;
22
+ * omitting it makes PRISMA_SERVICE fail fast.
23
+ */
24
+ useFactory?: (...args: any[]) => Promise<{
25
+ prismaService?: any;
26
+ }> | {
27
+ prismaService?: any;
28
+ };
8
29
  }
9
30
  export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<SurveyTemplateModuleOptions, "register", "create", {}>, MODULE_OPTIONS_TOKEN: string | symbol, OPTIONS_TYPE: SurveyTemplateModuleOptions & Partial<{}>;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.OPTIONS_TYPE = exports.MODULE_OPTIONS_TOKEN = exports.ConfigurableModuleClass = exports.PRISMA_SERVICE = void 0;
4
+ exports.OPTIONS_TYPE = exports.MODULE_OPTIONS_TOKEN = exports.ConfigurableModuleClass = exports.DEFAULT_SURVEY_TABLE_NAME = exports.PRISMA_SERVICE = void 0;
5
5
  const common_1 = require("@nestjs/common");
6
6
  exports.PRISMA_SERVICE = 'PrismaServiceInjectToken';
7
+ exports.DEFAULT_SURVEY_TABLE_NAME = 'survey';
7
8
  _a = new common_1.ConfigurableModuleBuilder().build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN, exports.OPTIONS_TYPE = _a.OPTIONS_TYPE;
8
9
  //# sourceMappingURL=survey-template.module-definition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"survey-template.module-definition.js","sourceRoot":"","sources":["../src/survey-template.module-definition.ts"],"names":[],"mappings":";;;;AACA,2CAA0D;AAG7C,QAAA,cAAc,GAAG,0BAA0B,CAAA;AAQ3C,KACX,IAAI,kCAAyB,EAA+B,CAAC,KAAK,EAAE,EADvD,+BAAuB,+BAAE,4BAAoB,4BAAE,oBAAY,mBACJ"}
1
+ {"version":3,"file":"survey-template.module-definition.js","sourceRoot":"","sources":["../src/survey-template.module-definition.ts"],"names":[],"mappings":";;;;AACA,2CAAgF;AAEnE,QAAA,cAAc,GAAG,0BAA0B,CAAA;AAE3C,QAAA,yBAAyB,GAAG,QAAQ,CAAA;AA4BpC,KACX,IAAI,kCAAyB,EAA+B,CAAC,KAAK,EAAE,EADvD,+BAAuB,+BAAE,4BAAoB,4BAAE,oBAAY,mBACJ"}
@@ -1,5 +1,6 @@
1
1
  import { DynamicModule } from '@nestjs/common';
2
- import { ConfigurableModuleClass, OPTIONS_TYPE } from './survey-template.module-definition';
2
+ import { ConfigurableModuleClass, OPTIONS_TYPE, SurveyTemplateModuleAsyncOptions } from './survey-template.module-definition';
3
3
  export declare class SurveyTemplateModule extends ConfigurableModuleClass {
4
4
  static register(options: typeof OPTIONS_TYPE): DynamicModule;
5
+ static registerAsync(options: SurveyTemplateModuleAsyncOptions): DynamicModule;
5
6
  }
@@ -16,40 +16,60 @@ const survey_answer_service_1 = require("./survey-answer.service");
16
16
  const survey_template_controller_1 = require("./survey-template.controller");
17
17
  const survey_template_module_definition_1 = require("./survey-template.module-definition");
18
18
  const survey_template_service_1 = require("./survey-template.service");
19
+ const DEFAULT_HANDLERS = [
20
+ survey_template_rds_handler_1.SurveyTemplateDataSyncRdsHandler,
21
+ survey_answer_rds_handler_1.SurveyAnswerDataSyncRdsHandler,
22
+ ];
19
23
  let SurveyTemplateModule = class SurveyTemplateModule extends survey_template_module_definition_1.ConfigurableModuleClass {
20
24
  static register(options) {
21
- const module = super.register(options);
25
+ const base = super.register(options);
26
+ const providers = [...(base.providers ?? [])];
27
+ const controllers = [...(base.controllers ?? [])];
28
+ const imports = [...(base.imports ?? [])];
29
+ // The survey services inject PRISMA_SERVICE unconditionally.
30
+ providers.push((0, core_1.buildPrismaProviderSync)(options.prismaService, survey_template_module_definition_1.PRISMA_SERVICE));
31
+ // Data-sync handlers are registered here (not inside CommandModule) so they
32
+ // can resolve PRISMA_SERVICE from this module's scope.
33
+ const handlers = options.dataSyncHandlers ?? DEFAULT_HANDLERS;
34
+ providers.push(...handlers);
22
35
  if (options.enableController) {
23
- if (!options.prismaService) {
24
- throw new Error('PrismaService must be provided when enableController is true.');
25
- }
26
- if (!module.controllers) {
27
- module.controllers = [];
28
- }
29
- module.controllers.push(survey_template_controller_1.SurveyTemplateController, survey_answer_controller_1.SurveyAnswerController);
30
- if (!module.providers) {
31
- module.providers = [];
32
- }
33
- module.providers.push({
34
- provide: survey_template_module_definition_1.PRISMA_SERVICE,
35
- useExisting: options.prismaService,
36
- });
37
- if (!module.imports) {
38
- module.imports = [];
39
- }
40
- const imports = [...(module.imports ?? [])];
41
- imports.push(core_1.CommandModule.register({
42
- tableName: 'survey',
43
- dataSyncHandlers: options?.dataSyncHandlers ?? [
44
- survey_template_rds_handler_1.SurveyTemplateDataSyncRdsHandler,
45
- survey_answer_rds_handler_1.SurveyAnswerDataSyncRdsHandler,
46
- ],
47
- }));
48
- return {
49
- ...module,
50
- imports,
51
- };
36
+ controllers.push(survey_template_controller_1.SurveyTemplateController, survey_answer_controller_1.SurveyAnswerController);
52
37
  }
38
+ imports.push((0, core_1.buildDomainCommandModule)(survey_template_module_definition_1.DEFAULT_SURVEY_TABLE_NAME, {
39
+ tableName: options.tableName,
40
+ dataSyncHandlers: handlers,
41
+ }));
42
+ // Always return a DynamicModule, even when enableController is false.
43
+ return { ...base, providers, controllers, imports };
44
+ }
45
+ static registerAsync(options) {
46
+ const base = super.registerAsync({
47
+ imports: options.imports,
48
+ inject: options.inject ?? [],
49
+ useFactory: async (...args) => {
50
+ const resolved = (await options.useFactory?.(...args)) ?? {};
51
+ return {
52
+ ...resolved,
53
+ enableController: options.enableController,
54
+ dataSyncHandlers: options.dataSyncHandlers,
55
+ tableName: options.tableName ?? survey_template_module_definition_1.DEFAULT_SURVEY_TABLE_NAME,
56
+ };
57
+ },
58
+ });
59
+ const providers = [...(base.providers ?? [])];
60
+ const controllers = [...(base.controllers ?? [])];
61
+ const imports = [...(base.imports ?? [])];
62
+ providers.push((0, core_1.buildPrismaProviderAsync)(survey_template_module_definition_1.MODULE_OPTIONS_TOKEN, survey_template_module_definition_1.PRISMA_SERVICE));
63
+ const handlers = options.dataSyncHandlers ?? DEFAULT_HANDLERS;
64
+ providers.push(...handlers);
65
+ if (options.enableController) {
66
+ controllers.push(survey_template_controller_1.SurveyTemplateController, survey_answer_controller_1.SurveyAnswerController);
67
+ }
68
+ imports.push((0, core_1.buildDomainCommandModule)(survey_template_module_definition_1.DEFAULT_SURVEY_TABLE_NAME, {
69
+ tableName: options.tableName,
70
+ dataSyncHandlers: handlers,
71
+ }));
72
+ return { ...base, providers, controllers, imports };
53
73
  }
54
74
  };
55
75
  exports.SurveyTemplateModule = SurveyTemplateModule;
@@ -1 +1 @@
1
- {"version":3,"file":"survey-template.module.js","sourceRoot":"","sources":["../src/survey-template.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAIkC;AAClC,2CAAsD;AAEtD,mFAAoF;AACpF,uFAAwF;AACxF,yEAAmE;AACnE,mEAA6D;AAC7D,6EAAuE;AACvE,2FAI4C;AAC5C,uEAAiE;AAO1D,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,2DAAuB;IAC/D,MAAM,CAAC,QAAQ,CAAC,OAA4B;QAC1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C7D,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAA;QAE3B,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAC7B,WAAW,CAAC,IAAI,CAAC,qDAAwB,EAAE,iDAAsB,CAAC,CAAA;QACpE,CAAC;QAED,OAAO,CAAC,IAAI,CACV,IAAA,+BAAwB,EAAC,6DAAyB,EAAE;YAClD,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,gBAAgB,EAAE,QAAQ;SAC3B,CAAC,CACH,CAAA;QAED,OAAO,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,CAAA;IACrD,CAAC;CACF,CAAA;AAxEY,oDAAoB;+BAApB,oBAAoB;IALhC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,sBAAe,EAAE,kBAAW,CAAC;QACvC,SAAS,EAAE,CAAC,+CAAqB,EAAE,2CAAmB,CAAC;QACvD,OAAO,EAAE,CAAC,+CAAqB,EAAE,2CAAmB,CAAC;KACtD,CAAC;GACW,oBAAoB,CAwEhC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const core_1 = require("@mbc-cqrs-serverless/core");
10
+ const common_1 = require("@nestjs/common");
11
+ const config_1 = require("@nestjs/config");
12
+ const testing_1 = require("@nestjs/testing");
13
+ const survey_template_module_1 = require("./survey-template.module");
14
+ const survey_template_service_1 = require("./survey-template.service");
15
+ class MockPrismaService {
16
+ }
17
+ /**
18
+ * Provides only globally-scoped app dependencies (ConfigService,
19
+ * StepFunctionService) and the concrete PrismaService class. PRISMA_SERVICE is
20
+ * intentionally NOT provided globally: the default data-sync handlers now resolve
21
+ * it from SurveyTemplateModule's own scope, proving the module boots without the
22
+ * app having to expose the token globally.
23
+ */
24
+ let SupportModule = class SupportModule {
25
+ };
26
+ SupportModule = __decorate([
27
+ (0, common_1.Global)(),
28
+ (0, common_1.Module)({
29
+ imports: [
30
+ config_1.ConfigModule.forRoot({
31
+ isGlobal: true,
32
+ ignoreEnvFile: true,
33
+ load: [() => ({ NODE_ENV: 'local', APP_NAME: 'app' })],
34
+ }),
35
+ ],
36
+ providers: [core_1.StepFunctionService, MockPrismaService],
37
+ exports: [core_1.StepFunctionService, MockPrismaService],
38
+ })
39
+ ], SupportModule);
40
+ describe('SurveyTemplateModule', () => {
41
+ afterEach(() => jest.restoreAllMocks());
42
+ describe('register (sync)', () => {
43
+ it('forwards the default table name to CommandModule', () => {
44
+ const spy = jest.spyOn(core_1.CommandModule, 'register');
45
+ survey_template_module_1.SurveyTemplateModule.register({ prismaService: MockPrismaService });
46
+ expect(spy).toHaveBeenCalledWith(expect.objectContaining({ tableName: 'survey' }));
47
+ });
48
+ it('forwards a custom table name to CommandModule', () => {
49
+ const spy = jest.spyOn(core_1.CommandModule, 'register');
50
+ survey_template_module_1.SurveyTemplateModule.register({
51
+ prismaService: MockPrismaService,
52
+ tableName: 'questionnaire',
53
+ });
54
+ expect(spy).toHaveBeenCalledWith(expect.objectContaining({ tableName: 'questionnaire' }));
55
+ });
56
+ it('returns a DynamicModule even when enableController is false', () => {
57
+ const mod = survey_template_module_1.SurveyTemplateModule.register({
58
+ prismaService: MockPrismaService,
59
+ enableController: false,
60
+ });
61
+ expect(mod).toBeDefined();
62
+ expect(mod.module).toBe(survey_template_module_1.SurveyTemplateModule);
63
+ });
64
+ });
65
+ describe('registerAsync', () => {
66
+ it('compiles and resolves the public service (default table)', async () => {
67
+ const moduleRef = await testing_1.Test.createTestingModule({
68
+ imports: [
69
+ SupportModule,
70
+ survey_template_module_1.SurveyTemplateModule.registerAsync({
71
+ inject: [MockPrismaService],
72
+ useFactory: (prisma) => ({
73
+ prismaService: prisma,
74
+ }),
75
+ }),
76
+ ],
77
+ }).compile();
78
+ await moduleRef.init();
79
+ const svc = moduleRef.get(survey_template_service_1.SurveyTemplateService);
80
+ expect(svc).toBeDefined();
81
+ expect(svc.prismaService).toBeInstanceOf(MockPrismaService);
82
+ await moduleRef.close();
83
+ });
84
+ });
85
+ });
86
+ //# sourceMappingURL=survey-template.module.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"survey-template.module.spec.js","sourceRoot":"","sources":["../src/survey-template.module.spec.ts"],"names":[],"mappings":";;;;;;;;AAAA,oDAA8E;AAC9E,2CAA+C;AAC/C,2CAA6C;AAC7C,6CAAsC;AAEtC,qEAA+D;AAC/D,uEAAiE;AAEjE,MAAM,iBAAiB;CAAG;AAE1B;;;;;;GAMG;AAaH,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,aAAa;IAZlB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,qBAAY,CAAC,OAAO,CAAC;gBACnB,QAAQ,EAAE,IAAI;gBACd,aAAa,EAAE,IAAI;gBACnB,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;aACvD,CAAC;SACH;QACD,SAAS,EAAE,CAAC,0BAAmB,EAAE,iBAAiB,CAAC;QACnD,OAAO,EAAE,CAAC,0BAAmB,EAAE,iBAAiB,CAAC;KAClD,CAAC;GACI,aAAa,CAAG;AAEtB,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,SAAS,CAAC,GAAG,EAAE,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CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;YACxE,MAAM,SAAS,GAAG,MAAM,cAAI,CAAC,mBAAmB,CAAC;gBAC/C,OAAO,EAAE;oBACP,aAAa;oBACb,6CAAoB,CAAC,aAAa,CAAC;wBACjC,MAAM,EAAE,CAAC,iBAAiB,CAAC;wBAC3B,UAAU,EAAE,CAAC,MAAyB,EAAE,EAAE,CAAC,CAAC;4BAC1C,aAAa,EAAE,MAAM;yBACtB,CAAC;qBACH,CAAC;iBACH;aACF,CAAC,CAAC,OAAO,EAAE,CAAA;YACZ,MAAM,SAAS,CAAC,IAAI,EAAE,CAAA;YAEtB,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,+CAAqB,CAAC,CAAA;YAChD,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAA;YACzB,MAAM,CAAE,GAAW,CAAC,aAAa,CAAC,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;YACpE,MAAM,SAAS,CAAC,KAAK,EAAE,CAAA;QACzB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mbc-cqrs-serverless/survey-template",
3
- "version": "1.3.5",
3
+ "version": "1.4.0",
4
4
  "description": "Survey module",
5
5
  "keywords": [
6
6
  "mbc",
@@ -41,8 +41,8 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@mbc-cqrs-serverless/core": "1.3.5",
45
- "@mbc-cqrs-serverless/master": "1.3.5"
44
+ "@mbc-cqrs-serverless/core": "1.4.0",
45
+ "@mbc-cqrs-serverless/master": "1.4.0"
46
46
  },
47
- "gitHead": "ec9f5438d64b3bcc7c62feb1327acc652e4c1aad"
47
+ "gitHead": "972a2726e2696e94e988dfc3135086b13cf2345b"
48
48
  }