@marimo-team/islands 0.25.1-dev4 → 0.25.1-dev40
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/dist/{ConnectedDataExplorerComponent-KVhjDMSe.js → ConnectedDataExplorerComponent-CwMXfDQR.js} +3 -3
- package/dist/{ErrorBoundary-pV36lYEK.js → ErrorBoundary-CAJO-M56.js} +1 -1
- package/dist/{ImageComparisonComponent-Dlm5aWnH.js → ImageComparisonComponent-Cpfz30OZ.js} +51 -52
- package/dist/{abnfDiagram-VCTEODGH-CpN0FRda.js → abnfDiagram-VCTEODGH-AFhOQTt8.js} +3 -3
- package/dist/{architectureDiagram-5GKGNRK7-DDyj5SRB.js → architectureDiagram-5GKGNRK7-BngksAAQ.js} +5 -5
- package/dist/{blockDiagram-I7D4REHJ-BbXEXJRu.js → blockDiagram-I7D4REHJ-CvBmppdy.js} +9 -9
- package/dist/{c4Diagram-7LVT6UL2-DcLsbQmR.js → c4Diagram-7LVT6UL2-EceL4_jH.js} +7 -7
- package/dist/{cells-B5-y5EY3.js → cells-Cv93oav_.js} +3 -3
- package/dist/{channel-B5XnTarr.js → channel-z7HZXHwv.js} +1 -1
- package/dist/{chat-ui-HJZsTl7o.js → chat-ui-DLSF8a04.js} +4 -4
- package/dist/{chunk-4HAMMTFA-D2qv8E0X.js → chunk-4HAMMTFA-BPTTOOC5.js} +5 -5
- package/dist/{chunk-75Z2AOVW-5_HsvXwr.js → chunk-75Z2AOVW-C4AOleKf.js} +1 -1
- package/dist/{chunk-DU6HZSFF-BUgAHvnM.js → chunk-DU6HZSFF-1TwWR6gh.js} +1 -1
- package/dist/{chunk-F27PBJKO-DHmYWZXr.js → chunk-F27PBJKO-DMI1PBe4.js} +1 -1
- package/dist/{chunk-GMAD6QVW-Czynz8aA.js → chunk-GMAD6QVW-vStrMz2P.js} +3 -3
- package/dist/{chunk-GVQU2GXP-yQEdulRS.js → chunk-GVQU2GXP-2HwWgs4u.js} +2 -2
- package/dist/{chunk-IMKFNOWR-BfwTebD0.js → chunk-IMKFNOWR-UOVZuZVn.js} +5 -5
- package/dist/{chunk-L3NEJ4N5-DwRWnDDK.js → chunk-L3NEJ4N5-RhC7i0I2.js} +5 -5
- package/dist/{chunk-OSK3NFVY-BBKU_Ign.js → chunk-OSK3NFVY-CZV09N-U.js} +6 -6
- package/dist/{chunk-P2QGCYS3-C0iGU29N.js → chunk-P2QGCYS3-0TAWai9C.js} +1 -1
- package/dist/{chunk-POPQ4Y6H-BCbS3Ozc.js → chunk-POPQ4Y6H-Cc3_56GX.js} +1 -1
- package/dist/{chunk-PWAF6VOD-CTFCL0jI.js → chunk-PWAF6VOD-lNxB9k8z.js} +1 -1
- package/dist/{chunk-SHT3W25Y-BspJEJ5H.js → chunk-SHT3W25Y-CrEPyWy1.js} +7 -7
- package/dist/{chunk-SVP7TREG-DX3rFNTe.js → chunk-SVP7TREG-uIyyySp6.js} +2 -2
- package/dist/{chunk-TICWLB2K-fVF7Uujg.js → chunk-TICWLB2K-DdXM3eg6.js} +5 -5
- package/dist/classDiagram-ZZMXUADV-BiATbBE4.js +30 -0
- package/dist/classDiagram-v2-VYDZK3BY-JnH97GYw.js +30 -0
- package/dist/{code-visibility-CgZS2a3W.js → code-visibility-XU9RAJNV.js} +2 -2
- package/dist/{common-DnMDPPaW.js → common-C0fbrgB8.js} +13 -13
- package/dist/{cynefinDiagram-5FMLGOSQ-CFQrqzSX.js → cynefinDiagram-5FMLGOSQ-zknaAsGy.js} +3 -3
- package/dist/{dagre-GXQ25YYZ-xHNAUTyG.js → dagre-GXQ25YYZ-BhMOoMGJ.js} +10 -10
- package/dist/{data-grid-overlay-editor-hHYgD_Sm.js → data-grid-overlay-editor-BnhbJgoq.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-Bt1rPbAx.js → diagram-S7CK7UJ4-V5-Z-EDY.js} +4 -4
- package/dist/{diagram-UQ7AKVKN-D1sq5FoZ.js → diagram-UQ7AKVKN-qw8AjDal.js} +3 -3
- package/dist/{diagram-VSXAHHWV-BKpmG23x.js → diagram-VSXAHHWV-CR7BJygZ.js} +2 -2
- package/dist/{diagram-VX7I27RA-BMwGFVD6.js → diagram-VX7I27RA-DfuqFb1E.js} +5 -5
- package/dist/{diagram-Z3DM3KII--KLDR9Pl.js → diagram-Z3DM3KII-DpWwlYZB.js} +3 -3
- package/dist/{dist-BaHjhkpZ.js → dist-CcyKTBTF.js} +1 -1
- package/dist/{ebnfDiagram-PWID7BFC-WnG4cvSQ.js → ebnfDiagram-PWID7BFC-C20OnNMZ.js} +3 -3
- package/dist/{erDiagram-RLTQ6QDP-DhzKiYHc.js → erDiagram-RLTQ6QDP-DBXLWO9v.js} +12 -12
- package/dist/{error-entries-Bkbpx0T0.js → error-entries-DLl0XqoW.js} +1 -1
- package/dist/{feedback-button-CvKssdG_.js → feedback-button-B0QSkbSp.js} +4 -4
- package/dist/flowDiagram-HODETNUW-DL52nMkt.js +16 -0
- package/dist/{formats-C8rLgZT9.js → formats-Cl_67ghI.js} +1 -1
- package/dist/{ganttDiagram-EL5Y4UJY-DbzEBLbl.js → ganttDiagram-EL5Y4UJY-cRRaDt88.js} +2 -2
- package/dist/{gitGraphDiagram-WWUBYQGX-BMf0iKi1.js → gitGraphDiagram-WWUBYQGX-Pox5k9-Y.js} +2 -2
- package/dist/{glide-data-editor-Ohetlgag.js → glide-data-editor-ymIQdwrb.js} +3 -3
- package/dist/{globals-CPNNcOJI.js → globals-B0S3-e_D.js} +1 -1
- package/dist/{html-to-image-BAgJOlSW.js → html-to-image-CGVgroef.js} +2 -2
- package/dist/{infoDiagram-27XIBGKW-BagtCX_5.js → infoDiagram-27XIBGKW-ntpxMfrq.js} +2 -2
- package/dist/{ishikawaDiagram-5VMMS53U-DByDehYy.js → ishikawaDiagram-5VMMS53U-BllIlHE5.js} +3 -3
- package/dist/{journeyDiagram-3NMN7TZE-D2LcKDUO.js → journeyDiagram-3NMN7TZE-EPJDPlt0.js} +2 -2
- package/dist/{kanban-definition-UXKFOSKX-BxwkbBI_.js → kanban-definition-UXKFOSKX-GYtNMjtS.js} +9 -9
- package/dist/{katex-C6D4cX_N.js → katex-BNCmKUol.js} +983 -1120
- package/dist/{loader-D2W4oM-3.js → loader-DEZSzvma.js} +253 -248
- package/dist/main.js +72 -69
- package/dist/{mermaid-DPNuhemn.js → mermaid-Dnzoxjt1.js} +49 -49
- package/dist/{mhchem-DWCF06w9.js → mhchem-BEc7A1or.js} +1 -1
- package/dist/{mindmap-definition-YA3MSWOX-Cgvojw3y.js → mindmap-definition-YA3MSWOX-Cth76xgH.js} +11 -11
- package/dist/{number-overlay-editor-CHWg5gGO.js → number-overlay-editor-DB3HJDI1.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-DahHhYyN.js → pegDiagram-XKGWAZYB-Cu4uOXii.js} +3 -3
- package/dist/{pieDiagram-E7YTZNPT-CCtX0oCK.js → pieDiagram-E7YTZNPT-Bh3eDa9s.js} +3 -3
- package/dist/{process-output-zDX4jbhd.js → process-output-CGfg-JmZ.js} +2 -2
- package/dist/{quadrantDiagram-AXDQQJYC-DftINo6g.js → quadrantDiagram-AXDQQJYC--kqzFC3w.js} +1 -1
- package/dist/{railroadDiagram-O6MQD6OU-Du5NsPUb.js → railroadDiagram-O6MQD6OU-DG-M6Rnc.js} +3 -3
- package/dist/{react-vega-5AcMW8gG.js → react-vega-ewj7q_U5.js} +1 -1
- package/dist/{requirementDiagram-BXWQKSXE-0pmmxL6_.js → requirementDiagram-BXWQKSXE-DCwsThh0.js} +11 -11
- package/dist/{reveal-component-BujcZI2B.js → reveal-component-CfTzIkA2.js} +3 -3
- package/dist/{sankeyDiagram-P5KCCOFB-CDKR5TJH.js → sankeyDiagram-P5KCCOFB-BdzhT0BM.js} +1 -1
- package/dist/{sequenceDiagram-WJ2MYXX4-DB-ChWwU.js → sequenceDiagram-WJ2MYXX4-CbXB1_PU.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-orN6AwMx.js → stateDiagram-D77RDMKH-A-Zf3Sb2.js} +13 -13
- package/dist/stateDiagram-v2-MP3YSRHH-D9YMnUGx.js +30 -0
- package/dist/style.css +1 -1
- package/dist/{swimlanes-42K2YHIH-BkSDcqDT.js → swimlanes-42K2YHIH-B_pMf0J4.js} +10 -10
- package/dist/swimlanesDiagram-VR7AAH4N-Ctgy-yGP.js +30 -0
- package/dist/{timeline-definition-24CTP7MA-BuqJUIRZ.js → timeline-definition-24CTP7MA-DTXFjTTM.js} +3 -3
- package/dist/{vega-component-CNf5gcrm.js → vega-component-tFOzgarw.js} +4 -4
- package/dist/{vega-embed-container-CbnTccZi.js → vega-embed-container-sSR5hAsy.js} +2 -2
- package/dist/{vega-loader.browser-D95WfUcj.js → vega-loader.browser-DNST6uVf.js} +2 -2
- package/dist/{vennDiagram-4TSXK5OY-CTUlJ2PK.js → vennDiagram-4TSXK5OY-BPHjZo0R.js} +3 -3
- package/dist/{wardleyDiagram-VM6X3IG4-3evLUb0M.js → wardleyDiagram-VM6X3IG4-6fTLYBuD.js} +3 -3
- package/dist/{xychartDiagram-S5SC5T6Z-DL2E3K8-.js → xychartDiagram-S5SC5T6Z-BYjwjrzE.js} +5 -5
- package/package.json +1 -2
- package/src/__mocks__/common.ts +3 -3
- package/src/__tests__/CellStatus.test.tsx +1 -1
- package/src/__tests__/setup.ts +7 -7
- package/src/components/app-config/ai-config.tsx +2 -0
- package/src/components/app-config/optional-features.tsx +1 -1
- package/src/components/chat/chat-panel.tsx +19 -8
- package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +286 -0
- package/src/components/data-table/charts/charts.tsx +26 -13
- package/src/components/data-table/column-summary/chart-spec-model.tsx +4 -4
- package/src/components/dependency-graph/elements.ts +2 -2
- package/src/components/editor/__tests__/package-alert.test.tsx +140 -0
- package/src/components/editor/actions/__tests__/pair-with-agent.test.tsx +107 -0
- package/src/components/editor/actions/pair-with-agent.tsx +119 -0
- package/src/components/editor/actions/useNotebookActions.tsx +2 -1
- package/src/components/editor/ai/add-cell-with-ai.tsx +2 -0
- package/src/components/editor/ai/staged-cell-submission.ts +2 -2
- package/src/components/editor/ai/transport/chat-transport.tsx +1 -1
- package/src/components/editor/chrome/components/contribute-snippet-button.tsx +6 -1
- package/src/components/editor/connections/database/as-code.ts +44 -44
- package/src/components/editor/connections/storage/as-code.ts +3 -3
- package/src/components/editor/file-tree/requesting-tree.tsx +16 -13
- package/src/components/editor/navigation/clipboard.ts +2 -2
- package/src/components/editor/notebook-cell.tsx +2 -2
- package/src/components/editor/output/MarimoTracebackOutput.tsx +1 -1
- package/src/components/editor/output/VideoOutput.tsx +1 -1
- package/src/components/editor/output/ansi-reduce.ts +21 -17
- package/src/components/editor/output/console/ConsoleOutput.tsx +3 -3
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +59 -0
- package/src/components/editor/output/console/text-rendering.tsx +3 -1
- package/src/components/editor/package-alert.tsx +20 -7
- package/src/components/home/components.tsx +1 -0
- package/src/components/pages/run-page.tsx +1 -0
- package/src/components/slides/__tests__/minimap-actions.test.tsx +7 -7
- package/src/components/slides/__tests__/minimap.test.ts +12 -12
- package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +8 -8
- package/src/components/static-html/share-modal.tsx +2 -1
- package/src/components/static-html/static-banner.tsx +2 -2
- package/src/components/ui/links.tsx +6 -1
- package/src/components/ui/typography.tsx +16 -8
- package/src/core/ai/context/__tests__/registry.test.ts +31 -28
- package/src/core/ai/context/providers/cell-output.ts +8 -8
- package/src/core/ai/context/providers/datasource.ts +10 -7
- package/src/core/ai/context/providers/error.ts +7 -7
- package/src/core/ai/context/providers/file.ts +8 -8
- package/src/core/ai/context/providers/tables.ts +7 -7
- package/src/core/ai/context/providers/variable.ts +7 -7
- package/src/core/ai/context/registry.ts +18 -18
- package/src/core/ai/ids/ids.ts +5 -5
- package/src/core/ai/model-registry.ts +12 -9
- package/src/core/ai/staged-cells.ts +6 -6
- package/src/core/ai/tools/base.ts +6 -6
- package/src/core/ai/tools/edit-notebook-tool.ts +6 -6
- package/src/core/ai/tools/registry.ts +4 -4
- package/src/core/ai/tools/run-cells-tool.ts +7 -7
- package/src/core/ai/tools/sample-tool.ts +6 -6
- package/src/core/cells/__tests__/cells.test.ts +27 -0
- package/src/core/cells/cells.ts +2 -1
- package/src/core/codemirror/cells/debugger-decorations.ts +13 -7
- package/src/core/codemirror/cells/line-timing-decorations.ts +9 -9
- package/src/core/codemirror/cells/traceback-decorations.ts +7 -4
- package/src/core/codemirror/code-lens/extension.ts +13 -13
- package/src/core/codemirror/copilot/__tests__/language-server.test.ts +6 -6
- package/src/core/codemirror/copilot/__tests__/transport.test.ts +12 -12
- package/src/core/codemirror/copilot/language-server.ts +13 -13
- package/src/core/codemirror/copilot/transport.ts +1 -1
- package/src/core/codemirror/find-replace/search-highlight.ts +5 -5
- package/src/core/codemirror/go-to-definition/underline.ts +3 -3
- package/src/core/codemirror/keymaps/vim.ts +3 -3
- package/src/core/codemirror/language/languages/markdown.ts +8 -8
- package/src/core/codemirror/language/languages/python.ts +7 -7
- package/src/core/codemirror/language/languages/sql/completion-builder.ts +5 -5
- package/src/core/codemirror/language/languages/sql/completion-store.ts +4 -4
- package/src/core/codemirror/language/languages/sql/sql.ts +21 -21
- package/src/core/codemirror/lsp/__tests__/transports.test.ts +10 -10
- package/src/core/codemirror/lsp/federated-lsp.ts +29 -27
- package/src/core/codemirror/lsp/notebook-lsp.ts +21 -21
- package/src/core/codemirror/misc/__tests__/dnd.test.ts +10 -10
- package/src/core/codemirror/misc/__tests__/paste.test.ts +7 -4
- package/src/core/codemirror/reactive-references/extension.ts +3 -3
- package/src/core/codemirror/rtc/loro/awareness.ts +12 -12
- package/src/core/codemirror/rtc/loro/sync.ts +5 -5
- package/src/core/codemirror/vim/cursor-visibility.ts +3 -3
- package/src/core/dom/ui-element.ts +5 -5
- package/src/core/dom/uiregistry.ts +10 -10
- package/src/core/hotkeys/hotkeys.ts +9 -9
- package/src/core/islands/__tests__/bridge.test.ts +4 -4
- package/src/core/islands/__tests__/test-utils.tsx +4 -4
- package/src/core/islands/bridge.ts +85 -82
- package/src/core/islands/components/web-components.tsx +7 -7
- package/src/core/islands/worker/__tests__/controller.test.ts +1 -1
- package/src/core/islands/worker/controller.ts +6 -3
- package/src/core/islands/worker-factory.ts +2 -2
- package/src/core/kernel/RuntimeState.ts +4 -4
- package/src/core/lsp/__tests__/transport.test.ts +19 -19
- package/src/core/lsp/transport.ts +5 -5
- package/src/core/network/CachingRequestRegistry.ts +2 -2
- package/src/core/network/DeferredRequestRegistry.ts +4 -4
- package/src/core/runtime/runtime.ts +25 -20
- package/src/core/static/virtual-file-tracker.ts +5 -5
- package/src/core/wasm/__tests__/bridge.test.ts +2 -2
- package/src/core/wasm/bridge.ts +130 -126
- package/src/core/wasm/router.ts +5 -5
- package/src/core/wasm/store.ts +4 -4
- package/src/core/wasm/worker/bootstrap.ts +8 -5
- package/src/core/wasm/worker/message-buffer.ts +3 -3
- package/src/core/websocket/transports/__tests__/ws.test.ts +8 -8
- package/src/core/websocket/transports/basic.ts +15 -8
- package/src/core/websocket/transports/sse.ts +7 -7
- package/src/core/websocket/transports/transport.ts +3 -3
- package/src/core/websocket/transports/ws.ts +9 -7
- package/src/css/globals.css +18 -21
- package/src/css/katex.min.css +260 -241
- package/src/hooks/__tests__/useOverflowDetection.test.tsx +5 -5
- package/src/hooks/__tests__/useResizeObserver.test.tsx +12 -12
- package/src/plugins/core/registerReactComponent.tsx +5 -5
- package/src/plugins/core/sidebar-element.tsx +2 -2
- package/src/plugins/impl/ButtonPlugin.tsx +3 -3
- package/src/plugins/impl/CheckboxPlugin.tsx +3 -3
- package/src/plugins/impl/CodeEditorPlugin.tsx +3 -3
- package/src/plugins/impl/DatePickerPlugin.tsx +3 -3
- package/src/plugins/impl/DateRangePlugin.tsx +3 -3
- package/src/plugins/impl/DateTimePickerPlugin.tsx +3 -3
- package/src/plugins/impl/DictPlugin.tsx +3 -3
- package/src/plugins/impl/DropdownPlugin.tsx +3 -3
- package/src/plugins/impl/FileUploadPlugin.tsx +3 -3
- package/src/plugins/impl/MatrixPlugin.tsx +4 -4
- package/src/plugins/impl/MicrophonePlugin.tsx +3 -3
- package/src/plugins/impl/MultiselectPlugin.tsx +3 -3
- package/src/plugins/impl/NumberPlugin.tsx +3 -3
- package/src/plugins/impl/RadioPlugin.tsx +9 -5
- package/src/plugins/impl/RangeSliderPlugin.tsx +3 -3
- package/src/plugins/impl/RefreshPlugin.tsx +3 -3
- package/src/plugins/impl/SliderPlugin.tsx +3 -3
- package/src/plugins/impl/SwitchPlugin.tsx +3 -3
- package/src/plugins/impl/TabsPlugin.tsx +3 -3
- package/src/plugins/impl/TextAreaPlugin.tsx +3 -3
- package/src/plugins/impl/TextInputPlugin.tsx +3 -3
- package/src/plugins/impl/__tests__/MatrixPlugin.test.tsx +2 -2
- package/src/plugins/impl/anywidget/model.ts +10 -10
- package/src/plugins/impl/anywidget/registry.ts +12 -9
- package/src/plugins/impl/anywidget/runtime.ts +11 -9
- package/src/plugins/impl/anywidget/widget-binding.ts +6 -6
- package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +7 -6
- package/src/plugins/impl/matplotlib/MatplotlibPlugin.tsx +3 -3
- package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +2 -2
- package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +2 -2
- package/src/plugins/impl/mpl-interactive/mpl-websocket-shim.ts +10 -10
- package/src/plugins/impl/panel/utils.ts +5 -5
- package/src/plugins/impl/plotly/PlotlyPlugin.tsx +3 -3
- package/src/plugins/impl/vega/VegaPlugin.tsx +3 -3
- package/src/plugins/impl/vega/__tests__/use-vega-container-remeasure.test.ts +7 -7
- package/src/plugins/impl/vega/__tests__/utils.test.ts +16 -1
- package/src/plugins/impl/vega/__tests__/vega.test.ts +37 -0
- package/src/plugins/impl/vega/loader.ts +23 -1
- package/src/plugins/impl/vega/utils.ts +5 -4
- package/src/plugins/layout/AccordionPlugin.tsx +3 -3
- package/src/plugins/layout/CalloutPlugin.tsx +3 -3
- package/src/plugins/layout/ImageComparisonPlugin.tsx +5 -3
- package/src/plugins/layout/JsonOutputPlugin.tsx +3 -3
- package/src/plugins/layout/MimeRenderPlugin.tsx +3 -3
- package/src/plugins/layout/NavigationMenuPlugin.tsx +3 -3
- package/src/plugins/layout/OutlinePlugin.tsx +3 -3
- package/src/plugins/layout/ProgressPlugin.tsx +3 -3
- package/src/plugins/layout/RoutesPlugin.tsx +6 -8
- package/src/plugins/layout/StatPlugin.tsx +3 -3
- package/src/plugins/layout/TexPlugin.tsx +3 -3
- package/src/plugins/layout/carousel/CarouselPlugin.tsx +4 -4
- package/src/plugins/layout/mermaid/MermaidPlugin.tsx +3 -3
- package/src/utils/Deferred.ts +6 -6
- package/src/utils/async-capture-tracker.ts +10 -7
- package/src/utils/errors.ts +5 -5
- package/src/utils/id-tree.tsx +83 -80
- package/src/utils/lru.ts +1 -1
- package/src/utils/multi-map.ts +14 -12
- package/src/utils/paths.ts +6 -6
- package/src/utils/pluralize.ts +3 -3
- package/src/utils/progress.ts +6 -6
- package/src/utils/python-poet/poet.ts +14 -14
- package/src/utils/routes.ts +4 -2
- package/src/utils/semaphore.ts +6 -6
- package/src/utils/storage/storage.ts +6 -6
- package/src/utils/storage/typed.ts +16 -12
- package/src/utils/time.ts +9 -9
- package/src/utils/timed-cache.ts +4 -4
- package/src/utils/tracer.ts +9 -6
- package/dist/classDiagram-ZZMXUADV-Fe-V14Sc.js +0 -30
- package/dist/classDiagram-v2-VYDZK3BY-xTDg7lOs.js +0 -30
- package/dist/flowDiagram-HODETNUW-6dMdB8pR.js +0 -16
- package/dist/katex-DFBiSucW.js +0 -21840
- package/dist/stateDiagram-v2-MP3YSRHH-o05_rJN8.js +0 -30
- package/dist/swimlanesDiagram-VR7AAH4N-D_nFQfRc.js +0 -30
package/src/utils/multi-map.ts
CHANGED
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
export class MultiMap<K, V> {
|
|
7
7
|
private map = new Map<K, V[]>();
|
|
8
8
|
|
|
9
|
-
get(key: K): V[] {
|
|
9
|
+
public get(key: K): V[] {
|
|
10
10
|
return this.map.get(key) ?? [];
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
set(key: K, values: V[]): void {
|
|
13
|
+
public set(key: K, values: V[]): void {
|
|
14
14
|
this.map.set(key, values);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
add(key: K, value: V): void {
|
|
17
|
+
public add(key: K, value: V): void {
|
|
18
18
|
if (this.map.has(key)) {
|
|
19
19
|
// oxlint-disable-next-line typescript/no-non-null-assertion
|
|
20
20
|
this.map.get(key)!.push(value);
|
|
@@ -23,38 +23,40 @@ export class MultiMap<K, V> {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
has(key: K): boolean {
|
|
26
|
+
public has(key: K): boolean {
|
|
27
27
|
return this.map.has(key);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
delete(key: K): boolean {
|
|
30
|
+
public delete(key: K): boolean {
|
|
31
31
|
return this.map.delete(key);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
clear(): void {
|
|
34
|
+
public clear(): void {
|
|
35
35
|
this.map.clear();
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
keys(): IterableIterator<K> {
|
|
38
|
+
public keys(): IterableIterator<K> {
|
|
39
39
|
return this.map.keys();
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
values(): IterableIterator<V[]> {
|
|
42
|
+
public values(): IterableIterator<V[]> {
|
|
43
43
|
return this.map.values();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
entries(): IterableIterator<[K, V[]]> {
|
|
46
|
+
public entries(): IterableIterator<[K, V[]]> {
|
|
47
47
|
return this.map.entries();
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
forEach(
|
|
50
|
+
public forEach(
|
|
51
|
+
callback: (values: V[], key: K, map: Map<K, V[]>) => void,
|
|
52
|
+
): void {
|
|
51
53
|
this.map.forEach(callback);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
/**
|
|
55
57
|
* Flatten all values into a single array.
|
|
56
58
|
*/
|
|
57
|
-
flatValues(): V[] {
|
|
59
|
+
public flatValues(): V[] {
|
|
58
60
|
const result: V[] = [];
|
|
59
61
|
for (const arr of this.map.values()) {
|
|
60
62
|
result.push(...arr);
|
|
@@ -65,7 +67,7 @@ export class MultiMap<K, V> {
|
|
|
65
67
|
/**
|
|
66
68
|
* Number of keys in the MultiMap.
|
|
67
69
|
*/
|
|
68
|
-
get size(): number {
|
|
70
|
+
public get size(): number {
|
|
69
71
|
return this.map.size;
|
|
70
72
|
}
|
|
71
73
|
}
|
package/src/utils/paths.ts
CHANGED
|
@@ -41,24 +41,24 @@ export const Paths = {
|
|
|
41
41
|
|
|
42
42
|
export class PathBuilder {
|
|
43
43
|
public readonly deliminator: string;
|
|
44
|
-
constructor(deliminator: "/" | "\\") {
|
|
44
|
+
public constructor(deliminator: "/" | "\\") {
|
|
45
45
|
this.deliminator = deliminator;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
static guessDeliminator(path: string): PathBuilder {
|
|
48
|
+
public static guessDeliminator(path: string): PathBuilder {
|
|
49
49
|
return path.includes("/") ? new PathBuilder("/") : new PathBuilder("\\");
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
join(...paths: string[]): FilePath {
|
|
52
|
+
public join(...paths: string[]): FilePath {
|
|
53
53
|
return paths.filter(Boolean).join(this.deliminator) as FilePath;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
basename(path: FilePath): FilePath {
|
|
56
|
+
public basename(path: FilePath): FilePath {
|
|
57
57
|
const parts = path.split(this.deliminator);
|
|
58
58
|
return (parts.pop() ?? "") as FilePath;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
rest(path: FilePath, root: FilePath): FilePath {
|
|
61
|
+
public rest(path: FilePath, root: FilePath): FilePath {
|
|
62
62
|
const pathParts = path.split(this.deliminator);
|
|
63
63
|
const rootParts = root.split(this.deliminator);
|
|
64
64
|
let i = 0;
|
|
@@ -70,7 +70,7 @@ export class PathBuilder {
|
|
|
70
70
|
return pathParts.slice(i).join(this.deliminator) as FilePath;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
dirname(path: FilePath): FilePath {
|
|
73
|
+
public dirname(path: FilePath): FilePath {
|
|
74
74
|
const parts = path.split(this.deliminator);
|
|
75
75
|
parts.pop();
|
|
76
76
|
return parts.join(this.deliminator) as FilePath;
|
package/src/utils/pluralize.ts
CHANGED
|
@@ -4,7 +4,7 @@ export class PluralWord {
|
|
|
4
4
|
public singular: string;
|
|
5
5
|
public _plural?: string;
|
|
6
6
|
|
|
7
|
-
constructor(singular: string, _plural?: string) {
|
|
7
|
+
public constructor(singular: string, _plural?: string) {
|
|
8
8
|
this.singular = singular;
|
|
9
9
|
this._plural = _plural;
|
|
10
10
|
}
|
|
@@ -21,11 +21,11 @@ export class PluralWord {
|
|
|
21
21
|
export class PluralWords {
|
|
22
22
|
private words: PluralWord[];
|
|
23
23
|
|
|
24
|
-
constructor(words: PluralWord[]) {
|
|
24
|
+
public constructor(words: PluralWord[]) {
|
|
25
25
|
this.words = words;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
static of(...words: (PluralWord | string)[]) {
|
|
28
|
+
public static of(...words: (PluralWord | string)[]) {
|
|
29
29
|
return new PluralWords(
|
|
30
30
|
words.map((word) => {
|
|
31
31
|
if (typeof word === "string") {
|
package/src/utils/progress.ts
CHANGED
|
@@ -6,15 +6,15 @@ export class ProgressState {
|
|
|
6
6
|
private total: number | "indeterminate";
|
|
7
7
|
private listeners = new Set<ProgressListener>();
|
|
8
8
|
|
|
9
|
-
constructor(total: number | "indeterminate") {
|
|
9
|
+
public constructor(total: number | "indeterminate") {
|
|
10
10
|
this.total = total;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
static indeterminate(): ProgressState {
|
|
13
|
+
public static indeterminate(): ProgressState {
|
|
14
14
|
return new ProgressState("indeterminate");
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
addTotal(total: number) {
|
|
17
|
+
public addTotal(total: number) {
|
|
18
18
|
if (this.total === "indeterminate") {
|
|
19
19
|
this.total = total;
|
|
20
20
|
} else {
|
|
@@ -26,7 +26,7 @@ export class ProgressState {
|
|
|
26
26
|
/**
|
|
27
27
|
* Update the progress by the given increment.
|
|
28
28
|
*/
|
|
29
|
-
increment(increment: number) {
|
|
29
|
+
public increment(increment: number) {
|
|
30
30
|
this.progress += increment;
|
|
31
31
|
this.notifyListeners();
|
|
32
32
|
}
|
|
@@ -34,7 +34,7 @@ export class ProgressState {
|
|
|
34
34
|
/**
|
|
35
35
|
* Get the progress as a percentage (0-100)
|
|
36
36
|
*/
|
|
37
|
-
getProgress(): number | "indeterminate" {
|
|
37
|
+
public getProgress(): number | "indeterminate" {
|
|
38
38
|
if (this.total === "indeterminate") {
|
|
39
39
|
return "indeterminate";
|
|
40
40
|
}
|
|
@@ -45,7 +45,7 @@ export class ProgressState {
|
|
|
45
45
|
* Subscribe to progress updates.
|
|
46
46
|
* Returns an unsubscribe function.
|
|
47
47
|
*/
|
|
48
|
-
subscribe(listener: ProgressListener): () => void {
|
|
48
|
+
public subscribe(listener: ProgressListener): () => void {
|
|
49
49
|
this.listeners.add(listener);
|
|
50
50
|
return () => {
|
|
51
51
|
this.listeners.delete(listener);
|
|
@@ -25,12 +25,12 @@ function asString(value: string | PythonCode): string {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export class Variable implements PythonCode {
|
|
28
|
-
name: string;
|
|
29
|
-
constructor(name: string) {
|
|
28
|
+
public name: string;
|
|
29
|
+
public constructor(name: string) {
|
|
30
30
|
this.name = name;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
toCode(): string {
|
|
33
|
+
public toCode(): string {
|
|
34
34
|
return this.name;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -43,16 +43,16 @@ interface LiteralOptions {
|
|
|
43
43
|
export class Literal implements PythonCode {
|
|
44
44
|
public readonly value: unknown;
|
|
45
45
|
public readonly opts: LiteralOptions;
|
|
46
|
-
constructor(value: unknown, opts: LiteralOptions = {}) {
|
|
46
|
+
public constructor(value: unknown, opts: LiteralOptions = {}) {
|
|
47
47
|
this.value = value;
|
|
48
48
|
this.opts = opts;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
static from(value: unknown, opts: LiteralOptions = {}): Literal {
|
|
51
|
+
public static from(value: unknown, opts: LiteralOptions = {}): Literal {
|
|
52
52
|
return new Literal(value, opts);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
toCode(): string {
|
|
55
|
+
public toCode(): string {
|
|
56
56
|
const EMPTY_VALUE = "";
|
|
57
57
|
const { removeNull = false, removeUndefined = true } = this.opts;
|
|
58
58
|
|
|
@@ -122,12 +122,12 @@ export class VariableDeclaration implements PythonCode {
|
|
|
122
122
|
public name: string;
|
|
123
123
|
public value: string | PythonCode;
|
|
124
124
|
|
|
125
|
-
constructor(name: string, value: string | PythonCode) {
|
|
125
|
+
public constructor(name: string, value: string | PythonCode) {
|
|
126
126
|
this.name = name;
|
|
127
127
|
this.value = value;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
toCode(): string {
|
|
130
|
+
public toCode(): string {
|
|
131
131
|
const right = asString(this.value);
|
|
132
132
|
if (right.includes("\n")) {
|
|
133
133
|
return `${this.name} = (\n${indent(right)}\n)`;
|
|
@@ -140,12 +140,12 @@ export class FunctionArg implements PythonCode {
|
|
|
140
140
|
public name: string;
|
|
141
141
|
public value: string | PythonCode;
|
|
142
142
|
|
|
143
|
-
constructor(name: string, value: string | PythonCode) {
|
|
143
|
+
public constructor(name: string, value: string | PythonCode) {
|
|
144
144
|
this.name = name;
|
|
145
145
|
this.value = value;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
toCode(): string {
|
|
148
|
+
public toCode(): string {
|
|
149
149
|
return `${this.name}=${asString(this.value)}`;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
@@ -155,7 +155,7 @@ export class FunctionCall implements PythonCode {
|
|
|
155
155
|
public name: string;
|
|
156
156
|
public multiLine: boolean;
|
|
157
157
|
|
|
158
|
-
constructor(
|
|
158
|
+
public constructor(
|
|
159
159
|
name: string,
|
|
160
160
|
args: PythonCode[] | Record<string, PythonCode>,
|
|
161
161
|
multiLine = false,
|
|
@@ -165,7 +165,7 @@ export class FunctionCall implements PythonCode {
|
|
|
165
165
|
this.args = objectToArgs(args);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
toCode(): string {
|
|
168
|
+
public toCode(): string {
|
|
169
169
|
if (this.multiLine) {
|
|
170
170
|
if (this.args.length === 0) {
|
|
171
171
|
return `${this.name}()`;
|
|
@@ -178,11 +178,11 @@ export class FunctionCall implements PythonCode {
|
|
|
178
178
|
return `${this.name}(${this.args.map(asString).join(", ")})`;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
addArg(...args: PythonCode[]): FunctionCall {
|
|
181
|
+
public addArg(...args: PythonCode[]): FunctionCall {
|
|
182
182
|
return new FunctionCall(this.name, [...this.args, ...args], this.multiLine);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
chain(
|
|
185
|
+
public chain(
|
|
186
186
|
name: string,
|
|
187
187
|
args: PythonCode[] | Record<string, PythonCode>,
|
|
188
188
|
): FunctionCall {
|
package/src/utils/routes.ts
CHANGED
|
@@ -13,7 +13,7 @@ export class TinyRouter {
|
|
|
13
13
|
pathFunction: MatchFunction<ParamData>;
|
|
14
14
|
}[];
|
|
15
15
|
|
|
16
|
-
constructor(templates: string[]) {
|
|
16
|
+
public constructor(templates: string[]) {
|
|
17
17
|
this.routes = templates.map((template) => {
|
|
18
18
|
return {
|
|
19
19
|
template,
|
|
@@ -22,7 +22,9 @@ export class TinyRouter {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
match(
|
|
25
|
+
public match(
|
|
26
|
+
location: Location,
|
|
27
|
+
): [Match<ParamData>, template: string] | false {
|
|
26
28
|
for (const { pathFunction, template } of this.routes) {
|
|
27
29
|
const match =
|
|
28
30
|
pathFunction(location.hash) || pathFunction(location.pathname);
|
package/src/utils/semaphore.ts
CHANGED
|
@@ -9,7 +9,7 @@ export class Semaphore {
|
|
|
9
9
|
private permits: number;
|
|
10
10
|
private waiters: Array<() => void> = [];
|
|
11
11
|
|
|
12
|
-
constructor(permits: number) {
|
|
12
|
+
public constructor(permits: number) {
|
|
13
13
|
if (!Number.isInteger(permits) || permits < 1) {
|
|
14
14
|
throw new Error(
|
|
15
15
|
`Semaphore permits must be a positive integer, got ${permits}`,
|
|
@@ -20,16 +20,16 @@ export class Semaphore {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/** Permits currently available. */
|
|
23
|
-
get available(): number {
|
|
23
|
+
public get available(): number {
|
|
24
24
|
return this.permits;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/** Number of waiters queued for a permit. */
|
|
28
|
-
get pending(): number {
|
|
28
|
+
public get pending(): number {
|
|
29
29
|
return this.waiters.length;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
acquire(): Promise<void> {
|
|
32
|
+
public acquire(): Promise<void> {
|
|
33
33
|
if (this.permits > 0) {
|
|
34
34
|
this.permits--;
|
|
35
35
|
return Promise.resolve();
|
|
@@ -39,7 +39,7 @@ export class Semaphore {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
release(): void {
|
|
42
|
+
public release(): void {
|
|
43
43
|
const next = this.waiters.shift();
|
|
44
44
|
if (next) {
|
|
45
45
|
next();
|
|
@@ -54,7 +54,7 @@ export class Semaphore {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/** Acquire a permit, run `fn`, then release the permit. */
|
|
57
|
-
async run<T>(fn: () => Promise<T>): Promise<T> {
|
|
57
|
+
public async run<T>(fn: () => Promise<T>): Promise<T> {
|
|
58
58
|
await this.acquire();
|
|
59
59
|
try {
|
|
60
60
|
return await fn();
|
|
@@ -8,28 +8,28 @@ import { getIframeCapabilities } from "../capabilities";
|
|
|
8
8
|
class InMemoryStorage implements Storage {
|
|
9
9
|
private store = new Map<string, string>();
|
|
10
10
|
|
|
11
|
-
get length(): number {
|
|
11
|
+
public get length(): number {
|
|
12
12
|
return this.store.size;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
clear(): void {
|
|
15
|
+
public clear(): void {
|
|
16
16
|
this.store.clear();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
getItem(key: string): string | null {
|
|
19
|
+
public getItem(key: string): string | null {
|
|
20
20
|
return this.store.get(key) || null;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
key(index: number): string | null {
|
|
23
|
+
public key(index: number): string | null {
|
|
24
24
|
const keys = [...this.store.keys()];
|
|
25
25
|
return keys[index] || null;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
removeItem(key: string): void {
|
|
28
|
+
public removeItem(key: string): void {
|
|
29
29
|
this.store.delete(key);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
setItem(key: string, value: string): void {
|
|
32
|
+
public setItem(key: string, value: string): void {
|
|
33
33
|
this.store.set(key, value);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -16,12 +16,12 @@ export class TypedLocalStorage<T> implements ITypedStorage<T> {
|
|
|
16
16
|
private defaultValue: T;
|
|
17
17
|
private storage: Storage;
|
|
18
18
|
|
|
19
|
-
constructor(defaultValue: T, storage = availableStorage) {
|
|
19
|
+
public constructor(defaultValue: T, storage = availableStorage) {
|
|
20
20
|
this.defaultValue = defaultValue;
|
|
21
21
|
this.storage = storage;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
get(key: string): T {
|
|
24
|
+
public get(key: string): T {
|
|
25
25
|
try {
|
|
26
26
|
const item = this.storage.getItem(key);
|
|
27
27
|
return item ? (JSON.parse(item) as T) : this.defaultValue;
|
|
@@ -30,11 +30,11 @@ export class TypedLocalStorage<T> implements ITypedStorage<T> {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
set(key: string, value: T) {
|
|
33
|
+
public set(key: string, value: T) {
|
|
34
34
|
this.storage.setItem(key, JSON.stringify(value));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
remove(key: string) {
|
|
37
|
+
public remove(key: string) {
|
|
38
38
|
this.storage.removeItem(key);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -44,7 +44,7 @@ export class ZodLocalStorage<T> implements ITypedStorage<T> {
|
|
|
44
44
|
private getDefaultValue: () => T;
|
|
45
45
|
private storage: Storage;
|
|
46
46
|
|
|
47
|
-
constructor(
|
|
47
|
+
public constructor(
|
|
48
48
|
schema: ZodType<T>,
|
|
49
49
|
getDefaultValue: () => T,
|
|
50
50
|
storage = availableStorage,
|
|
@@ -54,7 +54,7 @@ export class ZodLocalStorage<T> implements ITypedStorage<T> {
|
|
|
54
54
|
this.storage = storage;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
get(key: string): T {
|
|
57
|
+
public get(key: string): T {
|
|
58
58
|
try {
|
|
59
59
|
const item = this.storage.getItem(key);
|
|
60
60
|
if (item == null) {
|
|
@@ -72,11 +72,11 @@ export class ZodLocalStorage<T> implements ITypedStorage<T> {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
set(key: string, value: T) {
|
|
75
|
+
public set(key: string, value: T) {
|
|
76
76
|
this.storage.setItem(key, JSON.stringify(value));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
remove(key: string) {
|
|
79
|
+
public remove(key: string) {
|
|
80
80
|
this.storage.removeItem(key);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -89,7 +89,11 @@ export class NotebookScopedLocalStorage<T> extends ZodLocalStorage<T> {
|
|
|
89
89
|
private filename: string | null;
|
|
90
90
|
private unsubscribeFromFilename: (() => void) | null;
|
|
91
91
|
|
|
92
|
-
constructor(
|
|
92
|
+
public constructor(
|
|
93
|
+
key: string,
|
|
94
|
+
schema: ZodType<T>,
|
|
95
|
+
getDefaultValue: () => T,
|
|
96
|
+
) {
|
|
93
97
|
const filename = store.get(filenameAtom);
|
|
94
98
|
super(schema, getDefaultValue);
|
|
95
99
|
this.filename = filename;
|
|
@@ -104,15 +108,15 @@ export class NotebookScopedLocalStorage<T> extends ZodLocalStorage<T> {
|
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
110
|
|
|
107
|
-
override get(key: string) {
|
|
111
|
+
public override get(key: string) {
|
|
108
112
|
return super.get(this.createScopedKey(key, this.filename));
|
|
109
113
|
}
|
|
110
114
|
|
|
111
|
-
override set(key: string, value: T) {
|
|
115
|
+
public override set(key: string, value: T) {
|
|
112
116
|
super.set(this.createScopedKey(key, this.filename), value);
|
|
113
117
|
}
|
|
114
118
|
|
|
115
|
-
override remove(key: string) {
|
|
119
|
+
public override remove(key: string) {
|
|
116
120
|
super.remove(this.createScopedKey(key, this.filename));
|
|
117
121
|
}
|
|
118
122
|
|
package/src/utils/time.ts
CHANGED
|
@@ -9,25 +9,25 @@ export type Seconds = TypedNumber<"seconds">;
|
|
|
9
9
|
export class Time {
|
|
10
10
|
private readonly ms: Milliseconds;
|
|
11
11
|
|
|
12
|
-
static fromMilliseconds(ms: Milliseconds): Time;
|
|
13
|
-
static fromMilliseconds(ms: Milliseconds | null): Time | null;
|
|
14
|
-
static fromMilliseconds(ms: Milliseconds | null): Time | null {
|
|
12
|
+
public static fromMilliseconds(ms: Milliseconds): Time;
|
|
13
|
+
public static fromMilliseconds(ms: Milliseconds | null): Time | null;
|
|
14
|
+
public static fromMilliseconds(ms: Milliseconds | null): Time | null {
|
|
15
15
|
if (ms == null) {
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
18
|
return new Time(ms);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
static fromSeconds(s: Seconds): Time;
|
|
22
|
-
static fromSeconds(s: Seconds | null): Time | null;
|
|
23
|
-
static fromSeconds(s: Seconds | null): Time | null {
|
|
21
|
+
public static fromSeconds(s: Seconds): Time;
|
|
22
|
+
public static fromSeconds(s: Seconds | null): Time | null;
|
|
23
|
+
public static fromSeconds(s: Seconds | null): Time | null {
|
|
24
24
|
if (s == null) {
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
27
|
return new Time((s * 1000) as Milliseconds);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
static now(): Time {
|
|
30
|
+
public static now(): Time {
|
|
31
31
|
return new Time(Date.now() as Milliseconds);
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -35,11 +35,11 @@ export class Time {
|
|
|
35
35
|
this.ms = ms;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
toMilliseconds(): Milliseconds {
|
|
38
|
+
public toMilliseconds(): Milliseconds {
|
|
39
39
|
return this.ms;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
toSeconds(): Seconds {
|
|
42
|
+
public toSeconds(): Seconds {
|
|
43
43
|
return (this.ms / 1000) as Seconds;
|
|
44
44
|
}
|
|
45
45
|
}
|
package/src/utils/timed-cache.ts
CHANGED
|
@@ -9,7 +9,7 @@ export class TimedCache<T> {
|
|
|
9
9
|
private ttl: number;
|
|
10
10
|
private cache = new Map<string, { data: T; timestamp: number }>();
|
|
11
11
|
|
|
12
|
-
constructor(options: TimedCacheOptions) {
|
|
12
|
+
public constructor(options: TimedCacheOptions) {
|
|
13
13
|
this.ttl = options.ttl;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -22,7 +22,7 @@ export class TimedCache<T> {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
get(key: string): T | undefined {
|
|
25
|
+
public get(key: string): T | undefined {
|
|
26
26
|
this.cleanupExpiredEntries();
|
|
27
27
|
|
|
28
28
|
const cached = this.cache.get(key);
|
|
@@ -39,14 +39,14 @@ export class TimedCache<T> {
|
|
|
39
39
|
return cached.data;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
set(key: string, data: T): void {
|
|
42
|
+
public set(key: string, data: T): void {
|
|
43
43
|
this.cache.set(key, {
|
|
44
44
|
data,
|
|
45
45
|
timestamp: Date.now(),
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
clear(): void {
|
|
49
|
+
public clear(): void {
|
|
50
50
|
this.cache.clear();
|
|
51
51
|
}
|
|
52
52
|
}
|
package/src/utils/tracer.ts
CHANGED
|
@@ -22,7 +22,10 @@ interface Span {
|
|
|
22
22
|
export class Tracer {
|
|
23
23
|
private spans: Span[] = [];
|
|
24
24
|
|
|
25
|
-
startSpan(
|
|
25
|
+
public startSpan(
|
|
26
|
+
name: string,
|
|
27
|
+
attributes: Record<string, unknown> = {},
|
|
28
|
+
): Span {
|
|
26
29
|
const span: Span = {
|
|
27
30
|
name,
|
|
28
31
|
startTime: Date.now(),
|
|
@@ -33,16 +36,16 @@ export class Tracer {
|
|
|
33
36
|
return span;
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
endSpan(span: Span, status: SpanStatus = "ok"): void {
|
|
39
|
+
public endSpan(span: Span, status: SpanStatus = "ok"): void {
|
|
37
40
|
span.endTime = Date.now();
|
|
38
41
|
span.status = status;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
getSpans(): Span[] {
|
|
44
|
+
public getSpans(): Span[] {
|
|
42
45
|
return this.spans;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
wrap<T>(
|
|
48
|
+
public wrap<T>(
|
|
46
49
|
fn: () => T,
|
|
47
50
|
name?: string,
|
|
48
51
|
attributes: Record<string, unknown> = {},
|
|
@@ -58,7 +61,7 @@ export class Tracer {
|
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
wrapAsync<T extends (...args: any[]) => Promise<any>>(
|
|
64
|
+
public wrapAsync<T extends (...args: any[]) => Promise<any>>(
|
|
62
65
|
fn: T,
|
|
63
66
|
name?: string,
|
|
64
67
|
attributes: Record<string, unknown> = {},
|
|
@@ -76,7 +79,7 @@ export class Tracer {
|
|
|
76
79
|
}) as T;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
logSpans(): void {
|
|
82
|
+
public logSpans(): void {
|
|
80
83
|
if (process.env.NODE_ENV !== "development") {
|
|
81
84
|
return;
|
|
82
85
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import "./chunk-75Z2AOVW-5_HsvXwr.js";
|
|
2
|
-
import "./src-CA_m4ONl.js";
|
|
3
|
-
import { n as e } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
|
|
4
|
-
import "./chunk-DU6HZSFF-BUgAHvnM.js";
|
|
5
|
-
import "./chunk-P2QGCYS3-C0iGU29N.js";
|
|
6
|
-
import "./chunk-PWAF6VOD-CTFCL0jI.js";
|
|
7
|
-
import "./chunk-GMAD6QVW-Czynz8aA.js";
|
|
8
|
-
import "./chunk-4HAMMTFA-D2qv8E0X.js";
|
|
9
|
-
import "./chunk-GVQU2GXP-yQEdulRS.js";
|
|
10
|
-
import "./chunk-L3NEJ4N5-DwRWnDDK.js";
|
|
11
|
-
import "./chunk-OSK3NFVY-BBKU_Ign.js";
|
|
12
|
-
import "./mermaid-DPNuhemn.js";
|
|
13
|
-
import "./chunk-F27PBJKO-DHmYWZXr.js";
|
|
14
|
-
import "./chunk-XXDRQBXY-Dnl5VBqG.js";
|
|
15
|
-
import "./chunk-POPQ4Y6H-BCbS3Ozc.js";
|
|
16
|
-
import { i as t, n, r, t as i } from "./chunk-TICWLB2K-fVF7Uujg.js";
|
|
17
|
-
//#region ../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-ZZMXUADV.mjs
|
|
18
|
-
var a = {
|
|
19
|
-
parser: n,
|
|
20
|
-
get db() {
|
|
21
|
-
return new i();
|
|
22
|
-
},
|
|
23
|
-
renderer: r,
|
|
24
|
-
styles: t,
|
|
25
|
-
init: /* @__PURE__ */ e((e) => {
|
|
26
|
-
e.class ||= {}, e.class.arrowMarkerAbsolute = e.arrowMarkerAbsolute;
|
|
27
|
-
}, "init")
|
|
28
|
-
};
|
|
29
|
-
//#endregion
|
|
30
|
-
export { a as diagram };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import "./chunk-75Z2AOVW-5_HsvXwr.js";
|
|
2
|
-
import "./src-CA_m4ONl.js";
|
|
3
|
-
import { n as e } from "./chunk-Y2CYZVJY-DKKS1VyV.js";
|
|
4
|
-
import "./chunk-DU6HZSFF-BUgAHvnM.js";
|
|
5
|
-
import "./chunk-P2QGCYS3-C0iGU29N.js";
|
|
6
|
-
import "./chunk-PWAF6VOD-CTFCL0jI.js";
|
|
7
|
-
import "./chunk-GMAD6QVW-Czynz8aA.js";
|
|
8
|
-
import "./chunk-4HAMMTFA-D2qv8E0X.js";
|
|
9
|
-
import "./chunk-GVQU2GXP-yQEdulRS.js";
|
|
10
|
-
import "./chunk-L3NEJ4N5-DwRWnDDK.js";
|
|
11
|
-
import "./chunk-OSK3NFVY-BBKU_Ign.js";
|
|
12
|
-
import "./mermaid-DPNuhemn.js";
|
|
13
|
-
import "./chunk-F27PBJKO-DHmYWZXr.js";
|
|
14
|
-
import "./chunk-XXDRQBXY-Dnl5VBqG.js";
|
|
15
|
-
import "./chunk-POPQ4Y6H-BCbS3Ozc.js";
|
|
16
|
-
import { i as t, n, r, t as i } from "./chunk-TICWLB2K-fVF7Uujg.js";
|
|
17
|
-
//#region ../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-VYDZK3BY.mjs
|
|
18
|
-
var a = {
|
|
19
|
-
parser: n,
|
|
20
|
-
get db() {
|
|
21
|
-
return new i();
|
|
22
|
-
},
|
|
23
|
-
renderer: r,
|
|
24
|
-
styles: t,
|
|
25
|
-
init: /* @__PURE__ */ e((e) => {
|
|
26
|
-
e.class ||= {}, e.class.arrowMarkerAbsolute = e.arrowMarkerAbsolute;
|
|
27
|
-
}, "init")
|
|
28
|
-
};
|
|
29
|
-
//#endregion
|
|
30
|
-
export { a as diagram };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "./chunk-75Z2AOVW-5_HsvXwr.js";
|
|
2
|
-
import "./src-CA_m4ONl.js";
|
|
3
|
-
import "./chunk-DU6HZSFF-BUgAHvnM.js";
|
|
4
|
-
import "./chunk-P2QGCYS3-C0iGU29N.js";
|
|
5
|
-
import "./chunk-PWAF6VOD-CTFCL0jI.js";
|
|
6
|
-
import "./chunk-GMAD6QVW-Czynz8aA.js";
|
|
7
|
-
import "./chunk-4HAMMTFA-D2qv8E0X.js";
|
|
8
|
-
import "./chunk-GVQU2GXP-yQEdulRS.js";
|
|
9
|
-
import "./chunk-L3NEJ4N5-DwRWnDDK.js";
|
|
10
|
-
import "./chunk-OSK3NFVY-BBKU_Ign.js";
|
|
11
|
-
import "./mermaid-DPNuhemn.js";
|
|
12
|
-
import "./chunk-F27PBJKO-DHmYWZXr.js";
|
|
13
|
-
import "./chunk-XXDRQBXY-Dnl5VBqG.js";
|
|
14
|
-
import "./chunk-POPQ4Y6H-BCbS3Ozc.js";
|
|
15
|
-
import { n as e } from "./chunk-SHT3W25Y-BspJEJ5H.js";
|
|
16
|
-
export { e as diagram };
|