@interfere/types 10.4.0 → 10.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_sdk_runtime=require("./runtime.cjs");let zod=require("zod");const LOG_SOURCING_ENV_VAR=`INTERFERE_LOG_SOURCING`,LOG_SOURCING_GLOBAL=`__INTERFERE_LOG_SOURCING__`,logSourcingModeSchema=zod.z.enum([`sdk`,`drain`]);function resolveLogSourcingMode(opts){let injected=logSourcingModeSchema.safeParse(require_sdk_runtime.normalizeEnv(opts?.injected));if(injected.success)return injected.data;let fromEnv=logSourcingModeSchema.safeParse(require_sdk_runtime.normalizeEnv(opts?.env?.[LOG_SOURCING_ENV_VAR]));return fromEnv.success?fromEnv.data:`sdk`}function readLogSourcingMode(env=require_sdk_runtime.readProcessEnv()){let scope=globalThis,injected=`__INTERFERE_LOG_SOURCING__`in scope?scope[LOG_SOURCING_GLOBAL]:void 0;return resolveLogSourcingMode({env,injected:typeof injected==`string`?injected:void 0})}exports.DEFAULT_LOG_SOURCING_MODE=`sdk`,exports.LOG_SOURCING_ENV_VAR=LOG_SOURCING_ENV_VAR,exports.LOG_SOURCING_GLOBAL=LOG_SOURCING_GLOBAL,exports.logSourcingModeSchema=logSourcingModeSchema,exports.readLogSourcingMode=readLogSourcingMode,exports.resolveLogSourcingMode=resolveLogSourcingMode;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_sdk_runtime=require("./runtime.cjs");let zod=require("zod");const LOG_SOURCING_GLOBAL=`__INTERFERE_LOG_SOURCING__`,logSourcingModeSchema=zod.z.enum([`sdk`,`drain`]);function resolveLogSourcingMode(injected){let parsed=logSourcingModeSchema.safeParse(require_sdk_runtime.normalizeEnv(injected));return parsed.success?parsed.data:`sdk`}function readLogSourcingMode(){let scope=globalThis;return resolveLogSourcingMode(`__INTERFERE_LOG_SOURCING__`in scope?scope[LOG_SOURCING_GLOBAL]:void 0)}exports.DEFAULT_LOG_SOURCING_MODE=`sdk`,exports.LOG_SOURCING_GLOBAL=LOG_SOURCING_GLOBAL,exports.logSourcingModeSchema=logSourcingModeSchema,exports.readLogSourcingMode=readLogSourcingMode,exports.resolveLogSourcingMode=resolveLogSourcingMode;
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  //#region src/sdk/log-sourcing.d.ts
3
- export declare const LOG_SOURCING_ENV_VAR = "INTERFERE_LOG_SOURCING";
4
3
  /**
5
4
  * Global stamped into the server bundle at build time (via `withInterfere`'s
6
5
  * value-injection loader) from the surface's remote config. Read at cold
@@ -23,9 +22,8 @@ export declare const logSourcingModeSchema: z.ZodEnum<{
23
22
  */
24
23
  export type LogSourcingMode = z.infer<typeof logSourcingModeSchema>;
25
24
  export declare const DEFAULT_LOG_SOURCING_MODE = "sdk";
26
- export declare function resolveLogSourcingMode(opts?: {
27
- readonly injected?: string | null | undefined;
28
- readonly env?: Record<string, string | undefined> | undefined;
29
- }): "drain" | "sdk";
30
- export declare function readLogSourcingMode(env?: Record<string, string | undefined> | undefined): "drain" | "sdk";
25
+ /** The build-injected surface configuration wins; otherwise {@link DEFAULT_LOG_SOURCING_MODE}. */
26
+ export declare function resolveLogSourcingMode(injected?: unknown): "drain" | "sdk";
27
+ /** Reads the build-injected {@link LOG_SOURCING_GLOBAL} global. */
28
+ export declare function readLogSourcingMode(): "drain" | "sdk";
31
29
  //#endregion
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  //#region src/sdk/log-sourcing.d.ts
3
- export declare const LOG_SOURCING_ENV_VAR = "INTERFERE_LOG_SOURCING";
4
3
  /**
5
4
  * Global stamped into the server bundle at build time (via `withInterfere`'s
6
5
  * value-injection loader) from the surface's remote config. Read at cold
@@ -23,9 +22,8 @@ export declare const logSourcingModeSchema: z.ZodEnum<{
23
22
  */
24
23
  export type LogSourcingMode = z.infer<typeof logSourcingModeSchema>;
25
24
  export declare const DEFAULT_LOG_SOURCING_MODE = "sdk";
26
- export declare function resolveLogSourcingMode(opts?: {
27
- readonly injected?: string | null | undefined;
28
- readonly env?: Record<string, string | undefined> | undefined;
29
- }): "drain" | "sdk";
30
- export declare function readLogSourcingMode(env?: Record<string, string | undefined> | undefined): "drain" | "sdk";
25
+ /** The build-injected surface configuration wins; otherwise {@link DEFAULT_LOG_SOURCING_MODE}. */
26
+ export declare function resolveLogSourcingMode(injected?: unknown): "drain" | "sdk";
27
+ /** Reads the build-injected {@link LOG_SOURCING_GLOBAL} global. */
28
+ export declare function readLogSourcingMode(): "drain" | "sdk";
31
29
  //#endregion
@@ -1 +1 @@
1
- import{normalizeEnv,readProcessEnv}from"./runtime.mjs";import{z}from"zod";const LOG_SOURCING_ENV_VAR=`INTERFERE_LOG_SOURCING`,LOG_SOURCING_GLOBAL=`__INTERFERE_LOG_SOURCING__`,logSourcingModeSchema=z.enum([`sdk`,`drain`]),DEFAULT_LOG_SOURCING_MODE=`sdk`;function resolveLogSourcingMode(opts){let injected=logSourcingModeSchema.safeParse(normalizeEnv(opts?.injected));if(injected.success)return injected.data;let fromEnv=logSourcingModeSchema.safeParse(normalizeEnv(opts?.env?.[LOG_SOURCING_ENV_VAR]));return fromEnv.success?fromEnv.data:`sdk`}function readLogSourcingMode(env=readProcessEnv()){let scope=globalThis,injected=`__INTERFERE_LOG_SOURCING__`in scope?scope[LOG_SOURCING_GLOBAL]:void 0;return resolveLogSourcingMode({env,injected:typeof injected==`string`?injected:void 0})}export{DEFAULT_LOG_SOURCING_MODE,LOG_SOURCING_ENV_VAR,LOG_SOURCING_GLOBAL,logSourcingModeSchema,readLogSourcingMode,resolveLogSourcingMode};
1
+ import{normalizeEnv}from"./runtime.mjs";import{z}from"zod";const LOG_SOURCING_GLOBAL=`__INTERFERE_LOG_SOURCING__`,logSourcingModeSchema=z.enum([`sdk`,`drain`]),DEFAULT_LOG_SOURCING_MODE=`sdk`;function resolveLogSourcingMode(injected){let parsed=logSourcingModeSchema.safeParse(normalizeEnv(injected));return parsed.success?parsed.data:`sdk`}function readLogSourcingMode(){let scope=globalThis;return resolveLogSourcingMode(`__INTERFERE_LOG_SOURCING__`in scope?scope[LOG_SOURCING_GLOBAL]:void 0)}export{DEFAULT_LOG_SOURCING_MODE,LOG_SOURCING_GLOBAL,logSourcingModeSchema,readLogSourcingMode,resolveLogSourcingMode};
@@ -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 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
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_sdk_runtime=require("./runtime.cjs");let zod=require("zod");const SERVER_TRACING_GLOBAL=`__INTERFERE_SERVER_TRACING__`,serverTracingModeSchema=zod.z.enum([`full`,`drain`]),DEFAULT_SERVER_TRACING_MODE=`full`;function resolveServerTracing(opts){let parsed=serverTracingModeSchema.safeParse(require_sdk_runtime.normalizeEnv(opts?.injected)),env=opts?.env??require_sdk_runtime.readProcessEnv();return{mode:parsed.success?parsed.data:DEFAULT_SERVER_TRACING_MODE,vercel:!!require_sdk_runtime.normalizeEnv(env?.VERCEL)}}function readServerTracing(env=require_sdk_runtime.readProcessEnv()){let scope=globalThis;return resolveServerTracing({env,injected:`__INTERFERE_SERVER_TRACING__`in scope?scope[SERVER_TRACING_GLOBAL]:void 0})}exports.DEFAULT_SERVER_TRACING_MODE=DEFAULT_SERVER_TRACING_MODE,exports.SERVER_TRACING_GLOBAL=SERVER_TRACING_GLOBAL,exports.VERCEL_EXPORT_TIMEOUT_MS=2e3,exports.readServerTracing=readServerTracing,exports.resolveServerTracing=resolveServerTracing,exports.serverTracingModeSchema=serverTracingModeSchema;
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  //#region src/sdk/server-tracing.d.ts
3
- export declare const SERVER_TRACING_ENV_VAR = "INTERFERE_SERVER_TRACING";
4
3
  /**
5
4
  * Global stamped into the server bundle at build time (via `withInterfere`'s
6
5
  * value-injection loader) from the surface's remote config. Read at cold
@@ -22,19 +21,24 @@ export declare const serverTracingModeSchema: z.ZodEnum<{
22
21
  */
23
22
  export type ServerTracingMode = z.infer<typeof serverTracingModeSchema>;
24
23
  export declare const DEFAULT_SERVER_TRACING_MODE = "full";
24
+ /** Per-attempt and flush ceiling for direct exports on Vercel, where a flush holds the invocation open. */
25
+ export declare const VERCEL_EXPORT_TIMEOUT_MS = 2000;
25
26
  /**
26
- * Resolve the server tracing mode: the build-injected value wins, then the
27
- * `INTERFERE_SERVER_TRACING` env var, then {@link DEFAULT_SERVER_TRACING_MODE}.
28
- * Unrecognised values fall through to the next source.
27
+ * Resolve the server tracing mode from the build-injected surface
28
+ * configuration alone; unrecognised or absent values resolve to
29
+ * {@link DEFAULT_SERVER_TRACING_MODE}. `vercel` reports whether `VERCEL` is
30
+ * set, which callers use to cap direct export timeouts.
29
31
  */
30
- export declare function resolveServerTracingMode(opts?: {
31
- readonly injected?: string | null | undefined;
32
+ export declare function resolveServerTracing(opts?: {
33
+ readonly injected?: unknown;
32
34
  readonly env?: Record<string, string | undefined> | undefined;
33
- }): "drain" | "full";
34
- /**
35
- * Server-runtime convenience over {@link resolveServerTracingMode}: reads the
36
- * build-injected {@link SERVER_TRACING_GLOBAL} global and falls back to
37
- * `process.env`. Zero-touch — no code option required.
38
- */
39
- export declare function readServerTracingMode(env?: Record<string, string | undefined> | undefined): "drain" | "full";
35
+ }): {
36
+ mode: "drain" | "full";
37
+ vercel: boolean;
38
+ };
39
+ /** Reads the build-injected {@link SERVER_TRACING_GLOBAL} global and `process.env`. */
40
+ export declare function readServerTracing(env?: Record<string, string | undefined> | undefined): {
41
+ mode: "drain" | "full";
42
+ vercel: boolean;
43
+ };
40
44
  //#endregion
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  //#region src/sdk/server-tracing.d.ts
3
- export declare const SERVER_TRACING_ENV_VAR = "INTERFERE_SERVER_TRACING";
4
3
  /**
5
4
  * Global stamped into the server bundle at build time (via `withInterfere`'s
6
5
  * value-injection loader) from the surface's remote config. Read at cold
@@ -22,19 +21,24 @@ export declare const serverTracingModeSchema: z.ZodEnum<{
22
21
  */
23
22
  export type ServerTracingMode = z.infer<typeof serverTracingModeSchema>;
24
23
  export declare const DEFAULT_SERVER_TRACING_MODE = "full";
24
+ /** Per-attempt and flush ceiling for direct exports on Vercel, where a flush holds the invocation open. */
25
+ export declare const VERCEL_EXPORT_TIMEOUT_MS = 2000;
25
26
  /**
26
- * Resolve the server tracing mode: the build-injected value wins, then the
27
- * `INTERFERE_SERVER_TRACING` env var, then {@link DEFAULT_SERVER_TRACING_MODE}.
28
- * Unrecognised values fall through to the next source.
27
+ * Resolve the server tracing mode from the build-injected surface
28
+ * configuration alone; unrecognised or absent values resolve to
29
+ * {@link DEFAULT_SERVER_TRACING_MODE}. `vercel` reports whether `VERCEL` is
30
+ * set, which callers use to cap direct export timeouts.
29
31
  */
30
- export declare function resolveServerTracingMode(opts?: {
31
- readonly injected?: string | null | undefined;
32
+ export declare function resolveServerTracing(opts?: {
33
+ readonly injected?: unknown;
32
34
  readonly env?: Record<string, string | undefined> | undefined;
33
- }): "drain" | "full";
34
- /**
35
- * Server-runtime convenience over {@link resolveServerTracingMode}: reads the
36
- * build-injected {@link SERVER_TRACING_GLOBAL} global and falls back to
37
- * `process.env`. Zero-touch — no code option required.
38
- */
39
- export declare function readServerTracingMode(env?: Record<string, string | undefined> | undefined): "drain" | "full";
35
+ }): {
36
+ mode: "drain" | "full";
37
+ vercel: boolean;
38
+ };
39
+ /** Reads the build-injected {@link SERVER_TRACING_GLOBAL} global and `process.env`. */
40
+ export declare function readServerTracing(env?: Record<string, string | undefined> | undefined): {
41
+ mode: "drain" | "full";
42
+ vercel: boolean;
43
+ };
40
44
  //#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 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};
1
+ import{normalizeEnv,readProcessEnv}from"./runtime.mjs";import{z}from"zod";const SERVER_TRACING_GLOBAL=`__INTERFERE_SERVER_TRACING__`,serverTracingModeSchema=z.enum([`full`,`drain`]),DEFAULT_SERVER_TRACING_MODE=`full`,VERCEL_EXPORT_TIMEOUT_MS=2e3;function resolveServerTracing(opts){let parsed=serverTracingModeSchema.safeParse(normalizeEnv(opts?.injected)),env=opts?.env??readProcessEnv();return{mode:parsed.success?parsed.data:DEFAULT_SERVER_TRACING_MODE,vercel:!!normalizeEnv(env?.VERCEL)}}function readServerTracing(env=readProcessEnv()){let scope=globalThis;return resolveServerTracing({env,injected:`__INTERFERE_SERVER_TRACING__`in scope?scope[SERVER_TRACING_GLOBAL]:void 0})}export{DEFAULT_SERVER_TRACING_MODE,SERVER_TRACING_GLOBAL,VERCEL_EXPORT_TIMEOUT_MS,readServerTracing,resolveServerTracing,serverTracingModeSchema};
@@ -1,7 +1,7 @@
1
1
  //#region src/sdk/service-name.d.ts
2
2
  /**
3
3
  * Global a build stamps into the page with the default OTel `service.name`
4
- * (the Vite plugin derives it from the package name). The kernel reads it
4
+ * (the build integrations derive it from the package name). The kernel reads it
5
5
  * when `init()` is called without `serviceName`; an explicit value wins.
6
6
  */
7
7
  export declare const SERVICE_NAME_GLOBAL = "__INTERFERE_SERVICE_NAME__";
@@ -1,7 +1,7 @@
1
1
  //#region src/sdk/service-name.d.ts
2
2
  /**
3
3
  * Global a build stamps into the page with the default OTel `service.name`
4
- * (the Vite plugin derives it from the package name). The kernel reads it
4
+ * (the build integrations derive it from the package name). The kernel reads it
5
5
  * when `init()` is called without `serviceName`; an explicit value wins.
6
6
  */
7
7
  export declare const SERVICE_NAME_GLOBAL = "__INTERFERE_SERVICE_NAME__";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interfere/types",
3
- "version": "10.4.0",
3
+ "version": "10.5.0",
4
4
  "description": "TypeScript & Zod types for Interfere",
5
5
  "keywords": [
6
6
  "logging",