signalogy-sdk 1.0.0 → 1.0.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/README.md CHANGED
@@ -60,5 +60,5 @@ const { client } = useSignalogyClient({
60
60
 
61
61
  ## Configuration
62
62
 
63
- - `baseUrl` defaults to `https://api-signa.logy.bd`
63
+ - `baseUrl` defaults to `https://signa.logy.bd`
64
64
  - `fetcher` can be passed to override `fetch`
@@ -0,0 +1,82 @@
1
+ import { createRequire } from "node:module";
2
+ var __create = 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://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=FE8CFB712C16007264756E2164756E21
@@ -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://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;AAAA,IACpB,KAAK,OAAO;AAAA,IACZ,KAAK,OAAO,OAAO;AAAA,IACnB,KAAK,SAAS,OAAO,UAAU;AAAA,IAC/B,KAAK,UAAU,OAAO;AAAA;AAExB;;;ACbA,IAAM,mBAAmB,OAAO,aAAyC;AAAA,EACxE,MAAM,cAAc,SAAS,QAAQ,IAAI,cAAc,KAAK;AAAA,EAC5D,IAAI,YAAY,SAAS,kBAAkB,GAAG;AAAA,IAC7C,OAAO,SAAS,KAAK;AAAA,EACtB;AAAA,EACA,OAAO,SAAS,KAAK;AAAA;AAGf,IAAM,gBAAgB,CAAC,gBAAmC;AAAA,EAChE,IAAI,aAAa;AAAA,IAChB,OAAO;AAAA,EACR;AAAA,EAEA,IAAI,OAAO,UAAU,YAAY;AAAA,IAChC,OAAO,MAAM,KAAK,UAAU;AAAA,EAC7B;AAAA,EAEA,MAAM,IAAI,eAAe;AAAA,IACxB,MAAM;AAAA,IACN,SAAS;AAAA,EACV,CAAC;AAAA;AAGK,IAAM,oBAAoB,OAChC,aACgB;AAAA,EAChB,IAAI,SAAS,IAAI;AAAA,IAChB,OAAQ,MAAM,iBAAiB,QAAQ;AAAA,EACxC;AAAA,EAEA,MAAM,UAAU,MAAM,iBAAiB,QAAQ;AAAA,EAC/C,MAAM,IAAI,eAAe;AAAA,IACxB,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ,SAAS;AAAA,IACjB,SAAS;AAAA,EACV,CAAC;AAAA;;;ACxCK,IAAM,mBAAmB;;;ACQzB,IAAM,kBAAkB,CAAC,YAGR;AAAA,EACvB,SAAS,OAAO,WAAW;AAAA,EAC3B,SAAS,OAAO;AACjB;;;ACdO,IAAM,YAAY,MACxB,OAAO,WAAW,eAAe,OAAO,aAAa;",
12
+ "debugId": "FE8CFB712C16007264756E2164756E21",
13
+ "names": []
14
+ }
@@ -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://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=17A9AF47646990A764756E2164756E21
@@ -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://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\"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S,OAAO;AACjB;;;ACdO,IAAM,YAAY,MACxB,OAAO,WAAW,eAAe,OAAO,aAAa;",
12
+ "debugId": "17A9AF47646990A764756E2164756E21",
13
+ "names": []
14
+ }
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  createLocalStorageJwt,
8
8
  createSignalogyClient
9
9
  } from "./signalogy/client/index.js";
10
- import"./chunk-5d3f1stk.js";
10
+ import"./chunk-dd4wjp0h.js";
11
11
  export {
12
12
  createSignalogyServer,
13
13
  createSignalogyClient,
@@ -4,7 +4,7 @@ import {
4
4
  isBrowser,
5
5
  normalizeConfig,
6
6
  parseJsonResponse
7
- } from "../../chunk-5d3f1stk.js";
7
+ } from "../../chunk-dd4wjp0h.js";
8
8
 
9
9
  // src/signalogy/client/storage.ts
10
10
  var hasLocalStorage = () => typeof window !== "undefined" && !!window.localStorage;
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  __commonJS,
6
6
  __toESM
7
- } from "../../../chunk-5d3f1stk.js";
7
+ } from "../../../chunk-dd4wjp0h.js";
8
8
 
9
9
  // node_modules/react/cjs/react.development.js
10
10
  var require_react_development = __commonJS((exports, module) => {
@@ -5,7 +5,7 @@ import {
5
5
  isBrowser,
6
6
  normalizeConfig,
7
7
  parseJsonResponse
8
- } from "../../chunk-5d3f1stk.js";
8
+ } from "../../chunk-dd4wjp0h.js";
9
9
 
10
10
  // src/signalogy/shared/base64.ts
11
11
  var base64FromBytes = (bytes) => {
@@ -1 +1 @@
1
- export declare const DEFAULT_BASE_URL = "https://api-signa.logy.bd";
1
+ export declare const DEFAULT_BASE_URL = "https://signa.logy.bd";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalogy-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Signalogy SDK for server and browser clients",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -27,11 +27,6 @@
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "scripts": {
31
- "build": "bun run build:js && bun run build:types",
32
- "build:js": "bun bun.build.mjs",
33
- "build:types": "bun x tsc -p tsconfig.types.json"
34
- },
35
30
  "dependencies": {},
36
31
  "devDependencies": {
37
32
  "@types/node": "20.11.30",
@@ -42,6 +37,10 @@
42
37
  "keywords": [],
43
38
  "author": "",
44
39
  "license": "ISC",
45
- "packageManager": "pnpm@10.15.1",
46
- "sideEffects": false
47
- }
40
+ "sideEffects": false,
41
+ "scripts": {
42
+ "build": "bun run build:js && bun run build:types",
43
+ "build:js": "bun bun.build.mjs",
44
+ "build:types": "bun x tsc -p tsconfig.types.json"
45
+ }
46
+ }