diff --git a/package.json b/package.json index c15bb092f17d8..53d9e1ac15dba 100644 --- a/package.json +++ b/package.json @@ -511,6 +511,7 @@ "@types/deep-freeze-strict": "^1.1.0", "@types/delete-empty": "^2.0.0", "@types/ejs": "^3.0.6", + "@types/elastic__apm-synthtrace": "link:bazel-bin/packages/elastic-apm-synthtrace/npm_module_types", "@types/elastic__datemath": "link:bazel-bin/packages/elastic-datemath/npm_module_types", "@types/elasticsearch": "^5.0.33", "@types/enzyme": "^3.10.8", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index b96fea80f027b..74c28790ae06e 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -74,6 +74,7 @@ filegroup( filegroup( name = "build_pkg_types", srcs = [ + "//packages/elastic-apm-synthtrace:build_types", "//packages/elastic-datemath:build_types", ], ) diff --git a/packages/elastic-apm-synthtrace/BUILD.bazel b/packages/elastic-apm-synthtrace/BUILD.bazel index 8ae1632ffee4c..7fb188de435b6 100644 --- a/packages/elastic-apm-synthtrace/BUILD.bazel +++ b/packages/elastic-apm-synthtrace/BUILD.bazel @@ -1,9 +1,10 @@ -load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") -load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") -load("//src/dev/bazel:index.bzl", "jsts_transpiler") +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") PKG_BASE_NAME = "elastic-apm-synthtrace" PKG_REQUIRE_NAME = "@elastic/apm-synthtrace" +TYPES_PKG_REQUIRE_NAME = "@types/elastic__apm-synthtrace" SOURCE_FILES = glob( [ @@ -31,21 +32,18 @@ RUNTIME_DEPS = [ "@npm//moment", "@npm//object-hash", "@npm//p-limit", - "@npm//utility-types", - "@npm//uuid", "@npm//yargs", ] TYPES_DEPS = [ "//packages/elastic-datemath:npm_module_types", "@npm//@elastic/elasticsearch", - "@npm//moment", - "@npm//p-limit", "@npm//@types/jest", "@npm//@types/lodash", "@npm//@types/node", - "@npm//@types/uuid", "@npm//@types/object-hash", + "@npm//moment", + "@npm//p-limit", ] jsts_transpiler( @@ -75,12 +73,13 @@ ts_project( root_dir = "src", source_map = True, tsconfig = ":tsconfig", + validate = False, ) js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], + deps = RUNTIME_DEPS + [":target_node"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) @@ -99,3 +98,20 @@ filegroup( ], visibility = ["//visibility:public"], ) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = TYPES_PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [ + ":npm_module_types", + ], + visibility = ["//visibility:public"], +) diff --git a/packages/elastic-apm-synthtrace/package.json b/packages/elastic-apm-synthtrace/package.json index 43699e4795586..d2f2016a891b3 100644 --- a/packages/elastic-apm-synthtrace/package.json +++ b/packages/elastic-apm-synthtrace/package.json @@ -4,6 +4,5 @@ "description": "Elastic APM trace data generator", "license": "SSPL-1.0 OR Elastic License 2.0", "main": "./target_node/index.js", - "types": "./target_types/index.d.ts", "private": true } diff --git a/packages/elastic-apm-synthtrace/src/index.ts b/packages/elastic-apm-synthtrace/src/index.ts index 70105438ff5ae..931215c75fde4 100644 --- a/packages/elastic-apm-synthtrace/src/index.ts +++ b/packages/elastic-apm-synthtrace/src/index.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +export type { Exception } from './lib/entity'; export { service } from './lib/service'; export { browser } from './lib/browser'; export { timerange } from './lib/timerange'; diff --git a/yarn.lock b/yarn.lock index c6279d6577e14..2f3d3865b54ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5386,6 +5386,10 @@ resolved "https://registry.yarnpkg.com/@types/ejs/-/ejs-3.0.6.tgz#aca442289df623bfa8e47c23961f0357847b83fe" integrity sha512-fj1hi+ZSW0xPLrJJD+YNwIh9GZbyaIepG26E/gXvp8nCa2pYokxUYO1sK9qjGxp2g8ryZYuon7wmjpwE2cyASQ== +"@types/elastic__apm-synthtrace@link:bazel-bin/packages/elastic-apm-synthtrace/npm_module_types": + version "0.0.0" + uid "" + "@types/elastic__datemath@link:bazel-bin/packages/elastic-datemath/npm_module_types": version "0.0.0" uid ""