@dxos/app-framework 0.8.4-main.3eb6e50203 → 0.8.4-main.3fbcb4aa9b
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/.storybook/main.mts +1 -3
- package/dist/lib/browser/{capability-DU35RXMD.mjs → capability-5RRH3WIB.mjs} +11 -10
- package/dist/lib/browser/capability-5RRH3WIB.mjs.map +7 -0
- package/dist/lib/browser/{capability-7LE5X2NH.mjs → capability-LUKGKUQH.mjs} +10 -9
- package/dist/lib/browser/{chunk-4DQMLMGU.mjs → chunk-23D4SJUE.mjs} +11 -13
- package/dist/lib/browser/{chunk-4DQMLMGU.mjs.map → chunk-23D4SJUE.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-ZQO3UZ4R.mjs → chunk-3JWJXGLK.mjs} +6 -4
- package/dist/lib/browser/chunk-3JWJXGLK.mjs.map +7 -0
- package/dist/lib/browser/chunk-45CHLTBV.mjs +34 -0
- package/dist/lib/browser/chunk-45CHLTBV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-66IXTIVK.mjs} +3 -2
- package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
- package/dist/lib/browser/chunk-7VZJR2OA.mjs +581 -0
- package/dist/lib/browser/chunk-7VZJR2OA.mjs.map +7 -0
- package/dist/lib/browser/chunk-CZ4BIAHH.mjs +422 -0
- package/dist/lib/browser/chunk-CZ4BIAHH.mjs.map +7 -0
- package/dist/lib/browser/chunk-FJ4765WW.mjs +8 -0
- package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-FJ4765WW.mjs.map} +3 -3
- package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
- package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
- package/dist/lib/browser/chunk-JD3Z5NEF.mjs +469 -0
- package/dist/lib/browser/chunk-JD3Z5NEF.mjs.map +7 -0
- package/dist/lib/browser/chunk-NBXPP7JR.mjs +1174 -0
- package/dist/lib/browser/chunk-NBXPP7JR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-IGRQWMWW.mjs → chunk-WBHCSOBW.mjs} +18 -18
- package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KWP6PKIU.mjs → chunk-Z55LVAGN.mjs} +87 -19
- package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EIFGKQSA.mjs → chunk-ZGJAZSNE.mjs} +9 -37
- package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +16 -29
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/common/activation-events.mjs +9 -8
- package/dist/lib/browser/common/capabilities.mjs +9 -8
- package/dist/lib/browser/core/activation-event.mjs +1 -1
- package/dist/lib/browser/core/capability.mjs +3 -1
- package/dist/lib/browser/core/plugin-manager.mjs +8 -4
- package/dist/lib/browser/core/plugin.mjs +14 -4
- package/dist/lib/browser/core/url-loader.mjs +24 -0
- package/dist/lib/browser/index.mjs +45 -24
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{invoker-capability-7QW56NOM.mjs → invoker-capability-K4GHUFXF.mjs} +22 -14
- package/dist/lib/browser/invoker-capability-K4GHUFXF.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +184 -45
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/browser/testing/react.mjs +78 -0
- package/dist/lib/browser/testing/react.mjs.map +7 -0
- package/dist/lib/browser/ui/index.mjs +19 -20
- package/dist/lib/node-esm/{capability-OSVYGK4X.mjs → capability-FCGZVIEG.mjs} +10 -9
- package/dist/lib/{browser/capability-7LE5X2NH.mjs.map → node-esm/capability-FCGZVIEG.mjs.map} +1 -1
- package/dist/lib/node-esm/{capability-SR2EIZFP.mjs → capability-JOIQ2MQE.mjs} +11 -10
- package/dist/lib/node-esm/capability-JOIQ2MQE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-37Z53PXZ.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-37Z53PXZ.mjs.map} +3 -3
- package/dist/lib/node-esm/chunk-6XW6LET6.mjs +35 -0
- package/dist/lib/node-esm/chunk-6XW6LET6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-DHSHRYIB.mjs → chunk-D347W3KO.mjs} +9 -37
- package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DRZKO5UZ.mjs +470 -0
- package/dist/lib/node-esm/chunk-DRZKO5UZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-DZ2XLAGI.mjs → chunk-HTBJU5FX.mjs} +87 -19
- package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-M3HKPRPO.mjs +423 -0
- package/dist/lib/node-esm/chunk-M3HKPRPO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MUVUQC3G.mjs +1175 -0
- package/dist/lib/node-esm/chunk-MUVUQC3G.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-J2PHTRHC.mjs → chunk-SBS2YMPT.mjs} +11 -13
- package/dist/lib/node-esm/{chunk-J2PHTRHC.mjs.map → chunk-SBS2YMPT.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-64IMLAS2.mjs → chunk-SDJ4B2LU.mjs} +6 -4
- package/dist/lib/node-esm/chunk-SDJ4B2LU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-V24UWT36.mjs +582 -0
- package/dist/lib/node-esm/chunk-V24UWT36.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OQYHRZYF.mjs → chunk-WFSRZKBP.mjs} +18 -18
- package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
- package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-XOCUANHO.mjs} +3 -2
- package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +16 -29
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/common/activation-events.mjs +9 -8
- package/dist/lib/node-esm/common/capabilities.mjs +9 -8
- package/dist/lib/node-esm/core/activation-event.mjs +1 -1
- package/dist/lib/node-esm/core/capability.mjs +3 -1
- package/dist/lib/node-esm/core/plugin-manager.mjs +8 -4
- package/dist/lib/node-esm/core/plugin.mjs +14 -4
- package/dist/lib/node-esm/core/url-loader.mjs +25 -0
- package/dist/lib/node-esm/index.mjs +45 -24
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{invoker-capability-CK4AMF2R.mjs → invoker-capability-XEPW5LMJ.mjs} +22 -14
- package/dist/lib/node-esm/invoker-capability-XEPW5LMJ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +184 -45
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/testing/react.mjs +79 -0
- package/dist/lib/node-esm/testing/react.mjs.map +7 -0
- package/dist/lib/node-esm/ui/index.mjs +19 -20
- package/dist/plugin/node-esm/index.mjs +893 -0
- package/dist/plugin/node-esm/index.mjs.map +7 -0
- package/dist/plugin/node-esm/meta.json +1 -0
- package/dist/types/src/common/activation-events.d.ts +1 -1
- package/dist/types/src/common/activation-events.d.ts.map +1 -1
- package/dist/types/src/common/annotations.d.ts +1 -0
- package/dist/types/src/common/annotations.d.ts.map +1 -0
- package/dist/types/src/common/capabilities.d.ts +4 -8
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +8 -22
- package/dist/types/src/common/operations.d.ts.map +1 -1
- package/dist/types/src/core/activation-event.d.ts +5 -5
- package/dist/types/src/core/activation-event.d.ts.map +1 -1
- package/dist/types/src/core/capability-manager.d.ts +5 -0
- package/dist/types/src/core/capability-manager.d.ts.map +1 -1
- package/dist/types/src/core/capability.d.ts +14 -8
- package/dist/types/src/core/capability.d.ts.map +1 -1
- package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
- package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +6 -0
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
- package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manager.d.ts +177 -4
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manifest.d.ts +101 -0
- package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
- package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin.d.ts +113 -7
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/registry.d.ts +101 -0
- package/dist/types/src/core/registry.d.ts.map +1 -0
- package/dist/types/src/core/url-loader.d.ts +127 -0
- package/dist/types/src/core/url-loader.d.ts.map +1 -0
- package/dist/types/src/core/url-loader.test.d.ts +2 -0
- package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
- package/dist/types/src/helpers.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/capability.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/errors.d.ts +30 -3
- package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/types.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/meta.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/testing.d.ts +27 -77
- package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
- package/dist/types/src/plugin-runtime/meta.d.ts.map +1 -1
- package/dist/types/src/testing/harness.d.ts +67 -0
- package/dist/types/src/testing/harness.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/react.d.ts +27 -0
- package/dist/types/src/testing/react.d.ts.map +1 -0
- package/dist/types/src/testing/react.test.d.ts +2 -0
- package/dist/types/src/testing/react.test.d.ts.map +1 -0
- package/dist/types/src/testing/service.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/{App.d.ts → App/App.d.ts} +3 -2
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
- package/dist/types/src/ui/components/{App.stories.d.ts → App/App.stories.d.ts} +6 -1
- package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/App/index.d.ts +2 -0
- package/dist/types/src/ui/components/App/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/{PluginManagerProvider.d.ts → PluginManager/PluginManagerProvider.d.ts} +1 -1
- package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/index.d.ts +2 -0
- package/dist/types/src/ui/components/PluginManager/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +24 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/{surface → Surface}/SurfaceInfo.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
- package/dist/types/src/ui/components/{surface → Surface}/context.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/index.d.ts +36 -0
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/types.d.ts +197 -0
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
- package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
- package/dist/types/src/ui/components/index.d.ts +3 -3
- package/dist/types/src/ui/components/index.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/index.d.ts +0 -1
- package/dist/types/src/ui/hooks/index.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useApp.d.ts +47 -8
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
- package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useSurface.d.ts +2 -2
- package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -1
- package/dist/types/src/ui/index.d.ts +0 -1
- package/dist/types/src/ui/index.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts +2 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/loader.d.ts +51 -0
- package/dist/types/src/vite-plugin/boot-loader/loader.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
- package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
- package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/index.d.ts +5 -0
- package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/manifest.d.ts +41 -0
- package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
- package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/packages.d.ts +13 -0
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +16 -4
- package/package.json +58 -62
- package/src/cli/cli.ts +3 -3
- package/src/common/activation-events.ts +6 -6
- package/src/common/annotations.ts +3 -0
- package/src/common/capabilities.ts +18 -23
- package/src/common/operations.ts +7 -10
- package/src/context.ts +1 -1
- package/src/core/activation-event.ts +5 -2
- package/src/core/capability-manager.test.ts +1 -1
- package/src/core/capability-manager.ts +22 -1
- package/src/core/capability.ts +21 -10
- package/src/core/edge-registry-plugin-provider.ts +92 -0
- package/src/core/index.ts +6 -0
- package/src/core/plugin-asset-cache.ts +60 -0
- package/src/core/plugin-manager.test.ts +855 -29
- package/src/core/plugin-manager.ts +818 -179
- package/src/core/plugin-manifest.test.ts +75 -0
- package/src/core/plugin-manifest.ts +134 -0
- package/src/core/plugin.ts +145 -12
- package/src/core/registry.ts +157 -0
- package/src/core/url-loader.test.ts +221 -0
- package/src/core/url-loader.ts +388 -0
- package/src/plugin-operation/OperationPlugin.ts +2 -3
- package/src/plugin-operation/history/capability.ts +1 -2
- package/src/plugin-operation/history/errors.ts +2 -6
- package/src/plugin-operation/history/history-tracker.test.ts +37 -43
- package/src/plugin-operation/history/history-tracker.ts +1 -2
- package/src/plugin-operation/history/types.ts +1 -1
- package/src/plugin-operation/history/undo-mapping.ts +1 -1
- package/src/plugin-operation/history/undo-registry.test.ts +3 -4
- package/src/plugin-operation/history/undo-registry.ts +1 -1
- package/src/plugin-operation/invoker-capability.ts +19 -4
- package/src/plugin-operation/meta.ts +2 -1
- package/src/plugin-operation/testing.ts +26 -45
- package/src/plugin-runtime/RuntimePlugin.ts +2 -3
- package/src/plugin-runtime/meta.ts +2 -1
- package/src/testing/harness.ts +229 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/react.test.tsx +48 -0
- package/src/testing/react.tsx +113 -0
- package/src/testing/service.ts +3 -3
- package/src/testing/withPluginManager.stories.tsx +1 -2
- package/src/testing/withPluginManager.tsx +40 -15
- package/src/ui/components/App/App.stories.tsx +88 -0
- package/src/ui/components/App/App.tsx +81 -0
- package/src/ui/components/App/index.ts +5 -0
- package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
- package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
- package/src/ui/components/Placeholder/index.ts +5 -0
- package/src/ui/components/{PluginManagerContext.stories.tsx → PluginManager/PluginManagerContext.stories.tsx} +15 -13
- package/src/ui/components/{PluginManagerProvider.ts → PluginManager/PluginManagerProvider.ts} +1 -1
- package/src/ui/components/PluginManager/index.ts +5 -0
- package/src/ui/components/{surface → Surface}/SurfaceComponent.stories.tsx +25 -23
- package/src/ui/components/Surface/SurfaceComponent.tsx +303 -0
- package/src/ui/components/{surface → Surface}/SurfaceInfo.tsx +1 -2
- package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
- package/src/ui/components/Surface/index.ts +54 -0
- package/src/ui/components/Surface/types.test.ts +126 -0
- package/src/ui/components/Surface/types.ts +269 -0
- package/src/ui/components/index.ts +3 -3
- package/src/ui/hooks/index.ts +0 -1
- package/src/ui/hooks/useApp.test.tsx +159 -0
- package/src/ui/hooks/useApp.tsx +233 -24
- package/src/ui/hooks/useCapabilities.ts +1 -1
- package/src/ui/hooks/useLoading.tsx +14 -6
- package/src/ui/hooks/useSurface.ts +3 -3
- package/src/ui/index.ts +0 -1
- package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +270 -0
- package/src/vite-plugin/boot-loader/boot-loader.css +320 -0
- package/src/vite-plugin/boot-loader/boot-loader.js +325 -0
- package/src/vite-plugin/boot-loader/index.ts +5 -0
- package/src/vite-plugin/boot-loader/loader.ts +123 -0
- package/src/vite-plugin/composer/index.ts +306 -0
- package/src/vite-plugin/import-map/index.ts +527 -0
- package/src/vite-plugin/index.ts +10 -0
- package/src/vite-plugin/manifest.test.ts +46 -0
- package/src/vite-plugin/manifest.ts +57 -0
- package/src/vite-plugin/packages.ts +187 -0
- package/tsconfig.json +22 -1
- package/tsconfig.node.json +2 -4
- package/typedoc.json +2 -4
- package/vitest.config.ts +1 -1
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/dist/lib/browser/capability-DU35RXMD.mjs.map +0 -7
- package/dist/lib/browser/chunk-EIFGKQSA.mjs.map +0 -7
- package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
- package/dist/lib/browser/chunk-IGRQWMWW.mjs.map +0 -7
- package/dist/lib/browser/chunk-KWP6PKIU.mjs.map +0 -7
- package/dist/lib/browser/chunk-NPUEVX42.mjs +0 -34
- package/dist/lib/browser/chunk-NPUEVX42.mjs.map +0 -7
- package/dist/lib/browser/chunk-PKQT6C53.mjs.map +0 -7
- package/dist/lib/browser/chunk-WGWEEBUV.mjs +0 -807
- package/dist/lib/browser/chunk-WGWEEBUV.mjs.map +0 -7
- package/dist/lib/browser/chunk-YAFEA4GV.mjs +0 -1
- package/dist/lib/browser/chunk-YZQ6NFG4.mjs +0 -781
- package/dist/lib/browser/chunk-YZQ6NFG4.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZQO3UZ4R.mjs.map +0 -7
- package/dist/lib/browser/invoker-capability-7QW56NOM.mjs.map +0 -7
- package/dist/lib/node-esm/capability-SR2EIZFP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-64IMLAS2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DHSHRYIB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DZ2XLAGI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JAZVHID3.mjs +0 -35
- package/dist/lib/node-esm/chunk-JAZVHID3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OQYHRZYF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VV4YHPQQ.mjs +0 -782
- package/dist/lib/node-esm/chunk-VV4YHPQQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XHAKT6UD.mjs +0 -808
- package/dist/lib/node-esm/chunk-XHAKT6UD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +0 -2
- package/dist/lib/node-esm/invoker-capability-CK4AMF2R.mjs.map +0 -7
- package/dist/types/src/ui/components/App.d.ts.map +0 -1
- package/dist/types/src/ui/components/App.stories.d.ts.map +0 -1
- package/dist/types/src/ui/components/DefaultFallback.d.ts +0 -8
- package/dist/types/src/ui/components/DefaultFallback.d.ts.map +0 -1
- package/dist/types/src/ui/components/ErrorBoundary.d.ts +0 -30
- package/dist/types/src/ui/components/ErrorBoundary.d.ts.map +0 -1
- package/dist/types/src/ui/components/PluginManagerContext.stories.d.ts.map +0 -1
- package/dist/types/src/ui/components/PluginManagerProvider.d.ts.map +0 -1
- package/dist/types/src/ui/components/surface/SurfaceComponent.d.ts +0 -12
- package/dist/types/src/ui/components/surface/SurfaceComponent.d.ts.map +0 -1
- package/dist/types/src/ui/components/surface/SurfaceComponent.stories.d.ts.map +0 -1
- package/dist/types/src/ui/components/surface/index.d.ts +0 -5
- package/dist/types/src/ui/components/surface/index.d.ts.map +0 -1
- package/dist/types/src/ui/components/surface/types.d.ts +0 -94
- package/dist/types/src/ui/components/surface/types.d.ts.map +0 -1
- package/dist/types/src/ui/hooks/useOperationResolver.d.ts +0 -19
- package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +0 -1
- package/src/ui/components/App.stories.tsx +0 -62
- package/src/ui/components/App.tsx +0 -57
- package/src/ui/components/DefaultFallback.tsx +0 -26
- package/src/ui/components/ErrorBoundary.tsx +0 -56
- package/src/ui/components/surface/SurfaceComponent.tsx +0 -262
- package/src/ui/components/surface/index.ts +0 -8
- package/src/ui/components/surface/types.ts +0 -119
- package/src/ui/hooks/useOperationResolver.ts +0 -40
- /package/dist/lib/{node-esm/capability-OSVYGK4X.mjs.map → browser/capability-LUKGKUQH.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-YAFEA4GV.mjs.map → core/url-loader.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-Z4TJPSMP.mjs.map → core/url-loader.mjs.map} +0 -0
- /package/dist/types/src/ui/components/{PluginManagerContext.stories.d.ts → PluginManager/PluginManagerContext.stories.d.ts} +0 -0
- /package/dist/types/src/ui/components/{surface → Surface}/SurfaceComponent.stories.d.ts +0 -0
- /package/dist/types/src/ui/components/{surface → Surface}/SurfaceInfo.d.ts +0 -0
- /package/dist/types/src/ui/components/{surface → Surface}/context.d.ts +0 -0
- /package/src/ui/components/{surface → Surface}/context.ts +0 -0
|
@@ -5,10 +5,15 @@
|
|
|
5
5
|
import { it } from '@effect/vitest';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import * as Fiber from 'effect/Fiber';
|
|
8
|
+
import * as Layer from 'effect/Layer';
|
|
9
|
+
import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
8
10
|
import * as TestClock from 'effect/TestClock';
|
|
9
11
|
import { describe, expect } from 'vitest';
|
|
10
12
|
|
|
11
|
-
import {
|
|
13
|
+
import { Operation } from '@dxos/compute';
|
|
14
|
+
import { OperationInvoker } from '@dxos/operation';
|
|
15
|
+
|
|
16
|
+
const testRuntime = ManagedRuntime.make(Layer.empty) as unknown as ManagedRuntime.ManagedRuntime<any, any>;
|
|
12
17
|
|
|
13
18
|
import { UndoOperation } from '../../common';
|
|
14
19
|
import {
|
|
@@ -21,7 +26,6 @@ import {
|
|
|
21
26
|
toStringHandler,
|
|
22
27
|
waitUntil,
|
|
23
28
|
} from '../testing';
|
|
24
|
-
|
|
25
29
|
import * as HistoryTracker from './history-tracker';
|
|
26
30
|
import * as UndoMapping from './undo-mapping';
|
|
27
31
|
import * as UndoRegistry from './undo-registry';
|
|
@@ -35,7 +39,7 @@ describe('HistoryTracker', () => {
|
|
|
35
39
|
deriveContext: (_input, output) => ({ value: output.value }),
|
|
36
40
|
});
|
|
37
41
|
|
|
38
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]));
|
|
42
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]), testRuntime);
|
|
39
43
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
40
44
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
41
45
|
|
|
@@ -55,7 +59,7 @@ describe('HistoryTracker', () => {
|
|
|
55
59
|
|
|
56
60
|
it.effect('does not track operations without undo mapping', () =>
|
|
57
61
|
Effect.gen(function* () {
|
|
58
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([toStringHandler]));
|
|
62
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([toStringHandler]), testRuntime);
|
|
59
63
|
const undoRegistry = UndoRegistry.make(() => []);
|
|
60
64
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
61
65
|
const collector = yield* createEventCollector(invoker);
|
|
@@ -81,15 +85,12 @@ describe('HistoryTracker', () => {
|
|
|
81
85
|
});
|
|
82
86
|
|
|
83
87
|
let halveWasCalled = false;
|
|
84
|
-
const trackingHalveHandler =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
halveWasCalled = true;
|
|
88
|
-
return Effect.succeed({ value: data.value / 2 });
|
|
89
|
-
},
|
|
88
|
+
const trackingHalveHandler = Operation.withHandler(HalveCompute, (data) => {
|
|
89
|
+
halveWasCalled = true;
|
|
90
|
+
return Effect.succeed({ value: data.value / 2 });
|
|
90
91
|
});
|
|
91
92
|
|
|
92
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, trackingHalveHandler]));
|
|
93
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, trackingHalveHandler]), testRuntime);
|
|
93
94
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
94
95
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
95
96
|
|
|
@@ -117,7 +118,7 @@ describe('HistoryTracker', () => {
|
|
|
117
118
|
deriveContext: (_input, output) => ({ value: output.value }),
|
|
118
119
|
});
|
|
119
120
|
|
|
120
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]));
|
|
121
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]), testRuntime);
|
|
121
122
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
122
123
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
123
124
|
const collector = yield* createEventCollector(invoker);
|
|
@@ -152,15 +153,12 @@ describe('HistoryTracker', () => {
|
|
|
152
153
|
});
|
|
153
154
|
|
|
154
155
|
const halveInputs: number[] = [];
|
|
155
|
-
const trackingHalveHandler =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
halveInputs.push(data.value);
|
|
159
|
-
return Effect.succeed({ value: data.value / 2 });
|
|
160
|
-
},
|
|
156
|
+
const trackingHalveHandler = Operation.withHandler(HalveCompute, (data) => {
|
|
157
|
+
halveInputs.push(data.value);
|
|
158
|
+
return Effect.succeed({ value: data.value / 2 });
|
|
161
159
|
});
|
|
162
160
|
|
|
163
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, trackingHalveHandler]));
|
|
161
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, trackingHalveHandler]), testRuntime);
|
|
164
162
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
165
163
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
166
164
|
const collector = yield* createEventCollector(invoker);
|
|
@@ -194,7 +192,7 @@ describe('HistoryTracker', () => {
|
|
|
194
192
|
|
|
195
193
|
it.effect('undo on empty history returns error', () =>
|
|
196
194
|
Effect.gen(function* () {
|
|
197
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([]));
|
|
195
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([]), testRuntime);
|
|
198
196
|
const undoRegistry = UndoRegistry.make(() => []);
|
|
199
197
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
200
198
|
|
|
@@ -208,7 +206,7 @@ describe('HistoryTracker', () => {
|
|
|
208
206
|
|
|
209
207
|
it.effect('fires ShowUndo operation when undoable operation is tracked', () =>
|
|
210
208
|
Effect.gen(function* () {
|
|
211
|
-
const testMessage: [string, { ns: string }] = ['test
|
|
209
|
+
const testMessage: [string, { ns: string }] = ['test-undo.message', { ns: 'test' }];
|
|
212
210
|
const undoMapping = UndoMapping.make({
|
|
213
211
|
operation: Compute,
|
|
214
212
|
inverse: HalveCompute,
|
|
@@ -218,17 +216,15 @@ describe('HistoryTracker', () => {
|
|
|
218
216
|
|
|
219
217
|
let showUndoWasCalled = false;
|
|
220
218
|
let showUndoMessage: unknown = undefined;
|
|
221
|
-
const showUndoHandler =
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
showUndoMessage = input.message;
|
|
226
|
-
return Effect.succeed(undefined);
|
|
227
|
-
},
|
|
219
|
+
const showUndoHandler = Operation.withHandler(UndoOperation.ShowUndo, (input) => {
|
|
220
|
+
showUndoWasCalled = true;
|
|
221
|
+
showUndoMessage = input.message;
|
|
222
|
+
return Effect.succeed(undefined);
|
|
228
223
|
});
|
|
229
224
|
|
|
230
|
-
const invoker = OperationInvoker.make(
|
|
231
|
-
Effect.succeed([computeHandler, halveComputeHandler, showUndoHandler]),
|
|
225
|
+
const invoker = OperationInvoker.make(
|
|
226
|
+
() => Effect.succeed([computeHandler, halveComputeHandler, showUndoHandler]),
|
|
227
|
+
testRuntime,
|
|
232
228
|
);
|
|
233
229
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
234
230
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
@@ -254,7 +250,7 @@ describe('HistoryTracker', () => {
|
|
|
254
250
|
Effect.gen(function* () {
|
|
255
251
|
// Dynamic message that depends on input/output.
|
|
256
252
|
const dynamicMessage = (input: { value: number }, output: { value: number }): [string, { ns: string }] => [
|
|
257
|
-
`computed
|
|
253
|
+
`computed-${input.value}-to-${output.value}`,
|
|
258
254
|
{ ns: 'test' },
|
|
259
255
|
];
|
|
260
256
|
const undoMapping = UndoMapping.make({
|
|
@@ -266,17 +262,15 @@ describe('HistoryTracker', () => {
|
|
|
266
262
|
|
|
267
263
|
let showUndoWasCalled = false;
|
|
268
264
|
let showUndoMessage: unknown = undefined;
|
|
269
|
-
const showUndoHandler =
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
showUndoMessage = input.message;
|
|
274
|
-
return Effect.succeed(undefined);
|
|
275
|
-
},
|
|
265
|
+
const showUndoHandler = Operation.withHandler(UndoOperation.ShowUndo, (input) => {
|
|
266
|
+
showUndoWasCalled = true;
|
|
267
|
+
showUndoMessage = input.message;
|
|
268
|
+
return Effect.succeed(undefined);
|
|
276
269
|
});
|
|
277
270
|
|
|
278
|
-
const invoker = OperationInvoker.make(
|
|
279
|
-
Effect.succeed([computeHandler, halveComputeHandler, showUndoHandler]),
|
|
271
|
+
const invoker = OperationInvoker.make(
|
|
272
|
+
() => Effect.succeed([computeHandler, halveComputeHandler, showUndoHandler]),
|
|
273
|
+
testRuntime,
|
|
280
274
|
);
|
|
281
275
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
282
276
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
@@ -295,7 +289,7 @@ describe('HistoryTracker', () => {
|
|
|
295
289
|
yield* waitUntil(() => showUndoWasCalled);
|
|
296
290
|
expect(showUndoWasCalled).toBe(true);
|
|
297
291
|
// Compute 2 * 2 = 4, so message should be 'computed 2 to 4'.
|
|
298
|
-
expect(showUndoMessage).toEqual(['computed
|
|
292
|
+
expect(showUndoMessage).toEqual(['computed-2-to-4', { ns: 'test' }]);
|
|
299
293
|
}),
|
|
300
294
|
);
|
|
301
295
|
|
|
@@ -314,7 +308,7 @@ describe('HistoryTracker', () => {
|
|
|
314
308
|
},
|
|
315
309
|
});
|
|
316
310
|
|
|
317
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]));
|
|
311
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]), testRuntime);
|
|
318
312
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
319
313
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
320
314
|
const collector = yield* createEventCollector(invoker);
|
|
@@ -352,7 +346,7 @@ describe('HistoryTracker', () => {
|
|
|
352
346
|
},
|
|
353
347
|
});
|
|
354
348
|
|
|
355
|
-
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]));
|
|
349
|
+
const invoker = OperationInvoker.make(() => Effect.succeed([computeHandler, halveComputeHandler]), testRuntime);
|
|
356
350
|
const undoRegistry = UndoRegistry.make(() => [undoMapping]);
|
|
357
351
|
const tracker = HistoryTracker.make(invoker, undoRegistry);
|
|
358
352
|
const collector = yield* createEventCollector(invoker);
|
|
@@ -7,10 +7,9 @@ import * as Stream from 'effect/Stream';
|
|
|
7
7
|
|
|
8
8
|
import { runAndForwardErrors } from '@dxos/effect';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
|
-
import {
|
|
10
|
+
import { OperationInvoker } from '@dxos/operation';
|
|
11
11
|
|
|
12
12
|
import { UndoOperation } from '../../common';
|
|
13
|
-
|
|
14
13
|
import { EmptyHistoryError } from './errors';
|
|
15
14
|
import type { HistoryEntry } from './types';
|
|
16
15
|
import { resolveMessage } from './undo-mapping';
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import { describe, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Compute, HalveCompute } from '../testing';
|
|
8
|
-
|
|
9
8
|
import * as UndoMapping from './undo-mapping';
|
|
10
9
|
import * as UndoRegistry from './undo-registry';
|
|
11
10
|
|
|
@@ -52,18 +51,18 @@ describe('resolveMessage', () => {
|
|
|
52
51
|
});
|
|
53
52
|
|
|
54
53
|
test('returns static label as-is', ({ expect }) => {
|
|
55
|
-
const staticMessage: [string, { ns: string }] = ['test
|
|
54
|
+
const staticMessage: [string, { ns: string }] = ['test.message', { ns: 'test' }];
|
|
56
55
|
const result = UndoMapping.resolveMessage(staticMessage, { value: 1 }, { value: 2 });
|
|
57
56
|
expect(result).toEqual(staticMessage);
|
|
58
57
|
});
|
|
59
58
|
|
|
60
59
|
test('calls function message with input and output', ({ expect }) => {
|
|
61
60
|
const messageFunc = (input: { value: number }, output: { value: number }): [string, { ns: string }] => [
|
|
62
|
-
`input
|
|
61
|
+
`input-${input.value}-output-${output.value}`,
|
|
63
62
|
{ ns: 'test' },
|
|
64
63
|
];
|
|
65
64
|
const result = UndoMapping.resolveMessage(messageFunc, { value: 5 }, { value: 10 });
|
|
66
|
-
expect(result).toEqual(['input
|
|
65
|
+
expect(result).toEqual(['input-5-output-10', { ns: 'test' }]);
|
|
67
66
|
});
|
|
68
67
|
|
|
69
68
|
test('returns string label as-is', ({ expect }) => {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
7
8
|
import { OperationInvoker } from '@dxos/operation';
|
|
8
9
|
|
|
9
10
|
import { ActivationEvents, Capabilities } from '../common';
|
|
@@ -20,17 +21,31 @@ export default Capability.makeModule(
|
|
|
20
21
|
const pluginManager = yield* Plugin.Service;
|
|
21
22
|
|
|
22
23
|
// Get the ManagedRuntime capability (should be available since we activate after ManagedRuntimeReady).
|
|
23
|
-
const
|
|
24
|
-
|
|
24
|
+
const managedRuntime = yield* Capability.get(Capabilities.ManagedRuntime);
|
|
25
|
+
|
|
26
|
+
// Cache the merged handler promise to prevent concurrent module loading.
|
|
27
|
+
// Multiple Effects can invoke getHandlers simultaneously; without caching each
|
|
28
|
+
// creates a new merge() which triggers parallel dynamic imports that race in
|
|
29
|
+
// WebKit's module evaluator, causing TDZ errors on export default bindings.
|
|
30
|
+
let cachedSets: readonly OperationHandlerSet.OperationHandlerSet[] | undefined;
|
|
31
|
+
let cachedHandlers: ReturnType<OperationHandlerSet.OperationHandlerSet['getHandlers']> | undefined;
|
|
25
32
|
|
|
26
33
|
const invoker = OperationInvoker.make(
|
|
27
34
|
() =>
|
|
28
35
|
Effect.gen(function* () {
|
|
29
|
-
yield* Plugin.activate(ActivationEvents.
|
|
30
|
-
|
|
36
|
+
yield* Plugin.activate(ActivationEvents.SetupOperationHandler);
|
|
37
|
+
const sets = yield* Capability.getAll(Capabilities.OperationHandler);
|
|
38
|
+
|
|
39
|
+
if (sets !== cachedSets) {
|
|
40
|
+
cachedSets = sets;
|
|
41
|
+
cachedHandlers = OperationHandlerSet.merge(...sets).getHandlers();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return yield* Effect.promise(() => cachedHandlers!);
|
|
31
45
|
}).pipe(
|
|
32
46
|
Effect.provideService(Capability.Service, capabilityManager),
|
|
33
47
|
Effect.provideService(Plugin.Service, pluginManager),
|
|
48
|
+
Effect.orDie,
|
|
34
49
|
),
|
|
35
50
|
managedRuntime,
|
|
36
51
|
);
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { type Plugin } from '../core';
|
|
6
6
|
|
|
7
7
|
export const meta: Plugin.Meta = {
|
|
8
|
-
id: 'dxos.
|
|
8
|
+
id: 'org.dxos.plugin.operation',
|
|
9
9
|
name: 'Operation Plugin',
|
|
10
10
|
description: 'Provides operation invocation, undo registry, and history tracking.',
|
|
11
|
+
tags: ['system'],
|
|
11
12
|
};
|
|
@@ -9,49 +9,40 @@ import * as Ref from 'effect/Ref';
|
|
|
9
9
|
import * as Schema from 'effect/Schema';
|
|
10
10
|
import * as Stream from 'effect/Stream';
|
|
11
11
|
|
|
12
|
-
import { Operation
|
|
12
|
+
import { Operation } from '@dxos/compute';
|
|
13
|
+
import { OperationInvoker } from '@dxos/operation';
|
|
13
14
|
|
|
14
15
|
//
|
|
15
16
|
// Test Operations
|
|
16
17
|
//
|
|
17
18
|
|
|
18
19
|
export const Compute = Operation.make({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
output: Schema.Struct({ value: Schema.Number }),
|
|
22
|
-
},
|
|
20
|
+
input: Schema.Struct({ value: Schema.Number }),
|
|
21
|
+
output: Schema.Struct({ value: Schema.Number }),
|
|
23
22
|
meta: { key: 'test.compute' },
|
|
24
23
|
});
|
|
25
24
|
|
|
26
25
|
export const HalveCompute = Operation.make({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
output: Schema.Struct({ value: Schema.Number }),
|
|
30
|
-
},
|
|
26
|
+
input: Schema.Struct({ value: Schema.Number }),
|
|
27
|
+
output: Schema.Struct({ value: Schema.Number }),
|
|
31
28
|
meta: { key: 'test.halve-compute' },
|
|
32
29
|
});
|
|
33
30
|
|
|
34
31
|
export const ToString = Operation.make({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
output: Schema.Struct({ string: Schema.String }),
|
|
38
|
-
},
|
|
32
|
+
input: Schema.Struct({ value: Schema.Number }),
|
|
33
|
+
output: Schema.Struct({ string: Schema.String }),
|
|
39
34
|
meta: { key: 'test.to-string' },
|
|
40
35
|
});
|
|
41
36
|
|
|
42
37
|
export const Add = Operation.make({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
output: Schema.Number,
|
|
46
|
-
},
|
|
38
|
+
input: Schema.Tuple(Schema.Number, Schema.Number),
|
|
39
|
+
output: Schema.Number,
|
|
47
40
|
meta: { key: 'test.add' },
|
|
48
41
|
});
|
|
49
42
|
|
|
50
43
|
export const SideEffect = Operation.make({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
output: Schema.Void,
|
|
54
|
-
},
|
|
44
|
+
input: Schema.Void,
|
|
45
|
+
output: Schema.Void,
|
|
55
46
|
meta: { key: 'test.side-effect' },
|
|
56
47
|
});
|
|
57
48
|
|
|
@@ -59,34 +50,24 @@ export const SideEffect = Operation.make({
|
|
|
59
50
|
// Test Handlers
|
|
60
51
|
//
|
|
61
52
|
|
|
62
|
-
export const computeHandler =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}),
|
|
69
|
-
});
|
|
53
|
+
export const computeHandler = Operation.withHandler(Compute, (data) =>
|
|
54
|
+
Effect.gen(function* () {
|
|
55
|
+
yield* Effect.sleep(data.value * 10);
|
|
56
|
+
return { value: data.value * 2 };
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
70
59
|
|
|
71
|
-
export const halveComputeHandler =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
60
|
+
export const halveComputeHandler = Operation.withHandler(HalveCompute, (data) =>
|
|
61
|
+
Effect.succeed({ value: data.value / 2 }),
|
|
62
|
+
);
|
|
75
63
|
|
|
76
|
-
export const toStringHandler =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
64
|
+
export const toStringHandler = Operation.withHandler(ToString, (data) =>
|
|
65
|
+
Effect.succeed({ string: data.value.toString() }),
|
|
66
|
+
);
|
|
80
67
|
|
|
81
|
-
export const addHandler =
|
|
82
|
-
operation: Add,
|
|
83
|
-
handler: (data) => Effect.succeed(data[0] + data[1]),
|
|
84
|
-
});
|
|
68
|
+
export const addHandler = Operation.withHandler(Add, (data) => Effect.succeed(data[0] + data[1]));
|
|
85
69
|
|
|
86
|
-
export const sideEffectHandler =
|
|
87
|
-
operation: SideEffect,
|
|
88
|
-
handler: () => Effect.succeed(undefined),
|
|
89
|
-
});
|
|
70
|
+
export const sideEffectHandler = Operation.withHandler(SideEffect, () => Effect.succeed(undefined));
|
|
90
71
|
|
|
91
72
|
//
|
|
92
73
|
// Test Utilities
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import { ActivationEvents } from '../common';
|
|
6
6
|
import { Capability, Plugin } from '../core';
|
|
7
|
-
|
|
8
7
|
import { meta } from './meta';
|
|
9
8
|
|
|
10
9
|
const ManagedRuntimeCapability = Capability.lazy('ManagedRuntime', () => import('./capability'));
|
|
@@ -12,8 +11,8 @@ const ManagedRuntimeCapability = Capability.lazy('ManagedRuntime', () => import(
|
|
|
12
11
|
export const RuntimePlugin = Plugin.define(meta).pipe(
|
|
13
12
|
Plugin.addModule({
|
|
14
13
|
activatesOn: ActivationEvents.Startup,
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
firesBeforeActivation: [ActivationEvents.SetupLayer],
|
|
15
|
+
firesAfterActivation: [ActivationEvents.ManagedRuntimeReady],
|
|
17
16
|
activate: ManagedRuntimeCapability,
|
|
18
17
|
}),
|
|
19
18
|
Plugin.make,
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { type Plugin } from '../core';
|
|
6
6
|
|
|
7
7
|
export const meta: Plugin.Meta = {
|
|
8
|
-
id: 'dxos.
|
|
8
|
+
id: 'org.dxos.plugin.runtime',
|
|
9
9
|
name: 'Runtime Plugin',
|
|
10
10
|
description: 'Provides a managed Effect runtime by composing contributed layers.',
|
|
11
|
+
tags: ['system'],
|
|
11
12
|
};
|