@cardstack/boxel-cli 0.2.0-unstable.448 → 0.3.0-unstable.13
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/bundled-types/base/-private.d.ts +1 -0
- package/bundled-types/base/address.d.ts +17 -0
- package/bundled-types/base/ai-app-generator.d.ts +14 -0
- package/bundled-types/base/amount-with-currency.d.ts +10 -0
- package/bundled-types/base/avif-image-def.d.ts +12 -0
- package/bundled-types/base/avif-meta-extractor.d.ts +4 -0
- package/bundled-types/base/base64-image.d.ts +25 -0
- package/bundled-types/base/big-integer.d.ts +12 -0
- package/bundled-types/base/boolean.d.ts +14 -0
- package/bundled-types/base/brand-functional-palette.d.ts +16 -0
- package/bundled-types/base/brand-guide.d.ts +26 -0
- package/bundled-types/base/brand-logo.d.ts +29 -0
- package/bundled-types/base/card-api.d.ts +513 -0
- package/bundled-types/base/card-serialization.d.ts +47 -0
- package/bundled-types/base/cards-grid.d.ts +10 -0
- package/bundled-types/base/code-ref.d.ts +14 -0
- package/bundled-types/base/codemirror-editor.d.ts +135 -0
- package/bundled-types/base/color-field/components/advanced-color-picker.d.ts +66 -0
- package/bundled-types/base/color-field/components/color-picker-field.d.ts +22 -0
- package/bundled-types/base/color-field/components/color-wheel-picker.d.ts +44 -0
- package/bundled-types/base/color-field/components/contrast-checker-addon.d.ts +14 -0
- package/bundled-types/base/color-field/components/recent-colors-addon.d.ts +19 -0
- package/bundled-types/base/color-field/components/slider-picker.d.ts +40 -0
- package/bundled-types/base/color-field/components/swatches-picker.d.ts +5 -0
- package/bundled-types/base/color-field/modifiers/setup-element-modifier.d.ts +10 -0
- package/bundled-types/base/color-field/util/color-field-signature.d.ts +9 -0
- package/bundled-types/base/color-field/util/color-utils.d.ts +96 -0
- package/bundled-types/base/color-field/util/css-color-parsers.d.ts +11 -0
- package/bundled-types/base/color.d.ts +10 -0
- package/bundled-types/base/command.d.ts +593 -0
- package/bundled-types/base/commands/search-card-result.d.ts +36 -0
- package/bundled-types/base/components/age.d.ts +22 -0
- package/bundled-types/base/components/business-days.d.ts +16 -0
- package/bundled-types/base/components/card-list.d.ts +25 -0
- package/bundled-types/base/components/cards-grid-layout.d.ts +58 -0
- package/bundled-types/base/components/countdown.d.ts +31 -0
- package/bundled-types/base/components/expiration-warning.d.ts +24 -0
- package/bundled-types/base/components/time-ago.d.ts +24 -0
- package/bundled-types/base/components/time-slots.d.ts +20 -0
- package/bundled-types/base/components/timeline.d.ts +22 -0
- package/bundled-types/base/contains-many-component.d.ts +7 -0
- package/bundled-types/base/coordinate.d.ts +7 -0
- package/bundled-types/base/country.d.ts +23 -0
- package/bundled-types/base/css-value.d.ts +6 -0
- package/bundled-types/base/csv-file-def.d.ts +29 -0
- package/bundled-types/base/currency.d.ts +16 -0
- package/bundled-types/base/date/day.d.ts +9 -0
- package/bundled-types/base/date/month-day.d.ts +10 -0
- package/bundled-types/base/date/month-year.d.ts +9 -0
- package/bundled-types/base/date/month.d.ts +9 -0
- package/bundled-types/base/date/quarter.d.ts +10 -0
- package/bundled-types/base/date/week.d.ts +9 -0
- package/bundled-types/base/date/year.d.ts +9 -0
- package/bundled-types/base/date-range-field.d.ts +12 -0
- package/bundled-types/base/date.d.ts +12 -0
- package/bundled-types/base/datetime-stamp.d.ts +7 -0
- package/bundled-types/base/datetime.d.ts +12 -0
- package/bundled-types/base/default-templates/atom.d.ts +10 -0
- package/bundled-types/base/default-templates/card-info.d.ts +32 -0
- package/bundled-types/base/default-templates/embedded.d.ts +11 -0
- package/bundled-types/base/default-templates/field-edit.d.ts +10 -0
- package/bundled-types/base/default-templates/file-def-edit.d.ts +8 -0
- package/bundled-types/base/default-templates/fitted.d.ts +12 -0
- package/bundled-types/base/default-templates/head.d.ts +13 -0
- package/bundled-types/base/default-templates/image-def-atom.d.ts +8 -0
- package/bundled-types/base/default-templates/image-def-embedded.d.ts +8 -0
- package/bundled-types/base/default-templates/image-def-fitted.d.ts +8 -0
- package/bundled-types/base/default-templates/image-def-isolated.d.ts +8 -0
- package/bundled-types/base/default-templates/isolated-and-edit.d.ts +15 -0
- package/bundled-types/base/default-templates/markdown-fallback.d.ts +19 -0
- package/bundled-types/base/default-templates/markdown.d.ts +60 -0
- package/bundled-types/base/default-templates/missing-template.d.ts +13 -0
- package/bundled-types/base/default-templates/theme-dashboard.d.ts +126 -0
- package/bundled-types/base/detailed-style-reference.d.ts +48 -0
- package/bundled-types/base/email.d.ts +10 -0
- package/bundled-types/base/enum.d.ts +30 -0
- package/bundled-types/base/ethereum-address.d.ts +13 -0
- package/bundled-types/base/field-component.d.ts +65 -0
- package/bundled-types/base/field-support.d.ts +55 -0
- package/bundled-types/base/file-api.d.ts +2 -0
- package/bundled-types/base/file-menu-items.d.ts +4 -0
- package/bundled-types/base/gif-image-def.d.ts +12 -0
- package/bundled-types/base/gif-meta-extractor.d.ts +4 -0
- package/bundled-types/base/gts-file-def.d.ts +7 -0
- package/bundled-types/base/helpers/country.d.ts +3198 -0
- package/bundled-types/base/helpers/sanitized-html.d.ts +2 -0
- package/bundled-types/base/helpers/set-background-image.d.ts +2 -0
- package/bundled-types/base/image-file-def.d.ts +1 -0
- package/bundled-types/base/image.d.ts +8 -0
- package/bundled-types/base/index.d.ts +1 -0
- package/bundled-types/base/join-the-community.d.ts +14 -0
- package/bundled-types/base/jpg-image-def.d.ts +12 -0
- package/bundled-types/base/jpg-meta-extractor.d.ts +4 -0
- package/bundled-types/base/json-file-def.d.ts +23 -0
- package/bundled-types/base/links-to-editor.d.ts +22 -0
- package/bundled-types/base/links-to-many-component.d.ts +7 -0
- package/bundled-types/base/llm-model.d.ts +6 -0
- package/bundled-types/base/markdown-file-def.d.ts +25 -0
- package/bundled-types/base/markdown-helpers.d.ts +26 -0
- package/bundled-types/base/markdown.d.ts +1 -0
- package/bundled-types/base/matrix-event.d.ts +400 -0
- package/bundled-types/base/menu-items.d.ts +21 -0
- package/bundled-types/base/number/components/badge-counter.d.ts +32 -0
- package/bundled-types/base/number/components/badge-metric.d.ts +34 -0
- package/bundled-types/base/number/components/badge-notification.d.ts +38 -0
- package/bundled-types/base/number/components/gauge.d.ts +45 -0
- package/bundled-types/base/number/components/number-input.d.ts +27 -0
- package/bundled-types/base/number/components/progress-bar.d.ts +44 -0
- package/bundled-types/base/number/components/progress-circle.d.ts +41 -0
- package/bundled-types/base/number/components/score.d.ts +41 -0
- package/bundled-types/base/number/components/stat.d.ts +38 -0
- package/bundled-types/base/number/util/index.d.ts +29 -0
- package/bundled-types/base/number.d.ts +52 -0
- package/bundled-types/base/percentage.d.ts +9 -0
- package/bundled-types/base/phone-number.d.ts +25 -0
- package/bundled-types/base/png-image-def.d.ts +12 -0
- package/bundled-types/base/png-meta-extractor.d.ts +4 -0
- package/bundled-types/base/positioned-card.d.ts +7 -0
- package/bundled-types/base/query-field-support.d.ts +6 -0
- package/bundled-types/base/realm-config.d.ts +16 -0
- package/bundled-types/base/realm.d.ts +7 -0
- package/bundled-types/base/resources/command-data.d.ts +43 -0
- package/bundled-types/base/response-field.d.ts +6 -0
- package/bundled-types/base/rich-markdown.d.ts +30 -0
- package/bundled-types/base/shared-state.d.ts +1 -0
- package/bundled-types/base/skill-plus.d.ts +79 -0
- package/bundled-types/base/skill-reference.d.ts +12 -0
- package/bundled-types/base/skill-set.d.ts +18 -0
- package/bundled-types/base/skill.d.ts +21 -0
- package/bundled-types/base/spec.d.ts +108 -0
- package/bundled-types/base/string.d.ts +2 -0
- package/bundled-types/base/structured-theme-variables.d.ts +85 -0
- package/bundled-types/base/structured-theme.d.ts +32 -0
- package/bundled-types/base/style-reference.d.ts +14 -0
- package/bundled-types/base/svg-image-def.d.ts +12 -0
- package/bundled-types/base/svg-meta-extractor.d.ts +12 -0
- package/bundled-types/base/system-card.d.ts +17 -0
- package/bundled-types/base/tag.d.ts +15 -0
- package/bundled-types/base/text-area.d.ts +2 -0
- package/bundled-types/base/text-file-def.d.ts +23 -0
- package/bundled-types/base/text-input-validator.d.ts +13 -0
- package/bundled-types/base/theme.d.ts +2 -0
- package/bundled-types/base/time/duration.d.ts +14 -0
- package/bundled-types/base/time/relative-time.d.ts +10 -0
- package/bundled-types/base/time/time-range.d.ts +11 -0
- package/bundled-types/base/time.d.ts +9 -0
- package/bundled-types/base/ts-file-def.d.ts +26 -0
- package/bundled-types/base/ts-highlight.d.ts +1 -0
- package/bundled-types/base/types/@cardstack/boxel-host/index.d.ts +5 -0
- package/bundled-types/base/types/ember-css-url/index.d.ts +15 -0
- package/bundled-types/base/typography.d.ts +14 -0
- package/bundled-types/base/url.d.ts +13 -0
- package/bundled-types/base/watched-array.d.ts +7 -0
- package/bundled-types/base/webp-image-def.d.ts +12 -0
- package/bundled-types/base/webp-meta-extractor.d.ts +4 -0
- package/bundled-types/base/website.d.ts +8 -0
- package/bundled-types/base/welcome-to-boxel.d.ts +22 -0
- package/bundled-types/boxel-ui/components/accordion/index.gts +50 -0
- package/bundled-types/boxel-ui/components/accordion/item/index.gts +156 -0
- package/bundled-types/boxel-ui/components/accordion/usage.gts +157 -0
- package/bundled-types/boxel-ui/components/add-button/index.gts +46 -0
- package/bundled-types/boxel-ui/components/add-button/usage.gts +54 -0
- package/bundled-types/boxel-ui/components/alert/index.gts +151 -0
- package/bundled-types/boxel-ui/components/alert/usage.gts +66 -0
- package/bundled-types/boxel-ui/components/avatar/index.gts +79 -0
- package/bundled-types/boxel-ui/components/avatar/usage.gts +96 -0
- package/bundled-types/boxel-ui/components/basic-fitted/index.gts +340 -0
- package/bundled-types/boxel-ui/components/basic-fitted/usage.gts +223 -0
- package/bundled-types/boxel-ui/components/button/index.gts +416 -0
- package/bundled-types/boxel-ui/components/button/usage.gts +334 -0
- package/bundled-types/boxel-ui/components/card-container/index.gts +251 -0
- package/bundled-types/boxel-ui/components/card-container/usage.gts +53 -0
- package/bundled-types/boxel-ui/components/card-header/index.gts +473 -0
- package/bundled-types/boxel-ui/components/card-header/usage.gts +295 -0
- package/bundled-types/boxel-ui/components/circle-spinner/index.gts +42 -0
- package/bundled-types/boxel-ui/components/circle-spinner/usage.gts +48 -0
- package/bundled-types/boxel-ui/components/color-palette/index.gts +134 -0
- package/bundled-types/boxel-ui/components/color-palette/usage.gts +69 -0
- package/bundled-types/boxel-ui/components/color-picker/index.gts +125 -0
- package/bundled-types/boxel-ui/components/color-picker/usage.gts +56 -0
- package/bundled-types/boxel-ui/components/container/index.gts +67 -0
- package/bundled-types/boxel-ui/components/container/usage.gts +59 -0
- package/bundled-types/boxel-ui/components/context-button/index.gts +184 -0
- package/bundled-types/boxel-ui/components/context-button/usage.gts +125 -0
- package/bundled-types/boxel-ui/components/copy-button/index.gts +79 -0
- package/bundled-types/boxel-ui/components/copy-button/usage.gts +25 -0
- package/bundled-types/boxel-ui/components/date-range-picker/index.gts +211 -0
- package/bundled-types/boxel-ui/components/date-range-picker/setup.gts +11 -0
- package/bundled-types/boxel-ui/components/date-range-picker/usage.gts +52 -0
- package/bundled-types/boxel-ui/components/drag-and-drop/index.gts +256 -0
- package/bundled-types/boxel-ui/components/drag-and-drop/usage.gts +142 -0
- package/bundled-types/boxel-ui/components/dropdown/index.gts +478 -0
- package/bundled-types/boxel-ui/components/dropdown/trigger/index.gts +70 -0
- package/bundled-types/boxel-ui/components/dropdown/trigger/usage.gts +54 -0
- package/bundled-types/boxel-ui/components/dropdown/usage.gts +119 -0
- package/bundled-types/boxel-ui/components/email-input/index.gts +111 -0
- package/bundled-types/boxel-ui/components/email-input/usage.gts +75 -0
- package/bundled-types/boxel-ui/components/entity-icon-display/index.gts +144 -0
- package/bundled-types/boxel-ui/components/entity-icon-display/usage.gts +54 -0
- package/bundled-types/boxel-ui/components/entity-thumbnail-display/index.gts +148 -0
- package/bundled-types/boxel-ui/components/entity-thumbnail-display/usage.gts +76 -0
- package/bundled-types/boxel-ui/components/field-container/index.gts +150 -0
- package/bundled-types/boxel-ui/components/field-container/usage.gts +188 -0
- package/bundled-types/boxel-ui/components/filter-list/index.gts +255 -0
- package/bundled-types/boxel-ui/components/filter-list/usage.gts +153 -0
- package/bundled-types/boxel-ui/components/fitted-card-container/index.gts +66 -0
- package/bundled-types/boxel-ui/components/fitted-card-container/usage.gts +81 -0
- package/bundled-types/boxel-ui/components/grid-container/grid-item-container/index.gts +37 -0
- package/bundled-types/boxel-ui/components/grid-container/index.gts +116 -0
- package/bundled-types/boxel-ui/components/grid-container/usage.gts +105 -0
- package/bundled-types/boxel-ui/components/header/index.gts +101 -0
- package/bundled-types/boxel-ui/components/header/usage.gts +116 -0
- package/bundled-types/boxel-ui/components/icon-button/index.gts +148 -0
- package/bundled-types/boxel-ui/components/icon-button/usage.gts +249 -0
- package/bundled-types/boxel-ui/components/input/index.gts +560 -0
- package/bundled-types/boxel-ui/components/input/usage.gts +449 -0
- package/bundled-types/boxel-ui/components/input-group/accessories/index.gts +191 -0
- package/bundled-types/boxel-ui/components/input-group/controls/index.gts +54 -0
- package/bundled-types/boxel-ui/components/input-group/index.gts +347 -0
- package/bundled-types/boxel-ui/components/input-group/usage.gts +437 -0
- package/bundled-types/boxel-ui/components/kanban/card.gts +89 -0
- package/bundled-types/boxel-ui/components/kanban/column-header.gts +151 -0
- package/bundled-types/boxel-ui/components/kanban/drag.gts +1007 -0
- package/bundled-types/boxel-ui/components/kanban/engine.ts +247 -0
- package/bundled-types/boxel-ui/components/kanban/ghost.gts +64 -0
- package/bundled-types/boxel-ui/components/kanban/index.gts +16 -0
- package/bundled-types/boxel-ui/components/kanban/modifiers.gts +42 -0
- package/bundled-types/boxel-ui/components/kanban/plane-inner.gts +525 -0
- package/bundled-types/boxel-ui/components/kanban/plane.gts +163 -0
- package/bundled-types/boxel-ui/components/kanban/usage.gts +392 -0
- package/bundled-types/boxel-ui/components/label/index.gts +64 -0
- package/bundled-types/boxel-ui/components/loading-indicator/index.gts +78 -0
- package/bundled-types/boxel-ui/components/loading-indicator/usage.gts +72 -0
- package/bundled-types/boxel-ui/components/menu/index.gts +267 -0
- package/bundled-types/boxel-ui/components/menu/usage.gts +100 -0
- package/bundled-types/boxel-ui/components/message/index.gts +146 -0
- package/bundled-types/boxel-ui/components/message/usage.gts +263 -0
- package/bundled-types/boxel-ui/components/modal/index.gts +159 -0
- package/bundled-types/boxel-ui/components/modal/usage.gts +206 -0
- package/bundled-types/boxel-ui/components/multi-select/after-options.gts +59 -0
- package/bundled-types/boxel-ui/components/multi-select/index.gts +230 -0
- package/bundled-types/boxel-ui/components/multi-select/selected-item.gts +91 -0
- package/bundled-types/boxel-ui/components/multi-select/trigger.gts +190 -0
- package/bundled-types/boxel-ui/components/multi-select/usage.gts +420 -0
- package/bundled-types/boxel-ui/components/phone-input/index.gts +149 -0
- package/bundled-types/boxel-ui/components/phone-input/usage.gts +73 -0
- package/bundled-types/boxel-ui/components/picker/before-options-with-search.gts +340 -0
- package/bundled-types/boxel-ui/components/picker/index.gts +427 -0
- package/bundled-types/boxel-ui/components/picker/option-row.gts +270 -0
- package/bundled-types/boxel-ui/components/picker/selected-item.gts +171 -0
- package/bundled-types/boxel-ui/components/picker/trigger-labeled.gts +216 -0
- package/bundled-types/boxel-ui/components/picker/usage.gts +179 -0
- package/bundled-types/boxel-ui/components/pill/index.gts +231 -0
- package/bundled-types/boxel-ui/components/pill/usage.gts +230 -0
- package/bundled-types/boxel-ui/components/progress-bar/index.gts +124 -0
- package/bundled-types/boxel-ui/components/progress-bar/usage.gts +131 -0
- package/bundled-types/boxel-ui/components/progress-radial/index.gts +95 -0
- package/bundled-types/boxel-ui/components/progress-radial/usage.gts +79 -0
- package/bundled-types/boxel-ui/components/radio-input/index.gts +143 -0
- package/bundled-types/boxel-ui/components/radio-input/item.gts +210 -0
- package/bundled-types/boxel-ui/components/radio-input/usage.gts +303 -0
- package/bundled-types/boxel-ui/components/realm-icon/index.gts +129 -0
- package/bundled-types/boxel-ui/components/realm-icon/usage.gts +62 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/handle.gts +180 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/index.gts +341 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/panel.gts +86 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/usage.gts +350 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/adjust-layout-by-delta.ts +231 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/assert.ts +10 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/calculate-delta-percentage.ts +41 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/calculate-unsafe-default-layout.ts +53 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/compare-layouts.ts +12 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/const.ts +6 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/determine-pivot-indices.ts +15 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/dom/get-panel-element.ts +10 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/dom/get-panel-elements-for-group.ts +8 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/dom/get-panel-group-element.ts +21 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/dom/get-resize-handle-element-index.ts +14 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/dom/get-resize-handle-element.ts +12 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/dom/get-resize-handle-elements-for-group.ts +10 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/fuzzy-layouts-equal.ts +22 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/fuzzy-numbers.ts +21 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/get-resize-event-coordinates.ts +8 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/get-resize-event-cursor-position.ts +10 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/panel-resize-handle-registry.ts +446 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/resize-panel.ts +35 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/types.ts +23 -0
- package/bundled-types/boxel-ui/components/resizable-panel-group/utils/validate-panel-group-layout.ts +86 -0
- package/bundled-types/boxel-ui/components/select/index.gts +882 -0
- package/bundled-types/boxel-ui/components/select/trigger.gts +132 -0
- package/bundled-types/boxel-ui/components/select/usage.gts +353 -0
- package/bundled-types/boxel-ui/components/skeleton-placeholder/index.gts +89 -0
- package/bundled-types/boxel-ui/components/skeleton-placeholder/usage.gts +102 -0
- package/bundled-types/boxel-ui/components/sort-dropdown/index.gts +91 -0
- package/bundled-types/boxel-ui/components/sort-dropdown/usage.gts +77 -0
- package/bundled-types/boxel-ui/components/swatch/index.gts +81 -0
- package/bundled-types/boxel-ui/components/swatch/usage.gts +57 -0
- package/bundled-types/boxel-ui/components/switch/index.gts +95 -0
- package/bundled-types/boxel-ui/components/switch/usage.gts +79 -0
- package/bundled-types/boxel-ui/components/tabbed-header/index.gts +141 -0
- package/bundled-types/boxel-ui/components/tabbed-header/usage.gts +103 -0
- package/bundled-types/boxel-ui/components/tag/index.gts +50 -0
- package/bundled-types/boxel-ui/components/tag/usage.gts +89 -0
- package/bundled-types/boxel-ui/components/tag-list/index.gts +85 -0
- package/bundled-types/boxel-ui/components/tag-list/usage.gts +129 -0
- package/bundled-types/boxel-ui/components/tooltip/index.gts +306 -0
- package/bundled-types/boxel-ui/components/tooltip/usage.gts +168 -0
- package/bundled-types/boxel-ui/components/view-selector/index.gts +166 -0
- package/bundled-types/boxel-ui/components/view-selector/usage.gts +149 -0
- package/bundled-types/boxel-ui/components.ts +169 -0
- package/bundled-types/boxel-ui/helpers/add-class-to-svg.ts +8 -0
- package/bundled-types/boxel-ui/helpers/clipboard.ts +21 -0
- package/bundled-types/boxel-ui/helpers/cn.ts +12 -0
- package/bundled-types/boxel-ui/helpers/color-tools.ts +331 -0
- package/bundled-types/boxel-ui/helpers/compact.ts +3 -0
- package/bundled-types/boxel-ui/helpers/contrast-color.ts +32 -0
- package/bundled-types/boxel-ui/helpers/css-var.ts +41 -0
- package/bundled-types/boxel-ui/helpers/currency-format.ts +25 -0
- package/bundled-types/boxel-ui/helpers/dayjs-format.ts +27 -0
- package/bundled-types/boxel-ui/helpers/deterministic-color-from-string.ts +45 -0
- package/bundled-types/boxel-ui/helpers/element.ts +16 -0
- package/bundled-types/boxel-ui/helpers/extract-css-variables.ts +126 -0
- package/bundled-types/boxel-ui/helpers/format-age.ts +72 -0
- package/bundled-types/boxel-ui/helpers/format-countdown.ts +110 -0
- package/bundled-types/boxel-ui/helpers/format-currency.ts +95 -0
- package/bundled-types/boxel-ui/helpers/format-date-time.ts +567 -0
- package/bundled-types/boxel-ui/helpers/format-duration.ts +143 -0
- package/bundled-types/boxel-ui/helpers/format-file-size.ts +49 -0
- package/bundled-types/boxel-ui/helpers/format-list.ts +73 -0
- package/bundled-types/boxel-ui/helpers/format-names.ts +103 -0
- package/bundled-types/boxel-ui/helpers/format-number.ts +140 -0
- package/bundled-types/boxel-ui/helpers/format-ordinal.ts +115 -0
- package/bundled-types/boxel-ui/helpers/format-period.ts +188 -0
- package/bundled-types/boxel-ui/helpers/format-relative-time.ts +789 -0
- package/bundled-types/boxel-ui/helpers/generate-css-variables.ts +47 -0
- package/bundled-types/boxel-ui/helpers/markdown-escape.ts +36 -0
- package/bundled-types/boxel-ui/helpers/math-helpers.ts +18 -0
- package/bundled-types/boxel-ui/helpers/menu-divider.ts +15 -0
- package/bundled-types/boxel-ui/helpers/menu-item.ts +76 -0
- package/bundled-types/boxel-ui/helpers/optional.ts +7 -0
- package/bundled-types/boxel-ui/helpers/pick.ts +11 -0
- package/bundled-types/boxel-ui/helpers/sanitize-html.ts +45 -0
- package/bundled-types/boxel-ui/helpers/string.ts +15 -0
- package/bundled-types/boxel-ui/helpers/theme-css.ts +148 -0
- package/bundled-types/boxel-ui/helpers/truth-helpers.ts +48 -0
- package/bundled-types/boxel-ui/helpers/validate-email-format.ts +138 -0
- package/bundled-types/boxel-ui/helpers/validate-phone-format.ts +201 -0
- package/bundled-types/boxel-ui/helpers.ts +134 -0
- package/bundled-types/boxel-ui/icons/ai-bw.gts +22 -0
- package/bundled-types/boxel-ui/icons/arrow-left.gts +25 -0
- package/bundled-types/boxel-ui/icons/arrow-right.gts +28 -0
- package/bundled-types/boxel-ui/icons/arrow-top-left.gts +22 -0
- package/bundled-types/boxel-ui/icons/arrow-up.gts +25 -0
- package/bundled-types/boxel-ui/icons/atom.gts +26 -0
- package/bundled-types/boxel-ui/icons/boxel-icon-with-text.gts +29 -0
- package/bundled-types/boxel-ui/icons/boxel-icon.gts +34 -0
- package/bundled-types/boxel-ui/icons/card-definition.gts +26 -0
- package/bundled-types/boxel-ui/icons/card-instance.gts +26 -0
- package/bundled-types/boxel-ui/icons/card.gts +24 -0
- package/bundled-types/boxel-ui/icons/cardbot-lg.gts +24 -0
- package/bundled-types/boxel-ui/icons/caret-down.gts +23 -0
- package/bundled-types/boxel-ui/icons/caret-up.gts +23 -0
- package/bundled-types/boxel-ui/icons/check-mark.gts +23 -0
- package/bundled-types/boxel-ui/icons/chevron-right.gts +23 -0
- package/bundled-types/boxel-ui/icons/copy.gts +28 -0
- package/bundled-types/boxel-ui/icons/diagonal-arrow-left-up.gts +21 -0
- package/bundled-types/boxel-ui/icons/download.gts +19 -0
- package/bundled-types/boxel-ui/icons/dropdown-arrow-down.gts +20 -0
- package/bundled-types/boxel-ui/icons/dropdown-arrow-filled.gts +19 -0
- package/bundled-types/boxel-ui/icons/dropdown-arrow-up.gts +20 -0
- package/bundled-types/boxel-ui/icons/edit.gts +14 -0
- package/bundled-types/boxel-ui/icons/embedded.gts +34 -0
- package/bundled-types/boxel-ui/icons/exclamation-circle.gts +26 -0
- package/bundled-types/boxel-ui/icons/exclamation.gts +20 -0
- package/bundled-types/boxel-ui/icons/eye.gts +19 -0
- package/bundled-types/boxel-ui/icons/failure-bordered.gts +26 -0
- package/bundled-types/boxel-ui/icons/field.gts +26 -0
- package/bundled-types/boxel-ui/icons/file-alert.gts +28 -0
- package/bundled-types/boxel-ui/icons/file.gts +27 -0
- package/bundled-types/boxel-ui/icons/fitted.gts +42 -0
- package/bundled-types/boxel-ui/icons/folder.gts +26 -0
- package/bundled-types/boxel-ui/icons/form.gts +38 -0
- package/bundled-types/boxel-ui/icons/four-lines.gts +21 -0
- package/bundled-types/boxel-ui/icons/grid-3x3.gts +26 -0
- package/bundled-types/boxel-ui/icons/group.gts +22 -0
- package/bundled-types/boxel-ui/icons/head.gts +28 -0
- package/bundled-types/boxel-ui/icons/highlight-icon.gts +46 -0
- package/bundled-types/boxel-ui/icons/icon-circle-selected.gts +25 -0
- package/bundled-types/boxel-ui/icons/icon-circle.gts +25 -0
- package/bundled-types/boxel-ui/icons/icon-code.gts +22 -0
- package/bundled-types/boxel-ui/icons/icon-funnel.gts +23 -0
- package/bundled-types/boxel-ui/icons/icon-globe.gts +19 -0
- package/bundled-types/boxel-ui/icons/icon-grid.gts +68 -0
- package/bundled-types/boxel-ui/icons/icon-hexagon.gts +22 -0
- package/bundled-types/boxel-ui/icons/icon-inherit.gts +19 -0
- package/bundled-types/boxel-ui/icons/icon-link.gts +20 -0
- package/bundled-types/boxel-ui/icons/icon-list.gts +40 -0
- package/bundled-types/boxel-ui/icons/icon-minus-circle.gts +26 -0
- package/bundled-types/boxel-ui/icons/icon-pencil-crossed-out.gts +33 -0
- package/bundled-types/boxel-ui/icons/icon-pencil-not-crossed-out.gts +21 -0
- package/bundled-types/boxel-ui/icons/icon-pencil.gts +23 -0
- package/bundled-types/boxel-ui/icons/icon-plus-circle.gts +31 -0
- package/bundled-types/boxel-ui/icons/icon-plus-thin.gts +19 -0
- package/bundled-types/boxel-ui/icons/icon-plus.gts +20 -0
- package/bundled-types/boxel-ui/icons/icon-search-thick.gts +27 -0
- package/bundled-types/boxel-ui/icons/icon-search.gts +25 -0
- package/bundled-types/boxel-ui/icons/icon-table.gts +44 -0
- package/bundled-types/boxel-ui/icons/icon-trash.gts +24 -0
- package/bundled-types/boxel-ui/icons/icon-turn-down-right.gts +18 -0
- package/bundled-types/boxel-ui/icons/icon-x.gts +21 -0
- package/bundled-types/boxel-ui/icons/image-placeholder.gts +30 -0
- package/bundled-types/boxel-ui/icons/isolated.gts +20 -0
- package/bundled-types/boxel-ui/icons/loading-indicator.gts +26 -0
- package/bundled-types/boxel-ui/icons/lock.gts +23 -0
- package/bundled-types/boxel-ui/icons/markdown.gts +19 -0
- package/bundled-types/boxel-ui/icons/profile.gts +23 -0
- package/bundled-types/boxel-ui/icons/publish-site-icon.gts +25 -0
- package/bundled-types/boxel-ui/icons/rows-4.gts +26 -0
- package/bundled-types/boxel-ui/icons/select-all.gts +25 -0
- package/bundled-types/boxel-ui/icons/send.gts +21 -0
- package/bundled-types/boxel-ui/icons/sparkle.gts +21 -0
- package/bundled-types/boxel-ui/icons/star-filled.gts +25 -0
- package/bundled-types/boxel-ui/icons/star-half-fill.gts +27 -0
- package/bundled-types/boxel-ui/icons/star.gts +25 -0
- package/bundled-types/boxel-ui/icons/success-bordered.gts +30 -0
- package/bundled-types/boxel-ui/icons/three-dots-horizontal.gts +21 -0
- package/bundled-types/boxel-ui/icons/triangle-left.gts +23 -0
- package/bundled-types/boxel-ui/icons/triangle-right.gts +23 -0
- package/bundled-types/boxel-ui/icons/types.ts +10 -0
- package/bundled-types/boxel-ui/icons/upload.gts +20 -0
- package/bundled-types/boxel-ui/icons/warning.gts +19 -0
- package/bundled-types/boxel-ui/icons.gts +249 -0
- package/bundled-types/boxel-ui/modifiers/auto-focus.ts +7 -0
- package/bundled-types/boxel-ui/modifiers/set-css-var.ts +24 -0
- package/bundled-types/boxel-ui/modifiers.ts +14 -0
- package/bundled-types/boxel-ui/types/@cardstack/boxel-ui/index.d.ts +3 -0
- package/bundled-types/boxel-ui/types/ember-css-url/index.d.ts +15 -0
- package/bundled-types/boxel-ui/types/ember-draggable-modifiers/index.d.ts +109 -0
- package/bundled-types/boxel-ui/types/ember-draggable-modifiers/utils.d.ts +7 -0
- package/bundled-types/boxel-ui/types/ember-focus-trap/index.d.ts +20 -0
- package/bundled-types/boxel-ui/types/ember-power-calendar/components/index.d.ts +9 -0
- package/bundled-types/boxel-ui/types/ember-resize-modifier/index.d.ts +14 -0
- package/bundled-types/boxel-ui/types/ember-set-body-class/index.d.ts +12 -0
- package/bundled-types/boxel-ui/types/ember-sortable/index.d.ts +52 -0
- package/bundled-types/boxel-ui/types/global.d.ts +7 -0
- package/bundled-types/boxel-ui/usage.ts +112 -0
- package/bundled-types/boxel-ui/utils/date-utils.ts +192 -0
- package/bundled-types/boxel-ui/utils/fitted-formats.ts +161 -0
- package/bundled-types/host-app/app.ts +22 -0
- package/bundled-types/host-app/commands/add-field-to-card-definition.ts +74 -0
- package/bundled-types/host-app/commands/ai-assistant.ts +203 -0
- package/bundled-types/host-app/commands/apply-markdown-edit.ts +203 -0
- package/bundled-types/host-app/commands/apply-search-replace-block.ts +225 -0
- package/bundled-types/host-app/commands/ask-ai.ts +66 -0
- package/bundled-types/host-app/commands/authed-fetch.ts +53 -0
- package/bundled-types/host-app/commands/bot-requests/create-listing-pr-request.ts +77 -0
- package/bundled-types/host-app/commands/bot-requests/send-bot-trigger-event.ts +53 -0
- package/bundled-types/host-app/commands/can-read-realm.ts +34 -0
- package/bundled-types/host-app/commands/cancel-indexing-job.ts +29 -0
- package/bundled-types/host-app/commands/check-correctness.ts +309 -0
- package/bundled-types/host-app/commands/copy-and-edit.ts +311 -0
- package/bundled-types/host-app/commands/copy-card-as-markdown.ts +41 -0
- package/bundled-types/host-app/commands/copy-card-to-stack.ts +70 -0
- package/bundled-types/host-app/commands/copy-card.ts +67 -0
- package/bundled-types/host-app/commands/copy-file-to-realm.ts +82 -0
- package/bundled-types/host-app/commands/copy-source.ts +46 -0
- package/bundled-types/host-app/commands/create-ai-assistant-room.ts +144 -0
- package/bundled-types/host-app/commands/create-and-open-submission-workflow-card.ts +30 -0
- package/bundled-types/host-app/commands/create-specs.ts +422 -0
- package/bundled-types/host-app/commands/create-submission-workflow.ts +172 -0
- package/bundled-types/host-app/commands/evaluate-module.ts +119 -0
- package/bundled-types/host-app/commands/execute-atomic-operations.ts +44 -0
- package/bundled-types/host-app/commands/fetch-card-json.ts +33 -0
- package/bundled-types/host-app/commands/full-reindex-realm.ts +30 -0
- package/bundled-types/host-app/commands/generate-example-cards.ts +298 -0
- package/bundled-types/host-app/commands/generate-readme-spec.ts +116 -0
- package/bundled-types/host-app/commands/generate-theme-example.ts +147 -0
- package/bundled-types/host-app/commands/generate-thumbnail.ts +247 -0
- package/bundled-types/host-app/commands/get-all-realm-metas.ts +38 -0
- package/bundled-types/host-app/commands/get-available-realm-identifiers.ts +29 -0
- package/bundled-types/host-app/commands/get-card-type-schema.ts +59 -0
- package/bundled-types/host-app/commands/get-card.ts +34 -0
- package/bundled-types/host-app/commands/get-catalog-realm-identifiers.ts +29 -0
- package/bundled-types/host-app/commands/get-default-writable-realm.ts +28 -0
- package/bundled-types/host-app/commands/get-events-from-room.ts +70 -0
- package/bundled-types/host-app/commands/get-realm-of-resource-identifier.ts +37 -0
- package/bundled-types/host-app/commands/get-user-system-card.ts +38 -0
- package/bundled-types/host-app/commands/index.ts +590 -0
- package/bundled-types/host-app/commands/instantiate-card.ts +185 -0
- package/bundled-types/host-app/commands/invalidate-realm-identifiers.ts +33 -0
- package/bundled-types/host-app/commands/invite-user-to-room.ts +34 -0
- package/bundled-types/host-app/commands/lint-and-fix.ts +60 -0
- package/bundled-types/host-app/commands/listing-action-build.ts +79 -0
- package/bundled-types/host-app/commands/listing-action-init.ts +106 -0
- package/bundled-types/host-app/commands/listing-create.ts +632 -0
- package/bundled-types/host-app/commands/listing-generate-example.ts +83 -0
- package/bundled-types/host-app/commands/listing-install.ts +227 -0
- package/bundled-types/host-app/commands/listing-remix.ts +150 -0
- package/bundled-types/host-app/commands/listing-update-specs.ts +116 -0
- package/bundled-types/host-app/commands/listing-use.ts +97 -0
- package/bundled-types/host-app/commands/one-shot-llm-request.ts +209 -0
- package/bundled-types/host-app/commands/open-ai-assistant-room.ts +38 -0
- package/bundled-types/host-app/commands/open-create-listing-modal.ts +52 -0
- package/bundled-types/host-app/commands/open-in-interact-mode.ts +36 -0
- package/bundled-types/host-app/commands/open-workspace.ts +38 -0
- package/bundled-types/host-app/commands/patch-card-instance.ts +108 -0
- package/bundled-types/host-app/commands/patch-code.ts +243 -0
- package/bundled-types/host-app/commands/patch-fields.ts +304 -0
- package/bundled-types/host-app/commands/patch-theme.ts +52 -0
- package/bundled-types/host-app/commands/persist-module-inspector-view.ts +41 -0
- package/bundled-types/host-app/commands/populate-with-sample-data.ts +84 -0
- package/bundled-types/host-app/commands/preview-format.ts +52 -0
- package/bundled-types/host-app/commands/read-binary-file.ts +62 -0
- package/bundled-types/host-app/commands/read-card-for-ai-assistant.ts +50 -0
- package/bundled-types/host-app/commands/read-file-for-ai-assistant.ts +46 -0
- package/bundled-types/host-app/commands/read-source.ts +46 -0
- package/bundled-types/host-app/commands/read-text-file.ts +44 -0
- package/bundled-types/host-app/commands/register-bot.ts +42 -0
- package/bundled-types/host-app/commands/reindex-realm.ts +30 -0
- package/bundled-types/host-app/commands/retry-submission-workflow.ts +119 -0
- package/bundled-types/host-app/commands/sanitize-module-list.ts +83 -0
- package/bundled-types/host-app/commands/save-card.ts +44 -0
- package/bundled-types/host-app/commands/screenshot-card.ts +148 -0
- package/bundled-types/host-app/commands/search-and-choose.ts +180 -0
- package/bundled-types/host-app/commands/search-cards.ts +102 -0
- package/bundled-types/host-app/commands/search-google-images.ts +100 -0
- package/bundled-types/host-app/commands/send-ai-assistant-message.ts +122 -0
- package/bundled-types/host-app/commands/send-request-via-proxy.ts +70 -0
- package/bundled-types/host-app/commands/serialize-card.ts +45 -0
- package/bundled-types/host-app/commands/set-active-llm.ts +39 -0
- package/bundled-types/host-app/commands/set-user-system-card.ts +29 -0
- package/bundled-types/host-app/commands/show-card.ts +102 -0
- package/bundled-types/host-app/commands/show-file.ts +39 -0
- package/bundled-types/host-app/commands/store-add.ts +37 -0
- package/bundled-types/host-app/commands/summarize-session.ts +82 -0
- package/bundled-types/host-app/commands/switch-submode.ts +112 -0
- package/bundled-types/host-app/commands/sync-openrouter-models.ts +373 -0
- package/bundled-types/host-app/commands/transform-cards.ts +59 -0
- package/bundled-types/host-app/commands/unregister-bot.ts +29 -0
- package/bundled-types/host-app/commands/update-code-path-with-selection.ts +45 -0
- package/bundled-types/host-app/commands/update-playground-selection.ts +37 -0
- package/bundled-types/host-app/commands/update-room-skills.ts +231 -0
- package/bundled-types/host-app/commands/utils.ts +178 -0
- package/bundled-types/host-app/commands/validate-realm.ts +40 -0
- package/bundled-types/host-app/commands/write-binary-file.ts +142 -0
- package/bundled-types/host-app/commands/write-text-file.ts +104 -0
- package/bundled-types/host-app/components/.gitkeep +0 -0
- package/bundled-types/host-app/components/ai-assistant/action-bar.gts +188 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-button-active-bg.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-button-active-bg@2x.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-button-active-bg@3x.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon-animated.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon-bw.png +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon-bw@2x.png +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon-bw@3x.png +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon@2x.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/ai-assist-icon@3x.webp +0 -0
- package/bundled-types/host-app/components/ai-assistant/apply-button/index.gts +226 -0
- package/bundled-types/host-app/components/ai-assistant/apply-button/usage.gts +81 -0
- package/bundled-types/host-app/components/ai-assistant/attached-file-dropdown-menu.gts +179 -0
- package/bundled-types/host-app/components/ai-assistant/attachment-picker/attach-button.gts +176 -0
- package/bundled-types/host-app/components/ai-assistant/attachment-picker/attached-items.gts +271 -0
- package/bundled-types/host-app/components/ai-assistant/attachment-picker/index.gts +144 -0
- package/bundled-types/host-app/components/ai-assistant/attachment-picker/usage.gts +127 -0
- package/bundled-types/host-app/components/ai-assistant/button.gts +60 -0
- package/bundled-types/host-app/components/ai-assistant/chat-input/index.gts +203 -0
- package/bundled-types/host-app/components/ai-assistant/chat-input/usage.gts +68 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/actions.gts +58 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/apply-code-patch-button.gts +66 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/command-header.gts +115 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/diff-editor-header.gts +209 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/index.gts +228 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/patch-footer.gts +32 -0
- package/bundled-types/host-app/components/ai-assistant/code-block/view-code-button.gts +73 -0
- package/bundled-types/host-app/components/ai-assistant/focus-pill/index.gts +60 -0
- package/bundled-types/host-app/components/ai-assistant/focus-pill/usage.gts +45 -0
- package/bundled-types/host-app/components/ai-assistant/llm-mode-toggle.gts +113 -0
- package/bundled-types/host-app/components/ai-assistant/llm-select.gts +158 -0
- package/bundled-types/host-app/components/ai-assistant/message/aibot-message.gts +374 -0
- package/bundled-types/host-app/components/ai-assistant/message/attachments.gts +153 -0
- package/bundled-types/host-app/components/ai-assistant/message/index.gts +678 -0
- package/bundled-types/host-app/components/ai-assistant/message/meta.gts +66 -0
- package/bundled-types/host-app/components/ai-assistant/message/text-content.gts +32 -0
- package/bundled-types/host-app/components/ai-assistant/message/usage.gts +182 -0
- package/bundled-types/host-app/components/ai-assistant/message/user-message.gts +52 -0
- package/bundled-types/host-app/components/ai-assistant/new-session-button.gts +126 -0
- package/bundled-types/host-app/components/ai-assistant/new-session-settings.gts +180 -0
- package/bundled-types/host-app/components/ai-assistant/new-session.gts +83 -0
- package/bundled-types/host-app/components/ai-assistant/panel-popover.gts +102 -0
- package/bundled-types/host-app/components/ai-assistant/panel.gts +453 -0
- package/bundled-types/host-app/components/ai-assistant/past-session-item.gts +323 -0
- package/bundled-types/host-app/components/ai-assistant/past-sessions.gts +115 -0
- package/bundled-types/host-app/components/ai-assistant/rename-session.gts +144 -0
- package/bundled-types/host-app/components/ai-assistant/restore-file-modal.gts +105 -0
- package/bundled-types/host-app/components/ai-assistant/skill-menu/index.gts +190 -0
- package/bundled-types/host-app/components/ai-assistant/skill-menu/skill-toggle.gts +168 -0
- package/bundled-types/host-app/components/ai-assistant/skill-menu/usage.gts +48 -0
- package/bundled-types/host-app/components/ai-assistant/toast.gts +293 -0
- package/bundled-types/host-app/components/card-catalog/modal.gts +579 -0
- package/bundled-types/host-app/components/card-error.gts +41 -0
- package/bundled-types/host-app/components/card-instance-picker/index.gts +54 -0
- package/bundled-types/host-app/components/card-pill.gts +189 -0
- package/bundled-types/host-app/components/card-prerender.gts +880 -0
- package/bundled-types/host-app/components/card-renderer.gts +84 -0
- package/bundled-types/host-app/components/card-search/constants.ts +76 -0
- package/bundled-types/host-app/components/card-search/item-button.gts +243 -0
- package/bundled-types/host-app/components/card-search/panel.gts +150 -0
- package/bundled-types/host-app/components/card-search/search-bar.gts +218 -0
- package/bundled-types/host-app/components/card-search/search-content.gts +604 -0
- package/bundled-types/host-app/components/card-search/search-result-header.gts +165 -0
- package/bundled-types/host-app/components/card-search/search-result-section.gts +545 -0
- package/bundled-types/host-app/components/card-search/section-header.gts +117 -0
- package/bundled-types/host-app/components/editor/directory.gts +308 -0
- package/bundled-types/host-app/components/editor/file-tree.gts +69 -0
- package/bundled-types/host-app/components/editor/import-module.gts +27 -0
- package/bundled-types/host-app/components/editor/indexed-file-tree.gts +572 -0
- package/bundled-types/host-app/components/editor/recent-files.gts +141 -0
- package/bundled-types/host-app/components/file-pill.gts +206 -0
- package/bundled-types/host-app/components/head-format-preview.gts +781 -0
- package/bundled-types/host-app/components/host-mode/breadcrumb-item.gts +150 -0
- package/bundled-types/host-app/components/host-mode/breadcrumbs.gts +131 -0
- package/bundled-types/host-app/components/host-mode/card.gts +199 -0
- package/bundled-types/host-app/components/host-mode/content.gts +195 -0
- package/bundled-types/host-app/components/host-mode/stack-item.gts +310 -0
- package/bundled-types/host-app/components/host-mode/stack.gts +91 -0
- package/bundled-types/host-app/components/matrix/auth-container.gts +66 -0
- package/bundled-types/host-app/components/matrix/auth.gts +73 -0
- package/bundled-types/host-app/components/matrix/forgot-password.gts +487 -0
- package/bundled-types/host-app/components/matrix/login.gts +241 -0
- package/bundled-types/host-app/components/matrix/register-user.gts +843 -0
- package/bundled-types/host-app/components/matrix/room-message-command.gts +330 -0
- package/bundled-types/host-app/components/matrix/room-message.gts +261 -0
- package/bundled-types/host-app/components/matrix/room.gts +1872 -0
- package/bundled-types/host-app/components/matrix/user-profile.gts +99 -0
- package/bundled-types/host-app/components/modal-container.gts +171 -0
- package/bundled-types/host-app/components/operator-mode/binary-file-info.gts +77 -0
- package/bundled-types/host-app/components/operator-mode/card-adoption-chain.gts +99 -0
- package/bundled-types/host-app/components/operator-mode/card-error-detail.gts +87 -0
- package/bundled-types/host-app/components/operator-mode/card-error.gts +177 -0
- package/bundled-types/host-app/components/operator-mode/card-schema-editor.gts +616 -0
- package/bundled-types/host-app/components/operator-mode/card-url-bar.gts +197 -0
- package/bundled-types/host-app/components/operator-mode/choose-file-modal.gts +562 -0
- package/bundled-types/host-app/components/operator-mode/choose-subscription-plan-modal.gts +517 -0
- package/bundled-types/host-app/components/operator-mode/code-editor.gts +736 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/editor-indicator.gts +128 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/format-chooser.gts +589 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/inner-container.gts +162 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/left-panel-toggle.gts +267 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/module-inspector.gts +836 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/field-chooser-modal.gts +97 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/instance-chooser-dropdown.gts +346 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/playground-background.png +0 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/playground-panel.gts +1274 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/playground-preview.gts +155 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/playground.gts +98 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/playground/spec-search.gts +70 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/schema-editor.gts +205 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/spec-preview-badge.gts +72 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/spec-preview.gts +432 -0
- package/bundled-types/host-app/components/operator-mode/code-submode/toggle-button.gts +72 -0
- package/bundled-types/host-app/components/operator-mode/code-submode.gts +1030 -0
- package/bundled-types/host-app/components/operator-mode/container.gts +270 -0
- package/bundled-types/host-app/components/operator-mode/context-menu-button.gts +95 -0
- package/bundled-types/host-app/components/operator-mode/copy-button.gts +277 -0
- package/bundled-types/host-app/components/operator-mode/create-file-modal.gts +1087 -0
- package/bundled-types/host-app/components/operator-mode/create-listing-modal.gts +513 -0
- package/bundled-types/host-app/components/operator-mode/definition-container/base.gts +222 -0
- package/bundled-types/host-app/components/operator-mode/definition-container/clickable.gts +59 -0
- package/bundled-types/host-app/components/operator-mode/definition-container/divider.gts +48 -0
- package/bundled-types/host-app/components/operator-mode/definition-container/index.gts +108 -0
- package/bundled-types/host-app/components/operator-mode/delete-modal.gts +123 -0
- package/bundled-types/host-app/components/operator-mode/detail-panel-selector.gts +320 -0
- package/bundled-types/host-app/components/operator-mode/detail-panel.gts +834 -0
- package/bundled-types/host-app/components/operator-mode/edit-field-modal.gts +450 -0
- package/bundled-types/host-app/components/operator-mode/error-display.gts +590 -0
- package/bundled-types/host-app/components/operator-mode/host-submode/open-site-popover.gts +127 -0
- package/bundled-types/host-app/components/operator-mode/host-submode/publishing-realm-popover.gts +159 -0
- package/bundled-types/host-app/components/operator-mode/host-submode.gts +373 -0
- package/bundled-types/host-app/components/operator-mode/interact-submode/neighbor-stack-trigger.gts +116 -0
- package/bundled-types/host-app/components/operator-mode/interact-submode.gts +1021 -0
- package/bundled-types/host-app/components/operator-mode/new-file-button.gts +187 -0
- package/bundled-types/host-app/components/operator-mode/operator-mode-overlays.gts +511 -0
- package/bundled-types/host-app/components/operator-mode/overlays.gts +342 -0
- package/bundled-types/host-app/components/operator-mode/preview-panel/fitted-format-gallery.gts +127 -0
- package/bundled-types/host-app/components/operator-mode/preview-panel/index.gts +443 -0
- package/bundled-types/host-app/components/operator-mode/preview-panel/markdown-preview.gts +175 -0
- package/bundled-types/host-app/components/operator-mode/preview-panel/metadata-panel.gts +214 -0
- package/bundled-types/host-app/components/operator-mode/preview-panel/rendered-markdown.gts +718 -0
- package/bundled-types/host-app/components/operator-mode/private-dependency-violation.gts +70 -0
- package/bundled-types/host-app/components/operator-mode/profile/profile-email.gts +686 -0
- package/bundled-types/host-app/components/operator-mode/profile/profile-settings-modal.gts +454 -0
- package/bundled-types/host-app/components/operator-mode/profile/profile-subscription.gts +170 -0
- package/bundled-types/host-app/components/operator-mode/profile-info-popover.gts +263 -0
- package/bundled-types/host-app/components/operator-mode/publish-realm-modal.gts +1529 -0
- package/bundled-types/host-app/components/operator-mode/remove-field-modal.gts +135 -0
- package/bundled-types/host-app/components/operator-mode/send-error-to-ai-assistant.gts +195 -0
- package/bundled-types/host-app/components/operator-mode/stack-item.gts +1341 -0
- package/bundled-types/host-app/components/operator-mode/stack.gts +191 -0
- package/bundled-types/host-app/components/operator-mode/submode-layout.gts +781 -0
- package/bundled-types/host-app/components/operator-mode/syntax-error-display.gts +72 -0
- package/bundled-types/host-app/components/operator-mode/workspace-chooser/add-workspace.gts +282 -0
- package/bundled-types/host-app/components/operator-mode/workspace-chooser/index.gts +299 -0
- package/bundled-types/host-app/components/operator-mode/workspace-chooser/item-container.gts +50 -0
- package/bundled-types/host-app/components/operator-mode/workspace-chooser/workspace-loading-indicator.gts +50 -0
- package/bundled-types/host-app/components/operator-mode/workspace-chooser/workspace.gts +1079 -0
- package/bundled-types/host-app/components/pill-menu/index.gts +281 -0
- package/bundled-types/host-app/components/pill-menu/usage.gts +64 -0
- package/bundled-types/host-app/components/prerendered-card-search.gts +274 -0
- package/bundled-types/host-app/components/realm-dropdown.gts +209 -0
- package/bundled-types/host-app/components/realm-picker/index.gts +142 -0
- package/bundled-types/host-app/components/search-sheet/index.gts +426 -0
- package/bundled-types/host-app/components/search-sheet/usage.gts +99 -0
- package/bundled-types/host-app/components/submode-switcher.gts +260 -0
- package/bundled-types/host-app/components/type-picker/index.gts +111 -0
- package/bundled-types/host-app/components/with-known-realms-loaded.gts +47 -0
- package/bundled-types/host-app/components/with-loaded-realm.gts +39 -0
- package/bundled-types/host-app/components/with-subscription-data.gts +247 -0
- package/bundled-types/host-app/config/environment.ts +66 -0
- package/bundled-types/host-app/deprecation-workflow.js +30 -0
- package/bundled-types/host-app/lib/browser-queue.ts +198 -0
- package/bundled-types/host-app/lib/codemirror-context.ts +1081 -0
- package/bundled-types/host-app/lib/command-definitions.ts +41 -0
- package/bundled-types/host-app/lib/download-realm.ts +9 -0
- package/bundled-types/host-app/lib/example-card-helpers.ts +99 -0
- package/bundled-types/host-app/lib/externals.ts +247 -0
- package/bundled-types/host-app/lib/field-path-parser.ts +520 -0
- package/bundled-types/host-app/lib/file-def-manager.ts +712 -0
- package/bundled-types/host-app/lib/file-upload-state.ts +6 -0
- package/bundled-types/host-app/lib/formatted-message/utils.ts +272 -0
- package/bundled-types/host-app/lib/gc-card-store.ts +1084 -0
- package/bundled-types/host-app/lib/host-base-command.ts +29 -0
- package/bundled-types/host-app/lib/html-component.ts +144 -0
- package/bundled-types/host-app/lib/html-to-markdown.ts +96 -0
- package/bundled-types/host-app/lib/isolated-render.gts +90 -0
- package/bundled-types/host-app/lib/known-file-meta-urls.ts +17 -0
- package/bundled-types/host-app/lib/limited-set.ts +68 -0
- package/bundled-types/host-app/lib/matrix-classes/member.ts +28 -0
- package/bundled-types/host-app/lib/matrix-classes/message-builder.ts +444 -0
- package/bundled-types/host-app/lib/matrix-classes/message-code-patch-result.ts +44 -0
- package/bundled-types/host-app/lib/matrix-classes/message-command.ts +109 -0
- package/bundled-types/host-app/lib/matrix-classes/message.ts +239 -0
- package/bundled-types/host-app/lib/matrix-classes/room.ts +174 -0
- package/bundled-types/host-app/lib/matrix-utils.ts +114 -0
- package/bundled-types/host-app/lib/mutex.ts +62 -0
- package/bundled-types/host-app/lib/prerender-fetch-headers.ts +46 -0
- package/bundled-types/host-app/lib/prerender-util.ts +31 -0
- package/bundled-types/host-app/lib/public-path.ts +1 -0
- package/bundled-types/host-app/lib/random-name.ts +26 -0
- package/bundled-types/host-app/lib/realm-utils.ts +45 -0
- package/bundled-types/host-app/lib/search-cache-key.ts +33 -0
- package/bundled-types/host-app/lib/search-in-flight-key.ts +28 -0
- package/bundled-types/host-app/lib/search-replace-block-parsing.ts +101 -0
- package/bundled-types/host-app/lib/setup-globals.ts +15 -0
- package/bundled-types/host-app/lib/sqlite-adapter.ts +510 -0
- package/bundled-types/host-app/lib/stack-item.ts +164 -0
- package/bundled-types/host-app/lib/utils.ts +84 -0
- package/bundled-types/host-app/lib/window-error-handler.ts +132 -0
- package/bundled-types/host-app/router.ts +31 -0
- package/bundled-types/host-app/services/ai-assistant-panel-service.ts +850 -0
- package/bundled-types/host-app/services/billing-service.ts +208 -0
- package/bundled-types/host-app/services/card-service.ts +373 -0
- package/bundled-types/host-app/services/card-type-service.ts +226 -0
- package/bundled-types/host-app/services/code-semantics-service.ts +297 -0
- package/bundled-types/host-app/services/command-service.ts +975 -0
- package/bundled-types/host-app/services/environment-service.ts +26 -0
- package/bundled-types/host-app/services/error-display.ts +42 -0
- package/bundled-types/host-app/services/file-upload.ts +212 -0
- package/bundled-types/host-app/services/host-mode-service.ts +381 -0
- package/bundled-types/host-app/services/host-mode-state-service.ts +160 -0
- package/bundled-types/host-app/services/loader-service.ts +148 -0
- package/bundled-types/host-app/services/local-indexer.ts +68 -0
- package/bundled-types/host-app/services/local-persistence-service.ts +296 -0
- package/bundled-types/host-app/services/logger-service.ts +13 -0
- package/bundled-types/host-app/services/matrix-sdk-loader.ts +346 -0
- package/bundled-types/host-app/services/matrix-service.ts +2287 -0
- package/bundled-types/host-app/services/message-service.ts +84 -0
- package/bundled-types/host-app/services/module-contents-service.ts +333 -0
- package/bundled-types/host-app/services/monaco-service.ts +333 -0
- package/bundled-types/host-app/services/network.ts +101 -0
- package/bundled-types/host-app/services/operator-mode-state-service.ts +1591 -0
- package/bundled-types/host-app/services/playground-panel-service.ts +236 -0
- package/bundled-types/host-app/services/queue.ts +30 -0
- package/bundled-types/host-app/services/realm-info-service.ts +37 -0
- package/bundled-types/host-app/services/realm-server.ts +1209 -0
- package/bundled-types/host-app/services/realm.ts +1413 -0
- package/bundled-types/host-app/services/recent-cards-service.ts +174 -0
- package/bundled-types/host-app/services/recent-files-service.ts +224 -0
- package/bundled-types/host-app/services/render-error-state.ts +55 -0
- package/bundled-types/host-app/services/render-service.ts +362 -0
- package/bundled-types/host-app/services/render-store.ts +27 -0
- package/bundled-types/host-app/services/reset.ts +19 -0
- package/bundled-types/host-app/services/scroll-position-service.ts +81 -0
- package/bundled-types/host-app/services/spec-panel-service.ts +107 -0
- package/bundled-types/host-app/services/store.ts +2540 -0
- package/bundled-types/host-app/utils/assert-never.ts +3 -0
- package/bundled-types/host-app/utils/auth-error-guard.ts +183 -0
- package/bundled-types/host-app/utils/auth-service-worker-registration.ts +123 -0
- package/bundled-types/host-app/utils/card-search/query-builder.ts +169 -0
- package/bundled-types/host-app/utils/card-search/section-pagination.ts +57 -0
- package/bundled-types/host-app/utils/card-search/sections.ts +240 -0
- package/bundled-types/host-app/utils/card-search/type-filter.ts +124 -0
- package/bundled-types/host-app/utils/card-search/types.ts +11 -0
- package/bundled-types/host-app/utils/card-search/url.ts +23 -0
- package/bundled-types/host-app/utils/clipboard.ts +23 -0
- package/bundled-types/host-app/utils/editor/boxel-formatter.ts +65 -0
- package/bundled-types/host-app/utils/editor/editor-language.ts +88 -0
- package/bundled-types/host-app/utils/editor/monaco-test-waiter.ts +302 -0
- package/bundled-types/host-app/utils/file-def-attributes-extractor.ts +438 -0
- package/bundled-types/host-app/utils/file-name.ts +38 -0
- package/bundled-types/host-app/utils/id-from-card-or-url.ts +11 -0
- package/bundled-types/host-app/utils/lint-formatting.ts +57 -0
- package/bundled-types/host-app/utils/local-storage-keys.ts +28 -0
- package/bundled-types/host-app/utils/normalized-dir-path.ts +3 -0
- package/bundled-types/host-app/utils/prettify-messages.ts +21 -0
- package/bundled-types/host-app/utils/prettify-prompts.ts +21 -0
- package/bundled-types/host-app/utils/realm-index-boilerplate.ts +27 -0
- package/bundled-types/host-app/utils/register-boxel-transition.ts +17 -0
- package/bundled-types/host-app/utils/render-desync-detector.ts +362 -0
- package/bundled-types/host-app/utils/render-error.ts +455 -0
- package/bundled-types/host-app/utils/render-timer-stub.ts +249 -0
- package/bundled-types/host-app/utils/run-while-active.ts +14 -0
- package/bundled-types/host-app/utils/schema-editor.ts +25 -0
- package/bundled-types/host-app/utils/text-suggestion.ts +82 -0
- package/bundled-types/host-app/utils/titleize.ts +10 -0
- package/bundled-types/host-app/utils/uuid.ts +13 -0
- package/bundled-types/host-tests/helpers/adapter.ts +464 -0
- package/bundled-types/host-tests/helpers/base-realm.ts +464 -0
- package/bundled-types/host-tests/helpers/cards/view-card-demo.ts +119 -0
- package/bundled-types/host-tests/helpers/field-test-helpers.gts +54 -0
- package/bundled-types/host-tests/helpers/image-fixture.ts +3 -0
- package/bundled-types/host-tests/helpers/index.gts +2099 -0
- package/bundled-types/host-tests/helpers/indexer.ts +293 -0
- package/bundled-types/host-tests/helpers/interact-submode-setup.gts +551 -0
- package/bundled-types/host-tests/helpers/mock-matrix/_client.ts +1042 -0
- package/bundled-types/host-tests/helpers/mock-matrix/_sdk.ts +71 -0
- package/bundled-types/host-tests/helpers/mock-matrix/_server-state.ts +343 -0
- package/bundled-types/host-tests/helpers/mock-matrix/_sliding-sync.ts +140 -0
- package/bundled-types/host-tests/helpers/mock-matrix/_utils.ts +146 -0
- package/bundled-types/host-tests/helpers/mock-matrix.ts +200 -0
- package/bundled-types/host-tests/helpers/operator-mode-parameters-match.ts +71 -0
- package/bundled-types/host-tests/helpers/operator-mode-state.ts +18 -0
- package/bundled-types/host-tests/helpers/percy-snapshot.ts +228 -0
- package/bundled-types/host-tests/helpers/playground.ts +130 -0
- package/bundled-types/host-tests/helpers/realm-server-mock/index.ts +100 -0
- package/bundled-types/host-tests/helpers/realm-server-mock/routes.ts +617 -0
- package/bundled-types/host-tests/helpers/realm-server-mock/types.ts +24 -0
- package/bundled-types/host-tests/helpers/recent-files-cards.ts +86 -0
- package/bundled-types/host-tests/helpers/render-component.ts +40 -0
- package/bundled-types/host-tests/helpers/setup-qunit.js +164 -0
- package/bundled-types/host-tests/helpers/setup.ts +349 -0
- package/bundled-types/host-tests/helpers/shard-warmup.ts +72 -0
- package/bundled-types/host-tests/helpers/stream.ts +60 -0
- package/bundled-types/host-tests/helpers/test-auth.ts +27 -0
- package/bundled-types/host-tests/helpers/test-realm-registry.ts +23 -0
- package/bundled-types/host-tests/helpers/test-realm-service-worker.ts +92 -0
- package/bundled-types/host-tests/helpers/uncaught-exceptions.ts +16 -0
- package/bundled-types/host-tests/helpers/visit-operator-mode.ts +39 -0
- package/bundled-types/host-types/@cardstack/host/index.d.ts +3 -0
- package/bundled-types/host-types/@joplin/turndown-plugin-gfm/index.d.ts +15 -0
- package/bundled-types/host-types/@sqlite.org/sqlite-wasm/index.d.ts +122 -0
- package/bundled-types/host-types/ember-click-outside/modifiers/on-click-outside.ts +16 -0
- package/bundled-types/host-types/ember-concurrency/helpers/perform.d.ts +3 -0
- package/bundled-types/host-types/ember-css-url/index.d.ts +15 -0
- package/bundled-types/host-types/ember-data/types/registries/model.d.ts +6 -0
- package/bundled-types/host-types/ember-elsewhere/from-elsewhere.d.ts +12 -0
- package/bundled-types/host-types/ember-elsewhere/to-elsewhere.d.ts +16 -0
- package/bundled-types/host-types/ember-focus-trap/index.d.ts +4 -0
- package/bundled-types/host-types/ember-keyboard/modifiers/on-key.d.ts +15 -0
- package/bundled-types/host-types/index.d.ts +6 -0
- package/bundled-types/local-types/eslint-js.d.ts +5 -0
- package/bundled-types/local-types/index.d.ts +115 -0
- package/bundled-types/local-types/marked-gfm-heading-id.d.ts +12 -0
- package/bundled-types/local-types/matrix-js-sdk/index.d.ts +11 -0
- package/bundled-types/local-types/package.json +13 -0
- package/bundled-types/shims/boxel-cli-shims.d.ts +10 -0
- package/dist/index.js +100 -100
- package/package.json +13 -7
- package/src/commands/parse.ts +277 -34
|
@@ -0,0 +1,1042 @@
|
|
|
1
|
+
import type Owner from '@ember/owner';
|
|
2
|
+
|
|
3
|
+
import { getService } from '@universal-ember/test-support';
|
|
4
|
+
|
|
5
|
+
import { MatrixEvent } from 'matrix-js-sdk';
|
|
6
|
+
|
|
7
|
+
import * as MatrixSDK from 'matrix-js-sdk';
|
|
8
|
+
|
|
9
|
+
import type { LooseSingleCardDocument } from '@cardstack/runtime-common';
|
|
10
|
+
import { baseRealm, unixTime } from '@cardstack/runtime-common';
|
|
11
|
+
|
|
12
|
+
import { ensureTrailingSlash } from '@cardstack/runtime-common';
|
|
13
|
+
import { BOT_TRIGGER_EVENT_TYPE } from '@cardstack/runtime-common';
|
|
14
|
+
import { canonicalizeMatrixMediaKey } from '@cardstack/runtime-common/ai/matrix-utils';
|
|
15
|
+
import {
|
|
16
|
+
APP_BOXEL_ACTIVE_LLM,
|
|
17
|
+
APP_BOXEL_COMMAND_RESULT_EVENT_TYPE,
|
|
18
|
+
APP_BOXEL_DEBUG_MESSAGE_EVENT_TYPE,
|
|
19
|
+
APP_BOXEL_REALMS_EVENT_TYPE,
|
|
20
|
+
APP_BOXEL_ROOM_SKILLS_EVENT_TYPE,
|
|
21
|
+
APP_BOXEL_REALM_EVENT_TYPE,
|
|
22
|
+
APP_BOXEL_CODE_PATCH_RESULT_EVENT_TYPE,
|
|
23
|
+
APP_BOXEL_LLM_MODE,
|
|
24
|
+
APP_BOXEL_SYSTEM_CARD_EVENT_TYPE,
|
|
25
|
+
APP_BOXEL_WORKSPACE_FAVORITES_EVENT_TYPE,
|
|
26
|
+
} from '@cardstack/runtime-common/matrix-constants';
|
|
27
|
+
|
|
28
|
+
import ENV from '@cardstack/host/config/environment';
|
|
29
|
+
|
|
30
|
+
import FileDefManagerImpl from '@cardstack/host/lib/file-def-manager';
|
|
31
|
+
import type { ExtendedClient } from '@cardstack/host/services/matrix-sdk-loader';
|
|
32
|
+
|
|
33
|
+
import { assertNever } from '@cardstack/host/utils/assert-never';
|
|
34
|
+
|
|
35
|
+
import type { CardDef } from 'https://cardstack.com/base/card-api';
|
|
36
|
+
import type { SerializedFile } from 'https://cardstack.com/base/file-api';
|
|
37
|
+
import type { FileDef } from 'https://cardstack.com/base/file-api';
|
|
38
|
+
import type { MatrixEvent as DiscreteMatrixEvent } from 'https://cardstack.com/base/matrix-event';
|
|
39
|
+
import type { CommandField } from 'https://cardstack.com/base/skill';
|
|
40
|
+
|
|
41
|
+
import type { MockSDK } from './_sdk';
|
|
42
|
+
|
|
43
|
+
import type { ServerState } from './_server-state';
|
|
44
|
+
|
|
45
|
+
import type { Config } from '../mock-matrix';
|
|
46
|
+
import type {
|
|
47
|
+
MSC3575SlidingSyncRequest,
|
|
48
|
+
MSC3575SlidingSyncResponse,
|
|
49
|
+
} from 'matrix-js-sdk/lib/sliding-sync';
|
|
50
|
+
|
|
51
|
+
type IEvent = MatrixSDK.IEvent;
|
|
52
|
+
|
|
53
|
+
let nonce = 0;
|
|
54
|
+
|
|
55
|
+
type Plural<T> = {
|
|
56
|
+
[K in keyof T]: T[K][];
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const publicRealmURLs = [
|
|
60
|
+
baseRealm.url,
|
|
61
|
+
ENV.resolvedCatalogRealmURL &&
|
|
62
|
+
ensureTrailingSlash(ENV.resolvedCatalogRealmURL),
|
|
63
|
+
ensureTrailingSlash(ENV.resolvedSkillsRealmURL),
|
|
64
|
+
].filter(Boolean) as string[];
|
|
65
|
+
|
|
66
|
+
export class MockClient implements ExtendedClient {
|
|
67
|
+
private listeners: Partial<Plural<MatrixSDK.ClientEventHandlerMap>> = {};
|
|
68
|
+
private stopServerStateSubscriptions: Array<() => void> = [];
|
|
69
|
+
|
|
70
|
+
private txnCtr = 0;
|
|
71
|
+
private fileDefManager: FileDefManagerImpl;
|
|
72
|
+
slidingSyncInstance: any;
|
|
73
|
+
|
|
74
|
+
constructor(
|
|
75
|
+
private owner: Owner,
|
|
76
|
+
private sdk: MockSDK,
|
|
77
|
+
private serverState: ServerState,
|
|
78
|
+
private clientOpts: MatrixSDK.ICreateClientOpts,
|
|
79
|
+
private sdkOpts: Config,
|
|
80
|
+
) {
|
|
81
|
+
let matrixService = getService('matrix-service');
|
|
82
|
+
this.fileDefManager = new FileDefManagerImpl({
|
|
83
|
+
client: this as unknown as ExtendedClient,
|
|
84
|
+
owner: this.owner,
|
|
85
|
+
getCardAPI: () => matrixService.cardAPI,
|
|
86
|
+
getFileAPI: () => matrixService.fileAPI,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async getAccountDataFromServer<K extends keyof MatrixSDK.AccountDataEvents>(
|
|
91
|
+
_eventType: K,
|
|
92
|
+
): Promise<MatrixSDK.AccountDataEvents[K] | null> {
|
|
93
|
+
if (_eventType === 'm.direct') {
|
|
94
|
+
return {
|
|
95
|
+
[this.loggedInAs!]: this.sdkOpts.directRooms ?? [],
|
|
96
|
+
} as unknown as K;
|
|
97
|
+
} else if (_eventType === APP_BOXEL_REALMS_EVENT_TYPE) {
|
|
98
|
+
return {
|
|
99
|
+
realms: this.sdkOpts.activeRealms ?? [],
|
|
100
|
+
} as unknown as K;
|
|
101
|
+
} else if (_eventType === APP_BOXEL_SYSTEM_CARD_EVENT_TYPE) {
|
|
102
|
+
return (this.sdkOpts.systemCardAccountData ?? null) as unknown as K;
|
|
103
|
+
} else if (_eventType === APP_BOXEL_WORKSPACE_FAVORITES_EVENT_TYPE) {
|
|
104
|
+
return {
|
|
105
|
+
favorites: this.sdkOpts.workspaceFavorites ?? [],
|
|
106
|
+
} as unknown as K;
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
get loggedInAs() {
|
|
112
|
+
return this.clientOpts.userId ?? this.sdkOpts.loggedInAs;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async startClient(
|
|
116
|
+
opts?: MatrixSDK.IStartClientOpts | undefined,
|
|
117
|
+
): Promise<void> {
|
|
118
|
+
this.stopClient();
|
|
119
|
+
|
|
120
|
+
if (opts?.slidingSync) {
|
|
121
|
+
this.slidingSyncInstance = opts.slidingSync;
|
|
122
|
+
await opts.slidingSync.start();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
this.stopServerStateSubscriptions.push(
|
|
126
|
+
this.serverState.onEvent((serverEvent: IEvent) => {
|
|
127
|
+
this.emitEvent(new MatrixEvent(serverEvent));
|
|
128
|
+
}),
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
this.stopServerStateSubscriptions.push(
|
|
132
|
+
this.serverState.onSlidingSyncEvent((roomId, roomName) => {
|
|
133
|
+
if (this.slidingSyncInstance) {
|
|
134
|
+
this.slidingSyncInstance.triggerRoomSync(
|
|
135
|
+
roomId,
|
|
136
|
+
roomName,
|
|
137
|
+
this.serverState,
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}),
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
this.emitEvent(
|
|
144
|
+
new MatrixEvent({
|
|
145
|
+
type: APP_BOXEL_REALMS_EVENT_TYPE,
|
|
146
|
+
content: {
|
|
147
|
+
realms: this.sdkOpts.activeRealms ?? [],
|
|
148
|
+
},
|
|
149
|
+
}),
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async createRealmSession(realmURL: URL): Promise<string> {
|
|
154
|
+
let secret = "shhh! it's a secret";
|
|
155
|
+
let nowInSeconds = unixTime(Date.now());
|
|
156
|
+
let expires = nowInSeconds + (this.sdkOpts.expiresInSec ?? 60 * 60);
|
|
157
|
+
let header = { alg: 'none', typ: 'JWT' };
|
|
158
|
+
let permissions = (this.sdkOpts.realmPermissions ?? {})[realmURL.href] ?? [
|
|
159
|
+
'read',
|
|
160
|
+
'write',
|
|
161
|
+
];
|
|
162
|
+
if (publicRealmURLs.includes(realmURL.href)) {
|
|
163
|
+
permissions = ['read'];
|
|
164
|
+
}
|
|
165
|
+
let sessionRoom = `test-session-room-realm-${realmURL.href}-user-${this.loggedInAs}`;
|
|
166
|
+
let realmServerURL =
|
|
167
|
+
ensureTrailingSlash(realmURL.href) === baseRealm.url
|
|
168
|
+
? new URL(ENV.resolvedBaseRealmURL).origin
|
|
169
|
+
: realmURL.origin;
|
|
170
|
+
let payload = {
|
|
171
|
+
iat: nowInSeconds,
|
|
172
|
+
exp: expires,
|
|
173
|
+
user: this.loggedInAs,
|
|
174
|
+
realm: realmURL.href,
|
|
175
|
+
sessionRoom,
|
|
176
|
+
realmServerURL: ensureTrailingSlash(realmServerURL),
|
|
177
|
+
// adding a nonce to the test token so that we can tell the difference
|
|
178
|
+
// between different tokens created in the same second
|
|
179
|
+
nonce: nonce++,
|
|
180
|
+
permissions,
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
let stringifiedHeader = JSON.stringify(header);
|
|
184
|
+
let stringifiedPayload = JSON.stringify(payload);
|
|
185
|
+
let headerAndPayload = `${btoa(stringifiedHeader)}.${btoa(
|
|
186
|
+
stringifiedPayload,
|
|
187
|
+
)}`;
|
|
188
|
+
// this is our silly JWT--we don't sign with crypto since we are running in the
|
|
189
|
+
// browser so the secret is the signature
|
|
190
|
+
return `${headerAndPayload}.${secret}`;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
get baseUrl(): string {
|
|
194
|
+
return this.clientOpts.baseUrl;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
downloadContentAsBlob(_file: FileDef): Promise<Blob> {
|
|
198
|
+
throw new Error('Method not implemented.');
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
hashMessageWithSecret(_message: string): Promise<string> {
|
|
202
|
+
throw new Error('Method not implemented.');
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
getAccessToken(): string | null {
|
|
206
|
+
return "shhh! it's a secret";
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async getOpenIdToken() {
|
|
210
|
+
let accessToken =
|
|
211
|
+
this.sdkOpts.loggedInAs ?? this.clientOpts.userId ?? 'mock-matrix-user';
|
|
212
|
+
let baseUrl = this.baseUrl ?? 'http://localhost';
|
|
213
|
+
let matrixServerName: string;
|
|
214
|
+
try {
|
|
215
|
+
matrixServerName = new URL(baseUrl).host;
|
|
216
|
+
} catch (_e) {
|
|
217
|
+
matrixServerName = 'localhost';
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
access_token: `mock-openid-token:${accessToken}`,
|
|
221
|
+
expires_in: this.sdkOpts.expiresInSec ?? 60 * 60,
|
|
222
|
+
matrix_server_name: matrixServerName,
|
|
223
|
+
token_type: 'Bearer',
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
setAccountData<K extends keyof MatrixSDK.AccountDataEvents>(
|
|
228
|
+
type: K,
|
|
229
|
+
data: K,
|
|
230
|
+
): Promise<{}> {
|
|
231
|
+
if (type === APP_BOXEL_REALMS_EVENT_TYPE) {
|
|
232
|
+
this.sdkOpts.activeRealms = (data as any).realms;
|
|
233
|
+
} else if (type === 'm.direct') {
|
|
234
|
+
this.sdkOpts.directRooms = (data as any)[this.loggedInAs!];
|
|
235
|
+
} else if (type === APP_BOXEL_SYSTEM_CARD_EVENT_TYPE) {
|
|
236
|
+
this.sdkOpts.systemCardAccountData = data as any;
|
|
237
|
+
} else if (type === APP_BOXEL_WORKSPACE_FAVORITES_EVENT_TYPE) {
|
|
238
|
+
this.sdkOpts.workspaceFavorites = (data as any).favorites;
|
|
239
|
+
} else {
|
|
240
|
+
throw new Error(
|
|
241
|
+
'Support for updating this event type in account data is not yet implemented in this mock.',
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
this.emitEvent(
|
|
245
|
+
new MatrixEvent({
|
|
246
|
+
type: type as string,
|
|
247
|
+
content: data as unknown as Record<string, unknown>,
|
|
248
|
+
}),
|
|
249
|
+
);
|
|
250
|
+
return Promise.resolve({});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
getAccountData<T>(_type: string): Promise<T> {
|
|
254
|
+
throw new Error('Method not implemented.');
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
addThreePidOnly(_data: MatrixSDK.IAddThreePidOnlyBody): Promise<{}> {
|
|
258
|
+
throw new Error('Method not implemented.');
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
get credentials(): { userId: string | null } {
|
|
262
|
+
return { userId: this.loggedInAs ?? null };
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
deleteThreePid(
|
|
266
|
+
_medium: string,
|
|
267
|
+
_address: string,
|
|
268
|
+
): Promise<{ id_server_unbind_result: MatrixSDK.IdServerUnbindResult }> {
|
|
269
|
+
throw new Error('Method not implemented.');
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
fetchRoomEvent(
|
|
273
|
+
roomId: string,
|
|
274
|
+
eventId: string,
|
|
275
|
+
): Promise<Partial<MatrixSDK.IEvent>> {
|
|
276
|
+
let events = this.serverState.getRoomEvents(roomId);
|
|
277
|
+
let event = events.find((e) => e.event_id === eventId);
|
|
278
|
+
|
|
279
|
+
if (!event) {
|
|
280
|
+
throw new Error(`event ${eventId} not found in room ${roomId}`);
|
|
281
|
+
}
|
|
282
|
+
return Promise.resolve(event);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
forget(_roomId: string, _deleteRoom?: boolean | undefined): Promise<{}> {
|
|
286
|
+
throw new Error('Method not implemented.');
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
isUsernameAvailable(_username: string): Promise<boolean> {
|
|
290
|
+
throw new Error('Method not implemented.');
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
leave(_roomId: string): Promise<{}> {
|
|
294
|
+
throw new Error('Method not implemented.');
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
registerRequest(
|
|
298
|
+
_data: MatrixSDK.RegisterRequest,
|
|
299
|
+
_kind?: string | undefined,
|
|
300
|
+
): Promise<MatrixSDK.RegisterResponse> {
|
|
301
|
+
throw new Error('Method not implemented.');
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
requestPasswordEmailToken(
|
|
305
|
+
_email: string,
|
|
306
|
+
_clientSecret: string,
|
|
307
|
+
_sendAttempt: number,
|
|
308
|
+
_nextLink?: string | undefined,
|
|
309
|
+
): Promise<MatrixSDK.IRequestTokenResponse> {
|
|
310
|
+
throw new Error('Method not implemented.');
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
scrollback(
|
|
314
|
+
_room: MatrixSDK.Room,
|
|
315
|
+
_limit?: number | undefined,
|
|
316
|
+
): Promise<MatrixSDK.Room> {
|
|
317
|
+
throw new Error('Method not implemented.');
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
paginateEventTimeline(
|
|
321
|
+
_timeline: MatrixSDK.EventTimeline,
|
|
322
|
+
_opts?: MatrixSDK.IPaginateOpts | undefined,
|
|
323
|
+
): Promise<boolean> {
|
|
324
|
+
throw new Error('Method not implemented.');
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
async sendReadReceipt(
|
|
328
|
+
event: MatrixSDK.MatrixEvent | null,
|
|
329
|
+
receiptType?: MatrixSDK.ReceiptType | undefined,
|
|
330
|
+
_unthreaded?: boolean | undefined,
|
|
331
|
+
): Promise<{} | undefined> {
|
|
332
|
+
if (!event) return;
|
|
333
|
+
const eventId = event.getId()!;
|
|
334
|
+
|
|
335
|
+
this.serverState.addReceiptEvent(
|
|
336
|
+
event.getRoomId()!,
|
|
337
|
+
eventId,
|
|
338
|
+
this.loggedInAs!,
|
|
339
|
+
receiptType ?? ('m.read' as MatrixSDK.ReceiptType),
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
return Promise.resolve({});
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
setPassword(
|
|
346
|
+
_authDict: MatrixSDK.AuthDict,
|
|
347
|
+
_newPassword: string,
|
|
348
|
+
_logoutDevices?: boolean | undefined,
|
|
349
|
+
): Promise<{}> {
|
|
350
|
+
throw new Error('Method not implemented.');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
setRoomName(
|
|
354
|
+
_roomId: string,
|
|
355
|
+
_name: string,
|
|
356
|
+
): Promise<MatrixSDK.ISendEventResponse> {
|
|
357
|
+
throw new Error('Method not implemented.');
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
invite(
|
|
361
|
+
roomId: string,
|
|
362
|
+
userId: string,
|
|
363
|
+
_reason?: string | undefined,
|
|
364
|
+
): Promise<{}> {
|
|
365
|
+
let sender =
|
|
366
|
+
this.loggedInAs ?? this.clientOpts.userId ?? '@test_user:localhost';
|
|
367
|
+
let timestamp = Date.now();
|
|
368
|
+
this.serverState.setRoomState(
|
|
369
|
+
sender,
|
|
370
|
+
roomId,
|
|
371
|
+
'm.room.member',
|
|
372
|
+
{
|
|
373
|
+
displayname: userId,
|
|
374
|
+
membership: 'invite',
|
|
375
|
+
membershipTs: timestamp,
|
|
376
|
+
membershipInitiator: sender,
|
|
377
|
+
},
|
|
378
|
+
userId,
|
|
379
|
+
timestamp,
|
|
380
|
+
);
|
|
381
|
+
return Promise.resolve({});
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
joinRoom(
|
|
385
|
+
_roomIdOrAlias: string,
|
|
386
|
+
_opts?: MatrixSDK.IJoinRoomOpts | undefined,
|
|
387
|
+
): Promise<MatrixSDK.Room> {
|
|
388
|
+
let userId =
|
|
389
|
+
this.loggedInAs ?? this.clientOpts.userId ?? '@test_user:localhost';
|
|
390
|
+
|
|
391
|
+
this.serverState.setRoomState(
|
|
392
|
+
userId,
|
|
393
|
+
_roomIdOrAlias,
|
|
394
|
+
'm.room.member',
|
|
395
|
+
{
|
|
396
|
+
displayname: userId,
|
|
397
|
+
membership: 'join',
|
|
398
|
+
},
|
|
399
|
+
userId,
|
|
400
|
+
);
|
|
401
|
+
if (this.slidingSyncInstance) {
|
|
402
|
+
setTimeout(() => {
|
|
403
|
+
this.slidingSyncInstance.triggerRoomSync(
|
|
404
|
+
_roomIdOrAlias,
|
|
405
|
+
'A joined room',
|
|
406
|
+
this.serverState,
|
|
407
|
+
);
|
|
408
|
+
}, 0);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return Promise.resolve({
|
|
412
|
+
roomId: _roomIdOrAlias,
|
|
413
|
+
} as unknown as MatrixSDK.Room);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
loginWithPassword(
|
|
417
|
+
_user: string,
|
|
418
|
+
_password: string,
|
|
419
|
+
): Promise<MatrixSDK.LoginResponse> {
|
|
420
|
+
throw new Error('Method not implemented.');
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
logout(_stopClient?: boolean | undefined): Promise<{}> {
|
|
424
|
+
if (_stopClient) {
|
|
425
|
+
this.stopClient();
|
|
426
|
+
}
|
|
427
|
+
this.clientOpts.userId = undefined;
|
|
428
|
+
return Promise.resolve({});
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
roomState(_roomId: string): Promise<MatrixSDK.IStateEventWithRoomId[]> {
|
|
432
|
+
throw new Error('Method not implemented.');
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
setDisplayName(name: string): Promise<{}> {
|
|
436
|
+
this.serverState.setDisplayName(name);
|
|
437
|
+
return Promise.resolve({});
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
requestEmailToken(
|
|
441
|
+
_type: 'registration' | 'threepid',
|
|
442
|
+
_email: string,
|
|
443
|
+
_clientSecret: string,
|
|
444
|
+
_sendAttempt: number,
|
|
445
|
+
): Promise<MatrixSDK.IRequestTokenResponse> {
|
|
446
|
+
throw new Error('Method not implemented.');
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
loginWithEmail(
|
|
450
|
+
_email: string,
|
|
451
|
+
_password: string,
|
|
452
|
+
): Promise<MatrixSDK.LoginResponse> {
|
|
453
|
+
throw new Error('Method not implemented.');
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
sendEvent(
|
|
457
|
+
roomId: string,
|
|
458
|
+
eventType: string,
|
|
459
|
+
content: MatrixSDK.IContent,
|
|
460
|
+
txnId?: string,
|
|
461
|
+
): Promise<MatrixSDK.ISendEventResponse>;
|
|
462
|
+
sendEvent(
|
|
463
|
+
roomId: string,
|
|
464
|
+
threadId: string | null,
|
|
465
|
+
eventType: string,
|
|
466
|
+
content: MatrixSDK.IContent,
|
|
467
|
+
txnId?: string,
|
|
468
|
+
): Promise<MatrixSDK.ISendEventResponse>;
|
|
469
|
+
async sendEvent(...args: any[]): Promise<MatrixSDK.ISendEventResponse> {
|
|
470
|
+
let roomId: string;
|
|
471
|
+
|
|
472
|
+
let eventType: any;
|
|
473
|
+
let content: MatrixSDK.IContent;
|
|
474
|
+
|
|
475
|
+
if (typeof args[2] === 'object') {
|
|
476
|
+
[roomId, eventType, content] = args;
|
|
477
|
+
} else {
|
|
478
|
+
[roomId, , eventType, content] = args;
|
|
479
|
+
}
|
|
480
|
+
let roomEvent = {
|
|
481
|
+
room_id: roomId,
|
|
482
|
+
type: eventType,
|
|
483
|
+
content,
|
|
484
|
+
status: null,
|
|
485
|
+
};
|
|
486
|
+
// Local Echo
|
|
487
|
+
let txnId = this.makeTxnId();
|
|
488
|
+
let localEventId = '~' + roomId + ':' + txnId;
|
|
489
|
+
let localEventData = {
|
|
490
|
+
...roomEvent,
|
|
491
|
+
event_id: localEventId,
|
|
492
|
+
origin_server_ts: (this.sdkOpts.now ?? Date.now)(),
|
|
493
|
+
unsigned: { age: 0 },
|
|
494
|
+
sender: this.loggedInAs || 'unknown_user',
|
|
495
|
+
user_id: this.loggedInAs || 'unknown_user',
|
|
496
|
+
state_key: roomEvent.type === 'm.room.member' ? this.loggedInAs! : '',
|
|
497
|
+
};
|
|
498
|
+
let localEvent = new MatrixEvent(localEventData);
|
|
499
|
+
localEvent.setStatus('sending' as MatrixSDK.EventStatus.SENDING);
|
|
500
|
+
this.emitEvent(localEvent);
|
|
501
|
+
if (content.body?.match(/SENDING_DELAY_THEN_/)) {
|
|
502
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if (content.body?.match(/SENDING_DELAY_THEN_FAILURE/)) {
|
|
506
|
+
console.log(
|
|
507
|
+
'SENDING_DELAY_THEN_FAILURE, setting status to NOT_SENT',
|
|
508
|
+
localEvent,
|
|
509
|
+
);
|
|
510
|
+
localEvent.setStatus(MatrixSDK.EventStatus.NOT_SENT);
|
|
511
|
+
this.emitLocalEchoUpdated(localEvent);
|
|
512
|
+
throw new Error('Failed to send event, deliberately');
|
|
513
|
+
}
|
|
514
|
+
let eventId = this.serverState.addRoomEvent(
|
|
515
|
+
this.loggedInAs || 'unknown_user',
|
|
516
|
+
roomEvent,
|
|
517
|
+
);
|
|
518
|
+
let matrixEvent = new MatrixEvent({
|
|
519
|
+
...localEventData,
|
|
520
|
+
event_id: eventId,
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
this.emitLocalEchoUpdated(matrixEvent, localEventId);
|
|
524
|
+
return { event_id: eventId };
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
getStateEvent(
|
|
528
|
+
roomId: string,
|
|
529
|
+
eventType: string,
|
|
530
|
+
stateKey: string,
|
|
531
|
+
): Promise<Record<string, any>> {
|
|
532
|
+
return Promise.resolve(
|
|
533
|
+
this.serverState.getRoomState(roomId, eventType, stateKey),
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
sendStateEvent<K extends keyof MatrixSDK.StateEvents>(
|
|
538
|
+
roomId: string,
|
|
539
|
+
eventType: K,
|
|
540
|
+
content: MatrixSDK.IContent,
|
|
541
|
+
stateKey?: string | undefined,
|
|
542
|
+
_opts?: MatrixSDK.IRequestOpts | undefined,
|
|
543
|
+
): Promise<MatrixSDK.ISendEventResponse> {
|
|
544
|
+
let eventId = this.serverState.setRoomState(
|
|
545
|
+
this.loggedInAs || 'unknown_user',
|
|
546
|
+
roomId,
|
|
547
|
+
eventType as string,
|
|
548
|
+
content,
|
|
549
|
+
stateKey,
|
|
550
|
+
);
|
|
551
|
+
return Promise.resolve({ event_id: eventId });
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
makeTxnId(): string {
|
|
555
|
+
return 'm.mock.' + this.txnCtr++;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
getRoom(roomId: string | undefined): MatrixSDK.Room | null {
|
|
559
|
+
let hit = this.serverState.rooms.find((r) => r.id === roomId);
|
|
560
|
+
if (hit) {
|
|
561
|
+
return {
|
|
562
|
+
roomId,
|
|
563
|
+
client: this,
|
|
564
|
+
myUserId: this.loggedInAs!,
|
|
565
|
+
opts: {},
|
|
566
|
+
getMember(_userId: string) {
|
|
567
|
+
return {
|
|
568
|
+
membership: 'join',
|
|
569
|
+
};
|
|
570
|
+
},
|
|
571
|
+
oldState: {},
|
|
572
|
+
getLastActiveTimestamp: () =>
|
|
573
|
+
this.serverState.getRoomEvents(roomId!).at(-1)?.origin_server_ts ?? 0,
|
|
574
|
+
getLiveTimeline: () => {
|
|
575
|
+
return {
|
|
576
|
+
getState: (_direction: MatrixSDK.Direction) =>
|
|
577
|
+
this.serverState.getRoomStateUpdatePayload(roomId!),
|
|
578
|
+
getEvents: () =>
|
|
579
|
+
this.serverState
|
|
580
|
+
.getRoomEvents(roomId!)
|
|
581
|
+
.map((e) => new MatrixEvent(e)),
|
|
582
|
+
};
|
|
583
|
+
},
|
|
584
|
+
getOrCreateFilteredTimelineSet: (
|
|
585
|
+
filter: MatrixSDK.Filter,
|
|
586
|
+
_opts = {},
|
|
587
|
+
) => {
|
|
588
|
+
return {
|
|
589
|
+
getLiveTimeline: () => ({
|
|
590
|
+
getEvents: () => [],
|
|
591
|
+
getPaginationToken: () => null,
|
|
592
|
+
setPaginationToken: () => {},
|
|
593
|
+
getNeighbouringTimeline: () => null,
|
|
594
|
+
}),
|
|
595
|
+
addLiveEvent: () => {},
|
|
596
|
+
getTimelines: () => [],
|
|
597
|
+
getFilter: () => filter,
|
|
598
|
+
setFilter: () => {},
|
|
599
|
+
getTimelineForEvent: () => null,
|
|
600
|
+
addTimeline: () => ({
|
|
601
|
+
getEvents: () => [],
|
|
602
|
+
getPaginationToken: () => null,
|
|
603
|
+
setPaginationToken: () => {},
|
|
604
|
+
getNeighbouringTimeline: () => null,
|
|
605
|
+
}),
|
|
606
|
+
addEventsToTimeline: () => {},
|
|
607
|
+
handleRemoteEcho: () => {},
|
|
608
|
+
canContain: () => true,
|
|
609
|
+
};
|
|
610
|
+
},
|
|
611
|
+
} as unknown as MatrixSDK.Room;
|
|
612
|
+
}
|
|
613
|
+
return null;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
async decryptEventIfNeeded(
|
|
617
|
+
_event: MatrixSDK.MatrixEvent,
|
|
618
|
+
_options?: MatrixSDK.IDecryptOptions | undefined,
|
|
619
|
+
): Promise<void> {}
|
|
620
|
+
|
|
621
|
+
async getJoinedRooms(): Promise<{
|
|
622
|
+
joined_rooms: string[];
|
|
623
|
+
}> {
|
|
624
|
+
return {
|
|
625
|
+
joined_rooms: this.serverState.rooms.map((r) => r.id),
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
private eventHandlerType(type: string) {
|
|
630
|
+
switch (type) {
|
|
631
|
+
case APP_BOXEL_REALMS_EVENT_TYPE:
|
|
632
|
+
case APP_BOXEL_SYSTEM_CARD_EVENT_TYPE:
|
|
633
|
+
case APP_BOXEL_WORKSPACE_FAVORITES_EVENT_TYPE:
|
|
634
|
+
case 'm.direct':
|
|
635
|
+
return this.sdk.ClientEvent.AccountData;
|
|
636
|
+
case APP_BOXEL_ROOM_SKILLS_EVENT_TYPE:
|
|
637
|
+
case APP_BOXEL_CODE_PATCH_RESULT_EVENT_TYPE:
|
|
638
|
+
case APP_BOXEL_COMMAND_RESULT_EVENT_TYPE:
|
|
639
|
+
case APP_BOXEL_DEBUG_MESSAGE_EVENT_TYPE:
|
|
640
|
+
case APP_BOXEL_ACTIVE_LLM:
|
|
641
|
+
case APP_BOXEL_REALM_EVENT_TYPE:
|
|
642
|
+
case BOT_TRIGGER_EVENT_TYPE:
|
|
643
|
+
case 'm.room.create':
|
|
644
|
+
case 'm.room.message':
|
|
645
|
+
case 'm.room.name':
|
|
646
|
+
case 'm.room.member':
|
|
647
|
+
case APP_BOXEL_LLM_MODE:
|
|
648
|
+
return this.sdk.RoomEvent.Timeline;
|
|
649
|
+
case 'm.receipt':
|
|
650
|
+
return this.sdk.RoomEvent.Receipt;
|
|
651
|
+
|
|
652
|
+
default:
|
|
653
|
+
throw new Error(`unknown type ${type} in mock`);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
private emitEvent(event: MatrixEvent) {
|
|
658
|
+
let eventType = this.eventHandlerType(event.event.type!);
|
|
659
|
+
switch (eventType) {
|
|
660
|
+
case this.sdk.RoomEvent.Timeline:
|
|
661
|
+
{
|
|
662
|
+
let handlers = this.listeners[eventType];
|
|
663
|
+
|
|
664
|
+
if (handlers) {
|
|
665
|
+
for (let handler of handlers) {
|
|
666
|
+
handler(event, undefined, undefined, false, {
|
|
667
|
+
fake: 'event-timeline ',
|
|
668
|
+
} as any);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
if (typeof event.event.state_key === 'string') {
|
|
672
|
+
let handlers = this.listeners[this.sdk.RoomStateEvent.Update];
|
|
673
|
+
if (handlers) {
|
|
674
|
+
let roomState = this.serverState.getRoomStateUpdatePayload(
|
|
675
|
+
event.event.room_id!,
|
|
676
|
+
);
|
|
677
|
+
for (let handler of handlers) {
|
|
678
|
+
handler(roomState);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
break;
|
|
684
|
+
case this.sdk.RoomEvent.Receipt:
|
|
685
|
+
{
|
|
686
|
+
let handlers = this.listeners[eventType];
|
|
687
|
+
|
|
688
|
+
if (handlers) {
|
|
689
|
+
for (let handler of handlers) {
|
|
690
|
+
handler(event, { fake: 'room ' } as any);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
break;
|
|
695
|
+
case this.sdk.ClientEvent.AccountData:
|
|
696
|
+
{
|
|
697
|
+
let handlers = this.listeners[eventType];
|
|
698
|
+
|
|
699
|
+
if (handlers) {
|
|
700
|
+
for (let handler of handlers) {
|
|
701
|
+
handler(event, undefined);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
break;
|
|
706
|
+
case null:
|
|
707
|
+
break;
|
|
708
|
+
default:
|
|
709
|
+
throw assertNever(eventType);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
private emitLocalEchoUpdated(event: MatrixEvent, oldEventId?: string) {
|
|
714
|
+
let handlers = this.listeners[this.sdk.RoomEvent.LocalEchoUpdated];
|
|
715
|
+
if (handlers) {
|
|
716
|
+
for (let handler of handlers) {
|
|
717
|
+
handler(event, { fake: 'room' } as any, oldEventId, undefined);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
on<T extends MatrixSDK.EmittedEvents | MatrixSDK.EventEmitterEvents>(
|
|
723
|
+
event: T,
|
|
724
|
+
listener: MatrixSDK.Listener<
|
|
725
|
+
MatrixSDK.EmittedEvents,
|
|
726
|
+
MatrixSDK.ClientEventHandlerMap,
|
|
727
|
+
T
|
|
728
|
+
>,
|
|
729
|
+
): MatrixSDK.MatrixClient {
|
|
730
|
+
if (!event) {
|
|
731
|
+
throw new Error(`missing event type in matrix mock`);
|
|
732
|
+
}
|
|
733
|
+
// @ts-expect-error haven't got the types right yet
|
|
734
|
+
let list = this.listeners[event];
|
|
735
|
+
if (!list) {
|
|
736
|
+
list = [];
|
|
737
|
+
// @ts-expect-error haven't got the types right yet
|
|
738
|
+
this.listeners[event] = list;
|
|
739
|
+
}
|
|
740
|
+
list.push(listener);
|
|
741
|
+
return this as unknown as MatrixSDK.MatrixClient;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
off<T extends MatrixSDK.EmittedEvents | MatrixSDK.EventEmitterEvents>(
|
|
745
|
+
event: T,
|
|
746
|
+
listener: MatrixSDK.Listener<
|
|
747
|
+
MatrixSDK.EmittedEvents,
|
|
748
|
+
MatrixSDK.ClientEventHandlerMap,
|
|
749
|
+
T
|
|
750
|
+
>,
|
|
751
|
+
): MatrixSDK.MatrixClient {
|
|
752
|
+
// @ts-expect-error haven't got the types right yet
|
|
753
|
+
let list = this.listeners[event];
|
|
754
|
+
if (!list) {
|
|
755
|
+
return this as unknown as MatrixSDK.MatrixClient;
|
|
756
|
+
}
|
|
757
|
+
let index = list.indexOf(listener as never);
|
|
758
|
+
if (index > -1) {
|
|
759
|
+
list.splice(index, 1);
|
|
760
|
+
}
|
|
761
|
+
return this as unknown as MatrixSDK.MatrixClient;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
stopClient(): void {
|
|
765
|
+
for (let stop of this.stopServerStateSubscriptions) {
|
|
766
|
+
stop();
|
|
767
|
+
}
|
|
768
|
+
this.stopServerStateSubscriptions = [];
|
|
769
|
+
this.slidingSyncInstance?.stop?.();
|
|
770
|
+
this.slidingSyncInstance = undefined;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
async setPowerLevel(
|
|
774
|
+
_roomId: string,
|
|
775
|
+
_userId: string | string[],
|
|
776
|
+
_powerLevel: number | undefined,
|
|
777
|
+
_event?: MatrixSDK.MatrixEvent | null | undefined,
|
|
778
|
+
): Promise<MatrixSDK.ISendEventResponse> {
|
|
779
|
+
return { event_id: this.serverState.eventId() };
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
async createRoom({
|
|
783
|
+
name,
|
|
784
|
+
initial_state,
|
|
785
|
+
}: MatrixSDK.ICreateRoomOpts): Promise<{ room_id: string }> {
|
|
786
|
+
let sender = this.loggedInAs || 'unknown_user';
|
|
787
|
+
let roomId = this.serverState.createRoom(sender, name);
|
|
788
|
+
|
|
789
|
+
if (initial_state) {
|
|
790
|
+
for (let event of initial_state) {
|
|
791
|
+
this.serverState.setRoomState(
|
|
792
|
+
sender,
|
|
793
|
+
roomId,
|
|
794
|
+
event.type,
|
|
795
|
+
event.content,
|
|
796
|
+
);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
if (this.slidingSyncInstance) {
|
|
801
|
+
setTimeout(() => {
|
|
802
|
+
this.slidingSyncInstance.triggerRoomSync(
|
|
803
|
+
roomId,
|
|
804
|
+
name,
|
|
805
|
+
this.serverState,
|
|
806
|
+
);
|
|
807
|
+
}, 0);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
return { room_id: roomId };
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
async getThreePids(): Promise<{ threepids: MatrixSDK.IThreepid[] }> {
|
|
814
|
+
return {
|
|
815
|
+
threepids: [
|
|
816
|
+
{
|
|
817
|
+
added_at: 0,
|
|
818
|
+
validated_at: 0,
|
|
819
|
+
address: 'testuser@example.com',
|
|
820
|
+
medium: 'email' as MatrixSDK.ThreepidMedium.Email,
|
|
821
|
+
},
|
|
822
|
+
],
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
async getProfileInfo(
|
|
827
|
+
_userId: string,
|
|
828
|
+
_info?: string | undefined,
|
|
829
|
+
): Promise<{
|
|
830
|
+
avatar_url?: string | undefined;
|
|
831
|
+
displayname?: string | undefined;
|
|
832
|
+
}> {
|
|
833
|
+
return {
|
|
834
|
+
displayname: this.serverState.displayName,
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
isLoggedIn() {
|
|
839
|
+
return Boolean(this.loggedInAs);
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
getUserId(): string | null {
|
|
843
|
+
return this.loggedInAs ?? null;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
async uploadCards(cards: CardDef[]): Promise<FileDef[]> {
|
|
847
|
+
return await this.fileDefManager.uploadCards(cards);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
async uploadCommandDefinitions(
|
|
851
|
+
commandDefinitions: CommandField[],
|
|
852
|
+
): Promise<FileDef[]> {
|
|
853
|
+
return await this.fileDefManager.uploadCommandDefinitions(
|
|
854
|
+
commandDefinitions,
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
async uploadFiles(files: FileDef[]): Promise<FileDef[]> {
|
|
859
|
+
return await this.fileDefManager.uploadFiles(files);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
async cacheContentHashIfNeeded(event: DiscreteMatrixEvent): Promise<void> {
|
|
863
|
+
await this.fileDefManager.cacheContentHashIfNeeded(event);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
async recacheContentHash(contentHash: string, url: string): Promise<void> {
|
|
867
|
+
const canonicalKey = canonicalizeMatrixMediaKey(url) || url;
|
|
868
|
+
if (this.fileDefManager.invalidUrlCache.has(canonicalKey)) {
|
|
869
|
+
// Skipping re-caching for this url as it was previously checked and is invalid
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
let normalizedUrl = url;
|
|
874
|
+
if (canonicalKey.startsWith('mxc://')) {
|
|
875
|
+
normalizedUrl = this.mxcUrlToHttp(canonicalKey);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
let contentArrayBuffer =
|
|
879
|
+
this.serverState.getContent(normalizedUrl) ||
|
|
880
|
+
this.serverState.getContent(url);
|
|
881
|
+
if (!contentArrayBuffer) {
|
|
882
|
+
throw new Error('No content found for URL: ' + url);
|
|
883
|
+
}
|
|
884
|
+
let content = new Uint8Array(contentArrayBuffer);
|
|
885
|
+
const fetchedContentHash =
|
|
886
|
+
await this.fileDefManager.getContentHash(content);
|
|
887
|
+
if (fetchedContentHash !== contentHash) {
|
|
888
|
+
console.warn(
|
|
889
|
+
`Content hash mismatch for URL: ${url}, skipping re-caching step`,
|
|
890
|
+
);
|
|
891
|
+
this.fileDefManager.invalidUrlCache.add(canonicalKey);
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// Update the cache with the canonical matrix media URL when possible.
|
|
896
|
+
this.fileDefManager.contentHashCache.set(contentHash, normalizedUrl);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
async prefetchFileContent(file: FileDef): Promise<void> {
|
|
900
|
+
return await this.fileDefManager.prefetchFileContent(file);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
async prefetchLocalFileContent(
|
|
904
|
+
file: FileDef,
|
|
905
|
+
bytes: Uint8Array,
|
|
906
|
+
contentType: string,
|
|
907
|
+
): Promise<void> {
|
|
908
|
+
return await this.fileDefManager.prefetchLocalFileContent(
|
|
909
|
+
file,
|
|
910
|
+
bytes,
|
|
911
|
+
contentType,
|
|
912
|
+
);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
clearPrefetchedContent(): void {
|
|
916
|
+
this.fileDefManager.clearPrefetchedContent();
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
async uploadContent(
|
|
920
|
+
file: XMLHttpRequestBodyInit,
|
|
921
|
+
_opts?: MatrixSDK.UploadOpts,
|
|
922
|
+
): Promise<MatrixSDK.UploadResponse> {
|
|
923
|
+
if (this.sdkOpts.uploadContentInterceptor) {
|
|
924
|
+
await this.sdkOpts.uploadContentInterceptor();
|
|
925
|
+
}
|
|
926
|
+
let contentUri = `mxc://mock-server/${Math.random()}`;
|
|
927
|
+
let buffer: ArrayBuffer;
|
|
928
|
+
if (file instanceof Uint8Array) {
|
|
929
|
+
buffer = (file.buffer as ArrayBuffer).slice(
|
|
930
|
+
file.byteOffset,
|
|
931
|
+
file.byteOffset + file.byteLength,
|
|
932
|
+
);
|
|
933
|
+
} else if (file instanceof ArrayBuffer) {
|
|
934
|
+
buffer = file;
|
|
935
|
+
} else if (typeof file === 'string') {
|
|
936
|
+
buffer = new TextEncoder().encode(file).buffer as ArrayBuffer;
|
|
937
|
+
} else {
|
|
938
|
+
throw new Error(
|
|
939
|
+
`MockClient.uploadContent: unsupported file type ${typeof file}`,
|
|
940
|
+
);
|
|
941
|
+
}
|
|
942
|
+
this.serverState.addContent(this.mxcUrlToHttp(contentUri), buffer);
|
|
943
|
+
return { content_uri: contentUri };
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
async downloadCardFileDef(
|
|
947
|
+
serializedFile: SerializedFile,
|
|
948
|
+
): Promise<LooseSingleCardDocument> {
|
|
949
|
+
let content = this.serverState.getContent(serializedFile.url);
|
|
950
|
+
if (!content) {
|
|
951
|
+
throw new Error(`content not found for ${serializedFile.url}`);
|
|
952
|
+
}
|
|
953
|
+
let text = new TextDecoder().decode(content);
|
|
954
|
+
return JSON.parse(text) as LooseSingleCardDocument;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
async downloadAsFileInBrowser(
|
|
958
|
+
_serializedFile: SerializedFile,
|
|
959
|
+
): Promise<void> {
|
|
960
|
+
throw new Error('Method not implemented: downloadAsFileInBrowser');
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
mxcUrlToHttp(mxcUrl: string): string {
|
|
964
|
+
// Produce URLs that include /_matrix/media/ so they are recognized as
|
|
965
|
+
// Matrix media URLs by isMatrixMediaUrl and canonicalizeMatrixMediaKey.
|
|
966
|
+
// mxc://mock-server/id → http://mock-server/_matrix/media/v3/download/mock-server/id
|
|
967
|
+
let [serverName, ...rest] = mxcUrl.replace('mxc://', '').split('/');
|
|
968
|
+
let mediaId = rest.join('/');
|
|
969
|
+
return `http://mock-server/_matrix/media/v3/download/${serverName}/${mediaId}`;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
async slidingSync(
|
|
973
|
+
req: MSC3575SlidingSyncRequest,
|
|
974
|
+
_proxyBaseUrl: string,
|
|
975
|
+
_signal: AbortSignal,
|
|
976
|
+
): Promise<MSC3575SlidingSyncResponse> {
|
|
977
|
+
let lists: MSC3575SlidingSyncResponse['lists'] = {};
|
|
978
|
+
let rooms: MSC3575SlidingSyncResponse['rooms'] = {};
|
|
979
|
+
for (const [listKey, list] of Object.entries(req.lists || {})) {
|
|
980
|
+
for (let i = 0; i < list.ranges.length; i++) {
|
|
981
|
+
let [start, end] = list.ranges[i];
|
|
982
|
+
//currently we only filter rooms using is_dm
|
|
983
|
+
let dmRooms = (await this.getAccountDataFromServer('m.direct')) ?? {};
|
|
984
|
+
let roomsInRange = this.serverState.rooms
|
|
985
|
+
.filter((r) =>
|
|
986
|
+
list.filters?.is_dm
|
|
987
|
+
? dmRooms[this.loggedInAs!]?.includes(r.id)
|
|
988
|
+
: !dmRooms[this.loggedInAs!]?.includes(r.id),
|
|
989
|
+
)
|
|
990
|
+
.slice(start, end + 1);
|
|
991
|
+
|
|
992
|
+
for (let j = 0; j < roomsInRange.length; j++) {
|
|
993
|
+
let room = roomsInRange[j];
|
|
994
|
+
let timeline = this.serverState.getRoomEvents(room.id);
|
|
995
|
+
rooms[room.id] = {
|
|
996
|
+
name:
|
|
997
|
+
this.serverState.getRoomState(room.id, 'm.room.name', '')?.content
|
|
998
|
+
?.name ?? 'room',
|
|
999
|
+
required_state: [],
|
|
1000
|
+
timeline,
|
|
1001
|
+
notification_count: 0,
|
|
1002
|
+
highlight_count: 0,
|
|
1003
|
+
joined_count: 1,
|
|
1004
|
+
invited_count: 0,
|
|
1005
|
+
initial: true,
|
|
1006
|
+
};
|
|
1007
|
+
for (let k = 0; k < timeline.length; k++) {
|
|
1008
|
+
let event = timeline[k];
|
|
1009
|
+
this.emitEvent(new MatrixEvent(event));
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
lists[listKey] = {
|
|
1014
|
+
count: roomsInRange.length,
|
|
1015
|
+
ops: [
|
|
1016
|
+
{
|
|
1017
|
+
op: 'SYNC',
|
|
1018
|
+
room_ids: roomsInRange.map((r) => r.id),
|
|
1019
|
+
},
|
|
1020
|
+
],
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
let response: MSC3575SlidingSyncResponse = {
|
|
1026
|
+
pos: String(Date.now()),
|
|
1027
|
+
lists,
|
|
1028
|
+
rooms,
|
|
1029
|
+
extensions: {},
|
|
1030
|
+
};
|
|
1031
|
+
|
|
1032
|
+
return Promise.resolve(response);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
getDeviceId(): string | null {
|
|
1036
|
+
return null;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
getDevice(deviceId: string): Promise<MatrixSDK.IMyDevice> {
|
|
1040
|
+
throw new Error(`Method not implemented: getDevice ${deviceId}`);
|
|
1041
|
+
}
|
|
1042
|
+
}
|