autotel 3.4.0 → 3.4.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.
- package/dist/auto.cjs +5 -5
- package/dist/auto.js +3 -3
- package/dist/{chunk-Z3VD3UQZ.cjs → chunk-AC5GNZKB.cjs} +11 -11
- package/dist/{chunk-Z3VD3UQZ.cjs.map → chunk-AC5GNZKB.cjs.map} +1 -1
- package/dist/{chunk-B4CGFDZQ.js → chunk-ALPYR2GC.js} +4 -4
- package/dist/{chunk-B4CGFDZQ.js.map → chunk-ALPYR2GC.js.map} +1 -1
- package/dist/{chunk-643PQG3Y.js → chunk-CMHVQR6P.js} +3 -3
- package/dist/{chunk-643PQG3Y.js.map → chunk-CMHVQR6P.js.map} +1 -1
- package/dist/{chunk-DMSD5AF3.js → chunk-DQEHQNQE.js} +3 -3
- package/dist/{chunk-DMSD5AF3.js.map → chunk-DQEHQNQE.js.map} +1 -1
- package/dist/{chunk-FOFBFQES.cjs → chunk-FGNDN2FD.cjs} +36 -36
- package/dist/{chunk-FOFBFQES.cjs.map → chunk-FGNDN2FD.cjs.map} +1 -1
- package/dist/{chunk-PWOECUNT.cjs → chunk-GBFTC7Q7.cjs} +17 -17
- package/dist/{chunk-PWOECUNT.cjs.map → chunk-GBFTC7Q7.cjs.map} +1 -1
- package/dist/{chunk-HLZ7H3VZ.js → chunk-HT5JQKN2.js} +3 -3
- package/dist/{chunk-HLZ7H3VZ.js.map → chunk-HT5JQKN2.js.map} +1 -1
- package/dist/chunk-NVAI5CCN.cjs +39 -0
- package/dist/chunk-NVAI5CCN.cjs.map +1 -0
- package/dist/{chunk-NMEYVL4L.js → chunk-NVGPMGI4.js} +3 -3
- package/dist/{chunk-NMEYVL4L.js.map → chunk-NVGPMGI4.js.map} +1 -1
- package/dist/{chunk-LCXOOJIP.js → chunk-O4JZUCUE.js} +3 -3
- package/dist/{chunk-LCXOOJIP.js.map → chunk-O4JZUCUE.js.map} +1 -1
- package/dist/{chunk-LKASEUWE.js → chunk-O7JOKRN2.js} +4 -4
- package/dist/{chunk-LKASEUWE.js.map → chunk-O7JOKRN2.js.map} +1 -1
- package/dist/{chunk-2GIBANLB.cjs → chunk-OPPXYVEZ.cjs} +4 -4
- package/dist/{chunk-2GIBANLB.cjs.map → chunk-OPPXYVEZ.cjs.map} +1 -1
- package/dist/chunk-Q4EULJQY.js +35 -0
- package/dist/chunk-Q4EULJQY.js.map +1 -0
- package/dist/{chunk-FEEVB2GV.cjs → chunk-QWW3E3JM.cjs} +4 -4
- package/dist/{chunk-FEEVB2GV.cjs.map → chunk-QWW3E3JM.cjs.map} +1 -1
- package/dist/{chunk-RYVFCHSO.cjs → chunk-R7QYGZUP.cjs} +16 -16
- package/dist/{chunk-RYVFCHSO.cjs.map → chunk-R7QYGZUP.cjs.map} +1 -1
- package/dist/{chunk-TEXCI2S6.js → chunk-URHPSJW2.js} +4 -4
- package/dist/{chunk-TEXCI2S6.js.map → chunk-URHPSJW2.js.map} +1 -1
- package/dist/{chunk-BGO7TZID.cjs → chunk-VG2ABKJX.cjs} +7 -7
- package/dist/{chunk-BGO7TZID.cjs.map → chunk-VG2ABKJX.cjs.map} +1 -1
- package/dist/{chunk-AIX6BVNN.js → chunk-YWCESU4Y.js} +5 -5
- package/dist/{chunk-AIX6BVNN.js.map → chunk-YWCESU4Y.js.map} +1 -1
- package/dist/{chunk-6WWXA6IK.cjs → chunk-Z6HRSM2Y.cjs} +5 -5
- package/dist/{chunk-6WWXA6IK.cjs.map → chunk-Z6HRSM2Y.cjs.map} +1 -1
- package/dist/{chunk-JAX4LFGG.cjs → chunk-Z7PW3KHL.cjs} +13 -13
- package/dist/{chunk-JAX4LFGG.cjs.map → chunk-Z7PW3KHL.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 +89 -85
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -14
- package/dist/{init-DyE43paw.d.ts → init-DIowiiCh.d.ts} +5 -1
- package/dist/{init-gyesUMwz.d.cts → init-j-A1zI16.d.cts} +5 -1
- 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.d.cts +1 -1
- package/dist/yaml-config.d.ts +1 -1
- package/dist/yaml-config.js +2 -2
- package/package.json +1 -1
- package/src/index.ts +7 -1
- package/src/node-require.ts +45 -6
- package/dist/chunk-HR5YFXZW.cjs +0 -27
- package/dist/chunk-HR5YFXZW.cjs.map +0 -1
- package/dist/chunk-KVDA4HX2.js +0 -23
- package/dist/chunk-KVDA4HX2.js.map +0 -1
package/src/node-require.ts
CHANGED
|
@@ -23,9 +23,30 @@ import { createRequire } from 'node:module';
|
|
|
23
23
|
// `typeof __filename` does NOT throw when the identifier is undeclared, so
|
|
24
24
|
// the ESM build evaluates the conditional safely.
|
|
25
25
|
declare const __filename: string | undefined;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
|
|
27
|
+
// Build the Node `require` lazily on first use. Calling `createRequire`
|
|
28
|
+
// eagerly at module load crashes in runtimes where neither `__filename` nor
|
|
29
|
+
// `import.meta.url` resolves to a path — e.g. Cloudflare Workers / workerd,
|
|
30
|
+
// where the bundle has no module path and `createRequire(undefined)` throws
|
|
31
|
+
// synchronously at import. Deferring the call keeps merely importing this
|
|
32
|
+
// module (and therefore anything that re-exports it, such as `track`)
|
|
33
|
+
// side-effect-free; Node/CJS/ESM still get a real `require` on first call.
|
|
34
|
+
let cachedRequire: NodeRequire | undefined;
|
|
35
|
+
|
|
36
|
+
function getNodeRequire(): NodeRequire {
|
|
37
|
+
if (cachedRequire) return cachedRequire;
|
|
38
|
+
const base = typeof __filename === 'string' ? __filename : import.meta.url;
|
|
39
|
+
if (!base) {
|
|
40
|
+
// No module path in this runtime. Surface as a missing-module error so
|
|
41
|
+
// optional lookups via `safeRequire()` degrade gracefully to `undefined`.
|
|
42
|
+
throw Object.assign(
|
|
43
|
+
new Error('node require() is unavailable in this runtime'),
|
|
44
|
+
{ code: 'MODULE_NOT_FOUND' },
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
cachedRequire = createRequire(base);
|
|
48
|
+
return cachedRequire;
|
|
49
|
+
}
|
|
29
50
|
|
|
30
51
|
/**
|
|
31
52
|
* Synchronously require a module (works in both CJS and ESM)
|
|
@@ -46,7 +67,7 @@ const nodeRequire = createRequire(
|
|
|
46
67
|
*/
|
|
47
68
|
export function safeRequire<T = unknown>(id: string): T | undefined {
|
|
48
69
|
try {
|
|
49
|
-
return
|
|
70
|
+
return getNodeRequire()(id) as T;
|
|
50
71
|
} catch (error) {
|
|
51
72
|
if (error && (error as NodeJS.ErrnoException).code === 'MODULE_NOT_FOUND') {
|
|
52
73
|
// Optional dependency missing – return undefined
|
|
@@ -75,10 +96,28 @@ export function safeRequire<T = unknown>(id: string): T | undefined {
|
|
|
75
96
|
* ```
|
|
76
97
|
*/
|
|
77
98
|
export function requireModule<T = unknown>(id: string): T {
|
|
78
|
-
return
|
|
99
|
+
return getNodeRequire()(id) as T;
|
|
79
100
|
}
|
|
80
101
|
|
|
81
102
|
/**
|
|
82
|
-
* Direct access to the nodeRequire function (for advanced use cases)
|
|
103
|
+
* Direct access to the nodeRequire function (for advanced use cases).
|
|
104
|
+
*
|
|
105
|
+
* Lazily resolves the underlying Node `require` on first call, so importing
|
|
106
|
+
* this binding never triggers `createRequire` in runtimes that lack a module
|
|
107
|
+
* path (e.g. Cloudflare Workers).
|
|
108
|
+
*
|
|
109
|
+
* Only the call signature and `resolve` (including `resolve.paths`) are
|
|
110
|
+
* forwarded. The live, mutable members of a real `require` — `.cache`,
|
|
111
|
+
* `.main`, `.extensions` — are intentionally NOT exposed: a lazy wrapper
|
|
112
|
+
* can't mirror that shared state without resolving eagerly, which would
|
|
113
|
+
* reintroduce the workerd crash. Use `createRequire` directly if you need
|
|
114
|
+
* them.
|
|
83
115
|
*/
|
|
116
|
+
const nodeRequire = ((id: string) => getNodeRequire()(id)) as NodeRequire;
|
|
117
|
+
const lazyResolve = ((id: string, options?: { paths?: string[] }) =>
|
|
118
|
+
getNodeRequire().resolve(id, options)) as NodeRequire['resolve'];
|
|
119
|
+
lazyResolve.paths = (request: string) =>
|
|
120
|
+
getNodeRequire().resolve.paths(request);
|
|
121
|
+
nodeRequire.resolve = lazyResolve;
|
|
122
|
+
|
|
84
123
|
export { nodeRequire };
|
package/dist/chunk-HR5YFXZW.cjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var module$1 = require('module');
|
|
4
|
-
|
|
5
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
6
|
-
// src/node-require.ts
|
|
7
|
-
var nodeRequire = module$1.createRequire(
|
|
8
|
-
typeof __filename === "string" ? __filename : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-HR5YFXZW.cjs', document.baseURI).href))
|
|
9
|
-
);
|
|
10
|
-
function safeRequire(id) {
|
|
11
|
-
try {
|
|
12
|
-
return nodeRequire(id);
|
|
13
|
-
} catch (error) {
|
|
14
|
-
if (error && error.code === "MODULE_NOT_FOUND") {
|
|
15
|
-
return void 0;
|
|
16
|
-
}
|
|
17
|
-
throw error;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function requireModule(id) {
|
|
21
|
-
return nodeRequire(id);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
exports.requireModule = requireModule;
|
|
25
|
-
exports.safeRequire = safeRequire;
|
|
26
|
-
//# sourceMappingURL=chunk-HR5YFXZW.cjs.map
|
|
27
|
-
//# sourceMappingURL=chunk-HR5YFXZW.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/node-require.ts"],"names":["createRequire"],"mappings":";;;;;;AAyBA,IAAM,WAAA,GAAcA,sBAAA;AAAA,EAClB,OAAO,UAAA,KAAe,QAAA,GAAW,UAAA,GAAa;AAChD,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-HR5YFXZW.cjs","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"]}
|
package/dist/chunk-KVDA4HX2.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module';
|
|
2
|
-
|
|
3
|
-
// src/node-require.ts
|
|
4
|
-
var nodeRequire = createRequire(
|
|
5
|
-
typeof __filename === "string" ? __filename : import.meta.url
|
|
6
|
-
);
|
|
7
|
-
function safeRequire(id) {
|
|
8
|
-
try {
|
|
9
|
-
return nodeRequire(id);
|
|
10
|
-
} catch (error) {
|
|
11
|
-
if (error && error.code === "MODULE_NOT_FOUND") {
|
|
12
|
-
return void 0;
|
|
13
|
-
}
|
|
14
|
-
throw error;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function requireModule(id) {
|
|
18
|
-
return nodeRequire(id);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { requireModule, safeRequire };
|
|
22
|
-
//# sourceMappingURL=chunk-KVDA4HX2.js.map
|
|
23
|
-
//# sourceMappingURL=chunk-KVDA4HX2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|