@dxos/app-framework 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8
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-5OFLR7J4.mjs +34 -0
- package/dist/lib/browser/capability-5OFLR7J4.mjs.map +7 -0
- package/dist/lib/browser/{capability-7PCNSWBT.mjs → capability-ZHQDZRP5.mjs} +15 -11
- package/dist/lib/browser/capability-ZHQDZRP5.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-272IPLHQ.mjs} +1 -1
- package/dist/lib/browser/{chunk-PKQT6C53.mjs.map → chunk-272IPLHQ.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-FMZN33N4.mjs → chunk-3VXJONTI.mjs} +304 -178
- package/dist/lib/browser/chunk-3VXJONTI.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XYNO72GQ.mjs → chunk-7AL6SKIV.mjs} +459 -477
- package/dist/lib/browser/chunk-7AL6SKIV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TCLLRCS3.mjs → chunk-GH3M2LIW.mjs} +10 -7
- package/dist/lib/browser/chunk-GH3M2LIW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7IQHKD4U.mjs → chunk-JGWCBVKJ.mjs} +2 -2
- package/dist/lib/browser/chunk-JGWCBVKJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-M5IC326L.mjs +34 -0
- package/dist/lib/browser/chunk-M5IC326L.mjs.map +7 -0
- package/dist/lib/browser/chunk-TGX63LTL.mjs +8 -0
- package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-TGX63LTL.mjs.map} +1 -1
- package/dist/lib/browser/chunk-TIEBZMTF.mjs +44 -0
- package/dist/lib/browser/chunk-TIEBZMTF.mjs.map +7 -0
- package/dist/lib/browser/chunk-WEBSGU5L.mjs +80 -0
- package/dist/lib/browser/chunk-WEBSGU5L.mjs.map +7 -0
- package/dist/lib/browser/chunk-YAFEA4GV.mjs +1 -0
- package/dist/lib/browser/{chunk-6Y7PZV72.mjs → chunk-YNFPIQGB.mjs} +2 -3
- package/dist/lib/browser/{chunk-6Y7PZV72.mjs.map → chunk-YNFPIQGB.mjs.map} +3 -3
- package/dist/lib/browser/cli/index.mjs +89 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/common/activation-events.mjs +23 -0
- package/dist/lib/browser/common/capabilities.mjs +45 -0
- package/dist/lib/browser/core/activation-event.mjs +1 -1
- package/dist/lib/browser/core/capability.mjs +1 -1
- package/dist/lib/browser/core/plugin-manager.mjs +4 -4
- package/dist/lib/browser/core/plugin.mjs +6 -4
- package/dist/lib/browser/index.mjs +37 -132
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{invoker-capability-SZRSTHEH.mjs → invoker-capability-YTTQ2OBB.mjs} +16 -12
- package/dist/lib/browser/invoker-capability-YTTQ2OBB.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +55 -34
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/{react → ui}/index.mjs +18 -19
- package/dist/lib/node-esm/capability-CRHZKL6T.mjs +35 -0
- package/dist/lib/node-esm/capability-CRHZKL6T.mjs.map +7 -0
- package/dist/lib/node-esm/{capability-CFLQ2QQU.mjs → capability-W5C5464H.mjs} +15 -11
- package/dist/lib/node-esm/capability-W5C5464H.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-663A54LQ.mjs → chunk-3D66SZHP.mjs} +2 -2
- package/dist/lib/node-esm/chunk-3D66SZHP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-6REV5DE7.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs.map → chunk-6REV5DE7.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-XYQTBFPA.mjs → chunk-CMDON4NG.mjs} +304 -178
- package/dist/lib/node-esm/chunk-CMDON4NG.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-FKE4Z3D6.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-FKE4Z3D6.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-6WXBT3EC.mjs → chunk-I7FZT4A7.mjs} +459 -477
- package/dist/lib/node-esm/chunk-I7FZT4A7.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-GT6OKM5I.mjs → chunk-LHCJGNXK.mjs} +10 -7
- package/dist/lib/node-esm/chunk-LHCJGNXK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NHXBSAQR.mjs +35 -0
- package/dist/lib/node-esm/chunk-NHXBSAQR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-STMXUEPO.mjs → chunk-SB5ODNPX.mjs} +2 -3
- package/dist/lib/node-esm/{chunk-STMXUEPO.mjs.map → chunk-SB5ODNPX.mjs.map} +3 -3
- package/dist/lib/node-esm/chunk-SCDGIGGU.mjs +45 -0
- package/dist/lib/node-esm/chunk-SCDGIGGU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SQICGJBW.mjs +81 -0
- package/dist/lib/node-esm/chunk-SQICGJBW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +2 -0
- package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +90 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/common/activation-events.mjs +24 -0
- package/dist/lib/node-esm/common/activation-events.mjs.map +7 -0
- package/dist/lib/node-esm/common/capabilities.mjs +46 -0
- package/dist/lib/node-esm/common/capabilities.mjs.map +7 -0
- package/dist/lib/node-esm/core/activation-event.mjs +1 -1
- package/dist/lib/node-esm/core/capability.mjs +1 -1
- package/dist/lib/node-esm/core/plugin-manager.mjs +4 -4
- package/dist/lib/node-esm/core/plugin.mjs +6 -4
- package/dist/lib/node-esm/index.mjs +37 -132
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{invoker-capability-PNMA5JOS.mjs → invoker-capability-BU26474T.mjs} +16 -12
- package/dist/lib/node-esm/invoker-capability-BU26474T.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +55 -34
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{react → ui}/index.mjs +18 -19
- package/dist/lib/node-esm/ui/index.mjs.map +7 -0
- package/dist/types/src/{cli.d.ts → cli/cli.d.ts} +2 -2
- package/dist/types/src/cli/cli.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/common/activation-events.d.ts +27 -0
- package/dist/types/src/common/activation-events.d.ts.map +1 -0
- package/dist/types/src/common/capabilities.d.ts +115 -0
- package/dist/types/src/common/capabilities.d.ts.map +1 -0
- package/dist/types/src/common/index.d.ts +4 -9
- package/dist/types/src/common/index.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +1 -348
- package/dist/types/src/common/operations.d.ts.map +1 -1
- package/dist/types/src/common/translations.d.ts +0 -9
- package/dist/types/src/common/translations.d.ts.map +1 -1
- package/dist/types/src/core/activation-event.d.ts +1 -1
- package/dist/types/src/core/capability.d.ts +7 -7
- package/dist/types/src/core/capability.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manager.d.ts +6 -0
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin.d.ts +6 -1
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/capability.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +11 -3
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts +2 -2
- package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/{react → ui/components/App}/App.d.ts +1 -1
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
- package/dist/types/src/{react/Surface.stories.d.ts → ui/components/App/App.stories.d.ts} +7 -2
- 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/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
- package/dist/types/src/{react → ui/components/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 +12 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
- package/dist/types/src/{react/App.stories.d.ts → ui/components/Surface/SurfaceComponent.stories.d.ts} +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/context.d.ts +5 -0
- package/dist/types/src/ui/components/Surface/context.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/index.d.ts +20 -0
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
- package/dist/types/src/{common/surface.d.ts → ui/components/Surface/types.d.ts} +20 -18
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
- package/dist/types/src/ui/components/index.d.ts +4 -0
- package/dist/types/src/ui/components/index.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/index.d.ts +7 -0
- package/dist/types/src/ui/hooks/index.d.ts.map +1 -0
- package/dist/types/src/{react → ui/hooks}/useApp.d.ts +14 -9
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -0
- 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/{react → ui/hooks}/useCapabilities.d.ts +6 -1
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
- package/dist/types/src/{react → ui/hooks}/useOperationResolver.d.ts +2 -2
- package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +1 -0
- package/dist/types/src/{react/common.d.ts → ui/hooks/useSettingsState.d.ts} +1 -5
- package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useSurface.d.ts +3 -0
- package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -0
- package/dist/types/src/ui/index.d.ts +3 -0
- package/dist/types/src/ui/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +6 -6
- package/package.json +72 -64
- package/src/{cli.ts → cli/cli.ts} +10 -10
- package/src/{playground/debug → cli}/index.ts +1 -1
- package/src/common/activation-events.ts +44 -0
- package/src/common/capabilities.ts +178 -0
- package/src/common/index.ts +4 -9
- package/src/common/operations.ts +2 -376
- package/src/common/translations.ts +0 -12
- package/src/context.ts +1 -1
- package/src/core/activation-event.ts +1 -1
- package/src/core/capability.ts +9 -9
- package/src/core/plugin-manager.test.ts +292 -44
- package/src/core/plugin-manager.ts +326 -154
- package/src/core/plugin.ts +10 -2
- package/src/index.ts +1 -3
- package/src/plugin-operation/OperationPlugin.ts +5 -5
- package/src/plugin-operation/history/capability.ts +5 -5
- package/src/plugin-operation/history/undo-mapping.ts +6 -3
- package/src/plugin-operation/invoker-capability.ts +5 -5
- package/src/plugin-operation/meta.ts +1 -1
- package/src/plugin-runtime/RuntimePlugin.ts +4 -4
- package/src/plugin-runtime/capability.ts +5 -5
- package/src/plugin-runtime/meta.ts +1 -1
- package/src/testing/service.ts +6 -6
- package/src/testing/withPluginManager.stories.tsx +6 -6
- package/src/testing/withPluginManager.tsx +46 -19
- package/src/ui/components/App/App.stories.tsx +92 -0
- package/src/{react → ui/components/App}/App.tsx +6 -9
- package/src/{playground/layout → ui/components/App}/index.ts +1 -1
- package/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.tsx +13 -14
- package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +1 -1
- package/src/ui/components/PluginManager/index.ts +5 -0
- package/src/{react/Surface.stories.tsx → ui/components/Surface/SurfaceComponent.stories.tsx} +18 -16
- package/src/{react/Surface.tsx → ui/components/Surface/SurfaceComponent.tsx} +36 -56
- package/src/{react → ui/components/Surface}/SurfaceInfo.tsx +2 -2
- package/src/ui/components/Surface/context.ts +12 -0
- package/src/ui/components/Surface/index.ts +20 -0
- package/src/{common/surface.ts → ui/components/Surface/types.ts} +22 -25
- package/src/ui/components/index.ts +7 -0
- package/src/ui/hooks/index.ts +10 -0
- package/src/ui/hooks/useApp.test.tsx +159 -0
- package/src/{react → ui/hooks}/useApp.tsx +39 -29
- package/src/{react → ui/hooks}/useCapabilities.ts +9 -5
- package/src/{react → ui/hooks}/useOperationResolver.ts +5 -5
- package/src/{react/common.ts → ui/hooks/useSettingsState.ts} +0 -11
- package/src/ui/hooks/useSurface.ts +13 -0
- package/src/ui/index.ts +6 -0
- package/tsconfig.json +2 -29
- package/tsconfig.node.json +1 -3
- package/typedoc.json +2 -4
- package/vitest.config.ts +1 -1
- package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs +0 -149
- package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs.map +0 -7
- package/dist/lib/browser/capability-7PCNSWBT.mjs.map +0 -7
- package/dist/lib/browser/capability-KP3PFEXD.mjs +0 -31
- package/dist/lib/browser/capability-KP3PFEXD.mjs.map +0 -7
- package/dist/lib/browser/chunk-7IQHKD4U.mjs.map +0 -7
- package/dist/lib/browser/chunk-BLQJSGL3.mjs +0 -732
- package/dist/lib/browser/chunk-BLQJSGL3.mjs.map +0 -7
- package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
- package/dist/lib/browser/chunk-FMZN33N4.mjs.map +0 -7
- package/dist/lib/browser/chunk-H4WPA7U7.mjs +0 -77
- package/dist/lib/browser/chunk-H4WPA7U7.mjs.map +0 -7
- package/dist/lib/browser/chunk-TCLLRCS3.mjs.map +0 -7
- package/dist/lib/browser/chunk-XYNO72GQ.mjs.map +0 -7
- package/dist/lib/browser/common/index.mjs +0 -38
- package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs +0 -64
- package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs +0 -150
- package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs.map +0 -7
- package/dist/lib/node-esm/capability-CFLQ2QQU.mjs.map +0 -7
- package/dist/lib/node-esm/capability-RCUNM2M7.mjs +0 -32
- package/dist/lib/node-esm/capability-RCUNM2M7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-663A54LQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6WXBT3EC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GQEBIGKD.mjs +0 -733
- package/dist/lib/node-esm/chunk-GQEBIGKD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GT6OKM5I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XR6NMKEP.mjs +0 -78
- package/dist/lib/node-esm/chunk-XR6NMKEP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XYQTBFPA.mjs.map +0 -7
- package/dist/lib/node-esm/common/index.mjs +0 -39
- package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs +0 -65
- package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs.map +0 -7
- package/dist/types/src/cli.d.ts.map +0 -1
- package/dist/types/src/common/activation-event.d.ts +0 -66
- package/dist/types/src/common/activation-event.d.ts.map +0 -1
- package/dist/types/src/common/capability.d.ts +0 -265
- package/dist/types/src/common/capability.d.ts.map +0 -1
- package/dist/types/src/common/collaboration.d.ts +0 -26
- package/dist/types/src/common/collaboration.d.ts.map +0 -1
- package/dist/types/src/common/file.d.ts +0 -14
- package/dist/types/src/common/file.d.ts.map +0 -1
- package/dist/types/src/common/graph.d.ts +0 -21
- package/dist/types/src/common/graph.d.ts.map +0 -1
- package/dist/types/src/common/plugin.d.ts +0 -201
- package/dist/types/src/common/plugin.d.ts.map +0 -1
- package/dist/types/src/common/surface.d.ts.map +0 -1
- package/dist/types/src/playground/debug/Debug.d.ts +0 -8
- package/dist/types/src/playground/debug/Debug.d.ts.map +0 -1
- package/dist/types/src/playground/debug/index.d.ts +0 -2
- package/dist/types/src/playground/debug/index.d.ts.map +0 -1
- package/dist/types/src/playground/debug/plugin.d.ts +0 -3
- package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Main.d.ts +0 -8
- package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts +0 -8
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
- package/dist/types/src/playground/generator/generator.d.ts +0 -19
- package/dist/types/src/playground/generator/generator.d.ts.map +0 -1
- package/dist/types/src/playground/generator/index.d.ts +0 -3
- package/dist/types/src/playground/generator/index.d.ts.map +0 -1
- package/dist/types/src/playground/generator/plugin.d.ts +0 -3
- package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/layout/Layout.d.ts +0 -10
- package/dist/types/src/playground/layout/Layout.d.ts.map +0 -1
- package/dist/types/src/playground/layout/index.d.ts +0 -2
- package/dist/types/src/playground/layout/index.d.ts.map +0 -1
- package/dist/types/src/playground/layout/plugin.d.ts +0 -3
- package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts +0 -8
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +0 -1
- package/dist/types/src/playground/logger/index.d.ts +0 -2
- package/dist/types/src/playground/logger/index.d.ts.map +0 -1
- package/dist/types/src/playground/logger/plugin.d.ts +0 -3
- package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/schema.d.ts +0 -27
- package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
- package/dist/types/src/playground/playground.stories.d.ts +0 -11
- package/dist/types/src/playground/playground.stories.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -3
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/actions.d.ts +0 -61
- package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -6
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/index.d.ts +0 -3
- package/dist/types/src/plugin-settings/index.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/meta.d.ts +0 -3
- package/dist/types/src/plugin-settings/meta.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/operation-resolver.d.ts +0 -6
- package/dist/types/src/plugin-settings/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/translations.d.ts +0 -11
- package/dist/types/src/plugin-settings/translations.d.ts.map +0 -1
- package/dist/types/src/react/App.d.ts.map +0 -1
- package/dist/types/src/react/App.stories.d.ts.map +0 -1
- package/dist/types/src/react/DefaultFallback.d.ts +0 -8
- package/dist/types/src/react/DefaultFallback.d.ts.map +0 -1
- package/dist/types/src/react/ErrorBoundary.d.ts +0 -30
- package/dist/types/src/react/ErrorBoundary.d.ts.map +0 -1
- package/dist/types/src/react/PluginManagerContext.stories.d.ts.map +0 -1
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
- package/dist/types/src/react/Surface.d.ts +0 -14
- package/dist/types/src/react/Surface.d.ts.map +0 -1
- package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
- package/dist/types/src/react/SurfaceInfo.d.ts.map +0 -1
- package/dist/types/src/react/common.d.ts.map +0 -1
- package/dist/types/src/react/index.d.ts +0 -9
- package/dist/types/src/react/index.d.ts.map +0 -1
- package/dist/types/src/react/types.d.ts +0 -12
- package/dist/types/src/react/types.d.ts.map +0 -1
- package/dist/types/src/react/useApp.d.ts.map +0 -1
- package/dist/types/src/react/useCapabilities.d.ts.map +0 -1
- package/dist/types/src/react/useLoading.d.ts.map +0 -1
- package/dist/types/src/react/useOperationResolver.d.ts.map +0 -1
- package/src/common/activation-event.ts +0 -99
- package/src/common/capability.ts +0 -343
- package/src/common/collaboration.ts +0 -31
- package/src/common/file.ts +0 -22
- package/src/common/graph.ts +0 -30
- package/src/common/plugin.ts +0 -364
- package/src/playground/debug/Debug.tsx +0 -49
- package/src/playground/debug/plugin.ts +0 -16
- package/src/playground/generator/Main.tsx +0 -80
- package/src/playground/generator/Toolbar.tsx +0 -57
- package/src/playground/generator/generator.ts +0 -48
- package/src/playground/generator/index.ts +0 -6
- package/src/playground/generator/plugin.ts +0 -21
- package/src/playground/layout/Layout.tsx +0 -37
- package/src/playground/layout/plugin.ts +0 -18
- package/src/playground/logger/Toolbar.tsx +0 -33
- package/src/playground/logger/index.ts +0 -5
- package/src/playground/logger/plugin.ts +0 -42
- package/src/playground/logger/schema.ts +0 -22
- package/src/playground/playground.stories.tsx +0 -54
- package/src/plugin-settings/SettingsPlugin.ts +0 -19
- package/src/plugin-settings/actions.ts +0 -64
- package/src/plugin-settings/app-graph-builder.ts +0 -140
- package/src/plugin-settings/index.ts +0 -6
- package/src/plugin-settings/meta.ts +0 -10
- package/src/plugin-settings/operation-resolver.ts +0 -55
- package/src/plugin-settings/translations.ts +0 -19
- package/src/react/App.stories.tsx +0 -63
- package/src/react/DefaultFallback.tsx +0 -26
- package/src/react/ErrorBoundary.tsx +0 -56
- package/src/react/index.ts +0 -14
- package/src/react/types.ts +0 -27
- /package/dist/lib/{node-esm/react/index.mjs.map → browser/chunk-YAFEA4GV.mjs.map} +0 -0
- /package/dist/lib/{node-esm/common/index.mjs.map → browser/common/activation-events.mjs.map} +0 -0
- /package/dist/lib/browser/{react/index.mjs.map → common/capabilities.mjs.map} +0 -0
- /package/dist/lib/browser/{common → ui}/index.mjs.map +0 -0
- /package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.d.ts +0 -0
- /package/dist/types/src/{react → ui/components/Surface}/SurfaceInfo.d.ts +0 -0
- /package/dist/types/src/{react → ui/hooks}/useLoading.d.ts +0 -0
- /package/src/{react → ui/hooks}/useLoading.tsx +0 -0
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { afterEach, assert, describe, it } from '@effect/vitest';
|
|
6
6
|
import { type Atom, Registry } from '@effect-atom/atom-react';
|
|
7
|
+
import * as Cause from 'effect/Cause';
|
|
8
|
+
import * as Exit from 'effect/Exit';
|
|
7
9
|
import * as Duration from 'effect/Duration';
|
|
8
10
|
import * as Effect from 'effect/Effect';
|
|
9
11
|
import * as Fiber from 'effect/Fiber';
|
|
@@ -15,7 +17,7 @@ import * as TestClock from 'effect/TestClock';
|
|
|
15
17
|
import { invariant } from '@dxos/invariant';
|
|
16
18
|
import { type LogConfig, type LogEntry, LogLevel, log } from '@dxos/log';
|
|
17
19
|
|
|
18
|
-
import
|
|
20
|
+
import { ActivationEvents } from '../common';
|
|
19
21
|
|
|
20
22
|
import * as ActivationEvent from './activation-event';
|
|
21
23
|
import * as Capability from './capability';
|
|
@@ -23,14 +25,14 @@ import type * as CapabilityManager from './capability-manager';
|
|
|
23
25
|
import * as Plugin from './plugin';
|
|
24
26
|
import * as PluginManager from './plugin-manager';
|
|
25
27
|
|
|
26
|
-
const String = Capability.make<{ string: string }>('dxos.
|
|
27
|
-
const Number = Capability.make<{ number: number }>('dxos.
|
|
28
|
-
const Total = Capability.make<{ total: number }>('dxos.
|
|
28
|
+
const String = Capability.make<{ string: string }>('org.dxos.test.string');
|
|
29
|
+
const Number = Capability.make<{ number: number }>('org.dxos.test.number');
|
|
30
|
+
const Total = Capability.make<{ total: number }>('org.dxos.test.total');
|
|
29
31
|
|
|
30
|
-
const CountEvent = ActivationEvent.make('dxos.
|
|
31
|
-
const FailEvent = ActivationEvent.make('dxos.
|
|
32
|
+
const CountEvent = ActivationEvent.make('org.dxos.test.count');
|
|
33
|
+
const FailEvent = ActivationEvent.make('org.dxos.test.fail');
|
|
32
34
|
|
|
33
|
-
const testMeta = { id: 'dxos.
|
|
35
|
+
const testMeta = { id: 'org.dxos.plugin.test', name: 'Test' };
|
|
34
36
|
|
|
35
37
|
// TODO(wittjosiah): Factor out?
|
|
36
38
|
const atomCounter = (registry: Registry.Registry, atom: Atom.Atom<any>) => {
|
|
@@ -89,12 +91,12 @@ describe('PluginManager', () => {
|
|
|
89
91
|
const TestPluginFactory = Plugin.define<TestPluginOptions>(testMeta).pipe(
|
|
90
92
|
Plugin.addModule((options: TestPluginOptions) => ({
|
|
91
93
|
id: 'Hello',
|
|
92
|
-
activatesOn:
|
|
94
|
+
activatesOn: ActivationEvents.Startup,
|
|
93
95
|
activate: () => Effect.succeed(Capability.contributes(String, { string: `hello-${options.count}` })),
|
|
94
96
|
})),
|
|
95
97
|
Plugin.addModule({
|
|
96
98
|
id: 'World',
|
|
97
|
-
activatesOn:
|
|
99
|
+
activatesOn: ActivationEvents.Startup,
|
|
98
100
|
activate: () => Effect.succeed(Capability.contributes(String, { string: 'world' })),
|
|
99
101
|
}),
|
|
100
102
|
Plugin.make,
|
|
@@ -105,7 +107,7 @@ describe('PluginManager', () => {
|
|
|
105
107
|
|
|
106
108
|
const manager = PluginManager.make({ plugins: [plugin], core: [], pluginLoader });
|
|
107
109
|
yield* manager.enable(testMeta.id);
|
|
108
|
-
yield* manager.activate(
|
|
110
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
109
111
|
const strings = manager.capabilities.getAll(String);
|
|
110
112
|
assert.strictEqual(strings.length, 2);
|
|
111
113
|
assert.strictEqual(strings[0].string, 'hello-5');
|
|
@@ -118,7 +120,7 @@ describe('PluginManager', () => {
|
|
|
118
120
|
const Test = Plugin.define(testMeta).pipe(
|
|
119
121
|
Plugin.addModule({
|
|
120
122
|
id: 'Hello',
|
|
121
|
-
activatesOn:
|
|
123
|
+
activatesOn: ActivationEvents.Startup,
|
|
122
124
|
activate: () => Effect.succeed(Capability.contributes(String, { string: 'hello' })),
|
|
123
125
|
}),
|
|
124
126
|
Plugin.make,
|
|
@@ -140,7 +142,7 @@ describe('PluginManager', () => {
|
|
|
140
142
|
const Test = Plugin.define(testMeta).pipe(
|
|
141
143
|
Plugin.addModule({
|
|
142
144
|
id: 'Hello',
|
|
143
|
-
activatesOn:
|
|
145
|
+
activatesOn: ActivationEvents.Startup,
|
|
144
146
|
activate: () => Effect.succeed(Capability.contributes(String, { string: 'hello' })),
|
|
145
147
|
}),
|
|
146
148
|
Plugin.make,
|
|
@@ -154,9 +156,9 @@ describe('PluginManager', () => {
|
|
|
154
156
|
assert.deepStrictEqual(manager.getModules(), [testPlugin.modules[0]]);
|
|
155
157
|
assert.deepStrictEqual(manager.getActive(), []);
|
|
156
158
|
assert.deepStrictEqual(manager.getEventsFired(), []);
|
|
157
|
-
yield* manager.activate(
|
|
159
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
158
160
|
assert.deepStrictEqual(manager.getActive(), [testPlugin.modules[0].id]);
|
|
159
|
-
assert.deepStrictEqual(manager.getEventsFired(), [
|
|
161
|
+
assert.deepStrictEqual(manager.getEventsFired(), [ActivationEvents.Startup.id]);
|
|
160
162
|
}),
|
|
161
163
|
);
|
|
162
164
|
|
|
@@ -165,7 +167,7 @@ describe('PluginManager', () => {
|
|
|
165
167
|
const Test = Plugin.define(testMeta).pipe(
|
|
166
168
|
Plugin.addModule({
|
|
167
169
|
id: 'NoCapabilities',
|
|
168
|
-
activatesOn:
|
|
170
|
+
activatesOn: ActivationEvents.Startup,
|
|
169
171
|
activate: Effect.fnUntraced(function* () {}),
|
|
170
172
|
}),
|
|
171
173
|
Plugin.make,
|
|
@@ -175,7 +177,7 @@ describe('PluginManager', () => {
|
|
|
175
177
|
const manager = PluginManager.make({ plugins: [testPlugin], pluginLoader });
|
|
176
178
|
yield* manager.enable(Test.meta.id);
|
|
177
179
|
|
|
178
|
-
const result = yield* manager.activate(
|
|
180
|
+
const result = yield* manager.activate(ActivationEvents.Startup);
|
|
179
181
|
assert.isTrue(result);
|
|
180
182
|
assert.deepStrictEqual(manager.getActive(), [testPlugin.modules[0].id]);
|
|
181
183
|
assert.strictEqual(manager.capabilities.getAll(String).length, 0);
|
|
@@ -204,7 +206,7 @@ describe('PluginManager', () => {
|
|
|
204
206
|
|
|
205
207
|
it.effect('should catch and log defects (synchronous throws) in module activation', () =>
|
|
206
208
|
Effect.gen(function* () {
|
|
207
|
-
const DefectEvent = ActivationEvent.make('dxos.
|
|
209
|
+
const DefectEvent = ActivationEvent.make('org.dxos.test.defect');
|
|
208
210
|
const capturedErrors: LogEntry[] = [];
|
|
209
211
|
const removeProcessor = log.addProcessor((_config: LogConfig, entry: LogEntry) => {
|
|
210
212
|
if (entry.level === LogLevel.ERROR) {
|
|
@@ -238,7 +240,7 @@ describe('PluginManager', () => {
|
|
|
238
240
|
const defectLog = capturedErrors.find(
|
|
239
241
|
(entry) =>
|
|
240
242
|
entry.message?.includes('module failed to activate') &&
|
|
241
|
-
entry.context?.module === 'dxos.
|
|
243
|
+
entry.context?.module === 'org.dxos.plugin.test.module.DefectInEffectSync',
|
|
242
244
|
);
|
|
243
245
|
assert.isNotNull(defectLog, 'Expected error log for defect');
|
|
244
246
|
assert.strictEqual(defectLog?.context?.isDefect, true, 'Expected isDefect to be true for synchronous throw');
|
|
@@ -249,7 +251,7 @@ describe('PluginManager', () => {
|
|
|
249
251
|
|
|
250
252
|
it.effect('should catch and log defects when activate throws before returning Effect', () =>
|
|
251
253
|
Effect.gen(function* () {
|
|
252
|
-
const DefectEvent = ActivationEvent.make('dxos.
|
|
254
|
+
const DefectEvent = ActivationEvent.make('org.dxos.test.defect-immediate');
|
|
253
255
|
const capturedErrors: LogEntry[] = [];
|
|
254
256
|
const removeProcessor = log.addProcessor((_config: LogConfig, entry: LogEntry) => {
|
|
255
257
|
if (entry.level === LogLevel.ERROR) {
|
|
@@ -284,7 +286,7 @@ describe('PluginManager', () => {
|
|
|
284
286
|
const defectLog = capturedErrors.find(
|
|
285
287
|
(entry) =>
|
|
286
288
|
entry.message?.includes('module failed to activate') &&
|
|
287
|
-
entry.context?.module === 'dxos.
|
|
289
|
+
entry.context?.module === 'org.dxos.plugin.test.module.DefectImmediate',
|
|
288
290
|
);
|
|
289
291
|
assert.isNotNull(defectLog, 'Expected error log for immediate defect');
|
|
290
292
|
assert.strictEqual(
|
|
@@ -303,7 +305,7 @@ describe('PluginManager', () => {
|
|
|
303
305
|
Plugin.define(testMeta).pipe(
|
|
304
306
|
Plugin.addModule({
|
|
305
307
|
id: 'Hello',
|
|
306
|
-
activatesOn:
|
|
308
|
+
activatesOn: ActivationEvents.Startup,
|
|
307
309
|
activate: () => Effect.succeed(Capability.contributes(String, { string: 'hello' })),
|
|
308
310
|
}),
|
|
309
311
|
Plugin.addModule({
|
|
@@ -339,7 +341,7 @@ describe('PluginManager', () => {
|
|
|
339
341
|
);
|
|
340
342
|
|
|
341
343
|
yield* manager.add(testMeta.id);
|
|
342
|
-
yield* manager.activate(
|
|
344
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
343
345
|
yield* activating.await;
|
|
344
346
|
yield* activated.await;
|
|
345
347
|
|
|
@@ -374,7 +376,7 @@ describe('PluginManager', () => {
|
|
|
374
376
|
const Test = Plugin.define(testMeta).pipe(
|
|
375
377
|
Plugin.addModule({
|
|
376
378
|
id: 'Hello',
|
|
377
|
-
activatesOn:
|
|
379
|
+
activatesOn: ActivationEvents.Startup,
|
|
378
380
|
activate: () => {
|
|
379
381
|
count++;
|
|
380
382
|
return Effect.succeed(Capability.contributes(String, { string: 'hello' }));
|
|
@@ -389,19 +391,19 @@ describe('PluginManager', () => {
|
|
|
389
391
|
|
|
390
392
|
{
|
|
391
393
|
yield* manager.add(testMeta.id);
|
|
392
|
-
const result = yield* manager.activate(
|
|
394
|
+
const result = yield* manager.activate(ActivationEvents.Startup);
|
|
393
395
|
assert.isTrue(result);
|
|
394
396
|
assert.deepStrictEqual(manager.getActive(), [testPlugin.modules[0].id]);
|
|
395
397
|
assert.strictEqual(count, 1);
|
|
396
398
|
}
|
|
397
399
|
|
|
398
400
|
{
|
|
399
|
-
const result = yield* manager.activate(
|
|
401
|
+
const result = yield* manager.activate(ActivationEvents.Startup);
|
|
400
402
|
assert.isFalse(result);
|
|
401
403
|
}
|
|
402
404
|
|
|
403
405
|
{
|
|
404
|
-
const result = yield* manager.reset(
|
|
406
|
+
const result = yield* manager.reset(ActivationEvents.Startup);
|
|
405
407
|
assert.isTrue(result);
|
|
406
408
|
assert.strictEqual(count, 2);
|
|
407
409
|
}
|
|
@@ -419,7 +421,7 @@ describe('PluginManager', () => {
|
|
|
419
421
|
|
|
420
422
|
it.effect('should be able to fire custom activation events', () =>
|
|
421
423
|
Effect.gen(function* () {
|
|
422
|
-
const Plugin1 = Plugin.define({ id: 'dxos.
|
|
424
|
+
const Plugin1 = Plugin.define({ id: 'org.dxos.test.plugin-1', name: 'Plugin 1' }).pipe(
|
|
423
425
|
Plugin.addModule({
|
|
424
426
|
activatesOn: CountEvent,
|
|
425
427
|
id: 'Plugin1',
|
|
@@ -427,7 +429,7 @@ describe('PluginManager', () => {
|
|
|
427
429
|
}),
|
|
428
430
|
Plugin.make,
|
|
429
431
|
);
|
|
430
|
-
const Plugin2 = Plugin.define({ id: 'dxos.
|
|
432
|
+
const Plugin2 = Plugin.define({ id: 'org.dxos.test.plugin-2', name: 'Plugin 2' }).pipe(
|
|
431
433
|
Plugin.addModule({
|
|
432
434
|
activatesOn: CountEvent,
|
|
433
435
|
id: 'Plugin2',
|
|
@@ -435,7 +437,7 @@ describe('PluginManager', () => {
|
|
|
435
437
|
}),
|
|
436
438
|
Plugin.make,
|
|
437
439
|
);
|
|
438
|
-
const Plugin3 = Plugin.define({ id: 'dxos.
|
|
440
|
+
const Plugin3 = Plugin.define({ id: 'org.dxos.test.plugin-3', name: 'Plugin 3' }).pipe(
|
|
439
441
|
Plugin.addModule({
|
|
440
442
|
activatesOn: CountEvent,
|
|
441
443
|
id: 'Plugin3',
|
|
@@ -477,7 +479,7 @@ describe('PluginManager', () => {
|
|
|
477
479
|
Effect.gen(function* () {
|
|
478
480
|
const Test = Plugin.define(testMeta).pipe(
|
|
479
481
|
Plugin.addModule({
|
|
480
|
-
activatesOn: ActivationEvent.allOf(
|
|
482
|
+
activatesOn: ActivationEvent.allOf(ActivationEvents.Startup, CountEvent),
|
|
481
483
|
id: 'Hello',
|
|
482
484
|
activate: () => {
|
|
483
485
|
return Effect.succeed(Capability.contributes(String, { string: 'hello' }));
|
|
@@ -493,7 +495,7 @@ describe('PluginManager', () => {
|
|
|
493
495
|
assert.strictEqual(manager.capabilities.getAll(String).length, 0);
|
|
494
496
|
|
|
495
497
|
yield* manager.add(testMeta.id);
|
|
496
|
-
yield* manager.activate(
|
|
498
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
497
499
|
assert.deepStrictEqual(manager.getActive(), []);
|
|
498
500
|
assert.strictEqual(manager.capabilities.getAll(String).length, 0);
|
|
499
501
|
|
|
@@ -509,7 +511,7 @@ describe('PluginManager', () => {
|
|
|
509
511
|
const Test = Plugin.define(testMeta).pipe(
|
|
510
512
|
Plugin.addModule({
|
|
511
513
|
id: 'Hello',
|
|
512
|
-
activatesOn: ActivationEvent.oneOf(
|
|
514
|
+
activatesOn: ActivationEvent.oneOf(ActivationEvents.Startup, CountEvent),
|
|
513
515
|
activate: () => {
|
|
514
516
|
count++;
|
|
515
517
|
return Effect.succeed(Capability.contributes(String, { string: 'hello' }));
|
|
@@ -531,7 +533,7 @@ describe('PluginManager', () => {
|
|
|
531
533
|
assert.strictEqual(manager.capabilities.getAll(String).length, 1);
|
|
532
534
|
assert.strictEqual(count, 1);
|
|
533
535
|
|
|
534
|
-
yield* manager.activate(
|
|
536
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
535
537
|
assert.deepStrictEqual(manager.getActive(), [testPlugin.modules[0].id]);
|
|
536
538
|
assert.strictEqual(manager.capabilities.getAll(String).length, 1);
|
|
537
539
|
assert.strictEqual(count, 1);
|
|
@@ -546,10 +548,10 @@ describe('PluginManager', () => {
|
|
|
546
548
|
state.total = numbers.reduce((acc: number, n: { number: number }) => acc + n.number, 0);
|
|
547
549
|
};
|
|
548
550
|
|
|
549
|
-
const Count = Plugin.define({ id: 'dxos.
|
|
551
|
+
const Count = Plugin.define({ id: 'org.dxos.test.count', name: 'Count' }).pipe(
|
|
550
552
|
Plugin.addModule({
|
|
551
553
|
id: 'Count',
|
|
552
|
-
activatesOn:
|
|
554
|
+
activatesOn: ActivationEvents.Startup,
|
|
553
555
|
activatesBefore: [CountEvent],
|
|
554
556
|
activate: Effect.fnUntraced(function* () {
|
|
555
557
|
const capabilityManager = yield* Capability.Service;
|
|
@@ -586,7 +588,7 @@ describe('PluginManager', () => {
|
|
|
586
588
|
{
|
|
587
589
|
yield* manager.add(Test.meta.id);
|
|
588
590
|
yield* manager.add(Count.meta.id);
|
|
589
|
-
yield* manager.activate(
|
|
591
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
590
592
|
assert.deepStrictEqual(manager.getActive(), [
|
|
591
593
|
...testPlugin.modules.map((m) => m.id),
|
|
592
594
|
countPlugin.modules[0].id,
|
|
@@ -626,7 +628,7 @@ describe('PluginManager', () => {
|
|
|
626
628
|
|
|
627
629
|
it.effect('should be reactive', () =>
|
|
628
630
|
Effect.gen(function* () {
|
|
629
|
-
const Plugin1 = Plugin.define({ id: 'dxos.
|
|
631
|
+
const Plugin1 = Plugin.define({ id: 'org.dxos.test.plugin-1', name: 'Plugin 1' }).pipe(
|
|
630
632
|
Plugin.addModule({
|
|
631
633
|
activatesOn: CountEvent,
|
|
632
634
|
id: 'Plugin1',
|
|
@@ -634,7 +636,7 @@ describe('PluginManager', () => {
|
|
|
634
636
|
}),
|
|
635
637
|
Plugin.make,
|
|
636
638
|
);
|
|
637
|
-
const Plugin2 = Plugin.define({ id: 'dxos.
|
|
639
|
+
const Plugin2 = Plugin.define({ id: 'org.dxos.test.plugin-2', name: 'Plugin 2' }).pipe(
|
|
638
640
|
Plugin.addModule({
|
|
639
641
|
activatesOn: CountEvent,
|
|
640
642
|
id: 'Plugin2',
|
|
@@ -642,7 +644,7 @@ describe('PluginManager', () => {
|
|
|
642
644
|
}),
|
|
643
645
|
Plugin.make,
|
|
644
646
|
);
|
|
645
|
-
const Plugin3 = Plugin.define({ id: 'dxos.
|
|
647
|
+
const Plugin3 = Plugin.define({ id: 'org.dxos.test.plugin-3', name: 'Plugin 3' }).pipe(
|
|
646
648
|
Plugin.addModule({
|
|
647
649
|
activatesOn: CountEvent,
|
|
648
650
|
id: 'Plugin3',
|
|
@@ -752,8 +754,8 @@ describe('PluginManager', () => {
|
|
|
752
754
|
}
|
|
753
755
|
});
|
|
754
756
|
|
|
755
|
-
const SlowEvent = ActivationEvent.make('dxos.
|
|
756
|
-
const SlowPlugin = Plugin.define({ id: 'dxos.
|
|
757
|
+
const SlowEvent = ActivationEvent.make('org.dxos.test.slow');
|
|
758
|
+
const SlowPlugin = Plugin.define({ id: 'org.dxos.test.slow-plugin', name: 'Slow Plugin' }).pipe(
|
|
757
759
|
Plugin.addModule({
|
|
758
760
|
id: 'SlowModule',
|
|
759
761
|
activatesOn: SlowEvent,
|
|
@@ -795,11 +797,11 @@ describe('PluginManager', () => {
|
|
|
795
797
|
it.effect('should prevent concurrent loads of the same module via semaphore', () =>
|
|
796
798
|
Effect.gen(function* () {
|
|
797
799
|
// Two different events that both can trigger the same module.
|
|
798
|
-
const EventA = ActivationEvent.make('dxos.
|
|
799
|
-
const EventB = ActivationEvent.make('dxos.
|
|
800
|
+
const EventA = ActivationEvent.make('org.dxos.test.event-a');
|
|
801
|
+
const EventB = ActivationEvent.make('org.dxos.test.event-b');
|
|
800
802
|
|
|
801
803
|
let activateCallCount = 0;
|
|
802
|
-
const ConcurrentPlugin = Plugin.define({ id: 'dxos.
|
|
804
|
+
const ConcurrentPlugin = Plugin.define({ id: 'org.dxos.test.concurrent-plugin', name: 'Concurrent Plugin' }).pipe(
|
|
803
805
|
Plugin.addModule({
|
|
804
806
|
id: 'ConcurrentModule',
|
|
805
807
|
// Module activates on either event - this allows two different events to race.
|
|
@@ -842,4 +844,250 @@ describe('PluginManager', () => {
|
|
|
842
844
|
assert.strictEqual(strings[0].string, 'concurrent');
|
|
843
845
|
}),
|
|
844
846
|
);
|
|
847
|
+
|
|
848
|
+
it.effect('should deactivate all active modules on shutdown', () =>
|
|
849
|
+
Effect.gen(function* () {
|
|
850
|
+
const Plugin1 = Plugin.define({ id: 'org.dxos.test.plugin-1', name: 'Plugin 1' }).pipe(
|
|
851
|
+
Plugin.addModule({
|
|
852
|
+
activatesOn: ActivationEvents.Startup,
|
|
853
|
+
id: 'Plugin1',
|
|
854
|
+
activate: () => Effect.succeed(Capability.contributes(String, { string: 'hello' })),
|
|
855
|
+
}),
|
|
856
|
+
Plugin.make,
|
|
857
|
+
);
|
|
858
|
+
const Plugin2 = Plugin.define({ id: 'org.dxos.test.plugin-2', name: 'Plugin 2' }).pipe(
|
|
859
|
+
Plugin.addModule({
|
|
860
|
+
activatesOn: ActivationEvents.Startup,
|
|
861
|
+
id: 'Plugin2',
|
|
862
|
+
activate: () => Effect.succeed(Capability.contributes(Number, { number: 42 })),
|
|
863
|
+
}),
|
|
864
|
+
Plugin.make,
|
|
865
|
+
);
|
|
866
|
+
const plugin1 = Plugin1();
|
|
867
|
+
const plugin2 = Plugin2();
|
|
868
|
+
plugins = [plugin1, plugin2];
|
|
869
|
+
|
|
870
|
+
const manager = PluginManager.make({ pluginLoader });
|
|
871
|
+
yield* manager.add(Plugin1.meta.id);
|
|
872
|
+
yield* manager.add(Plugin2.meta.id);
|
|
873
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
874
|
+
assert.strictEqual(manager.getActive().length, 2);
|
|
875
|
+
assert.strictEqual(manager.capabilities.getAll(String).length, 1);
|
|
876
|
+
assert.strictEqual(manager.capabilities.getAll(Number).length, 1);
|
|
877
|
+
|
|
878
|
+
const result = yield* manager.shutdown();
|
|
879
|
+
assert.isTrue(result);
|
|
880
|
+
assert.deepStrictEqual(manager.getActive(), []);
|
|
881
|
+
assert.strictEqual(manager.capabilities.getAll(String).length, 0);
|
|
882
|
+
assert.strictEqual(manager.capabilities.getAll(Number).length, 0);
|
|
883
|
+
}),
|
|
884
|
+
);
|
|
885
|
+
|
|
886
|
+
it.effect('should run capability deactivate hooks during shutdown', () =>
|
|
887
|
+
Effect.gen(function* () {
|
|
888
|
+
let deactivated = false;
|
|
889
|
+
const Test = Plugin.define(testMeta).pipe(
|
|
890
|
+
Plugin.addModule({
|
|
891
|
+
id: 'WithDeactivate',
|
|
892
|
+
activatesOn: ActivationEvents.Startup,
|
|
893
|
+
activate: () =>
|
|
894
|
+
Effect.succeed(
|
|
895
|
+
Capability.contributes(String, { string: 'hello' }, () =>
|
|
896
|
+
Effect.sync(() => {
|
|
897
|
+
deactivated = true;
|
|
898
|
+
}),
|
|
899
|
+
),
|
|
900
|
+
),
|
|
901
|
+
}),
|
|
902
|
+
Plugin.make,
|
|
903
|
+
);
|
|
904
|
+
const testPlugin = Test();
|
|
905
|
+
plugins = [testPlugin];
|
|
906
|
+
|
|
907
|
+
const manager = PluginManager.make({ pluginLoader });
|
|
908
|
+
yield* manager.add(testMeta.id);
|
|
909
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
910
|
+
assert.isFalse(deactivated);
|
|
911
|
+
|
|
912
|
+
yield* manager.shutdown();
|
|
913
|
+
assert.isTrue(deactivated);
|
|
914
|
+
}),
|
|
915
|
+
);
|
|
916
|
+
|
|
917
|
+
it.effect('should deactivate modules in reverse activation order during shutdown', () =>
|
|
918
|
+
Effect.gen(function* () {
|
|
919
|
+
const deactivationOrder: string[] = [];
|
|
920
|
+
const Plugin1 = Plugin.define({ id: 'org.dxos.test.plugin-1', name: 'Plugin 1' }).pipe(
|
|
921
|
+
Plugin.addModule({
|
|
922
|
+
activatesOn: ActivationEvents.Startup,
|
|
923
|
+
id: 'First',
|
|
924
|
+
activate: () =>
|
|
925
|
+
Effect.succeed(
|
|
926
|
+
Capability.contributes(String, { string: 'first' }, () =>
|
|
927
|
+
Effect.sync(() => {
|
|
928
|
+
deactivationOrder.push('First');
|
|
929
|
+
}),
|
|
930
|
+
),
|
|
931
|
+
),
|
|
932
|
+
}),
|
|
933
|
+
Plugin.make,
|
|
934
|
+
);
|
|
935
|
+
const Plugin2 = Plugin.define({ id: 'org.dxos.test.plugin-2', name: 'Plugin 2' }).pipe(
|
|
936
|
+
Plugin.addModule({
|
|
937
|
+
activatesOn: ActivationEvents.Startup,
|
|
938
|
+
id: 'Second',
|
|
939
|
+
activate: () =>
|
|
940
|
+
Effect.succeed(
|
|
941
|
+
Capability.contributes(Number, { number: 2 }, () =>
|
|
942
|
+
Effect.sync(() => {
|
|
943
|
+
deactivationOrder.push('Second');
|
|
944
|
+
}),
|
|
945
|
+
),
|
|
946
|
+
),
|
|
947
|
+
}),
|
|
948
|
+
Plugin.make,
|
|
949
|
+
);
|
|
950
|
+
plugins = [Plugin1(), Plugin2()];
|
|
951
|
+
|
|
952
|
+
const manager = PluginManager.make({ pluginLoader });
|
|
953
|
+
yield* manager.add(Plugin1.meta.id);
|
|
954
|
+
yield* manager.add(Plugin2.meta.id);
|
|
955
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
956
|
+
|
|
957
|
+
yield* manager.shutdown();
|
|
958
|
+
assert.deepStrictEqual(deactivationOrder, ['Second', 'First']);
|
|
959
|
+
}),
|
|
960
|
+
);
|
|
961
|
+
|
|
962
|
+
it.effect('should clear lifecycle bookkeeping during shutdown', () =>
|
|
963
|
+
Effect.gen(function* () {
|
|
964
|
+
const Test = Plugin.define(testMeta).pipe(
|
|
965
|
+
Plugin.addModule({
|
|
966
|
+
id: 'Hello',
|
|
967
|
+
activatesOn: ActivationEvents.Startup,
|
|
968
|
+
activate: () => Effect.succeed(Capability.contributes(String, { string: 'hello' })),
|
|
969
|
+
}),
|
|
970
|
+
Plugin.make,
|
|
971
|
+
);
|
|
972
|
+
const testPlugin = Test();
|
|
973
|
+
plugins = [testPlugin];
|
|
974
|
+
|
|
975
|
+
const manager = PluginManager.make({ pluginLoader });
|
|
976
|
+
yield* manager.add(testMeta.id);
|
|
977
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
978
|
+
assert.isTrue(manager.getEventsFired().length > 0);
|
|
979
|
+
|
|
980
|
+
yield* manager.shutdown();
|
|
981
|
+
assert.deepStrictEqual(manager.getEventsFired(), []);
|
|
982
|
+
assert.deepStrictEqual(manager.getPendingReset(), []);
|
|
983
|
+
assert.deepStrictEqual(manager.getActive(), []);
|
|
984
|
+
}),
|
|
985
|
+
);
|
|
986
|
+
|
|
987
|
+
it.effect('should interrupt in-flight activation during shutdown', () =>
|
|
988
|
+
Effect.gen(function* () {
|
|
989
|
+
const activationStarted = yield* Effect.makeLatch(false);
|
|
990
|
+
const allowActivationToComplete = yield* Effect.makeLatch(false);
|
|
991
|
+
const Test = Plugin.define(testMeta).pipe(
|
|
992
|
+
Plugin.addModule({
|
|
993
|
+
id: 'Hello',
|
|
994
|
+
activatesOn: ActivationEvents.Startup,
|
|
995
|
+
activate: () =>
|
|
996
|
+
Effect.gen(function* () {
|
|
997
|
+
yield* activationStarted.open;
|
|
998
|
+
yield* allowActivationToComplete.await;
|
|
999
|
+
return Capability.contributes(String, { string: 'hello' });
|
|
1000
|
+
}),
|
|
1001
|
+
}),
|
|
1002
|
+
Plugin.make,
|
|
1003
|
+
);
|
|
1004
|
+
const testPlugin = Test();
|
|
1005
|
+
plugins = [testPlugin];
|
|
1006
|
+
|
|
1007
|
+
const manager = PluginManager.make({ pluginLoader });
|
|
1008
|
+
yield* manager.add(testMeta.id);
|
|
1009
|
+
|
|
1010
|
+
const activationFiber = yield* Effect.fork(manager.activate(ActivationEvents.Startup));
|
|
1011
|
+
yield* activationStarted.await;
|
|
1012
|
+
|
|
1013
|
+
const shutdownFiber = yield* Effect.fork(manager.shutdown());
|
|
1014
|
+
yield* allowActivationToComplete.open;
|
|
1015
|
+
|
|
1016
|
+
const shutdownResult = yield* Fiber.join(shutdownFiber);
|
|
1017
|
+
const activationExit = yield* Fiber.await(activationFiber);
|
|
1018
|
+
|
|
1019
|
+
assert.isTrue(shutdownResult);
|
|
1020
|
+
assert.isTrue(Exit.isFailure(activationExit));
|
|
1021
|
+
if (Exit.isFailure(activationExit)) {
|
|
1022
|
+
assert.isTrue(Cause.isInterruptedOnly(activationExit.cause));
|
|
1023
|
+
}
|
|
1024
|
+
assert.strictEqual(manager.capabilities.getAll(String).length, 0);
|
|
1025
|
+
assert.deepStrictEqual(manager.getActive(), []);
|
|
1026
|
+
assert.deepStrictEqual(manager.getEventsFired(), []);
|
|
1027
|
+
}),
|
|
1028
|
+
);
|
|
1029
|
+
|
|
1030
|
+
it.effect('should preserve plugins, core, enabled, and modules after shutdown', () =>
|
|
1031
|
+
Effect.gen(function* () {
|
|
1032
|
+
const Test = Plugin.define(testMeta).pipe(
|
|
1033
|
+
Plugin.addModule({
|
|
1034
|
+
id: 'Hello',
|
|
1035
|
+
activatesOn: ActivationEvents.Startup,
|
|
1036
|
+
activate: () => Effect.succeed(Capability.contributes(String, { string: 'hello' })),
|
|
1037
|
+
}),
|
|
1038
|
+
Plugin.make,
|
|
1039
|
+
);
|
|
1040
|
+
const testPlugin = Test();
|
|
1041
|
+
plugins = [testPlugin];
|
|
1042
|
+
|
|
1043
|
+
const manager = PluginManager.make({ pluginLoader });
|
|
1044
|
+
yield* manager.add(testMeta.id);
|
|
1045
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
1046
|
+
|
|
1047
|
+
const pluginsBefore = manager.getPlugins();
|
|
1048
|
+
const coreBefore = manager.getCore();
|
|
1049
|
+
const enabledBefore = manager.getEnabled();
|
|
1050
|
+
const modulesBefore = manager.getModules();
|
|
1051
|
+
|
|
1052
|
+
yield* manager.shutdown();
|
|
1053
|
+
|
|
1054
|
+
assert.deepStrictEqual(manager.getPlugins(), pluginsBefore);
|
|
1055
|
+
assert.deepStrictEqual(manager.getCore(), coreBefore);
|
|
1056
|
+
assert.deepStrictEqual(manager.getEnabled(), enabledBefore);
|
|
1057
|
+
assert.deepStrictEqual(manager.getModules(), modulesBefore);
|
|
1058
|
+
}),
|
|
1059
|
+
);
|
|
1060
|
+
|
|
1061
|
+
it.effect('should allow re-activation after shutdown', () =>
|
|
1062
|
+
Effect.gen(function* () {
|
|
1063
|
+
let activateCount = 0;
|
|
1064
|
+
const Test = Plugin.define(testMeta).pipe(
|
|
1065
|
+
Plugin.addModule({
|
|
1066
|
+
id: 'Hello',
|
|
1067
|
+
activatesOn: ActivationEvents.Startup,
|
|
1068
|
+
activate: () => {
|
|
1069
|
+
activateCount++;
|
|
1070
|
+
return Effect.succeed(Capability.contributes(String, { string: 'hello' }));
|
|
1071
|
+
},
|
|
1072
|
+
}),
|
|
1073
|
+
Plugin.make,
|
|
1074
|
+
);
|
|
1075
|
+
const testPlugin = Test();
|
|
1076
|
+
plugins = [testPlugin];
|
|
1077
|
+
|
|
1078
|
+
const manager = PluginManager.make({ pluginLoader });
|
|
1079
|
+
yield* manager.add(testMeta.id);
|
|
1080
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
1081
|
+
assert.strictEqual(activateCount, 1);
|
|
1082
|
+
assert.deepStrictEqual(manager.getActive(), [testPlugin.modules[0].id]);
|
|
1083
|
+
|
|
1084
|
+
yield* manager.shutdown();
|
|
1085
|
+
assert.deepStrictEqual(manager.getActive(), []);
|
|
1086
|
+
|
|
1087
|
+
yield* manager.activate(ActivationEvents.Startup);
|
|
1088
|
+
assert.strictEqual(activateCount, 2);
|
|
1089
|
+
assert.deepStrictEqual(manager.getActive(), [testPlugin.modules[0].id]);
|
|
1090
|
+
assert.strictEqual(manager.capabilities.getAll(String).length, 1);
|
|
1091
|
+
}),
|
|
1092
|
+
);
|
|
845
1093
|
});
|