@bgx4k3p/huly-mcp-server 2.2.4 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +186 -56
- package/node_modules/@hcengineering/account-client/lib/__tests__/utils.test.js +249 -0
- package/node_modules/@hcengineering/account-client/lib/__tests__/utils.test.js.map +7 -0
- package/node_modules/@hcengineering/account-client/lib/client.js +88 -3
- package/node_modules/@hcengineering/account-client/lib/client.js.map +2 -2
- package/node_modules/@hcengineering/account-client/lib/types.js.map +2 -2
- package/node_modules/@hcengineering/account-client/lib/utils.js +50 -0
- package/node_modules/@hcengineering/account-client/lib/utils.js.map +2 -2
- package/node_modules/@hcengineering/account-client/package.json +22 -19
- package/node_modules/@hcengineering/account-client/src/__tests__/utils.test.ts +304 -0
- package/node_modules/@hcengineering/account-client/src/client.ts +127 -6
- package/node_modules/@hcengineering/account-client/src/types.ts +7 -0
- package/node_modules/@hcengineering/account-client/src/utils.ts +65 -1
- package/node_modules/@hcengineering/analytics/lib/index.js +1 -1
- package/node_modules/@hcengineering/analytics/lib/index.js.map +2 -2
- package/node_modules/@hcengineering/analytics/package.json +19 -16
- package/node_modules/@hcengineering/analytics/src/index.ts +2 -1
- package/node_modules/@hcengineering/api-client/lib/client.js +9 -4
- package/node_modules/@hcengineering/api-client/lib/client.js.map +2 -2
- package/node_modules/@hcengineering/api-client/lib/rest/adapter.js +64 -0
- package/node_modules/@hcengineering/api-client/lib/rest/adapter.js.map +7 -0
- package/node_modules/@hcengineering/api-client/lib/rest/index.js +2 -0
- package/node_modules/@hcengineering/api-client/lib/rest/index.js.map +2 -2
- package/node_modules/@hcengineering/api-client/lib/socket/node.js +5 -1
- package/node_modules/@hcengineering/api-client/lib/socket/node.js.map +2 -2
- package/node_modules/@hcengineering/api-client/package.json +28 -25
- package/node_modules/@hcengineering/api-client/src/client.ts +10 -1
- package/node_modules/@hcengineering/api-client/src/rest/adapter.ts +96 -0
- package/node_modules/@hcengineering/api-client/src/rest/index.ts +1 -0
- package/node_modules/@hcengineering/api-client/src/socket/node.ts +6 -1
- package/node_modules/@hcengineering/chunter/lib/index.js.map +2 -2
- package/node_modules/@hcengineering/chunter/package.json +13 -10
- package/node_modules/@hcengineering/client/package.json +21 -18
- package/node_modules/@hcengineering/client-resources/package.json +24 -21
- package/node_modules/@hcengineering/collaborator-client/package.json +21 -18
- package/node_modules/@hcengineering/contact/lib/__tests__/workspaceMemberStatusUtils.test.js +38 -0
- package/node_modules/@hcengineering/contact/lib/__tests__/workspaceMemberStatusUtils.test.js.map +7 -0
- package/node_modules/@hcengineering/contact/lib/index.js +13 -4
- package/node_modules/@hcengineering/contact/lib/index.js.map +2 -2
- package/node_modules/@hcengineering/contact/lib/types.js.map +1 -1
- package/node_modules/@hcengineering/contact/lib/utils.js +132 -108
- package/node_modules/@hcengineering/contact/lib/utils.js.map +3 -3
- package/node_modules/@hcengineering/contact/lib/workspaceMemberStatusUtils.js +79 -0
- package/node_modules/@hcengineering/contact/lib/workspaceMemberStatusUtils.js.map +7 -0
- package/node_modules/@hcengineering/contact/package.json +12 -9
- package/node_modules/@hcengineering/core/CHANGELOG.md +9 -1
- package/node_modules/@hcengineering/core/lang/cs.json +6 -1
- package/node_modules/@hcengineering/core/lang/de.json +6 -1
- package/node_modules/@hcengineering/core/lang/en.json +6 -1
- package/node_modules/@hcengineering/core/lang/es.json +6 -1
- package/node_modules/@hcengineering/core/lang/fr.json +6 -1
- package/node_modules/@hcengineering/core/lang/it.json +6 -1
- package/node_modules/@hcengineering/core/lang/ja.json +6 -1
- package/node_modules/@hcengineering/core/lang/pt-br.json +70 -0
- package/node_modules/@hcengineering/core/lang/pt.json +6 -1
- package/node_modules/@hcengineering/core/lang/ru.json +6 -1
- package/node_modules/@hcengineering/core/lang/tr.json +6 -1
- package/node_modules/@hcengineering/core/lang/zh.json +6 -1
- package/node_modules/@hcengineering/core/lib/__tests__/autoJoinRoles.test.js +13 -0
- package/node_modules/@hcengineering/core/lib/__tests__/autoJoinRoles.test.js.map +7 -0
- package/node_modules/@hcengineering/core/lib/__tests__/memdb.test.js +133 -0
- package/node_modules/@hcengineering/core/lib/__tests__/memdb.test.js.map +2 -2
- package/node_modules/@hcengineering/core/lib/__tests__/minmodel.js +25 -0
- package/node_modules/@hcengineering/core/lib/__tests__/minmodel.js.map +2 -2
- package/node_modules/@hcengineering/core/lib/__tests__/query.test.js +43 -0
- package/node_modules/@hcengineering/core/lib/__tests__/query.test.js.map +7 -0
- package/node_modules/@hcengineering/core/lib/autoJoinRoles.js +36 -0
- package/node_modules/@hcengineering/core/lib/autoJoinRoles.js.map +7 -0
- package/node_modules/@hcengineering/core/lib/classes.js +5 -0
- package/node_modules/@hcengineering/core/lib/classes.js.map +3 -3
- package/node_modules/@hcengineering/core/lib/clone.js +13 -2
- package/node_modules/@hcengineering/core/lib/clone.js.map +2 -2
- package/node_modules/@hcengineering/core/lib/component.js +14 -3
- package/node_modules/@hcengineering/core/lib/component.js.map +2 -2
- package/node_modules/@hcengineering/core/lib/index.js +2 -0
- package/node_modules/@hcengineering/core/lib/index.js.map +2 -2
- package/node_modules/@hcengineering/core/lib/memdb.js +6 -2
- package/node_modules/@hcengineering/core/lib/memdb.js.map +2 -2
- package/node_modules/@hcengineering/core/lib/operations.js +11 -0
- package/node_modules/@hcengineering/core/lib/operations.js.map +2 -2
- package/node_modules/@hcengineering/core/lib/predicate.js +3 -0
- package/node_modules/@hcengineering/core/lib/predicate.js.map +2 -2
- package/node_modules/@hcengineering/core/lib/storage.js.map +2 -2
- package/node_modules/@hcengineering/core/lib/tx.js +3 -1
- package/node_modules/@hcengineering/core/lib/tx.js.map +2 -2
- package/node_modules/@hcengineering/core/lib/utils.js +1 -1
- package/node_modules/@hcengineering/core/lib/utils.js.map +2 -2
- package/node_modules/@hcengineering/core/lib/versioning.js +17 -0
- package/node_modules/@hcengineering/core/lib/versioning.js.map +7 -0
- package/node_modules/@hcengineering/core/package.json +22 -19
- package/node_modules/@hcengineering/core/src/__tests__/autoJoinRoles.test.ts +27 -0
- package/node_modules/@hcengineering/core/src/__tests__/memdb.test.ts +150 -1
- package/node_modules/@hcengineering/core/src/__tests__/minmodel.ts +29 -1
- package/node_modules/@hcengineering/core/src/__tests__/query.test.ts +66 -0
- package/node_modules/@hcengineering/core/src/autoJoinRoles.ts +33 -0
- package/node_modules/@hcengineering/core/src/classes.ts +61 -1
- package/node_modules/@hcengineering/core/src/clone.ts +13 -2
- package/node_modules/@hcengineering/core/src/component.ts +25 -9
- package/node_modules/@hcengineering/core/src/index.ts +2 -0
- package/node_modules/@hcengineering/core/src/memdb.ts +7 -3
- package/node_modules/@hcengineering/core/src/operations.ts +11 -0
- package/node_modules/@hcengineering/core/src/predicate.ts +3 -0
- package/node_modules/@hcengineering/core/src/storage.ts +6 -3
- package/node_modules/@hcengineering/core/src/tx.ts +4 -1
- package/node_modules/@hcengineering/core/src/utils.ts +1 -1
- package/node_modules/@hcengineering/core/src/versioning.ts +13 -0
- package/node_modules/@hcengineering/measurements/lib/__tests__/performance.test.js +3 -3
- package/node_modules/@hcengineering/measurements/lib/__tests__/performance.test.js.map +2 -2
- package/node_modules/@hcengineering/measurements/package.json +17 -14
- package/node_modules/@hcengineering/measurements/src/__tests__/performance.test.ts +3 -3
- package/node_modules/@hcengineering/platform/lang/pt-br.json +31 -0
- package/node_modules/@hcengineering/platform/lib/__tests__/i18n.test.js +100 -0
- package/node_modules/@hcengineering/platform/lib/__tests__/i18n.test.js.map +2 -2
- package/node_modules/@hcengineering/platform/lib/__tests__/status.test.js +78 -0
- package/node_modules/@hcengineering/platform/lib/__tests__/status.test.js.map +7 -0
- package/node_modules/@hcengineering/platform/lib/i18n.js +78 -69
- package/node_modules/@hcengineering/platform/lib/i18n.js.map +3 -3
- package/node_modules/@hcengineering/platform/lib/status.js +25 -0
- package/node_modules/@hcengineering/platform/lib/status.js.map +2 -2
- package/node_modules/@hcengineering/platform/package.json +18 -15
- package/node_modules/@hcengineering/platform/src/__tests__/i18n.test.ts +114 -2
- package/node_modules/@hcengineering/platform/src/__tests__/status.test.ts +77 -0
- package/node_modules/@hcengineering/platform/src/i18n.ts +99 -71
- package/node_modules/@hcengineering/platform/src/status.ts +30 -0
- package/node_modules/@hcengineering/rank/package.json +19 -16
- package/node_modules/@hcengineering/rpc/package.json +21 -18
- package/node_modules/@hcengineering/tags/package.json +12 -9
- package/node_modules/@hcengineering/task/package.json +14 -11
- package/node_modules/@hcengineering/text/lib/markup/__tests__/utils.test.js +25 -0
- package/node_modules/@hcengineering/text/lib/markup/__tests__/utils.test.js.map +2 -2
- package/node_modules/@hcengineering/text/lib/tiptapExtensions.js +6 -0
- package/node_modules/@hcengineering/text/lib/tiptapExtensions.js.map +2 -2
- package/node_modules/@hcengineering/text/package.json +23 -18
- package/node_modules/@hcengineering/text/src/markup/__tests__/utils.test.ts +27 -0
- package/node_modules/@hcengineering/text/src/tiptapExtensions.ts +3 -0
- package/node_modules/@hcengineering/text-core/lib/markup/model.js +1 -0
- package/node_modules/@hcengineering/text-core/lib/markup/model.js.map +2 -2
- package/node_modules/@hcengineering/text-core/package.json +20 -17
- package/node_modules/@hcengineering/text-core/src/markup/model.ts +2 -1
- package/node_modules/@hcengineering/text-html/package.json +19 -16
- package/node_modules/@hcengineering/text-markdown/lib/serializer.js +14 -0
- package/node_modules/@hcengineering/text-markdown/lib/serializer.js.map +2 -2
- package/node_modules/@hcengineering/text-markdown/package.json +20 -17
- package/node_modules/@hcengineering/text-markdown/src/serializer.ts +14 -0
- package/node_modules/@hcengineering/tracker/lib/index.js +1 -0
- package/node_modules/@hcengineering/tracker/lib/index.js.map +2 -2
- package/node_modules/@hcengineering/tracker/package.json +16 -13
- package/node_modules/@tiptap/core/dist/commands/focus.d.ts.map +1 -1
- package/node_modules/@tiptap/core/dist/index.cjs +19 -2
- package/node_modules/@tiptap/core/dist/index.cjs.map +1 -1
- package/node_modules/@tiptap/core/dist/index.js +19 -3
- package/node_modules/@tiptap/core/dist/index.js.map +1 -1
- package/node_modules/@tiptap/core/dist/index.umd.js +19 -2
- package/node_modules/@tiptap/core/dist/index.umd.js.map +1 -1
- package/node_modules/@tiptap/core/dist/utilities/index.d.ts +1 -0
- package/node_modules/@tiptap/core/dist/utilities/index.d.ts.map +1 -1
- package/node_modules/@tiptap/core/dist/utilities/isSafari.d.ts +10 -0
- package/node_modules/@tiptap/core/dist/utilities/isSafari.d.ts.map +1 -0
- package/node_modules/@tiptap/core/package.json +2 -2
- package/node_modules/@tiptap/core/src/commands/focus.ts +7 -2
- package/node_modules/@tiptap/core/src/utilities/index.ts +1 -0
- package/node_modules/@tiptap/core/src/utilities/isSafari.ts +11 -0
- package/node_modules/@tiptap/extension-blockquote/package.json +2 -2
- package/node_modules/@tiptap/extension-bold/package.json +2 -2
- package/node_modules/@tiptap/extension-bullet-list/package.json +2 -2
- package/node_modules/@tiptap/extension-code/package.json +2 -2
- package/node_modules/@tiptap/extension-code-block/package.json +3 -3
- package/node_modules/@tiptap/extension-document/package.json +2 -2
- package/node_modules/@tiptap/extension-dropcursor/package.json +3 -3
- package/node_modules/@tiptap/extension-gapcursor/package.json +3 -3
- package/node_modules/@tiptap/extension-hard-break/package.json +2 -2
- package/node_modules/@tiptap/extension-heading/package.json +2 -2
- package/node_modules/@tiptap/extension-highlight/package.json +2 -2
- package/node_modules/@tiptap/extension-history/package.json +3 -3
- package/node_modules/@tiptap/extension-horizontal-rule/package.json +3 -3
- package/node_modules/@tiptap/extension-italic/package.json +2 -2
- package/node_modules/@tiptap/extension-link/package.json +3 -3
- package/node_modules/@tiptap/extension-list-item/package.json +2 -2
- package/node_modules/@tiptap/extension-mention/package.json +4 -4
- package/node_modules/@tiptap/extension-ordered-list/package.json +2 -2
- package/node_modules/@tiptap/extension-paragraph/package.json +2 -2
- package/node_modules/@tiptap/extension-strike/package.json +2 -2
- package/node_modules/@tiptap/extension-subscript/README.md +14 -0
- package/node_modules/@tiptap/extension-subscript/dist/index.cjs +61 -0
- package/node_modules/@tiptap/extension-subscript/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/extension-subscript/dist/index.d.ts +4 -0
- package/node_modules/@tiptap/extension-subscript/dist/index.d.ts.map +1 -0
- package/node_modules/@tiptap/extension-subscript/dist/index.js +56 -0
- package/node_modules/@tiptap/extension-subscript/dist/index.js.map +1 -0
- package/node_modules/@tiptap/extension-subscript/dist/index.umd.js +65 -0
- package/node_modules/@tiptap/extension-subscript/dist/index.umd.js.map +1 -0
- package/node_modules/@tiptap/extension-subscript/dist/subscript.d.ts +36 -0
- package/node_modules/@tiptap/extension-subscript/dist/subscript.d.ts.map +1 -0
- package/node_modules/@tiptap/extension-subscript/package.json +49 -0
- package/node_modules/@tiptap/extension-subscript/src/index.ts +5 -0
- package/node_modules/@tiptap/extension-subscript/src/subscript.ts +91 -0
- package/node_modules/@tiptap/extension-superscript/README.md +14 -0
- package/node_modules/@tiptap/extension-superscript/dist/index.cjs +61 -0
- package/node_modules/@tiptap/extension-superscript/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/extension-superscript/dist/index.d.ts +4 -0
- package/node_modules/@tiptap/extension-superscript/dist/index.d.ts.map +1 -0
- package/node_modules/@tiptap/extension-superscript/dist/index.js +56 -0
- package/node_modules/@tiptap/extension-superscript/dist/index.js.map +1 -0
- package/node_modules/@tiptap/extension-superscript/dist/index.umd.js +65 -0
- package/node_modules/@tiptap/extension-superscript/dist/index.umd.js.map +1 -0
- package/node_modules/@tiptap/extension-superscript/dist/superscript.d.ts +36 -0
- package/node_modules/@tiptap/extension-superscript/dist/superscript.d.ts.map +1 -0
- package/node_modules/@tiptap/extension-superscript/package.json +49 -0
- package/node_modules/@tiptap/extension-superscript/src/index.ts +5 -0
- package/node_modules/@tiptap/extension-superscript/src/superscript.ts +91 -0
- package/node_modules/@tiptap/extension-table/package.json +3 -3
- package/node_modules/@tiptap/extension-table-cell/package.json +2 -2
- package/node_modules/@tiptap/extension-table-header/package.json +2 -2
- package/node_modules/@tiptap/extension-table-row/package.json +2 -2
- package/node_modules/@tiptap/extension-task-item/package.json +3 -3
- package/node_modules/@tiptap/extension-task-list/package.json +2 -2
- package/node_modules/@tiptap/extension-text/package.json +2 -2
- package/node_modules/@tiptap/extension-typography/package.json +2 -2
- package/node_modules/@tiptap/extension-underline/package.json +2 -2
- package/node_modules/@tiptap/html/package.json +3 -3
- package/node_modules/@tiptap/pm/package.json +1 -1
- package/node_modules/@tiptap/starter-kit/node_modules/@tiptap/extension-text-style/package.json +2 -2
- package/node_modules/@tiptap/starter-kit/package.json +22 -22
- package/node_modules/@tiptap/suggestion/package.json +3 -3
- package/node_modules/linkify-it/build/index.cjs.js +99 -94
- package/node_modules/linkify-it/index.mjs +99 -94
- package/node_modules/linkify-it/package.json +11 -1
- package/node_modules/linkifyjs/README.md +4 -2
- package/node_modules/linkifyjs/dist/linkify.cjs +8 -11
- package/node_modules/linkifyjs/dist/linkify.d.cts +14 -14
- package/node_modules/linkifyjs/dist/linkify.d.mts +14 -14
- package/node_modules/linkifyjs/dist/linkify.js +8 -11
- package/node_modules/linkifyjs/dist/linkify.min.js +1 -1
- package/node_modules/linkifyjs/dist/linkify.mjs +8 -11
- package/node_modules/linkifyjs/package.json +1 -1
- package/node_modules/markdown-it/README.md +13 -17
- package/node_modules/markdown-it/dist/index.cjs.js +111 -31
- package/node_modules/markdown-it/dist/markdown-it.js +117 -31
- package/node_modules/markdown-it/dist/markdown-it.min.js +2 -2
- package/node_modules/markdown-it/lib/common/utils.mjs +30 -1
- package/node_modules/markdown-it/lib/index.mjs +1 -1
- package/node_modules/markdown-it/lib/rules_block/heading.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_block/html_block.mjs +12 -1
- package/node_modules/markdown-it/lib/rules_block/lheading.mjs +4 -1
- package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +3 -1
- package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +37 -21
- package/node_modules/markdown-it/lib/rules_inline/entity.mjs +2 -2
- package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +37 -6
- package/node_modules/markdown-it/package.json +14 -3
- package/node_modules/msgpackr/README.md +1 -3
- package/node_modules/msgpackr/benchmark.md +26 -16
- package/node_modules/msgpackr/dist/index-no-eval.cjs +35 -16
- package/node_modules/msgpackr/dist/index-no-eval.cjs.map +1 -1
- package/node_modules/msgpackr/dist/index-no-eval.min.js +1 -1
- package/node_modules/msgpackr/dist/index-no-eval.min.js.map +1 -1
- package/node_modules/msgpackr/dist/index.js +35 -16
- package/node_modules/msgpackr/dist/index.js.map +1 -1
- package/node_modules/msgpackr/dist/index.min.js +1 -1
- package/node_modules/msgpackr/dist/index.min.js.map +1 -1
- package/node_modules/msgpackr/dist/node.cjs +50 -26
- package/node_modules/msgpackr/dist/node.cjs.map +1 -1
- package/node_modules/msgpackr/dist/test.js +44 -16
- package/node_modules/msgpackr/dist/test.js.map +1 -1
- package/node_modules/msgpackr/dist/unpack-no-eval.cjs +35 -16
- package/node_modules/msgpackr/dist/unpack-no-eval.cjs.map +1 -1
- package/node_modules/msgpackr/index.d.cts +2 -0
- package/node_modules/msgpackr/index.d.ts +2 -0
- package/node_modules/msgpackr/package.json +1 -1
- package/node_modules/msgpackr/stream.js +15 -10
- package/node_modules/msgpackr/unpack.js +35 -16
- package/node_modules/prosemirror-changeset/CHANGELOG.md +12 -0
- package/node_modules/prosemirror-changeset/README.md +31 -2
- package/node_modules/prosemirror-changeset/dist/index.cjs +17 -2
- package/node_modules/prosemirror-changeset/dist/index.d.cts +32 -2
- package/node_modules/prosemirror-changeset/dist/index.d.ts +32 -2
- package/node_modules/prosemirror-changeset/dist/index.js +18 -3
- package/node_modules/prosemirror-changeset/package.json +2 -2
- package/node_modules/prosemirror-changeset/src/README.md +4 -2
- package/node_modules/prosemirror-changeset/src/change.ts +18 -0
- package/node_modules/prosemirror-changeset/src/changeset.ts +10 -4
- package/node_modules/prosemirror-changeset/src/simplify.ts +1 -1
- package/node_modules/prosemirror-changeset/test/test-simplify.ts +3 -0
- package/node_modules/prosemirror-gapcursor/CHANGELOG.md +6 -0
- package/node_modules/prosemirror-gapcursor/dist/index.cjs +1 -1
- package/node_modules/prosemirror-gapcursor/dist/index.js +1 -1
- package/node_modules/prosemirror-gapcursor/package.json +3 -2
- package/node_modules/prosemirror-gapcursor/src/gapcursor.ts +1 -1
- package/node_modules/prosemirror-markdown/CHANGELOG.md +12 -0
- package/node_modules/prosemirror-markdown/dist/index.cjs +11 -1
- package/node_modules/prosemirror-markdown/dist/index.js +14 -2
- package/node_modules/prosemirror-markdown/package.json +1 -1
- package/node_modules/prosemirror-markdown/src/to_markdown.ts +12 -3
- package/node_modules/prosemirror-menu/CHANGELOG.md +18 -0
- package/node_modules/prosemirror-menu/CONTRIBUTING.md +22 -18
- package/node_modules/prosemirror-menu/README.md +69 -29
- package/node_modules/prosemirror-menu/dist/index.cjs +232 -48
- package/node_modules/prosemirror-menu/dist/index.d.cts +29 -14
- package/node_modules/prosemirror-menu/dist/index.d.ts +29 -14
- package/node_modules/prosemirror-menu/dist/index.js +229 -36
- package/node_modules/prosemirror-menu/package.json +2 -2
- package/node_modules/prosemirror-menu/src/README.md +30 -1
- package/node_modules/prosemirror-menu/src/icons.ts +3 -2
- package/node_modules/prosemirror-menu/src/menu.ts +193 -40
- package/node_modules/prosemirror-menu/src/menubar.ts +50 -5
- package/node_modules/prosemirror-menu/style/menu.css +28 -7
- package/node_modules/prosemirror-model/CHANGELOG.md +20 -0
- package/node_modules/prosemirror-model/CONTRIBUTING.md +19 -19
- package/node_modules/prosemirror-model/README.md +3 -3
- package/node_modules/prosemirror-model/dist/index.cjs +13 -10
- package/node_modules/prosemirror-model/dist/index.d.cts +25 -21
- package/node_modules/prosemirror-model/dist/index.d.ts +25 -21
- package/node_modules/prosemirror-model/dist/index.js +19 -23
- package/node_modules/prosemirror-model/package.json +2 -2
- package/node_modules/prosemirror-model/src/fragment.ts +1 -1
- package/node_modules/prosemirror-model/src/from_dom.ts +4 -1
- package/node_modules/prosemirror-model/src/node.ts +5 -4
- package/node_modules/prosemirror-model/src/replace.ts +6 -15
- package/node_modules/prosemirror-model/src/schema.ts +1 -1
- package/node_modules/prosemirror-model/src/to_dom.ts +24 -20
- package/node_modules/prosemirror-transform/CHANGELOG.md +16 -0
- package/node_modules/prosemirror-transform/dist/index.cjs +38 -4
- package/node_modules/prosemirror-transform/dist/index.d.cts +19 -0
- package/node_modules/prosemirror-transform/dist/index.d.ts +19 -0
- package/node_modules/prosemirror-transform/dist/index.js +52 -1
- package/node_modules/prosemirror-transform/package.json +1 -1
- package/node_modules/prosemirror-transform/src/replace.ts +16 -0
- package/node_modules/prosemirror-transform/src/replace_step.ts +10 -1
- package/node_modules/prosemirror-transform/src/transform.ts +21 -2
- package/node_modules/prosemirror-view/CHANGELOG.md +34 -2
- package/node_modules/prosemirror-view/CONTRIBUTING.md +19 -19
- package/node_modules/prosemirror-view/README.md +3 -3
- package/node_modules/prosemirror-view/dist/index.cjs +96 -40
- package/node_modules/prosemirror-view/dist/index.d.cts +2 -2
- package/node_modules/prosemirror-view/dist/index.d.ts +2 -2
- package/node_modules/prosemirror-view/dist/index.js +90 -39
- package/node_modules/prosemirror-view/package.json +2 -2
- package/node_modules/prosemirror-view/src/domchange.ts +1 -1
- package/node_modules/prosemirror-view/src/domobserver.ts +59 -16
- package/node_modules/prosemirror-view/src/index.ts +4 -4
- package/node_modules/prosemirror-view/src/input.ts +9 -6
- package/node_modules/prosemirror-view/src/viewdesc.ts +26 -22
- package/node_modules/prosemirror-view/style/prosemirror.css +1 -1
- package/package.json +5 -4
- package/src/client.mjs +2 -2
- package/src/config.mjs +1 -0
- package/src/helpers.mjs +2 -2
- package/src/index.mjs +31 -1
- package/src/initCodex.mjs +281 -0
- package/src/mcp.mjs +1 -1
- package/src/mcpShared.mjs +95 -5
- package/node_modules/@hcengineering/account-client/types/client.d.ts +0 -140
- package/node_modules/@hcengineering/account-client/types/client.d.ts.map +0 -1
- package/node_modules/@hcengineering/account-client/types/index.d.ts +0 -4
- package/node_modules/@hcengineering/account-client/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/account-client/types/types.d.ts +0 -177
- package/node_modules/@hcengineering/account-client/types/types.d.ts.map +0 -1
- package/node_modules/@hcengineering/account-client/types/utils.d.ts +0 -5
- package/node_modules/@hcengineering/account-client/types/utils.d.ts.map +0 -1
- package/node_modules/@hcengineering/analytics/types/index.d.ts +0 -25
- package/node_modules/@hcengineering/analytics/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/__tests__/config.test.d.ts +0 -2
- package/node_modules/@hcengineering/api-client/types/__tests__/config.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/__tests__/markup-client.test.d.ts +0 -2
- package/node_modules/@hcengineering/api-client/types/__tests__/markup-client.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/__tests__/markup-types.test.d.ts +0 -2
- package/node_modules/@hcengineering/api-client/types/__tests__/markup-types.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/__tests__/rest-utils.test.d.ts +0 -2
- package/node_modules/@hcengineering/api-client/types/__tests__/rest-utils.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/__tests__/utils.test.d.ts +0 -2
- package/node_modules/@hcengineering/api-client/types/__tests__/utils.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/client.d.ts +0 -6
- package/node_modules/@hcengineering/api-client/types/client.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/config.d.ts +0 -8
- package/node_modules/@hcengineering/api-client/types/config.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/index.d.ts +0 -9
- package/node_modules/@hcengineering/api-client/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/markup/client.d.ts +0 -5
- package/node_modules/@hcengineering/api-client/types/markup/client.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/markup/index.d.ts +0 -3
- package/node_modules/@hcengineering/api-client/types/markup/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/markup/types.d.ts +0 -41
- package/node_modules/@hcengineering/api-client/types/markup/types.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/rest/index.d.ts +0 -4
- package/node_modules/@hcengineering/api-client/types/rest/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/rest/rest.d.ts +0 -39
- package/node_modules/@hcengineering/api-client/types/rest/rest.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/rest/tx.d.ts +0 -3
- package/node_modules/@hcengineering/api-client/types/rest/tx.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/rest/types.d.ts +0 -16
- package/node_modules/@hcengineering/api-client/types/rest/types.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/rest/utils.d.ts +0 -3
- package/node_modules/@hcengineering/api-client/types/rest/utils.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/socket/browser.d.ts +0 -4
- package/node_modules/@hcengineering/api-client/types/socket/browser.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/socket/index.d.ts +0 -3
- package/node_modules/@hcengineering/api-client/types/socket/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/socket/node.d.ts +0 -4
- package/node_modules/@hcengineering/api-client/types/socket/node.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/storage/client.d.ts +0 -21
- package/node_modules/@hcengineering/api-client/types/storage/client.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/storage/error.d.ts +0 -10
- package/node_modules/@hcengineering/api-client/types/storage/error.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/storage/index.d.ts +0 -4
- package/node_modules/@hcengineering/api-client/types/storage/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/storage/types.d.ts +0 -10
- package/node_modules/@hcengineering/api-client/types/storage/types.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/types.d.ts +0 -101
- package/node_modules/@hcengineering/api-client/types/types.d.ts.map +0 -1
- package/node_modules/@hcengineering/api-client/types/utils.d.ts +0 -12
- package/node_modules/@hcengineering/api-client/types/utils.d.ts.map +0 -1
- package/node_modules/@hcengineering/chunter/types/analytics.d.ts +0 -5
- package/node_modules/@hcengineering/chunter/types/analytics.d.ts.map +0 -1
- package/node_modules/@hcengineering/chunter/types/index.d.ts +0 -211
- package/node_modules/@hcengineering/chunter/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/chunter/types/utils.d.ts +0 -7
- package/node_modules/@hcengineering/chunter/types/utils.d.ts.map +0 -1
- package/node_modules/@hcengineering/client/types/__tests__/client.test.d.ts +0 -2
- package/node_modules/@hcengineering/client/types/__tests__/client.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/client/types/index.d.ts +0 -69
- package/node_modules/@hcengineering/client/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/client-resources/types/__tests__/connection.test.d.ts +0 -2
- package/node_modules/@hcengineering/client-resources/types/__tests__/connection.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/client-resources/types/__tests__/integration.test.d.ts +0 -45
- package/node_modules/@hcengineering/client-resources/types/__tests__/integration.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/client-resources/types/connection.d.ts +0 -7
- package/node_modules/@hcengineering/client-resources/types/connection.d.ts.map +0 -1
- package/node_modules/@hcengineering/client-resources/types/index.d.ts +0 -11
- package/node_modules/@hcengineering/client-resources/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/collaborator-client/types/__tests__/utils.test.d.ts +0 -2
- package/node_modules/@hcengineering/collaborator-client/types/__tests__/utils.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/collaborator-client/types/client.d.ts +0 -34
- package/node_modules/@hcengineering/collaborator-client/types/client.d.ts.map +0 -1
- package/node_modules/@hcengineering/collaborator-client/types/index.d.ts +0 -3
- package/node_modules/@hcengineering/collaborator-client/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/collaborator-client/types/utils.d.ts +0 -9
- package/node_modules/@hcengineering/collaborator-client/types/utils.d.ts.map +0 -1
- package/node_modules/@hcengineering/contact/types/__tests__/cache.test.d.ts +0 -2
- package/node_modules/@hcengineering/contact/types/__tests__/cache.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/contact/types/analytics.d.ts +0 -6
- package/node_modules/@hcengineering/contact/types/analytics.d.ts.map +0 -1
- package/node_modules/@hcengineering/contact/types/avatar.d.ts +0 -12
- package/node_modules/@hcengineering/contact/types/avatar.d.ts.map +0 -1
- package/node_modules/@hcengineering/contact/types/cache.d.ts +0 -49
- package/node_modules/@hcengineering/contact/types/cache.d.ts.map +0 -1
- package/node_modules/@hcengineering/contact/types/index.d.ts +0 -367
- package/node_modules/@hcengineering/contact/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/contact/types/types.d.ts +0 -25
- package/node_modules/@hcengineering/contact/types/types.d.ts.map +0 -1
- package/node_modules/@hcengineering/contact/types/utils.d.ts +0 -110
- package/node_modules/@hcengineering/contact/types/utils.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/client.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/client.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/clone.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/clone.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/collaboration.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/collaboration.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/collaborators.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/collaborators.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/common.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/common.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/connection.d.ts +0 -4
- package/node_modules/@hcengineering/core/types/__tests__/connection.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/contexts.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/contexts.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/hierarchy.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/hierarchy.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/lang.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/lang.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/limiter-edge-cases.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/limiter-edge-cases.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/limits.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/limits.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/memdb.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/memdb.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/minmodel.d.ts +0 -50
- package/node_modules/@hcengineering/core/types/__tests__/minmodel.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/objvalue.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/objvalue.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/operator-bugs.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/operator-bugs.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/operator.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/operator.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/rate-limiter.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/rate-limiter.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/time.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/time.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/__tests__/utils.test.d.ts +0 -2
- package/node_modules/@hcengineering/core/types/__tests__/utils.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/backup.d.ts +0 -26
- package/node_modules/@hcengineering/core/types/backup.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/benchmark.d.ts +0 -19
- package/node_modules/@hcengineering/core/types/benchmark.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/classes.d.ts +0 -716
- package/node_modules/@hcengineering/core/types/classes.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/client.d.ts +0 -69
- package/node_modules/@hcengineering/core/types/client.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/clone.d.ts +0 -3
- package/node_modules/@hcengineering/core/types/clone.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/collaboration.d.ts +0 -16
- package/node_modules/@hcengineering/core/types/collaboration.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/collaborators.d.ts +0 -3
- package/node_modules/@hcengineering/core/types/collaborators.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/common.d.ts +0 -4
- package/node_modules/@hcengineering/core/types/common.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/component.d.ts +0 -229
- package/node_modules/@hcengineering/core/types/component.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/hierarchy.d.ts +0 -84
- package/node_modules/@hcengineering/core/types/hierarchy.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/index.d.ts +0 -25
- package/node_modules/@hcengineering/core/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/memdb.d.ts +0 -60
- package/node_modules/@hcengineering/core/types/memdb.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/objvalue.d.ts +0 -10
- package/node_modules/@hcengineering/core/types/objvalue.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/operations.d.ts +0 -87
- package/node_modules/@hcengineering/core/types/operations.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/operator.d.ts +0 -16
- package/node_modules/@hcengineering/core/types/operator.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/predicate.d.ts +0 -6
- package/node_modules/@hcengineering/core/types/predicate.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/proxy.d.ts +0 -21
- package/node_modules/@hcengineering/core/types/proxy.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/query.d.ts +0 -21
- package/node_modules/@hcengineering/core/types/query.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/server.d.ts +0 -82
- package/node_modules/@hcengineering/core/types/server.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/status.d.ts +0 -30
- package/node_modules/@hcengineering/core/types/status.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/storage.d.ts +0 -233
- package/node_modules/@hcengineering/core/types/storage.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/time.d.ts +0 -8
- package/node_modules/@hcengineering/core/types/time.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/tx.d.ts +0 -261
- package/node_modules/@hcengineering/core/types/tx.d.ts.map +0 -1
- package/node_modules/@hcengineering/core/types/utils.d.ts +0 -207
- package/node_modules/@hcengineering/core/types/utils.d.ts.map +0 -1
- package/node_modules/@hcengineering/measurements/types/__tests__/context.test.d.ts +0 -2
- package/node_modules/@hcengineering/measurements/types/__tests__/context.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/measurements/types/__tests__/index.test.d.ts +0 -2
- package/node_modules/@hcengineering/measurements/types/__tests__/index.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/measurements/types/__tests__/metrics.test.d.ts +0 -2
- package/node_modules/@hcengineering/measurements/types/__tests__/metrics.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/measurements/types/__tests__/performance.test.d.ts +0 -2
- package/node_modules/@hcengineering/measurements/types/__tests__/performance.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/measurements/types/context.d.ts +0 -64
- package/node_modules/@hcengineering/measurements/types/context.d.ts.map +0 -1
- package/node_modules/@hcengineering/measurements/types/index.d.ts +0 -12
- package/node_modules/@hcengineering/measurements/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/measurements/types/metrics.d.ts +0 -34
- package/node_modules/@hcengineering/measurements/types/metrics.d.ts.map +0 -1
- package/node_modules/@hcengineering/measurements/types/types.d.ts +0 -88
- package/node_modules/@hcengineering/measurements/types/types.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/__tests__/i18n.test.d.ts +0 -2
- package/node_modules/@hcengineering/platform/types/__tests__/i18n.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/__tests__/ident.test.d.ts +0 -2
- package/node_modules/@hcengineering/platform/types/__tests__/ident.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/__tests__/plugin.d.ts +0 -7
- package/node_modules/@hcengineering/platform/types/__tests__/plugin.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/__tests__/resource.test.d.ts +0 -2
- package/node_modules/@hcengineering/platform/types/__tests__/resource.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/event.d.ts +0 -39
- package/node_modules/@hcengineering/platform/types/event.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/i18n.d.ts +0 -28
- package/node_modules/@hcengineering/platform/types/i18n.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/ident.d.ts +0 -14
- package/node_modules/@hcengineering/platform/types/ident.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/index.d.ts +0 -19
- package/node_modules/@hcengineering/platform/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/metadata.d.ts +0 -38
- package/node_modules/@hcengineering/platform/types/metadata.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/platform.d.ts +0 -218
- package/node_modules/@hcengineering/platform/types/platform.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/resource.d.ts +0 -49
- package/node_modules/@hcengineering/platform/types/resource.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/status.d.ts +0 -60
- package/node_modules/@hcengineering/platform/types/status.d.ts.map +0 -1
- package/node_modules/@hcengineering/platform/types/testUtils.d.ts +0 -8
- package/node_modules/@hcengineering/platform/types/testUtils.d.ts.map +0 -1
- package/node_modules/@hcengineering/rank/types/__tests__/utils.test.d.ts +0 -2
- package/node_modules/@hcengineering/rank/types/__tests__/utils.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/rank/types/index.d.ts +0 -3
- package/node_modules/@hcengineering/rank/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/rank/types/types.d.ts +0 -2
- package/node_modules/@hcengineering/rank/types/types.d.ts.map +0 -1
- package/node_modules/@hcengineering/rank/types/utils.d.ts +0 -6
- package/node_modules/@hcengineering/rank/types/utils.d.ts.map +0 -1
- package/node_modules/@hcengineering/rpc/types/index.d.ts +0 -3
- package/node_modules/@hcengineering/rpc/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/rpc/types/rpc.d.ts +0 -96
- package/node_modules/@hcengineering/rpc/types/rpc.d.ts.map +0 -1
- package/node_modules/@hcengineering/rpc/types/sliding.d.ts +0 -11
- package/node_modules/@hcengineering/rpc/types/sliding.d.ts.map +0 -1
- package/node_modules/@hcengineering/rpc/types/test/rateLimit.spec.d.ts +0 -2
- package/node_modules/@hcengineering/rpc/types/test/rateLimit.spec.d.ts.map +0 -1
- package/node_modules/@hcengineering/tags/types/analytics.d.ts +0 -5
- package/node_modules/@hcengineering/tags/types/analytics.d.ts.map +0 -1
- package/node_modules/@hcengineering/tags/types/index.d.ts +0 -105
- package/node_modules/@hcengineering/tags/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/task/types/index.d.ts +0 -227
- package/node_modules/@hcengineering/task/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/task/types/utils.d.ts +0 -61
- package/node_modules/@hcengineering/task/types/utils.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/extensions.d.ts +0 -53
- package/node_modules/@hcengineering/text/types/extensions.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/index.d.ts +0 -13
- package/node_modules/@hcengineering/text/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/kit.d.ts +0 -12
- package/node_modules/@hcengineering/text/types/kit.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/kits/common-kit.d.ts +0 -72
- package/node_modules/@hcengineering/text/types/kits/common-kit.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/kits/server-kit.d.ts +0 -106
- package/node_modules/@hcengineering/text/types/kits/server-kit.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/marks/code.d.ts +0 -8
- package/node_modules/@hcengineering/text/types/marks/code.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/marks/colors.d.ts +0 -21
- package/node_modules/@hcengineering/text/types/marks/colors.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/marks/inlineComment.d.ts +0 -5
- package/node_modules/@hcengineering/text/types/marks/inlineComment.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/marks/noteBase.d.ts +0 -23
- package/node_modules/@hcengineering/text/types/marks/noteBase.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/marks/qmsInlineCommentMark.d.ts +0 -6
- package/node_modules/@hcengineering/text/types/marks/qmsInlineCommentMark.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/markup/__tests__/dsl.test.d.ts +0 -2
- package/node_modules/@hcengineering/text/types/markup/__tests__/dsl.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/markup/__tests__/utils.test.d.ts +0 -5
- package/node_modules/@hcengineering/text/types/markup/__tests__/utils.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/markup/utils.d.ts +0 -19
- package/node_modules/@hcengineering/text/types/markup/utils.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/nodes/codeblock.d.ts +0 -12
- package/node_modules/@hcengineering/text/types/nodes/codeblock.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/nodes/comment.d.ts +0 -6
- package/node_modules/@hcengineering/text/types/nodes/comment.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/nodes/embed.d.ts +0 -3
- package/node_modules/@hcengineering/text/types/nodes/embed.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/nodes/emoji.d.ts +0 -17
- package/node_modules/@hcengineering/text/types/nodes/emoji.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/nodes/file.d.ts +0 -13
- package/node_modules/@hcengineering/text/types/nodes/file.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/nodes/image.d.ts +0 -52
- package/node_modules/@hcengineering/text/types/nodes/image.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/nodes/index.d.ts +0 -11
- package/node_modules/@hcengineering/text/types/nodes/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/nodes/markdown.d.ts +0 -3
- package/node_modules/@hcengineering/text/types/nodes/markdown.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/nodes/mermaid.d.ts +0 -4
- package/node_modules/@hcengineering/text/types/nodes/mermaid.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/nodes/reference.d.ts +0 -18
- package/node_modules/@hcengineering/text/types/nodes/reference.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/nodes/todo.d.ts +0 -3
- package/node_modules/@hcengineering/text/types/nodes/todo.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/nodes/utils.d.ts +0 -6
- package/node_modules/@hcengineering/text/types/nodes/utils.d.ts.map +0 -1
- package/node_modules/@hcengineering/text/types/tiptapExtensions.d.ts +0 -28
- package/node_modules/@hcengineering/text/types/tiptapExtensions.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-core/types/index.d.ts +0 -6
- package/node_modules/@hcengineering/text-core/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-core/types/markup/__tests__/traverse.test.d.ts +0 -2
- package/node_modules/@hcengineering/text-core/types/markup/__tests__/traverse.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-core/types/markup/__tests__/utils.test.d.ts +0 -2
- package/node_modules/@hcengineering/text-core/types/markup/__tests__/utils.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-core/types/markup/dsl.d.ts +0 -25
- package/node_modules/@hcengineering/text-core/types/markup/dsl.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-core/types/markup/model.d.ts +0 -74
- package/node_modules/@hcengineering/text-core/types/markup/model.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-core/types/markup/reference.d.ts +0 -15
- package/node_modules/@hcengineering/text-core/types/markup/reference.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-core/types/markup/traverse.d.ts +0 -6
- package/node_modules/@hcengineering/text-core/types/markup/traverse.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-core/types/markup/utils.d.ts +0 -25
- package/node_modules/@hcengineering/text-core/types/markup/utils.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-html/types/__tests__/html.test.d.ts +0 -2
- package/node_modules/@hcengineering/text-html/types/__tests__/html.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-html/types/index.d.ts +0 -6
- package/node_modules/@hcengineering/text-html/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-html/types/parser.d.ts +0 -10
- package/node_modules/@hcengineering/text-html/types/parser.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-html/types/serializer.d.ts +0 -9
- package/node_modules/@hcengineering/text-html/types/serializer.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-markdown/types/__tests__/markdown.test.d.ts +0 -9
- package/node_modules/@hcengineering/text-markdown/types/__tests__/markdown.test.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-markdown/types/compare.d.ts +0 -10
- package/node_modules/@hcengineering/text-markdown/types/compare.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-markdown/types/index.d.ts +0 -14
- package/node_modules/@hcengineering/text-markdown/types/index.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-markdown/types/marks.d.ts +0 -8
- package/node_modules/@hcengineering/text-markdown/types/marks.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-markdown/types/node.d.ts +0 -4
- package/node_modules/@hcengineering/text-markdown/types/node.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-markdown/types/parser.d.ts +0 -50
- package/node_modules/@hcengineering/text-markdown/types/parser.d.ts.map +0 -1
- package/node_modules/@hcengineering/text-markdown/types/serializer.d.ts +0 -102
- package/node_modules/@hcengineering/text-markdown/types/serializer.d.ts.map +0 -1
- package/node_modules/@hcengineering/tracker/types/analytics.d.ts +0 -24
- package/node_modules/@hcengineering/tracker/types/analytics.d.ts.map +0 -1
- package/node_modules/@hcengineering/tracker/types/index.d.ts +0 -431
- package/node_modules/@hcengineering/tracker/types/index.d.ts.map +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"status": {
|
|
3
|
+
"LoadingPlugin": "Carregando plugin {plugin}...",
|
|
4
|
+
"UnknownError": "Erro desconhecido: {message}",
|
|
5
|
+
"InvalidId": "Id inválido: {id}",
|
|
6
|
+
"BadRequest": "Pedido inválido",
|
|
7
|
+
"Forbidden": "Proibido",
|
|
8
|
+
"Conflict": "Conflito",
|
|
9
|
+
"ExpiredLink": "Este link de convite expirou",
|
|
10
|
+
"Unauthorized": "Não autorizado",
|
|
11
|
+
"UnknownMethod": "Método desconhecido: {method}",
|
|
12
|
+
"InternalServerError": "Erro interno do servidor",
|
|
13
|
+
"MaintenanceWarning": "Manutenção programada dentro de",
|
|
14
|
+
"MaintenanceWarningTime": "{time, plural, =1 {menos de um minuto} other {# minutos}}",
|
|
15
|
+
"AccountNotFound": "Conta não encontrada",
|
|
16
|
+
"AccountNotConfirmed": "Conta não confirmada",
|
|
17
|
+
"WorkspaceNotFound": "Espaço de trabalho não encontrado",
|
|
18
|
+
"InvalidPassword": "Senha inválida",
|
|
19
|
+
"AccountAlreadyExists": "Conta já existe",
|
|
20
|
+
"WorkspaceRateLimit": "O servidor está ocupado. Por favor, espere um pouco e tente novamente",
|
|
21
|
+
"AccountAlreadyConfirmed": "Conta já confirmada",
|
|
22
|
+
"WorkspaceAlreadyExists": "Espaço de trabalho já existe",
|
|
23
|
+
"InvalidOtp": "Código inválido",
|
|
24
|
+
"PasswordLoginLocked": "O login com senha está bloqueado devido a muitas tentativas incorretas. Use um método de login OTP para desbloquear sua conta.",
|
|
25
|
+
"InviteNotFound": "Convite com e-mail:{email} não encontrado.",
|
|
26
|
+
"WorkspaceLimitReached": "Você atingiu o limite de espaços de trabalho. Entre em contato conosco...",
|
|
27
|
+
"ReadOnlyAccount": "Demonstração anônima de convidado",
|
|
28
|
+
"SystemAccount": "Conta do sistema",
|
|
29
|
+
"SocialIdAlreadyExists": "ID social já existe"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -26,6 +26,12 @@ var import_platform = __toESM(require("../platform"));
|
|
|
26
26
|
var import_status = require("../status");
|
|
27
27
|
var import_i18n = require("../i18n");
|
|
28
28
|
var import_event = require("../event");
|
|
29
|
+
function translateCBAsync(message, params, language) {
|
|
30
|
+
return new Promise((resolve) => {
|
|
31
|
+
(0, import_i18n.translateCB)(message, params, language, resolve);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
__name(translateCBAsync, "translateCBAsync");
|
|
29
35
|
const testId = "test-strings";
|
|
30
36
|
const test = (0, import_platform.plugin)(testId, {
|
|
31
37
|
string: {
|
|
@@ -105,5 +111,99 @@ describe("i18n", () => {
|
|
|
105
111
|
expect(translated).toBe(message);
|
|
106
112
|
(0, import_event.removeEventListener)(import_event.PlatformEvent, eventListener);
|
|
107
113
|
});
|
|
114
|
+
it("translateCB should resolve with message when bad id (_parseId throws)", async () => {
|
|
115
|
+
expect.assertions(2);
|
|
116
|
+
const message = "invalidIntlIdCB";
|
|
117
|
+
const checkStatus = new import_status.Status(import_status.Severity.ERROR, import_platform.default.status.InvalidId, { id: message });
|
|
118
|
+
const eventListener = /* @__PURE__ */ __name(async (event, data) => {
|
|
119
|
+
expect(data).toEqual(checkStatus);
|
|
120
|
+
}, "eventListener");
|
|
121
|
+
(0, import_event.addEventListener)(import_event.PlatformEvent, eventListener);
|
|
122
|
+
const out = await translateCBAsync(message, {}, "en");
|
|
123
|
+
expect(out).toBe(message);
|
|
124
|
+
(0, import_event.removeEventListener)(import_event.PlatformEvent, eventListener);
|
|
125
|
+
});
|
|
126
|
+
it("translateCB should match translate for loaded string", async () => {
|
|
127
|
+
const fromTranslate = await (0, import_i18n.translate)(test.string.loadingPlugin, { plugin: "cb" });
|
|
128
|
+
const fromCB = await translateCBAsync(test.string.loadingPlugin, { plugin: "cb" }, "en");
|
|
129
|
+
expect(fromCB).toBe(fromTranslate);
|
|
130
|
+
});
|
|
131
|
+
it("translate and translateCB should return embedded label text", async () => {
|
|
132
|
+
const embedded = (0, import_platform.getEmbeddedLabel)("Embedded copy");
|
|
133
|
+
expect(await (0, import_i18n.translate)(embedded, {})).toBe("Embedded copy");
|
|
134
|
+
expect(await translateCBAsync(embedded, {}, "en")).toBe("Embedded copy");
|
|
135
|
+
});
|
|
136
|
+
it("loadPluginStrings(force) should clear format cache so strings still resolve", async () => {
|
|
137
|
+
await (0, import_i18n.translate)(test.string.loadingPlugin, { plugin: "before" });
|
|
138
|
+
await (0, import_i18n.loadPluginStrings)("en", true);
|
|
139
|
+
const after = await (0, import_i18n.translate)(test.string.loadingPlugin, { plugin: "after" });
|
|
140
|
+
expect(after).toContain("after");
|
|
141
|
+
});
|
|
142
|
+
it("translate with skipError should not broadcast platform status (no loader)", async () => {
|
|
143
|
+
const pluginId = "plugin-skip-error-no-loader";
|
|
144
|
+
const message = `${pluginId}:string:any`;
|
|
145
|
+
let events = 0;
|
|
146
|
+
const listener = /* @__PURE__ */ __name(async () => {
|
|
147
|
+
events++;
|
|
148
|
+
}, "listener");
|
|
149
|
+
(0, import_event.addEventListener)(import_event.PlatformEvent, listener);
|
|
150
|
+
await (0, import_i18n.translate)(message, {}, "en", true);
|
|
151
|
+
(0, import_event.removeEventListener)(import_event.PlatformEvent, listener);
|
|
152
|
+
expect(events).toBe(0);
|
|
153
|
+
});
|
|
154
|
+
it("translate should return message id and emit status when ICU format params are missing", async () => {
|
|
155
|
+
const fmtPlugin = "i18n-icu-format-test";
|
|
156
|
+
(0, import_i18n.addStringsLoader)(fmtPlugin, async () => ({
|
|
157
|
+
string: {
|
|
158
|
+
badPlural: "{dias, plural, =0 {} other {#d}} {horas, plural, =0 {} other {#h}}"
|
|
159
|
+
}
|
|
160
|
+
}));
|
|
161
|
+
const message = `${fmtPlugin}:string:badPlural`;
|
|
162
|
+
expect.assertions(2);
|
|
163
|
+
let gotStatus = false;
|
|
164
|
+
const listener = /* @__PURE__ */ __name(async (_event, data) => {
|
|
165
|
+
if (data instanceof import_status.Status) {
|
|
166
|
+
gotStatus = true;
|
|
167
|
+
}
|
|
168
|
+
}, "listener");
|
|
169
|
+
(0, import_event.addEventListener)(import_event.PlatformEvent, listener);
|
|
170
|
+
const out = await (0, import_i18n.translate)(message, { days: 1, hours: 2 }, "en");
|
|
171
|
+
(0, import_event.removeEventListener)(import_event.PlatformEvent, listener);
|
|
172
|
+
expect(out).toBe(message);
|
|
173
|
+
expect(gotStatus).toBe(true);
|
|
174
|
+
});
|
|
175
|
+
it("translateCB should resolve to message id when ICU format params are missing", async () => {
|
|
176
|
+
const fmtPlugin = "i18n-icu-format-test-cb";
|
|
177
|
+
(0, import_i18n.addStringsLoader)(fmtPlugin, async () => ({
|
|
178
|
+
string: {
|
|
179
|
+
badPlural: "{dias, plural, =0 {} other {#d}}"
|
|
180
|
+
}
|
|
181
|
+
}));
|
|
182
|
+
const message = `${fmtPlugin}:string:badPlural`;
|
|
183
|
+
expect.assertions(2);
|
|
184
|
+
let gotStatus = false;
|
|
185
|
+
const listener = /* @__PURE__ */ __name(async (_event, data) => {
|
|
186
|
+
if (data instanceof import_status.Status) {
|
|
187
|
+
gotStatus = true;
|
|
188
|
+
}
|
|
189
|
+
}, "listener");
|
|
190
|
+
(0, import_event.addEventListener)(import_event.PlatformEvent, listener);
|
|
191
|
+
const out = await translateCBAsync(message, { days: 1 }, "en");
|
|
192
|
+
(0, import_event.removeEventListener)(import_event.PlatformEvent, listener);
|
|
193
|
+
expect(out).toBe(message);
|
|
194
|
+
expect(gotStatus).toBe(true);
|
|
195
|
+
});
|
|
196
|
+
it("translateCB should defer to translate when translation is not yet cached", async () => {
|
|
197
|
+
const deferPlugin = "i18n-defer-translate";
|
|
198
|
+
const deferMsg = `${deferPlugin}:string:only`;
|
|
199
|
+
(0, import_i18n.addStringsLoader)(deferPlugin, async (locale) => {
|
|
200
|
+
if (locale === "en") {
|
|
201
|
+
return { string: { only: "Deferred {v}" } };
|
|
202
|
+
}
|
|
203
|
+
return { string: { only: "Deferred {v}" } };
|
|
204
|
+
});
|
|
205
|
+
const out = await translateCBAsync(deferMsg, { v: "ok" }, "en");
|
|
206
|
+
expect(out).toBe("Deferred ok");
|
|
207
|
+
});
|
|
108
208
|
});
|
|
109
209
|
//# sourceMappingURL=i18n.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/__tests__/i18n.test.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright \u00A9 2020, 2021 Anticrm Platform Contributors.\n// Copyright \u00A9 2021 Hardcore Engineering Inc.\n//\n// Licensed under the Eclipse Public License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License. You may\n// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\nimport type { Plugin, IntlString } from '../platform'\nimport platform, { plugin } from '../platform'\nimport { Severity, Status } from '../status'\n\nimport { addStringsLoader, translate } from '../i18n'\nimport { addEventListener, PlatformEvent, removeEventListener } from '../event'\n\nconst testId = 'test-strings' as Plugin\n\nconst test = plugin(testId, {\n string: {\n loadingPlugin: '' as IntlString<{ plugin: string }>\n }\n})\n\ndescribe('i18n', () => {\n it('should translate string', async () => {\n addStringsLoader(testId, async (locale: string) => await import(`./lang/${locale}.json`))\n const translated = await translate(test.string.loadingPlugin, { plugin: 'xxx' })\n expect(translated).toBe('Loading plugin <b>xxx</b>...')\n })\n\n it('should return id when no translation found', async () => {\n const id = (testId + '.inexistent') as IntlString\n const inexistent = await translate(id, {})\n expect(inexistent).toBe(id)\n })\n\n it('should cache translated string', async () => {\n const translated = await translate(test.string.loadingPlugin, { plugin: 'xxx' })\n expect(translated).toBe('Loading plugin <b>xxx</b>...')\n })\n\n it('should emit status and return id when no loader', async () => {\n expect.assertions(2)\n const plugin = 'plugin-without-string-loader'\n const message = `${plugin}:string:id`\n\n const checkStatus = new Status(Severity.ERROR, platform.status.NoLoaderForStrings, { plugin })\n const eventListener = async (event: string, data: any): Promise<void> => {\n expect(data).toEqual(checkStatus)\n }\n addEventListener(PlatformEvent, eventListener)\n const translated = await translate(message as IntlString, {})\n expect(translated).toBe(message)\n removeEventListener(PlatformEvent, eventListener)\n })\n\n it('should emit status and return id when bad loader', async () => {\n expect.assertions(2)\n const plugin = 'component-for-bad-loader'\n const message = `${plugin}:string:id`\n const errorMessage = 'bad loader'\n addStringsLoader(plugin as Plugin, (locale: string) => {\n throw new Error(errorMessage)\n })\n\n const checkStatus = new Status(Severity.ERROR, platform.status.UnknownError, { message: errorMessage })\n const eventListener = async (event: string, data: any): Promise<void> => {\n expect(data).toEqual(checkStatus)\n }\n addEventListener(PlatformEvent, eventListener)\n const translated = await translate(message as IntlString, {})\n expect(translated).toBe(message)\n removeEventListener(PlatformEvent, eventListener)\n })\n\n it('should cache error', async () => {\n const plugin = 'component'\n const message = `${plugin}:string:id`\n\n const checkStatus = new Status(Severity.ERROR, platform.status.NoLoaderForStrings, { plugin })\n let calls = 0\n const eventListener = async (event: string, data: any): Promise<void> => {\n ++calls\n expect(data).toEqual(checkStatus)\n }\n\n addEventListener(PlatformEvent, eventListener)\n const t1 = await translate(message as IntlString, {})\n const t2 = await translate(message as IntlString, {})\n expect(t1).toBe(t2)\n removeEventListener(PlatformEvent, eventListener)\n expect(calls).toBe(1)\n })\n\n it('should return message when bad id', async () => {\n expect.assertions(2)\n const message = 'testMessage' as IntlString\n const checkStatus = new Status(Severity.ERROR, platform.status.InvalidId, { id: message })\n const eventListener = async (event: string, data: any): Promise<void> => {\n expect(data).toEqual(checkStatus)\n }\n addEventListener(PlatformEvent, eventListener)\n const translated = await translate(message, {})\n expect(translated).toBe(message)\n removeEventListener(PlatformEvent, eventListener)\n })\n})\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAiBA,
|
|
4
|
+
"sourcesContent": ["//\n// Copyright \u00A9 2020, 2021 Anticrm Platform Contributors.\n// Copyright \u00A9 2021 Hardcore Engineering Inc.\n//\n// Licensed under the Eclipse Public License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License. You may\n// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\nimport type { Plugin, IntlString } from '../platform'\nimport platform, { getEmbeddedLabel, plugin } from '../platform'\nimport { Severity, Status } from '../status'\n\nimport { addStringsLoader, loadPluginStrings, translate, translateCB } from '../i18n'\nimport { addEventListener, PlatformEvent, removeEventListener } from '../event'\n\nfunction translateCBAsync (\n message: IntlString,\n params: Record<string, any>,\n language: string | undefined\n): Promise<string> {\n return new Promise((resolve) => {\n translateCB(message, params, language, resolve)\n })\n}\n\nconst testId = 'test-strings' as Plugin\n\nconst test = plugin(testId, {\n string: {\n loadingPlugin: '' as IntlString<{ plugin: string }>\n }\n})\n\ndescribe('i18n', () => {\n it('should translate string', async () => {\n addStringsLoader(testId, async (locale: string) => await import(`./lang/${locale}.json`))\n const translated = await translate(test.string.loadingPlugin, { plugin: 'xxx' })\n expect(translated).toBe('Loading plugin <b>xxx</b>...')\n })\n\n it('should return id when no translation found', async () => {\n const id = (testId + '.inexistent') as IntlString\n const inexistent = await translate(id, {})\n expect(inexistent).toBe(id)\n })\n\n it('should cache translated string', async () => {\n const translated = await translate(test.string.loadingPlugin, { plugin: 'xxx' })\n expect(translated).toBe('Loading plugin <b>xxx</b>...')\n })\n\n it('should emit status and return id when no loader', async () => {\n expect.assertions(2)\n const plugin = 'plugin-without-string-loader'\n const message = `${plugin}:string:id`\n\n const checkStatus = new Status(Severity.ERROR, platform.status.NoLoaderForStrings, { plugin })\n const eventListener = async (event: string, data: any): Promise<void> => {\n expect(data).toEqual(checkStatus)\n }\n addEventListener(PlatformEvent, eventListener)\n const translated = await translate(message as IntlString, {})\n expect(translated).toBe(message)\n removeEventListener(PlatformEvent, eventListener)\n })\n\n it('should emit status and return id when bad loader', async () => {\n expect.assertions(2)\n const plugin = 'component-for-bad-loader'\n const message = `${plugin}:string:id`\n const errorMessage = 'bad loader'\n addStringsLoader(plugin as Plugin, (locale: string) => {\n throw new Error(errorMessage)\n })\n\n const checkStatus = new Status(Severity.ERROR, platform.status.UnknownError, { message: errorMessage })\n const eventListener = async (event: string, data: any): Promise<void> => {\n expect(data).toEqual(checkStatus)\n }\n addEventListener(PlatformEvent, eventListener)\n const translated = await translate(message as IntlString, {})\n expect(translated).toBe(message)\n removeEventListener(PlatformEvent, eventListener)\n })\n\n it('should cache error', async () => {\n const plugin = 'component'\n const message = `${plugin}:string:id`\n\n const checkStatus = new Status(Severity.ERROR, platform.status.NoLoaderForStrings, { plugin })\n let calls = 0\n const eventListener = async (event: string, data: any): Promise<void> => {\n ++calls\n expect(data).toEqual(checkStatus)\n }\n\n addEventListener(PlatformEvent, eventListener)\n const t1 = await translate(message as IntlString, {})\n const t2 = await translate(message as IntlString, {})\n expect(t1).toBe(t2)\n removeEventListener(PlatformEvent, eventListener)\n expect(calls).toBe(1)\n })\n\n it('should return message when bad id', async () => {\n expect.assertions(2)\n const message = 'testMessage' as IntlString\n const checkStatus = new Status(Severity.ERROR, platform.status.InvalidId, { id: message })\n const eventListener = async (event: string, data: any): Promise<void> => {\n expect(data).toEqual(checkStatus)\n }\n addEventListener(PlatformEvent, eventListener)\n const translated = await translate(message, {})\n expect(translated).toBe(message)\n removeEventListener(PlatformEvent, eventListener)\n })\n\n it('translateCB should resolve with message when bad id (_parseId throws)', async () => {\n expect.assertions(2)\n const message = 'invalidIntlIdCB' as IntlString\n const checkStatus = new Status(Severity.ERROR, platform.status.InvalidId, { id: message })\n const eventListener = async (event: string, data: any): Promise<void> => {\n expect(data).toEqual(checkStatus)\n }\n addEventListener(PlatformEvent, eventListener)\n const out = await translateCBAsync(message, {}, 'en')\n expect(out).toBe(message)\n removeEventListener(PlatformEvent, eventListener)\n })\n\n it('translateCB should match translate for loaded string', async () => {\n const fromTranslate = await translate(test.string.loadingPlugin, { plugin: 'cb' })\n const fromCB = await translateCBAsync(test.string.loadingPlugin, { plugin: 'cb' }, 'en')\n expect(fromCB).toBe(fromTranslate)\n })\n\n it('translate and translateCB should return embedded label text', async () => {\n const embedded = getEmbeddedLabel('Embedded copy')\n expect(await translate(embedded, {})).toBe('Embedded copy')\n expect(await translateCBAsync(embedded, {}, 'en')).toBe('Embedded copy')\n })\n\n it('loadPluginStrings(force) should clear format cache so strings still resolve', async () => {\n await translate(test.string.loadingPlugin, { plugin: 'before' })\n await loadPluginStrings('en', true)\n const after = await translate(test.string.loadingPlugin, { plugin: 'after' })\n expect(after).toContain('after')\n })\n\n it('translate with skipError should not broadcast platform status (no loader)', async () => {\n const pluginId = 'plugin-skip-error-no-loader'\n const message = `${pluginId}:string:any` as IntlString\n let events = 0\n const listener = async (): Promise<void> => {\n events++\n }\n addEventListener(PlatformEvent, listener)\n await translate(message, {}, 'en', true)\n removeEventListener(PlatformEvent, listener)\n expect(events).toBe(0)\n })\n\n it('translate should return message id and emit status when ICU format params are missing', async () => {\n const fmtPlugin = 'i18n-icu-format-test' as Plugin\n addStringsLoader(fmtPlugin, async () => ({\n string: {\n badPlural: '{dias, plural, =0 {} other {#d}} {horas, plural, =0 {} other {#h}}'\n }\n }))\n const message = `${fmtPlugin}:string:badPlural` as IntlString\n expect.assertions(2)\n let gotStatus = false\n const listener = async (_event: string, data: any): Promise<void> => {\n if (data instanceof Status) {\n gotStatus = true\n }\n }\n addEventListener(PlatformEvent, listener)\n const out = await translate(message, { days: 1, hours: 2 } as any, 'en')\n removeEventListener(PlatformEvent, listener)\n expect(out).toBe(message)\n expect(gotStatus).toBe(true)\n })\n\n it('translateCB should resolve to message id when ICU format params are missing', async () => {\n const fmtPlugin = 'i18n-icu-format-test-cb' as Plugin\n addStringsLoader(fmtPlugin, async () => ({\n string: {\n badPlural: '{dias, plural, =0 {} other {#d}}'\n }\n }))\n const message = `${fmtPlugin}:string:badPlural` as IntlString\n expect.assertions(2)\n let gotStatus = false\n const listener = async (_event: string, data: any): Promise<void> => {\n if (data instanceof Status) {\n gotStatus = true\n }\n }\n addEventListener(PlatformEvent, listener)\n const out = await translateCBAsync(message, { days: 1 }, 'en')\n removeEventListener(PlatformEvent, listener)\n expect(out).toBe(message)\n expect(gotStatus).toBe(true)\n })\n\n it('translateCB should defer to translate when translation is not yet cached', async () => {\n const deferPlugin = 'i18n-defer-translate' as Plugin\n const deferMsg = `${deferPlugin}:string:only` as IntlString\n addStringsLoader(deferPlugin, async (locale: string) => {\n if (locale === 'en') {\n return { string: { only: 'Deferred {v}' } }\n }\n return { string: { only: 'Deferred {v}' } }\n })\n const out = await translateCBAsync(deferMsg, { v: 'ok' }, 'en')\n expect(out).toBe('Deferred ok')\n })\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAiBA,sBAAmD;AACnD,oBAAiC;AAEjC,kBAA4E;AAC5E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AAA,MACb;AAAA,IACF,EAAE;AACF,UAAM,UAAU,GAAG,SAAS;AAC5B,WAAO,WAAW,CAAC;AACnB,QAAI,YAAY;AAChB,UAAM,WAAW,8BAAO,QAAgB,SAA6B;AACnE,UAAI,gBAAgB,sBAAQ;AAC1B,oBAAY;AAAA,MACd;AAAA,IACF,GAJiB;AAKjB,uCAAiB,4BAAe,QAAQ;AACxC,UAAM,MAAM,MAAM,iBAAiB,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI;AAC7D,0CAAoB,4BAAe,QAAQ;AAC3C,WAAO,GAAG,EAAE,KAAK,OAAO;AACxB,WAAO,SAAS,EAAE,KAAK,IAAI;AAAA,EAC7B,CAAC;AAED,KAAG,4EAA4E,YAAY;AACzF,UAAM,cAAc;AACpB,UAAM,WAAW,GAAG,WAAW;AAC/B,sCAAiB,aAAa,OAAO,WAAmB;AACtD,UAAI,WAAW,MAAM;AACnB,eAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,EAAE;AAAA,MAC5C;AACA,aAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,EAAE;AAAA,IAC5C,CAAC;AACD,UAAM,MAAM,MAAM,iBAAiB,UAAU,EAAE,GAAG,KAAK,GAAG,IAAI;AAC9D,WAAO,GAAG,EAAE,KAAK,aAAa;AAAA,EAChC,CAAC;AACH,CAAC;",
|
|
6
6
|
"names": ["plugin", "platform"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var import_platform = __toESM(require("../platform"));
|
|
25
|
+
var import_status = require("../status");
|
|
26
|
+
describe("errorToStatus", () => {
|
|
27
|
+
it("returns status from PlatformError", () => {
|
|
28
|
+
const err = new import_status.PlatformError(import_status.UNAUTHORIZED);
|
|
29
|
+
expect((0, import_status.errorToStatus)(err)).toBe(import_status.UNAUTHORIZED);
|
|
30
|
+
});
|
|
31
|
+
it("returns same Status instance", () => {
|
|
32
|
+
const st = new import_status.Status(import_status.Severity.WARNING, import_platform.default.status.MaintenanceWarning, { time: 1, message: "" });
|
|
33
|
+
expect((0, import_status.errorToStatus)(st)).toBe(st);
|
|
34
|
+
});
|
|
35
|
+
it("reconstructs from plain status-shaped object (duplicate package / JSON)", () => {
|
|
36
|
+
const plain = {
|
|
37
|
+
severity: import_status.UNAUTHORIZED.severity,
|
|
38
|
+
code: import_status.UNAUTHORIZED.code,
|
|
39
|
+
params: import_status.UNAUTHORIZED.params
|
|
40
|
+
};
|
|
41
|
+
expect((0, import_status.errorToStatus)(plain)).toEqual(import_status.UNAUTHORIZED);
|
|
42
|
+
});
|
|
43
|
+
it("unwraps embedded .status (foreign PlatformError shape)", () => {
|
|
44
|
+
const workspaceUuid = "d388f8f8-915c-4ef8-96f7-018147ce1234";
|
|
45
|
+
const embedded = {
|
|
46
|
+
status: {
|
|
47
|
+
severity: import_status.Severity.ERROR,
|
|
48
|
+
code: import_platform.default.status.WorkspaceNotFound,
|
|
49
|
+
params: { workspaceUuid }
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
expect((0, import_status.errorToStatus)(embedded)).toMatchObject({
|
|
53
|
+
severity: import_status.Severity.ERROR,
|
|
54
|
+
code: import_platform.default.status.WorkspaceNotFound,
|
|
55
|
+
params: { workspaceUuid }
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
it("delegates Error to unknownError \u2192 unknownStatus", () => {
|
|
59
|
+
expect((0, import_status.errorToStatus)(new Error("boom"))).toEqual((0, import_status.unknownStatus)("boom"));
|
|
60
|
+
});
|
|
61
|
+
it("delegates string to unknownError \u2192 unknownStatus", () => {
|
|
62
|
+
expect((0, import_status.errorToStatus)("nope")).toEqual((0, import_status.unknownStatus)("nope"));
|
|
63
|
+
});
|
|
64
|
+
it("returns ERROR for unrecognized values", () => {
|
|
65
|
+
expect((0, import_status.errorToStatus)(null)).toBe(import_status.ERROR);
|
|
66
|
+
expect((0, import_status.errorToStatus)(void 0)).toBe(import_status.ERROR);
|
|
67
|
+
expect((0, import_status.errorToStatus)(42)).toBe(import_status.ERROR);
|
|
68
|
+
expect((0, import_status.errorToStatus)({})).toBe(import_status.ERROR);
|
|
69
|
+
});
|
|
70
|
+
it("ignores .status that is not status-shaped", () => {
|
|
71
|
+
expect(
|
|
72
|
+
(0, import_status.errorToStatus)({
|
|
73
|
+
status: { code: "only-code" }
|
|
74
|
+
})
|
|
75
|
+
).toBe(import_status.ERROR);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=status.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/__tests__/status.test.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright \u00A9 2026 Hardcore Engineering Inc.\n//\n// Licensed under the Eclipse Public License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR ANY KIND, either express or implied.\n//\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\nimport platform from '../platform'\nimport { ERROR, PlatformError, Severity, Status, UNAUTHORIZED, errorToStatus, unknownStatus } from '../status'\n\ndescribe('errorToStatus', () => {\n it('returns status from PlatformError', () => {\n const err = new PlatformError(UNAUTHORIZED)\n expect(errorToStatus(err)).toBe(UNAUTHORIZED)\n })\n\n it('returns same Status instance', () => {\n const st = new Status(Severity.WARNING, platform.status.MaintenanceWarning, { time: 1, message: '' })\n expect(errorToStatus(st)).toBe(st)\n })\n\n it('reconstructs from plain status-shaped object (duplicate package / JSON)', () => {\n const plain = {\n severity: UNAUTHORIZED.severity,\n code: UNAUTHORIZED.code,\n params: UNAUTHORIZED.params\n }\n expect(errorToStatus(plain)).toEqual(UNAUTHORIZED)\n })\n\n it('unwraps embedded .status (foreign PlatformError shape)', () => {\n const workspaceUuid = 'd388f8f8-915c-4ef8-96f7-018147ce1234'\n const embedded = {\n status: {\n severity: Severity.ERROR,\n code: platform.status.WorkspaceNotFound,\n params: { workspaceUuid }\n }\n }\n expect(errorToStatus(embedded)).toMatchObject({\n severity: Severity.ERROR,\n code: platform.status.WorkspaceNotFound,\n params: { workspaceUuid }\n })\n })\n\n it('delegates Error to unknownError \u2192 unknownStatus', () => {\n expect(errorToStatus(new Error('boom'))).toEqual(unknownStatus('boom'))\n })\n\n it('delegates string to unknownError \u2192 unknownStatus', () => {\n expect(errorToStatus('nope')).toEqual(unknownStatus('nope'))\n })\n\n it('returns ERROR for unrecognized values', () => {\n expect(errorToStatus(null)).toBe(ERROR)\n expect(errorToStatus(undefined)).toBe(ERROR)\n expect(errorToStatus(42)).toBe(ERROR)\n expect(errorToStatus({})).toBe(ERROR)\n })\n\n it('ignores .status that is not status-shaped', () => {\n expect(\n errorToStatus({\n status: { code: 'only-code' }\n })\n ).toBe(ERROR)\n })\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAeA,sBAAqB;AACrB,oBAAmG;AAEnG,SAAS,iBAAiB,MAAM;AAC9B,KAAG,qCAAqC,MAAM;AAC5C,UAAM,MAAM,IAAI,4BAAc,0BAAY;AAC1C,eAAO,6BAAc,GAAG,CAAC,EAAE,KAAK,0BAAY;AAAA,EAC9C,CAAC;AAED,KAAG,gCAAgC,MAAM;AACvC,UAAM,KAAK,IAAI,qBAAO,uBAAS,SAAS,gBAAAA,QAAS,OAAO,oBAAoB,EAAE,MAAM,GAAG,SAAS,GAAG,CAAC;AACpG,eAAO,6BAAc,EAAE,CAAC,EAAE,KAAK,EAAE;AAAA,EACnC,CAAC;AAED,KAAG,2EAA2E,MAAM;AAClF,UAAM,QAAQ;AAAA,MACZ,UAAU,2BAAa;AAAA,MACvB,MAAM,2BAAa;AAAA,MACnB,QAAQ,2BAAa;AAAA,IACvB;AACA,eAAO,6BAAc,KAAK,CAAC,EAAE,QAAQ,0BAAY;AAAA,EACnD,CAAC;AAED,KAAG,0DAA0D,MAAM;AACjE,UAAM,gBAAgB;AACtB,UAAM,WAAW;AAAA,MACf,QAAQ;AAAA,QACN,UAAU,uBAAS;AAAA,QACnB,MAAM,gBAAAA,QAAS,OAAO;AAAA,QACtB,QAAQ,EAAE,cAAc;AAAA,MAC1B;AAAA,IACF;AACA,eAAO,6BAAc,QAAQ,CAAC,EAAE,cAAc;AAAA,MAC5C,UAAU,uBAAS;AAAA,MACnB,MAAM,gBAAAA,QAAS,OAAO;AAAA,MACtB,QAAQ,EAAE,cAAc;AAAA,IAC1B,CAAC;AAAA,EACH,CAAC;AAED,KAAG,wDAAmD,MAAM;AAC1D,eAAO,6BAAc,IAAI,MAAM,MAAM,CAAC,CAAC,EAAE,YAAQ,6BAAc,MAAM,CAAC;AAAA,EACxE,CAAC;AAED,KAAG,yDAAoD,MAAM;AAC3D,eAAO,6BAAc,MAAM,CAAC,EAAE,YAAQ,6BAAc,MAAM,CAAC;AAAA,EAC7D,CAAC;AAED,KAAG,yCAAyC,MAAM;AAChD,eAAO,6BAAc,IAAI,CAAC,EAAE,KAAK,mBAAK;AACtC,eAAO,6BAAc,MAAS,CAAC,EAAE,KAAK,mBAAK;AAC3C,eAAO,6BAAc,EAAE,CAAC,EAAE,KAAK,mBAAK;AACpC,eAAO,6BAAc,CAAC,CAAC,CAAC,EAAE,KAAK,mBAAK;AAAA,EACtC,CAAC;AAED,KAAG,6CAA6C,MAAM;AACpD;AAAA,UACE,6BAAc;AAAA,QACZ,QAAQ,EAAE,MAAM,YAAY;AAAA,MAC9B,CAAC;AAAA,IACH,EAAE,KAAK,mBAAK;AAAA,EACd,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": ["platform"]
|
|
7
|
+
}
|
|
@@ -66,11 +66,30 @@ async function loadPluginStrings(locale, force = false) {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
__name(loadPluginStrings, "loadPluginStrings");
|
|
69
|
-
async function
|
|
69
|
+
async function setStatus(status, skipError) {
|
|
70
|
+
if (skipError !== true) {
|
|
71
|
+
await (0, import_event.setPlatformStatus)(status);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
__name(setStatus, "setStatus");
|
|
75
|
+
async function pipelineErrorToStatus(err, skipError) {
|
|
76
|
+
const status = (0, import_status.unknownError)(err);
|
|
77
|
+
await setStatus(status, skipError);
|
|
78
|
+
return status;
|
|
79
|
+
}
|
|
80
|
+
__name(pipelineErrorToStatus, "pipelineErrorToStatus");
|
|
81
|
+
async function handleIntlPipelineFailure(err, message, localeCache, skipError) {
|
|
82
|
+
const status = (0, import_status.unknownError)(err);
|
|
83
|
+
localeCache.set(message, status);
|
|
84
|
+
await setStatus(status, skipError);
|
|
85
|
+
return message;
|
|
86
|
+
}
|
|
87
|
+
__name(handleIntlPipelineFailure, "handleIntlPipelineFailure");
|
|
88
|
+
async function loadTranslationsForComponent(plugin, locale, skipError) {
|
|
70
89
|
const loader = loaders.get(plugin);
|
|
71
90
|
if (loader === void 0) {
|
|
72
91
|
const status = new import_status.Status(import_status.Severity.ERROR, import_platform.default.status.NoLoaderForStrings, { plugin });
|
|
73
|
-
await (
|
|
92
|
+
await setStatus(status, skipError);
|
|
74
93
|
return status;
|
|
75
94
|
}
|
|
76
95
|
try {
|
|
@@ -80,9 +99,7 @@ async function loadTranslationsForComponent(plugin, locale) {
|
|
|
80
99
|
try {
|
|
81
100
|
return await loader("en");
|
|
82
101
|
} catch (err2) {
|
|
83
|
-
|
|
84
|
-
await (0, import_event.setPlatformStatus)(status);
|
|
85
|
-
return status;
|
|
102
|
+
return await pipelineErrorToStatus(err2, skipError);
|
|
86
103
|
}
|
|
87
104
|
}
|
|
88
105
|
}
|
|
@@ -106,7 +123,7 @@ function getCachedTranslation(id, locale) {
|
|
|
106
123
|
}
|
|
107
124
|
}
|
|
108
125
|
__name(getCachedTranslation, "getCachedTranslation");
|
|
109
|
-
async function getTranslation(id, locale) {
|
|
126
|
+
async function getTranslation(id, locale, skipError) {
|
|
110
127
|
try {
|
|
111
128
|
const localtTanslations = translations.get(locale) ?? /* @__PURE__ */ new Map();
|
|
112
129
|
if (!translations.has(locale)) {
|
|
@@ -114,7 +131,7 @@ async function getTranslation(id, locale) {
|
|
|
114
131
|
}
|
|
115
132
|
let messages = localtTanslations.get(id.component);
|
|
116
133
|
if (messages === void 0) {
|
|
117
|
-
messages = await loadTranslationsForComponent(id.component, locale);
|
|
134
|
+
messages = await loadTranslationsForComponent(id.component, locale, skipError);
|
|
118
135
|
localtTanslations.set(id.component, messages);
|
|
119
136
|
}
|
|
120
137
|
if (messages instanceof import_status.Status) {
|
|
@@ -126,7 +143,7 @@ async function getTranslation(id, locale) {
|
|
|
126
143
|
} else {
|
|
127
144
|
let eng = englishTranslationsForMissing.get(id.component);
|
|
128
145
|
if (eng === void 0) {
|
|
129
|
-
eng = await loadTranslationsForComponent(id.component, "en");
|
|
146
|
+
eng = await loadTranslationsForComponent(id.component, "en", skipError);
|
|
130
147
|
englishTranslationsForMissing.set(id.component, eng);
|
|
131
148
|
}
|
|
132
149
|
if (eng instanceof import_status.Status) {
|
|
@@ -138,90 +155,82 @@ async function getTranslation(id, locale) {
|
|
|
138
155
|
return messages[id.name];
|
|
139
156
|
}
|
|
140
157
|
} catch (err) {
|
|
141
|
-
|
|
142
|
-
await (0, import_event.setPlatformStatus)(status);
|
|
143
|
-
return status;
|
|
158
|
+
return await pipelineErrorToStatus(err, skipError);
|
|
144
159
|
}
|
|
145
160
|
}
|
|
146
161
|
__name(getTranslation, "getTranslation");
|
|
147
|
-
async function translate(message, params, language) {
|
|
162
|
+
async function translate(message, params, language, skipError) {
|
|
148
163
|
const locale = language ?? (0, import_metadata.getMetadata)(import_platform.default.metadata.locale) ?? "en";
|
|
149
164
|
const localCache = cache.get(locale) ?? /* @__PURE__ */ new Map();
|
|
150
165
|
if (!cache.has(locale)) {
|
|
151
166
|
cache.set(locale, localCache);
|
|
152
167
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (compiled
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
return compiled.format(params);
|
|
159
|
-
} else {
|
|
160
|
-
try {
|
|
161
|
-
const id = (0, import_ident._parseId)(message);
|
|
162
|
-
if (id.component === import_platform._EmbeddedId) {
|
|
163
|
-
return id.name;
|
|
164
|
-
}
|
|
165
|
-
const translation = getCachedTranslation(id, locale) ?? await getTranslation(id, locale) ?? message;
|
|
166
|
-
if (translation instanceof import_status.Status) {
|
|
167
|
-
localCache.set(message, translation);
|
|
168
|
+
try {
|
|
169
|
+
const compiled = localCache.get(message);
|
|
170
|
+
if (compiled !== void 0) {
|
|
171
|
+
if (compiled instanceof import_status.Status) {
|
|
168
172
|
return message;
|
|
169
173
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
return compiled.format(params);
|
|
175
|
+
}
|
|
176
|
+
const id = (0, import_ident._parseId)(message);
|
|
177
|
+
if (id.component === import_platform._EmbeddedId) {
|
|
178
|
+
return id.name;
|
|
179
|
+
}
|
|
180
|
+
const translation = getCachedTranslation(id, locale) ?? await getTranslation(id, locale, skipError) ?? message;
|
|
181
|
+
if (translation instanceof import_status.Status) {
|
|
182
|
+
localCache.set(message, translation);
|
|
177
183
|
return message;
|
|
178
184
|
}
|
|
185
|
+
const compiledNew = new import_intl_messageformat.IntlMessageFormat(translation, locale, void 0, { ignoreTag: true });
|
|
186
|
+
localCache.set(message, compiledNew);
|
|
187
|
+
return compiledNew.format(params);
|
|
188
|
+
} catch (err) {
|
|
189
|
+
return await handleIntlPipelineFailure(err, message, localCache, skipError);
|
|
179
190
|
}
|
|
180
191
|
}
|
|
181
192
|
__name(translate, "translate");
|
|
182
|
-
function translateCB(message, params, language, resolve) {
|
|
193
|
+
function translateCB(message, params, language, resolve, skipError) {
|
|
183
194
|
const locale = language ?? (0, import_metadata.getMetadata)(import_platform.default.metadata.locale) ?? "en";
|
|
184
195
|
const localCache = cache.get(locale) ?? /* @__PURE__ */ new Map();
|
|
185
196
|
if (!cache.has(locale)) {
|
|
186
197
|
cache.set(locale, localCache);
|
|
187
198
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (compiled
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
resolve(compiled.format(params));
|
|
195
|
-
} else {
|
|
196
|
-
let id;
|
|
197
|
-
try {
|
|
198
|
-
id = (0, import_ident._parseId)(message);
|
|
199
|
-
if (id.component === import_platform._EmbeddedId) {
|
|
200
|
-
resolve(id.name);
|
|
199
|
+
try {
|
|
200
|
+
const compiled = localCache.get(message);
|
|
201
|
+
if (compiled !== void 0) {
|
|
202
|
+
if (compiled instanceof import_status.Status) {
|
|
203
|
+
resolve(message);
|
|
201
204
|
return;
|
|
202
205
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
206
|
+
resolve(compiled.format(params));
|
|
207
|
+
} else {
|
|
208
|
+
let id;
|
|
209
|
+
try {
|
|
210
|
+
id = (0, import_ident._parseId)(message);
|
|
211
|
+
if (id.component === import_platform._EmbeddedId) {
|
|
212
|
+
resolve(id.name);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
} catch (err) {
|
|
216
|
+
void handleIntlPipelineFailure(err, message, localCache, skipError).then(resolve);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const translation = getCachedTranslation(id, locale);
|
|
220
|
+
if (translation === void 0 || translation instanceof import_status.Status) {
|
|
221
|
+
void translate(message, params, language, skipError).then((res) => {
|
|
222
|
+
resolve(res);
|
|
223
|
+
}).catch((err) => {
|
|
224
|
+
void handleIntlPipelineFailure(err, message, localCache, skipError).then(resolve);
|
|
225
|
+
});
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const compiledNew = new import_intl_messageformat.IntlMessageFormat(translation, locale, void 0, { ignoreTag: true });
|
|
229
|
+
localCache.set(message, compiledNew);
|
|
230
|
+
resolve(compiledNew.format(params));
|
|
221
231
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
resolve(compiled2.format(params));
|
|
232
|
+
} catch (err) {
|
|
233
|
+
void handleIntlPipelineFailure(err, message, localCache, skipError).then(resolve);
|
|
225
234
|
}
|
|
226
235
|
}
|
|
227
236
|
__name(translateCB, "translateCB");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/i18n.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright \u00A9 2020, 2021 Anticrm Platform Contributors.\n// Copyright \u00A9 2021 Hardcore Engineering Inc.\n//\n// Licensed under the Eclipse Public License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License. You may\n// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\nimport { IntlMessageFormat } from 'intl-messageformat'\nimport { setPlatformStatus } from './event'\nimport { _IdInfo, _parseId } from './ident'\nimport type { IntlString, Plugin } from './platform'\nimport { Severity, Status, unknownError } from './status'\n\nimport { getMetadata } from './metadata'\nimport platform, { _EmbeddedId } from './platform'\n\n/**\n * @public\n */\nexport type Loader = (locale: string) => Promise<Record<string, string | Record<string, string>>>\n\ntype Messages = Record<string, IntlString | Record<string, IntlString>>\n\nconst loaders = new Map<Plugin, Loader>()\nconst translations = new Map<string, Map<Plugin, Messages | Status>>()\nconst cache = new Map<string, Map<IntlString, IntlMessageFormat | Status>>()\nconst englishTranslationsForMissing = new Map<Plugin, Messages | Status>()\n/**\n * @public\n * @param plugin -\n * @param loader -\n */\nexport function addStringsLoader (plugin: Plugin, loader: Loader): void {\n loaders.set(plugin, loader)\n}\n\n/**\n * Perform load of all internationalization sources for all plugins available.\n * @public\n */\nexport async function loadPluginStrings (locale: string, force: boolean = false): Promise<void> {\n if (force) {\n cache.clear()\n }\n for (const [plugin] of loaders) {\n const localtTanslations = translations.get(locale) ?? new Map<Plugin, Messages | Status<any>>()\n if (!translations.has(locale)) {\n translations.set(locale, localtTanslations)\n }\n let messages = localtTanslations.get(plugin)\n if (messages === undefined || force) {\n messages = await loadTranslationsForComponent(plugin, locale)\n localtTanslations.set(plugin, messages)\n }\n }\n}\n\nasync function loadTranslationsForComponent (plugin: Plugin
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,gCAAkC;AAClC,mBAAkC;AAClC,mBAAkC;AAElC,oBAA+C;AAE/C,sBAA4B;AAC5B,sBAAsC;AAStC,MAAM,UAAU,oBAAI,IAAoB;AACxC,MAAM,eAAe,oBAAI,IAA4C;AACrE,MAAM,QAAQ,oBAAI,IAAyD;AAC3E,MAAM,gCAAgC,oBAAI,IAA+B;AAMlE,SAAS,iBAAkB,QAAgB,QAAsB;AACtE,UAAQ,IAAI,QAAQ,MAAM;AAC5B;AAFgB;AAQhB,eAAsB,kBAAmB,QAAgB,QAAiB,OAAsB;AAC9F,MAAI,OAAO;AACT,UAAM,MAAM;AAAA,EACd;AACA,aAAW,CAAC,MAAM,KAAK,SAAS;AAC9B,UAAM,oBAAoB,aAAa,IAAI,MAAM,KAAK,oBAAI,IAAoC;AAC9F,QAAI,CAAC,aAAa,IAAI,MAAM,GAAG;AAC7B,mBAAa,IAAI,QAAQ,iBAAiB;AAAA,IAC5C;AACA,QAAI,WAAW,kBAAkB,IAAI,MAAM;AAC3C,QAAI,aAAa,UAAa,OAAO;AACnC,iBAAW,MAAM,6BAA6B,QAAQ,MAAM;AAC5D,wBAAkB,IAAI,QAAQ,QAAQ;AAAA,IACxC;AAAA,EACF;AACF;AAfsB;AAiBtB,eAAe,
|
|
6
|
-
"names": ["platform", "err"
|
|
4
|
+
"sourcesContent": ["//\n// Copyright \u00A9 2020, 2021 Anticrm Platform Contributors.\n// Copyright \u00A9 2021 Hardcore Engineering Inc.\n//\n// Licensed under the Eclipse Public License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License. You may\n// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\nimport { IntlMessageFormat } from 'intl-messageformat'\nimport { setPlatformStatus } from './event'\nimport { _IdInfo, _parseId } from './ident'\nimport type { IntlString, Plugin } from './platform'\nimport { Severity, Status, unknownError } from './status'\n\nimport { getMetadata } from './metadata'\nimport platform, { _EmbeddedId } from './platform'\n\n/**\n * @public\n */\nexport type Loader = (locale: string) => Promise<Record<string, string | Record<string, string>>>\n\ntype Messages = Record<string, IntlString | Record<string, IntlString>>\n\nconst loaders = new Map<Plugin, Loader>()\nconst translations = new Map<string, Map<Plugin, Messages | Status>>()\nconst cache = new Map<string, Map<IntlString, IntlMessageFormat | Status>>()\nconst englishTranslationsForMissing = new Map<Plugin, Messages | Status>()\n/**\n * @public\n * @param plugin -\n * @param loader -\n */\nexport function addStringsLoader (plugin: Plugin, loader: Loader): void {\n loaders.set(plugin, loader)\n}\n\n/**\n * Perform load of all internationalization sources for all plugins available.\n * @public\n */\nexport async function loadPluginStrings (locale: string, force: boolean = false): Promise<void> {\n if (force) {\n cache.clear()\n }\n for (const [plugin] of loaders) {\n const localtTanslations = translations.get(locale) ?? new Map<Plugin, Messages | Status<any>>()\n if (!translations.has(locale)) {\n translations.set(locale, localtTanslations)\n }\n let messages = localtTanslations.get(plugin)\n if (messages === undefined || force) {\n messages = await loadTranslationsForComponent(plugin, locale)\n localtTanslations.set(plugin, messages)\n }\n }\n}\n\nasync function setStatus (status: Status, skipError?: boolean): Promise<void> {\n if (skipError !== true) {\n await setPlatformStatus(status)\n }\n}\n\n/** Notify platform and return a Status for load/resolve paths that do not use the per-message format cache. */\nasync function pipelineErrorToStatus (err: unknown, skipError?: boolean): Promise<Status> {\n const status = unknownError(err)\n await setStatus(status, skipError)\n return status\n}\n\n/**\n * On compile/resolve failure: cache failure for this intl id, notify platform, return `message` as UI fallback.\n */\nasync function handleIntlPipelineFailure (\n err: unknown,\n message: IntlString,\n localeCache: Map<IntlString, IntlMessageFormat | Status>,\n skipError?: boolean\n): Promise<IntlString> {\n const status = unknownError(err)\n localeCache.set(message, status)\n await setStatus(status, skipError)\n return message\n}\n\nasync function loadTranslationsForComponent (\n plugin: Plugin,\n locale: string,\n skipError?: boolean\n): Promise<Messages | Status> {\n const loader = loaders.get(plugin)\n if (loader === undefined) {\n const status = new Status(Severity.ERROR, platform.status.NoLoaderForStrings, { plugin })\n await setStatus(status, skipError)\n return status\n }\n try {\n return (await loader(locale)) as Record<string, IntlString> | Status\n } catch (err) {\n console.error('No translations found for plugin', plugin, err)\n try {\n return (await loader('en')) as Record<string, IntlString> | Status\n } catch (err: any) {\n return await pipelineErrorToStatus(err, skipError)\n }\n }\n}\n\nfunction getCachedTranslation (id: _IdInfo, locale: string): IntlString | Status | undefined {\n const localtTanslations = translations.get(locale)\n if (localtTanslations === undefined) {\n return undefined\n }\n const messages = localtTanslations.get(id.component)\n if (messages === undefined) {\n return undefined\n }\n if (messages instanceof Status) {\n return messages\n }\n if (id.kind !== undefined) {\n if ((messages[id.kind] as Record<string, IntlString>)?.[id.name] !== undefined) {\n return (messages[id.kind] as Record<string, IntlString>)?.[id.name]\n }\n }\n}\n\nasync function getTranslation (\n id: _IdInfo,\n locale: string,\n skipError?: boolean\n): Promise<IntlString | Status | undefined> {\n try {\n const localtTanslations = translations.get(locale) ?? new Map<Plugin, Messages | Status<any>>()\n if (!translations.has(locale)) {\n translations.set(locale, localtTanslations)\n }\n let messages = localtTanslations.get(id.component)\n if (messages === undefined) {\n messages = await loadTranslationsForComponent(id.component, locale, skipError)\n localtTanslations.set(id.component, messages)\n }\n if (messages instanceof Status) {\n return messages\n }\n if (id.kind !== undefined) {\n if ((messages[id.kind] as Record<string, IntlString>)?.[id.name] !== undefined) {\n return (messages[id.kind] as Record<string, IntlString>)?.[id.name]\n } else {\n let eng = englishTranslationsForMissing.get(id.component)\n if (eng === undefined) {\n eng = await loadTranslationsForComponent(id.component, 'en', skipError)\n englishTranslationsForMissing.set(id.component, eng)\n }\n if (eng instanceof Status) {\n return eng\n }\n return (eng[id.kind] as Record<string, IntlString>)?.[id.name]\n }\n } else {\n return messages[id.name] as IntlString\n }\n } catch (err) {\n return await pipelineErrorToStatus(err, skipError)\n }\n}\n\n/**\n * @public\n * @param message -\n * @param params -\n * @returns\n */\nexport async function translate<P extends Record<string, any>> (\n message: IntlString<P>,\n params: P,\n language?: string,\n skipError?: boolean\n): Promise<string> {\n const locale = language ?? getMetadata(platform.metadata.locale) ?? 'en'\n const localCache = cache.get(locale) ?? new Map<IntlString, IntlMessageFormat | Status>()\n if (!cache.has(locale)) {\n cache.set(locale, localCache)\n }\n try {\n const compiled = localCache.get(message)\n\n if (compiled !== undefined) {\n if (compiled instanceof Status) {\n return message\n }\n return compiled.format(params)\n }\n const id = _parseId(message)\n if (id.component === _EmbeddedId) {\n return id.name\n }\n const translation = getCachedTranslation(id, locale) ?? (await getTranslation(id, locale, skipError)) ?? message\n if (translation instanceof Status) {\n localCache.set(message, translation)\n return message\n }\n const compiledNew = new IntlMessageFormat(translation, locale, undefined, { ignoreTag: true })\n localCache.set(message, compiledNew)\n return compiledNew.format(params)\n } catch (err) {\n return await handleIntlPipelineFailure(err, message, localCache, skipError)\n }\n}\n/**\n * Will do a translation in case language file already in cache, a translate is called and Promise is returned overwise\n */\nexport function translateCB<P extends Record<string, any>> (\n message: IntlString<P>,\n params: P,\n language: string | undefined,\n resolve: (value: string) => void,\n skipError?: boolean\n): void {\n const locale = language ?? getMetadata(platform.metadata.locale) ?? 'en'\n const localCache = cache.get(locale) ?? new Map<IntlString, IntlMessageFormat | Status>()\n if (!cache.has(locale)) {\n cache.set(locale, localCache)\n }\n try {\n const compiled = localCache.get(message)\n\n if (compiled !== undefined) {\n if (compiled instanceof Status) {\n resolve(message)\n return\n }\n resolve(compiled.format(params))\n } else {\n let id: _IdInfo\n try {\n id = _parseId(message)\n if (id.component === _EmbeddedId) {\n resolve(id.name)\n return\n }\n } catch (err) {\n void handleIntlPipelineFailure(err, message, localCache, skipError).then(resolve)\n return\n }\n const translation = getCachedTranslation(id, locale)\n if (translation === undefined || translation instanceof Status) {\n void translate(message, params, language, skipError)\n .then((res) => {\n resolve(res)\n })\n .catch((err) => {\n void handleIntlPipelineFailure(err, message, localCache, skipError).then(resolve)\n })\n return\n }\n\n const compiledNew = new IntlMessageFormat(translation, locale, undefined, { ignoreTag: true })\n localCache.set(message, compiledNew)\n resolve(compiledNew.format(params))\n }\n } catch (err) {\n void handleIntlPipelineFailure(err, message, localCache, skipError).then(resolve)\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,gCAAkC;AAClC,mBAAkC;AAClC,mBAAkC;AAElC,oBAA+C;AAE/C,sBAA4B;AAC5B,sBAAsC;AAStC,MAAM,UAAU,oBAAI,IAAoB;AACxC,MAAM,eAAe,oBAAI,IAA4C;AACrE,MAAM,QAAQ,oBAAI,IAAyD;AAC3E,MAAM,gCAAgC,oBAAI,IAA+B;AAMlE,SAAS,iBAAkB,QAAgB,QAAsB;AACtE,UAAQ,IAAI,QAAQ,MAAM;AAC5B;AAFgB;AAQhB,eAAsB,kBAAmB,QAAgB,QAAiB,OAAsB;AAC9F,MAAI,OAAO;AACT,UAAM,MAAM;AAAA,EACd;AACA,aAAW,CAAC,MAAM,KAAK,SAAS;AAC9B,UAAM,oBAAoB,aAAa,IAAI,MAAM,KAAK,oBAAI,IAAoC;AAC9F,QAAI,CAAC,aAAa,IAAI,MAAM,GAAG;AAC7B,mBAAa,IAAI,QAAQ,iBAAiB;AAAA,IAC5C;AACA,QAAI,WAAW,kBAAkB,IAAI,MAAM;AAC3C,QAAI,aAAa,UAAa,OAAO;AACnC,iBAAW,MAAM,6BAA6B,QAAQ,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;AAAA,MACF;AACA,cAAQ,SAAS,OAAO,MAAM,CAAC;AAAA,IACjC,OAAO;AACL,UAAI;AACJ,UAAI;AACF,iBAAK,uBAAS,OAAO;AACrB,YAAI,GAAG,cAAc,6BAAa;AAChC,kBAAQ,GAAG,IAAI;AACf;AAAA,QACF;AAAA,MACF,SAAS,KAAK;AACZ,aAAK,0BAA0B,KAAK,SAAS,YAAY,SAAS,EAAE,KAAK,OAAO;AAChF;AAAA,MACF;AACA,YAAM,cAAc,qBAAqB,IAAI,MAAM;AACnD,UAAI,gBAAgB,UAAa,uBAAuB,sBAAQ;AAC9D,aAAK,UAAU,SAAS,QAAQ,UAAU,SAAS,EAChD,KAAK,CAAC,QAAQ;AACb,kBAAQ,GAAG;AAAA,QACb,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,eAAK,0BAA0B,KAAK,SAAS,YAAY,SAAS,EAAE,KAAK,OAAO;AAAA,QAClF,CAAC;AACH;AAAA,MACF;AAEA,YAAM,cAAc,IAAI,4CAAkB,aAAa,QAAQ,QAAW,EAAE,WAAW,KAAK,CAAC;AAC7F,iBAAW,IAAI,SAAS,WAAW;AACnC,cAAQ,YAAY,OAAO,MAAM,CAAC;AAAA,IACpC;AAAA,EACF,SAAS,KAAK;AACZ,SAAK,0BAA0B,KAAK,SAAS,YAAY,SAAS,EAAE,KAAK,OAAO;AAAA,EAClF;AACF;AApDgB;",
|
|
6
|
+
"names": ["platform", "err"]
|
|
7
7
|
}
|
|
@@ -35,6 +35,7 @@ __export(status_exports, {
|
|
|
35
35
|
Severity: () => Severity,
|
|
36
36
|
Status: () => Status,
|
|
37
37
|
UNAUTHORIZED: () => UNAUTHORIZED,
|
|
38
|
+
errorToStatus: () => errorToStatus,
|
|
38
39
|
unknownError: () => unknownError,
|
|
39
40
|
unknownStatus: () => unknownStatus
|
|
40
41
|
});
|
|
@@ -77,6 +78,30 @@ function unknownStatus(message) {
|
|
|
77
78
|
return new Status("ERROR" /* ERROR */, import_platform.default.status.UnknownError, { message });
|
|
78
79
|
}
|
|
79
80
|
__name(unknownStatus, "unknownStatus");
|
|
81
|
+
function isStatusLike(err) {
|
|
82
|
+
if (typeof err !== "object" || err === null) return false;
|
|
83
|
+
const o = err;
|
|
84
|
+
return typeof o.severity === "string" && typeof o.code === "string" && typeof o.params === "object" && o.params !== null;
|
|
85
|
+
}
|
|
86
|
+
__name(isStatusLike, "isStatusLike");
|
|
87
|
+
function unwrapEmbeddedStatus(err) {
|
|
88
|
+
if (typeof err !== "object" || err === null || !("status" in err)) return void 0;
|
|
89
|
+
const st = err.status;
|
|
90
|
+
if (!isStatusLike(st)) return void 0;
|
|
91
|
+
return new Status(st.severity, st.code, st.params);
|
|
92
|
+
}
|
|
93
|
+
__name(unwrapEmbeddedStatus, "unwrapEmbeddedStatus");
|
|
94
|
+
function errorToStatus(err) {
|
|
95
|
+
if (err instanceof PlatformError) return err.status;
|
|
96
|
+
if (err instanceof Status) return err;
|
|
97
|
+
if (isStatusLike(err)) {
|
|
98
|
+
return new Status(err.severity, err.code, err.params);
|
|
99
|
+
}
|
|
100
|
+
const status = unwrapEmbeddedStatus(err);
|
|
101
|
+
if (status !== void 0) return status;
|
|
102
|
+
return unknownError(err);
|
|
103
|
+
}
|
|
104
|
+
__name(errorToStatus, "errorToStatus");
|
|
80
105
|
function unknownError(err) {
|
|
81
106
|
if (err instanceof PlatformError) return err.status;
|
|
82
107
|
if (err instanceof Error) return unknownStatus(err.message);
|