@devvit/realtime 0.11.17-next-2025-06-11-cb2b5dc3c.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/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2023 Reddit Inc.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions
5
+ are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ 2. Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+ 3. Neither the name of the copyright holder nor the names of its
13
+ contributors may be used to endorse or promote products derived from
14
+ this software without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
+ SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @devvit/realtime
2
+
3
+ Contains a Realtime client for use with the Devvit framework.
4
+
5
+ Sign up for Reddit's Developer Platform [here!](https://developers.reddit.com)
@@ -0,0 +1,8 @@
1
+ import type { Realtime } from '@devvit/protos';
2
+ import type { JSONValue } from '@devvit/shared-types/json.js';
3
+ export declare class RealtimeClient {
4
+ #private;
5
+ constructor(realtimePlugin: Realtime);
6
+ send(channel: string, msg: JSONValue): Promise<void>;
7
+ }
8
+ //# sourceMappingURL=RealtimeClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RealtimeClient.d.ts","sourceRoot":"","sources":["../src/RealtimeClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,qBAAa,cAAc;;gBAGb,cAAc,EAAE,QAAQ;IAI9B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAI3D"}
@@ -0,0 +1,24 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _RealtimeClient_realtimePlugin;
13
+ import { getContext } from '@devvit/server';
14
+ export class RealtimeClient {
15
+ constructor(realtimePlugin) {
16
+ _RealtimeClient_realtimePlugin.set(this, void 0);
17
+ __classPrivateFieldSet(this, _RealtimeClient_realtimePlugin, realtimePlugin, "f");
18
+ }
19
+ async send(channel, msg) {
20
+ // guarantee an object by wrapping msg. the key must align to useChannel().
21
+ await __classPrivateFieldGet(this, _RealtimeClient_realtimePlugin, "f").Send({ channel, data: { msg } }, getContext().debug.metadata);
22
+ }
23
+ }
24
+ _RealtimeClient_realtimePlugin = new WeakMap();
@@ -0,0 +1,3 @@
1
+ import { RealtimeClient } from './RealtimeClient.js';
2
+ export declare function getRealtime(): RealtimeClient;
3
+ //# sourceMappingURL=getRealtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRealtime.d.ts","sourceRoot":"","sources":["../src/getRealtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIrD,wBAAgB,WAAW,IAAI,cAAc,CAI5C"}
package/getRealtime.js ADDED
@@ -0,0 +1,8 @@
1
+ import { RealtimeDefinition } from '@devvit/protos';
2
+ import { getDevvitConfig } from '@devvit/server/get-devvit-config.js';
3
+ import { RealtimeClient } from './RealtimeClient.js';
4
+ let realtimePlugin;
5
+ export function getRealtime() {
6
+ realtimePlugin ?? (realtimePlugin = getDevvitConfig().use(RealtimeDefinition));
7
+ return new RealtimeClient(realtimePlugin);
8
+ }
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { getRealtime } from './getRealtime.js';
2
+ export type { RealtimeClient } from './RealtimeClient.js';
3
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
package/index.js ADDED
@@ -0,0 +1 @@
1
+ export { getRealtime } from './getRealtime.js';
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@devvit/realtime",
3
+ "version": "0.11.17-next-2025-06-11-cb2b5dc3c.0",
4
+ "license": "BSD-3-Clause",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://developers.reddit.com/"
8
+ },
9
+ "type": "module",
10
+ "main": "./index.js",
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "clean": "rm -rf .turbo coverage dist",
14
+ "clobber": "yarn clean && rm -rf node_modules",
15
+ "dev": "tsc -w",
16
+ "lint": "redlint .",
17
+ "lint:fix": "yarn lint --fix",
18
+ "prepublishOnly": "publish-package-json",
19
+ "test": "yarn test:types && yarn lint",
20
+ "test:types": "tsc --noEmit"
21
+ },
22
+ "types": "./index.d.ts",
23
+ "dependencies": {
24
+ "@devvit/protos": "0.11.17-next-2025-06-11-cb2b5dc3c.0",
25
+ "@devvit/shared-types": "0.11.17-next-2025-06-11-cb2b5dc3c.0"
26
+ },
27
+ "peerDependencies": {
28
+ "@devvit/server": "*"
29
+ },
30
+ "devDependencies": {
31
+ "@devvit/repo-tools": "0.11.17-next-2025-06-11-cb2b5dc3c.0",
32
+ "@devvit/server": "0.11.17-next-2025-06-11-cb2b5dc3c.0",
33
+ "@devvit/tsconfig": "0.11.17-next-2025-06-11-cb2b5dc3c.0",
34
+ "eslint": "9.11.1",
35
+ "typescript": "5.8.3"
36
+ },
37
+ "publishConfig": {
38
+ "directory": "dist"
39
+ },
40
+ "source": "./src/index.ts",
41
+ "gitHead": "b47e605e2017d7981ee0cb6edcbd3d849166e965"
42
+ }