@starko-one/sdk 0.0.0-stage → 0.1.0-beta.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/LICENSE +17 -0
  3. package/NOTICE +58 -0
  4. package/README.md +81 -2
  5. package/dist/api-B5IHeINe.d.ts +558 -0
  6. package/dist/api-DR4HazCu.d.cts +558 -0
  7. package/dist/browser/index.cjs +168 -0
  8. package/dist/browser/index.d.cts +131 -0
  9. package/dist/browser/index.d.ts +131 -0
  10. package/dist/browser/index.js +7 -0
  11. package/dist/build/rollup.cjs +22 -0
  12. package/dist/build/rollup.d.cts +34 -0
  13. package/dist/build/rollup.d.ts +34 -0
  14. package/dist/build/rollup.js +3 -0
  15. package/dist/build/vite.cjs +51 -0
  16. package/dist/build/vite.d.cts +23 -0
  17. package/dist/build/vite.d.ts +23 -0
  18. package/dist/build/vite.js +46 -0
  19. package/dist/build/webpack.cjs +18 -0
  20. package/dist/build/webpack.d.cts +39 -0
  21. package/dist/build/webpack.d.ts +39 -0
  22. package/dist/build/webpack.js +3 -0
  23. package/dist/chunk-7HYGODU6.cjs +583 -0
  24. package/dist/chunk-A5M4NOVT.js +413 -0
  25. package/dist/chunk-A7MYYWMP.cjs +15 -0
  26. package/dist/chunk-BAQA47FM.js +1113 -0
  27. package/dist/chunk-CM7HM6CC.js +563 -0
  28. package/dist/chunk-DFYNIWUN.js +608 -0
  29. package/dist/chunk-DMVVCGKO.cjs +96 -0
  30. package/dist/chunk-FARGXYJ4.cjs +56 -0
  31. package/dist/chunk-G3MYIAX2.js +1226 -0
  32. package/dist/chunk-G4NAVZQ4.js +249 -0
  33. package/dist/chunk-GH7RYPKS.js +96 -0
  34. package/dist/chunk-HADYYQNL.cjs +134 -0
  35. package/dist/chunk-HOQPAB4X.js +178 -0
  36. package/dist/chunk-J5RU73SW.js +214 -0
  37. package/dist/chunk-JNAJ3YZB.cjs +223 -0
  38. package/dist/chunk-KN7H22EQ.cjs +659 -0
  39. package/dist/chunk-LDQ4I7FZ.cjs +1151 -0
  40. package/dist/chunk-NPGESRVQ.js +1212 -0
  41. package/dist/chunk-OPWM5V7A.cjs +258 -0
  42. package/dist/chunk-PYYWPIFL.cjs +1230 -0
  43. package/dist/chunk-R7JLZ4WO.cjs +115 -0
  44. package/dist/chunk-SC6VQSES.js +213 -0
  45. package/dist/chunk-TPSJGLR3.cjs +220 -0
  46. package/dist/chunk-UKBY6HPC.js +131 -0
  47. package/dist/chunk-VRSEHRBX.cjs +185 -0
  48. package/dist/chunk-X74AONZA.js +90 -0
  49. package/dist/chunk-XW3I5CJN.js +12 -0
  50. package/dist/chunk-XW56FKKJ.js +53 -0
  51. package/dist/chunk-Z3G5SW7R.cjs +1251 -0
  52. package/dist/chunk-ZVMAN7OO.cjs +431 -0
  53. package/dist/cli/index.cjs +1487 -0
  54. package/dist/common-ARWXbeS3.d.ts +36 -0
  55. package/dist/common-CwIFh2hK.d.cts +36 -0
  56. package/dist/dedupe-eHBIfUUD.d.cts +13 -0
  57. package/dist/dedupe-fw8aNtt4.d.ts +13 -0
  58. package/dist/handler-DTZ4Rzcf.d.ts +82 -0
  59. package/dist/handler-_00lctTI.d.cts +82 -0
  60. package/dist/index.cjs +277 -0
  61. package/dist/index.d.cts +187 -0
  62. package/dist/index.d.ts +187 -0
  63. package/dist/index.js +4 -0
  64. package/dist/next/client.cjs +113 -0
  65. package/dist/next/client.d.cts +26 -0
  66. package/dist/next/client.d.ts +26 -0
  67. package/dist/next/client.js +41 -0
  68. package/dist/next/config.cjs +275 -0
  69. package/dist/next/config.d.cts +193 -0
  70. package/dist/next/config.d.ts +193 -0
  71. package/dist/next/config.js +261 -0
  72. package/dist/next/index.cjs +148 -0
  73. package/dist/next/index.d.cts +32 -0
  74. package/dist/next/index.d.ts +32 -0
  75. package/dist/next/index.js +59 -0
  76. package/dist/node/index.cjs +257 -0
  77. package/dist/node/index.d.cts +145 -0
  78. package/dist/node/index.d.ts +145 -0
  79. package/dist/node/index.js +83 -0
  80. package/dist/options-0BhybO54.d.cts +47 -0
  81. package/dist/options-0BhybO54.d.ts +47 -0
  82. package/dist/react/index.cjs +107 -0
  83. package/dist/react/index.d.cts +84 -0
  84. package/dist/react/index.d.ts +84 -0
  85. package/dist/react/index.js +103 -0
  86. package/dist/scope-Bvh45bOf.d.cts +404 -0
  87. package/dist/scope-Bvh45bOf.d.ts +404 -0
  88. package/dist/server-edge-BPOGA3GH.cjs +51 -0
  89. package/dist/server-edge-GYKAJREU.js +48 -0
  90. package/dist/server-node-HYK2OB2J.js +24 -0
  91. package/dist/server-node-J2DBAHDV.cjs +27 -0
  92. package/dist/session-C_WzbEN2.d.cts +4 -0
  93. package/dist/session-C_WzbEN2.d.ts +4 -0
  94. package/dist/session-propagation-B7REA7uy.d.cts +30 -0
  95. package/dist/session-propagation-BnJjKJbR.d.ts +30 -0
  96. package/dist/starko.min.js +6 -0
  97. package/docs/browser.md +381 -0
  98. package/docs/configuration.md +269 -0
  99. package/docs/nextjs.md +312 -0
  100. package/docs/node.md +376 -0
  101. package/docs/other-backends.md +232 -0
  102. package/docs/privacy.md +112 -0
  103. package/docs/react.md +187 -0
  104. package/docs/source-maps.md +332 -0
  105. package/docs/troubleshooting.md +171 -0
  106. package/docs/widget.md +84 -0
  107. package/docs/wire-format.md +367 -0
  108. package/package.json +98 -4
@@ -0,0 +1,258 @@
1
+ 'use strict';
2
+
3
+ var chunkKN7H22EQ_cjs = require('./chunk-KN7H22EQ.cjs');
4
+ var chunkR7JLZ4WO_cjs = require('./chunk-R7JLZ4WO.cjs');
5
+
6
+ // src/core/debug-ids.ts
7
+ var SENTRY_DEBUG_ID_GLOBAL = "_sentryDebugIds";
8
+ var GLOBALS = [SENTRY_DEBUG_ID_GLOBAL, chunkR7JLZ4WO_cjs.NATIVE_DEBUG_ID_GLOBAL, chunkR7JLZ4WO_cjs.DEBUG_ID_GLOBAL];
9
+ var cache;
10
+ var fileOfStack = /* @__PURE__ */ new Map();
11
+ function readGlobal(name) {
12
+ try {
13
+ const v = globalThis[name];
14
+ return v && typeof v === "object" ? v : void 0;
15
+ } catch {
16
+ return void 0;
17
+ }
18
+ }
19
+ function getDebugIdMap(parser) {
20
+ const maps = GLOBALS.map(readGlobal);
21
+ if (!maps.some(Boolean)) return {};
22
+ const keys = maps.map((m) => m ? Object.keys(m) : []);
23
+ const sizes = keys.map((k) => k.length).join(":");
24
+ if (cache && cache.parser === parser && cache.sizes === sizes) return cache.map;
25
+ const map = {};
26
+ const add = (keys2, ids) => {
27
+ for (const stack of keys2) {
28
+ const id = ids[stack];
29
+ if (typeof id !== "string") continue;
30
+ let file = fileOfStack.get(stack);
31
+ if (file === void 0) {
32
+ file = parser(stack).find((f) => f.filename)?.filename ?? null;
33
+ fileOfStack.set(stack, file);
34
+ }
35
+ if (file) map[file] = id;
36
+ }
37
+ };
38
+ maps.forEach((m, i) => m && add(keys[i], m));
39
+ cache = { parser, sizes, map };
40
+ return map;
41
+ }
42
+ function getInjectedRelease() {
43
+ const v = globalThis[chunkR7JLZ4WO_cjs.RELEASE_GLOBAL];
44
+ if (typeof v === "string" && v) return v;
45
+ if (v && typeof v === "object" && typeof v.id === "string") return v.id;
46
+ return void 0;
47
+ }
48
+
49
+ // src/core/exceptions.ts
50
+ var ERROR_EVENT_MESSAGE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/s;
51
+ var get = (o, k) => {
52
+ try {
53
+ return o[k];
54
+ } catch {
55
+ return void 0;
56
+ }
57
+ };
58
+ function className(o) {
59
+ try {
60
+ const name = Object.getPrototypeOf(o)?.constructor?.name;
61
+ return chunkKN7H22EQ_cjs.isString(name) && name ? name : void 0;
62
+ } catch {
63
+ return void 0;
64
+ }
65
+ }
66
+ function coerceError(err) {
67
+ const name = get(err, "name");
68
+ const message = get(err, "message");
69
+ const stack = get(err, "stack");
70
+ const out = {
71
+ type: chunkKN7H22EQ_cjs.isString(name) && name || className(err) || "Error",
72
+ value: chunkKN7H22EQ_cjs.isString(message) ? message : message == null ? "" : chunkKN7H22EQ_cjs.safeString(message),
73
+ stack: chunkKN7H22EQ_cjs.isString(stack) ? stack : void 0
74
+ };
75
+ const children = [];
76
+ const cause = get(err, "cause");
77
+ if (cause !== void 0 && cause !== null) children.push(["cause", cause]);
78
+ const errors = get(err, "errors");
79
+ if (Array.isArray(errors)) errors.forEach((e, i) => children.push([`errors[${i}]`, e]));
80
+ if (children.length) out.children = children;
81
+ return out;
82
+ }
83
+ function coerce(value, ctx, serialized) {
84
+ if (chunkKN7H22EQ_cjs.isTagged(value, "ErrorEvent") || chunkKN7H22EQ_cjs.isEventLike(value) && "error" in value && "message" in value) {
85
+ const ev = value;
86
+ const filename = get(ev, "filename");
87
+ const lineno = get(ev, "lineno");
88
+ const colno = get(ev, "colno");
89
+ const locStack = chunkKN7H22EQ_cjs.isString(filename) && filename && typeof lineno === "number" && lineno > 0 ? `Error
90
+ at ${filename}:${lineno}:${typeof colno === "number" ? colno : 0}` : void 0;
91
+ const inner = get(ev, "error");
92
+ if (inner !== void 0 && inner !== null) {
93
+ const ex = coerce(inner, { ...ctx, synthetic: void 0 }, serialized);
94
+ if (!ex.stack && locStack) {
95
+ ex.stack = locStack;
96
+ ex.synthetic = false;
97
+ }
98
+ return ex;
99
+ }
100
+ const msg = get(ev, "message");
101
+ const m = ERROR_EVENT_MESSAGE.exec(chunkKN7H22EQ_cjs.isString(msg) ? msg : "") || [];
102
+ return { type: m[1] || "Error", value: m[2] || "", stack: locStack };
103
+ }
104
+ if (chunkKN7H22EQ_cjs.isTagged(value, "PromiseRejectionEvent") || chunkKN7H22EQ_cjs.isEventLike(value) && ("reason" in value || hasDetailReason(value))) {
105
+ let reason = get(value, "reason");
106
+ if (reason === void 0 && hasDetailReason(value)) reason = get(get(value, "detail"), "reason");
107
+ if (chunkKN7H22EQ_cjs.isPrimitive(reason)) {
108
+ return {
109
+ type: "UnhandledRejection",
110
+ value: `Non-Error promise rejection captured with value: ${chunkKN7H22EQ_cjs.safeString(reason)}`,
111
+ ...syntheticStack(ctx)
112
+ };
113
+ }
114
+ return coerce(reason, ctx, serialized);
115
+ }
116
+ if (chunkKN7H22EQ_cjs.isError(value)) {
117
+ const out = coerceError(value);
118
+ if (!out.stack) Object.assign(out, syntheticStack(ctx));
119
+ return out;
120
+ }
121
+ if (chunkKN7H22EQ_cjs.isEventLike(value)) {
122
+ const type = get(value, "type");
123
+ return {
124
+ type: className(value) || "Event",
125
+ value: `Event \`${className(value) || "Event"}\` (type=${chunkKN7H22EQ_cjs.isString(type) ? type : "unknown"}) captured as exception`,
126
+ ...syntheticStack(ctx)
127
+ };
128
+ }
129
+ if (value !== null && typeof value === "object") {
130
+ const o = value;
131
+ if (chunkKN7H22EQ_cjs.isPlainObject(o)) {
132
+ for (const k of Object.keys(o)) {
133
+ const v = get(o, k);
134
+ if (chunkKN7H22EQ_cjs.isError(v)) return coerce(v, ctx, serialized);
135
+ }
136
+ }
137
+ const name = get(o, "name");
138
+ const message = get(o, "message");
139
+ const stack = get(o, "stack");
140
+ let text;
141
+ if (chunkKN7H22EQ_cjs.isString(message) && message) text = message;
142
+ else {
143
+ const keys = Object.keys(o).sort();
144
+ let list = keys.join(", ");
145
+ if (list.length > 40) list = chunkKN7H22EQ_cjs.truncate(list, 40) + "\u2026";
146
+ const cls = className(o);
147
+ text = `${cls && cls !== "Object" ? `'${cls}'` : "Object"} captured as exception with keys: ${list || "[none]"}`;
148
+ }
149
+ if (serialized) serialized.value = chunkKN7H22EQ_cjs.normalizeToSize(o, chunkR7JLZ4WO_cjs.LIMITS.MAX_EXTRA_BYTES / 2, 3);
150
+ const out = { type: chunkKN7H22EQ_cjs.isString(name) && name || "Error", value: text };
151
+ if (chunkKN7H22EQ_cjs.isString(stack) && stack) out.stack = stack;
152
+ else Object.assign(out, syntheticStack(ctx));
153
+ return out;
154
+ }
155
+ if (chunkKN7H22EQ_cjs.isString(value)) return { type: "Error", value, ...syntheticStack(ctx) };
156
+ return { type: "Error", value: chunkKN7H22EQ_cjs.safeString(value), ...syntheticStack(ctx) };
157
+ }
158
+ function hasDetailReason(v) {
159
+ const d = get(v, "detail");
160
+ return !!d && typeof d === "object" && "reason" in d;
161
+ }
162
+ function syntheticStack(ctx) {
163
+ const s = ctx.synthetic;
164
+ if (!s || !s.stack) return {};
165
+ return { stack: s.stack, skip: s.skip, synthetic: true };
166
+ }
167
+ function toWireFrames(parsed, ctx) {
168
+ const ids = getDebugIdMap(ctx.parser);
169
+ return parsed.map((p) => {
170
+ const f = { platform: ctx.framePlatform };
171
+ if (p.filename !== void 0) f.filename = p.filename;
172
+ if (p.function !== void 0) f.function = p.function;
173
+ if (p.lineno !== void 0) f.lineno = p.lineno;
174
+ if (p.colno !== void 0) f.colno = p.colno;
175
+ try {
176
+ const inApp = ctx.isInApp && ctx.isInApp(p.filename);
177
+ if (typeof inApp === "boolean") f.in_app = inApp;
178
+ } catch {
179
+ }
180
+ const id = p.filename ? ids[p.filename] : void 0;
181
+ if (id) f.chunk_id = id;
182
+ return f;
183
+ });
184
+ }
185
+ function buildExceptions(value, mechanism, ctx) {
186
+ const ser = {};
187
+ const exceptions = [];
188
+ const seen = /* @__PURE__ */ new Set();
189
+ const handled = mechanism?.handled ?? true;
190
+ const visit = (v, source, parent, depth) => {
191
+ if (exceptions.length >= chunkR7JLZ4WO_cjs.LIMITS.MAX_EXCEPTIONS) return;
192
+ if (v !== null && typeof v === "object") {
193
+ if (seen.has(v)) return;
194
+ seen.add(v);
195
+ }
196
+ const ex = coerce(v, parent === void 0 ? ctx : { ...ctx, synthetic: void 0 }, parent === void 0 ? ser : void 0);
197
+ const id = exceptions.length;
198
+ const wire = { type: ex.type || "Error", value: ex.value || "" };
199
+ const mech = parent === void 0 ? { type: mechanism?.type || "generic", handled, ...stripUndefined(mechanism) } : { type: "chained", handled, source, exception_id: id, parent_id: parent };
200
+ if (ex.synthetic) mech.synthetic = true;
201
+ wire.mechanism = mech;
202
+ if (ex.stack) {
203
+ const frames = toWireFrames(ctx.parser(ex.stack, ex.skip || 0), ctx);
204
+ if (frames.length) wire.stacktrace = { type: "raw", frames };
205
+ }
206
+ exceptions.push(wire);
207
+ if (depth >= chunkR7JLZ4WO_cjs.LIMITS.MAX_EXCEPTIONS) return;
208
+ for (const [src, child] of ex.children || []) visit(child, src, id, depth + 1);
209
+ };
210
+ try {
211
+ visit(value, void 0, void 0, 0);
212
+ } catch {
213
+ if (!exceptions.length) exceptions.push({ type: "Error", value: chunkKN7H22EQ_cjs.safeString(value), mechanism: { type: mechanism?.type || "generic", handled } });
214
+ }
215
+ if (exceptions.length > 1) exceptions[0].mechanism.exception_id = 0;
216
+ return { exceptions, serialized: ser.value };
217
+ }
218
+ function stripUndefined(o) {
219
+ const out = {};
220
+ if (o) {
221
+ for (const k of Object.keys(o)) if (o[k] !== void 0) out[k] = o[k];
222
+ }
223
+ return out;
224
+ }
225
+ var captured = /* @__PURE__ */ new WeakMap();
226
+ function capturedAs(value) {
227
+ if (!value || typeof value !== "object") return void 0;
228
+ try {
229
+ return captured.get(value);
230
+ } catch {
231
+ return void 0;
232
+ }
233
+ }
234
+ function markCaptured(value, eventId) {
235
+ try {
236
+ if (!value || typeof value !== "object") return;
237
+ captured.set(value, eventId);
238
+ const inner = get(value, "error") || get(value, "reason");
239
+ if (chunkKN7H22EQ_cjs.isEventLike(value) && inner && typeof inner === "object") captured.set(inner, eventId);
240
+ } catch {
241
+ }
242
+ }
243
+ function unwrapThrown(value) {
244
+ if (chunkKN7H22EQ_cjs.isEventLike(value)) {
245
+ const inner = get(value, "error") || get(value, "reason");
246
+ if (inner && typeof inner === "object") return inner;
247
+ }
248
+ return value;
249
+ }
250
+
251
+ exports.buildExceptions = buildExceptions;
252
+ exports.capturedAs = capturedAs;
253
+ exports.coerce = coerce;
254
+ exports.getDebugIdMap = getDebugIdMap;
255
+ exports.getInjectedRelease = getInjectedRelease;
256
+ exports.markCaptured = markCaptured;
257
+ exports.toWireFrames = toWireFrames;
258
+ exports.unwrapThrown = unwrapThrown;