@dismissible/nestjs-core 2.0.2 → 2.0.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 (43) hide show
  1. package/README.md +12 -0
  2. package/package.json +7 -7
  3. package/src/api/use-cases/batch-get-or-create/batch-get-or-create.controller.d.ts +16 -0
  4. package/src/api/use-cases/batch-get-or-create/batch-get-or-create.controller.js +80 -0
  5. package/src/api/use-cases/batch-get-or-create/batch-get-or-create.controller.js.map +1 -0
  6. package/src/api/use-cases/batch-get-or-create/batch-get-or-create.controller.spec.d.ts +1 -0
  7. package/src/api/use-cases/batch-get-or-create/batch-get-or-create.controller.spec.js +52 -0
  8. package/src/api/use-cases/batch-get-or-create/batch-get-or-create.controller.spec.js.map +1 -0
  9. package/src/api/use-cases/batch-get-or-create/batch-get-or-create.request.dto.d.ts +10 -0
  10. package/src/api/use-cases/batch-get-or-create/batch-get-or-create.request.dto.js +47 -0
  11. package/src/api/use-cases/batch-get-or-create/batch-get-or-create.request.dto.js.map +1 -0
  12. package/src/api/use-cases/batch-get-or-create/batch-get-or-create.response.dto.d.ts +7 -0
  13. package/src/api/use-cases/batch-get-or-create/batch-get-or-create.response.dto.js +20 -0
  14. package/src/api/use-cases/batch-get-or-create/batch-get-or-create.response.dto.js.map +1 -0
  15. package/src/api/use-cases/batch-get-or-create/index.d.ts +3 -0
  16. package/src/api/use-cases/batch-get-or-create/index.js +7 -0
  17. package/src/api/use-cases/batch-get-or-create/index.js.map +1 -0
  18. package/src/api/use-cases/index.d.ts +1 -0
  19. package/src/api/use-cases/index.js +1 -0
  20. package/src/api/use-cases/index.js.map +1 -1
  21. package/src/core/dismissible-core.service.d.ts +21 -1
  22. package/src/core/dismissible-core.service.interface.d.ts +21 -1
  23. package/src/core/dismissible-core.service.interface.js.map +1 -1
  24. package/src/core/dismissible-core.service.js +101 -0
  25. package/src/core/dismissible-core.service.js.map +1 -1
  26. package/src/core/dismissible-core.service.spec.js +164 -0
  27. package/src/core/dismissible-core.service.spec.js.map +1 -1
  28. package/src/core/dismissible.service.d.ts +8 -1
  29. package/src/core/dismissible.service.interface.d.ts +8 -1
  30. package/src/core/dismissible.service.interface.js.map +1 -1
  31. package/src/core/dismissible.service.js +76 -0
  32. package/src/core/dismissible.service.js.map +1 -1
  33. package/src/core/hook-runner.interface.d.ts +28 -1
  34. package/src/core/hook-runner.service.d.ts +53 -1
  35. package/src/core/hook-runner.service.js +168 -0
  36. package/src/core/hook-runner.service.js.map +1 -1
  37. package/src/core/hook-runner.service.spec.js +353 -0
  38. package/src/core/hook-runner.service.spec.js.map +1 -1
  39. package/src/core/service-responses.interface.d.ts +11 -0
  40. package/src/dismissible.module.integration.spec.js +212 -4
  41. package/src/dismissible.module.integration.spec.js.map +1 -1
  42. package/src/dismissible.module.js +7 -1
  43. package/src/dismissible.module.js.map +1 -1
package/README.md CHANGED
@@ -78,6 +78,7 @@ The module automatically registers REST endpoints for all operations:
78
78
  - `GET /v1/users/:userId/items/:itemId` - Get or create an item
79
79
  - `DELETE /v1/users/:userId/items/:itemId` - Dismiss an item
80
80
  - `POST /v1/users/:userId/items/:itemId` - Restore a dismissed item
81
+ - `POST /v1/users/:userId/items` - Batch get or create multiple items (max 50)
81
82
 
82
83
  Example request:
83
84
 
@@ -90,6 +91,11 @@ curl -X DELETE http://localhost:3000/v1/users/user-123/items/welcome-banner
90
91
 
91
92
  # Restore a dismissed item
92
93
  curl -X POST http://localhost:3000/v1/users/user-123/items/welcome-banner
94
+
95
+ # Batch get or create multiple items
96
+ curl -X POST http://localhost:3000/v1/users/user-123/items \
97
+ -H "Content-Type: application/json" \
98
+ -d '{"items": ["welcome-banner", "onboarding-tip-1", "feature-announcement"]}'
93
99
  ```
94
100
 
95
101
  ### React Client Integration
@@ -447,6 +453,12 @@ export class FeaturesController {
447
453
  const result = await this.dismissibleService.restore(itemId, userId);
448
454
  return { item: result.item };
449
455
  }
456
+
457
+ @Post(':userId/items')
458
+ async batchGetOrCreate(@Param('userId') userId: string, @Body() body: { items: string[] }) {
459
+ const result = await this.dismissibleService.batchGetOrCreate(body.items, userId);
460
+ return { items: result.items };
461
+ }
450
462
  }
451
463
  ```
452
464
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dismissible/nestjs-core",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Core Dismissible state management library for NestJS applications",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -18,12 +18,12 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "@nestjs/event-emitter": "^3.0.1",
21
- "@dismissible/nestjs-hooks": "^2.0.2",
22
- "@dismissible/nestjs-item": "^2.0.2",
23
- "@dismissible/nestjs-request": "^2.0.2",
24
- "@dismissible/nestjs-storage": "^2.0.2",
25
- "@dismissible/nestjs-logger": "^2.0.2",
26
- "@dismissible/nestjs-validation": "^2.0.2"
21
+ "@dismissible/nestjs-hooks": "^2.0.3",
22
+ "@dismissible/nestjs-item": "^2.0.3",
23
+ "@dismissible/nestjs-request": "^2.0.3",
24
+ "@dismissible/nestjs-storage": "^2.0.3",
25
+ "@dismissible/nestjs-logger": "^2.0.3",
26
+ "@dismissible/nestjs-validation": "^2.0.3"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@nestjs/common": "^10.0.0 || ^11.0.0",
@@ -0,0 +1,16 @@
1
+ import { IDismissibleService } from '../../../core/dismissible.service.interface';
2
+ import { IDismissibleItemMapper } from '../../dismissible-item.mapper.interface';
3
+ import { IRequestContext } from '@dismissible/nestjs-request';
4
+ import { BatchGetOrCreateRequestDto } from './batch-get-or-create.request.dto';
5
+ import { BatchGetOrCreateResponseDto } from './batch-get-or-create.response.dto';
6
+ import { IResponseService } from '../../../response/response.service.interface';
7
+ /**
8
+ * Controller for batch get-or-create dismissible item operations.
9
+ */
10
+ export declare class BatchGetOrCreateController {
11
+ private readonly dismissibleService;
12
+ private readonly mapper;
13
+ private readonly responseService;
14
+ constructor(dismissibleService: IDismissibleService, mapper: IDismissibleItemMapper, responseService: IResponseService);
15
+ batchGetOrCreate(userId: string, body: BatchGetOrCreateRequestDto, context: IRequestContext): Promise<BatchGetOrCreateResponseDto>;
16
+ }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BatchGetOrCreateController = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const swagger_1 = require("@nestjs/swagger");
7
+ const dismissible_service_interface_1 = require("../../../core/dismissible.service.interface");
8
+ const dismissible_item_mapper_interface_1 = require("../../dismissible-item.mapper.interface");
9
+ const nestjs_request_1 = require("@dismissible/nestjs-request");
10
+ const batch_get_or_create_request_dto_1 = require("./batch-get-or-create.request.dto");
11
+ const batch_get_or_create_response_dto_1 = require("./batch-get-or-create.response.dto");
12
+ const response_service_interface_1 = require("../../../response/response.service.interface");
13
+ const http_exception_filter_1 = require("../../../response/http-exception-filter");
14
+ const api_tags_constants_1 = require("../api-tags.constants");
15
+ const validation_1 = require("../../validation");
16
+ /**
17
+ * Route for batch operations (without itemId param).
18
+ */
19
+ const BATCH_ROUTE = '/v1/users/:userId/items';
20
+ /**
21
+ * Controller for batch get-or-create dismissible item operations.
22
+ */
23
+ let BatchGetOrCreateController = class BatchGetOrCreateController {
24
+ constructor(dismissibleService, mapper, responseService) {
25
+ this.dismissibleService = dismissibleService;
26
+ this.mapper = mapper;
27
+ this.responseService = responseService;
28
+ }
29
+ async batchGetOrCreate(userId, body, context) {
30
+ const result = await this.dismissibleService.batchGetOrCreate(body.items, userId, context);
31
+ const responseItems = result.items.map((item) => this.mapper.toResponseDto(item));
32
+ return this.responseService.success(responseItems);
33
+ }
34
+ };
35
+ exports.BatchGetOrCreateController = BatchGetOrCreateController;
36
+ tslib_1.__decorate([
37
+ (0, common_1.Post)(),
38
+ (0, swagger_1.ApiOperation)({
39
+ summary: 'Batch get or create dismissible items',
40
+ description: 'Retrieves existing dismissible items or creates new ones for the given item IDs. Returns all items in the order requested.',
41
+ }),
42
+ (0, swagger_1.ApiParam)({
43
+ name: 'userId',
44
+ description: 'User identifier (max length: 64 characters)',
45
+ example: 'user-123',
46
+ }),
47
+ (0, swagger_1.ApiBody)({
48
+ type: batch_get_or_create_request_dto_1.BatchGetOrCreateRequestDto,
49
+ description: 'Array of item IDs to get or create',
50
+ }),
51
+ (0, swagger_1.ApiResponse)({
52
+ status: 200,
53
+ description: 'The dismissible items (retrieved or created)',
54
+ type: batch_get_or_create_response_dto_1.BatchGetOrCreateResponseDto,
55
+ }),
56
+ (0, swagger_1.ApiResponse)({
57
+ status: 400,
58
+ description: 'Invalid request (validation error)',
59
+ }),
60
+ (0, swagger_1.ApiResponse)({
61
+ status: 403,
62
+ description: 'Operation blocked by lifecycle hook',
63
+ }),
64
+ (0, common_1.UseFilters)(http_exception_filter_1.HttpExceptionFilter),
65
+ tslib_1.__param(0, (0, validation_1.UserId)()),
66
+ tslib_1.__param(1, (0, common_1.Body)()),
67
+ tslib_1.__param(2, (0, nestjs_request_1.RequestContext)()),
68
+ tslib_1.__metadata("design:type", Function),
69
+ tslib_1.__metadata("design:paramtypes", [String, batch_get_or_create_request_dto_1.BatchGetOrCreateRequestDto, Object]),
70
+ tslib_1.__metadata("design:returntype", Promise)
71
+ ], BatchGetOrCreateController.prototype, "batchGetOrCreate", null);
72
+ exports.BatchGetOrCreateController = BatchGetOrCreateController = tslib_1.__decorate([
73
+ (0, swagger_1.ApiTags)(api_tags_constants_1.API_TAG_DISMISSIBLE),
74
+ (0, common_1.Controller)(BATCH_ROUTE),
75
+ tslib_1.__param(0, (0, common_1.Inject)(dismissible_service_interface_1.DISMISSIBLE_SERVICE)),
76
+ tslib_1.__param(1, (0, common_1.Inject)(dismissible_item_mapper_interface_1.DISMISSIBLE_ITEM_MAPPER)),
77
+ tslib_1.__param(2, (0, common_1.Inject)(response_service_interface_1.DISMISSIBLE_RESPONSE_SERVICE)),
78
+ tslib_1.__metadata("design:paramtypes", [Object, Object, Object])
79
+ ], BatchGetOrCreateController);
80
+ //# sourceMappingURL=batch-get-or-create.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-get-or-create.controller.js","sourceRoot":"","sources":["../../../../../../../libs/core/src/api/use-cases/batch-get-or-create/batch-get-or-create.controller.ts"],"names":[],"mappings":";;;;AAAA,2CAA4E;AAC5E,6CAAwF;AACxF,+FAGqD;AACrD,+FAGiD;AACjD,gEAA8E;AAC9E,uFAA+E;AAC/E,yFAAiF;AACjF,6FAGsD;AACtD,mFAA8E;AAC9E,8DAA4D;AAC5D,iDAA0C;AAE1C;;GAEG;AACH,MAAM,WAAW,GAAG,yBAAyB,CAAC;AAE9C;;GAEG;AAGI,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IACrC,YAEmB,kBAAuC,EAEvC,MAA8B,EAE9B,eAAiC;QAJjC,uBAAkB,GAAlB,kBAAkB,CAAqB;QAEvC,WAAM,GAAN,MAAM,CAAwB;QAE9B,oBAAe,GAAf,eAAe,CAAkB;IACjD,CAAC;IA+BE,AAAN,KAAK,CAAC,gBAAgB,CACV,MAAc,EAChB,IAAgC,EACtB,OAAwB;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAE3F,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QAElF,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACrD,CAAC;CACF,CAAA;AAlDY,gEAA0B;AAuC/B;IA7BL,IAAA,aAAI,GAAE;IACN,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,uCAAuC;QAChD,WAAW,EACT,4HAA4H;KAC/H,CAAC;IACD,IAAA,kBAAQ,EAAC;QACR,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,6CAA6C;QAC1D,OAAO,EAAE,UAAU;KACpB,CAAC;IACD,IAAA,iBAAO,EAAC;QACP,IAAI,EAAE,4DAA0B;QAChC,WAAW,EAAE,oCAAoC;KAClD,CAAC;IACD,IAAA,qBAAW,EAAC;QACX,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,8CAA8C;QAC3D,IAAI,EAAE,8DAA2B;KAClC,CAAC;IACD,IAAA,qBAAW,EAAC;QACX,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,oCAAoC;KAClD,CAAC;IACD,IAAA,qBAAW,EAAC;QACX,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,qCAAqC;KACnD,CAAC;IACD,IAAA,mBAAU,EAAC,2CAAmB,CAAC;IAE7B,mBAAA,IAAA,mBAAM,GAAE,CAAA;IACR,mBAAA,IAAA,aAAI,GAAE,CAAA;IACN,mBAAA,IAAA,+BAAc,GAAE,CAAA;;qDADH,4DAA0B;;kEAQzC;qCAjDU,0BAA0B;IAFtC,IAAA,iBAAO,EAAC,wCAAmB,CAAC;IAC5B,IAAA,mBAAU,EAAC,WAAW,CAAC;IAGnB,mBAAA,IAAA,eAAM,EAAC,mDAAmB,CAAC,CAAA;IAE3B,mBAAA,IAAA,eAAM,EAAC,2DAAuB,CAAC,CAAA;IAE/B,mBAAA,IAAA,eAAM,EAAC,yDAA4B,CAAC,CAAA;;GAN5B,0BAA0B,CAkDtC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ts_jest_mocker_1 = require("ts-jest-mocker");
4
+ const batch_get_or_create_controller_1 = require("./batch-get-or-create.controller");
5
+ const dismissible_service_1 = require("../../../core/dismissible.service");
6
+ const dismissible_item_mapper_1 = require("../../dismissible-item.mapper");
7
+ const factories_1 = require("../../../testing/factories");
8
+ const response_1 = require("../../../response");
9
+ describe('BatchGetOrCreateController', () => {
10
+ let controller;
11
+ let mockService;
12
+ let mockResponseService;
13
+ let mapper;
14
+ beforeEach(() => {
15
+ mockService = (0, ts_jest_mocker_1.mock)(dismissible_service_1.DismissibleService);
16
+ mockResponseService = (0, ts_jest_mocker_1.mock)(response_1.ResponseService, { failIfMockNotProvided: false });
17
+ mockResponseService.success.mockImplementation((data) => ({ data }));
18
+ mapper = new dismissible_item_mapper_1.DismissibleItemMapper();
19
+ controller = new batch_get_or_create_controller_1.BatchGetOrCreateController(mockService, mapper, mockResponseService);
20
+ });
21
+ describe('batchGetOrCreate', () => {
22
+ it('should return items wrapped in data', async () => {
23
+ const item1 = (0, factories_1.createTestItem)({ id: 'item-1' });
24
+ const item2 = (0, factories_1.createTestItem)({ id: 'item-2' });
25
+ const context = (0, factories_1.createTestContext)();
26
+ mockService.batchGetOrCreate.mockResolvedValue({
27
+ items: [item1, item2],
28
+ retrievedItems: [item1],
29
+ createdItems: [item2],
30
+ });
31
+ const result = await controller.batchGetOrCreate('test-user-id', { items: ['item-1', 'item-2'] }, context);
32
+ expect(result.data).toHaveLength(2);
33
+ expect(result.data[0].itemId).toBe('item-1');
34
+ expect(result.data[1].itemId).toBe('item-2');
35
+ expect(mockResponseService.success).toHaveBeenCalled();
36
+ expect(mockService.batchGetOrCreate).toHaveBeenCalledWith(['item-1', 'item-2'], 'test-user-id', context);
37
+ });
38
+ it('should handle single item request', async () => {
39
+ const item = (0, factories_1.createTestItem)({ id: 'single-item' });
40
+ const context = (0, factories_1.createTestContext)();
41
+ mockService.batchGetOrCreate.mockResolvedValue({
42
+ items: [item],
43
+ retrievedItems: [],
44
+ createdItems: [item],
45
+ });
46
+ const result = await controller.batchGetOrCreate('test-user-id', { items: ['single-item'] }, context);
47
+ expect(result.data).toHaveLength(1);
48
+ expect(result.data[0].itemId).toBe('single-item');
49
+ });
50
+ });
51
+ });
52
+ //# sourceMappingURL=batch-get-or-create.controller.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-get-or-create.controller.spec.js","sourceRoot":"","sources":["../../../../../../../libs/core/src/api/use-cases/batch-get-or-create/batch-get-or-create.controller.spec.ts"],"names":[],"mappings":";;AAAA,mDAA4C;AAC5C,qFAA8E;AAC9E,2EAAuE;AACvE,2EAAsE;AACtE,0DAA+E;AAC/E,gDAAoD;AAEpD,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,IAAI,UAAsC,CAAC;IAC3C,IAAI,WAAqC,CAAC;IAC1C,IAAI,mBAA0C,CAAC;IAC/C,IAAI,MAA6B,CAAC;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,WAAW,GAAG,IAAA,qBAAI,EAAC,wCAAkB,CAAC,CAAC;QACvC,mBAAmB,GAAG,IAAA,qBAAI,EAAC,0BAAe,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9E,mBAAmB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACrE,MAAM,GAAG,IAAI,+CAAqB,EAAE,CAAC;QAErC,UAAU,GAAG,IAAI,2DAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACxF,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;YACnD,MAAM,KAAK,GAAG,IAAA,0BAAc,EAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC/C,MAAM,KAAK,GAAG,IAAA,0BAAc,EAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC/C,MAAM,OAAO,GAAG,IAAA,6BAAiB,GAAE,CAAC;YAEpC,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC;gBAC7C,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,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AAE,EAC1B,OAAO,CACR,CAAC;YAEF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACpC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Maximum number of items allowed in a batch request.
3
+ */
4
+ export declare const BATCH_MAX_SIZE = 50;
5
+ /**
6
+ * Request DTO for batch get-or-create operation.
7
+ */
8
+ export declare class BatchGetOrCreateRequestDto {
9
+ items: string[];
10
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BatchGetOrCreateRequestDto = exports.BATCH_MAX_SIZE = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const swagger_1 = require("@nestjs/swagger");
6
+ const class_validator_1 = require("class-validator");
7
+ const dismissible_input_dto_1 = require("../../../validation/dismissible-input.dto");
8
+ /**
9
+ * Maximum number of items allowed in a batch request.
10
+ */
11
+ exports.BATCH_MAX_SIZE = 50;
12
+ /**
13
+ * Request DTO for batch get-or-create operation.
14
+ */
15
+ class BatchGetOrCreateRequestDto {
16
+ }
17
+ exports.BatchGetOrCreateRequestDto = BatchGetOrCreateRequestDto;
18
+ tslib_1.__decorate([
19
+ (0, swagger_1.ApiProperty)({
20
+ description: `Array of item IDs to get or create (max ${exports.BATCH_MAX_SIZE} items)`,
21
+ example: ['welcome-banner-v1', 'onboarding-tip-1', 'feature-announcement'],
22
+ type: [String],
23
+ minItems: 1,
24
+ maxItems: exports.BATCH_MAX_SIZE,
25
+ }),
26
+ (0, class_validator_1.IsArray)(),
27
+ (0, class_validator_1.ArrayMinSize)(1, { message: 'items array must contain at least 1 item' }),
28
+ (0, class_validator_1.ArrayMaxSize)(exports.BATCH_MAX_SIZE, {
29
+ message: `items array must contain at most ${exports.BATCH_MAX_SIZE} items`,
30
+ }),
31
+ (0, class_validator_1.IsString)({ each: true }),
32
+ (0, class_validator_1.IsNotEmpty)({ each: true, message: 'each item ID must not be empty' }),
33
+ (0, class_validator_1.MinLength)(dismissible_input_dto_1.VALIDATION_CONSTANTS.ID_MIN_LENGTH, {
34
+ each: true,
35
+ message: `each item ID must be at least ${dismissible_input_dto_1.VALIDATION_CONSTANTS.ID_MIN_LENGTH} character`,
36
+ }),
37
+ (0, class_validator_1.MaxLength)(dismissible_input_dto_1.VALIDATION_CONSTANTS.ID_MAX_LENGTH, {
38
+ each: true,
39
+ message: `each item ID must be at most ${dismissible_input_dto_1.VALIDATION_CONSTANTS.ID_MAX_LENGTH} characters`,
40
+ }),
41
+ (0, class_validator_1.Matches)(dismissible_input_dto_1.VALIDATION_CONSTANTS.ID_PATTERN, {
42
+ each: true,
43
+ message: `each item ID ${dismissible_input_dto_1.VALIDATION_CONSTANTS.ID_PATTERN_MESSAGE}`,
44
+ }),
45
+ tslib_1.__metadata("design:type", Array)
46
+ ], BatchGetOrCreateRequestDto.prototype, "items", void 0);
47
+ //# sourceMappingURL=batch-get-or-create.request.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-get-or-create.request.dto.js","sourceRoot":"","sources":["../../../../../../../libs/core/src/api/use-cases/batch-get-or-create/batch-get-or-create.request.dto.ts"],"names":[],"mappings":";;;;AAAA,6CAA8C;AAC9C,qDASyB;AACzB,qFAAiF;AAEjF;;GAEG;AACU,QAAA,cAAc,GAAG,EAAE,CAAC;AAEjC;;GAEG;AACH,MAAa,0BAA0B;CA4BtC;AA5BD,gEA4BC;AADC;IA1BC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,2CAA2C,sBAAc,SAAS;QAC/E,OAAO,EAAE,CAAC,mBAAmB,EAAE,kBAAkB,EAAE,sBAAsB,CAAC;QAC1E,IAAI,EAAE,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,sBAAc;KACzB,CAAC;IACD,IAAA,yBAAO,GAAE;IACT,IAAA,8BAAY,EAAC,CAAC,EAAE,EAAE,OAAO,EAAE,0CAA0C,EAAE,CAAC;IACxE,IAAA,8BAAY,EAAC,sBAAc,EAAE;QAC5B,OAAO,EAAE,oCAAoC,sBAAc,QAAQ;KACpE,CAAC;IACD,IAAA,0BAAQ,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACxB,IAAA,4BAAU,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gCAAgC,EAAE,CAAC;IACrE,IAAA,2BAAS,EAAC,4CAAoB,CAAC,aAAa,EAAE;QAC7C,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,iCAAiC,4CAAoB,CAAC,aAAa,YAAY;KACzF,CAAC;IACD,IAAA,2BAAS,EAAC,4CAAoB,CAAC,aAAa,EAAE;QAC7C,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,gCAAgC,4CAAoB,CAAC,aAAa,aAAa;KACzF,CAAC;IACD,IAAA,yBAAO,EAAC,4CAAoB,CAAC,UAAU,EAAE;QACxC,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,gBAAgB,4CAAoB,CAAC,kBAAkB,EAAE;KACnE,CAAC;;yDACe"}
@@ -0,0 +1,7 @@
1
+ import { DismissibleItemResponseDto } from '../../dismissible-item-response.dto';
2
+ /**
3
+ * Response DTO for the batch getOrCreate operation.
4
+ */
5
+ export declare class BatchGetOrCreateResponseDto {
6
+ data: DismissibleItemResponseDto[];
7
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BatchGetOrCreateResponseDto = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const swagger_1 = require("@nestjs/swagger");
6
+ const dismissible_item_response_dto_1 = require("../../dismissible-item-response.dto");
7
+ /**
8
+ * Response DTO for the batch getOrCreate operation.
9
+ */
10
+ class BatchGetOrCreateResponseDto {
11
+ }
12
+ exports.BatchGetOrCreateResponseDto = BatchGetOrCreateResponseDto;
13
+ tslib_1.__decorate([
14
+ (0, swagger_1.ApiProperty)({
15
+ description: 'Array of dismissible items (retrieved or created)',
16
+ type: [dismissible_item_response_dto_1.DismissibleItemResponseDto],
17
+ }),
18
+ tslib_1.__metadata("design:type", Array)
19
+ ], BatchGetOrCreateResponseDto.prototype, "data", void 0);
20
+ //# sourceMappingURL=batch-get-or-create.response.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-get-or-create.response.dto.js","sourceRoot":"","sources":["../../../../../../../libs/core/src/api/use-cases/batch-get-or-create/batch-get-or-create.response.dto.ts"],"names":[],"mappings":";;;;AAAA,6CAA8C;AAC9C,uFAAiF;AAEjF;;GAEG;AACH,MAAa,2BAA2B;CAMvC;AAND,kEAMC;AADC;IAJC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,mDAAmD;QAChE,IAAI,EAAE,CAAC,0DAA0B,CAAC;KACnC,CAAC;;yDACkC"}
@@ -0,0 +1,3 @@
1
+ export * from './batch-get-or-create.request.dto';
2
+ export * from './batch-get-or-create.response.dto';
3
+ export * from './batch-get-or-create.controller';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./batch-get-or-create.request.dto"), exports);
5
+ tslib_1.__exportStar(require("./batch-get-or-create.response.dto"), exports);
6
+ tslib_1.__exportStar(require("./batch-get-or-create.controller"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/core/src/api/use-cases/batch-get-or-create/index.ts"],"names":[],"mappings":";;;AAAA,4EAAkD;AAClD,6EAAmD;AACnD,2EAAiD"}
@@ -1,3 +1,4 @@
1
1
  export * from './get-or-create';
2
+ export * from './batch-get-or-create';
2
3
  export * from './dismiss';
3
4
  export * from './restore';
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./get-or-create"), exports);
5
+ tslib_1.__exportStar(require("./batch-get-or-create"), exports);
5
6
  tslib_1.__exportStar(require("./dismiss"), exports);
6
7
  tslib_1.__exportStar(require("./restore"), exports);
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/core/src/api/use-cases/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,oDAA0B;AAC1B,oDAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/core/src/api/use-cases/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,gEAAsC;AACtC,oDAA0B;AAC1B,oDAA0B"}
@@ -1,5 +1,5 @@
1
1
  import { IDismissibleStorage } from '@dismissible/nestjs-storage';
2
- import { IGetOrCreateServiceResponse, IDismissServiceResponse, IRestoreServiceResponse } from './service-responses.interface';
2
+ import { IGetOrCreateServiceResponse, IBatchGetOrCreateServiceResponse, IDismissServiceResponse, IRestoreServiceResponse } from './service-responses.interface';
3
3
  import { IDismissibleCoreService } from './dismissible-core.service.interface';
4
4
  import { IDismissibleHelper } from '../utils/dismissible.helper.interface';
5
5
  import { IDateService } from '../utils/date/date.service.interface';
@@ -25,6 +25,13 @@ export declare class DismissibleCoreService implements IDismissibleCoreService {
25
25
  * @returns The item or null if not found
26
26
  */
27
27
  get(itemId: string, userId: string): Promise<DismissibleItemDto | null>;
28
+ /**
29
+ * Get multiple existing items by user ID and item IDs.
30
+ * @param itemIds Array of item identifiers
31
+ * @param userId The user identifier (required)
32
+ * @returns Map of itemId to item for items that exist
33
+ */
34
+ getMany(itemIds: string[], userId: string): Promise<Map<string, DismissibleItemDto>>;
28
35
  /**
29
36
  * Create a new item.
30
37
  * @param itemId The item identifier
@@ -32,12 +39,25 @@ export declare class DismissibleCoreService implements IDismissibleCoreService {
32
39
  * @returns The created item
33
40
  */
34
41
  create(itemId: string, userId: string): Promise<DismissibleItemDto>;
42
+ /**
43
+ * Create multiple new items.
44
+ * @param itemIds Array of item identifiers
45
+ * @param userId The user identifier (required)
46
+ * @returns Array of created items
47
+ */
48
+ createMany(itemIds: string[], userId: string): Promise<DismissibleItemDto[]>;
35
49
  /**
36
50
  * Get an existing item or create a new one.
37
51
  * @param itemId The item identifier
38
52
  * @param userId The user identifier (required)
39
53
  */
40
54
  getOrCreate(itemId: string, userId: string): Promise<IGetOrCreateServiceResponse>;
55
+ /**
56
+ * Get existing items or create new ones for multiple item IDs.
57
+ * @param itemIds Array of item identifiers
58
+ * @param userId The user identifier (required)
59
+ */
60
+ batchGetOrCreate(itemIds: string[], userId: string): Promise<IBatchGetOrCreateServiceResponse>;
41
61
  /**
42
62
  * Dismiss an item.
43
63
  * @param itemId The item identifier
@@ -1,5 +1,5 @@
1
1
  import { DismissibleItemDto } from '@dismissible/nestjs-item';
2
- import { IGetOrCreateServiceResponse, IDismissServiceResponse, IRestoreServiceResponse } from './service-responses.interface';
2
+ import { IGetOrCreateServiceResponse, IBatchGetOrCreateServiceResponse, IDismissServiceResponse, IRestoreServiceResponse } from './service-responses.interface';
3
3
  /**
4
4
  * Injection token for the dismissible core service provider.
5
5
  */
@@ -16,6 +16,13 @@ export interface IDismissibleCoreService {
16
16
  * @returns The item or null if not found
17
17
  */
18
18
  get(itemId: string, userId: string): Promise<DismissibleItemDto | null>;
19
+ /**
20
+ * Get multiple existing items by user ID and item IDs.
21
+ * @param itemIds Array of item identifiers
22
+ * @param userId The user identifier (required)
23
+ * @returns Map of itemId to item for items that exist
24
+ */
25
+ getMany(itemIds: string[], userId: string): Promise<Map<string, DismissibleItemDto>>;
19
26
  /**
20
27
  * Create a new item.
21
28
  * @param itemId The item identifier
@@ -23,12 +30,25 @@ export interface IDismissibleCoreService {
23
30
  * @returns The created item
24
31
  */
25
32
  create(itemId: string, userId: string): Promise<DismissibleItemDto>;
33
+ /**
34
+ * Create multiple new items.
35
+ * @param itemIds Array of item identifiers
36
+ * @param userId The user identifier (required)
37
+ * @returns Array of created items
38
+ */
39
+ createMany(itemIds: string[], userId: string): Promise<DismissibleItemDto[]>;
26
40
  /**
27
41
  * Get an existing item or create a new one.
28
42
  * @param itemId The item identifier
29
43
  * @param userId The user identifier (required)
30
44
  */
31
45
  getOrCreate(itemId: string, userId: string): Promise<IGetOrCreateServiceResponse>;
46
+ /**
47
+ * Get existing items or create new ones for multiple item IDs.
48
+ * @param itemIds Array of item identifiers
49
+ * @param userId The user identifier (required)
50
+ */
51
+ batchGetOrCreate(itemIds: string[], userId: string): Promise<IBatchGetOrCreateServiceResponse>;
32
52
  /**
33
53
  * Dismiss an item.
34
54
  * @param itemId The item identifier
@@ -1 +1 @@
1
- {"version":3,"file":"dismissible-core.service.interface.js","sourceRoot":"","sources":["../../../../../libs/core/src/core/dismissible-core.service.interface.ts"],"names":[],"mappings":";;;AAOA;;GAEG;AACU,QAAA,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC"}
1
+ {"version":3,"file":"dismissible-core.service.interface.js","sourceRoot":"","sources":["../../../../../libs/core/src/core/dismissible-core.service.interface.ts"],"names":[],"mappings":";;;AAQA;;GAEG;AACU,QAAA,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC"}
@@ -37,6 +37,18 @@ let DismissibleCoreService = class DismissibleCoreService {
37
37
  }
38
38
  return item;
39
39
  }
40
+ /**
41
+ * Get multiple existing items by user ID and item IDs.
42
+ * @param itemIds Array of item identifiers
43
+ * @param userId The user identifier (required)
44
+ * @returns Map of itemId to item for items that exist
45
+ */
46
+ async getMany(itemIds, userId) {
47
+ this.logger.debug(`Looking up items in storage`, { itemCount: itemIds.length, userId });
48
+ const items = await this.storage.getMany(userId, itemIds);
49
+ this.logger.debug(`Found items`, { requested: itemIds.length, found: items.size, userId });
50
+ return items;
51
+ }
40
52
  /**
41
53
  * Create a new item.
42
54
  * @param itemId The item identifier
@@ -59,6 +71,34 @@ let DismissibleCoreService = class DismissibleCoreService {
59
71
  this.logger.log(`Created new dismissible item`, { itemId, userId });
60
72
  return createdItem;
61
73
  }
74
+ /**
75
+ * Create multiple new items.
76
+ * @param itemIds Array of item identifiers
77
+ * @param userId The user identifier (required)
78
+ * @returns Array of created items
79
+ */
80
+ async createMany(itemIds, userId) {
81
+ if (itemIds.length === 0) {
82
+ return [];
83
+ }
84
+ this.logger.debug(`Creating new items`, {
85
+ itemCount: itemIds.length,
86
+ userId,
87
+ });
88
+ const now = this.dateService.getNow();
89
+ const itemsToCreate = itemIds.map((itemId) => this.itemFactory.create({
90
+ id: itemId,
91
+ createdAt: now,
92
+ userId,
93
+ }));
94
+ // Validate all items before creating
95
+ for (const item of itemsToCreate) {
96
+ await this.validationService.validateInstance(item);
97
+ }
98
+ const createdItems = await this.storage.createMany(itemsToCreate);
99
+ this.logger.log(`Created new dismissible items`, { itemCount: createdItems.length, userId });
100
+ return createdItems;
101
+ }
62
102
  /**
63
103
  * Get an existing item or create a new one.
64
104
  * @param itemId The item identifier
@@ -78,6 +118,67 @@ let DismissibleCoreService = class DismissibleCoreService {
78
118
  created: true,
79
119
  };
80
120
  }
121
+ /**
122
+ * Get existing items or create new ones for multiple item IDs.
123
+ * @param itemIds Array of item identifiers
124
+ * @param userId The user identifier (required)
125
+ */
126
+ async batchGetOrCreate(itemIds, userId) {
127
+ this.logger.debug(`Batch looking up items in storage`, { itemCount: itemIds.length, userId });
128
+ // Get all existing items in one batch query
129
+ const existingItemsMap = await this.storage.getMany(userId, itemIds);
130
+ // Separate existing items from items to create
131
+ const retrievedItems = [];
132
+ const itemIdsToCreate = [];
133
+ for (const itemId of itemIds) {
134
+ const existingItem = existingItemsMap.get(itemId);
135
+ if (existingItem) {
136
+ retrievedItems.push(existingItem);
137
+ }
138
+ else {
139
+ itemIdsToCreate.push(itemId);
140
+ }
141
+ }
142
+ this.logger.debug(`Batch lookup complete`, {
143
+ userId,
144
+ requested: itemIds.length,
145
+ existing: retrievedItems.length,
146
+ toCreate: itemIdsToCreate.length,
147
+ });
148
+ // Create missing items
149
+ let createdItems = [];
150
+ if (itemIdsToCreate.length > 0) {
151
+ const now = this.dateService.getNow();
152
+ const itemsToCreate = itemIdsToCreate.map((itemId) => this.itemFactory.create({
153
+ id: itemId,
154
+ createdAt: now,
155
+ userId,
156
+ }));
157
+ // Validate all items before creating
158
+ for (const item of itemsToCreate) {
159
+ await this.validationService.validateInstance(item);
160
+ }
161
+ createdItems = await this.storage.createMany(itemsToCreate);
162
+ this.logger.log(`Batch created new dismissible items`, {
163
+ userId,
164
+ created: createdItems.length,
165
+ });
166
+ }
167
+ // Combine all items in the original order
168
+ const allItemsMap = new Map();
169
+ for (const item of retrievedItems) {
170
+ allItemsMap.set(item.id, item);
171
+ }
172
+ for (const item of createdItems) {
173
+ allItemsMap.set(item.id, item);
174
+ }
175
+ const items = itemIds.map((id) => allItemsMap.get(id));
176
+ return {
177
+ items,
178
+ retrievedItems,
179
+ createdItems,
180
+ };
181
+ }
81
182
  /**
82
183
  * Dismiss an item.
83
184
  * @param itemId The item identifier
@@ -1 +1 @@
1
- {"version":3,"file":"dismissible-core.service.js","sourceRoot":"","sources":["../../../../../libs/core/src/core/dismissible-core.service.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AACpD,gEAA+F;AAO/F,wFAA+F;AAC/F,iFAA8F;AAC9F,8DAAoF;AACpF,8CAIuB;AACvB,sEAAoG;AACpG,0DAIkC;AAElC;;;GAGG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACjC,YACwD,OAA4B,EAC/B,WAAyB,EAC/B,MAA0B,EACpB,WAAoC,EAEtE,iBAAqC,EACT,iBAAqC;QAN5B,YAAO,GAAP,OAAO,CAAqB;QAC/B,gBAAW,GAAX,WAAW,CAAc;QAC/B,WAAM,GAAN,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CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QAEnE,MAAM,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAE5D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAE5D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAErD,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,YAAY;SACb,CAAC;IACJ,CAAC;CACF,CAAA;AAtJY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;IAGR,mBAAA,IAAA,eAAM,EAAC,4CAA2B,CAAC,CAAA;IACnC,mBAAA,IAAA,eAAM,EAAC,iDAAwB,CAAC,CAAA;IAChC,mBAAA,IAAA,eAAM,EAAC,kCAAkB,CAAC,CAAA;IAC1B,mBAAA,IAAA,eAAM,EAAC,sCAAwB,CAAC,CAAA;IAChC,mBAAA,IAAA,eAAM,EAAC,kDAA8B,CAAC,CAAA;IAEtC,mBAAA,IAAA,eAAM,EAAC,iDAAkB,CAAC,CAAA;;GARlB,sBAAsB,CAsJlC"}
1
+ {"version":3,"file":"dismissible-core.service.js","sourceRoot":"","sources":["../../../../../libs/core/src/core/dismissible-core.service.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AACpD,gEAA+F;AAQ/F,wFAA+F;AAC/F,iFAA8F;AAC9F,8DAAoF;AACpF,8CAIuB;AACvB,sEAAoG;AACpG,0DAIkC;AAElC;;;GAGG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACjC,YACwD,OAA4B,EAC/B,WAAyB,EAC/B,MAA0B,EACpB,WAAoC,EAEtE,iBAAqC,EACT,iBAAqC;QAN5B,YAAO,GAAP,OAAO,CAAqB;QAC/B,gBAAW,GAAX,WAAW,CAAc;QAC/B,WAAM,GAAN,MAAM,CAAoB;QACp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