@interfere/types 10.1.2 → 10.2.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/dist/data/frame.cjs +1 -1
- package/dist/data/frame.d.cts +6 -7
- package/dist/data/frame.d.mts +6 -7
- package/dist/data/frame.mjs +1 -1
- package/dist/data/session.cjs +1 -1
- package/dist/data/session.d.cts +3 -4
- package/dist/data/session.d.mts +3 -4
- package/dist/data/session.mjs +1 -1
- package/dist/data/source-map-batch.cjs +1 -0
- package/dist/data/source-map-batch.d.cts +4 -0
- package/dist/data/source-map-batch.d.mts +4 -0
- package/dist/data/source-map-batch.mjs +1 -0
- package/dist/data/source-map-diagnostics.cjs +1 -0
- package/dist/data/source-map-diagnostics.d.cts +49 -0
- package/dist/data/source-map-diagnostics.d.mts +49 -0
- package/dist/data/source-map-diagnostics.mjs +1 -0
- package/dist/data/source-map-status.cjs +1 -0
- package/dist/data/source-map-status.d.cts +65 -0
- package/dist/data/source-map-status.d.mts +65 -0
- package/dist/data/source-map-status.mjs +1 -0
- package/dist/data/source-map-upload-batch.cjs +1 -0
- package/dist/data/source-map-upload-batch.d.cts +22 -0
- package/dist/data/source-map-upload-batch.d.mts +22 -0
- package/dist/data/source-map-upload-batch.mjs +1 -0
- package/dist/data/source-maps.cjs +1 -1
- package/dist/data/source-maps.d.cts +73 -63
- package/dist/data/source-maps.d.mts +73 -63
- package/dist/data/source-maps.mjs +1 -1
- package/dist/events/error.cjs +1 -1
- package/dist/events/error.d.cts +118 -111
- package/dist/events/error.d.mts +118 -111
- package/dist/events/error.mjs +1 -1
- package/dist/events/pageleave.cjs +1 -1
- package/dist/events/pageleave.d.cts +5 -6
- package/dist/events/pageleave.d.mts +5 -6
- package/dist/events/pageleave.mjs +1 -1
- package/dist/events/pageview.cjs +1 -1
- package/dist/events/pageview.d.cts +6 -7
- package/dist/events/pageview.d.mts +6 -7
- package/dist/events/pageview.mjs +1 -1
- package/dist/integrations/index.cjs +1 -1
- package/dist/integrations/index.d.cts +62 -63
- package/dist/integrations/index.d.mts +62 -63
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/platforms/cli.cjs +1 -1
- package/dist/integrations/platforms/cli.d.cts +3 -4
- package/dist/integrations/platforms/cli.d.mts +3 -4
- package/dist/integrations/platforms/cli.mjs +1 -1
- package/dist/integrations/platforms/cloudflare.cjs +1 -1
- package/dist/integrations/platforms/cloudflare.d.cts +12 -13
- package/dist/integrations/platforms/cloudflare.d.mts +12 -13
- package/dist/integrations/platforms/cloudflare.mjs +1 -1
- package/dist/integrations/platforms/github.cjs +1 -1
- package/dist/integrations/platforms/github.d.cts +30 -31
- package/dist/integrations/platforms/github.d.mts +30 -31
- package/dist/integrations/platforms/github.mjs +1 -1
- package/dist/integrations/platforms/slack.cjs +1 -1
- package/dist/integrations/platforms/slack.d.cts +7 -8
- package/dist/integrations/platforms/slack.d.mts +7 -8
- package/dist/integrations/platforms/slack.mjs +1 -1
- package/dist/integrations/platforms/vercel.cjs +1 -1
- package/dist/integrations/platforms/vercel.d.cts +12 -13
- package/dist/integrations/platforms/vercel.d.mts +12 -13
- package/dist/integrations/platforms/vercel.mjs +1 -1
- package/dist/releases/build-telemetry.d.cts +8 -9
- package/dist/releases/build-telemetry.d.mts +8 -9
- package/dist/releases/definition.cjs +1 -1
- package/dist/releases/definition.d.cts +48 -49
- package/dist/releases/definition.d.mts +48 -49
- package/dist/releases/definition.mjs +1 -1
- package/dist/releases/slug.d.cts +5 -6
- package/dist/releases/slug.d.mts +5 -6
- package/dist/sdk/build-config.cjs +1 -0
- package/dist/sdk/build-config.d.cts +22 -0
- package/dist/sdk/build-config.d.mts +22 -0
- package/dist/sdk/build-config.mjs +1 -0
- package/dist/sdk/build-diagnostics.cjs +1 -1
- package/dist/sdk/build-diagnostics.d.cts +11 -12
- package/dist/sdk/build-diagnostics.d.mts +11 -12
- package/dist/sdk/build-diagnostics.mjs +1 -1
- package/dist/sdk/cli-destination.cjs +1 -1
- package/dist/sdk/cli-destination.d.cts +7 -4
- package/dist/sdk/cli-destination.d.mts +7 -4
- package/dist/sdk/cli-destination.mjs +1 -1
- package/dist/sdk/deploy-environment.cjs +1 -1
- package/dist/sdk/deploy-environment.d.cts +28 -6
- package/dist/sdk/deploy-environment.d.mts +28 -6
- package/dist/sdk/deploy-environment.mjs +1 -1
- package/dist/sdk/env.d.cts +3 -4
- package/dist/sdk/env.d.mts +3 -4
- package/dist/sdk/envelope.cjs +1 -1
- package/dist/sdk/envelope.d.cts +129 -130
- package/dist/sdk/envelope.d.mts +129 -130
- package/dist/sdk/envelope.mjs +1 -1
- package/dist/sdk/errors.cjs +2 -2
- package/dist/sdk/errors.d.cts +70 -28
- package/dist/sdk/errors.d.mts +70 -28
- package/dist/sdk/errors.mjs +2 -2
- package/dist/sdk/geo.cjs +1 -1
- package/dist/sdk/geo.d.cts +4 -5
- package/dist/sdk/geo.d.mts +4 -5
- package/dist/sdk/geo.mjs +1 -1
- package/dist/sdk/github-source.cjs +1 -1
- package/dist/sdk/github-source.d.cts +9 -9
- package/dist/sdk/github-source.d.mts +9 -9
- package/dist/sdk/github-source.mjs +1 -1
- package/dist/sdk/identify.cjs +1 -1
- package/dist/sdk/identify.d.cts +13 -14
- package/dist/sdk/identify.d.mts +13 -14
- package/dist/sdk/identify.mjs +1 -1
- package/dist/sdk/injected-globals.d.cts +9 -10
- package/dist/sdk/injected-globals.d.mts +9 -10
- package/dist/sdk/log-sourcing.cjs +1 -1
- package/dist/sdk/log-sourcing.d.cts +9 -10
- package/dist/sdk/log-sourcing.d.mts +9 -10
- package/dist/sdk/log-sourcing.mjs +1 -1
- package/dist/sdk/plugins/context/browser.cjs +1 -1
- package/dist/sdk/plugins/context/browser.d.cts +17 -18
- package/dist/sdk/plugins/context/browser.d.mts +17 -18
- package/dist/sdk/plugins/context/browser.mjs +1 -1
- package/dist/sdk/plugins/context/edge.cjs +1 -1
- package/dist/sdk/plugins/context/edge.d.cts +3 -4
- package/dist/sdk/plugins/context/edge.d.mts +3 -4
- package/dist/sdk/plugins/context/edge.mjs +1 -1
- package/dist/sdk/plugins/context/next.cjs +1 -1
- package/dist/sdk/plugins/context/next.d.cts +8 -9
- package/dist/sdk/plugins/context/next.d.mts +8 -9
- package/dist/sdk/plugins/context/next.mjs +1 -1
- package/dist/sdk/plugins/context/node.cjs +1 -1
- package/dist/sdk/plugins/context/node.d.cts +3 -4
- package/dist/sdk/plugins/context/node.d.mts +3 -4
- package/dist/sdk/plugins/context/node.mjs +1 -1
- package/dist/sdk/plugins/manifest.d.cts +10 -9
- package/dist/sdk/plugins/manifest.d.mts +10 -9
- package/dist/sdk/plugins/payload/errors.cjs +1 -1
- package/dist/sdk/plugins/payload/errors.d.cts +23 -24
- package/dist/sdk/plugins/payload/errors.d.mts +23 -24
- package/dist/sdk/plugins/payload/errors.mjs +1 -1
- package/dist/sdk/plugins/payload/page-events.cjs +1 -1
- package/dist/sdk/plugins/payload/page-events.d.cts +9 -10
- package/dist/sdk/plugins/payload/page-events.d.mts +9 -10
- package/dist/sdk/plugins/payload/page-events.mjs +1 -1
- package/dist/sdk/plugins/payload/rage-click.cjs +1 -1
- package/dist/sdk/plugins/payload/rage-click.d.cts +5 -6
- package/dist/sdk/plugins/payload/rage-click.d.mts +5 -6
- package/dist/sdk/plugins/payload/rage-click.mjs +1 -1
- package/dist/sdk/plugins/payload/replay.cjs +1 -1
- package/dist/sdk/plugins/payload/replay.d.cts +4 -5
- package/dist/sdk/plugins/payload/replay.d.mts +4 -5
- package/dist/sdk/plugins/payload/replay.mjs +1 -1
- package/dist/sdk/remote-config.cjs +1 -1
- package/dist/sdk/remote-config.d.cts +43 -20
- package/dist/sdk/remote-config.d.mts +43 -20
- package/dist/sdk/remote-config.mjs +1 -1
- package/dist/sdk/runtime.cjs +1 -1
- package/dist/sdk/runtime.d.cts +11 -12
- package/dist/sdk/runtime.d.mts +11 -12
- package/dist/sdk/runtime.mjs +1 -1
- package/dist/sdk/server-tracing.cjs +1 -1
- package/dist/sdk/server-tracing.d.cts +9 -10
- package/dist/sdk/server-tracing.d.mts +9 -10
- package/dist/sdk/server-tracing.mjs +1 -1
- package/dist/sdk/source-map-richness.cjs +1 -0
- package/dist/sdk/source-map-richness.d.cts +9 -0
- package/dist/sdk/source-map-richness.d.mts +9 -0
- package/dist/sdk/source-map-richness.mjs +1 -0
- package/dist/sdk/trace-freshness.cjs +1 -0
- package/dist/sdk/trace-freshness.d.cts +6 -0
- package/dist/sdk/trace-freshness.d.mts +6 -0
- package/dist/sdk/trace-freshness.mjs +1 -0
- package/package.json +13 -13
package/dist/sdk/runtime.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
//#region src/sdk/runtime.d.ts
|
|
3
|
-
declare const envSchema: z.ZodNullable<z.ZodString>;
|
|
4
|
-
type Env = z.infer<typeof envSchema>;
|
|
3
|
+
export declare const envSchema: z.ZodNullable<z.ZodString>;
|
|
4
|
+
export type Env = z.infer<typeof envSchema>;
|
|
5
5
|
/**
|
|
6
6
|
* Fallback environment when nothing is configured. `development` (not
|
|
7
7
|
* `production`, which is what Sentry defaults to) because the collector has
|
|
@@ -10,7 +10,7 @@ type Env = z.infer<typeof envSchema>;
|
|
|
10
10
|
* label keeps local noise out of product data. A real deploy sets one of the
|
|
11
11
|
* higher-precedence signals below.
|
|
12
12
|
*/
|
|
13
|
-
declare const DEFAULT_ENVIRONMENT = "development";
|
|
13
|
+
export declare const DEFAULT_ENVIRONMENT = "development";
|
|
14
14
|
/**
|
|
15
15
|
* Resolve the deployment environment using a precedence chain modelled on
|
|
16
16
|
* Sentry's: an explicit value (init option) wins, then a dedicated
|
|
@@ -21,24 +21,23 @@ declare const DEFAULT_ENVIRONMENT = "development";
|
|
|
21
21
|
* and prod all ship `NODE_ENV=production`), not a deploy-environment
|
|
22
22
|
* identifier. The dedicated var is the real abstraction.
|
|
23
23
|
*/
|
|
24
|
-
declare function resolveEnvironment(opts?: {
|
|
24
|
+
export declare function resolveEnvironment(opts?: {
|
|
25
25
|
readonly explicit?: string | null | undefined;
|
|
26
26
|
readonly env?: Record<string, string | undefined>;
|
|
27
27
|
}): string;
|
|
28
|
-
declare const runtimeSchema: z.ZodNullable<z.ZodEnum<{
|
|
28
|
+
export declare const runtimeSchema: z.ZodNullable<z.ZodEnum<{
|
|
29
29
|
browser: "browser";
|
|
30
30
|
edge: "edge";
|
|
31
31
|
node: "node";
|
|
32
32
|
}>>;
|
|
33
|
-
type Runtime = z.infer<typeof runtimeSchema>;
|
|
33
|
+
export type Runtime = z.infer<typeof runtimeSchema>;
|
|
34
34
|
/**
|
|
35
35
|
* `process.env` when the runtime provides it, `undefined` otherwise. Accessed
|
|
36
36
|
* structurally via `globalThis` so callers never need `@types/node`.
|
|
37
37
|
*/
|
|
38
|
-
declare function readProcessEnv(): Record<string, string | undefined> | undefined;
|
|
39
|
-
declare function inferRuntime(options?: {
|
|
38
|
+
export declare function readProcessEnv(): Record<string, string | undefined> | undefined;
|
|
39
|
+
export declare function inferRuntime(options?: {
|
|
40
40
|
readonly nextRuntime?: unknown;
|
|
41
|
-
}):
|
|
42
|
-
declare function normalizeEnv(value: unknown): string | null;
|
|
43
|
-
//#endregion
|
|
44
|
-
export { DEFAULT_ENVIRONMENT, Env, Runtime, envSchema, inferRuntime, normalizeEnv, readProcessEnv, resolveEnvironment, runtimeSchema };
|
|
41
|
+
}): "browser" | "edge" | "node" | null;
|
|
42
|
+
export declare function normalizeEnv(value: unknown): string | null;
|
|
43
|
+
//#endregion
|
package/dist/sdk/runtime.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
//#region src/sdk/runtime.d.ts
|
|
3
|
-
declare const envSchema: z.ZodNullable<z.ZodString>;
|
|
4
|
-
type Env = z.infer<typeof envSchema>;
|
|
3
|
+
export declare const envSchema: z.ZodNullable<z.ZodString>;
|
|
4
|
+
export type Env = z.infer<typeof envSchema>;
|
|
5
5
|
/**
|
|
6
6
|
* Fallback environment when nothing is configured. `development` (not
|
|
7
7
|
* `production`, which is what Sentry defaults to) because the collector has
|
|
@@ -10,7 +10,7 @@ type Env = z.infer<typeof envSchema>;
|
|
|
10
10
|
* label keeps local noise out of product data. A real deploy sets one of the
|
|
11
11
|
* higher-precedence signals below.
|
|
12
12
|
*/
|
|
13
|
-
declare const DEFAULT_ENVIRONMENT = "development";
|
|
13
|
+
export declare const DEFAULT_ENVIRONMENT = "development";
|
|
14
14
|
/**
|
|
15
15
|
* Resolve the deployment environment using a precedence chain modelled on
|
|
16
16
|
* Sentry's: an explicit value (init option) wins, then a dedicated
|
|
@@ -21,24 +21,23 @@ declare const DEFAULT_ENVIRONMENT = "development";
|
|
|
21
21
|
* and prod all ship `NODE_ENV=production`), not a deploy-environment
|
|
22
22
|
* identifier. The dedicated var is the real abstraction.
|
|
23
23
|
*/
|
|
24
|
-
declare function resolveEnvironment(opts?: {
|
|
24
|
+
export declare function resolveEnvironment(opts?: {
|
|
25
25
|
readonly explicit?: string | null | undefined;
|
|
26
26
|
readonly env?: Record<string, string | undefined>;
|
|
27
27
|
}): string;
|
|
28
|
-
declare const runtimeSchema: z.ZodNullable<z.ZodEnum<{
|
|
28
|
+
export declare const runtimeSchema: z.ZodNullable<z.ZodEnum<{
|
|
29
29
|
browser: "browser";
|
|
30
30
|
edge: "edge";
|
|
31
31
|
node: "node";
|
|
32
32
|
}>>;
|
|
33
|
-
type Runtime = z.infer<typeof runtimeSchema>;
|
|
33
|
+
export type Runtime = z.infer<typeof runtimeSchema>;
|
|
34
34
|
/**
|
|
35
35
|
* `process.env` when the runtime provides it, `undefined` otherwise. Accessed
|
|
36
36
|
* structurally via `globalThis` so callers never need `@types/node`.
|
|
37
37
|
*/
|
|
38
|
-
declare function readProcessEnv(): Record<string, string | undefined> | undefined;
|
|
39
|
-
declare function inferRuntime(options?: {
|
|
38
|
+
export declare function readProcessEnv(): Record<string, string | undefined> | undefined;
|
|
39
|
+
export declare function inferRuntime(options?: {
|
|
40
40
|
readonly nextRuntime?: unknown;
|
|
41
|
-
}):
|
|
42
|
-
declare function normalizeEnv(value: unknown): string | null;
|
|
43
|
-
//#endregion
|
|
44
|
-
export { DEFAULT_ENVIRONMENT, Env, Runtime, envSchema, inferRuntime, normalizeEnv, readProcessEnv, resolveEnvironment, runtimeSchema };
|
|
41
|
+
}): "browser" | "edge" | "node" | null;
|
|
42
|
+
export declare function normalizeEnv(value: unknown): string | null;
|
|
43
|
+
//#endregion
|
package/dist/sdk/runtime.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"zod";const envSchema=z.string().min(1).nullable().meta({
|
|
1
|
+
import{z}from"zod";const envSchema=z.string().min(1).nullable().meta({description:"Deployment environment the SDK is running in. Free-form label (e.g. `production`, `preview`, `staging`, `development`).",id:`Environment`,title:`Environment`}),DEFAULT_ENVIRONMENT=`development`,ENVIRONMENT_ENV_VARS=[`INTERFERE_ENVIRONMENT`,`VERCEL_ENV`,`NODE_ENV`];function resolveEnvironment(opts){let env=opts?.env??{},explicit=normalizeEnv(opts?.explicit);if(explicit)return explicit;for(let key of ENVIRONMENT_ENV_VARS){let value=normalizeEnv(env[key]);if(value)return value}return DEFAULT_ENVIRONMENT}const runtimeSchema=z.enum([`browser`,`node`,`edge`]).nullable().meta({description:`JavaScript runtime the SDK is running in.`,id:`Runtime`,title:`Runtime`}),globalScope=globalThis;function readProcessEnv(){return globalScope.process?.env}function inferRuntime(options){return globalScope.window!==void 0&&globalScope.document!==void 0&&globalScope.navigator!==void 0?`browser`:typeof globalScope.EdgeRuntime==`string`||options?.nextRuntime===`edge`?`edge`:typeof globalScope.process?.versions?.node==`string`?`node`:null}function normalizeEnv(value){if(typeof value!=`string`)return null;let env=value.trim().toLowerCase();return env.length>0?env:null}export{DEFAULT_ENVIRONMENT,envSchema,inferRuntime,normalizeEnv,readProcessEnv,resolveEnvironment,runtimeSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_sdk_runtime=require("./runtime.cjs");let zod=require("zod");const SERVER_TRACING_ENV_VAR=`INTERFERE_SERVER_TRACING`,SERVER_TRACING_GLOBAL=`__INTERFERE_SERVER_TRACING__`,serverTracingModeSchema=zod.z.enum([`full`,`drain`]),DEFAULT_SERVER_TRACING_MODE=`full`;function resolveServerTracingMode(opts){let injected=serverTracingModeSchema.safeParse(require_sdk_runtime.normalizeEnv(opts?.injected));if(injected.success)return injected.data;let fromEnv=serverTracingModeSchema.safeParse(require_sdk_runtime.normalizeEnv(opts?.env?.[SERVER_TRACING_ENV_VAR]));return fromEnv.success?fromEnv.data:DEFAULT_SERVER_TRACING_MODE}function readServerTracingMode(env=require_sdk_runtime.readProcessEnv()){let
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_sdk_runtime=require("./runtime.cjs");let zod=require("zod");const SERVER_TRACING_ENV_VAR=`INTERFERE_SERVER_TRACING`,SERVER_TRACING_GLOBAL=`__INTERFERE_SERVER_TRACING__`,serverTracingModeSchema=zod.z.enum([`full`,`drain`]),DEFAULT_SERVER_TRACING_MODE=`full`;function resolveServerTracingMode(opts){let injected=serverTracingModeSchema.safeParse(require_sdk_runtime.normalizeEnv(opts?.injected));if(injected.success)return injected.data;let fromEnv=serverTracingModeSchema.safeParse(require_sdk_runtime.normalizeEnv(opts?.env?.[SERVER_TRACING_ENV_VAR]));return fromEnv.success?fromEnv.data:DEFAULT_SERVER_TRACING_MODE}function readServerTracingMode(env=require_sdk_runtime.readProcessEnv()){let scope=globalThis,injected=`__INTERFERE_SERVER_TRACING__`in scope?scope[SERVER_TRACING_GLOBAL]:void 0;return resolveServerTracingMode({env,injected:typeof injected==`string`?injected:void 0})}exports.DEFAULT_SERVER_TRACING_MODE=DEFAULT_SERVER_TRACING_MODE,exports.SERVER_TRACING_ENV_VAR=SERVER_TRACING_ENV_VAR,exports.SERVER_TRACING_GLOBAL=SERVER_TRACING_GLOBAL,exports.readServerTracingMode=readServerTracingMode,exports.resolveServerTracingMode=resolveServerTracingMode,exports.serverTracingModeSchema=serverTracingModeSchema;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
//#region src/sdk/server-tracing.d.ts
|
|
3
|
-
declare const SERVER_TRACING_ENV_VAR = "INTERFERE_SERVER_TRACING";
|
|
3
|
+
export declare const SERVER_TRACING_ENV_VAR = "INTERFERE_SERVER_TRACING";
|
|
4
4
|
/**
|
|
5
5
|
* Global stamped into the server bundle at build time (via `withInterfere`'s
|
|
6
6
|
* value-injection loader) from the surface's remote config. Read at cold
|
|
7
7
|
* start so the mode is known synchronously, before instrumentation registers.
|
|
8
8
|
*/
|
|
9
|
-
declare const SERVER_TRACING_GLOBAL = "__INTERFERE_SERVER_TRACING__";
|
|
10
|
-
declare const serverTracingModeSchema: z.ZodEnum<{
|
|
9
|
+
export declare const SERVER_TRACING_GLOBAL = "__INTERFERE_SERVER_TRACING__";
|
|
10
|
+
export declare const serverTracingModeSchema: z.ZodEnum<{
|
|
11
11
|
drain: "drain";
|
|
12
12
|
full: "full";
|
|
13
13
|
}>;
|
|
@@ -20,22 +20,21 @@ declare const serverTracingModeSchema: z.ZodEnum<{
|
|
|
20
20
|
* server/edge traces to a platform trace drain, removing the per-fetch span
|
|
21
21
|
* creation from the request hot path.
|
|
22
22
|
*/
|
|
23
|
-
type ServerTracingMode = z.infer<typeof serverTracingModeSchema>;
|
|
24
|
-
declare const DEFAULT_SERVER_TRACING_MODE = "full";
|
|
23
|
+
export type ServerTracingMode = z.infer<typeof serverTracingModeSchema>;
|
|
24
|
+
export declare const DEFAULT_SERVER_TRACING_MODE = "full";
|
|
25
25
|
/**
|
|
26
26
|
* Resolve the server tracing mode: the build-injected value wins, then the
|
|
27
27
|
* `INTERFERE_SERVER_TRACING` env var, then {@link DEFAULT_SERVER_TRACING_MODE}.
|
|
28
28
|
* Unrecognised values fall through to the next source.
|
|
29
29
|
*/
|
|
30
|
-
declare function resolveServerTracingMode(opts?: {
|
|
30
|
+
export declare function resolveServerTracingMode(opts?: {
|
|
31
31
|
readonly injected?: string | null | undefined;
|
|
32
32
|
readonly env?: Record<string, string | undefined> | undefined;
|
|
33
|
-
}):
|
|
33
|
+
}): "drain" | "full";
|
|
34
34
|
/**
|
|
35
35
|
* Server-runtime convenience over {@link resolveServerTracingMode}: reads the
|
|
36
36
|
* build-injected {@link SERVER_TRACING_GLOBAL} global and falls back to
|
|
37
37
|
* `process.env`. Zero-touch — no code option required.
|
|
38
38
|
*/
|
|
39
|
-
declare function readServerTracingMode(env?: Record<string, string | undefined> | undefined):
|
|
40
|
-
//#endregion
|
|
41
|
-
export { DEFAULT_SERVER_TRACING_MODE, SERVER_TRACING_ENV_VAR, SERVER_TRACING_GLOBAL, ServerTracingMode, readServerTracingMode, resolveServerTracingMode, serverTracingModeSchema };
|
|
39
|
+
export declare function readServerTracingMode(env?: Record<string, string | undefined> | undefined): "drain" | "full";
|
|
40
|
+
//#endregion
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
//#region src/sdk/server-tracing.d.ts
|
|
3
|
-
declare const SERVER_TRACING_ENV_VAR = "INTERFERE_SERVER_TRACING";
|
|
3
|
+
export declare const SERVER_TRACING_ENV_VAR = "INTERFERE_SERVER_TRACING";
|
|
4
4
|
/**
|
|
5
5
|
* Global stamped into the server bundle at build time (via `withInterfere`'s
|
|
6
6
|
* value-injection loader) from the surface's remote config. Read at cold
|
|
7
7
|
* start so the mode is known synchronously, before instrumentation registers.
|
|
8
8
|
*/
|
|
9
|
-
declare const SERVER_TRACING_GLOBAL = "__INTERFERE_SERVER_TRACING__";
|
|
10
|
-
declare const serverTracingModeSchema: z.ZodEnum<{
|
|
9
|
+
export declare const SERVER_TRACING_GLOBAL = "__INTERFERE_SERVER_TRACING__";
|
|
10
|
+
export declare const serverTracingModeSchema: z.ZodEnum<{
|
|
11
11
|
drain: "drain";
|
|
12
12
|
full: "full";
|
|
13
13
|
}>;
|
|
@@ -20,22 +20,21 @@ declare const serverTracingModeSchema: z.ZodEnum<{
|
|
|
20
20
|
* server/edge traces to a platform trace drain, removing the per-fetch span
|
|
21
21
|
* creation from the request hot path.
|
|
22
22
|
*/
|
|
23
|
-
type ServerTracingMode = z.infer<typeof serverTracingModeSchema>;
|
|
24
|
-
declare const DEFAULT_SERVER_TRACING_MODE = "full";
|
|
23
|
+
export type ServerTracingMode = z.infer<typeof serverTracingModeSchema>;
|
|
24
|
+
export declare const DEFAULT_SERVER_TRACING_MODE = "full";
|
|
25
25
|
/**
|
|
26
26
|
* Resolve the server tracing mode: the build-injected value wins, then the
|
|
27
27
|
* `INTERFERE_SERVER_TRACING` env var, then {@link DEFAULT_SERVER_TRACING_MODE}.
|
|
28
28
|
* Unrecognised values fall through to the next source.
|
|
29
29
|
*/
|
|
30
|
-
declare function resolveServerTracingMode(opts?: {
|
|
30
|
+
export declare function resolveServerTracingMode(opts?: {
|
|
31
31
|
readonly injected?: string | null | undefined;
|
|
32
32
|
readonly env?: Record<string, string | undefined> | undefined;
|
|
33
|
-
}):
|
|
33
|
+
}): "drain" | "full";
|
|
34
34
|
/**
|
|
35
35
|
* Server-runtime convenience over {@link resolveServerTracingMode}: reads the
|
|
36
36
|
* build-injected {@link SERVER_TRACING_GLOBAL} global and falls back to
|
|
37
37
|
* `process.env`. Zero-touch — no code option required.
|
|
38
38
|
*/
|
|
39
|
-
declare function readServerTracingMode(env?: Record<string, string | undefined> | undefined):
|
|
40
|
-
//#endregion
|
|
41
|
-
export { DEFAULT_SERVER_TRACING_MODE, SERVER_TRACING_ENV_VAR, SERVER_TRACING_GLOBAL, ServerTracingMode, readServerTracingMode, resolveServerTracingMode, serverTracingModeSchema };
|
|
39
|
+
export declare function readServerTracingMode(env?: Record<string, string | undefined> | undefined): "drain" | "full";
|
|
40
|
+
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{normalizeEnv,readProcessEnv}from"./runtime.mjs";import{z}from"zod";const SERVER_TRACING_ENV_VAR=`INTERFERE_SERVER_TRACING`,SERVER_TRACING_GLOBAL=`__INTERFERE_SERVER_TRACING__`,serverTracingModeSchema=z.enum([`full`,`drain`]),DEFAULT_SERVER_TRACING_MODE=`full`;function resolveServerTracingMode(opts){let injected=serverTracingModeSchema.safeParse(normalizeEnv(opts?.injected));if(injected.success)return injected.data;let fromEnv=serverTracingModeSchema.safeParse(normalizeEnv(opts?.env?.[SERVER_TRACING_ENV_VAR]));return fromEnv.success?fromEnv.data:DEFAULT_SERVER_TRACING_MODE}function readServerTracingMode(env=readProcessEnv()){let
|
|
1
|
+
import{normalizeEnv,readProcessEnv}from"./runtime.mjs";import{z}from"zod";const SERVER_TRACING_ENV_VAR=`INTERFERE_SERVER_TRACING`,SERVER_TRACING_GLOBAL=`__INTERFERE_SERVER_TRACING__`,serverTracingModeSchema=z.enum([`full`,`drain`]),DEFAULT_SERVER_TRACING_MODE=`full`;function resolveServerTracingMode(opts){let injected=serverTracingModeSchema.safeParse(normalizeEnv(opts?.injected));if(injected.success)return injected.data;let fromEnv=serverTracingModeSchema.safeParse(normalizeEnv(opts?.env?.[SERVER_TRACING_ENV_VAR]));return fromEnv.success?fromEnv.data:DEFAULT_SERVER_TRACING_MODE}function readServerTracingMode(env=readProcessEnv()){let scope=globalThis,injected=`__INTERFERE_SERVER_TRACING__`in scope?scope[SERVER_TRACING_GLOBAL]:void 0;return resolveServerTracingMode({env,injected:typeof injected==`string`?injected:void 0})}export{DEFAULT_SERVER_TRACING_MODE,SERVER_TRACING_ENV_VAR,SERVER_TRACING_GLOBAL,readServerTracingMode,resolveServerTracingMode,serverTracingModeSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const EMPTY_RICHNESS={hasSourcesContent:!1,hasNames:!1,hasFile:!1,mappingsPresent:!1};function leafRichness(map){let sourcesContent=`sourcesContent`in map?map.sourcesContent:void 0,names=`names`in map?map.names:void 0,file=`file`in map?map.file:void 0,mappings=`mappings`in map?map.mappings:void 0;return{hasSourcesContent:Array.isArray(sourcesContent)&&sourcesContent.length>0,hasNames:Array.isArray(names)&&names.length>0,hasFile:typeof file==`string`&&file.length>0,mappingsPresent:typeof mappings==`string`&&mappings.length>0}}function extractRichness(content){let parsed;try{parsed=JSON.parse(content)}catch{return EMPTY_RICHNESS}if(!(typeof parsed==`object`&&parsed))return EMPTY_RICHNESS;let sections=`sections`in parsed?parsed.sections:void 0;if(!Array.isArray(sections))return leafRichness(parsed);let merged={hasSourcesContent:!1,hasNames:!1,hasFile:`file`in parsed&&typeof parsed.file==`string`&&parsed.file.length>0,mappingsPresent:!1},indexedSections=sections;for(let section of indexedSections){if(typeof section!=`object`||!section||!(`map`in section))continue;let inner=section.map;if(!(typeof inner==`object`&&inner))continue;let r=leafRichness(inner);merged.hasSourcesContent||=r.hasSourcesContent,merged.hasNames||=r.hasNames,merged.mappingsPresent||=r.mappingsPresent}return merged}exports.extractRichness=extractRichness;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/sdk/source-map-richness.d.ts
|
|
2
|
+
interface SourceMapRichness {
|
|
3
|
+
hasSourcesContent: boolean;
|
|
4
|
+
hasNames: boolean;
|
|
5
|
+
hasFile: boolean;
|
|
6
|
+
mappingsPresent: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function extractRichness(content: string): SourceMapRichness;
|
|
9
|
+
//#endregion
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/sdk/source-map-richness.d.ts
|
|
2
|
+
interface SourceMapRichness {
|
|
3
|
+
hasSourcesContent: boolean;
|
|
4
|
+
hasNames: boolean;
|
|
5
|
+
hasFile: boolean;
|
|
6
|
+
mappingsPresent: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function extractRichness(content: string): SourceMapRichness;
|
|
9
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const EMPTY_RICHNESS={hasSourcesContent:!1,hasNames:!1,hasFile:!1,mappingsPresent:!1};function leafRichness(map){let sourcesContent=`sourcesContent`in map?map.sourcesContent:void 0,names=`names`in map?map.names:void 0,file=`file`in map?map.file:void 0,mappings=`mappings`in map?map.mappings:void 0;return{hasSourcesContent:Array.isArray(sourcesContent)&&sourcesContent.length>0,hasNames:Array.isArray(names)&&names.length>0,hasFile:typeof file==`string`&&file.length>0,mappingsPresent:typeof mappings==`string`&&mappings.length>0}}function extractRichness(content){let parsed;try{parsed=JSON.parse(content)}catch{return EMPTY_RICHNESS}if(!(typeof parsed==`object`&&parsed))return EMPTY_RICHNESS;let sections=`sections`in parsed?parsed.sections:void 0;if(!Array.isArray(sections))return leafRichness(parsed);let merged={hasSourcesContent:!1,hasNames:!1,hasFile:`file`in parsed&&typeof parsed.file==`string`&&parsed.file.length>0,mappingsPresent:!1},indexedSections=sections;for(let section of indexedSections){if(typeof section!=`object`||!section||!(`map`in section))continue;let inner=section.map;if(!(typeof inner==`object`&&inner))continue;let r=leafRichness(inner);merged.hasSourcesContent||=r.hasSourcesContent,merged.hasNames||=r.hasNames,merged.mappingsPresent||=r.mappingsPresent}return merged}export{extractRichness};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function freshnessStamp(nowMs){return Math.floor(nowMs/1e3).toString(10)}function isFreshnessStampExpired(stamp,nowMs){let stampedAtSeconds=Number.parseInt(stamp,10);return Number.isFinite(stampedAtSeconds)?nowMs/1e3-stampedAtSeconds>120:!1}exports.TRACEPARENT_MAX_AGE_SECONDS=120,exports.TRACESTATE_FRESHNESS_KEY=`interfere`,exports.freshnessStamp=freshnessStamp,exports.isFreshnessStampExpired=isFreshnessStampExpired;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/sdk/trace-freshness.d.ts
|
|
2
|
+
export declare const TRACESTATE_FRESHNESS_KEY = "interfere";
|
|
3
|
+
export declare const TRACEPARENT_MAX_AGE_SECONDS = 120;
|
|
4
|
+
export declare function freshnessStamp(nowMs: number): string;
|
|
5
|
+
export declare function isFreshnessStampExpired(stamp: string, nowMs: number): boolean;
|
|
6
|
+
//#endregion
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/sdk/trace-freshness.d.ts
|
|
2
|
+
export declare const TRACESTATE_FRESHNESS_KEY = "interfere";
|
|
3
|
+
export declare const TRACEPARENT_MAX_AGE_SECONDS = 120;
|
|
4
|
+
export declare function freshnessStamp(nowMs: number): string;
|
|
5
|
+
export declare function isFreshnessStampExpired(stamp: string, nowMs: number): boolean;
|
|
6
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const TRACESTATE_FRESHNESS_KEY=`interfere`,TRACEPARENT_MAX_AGE_SECONDS=120;function freshnessStamp(nowMs){return Math.floor(nowMs/1e3).toString(10)}function isFreshnessStampExpired(stamp,nowMs){let stampedAtSeconds=Number.parseInt(stamp,10);return Number.isFinite(stampedAtSeconds)?nowMs/1e3-stampedAtSeconds>120:!1}export{TRACEPARENT_MAX_AGE_SECONDS,TRACESTATE_FRESHNESS_KEY,freshnessStamp,isFreshnessStampExpired};
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interfere/types",
|
|
3
|
-
"version": "10.1
|
|
4
|
-
"license": "MIT",
|
|
3
|
+
"version": "10.2.1",
|
|
5
4
|
"description": "TypeScript & Zod types for Interfere",
|
|
6
5
|
"keywords": [
|
|
6
|
+
"logging",
|
|
7
7
|
"observability",
|
|
8
|
-
"typescript"
|
|
9
|
-
"logging"
|
|
8
|
+
"typescript"
|
|
10
9
|
],
|
|
11
10
|
"homepage": "https://interfere.com",
|
|
12
11
|
"bugs": {
|
|
13
12
|
"url": "mailto:support@interfere.com"
|
|
14
13
|
},
|
|
14
|
+
"license": "MIT",
|
|
15
15
|
"author": "Interfere <support@interfere.com> (https://interfere.com)",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
@@ -145,20 +145,20 @@
|
|
|
145
145
|
},
|
|
146
146
|
"scripts": {
|
|
147
147
|
"build": "tsdown",
|
|
148
|
-
"test": "vitest run",
|
|
149
|
-
"typecheck": "
|
|
148
|
+
"test": "vitest run --config ../../../../vitest.config.ts",
|
|
149
|
+
"typecheck": "bun check"
|
|
150
150
|
},
|
|
151
151
|
"dependencies": {
|
|
152
|
-
"zod": "^4.4
|
|
152
|
+
"zod": "^4.5.4"
|
|
153
153
|
},
|
|
154
154
|
"devDependencies": {
|
|
155
|
-
"@interfere/
|
|
156
|
-
"@interfere/test-utils": "^9.1.2",
|
|
155
|
+
"@interfere/test-utils": "^10.0.0",
|
|
157
156
|
"@interfere/typescript-config": "^9.0.2",
|
|
158
|
-
"@
|
|
159
|
-
"@
|
|
160
|
-
"
|
|
157
|
+
"@interfere/vitest-config": "0.0.0",
|
|
158
|
+
"@types/node": "^26.4.1",
|
|
159
|
+
"@vitest/coverage-v8": "5.0.1",
|
|
160
|
+
"tsdown": "^0.23.0",
|
|
161
161
|
"typescript": "^7.0.2",
|
|
162
|
-
"vitest": "
|
|
162
|
+
"vitest": "5.0.1"
|
|
163
163
|
}
|
|
164
164
|
}
|