Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/datadog-instrumentations/src/multer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function publishRequestBodyAndNext (req, res, next) {
addHook({
name: 'multer',
file: 'lib/make-middleware.js',
versions: ['^1.4.4-lts.1']
versions: ['>=1.4.4-lts.1']
}, makeMiddleware => {
return shimmer.wrapFunction(makeMiddleware, makeMiddleware => function () {
const middleware = makeMiddleware.apply(this, arguments)
Expand Down
27 changes: 25 additions & 2 deletions packages/dd-trace/test/plugins/versions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

const { subset } = require('semver')
const latests = require('./package.json').dependencies
const supported = require('./supported.json')

const dir = 'packages/dd-trace/test/plugins/versions'
const exactVersionExp = /^=?\d+\.\d+\.\d+/

/**
Expand All @@ -25,7 +27,7 @@ function capSubrange (name, subrange) {

if (!latests[name]) {
throw new Error(
`Latest version for '${name}' needs to be defined in 'packages/dd-trace/test/plugins/versions/package.json'.`
`Latest version for '${name}' needs to be defined in '${dir}/package.json'.`
)
}

Expand All @@ -40,6 +42,27 @@ function capSubrange (name, subrange) {
return `${subrange} <=${latests[name]}`
}

/**
* @param {string} name
* @param {string} subrange
*/
function assertSupported (name, subrange) {
if (supported[name] === null) return

if (!supported[name]) {
throw new Error(
`Supported version range for '${name}' needs to be defined in '${dir}/supported.json'.`
)
}

if (!subset(subrange, supported[name])) {
throw new Error(
`Version range '${subrange}' for '${name}' is lower than supported range defined in '${dir}/supported.json'.`
)
}
}

module.exports = {
getCappedRange
getCappedRange,
assertSupported
}
132 changes: 132 additions & 0 deletions packages/dd-trace/test/plugins/versions/supported.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"@apollo/gateway": ">=2.3",
"@apollo/server": ">=4",
"@aws-sdk/smithy-client": ">=3",
"@azure/functions": ">=4",
"@azure/service-bus": ">=7.9.2",
"@confluentinc/kafka-javascript": ">=1",
"@cucumber/cucumber": ">=7",
"@elastic/elasticsearch": ">=5.6.16",
"@elastic/transport": ">=8",
"@google-cloud/pubsub": ">=1.2",
"@google-cloud/vertexai": ">=1",
"@graphql-tools/executor": ">=0.0.14",
"@grpc/grpc-js": ">=1.0.3",
"@hapi/hapi": ">=17.9",
"@jest/core": ">=24.8",
"@jest/reporters": ">=24.8",
"@jest/test-sequencer": ">=28",
"@jest/transform": ">=24.8",
"@koa/router": ">=8",
"@langchain/core": ">=0.1",
"@node-redis/client": ">=1",
"@opensearch-project/opensearch": ">=1",
"@prisma/client": ">=6.1",
"@redis/client": ">=1.1",
"@smithy/smithy-client": ">=1.0.3",
"@vitest/runner": ">=1.6",
"aerospike": ">=4",
"amqp10": ">=3",
"amqplib": ">=0.5.0",
"apollo-server-core": ">=3",
"avsc": ">=5",
"aws-sdk": ">=2.1.35",
"bluebird": ">=2.0.2",
"body-parser": ">=1.4",
"bunyan": ">=1",
"cassandra-driver": ">=3",
"child_process": null,
"connect": ">=2.2.2",
"cookie": ">=0.4",
"cookie-parser": ">=1",
"couchbase": ">=2.6.12",
"crypto": null,
"cypress": ">=10.2",
"dd-trace-api": null,
"dns": null,
"elasticsearch": ">=10",
"express": ">=4",
"express-mongo-sanitize": ">=1",
"express-session": ">=1.5",
"fastify": ">=1",
"find-my-way": ">=1",
"fs": null,
"generic-pool": ">=2",
"graphql": ">=0.10",
"handlebars": ">=4",
"hapi": ">=16",
"hono": ">=4",
"http": null,
"http2": null,
"https": null,
"ioredis": ">=2",
"iovalkey": ">=0.0.1",
"jest-circus": ">=24.8",
"jest-config": ">=24.8",
"jest-environment-jsdom": ">=24.8",
"jest-environment-node": ">=24.8",
"jest-runtime": ">=24.8",
"jest-worker": ">=24.9",
"kafkajs": ">=1.4",
"knex": ">=0.8",
"koa": ">=2",
"koa-router": ">=7",
"ldapjs": ">=2",
"limitd-client": ">=2.8",
"lodash": ">=4",
"mariadb": ">=2.0.4",
"memcached": ">=2.2",
"microgateway-core": ">=2.1",
"mocha": ">=5.2",
"mocha-each": ">=2.0.1",
"moleculer": ">=0.14",
"mongodb": ">=3.3",
"mongodb-core": ">=2",
"mongoose": ">=4.6.4",
"mquery": ">=5",
"multer": ">=1.4.4-lts.1",
"mysql": ">=2",
"mysql2": ">=1",
"net": null,
"next": ">=10.2",
"node-serialize": ">=0.0.4",
"node:child_process": null,
"node:crypto": null,
"node:dns": null,
"node:fs": null,
"node:http": null,
"node:http2": null,
"node:https": null,
"node:net": null,
"node:url": null,
"nyc": ">=17",
"openai": ">=3",
"oracledb": ">=5",
"passport": ">=0.3",
"passport-http": ">=0.3",
"passport-local": ">=1",
"pg": ">=8.0.3",
"pino": ">=2",
"pino-pretty": ">=1",
"playwright": ">=1.38",
"playwright-core": ">=1.38",
"promise": ">=7",
"promise-js": ">=0.0.3",
"protobufjs": ">=6.8",
"pug": ">=2.0.4",
"q": ">=1",
"redis": ">=0.12",
"restify": ">=3",
"rhea": ">=1",
"router": ">=1",
"selenium-webdriver": ">=4.11",
"sequelize": ">=4",
"sharedb": ">=1",
"tedious": ">=1",
"undici": ">=4.4.1",
"url": null,
"vitest": ">=1.6",
"when": ">=3",
"winston": ">=1",
"workerpool": ">=6"
}
6 changes: 5 additions & 1 deletion scripts/install_plugin_modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const semver = require('semver')
const exec = require('./helpers/exec')
const externals = require('../packages/dd-trace/test/plugins/externals.json')
const { getInstrumentation } = require('../packages/dd-trace/test/setup/helpers/load-inst')
const { getCappedRange } = require('../packages/dd-trace/test/plugins/versions')
const { assertSupported, getCappedRange } = require('../packages/dd-trace/test/plugins/versions')

const requirePackageJsonPath = require.resolve('../packages/dd-trace/src/require-package-json')

Expand Down Expand Up @@ -112,6 +112,10 @@ async function assertFolder (name, version) {
* @param {boolean} external
*/
async function assertPackage (name, version, dependencyVersionRange, external) {
if (!external) {
assertSupported(name, dependencyVersionRange)
}

const dependencies = {
[name]: getCappedRange(name, dependencyVersionRange)
}
Expand Down
Loading