@monorise/core 1.0.0 → 1.0.2
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/controllers/entity/create-entity.controller.ts +2 -2
- package/controllers/entity/delete-entity.controller.ts +2 -2
- package/controllers/entity/get-entity.controller.ts +1 -1
- package/controllers/entity/list-entities.controller.ts +3 -3
- package/controllers/entity/update-entity.controller.ts +2 -2
- package/controllers/entity/upsert-entity.controller.ts +4 -4
- package/controllers/mutual/create-mutual.controller.ts +4 -4
- package/controllers/mutual/delete-mutual.controller.ts +2 -2
- package/controllers/mutual/get-mutual.controller.ts +1 -1
- package/controllers/mutual/list-entities-by-entity.controller.ts +1 -1
- package/controllers/mutual/update-mutual.controller.ts +2 -2
- package/controllers/setupRoutes.ts +1 -1
- package/controllers/tag/list-tags.controller.ts +3 -3
- package/data/DbUtils.ts +1 -1
- package/data/Entity.ts +1 -1
- package/data/EventUtils.ts +2 -2
- package/data/Mutual.ts +3 -3
- package/data/Tag.ts +1 -1
- package/dist/controllers/entity/create-entity.controller.d.ts +1 -1
- package/dist/controllers/entity/create-entity.controller.d.ts.map +1 -1
- package/dist/controllers/entity/create-entity.controller.js +1 -1
- package/dist/controllers/entity/create-entity.controller.js.map +1 -1
- package/dist/controllers/entity/delete-entity.controller.d.ts +1 -1
- package/dist/controllers/entity/delete-entity.controller.d.ts.map +1 -1
- package/dist/controllers/entity/delete-entity.controller.js +1 -1
- package/dist/controllers/entity/delete-entity.controller.js.map +1 -1
- package/dist/controllers/entity/get-entity.controller.d.ts +1 -1
- package/dist/controllers/entity/get-entity.controller.d.ts.map +1 -1
- package/dist/controllers/entity/list-entities.controller.d.ts +1 -1
- package/dist/controllers/entity/list-entities.controller.d.ts.map +1 -1
- package/dist/controllers/entity/list-entities.controller.js +2 -2
- package/dist/controllers/entity/list-entities.controller.js.map +1 -1
- package/dist/controllers/entity/update-entity.controller.d.ts +1 -1
- package/dist/controllers/entity/update-entity.controller.d.ts.map +1 -1
- package/dist/controllers/entity/update-entity.controller.js +1 -1
- package/dist/controllers/entity/update-entity.controller.js.map +1 -1
- package/dist/controllers/entity/upsert-entity.controller.d.ts +2 -2
- package/dist/controllers/entity/upsert-entity.controller.d.ts.map +1 -1
- package/dist/controllers/entity/upsert-entity.controller.js +2 -2
- package/dist/controllers/entity/upsert-entity.controller.js.map +1 -1
- package/dist/controllers/mutual/create-mutual.controller.d.ts +2 -2
- package/dist/controllers/mutual/create-mutual.controller.d.ts.map +1 -1
- package/dist/controllers/mutual/create-mutual.controller.js +2 -2
- package/dist/controllers/mutual/create-mutual.controller.js.map +1 -1
- package/dist/controllers/mutual/delete-mutual.controller.d.ts +1 -1
- package/dist/controllers/mutual/delete-mutual.controller.d.ts.map +1 -1
- package/dist/controllers/mutual/delete-mutual.controller.js +1 -1
- package/dist/controllers/mutual/delete-mutual.controller.js.map +1 -1
- package/dist/controllers/mutual/get-mutual.controller.d.ts +1 -1
- package/dist/controllers/mutual/get-mutual.controller.d.ts.map +1 -1
- package/dist/controllers/mutual/list-entities-by-entity.controller.d.ts +1 -1
- package/dist/controllers/mutual/list-entities-by-entity.controller.d.ts.map +1 -1
- package/dist/controllers/mutual/update-mutual.controller.d.ts +1 -1
- package/dist/controllers/mutual/update-mutual.controller.d.ts.map +1 -1
- package/dist/controllers/mutual/update-mutual.controller.js +1 -1
- package/dist/controllers/mutual/update-mutual.controller.js.map +1 -1
- package/dist/controllers/setupRoutes.js +1 -1
- package/dist/controllers/setupRoutes.js.map +1 -1
- package/dist/controllers/tag/list-tags.controller.d.ts +1 -1
- package/dist/controllers/tag/list-tags.controller.d.ts.map +1 -1
- package/dist/controllers/tag/list-tags.controller.js +2 -2
- package/dist/controllers/tag/list-tags.controller.js.map +1 -1
- package/dist/data/DbUtils.js +1 -1
- package/dist/data/DbUtils.js.map +1 -1
- package/dist/data/Entity.js +1 -1
- package/dist/data/Entity.js.map +1 -1
- package/dist/data/EventUtils.d.ts +1 -1
- package/dist/data/EventUtils.d.ts.map +1 -1
- package/dist/data/EventUtils.js +1 -1
- package/dist/data/EventUtils.js.map +1 -1
- package/dist/data/Mutual.d.ts +1 -1
- package/dist/data/Mutual.d.ts.map +1 -1
- package/dist/data/Mutual.js +2 -2
- package/dist/data/Mutual.js.map +1 -1
- package/dist/data/Tag.js +1 -1
- package/dist/data/Tag.js.map +1 -1
- package/dist/helpers/event.d.ts +1 -1
- package/dist/helpers/event.d.ts.map +1 -1
- package/dist/helpers/event.js +2 -2
- package/dist/helpers/event.js.map +1 -1
- package/dist/mock/monorise/chapter.d.ts +91 -91
- package/dist/mock/monorise/course.d.ts +17 -17
- package/dist/mock/monorise/index.d.ts +186 -186
- package/dist/mock/monorise/video.d.ts +28 -28
- package/dist/processors/create-entity-processor.js +3 -3
- package/dist/processors/create-entity-processor.js.map +1 -1
- package/dist/processors/mutual-processor.js +5 -5
- package/dist/processors/mutual-processor.js.map +1 -1
- package/dist/processors/prejoin-processor.js +4 -4
- package/dist/processors/prejoin-processor.js.map +1 -1
- package/dist/processors/replication-processor.js +3 -3
- package/dist/processors/replication-processor.js.map +1 -1
- package/dist/processors/tag-processor.js +2 -2
- package/dist/processors/tag-processor.js.map +1 -1
- package/dist/services/DependencyContainer.d.ts +18 -18
- package/dist/services/DependencyContainer.d.ts.map +1 -1
- package/dist/services/DependencyContainer.js +19 -19
- package/dist/services/DependencyContainer.js.map +1 -1
- package/dist/services/entity-service-lifecycle.d.ts +3 -3
- package/dist/services/entity-service-lifecycle.d.ts.map +1 -1
- package/dist/services/entity-service-lifecycle.js +1 -1
- package/dist/services/entity-service-lifecycle.js.map +1 -1
- package/dist/services/entity.service.d.ts +5 -5
- package/dist/services/entity.service.d.ts.map +1 -1
- package/dist/services/entity.service.js +2 -2
- package/dist/services/entity.service.js.map +1 -1
- package/dist/services/mutual.service.d.ts +5 -5
- package/dist/services/mutual.service.d.ts.map +1 -1
- package/dist/services/mutual.service.js +3 -3
- package/dist/services/mutual.service.js.map +1 -1
- package/dist/types/entity.type.d.ts +1 -1
- package/dist/types/entity.type.d.ts.map +1 -1
- package/helpers/event.ts +2 -2
- package/package.json +1 -1
- package/processors/create-entity-processor.ts +3 -3
- package/processors/mutual-processor.ts +5 -5
- package/processors/prejoin-processor.ts +8 -8
- package/processors/replication-processor.ts +3 -3
- package/processors/tag-processor.ts +4 -4
- package/services/DependencyContainer.ts +22 -22
- package/services/entity-service-lifecycle.ts +4 -4
- package/services/entity.service.ts +6 -6
- package/services/mutual.service.ts +6 -6
- package/tsconfig.json +1 -3
- package/types/entity.type.ts +2 -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,62 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const fileObjectSchema: z.ZodObject<{
|
|
3
|
-
name: z.ZodString;
|
|
4
|
-
url: z.ZodString;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
name: string;
|
|
7
|
-
url: string;
|
|
8
|
-
}, {
|
|
9
|
-
name: string;
|
|
10
|
-
url: string;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const fileSchema: z.ZodObject<{
|
|
13
|
-
uid: z.ZodString;
|
|
14
|
-
name: z.ZodString;
|
|
15
|
-
regular: z.ZodObject<{
|
|
16
|
-
name: z.ZodString;
|
|
17
|
-
url: z.ZodString;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
name: string;
|
|
20
|
-
url: string;
|
|
21
|
-
}, {
|
|
22
|
-
name: string;
|
|
23
|
-
url: string;
|
|
24
|
-
}>;
|
|
25
|
-
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
26
|
-
name: z.ZodString;
|
|
27
|
-
url: z.ZodString;
|
|
28
|
-
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
name: string;
|
|
30
|
-
url: string;
|
|
31
|
-
}, {
|
|
32
|
-
name: string;
|
|
33
|
-
url: string;
|
|
34
|
-
}>>;
|
|
35
|
-
jobId: z.ZodOptional<z.ZodString>;
|
|
36
|
-
}, "strip", z.ZodTypeAny, {
|
|
37
|
-
name: string;
|
|
38
|
-
uid: string;
|
|
39
|
-
regular: {
|
|
40
|
-
name: string;
|
|
41
|
-
url: string;
|
|
42
|
-
};
|
|
43
|
-
thumbnail?: {
|
|
44
|
-
name: string;
|
|
45
|
-
url: string;
|
|
46
|
-
} | undefined;
|
|
47
|
-
jobId?: string | undefined;
|
|
48
|
-
}, {
|
|
49
|
-
name: string;
|
|
50
|
-
uid: string;
|
|
51
|
-
regular: {
|
|
52
|
-
name: string;
|
|
53
|
-
url: string;
|
|
54
|
-
};
|
|
55
|
-
thumbnail?: {
|
|
56
|
-
name: string;
|
|
57
|
-
url: string;
|
|
58
|
-
} | undefined;
|
|
59
|
-
jobId?: string | undefined;
|
|
60
|
-
}>;
|
|
61
|
-
export type File = z.infer<typeof fileSchema>;
|
|
62
|
-
//# sourceMappingURL=FileObject.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileObject.d.ts","sourceRoot":"","sources":["../../../../data/FileObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;;;;;;;EAG3B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMrB,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const fileObjectSchema = z.object({
|
|
3
|
-
name: z.string(),
|
|
4
|
-
url: z.string(),
|
|
5
|
-
});
|
|
6
|
-
export const fileSchema = z.object({
|
|
7
|
-
uid: z.string(),
|
|
8
|
-
name: z.string(),
|
|
9
|
-
regular: fileObjectSchema,
|
|
10
|
-
thumbnail: fileObjectSchema.optional(),
|
|
11
|
-
jobId: z.string().optional(),
|
|
12
|
-
});
|
|
13
|
-
//# sourceMappingURL=FileObject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileObject.js","sourceRoot":"","sources":["../../../../data/FileObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,gBAAgB;IACzB,SAAS,EAAE,gBAAgB,CAAC,QAAQ,EAAE;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { type AttributeValue, type DynamoDB, type TransactWriteItem } from '@aws-sdk/client-dynamodb';
|
|
2
|
-
import type { Entity, EntitySchemaMap } from '@monorise/base';
|
|
3
|
-
import type { DbUtils } from '#/data/DbUtils';
|
|
4
|
-
import { type ProjectionExpressionValues } from './ProjectionExpression';
|
|
5
|
-
import { Repository } from './abstract/Repository.base';
|
|
6
|
-
export declare class Mutual<B extends Entity, T extends Entity, M extends Record<string, unknown>> {
|
|
7
|
-
byEntityType: B;
|
|
8
|
-
byEntityId: string;
|
|
9
|
-
byData: Partial<EntitySchemaMap[B]>;
|
|
10
|
-
entityType: T;
|
|
11
|
-
entityId: string;
|
|
12
|
-
data: Partial<EntitySchemaMap[T]>;
|
|
13
|
-
mutualData: M;
|
|
14
|
-
mutualId?: string | undefined;
|
|
15
|
-
private _createdAt?;
|
|
16
|
-
private _updatedAt?;
|
|
17
|
-
private _mutualUpdatedAt?;
|
|
18
|
-
private _expiresAt?;
|
|
19
|
-
constructor(byEntityType: B, byEntityId: string, byData: Partial<EntitySchemaMap[B]>, entityType: T, entityId: string, data: Partial<EntitySchemaMap[T]>, mutualData: M, mutualId?: string | undefined, _createdAt?: Date | undefined, _updatedAt?: Date | undefined, _mutualUpdatedAt?: Date | undefined, _expiresAt?: Date | undefined);
|
|
20
|
-
static fromItem<B extends Entity, T extends Entity, M extends Record<string, unknown>>(item?: Record<string, AttributeValue>): Mutual<B, T, M>;
|
|
21
|
-
mainKeys(): Record<string, AttributeValue>;
|
|
22
|
-
subKeys(): Record<string, AttributeValue>;
|
|
23
|
-
get byFullEntityId(): string;
|
|
24
|
-
get fullEntityId(): string;
|
|
25
|
-
get listEntitySK(): string;
|
|
26
|
-
get mainPk(): string;
|
|
27
|
-
get mainSk(): string;
|
|
28
|
-
get createdAt(): string | undefined;
|
|
29
|
-
get updatedAt(): string | undefined;
|
|
30
|
-
get mutualUpdatedAt(): string | undefined;
|
|
31
|
-
get expiresAt(): string | undefined;
|
|
32
|
-
toMutualItemOnly(): Record<string, AttributeValue>;
|
|
33
|
-
toItem(): Record<string, AttributeValue>;
|
|
34
|
-
toReversedItem(): Record<string, AttributeValue>;
|
|
35
|
-
toJSON(): Record<string, unknown>;
|
|
36
|
-
}
|
|
37
|
-
export declare class MutualRepository extends Repository {
|
|
38
|
-
private readonly TABLE_NAME;
|
|
39
|
-
private readonly dynamodbClient;
|
|
40
|
-
private readonly ddbUtils;
|
|
41
|
-
constructor(TABLE_NAME: string, dynamodbClient: DynamoDB, ddbUtils: DbUtils);
|
|
42
|
-
listEntitiesByEntity<B extends Entity, T extends Entity, M extends Record<string, unknown>>(byEntityType: B, byEntityId: string, entityType: T, opts?: {
|
|
43
|
-
lastKey?: Record<string, AttributeValue>;
|
|
44
|
-
ProjectionExpression?: ProjectionExpressionValues;
|
|
45
|
-
limit?: number;
|
|
46
|
-
}): Promise<{
|
|
47
|
-
items: Mutual<B, T, M>[];
|
|
48
|
-
lastKey?: Record<string, AttributeValue>;
|
|
49
|
-
}>;
|
|
50
|
-
getMutual<B extends Entity, T extends Entity, M extends Record<string, unknown>>(byEntityType: B, byEntityId: string, entityType: T, entityId: string, opts?: {
|
|
51
|
-
isFromMetadata?: boolean;
|
|
52
|
-
ProjectionExpression?: string;
|
|
53
|
-
}): Promise<Mutual<B, T, M>>;
|
|
54
|
-
checkMutualExist<B extends Entity, T extends Entity>(byEntityType: B, byEntityId: string, entityType: T, entityId: string): Promise<void>;
|
|
55
|
-
createMutualTransactItems<B extends Entity, T extends Entity, M extends Record<string, unknown>>(mutual: Mutual<B, T, M>, opts?: {
|
|
56
|
-
ConditionExpression?: string;
|
|
57
|
-
ExpressionAttributeNames?: Record<string, string>;
|
|
58
|
-
ExpressionAttributeValues?: Record<string, AttributeValue>;
|
|
59
|
-
}): TransactWriteItem[];
|
|
60
|
-
createMutual<B extends Entity, T extends Entity, M extends Record<string, unknown>>(byEntityType: B, byEntityId: string, byData: EntitySchemaMap[B], entityType: T, entityId: string, data: EntitySchemaMap[T], mutualData?: M, opts?: {
|
|
61
|
-
ConditionExpression?: string;
|
|
62
|
-
ExpressionAttributeNames?: Record<string, string>;
|
|
63
|
-
ExpressionAttributeValues?: Record<string, AttributeValue>;
|
|
64
|
-
createAndUpdateDatetime?: Date;
|
|
65
|
-
}): Promise<Mutual<B, T, M>>;
|
|
66
|
-
updateMutual<B extends Entity, T extends Entity, M extends Record<string, unknown>>(byEntityType: B, byEntityId: string, entityType: T, entityId: string, toUpdate: {
|
|
67
|
-
mutualData: Record<string, unknown>;
|
|
68
|
-
mutualUpdatedAt?: string;
|
|
69
|
-
updatedAt?: string;
|
|
70
|
-
}, opts?: {
|
|
71
|
-
ConditionExpression?: string;
|
|
72
|
-
ExpressionAttributeNames?: Record<string, string>;
|
|
73
|
-
ExpressionAttributeValues?: Record<string, AttributeValue>;
|
|
74
|
-
returnUpdatedValue?: boolean;
|
|
75
|
-
maxObjectUpdateLevel?: number;
|
|
76
|
-
}): Promise<Mutual<B, T, M> | undefined>;
|
|
77
|
-
deleteMutual<B extends Entity, T extends Entity, M extends Record<string, unknown>>(byEntityType: B, byEntityId: string, entityType: T, entityId: string, opts?: {
|
|
78
|
-
ConditionExpression?: string;
|
|
79
|
-
ExpressionAttributeNames?: Record<string, string>;
|
|
80
|
-
ExpressionAttributeValues?: Record<string, AttributeValue>;
|
|
81
|
-
}): Promise<Mutual<B, T, M>>;
|
|
82
|
-
createMutualLock<B extends Entity, T extends Entity>({ byEntityType, byEntityId, entityType, version, }: {
|
|
83
|
-
byEntityType: B;
|
|
84
|
-
byEntityId: string;
|
|
85
|
-
entityType: T;
|
|
86
|
-
version: string;
|
|
87
|
-
}): Promise<void>;
|
|
88
|
-
deleteMutualLock<B extends Entity, T extends Entity>({ byEntityType, byEntityId, entityType, }: {
|
|
89
|
-
byEntityType: B;
|
|
90
|
-
byEntityId: string;
|
|
91
|
-
entityType: T;
|
|
92
|
-
}): Promise<void>;
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=Mutual.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Mutual.d.ts","sourceRoot":"","sources":["../../../../data/Mutual.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,QAAQ,EAEb,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,qBAAa,MAAM,CACjB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAGxB,YAAY,EAAE,CAAC;IACf,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACnC,UAAU,EAAE,CAAC;IACb,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACjC,UAAU,EAAE,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM;IACxB,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,gBAAgB,CAAC;IACzB,OAAO,CAAC,UAAU,CAAC;gBAXZ,YAAY,EAAE,CAAC,EACf,UAAU,EAAE,MAAM,EACl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C,CAAC;IA4FrB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,EACzD,YAAY,EACZ,UAAU,EACV,UAAU,EACV,OAAO,GACR,EAAE;QACD,YAAY,EAAE,CAAC,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,CAAC,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwEX,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,EACzD,YAAY,EACZ,UAAU,EACV,UAAU,GACX,EAAE;QACD,YAAY,EAAE,CAAC,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,CAAC,CAAC;KACf,GAAG,OAAO,CAAC,IAAI,CAAC;CAmBlB"}
|
|
@@ -1,492 +0,0 @@
|
|
|
1
|
-
import { BatchStatementErrorCodeEnum, TransactionCanceledException, } from '@aws-sdk/client-dynamodb';
|
|
2
|
-
import { marshall, unmarshall } from '@aws-sdk/util-dynamodb';
|
|
3
|
-
import { ulid } from 'ulid';
|
|
4
|
-
import { StandardError } from '#/errors/standard-error';
|
|
5
|
-
import { sleep } from '#/helpers/sleep';
|
|
6
|
-
import { PROJECTION_EXPRESSION, } from './ProjectionExpression';
|
|
7
|
-
import { Repository } from './abstract/Repository.base';
|
|
8
|
-
export class Mutual {
|
|
9
|
-
byEntityType;
|
|
10
|
-
byEntityId;
|
|
11
|
-
byData;
|
|
12
|
-
entityType;
|
|
13
|
-
entityId;
|
|
14
|
-
data;
|
|
15
|
-
mutualData;
|
|
16
|
-
mutualId;
|
|
17
|
-
_createdAt;
|
|
18
|
-
_updatedAt;
|
|
19
|
-
_mutualUpdatedAt;
|
|
20
|
-
_expiresAt;
|
|
21
|
-
constructor(byEntityType, byEntityId, byData, entityType, entityId, data, mutualData, mutualId, _createdAt, _updatedAt, _mutualUpdatedAt, _expiresAt) {
|
|
22
|
-
this.byEntityType = byEntityType;
|
|
23
|
-
this.byEntityId = byEntityId;
|
|
24
|
-
this.byData = byData;
|
|
25
|
-
this.entityType = entityType;
|
|
26
|
-
this.entityId = entityId;
|
|
27
|
-
this.data = data;
|
|
28
|
-
this.mutualData = mutualData;
|
|
29
|
-
this.mutualId = mutualId;
|
|
30
|
-
this._createdAt = _createdAt;
|
|
31
|
-
this._updatedAt = _updatedAt;
|
|
32
|
-
this._mutualUpdatedAt = _mutualUpdatedAt;
|
|
33
|
-
this._expiresAt = _expiresAt;
|
|
34
|
-
}
|
|
35
|
-
static fromItem(item) {
|
|
36
|
-
if (!item)
|
|
37
|
-
throw new StandardError('MUTUAL_IS_UNDEFINED', 'Mutual item empty');
|
|
38
|
-
const parsedItem = unmarshall(item);
|
|
39
|
-
return new Mutual(parsedItem.byEntityType, parsedItem.byEntityId, parsedItem.byData, parsedItem.entityType, parsedItem.entityId, parsedItem.data, parsedItem.mutualData, parsedItem.mutualId, parsedItem.createdAt ? new Date(parsedItem.createdAt) : undefined, parsedItem.updatedAt ? new Date(parsedItem.updatedAt) : undefined, parsedItem.mutualUpdatedAt
|
|
40
|
-
? new Date(parsedItem.mutualUpdatedAt)
|
|
41
|
-
: undefined, parsedItem.expiresAt ? new Date(parsedItem.expiresAt) : undefined);
|
|
42
|
-
}
|
|
43
|
-
mainKeys() {
|
|
44
|
-
return {
|
|
45
|
-
PK: { S: this.mainPk },
|
|
46
|
-
SK: { S: this.mainSk },
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
subKeys() {
|
|
50
|
-
return {
|
|
51
|
-
PK: { S: this.byFullEntityId },
|
|
52
|
-
SK: { S: this.fullEntityId },
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
get byFullEntityId() {
|
|
56
|
-
return `${this.byEntityType}#${this.byEntityId}`;
|
|
57
|
-
}
|
|
58
|
-
get fullEntityId() {
|
|
59
|
-
return `${this.entityType}#${this.entityId}`;
|
|
60
|
-
}
|
|
61
|
-
get listEntitySK() {
|
|
62
|
-
return this.entityType;
|
|
63
|
-
}
|
|
64
|
-
get mainPk() {
|
|
65
|
-
return `MUTUAL#${this.mutualId}`;
|
|
66
|
-
}
|
|
67
|
-
get mainSk() {
|
|
68
|
-
return '#METADATA#';
|
|
69
|
-
}
|
|
70
|
-
get createdAt() {
|
|
71
|
-
return this._createdAt?.toISOString();
|
|
72
|
-
}
|
|
73
|
-
get updatedAt() {
|
|
74
|
-
return this._updatedAt?.toISOString();
|
|
75
|
-
}
|
|
76
|
-
get mutualUpdatedAt() {
|
|
77
|
-
return this._mutualUpdatedAt?.toISOString();
|
|
78
|
-
}
|
|
79
|
-
get expiresAt() {
|
|
80
|
-
return this._expiresAt?.toISOString();
|
|
81
|
-
}
|
|
82
|
-
toMutualItemOnly() {
|
|
83
|
-
// Mutual #METADATA# has `mutualData` only
|
|
84
|
-
return {
|
|
85
|
-
...marshall({ ...this.toJSON(), data: {} }, { removeUndefinedValues: true }),
|
|
86
|
-
...this.mainKeys(),
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
toItem() {
|
|
90
|
-
return {
|
|
91
|
-
...marshall(this.toJSON(), { removeUndefinedValues: true }),
|
|
92
|
-
...this.mainKeys(),
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
toReversedItem() {
|
|
96
|
-
const item = this.toJSON();
|
|
97
|
-
const reversedMutual = {
|
|
98
|
-
...item,
|
|
99
|
-
byEntityType: item.entityType,
|
|
100
|
-
byEntityId: item.entityId,
|
|
101
|
-
entityType: item.byEntityType,
|
|
102
|
-
entityId: item.byEntityId,
|
|
103
|
-
data: this.byData,
|
|
104
|
-
};
|
|
105
|
-
return {
|
|
106
|
-
...marshall(reversedMutual, { removeUndefinedValues: true }),
|
|
107
|
-
...this.mainKeys(),
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
toJSON() {
|
|
111
|
-
return {
|
|
112
|
-
byEntityType: this.byEntityType,
|
|
113
|
-
byEntityId: this.byEntityId,
|
|
114
|
-
entityType: this.entityType,
|
|
115
|
-
entityId: this.entityId,
|
|
116
|
-
mutualId: this.mutualId,
|
|
117
|
-
data: this.data,
|
|
118
|
-
mutualData: this.mutualData,
|
|
119
|
-
createdAt: this.createdAt,
|
|
120
|
-
updatedAt: this.updatedAt,
|
|
121
|
-
mutualUpdatedAt: this.mutualUpdatedAt,
|
|
122
|
-
expiresAt: this.expiresAt,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
export class MutualRepository extends Repository {
|
|
127
|
-
TABLE_NAME;
|
|
128
|
-
dynamodbClient;
|
|
129
|
-
ddbUtils;
|
|
130
|
-
constructor(TABLE_NAME, dynamodbClient, ddbUtils) {
|
|
131
|
-
super();
|
|
132
|
-
this.TABLE_NAME = TABLE_NAME;
|
|
133
|
-
this.dynamodbClient = dynamodbClient;
|
|
134
|
-
this.ddbUtils = ddbUtils;
|
|
135
|
-
}
|
|
136
|
-
async listEntitiesByEntity(byEntityType, byEntityId, entityType, opts = {}) {
|
|
137
|
-
const mutual = new Mutual(byEntityType, byEntityId, {}, entityType, 'list_by_only', {}, {});
|
|
138
|
-
const listAssociationsQuery = {
|
|
139
|
-
TableName: this.TABLE_NAME,
|
|
140
|
-
KeyConditionExpression: '#PK = :PK and begins_with(#SK, :SK)',
|
|
141
|
-
FilterExpression: 'attribute_not_exists(#expiresAt) or attribute_type(#expiresAt, :nullType)',
|
|
142
|
-
ExpressionAttributeNames: {
|
|
143
|
-
'#PK': 'PK',
|
|
144
|
-
'#SK': 'SK',
|
|
145
|
-
'#expiresAt': 'expiresAt',
|
|
146
|
-
},
|
|
147
|
-
ExpressionAttributeValues: {
|
|
148
|
-
':PK': {
|
|
149
|
-
S: mutual.byFullEntityId,
|
|
150
|
-
},
|
|
151
|
-
':SK': {
|
|
152
|
-
S: mutual.listEntitySK,
|
|
153
|
-
},
|
|
154
|
-
':nullType': { S: 'NULL' },
|
|
155
|
-
},
|
|
156
|
-
ProjectionExpression: opts.ProjectionExpression,
|
|
157
|
-
};
|
|
158
|
-
let lastKey = opts.lastKey;
|
|
159
|
-
let items = [];
|
|
160
|
-
let remainingCount = opts.limit ?? 0;
|
|
161
|
-
do {
|
|
162
|
-
const resp = await this.dynamodbClient.query({
|
|
163
|
-
...listAssociationsQuery,
|
|
164
|
-
...(remainingCount && { Limit: remainingCount }),
|
|
165
|
-
...(lastKey && {
|
|
166
|
-
ExclusiveStartKey: lastKey,
|
|
167
|
-
}),
|
|
168
|
-
});
|
|
169
|
-
items = items.concat(resp.Items?.map((item) => Mutual.fromItem(item)) || []);
|
|
170
|
-
lastKey = resp.LastEvaluatedKey;
|
|
171
|
-
if (opts.limit) {
|
|
172
|
-
remainingCount = remainingCount - (resp.Items?.length ?? 0);
|
|
173
|
-
}
|
|
174
|
-
} while (
|
|
175
|
-
// limit is given, haven't reach limit, and there are still items to retrieve
|
|
176
|
-
(opts.limit && remainingCount && lastKey) ||
|
|
177
|
-
// no limit is given and there are still items to retrieve
|
|
178
|
-
(!opts.limit && lastKey));
|
|
179
|
-
return {
|
|
180
|
-
items,
|
|
181
|
-
lastKey,
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
async getMutual(byEntityType, byEntityId, entityType, entityId, opts) {
|
|
185
|
-
const mutual = new Mutual(byEntityType, byEntityId, {}, entityType, entityId, {}, {});
|
|
186
|
-
const resp = await this.dynamodbClient.getItem({
|
|
187
|
-
TableName: this.TABLE_NAME,
|
|
188
|
-
Key: mutual.subKeys(),
|
|
189
|
-
ProjectionExpression: opts?.ProjectionExpression,
|
|
190
|
-
});
|
|
191
|
-
let mutualMetadata = null;
|
|
192
|
-
if (opts?.isFromMetadata) {
|
|
193
|
-
const tempMutual = Mutual.fromItem(resp.Item);
|
|
194
|
-
const respMetadataMutual = await this.dynamodbClient.getItem({
|
|
195
|
-
TableName: this.TABLE_NAME,
|
|
196
|
-
Key: tempMutual.mainKeys(),
|
|
197
|
-
ProjectionExpression: opts?.ProjectionExpression,
|
|
198
|
-
});
|
|
199
|
-
mutualMetadata = Mutual.fromItem(respMetadataMutual.Item);
|
|
200
|
-
}
|
|
201
|
-
return mutualMetadata || Mutual.fromItem(resp.Item);
|
|
202
|
-
}
|
|
203
|
-
async checkMutualExist(byEntityType, byEntityId, entityType, entityId) {
|
|
204
|
-
const mutual = new Mutual(byEntityType, byEntityId, {}, entityType, entityId, {}, {});
|
|
205
|
-
const resp = await this.dynamodbClient.getItem({
|
|
206
|
-
TableName: this.TABLE_NAME,
|
|
207
|
-
Key: mutual.subKeys(),
|
|
208
|
-
ProjectionExpression: 'PK, SK, expiresAt',
|
|
209
|
-
});
|
|
210
|
-
if (resp.Item && !resp.Item?.expiresAt) {
|
|
211
|
-
throw new StandardError('MUTUAL_EXISTS', 'Entities are already linked');
|
|
212
|
-
}
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
createMutualTransactItems(mutual, opts) {
|
|
216
|
-
const TransactItems = [
|
|
217
|
-
{
|
|
218
|
-
Put: {
|
|
219
|
-
TableName: this.TABLE_NAME,
|
|
220
|
-
ConditionExpression: opts?.ConditionExpression ||
|
|
221
|
-
'attribute_not_exists(PK) OR attribute_exists(expiresAt)',
|
|
222
|
-
ExpressionAttributeNames: opts?.ExpressionAttributeNames,
|
|
223
|
-
ExpressionAttributeValues: opts?.ExpressionAttributeValues,
|
|
224
|
-
Item: mutual.toItem(),
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
Put: {
|
|
229
|
-
TableName: this.TABLE_NAME,
|
|
230
|
-
ConditionExpression: opts?.ConditionExpression ||
|
|
231
|
-
'attribute_not_exists(PK) OR attribute_exists(expiresAt)',
|
|
232
|
-
ExpressionAttributeNames: opts?.ExpressionAttributeNames,
|
|
233
|
-
ExpressionAttributeValues: opts?.ExpressionAttributeValues,
|
|
234
|
-
Item: {
|
|
235
|
-
...mutual.toItem(),
|
|
236
|
-
PK: { S: mutual.byFullEntityId },
|
|
237
|
-
SK: { S: mutual.fullEntityId },
|
|
238
|
-
R1PK: { S: mutual.fullEntityId },
|
|
239
|
-
R1SK: { S: mutual.byFullEntityId },
|
|
240
|
-
R2PK: { S: mutual.mainPk },
|
|
241
|
-
R2SK: { S: mutual.byFullEntityId },
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
Put: {
|
|
247
|
-
TableName: this.TABLE_NAME,
|
|
248
|
-
ConditionExpression: opts?.ConditionExpression ||
|
|
249
|
-
'attribute_not_exists(PK) OR attribute_exists(expiresAt)',
|
|
250
|
-
ExpressionAttributeNames: opts?.ExpressionAttributeNames,
|
|
251
|
-
ExpressionAttributeValues: opts?.ExpressionAttributeValues,
|
|
252
|
-
Item: {
|
|
253
|
-
...mutual.toReversedItem(),
|
|
254
|
-
PK: { S: mutual.fullEntityId },
|
|
255
|
-
SK: { S: mutual.byFullEntityId },
|
|
256
|
-
R1PK: { S: mutual.byFullEntityId },
|
|
257
|
-
R1SK: { S: mutual.fullEntityId },
|
|
258
|
-
R2PK: { S: mutual.mainPk },
|
|
259
|
-
R2SK: { S: mutual.fullEntityId },
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
];
|
|
264
|
-
return TransactItems;
|
|
265
|
-
}
|
|
266
|
-
async createMutual(byEntityType, byEntityId, byData, entityType, entityId, data, mutualData = {}, opts) {
|
|
267
|
-
const errorContext = {};
|
|
268
|
-
const currentDatetime = opts?.createAndUpdateDatetime || new Date();
|
|
269
|
-
const mutual = new Mutual(byEntityType, byEntityId, byData, entityType, entityId, data, mutualData, ulid(), currentDatetime, currentDatetime, currentDatetime);
|
|
270
|
-
const TransactItems = this.createMutualTransactItems(mutual, {
|
|
271
|
-
ConditionExpression: opts?.ConditionExpression,
|
|
272
|
-
ExpressionAttributeNames: opts?.ExpressionAttributeNames,
|
|
273
|
-
ExpressionAttributeValues: opts?.ExpressionAttributeValues,
|
|
274
|
-
});
|
|
275
|
-
errorContext.TransactItems = TransactItems;
|
|
276
|
-
await this.dynamodbClient.transactWriteItems({ TransactItems });
|
|
277
|
-
return mutual;
|
|
278
|
-
}
|
|
279
|
-
async updateMutual(byEntityType, byEntityId, entityType, entityId, toUpdate, opts) {
|
|
280
|
-
const returnUpdatedValue = opts?.returnUpdatedValue ?? false;
|
|
281
|
-
const errorContext = {};
|
|
282
|
-
try {
|
|
283
|
-
const mutual = await this.getMutual(byEntityType, byEntityId, entityType, entityId, { ProjectionExpression: PROJECTION_EXPRESSION.NO_DATA });
|
|
284
|
-
const currentDatetime = new Date().toISOString();
|
|
285
|
-
const toUpdateExpressions = this.toUpdate({
|
|
286
|
-
mutualUpdatedAt: currentDatetime,
|
|
287
|
-
...toUpdate,
|
|
288
|
-
}, { maxLevel: opts?.maxObjectUpdateLevel });
|
|
289
|
-
const updateExpression = {
|
|
290
|
-
ConditionExpression: opts?.ConditionExpression || 'attribute_exists(PK)',
|
|
291
|
-
UpdateExpression: toUpdateExpressions.UpdateExpression,
|
|
292
|
-
ExpressionAttributeNames: {
|
|
293
|
-
...toUpdateExpressions.ExpressionAttributeNames,
|
|
294
|
-
...opts?.ExpressionAttributeNames,
|
|
295
|
-
},
|
|
296
|
-
ExpressionAttributeValues: {
|
|
297
|
-
...toUpdateExpressions.ExpressionAttributeValues,
|
|
298
|
-
...opts?.ExpressionAttributeValues,
|
|
299
|
-
},
|
|
300
|
-
};
|
|
301
|
-
const TransactItems = [
|
|
302
|
-
{
|
|
303
|
-
Update: {
|
|
304
|
-
TableName: this.TABLE_NAME,
|
|
305
|
-
Key: mutual.mainKeys(),
|
|
306
|
-
...updateExpression,
|
|
307
|
-
},
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
Update: {
|
|
311
|
-
TableName: this.TABLE_NAME,
|
|
312
|
-
Key: {
|
|
313
|
-
PK: { S: mutual.byFullEntityId },
|
|
314
|
-
SK: { S: mutual.fullEntityId },
|
|
315
|
-
},
|
|
316
|
-
...updateExpression,
|
|
317
|
-
},
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
Update: {
|
|
321
|
-
TableName: this.TABLE_NAME,
|
|
322
|
-
Key: {
|
|
323
|
-
PK: { S: mutual.fullEntityId },
|
|
324
|
-
SK: { S: mutual.byFullEntityId },
|
|
325
|
-
},
|
|
326
|
-
...updateExpression,
|
|
327
|
-
},
|
|
328
|
-
},
|
|
329
|
-
];
|
|
330
|
-
errorContext.TransactItems = TransactItems;
|
|
331
|
-
await this.ddbUtils.executeTransactWrite({ TransactItems });
|
|
332
|
-
if (!returnUpdatedValue) {
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
const updatedMutual = await this.getMutual(byEntityType, byEntityId, entityType, entityId);
|
|
336
|
-
return updatedMutual;
|
|
337
|
-
}
|
|
338
|
-
catch (err) {
|
|
339
|
-
if (err instanceof StandardError &&
|
|
340
|
-
err.code === 'CONDITIONAL_CHECK_FAILED') {
|
|
341
|
-
throw new StandardError('MUTUAL_NOT_FOUND', 'Mutual not found', err, {
|
|
342
|
-
errorContext,
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
throw err;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
async deleteMutual(byEntityType, byEntityId, entityType, entityId, opts) {
|
|
349
|
-
const errorContext = {
|
|
350
|
-
byEntityType,
|
|
351
|
-
byEntityId,
|
|
352
|
-
entityType,
|
|
353
|
-
entityId,
|
|
354
|
-
};
|
|
355
|
-
try {
|
|
356
|
-
const mutual = await this.getMutual(byEntityType, byEntityId, entityType, entityId, { ProjectionExpression: PROJECTION_EXPRESSION.NO_DATA });
|
|
357
|
-
const tenMinsLater = Math.floor(new Date().getTime() / 1000 + 10 * 60);
|
|
358
|
-
const expressions = {
|
|
359
|
-
UpdateExpression: 'SET #expiresAt = :expiresAt, #mutualUpdatedAt = :mutualUpdatedAt, #updatedAt = :mutualUpdatedAt',
|
|
360
|
-
ConditionExpression: opts?.ConditionExpression ||
|
|
361
|
-
'attribute_exists(PK) AND attribute_not_exists(#expiresAt)',
|
|
362
|
-
ExpressionAttributeNames: {
|
|
363
|
-
'#expiresAt': 'expiresAt',
|
|
364
|
-
'#mutualUpdatedAt': 'mutualUpdatedAt',
|
|
365
|
-
'#updatedAt': 'updatedAt',
|
|
366
|
-
...opts?.ExpressionAttributeNames,
|
|
367
|
-
},
|
|
368
|
-
ExpressionAttributeValues: {
|
|
369
|
-
':expiresAt': { N: String(tenMinsLater) },
|
|
370
|
-
':mutualUpdatedAt': { S: new Date().toISOString() },
|
|
371
|
-
...opts?.ExpressionAttributeValues,
|
|
372
|
-
},
|
|
373
|
-
};
|
|
374
|
-
const TransactItems = [
|
|
375
|
-
{
|
|
376
|
-
Update: {
|
|
377
|
-
TableName: this.TABLE_NAME,
|
|
378
|
-
Key: mutual.mainKeys(),
|
|
379
|
-
...expressions,
|
|
380
|
-
},
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
Update: {
|
|
384
|
-
TableName: this.TABLE_NAME,
|
|
385
|
-
Key: {
|
|
386
|
-
PK: { S: mutual.byFullEntityId },
|
|
387
|
-
SK: { S: mutual.fullEntityId },
|
|
388
|
-
},
|
|
389
|
-
...expressions,
|
|
390
|
-
},
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
Update: {
|
|
394
|
-
TableName: this.TABLE_NAME,
|
|
395
|
-
Key: {
|
|
396
|
-
PK: { S: mutual.fullEntityId },
|
|
397
|
-
SK: { S: mutual.byFullEntityId },
|
|
398
|
-
},
|
|
399
|
-
...expressions,
|
|
400
|
-
},
|
|
401
|
-
},
|
|
402
|
-
];
|
|
403
|
-
errorContext.TransactItems = TransactItems;
|
|
404
|
-
await this.dynamodbClient.transactWriteItems({ TransactItems });
|
|
405
|
-
return mutual;
|
|
406
|
-
}
|
|
407
|
-
catch (err) {
|
|
408
|
-
const isConditionalCheckFailed = err instanceof TransactionCanceledException &&
|
|
409
|
-
err.CancellationReasons?.some((reason) => reason.Code === BatchStatementErrorCodeEnum.ConditionalCheckFailed);
|
|
410
|
-
const isMutualIsUndefined = err instanceof StandardError && err.code === 'MUTUAL_IS_UNDEFINED';
|
|
411
|
-
if (isConditionalCheckFailed || isMutualIsUndefined) {
|
|
412
|
-
throw new StandardError('MUTUAL_NOT_FOUND', 'Mutual not found', err, {
|
|
413
|
-
errorContext,
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
throw err;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
async createMutualLock({ byEntityType, byEntityId, entityType, version, }) {
|
|
420
|
-
let retryCount = 2;
|
|
421
|
-
const itemKey = {
|
|
422
|
-
PK: {
|
|
423
|
-
S: `MUTUAL#${byEntityType}#${byEntityId}#${entityType}`,
|
|
424
|
-
},
|
|
425
|
-
SK: { S: '#LOCK#' },
|
|
426
|
-
};
|
|
427
|
-
do {
|
|
428
|
-
try {
|
|
429
|
-
const fiveMinsLater = Math.floor(new Date().getTime() / 1000 + 5 * 60);
|
|
430
|
-
await this.dynamodbClient.putItem({
|
|
431
|
-
TableName: this.TABLE_NAME,
|
|
432
|
-
Item: {
|
|
433
|
-
...itemKey,
|
|
434
|
-
version: { S: version },
|
|
435
|
-
status: { S: 'LOCK' },
|
|
436
|
-
expiresAt: {
|
|
437
|
-
// auto release lock in case the mutual logic gone wrong to prevent dead lock
|
|
438
|
-
N: `${fiveMinsLater}`,
|
|
439
|
-
},
|
|
440
|
-
},
|
|
441
|
-
ConditionExpression: 'attribute_not_exists(PK) OR version < :version AND #status <> :status',
|
|
442
|
-
ExpressionAttributeNames: { '#status': 'status' },
|
|
443
|
-
ExpressionAttributeValues: {
|
|
444
|
-
':version': { S: version },
|
|
445
|
-
':status': { S: 'LOCK' },
|
|
446
|
-
},
|
|
447
|
-
});
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
catch (err) {
|
|
451
|
-
console.log('=====CATCHED_MUTUAL_LOCK_CONFLICT=====');
|
|
452
|
-
const lock = await this.dynamodbClient.getItem({
|
|
453
|
-
TableName: this.TABLE_NAME,
|
|
454
|
-
Key: itemKey,
|
|
455
|
-
});
|
|
456
|
-
// if version is lower, throw not retryable error to skip
|
|
457
|
-
const existingVersion = lock.Item?.version?.S ?? '';
|
|
458
|
-
const isExistingVersionGreaterThanNewVersion = existingVersion >= version;
|
|
459
|
-
if (isExistingVersionGreaterThanNewVersion) {
|
|
460
|
-
throw new StandardError('MUTUAL_LOCK_CONFLICT', 'Lock conflict', err, { lock: lock.Item });
|
|
461
|
-
}
|
|
462
|
-
// default behaviour
|
|
463
|
-
// if version is higher, retry
|
|
464
|
-
// if lock not found, retry
|
|
465
|
-
await sleep(2000);
|
|
466
|
-
console.log('=====RETRY_MUTUAL_LOCK=====');
|
|
467
|
-
}
|
|
468
|
-
} while (retryCount-- > 0);
|
|
469
|
-
// catch real unhandled error, so it can reach DLQ for inspection
|
|
470
|
-
throw new StandardError('RETRYABLE_MUTUAL_LOCK_CONFLICT', 'Retryable lock conflict');
|
|
471
|
-
}
|
|
472
|
-
async deleteMutualLock({ byEntityType, byEntityId, entityType, }) {
|
|
473
|
-
try {
|
|
474
|
-
await this.dynamodbClient.updateItem({
|
|
475
|
-
TableName: this.TABLE_NAME,
|
|
476
|
-
Key: {
|
|
477
|
-
PK: {
|
|
478
|
-
S: `MUTUAL#${byEntityType}#${byEntityId}#${entityType}`,
|
|
479
|
-
},
|
|
480
|
-
SK: { S: '#LOCK#' },
|
|
481
|
-
},
|
|
482
|
-
UpdateExpression: 'REMOVE #status',
|
|
483
|
-
ExpressionAttributeNames: { '#status': 'status' },
|
|
484
|
-
});
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
catch (error) {
|
|
488
|
-
// if lock is not found, it's okay
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
//# sourceMappingURL=Mutual.js.map
|