@rocket.chat/ddp-client 0.0.2-rc.0 → 0.0.2-rc.1
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/CHANGELOG.md +7 -0
- package/dist/ClientStream.d.ts +27 -0
- package/dist/ClientStream.d.ts.map +1 -0
- package/dist/ClientStream.js +154 -0
- package/dist/ClientStream.js.map +1 -0
- package/dist/Connection.d.ts +55 -0
- package/dist/Connection.d.ts.map +1 -0
- package/dist/Connection.js +124 -0
- package/dist/Connection.js.map +1 -0
- package/dist/DDPDispatcher.d.ts +23 -0
- package/dist/DDPDispatcher.d.ts.map +1 -0
- package/dist/DDPDispatcher.js +82 -0
- package/dist/DDPDispatcher.js.map +1 -0
- package/dist/DDPSDK.d.ts +54 -0
- package/dist/DDPSDK.d.ts.map +1 -0
- package/dist/DDPSDK.js +126 -0
- package/dist/DDPSDK.js.map +1 -0
- package/dist/MinimalDDPClient.d.ts +80 -0
- package/dist/MinimalDDPClient.d.ts.map +1 -0
- package/dist/MinimalDDPClient.js +170 -0
- package/dist/MinimalDDPClient.js.map +1 -0
- package/dist/TimeoutControl.d.ts +26 -0
- package/dist/TimeoutControl.d.ts.map +1 -0
- package/dist/TimeoutControl.js +55 -0
- package/dist/TimeoutControl.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/legacy/RocketchatSDKLegacy.d.ts +107 -0
- package/dist/legacy/RocketchatSDKLegacy.d.ts.map +1 -0
- package/dist/legacy/RocketchatSDKLegacy.js +219 -0
- package/dist/legacy/RocketchatSDKLegacy.js.map +1 -0
- package/dist/legacy/types/SDKLegacy.d.ts +105 -0
- package/dist/legacy/types/SDKLegacy.d.ts.map +1 -0
- package/dist/legacy/types/SDKLegacy.js +3 -0
- package/dist/legacy/types/SDKLegacy.js.map +1 -0
- package/dist/livechat/LivechatClientImpl.d.ts +117 -0
- package/dist/livechat/LivechatClientImpl.d.ts.map +1 -0
- package/dist/livechat/LivechatClientImpl.js +275 -0
- package/dist/livechat/LivechatClientImpl.js.map +1 -0
- package/dist/livechat/types/LivechatSDK.d.ts +61 -0
- package/dist/livechat/types/LivechatSDK.d.ts.map +1 -0
- package/dist/livechat/types/LivechatSDK.js +3 -0
- package/dist/livechat/types/LivechatSDK.js.map +1 -0
- package/dist/types/Account.d.ts +39 -0
- package/dist/types/Account.d.ts.map +1 -0
- package/dist/types/Account.js +70 -0
- package/dist/types/Account.js.map +1 -0
- package/dist/types/ClientStream.d.ts +113 -0
- package/dist/types/ClientStream.d.ts.map +1 -0
- package/dist/types/ClientStream.js +3 -0
- package/dist/types/ClientStream.js.map +1 -0
- package/dist/types/DDPClient.d.ts +112 -0
- package/dist/types/DDPClient.d.ts.map +1 -0
- package/dist/types/DDPClient.js +3 -0
- package/dist/types/DDPClient.js.map +1 -0
- package/dist/types/IncomingPayload.d.ts +9 -0
- package/dist/types/IncomingPayload.d.ts.map +1 -0
- package/dist/types/IncomingPayload.js +3 -0
- package/dist/types/IncomingPayload.js.map +1 -0
- package/dist/types/OutgoingPayload.d.ts +9 -0
- package/dist/types/OutgoingPayload.d.ts.map +1 -0
- package/dist/types/OutgoingPayload.js +3 -0
- package/dist/types/OutgoingPayload.js.map +1 -0
- package/dist/types/RemoveListener.d.ts +2 -0
- package/dist/types/RemoveListener.d.ts.map +1 -0
- package/dist/types/RemoveListener.js +3 -0
- package/dist/types/RemoveListener.js.map +1 -0
- package/dist/types/SDK.d.ts +14 -0
- package/dist/types/SDK.d.ts.map +1 -0
- package/dist/types/SDK.js +3 -0
- package/dist/types/SDK.js.map +1 -0
- package/dist/types/Subscription.d.ts +12 -0
- package/dist/types/Subscription.d.ts.map +1 -0
- package/dist/types/Subscription.js +3 -0
- package/dist/types/Subscription.js.map +1 -0
- package/dist/types/connectionPayloads.d.ts +29 -0
- package/dist/types/connectionPayloads.d.ts.map +1 -0
- package/dist/types/connectionPayloads.js +3 -0
- package/dist/types/connectionPayloads.js.map +1 -0
- package/dist/types/heartbeatsPayloads.d.ts +23 -0
- package/dist/types/heartbeatsPayloads.d.ts.map +1 -0
- package/dist/types/heartbeatsPayloads.js +3 -0
- package/dist/types/heartbeatsPayloads.js.map +1 -0
- package/dist/types/methods.d.ts +13 -0
- package/dist/types/methods.d.ts.map +1 -0
- package/dist/types/methods.js +3 -0
- package/dist/types/methods.js.map +1 -0
- package/dist/types/methodsPayloads.d.ts +43 -0
- package/dist/types/methodsPayloads.d.ts.map +1 -0
- package/dist/types/methodsPayloads.js +3 -0
- package/dist/types/methodsPayloads.js.map +1 -0
- package/dist/types/publicationPayloads.d.ts +110 -0
- package/dist/types/publicationPayloads.d.ts.map +1 -0
- package/dist/types/publicationPayloads.js +3 -0
- package/dist/types/publicationPayloads.js.map +1 -0
- package/dist/types/streams.d.ts +571 -0
- package/dist/types/streams.d.ts.map +1 -0
- package/dist/types/streams.js +3 -0
- package/dist/types/streams.js.map +1 -0
- package/dist/wrapOnceEventIntoPromise.d.ts +13 -0
- package/dist/wrapOnceEventIntoPromise.d.ts.map +1 -0
- package/dist/wrapOnceEventIntoPromise.js +27 -0
- package/dist/wrapOnceEventIntoPromise.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { IncomingPayload } from './IncomingPayload';
|
|
2
|
+
import type { RemoveListener } from './RemoveListener';
|
|
3
|
+
import type { ConnectedPayload, FailedPayload } from './connectionPayloads';
|
|
4
|
+
import type { MethodPayload, ResultPayload, UpdatedPayload } from './methodsPayloads';
|
|
5
|
+
import type { NosubPayload, PublicationPayloads, ServerPublicationPayloads } from './publicationPayloads';
|
|
6
|
+
export interface DDPDispatchOptions {
|
|
7
|
+
wait?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A low-level DDP client that can be used to communicate with a DDP server.
|
|
11
|
+
*/
|
|
12
|
+
export interface DDPClient {
|
|
13
|
+
/**
|
|
14
|
+
* Invokes a remote method.
|
|
15
|
+
* @param method The name of the method to invoke.
|
|
16
|
+
* @param params The parameters to pass to the method.
|
|
17
|
+
* @param options The options to pass to the method.
|
|
18
|
+
* @returns A string representing the method call.
|
|
19
|
+
*/
|
|
20
|
+
call(method: string, params: any[], options?: DDPDispatchOptions): MethodPayload;
|
|
21
|
+
/**
|
|
22
|
+
* Subscribes to a queue of stream messages.
|
|
23
|
+
* @param name The name of the queue to subscribe to.
|
|
24
|
+
* @param params The parameters that the queue takes.
|
|
25
|
+
* @returns A string representing the subscription id.
|
|
26
|
+
*/
|
|
27
|
+
subscribe(name: string, params: any[]): string;
|
|
28
|
+
/**
|
|
29
|
+
* Subscribes to a queue of stream messages.
|
|
30
|
+
* @param id arbitrary id to use for the subscription
|
|
31
|
+
* @param name The name of the queue to subscribe to.
|
|
32
|
+
* @param params The parameters that the queue takes.
|
|
33
|
+
* @returns A string representing the subscription id.
|
|
34
|
+
*/
|
|
35
|
+
subscribeWithId(id: string, name: string, params: any[]): string;
|
|
36
|
+
/**
|
|
37
|
+
* Unsubscribes from a queue of stream messages.
|
|
38
|
+
* @param id The id of the subscription to unsubscribe from.
|
|
39
|
+
*/
|
|
40
|
+
unsubscribe(id: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Handles a message received from the server.
|
|
43
|
+
*/
|
|
44
|
+
handleMessage(serialized: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Registers a callback to be called every time a message is sent to the server.
|
|
47
|
+
*/
|
|
48
|
+
onDispatchMessage(callback: (msg: string) => void): RemoveListener;
|
|
49
|
+
/**
|
|
50
|
+
* Sends a connect message to the server.
|
|
51
|
+
*/
|
|
52
|
+
connect(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Registers a callback to be called once after the subscription is ready or rejected.
|
|
55
|
+
* @param id The id of the subscription.
|
|
56
|
+
* @param callback The callback to be called.
|
|
57
|
+
* @returns A function to unregister the callback.
|
|
58
|
+
*/
|
|
59
|
+
onPublish(name: string, callback: (payload: ServerPublicationPayloads) => void): RemoveListener;
|
|
60
|
+
/**
|
|
61
|
+
* Registers a callback to be called once after the method is resolved or rejected.
|
|
62
|
+
* @param id The id of the method.
|
|
63
|
+
* @param callback The callback to be called.
|
|
64
|
+
* @returns A function to unregister the callback.
|
|
65
|
+
*/
|
|
66
|
+
onResult(id: string, callback: (payload: ResultPayload) => void): RemoveListener;
|
|
67
|
+
/**
|
|
68
|
+
* Registers a callback to be called every time the subscription is updated.
|
|
69
|
+
* @param id The id of the subscription.
|
|
70
|
+
* @param callback The callback to be called.
|
|
71
|
+
* @returns A function to unregister the callback.
|
|
72
|
+
*/
|
|
73
|
+
onUpdate(id: string, callback: (payload: UpdatedPayload) => void): RemoveListener;
|
|
74
|
+
/**
|
|
75
|
+
* Registers a callback to be called once after the subscription is stopped.
|
|
76
|
+
* @param id The id of the subscription.
|
|
77
|
+
* @param callback The callback to be called.
|
|
78
|
+
* @returns A function to unregister the callback.
|
|
79
|
+
*/
|
|
80
|
+
onNoSub(id: string, callback: (payload: NosubPayload) => void): RemoveListener;
|
|
81
|
+
/**
|
|
82
|
+
* Registers a callback to be called every time a new document is added/updated/removed from the collection.
|
|
83
|
+
* @param name The name of the collection.
|
|
84
|
+
* @param callback The callback to be called.
|
|
85
|
+
* @returns A function to unregister the callback.
|
|
86
|
+
*/
|
|
87
|
+
onCollection(name: string, callback: (payload: PublicationPayloads) => void): RemoveListener;
|
|
88
|
+
/**
|
|
89
|
+
* Registers a callback to be called once after the connection is established or rejected.
|
|
90
|
+
* @param callback The callback to be called.
|
|
91
|
+
* @returns A function to unregister the callback.
|
|
92
|
+
*/
|
|
93
|
+
onConnection(callback: (payload: ConnectedPayload | FailedPayload) => void): RemoveListener;
|
|
94
|
+
/**
|
|
95
|
+
* Registers a callback to be called every time a message is received.
|
|
96
|
+
* @param callback The callback to be called.
|
|
97
|
+
* @returns A function to unregister the callback.
|
|
98
|
+
*/
|
|
99
|
+
onMessage(callback: (payload: IncomingPayload) => void): RemoveListener;
|
|
100
|
+
/**
|
|
101
|
+
* Registers a callback to be called once after a message is received.
|
|
102
|
+
* @param callback The callback to be called.
|
|
103
|
+
* @returns A function to unregister the callback.
|
|
104
|
+
*/
|
|
105
|
+
onceMessage(callback: (payload: IncomingPayload) => void): RemoveListener;
|
|
106
|
+
/**
|
|
107
|
+
* Sends a ping message to the server.
|
|
108
|
+
* @returns nothing
|
|
109
|
+
*/
|
|
110
|
+
ping(id?: string): void;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=DDPClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DDPClient.d.ts","sourceRoot":"","sources":["../../src/types/DDPClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAE1G,MAAM,WAAW,kBAAkB;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,aAAa,CAAC;IAEjF;;;;;OAKG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAE/C;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,E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eAAe,KAAK,IAAI,GAAG,cAAc,CAAC;IAE1E;;;OAGG;IACH,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DDPClient.js","sourceRoot":"","sources":["../../src/types/DDPClient.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConnectedPayload, FailedPayload } from './connectionPayloads';
|
|
2
|
+
import type { PingPayload, PongPayload } from './heartbeatsPayloads';
|
|
3
|
+
import type { ServerMethodPayloads } from './methodsPayloads';
|
|
4
|
+
import type { ServerPublicationPayloads } from './publicationPayloads';
|
|
5
|
+
/**
|
|
6
|
+
* @category incoming
|
|
7
|
+
*/
|
|
8
|
+
export type IncomingPayload = PingPayload | PongPayload | ServerPublicationPayloads | ServerMethodPayloads | ConnectedPayload | FailedPayload;
|
|
9
|
+
//# sourceMappingURL=IncomingPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IncomingPayload.d.ts","sourceRoot":"","sources":["../../src/types/IncomingPayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,eAAe,GACxB,WAAW,GACX,WAAW,GACX,yBAAyB,GACzB,oBAAoB,GACpB,gBAAgB,GAChB,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IncomingPayload.js","sourceRoot":"","sources":["../../src/types/IncomingPayload.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConnectPayload } from './connectionPayloads';
|
|
2
|
+
import type { PingPayload, PongPayload } from './heartbeatsPayloads';
|
|
3
|
+
import type { MethodPayload } from './methodsPayloads';
|
|
4
|
+
import type { ClientPublicationPayloads } from './publicationPayloads';
|
|
5
|
+
/**
|
|
6
|
+
* @category outgoing
|
|
7
|
+
*/
|
|
8
|
+
export type OutgoingPayload = PingPayload | PongPayload | ConnectPayload | ClientPublicationPayloads | MethodPayload;
|
|
9
|
+
//# sourceMappingURL=OutgoingPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutgoingPayload.d.ts","sourceRoot":"","sources":["../../src/types/OutgoingPayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,WAAW,GAAG,cAAc,GAAG,yBAAyB,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutgoingPayload.js","sourceRoot":"","sources":["../../src/types/OutgoingPayload.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoveListener.d.ts","sourceRoot":"","sources":["../../src/types/RemoveListener.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoveListener.js","sourceRoot":"","sources":["../../src/types/RemoveListener.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RestClient } from '@rocket.chat/api-client';
|
|
2
|
+
import type { ClientStream } from './ClientStream';
|
|
3
|
+
import type { Connection } from '../Connection';
|
|
4
|
+
import type { TimeoutControl } from '../TimeoutControl';
|
|
5
|
+
import type { Account } from './Account';
|
|
6
|
+
export interface SDK {
|
|
7
|
+
stream(name: string, params: unknown[], cb: (...data: unknown[]) => void): ReturnType<ClientStream['subscribe']>;
|
|
8
|
+
connection: Connection;
|
|
9
|
+
account: Account;
|
|
10
|
+
client: ClientStream;
|
|
11
|
+
timeoutControl: TimeoutControl;
|
|
12
|
+
rest: RestClient;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=SDK.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SDK.d.ts","sourceRoot":"","sources":["../../src/types/SDK.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBzC,MAAM,WAAW,GAAG;IACnB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC;IAEjH,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;IAErB,cAAc,EAAE,cAAc,CAAC;IAC/B,IAAI,EAAE,UAAU,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SDK.js","sourceRoot":"","sources":["../../src/types/SDK.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ServerPublicationPayloads } from './publicationPayloads';
|
|
2
|
+
export interface Subscription {
|
|
3
|
+
stop: () => void;
|
|
4
|
+
ready: () => Promise<void>;
|
|
5
|
+
isReady: boolean;
|
|
6
|
+
onChange: (cb: (arg: ServerPublicationPayloads) => void) => void;
|
|
7
|
+
id: string;
|
|
8
|
+
params: any[];
|
|
9
|
+
name: string;
|
|
10
|
+
error?: unknown;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Subscription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Subscription.d.ts","sourceRoot":"","sources":["../../src/types/Subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEvE,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,yBAAyB,KAAK,IAAI,KAAK,IAAI,CAAC;IACjE,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Subscription.js","sourceRoot":"","sources":["../../src/types/Subscription.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category outgoing
|
|
3
|
+
*/
|
|
4
|
+
export type ConnectPayload = {
|
|
5
|
+
msg: 'connect';
|
|
6
|
+
/** previous DDP session identifier (if trying to reconnect to an existing DDP session) */
|
|
7
|
+
session?: string;
|
|
8
|
+
/** the proposed protocol version */
|
|
9
|
+
version: string;
|
|
10
|
+
/** protocol versions supported by the client, in order of preference */
|
|
11
|
+
support: string[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @category incoming
|
|
15
|
+
*/
|
|
16
|
+
export type ConnectedPayload = {
|
|
17
|
+
msg: 'connected';
|
|
18
|
+
/** an identifier for the DDP session */
|
|
19
|
+
session: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @category incoming
|
|
23
|
+
*/
|
|
24
|
+
export type FailedPayload = {
|
|
25
|
+
msg: 'failed';
|
|
26
|
+
/** a suggested protocol version to connect with */
|
|
27
|
+
version: string;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=connectionPayloads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionPayloads.d.ts","sourceRoot":"","sources":["../../src/types/connectionPayloads.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,GAAG,EAAE,SAAS,CAAC;IACf,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,GAAG,EAAE,WAAW,CAAC;IACjB,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,GAAG,EAAE,QAAQ,CAAC;IACd,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionPayloads.js","sourceRoot":"","sources":["../../src/types/connectionPayloads.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category incoming | outgoing
|
|
3
|
+
*
|
|
4
|
+
* At any time after the connection is established either side may send a ping message. The other side
|
|
5
|
+
* must respond with a pong message as soon as possible.
|
|
6
|
+
*/
|
|
7
|
+
export type PingPayload = {
|
|
8
|
+
msg: 'ping';
|
|
9
|
+
/** identifier used to correlate with response */
|
|
10
|
+
id?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @category incoming | outgoing
|
|
14
|
+
*
|
|
15
|
+
* The pong message is sent in response to a ping message. If the ping message included an id field,
|
|
16
|
+
* the pong message must include the same id field.
|
|
17
|
+
*/
|
|
18
|
+
export type PongPayload = {
|
|
19
|
+
msg: 'pong';
|
|
20
|
+
/** identifier as received in the ping message */
|
|
21
|
+
id?: string;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=heartbeatsPayloads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heartbeatsPayloads.d.ts","sourceRoot":"","sources":["../../src/types/heartbeatsPayloads.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,EAAE,CAAC,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,EAAE,CAAC,EAAE,MAAM,CAAC;CACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heartbeatsPayloads.js","sourceRoot":"","sources":["../../src/types/heartbeatsPayloads.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ServerMethods {
|
|
2
|
+
resetPassword(token: string, password: string): {
|
|
3
|
+
token: string;
|
|
4
|
+
};
|
|
5
|
+
setUserPassword(password: string): void;
|
|
6
|
+
sendConfirmationEmail(to: string): boolean;
|
|
7
|
+
checkRegistrationSecretURL(hash: string): boolean;
|
|
8
|
+
}
|
|
9
|
+
export type ServerMethodName = keyof ServerMethods;
|
|
10
|
+
export type ServerMethodParameters<MethodName extends ServerMethodName> = Parameters<ServerMethods[MethodName]>;
|
|
11
|
+
export type ServerMethodReturn<MethodName extends ServerMethodName> = Awaited<ReturnType<ServerMethods[MethodName]>>;
|
|
12
|
+
export type ServerMethodFunction<MethodName extends ServerMethodName> = (...args: ServerMethodParameters<MethodName>) => Promise<ServerMethodReturn<MethodName>>;
|
|
13
|
+
//# sourceMappingURL=methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/types/methods.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,aAAa;IAC7B,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3C,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAClD;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,aAAa,CAAC;AAEnD,MAAM,MAAM,sBAAsB,CAAC,UAAU,SAAS,gBAAgB,IAAI,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;AAEhH,MAAM,MAAM,kBAAkB,CAAC,UAAU,SAAS,gBAAgB,IAAI,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAErH,MAAM,MAAM,oBAAoB,CAAC,UAAU,SAAS,gBAAgB,IAAI,CACvE,GAAG,IAAI,EAAE,sBAAsB,CAAC,UAAU,CAAC,KACvC,OAAO,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../../src/types/methods.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category outgoing
|
|
3
|
+
*/
|
|
4
|
+
export type MethodPayload = {
|
|
5
|
+
msg: 'method';
|
|
6
|
+
/** method name */
|
|
7
|
+
method: string;
|
|
8
|
+
/** EJSON parameters to the method */
|
|
9
|
+
params: any[];
|
|
10
|
+
/** an arbitrary client-determined identifier for this method call */
|
|
11
|
+
id: string;
|
|
12
|
+
/** an arbitrary client-determined seed for pseudo-random generators */
|
|
13
|
+
randomSeed?: Record<string, unknown>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* @category incoming
|
|
17
|
+
*/
|
|
18
|
+
export type ResultPayload = {
|
|
19
|
+
msg: 'result';
|
|
20
|
+
/** the id passed to `'method'` */
|
|
21
|
+
id: string;
|
|
22
|
+
/** an error thrown by the method (or method-not-found) */
|
|
23
|
+
error?: unknown;
|
|
24
|
+
/** the EJSON return value of the method, if any */
|
|
25
|
+
result?: any;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* @category incoming
|
|
29
|
+
*/
|
|
30
|
+
export type UpdatedPayload = {
|
|
31
|
+
msg: 'updated';
|
|
32
|
+
/** array of method ids; all of whose writes have been reflected in data messages */
|
|
33
|
+
methods: string[];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @category outgoing
|
|
37
|
+
*/
|
|
38
|
+
export type ClientMethodPayloads = MethodPayload;
|
|
39
|
+
/**
|
|
40
|
+
* @category incoming
|
|
41
|
+
*/
|
|
42
|
+
export type ServerMethodPayloads = ResultPayload | UpdatedPayload;
|
|
43
|
+
//# sourceMappingURL=methodsPayloads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methodsPayloads.d.ts","sourceRoot":"","sources":["../../src/types/methodsPayloads.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,GAAG,EAAE,QAAQ,CAAC;IACd,kBAAkB;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;IACX,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,GAAG,EAAE,QAAQ,CAAC;IACd,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,0DAA0D;IAC1D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mDAAmD;IACnD,MAAM,CAAC,EAAE,GAAG,CAAC;CACb,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,GAAG,EAAE,SAAS,CAAC;IACf,oFAAoF;IACpF,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methodsPayloads.js","sourceRoot":"","sources":["../../src/types/methodsPayloads.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category outgoing
|
|
3
|
+
*/
|
|
4
|
+
export type SubscribePayload = {
|
|
5
|
+
msg: 'sub';
|
|
6
|
+
/** an arbitrary client-determined identifier for this subscription */
|
|
7
|
+
id: string;
|
|
8
|
+
/** the name of the subscription */
|
|
9
|
+
name: string;
|
|
10
|
+
/** parameters to the subscription */
|
|
11
|
+
params?: any[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @category outgoing
|
|
15
|
+
*/
|
|
16
|
+
export type UnsubscribePayload = {
|
|
17
|
+
msg: 'unsub';
|
|
18
|
+
/** the id passed to `'sub'` */
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @category outgoing
|
|
23
|
+
*/
|
|
24
|
+
export type ClientPublicationPayloads = SubscribePayload | UnsubscribePayload;
|
|
25
|
+
/**
|
|
26
|
+
* @category incoming
|
|
27
|
+
*/
|
|
28
|
+
export type NosubPayload = {
|
|
29
|
+
msg: 'nosub';
|
|
30
|
+
/** the id passed to `'sub'` */
|
|
31
|
+
id: string;
|
|
32
|
+
/** an error thrown by the subscription (or sub-not-found) */
|
|
33
|
+
error?: unknown;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @category incoming
|
|
37
|
+
*/
|
|
38
|
+
export type AddedPayload = {
|
|
39
|
+
msg: 'added';
|
|
40
|
+
/** the name of the collection */
|
|
41
|
+
collection: string;
|
|
42
|
+
/** the document ID */
|
|
43
|
+
id: string;
|
|
44
|
+
/** the document fields */
|
|
45
|
+
fields?: Record<string, any>;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* @category incoming
|
|
49
|
+
*/
|
|
50
|
+
export type ChangedPayload = {
|
|
51
|
+
msg: 'changed';
|
|
52
|
+
/** the name of the collection */
|
|
53
|
+
collection: string;
|
|
54
|
+
/** the document ID */
|
|
55
|
+
id: string;
|
|
56
|
+
/** the document fields */
|
|
57
|
+
fields?: Record<string, any>;
|
|
58
|
+
/** the document fields to delete */
|
|
59
|
+
cleared?: string[];
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* @category incoming
|
|
63
|
+
*/
|
|
64
|
+
export type RemovedPayload = {
|
|
65
|
+
msg: 'removed';
|
|
66
|
+
/** the name of the collection */
|
|
67
|
+
collection: string;
|
|
68
|
+
/** the document ID */
|
|
69
|
+
id: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* @category incoming
|
|
73
|
+
*/
|
|
74
|
+
export type ReadyPayload = {
|
|
75
|
+
msg: 'ready';
|
|
76
|
+
/** the ids passed to `'sub'` which have sent their initial batch of data */
|
|
77
|
+
subs: string[];
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* @category incoming
|
|
81
|
+
*/
|
|
82
|
+
export type AddedBeforePayload = {
|
|
83
|
+
msg: 'addedBefore';
|
|
84
|
+
/** the name of the collection */
|
|
85
|
+
collection: string;
|
|
86
|
+
/** the document ID */
|
|
87
|
+
id: string;
|
|
88
|
+
/** the document fields */
|
|
89
|
+
fields?: Record<string, any>;
|
|
90
|
+
/** the document ID to add the document before, or `null` to add at the end */
|
|
91
|
+
before: string | null;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* @category incoming
|
|
95
|
+
*/
|
|
96
|
+
export type MovedBeforePayload = {
|
|
97
|
+
msg: 'movedBefore';
|
|
98
|
+
/** the name of the collection */
|
|
99
|
+
collection: string;
|
|
100
|
+
/** the document ID */
|
|
101
|
+
id: string;
|
|
102
|
+
/** the document ID to move the document before, or `null` to move to the end */
|
|
103
|
+
before: string | null;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* @category incoming
|
|
107
|
+
*/
|
|
108
|
+
export type ServerPublicationPayloads = NosubPayload | AddedPayload | ChangedPayload | RemovedPayload | ReadyPayload | AddedBeforePayload | MovedBeforePayload;
|
|
109
|
+
export type PublicationPayloads = AddedPayload | ChangedPayload | RemovedPayload;
|
|
110
|
+
//# sourceMappingURL=publicationPayloads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publicationPayloads.d.ts","sourceRoot":"","sources":["../../src/types/publicationPayloads.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,G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MAAM,CAAC;IACnB,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;CACX,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IAC1B,GAAG,EAAE,OAAO,CAAC;IACb,4EAA4E;IAC5E,IAAI,EAAE,MAAM,EAAE,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,GAAG,EAAE,aAAa,CAAC;IACnB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,8EAA8E;IAC9E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAOF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,GAAG,EAAE,aAAa,CAAC;IACnB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,gFAAgF;IAChF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAClC,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,cAAc,GACd,YAAY,GACZ,kBAAkB,GAClB,kBAAkB,CAAC;AAEtB,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,cAAc,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publicationPayloads.js","sourceRoot":"","sources":["../../src/types/publicationPayloads.ts"],"names":[],"mappings":""}
|