@monorise/core 1.0.0 → 1.0.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.
- package/package.json +1 -1
- package/tsconfig.json +1 -2
- package/dist/mock/container.d.ts +0 -3
- package/dist/mock/container.d.ts.map +0 -1
- package/dist/mock/container.js +0 -3
- package/dist/mock/container.js.map +0 -1
- package/dist/packages/core/configs/service.config.d.ts +0 -5
- package/dist/packages/core/configs/service.config.d.ts.map +0 -1
- package/dist/packages/core/configs/service.config.js +0 -5
- package/dist/packages/core/configs/service.config.js.map +0 -1
- package/dist/packages/core/constants/table.d.ts +0 -4
- package/dist/packages/core/constants/table.d.ts.map +0 -1
- package/dist/packages/core/constants/table.js +0 -4
- package/dist/packages/core/constants/table.js.map +0 -1
- package/dist/packages/core/controllers/entity/create-entity.controller.d.ts +0 -8
- package/dist/packages/core/controllers/entity/create-entity.controller.d.ts.map +0 -1
- package/dist/packages/core/controllers/entity/create-entity.controller.js +0 -44
- package/dist/packages/core/controllers/entity/create-entity.controller.js.map +0 -1
- package/dist/packages/core/controllers/entity/delete-entity.controller.d.ts +0 -8
- package/dist/packages/core/controllers/entity/delete-entity.controller.d.ts.map +0 -1
- package/dist/packages/core/controllers/entity/delete-entity.controller.js +0 -29
- package/dist/packages/core/controllers/entity/delete-entity.controller.js.map +0 -1
- package/dist/packages/core/controllers/entity/get-entity.controller.d.ts +0 -8
- package/dist/packages/core/controllers/entity/get-entity.controller.d.ts.map +0 -1
- package/dist/packages/core/controllers/entity/get-entity.controller.js +0 -24
- package/dist/packages/core/controllers/entity/get-entity.controller.js.map +0 -1
- package/dist/packages/core/controllers/entity/list-entities.controller.d.ts +0 -8
- package/dist/packages/core/controllers/entity/list-entities.controller.d.ts.map +0 -1
- package/dist/packages/core/controllers/entity/list-entities.controller.js +0 -56
- package/dist/packages/core/controllers/entity/list-entities.controller.js.map +0 -1
- package/dist/packages/core/controllers/entity/update-entity.controller.d.ts +0 -8
- package/dist/packages/core/controllers/entity/update-entity.controller.d.ts.map +0 -1
- package/dist/packages/core/controllers/entity/update-entity.controller.js +0 -45
- package/dist/packages/core/controllers/entity/update-entity.controller.js.map +0 -1
- package/dist/packages/core/controllers/entity/upsert-entity.controller.d.ts +0 -10
- package/dist/packages/core/controllers/entity/upsert-entity.controller.d.ts.map +0 -1
- package/dist/packages/core/controllers/entity/upsert-entity.controller.js +0 -73
- package/dist/packages/core/controllers/entity/upsert-entity.controller.js.map +0 -1
- package/dist/packages/core/controllers/mutual/create-mutual.controller.d.ts +0 -10
- package/dist/packages/core/controllers/mutual/create-mutual.controller.d.ts.map +0 -1
- package/dist/packages/core/controllers/mutual/create-mutual.controller.js +0 -70
- package/dist/packages/core/controllers/mutual/create-mutual.controller.js.map +0 -1
- package/dist/packages/core/controllers/mutual/delete-mutual.controller.d.ts +0 -8
- package/dist/packages/core/controllers/mutual/delete-mutual.controller.d.ts.map +0 -1
- package/dist/packages/core/controllers/mutual/delete-mutual.controller.js +0 -31
- package/dist/packages/core/controllers/mutual/delete-mutual.controller.js.map +0 -1
- package/dist/packages/core/controllers/mutual/get-mutual.controller.d.ts +0 -8
- package/dist/packages/core/controllers/mutual/get-mutual.controller.d.ts.map +0 -1
- package/dist/packages/core/controllers/mutual/get-mutual.controller.js +0 -24
- package/dist/packages/core/controllers/mutual/get-mutual.controller.js.map +0 -1
- package/dist/packages/core/controllers/mutual/list-entities-by-entity.controller.d.ts +0 -8
- package/dist/packages/core/controllers/mutual/list-entities-by-entity.controller.d.ts.map +0 -1
- package/dist/packages/core/controllers/mutual/list-entities-by-entity.controller.js +0 -56
- package/dist/packages/core/controllers/mutual/list-entities-by-entity.controller.js.map +0 -1
- package/dist/packages/core/controllers/mutual/update-mutual.controller.d.ts +0 -8
- package/dist/packages/core/controllers/mutual/update-mutual.controller.d.ts.map +0 -1
- package/dist/packages/core/controllers/mutual/update-mutual.controller.js +0 -40
- package/dist/packages/core/controllers/mutual/update-mutual.controller.js.map +0 -1
- package/dist/packages/core/controllers/setupRoutes.d.ts +0 -3
- package/dist/packages/core/controllers/setupRoutes.d.ts.map +0 -1
- package/dist/packages/core/controllers/setupRoutes.js +0 -33
- package/dist/packages/core/controllers/setupRoutes.js.map +0 -1
- package/dist/packages/core/controllers/tag/list-tags.controller.d.ts +0 -8
- package/dist/packages/core/controllers/tag/list-tags.controller.d.ts.map +0 -1
- package/dist/packages/core/controllers/tag/list-tags.controller.js +0 -48
- package/dist/packages/core/controllers/tag/list-tags.controller.js.map +0 -1
- package/dist/packages/core/data/DbUtils.d.ts +0 -7
- package/dist/packages/core/data/DbUtils.d.ts.map +0 -1
- package/dist/packages/core/data/DbUtils.js +0 -23
- package/dist/packages/core/data/DbUtils.js.map +0 -1
- package/dist/packages/core/data/Entity.d.ts +0 -71
- package/dist/packages/core/data/Entity.d.ts.map +0 -1
- package/dist/packages/core/data/Entity.js +0 -358
- package/dist/packages/core/data/Entity.js.map +0 -1
- package/dist/packages/core/data/EventUtils.d.ts +0 -14
- package/dist/packages/core/data/EventUtils.d.ts.map +0 -1
- package/dist/packages/core/data/EventUtils.js +0 -34
- package/dist/packages/core/data/EventUtils.js.map +0 -1
- package/dist/packages/core/data/FileObject.d.ts +0 -62
- package/dist/packages/core/data/FileObject.d.ts.map +0 -1
- package/dist/packages/core/data/FileObject.js +0 -13
- package/dist/packages/core/data/FileObject.js.map +0 -1
- package/dist/packages/core/data/Mutual.d.ts +0 -94
- package/dist/packages/core/data/Mutual.d.ts.map +0 -1
- package/dist/packages/core/data/Mutual.js +0 -492
- package/dist/packages/core/data/Mutual.js.map +0 -1
- package/dist/packages/core/data/ProjectionExpression.d.ts +0 -6
- package/dist/packages/core/data/ProjectionExpression.d.ts.map +0 -1
- package/dist/packages/core/data/ProjectionExpression.js +0 -5
- package/dist/packages/core/data/ProjectionExpression.js.map +0 -1
- package/dist/packages/core/data/Tag.d.ts +0 -77
- package/dist/packages/core/data/Tag.d.ts.map +0 -1
- package/dist/packages/core/data/Tag.js +0 -330
- package/dist/packages/core/data/Tag.js.map +0 -1
- package/dist/packages/core/data/abstract/Item.base.d.ts +0 -11
- package/dist/packages/core/data/abstract/Item.base.d.ts.map +0 -1
- package/dist/packages/core/data/abstract/Item.base.js +0 -9
- package/dist/packages/core/data/abstract/Item.base.js.map +0 -1
- package/dist/packages/core/data/abstract/Repository.base.d.ts +0 -11
- package/dist/packages/core/data/abstract/Repository.base.d.ts.map +0 -1
- package/dist/packages/core/data/abstract/Repository.base.js +0 -54
- package/dist/packages/core/data/abstract/Repository.base.js.map +0 -1
- package/dist/packages/core/errors/api-error.d.ts +0 -23
- package/dist/packages/core/errors/api-error.d.ts.map +0 -1
- package/dist/packages/core/errors/api-error.js +0 -26
- package/dist/packages/core/errors/api-error.js.map +0 -1
- package/dist/packages/core/errors/extendable-error.d.ts +0 -18
- package/dist/packages/core/errors/extendable-error.d.ts.map +0 -1
- package/dist/packages/core/errors/extendable-error.js +0 -22
- package/dist/packages/core/errors/extendable-error.js.map +0 -1
- package/dist/packages/core/errors/standard-error.d.ts +0 -11
- package/dist/packages/core/errors/standard-error.d.ts.map +0 -1
- package/dist/packages/core/errors/standard-error.js +0 -21
- package/dist/packages/core/errors/standard-error.js.map +0 -1
- package/dist/packages/core/helpers/dependencies.d.ts +0 -8
- package/dist/packages/core/helpers/dependencies.d.ts.map +0 -1
- package/dist/packages/core/helpers/dependencies.js +0 -10
- package/dist/packages/core/helpers/dependencies.js.map +0 -1
- package/dist/packages/core/helpers/event.d.ts +0 -22
- package/dist/packages/core/helpers/event.d.ts.map +0 -1
- package/dist/packages/core/helpers/event.js +0 -47
- package/dist/packages/core/helpers/event.js.map +0 -1
- package/dist/packages/core/helpers/fromLastKeyQuery.d.ts +0 -3
- package/dist/packages/core/helpers/fromLastKeyQuery.d.ts.map +0 -1
- package/dist/packages/core/helpers/fromLastKeyQuery.js +0 -7
- package/dist/packages/core/helpers/fromLastKeyQuery.js.map +0 -1
- package/dist/packages/core/helpers/sleep.d.ts +0 -2
- package/dist/packages/core/helpers/sleep.d.ts.map +0 -1
- package/dist/packages/core/helpers/sleep.js +0 -2
- package/dist/packages/core/helpers/sleep.js.map +0 -1
- package/dist/packages/core/helpers/toLastKeyResponse.d.ts +0 -3
- package/dist/packages/core/helpers/toLastKeyResponse.d.ts.map +0 -1
- package/dist/packages/core/helpers/toLastKeyResponse.js +0 -7
- package/dist/packages/core/helpers/toLastKeyResponse.js.map +0 -1
- package/dist/packages/core/index.d.ts +0 -12
- package/dist/packages/core/index.d.ts.map +0 -1
- package/dist/packages/core/index.js +0 -12
- package/dist/packages/core/index.js.map +0 -1
- package/dist/packages/core/middlewares/entity-type-check.d.ts +0 -3
- package/dist/packages/core/middlewares/entity-type-check.d.ts.map +0 -1
- package/dist/packages/core/middlewares/entity-type-check.js +0 -12
- package/dist/packages/core/middlewares/entity-type-check.js.map +0 -1
- package/dist/packages/core/middlewares/mutual-type-check.d.ts +0 -3
- package/dist/packages/core/middlewares/mutual-type-check.d.ts.map +0 -1
- package/dist/packages/core/middlewares/mutual-type-check.js +0 -13
- package/dist/packages/core/middlewares/mutual-type-check.js.map +0 -1
- package/dist/packages/core/mock/container.d.ts +0 -3
- package/dist/packages/core/mock/container.d.ts.map +0 -1
- package/dist/packages/core/mock/container.js +0 -3
- package/dist/packages/core/mock/container.js.map +0 -1
- package/dist/packages/core/mock/entity.d.ts +0 -13
- package/dist/packages/core/mock/entity.d.ts.map +0 -1
- package/dist/packages/core/mock/entity.js +0 -14
- package/dist/packages/core/mock/entity.js.map +0 -1
- package/dist/packages/core/mock/monorise/admin.d.ts +0 -127
- package/dist/packages/core/mock/monorise/admin.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/admin.js +0 -29
- package/dist/packages/core/mock/monorise/admin.js.map +0 -1
- package/dist/packages/core/mock/monorise/audio.d.ts +0 -324
- package/dist/packages/core/mock/monorise/audio.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/audio.js +0 -32
- package/dist/packages/core/mock/monorise/audio.js.map +0 -1
- package/dist/packages/core/mock/monorise/chapter.d.ts +0 -457
- package/dist/packages/core/mock/monorise/chapter.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/chapter.js +0 -81
- package/dist/packages/core/mock/monorise/chapter.js.map +0 -1
- package/dist/packages/core/mock/monorise/cohort-track.d.ts +0 -118
- package/dist/packages/core/mock/monorise/cohort-track.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/cohort-track.js +0 -38
- package/dist/packages/core/mock/monorise/cohort-track.js.map +0 -1
- package/dist/packages/core/mock/monorise/course-banner.d.ts +0 -149
- package/dist/packages/core/mock/monorise/course-banner.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/course-banner.js +0 -24
- package/dist/packages/core/mock/monorise/course-banner.js.map +0 -1
- package/dist/packages/core/mock/monorise/course.d.ts +0 -311
- package/dist/packages/core/mock/monorise/course.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/course.js +0 -128
- package/dist/packages/core/mock/monorise/course.js.map +0 -1
- package/dist/packages/core/mock/monorise/expert.d.ts +0 -380
- package/dist/packages/core/mock/monorise/expert.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/expert.js +0 -32
- package/dist/packages/core/mock/monorise/expert.js.map +0 -1
- package/dist/packages/core/mock/monorise/index.d.ts +0 -3599
- package/dist/packages/core/mock/monorise/index.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/index.js +0 -62
- package/dist/packages/core/mock/monorise/index.js.map +0 -1
- package/dist/packages/core/mock/monorise/learner-video-progress.d.ts +0 -198
- package/dist/packages/core/mock/monorise/learner-video-progress.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/learner-video-progress.js +0 -21
- package/dist/packages/core/mock/monorise/learner-video-progress.js.map +0 -1
- package/dist/packages/core/mock/monorise/learner.d.ts +0 -390
- package/dist/packages/core/mock/monorise/learner.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/learner.js +0 -59
- package/dist/packages/core/mock/monorise/learner.js.map +0 -1
- package/dist/packages/core/mock/monorise/learning-activity-submission.d.ts +0 -160
- package/dist/packages/core/mock/monorise/learning-activity-submission.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/learning-activity-submission.js +0 -17
- package/dist/packages/core/mock/monorise/learning-activity-submission.js.map +0 -1
- package/dist/packages/core/mock/monorise/learning-activity.d.ts +0 -266
- package/dist/packages/core/mock/monorise/learning-activity.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/learning-activity.js +0 -50
- package/dist/packages/core/mock/monorise/learning-activity.js.map +0 -1
- package/dist/packages/core/mock/monorise/learning-journey-config.d.ts +0 -84
- package/dist/packages/core/mock/monorise/learning-journey-config.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/learning-journey-config.js +0 -27
- package/dist/packages/core/mock/monorise/learning-journey-config.js.map +0 -1
- package/dist/packages/core/mock/monorise/learning-journey-progress.d.ts +0 -290
- package/dist/packages/core/mock/monorise/learning-journey-progress.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/learning-journey-progress.js +0 -46
- package/dist/packages/core/mock/monorise/learning-journey-progress.js.map +0 -1
- package/dist/packages/core/mock/monorise/module.d.ts +0 -211
- package/dist/packages/core/mock/monorise/module.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/module.js +0 -91
- package/dist/packages/core/mock/monorise/module.js.map +0 -1
- package/dist/packages/core/mock/monorise/organization.d.ts +0 -346
- package/dist/packages/core/mock/monorise/organization.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/organization.js +0 -54
- package/dist/packages/core/mock/monorise/organization.js.map +0 -1
- package/dist/packages/core/mock/monorise/pathway.d.ts +0 -267
- package/dist/packages/core/mock/monorise/pathway.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/pathway.js +0 -221
- package/dist/packages/core/mock/monorise/pathway.js.map +0 -1
- package/dist/packages/core/mock/monorise/phase.d.ts +0 -580
- package/dist/packages/core/mock/monorise/phase.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/phase.js +0 -166
- package/dist/packages/core/mock/monorise/phase.js.map +0 -1
- package/dist/packages/core/mock/monorise/reference.d.ts +0 -171
- package/dist/packages/core/mock/monorise/reference.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/reference.js +0 -25
- package/dist/packages/core/mock/monorise/reference.js.map +0 -1
- package/dist/packages/core/mock/monorise/track.d.ts +0 -617
- package/dist/packages/core/mock/monorise/track.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/track.js +0 -270
- package/dist/packages/core/mock/monorise/track.js.map +0 -1
- package/dist/packages/core/mock/monorise/video.d.ts +0 -346
- package/dist/packages/core/mock/monorise/video.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise/video.js +0 -33
- package/dist/packages/core/mock/monorise/video.js.map +0 -1
- package/dist/packages/core/mock/monorise.d.ts +0 -6
- package/dist/packages/core/mock/monorise.d.ts.map +0 -1
- package/dist/packages/core/mock/monorise.js +0 -5
- package/dist/packages/core/mock/monorise.js.map +0 -1
- package/dist/packages/core/processors/create-entity-processor.d.ts +0 -5
- package/dist/packages/core/processors/create-entity-processor.d.ts.map +0 -1
- package/dist/packages/core/processors/create-entity-processor.js +0 -32
- package/dist/packages/core/processors/create-entity-processor.js.map +0 -1
- package/dist/packages/core/processors/mutual-processor.d.ts +0 -15
- package/dist/packages/core/processors/mutual-processor.d.ts.map +0 -1
- package/dist/packages/core/processors/mutual-processor.js +0 -128
- package/dist/packages/core/processors/mutual-processor.js.map +0 -1
- package/dist/packages/core/processors/prejoin-processor.d.ts +0 -12
- package/dist/packages/core/processors/prejoin-processor.d.ts.map +0 -1
- package/dist/packages/core/processors/prejoin-processor.js +0 -150
- package/dist/packages/core/processors/prejoin-processor.js.map +0 -1
- package/dist/packages/core/processors/replication-processor.d.ts +0 -8
- package/dist/packages/core/processors/replication-processor.d.ts.map +0 -1
- package/dist/packages/core/processors/replication-processor.js +0 -180
- package/dist/packages/core/processors/replication-processor.js.map +0 -1
- package/dist/packages/core/processors/tag-processor.d.ts +0 -11
- package/dist/packages/core/processors/tag-processor.d.ts.map +0 -1
- package/dist/packages/core/processors/tag-processor.js +0 -106
- package/dist/packages/core/processors/tag-processor.js.map +0 -1
- package/dist/packages/core/services/DependencyContainer.d.ts +0 -51
- package/dist/packages/core/services/DependencyContainer.d.ts.map +0 -1
- package/dist/packages/core/services/DependencyContainer.js +0 -115
- package/dist/packages/core/services/DependencyContainer.js.map +0 -1
- package/dist/packages/core/services/entity-service-lifecycle.d.ts +0 -12
- package/dist/packages/core/services/entity-service-lifecycle.d.ts.map +0 -1
- package/dist/packages/core/services/entity-service-lifecycle.js +0 -23
- package/dist/packages/core/services/entity-service-lifecycle.js.map +0 -1
- package/dist/packages/core/services/entity.service.d.ts +0 -32
- package/dist/packages/core/services/entity.service.d.ts.map +0 -1
- package/dist/packages/core/services/entity.service.js +0 -121
- package/dist/packages/core/services/entity.service.js.map +0 -1
- package/dist/packages/core/services/mutual.service.d.ts +0 -64
- package/dist/packages/core/services/mutual.service.d.ts.map +0 -1
- package/dist/packages/core/services/mutual.service.js +0 -144
- package/dist/packages/core/services/mutual.service.js.map +0 -1
- package/dist/packages/core/types/entity.type.d.ts +0 -20
- package/dist/packages/core/types/entity.type.d.ts.map +0 -1
- package/dist/packages/core/types/entity.type.js +0 -2
- package/dist/packages/core/types/entity.type.js.map +0 -1
- package/dist/shared/types/event.d.ts +0 -72
- package/dist/shared/types/event.d.ts.map +0 -1
- package/dist/shared/types/event.js +0 -74
- package/dist/shared/types/event.js.map +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Request, Response } from 'express';
|
|
2
|
-
import type { MutualRepository } from '#/data/Mutual';
|
|
3
|
-
export declare class GetMutualController {
|
|
4
|
-
private associateRepository;
|
|
5
|
-
constructor(associateRepository: MutualRepository);
|
|
6
|
-
controller: (req: Request, res: Response) => void;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=get-mutual.controller.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-mutual.controller.d.ts","sourceRoot":"","sources":["../../../../../controllers/mutual/get-mutual.controller.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,qBAAa,mBAAmB;IAClB,OAAO,CAAC,mBAAmB;gBAAnB,mBAAmB,EAAE,gBAAgB;IAEzD,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CA4B/C;CACH"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
export class GetMutualController {
|
|
3
|
-
associateRepository;
|
|
4
|
-
constructor(associateRepository) {
|
|
5
|
-
this.associateRepository = associateRepository;
|
|
6
|
-
}
|
|
7
|
-
controller = async (req, res) => {
|
|
8
|
-
const { byEntityType, byEntityId, entityType, entityId } = req.params;
|
|
9
|
-
try {
|
|
10
|
-
const associate = await this.associateRepository.getMutual(byEntityType, byEntityId, entityType, entityId);
|
|
11
|
-
return res.status(httpStatus.OK).json(associate);
|
|
12
|
-
}
|
|
13
|
-
catch (err) {
|
|
14
|
-
if (err.code === 'MUTUAL_IS_UNDEFINED') {
|
|
15
|
-
return res.status(httpStatus.NOT_FOUND).json({
|
|
16
|
-
code: 'MUTUAL_NOT_FOUND',
|
|
17
|
-
message: 'Mutual not found',
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
throw err;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=get-mutual.controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-mutual.controller.js","sourceRoot":"","sources":["../../../../../controllers/mutual/get-mutual.controller.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,aAAa,CAAC;AAGrC,MAAM,OAAO,mBAAmB;IACV;IAApB,YAAoB,mBAAqC;QAArC,wBAAmB,GAAnB,mBAAmB,CAAkB;IAAG,CAAC;IAE7D,UAAU,GAA0C,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QACrE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,GACtD,GAAG,CAAC,MAKH,CAAC;QAEJ,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,SAAS,CACxD,YAAY,EACZ,UAAU,EACV,UAAU,EACV,QAAQ,CACT,CAAC;YAEF,OAAO,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAK,GAAW,CAAC,IAAI,KAAK,qBAAqB,EAAE,CAAC;gBAChD,OAAO,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;oBAC3C,IAAI,EAAE,kBAAkB;oBACxB,OAAO,EAAE,kBAAkB;iBAC5B,CAAC,CAAC;YACL,CAAC;YAED,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC,CAAC;CACH"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Request, Response } from 'express';
|
|
2
|
-
import type { MutualRepository } from '#/data/Mutual';
|
|
3
|
-
export declare class ListEntitiesByEntityController {
|
|
4
|
-
private associateRepository;
|
|
5
|
-
constructor(associateRepository: MutualRepository);
|
|
6
|
-
controller: (req: Request, res: Response) => void;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=list-entities-by-entity.controller.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-entities-by-entity.controller.d.ts","sourceRoot":"","sources":["../../../../../controllers/mutual/list-entities-by-entity.controller.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGjD,OAAO,KAAK,EAAU,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9D,qBAAa,8BAA8B;IAC7B,OAAO,CAAC,mBAAmB;gBAAnB,mBAAmB,EAAE,gBAAgB;IAEzD,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAiE/C;CACH"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export class ListEntitiesByEntityController {
|
|
4
|
-
associateRepository;
|
|
5
|
-
constructor(associateRepository) {
|
|
6
|
-
this.associateRepository = associateRepository;
|
|
7
|
-
}
|
|
8
|
-
controller = async (req, res) => {
|
|
9
|
-
const { byEntityType, byEntityId, entityType } = req.params;
|
|
10
|
-
/**
|
|
11
|
-
* Chain query is a query that allows to query entities by a chain of mutual types.
|
|
12
|
-
* if /core/mutual/learner/:learnerId/pathways?chainEntityQuery=type1,type2
|
|
13
|
-
* then the query will look for list of type1 in learner based on learnerId,
|
|
14
|
-
* then look for list of type2 in type1 by list of entityId of type1,
|
|
15
|
-
* then finally look for list of pathways in type2 by list of entityId of type2.
|
|
16
|
-
*/
|
|
17
|
-
const querySchema = z.object({
|
|
18
|
-
chainEntityQuery: z.string().optional(),
|
|
19
|
-
});
|
|
20
|
-
const queryParam = querySchema.parse(req.query);
|
|
21
|
-
if (queryParam?.chainEntityQuery) {
|
|
22
|
-
try {
|
|
23
|
-
const mutualTypes = queryParam.chainEntityQuery.split(',');
|
|
24
|
-
const chainMutualTypes = [byEntityType, ...mutualTypes, entityType];
|
|
25
|
-
let byIds = [byEntityId];
|
|
26
|
-
let items = [];
|
|
27
|
-
for (let i = 1; i < chainMutualTypes.length; i++) {
|
|
28
|
-
const byType = chainMutualTypes[i - 1];
|
|
29
|
-
const type = chainMutualTypes[i];
|
|
30
|
-
items = [];
|
|
31
|
-
for (const byId of byIds) {
|
|
32
|
-
const resp = await this.associateRepository.listEntitiesByEntity(byType, byId, type);
|
|
33
|
-
items = items.concat(resp.items);
|
|
34
|
-
}
|
|
35
|
-
byIds = items.map((item) => item.entityId);
|
|
36
|
-
}
|
|
37
|
-
return res.json({
|
|
38
|
-
entities: items,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
return res.status(httpStatus.BAD_REQUEST).json({
|
|
43
|
-
code: 'INVALID_CHAIN_QUERY',
|
|
44
|
-
message: 'Chain query is invalid. Please double check the chainEntityQuery param',
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
const resp = await this.associateRepository.listEntitiesByEntity(byEntityType, byEntityId, entityType);
|
|
50
|
-
return res.json({
|
|
51
|
-
entities: resp.items,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=list-entities-by-entity.controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-entities-by-entity.controller.js","sourceRoot":"","sources":["../../../../../controllers/mutual/list-entities-by-entity.controller.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,OAAO,8BAA8B;IACrB;IAApB,YAAoB,mBAAqC;QAArC,wBAAmB,GAAnB,mBAAmB,CAAkB;IAAG,CAAC;IAE7D,UAAU,GAA0C,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QACrE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,MAIpD,CAAC;QAEF;;;;;;WAMG;QACH,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;YAC3B,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ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C,IAAI,CAAC;oBAC7C,IAAI,EAAE,qBAAqB;oBAC3B,OAAO,EACL,wEAAwE;iBAC3E,CAAC,CAAC;YACL,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,CAC9D,YAAY,EACZ,UAAU,EACV,UAAU,CACX,CAAC;YAEF,OAAO,GAAG,CAAC,IAAI,CAAC;gBACd,QAAQ,EAAE,IAAI,CAAC,KAAK;aACrB,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;CACH"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Request, Response } from 'express';
|
|
2
|
-
import type { MutualService } from '#/services/mutual.service';
|
|
3
|
-
export declare class UpdateMutualController {
|
|
4
|
-
private mutualService;
|
|
5
|
-
constructor(mutualService: MutualService);
|
|
6
|
-
controller: (req: Request, res: Response) => void;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=update-mutual.controller.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-mutual.controller.d.ts","sourceRoot":"","sources":["../../../../../controllers/mutual/update-mutual.controller.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,qBAAa,sBAAsB;IACrB,OAAO,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAEhD,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAsC/C;CACH"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { ZodError } from 'zod';
|
|
3
|
-
import { StandardError } from '#/errors/standard-error';
|
|
4
|
-
export class UpdateMutualController {
|
|
5
|
-
mutualService;
|
|
6
|
-
constructor(mutualService) {
|
|
7
|
-
this.mutualService = mutualService;
|
|
8
|
-
}
|
|
9
|
-
controller = async (req, res) => {
|
|
10
|
-
const accountId = req.headers['account-id'];
|
|
11
|
-
const { byEntityType, byEntityId, entityType, entityId } = req.params;
|
|
12
|
-
try {
|
|
13
|
-
const mutual = await this.mutualService.updateMutual({
|
|
14
|
-
byEntityType,
|
|
15
|
-
byEntityId,
|
|
16
|
-
entityType,
|
|
17
|
-
entityId,
|
|
18
|
-
mutualPayload: req.body,
|
|
19
|
-
accountId,
|
|
20
|
-
});
|
|
21
|
-
return res.status(httpStatus.OK).json(mutual);
|
|
22
|
-
}
|
|
23
|
-
catch (err) {
|
|
24
|
-
if (err instanceof ZodError) {
|
|
25
|
-
return res.status(httpStatus.BAD_REQUEST).json({
|
|
26
|
-
code: 'API_VALIDATION_ERROR',
|
|
27
|
-
message: 'API validation failed',
|
|
28
|
-
details: err.flatten(),
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
if (err instanceof StandardError && err.code === 'MUTUAL_NOT_FOUND') {
|
|
32
|
-
return res.status(httpStatus.BAD_REQUEST).json({
|
|
33
|
-
...err.toJSON(),
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
throw err;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=update-mutual.controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-mutual.controller.js","sourceRoot":"","sources":["../../../../../controllers/mutual/update-mutual.controller.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,MAAM,OAAO,sBAAsB;IACb;IAApB,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAEpD,UAAU,GAA0C,KAAK,EAAE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AM,KAAG,IAiE9C,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Router } from 'express';
|
|
2
|
-
import { DependencyContainer } from '#/services/DependencyContainer';
|
|
3
|
-
import { entityTypeCheck } from '../middlewares/entity-type-check';
|
|
4
|
-
import { mutualTypeCheck } from '../middlewares/mutual-type-check';
|
|
5
|
-
const router = Router();
|
|
6
|
-
const setupCommonRoutes = (tableName) => {
|
|
7
|
-
/*
|
|
8
|
-
* Mutual endpoint
|
|
9
|
-
*/
|
|
10
|
-
const container = new DependencyContainer(tableName);
|
|
11
|
-
router.use('/mutual/:byEntityType/:byEntityId/:entityType', mutualTypeCheck);
|
|
12
|
-
router.get('/mutual/:byEntityType/:byEntityId/:entityType', container.listEntitiesByEntityController.controller);
|
|
13
|
-
router.post('/mutual/:byEntityType/:byEntityId/:entityType/:entityId', container.createMutualController.controller);
|
|
14
|
-
router.get('/mutual/:byEntityType/:byEntityId/:entityType/:entityId', container.getMutualController.controller);
|
|
15
|
-
router.patch('/mutual/:byEntityType/:byEntityId/:entityType/:entityId', container.updateMutualController.controller);
|
|
16
|
-
router.delete('/mutual/:byEntityType/:byEntityId/:entityType/:entityId', container.deleteMutualController.controller);
|
|
17
|
-
/*
|
|
18
|
-
* Entities endpoint
|
|
19
|
-
*/
|
|
20
|
-
router.use('/entity/:entityType', entityTypeCheck);
|
|
21
|
-
router.get('/entity/:entityType', container.listEntitiesController.controller);
|
|
22
|
-
router.post('/entity/:entityType', container.createEntityController.controller);
|
|
23
|
-
router.get('/entity/:entityType/:entityId', container.getEntityController.controller);
|
|
24
|
-
router.put('/entity/:entityType/:entityId', container.upsertEntityController.controller);
|
|
25
|
-
router.patch('/entity/:entityType/:entityId', container.updateEntityController.controller);
|
|
26
|
-
router.delete('/entity/:entityType/:entityId', container.deleteEntityController.controller);
|
|
27
|
-
/*
|
|
28
|
-
* Tag endpoint
|
|
29
|
-
*/
|
|
30
|
-
router.get('/tag/:entityType/:tagName', container.listTagsController.controller);
|
|
31
|
-
};
|
|
32
|
-
export { setupCommonRoutes };
|
|
33
|
-
//# sourceMappingURL=setupRoutes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupRoutes.js","sourceRoot":"","sources":["../../../../controllers/setupRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;AAExB,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAQ,EAAE;IACpD;;OAEG;IACH,MAAM,SAAS,GAAG,IAAI,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAErD,MAAM,CAAC,GAAG,CAAC,+CAA+C,EAAE,eAAe,CAAC,CAAC;IAC7E,MAAM,CAAC,GAAG,CACR,+CAA+C,EAC/C,SAAS,CAAC,8BAA8B,CAAC,UAAU,CACpD,CAAC;IACF,MAAM,CAAC,IAAI,CACT,yDAAyD,EACzD,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAC5C,CAAC;IACF,MAAM,CAAC,GAAG,CACR,yDAAyD,EACzD,SAAS,CAAC,mBAAmB,CAAC,UAAU,CACzC,CAAC;IACF,MAAM,CAAC,KAAK,CACV,yDAAyD,EACzD,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAC5C,CAAC;IACF,MAAM,CAAC,MAAM,CACX,yDAAyD,EACzD,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAC5C,CAAC;IAEF;;OAEG;IAEH,MAAM,CAAC,GAAG,CAAC,qBAAqB,EAAE,eAAe,CAAC,CAAC;IACnD,MAAM,CAAC,GAAG,CACR,qBAAqB,EACrB,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAC5C,CAAC;IACF,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAC5C,CAAC;IACF,MAAM,CAAC,GAAG,CACR,+BAA+B,EAC/B,SAAS,CAAC,mBAAmB,CAAC,UAAU,CACzC,CAAC;IACF,MAAM,CAAC,GAAG,CACR,+BAA+B,EAC/B,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAC5C,CAAC;IACF,MAAM,CAAC,KAAK,CACV,+BAA+B,EAC/B,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAC5C,CAAC;IACF,MAAM,CAAC,MAAM,CACX,+BAA+B,EAC/B,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAC5C,CAAC;IAEF;;OAEG;IACH,MAAM,CAAC,GAAG,CACR,2BAA2B,EAC3B,SAAS,CAAC,kBAAkB,CAAC,UAAU,CACxC,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Request, Response } from 'express';
|
|
2
|
-
import type { TagRepository } from '#/data/Tag';
|
|
3
|
-
export declare class ListTagsController {
|
|
4
|
-
private tagRepository;
|
|
5
|
-
constructor(tagRepository: TagRepository);
|
|
6
|
-
controller: (req: Request, res: Response) => void;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=list-tags.controller.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-tags.controller.d.ts","sourceRoot":"","sources":["../../../../../controllers/tag/list-tags.controller.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAahD,qBAAa,kBAAkB;IACjB,OAAO,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAEhD,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,KAAK,IAAI,CAoC/C;CACH"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { fromLastKeyQuery } from '#/helpers/fromLastKeyQuery';
|
|
3
|
-
import { toLastKeyResponse } from '#/helpers/toLastKeyResponse';
|
|
4
|
-
const querySchema = z.object({
|
|
5
|
-
group: z.string().optional(),
|
|
6
|
-
query: z.string().optional(),
|
|
7
|
-
start: z.string().optional(),
|
|
8
|
-
end: z.string().optional(),
|
|
9
|
-
limit: z.string().optional(),
|
|
10
|
-
lastKey: z.string().optional(),
|
|
11
|
-
});
|
|
12
|
-
export class ListTagsController {
|
|
13
|
-
tagRepository;
|
|
14
|
-
constructor(tagRepository) {
|
|
15
|
-
this.tagRepository = tagRepository;
|
|
16
|
-
}
|
|
17
|
-
controller = async (req, res) => {
|
|
18
|
-
const errorContext = {};
|
|
19
|
-
try {
|
|
20
|
-
errorContext.params = req.params;
|
|
21
|
-
errorContext.query = req.query;
|
|
22
|
-
const { entityType, tagName } = req.params;
|
|
23
|
-
const { lastKey, query, limit, start, end, group } = querySchema.parse(req.query);
|
|
24
|
-
const results = await this.tagRepository.listTags({
|
|
25
|
-
entityType,
|
|
26
|
-
tagName,
|
|
27
|
-
limit: Number(limit),
|
|
28
|
-
options: {
|
|
29
|
-
lastKey: fromLastKeyQuery(lastKey),
|
|
30
|
-
},
|
|
31
|
-
query,
|
|
32
|
-
group,
|
|
33
|
-
start,
|
|
34
|
-
end,
|
|
35
|
-
});
|
|
36
|
-
return res.json({
|
|
37
|
-
entities: results.items.map((item) => item.toJSON()),
|
|
38
|
-
totalCount: results.totalCount,
|
|
39
|
-
lastKey: toLastKeyResponse(results.lastKey),
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
console.log({ error, errorContext });
|
|
44
|
-
return res.status(500).json({ message: error });
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=list-tags.controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-tags.controller.js","sourceRoot":"","sources":["../../../../../controllers/tag/list-tags.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,OAAO,kBAAkB;IACT;IAApB,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAEpD,UAAU,GAA0C,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QACrE,MAAM,YAAY,GAA4B,EAAE,CAAC;QACjD,IAAI,CAAC;YACH,YAAY,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;YACjC,YAAY,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;YAE/B,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,MAGnC,CAAC;YAEF,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC,KAAK,CACpE,GAAG,CAAC,KAAK,CACV,CAAC;YAEF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC;gBAChD,UAAU;gBACV,OAAO;gBACP,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;gBACpB,OAAO,EAAE;oBACP,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;iBACnC;gBACD,KAAK;gBACL,KAAK;gBACL,KAAK;gBACL,GAAG;aACJ,CAAC,CAAC;YACH,OAAO,GAAG,CAAC,IAAI,CAAC;gBACd,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACpD,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC;aAC5C,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;YACrC,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAClD,CAAC;IACH,CAAC,CAAC;CACH"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type DynamoDB, type TransactWriteItemsInput } from '@aws-sdk/client-dynamodb';
|
|
2
|
-
export declare class DbUtils {
|
|
3
|
-
private ddbClient;
|
|
4
|
-
constructor(ddbClient: DynamoDB);
|
|
5
|
-
executeTransactWrite(params: TransactWriteItemsInput): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=DbUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DbUtils.d.ts","sourceRoot":"","sources":["../../../../data/DbUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,uBAAuB,EAE7B,MAAM,0BAA0B,CAAC;AAGlC,qBAAa,OAAO;IACN,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,QAAQ;IAEjC,oBAAoB,CAAC,MAAM,EAAE,uBAAuB;CA4B3D"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BatchStatementErrorCodeEnum, TransactionCanceledException, } from '@aws-sdk/client-dynamodb';
|
|
2
|
-
import { StandardError } from '#/errors/standard-error';
|
|
3
|
-
export class DbUtils {
|
|
4
|
-
ddbClient;
|
|
5
|
-
constructor(ddbClient) {
|
|
6
|
-
this.ddbClient = ddbClient;
|
|
7
|
-
}
|
|
8
|
-
async executeTransactWrite(params) {
|
|
9
|
-
try {
|
|
10
|
-
await this.ddbClient.transactWriteItems(params);
|
|
11
|
-
}
|
|
12
|
-
catch (err) {
|
|
13
|
-
if (err instanceof TransactionCanceledException) {
|
|
14
|
-
const hasConditionalCheckFailed = err.CancellationReasons?.some((reason) => reason.Code === BatchStatementErrorCodeEnum.ConditionalCheckFailed);
|
|
15
|
-
if (hasConditionalCheckFailed) {
|
|
16
|
-
throw new StandardError('CONDITIONAL_CHECK_FAILED', 'Failed to executeTransactWrite', err, { params });
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
throw new StandardError('TRANSACTION_FAILED', 'Failed to executeTransactWrite', err, { params });
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=DbUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DbUtils.js","sourceRoot":"","sources":["../../../../data/DbUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAG3B,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,OAAO,OAAO;IACE;IAApB,YAAoB,SAAmB;QAAnB,cAAS,GAAT,SAAS,CAAU;IAAG,CAAC;IAE3C,KAAK,CAAC,oBAAoB,CAAC,MAA+B;QACxD,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,4BAA4B,EAAE,CAAC;gBAChD,MAAM,yBAAyB,GAAG,GAAG,CAAC,mBAAmB,EAAE,IAAI,CAC7D,CAAC,MAAM,EAAE,EAAE,CACT,MAAM,CAAC,IAAI,KAAK,2BAA2B,CAAC,sBAAsB,CACrE,CAAC;gBAEF,IAAI,yBAAyB,EAAE,CAAC;oBAC9B,MAAM,IAAI,aAAa,CACrB,0BAA0B,EAC1B,gCAAgC,EAChC,GAAG,EACH,EAAE,MAAM,EAAE,CACX,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,MAAM,IAAI,aAAa,CACrB,oBAAoB,EACpB,gCAAgC,EAChC,GAAG,EACH,EAAE,MAAM,EAAE,CACX,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { type AttributeValue, type DynamoDB, type TransactWriteItem } from '@aws-sdk/client-dynamodb';
|
|
2
|
-
import type { EntitySchemaMap, Entity as EntityType } from '@monorise/base';
|
|
3
|
-
import type { ProjectionExpressionValues } from './ProjectionExpression';
|
|
4
|
-
import { Item } from './abstract/Item.base';
|
|
5
|
-
import { Repository } from './abstract/Repository.base';
|
|
6
|
-
export declare class Entity<T extends EntityType> extends Item {
|
|
7
|
-
entityType: T;
|
|
8
|
-
entityId?: string | undefined;
|
|
9
|
-
data: Partial<EntitySchemaMap[T]>;
|
|
10
|
-
private _createdAt?;
|
|
11
|
-
private _updatedAt?;
|
|
12
|
-
fullId: string;
|
|
13
|
-
constructor(entityType: T, entityId?: string | undefined, data?: Partial<EntitySchemaMap[T]>, _createdAt?: Date | undefined, _updatedAt?: Date | undefined);
|
|
14
|
-
static fromItem<T extends EntityType>(item?: Record<string, AttributeValue>): Entity<T>;
|
|
15
|
-
get pk(): string;
|
|
16
|
-
get sk(): string;
|
|
17
|
-
get listActionKey(): string;
|
|
18
|
-
get emailKeys(): Record<string, AttributeValue>;
|
|
19
|
-
get createdAt(): string | undefined;
|
|
20
|
-
get updatedAt(): string | undefined;
|
|
21
|
-
toItem(): Record<string, AttributeValue>;
|
|
22
|
-
toJSON(): Record<string, unknown>;
|
|
23
|
-
}
|
|
24
|
-
export declare class EntityRepository extends Repository {
|
|
25
|
-
private readonly TABLE_NAME;
|
|
26
|
-
private readonly dynamodbClient;
|
|
27
|
-
constructor(TABLE_NAME: string, dynamodbClient: DynamoDB);
|
|
28
|
-
listEntities<T extends EntityType>({ entityType, limit, // if this is not set, it will return all items
|
|
29
|
-
between, options, }: {
|
|
30
|
-
entityType: T;
|
|
31
|
-
limit?: number;
|
|
32
|
-
between?: {
|
|
33
|
-
start: string;
|
|
34
|
-
end: string;
|
|
35
|
-
};
|
|
36
|
-
options?: {
|
|
37
|
-
lastKey?: Record<string, AttributeValue>;
|
|
38
|
-
ProjectionExpression?: ProjectionExpressionValues;
|
|
39
|
-
};
|
|
40
|
-
}): Promise<{
|
|
41
|
-
items: Entity<T>[];
|
|
42
|
-
totalCount?: number;
|
|
43
|
-
lastKey?: Record<string, AttributeValue>;
|
|
44
|
-
}>;
|
|
45
|
-
getEntity<T extends EntityType>(entityType: T, entityId: string): Promise<Entity<T>>;
|
|
46
|
-
getEntityByEmail<T extends EntityType>(entityType: T, email: string): Promise<Entity<T>>;
|
|
47
|
-
getEmailAvailability<T extends EntityType>(entityType: T, email: string): Promise<void>;
|
|
48
|
-
createEntityTransactItems<T extends EntityType>(entity: Entity<T>, opts?: {
|
|
49
|
-
mutualId?: string;
|
|
50
|
-
}): TransactWriteItem[];
|
|
51
|
-
createEntity<T extends EntityType>(entityType: T, entityPayload: EntitySchemaMap[T], entityId?: string, opts?: {
|
|
52
|
-
createAndUpdateDatetime?: Date;
|
|
53
|
-
mutualId?: string;
|
|
54
|
-
}): Promise<Entity<T>>;
|
|
55
|
-
upsertEntity<T extends EntityType>(entityType: T, entityId: string, payload: Partial<EntitySchemaMap[T]>): Promise<Entity<T>>;
|
|
56
|
-
updateEntity<T extends EntityType>(entityType: T, entityId: string, toUpdate: {
|
|
57
|
-
data: Partial<EntitySchemaMap[T]>;
|
|
58
|
-
updatedAt?: string;
|
|
59
|
-
}, opts?: {
|
|
60
|
-
ConditionExpression: string;
|
|
61
|
-
ExpressionAttributeNames: Record<string, string>;
|
|
62
|
-
ExpressionAttributeValues: Record<string, AttributeValue>;
|
|
63
|
-
}): Promise<Entity<T>>;
|
|
64
|
-
deleteEntity<T extends EntityType>(entityType: T, entityId: string): Promise<void>;
|
|
65
|
-
queryEntities<T extends EntityType>(entityType: T, query: string): Promise<{
|
|
66
|
-
items: Entity<T>[];
|
|
67
|
-
totalCount?: number;
|
|
68
|
-
filteredCount?: number;
|
|
69
|
-
}>;
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=Entity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../../data/Entity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,QAAQ,EAEb,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAO5E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,qBAAa,MAAM,CAAC,CAAC,SAAS,UAAU,C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