@dxos/plugin-space 0.8.4-main.84f28bd → 0.8.4-main.c1de068
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/lib/browser/CollectionMain-D2B75XBS.mjs +31 -0
- package/dist/lib/browser/CollectionMain-D2B75XBS.mjs.map +7 -0
- package/dist/lib/browser/ObjectDetailsPanel-YPTDQKMG.mjs +88 -0
- package/dist/lib/browser/ObjectDetailsPanel-YPTDQKMG.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-PMDF6PJV.mjs → app-graph-builder-7CZZJS3S.mjs} +138 -22
- package/dist/lib/browser/app-graph-builder-7CZZJS3S.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-serializer-UKYMBX4O.mjs → app-graph-serializer-H6AW7KGS.mjs} +4 -4
- package/dist/lib/browser/{chunk-XXIPJLJF.mjs → chunk-CEFHNVU7.mjs} +2 -1
- package/dist/lib/browser/chunk-CEFHNVU7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-C7KGJTAL.mjs → chunk-JS3MMC42.mjs} +2 -1
- package/dist/lib/browser/{chunk-C7KGJTAL.mjs.map → chunk-JS3MMC42.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-6VLSHG4A.mjs → chunk-QACNNDOT.mjs} +64 -3
- package/dist/lib/browser/chunk-QACNNDOT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-S6NY637J.mjs → chunk-SGTQ52SU.mjs} +57 -3
- package/dist/lib/browser/chunk-SGTQ52SU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GVTXQCIW.mjs → chunk-V7MJSSBQ.mjs} +355 -286
- package/dist/lib/browser/chunk-V7MJSSBQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WBSEOLEM.mjs → chunk-XUYKJUU7.mjs} +124 -21
- package/dist/lib/browser/chunk-XUYKJUU7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +98 -9
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-WK5WYFH3.mjs → intent-resolver-TIXVDYN7.mjs} +164 -14
- package/dist/lib/browser/intent-resolver-TIXVDYN7.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-7S6FIC5G.mjs → react-root-N2J7TDRX.mjs} +5 -5
- package/dist/lib/browser/{react-surface-6C3YJNDK.mjs → react-surface-TPNLWJJH.mjs} +35 -14
- package/dist/lib/browser/react-surface-TPNLWJJH.mjs.map +7 -0
- package/dist/lib/browser/{schema-defs-K3B3OAH4.mjs → schema-defs-Z6FC4AHC.mjs} +2 -2
- package/dist/lib/browser/{settings-XNWYRWNM.mjs → settings-4IMP5RYT.mjs} +2 -2
- package/dist/lib/browser/{spaces-ready-K7NSNBHM.mjs → spaces-ready-TOPG6IV4.mjs} +4 -4
- package/dist/lib/browser/{state-522XTUR4.mjs → state-QYZAB45H.mjs} +2 -2
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/CollectionMain-ZJIFCWKZ.mjs +32 -0
- package/dist/lib/node-esm/CollectionMain-ZJIFCWKZ.mjs.map +7 -0
- package/dist/lib/node-esm/ObjectDetailsPanel-QKZEDSZK.mjs +89 -0
- package/dist/lib/node-esm/ObjectDetailsPanel-QKZEDSZK.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-TO72W6MI.mjs → app-graph-builder-KGIGWC72.mjs} +138 -22
- package/dist/lib/node-esm/app-graph-builder-KGIGWC72.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-serializer-LA3IZDXJ.mjs → app-graph-serializer-2ICUGQQT.mjs} +4 -4
- package/dist/lib/node-esm/{chunk-HJJHLWKY.mjs → chunk-4AOMYKDE.mjs} +124 -21
- package/dist/lib/node-esm/chunk-4AOMYKDE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-72QMMRKC.mjs → chunk-5HHYE264.mjs} +2 -1
- package/dist/lib/node-esm/{chunk-72QMMRKC.mjs.map → chunk-5HHYE264.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-AT7LGFER.mjs → chunk-5T3ZH23B.mjs} +2 -1
- package/dist/lib/node-esm/chunk-5T3ZH23B.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OUBADVJE.mjs → chunk-6X5DLJM5.mjs} +355 -286
- package/dist/lib/node-esm/chunk-6X5DLJM5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2THX6G4C.mjs → chunk-JH6F4C3I.mjs} +57 -3
- package/dist/lib/node-esm/chunk-JH6F4C3I.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SXD6T2N4.mjs → chunk-P442DOQ3.mjs} +64 -3
- package/dist/lib/node-esm/chunk-P442DOQ3.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +98 -9
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-HSR27ME4.mjs → intent-resolver-MHGHRGDT.mjs} +164 -14
- package/dist/lib/node-esm/intent-resolver-MHGHRGDT.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-root-HUK3ANLV.mjs → react-root-KW3TGJGY.mjs} +5 -5
- package/dist/lib/node-esm/{react-surface-AGAWX7DD.mjs → react-surface-UUIUUD6P.mjs} +35 -14
- package/dist/lib/node-esm/react-surface-UUIUUD6P.mjs.map +7 -0
- package/dist/lib/node-esm/{schema-defs-4MCDG4DV.mjs → schema-defs-WHJM7UZE.mjs} +2 -2
- package/dist/lib/node-esm/{settings-YGKHGFPH.mjs → settings-SAOBPND3.mjs} +2 -2
- package/dist/lib/node-esm/{spaces-ready-UM2P3DCR.mjs → spaces-ready-HIUKNDZK.mjs} +4 -4
- package/dist/lib/node-esm/{state-C4IOXPZP.mjs → state-ZVEHQ4BJ.mjs} +2 -2
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +9 -3
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/AwaitingObject.d.ts.map +1 -1
- package/dist/types/src/components/CollectionMain.d.ts +1 -0
- package/dist/types/src/components/CollectionMain.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts +3 -2
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
- package/dist/types/src/components/MembersContainer.d.ts.map +1 -1
- package/dist/types/src/components/MenuFooter.d.ts.map +1 -1
- package/dist/types/src/components/ObjectDetailsPanel.d.ts +9 -0
- package/dist/types/src/components/ObjectDetailsPanel.d.ts.map +1 -0
- package/dist/types/src/components/PersistenceStatus.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.d.ts +1 -1
- package/dist/types/src/components/SyncStatus/status.d.ts +5 -5
- package/dist/types/src/components/ViewEditor.d.ts +8 -0
- package/dist/types/src/components/ViewEditor.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +8 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -0
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +61 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +82 -2
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +27 -2
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +47 -49
- package/src/SpacePlugin.ts +87 -4
- package/src/capabilities/app-graph-builder.ts +165 -5
- package/src/capabilities/capabilities.ts +8 -3
- package/src/capabilities/intent-resolver.ts +114 -5
- package/src/capabilities/react-surface.tsx +47 -10
- package/src/components/AwaitingObject.tsx +4 -6
- package/src/components/CollectionMain.tsx +2 -0
- package/src/components/CreateDialog/CreateObjectDialog.tsx +29 -25
- package/src/components/MembersContainer.tsx +5 -3
- package/src/components/MenuFooter.tsx +2 -3
- package/src/components/ObjectDetailsPanel.tsx +77 -0
- package/src/components/PersistenceStatus.tsx +5 -6
- package/src/components/PopoverRenameObject.tsx +2 -2
- package/src/components/SyncStatus/SyncStatus.tsx +1 -1
- package/src/components/SyncStatus/status.ts +4 -4
- package/src/components/ViewEditor.tsx +64 -0
- package/src/components/index.ts +6 -1
- package/src/events.ts +1 -0
- package/src/translations.ts +62 -0
- package/src/types/types.ts +56 -3
- package/src/util.tsx +115 -20
- package/dist/lib/browser/app-graph-builder-PMDF6PJV.mjs.map +0 -7
- package/dist/lib/browser/chunk-6VLSHG4A.mjs.map +0 -7
- package/dist/lib/browser/chunk-GVTXQCIW.mjs.map +0 -7
- package/dist/lib/browser/chunk-S6NY637J.mjs.map +0 -7
- package/dist/lib/browser/chunk-WBSEOLEM.mjs.map +0 -7
- package/dist/lib/browser/chunk-XXIPJLJF.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-WK5WYFH3.mjs.map +0 -7
- package/dist/lib/browser/react-surface-6C3YJNDK.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-TO72W6MI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2THX6G4C.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AT7LGFER.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HJJHLWKY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OUBADVJE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SXD6T2N4.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-HSR27ME4.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-AGAWX7DD.mjs.map +0 -7
- /package/dist/lib/browser/{app-graph-serializer-UKYMBX4O.mjs.map → app-graph-serializer-H6AW7KGS.mjs.map} +0 -0
- /package/dist/lib/browser/{react-root-7S6FIC5G.mjs.map → react-root-N2J7TDRX.mjs.map} +0 -0
- /package/dist/lib/browser/{schema-defs-K3B3OAH4.mjs.map → schema-defs-Z6FC4AHC.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-XNWYRWNM.mjs.map → settings-4IMP5RYT.mjs.map} +0 -0
- /package/dist/lib/browser/{spaces-ready-K7NSNBHM.mjs.map → spaces-ready-TOPG6IV4.mjs.map} +0 -0
- /package/dist/lib/browser/{state-522XTUR4.mjs.map → state-QYZAB45H.mjs.map} +0 -0
- /package/dist/lib/node-esm/{app-graph-serializer-LA3IZDXJ.mjs.map → app-graph-serializer-2ICUGQQT.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-root-HUK3ANLV.mjs.map → react-root-KW3TGJGY.mjs.map} +0 -0
- /package/dist/lib/node-esm/{schema-defs-4MCDG4DV.mjs.map → schema-defs-WHJM7UZE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-YGKHGFPH.mjs.map → settings-SAOBPND3.mjs.map} +0 -0
- /package/dist/lib/node-esm/{spaces-ready-UM2P3DCR.mjs.map → spaces-ready-HIUKNDZK.mjs.map} +0 -0
- /package/dist/lib/node-esm/{state-C4IOXPZP.mjs.map → state-ZVEHQ4BJ.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-space",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.c1de068",
|
|
4
4
|
"description": "DXOS Surface plugin for DXOS ECHO Spaces",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -36,75 +36,73 @@
|
|
|
36
36
|
"@automerge/automerge": "3.0.0",
|
|
37
37
|
"@preact-signals/safe-react": "^0.9.0",
|
|
38
38
|
"@preact/signals-core": "^1.9.0",
|
|
39
|
-
"effect": "3.
|
|
39
|
+
"effect": "3.17.0",
|
|
40
40
|
"jszip": "^3.10.1",
|
|
41
41
|
"localforage": "^1.10.0",
|
|
42
42
|
"react-drag-drop-files": "^2.3.8",
|
|
43
43
|
"react-is": "~18.2.0",
|
|
44
44
|
"react-qr-rounded": "^1.0.0",
|
|
45
|
-
"@dxos/ai": "0.8.4-main.
|
|
46
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/client": "0.8.4-main.
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/echo-schema": "0.8.4-main.
|
|
54
|
-
"@dxos/echo-signals": "0.8.4-main.
|
|
55
|
-
"@dxos/effect": "0.8.4-main.
|
|
56
|
-
"@dxos/invariant": "0.8.4-main.
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/local-storage": "0.8.4-main.
|
|
60
|
-
"@dxos/log": "0.8.4-main.
|
|
61
|
-
"@dxos/migrations": "0.8.4-main.
|
|
62
|
-
"@dxos/plugin-
|
|
63
|
-
"@dxos/plugin-
|
|
64
|
-
"@dxos/plugin-
|
|
65
|
-
"@dxos/plugin-
|
|
66
|
-
"@dxos/plugin-
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/react-
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/react-ui-
|
|
72
|
-
"@dxos/react-ui-
|
|
73
|
-
"@dxos/react-ui-list": "0.8.4-main.
|
|
74
|
-
"@dxos/react-ui-
|
|
75
|
-
"@dxos/react-ui-
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.
|
|
78
|
-
"@dxos/react-ui-tabs": "0.8.4-main.
|
|
79
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
80
|
-
"@dxos/schema": "0.8.4-main.
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
45
|
+
"@dxos/ai": "0.8.4-main.c1de068",
|
|
46
|
+
"@dxos/app-framework": "0.8.4-main.c1de068",
|
|
47
|
+
"@dxos/blueprints": "0.8.4-main.c1de068",
|
|
48
|
+
"@dxos/context": "0.8.4-main.c1de068",
|
|
49
|
+
"@dxos/async": "0.8.4-main.c1de068",
|
|
50
|
+
"@dxos/client": "0.8.4-main.c1de068",
|
|
51
|
+
"@dxos/echo": "0.8.4-main.c1de068",
|
|
52
|
+
"@dxos/display-name": "0.8.4-main.c1de068",
|
|
53
|
+
"@dxos/echo-schema": "0.8.4-main.c1de068",
|
|
54
|
+
"@dxos/echo-signals": "0.8.4-main.c1de068",
|
|
55
|
+
"@dxos/effect": "0.8.4-main.c1de068",
|
|
56
|
+
"@dxos/invariant": "0.8.4-main.c1de068",
|
|
57
|
+
"@dxos/keys": "0.8.4-main.c1de068",
|
|
58
|
+
"@dxos/live-object": "0.8.4-main.c1de068",
|
|
59
|
+
"@dxos/local-storage": "0.8.4-main.c1de068",
|
|
60
|
+
"@dxos/log": "0.8.4-main.c1de068",
|
|
61
|
+
"@dxos/migrations": "0.8.4-main.c1de068",
|
|
62
|
+
"@dxos/plugin-client": "0.8.4-main.c1de068",
|
|
63
|
+
"@dxos/plugin-graph": "0.8.4-main.c1de068",
|
|
64
|
+
"@dxos/plugin-observability": "0.8.4-main.c1de068",
|
|
65
|
+
"@dxos/plugin-deck": "0.8.4-main.c1de068",
|
|
66
|
+
"@dxos/plugin-status-bar": "0.8.4-main.c1de068",
|
|
67
|
+
"@dxos/react-client": "0.8.4-main.c1de068",
|
|
68
|
+
"@dxos/react-ui-attention": "0.8.4-main.c1de068",
|
|
69
|
+
"@dxos/react-ui-editor": "0.8.4-main.c1de068",
|
|
70
|
+
"@dxos/protocols": "0.8.4-main.c1de068",
|
|
71
|
+
"@dxos/react-ui-form": "0.8.4-main.c1de068",
|
|
72
|
+
"@dxos/react-ui-pickers": "0.8.4-main.c1de068",
|
|
73
|
+
"@dxos/react-ui-list": "0.8.4-main.c1de068",
|
|
74
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.c1de068",
|
|
75
|
+
"@dxos/react-ui-stack": "0.8.4-main.c1de068",
|
|
76
|
+
"@dxos/plugin-attention": "0.8.4-main.c1de068",
|
|
77
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.c1de068",
|
|
78
|
+
"@dxos/react-ui-tabs": "0.8.4-main.c1de068",
|
|
79
|
+
"@dxos/react-ui-theme": "0.8.4-main.c1de068",
|
|
80
|
+
"@dxos/schema": "0.8.4-main.c1de068",
|
|
81
|
+
"@dxos/util": "0.8.4-main.c1de068",
|
|
82
|
+
"@dxos/shell": "0.8.4-main.c1de068"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@babel/core": "^7.18.13",
|
|
86
86
|
"@effect-rx/rx-react": "0.38.0",
|
|
87
|
-
"@effect/platform": "0.
|
|
88
|
-
"@phosphor-icons/react": "^2.1.5",
|
|
87
|
+
"@effect/platform": "0.89.0",
|
|
89
88
|
"@types/react": "~18.2.0",
|
|
90
89
|
"@types/react-dom": "~18.2.0",
|
|
91
90
|
"react": "~18.2.0",
|
|
92
91
|
"react-dom": "~18.2.0",
|
|
93
92
|
"vite": "5.4.7",
|
|
94
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
95
|
-
"@dxos/
|
|
96
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
97
|
-
"@dxos/
|
|
93
|
+
"@dxos/react-ui": "0.8.4-main.c1de068",
|
|
94
|
+
"@dxos/storybook-utils": "0.8.4-main.c1de068",
|
|
95
|
+
"@dxos/react-ui-theme": "0.8.4-main.c1de068",
|
|
96
|
+
"@dxos/random": "0.8.4-main.c1de068"
|
|
98
97
|
},
|
|
99
98
|
"peerDependencies": {
|
|
100
99
|
"@effect-rx/rx-react": "^0.34.1",
|
|
101
100
|
"@effect/platform": "^0.80.12",
|
|
102
|
-
"@phosphor-icons/react": "^2.1.5",
|
|
103
101
|
"effect": "^3.13.3",
|
|
104
102
|
"react": "~18.2.0",
|
|
105
103
|
"react-dom": "~18.2.0",
|
|
106
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
107
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
104
|
+
"@dxos/react-ui": "0.8.4-main.c1de068",
|
|
105
|
+
"@dxos/react-ui-theme": "0.8.4-main.c1de068"
|
|
108
106
|
},
|
|
109
107
|
"publishConfig": {
|
|
110
108
|
"access": "public"
|
package/src/SpacePlugin.ts
CHANGED
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
} from '@dxos/app-framework';
|
|
17
17
|
import { Ref, Type } from '@dxos/echo';
|
|
18
18
|
import { AttentionEvents } from '@dxos/plugin-attention';
|
|
19
|
-
import { ClientEvents } from '@dxos/plugin-client';
|
|
20
|
-
import { DataType } from '@dxos/schema';
|
|
19
|
+
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
20
|
+
import { createDefaultSchema, DataType, ViewTypeV1, ViewTypeV1ToV2, ViewTypeV2 } from '@dxos/schema';
|
|
21
21
|
import { translations as shellTranslations } from '@dxos/shell/react';
|
|
22
22
|
|
|
23
23
|
import {
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
import { SpaceEvents } from './events';
|
|
38
38
|
import { meta } from './meta';
|
|
39
39
|
import { translations } from './translations';
|
|
40
|
-
import { CollectionAction, defineObjectForm } from './types';
|
|
40
|
+
import { CollectionAction, defineObjectForm, SpaceAction } from './types';
|
|
41
41
|
|
|
42
42
|
export type SpacePluginOptions = {
|
|
43
43
|
/**
|
|
@@ -109,6 +109,42 @@ export const SpacePlugin = ({
|
|
|
109
109
|
icon: 'ph--funnel-simple--regular',
|
|
110
110
|
},
|
|
111
111
|
}),
|
|
112
|
+
contributes(Capabilities.Metadata, {
|
|
113
|
+
id: Type.getTypename(DataType.StoredSchema),
|
|
114
|
+
metadata: {
|
|
115
|
+
icon: 'ph--database--regular',
|
|
116
|
+
},
|
|
117
|
+
}),
|
|
118
|
+
contributes(Capabilities.Metadata, {
|
|
119
|
+
id: Type.getTypename(DataType.Event),
|
|
120
|
+
metadata: {
|
|
121
|
+
icon: 'ph--calendar-dot--regular',
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
contributes(Capabilities.Metadata, {
|
|
125
|
+
id: Type.getTypename(DataType.Organization),
|
|
126
|
+
metadata: {
|
|
127
|
+
icon: 'ph--building-office--regular',
|
|
128
|
+
},
|
|
129
|
+
}),
|
|
130
|
+
contributes(Capabilities.Metadata, {
|
|
131
|
+
id: Type.getTypename(DataType.Person),
|
|
132
|
+
metadata: {
|
|
133
|
+
icon: 'ph--user--regular',
|
|
134
|
+
},
|
|
135
|
+
}),
|
|
136
|
+
contributes(Capabilities.Metadata, {
|
|
137
|
+
id: Type.getTypename(DataType.Project),
|
|
138
|
+
metadata: {
|
|
139
|
+
icon: 'ph--check-square-offset--regular',
|
|
140
|
+
},
|
|
141
|
+
}),
|
|
142
|
+
contributes(Capabilities.Metadata, {
|
|
143
|
+
id: Type.getTypename(DataType.Task),
|
|
144
|
+
metadata: {
|
|
145
|
+
icon: 'ph--check-circle--regular',
|
|
146
|
+
},
|
|
147
|
+
}),
|
|
112
148
|
],
|
|
113
149
|
}),
|
|
114
150
|
defineModule({
|
|
@@ -131,14 +167,61 @@ export const SpacePlugin = ({
|
|
|
131
167
|
getIntent: (props) => createIntent(CollectionAction.CreateQueryCollection, props),
|
|
132
168
|
}),
|
|
133
169
|
),
|
|
170
|
+
contributes(
|
|
171
|
+
SpaceCapabilities.ObjectForm,
|
|
172
|
+
defineObjectForm({
|
|
173
|
+
objectSchema: DataType.StoredSchema,
|
|
174
|
+
formSchema: SpaceAction.StoredSchemaForm,
|
|
175
|
+
getIntent: (props, options) =>
|
|
176
|
+
props.typename
|
|
177
|
+
? createIntent(SpaceAction.UseStaticSchema, { space: options.space, typename: props.typename })
|
|
178
|
+
: createIntent(SpaceAction.AddSchema, {
|
|
179
|
+
space: options.space,
|
|
180
|
+
name: props.name,
|
|
181
|
+
schema: createDefaultSchema(),
|
|
182
|
+
}),
|
|
183
|
+
}),
|
|
184
|
+
),
|
|
134
185
|
],
|
|
135
186
|
}),
|
|
136
187
|
defineModule({
|
|
137
|
-
id: `${meta.id}/module/schema`,
|
|
188
|
+
id: `${meta.id}/module/schema-defs`,
|
|
138
189
|
activatesOn: ClientEvents.ClientReady,
|
|
139
190
|
activatesBefore: [ClientEvents.SetupSchema],
|
|
140
191
|
activate: SchemaDefs,
|
|
141
192
|
}),
|
|
193
|
+
defineModule({
|
|
194
|
+
id: `${meta.id}/module/schema`,
|
|
195
|
+
activatesOn: ClientEvents.SetupSchema,
|
|
196
|
+
activate: () =>
|
|
197
|
+
contributes(ClientCapabilities.Schema, [
|
|
198
|
+
DataType.View,
|
|
199
|
+
ViewTypeV1,
|
|
200
|
+
ViewTypeV2,
|
|
201
|
+
DataType.Event,
|
|
202
|
+
DataType.Organization,
|
|
203
|
+
DataType.Person,
|
|
204
|
+
DataType.Project,
|
|
205
|
+
DataType.Task,
|
|
206
|
+
]),
|
|
207
|
+
}),
|
|
208
|
+
defineModule({
|
|
209
|
+
id: `${meta.id}/module/migration`,
|
|
210
|
+
activatesOn: ClientEvents.SetupMigration,
|
|
211
|
+
activate: () => contributes(ClientCapabilities.Migration, [ViewTypeV1ToV2]),
|
|
212
|
+
}),
|
|
213
|
+
defineModule({
|
|
214
|
+
id: `${meta.id}/module/whitelist-schema`,
|
|
215
|
+
activatesOn: ClientEvents.SetupSchema,
|
|
216
|
+
activate: () =>
|
|
217
|
+
contributes(ClientCapabilities.SchemaWhiteList, [
|
|
218
|
+
DataType.Event,
|
|
219
|
+
DataType.Organization,
|
|
220
|
+
DataType.Person,
|
|
221
|
+
DataType.Project,
|
|
222
|
+
DataType.Task,
|
|
223
|
+
]),
|
|
224
|
+
}),
|
|
142
225
|
defineModule({
|
|
143
226
|
id: `${meta.id}/module/react-root`,
|
|
144
227
|
activatesOn: Events.Startup,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Rx } from '@effect-rx/rx-react';
|
|
6
|
-
import { Array, Option, pipe } from 'effect';
|
|
6
|
+
import { Array, Option, pipe, Schema } from 'effect';
|
|
7
7
|
|
|
8
8
|
import { Capabilities, contributes, createIntent, type PluginContext } from '@dxos/app-framework';
|
|
9
9
|
import { getSpace, SpaceState, type Space, isSpace, type QueryResult } from '@dxos/client/echo';
|
|
@@ -24,6 +24,8 @@ import {
|
|
|
24
24
|
constructSpaceActions,
|
|
25
25
|
constructSpaceNode,
|
|
26
26
|
createObjectNode,
|
|
27
|
+
createStaticSchemaActions,
|
|
28
|
+
createStaticSchemaNode,
|
|
27
29
|
rxFromQuery,
|
|
28
30
|
SHARED,
|
|
29
31
|
SPACES,
|
|
@@ -478,15 +480,146 @@ export default (context: PluginContext) => {
|
|
|
478
480
|
},
|
|
479
481
|
}),
|
|
480
482
|
|
|
483
|
+
// Static schema records.
|
|
484
|
+
createExtension({
|
|
485
|
+
id: `${SPACE_PLUGIN}/static-schemas`,
|
|
486
|
+
connector: (node) => {
|
|
487
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
488
|
+
return Rx.make((get) =>
|
|
489
|
+
pipe(
|
|
490
|
+
get(node),
|
|
491
|
+
Option.flatMap((node) =>
|
|
492
|
+
Obj.instanceOf(DataType.QueryCollection, node.data) &&
|
|
493
|
+
node.data.query.typename === DataType.StoredSchema.typename
|
|
494
|
+
? Option.some(node.data)
|
|
495
|
+
: Option.none(),
|
|
496
|
+
),
|
|
497
|
+
Option.flatMap((collection) => {
|
|
498
|
+
const space = getSpace(collection);
|
|
499
|
+
return space?.properties.staticRecords ? Option.some(space) : Option.none();
|
|
500
|
+
}),
|
|
501
|
+
Option.map((space) => {
|
|
502
|
+
return get(rxFromSignal(() => (space.properties.staticRecords ?? []) as string[]))
|
|
503
|
+
.map((typename) =>
|
|
504
|
+
client.graph.schemaRegistry.schemas.find((schema) => Type.getTypename(schema) === typename),
|
|
505
|
+
)
|
|
506
|
+
.filter(isNonNullable)
|
|
507
|
+
.map((schema) => createStaticSchemaNode({ schema, space }));
|
|
508
|
+
}),
|
|
509
|
+
Option.getOrElse(() => []),
|
|
510
|
+
),
|
|
511
|
+
);
|
|
512
|
+
},
|
|
513
|
+
}),
|
|
514
|
+
|
|
515
|
+
// Create static schema actions.
|
|
516
|
+
createExtension({
|
|
517
|
+
id: `${SPACE_PLUGIN}/static-schema-actions`,
|
|
518
|
+
actions: (node) => {
|
|
519
|
+
let query: QueryResult<DataType.View> | undefined;
|
|
520
|
+
return Rx.make((get) =>
|
|
521
|
+
pipe(
|
|
522
|
+
get(node),
|
|
523
|
+
Option.flatMap((node) => {
|
|
524
|
+
const space = isSpace(node.properties.space) ? node.properties.space : undefined;
|
|
525
|
+
return space && Schema.isSchema(node.data) ? Option.some({ space, schema: node.data }) : Option.none();
|
|
526
|
+
}),
|
|
527
|
+
Option.map(({ space, schema }) => {
|
|
528
|
+
if (!query) {
|
|
529
|
+
// TODO(wittjosiah): Support filtering by nested properties (e.g. `query.typename`).
|
|
530
|
+
query = space.db.query(Filter.type(DataType.View));
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
const views = get(rxFromQuery(query));
|
|
534
|
+
const filteredViews = get(
|
|
535
|
+
rxFromSignal(() =>
|
|
536
|
+
// TODO(wittjosiah): Remove cast.
|
|
537
|
+
views.filter((view) => view.query.typename === Type.getTypename(schema as Type.Obj.Any)),
|
|
538
|
+
),
|
|
539
|
+
);
|
|
540
|
+
const deletable = filteredViews.length === 0;
|
|
541
|
+
|
|
542
|
+
// TODO(wittjosiah): Remove cast.
|
|
543
|
+
return createStaticSchemaActions({ schema: schema as Type.Obj.Any, space, deletable });
|
|
544
|
+
}),
|
|
545
|
+
Option.getOrElse(() => []),
|
|
546
|
+
),
|
|
547
|
+
);
|
|
548
|
+
},
|
|
549
|
+
}),
|
|
550
|
+
|
|
551
|
+
// Create nodes for schema views.
|
|
552
|
+
createExtension({
|
|
553
|
+
id: `${SPACE_PLUGIN}/schema-views`,
|
|
554
|
+
connector: (node) => {
|
|
555
|
+
let query: QueryResult<DataType.View> | undefined;
|
|
556
|
+
return Rx.make((get) =>
|
|
557
|
+
pipe(
|
|
558
|
+
get(node),
|
|
559
|
+
Option.flatMap((node) => {
|
|
560
|
+
const space = getSpace(node.data) ?? (isSpace(node.properties.space) ? node.properties.space : undefined);
|
|
561
|
+
return space && (Obj.instanceOf(DataType.StoredSchema, node.data) || Schema.isSchema(node.data))
|
|
562
|
+
? Option.some({ space, schema: node.data })
|
|
563
|
+
: Option.none();
|
|
564
|
+
}),
|
|
565
|
+
Option.map(({ space, schema }) => {
|
|
566
|
+
if (!query) {
|
|
567
|
+
// TODO(wittjosiah): Support filtering by nested properties (e.g. `query.typename`).
|
|
568
|
+
query = space.db.query(Filter.type(DataType.View));
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// TODO(wittjosiah): Remove cast.
|
|
572
|
+
const typename = Schema.isSchema(schema) ? Type.getTypename(schema as Type.Obj.Any) : schema.typename;
|
|
573
|
+
return get(rxFromQuery(query))
|
|
574
|
+
.filter((view) => view.query.typename === typename)
|
|
575
|
+
.map((view) =>
|
|
576
|
+
get(
|
|
577
|
+
rxFromSignal(() =>
|
|
578
|
+
createObjectNode({
|
|
579
|
+
object: view,
|
|
580
|
+
space,
|
|
581
|
+
resolve,
|
|
582
|
+
droppable: false,
|
|
583
|
+
}),
|
|
584
|
+
),
|
|
585
|
+
),
|
|
586
|
+
)
|
|
587
|
+
.filter(isNonNullable);
|
|
588
|
+
}),
|
|
589
|
+
Option.getOrElse(() => []),
|
|
590
|
+
),
|
|
591
|
+
);
|
|
592
|
+
},
|
|
593
|
+
}),
|
|
594
|
+
|
|
481
595
|
// Create collection actions and action groups.
|
|
482
596
|
createExtension({
|
|
483
597
|
id: `${SPACE_PLUGIN}/object-actions`,
|
|
484
|
-
actions: (node) =>
|
|
485
|
-
|
|
598
|
+
actions: (node) => {
|
|
599
|
+
let query: QueryResult<DataType.View> | undefined;
|
|
600
|
+
return Rx.make((get) =>
|
|
486
601
|
pipe(
|
|
487
602
|
get(node),
|
|
488
|
-
Option.flatMap((node) =>
|
|
489
|
-
|
|
603
|
+
Option.flatMap((node) => {
|
|
604
|
+
const space = getSpace(node.data);
|
|
605
|
+
return space && Obj.isObject(node.data) ? Option.some({ space, object: node.data }) : Option.none();
|
|
606
|
+
}),
|
|
607
|
+
Option.flatMap(({ space, object }) => {
|
|
608
|
+
const isSchema = Obj.instanceOf(DataType.StoredSchema, object);
|
|
609
|
+
if (!query && isSchema) {
|
|
610
|
+
// TODO(wittjosiah): Support filtering by nested properties (e.g. `query.typename`).
|
|
611
|
+
query = space.db.query(Filter.type(DataType.View));
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
let deletable = !isSchema;
|
|
615
|
+
if (isSchema && query) {
|
|
616
|
+
const views = get(rxFromQuery(query));
|
|
617
|
+
const filteredViews = get(
|
|
618
|
+
rxFromSignal(() => views.filter((view) => view.query.typename === object.typename)),
|
|
619
|
+
);
|
|
620
|
+
deletable = filteredViews.length === 0;
|
|
621
|
+
}
|
|
622
|
+
|
|
490
623
|
const [dispatcher] = get(context.capabilities(Capabilities.IntentDispatcher));
|
|
491
624
|
const [appGraph] = get(context.capabilities(Capabilities.AppGraph));
|
|
492
625
|
const [state] = get(context.capabilities(SpaceCapabilities.State));
|
|
@@ -500,6 +633,7 @@ export default (context: PluginContext) => {
|
|
|
500
633
|
graph: appGraph.graph,
|
|
501
634
|
dispatch: dispatcher.dispatchPromise,
|
|
502
635
|
objectForms,
|
|
636
|
+
deletable,
|
|
503
637
|
navigable: get(rxFromSignal(() => state.navigableCollections)),
|
|
504
638
|
});
|
|
505
639
|
}
|
|
@@ -507,6 +641,32 @@ export default (context: PluginContext) => {
|
|
|
507
641
|
Option.map((params) => constructObjectActions(params)),
|
|
508
642
|
Option.getOrElse(() => []),
|
|
509
643
|
),
|
|
644
|
+
);
|
|
645
|
+
},
|
|
646
|
+
}),
|
|
647
|
+
|
|
648
|
+
// View selected objects.
|
|
649
|
+
createExtension({
|
|
650
|
+
id: `${SPACE_PLUGIN}/selected-objects`,
|
|
651
|
+
connector: (node) =>
|
|
652
|
+
Rx.make((get) =>
|
|
653
|
+
pipe(
|
|
654
|
+
get(node),
|
|
655
|
+
Option.flatMap((node) => (Obj.instanceOf(DataType.View, node.data) ? Option.some(node) : Option.none())),
|
|
656
|
+
Option.map((node) => [
|
|
657
|
+
{
|
|
658
|
+
id: [node.id, 'selected-objects'].join(ATTENDABLE_PATH_SEPARATOR),
|
|
659
|
+
type: PLANK_COMPANION_TYPE,
|
|
660
|
+
data: 'selected-objects',
|
|
661
|
+
properties: {
|
|
662
|
+
label: ['companion selected objects label', { ns: SPACE_PLUGIN }],
|
|
663
|
+
icon: 'ph--tree-view--regular',
|
|
664
|
+
disposition: 'hidden',
|
|
665
|
+
},
|
|
666
|
+
},
|
|
667
|
+
]),
|
|
668
|
+
Option.getOrElse(() => []),
|
|
669
|
+
),
|
|
510
670
|
),
|
|
511
671
|
}),
|
|
512
672
|
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Schema } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { type AnyIntentChain, defineCapability, type Label } from '@dxos/app-framework';
|
|
6
8
|
import { type Space } from '@dxos/react-client/echo';
|
|
7
9
|
import { type DataType } from '@dxos/schema';
|
|
8
|
-
import { type Position, type DeepReadonly
|
|
10
|
+
import { type Position, type DeepReadonly } from '@dxos/util';
|
|
9
11
|
|
|
10
12
|
import { SPACE_PLUGIN } from '../meta';
|
|
11
13
|
import { type ObjectForm, type PluginState } from '../types';
|
|
@@ -17,8 +19,11 @@ export namespace SpaceCapabilities {
|
|
|
17
19
|
export type SettingsSection = { id: string; label: Label; position?: Position };
|
|
18
20
|
export const SettingsSection = defineCapability<SettingsSection>(`${SPACE_PLUGIN}/capability/settings-section`);
|
|
19
21
|
|
|
20
|
-
export type OnSpaceCreated = (params: { space: Space; rootCollection: DataType.Collection }) =>
|
|
22
|
+
export type OnSpaceCreated = (params: { space: Space; rootCollection: DataType.Collection }) => AnyIntentChain;
|
|
21
23
|
export const OnSpaceCreated = defineCapability<OnSpaceCreated>(`${SPACE_PLUGIN}/capability/on-space-created`);
|
|
22
24
|
|
|
25
|
+
export type OnSchemaAdded = (params: { space: Space; schema: Schema.Schema.AnyNoContext }) => AnyIntentChain;
|
|
26
|
+
export const OnSchemaAdded = defineCapability<OnSchemaAdded>(`${SPACE_PLUGIN}/capability/on-schema-added`);
|
|
27
|
+
|
|
23
28
|
export const ObjectForm = defineCapability<ObjectForm<any>>(`${SPACE_PLUGIN}/capability/object-form`);
|
|
24
29
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
createIntent,
|
|
13
13
|
createResolver,
|
|
14
14
|
} from '@dxos/app-framework';
|
|
15
|
-
import { Obj, Ref, Relation,
|
|
15
|
+
import { Obj, Ref, Relation, Type } from '@dxos/echo';
|
|
16
16
|
import { invariant } from '@dxos/invariant';
|
|
17
17
|
import { Migrations } from '@dxos/migrations';
|
|
18
18
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
@@ -21,7 +21,7 @@ import { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata
|
|
|
21
21
|
import { isSpace, getSpace, SpaceState, fullyQualifiedId } from '@dxos/react-client/echo';
|
|
22
22
|
import { Invitation, InvitationEncoder } from '@dxos/react-client/invitations';
|
|
23
23
|
import { ATTENDABLE_PATH_SEPARATOR } from '@dxos/react-ui-attention';
|
|
24
|
-
import { DataType } from '@dxos/schema';
|
|
24
|
+
import { DataType, ProjectionModel } from '@dxos/schema';
|
|
25
25
|
|
|
26
26
|
import { SpaceCapabilities } from './capabilities';
|
|
27
27
|
import {
|
|
@@ -75,17 +75,27 @@ export default ({ context, observability, createInvitationUrl }: IntentResolverO
|
|
|
75
75
|
await space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED);
|
|
76
76
|
}
|
|
77
77
|
await space.waitUntilReady();
|
|
78
|
+
|
|
79
|
+
// Create root collection.
|
|
78
80
|
const collection = Obj.make(DataType.Collection, { objects: [] });
|
|
79
81
|
space.properties[DataType.Collection.typename] = Ref.make(collection);
|
|
80
82
|
|
|
83
|
+
// Set current migration version.
|
|
81
84
|
if (Migrations.versionProperty) {
|
|
82
85
|
space.properties[Migrations.versionProperty] = Migrations.targetVersion;
|
|
83
86
|
}
|
|
84
87
|
|
|
88
|
+
// Create records smart collection.
|
|
89
|
+
const records = Obj.make(DataType.QueryCollection, {
|
|
90
|
+
query: { typename: DataType.StoredSchema.typename },
|
|
91
|
+
});
|
|
92
|
+
collection.objects.push(Ref.make(records));
|
|
93
|
+
|
|
94
|
+
// Allow other plugins to add default content.
|
|
85
95
|
await context.activatePromise(SpaceEvents.SpaceCreated);
|
|
86
96
|
const onSpaceCreatedCallbacks = context.getCapabilities(SpaceCapabilities.OnSpaceCreated);
|
|
87
|
-
|
|
88
|
-
|
|
97
|
+
const spaceCreatedIntents = onSpaceCreatedCallbacks.map((onSpaceCreated) =>
|
|
98
|
+
onSpaceCreated({ space, rootCollection: collection }),
|
|
89
99
|
);
|
|
90
100
|
|
|
91
101
|
return {
|
|
@@ -95,6 +105,7 @@ export default ({ context, observability, createInvitationUrl }: IntentResolverO
|
|
|
95
105
|
space,
|
|
96
106
|
},
|
|
97
107
|
intents: [
|
|
108
|
+
...spaceCreatedIntents,
|
|
98
109
|
...(observability
|
|
99
110
|
? [
|
|
100
111
|
createIntent(ObservabilityAction.SendEvent, {
|
|
@@ -309,9 +320,106 @@ export default ({ context, observability, createInvitationUrl }: IntentResolverO
|
|
|
309
320
|
};
|
|
310
321
|
},
|
|
311
322
|
}),
|
|
323
|
+
createResolver({
|
|
324
|
+
intent: SpaceAction.UseStaticSchema,
|
|
325
|
+
resolve: async ({ space, typename }) => {
|
|
326
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
327
|
+
const schema = client.graph.schemaRegistry.schemas.find((schema) => Type.getTypename(schema) === typename);
|
|
328
|
+
invariant(schema, `Schema not found: ${typename}`);
|
|
329
|
+
|
|
330
|
+
if (!space.properties.staticRecords) {
|
|
331
|
+
space.properties.staticRecords = [];
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (!space.properties.staticRecords.includes(typename)) {
|
|
335
|
+
space.properties.staticRecords.push(typename);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
await context.activatePromise(SpaceEvents.SchemaAdded);
|
|
339
|
+
const onSchemaAdded = context.getCapabilities(SpaceCapabilities.OnSchemaAdded);
|
|
340
|
+
const schemaAddedIntents = onSchemaAdded.map((onSchemaAdded) => onSchemaAdded({ space, schema }));
|
|
341
|
+
|
|
342
|
+
return {
|
|
343
|
+
data: {},
|
|
344
|
+
intents: [
|
|
345
|
+
...schemaAddedIntents,
|
|
346
|
+
...(observability
|
|
347
|
+
? [
|
|
348
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
349
|
+
name: 'space.schema.use',
|
|
350
|
+
properties: {
|
|
351
|
+
spaceId: space.id,
|
|
352
|
+
typename: Type.getTypename(schema),
|
|
353
|
+
},
|
|
354
|
+
}),
|
|
355
|
+
]
|
|
356
|
+
: []),
|
|
357
|
+
],
|
|
358
|
+
};
|
|
359
|
+
},
|
|
360
|
+
}),
|
|
361
|
+
createResolver({
|
|
362
|
+
intent: SpaceAction.AddSchema,
|
|
363
|
+
resolve: async ({ space, name, schema: schemaInput }) => {
|
|
364
|
+
const [schema] = await space.db.schemaRegistry.register([schemaInput]);
|
|
365
|
+
if (name) {
|
|
366
|
+
schema.storedSchema.name = name;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
await context.activatePromise(SpaceEvents.SchemaAdded);
|
|
370
|
+
const onSchemaAdded = context.getCapabilities(SpaceCapabilities.OnSchemaAdded);
|
|
371
|
+
const schemaAddedIntents = onSchemaAdded.map((onSchemaAdded) => onSchemaAdded({ space, schema }));
|
|
372
|
+
|
|
373
|
+
return {
|
|
374
|
+
data: {
|
|
375
|
+
id: schema.id,
|
|
376
|
+
object: schema.storedSchema,
|
|
377
|
+
schema,
|
|
378
|
+
},
|
|
379
|
+
intents: [
|
|
380
|
+
...schemaAddedIntents,
|
|
381
|
+
...(observability
|
|
382
|
+
? [
|
|
383
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
384
|
+
name: 'space.schema.add',
|
|
385
|
+
properties: {
|
|
386
|
+
spaceId: space.id,
|
|
387
|
+
objectId: schema.id,
|
|
388
|
+
typename: schema.typename,
|
|
389
|
+
},
|
|
390
|
+
}),
|
|
391
|
+
]
|
|
392
|
+
: []),
|
|
393
|
+
],
|
|
394
|
+
};
|
|
395
|
+
},
|
|
396
|
+
}),
|
|
397
|
+
createResolver({
|
|
398
|
+
intent: SpaceAction.DeleteField,
|
|
399
|
+
resolve: async ({ view, fieldId, deletionData }, undo) => {
|
|
400
|
+
const space = getSpace(view);
|
|
401
|
+
invariant(space);
|
|
402
|
+
invariant(view.query.typename);
|
|
403
|
+
const schema = await space.db.schemaRegistry.query({ typename: view.query.typename }).firstOrUndefined();
|
|
404
|
+
invariant(schema);
|
|
405
|
+
const projection = new ProjectionModel(schema.jsonSchema, view.projection);
|
|
406
|
+
if (!undo) {
|
|
407
|
+
const { deleted, index } = projection.deleteFieldProjection(fieldId);
|
|
408
|
+
return {
|
|
409
|
+
undoable: {
|
|
410
|
+
message: ['field deleted label', { ns: SPACE_PLUGIN }],
|
|
411
|
+
data: { deletionData: { ...deleted, index } },
|
|
412
|
+
},
|
|
413
|
+
};
|
|
414
|
+
} else if (undo && deletionData) {
|
|
415
|
+
const { field, props, index } = deletionData;
|
|
416
|
+
projection.setFieldProjection({ field, props }, index);
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
}),
|
|
312
420
|
createResolver({
|
|
313
421
|
intent: SpaceAction.OpenCreateObject,
|
|
314
|
-
resolve: ({ target, typename, navigable = true }) => {
|
|
422
|
+
resolve: ({ target, typename, navigable = true, onCreateObject }) => {
|
|
315
423
|
const state = context.getCapability(SpaceCapabilities.State);
|
|
316
424
|
|
|
317
425
|
return {
|
|
@@ -324,6 +432,7 @@ export default ({ context, observability, createInvitationUrl }: IntentResolverO
|
|
|
324
432
|
props: {
|
|
325
433
|
target,
|
|
326
434
|
typename,
|
|
435
|
+
onCreateObject,
|
|
327
436
|
shouldNavigate: navigable
|
|
328
437
|
? (object: Obj.Any) => {
|
|
329
438
|
const isCollection = Obj.instanceOf(DataType.Collection, object);
|