@dxos/plugin-client 0.8.1 → 0.8.2-main.2f9c567
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/{app-graph-builder-WAS4YZNA.mjs → app-graph-builder-2MEWX6SJ.mjs} +2 -2
- package/dist/lib/browser/chunk-KBYCZ4HW.mjs +105 -0
- package/dist/lib/browser/chunk-KBYCZ4HW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XZ4TQC56.mjs → chunk-LOUI7XSH.mjs} +21 -21
- package/dist/lib/browser/chunk-LOUI7XSH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +6 -6
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-NCISOZW4.mjs → intent-resolver-UME7DARZ.mjs} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-J7SZR2J6.mjs → react-surface-A2R3JYXX.mjs} +3 -3
- package/dist/lib/browser/{schema-JQAT6Q7S.mjs → schema-defs-VAAQHAM7.mjs} +4 -4
- package/dist/lib/browser/{schema-JQAT6Q7S.mjs.map → schema-defs-VAAQHAM7.mjs.map} +2 -2
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{app-graph-builder-PXOJZJO5.cjs → app-graph-builder-JBJ243GL.cjs} +13 -13
- package/dist/lib/node/{chunk-FROKBEVH.cjs → chunk-7MPFFPR7.cjs} +47 -47
- package/dist/lib/node/chunk-7MPFFPR7.cjs.map +7 -0
- package/dist/lib/node/{chunk-3JE5BFCT.cjs → chunk-HEC6UXQX.cjs} +21 -21
- package/dist/lib/node/chunk-HEC6UXQX.cjs.map +7 -0
- package/dist/lib/node/index.cjs +6 -6
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-U2576ALY.cjs → intent-resolver-33S7BRJP.cjs} +22 -22
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-BSTIXMER.cjs → react-surface-FYWDPVXT.cjs} +24 -24
- package/dist/lib/node/{schema-INQ72F54.cjs → schema-defs-XMQEOUXA.cjs} +6 -6
- package/dist/lib/node/{schema-INQ72F54.cjs.map → schema-defs-XMQEOUXA.cjs.map} +2 -2
- package/dist/lib/node/types.cjs +3 -3
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{app-graph-builder-KIN6NWFI.mjs → app-graph-builder-7NA7GGEF.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-LZN2UNN7.mjs → chunk-37CRJHYH.mjs} +21 -21
- package/dist/lib/node-esm/chunk-37CRJHYH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ALO6XJEZ.mjs +106 -0
- package/dist/lib/node-esm/chunk-ALO6XJEZ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +6 -6
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-G25U4UGI.mjs → intent-resolver-4ULBB4ZA.mjs} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-ZPI7T4EM.mjs → react-surface-VXMRB7IY.mjs} +3 -3
- package/dist/lib/node-esm/{schema-OK7HY3JJ.mjs → schema-defs-YQULJ6B6.mjs} +4 -4
- package/dist/lib/node-esm/{schema-OK7HY3JJ.mjs.map → schema-defs-YQULJ6B6.mjs.map} +2 -2
- package/dist/lib/node-esm/types.mjs +1 -1
- package/dist/types/src/capabilities/app-graph-builder.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/{schema.d.ts → schema-defs.d.ts} +1 -1
- package/dist/types/src/capabilities/schema-defs.d.ts.map +1 -0
- package/dist/types/src/components/DevicesContainer.d.ts.map +1 -1
- package/dist/types/src/components/ProfileContainer.d.ts.map +1 -1
- package/dist/types/src/components/RecoveryCredentialsContainer.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +51 -51
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +26 -25
- package/src/ClientPlugin.ts +2 -2
- package/src/capabilities/index.ts +1 -1
- package/src/components/DevicesContainer.tsx +69 -52
- package/src/components/ProfileContainer.tsx +30 -21
- package/src/components/RecoveryCredentialsContainer.tsx +48 -46
- package/src/translations.ts +1 -1
- package/src/types.ts +48 -44
- package/dist/lib/browser/chunk-AN7FJKIJ.mjs +0 -105
- package/dist/lib/browser/chunk-AN7FJKIJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-XZ4TQC56.mjs.map +0 -7
- package/dist/lib/node/chunk-3JE5BFCT.cjs.map +0 -7
- package/dist/lib/node/chunk-FROKBEVH.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-AD5W5QCQ.mjs +0 -106
- package/dist/lib/node-esm/chunk-AD5W5QCQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LZN2UNN7.mjs.map +0 -7
- package/dist/types/src/capabilities/schema.d.ts.map +0 -1
- /package/dist/lib/browser/{app-graph-builder-WAS4YZNA.mjs.map → app-graph-builder-2MEWX6SJ.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-resolver-NCISOZW4.mjs.map → intent-resolver-UME7DARZ.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-J7SZR2J6.mjs.map → react-surface-A2R3JYXX.mjs.map} +0 -0
- /package/dist/lib/node/{app-graph-builder-PXOJZJO5.cjs.map → app-graph-builder-JBJ243GL.cjs.map} +0 -0
- /package/dist/lib/node/{intent-resolver-U2576ALY.cjs.map → intent-resolver-33S7BRJP.cjs.map} +0 -0
- /package/dist/lib/node/{react-surface-BSTIXMER.cjs.map → react-surface-FYWDPVXT.cjs.map} +0 -0
- /package/dist/lib/node-esm/{app-graph-builder-KIN6NWFI.mjs.map → app-graph-builder-7NA7GGEF.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-resolver-G25U4UGI.mjs.map → intent-resolver-4ULBB4ZA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-surface-ZPI7T4EM.mjs.map → react-surface-VXMRB7IY.mjs.map} +0 -0
- /package/src/capabilities/{schema.ts → schema-defs.ts} +0 -0
package/src/ClientPlugin.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
Migrations,
|
|
12
12
|
ReactContext,
|
|
13
13
|
ReactSurface,
|
|
14
|
-
|
|
14
|
+
SchemaDefs,
|
|
15
15
|
} from './capabilities';
|
|
16
16
|
import { ClientEvents } from './events';
|
|
17
17
|
import { meta } from './meta';
|
|
@@ -41,7 +41,7 @@ export const ClientPlugin = ({
|
|
|
41
41
|
id: `${meta.id}/module/schema`,
|
|
42
42
|
activatesOn: ClientEvents.ClientReady,
|
|
43
43
|
activatesBefore: [ClientEvents.SetupSchema],
|
|
44
|
-
activate:
|
|
44
|
+
activate: SchemaDefs,
|
|
45
45
|
}),
|
|
46
46
|
defineModule({
|
|
47
47
|
id: `${meta.id}/module/migration`,
|
|
@@ -10,6 +10,6 @@ export const IntentResolver = lazy(async () => import('./intent-resolver'));
|
|
|
10
10
|
export const Migrations = lazy(async () => import('./migrations'));
|
|
11
11
|
export const ReactContext = lazy(async () => import('./react-context'));
|
|
12
12
|
export const ReactSurface = lazy(async () => import('./react-surface'));
|
|
13
|
-
export const
|
|
13
|
+
export const SchemaDefs = lazy(async () => import('./schema-defs'));
|
|
14
14
|
|
|
15
15
|
export * from './capabilities';
|
|
@@ -13,7 +13,14 @@ import { type Device, useDevices } from '@dxos/react-client/halo';
|
|
|
13
13
|
import { type CancellableInvitationObservable, Invitation, InvitationEncoder } from '@dxos/react-client/invitations';
|
|
14
14
|
import { useNetworkStatus } from '@dxos/react-client/mesh';
|
|
15
15
|
import { Button, Clipboard, IconButton, List, useId, useTranslation } from '@dxos/react-ui';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
ControlFrame,
|
|
18
|
+
ControlFrameItem,
|
|
19
|
+
ControlGroup,
|
|
20
|
+
ControlItem,
|
|
21
|
+
ControlPage,
|
|
22
|
+
ControlSection,
|
|
23
|
+
} from '@dxos/react-ui-form';
|
|
17
24
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
18
25
|
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
19
26
|
import { AuthCode, Centered, DeviceListItem, Emoji, Viewport } from '@dxos/shell/react';
|
|
@@ -46,57 +53,67 @@ export const DevicesContainer = ({
|
|
|
46
53
|
|
|
47
54
|
return (
|
|
48
55
|
<Clipboard.Provider>
|
|
49
|
-
<StackItem.Content classNames='
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
56
|
+
<StackItem.Content classNames='block overflow-y-auto'>
|
|
57
|
+
<ControlPage>
|
|
58
|
+
<ControlSection
|
|
59
|
+
title={t('devices verbose label', { ns: CLIENT_PLUGIN })}
|
|
60
|
+
description={t('devices description', { ns: CLIENT_PLUGIN })}
|
|
61
|
+
>
|
|
62
|
+
<ControlFrame>
|
|
63
|
+
<ControlFrameItem title={t('devices label', { ns: CLIENT_PLUGIN })}>
|
|
64
|
+
<List>
|
|
65
|
+
{devices.map((device: Device) => {
|
|
66
|
+
return (
|
|
67
|
+
<DeviceListItem
|
|
68
|
+
key={device.deviceKey.toHex()}
|
|
69
|
+
device={device}
|
|
70
|
+
connectionState={connectionState}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
})}
|
|
74
|
+
</List>
|
|
75
|
+
</ControlFrameItem>
|
|
76
|
+
<ControlFrameItem title='Add device'>
|
|
77
|
+
<DeviceInvitation createInvitationUrl={createInvitationUrl} />
|
|
78
|
+
</ControlFrameItem>
|
|
79
|
+
</ControlFrame>
|
|
80
|
+
</ControlSection>
|
|
81
|
+
<ControlSection
|
|
82
|
+
title={t('danger zone title', { ns: CLIENT_PLUGIN })}
|
|
83
|
+
description={t('danger zone description', { ns: CLIENT_PLUGIN })}
|
|
84
|
+
>
|
|
85
|
+
<ControlGroup>
|
|
86
|
+
<ControlItem
|
|
87
|
+
title={t('reset device label')}
|
|
88
|
+
description={t('reset device description', { ns: CLIENT_PLUGIN })}
|
|
89
|
+
>
|
|
90
|
+
<Button variant='destructive' onClick={handleResetStorage} data-testid='devicesContainer.reset'>
|
|
91
|
+
{t('reset device label')}
|
|
92
|
+
</Button>
|
|
93
|
+
</ControlItem>
|
|
94
|
+
<ControlItem
|
|
95
|
+
title={t('recover identity label')}
|
|
96
|
+
description={t('recover identity description', { ns: CLIENT_PLUGIN })}
|
|
97
|
+
>
|
|
98
|
+
<Button variant='destructive' onClick={handleRecover} data-testid='devicesContainer.recover'>
|
|
99
|
+
{t('recover identity label')}
|
|
100
|
+
</Button>
|
|
101
|
+
</ControlItem>
|
|
102
|
+
<ControlItem
|
|
103
|
+
title={t('join new identity label')}
|
|
104
|
+
description={t('join new identity description', { ns: CLIENT_PLUGIN })}
|
|
105
|
+
>
|
|
106
|
+
<Button
|
|
107
|
+
variant='destructive'
|
|
108
|
+
onClick={handleJoinNewIdentity}
|
|
109
|
+
data-testid='devicesContainer.joinExisting'
|
|
110
|
+
>
|
|
111
|
+
{t('join new identity label')}
|
|
112
|
+
</Button>
|
|
113
|
+
</ControlItem>
|
|
114
|
+
</ControlGroup>
|
|
115
|
+
</ControlSection>
|
|
116
|
+
</ControlPage>
|
|
100
117
|
</StackItem.Content>
|
|
101
118
|
</Clipboard.Provider>
|
|
102
119
|
);
|
|
@@ -2,14 +2,21 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Schema
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
6
|
import React, { type ChangeEvent, useCallback, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { debounce } from '@dxos/async';
|
|
9
9
|
import { useClient } from '@dxos/react-client';
|
|
10
10
|
import { type Identity, useIdentity } from '@dxos/react-client/halo';
|
|
11
11
|
import { ButtonGroup, Clipboard, Input, useTranslation } from '@dxos/react-ui';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
Form,
|
|
14
|
+
type InputComponent,
|
|
15
|
+
ControlItem,
|
|
16
|
+
ControlItemInput,
|
|
17
|
+
ControlSection,
|
|
18
|
+
ControlPage,
|
|
19
|
+
} from '@dxos/react-ui-form';
|
|
13
20
|
import { EmojiPickerBlock, HuePicker } from '@dxos/react-ui-pickers';
|
|
14
21
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
15
22
|
import { hexToHue, hexToEmoji } from '@dxos/util';
|
|
@@ -136,28 +143,30 @@ export const ProfileContainer = () => {
|
|
|
136
143
|
);
|
|
137
144
|
|
|
138
145
|
return (
|
|
139
|
-
<StackItem.Content classNames='
|
|
140
|
-
<
|
|
141
|
-
<
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
<StackItem.Content classNames='block overflow-y-auto'>
|
|
147
|
+
<ControlPage>
|
|
148
|
+
<Clipboard.Provider>
|
|
149
|
+
<ControlSection title={t('profile label')} description={t('profile description')}>
|
|
150
|
+
<Form
|
|
151
|
+
schema={ProfileSchema}
|
|
152
|
+
values={values}
|
|
153
|
+
autoSave
|
|
154
|
+
onSave={handleSave}
|
|
155
|
+
Custom={customElements}
|
|
156
|
+
classNames='p-0 container-max-width [&_[role="form"]]:grid [&_[role="form"]]:grid-cols-1 md:[&_[role="form"]]:grid-cols-[1fr_min-content] [&_[role="form"]]:gap-4'
|
|
157
|
+
/>
|
|
158
|
+
</ControlSection>
|
|
159
|
+
</Clipboard.Provider>
|
|
160
|
+
</ControlPage>
|
|
152
161
|
</StackItem.Content>
|
|
153
162
|
);
|
|
154
163
|
};
|
|
155
164
|
|
|
156
165
|
// TODO(wittjosiah): Integrate annotations with translations.
|
|
157
|
-
const ProfileSchema =
|
|
158
|
-
displayName:
|
|
159
|
-
emoji:
|
|
160
|
-
hue:
|
|
161
|
-
did:
|
|
166
|
+
const ProfileSchema = Schema.Struct({
|
|
167
|
+
displayName: Schema.String.annotations({ title: 'Display name' }),
|
|
168
|
+
emoji: Schema.String.annotations({ title: 'Avatar' }),
|
|
169
|
+
hue: Schema.String.annotations({ title: 'Color' }),
|
|
170
|
+
did: Schema.String.annotations({ title: 'DID' }),
|
|
162
171
|
});
|
|
163
|
-
type Profile =
|
|
172
|
+
type Profile = Schema.Schema.Type<typeof ProfileSchema>;
|
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
|
7
7
|
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { useCredentials } from '@dxos/react-client/halo';
|
|
9
9
|
import { Icon, IconButton, List, ListItem, useTranslation, Message } from '@dxos/react-ui';
|
|
10
|
-
import { ControlGroup, ControlItem, ControlSection } from '@dxos/react-ui-form';
|
|
10
|
+
import { ControlGroup, ControlItem, ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
11
11
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
12
12
|
|
|
13
13
|
import { CLIENT_PLUGIN } from '../meta';
|
|
@@ -24,51 +24,53 @@ export const RecoveryCredentialsContainer = () => {
|
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
|
-
<StackItem.Content classNames='
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<Message.
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<ListItem.
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
27
|
+
<StackItem.Content classNames='block overflow-y-auto'>
|
|
28
|
+
<ControlPage>
|
|
29
|
+
<ControlSection title={t('recovery setup dialog title')} description={t('recovery setup dialog description')}>
|
|
30
|
+
<ControlGroup>
|
|
31
|
+
<ControlItem title={t('create passkey label')} description={t('create passkey description')}>
|
|
32
|
+
<IconButton
|
|
33
|
+
label={t('create passkey label')}
|
|
34
|
+
icon='ph--key--duotone'
|
|
35
|
+
variant='primary'
|
|
36
|
+
size={5}
|
|
37
|
+
onClick={() => dispatch(createIntent(ClientAction.CreatePasskey))}
|
|
38
|
+
/>
|
|
39
|
+
</ControlItem>
|
|
40
|
+
<ControlItem title={t('create recovery code label')} description={t('create recovery code description')}>
|
|
41
|
+
<IconButton
|
|
42
|
+
label={t('create recovery code label')}
|
|
43
|
+
icon='ph--receipt--duotone'
|
|
44
|
+
variant='default'
|
|
45
|
+
size={5}
|
|
46
|
+
onClick={() => dispatch(createIntent(ClientAction.CreateRecoveryCode))}
|
|
47
|
+
/>
|
|
48
|
+
</ControlItem>
|
|
49
|
+
</ControlGroup>
|
|
50
|
+
</ControlSection>
|
|
51
|
+
<ControlSection title={t('credentials list label')}>
|
|
52
|
+
{recoveryCredentials.length < 1 ? (
|
|
53
|
+
<Message.Root valence='error' className='container-max-width'>
|
|
54
|
+
<Message.Title>
|
|
55
|
+
<Icon icon='ph--shield-warning--duotone' size={5} classNames='inline-block align-top mbs-px mie-1' />
|
|
56
|
+
{t('no credentials title')}
|
|
57
|
+
</Message.Title>
|
|
58
|
+
<Message.Body>{t('no credentials message')}</Message.Body>
|
|
59
|
+
</Message.Root>
|
|
60
|
+
) : (
|
|
61
|
+
<List classNames='container-max-width pli-2'>
|
|
62
|
+
{recoveryCredentials.map((credential) => (
|
|
63
|
+
<ListItem.Root key={credential.id?.toHex()}>
|
|
64
|
+
<ListItem.Endcap>
|
|
65
|
+
<Icon icon='ph--key--regular' size={5} />
|
|
66
|
+
</ListItem.Endcap>
|
|
67
|
+
<ListItem.Heading>{credential.issuanceDate.toLocaleString()}</ListItem.Heading>
|
|
68
|
+
</ListItem.Root>
|
|
69
|
+
))}
|
|
70
|
+
</List>
|
|
71
|
+
)}
|
|
72
|
+
</ControlSection>
|
|
73
|
+
</ControlPage>
|
|
72
74
|
</StackItem.Content>
|
|
73
75
|
);
|
|
74
76
|
};
|
package/src/translations.ts
CHANGED
|
@@ -42,7 +42,7 @@ export default [
|
|
|
42
42
|
'open user account label': 'Open user account',
|
|
43
43
|
'manage credentials dialog title': 'Manage Account Recovery',
|
|
44
44
|
'credentials list label': 'Recovery credentials',
|
|
45
|
-
'no credentials title': 'There
|
|
45
|
+
'no credentials title': 'WARNING: There is currently no way to recover your account.',
|
|
46
46
|
'no credentials message': 'Create a recovery credential above to secure your account.',
|
|
47
47
|
'recovery setup dialog title': 'Account Security',
|
|
48
48
|
'recovery setup dialog description':
|
package/src/types.ts
CHANGED
|
@@ -2,84 +2,88 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
|
+
|
|
5
7
|
import { type PluginsContext } from '@dxos/app-framework';
|
|
6
|
-
import { S } from '@dxos/echo-schema';
|
|
7
8
|
import { type Client, PublicKey, type ClientOptions } from '@dxos/react-client';
|
|
8
9
|
import { type MaybePromise } from '@dxos/util';
|
|
9
10
|
|
|
10
11
|
import { CLIENT_PLUGIN } from './meta';
|
|
11
12
|
|
|
12
13
|
// TODO(wittjosiah): Factor out. Generate?
|
|
13
|
-
const IdentitySchema =
|
|
14
|
-
identityKey:
|
|
15
|
-
spaceKey:
|
|
16
|
-
profile:
|
|
17
|
-
|
|
18
|
-
displayName:
|
|
19
|
-
avatarCid:
|
|
20
|
-
data:
|
|
14
|
+
const IdentitySchema = Schema.Struct({
|
|
15
|
+
identityKey: Schema.instanceOf(PublicKey),
|
|
16
|
+
spaceKey: Schema.optional(Schema.instanceOf(PublicKey)),
|
|
17
|
+
profile: Schema.optional(
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
displayName: Schema.optional(Schema.String),
|
|
20
|
+
avatarCid: Schema.optional(Schema.String),
|
|
21
|
+
data: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
|
|
21
22
|
}),
|
|
22
23
|
),
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
const CLIENT_ACTION = `${CLIENT_PLUGIN}/action`;
|
|
26
27
|
export namespace ClientAction {
|
|
27
|
-
export class CreateIdentity extends
|
|
28
|
-
input:
|
|
29
|
-
displayName:
|
|
28
|
+
export class CreateIdentity extends Schema.TaggedClass<CreateIdentity>()(`${CLIENT_ACTION}/create-identity`, {
|
|
29
|
+
input: Schema.Struct({
|
|
30
|
+
displayName: Schema.optional(Schema.String),
|
|
30
31
|
}),
|
|
31
32
|
output: IdentitySchema,
|
|
32
33
|
}) {}
|
|
33
34
|
|
|
34
|
-
export class JoinIdentity extends
|
|
35
|
-
input:
|
|
36
|
-
invitationCode:
|
|
35
|
+
export class JoinIdentity extends Schema.TaggedClass<JoinIdentity>()(`${CLIENT_ACTION}/join-identity`, {
|
|
36
|
+
input: Schema.Struct({
|
|
37
|
+
invitationCode: Schema.optional(Schema.String),
|
|
37
38
|
}),
|
|
38
|
-
output:
|
|
39
|
+
output: Schema.Void,
|
|
39
40
|
}) {}
|
|
40
41
|
|
|
41
|
-
export class ShareIdentity extends
|
|
42
|
-
input:
|
|
43
|
-
output:
|
|
42
|
+
export class ShareIdentity extends Schema.TaggedClass<ShareIdentity>()(`${CLIENT_ACTION}/share-identity`, {
|
|
43
|
+
input: Schema.Void,
|
|
44
|
+
output: Schema.Void,
|
|
44
45
|
}) {}
|
|
45
46
|
|
|
46
|
-
export class RecoverIdentity extends
|
|
47
|
-
input:
|
|
48
|
-
output:
|
|
47
|
+
export class RecoverIdentity extends Schema.TaggedClass<RecoverIdentity>()(`${CLIENT_ACTION}/recover-identity`, {
|
|
48
|
+
input: Schema.Void,
|
|
49
|
+
output: Schema.Void,
|
|
49
50
|
}) {}
|
|
50
51
|
|
|
51
|
-
export class ResetStorage extends
|
|
52
|
-
input:
|
|
53
|
-
mode:
|
|
52
|
+
export class ResetStorage extends Schema.TaggedClass<ResetStorage>()(`${CLIENT_ACTION}/reset-storage`, {
|
|
53
|
+
input: Schema.Struct({
|
|
54
|
+
mode: Schema.optional(Schema.String),
|
|
54
55
|
}),
|
|
55
|
-
output:
|
|
56
|
-
}) {}
|
|
57
|
-
|
|
58
|
-
export class CreateAgent extends S.TaggedClass<CreateAgent>()(`${CLIENT_ACTION}/create-agent`, {
|
|
59
|
-
input: S.Void,
|
|
60
|
-
output: S.Void,
|
|
56
|
+
output: Schema.Void,
|
|
61
57
|
}) {}
|
|
62
58
|
|
|
63
|
-
export class
|
|
64
|
-
input:
|
|
65
|
-
output:
|
|
59
|
+
export class CreateAgent extends Schema.TaggedClass<CreateAgent>()(`${CLIENT_ACTION}/create-agent`, {
|
|
60
|
+
input: Schema.Void,
|
|
61
|
+
output: Schema.Void,
|
|
66
62
|
}) {}
|
|
67
63
|
|
|
68
|
-
export class
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
export class CreateRecoveryCode extends Schema.TaggedClass<CreateRecoveryCode>()(
|
|
65
|
+
`${CLIENT_ACTION}/create-recovery-code`,
|
|
66
|
+
{
|
|
67
|
+
input: Schema.Void,
|
|
68
|
+
output: Schema.Void,
|
|
69
|
+
},
|
|
70
|
+
) {}
|
|
71
|
+
|
|
72
|
+
export class CreatePasskey extends Schema.TaggedClass<CreatePasskey>()(`${CLIENT_ACTION}/create-passkey`, {
|
|
73
|
+
input: Schema.Void,
|
|
74
|
+
output: Schema.Void,
|
|
71
75
|
}) {}
|
|
72
76
|
|
|
73
|
-
export class RedeemPasskey extends
|
|
74
|
-
input:
|
|
75
|
-
output:
|
|
77
|
+
export class RedeemPasskey extends Schema.TaggedClass<RedeemPasskey>()(`${CLIENT_ACTION}/redeem-passkey`, {
|
|
78
|
+
input: Schema.Void,
|
|
79
|
+
output: Schema.Void,
|
|
76
80
|
}) {}
|
|
77
81
|
|
|
78
|
-
export class RedeemToken extends
|
|
79
|
-
input:
|
|
80
|
-
token:
|
|
82
|
+
export class RedeemToken extends Schema.TaggedClass<RedeemToken>()(`${CLIENT_ACTION}/redeem-token`, {
|
|
83
|
+
input: Schema.Struct({
|
|
84
|
+
token: Schema.String,
|
|
81
85
|
}),
|
|
82
|
-
output:
|
|
86
|
+
output: Schema.Void,
|
|
83
87
|
}) {}
|
|
84
88
|
}
|
|
85
89
|
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CLIENT_PLUGIN
|
|
3
|
-
} from "./chunk-MCEXD5XH.mjs";
|
|
4
|
-
|
|
5
|
-
// packages/plugins/plugin-client/src/types.ts
|
|
6
|
-
import { S } from "@dxos/echo-schema";
|
|
7
|
-
import { PublicKey } from "@dxos/react-client";
|
|
8
|
-
var IdentitySchema = S.Struct({
|
|
9
|
-
identityKey: S.instanceOf(PublicKey),
|
|
10
|
-
spaceKey: S.optional(S.instanceOf(PublicKey)),
|
|
11
|
-
profile: S.optional(S.Struct({
|
|
12
|
-
displayName: S.optional(S.String),
|
|
13
|
-
avatarCid: S.optional(S.String),
|
|
14
|
-
data: S.optional(S.Record({
|
|
15
|
-
key: S.String,
|
|
16
|
-
value: S.Any
|
|
17
|
-
}))
|
|
18
|
-
}))
|
|
19
|
-
});
|
|
20
|
-
var CLIENT_ACTION = `${CLIENT_PLUGIN}/action`;
|
|
21
|
-
var ClientAction;
|
|
22
|
-
(function(ClientAction2) {
|
|
23
|
-
class CreateIdentity extends S.TaggedClass()(`${CLIENT_ACTION}/create-identity`, {
|
|
24
|
-
input: S.Struct({
|
|
25
|
-
displayName: S.optional(S.String)
|
|
26
|
-
}),
|
|
27
|
-
output: IdentitySchema
|
|
28
|
-
}) {
|
|
29
|
-
}
|
|
30
|
-
ClientAction2.CreateIdentity = CreateIdentity;
|
|
31
|
-
class JoinIdentity extends S.TaggedClass()(`${CLIENT_ACTION}/join-identity`, {
|
|
32
|
-
input: S.Struct({
|
|
33
|
-
invitationCode: S.optional(S.String)
|
|
34
|
-
}),
|
|
35
|
-
output: S.Void
|
|
36
|
-
}) {
|
|
37
|
-
}
|
|
38
|
-
ClientAction2.JoinIdentity = JoinIdentity;
|
|
39
|
-
class ShareIdentity extends S.TaggedClass()(`${CLIENT_ACTION}/share-identity`, {
|
|
40
|
-
input: S.Void,
|
|
41
|
-
output: S.Void
|
|
42
|
-
}) {
|
|
43
|
-
}
|
|
44
|
-
ClientAction2.ShareIdentity = ShareIdentity;
|
|
45
|
-
class RecoverIdentity extends S.TaggedClass()(`${CLIENT_ACTION}/recover-identity`, {
|
|
46
|
-
input: S.Void,
|
|
47
|
-
output: S.Void
|
|
48
|
-
}) {
|
|
49
|
-
}
|
|
50
|
-
ClientAction2.RecoverIdentity = RecoverIdentity;
|
|
51
|
-
class ResetStorage extends S.TaggedClass()(`${CLIENT_ACTION}/reset-storage`, {
|
|
52
|
-
input: S.Struct({
|
|
53
|
-
mode: S.optional(S.String)
|
|
54
|
-
}),
|
|
55
|
-
output: S.Void
|
|
56
|
-
}) {
|
|
57
|
-
}
|
|
58
|
-
ClientAction2.ResetStorage = ResetStorage;
|
|
59
|
-
class CreateAgent extends S.TaggedClass()(`${CLIENT_ACTION}/create-agent`, {
|
|
60
|
-
input: S.Void,
|
|
61
|
-
output: S.Void
|
|
62
|
-
}) {
|
|
63
|
-
}
|
|
64
|
-
ClientAction2.CreateAgent = CreateAgent;
|
|
65
|
-
class CreateRecoveryCode extends S.TaggedClass()(`${CLIENT_ACTION}/create-recovery-code`, {
|
|
66
|
-
input: S.Void,
|
|
67
|
-
output: S.Void
|
|
68
|
-
}) {
|
|
69
|
-
}
|
|
70
|
-
ClientAction2.CreateRecoveryCode = CreateRecoveryCode;
|
|
71
|
-
class CreatePasskey extends S.TaggedClass()(`${CLIENT_ACTION}/create-passkey`, {
|
|
72
|
-
input: S.Void,
|
|
73
|
-
output: S.Void
|
|
74
|
-
}) {
|
|
75
|
-
}
|
|
76
|
-
ClientAction2.CreatePasskey = CreatePasskey;
|
|
77
|
-
class RedeemPasskey extends S.TaggedClass()(`${CLIENT_ACTION}/redeem-passkey`, {
|
|
78
|
-
input: S.Void,
|
|
79
|
-
output: S.Void
|
|
80
|
-
}) {
|
|
81
|
-
}
|
|
82
|
-
ClientAction2.RedeemPasskey = RedeemPasskey;
|
|
83
|
-
class RedeemToken extends S.TaggedClass()(`${CLIENT_ACTION}/redeem-token`, {
|
|
84
|
-
input: S.Struct({
|
|
85
|
-
token: S.String
|
|
86
|
-
}),
|
|
87
|
-
output: S.Void
|
|
88
|
-
}) {
|
|
89
|
-
}
|
|
90
|
-
ClientAction2.RedeemToken = RedeemToken;
|
|
91
|
-
})(ClientAction || (ClientAction = {}));
|
|
92
|
-
var Account;
|
|
93
|
-
(function(Account2) {
|
|
94
|
-
const _id = "dxos.org.plugin.client.account";
|
|
95
|
-
Account2.id = `!${_id}`;
|
|
96
|
-
Account2.Profile = `${_id}.profile`;
|
|
97
|
-
Account2.Devices = `${_id}.devices`;
|
|
98
|
-
Account2.Security = `${_id}.security`;
|
|
99
|
-
})(Account || (Account = {}));
|
|
100
|
-
|
|
101
|
-
export {
|
|
102
|
-
ClientAction,
|
|
103
|
-
Account
|
|
104
|
-
};
|
|
105
|
-
//# sourceMappingURL=chunk-AN7FJKIJ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type PluginsContext } from '@dxos/app-framework';\nimport { S } from '@dxos/echo-schema';\nimport { type Client, PublicKey, type ClientOptions } from '@dxos/react-client';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { CLIENT_PLUGIN } from './meta';\n\n// TODO(wittjosiah): Factor out. Generate?\nconst IdentitySchema = S.Struct({\n identityKey: S.instanceOf(PublicKey),\n spaceKey: S.optional(S.instanceOf(PublicKey)),\n profile: S.optional(\n S.Struct({\n displayName: S.optional(S.String),\n avatarCid: S.optional(S.String),\n data: S.optional(S.Record({ key: S.String, value: S.Any })),\n }),\n ),\n});\n\nconst CLIENT_ACTION = `${CLIENT_PLUGIN}/action`;\nexport namespace ClientAction {\n export class CreateIdentity extends S.TaggedClass<CreateIdentity>()(`${CLIENT_ACTION}/create-identity`, {\n input: S.Struct({\n displayName: S.optional(S.String),\n }),\n output: IdentitySchema,\n }) {}\n\n export class JoinIdentity extends S.TaggedClass<JoinIdentity>()(`${CLIENT_ACTION}/join-identity`, {\n input: S.Struct({\n invitationCode: S.optional(S.String),\n }),\n output: S.Void,\n }) {}\n\n export class ShareIdentity extends S.TaggedClass<ShareIdentity>()(`${CLIENT_ACTION}/share-identity`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class RecoverIdentity extends S.TaggedClass<RecoverIdentity>()(`${CLIENT_ACTION}/recover-identity`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class ResetStorage extends S.TaggedClass<ResetStorage>()(`${CLIENT_ACTION}/reset-storage`, {\n input: S.Struct({\n mode: S.optional(S.String),\n }),\n output: S.Void,\n }) {}\n\n export class CreateAgent extends S.TaggedClass<CreateAgent>()(`${CLIENT_ACTION}/create-agent`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class CreateRecoveryCode extends S.TaggedClass<CreateRecoveryCode>()(`${CLIENT_ACTION}/create-recovery-code`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class CreatePasskey extends S.TaggedClass<CreatePasskey>()(`${CLIENT_ACTION}/create-passkey`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class RedeemPasskey extends S.TaggedClass<RedeemPasskey>()(`${CLIENT_ACTION}/redeem-passkey`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class RedeemToken extends S.TaggedClass<RedeemToken>()(`${CLIENT_ACTION}/redeem-token`, {\n input: S.Struct({\n token: S.String,\n }),\n output: S.Void,\n }) {}\n}\n\nexport type ClientPluginOptions = ClientOptions & {\n /**\n * Base URL for the invitation link.\n */\n invitationUrl?: string;\n\n /**\n * Query parameter for the invitation code.\n */\n invitationParam?: string;\n\n /**\n * Run after the client has been initialized.\n */\n onClientInitialized?: (context: PluginsContext, client: Client) => MaybePromise<void>;\n\n /**\n * Called when the client is reset.\n */\n onReset?: (params: { target?: string }) => MaybePromise<void>;\n};\n\nexport namespace Account {\n // TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.\n const _id = 'dxos.org.plugin.client.account';\n // TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.\n // Ideally this should be worked into the data model in a generic way.\n export const id = `!${_id}`;\n\n export const Profile = `${_id}.profile`;\n export const Devices = `${_id}.devices`;\n export const Security = `${_id}.security`;\n}\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AAC7B,GAViBD,YAAAA,UAAAA,CAAAA,EAAAA;",
|
|
6
|
-
"names": ["S", "PublicKey", "IdentitySchema", "S", "Struct", "identityKey", "instanceOf", "PublicKey", "spaceKey", "optional", "profile", "displayName", "String", "avatarCid", "data", "Record", "key", "value", "Any", "CLIENT_ACTION", "CLIENT_PLUGIN", "ClientAction", "CreateIdentity", "TaggedClass", "input", "output", "JoinIdentity", "invitationCode", "Void", "ShareIdentity", "RecoverIdentity", "ResetStorage", "mode", "CreateAgent", "CreateRecoveryCode", "CreatePasskey", "RedeemPasskey", "RedeemToken", "token", "Account", "_id", "id", "Profile", "Devices", "Security"]
|
|
7
|
-
}
|