@launchdarkly/observability-next 0.2.13 → 0.3.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/CHANGELOG.md +24 -0
- package/dist/config.cjs +1 -1
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/next-client.cjs +1 -1
- package/dist/next-client.cjs.map +1 -1
- package/dist/next-client.d.ts +2 -1
- package/dist/next-client.d.ts.map +1 -1
- package/dist/next-client.js +1 -1
- package/dist/next-client.js.map +1 -1
- package/dist/proxy-BxWoc7Yz.js +2 -0
- package/dist/proxy-BxWoc7Yz.js.map +1 -0
- package/dist/proxy-oEFAL7Y5.js +2 -0
- package/dist/proxy-oEFAL7Y5.js.map +1 -0
- package/dist/server.cjs +1 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/ssr.cjs +1 -1
- package/dist/ssr.js +1 -1
- package/dist/{standalone-CkwD29IP.js → standalone-C9hZecMf.js} +2 -2
- package/dist/{standalone-CkwD29IP.js.map → standalone-C9hZecMf.js.map} +1 -1
- package/dist/{standalone-CQH9Vh11.js → standalone-D7TcqTSf.js} +2 -2
- package/dist/{standalone-CQH9Vh11.js.map → standalone-D7TcqTSf.js.map} +1 -1
- package/dist/util/proxy.d.ts +13 -0
- package/dist/util/proxy.d.ts.map +1 -1
- package/dist/util/register-observability.d.ts.map +1 -1
- package/dist/util/version.d.ts +1 -1
- package/dist/util/with-launchdarkly-config.d.ts +2 -0
- package/dist/util/with-launchdarkly-config.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/proxy-B6yiPOEG.js +0 -2
- package/dist/proxy-B6yiPOEG.js.map +0 -1
- package/dist/proxy-DccSYatN.js +0 -2
- package/dist/proxy-DccSYatN.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.1](https://github.com/launchdarkly/observability-sdk/compare/observability-next-0.3.0...observability-next-0.3.1) (2026-10-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Dependencies
|
|
7
|
+
|
|
8
|
+
* The following workspace dependencies were updated
|
|
9
|
+
* dependencies
|
|
10
|
+
* @launchdarkly/observability bumped to 1.2.1
|
|
11
|
+
* @launchdarkly/session-replay bumped to 1.2.1
|
|
12
|
+
|
|
13
|
+
## [0.3.0](https://github.com/launchdarkly/observability-sdk/compare/observability-next-0.2.13...observability-next-0.3.0) (2026-10-10)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **next:** full-featured Next 16 e2e example + bundler-safe observability singleton + staging-configurable endpoints ([#822](https://github.com/launchdarkly/observability-sdk/issues/822)) ([51a1010](https://github.com/launchdarkly/observability-sdk/commit/51a1010cd1314b8a7c48238f788372df14199610))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Dependencies
|
|
22
|
+
|
|
23
|
+
* The following workspace dependencies were updated
|
|
24
|
+
* dependencies
|
|
25
|
+
* @launchdarkly/observability-node bumped to 1.4.0
|
|
26
|
+
|
|
3
27
|
## [0.2.13](https://github.com/launchdarkly/observability-sdk/compare/observability-next-0.2.12...observability-next-0.2.13) (2026-10-09)
|
|
4
28
|
|
|
5
29
|
|
package/dist/config.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("./proxy-
|
|
1
|
+
"use strict";var e=require("./proxy-BxWoc7Yz.js");const r=["@launchdarkly/observability-node","@launchdarkly/node-server-sdk-otel","@prisma/instrumentation","require-in-the-middle","import-in-the-middle"],n=(n,t)=>{const o=(e=>({configureLaunchDarklyProxy:e?.configureLaunchDarklyProxy??!0,backendUrl:e?.backendUrl,otelEndpoint:e?.otelEndpoint}))(t);let a=n.rewrites;if(o.configureLaunchDarklyProxy){const{backendUrl:r,otlpEndpoint:t}=e.resolveLDEndpoints({backendUrl:o.backendUrl,otelEndpoint:o.otelEndpoint}),i=[{source:e.PROXY_BACKEND_PATH,destination:r},{source:"/v1/traces",destination:`${t}/v1/traces`},{source:"/v1/metrics",destination:`${t}/v1/metrics`},{source:"/v1/logs",destination:`${t}/v1/logs`}];a=async()=>{let e;return e=n.rewrites?await n.rewrites():new Array,!e||Array.isArray(e)?(e=e??[],e.concat(...i)):{beforeFiles:e.beforeFiles??[],afterFiles:(e.afterFiles??[]).concat(...i),fallback:e.fallback??[]}}}const i=Array.from(new Set([...n.serverExternalPackages??[],...r]));return{...n,env:{...n.env,[e.PROXY_ENV_FLAG]:o.configureLaunchDarklyProxy?"true":""},rewrites:a,serverExternalPackages:i}};exports.LD_OTLP_ENDPOINT=e.LD_OTLP_ENDPOINT,exports.LD_PUBLIC_BACKEND_URL=e.LD_PUBLIC_BACKEND_URL,exports.LD_STAGING_BACKEND_URL=e.LD_STAGING_BACKEND_URL,exports.LD_STAGING_OTLP_ENDPOINT=e.LD_STAGING_OTLP_ENDPOINT,exports.resolveLDEndpoints=e.resolveLDEndpoints,exports.withLaunchDarklyConfig=function(e,r){if("function"==typeof e){return async(t,{defaultConfig:o})=>{const a=e(t,{defaultConfig:o}),i=await a;return n(i,r)}}return n(e,r)};
|
|
2
2
|
//# sourceMappingURL=config.cjs.map
|
package/dist/config.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.cjs","sources":["../src/util/with-launchdarkly-config.ts"],"sourcesContent":["import { NextConfig } from 'next'\nimport { Rewrite } from 'next/dist/lib/load-custom-routes'\n\nimport {
|
|
1
|
+
{"version":3,"file":"config.cjs","sources":["../src/util/with-launchdarkly-config.ts"],"sourcesContent":["import { NextConfig } from 'next'\nimport { Rewrite } from 'next/dist/lib/load-custom-routes'\n\nimport { PROXY_BACKEND_PATH, PROXY_ENV_FLAG, resolveLDEndpoints } from './proxy'\n\n/**\n * Packages that the LaunchDarkly observability node SDK relies on and that must\n * be loaded natively at runtime rather than webpack-bundled. Bundling them\n * breaks `require-in-the-middle`-based instrumentation (and therefore\n * server-side tracing initialized via {@link registerObservability}).\n */\nconst LD_SERVER_EXTERNAL_PACKAGES = [\n\t'@launchdarkly/observability-node',\n\t'@launchdarkly/node-server-sdk-otel',\n\t'@prisma/instrumentation',\n\t'require-in-the-middle',\n\t'import-in-the-middle',\n]\n\nexport interface LaunchDarklyConfigOptions {\n\t/**\n\t * Configures same-origin rewrites that proxy browser telemetry through your\n\t * own domain to LaunchDarkly. This avoids ad-blockers and keeps requests on\n\t * your origin. When enabled, {@link LDObservabilityInit} automatically routes\n\t * its requests through the proxy.\n\t * @default true\n\t */\n\tconfigureLaunchDarklyProxy?: boolean\n\t/**\n\t * LaunchDarkly events ingest URL that the `/highlight-events` rewrite\n\t * forwards browser telemetry to. Defaults to the production host; override\n\t * to point the proxy at LaunchDarkly staging or a local backend (or set the\n\t * `LAUNCHDARKLY_BACKEND_URL` env var, or `LAUNCHDARKLY_ENV=staging`).\n\t */\n\tbackendUrl?: string\n\t/**\n\t * LaunchDarkly OTLP endpoint that the `/v1/traces`, `/v1/metrics` and\n\t * `/v1/logs` rewrites forward browser OTLP data to. Defaults to the\n\t * production host; override to point the proxy at LaunchDarkly staging or a\n\t * local backend (or set the `LAUNCHDARKLY_OTEL_ENDPOINT` env var, or\n\t * `LAUNCHDARKLY_ENV=staging`).\n\t */\n\totelEndpoint?: string\n}\n\nconst getDefaultOpts = (\n\topts?: LaunchDarklyConfigOptions,\n): Required<Pick<LaunchDarklyConfigOptions, 'configureLaunchDarklyProxy'>> &\n\tPick<LaunchDarklyConfigOptions, 'backendUrl' | 'otelEndpoint'> => ({\n\tconfigureLaunchDarklyProxy: opts?.configureLaunchDarklyProxy ?? true,\n\tbackendUrl: opts?.backendUrl,\n\totelEndpoint: opts?.otelEndpoint,\n})\n\ntype NextConfigObject = NextConfig\ntype NextConfigFunction = (\n\tphase: string,\n\t{ defaultConfig }: { defaultConfig: any },\n) => NextConfig\ntype NextConfigAsyncFunction = (\n\tphase: string,\n\t{ defaultConfig }: { defaultConfig: any },\n) => Promise<NextConfig>\ntype NextConfigInput =\n\t| NextConfigObject\n\t| NextConfigFunction\n\t| NextConfigAsyncFunction\n\nconst getLaunchDarklyConfig = (\n\tconfig: NextConfig,\n\topts?: LaunchDarklyConfigOptions,\n): NextConfig => {\n\tconst defaultOpts = getDefaultOpts(opts)\n\n\tlet newRewrites = config.rewrites\n\tif (defaultOpts.configureLaunchDarklyProxy) {\n\t\tconst { backendUrl, otlpEndpoint } = resolveLDEndpoints({\n\t\t\tbackendUrl: defaultOpts.backendUrl,\n\t\t\totelEndpoint: defaultOpts.otelEndpoint,\n\t\t})\n\t\tconst proxyRewrites: Rewrite[] = [\n\t\t\t{\n\t\t\t\tsource: PROXY_BACKEND_PATH,\n\t\t\t\tdestination: backendUrl,\n\t\t\t},\n\t\t\t{\n\t\t\t\tsource: '/v1/traces',\n\t\t\t\tdestination: `${otlpEndpoint}/v1/traces`,\n\t\t\t},\n\t\t\t{\n\t\t\t\tsource: '/v1/metrics',\n\t\t\t\tdestination: `${otlpEndpoint}/v1/metrics`,\n\t\t\t},\n\t\t\t{\n\t\t\t\tsource: '/v1/logs',\n\t\t\t\tdestination: `${otlpEndpoint}/v1/logs`,\n\t\t\t},\n\t\t]\n\n\t\tnewRewrites = async () => {\n\t\t\tlet re:\n\t\t\t\t| Rewrite[]\n\t\t\t\t| {\n\t\t\t\t\t\tbeforeFiles?: Rewrite[]\n\t\t\t\t\t\tafterFiles?: Rewrite[]\n\t\t\t\t\t\tfallback?: Rewrite[]\n\t\t\t\t }\n\t\t\tif (!config.rewrites) {\n\t\t\t\tre = new Array<Rewrite>()\n\t\t\t} else {\n\t\t\t\tre = await config.rewrites()\n\t\t\t}\n\n\t\t\tif (!re || Array.isArray(re)) {\n\t\t\t\tre = re ?? []\n\t\t\t\treturn re.concat(...proxyRewrites)\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tbeforeFiles: re.beforeFiles ?? [],\n\t\t\t\tafterFiles: (re.afterFiles ?? []).concat(...proxyRewrites),\n\t\t\t\tfallback: re.fallback ?? [],\n\t\t\t}\n\t\t}\n\t}\n\n\tconst serverExternalPackages = Array.from(\n\t\tnew Set([\n\t\t\t...(config.serverExternalPackages ?? []),\n\t\t\t...LD_SERVER_EXTERNAL_PACKAGES,\n\t\t]),\n\t)\n\n\treturn {\n\t\t...config,\n\t\tenv: {\n\t\t\t...config.env,\n\t\t\t[PROXY_ENV_FLAG]: defaultOpts.configureLaunchDarklyProxy\n\t\t\t\t? 'true'\n\t\t\t\t: '',\n\t\t},\n\t\trewrites: newRewrites,\n\t\tserverExternalPackages,\n\t}\n}\n\nexport function withLaunchDarklyConfig(\n\tconfig: NextConfigObject,\n\topts?: LaunchDarklyConfigOptions,\n): NextConfig\nexport function withLaunchDarklyConfig(\n\tconfig: NextConfigFunction | NextConfigAsyncFunction,\n\topts?: LaunchDarklyConfigOptions,\n): NextConfigAsyncFunction\nexport function withLaunchDarklyConfig(\n\tconfig: NextConfigInput,\n\topts?: LaunchDarklyConfigOptions,\n): NextConfig | NextConfigAsyncFunction {\n\tif (typeof config === 'function') {\n\t\tconst phaseHandler: NextConfigAsyncFunction = async (\n\t\t\tphase: string,\n\t\t\t{ defaultConfig }: { defaultConfig: any },\n\t\t): Promise<NextConfig> => {\n\t\t\tconst userNextConfigObject: NextConfig | Promise<NextConfig> =\n\t\t\t\tconfig(phase, { defaultConfig })\n\t\t\tconst nc = await userNextConfigObject\n\t\t\treturn getLaunchDarklyConfig(nc, opts)\n\t\t}\n\t\treturn phaseHandler\n\t}\n\treturn getLaunchDarklyConfig(config, opts)\n}\n"],"names":["LD_SERVER_EXTERNAL_PACKAGES","getLaunchDarklyConfig","config","opts","defaultOpts","configureLaunchDarklyProxy","backendUrl","otelEndpoint","getDefaultOpts","newRewrites","rewrites","otlpEndpoint","resolveLDEndpoints","proxyRewrites","source","PROXY_BACKEND_PATH","destination","async","re","Array","isArray","concat","beforeFiles","afterFiles","fallback","serverExternalPackages","from","Set","env","PROXY_ENV_FLAG","phase","defaultConfig","userNextConfigObject","nc"],"mappings":"kDAWA,MAAMA,EAA8B,CACnC,mCACA,qCACA,0BACA,wBACA,wBAoDKC,EAAwB,CAC7BC,EACAC,KAEA,MAAMC,EA3BgB,CACtBD,IAAgC,CAGhCE,2BAA4BF,GAAME,6BAA8B,EAChEC,WAAYH,GAAMG,WAClBC,aAAcJ,GAAMI,eAqBAC,CAAeL,GAEnC,IAAIM,EAAcP,EAAOQ,SACzB,GAAIN,EAAYC,2BAA4B,CAC3C,MAAMC,WAAEA,EAAUK,aAAEA,GAAiBC,qBAAmB,CACvDN,WAAYF,EAAYE,WACxBC,aAAcH,EAAYG,eAErBM,EAA2B,CAChC,CACCC,OAAQC,EAAAA,mBACRC,YAAaV,GAEd,CACCQ,OAAQ,aACRE,YAAa,GAAGL,eAEjB,CACCG,OAAQ,cACRE,YAAa,GAAGL,gBAEjB,CACCG,OAAQ,WACRE,YAAa,GAAGL,cAIlBF,EAAcQ,UACb,IAAIC,EAaJ,OAHCA,EAHIhB,EAAOQ,eAGAR,EAAOQ,WAFb,IAAIS,OAKLD,GAAMC,MAAMC,QAAQF,IACxBA,EAAKA,GAAM,GACJA,EAAGG,UAAUR,IAEd,CACNS,YAAaJ,EAAGI,aAAe,GAC/BC,YAAaL,EAAGK,YAAc,IAAIF,UAAUR,GAC5CW,SAAUN,EAAGM,UAAY,IAG5B,CAEA,MAAMC,EAAyBN,MAAMO,KACpC,IAAIC,IAAI,IACHzB,EAAOuB,wBAA0B,MAClCzB,KAIL,MAAO,IACHE,EACH0B,IAAK,IACD1B,EAAO0B,IACV,CAACC,EAAAA,gBAAiBzB,EAAYC,2BAC3B,OACA,IAEJK,SAAUD,EACVgB,gUAYI,SACLvB,EACAC,GAEA,GAAsB,mBAAXD,EAAuB,CAUjC,OAT8Ce,MAC7Ca,GACEC,oBAEF,MAAMC,EACL9B,EAAO4B,EAAO,CAAEC,kBACXE,QAAWD,EACjB,OAAO/B,EAAsBgC,EAAI9B,GAGnC,CACA,OAAOF,EAAsBC,EAAQC,EACtC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { withLaunchDarklyConfig, type LaunchDarklyConfigOptions, } from './util/with-launchdarkly-config';
|
|
2
|
+
export { resolveLDEndpoints, type LDEndpoints, LD_PUBLIC_BACKEND_URL, LD_OTLP_ENDPOINT, LD_STAGING_BACKEND_URL, LD_STAGING_OTLP_ENDPOINT, } from './util/proxy';
|
|
2
3
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,EACtB,KAAK,yBAAyB,GAC9B,MAAM,iCAAiC,CAAA"}
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,EACtB,KAAK,yBAAyB,GAC9B,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACN,kBAAkB,EAClB,KAAK,WAAW,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,GACxB,MAAM,cAAc,CAAA"}
|
package/dist/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{r as e,a as r,P as n}from"./proxy-oEFAL7Y5.js";export{L as LD_OTLP_ENDPOINT,b as LD_PUBLIC_BACKEND_URL,c as LD_STAGING_BACKEND_URL,d as LD_STAGING_OTLP_ENDPOINT}from"./proxy-oEFAL7Y5.js";const t=["@launchdarkly/observability-node","@launchdarkly/node-server-sdk-otel","@prisma/instrumentation","require-in-the-middle","import-in-the-middle"],a=(a,o)=>{const i=(e=>({configureLaunchDarklyProxy:e?.configureLaunchDarklyProxy??!0,backendUrl:e?.backendUrl,otelEndpoint:e?.otelEndpoint}))(o);let s=a.rewrites;if(i.configureLaunchDarklyProxy){const{backendUrl:r,otlpEndpoint:t}=e({backendUrl:i.backendUrl,otelEndpoint:i.otelEndpoint}),o=[{source:n,destination:r},{source:"/v1/traces",destination:`${t}/v1/traces`},{source:"/v1/metrics",destination:`${t}/v1/metrics`},{source:"/v1/logs",destination:`${t}/v1/logs`}];s=async()=>{let e;return e=a.rewrites?await a.rewrites():new Array,!e||Array.isArray(e)?(e=e??[],e.concat(...o)):{beforeFiles:e.beforeFiles??[],afterFiles:(e.afterFiles??[]).concat(...o),fallback:e.fallback??[]}}}const c=Array.from(new Set([...a.serverExternalPackages??[],...t]));return{...a,env:{...a.env,[r]:i.configureLaunchDarklyProxy?"true":""},rewrites:s,serverExternalPackages:c}};function o(e,r){if("function"==typeof e){return async(n,{defaultConfig:t})=>{const o=e(n,{defaultConfig:t}),i=await o;return a(i,r)}}return a(e,r)}export{e as resolveLDEndpoints,o as withLaunchDarklyConfig};
|
|
2
2
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../src/util/with-launchdarkly-config.ts"],"sourcesContent":["import { NextConfig } from 'next'\nimport { Rewrite } from 'next/dist/lib/load-custom-routes'\n\nimport {
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../src/util/with-launchdarkly-config.ts"],"sourcesContent":["import { NextConfig } from 'next'\nimport { Rewrite } from 'next/dist/lib/load-custom-routes'\n\nimport { PROXY_BACKEND_PATH, PROXY_ENV_FLAG, resolveLDEndpoints } from './proxy'\n\n/**\n * Packages that the LaunchDarkly observability node SDK relies on and that must\n * be loaded natively at runtime rather than webpack-bundled. Bundling them\n * breaks `require-in-the-middle`-based instrumentation (and therefore\n * server-side tracing initialized via {@link registerObservability}).\n */\nconst LD_SERVER_EXTERNAL_PACKAGES = [\n\t'@launchdarkly/observability-node',\n\t'@launchdarkly/node-server-sdk-otel',\n\t'@prisma/instrumentation',\n\t'require-in-the-middle',\n\t'import-in-the-middle',\n]\n\nexport interface LaunchDarklyConfigOptions {\n\t/**\n\t * Configures same-origin rewrites that proxy browser telemetry through your\n\t * own domain to LaunchDarkly. This avoids ad-blockers and keeps requests on\n\t * your origin. When enabled, {@link LDObservabilityInit} automatically routes\n\t * its requests through the proxy.\n\t * @default true\n\t */\n\tconfigureLaunchDarklyProxy?: boolean\n\t/**\n\t * LaunchDarkly events ingest URL that the `/highlight-events` rewrite\n\t * forwards browser telemetry to. Defaults to the production host; override\n\t * to point the proxy at LaunchDarkly staging or a local backend (or set the\n\t * `LAUNCHDARKLY_BACKEND_URL` env var, or `LAUNCHDARKLY_ENV=staging`).\n\t */\n\tbackendUrl?: string\n\t/**\n\t * LaunchDarkly OTLP endpoint that the `/v1/traces`, `/v1/metrics` and\n\t * `/v1/logs` rewrites forward browser OTLP data to. Defaults to the\n\t * production host; override to point the proxy at LaunchDarkly staging or a\n\t * local backend (or set the `LAUNCHDARKLY_OTEL_ENDPOINT` env var, or\n\t * `LAUNCHDARKLY_ENV=staging`).\n\t */\n\totelEndpoint?: string\n}\n\nconst getDefaultOpts = (\n\topts?: LaunchDarklyConfigOptions,\n): Required<Pick<LaunchDarklyConfigOptions, 'configureLaunchDarklyProxy'>> &\n\tPick<LaunchDarklyConfigOptions, 'backendUrl' | 'otelEndpoint'> => ({\n\tconfigureLaunchDarklyProxy: opts?.configureLaunchDarklyProxy ?? true,\n\tbackendUrl: opts?.backendUrl,\n\totelEndpoint: opts?.otelEndpoint,\n})\n\ntype NextConfigObject = NextConfig\ntype NextConfigFunction = (\n\tphase: string,\n\t{ defaultConfig }: { defaultConfig: any },\n) => NextConfig\ntype NextConfigAsyncFunction = (\n\tphase: string,\n\t{ defaultConfig }: { defaultConfig: any },\n) => Promise<NextConfig>\ntype NextConfigInput =\n\t| NextConfigObject\n\t| NextConfigFunction\n\t| NextConfigAsyncFunction\n\nconst getLaunchDarklyConfig = (\n\tconfig: NextConfig,\n\topts?: LaunchDarklyConfigOptions,\n): NextConfig => {\n\tconst defaultOpts = getDefaultOpts(opts)\n\n\tlet newRewrites = config.rewrites\n\tif (defaultOpts.configureLaunchDarklyProxy) {\n\t\tconst { backendUrl, otlpEndpoint } = resolveLDEndpoints({\n\t\t\tbackendUrl: defaultOpts.backendUrl,\n\t\t\totelEndpoint: defaultOpts.otelEndpoint,\n\t\t})\n\t\tconst proxyRewrites: Rewrite[] = [\n\t\t\t{\n\t\t\t\tsource: PROXY_BACKEND_PATH,\n\t\t\t\tdestination: backendUrl,\n\t\t\t},\n\t\t\t{\n\t\t\t\tsource: '/v1/traces',\n\t\t\t\tdestination: `${otlpEndpoint}/v1/traces`,\n\t\t\t},\n\t\t\t{\n\t\t\t\tsource: '/v1/metrics',\n\t\t\t\tdestination: `${otlpEndpoint}/v1/metrics`,\n\t\t\t},\n\t\t\t{\n\t\t\t\tsource: '/v1/logs',\n\t\t\t\tdestination: `${otlpEndpoint}/v1/logs`,\n\t\t\t},\n\t\t]\n\n\t\tnewRewrites = async () => {\n\t\t\tlet re:\n\t\t\t\t| Rewrite[]\n\t\t\t\t| {\n\t\t\t\t\t\tbeforeFiles?: Rewrite[]\n\t\t\t\t\t\tafterFiles?: Rewrite[]\n\t\t\t\t\t\tfallback?: Rewrite[]\n\t\t\t\t }\n\t\t\tif (!config.rewrites) {\n\t\t\t\tre = new Array<Rewrite>()\n\t\t\t} else {\n\t\t\t\tre = await config.rewrites()\n\t\t\t}\n\n\t\t\tif (!re || Array.isArray(re)) {\n\t\t\t\tre = re ?? []\n\t\t\t\treturn re.concat(...proxyRewrites)\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tbeforeFiles: re.beforeFiles ?? [],\n\t\t\t\tafterFiles: (re.afterFiles ?? []).concat(...proxyRewrites),\n\t\t\t\tfallback: re.fallback ?? [],\n\t\t\t}\n\t\t}\n\t}\n\n\tconst serverExternalPackages = Array.from(\n\t\tnew Set([\n\t\t\t...(config.serverExternalPackages ?? []),\n\t\t\t...LD_SERVER_EXTERNAL_PACKAGES,\n\t\t]),\n\t)\n\n\treturn {\n\t\t...config,\n\t\tenv: {\n\t\t\t...config.env,\n\t\t\t[PROXY_ENV_FLAG]: defaultOpts.configureLaunchDarklyProxy\n\t\t\t\t? 'true'\n\t\t\t\t: '',\n\t\t},\n\t\trewrites: newRewrites,\n\t\tserverExternalPackages,\n\t}\n}\n\nexport function withLaunchDarklyConfig(\n\tconfig: NextConfigObject,\n\topts?: LaunchDarklyConfigOptions,\n): NextConfig\nexport function withLaunchDarklyConfig(\n\tconfig: NextConfigFunction | NextConfigAsyncFunction,\n\topts?: LaunchDarklyConfigOptions,\n): NextConfigAsyncFunction\nexport function withLaunchDarklyConfig(\n\tconfig: NextConfigInput,\n\topts?: LaunchDarklyConfigOptions,\n): NextConfig | NextConfigAsyncFunction {\n\tif (typeof config === 'function') {\n\t\tconst phaseHandler: NextConfigAsyncFunction = async (\n\t\t\tphase: string,\n\t\t\t{ defaultConfig }: { defaultConfig: any },\n\t\t): Promise<NextConfig> => {\n\t\t\tconst userNextConfigObject: NextConfig | Promise<NextConfig> =\n\t\t\t\tconfig(phase, { defaultConfig })\n\t\t\tconst nc = await userNextConfigObject\n\t\t\treturn getLaunchDarklyConfig(nc, opts)\n\t\t}\n\t\treturn phaseHandler\n\t}\n\treturn getLaunchDarklyConfig(config, opts)\n}\n"],"names":["LD_SERVER_EXTERNAL_PACKAGES","getLaunchDarklyConfig","config","opts","defaultOpts","configureLaunchDarklyProxy","backendUrl","otelEndpoint","getDefaultOpts","newRewrites","rewrites","otlpEndpoint","resolveLDEndpoints","proxyRewrites","source","PROXY_BACKEND_PATH","destination","async","re","Array","isArray","concat","beforeFiles","afterFiles","fallback","serverExternalPackages","from","Set","env","PROXY_ENV_FLAG","withLaunchDarklyConfig","phase","defaultConfig","userNextConfigObject","nc"],"mappings":"kMAWA,MAAMA,EAA8B,CACnC,mCACA,qCACA,0BACA,wBACA,wBAoDKC,EAAwB,CAC7BC,EACAC,KAEA,MAAMC,EA3BgB,CACtBD,IAAgC,CAGhCE,2BAA4BF,GAAME,6BAA8B,EAChEC,WAAYH,GAAMG,WAClBC,aAAcJ,GAAMI,eAqBAC,CAAeL,GAEnC,IAAIM,EAAcP,EAAOQ,SACzB,GAAIN,EAAYC,2BAA4B,CAC3C,MAAMC,WAAEA,EAAUK,aAAEA,GAAiBC,EAAmB,CACvDN,WAAYF,EAAYE,WACxBC,aAAcH,EAAYG,eAErBM,EAA2B,CAChC,CACCC,OAAQC,EACRC,YAAaV,GAEd,CACCQ,OAAQ,aACRE,YAAa,GAAGL,eAEjB,CACCG,OAAQ,cACRE,YAAa,GAAGL,gBAEjB,CACCG,OAAQ,WACRE,YAAa,GAAGL,cAIlBF,EAAcQ,UACb,IAAIC,EAaJ,OAHCA,EAHIhB,EAAOQ,eAGAR,EAAOQ,WAFb,IAAIS,OAKLD,GAAMC,MAAMC,QAAQF,IACxBA,EAAKA,GAAM,GACJA,EAAGG,UAAUR,IAEd,CACNS,YAAaJ,EAAGI,aAAe,GAC/BC,YAAaL,EAAGK,YAAc,IAAIF,UAAUR,GAC5CW,SAAUN,EAAGM,UAAY,IAG5B,CAEA,MAAMC,EAAyBN,MAAMO,KACpC,IAAIC,IAAI,IACHzB,EAAOuB,wBAA0B,MAClCzB,KAIL,MAAO,IACHE,EACH0B,IAAK,IACD1B,EAAO0B,IACVC,CAACA,GAAiBzB,EAAYC,2BAC3B,OACA,IAEJK,SAAUD,EACVgB,2BAYI,SAAUK,EACf5B,EACAC,GAEA,GAAsB,mBAAXD,EAAuB,CAUjC,OAT8Ce,MAC7Cc,GACEC,oBAEF,MAAMC,EACL/B,EAAO6B,EAAO,CAAEC,kBACXE,QAAWD,EACjB,OAAOhC,EAAsBiC,EAAI/B,GAGnC,CACA,OAAOF,EAAsBC,EAAQC,EACtC"}
|
package/dist/next-client.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e=require("@launchdarkly/observability"),r=require("@launchdarkly/session-replay"),n=require("js-cookie"),t=require("react"),o=require("./proxy-
|
|
2
|
+
"use strict";var e=require("@launchdarkly/observability"),r=require("@launchdarkly/session-replay"),n=require("js-cookie"),t=require("react"),o=require("./proxy-BxWoc7Yz.js"),s=require("./standalone-D7TcqTSf.js"),i=require("./error-boundary-CUcyBTHj.js");require("react/jsx-runtime"),Object.defineProperty(exports,"LDObserve",{enumerable:!0,get:function(){return e.LDObserve}}),Object.defineProperty(exports,"LDRecord",{enumerable:!0,get:function(){return r.LDRecord}}),exports.ErrorBoundary=i.ErrorBoundary,exports.LDObservabilityInit=function({sdkKey:i,application:u,excludedHostnames:a=[],useProxy:c,...l}){return t.useEffect(()=>{if(!(!!i&&a.every(e=>!window.location.hostname.includes(e))))return;let t={...l};(c??"true"===process.env[o.PROXY_ENV_FLAG])&&(t={...t,backendUrl:o.PROXY_BACKEND_PATH,otel:{...t.otel,otlpEndpoint:window.location.origin}}),s.ensureStandaloneInit("observe",()=>new e(t),i,u),s.ensureStandaloneInit("record",()=>new r(t),i,u);const d=()=>{const e=r.LDRecord.getSession()?.sessionSecureID;return!!e&&(n.set("sessionSecureID",e),!0)};if(d())return;let y=0;const b=setInterval(()=>{(d()||++y>=50)&&clearInterval(b)},100);return()=>clearInterval(b)},[]),null};
|
|
3
3
|
//# sourceMappingURL=next-client.cjs.map
|
package/dist/next-client.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-client.cjs","sources":["../src/next-client.tsx"],"sourcesContent":["import Observability, {\n\tLDObserve,\n\ttype ObserveOptions,\n} from '@launchdarkly/observability'\nimport SessionReplay, {\n\tLDRecord,\n\ttype RecordOptions,\n} from '@launchdarkly/session-replay'\nimport Cookies from 'js-cookie'\nimport { useEffect } from 'react'\n\nimport { PROXY_BACKEND_PATH, PROXY_ENV_FLAG } from './util/proxy'\nimport { ensureStandaloneInit, type LDApplicationInfo } from './util/standalone'\n\nexport { ErrorBoundary } from './error-boundary'\nexport type { ErrorBoundaryProps, ErrorBoundaryState } from './error-boundary'\nexport { LDObserve, LDRecord }\n\n/**\n * Options for {@link LDObservabilityInit}. Combines the browser observability and\n * session replay options, plus the LaunchDarkly SDK key used to initialize them\n * in standalone mode.\n */\nexport type LDObservabilityInitProps = ObserveOptions &\n\tRecordOptions & {\n\t\t/**\n\t\t * The LaunchDarkly client-side ID (SDK key) for the environment to send\n\t\t * telemetry to. Required for the SDK to initialize.\n\t\t */\n\t\tsdkKey?: string\n\t\t/**\n\t\t * Application metadata (id / version) tagged onto telemetry, mirroring\n\t\t * the `application` field of a LaunchDarkly client configuration.\n\t\t */\n\t\tapplication?: LDApplicationInfo\n\t\t/**\n\t\t * Hostnames on which the SDK should not initialize (e.g. local\n\t\t * development domains). If the current hostname includes any of these\n\t\t * substrings the SDK is skipped.\n\t\t */\n\t\texcludedHostnames?: string[]\n\t}\n\n/**\n * Drop-in client component that boots LaunchDarkly observability and session\n * replay for a Next.js app. Render it once near the root of your app (e.g. in\n * `app/layout.tsx` or `pages/_app.tsx`).\n *\n * It runs the plugins in standalone mode — there is no LaunchDarkly feature-flag\n * SDK for Next.js, so the plugins are initialized directly from the LaunchDarkly\n * SDK key rather than registered with an LD client.\n */\nexport function LDObservabilityInit({\n\tsdkKey,\n\tapplication,\n\texcludedHostnames = [],\n\t...options\n}: LDObservabilityInitProps) {\n\tuseEffect(() => {\n\t\tconst shouldRender =\n\t\t\t!!sdkKey &&\n\t\t\texcludedHostnames.every(\n\t\t\t\t(hostname) => !window.location.hostname.includes(hostname),\n\t\t\t)\n\n\t\tif (!shouldRender) {\n\t\t\treturn\n\t\t}\n\n\t\tlet initOptions: LDObservabilityInitProps = { ...options }\n\n\t\tconst configureProxy
|
|
1
|
+
{"version":3,"file":"next-client.cjs","sources":["../src/next-client.tsx"],"sourcesContent":["import Observability, {\n\tLDObserve,\n\ttype ObserveOptions,\n} from '@launchdarkly/observability'\nimport SessionReplay, {\n\tLDRecord,\n\ttype RecordOptions,\n} from '@launchdarkly/session-replay'\nimport Cookies from 'js-cookie'\nimport { useEffect } from 'react'\n\nimport { PROXY_BACKEND_PATH, PROXY_ENV_FLAG } from './util/proxy'\nimport { ensureStandaloneInit, type LDApplicationInfo } from './util/standalone'\n\nexport { ErrorBoundary } from './error-boundary'\nexport type { ErrorBoundaryProps, ErrorBoundaryState } from './error-boundary'\nexport { LDObserve, LDRecord }\n\n/**\n * Options for {@link LDObservabilityInit}. Combines the browser observability and\n * session replay options, plus the LaunchDarkly SDK key used to initialize them\n * in standalone mode.\n */\nexport type LDObservabilityInitProps = ObserveOptions &\n\tRecordOptions & {\n\t\t/**\n\t\t * The LaunchDarkly client-side ID (SDK key) for the environment to send\n\t\t * telemetry to. Required for the SDK to initialize.\n\t\t */\n\t\tsdkKey?: string\n\t\t/**\n\t\t * Application metadata (id / version) tagged onto telemetry, mirroring\n\t\t * the `application` field of a LaunchDarkly client configuration.\n\t\t */\n\t\tapplication?: LDApplicationInfo\n\t\t/**\n\t\t * Hostnames on which the SDK should not initialize (e.g. local\n\t\t * development domains). If the current hostname includes any of these\n\t\t * substrings the SDK is skipped.\n\t\t */\n\t\texcludedHostnames?: string[]\n\t\t/**\n\t\t * Whether the same-origin telemetry proxy rewrites (from\n\t\t * `withLaunchDarklyConfig`) are configured. When true, telemetry is\n\t\t * uploaded to `/highlight-events` plus same-origin OTLP paths, which the\n\t\t * Next server rewrites forward to LaunchDarkly.\n\t\t *\n\t\t * Compute it server-side with `process.env[PROXY_ENV_FLAG] === 'true'` —\n\t\t * the server runtime has the `env` map from `next.config`, while client\n\t\t * bundles cannot (Turbopack does not inline `next.config.js` `env` map\n\t\t * values into the client bundle). If omitted, the SDK falls back to the\n\t\t * (less reliable) client-side env probe.\n\t\t */\n\t\tuseProxy?: boolean\n\t}\n\n/**\n * Drop-in client component that boots LaunchDarkly observability and session\n * replay for a Next.js app. Render it once near the root of your app (e.g. in\n * `app/layout.tsx` or `pages/_app.tsx`).\n *\n * It runs the plugins in standalone mode — there is no LaunchDarkly feature-flag\n * SDK for Next.js, so the plugins are initialized directly from the LaunchDarkly\n * SDK key rather than registered with an LD client.\n */\nexport function LDObservabilityInit({\n\tsdkKey,\n\tapplication,\n\texcludedHostnames = [],\n\tuseProxy,\n\t...options\n}: LDObservabilityInitProps) {\n\tuseEffect(() => {\n\t\tconst shouldRender =\n\t\t\t!!sdkKey &&\n\t\t\texcludedHostnames.every(\n\t\t\t\t(hostname) => !window.location.hostname.includes(hostname),\n\t\t\t)\n\n\t\tif (!shouldRender) {\n\t\t\treturn\n\t\t}\n\n\t\tlet initOptions: LDObservabilityInitProps = { ...options }\n\n\t\t// `useProxy` is normally passed as a prop by a server layout (computed\n\t\t// from the withLaunchDarklyConfig env flag). Fall back to a client-side\n\t\t// probe of the same flag for callers that don't pass it — note this probe\n\t\t// only sees a value when the bundler inlined next.config's env map (e.g.\n\t\t// webpack builds).\n\t\tconst configureProxy =\n\t\t\tuseProxy ?? process.env[PROXY_ENV_FLAG] === 'true'\n\t\tif (configureProxy) {\n\t\t\tinitOptions = {\n\t\t\t\t...initOptions,\n\t\t\t\tbackendUrl: PROXY_BACKEND_PATH,\n\t\t\t\totel: {\n\t\t\t\t\t...initOptions.otel,\n\t\t\t\t\totlpEndpoint: window.location.origin,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\t// Standalone init loads the LDObserve / LDRecord singletons. The shared\n\t\t// guard keeps this idempotent across re-renders and bundles.\n\t\tensureStandaloneInit(\n\t\t\t'observe',\n\t\t\t() => new Observability(initOptions),\n\t\t\tsdkKey,\n\t\t\tapplication,\n\t\t)\n\t\tensureStandaloneInit(\n\t\t\t'record',\n\t\t\t() => new SessionReplay(initOptions),\n\t\t\tsdkKey,\n\t\t\tapplication,\n\t\t)\n\n\t\t// The session secure id only becomes available once the session replay\n\t\t// SDK has finished loading, so LDRecord.getSession() returns null right\n\t\t// after init. Poll briefly until it resolves, then persist it for\n\t\t// observabilityMiddleware to forward as x-highlight-request. If replay\n\t\t// never loads, there is no session to link and the cookie is left unset.\n\t\tconst persistSessionCookie = () => {\n\t\t\tconst sessionSecureID = LDRecord.getSession()?.sessionSecureID\n\t\t\tif (sessionSecureID) {\n\t\t\t\tCookies.set('sessionSecureID', sessionSecureID)\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tif (persistSessionCookie()) {\n\t\t\treturn\n\t\t}\n\t\tlet attempts = 0\n\t\tconst interval = setInterval(() => {\n\t\t\tif (persistSessionCookie() || ++attempts >= 50) {\n\t\t\t\tclearInterval(interval)\n\t\t\t}\n\t\t}, 100)\n\t\treturn () => clearInterval(interval)\n\t}, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n\treturn null\n}\n"],"names":["sdkKey","application","excludedHostnames","useProxy","options","useEffect","every","hostname","window","location","includes","initOptions","process","env","PROXY_ENV_FLAG","backendUrl","PROXY_BACKEND_PATH","otel","otlpEndpoint","origin","ensureStandaloneInit","Observability","SessionReplay","persistSessionCookie","sessionSecureID","LDRecord","getSession","Cookies","set","attempts","interval","setInterval","clearInterval"],"mappings":"kiBAiEoCA,OACnCA,EAAMC,YACNA,EAAWC,kBACXA,EAAoB,GAAEC,SACtBA,KACGC,IAyEH,OAvEAC,EAAAA,UAAU,KAOT,OALGL,GACFE,EAAkBI,MAChBC,IAAcC,OAAOC,SAASF,SAASG,SAASH,KAIlD,OAGD,IAAII,EAAwC,IAAKP,IAQhDD,GAA4C,SAAhCS,QAAQC,IAAIC,EAAAA,mBAExBH,EAAc,IACVA,EACHI,WAAYC,EAAAA,mBACZC,KAAM,IACFN,EAAYM,KACfC,aAAcV,OAAOC,SAASU,UAOjCC,EAAAA,qBACC,UACA,IAAM,IAAIC,EAAcV,GACxBX,EACAC,GAEDmB,EAAAA,qBACC,SACA,IAAM,IAAIE,EAAcX,GACxBX,EACAC,GAQD,MAAMsB,EAAuB,KAC5B,MAAMC,EAAkBC,EAAAA,SAASC,cAAcF,gBAC/C,QAAIA,IACHG,EAAQC,IAAI,kBAAmBJ,IACxB,IAIT,GAAID,IACH,OAED,IAAIM,EAAW,EACf,MAAMC,EAAWC,YAAY,MACxBR,OAA4BM,GAAY,KAC3CG,cAAcF,IAEb,KACH,MAAO,IAAME,cAAcF,IACzB,IAEI,IACR"}
|
package/dist/next-client.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type LDObservabilityInitProps = ObserveOptions & RecordOptions & {
|
|
|
8
8
|
sdkKey?: string;
|
|
9
9
|
application?: LDApplicationInfo;
|
|
10
10
|
excludedHostnames?: string[];
|
|
11
|
+
useProxy?: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare function LDObservabilityInit({ sdkKey, application, excludedHostnames, ...options }: LDObservabilityInitProps): null;
|
|
13
|
+
export declare function LDObservabilityInit({ sdkKey, application, excludedHostnames, useProxy, ...options }: LDObservabilityInitProps): null;
|
|
13
14
|
//# sourceMappingURL=next-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-client.d.ts","sourceRoot":"","sources":["../src/next-client.tsx"],"names":[],"mappings":"AAAA,OAAsB,EACrB,SAAS,EACT,KAAK,cAAc,EACnB,MAAM,6BAA6B,CAAA;AACpC,OAAsB,EACrB,QAAQ,EACR,KAAK,aAAa,EAClB,MAAM,8BAA8B,CAAA;AAKrC,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAA;AAO9B,MAAM,MAAM,wBAAwB,GAAG,cAAc,GACpD,aAAa,GAAG;IAKf,MAAM,CAAC,EAAE,MAAM,CAAA;IAKf,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAM/B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"next-client.d.ts","sourceRoot":"","sources":["../src/next-client.tsx"],"names":[],"mappings":"AAAA,OAAsB,EACrB,SAAS,EACT,KAAK,cAAc,EACnB,MAAM,6BAA6B,CAAA;AACpC,OAAsB,EACrB,QAAQ,EACR,KAAK,aAAa,EAClB,MAAM,8BAA8B,CAAA;AAKrC,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAA;AAO9B,MAAM,MAAM,wBAAwB,GAAG,cAAc,GACpD,aAAa,GAAG;IAKf,MAAM,CAAC,EAAE,MAAM,CAAA;IAKf,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAM/B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;IAa5B,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAWF,wBAAgB,mBAAmB,CAAC,EACnC,MAAM,EACN,WAAW,EACX,iBAAsB,EACtB,QAAQ,EACR,GAAG,OAAO,EACV,EAAE,wBAAwB,QAyE1B"}
|
package/dist/next-client.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import r from"@launchdarkly/observability";export{LDObserve}from"@launchdarkly/observability";import e,{LDRecord as o}from"@launchdarkly/session-replay";export{LDRecord}from"@launchdarkly/session-replay";import t from"js-cookie";import{useEffect as n}from"react";import{P as s,a}from"./proxy-
|
|
2
|
+
import r from"@launchdarkly/observability";export{LDObserve}from"@launchdarkly/observability";import e,{LDRecord as o}from"@launchdarkly/session-replay";export{LDRecord}from"@launchdarkly/session-replay";import t from"js-cookie";import{useEffect as n}from"react";import{P as s,a}from"./proxy-oEFAL7Y5.js";import{e as i}from"./standalone-C9hZecMf.js";export{E as ErrorBoundary}from"./error-boundary-CSJNDDPj.js";import"react/jsx-runtime";function l({sdkKey:l,application:c,excludedHostnames:u=[],useProxy:m,...p}){return n(()=>{if(!(!!l&&u.every(r=>!window.location.hostname.includes(r))))return;let n={...p};(m??"true"===process.env[a])&&(n={...n,backendUrl:s,otel:{...n.otel,otlpEndpoint:window.location.origin}}),i("observe",()=>new r(n),l,c),i("record",()=>new e(n),l,c);const d=()=>{const r=o.getSession()?.sessionSecureID;return!!r&&(t.set("sessionSecureID",r),!0)};if(d())return;let y=0;const f=setInterval(()=>{(d()||++y>=50)&&clearInterval(f)},100);return()=>clearInterval(f)},[]),null}export{l as LDObservabilityInit};
|
|
3
3
|
//# sourceMappingURL=next-client.js.map
|
package/dist/next-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-client.js","sources":["../src/next-client.tsx"],"sourcesContent":["import Observability, {\n\tLDObserve,\n\ttype ObserveOptions,\n} from '@launchdarkly/observability'\nimport SessionReplay, {\n\tLDRecord,\n\ttype RecordOptions,\n} from '@launchdarkly/session-replay'\nimport Cookies from 'js-cookie'\nimport { useEffect } from 'react'\n\nimport { PROXY_BACKEND_PATH, PROXY_ENV_FLAG } from './util/proxy'\nimport { ensureStandaloneInit, type LDApplicationInfo } from './util/standalone'\n\nexport { ErrorBoundary } from './error-boundary'\nexport type { ErrorBoundaryProps, ErrorBoundaryState } from './error-boundary'\nexport { LDObserve, LDRecord }\n\n/**\n * Options for {@link LDObservabilityInit}. Combines the browser observability and\n * session replay options, plus the LaunchDarkly SDK key used to initialize them\n * in standalone mode.\n */\nexport type LDObservabilityInitProps = ObserveOptions &\n\tRecordOptions & {\n\t\t/**\n\t\t * The LaunchDarkly client-side ID (SDK key) for the environment to send\n\t\t * telemetry to. Required for the SDK to initialize.\n\t\t */\n\t\tsdkKey?: string\n\t\t/**\n\t\t * Application metadata (id / version) tagged onto telemetry, mirroring\n\t\t * the `application` field of a LaunchDarkly client configuration.\n\t\t */\n\t\tapplication?: LDApplicationInfo\n\t\t/**\n\t\t * Hostnames on which the SDK should not initialize (e.g. local\n\t\t * development domains). If the current hostname includes any of these\n\t\t * substrings the SDK is skipped.\n\t\t */\n\t\texcludedHostnames?: string[]\n\t}\n\n/**\n * Drop-in client component that boots LaunchDarkly observability and session\n * replay for a Next.js app. Render it once near the root of your app (e.g. in\n * `app/layout.tsx` or `pages/_app.tsx`).\n *\n * It runs the plugins in standalone mode — there is no LaunchDarkly feature-flag\n * SDK for Next.js, so the plugins are initialized directly from the LaunchDarkly\n * SDK key rather than registered with an LD client.\n */\nexport function LDObservabilityInit({\n\tsdkKey,\n\tapplication,\n\texcludedHostnames = [],\n\t...options\n}: LDObservabilityInitProps) {\n\tuseEffect(() => {\n\t\tconst shouldRender =\n\t\t\t!!sdkKey &&\n\t\t\texcludedHostnames.every(\n\t\t\t\t(hostname) => !window.location.hostname.includes(hostname),\n\t\t\t)\n\n\t\tif (!shouldRender) {\n\t\t\treturn\n\t\t}\n\n\t\tlet initOptions: LDObservabilityInitProps = { ...options }\n\n\t\tconst configureProxy
|
|
1
|
+
{"version":3,"file":"next-client.js","sources":["../src/next-client.tsx"],"sourcesContent":["import Observability, {\n\tLDObserve,\n\ttype ObserveOptions,\n} from '@launchdarkly/observability'\nimport SessionReplay, {\n\tLDRecord,\n\ttype RecordOptions,\n} from '@launchdarkly/session-replay'\nimport Cookies from 'js-cookie'\nimport { useEffect } from 'react'\n\nimport { PROXY_BACKEND_PATH, PROXY_ENV_FLAG } from './util/proxy'\nimport { ensureStandaloneInit, type LDApplicationInfo } from './util/standalone'\n\nexport { ErrorBoundary } from './error-boundary'\nexport type { ErrorBoundaryProps, ErrorBoundaryState } from './error-boundary'\nexport { LDObserve, LDRecord }\n\n/**\n * Options for {@link LDObservabilityInit}. Combines the browser observability and\n * session replay options, plus the LaunchDarkly SDK key used to initialize them\n * in standalone mode.\n */\nexport type LDObservabilityInitProps = ObserveOptions &\n\tRecordOptions & {\n\t\t/**\n\t\t * The LaunchDarkly client-side ID (SDK key) for the environment to send\n\t\t * telemetry to. Required for the SDK to initialize.\n\t\t */\n\t\tsdkKey?: string\n\t\t/**\n\t\t * Application metadata (id / version) tagged onto telemetry, mirroring\n\t\t * the `application` field of a LaunchDarkly client configuration.\n\t\t */\n\t\tapplication?: LDApplicationInfo\n\t\t/**\n\t\t * Hostnames on which the SDK should not initialize (e.g. local\n\t\t * development domains). If the current hostname includes any of these\n\t\t * substrings the SDK is skipped.\n\t\t */\n\t\texcludedHostnames?: string[]\n\t\t/**\n\t\t * Whether the same-origin telemetry proxy rewrites (from\n\t\t * `withLaunchDarklyConfig`) are configured. When true, telemetry is\n\t\t * uploaded to `/highlight-events` plus same-origin OTLP paths, which the\n\t\t * Next server rewrites forward to LaunchDarkly.\n\t\t *\n\t\t * Compute it server-side with `process.env[PROXY_ENV_FLAG] === 'true'` —\n\t\t * the server runtime has the `env` map from `next.config`, while client\n\t\t * bundles cannot (Turbopack does not inline `next.config.js` `env` map\n\t\t * values into the client bundle). If omitted, the SDK falls back to the\n\t\t * (less reliable) client-side env probe.\n\t\t */\n\t\tuseProxy?: boolean\n\t}\n\n/**\n * Drop-in client component that boots LaunchDarkly observability and session\n * replay for a Next.js app. Render it once near the root of your app (e.g. in\n * `app/layout.tsx` or `pages/_app.tsx`).\n *\n * It runs the plugins in standalone mode — there is no LaunchDarkly feature-flag\n * SDK for Next.js, so the plugins are initialized directly from the LaunchDarkly\n * SDK key rather than registered with an LD client.\n */\nexport function LDObservabilityInit({\n\tsdkKey,\n\tapplication,\n\texcludedHostnames = [],\n\tuseProxy,\n\t...options\n}: LDObservabilityInitProps) {\n\tuseEffect(() => {\n\t\tconst shouldRender =\n\t\t\t!!sdkKey &&\n\t\t\texcludedHostnames.every(\n\t\t\t\t(hostname) => !window.location.hostname.includes(hostname),\n\t\t\t)\n\n\t\tif (!shouldRender) {\n\t\t\treturn\n\t\t}\n\n\t\tlet initOptions: LDObservabilityInitProps = { ...options }\n\n\t\t// `useProxy` is normally passed as a prop by a server layout (computed\n\t\t// from the withLaunchDarklyConfig env flag). Fall back to a client-side\n\t\t// probe of the same flag for callers that don't pass it — note this probe\n\t\t// only sees a value when the bundler inlined next.config's env map (e.g.\n\t\t// webpack builds).\n\t\tconst configureProxy =\n\t\t\tuseProxy ?? process.env[PROXY_ENV_FLAG] === 'true'\n\t\tif (configureProxy) {\n\t\t\tinitOptions = {\n\t\t\t\t...initOptions,\n\t\t\t\tbackendUrl: PROXY_BACKEND_PATH,\n\t\t\t\totel: {\n\t\t\t\t\t...initOptions.otel,\n\t\t\t\t\totlpEndpoint: window.location.origin,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\t// Standalone init loads the LDObserve / LDRecord singletons. The shared\n\t\t// guard keeps this idempotent across re-renders and bundles.\n\t\tensureStandaloneInit(\n\t\t\t'observe',\n\t\t\t() => new Observability(initOptions),\n\t\t\tsdkKey,\n\t\t\tapplication,\n\t\t)\n\t\tensureStandaloneInit(\n\t\t\t'record',\n\t\t\t() => new SessionReplay(initOptions),\n\t\t\tsdkKey,\n\t\t\tapplication,\n\t\t)\n\n\t\t// The session secure id only becomes available once the session replay\n\t\t// SDK has finished loading, so LDRecord.getSession() returns null right\n\t\t// after init. Poll briefly until it resolves, then persist it for\n\t\t// observabilityMiddleware to forward as x-highlight-request. If replay\n\t\t// never loads, there is no session to link and the cookie is left unset.\n\t\tconst persistSessionCookie = () => {\n\t\t\tconst sessionSecureID = LDRecord.getSession()?.sessionSecureID\n\t\t\tif (sessionSecureID) {\n\t\t\t\tCookies.set('sessionSecureID', sessionSecureID)\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tif (persistSessionCookie()) {\n\t\t\treturn\n\t\t}\n\t\tlet attempts = 0\n\t\tconst interval = setInterval(() => {\n\t\t\tif (persistSessionCookie() || ++attempts >= 50) {\n\t\t\t\tclearInterval(interval)\n\t\t\t}\n\t\t}, 100)\n\t\treturn () => clearInterval(interval)\n\t}, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n\treturn null\n}\n"],"names":["LDObservabilityInit","sdkKey","application","excludedHostnames","useProxy","options","useEffect","every","hostname","window","location","includes","initOptions","process","env","PROXY_ENV_FLAG","backendUrl","PROXY_BACKEND_PATH","otel","otlpEndpoint","origin","ensureStandaloneInit","Observability","SessionReplay","persistSessionCookie","sessionSecureID","LDRecord","getSession","Cookies","set","attempts","interval","setInterval","clearInterval"],"mappings":"8bAiEgBA,GAAoBC,OACnCA,EAAMC,YACNA,EAAWC,kBACXA,EAAoB,GAAEC,SACtBA,KACGC,IAyEH,OAvEAC,EAAU,KAOT,OALGL,GACFE,EAAkBI,MAChBC,IAAcC,OAAOC,SAASF,SAASG,SAASH,KAIlD,OAGD,IAAII,EAAwC,IAAKP,IAQhDD,GAA4C,SAAhCS,QAAQC,IAAIC,MAExBH,EAAc,IACVA,EACHI,WAAYC,EACZC,KAAM,IACFN,EAAYM,KACfC,aAAcV,OAAOC,SAASU,UAOjCC,EACC,UACA,IAAM,IAAIC,EAAcV,GACxBX,EACAC,GAEDmB,EACC,SACA,IAAM,IAAIE,EAAcX,GACxBX,EACAC,GAQD,MAAMsB,EAAuB,KAC5B,MAAMC,EAAkBC,EAASC,cAAcF,gBAC/C,QAAIA,IACHG,EAAQC,IAAI,kBAAmBJ,IACxB,IAIT,GAAID,IACH,OAED,IAAIM,EAAW,EACf,MAAMC,EAAWC,YAAY,MACxBR,OAA4BM,GAAY,KAC3CG,cAAcF,IAEb,KACH,MAAO,IAAME,cAAcF,IACzB,IAEI,IACR"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const t="https://pub.observability.app.launchdarkly.com",o="https://otel.observability.app.launchdarkly.com",s="https://pub.observability.ld-stg.launchdarkly.com",e="https://otel.observability.ld-stg.launchdarkly.com:4318";exports.LD_OTLP_ENDPOINT=o,exports.LD_PUBLIC_BACKEND_URL=t,exports.LD_STAGING_BACKEND_URL=s,exports.LD_STAGING_OTLP_ENDPOINT=e,exports.PROXY_BACKEND_PATH="/highlight-events",exports.PROXY_ENV_FLAG="configureLaunchDarklyProxy",exports.resolveLDEndpoints=function(r={}){const n="staging"===(process.env.LAUNCHDARKLY_ENV??"").toLowerCase();return{backendUrl:r.backendUrl||process.env.LAUNCHDARKLY_BACKEND_URL||(n?s:t),otlpEndpoint:r.otelEndpoint||process.env.LAUNCHDARKLY_OTEL_ENDPOINT||(n?e:o)}};
|
|
2
|
+
//# sourceMappingURL=proxy-BxWoc7Yz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy-BxWoc7Yz.js","sources":["../src/util/proxy.ts"],"sourcesContent":["/**\n * Shared constants describing the optional same-origin proxy that\n * {@link withLaunchDarklyConfig} sets up and that the client reads. Proxying\n * routes browser telemetry through your own domain so it is not blocked by ad\n * blockers and so that requests share the page's origin.\n */\n\n/** Env var (inlined by Next) signalling that the proxy rewrites are configured. */\nexport const PROXY_ENV_FLAG = 'configureLaunchDarklyProxy'\n\n/** Same-origin path that proxies to the LaunchDarkly events ingest endpoint. */\nexport const PROXY_BACKEND_PATH = '/highlight-events'\n\n/** Public LaunchDarkly production endpoints that the proxy rewrites forward to. */\nexport const LD_PUBLIC_BACKEND_URL =\n\t'https://pub.observability.app.launchdarkly.com'\nexport const LD_OTLP_ENDPOINT =\n\t'https://otel.observability.app.launchdarkly.com'\n\n/** Public LaunchDarkly staging endpoints (mirrors the mobile example apps). */\nexport const LD_STAGING_BACKEND_URL =\n\t'https://pub.observability.ld-stg.launchdarkly.com'\nexport const LD_STAGING_OTLP_ENDPOINT =\n\t'https://otel.observability.ld-stg.launchdarkly.com:4318'\n\n/**\n * Env var selecting the LaunchDarkly deployment to send data to ('production'\n * by default, 'staging' switches the proxy destinations to the staging hosts).\n */\nexport const LAUNCHDARKLY_ENV_ENV_VAR = 'LAUNCHDARKLY_ENV'\n\n/** Optional env var overriding the LaunchDarkly events ingest (backend) URL. */\nexport const LAUNCHDARKLY_BACKEND_URL_ENV_VAR = 'LAUNCHDARKLY_BACKEND_URL'\n\n/** Optional env var overriding the LaunchDarkly OTLP endpoint for traces/logs/metrics. */\nexport const LAUNCHDARKLY_OTEL_ENDPOINT_ENV_VAR = 'LAUNCHDARKLY_OTEL_ENDPOINT'\n\nexport interface LDEndpoints {\n\t/** LaunchDarkly public events ingest URL (session/error/log data). */\n\tbackendUrl: string\n\t/** LaunchDarkly OTLP-over-HTTP endpoint for traces, metrics and logs. */\n\totlpEndpoint: string\n}\n\n/**\n * Resolve the LaunchDarkly endpoints that the proxy rewrites forward to.\n *\n * Precedence: explicit options > `LAUNCHDARKLY_OTEL_ENDPOINT` /\n * `LAUNCHDARKLY_BACKEND_URL` env vars > the 'staging' hosts when\n * `LAUNCHDARKLY_ENV=staging` > the production hosts. This lets an app (most\n * commonly an example / e2e app) repoint the same-origin proxy at a staging or\n * local backend via env vars without code changes.\n */\nexport function resolveLDEndpoints(\n\topts: {\n\t\tbackendUrl?: string\n\t\totelEndpoint?: string\n\t} = {},\n): LDEndpoints {\n\tconst isStaging =\n\t\t(process.env[LAUNCHDARKLY_ENV_ENV_VAR] ?? '').toLowerCase() ===\n\t\t'staging'\n\n\tconst backendUrl =\n\t\topts.backendUrl ||\n\t\tprocess.env[LAUNCHDARKLY_BACKEND_URL_ENV_VAR] ||\n\t\t(isStaging ? LD_STAGING_BACKEND_URL : LD_PUBLIC_BACKEND_URL)\n\n\tconst otlpEndpoint =\n\t\topts.otelEndpoint ||\n\t\tprocess.env[LAUNCHDARKLY_OTEL_ENDPOINT_ENV_VAR] ||\n\t\t(isStaging ? LD_STAGING_OTLP_ENDPOINT : LD_OTLP_ENDPOINT)\n\n\treturn { backendUrl, otlpEndpoint }\n}\n"],"names":["LD_PUBLIC_BACKEND_URL","LD_OTLP_ENDPOINT","LD_STAGING_BACKEND_URL","LD_STAGING_OTLP_ENDPOINT","opts","isStaging","process","env","toLowerCase","backendUrl","otlpEndpoint","otelEndpoint"],"mappings":"aAQO,MAMMA,EACZ,iDACYC,EACZ,kDAGYC,EACZ,oDACYC,EACZ,oNAZiC,2CAHJ,wDA6CxB,SACLC,EAGI,IAEJ,MAAMC,EAEL,aADCC,QAAQC,IAA4B,kBAAK,IAAIC,cAa/C,MAAO,CAAEC,WATRL,EAAKK,YACLH,QAAQC,IAAoC,2BAC3CF,EAAYH,EAAyBF,GAOlBU,aAJpBN,EAAKO,cACLL,QAAQC,IAAsC,6BAC7CF,EAAYF,EAA2BF,GAG1C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const t="configureLaunchDarklyProxy",a="/highlight-events",s="https://pub.observability.app.launchdarkly.com",o="https://otel.observability.app.launchdarkly.com",e="https://pub.observability.ld-stg.launchdarkly.com",l="https://otel.observability.ld-stg.launchdarkly.com:4318";function n(t={}){const a="staging"===(process.env.LAUNCHDARKLY_ENV??"").toLowerCase();return{backendUrl:t.backendUrl||process.env.LAUNCHDARKLY_BACKEND_URL||(a?e:s),otlpEndpoint:t.otelEndpoint||process.env.LAUNCHDARKLY_OTEL_ENDPOINT||(a?l:o)}}export{o as L,a as P,t as a,s as b,e as c,l as d,n as r};
|
|
2
|
+
//# sourceMappingURL=proxy-oEFAL7Y5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy-oEFAL7Y5.js","sources":["../src/util/proxy.ts"],"sourcesContent":["/**\n * Shared constants describing the optional same-origin proxy that\n * {@link withLaunchDarklyConfig} sets up and that the client reads. Proxying\n * routes browser telemetry through your own domain so it is not blocked by ad\n * blockers and so that requests share the page's origin.\n */\n\n/** Env var (inlined by Next) signalling that the proxy rewrites are configured. */\nexport const PROXY_ENV_FLAG = 'configureLaunchDarklyProxy'\n\n/** Same-origin path that proxies to the LaunchDarkly events ingest endpoint. */\nexport const PROXY_BACKEND_PATH = '/highlight-events'\n\n/** Public LaunchDarkly production endpoints that the proxy rewrites forward to. */\nexport const LD_PUBLIC_BACKEND_URL =\n\t'https://pub.observability.app.launchdarkly.com'\nexport const LD_OTLP_ENDPOINT =\n\t'https://otel.observability.app.launchdarkly.com'\n\n/** Public LaunchDarkly staging endpoints (mirrors the mobile example apps). */\nexport const LD_STAGING_BACKEND_URL =\n\t'https://pub.observability.ld-stg.launchdarkly.com'\nexport const LD_STAGING_OTLP_ENDPOINT =\n\t'https://otel.observability.ld-stg.launchdarkly.com:4318'\n\n/**\n * Env var selecting the LaunchDarkly deployment to send data to ('production'\n * by default, 'staging' switches the proxy destinations to the staging hosts).\n */\nexport const LAUNCHDARKLY_ENV_ENV_VAR = 'LAUNCHDARKLY_ENV'\n\n/** Optional env var overriding the LaunchDarkly events ingest (backend) URL. */\nexport const LAUNCHDARKLY_BACKEND_URL_ENV_VAR = 'LAUNCHDARKLY_BACKEND_URL'\n\n/** Optional env var overriding the LaunchDarkly OTLP endpoint for traces/logs/metrics. */\nexport const LAUNCHDARKLY_OTEL_ENDPOINT_ENV_VAR = 'LAUNCHDARKLY_OTEL_ENDPOINT'\n\nexport interface LDEndpoints {\n\t/** LaunchDarkly public events ingest URL (session/error/log data). */\n\tbackendUrl: string\n\t/** LaunchDarkly OTLP-over-HTTP endpoint for traces, metrics and logs. */\n\totlpEndpoint: string\n}\n\n/**\n * Resolve the LaunchDarkly endpoints that the proxy rewrites forward to.\n *\n * Precedence: explicit options > `LAUNCHDARKLY_OTEL_ENDPOINT` /\n * `LAUNCHDARKLY_BACKEND_URL` env vars > the 'staging' hosts when\n * `LAUNCHDARKLY_ENV=staging` > the production hosts. This lets an app (most\n * commonly an example / e2e app) repoint the same-origin proxy at a staging or\n * local backend via env vars without code changes.\n */\nexport function resolveLDEndpoints(\n\topts: {\n\t\tbackendUrl?: string\n\t\totelEndpoint?: string\n\t} = {},\n): LDEndpoints {\n\tconst isStaging =\n\t\t(process.env[LAUNCHDARKLY_ENV_ENV_VAR] ?? '').toLowerCase() ===\n\t\t'staging'\n\n\tconst backendUrl =\n\t\topts.backendUrl ||\n\t\tprocess.env[LAUNCHDARKLY_BACKEND_URL_ENV_VAR] ||\n\t\t(isStaging ? LD_STAGING_BACKEND_URL : LD_PUBLIC_BACKEND_URL)\n\n\tconst otlpEndpoint =\n\t\topts.otelEndpoint ||\n\t\tprocess.env[LAUNCHDARKLY_OTEL_ENDPOINT_ENV_VAR] ||\n\t\t(isStaging ? LD_STAGING_OTLP_ENDPOINT : LD_OTLP_ENDPOINT)\n\n\treturn { backendUrl, otlpEndpoint }\n}\n"],"names":["PROXY_ENV_FLAG","PROXY_BACKEND_PATH","LD_PUBLIC_BACKEND_URL","LD_OTLP_ENDPOINT","LD_STAGING_BACKEND_URL","LD_STAGING_OTLP_ENDPOINT","resolveLDEndpoints","opts","isStaging","process","env","toLowerCase","backendUrl","otlpEndpoint","otelEndpoint"],"mappings":"AAQO,MAAMA,EAAiB,6BAGjBC,EAAqB,oBAGrBC,EACZ,iDACYC,EACZ,kDAGYC,EACZ,oDACYC,EACZ,0DA8BK,SAAUC,EACfC,EAGI,IAEJ,MAAMC,EAEL,aADCC,QAAQC,IAA4B,kBAAK,IAAIC,cAa/C,MAAO,CAAEC,WATRL,EAAKK,YACLH,QAAQC,IAAoC,2BAC3CF,EAAYJ,EAAyBF,GAOlBW,aAJpBN,EAAKO,cACLL,QAAQC,IAAsC,6BAC7CF,EAAYH,EAA2BF,GAG1C"}
|
package/dist/server.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@launchdarkly/observability-node"),r=require("./observability-middleware-CH0Vm0ev.js"),t=require("./standalone-
|
|
1
|
+
"use strict";var e=require("@launchdarkly/observability-node"),r=require("./observability-middleware-CH0Vm0ev.js"),t=require("./standalone-D7TcqTSf.js");async function i(e){if(!r.isNodeJsRuntime())return void console.info(`LaunchDarkly observability not registered: NEXT_RUNTIME=${process.env.NEXT_RUNTIME}`);const i=globalThis.__ldObservabilityNextRegister??=async function(e){const{Observability:r}=await import("@launchdarkly/observability-node"),{sdkKey:i,...s}=e,n=new r(s);n.register?.({},t.standaloneMetadata(i))}(e).catch(e=>{throw globalThis.__ldObservabilityNextRegister===i&&(globalThis.__ldObservabilityNextRegister=void 0),e});await i}function s(e){return e?e.split("#")[0].split("?")[0]:""}require("next/headers"),require("next/server");const n=a;function a(t){if(r.isNodeJsRuntime())return(r=>t=>async(n,a)=>(await i(r),await e.LDObserve.runWithHeaders(`${n.method?.toUpperCase()} - ${s(n.url)}`,n.headers,async()=>await t(n,a))))(t);throw new Error(`unidentified NEXT_RUNTIME: ${process.env.NEXT_RUNTIME}`)}Object.defineProperty(exports,"Handlers",{enumerable:!0,get:function(){return e.Handlers}}),Object.defineProperty(exports,"LDObserve",{enumerable:!0,get:function(){return e.LDObserve}}),exports.isNodeJsRuntime=r.isNodeJsRuntime,exports.observabilityMiddleware=r.observabilityMiddleware,exports.AppRouterObservability=function(t){if(r.isNodeJsRuntime())return function(r){return t=>async(n,a)=>(await i(r),await e.LDObserve.runWithHeaders(`${n.method?.toUpperCase()} - ${s(n.url)}`,n.headers,async()=>t(n,a)))}(t);throw new Error(`unidentified NEXT_RUNTIME: ${process.env.NEXT_RUNTIME}`)},exports.EdgeObservability=function(e){throw new Error(`unsupported NEXT_RUNTIME: ${process.env.NEXT_RUNTIME}`)},exports.Observability=n,exports.PageRouterObservability=a,exports.registerObservability=i;
|
|
2
2
|
//# sourceMappingURL=server.cjs.map
|
package/dist/server.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.cjs","sources":["../src/util/register-observability.ts","../src/util/sanitize-url.ts","../src/util/with-observability-page-router.ts","../src/server.ts","../src/util/with-observability-app-router.ts"],"sourcesContent":["import { isNodeJsRuntime } from './is-node-js-runtime'\nimport { standaloneMetadata, type StandalonePlugin } from './standalone'\nimport type { ObservabilityEnv } from './types'\n\
|
|
1
|
+
{"version":3,"file":"server.cjs","sources":["../src/util/register-observability.ts","../src/util/sanitize-url.ts","../src/util/with-observability-page-router.ts","../src/server.ts","../src/util/with-observability-app-router.ts"],"sourcesContent":["import { isNodeJsRuntime } from './is-node-js-runtime'\nimport { standaloneMetadata, type StandalonePlugin } from './standalone'\nimport type { ObservabilityEnv } from './types'\n\ndeclare var globalThis: { __ldObservabilityNextRegister?: Promise<void> }\n\nasync function init(env: ObservabilityEnv) {\n\t// Import lazily so the OpenTelemetry/node dependencies are never pulled into\n\t// an edge bundle.\n\tconst { Observability } = await import('@launchdarkly/observability-node')\n\n\tconst { sdkKey, ...options } = env\n\tconst plugin = new Observability(options) as unknown as StandalonePlugin\n\t// `register` ignores the client argument and initializes LDObserve from the\n\t// SDK key in the metadata. See util/standalone.ts. Inside the node SDK,\n\t// `Observability.register` is idempotent, so even if a bundler-duplicated\n\t// copy of this module runs the same call, only the first OpenTelemetry\n\t// configuration is created.\n\tplugin.register?.({}, standaloneMetadata(sdkKey))\n}\n\n/**\n * Initialize the server-side LaunchDarkly observability plugin in standalone\n * mode. Call this from your Next.js `instrumentation.ts` `register()` hook.\n *\n * Initialization only happens in the Node.js runtime; in the edge runtime this\n * is a no-op (the OpenTelemetry-based node SDK is not edge-compatible). It is\n * idempotent and concurrency-safe, so route-handler wrappers can safely await\n * it on every request.\n *\n * `LDObserve` is a process-global singleton that can only be initialized once,\n * so the first successful call wins and later calls reuse it. All callers\n * (`instrumentation.ts` and any route wrappers) should therefore pass the same\n * `env` — initialize once in `instrumentation.ts` for the canonical config.\n *\n * Bundling note: Turbopack may duplicate this module across server bundles\n * (each entry gets its own `initPromise`), so the in-flight init is\n * additionally cached on `globalThis` — only the first copy constructs the\n * `Observability` plugin (and with it the OTel NodeSDK and instrumentation\n * hooks).\n *\n * Failure semantics: a failed init drops the cached promise so a later request\n * can retry, and the rejection is re-thrown so that callers (e.g. route\n * wrappers) surface the original error instead of a confusing downstream\n * `LDObserve.*` failure on an uninitialized client.\n */\nexport async function registerObservability(env: ObservabilityEnv) {\n\tif (!isNodeJsRuntime()) {\n\t\tconsole.info(\n\t\t\t`LaunchDarkly observability not registered: NEXT_RUNTIME=${process.env.NEXT_RUNTIME}`,\n\t\t)\n\t\treturn\n\t}\n\n\t// Cache the in-flight init process-wide so duplicated module copies converge\n\t// on the first initialization instead of each constructing their own plugin\n\t// (and therefore a second OTel NodeSDK). On failure the cache is dropped so\n\t// a later call retries; the rejection still reaches each caller.\n\tconst inFlight = (globalThis.__ldObservabilityNextRegister ??= init(\n\t\tenv,\n\t).catch((err) => {\n\t\tif (globalThis.__ldObservabilityNextRegister === inFlight) {\n\t\t\tglobalThis.__ldObservabilityNextRegister = undefined\n\t\t}\n\t\tthrow err\n\t}))\n\n\tawait inFlight\n}\n","/**\n * Strip the query string and fragment from a URL before it is used as an\n * OpenTelemetry span name. Query params and hash fragments can carry secrets\n * (OAuth tokens, auth codes, signed URLs); span names are exported to the\n * tracing backend, so the high-cardinality, potentially-sensitive tail must be\n * dropped. Works for both absolute URLs (`request.url`) and request-relative\n * paths (`req.url` in the Pages Router).\n */\nexport function sanitizeSpanUrl(url: string | undefined): string {\n\tif (!url) {\n\t\treturn ''\n\t}\n\treturn url.split('#')[0].split('?')[0]\n}\n","import { LDObserve } from '@launchdarkly/observability-node'\n\nimport { registerObservability } from './register-observability'\nimport { sanitizeSpanUrl } from './sanitize-url'\nimport type { ObservabilityEnv } from './types'\n\nimport type { IncomingHttpHeaders } from 'http'\n\nexport declare type HasHeaders = {\n\theaders: IncomingHttpHeaders\n\tmethod?: string\n\turl?: string\n}\nexport declare type HasStatus = {\n\treadonly statusCode: number\n\treadonly statusMessage: string\n\tstatus: (statusCode: number) => HasStatus\n\tsend: (body: string) => void\n}\nexport declare type ApiHandler<T extends HasHeaders, S extends HasStatus> = (\n\treq: T,\n\tres: S,\n) => unknown | Promise<unknown>\n\n/**\n * Wraps a Pages Router API handler so that its execution runs inside a\n * LaunchDarkly trace, with the session and request linked via incoming headers.\n */\nexport const Highlight =\n\t(env: ObservabilityEnv) =>\n\t<T extends HasHeaders, S extends HasStatus>(\n\t\toriginalHandler: ApiHandler<T, S>,\n\t): ApiHandler<T, S> => {\n\t\treturn async (req, res) => {\n\t\t\tawait registerObservability(env)\n\n\t\t\treturn await LDObserve.runWithHeaders(\n\t\t\t\t`${req.method?.toUpperCase()} - ${sanitizeSpanUrl(req.url)}`,\n\t\t\t\treq.headers,\n\t\t\t\tasync () => {\n\t\t\t\t\treturn await originalHandler(req, res)\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\t}\n","import * as withObservabilityAppRouter from './util/with-observability-app-router'\nimport * as withObservabilityPageRouter from './util/with-observability-page-router'\n\nimport { isNodeJsRuntime } from './util/is-node-js-runtime'\nimport type { ObservabilityEnv } from './util/types'\n\nexport { Handlers, LDObserve } from '@launchdarkly/observability-node'\nexport { observabilityMiddleware } from './util/observability-middleware'\nexport { isNodeJsRuntime } from './util/is-node-js-runtime'\nexport { registerObservability } from './util/register-observability'\nexport type { ObservabilityEnv } from './util/types'\n\ntype PageRouterObservabilityHandler = ReturnType<\n\ttypeof withObservabilityPageRouter.Highlight\n>\n\n/**\n * Default Pages Router wrapper. Alias for {@link PageRouterObservability}.\n */\nexport const Observability = PageRouterObservability\n\n/**\n * Wrap a Pages Router API handler to record LaunchDarkly traces. Only supported\n * in the Node.js runtime.\n */\nexport function PageRouterObservability(\n\tenv: ObservabilityEnv,\n): PageRouterObservabilityHandler {\n\tif (isNodeJsRuntime()) {\n\t\treturn withObservabilityPageRouter.Highlight(env)\n\t}\n\tthrow new Error(`unidentified NEXT_RUNTIME: ${process.env.NEXT_RUNTIME}`)\n}\n\n/**\n * Wrap an App Router route handler to record LaunchDarkly traces. Only supported\n * in the Node.js runtime.\n */\nexport function AppRouterObservability(env: ObservabilityEnv) {\n\tif (isNodeJsRuntime()) {\n\t\treturn withObservabilityAppRouter.Highlight(env)\n\t}\n\tthrow new Error(`unidentified NEXT_RUNTIME: ${process.env.NEXT_RUNTIME}`)\n}\n\n/**\n * Edge runtime is not yet supported by the LaunchDarkly observability node SDK.\n */\nexport function EdgeObservability(_: ObservabilityEnv): never {\n\tthrow new Error(`unsupported NEXT_RUNTIME: ${process.env.NEXT_RUNTIME}`)\n}\n","import { LDObserve } from '@launchdarkly/observability-node'\n\nimport { registerObservability } from './register-observability'\nimport { sanitizeSpanUrl } from './sanitize-url'\nimport type { ObservabilityEnv } from './types'\n\ntype NextContext = {\n\tparams: Promise<Record<string, string>>\n}\ntype NextHandler = (request: Request, context: NextContext) => Promise<Response>\n\n/**\n * Wraps an App Router route handler so that its execution runs inside a\n * LaunchDarkly trace, with the session and request linked via incoming headers.\n */\nexport function Highlight(env: ObservabilityEnv) {\n\treturn (originalHandler: NextHandler) =>\n\t\tasync (request: Request, context: NextContext): Promise<Response> => {\n\t\t\tawait registerObservability(env)\n\n\t\t\treturn await LDObserve.runWithHeaders(\n\t\t\t\t`${request.method?.toUpperCase()} - ${sanitizeSpanUrl(request.url)}`,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\trequest.headers as any,\n\t\t\t\tasync () => originalHandler(request, context),\n\t\t\t)\n\t\t}\n}\n"],"names":["async","registerObservability","env","isNodeJsRuntime","console","info","process","NEXT_RUNTIME","inFlight","globalThis","__ldObservabilityNextRegister","Observability","import","sdkKey","options","plugin","register","standaloneMetadata","init","catch","err","undefined","sanitizeSpanUrl","url","split","PageRouterObservability","originalHandler","req","res","LDObserve","runWithHeaders","method","toUpperCase","headers","withObservabilityPageRouter.Highlight","Error","request","context","withObservabilityAppRouter.Highlight","_"],"mappings":"yJA8COA,eAAeC,EAAsBC,GAC3C,IAAKC,EAAAA,kBAIJ,YAHAC,QAAQC,KACP,2DAA2DC,QAAQJ,IAAIK,gBASzE,MAAMC,EAAYC,WAAWC,gCApD9BV,eAAoBE,GAGnB,MAAMS,cAAEA,SAAwBC,OAAO,qCAEjCC,OAAEA,KAAWC,GAAYZ,EACzBa,EAAS,IAAIJ,EAAcG,GAMjCC,EAAOC,WAAW,CAAA,EAAIC,EAAAA,mBAAmBJ,GAC1C,CAuCgEK,CAC9DhB,GACCiB,MAAOC,IAIR,MAHIX,WAAWC,gCAAkCF,IAChDC,WAAWC,mCAAgCW,GAEtCD,UAGDZ,CACP,CC5DM,SAAUc,EAAgBC,GAC/B,OAAKA,EAGEA,EAAIC,MAAM,KAAK,GAAGA,MAAM,KAAK,GAF5B,EAGT,gDCeO,MCTMb,EAAgBc,EAMvB,SAAUA,EACfvB,GAEA,GAAIC,EAAAA,kBACH,MDAD,CAACD,GAEAwB,GAEO1B,MAAO2B,EAAKC,WACZ3B,EAAsBC,SAEf2B,EAAAA,UAAUC,eACtB,GAAGH,EAAII,QAAQC,mBAAmBV,EAAgBK,EAAIJ,OACtDI,EAAIM,QACJjC,eACc0B,EAAgBC,EAAKC,KCX9BM,CAAsChC,GAE9C,MAAM,IAAIiC,MAAM,8BAA8B7B,QAAQJ,IAAIK,eAC3D,8TAMM,SAAiCL,GACtC,GAAIC,EAAAA,kBACH,OCzBI,SAAoBD,GACzB,OAAQwB,GACP1B,MAAOoC,EAAkBC,WAClBpC,EAAsBC,SAEf2B,EAAAA,UAAUC,eACtB,GAAGM,EAAQL,QAAQC,mBAAmBV,EAAgBc,EAAQb,OAE9Da,EAAQH,QACRjC,SAAY0B,EAAgBU,EAASC,IAGzC,CDaSC,CAAqCpC,GAE7C,MAAM,IAAIiC,MAAM,8BAA8B7B,QAAQJ,IAAIK,eAC3D,4BAKM,SAA4BgC,GACjC,MAAM,IAAIJ,MAAM,6BAA6B7B,QAAQJ,IAAIK,eAC1D"}
|
package/dist/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{LDObserve as
|
|
1
|
+
import{LDObserve as e}from"@launchdarkly/observability-node";export{Handlers,LDObserve}from"@launchdarkly/observability-node";import{i as r}from"./observability-middleware-D4dJiJoK.js";export{o as observabilityMiddleware}from"./observability-middleware-D4dJiJoK.js";import{s as i}from"./standalone-C9hZecMf.js";import"next/headers";import"next/server";async function t(e){if(!r())return void console.info(`LaunchDarkly observability not registered: NEXT_RUNTIME=${process.env.NEXT_RUNTIME}`);const t=globalThis.__ldObservabilityNextRegister??=async function(e){const{Observability:r}=await import("@launchdarkly/observability-node"),{sdkKey:t,...o}=e,a=new r(o);a.register?.({},i(t))}(e).catch(e=>{throw globalThis.__ldObservabilityNextRegister===t&&(globalThis.__ldObservabilityNextRegister=void 0),e});await t}function a(e){return e?e.split("#")[0].split("?")[0]:""}const s=n;function n(i){if(r())return(r=>i=>async(o,s)=>(await t(r),await e.runWithHeaders(`${o.method?.toUpperCase()} - ${a(o.url)}`,o.headers,async()=>await i(o,s))))(i);throw new Error(`unidentified NEXT_RUNTIME: ${process.env.NEXT_RUNTIME}`)}function l(i){if(r())return function(r){return i=>async(o,s)=>(await t(r),await e.runWithHeaders(`${o.method?.toUpperCase()} - ${a(o.url)}`,o.headers,async()=>i(o,s)))}(i);throw new Error(`unidentified NEXT_RUNTIME: ${process.env.NEXT_RUNTIME}`)}function d(e){throw new Error(`unsupported NEXT_RUNTIME: ${process.env.NEXT_RUNTIME}`)}export{l as AppRouterObservability,d as EdgeObservability,s as Observability,n as PageRouterObservability,r as isNodeJsRuntime,t as registerObservability};
|
|
2
2
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sources":["../src/util/register-observability.ts","../src/util/sanitize-url.ts","../src/util/with-observability-page-router.ts","../src/server.ts","../src/util/with-observability-app-router.ts"],"sourcesContent":["import { isNodeJsRuntime } from './is-node-js-runtime'\nimport { standaloneMetadata, type StandalonePlugin } from './standalone'\nimport type { ObservabilityEnv } from './types'\n\
|
|
1
|
+
{"version":3,"file":"server.js","sources":["../src/util/register-observability.ts","../src/util/sanitize-url.ts","../src/util/with-observability-page-router.ts","../src/server.ts","../src/util/with-observability-app-router.ts"],"sourcesContent":["import { isNodeJsRuntime } from './is-node-js-runtime'\nimport { standaloneMetadata, type StandalonePlugin } from './standalone'\nimport type { ObservabilityEnv } from './types'\n\ndeclare var globalThis: { __ldObservabilityNextRegister?: Promise<void> }\n\nasync function init(env: ObservabilityEnv) {\n\t// Import lazily so the OpenTelemetry/node dependencies are never pulled into\n\t// an edge bundle.\n\tconst { Observability } = await import('@launchdarkly/observability-node')\n\n\tconst { sdkKey, ...options } = env\n\tconst plugin = new Observability(options) as unknown as StandalonePlugin\n\t// `register` ignores the client argument and initializes LDObserve from the\n\t// SDK key in the metadata. See util/standalone.ts. Inside the node SDK,\n\t// `Observability.register` is idempotent, so even if a bundler-duplicated\n\t// copy of this module runs the same call, only the first OpenTelemetry\n\t// configuration is created.\n\tplugin.register?.({}, standaloneMetadata(sdkKey))\n}\n\n/**\n * Initialize the server-side LaunchDarkly observability plugin in standalone\n * mode. Call this from your Next.js `instrumentation.ts` `register()` hook.\n *\n * Initialization only happens in the Node.js runtime; in the edge runtime this\n * is a no-op (the OpenTelemetry-based node SDK is not edge-compatible). It is\n * idempotent and concurrency-safe, so route-handler wrappers can safely await\n * it on every request.\n *\n * `LDObserve` is a process-global singleton that can only be initialized once,\n * so the first successful call wins and later calls reuse it. All callers\n * (`instrumentation.ts` and any route wrappers) should therefore pass the same\n * `env` — initialize once in `instrumentation.ts` for the canonical config.\n *\n * Bundling note: Turbopack may duplicate this module across server bundles\n * (each entry gets its own `initPromise`), so the in-flight init is\n * additionally cached on `globalThis` — only the first copy constructs the\n * `Observability` plugin (and with it the OTel NodeSDK and instrumentation\n * hooks).\n *\n * Failure semantics: a failed init drops the cached promise so a later request\n * can retry, and the rejection is re-thrown so that callers (e.g. route\n * wrappers) surface the original error instead of a confusing downstream\n * `LDObserve.*` failure on an uninitialized client.\n */\nexport async function registerObservability(env: ObservabilityEnv) {\n\tif (!isNodeJsRuntime()) {\n\t\tconsole.info(\n\t\t\t`LaunchDarkly observability not registered: NEXT_RUNTIME=${process.env.NEXT_RUNTIME}`,\n\t\t)\n\t\treturn\n\t}\n\n\t// Cache the in-flight init process-wide so duplicated module copies converge\n\t// on the first initialization instead of each constructing their own plugin\n\t// (and therefore a second OTel NodeSDK). On failure the cache is dropped so\n\t// a later call retries; the rejection still reaches each caller.\n\tconst inFlight = (globalThis.__ldObservabilityNextRegister ??= init(\n\t\tenv,\n\t).catch((err) => {\n\t\tif (globalThis.__ldObservabilityNextRegister === inFlight) {\n\t\t\tglobalThis.__ldObservabilityNextRegister = undefined\n\t\t}\n\t\tthrow err\n\t}))\n\n\tawait inFlight\n}\n","/**\n * Strip the query string and fragment from a URL before it is used as an\n * OpenTelemetry span name. Query params and hash fragments can carry secrets\n * (OAuth tokens, auth codes, signed URLs); span names are exported to the\n * tracing backend, so the high-cardinality, potentially-sensitive tail must be\n * dropped. Works for both absolute URLs (`request.url`) and request-relative\n * paths (`req.url` in the Pages Router).\n */\nexport function sanitizeSpanUrl(url: string | undefined): string {\n\tif (!url) {\n\t\treturn ''\n\t}\n\treturn url.split('#')[0].split('?')[0]\n}\n","import { LDObserve } from '@launchdarkly/observability-node'\n\nimport { registerObservability } from './register-observability'\nimport { sanitizeSpanUrl } from './sanitize-url'\nimport type { ObservabilityEnv } from './types'\n\nimport type { IncomingHttpHeaders } from 'http'\n\nexport declare type HasHeaders = {\n\theaders: IncomingHttpHeaders\n\tmethod?: string\n\turl?: string\n}\nexport declare type HasStatus = {\n\treadonly statusCode: number\n\treadonly statusMessage: string\n\tstatus: (statusCode: number) => HasStatus\n\tsend: (body: string) => void\n}\nexport declare type ApiHandler<T extends HasHeaders, S extends HasStatus> = (\n\treq: T,\n\tres: S,\n) => unknown | Promise<unknown>\n\n/**\n * Wraps a Pages Router API handler so that its execution runs inside a\n * LaunchDarkly trace, with the session and request linked via incoming headers.\n */\nexport const Highlight =\n\t(env: ObservabilityEnv) =>\n\t<T extends HasHeaders, S extends HasStatus>(\n\t\toriginalHandler: ApiHandler<T, S>,\n\t): ApiHandler<T, S> => {\n\t\treturn async (req, res) => {\n\t\t\tawait registerObservability(env)\n\n\t\t\treturn await LDObserve.runWithHeaders(\n\t\t\t\t`${req.method?.toUpperCase()} - ${sanitizeSpanUrl(req.url)}`,\n\t\t\t\treq.headers,\n\t\t\t\tasync () => {\n\t\t\t\t\treturn await originalHandler(req, res)\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\t}\n","import * as withObservabilityAppRouter from './util/with-observability-app-router'\nimport * as withObservabilityPageRouter from './util/with-observability-page-router'\n\nimport { isNodeJsRuntime } from './util/is-node-js-runtime'\nimport type { ObservabilityEnv } from './util/types'\n\nexport { Handlers, LDObserve } from '@launchdarkly/observability-node'\nexport { observabilityMiddleware } from './util/observability-middleware'\nexport { isNodeJsRuntime } from './util/is-node-js-runtime'\nexport { registerObservability } from './util/register-observability'\nexport type { ObservabilityEnv } from './util/types'\n\ntype PageRouterObservabilityHandler = ReturnType<\n\ttypeof withObservabilityPageRouter.Highlight\n>\n\n/**\n * Default Pages Router wrapper. Alias for {@link PageRouterObservability}.\n */\nexport const Observability = PageRouterObservability\n\n/**\n * Wrap a Pages Router API handler to record LaunchDarkly traces. Only supported\n * in the Node.js runtime.\n */\nexport function PageRouterObservability(\n\tenv: ObservabilityEnv,\n): PageRouterObservabilityHandler {\n\tif (isNodeJsRuntime()) {\n\t\treturn withObservabilityPageRouter.Highlight(env)\n\t}\n\tthrow new Error(`unidentified NEXT_RUNTIME: ${process.env.NEXT_RUNTIME}`)\n}\n\n/**\n * Wrap an App Router route handler to record LaunchDarkly traces. Only supported\n * in the Node.js runtime.\n */\nexport function AppRouterObservability(env: ObservabilityEnv) {\n\tif (isNodeJsRuntime()) {\n\t\treturn withObservabilityAppRouter.Highlight(env)\n\t}\n\tthrow new Error(`unidentified NEXT_RUNTIME: ${process.env.NEXT_RUNTIME}`)\n}\n\n/**\n * Edge runtime is not yet supported by the LaunchDarkly observability node SDK.\n */\nexport function EdgeObservability(_: ObservabilityEnv): never {\n\tthrow new Error(`unsupported NEXT_RUNTIME: ${process.env.NEXT_RUNTIME}`)\n}\n","import { LDObserve } from '@launchdarkly/observability-node'\n\nimport { registerObservability } from './register-observability'\nimport { sanitizeSpanUrl } from './sanitize-url'\nimport type { ObservabilityEnv } from './types'\n\ntype NextContext = {\n\tparams: Promise<Record<string, string>>\n}\ntype NextHandler = (request: Request, context: NextContext) => Promise<Response>\n\n/**\n * Wraps an App Router route handler so that its execution runs inside a\n * LaunchDarkly trace, with the session and request linked via incoming headers.\n */\nexport function Highlight(env: ObservabilityEnv) {\n\treturn (originalHandler: NextHandler) =>\n\t\tasync (request: Request, context: NextContext): Promise<Response> => {\n\t\t\tawait registerObservability(env)\n\n\t\t\treturn await LDObserve.runWithHeaders(\n\t\t\t\t`${request.method?.toUpperCase()} - ${sanitizeSpanUrl(request.url)}`,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\trequest.headers as any,\n\t\t\t\tasync () => originalHandler(request, context),\n\t\t\t)\n\t\t}\n}\n"],"names":["async","registerObservability","env","isNodeJsRuntime","console","info","process","NEXT_RUNTIME","inFlight","globalThis","__ldObservabilityNextRegister","Observability","import","sdkKey","options","plugin","register","standaloneMetadata","init","catch","err","undefined","sanitizeSpanUrl","url","split","PageRouterObservability","originalHandler","req","res","LDObserve","runWithHeaders","method","toUpperCase","headers","withObservabilityPageRouter.Highlight","Error","AppRouterObservability","request","context","withObservabilityAppRouter.Highlight","EdgeObservability","_"],"mappings":"gWA8COA,eAAeC,EAAsBC,GAC3C,IAAKC,IAIJ,YAHAC,QAAQC,KACP,2DAA2DC,QAAQJ,IAAIK,gBASzE,MAAMC,EAAYC,WAAWC,gCApD9BV,eAAoBE,GAGnB,MAAMS,cAAEA,SAAwBC,OAAO,qCAEjCC,OAAEA,KAAWC,GAAYZ,EACzBa,EAAS,IAAIJ,EAAcG,GAMjCC,EAAOC,WAAW,CAAA,EAAIC,EAAmBJ,GAC1C,CAuCgEK,CAC9DhB,GACCiB,MAAOC,IAIR,MAHIX,WAAWC,gCAAkCF,IAChDC,WAAWC,mCAAgCW,GAEtCD,UAGDZ,CACP,CC5DM,SAAUc,EAAgBC,GAC/B,OAAKA,EAGEA,EAAIC,MAAM,KAAK,GAAGA,MAAM,KAAK,GAF5B,EAGT,CCeO,MCTMb,EAAgBc,EAMvB,SAAUA,EACfvB,GAEA,GAAIC,IACH,MDAD,CAACD,GAEAwB,GAEO1B,MAAO2B,EAAKC,WACZ3B,EAAsBC,SAEf2B,EAAUC,eACtB,GAAGH,EAAII,QAAQC,mBAAmBV,EAAgBK,EAAIJ,OACtDI,EAAIM,QACJjC,eACc0B,EAAgBC,EAAKC,KCX9BM,CAAsChC,GAE9C,MAAM,IAAIiC,MAAM,8BAA8B7B,QAAQJ,IAAIK,eAC3D,CAMM,SAAU6B,EAAuBlC,GACtC,GAAIC,IACH,OCzBI,SAAoBD,GACzB,OAAQwB,GACP1B,MAAOqC,EAAkBC,WAClBrC,EAAsBC,SAEf2B,EAAUC,eACtB,GAAGO,EAAQN,QAAQC,mBAAmBV,EAAgBe,EAAQd,OAE9Dc,EAAQJ,QACRjC,SAAY0B,EAAgBW,EAASC,IAGzC,CDaSC,CAAqCrC,GAE7C,MAAM,IAAIiC,MAAM,8BAA8B7B,QAAQJ,IAAIK,eAC3D,CAKM,SAAUiC,EAAkBC,GACjC,MAAM,IAAIN,MAAM,6BAA6B7B,QAAQJ,IAAIK,eAC1D"}
|
package/dist/ssr.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var r=require("react/jsx-runtime"),e=require("@launchdarkly/observability"),s=require("next/error.js"),t=require("react"),o=require("./standalone-
|
|
1
|
+
"use strict";var r=require("react/jsx-runtime"),e=require("@launchdarkly/observability"),s=require("next/error.js"),t=require("react"),o=require("./standalone-D7TcqTSf.js"),n=require("./error-boundary-CUcyBTHj.js");function u({res:r,err:e}){const s=r?.statusCode??e?.statusCode??500;return{errorMessage:r?.statusMessage??e?.message??"An error occurred",statusCode:s}}Object.defineProperty(exports,"LDObserve",{enumerable:!0,get:function(){return e.LDObserve}}),exports.ErrorBoundary=n.ErrorBoundary,exports.appRouterSsrErrorHandler=function(s){return({error:o,reset:n})=>(t.useEffect(()=>{e.LDObserve.recordError(o)},[o]),r.jsx(s,{error:o,reset:n}))},exports.getLDErrorInitialProps=u,exports.pageRouterCustomErrorHandler=function(n,a){const{sdkKey:i,application:c,...d}=n,p=n=>(t.useEffect(()=>{i&&o.ensureStandaloneInit("observe",()=>new e(d),i,c),e.LDObserve.recordError(new Error(n.errorMessage))},[n.errorMessage]),a?r.jsx(a,{...n}):r.jsx(s,{...n}));return p.getInitialProps=u,p};
|
|
2
2
|
//# sourceMappingURL=ssr.cjs.map
|
package/dist/ssr.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import e,{LDObserve as o}from"@launchdarkly/observability";export{LDObserve}from"@launchdarkly/observability";import s from"next/error.js";import{useEffect as t}from"react";import{e as a}from"./standalone-
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import e,{LDObserve as o}from"@launchdarkly/observability";export{LDObserve}from"@launchdarkly/observability";import s from"next/error.js";import{useEffect as t}from"react";import{e as a}from"./standalone-C9hZecMf.js";export{E as ErrorBoundary}from"./error-boundary-CSJNDDPj.js";function n({res:r,err:e}){const o=r?.statusCode??e?.statusCode??500;return{errorMessage:r?.statusMessage??e?.message??"An error occurred",statusCode:o}}function i(i,u){const{sdkKey:c,application:m,...d}=i,p=n=>(t(()=>{c&&a("observe",()=>new e(d),c,m),o.recordError(new Error(n.errorMessage))},[n.errorMessage]),r(u||s,{...n}));return p.getInitialProps=n,p}function u(e){return({error:s,reset:a})=>(t(()=>{o.recordError(s)},[s]),r(e,{error:s,reset:a}))}export{u as appRouterSsrErrorHandler,n as getLDErrorInitialProps,i as pageRouterCustomErrorHandler};
|
|
2
2
|
//# sourceMappingURL=ssr.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,n){return{sdk:{name:"@launchdarkly/observability-next",version:"0.
|
|
2
|
-
//# sourceMappingURL=standalone-
|
|
1
|
+
function e(e,n){return{sdk:{name:"@launchdarkly/observability-next",version:"0.2.4"},sdkKey:e,clientSideId:e,application:n}}function n(n,t,i,s){const o=globalThis.__ldObservabilityNext??={};if(o[n])return;const a=t();a.getHooks?.(e(i,s)),o[n]=!0}export{n as e,e as s};
|
|
2
|
+
//# sourceMappingURL=standalone-C9hZecMf.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalone-
|
|
1
|
+
{"version":3,"file":"standalone-C9hZecMf.js","sources":["../src/util/standalone.ts","../src/util/version.ts"],"sourcesContent":["import { SDK_NAME, SDK_VERSION } from './version'\n\n/**\n * Application metadata that LaunchDarkly associates with telemetry. Mirrors the\n * `application` field of the LaunchDarkly client configuration so that data sent\n * in standalone mode is tagged identically to data sent through an LD client.\n */\nexport interface LDApplicationInfo {\n\tid?: string\n\tversion?: string\n}\n\n/**\n * The LaunchDarkly observability and session replay plugins are normally\n * registered with a LaunchDarkly feature-flag client, which hands them an\n * `LDPluginEnvironmentMetadata` object describing the environment (and crucially\n * the SDK credential) during `getHooks`. There is no LaunchDarkly feature-flag\n * SDK for Next.js, so this SDK runs the plugins in \"standalone\" mode: we build\n * the same metadata object ourselves from the LaunchDarkly SDK key and invoke\n * the plugin's `getHooks`, which performs the one-time initialization that loads\n * the `LDObserve` / `LDRecord` singletons.\n *\n * The hooks returned by `getHooks` are only used for feature-flag evaluation and\n * identify tracking, which cannot fire without an LD client, so they are\n * discarded in standalone mode.\n */\nexport function standaloneMetadata(\n\tsdkKey: string,\n\tapplication?: LDApplicationInfo,\n) {\n\treturn {\n\t\tsdk: {\n\t\t\tname: SDK_NAME,\n\t\t\tversion: SDK_VERSION,\n\t\t},\n\t\tsdkKey,\n\t\tclientSideId: sdkKey,\n\t\tapplication,\n\t}\n}\n\n/**\n * A minimal structural type for a LaunchDarkly plugin so we can trigger\n * standalone initialization without depending on a specific LD client SDK\n * package. Both the browser plugins (`@launchdarkly/observability`,\n * `@launchdarkly/session-replay`) and the node plugin\n * (`@launchdarkly/observability-node`) satisfy this shape.\n */\nexport interface StandalonePlugin {\n\tgetHooks?(metadata: ReturnType<typeof standaloneMetadata>): unknown\n\tregister?(\n\t\tclient: unknown,\n\t\tmetadata: ReturnType<typeof standaloneMetadata>,\n\t): void\n}\n\ninterface InitRegistry {\n\t[key: string]: boolean\n}\ndeclare var globalThis: { __ldObservabilityNext?: InitRegistry }\n\n/**\n * Initialize a browser plugin in standalone mode exactly once. The guard is\n * keyed on `globalThis` (where the LDObserve / LDRecord singletons also live) so\n * that initialization is idempotent across this SDK's separate client and ssr\n * bundles — e.g. when both `LDObservabilityInit` and a Pages Router `_error`\n * page would otherwise init the same plugin.\n */\nexport function ensureStandaloneInit(\n\tkey: string,\n\tcreatePlugin: () => StandalonePlugin,\n\tsdkKey: string,\n\tapplication?: LDApplicationInfo,\n) {\n\tconst registry = (globalThis.__ldObservabilityNext ??= {})\n\tif (registry[key]) {\n\t\treturn\n\t}\n\n\tconst plugin = createPlugin()\n\tplugin.getHooks?.(standaloneMetadata(sdkKey, application))\n\t// Only mark the key initialized once init succeeds, so a throw from\n\t// createPlugin / getHooks leaves the plugin retryable on the next call.\n\tregistry[key] = true\n}\n","export const SDK_NAME = '@launchdarkly/observability-next'\n\n// Keep in sync with package.json \"version\". Used only as informational\n// telemetry metadata (telemetry.sdk.version), so minor drift is harmless. It is\n// a literal (rather than an import of package.json) so the manifest is not\n// bundled into the browser client.\nexport const SDK_VERSION = '0.2.4'\n"],"names":["standaloneMetadata","sdkKey","application","sdk","name","version","clientSideId","ensureStandaloneInit","key","createPlugin","registry","globalThis","__ldObservabilityNext","plugin","getHooks"],"mappings":"AA0BM,SAAUA,EACfC,EACAC,GAEA,MAAO,CACNC,IAAK,CACJC,KChCqB,mCDiCrBC,QC3BwB,SD6BzBJ,SACAK,aAAcL,EACdC,cAEF,CA6BM,SAAUK,EACfC,EACAC,EACAR,EACAC,GAEA,MAAMQ,EAAYC,WAAWC,wBAA0B,GACvD,GAAIF,EAASF,GACZ,OAGD,MAAMK,EAASJ,IACfI,EAAOC,WAAWd,EAAmBC,EAAQC,IAG7CQ,EAASF,IAAO,CACjB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function t(t,e){return{sdk:{name:"@launchdarkly/observability-next",version:"0.
|
|
2
|
-
//# sourceMappingURL=standalone-
|
|
1
|
+
"use strict";function t(t,e){return{sdk:{name:"@launchdarkly/observability-next",version:"0.2.4"},sdkKey:t,clientSideId:t,application:e}}exports.ensureStandaloneInit=function(e,n,a,i){const s=globalThis.__ldObservabilityNext??={};if(s[e])return;const o=n();o.getHooks?.(t(a,i)),s[e]=!0},exports.standaloneMetadata=t;
|
|
2
|
+
//# sourceMappingURL=standalone-D7TcqTSf.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalone-
|
|
1
|
+
{"version":3,"file":"standalone-D7TcqTSf.js","sources":["../src/util/standalone.ts","../src/util/version.ts"],"sourcesContent":["import { SDK_NAME, SDK_VERSION } from './version'\n\n/**\n * Application metadata that LaunchDarkly associates with telemetry. Mirrors the\n * `application` field of the LaunchDarkly client configuration so that data sent\n * in standalone mode is tagged identically to data sent through an LD client.\n */\nexport interface LDApplicationInfo {\n\tid?: string\n\tversion?: string\n}\n\n/**\n * The LaunchDarkly observability and session replay plugins are normally\n * registered with a LaunchDarkly feature-flag client, which hands them an\n * `LDPluginEnvironmentMetadata` object describing the environment (and crucially\n * the SDK credential) during `getHooks`. There is no LaunchDarkly feature-flag\n * SDK for Next.js, so this SDK runs the plugins in \"standalone\" mode: we build\n * the same metadata object ourselves from the LaunchDarkly SDK key and invoke\n * the plugin's `getHooks`, which performs the one-time initialization that loads\n * the `LDObserve` / `LDRecord` singletons.\n *\n * The hooks returned by `getHooks` are only used for feature-flag evaluation and\n * identify tracking, which cannot fire without an LD client, so they are\n * discarded in standalone mode.\n */\nexport function standaloneMetadata(\n\tsdkKey: string,\n\tapplication?: LDApplicationInfo,\n) {\n\treturn {\n\t\tsdk: {\n\t\t\tname: SDK_NAME,\n\t\t\tversion: SDK_VERSION,\n\t\t},\n\t\tsdkKey,\n\t\tclientSideId: sdkKey,\n\t\tapplication,\n\t}\n}\n\n/**\n * A minimal structural type for a LaunchDarkly plugin so we can trigger\n * standalone initialization without depending on a specific LD client SDK\n * package. Both the browser plugins (`@launchdarkly/observability`,\n * `@launchdarkly/session-replay`) and the node plugin\n * (`@launchdarkly/observability-node`) satisfy this shape.\n */\nexport interface StandalonePlugin {\n\tgetHooks?(metadata: ReturnType<typeof standaloneMetadata>): unknown\n\tregister?(\n\t\tclient: unknown,\n\t\tmetadata: ReturnType<typeof standaloneMetadata>,\n\t): void\n}\n\ninterface InitRegistry {\n\t[key: string]: boolean\n}\ndeclare var globalThis: { __ldObservabilityNext?: InitRegistry }\n\n/**\n * Initialize a browser plugin in standalone mode exactly once. The guard is\n * keyed on `globalThis` (where the LDObserve / LDRecord singletons also live) so\n * that initialization is idempotent across this SDK's separate client and ssr\n * bundles — e.g. when both `LDObservabilityInit` and a Pages Router `_error`\n * page would otherwise init the same plugin.\n */\nexport function ensureStandaloneInit(\n\tkey: string,\n\tcreatePlugin: () => StandalonePlugin,\n\tsdkKey: string,\n\tapplication?: LDApplicationInfo,\n) {\n\tconst registry = (globalThis.__ldObservabilityNext ??= {})\n\tif (registry[key]) {\n\t\treturn\n\t}\n\n\tconst plugin = createPlugin()\n\tplugin.getHooks?.(standaloneMetadata(sdkKey, application))\n\t// Only mark the key initialized once init succeeds, so a throw from\n\t// createPlugin / getHooks leaves the plugin retryable on the next call.\n\tregistry[key] = true\n}\n","export const SDK_NAME = '@launchdarkly/observability-next'\n\n// Keep in sync with package.json \"version\". Used only as informational\n// telemetry metadata (telemetry.sdk.version), so minor drift is harmless. It is\n// a literal (rather than an import of package.json) so the manifest is not\n// bundled into the browser client.\nexport const SDK_VERSION = '0.2.4'\n"],"names":["standaloneMetadata","sdkKey","application","sdk","name","version","clientSideId","key","createPlugin","registry","globalThis","__ldObservabilityNext","plugin","getHooks"],"mappings":"aA0BM,SAAUA,EACfC,EACAC,GAEA,MAAO,CACNC,IAAK,CACJC,KChCqB,mCDiCrBC,QC3BwB,SD6BzBJ,SACAK,aAAcL,EACdC,cAEF,8BA6BM,SACLK,EACAC,EACAP,EACAC,GAEA,MAAMO,EAAYC,WAAWC,wBAA0B,GACvD,GAAIF,EAASF,GACZ,OAGD,MAAMK,EAASJ,IACfI,EAAOC,WAAWb,EAAmBC,EAAQC,IAG7CO,EAASF,IAAO,CACjB"}
|
package/dist/util/proxy.d.ts
CHANGED
|
@@ -2,4 +2,17 @@ export declare const PROXY_ENV_FLAG = "configureLaunchDarklyProxy";
|
|
|
2
2
|
export declare const PROXY_BACKEND_PATH = "/highlight-events";
|
|
3
3
|
export declare const LD_PUBLIC_BACKEND_URL = "https://pub.observability.app.launchdarkly.com";
|
|
4
4
|
export declare const LD_OTLP_ENDPOINT = "https://otel.observability.app.launchdarkly.com";
|
|
5
|
+
export declare const LD_STAGING_BACKEND_URL = "https://pub.observability.ld-stg.launchdarkly.com";
|
|
6
|
+
export declare const LD_STAGING_OTLP_ENDPOINT = "https://otel.observability.ld-stg.launchdarkly.com:4318";
|
|
7
|
+
export declare const LAUNCHDARKLY_ENV_ENV_VAR = "LAUNCHDARKLY_ENV";
|
|
8
|
+
export declare const LAUNCHDARKLY_BACKEND_URL_ENV_VAR = "LAUNCHDARKLY_BACKEND_URL";
|
|
9
|
+
export declare const LAUNCHDARKLY_OTEL_ENDPOINT_ENV_VAR = "LAUNCHDARKLY_OTEL_ENDPOINT";
|
|
10
|
+
export interface LDEndpoints {
|
|
11
|
+
backendUrl: string;
|
|
12
|
+
otlpEndpoint: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function resolveLDEndpoints(opts?: {
|
|
15
|
+
backendUrl?: string;
|
|
16
|
+
otelEndpoint?: string;
|
|
17
|
+
}): LDEndpoints;
|
|
5
18
|
//# sourceMappingURL=proxy.d.ts.map
|
package/dist/util/proxy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/util/proxy.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,cAAc,+BAA+B,CAAA;AAG1D,eAAO,MAAM,kBAAkB,sBAAsB,CAAA;AAGrD,eAAO,MAAM,qBAAqB,mDACe,CAAA;AACjD,eAAO,MAAM,gBAAgB,oDACqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/util/proxy.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,cAAc,+BAA+B,CAAA;AAG1D,eAAO,MAAM,kBAAkB,sBAAsB,CAAA;AAGrD,eAAO,MAAM,qBAAqB,mDACe,CAAA;AACjD,eAAO,MAAM,gBAAgB,oDACqB,CAAA;AAGlD,eAAO,MAAM,sBAAsB,sDACiB,CAAA;AACpD,eAAO,MAAM,wBAAwB,4DACqB,CAAA;AAM1D,eAAO,MAAM,wBAAwB,qBAAqB,CAAA;AAG1D,eAAO,MAAM,gCAAgC,6BAA6B,CAAA;AAG1E,eAAO,MAAM,kCAAkC,+BAA+B,CAAA;AAE9E,MAAM,WAAW,WAAW;IAE3B,UAAU,EAAE,MAAM,CAAA;IAElB,YAAY,EAAE,MAAM,CAAA;CACpB;AAWD,wBAAgB,kBAAkB,CACjC,IAAI,GAAE;IACL,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CAChB,GACJ,WAAW,CAgBb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-observability.d.ts","sourceRoot":"","sources":["../../src/util/register-observability.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"register-observability.d.ts","sourceRoot":"","sources":["../../src/util/register-observability.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AA4C/C,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,iBAsBhE"}
|
package/dist/util/version.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { NextConfig } from 'next';
|
|
2
2
|
export interface LaunchDarklyConfigOptions {
|
|
3
3
|
configureLaunchDarklyProxy?: boolean;
|
|
4
|
+
backendUrl?: string;
|
|
5
|
+
otelEndpoint?: string;
|
|
4
6
|
}
|
|
5
7
|
type NextConfigObject = NextConfig;
|
|
6
8
|
type NextConfigFunction = (phase: string, { defaultConfig }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-launchdarkly-config.d.ts","sourceRoot":"","sources":["../../src/util/with-launchdarkly-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"with-launchdarkly-config.d.ts","sourceRoot":"","sources":["../../src/util/with-launchdarkly-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAmBjC,MAAM,WAAW,yBAAyB;IAQzC,0BAA0B,CAAC,EAAE,OAAO,CAAA;IAOpC,UAAU,CAAC,EAAE,MAAM,CAAA;IAQnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACrB;AAWD,KAAK,gBAAgB,GAAG,UAAU,CAAA;AAClC,KAAK,kBAAkB,GAAG,CACzB,KAAK,EAAE,MAAM,EACb,EAAE,aAAa,EAAE,EAAE;IAAE,aAAa,EAAE,GAAG,CAAA;CAAE,KACrC,UAAU,CAAA;AACf,KAAK,uBAAuB,GAAG,CAC9B,KAAK,EAAE,MAAM,EACb,EAAE,aAAa,EAAE,EAAE;IAAE,aAAa,EAAE,GAAG,CAAA;CAAE,KACrC,OAAO,CAAC,UAAU,CAAC,CAAA;AAmFxB,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,gBAAgB,EACxB,IAAI,CAAC,EAAE,yBAAyB,GAC9B,UAAU,CAAA;AACb,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,kBAAkB,GAAG,uBAAuB,EACpD,IAAI,CAAC,EAAE,yBAAyB,GAC9B,uBAAuB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@launchdarkly/observability-next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "LaunchDarkly observability and session replay for Next.js. Capture frontend and backend errors, logs, traces, and session replays.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"launchdarkly",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"react": ">=17"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@launchdarkly/observability": "1.2.
|
|
77
|
-
"@launchdarkly/observability-node": "1.
|
|
78
|
-
"@launchdarkly/session-replay": "1.2.
|
|
76
|
+
"@launchdarkly/observability": "1.2.1",
|
|
77
|
+
"@launchdarkly/observability-node": "1.4.0",
|
|
78
|
+
"@launchdarkly/session-replay": "1.2.1",
|
|
79
79
|
"js-cookie": "^3.0.5"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
package/dist/proxy-B6yiPOEG.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";exports.LD_OTLP_ENDPOINT="https://otel.observability.app.launchdarkly.com",exports.LD_PUBLIC_BACKEND_URL="https://pub.observability.app.launchdarkly.com",exports.PROXY_BACKEND_PATH="/highlight-events",exports.PROXY_ENV_FLAG="configureLaunchDarklyProxy";
|
|
2
|
-
//# sourceMappingURL=proxy-B6yiPOEG.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-B6yiPOEG.js","sources":["../src/util/proxy.ts"],"sourcesContent":["/**\n * Shared constants describing the optional same-origin proxy that\n * {@link withLaunchDarklyConfig} sets up and that the client reads. Proxying\n * routes browser telemetry through your own domain so it is not blocked by ad\n * blockers and so that requests share the page's origin.\n */\n\n/** Env var (inlined by Next) signalling that the proxy rewrites are configured. */\nexport const PROXY_ENV_FLAG = 'configureLaunchDarklyProxy'\n\n/** Same-origin path that proxies to the LaunchDarkly events ingest endpoint. */\nexport const PROXY_BACKEND_PATH = '/highlight-events'\n\n/** Public LaunchDarkly endpoints that the proxy rewrites forward to. */\nexport const LD_PUBLIC_BACKEND_URL =\n\t'https://pub.observability.app.launchdarkly.com'\nexport const LD_OTLP_ENDPOINT =\n\t'https://otel.observability.app.launchdarkly.com'\n"],"names":[],"mappings":"sCAiBC,gFAFA,4EAJiC,2CAHJ"}
|
package/dist/proxy-DccSYatN.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-DccSYatN.js","sources":["../src/util/proxy.ts"],"sourcesContent":["/**\n * Shared constants describing the optional same-origin proxy that\n * {@link withLaunchDarklyConfig} sets up and that the client reads. Proxying\n * routes browser telemetry through your own domain so it is not blocked by ad\n * blockers and so that requests share the page's origin.\n */\n\n/** Env var (inlined by Next) signalling that the proxy rewrites are configured. */\nexport const PROXY_ENV_FLAG = 'configureLaunchDarklyProxy'\n\n/** Same-origin path that proxies to the LaunchDarkly events ingest endpoint. */\nexport const PROXY_BACKEND_PATH = '/highlight-events'\n\n/** Public LaunchDarkly endpoints that the proxy rewrites forward to. */\nexport const LD_PUBLIC_BACKEND_URL =\n\t'https://pub.observability.app.launchdarkly.com'\nexport const LD_OTLP_ENDPOINT =\n\t'https://otel.observability.app.launchdarkly.com'\n"],"names":["PROXY_ENV_FLAG","PROXY_BACKEND_PATH","LD_PUBLIC_BACKEND_URL","LD_OTLP_ENDPOINT"],"mappings":"AAQO,MAAMA,EAAiB,6BAGjBC,EAAqB,oBAGrBC,EACZ,iDACYC,EACZ"}
|