@dxos/client-protocol 0.8.4-main.72ec0f3 → 0.8.4-main.765dc60934
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/LICENSE +102 -5
- package/dist/lib/browser/chunk-GCBXMPTW.mjs +51 -0
- package/dist/lib/browser/chunk-GCBXMPTW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +45 -28
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types/index.mjs +9 -5
- package/dist/lib/node-esm/chunk-2RN4CLEW.mjs +53 -0
- package/dist/lib/node-esm/chunk-2RN4CLEW.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +45 -28
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types/index.mjs +9 -5
- package/dist/types/src/config.d.ts +24 -8
- package/dist/types/src/config.d.ts.map +1 -1
- package/dist/types/src/echo.d.ts +8 -16
- package/dist/types/src/echo.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/invitations/encoder.d.ts.map +1 -1
- package/dist/types/src/invitations/invitations.d.ts +2 -2
- package/dist/types/src/invitations/invitations.d.ts.map +1 -1
- package/dist/types/src/{service-definitions.d.ts → service.d.ts} +18 -7
- package/dist/types/src/service.d.ts.map +1 -0
- package/dist/types/src/space.d.ts +40 -17
- package/dist/types/src/space.d.ts.map +1 -1
- package/dist/types/src/types/SpaceProperties.d.ts +67 -0
- package/dist/types/src/types/SpaceProperties.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -25
- package/src/config.ts +33 -14
- package/src/echo.ts +8 -20
- package/src/index.ts +2 -2
- package/src/{service-definitions.ts → service.ts} +24 -7
- package/src/space.ts +61 -27
- package/src/types/SpaceProperties.ts +76 -0
- package/src/types/index.ts +1 -1
- package/dist/lib/browser/chunk-HIQWFHOK.mjs +0 -25
- package/dist/lib/browser/chunk-HIQWFHOK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TN3JZMTK.mjs +0 -27
- package/dist/lib/node-esm/chunk-TN3JZMTK.mjs.map +0 -7
- package/dist/types/src/service-definitions.d.ts.map +0 -1
- package/dist/types/src/types/Properties.d.ts +0 -22
- package/dist/types/src/types/Properties.d.ts.map +0 -1
- package/src/types/Properties.ts +0 -29
|
@@ -1,23 +1,35 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
import { type MulticastObservable } from '@dxos/async';
|
|
2
3
|
import { type SpecificCredential } from '@dxos/credentials';
|
|
3
|
-
import { type
|
|
4
|
+
import { type Database, type Obj } from '@dxos/echo';
|
|
5
|
+
import { type EchoDatabase, type QueueFactory, type SpaceSyncState } from '@dxos/echo-db';
|
|
4
6
|
import { type PublicKey, type SpaceId } from '@dxos/keys';
|
|
5
|
-
import { type
|
|
7
|
+
import { type Messenger } from '@dxos/protocols';
|
|
8
|
+
import { type Contact, type CreateEpochRequest, type Invitation, SpaceArchive, type Space as SpaceData, type SpaceMember, type SpaceState, type UpdateMemberRoleRequest } from '@dxos/protocols/proto/dxos/client/services';
|
|
6
9
|
import { type EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
7
10
|
import { type SpaceSnapshot } from '@dxos/protocols/proto/dxos/echo/snapshot';
|
|
8
|
-
import { type Credential, type Epoch } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
9
|
-
import { type GossipMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/gossip';
|
|
11
|
+
import { type Credential, type Epoch, type MembershipPolicy } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
10
12
|
import { type CancellableInvitation } from './invitations';
|
|
13
|
+
import { type SpaceProperties } from './types';
|
|
11
14
|
export type CreateEpochOptions = {
|
|
12
15
|
migration?: CreateEpochRequest.Migration;
|
|
13
16
|
automergeRootUrl?: string;
|
|
14
17
|
};
|
|
18
|
+
export type ExportSpaceOptions = {
|
|
19
|
+
/**
|
|
20
|
+
* Archive format.
|
|
21
|
+
* @default SpaceArchive.Format.BINARY
|
|
22
|
+
*/
|
|
23
|
+
format?: SpaceArchive.Format;
|
|
24
|
+
};
|
|
15
25
|
export interface SpaceInternal {
|
|
26
|
+
get db(): EchoDatabase;
|
|
16
27
|
get data(): SpaceData;
|
|
17
|
-
createEpoch(options?: CreateEpochOptions): Promise<void>;
|
|
18
28
|
getCredentials(): Promise<Credential[]>;
|
|
19
29
|
getEpochs(): Promise<SpecificCredential<Epoch>[]>;
|
|
30
|
+
createEpoch(options?: CreateEpochOptions): Promise<void>;
|
|
20
31
|
removeMember(memberKey: PublicKey): Promise<void>;
|
|
32
|
+
export(options?: ExportSpaceOptions): Promise<SpaceArchive>;
|
|
21
33
|
/**
|
|
22
34
|
* Migrate space data to the latest version.
|
|
23
35
|
*/
|
|
@@ -31,36 +43,47 @@ export interface SpaceInternal {
|
|
|
31
43
|
onProgress: (state: SpaceSyncState.PeerState | undefined) => void;
|
|
32
44
|
timeout?: number;
|
|
33
45
|
}): Promise<void>;
|
|
34
|
-
export(): Promise<SpaceArchive>;
|
|
35
46
|
}
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*/
|
|
40
|
-
get id(): SpaceId;
|
|
47
|
+
export declare const SPACE_TAG: unique symbol;
|
|
48
|
+
export interface Space extends Messenger {
|
|
49
|
+
readonly [SPACE_TAG]: true;
|
|
41
50
|
/**
|
|
42
51
|
* @deprecated Use `id`.
|
|
43
52
|
*/
|
|
44
53
|
get key(): PublicKey;
|
|
54
|
+
/**
|
|
55
|
+
* Unique space identifier.
|
|
56
|
+
*/
|
|
57
|
+
get id(): SpaceId;
|
|
45
58
|
/**
|
|
46
59
|
* Echo database.
|
|
47
60
|
*/
|
|
48
|
-
get db():
|
|
61
|
+
get db(): Database.Database;
|
|
49
62
|
/**
|
|
50
63
|
* Access to queues.
|
|
51
64
|
*/
|
|
52
65
|
get queues(): QueueFactory;
|
|
53
66
|
get isOpen(): boolean;
|
|
54
67
|
/**
|
|
55
|
-
*
|
|
68
|
+
* Immutable tags assigned at space creation time.
|
|
69
|
+
* Available on closed spaces.
|
|
56
70
|
*/
|
|
57
|
-
get
|
|
71
|
+
get tags(): string[];
|
|
72
|
+
/**
|
|
73
|
+
* Immutable membership policy assigned at space creation time.
|
|
74
|
+
* Available on closed spaces.
|
|
75
|
+
*/
|
|
76
|
+
get membershipPolicy(): MembershipPolicy;
|
|
58
77
|
/**
|
|
59
78
|
* Current state of the space.
|
|
60
79
|
* The database is ready to be used in `SpaceState.SPACE_READY` state.
|
|
61
80
|
* Presence is available in `SpaceState.SPACE_CONTROL_ONLY` state.
|
|
62
81
|
*/
|
|
63
82
|
get state(): MulticastObservable<SpaceState>;
|
|
83
|
+
/**
|
|
84
|
+
* Properties object.
|
|
85
|
+
*/
|
|
86
|
+
get properties(): Obj.OfShape<SpaceProperties>;
|
|
64
87
|
/**
|
|
65
88
|
* Current state of space pipeline.
|
|
66
89
|
*/
|
|
@@ -90,7 +113,7 @@ export interface Space {
|
|
|
90
113
|
share(options?: Partial<Invitation>): CancellableInvitation;
|
|
91
114
|
admitContact(contact: Contact): Promise<void>;
|
|
92
115
|
updateMemberRole(request: Omit<UpdateMemberRoleRequest, 'spaceKey'>): Promise<void>;
|
|
93
|
-
postMessage: (channel: string, message: any) => Promise<void>;
|
|
94
|
-
listen: (channel: string, callback: (message: GossipMessage) => void) => CleanupFn;
|
|
95
116
|
}
|
|
117
|
+
export declare const isSpace: (object: unknown) => object is Space;
|
|
118
|
+
export declare const SpaceSchema: Schema.Schema<Space>;
|
|
96
119
|
//# sourceMappingURL=space.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space.d.ts","sourceRoot":"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G5C,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
import { Ref, Type } from '@dxos/echo';
|
|
3
|
+
/**
|
|
4
|
+
* Where do triggers get executed.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ComputeEnvironment: Schema.Literal<["disabled", "local", "edge"]>;
|
|
7
|
+
export type ComputeEnvironment = Schema.Schema.Type<typeof ComputeEnvironment>;
|
|
8
|
+
export declare const SpacePropertiesSchema: Schema.TypeLiteral<{
|
|
9
|
+
archived: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
10
|
+
edgeReplication: Schema.optional<typeof Schema.Boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated
|
|
13
|
+
*/
|
|
14
|
+
invocationTraceFeed: Schema.optional<Ref.RefSchema<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
15
|
+
readonly name?: string | undefined;
|
|
16
|
+
readonly kind?: string | undefined;
|
|
17
|
+
readonly namespace?: "data" | "trace" | undefined;
|
|
18
|
+
}>>;
|
|
19
|
+
/**
|
|
20
|
+
* Preference for trigger execution.
|
|
21
|
+
* *disabled* - triggers do not run locally or on EDGE.
|
|
22
|
+
* *local* - triggers are executed locally on the client, edge is not running triggers.
|
|
23
|
+
* *edge* - triggers are executed on the edge, triggers are not run locally.
|
|
24
|
+
*/
|
|
25
|
+
computeEnvironment: Schema.optional<Schema.Literal<["disabled", "local", "edge"]>>;
|
|
26
|
+
name: Schema.optional<typeof Schema.String>;
|
|
27
|
+
icon: Schema.optional<typeof Schema.String>;
|
|
28
|
+
hue: Schema.optional<typeof Schema.String>;
|
|
29
|
+
}, readonly [{
|
|
30
|
+
readonly key: typeof Schema.String;
|
|
31
|
+
readonly value: typeof Schema.Any;
|
|
32
|
+
}]>;
|
|
33
|
+
export type SpacePropertiesSchema = Schema.Schema.Type<typeof SpacePropertiesSchema>;
|
|
34
|
+
/** @deprecated Use SpaceProperties instead. */
|
|
35
|
+
export declare const LegacySpaceProperties: Type.Obj<{
|
|
36
|
+
readonly [x: string]: any;
|
|
37
|
+
readonly archived?: boolean | undefined;
|
|
38
|
+
readonly edgeReplication?: boolean | undefined;
|
|
39
|
+
readonly invocationTraceFeed?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
40
|
+
readonly name?: string | undefined;
|
|
41
|
+
readonly kind?: string | undefined;
|
|
42
|
+
readonly namespace?: "data" | "trace" | undefined;
|
|
43
|
+
}> | undefined;
|
|
44
|
+
readonly computeEnvironment?: "disabled" | "edge" | "local" | undefined;
|
|
45
|
+
readonly name?: string | undefined;
|
|
46
|
+
readonly icon?: string | undefined;
|
|
47
|
+
readonly hue?: string | undefined;
|
|
48
|
+
}, Schema.Struct.Fields>;
|
|
49
|
+
export interface LegacySpaceProperties extends Schema.Schema.Type<typeof LegacySpaceProperties> {
|
|
50
|
+
}
|
|
51
|
+
export declare const SpaceProperties: Type.Obj<{
|
|
52
|
+
readonly [x: string]: any;
|
|
53
|
+
readonly archived?: boolean | undefined;
|
|
54
|
+
readonly edgeReplication?: boolean | undefined;
|
|
55
|
+
readonly invocationTraceFeed?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
56
|
+
readonly name?: string | undefined;
|
|
57
|
+
readonly kind?: string | undefined;
|
|
58
|
+
readonly namespace?: "data" | "trace" | undefined;
|
|
59
|
+
}> | undefined;
|
|
60
|
+
readonly computeEnvironment?: "disabled" | "edge" | "local" | undefined;
|
|
61
|
+
readonly name?: string | undefined;
|
|
62
|
+
readonly icon?: string | undefined;
|
|
63
|
+
readonly hue?: string | undefined;
|
|
64
|
+
}, Schema.Struct.Fields>;
|
|
65
|
+
export interface SpaceProperties extends Schema.Schema.Type<typeof SpaceProperties> {
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=SpaceProperties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpaceProperties.d.ts","sourceRoot":"","sources":["../../../../src/types/SpaceProperties.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAoB,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,kBAAkB,+CAA8C,CAAC;AAC9E,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE/E,eAAO,MAAM,qBAAqB;;;IAW9B;;OAEG;;;;;;IAGH;;;;;OAKG;;;;;;;;GAeN,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAErF,+CAA+C;AAC/C,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;wBAMjC,CAAC;AAEF,MAAM,WAAW,qBAAsB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,qBAAqB,CAAC;CAAG;AAIlG,eAAO,MAAM,eAAe;;;;;;;;;;;;;wBAM3B,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC;CAAG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './SpaceProperties';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAIA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAIA,cAAc,mBAAmB,CAAC"}
|