@chatinfra/client 0.0.4 → 0.0.5

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/dist/index.d.mts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from '@chatinfra/sdk';
2
- import '@chatinfra/realtime-pusher-rn';
3
2
  import '@chatinfra/realtime-pusher-web';
4
3
  import '@chatinfra/storage-web';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from '@chatinfra/sdk';
2
- import '@chatinfra/realtime-pusher-rn';
3
2
  import '@chatinfra/realtime-pusher-web';
4
3
  import '@chatinfra/storage-web';
@@ -1,2 +1,24 @@
1
+ import { RealtimeTransport } from '@chatinfra/sdk';
1
2
  export * from '@chatinfra/sdk';
2
- export * from '@chatinfra/realtime-pusher-rn';
3
+
4
+ declare class PusherReactNativeTransport implements RealtimeTransport {
5
+ private pusher;
6
+ private inited;
7
+ private connected;
8
+ private subscribed;
9
+ private onDebug?;
10
+ init(cfg: {
11
+ key: string;
12
+ cluster: string;
13
+ forceTLS: boolean;
14
+ authorizer: (channelName: string, socketId: string) => Promise<any>;
15
+ onDebug?: (msg: string, data?: any) => void;
16
+ }): Promise<void>;
17
+ connect(): Promise<void>;
18
+ subscribe(channelName: string, onEvent: (eventName: string, data: any) => void): Promise<void>;
19
+ unsubscribe(channelName: string): Promise<void>;
20
+ trigger(channelName: string, eventName: string, data: any): Promise<void>;
21
+ disconnect(): Promise<void>;
22
+ }
23
+
24
+ export { PusherReactNativeTransport };
@@ -1,2 +1,24 @@
1
+ import { RealtimeTransport } from '@chatinfra/sdk';
1
2
  export * from '@chatinfra/sdk';
2
- export * from '@chatinfra/realtime-pusher-rn';
3
+
4
+ declare class PusherReactNativeTransport implements RealtimeTransport {
5
+ private pusher;
6
+ private inited;
7
+ private connected;
8
+ private subscribed;
9
+ private onDebug?;
10
+ init(cfg: {
11
+ key: string;
12
+ cluster: string;
13
+ forceTLS: boolean;
14
+ authorizer: (channelName: string, socketId: string) => Promise<any>;
15
+ onDebug?: (msg: string, data?: any) => void;
16
+ }): Promise<void>;
17
+ connect(): Promise<void>;
18
+ subscribe(channelName: string, onEvent: (eventName: string, data: any) => void): Promise<void>;
19
+ unsubscribe(channelName: string): Promise<void>;
20
+ trigger(channelName: string, eventName: string, data: any): Promise<void>;
21
+ disconnect(): Promise<void>;
22
+ }
23
+
24
+ export { PusherReactNativeTransport };
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
6
10
  var __copyProps = (to, from, except, desc) => {
7
11
  if (from && typeof from === "object" || typeof from === "function") {
8
12
  for (let key of __getOwnPropNames(from))
@@ -16,12 +20,102 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
20
 
17
21
  // src/react-native.ts
18
22
  var react_native_exports = {};
23
+ __export(react_native_exports, {
24
+ PusherReactNativeTransport: () => PusherReactNativeTransport
25
+ });
19
26
  module.exports = __toCommonJS(react_native_exports);
20
27
  __reExport(react_native_exports, require("@chatinfra/sdk"), module.exports);
21
- __reExport(react_native_exports, require("@chatinfra/realtime-pusher-rn"), module.exports);
28
+
29
+ // src/transports/pusher-react-native.ts
30
+ var import_pusher_websocket_react_native = require("@pusher/pusher-websocket-react-native");
31
+ var PusherReactNativeTransport = class {
32
+ constructor() {
33
+ this.pusher = import_pusher_websocket_react_native.Pusher.getInstance();
34
+ this.inited = false;
35
+ this.connected = false;
36
+ this.subscribed = /* @__PURE__ */ new Set();
37
+ }
38
+ async init(cfg) {
39
+ if (this.inited) return;
40
+ this.onDebug = cfg.onDebug;
41
+ await this.pusher.init({
42
+ apiKey: cfg.key,
43
+ cluster: cfg.cluster,
44
+ useTLS: !!cfg.forceTLS,
45
+ onAuthorizer: async (channelName, socketId) => {
46
+ this.onDebug?.("authorizer", { channelName, socketId });
47
+ return await cfg.authorizer(channelName, socketId);
48
+ }
49
+ });
50
+ this.inited = true;
51
+ }
52
+ async connect() {
53
+ if (!this.inited || this.connected) return;
54
+ try {
55
+ await this.pusher.connect();
56
+ this.connected = true;
57
+ } catch (e) {
58
+ this.onDebug?.("connect_failed", e);
59
+ throw e;
60
+ }
61
+ }
62
+ async subscribe(channelName, onEvent) {
63
+ if (!this.inited) throw new Error("PusherReactNativeTransport not initialized");
64
+ if (!this.connected) await this.connect();
65
+ if (this.subscribed.has(channelName)) return;
66
+ await this.pusher.subscribe({
67
+ channelName,
68
+ onEvent: (event) => {
69
+ let data = event.data;
70
+ try {
71
+ data = typeof data === "string" ? JSON.parse(data) : data;
72
+ } catch {
73
+ }
74
+ onEvent(event.eventName, data);
75
+ }
76
+ });
77
+ this.subscribed.add(channelName);
78
+ }
79
+ async unsubscribe(channelName) {
80
+ if (!this.inited) return;
81
+ if (!this.subscribed.has(channelName)) return;
82
+ try {
83
+ await this.pusher.unsubscribe({ channelName });
84
+ } catch (e) {
85
+ this.onDebug?.("unsubscribe_failed", e);
86
+ } finally {
87
+ this.subscribed.delete(channelName);
88
+ }
89
+ }
90
+ async trigger(channelName, eventName, data) {
91
+ if (!this.inited || !this.connected) return;
92
+ try {
93
+ await this.pusher.trigger({ channelName, eventName, data });
94
+ } catch (e) {
95
+ this.onDebug?.("trigger_failed", e);
96
+ }
97
+ }
98
+ async disconnect() {
99
+ if (!this.inited || !this.connected) return;
100
+ try {
101
+ for (const ch of Array.from(this.subscribed)) {
102
+ try {
103
+ await this.pusher.unsubscribe({ channelName: ch });
104
+ } catch {
105
+ }
106
+ }
107
+ this.subscribed.clear();
108
+ await this.pusher.disconnect();
109
+ } catch (e) {
110
+ this.onDebug?.("disconnect_failed", e);
111
+ } finally {
112
+ this.connected = false;
113
+ }
114
+ }
115
+ };
22
116
  // Annotate the CommonJS export names for ESM import in node:
23
117
  0 && (module.exports = {
24
- ...require("@chatinfra/sdk"),
25
- ...require("@chatinfra/realtime-pusher-rn")
118
+ PusherReactNativeTransport,
119
+ ...require("@chatinfra/sdk")
26
120
  });
27
121
  //# sourceMappingURL=react-native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/react-native.ts"],"sourcesContent":["export * from \"@chatinfra/sdk\";\nexport * from \"@chatinfra/realtime-pusher-rn\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iCAAc,2BAAd;AACA,iCAAc,0CADd;","names":[]}
1
+ {"version":3,"sources":["../src/react-native.ts","../src/transports/pusher-react-native.ts"],"sourcesContent":["// packages/client/src/react-native.ts\nexport * from \"@chatinfra/sdk\";\nexport { PusherReactNativeTransport } from \"./transports/pusher-react-native\";\n","// packages/client/src/transports/pusher-react-native.ts\nimport { Pusher, type PusherEvent } from \"@pusher/pusher-websocket-react-native\";\nimport type { RealtimeTransport } from \"@chatinfra/sdk\";\n\nexport class PusherReactNativeTransport implements RealtimeTransport {\n private pusher = Pusher.getInstance();\n private inited = false;\n private connected = false;\n private subscribed = new Set<string>();\n private onDebug?: (msg: string, data?: any) => void;\n\n async init(cfg: {\n key: string;\n cluster: string;\n forceTLS: boolean;\n authorizer: (channelName: string, socketId: string) => Promise<any>;\n onDebug?: (msg: string, data?: any) => void;\n }) {\n if (this.inited) return;\n\n this.onDebug = cfg.onDebug;\n\n await this.pusher.init({\n apiKey: cfg.key,\n cluster: cfg.cluster,\n useTLS: !!cfg.forceTLS,\n onAuthorizer: async (channelName: string, socketId: string) => {\n this.onDebug?.(\"authorizer\", { channelName, socketId });\n return await cfg.authorizer(channelName, socketId);\n },\n });\n\n this.inited = true;\n }\n\n async connect() {\n if (!this.inited || this.connected) return;\n try {\n await this.pusher.connect();\n this.connected = true;\n } catch (e) {\n this.onDebug?.(\"connect_failed\", e);\n throw e;\n }\n }\n\n async subscribe(channelName: string, onEvent: (eventName: string, data: any) => void) {\n if (!this.inited) throw new Error(\"PusherReactNativeTransport not initialized\");\n if (!this.connected) await this.connect();\n if (this.subscribed.has(channelName)) return;\n\n await this.pusher.subscribe({\n channelName,\n onEvent: (event: PusherEvent) => {\n let data: any = event.data;\n try {\n data = typeof data === \"string\" ? JSON.parse(data) : data;\n } catch {}\n onEvent(event.eventName, data);\n },\n });\n\n this.subscribed.add(channelName);\n }\n\n async unsubscribe(channelName: string) {\n if (!this.inited) return;\n if (!this.subscribed.has(channelName)) return;\n\n try {\n await this.pusher.unsubscribe({ channelName });\n } catch (e) {\n // ignore native edge cases\n this.onDebug?.(\"unsubscribe_failed\", e);\n } finally {\n this.subscribed.delete(channelName);\n }\n }\n\n async trigger(channelName: string, eventName: string, data: any) {\n if (!this.inited || !this.connected) return;\n try {\n await this.pusher.trigger({ channelName, eventName, data });\n } catch (e) {\n this.onDebug?.(\"trigger_failed\", e);\n }\n }\n\n async disconnect() {\n // ✅ avoid crash: don't call native disconnect if never connected\n if (!this.inited || !this.connected) return;\n\n try {\n // unsubscribe defensively\n for (const ch of Array.from(this.subscribed)) {\n try {\n await this.pusher.unsubscribe({ channelName: ch });\n } catch {}\n }\n this.subscribed.clear();\n\n await this.pusher.disconnect();\n } catch (e) {\n // ✅ swallow native disconnect crash scenarios\n this.onDebug?.(\"disconnect_failed\", e);\n } finally {\n this.connected = false;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iCAAc,2BADd;;;ACCA,2CAAyC;AAGlC,IAAM,6BAAN,MAA8D;AAAA,EAA9D;AACL,SAAQ,SAAS,4CAAO,YAAY;AACpC,SAAQ,SAAS;AACjB,SAAQ,YAAY;AACpB,SAAQ,aAAa,oBAAI,IAAY;AAAA;AAAA,EAGrC,MAAM,KAAK,KAMR;AACD,QAAI,KAAK,OAAQ;AAEjB,SAAK,UAAU,IAAI;AAEnB,UAAM,KAAK,OAAO,KAAK;AAAA,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W,OAAO,WAAW;AAAA,IACpC;AAAA,EACF;AAAA,EAEA,MAAM,QAAQ,aAAqB,WAAmB,MAAW;AAC/D,QAAI,CAAC,KAAK,UAAU,CAAC,KAAK,UAAW;AACrC,QAAI;AACF,YAAM,KAAK,OAAO,QAAQ,EAAE,aAAa,WAAW,KAAK,CAAC;AAAA,IAC5D,SAAS,GAAG;AACV,WAAK,UAAU,kBAAkB,CAAC;AAAA,IACpC;AAAA,EACF;AAAA,EAEA,MAAM,aAAa;AAEjB,QAAI,CAAC,KAAK,UAAU,CAAC,KAAK,UAAW;AAErC,QAAI;AAEF,iBAAW,MAAM,MAAM,KAAK,KAAK,UAAU,GAAG;AAC5C,YAAI;AACF,gBAAM,KAAK,OAAO,YAAY,EAAE,aAAa,GAAG,CAAC;AAAA,QACnD,QAAQ;AAAA,QAAC;AAAA,MACX;AACA,WAAK,WAAW,MAAM;AAEtB,YAAM,KAAK,OAAO,WAAW;AAAA,IAC/B,SAAS,GAAG;AAEV,WAAK,UAAU,qBAAqB,CAAC;AAAA,IACvC,UAAE;AACA,WAAK,YAAY;AAAA,IACnB;AAAA,EACF;AACF;","names":[]}
@@ -1,4 +1,94 @@
1
1
  // src/react-native.ts
2
2
  export * from "@chatinfra/sdk";
3
- export * from "@chatinfra/realtime-pusher-rn";
3
+
4
+ // src/transports/pusher-react-native.ts
5
+ import { Pusher } from "@pusher/pusher-websocket-react-native";
6
+ var PusherReactNativeTransport = class {
7
+ constructor() {
8
+ this.pusher = Pusher.getInstance();
9
+ this.inited = false;
10
+ this.connected = false;
11
+ this.subscribed = /* @__PURE__ */ new Set();
12
+ }
13
+ async init(cfg) {
14
+ if (this.inited) return;
15
+ this.onDebug = cfg.onDebug;
16
+ await this.pusher.init({
17
+ apiKey: cfg.key,
18
+ cluster: cfg.cluster,
19
+ useTLS: !!cfg.forceTLS,
20
+ onAuthorizer: async (channelName, socketId) => {
21
+ this.onDebug?.("authorizer", { channelName, socketId });
22
+ return await cfg.authorizer(channelName, socketId);
23
+ }
24
+ });
25
+ this.inited = true;
26
+ }
27
+ async connect() {
28
+ if (!this.inited || this.connected) return;
29
+ try {
30
+ await this.pusher.connect();
31
+ this.connected = true;
32
+ } catch (e) {
33
+ this.onDebug?.("connect_failed", e);
34
+ throw e;
35
+ }
36
+ }
37
+ async subscribe(channelName, onEvent) {
38
+ if (!this.inited) throw new Error("PusherReactNativeTransport not initialized");
39
+ if (!this.connected) await this.connect();
40
+ if (this.subscribed.has(channelName)) return;
41
+ await this.pusher.subscribe({
42
+ channelName,
43
+ onEvent: (event) => {
44
+ let data = event.data;
45
+ try {
46
+ data = typeof data === "string" ? JSON.parse(data) : data;
47
+ } catch {
48
+ }
49
+ onEvent(event.eventName, data);
50
+ }
51
+ });
52
+ this.subscribed.add(channelName);
53
+ }
54
+ async unsubscribe(channelName) {
55
+ if (!this.inited) return;
56
+ if (!this.subscribed.has(channelName)) return;
57
+ try {
58
+ await this.pusher.unsubscribe({ channelName });
59
+ } catch (e) {
60
+ this.onDebug?.("unsubscribe_failed", e);
61
+ } finally {
62
+ this.subscribed.delete(channelName);
63
+ }
64
+ }
65
+ async trigger(channelName, eventName, data) {
66
+ if (!this.inited || !this.connected) return;
67
+ try {
68
+ await this.pusher.trigger({ channelName, eventName, data });
69
+ } catch (e) {
70
+ this.onDebug?.("trigger_failed", e);
71
+ }
72
+ }
73
+ async disconnect() {
74
+ if (!this.inited || !this.connected) return;
75
+ try {
76
+ for (const ch of Array.from(this.subscribed)) {
77
+ try {
78
+ await this.pusher.unsubscribe({ channelName: ch });
79
+ } catch {
80
+ }
81
+ }
82
+ this.subscribed.clear();
83
+ await this.pusher.disconnect();
84
+ } catch (e) {
85
+ this.onDebug?.("disconnect_failed", e);
86
+ } finally {
87
+ this.connected = false;
88
+ }
89
+ }
90
+ };
91
+ export {
92
+ PusherReactNativeTransport
93
+ };
4
94
  //# sourceMappingURL=react-native.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/react-native.ts"],"sourcesContent":["export * from \"@chatinfra/sdk\";\nexport * from \"@chatinfra/realtime-pusher-rn\";\n"],"mappings":";AAAA,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/react-native.ts","../src/transports/pusher-react-native.ts"],"sourcesContent":["// packages/client/src/react-native.ts\nexport * from \"@chatinfra/sdk\";\nexport { PusherReactNativeTransport } from \"./transports/pusher-react-native\";\n","// packages/client/src/transports/pusher-react-native.ts\nimport { Pusher, type PusherEvent } from \"@pusher/pusher-websocket-react-native\";\nimport type { RealtimeTransport } from \"@chatinfra/sdk\";\n\nexport class PusherReactNativeTransport implements RealtimeTransport {\n private pusher = Pusher.getInstance();\n private inited = false;\n private connected = false;\n private subscribed = new Set<string>();\n private onDebug?: (msg: string, data?: any) => void;\n\n async init(cfg: {\n key: string;\n cluster: string;\n forceTLS: boolean;\n authorizer: (channelName: string, socketId: string) => Promise<any>;\n onDebug?: (msg: string, data?: any) => void;\n }) {\n if (this.inited) return;\n\n this.onDebug = cfg.onDebug;\n\n await this.pusher.init({\n apiKey: cfg.key,\n cluster: cfg.cluster,\n useTLS: !!cfg.forceTLS,\n onAuthorizer: async (channelName: string, socketId: string) => {\n this.onDebug?.(\"authorizer\", { channelName, socketId });\n return await cfg.authorizer(channelName, socketId);\n },\n });\n\n this.inited = true;\n }\n\n async connect() {\n if (!this.inited || this.connected) return;\n try {\n await this.pusher.connect();\n this.connected = true;\n } catch (e) {\n this.onDebug?.(\"connect_failed\", e);\n throw e;\n }\n }\n\n async subscribe(channelName: string, onEvent: (eventName: string, data: any) => void) {\n if (!this.inited) throw new Error(\"PusherReactNativeTransport not initialized\");\n if (!this.connected) await this.connect();\n if (this.subscribed.has(channelName)) return;\n\n await this.pusher.subscribe({\n channelName,\n onEvent: (event: PusherEvent) => {\n let data: any = event.data;\n try {\n data = typeof data === \"string\" ? JSON.parse(data) : data;\n } catch {}\n onEvent(event.eventName, data);\n },\n });\n\n this.subscribed.add(channelName);\n }\n\n async unsubscribe(channelName: string) {\n if (!this.inited) return;\n if (!this.subscribed.has(channelName)) return;\n\n try {\n await this.pusher.unsubscribe({ channelName });\n } catch (e) {\n // ignore native edge cases\n this.onDebug?.(\"unsubscribe_failed\", e);\n } finally {\n this.subscribed.delete(channelName);\n }\n }\n\n async trigger(channelName: string, eventName: string, data: any) {\n if (!this.inited || !this.connected) return;\n try {\n await this.pusher.trigger({ channelName, eventName, data });\n } catch (e) {\n this.onDebug?.(\"trigger_failed\", e);\n }\n }\n\n async disconnect() {\n // ✅ avoid crash: don't call native disconnect if never connected\n if (!this.inited || !this.connected) return;\n\n try {\n // unsubscribe defensively\n for (const ch of Array.from(this.subscribed)) {\n try {\n await this.pusher.unsubscribe({ channelName: ch });\n } catch {}\n }\n this.subscribed.clear();\n\n await this.pusher.disconnect();\n } catch (e) {\n // ✅ swallow native disconnect crash scenarios\n this.onDebug?.(\"disconnect_failed\", e);\n } finally {\n this.connected = false;\n }\n }\n}\n"],"mappings":";AACA,cAAc;;;ACAd,SAAS,cAAgC;AAGlC,IAAM,6BAAN,MAA8D;AAAA,EAA9D;AACL,SAAQ,SAAS,OAAO,YAAY;AACpC,SAAQ,SAAS;AACjB,SAAQ,YAAY;AACpB,SAAQ,aAAa,oBAAI,IAAY;AAAA;AAAA,EAGrC,MAAM,KAAK,KAMR;AACD,QAAI,KAAK,OAAQ;AAEjB,SAAK,UAAU,IAAI;AAEnB,UAAM,KAAK,OAAO,KAAK;AAAA,MACrB,QAAQ,IAAI;AAAA,MACZ,SAAS,IAAI;AAAA,MACb,QAAQ,CAAC,CAAC,IAAI;AAAA,MACd,cAAc,OAAO,aAAqB,aAAqB;AAC7D,aAAK,UAAU,cAAc,EAAE,aAAa,SAAS,CAAC;AACtD,eAAO,MAAM,IAAI,WAAW,aAAa,QAAQ;AAAA,MACnD;AAAA,IACF,CAAC;AAED,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAM,UAAU;AACd,QAAI,CAAC,KAAK,UAAU,KAAK,UAAW;AACpC,QAAI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C,KAAK,UAAW;AAErC,QAAI;AAEF,iBAAW,MAAM,MAAM,KAAK,KAAK,UAAU,GAAG;AAC5C,YAAI;AACF,gBAAM,KAAK,OAAO,YAAY,EAAE,aAAa,GAAG,CAAC;AAAA,QACnD,QAAQ;AAAA,QAAC;AAAA,MACX;AACA,WAAK,WAAW,MAAM;AAEtB,YAAM,KAAK,OAAO,WAAW;AAAA,IAC/B,SAAS,GAAG;AAEV,WAAK,UAAU,qBAAqB,CAAC;AAAA,IACvC,UAAE;AACA,WAAK,YAAY;AAAA,IACnB;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,25 +1,17 @@
1
1
  {
2
2
  "name": "@chatinfra/client",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
7
- "react-native": "dist/react-native.js",
7
+ "files": [
8
+ "dist"
9
+ ],
8
10
  "exports": {
9
11
  ".": {
10
- "react-native": {
11
- "types": "./dist/react-native.d.ts",
12
- "require": "./dist/react-native.js",
13
- "import": "./dist/react-native.mjs"
14
- },
15
- "import": {
16
- "types": "./dist/index.d.ts",
17
- "default": "./dist/index.mjs"
18
- },
19
- "require": {
20
- "types": "./dist/index.d.ts",
21
- "default": "./dist/index.js"
22
- }
12
+ "types": "./dist/index.d.ts",
13
+ "require": "./dist/index.js",
14
+ "import": "./dist/index.mjs"
23
15
  },
24
16
  "./react-native": {
25
17
  "types": "./dist/react-native.d.ts",
@@ -32,18 +24,23 @@
32
24
  "import": "./dist/web.mjs"
33
25
  }
34
26
  },
35
- "files": [
36
- "dist"
37
- ],
38
27
  "dependencies": {
39
- "@chatinfra/sdk": "0.0.1"
40
- },
41
- "optionalDependencies": {
42
- "@chatinfra/realtime-pusher-rn": "0.0.1",
28
+ "@chatinfra/sdk": "0.0.1",
43
29
  "@chatinfra/realtime-pusher-web": "0.0.1",
44
- "@chatinfra/storage-web": "0.0.1"
30
+ "@chatinfra/storage-web": "0.0.1",
31
+ "@chatinfra/realtime-pusher-rn": "0.0.1"
32
+ },
33
+ "devDependencies": {
34
+ "tsup": "^8.5.1",
35
+ "typescript": "^5.9.3",
36
+ "@pusher/pusher-websocket-react-native": "^1.3.2",
37
+ "expo-secure-store": "^15.0.8"
38
+ },
39
+ "peerDependencies": {
40
+ "@pusher/pusher-websocket-react-native": "^1.3.2",
41
+ "expo-secure-store": "*"
45
42
  },
46
43
  "scripts": {
47
- "build": "pnpm exec tsup"
44
+ "build": "pnpm exec tsup --config tsup.config.ts"
48
45
  }
49
46
  }