@glasstrace/sdk 1.1.3 → 1.2.1
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 +54 -1
- package/dist/{chunk-6RNBUUBR.js → chunk-2GCN27SI.js} +2 -2
- package/dist/{chunk-4EZ6JTDG.js → chunk-47B2G3FE.js} +2 -2
- package/dist/{chunk-FGDS33I2.js → chunk-CTJO7PUZ.js} +71 -17
- package/dist/chunk-CTJO7PUZ.js.map +1 -0
- package/dist/{chunk-X5MAXP5T.js → chunk-EBYISKQP.js} +5 -3
- package/dist/{chunk-X5MAXP5T.js.map → chunk-EBYISKQP.js.map} +1 -1
- package/dist/{chunk-JKI4OCFV.js → chunk-HV5ID2WJ.js} +3 -3
- package/dist/{chunk-TWTWRJ25.js → chunk-MD5XPCTQ.js} +2 -2
- package/dist/{chunk-TWHCJKRS.js → chunk-NFPDYME5.js} +3 -3
- package/dist/{chunk-DST4UBXU.js → chunk-YMLMZCPR.js} +2 -2
- package/dist/cli/init.cjs +5 -3
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.js +6 -6
- package/dist/cli/mcp-add.cjs +4 -2
- package/dist/cli/mcp-add.cjs.map +1 -1
- package/dist/cli/mcp-add.js +2 -2
- package/dist/cli/uninit.js +3 -3
- package/dist/cli/validate.cjs +4 -2
- package/dist/cli/validate.cjs.map +1 -1
- package/dist/cli/validate.js +2 -2
- package/dist/edge-entry.cjs +4 -2
- package/dist/edge-entry.cjs.map +1 -1
- package/dist/edge-entry.js +2 -2
- package/dist/index.cjs +70 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/node-entry.cjs +70 -14
- package/dist/node-entry.cjs.map +1 -1
- package/dist/node-entry.js +7 -7
- package/dist/node-subpath.cjs +4 -2
- package/dist/node-subpath.cjs.map +1 -1
- package/dist/node-subpath.js +3 -3
- package/dist/{source-map-uploader-DPUUCLNW.js → source-map-uploader-RA4Z7TWA.js} +3 -3
- package/dist/trpc/index.cjs +809 -0
- package/dist/trpc/index.cjs.map +1 -0
- package/dist/trpc/index.d.cts +165 -0
- package/dist/trpc/index.d.ts +165 -0
- package/dist/trpc/index.js +65 -0
- package/dist/trpc/index.js.map +1 -0
- package/package.json +12 -1
- package/dist/chunk-FGDS33I2.js.map +0 -1
- /package/dist/{chunk-6RNBUUBR.js.map → chunk-2GCN27SI.js.map} +0 -0
- /package/dist/{chunk-4EZ6JTDG.js.map → chunk-47B2G3FE.js.map} +0 -0
- /package/dist/{chunk-JKI4OCFV.js.map → chunk-HV5ID2WJ.js.map} +0 -0
- /package/dist/{chunk-TWTWRJ25.js.map → chunk-MD5XPCTQ.js.map} +0 -0
- /package/dist/{chunk-TWHCJKRS.js.map → chunk-NFPDYME5.js.map} +0 -0
- /package/dist/{chunk-DST4UBXU.js.map → chunk-YMLMZCPR.js.map} +0 -0
- /package/dist/{source-map-uploader-DPUUCLNW.js.map → source-map-uploader-RA4Z7TWA.js.map} +0 -0
package/dist/edge-entry.js
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
GlasstraceSpanProcessor,
|
|
3
3
|
SdkError,
|
|
4
4
|
captureCorrelationId
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-2GCN27SI.js";
|
|
6
6
|
import "./chunk-DQ25VOKK.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-EBYISKQP.js";
|
|
8
8
|
import "./chunk-NSBPE2FW.js";
|
|
9
9
|
export {
|
|
10
10
|
GlasstraceSpanProcessor,
|
package/dist/index.cjs
CHANGED
|
@@ -14667,13 +14667,15 @@ var init_dist = __esm({
|
|
|
14667
14667
|
});
|
|
14668
14668
|
PresignedUploadResponseSchema = external_exports.object({
|
|
14669
14669
|
uploadId: external_exports.string().uuid(),
|
|
14670
|
-
expiresAt: external_exports.number().int().
|
|
14670
|
+
expiresAt: external_exports.number().int().nonnegative(),
|
|
14671
14671
|
files: external_exports.array(
|
|
14672
14672
|
external_exports.object({
|
|
14673
14673
|
filePath: external_exports.string().min(1),
|
|
14674
14674
|
clientToken: external_exports.string().min(1),
|
|
14675
14675
|
pathname: external_exports.string().min(1),
|
|
14676
|
-
maxBytes: external_exports.number().int().positive()
|
|
14676
|
+
maxBytes: external_exports.number().int().positive(),
|
|
14677
|
+
/** Vercel Blob access mode — explicit in the contract per DISC-756. */
|
|
14678
|
+
access: external_exports.enum(["public"])
|
|
14677
14679
|
})
|
|
14678
14680
|
).min(1).max(100)
|
|
14679
14681
|
});
|
|
@@ -18224,16 +18226,22 @@ var ERROR_RESPONSE_BODY_TRUNCATION_MARKER = "...[truncated]";
|
|
|
18224
18226
|
var REDACTED = "[REDACTED]";
|
|
18225
18227
|
var ERROR_STATUS_MIN = 400;
|
|
18226
18228
|
var ERROR_STATUS_MAX = 599;
|
|
18227
|
-
function
|
|
18229
|
+
function coerceHttpStatus(value) {
|
|
18228
18230
|
let numeric;
|
|
18229
|
-
if (typeof
|
|
18230
|
-
numeric =
|
|
18231
|
-
} else if (typeof
|
|
18232
|
-
|
|
18231
|
+
if (typeof value === "number") {
|
|
18232
|
+
numeric = value;
|
|
18233
|
+
} else if (typeof value === "string") {
|
|
18234
|
+
const trimmed = value.trim();
|
|
18235
|
+
if (trimmed.length === 0) return void 0;
|
|
18236
|
+
numeric = Number(trimmed);
|
|
18233
18237
|
} else {
|
|
18234
|
-
return
|
|
18238
|
+
return void 0;
|
|
18235
18239
|
}
|
|
18236
|
-
|
|
18240
|
+
return Number.isFinite(numeric) ? numeric : void 0;
|
|
18241
|
+
}
|
|
18242
|
+
function isHttpErrorStatus(status) {
|
|
18243
|
+
const numeric = coerceHttpStatus(status);
|
|
18244
|
+
if (numeric === void 0) return false;
|
|
18237
18245
|
return numeric >= ERROR_STATUS_MIN && numeric <= ERROR_STATUS_MAX;
|
|
18238
18246
|
}
|
|
18239
18247
|
var REDACTION_PATTERNS = [
|
|
@@ -18493,7 +18501,7 @@ var GlasstraceExporter = class {
|
|
|
18493
18501
|
}
|
|
18494
18502
|
}
|
|
18495
18503
|
}
|
|
18496
|
-
const statusCode = attrs["http.status_code"] ?? attrs["http.response.status_code"];
|
|
18504
|
+
const statusCode = coerceHttpStatus(attrs["http.status_code"]) ?? coerceHttpStatus(attrs["http.response.status_code"]);
|
|
18497
18505
|
if (statusCode !== void 0) {
|
|
18498
18506
|
extra[ATTR.HTTP_STATUS_CODE] = statusCode;
|
|
18499
18507
|
}
|
|
@@ -22184,8 +22192,51 @@ async function runRegistrationPath(config2, sessionManager) {
|
|
|
22184
22192
|
// src/context-manager.ts
|
|
22185
22193
|
var import_node_async_hooks = require("node:async_hooks");
|
|
22186
22194
|
init_esm();
|
|
22195
|
+
var GLASSTRACE_BRAND = 1;
|
|
22196
|
+
var GUARD = /* @__PURE__ */ Symbol.for("glasstrace.context-manager.installed");
|
|
22197
|
+
var OTEL_API_KEY = /* @__PURE__ */ Symbol.for("opentelemetry.js.api.1");
|
|
22198
|
+
function isOtelContextManager(value) {
|
|
22199
|
+
if (typeof value !== "object" || value === null) return false;
|
|
22200
|
+
const candidate = value;
|
|
22201
|
+
return typeof candidate.active === "function" && typeof candidate.with === "function" && typeof candidate.bind === "function" && typeof candidate.enable === "function" && typeof candidate.disable === "function";
|
|
22202
|
+
}
|
|
22203
|
+
function isInstallationRecord(value) {
|
|
22204
|
+
if (typeof value !== "object" || value === null) return false;
|
|
22205
|
+
const candidate = value;
|
|
22206
|
+
if (candidate.glasstraceContextManagerBrand !== GLASSTRACE_BRAND) return false;
|
|
22207
|
+
return candidate.manager === null || isOtelContextManager(candidate.manager);
|
|
22208
|
+
}
|
|
22209
|
+
function getOtelRegisteredContextManager() {
|
|
22210
|
+
const otelSlot = globalThis[OTEL_API_KEY];
|
|
22211
|
+
if (typeof otelSlot !== "object" || otelSlot === null) return void 0;
|
|
22212
|
+
const ctx = otelSlot.context;
|
|
22213
|
+
return isOtelContextManager(ctx) ? ctx : void 0;
|
|
22214
|
+
}
|
|
22187
22215
|
function installContextManager() {
|
|
22188
22216
|
try {
|
|
22217
|
+
const slot = globalThis;
|
|
22218
|
+
const existing = slot[GUARD];
|
|
22219
|
+
const otelCurrent = getOtelRegisteredContextManager();
|
|
22220
|
+
if (isInstallationRecord(existing) && existing.manager !== null && existing.manager === otelCurrent) {
|
|
22221
|
+
return true;
|
|
22222
|
+
}
|
|
22223
|
+
if (isInstallationRecord(existing) && existing.manager === null && otelCurrent !== void 0) {
|
|
22224
|
+
return false;
|
|
22225
|
+
}
|
|
22226
|
+
if (isInstallationRecord(existing) && existing.manager !== null) {
|
|
22227
|
+
const reSuccess = context.setGlobalContextManager(existing.manager);
|
|
22228
|
+
if (!reSuccess) {
|
|
22229
|
+
console.warn(
|
|
22230
|
+
"[glasstrace] Another context manager is already registered. Trace context propagation may not work as expected."
|
|
22231
|
+
);
|
|
22232
|
+
}
|
|
22233
|
+
const reRecord = {
|
|
22234
|
+
glasstraceContextManagerBrand: GLASSTRACE_BRAND,
|
|
22235
|
+
manager: reSuccess ? existing.manager : null
|
|
22236
|
+
};
|
|
22237
|
+
slot[GUARD] = reRecord;
|
|
22238
|
+
return reSuccess;
|
|
22239
|
+
}
|
|
22189
22240
|
const als = new import_node_async_hooks.AsyncLocalStorage();
|
|
22190
22241
|
const contextManager = {
|
|
22191
22242
|
active: () => als.getStore() ?? ROOT_CONTEXT,
|
|
@@ -22206,6 +22257,11 @@ function installContextManager() {
|
|
|
22206
22257
|
"[glasstrace] Another context manager is already registered. Trace context propagation may not work as expected."
|
|
22207
22258
|
);
|
|
22208
22259
|
}
|
|
22260
|
+
const record2 = {
|
|
22261
|
+
glasstraceContextManagerBrand: GLASSTRACE_BRAND,
|
|
22262
|
+
manager: success2 ? contextManager : null
|
|
22263
|
+
};
|
|
22264
|
+
slot[GUARD] = record2;
|
|
22209
22265
|
return success2;
|
|
22210
22266
|
} catch {
|
|
22211
22267
|
return false;
|
|
@@ -22437,7 +22493,7 @@ function registerGlasstrace(options) {
|
|
|
22437
22493
|
setCoreState(CoreState.REGISTERING);
|
|
22438
22494
|
startRuntimeStateWriter({
|
|
22439
22495
|
projectRoot: process.cwd(),
|
|
22440
|
-
sdkVersion: "1.1
|
|
22496
|
+
sdkVersion: "1.2.1"
|
|
22441
22497
|
});
|
|
22442
22498
|
const config2 = resolveConfig(options);
|
|
22443
22499
|
if (config2.verbose) {
|
|
@@ -22603,8 +22659,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
22603
22659
|
if (config2.verbose) {
|
|
22604
22660
|
console.info("[glasstrace] Background init firing.");
|
|
22605
22661
|
}
|
|
22606
|
-
const healthReport = collectHealthReport("1.1
|
|
22607
|
-
const initResult = await performInit(config2, anonKeyForInit, "1.1
|
|
22662
|
+
const healthReport = collectHealthReport("1.2.1");
|
|
22663
|
+
const initResult = await performInit(config2, anonKeyForInit, "1.2.1", healthReport);
|
|
22608
22664
|
if (generation !== registrationGeneration) return;
|
|
22609
22665
|
const currentState = getCoreState();
|
|
22610
22666
|
if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
|
|
@@ -22627,7 +22683,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
22627
22683
|
}
|
|
22628
22684
|
maybeInstallConsoleCapture();
|
|
22629
22685
|
if (didLastInitSucceed()) {
|
|
22630
|
-
startHeartbeat(config2, anonKeyForInit, "1.1
|
|
22686
|
+
startHeartbeat(config2, anonKeyForInit, "1.2.1", generation, (newApiKey, accountId) => {
|
|
22631
22687
|
setAuthState(AuthState.CLAIMING);
|
|
22632
22688
|
emitLifecycleEvent("auth:claim_started", { accountId });
|
|
22633
22689
|
setResolvedApiKey(newApiKey);
|