@glasstrace/sdk 1.16.0 → 1.18.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 +44 -3
- package/dist/async-context/index.cjs.map +1 -1
- package/dist/async-context/index.js +2 -2
- package/dist/{capture-error-B0txjNut.d.cts → capture-error-B8qiXFeC.d.cts} +2 -2
- package/dist/{capture-error-Dc01rYNR.d.ts → capture-error-BTI6mCH2.d.ts} +2 -2
- package/dist/{chunk-WOYJAG7H.js → chunk-BJOZBAP7.js} +3 -3
- package/dist/{chunk-AFTCLH77.js → chunk-CN5EP25B.js} +2 -2
- package/dist/{chunk-KM4UNN3Q.js → chunk-EVX6D2TX.js} +2 -2
- package/dist/{chunk-BGJKEFBN.js → chunk-M3QGJUEI.js} +2 -2
- package/dist/{chunk-GBVMPMVV.js → chunk-MKT54VEH.js} +2 -2
- package/dist/{chunk-GBVMPMVV.js.map → chunk-MKT54VEH.js.map} +1 -1
- package/dist/{chunk-OHSX224U.js → chunk-O7IJP2TQ.js} +2 -2
- package/dist/{chunk-T7B752NF.js → chunk-SONZOTBP.js} +11 -3
- package/dist/{chunk-T7B752NF.js.map → chunk-SONZOTBP.js.map} +1 -1
- package/dist/{chunk-774XIOZG.js → chunk-UOAG72NR.js} +2 -2
- package/dist/{chunk-DW3CZDS6.js → chunk-YKE6HJLW.js} +2 -2
- package/dist/{chunk-EWW3TZ52.js → chunk-Z2DSC3YI.js} +61 -11
- package/dist/{chunk-EWW3TZ52.js.map → chunk-Z2DSC3YI.js.map} +1 -1
- package/dist/cli/init.cjs +4 -4
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.js +7 -7
- package/dist/cli/mcp-add.cjs +1 -1
- package/dist/cli/mcp-add.cjs.map +1 -1
- package/dist/cli/mcp-add.js +3 -3
- package/dist/cli/uninit.js +3 -3
- package/dist/cli/upgrade-instructions.cjs +1 -1
- package/dist/cli/upgrade-instructions.js +3 -3
- package/dist/cli/validate.cjs.map +1 -1
- package/dist/cli/validate.js +2 -2
- package/dist/{correlation-id-CelUvw7j.d.cts → correlation-id-CClOq8Wn.d.cts} +1 -1
- package/dist/{correlation-id-B9YYmoZw.d.ts → correlation-id-Ct86Ug4s.d.ts} +1 -1
- package/dist/edge-entry.cjs.map +1 -1
- package/dist/edge-entry.d.cts +2 -2
- package/dist/edge-entry.d.ts +2 -2
- package/dist/edge-entry.js +4 -4
- package/dist/{import-graph-Dka_Fm7j.d.ts → import-graph-DZjTJdJ5.d.ts} +1 -1
- package/dist/{import-graph-DBLGNjcI.d.cts → import-graph-DyQfZU2f.d.cts} +1 -1
- package/dist/index.cjs +202 -7
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-3-cJoY8y.d.cts → index.d-DhatN7mq.d.cts} +1 -1
- package/dist/{index.d-3-cJoY8y.d.ts → index.d-DhatN7mq.d.ts} +1 -1
- package/dist/index.d.cts +243 -5
- package/dist/index.d.ts +243 -5
- package/dist/index.js +151 -6
- package/dist/index.js.map +1 -1
- package/dist/middleware/index.cjs.map +1 -1
- package/dist/middleware/index.js +2 -2
- package/dist/node-entry.cjs +5 -5
- package/dist/node-entry.cjs.map +1 -1
- package/dist/node-entry.d.cts +4 -4
- package/dist/node-entry.d.ts +4 -4
- package/dist/node-entry.js +7 -7
- package/dist/node-subpath.cjs.map +1 -1
- package/dist/node-subpath.d.cts +2 -2
- package/dist/node-subpath.d.ts +2 -2
- package/dist/node-subpath.js +3 -3
- package/dist/{source-map-uploader-UJPZCUFN.js → source-map-uploader-U7SLSKIZ.js} +3 -3
- package/dist/trpc/index.cjs.map +1 -1
- package/dist/trpc/index.js +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-WOYJAG7H.js.map → chunk-BJOZBAP7.js.map} +0 -0
- /package/dist/{chunk-AFTCLH77.js.map → chunk-CN5EP25B.js.map} +0 -0
- /package/dist/{chunk-KM4UNN3Q.js.map → chunk-EVX6D2TX.js.map} +0 -0
- /package/dist/{chunk-BGJKEFBN.js.map → chunk-M3QGJUEI.js.map} +0 -0
- /package/dist/{chunk-OHSX224U.js.map → chunk-O7IJP2TQ.js.map} +0 -0
- /package/dist/{chunk-774XIOZG.js.map → chunk-UOAG72NR.js.map} +0 -0
- /package/dist/{chunk-DW3CZDS6.js.map → chunk-YKE6HJLW.js.map} +0 -0
- /package/dist/{source-map-uploader-UJPZCUFN.js.map → source-map-uploader-U7SLSKIZ.js.map} +0 -0
package/dist/edge-entry.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { C as CorrelationIdRequest, G as GlasstraceSpanProcessor, S as SdkError, c as captureCorrelationId } from './correlation-id-
|
|
1
|
+
export { C as CorrelationIdRequest, G as GlasstraceSpanProcessor, S as SdkError, c as captureCorrelationId } from './correlation-id-CClOq8Wn.cjs';
|
|
2
2
|
export { RequestMiddlewareFunction, TracedRequestMiddlewareOptions, tracedRequestMiddleware } from './middleware/index.cjs';
|
|
3
3
|
export { WithAsyncCausalityOptions, withAsyncCausality } from './async-context/index.cjs';
|
|
4
|
-
import './index.d-
|
|
4
|
+
import './index.d-DhatN7mq.cjs';
|
|
5
5
|
import './v4/classic/external.cjs';
|
|
6
6
|
import './export/ReadableSpan';
|
|
7
7
|
import './Span';
|
package/dist/edge-entry.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { C as CorrelationIdRequest, G as GlasstraceSpanProcessor, S as SdkError, c as captureCorrelationId } from './correlation-id-
|
|
1
|
+
export { C as CorrelationIdRequest, G as GlasstraceSpanProcessor, S as SdkError, c as captureCorrelationId } from './correlation-id-Ct86Ug4s.js';
|
|
2
2
|
export { RequestMiddlewareFunction, TracedRequestMiddlewareOptions, tracedRequestMiddleware } from './middleware/index.js';
|
|
3
3
|
export { WithAsyncCausalityOptions, withAsyncCausality } from './async-context/index.js';
|
|
4
|
-
import './index.d-
|
|
4
|
+
import './index.d-DhatN7mq.js';
|
|
5
5
|
import './v4/classic/external.cjs';
|
|
6
6
|
import './export/ReadableSpan';
|
|
7
7
|
import './Span';
|
package/dist/edge-entry.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
tracedRequestMiddleware
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CN5EP25B.js";
|
|
4
4
|
import {
|
|
5
5
|
withAsyncCausality
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YKE6HJLW.js";
|
|
7
7
|
import {
|
|
8
8
|
GlasstraceSpanProcessor,
|
|
9
9
|
SdkError,
|
|
10
10
|
captureCorrelationId
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EVX6D2TX.js";
|
|
12
12
|
import "./chunk-CL3OVHPO.js";
|
|
13
13
|
import "./chunk-DQ25VOKK.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-MKT54VEH.js";
|
|
15
15
|
import "./chunk-NSBPE2FW.js";
|
|
16
16
|
export {
|
|
17
17
|
GlasstraceSpanProcessor,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as SourceMapUploadResponse, a as SourceMapManifestResponse, I as ImportGraphPayload } from './index.d-DhatN7mq.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* In-memory source map entry: a file path paired with its full text content.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as SourceMapUploadResponse, a as SourceMapManifestResponse, I as ImportGraphPayload } from './index.d-DhatN7mq.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* In-memory source map entry: a file path paired with its full text content.
|
package/dist/index.cjs
CHANGED
|
@@ -15808,7 +15808,7 @@ var init_dist = __esm({
|
|
|
15808
15808
|
"status",
|
|
15809
15809
|
"phase"
|
|
15810
15810
|
];
|
|
15811
|
-
SIDE_EFFECT_SEMANTIC_FIELD_OPEN_PATTERN = /^[a-z][A-Za-z0-9]*(Class|Count|Kind|Role)$/;
|
|
15811
|
+
SIDE_EFFECT_SEMANTIC_FIELD_OPEN_PATTERN = /^[a-z][A-Za-z0-9]*(Class|Count|Kind|Role|Holds)$/;
|
|
15812
15812
|
MAX_SIDE_EFFECT_SEMANTIC_FIELD_KEY_LENGTH = 80;
|
|
15813
15813
|
SIDE_EFFECT_OMISSION_REASONS = [
|
|
15814
15814
|
"pii",
|
|
@@ -17918,6 +17918,7 @@ __export(src_exports, {
|
|
|
17918
17918
|
GlasstraceSpanProcessor: () => GlasstraceSpanProcessor,
|
|
17919
17919
|
SdkError: () => SdkError,
|
|
17920
17920
|
SessionManager: () => SessionManager,
|
|
17921
|
+
capture: () => capture,
|
|
17921
17922
|
captureCorrelationId: () => captureCorrelationId,
|
|
17922
17923
|
captureError: () => captureError,
|
|
17923
17924
|
classifyFetchTarget: () => classifyFetchTarget,
|
|
@@ -17930,12 +17931,15 @@ __export(src_exports, {
|
|
|
17930
17931
|
getOrCreateAnonKey: () => getOrCreateAnonKey,
|
|
17931
17932
|
getOrigin: () => getOrigin,
|
|
17932
17933
|
getStatus: () => getStatus,
|
|
17934
|
+
invariant: () => invariant,
|
|
17933
17935
|
isAnonymousMode: () => isAnonymousMode,
|
|
17936
|
+
isNullInvariant: () => isNullInvariant,
|
|
17934
17937
|
isProductionDisabled: () => isProductionDisabled,
|
|
17935
17938
|
isReady: () => isReady,
|
|
17936
17939
|
isSideEffectSemanticFieldKey: () => isSideEffectSemanticFieldKey,
|
|
17937
17940
|
loadCachedConfig: () => loadCachedConfig,
|
|
17938
17941
|
performInit: () => performInit,
|
|
17942
|
+
prismaAdapter: () => prismaAdapter,
|
|
17939
17943
|
readAnonKey: () => readAnonKey,
|
|
17940
17944
|
readEnvVars: () => readEnvVars,
|
|
17941
17945
|
recordSideEffect: () => recordSideEffect,
|
|
@@ -19270,6 +19274,13 @@ function getActiveConfig() {
|
|
|
19270
19274
|
}
|
|
19271
19275
|
return { ...DEFAULT_CAPTURE_CONFIG };
|
|
19272
19276
|
}
|
|
19277
|
+
function isCaptureEnabled() {
|
|
19278
|
+
try {
|
|
19279
|
+
return getActiveConfig().sideEffectEvidence === true;
|
|
19280
|
+
} catch {
|
|
19281
|
+
return false;
|
|
19282
|
+
}
|
|
19283
|
+
}
|
|
19273
19284
|
function getLinkedAccountId() {
|
|
19274
19285
|
return currentConfig?.linkedAccountId;
|
|
19275
19286
|
}
|
|
@@ -24159,6 +24170,7 @@ var TOKEN_REGEX = /^[A-Za-z0-9][A-Za-z0-9_.:-]*$/;
|
|
|
24159
24170
|
var LOCALE_REGEX = /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8}){0,3}$/;
|
|
24160
24171
|
var TIMEZONE_REGEX = /^(?:UTC|GMT|[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+){1,3})$/;
|
|
24161
24172
|
var DIGIT_REGEX = /^[0-9]+$/;
|
|
24173
|
+
var BOOL_REGEX = /^(?:true|false)$/;
|
|
24162
24174
|
var URL_SCHEME = /:\/\//;
|
|
24163
24175
|
var URL_SCHEME_RELATIVE = /^\/\//;
|
|
24164
24176
|
var EMAIL_LIKE = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/i;
|
|
@@ -24193,6 +24205,9 @@ function passesFieldValidator(key, value) {
|
|
|
24193
24205
|
if (typeof key === "string" && key.endsWith("Count")) {
|
|
24194
24206
|
return DIGIT_REGEX.test(value);
|
|
24195
24207
|
}
|
|
24208
|
+
if (typeof key === "string" && key.endsWith("Holds")) {
|
|
24209
|
+
return BOOL_REGEX.test(value);
|
|
24210
|
+
}
|
|
24196
24211
|
return TOKEN_REGEX.test(value);
|
|
24197
24212
|
}
|
|
24198
24213
|
function checkOperationLabel(value) {
|
|
@@ -24301,7 +24316,7 @@ var spanState = /* @__PURE__ */ new WeakMap();
|
|
|
24301
24316
|
function getOrCreateState(span) {
|
|
24302
24317
|
let state = spanState.get(span);
|
|
24303
24318
|
if (!state) {
|
|
24304
|
-
state = { operationsRecorded: 0, omissions: /* @__PURE__ */ new Map() };
|
|
24319
|
+
state = { operationsRecorded: 0, omissions: /* @__PURE__ */ new Map(), scalarsRecorded: 0 };
|
|
24305
24320
|
spanState.set(span, state);
|
|
24306
24321
|
}
|
|
24307
24322
|
return state;
|
|
@@ -24414,6 +24429,14 @@ function attachScalar(span, key, value) {
|
|
|
24414
24429
|
} catch {
|
|
24415
24430
|
}
|
|
24416
24431
|
}
|
|
24432
|
+
function reserveScalarSlot(span) {
|
|
24433
|
+
const state = getOrCreateState(span);
|
|
24434
|
+
if (state.scalarsRecorded >= MAX_SIDE_EFFECT_SCALARS_PER_OPERATION) {
|
|
24435
|
+
return false;
|
|
24436
|
+
}
|
|
24437
|
+
state.scalarsRecorded += 1;
|
|
24438
|
+
return true;
|
|
24439
|
+
}
|
|
24417
24440
|
function recordOmission(span, reason) {
|
|
24418
24441
|
recordOmissionOnSpan(span, reason);
|
|
24419
24442
|
}
|
|
@@ -24524,6 +24547,7 @@ function runRecordSideEffect(input) {
|
|
|
24524
24547
|
recordOmission(outcome.span, "value_too_long");
|
|
24525
24548
|
return;
|
|
24526
24549
|
}
|
|
24550
|
+
const attachedFieldKeys = /* @__PURE__ */ new Set();
|
|
24527
24551
|
const fields = candidate.fields;
|
|
24528
24552
|
if (fields && typeof fields === "object") {
|
|
24529
24553
|
for (const [rawKey, rawValue] of Object.entries(fields)) {
|
|
@@ -24542,6 +24566,39 @@ function runRecordSideEffect(input) {
|
|
|
24542
24566
|
} catch {
|
|
24543
24567
|
}
|
|
24544
24568
|
attachField(outcome.span, rawKey, valueOutcome.value);
|
|
24569
|
+
attachedFieldKeys.add(rawKey);
|
|
24570
|
+
}
|
|
24571
|
+
}
|
|
24572
|
+
const relations = candidate.relations;
|
|
24573
|
+
if (relations && typeof relations === "object") {
|
|
24574
|
+
for (const [rawKey, rawValue] of Object.entries(relations)) {
|
|
24575
|
+
if (attachedFieldKeys.has(rawKey)) {
|
|
24576
|
+
recordOmission(outcome.span, "unsupported_key");
|
|
24577
|
+
continue;
|
|
24578
|
+
}
|
|
24579
|
+
if (!rawKey.endsWith("Holds") || !checkSemanticFieldKey(rawKey)) {
|
|
24580
|
+
recordOmission(outcome.span, "unsupported_key");
|
|
24581
|
+
continue;
|
|
24582
|
+
}
|
|
24583
|
+
if (typeof rawValue !== "boolean") {
|
|
24584
|
+
recordOmission(outcome.span, "raw_payload");
|
|
24585
|
+
continue;
|
|
24586
|
+
}
|
|
24587
|
+
const valueOutcome = checkSemanticFieldValue(
|
|
24588
|
+
rawKey,
|
|
24589
|
+
rawValue ? "true" : "false"
|
|
24590
|
+
);
|
|
24591
|
+
if (!valueOutcome.accepted) {
|
|
24592
|
+
recordOmission(outcome.span, valueOutcome.reason);
|
|
24593
|
+
continue;
|
|
24594
|
+
}
|
|
24595
|
+
try {
|
|
24596
|
+
maybeWarnMixedCasing(rawKey, valueOutcome.value);
|
|
24597
|
+
maybeWarnPatternKeyProliferation(rawKey);
|
|
24598
|
+
} catch {
|
|
24599
|
+
}
|
|
24600
|
+
attachField(outcome.span, rawKey, valueOutcome.value);
|
|
24601
|
+
attachedFieldKeys.add(rawKey);
|
|
24545
24602
|
}
|
|
24546
24603
|
}
|
|
24547
24604
|
const scalars = candidate.scalars;
|
|
@@ -24863,11 +24920,11 @@ function registerGlasstrace(options) {
|
|
|
24863
24920
|
setCoreState(CoreState.REGISTERING);
|
|
24864
24921
|
maybeWarnStaleAgentInstructions({
|
|
24865
24922
|
projectRoot: process.cwd(),
|
|
24866
|
-
sdkVersion: "1.
|
|
24923
|
+
sdkVersion: "1.18.0"
|
|
24867
24924
|
});
|
|
24868
24925
|
startRuntimeStateWriter({
|
|
24869
24926
|
projectRoot: process.cwd(),
|
|
24870
|
-
sdkVersion: "1.
|
|
24927
|
+
sdkVersion: "1.18.0"
|
|
24871
24928
|
});
|
|
24872
24929
|
const config2 = resolveConfig(options);
|
|
24873
24930
|
setSideEffectVerboseFlag(config2.verbose);
|
|
@@ -25035,8 +25092,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
25035
25092
|
if (config2.verbose) {
|
|
25036
25093
|
console.info("[glasstrace] Background init firing.");
|
|
25037
25094
|
}
|
|
25038
|
-
const healthReport = collectHealthReport("1.
|
|
25039
|
-
const initResult = await performInit(config2, anonKeyForInit, "1.
|
|
25095
|
+
const healthReport = collectHealthReport("1.18.0");
|
|
25096
|
+
const initResult = await performInit(config2, anonKeyForInit, "1.18.0", healthReport);
|
|
25040
25097
|
if (generation !== registrationGeneration) return;
|
|
25041
25098
|
const currentState = getCoreState();
|
|
25042
25099
|
if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
|
|
@@ -25059,7 +25116,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
25059
25116
|
}
|
|
25060
25117
|
maybeInstallConsoleCapture();
|
|
25061
25118
|
if (didLastInitSucceed()) {
|
|
25062
|
-
startHeartbeat(config2, anonKeyForInit, "1.
|
|
25119
|
+
startHeartbeat(config2, anonKeyForInit, "1.18.0", generation, (newApiKey, accountId) => {
|
|
25063
25120
|
setAuthState(AuthState.CLAIMING);
|
|
25064
25121
|
emitLifecycleEvent("auth:claim_started", { accountId });
|
|
25065
25122
|
setResolvedApiKey(newApiKey);
|
|
@@ -25352,6 +25409,140 @@ function firstToken(value) {
|
|
|
25352
25409
|
return void 0;
|
|
25353
25410
|
}
|
|
25354
25411
|
|
|
25412
|
+
// src/side-effect/capture.ts
|
|
25413
|
+
function capture(name, value, options) {
|
|
25414
|
+
try {
|
|
25415
|
+
runCapture(name, value, options);
|
|
25416
|
+
} catch {
|
|
25417
|
+
}
|
|
25418
|
+
}
|
|
25419
|
+
function runCapture(name, value, options) {
|
|
25420
|
+
const span = options?.span;
|
|
25421
|
+
if (!span) return;
|
|
25422
|
+
if (!isCaptureEnabled()) return;
|
|
25423
|
+
try {
|
|
25424
|
+
if (typeof span.isRecording === "function" && !span.isRecording()) {
|
|
25425
|
+
return;
|
|
25426
|
+
}
|
|
25427
|
+
} catch {
|
|
25428
|
+
return;
|
|
25429
|
+
}
|
|
25430
|
+
const outcome = checkScalarField(name, value);
|
|
25431
|
+
if (!outcome.accepted) {
|
|
25432
|
+
recordOmission(span, outcome.reason);
|
|
25433
|
+
return;
|
|
25434
|
+
}
|
|
25435
|
+
if (!reserveScalarSlot(span)) {
|
|
25436
|
+
recordOmission(span, "value_too_long");
|
|
25437
|
+
return;
|
|
25438
|
+
}
|
|
25439
|
+
attachScalar(span, name, outcome.value);
|
|
25440
|
+
}
|
|
25441
|
+
|
|
25442
|
+
// src/adapters/prisma.ts
|
|
25443
|
+
init_esm();
|
|
25444
|
+
var TRACER_NAME = "glasstrace-prisma";
|
|
25445
|
+
function hasRecordingActiveSpan() {
|
|
25446
|
+
try {
|
|
25447
|
+
const span = trace.getActiveSpan();
|
|
25448
|
+
if (span === void 0) return false;
|
|
25449
|
+
if (typeof span.isRecording === "function" && !span.isRecording()) {
|
|
25450
|
+
return false;
|
|
25451
|
+
}
|
|
25452
|
+
return true;
|
|
25453
|
+
} catch {
|
|
25454
|
+
return false;
|
|
25455
|
+
}
|
|
25456
|
+
}
|
|
25457
|
+
function openOwnedSpan(model, operation) {
|
|
25458
|
+
try {
|
|
25459
|
+
return trace.getTracer(TRACER_NAME).startSpan(`db.${model}.${operation}`, { kind: SpanKind.CLIENT });
|
|
25460
|
+
} catch {
|
|
25461
|
+
return void 0;
|
|
25462
|
+
}
|
|
25463
|
+
}
|
|
25464
|
+
function deriveFlagKey(column) {
|
|
25465
|
+
return column.endsWith("Flag") ? column : `${column}Flag`;
|
|
25466
|
+
}
|
|
25467
|
+
function projectAllowlisted(span, columns, result) {
|
|
25468
|
+
if (result === null || typeof result !== "object" || Array.isArray(result)) {
|
|
25469
|
+
return;
|
|
25470
|
+
}
|
|
25471
|
+
const row = result;
|
|
25472
|
+
for (const column of columns) {
|
|
25473
|
+
if (!(column in row)) continue;
|
|
25474
|
+
capture(deriveFlagKey(column), row[column], { span });
|
|
25475
|
+
}
|
|
25476
|
+
}
|
|
25477
|
+
function prismaAdapter(options = {}) {
|
|
25478
|
+
const policy = /* @__PURE__ */ new Map();
|
|
25479
|
+
for (const entry of options?.allow ?? []) {
|
|
25480
|
+
if (!entry || typeof entry.model !== "string" || typeof entry.column !== "string" || entry.model.length === 0 || entry.column.length === 0) {
|
|
25481
|
+
continue;
|
|
25482
|
+
}
|
|
25483
|
+
let columns = policy.get(entry.model);
|
|
25484
|
+
if (!columns) {
|
|
25485
|
+
columns = /* @__PURE__ */ new Set();
|
|
25486
|
+
policy.set(entry.model, columns);
|
|
25487
|
+
}
|
|
25488
|
+
columns.add(entry.column);
|
|
25489
|
+
}
|
|
25490
|
+
return {
|
|
25491
|
+
name: "glasstrace-capture",
|
|
25492
|
+
query: {
|
|
25493
|
+
$allModels: {
|
|
25494
|
+
async $allOperations(params) {
|
|
25495
|
+
const { model, operation, args, query } = params;
|
|
25496
|
+
const columns = model !== void 0 ? policy.get(model) : void 0;
|
|
25497
|
+
if (model === void 0 || columns === void 0 || operation === "findMany" || !isCaptureEnabled() || !hasRecordingActiveSpan()) {
|
|
25498
|
+
return query(args);
|
|
25499
|
+
}
|
|
25500
|
+
const span = openOwnedSpan(model, operation);
|
|
25501
|
+
if (span === void 0) {
|
|
25502
|
+
return query(args);
|
|
25503
|
+
}
|
|
25504
|
+
try {
|
|
25505
|
+
const result = await query(args);
|
|
25506
|
+
try {
|
|
25507
|
+
projectAllowlisted(span, columns, result);
|
|
25508
|
+
} catch {
|
|
25509
|
+
}
|
|
25510
|
+
return result;
|
|
25511
|
+
} finally {
|
|
25512
|
+
try {
|
|
25513
|
+
span.end();
|
|
25514
|
+
} catch {
|
|
25515
|
+
}
|
|
25516
|
+
}
|
|
25517
|
+
}
|
|
25518
|
+
}
|
|
25519
|
+
}
|
|
25520
|
+
};
|
|
25521
|
+
}
|
|
25522
|
+
|
|
25523
|
+
// src/side-effect/invariant.ts
|
|
25524
|
+
function invariant(left, op, right) {
|
|
25525
|
+
switch (op) {
|
|
25526
|
+
case "eq":
|
|
25527
|
+
return left === right;
|
|
25528
|
+
case "neq":
|
|
25529
|
+
return left !== right;
|
|
25530
|
+
case "lt":
|
|
25531
|
+
return left < right;
|
|
25532
|
+
case "lte":
|
|
25533
|
+
return left <= right;
|
|
25534
|
+
case "gt":
|
|
25535
|
+
return left > right;
|
|
25536
|
+
case "gte":
|
|
25537
|
+
return left >= right;
|
|
25538
|
+
}
|
|
25539
|
+
op;
|
|
25540
|
+
return false;
|
|
25541
|
+
}
|
|
25542
|
+
function isNullInvariant(value) {
|
|
25543
|
+
return value === null || value === void 0;
|
|
25544
|
+
}
|
|
25545
|
+
|
|
25355
25546
|
// src/index.ts
|
|
25356
25547
|
init_dist();
|
|
25357
25548
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -25360,6 +25551,7 @@ init_dist();
|
|
|
25360
25551
|
GlasstraceSpanProcessor,
|
|
25361
25552
|
SdkError,
|
|
25362
25553
|
SessionManager,
|
|
25554
|
+
capture,
|
|
25363
25555
|
captureCorrelationId,
|
|
25364
25556
|
captureError,
|
|
25365
25557
|
classifyFetchTarget,
|
|
@@ -25372,12 +25564,15 @@ init_dist();
|
|
|
25372
25564
|
getOrCreateAnonKey,
|
|
25373
25565
|
getOrigin,
|
|
25374
25566
|
getStatus,
|
|
25567
|
+
invariant,
|
|
25375
25568
|
isAnonymousMode,
|
|
25569
|
+
isNullInvariant,
|
|
25376
25570
|
isProductionDisabled,
|
|
25377
25571
|
isReady,
|
|
25378
25572
|
isSideEffectSemanticFieldKey,
|
|
25379
25573
|
loadCachedConfig,
|
|
25380
25574
|
performInit,
|
|
25575
|
+
prismaAdapter,
|
|
25381
25576
|
readAnonKey,
|
|
25382
25577
|
readEnvVars,
|
|
25383
25578
|
recordSideEffect,
|