@glasstrace/sdk 1.12.0 → 1.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/README.md +55 -20
- package/dist/async-context/index.cjs.map +1 -1
- package/dist/async-context/index.js +2 -2
- package/dist/{capture-error-CRQSqKgd.d.cts → capture-error-03qDnC5v.d.cts} +2 -2
- package/dist/{capture-error-CqCbjoMq.d.ts → capture-error-CAfFUyIU.d.ts} +2 -2
- package/dist/{chunk-6NKMAKMI.js → chunk-6ST4QV7T.js} +3 -3
- package/dist/{chunk-BN5DVIUO.js → chunk-7LE2O4ZJ.js} +12 -7
- package/dist/{chunk-BN5DVIUO.js.map → chunk-7LE2O4ZJ.js.map} +1 -1
- package/dist/{chunk-J3ZCVE67.js → chunk-F7A3QXCT.js} +2 -2
- package/dist/{chunk-M3ZTG4P5.js → chunk-HMEHYSTS.js} +2 -2
- package/dist/{chunk-4YRYR32D.js → chunk-LQZRGBN5.js} +2 -2
- package/dist/{chunk-ZIL2IY4C.js → chunk-MP3QNDXQ.js} +2 -2
- package/dist/{chunk-FFNGE5RR.js → chunk-VMK2G6QR.js} +2 -2
- package/dist/{chunk-CZQN6G4I.js → chunk-VWZMG3W2.js} +10 -10
- package/dist/{chunk-KBHGPQZ2.js → chunk-XMD5OYD6.js} +2 -2
- package/dist/{chunk-V75ZB4G4.js → chunk-ZIYT2Y4B.js} +3 -3
- 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-CFpyJsKv.d.cts → correlation-id-CZ2bstzA.d.cts} +1 -1
- package/dist/{correlation-id-DPXyY9-3.d.ts → correlation-id-YcfcqOru.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/index.cjs +32 -18
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-D-jdiIPU.d.cts → index.d-BQIJ5Dvc.d.cts} +44 -9
- package/dist/{index.d-D-jdiIPU.d.ts → index.d-BQIJ5Dvc.d.ts} +44 -9
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +19 -14
- 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 +3 -3
- package/dist/node-entry.d.ts +3 -3
- package/dist/node-entry.js +7 -7
- package/dist/node-subpath.cjs.map +1 -1
- package/dist/node-subpath.d.cts +1 -1
- package/dist/node-subpath.d.ts +1 -1
- package/dist/node-subpath.js +3 -3
- package/dist/{source-map-uploader-K67LTPBG.js → source-map-uploader-NUONOEJG.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-6NKMAKMI.js.map → chunk-6ST4QV7T.js.map} +0 -0
- /package/dist/{chunk-J3ZCVE67.js.map → chunk-F7A3QXCT.js.map} +0 -0
- /package/dist/{chunk-M3ZTG4P5.js.map → chunk-HMEHYSTS.js.map} +0 -0
- /package/dist/{chunk-4YRYR32D.js.map → chunk-LQZRGBN5.js.map} +0 -0
- /package/dist/{chunk-ZIL2IY4C.js.map → chunk-MP3QNDXQ.js.map} +0 -0
- /package/dist/{chunk-FFNGE5RR.js.map → chunk-VMK2G6QR.js.map} +0 -0
- /package/dist/{chunk-CZQN6G4I.js.map → chunk-VWZMG3W2.js.map} +0 -0
- /package/dist/{chunk-KBHGPQZ2.js.map → chunk-XMD5OYD6.js.map} +0 -0
- /package/dist/{chunk-V75ZB4G4.js.map → chunk-ZIYT2Y4B.js.map} +0 -0
- /package/dist/{source-map-uploader-K67LTPBG.js.map → source-map-uploader-NUONOEJG.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-CZ2bstzA.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-BQIJ5Dvc.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-YcfcqOru.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-BQIJ5Dvc.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-VMK2G6QR.js";
|
|
4
4
|
import {
|
|
5
5
|
withAsyncCausality
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LQZRGBN5.js";
|
|
7
7
|
import {
|
|
8
8
|
GlasstraceSpanProcessor,
|
|
9
9
|
SdkError,
|
|
10
10
|
captureCorrelationId
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-HMEHYSTS.js";
|
|
12
12
|
import "./chunk-CL3OVHPO.js";
|
|
13
13
|
import "./chunk-DQ25VOKK.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-7LE2O4ZJ.js";
|
|
15
15
|
import "./chunk-NSBPE2FW.js";
|
|
16
16
|
export {
|
|
17
17
|
GlasstraceSpanProcessor,
|
package/dist/index.cjs
CHANGED
|
@@ -15332,7 +15332,13 @@ function deriveSessionId(apiKey, origin, date5, windowIndex) {
|
|
|
15332
15332
|
const digest = sha256Hex(input).slice(0, 16);
|
|
15333
15333
|
return SessionIdSchema.parse(digest);
|
|
15334
15334
|
}
|
|
15335
|
-
|
|
15335
|
+
function isSideEffectSemanticFieldKey(key) {
|
|
15336
|
+
if (key.length > MAX_SIDE_EFFECT_SEMANTIC_FIELD_KEY_LENGTH) return false;
|
|
15337
|
+
return SIDE_EFFECT_SEMANTIC_FIELD_STABLE_CORE_KEYS.includes(
|
|
15338
|
+
key
|
|
15339
|
+
) || SIDE_EFFECT_SEMANTIC_FIELD_OPEN_PATTERN.test(key);
|
|
15340
|
+
}
|
|
15341
|
+
var DevApiKeySchema, AnonApiKeySchema, SessionIdSchema, BuildHashSchema, SdkDiagnosticCodeSchema, CaptureConfigSchema, SdkCachedConfigSchema, GlasstraceOptionsSchema, GlasstraceEnvVarsSchema, GLASSTRACE_ATTRIBUTE_NAMES, DEFAULT_CAPTURE_CONFIG, MAX_SOURCE_MAP_FILE_PATH_LENGTH, MAX_SOURCE_MAP_FILE_SIZE, MAX_SOURCE_MAP_FILE_COUNT, MAX_PRESIGNED_CLIENT_TOKEN_LENGTH, MAX_PRESIGNED_PATHNAME_LENGTH, ImportGraphPayloadSchema, SdkHealthReportSchema, TierLimitsSchema, SdkInitResponseSchema, DiscoveryResponseSchema, SourceMapUploadResponseSchema, PresignedUploadRequestSchema, PresignedUploadResponseSchema, SourceMapManifestRequestSchema, SourceMapManifestResponseSchema, K, SIDE_EFFECT_OPERATION_KINDS, SIDE_EFFECT_SEMANTIC_FIELD_STABLE_CORE_KEYS, SIDE_EFFECT_SEMANTIC_FIELD_OPEN_PATTERN, MAX_SIDE_EFFECT_SEMANTIC_FIELD_KEY_LENGTH, SIDE_EFFECT_OMISSION_REASONS, SIDE_EFFECT_OPERATION_STATUSES, SIDE_EFFECT_OPERATION_PHASES;
|
|
15336
15342
|
var init_dist = __esm({
|
|
15337
15343
|
"../protocol/dist/index.js"() {
|
|
15338
15344
|
"use strict";
|
|
@@ -15769,18 +15775,17 @@ var init_dist = __esm({
|
|
|
15769
15775
|
"queue",
|
|
15770
15776
|
"after_callback"
|
|
15771
15777
|
];
|
|
15772
|
-
|
|
15778
|
+
SIDE_EFFECT_SEMANTIC_FIELD_STABLE_CORE_KEYS = [
|
|
15773
15779
|
"templateKey",
|
|
15774
15780
|
"providerOperation",
|
|
15775
15781
|
"role",
|
|
15776
15782
|
"locale",
|
|
15777
15783
|
"timezone",
|
|
15778
15784
|
"status",
|
|
15779
|
-
"phase"
|
|
15780
|
-
"recipientClass",
|
|
15781
|
-
"participantCount",
|
|
15782
|
-
"activeParticipantCount"
|
|
15785
|
+
"phase"
|
|
15783
15786
|
];
|
|
15787
|
+
SIDE_EFFECT_SEMANTIC_FIELD_OPEN_PATTERN = /^[a-z][A-Za-z0-9]*(Class|Count|Kind|Role)$/;
|
|
15788
|
+
MAX_SIDE_EFFECT_SEMANTIC_FIELD_KEY_LENGTH = 80;
|
|
15784
15789
|
SIDE_EFFECT_OMISSION_REASONS = [
|
|
15785
15790
|
"pii",
|
|
15786
15791
|
"secret",
|
|
@@ -17884,6 +17889,7 @@ __export(src_exports, {
|
|
|
17884
17889
|
isAnonymousMode: () => isAnonymousMode,
|
|
17885
17890
|
isProductionDisabled: () => isProductionDisabled,
|
|
17886
17891
|
isReady: () => isReady,
|
|
17892
|
+
isSideEffectSemanticFieldKey: () => isSideEffectSemanticFieldKey,
|
|
17887
17893
|
loadCachedConfig: () => loadCachedConfig,
|
|
17888
17894
|
performInit: () => performInit,
|
|
17889
17895
|
readAnonKey: () => readAnonKey,
|
|
@@ -24357,11 +24363,11 @@ function registerGlasstrace(options) {
|
|
|
24357
24363
|
setCoreState(CoreState.REGISTERING);
|
|
24358
24364
|
maybeWarnStaleAgentInstructions({
|
|
24359
24365
|
projectRoot: process.cwd(),
|
|
24360
|
-
sdkVersion: "1.
|
|
24366
|
+
sdkVersion: "1.13.0"
|
|
24361
24367
|
});
|
|
24362
24368
|
startRuntimeStateWriter({
|
|
24363
24369
|
projectRoot: process.cwd(),
|
|
24364
|
-
sdkVersion: "1.
|
|
24370
|
+
sdkVersion: "1.13.0"
|
|
24365
24371
|
});
|
|
24366
24372
|
const config2 = resolveConfig(options);
|
|
24367
24373
|
if (config2.verbose) {
|
|
@@ -24528,8 +24534,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
24528
24534
|
if (config2.verbose) {
|
|
24529
24535
|
console.info("[glasstrace] Background init firing.");
|
|
24530
24536
|
}
|
|
24531
|
-
const healthReport = collectHealthReport("1.
|
|
24532
|
-
const initResult = await performInit(config2, anonKeyForInit, "1.
|
|
24537
|
+
const healthReport = collectHealthReport("1.13.0");
|
|
24538
|
+
const initResult = await performInit(config2, anonKeyForInit, "1.13.0", healthReport);
|
|
24533
24539
|
if (generation !== registrationGeneration) return;
|
|
24534
24540
|
const currentState = getCoreState();
|
|
24535
24541
|
if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
|
|
@@ -24552,7 +24558,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
24552
24558
|
}
|
|
24553
24559
|
maybeInstallConsoleCapture();
|
|
24554
24560
|
if (didLastInitSucceed()) {
|
|
24555
|
-
startHeartbeat(config2, anonKeyForInit, "1.
|
|
24561
|
+
startHeartbeat(config2, anonKeyForInit, "1.13.0", generation, (newApiKey, accountId) => {
|
|
24556
24562
|
setAuthState(AuthState.CLAIMING);
|
|
24557
24563
|
emitLifecycleEvent("auth:claim_started", { accountId });
|
|
24558
24564
|
setResolvedApiKey(newApiKey);
|
|
@@ -24849,13 +24855,11 @@ function firstToken(value) {
|
|
|
24849
24855
|
init_dist();
|
|
24850
24856
|
var MAX_SIDE_EFFECT_OPERATION_LABEL_LENGTH = 96;
|
|
24851
24857
|
var MAX_SIDE_EFFECT_FIELD_VALUE_LENGTH = 80;
|
|
24858
|
+
var MAX_SIDE_EFFECT_FIELD_COUNT_VALUE_LENGTH = 16;
|
|
24852
24859
|
var MAX_SIDE_EFFECT_OPERATIONS_PER_SPAN = 5;
|
|
24853
24860
|
var OPERATION_KIND_SET = new Set(
|
|
24854
24861
|
SIDE_EFFECT_OPERATION_KINDS
|
|
24855
24862
|
);
|
|
24856
|
-
var SEMANTIC_FIELD_KEY_SET = new Set(
|
|
24857
|
-
SIDE_EFFECT_SEMANTIC_FIELD_KEYS
|
|
24858
|
-
);
|
|
24859
24863
|
var OPERATION_STATUS_SET = new Set(
|
|
24860
24864
|
SIDE_EFFECT_OPERATION_STATUSES
|
|
24861
24865
|
);
|
|
@@ -24900,7 +24904,7 @@ function detectUnsafePattern(value) {
|
|
|
24900
24904
|
function passesFieldValidator(key, value) {
|
|
24901
24905
|
if (key === "locale") return LOCALE_REGEX.test(value);
|
|
24902
24906
|
if (key === "timezone") return TIMEZONE_REGEX.test(value);
|
|
24903
|
-
if (key === "
|
|
24907
|
+
if (typeof key === "string" && key.endsWith("Count")) {
|
|
24904
24908
|
return DIGIT_REGEX.test(value);
|
|
24905
24909
|
}
|
|
24906
24910
|
return TOKEN_REGEX.test(value);
|
|
@@ -24925,7 +24929,8 @@ function checkSemanticFieldValue(key, value) {
|
|
|
24925
24929
|
if (typeof value !== "string" || value.length === 0) {
|
|
24926
24930
|
return { accepted: false, reason: "raw_payload" };
|
|
24927
24931
|
}
|
|
24928
|
-
|
|
24932
|
+
const maxLength = typeof key === "string" && key.endsWith("Count") ? MAX_SIDE_EFFECT_FIELD_COUNT_VALUE_LENGTH : MAX_SIDE_EFFECT_FIELD_VALUE_LENGTH;
|
|
24933
|
+
if (value.length > maxLength) {
|
|
24929
24934
|
return { accepted: false, reason: "value_too_long" };
|
|
24930
24935
|
}
|
|
24931
24936
|
const unsafe = detectUnsafePattern(value);
|
|
@@ -24938,7 +24943,7 @@ function checkSemanticFieldValue(key, value) {
|
|
|
24938
24943
|
return { accepted: true, value };
|
|
24939
24944
|
}
|
|
24940
24945
|
function checkSemanticFieldKey(key) {
|
|
24941
|
-
return typeof key === "string" &&
|
|
24946
|
+
return typeof key === "string" && isSideEffectSemanticFieldKey(key);
|
|
24942
24947
|
}
|
|
24943
24948
|
function checkOperationKind(kind) {
|
|
24944
24949
|
return typeof kind === "string" && OPERATION_KIND_SET.has(kind);
|
|
@@ -25016,6 +25021,11 @@ var FIELD_ATTRIBUTE_BY_KEY = {
|
|
|
25016
25021
|
participantCount: GLASSTRACE_ATTRIBUTE_NAMES.SIDE_EFFECT_FIELD_PARTICIPANT_COUNT,
|
|
25017
25022
|
activeParticipantCount: GLASSTRACE_ATTRIBUTE_NAMES.SIDE_EFFECT_FIELD_ACTIVE_PARTICIPANT_COUNT
|
|
25018
25023
|
};
|
|
25024
|
+
function resolveFieldAttribute(key) {
|
|
25025
|
+
const explicit = FIELD_ATTRIBUTE_BY_KEY[key];
|
|
25026
|
+
if (explicit !== void 0) return explicit;
|
|
25027
|
+
return `glasstrace.side_effect.field.${key}`;
|
|
25028
|
+
}
|
|
25019
25029
|
function attachOperation(input) {
|
|
25020
25030
|
const span = getRecordingActiveSpan();
|
|
25021
25031
|
if (!span) return { kind: "no_active_span" };
|
|
@@ -25047,7 +25057,7 @@ function attachOperation(input) {
|
|
|
25047
25057
|
return { kind: "attached", span };
|
|
25048
25058
|
}
|
|
25049
25059
|
function attachField(span, key, value) {
|
|
25050
|
-
const attribute =
|
|
25060
|
+
const attribute = resolveFieldAttribute(key);
|
|
25051
25061
|
try {
|
|
25052
25062
|
span.setAttribute(attribute, value);
|
|
25053
25063
|
} catch {
|
|
@@ -25129,6 +25139,9 @@ function runRecordSideEffect(input) {
|
|
|
25129
25139
|
}
|
|
25130
25140
|
}
|
|
25131
25141
|
}
|
|
25142
|
+
|
|
25143
|
+
// src/index.ts
|
|
25144
|
+
init_dist();
|
|
25132
25145
|
// Annotate the CommonJS export names for ESM import in node:
|
|
25133
25146
|
0 && (module.exports = {
|
|
25134
25147
|
GlasstraceExporter,
|
|
@@ -25150,6 +25163,7 @@ function runRecordSideEffect(input) {
|
|
|
25150
25163
|
isAnonymousMode,
|
|
25151
25164
|
isProductionDisabled,
|
|
25152
25165
|
isReady,
|
|
25166
|
+
isSideEffectSemanticFieldKey,
|
|
25153
25167
|
loadCachedConfig,
|
|
25154
25168
|
performInit,
|
|
25155
25169
|
readAnonKey,
|