@glasstrace/sdk 0.2.1 → 0.4.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 (44) hide show
  1. package/dist/adapters/drizzle.cjs +729 -3
  2. package/dist/adapters/drizzle.cjs.map +1 -1
  3. package/dist/adapters/drizzle.js +4 -1
  4. package/dist/adapters/drizzle.js.map +1 -1
  5. package/dist/chunk-DQ25VOKK.js +1250 -0
  6. package/dist/chunk-DQ25VOKK.js.map +1 -0
  7. package/dist/{chunk-CUFIV225.js → chunk-EC5IINUT.js} +86 -201
  8. package/dist/chunk-EC5IINUT.js.map +1 -0
  9. package/dist/chunk-STECO33B.js +675 -0
  10. package/dist/chunk-STECO33B.js.map +1 -0
  11. package/dist/chunk-TJ6ETQPH.js +172 -0
  12. package/dist/chunk-TJ6ETQPH.js.map +1 -0
  13. package/dist/chunk-WZXVS2EO.js +9 -0
  14. package/dist/chunk-WZXVS2EO.js.map +1 -0
  15. package/dist/cli/init.cjs +12481 -10892
  16. package/dist/cli/init.cjs.map +1 -1
  17. package/dist/cli/init.js +195 -186
  18. package/dist/cli/init.js.map +1 -1
  19. package/dist/cli/mcp-add.cjs +14651 -0
  20. package/dist/cli/mcp-add.cjs.map +1 -0
  21. package/dist/cli/mcp-add.d.cts +46 -0
  22. package/dist/cli/mcp-add.d.ts +46 -0
  23. package/dist/cli/mcp-add.js +243 -0
  24. package/dist/cli/mcp-add.js.map +1 -0
  25. package/dist/esm-POMEQPKL.js +62 -0
  26. package/dist/esm-POMEQPKL.js.map +1 -0
  27. package/dist/getMachineId-bsd-TC3JSTY5.js +29 -0
  28. package/dist/getMachineId-bsd-TC3JSTY5.js.map +1 -0
  29. package/dist/getMachineId-darwin-2SUKQCE6.js +29 -0
  30. package/dist/getMachineId-darwin-2SUKQCE6.js.map +1 -0
  31. package/dist/getMachineId-linux-PNAFHLXH.js +23 -0
  32. package/dist/getMachineId-linux-PNAFHLXH.js.map +1 -0
  33. package/dist/getMachineId-unsupported-L2MNYW3W.js +14 -0
  34. package/dist/getMachineId-unsupported-L2MNYW3W.js.map +1 -0
  35. package/dist/getMachineId-win-D6D42WOQ.js +31 -0
  36. package/dist/getMachineId-win-D6D42WOQ.js.map +1 -0
  37. package/dist/index.cjs +7580 -3456
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.cts +12 -4
  40. package/dist/index.d.ts +12 -4
  41. package/dist/index.js +2774 -299
  42. package/dist/index.js.map +1 -1
  43. package/package.json +3 -7
  44. package/dist/chunk-CUFIV225.js.map +0 -1
@@ -23,7 +23,733 @@ __export(drizzle_exports, {
23
23
  GlasstraceDrizzleLogger: () => GlasstraceDrizzleLogger
24
24
  });
25
25
  module.exports = __toCommonJS(drizzle_exports);
26
- var import_api = require("@opentelemetry/api");
26
+
27
+ // ../../node_modules/@opentelemetry/api/build/esm/version.js
28
+ var VERSION = "1.9.1";
29
+
30
+ // ../../node_modules/@opentelemetry/api/build/esm/internal/semver.js
31
+ var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
32
+ function _makeCompatibilityCheck(ownVersion) {
33
+ const acceptedVersions = /* @__PURE__ */ new Set([ownVersion]);
34
+ const rejectedVersions = /* @__PURE__ */ new Set();
35
+ const myVersionMatch = ownVersion.match(re);
36
+ if (!myVersionMatch) {
37
+ return () => false;
38
+ }
39
+ const ownVersionParsed = {
40
+ major: +myVersionMatch[1],
41
+ minor: +myVersionMatch[2],
42
+ patch: +myVersionMatch[3],
43
+ prerelease: myVersionMatch[4]
44
+ };
45
+ if (ownVersionParsed.prerelease != null) {
46
+ return function isExactmatch(globalVersion) {
47
+ return globalVersion === ownVersion;
48
+ };
49
+ }
50
+ function _reject(v) {
51
+ rejectedVersions.add(v);
52
+ return false;
53
+ }
54
+ function _accept(v) {
55
+ acceptedVersions.add(v);
56
+ return true;
57
+ }
58
+ return function isCompatible2(globalVersion) {
59
+ if (acceptedVersions.has(globalVersion)) {
60
+ return true;
61
+ }
62
+ if (rejectedVersions.has(globalVersion)) {
63
+ return false;
64
+ }
65
+ const globalVersionMatch = globalVersion.match(re);
66
+ if (!globalVersionMatch) {
67
+ return _reject(globalVersion);
68
+ }
69
+ const globalVersionParsed = {
70
+ major: +globalVersionMatch[1],
71
+ minor: +globalVersionMatch[2],
72
+ patch: +globalVersionMatch[3],
73
+ prerelease: globalVersionMatch[4]
74
+ };
75
+ if (globalVersionParsed.prerelease != null) {
76
+ return _reject(globalVersion);
77
+ }
78
+ if (ownVersionParsed.major !== globalVersionParsed.major) {
79
+ return _reject(globalVersion);
80
+ }
81
+ if (ownVersionParsed.major === 0) {
82
+ if (ownVersionParsed.minor === globalVersionParsed.minor && ownVersionParsed.patch <= globalVersionParsed.patch) {
83
+ return _accept(globalVersion);
84
+ }
85
+ return _reject(globalVersion);
86
+ }
87
+ if (ownVersionParsed.minor <= globalVersionParsed.minor) {
88
+ return _accept(globalVersion);
89
+ }
90
+ return _reject(globalVersion);
91
+ };
92
+ }
93
+ var isCompatible = _makeCompatibilityCheck(VERSION);
94
+
95
+ // ../../node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
96
+ var major = VERSION.split(".")[0];
97
+ var GLOBAL_OPENTELEMETRY_API_KEY = /* @__PURE__ */ Symbol.for(`opentelemetry.js.api.${major}`);
98
+ var _global = typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : typeof window === "object" ? window : typeof global === "object" ? global : {};
99
+ function registerGlobal(type, instance, diag, allowOverride = false) {
100
+ var _a;
101
+ const api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {
102
+ version: VERSION
103
+ };
104
+ if (!allowOverride && api[type]) {
105
+ const err = new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`);
106
+ diag.error(err.stack || err.message);
107
+ return false;
108
+ }
109
+ if (api.version !== VERSION) {
110
+ const err = new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`);
111
+ diag.error(err.stack || err.message);
112
+ return false;
113
+ }
114
+ api[type] = instance;
115
+ diag.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION}.`);
116
+ return true;
117
+ }
118
+ function getGlobal(type) {
119
+ var _a, _b;
120
+ const globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;
121
+ if (!globalVersion || !isCompatible(globalVersion)) {
122
+ return;
123
+ }
124
+ return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];
125
+ }
126
+ function unregisterGlobal(type, diag) {
127
+ diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`);
128
+ const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
129
+ if (api) {
130
+ delete api[type];
131
+ }
132
+ }
133
+
134
+ // ../../node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
135
+ var DiagComponentLogger = class {
136
+ constructor(props) {
137
+ this._namespace = props.namespace || "DiagComponentLogger";
138
+ }
139
+ debug(...args) {
140
+ return logProxy("debug", this._namespace, args);
141
+ }
142
+ error(...args) {
143
+ return logProxy("error", this._namespace, args);
144
+ }
145
+ info(...args) {
146
+ return logProxy("info", this._namespace, args);
147
+ }
148
+ warn(...args) {
149
+ return logProxy("warn", this._namespace, args);
150
+ }
151
+ verbose(...args) {
152
+ return logProxy("verbose", this._namespace, args);
153
+ }
154
+ };
155
+ function logProxy(funcName, namespace, args) {
156
+ const logger = getGlobal("diag");
157
+ if (!logger) {
158
+ return;
159
+ }
160
+ return logger[funcName](namespace, ...args);
161
+ }
162
+
163
+ // ../../node_modules/@opentelemetry/api/build/esm/diag/types.js
164
+ var DiagLogLevel;
165
+ (function(DiagLogLevel2) {
166
+ DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
167
+ DiagLogLevel2[DiagLogLevel2["ERROR"] = 30] = "ERROR";
168
+ DiagLogLevel2[DiagLogLevel2["WARN"] = 50] = "WARN";
169
+ DiagLogLevel2[DiagLogLevel2["INFO"] = 60] = "INFO";
170
+ DiagLogLevel2[DiagLogLevel2["DEBUG"] = 70] = "DEBUG";
171
+ DiagLogLevel2[DiagLogLevel2["VERBOSE"] = 80] = "VERBOSE";
172
+ DiagLogLevel2[DiagLogLevel2["ALL"] = 9999] = "ALL";
173
+ })(DiagLogLevel || (DiagLogLevel = {}));
174
+
175
+ // ../../node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
176
+ function createLogLevelDiagLogger(maxLevel, logger) {
177
+ if (maxLevel < DiagLogLevel.NONE) {
178
+ maxLevel = DiagLogLevel.NONE;
179
+ } else if (maxLevel > DiagLogLevel.ALL) {
180
+ maxLevel = DiagLogLevel.ALL;
181
+ }
182
+ logger = logger || {};
183
+ function _filterFunc(funcName, theLevel) {
184
+ const theFunc = logger[funcName];
185
+ if (typeof theFunc === "function" && maxLevel >= theLevel) {
186
+ return theFunc.bind(logger);
187
+ }
188
+ return function() {
189
+ };
190
+ }
191
+ return {
192
+ error: _filterFunc("error", DiagLogLevel.ERROR),
193
+ warn: _filterFunc("warn", DiagLogLevel.WARN),
194
+ info: _filterFunc("info", DiagLogLevel.INFO),
195
+ debug: _filterFunc("debug", DiagLogLevel.DEBUG),
196
+ verbose: _filterFunc("verbose", DiagLogLevel.VERBOSE)
197
+ };
198
+ }
199
+
200
+ // ../../node_modules/@opentelemetry/api/build/esm/api/diag.js
201
+ var API_NAME = "diag";
202
+ var DiagAPI = class _DiagAPI {
203
+ /** Get the singleton instance of the DiagAPI API */
204
+ static instance() {
205
+ if (!this._instance) {
206
+ this._instance = new _DiagAPI();
207
+ }
208
+ return this._instance;
209
+ }
210
+ /**
211
+ * Private internal constructor
212
+ * @private
213
+ */
214
+ constructor() {
215
+ function _logProxy(funcName) {
216
+ return function(...args) {
217
+ const logger = getGlobal("diag");
218
+ if (!logger)
219
+ return;
220
+ return logger[funcName](...args);
221
+ };
222
+ }
223
+ const self2 = this;
224
+ const setLogger = (logger, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => {
225
+ var _a, _b, _c;
226
+ if (logger === self2) {
227
+ const err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
228
+ self2.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
229
+ return false;
230
+ }
231
+ if (typeof optionsOrLogLevel === "number") {
232
+ optionsOrLogLevel = {
233
+ logLevel: optionsOrLogLevel
234
+ };
235
+ }
236
+ const oldLogger = getGlobal("diag");
237
+ const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);
238
+ if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
239
+ const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
240
+ oldLogger.warn(`Current logger will be overwritten from ${stack}`);
241
+ newLogger.warn(`Current logger will overwrite one already registered from ${stack}`);
242
+ }
243
+ return registerGlobal("diag", newLogger, self2, true);
244
+ };
245
+ self2.setLogger = setLogger;
246
+ self2.disable = () => {
247
+ unregisterGlobal(API_NAME, self2);
248
+ };
249
+ self2.createComponentLogger = (options) => {
250
+ return new DiagComponentLogger(options);
251
+ };
252
+ self2.verbose = _logProxy("verbose");
253
+ self2.debug = _logProxy("debug");
254
+ self2.info = _logProxy("info");
255
+ self2.warn = _logProxy("warn");
256
+ self2.error = _logProxy("error");
257
+ }
258
+ };
259
+
260
+ // ../../node_modules/@opentelemetry/api/build/esm/context/context.js
261
+ function createContextKey(description) {
262
+ return Symbol.for(description);
263
+ }
264
+ var BaseContext = class _BaseContext {
265
+ /**
266
+ * Construct a new context which inherits values from an optional parent context.
267
+ *
268
+ * @param parentContext a context from which to inherit values
269
+ */
270
+ constructor(parentContext) {
271
+ const self2 = this;
272
+ self2._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
273
+ self2.getValue = (key) => self2._currentContext.get(key);
274
+ self2.setValue = (key, value) => {
275
+ const context = new _BaseContext(self2._currentContext);
276
+ context._currentContext.set(key, value);
277
+ return context;
278
+ };
279
+ self2.deleteValue = (key) => {
280
+ const context = new _BaseContext(self2._currentContext);
281
+ context._currentContext.delete(key);
282
+ return context;
283
+ };
284
+ }
285
+ };
286
+ var ROOT_CONTEXT = new BaseContext();
287
+
288
+ // ../../node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js
289
+ var NoopContextManager = class {
290
+ active() {
291
+ return ROOT_CONTEXT;
292
+ }
293
+ with(_context, fn, thisArg, ...args) {
294
+ return fn.call(thisArg, ...args);
295
+ }
296
+ bind(_context, target) {
297
+ return target;
298
+ }
299
+ enable() {
300
+ return this;
301
+ }
302
+ disable() {
303
+ return this;
304
+ }
305
+ };
306
+
307
+ // ../../node_modules/@opentelemetry/api/build/esm/api/context.js
308
+ var API_NAME2 = "context";
309
+ var NOOP_CONTEXT_MANAGER = new NoopContextManager();
310
+ var ContextAPI = class _ContextAPI {
311
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
312
+ constructor() {
313
+ }
314
+ /** Get the singleton instance of the Context API */
315
+ static getInstance() {
316
+ if (!this._instance) {
317
+ this._instance = new _ContextAPI();
318
+ }
319
+ return this._instance;
320
+ }
321
+ /**
322
+ * Set the current context manager.
323
+ *
324
+ * @returns true if the context manager was successfully registered, else false
325
+ */
326
+ setGlobalContextManager(contextManager) {
327
+ return registerGlobal(API_NAME2, contextManager, DiagAPI.instance());
328
+ }
329
+ /**
330
+ * Get the currently active context
331
+ */
332
+ active() {
333
+ return this._getContextManager().active();
334
+ }
335
+ /**
336
+ * Execute a function with an active context
337
+ *
338
+ * @param context context to be active during function execution
339
+ * @param fn function to execute in a context
340
+ * @param thisArg optional receiver to be used for calling fn
341
+ * @param args optional arguments forwarded to fn
342
+ */
343
+ with(context, fn, thisArg, ...args) {
344
+ return this._getContextManager().with(context, fn, thisArg, ...args);
345
+ }
346
+ /**
347
+ * Bind a context to a target function or event emitter
348
+ *
349
+ * @param context context to bind to the event emitter or function. Defaults to the currently active context
350
+ * @param target function or event emitter to bind
351
+ */
352
+ bind(context, target) {
353
+ return this._getContextManager().bind(context, target);
354
+ }
355
+ _getContextManager() {
356
+ return getGlobal(API_NAME2) || NOOP_CONTEXT_MANAGER;
357
+ }
358
+ /** Disable and remove the global context manager */
359
+ disable() {
360
+ this._getContextManager().disable();
361
+ unregisterGlobal(API_NAME2, DiagAPI.instance());
362
+ }
363
+ };
364
+
365
+ // ../../node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js
366
+ var TraceFlags;
367
+ (function(TraceFlags2) {
368
+ TraceFlags2[TraceFlags2["NONE"] = 0] = "NONE";
369
+ TraceFlags2[TraceFlags2["SAMPLED"] = 1] = "SAMPLED";
370
+ })(TraceFlags || (TraceFlags = {}));
371
+
372
+ // ../../node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js
373
+ var INVALID_SPANID = "0000000000000000";
374
+ var INVALID_TRACEID = "00000000000000000000000000000000";
375
+ var INVALID_SPAN_CONTEXT = {
376
+ traceId: INVALID_TRACEID,
377
+ spanId: INVALID_SPANID,
378
+ traceFlags: TraceFlags.NONE
379
+ };
380
+
381
+ // ../../node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js
382
+ var NonRecordingSpan = class {
383
+ constructor(spanContext = INVALID_SPAN_CONTEXT) {
384
+ this._spanContext = spanContext;
385
+ }
386
+ // Returns a SpanContext.
387
+ spanContext() {
388
+ return this._spanContext;
389
+ }
390
+ // By default does nothing
391
+ setAttribute(_key, _value) {
392
+ return this;
393
+ }
394
+ // By default does nothing
395
+ setAttributes(_attributes) {
396
+ return this;
397
+ }
398
+ // By default does nothing
399
+ addEvent(_name, _attributes) {
400
+ return this;
401
+ }
402
+ addLink(_link) {
403
+ return this;
404
+ }
405
+ addLinks(_links) {
406
+ return this;
407
+ }
408
+ // By default does nothing
409
+ setStatus(_status) {
410
+ return this;
411
+ }
412
+ // By default does nothing
413
+ updateName(_name) {
414
+ return this;
415
+ }
416
+ // By default does nothing
417
+ end(_endTime) {
418
+ }
419
+ // isRecording always returns false for NonRecordingSpan.
420
+ isRecording() {
421
+ return false;
422
+ }
423
+ // By default does nothing
424
+ recordException(_exception, _time) {
425
+ }
426
+ };
427
+
428
+ // ../../node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
429
+ var SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
430
+ function getSpan(context) {
431
+ return context.getValue(SPAN_KEY) || void 0;
432
+ }
433
+ function getActiveSpan() {
434
+ return getSpan(ContextAPI.getInstance().active());
435
+ }
436
+ function setSpan(context, span) {
437
+ return context.setValue(SPAN_KEY, span);
438
+ }
439
+ function deleteSpan(context) {
440
+ return context.deleteValue(SPAN_KEY);
441
+ }
442
+ function setSpanContext(context, spanContext) {
443
+ return setSpan(context, new NonRecordingSpan(spanContext));
444
+ }
445
+ function getSpanContext(context) {
446
+ var _a;
447
+ return (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.spanContext();
448
+ }
449
+
450
+ // ../../node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
451
+ var isHex = new Uint8Array([
452
+ 0,
453
+ 0,
454
+ 0,
455
+ 0,
456
+ 0,
457
+ 0,
458
+ 0,
459
+ 0,
460
+ 0,
461
+ 0,
462
+ 0,
463
+ 0,
464
+ 0,
465
+ 0,
466
+ 0,
467
+ 0,
468
+ 0,
469
+ 0,
470
+ 0,
471
+ 0,
472
+ 0,
473
+ 0,
474
+ 0,
475
+ 0,
476
+ 0,
477
+ 0,
478
+ 0,
479
+ 0,
480
+ 0,
481
+ 0,
482
+ 0,
483
+ 0,
484
+ 0,
485
+ 0,
486
+ 0,
487
+ 0,
488
+ 0,
489
+ 0,
490
+ 0,
491
+ 0,
492
+ 0,
493
+ 0,
494
+ 0,
495
+ 0,
496
+ 0,
497
+ 0,
498
+ 0,
499
+ 0,
500
+ 1,
501
+ 1,
502
+ 1,
503
+ 1,
504
+ 1,
505
+ 1,
506
+ 1,
507
+ 1,
508
+ 1,
509
+ 1,
510
+ 0,
511
+ 0,
512
+ 0,
513
+ 0,
514
+ 0,
515
+ 0,
516
+ 0,
517
+ 1,
518
+ 1,
519
+ 1,
520
+ 1,
521
+ 1,
522
+ 1,
523
+ 0,
524
+ 0,
525
+ 0,
526
+ 0,
527
+ 0,
528
+ 0,
529
+ 0,
530
+ 0,
531
+ 0,
532
+ 0,
533
+ 0,
534
+ 0,
535
+ 0,
536
+ 0,
537
+ 0,
538
+ 0,
539
+ 0,
540
+ 0,
541
+ 0,
542
+ 0,
543
+ 0,
544
+ 0,
545
+ 0,
546
+ 0,
547
+ 0,
548
+ 0,
549
+ 1,
550
+ 1,
551
+ 1,
552
+ 1,
553
+ 1,
554
+ 1
555
+ ]);
556
+ function isValidHex(id, length) {
557
+ if (typeof id !== "string" || id.length !== length)
558
+ return false;
559
+ let r = 0;
560
+ for (let i = 0; i < id.length; i += 4) {
561
+ r += (isHex[id.charCodeAt(i)] | 0) + (isHex[id.charCodeAt(i + 1)] | 0) + (isHex[id.charCodeAt(i + 2)] | 0) + (isHex[id.charCodeAt(i + 3)] | 0);
562
+ }
563
+ return r === length;
564
+ }
565
+ function isValidTraceId(traceId) {
566
+ return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID;
567
+ }
568
+ function isValidSpanId(spanId) {
569
+ return isValidHex(spanId, 16) && spanId !== INVALID_SPANID;
570
+ }
571
+ function isSpanContextValid(spanContext) {
572
+ return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
573
+ }
574
+ function wrapSpanContext(spanContext) {
575
+ return new NonRecordingSpan(spanContext);
576
+ }
577
+
578
+ // ../../node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js
579
+ var contextApi = ContextAPI.getInstance();
580
+ var NoopTracer = class {
581
+ // startSpan starts a noop span.
582
+ startSpan(name, options, context = contextApi.active()) {
583
+ const root = Boolean(options === null || options === void 0 ? void 0 : options.root);
584
+ if (root) {
585
+ return new NonRecordingSpan();
586
+ }
587
+ const parentFromContext = context && getSpanContext(context);
588
+ if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) {
589
+ return new NonRecordingSpan(parentFromContext);
590
+ } else {
591
+ return new NonRecordingSpan();
592
+ }
593
+ }
594
+ startActiveSpan(name, arg2, arg3, arg4) {
595
+ let opts;
596
+ let ctx;
597
+ let fn;
598
+ if (arguments.length < 2) {
599
+ return;
600
+ } else if (arguments.length === 2) {
601
+ fn = arg2;
602
+ } else if (arguments.length === 3) {
603
+ opts = arg2;
604
+ fn = arg3;
605
+ } else {
606
+ opts = arg2;
607
+ ctx = arg3;
608
+ fn = arg4;
609
+ }
610
+ const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
611
+ const span = this.startSpan(name, opts, parentContext);
612
+ const contextWithSpanSet = setSpan(parentContext, span);
613
+ return contextApi.with(contextWithSpanSet, fn, void 0, span);
614
+ }
615
+ };
616
+ function isSpanContext(spanContext) {
617
+ return spanContext !== null && typeof spanContext === "object" && "spanId" in spanContext && typeof spanContext["spanId"] === "string" && "traceId" in spanContext && typeof spanContext["traceId"] === "string" && "traceFlags" in spanContext && typeof spanContext["traceFlags"] === "number";
618
+ }
619
+
620
+ // ../../node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js
621
+ var NOOP_TRACER = new NoopTracer();
622
+ var ProxyTracer = class {
623
+ constructor(provider, name, version, options) {
624
+ this._provider = provider;
625
+ this.name = name;
626
+ this.version = version;
627
+ this.options = options;
628
+ }
629
+ startSpan(name, options, context) {
630
+ return this._getTracer().startSpan(name, options, context);
631
+ }
632
+ startActiveSpan(_name, _options, _context, _fn) {
633
+ const tracer = this._getTracer();
634
+ return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
635
+ }
636
+ /**
637
+ * Try to get a tracer from the proxy tracer provider.
638
+ * If the proxy tracer provider has no delegate, return a noop tracer.
639
+ */
640
+ _getTracer() {
641
+ if (this._delegate) {
642
+ return this._delegate;
643
+ }
644
+ const tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);
645
+ if (!tracer) {
646
+ return NOOP_TRACER;
647
+ }
648
+ this._delegate = tracer;
649
+ return this._delegate;
650
+ }
651
+ };
652
+
653
+ // ../../node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js
654
+ var NoopTracerProvider = class {
655
+ getTracer(_name, _version, _options) {
656
+ return new NoopTracer();
657
+ }
658
+ };
659
+
660
+ // ../../node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js
661
+ var NOOP_TRACER_PROVIDER = new NoopTracerProvider();
662
+ var ProxyTracerProvider = class {
663
+ /**
664
+ * Get a {@link ProxyTracer}
665
+ */
666
+ getTracer(name, version, options) {
667
+ var _a;
668
+ return (_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options);
669
+ }
670
+ getDelegate() {
671
+ var _a;
672
+ return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER;
673
+ }
674
+ /**
675
+ * Set the delegate tracer provider
676
+ */
677
+ setDelegate(delegate) {
678
+ this._delegate = delegate;
679
+ }
680
+ getDelegateTracer(name, version, options) {
681
+ var _a;
682
+ return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);
683
+ }
684
+ };
685
+
686
+ // ../../node_modules/@opentelemetry/api/build/esm/trace/span_kind.js
687
+ var SpanKind;
688
+ (function(SpanKind2) {
689
+ SpanKind2[SpanKind2["INTERNAL"] = 0] = "INTERNAL";
690
+ SpanKind2[SpanKind2["SERVER"] = 1] = "SERVER";
691
+ SpanKind2[SpanKind2["CLIENT"] = 2] = "CLIENT";
692
+ SpanKind2[SpanKind2["PRODUCER"] = 3] = "PRODUCER";
693
+ SpanKind2[SpanKind2["CONSUMER"] = 4] = "CONSUMER";
694
+ })(SpanKind || (SpanKind = {}));
695
+
696
+ // ../../node_modules/@opentelemetry/api/build/esm/api/trace.js
697
+ var API_NAME3 = "trace";
698
+ var TraceAPI = class _TraceAPI {
699
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
700
+ constructor() {
701
+ this._proxyTracerProvider = new ProxyTracerProvider();
702
+ this.wrapSpanContext = wrapSpanContext;
703
+ this.isSpanContextValid = isSpanContextValid;
704
+ this.deleteSpan = deleteSpan;
705
+ this.getSpan = getSpan;
706
+ this.getActiveSpan = getActiveSpan;
707
+ this.getSpanContext = getSpanContext;
708
+ this.setSpan = setSpan;
709
+ this.setSpanContext = setSpanContext;
710
+ }
711
+ /** Get the singleton instance of the Trace API */
712
+ static getInstance() {
713
+ if (!this._instance) {
714
+ this._instance = new _TraceAPI();
715
+ }
716
+ return this._instance;
717
+ }
718
+ /**
719
+ * Set the current global tracer.
720
+ *
721
+ * @returns true if the tracer provider was successfully registered, else false
722
+ */
723
+ setGlobalTracerProvider(provider) {
724
+ const success = registerGlobal(API_NAME3, this._proxyTracerProvider, DiagAPI.instance());
725
+ if (success) {
726
+ this._proxyTracerProvider.setDelegate(provider);
727
+ }
728
+ return success;
729
+ }
730
+ /**
731
+ * Returns the global tracer provider.
732
+ */
733
+ getTracerProvider() {
734
+ return getGlobal(API_NAME3) || this._proxyTracerProvider;
735
+ }
736
+ /**
737
+ * Returns a tracer from the global tracer provider.
738
+ */
739
+ getTracer(name, version) {
740
+ return this.getTracerProvider().getTracer(name, version);
741
+ }
742
+ /** Remove the global tracer provider */
743
+ disable() {
744
+ unregisterGlobal(API_NAME3, DiagAPI.instance());
745
+ this._proxyTracerProvider = new ProxyTracerProvider();
746
+ }
747
+ };
748
+
749
+ // ../../node_modules/@opentelemetry/api/build/esm/trace-api.js
750
+ var trace = TraceAPI.getInstance();
751
+
752
+ // src/adapters/drizzle.ts
27
753
  function extractOperation(query) {
28
754
  const trimmed = query.trimStart().toUpperCase();
29
755
  if (trimmed.startsWith("SELECT")) return "SELECT";
@@ -45,7 +771,7 @@ var GlasstraceDrizzleLogger = class {
45
771
  tracer;
46
772
  captureParams;
47
773
  constructor(options) {
48
- this.tracer = import_api.trace.getTracer("glasstrace-drizzle");
774
+ this.tracer = trace.getTracer("glasstrace-drizzle");
49
775
  this.captureParams = options?.captureParams ?? false;
50
776
  }
51
777
  /**
@@ -56,7 +782,7 @@ var GlasstraceDrizzleLogger = class {
56
782
  const operation = extractOperation(query);
57
783
  const spanName = operation === "unknown" ? "drizzle.query" : `drizzle.${operation}`;
58
784
  const span = this.tracer.startSpan(spanName, {
59
- kind: import_api.SpanKind.CLIENT,
785
+ kind: SpanKind.CLIENT,
60
786
  attributes: {
61
787
  "db.system": "drizzle",
62
788
  "db.statement": query,