@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/utils.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright \u00A9 2020, 2021 Anticrm Platform Contributors.\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 { getEmbeddedLabel, getMetadata, type IntlString } from '@hcengineering/platform'\nimport { deepEqual } from 'fast-equals'\nimport { DOMAIN_BENCHMARK } from './benchmark'\nimport {\n type Account,\n AccountRole,\n type AccountUuid,\n type AnyAttribute,\n type AttachedDoc,\n type Class,\n ClassifierKind,\n type Collection,\n type Doc,\n type DocData,\n type Domain,\n DOMAIN_BLOB,\n DOMAIN_MODEL,\n DOMAIN_TRANSIENT,\n type FullTextSearchContext,\n IndexKind,\n type Obj,\n type Permission,\n type PluginConfiguration,\n type Rank,\n type Ref,\n type Role,\n roleOrder,\n type SocialId,\n SocialIdType,\n type SocialKey,\n type Space,\n type TypedSpace,\n type WorkspaceMode\n} from './classes'\nimport core from './component'\nimport { type Hierarchy } from './hierarchy'\nimport { type TxOperations } from './operations'\nimport { isPredicate } from './predicate'\nimport { type Branding, type BrandingMap } from './server'\nimport { type DocumentQuery, type FindResult } from './storage'\nimport { DOMAIN_TX, type Tx, type TxCreateDoc, type TxCUD, TxProcessor, type TxUpdateDoc } from './tx'\n\nfunction toHex (value: number, chars: number): string {\n const result = value.toString(16)\n if (result.length < chars) {\n return '0'.repeat(chars - result.length) + result\n }\n return result\n}\n\nlet counter = (Math.random() * (1 << 24)) | 0\nconst random = toHex((Math.random() * (1 << 24)) | 0, 6) + toHex((Math.random() * (1 << 16)) | 0, 4)\n\nfunction timestamp (): string {\n const time = (Date.now() / 1000) | 0\n return toHex(time, 8)\n}\n\nfunction count (): string {\n const val = counter++ & 0xffffff\n return toHex(val, 6)\n}\n\n/**\n * @public\n * @returns\n */\nexport function generateId<T extends Doc> (join: string = ''): Ref<T> {\n return (timestamp() + join + random + join + count()) as Ref<T>\n}\n\nexport function generateUuid (): string {\n // Consider own implementation if it will be slow\n return crypto.randomUUID()\n}\n\n/** @public */\nexport function isId (value: any): value is Ref<any> {\n return typeof value === 'string' && /^[0-9a-f]{24,24}$/.test(value)\n}\n\nlet currentAccount: Account\n\n/**\n * @public\n * @returns\n */\nexport function getCurrentAccount (): Account {\n return currentAccount\n}\n\n/**\n * @public\n * @param account -\n */\nexport function setCurrentAccount (account: Account): void {\n currentAccount = account\n}\n/**\n * @public\n */\nexport function escapeLikeForRegexp (value: string): string {\n return value.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n}\n\n/**\n * @public\n */\nexport function toFindResult<T extends Doc> (docs: T[], total?: number, lookupMap?: Record<string, Doc>): FindResult<T> {\n const length = total ?? docs.length\n if (Object.keys(lookupMap ?? {}).length === 0) {\n lookupMap = undefined\n }\n return Object.assign(docs, { total: length, lookupMap })\n}\n\nexport type WorkspaceUuid = string & { __workspaceUuid: true }\nexport type WorkspaceDataId = string & { __workspaceDataId: true }\nexport interface WorkspaceIds {\n uuid: WorkspaceUuid\n url: string\n dataId?: WorkspaceDataId // Old workspace identifier. E.g. Database name in Mongo, bucket in R2, etc.\n}\n\n/**\n * @public\n */\nexport function isWorkspaceCreating (mode?: WorkspaceMode): boolean {\n if (mode === undefined) {\n return false\n }\n\n return ['pending-creation', 'creating'].includes(mode)\n}\n\n/**\n * @public\n */\nexport function docKey (name: string, _class?: Ref<Class<Doc>>): string {\n return _class === undefined || _class !== core.class.Doc ? name : `${_class}%${name}`\n}\n\n/**\n * @public\n */\nexport function isFullTextAttribute (attr: AnyAttribute): boolean {\n return (\n attr.index === IndexKind.FullText ||\n attr.type._class === core.class.TypeBlob ||\n attr.type._class === core.class.EnumOf ||\n attr.type._class === core.class.TypeCollaborativeDoc\n )\n}\n\n/**\n * @public\n */\nexport function isIndexedAttribute (attr: AnyAttribute): boolean {\n return attr.index === IndexKind.Indexed || attr.index === IndexKind.IndexedDsc\n}\n\n/**\n * @public\n */\nexport interface IdMap<T extends Doc> extends Map<Ref<T>, T> {}\n\n/**\n * @public\n */\nexport function toIdMap<T extends Doc> (arr: T[]): IdMap<T> {\n return new Map(arr.map((p) => [p._id, p]))\n}\n\n/**\n * @public\n */\nexport function concatLink (host: string, path: string): string {\n if (!host.endsWith('/') && !path.startsWith('/')) {\n return `${host}/${path}`\n } else if (host.endsWith('/') && path.startsWith('/')) {\n const newPath = path.slice(1)\n return `${host}${newPath}`\n } else {\n return `${host}${path}`\n }\n}\n\n/**\n * @public\n */\nexport function fillDefaults<T extends Doc> (\n hierarchy: Hierarchy,\n object: DocData<T> | T,\n _class: Ref<Class<T>>\n): DocData<T> | T {\n const baseClass = hierarchy.isDerived(_class, core.class.AttachedDoc) ? core.class.AttachedDoc : core.class.Doc\n const attributes = hierarchy.getAllAttributes(_class, baseClass)\n for (const attribute of attributes) {\n if (attribute[1].defaultValue !== undefined) {\n if ((object as any)[attribute[0]] === undefined) {\n // Clone default value as it might be an object (e.g. array)\n ;(object as any)[attribute[0]] = structuredClone(attribute[1].defaultValue)\n }\n }\n }\n return object\n}\n\n/**\n * @public\n */\nexport class AggregateValueData {\n constructor (\n readonly name: string,\n readonly _id: Ref<Doc>,\n readonly space: Ref<Space>,\n readonly rank?: string,\n readonly category?: Ref<Doc>\n ) {}\n\n getRank (): string {\n return this.rank ?? ''\n }\n}\n\n/**\n * @public\n */\nexport class AggregateValue {\n constructor (\n readonly name: string | undefined,\n readonly values: AggregateValueData[]\n ) {}\n}\n\n/**\n * @public\n */\nexport type CategoryType = number | string | undefined | Ref<Doc> | AggregateValue\n\nexport interface IDocManager<T extends Doc> {\n get: (ref: Ref<T>) => T | undefined\n getDocs: () => T[]\n getIdMap: () => IdMap<T>\n filter: (predicate: (value: T) => boolean) => T[]\n}\n\n/**\n * @public\n */\nexport class DocManager<T extends Doc> implements IDocManager<T> {\n protected readonly byId: IdMap<T>\n\n constructor (protected readonly docs: T[]) {\n this.byId = toIdMap(docs)\n }\n\n get (ref: Ref<T>): T | undefined {\n return this.byId.get(ref)\n }\n\n getDocs (): T[] {\n return this.docs\n }\n\n getIdMap (): IdMap<T> {\n return this.byId\n }\n\n filter (predicate: (value: T) => boolean): T[] {\n return this.docs.filter(predicate)\n }\n}\n\n/**\n * @public\n */\n\nexport class RateLimiter {\n idCounter: number = 0\n processingQueue = new Map<number, Promise<void>>()\n last: number = 0\n rate: number\n\n queue: (() => Promise<void>)[] = []\n\n constructor (rate: number) {\n this.rate = rate\n }\n\n notify: (() => void)[] = []\n\n async exec<T, B extends Record<string, any> = any>(op: (args?: B) => Promise<T>, args?: B): Promise<T> {\n const processingId = this.idCounter++\n\n while (this.processingQueue.size >= this.rate) {\n await new Promise<void>((resolve) => {\n this.notify.push(resolve)\n })\n }\n try {\n const p = op(args)\n this.processingQueue.set(processingId, p as Promise<void>)\n return await p\n } finally {\n this.processingQueue.delete(processingId)\n const n = this.notify.shift()\n if (n !== undefined) {\n n()\n }\n }\n }\n\n async add<T, B extends Record<string, any> = any>(\n op: (args?: B) => Promise<T>,\n args?: B,\n errHandler?: (err: any) => void\n ): Promise<void> {\n while (this.processingQueue.size >= this.rate) {\n await new Promise<void>((resolve) => {\n this.notify.push(resolve)\n })\n }\n void this.exec(op, args).catch((err) => {\n if (errHandler !== undefined) {\n errHandler(err)\n }\n console.error('Failed to execute in rate limitter', err)\n })\n }\n\n async waitProcessing (): Promise<void> {\n while (this.processingQueue.size > 0) {\n await new Promise<void>((resolve) => {\n this.notify.push(resolve)\n })\n }\n }\n}\n\nexport function mergeQueries<T extends Doc> (query1: DocumentQuery<T>, query2: DocumentQuery<T>): DocumentQuery<T> {\n const keys1 = Object.keys(query1)\n const keys2 = Object.keys(query2)\n\n const query = {}\n\n for (const key of keys1) {\n if (!keys2.includes(key)) {\n Object.assign(query, { [key]: query1[key] })\n }\n }\n\n for (const key of keys2) {\n if (!keys1.includes(key)) {\n Object.assign(query, { [key]: query2[key] })\n } else {\n const value = mergeField(query1[key], query2[key])\n if (value !== undefined) {\n Object.assign(query, { [key]: value })\n }\n }\n }\n\n return query\n}\n\nfunction mergeField (field1: any, field2: any): any | undefined {\n // this is a special predicate that causes query never return any docs\n // it is used in cases when queries intersection is empty\n const never = { $in: [] }\n // list of ignored predicates, handled separately\n const ignored = ['$in', '$nin', '$ne']\n\n const isPredicate1 = isPredicate(field1)\n const isPredicate2 = isPredicate(field2)\n\n if (isPredicate1 && isPredicate2) {\n // $in, $nin, $eq are related fields so handle them separately here\n const result = getInNiN(field1, field2)\n\n const keys1 = Object.keys(field1)\n const keys2 = Object.keys(field2)\n\n for (const key of keys1) {\n if (ignored.includes(key)) continue\n\n if (!keys2.includes(key)) {\n Object.assign(result, { [key]: field1[key] })\n } else {\n const value = mergePredicateWithPredicate(key, field1[key], field2[key])\n if (value !== undefined) {\n Object.assign(result, { [key]: value })\n }\n }\n }\n\n for (const key of keys2) {\n if (ignored.includes(key)) continue\n\n if (!keys1.includes(key)) {\n Object.assign(result, { [key]: field2[key] })\n }\n }\n\n return Object.keys(result).length > 0 ? result : undefined\n } else if (isPredicate1 || isPredicate2) {\n // when one field is a predicate and the other is a simple value\n // we need to ensure that the value matches predicate\n const predicate = isPredicate1 ? field1 : field2\n const value = isPredicate1 ? field2 : field1\n\n for (const x in predicate) {\n const result = mergePredicateWithValue(x, predicate[x], value)\n if (\n Array.isArray(result?.$in) &&\n result.$in.length > 0 &&\n Array.isArray(result?.$nin) &&\n result.$nin.length === 0\n ) {\n delete result.$nin\n }\n if (result !== undefined) {\n return result\n }\n }\n\n // if we reached here, the value does not match the predicate\n return never\n } else {\n // both are not predicates, can filter only when values are equal\n return deepEqual(field1, field2) ? field1 : never\n }\n}\n\nfunction mergePredicateWithPredicate (predicate: string, val1: any, val2: any): any | undefined {\n if (val1 === undefined) return val2\n if (val2 === undefined) return val1\n\n switch (predicate) {\n case '$lt':\n return val1 < val2 ? val1 : val2\n case '$lte':\n return val1 <= val2 ? val1 : val2\n case '$gt':\n return val1 > val2 ? val1 : val2\n case '$gte':\n return val1 >= val2 ? val1 : val2\n }\n\n // TODO we should properly support all available predicates here\n // until then, fallback to the first predicate value\n\n return val1\n}\n\nfunction mergePredicateWithValue (predicate: string, val1: any, val2: any): any | undefined {\n switch (predicate) {\n case '$in':\n return Array.isArray(val1) && val1.includes(val2) ? val2 : undefined\n case '$nin':\n return Array.isArray(val1) && !val1.includes(val2) ? val2 : undefined\n case '$lt':\n return val2 < val1 ? val2 : undefined\n case '$lte':\n return val2 <= val1 ? val2 : undefined\n case '$gt':\n return val2 > val1 ? val2 : undefined\n case '$gte':\n return val2 >= val1 ? val2 : undefined\n case '$ne':\n return val1 !== val2 ? val2 : undefined\n }\n\n // TODO we should properly support all available predicates here\n // until then, fallback to the non-predicate value\n\n return val2\n}\n\nfunction getInNiN (query1: any, query2: any): any {\n const aIn = typeof query1 === 'object' && '$in' in query1 ? query1.$in : undefined\n const bIn = typeof query2 === 'object' && '$in' in query2 ? query2.$in : undefined\n const aNIn =\n (typeof query1 === 'object' && '$nin' in query1 ? query1.$nin : undefined) ??\n (typeof query1 === 'object' && query1.$ne !== undefined ? [query1.$ne] : [])\n const bNIn =\n (typeof query2 === 'object' && '$nin' in query2 ? query2.$nin : undefined) ??\n (typeof query1 === 'object' && query2.$ne !== undefined ? [query2.$ne] : [])\n\n const finalNin = Array.from(new Set([...aNIn, ...bNIn]))\n\n // we must keep $in if it was in the original query\n if (aIn !== undefined || bIn !== undefined) {\n const finalIn =\n aIn !== undefined && bIn !== undefined\n ? aIn.length - bIn.length < 0\n ? bIn.filter((c: any) => aIn.includes(c))\n : aIn.filter((c: any) => bIn.includes(c))\n : (aIn ?? bIn)\n return { $in: finalIn.filter((p: any) => !finalNin.includes(p)) }\n }\n // try to preserve original $ne instead of $nin\n if ((typeof query1 === 'object' && '$ne' in query1) || (typeof query2 === 'object' && '$ne' in query2)) {\n if (finalNin.length === 1) {\n return { $ne: finalNin[0] }\n }\n }\n if (finalNin.length > 0) {\n return { $nin: finalNin }\n }\n return {}\n}\n\nexport function cutObjectArray (obj: any): any {\n if (obj == null) {\n return obj\n }\n const r = {}\n for (const key of Object.keys(obj)) {\n if (Array.isArray(obj[key])) {\n if (obj[key].length > 3) {\n Object.assign(r, { [key]: [...obj[key].slice(0, 3), `... and ${obj[key].length - 3} more`] })\n } else Object.assign(r, { [key]: obj[key] })\n continue\n }\n if (typeof obj[key] === 'object' && obj[key] !== null) {\n Object.assign(r, { [key]: cutObjectArray(obj[key]) })\n continue\n }\n Object.assign(r, { [key]: obj[key] })\n }\n return r\n}\n\nexport function includesAny (arr1: string[] | null | undefined, arr2: string[] | null | undefined): boolean {\n if (arr1 == null || arr1.length === 0 || arr2 == null || arr2.length === 0) {\n return false\n }\n\n return arr1.some((m) => arr2.includes(m))\n}\n\nexport const isEnum =\n <T>(e: T) =>\n (token: any): token is T[keyof T] => {\n return typeof token === 'string' && Object.values(e as Record<string, any>).includes(token)\n }\n\nexport async function checkPermission (\n client: TxOperations,\n _id: Ref<Permission>,\n _space: Ref<TypedSpace>,\n space?: TypedSpace\n): Promise<boolean> {\n const arePermissionsDisabled = getMetadata(core.metadata.DisablePermissions) ?? false\n if (arePermissionsDisabled) return true\n\n return await hasPermission(client, _id, _space, space)\n}\n\nexport async function checkForbiddenPermission (\n client: TxOperations,\n _id: Ref<Permission>,\n _space: Ref<TypedSpace>,\n space?: TypedSpace\n): Promise<boolean> {\n const arePermissionsDisabled = getMetadata(core.metadata.DisablePermissions) ?? false\n if (arePermissionsDisabled) return false\n\n return await hasPermission(client, _id, _space, space)\n}\n\nasync function hasPermission (\n client: TxOperations,\n _id: Ref<Permission>,\n _space: Ref<TypedSpace>,\n space?: TypedSpace\n): Promise<boolean> {\n space = space ?? (await client.findOne(core.class.TypedSpace, { _id: _space }))\n const type = await client\n .getModel()\n .findOne(core.class.SpaceType, { _id: space?.type }, { lookup: { _id: { roles: core.class.Role } } })\n const mixin = type?.targetClass\n if (space === undefined || type === undefined || mixin === undefined) {\n return false\n }\n\n const me = getCurrentAccount()\n const asMixin = client.getHierarchy().as(space, mixin)\n const myRoles = type.$lookup?.roles?.filter((role) => ((asMixin as any)[role._id] ?? []).includes(me.uuid)) as Role[]\n\n if (myRoles === undefined) {\n return false\n }\n\n const myPermissions = new Set(myRoles.flatMap((role) => role.permissions))\n\n return myPermissions.has(_id)\n}\n\n/**\n * @public\n */\nexport function getRoleAttributeLabel (roleName: string): IntlString {\n return getEmbeddedLabel(`Role: ${roleName.trim()}`)\n}\n\n/**\n * @public\n */\nexport function getFullTextIndexableAttributes (\n hierarchy: Hierarchy,\n clazz: Ref<Class<Obj>>,\n skipDocs: boolean = false\n): AnyAttribute[] {\n const allAttributes = hierarchy.getAllAttributes(clazz)\n const result: AnyAttribute[] = []\n for (const [, attr] of allAttributes) {\n if (skipDocs && (attr.attributeOf === core.class.Doc || attr.attributeOf === core.class.AttachedDoc)) {\n continue\n }\n if (isFullTextAttribute(attr) || isIndexedAttribute(attr)) {\n result.push(attr)\n }\n }\n\n hierarchy\n .getDescendants(clazz)\n .filter((m) => hierarchy.getClass(m).kind === ClassifierKind.MIXIN)\n .forEach((m) => {\n for (const [, v] of hierarchy.getAllAttributes(m, clazz)) {\n if (skipDocs && (v.attributeOf === core.class.Doc || v.attributeOf === core.class.AttachedDoc)) {\n continue\n }\n if (isFullTextAttribute(v) || isIndexedAttribute(v)) {\n result.push(v)\n }\n }\n })\n return result\n}\n\nconst ctxKey = 'indexer_ftc'\n/**\n * @public\n */\nexport function getFullTextContext (\n hierarchy: Hierarchy,\n objectClass: Ref<Class<Doc>>,\n contexts: Map<Ref<Class<Doc>>, FullTextSearchContext>\n): Omit<FullTextSearchContext, keyof Class<Doc>> {\n let ctx: Omit<FullTextSearchContext, keyof Class<Doc>> | undefined = hierarchy.getClassifierProp(objectClass, ctxKey)\n if (ctx !== undefined) {\n return ctx\n }\n if (typeof ctx !== 'string') {\n const anc = hierarchy.getAncestors(objectClass)\n for (const oc of anc) {\n const ctx = contexts.get(oc)\n if (ctx !== undefined) {\n hierarchy.setClassifierProp(objectClass, ctxKey, ctx)\n return ctx\n }\n }\n }\n ctx = {\n toClass: objectClass,\n fullTextSummary: false,\n forceIndex: false\n }\n hierarchy.setClassifierProp(objectClass, ctxKey, ctx)\n return ctx\n}\n\n/**\n * @public\n */\nexport function isClassIndexable (\n hierarchy: Hierarchy,\n c: Ref<Class<Doc>>,\n contexts: Map<Ref<Class<Doc>>, FullTextSearchContext>\n): boolean {\n const indexed = hierarchy.getClassifierProp(c, 'class_indexed')\n if (indexed !== undefined) {\n return indexed as boolean\n }\n const domain = hierarchy.findDomain(c)\n if (domain === undefined) {\n hierarchy.setClassifierProp(c, 'class_indexed', false)\n return false\n }\n\n if (\n domain === DOMAIN_TX ||\n domain === DOMAIN_MODEL ||\n domain === DOMAIN_BLOB ||\n domain === ('preference' as Domain) ||\n domain === DOMAIN_TRANSIENT ||\n domain === ('settings' as Domain) ||\n domain === DOMAIN_BENCHMARK\n ) {\n hierarchy.setClassifierProp(c, 'class_indexed', false)\n return false\n }\n\n const indexMixin = hierarchy.classHierarchyMixin(c, core.mixin.IndexConfiguration)\n if (indexMixin?.searchDisabled !== undefined && indexMixin?.searchDisabled) {\n hierarchy.setClassifierProp(c, 'class_indexed', false)\n return false\n }\n\n const attrs = getFullTextIndexableAttributes(hierarchy, c, true)\n for (const d of hierarchy.getDescendants(c)) {\n if (hierarchy.isMixin(d)) {\n attrs.push(...getFullTextIndexableAttributes(hierarchy, d, true))\n }\n }\n\n let result = true\n\n if (attrs.length === 0 && !(getFullTextContext(hierarchy, c, contexts)?.forceIndex ?? false)) {\n result = false\n // We need check if document has collections with indexable fields.\n const attrs = hierarchy.getAllAttributes(c).values()\n for (const attr of attrs) {\n if (attr.type._class === core.class.Collection) {\n if (isClassIndexable(hierarchy, (attr.type as Collection<AttachedDoc>).of, contexts)) {\n result = true\n break\n }\n }\n }\n }\n hierarchy.setClassifierProp(c, 'class_indexed', result)\n return result\n}\n\ntype ReduceParameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never\n\ninterface NextCall {\n op: () => Promise<void>\n}\n\n/**\n * Utility method to skip middle update calls, optimistically if update function is called multiple times with few different parameters, only the last variant will be executed.\n * The last invocation is executed after a few cycles, allowing to skip middle ones.\n *\n * This method can be used inside Svelte components to collapse complex update logic and handle interactions.\n */\nexport function reduceCalls<T extends (...args: ReduceParameters<T>) => Promise<void>> (\n operation: T\n): (...args: ReduceParameters<T>) => Promise<void> {\n let nextCall: NextCall | undefined\n let currentCall: NextCall | undefined\n\n const next = (): void => {\n currentCall = nextCall\n nextCall = undefined\n if (currentCall !== undefined) {\n void currentCall.op().catch()\n }\n }\n return async function (...args: ReduceParameters<T>): Promise<void> {\n const myOp = async (): Promise<void> => {\n try {\n await operation(...args)\n } catch (err: any) {\n console.error('Error occurred in reduceCalls:', err)\n }\n next()\n }\n\n nextCall = { op: myOp }\n await Promise.resolve()\n if (currentCall === undefined) {\n next()\n }\n }\n}\n\nexport function isOwnerOrMaintainer (): boolean {\n const account = getCurrentAccount()\n return hasAccountRole(account, AccountRole.Maintainer)\n}\n\nexport function hasAccountRole (acc: Account, targerRole: AccountRole): boolean {\n return roleOrder[acc.role] >= roleOrder[targerRole]\n}\n\nexport function getBranding (brandings: BrandingMap, key: string | undefined): Branding | null {\n if (key === undefined) return null\n\n return Object.values(brandings).find((branding) => branding.key === key) ?? null\n}\n\nexport function fillConfiguration (systemTx: Tx[], configs: Map<Ref<PluginConfiguration>, PluginConfiguration>): void {\n for (const t of systemTx) {\n if (t._class === core.class.TxCreateDoc) {\n const ct = t as TxCreateDoc<Doc>\n if (ct.objectClass === core.class.PluginConfiguration) {\n configs.set(ct.objectId as Ref<PluginConfiguration>, TxProcessor.createDoc2Doc(ct) as PluginConfiguration)\n }\n } else if (t._class === core.class.TxUpdateDoc) {\n const ut = t as TxUpdateDoc<Doc>\n if (ut.objectClass === core.class.PluginConfiguration) {\n const c = configs.get(ut.objectId as Ref<PluginConfiguration>)\n if (c !== undefined) {\n if (c.system !== true || ut.modifiedBy === core.account.ConfigUser) {\n TxProcessor.updateDoc2Doc(c, ut)\n }\n }\n }\n }\n }\n}\n\nexport function pluginFilterTx (\n excludedPlugins: PluginConfiguration[],\n configs: Map<Ref<PluginConfiguration>, PluginConfiguration>,\n systemTx: Tx[]\n): Tx[] {\n const stx = toIdMap(systemTx)\n const totalExcluded = new Set<Ref<Tx>>()\n let msg = ''\n for (const a of excludedPlugins) {\n for (const c of configs.values()) {\n if (a.pluginId === c.pluginId) {\n for (const id of c.transactions) {\n if (c.classFilter !== undefined) {\n const filter = new Set(c.classFilter)\n const tx = stx.get(id as Ref<Tx>)\n if (\n tx?._class === core.class.TxCreateDoc ||\n tx?._class === core.class.TxUpdateDoc ||\n tx?._class === core.class.TxRemoveDoc\n ) {\n const cud = tx as TxCUD<Doc>\n if (filter.has(cud.objectClass)) {\n totalExcluded.add(id as Ref<Tx>)\n }\n }\n } else {\n totalExcluded.add(id as Ref<Tx>)\n }\n }\n msg += ` ${c.pluginId}:${c.transactions.length}`\n }\n }\n }\n if (typeof window !== 'undefined') {\n console.log('exclude plugin', msg)\n }\n systemTx = systemTx.filter((t) => !totalExcluded.has(t._id))\n return systemTx\n}\n\n/**\n * @public\n */\nexport class TimeRateLimiter {\n idCounter: number = 0\n active: number = 0\n last: number = 0\n rate: number\n period: number\n executions: { time: number, running: boolean }[] = []\n\n queue: (() => Promise<void>)[] = []\n notify: (() => void)[] = []\n\n constructor (rate: number, period: number = 1000) {\n this.rate = rate\n this.period = period\n }\n\n private cleanupExecutions (): void {\n const now = Date.now()\n this.executions = this.executions.filter((time) => time.running || now - time.time < this.period)\n }\n\n async exec<T, B extends Record<string, any> = any>(op: (args?: B) => Promise<T>, args?: B): Promise<T> {\n while (this.active >= this.rate || this.executions.length >= this.rate) {\n this.cleanupExecutions()\n if (this.executions.length < this.rate) {\n break\n }\n await new Promise<void>((resolve) => {\n setTimeout(resolve, this.period / this.rate)\n })\n }\n\n const v = { time: Date.now(), running: true }\n this.active++\n try {\n this.executions.push(v)\n const p = op(args)\n return await p\n } finally {\n v.running = false\n this.active--\n this.cleanupExecutions()\n const n = this.notify.shift()\n if (n !== undefined) {\n n()\n }\n }\n }\n\n async waitProcessing (): Promise<void> {\n while (this.active > 0) {\n await new Promise<void>((resolve) => {\n this.notify.push(resolve)\n })\n }\n }\n}\n\nexport function combineAttributes (\n attributes: any[],\n key: string,\n operator: '$push' | '$pull' | '$unset',\n arrayKey?: '$each' | '$in'\n): any[] {\n return Array.from(\n new Set(\n attributes.flatMap((attr) => {\n if (arrayKey === undefined) {\n return attr[operator]?.[key]\n }\n\n return Array.isArray(attr[operator]?.[key]?.[arrayKey])\n ? attr[operator]?.[key]?.[arrayKey]\n : attr[operator]?.[key]\n })\n )\n ).filter((v) => v != null)\n}\n\nexport function buildSocialIdString (key: SocialKey): string {\n return `${key.type}:${key.value}`\n}\n\nexport function parseSocialIdString (id: string): SocialKey {\n const [type, value] = id.split(':')\n\n if (type === undefined || value === undefined) {\n throw new Error(`Social id is not valid: ${id}`)\n }\n\n if (!Object.values(SocialIdType).includes(type as SocialIdType)) {\n throw new Error(`Social id type is not valid: ${id}`)\n }\n\n return { type: type as SocialIdType, value }\n}\n\nexport function pickPrimarySocialId (socialIds: SocialId[]): SocialId {\n const activeSocialIds = socialIds.filter((si) => si.isDeleted !== true)\n if (activeSocialIds.length === 0) {\n throw new Error('No active social ids provided')\n }\n const hulySocialIds = activeSocialIds.filter((si) => si.type === SocialIdType.HULY)\n\n return hulySocialIds[0] ?? activeSocialIds[0]\n}\n\nexport const loginSocialTypes = [SocialIdType.EMAIL, SocialIdType.GOOGLE, SocialIdType.GITHUB, SocialIdType.OIDC]\n\nexport function notEmpty<T> (id: T | undefined | null): id is T {\n return id !== undefined && id !== null && id !== ''\n}\n\nexport function unique<T> (arr: T[]): T[] {\n return Array.from(new Set(arr))\n}\n\nexport function uniqueNotEmpty<T extends NonNullable<unknown>> (arr: Array<T | undefined | null>): T[] {\n return unique(arr).filter(notEmpty)\n}\nexport { platformNow, platformNowDiff } from '@hcengineering/measurements'\n\nexport interface PermissionsGrant {\n spaces?: Ref<Space>[]\n grantedBy?: AccountUuid\n}\n\nexport type KeysByType<O extends object, T> = { [k in keyof O]-?: O[k] extends T ? k : never }[keyof O]\n\nexport function toRank (str: string | undefined): Rank | undefined {\n if (str === undefined) return\n if (str.startsWith('0|')) {\n return str\n }\n return '0|' + str.replaceAll(/[-:_]/g, '').toLowerCase()\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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C;AACpE,QAAM,kBAAkB,UAAU,OAAO,CAAC,OAAO,GAAG,cAAc,IAAI;AACtE,MAAI,gBAAgB,WAAW,GAAG;AAChC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AACA,QAAM,gBAAgB,gBAAgB,OAAO,CAAC,OAAO,GAAG,SAAS,4BAAa,IAAI;AAElF,SAAO,cAAc,CAAC,KAAK,gBAAgB,CAAC;AAC9C;AARgB;AAUT,MAAM,mBAAmB,CAAC,4BAAa,OAAO,4BAAa,QAAQ,4BAAa,QAAQ,4BAAa,IAAI;AAEzG,SAAS,SAAa,IAAmC;AAC9D,SAAO,OAAO,UAAa,OAAO,QAAQ,OAAO;AACnD;AAFgB;AAIT,SAAS,OAAW,KAAe;AACxC,SAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC;AAChC;AAFgB;AAIT,SAAS,eAAgD,KAAuC;AACrG,SAAO,OAAO,GAAG,EAAE,OAAO,QAAQ;AACpC;AAFgB;AAYT,SAAS,OAAQ,KAA2C;AACjE,MAAI,QAAQ,OAAW;AACvB,MAAI,IAAI,WAAW,IAAI,GAAG;AACxB,WAAO;AAAA,EACT;AACA,SAAO,OAAO,IAAI,WAAW,UAAU,EAAE,EAAE,YAAY;AACzD;AANgB;",
|
|
4
|
+
"sourcesContent": ["//\n// Copyright \u00A9 2020, 2021 Anticrm Platform Contributors.\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 { getEmbeddedLabel, getMetadata, type IntlString } from '@hcengineering/platform'\nimport { deepEqual } from 'fast-equals'\nimport { DOMAIN_BENCHMARK } from './benchmark'\nimport {\n type Account,\n AccountRole,\n type AccountUuid,\n type AnyAttribute,\n type AttachedDoc,\n type Class,\n ClassifierKind,\n type Collection,\n type Doc,\n type DocData,\n type Domain,\n DOMAIN_BLOB,\n DOMAIN_MODEL,\n DOMAIN_TRANSIENT,\n type FullTextSearchContext,\n IndexKind,\n type Obj,\n type Permission,\n type PluginConfiguration,\n type Rank,\n type Ref,\n type Role,\n roleOrder,\n type SocialId,\n SocialIdType,\n type SocialKey,\n type Space,\n type TypedSpace,\n type WorkspaceMode\n} from './classes'\nimport core from './component'\nimport { type Hierarchy } from './hierarchy'\nimport { type TxOperations } from './operations'\nimport { isPredicate } from './predicate'\nimport { type Branding, type BrandingMap } from './server'\nimport { type DocumentQuery, type FindResult } from './storage'\nimport { DOMAIN_TX, type Tx, type TxCreateDoc, type TxCUD, TxProcessor, type TxUpdateDoc } from './tx'\n\nfunction toHex (value: number, chars: number): string {\n const result = value.toString(16)\n if (result.length < chars) {\n return '0'.repeat(chars - result.length) + result\n }\n return result\n}\n\nlet counter = (Math.random() * (1 << 24)) | 0\nconst random = toHex((Math.random() * (1 << 24)) | 0, 6) + toHex((Math.random() * (1 << 16)) | 0, 4)\n\nfunction timestamp (): string {\n const time = (Date.now() / 1000) | 0\n return toHex(time, 8)\n}\n\nfunction count (): string {\n const val = counter++ & 0xffffff\n return toHex(val, 6)\n}\n\n/**\n * @public\n * @returns\n */\nexport function generateId<T extends Doc> (join: string = ''): Ref<T> {\n return (timestamp() + join + random + join + count()) as Ref<T>\n}\n\nexport function generateUuid (): string {\n // Consider own implementation if it will be slow\n return crypto.randomUUID()\n}\n\n/** @public */\nexport function isId (value: any): value is Ref<any> {\n return typeof value === 'string' && /^[0-9a-f]{24,24}$/.test(value)\n}\n\nlet currentAccount: Account\n\n/**\n * @public\n * @returns\n */\nexport function getCurrentAccount (): Account {\n return currentAccount\n}\n\n/**\n * @public\n * @param account -\n */\nexport function setCurrentAccount (account: Account): void {\n currentAccount = account\n}\n/**\n * @public\n */\nexport function escapeLikeForRegexp (value: string): string {\n return value.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n}\n\n/**\n * @public\n */\nexport function toFindResult<T extends Doc> (docs: T[], total?: number, lookupMap?: Record<string, Doc>): FindResult<T> {\n const length = total ?? docs.length\n if (Object.keys(lookupMap ?? {}).length === 0) {\n lookupMap = undefined\n }\n return Object.assign(docs, { total: length, lookupMap })\n}\n\nexport type WorkspaceUuid = string & { __workspaceUuid: true }\nexport type WorkspaceDataId = string & { __workspaceDataId: true }\nexport interface WorkspaceIds {\n uuid: WorkspaceUuid\n url: string\n dataId?: WorkspaceDataId // Old workspace identifier. E.g. Database name in Mongo, bucket in R2, etc.\n}\n\n/**\n * @public\n */\nexport function isWorkspaceCreating (mode?: WorkspaceMode): boolean {\n if (mode === undefined) {\n return false\n }\n\n return ['pending-creation', 'creating'].includes(mode)\n}\n\n/**\n * @public\n */\nexport function docKey (name: string, _class?: Ref<Class<Doc>>): string {\n return _class === undefined || _class !== core.class.Doc ? name : `${_class}%${name}`\n}\n\n/**\n * @public\n */\nexport function isFullTextAttribute (attr: AnyAttribute): boolean {\n return (\n attr.index === IndexKind.FullText ||\n attr.type._class === core.class.TypeBlob ||\n attr.type._class === core.class.EnumOf ||\n attr.type._class === core.class.TypeCollaborativeDoc\n )\n}\n\n/**\n * @public\n */\nexport function isIndexedAttribute (attr: AnyAttribute): boolean {\n return attr.index === IndexKind.Indexed || attr.index === IndexKind.IndexedDsc\n}\n\n/**\n * @public\n */\nexport interface IdMap<T extends Doc> extends Map<Ref<T>, T> {}\n\n/**\n * @public\n */\nexport function toIdMap<T extends Doc> (arr: T[]): IdMap<T> {\n return new Map(arr.map((p) => [p._id, p]))\n}\n\n/**\n * @public\n */\nexport function concatLink (host: string, path: string): string {\n if (!host.endsWith('/') && !path.startsWith('/')) {\n return `${host}/${path}`\n } else if (host.endsWith('/') && path.startsWith('/')) {\n const newPath = path.slice(1)\n return `${host}${newPath}`\n } else {\n return `${host}${path}`\n }\n}\n\n/**\n * @public\n */\nexport function fillDefaults<T extends Doc> (\n hierarchy: Hierarchy,\n object: DocData<T> | T,\n _class: Ref<Class<T>>\n): DocData<T> | T {\n const baseClass = hierarchy.isDerived(_class, core.class.AttachedDoc) ? core.class.AttachedDoc : core.class.Doc\n const attributes = hierarchy.getAllAttributes(_class, baseClass)\n for (const attribute of attributes) {\n if (attribute[1].defaultValue != null) {\n if ((object as any)[attribute[0]] === undefined) {\n // Clone default value as it might be an object (e.g. array)\n ;(object as any)[attribute[0]] = structuredClone(attribute[1].defaultValue)\n }\n }\n }\n return object\n}\n\n/**\n * @public\n */\nexport class AggregateValueData {\n constructor (\n readonly name: string,\n readonly _id: Ref<Doc>,\n readonly space: Ref<Space>,\n readonly rank?: string,\n readonly category?: Ref<Doc>\n ) {}\n\n getRank (): string {\n return this.rank ?? ''\n }\n}\n\n/**\n * @public\n */\nexport class AggregateValue {\n constructor (\n readonly name: string | undefined,\n readonly values: AggregateValueData[]\n ) {}\n}\n\n/**\n * @public\n */\nexport type CategoryType = number | string | undefined | Ref<Doc> | AggregateValue\n\nexport interface IDocManager<T extends Doc> {\n get: (ref: Ref<T>) => T | undefined\n getDocs: () => T[]\n getIdMap: () => IdMap<T>\n filter: (predicate: (value: T) => boolean) => T[]\n}\n\n/**\n * @public\n */\nexport class DocManager<T extends Doc> implements IDocManager<T> {\n protected readonly byId: IdMap<T>\n\n constructor (protected readonly docs: T[]) {\n this.byId = toIdMap(docs)\n }\n\n get (ref: Ref<T>): T | undefined {\n return this.byId.get(ref)\n }\n\n getDocs (): T[] {\n return this.docs\n }\n\n getIdMap (): IdMap<T> {\n return this.byId\n }\n\n filter (predicate: (value: T) => boolean): T[] {\n return this.docs.filter(predicate)\n }\n}\n\n/**\n * @public\n */\n\nexport class RateLimiter {\n idCounter: number = 0\n processingQueue = new Map<number, Promise<void>>()\n last: number = 0\n rate: number\n\n queue: (() => Promise<void>)[] = []\n\n constructor (rate: number) {\n this.rate = rate\n }\n\n notify: (() => void)[] = []\n\n async exec<T, B extends Record<string, any> = any>(op: (args?: B) => Promise<T>, args?: B): Promise<T> {\n const processingId = this.idCounter++\n\n while (this.processingQueue.size >= this.rate) {\n await new Promise<void>((resolve) => {\n this.notify.push(resolve)\n })\n }\n try {\n const p = op(args)\n this.processingQueue.set(processingId, p as Promise<void>)\n return await p\n } finally {\n this.processingQueue.delete(processingId)\n const n = this.notify.shift()\n if (n !== undefined) {\n n()\n }\n }\n }\n\n async add<T, B extends Record<string, any> = any>(\n op: (args?: B) => Promise<T>,\n args?: B,\n errHandler?: (err: any) => void\n ): Promise<void> {\n while (this.processingQueue.size >= this.rate) {\n await new Promise<void>((resolve) => {\n this.notify.push(resolve)\n })\n }\n void this.exec(op, args).catch((err) => {\n if (errHandler !== undefined) {\n errHandler(err)\n }\n console.error('Failed to execute in rate limitter', err)\n })\n }\n\n async waitProcessing (): Promise<void> {\n while (this.processingQueue.size > 0) {\n await new Promise<void>((resolve) => {\n this.notify.push(resolve)\n })\n }\n }\n}\n\nexport function mergeQueries<T extends Doc> (query1: DocumentQuery<T>, query2: DocumentQuery<T>): DocumentQuery<T> {\n const keys1 = Object.keys(query1)\n const keys2 = Object.keys(query2)\n\n const query = {}\n\n for (const key of keys1) {\n if (!keys2.includes(key)) {\n Object.assign(query, { [key]: query1[key] })\n }\n }\n\n for (const key of keys2) {\n if (!keys1.includes(key)) {\n Object.assign(query, { [key]: query2[key] })\n } else {\n const value = mergeField(query1[key], query2[key])\n if (value !== undefined) {\n Object.assign(query, { [key]: value })\n }\n }\n }\n\n return query\n}\n\nfunction mergeField (field1: any, field2: any): any | undefined {\n // this is a special predicate that causes query never return any docs\n // it is used in cases when queries intersection is empty\n const never = { $in: [] }\n // list of ignored predicates, handled separately\n const ignored = ['$in', '$nin', '$ne']\n\n const isPredicate1 = isPredicate(field1)\n const isPredicate2 = isPredicate(field2)\n\n if (isPredicate1 && isPredicate2) {\n // $in, $nin, $eq are related fields so handle them separately here\n const result = getInNiN(field1, field2)\n\n const keys1 = Object.keys(field1)\n const keys2 = Object.keys(field2)\n\n for (const key of keys1) {\n if (ignored.includes(key)) continue\n\n if (!keys2.includes(key)) {\n Object.assign(result, { [key]: field1[key] })\n } else {\n const value = mergePredicateWithPredicate(key, field1[key], field2[key])\n if (value !== undefined) {\n Object.assign(result, { [key]: value })\n }\n }\n }\n\n for (const key of keys2) {\n if (ignored.includes(key)) continue\n\n if (!keys1.includes(key)) {\n Object.assign(result, { [key]: field2[key] })\n }\n }\n\n return Object.keys(result).length > 0 ? result : undefined\n } else if (isPredicate1 || isPredicate2) {\n // when one field is a predicate and the other is a simple value\n // we need to ensure that the value matches predicate\n const predicate = isPredicate1 ? field1 : field2\n const value = isPredicate1 ? field2 : field1\n\n for (const x in predicate) {\n const result = mergePredicateWithValue(x, predicate[x], value)\n if (\n Array.isArray(result?.$in) &&\n result.$in.length > 0 &&\n Array.isArray(result?.$nin) &&\n result.$nin.length === 0\n ) {\n delete result.$nin\n }\n if (result !== undefined) {\n return result\n }\n }\n\n // if we reached here, the value does not match the predicate\n return never\n } else {\n // both are not predicates, can filter only when values are equal\n return deepEqual(field1, field2) ? field1 : never\n }\n}\n\nfunction mergePredicateWithPredicate (predicate: string, val1: any, val2: any): any | undefined {\n if (val1 === undefined) return val2\n if (val2 === undefined) return val1\n\n switch (predicate) {\n case '$lt':\n return val1 < val2 ? val1 : val2\n case '$lte':\n return val1 <= val2 ? val1 : val2\n case '$gt':\n return val1 > val2 ? val1 : val2\n case '$gte':\n return val1 >= val2 ? val1 : val2\n }\n\n // TODO we should properly support all available predicates here\n // until then, fallback to the first predicate value\n\n return val1\n}\n\nfunction mergePredicateWithValue (predicate: string, val1: any, val2: any): any | undefined {\n switch (predicate) {\n case '$in':\n return Array.isArray(val1) && val1.includes(val2) ? val2 : undefined\n case '$nin':\n return Array.isArray(val1) && !val1.includes(val2) ? val2 : undefined\n case '$lt':\n return val2 < val1 ? val2 : undefined\n case '$lte':\n return val2 <= val1 ? val2 : undefined\n case '$gt':\n return val2 > val1 ? val2 : undefined\n case '$gte':\n return val2 >= val1 ? val2 : undefined\n case '$ne':\n return val1 !== val2 ? val2 : undefined\n }\n\n // TODO we should properly support all available predicates here\n // until then, fallback to the non-predicate value\n\n return val2\n}\n\nfunction getInNiN (query1: any, query2: any): any {\n const aIn = typeof query1 === 'object' && '$in' in query1 ? query1.$in : undefined\n const bIn = typeof query2 === 'object' && '$in' in query2 ? query2.$in : undefined\n const aNIn =\n (typeof query1 === 'object' && '$nin' in query1 ? query1.$nin : undefined) ??\n (typeof query1 === 'object' && query1.$ne !== undefined ? [query1.$ne] : [])\n const bNIn =\n (typeof query2 === 'object' && '$nin' in query2 ? query2.$nin : undefined) ??\n (typeof query1 === 'object' && query2.$ne !== undefined ? [query2.$ne] : [])\n\n const finalNin = Array.from(new Set([...aNIn, ...bNIn]))\n\n // we must keep $in if it was in the original query\n if (aIn !== undefined || bIn !== undefined) {\n const finalIn =\n aIn !== undefined && bIn !== undefined\n ? aIn.length - bIn.length < 0\n ? bIn.filter((c: any) => aIn.includes(c))\n : aIn.filter((c: any) => bIn.includes(c))\n : (aIn ?? bIn)\n return { $in: finalIn.filter((p: any) => !finalNin.includes(p)) }\n }\n // try to preserve original $ne instead of $nin\n if ((typeof query1 === 'object' && '$ne' in query1) || (typeof query2 === 'object' && '$ne' in query2)) {\n if (finalNin.length === 1) {\n return { $ne: finalNin[0] }\n }\n }\n if (finalNin.length > 0) {\n return { $nin: finalNin }\n }\n return {}\n}\n\nexport function cutObjectArray (obj: any): any {\n if (obj == null) {\n return obj\n }\n const r = {}\n for (const key of Object.keys(obj)) {\n if (Array.isArray(obj[key])) {\n if (obj[key].length > 3) {\n Object.assign(r, { [key]: [...obj[key].slice(0, 3), `... and ${obj[key].length - 3} more`] })\n } else Object.assign(r, { [key]: obj[key] })\n continue\n }\n if (typeof obj[key] === 'object' && obj[key] !== null) {\n Object.assign(r, { [key]: cutObjectArray(obj[key]) })\n continue\n }\n Object.assign(r, { [key]: obj[key] })\n }\n return r\n}\n\nexport function includesAny (arr1: string[] | null | undefined, arr2: string[] | null | undefined): boolean {\n if (arr1 == null || arr1.length === 0 || arr2 == null || arr2.length === 0) {\n return false\n }\n\n return arr1.some((m) => arr2.includes(m))\n}\n\nexport const isEnum =\n <T>(e: T) =>\n (token: any): token is T[keyof T] => {\n return typeof token === 'string' && Object.values(e as Record<string, any>).includes(token)\n }\n\nexport async function checkPermission (\n client: TxOperations,\n _id: Ref<Permission>,\n _space: Ref<TypedSpace>,\n space?: TypedSpace\n): Promise<boolean> {\n const arePermissionsDisabled = getMetadata(core.metadata.DisablePermissions) ?? false\n if (arePermissionsDisabled) return true\n\n return await hasPermission(client, _id, _space, space)\n}\n\nexport async function checkForbiddenPermission (\n client: TxOperations,\n _id: Ref<Permission>,\n _space: Ref<TypedSpace>,\n space?: TypedSpace\n): Promise<boolean> {\n const arePermissionsDisabled = getMetadata(core.metadata.DisablePermissions) ?? false\n if (arePermissionsDisabled) return false\n\n return await hasPermission(client, _id, _space, space)\n}\n\nasync function hasPermission (\n client: TxOperations,\n _id: Ref<Permission>,\n _space: Ref<TypedSpace>,\n space?: TypedSpace\n): Promise<boolean> {\n space = space ?? (await client.findOne(core.class.TypedSpace, { _id: _space }))\n const type = await client\n .getModel()\n .findOne(core.class.SpaceType, { _id: space?.type }, { lookup: { _id: { roles: core.class.Role } } })\n const mixin = type?.targetClass\n if (space === undefined || type === undefined || mixin === undefined) {\n return false\n }\n\n const me = getCurrentAccount()\n const asMixin = client.getHierarchy().as(space, mixin)\n const myRoles = type.$lookup?.roles?.filter((role) => ((asMixin as any)[role._id] ?? []).includes(me.uuid)) as Role[]\n\n if (myRoles === undefined) {\n return false\n }\n\n const myPermissions = new Set(myRoles.flatMap((role) => role.permissions))\n\n return myPermissions.has(_id)\n}\n\n/**\n * @public\n */\nexport function getRoleAttributeLabel (roleName: string): IntlString {\n return getEmbeddedLabel(`Role: ${roleName.trim()}`)\n}\n\n/**\n * @public\n */\nexport function getFullTextIndexableAttributes (\n hierarchy: Hierarchy,\n clazz: Ref<Class<Obj>>,\n skipDocs: boolean = false\n): AnyAttribute[] {\n const allAttributes = hierarchy.getAllAttributes(clazz)\n const result: AnyAttribute[] = []\n for (const [, attr] of allAttributes) {\n if (skipDocs && (attr.attributeOf === core.class.Doc || attr.attributeOf === core.class.AttachedDoc)) {\n continue\n }\n if (isFullTextAttribute(attr) || isIndexedAttribute(attr)) {\n result.push(attr)\n }\n }\n\n hierarchy\n .getDescendants(clazz)\n .filter((m) => hierarchy.getClass(m).kind === ClassifierKind.MIXIN)\n .forEach((m) => {\n for (const [, v] of hierarchy.getAllAttributes(m, clazz)) {\n if (skipDocs && (v.attributeOf === core.class.Doc || v.attributeOf === core.class.AttachedDoc)) {\n continue\n }\n if (isFullTextAttribute(v) || isIndexedAttribute(v)) {\n result.push(v)\n }\n }\n })\n return result\n}\n\nconst ctxKey = 'indexer_ftc'\n/**\n * @public\n */\nexport function getFullTextContext (\n hierarchy: Hierarchy,\n objectClass: Ref<Class<Doc>>,\n contexts: Map<Ref<Class<Doc>>, FullTextSearchContext>\n): Omit<FullTextSearchContext, keyof Class<Doc>> {\n let ctx: Omit<FullTextSearchContext, keyof Class<Doc>> | undefined = hierarchy.getClassifierProp(objectClass, ctxKey)\n if (ctx !== undefined) {\n return ctx\n }\n if (typeof ctx !== 'string') {\n const anc = hierarchy.getAncestors(objectClass)\n for (const oc of anc) {\n const ctx = contexts.get(oc)\n if (ctx !== undefined) {\n hierarchy.setClassifierProp(objectClass, ctxKey, ctx)\n return ctx\n }\n }\n }\n ctx = {\n toClass: objectClass,\n fullTextSummary: false,\n forceIndex: false\n }\n hierarchy.setClassifierProp(objectClass, ctxKey, ctx)\n return ctx\n}\n\n/**\n * @public\n */\nexport function isClassIndexable (\n hierarchy: Hierarchy,\n c: Ref<Class<Doc>>,\n contexts: Map<Ref<Class<Doc>>, FullTextSearchContext>\n): boolean {\n const indexed = hierarchy.getClassifierProp(c, 'class_indexed')\n if (indexed !== undefined) {\n return indexed as boolean\n }\n const domain = hierarchy.findDomain(c)\n if (domain === undefined) {\n hierarchy.setClassifierProp(c, 'class_indexed', false)\n return false\n }\n\n if (\n domain === DOMAIN_TX ||\n domain === DOMAIN_MODEL ||\n domain === DOMAIN_BLOB ||\n domain === ('preference' as Domain) ||\n domain === DOMAIN_TRANSIENT ||\n domain === ('settings' as Domain) ||\n domain === DOMAIN_BENCHMARK\n ) {\n hierarchy.setClassifierProp(c, 'class_indexed', false)\n return false\n }\n\n const indexMixin = hierarchy.classHierarchyMixin(c, core.mixin.IndexConfiguration)\n if (indexMixin?.searchDisabled !== undefined && indexMixin?.searchDisabled) {\n hierarchy.setClassifierProp(c, 'class_indexed', false)\n return false\n }\n\n const attrs = getFullTextIndexableAttributes(hierarchy, c, true)\n for (const d of hierarchy.getDescendants(c)) {\n if (hierarchy.isMixin(d)) {\n attrs.push(...getFullTextIndexableAttributes(hierarchy, d, true))\n }\n }\n\n let result = true\n\n if (attrs.length === 0 && !(getFullTextContext(hierarchy, c, contexts)?.forceIndex ?? false)) {\n result = false\n // We need check if document has collections with indexable fields.\n const attrs = hierarchy.getAllAttributes(c).values()\n for (const attr of attrs) {\n if (attr.type._class === core.class.Collection) {\n if (isClassIndexable(hierarchy, (attr.type as Collection<AttachedDoc>).of, contexts)) {\n result = true\n break\n }\n }\n }\n }\n hierarchy.setClassifierProp(c, 'class_indexed', result)\n return result\n}\n\ntype ReduceParameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never\n\ninterface NextCall {\n op: () => Promise<void>\n}\n\n/**\n * Utility method to skip middle update calls, optimistically if update function is called multiple times with few different parameters, only the last variant will be executed.\n * The last invocation is executed after a few cycles, allowing to skip middle ones.\n *\n * This method can be used inside Svelte components to collapse complex update logic and handle interactions.\n */\nexport function reduceCalls<T extends (...args: ReduceParameters<T>) => Promise<void>> (\n operation: T\n): (...args: ReduceParameters<T>) => Promise<void> {\n let nextCall: NextCall | undefined\n let currentCall: NextCall | undefined\n\n const next = (): void => {\n currentCall = nextCall\n nextCall = undefined\n if (currentCall !== undefined) {\n void currentCall.op().catch()\n }\n }\n return async function (...args: ReduceParameters<T>): Promise<void> {\n const myOp = async (): Promise<void> => {\n try {\n await operation(...args)\n } catch (err: any) {\n console.error('Error occurred in reduceCalls:', err)\n }\n next()\n }\n\n nextCall = { op: myOp }\n await Promise.resolve()\n if (currentCall === undefined) {\n next()\n }\n }\n}\n\nexport function isOwnerOrMaintainer (): boolean {\n const account = getCurrentAccount()\n return hasAccountRole(account, AccountRole.Maintainer)\n}\n\nexport function hasAccountRole (acc: Account, targerRole: AccountRole): boolean {\n return roleOrder[acc.role] >= roleOrder[targerRole]\n}\n\nexport function getBranding (brandings: BrandingMap, key: string | undefined): Branding | null {\n if (key === undefined) return null\n\n return Object.values(brandings).find((branding) => branding.key === key) ?? null\n}\n\nexport function fillConfiguration (systemTx: Tx[], configs: Map<Ref<PluginConfiguration>, PluginConfiguration>): void {\n for (const t of systemTx) {\n if (t._class === core.class.TxCreateDoc) {\n const ct = t as TxCreateDoc<Doc>\n if (ct.objectClass === core.class.PluginConfiguration) {\n configs.set(ct.objectId as Ref<PluginConfiguration>, TxProcessor.createDoc2Doc(ct) as PluginConfiguration)\n }\n } else if (t._class === core.class.TxUpdateDoc) {\n const ut = t as TxUpdateDoc<Doc>\n if (ut.objectClass === core.class.PluginConfiguration) {\n const c = configs.get(ut.objectId as Ref<PluginConfiguration>)\n if (c !== undefined) {\n if (c.system !== true || ut.modifiedBy === core.account.ConfigUser) {\n TxProcessor.updateDoc2Doc(c, ut)\n }\n }\n }\n }\n }\n}\n\nexport function pluginFilterTx (\n excludedPlugins: PluginConfiguration[],\n configs: Map<Ref<PluginConfiguration>, PluginConfiguration>,\n systemTx: Tx[]\n): Tx[] {\n const stx = toIdMap(systemTx)\n const totalExcluded = new Set<Ref<Tx>>()\n let msg = ''\n for (const a of excludedPlugins) {\n for (const c of configs.values()) {\n if (a.pluginId === c.pluginId) {\n for (const id of c.transactions) {\n if (c.classFilter !== undefined) {\n const filter = new Set(c.classFilter)\n const tx = stx.get(id as Ref<Tx>)\n if (\n tx?._class === core.class.TxCreateDoc ||\n tx?._class === core.class.TxUpdateDoc ||\n tx?._class === core.class.TxRemoveDoc\n ) {\n const cud = tx as TxCUD<Doc>\n if (filter.has(cud.objectClass)) {\n totalExcluded.add(id as Ref<Tx>)\n }\n }\n } else {\n totalExcluded.add(id as Ref<Tx>)\n }\n }\n msg += ` ${c.pluginId}:${c.transactions.length}`\n }\n }\n }\n if (typeof window !== 'undefined') {\n console.log('exclude plugin', msg)\n }\n systemTx = systemTx.filter((t) => !totalExcluded.has(t._id))\n return systemTx\n}\n\n/**\n * @public\n */\nexport class TimeRateLimiter {\n idCounter: number = 0\n active: number = 0\n last: number = 0\n rate: number\n period: number\n executions: { time: number, running: boolean }[] = []\n\n queue: (() => Promise<void>)[] = []\n notify: (() => void)[] = []\n\n constructor (rate: number, period: number = 1000) {\n this.rate = rate\n this.period = period\n }\n\n private cleanupExecutions (): void {\n const now = Date.now()\n this.executions = this.executions.filter((time) => time.running || now - time.time < this.period)\n }\n\n async exec<T, B extends Record<string, any> = any>(op: (args?: B) => Promise<T>, args?: B): Promise<T> {\n while (this.active >= this.rate || this.executions.length >= this.rate) {\n this.cleanupExecutions()\n if (this.executions.length < this.rate) {\n break\n }\n await new Promise<void>((resolve) => {\n setTimeout(resolve, this.period / this.rate)\n })\n }\n\n const v = { time: Date.now(), running: true }\n this.active++\n try {\n this.executions.push(v)\n const p = op(args)\n return await p\n } finally {\n v.running = false\n this.active--\n this.cleanupExecutions()\n const n = this.notify.shift()\n if (n !== undefined) {\n n()\n }\n }\n }\n\n async waitProcessing (): Promise<void> {\n while (this.active > 0) {\n await new Promise<void>((resolve) => {\n this.notify.push(resolve)\n })\n }\n }\n}\n\nexport function combineAttributes (\n attributes: any[],\n key: string,\n operator: '$push' | '$pull' | '$unset',\n arrayKey?: '$each' | '$in'\n): any[] {\n return Array.from(\n new Set(\n attributes.flatMap((attr) => {\n if (arrayKey === undefined) {\n return attr[operator]?.[key]\n }\n\n return Array.isArray(attr[operator]?.[key]?.[arrayKey])\n ? attr[operator]?.[key]?.[arrayKey]\n : attr[operator]?.[key]\n })\n )\n ).filter((v) => v != null)\n}\n\nexport function buildSocialIdString (key: SocialKey): string {\n return `${key.type}:${key.value}`\n}\n\nexport function parseSocialIdString (id: string): SocialKey {\n const [type, value] = id.split(':')\n\n if (type === undefined || value === undefined) {\n throw new Error(`Social id is not valid: ${id}`)\n }\n\n if (!Object.values(SocialIdType).includes(type as SocialIdType)) {\n throw new Error(`Social id type is not valid: ${id}`)\n }\n\n return { type: type as SocialIdType, value }\n}\n\nexport function pickPrimarySocialId (socialIds: SocialId[]): SocialId {\n const activeSocialIds = socialIds.filter((si) => si.isDeleted !== true)\n if (activeSocialIds.length === 0) {\n throw new Error('No active social ids provided')\n }\n const hulySocialIds = activeSocialIds.filter((si) => si.type === SocialIdType.HULY)\n\n return hulySocialIds[0] ?? activeSocialIds[0]\n}\n\nexport const loginSocialTypes = [SocialIdType.EMAIL, SocialIdType.GOOGLE, SocialIdType.GITHUB, SocialIdType.OIDC]\n\nexport function notEmpty<T> (id: T | undefined | null): id is T {\n return id !== undefined && id !== null && id !== ''\n}\n\nexport function unique<T> (arr: T[]): T[] {\n return Array.from(new Set(arr))\n}\n\nexport function uniqueNotEmpty<T extends NonNullable<unknown>> (arr: Array<T | undefined | null>): T[] {\n return unique(arr).filter(notEmpty)\n}\nexport { platformNow, platformNowDiff } from '@hcengineering/measurements'\n\nexport interface PermissionsGrant {\n spaces?: Ref<Space>[]\n grantedBy?: AccountUuid\n}\n\nexport type KeysByType<O extends object, T> = { [k in keyof O]-?: O[k] extends T ? k : never }[keyof O]\n\nexport function toRank (str: string | undefined): Rank | undefined {\n if (str === undefined) return\n if (str.startsWith('0|')) {\n return str\n }\n return '0|' + str.replaceAll(/[-:_]/g, '').toLowerCase()\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;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ACjD;AAEA,MAAI,CAAC,OAAO,OAAO,2BAAY,EAAE,SAAS,IAAoB,GAAG;AAC/D,UAAM,IAAI,MAAM,gCAAgC,EAAE,EAAE;AAAA,EACtD;AAEA,SAAO,EAAE,MAA4B,MAAM;AAC7C;AAZgB;AAcT,SAAS,oBAAqB,WAAiC;AACpE,QAAM,kBAAkB,UAAU,OAAO,CAAC,OAAO,GAAG,cAAc,IAAI;AACtE,MAAI,gBAAgB,WAAW,GAAG;AAChC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AACA,QAAM,gBAAgB,gBAAgB,OAAO,CAAC,OAAO,GAAG,SAAS,4BAAa,IAAI;AAElF,SAAO,cAAc,CAAC,KAAK,gBAAgB,CAAC;AAC9C;AARgB;AAUT,MAAM,mBAAmB,CAAC,4BAAa,OAAO,4BAAa,QAAQ,4BAAa,QAAQ,4BAAa,IAAI;AAEzG,SAAS,SAAa,IAAmC;AAC9D,SAAO,OAAO,UAAa,OAAO,QAAQ,OAAO;AACnD;AAFgB;AAIT,SAAS,OAAW,KAAe;AACxC,SAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC;AAChC;AAFgB;AAIT,SAAS,eAAgD,KAAuC;AACrG,SAAO,OAAO,GAAG,EAAE,OAAO,QAAQ;AACpC;AAFgB;AAYT,SAAS,OAAQ,KAA2C;AACjE,MAAI,QAAQ,OAAW;AACvB,MAAI,IAAI,WAAW,IAAI,GAAG;AACxB,WAAO;AAAA,EACT;AACA,SAAO,OAAO,IAAI,WAAW,UAAU,EAAE,EAAE,YAAY;AACzD;AANgB;",
|
|
6
6
|
"names": ["core", "ctx", "attrs"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var versioning_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(versioning_exports);
|
|
17
|
+
//# sourceMappingURL=versioning.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/versioning.ts"],
|
|
4
|
+
"sourcesContent": ["import { Class, Doc, PersonId, Ref } from './classes'\n\nexport interface VersionableDoc extends Doc {\n baseId?: Ref<Doc>\n version?: number\n isLatest?: boolean\n docCreatedBy?: PersonId\n readonly?: boolean\n}\n\nexport interface VersionableClass extends Class<Doc> {\n enabled: boolean\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hcengineering/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.423",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -17,8 +17,18 @@
|
|
|
17
17
|
],
|
|
18
18
|
"author": "Anticrm Platform Contributors",
|
|
19
19
|
"license": "EPL-2.0",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "compile",
|
|
22
|
+
"build:watch": "compile",
|
|
23
|
+
"test": "jest --passWithNoTests --silent --coverage",
|
|
24
|
+
"format": "format src",
|
|
25
|
+
"_phase:build": "compile transpile src",
|
|
26
|
+
"_phase:test": "jest --passWithNoTests --silent --coverage",
|
|
27
|
+
"_phase:format": "format src",
|
|
28
|
+
"_phase:validate": "compile validate"
|
|
29
|
+
},
|
|
20
30
|
"devDependencies": {
|
|
21
|
-
"@hcengineering/platform-rig": "^0.7.
|
|
31
|
+
"@hcengineering/platform-rig": "^0.7.423",
|
|
22
32
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
23
33
|
"eslint-plugin-import": "^2.26.0",
|
|
24
34
|
"eslint-plugin-promise": "^6.1.1",
|
|
@@ -26,21 +36,24 @@
|
|
|
26
36
|
"eslint": "^8.54.0",
|
|
27
37
|
"@typescript-eslint/parser": "^6.21.0",
|
|
28
38
|
"eslint-config-standard-with-typescript": "^40.0.0",
|
|
29
|
-
"prettier": "^3.
|
|
39
|
+
"prettier": "^3.6.2",
|
|
30
40
|
"typescript": "^5.9.3",
|
|
31
41
|
"jest": "^29.7.0",
|
|
32
42
|
"ts-jest": "^29.1.1",
|
|
33
43
|
"@types/jest": "^29.5.5",
|
|
34
|
-
"@types/node": "^22.
|
|
44
|
+
"@types/node": "^22.18.1",
|
|
35
45
|
"eslint-plugin-svelte": "^2.35.1"
|
|
36
46
|
},
|
|
37
47
|
"dependencies": {
|
|
38
|
-
"@hcengineering/platform": "^0.7.
|
|
39
|
-
"@hcengineering/analytics": "^0.7.
|
|
40
|
-
"@hcengineering/measurements": "^0.7.
|
|
48
|
+
"@hcengineering/platform": "^0.7.423",
|
|
49
|
+
"@hcengineering/analytics": "^0.7.423",
|
|
50
|
+
"@hcengineering/measurements": "^0.7.423",
|
|
41
51
|
"fast-equals": "^5.2.2"
|
|
42
52
|
},
|
|
43
|
-
"repository":
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/hcengineering/huly.core.git"
|
|
56
|
+
},
|
|
44
57
|
"publishConfig": {
|
|
45
58
|
"access": "public"
|
|
46
59
|
},
|
|
@@ -58,15 +71,5 @@
|
|
|
58
71
|
"require": "./lang",
|
|
59
72
|
"import": "./lang"
|
|
60
73
|
}
|
|
61
|
-
},
|
|
62
|
-
"scripts": {
|
|
63
|
-
"build": "compile",
|
|
64
|
-
"build:watch": "compile",
|
|
65
|
-
"test": "jest --passWithNoTests --silent --coverage",
|
|
66
|
-
"format": "format src",
|
|
67
|
-
"_phase:build": "compile transpile src",
|
|
68
|
-
"_phase:test": "jest --passWithNoTests --silent --coverage",
|
|
69
|
-
"_phase:format": "format src",
|
|
70
|
-
"_phase:validate": "compile validate"
|
|
71
74
|
}
|
|
72
|
-
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright © 2026 Hardcore Engineering Inc.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License. You may
|
|
6
|
+
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
//
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
|
|
16
|
+
import { AccountRole } from '../classes'
|
|
17
|
+
import { setWorkspaceGuestAutoJoinRoles } from '../autoJoinRoles'
|
|
18
|
+
|
|
19
|
+
describe('autoJoinRoles', () => {
|
|
20
|
+
test('setWorkspaceGuestAutoJoinRoles toggles Guest only', () => {
|
|
21
|
+
expect(setWorkspaceGuestAutoJoinRoles(undefined, false)).toEqual([])
|
|
22
|
+
expect(setWorkspaceGuestAutoJoinRoles([AccountRole.User], true).sort()).toEqual(
|
|
23
|
+
[AccountRole.User, AccountRole.Guest].sort()
|
|
24
|
+
)
|
|
25
|
+
expect(setWorkspaceGuestAutoJoinRoles([AccountRole.Guest, AccountRole.User], false)).toEqual([AccountRole.User])
|
|
26
|
+
})
|
|
27
|
+
})
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
//
|
|
15
15
|
|
|
16
16
|
import { type Client, type DomainParams, type DomainRequestOptions, type DomainResult } from '..'
|
|
17
|
-
import type { Class, Doc, Obj, OperationDomain, Ref } from '../classes'
|
|
17
|
+
import type { Class, Doc, Obj, OperationDomain, Ref, Space } from '../classes'
|
|
18
18
|
import core from '../component'
|
|
19
19
|
import { Hierarchy } from '../hierarchy'
|
|
20
20
|
import { ModelDb, TxDb } from '../memdb'
|
|
@@ -293,6 +293,155 @@ describe('memdb', () => {
|
|
|
293
293
|
expect(result2).toHaveLength(1)
|
|
294
294
|
})
|
|
295
295
|
|
|
296
|
+
it('check associations', async () => {
|
|
297
|
+
const { model } = await createModel()
|
|
298
|
+
const operations = new TxOperations(model, core.account.System)
|
|
299
|
+
const association = await operations.findOne(core.class.Association, {})
|
|
300
|
+
if (association == null) {
|
|
301
|
+
throw new Error('Association not found')
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const spaces = await operations.findAll(core.class.Space, {})
|
|
305
|
+
expect(spaces).toHaveLength(2)
|
|
306
|
+
|
|
307
|
+
const first = await operations.addCollection(
|
|
308
|
+
test.class.TestComment,
|
|
309
|
+
core.space.Model,
|
|
310
|
+
spaces[0]._id,
|
|
311
|
+
spaces[0]._class,
|
|
312
|
+
'comments',
|
|
313
|
+
{
|
|
314
|
+
message: 'msg'
|
|
315
|
+
}
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
const second = await operations.addCollection(
|
|
319
|
+
test.class.TestComment,
|
|
320
|
+
core.space.Model,
|
|
321
|
+
first,
|
|
322
|
+
test.class.TestComment,
|
|
323
|
+
'comments',
|
|
324
|
+
{
|
|
325
|
+
message: 'msg2'
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
await operations.createDoc(core.class.Relation, '' as Ref<Space>, {
|
|
330
|
+
docA: first,
|
|
331
|
+
docB: second,
|
|
332
|
+
association: association._id
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
const r = await operations.findAll(
|
|
336
|
+
test.class.TestComment,
|
|
337
|
+
{ _id: first },
|
|
338
|
+
{
|
|
339
|
+
associations: [[association._id, 1]]
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
expect(r.length).toEqual(1)
|
|
343
|
+
expect((r[0].$associations?.[association._id + '_b'][0] as any)?._id).toEqual(second)
|
|
344
|
+
})
|
|
345
|
+
|
|
346
|
+
it('check deep associations', async () => {
|
|
347
|
+
const { model } = await createModel()
|
|
348
|
+
const operations = new TxOperations(model, core.account.System)
|
|
349
|
+
const association = await operations.findOne(core.class.Association, {})
|
|
350
|
+
if (association == null) {
|
|
351
|
+
throw new Error('Association not found')
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const spaces = await operations.findAll(core.class.Space, {})
|
|
355
|
+
expect(spaces).toHaveLength(2)
|
|
356
|
+
|
|
357
|
+
const zero = await operations.addCollection(
|
|
358
|
+
test.class.TestComment,
|
|
359
|
+
core.space.Model,
|
|
360
|
+
spaces[0]._id,
|
|
361
|
+
spaces[0]._class,
|
|
362
|
+
'comments',
|
|
363
|
+
{
|
|
364
|
+
message: 'msg'
|
|
365
|
+
}
|
|
366
|
+
)
|
|
367
|
+
|
|
368
|
+
const first = await operations.addCollection(
|
|
369
|
+
test.class.TestComment,
|
|
370
|
+
core.space.Model,
|
|
371
|
+
spaces[0]._id,
|
|
372
|
+
spaces[0]._class,
|
|
373
|
+
'comments',
|
|
374
|
+
{
|
|
375
|
+
message: 'msg'
|
|
376
|
+
}
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
const second = await operations.addCollection(
|
|
380
|
+
test.class.TestComment,
|
|
381
|
+
core.space.Model,
|
|
382
|
+
first,
|
|
383
|
+
test.class.TestComment,
|
|
384
|
+
'comments',
|
|
385
|
+
{
|
|
386
|
+
message: 'msg2'
|
|
387
|
+
}
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
const second2 = await operations.addCollection(
|
|
391
|
+
test.class.TestComment,
|
|
392
|
+
core.space.Model,
|
|
393
|
+
first,
|
|
394
|
+
test.class.TestComment,
|
|
395
|
+
'comments',
|
|
396
|
+
{
|
|
397
|
+
message: 'msg2'
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
|
|
401
|
+
const third = await operations.addCollection(
|
|
402
|
+
test.class.TestComment,
|
|
403
|
+
core.space.Model,
|
|
404
|
+
spaces[0]._id,
|
|
405
|
+
spaces[0]._class,
|
|
406
|
+
'comments',
|
|
407
|
+
{
|
|
408
|
+
message: 'msg3'
|
|
409
|
+
}
|
|
410
|
+
)
|
|
411
|
+
await operations.createDoc(core.class.Relation, '' as Ref<Space>, {
|
|
412
|
+
docA: first,
|
|
413
|
+
docB: second,
|
|
414
|
+
association: association._id
|
|
415
|
+
})
|
|
416
|
+
|
|
417
|
+
await operations.createDoc(core.class.Relation, '' as Ref<Space>, {
|
|
418
|
+
docA: first,
|
|
419
|
+
docB: second2,
|
|
420
|
+
association: association._id
|
|
421
|
+
})
|
|
422
|
+
|
|
423
|
+
await operations.createDoc(core.class.Relation, '' as Ref<Space>, {
|
|
424
|
+
docA: second,
|
|
425
|
+
docB: third,
|
|
426
|
+
association: association._id
|
|
427
|
+
})
|
|
428
|
+
|
|
429
|
+
const r = await operations.findAll(
|
|
430
|
+
test.class.TestComment,
|
|
431
|
+
{ _id: { $in: [zero, first] } },
|
|
432
|
+
{
|
|
433
|
+
associations: [[association._id, 1, [[association._id, 1]]]]
|
|
434
|
+
}
|
|
435
|
+
)
|
|
436
|
+
expect(r.length).toEqual(2)
|
|
437
|
+
expect(r[1].$associations?.[`${association._id}_b`]).toHaveLength(2)
|
|
438
|
+
expect((r[1].$associations?.[`${association._id}_b`][0] as any)?._id).toEqual(second)
|
|
439
|
+
expect(r[1].$associations?.[`${association._id}_b`][1]?.$associations?.[`${association._id}_b`]).toHaveLength(0)
|
|
440
|
+
expect(
|
|
441
|
+
(r[1].$associations?.[`${association._id}_b`][0]?.$associations?.[`${association._id}_b`][0] as any)?._id
|
|
442
|
+
).toEqual(third)
|
|
443
|
+
})
|
|
444
|
+
|
|
296
445
|
it('lookups', async () => {
|
|
297
446
|
const { model } = await createModel()
|
|
298
447
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import type { IntlString, Plugin } from '@hcengineering/platform'
|
|
17
17
|
import { plugin } from '@hcengineering/platform'
|
|
18
18
|
import type { Arr, AttachedDoc, Class, Data, Doc, Interface, Mixin, Obj, Ref, Space } from '../classes'
|
|
19
|
-
import { ClassifierKind, DOMAIN_MODEL } from '../classes'
|
|
19
|
+
import { ClassifierKind, DOMAIN_MODEL, DOMAIN_RELATION } from '../classes'
|
|
20
20
|
import core from '../component'
|
|
21
21
|
import type { DocumentUpdate, TxCUD, TxCreateDoc, TxRemoveDoc, TxUpdateDoc } from '../tx'
|
|
22
22
|
import { DOMAIN_TX, TxFactory } from '../tx'
|
|
@@ -252,6 +252,34 @@ export function genMinModel (): TxCUD<Doc>[] {
|
|
|
252
252
|
})
|
|
253
253
|
)
|
|
254
254
|
|
|
255
|
+
txes.push(
|
|
256
|
+
createClass(core.class.Relation, {
|
|
257
|
+
label: 'Relation' as IntlString,
|
|
258
|
+
extends: core.class.Doc,
|
|
259
|
+
kind: ClassifierKind.CLASS,
|
|
260
|
+
domain: DOMAIN_RELATION
|
|
261
|
+
})
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
txes.push(
|
|
265
|
+
createClass(core.class.Association, {
|
|
266
|
+
label: 'Association' as IntlString,
|
|
267
|
+
extends: core.class.Doc,
|
|
268
|
+
kind: ClassifierKind.CLASS,
|
|
269
|
+
domain: DOMAIN_MODEL
|
|
270
|
+
})
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
txes.push(
|
|
274
|
+
createDoc(core.class.Association, {
|
|
275
|
+
nameA: 'my-assoc',
|
|
276
|
+
nameB: 'my-assoc',
|
|
277
|
+
classA: test.class.TestComment,
|
|
278
|
+
classB: test.class.TestComment,
|
|
279
|
+
type: '1:1'
|
|
280
|
+
})
|
|
281
|
+
)
|
|
282
|
+
|
|
255
283
|
txes.push(
|
|
256
284
|
createDoc(core.class.Space, {
|
|
257
285
|
name: 'Sp1',
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright © 2026 Hardcore Engineering Inc.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License. You may
|
|
6
|
+
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
//
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
|
|
16
|
+
import { findProperty } from '../query'
|
|
17
|
+
import type { Doc, Ref, Class } from '../classes'
|
|
18
|
+
|
|
19
|
+
function doc (id: string, fields: Record<string, any> = {}): Doc {
|
|
20
|
+
const doc: Doc = { _id: id as Ref<Doc>, _class: 'test:class:Issue' as Ref<Class<Doc>>, ...fields } as any
|
|
21
|
+
return doc
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
describe('findProperty', () => {
|
|
25
|
+
const assigned1 = doc('i1', { assignee: 'person:1' })
|
|
26
|
+
const assigned2 = doc('i2', { assignee: 'person:2' })
|
|
27
|
+
const unassigned = doc('i3', { assignee: null })
|
|
28
|
+
const missingField = doc('i4')
|
|
29
|
+
const allDocs = [assigned1, assigned2, unassigned, missingField]
|
|
30
|
+
|
|
31
|
+
it('should match a specific value', () => {
|
|
32
|
+
const result = findProperty(allDocs, 'assignee', 'person:1')
|
|
33
|
+
expect(result).toEqual([assigned1])
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('should match null to docs with null or missing field', () => {
|
|
37
|
+
const result = findProperty(allDocs, 'assignee', null)
|
|
38
|
+
expect(result).toEqual([unassigned, missingField])
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('should match undefined to docs with null or missing field', () => {
|
|
42
|
+
const result = findProperty(allDocs, 'assignee', undefined)
|
|
43
|
+
expect(result).toEqual([unassigned, missingField])
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
describe('JSON round-trip (simulates server query)', () => {
|
|
47
|
+
it('null survives JSON serialization and filters correctly', () => {
|
|
48
|
+
const query = { assignee: null }
|
|
49
|
+
const roundTripped = JSON.parse(JSON.stringify(query))
|
|
50
|
+
expect(roundTripped).toHaveProperty('assignee')
|
|
51
|
+
|
|
52
|
+
const result = findProperty(allDocs, 'assignee', roundTripped.assignee)
|
|
53
|
+
expect(result).toEqual([unassigned, missingField])
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('undefined is stripped by JSON serialization, losing the filter', () => {
|
|
57
|
+
const query = { assignee: undefined }
|
|
58
|
+
const roundTripped = JSON.parse(JSON.stringify(query))
|
|
59
|
+
expect(roundTripped).not.toHaveProperty('assignee')
|
|
60
|
+
|
|
61
|
+
// Without the 'assignee' key, matchQuery iterates only the remaining keys
|
|
62
|
+
// and never calls findProperty for assignee, so all docs pass through.
|
|
63
|
+
// This is the root cause of #10606.
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
})
|