@sentry/effect 11.11.0 → 11.13.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/build/cjs/_virtual/_rolldown/runtime.js +22 -0
- package/build/cjs/client/index.js +38 -16
- package/build/cjs/client/index.js.map +1 -1
- package/build/cjs/client/sdk.js +14 -12
- package/build/cjs/client/sdk.js.map +1 -1
- package/build/cjs/client/tracer.js +13 -8
- package/build/cjs/client/tracer.js.map +1 -1
- package/build/cjs/errorReporter.js +52 -56
- package/build/cjs/errorReporter.js.map +1 -1
- package/build/cjs/index.client.js +20 -28
- package/build/cjs/index.server.js +20 -28
- package/build/cjs/logger.js +41 -51
- package/build/cjs/logger.js.map +1 -1
- package/build/cjs/metrics.js +100 -114
- package/build/cjs/metrics.js.map +1 -1
- package/build/cjs/server/index.js +39 -16
- package/build/cjs/server/index.js.map +1 -1
- package/build/cjs/server/sdk.js +22 -14
- package/build/cjs/server/sdk.js.map +1 -1
- package/build/cjs/server/tracer.js +19 -8
- package/build/cjs/server/tracer.js.map +1 -1
- package/build/cjs/tracer.js +251 -226
- package/build/cjs/tracer.js.map +1 -1
- package/build/esm/client/index.js +37 -13
- package/build/esm/client/index.js.map +1 -1
- package/build/esm/client/sdk.js +14 -10
- package/build/esm/client/sdk.js.map +1 -1
- package/build/esm/client/tracer.js +12 -5
- package/build/esm/client/tracer.js.map +1 -1
- package/build/esm/errorReporter.js +50 -54
- package/build/esm/errorReporter.js.map +1 -1
- package/build/esm/index.client.js +8 -8
- package/build/esm/index.server.js +8 -8
- package/build/esm/logger.js +38 -48
- package/build/esm/logger.js.map +1 -1
- package/build/esm/metrics.js +93 -111
- package/build/esm/metrics.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/server/index.js +38 -13
- package/build/esm/server/index.js.map +1 -1
- package/build/esm/server/sdk.js +22 -12
- package/build/esm/server/sdk.js.map +1 -1
- package/build/esm/server/tracer.js +18 -5
- package/build/esm/server/tracer.js.map +1 -1
- package/build/esm/tracer.js +244 -222
- package/build/esm/tracer.js.map +1 -1
- package/package.json +18 -19
- package/build/cjs/index.client.js.map +0 -1
- package/build/cjs/index.server.js.map +0 -1
- package/build/esm/index.client.js.map +0 -1
- package/build/esm/index.server.js.map +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
exports.__toESM = __toESM;
|
|
@@ -1,19 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const require_errorReporter = require("../errorReporter.js");
|
|
2
|
+
const require_sdk = require("./sdk.js");
|
|
3
|
+
let effect_Layer = require("effect/Layer");
|
|
4
|
+
// src/client/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* Creates an Effect Layer that initializes Sentry for browser clients.
|
|
7
|
+
*
|
|
8
|
+
* On Effect v4 the layer also registers a Sentry `ErrorReporter`, so failures passing through
|
|
9
|
+
* `Effect.withErrorReporting`, `ErrorReporter.report` or the built-in HTTP and RPC boundaries are captured.
|
|
10
|
+
*
|
|
11
|
+
* To enable Effect tracing, logs, or metrics, compose with the respective layers:
|
|
12
|
+
* - `Layer.setTracer(Sentry.SentryEffectTracer)` for tracing
|
|
13
|
+
* - `Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger)` for logs
|
|
14
|
+
* - `Sentry.SentryEffectMetricsLayer` for metrics
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import * as Sentry from '@sentry/effect/client';
|
|
19
|
+
* import { Layer, Logger, LogLevel } from 'effect';
|
|
20
|
+
*
|
|
21
|
+
* const SentryLive = Layer.mergeAll(
|
|
22
|
+
* Sentry.effectLayer({
|
|
23
|
+
* dsn: '__DSN__',
|
|
24
|
+
* integrations: [Sentry.browserTracingIntegration()],
|
|
25
|
+
* tracesSampleRate: 1.0,
|
|
26
|
+
* }),
|
|
27
|
+
* Layer.setTracer(Sentry.SentryEffectTracer),
|
|
28
|
+
* Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger),
|
|
29
|
+
* );
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
7
32
|
function effectLayer(options) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}),
|
|
13
|
-
errorReporter.makeSentryErrorReporterLayer()
|
|
14
|
-
);
|
|
33
|
+
return (0, effect_Layer.merge)((0, effect_Layer.suspend)(() => {
|
|
34
|
+
require_sdk.init(options);
|
|
35
|
+
return effect_Layer.empty;
|
|
36
|
+
}), require_errorReporter.makeSentryErrorReporterLayer());
|
|
15
37
|
}
|
|
16
|
-
|
|
17
|
-
exports.init = sdk.init;
|
|
18
38
|
exports.effectLayer = effectLayer;
|
|
19
|
-
|
|
39
|
+
exports.init = require_sdk.init;
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/client/index.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport type * as EffectLayer from 'effect/Layer';\nimport { empty as emptyLayer, merge as mergeLayer, suspend as suspendLayer } from 'effect/Layer';\nimport { makeSentryErrorReporterLayer } from '../errorReporter';\nimport { init } from './sdk';\n\nexport { init } from './sdk';\n\n/**\n * Options for the Sentry Effect client layer.\n */\nexport type EffectClientLayerOptions = BrowserOptions;\n\n/**\n * Creates an Effect Layer that initializes Sentry for browser clients.\n *\n * On Effect v4 the layer also registers a Sentry `ErrorReporter`, so failures passing through\n * `Effect.withErrorReporting`, `ErrorReporter.report` or the built-in HTTP and RPC boundaries are captured.\n *\n * To enable Effect tracing, logs, or metrics, compose with the respective layers:\n * - `Layer.setTracer(Sentry.SentryEffectTracer)` for tracing\n * - `Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger)` for logs\n * - `Sentry.SentryEffectMetricsLayer` for metrics\n *\n * @example\n * ```typescript\n * import * as Sentry from '@sentry/effect/client';\n * import { Layer, Logger, LogLevel } from 'effect';\n *\n * const SentryLive = Layer.mergeAll(\n * Sentry.effectLayer({\n * dsn: '__DSN__',\n * integrations: [Sentry.browserTracingIntegration()],\n * tracesSampleRate: 1.0,\n * }),\n * Layer.setTracer(Sentry.SentryEffectTracer),\n * Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger),\n * );\n * ```\n */\nexport function effectLayer(options: EffectClientLayerOptions): EffectLayer.Layer<never, never, never> {\n return mergeLayer(\n suspendLayer(() => {\n init(options);\n\n return emptyLayer;\n }),\n makeSentryErrorReporterLayer(),\n );\n}\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":["mergeLayer","suspendLayer","init","emptyLayer","makeSentryErrorReporterLayer"],"sources":["../../../src/client/index.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport type * as EffectLayer from 'effect/Layer';\nimport { empty as emptyLayer, merge as mergeLayer, suspend as suspendLayer } from 'effect/Layer';\nimport { makeSentryErrorReporterLayer } from '../errorReporter';\nimport { init } from './sdk';\n\nexport { init } from './sdk';\n\n/**\n * Options for the Sentry Effect client layer.\n */\nexport type EffectClientLayerOptions = BrowserOptions;\n\n/**\n * Creates an Effect Layer that initializes Sentry for browser clients.\n *\n * On Effect v4 the layer also registers a Sentry `ErrorReporter`, so failures passing through\n * `Effect.withErrorReporting`, `ErrorReporter.report` or the built-in HTTP and RPC boundaries are captured.\n *\n * To enable Effect tracing, logs, or metrics, compose with the respective layers:\n * - `Layer.setTracer(Sentry.SentryEffectTracer)` for tracing\n * - `Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger)` for logs\n * - `Sentry.SentryEffectMetricsLayer` for metrics\n *\n * @example\n * ```typescript\n * import * as Sentry from '@sentry/effect/client';\n * import { Layer, Logger, LogLevel } from 'effect';\n *\n * const SentryLive = Layer.mergeAll(\n * Sentry.effectLayer({\n * dsn: '__DSN__',\n * integrations: [Sentry.browserTracingIntegration()],\n * tracesSampleRate: 1.0,\n * }),\n * Layer.setTracer(Sentry.SentryEffectTracer),\n * Logger.replace(Logger.defaultLogger, Sentry.SentryEffectLogger),\n * );\n * ```\n */\nexport function effectLayer(options: EffectClientLayerOptions): EffectLayer.Layer<never, never, never> {\n return mergeLayer(\n suspendLayer(() => {\n init(options);\n\n return emptyLayer;\n }),\n makeSentryErrorReporterLayer(),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,YAAY,SAA2E;CACrG,QAAA,GAAOA,aAAAA,MAAAA,EAAAA,GACLC,aAAAA,QAAAA,OAAmB;EACjBC,YAAAA,KAAK,OAAO;EAEZ,OAAOC,aAAAA;CACT,CAAC,GACDC,sBAAAA,6BAA6B,CAC/B;AACF"}
|
package/build/cjs/client/sdk.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
let _sentry_core = require("@sentry/core");
|
|
2
|
+
let _sentry_browser = require("@sentry/browser");
|
|
3
|
+
// src/client/sdk.ts
|
|
4
|
+
/**
|
|
5
|
+
* Initializes the Sentry Effect SDK for browser clients.
|
|
6
|
+
*
|
|
7
|
+
* @param options - Configuration options for the SDK
|
|
8
|
+
* @returns The initialized Sentry client, or undefined if initialization failed
|
|
9
|
+
*/
|
|
6
10
|
function init(options) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
core.applySdkMetadata(opts, "effect", ["effect", "browser"]);
|
|
11
|
-
return browser.init(opts);
|
|
11
|
+
const opts = { ...options };
|
|
12
|
+
(0, _sentry_core.applySdkMetadata)(opts, "effect", ["effect", "browser"]);
|
|
13
|
+
return (0, _sentry_browser.init)(opts);
|
|
12
14
|
}
|
|
13
|
-
|
|
14
15
|
exports.init = init;
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../../src/client/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport { init as initBrowser } from '@sentry/browser';\nimport type { Client } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\n\n/**\n * Initializes the Sentry Effect SDK for browser clients.\n *\n * @param options - Configuration options for the SDK\n * @returns The initialized Sentry client, or undefined if initialization failed\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'effect', ['effect', 'browser']);\n\n return initBrowser(opts);\n}\n"],"
|
|
1
|
+
{"version":3,"file":"sdk.js","names":["applySdkMetadata","initBrowser"],"sources":["../../../src/client/sdk.ts"],"sourcesContent":["import type { BrowserOptions } from '@sentry/browser';\nimport { init as initBrowser } from '@sentry/browser';\nimport type { Client } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\n\n/**\n * Initializes the Sentry Effect SDK for browser clients.\n *\n * @param options - Configuration options for the SDK\n * @returns The initialized Sentry client, or undefined if initialization failed\n */\nexport function init(options: BrowserOptions): Client | undefined {\n const opts = {\n ...options,\n };\n\n applySdkMetadata(opts, 'effect', ['effect', 'browser']);\n\n return initBrowser(opts);\n}\n"],"mappings":";;;;;;;;;AAWA,SAAgB,KAAK,SAA6C;CAChE,MAAM,OAAO,EACX,GAAG,QACL;CAEAA,CAAAA,GAAAA,aAAAA,iBAAAA,CAAiB,MAAM,UAAU,CAAC,UAAU,SAAS,CAAC;CAEtD,QAAA,GAAOC,gBAAAA,KAAAA,CAAY,IAAI;AACzB"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const require_tracer = require("../tracer.js");
|
|
2
|
+
let _sentry_core_browser = require("@sentry/core/browser");
|
|
3
|
+
// src/client/tracer.ts
|
|
4
|
+
/**
|
|
5
|
+
* Effect `Tracer` that records Effect spans as Sentry spans in browser clients.
|
|
6
|
+
*
|
|
7
|
+
* Wrapped in an arrow rather than passed by reference so the import binding is read per span. That
|
|
8
|
+
* keeps the browser variant substitutable (mocks, bundler interop) exactly as it was when the tracer
|
|
9
|
+
* called it directly.
|
|
10
|
+
*/
|
|
11
|
+
const SentryEffectTracer = require_tracer.makeSentryTracer((options) => (0, _sentry_core_browser.startInactiveSpan)(options), false);
|
|
8
12
|
exports.SentryEffectTracer = SentryEffectTracer;
|
|
9
|
-
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=tracer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracer.js","sources":["../../../src/client/tracer.ts"],"sourcesContent":["import { startInactiveSpan } from '@sentry/core/browser';\nimport { makeSentryTracer } from '../tracer';\n\n/**\n * Effect `Tracer` that records Effect spans as Sentry spans in browser clients.\n *\n * Wrapped in an arrow rather than passed by reference so the import binding is read per span. That\n * keeps the browser variant substitutable (mocks, bundler interop) exactly as it was when the tracer\n * called it directly.\n */\nexport const SentryEffectTracer = makeSentryTracer(options => startInactiveSpan(options), false);\n"],"
|
|
1
|
+
{"version":3,"file":"tracer.js","names":["makeSentryTracer","startInactiveSpan"],"sources":["../../../src/client/tracer.ts"],"sourcesContent":["import { startInactiveSpan } from '@sentry/core/browser';\nimport { makeSentryTracer } from '../tracer';\n\n/**\n * Effect `Tracer` that records Effect spans as Sentry spans in browser clients.\n *\n * Wrapped in an arrow rather than passed by reference so the import binding is read per span. That\n * keeps the browser variant substitutable (mocks, bundler interop) exactly as it was when the tracer\n * called it directly.\n */\nexport const SentryEffectTracer = makeSentryTracer(options => startInactiveSpan(options), false);\n"],"mappings":";;;;;;;;;;AAUA,MAAa,qBAAqBA,eAAAA,kBAAiB,aAAA,GAAWC,qBAAAA,kBAAAA,CAAkB,OAAO,GAAG,KAAK"}
|
|
@@ -1,65 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const ErrorReporter = effectExports.ErrorReporter;
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
2
|
+
let effect_Layer = require("effect/Layer");
|
|
3
|
+
let _sentry_core = require("@sentry/core");
|
|
4
|
+
let effect = require("effect");
|
|
5
|
+
effect = require_runtime.__toESM(effect);
|
|
6
|
+
// src/errorReporter.ts
|
|
7
|
+
const ErrorReporter = Reflect.get(effect, "ErrorReporter");
|
|
9
8
|
const SEVERITY_TO_LEVEL = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
Fatal: "fatal",
|
|
10
|
+
Error: "error",
|
|
11
|
+
Warn: "warning",
|
|
12
|
+
Info: "info",
|
|
13
|
+
Debug: "debug",
|
|
14
|
+
Trace: "debug"
|
|
16
15
|
};
|
|
17
16
|
function getLevel(errorReporter, error) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
return "error";
|
|
17
|
+
if ((0, _sentry_core.isObjectLike)(error) && errorReporter.severity in error) return SEVERITY_TO_LEVEL[errorReporter.getSeverity(error)];
|
|
18
|
+
return "error";
|
|
22
19
|
}
|
|
23
20
|
function makeSentryErrorReporter(errorReporter) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
21
|
+
const reported = /* @__PURE__ */ new WeakSet();
|
|
22
|
+
return {
|
|
23
|
+
[errorReporter.TypeId]: errorReporter.TypeId,
|
|
24
|
+
report({ cause }) {
|
|
25
|
+
if (reported.has(cause)) return;
|
|
26
|
+
reported.add(cause);
|
|
27
|
+
for (const reason of cause.reasons) {
|
|
28
|
+
if (reason._tag === "Interrupt") continue;
|
|
29
|
+
const error = reason._tag === "Fail" ? reason.error : reason.defect;
|
|
30
|
+
if ((0, _sentry_core.isObjectLike)(error)) {
|
|
31
|
+
if (reported.has(error)) continue;
|
|
32
|
+
reported.add(error);
|
|
33
|
+
}
|
|
34
|
+
if (errorReporter.isIgnored(error)) continue;
|
|
35
|
+
(0, _sentry_core.captureException)(error, {
|
|
36
|
+
mechanism: {
|
|
37
|
+
type: "auto.function.effect.error_reporter",
|
|
38
|
+
handled: false
|
|
39
|
+
},
|
|
40
|
+
captureContext: {
|
|
41
|
+
level: getLevel(errorReporter, error),
|
|
42
|
+
extra: (0, _sentry_core.isObjectLike)(error) ? { ...errorReporter.getAttributes(error) } : void 0
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
56
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Registers a Sentry `ErrorReporter` for `Effect.withErrorReporting`, `ErrorReporter.report` and the
|
|
51
|
+
* built-in HTTP and RPC reporting boundaries. Existing reporters are kept.
|
|
52
|
+
*
|
|
53
|
+
* Effect v3 has no `ErrorReporter` API, so the returned layer is empty there.
|
|
54
|
+
*/
|
|
57
55
|
function makeSentryErrorReporterLayer() {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
return ErrorReporter.layer([makeSentryErrorReporter(ErrorReporter)], { mergeWithExisting: true });
|
|
56
|
+
if (!ErrorReporter) return effect_Layer.empty;
|
|
57
|
+
return ErrorReporter.layer([makeSentryErrorReporter(ErrorReporter)], { mergeWithExisting: true });
|
|
62
58
|
}
|
|
63
|
-
|
|
64
59
|
exports.makeSentryErrorReporterLayer = makeSentryErrorReporterLayer;
|
|
65
|
-
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=errorReporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorReporter.js","sources":["../../src/errorReporter.ts"],"sourcesContent":["import type { SeverityLevel } from '@sentry/core';\nimport { captureException, isObjectLike } from '@sentry/core';\nimport * as Effect from 'effect';\nimport type * as Cause from 'effect/Cause';\nimport type * as EffectErrorReporter from 'effect/ErrorReporter';\nimport type * as EffectLayer from 'effect/Layer';\nimport { empty as emptyLayer } from 'effect/Layer';\nimport type * as LogLevel from 'effect/LogLevel';\n\n// `effect/ErrorReporter` only exists in Effect v4, so it is read off the main entry instead of being imported\n// as a subpath. On Effect v3 the lookup yields `undefined` and no reporter is registered. The property is read\n//
|
|
1
|
+
{"version":3,"file":"errorReporter.js","names":["Effect","isObjectLike","captureException","emptyLayer"],"sources":["../../src/errorReporter.ts"],"sourcesContent":["import type { SeverityLevel } from '@sentry/core';\nimport { captureException, isObjectLike } from '@sentry/core';\nimport * as Effect from 'effect';\nimport type * as Cause from 'effect/Cause';\nimport type * as EffectErrorReporter from 'effect/ErrorReporter';\nimport type * as EffectLayer from 'effect/Layer';\nimport { empty as emptyLayer } from 'effect/Layer';\nimport type * as LogLevel from 'effect/LogLevel';\n\n// `effect/ErrorReporter` only exists in Effect v4, so it is read off the main entry instead of being imported\n// as a subpath. On Effect v3 the lookup yields `undefined` and no reporter is registered. The property is read\n// with `Reflect.get` because bundlers fail the build on `Effect.ErrorReporter` when the export is absent, and\n// an aliased property read gets folded back into exactly that member access by our own build.\nconst ErrorReporter = Reflect.get(Effect, 'ErrorReporter') as typeof EffectErrorReporter | undefined;\n\nconst SEVERITY_TO_LEVEL: Record<LogLevel.Severity, SeverityLevel> = {\n Fatal: 'fatal',\n Error: 'error',\n Warn: 'warning',\n Info: 'info',\n Debug: 'debug',\n Trace: 'debug',\n};\n\nfunction getLevel(errorReporter: typeof EffectErrorReporter, error: unknown): SeverityLevel {\n // Effect's `getSeverity` falls back to `Info` for unannotated errors, which would file plain failures as\n // informational in Sentry. Only an explicit annotation changes the level.\n if (isObjectLike(error) && errorReporter.severity in error) {\n return SEVERITY_TO_LEVEL[errorReporter.getSeverity(error)];\n }\n return 'error';\n}\n\nfunction makeSentryErrorReporter(errorReporter: typeof EffectErrorReporter): EffectErrorReporter.ErrorReporter {\n const reported = new WeakSet<object>();\n\n return {\n [errorReporter.TypeId]: errorReporter.TypeId,\n report({ cause }: { readonly cause: Cause.Cause<unknown> }): void {\n if (reported.has(cause)) {\n return;\n }\n reported.add(cause);\n\n for (const reason of cause.reasons) {\n if (reason._tag === 'Interrupt') {\n continue;\n }\n\n // The raw error is captured rather than Effect's pretty-printed copy so Sentry sees the original stack,\n // `cause` chain and error class.\n const error = reason._tag === 'Fail' ? reason.error : reason.defect;\n\n if (isObjectLike(error)) {\n if (reported.has(error)) {\n continue;\n }\n reported.add(error);\n }\n\n if (errorReporter.isIgnored(error)) {\n continue;\n }\n\n captureException(error, {\n mechanism: { type: 'auto.function.effect.error_reporter', handled: false },\n captureContext: {\n level: getLevel(errorReporter, error),\n extra: isObjectLike(error) ? { ...errorReporter.getAttributes(error) } : undefined,\n },\n });\n }\n },\n };\n}\n\n/**\n * Registers a Sentry `ErrorReporter` for `Effect.withErrorReporting`, `ErrorReporter.report` and the\n * built-in HTTP and RPC reporting boundaries. Existing reporters are kept.\n *\n * Effect v3 has no `ErrorReporter` API, so the returned layer is empty there.\n */\nexport function makeSentryErrorReporterLayer(): EffectLayer.Layer<never, never, never> {\n if (!ErrorReporter) {\n return emptyLayer;\n }\n\n return ErrorReporter.layer([makeSentryErrorReporter(ErrorReporter)], { mergeWithExisting: true });\n}\n"],"mappings":";;;;;;AAaA,MAAM,gBAAgB,QAAQ,IAAIA,QAAQ,eAAe;AAEzD,MAAM,oBAA8D;CAClE,OAAO;CACP,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;AACT;AAEA,SAAS,SAAS,eAA2C,OAA+B;CAG1F,KAAA,GAAIC,aAAAA,aAAAA,CAAa,KAAK,KAAK,cAAc,YAAY,OACnD,OAAO,kBAAkB,cAAc,YAAY,KAAK;CAE1D,OAAO;AACT;AAEA,SAAS,wBAAwB,eAA8E;CAC7G,MAAM,2BAAW,IAAI,QAAgB;CAErC,OAAO;GACJ,cAAc,SAAS,cAAc;EACtC,OAAO,EAAE,SAAyD;GAChE,IAAI,SAAS,IAAI,KAAK,GACpB;GAEF,SAAS,IAAI,KAAK;GAElB,KAAK,MAAM,UAAU,MAAM,SAAS;IAClC,IAAI,OAAO,SAAS,aAClB;IAKF,MAAM,QAAQ,OAAO,SAAS,SAAS,OAAO,QAAQ,OAAO;IAE7D,KAAA,GAAIA,aAAAA,aAAAA,CAAa,KAAK,GAAG;KACvB,IAAI,SAAS,IAAI,KAAK,GACpB;KAEF,SAAS,IAAI,KAAK;IACpB;IAEA,IAAI,cAAc,UAAU,KAAK,GAC/B;IAGFC,CAAAA,GAAAA,aAAAA,iBAAAA,CAAiB,OAAO;KACtB,WAAW;MAAE,MAAM;MAAuC,SAAS;KAAM;KACzE,gBAAgB;MACd,OAAO,SAAS,eAAe,KAAK;MACpC,QAAA,GAAOD,aAAAA,aAAAA,CAAa,KAAK,IAAI,EAAE,GAAG,cAAc,cAAc,KAAK,EAAE,IAAI,KAAA;KAC3E;IACF,CAAC;GACH;EACF;CACF;AACF;;;;;;;AAQA,SAAgB,+BAAuE;CACrF,IAAI,CAAC,eACH,OAAOE,aAAAA;CAGT,OAAO,cAAc,MAAM,CAAC,wBAAwB,aAAa,CAAC,GAAG,EAAE,mBAAmB,KAAK,CAAC;AAClG"}
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.
|
|
14
|
-
|
|
15
|
-
exports.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Object.
|
|
20
|
-
!Object.prototype.hasOwnProperty.call(exports,
|
|
21
|
-
Object.defineProperty(exports, '__proto__', {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
value: browser['__proto__']
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
Object.keys(browser).forEach(function (k) {
|
|
27
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = browser[k];
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_index = require("./client/index.js");
|
|
3
|
+
const require_tracer = require("./client/tracer.js");
|
|
4
|
+
const require_tracer$1 = require("./tracer.js");
|
|
5
|
+
const require_sdk = require("./client/sdk.js");
|
|
6
|
+
const require_logger = require("./logger.js");
|
|
7
|
+
const require_metrics = require("./metrics.js");
|
|
8
|
+
exports.SentryEffectExternalSpanLayer = require_tracer$1.SentryEffectExternalSpanLayer;
|
|
9
|
+
exports.SentryEffectLogger = require_logger.SentryEffectLogger;
|
|
10
|
+
exports.SentryEffectMetricsLayer = require_metrics.SentryEffectMetricsLayer;
|
|
11
|
+
exports.SentryEffectTracer = require_tracer.SentryEffectTracer;
|
|
12
|
+
exports.effectLayer = require_index.effectLayer;
|
|
13
|
+
exports.init = require_sdk.init;
|
|
14
|
+
var _sentry_browser = require("@sentry/browser");
|
|
15
|
+
Object.prototype.hasOwnProperty.call(_sentry_browser, "__proto__") && !Object.prototype.hasOwnProperty.call(exports, "__proto__") && Object.defineProperty(exports, "__proto__", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
value: _sentry_browser["__proto__"]
|
|
18
|
+
});
|
|
19
|
+
Object.keys(_sentry_browser).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = _sentry_browser[k];
|
|
28
21
|
});
|
|
29
|
-
//# sourceMappingURL=index.client.js.map
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.
|
|
14
|
-
|
|
15
|
-
exports.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Object.
|
|
20
|
-
!Object.prototype.hasOwnProperty.call(exports,
|
|
21
|
-
Object.defineProperty(exports, '__proto__', {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
value: node['__proto__']
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
Object.keys(node).forEach(function (k) {
|
|
27
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = node[k];
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk = require("./server/sdk.js");
|
|
3
|
+
const require_index = require("./server/index.js");
|
|
4
|
+
const require_tracer = require("./server/tracer.js");
|
|
5
|
+
const require_tracer$1 = require("./tracer.js");
|
|
6
|
+
const require_logger = require("./logger.js");
|
|
7
|
+
const require_metrics = require("./metrics.js");
|
|
8
|
+
exports.SentryEffectExternalSpanLayer = require_tracer$1.SentryEffectExternalSpanLayer;
|
|
9
|
+
exports.SentryEffectLogger = require_logger.SentryEffectLogger;
|
|
10
|
+
exports.SentryEffectMetricsLayer = require_metrics.SentryEffectMetricsLayer;
|
|
11
|
+
exports.SentryEffectTracer = require_tracer.SentryEffectTracer;
|
|
12
|
+
exports.effectLayer = require_index.effectLayer;
|
|
13
|
+
exports.init = require_sdk.init;
|
|
14
|
+
var _sentry_node = require("@sentry/node");
|
|
15
|
+
Object.prototype.hasOwnProperty.call(_sentry_node, "__proto__") && !Object.prototype.hasOwnProperty.call(exports, "__proto__") && Object.defineProperty(exports, "__proto__", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
value: _sentry_node["__proto__"]
|
|
18
|
+
});
|
|
19
|
+
Object.keys(_sentry_node).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = _sentry_node[k];
|
|
28
21
|
});
|
|
29
|
-
//# sourceMappingURL=index.server.js.map
|
package/build/cjs/logger.js
CHANGED
|
@@ -1,55 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const LOG_ATTRIBUTES = {
|
|
8
|
-
[attributes.SENTRY_ORIGIN]: "auto.log.effect"
|
|
9
|
-
};
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
2
|
+
let _sentry_core = require("@sentry/core");
|
|
3
|
+
let _sentry_conventions_attributes = require("@sentry/conventions/attributes");
|
|
4
|
+
let effect_Logger = require("effect/Logger");
|
|
5
|
+
effect_Logger = require_runtime.__toESM(effect_Logger);
|
|
6
|
+
// src/logger.ts
|
|
7
|
+
const LOG_ATTRIBUTES = { [_sentry_conventions_attributes.SENTRY_ORIGIN]: "auto.log.effect" };
|
|
10
8
|
function getLogLevelTag(logLevel) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (core.isObjectLike(logLevel) && "_tag" in logLevel) {
|
|
15
|
-
return logLevel._tag;
|
|
16
|
-
}
|
|
17
|
-
return "Info";
|
|
9
|
+
if (typeof logLevel === "string") return logLevel;
|
|
10
|
+
if ((0, _sentry_core.isObjectLike)(logLevel) && "_tag" in logLevel) return logLevel._tag;
|
|
11
|
+
return "Info";
|
|
18
12
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
case "Trace":
|
|
49
|
-
core.logger.trace(msg, LOG_ATTRIBUTES);
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
13
|
+
/**
|
|
14
|
+
* Effect Logger that sends logs to Sentry.
|
|
15
|
+
*/
|
|
16
|
+
const SentryEffectLogger = effect_Logger.make(({ logLevel, message }) => {
|
|
17
|
+
let msg;
|
|
18
|
+
if (typeof message === "string") msg = message;
|
|
19
|
+
else if (Array.isArray(message) && message.length === 1) {
|
|
20
|
+
const firstElement = message[0];
|
|
21
|
+
msg = typeof firstElement === "string" ? firstElement : JSON.stringify(firstElement);
|
|
22
|
+
} else msg = JSON.stringify(message);
|
|
23
|
+
switch (getLogLevelTag(logLevel)) {
|
|
24
|
+
case "Fatal":
|
|
25
|
+
_sentry_core.logger.fatal(msg, LOG_ATTRIBUTES);
|
|
26
|
+
break;
|
|
27
|
+
case "Error":
|
|
28
|
+
_sentry_core.logger.error(msg, LOG_ATTRIBUTES);
|
|
29
|
+
break;
|
|
30
|
+
case "Warning":
|
|
31
|
+
case "Warn":
|
|
32
|
+
_sentry_core.logger.warn(msg, LOG_ATTRIBUTES);
|
|
33
|
+
break;
|
|
34
|
+
case "Info":
|
|
35
|
+
_sentry_core.logger.info(msg, LOG_ATTRIBUTES);
|
|
36
|
+
break;
|
|
37
|
+
case "Debug":
|
|
38
|
+
_sentry_core.logger.debug(msg, LOG_ATTRIBUTES);
|
|
39
|
+
break;
|
|
40
|
+
case "Trace": _sentry_core.logger.trace(msg, LOG_ATTRIBUTES);
|
|
41
|
+
}
|
|
52
42
|
});
|
|
53
|
-
|
|
54
43
|
exports.SentryEffectLogger = SentryEffectLogger;
|
|
55
|
-
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=logger.js.map
|
package/build/cjs/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sources":["../../src/logger.ts"],"sourcesContent":["import { SENTRY_ORIGIN } from '@sentry/conventions/attributes';\nimport { isObjectLike, logger as sentryLogger } from '@sentry/core';\nimport * as Logger from 'effect/Logger';\nimport type * as LogLevel from 'effect/LogLevel';\n\nconst LOG_ATTRIBUTES = {\n [SENTRY_ORIGIN]: 'auto.log.effect',\n};\n\nfunction getLogLevelTag(logLevel: LogLevel.LogLevel): LogLevel.LogLevel | 'Warning' {\n // Effect v4: logLevel is a string literal directly\n if (typeof logLevel === 'string') {\n return logLevel;\n }\n\n // Effect v3: logLevel has _tag property\n if (isObjectLike(logLevel) && '_tag' in logLevel) {\n return (logLevel as { _tag: LogLevel.LogLevel })._tag;\n }\n\n return 'Info';\n}\n\n/**\n * Effect Logger that sends logs to Sentry.\n */\nexport const SentryEffectLogger = Logger.make(({ logLevel, message }) => {\n let msg: string;\n if (typeof message === 'string') {\n msg = message;\n } else if (Array.isArray(message) && message.length === 1) {\n const firstElement = message[0];\n msg = typeof firstElement === 'string' ? firstElement : JSON.stringify(firstElement);\n } else {\n msg = JSON.stringify(message);\n }\n\n const tag = getLogLevelTag(logLevel);\n\n switch (tag) {\n case 'Fatal':\n sentryLogger.fatal(msg, LOG_ATTRIBUTES);\n break;\n case 'Error':\n sentryLogger.error(msg, LOG_ATTRIBUTES);\n break;\n case 'Warning': // Effect v3\n case 'Warn': // Effect v4\n sentryLogger.warn(msg, LOG_ATTRIBUTES);\n break;\n case 'Info':\n sentryLogger.info(msg, LOG_ATTRIBUTES);\n break;\n case 'Debug':\n sentryLogger.debug(msg, LOG_ATTRIBUTES);\n break;\n case 'Trace':\n sentryLogger.trace(msg, LOG_ATTRIBUTES);\n break;\n case 'All':\n case 'None':\n break;\n default:\n tag satisfies never;\n }\n});\n"],"
|
|
1
|
+
{"version":3,"file":"logger.js","names":["SENTRY_ORIGIN","isObjectLike","Logger","sentryLogger"],"sources":["../../src/logger.ts"],"sourcesContent":["import { SENTRY_ORIGIN } from '@sentry/conventions/attributes';\nimport { isObjectLike, logger as sentryLogger } from '@sentry/core';\nimport * as Logger from 'effect/Logger';\nimport type * as LogLevel from 'effect/LogLevel';\n\nconst LOG_ATTRIBUTES = {\n [SENTRY_ORIGIN]: 'auto.log.effect',\n};\n\nfunction getLogLevelTag(logLevel: LogLevel.LogLevel): LogLevel.LogLevel | 'Warning' {\n // Effect v4: logLevel is a string literal directly\n if (typeof logLevel === 'string') {\n return logLevel;\n }\n\n // Effect v3: logLevel has _tag property\n if (isObjectLike(logLevel) && '_tag' in logLevel) {\n return (logLevel as { _tag: LogLevel.LogLevel })._tag;\n }\n\n return 'Info';\n}\n\n/**\n * Effect Logger that sends logs to Sentry.\n */\nexport const SentryEffectLogger = Logger.make(({ logLevel, message }) => {\n let msg: string;\n if (typeof message === 'string') {\n msg = message;\n } else if (Array.isArray(message) && message.length === 1) {\n const firstElement = message[0];\n msg = typeof firstElement === 'string' ? firstElement : JSON.stringify(firstElement);\n } else {\n msg = JSON.stringify(message);\n }\n\n const tag = getLogLevelTag(logLevel);\n\n switch (tag) {\n case 'Fatal':\n sentryLogger.fatal(msg, LOG_ATTRIBUTES);\n break;\n case 'Error':\n sentryLogger.error(msg, LOG_ATTRIBUTES);\n break;\n case 'Warning': // Effect v3\n case 'Warn': // Effect v4\n sentryLogger.warn(msg, LOG_ATTRIBUTES);\n break;\n case 'Info':\n sentryLogger.info(msg, LOG_ATTRIBUTES);\n break;\n case 'Debug':\n sentryLogger.debug(msg, LOG_ATTRIBUTES);\n break;\n case 'Trace':\n sentryLogger.trace(msg, LOG_ATTRIBUTES);\n break;\n case 'All':\n case 'None':\n break;\n default:\n tag satisfies never;\n }\n});\n"],"mappings":";;;;;;AAKA,MAAM,iBAAiB,GACpBA,+BAAAA,gBAAgB,kBACnB;AAEA,SAAS,eAAe,UAA4D;CAElF,IAAI,OAAO,aAAa,UACtB,OAAO;CAIT,KAAA,GAAIC,aAAAA,aAAAA,CAAa,QAAQ,KAAK,UAAU,UACtC,OAAQ,SAAyC;CAGnD,OAAO;AACT;;;;AAKA,MAAa,qBAAqBC,cAAO,MAAM,EAAE,UAAU,cAAc;CACvE,IAAI;CACJ,IAAI,OAAO,YAAY,UACrB,MAAM;MACD,IAAI,MAAM,QAAQ,OAAO,KAAK,QAAQ,WAAW,GAAG;EACzD,MAAM,eAAe,QAAQ;EAC7B,MAAM,OAAO,iBAAiB,WAAW,eAAe,KAAK,UAAU,YAAY;CACrF,OACE,MAAM,KAAK,UAAU,OAAO;CAK9B,QAFY,eAAe,QAEjB,GAAV;EACE,KAAK;GACHC,aAAAA,OAAa,MAAM,KAAK,cAAc;GACtC;EACF,KAAK;GACHA,aAAAA,OAAa,MAAM,KAAK,cAAc;GACtC;EACF,KAAK;EACL,KAAK;GACHA,aAAAA,OAAa,KAAK,KAAK,cAAc;GACrC;EACF,KAAK;GACHA,aAAAA,OAAa,KAAK,KAAK,cAAc;GACrC;EACF,KAAK;GACHA,aAAAA,OAAa,MAAM,KAAK,cAAc;GACtC;EACF,KAAK,SACHA,aAAAA,OAAa,MAAM,KAAK,cAAc;CAO1C;AACF,CAAC"}
|