@mark1russell7/otel-ts 0.0.0-bootstrap.0 → 0.1.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.
Files changed (113) hide show
  1. package/README.md +417 -2
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/before-flush.d.ts +21 -0
  4. package/dist/before-flush.d.ts.map +1 -0
  5. package/dist/before-flush.js +46 -0
  6. package/dist/before-flush.js.map +1 -0
  7. package/dist/common.d.ts +11 -0
  8. package/dist/common.d.ts.map +1 -0
  9. package/dist/common.js +22 -0
  10. package/dist/common.js.map +1 -0
  11. package/dist/constants.d.ts +12 -0
  12. package/dist/constants.d.ts.map +1 -0
  13. package/dist/constants.js +12 -0
  14. package/dist/constants.js.map +1 -0
  15. package/dist/context-manager.d.ts +36 -0
  16. package/dist/context-manager.d.ts.map +1 -0
  17. package/dist/context-manager.js +60 -0
  18. package/dist/context-manager.js.map +1 -0
  19. package/dist/core.d.ts +14 -0
  20. package/dist/core.d.ts.map +1 -0
  21. package/dist/core.js +26 -0
  22. package/dist/core.js.map +1 -0
  23. package/dist/env.d.ts +6 -0
  24. package/dist/env.d.ts.map +1 -0
  25. package/dist/env.js +8 -0
  26. package/dist/env.js.map +1 -0
  27. package/dist/faro.d.ts +8 -0
  28. package/dist/faro.d.ts.map +1 -0
  29. package/dist/faro.js +24 -0
  30. package/dist/faro.js.map +1 -0
  31. package/dist/id.d.ts +22 -0
  32. package/dist/id.d.ts.map +1 -0
  33. package/dist/id.js +54 -0
  34. package/dist/id.js.map +1 -0
  35. package/dist/index.d.ts +14 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +33 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/init.d.ts +8 -0
  40. package/dist/init.d.ts.map +1 -0
  41. package/dist/init.js +135 -0
  42. package/dist/init.js.map +1 -0
  43. package/dist/lifecycle.d.ts +33 -0
  44. package/dist/lifecycle.d.ts.map +1 -0
  45. package/dist/lifecycle.js +39 -0
  46. package/dist/lifecycle.js.map +1 -0
  47. package/dist/logs.d.ts +6 -0
  48. package/dist/logs.d.ts.map +1 -0
  49. package/dist/logs.js +17 -0
  50. package/dist/logs.js.map +1 -0
  51. package/dist/metrics.d.ts +5 -0
  52. package/dist/metrics.d.ts.map +1 -0
  53. package/dist/metrics.js +37 -0
  54. package/dist/metrics.js.map +1 -0
  55. package/dist/node-testing.d.ts +23 -0
  56. package/dist/node-testing.d.ts.map +1 -0
  57. package/dist/node-testing.js +71 -0
  58. package/dist/node-testing.js.map +1 -0
  59. package/dist/node.d.ts +37 -0
  60. package/dist/node.d.ts.map +1 -0
  61. package/dist/node.js +54 -0
  62. package/dist/node.js.map +1 -0
  63. package/dist/resource.d.ts +38 -0
  64. package/dist/resource.d.ts.map +1 -0
  65. package/dist/resource.js +54 -0
  66. package/dist/resource.js.map +1 -0
  67. package/dist/session-processors.d.ts +9 -0
  68. package/dist/session-processors.d.ts.map +1 -0
  69. package/dist/session-processors.js +37 -0
  70. package/dist/session-processors.js.map +1 -0
  71. package/dist/session.d.ts +21 -0
  72. package/dist/session.d.ts.map +1 -0
  73. package/dist/session.js +76 -0
  74. package/dist/session.js.map +1 -0
  75. package/dist/trace-echo.d.ts +60 -0
  76. package/dist/trace-echo.d.ts.map +1 -0
  77. package/dist/trace-echo.js +118 -0
  78. package/dist/trace-echo.js.map +1 -0
  79. package/dist/tracing.d.ts +7 -0
  80. package/dist/tracing.d.ts.map +1 -0
  81. package/dist/tracing.js +48 -0
  82. package/dist/tracing.js.map +1 -0
  83. package/dist/types.d.ts +210 -0
  84. package/dist/types.d.ts.map +1 -0
  85. package/dist/types.js +2 -0
  86. package/dist/types.js.map +1 -0
  87. package/dist/zone.d.ts +14 -0
  88. package/dist/zone.d.ts.map +1 -0
  89. package/dist/zone.js +40 -0
  90. package/dist/zone.js.map +1 -0
  91. package/package.json +84 -5
  92. package/src/before-flush.ts +64 -0
  93. package/src/common.ts +46 -0
  94. package/src/constants.ts +12 -0
  95. package/src/context-manager.ts +82 -0
  96. package/src/core.ts +38 -0
  97. package/src/env.ts +7 -0
  98. package/src/faro.ts +29 -0
  99. package/src/id.ts +59 -0
  100. package/src/index.ts +45 -0
  101. package/src/init.ts +177 -0
  102. package/src/lifecycle.ts +52 -0
  103. package/src/logs.ts +30 -0
  104. package/src/metrics.ts +63 -0
  105. package/src/node-testing.ts +88 -0
  106. package/src/node.ts +89 -0
  107. package/src/resource.ts +73 -0
  108. package/src/session-processors.ts +48 -0
  109. package/src/session.ts +86 -0
  110. package/src/trace-echo.ts +137 -0
  111. package/src/tracing.ts +64 -0
  112. package/src/types.ts +261 -0
  113. package/src/zone.ts +52 -0
@@ -0,0 +1,21 @@
1
+ import type { FlushCause } from "./types.js";
2
+ export type BeforeFlushListener = (cause: FlushCause) => void;
3
+ export interface BeforeFlushListeners {
4
+ /** Adds a listener. @returns A function that removes it */
5
+ add(listener: BeforeFlushListener): () => void;
6
+ /**
7
+ * Calls every listener synchronously, in registration order, with the
8
+ * cause of the flush. A listener that throws does not stop the others; the
9
+ * first error is logged.
10
+ */
11
+ run(cause?: FlushCause): void;
12
+ }
13
+ /**
14
+ * Functions that run just before telemetry is flushed, so that values they
15
+ * record (e.g. a page's final Web Vitals) go out in that flush. `init()`
16
+ * runs them at the start of `forceFlush()` and `shutdown()`, which is also
17
+ * what its page-hide handlers call. So they don't depend on the order in
18
+ * which `pagehide` listeners run (which differs between browsers).
19
+ */
20
+ export declare function createBeforeFlushListeners(): BeforeFlushListeners;
21
+ //# sourceMappingURL=before-flush.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"before-flush.d.ts","sourceRoot":"","sources":["../src/before-flush.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,GAAG,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM,IAAI,CAAC;IAE/C;;;;OAIG;IACH,GAAG,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,IAAI,oBAAoB,CAwCjE"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Functions that run just before telemetry is flushed, so that values they
3
+ * record (e.g. a page's final Web Vitals) go out in that flush. `init()`
4
+ * runs them at the start of `forceFlush()` and `shutdown()`, which is also
5
+ * what its page-hide handlers call. So they don't depend on the order in
6
+ * which `pagehide` listeners run (which differs between browsers).
7
+ */
8
+ export function createBeforeFlushListeners() {
9
+ // Wrapped, so the same function can be added twice and removed once
10
+ const entries = new Set();
11
+ let running = false;
12
+ let errorLogged = false;
13
+ return {
14
+ add(listener) {
15
+ const entry = { listener };
16
+ entries.add(entry);
17
+ return () => {
18
+ entries.delete(entry);
19
+ };
20
+ },
21
+ run(cause = {}) {
22
+ // A listener that flushes again must not start another round
23
+ if (running)
24
+ return;
25
+ running = true;
26
+ try {
27
+ // A snapshot: listeners may add or remove listeners
28
+ for (const { listener } of [...entries]) {
29
+ try {
30
+ listener(cause);
31
+ }
32
+ catch (error) {
33
+ if (!errorLogged) {
34
+ errorLogged = true;
35
+ console.error("[otel-ts] An onBeforeFlush listener threw; telemetry is flushed anyway. Later listener errors are not logged.", error);
36
+ }
37
+ }
38
+ }
39
+ }
40
+ finally {
41
+ running = false;
42
+ }
43
+ },
44
+ };
45
+ }
46
+ //# sourceMappingURL=before-flush.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"before-flush.js","sourceRoot":"","sources":["../src/before-flush.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B;IACxC,oEAAoE;IACpE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAqC,CAAC;IAC7D,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,WAAW,GAAG,KAAK,CAAC;IAExB,OAAO;QACL,GAAG,CAAC,QAAQ;YACV,MAAM,KAAK,GAAG,EAAE,QAAQ,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACnB,OAAO,GAAG,EAAE;gBACV,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACxB,CAAC,CAAC;QACJ,CAAC;QAED,GAAG,CAAC,KAAK,GAAG,EAAE;YACZ,6DAA6D;YAC7D,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YAEf,IAAI,CAAC;gBACH,oDAAoD;gBACpD,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC;oBACxC,IAAI,CAAC;wBACH,QAAQ,CAAC,KAAK,CAAC,CAAC;oBAClB,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,IAAI,CAAC,WAAW,EAAE,CAAC;4BACjB,WAAW,GAAG,IAAI,CAAC;4BACnB,OAAO,CAAC,KAAK,CACX,+GAA+G,EAC/G,KAAK,CACN,CAAC;wBACJ,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,OAAO,GAAG,KAAK,CAAC;YAClB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The API that each entry exports, except `init()` and the types of its
3
+ * configuration: `@mark1russell7/otel-ts`, `@mark1russell7/otel-ts/zone` and
4
+ * `@mark1russell7/otel-ts/core` each export their own.
5
+ */
6
+ export type { ContextManagerName, FlushCause, HistogramAggregation, MetricsTemporality, OtelTsInstance, } from "./types.js";
7
+ export { createInstanceId } from "./id.js";
8
+ export { getOrCreateSessionId } from "./session.js";
9
+ export { runInRemoteTrace, type RemoteTraceOptions } from "./trace-echo.js";
10
+ export { DEFAULT_METRICS_EXPORT_INTERVAL_MS, DEFAULT_OTLP_ENDPOINT, DEFAULT_SERVICE_NAME, DEFAULT_SERVICE_VERSION, } from "./constants.js";
11
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,YAAY,EACV,kBAAkB,EAClB,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,GACf,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAM3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAMpD,OAAO,EAAE,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAM5E,OAAO,EACL,kCAAkC,EAClC,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC"}
package/dist/common.js ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The API that each entry exports, except `init()` and the types of its
3
+ * configuration: `@mark1russell7/otel-ts`, `@mark1russell7/otel-ts/zone` and
4
+ * `@mark1russell7/otel-ts/core` each export their own.
5
+ */
6
+ // =============================================================================
7
+ // Identity
8
+ // =============================================================================
9
+ export { createInstanceId } from "./id.js";
10
+ // =============================================================================
11
+ // Session
12
+ // =============================================================================
13
+ export { getOrCreateSessionId } from "./session.js";
14
+ // =============================================================================
15
+ // The trace of a remote change
16
+ // =============================================================================
17
+ export { runInRemoteTrace } from "./trace-echo.js";
18
+ // =============================================================================
19
+ // Constants
20
+ // =============================================================================
21
+ export { DEFAULT_METRICS_EXPORT_INTERVAL_MS, DEFAULT_OTLP_ENDPOINT, DEFAULT_SERVICE_NAME, DEFAULT_SERVICE_VERSION, } from "./constants.js";
22
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,gFAAgF;AAChF,+BAA+B;AAC/B,gFAAgF;AAEhF,OAAO,EAAE,gBAAgB,EAA2B,MAAM,iBAAiB,CAAC;AAE5E,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,OAAO,EACL,kCAAkC,EAClC,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const DEFAULT_OTLP_ENDPOINT = "http://localhost:4318";
2
+ export declare const DEFAULT_SERVICE_NAME = "frontend-app";
3
+ export declare const DEFAULT_SERVICE_VERSION = "0.0.0";
4
+ export declare const DEFAULT_METRICS_EXPORT_INTERVAL_MS = 15000;
5
+ export declare const SESSION_STORAGE_KEY = "otel_session_id";
6
+ export declare const SESSION_TTL_MS: number;
7
+ /**
8
+ * Semantic-conventions `session.id`. It has Development status, so the
9
+ * stable `@opentelemetry/semantic-conventions` entry point does not export it.
10
+ */
11
+ export declare const ATTR_SESSION_ID = "session.id";
12
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAC7D,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AACnD,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAC/C,eAAO,MAAM,kCAAkC,QAAS,CAAC;AACzD,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AACrD,eAAO,MAAM,cAAc,QAAiB,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,eAAe,eAAe,CAAC"}
@@ -0,0 +1,12 @@
1
+ export const DEFAULT_OTLP_ENDPOINT = "http://localhost:4318";
2
+ export const DEFAULT_SERVICE_NAME = "frontend-app";
3
+ export const DEFAULT_SERVICE_VERSION = "0.0.0";
4
+ export const DEFAULT_METRICS_EXPORT_INTERVAL_MS = 15_000;
5
+ export const SESSION_STORAGE_KEY = "otel_session_id";
6
+ export const SESSION_TTL_MS = 30 * 60 * 1000;
7
+ /**
8
+ * Semantic-conventions `session.id`. It has Development status, so the
9
+ * stable `@opentelemetry/semantic-conventions` entry point does not export it.
10
+ */
11
+ export const ATTR_SESSION_ID = "session.id";
12
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC;AACnD,MAAM,CAAC,MAAM,uBAAuB,GAAG,OAAO,CAAC;AAC/C,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AACrD,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { ContextManager } from "@opentelemetry/api";
2
+ import type { ContextManagerName, ContextManagerOption } from "./types.js";
3
+ /**
4
+ * The entries of the package. Each entry loads at most one context library,
5
+ * because zone.js and async-browser-context patch the same functions with
6
+ * different rules: they cannot share a page.
7
+ */
8
+ export declare const ENTRIES: {
9
+ /** async-browser-context */
10
+ readonly main: "@mark1russell7/otel-ts";
11
+ /** zone.js */
12
+ readonly zone: "@mark1russell7/otel-ts/zone";
13
+ /** No context library */
14
+ readonly core: "@mark1russell7/otel-ts/core";
15
+ };
16
+ export type Entry = keyof typeof ENTRIES;
17
+ /** The context managers of one entry */
18
+ export interface EntryContextManagers {
19
+ readonly entry: Entry;
20
+ /** The name that `init()` uses when the config has no `contextManager` */
21
+ readonly defaultName: ContextManagerName;
22
+ /** Makes the manager for each name that the entry has */
23
+ readonly factories: Partial<Record<ContextManagerName, () => ContextManager>>;
24
+ }
25
+ /** The error message for a name that `entry` does not have */
26
+ export declare function unavailableMessage(name: string, entry: Entry): string;
27
+ /** Makes the stack manager. Each entry has it. */
28
+ export declare const createStackContextManager: () => ContextManager;
29
+ /**
30
+ * The context manager for the `contextManager` option, in the entry of
31
+ * `managers`. Gives back a `ContextManager` instance of the app.
32
+ *
33
+ * @throws For a name that the entry does not have
34
+ */
35
+ export declare function createContextManager(option: ContextManagerOption, managers: EntryContextManagers): ContextManager;
36
+ //# sourceMappingURL=context-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-manager.d.ts","sourceRoot":"","sources":["../src/context-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE3E;;;;GAIG;AACH,eAAO,MAAM,OAAO;IAClB,4BAA4B;;IAE5B,cAAc;;IAEd,yBAAyB;;CAEjB,CAAC;AAEX,MAAM,MAAM,KAAK,GAAG,MAAM,OAAO,OAAO,CAAC;AAEzC,wCAAwC;AACxC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAC;IACzC,yDAAyD;IACzD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,cAAc,CAAC,CAAC,CAAC;CAC/E;AAgBD,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAerE;AAED,kDAAkD;AAClD,eAAO,MAAM,yBAAyB,QAAO,cAClB,CAAC;AAE5B;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,oBAAoB,EAC5B,QAAQ,EAAE,oBAAoB,GAC7B,cAAc,CAOhB"}
@@ -0,0 +1,60 @@
1
+ import { StackContextManager } from "@opentelemetry/sdk-trace-web";
2
+ /**
3
+ * The entries of the package. Each entry loads at most one context library,
4
+ * because zone.js and async-browser-context patch the same functions with
5
+ * different rules: they cannot share a page.
6
+ */
7
+ export const ENTRIES = {
8
+ /** async-browser-context */
9
+ main: "@mark1russell7/otel-ts",
10
+ /** zone.js */
11
+ zone: "@mark1russell7/otel-ts/zone",
12
+ /** No context library */
13
+ core: "@mark1russell7/otel-ts/core",
14
+ };
15
+ /** The entry that has each name. Each entry has "stack". */
16
+ const ENTRY_OF = {
17
+ async: "main",
18
+ zone: "zone",
19
+ stack: "core",
20
+ };
21
+ /** The context library that each entry loads */
22
+ const LIBRARY_OF = {
23
+ main: "async-browser-context",
24
+ zone: "zone.js",
25
+ core: undefined,
26
+ };
27
+ /** The error message for a name that `entry` does not have */
28
+ export function unavailableMessage(name, entry) {
29
+ const home = Object.hasOwn(ENTRY_OF, name)
30
+ ? ENTRY_OF[name]
31
+ : undefined;
32
+ if (home === undefined) {
33
+ return `[otel-ts] Unknown contextManager "${name}". Use "async", "zone" or "stack", or a ContextManager.`;
34
+ }
35
+ const library = LIBRARY_OF[entry];
36
+ const reason = library
37
+ ? `This entry loads ${library}, and zone.js and async-browser-context cannot share a page: they patch the same functions with different rules.`
38
+ : "This entry loads no context library.";
39
+ return (`[otel-ts] contextManager: "${name}" is not available in "${ENTRIES[entry]}". ${reason} ` +
40
+ `Import init from "${ENTRIES[home]}" in place of "${ENTRIES[entry]}".`);
41
+ }
42
+ /** Makes the stack manager. Each entry has it. */
43
+ export const createStackContextManager = () => new StackContextManager();
44
+ /**
45
+ * The context manager for the `contextManager` option, in the entry of
46
+ * `managers`. Gives back a `ContextManager` instance of the app.
47
+ *
48
+ * @throws For a name that the entry does not have
49
+ */
50
+ export function createContextManager(option, managers) {
51
+ if (typeof option !== "string")
52
+ return option;
53
+ const factory = Object.hasOwn(managers.factories, option)
54
+ ? managers.factories[option]
55
+ : undefined;
56
+ if (!factory)
57
+ throw new Error(unavailableMessage(option, managers.entry));
58
+ return factory();
59
+ }
60
+ //# sourceMappingURL=context-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-manager.js","sourceRoot":"","sources":["../src/context-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,4BAA4B;IAC5B,IAAI,EAAE,wBAAwB;IAC9B,cAAc;IACd,IAAI,EAAE,6BAA6B;IACnC,yBAAyB;IACzB,IAAI,EAAE,6BAA6B;CAC3B,CAAC;AAaX,4DAA4D;AAC5D,MAAM,QAAQ,GAAsC;IAClD,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;CACd,CAAC;AAEF,gDAAgD;AAChD,MAAM,UAAU,GAAsC;IACpD,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;CAChB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,KAAY;IAC3D,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC;QACxC,CAAC,CAAC,QAAQ,CAAC,IAA0B,CAAC;QACtC,CAAC,CAAC,SAAS,CAAC;IACd,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,qCAAqC,IAAI,yDAAyD,CAAC;IAC5G,CAAC;IACD,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,OAAO;QACpB,CAAC,CAAC,oBAAoB,OAAO,kHAAkH;QAC/I,CAAC,CAAC,sCAAsC,CAAC;IAC3C,OAAO,CACL,8BAA8B,IAAI,0BAA0B,OAAO,CAAC,KAAK,CAAC,MAAM,MAAM,GAAG;QACzF,qBAAqB,OAAO,CAAC,IAAI,CAAC,kBAAkB,OAAO,CAAC,KAAK,CAAC,IAAI,CACvE,CAAC;AACJ,CAAC;AAED,kDAAkD;AAClD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAmB,EAAE,CAC5D,IAAI,mBAAmB,EAAE,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAA4B,EAC5B,QAA8B;IAE9B,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAC9C,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QACvD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC;QAC5B,CAAC,CAAC,SAAS,CAAC;IACd,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1E,OAAO,OAAO,EAAE,CAAC;AACnB,CAAC"}
package/dist/core.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import type * as Types from "./types.js";
2
+ export * from "./common.js";
3
+ /** The context manager names of this entry: only "stack" (default) */
4
+ export type ContextManagerOption = Types.ContextManagerOption<"stack">;
5
+ /** The configuration of `init()` in this entry */
6
+ export type OtelTsConfig = Types.OtelTsConfig<"stack">;
7
+ /**
8
+ * Starts traces, metrics and logs. The default `contextManager` is "stack".
9
+ *
10
+ * @throws For `contextManager: "async"` or `"zone"`: import `init` from
11
+ * `@mark1russell7/otel-ts` or from `@mark1russell7/otel-ts/zone`.
12
+ */
13
+ export declare function init(config?: OtelTsConfig): Types.OtelTsInstance;
14
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AAEzC,cAAc,aAAa,CAAC;AAE5B,sEAAsE;AACtE,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAEvE,kDAAkD;AAClD,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;AAQvD;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,KAAK,CAAC,cAAc,CAEhE"}
package/dist/core.js ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The core entry, `@mark1russell7/otel-ts/core`. The same API as
3
+ * `@mark1russell7/otel-ts`, but it imports no context library and patches
4
+ * nothing: the default `contextManager` is "stack". The app can also give its
5
+ * own `ContextManager`.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import { createStackContextManager, } from "./context-manager.js";
10
+ import { initWith } from "./init.js";
11
+ export * from "./common.js";
12
+ const managers = {
13
+ entry: "core",
14
+ defaultName: "stack",
15
+ factories: { stack: createStackContextManager },
16
+ };
17
+ /**
18
+ * Starts traces, metrics and logs. The default `contextManager` is "stack".
19
+ *
20
+ * @throws For `contextManager: "async"` or `"zone"`: import `init` from
21
+ * `@mark1russell7/otel-ts` or from `@mark1russell7/otel-ts/zone`.
22
+ */
23
+ export function init(config) {
24
+ return initWith(managers, config);
25
+ }
26
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,yBAAyB,GAE1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGrC,cAAc,aAAa,CAAC;AAQ5B,MAAM,QAAQ,GAAyB;IACrC,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,OAAO;IACpB,SAAS,EAAE,EAAE,KAAK,EAAE,yBAAyB,EAAE;CAChD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAC,MAAqB;IACxC,OAAO,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACpC,CAAC"}
package/dist/env.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * True in a page (`window` and `document` exist); false in Web Workers and
3
+ * other runtimes without a DOM.
4
+ */
5
+ export declare function hasDom(): boolean;
6
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,MAAM,IAAI,OAAO,CAEhC"}
package/dist/env.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * True in a page (`window` and `document` exist); false in Web Workers and
3
+ * other runtimes without a DOM.
4
+ */
5
+ export function hasDom() {
6
+ return typeof window !== "undefined" && typeof document !== "undefined";
7
+ }
8
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,MAAM;IACpB,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,CAAC;AAC1E,CAAC"}
package/dist/faro.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { type Faro } from "@grafana/faro-web-sdk";
2
+ import type { ResolvedConfig } from "./types.js";
3
+ /**
4
+ * Starts Faro, sending to `url`. Without a URL (or transports) Faro has
5
+ * nowhere to send data and logs an error, so `init()` skips it then.
6
+ */
7
+ export declare function setupFaro(config: ResolvedConfig, url: string): Faro;
8
+ //# sourceMappingURL=faro.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faro.d.ts","sourceRoot":"","sources":["../src/faro.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,IAAI,EACV,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAgBnE"}
package/dist/faro.js ADDED
@@ -0,0 +1,24 @@
1
+ import { initializeFaro, getWebInstrumentations, } from "@grafana/faro-web-sdk";
2
+ import { TracingInstrumentation } from "@grafana/faro-web-tracing";
3
+ /**
4
+ * Starts Faro, sending to `url`. Without a URL (or transports) Faro has
5
+ * nowhere to send data and logs an error, so `init()` skips it then.
6
+ */
7
+ export function setupFaro(config, url) {
8
+ return initializeFaro({
9
+ url,
10
+ app: {
11
+ name: config.faroAppName ?? config.serviceName,
12
+ version: config.serviceVersion,
13
+ },
14
+ instrumentations: [
15
+ ...getWebInstrumentations({
16
+ captureConsole: true,
17
+ enablePerformanceInstrumentation: true,
18
+ enableContentSecurityPolicyInstrumentation: true,
19
+ }),
20
+ new TracingInstrumentation(),
21
+ ],
22
+ });
23
+ }
24
+ //# sourceMappingURL=faro.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faro.js","sourceRoot":"","sources":["../src/faro.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGnE;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,MAAsB,EAAE,GAAW;IAC3D,OAAO,cAAc,CAAC;QACpB,GAAG;QACH,GAAG,EAAE;YACH,IAAI,EAAE,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW;YAC9C,OAAO,EAAE,MAAM,CAAC,cAAc;SAC/B;QACD,gBAAgB,EAAE;YAChB,GAAG,sBAAsB,CAAC;gBACxB,cAAc,EAAE,IAAI;gBACpB,gCAAgC,EAAE,IAAI;gBACtC,0CAA0C,EAAE,IAAI;aACjD,CAAC;YACF,IAAI,sBAAsB,EAAE;SAC7B;KACF,CAAC,CAAC;AACL,CAAC"}
package/dist/id.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Returns a new random version 4 UUID (RFC 9562).
3
+ *
4
+ * `crypto.randomUUID()` exists only in secure contexts: HTTPS pages and
5
+ * http://localhost. Pages served over plain http:// from any other host lack
6
+ * it but still have `crypto.getRandomValues()`, so this falls back to that,
7
+ * and to `Math.random()` where there is no Web Crypto at all. The result is
8
+ * an identifier, not a secret: the fallbacks only need to make collisions
9
+ * unlikely.
10
+ */
11
+ export declare function randomUuid(): string;
12
+ /**
13
+ * Returns a new value for the `service.instance.id` resource attribute: a
14
+ * random version 4 UUID.
15
+ *
16
+ * `init()` calls this once per call when no `serviceInstanceId` is given, so
17
+ * every SDK instance (each page load, each Web Worker) is its own metric
18
+ * writer. Call it yourself only to know the value before `init()`; never
19
+ * persist it or derive it from the session ID.
20
+ */
21
+ export declare function createInstanceId(): string;
22
+ //# sourceMappingURL=id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,UAAU,IAAI,MAAM,CA8BnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
package/dist/id.js ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Returns a new random version 4 UUID (RFC 9562).
3
+ *
4
+ * `crypto.randomUUID()` exists only in secure contexts: HTTPS pages and
5
+ * http://localhost. Pages served over plain http:// from any other host lack
6
+ * it but still have `crypto.getRandomValues()`, so this falls back to that,
7
+ * and to `Math.random()` where there is no Web Crypto at all. The result is
8
+ * an identifier, not a secret: the fallbacks only need to make collisions
9
+ * unlikely.
10
+ */
11
+ export function randomUuid() {
12
+ const webCrypto = getWebCrypto();
13
+ if (typeof webCrypto?.randomUUID === "function") {
14
+ return webCrypto.randomUUID();
15
+ }
16
+ const bytes = new Uint8Array(16);
17
+ if (typeof webCrypto?.getRandomValues === "function") {
18
+ webCrypto.getRandomValues(bytes);
19
+ }
20
+ else {
21
+ for (let i = 0; i < bytes.length; i++) {
22
+ bytes[i] = Math.floor(Math.random() * 256);
23
+ }
24
+ }
25
+ bytes[6] = (bytes[6] & 0x0f) | 0x40; // version 4
26
+ bytes[8] = (bytes[8] & 0x3f) | 0x80; // RFC 9562 variant (10xx)
27
+ const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0"));
28
+ return [
29
+ hex.slice(0, 4),
30
+ hex.slice(4, 6),
31
+ hex.slice(6, 8),
32
+ hex.slice(8, 10),
33
+ hex.slice(10, 16),
34
+ ]
35
+ .map((group) => group.join(""))
36
+ .join("-");
37
+ }
38
+ /**
39
+ * Returns a new value for the `service.instance.id` resource attribute: a
40
+ * random version 4 UUID.
41
+ *
42
+ * `init()` calls this once per call when no `serviceInstanceId` is given, so
43
+ * every SDK instance (each page load, each Web Worker) is its own metric
44
+ * writer. Call it yourself only to know the value before `init()`; never
45
+ * persist it or derive it from the session ID.
46
+ */
47
+ export function createInstanceId() {
48
+ return randomUuid();
49
+ }
50
+ /** Web Crypto where it exists; missing members are checked by the caller */
51
+ function getWebCrypto() {
52
+ return typeof crypto === "undefined" ? undefined : crypto;
53
+ }
54
+ //# sourceMappingURL=id.js.map
package/dist/id.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.js","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IAEjC,IAAI,OAAO,SAAS,EAAE,UAAU,KAAK,UAAU,EAAE,CAAC;QAChD,OAAO,SAAS,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IAEjC,IAAI,OAAO,SAAS,EAAE,eAAe,KAAK,UAAU,EAAE,CAAC;QACrD,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;SAAM,CAAC;QACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,YAAY;IACjD,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,0BAA0B;IAE/D,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IAC5E,OAAO;QACL,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QAChB,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC;KAClB;SACE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC9B,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,EAAE,CAAC;AACtB,CAAC;AAED,4EAA4E;AAC5E,SAAS,YAAY;IACnB,OAAO,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type * as Types from "./types.js";
2
+ export * from "./common.js";
3
+ /** The context manager names of this entry: "async" (default) and "stack" */
4
+ export type ContextManagerOption = Types.ContextManagerOption<"async" | "stack">;
5
+ /** The configuration of `init()` in this entry */
6
+ export type OtelTsConfig = Types.OtelTsConfig<"async" | "stack">;
7
+ /**
8
+ * Starts traces, metrics and logs. The default `contextManager` is "async".
9
+ *
10
+ * @throws For `contextManager: "zone"`: zone.js cannot share the page with
11
+ * async-browser-context. Import `init` from `@mark1russell7/otel-ts/zone`.
12
+ */
13
+ export declare function init(config?: OtelTsConfig): Types.OtelTsInstance;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AAEzC,cAAc,aAAa,CAAC;AAE5B,6EAA6E;AAC7E,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,oBAAoB,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC;AAEjF,kDAAkD;AAClD,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC;AAWjE;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,KAAK,CAAC,cAAc,CAEhE"}
package/dist/index.js ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The main entry, `@mark1russell7/otel-ts`. It keeps the active span with
3
+ * async-browser-context: the default `contextManager` is "async".
4
+ *
5
+ * async-browser-context patches `Promise.prototype.then`, the timers, the
6
+ * event listeners and other callback APIs when this entry loads, also when
7
+ * the app selects "stack". `@mark1russell7/otel-ts/core` patches nothing, and
8
+ * `@mark1russell7/otel-ts/zone` uses zone.js.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ import { AsyncContextManager } from "async-browser-context/opentelemetry";
13
+ import { createStackContextManager, } from "./context-manager.js";
14
+ import { initWith } from "./init.js";
15
+ export * from "./common.js";
16
+ const managers = {
17
+ entry: "main",
18
+ defaultName: "async",
19
+ factories: {
20
+ async: () => new AsyncContextManager(),
21
+ stack: createStackContextManager,
22
+ },
23
+ };
24
+ /**
25
+ * Starts traces, metrics and logs. The default `contextManager` is "async".
26
+ *
27
+ * @throws For `contextManager: "zone"`: zone.js cannot share the page with
28
+ * async-browser-context. Import `init` from `@mark1russell7/otel-ts/zone`.
29
+ */
30
+ export function init(config) {
31
+ return initWith(managers, config);
32
+ }
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EACL,yBAAyB,GAE1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGrC,cAAc,aAAa,CAAC;AAQ5B,MAAM,QAAQ,GAAyB;IACrC,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,OAAO;IACpB,SAAS,EAAE;QACT,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,mBAAmB,EAAE;QACtC,KAAK,EAAE,yBAAyB;KACjC;CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAC,MAAqB;IACxC,OAAO,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACpC,CAAC"}
package/dist/init.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type { OtelTsConfig, OtelTsInstance } from "./types.js";
2
+ import { type EntryContextManagers } from "./context-manager.js";
3
+ /**
4
+ * The `init()` of each entry. `managers` are the context managers of the
5
+ * entry: the entry imports at most one context library.
6
+ */
7
+ export declare function initWith(managers: EntryContextManagers, config?: OtelTsConfig): OtelTsInstance;
8
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAc,YAAY,EAAE,cAAc,EAAkB,MAAM,YAAY,CAAC;AAM3F,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AA0D9B;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,oBAAoB,EAC9B,MAAM,CAAC,EAAE,YAAY,GACpB,cAAc,CAoGhB"}