@glasstrace/sdk 1.16.0 → 1.17.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 (54) hide show
  1. package/README.md +44 -3
  2. package/dist/async-context/index.cjs.map +1 -1
  3. package/dist/async-context/index.js +2 -2
  4. package/dist/{chunk-WOYJAG7H.js → chunk-BJOZBAP7.js} +3 -3
  5. package/dist/{chunk-AFTCLH77.js → chunk-CN5EP25B.js} +2 -2
  6. package/dist/{chunk-KM4UNN3Q.js → chunk-EVX6D2TX.js} +2 -2
  7. package/dist/{chunk-EWW3TZ52.js → chunk-F2IPBTDJ.js} +48 -10
  8. package/dist/{chunk-EWW3TZ52.js.map → chunk-F2IPBTDJ.js.map} +1 -1
  9. package/dist/{chunk-BGJKEFBN.js → chunk-M3QGJUEI.js} +2 -2
  10. package/dist/{chunk-GBVMPMVV.js → chunk-MKT54VEH.js} +2 -2
  11. package/dist/{chunk-GBVMPMVV.js.map → chunk-MKT54VEH.js.map} +1 -1
  12. package/dist/{chunk-OHSX224U.js → chunk-O7IJP2TQ.js} +2 -2
  13. package/dist/{chunk-774XIOZG.js → chunk-UOAG72NR.js} +2 -2
  14. package/dist/{chunk-T7B752NF.js → chunk-VEQX2YSQ.js} +3 -3
  15. package/dist/{chunk-DW3CZDS6.js → chunk-YKE6HJLW.js} +2 -2
  16. package/dist/cli/init.cjs +4 -4
  17. package/dist/cli/init.cjs.map +1 -1
  18. package/dist/cli/init.js +7 -7
  19. package/dist/cli/mcp-add.cjs +1 -1
  20. package/dist/cli/mcp-add.cjs.map +1 -1
  21. package/dist/cli/mcp-add.js +3 -3
  22. package/dist/cli/uninit.js +3 -3
  23. package/dist/cli/upgrade-instructions.cjs +1 -1
  24. package/dist/cli/upgrade-instructions.js +3 -3
  25. package/dist/cli/validate.cjs.map +1 -1
  26. package/dist/cli/validate.js +2 -2
  27. package/dist/edge-entry.cjs.map +1 -1
  28. package/dist/edge-entry.js +4 -4
  29. package/dist/index.cjs +71 -6
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +74 -1
  32. package/dist/index.d.ts +74 -1
  33. package/dist/index.js +30 -5
  34. package/dist/index.js.map +1 -1
  35. package/dist/middleware/index.cjs.map +1 -1
  36. package/dist/middleware/index.js +2 -2
  37. package/dist/node-entry.cjs +5 -5
  38. package/dist/node-entry.cjs.map +1 -1
  39. package/dist/node-entry.js +7 -7
  40. package/dist/node-subpath.cjs.map +1 -1
  41. package/dist/node-subpath.js +3 -3
  42. package/dist/{source-map-uploader-UJPZCUFN.js → source-map-uploader-U7SLSKIZ.js} +3 -3
  43. package/dist/trpc/index.cjs.map +1 -1
  44. package/dist/trpc/index.js +1 -1
  45. package/package.json +1 -1
  46. /package/dist/{chunk-WOYJAG7H.js.map → chunk-BJOZBAP7.js.map} +0 -0
  47. /package/dist/{chunk-AFTCLH77.js.map → chunk-CN5EP25B.js.map} +0 -0
  48. /package/dist/{chunk-KM4UNN3Q.js.map → chunk-EVX6D2TX.js.map} +0 -0
  49. /package/dist/{chunk-BGJKEFBN.js.map → chunk-M3QGJUEI.js.map} +0 -0
  50. /package/dist/{chunk-OHSX224U.js.map → chunk-O7IJP2TQ.js.map} +0 -0
  51. /package/dist/{chunk-774XIOZG.js.map → chunk-UOAG72NR.js.map} +0 -0
  52. /package/dist/{chunk-T7B752NF.js.map → chunk-VEQX2YSQ.js.map} +0 -0
  53. /package/dist/{chunk-DW3CZDS6.js.map → chunk-YKE6HJLW.js.map} +0 -0
  54. /package/dist/{source-map-uploader-UJPZCUFN.js.map → source-map-uploader-U7SLSKIZ.js.map} +0 -0
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  tracedRequestMiddleware
3
- } from "./chunk-AFTCLH77.js";
3
+ } from "./chunk-CN5EP25B.js";
4
4
  import {
5
5
  withAsyncCausality
6
- } from "./chunk-DW3CZDS6.js";
6
+ } from "./chunk-YKE6HJLW.js";
7
7
  import {
8
8
  GlasstraceSpanProcessor,
9
9
  SdkError,
10
10
  captureCorrelationId
11
- } from "./chunk-KM4UNN3Q.js";
11
+ } from "./chunk-EVX6D2TX.js";
12
12
  import "./chunk-CL3OVHPO.js";
13
13
  import "./chunk-DQ25VOKK.js";
14
- import "./chunk-GBVMPMVV.js";
14
+ import "./chunk-MKT54VEH.js";
15
15
  import "./chunk-NSBPE2FW.js";
16
16
  export {
17
17
  GlasstraceSpanProcessor,
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",
@@ -17930,7 +17930,9 @@ __export(src_exports, {
17930
17930
  getOrCreateAnonKey: () => getOrCreateAnonKey,
17931
17931
  getOrigin: () => getOrigin,
17932
17932
  getStatus: () => getStatus,
17933
+ invariant: () => invariant,
17933
17934
  isAnonymousMode: () => isAnonymousMode,
17935
+ isNullInvariant: () => isNullInvariant,
17934
17936
  isProductionDisabled: () => isProductionDisabled,
17935
17937
  isReady: () => isReady,
17936
17938
  isSideEffectSemanticFieldKey: () => isSideEffectSemanticFieldKey,
@@ -24159,6 +24161,7 @@ var TOKEN_REGEX = /^[A-Za-z0-9][A-Za-z0-9_.:-]*$/;
24159
24161
  var LOCALE_REGEX = /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8}){0,3}$/;
24160
24162
  var TIMEZONE_REGEX = /^(?:UTC|GMT|[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+){1,3})$/;
24161
24163
  var DIGIT_REGEX = /^[0-9]+$/;
24164
+ var BOOL_REGEX = /^(?:true|false)$/;
24162
24165
  var URL_SCHEME = /:\/\//;
24163
24166
  var URL_SCHEME_RELATIVE = /^\/\//;
24164
24167
  var EMAIL_LIKE = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/i;
@@ -24193,6 +24196,9 @@ function passesFieldValidator(key, value) {
24193
24196
  if (typeof key === "string" && key.endsWith("Count")) {
24194
24197
  return DIGIT_REGEX.test(value);
24195
24198
  }
24199
+ if (typeof key === "string" && key.endsWith("Holds")) {
24200
+ return BOOL_REGEX.test(value);
24201
+ }
24196
24202
  return TOKEN_REGEX.test(value);
24197
24203
  }
24198
24204
  function checkOperationLabel(value) {
@@ -24524,6 +24530,7 @@ function runRecordSideEffect(input) {
24524
24530
  recordOmission(outcome.span, "value_too_long");
24525
24531
  return;
24526
24532
  }
24533
+ const attachedFieldKeys = /* @__PURE__ */ new Set();
24527
24534
  const fields = candidate.fields;
24528
24535
  if (fields && typeof fields === "object") {
24529
24536
  for (const [rawKey, rawValue] of Object.entries(fields)) {
@@ -24542,6 +24549,39 @@ function runRecordSideEffect(input) {
24542
24549
  } catch {
24543
24550
  }
24544
24551
  attachField(outcome.span, rawKey, valueOutcome.value);
24552
+ attachedFieldKeys.add(rawKey);
24553
+ }
24554
+ }
24555
+ const relations = candidate.relations;
24556
+ if (relations && typeof relations === "object") {
24557
+ for (const [rawKey, rawValue] of Object.entries(relations)) {
24558
+ if (attachedFieldKeys.has(rawKey)) {
24559
+ recordOmission(outcome.span, "unsupported_key");
24560
+ continue;
24561
+ }
24562
+ if (!rawKey.endsWith("Holds") || !checkSemanticFieldKey(rawKey)) {
24563
+ recordOmission(outcome.span, "unsupported_key");
24564
+ continue;
24565
+ }
24566
+ if (typeof rawValue !== "boolean") {
24567
+ recordOmission(outcome.span, "raw_payload");
24568
+ continue;
24569
+ }
24570
+ const valueOutcome = checkSemanticFieldValue(
24571
+ rawKey,
24572
+ rawValue ? "true" : "false"
24573
+ );
24574
+ if (!valueOutcome.accepted) {
24575
+ recordOmission(outcome.span, valueOutcome.reason);
24576
+ continue;
24577
+ }
24578
+ try {
24579
+ maybeWarnMixedCasing(rawKey, valueOutcome.value);
24580
+ maybeWarnPatternKeyProliferation(rawKey);
24581
+ } catch {
24582
+ }
24583
+ attachField(outcome.span, rawKey, valueOutcome.value);
24584
+ attachedFieldKeys.add(rawKey);
24545
24585
  }
24546
24586
  }
24547
24587
  const scalars = candidate.scalars;
@@ -24863,11 +24903,11 @@ function registerGlasstrace(options) {
24863
24903
  setCoreState(CoreState.REGISTERING);
24864
24904
  maybeWarnStaleAgentInstructions({
24865
24905
  projectRoot: process.cwd(),
24866
- sdkVersion: "1.16.0"
24906
+ sdkVersion: "1.17.0"
24867
24907
  });
24868
24908
  startRuntimeStateWriter({
24869
24909
  projectRoot: process.cwd(),
24870
- sdkVersion: "1.16.0"
24910
+ sdkVersion: "1.17.0"
24871
24911
  });
24872
24912
  const config2 = resolveConfig(options);
24873
24913
  setSideEffectVerboseFlag(config2.verbose);
@@ -25035,8 +25075,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
25035
25075
  if (config2.verbose) {
25036
25076
  console.info("[glasstrace] Background init firing.");
25037
25077
  }
25038
- const healthReport = collectHealthReport("1.16.0");
25039
- const initResult = await performInit(config2, anonKeyForInit, "1.16.0", healthReport);
25078
+ const healthReport = collectHealthReport("1.17.0");
25079
+ const initResult = await performInit(config2, anonKeyForInit, "1.17.0", healthReport);
25040
25080
  if (generation !== registrationGeneration) return;
25041
25081
  const currentState = getCoreState();
25042
25082
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -25059,7 +25099,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
25059
25099
  }
25060
25100
  maybeInstallConsoleCapture();
25061
25101
  if (didLastInitSucceed()) {
25062
- startHeartbeat(config2, anonKeyForInit, "1.16.0", generation, (newApiKey, accountId) => {
25102
+ startHeartbeat(config2, anonKeyForInit, "1.17.0", generation, (newApiKey, accountId) => {
25063
25103
  setAuthState(AuthState.CLAIMING);
25064
25104
  emitLifecycleEvent("auth:claim_started", { accountId });
25065
25105
  setResolvedApiKey(newApiKey);
@@ -25352,6 +25392,29 @@ function firstToken(value) {
25352
25392
  return void 0;
25353
25393
  }
25354
25394
 
25395
+ // src/side-effect/invariant.ts
25396
+ function invariant(left, op, right) {
25397
+ switch (op) {
25398
+ case "eq":
25399
+ return left === right;
25400
+ case "neq":
25401
+ return left !== right;
25402
+ case "lt":
25403
+ return left < right;
25404
+ case "lte":
25405
+ return left <= right;
25406
+ case "gt":
25407
+ return left > right;
25408
+ case "gte":
25409
+ return left >= right;
25410
+ }
25411
+ op;
25412
+ return false;
25413
+ }
25414
+ function isNullInvariant(value) {
25415
+ return value === null || value === void 0;
25416
+ }
25417
+
25355
25418
  // src/index.ts
25356
25419
  init_dist();
25357
25420
  // Annotate the CommonJS export names for ESM import in node:
@@ -25372,7 +25435,9 @@ init_dist();
25372
25435
  getOrCreateAnonKey,
25373
25436
  getOrigin,
25374
25437
  getStatus,
25438
+ invariant,
25375
25439
  isAnonymousMode,
25440
+ isNullInvariant,
25376
25441
  isProductionDisabled,
25377
25442
  isReady,
25378
25443
  isSideEffectSemanticFieldKey,