@picked/telemetry 0.0.117-next.2 → 0.0.117

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.
@@ -0,0 +1,36 @@
1
+ import type { SpanAttributes, TelemetrySpan } from './span.js';
2
+ /** Picked's own collector, where spans go when the caller names no endpoint. */
3
+ export declare const DEFAULT_TELEMETRY_ENDPOINT = "https://production.otel.picked.app/v1/traces";
4
+ /** Options for {@link createTelemetryEmitter}. */
5
+ export interface TelemetryEmitterOptions {
6
+ /** Absolute URL of the OTLP HTTP trace endpoint. Defaults to {@link DEFAULT_TELEMETRY_ENDPOINT}. */
7
+ endpoint?: string;
8
+ /** Attributes describing the emitter, such as `service.name`. */
9
+ resource: SpanAttributes;
10
+ /** Extra request headers, such as the ingest-channel marker. */
11
+ headers?: Record<string, string>;
12
+ /** Spans to buffer before flushing automatically. Defaults to 50. */
13
+ maxBatchSize?: number;
14
+ }
15
+ /** Records spans and sends them onward. */
16
+ export interface TelemetryEmitter {
17
+ /** Buffers a completed span, flushing automatically once the batch is full. */
18
+ record: (span: TelemetrySpan) => void;
19
+ /** Sends everything buffered. Always resolves, including on transport failure. */
20
+ flush: () => Promise<void>;
21
+ /** Spans currently buffered. Exposed so tests can assert the buffer is bounded. */
22
+ bufferedCount: () => number;
23
+ }
24
+ /**
25
+ * Creates an emitter that batches spans and posts them as OTLP/HTTP JSON.
26
+ *
27
+ * The transport is `fetch` with `keepalive`, which can set the request headers
28
+ * the ingest-channel marker travels on.
29
+ *
30
+ * @param {TelemetryEmitterOptions} options - Endpoint, resource attributes and transport headers.
31
+ * @returns {TelemetryEmitter} An emitter bound to those options.
32
+ * @example
33
+ * const emitter = createTelemetryEmitter({ resource: { 'service.name': 'picked-sdk' } })
34
+ */
35
+ export declare function createTelemetryEmitter(options: TelemetryEmitterOptions): TelemetryEmitter;
36
+ //# sourceMappingURL=emitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAE3D,gFAAgF;AAChF,eAAO,MAAM,0BAA0B,iDAAiD,CAAA;AAcxF,kDAAkD;AAClD,MAAM,WAAW,uBAAuB;IACtC,oGAAoG;IACpG,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iEAAiE;IACjE,QAAQ,EAAE,cAAc,CAAA;IACxB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,2CAA2C;AAC3C,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAA;IACrC,kFAAkF;IAClF,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,mFAAmF;IACnF,aAAa,EAAE,MAAM,MAAM,CAAA;CAC5B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,gBAAgB,CA4CzF"}
@@ -0,0 +1,26 @@
1
+ /** @file W3C trace-context identifier generation. */
2
+ /**
3
+ * Generates a trace id.
4
+ *
5
+ * @returns {string} 32 lowercase hex characters.
6
+ * @example createTraceId() // '4bf92f3577b34da6a3ce929d0e0e4736'
7
+ */
8
+ export declare function createTraceId(): string;
9
+ /**
10
+ * Generates a span id.
11
+ *
12
+ * @returns {string} 16 lowercase hex characters.
13
+ * @example createSpanId() // '00f067aa0ba902b7'
14
+ */
15
+ export declare function createSpanId(): string;
16
+ /**
17
+ * Builds a `traceparent` header value.
18
+ *
19
+ * @param {string} traceId - 32 hex characters.
20
+ * @param {string} spanId - 16 hex characters identifying the parent span.
21
+ * @param {boolean} sampled - Whether this trace was sampled.
22
+ * @returns {string} A version-00 `traceparent` value.
23
+ * @example formatTraceparent(createTraceId(), createSpanId(), true)
24
+ */
25
+ export declare function formatTraceparent(traceId: string, spanId: string, sampled: boolean): string;
26
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/ids.ts"],"names":[],"mappings":"AAAA,qDAAqD;AA4CrD;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAE3F"}
@@ -0,0 +1,7 @@
1
+ /** @file Public surface of the Picked telemetry emitter. */
2
+ export { createTelemetryEmitter, DEFAULT_TELEMETRY_ENDPOINT } from './emitter.js';
3
+ export type { TelemetryEmitter, TelemetryEmitterOptions } from './emitter.js';
4
+ export { createSpanId, createTraceId, formatTraceparent } from './ids.js';
5
+ export { toUnixNano } from './time.js';
6
+ export type { SpanAttributes, SpanAttributeValue, SpanKind, SpanStatus, TelemetrySpan, } from './span.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AAC9E,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAC1E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,UAAU,EACV,aAAa,GACd,MAAM,QAAQ,CAAA"}
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`@picked/telemetry`,t={unset:0,ok:1,error:2},n={internal:1,server:2,client:3};function r(){return`0.0.117-next.2`}function i(e){return typeof e==`string`?{stringValue:e}:typeof e==`boolean`?{boolValue:e}:Number.isInteger(e)?{intValue:e.toString()}:{doubleValue:e}}function a(e){return Object.entries(e).map(([e,t])=>({key:e,value:i(t)}))}function o(e){return{traceId:e.traceId,spanId:e.spanId,...e.parentSpanId?{parentSpanId:e.parentSpanId}:{},name:e.name,kind:n[e.kind??`internal`],startTimeUnixNano:e.startTimeUnixNano,endTimeUnixNano:e.endTimeUnixNano,attributes:a(e.attributes),status:{code:t[e.status]}}}function s(t,n){return{resourceSpans:[{resource:{attributes:a(t)},scopeSpans:[{scope:{name:e,version:r()},spans:n.map(o)}]}]}}var c=`https://production.otel.picked.app/v1/traces`,l=50,u=3e3;function d(e){let t=e.endpoint??`https://production.otel.picked.app/v1/traces`,n=e.maxBatchSize??l,r=[];async function i(){if(r.length===0)return;let n=r;r=[];let i=globalThis.fetch;if(typeof i==`function`)try{await i(t,{method:`POST`,keepalive:!0,headers:{"Content-Type":`application/json`,...e.headers},body:JSON.stringify(s(e.resource,n)),signal:AbortSignal.timeout(u)})}catch{}}return{record:e=>{r.push(e),r.length>=n&&i()},flush:i,bufferedCount:()=>r.length}}var f=16,p=8;function m(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t.every(e=>e===0)&&(t[0]=1),t}function h(e){let t=``;for(let n of e)t+=n.toString(16).padStart(2,`0`);return t}function g(){return h(m(f))}function _(){return h(m(p))}function v(e,t,n){return`00-${e}-${t}-${n?`01`:`00`}`}var y=1000000n;function b(e){let t=Math.trunc(e),n=Math.round((e-t)*Number(y));return(BigInt(t)*y+BigInt(n)).toString()}exports.DEFAULT_TELEMETRY_ENDPOINT=c,exports.createSpanId=_,exports.createTelemetryEmitter=d,exports.createTraceId=g,exports.formatTraceparent=v,exports.toUnixNano=b;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`@picked/telemetry`,t={unset:0,ok:1,error:2},n={internal:1,server:2,client:3};function r(){return`0.0.117`}function i(e){return typeof e==`string`?{stringValue:e}:typeof e==`boolean`?{boolValue:e}:Number.isInteger(e)?{intValue:e.toString()}:{doubleValue:e}}function a(e){return Object.entries(e).map(([e,t])=>({key:e,value:i(t)}))}function o(e){return{traceId:e.traceId,spanId:e.spanId,...e.parentSpanId?{parentSpanId:e.parentSpanId}:{},name:e.name,kind:n[e.kind??`internal`],startTimeUnixNano:e.startTimeUnixNano,endTimeUnixNano:e.endTimeUnixNano,attributes:a(e.attributes),status:{code:t[e.status]}}}function s(t,n){return{resourceSpans:[{resource:{attributes:a(t)},scopeSpans:[{scope:{name:e,version:r()},spans:n.map(o)}]}]}}var c=`https://production.otel.picked.app/v1/traces`,l=50,u=3e3;function d(e){let t=e.endpoint??`https://production.otel.picked.app/v1/traces`,n=e.maxBatchSize??l,r=[];async function i(){if(r.length===0)return;let n=r;r=[];let i=globalThis.fetch;if(typeof i==`function`)try{await i(t,{method:`POST`,keepalive:!0,headers:{"Content-Type":`application/json`,...e.headers},body:JSON.stringify(s(e.resource,n)),signal:AbortSignal.timeout(u)})}catch{}}return{record:e=>{r.push(e),r.length>=n&&i()},flush:i,bufferedCount:()=>r.length}}var f=16,p=8;function m(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t.every(e=>e===0)&&(t[0]=1),t}function h(e){let t=``;for(let n of e)t+=n.toString(16).padStart(2,`0`);return t}function g(){return h(m(f))}function _(){return h(m(p))}function v(e,t,n){return`00-${e}-${t}-${n?`01`:`00`}`}var y=1000000n;function b(e){let t=Math.trunc(e),n=Math.round((e-t)*Number(y));return(BigInt(t)*y+BigInt(n)).toString()}exports.DEFAULT_TELEMETRY_ENDPOINT=c,exports.createSpanId=_,exports.createTelemetryEmitter=d,exports.createTraceId=g,exports.formatTraceparent=v,exports.toUnixNano=b;
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @file OTLP/HTTP-JSON encoding.
3
+ *
4
+ * The wire format is the protobuf JSON mapping of the OTLP trace service
5
+ * request. Two of its rules are easy to miss: a 64-bit integer is carried as a
6
+ * string, and every attribute is a `{ key, value: { <typeField> } }` pair.
7
+ */
8
+ import type { SpanAttributes, TelemetrySpan } from './span.js';
9
+ /** An attribute value in its OTLP-tagged form. */
10
+ type EncodedAttributeValue = {
11
+ stringValue: string;
12
+ } | {
13
+ boolValue: boolean;
14
+ } | {
15
+ intValue: string;
16
+ } | {
17
+ doubleValue: number;
18
+ };
19
+ /** An OTLP key/value attribute pair. */
20
+ interface EncodedAttribute {
21
+ key: string;
22
+ value: EncodedAttributeValue;
23
+ }
24
+ /** A span in its OTLP-encoded form. */
25
+ export interface EncodedSpan {
26
+ traceId: string;
27
+ spanId: string;
28
+ parentSpanId?: string;
29
+ name: string;
30
+ kind: number;
31
+ startTimeUnixNano: string;
32
+ endTimeUnixNano: string;
33
+ attributes: EncodedAttribute[];
34
+ status: {
35
+ code: number;
36
+ };
37
+ }
38
+ /** One `scopeSpans` entry. */
39
+ interface EncodedScopeSpans {
40
+ scope: {
41
+ name: string;
42
+ version: string;
43
+ };
44
+ spans: EncodedSpan[];
45
+ }
46
+ /** One `resourceSpans` entry. */
47
+ interface EncodedResourceSpans {
48
+ resource: {
49
+ attributes: EncodedAttribute[];
50
+ };
51
+ scopeSpans: EncodedScopeSpans[];
52
+ }
53
+ /** The body of an OTLP trace export request. */
54
+ export interface EncodedPayload {
55
+ resourceSpans: EncodedResourceSpans[];
56
+ }
57
+ /**
58
+ * Builds the body of an OTLP trace export request.
59
+ *
60
+ * @param {SpanAttributes} resource - Attributes describing the emitter, such as `service.name`.
61
+ * @param {TelemetrySpan[]} spans - Spans to include in this batch.
62
+ * @returns {EncodedPayload} The request body, ready to serialise.
63
+ * @example encodeResourceSpans({ 'service.name': 'picked-sdk' }, [span])
64
+ */
65
+ export declare function encodeResourceSpans(resource: SpanAttributes, spans: TelemetrySpan[]): EncodedPayload;
66
+ export {};
67
+ //# sourceMappingURL=payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/payload.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,cAAc,EAId,aAAa,EACd,MAAM,QAAQ,CAAA;AAWf,kDAAkD;AAClD,KAAK,qBAAqB,GACxB;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnG,wCAAwC;AACxC,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,qBAAqB,CAAA;CAC7B;AAED,uCAAuC;AACvC,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,gBAAgB,EAAE,CAAA;IAC9B,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CACzB;AAED,8BAA8B;AAC9B,UAAU,iBAAiB;IACzB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IACxC,KAAK,EAAE,WAAW,EAAE,CAAA;CACrB;AAED,iCAAiC;AACjC,UAAU,oBAAoB;IAC5B,QAAQ,EAAE;QAAE,UAAU,EAAE,gBAAgB,EAAE,CAAA;KAAE,CAAA;IAC5C,UAAU,EAAE,iBAAiB,EAAE,CAAA;CAChC;AAED,gDAAgD;AAChD,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,oBAAoB,EAAE,CAAA;CACtC;AAiED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,aAAa,EAAE,GACrB,cAAc,CAchB"}
@@ -0,0 +1,31 @@
1
+ /** @file The span shape the Picked SDK surfaces record and this package emits. */
2
+ /** A value an attribute may carry. Attribute values are scalars in OTLP. */
3
+ export type SpanAttributeValue = string | number | boolean;
4
+ /** Attributes recorded on a span or on the emitting resource. */
5
+ export type SpanAttributes = Record<string, SpanAttributeValue>;
6
+ /** Outcome of the operation a span covers. */
7
+ export type SpanStatus = 'unset' | 'ok' | 'error';
8
+ /** The span's role: work inside the emitter, a request it served, or a request it sent. */
9
+ export type SpanKind = 'internal' | 'server' | 'client';
10
+ /** One completed span, ready to encode. */
11
+ export interface TelemetrySpan {
12
+ /** Operation name, for example `picked.start`. */
13
+ name: string;
14
+ /** 32 hex characters shared by every span in the trace. */
15
+ traceId: string;
16
+ /** 16 hex characters identifying this span. */
17
+ spanId: string;
18
+ /** The enclosing span, when this span has one. Absent on a root span. */
19
+ parentSpanId?: string;
20
+ /** Start time in nanoseconds since the epoch, as a decimal string. */
21
+ startTimeUnixNano: string;
22
+ /** End time in nanoseconds since the epoch, as a decimal string. */
23
+ endTimeUnixNano: string;
24
+ /** Attributes describing this operation. */
25
+ attributes: SpanAttributes;
26
+ /** Outcome of the operation. */
27
+ status: SpanStatus;
28
+ /** The span's role. `internal` when absent. */
29
+ kind?: SpanKind;
30
+ }
31
+ //# sourceMappingURL=span.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"span.d.ts","sourceRoot":"","sources":["../../src/span.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAElF,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAE1D,iEAAiE;AACjE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;AAE/D,8CAA8C;AAC9C,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,IAAI,GAAG,OAAO,CAAA;AAEjD,2FAA2F;AAC3F,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEvD,2CAA2C;AAC3C,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAA;IACf,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAA;IACd,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,sEAAsE;IACtE,iBAAiB,EAAE,MAAM,CAAA;IACzB,oEAAoE;IACpE,eAAe,EAAE,MAAM,CAAA;IACvB,4CAA4C;IAC5C,UAAU,EAAE,cAAc,CAAA;IAC1B,gCAAgC;IAChC,MAAM,EAAE,UAAU,CAAA;IAClB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB"}
@@ -0,0 +1,14 @@
1
+ /** @file Timestamp conversion for OTLP, which counts nanoseconds since the epoch. */
2
+ /**
3
+ * Converts epoch milliseconds to the Unix-nanosecond string OTLP expects.
4
+ *
5
+ * Nanoseconds since the epoch exceed `Number.MAX_SAFE_INTEGER`, so scaling a
6
+ * millisecond float by 1e6 rounds away the low digits. Going through `BigInt`
7
+ * keeps every millisecond exact, with the fraction added separately.
8
+ *
9
+ * @param {number} epochMs - Milliseconds since the Unix epoch.
10
+ * @returns {string} Nanoseconds since the epoch, as a decimal string.
11
+ * @example toUnixNano(1786500000123.5) // '1786500000123500000'
12
+ */
13
+ export declare function toUnixNano(epochMs: number): string;
14
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/time.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAKrF;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKlD"}
package/dist/esm/index.js CHANGED
@@ -9,7 +9,7 @@ var e = {
9
9
  client: 3
10
10
  };
11
11
  function n() {
12
- return "0.0.117-next.2";
12
+ return "0.0.117";
13
13
  }
14
14
  function r(e) {
15
15
  return typeof e == "string" ? { stringValue: e } : typeof e == "boolean" ? { boolValue: e } : Number.isInteger(e) ? { intValue: e.toString() } : { doubleValue: e };
@@ -1,4 +1,4 @@
1
- import type { SpanAttributes, TelemetrySpan } from './span';
1
+ import type { SpanAttributes, TelemetrySpan } from './span.js';
2
2
  /** Picked's own collector, where spans go when the caller names no endpoint. */
3
3
  export declare const DEFAULT_TELEMETRY_ENDPOINT = "https://production.otel.picked.app/v1/traces";
4
4
  /** Options for {@link createTelemetryEmitter}. */
@@ -1,7 +1,7 @@
1
1
  /** @file Public surface of the Picked telemetry emitter. */
2
- export { createTelemetryEmitter, DEFAULT_TELEMETRY_ENDPOINT } from './emitter';
3
- export type { TelemetryEmitter, TelemetryEmitterOptions } from './emitter';
4
- export { createSpanId, createTraceId, formatTraceparent } from './ids';
5
- export { toUnixNano } from './time';
6
- export type { SpanAttributes, SpanAttributeValue, SpanKind, SpanStatus, TelemetrySpan, } from './span';
2
+ export { createTelemetryEmitter, DEFAULT_TELEMETRY_ENDPOINT } from './emitter.js';
3
+ export type { TelemetryEmitter, TelemetryEmitterOptions } from './emitter.js';
4
+ export { createSpanId, createTraceId, formatTraceparent } from './ids.js';
5
+ export { toUnixNano } from './time.js';
6
+ export type { SpanAttributes, SpanAttributeValue, SpanKind, SpanStatus, TelemetrySpan, } from './span.js';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -5,7 +5,7 @@
5
5
  * request. Two of its rules are easy to miss: a 64-bit integer is carried as a
6
6
  * string, and every attribute is a `{ key, value: { <typeField> } }` pair.
7
7
  */
8
- import type { SpanAttributes, TelemetrySpan } from './span';
8
+ import type { SpanAttributes, TelemetrySpan } from './span.js';
9
9
  /** An attribute value in its OTLP-tagged form. */
10
10
  type EncodedAttributeValue = {
11
11
  stringValue: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@picked/telemetry",
3
3
  "description": "Minimal OTLP/HTTP-JSON span emitter shared by the Picked SDK surfaces",
4
- "version": "0.0.117-next.2",
4
+ "version": "0.0.117",
5
5
  "dependencies": {},
6
6
  "devDependencies": {
7
7
  "@repo/eslint-config": "workspace:*",
@@ -18,9 +18,14 @@
18
18
  },
19
19
  "exports": {
20
20
  ".": {
21
- "types": "./dist/types/index.d.ts",
22
- "import": "./dist/esm/index.js",
23
- "require": "./dist/cjs/index.js",
21
+ "import": {
22
+ "types": "./dist/types/index.d.ts",
23
+ "default": "./dist/esm/index.js"
24
+ },
25
+ "require": {
26
+ "types": "./dist/cjs/index.d.ts",
27
+ "default": "./dist/cjs/index.js"
28
+ },
24
29
  "default": "./dist/esm/index.js"
25
30
  }
26
31
  },
@@ -52,7 +57,7 @@
52
57
  "access": "public"
53
58
  },
54
59
  "scripts": {
55
- "build": "vite build && tsgo -p tsconfig.build.json",
60
+ "build": "vite build && tsgo -p tsconfig.build.json && node ../../scripts/sdk-dist.mjs",
56
61
  "check": "pnpm type-check && pnpm lint && pnpm knip && pnpm jscpd",
57
62
  "dev": "node ../../scripts/sdk-watch-build.mjs",
58
63
  "jscpd": "jscpd src",
@@ -64,7 +69,7 @@
64
69
  "size": "size-limit",
65
70
  "test": "vitest run",
66
71
  "test:coverage": "../../scripts/vitest-coverage.sh",
67
- "test:packaged-types": "attw --pack",
72
+ "test:packaged-types": "attw --pack --profile node16",
68
73
  "test:watch": "vitest",
69
74
  "type-check": "tsgo -p . --noEmit"
70
75
  },