@interfere/types 10.4.0 → 10.5.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.
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const hostingPlatformSchema=require("zod").z.enum([`vercel`,`cloudflare`]);exports.PLATFORM_GLOBAL=`__INTERFERE_PLATFORM__`,exports.hostingPlatformSchema=hostingPlatformSchema;
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ //#region src/integrations/platforms/hosting.d.ts
3
+ /**
4
+ * Global stamped into the server bundle at build time with the surface's
5
+ * hosting platform from the remote config: a {@link HostingPlatform}, or
6
+ * `null` when the surface is not linked to one. Absent when the build could
7
+ * not load the remote config.
8
+ */
9
+ export declare const PLATFORM_GLOBAL = "__INTERFERE_PLATFORM__";
10
+ /** Hosting platform the surface is linked to through a destination connection. */
11
+ export declare const hostingPlatformSchema: z.ZodEnum<{
12
+ cloudflare: "cloudflare";
13
+ vercel: "vercel";
14
+ }>;
15
+ export type HostingPlatform = z.infer<typeof hostingPlatformSchema>;
16
+ //#endregion
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ //#region src/integrations/platforms/hosting.d.ts
3
+ /**
4
+ * Global stamped into the server bundle at build time with the surface's
5
+ * hosting platform from the remote config: a {@link HostingPlatform}, or
6
+ * `null` when the surface is not linked to one. Absent when the build could
7
+ * not load the remote config.
8
+ */
9
+ export declare const PLATFORM_GLOBAL = "__INTERFERE_PLATFORM__";
10
+ /** Hosting platform the surface is linked to through a destination connection. */
11
+ export declare const hostingPlatformSchema: z.ZodEnum<{
12
+ cloudflare: "cloudflare";
13
+ vercel: "vercel";
14
+ }>;
15
+ export type HostingPlatform = z.infer<typeof hostingPlatformSchema>;
16
+ //#endregion
@@ -0,0 +1 @@
1
+ import{z}from"zod";const PLATFORM_GLOBAL=`__INTERFERE_PLATFORM__`,hostingPlatformSchema=z.enum([`vercel`,`cloudflare`]);export{PLATFORM_GLOBAL,hostingPlatformSchema};
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_sdk_remote_config=require("./remote-config.cjs");let zod=require("zod");const remoteConfigFields=require_sdk_remote_config.remoteConfigSchema.shape,buildConfigSchema=(0,zod.catch)(zod.z.object({ingestUrl:(0,zod.catch)(remoteConfigFields.ingestUrl,void 0),logSourcing:(0,zod.catch)(remoteConfigFields.logSourcing,void 0),plugins:(0,zod.catch)(remoteConfigFields.plugins.partial().optional(),void 0),serverTracing:(0,zod.catch)(remoteConfigFields.serverTracing,void 0)}),{});exports.buildConfigSchema=buildConfigSchema;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_sdk_remote_config=require("./remote-config.cjs");let zod=require("zod");const remoteConfigFields=require_sdk_remote_config.remoteConfigSchema.shape,buildConfigSchema=(0,zod.catch)(zod.z.object({ingestUrl:(0,zod.catch)(remoteConfigFields.ingestUrl,void 0),logSourcing:(0,zod.catch)(remoteConfigFields.logSourcing,void 0),platform:(0,zod.catch)(remoteConfigFields.platform,void 0),plugins:(0,zod.catch)(remoteConfigFields.plugins.partial().optional(),void 0),serverTracing:(0,zod.catch)(remoteConfigFields.serverTracing,void 0)}),{});exports.buildConfigSchema=buildConfigSchema;
@@ -6,6 +6,10 @@ export declare const buildConfigSchema: z.ZodCatch<z.ZodObject<{
6
6
  drain: "drain";
7
7
  sdk: "sdk";
8
8
  }>>>;
9
+ platform: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
10
+ cloudflare: "cloudflare";
11
+ vercel: "vercel";
12
+ }>>>;
9
13
  plugins: z.ZodCatch<z.ZodOptional<z.ZodObject<{
10
14
  device: z.ZodOptional<z.ZodBoolean>;
11
15
  errors: z.ZodOptional<z.ZodBoolean>;
@@ -6,6 +6,10 @@ export declare const buildConfigSchema: z.ZodCatch<z.ZodObject<{
6
6
  drain: "drain";
7
7
  sdk: "sdk";
8
8
  }>>>;
9
+ platform: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
10
+ cloudflare: "cloudflare";
11
+ vercel: "vercel";
12
+ }>>>;
9
13
  plugins: z.ZodCatch<z.ZodOptional<z.ZodObject<{
10
14
  device: z.ZodOptional<z.ZodBoolean>;
11
15
  errors: z.ZodOptional<z.ZodBoolean>;
@@ -1 +1 @@
1
- import{remoteConfigSchema}from"./remote-config.mjs";import{catch as catch$1,z}from"zod";const remoteConfigFields=remoteConfigSchema.shape,buildConfigSchema=catch$1(z.object({ingestUrl:catch$1(remoteConfigFields.ingestUrl,void 0),logSourcing:catch$1(remoteConfigFields.logSourcing,void 0),plugins:catch$1(remoteConfigFields.plugins.partial().optional(),void 0),serverTracing:catch$1(remoteConfigFields.serverTracing,void 0)}),{});export{buildConfigSchema};
1
+ import{remoteConfigSchema}from"./remote-config.mjs";import{catch as catch$1,z}from"zod";const remoteConfigFields=remoteConfigSchema.shape,buildConfigSchema=catch$1(z.object({ingestUrl:catch$1(remoteConfigFields.ingestUrl,void 0),logSourcing:catch$1(remoteConfigFields.logSourcing,void 0),platform:catch$1(remoteConfigFields.platform,void 0),plugins:catch$1(remoteConfigFields.plugins.partial().optional(),void 0),serverTracing:catch$1(remoteConfigFields.serverTracing,void 0)}),{});export{buildConfigSchema};
@@ -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_log_sourcing=require("./log-sourcing.cjs"),require_sdk_plugins_manifest=require("./plugins/manifest.cjs"),require_sdk_server_tracing=require("./server-tracing.cjs");let zod=require("zod");const remotePluginConfigSchema=zod.z.object(Object.fromEntries(require_sdk_plugins_manifest.PLUGIN_MANIFEST.map(p=>[p.name,zod.z.boolean()]))).meta({id:`RemotePluginConfig`,title:`RemotePluginConfig`}),remoteConfigSchema=zod.z.object({ingestUrl:zod.z.url().optional(),logSourcing:require_sdk_log_sourcing.logSourcingModeSchema.optional(),plugins:remotePluginConfigSchema,serverTracing:require_sdk_server_tracing.serverTracingModeSchema.optional()}).meta({id:`RemoteConfig`,title:`RemoteConfig`}),partialRemotePluginConfigSchema=remotePluginConfigSchema.partial(),remoteConfigInputSchema=remoteConfigSchema.extend({plugins:partialRemotePluginConfigSchema.optional()}),PLUGINS_GLOBAL=`__INTERFERE_PLUGINS__`;function readBakedPlugins(){let scope=globalThis,injected=`__INTERFERE_PLUGINS__`in scope?scope[PLUGINS_GLOBAL]:void 0;if(injected==null)return null;let parsed=remotePluginConfigSchema.safeParse(injected);return parsed.success?parsed.data:null}const EVENT_TYPE_TO_PLUGIN=Object.fromEntries(require_sdk_plugins_manifest.PLUGIN_MANIFEST.flatMap(plugin=>plugin.events.map(event=>[event.name,plugin.name])));exports.EVENT_TYPE_TO_PLUGIN=EVENT_TYPE_TO_PLUGIN,exports.PLUGINS_GLOBAL=PLUGINS_GLOBAL,exports.readBakedPlugins=readBakedPlugins,exports.remoteConfigInputSchema=remoteConfigInputSchema,exports.remoteConfigSchema=remoteConfigSchema,exports.remotePluginConfigSchema=remotePluginConfigSchema;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_sdk_log_sourcing=require("./log-sourcing.cjs"),require_sdk_plugins_manifest=require("./plugins/manifest.cjs"),require_integrations_platforms_hosting=require("../integrations/platforms/hosting.cjs"),require_sdk_server_tracing=require("./server-tracing.cjs");let zod=require("zod");const remotePluginConfigSchema=zod.z.object(Object.fromEntries(require_sdk_plugins_manifest.PLUGIN_MANIFEST.map(p=>[p.name,zod.z.boolean()]))).meta({id:`RemotePluginConfig`,title:`RemotePluginConfig`}),remoteConfigSchema=zod.z.object({ingestUrl:zod.z.url().optional(),logSourcing:require_sdk_log_sourcing.logSourcingModeSchema.optional(),platform:require_integrations_platforms_hosting.hostingPlatformSchema.optional(),plugins:remotePluginConfigSchema,serverTracing:require_sdk_server_tracing.serverTracingModeSchema.optional()}).meta({id:`RemoteConfig`,title:`RemoteConfig`}),partialRemotePluginConfigSchema=remotePluginConfigSchema.partial(),remoteConfigInputSchema=remoteConfigSchema.extend({plugins:partialRemotePluginConfigSchema.optional()}),PLUGINS_GLOBAL=`__INTERFERE_PLUGINS__`;function readBakedPlugins(){let scope=globalThis,injected=`__INTERFERE_PLUGINS__`in scope?scope[PLUGINS_GLOBAL]:void 0;if(injected==null)return null;let parsed=remotePluginConfigSchema.safeParse(injected);return parsed.success?parsed.data:null}const EVENT_TYPE_TO_PLUGIN=Object.fromEntries(require_sdk_plugins_manifest.PLUGIN_MANIFEST.flatMap(plugin=>plugin.events.map(event=>[event.name,plugin.name])));exports.EVENT_TYPE_TO_PLUGIN=EVENT_TYPE_TO_PLUGIN,exports.PLUGINS_GLOBAL=PLUGINS_GLOBAL,exports.readBakedPlugins=readBakedPlugins,exports.remoteConfigInputSchema=remoteConfigInputSchema,exports.remoteConfigSchema=remoteConfigSchema,exports.remotePluginConfigSchema=remotePluginConfigSchema;
@@ -17,6 +17,10 @@ export declare const remoteConfigSchema: z.ZodObject<{
17
17
  drain: "drain";
18
18
  sdk: "sdk";
19
19
  }>>;
20
+ platform: z.ZodOptional<z.ZodEnum<{
21
+ cloudflare: "cloudflare";
22
+ vercel: "vercel";
23
+ }>>;
20
24
  plugins: z.ZodObject<{
21
25
  device: z.ZodBoolean;
22
26
  errors: z.ZodBoolean;
@@ -45,6 +49,10 @@ export declare const remoteConfigInputSchema: z.ZodObject<{
45
49
  drain: "drain";
46
50
  sdk: "sdk";
47
51
  }>>;
52
+ platform: z.ZodOptional<z.ZodEnum<{
53
+ cloudflare: "cloudflare";
54
+ vercel: "vercel";
55
+ }>>;
48
56
  serverTracing: z.ZodOptional<z.ZodEnum<{
49
57
  drain: "drain";
50
58
  full: "full";
@@ -17,6 +17,10 @@ export declare const remoteConfigSchema: z.ZodObject<{
17
17
  drain: "drain";
18
18
  sdk: "sdk";
19
19
  }>>;
20
+ platform: z.ZodOptional<z.ZodEnum<{
21
+ cloudflare: "cloudflare";
22
+ vercel: "vercel";
23
+ }>>;
20
24
  plugins: z.ZodObject<{
21
25
  device: z.ZodBoolean;
22
26
  errors: z.ZodBoolean;
@@ -45,6 +49,10 @@ export declare const remoteConfigInputSchema: z.ZodObject<{
45
49
  drain: "drain";
46
50
  sdk: "sdk";
47
51
  }>>;
52
+ platform: z.ZodOptional<z.ZodEnum<{
53
+ cloudflare: "cloudflare";
54
+ vercel: "vercel";
55
+ }>>;
48
56
  serverTracing: z.ZodOptional<z.ZodEnum<{
49
57
  drain: "drain";
50
58
  full: "full";
@@ -1 +1 @@
1
- import{logSourcingModeSchema}from"./log-sourcing.mjs";import{PLUGIN_MANIFEST}from"./plugins/manifest.mjs";import{serverTracingModeSchema}from"./server-tracing.mjs";import{z}from"zod";const remotePluginConfigSchema=z.object(Object.fromEntries(PLUGIN_MANIFEST.map(p=>[p.name,z.boolean()]))).meta({id:`RemotePluginConfig`,title:`RemotePluginConfig`}),remoteConfigSchema=z.object({ingestUrl:z.url().optional(),logSourcing:logSourcingModeSchema.optional(),plugins:remotePluginConfigSchema,serverTracing:serverTracingModeSchema.optional()}).meta({id:`RemoteConfig`,title:`RemoteConfig`}),partialRemotePluginConfigSchema=remotePluginConfigSchema.partial(),remoteConfigInputSchema=remoteConfigSchema.extend({plugins:partialRemotePluginConfigSchema.optional()}),PLUGINS_GLOBAL=`__INTERFERE_PLUGINS__`;function readBakedPlugins(){let scope=globalThis,injected=`__INTERFERE_PLUGINS__`in scope?scope[PLUGINS_GLOBAL]:void 0;if(injected==null)return null;let parsed=remotePluginConfigSchema.safeParse(injected);return parsed.success?parsed.data:null}const EVENT_TYPE_TO_PLUGIN=Object.fromEntries(PLUGIN_MANIFEST.flatMap(plugin=>plugin.events.map(event=>[event.name,plugin.name])));export{EVENT_TYPE_TO_PLUGIN,PLUGINS_GLOBAL,readBakedPlugins,remoteConfigInputSchema,remoteConfigSchema,remotePluginConfigSchema};
1
+ import{logSourcingModeSchema}from"./log-sourcing.mjs";import{PLUGIN_MANIFEST}from"./plugins/manifest.mjs";import{hostingPlatformSchema}from"../integrations/platforms/hosting.mjs";import{serverTracingModeSchema}from"./server-tracing.mjs";import{z}from"zod";const remotePluginConfigSchema=z.object(Object.fromEntries(PLUGIN_MANIFEST.map(p=>[p.name,z.boolean()]))).meta({id:`RemotePluginConfig`,title:`RemotePluginConfig`}),remoteConfigSchema=z.object({ingestUrl:z.url().optional(),logSourcing:logSourcingModeSchema.optional(),platform:hostingPlatformSchema.optional(),plugins:remotePluginConfigSchema,serverTracing:serverTracingModeSchema.optional()}).meta({id:`RemoteConfig`,title:`RemoteConfig`}),partialRemotePluginConfigSchema=remotePluginConfigSchema.partial(),remoteConfigInputSchema=remoteConfigSchema.extend({plugins:partialRemotePluginConfigSchema.optional()}),PLUGINS_GLOBAL=`__INTERFERE_PLUGINS__`;function readBakedPlugins(){let scope=globalThis,injected=`__INTERFERE_PLUGINS__`in scope?scope[PLUGINS_GLOBAL]:void 0;if(injected==null)return null;let parsed=remotePluginConfigSchema.safeParse(injected);return parsed.success?parsed.data:null}const EVENT_TYPE_TO_PLUGIN=Object.fromEntries(PLUGIN_MANIFEST.flatMap(plugin=>plugin.events.map(event=>[event.name,plugin.name])));export{EVENT_TYPE_TO_PLUGIN,PLUGINS_GLOBAL,readBakedPlugins,remoteConfigInputSchema,remoteConfigSchema,remotePluginConfigSchema};
@@ -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"),require_integrations_platforms_hosting=require("../integrations/platforms/hosting.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)),vercel=opts?.platform===void 0?!!require_sdk_runtime.normalizeEnv((opts?.env??require_sdk_runtime.readProcessEnv())?.VERCEL):require_integrations_platforms_hosting.hostingPlatformSchema.safeParse(require_sdk_runtime.normalizeEnv(opts.platform)).data===`vercel`;return{mode:parsed.success?parsed.data:DEFAULT_SERVER_TRACING_MODE,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,platform:`__INTERFERE_PLATFORM__`in scope?scope[require_integrations_platforms_hosting.PLATFORM_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,26 @@ 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 and hosting platform from the
28
+ * build-injected surface configuration. Unrecognised or absent modes resolve
29
+ * to {@link DEFAULT_SERVER_TRACING_MODE}. `vercel` reports whether the
30
+ * injected platform is Vercel, which callers use to cap direct export
31
+ * timeouts; `VERCEL` is read only when the build injected no platform.
29
32
  */
30
- export declare function resolveServerTracingMode(opts?: {
31
- readonly injected?: string | null | undefined;
33
+ export declare function resolveServerTracing(opts?: {
34
+ readonly injected?: unknown;
35
+ readonly platform?: unknown;
32
36
  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";
37
+ }): {
38
+ mode: "drain" | "full";
39
+ vercel: boolean;
40
+ };
41
+ /** Reads the build-injected {@link SERVER_TRACING_GLOBAL} and {@link PLATFORM_GLOBAL} globals. */
42
+ export declare function readServerTracing(env?: Record<string, string | undefined> | undefined): {
43
+ mode: "drain" | "full";
44
+ vercel: boolean;
45
+ };
40
46
  //#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,26 @@ 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 and hosting platform from the
28
+ * build-injected surface configuration. Unrecognised or absent modes resolve
29
+ * to {@link DEFAULT_SERVER_TRACING_MODE}. `vercel` reports whether the
30
+ * injected platform is Vercel, which callers use to cap direct export
31
+ * timeouts; `VERCEL` is read only when the build injected no platform.
29
32
  */
30
- export declare function resolveServerTracingMode(opts?: {
31
- readonly injected?: string | null | undefined;
33
+ export declare function resolveServerTracing(opts?: {
34
+ readonly injected?: unknown;
35
+ readonly platform?: unknown;
32
36
  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";
37
+ }): {
38
+ mode: "drain" | "full";
39
+ vercel: boolean;
40
+ };
41
+ /** Reads the build-injected {@link SERVER_TRACING_GLOBAL} and {@link PLATFORM_GLOBAL} globals. */
42
+ export declare function readServerTracing(env?: Record<string, string | undefined> | undefined): {
43
+ mode: "drain" | "full";
44
+ vercel: boolean;
45
+ };
40
46
  //#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{PLATFORM_GLOBAL,hostingPlatformSchema}from"../integrations/platforms/hosting.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)),vercel=opts?.platform===void 0?!!normalizeEnv((opts?.env??readProcessEnv())?.VERCEL):hostingPlatformSchema.safeParse(normalizeEnv(opts.platform)).data===`vercel`;return{mode:parsed.success?parsed.data:DEFAULT_SERVER_TRACING_MODE,vercel}}function readServerTracing(env=readProcessEnv()){let scope=globalThis;return resolveServerTracing({env,injected:`__INTERFERE_SERVER_TRACING__`in scope?scope[SERVER_TRACING_GLOBAL]:void 0,platform:`__INTERFERE_PLATFORM__`in scope?scope[PLATFORM_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.1",
4
4
  "description": "TypeScript & Zod types for Interfere",
5
5
  "keywords": [
6
6
  "logging",