autotel 3.1.0 → 3.1.1
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.
- package/dist/auto.cjs +5 -5
- package/dist/auto.js +3 -3
- package/dist/{chunk-BGAR6MCX.cjs → chunk-2GIBANLB.cjs} +4 -4
- package/dist/{chunk-BGAR6MCX.cjs.map → chunk-2GIBANLB.cjs.map} +1 -1
- package/dist/{chunk-ISEHXVMD.cjs → chunk-45B2GD4P.cjs} +16 -16
- package/dist/{chunk-ISEHXVMD.cjs.map → chunk-45B2GD4P.cjs.map} +1 -1
- package/dist/{chunk-5GQOWMEY.js → chunk-52ALHU7T.js} +3 -3
- package/dist/{chunk-5GQOWMEY.js.map → chunk-52ALHU7T.js.map} +1 -1
- package/dist/{chunk-7NDHLHZK.js → chunk-643PQG3Y.js} +3 -3
- package/dist/{chunk-7NDHLHZK.js.map → chunk-643PQG3Y.js.map} +1 -1
- package/dist/{chunk-TDJXVXM4.js → chunk-6TFJF7SS.js} +3 -3
- package/dist/{chunk-TDJXVXM4.js.map → chunk-6TFJF7SS.js.map} +1 -1
- package/dist/{chunk-ZUOASZED.cjs → chunk-6X2GG65S.cjs} +5 -5
- package/dist/{chunk-ZUOASZED.cjs.map → chunk-6X2GG65S.cjs.map} +1 -1
- package/dist/{chunk-BTEPYWDF.cjs → chunk-FEEVB2GV.cjs} +4 -4
- package/dist/{chunk-BTEPYWDF.cjs.map → chunk-FEEVB2GV.cjs.map} +1 -1
- package/dist/{chunk-IC4AZUGC.js → chunk-FTBBBPT6.js} +3 -3
- package/dist/{chunk-IC4AZUGC.js.map → chunk-FTBBBPT6.js.map} +1 -1
- package/dist/{chunk-MBEHEGQE.js → chunk-HLZ7H3VZ.js} +3 -3
- package/dist/{chunk-MBEHEGQE.js.map → chunk-HLZ7H3VZ.js.map} +1 -1
- package/dist/{chunk-EQIY6C3X.cjs → chunk-HR5YFXZW.cjs} +5 -3
- package/dist/chunk-HR5YFXZW.cjs.map +1 -0
- package/dist/{chunk-H5P4ZTCX.cjs → chunk-KPDIEVVV.cjs} +36 -36
- package/dist/{chunk-H5P4ZTCX.cjs.map → chunk-KPDIEVVV.cjs.map} +1 -1
- package/dist/{chunk-KPNV2GPW.js → chunk-KVDA4HX2.js} +5 -3
- package/dist/chunk-KVDA4HX2.js.map +1 -0
- package/dist/{chunk-KAELJC6T.cjs → chunk-LIYNUGML.cjs} +13 -13
- package/dist/{chunk-KAELJC6T.cjs.map → chunk-LIYNUGML.cjs.map} +1 -1
- package/dist/{chunk-MAITXZFR.js → chunk-MHPYLMQS.js} +4 -4
- package/dist/{chunk-MAITXZFR.js.map → chunk-MHPYLMQS.js.map} +1 -1
- package/dist/{chunk-A7VZ7CSC.cjs → chunk-MXO6LXV5.cjs} +11 -11
- package/dist/{chunk-A7VZ7CSC.cjs.map → chunk-MXO6LXV5.cjs.map} +1 -1
- package/dist/{chunk-SIMG4IGE.js → chunk-MYWQELNY.js} +4 -4
- package/dist/{chunk-SIMG4IGE.js.map → chunk-MYWQELNY.js.map} +1 -1
- package/dist/{chunk-BJDZXR3Y.js → chunk-PEEUMQ3R.js} +4 -4
- package/dist/{chunk-BJDZXR3Y.js.map → chunk-PEEUMQ3R.js.map} +1 -1
- package/dist/{chunk-D6ELKUMF.js → chunk-T7CPAGOI.js} +5 -5
- package/dist/{chunk-D6ELKUMF.js.map → chunk-T7CPAGOI.js.map} +1 -1
- package/dist/{chunk-I36M5IZD.cjs → chunk-YPQMAE6U.cjs} +7 -7
- package/dist/{chunk-I36M5IZD.cjs.map → chunk-YPQMAE6U.cjs.map} +1 -1
- package/dist/{chunk-ADZDAWNV.cjs → chunk-ZPERWNOP.cjs} +17 -17
- package/dist/{chunk-ADZDAWNV.cjs.map → chunk-ZPERWNOP.cjs.map} +1 -1
- package/dist/correlation-id.cjs +12 -12
- package/dist/correlation-id.js +4 -4
- package/dist/decorators.cjs +7 -7
- package/dist/decorators.js +6 -6
- package/dist/event.cjs +8 -8
- package/dist/event.js +5 -5
- package/dist/functional.cjs +14 -14
- package/dist/functional.js +6 -6
- package/dist/http.cjs +5 -5
- package/dist/http.js +4 -4
- package/dist/index.cjs +83 -83
- package/dist/index.js +14 -14
- package/dist/instrumentation.cjs +11 -11
- package/dist/instrumentation.js +3 -3
- package/dist/messaging.cjs +10 -10
- package/dist/messaging.js +7 -7
- package/dist/semantic-helpers.cjs +11 -11
- package/dist/semantic-helpers.js +7 -7
- package/dist/trace-helpers.cjs +14 -14
- package/dist/trace-helpers.js +2 -2
- package/dist/webhook.cjs +8 -8
- package/dist/webhook.js +6 -6
- package/dist/workflow-distributed.cjs +8 -8
- package/dist/workflow-distributed.js +6 -6
- package/dist/workflow.cjs +11 -11
- package/dist/workflow.js +7 -7
- package/dist/yaml-config.cjs +5 -5
- package/dist/yaml-config.js +2 -2
- package/package.json +1 -1
- package/src/node-require.ts +15 -7
- package/dist/chunk-EQIY6C3X.cjs.map +0 -1
- package/dist/chunk-KPNV2GPW.js.map +0 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
2
|
|
|
3
3
|
// src/node-require.ts
|
|
4
|
-
var nodeRequire = createRequire(
|
|
4
|
+
var nodeRequire = createRequire(
|
|
5
|
+
typeof __filename === "string" ? __filename : import.meta.url
|
|
6
|
+
);
|
|
5
7
|
function safeRequire(id) {
|
|
6
8
|
try {
|
|
7
9
|
return nodeRequire(id);
|
|
@@ -17,5 +19,5 @@ function requireModule(id) {
|
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export { requireModule, safeRequire };
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
22
|
+
//# sourceMappingURL=chunk-KVDA4HX2.js.map
|
|
23
|
+
//# sourceMappingURL=chunk-KVDA4HX2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/node-require.ts"],"names":[],"mappings":";;;AAyBA,IAAM,WAAA,GAAc,aAAA;AAAA,EAClB,OAAO,UAAA,KAAe,QAAA,GAAW,UAAA,GAAa,MAAA,CAAA,IAAA,CAAY;AAC5D,CAAA;AAmBO,SAAS,YAAyB,EAAA,EAA2B;AAClE,EAAA,IAAI;AACF,IAAA,OAAO,YAAY,EAAE,CAAA;AAAA,EACvB,SAAS,KAAA,EAAO;AACd,IAAA,IAAI,KAAA,IAAU,KAAA,CAAgC,IAAA,KAAS,kBAAA,EAAoB;AAEzE,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,MAAM,KAAA;AAAA,EACR;AACF;AAmBO,SAAS,cAA2B,EAAA,EAAe;AACxD,EAAA,OAAO,YAAY,EAAE,CAAA;AACvB","file":"chunk-KVDA4HX2.js","sourcesContent":["/**\n * Cross-format require() helper for CJS and ESM compatibility\n *\n * Provides a synchronous `require()` function that works in both:\n * - CJS builds: Uses native `require`\n * - ESM builds: Uses `createRequire(import.meta.url)`\n *\n * This allows optional peer dependencies and dynamic module loading\n * to work synchronously in both module formats.\n */\n\nimport { createRequire } from 'node:module';\n\n// `__filename` is provided by CJS and by esbuild's CJS output wrapper, but\n// is undefined under pure ESM. `import.meta.url` is provided by ESM. Pick\n// whichever is available so the helper works in:\n// - native CJS (autotel's published `.cjs`)\n// - native ESM (autotel's published `.js`)\n// - ESM-bundled-into-CJS by a downstream consumer (e.g. CDK's\n// `aws-lambda-nodejs` → esbuild with `format: cjs`). esbuild rewrites\n// `import.meta` to `{}` in this case, so `createRequire(import.meta.url)`\n// alone collapses to `createRequire(undefined)` and crashes at load.\n// `typeof __filename` does NOT throw when the identifier is undeclared, so\n// the ESM build evaluates the conditional safely.\ndeclare const __filename: string | undefined;\nconst nodeRequire = createRequire(\n typeof __filename === 'string' ? __filename : import.meta.url,\n);\n\n/**\n * Synchronously require a module (works in both CJS and ESM)\n *\n * @param id - Module ID to require\n * @returns The required module\n * @throws Error if module cannot be loaded\n *\n * @example\n * ```typescript\n * import { safeRequire } from './node-require';\n *\n * const traceloop = safeRequire('@traceloop/node-server-sdk');\n * if (traceloop) {\n * traceloop.initialize({ ... });\n * }\n * ```\n */\nexport function safeRequire<T = unknown>(id: string): T | undefined {\n try {\n return nodeRequire(id) as T;\n } catch (error) {\n if (error && (error as NodeJS.ErrnoException).code === 'MODULE_NOT_FOUND') {\n // Optional dependency missing – return undefined\n return undefined;\n }\n // Any other error is a real bug: rethrow\n throw error;\n }\n}\n\n/**\n * Synchronously require a module (throws if not found)\n *\n * Use this when the module is required (not optional).\n *\n * @param id - Module ID to require\n * @returns The required module\n * @throws Error if module cannot be loaded\n *\n * @example\n * ```typescript\n * import { requireModule } from './node-require';\n *\n * const fs = requireModule<typeof import('node:fs')>('node:fs');\n * const content = fs.readFileSync('file.txt', 'utf8');\n * ```\n */\nexport function requireModule<T = unknown>(id: string): T {\n return nodeRequire(id) as T;\n}\n\n/**\n * Direct access to the nodeRequire function (for advanced use cases)\n */\nexport { nodeRequire };\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk45B2GD4P_cjs = require('./chunk-45B2GD4P.cjs');
|
|
4
4
|
var chunkESLWRGAG_cjs = require('./chunk-ESLWRGAG.cjs');
|
|
5
5
|
var api = require('@opentelemetry/api');
|
|
6
6
|
var async_hooks = require('async_hooks');
|
|
@@ -370,7 +370,7 @@ var EventQueue = class {
|
|
|
370
370
|
}
|
|
371
371
|
this.metrics?.dropped.add(1, attrs);
|
|
372
372
|
const logLevel = reason === "payload_invalid" ? "error" : "warn";
|
|
373
|
-
const logger =
|
|
373
|
+
const logger = chunk45B2GD4P_cjs.getLogger();
|
|
374
374
|
if (logLevel === "error") {
|
|
375
375
|
logger.error(
|
|
376
376
|
{
|
|
@@ -402,7 +402,7 @@ var EventQueue = class {
|
|
|
402
402
|
recordFailed(event, subscriberName, error) {
|
|
403
403
|
this.metrics?.failed.add(1, { subscriber: subscriberName });
|
|
404
404
|
this.subscriberHealthy.set(subscriberName, false);
|
|
405
|
-
|
|
405
|
+
chunk45B2GD4P_cjs.getLogger().error(
|
|
406
406
|
{
|
|
407
407
|
eventName: event.name,
|
|
408
408
|
subscriber: subscriberName,
|
|
@@ -443,7 +443,7 @@ var EventQueue = class {
|
|
|
443
443
|
if (this.queue.length >= this.config.maxSize) {
|
|
444
444
|
const droppedEvent = this.queue.shift();
|
|
445
445
|
this.recordDropped("rate_limit", droppedEvent);
|
|
446
|
-
|
|
446
|
+
chunk45B2GD4P_cjs.getLogger().warn(
|
|
447
447
|
{
|
|
448
448
|
droppedEvent: droppedEvent?.name
|
|
449
449
|
},
|
|
@@ -539,7 +539,7 @@ var EventQueue = class {
|
|
|
539
539
|
const failedSubscriberNames = [
|
|
540
540
|
...new Set(failedDeliveries.map((f) => f.subscriberName))
|
|
541
541
|
];
|
|
542
|
-
|
|
542
|
+
chunk45B2GD4P_cjs.getLogger().error(
|
|
543
543
|
{
|
|
544
544
|
failedSubscribers: failedSubscriberNames,
|
|
545
545
|
retriesAttempted: this.config.maxRetries
|
|
@@ -826,8 +826,8 @@ function validateEvent(eventName, attributes, config) {
|
|
|
826
826
|
// src/track.ts
|
|
827
827
|
var eventsQueue = null;
|
|
828
828
|
function buildAutotelContext(span) {
|
|
829
|
-
const eventsConfig =
|
|
830
|
-
const config =
|
|
829
|
+
const eventsConfig = chunk45B2GD4P_cjs.getEventsConfig();
|
|
830
|
+
const config = chunk45B2GD4P_cjs.getConfig();
|
|
831
831
|
const correlationId = getOrCreateCorrelationId();
|
|
832
832
|
if (!eventsConfig?.includeTraceContext) {
|
|
833
833
|
return {
|
|
@@ -881,12 +881,12 @@ function buildAutotelContext(span) {
|
|
|
881
881
|
return autotelContext;
|
|
882
882
|
}
|
|
883
883
|
function getOrCreateQueue() {
|
|
884
|
-
if (!
|
|
885
|
-
|
|
884
|
+
if (!chunk45B2GD4P_cjs.isInitialized()) {
|
|
885
|
+
chunk45B2GD4P_cjs.warnIfNotInitialized("track()");
|
|
886
886
|
return null;
|
|
887
887
|
}
|
|
888
888
|
if (!eventsQueue) {
|
|
889
|
-
const config =
|
|
889
|
+
const config = chunk45B2GD4P_cjs.getConfig();
|
|
890
890
|
if (!config?.subscribers || config.subscribers.length === 0) {
|
|
891
891
|
return null;
|
|
892
892
|
}
|
|
@@ -897,7 +897,7 @@ function getOrCreateQueue() {
|
|
|
897
897
|
function track(event, data) {
|
|
898
898
|
const queue = getOrCreateQueue();
|
|
899
899
|
if (!queue) return;
|
|
900
|
-
const validationConfig =
|
|
900
|
+
const validationConfig = chunk45B2GD4P_cjs.getValidationConfig();
|
|
901
901
|
const validated = validateEvent(event, data, validationConfig || void 0);
|
|
902
902
|
const span = api.trace.getActiveSpan();
|
|
903
903
|
const enrichedData = span ? {
|
|
@@ -1203,5 +1203,5 @@ exports.structuredErrorToJSON = structuredErrorToJSON;
|
|
|
1203
1203
|
exports.toAttributeValue = toAttributeValue;
|
|
1204
1204
|
exports.track = track;
|
|
1205
1205
|
exports.validateEvent = validateEvent;
|
|
1206
|
-
//# sourceMappingURL=chunk-
|
|
1207
|
-
//# sourceMappingURL=chunk-
|
|
1206
|
+
//# sourceMappingURL=chunk-LIYNUGML.cjs.map
|
|
1207
|
+
//# sourceMappingURL=chunk-LIYNUGML.cjs.map
|