@casual-simulation/aux-common 3.3.12 → 3.3.14
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/bots/BotEvents.d.ts +36 -1
- package/bots/BotEvents.js +16 -0
- package/bots/BotEvents.js.map +1 -1
- package/common/DenialReason.d.ts +4 -1
- package/documents/RemoteYjsSharedDocument.d.ts +52 -0
- package/documents/RemoteYjsSharedDocument.js +304 -0
- package/documents/RemoteYjsSharedDocument.js.map +1 -0
- package/documents/SharedDocument.d.ts +449 -0
- package/documents/SharedDocument.js +2 -0
- package/documents/SharedDocument.js.map +1 -0
- package/documents/SharedDocumentConfig.d.ts +65 -0
- package/documents/SharedDocumentConfig.js +2 -0
- package/documents/SharedDocumentConfig.js.map +1 -0
- package/documents/SharedDocumentFactories.d.ts +20 -0
- package/documents/SharedDocumentFactories.js +29 -0
- package/documents/SharedDocumentFactories.js.map +1 -0
- package/documents/YjsSharedDocument.d.ts +152 -0
- package/documents/YjsSharedDocument.js +628 -0
- package/documents/YjsSharedDocument.js.map +1 -0
- package/documents/index.d.ts +6 -0
- package/documents/index.js +6 -0
- package/documents/index.js.map +1 -0
- package/documents/test/DocumentTests.d.ts +6 -0
- package/documents/test/DocumentTests.js +497 -0
- package/documents/test/DocumentTests.js.map +1 -0
- package/package.json +2 -2
- package/partitions/AuxPartitionConfig.d.ts +5 -4
- package/partitions/PartitionAuthSource.d.ts +4 -0
- package/partitions/RemoteYjsPartition.d.ts +8 -50
- package/partitions/RemoteYjsPartition.js +65 -364
- package/partitions/RemoteYjsPartition.js.map +1 -1
- package/partitions/YjsPartition.d.ts +4 -28
- package/partitions/YjsPartition.js +7 -93
- package/partitions/YjsPartition.js.map +1 -1
- package/websockets/InstRecordsClient.js +1 -1
- package/websockets/InstRecordsClient.js.map +1 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { BehaviorSubject, Observable, Subject, Subscription } from 'rxjs';
|
|
2
|
+
import { AbstractType as YType, Map as YMap, Array as YArray, Text as YText, RelativePosition, Doc } from 'yjs';
|
|
3
|
+
import { SharedTypeChanges, SharedMap, SharedArray, SharedText, SharedArrayDelta, SharedTextDelta, SharedDocument, SharedType, SharedMapChanges, SharedArrayChanges, SharedTextChanges } from './SharedDocument';
|
|
4
|
+
import { InstUpdate } from '../bots';
|
|
5
|
+
import { CurrentVersion, Action, StatusUpdate } from '../common';
|
|
6
|
+
import { ClientError, InstRecordsClient } from '../websockets';
|
|
7
|
+
import { YjsIndexedDBPersistence } from '../yjs/YjsIndexedDBPersistence';
|
|
8
|
+
import { SharedDocumentConfig } from './SharedDocumentConfig';
|
|
9
|
+
export declare const APPLY_UPDATES_TO_INST_TRANSACTION_ORIGIN = "__apply_updates_to_inst";
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new YJS shared document.
|
|
12
|
+
* @param config The config for the document.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createYjsSharedDocument(config: SharedDocumentConfig): YjsSharedDocument;
|
|
15
|
+
/**
|
|
16
|
+
* Defines a shared document that is backed by a YJS document.
|
|
17
|
+
*/
|
|
18
|
+
export declare class YjsSharedDocument implements SharedDocument {
|
|
19
|
+
protected _onVersionUpdated: BehaviorSubject<CurrentVersion>;
|
|
20
|
+
protected _onUpdates: Subject<string[]>;
|
|
21
|
+
protected _onError: Subject<any>;
|
|
22
|
+
protected _onEvents: Subject<Action[]>;
|
|
23
|
+
protected _onStatusUpdated: Subject<StatusUpdate>;
|
|
24
|
+
protected _onClientError: Subject<ClientError>;
|
|
25
|
+
protected _sub: Subscription;
|
|
26
|
+
protected _localId: number;
|
|
27
|
+
protected _remoteId: number;
|
|
28
|
+
protected _doc: Doc;
|
|
29
|
+
protected _client: InstRecordsClient;
|
|
30
|
+
protected _currentVersion: CurrentVersion;
|
|
31
|
+
protected _isLocalTransaction: boolean;
|
|
32
|
+
protected _isRemoteUpdate: boolean;
|
|
33
|
+
protected _recordName: string | null;
|
|
34
|
+
protected _inst: string;
|
|
35
|
+
protected _branch: string;
|
|
36
|
+
protected _indexeddb: YjsIndexedDBPersistence;
|
|
37
|
+
protected _persistence: SharedDocumentConfig['localPersistence'];
|
|
38
|
+
private _maps;
|
|
39
|
+
private _arrays;
|
|
40
|
+
private _texts;
|
|
41
|
+
get recordName(): string;
|
|
42
|
+
get address(): string;
|
|
43
|
+
get branch(): string;
|
|
44
|
+
get clientId(): number;
|
|
45
|
+
get closed(): boolean;
|
|
46
|
+
get onVersionUpdated(): Observable<CurrentVersion>;
|
|
47
|
+
get onError(): Observable<any>;
|
|
48
|
+
get onEvents(): Observable<Action[]>;
|
|
49
|
+
get onClientError(): Observable<ClientError>;
|
|
50
|
+
get onStatusUpdated(): Observable<StatusUpdate>;
|
|
51
|
+
get site(): string;
|
|
52
|
+
get onUpdates(): Observable<string[]>;
|
|
53
|
+
get doc(): Doc;
|
|
54
|
+
protected get _remoteSite(): string;
|
|
55
|
+
protected get _currentSite(): string;
|
|
56
|
+
unsubscribe(): void;
|
|
57
|
+
constructor(config: SharedDocumentConfig);
|
|
58
|
+
getMap<T = any>(name: string): SharedMap<T>;
|
|
59
|
+
getArray<T = any>(name: string): SharedArray<T>;
|
|
60
|
+
getText(name: string): SharedText;
|
|
61
|
+
createMap<T = any>(): SharedMap<T>;
|
|
62
|
+
createArray<T = any>(): SharedArray<T>;
|
|
63
|
+
init(): Promise<void>;
|
|
64
|
+
connect(): void;
|
|
65
|
+
transact(callback: () => void): void;
|
|
66
|
+
getStateUpdate(): InstUpdate;
|
|
67
|
+
applyStateUpdates(updates: InstUpdate[]): void;
|
|
68
|
+
/**
|
|
69
|
+
* Applies the given updates to the YJS document.
|
|
70
|
+
* @param updates The updates to apply.
|
|
71
|
+
* @param transactionOrigin The origin of the transaction.
|
|
72
|
+
*/
|
|
73
|
+
protected _applyUpdates(updates: string[], transactionOrigin?: string): void;
|
|
74
|
+
}
|
|
75
|
+
export declare class YjsSharedType<TType extends YType<any>, TChanges extends SharedTypeChanges> {
|
|
76
|
+
private _type;
|
|
77
|
+
private _changes;
|
|
78
|
+
private _deepChanges;
|
|
79
|
+
get type(): TType;
|
|
80
|
+
get doc(): SharedDocument;
|
|
81
|
+
get parent(): SharedType;
|
|
82
|
+
get changes(): Observable<TChanges>;
|
|
83
|
+
get deepChanges(): Observable<SharedTypeChanges[]>;
|
|
84
|
+
constructor(type: TType);
|
|
85
|
+
}
|
|
86
|
+
export declare class YjsSharedMap<T> extends YjsSharedType<YMap<T>, SharedMapChanges<T>> implements SharedMap<T> {
|
|
87
|
+
constructor(map: YMap<T>);
|
|
88
|
+
constructor(map: Map<string, T>);
|
|
89
|
+
get size(): number;
|
|
90
|
+
set(key: string, value: T): void;
|
|
91
|
+
get(key: string): T;
|
|
92
|
+
delete(key: string): void;
|
|
93
|
+
has(key: string): boolean;
|
|
94
|
+
clear(): void;
|
|
95
|
+
clone(): SharedMap<T>;
|
|
96
|
+
toJSON(): {
|
|
97
|
+
[key: string]: T;
|
|
98
|
+
};
|
|
99
|
+
forEach(callback: (value: T, key: string, map: SharedMap<T>) => void): void;
|
|
100
|
+
entries(): IterableIterator<[string, T]>;
|
|
101
|
+
keys(): IterableIterator<string>;
|
|
102
|
+
values(): IterableIterator<T>;
|
|
103
|
+
[Symbol.iterator](): IterableIterator<[string, T]>;
|
|
104
|
+
}
|
|
105
|
+
export declare class YjsSharedArray<T> extends YjsSharedType<YArray<T>, SharedArrayChanges<T>> implements SharedArray<T> {
|
|
106
|
+
get length(): number;
|
|
107
|
+
get size(): number;
|
|
108
|
+
constructor(arr: YArray<T>);
|
|
109
|
+
constructor(arr: Array<T>);
|
|
110
|
+
insert(index: number, items: T[]): void;
|
|
111
|
+
delete(index: number, count: number): void;
|
|
112
|
+
applyDelta(delta: SharedArrayDelta<T>): void;
|
|
113
|
+
push(...items: T[]): void;
|
|
114
|
+
pop(): T | undefined;
|
|
115
|
+
unshift(...items: T[]): void;
|
|
116
|
+
shift(): T | undefined;
|
|
117
|
+
get(index: number): T;
|
|
118
|
+
slice(start?: number, end?: number): T[];
|
|
119
|
+
splice(start: number, deleteCount?: number, ...items: T[]): T[];
|
|
120
|
+
toArray(): T[];
|
|
121
|
+
toJSON(): T[];
|
|
122
|
+
forEach(callback: (value: T, index: number, array: SharedArray<T>) => void): void;
|
|
123
|
+
map(callback: (value: T, index: number, array: SharedArray<T>) => T): T[];
|
|
124
|
+
filter(predicate: (value: T, index: number, array: SharedArray<T>) => boolean): T[];
|
|
125
|
+
clone(): SharedArray<T>;
|
|
126
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
127
|
+
private _mapItems;
|
|
128
|
+
}
|
|
129
|
+
export declare class YjsSharedText implements SharedText {
|
|
130
|
+
private _text;
|
|
131
|
+
private _changes;
|
|
132
|
+
private _deepChanges;
|
|
133
|
+
get doc(): SharedDocument;
|
|
134
|
+
get parent(): SharedType;
|
|
135
|
+
get length(): number;
|
|
136
|
+
get size(): number;
|
|
137
|
+
get changes(): Observable<SharedTextChanges>;
|
|
138
|
+
get deepChanges(): Observable<SharedTextChanges[]>;
|
|
139
|
+
constructor(text: YText);
|
|
140
|
+
constructor(text: string);
|
|
141
|
+
insert(index: number, text: string, attribtues?: Record<string, any>): void;
|
|
142
|
+
delete(index: number, count: number): void;
|
|
143
|
+
applyDelta(delta: SharedTextDelta): void;
|
|
144
|
+
toDelta(): SharedTextDelta;
|
|
145
|
+
encodeRelativePosition(index: number, assoc?: number): RelativePosition;
|
|
146
|
+
decodeRelativePosition(position: RelativePosition): number;
|
|
147
|
+
slice(start?: number, end?: number): string;
|
|
148
|
+
toString(): string;
|
|
149
|
+
toJSON(): string;
|
|
150
|
+
clone(): SharedText;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=YjsSharedDocument.d.ts.map
|