dd-trace 5.135.0 → 5.136.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.
- package/ci/init.js +2 -22
- package/ext/exporters.js +0 -1
- package/index.d.ts +105 -5
- package/initialize.mjs +5 -2
- package/lambda.d.ts +39 -0
- package/lambda.js +3 -0
- package/package.json +11 -9
- package/packages/datadog-esbuild/index.js +8 -55
- package/packages/datadog-instrumentations/src/aws-lambda.js +88 -0
- package/packages/datadog-instrumentations/src/cucumber.js +5 -2
- package/packages/datadog-instrumentations/src/elevenlabs/activity.js +114 -0
- package/packages/datadog-instrumentations/src/elevenlabs/audio.js +104 -0
- package/packages/datadog-instrumentations/src/elevenlabs/index.js +288 -0
- package/packages/datadog-instrumentations/src/elevenlabs/session.js +444 -0
- package/packages/datadog-instrumentations/src/graphql.js +20 -17
- package/packages/{datadog-esbuild/src/utils.js → datadog-instrumentations/src/helpers/bundler-esm-exports.js} +282 -40
- package/packages/datadog-instrumentations/src/helpers/bundler-transform.js +573 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-utils.js +104 -0
- package/packages/datadog-instrumentations/src/helpers/hook.js +29 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +3 -7
- package/packages/datadog-instrumentations/src/helpers/lambda-handler.js +189 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +2 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +18 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/async-mutex.js +41 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/elevenlabs.js +25 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +0 -36
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/next.js +40 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/openai-agents-realtime.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/trpc.js +148 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/target-patterns.json +50 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +17 -3
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +59 -2
- package/packages/datadog-instrumentations/src/ioredis.js +101 -3
- package/packages/datadog-instrumentations/src/next.js +19 -6
- package/packages/datadog-instrumentations/src/openai-agents-realtime.js +149 -0
- package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +27 -0
- package/packages/datadog-instrumentations/src/openai-realtime/index.js +17 -6
- package/packages/datadog-instrumentations/src/openai-realtime/server-playback.js +887 -0
- package/packages/datadog-instrumentations/src/openai-realtime/session.js +150 -25
- package/packages/datadog-instrumentations/src/openai-realtime/turns.js +29 -2
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +11 -9
- package/packages/datadog-instrumentations/src/webdriverio.js +12 -12
- package/packages/datadog-plugin-async-mutex/src/index.js +50 -0
- package/packages/datadog-plugin-aws-lambda/src/index.js +106 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +22 -11
- package/packages/datadog-plugin-elevenlabs/src/index.js +69 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +10 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +19 -52
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +4 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +25 -4
- package/packages/datadog-plugin-http/src/client.js +32 -9
- package/packages/datadog-plugin-http2/src/client.js +38 -13
- package/packages/datadog-plugin-next/src/index.js +112 -14
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +5 -3
- package/packages/datadog-plugin-trpc/src/index.js +15 -0
- package/packages/datadog-plugin-trpc/src/procedure.js +48 -0
- package/packages/datadog-plugin-trpc/src/request.js +81 -0
- package/packages/datadog-plugin-undici/src/index.js +22 -7
- package/packages/datadog-turbopack/index.js +4 -28
- package/packages/datadog-turbopack/src/loader.js +14 -452
- package/packages/datadog-webpack/index.js +3 -55
- package/packages/dd-trace/src/aiguard/evaluation.js +62 -1
- package/packages/dd-trace/src/aiguard/sdk.js +8 -2
- package/packages/dd-trace/src/aiguard/tags.js +2 -0
- package/packages/dd-trace/src/appsec/blocking/index.js +4 -0
- package/packages/dd-trace/src/appsec/graphql.js +91 -6
- package/packages/dd-trace/src/appsec/recommended.json +1287 -90
- package/packages/dd-trace/src/before-exit.js +32 -0
- package/packages/dd-trace/src/bootstrap.js +5 -3
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +15 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +12 -34
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +41 -13
- package/packages/dd-trace/src/ci-visibility/exporters/request.js +2 -3
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +1 -2
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +1 -1
- package/packages/dd-trace/src/ci-visibility/telemetry.js +6 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +1 -1
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +9 -134
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache.js +11 -156
- package/packages/dd-trace/src/config/config-types.d.ts +3 -0
- package/packages/dd-trace/src/config/defaults.js +5 -0
- package/packages/dd-trace/src/config/generated-config-types.d.ts +42 -2
- package/packages/dd-trace/src/config/index.js +17 -5
- package/packages/dd-trace/src/config/parsers.js +9 -0
- package/packages/dd-trace/src/config/supported-configurations.json +158 -4
- package/packages/dd-trace/src/constants.js +1 -0
- package/packages/dd-trace/src/debugger/pause-duration-histogram.js +2 -1
- package/packages/dd-trace/src/exporter.js +0 -11
- package/packages/dd-trace/src/exporters/common/request.js +81 -48
- package/packages/dd-trace/src/exporters/common/retry.js +12 -7
- package/packages/dd-trace/src/exporters/common/url.js +1 -1
- package/packages/dd-trace/src/id.js +1 -1
- package/packages/dd-trace/src/lambda/facade.js +74 -0
- package/packages/dd-trace/src/lambda/handler.js +3 -41
- package/packages/dd-trace/src/lambda/index.js +38 -15
- package/packages/dd-trace/src/lambda/runtime/patch.js +19 -3
- package/packages/dd-trace/src/lambda/wrap.js +44 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +2 -0
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +10 -5
- package/packages/dd-trace/src/llmobs/plugins/elevenlabs.js +96 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +19 -6
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +38 -11
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +10 -2
- package/packages/dd-trace/src/llmobs/sdk.js +19 -0
- package/packages/dd-trace/src/llmobs/span_processor.js +9 -0
- package/packages/dd-trace/src/llmobs/tagger.js +22 -0
- package/packages/dd-trace/src/log/channels.js +4 -0
- package/packages/dd-trace/src/log/writer.js +6 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +4 -0
- package/packages/dd-trace/src/openfeature/configuration_source.js +35 -27
- package/packages/dd-trace/src/openfeature/flag-selection.js +152 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +19 -1
- package/packages/dd-trace/src/openfeature/writers/base.js +1 -3
- package/packages/dd-trace/src/opentelemetry/logs/index.js +11 -0
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +7 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +4 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +19 -1
- package/packages/dd-trace/src/opentelemetry/span-ending-hook.js +5 -1
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +6 -1
- package/packages/dd-trace/src/opentelemetry/span.js +2 -2
- package/packages/dd-trace/src/opentelemetry/startup-config.js +174 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +7 -1
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +77 -23
- package/packages/dd-trace/src/opentracing/tracer.js +24 -0
- package/packages/dd-trace/src/otel-thread-ctx.js +28 -31
- package/packages/dd-trace/src/plugin_manager.js +34 -7
- package/packages/dd-trace/src/plugins/ci_plugin.js +41 -10
- package/packages/dd-trace/src/plugins/index.js +6 -0
- package/packages/dd-trace/src/plugins/plugin.js +4 -2
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/ci.js +18 -1
- package/packages/dd-trace/src/plugins/util/git-cache.js +4 -4
- package/packages/dd-trace/src/plugins/util/git.js +263 -82
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +75 -46
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +12 -4
- package/packages/dd-trace/src/plugins/util/status-validator.js +23 -10
- package/packages/dd-trace/src/plugins/util/tags.js +6 -0
- package/packages/dd-trace/src/plugins/util/test.js +64 -39
- package/packages/dd-trace/src/plugins/util/url.js +10 -2
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +2 -2
- package/packages/dd-trace/src/plugins/util/web.js +65 -10
- package/packages/dd-trace/src/profiling/webspan-utils.js +6 -5
- package/packages/dd-trace/src/proxy.js +33 -53
- package/packages/dd-trace/src/span_processor.js +20 -0
- package/packages/dd-trace/src/startup-log.js +8 -6
- package/packages/dd-trace/src/telemetry/metrics.js +2 -1
- package/packages/dd-trace/src/tracer.js +0 -2
- package/packages/dd-trace/src/web-tags-cache.js +8 -9
- package/register.js +2 -1
- package/vendor/dist/@apm-js-collab/code-transformer/LICENSE +489 -0
- package/vendor/dist/@datadog/flagging-core/LICENSE +221 -0
- package/vendor/dist/@datadog/flagging-core/index.js +1 -0
- package/vendor/dist/@datadog/openfeature-node-server/LICENSE +21 -1
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/LICENSE +3 -1
- package/vendor/dist/@datadog/sketches-js/LICENSE +263 -0
- package/vendor/dist/@datadog/source-map/LICENSE +1 -0
- package/vendor/dist/@isaacs/ttlcache/LICENSE +13 -0
- package/vendor/dist/@opentelemetry/core/LICENSE +209 -1
- package/vendor/dist/crypto-randomuuid/LICENSE +3 -0
- package/vendor/dist/escape-string-regexp/LICENSE +13 -0
- package/vendor/dist/esquery/LICENSE +2 -0
- package/vendor/dist/https-proxy-agent/LICENSE +80 -1
- package/vendor/dist/istanbul-lib-coverage/LICENSE +2 -0
- package/vendor/dist/jest-docblock/LICENSE +16 -0
- package/vendor/dist/jsonpath-plus/LICENSE +13 -0
- package/vendor/dist/limiter/LICENSE +2 -0
- package/vendor/dist/lodash.sortby/LICENSE +2 -0
- package/vendor/dist/lru-cache/LICENSE +13 -0
- package/vendor/dist/meriyah/LICENSE +13 -0
- package/vendor/dist/module-details-from-path/LICENSE +2 -0
- package/vendor/dist/mutexify/promise/LICENSE +28 -0
- package/vendor/dist/pprof-format/LICENSE +13 -0
- package/vendor/dist/pprof-format/index.js +1 -1
- package/vendor/dist/protobufjs/LICENSE +219 -0
- package/vendor/dist/protobufjs/minimal/LICENSE +219 -0
- package/vendor/dist/proxy-from-env/LICENSE +13 -0
- package/vendor/dist/retry/LICENSE +2 -0
- package/vendor/dist/rfdc/LICENSE +2 -0
- package/vendor/dist/semifies/LICENSE +3 -1
- package/vendor/dist/shell-quote/LICENSE +3 -1
- package/vendor/dist/source-map/LICENSE +1 -0
- package/vendor/dist/source-map/lib/util/LICENSE +1 -0
- package/vendor/dist/tlhunter-sorted-set/LICENSE +2 -0
- package/vendor/dist/ttl-set/LICENSE +28 -0
- package/ci/diagnose.js +0 -2215
- package/ci/runbook.md +0 -299
- package/ci/test-optimization-validation/approval-artifacts.js +0 -175
- package/ci/test-optimization-validation/approval.js +0 -386
- package/ci/test-optimization-validation/artifact-id.js +0 -18
- package/ci/test-optimization-validation/blocker-category.js +0 -24
- package/ci/test-optimization-validation/bounded-json.js +0 -120
- package/ci/test-optimization-validation/ci-command-candidate.js +0 -77
- package/ci/test-optimization-validation/ci-discovery.js +0 -192
- package/ci/test-optimization-validation/ci-package-scripts.js +0 -169
- package/ci/test-optimization-validation/ci-remediation.js +0 -283
- package/ci/test-optimization-validation/cli.js +0 -954
- package/ci/test-optimization-validation/command-blocker.js +0 -377
- package/ci/test-optimization-validation/command-output-policy.js +0 -188
- package/ci/test-optimization-validation/command-runner.js +0 -649
- package/ci/test-optimization-validation/environment.js +0 -88
- package/ci/test-optimization-validation/executable-approval.js +0 -47
- package/ci/test-optimization-validation/executable.js +0 -244
- package/ci/test-optimization-validation/execution-lock.js +0 -70
- package/ci/test-optimization-validation/framework-adapters/cucumber-validation.json +0 -3
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +0 -767
- package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -99
- package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -175
- package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -513
- package/ci/test-optimization-validation/generated-file-policy.js +0 -63
- package/ci/test-optimization-validation/generated-files.js +0 -425
- package/ci/test-optimization-validation/generated-test-contract.js +0 -284
- package/ci/test-optimization-validation/generated-verifier.js +0 -235
- package/ci/test-optimization-validation/literal-environment.js +0 -56
- package/ci/test-optimization-validation/literal-glob.js +0 -52
- package/ci/test-optimization-validation/manifest-loader.js +0 -116
- package/ci/test-optimization-validation/manifest-scaffold.js +0 -1276
- package/ci/test-optimization-validation/manifest-schema.js +0 -695
- package/ci/test-optimization-validation/offline-fixtures.js +0 -335
- package/ci/test-optimization-validation/offline-output.js +0 -406
- package/ci/test-optimization-validation/package-check.js +0 -97
- package/ci/test-optimization-validation/payload-normalizer.js +0 -72
- package/ci/test-optimization-validation/plan-writer.js +0 -541
- package/ci/test-optimization-validation/preflight-runner.js +0 -186
- package/ci/test-optimization-validation/project-build-artifact.js +0 -31
- package/ci/test-optimization-validation/redaction.js +0 -319
- package/ci/test-optimization-validation/report-writer.js +0 -666
- package/ci/test-optimization-validation/result-semantics.js +0 -103
- package/ci/test-optimization-validation/runner-command.js +0 -264
- package/ci/test-optimization-validation/runner-contract.js +0 -695
- package/ci/test-optimization-validation/safe-files.js +0 -202
- package/ci/test-optimization-validation/scenarios/auto-test-retries.js +0 -171
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -407
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +0 -666
- package/ci/test-optimization-validation/scenarios/early-flake-detection.js +0 -142
- package/ci/test-optimization-validation/scenarios/helpers.js +0 -621
- package/ci/test-optimization-validation/scenarios/test-management.js +0 -219
- package/ci/test-optimization-validation/source-text.js +0 -84
- package/ci/test-optimization-validation/static-diagnosis.js +0 -166
- package/ci/test-optimization-validation/test-output.js +0 -120
- package/ci/test-optimization-validation/validation-blocker.js +0 -21
- package/ci/validate-test-optimization.js +0 -3
- package/packages/datadog-esbuild/src/resolver.js +0 -284
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -156
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -287
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/payload-projection.js +0 -84
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -368
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/writer.js +0 -59
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { setTimeout } = require('node:timers')
|
|
3
4
|
const path = require('path')
|
|
4
5
|
|
|
5
6
|
const iitm = require('../../../dd-trace/src/iitm')
|
|
@@ -8,6 +9,8 @@ const log = require('../../../dd-trace/src/log')
|
|
|
8
9
|
const requirePackageJson = require('../../../dd-trace/src/require-package-json')
|
|
9
10
|
const { isNodeBuiltinModuleName } = require('./shared-utils')
|
|
10
11
|
|
|
12
|
+
const VERSION_CACHE_IDLE_TIMEOUT_MS = 1000
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* @param {string} moduleBaseDir
|
|
13
16
|
* @returns {string|undefined}
|
|
@@ -49,6 +52,10 @@ function Hook (modules, hookOptions, onrequire) {
|
|
|
49
52
|
|
|
50
53
|
this._patched = Object.create(null)
|
|
51
54
|
const patched = new WeakMap()
|
|
55
|
+
/** @type {Map<string|undefined, string|undefined>|undefined} */
|
|
56
|
+
let versions
|
|
57
|
+
/** @type {ReturnType<typeof setTimeout>|undefined} */
|
|
58
|
+
let clearVersionsTimer
|
|
52
59
|
|
|
53
60
|
/**
|
|
54
61
|
* @param {object|Function|undefined} moduleExports
|
|
@@ -80,7 +87,28 @@ function Hook (modules, hookOptions, onrequire) {
|
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
try {
|
|
83
|
-
|
|
90
|
+
if (!moduleVersion) {
|
|
91
|
+
moduleVersion = versions?.get(moduleBaseDir)
|
|
92
|
+
if (!moduleVersion) {
|
|
93
|
+
moduleVersion = getVersion(moduleBaseDir)
|
|
94
|
+
if (moduleBaseDir) {
|
|
95
|
+
versions ??= new Map()
|
|
96
|
+
versions.set(moduleBaseDir, moduleVersion)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (versions) {
|
|
100
|
+
if (clearVersionsTimer) {
|
|
101
|
+
clearVersionsTimer.refresh()
|
|
102
|
+
} else {
|
|
103
|
+
const cache = versions
|
|
104
|
+
clearVersionsTimer = setTimeout(() => {
|
|
105
|
+
cache.clear()
|
|
106
|
+
clearVersionsTimer = undefined
|
|
107
|
+
}, VERSION_CACHE_IDLE_TIMEOUT_MS)
|
|
108
|
+
clearVersionsTimer.unref?.()
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
84
112
|
} catch (error) {
|
|
85
113
|
log.error('Error getting version for "%s": %s', moduleName, error.message, error)
|
|
86
114
|
return moduleExports
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
+
'@elevenlabs/elevenlabs-js': () => require('../elevenlabs'),
|
|
4
5
|
// Only list unprefixed node modules. They will automatically be instrumented as prefixed and unprefixed.
|
|
5
6
|
child_process: () => require('../child_process'),
|
|
6
7
|
crypto: () => require('../crypto'),
|
|
@@ -48,7 +49,7 @@ module.exports = {
|
|
|
48
49
|
'@koa/router': () => require('../koa'),
|
|
49
50
|
'@node-redis/client': () => require('../redis'),
|
|
50
51
|
'@opensearch-project/opensearch': () => require('../opensearch'),
|
|
51
|
-
'@opentelemetry/sdk-trace': () => require('../otel-sdk-trace'),
|
|
52
|
+
'@opentelemetry/sdk-trace': { esmFirst: true, fn: () => require('../otel-sdk-trace') },
|
|
52
53
|
'@opentelemetry/sdk-trace-node': () => require('../otel-sdk-trace'),
|
|
53
54
|
'@prisma/client': { esmFirst: true, fn: () => require('../prisma') },
|
|
54
55
|
'./runtime/library.js': () => require('../prisma'),
|
|
@@ -56,10 +57,6 @@ module.exports = {
|
|
|
56
57
|
'@smithy/core': () => require('../aws-sdk'),
|
|
57
58
|
'@smithy/smithy-client': () => require('../aws-sdk'),
|
|
58
59
|
'@vitest/runner': { esmFirst: true, fn: () => require('../vitest') },
|
|
59
|
-
'@wdio/cli': { esmFirst: true, fn: () => require('../webdriverio') },
|
|
60
|
-
'@wdio/jasmine-framework': { esmFirst: true, fn: () => require('../webdriverio') },
|
|
61
|
-
'@wdio/local-runner': { esmFirst: true, fn: () => require('../webdriverio') },
|
|
62
|
-
'@wdio/utils': { esmFirst: true, fn: () => require('../webdriverio') },
|
|
63
60
|
aerospike: () => require('../aerospike'),
|
|
64
61
|
ai: () => require('../ai'),
|
|
65
62
|
amqp10: () => require('../amqp10'),
|
|
@@ -85,7 +82,7 @@ module.exports = {
|
|
|
85
82
|
fastify: () => require('../fastify'),
|
|
86
83
|
'find-my-way': () => require('../find-my-way'),
|
|
87
84
|
'generic-pool': () => require('../generic-pool'),
|
|
88
|
-
graphql: () => require('../graphql'),
|
|
85
|
+
graphql: { esmFirst: true, fn: () => require('../graphql') },
|
|
89
86
|
'graphql-jit': { esmFirst: true, fn: () => require('../graphql') },
|
|
90
87
|
grpc: () => require('../grpc'),
|
|
91
88
|
handlebars: () => require('../handlebars'),
|
|
@@ -154,7 +151,6 @@ module.exports = {
|
|
|
154
151
|
tinypool: { esmFirst: true, fn: () => require('../vitest') },
|
|
155
152
|
undici: () => require('../undici'),
|
|
156
153
|
vitest: { esmFirst: true, fn: () => require('../vitest') },
|
|
157
|
-
webdriverio: { esmFirst: true, fn: () => require('../webdriverio') },
|
|
158
154
|
when: () => require('../when'),
|
|
159
155
|
winston: () => require('../winston'),
|
|
160
156
|
workerpool: () => require('../mocha'),
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { EventEmitter } = require('node:events')
|
|
4
|
+
const { types: { isProxy } } = require('node:util')
|
|
5
|
+
|
|
6
|
+
const HANDLER_STREAMING = Symbol.for('aws.lambda.runtime.handler.streaming')
|
|
7
|
+
const HANDLER_HIGHWATERMARK = Symbol.for('aws.lambda.runtime.handler.streaming.highWaterMark')
|
|
8
|
+
const STREAM_RESPONSE = 'response'
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* MIGRATION SCOPE (#10488): move the existing datadog-lambda-js completion policy as-is.
|
|
12
|
+
* Source: https://github.com/DataDog/datadog-lambda-js/blob/bb5266a00e72eba0edcfe8d73256fe70461547c4/src/utils/handler.ts
|
|
13
|
+
* Only TypeScript types, module syntax and repository formatting are changed in promisifiedHandler below.
|
|
14
|
+
*
|
|
15
|
+
* Known legacy corner cases intentionally left for separate behavior changes:
|
|
16
|
+
* - Callback intent is inferred from handler.length and the returned value. Rest/default parameters can
|
|
17
|
+
* hide callback intent; undefined and server/socket/emitter-like returns can leave completion pending.
|
|
18
|
+
* - Promise.race selects the adapter result, not AWS's native response timing. Callback/context methods
|
|
19
|
+
* are not forwarded to their originals or restored, and outer wrappers can observe that shared mutation.
|
|
20
|
+
* - A handler or then getter can throw synchronously, including after calling a completion method.
|
|
21
|
+
* A callback Promise abandoned by a synchronous return/throw can later reject without an observer.
|
|
22
|
+
* - Metadata, then and artifact detection read properties directly, so getters/Proxy traps can run.
|
|
23
|
+
* A null return can throw during these checks. These are the upstream checks, not a new type policy.
|
|
24
|
+
* - The adapter installs methods on the supplied context. Frozen/read-only contexts, replacement methods
|
|
25
|
+
* and freezing after installation retain the shim's existing behavior; there is no defensive context view.
|
|
26
|
+
* - Buffered calls use (event, context, syntheticCallback); streaming calls use (event, stream, context).
|
|
27
|
+
* Custom receivers, additional arguments and alternative buffered argument positions are not preserved.
|
|
28
|
+
*
|
|
29
|
+
* Record newly identified legacy completion concerns here rather than expanding this migration's policy.
|
|
30
|
+
* Fixes to those behaviors belong in a separate change. A difference introduced by this port is still a bug.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {Function} handler Customer Lambda handler.
|
|
35
|
+
* @returns {Function} Existing shim completion adapter.
|
|
36
|
+
*/
|
|
37
|
+
// Keep the upstream completion policy recognizable for this as-is migration.
|
|
38
|
+
/* eslint-disable unicorn/consistent-function-scoping, no-useless-assignment, unicorn/no-duplicate-if-branches */
|
|
39
|
+
/* eslint-disable sonarjs/prefer-immediate-return, unicorn/no-negated-condition */
|
|
40
|
+
function promisifiedHandler (handler) {
|
|
41
|
+
// Response Stream Lambda function.
|
|
42
|
+
if (handler[HANDLER_STREAMING] !== undefined && handler[HANDLER_STREAMING] === STREAM_RESPONSE) {
|
|
43
|
+
return (event, responseStream, context) => {
|
|
44
|
+
// This handler will always be a promise.
|
|
45
|
+
const promise = handler(event, responseStream, context)
|
|
46
|
+
return promise
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Buffered Lambda function.
|
|
50
|
+
return (event, context) => {
|
|
51
|
+
// Lambda functions in node complete in one of two possible ways.
|
|
52
|
+
// 1. By calling the "callback" function with a result.
|
|
53
|
+
// 2. Returning a value directly from the function using a promise.
|
|
54
|
+
let modifiedCallback = () => {}
|
|
55
|
+
let modifiedLegacyDoneCallback = () => {}
|
|
56
|
+
let modifiedLegacySucceedCallback = () => {}
|
|
57
|
+
let modifiedLegacyFailCallback = () => {}
|
|
58
|
+
const callbackProm = new Promise((resolve, reject) => {
|
|
59
|
+
modifiedCallback = (err, result) => {
|
|
60
|
+
if (err !== undefined && err !== null) {
|
|
61
|
+
reject(err)
|
|
62
|
+
} else {
|
|
63
|
+
resolve(result)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Legacy done callback finished immediately, and doesn't wait for pending
|
|
67
|
+
// event loop
|
|
68
|
+
modifiedLegacyDoneCallback = (err, result) => {
|
|
69
|
+
context.callbackWaitsForEmptyEventLoop = false
|
|
70
|
+
if (err !== undefined && err !== null) {
|
|
71
|
+
reject(err)
|
|
72
|
+
} else {
|
|
73
|
+
resolve(result)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
modifiedLegacySucceedCallback = (result) => {
|
|
77
|
+
context.callbackWaitsForEmptyEventLoop = false
|
|
78
|
+
resolve(result)
|
|
79
|
+
}
|
|
80
|
+
modifiedLegacyFailCallback = (err) => {
|
|
81
|
+
context.callbackWaitsForEmptyEventLoop = false
|
|
82
|
+
reject(err)
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
context.done = modifiedLegacyDoneCallback
|
|
86
|
+
context.succeed = modifiedLegacySucceedCallback
|
|
87
|
+
context.fail = modifiedLegacyFailCallback
|
|
88
|
+
const asyncProm = handler(event, context, modifiedCallback)
|
|
89
|
+
let promise = callbackProm
|
|
90
|
+
if (asyncProm !== undefined && typeof asyncProm.then === 'function') {
|
|
91
|
+
// Mimics behaviour of lambda runtime, the first method of returning a result always wins.
|
|
92
|
+
promise = Promise.race([callbackProm, asyncProm])
|
|
93
|
+
} else if (handler.length >= 3) {
|
|
94
|
+
// Handler takes a callback, wait for the callback to be called
|
|
95
|
+
promise = callbackProm
|
|
96
|
+
} else if (asyncProm === undefined) {
|
|
97
|
+
// Handler returned nothing (implicit `undefined`) and doesn't take a callback parameter.
|
|
98
|
+
// It must be relying on `context.succeed` / `context.done` / `context.fail` to signal
|
|
99
|
+
// completion (e.g. `aws-serverless-express`'s `proxy()` with the default
|
|
100
|
+
// `CONTEXT_SUCCEED` resolution mode, or any other fire-and-forget pattern that finishes
|
|
101
|
+
// asynchronously). Wait for callbackProm rather than resolving immediately, otherwise
|
|
102
|
+
// the wrapper would shortcut the function before its work finishes, which causes the
|
|
103
|
+
// Lambda runtime to return an empty response and freeze the worker before any pending
|
|
104
|
+
// stdout writes are flushed to CloudWatch.
|
|
105
|
+
promise = callbackProm
|
|
106
|
+
} else {
|
|
107
|
+
// Handler returned a value directly
|
|
108
|
+
// Distinguish between:
|
|
109
|
+
// - ordinary sync return value -> resolve immediately
|
|
110
|
+
// - side-effect artifact (e.g. aws-serverless-express server) -> wait for context.done
|
|
111
|
+
// Heuristic: trying to detect common types of side-effect artifacts
|
|
112
|
+
const looksLikeArtifact = asyncProm !== undefined &&
|
|
113
|
+
typeof asyncProm === 'object' &&
|
|
114
|
+
// 1. Node.js http.Server or similar
|
|
115
|
+
((typeof asyncProm.listen === 'function' && typeof asyncProm.close === 'function') ||
|
|
116
|
+
// 2. EventEmitter-like (has .on and .emit)
|
|
117
|
+
(typeof asyncProm.on === 'function' && typeof asyncProm.emit === 'function') ||
|
|
118
|
+
// 3. Instance of EventEmitter (covers Server, Socket, etc.)
|
|
119
|
+
asyncProm instanceof EventEmitter ||
|
|
120
|
+
// 4. Constructor name hint
|
|
121
|
+
(asyncProm.constructor && /Server|Socket|Emitter/i.test(asyncProm.constructor.name)))
|
|
122
|
+
if (looksLikeArtifact) {
|
|
123
|
+
// Wait for callbackProm instead (the context.done/succeed/fail will resolve it)
|
|
124
|
+
promise = callbackProm
|
|
125
|
+
} else {
|
|
126
|
+
// Return the value directly
|
|
127
|
+
promise = Promise.resolve(asyncProm)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return promise
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* eslint-enable unicorn/consistent-function-scoping, no-useless-assignment, unicorn/no-duplicate-if-branches */
|
|
135
|
+
/* eslint-enable sonarjs/prefer-immediate-return, unicorn/no-negated-condition */
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Reads metadata without executing application getters or Proxy traps.
|
|
139
|
+
*
|
|
140
|
+
* @param {unknown} target
|
|
141
|
+
* @param {string | symbol} name
|
|
142
|
+
*/
|
|
143
|
+
function getDataProperty (target, name) {
|
|
144
|
+
if (target === null || (typeof target !== 'object' && typeof target !== 'function')) return
|
|
145
|
+
while (target !== null && !isProxy(target)) {
|
|
146
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, name)
|
|
147
|
+
if (descriptor) return descriptor.value
|
|
148
|
+
target = Object.getPrototypeOf(target)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Copies data properties without running customer metadata getters or Proxy traps.
|
|
154
|
+
*
|
|
155
|
+
* @param {Function} handler Original handler.
|
|
156
|
+
* @param {Function} wrapped Wrapper to receive safe metadata.
|
|
157
|
+
*/
|
|
158
|
+
function copyHandlerMetadata (handler, wrapped) {
|
|
159
|
+
// datadog-lambda-js uses arity and the runtime's streaming metadata to choose how to invoke the handler.
|
|
160
|
+
Object.defineProperty(wrapped, 'length', { value: getDataProperty(handler, 'length') ?? 0 })
|
|
161
|
+
for (const name of [HANDLER_STREAMING, HANDLER_HIGHWATERMARK, '_ddWrapped']) {
|
|
162
|
+
const value = getDataProperty(handler, name)
|
|
163
|
+
if (value !== undefined) wrapped[name] = value
|
|
164
|
+
}
|
|
165
|
+
if (!isProxy(handler)) {
|
|
166
|
+
for (const name of Reflect.ownKeys(handler)) {
|
|
167
|
+
if (name === 'arguments' || name === 'caller') continue
|
|
168
|
+
const descriptor = Object.getOwnPropertyDescriptor(handler, name)
|
|
169
|
+
if (!Object.hasOwn(descriptor, 'value')) continue
|
|
170
|
+
const existing = Object.getOwnPropertyDescriptor(wrapped, name)
|
|
171
|
+
if (existing?.configurable === false) {
|
|
172
|
+
// Intrinsic function slots such as prototype cannot change their descriptor shape.
|
|
173
|
+
if (existing.writable) {
|
|
174
|
+
Object.defineProperty(wrapped, name, { value: descriptor.value, writable: descriptor.writable })
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
Object.defineProperty(wrapped, name, descriptor)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
module.exports = {
|
|
184
|
+
HANDLER_STREAMING,
|
|
185
|
+
copyHandlerMetadata,
|
|
186
|
+
getDataProperty,
|
|
187
|
+
STREAM_RESPONSE,
|
|
188
|
+
promisifiedHandler,
|
|
189
|
+
}
|
|
@@ -195,6 +195,7 @@ function createMatcher (dcModule) {
|
|
|
195
195
|
configureGraphqlJitRuntime,
|
|
196
196
|
configureMercuriusRequest,
|
|
197
197
|
publishDurableOrchestrationFailure,
|
|
198
|
+
publishTrpcRequestInfo,
|
|
198
199
|
waitForAsyncEnd,
|
|
199
200
|
} = require('./transforms')
|
|
200
201
|
const {
|
|
@@ -216,6 +217,7 @@ function createMatcher (dcModule) {
|
|
|
216
217
|
matcher.addTransform('configureMercuriusRequest', configureMercuriusRequest)
|
|
217
218
|
matcher.addTransform('publishDurableOrchestrationFailure', publishDurableOrchestrationFailure)
|
|
218
219
|
matcher.addTransform('postgresQueryAcquire', postgresQueryAcquire)
|
|
220
|
+
matcher.addTransform('publishTrpcRequestInfo', publishTrpcRequestInfo)
|
|
219
221
|
matcher.addTransform('postgresQueryHandlers', postgresQueryHandlers)
|
|
220
222
|
matcher.addTransform('postgresQueryLifecycle', postgresQueryLifecycle)
|
|
221
223
|
matcher.addTransform('postgresQueryPreparation', postgresQueryPreparation)
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
/** @satisfies {InstrumentationRegistryEntry[]} */
|
|
24
24
|
const registry = [
|
|
25
25
|
{ instrumentations: require('./instrumentations/ai') },
|
|
26
|
+
{ activate: true, instrumentations: require('./instrumentations/async-mutex') },
|
|
26
27
|
{ activate: true, instrumentations: require('./instrumentations/azure-cosmos') },
|
|
27
28
|
{ instrumentations: require('./instrumentations/azure-durable-functions') },
|
|
28
29
|
{ activate: true, instrumentations: require('./instrumentations/bullmq') },
|
|
@@ -30,6 +31,10 @@ const registry = [
|
|
|
30
31
|
activate: { setup: () => require('../../claude-agent-sdk') },
|
|
31
32
|
instrumentations: require('./instrumentations/claude-agent-sdk'),
|
|
32
33
|
},
|
|
34
|
+
{
|
|
35
|
+
activate: { setup: () => require('../../elevenlabs') },
|
|
36
|
+
instrumentations: require('./instrumentations/elevenlabs'),
|
|
37
|
+
},
|
|
33
38
|
{ instrumentations: require('./instrumentations/graphql') },
|
|
34
39
|
{ instrumentations: require('./instrumentations/graphql-jit') },
|
|
35
40
|
{ instrumentations: require('./instrumentations/jest') },
|
|
@@ -37,7 +42,12 @@ const registry = [
|
|
|
37
42
|
{ activate: true, instrumentations: require('./instrumentations/langgraph') },
|
|
38
43
|
{ activate: true, instrumentations: require('./instrumentations/mercurius') },
|
|
39
44
|
{ instrumentations: require('./instrumentations/modelcontextprotocol-sdk') },
|
|
45
|
+
{ instrumentations: require('./instrumentations/next') },
|
|
40
46
|
{ instrumentations: require('./instrumentations/openai-agents') },
|
|
47
|
+
{
|
|
48
|
+
activate: { setup: () => require('../../openai-agents-realtime') },
|
|
49
|
+
instrumentations: require('./instrumentations/openai-agents-realtime'),
|
|
50
|
+
},
|
|
41
51
|
{ instrumentations: require('./instrumentations/playwright') },
|
|
42
52
|
{ activate: true, instrumentations: require('./instrumentations/postgres') },
|
|
43
53
|
{
|
|
@@ -45,7 +55,13 @@ const registry = [
|
|
|
45
55
|
instrumentations: require('./instrumentations/react-router'),
|
|
46
56
|
},
|
|
47
57
|
{ instrumentations: require('./instrumentations/vitest') },
|
|
48
|
-
{
|
|
58
|
+
{
|
|
59
|
+
activate: {
|
|
60
|
+
modules: ['@wdio/cli', '@wdio/jasmine-framework', '@wdio/local-runner', '@wdio/utils', 'webdriverio'],
|
|
61
|
+
setup: activation => require('../../webdriverio').recordLocalRunnerVersion(activation),
|
|
62
|
+
},
|
|
63
|
+
instrumentations: require('./instrumentations/webdriverio'),
|
|
64
|
+
},
|
|
49
65
|
{
|
|
50
66
|
activate: { setup: () => require('../../aws-durable-execution-sdk-js') },
|
|
51
67
|
instrumentations: require('./instrumentations/aws-durable-execution-sdk-js'),
|
|
@@ -55,6 +71,7 @@ const registry = [
|
|
|
55
71
|
activate: { setup: () => require('../../typesafe') },
|
|
56
72
|
instrumentations: require('./instrumentations/typesafe'),
|
|
57
73
|
},
|
|
74
|
+
{ activate: true, instrumentations: require('./instrumentations/trpc') },
|
|
58
75
|
]
|
|
59
76
|
|
|
60
77
|
const activatedModules = new Set()
|
package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/async-mutex.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
module: {
|
|
6
|
+
name: 'async-mutex',
|
|
7
|
+
versionRange: '>=0.5.0',
|
|
8
|
+
filePath: 'lib/Semaphore.js',
|
|
9
|
+
},
|
|
10
|
+
functionQuery: {
|
|
11
|
+
expressionName: 'acquire',
|
|
12
|
+
kind: 'Async',
|
|
13
|
+
},
|
|
14
|
+
channelName: 'Semaphore_acquire',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
module: {
|
|
18
|
+
name: 'async-mutex',
|
|
19
|
+
versionRange: '>=0.5.0',
|
|
20
|
+
filePath: 'es6/Semaphore.js',
|
|
21
|
+
},
|
|
22
|
+
functionQuery: {
|
|
23
|
+
expressionName: 'acquire',
|
|
24
|
+
kind: 'Async',
|
|
25
|
+
},
|
|
26
|
+
channelName: 'Semaphore_acquire',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
module: {
|
|
30
|
+
name: 'async-mutex',
|
|
31
|
+
versionRange: '>=0.5.0',
|
|
32
|
+
filePath: 'index.mjs',
|
|
33
|
+
},
|
|
34
|
+
functionQuery: {
|
|
35
|
+
className: 'Semaphore',
|
|
36
|
+
methodName: 'acquire',
|
|
37
|
+
kind: 'Async',
|
|
38
|
+
},
|
|
39
|
+
channelName: 'Semaphore_acquire',
|
|
40
|
+
},
|
|
41
|
+
]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// The published Node SDK is CommonJS; ESM imports resolve to these same files.
|
|
4
|
+
// Public message callbacks run after tool dispatch, and startSession resolves after audio startup.
|
|
5
|
+
// These version-gated funnels preserve those earlier observation points; real-SDK CJS/ESM tests cover them.
|
|
6
|
+
module.exports = [
|
|
7
|
+
...['startSession', '_onWebSocketOpen', '_handleMessage', '_onWebSocketClose', 'endSession'].map(methodName => ({
|
|
8
|
+
module: {
|
|
9
|
+
name: '@elevenlabs/elevenlabs-js',
|
|
10
|
+
versionRange: '>=2.75.0 <3',
|
|
11
|
+
filePath: 'api/resources/conversationalAi/conversation/Conversation.js',
|
|
12
|
+
},
|
|
13
|
+
functionQuery: { className: 'Conversation', methodName, kind: methodName === 'startSession' ? 'Async' : 'Sync' },
|
|
14
|
+
channelName: methodName,
|
|
15
|
+
})),
|
|
16
|
+
...['register', 'executeToolAsync'].map(methodName => ({
|
|
17
|
+
module: {
|
|
18
|
+
name: '@elevenlabs/elevenlabs-js',
|
|
19
|
+
versionRange: '>=2.75.0 <3',
|
|
20
|
+
filePath: 'api/resources/conversationalAi/conversation/ClientTools.js',
|
|
21
|
+
},
|
|
22
|
+
functionQuery: { className: 'ClientTools', methodName },
|
|
23
|
+
channelName: methodName,
|
|
24
|
+
})),
|
|
25
|
+
]
|
|
@@ -210,18 +210,6 @@ const instrumentations = [
|
|
|
210
210
|
},
|
|
211
211
|
channelName: 'dd:graphql:printer:load',
|
|
212
212
|
},
|
|
213
|
-
{
|
|
214
|
-
module: {
|
|
215
|
-
name: 'graphql',
|
|
216
|
-
versionRange: '>=0.10',
|
|
217
|
-
filePath: 'language/printer.mjs',
|
|
218
|
-
},
|
|
219
|
-
functionQuery: {
|
|
220
|
-
functionName: '__module_export__',
|
|
221
|
-
kind: 'Sync',
|
|
222
|
-
},
|
|
223
|
-
channelName: 'dd:graphql:printer:load',
|
|
224
|
-
},
|
|
225
213
|
{
|
|
226
214
|
module: {
|
|
227
215
|
name: 'graphql',
|
|
@@ -234,18 +222,6 @@ const instrumentations = [
|
|
|
234
222
|
},
|
|
235
223
|
channelName: 'dd:graphql:visitor:load',
|
|
236
224
|
},
|
|
237
|
-
{
|
|
238
|
-
module: {
|
|
239
|
-
name: 'graphql',
|
|
240
|
-
versionRange: '>=0.10',
|
|
241
|
-
filePath: 'language/visitor.mjs',
|
|
242
|
-
},
|
|
243
|
-
functionQuery: {
|
|
244
|
-
functionName: '__module_export__',
|
|
245
|
-
kind: 'Sync',
|
|
246
|
-
},
|
|
247
|
-
channelName: 'dd:graphql:visitor:load',
|
|
248
|
-
},
|
|
249
225
|
{
|
|
250
226
|
module: {
|
|
251
227
|
name: 'graphql',
|
|
@@ -258,18 +234,6 @@ const instrumentations = [
|
|
|
258
234
|
},
|
|
259
235
|
channelName: 'dd:graphql:utilities:load',
|
|
260
236
|
},
|
|
261
|
-
{
|
|
262
|
-
module: {
|
|
263
|
-
name: 'graphql',
|
|
264
|
-
versionRange: '>=0.10',
|
|
265
|
-
filePath: 'utilities/index.mjs',
|
|
266
|
-
},
|
|
267
|
-
functionQuery: {
|
|
268
|
-
functionName: '__module_export__',
|
|
269
|
-
kind: 'Sync',
|
|
270
|
-
},
|
|
271
|
-
channelName: 'dd:graphql:utilities:load',
|
|
272
|
-
},
|
|
273
237
|
]
|
|
274
238
|
|
|
275
239
|
const fastPathInstrumentations = []
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const astQuery = 'MethodDefinition[key.name="handleNextImageRequest"] > FunctionExpression, ' +
|
|
4
|
+
'AssignmentExpression[left.object.type="ThisExpression"]' +
|
|
5
|
+
'[left.property.name="handleNextImageRequest"] > ArrowFunctionExpression, ' +
|
|
6
|
+
'ObjectExpression:has(Property[key.name="name"][value.value="_next/image catchall"])' +
|
|
7
|
+
' > Property[key.name="fn"] > ArrowFunctionExpression'
|
|
8
|
+
|
|
9
|
+
module.exports = [
|
|
10
|
+
{
|
|
11
|
+
module: {
|
|
12
|
+
name: 'next',
|
|
13
|
+
versionRange: '>=10.2 <11.1',
|
|
14
|
+
filePath: 'dist/next-server/server/next-server.js',
|
|
15
|
+
},
|
|
16
|
+
functionQuery: { kind: 'Async', index: null },
|
|
17
|
+
astQuery,
|
|
18
|
+
channelName: 'imageRequest',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
module: {
|
|
22
|
+
name: 'next',
|
|
23
|
+
versionRange: '>=11.1 <15.2',
|
|
24
|
+
filePath: 'dist/server/next-server.js',
|
|
25
|
+
},
|
|
26
|
+
functionQuery: { kind: 'Async', index: null },
|
|
27
|
+
astQuery,
|
|
28
|
+
channelName: 'imageRequest',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
module: {
|
|
32
|
+
name: 'next',
|
|
33
|
+
versionRange: '>=15.2',
|
|
34
|
+
filePath: 'dist/server/next-server.js',
|
|
35
|
+
},
|
|
36
|
+
functionQuery: { kind: 'Async', index: null },
|
|
37
|
+
astQuery,
|
|
38
|
+
channelName: 'imageRequestWithMiddleware',
|
|
39
|
+
},
|
|
40
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const entries = []
|
|
4
|
+
for (const extension of ['js', 'mjs']) {
|
|
5
|
+
for (const [channelName, functionQuery] of Object.entries({
|
|
6
|
+
constructor: { methodName: 'constructor', kind: 'Sync' },
|
|
7
|
+
connect: { methodName: 'connect', kind: 'Async' },
|
|
8
|
+
send: { privateMethodName: 'sendEventNow', kind: 'Sync' },
|
|
9
|
+
close: { methodName: 'close', kind: 'Sync' },
|
|
10
|
+
})) {
|
|
11
|
+
entries.push({
|
|
12
|
+
module: {
|
|
13
|
+
name: '@openai/agents-realtime',
|
|
14
|
+
versionRange: '>=0.20.0',
|
|
15
|
+
filePath: 'dist/openaiRealtimeWebsocket.' + extension,
|
|
16
|
+
},
|
|
17
|
+
functionQuery: { className: 'OpenAIRealtimeWebSocket', ...functionQuery },
|
|
18
|
+
channelName,
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = entries
|