@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,10 +1,10 @@
1
1
  import {
2
2
  _resetForTesting,
3
3
  withAsyncCausality
4
- } from "../chunk-DW3CZDS6.js";
4
+ } from "../chunk-YKE6HJLW.js";
5
5
  import "../chunk-CL3OVHPO.js";
6
6
  import "../chunk-DQ25VOKK.js";
7
- import "../chunk-GBVMPMVV.js";
7
+ import "../chunk-MKT54VEH.js";
8
8
  import "../chunk-NSBPE2FW.js";
9
9
  export {
10
10
  _resetForTesting,
@@ -5,10 +5,10 @@ import {
5
5
  isDevApiKey,
6
6
  readEnvLocalApiKey,
7
7
  writeAndFsyncTempSync
8
- } from "./chunk-774XIOZG.js";
8
+ } from "./chunk-UOAG72NR.js";
9
9
  import {
10
10
  AnonApiKeySchema
11
- } from "./chunk-GBVMPMVV.js";
11
+ } from "./chunk-MKT54VEH.js";
12
12
  import {
13
13
  NEXT_CONFIG_NAMES
14
14
  } from "./chunk-NB7GJE4S.js";
@@ -922,4 +922,4 @@ export {
922
922
  writeShutdownMarker,
923
923
  runUninit
924
924
  };
925
- //# sourceMappingURL=chunk-WOYJAG7H.js.map
925
+ //# sourceMappingURL=chunk-BJOZBAP7.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-DQ25VOKK.js";
8
8
  import {
9
9
  GLASSTRACE_ATTRIBUTE_NAMES
10
- } from "./chunk-GBVMPMVV.js";
10
+ } from "./chunk-MKT54VEH.js";
11
11
 
12
12
  // src/middleware/index.ts
13
13
  var ATTR = GLASSTRACE_ATTRIBUTE_NAMES;
@@ -136,4 +136,4 @@ export {
136
136
  _resetForTesting,
137
137
  tracedRequestMiddleware
138
138
  };
139
- //# sourceMappingURL=chunk-AFTCLH77.js.map
139
+ //# sourceMappingURL=chunk-CN5EP25B.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-DQ25VOKK.js";
4
4
  import {
5
5
  GLASSTRACE_ATTRIBUTE_NAMES
6
- } from "./chunk-GBVMPMVV.js";
6
+ } from "./chunk-MKT54VEH.js";
7
7
 
8
8
  // src/errors.ts
9
9
  var SdkError = class extends Error {
@@ -102,4 +102,4 @@ export {
102
102
  GlasstraceSpanProcessor,
103
103
  captureCorrelationId
104
104
  };
105
- //# sourceMappingURL=chunk-KM4UNN3Q.js.map
105
+ //# sourceMappingURL=chunk-EVX6D2TX.js.map
@@ -54,7 +54,7 @@ import {
54
54
  performInit,
55
55
  recordSpansDropped,
56
56
  recordSpansExported
57
- } from "./chunk-T7B752NF.js";
57
+ } from "./chunk-VEQX2YSQ.js";
58
58
  import {
59
59
  isAnonymousMode,
60
60
  isProductionDisabled,
@@ -65,7 +65,7 @@ import {
65
65
  getOrCreateAnonKey,
66
66
  isSyncFsAvailable,
67
67
  readAnonKey
68
- } from "./chunk-774XIOZG.js";
68
+ } from "./chunk-UOAG72NR.js";
69
69
  import {
70
70
  GLASSTRACE_ATTRIBUTE_NAMES,
71
71
  MAX_SIDE_EFFECT_SCALARS_PER_OPERATION,
@@ -79,7 +79,7 @@ import {
79
79
  deriveSessionId,
80
80
  isSideEffectScalarKey,
81
81
  isSideEffectSemanticFieldKey
82
- } from "./chunk-GBVMPMVV.js";
82
+ } from "./chunk-MKT54VEH.js";
83
83
  import {
84
84
  isEndMarkerLine,
85
85
  parseStartMarkerLine
@@ -4406,6 +4406,7 @@ var TOKEN_REGEX = /^[A-Za-z0-9][A-Za-z0-9_.:-]*$/;
4406
4406
  var LOCALE_REGEX = /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8}){0,3}$/;
4407
4407
  var TIMEZONE_REGEX = /^(?:UTC|GMT|[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+){1,3})$/;
4408
4408
  var DIGIT_REGEX = /^[0-9]+$/;
4409
+ var BOOL_REGEX = /^(?:true|false)$/;
4409
4410
  var URL_SCHEME = /:\/\//;
4410
4411
  var URL_SCHEME_RELATIVE = /^\/\//;
4411
4412
  var EMAIL_LIKE = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/i;
@@ -4440,6 +4441,9 @@ function passesFieldValidator(key, value) {
4440
4441
  if (typeof key === "string" && key.endsWith("Count")) {
4441
4442
  return DIGIT_REGEX.test(value);
4442
4443
  }
4444
+ if (typeof key === "string" && key.endsWith("Holds")) {
4445
+ return BOOL_REGEX.test(value);
4446
+ }
4443
4447
  return TOKEN_REGEX.test(value);
4444
4448
  }
4445
4449
  function checkOperationLabel(value) {
@@ -4769,6 +4773,7 @@ function runRecordSideEffect(input) {
4769
4773
  recordOmission(outcome.span, "value_too_long");
4770
4774
  return;
4771
4775
  }
4776
+ const attachedFieldKeys = /* @__PURE__ */ new Set();
4772
4777
  const fields = candidate.fields;
4773
4778
  if (fields && typeof fields === "object") {
4774
4779
  for (const [rawKey, rawValue] of Object.entries(fields)) {
@@ -4787,6 +4792,39 @@ function runRecordSideEffect(input) {
4787
4792
  } catch {
4788
4793
  }
4789
4794
  attachField(outcome.span, rawKey, valueOutcome.value);
4795
+ attachedFieldKeys.add(rawKey);
4796
+ }
4797
+ }
4798
+ const relations = candidate.relations;
4799
+ if (relations && typeof relations === "object") {
4800
+ for (const [rawKey, rawValue] of Object.entries(relations)) {
4801
+ if (attachedFieldKeys.has(rawKey)) {
4802
+ recordOmission(outcome.span, "unsupported_key");
4803
+ continue;
4804
+ }
4805
+ if (!rawKey.endsWith("Holds") || !checkSemanticFieldKey(rawKey)) {
4806
+ recordOmission(outcome.span, "unsupported_key");
4807
+ continue;
4808
+ }
4809
+ if (typeof rawValue !== "boolean") {
4810
+ recordOmission(outcome.span, "raw_payload");
4811
+ continue;
4812
+ }
4813
+ const valueOutcome = checkSemanticFieldValue(
4814
+ rawKey,
4815
+ rawValue ? "true" : "false"
4816
+ );
4817
+ if (!valueOutcome.accepted) {
4818
+ recordOmission(outcome.span, valueOutcome.reason);
4819
+ continue;
4820
+ }
4821
+ try {
4822
+ maybeWarnMixedCasing(rawKey, valueOutcome.value);
4823
+ maybeWarnPatternKeyProliferation(rawKey);
4824
+ } catch {
4825
+ }
4826
+ attachField(outcome.span, rawKey, valueOutcome.value);
4827
+ attachedFieldKeys.add(rawKey);
4790
4828
  }
4791
4829
  }
4792
4830
  const scalars = candidate.scalars;
@@ -5080,11 +5118,11 @@ function registerGlasstrace(options) {
5080
5118
  setCoreState(CoreState.REGISTERING);
5081
5119
  maybeWarnStaleAgentInstructions({
5082
5120
  projectRoot: process.cwd(),
5083
- sdkVersion: "1.16.0"
5121
+ sdkVersion: "1.17.0"
5084
5122
  });
5085
5123
  startRuntimeStateWriter({
5086
5124
  projectRoot: process.cwd(),
5087
- sdkVersion: "1.16.0"
5125
+ sdkVersion: "1.17.0"
5088
5126
  });
5089
5127
  const config = resolveConfig(options);
5090
5128
  setSideEffectVerboseFlag(config.verbose);
@@ -5252,8 +5290,8 @@ async function backgroundInit(config, anonKeyForInit, generation) {
5252
5290
  if (config.verbose) {
5253
5291
  console.info("[glasstrace] Background init firing.");
5254
5292
  }
5255
- const healthReport = collectHealthReport("1.16.0");
5256
- const initResult = await performInit(config, anonKeyForInit, "1.16.0", healthReport);
5293
+ const healthReport = collectHealthReport("1.17.0");
5294
+ const initResult = await performInit(config, anonKeyForInit, "1.17.0", healthReport);
5257
5295
  if (generation !== registrationGeneration) return;
5258
5296
  const currentState = getCoreState();
5259
5297
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -5276,7 +5314,7 @@ async function backgroundInit(config, anonKeyForInit, generation) {
5276
5314
  }
5277
5315
  maybeInstallConsoleCapture();
5278
5316
  if (didLastInitSucceed()) {
5279
- startHeartbeat(config, anonKeyForInit, "1.16.0", generation, (newApiKey, accountId) => {
5317
+ startHeartbeat(config, anonKeyForInit, "1.17.0", generation, (newApiKey, accountId) => {
5280
5318
  setAuthState(AuthState.CLAIMING);
5281
5319
  emitLifecycleEvent("auth:claim_started", { accountId });
5282
5320
  setResolvedApiKey(newApiKey);
@@ -5573,7 +5611,7 @@ async function handleSourceMapUpload(distDir) {
5573
5611
  );
5574
5612
  return;
5575
5613
  }
5576
- const { discoverSourceMapFiles, computeBuildHash, uploadSourceMaps } = await import("./source-map-uploader-UJPZCUFN.js");
5614
+ const { discoverSourceMapFiles, computeBuildHash, uploadSourceMaps } = await import("./source-map-uploader-U7SLSKIZ.js");
5577
5615
  const files = await discoverSourceMapFiles(distDir);
5578
5616
  if (files.length === 0) {
5579
5617
  console.info("[glasstrace] No source map files found. Skipping upload.");
@@ -5674,4 +5712,4 @@ export {
5674
5712
  withGlasstraceConfig,
5675
5713
  captureError
5676
5714
  };
5677
- //# sourceMappingURL=chunk-EWW3TZ52.js.map
5715
+ //# sourceMappingURL=chunk-F2IPBTDJ.js.map