@abyss-project/tools 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +33 -0
- package/.prettierrc +5 -0
- package/dist/api/abyss.admin.api.d.ts +7 -0
- package/dist/api/abyss.admin.api.js +28 -0
- package/dist/api/atlas-document.api.d.ts +6 -0
- package/dist/api/atlas-document.api.js +26 -0
- package/dist/api/atlas-group.api.d.ts +6 -0
- package/dist/api/atlas-group.api.js +24 -0
- package/dist/api/atlas-page-content.api.d.ts +0 -0
- package/dist/api/atlas-page-content.api.js +1 -0
- package/dist/api/atlas-page.api.d.ts +10 -0
- package/dist/api/atlas-page.api.js +46 -0
- package/dist/api/atlas.api.d.ts +8 -0
- package/dist/api/atlas.api.js +35 -0
- package/dist/api/atlas.public.api.d.ts +4 -0
- package/dist/api/atlas.public.api.js +18 -0
- package/dist/api/board-card-checklist.api.d.ts +8 -0
- package/dist/api/board-card-checklist.api.js +32 -0
- package/dist/api/board-card-comment.api.d.ts +5 -0
- package/dist/api/board-card-comment.api.js +20 -0
- package/dist/api/board-card-document.api.d.ts +5 -0
- package/dist/api/board-card-document.api.js +20 -0
- package/dist/api/board-card.api.d.ts +11 -0
- package/dist/api/board-card.api.js +48 -0
- package/dist/api/board-column.api.d.ts +5 -0
- package/dist/api/board-column.api.js +20 -0
- package/dist/api/board-label.api.d.ts +8 -0
- package/dist/api/board-label.api.js +33 -0
- package/dist/api/board.api.d.ts +12 -0
- package/dist/api/board.api.js +41 -0
- package/dist/api/draw.api.d.ts +8 -0
- package/dist/api/draw.api.js +36 -0
- package/dist/api/draw.public.api.d.ts +5 -0
- package/dist/api/draw.public.api.js +20 -0
- package/dist/api/index.d.ts +26 -0
- package/dist/api/index.js +42 -0
- package/dist/api/memo.api.d.ts +8 -0
- package/dist/api/memo.api.js +36 -0
- package/dist/api/metrics.api.d.ts +2 -0
- package/dist/api/metrics.api.js +8 -0
- package/dist/api/retrospective-card.api.d.ts +6 -0
- package/dist/api/retrospective-card.api.js +26 -0
- package/dist/api/retrospective-member.api.d.ts +5 -0
- package/dist/api/retrospective-member.api.js +20 -0
- package/dist/api/retrospective-section.api.d.ts +6 -0
- package/dist/api/retrospective-section.api.js +26 -0
- package/dist/api/retrospective.api.d.ts +8 -0
- package/dist/api/retrospective.api.js +34 -0
- package/dist/api/retrospective.public.api.d.ts +11 -0
- package/dist/api/retrospective.public.api.js +44 -0
- package/dist/api/short-link.admin.api.d.ts +7 -0
- package/dist/api/short-link.admin.api.js +22 -0
- package/dist/api/short-link.api.d.ts +12 -0
- package/dist/api/short-link.api.js +48 -0
- package/dist/api/short-link.public.api.d.ts +8 -0
- package/dist/api/short-link.public.api.js +32 -0
- package/dist/api/user-tag.api.d.ts +9 -0
- package/dist/api/user-tag.api.js +36 -0
- package/dist/constants/atlas.constants.d.ts +2 -0
- package/dist/constants/atlas.constants.js +5 -0
- package/dist/constants/board.constants.d.ts +5 -0
- package/dist/constants/board.constants.js +8 -0
- package/dist/constants/index.d.ts +5 -0
- package/dist/constants/index.js +21 -0
- package/dist/constants/memo.constants.d.ts +3 -0
- package/dist/constants/memo.constants.js +6 -0
- package/dist/constants/short-link.constants.d.ts +8 -0
- package/dist/constants/short-link.constants.js +11 -0
- package/dist/constants/user-tag.constants.d.ts +3 -0
- package/dist/constants/user-tag.constants.js +6 -0
- package/dist/index.d.ts +262 -0
- package/dist/index.js +341 -0
- package/dist/server-sent-events/index.d.ts +10 -0
- package/dist/server-sent-events/index.js +28 -0
- package/dist/server-sent-events/protocols/atlas/atlas.sse-protocol.d.ts +74 -0
- package/dist/server-sent-events/protocols/atlas/atlas.sse-protocol.js +21 -0
- package/dist/server-sent-events/protocols/atlas/index.d.ts +1 -0
- package/dist/server-sent-events/protocols/atlas/index.js +17 -0
- package/dist/server-sent-events/protocols/board/board.sse-protocol.d.ts +91 -0
- package/dist/server-sent-events/protocols/board/board.sse-protocol.js +23 -0
- package/dist/server-sent-events/protocols/board/index.d.ts +1 -0
- package/dist/server-sent-events/protocols/board/index.js +17 -0
- package/dist/server-sent-events/protocols/board-card/board-card.sse-protocol.d.ts +18 -0
- package/dist/server-sent-events/protocols/board-card/board-card.sse-protocol.js +11 -0
- package/dist/server-sent-events/protocols/board-card/index.d.ts +1 -0
- package/dist/server-sent-events/protocols/board-card/index.js +17 -0
- package/dist/server-sent-events/protocols/index.d.ts +20 -0
- package/dist/server-sent-events/protocols/index.js +29 -0
- package/dist/server-sent-events/protocols/retrospective/index.d.ts +1 -0
- package/dist/server-sent-events/protocols/retrospective/index.js +17 -0
- package/dist/server-sent-events/protocols/retrospective/retrospective.sse-protocol.d.ts +69 -0
- package/dist/server-sent-events/protocols/retrospective/retrospective.sse-protocol.js +21 -0
- package/dist/server-sent-events/server-sent-events.manager.d.ts +23 -0
- package/dist/server-sent-events/server-sent-events.manager.js +59 -0
- package/dist/types/draw.type.d.ts +132 -0
- package/dist/types/draw.type.js +15 -0
- package/dist/types/enum/api-error.enum.d.ts +21 -0
- package/dist/types/enum/api-error.enum.js +26 -0
- package/dist/types/enum/board-activity.enum.d.ts +170 -0
- package/dist/types/enum/board-activity.enum.js +37 -0
- package/dist/types/enum/board-column-type.enum.d.ts +6 -0
- package/dist/types/enum/board-column-type.enum.js +10 -0
- package/dist/types/enum/index.d.ts +3 -0
- package/dist/types/enum/index.js +19 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +19 -0
- package/dist/types/interface/api/index.d.ts +5 -0
- package/dist/types/interface/api/index.js +21 -0
- package/dist/types/interface/api/requests/abyss.admin.request.d.ts +14 -0
- package/dist/types/interface/api/requests/abyss.admin.request.js +2 -0
- package/dist/types/interface/api/requests/atlas-document.request.d.ts +26 -0
- package/dist/types/interface/api/requests/atlas-document.request.js +2 -0
- package/dist/types/interface/api/requests/atlas-group.request.d.ts +40 -0
- package/dist/types/interface/api/requests/atlas-group.request.js +2 -0
- package/dist/types/interface/api/requests/atlas-page.request.d.ts +72 -0
- package/dist/types/interface/api/requests/atlas-page.request.js +2 -0
- package/dist/types/interface/api/requests/atlas.public.request.d.ts +18 -0
- package/dist/types/interface/api/requests/atlas.public.request.js +2 -0
- package/dist/types/interface/api/requests/atlas.request.d.ts +33 -0
- package/dist/types/interface/api/requests/atlas.request.js +2 -0
- package/dist/types/interface/api/requests/board-card-checklist.request.d.ts +55 -0
- package/dist/types/interface/api/requests/board-card-checklist.request.js +2 -0
- package/dist/types/interface/api/requests/board-card-comment.request.d.ts +25 -0
- package/dist/types/interface/api/requests/board-card-comment.request.js +2 -0
- package/dist/types/interface/api/requests/board-card-document.request.d.ts +25 -0
- package/dist/types/interface/api/requests/board-card-document.request.js +2 -0
- package/dist/types/interface/api/requests/board-card.request.d.ts +77 -0
- package/dist/types/interface/api/requests/board-card.request.js +2 -0
- package/dist/types/interface/api/requests/board-column.request.d.ts +26 -0
- package/dist/types/interface/api/requests/board-column.request.js +2 -0
- package/dist/types/interface/api/requests/board-label.request.d.ts +36 -0
- package/dist/types/interface/api/requests/board-label.request.js +2 -0
- package/dist/types/interface/api/requests/board.request.d.ts +25 -0
- package/dist/types/interface/api/requests/board.request.js +2 -0
- package/dist/types/interface/api/requests/draw.public.request.d.ts +17 -0
- package/dist/types/interface/api/requests/draw.public.request.js +2 -0
- package/dist/types/interface/api/requests/draw.request.d.ts +31 -0
- package/dist/types/interface/api/requests/draw.request.js +2 -0
- package/dist/types/interface/api/requests/index.d.ts +26 -0
- package/dist/types/interface/api/requests/index.js +42 -0
- package/dist/types/interface/api/requests/memo.request.d.ts +29 -0
- package/dist/types/interface/api/requests/memo.request.js +2 -0
- package/dist/types/interface/api/requests/metrics.request.d.ts +3 -0
- package/dist/types/interface/api/requests/metrics.request.js +2 -0
- package/dist/types/interface/api/requests/retrospective-card.request.d.ts +32 -0
- package/dist/types/interface/api/requests/retrospective-card.request.js +2 -0
- package/dist/types/interface/api/requests/retrospective-member.request.d.ts +17 -0
- package/dist/types/interface/api/requests/retrospective-member.request.js +2 -0
- package/dist/types/interface/api/requests/retrospective-section.request.d.ts +36 -0
- package/dist/types/interface/api/requests/retrospective-section.request.js +2 -0
- package/dist/types/interface/api/requests/retrospective.public.request.d.ts +71 -0
- package/dist/types/interface/api/requests/retrospective.public.request.js +2 -0
- package/dist/types/interface/api/requests/retrospective.request.d.ts +39 -0
- package/dist/types/interface/api/requests/retrospective.request.js +2 -0
- package/dist/types/interface/api/requests/short-link.admin.request.d.ts +29 -0
- package/dist/types/interface/api/requests/short-link.admin.request.js +2 -0
- package/dist/types/interface/api/requests/short-link.public.request.d.ts +33 -0
- package/dist/types/interface/api/requests/short-link.public.request.js +2 -0
- package/dist/types/interface/api/requests/short-link.request.d.ts +47 -0
- package/dist/types/interface/api/requests/short-link.request.js +2 -0
- package/dist/types/interface/api/requests/user-tag.request.d.ts +37 -0
- package/dist/types/interface/api/requests/user-tag.request.js +2 -0
- package/dist/types/interface/api/responses/abyss.admin.response.d.ts +14 -0
- package/dist/types/interface/api/responses/abyss.admin.response.js +2 -0
- package/dist/types/interface/api/responses/atlas-document.response.d.ts +19 -0
- package/dist/types/interface/api/responses/atlas-document.response.js +2 -0
- package/dist/types/interface/api/responses/atlas-group.response.d.ts +19 -0
- package/dist/types/interface/api/responses/atlas-group.response.js +2 -0
- package/dist/types/interface/api/responses/atlas-page.response.d.ts +44 -0
- package/dist/types/interface/api/responses/atlas-page.response.js +2 -0
- package/dist/types/interface/api/responses/atlas.public.response.d.ts +18 -0
- package/dist/types/interface/api/responses/atlas.public.response.js +2 -0
- package/dist/types/interface/api/responses/atlas.response.d.ts +19 -0
- package/dist/types/interface/api/responses/atlas.response.js +2 -0
- package/dist/types/interface/api/responses/board-card-checklist.response.d.ts +27 -0
- package/dist/types/interface/api/responses/board-card-checklist.response.js +2 -0
- package/dist/types/interface/api/responses/board-card-comment.response.d.ts +17 -0
- package/dist/types/interface/api/responses/board-card-comment.response.js +2 -0
- package/dist/types/interface/api/responses/board-card-document.response.d.ts +20 -0
- package/dist/types/interface/api/responses/board-card-document.response.js +2 -0
- package/dist/types/interface/api/responses/board-card.response.d.ts +47 -0
- package/dist/types/interface/api/responses/board-card.response.js +2 -0
- package/dist/types/interface/api/responses/board-column.response.d.ts +17 -0
- package/dist/types/interface/api/responses/board-column.response.js +2 -0
- package/dist/types/interface/api/responses/board-label.response.d.ts +30 -0
- package/dist/types/interface/api/responses/board-label.response.js +2 -0
- package/dist/types/interface/api/responses/board.response.d.ts +59 -0
- package/dist/types/interface/api/responses/board.response.js +2 -0
- package/dist/types/interface/api/responses/draw.public.response.d.ts +17 -0
- package/dist/types/interface/api/responses/draw.public.response.js +2 -0
- package/dist/types/interface/api/responses/draw.response.d.ts +19 -0
- package/dist/types/interface/api/responses/draw.response.js +2 -0
- package/dist/types/interface/api/responses/index.d.ts +26 -0
- package/dist/types/interface/api/responses/index.js +42 -0
- package/dist/types/interface/api/responses/memo.response.d.ts +19 -0
- package/dist/types/interface/api/responses/memo.response.js +2 -0
- package/dist/types/interface/api/responses/metrics.response.d.ts +13 -0
- package/dist/types/interface/api/responses/metrics.response.js +2 -0
- package/dist/types/interface/api/responses/retrospective-card.response.d.ts +19 -0
- package/dist/types/interface/api/responses/retrospective-card.response.js +2 -0
- package/dist/types/interface/api/responses/retrospective-member.response.d.ts +18 -0
- package/dist/types/interface/api/responses/retrospective-member.response.js +2 -0
- package/dist/types/interface/api/responses/retrospective-section.response.d.ts +19 -0
- package/dist/types/interface/api/responses/retrospective-section.response.js +2 -0
- package/dist/types/interface/api/responses/retrospective.public.response.d.ts +36 -0
- package/dist/types/interface/api/responses/retrospective.public.response.js +2 -0
- package/dist/types/interface/api/responses/retrospective.response.d.ts +19 -0
- package/dist/types/interface/api/responses/retrospective.response.js +2 -0
- package/dist/types/interface/api/responses/short-link.admin.response.d.ts +17 -0
- package/dist/types/interface/api/responses/short-link.admin.response.js +2 -0
- package/dist/types/interface/api/responses/short-link.public.response.d.ts +21 -0
- package/dist/types/interface/api/responses/short-link.public.response.js +2 -0
- package/dist/types/interface/api/responses/short-link.response.d.ts +25 -0
- package/dist/types/interface/api/responses/short-link.response.js +2 -0
- package/dist/types/interface/api/responses/user-tag.response.d.ts +32 -0
- package/dist/types/interface/api/responses/user-tag.response.js +2 -0
- package/dist/types/interface/api/type-message/api-error.d.ts +6 -0
- package/dist/types/interface/api/type-message/api-error.js +2 -0
- package/dist/types/interface/api/type-message/base-paginate.d.ts +10 -0
- package/dist/types/interface/api/type-message/base-paginate.js +2 -0
- package/dist/types/interface/api/type-message/response.d.ts +5 -0
- package/dist/types/interface/api/type-message/response.js +2 -0
- package/dist/types/interface/index.d.ts +2 -0
- package/dist/types/interface/index.js +18 -0
- package/dist/types/interface/models/atlas-document.dto.d.ts +19 -0
- package/dist/types/interface/models/atlas-document.dto.js +2 -0
- package/dist/types/interface/models/atlas-group.dto.d.ts +18 -0
- package/dist/types/interface/models/atlas-group.dto.js +2 -0
- package/dist/types/interface/models/atlas-page-content.dto.d.ts +14 -0
- package/dist/types/interface/models/atlas-page-content.dto.js +2 -0
- package/dist/types/interface/models/atlas-page.dto.d.ts +23 -0
- package/dist/types/interface/models/atlas-page.dto.js +2 -0
- package/dist/types/interface/models/atlas.dto.d.ts +30 -0
- package/dist/types/interface/models/atlas.dto.js +2 -0
- package/dist/types/interface/models/board-activity.dto.d.ts +17 -0
- package/dist/types/interface/models/board-activity.dto.js +2 -0
- package/dist/types/interface/models/board-card-checklist-row.dto.d.ts +11 -0
- package/dist/types/interface/models/board-card-checklist-row.dto.js +2 -0
- package/dist/types/interface/models/board-card-checklist.dto.d.ts +13 -0
- package/dist/types/interface/models/board-card-checklist.dto.js +2 -0
- package/dist/types/interface/models/board-card-comment.dto.d.ts +12 -0
- package/dist/types/interface/models/board-card-comment.dto.js +2 -0
- package/dist/types/interface/models/board-card-document.dto.d.ts +19 -0
- package/dist/types/interface/models/board-card-document.dto.js +2 -0
- package/dist/types/interface/models/board-card-label.dto.d.ts +11 -0
- package/dist/types/interface/models/board-card-label.dto.js +2 -0
- package/dist/types/interface/models/board-card-member.dto.d.ts +11 -0
- package/dist/types/interface/models/board-card-member.dto.js +2 -0
- package/dist/types/interface/models/board-card.dto.d.ts +34 -0
- package/dist/types/interface/models/board-card.dto.js +2 -0
- package/dist/types/interface/models/board-column.dto.d.ts +14 -0
- package/dist/types/interface/models/board-column.dto.js +2 -0
- package/dist/types/interface/models/board-label.dto.d.ts +10 -0
- package/dist/types/interface/models/board-label.dto.js +2 -0
- package/dist/types/interface/models/board.dto.d.ts +29 -0
- package/dist/types/interface/models/board.dto.js +2 -0
- package/dist/types/interface/models/draw.dto.d.ts +25 -0
- package/dist/types/interface/models/draw.dto.js +2 -0
- package/dist/types/interface/models/index.d.ts +28 -0
- package/dist/types/interface/models/index.js +44 -0
- package/dist/types/interface/models/memo.dto.d.ts +19 -0
- package/dist/types/interface/models/memo.dto.js +2 -0
- package/dist/types/interface/models/organization.dto.d.ts +9 -0
- package/dist/types/interface/models/organization.dto.js +2 -0
- package/dist/types/interface/models/project.dto.d.ts +22 -0
- package/dist/types/interface/models/project.dto.js +2 -0
- package/dist/types/interface/models/retrospective-card.dto.d.ts +14 -0
- package/dist/types/interface/models/retrospective-card.dto.js +2 -0
- package/dist/types/interface/models/retrospective-member.dto.d.ts +12 -0
- package/dist/types/interface/models/retrospective-member.dto.js +2 -0
- package/dist/types/interface/models/retrospective-section.dto.d.ts +13 -0
- package/dist/types/interface/models/retrospective-section.dto.js +2 -0
- package/dist/types/interface/models/retrospective.dto.d.ts +29 -0
- package/dist/types/interface/models/retrospective.dto.js +2 -0
- package/dist/types/interface/models/short-link-click.dto.d.ts +30 -0
- package/dist/types/interface/models/short-link-click.dto.js +2 -0
- package/dist/types/interface/models/short-link.dto.d.ts +71 -0
- package/dist/types/interface/models/short-link.dto.js +2 -0
- package/dist/types/interface/models/user-tag.dto.d.ts +22 -0
- package/dist/types/interface/models/user-tag.dto.js +2 -0
- package/dist/types/interface/models/user.dto.d.ts +23 -0
- package/dist/types/interface/models/user.dto.js +2 -0
- package/dist/utils/board.utils.d.ts +5 -0
- package/dist/utils/board.utils.js +39 -0
- package/dist/utils/enum.utils.d.ts +1 -0
- package/dist/utils/enum.utils.js +9 -0
- package/dist/utils/error.utils.d.ts +15 -0
- package/dist/utils/error.utils.js +24 -0
- package/dist/utils/icons.utils.d.ts +75 -0
- package/dist/utils/icons.utils.js +86 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/shape.utils.d.ts +26 -0
- package/dist/utils/shape.utils.js +181 -0
- package/package.json +53 -0
- package/src/api/abyss.admin.api.ts +60 -0
- package/src/api/atlas-document.api.ts +68 -0
- package/src/api/atlas-group.api.ts +69 -0
- package/src/api/atlas-page-content.api.ts +0 -0
- package/src/api/atlas-page.api.ts +124 -0
- package/src/api/atlas.api.ts +65 -0
- package/src/api/atlas.public.api.ts +42 -0
- package/src/api/board-card-checklist.api.ts +99 -0
- package/src/api/board-card-comment.api.ts +57 -0
- package/src/api/board-card-document.api.ts +57 -0
- package/src/api/board-card.api.ts +137 -0
- package/src/api/board-column.api.ts +54 -0
- package/src/api/board-label.api.ts +87 -0
- package/src/api/board.api.ts +67 -0
- package/src/api/draw.api.ts +58 -0
- package/src/api/draw.public.api.ts +48 -0
- package/src/api/index.ts +43 -0
- package/src/api/memo.api.ts +59 -0
- package/src/api/metrics.api.ts +15 -0
- package/src/api/retrospective-card.api.ts +74 -0
- package/src/api/retrospective-member.api.ts +54 -0
- package/src/api/retrospective-section.api.ts +74 -0
- package/src/api/retrospective.api.ts +86 -0
- package/src/api/retrospective.public.api.ts +147 -0
- package/src/api/short-link.admin.api.ts +39 -0
- package/src/api/short-link.api.ts +90 -0
- package/src/api/short-link.public.api.ts +60 -0
- package/src/api/user-tag.api.ts +70 -0
- package/src/constants/atlas.constants.ts +2 -0
- package/src/constants/board.constants.ts +7 -0
- package/src/constants/index.ts +5 -0
- package/src/constants/memo.constants.ts +3 -0
- package/src/constants/short-link.constants.ts +11 -0
- package/src/constants/user-tag.constants.ts +3 -0
- package/src/index.ts +541 -0
- package/src/server-sent-events/index.ts +13 -0
- package/src/server-sent-events/protocols/atlas/atlas.sse-protocol.ts +90 -0
- package/src/server-sent-events/protocols/atlas/index.ts +1 -0
- package/src/server-sent-events/protocols/board/board.sse-protocol.ts +115 -0
- package/src/server-sent-events/protocols/board/index.ts +1 -0
- package/src/server-sent-events/protocols/board-card/board-card.sse-protocol.ts +26 -0
- package/src/server-sent-events/protocols/board-card/index.ts +1 -0
- package/src/server-sent-events/protocols/index.ts +26 -0
- package/src/server-sent-events/protocols/retrospective/index.ts +1 -0
- package/src/server-sent-events/protocols/retrospective/retrospective.sse-protocol.ts +92 -0
- package/src/server-sent-events/server-sent-events.manager.ts +73 -0
- package/src/types/draw.type.ts +173 -0
- package/src/types/enum/api-error.enum.ts +23 -0
- package/src/types/enum/board-activity.enum.ts +189 -0
- package/src/types/enum/board-column-type.enum.ts +6 -0
- package/src/types/enum/index.ts +3 -0
- package/src/types/index.ts +5 -0
- package/src/types/interface/api/index.ts +5 -0
- package/src/types/interface/api/requests/abyss.admin.request.ts +16 -0
- package/src/types/interface/api/requests/atlas-document.request.ts +32 -0
- package/src/types/interface/api/requests/atlas-group.request.ts +45 -0
- package/src/types/interface/api/requests/atlas-page.request.ts +84 -0
- package/src/types/interface/api/requests/atlas.public.request.ts +21 -0
- package/src/types/interface/api/requests/atlas.request.ts +40 -0
- package/src/types/interface/api/requests/board-card-checklist.request.ts +61 -0
- package/src/types/interface/api/requests/board-card-comment.request.ts +28 -0
- package/src/types/interface/api/requests/board-card-document.request.ts +29 -0
- package/src/types/interface/api/requests/board-card.request.ts +86 -0
- package/src/types/interface/api/requests/board-column.request.ts +30 -0
- package/src/types/interface/api/requests/board-label.request.ts +42 -0
- package/src/types/interface/api/requests/board.request.ts +30 -0
- package/src/types/interface/api/requests/draw.public.request.ts +20 -0
- package/src/types/interface/api/requests/draw.request.ts +37 -0
- package/src/types/interface/api/requests/index.ts +26 -0
- package/src/types/interface/api/requests/memo.request.ts +35 -0
- package/src/types/interface/api/requests/metrics.request.ts +3 -0
- package/src/types/interface/api/requests/retrospective-card.request.ts +38 -0
- package/src/types/interface/api/requests/retrospective-member.request.ts +20 -0
- package/src/types/interface/api/requests/retrospective-section.request.ts +43 -0
- package/src/types/interface/api/requests/retrospective.public.request.ts +84 -0
- package/src/types/interface/api/requests/retrospective.request.ts +46 -0
- package/src/types/interface/api/requests/short-link.admin.request.ts +35 -0
- package/src/types/interface/api/requests/short-link.public.request.ts +40 -0
- package/src/types/interface/api/requests/short-link.request.ts +57 -0
- package/src/types/interface/api/requests/user-tag.request.ts +45 -0
- package/src/types/interface/api/responses/abyss.admin.response.ts +17 -0
- package/src/types/interface/api/responses/atlas-document.response.ts +24 -0
- package/src/types/interface/api/responses/atlas-group.response.ts +23 -0
- package/src/types/interface/api/responses/atlas-page.response.ts +53 -0
- package/src/types/interface/api/responses/atlas.public.response.ts +21 -0
- package/src/types/interface/api/responses/atlas.response.ts +23 -0
- package/src/types/interface/api/responses/board-card-checklist.response.ts +31 -0
- package/src/types/interface/api/responses/board-card-comment.response.ts +20 -0
- package/src/types/interface/api/responses/board-card-document.response.ts +21 -0
- package/src/types/interface/api/responses/board-card.response.ts +55 -0
- package/src/types/interface/api/responses/board-column.response.ts +20 -0
- package/src/types/interface/api/responses/board-label.response.ts +31 -0
- package/src/types/interface/api/responses/board.response.ts +68 -0
- package/src/types/interface/api/responses/draw.public.response.ts +20 -0
- package/src/types/interface/api/responses/draw.response.ts +23 -0
- package/src/types/interface/api/responses/index.ts +26 -0
- package/src/types/interface/api/responses/memo.response.ts +23 -0
- package/src/types/interface/api/responses/metrics.response.ts +16 -0
- package/src/types/interface/api/responses/retrospective-card.response.ts +23 -0
- package/src/types/interface/api/responses/retrospective-member.response.ts +22 -0
- package/src/types/interface/api/responses/retrospective-section.response.ts +23 -0
- package/src/types/interface/api/responses/retrospective.public.response.ts +57 -0
- package/src/types/interface/api/responses/retrospective.response.ts +23 -0
- package/src/types/interface/api/responses/short-link.admin.response.ts +21 -0
- package/src/types/interface/api/responses/short-link.public.response.ts +26 -0
- package/src/types/interface/api/responses/short-link.response.ts +31 -0
- package/src/types/interface/api/responses/user-tag.response.ts +38 -0
- package/src/types/interface/api/type-message/api-error.ts +7 -0
- package/src/types/interface/api/type-message/base-paginate.ts +11 -0
- package/src/types/interface/api/type-message/response.ts +6 -0
- package/src/types/interface/index.ts +2 -0
- package/src/types/interface/models/atlas-document.dto.ts +22 -0
- package/src/types/interface/models/atlas-group.dto.ts +21 -0
- package/src/types/interface/models/atlas-page-content.dto.ts +17 -0
- package/src/types/interface/models/atlas-page.dto.ts +26 -0
- package/src/types/interface/models/atlas.dto.ts +34 -0
- package/src/types/interface/models/board-activity.dto.ts +20 -0
- package/src/types/interface/models/board-card-checklist-row.dto.ts +14 -0
- package/src/types/interface/models/board-card-checklist.dto.ts +16 -0
- package/src/types/interface/models/board-card-comment.dto.ts +15 -0
- package/src/types/interface/models/board-card-document.dto.ts +22 -0
- package/src/types/interface/models/board-card-label.dto.ts +14 -0
- package/src/types/interface/models/board-card-member.dto.ts +14 -0
- package/src/types/interface/models/board-card.dto.ts +37 -0
- package/src/types/interface/models/board-column.dto.ts +17 -0
- package/src/types/interface/models/board-label.dto.ts +13 -0
- package/src/types/interface/models/board.dto.ts +32 -0
- package/src/types/interface/models/draw.dto.ts +28 -0
- package/src/types/interface/models/index.ts +28 -0
- package/src/types/interface/models/memo.dto.ts +22 -0
- package/src/types/interface/models/organization.dto.ts +12 -0
- package/src/types/interface/models/project.dto.ts +25 -0
- package/src/types/interface/models/retrospective-card.dto.ts +17 -0
- package/src/types/interface/models/retrospective-member.dto.ts +15 -0
- package/src/types/interface/models/retrospective-section.dto.ts +16 -0
- package/src/types/interface/models/retrospective.dto.ts +32 -0
- package/src/types/interface/models/short-link-click.dto.ts +33 -0
- package/src/types/interface/models/short-link.dto.ts +48 -0
- package/src/types/interface/models/user-tag.dto.ts +26 -0
- package/src/types/interface/models/user.dto.ts +26 -0
- package/src/utils/board.utils.ts +57 -0
- package/src/utils/enum.utils.ts +6 -0
- package/src/utils/error.utils.ts +30 -0
- package/src/utils/icons.utils.ts +96 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/shape.utils.ts +296 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IShortLink } from './short-link.dto';
|
|
2
|
+
|
|
3
|
+
export interface IShortLinkClick {
|
|
4
|
+
id: string;
|
|
5
|
+
shortLinkId: string;
|
|
6
|
+
ipAddress: string | null;
|
|
7
|
+
ipHash: string;
|
|
8
|
+
userAgent: string | null;
|
|
9
|
+
referer: string | null;
|
|
10
|
+
refererDomain: string | null;
|
|
11
|
+
/** Code pays ISO-3 (ex: "FRA", "USA", "DEU") */
|
|
12
|
+
countryCodeIso: string | null;
|
|
13
|
+
countryCode: string | null;
|
|
14
|
+
countryName: string | null;
|
|
15
|
+
continentCode: string | null;
|
|
16
|
+
city: string | null;
|
|
17
|
+
device: string | null;
|
|
18
|
+
browser: string | null;
|
|
19
|
+
os: string | null;
|
|
20
|
+
language: string | null;
|
|
21
|
+
utmSource: string | null;
|
|
22
|
+
utmMedium: string | null;
|
|
23
|
+
utmCampaign: string | null;
|
|
24
|
+
utmTerm: string | null;
|
|
25
|
+
utmContent: string | null;
|
|
26
|
+
isBotLikely: boolean;
|
|
27
|
+
isReturningVisitor: boolean;
|
|
28
|
+
clickedAt: Date;
|
|
29
|
+
createdAt?: Date;
|
|
30
|
+
updatedAt?: Date;
|
|
31
|
+
|
|
32
|
+
shortLink?: IShortLink;
|
|
33
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { IOrganization } from './organization.dto';
|
|
2
|
+
import { IUser } from './user.dto';
|
|
3
|
+
import { IProject } from './project.dto';
|
|
4
|
+
import { IShortLinkClick } from './short-link-click.dto';
|
|
5
|
+
import { IEntityUserTag } from './user-tag.dto';
|
|
6
|
+
|
|
7
|
+
export interface IShortLink {
|
|
8
|
+
id: string;
|
|
9
|
+
slug: string;
|
|
10
|
+
originalUrl: string;
|
|
11
|
+
title: string | null;
|
|
12
|
+
description: string | null;
|
|
13
|
+
userId: string | null;
|
|
14
|
+
projectId: string | null;
|
|
15
|
+
organizationId: string | null;
|
|
16
|
+
isActive: boolean;
|
|
17
|
+
clickCount: number;
|
|
18
|
+
uniqueClickCount: number;
|
|
19
|
+
lastClickedAt: Date | null;
|
|
20
|
+
expiresAt: Date | null;
|
|
21
|
+
maxClicks: number | null;
|
|
22
|
+
password: string | null;
|
|
23
|
+
createdAt?: Date;
|
|
24
|
+
updatedAt?: Date;
|
|
25
|
+
deletedAt?: Date | null;
|
|
26
|
+
|
|
27
|
+
user?: IUser | null;
|
|
28
|
+
project?: IProject | null;
|
|
29
|
+
organization?: IOrganization | null;
|
|
30
|
+
shortLinkClicks?: IShortLinkClick[];
|
|
31
|
+
entityUserTags?: IEntityUserTag[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IShortLinkWithStats extends IShortLink {
|
|
35
|
+
stats?: {
|
|
36
|
+
clicksByDay: { date: string; clicks: number; uniqueClicks: number }[];
|
|
37
|
+
clicksByCountry: { country: string; clicks: number; countryName: string }[];
|
|
38
|
+
clicksByDevice: { device: string; clicks: number }[];
|
|
39
|
+
clicksByBrowser: { browser: string; clicks: number }[];
|
|
40
|
+
clicksByReferer: { referer: string; clicks: number }[];
|
|
41
|
+
clicksByUtmSource: { utmSource: string; clicks: number }[];
|
|
42
|
+
clicksByLanguage: { language: string; clicks: number }[];
|
|
43
|
+
clicksByRefererDomain: { refererDomain: string; clicks: number }[];
|
|
44
|
+
clicksLast24h: number;
|
|
45
|
+
returningVisitorsCount: number;
|
|
46
|
+
botClicksCount: number;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface IUserTag {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
color: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
organizationId: string | null;
|
|
7
|
+
createdAt?: Date;
|
|
8
|
+
updatedAt?: Date;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Junction type for entity-tag relationships
|
|
12
|
+
export interface IEntityUserTag {
|
|
13
|
+
id: string;
|
|
14
|
+
entityId: string;
|
|
15
|
+
entityType: string;
|
|
16
|
+
userTagId: string;
|
|
17
|
+
createdAt?: Date;
|
|
18
|
+
userTag?: IUserTag | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Stats entry for tag usage counts
|
|
22
|
+
export interface IUserTagStatEntry {
|
|
23
|
+
userTagId: string;
|
|
24
|
+
entityType: string;
|
|
25
|
+
count: number;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IAtlas } from './atlas.dto';
|
|
2
|
+
import { IBoard } from './board.dto';
|
|
3
|
+
import { IBoardCardComment } from './board-card-comment.dto';
|
|
4
|
+
import { IDraw } from './draw.dto';
|
|
5
|
+
import { IMemo } from './memo.dto';
|
|
6
|
+
import { IProject } from './project.dto';
|
|
7
|
+
import { IRetrospective } from './retrospective.dto';
|
|
8
|
+
import { IShortLink } from './short-link.dto';
|
|
9
|
+
|
|
10
|
+
export interface IUser {
|
|
11
|
+
id?: string;
|
|
12
|
+
apiKey: string;
|
|
13
|
+
isAdmin: boolean;
|
|
14
|
+
updatedAt?: Date;
|
|
15
|
+
createdAt?: Date;
|
|
16
|
+
|
|
17
|
+
// Associations
|
|
18
|
+
projects?: IProject[];
|
|
19
|
+
boards?: IBoard[];
|
|
20
|
+
draws?: IDraw[];
|
|
21
|
+
retrospectives?: IRetrospective[];
|
|
22
|
+
atlases?: IAtlas[];
|
|
23
|
+
memos?: IMemo[];
|
|
24
|
+
shortLinks?: IShortLink[];
|
|
25
|
+
boardCardComments?: IBoardCardComment[];
|
|
26
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { differenceInCalendarDays, isBefore } from 'date-fns';
|
|
2
|
+
import { BoardColumnType, IBoardCard } from '../types';
|
|
3
|
+
|
|
4
|
+
const BOARD_COLUMN_TYPE_STARTED = [BoardColumnType.DOING, BoardColumnType.DONE];
|
|
5
|
+
const BOARD_COLUMN_TYPE_DONE = [BoardColumnType.DONE];
|
|
6
|
+
|
|
7
|
+
export const isCardStartDateLate = (
|
|
8
|
+
boardCard: IBoardCard,
|
|
9
|
+
boardColumnType: BoardColumnType,
|
|
10
|
+
): boolean => {
|
|
11
|
+
if (!boardCard.startDate) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return (
|
|
15
|
+
isBefore(new Date(boardCard.startDate), new Date()) &&
|
|
16
|
+
!BOARD_COLUMN_TYPE_STARTED.includes(boardColumnType)
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const isAlmostCardStartDateLate = (
|
|
21
|
+
boardCard: IBoardCard,
|
|
22
|
+
boardColumnType: BoardColumnType,
|
|
23
|
+
): boolean => {
|
|
24
|
+
if (!boardCard.startDate) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return (
|
|
28
|
+
!isCardStartDateLate(boardCard, boardColumnType) &&
|
|
29
|
+
differenceInCalendarDays(new Date(boardCard.startDate), new Date()) <= 2
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const isCardEndDateLate = (
|
|
34
|
+
boardCard: IBoardCard,
|
|
35
|
+
boardColumnType: BoardColumnType,
|
|
36
|
+
): boolean => {
|
|
37
|
+
if (!boardCard.endDate) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return (
|
|
41
|
+
isBefore(new Date(boardCard.endDate), new Date()) &&
|
|
42
|
+
!BOARD_COLUMN_TYPE_DONE.includes(boardColumnType)
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const isAlmostCardEndDateLate = (
|
|
47
|
+
boardCard: IBoardCard,
|
|
48
|
+
boardColumnType: BoardColumnType,
|
|
49
|
+
): boolean => {
|
|
50
|
+
if (!boardCard.endDate) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return (
|
|
54
|
+
!isCardEndDateLate(boardCard, boardColumnType) &&
|
|
55
|
+
Math.abs(differenceInCalendarDays(new Date(boardCard.endDate), new Date())) <= 2
|
|
56
|
+
);
|
|
57
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Code, ErrorType } from '../types';
|
|
2
|
+
|
|
3
|
+
type ErrorParams = { code: Code; type: ErrorType; message?: string };
|
|
4
|
+
|
|
5
|
+
export class ServiceException extends Error {
|
|
6
|
+
private readonly code: Code;
|
|
7
|
+
|
|
8
|
+
private readonly type: ErrorType;
|
|
9
|
+
|
|
10
|
+
getCode(): Code {
|
|
11
|
+
return this.code;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getType(): ErrorType {
|
|
15
|
+
return this.type;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
constructor(params: ErrorParams) {
|
|
19
|
+
super(params.message);
|
|
20
|
+
this.code = params.code;
|
|
21
|
+
this.type = params.type;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const handleError = (error: Error | ErrorParams, _params?: ErrorParams): Error => {
|
|
26
|
+
if (error instanceof Error) {
|
|
27
|
+
return error;
|
|
28
|
+
}
|
|
29
|
+
return new ServiceException(error);
|
|
30
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export const ICON_LIBRARY = {
|
|
2
|
+
database: '🗄️',
|
|
3
|
+
server: '🖥️',
|
|
4
|
+
cloud: '☁️',
|
|
5
|
+
network: '🌐',
|
|
6
|
+
router: '📡',
|
|
7
|
+
security: '🔒',
|
|
8
|
+
warning: '⚠️',
|
|
9
|
+
error: '❌',
|
|
10
|
+
success: '✅',
|
|
11
|
+
info: 'ℹ️',
|
|
12
|
+
|
|
13
|
+
diamond: '💎',
|
|
14
|
+
gear: '⚙️',
|
|
15
|
+
tool: '🔧',
|
|
16
|
+
wrench: '🔨',
|
|
17
|
+
|
|
18
|
+
arrowUp: '⬆️',
|
|
19
|
+
arrowDown: '⬇️',
|
|
20
|
+
arrowLeft: '⬅️',
|
|
21
|
+
arrowRight: '➡️',
|
|
22
|
+
arrowUpRight: '↗️',
|
|
23
|
+
arrowDownRight: '↘️',
|
|
24
|
+
arrowDownLeft: '↙️',
|
|
25
|
+
arrowUpLeft: '↖️',
|
|
26
|
+
|
|
27
|
+
start: '🚀',
|
|
28
|
+
stop: '🛑',
|
|
29
|
+
pause: '⏸️',
|
|
30
|
+
play: '▶️',
|
|
31
|
+
process: '⚡',
|
|
32
|
+
|
|
33
|
+
email: '📧',
|
|
34
|
+
phone: '📞',
|
|
35
|
+
message: '💬',
|
|
36
|
+
notification: '🔔',
|
|
37
|
+
|
|
38
|
+
document: '📄',
|
|
39
|
+
folder: '📁',
|
|
40
|
+
file: '📋',
|
|
41
|
+
pdf: '📕',
|
|
42
|
+
image: '🖼️',
|
|
43
|
+
|
|
44
|
+
user: '👤',
|
|
45
|
+
users: '👥',
|
|
46
|
+
team: '👪',
|
|
47
|
+
admin: '👨💼',
|
|
48
|
+
|
|
49
|
+
add: '➕',
|
|
50
|
+
remove: '➖',
|
|
51
|
+
edit: '✏️',
|
|
52
|
+
search: '🔍',
|
|
53
|
+
filter: '🔽',
|
|
54
|
+
sort: '📊',
|
|
55
|
+
|
|
56
|
+
online: '🟢',
|
|
57
|
+
offline: '🔴',
|
|
58
|
+
pending: '🟡',
|
|
59
|
+
unknown: '⚪',
|
|
60
|
+
|
|
61
|
+
circle: '⭕',
|
|
62
|
+
square: '⬜',
|
|
63
|
+
triangle: '🔺',
|
|
64
|
+
star: '⭐',
|
|
65
|
+
heart: '❤️',
|
|
66
|
+
|
|
67
|
+
settings: '⚙️',
|
|
68
|
+
power: '🔌',
|
|
69
|
+
battery: '🔋',
|
|
70
|
+
wifi: '📶',
|
|
71
|
+
bluetooth: '📲',
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const ICON_CATEGORIES = {
|
|
75
|
+
technical: ['database', 'server', 'cloud', 'network', 'router', 'security'],
|
|
76
|
+
status: ['warning', 'error', 'success', 'info', 'online', 'offline', 'pending', 'unknown'],
|
|
77
|
+
arrows: [
|
|
78
|
+
'arrowUp',
|
|
79
|
+
'arrowDown',
|
|
80
|
+
'arrowLeft',
|
|
81
|
+
'arrowRight',
|
|
82
|
+
'arrowUpRight',
|
|
83
|
+
'arrowDownRight',
|
|
84
|
+
'arrowDownLeft',
|
|
85
|
+
'arrowUpLeft',
|
|
86
|
+
],
|
|
87
|
+
process: ['start', 'stop', 'pause', 'play', 'process', 'gear', 'tool', 'wrench'],
|
|
88
|
+
communication: ['email', 'phone', 'message', 'notification'],
|
|
89
|
+
files: ['document', 'folder', 'file', 'pdf', 'image'],
|
|
90
|
+
users: ['user', 'users', 'team', 'admin'],
|
|
91
|
+
actions: ['add', 'remove', 'edit', 'search', 'filter', 'sort'],
|
|
92
|
+
shapes: ['circle', 'square', 'triangle', 'star', 'heart', 'diamond'],
|
|
93
|
+
system: ['settings', 'power', 'battery', 'wifi', 'bluetooth'],
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export type IconType = keyof typeof ICON_LIBRARY;
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { ICON_LIBRARY } from './icons.utils';
|
|
2
|
+
import {
|
|
3
|
+
Id,
|
|
4
|
+
Point,
|
|
5
|
+
DrawSize,
|
|
6
|
+
DrawStyle,
|
|
7
|
+
DrawShapeType,
|
|
8
|
+
DrawShapeToJsonResult,
|
|
9
|
+
} from '../types/draw.type';
|
|
10
|
+
|
|
11
|
+
export type Endpoint = {
|
|
12
|
+
style: DrawArrowEndpointStyle;
|
|
13
|
+
} & (
|
|
14
|
+
| { kind: 'free'; x: number; y: number }
|
|
15
|
+
| { kind: 'anchor'; shapeId: Id; relativeX: number; relativeY: number }
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export type DrawArrowEndpointStyle = 'arrow' | 'circle' | 'square' | 'diamond' | 'none';
|
|
19
|
+
|
|
20
|
+
export type CurvePoint = Point & {
|
|
21
|
+
type: 'straight' | 'curved'; // type de courbure: angle droit ou arrondi
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const rectangleToSvg = (position: Point, size: DrawSize, style: DrawStyle): string => {
|
|
25
|
+
const x = position.x - size.width / 2;
|
|
26
|
+
const y = position.y - size.height / 2;
|
|
27
|
+
const width = size.width;
|
|
28
|
+
const height = size.height;
|
|
29
|
+
const fillColor = style.fillColor === 'none' ? 'none' : style.fillColor;
|
|
30
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
31
|
+
const centerX = position.x;
|
|
32
|
+
const centerY = position.y;
|
|
33
|
+
|
|
34
|
+
return `<rect x="${x}" y="${y}" width="${width}" height="${height}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${
|
|
35
|
+
style.strokeWidth
|
|
36
|
+
}" opacity="${style.opacity}" rx="${style.cornerRadius}" ry="${
|
|
37
|
+
style.cornerRadius
|
|
38
|
+
}" stroke-dasharray="${style.lineDash || 'none'}" transform="rotate(${
|
|
39
|
+
style.rotation
|
|
40
|
+
} ${centerX} ${centerY})" />`;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const diamondToSvg = (position: Point, size: DrawSize, style: DrawStyle): string => {
|
|
44
|
+
const cx = position.x;
|
|
45
|
+
const cy = position.y;
|
|
46
|
+
const halfWidth = size.width / 2;
|
|
47
|
+
const halfHeight = size.height / 2;
|
|
48
|
+
const fillColor = style.fillColor === 'none' ? 'none' : style.fillColor;
|
|
49
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
50
|
+
|
|
51
|
+
const points = [
|
|
52
|
+
`${cx},${cy - halfHeight}`, // Top
|
|
53
|
+
`${cx + halfWidth},${cy}`, // Right
|
|
54
|
+
`${cx},${cy + halfHeight}`, // Bottom
|
|
55
|
+
`${cx - halfWidth},${cy}`, // Left
|
|
56
|
+
].join(' ');
|
|
57
|
+
|
|
58
|
+
return `<polygon points="${points}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${
|
|
59
|
+
style.strokeWidth
|
|
60
|
+
}" stroke-dasharray="${style.lineDash || 'none'}" opacity="${style.opacity}" transform="rotate(${
|
|
61
|
+
style.rotation
|
|
62
|
+
} ${cx} ${cy})" />`;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const ellipseToSvg = (position: Point, size: DrawSize, style: DrawStyle): string => {
|
|
66
|
+
const cx = position.x;
|
|
67
|
+
const cy = position.y;
|
|
68
|
+
const radiusX = size.width / 2;
|
|
69
|
+
const radiusY = size.height / 2;
|
|
70
|
+
const fillColor = style.fillColor === 'none' ? 'none' : style.fillColor;
|
|
71
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
72
|
+
|
|
73
|
+
return `<ellipse cx="${cx}" cy="${cy}" rx="${radiusX}" ry="${radiusY}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${
|
|
74
|
+
style.strokeWidth
|
|
75
|
+
}" opacity="${style.opacity}" stroke-dasharray="${style.lineDash || 'none'}" transform="rotate(${
|
|
76
|
+
style.rotation
|
|
77
|
+
} ${cx} ${cy})" />`;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const textToSvg = (position: Point, style: DrawStyle, text: string): string => {
|
|
81
|
+
const x = position.x;
|
|
82
|
+
const y = position.y;
|
|
83
|
+
const fillColor = style.fillColor === 'none' ? 'none' : style.fillColor;
|
|
84
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
85
|
+
|
|
86
|
+
return `<text x="${x}" y="${y}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${
|
|
87
|
+
style.strokeWidth
|
|
88
|
+
}" opacity="${style.opacity}" font-size="${style.fontSize}" font-family="${style.fontFamily}"
|
|
89
|
+
stroke-dasharray="${
|
|
90
|
+
style.lineDash || 'none'
|
|
91
|
+
}" text-anchor="middle" dominant-baseline="middle" transform="rotate(${
|
|
92
|
+
style.rotation
|
|
93
|
+
} ${x} ${y})">${text}</text>`;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const iconToSvg = (
|
|
97
|
+
position: Point,
|
|
98
|
+
size: DrawSize,
|
|
99
|
+
style: DrawStyle,
|
|
100
|
+
iconSymbol: string,
|
|
101
|
+
): string => {
|
|
102
|
+
const x = position.x;
|
|
103
|
+
const y = position.y;
|
|
104
|
+
const fillColor = style.fillColor === 'none' ? 'none' : style.fillColor;
|
|
105
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
106
|
+
const fontSize = Math.min(size.width, size.height) * 0.8;
|
|
107
|
+
|
|
108
|
+
return `<text x="${x}" y="${y}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${style.strokeWidth}" opacity="${style.opacity}" font-size="${fontSize}" font-family="Arial" text-anchor="middle" dominant-baseline="middle" transform="rotate(${style.rotation} ${x} ${y})">${iconSymbol}</text>`;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const imageToSvg = (
|
|
112
|
+
position: Point,
|
|
113
|
+
size: DrawSize,
|
|
114
|
+
style: DrawStyle,
|
|
115
|
+
src: string,
|
|
116
|
+
): string => {
|
|
117
|
+
const x = position.x - size.width / 2;
|
|
118
|
+
const y = position.y - size.height / 2;
|
|
119
|
+
const width = size.width;
|
|
120
|
+
const height = size.height;
|
|
121
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
122
|
+
const centerX = position.x;
|
|
123
|
+
const centerY = position.y;
|
|
124
|
+
|
|
125
|
+
return `<image x="${x}" y="${y}" width="${width}" height="${height}" href="${src}" opacity="${style.opacity}" stroke="${strokeColor}" stroke-width="${style.strokeWidth}" rx="${style.cornerRadius}" ry="${style.cornerRadius}" transform="rotate(${style.rotation} ${centerX} ${centerY})" />`;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const commentToSvg = (
|
|
129
|
+
position: Point,
|
|
130
|
+
size: DrawSize,
|
|
131
|
+
style: DrawStyle,
|
|
132
|
+
id: string,
|
|
133
|
+
): string => {
|
|
134
|
+
const cx = position.x;
|
|
135
|
+
const cy = position.y;
|
|
136
|
+
const radius = size.width / 2;
|
|
137
|
+
const fillColor = style.fillColor === 'none' ? 'transparent' : style.fillColor;
|
|
138
|
+
const strokeColor = style.strokeColor === 'none' ? 'none' : style.strokeColor;
|
|
139
|
+
const fontSize = size.width * 0.6;
|
|
140
|
+
|
|
141
|
+
// Calculate text position to center the "!" character
|
|
142
|
+
const textX = cx;
|
|
143
|
+
const textY = cy + fontSize * 0.35; // Adjust for vertical centering
|
|
144
|
+
|
|
145
|
+
return `
|
|
146
|
+
<g opacity="${style.opacity}" transform="rotate(${style.rotation} ${cx} ${cy})">
|
|
147
|
+
<defs>
|
|
148
|
+
<filter id="comment-shadow-${id}" x="-50%" y="-50%" width="200%" height="200%">
|
|
149
|
+
<feDropShadow dx="2" dy="2" stdDeviation="5" flood-color="black" flood-opacity="0.3"/>
|
|
150
|
+
</filter>
|
|
151
|
+
</defs>
|
|
152
|
+
<circle cx="${cx}" cy="${cy}" r="${radius}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${style.strokeWidth}" filter="url(#comment-shadow-${id})" />
|
|
153
|
+
<text x="${textX}" y="${textY}" fill="white" font-size="${fontSize}" font-family="Arial" text-anchor="middle" dominant-baseline="middle" font-weight="bold">!</text>
|
|
154
|
+
</g>`;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const renderEndpointStyleSvg = (
|
|
158
|
+
x: number,
|
|
159
|
+
y: number,
|
|
160
|
+
style: DrawArrowEndpointStyle,
|
|
161
|
+
angle: number,
|
|
162
|
+
strokeColor: string,
|
|
163
|
+
fillColor: string,
|
|
164
|
+
strokeWidth: number,
|
|
165
|
+
): string => {
|
|
166
|
+
switch (style) {
|
|
167
|
+
case 'circle':
|
|
168
|
+
return `<circle cx="${x}" cy="${y}" r="6" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${strokeWidth}" />`;
|
|
169
|
+
|
|
170
|
+
case 'square':
|
|
171
|
+
const squareX = x - 6;
|
|
172
|
+
const squareY = y - 6;
|
|
173
|
+
return `<rect x="${squareX}" y="${squareY}" width="12" height="12" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${strokeWidth}" transform="rotate(${
|
|
174
|
+
angle * (180 / Math.PI)
|
|
175
|
+
} ${x} ${y})" />`;
|
|
176
|
+
|
|
177
|
+
case 'diamond':
|
|
178
|
+
return `<polygon points="${x},${y - 6} ${x + 6},${y} ${x},${y + 6} ${
|
|
179
|
+
x - 6
|
|
180
|
+
},${y}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${strokeWidth}" transform="rotate(${
|
|
181
|
+
angle * (180 / Math.PI)
|
|
182
|
+
} ${x} ${y})" />`;
|
|
183
|
+
|
|
184
|
+
case 'arrow':
|
|
185
|
+
const arrowSize = 8;
|
|
186
|
+
const x1 = x - arrowSize * Math.cos(angle - Math.PI / 6);
|
|
187
|
+
const y1 = y - arrowSize * Math.sin(angle - Math.PI / 6);
|
|
188
|
+
const x2 = x - arrowSize * Math.cos(angle + Math.PI / 6);
|
|
189
|
+
const y2 = y - arrowSize * Math.sin(angle + Math.PI / 6);
|
|
190
|
+
return `<polygon points="${x},${y} ${x1},${y1} ${x2},${y2}" fill="${fillColor}" stroke="${strokeColor}" stroke-width="${strokeWidth}" />`;
|
|
191
|
+
|
|
192
|
+
case 'none':
|
|
193
|
+
default:
|
|
194
|
+
return '';
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export const arrowToSvg = (
|
|
199
|
+
style: DrawStyle,
|
|
200
|
+
startEndpoint: Endpoint,
|
|
201
|
+
endEndpoint: Endpoint,
|
|
202
|
+
fromPos: Point,
|
|
203
|
+
toPos: Point,
|
|
204
|
+
): string => {
|
|
205
|
+
const angle = Math.atan2(toPos.y - fromPos.y, toPos.x - fromPos.x);
|
|
206
|
+
|
|
207
|
+
let svg = `<g opacity="${style.opacity}">`;
|
|
208
|
+
|
|
209
|
+
svg += `<line x1="${fromPos.x}" y1="${fromPos.y}" x2="${toPos.x}" y2="${toPos.y}" stroke="${style.strokeColor}" stroke-width="${style.strokeWidth}" />`;
|
|
210
|
+
|
|
211
|
+
svg += renderEndpointStyleSvg(
|
|
212
|
+
fromPos.x,
|
|
213
|
+
fromPos.y,
|
|
214
|
+
startEndpoint.style as DrawArrowEndpointStyle,
|
|
215
|
+
angle + Math.PI,
|
|
216
|
+
style.strokeColor,
|
|
217
|
+
style.fillColor,
|
|
218
|
+
style.strokeWidth,
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
svg += renderEndpointStyleSvg(
|
|
222
|
+
toPos.x,
|
|
223
|
+
toPos.y,
|
|
224
|
+
endEndpoint.style as DrawArrowEndpointStyle,
|
|
225
|
+
angle,
|
|
226
|
+
style.strokeColor,
|
|
227
|
+
style.fillColor,
|
|
228
|
+
style.strokeWidth,
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
svg += '</g>';
|
|
232
|
+
|
|
233
|
+
return svg;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export const sceneToSVG = (
|
|
237
|
+
shapes: DrawShapeToJsonResult[],
|
|
238
|
+
width: number,
|
|
239
|
+
height: number,
|
|
240
|
+
): string => {
|
|
241
|
+
const shapeEls = shapes
|
|
242
|
+
.sort((a, b) => (a.zIndex || 0) - (b.zIndex || 0))
|
|
243
|
+
.map((s) => {
|
|
244
|
+
switch (s.type) {
|
|
245
|
+
case DrawShapeType.RECTANGLE:
|
|
246
|
+
return rectangleToSvg(s.position, s.size, s.style);
|
|
247
|
+
case DrawShapeType.DIAMOND:
|
|
248
|
+
return diamondToSvg(s.position, s.size, s.style);
|
|
249
|
+
case DrawShapeType.ELLIPSE:
|
|
250
|
+
return ellipseToSvg(s.position, s.size, s.style);
|
|
251
|
+
case DrawShapeType.TEXT:
|
|
252
|
+
return textToSvg(s.position, s.style, s.text || '');
|
|
253
|
+
case DrawShapeType.ICON:
|
|
254
|
+
const iconSymbol = ICON_LIBRARY[s.iconType] || '';
|
|
255
|
+
return iconToSvg(s.position, s.size, s.style, iconSymbol);
|
|
256
|
+
case DrawShapeType.IMAGE:
|
|
257
|
+
return imageToSvg(s.position, s.size, s.style, s.src);
|
|
258
|
+
case DrawShapeType.COMMENT:
|
|
259
|
+
return commentToSvg(s.position, s.size, s.style, s.id);
|
|
260
|
+
case DrawShapeType.ARROW:
|
|
261
|
+
if (s.startEndpoint && s.endEndpoint) {
|
|
262
|
+
const fromPos =
|
|
263
|
+
s.startEndpoint.kind === 'anchor'
|
|
264
|
+
? shapes.find((shape) => shape.id === (s.startEndpoint as any)?.shapeId)?.position
|
|
265
|
+
: {
|
|
266
|
+
x: (s.startEndpoint as any).x,
|
|
267
|
+
y: (s.startEndpoint as any).y,
|
|
268
|
+
};
|
|
269
|
+
const toPos =
|
|
270
|
+
s.endEndpoint.kind === 'anchor'
|
|
271
|
+
? shapes.find((shape) => shape.id === (s.endEndpoint as any)?.shapeId)?.position
|
|
272
|
+
: {
|
|
273
|
+
x: (s.endEndpoint as any).x,
|
|
274
|
+
y: (s.endEndpoint as any).y,
|
|
275
|
+
};
|
|
276
|
+
if (!fromPos || !toPos) return '';
|
|
277
|
+
return arrowToSvg(s.style, s.startEndpoint, s.endEndpoint, fromPos, toPos);
|
|
278
|
+
}
|
|
279
|
+
return '';
|
|
280
|
+
default:
|
|
281
|
+
return '';
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
const defs = `
|
|
286
|
+
<defs>
|
|
287
|
+
<marker id="arrow" markerWidth="10" markerHeight="10" refX="10" refY="5" orient="auto-start-reverse">
|
|
288
|
+
<path d="M0,0 L10,5 L0,10 z" fill="currentColor"/>
|
|
289
|
+
</marker>
|
|
290
|
+
</defs>`;
|
|
291
|
+
|
|
292
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
|
|
293
|
+
${defs}
|
|
294
|
+
${shapeEls.join('\n')}
|
|
295
|
+
</svg>`;
|
|
296
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"incremental": false,
|
|
4
|
+
"target": "es2019",
|
|
5
|
+
"lib": ["dom", "ES2019"],
|
|
6
|
+
"experimentalDecorators": true,
|
|
7
|
+
"emitDecoratorMetadata": true,
|
|
8
|
+
"module": "commonjs",
|
|
9
|
+
"rootDir": "./src",
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"allowJs": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"outDir": "./dist",
|
|
15
|
+
"removeComments": true,
|
|
16
|
+
"allowSyntheticDefaultImports": true,
|
|
17
|
+
"esModuleInterop": true,
|
|
18
|
+
"forceConsistentCasingInFileNames": true,
|
|
19
|
+
"strict": true,
|
|
20
|
+
"strictPropertyInitialization": false,
|
|
21
|
+
"skipLibCheck": true
|
|
22
|
+
},
|
|
23
|
+
"exclude": ["./dist/**/*"]
|
|
24
|
+
}
|