autotel-subscribers 59.0.0 → 59.0.2

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.
@@ -1,12 +1,12 @@
1
1
  import { EventAttributes, EventSubscriber, FunnelStatus, OutcomeStatus } from "autotel/event-subscriber";
2
2
  //#region src/amplitude.d.ts
3
- interface AmplitudeConfig {
3
+ export interface AmplitudeConfig {
4
4
  /** Amplitude API key */
5
5
  apiKey: string;
6
6
  /** Enable/disable the subscriber */
7
7
  enabled?: boolean;
8
8
  }
9
- declare class AmplitudeSubscriber implements EventSubscriber {
9
+ export declare class AmplitudeSubscriber implements EventSubscriber {
10
10
  readonly name = "AmplitudeSubscriber";
11
11
  readonly version = "1.0.0";
12
12
  private amplitudeModule;
@@ -23,5 +23,4 @@ declare class AmplitudeSubscriber implements EventSubscriber {
23
23
  /** Flush pending events before shutdown */
24
24
  shutdown(): Promise<void>;
25
25
  }
26
- //#endregion
27
- export { AmplitudeConfig, AmplitudeSubscriber };
26
+ //#endregion
@@ -1,12 +1,12 @@
1
1
  import { EventAttributes, EventSubscriber, FunnelStatus, OutcomeStatus } from "autotel/event-subscriber";
2
2
  //#region src/amplitude.d.ts
3
- interface AmplitudeConfig {
3
+ export interface AmplitudeConfig {
4
4
  /** Amplitude API key */
5
5
  apiKey: string;
6
6
  /** Enable/disable the subscriber */
7
7
  enabled?: boolean;
8
8
  }
9
- declare class AmplitudeSubscriber implements EventSubscriber {
9
+ export declare class AmplitudeSubscriber implements EventSubscriber {
10
10
  readonly name = "AmplitudeSubscriber";
11
11
  readonly version = "1.0.0";
12
12
  private amplitudeModule;
@@ -23,5 +23,4 @@ declare class AmplitudeSubscriber implements EventSubscriber {
23
23
  /** Flush pending events before shutdown */
24
24
  shutdown(): Promise<void>;
25
25
  }
26
- //#endregion
27
- export { AmplitudeConfig, AmplitudeSubscriber };
26
+ //#endregion
@@ -5,14 +5,14 @@ import { n as EventPayload, r as EventSubscriber } from "./event-subscriber-base
5
5
  * target this spec. Bumping the spec version is a breaking change for
6
6
  * downstream consumers, so add fields rather than rename existing ones.
7
7
  */
8
- declare const ARCHITECTURE_SNAPSHOT_SPEC: "autotel-architecture/v0.1.0";
9
- type ArchitectureSnapshot = {
8
+ export declare const ARCHITECTURE_SNAPSHOT_SPEC: 'autotel-architecture/v0.1.0';
9
+ export type ArchitectureSnapshot = {
10
10
  spec: typeof ARCHITECTURE_SNAPSHOT_SPEC;
11
11
  generatedAt: string;
12
12
  service: string;
13
13
  events: Record<string, EventObservation>;
14
14
  };
15
- type EventObservation = {
15
+ export type EventObservation = {
16
16
  name: string;
17
17
  observedCount: number;
18
18
  firstSeen: string;
@@ -48,26 +48,26 @@ type EventObservation = {
48
48
  };
49
49
  };
50
50
  /** One (producer, channel) pair an event was observed on, with its own count. */
51
- type EventSource = {
51
+ export type EventSource = {
52
52
  producer?: string;
53
53
  channel?: string;
54
54
  count: number;
55
55
  firstSeen: string;
56
56
  lastSeen: string;
57
57
  };
58
- type FieldStats = {
58
+ export type FieldStats = {
59
59
  /** Runtime types observed for this field path (e.g. string, number). */
60
60
  types: string[];
61
61
  /** Small set of observed primitive values (for enum/value drift checks). */
62
62
  sampleValues: Array<string | number | boolean | null>;
63
63
  };
64
- interface ArchitectureSnapshotConfig {
64
+ export interface ArchitectureSnapshotConfig {
65
65
  /** Service identifier that appears in the snapshot header. */
66
66
  service: string;
67
67
  /** Maximum number of trace IDs to retain per event (default 3). */
68
68
  maxSampleTraceIds?: number;
69
69
  }
70
- declare class ArchitectureSnapshotSubscriber extends EventSubscriber {
70
+ export declare class ArchitectureSnapshotSubscriber extends EventSubscriber {
71
71
  readonly name = "ArchitectureSnapshotSubscriber";
72
72
  private readonly service;
73
73
  private readonly maxSampleTraceIds;
@@ -108,6 +108,5 @@ declare class ArchitectureSnapshotSubscriber extends EventSubscriber {
108
108
  * Walk a JSON-like value and produce a sorted list of dotted field paths.
109
109
  * Arrays collapse with `[]`, so `items: [{ sku: 'x' }]` yields `items[].sku`.
110
110
  */
111
- declare function extractFieldPaths(value: unknown, prefix?: string): string[];
112
- //#endregion
113
- export { ARCHITECTURE_SNAPSHOT_SPEC, ArchitectureSnapshot, ArchitectureSnapshotConfig, ArchitectureSnapshotSubscriber, EventObservation, EventSource, FieldStats, extractFieldPaths };
111
+ export declare function extractFieldPaths(value: unknown, prefix?: string): string[];
112
+ //#endregion
@@ -5,14 +5,14 @@ import { n as EventPayload, r as EventSubscriber } from "./event-subscriber-base
5
5
  * target this spec. Bumping the spec version is a breaking change for
6
6
  * downstream consumers, so add fields rather than rename existing ones.
7
7
  */
8
- declare const ARCHITECTURE_SNAPSHOT_SPEC: "autotel-architecture/v0.1.0";
9
- type ArchitectureSnapshot = {
8
+ export declare const ARCHITECTURE_SNAPSHOT_SPEC: 'autotel-architecture/v0.1.0';
9
+ export type ArchitectureSnapshot = {
10
10
  spec: typeof ARCHITECTURE_SNAPSHOT_SPEC;
11
11
  generatedAt: string;
12
12
  service: string;
13
13
  events: Record<string, EventObservation>;
14
14
  };
15
- type EventObservation = {
15
+ export type EventObservation = {
16
16
  name: string;
17
17
  observedCount: number;
18
18
  firstSeen: string;
@@ -48,26 +48,26 @@ type EventObservation = {
48
48
  };
49
49
  };
50
50
  /** One (producer, channel) pair an event was observed on, with its own count. */
51
- type EventSource = {
51
+ export type EventSource = {
52
52
  producer?: string;
53
53
  channel?: string;
54
54
  count: number;
55
55
  firstSeen: string;
56
56
  lastSeen: string;
57
57
  };
58
- type FieldStats = {
58
+ export type FieldStats = {
59
59
  /** Runtime types observed for this field path (e.g. string, number). */
60
60
  types: string[];
61
61
  /** Small set of observed primitive values (for enum/value drift checks). */
62
62
  sampleValues: Array<string | number | boolean | null>;
63
63
  };
64
- interface ArchitectureSnapshotConfig {
64
+ export interface ArchitectureSnapshotConfig {
65
65
  /** Service identifier that appears in the snapshot header. */
66
66
  service: string;
67
67
  /** Maximum number of trace IDs to retain per event (default 3). */
68
68
  maxSampleTraceIds?: number;
69
69
  }
70
- declare class ArchitectureSnapshotSubscriber extends EventSubscriber {
70
+ export declare class ArchitectureSnapshotSubscriber extends EventSubscriber {
71
71
  readonly name = "ArchitectureSnapshotSubscriber";
72
72
  private readonly service;
73
73
  private readonly maxSampleTraceIds;
@@ -108,6 +108,5 @@ declare class ArchitectureSnapshotSubscriber extends EventSubscriber {
108
108
  * Walk a JSON-like value and produce a sorted list of dotted field paths.
109
109
  * Arrays collapse with `[]`, so `items: [{ sku: 'x' }]` yields `items[].sku`.
110
110
  */
111
- declare function extractFieldPaths(value: unknown, prefix?: string): string[];
112
- //#endregion
113
- export { ARCHITECTURE_SNAPSHOT_SPEC, ArchitectureSnapshot, ArchitectureSnapshotConfig, ArchitectureSnapshotSubscriber, EventObservation, EventSource, FieldStats, extractFieldPaths };
111
+ export declare function extractFieldPaths(value: unknown, prefix?: string): string[];
112
+ //#endregion
@@ -7,22 +7,22 @@ import { SlackSubscriberConfig } from "./slack.cjs";
7
7
  import { EventSubscriber } from "autotel/event-subscriber";
8
8
  //#region src/factories.d.ts
9
9
  /** Create a Mixpanel events subscriber */
10
- declare function createMixpanelSubscriber(config: {
10
+ export declare function createMixpanelSubscriber(config: {
11
11
  token: string;
12
12
  enabled?: boolean;
13
13
  }): EventSubscriber;
14
14
  /** Create an Amplitude events subscriber */
15
- declare function createAmplitudeSubscriber(config: {
15
+ export declare function createAmplitudeSubscriber(config: {
16
16
  apiKey: string;
17
17
  enabled?: boolean;
18
18
  }): EventSubscriber;
19
19
  /** Create a Segment events subscriber */
20
- declare function createSegmentSubscriber(config: {
20
+ export declare function createSegmentSubscriber(config: {
21
21
  writeKey: string;
22
22
  enabled?: boolean;
23
23
  }): EventSubscriber;
24
24
  /** Create a Webhook events subscriber with retry and timeout support */
25
- declare function createWebhookSubscriber(config: {
25
+ export declare function createWebhookSubscriber(config: {
26
26
  url: string;
27
27
  method?: 'POST' | 'PUT';
28
28
  headers?: Record<string, string>;
@@ -32,13 +32,13 @@ declare function createWebhookSubscriber(config: {
32
32
  retryDelayMs?: number;
33
33
  }): EventSubscriber;
34
34
  /** Create a Slack events subscriber */
35
- declare function createSlackSubscriber(config: {
35
+ export declare function createSlackSubscriber(config: {
36
36
  webhookUrl: string;
37
37
  channel?: string;
38
38
  enabled?: boolean;
39
39
  }): EventSubscriber;
40
40
  /** Create a mock events subscriber for testing */
41
- declare function createMockSubscriber(): MockEventSubscriber;
41
+ export declare function createMockSubscriber(): MockEventSubscriber;
42
42
  /**
43
43
  * Strategy for composing multiple subscribers
44
44
  *
@@ -49,9 +49,9 @@ declare function createMockSubscriber(): MockEventSubscriber;
49
49
  * - `race`: Send to all, succeed when any succeeds
50
50
  * - `mirrored`: Send to primary, mirror to others (primary failure fails all)
51
51
  */
52
- type ComposeSubscriberStrategy = 'parallel' | 'failover' | 'round-robin' | 'random' | 'race' | 'mirrored';
52
+ export type ComposeSubscriberStrategy = 'parallel' | 'failover' | 'round-robin' | 'random' | 'race' | 'mirrored';
53
53
  /** Configuration options for composing multiple subscribers */
54
- type ComposeSubscribersOptions = {
54
+ export type ComposeSubscribersOptions = {
55
55
  name?: string;
56
56
  strategy?: ComposeSubscriberStrategy;
57
57
  maxAttemptsPerSubscriber?: number;
@@ -77,6 +77,6 @@ type ComposeSubscribersOptions = {
77
77
  * @param options - Configuration for composition strategy and retry behavior
78
78
  * @returns A composite EventSubscriber that applies the strategy
79
79
  */
80
- declare function composeSubscribers(subscribers: EventSubscriber[], options?: ComposeSubscribersOptions): EventSubscriber;
80
+ export declare function composeSubscribers(subscribers: EventSubscriber[], options?: ComposeSubscribersOptions): EventSubscriber;
81
81
  //#endregion
82
- export { type AmplitudeConfig, ComposeSubscriberStrategy, ComposeSubscribersOptions, type MixpanelConfig, type SegmentConfig, type SlackSubscriberConfig, type WebhookConfig, composeSubscribers, createAmplitudeSubscriber, createMixpanelSubscriber, createMockSubscriber, createSegmentSubscriber, createSlackSubscriber, createWebhookSubscriber };
82
+ export type { AmplitudeConfig, MixpanelConfig, SegmentConfig, SlackSubscriberConfig, WebhookConfig };
@@ -7,22 +7,22 @@ import { SlackSubscriberConfig } from "./slack.js";
7
7
  import { EventSubscriber } from "autotel/event-subscriber";
8
8
  //#region src/factories.d.ts
9
9
  /** Create a Mixpanel events subscriber */
10
- declare function createMixpanelSubscriber(config: {
10
+ export declare function createMixpanelSubscriber(config: {
11
11
  token: string;
12
12
  enabled?: boolean;
13
13
  }): EventSubscriber;
14
14
  /** Create an Amplitude events subscriber */
15
- declare function createAmplitudeSubscriber(config: {
15
+ export declare function createAmplitudeSubscriber(config: {
16
16
  apiKey: string;
17
17
  enabled?: boolean;
18
18
  }): EventSubscriber;
19
19
  /** Create a Segment events subscriber */
20
- declare function createSegmentSubscriber(config: {
20
+ export declare function createSegmentSubscriber(config: {
21
21
  writeKey: string;
22
22
  enabled?: boolean;
23
23
  }): EventSubscriber;
24
24
  /** Create a Webhook events subscriber with retry and timeout support */
25
- declare function createWebhookSubscriber(config: {
25
+ export declare function createWebhookSubscriber(config: {
26
26
  url: string;
27
27
  method?: 'POST' | 'PUT';
28
28
  headers?: Record<string, string>;
@@ -32,13 +32,13 @@ declare function createWebhookSubscriber(config: {
32
32
  retryDelayMs?: number;
33
33
  }): EventSubscriber;
34
34
  /** Create a Slack events subscriber */
35
- declare function createSlackSubscriber(config: {
35
+ export declare function createSlackSubscriber(config: {
36
36
  webhookUrl: string;
37
37
  channel?: string;
38
38
  enabled?: boolean;
39
39
  }): EventSubscriber;
40
40
  /** Create a mock events subscriber for testing */
41
- declare function createMockSubscriber(): MockEventSubscriber;
41
+ export declare function createMockSubscriber(): MockEventSubscriber;
42
42
  /**
43
43
  * Strategy for composing multiple subscribers
44
44
  *
@@ -49,9 +49,9 @@ declare function createMockSubscriber(): MockEventSubscriber;
49
49
  * - `race`: Send to all, succeed when any succeeds
50
50
  * - `mirrored`: Send to primary, mirror to others (primary failure fails all)
51
51
  */
52
- type ComposeSubscriberStrategy = 'parallel' | 'failover' | 'round-robin' | 'random' | 'race' | 'mirrored';
52
+ export type ComposeSubscriberStrategy = 'parallel' | 'failover' | 'round-robin' | 'random' | 'race' | 'mirrored';
53
53
  /** Configuration options for composing multiple subscribers */
54
- type ComposeSubscribersOptions = {
54
+ export type ComposeSubscribersOptions = {
55
55
  name?: string;
56
56
  strategy?: ComposeSubscriberStrategy;
57
57
  maxAttemptsPerSubscriber?: number;
@@ -77,6 +77,6 @@ type ComposeSubscribersOptions = {
77
77
  * @param options - Configuration for composition strategy and retry behavior
78
78
  * @returns A composite EventSubscriber that applies the strategy
79
79
  */
80
- declare function composeSubscribers(subscribers: EventSubscriber[], options?: ComposeSubscribersOptions): EventSubscriber;
80
+ export declare function composeSubscribers(subscribers: EventSubscriber[], options?: ComposeSubscribersOptions): EventSubscriber;
81
81
  //#endregion
82
- export { type AmplitudeConfig, ComposeSubscriberStrategy, ComposeSubscribersOptions, type MixpanelConfig, type SegmentConfig, type SlackSubscriberConfig, type WebhookConfig, composeSubscribers, createAmplitudeSubscriber, createMixpanelSubscriber, createMockSubscriber, createSegmentSubscriber, createSlackSubscriber, createWebhookSubscriber };
82
+ export type { AmplitudeConfig, MixpanelConfig, SegmentConfig, SlackSubscriberConfig, WebhookConfig };
package/dist/file.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as EventPayload, r as EventSubscriber$1 } from "./event-subscriber-base-DpZclJM4.cjs";
2
2
  import { EventAttributes } from "autotel/event-subscriber";
3
3
  //#region src/file.d.ts
4
- interface FileSubscriberConfig {
4
+ export interface FileSubscriberConfig {
5
5
  /** File path to append newline-delimited JSON events to. */
6
6
  path: string;
7
7
  /** Enable or disable the subscriber. Default `true`. */
@@ -16,7 +16,7 @@ interface FileSubscriberConfig {
16
16
  */
17
17
  transform?: (payload: EventPayload) => EventAttributes | null;
18
18
  }
19
- declare class FileSubscriber extends EventSubscriber$1 {
19
+ export declare class FileSubscriber extends EventSubscriber$1 {
20
20
  readonly name = "FileSubscriber";
21
21
  readonly version = "1.0.0";
22
22
  private readonly filePath;
@@ -31,5 +31,4 @@ declare class FileSubscriber extends EventSubscriber$1 {
31
31
  private write;
32
32
  shutdown(): Promise<void>;
33
33
  }
34
- //#endregion
35
- export { FileSubscriber, FileSubscriberConfig };
34
+ //#endregion
package/dist/file.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as EventPayload, r as EventSubscriber$1 } from "./event-subscriber-base-DpZclJM4.js";
2
2
  import { EventAttributes } from "autotel/event-subscriber";
3
3
  //#region src/file.d.ts
4
- interface FileSubscriberConfig {
4
+ export interface FileSubscriberConfig {
5
5
  /** File path to append newline-delimited JSON events to. */
6
6
  path: string;
7
7
  /** Enable or disable the subscriber. Default `true`. */
@@ -16,7 +16,7 @@ interface FileSubscriberConfig {
16
16
  */
17
17
  transform?: (payload: EventPayload) => EventAttributes | null;
18
18
  }
19
- declare class FileSubscriber extends EventSubscriber$1 {
19
+ export declare class FileSubscriber extends EventSubscriber$1 {
20
20
  readonly name = "FileSubscriber";
21
21
  readonly version = "1.0.0";
22
22
  private readonly filePath;
@@ -31,5 +31,4 @@ declare class FileSubscriber extends EventSubscriber$1 {
31
31
  private write;
32
32
  shutdown(): Promise<void>;
33
33
  }
34
- //#endregion
35
- export { FileSubscriber, FileSubscriberConfig };
34
+ //#endregion
package/dist/index.d.cts CHANGED
@@ -53,7 +53,7 @@ interface BufferStatus {
53
53
  *
54
54
  * Provides streaming-specific patterns on top of EventSubscriber.
55
55
  */
56
- declare abstract class StreamingEventSubscriber extends EventSubscriber {
56
+ export declare abstract class StreamingEventSubscriber extends EventSubscriber {
57
57
  protected config: Required<StreamingSubscriberConfig>;
58
58
  protected buffer: EventPayload[];
59
59
  protected flushIntervalHandle: NodeJS.Timeout | null;
@@ -132,4 +132,4 @@ declare abstract class StreamingEventSubscriber extends EventSubscriber {
132
132
  protected compressPayload(payload: string): Promise<Buffer | string>;
133
133
  }
134
134
  //#endregion
135
- export { ARCHITECTURE_SNAPSHOT_SPEC, type AmplitudeConfig, AmplitudeSubscriber, type ArchitectureSnapshot, type ArchitectureSnapshotConfig, ArchitectureSnapshotSubscriber, type EventObservation, type EventPayload, EventSubscriber, FileSubscriber, type FileSubscriberConfig, type LokiConfig, LokiSubscriber, type MixpanelConfig, MixpanelSubscriber, type PostHogConfig, PostHogSubscriber, type SecurityAlert, type SecurityAlertSeverity, SecuritySubscriber, type SecuritySubscriberConfig, type SegmentConfig, SegmentSubscriber, SlackSubscriber, type SlackSubscriberConfig, StreamingEventSubscriber, type WebhookConfig, WebhookSubscriber, extractFieldPaths };
135
+ export { ARCHITECTURE_SNAPSHOT_SPEC, type AmplitudeConfig, AmplitudeSubscriber, type ArchitectureSnapshot, type ArchitectureSnapshotConfig, ArchitectureSnapshotSubscriber, type EventObservation, type EventPayload, EventSubscriber, FileSubscriber, type FileSubscriberConfig, type LokiConfig, LokiSubscriber, type MixpanelConfig, MixpanelSubscriber, type PostHogConfig, PostHogSubscriber, type SecurityAlert, type SecurityAlertSeverity, SecuritySubscriber, type SecuritySubscriberConfig, type SegmentConfig, SegmentSubscriber, SlackSubscriber, type SlackSubscriberConfig, type WebhookConfig, WebhookSubscriber, extractFieldPaths };
package/dist/index.d.ts CHANGED
@@ -53,7 +53,7 @@ interface BufferStatus {
53
53
  *
54
54
  * Provides streaming-specific patterns on top of EventSubscriber.
55
55
  */
56
- declare abstract class StreamingEventSubscriber extends EventSubscriber {
56
+ export declare abstract class StreamingEventSubscriber extends EventSubscriber {
57
57
  protected config: Required<StreamingSubscriberConfig>;
58
58
  protected buffer: EventPayload[];
59
59
  protected flushIntervalHandle: NodeJS.Timeout | null;
@@ -132,4 +132,4 @@ declare abstract class StreamingEventSubscriber extends EventSubscriber {
132
132
  protected compressPayload(payload: string): Promise<Buffer | string>;
133
133
  }
134
134
  //#endregion
135
- export { ARCHITECTURE_SNAPSHOT_SPEC, type AmplitudeConfig, AmplitudeSubscriber, type ArchitectureSnapshot, type ArchitectureSnapshotConfig, ArchitectureSnapshotSubscriber, type EventObservation, type EventPayload, EventSubscriber, FileSubscriber, type FileSubscriberConfig, type LokiConfig, LokiSubscriber, type MixpanelConfig, MixpanelSubscriber, type PostHogConfig, PostHogSubscriber, type SecurityAlert, type SecurityAlertSeverity, SecuritySubscriber, type SecuritySubscriberConfig, type SegmentConfig, SegmentSubscriber, SlackSubscriber, type SlackSubscriberConfig, StreamingEventSubscriber, type WebhookConfig, WebhookSubscriber, extractFieldPaths };
135
+ export { ARCHITECTURE_SNAPSHOT_SPEC, type AmplitudeConfig, AmplitudeSubscriber, type ArchitectureSnapshot, type ArchitectureSnapshotConfig, ArchitectureSnapshotSubscriber, type EventObservation, type EventPayload, EventSubscriber, FileSubscriber, type FileSubscriberConfig, type LokiConfig, LokiSubscriber, type MixpanelConfig, MixpanelSubscriber, type PostHogConfig, PostHogSubscriber, type SecurityAlert, type SecurityAlertSeverity, SecuritySubscriber, type SecuritySubscriberConfig, type SegmentConfig, SegmentSubscriber, SlackSubscriber, type SlackSubscriberConfig, type WebhookConfig, WebhookSubscriber, extractFieldPaths };
package/dist/loki.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventAttributes, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus } from "autotel/event-subscriber";
2
2
  //#region src/loki.d.ts
3
- interface LokiConfig {
3
+ export interface LokiConfig {
4
4
  /**
5
5
  * Base URL of the Loki instance, without the push path.
6
6
  * Falls back to `LOKI_ENDPOINT`, `LOKI_URL`, then `LOKI_BASE_URL`.
@@ -49,20 +49,20 @@ interface LokiConfig {
49
49
  enabled?: boolean;
50
50
  }
51
51
  /** One event as it is written to the Loki line. */
52
- type LokiEvent = EventAttributes & {
52
+ export type LokiEvent = EventAttributes & {
53
53
  timestamp?: string;
54
54
  };
55
55
  interface LokiStream {
56
56
  stream: Record<string, string>;
57
57
  values: [string, string][];
58
58
  }
59
- interface LokiPayload {
59
+ export interface LokiPayload {
60
60
  streams: LokiStream[];
61
61
  }
62
62
  /** Resolve the push URL, tolerating an endpoint that already carries the path. */
63
- declare function resolveLokiPushUrl(endpoint: string): string;
63
+ export declare function resolveLokiPushUrl(endpoint: string): string;
64
64
  /** Loki entry timestamps are nanosecond epoch strings. */
65
- declare function toLokiTimestamp(timestamp?: string): string;
65
+ export declare function toLokiTimestamp(timestamp?: string): string;
66
66
  /**
67
67
  * Build the stream labels for one event.
68
68
  *
@@ -70,20 +70,20 @@ declare function toLokiTimestamp(timestamp?: string): string;
70
70
  * Objects and arrays are skipped rather than stringified, because a serialised
71
71
  * object is exactly the unbounded label value that wrecks a Loki instance.
72
72
  */
73
- declare function toLokiLabels(event: LokiEvent, config?: Pick<LokiConfig, 'labelFields' | 'labels'>): Record<string, string>;
73
+ export declare function toLokiLabels(event: LokiEvent, config?: Pick<LokiConfig, 'labelFields' | 'labels'>): Record<string, string>;
74
74
  /**
75
75
  * Group events into streams by label set.
76
76
  *
77
77
  * Loki rejects a push whose entries run backwards within a stream, so each
78
78
  * stream's values are sorted by timestamp before they go out.
79
79
  */
80
- declare function buildLokiPayload(events: LokiEvent[], config?: Pick<LokiConfig, 'labelFields' | 'labels'>): LokiPayload;
80
+ export declare function buildLokiPayload(events: LokiEvent[], config?: Pick<LokiConfig, 'labelFields' | 'labels'>): LokiPayload;
81
81
  /** Auth and tenancy headers for a resolved config. */
82
- declare function toLokiHeaders(config: Pick<LokiConfig, 'apiKey' | 'user' | 'tenantId'>): Record<string, string>;
82
+ export declare function toLokiHeaders(config: Pick<LokiConfig, 'apiKey' | 'user' | 'tenantId'>): Record<string, string>;
83
83
  /** Push a batch of events without going through a subscriber. */
84
- declare function sendBatchToLoki(events: LokiEvent[], config?: LokiConfig): Promise<void>;
84
+ export declare function sendBatchToLoki(events: LokiEvent[], config?: LokiConfig): Promise<void>;
85
85
  /** Push a single event without going through a subscriber. */
86
- declare function sendToLoki(event: LokiEvent, config?: LokiConfig): Promise<void>;
86
+ export declare function sendToLoki(event: LokiEvent, config?: LokiConfig): Promise<void>;
87
87
  /**
88
88
  * Buffers events and pushes them to Loki as grouped streams.
89
89
  *
@@ -91,7 +91,7 @@ declare function sendToLoki(event: LokiEvent, config?: LokiConfig): Promise<void
91
91
  * request carrying several streams costs far less than one request per event,
92
92
  * and grouping is what lets entries be ordered within a stream.
93
93
  */
94
- declare class LokiSubscriber implements EventSubscriber {
94
+ export declare class LokiSubscriber implements EventSubscriber {
95
95
  readonly name = "LokiSubscriber";
96
96
  readonly version = "1.0.0";
97
97
  private readonly config;
@@ -115,5 +115,4 @@ declare class LokiSubscriber implements EventSubscriber {
115
115
  private track;
116
116
  shutdown(): Promise<void>;
117
117
  }
118
- //#endregion
119
- export { LokiConfig, LokiEvent, LokiPayload, LokiSubscriber, buildLokiPayload, resolveLokiPushUrl, sendBatchToLoki, sendToLoki, toLokiHeaders, toLokiLabels, toLokiTimestamp };
118
+ //#endregion
package/dist/loki.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventAttributes, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus } from "autotel/event-subscriber";
2
2
  //#region src/loki.d.ts
3
- interface LokiConfig {
3
+ export interface LokiConfig {
4
4
  /**
5
5
  * Base URL of the Loki instance, without the push path.
6
6
  * Falls back to `LOKI_ENDPOINT`, `LOKI_URL`, then `LOKI_BASE_URL`.
@@ -49,20 +49,20 @@ interface LokiConfig {
49
49
  enabled?: boolean;
50
50
  }
51
51
  /** One event as it is written to the Loki line. */
52
- type LokiEvent = EventAttributes & {
52
+ export type LokiEvent = EventAttributes & {
53
53
  timestamp?: string;
54
54
  };
55
55
  interface LokiStream {
56
56
  stream: Record<string, string>;
57
57
  values: [string, string][];
58
58
  }
59
- interface LokiPayload {
59
+ export interface LokiPayload {
60
60
  streams: LokiStream[];
61
61
  }
62
62
  /** Resolve the push URL, tolerating an endpoint that already carries the path. */
63
- declare function resolveLokiPushUrl(endpoint: string): string;
63
+ export declare function resolveLokiPushUrl(endpoint: string): string;
64
64
  /** Loki entry timestamps are nanosecond epoch strings. */
65
- declare function toLokiTimestamp(timestamp?: string): string;
65
+ export declare function toLokiTimestamp(timestamp?: string): string;
66
66
  /**
67
67
  * Build the stream labels for one event.
68
68
  *
@@ -70,20 +70,20 @@ declare function toLokiTimestamp(timestamp?: string): string;
70
70
  * Objects and arrays are skipped rather than stringified, because a serialised
71
71
  * object is exactly the unbounded label value that wrecks a Loki instance.
72
72
  */
73
- declare function toLokiLabels(event: LokiEvent, config?: Pick<LokiConfig, 'labelFields' | 'labels'>): Record<string, string>;
73
+ export declare function toLokiLabels(event: LokiEvent, config?: Pick<LokiConfig, 'labelFields' | 'labels'>): Record<string, string>;
74
74
  /**
75
75
  * Group events into streams by label set.
76
76
  *
77
77
  * Loki rejects a push whose entries run backwards within a stream, so each
78
78
  * stream's values are sorted by timestamp before they go out.
79
79
  */
80
- declare function buildLokiPayload(events: LokiEvent[], config?: Pick<LokiConfig, 'labelFields' | 'labels'>): LokiPayload;
80
+ export declare function buildLokiPayload(events: LokiEvent[], config?: Pick<LokiConfig, 'labelFields' | 'labels'>): LokiPayload;
81
81
  /** Auth and tenancy headers for a resolved config. */
82
- declare function toLokiHeaders(config: Pick<LokiConfig, 'apiKey' | 'user' | 'tenantId'>): Record<string, string>;
82
+ export declare function toLokiHeaders(config: Pick<LokiConfig, 'apiKey' | 'user' | 'tenantId'>): Record<string, string>;
83
83
  /** Push a batch of events without going through a subscriber. */
84
- declare function sendBatchToLoki(events: LokiEvent[], config?: LokiConfig): Promise<void>;
84
+ export declare function sendBatchToLoki(events: LokiEvent[], config?: LokiConfig): Promise<void>;
85
85
  /** Push a single event without going through a subscriber. */
86
- declare function sendToLoki(event: LokiEvent, config?: LokiConfig): Promise<void>;
86
+ export declare function sendToLoki(event: LokiEvent, config?: LokiConfig): Promise<void>;
87
87
  /**
88
88
  * Buffers events and pushes them to Loki as grouped streams.
89
89
  *
@@ -91,7 +91,7 @@ declare function sendToLoki(event: LokiEvent, config?: LokiConfig): Promise<void
91
91
  * request carrying several streams costs far less than one request per event,
92
92
  * and grouping is what lets entries be ordered within a stream.
93
93
  */
94
- declare class LokiSubscriber implements EventSubscriber {
94
+ export declare class LokiSubscriber implements EventSubscriber {
95
95
  readonly name = "LokiSubscriber";
96
96
  readonly version = "1.0.0";
97
97
  private readonly config;
@@ -115,5 +115,4 @@ declare class LokiSubscriber implements EventSubscriber {
115
115
  private track;
116
116
  shutdown(): Promise<void>;
117
117
  }
118
- //#endregion
119
- export { LokiConfig, LokiEvent, LokiPayload, LokiSubscriber, buildLokiPayload, resolveLokiPushUrl, sendBatchToLoki, sendToLoki, toLokiHeaders, toLokiLabels, toLokiTimestamp };
118
+ //#endregion