autotel-subscribers 45.0.0 → 46.0.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 (113) hide show
  1. package/dist/amplitude.cjs +1 -2
  2. package/dist/amplitude.d.cts +1 -2
  3. package/dist/amplitude.d.ts +1 -2
  4. package/dist/amplitude.js +1 -2
  5. package/dist/architecture-snapshot.cjs +1 -2
  6. package/dist/architecture-snapshot.d.cts +1 -2
  7. package/dist/architecture-snapshot.d.ts +1 -2
  8. package/dist/architecture-snapshot.js +1 -2
  9. package/dist/event-subscriber-base-C_F3Ycbe.cjs +1 -2
  10. package/dist/event-subscriber-base-Day2ml6V.js +1 -2
  11. package/dist/event-subscriber-base-DpZclJM4.d.cts +1 -2
  12. package/dist/event-subscriber-base-DpZclJM4.d.ts +1 -2
  13. package/dist/factories.cjs +1 -2
  14. package/dist/factories.d.cts +1 -2
  15. package/dist/factories.d.ts +1 -2
  16. package/dist/factories.js +1 -2
  17. package/dist/file.cjs +1 -2
  18. package/dist/file.d.cts +1 -2
  19. package/dist/file.d.ts +1 -2
  20. package/dist/file.js +1 -2
  21. package/dist/index.cjs +3 -2
  22. package/dist/index.d.cts +2 -2
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.js +2 -2
  25. package/dist/loki.cjs +229 -0
  26. package/dist/loki.d.cts +119 -0
  27. package/dist/loki.d.ts +119 -0
  28. package/dist/loki.js +221 -0
  29. package/dist/middleware.cjs +1 -2
  30. package/dist/middleware.d.cts +1 -2
  31. package/dist/middleware.d.ts +1 -2
  32. package/dist/middleware.js +1 -2
  33. package/dist/mixpanel.cjs +1 -2
  34. package/dist/mixpanel.d.cts +1 -2
  35. package/dist/mixpanel.d.ts +1 -2
  36. package/dist/mixpanel.js +1 -2
  37. package/dist/posthog-ByP8BmHb.js +1 -2
  38. package/dist/posthog-DOOBZanH.cjs +1 -2
  39. package/dist/posthog.d.cts +1 -2
  40. package/dist/posthog.d.ts +1 -2
  41. package/dist/security.cjs +1 -2
  42. package/dist/security.d.cts +1 -2
  43. package/dist/security.d.ts +1 -2
  44. package/dist/security.js +1 -2
  45. package/dist/segment.cjs +1 -2
  46. package/dist/segment.d.cts +1 -2
  47. package/dist/segment.d.ts +1 -2
  48. package/dist/segment.js +1 -2
  49. package/dist/slack.cjs +1 -2
  50. package/dist/slack.d.cts +1 -2
  51. package/dist/slack.d.ts +1 -2
  52. package/dist/slack.js +1 -2
  53. package/dist/webhook-delivery-D3v50C81.js +1 -2
  54. package/dist/webhook-delivery-DZeUlZhi.cjs +1 -2
  55. package/dist/webhook.cjs +1 -2
  56. package/dist/webhook.d.cts +1 -2
  57. package/dist/webhook.d.ts +1 -2
  58. package/dist/webhook.js +1 -2
  59. package/package.json +17 -10
  60. package/dist/amplitude.cjs.map +0 -1
  61. package/dist/amplitude.d.cts.map +0 -1
  62. package/dist/amplitude.d.ts.map +0 -1
  63. package/dist/amplitude.js.map +0 -1
  64. package/dist/architecture-snapshot.cjs.map +0 -1
  65. package/dist/architecture-snapshot.d.cts.map +0 -1
  66. package/dist/architecture-snapshot.d.ts.map +0 -1
  67. package/dist/architecture-snapshot.js.map +0 -1
  68. package/dist/event-subscriber-base-C_F3Ycbe.cjs.map +0 -1
  69. package/dist/event-subscriber-base-Day2ml6V.js.map +0 -1
  70. package/dist/event-subscriber-base-DpZclJM4.d.cts.map +0 -1
  71. package/dist/event-subscriber-base-DpZclJM4.d.ts.map +0 -1
  72. package/dist/factories.cjs.map +0 -1
  73. package/dist/factories.d.cts.map +0 -1
  74. package/dist/factories.d.ts.map +0 -1
  75. package/dist/factories.js.map +0 -1
  76. package/dist/file.cjs.map +0 -1
  77. package/dist/file.d.cts.map +0 -1
  78. package/dist/file.d.ts.map +0 -1
  79. package/dist/file.js.map +0 -1
  80. package/dist/index.cjs.map +0 -1
  81. package/dist/index.d.cts.map +0 -1
  82. package/dist/index.d.ts.map +0 -1
  83. package/dist/index.js.map +0 -1
  84. package/dist/middleware.cjs.map +0 -1
  85. package/dist/middleware.d.cts.map +0 -1
  86. package/dist/middleware.d.ts.map +0 -1
  87. package/dist/middleware.js.map +0 -1
  88. package/dist/mixpanel.cjs.map +0 -1
  89. package/dist/mixpanel.d.cts.map +0 -1
  90. package/dist/mixpanel.d.ts.map +0 -1
  91. package/dist/mixpanel.js.map +0 -1
  92. package/dist/posthog-ByP8BmHb.js.map +0 -1
  93. package/dist/posthog-DOOBZanH.cjs.map +0 -1
  94. package/dist/posthog.d.cts.map +0 -1
  95. package/dist/posthog.d.ts.map +0 -1
  96. package/dist/security.cjs.map +0 -1
  97. package/dist/security.d.cts.map +0 -1
  98. package/dist/security.d.ts.map +0 -1
  99. package/dist/security.js.map +0 -1
  100. package/dist/segment.cjs.map +0 -1
  101. package/dist/segment.d.cts.map +0 -1
  102. package/dist/segment.d.ts.map +0 -1
  103. package/dist/segment.js.map +0 -1
  104. package/dist/slack.cjs.map +0 -1
  105. package/dist/slack.d.cts.map +0 -1
  106. package/dist/slack.d.ts.map +0 -1
  107. package/dist/slack.js.map +0 -1
  108. package/dist/webhook-delivery-D3v50C81.js.map +0 -1
  109. package/dist/webhook-delivery-DZeUlZhi.cjs.map +0 -1
  110. package/dist/webhook.cjs.map +0 -1
  111. package/dist/webhook.d.cts.map +0 -1
  112. package/dist/webhook.d.ts.map +0 -1
  113. package/dist/webhook.js.map +0 -1
@@ -84,5 +84,4 @@ var AmplitudeSubscriber = class {
84
84
  };
85
85
 
86
86
  //#endregion
87
- exports.AmplitudeSubscriber = AmplitudeSubscriber;
88
- //# sourceMappingURL=amplitude.cjs.map
87
+ exports.AmplitudeSubscriber = AmplitudeSubscriber;
@@ -24,5 +24,4 @@ declare class AmplitudeSubscriber implements EventSubscriber {
24
24
  shutdown(): Promise<void>;
25
25
  }
26
26
  //#endregion
27
- export { AmplitudeConfig, AmplitudeSubscriber };
28
- //# sourceMappingURL=amplitude.d.cts.map
27
+ export { AmplitudeConfig, AmplitudeSubscriber };
@@ -24,5 +24,4 @@ declare class AmplitudeSubscriber implements EventSubscriber {
24
24
  shutdown(): Promise<void>;
25
25
  }
26
26
  //#endregion
27
- export { AmplitudeConfig, AmplitudeSubscriber };
28
- //# sourceMappingURL=amplitude.d.ts.map
27
+ export { AmplitudeConfig, AmplitudeSubscriber };
package/dist/amplitude.js CHANGED
@@ -82,5 +82,4 @@ var AmplitudeSubscriber = class {
82
82
  };
83
83
 
84
84
  //#endregion
85
- export { AmplitudeSubscriber };
86
- //# sourceMappingURL=amplitude.js.map
85
+ export { AmplitudeSubscriber };
@@ -290,5 +290,4 @@ function comparePrimitiveValues(a, b) {
290
290
  //#endregion
291
291
  exports.ARCHITECTURE_SNAPSHOT_SPEC = ARCHITECTURE_SNAPSHOT_SPEC;
292
292
  exports.ArchitectureSnapshotSubscriber = ArchitectureSnapshotSubscriber;
293
- exports.extractFieldPaths = extractFieldPaths;
294
- //# sourceMappingURL=architecture-snapshot.cjs.map
293
+ exports.extractFieldPaths = extractFieldPaths;
@@ -91,5 +91,4 @@ declare class ArchitectureSnapshotSubscriber extends EventSubscriber {
91
91
  */
92
92
  declare function extractFieldPaths(value: unknown, prefix?: string): string[];
93
93
  //#endregion
94
- export { ARCHITECTURE_SNAPSHOT_SPEC, ArchitectureSnapshot, ArchitectureSnapshotConfig, ArchitectureSnapshotSubscriber, EventObservation, FieldStats, extractFieldPaths };
95
- //# sourceMappingURL=architecture-snapshot.d.cts.map
94
+ export { ARCHITECTURE_SNAPSHOT_SPEC, ArchitectureSnapshot, ArchitectureSnapshotConfig, ArchitectureSnapshotSubscriber, EventObservation, FieldStats, extractFieldPaths };
@@ -91,5 +91,4 @@ declare class ArchitectureSnapshotSubscriber extends EventSubscriber {
91
91
  */
92
92
  declare function extractFieldPaths(value: unknown, prefix?: string): string[];
93
93
  //#endregion
94
- export { ARCHITECTURE_SNAPSHOT_SPEC, ArchitectureSnapshot, ArchitectureSnapshotConfig, ArchitectureSnapshotSubscriber, EventObservation, FieldStats, extractFieldPaths };
95
- //# sourceMappingURL=architecture-snapshot.d.ts.map
94
+ export { ARCHITECTURE_SNAPSHOT_SPEC, ArchitectureSnapshot, ArchitectureSnapshotConfig, ArchitectureSnapshotSubscriber, EventObservation, FieldStats, extractFieldPaths };
@@ -284,5 +284,4 @@ function comparePrimitiveValues(a, b) {
284
284
  }
285
285
 
286
286
  //#endregion
287
- export { ARCHITECTURE_SNAPSHOT_SPEC, ArchitectureSnapshotSubscriber, extractFieldPaths };
288
- //# sourceMappingURL=architecture-snapshot.js.map
287
+ export { ARCHITECTURE_SNAPSHOT_SPEC, ArchitectureSnapshotSubscriber, extractFieldPaths };
@@ -206,5 +206,4 @@ Object.defineProperty(exports, 'EventSubscriber', {
206
206
  get: function () {
207
207
  return EventSubscriber;
208
208
  }
209
- });
210
- //# sourceMappingURL=event-subscriber-base-C_F3Ycbe.cjs.map
209
+ });
@@ -200,5 +200,4 @@ var EventSubscriber = class {
200
200
  };
201
201
 
202
202
  //#endregion
203
- export { EventSubscriber as t };
204
- //# sourceMappingURL=event-subscriber-base-Day2ml6V.js.map
203
+ export { EventSubscriber as t };
@@ -160,5 +160,4 @@ declare abstract class EventSubscriber$1 implements EventSubscriber {
160
160
  private sendWithErrorHandling;
161
161
  }
162
162
  //#endregion
163
- export { EventPayload as n, EventSubscriber$1 as r, AutotelEventContext$1 as t };
164
- //# sourceMappingURL=event-subscriber-base-DpZclJM4.d.cts.map
163
+ export { EventPayload as n, EventSubscriber$1 as r, AutotelEventContext$1 as t };
@@ -160,5 +160,4 @@ declare abstract class EventSubscriber$1 implements EventSubscriber {
160
160
  private sendWithErrorHandling;
161
161
  }
162
162
  //#endregion
163
- export { EventPayload as n, EventSubscriber$1 as r, AutotelEventContext$1 as t };
164
- //# sourceMappingURL=event-subscriber-base-DpZclJM4.d.ts.map
163
+ export { EventPayload as n, EventSubscriber$1 as r, AutotelEventContext$1 as t };
@@ -371,5 +371,4 @@ exports.createMockSubscriber = createMockSubscriber;
371
371
  exports.createPostHogSubscriber = createPostHogSubscriber;
372
372
  exports.createSegmentSubscriber = createSegmentSubscriber;
373
373
  exports.createSlackSubscriber = createSlackSubscriber;
374
- exports.createWebhookSubscriber = createWebhookSubscriber;
375
- //# sourceMappingURL=factories.cjs.map
374
+ exports.createWebhookSubscriber = createWebhookSubscriber;
@@ -165,5 +165,4 @@ type ComposeSubscribersOptions = {
165
165
  */
166
166
  declare function composeSubscribers(subscribers: EventSubscriber[], options?: ComposeSubscribersOptions): EventSubscriber;
167
167
  //#endregion
168
- export { type AmplitudeConfig, ComposeSubscriberStrategy, ComposeSubscribersOptions, type MixpanelConfig, type PostHogConfig, type SegmentConfig, type SlackSubscriberConfig, type WebhookConfig, composeSubscribers, createAmplitudeSubscriber, createMixpanelSubscriber, createMockSubscriber, createPostHogSubscriber, createSegmentSubscriber, createSlackSubscriber, createWebhookSubscriber };
169
- //# sourceMappingURL=factories.d.cts.map
168
+ export { type AmplitudeConfig, ComposeSubscriberStrategy, ComposeSubscribersOptions, type MixpanelConfig, type PostHogConfig, type SegmentConfig, type SlackSubscriberConfig, type WebhookConfig, composeSubscribers, createAmplitudeSubscriber, createMixpanelSubscriber, createMockSubscriber, createPostHogSubscriber, createSegmentSubscriber, createSlackSubscriber, createWebhookSubscriber };
@@ -165,5 +165,4 @@ type ComposeSubscribersOptions = {
165
165
  */
166
166
  declare function composeSubscribers(subscribers: EventSubscriber[], options?: ComposeSubscribersOptions): EventSubscriber;
167
167
  //#endregion
168
- export { type AmplitudeConfig, ComposeSubscriberStrategy, ComposeSubscribersOptions, type MixpanelConfig, type PostHogConfig, type SegmentConfig, type SlackSubscriberConfig, type WebhookConfig, composeSubscribers, createAmplitudeSubscriber, createMixpanelSubscriber, createMockSubscriber, createPostHogSubscriber, createSegmentSubscriber, createSlackSubscriber, createWebhookSubscriber };
169
- //# sourceMappingURL=factories.d.ts.map
168
+ export { type AmplitudeConfig, ComposeSubscriberStrategy, ComposeSubscribersOptions, type MixpanelConfig, type PostHogConfig, type SegmentConfig, type SlackSubscriberConfig, type WebhookConfig, composeSubscribers, createAmplitudeSubscriber, createMixpanelSubscriber, createMockSubscriber, createPostHogSubscriber, createSegmentSubscriber, createSlackSubscriber, createWebhookSubscriber };
package/dist/factories.js CHANGED
@@ -363,5 +363,4 @@ function composeSubscribers(subscribers, options = {}) {
363
363
  }
364
364
 
365
365
  //#endregion
366
- export { composeSubscribers, createAmplitudeSubscriber, createMixpanelSubscriber, createMockSubscriber, createPostHogSubscriber, createSegmentSubscriber, createSlackSubscriber, createWebhookSubscriber };
367
- //# sourceMappingURL=factories.js.map
366
+ export { composeSubscribers, createAmplitudeSubscriber, createMixpanelSubscriber, createMockSubscriber, createPostHogSubscriber, createSegmentSubscriber, createSlackSubscriber, createWebhookSubscriber };
package/dist/file.cjs CHANGED
@@ -66,5 +66,4 @@ var FileSubscriber = class extends require_event_subscriber_base.EventSubscriber
66
66
  };
67
67
 
68
68
  //#endregion
69
- exports.FileSubscriber = FileSubscriber;
70
- //# sourceMappingURL=file.cjs.map
69
+ exports.FileSubscriber = FileSubscriber;
package/dist/file.d.cts CHANGED
@@ -31,5 +31,4 @@ declare class FileSubscriber extends EventSubscriber {
31
31
  shutdown(): Promise<void>;
32
32
  }
33
33
  //#endregion
34
- export { FileSubscriber, FileSubscriberConfig };
35
- //# sourceMappingURL=file.d.cts.map
34
+ export { FileSubscriber, FileSubscriberConfig };
package/dist/file.d.ts CHANGED
@@ -31,5 +31,4 @@ declare class FileSubscriber extends EventSubscriber {
31
31
  shutdown(): Promise<void>;
32
32
  }
33
33
  //#endregion
34
- export { FileSubscriber, FileSubscriberConfig };
35
- //# sourceMappingURL=file.d.ts.map
34
+ export { FileSubscriber, FileSubscriberConfig };
package/dist/file.js CHANGED
@@ -63,5 +63,4 @@ var FileSubscriber = class extends EventSubscriber {
63
63
  };
64
64
 
65
65
  //#endregion
66
- export { FileSubscriber };
67
- //# sourceMappingURL=file.js.map
66
+ export { FileSubscriber };
package/dist/index.cjs CHANGED
@@ -7,6 +7,7 @@ const require_amplitude = require('./amplitude.cjs');
7
7
  const require_slack = require('./slack.cjs');
8
8
  const require_security = require('./security.cjs');
9
9
  const require_webhook = require('./webhook.cjs');
10
+ const require_loki = require('./loki.cjs');
10
11
  const require_architecture_snapshot = require('./architecture-snapshot.cjs');
11
12
  const require_file = require('./file.cjs');
12
13
 
@@ -185,6 +186,7 @@ exports.AmplitudeSubscriber = require_amplitude.AmplitudeSubscriber;
185
186
  exports.ArchitectureSnapshotSubscriber = require_architecture_snapshot.ArchitectureSnapshotSubscriber;
186
187
  exports.EventSubscriber = require_event_subscriber_base.EventSubscriber;
187
188
  exports.FileSubscriber = require_file.FileSubscriber;
189
+ exports.LokiSubscriber = require_loki.LokiSubscriber;
188
190
  exports.MixpanelSubscriber = require_mixpanel.MixpanelSubscriber;
189
191
  exports.PostHogSubscriber = require_posthog.PostHogSubscriber;
190
192
  exports.SecuritySubscriber = require_security.SecuritySubscriber;
@@ -192,5 +194,4 @@ exports.SegmentSubscriber = require_segment.SegmentSubscriber;
192
194
  exports.SlackSubscriber = require_slack.SlackSubscriber;
193
195
  exports.StreamingEventSubscriber = StreamingEventSubscriber;
194
196
  exports.WebhookSubscriber = require_webhook.WebhookSubscriber;
195
- exports.extractFieldPaths = require_architecture_snapshot.extractFieldPaths;
196
- //# sourceMappingURL=index.cjs.map
197
+ exports.extractFieldPaths = require_architecture_snapshot.extractFieldPaths;
package/dist/index.d.cts CHANGED
@@ -8,6 +8,7 @@ import { WebhookConfig, WebhookSubscriber } from "./webhook.cjs";
8
8
  import { SlackSubscriber, SlackSubscriberConfig } from "./slack.cjs";
9
9
  import { FileSubscriber, FileSubscriberConfig } from "./file.cjs";
10
10
  import { SecurityAlert, SecurityAlertSeverity, SecuritySubscriber, SecuritySubscriberConfig } from "./security.cjs";
11
+ import { LokiConfig, LokiSubscriber } from "./loki.cjs";
11
12
  //#region src/streaming-event-subscriber.d.ts
12
13
  /**
13
14
  * Buffer overflow strategy
@@ -131,5 +132,4 @@ declare abstract class StreamingEventSubscriber extends EventSubscriber {
131
132
  protected compressPayload(payload: string): Promise<Buffer | string>;
132
133
  }
133
134
  //#endregion
134
- export { ARCHITECTURE_SNAPSHOT_SPEC, type AmplitudeConfig, AmplitudeSubscriber, type ArchitectureSnapshot, type ArchitectureSnapshotConfig, ArchitectureSnapshotSubscriber, type EventObservation, type EventPayload, EventSubscriber, FileSubscriber, type FileSubscriberConfig, 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
- //# sourceMappingURL=index.d.cts.map
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 };
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import { WebhookConfig, WebhookSubscriber } from "./webhook.js";
8
8
  import { SlackSubscriber, SlackSubscriberConfig } from "./slack.js";
9
9
  import { FileSubscriber, FileSubscriberConfig } from "./file.js";
10
10
  import { SecurityAlert, SecurityAlertSeverity, SecuritySubscriber, SecuritySubscriberConfig } from "./security.js";
11
+ import { LokiConfig, LokiSubscriber } from "./loki.js";
11
12
  //#region src/streaming-event-subscriber.d.ts
12
13
  /**
13
14
  * Buffer overflow strategy
@@ -131,5 +132,4 @@ declare abstract class StreamingEventSubscriber extends EventSubscriber {
131
132
  protected compressPayload(payload: string): Promise<Buffer | string>;
132
133
  }
133
134
  //#endregion
134
- export { ARCHITECTURE_SNAPSHOT_SPEC, type AmplitudeConfig, AmplitudeSubscriber, type ArchitectureSnapshot, type ArchitectureSnapshotConfig, ArchitectureSnapshotSubscriber, type EventObservation, type EventPayload, EventSubscriber, FileSubscriber, type FileSubscriberConfig, 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
- //# sourceMappingURL=index.d.ts.map
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 };
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ import { AmplitudeSubscriber } from "./amplitude.js";
6
6
  import { SlackSubscriber } from "./slack.js";
7
7
  import { SecuritySubscriber } from "./security.js";
8
8
  import { WebhookSubscriber } from "./webhook.js";
9
+ import { LokiSubscriber } from "./loki.js";
9
10
  import { ARCHITECTURE_SNAPSHOT_SPEC, ArchitectureSnapshotSubscriber, extractFieldPaths } from "./architecture-snapshot.js";
10
11
  import { FileSubscriber } from "./file.js";
11
12
 
@@ -179,5 +180,4 @@ var StreamingEventSubscriber = class extends EventSubscriber {
179
180
  };
180
181
 
181
182
  //#endregion
182
- export { ARCHITECTURE_SNAPSHOT_SPEC, AmplitudeSubscriber, ArchitectureSnapshotSubscriber, EventSubscriber, FileSubscriber, MixpanelSubscriber, PostHogSubscriber, SecuritySubscriber, SegmentSubscriber, SlackSubscriber, StreamingEventSubscriber, WebhookSubscriber, extractFieldPaths };
183
- //# sourceMappingURL=index.js.map
183
+ export { ARCHITECTURE_SNAPSHOT_SPEC, AmplitudeSubscriber, ArchitectureSnapshotSubscriber, EventSubscriber, FileSubscriber, LokiSubscriber, MixpanelSubscriber, PostHogSubscriber, SecuritySubscriber, SegmentSubscriber, SlackSubscriber, StreamingEventSubscriber, WebhookSubscriber, extractFieldPaths };
package/dist/loki.cjs ADDED
@@ -0,0 +1,229 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_webhook_delivery = require('./webhook-delivery-DZeUlZhi.cjs');
3
+
4
+ //#region src/loki.ts
5
+ /** Push path appended to {@link LokiConfig.endpoint}. */
6
+ const LOKI_PUSH_PATH = "/loki/api/v1/push";
7
+ /**
8
+ * Fields promoted to Loki labels when none are configured. Deliberately short:
9
+ * every distinct combination of label values is a separate stream.
10
+ */
11
+ const DEFAULT_LABEL_FIELDS = [
12
+ "service",
13
+ "environment",
14
+ "level"
15
+ ];
16
+ function firstEnv(...names) {
17
+ for (const name of names) {
18
+ const value = process.env[name];
19
+ if (value) return value;
20
+ }
21
+ }
22
+ /** Resolve the push URL, tolerating an endpoint that already carries the path. */
23
+ function resolveLokiPushUrl(endpoint) {
24
+ const trimmed = endpoint.replace(/\/+$/, "");
25
+ return trimmed.endsWith(LOKI_PUSH_PATH) ? trimmed : `${trimmed}${LOKI_PUSH_PATH}`;
26
+ }
27
+ /** Loki entry timestamps are nanosecond epoch strings. */
28
+ function toLokiTimestamp(timestamp) {
29
+ const parsed = timestamp ? Date.parse(timestamp) : NaN;
30
+ return `${Number.isFinite(parsed) ? parsed : Date.now()}000000`;
31
+ }
32
+ /**
33
+ * Build the stream labels for one event.
34
+ *
35
+ * Only configured fields holding a string, number or boolean become labels.
36
+ * Objects and arrays are skipped rather than stringified, because a serialised
37
+ * object is exactly the unbounded label value that wrecks a Loki instance.
38
+ */
39
+ function toLokiLabels(event, config = {}) {
40
+ const fields = config.labelFields ?? [...DEFAULT_LABEL_FIELDS];
41
+ const labels = { ...config.labels };
42
+ for (const field of fields) {
43
+ const value = event[field];
44
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") labels[field] = String(value);
45
+ }
46
+ return labels;
47
+ }
48
+ /**
49
+ * Group events into streams by label set.
50
+ *
51
+ * Loki rejects a push whose entries run backwards within a stream, so each
52
+ * stream's values are sorted by timestamp before they go out.
53
+ */
54
+ function buildLokiPayload(events, config = {}) {
55
+ const byLabels = /* @__PURE__ */ new Map();
56
+ for (const event of events) {
57
+ const labels = toLokiLabels(event, config);
58
+ const key = JSON.stringify(Object.entries(labels).toSorted(([a], [b]) => a.localeCompare(b)));
59
+ const entry = [toLokiTimestamp(typeof event.timestamp === "string" ? event.timestamp : void 0), JSON.stringify(event)];
60
+ const existing = byLabels.get(key);
61
+ if (existing) existing.values.push(entry);
62
+ else byLabels.set(key, {
63
+ stream: labels,
64
+ values: [entry]
65
+ });
66
+ }
67
+ for (const stream of byLabels.values()) stream.values = stream.values.toSorted(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
68
+ return { streams: [...byLabels.values()] };
69
+ }
70
+ /** Auth and tenancy headers for a resolved config. */
71
+ function toLokiHeaders(config) {
72
+ const headers = {};
73
+ if (config.user && config.apiKey) headers.Authorization = `Basic ${Buffer.from(`${config.user}:${config.apiKey}`).toString("base64")}`;
74
+ else if (config.apiKey) headers.Authorization = `Bearer ${config.apiKey}`;
75
+ if (config.tenantId) headers["X-Scope-OrgID"] = config.tenantId;
76
+ return headers;
77
+ }
78
+ /** Push a batch of events without going through a subscriber. */
79
+ async function sendBatchToLoki(events, config = {}) {
80
+ if (events.length === 0) return;
81
+ const endpoint = config.endpoint ?? firstEnv("LOKI_ENDPOINT", "LOKI_URL", "LOKI_BASE_URL");
82
+ if (!endpoint) throw new Error("Loki endpoint is not configured");
83
+ const resolved = {
84
+ ...config,
85
+ endpoint,
86
+ apiKey: config.apiKey ?? firstEnv("LOKI_API_KEY", "GRAFANA_API_KEY"),
87
+ user: config.user ?? firstEnv("LOKI_USER", "GRAFANA_USER"),
88
+ tenantId: config.tenantId ?? firstEnv("LOKI_TENANT_ID")
89
+ };
90
+ await require_webhook_delivery.postJsonWithRetry(require_webhook_delivery.createHttpClient({ timeoutMs: resolved.timeoutMs ?? 5e3 }), resolveLokiPushUrl(endpoint), buildLokiPayload(events, resolved), {
91
+ headers: toLokiHeaders(resolved),
92
+ maxRetries: resolved.maxRetries ?? 3,
93
+ label: "Loki"
94
+ });
95
+ }
96
+ /** Push a single event without going through a subscriber. */
97
+ async function sendToLoki(event, config = {}) {
98
+ await sendBatchToLoki([event], config);
99
+ }
100
+ /**
101
+ * Buffers events and pushes them to Loki as grouped streams.
102
+ *
103
+ * Batching is not an optimisation here so much as the shape Loki wants: one
104
+ * request carrying several streams costs far less than one request per event,
105
+ * and grouping is what lets entries be ordered within a stream.
106
+ */
107
+ var LokiSubscriber = class {
108
+ name = "LokiSubscriber";
109
+ version = "1.0.0";
110
+ config;
111
+ endpoint;
112
+ enabled;
113
+ batchSize;
114
+ flushIntervalMs;
115
+ httpClient;
116
+ buffer = [];
117
+ timer;
118
+ pending = /* @__PURE__ */ new Set();
119
+ warnedMissingEndpoint = false;
120
+ constructor(config = {}) {
121
+ this.endpoint = config.endpoint ?? firstEnv("LOKI_ENDPOINT", "LOKI_URL", "LOKI_BASE_URL");
122
+ this.config = {
123
+ ...config,
124
+ apiKey: config.apiKey ?? firstEnv("LOKI_API_KEY", "GRAFANA_API_KEY"),
125
+ user: config.user ?? firstEnv("LOKI_USER", "GRAFANA_USER"),
126
+ tenantId: config.tenantId ?? firstEnv("LOKI_TENANT_ID")
127
+ };
128
+ this.enabled = config.enabled ?? true;
129
+ this.batchSize = config.batchSize ?? 100;
130
+ this.flushIntervalMs = config.flushIntervalMs ?? 5e3;
131
+ this.httpClient = require_webhook_delivery.createHttpClient({ timeoutMs: config.timeoutMs ?? 5e3 });
132
+ }
133
+ record(event) {
134
+ if (!this.enabled) return;
135
+ if (!this.endpoint) {
136
+ if (!this.warnedMissingEndpoint) {
137
+ this.warnedMissingEndpoint = true;
138
+ console.warn("[autotel/loki] No endpoint configured; set LOKI_ENDPOINT or pass { endpoint }. Events are being dropped.");
139
+ }
140
+ return;
141
+ }
142
+ this.buffer.push(event);
143
+ if (this.buffer.length >= this.batchSize) {
144
+ this.track(this.flush());
145
+ return;
146
+ }
147
+ if (!this.timer) {
148
+ this.timer = setTimeout(() => {
149
+ this.timer = void 0;
150
+ this.track(this.flush());
151
+ }, this.flushIntervalMs);
152
+ this.timer.unref?.();
153
+ }
154
+ }
155
+ /** Push everything buffered so far. Safe to call when empty. */
156
+ async flush() {
157
+ if (this.buffer.length === 0 || !this.endpoint) return;
158
+ const batch = this.buffer;
159
+ this.buffer = [];
160
+ await require_webhook_delivery.postJsonWithRetry(this.httpClient, resolveLokiPushUrl(this.endpoint), buildLokiPayload(batch, this.config), {
161
+ headers: toLokiHeaders(this.config),
162
+ maxRetries: this.config.maxRetries ?? 3,
163
+ label: "Loki"
164
+ });
165
+ }
166
+ async trackEvent(name, attributes, options) {
167
+ this.record({
168
+ type: "event",
169
+ name,
170
+ ...attributes,
171
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
172
+ ...options?.autotel ? { autotel: options.autotel } : {}
173
+ });
174
+ }
175
+ async trackFunnelStep(funnelName, step, attributes, options) {
176
+ this.record({
177
+ type: "funnel",
178
+ funnel: funnelName,
179
+ step,
180
+ ...attributes,
181
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
182
+ ...options?.autotel ? { autotel: options.autotel } : {}
183
+ });
184
+ }
185
+ async trackOutcome(operationName, outcome, attributes, options) {
186
+ this.record({
187
+ type: "outcome",
188
+ operation: operationName,
189
+ outcome,
190
+ ...attributes,
191
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
192
+ ...options?.autotel ? { autotel: options.autotel } : {}
193
+ });
194
+ }
195
+ async trackValue(name, value, attributes, options) {
196
+ this.record({
197
+ type: "value",
198
+ name,
199
+ value,
200
+ ...attributes,
201
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
202
+ ...options?.autotel ? { autotel: options.autotel } : {}
203
+ });
204
+ }
205
+ track(request) {
206
+ this.pending.add(request);
207
+ request.catch(() => {}).finally(() => {
208
+ this.pending.delete(request);
209
+ });
210
+ }
211
+ async shutdown() {
212
+ if (this.timer) {
213
+ clearTimeout(this.timer);
214
+ this.timer = void 0;
215
+ }
216
+ if (this.pending.size > 0) await Promise.allSettled(this.pending);
217
+ await this.flush().catch(() => {});
218
+ }
219
+ };
220
+
221
+ //#endregion
222
+ exports.LokiSubscriber = LokiSubscriber;
223
+ exports.buildLokiPayload = buildLokiPayload;
224
+ exports.resolveLokiPushUrl = resolveLokiPushUrl;
225
+ exports.sendBatchToLoki = sendBatchToLoki;
226
+ exports.sendToLoki = sendToLoki;
227
+ exports.toLokiHeaders = toLokiHeaders;
228
+ exports.toLokiLabels = toLokiLabels;
229
+ exports.toLokiTimestamp = toLokiTimestamp;
@@ -0,0 +1,119 @@
1
+ import { EventAttributes, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus } from "autotel/event-subscriber";
2
+ //#region src/loki.d.ts
3
+ interface LokiConfig {
4
+ /**
5
+ * Base URL of the Loki instance, without the push path.
6
+ * Falls back to `LOKI_ENDPOINT`, `LOKI_URL`, then `LOKI_BASE_URL`.
7
+ *
8
+ * @example 'http://localhost:3100'
9
+ * @example 'https://logs-prod-eu-west-0.grafana.net'
10
+ */
11
+ endpoint?: string;
12
+ /**
13
+ * API token. Paired with {@link LokiConfig.user} it is sent as HTTP Basic,
14
+ * which is what Grafana Cloud expects. Alone it is sent as Bearer, which
15
+ * suits an instance behind an authenticating proxy.
16
+ * Falls back to `LOKI_API_KEY`, then `GRAFANA_API_KEY`.
17
+ */
18
+ apiKey?: string;
19
+ /**
20
+ * Grafana Cloud instance ID — the numeric user of the Loki datasource, not
21
+ * an account email. Supplying it switches authentication to Basic.
22
+ * Falls back to `LOKI_USER`, then `GRAFANA_USER`.
23
+ */
24
+ user?: string;
25
+ /**
26
+ * Tenant for multi-tenant self-hosted Loki, sent as `X-Scope-OrgID`.
27
+ * Independent of the auth mode. Falls back to `LOKI_TENANT_ID`.
28
+ */
29
+ tenantId?: string;
30
+ /**
31
+ * Event fields promoted to stream labels.
32
+ * Defaults to `['service', 'environment', 'level']`.
33
+ *
34
+ * Keep this short and bounded. Promoting `requestId` or `userId` creates one
35
+ * stream per value, which degrades and eventually breaks an instance.
36
+ */
37
+ labelFields?: string[];
38
+ /** Static labels merged into every stream, e.g. `{ cluster: 'prod-eu' }`. */
39
+ labels?: Record<string, string>;
40
+ /** Events buffered before a push. Default 100. */
41
+ batchSize?: number;
42
+ /** Milliseconds before a partial batch is pushed anyway. Default 5000. */
43
+ flushIntervalMs?: number;
44
+ /** Request timeout in milliseconds. Default 5000. */
45
+ timeoutMs?: number;
46
+ /** Attempts including the first. Default 3. */
47
+ maxRetries?: number;
48
+ /** Set false to construct the subscriber without sending anything. */
49
+ enabled?: boolean;
50
+ }
51
+ /** One event as it is written to the Loki line. */
52
+ type LokiEvent = Record<string, unknown> & {
53
+ timestamp?: string;
54
+ };
55
+ interface LokiStream {
56
+ stream: Record<string, string>;
57
+ values: [string, string][];
58
+ }
59
+ interface LokiPayload {
60
+ streams: LokiStream[];
61
+ }
62
+ /** Resolve the push URL, tolerating an endpoint that already carries the path. */
63
+ declare function resolveLokiPushUrl(endpoint: string): string;
64
+ /** Loki entry timestamps are nanosecond epoch strings. */
65
+ declare function toLokiTimestamp(timestamp?: string): string;
66
+ /**
67
+ * Build the stream labels for one event.
68
+ *
69
+ * Only configured fields holding a string, number or boolean become labels.
70
+ * Objects and arrays are skipped rather than stringified, because a serialised
71
+ * object is exactly the unbounded label value that wrecks a Loki instance.
72
+ */
73
+ declare function toLokiLabels(event: LokiEvent, config?: Pick<LokiConfig, 'labelFields' | 'labels'>): Record<string, string>;
74
+ /**
75
+ * Group events into streams by label set.
76
+ *
77
+ * Loki rejects a push whose entries run backwards within a stream, so each
78
+ * stream's values are sorted by timestamp before they go out.
79
+ */
80
+ declare function buildLokiPayload(events: LokiEvent[], config?: Pick<LokiConfig, 'labelFields' | 'labels'>): LokiPayload;
81
+ /** Auth and tenancy headers for a resolved config. */
82
+ declare function toLokiHeaders(config: Pick<LokiConfig, 'apiKey' | 'user' | 'tenantId'>): Record<string, string>;
83
+ /** Push a batch of events without going through a subscriber. */
84
+ declare function sendBatchToLoki(events: LokiEvent[], config?: LokiConfig): Promise<void>;
85
+ /** Push a single event without going through a subscriber. */
86
+ declare function sendToLoki(event: LokiEvent, config?: LokiConfig): Promise<void>;
87
+ /**
88
+ * Buffers events and pushes them to Loki as grouped streams.
89
+ *
90
+ * Batching is not an optimisation here so much as the shape Loki wants: one
91
+ * request carrying several streams costs far less than one request per event,
92
+ * and grouping is what lets entries be ordered within a stream.
93
+ */
94
+ declare class LokiSubscriber implements EventSubscriber {
95
+ readonly name = "LokiSubscriber";
96
+ readonly version = "1.0.0";
97
+ private readonly config;
98
+ private readonly endpoint;
99
+ private readonly enabled;
100
+ private readonly batchSize;
101
+ private readonly flushIntervalMs;
102
+ private readonly httpClient;
103
+ private buffer;
104
+ private timer;
105
+ private readonly pending;
106
+ private warnedMissingEndpoint;
107
+ constructor(config?: LokiConfig);
108
+ private record;
109
+ /** Push everything buffered so far. Safe to call when empty. */
110
+ flush(): Promise<void>;
111
+ trackEvent(name: string, attributes?: EventAttributes, options?: EventTrackingOptions): Promise<void>;
112
+ trackFunnelStep(funnelName: string, step: FunnelStatus, attributes?: EventAttributes, options?: EventTrackingOptions): Promise<void>;
113
+ trackOutcome(operationName: string, outcome: OutcomeStatus, attributes?: EventAttributes, options?: EventTrackingOptions): Promise<void>;
114
+ trackValue(name: string, value: number, attributes?: EventAttributes, options?: EventTrackingOptions): Promise<void>;
115
+ private track;
116
+ shutdown(): Promise<void>;
117
+ }
118
+ //#endregion
119
+ export { LokiConfig, LokiEvent, LokiPayload, LokiSubscriber, buildLokiPayload, resolveLokiPushUrl, sendBatchToLoki, sendToLoki, toLokiHeaders, toLokiLabels, toLokiTimestamp };