@devvit/client 0.11.18-next-2025-06-18-22-55-08-ef205533e.0 → 0.11.18-next-2025-06-23-18-44-30-c58ed8056.0
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/client-meta.min.json +6 -7
- package/client.min.js +1 -1
- package/client.min.js.map +3 -3
- package/effects/index.d.ts +1 -1
- package/effects/index.d.ts.map +1 -1
- package/effects/index.js +1 -1
- package/effects/realtime.d.ts +19 -11
- package/effects/realtime.d.ts.map +1 -1
- package/effects/realtime.js +30 -23
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/package.json +8 -8
package/effects/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { navigateTo } from './navigate-to.js';
|
|
2
|
-
export { connectRealtime
|
|
2
|
+
export { connectRealtime } from './realtime.js';
|
|
3
3
|
export { showForm } from './show-form.js';
|
|
4
4
|
export { showToast, type Toast } from './show-toast.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/effects/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/effects/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/effects/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC"}
|
package/effects/index.js
CHANGED
package/effects/realtime.d.ts
CHANGED
|
@@ -9,19 +9,27 @@ type ConnectRealtimeOptions = {
|
|
|
9
9
|
* Connects to a realtime channel for receiving messages.
|
|
10
10
|
*
|
|
11
11
|
* @param opts - Connection options including channel name and callbacks
|
|
12
|
-
* @
|
|
12
|
+
* @returns A Connection object with a disconnect method
|
|
13
13
|
*/
|
|
14
|
-
export declare const connectRealtime: (opts: Readonly<ConnectRealtimeOptions>) => Promise<
|
|
14
|
+
export declare const connectRealtime: (opts: Readonly<ConnectRealtimeOptions>) => Promise<Connection>;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* This works by sending a list of all channels we want to remain subscribed to,
|
|
19
|
-
* excluding the channel we want to disconnect from. The effect handler compares this
|
|
20
|
-
* new list with existing subscriptions and triggers disconnect for any channel
|
|
21
|
-
* that's no longer in the list.
|
|
22
|
-
*
|
|
23
|
-
* @param channel - The channel name to disconnect from
|
|
16
|
+
* Clears all connections. Used for testing purposes.
|
|
17
|
+
* @internal
|
|
24
18
|
*/
|
|
25
|
-
export declare const
|
|
19
|
+
export declare const __clearConnections: () => void;
|
|
20
|
+
declare class Connection {
|
|
21
|
+
#private;
|
|
22
|
+
constructor(opts: Readonly<ConnectRealtimeOptions>);
|
|
23
|
+
/**
|
|
24
|
+
* Disconnects from the realtime channel.
|
|
25
|
+
*
|
|
26
|
+
* This works by sending a list of all channels we want to remain subscribed to,
|
|
27
|
+
* excluding the channel we want to disconnect from. The effect handler compares this
|
|
28
|
+
* new list with existing subscriptions and triggers disconnect for any channel
|
|
29
|
+
* that's no longer in the list.
|
|
30
|
+
*/
|
|
31
|
+
disconnect(): Promise<void>;
|
|
32
|
+
onMessage: (ev: MessageEvent) => void;
|
|
33
|
+
}
|
|
26
34
|
export {};
|
|
27
35
|
//# sourceMappingURL=realtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime.d.ts","sourceRoot":"","sources":["../../src/effects/realtime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACtC,CAAC;AAQF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"realtime.d.ts","sourceRoot":"","sources":["../../src/effects/realtime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACtC,CAAC;AAQF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,QAAQ,CAAC,sBAAsB,CAAC,KACrC,OAAO,CAAC,UAAU,CAepB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAO,IAErC,CAAC;AAEF,cAAM,UAAU;;gBAGF,IAAI,EAAE,QAAQ,CAAC,sBAAsB,CAAC;IAIlD;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBjC,SAAS,GAAI,IAAI,YAAY,KAAG,IAAI,CAgClC;CACH"}
|
package/effects/realtime.js
CHANGED
|
@@ -19,11 +19,12 @@ const connectionsByChannel = new Map();
|
|
|
19
19
|
* Connects to a realtime channel for receiving messages.
|
|
20
20
|
*
|
|
21
21
|
* @param opts - Connection options including channel name and callbacks
|
|
22
|
-
* @
|
|
22
|
+
* @returns A Connection object with a disconnect method
|
|
23
23
|
*/
|
|
24
24
|
export const connectRealtime = async (opts) => {
|
|
25
|
-
if (connectionsByChannel.has(opts.channel))
|
|
26
|
-
return;
|
|
25
|
+
if (connectionsByChannel.has(opts.channel)) {
|
|
26
|
+
return connectionsByChannel.get(opts.channel);
|
|
27
|
+
}
|
|
27
28
|
const connection = new Connection(opts);
|
|
28
29
|
connectionsByChannel.set(opts.channel, connection);
|
|
29
30
|
addEventListener('message', connection.onMessage);
|
|
@@ -31,29 +32,14 @@ export const connectRealtime = async (opts) => {
|
|
|
31
32
|
realtimeSubscriptions: { subscriptionIds: [...connectionsByChannel.keys()] },
|
|
32
33
|
type: 0,
|
|
33
34
|
});
|
|
35
|
+
return connection;
|
|
34
36
|
};
|
|
35
37
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* This works by sending a list of all channels we want to remain subscribed to,
|
|
39
|
-
* excluding the channel we want to disconnect from. The effect handler compares this
|
|
40
|
-
* new list with existing subscriptions and triggers disconnect for any channel
|
|
41
|
-
* that's no longer in the list.
|
|
42
|
-
*
|
|
43
|
-
* @param channel - The channel name to disconnect from
|
|
38
|
+
* Clears all connections. Used for testing purposes.
|
|
39
|
+
* @internal
|
|
44
40
|
*/
|
|
45
|
-
export const
|
|
46
|
-
|
|
47
|
-
if (!connection) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
// Get all current subscriptions except the one we're disconnecting
|
|
51
|
-
const remainingChannels = [...connectionsByChannel.keys()].filter((ch) => ch !== channel);
|
|
52
|
-
await emitEffect({
|
|
53
|
-
realtimeSubscriptions: { subscriptionIds: remainingChannels },
|
|
54
|
-
type: 0,
|
|
55
|
-
});
|
|
56
|
-
connectionsByChannel.delete(channel);
|
|
41
|
+
export const __clearConnections = () => {
|
|
42
|
+
connectionsByChannel.clear();
|
|
57
43
|
};
|
|
58
44
|
class Connection {
|
|
59
45
|
constructor(opts) {
|
|
@@ -90,5 +76,26 @@ class Connection {
|
|
|
90
76
|
};
|
|
91
77
|
__classPrivateFieldSet(this, _Connection_opts, opts, "f");
|
|
92
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Disconnects from the realtime channel.
|
|
81
|
+
*
|
|
82
|
+
* This works by sending a list of all channels we want to remain subscribed to,
|
|
83
|
+
* excluding the channel we want to disconnect from. The effect handler compares this
|
|
84
|
+
* new list with existing subscriptions and triggers disconnect for any channel
|
|
85
|
+
* that's no longer in the list.
|
|
86
|
+
*/
|
|
87
|
+
async disconnect() {
|
|
88
|
+
const connection = connectionsByChannel.get(__classPrivateFieldGet(this, _Connection_opts, "f").channel);
|
|
89
|
+
if (!connection) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// Get all current subscriptions except the one we're disconnecting
|
|
93
|
+
const remainingChannels = [...connectionsByChannel.keys()].filter((ch) => ch !== __classPrivateFieldGet(this, _Connection_opts, "f").channel);
|
|
94
|
+
await emitEffect({
|
|
95
|
+
realtimeSubscriptions: { subscriptionIds: remainingChannels },
|
|
96
|
+
type: 0,
|
|
97
|
+
});
|
|
98
|
+
connectionsByChannel.delete(__classPrivateFieldGet(this, _Connection_opts, "f").channel);
|
|
99
|
+
}
|
|
93
100
|
}
|
|
94
101
|
_Connection_opts = new WeakMap();
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { context } from './context.js';
|
|
2
|
-
export { connectRealtime,
|
|
2
|
+
export { connectRealtime, navigateTo, showForm, showToast } from './effects/index.js';
|
|
3
3
|
export { type Toast } from './effects/show-toast.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { context } from './context.js';
|
|
2
|
-
export { connectRealtime,
|
|
2
|
+
export { connectRealtime, navigateTo, showForm, showToast } from './effects/index.js';
|
|
3
3
|
export {} from './effects/show-toast.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/client",
|
|
3
|
-
"version": "0.11.18-next-2025-06-18-
|
|
3
|
+
"version": "0.11.18-next-2025-06-23-18-44-30-c58ed8056.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
},
|
|
26
26
|
"types": "./index.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@devvit/protos": "0.11.18-next-2025-06-18-
|
|
29
|
-
"@devvit/reddit": "0.11.18-next-2025-06-18-
|
|
30
|
-
"@devvit/shared-types": "0.11.18-next-2025-06-18-
|
|
31
|
-
"@devvit/web-view-scripts": "0.11.18-next-2025-06-18-
|
|
28
|
+
"@devvit/protos": "0.11.18-next-2025-06-23-18-44-30-c58ed8056.0",
|
|
29
|
+
"@devvit/reddit": "0.11.18-next-2025-06-23-18-44-30-c58ed8056.0",
|
|
30
|
+
"@devvit/shared-types": "0.11.18-next-2025-06-23-18-44-30-c58ed8056.0",
|
|
31
|
+
"@devvit/web-view-scripts": "0.11.18-next-2025-06-23-18-44-30-c58ed8056.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@ampproject/filesize": "4.3.0",
|
|
35
|
-
"@devvit/repo-tools": "0.11.18-next-2025-06-18-
|
|
36
|
-
"@devvit/tsconfig": "0.11.18-next-2025-06-18-
|
|
35
|
+
"@devvit/repo-tools": "0.11.18-next-2025-06-23-18-44-30-c58ed8056.0",
|
|
36
|
+
"@devvit/tsconfig": "0.11.18-next-2025-06-23-18-44-30-c58ed8056.0",
|
|
37
37
|
"esbuild": "0.23.0",
|
|
38
38
|
"eslint": "9.11.1",
|
|
39
39
|
"typescript": "5.8.3",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"source": "./src/index.ts",
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "a31725b21c40199319956207635670d8b296f109"
|
|
53
53
|
}
|