signalogy-sdk 1.0.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/README.md +64 -0
- package/dist/chunk-0btcm6v6.js +112 -0
- package/dist/chunk-0btcm6v6.js.map +14 -0
- package/dist/chunk-5d3f1stk.js +82 -0
- package/dist/chunk-5d3f1stk.js.map +14 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +9 -0
- package/dist/signalogy/client/index.d.ts +17 -0
- package/dist/signalogy/client/index.js +152 -0
- package/dist/signalogy/client/index.js.map +11 -0
- package/dist/signalogy/client/react/index.d.ts +7 -0
- package/dist/signalogy/client/react/index.js +1843 -0
- package/dist/signalogy/client/react/index.js.map +12 -0
- package/dist/signalogy/client/storage.d.ts +8 -0
- package/dist/signalogy/client/types.d.ts +6 -0
- package/dist/signalogy/server/index.d.ts +18 -0
- package/dist/signalogy/server/index.js +99 -0
- package/dist/signalogy/server/index.js.map +13 -0
- package/dist/signalogy/shared/base-url.d.ts +1 -0
- package/dist/signalogy/shared/base64.d.ts +2 -0
- package/dist/signalogy/shared/config.d.ts +9 -0
- package/dist/signalogy/shared/crypto.d.ts +2 -0
- package/dist/signalogy/shared/env.d.ts +1 -0
- package/dist/signalogy/shared/errors.d.ts +11 -0
- package/dist/signalogy/shared/fetcher.d.ts +3 -0
- package/dist/signalogy/shared/index.d.ts +7 -0
- package/dist/signalogy/shared/json.d.ts +1 -0
- package/dist/signalogy/shared/jwt.d.ts +5 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Signalogy SDK
|
|
2
|
+
|
|
3
|
+
Server and browser clients for Signalogy.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add signalogy-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Server usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { createSignalogyServer } from "signalogy-sdk";
|
|
15
|
+
|
|
16
|
+
const server = createSignalogyServer({
|
|
17
|
+
secretId: "your-secret-id",
|
|
18
|
+
secretKey: "your-secret-key",
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const token = await server.signJwt("user-123");
|
|
22
|
+
|
|
23
|
+
await server.send({
|
|
24
|
+
userId: "user-123",
|
|
25
|
+
payload: { message: "Hello" },
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Client usage
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import {
|
|
33
|
+
createSignalogyClient,
|
|
34
|
+
createBrowserJwtStorage,
|
|
35
|
+
} from "signalogy-sdk";
|
|
36
|
+
|
|
37
|
+
const client = createSignalogyClient({
|
|
38
|
+
secretId: "your-secret-id",
|
|
39
|
+
jwtStorage: createBrowserJwtStorage("signalogy_token"),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const socket = client.connectWebSocket({
|
|
43
|
+
onMessage: (event) => {
|
|
44
|
+
console.log("Received", event.data);
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## React helper
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { useSignalogyClient } from "signalogy-sdk/signalogy/client/react";
|
|
53
|
+
import { createBrowserJwtStorage } from "signalogy-sdk";
|
|
54
|
+
|
|
55
|
+
const { client } = useSignalogyClient({
|
|
56
|
+
secretId: "your-secret-id",
|
|
57
|
+
jwtStorage: createBrowserJwtStorage("signalogy_token"),
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Configuration
|
|
62
|
+
|
|
63
|
+
- `baseUrl` defaults to `https://api-signa.logy.bd`
|
|
64
|
+
- `fetcher` can be passed to override `fetch`
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
19
|
+
var __toCommonJS = (from) => {
|
|
20
|
+
var entry = __moduleCache.get(from), desc;
|
|
21
|
+
if (entry)
|
|
22
|
+
return entry;
|
|
23
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
24
|
+
if (from && typeof from === "object" || typeof from === "function")
|
|
25
|
+
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
26
|
+
get: () => from[key],
|
|
27
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
28
|
+
}));
|
|
29
|
+
__moduleCache.set(from, entry);
|
|
30
|
+
return entry;
|
|
31
|
+
};
|
|
32
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
|
+
var __export = (target, all) => {
|
|
34
|
+
for (var name in all)
|
|
35
|
+
__defProp(target, name, {
|
|
36
|
+
get: all[name],
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
set: (newValue) => all[name] = () => newValue
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
43
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
44
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
45
|
+
}) : x)(function(x) {
|
|
46
|
+
if (typeof require !== "undefined")
|
|
47
|
+
return require.apply(this, arguments);
|
|
48
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// src/signalogy/shared/errors.ts
|
|
52
|
+
class SignalogyError extends Error {
|
|
53
|
+
code;
|
|
54
|
+
status;
|
|
55
|
+
details;
|
|
56
|
+
constructor(params) {
|
|
57
|
+
super(params.message);
|
|
58
|
+
this.name = "SignalogyError";
|
|
59
|
+
this.code = params.code;
|
|
60
|
+
this.status = params.status ?? null;
|
|
61
|
+
this.details = params.details;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// src/signalogy/shared/fetcher.ts
|
|
66
|
+
var readResponseBody = async (response) => {
|
|
67
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
68
|
+
if (contentType.includes("application/json")) {
|
|
69
|
+
return response.json();
|
|
70
|
+
}
|
|
71
|
+
return response.text();
|
|
72
|
+
};
|
|
73
|
+
var createFetcher = (customFetch) => {
|
|
74
|
+
if (customFetch) {
|
|
75
|
+
return customFetch;
|
|
76
|
+
}
|
|
77
|
+
if (typeof fetch === "function") {
|
|
78
|
+
return fetch.bind(globalThis);
|
|
79
|
+
}
|
|
80
|
+
throw new SignalogyError({
|
|
81
|
+
code: "fetch_unavailable",
|
|
82
|
+
message: "Fetch API is not available in this environment."
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
var parseJsonResponse = async (response) => {
|
|
86
|
+
if (response.ok) {
|
|
87
|
+
return await readResponseBody(response);
|
|
88
|
+
}
|
|
89
|
+
const payload = await readResponseBody(response);
|
|
90
|
+
throw new SignalogyError({
|
|
91
|
+
code: "request_failed",
|
|
92
|
+
message: "Signalogy request failed",
|
|
93
|
+
status: response.status,
|
|
94
|
+
details: payload
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// src/signalogy/shared/base-url.ts
|
|
99
|
+
var DEFAULT_BASE_URL = "https://api-signa.logy.bd";
|
|
100
|
+
|
|
101
|
+
// src/signalogy/shared/config.ts
|
|
102
|
+
var normalizeConfig = (config) => ({
|
|
103
|
+
baseUrl: config.baseUrl ?? DEFAULT_BASE_URL,
|
|
104
|
+
fetcher: config.fetcher
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// src/signalogy/shared/env.ts
|
|
108
|
+
var isBrowser = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
109
|
+
|
|
110
|
+
export { __toESM, __toCommonJS, __commonJS, __export, __esm, __require, SignalogyError, createFetcher, parseJsonResponse, normalizeConfig, isBrowser };
|
|
111
|
+
|
|
112
|
+
//# debugId=970F0C5E9B62A4DB64756E2164756E21
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/signalogy/shared/errors.ts", "../src/signalogy/shared/fetcher.ts", "../src/signalogy/shared/base-url.ts", "../src/signalogy/shared/config.ts", "../src/signalogy/shared/env.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export class SignalogyError extends Error {\n\tpublic readonly code: string;\n\tpublic readonly status: number | null;\n\tpublic readonly details: unknown;\n\n\tpublic constructor(params: {\n\t\tcode: string;\n\t\tmessage: string;\n\t\tstatus?: number | null;\n\t\tdetails?: unknown;\n\t}) {\n\t\tsuper(params.message);\n\t\tthis.name = \"SignalogyError\";\n\t\tthis.code = params.code;\n\t\tthis.status = params.status ?? null;\n\t\tthis.details = params.details;\n\t}\n}\n",
|
|
6
|
+
"import { SignalogyError } from \"./errors\";\n\nexport type Fetcher = (input: RequestInfo, init?: RequestInit) => Promise<Response>;\n\nconst readResponseBody = async (response: Response): Promise<unknown> => {\n\tconst contentType = response.headers.get(\"content-type\") ?? \"\";\n\tif (contentType.includes(\"application/json\")) {\n\t\treturn response.json();\n\t}\n\treturn response.text();\n};\n\nexport const createFetcher = (customFetch?: Fetcher): Fetcher => {\n\tif (customFetch) {\n\t\treturn customFetch;\n\t}\n\n\tif (typeof fetch === \"function\") {\n\t\treturn fetch.bind(globalThis);\n\t}\n\n\tthrow new SignalogyError({\n\t\tcode: \"fetch_unavailable\",\n\t\tmessage: \"Fetch API is not available in this environment.\",\n\t});\n};\n\nexport const parseJsonResponse = async <T>(\n\tresponse: Response,\n): Promise<T> => {\n\tif (response.ok) {\n\t\treturn (await readResponseBody(response)) as T;\n\t}\n\n\tconst payload = await readResponseBody(response);\n\tthrow new SignalogyError({\n\t\tcode: \"request_failed\",\n\t\tmessage: \"Signalogy request failed\",\n\t\tstatus: response.status,\n\t\tdetails: payload,\n\t});\n};\n",
|
|
7
|
+
"export const DEFAULT_BASE_URL = \"https://api-signa.logy.bd\";\n",
|
|
8
|
+
"import { DEFAULT_BASE_URL } from \"./base-url\";\nimport type { Fetcher } from \"./fetcher\";\n\nexport type SignalogyConfig = {\n\tbaseUrl: string;\n\tfetcher?: Fetcher;\n};\n\nexport const normalizeConfig = (config: {\n\tbaseUrl?: string;\n\tfetcher?: Fetcher;\n}): SignalogyConfig => ({\n\tbaseUrl: config.baseUrl ?? DEFAULT_BASE_URL,\n\tfetcher: config.fetcher,\n});\n",
|
|
9
|
+
"export const isBrowser = (): boolean =>\n\ttypeof window !== \"undefined\" && typeof document !== \"undefined\";\n"
|
|
10
|
+
],
|
|
11
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,uBAAuB,MAAM;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EAET,WAAW,CAAC,QAKhB;AAAA,IACF,MAAM,OAAO,OAAO;AA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Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
20
|
+
|
|
21
|
+
// src/signalogy/shared/errors.ts
|
|
22
|
+
class SignalogyError extends Error {
|
|
23
|
+
code;
|
|
24
|
+
status;
|
|
25
|
+
details;
|
|
26
|
+
constructor(params) {
|
|
27
|
+
super(params.message);
|
|
28
|
+
this.name = "SignalogyError";
|
|
29
|
+
this.code = params.code;
|
|
30
|
+
this.status = params.status ?? null;
|
|
31
|
+
this.details = params.details;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/signalogy/shared/fetcher.ts
|
|
36
|
+
var readResponseBody = async (response) => {
|
|
37
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
38
|
+
if (contentType.includes("application/json")) {
|
|
39
|
+
return response.json();
|
|
40
|
+
}
|
|
41
|
+
return response.text();
|
|
42
|
+
};
|
|
43
|
+
var createFetcher = (customFetch) => {
|
|
44
|
+
if (customFetch) {
|
|
45
|
+
return customFetch;
|
|
46
|
+
}
|
|
47
|
+
if (typeof fetch === "function") {
|
|
48
|
+
return fetch.bind(globalThis);
|
|
49
|
+
}
|
|
50
|
+
throw new SignalogyError({
|
|
51
|
+
code: "fetch_unavailable",
|
|
52
|
+
message: "Fetch API is not available in this environment."
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
var parseJsonResponse = async (response) => {
|
|
56
|
+
if (response.ok) {
|
|
57
|
+
return await readResponseBody(response);
|
|
58
|
+
}
|
|
59
|
+
const payload = await readResponseBody(response);
|
|
60
|
+
throw new SignalogyError({
|
|
61
|
+
code: "request_failed",
|
|
62
|
+
message: "Signalogy request failed",
|
|
63
|
+
status: response.status,
|
|
64
|
+
details: payload
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/signalogy/shared/base-url.ts
|
|
69
|
+
var DEFAULT_BASE_URL = "https://api-signa.logy.bd";
|
|
70
|
+
|
|
71
|
+
// src/signalogy/shared/config.ts
|
|
72
|
+
var normalizeConfig = (config) => ({
|
|
73
|
+
baseUrl: config.baseUrl ?? DEFAULT_BASE_URL,
|
|
74
|
+
fetcher: config.fetcher
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// src/signalogy/shared/env.ts
|
|
78
|
+
var isBrowser = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
79
|
+
|
|
80
|
+
export { __toESM, __commonJS, __require, SignalogyError, createFetcher, parseJsonResponse, normalizeConfig, isBrowser };
|
|
81
|
+
|
|
82
|
+
//# debugId=B1D0C5FFFFD1E51464756E2164756E21
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/signalogy/shared/errors.ts", "../src/signalogy/shared/fetcher.ts", "../src/signalogy/shared/base-url.ts", "../src/signalogy/shared/config.ts", "../src/signalogy/shared/env.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export class SignalogyError extends Error {\n\tpublic readonly code: string;\n\tpublic readonly status: number | null;\n\tpublic readonly details: unknown;\n\n\tpublic constructor(params: {\n\t\tcode: string;\n\t\tmessage: string;\n\t\tstatus?: number | null;\n\t\tdetails?: unknown;\n\t}) {\n\t\tsuper(params.message);\n\t\tthis.name = \"SignalogyError\";\n\t\tthis.code = params.code;\n\t\tthis.status = params.status ?? null;\n\t\tthis.details = params.details;\n\t}\n}\n",
|
|
6
|
+
"import { SignalogyError } from \"./errors\";\n\nexport type Fetcher = (input: RequestInfo, init?: RequestInit) => Promise<Response>;\n\nconst readResponseBody = async (response: Response): Promise<unknown> => {\n\tconst contentType = response.headers.get(\"content-type\") ?? \"\";\n\tif (contentType.includes(\"application/json\")) {\n\t\treturn response.json();\n\t}\n\treturn response.text();\n};\n\nexport const createFetcher = (customFetch?: Fetcher): Fetcher => {\n\tif (customFetch) {\n\t\treturn customFetch;\n\t}\n\n\tif (typeof fetch === \"function\") {\n\t\treturn fetch.bind(globalThis);\n\t}\n\n\tthrow new SignalogyError({\n\t\tcode: \"fetch_unavailable\",\n\t\tmessage: \"Fetch API is not available in this environment.\",\n\t});\n};\n\nexport const parseJsonResponse = async <T>(\n\tresponse: Response,\n): Promise<T> => {\n\tif (response.ok) {\n\t\treturn (await readResponseBody(response)) as T;\n\t}\n\n\tconst payload = await readResponseBody(response);\n\tthrow new SignalogyError({\n\t\tcode: \"request_failed\",\n\t\tmessage: \"Signalogy request failed\",\n\t\tstatus: response.status,\n\t\tdetails: payload,\n\t});\n};\n",
|
|
7
|
+
"export const DEFAULT_BASE_URL = \"https://api-signa.logy.bd\";\n",
|
|
8
|
+
"import { DEFAULT_BASE_URL } from \"./base-url\";\nimport type { Fetcher } from \"./fetcher\";\n\nexport type SignalogyConfig = {\n\tbaseUrl: string;\n\tfetcher?: Fetcher;\n};\n\nexport const normalizeConfig = (config: {\n\tbaseUrl?: string;\n\tfetcher?: Fetcher;\n}): SignalogyConfig => ({\n\tbaseUrl: config.baseUrl ?? DEFAULT_BASE_URL,\n\tfetcher: config.fetcher,\n});\n",
|
|
9
|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AAW;AAAA,EAC3B,SAAS,OAAO;AACjB;;;ACdO,IAAM,YAAY,MACxB,OAAO,WAAW,eAAe,OAAO,aAAa;",
|
|
12
|
+
"debugId": "B1D0C5FFFFD1E51464756E2164756E21",
|
|
13
|
+
"names": []
|
|
14
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSignalogyServer
|
|
3
|
+
} from "./signalogy/server/index.js";
|
|
4
|
+
import {
|
|
5
|
+
createBrowserJwtStorage,
|
|
6
|
+
createCookieJwt,
|
|
7
|
+
createLocalStorageJwt,
|
|
8
|
+
createSignalogyClient
|
|
9
|
+
} from "./signalogy/client/index.js";
|
|
10
|
+
import"./chunk-5d3f1stk.js";
|
|
11
|
+
export {
|
|
12
|
+
createSignalogyServer,
|
|
13
|
+
createSignalogyClient,
|
|
14
|
+
createLocalStorageJwt,
|
|
15
|
+
createCookieJwt,
|
|
16
|
+
createBrowserJwtStorage
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//# debugId=DEBFF4A3EF01451D64756E2164756E21
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Fetcher } from "../shared/fetcher";
|
|
2
|
+
import type { JwtStorage } from "./storage";
|
|
3
|
+
import type { SignalogyWebSocketHandlers } from "./types";
|
|
4
|
+
export type SignalogyClientOptions = {
|
|
5
|
+
secretId: string;
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
fetcher?: Fetcher;
|
|
8
|
+
jwtStorage?: JwtStorage;
|
|
9
|
+
};
|
|
10
|
+
export type SignalogyClient = {
|
|
11
|
+
connectWebSocket: (handlers: SignalogyWebSocketHandlers) => WebSocket;
|
|
12
|
+
getToken: () => string | null;
|
|
13
|
+
validateToken: () => Promise<Record<string, unknown>>;
|
|
14
|
+
};
|
|
15
|
+
export declare const createSignalogyClient: (options: SignalogyClientOptions) => SignalogyClient;
|
|
16
|
+
export type SignalogyClientInstance = SignalogyClient;
|
|
17
|
+
export { createCookieJwt, createLocalStorageJwt, createBrowserJwtStorage, } from "./storage";
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SignalogyError,
|
|
3
|
+
createFetcher,
|
|
4
|
+
isBrowser,
|
|
5
|
+
normalizeConfig,
|
|
6
|
+
parseJsonResponse
|
|
7
|
+
} from "../../chunk-5d3f1stk.js";
|
|
8
|
+
|
|
9
|
+
// src/signalogy/client/storage.ts
|
|
10
|
+
var hasLocalStorage = () => typeof window !== "undefined" && !!window.localStorage;
|
|
11
|
+
var hasDocument = () => typeof document !== "undefined";
|
|
12
|
+
var readCookie = (key) => {
|
|
13
|
+
if (!hasDocument()) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const entries = document.cookie.split(";").map((entry) => entry.trim());
|
|
17
|
+
for (const entry of entries) {
|
|
18
|
+
if (entry.startsWith(`${key}=`)) {
|
|
19
|
+
return decodeURIComponent(entry.slice(key.length + 1));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
24
|
+
var writeCookie = (key, value) => {
|
|
25
|
+
if (!hasDocument()) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
document.cookie = `${key}=${encodeURIComponent(value)}; path=/`;
|
|
29
|
+
};
|
|
30
|
+
var clearCookie = (key) => {
|
|
31
|
+
if (!hasDocument()) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
document.cookie = `${key}=; path=/; max-age=0`;
|
|
35
|
+
};
|
|
36
|
+
var createLocalStorageJwt = (key) => ({
|
|
37
|
+
get: () => {
|
|
38
|
+
if (!hasLocalStorage()) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return window.localStorage.getItem(key);
|
|
42
|
+
},
|
|
43
|
+
set: (token) => {
|
|
44
|
+
if (!hasLocalStorage()) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
window.localStorage.setItem(key, token);
|
|
48
|
+
},
|
|
49
|
+
clear: () => {
|
|
50
|
+
if (!hasLocalStorage()) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
window.localStorage.removeItem(key);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var createCookieJwt = (key) => ({
|
|
57
|
+
get: () => readCookie(key),
|
|
58
|
+
set: (token) => writeCookie(key, token),
|
|
59
|
+
clear: () => clearCookie(key)
|
|
60
|
+
});
|
|
61
|
+
var createBrowserJwtStorage = (key) => ({
|
|
62
|
+
get: () => {
|
|
63
|
+
if (hasLocalStorage()) {
|
|
64
|
+
const value = window.localStorage.getItem(key);
|
|
65
|
+
if (value) {
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return readCookie(key);
|
|
70
|
+
},
|
|
71
|
+
set: (token) => {
|
|
72
|
+
if (hasLocalStorage()) {
|
|
73
|
+
window.localStorage.setItem(key, token);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
writeCookie(key, token);
|
|
77
|
+
},
|
|
78
|
+
clear: () => {
|
|
79
|
+
if (hasLocalStorage()) {
|
|
80
|
+
window.localStorage.removeItem(key);
|
|
81
|
+
}
|
|
82
|
+
clearCookie(key);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// src/signalogy/client/index.ts
|
|
87
|
+
var createSignalogyClient = (options) => {
|
|
88
|
+
const { baseUrl, fetcher: customFetch } = normalizeConfig({
|
|
89
|
+
baseUrl: options.baseUrl,
|
|
90
|
+
fetcher: options.fetcher
|
|
91
|
+
});
|
|
92
|
+
const fetcher = createFetcher(customFetch);
|
|
93
|
+
const jwtStorage = options.jwtStorage;
|
|
94
|
+
const getToken = () => jwtStorage?.get() ?? null;
|
|
95
|
+
const connectWebSocket = (handlers) => {
|
|
96
|
+
if (!isBrowser()) {
|
|
97
|
+
throw new SignalogyError({
|
|
98
|
+
code: "browser_required",
|
|
99
|
+
message: "Signalogy client SDK requires a browser environment."
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
const token = getToken();
|
|
103
|
+
if (!token) {
|
|
104
|
+
throw new SignalogyError({
|
|
105
|
+
code: "missing_token",
|
|
106
|
+
message: "No JWT token available. Provide a jwtStorage implementation."
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const wsBase = baseUrl.replace(/^http/, "ws");
|
|
110
|
+
const wsUrl = `${wsBase}/api/notifications/ws?token=${encodeURIComponent(token)}&secret_id=${encodeURIComponent(options.secretId)}`;
|
|
111
|
+
const socket = new WebSocket(wsUrl);
|
|
112
|
+
if (handlers.onOpen) {
|
|
113
|
+
socket.addEventListener("open", () => handlers.onOpen?.());
|
|
114
|
+
}
|
|
115
|
+
if (handlers.onMessage) {
|
|
116
|
+
socket.addEventListener("message", (event) => handlers.onMessage?.(event));
|
|
117
|
+
}
|
|
118
|
+
if (handlers.onClose) {
|
|
119
|
+
socket.addEventListener("close", (event) => handlers.onClose?.(event));
|
|
120
|
+
}
|
|
121
|
+
if (handlers.onError) {
|
|
122
|
+
socket.addEventListener("error", () => handlers.onError?.());
|
|
123
|
+
}
|
|
124
|
+
return socket;
|
|
125
|
+
};
|
|
126
|
+
const validateToken = async () => {
|
|
127
|
+
const token = getToken();
|
|
128
|
+
if (!token) {
|
|
129
|
+
throw new SignalogyError({
|
|
130
|
+
code: "missing_token",
|
|
131
|
+
message: "No JWT token available. Provide a jwtStorage implementation."
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
const response = await fetcher(`${baseUrl}/api/notifications/validate?secret_id=${encodeURIComponent(options.secretId)}`, {
|
|
135
|
+
method: "POST",
|
|
136
|
+
headers: { "content-type": "application/json" },
|
|
137
|
+
body: JSON.stringify({ token })
|
|
138
|
+
});
|
|
139
|
+
return parseJsonResponse(response);
|
|
140
|
+
};
|
|
141
|
+
return { connectWebSocket, getToken, validateToken };
|
|
142
|
+
};
|
|
143
|
+
export {
|
|
144
|
+
createSignalogyClient,
|
|
145
|
+
createLocalStorageJwt,
|
|
146
|
+
createCookieJwt,
|
|
147
|
+
createBrowserJwtStorage
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export { createLocalStorageJwt, createCookieJwt, createBrowserJwtStorage, createSignalogyClient };
|
|
151
|
+
|
|
152
|
+
//# debugId=879F8C9F626965F864756E2164756E21
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/signalogy/client/storage.ts", "../src/signalogy/client/index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export type JwtStorage = {\n\tget: () => string | null;\n\tset: (token: string) => void;\n\tclear: () => void;\n};\n\nconst hasLocalStorage = (): boolean =>\n\ttypeof window !== \"undefined\" && !!window.localStorage;\n\nconst hasDocument = (): boolean => typeof document !== \"undefined\";\n\nconst readCookie = (key: string): string | null => {\n\tif (!hasDocument()) {\n\t\treturn null;\n\t}\n\tconst entries = document.cookie.split(\";\").map((entry) => entry.trim());\n\tfor (const entry of entries) {\n\t\tif (entry.startsWith(`${key}=`)) {\n\t\t\treturn decodeURIComponent(entry.slice(key.length + 1));\n\t\t}\n\t}\n\treturn null;\n};\n\nconst writeCookie = (key: string, value: string): void => {\n\tif (!hasDocument()) {\n\t\treturn;\n\t}\n\tdocument.cookie = `${key}=${encodeURIComponent(value)}; path=/`;\n};\n\nconst clearCookie = (key: string): void => {\n\tif (!hasDocument()) {\n\t\treturn;\n\t}\n\tdocument.cookie = `${key}=; path=/; max-age=0`;\n};\n\nexport const createLocalStorageJwt = (key: string): JwtStorage => ({\n\tget: () => {\n\t\tif (!hasLocalStorage()) {\n\t\t\treturn null;\n\t\t}\n\t\treturn window.localStorage.getItem(key);\n\t},\n\tset: (token: string) => {\n\t\tif (!hasLocalStorage()) {\n\t\t\treturn;\n\t\t}\n\t\twindow.localStorage.setItem(key, token);\n\t},\n\tclear: () => {\n\t\tif (!hasLocalStorage()) {\n\t\t\treturn;\n\t\t}\n\t\twindow.localStorage.removeItem(key);\n\t},\n});\n\nexport const createCookieJwt = (key: string): JwtStorage => ({\n\tget: () => readCookie(key),\n\tset: (token: string) => writeCookie(key, token),\n\tclear: () => clearCookie(key),\n});\n\nexport const createBrowserJwtStorage = (key: string): JwtStorage => ({\n\tget: () => {\n\t\tif (hasLocalStorage()) {\n\t\t\tconst value = window.localStorage.getItem(key);\n\t\t\tif (value) {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t\treturn readCookie(key);\n\t},\n\tset: (token: string) => {\n\t\tif (hasLocalStorage()) {\n\t\t\twindow.localStorage.setItem(key, token);\n\t\t\treturn;\n\t\t}\n\t\twriteCookie(key, token);\n\t},\n\tclear: () => {\n\t\tif (hasLocalStorage()) {\n\t\t\twindow.localStorage.removeItem(key);\n\t\t}\n\t\tclearCookie(key);\n\t},\n});\n",
|
|
6
|
+
"import { createFetcher, parseJsonResponse, type Fetcher } from \"../shared/fetcher\";\nimport { SignalogyError } from \"../shared/errors\";\nimport type { JwtStorage } from \"./storage\";\nimport type { SignalogyWebSocketHandlers } from \"./types\";\nimport { normalizeConfig } from \"../shared/config\";\nimport { isBrowser } from \"../shared/env\";\n\nexport type SignalogyClientOptions = {\n\tsecretId: string;\n\tbaseUrl?: string;\n\tfetcher?: Fetcher;\n\tjwtStorage?: JwtStorage;\n};\n\nexport type SignalogyClient = {\n\tconnectWebSocket: (handlers: SignalogyWebSocketHandlers) => WebSocket;\n\tgetToken: () => string | null;\n\tvalidateToken: () => Promise<Record<string, unknown>>;\n};\n\nexport const createSignalogyClient = (\n\toptions: SignalogyClientOptions,\n): SignalogyClient => {\n\tconst { baseUrl, fetcher: customFetch } = normalizeConfig({\n\t\tbaseUrl: options.baseUrl,\n\t\tfetcher: options.fetcher,\n\t});\n\tconst fetcher = createFetcher(customFetch);\n\tconst jwtStorage = options.jwtStorage;\n\n\tconst getToken = (): string | null => jwtStorage?.get() ?? null;\n\n\tconst connectWebSocket: SignalogyClient[\"connectWebSocket\"] = (\n\t\thandlers: SignalogyWebSocketHandlers,\n\t): WebSocket => {\n\t\tif (!isBrowser()) {\n\t\t\tthrow new SignalogyError({\n\t\t\t\tcode: \"browser_required\",\n\t\t\t\tmessage: \"Signalogy client SDK requires a browser environment.\",\n\t\t\t});\n\t\t}\n\n\t\tconst token = getToken();\n\t\tif (!token) {\n\t\t\tthrow new SignalogyError({\n\t\t\t\tcode: \"missing_token\",\n\t\t\t\tmessage: \"No JWT token available. Provide a jwtStorage implementation.\",\n\t\t\t});\n\t\t}\n\n\t\tconst wsBase = baseUrl.replace(/^http/, \"ws\");\n\t\tconst wsUrl = `${wsBase}/api/notifications/ws?token=${encodeURIComponent(\n\t\t\ttoken,\n\t\t)}&secret_id=${encodeURIComponent(options.secretId)}`;\n\t\tconst socket = new WebSocket(wsUrl);\n\n\t\tif (handlers.onOpen) {\n\t\t\tsocket.addEventListener(\"open\", () => handlers.onOpen?.());\n\t\t}\n\t\tif (handlers.onMessage) {\n\t\t\tsocket.addEventListener(\"message\", (event) =>\n\t\t\t\thandlers.onMessage?.(event),\n\t\t\t);\n\t\t}\n\t\tif (handlers.onClose) {\n\t\t\tsocket.addEventListener(\"close\", (event) => handlers.onClose?.(event));\n\t\t}\n\t\tif (handlers.onError) {\n\t\t\tsocket.addEventListener(\"error\", () => handlers.onError?.());\n\t\t}\n\n\t\treturn socket;\n\t};\n\n\tconst validateToken = async (): Promise<Record<string, unknown>> => {\n\t\tconst token = getToken();\n\t\tif (!token) {\n\t\t\tthrow new SignalogyError({\n\t\t\t\tcode: \"missing_token\",\n\t\t\t\tmessage: \"No JWT token available. Provide a jwtStorage implementation.\",\n\t\t\t});\n\t\t}\n\n\t\tconst response = await fetcher(\n\t\t\t`${baseUrl}/api/notifications/validate?secret_id=${encodeURIComponent(\n\t\t\t\toptions.secretId,\n\t\t\t)}`,\n\t\t\t{\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: { \"content-type\": \"application/json\" },\n\t\t\t\tbody: JSON.stringify({ token }),\n\t\t\t},\n\t\t);\n\n\t\treturn parseJsonResponse<Record<string, unknown>>(response);\n\t};\n\n\treturn { connectWebSocket, getToken, validateToken };\n};\n\nexport type SignalogyClientInstance = SignalogyClient;\nexport {\n\tcreateCookieJwt,\n\tcreateLocalStorageJwt,\n\tcreateBrowserJwtStorage,\n} from \"./storage\";\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";;;;;;;;;AAMA,IAAM,kBAAkB,MACvB,OAAO,WAAW,eAAe,CAAC,CAAC,OAAO;AAE3C,IAAM,cAAc,MAAe,OAAO,aAAa;AAEvD,IAAM,aAAa,CAAC,QAA+B;AAAA,EAClD,IAAI,CAAC,YAAY,GAAG;AAAA,IACnB,OAAO;AAAA,EACR;AAAA,EACA,MAAM,UAAU,SAAS,OAAO,MAAM,GAAG,EAAE,IAAI,CAAC,UAAU,MAAM,KAAK,CAAC;AAAA,EACtE,WAAW,SAAS,SAAS;AAAA,IAC5B,IAAI,MAAM,WAAW,GAAG,MAAM,GAAG;AAAA,MAChC,OAAO,mBAAmB,MAAM,MAAM,IAAI,SAAS,CAAC,CAAC;AAAA,IACtD;AAAA,EACD;AAAA,EACA,OAAO;AAAA;AAGR,IAAM,cAAc,CAAC,KAAa,UAAwB;AAAA,EACzD,IAAI,CAAC,YAAY,GAAG;AAAA,IACnB;AAAA,EACD;AAAA,EACA,SAAS,SAAS,GAAG,OAAO,mBAAmB,KAAK;AAAA;AAGrD,IAAM,cAAc,CAAC,QAAsB;AAAA,EAC1C,IAAI,CAAC,YAAY,GAAG;AAAA,IACnB;AAAA,EACD;AAAA,EACA,SAAS,SAAS,GAAG;AAAA;AAGf,IAAM,wBAAwB,CAAC,SAA6B;AAAA,EAClE,KAAK,MAAM;AAAA,IACV,IAAI,CAAC,gBAAgB,GAAG;AAAA,MACvB,OAAO;AAAA,IACR;AAAA,IACA,OAAO,OAAO,aAAa,QAAQ,GAAG;AAAA;AAAA,EAEvC,KAAK,CA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SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM,KAAK,UAAU,EAAE,MAAM,CAAC;AAAA,IAC/B,CACD;AAAA,IAEA,OAAO,kBAA2C,QAAQ;AAAA;AAAA,EAG3D,OAAO,EAAE,kBAAkB,UAAU,cAAc;AAAA;",
|
|
9
|
+
"debugId": "879F8C9F626965F864756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SignalogyClientOptions, SignalogyClient } from "../index";
|
|
2
|
+
export type UseSignalogyClientResult = {
|
|
3
|
+
client: SignalogyClient | null;
|
|
4
|
+
status: "idle" | "ready" | "error";
|
|
5
|
+
error: Error | null;
|
|
6
|
+
};
|
|
7
|
+
export declare const useSignalogyClient: (options: SignalogyClientOptions) => UseSignalogyClientResult;
|