@dxos/plugin-space 0.8.4-main.72ec0f3 → 0.8.4-main.7ace549
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/{ObjectDetailsPanel-2BRUBHP6.mjs → ObjectDetailsPanel-ACGHWPDX.mjs} +2 -2
- package/dist/lib/browser/{ObjectDetailsPanel-2BRUBHP6.mjs.map → ObjectDetailsPanel-ACGHWPDX.mjs.map} +3 -3
- package/dist/lib/browser/{ObjectSettings-5LLWCVEK.mjs → ObjectSettings-U3IH7BMV.mjs} +2 -2
- package/dist/lib/browser/{ObjectSettings-5LLWCVEK.mjs.map → ObjectSettings-U3IH7BMV.mjs.map} +3 -3
- package/dist/lib/browser/{RecordArticle-SXDRWTTU.mjs → RecordArticle-2PFEBPXY.mjs} +1 -1
- package/dist/lib/browser/RecordArticle-2PFEBPXY.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-VQAB3GCQ.mjs → app-graph-builder-HABMCWAI.mjs} +140 -151
- package/dist/lib/browser/app-graph-builder-HABMCWAI.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-serializer-KSLKMEPP.mjs → app-graph-serializer-G3VFEGTN.mjs} +4 -4
- package/dist/lib/browser/chunk-6A3NWBB6.mjs +392 -0
- package/dist/lib/browser/chunk-6A3NWBB6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-K5J7ZB5P.mjs → chunk-C6DAPIFF.mjs} +3 -3
- package/dist/lib/browser/chunk-C6DAPIFF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ERQMHU7L.mjs → chunk-GJOZILGC.mjs} +163 -105
- package/dist/lib/browser/chunk-GJOZILGC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-J2BUK5E6.mjs → chunk-KCZ527AM.mjs} +169 -101
- package/dist/lib/browser/chunk-KCZ527AM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PU5IOFMG.mjs → chunk-P25R3AOK.mjs} +4 -47
- package/dist/lib/browser/{chunk-PU5IOFMG.mjs.map → chunk-P25R3AOK.mjs.map} +4 -4
- package/dist/lib/browser/{chunk-OLBBSOVI.mjs → chunk-POFUXISV.mjs} +53 -59
- package/dist/lib/browser/chunk-POFUXISV.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +47 -94
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-Q2XWHAVA.mjs → intent-resolver-RZEWNJ2K.mjs} +51 -40
- package/dist/lib/browser/intent-resolver-RZEWNJ2K.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-MM4HADPE.mjs → react-root-JCRD74GI.mjs} +6 -6
- package/dist/lib/browser/{react-surface-SGZC3Y4U.mjs → react-surface-VOETEAG3.mjs} +28 -14
- package/dist/lib/browser/react-surface-VOETEAG3.mjs.map +7 -0
- package/dist/lib/browser/repair-CNLE35NF.mjs +44 -0
- package/dist/lib/browser/repair-CNLE35NF.mjs.map +7 -0
- package/dist/lib/browser/{settings-WKLGKUHQ.mjs → settings-TRLI52I5.mjs} +2 -2
- package/dist/lib/browser/{spaces-ready-C5QC2UFL.mjs → spaces-ready-OHGCWZHQ.mjs} +13 -7
- package/dist/lib/browser/{spaces-ready-C5QC2UFL.mjs.map → spaces-ready-OHGCWZHQ.mjs.map} +2 -2
- package/dist/lib/browser/{state-Q7YRE5KG.mjs → state-C7N6EDDZ.mjs} +2 -2
- package/dist/lib/browser/types/index.mjs +9 -3
- package/dist/lib/node-esm/{ObjectDetailsPanel-6PZQIQG3.mjs → ObjectDetailsPanel-6OFTT3GG.mjs} +2 -2
- package/dist/lib/node-esm/{ObjectDetailsPanel-6PZQIQG3.mjs.map → ObjectDetailsPanel-6OFTT3GG.mjs.map} +3 -3
- package/dist/lib/node-esm/{ObjectSettings-OQSBOH7K.mjs → ObjectSettings-YXPJQMJ5.mjs} +2 -2
- package/dist/lib/node-esm/{ObjectSettings-OQSBOH7K.mjs.map → ObjectSettings-YXPJQMJ5.mjs.map} +3 -3
- package/dist/lib/node-esm/{RecordArticle-NACBH42P.mjs → RecordArticle-SSJ7PULS.mjs} +1 -1
- package/dist/lib/node-esm/RecordArticle-SSJ7PULS.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-24JCLJPX.mjs → app-graph-builder-T6VJKIOA.mjs} +140 -151
- package/dist/lib/node-esm/app-graph-builder-T6VJKIOA.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-serializer-R723K764.mjs → app-graph-serializer-2NLWWFUB.mjs} +4 -4
- package/dist/lib/node-esm/{chunk-TJPQDQNI.mjs → chunk-7EV4SN47.mjs} +4 -47
- package/dist/lib/node-esm/{chunk-TJPQDQNI.mjs.map → chunk-7EV4SN47.mjs.map} +4 -4
- package/dist/lib/node-esm/{chunk-WC4VBFMA.mjs → chunk-AX3UGL5D.mjs} +53 -59
- package/dist/lib/node-esm/chunk-AX3UGL5D.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VH2EBZEV.mjs → chunk-I6FZP42D.mjs} +163 -105
- package/dist/lib/node-esm/chunk-I6FZP42D.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ITQFSFQ3.mjs → chunk-JAMGJUFU.mjs} +169 -101
- package/dist/lib/node-esm/chunk-JAMGJUFU.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-Z7BB6HC2.mjs → chunk-WWGV5FJM.mjs} +3 -3
- package/dist/lib/node-esm/chunk-WWGV5FJM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-X34VDVMY.mjs +393 -0
- package/dist/lib/node-esm/chunk-X34VDVMY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +47 -94
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-YK4ESSET.mjs → intent-resolver-4PHJWDXW.mjs} +51 -40
- package/dist/lib/node-esm/intent-resolver-4PHJWDXW.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-root-5ANDLQMX.mjs → react-root-O5I5CDJ7.mjs} +6 -6
- package/dist/lib/node-esm/{react-surface-V7J2QB44.mjs → react-surface-J3XDMU2D.mjs} +28 -14
- package/dist/lib/node-esm/react-surface-J3XDMU2D.mjs.map +7 -0
- package/dist/lib/node-esm/repair-EHZS6MFY.mjs +45 -0
- package/dist/lib/node-esm/repair-EHZS6MFY.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-RBB5633M.mjs → settings-MNQTKHL7.mjs} +2 -2
- package/dist/lib/node-esm/{spaces-ready-SJCXV6YH.mjs → spaces-ready-ZPU24DA2.mjs} +13 -7
- package/dist/lib/node-esm/{spaces-ready-SJCXV6YH.mjs.map → spaces-ready-ZPU24DA2.mjs.map} +2 -2
- package/dist/lib/node-esm/{state-362I5BMK.mjs → state-45TXZQJ6.mjs} +2 -2
- package/dist/lib/node-esm/types/index.mjs +9 -3
- 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 -4
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -1
- package/dist/types/src/capabilities/index.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/capabilities/repair.d.ts +4 -0
- package/dist/types/src/capabilities/repair.d.ts.map +1 -0
- package/dist/types/src/capabilities/spaces-ready.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts +147 -253
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts +14 -7
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/MembersContainer/MembersContainer.stories.d.ts +147 -253
- package/dist/types/src/components/MembersContainer/MembersContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/AdvancedObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.stories.d.ts +147 -253
- package/dist/types/src/components/ObjectSettings/BaseObjectSettings.stories.d.ts.map +1 -1
- package/dist/types/src/components/ObjectSettings/ForeignKeys.d.ts +3 -3
- package/dist/types/src/components/ObjectSettings/ForeignKeys.d.ts.map +1 -1
- package/dist/types/src/components/RecordArticle.stories.d.ts +147 -253
- package/dist/types/src/components/RecordArticle.stories.d.ts.map +1 -1
- package/dist/types/src/components/SchemaContainer.d.ts +1 -1
- package/dist/types/src/components/SchemaContainer.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence/SpacePresence.d.ts +2 -2
- package/dist/types/src/components/SpacePresence/SpacePresence.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence/SpacePresence.stories.d.ts +147 -253
- package/dist/types/src/components/SpacePresence/SpacePresence.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.stories.d.ts +147 -253
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +147 -253
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -2
- package/dist/types/src/helpers/query.d.ts +1 -1
- package/dist/types/src/helpers/query.d.ts.map +1 -1
- package/dist/types/src/hooks/useTypeOptions.d.ts +2 -2
- package/dist/types/src/hooks/useTypeOptions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +147 -253
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/form.d.ts +24 -0
- package/dist/types/src/types/form.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +29 -72
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +16 -32
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +54 -50
- package/src/SpacePlugin.ts +34 -84
- package/src/capabilities/app-graph-builder.ts +130 -227
- package/src/capabilities/capabilities.ts +10 -5
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/intent-resolver.ts +31 -35
- package/src/capabilities/react-surface.tsx +34 -8
- package/src/capabilities/repair.ts +57 -0
- package/src/capabilities/spaces-ready.ts +7 -1
- package/src/components/CreateDialog/CreateObjectDialog.tsx +33 -23
- package/src/components/CreateDialog/CreateObjectPanel.tsx +32 -25
- package/src/components/ObjectDetailsPanel/ObjectForm.tsx +1 -1
- package/src/components/ObjectSettings/AdvancedObjectSettings.tsx +4 -5
- package/src/components/ObjectSettings/BaseObjectSettings.tsx +1 -1
- package/src/components/ObjectSettings/ForeignKeys.tsx +5 -5
- package/src/components/RecordArticle.tsx +6 -6
- package/src/components/SchemaContainer.tsx +2 -2
- package/src/components/SpacePresence/SpacePresence.tsx +2 -2
- package/src/components/SpaceSettings/SpaceSettingsContainer.tsx +25 -6
- package/src/components/ViewEditor.tsx +9 -3
- package/src/helpers/query.ts +1 -1
- package/src/hooks/useTypeOptions.ts +3 -35
- package/src/translations.ts +52 -57
- package/src/types/form.ts +75 -0
- package/src/types/index.ts +1 -0
- package/src/types/types.ts +26 -36
- package/src/util.tsx +165 -107
- package/dist/lib/browser/RecordArticle-SXDRWTTU.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-VQAB3GCQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-ERQMHU7L.mjs.map +0 -7
- package/dist/lib/browser/chunk-J2BUK5E6.mjs.map +0 -7
- package/dist/lib/browser/chunk-K5J7ZB5P.mjs.map +0 -7
- package/dist/lib/browser/chunk-M2Z6D4ZI.mjs +0 -349
- package/dist/lib/browser/chunk-M2Z6D4ZI.mjs.map +0 -7
- package/dist/lib/browser/chunk-OLBBSOVI.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-Q2XWHAVA.mjs.map +0 -7
- package/dist/lib/browser/react-surface-SGZC3Y4U.mjs.map +0 -7
- package/dist/lib/browser/schema-defs-QPI2JU3X.mjs +0 -26
- package/dist/lib/browser/schema-defs-QPI2JU3X.mjs.map +0 -7
- package/dist/lib/node-esm/RecordArticle-NACBH42P.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-24JCLJPX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2PN7QNGV.mjs +0 -350
- package/dist/lib/node-esm/chunk-2PN7QNGV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ITQFSFQ3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VH2EBZEV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WC4VBFMA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z7BB6HC2.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YK4ESSET.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-V7J2QB44.mjs.map +0 -7
- package/dist/lib/node-esm/schema-defs-ZS2D47XW.mjs +0 -27
- package/dist/lib/node-esm/schema-defs-ZS2D47XW.mjs.map +0 -7
- package/dist/types/src/capabilities/schema-defs.d.ts +0 -4
- package/dist/types/src/capabilities/schema-defs.d.ts.map +0 -1
- package/src/capabilities/schema-defs.ts +0 -31
- /package/dist/lib/browser/{app-graph-serializer-KSLKMEPP.mjs.map → app-graph-serializer-G3VFEGTN.mjs.map} +0 -0
- /package/dist/lib/browser/{react-root-MM4HADPE.mjs.map → react-root-JCRD74GI.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-WKLGKUHQ.mjs.map → settings-TRLI52I5.mjs.map} +0 -0
- /package/dist/lib/browser/{state-Q7YRE5KG.mjs.map → state-C7N6EDDZ.mjs.map} +0 -0
- /package/dist/lib/node-esm/{app-graph-serializer-R723K764.mjs.map → app-graph-serializer-2NLWWFUB.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-root-5ANDLQMX.mjs.map → react-root-O5I5CDJ7.mjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-RBB5633M.mjs.map → settings-MNQTKHL7.mjs.map} +0 -0
- /package/dist/lib/node-esm/{state-362I5BMK.mjs.map → state-45TXZQJ6.mjs.map} +0 -0
|
@@ -6,7 +6,7 @@ import React, { useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Surface } from '@dxos/app-framework/react';
|
|
8
8
|
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
9
|
-
import { Filter, type Obj, Ref, Relation } from '@dxos/echo';
|
|
9
|
+
import { type Entity, Filter, type Obj, Ref, Relation } from '@dxos/echo';
|
|
10
10
|
import { type Space, getSpace, useQuery } from '@dxos/react-client/echo';
|
|
11
11
|
import { useTranslation } from '@dxos/react-ui';
|
|
12
12
|
import { Masonry } from '@dxos/react-ui-masonry';
|
|
@@ -36,7 +36,7 @@ export const RecordArticle = ({ subject }: SurfaceComponentProps) => {
|
|
|
36
36
|
{related.length > 0 && (
|
|
37
37
|
<div role='none' className={mx('flex flex-col gap-1', singleColumn ? 'card-max-width' : 'is-full')}>
|
|
38
38
|
<label className='mbs-2 text-sm text-description'>{t('related objects label')}</label>
|
|
39
|
-
<Masonry.Root<
|
|
39
|
+
<Masonry.Root<Entity.Unknown>
|
|
40
40
|
items={related}
|
|
41
41
|
render={Card}
|
|
42
42
|
columnCount={singleColumn ? 1 : undefined}
|
|
@@ -49,7 +49,7 @@ export const RecordArticle = ({ subject }: SurfaceComponentProps) => {
|
|
|
49
49
|
);
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
const Card = ({ data: subject }: { data:
|
|
52
|
+
const Card = ({ data: subject }: { data: Entity.Unknown }) => {
|
|
53
53
|
const data = useMemo(() => ({ subject }), [subject]);
|
|
54
54
|
return <Surface role='card' data={data} limit={1} />;
|
|
55
55
|
};
|
|
@@ -66,11 +66,11 @@ const useRelatedObjects = (
|
|
|
66
66
|
return [];
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
const related:
|
|
69
|
+
const related: Entity.Unknown[] = [];
|
|
70
70
|
|
|
71
71
|
// TODO(burdon): Change Person => Organization to relations.
|
|
72
72
|
if (options.references) {
|
|
73
|
-
const getReferences = (obj:
|
|
73
|
+
const getReferences = (obj: Entity.Unknown): Ref.Any[] => {
|
|
74
74
|
return Object.getOwnPropertyNames(obj)
|
|
75
75
|
.map((name) => obj[name as keyof Obj.Any])
|
|
76
76
|
.filter((value) => Ref.isRef(value)) as Ref.Any[];
|
|
@@ -88,7 +88,7 @@ const useRelatedObjects = (
|
|
|
88
88
|
|
|
89
89
|
if (options.relations) {
|
|
90
90
|
// TODO(dmaretskyi): Workaround until https://github.com/dxos/dxos/pull/10100 lands.
|
|
91
|
-
const isValidRelation = (obj:
|
|
91
|
+
const isValidRelation = (obj: Relation.Any) => {
|
|
92
92
|
try {
|
|
93
93
|
return Relation.isRelation(obj) && Relation.getSource(obj) && Relation.getTarget(obj);
|
|
94
94
|
} catch {
|
|
@@ -40,8 +40,8 @@ export const SchemaContainer = ({ space }: SchemaPanelProps) => {
|
|
|
40
40
|
/**
|
|
41
41
|
* Subscribe to and retrieve all schemas from a space's schema registry.
|
|
42
42
|
*/
|
|
43
|
-
export const useQuerySpaceSchemas = (space: Space): Type.
|
|
44
|
-
const [schemas, setSchemas] = useState<Type.
|
|
43
|
+
export const useQuerySpaceSchemas = (space: Space): Type.RuntimeType[] => {
|
|
44
|
+
const [schemas, setSchemas] = useState<Type.RuntimeType[]>([]);
|
|
45
45
|
|
|
46
46
|
useEffect(() => {
|
|
47
47
|
const query = space.db.schemaRegistry.query();
|
|
@@ -7,7 +7,7 @@ import React, { forwardRef, useCallback, useEffect, useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { useAppGraph, useCapability } from '@dxos/app-framework/react';
|
|
9
9
|
import { generateName } from '@dxos/display-name';
|
|
10
|
-
import { Obj
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
11
|
import { PublicKey, useClient } from '@dxos/react-client';
|
|
12
12
|
import { type SpaceMember, getSpace, useMembers } from '@dxos/react-client/echo';
|
|
13
13
|
import { type Identity, useIdentity } from '@dxos/react-client/halo';
|
|
@@ -43,7 +43,7 @@ const noViewers = new ComplexMap<PublicKey, ObjectViewerProps>(PublicKey.hash);
|
|
|
43
43
|
const getName = (identity: Identity) => identity.profile?.displayName ?? generateName(identity.identityKey.toHex());
|
|
44
44
|
|
|
45
45
|
export type SpacePresenceProps = {
|
|
46
|
-
object:
|
|
46
|
+
object: Obj.Any;
|
|
47
47
|
spaceKey?: PublicKey;
|
|
48
48
|
};
|
|
49
49
|
|
|
@@ -7,7 +7,7 @@ import * as Schema from 'effect/Schema';
|
|
|
7
7
|
import React, { type ChangeEvent, useCallback, useMemo, useState } from 'react';
|
|
8
8
|
|
|
9
9
|
import { LayoutAction, chain, createIntent } from '@dxos/app-framework';
|
|
10
|
-
import { useIntentDispatcher } from '@dxos/app-framework/react';
|
|
10
|
+
import { useCapabilities, useIntentDispatcher } from '@dxos/app-framework/react';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
12
|
import { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
13
13
|
import { useClient } from '@dxos/react-client';
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
import { HuePicker, IconPicker } from '@dxos/react-ui-pickers';
|
|
25
25
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
26
26
|
|
|
27
|
+
import { SpaceCapabilities } from '../../capabilities';
|
|
27
28
|
import { meta } from '../../meta';
|
|
28
29
|
import { SpaceAction, SpaceForm } from '../../types';
|
|
29
30
|
|
|
@@ -174,6 +175,11 @@ export const SpaceSettingsContainer = ({ space }: SpaceSettingsContainerProps) =
|
|
|
174
175
|
download(new Blob([archive.contents as Uint8Array<ArrayBuffer>]), archive.filename);
|
|
175
176
|
}, [space, download]);
|
|
176
177
|
|
|
178
|
+
const repairs = useCapabilities(SpaceCapabilities.Repair);
|
|
179
|
+
const handleRepair = useCallback(async () => {
|
|
180
|
+
await Promise.all(repairs.map((repair) => repair({ space, isDefault: client.spaces.default === space })));
|
|
181
|
+
}, [client, space, repairs]);
|
|
182
|
+
|
|
177
183
|
return (
|
|
178
184
|
<StackItem.Content scrollable>
|
|
179
185
|
<ControlPage>
|
|
@@ -193,12 +199,25 @@ export const SpaceSettingsContainer = ({ space }: SpaceSettingsContainerProps) =
|
|
|
193
199
|
classNames='container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]'
|
|
194
200
|
/>
|
|
195
201
|
</ControlSection>
|
|
196
|
-
<
|
|
197
|
-
title={t('
|
|
198
|
-
description={t('
|
|
202
|
+
<ControlSection
|
|
203
|
+
title={t('space controls title', { ns: meta.id })}
|
|
204
|
+
description={t('space controls description', { ns: meta.id })}
|
|
199
205
|
>
|
|
200
|
-
<
|
|
201
|
-
|
|
206
|
+
<div role='none' className='container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]'>
|
|
207
|
+
<ControlItemInput
|
|
208
|
+
title={t('backup space title', { ns: meta.id })}
|
|
209
|
+
description={t('backup space description', { ns: meta.id })}
|
|
210
|
+
>
|
|
211
|
+
<Button onClick={handleBackup}>{t('download backup label')}</Button>
|
|
212
|
+
</ControlItemInput>
|
|
213
|
+
<ControlItemInput
|
|
214
|
+
title={t('repair space title', { ns: meta.id })}
|
|
215
|
+
description={t('repair space description', { ns: meta.id })}
|
|
216
|
+
>
|
|
217
|
+
<Button onClick={handleRepair}>{t('repair space label')}</Button>
|
|
218
|
+
</ControlItemInput>
|
|
219
|
+
</div>
|
|
220
|
+
</ControlSection>
|
|
202
221
|
</ControlPage>
|
|
203
222
|
</StackItem.Content>
|
|
204
223
|
);
|
|
@@ -26,7 +26,14 @@ export const ViewEditor = ({ view }: ViewEditorProps) => {
|
|
|
26
26
|
const space = getSpace(view);
|
|
27
27
|
const [schema, setSchema] = useState<Schema.Schema.AnyNoContext>(() => Schema.Struct({}));
|
|
28
28
|
const tags = useQuery(space, Filter.type(Tag.Tag));
|
|
29
|
-
const types = useTypeOptions({
|
|
29
|
+
const types = useTypeOptions({
|
|
30
|
+
space,
|
|
31
|
+
annotation: {
|
|
32
|
+
location: ['database', 'runtime'],
|
|
33
|
+
kind: ['user'],
|
|
34
|
+
registered: ['registered'],
|
|
35
|
+
},
|
|
36
|
+
});
|
|
30
37
|
|
|
31
38
|
useAsyncEffect(async () => {
|
|
32
39
|
if (!view?.query || !space) {
|
|
@@ -56,7 +63,6 @@ export const ViewEditor = ({ view }: ViewEditorProps) => {
|
|
|
56
63
|
const newView = View.make({
|
|
57
64
|
query,
|
|
58
65
|
jsonSchema: Type.toJsonSchema(newSchema),
|
|
59
|
-
presentation: Obj.make(Type.Expando, {}),
|
|
60
66
|
});
|
|
61
67
|
view.projection = Obj.getSnapshot(newView).projection;
|
|
62
68
|
|
|
@@ -81,7 +87,7 @@ export const ViewEditor = ({ view }: ViewEditorProps) => {
|
|
|
81
87
|
registry={space.db.schemaRegistry}
|
|
82
88
|
schema={schema}
|
|
83
89
|
view={view}
|
|
84
|
-
mode='
|
|
90
|
+
mode='tag'
|
|
85
91
|
outerSpacing={false}
|
|
86
92
|
tags={tags}
|
|
87
93
|
types={types}
|
package/src/helpers/query.ts
CHANGED
|
@@ -49,7 +49,7 @@ export const resolveSchemaWithClientAndSpace = (client: Client, space: Space, qu
|
|
|
49
49
|
|
|
50
50
|
const query = space.db.schemaRegistry.query({ typename });
|
|
51
51
|
const schemas = yield* Effect.promise(() => query.run());
|
|
52
|
-
return Array.head(schemas)
|
|
52
|
+
return Array.head(schemas);
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
return resolveSchema(query, resolve).pipe(
|
|
@@ -4,48 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { useCapabilities } from '@dxos/app-framework/react';
|
|
8
|
-
import { Type } from '@dxos/echo';
|
|
9
|
-
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
10
7
|
import { useClient } from '@dxos/react-client';
|
|
11
8
|
import { type Space } from '@dxos/react-client/echo';
|
|
12
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
13
|
-
import { Collection, type TypenameAnnotation, getTypenames } from '@dxos/schema';
|
|
14
10
|
|
|
15
|
-
import {
|
|
11
|
+
import { type TypeInputOptions, getTypenames } from '../types';
|
|
16
12
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
export const useTypeOptions = ({ space, annotation }: { space?: Space; annotation: TypenameAnnotation[] }) => {
|
|
13
|
+
export const useTypeOptions = ({ space, annotation }: { space?: Space; annotation: TypeInputOptions }) => {
|
|
20
14
|
const { t } = useTranslation();
|
|
21
15
|
const client = useClient();
|
|
22
|
-
|
|
23
|
-
const schemaWhitelists = useCapabilities(ClientCapabilities.SchemaWhiteList);
|
|
24
|
-
const whitelistedTypenames = useMemo(
|
|
25
|
-
() => new Set(schemaWhitelists.flatMap((typeArray) => typeArray.map((type) => Type.getTypename(type)))),
|
|
26
|
-
[schemaWhitelists],
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const objectForms = useCapabilities(SpaceCapabilities.ObjectForm);
|
|
30
|
-
const objectFormTypenames = useMemo(
|
|
31
|
-
() =>
|
|
32
|
-
new Set(
|
|
33
|
-
objectForms
|
|
34
|
-
.map((form) => Type.getTypename(form.objectSchema))
|
|
35
|
-
// TODO(wittjosiah): Remove.
|
|
36
|
-
.filter((typename) => !OMIT.includes(typename) && !typename.endsWith('View')),
|
|
37
|
-
),
|
|
38
|
-
[objectForms],
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const typenames = getTypenames({
|
|
42
|
-
annotation,
|
|
43
|
-
whitelistedTypenames,
|
|
44
|
-
objectFormTypenames,
|
|
45
|
-
space,
|
|
46
|
-
client,
|
|
47
|
-
});
|
|
48
|
-
|
|
16
|
+
const typenames = getTypenames({ annotation, space, client });
|
|
49
17
|
return useMemo(
|
|
50
18
|
() =>
|
|
51
19
|
typenames
|
package/src/translations.ts
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Type } from '@dxos/echo';
|
|
6
|
-
import { StoredSchema } from '@dxos/echo/internal';
|
|
7
6
|
import { type Resource } from '@dxos/react-ui';
|
|
8
|
-
import { Collection
|
|
9
|
-
import { Event, Organization, Person, Project, Task } from '@dxos/types';
|
|
7
|
+
import { Collection } from '@dxos/schema';
|
|
8
|
+
import { Event, Message, Organization, Person, Project, Task } from '@dxos/types';
|
|
10
9
|
|
|
11
10
|
import { meta } from './meta';
|
|
12
11
|
|
|
@@ -22,33 +21,17 @@ export const translations = [
|
|
|
22
21
|
'object name placeholder': 'New collection',
|
|
23
22
|
'rename object label': 'Rename collection',
|
|
24
23
|
'delete object label': 'Delete collection',
|
|
24
|
+
'object deleted label': 'Collection deleted',
|
|
25
25
|
},
|
|
26
|
-
[Type.getTypename(
|
|
27
|
-
'typename label': '
|
|
28
|
-
'typename label_zero': '
|
|
29
|
-
'typename label_one': '
|
|
30
|
-
'typename label_other': '
|
|
31
|
-
'object name placeholder': 'New
|
|
32
|
-
'rename object label': 'Rename
|
|
33
|
-
'delete object label': 'Delete
|
|
34
|
-
|
|
35
|
-
[StoredSchema.typename]: {
|
|
36
|
-
'typename label': 'Record',
|
|
37
|
-
'typename label_zero': 'Records',
|
|
38
|
-
'typename label_one': 'Record',
|
|
39
|
-
'typename label_other': 'Records',
|
|
40
|
-
'object name placeholder': 'New record type',
|
|
41
|
-
'rename object label': 'Rename record type',
|
|
42
|
-
'delete object label': 'Delete record type',
|
|
43
|
-
},
|
|
44
|
-
[Type.getTypename(View.View)]: {
|
|
45
|
-
'typename label': 'View',
|
|
46
|
-
'typename label_zero': 'Views',
|
|
47
|
-
'typename label_one': 'View',
|
|
48
|
-
'typename label_other': 'Views',
|
|
49
|
-
'object name placeholder': 'New view',
|
|
50
|
-
'rename object label': 'Rename view',
|
|
51
|
-
'delete object label': 'Delete view',
|
|
26
|
+
[Type.getTypename(Type.PersistentType)]: {
|
|
27
|
+
'typename label': 'Type',
|
|
28
|
+
'typename label_zero': 'Types',
|
|
29
|
+
'typename label_one': 'Type',
|
|
30
|
+
'typename label_other': 'Types',
|
|
31
|
+
'object name placeholder': 'New type',
|
|
32
|
+
'rename object label': 'Rename type',
|
|
33
|
+
'delete object label': 'Delete type',
|
|
34
|
+
'object deleted label': 'Type deleted',
|
|
52
35
|
},
|
|
53
36
|
[Event.Event.typename]: {
|
|
54
37
|
'typename label': 'Event',
|
|
@@ -57,6 +40,13 @@ export const translations = [
|
|
|
57
40
|
'typename label_other': 'Events',
|
|
58
41
|
'object name placeholder': 'New event',
|
|
59
42
|
},
|
|
43
|
+
[Message.Message.typename]: {
|
|
44
|
+
'typename label': 'Message',
|
|
45
|
+
'typename label_zero': 'Messages',
|
|
46
|
+
'typename label_one': 'Message',
|
|
47
|
+
'typename label_other': 'Messages',
|
|
48
|
+
'object name placeholder': 'New message',
|
|
49
|
+
},
|
|
60
50
|
[Organization.Organization.typename]: {
|
|
61
51
|
'typename label': 'Organization',
|
|
62
52
|
'typename label_zero': 'Organizations',
|
|
@@ -100,7 +90,7 @@ export const translations = [
|
|
|
100
90
|
'rename space label': 'Rename space',
|
|
101
91
|
'active space label': 'Active space:',
|
|
102
92
|
'space name label': 'Space name',
|
|
103
|
-
'object name label': '
|
|
93
|
+
'object name label': 'Object name',
|
|
104
94
|
'close space label': 'Close space',
|
|
105
95
|
'open space label': 'Open space',
|
|
106
96
|
'export data label': 'Export data',
|
|
@@ -118,32 +108,31 @@ export const translations = [
|
|
|
118
108
|
'spaces label': 'Spaces',
|
|
119
109
|
'space settings label': 'Spaces',
|
|
120
110
|
'space settings description':
|
|
121
|
-
'Each space has its own settings you can configure, where you can adjust its properties, membership, integrations, and other
|
|
111
|
+
'Each space has its own settings you can configure, where you can adjust its properties, membership, integrations, and other objects specific to that space.',
|
|
122
112
|
'show hidden spaces label': 'Show archived spaces',
|
|
123
113
|
'save files to directory label': 'Save files to disk',
|
|
124
114
|
'select path label': 'Select path',
|
|
115
|
+
'snapshot by schema label': 'Snapshot of objects',
|
|
125
116
|
'rename collection label': 'Rename collection',
|
|
126
|
-
'rename object label': 'Rename
|
|
127
|
-
'duplicate object label': 'Duplicate
|
|
128
|
-
'
|
|
129
|
-
'
|
|
130
|
-
'
|
|
131
|
-
'object deleted label': 'Item deleted',
|
|
132
|
-
'objects deleted label': 'Items deleted',
|
|
133
|
-
'go to object label': 'Open item',
|
|
117
|
+
'rename object label': 'Rename object',
|
|
118
|
+
'duplicate object label': 'Duplicate object',
|
|
119
|
+
'object deleted label': 'Object deleted',
|
|
120
|
+
'objects deleted label': 'Objects deleted',
|
|
121
|
+
'go to object label': 'Open object',
|
|
134
122
|
'found object label': 'Ready.',
|
|
135
|
-
'found object description': 'The requested
|
|
123
|
+
'found object description': 'The requested object is now available.',
|
|
136
124
|
'waiting for object label': 'Loading…',
|
|
137
|
-
'waiting for object description': 'The requested
|
|
125
|
+
'waiting for object description': 'The requested object is still being synchronized.',
|
|
138
126
|
'object not found label': 'Nothing found.',
|
|
139
127
|
'object not found description':
|
|
140
|
-
'The requested
|
|
141
|
-
'missing object message': '
|
|
128
|
+
'The requested object has not been found yet. Ensure there are enough peers online in the space with an updated copy.',
|
|
129
|
+
'missing object message': 'Object not available.',
|
|
142
130
|
'missing object description':
|
|
143
|
-
'The requested
|
|
131
|
+
'The requested object has not been found yet. Ensure there are enough peers online in the space with an updated copy.',
|
|
144
132
|
'create object in space label': 'Add to space',
|
|
145
133
|
'create object in collection label': 'Add to collection',
|
|
146
|
-
'create object in
|
|
134
|
+
'create object in system collection label': 'Add to system collection',
|
|
135
|
+
'add view to schema label': 'Add view to type',
|
|
147
136
|
'space members label': 'Space members',
|
|
148
137
|
'active space members heading': 'Online ({{count}})',
|
|
149
138
|
'inactive space members heading': 'Offline ({{count}})',
|
|
@@ -161,10 +150,10 @@ export const translations = [
|
|
|
161
150
|
'location label': 'Located in',
|
|
162
151
|
'space limit label': 'Space Limit Reached',
|
|
163
152
|
'space limit description':
|
|
164
|
-
'This space has reached the maximum number of
|
|
153
|
+
'This space has reached the maximum number of objects for the beta. This limit includes deleted objects currently, but those can be permanently removed with the cleanup action.',
|
|
165
154
|
'space limit close label': 'Close',
|
|
166
155
|
'remove deleted objects label': 'Cleanup',
|
|
167
|
-
'remove deleted objects alt': 'Permanently remove deleted
|
|
156
|
+
'remove deleted objects alt': 'Permanently remove deleted objects to free up space.',
|
|
168
157
|
'copy link label': 'Copy link',
|
|
169
158
|
'default on space create label': 'On space create',
|
|
170
159
|
'sync status title': 'Sync status',
|
|
@@ -181,11 +170,11 @@ export const translations = [
|
|
|
181
170
|
'remote synced label': 'Synced with peers',
|
|
182
171
|
'syncing label': 'Space syncing',
|
|
183
172
|
'show all label': 'Show all',
|
|
184
|
-
'no sync status label': 'No space with missing
|
|
173
|
+
'no sync status label': 'No space with missing objects.',
|
|
185
174
|
'create space dialog title': 'Create Space',
|
|
186
175
|
'create object dialog title': 'Create {{object}}',
|
|
187
176
|
'space input placeholder': 'Select space',
|
|
188
|
-
'schema input placeholder': 'Select
|
|
177
|
+
'schema input placeholder': 'Select type',
|
|
189
178
|
'creating object type label': 'Type',
|
|
190
179
|
'creating in space label': 'Location',
|
|
191
180
|
'creating in collection label': 'In Collection',
|
|
@@ -196,7 +185,7 @@ export const translations = [
|
|
|
196
185
|
'foreign keys': 'Foreign Keys',
|
|
197
186
|
'add key': 'Add Key',
|
|
198
187
|
'open space settings label': 'Open settings',
|
|
199
|
-
'related objects label': 'Related
|
|
188
|
+
'related objects label': 'Related Objects',
|
|
200
189
|
|
|
201
190
|
'row details no selection label': 'No objects selected',
|
|
202
191
|
'companion selected objects label': 'Selected',
|
|
@@ -218,10 +207,10 @@ export const translations = [
|
|
|
218
207
|
'space settings properties label': 'General settings',
|
|
219
208
|
'space properties settings verbose label': 'Manage space properties',
|
|
220
209
|
'space properties settings description': 'You can configure how this space is displayed in the app here.',
|
|
221
|
-
'space settings schema label': '
|
|
222
|
-
'schema verbose label': 'Manage
|
|
223
|
-
'schema description': 'You can manage all of the
|
|
224
|
-
'no schemas found message': 'No
|
|
210
|
+
'space settings schema label': 'Types',
|
|
211
|
+
'schema verbose label': 'Manage types',
|
|
212
|
+
'schema description': 'You can manage all of the types stored within this space here.',
|
|
213
|
+
'no schemas found message': 'No types found',
|
|
225
214
|
'display name input placeholder': 'Space name',
|
|
226
215
|
'display name description': 'Name of the space as it appears in the app.',
|
|
227
216
|
'icon description': 'Icon used to represent the space in the app.',
|
|
@@ -231,11 +220,17 @@ export const translations = [
|
|
|
231
220
|
'archive space description':
|
|
232
221
|
'Archiving a space will remove it from the sidebar and stop replicating updates, but will not delete the data. You can unarchive it by enabling archived spaces in the app settings.',
|
|
233
222
|
'archive space label': 'Archive',
|
|
234
|
-
'
|
|
223
|
+
'unarchive space label': 'Unarchive',
|
|
224
|
+
|
|
225
|
+
'space controls title': 'Space Controls',
|
|
226
|
+
'space controls description': 'Advanced controls for this space.',
|
|
227
|
+
'backup space title': 'Backup Space',
|
|
235
228
|
'backup space description':
|
|
236
229
|
'Download a backup of the space. Contains all data in the space in an unencrypted format.',
|
|
237
|
-
'download backup': 'Download backup',
|
|
238
|
-
'
|
|
230
|
+
'download backup label': 'Download backup',
|
|
231
|
+
'repair space title': 'Repair Space',
|
|
232
|
+
'repair space description': 'Run repair operations on the space.',
|
|
233
|
+
'repair space label': 'Run repairs',
|
|
239
234
|
|
|
240
235
|
'sync edge connected label': 'Edge connected',
|
|
241
236
|
'sync edge disconnected label': 'Edge disconnected',
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { type Client } from '@dxos/client';
|
|
9
|
+
import { type Space } from '@dxos/client/echo';
|
|
10
|
+
import { Type } from '@dxos/echo';
|
|
11
|
+
import { EntityKind, SystemTypeAnnotation, createAnnotationHelper, getTypeAnnotation } from '@dxos/echo/internal';
|
|
12
|
+
|
|
13
|
+
export const TypeInputOptions = Schema.Struct({
|
|
14
|
+
location: Schema.Array(Schema.Literal('database', 'runtime')),
|
|
15
|
+
kind: Schema.Array(Schema.Literal('system', 'user')),
|
|
16
|
+
registered: Schema.Array(Schema.Literal('registered', 'unregistered')),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type TypeInputOptions = Schema.Schema.Type<typeof TypeInputOptions>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Used in forms to identify the field representing an object's type and determine which types are shown as options.
|
|
23
|
+
*/
|
|
24
|
+
export const TypeInputOptionsAnnotationId = Symbol.for('@dxos/schema/annotation/TypeInputOptions');
|
|
25
|
+
export const TypeInputOptionsAnnotation = createAnnotationHelper<TypeInputOptions>(TypeInputOptionsAnnotationId);
|
|
26
|
+
|
|
27
|
+
// TODO(wittjosiah): This is way to complicated and needs to be simplified.
|
|
28
|
+
export const getTypenames = ({
|
|
29
|
+
annotation,
|
|
30
|
+
space,
|
|
31
|
+
client,
|
|
32
|
+
}: {
|
|
33
|
+
annotation: TypeInputOptions;
|
|
34
|
+
space?: Space;
|
|
35
|
+
client: Client;
|
|
36
|
+
}) => {
|
|
37
|
+
const includeRuntime = annotation.location.includes('runtime');
|
|
38
|
+
const includeDatabase = annotation.location.includes('database');
|
|
39
|
+
const includeSystemType = annotation.kind.includes('system');
|
|
40
|
+
const includeUserType = annotation.kind.includes('user');
|
|
41
|
+
const includeRegistered = annotation.registered.includes('registered');
|
|
42
|
+
const includeUnregistered = annotation.registered.includes('unregistered');
|
|
43
|
+
|
|
44
|
+
const runtimeTypenames = includeRuntime
|
|
45
|
+
? client.graph.schemaRegistry.schemas
|
|
46
|
+
.filter((schema) => {
|
|
47
|
+
const relation = getTypeAnnotation(schema)?.kind === EntityKind.Relation;
|
|
48
|
+
if (relation) {
|
|
49
|
+
return includeSystemType;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const system = SystemTypeAnnotation.get(schema).pipe(Option.getOrElse(() => false));
|
|
53
|
+
if (system) {
|
|
54
|
+
return includeSystemType;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return includeUserType;
|
|
58
|
+
})
|
|
59
|
+
.filter((schema) => {
|
|
60
|
+
const registered = space?.properties.staticRecords?.includes(Type.getTypename(schema));
|
|
61
|
+
return registered ? includeRegistered : includeUnregistered;
|
|
62
|
+
})
|
|
63
|
+
.map((schema) => Type.getTypename(schema))
|
|
64
|
+
: [];
|
|
65
|
+
|
|
66
|
+
const databaseTypenames =
|
|
67
|
+
includeDatabase && includeRegistered && space
|
|
68
|
+
? space.db.schemaRegistry
|
|
69
|
+
.query()
|
|
70
|
+
.runSync()
|
|
71
|
+
.map((schema) => schema.typename)
|
|
72
|
+
: [];
|
|
73
|
+
|
|
74
|
+
return Array.from(new Set<string>([...runtimeTypenames, ...databaseTypenames])).sort();
|
|
75
|
+
};
|
package/src/types/index.ts
CHANGED
package/src/types/types.ts
CHANGED
|
@@ -5,17 +5,18 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { type AnyIntentChain } from '@dxos/app-framework';
|
|
8
|
-
import { type Obj, Type } from '@dxos/echo';
|
|
9
|
-
import { type BaseObject, EchoSchema, StoredSchema } from '@dxos/echo/internal';
|
|
8
|
+
import { type Obj, QueryAST, Type } from '@dxos/echo';
|
|
10
9
|
import { type PublicKey } from '@dxos/react-client';
|
|
11
10
|
// TODO(wittjosiah): This pulls in full client.
|
|
12
11
|
import { EchoObjectSchema, ReactiveObjectSchema, type Space, SpaceSchema } from '@dxos/react-client/echo';
|
|
13
12
|
import { CancellableInvitationObservable, Invitation } from '@dxos/react-client/invitations';
|
|
14
|
-
import { Collection, FieldSchema,
|
|
13
|
+
import { Collection, FieldSchema, View } from '@dxos/schema';
|
|
15
14
|
import { type ComplexMap } from '@dxos/util';
|
|
16
15
|
|
|
17
16
|
import { meta } from '../meta';
|
|
18
17
|
|
|
18
|
+
import { TypeInputOptionsAnnotation } from './form';
|
|
19
|
+
|
|
19
20
|
export const SPACE_DIRECTORY_HANDLE = `${meta.id}/directory`;
|
|
20
21
|
|
|
21
22
|
export const SPACE_TYPE = 'dxos.org/type/Space';
|
|
@@ -82,7 +83,7 @@ export type SpaceSettingsProps = Schema.Schema.Type<typeof SpaceSettingsSchema>;
|
|
|
82
83
|
|
|
83
84
|
export type SerializerMap = Record<string, TypedObjectSerializer>;
|
|
84
85
|
|
|
85
|
-
export interface TypedObjectSerializer<T extends Obj.Any =
|
|
86
|
+
export interface TypedObjectSerializer<T extends Obj.Any = Obj.Any> {
|
|
86
87
|
serialize(params: { object: T }): Promise<string>;
|
|
87
88
|
|
|
88
89
|
/**
|
|
@@ -93,6 +94,8 @@ export interface TypedObjectSerializer<T extends Obj.Any = Type.Expando> {
|
|
|
93
94
|
deserialize(params: { content: string; space: Space; newId?: boolean }): Promise<T>;
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
export type CreateObjectIntent = (props: any, options: { space: Space }) => AnyIntentChain;
|
|
98
|
+
|
|
96
99
|
// TODO(burdon): Move to FormatEnum or SDK.
|
|
97
100
|
export const IconAnnotationId = Symbol.for('@dxos/plugin-space/annotation/Icon');
|
|
98
101
|
export const HueAnnotationId = Symbol.for('@dxos/plugin-space/annotation/Hue');
|
|
@@ -105,15 +108,6 @@ export const SpaceForm = Schema.Struct({
|
|
|
105
108
|
edgeReplication: Schema.Boolean.annotations({ title: 'Enable EDGE Replication' }),
|
|
106
109
|
});
|
|
107
110
|
|
|
108
|
-
export type ObjectForm<T extends BaseObject = BaseObject> = {
|
|
109
|
-
objectSchema: Schema.Schema.AnyNoContext;
|
|
110
|
-
formSchema?: Schema.Schema<T, any>;
|
|
111
|
-
hidden?: boolean;
|
|
112
|
-
getIntent: (props: T, options: { space: Space }) => AnyIntentChain;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const defineObjectForm = <T extends BaseObject>(form: ObjectForm<T>) => form;
|
|
116
|
-
|
|
117
111
|
export const SPACE_ACTION = `${meta.id}/action`;
|
|
118
112
|
|
|
119
113
|
export namespace SpaceAction {
|
|
@@ -217,12 +211,26 @@ export namespace SpaceAction {
|
|
|
217
211
|
output: Schema.Boolean,
|
|
218
212
|
}) {}
|
|
219
213
|
|
|
214
|
+
export class Snapshot extends Schema.TaggedClass<Snapshot>()(`${SPACE_ACTION}/snapshot`, {
|
|
215
|
+
input: Schema.Struct({
|
|
216
|
+
space: SpaceSchema,
|
|
217
|
+
query: QueryAST.Query.pipe(Schema.optional),
|
|
218
|
+
}),
|
|
219
|
+
output: Schema.Struct({
|
|
220
|
+
snapshot: Schema.instanceOf(Blob),
|
|
221
|
+
}),
|
|
222
|
+
}) {}
|
|
223
|
+
|
|
220
224
|
export const StoredSchemaForm = Schema.Struct({
|
|
221
225
|
name: Schema.optional(Schema.String),
|
|
222
|
-
typename: Schema.
|
|
223
|
-
Schema.
|
|
224
|
-
|
|
226
|
+
typename: Schema.String.pipe(
|
|
227
|
+
Schema.annotations({ title: 'Select type (leave blank to create a new type)' }),
|
|
228
|
+
TypeInputOptionsAnnotation.set({
|
|
229
|
+
location: ['runtime'],
|
|
230
|
+
kind: ['user'],
|
|
231
|
+
registered: ['unregistered'],
|
|
225
232
|
}),
|
|
233
|
+
Schema.optional,
|
|
226
234
|
),
|
|
227
235
|
});
|
|
228
236
|
|
|
@@ -251,8 +259,8 @@ export namespace SpaceAction {
|
|
|
251
259
|
output: Schema.Struct({
|
|
252
260
|
// TODO(wittjosiah): ObjectId.
|
|
253
261
|
id: Schema.String,
|
|
254
|
-
object:
|
|
255
|
-
schema: Schema.instanceOf(
|
|
262
|
+
object: Type.PersistentType,
|
|
263
|
+
schema: Schema.instanceOf(Type.RuntimeType),
|
|
256
264
|
}),
|
|
257
265
|
}) {}
|
|
258
266
|
|
|
@@ -369,22 +377,4 @@ export namespace CollectionAction {
|
|
|
369
377
|
object: Collection.Collection,
|
|
370
378
|
}),
|
|
371
379
|
}) {}
|
|
372
|
-
|
|
373
|
-
export const QueryCollectionForm = Schema.Struct({
|
|
374
|
-
name: Schema.optional(Schema.String),
|
|
375
|
-
typename: Schema.String.annotations({
|
|
376
|
-
[TypenameAnnotationId]: ['object-form'],
|
|
377
|
-
}),
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
export class CreateQueryCollection extends Schema.TaggedClass<CreateQueryCollection>()(
|
|
381
|
-
'dxos.org/plugin/collection/action/create-query-collection',
|
|
382
|
-
{
|
|
383
|
-
input: QueryCollectionForm,
|
|
384
|
-
output: Schema.Struct({
|
|
385
|
-
// TODO(wittjosiah): Remove cast.
|
|
386
|
-
object: EchoObjectSchema, // Collection.QueryCollection,
|
|
387
|
-
}),
|
|
388
|
-
},
|
|
389
|
-
) {}
|
|
390
380
|
}
|