@reopt-ai/data-sdk-client 0.1.6 → 0.2.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 +141 -7
- package/dist/client-B1GlWwVq.d.ts +744 -0
- package/dist/client-B1GlWwVq.d.ts.map +1 -0
- package/dist/client-BCrui21p.d.cts +744 -0
- package/dist/client-BCrui21p.d.cts.map +1 -0
- package/dist/exceptions-C9Fh0BIR.js +285 -0
- package/dist/exceptions-C9Fh0BIR.js.map +1 -0
- package/dist/exceptions-CuhGo9A5.cjs +289 -0
- package/dist/exceptions-CuhGo9A5.cjs.map +1 -0
- package/dist/index.cjs +75 -1874
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +83 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +35 -33
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -70
- package/dist/index.js.map +1 -1
- package/dist/next.cjs +51 -1919
- package/dist/next.cjs.map +1 -1
- package/dist/next.d.cts +31 -0
- package/dist/next.d.cts.map +1 -0
- package/dist/next.d.ts +8 -10
- package/dist/next.d.ts.map +1 -0
- package/dist/next.js +36 -49
- package/dist/next.js.map +1 -1
- package/dist/observe-D-BHMwrO.cjs +54 -0
- package/dist/observe-D-BHMwrO.cjs.map +1 -0
- package/dist/observe-D1pNg1qL.js +54 -0
- package/dist/observe-D1pNg1qL.js.map +1 -0
- package/dist/react.cjs +105 -1863
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +80 -0
- package/dist/react.d.cts.map +1 -0
- package/dist/react.d.ts +52 -46
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +118 -23
- package/dist/react.js.map +1 -1
- package/dist/registry-BPhiH_l9.js +1775 -0
- package/dist/registry-BPhiH_l9.js.map +1 -0
- package/dist/registry-CGqrOtf4.cjs +1810 -0
- package/dist/registry-CGqrOtf4.cjs.map +1 -0
- package/dist/tracing-DAhaKkl0.cjs +93 -0
- package/dist/tracing-DAhaKkl0.cjs.map +1 -0
- package/dist/tracing-Dt1RVuQ9.js +93 -0
- package/dist/tracing-Dt1RVuQ9.js.map +1 -0
- package/package.json +31 -16
- package/dist/chunk-4MTDZBRS.js +0 -57
- package/dist/chunk-4MTDZBRS.js.map +0 -1
- package/dist/chunk-SYCBGBTH.js +0 -1627
- package/dist/chunk-SYCBGBTH.js.map +0 -1
- package/dist/chunk-YRP3I3OD.js +0 -106
- package/dist/chunk-YRP3I3OD.js.map +0 -1
- package/dist/client-BCd2fgmx.d.ts +0 -581
- package/dist/exceptions-NQHZUDYO.js +0 -9
- package/dist/exceptions-NQHZUDYO.js.map +0 -1
- package/dist/tracing-LC3NZND7.js +0 -91
- package/dist/tracing-LC3NZND7.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reopt-ai/data-sdk-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "reopt-data browser SDK — vanilla, React and Next.js App Router client components",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,19 +17,34 @@
|
|
|
17
17
|
"type": "module",
|
|
18
18
|
"exports": {
|
|
19
19
|
".": {
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
"import": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"require": {
|
|
25
|
+
"types": "./dist/index.d.cts",
|
|
26
|
+
"default": "./dist/index.cjs"
|
|
27
|
+
}
|
|
23
28
|
},
|
|
24
29
|
"./react": {
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/react.d.ts",
|
|
32
|
+
"default": "./dist/react.js"
|
|
33
|
+
},
|
|
34
|
+
"require": {
|
|
35
|
+
"types": "./dist/react.d.cts",
|
|
36
|
+
"default": "./dist/react.cjs"
|
|
37
|
+
}
|
|
28
38
|
},
|
|
29
39
|
"./next": {
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
"import": {
|
|
41
|
+
"types": "./dist/next.d.ts",
|
|
42
|
+
"default": "./dist/next.js"
|
|
43
|
+
},
|
|
44
|
+
"require": {
|
|
45
|
+
"types": "./dist/next.d.cts",
|
|
46
|
+
"default": "./dist/next.cjs"
|
|
47
|
+
}
|
|
33
48
|
}
|
|
34
49
|
},
|
|
35
50
|
"main": "./dist/index.cjs",
|
|
@@ -51,26 +66,26 @@
|
|
|
51
66
|
}
|
|
52
67
|
},
|
|
53
68
|
"dependencies": {
|
|
54
|
-
"@reopt-ai/data-contract": "0.
|
|
69
|
+
"@reopt-ai/data-contract": "0.7.0"
|
|
55
70
|
},
|
|
56
71
|
"devDependencies": {
|
|
57
72
|
"@testing-library/react": "^16.3.2",
|
|
58
73
|
"@types/node": "^22.20.1",
|
|
59
74
|
"@types/react": "^19.2.18",
|
|
60
|
-
"esbuild": "^0.28.2",
|
|
61
75
|
"jsdom": "^30.0.1",
|
|
62
|
-
"next": "16.3.
|
|
76
|
+
"next": "16.3.3",
|
|
63
77
|
"react": "^19.2.8",
|
|
64
|
-
"
|
|
78
|
+
"tsdown": "^0.22.14",
|
|
65
79
|
"typescript": "^5.9.3",
|
|
66
80
|
"vitest": "^4.1.11",
|
|
67
81
|
"@reopt-ai/data-sdk-core": "0.0.0",
|
|
68
82
|
"@repo/typescript-config": "0.0.0"
|
|
69
83
|
},
|
|
70
84
|
"scripts": {
|
|
71
|
-
"build": "
|
|
85
|
+
"build": "tsdown && pnpm run check:dist && pnpm run check:size",
|
|
86
|
+
"check:package": "node ../../scripts/check-package-contract.mjs",
|
|
72
87
|
"check-types": "tsc --noEmit",
|
|
73
|
-
"dev": "
|
|
88
|
+
"dev": "tsdown --watch",
|
|
74
89
|
"lint": "oxlint .",
|
|
75
90
|
"test": "vitest run",
|
|
76
91
|
"test:watch": "vitest",
|
package/dist/chunk-4MTDZBRS.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// src/capture/exceptions.ts
|
|
2
|
-
var MAX_STACK_CHARS = 8e3;
|
|
3
|
-
function describeError(value, source) {
|
|
4
|
-
const path = typeof location !== "undefined" ? location.pathname : "";
|
|
5
|
-
if (value instanceof Error) {
|
|
6
|
-
return {
|
|
7
|
-
$exception_type: value.name || "Error",
|
|
8
|
-
$exception_message: value.message,
|
|
9
|
-
...value.stack ? { $exception_stack: value.stack.slice(0, MAX_STACK_CHARS) } : {},
|
|
10
|
-
$exception_source: source,
|
|
11
|
-
$exception_handled: false,
|
|
12
|
-
path
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
$exception_type: typeof value === "object" && value !== null ? "UnknownError" : typeof value,
|
|
17
|
-
$exception_message: safeString(value),
|
|
18
|
-
$exception_source: source,
|
|
19
|
-
$exception_handled: false,
|
|
20
|
-
path
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function safeString(value) {
|
|
24
|
-
try {
|
|
25
|
-
return typeof value === "string" ? value : JSON.stringify(value) ?? String(value);
|
|
26
|
-
} catch {
|
|
27
|
-
return String(value);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function installExceptionCapture(report) {
|
|
31
|
-
if (typeof window === "undefined") return () => {
|
|
32
|
-
};
|
|
33
|
-
const onError = (event) => {
|
|
34
|
-
try {
|
|
35
|
-
report(describeError(event.error ?? new Error(event.message), "window.onerror"));
|
|
36
|
-
} catch {
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const onRejection = (event) => {
|
|
40
|
-
try {
|
|
41
|
-
report(describeError(event.reason, "unhandledrejection"));
|
|
42
|
-
} catch {
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
window.addEventListener("error", onError);
|
|
46
|
-
window.addEventListener("unhandledrejection", onRejection);
|
|
47
|
-
return () => {
|
|
48
|
-
window.removeEventListener("error", onError);
|
|
49
|
-
window.removeEventListener("unhandledrejection", onRejection);
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export {
|
|
54
|
-
describeError,
|
|
55
|
-
installExceptionCapture
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=chunk-4MTDZBRS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/capture/exceptions.ts"],"sourcesContent":["export type ExceptionProperties = {\n $exception_type: string;\n $exception_message: string;\n $exception_stack?: string;\n $exception_source: \"window.onerror\" | \"unhandledrejection\";\n $exception_handled: boolean;\n path: string;\n};\n\nconst MAX_STACK_CHARS = 8_000;\n\nexport function describeError(value: unknown, source: ExceptionProperties[\"$exception_source\"]): ExceptionProperties {\n const path = typeof location !== \"undefined\" ? location.pathname : \"\";\n if (value instanceof Error) {\n return {\n $exception_type: value.name || \"Error\",\n $exception_message: value.message,\n ...(value.stack ? { $exception_stack: value.stack.slice(0, MAX_STACK_CHARS) } : {}),\n $exception_source: source,\n $exception_handled: false,\n path,\n };\n }\n return {\n $exception_type: typeof value === \"object\" && value !== null ? \"UnknownError\" : typeof value,\n $exception_message: safeString(value),\n $exception_source: source,\n $exception_handled: false,\n path,\n };\n}\n\nfunction safeString(value: unknown): string {\n try {\n return typeof value === \"string\" ? value : (JSON.stringify(value) ?? String(value));\n } catch {\n return String(value);\n }\n}\n\n/**\n * Reports uncaught errors and unhandled promise rejections. Errors thrown by\n * the reporter itself are swallowed — an analytics SDK must never turn one\n * crash into two.\n */\nexport function installExceptionCapture(report: (properties: ExceptionProperties) => void): () => void {\n if (typeof window === \"undefined\") return () => {};\n const onError = (event: ErrorEvent) => {\n try {\n // Some environments deliver the message but not the Error object.\n report(describeError(event.error ?? new Error(event.message), \"window.onerror\"));\n } catch {\n // see above\n }\n };\n const onRejection = (event: PromiseRejectionEvent) => {\n try {\n report(describeError(event.reason, \"unhandledrejection\"));\n } catch {\n // see above\n }\n };\n window.addEventListener(\"error\", onError);\n window.addEventListener(\"unhandledrejection\", onRejection);\n return () => {\n window.removeEventListener(\"error\", onError);\n window.removeEventListener(\"unhandledrejection\", onRejection);\n };\n}\n"],"mappings":";AASA,IAAM,kBAAkB;AAEjB,SAAS,cAAc,OAAgB,QAAuE;AACnH,QAAM,OAAO,OAAO,aAAa,cAAc,SAAS,WAAW;AACnE,MAAI,iBAAiB,OAAO;AAC1B,WAAO;AAAA,MACL,iBAAiB,MAAM,QAAQ;AAAA,MAC/B,oBAAoB,MAAM;AAAA,MAC1B,GAAI,MAAM,QAAQ,EAAE,kBAAkB,MAAM,MAAM,MAAM,GAAG,eAAe,EAAE,IAAI,CAAC;AAAA,MACjF,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB;AAAA,IACF;AAAA,EACF;AACA,SAAO;AAAA,IACL,iBAAiB,OAAO,UAAU,YAAY,UAAU,OAAO,iBAAiB,OAAO;AAAA,IACvF,oBAAoB,WAAW,KAAK;AAAA,IACpC,mBAAmB;AAAA,IACnB,oBAAoB;AAAA,IACpB;AAAA,EACF;AACF;AAEA,SAAS,WAAW,OAAwB;AAC1C,MAAI;AACF,WAAO,OAAO,UAAU,WAAW,QAAS,KAAK,UAAU,KAAK,KAAK,OAAO,KAAK;AAAA,EACnF,QAAQ;AACN,WAAO,OAAO,KAAK;AAAA,EACrB;AACF;AAOO,SAAS,wBAAwB,QAA+D;AACrG,MAAI,OAAO,WAAW,YAAa,QAAO,MAAM;AAAA,EAAC;AACjD,QAAM,UAAU,CAAC,UAAsB;AACrC,QAAI;AAEF,aAAO,cAAc,MAAM,SAAS,IAAI,MAAM,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAAA,IACjF,QAAQ;AAAA,IAER;AAAA,EACF;AACA,QAAM,cAAc,CAAC,UAAiC;AACpD,QAAI;AACF,aAAO,cAAc,MAAM,QAAQ,oBAAoB,CAAC;AAAA,IAC1D,QAAQ;AAAA,IAER;AAAA,EACF;AACA,SAAO,iBAAiB,SAAS,OAAO;AACxC,SAAO,iBAAiB,sBAAsB,WAAW;AACzD,SAAO,MAAM;AACX,WAAO,oBAAoB,SAAS,OAAO;AAC3C,WAAO,oBAAoB,sBAAsB,WAAW;AAAA,EAC9D;AACF;","names":[]}
|