@interfere/types 10.5.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.
- package/dist/integrations/platforms/hosting.cjs +1 -0
- package/dist/integrations/platforms/hosting.d.cts +16 -0
- package/dist/integrations/platforms/hosting.d.mts +16 -0
- package/dist/integrations/platforms/hosting.mjs +1 -0
- package/dist/sdk/build-config.cjs +1 -1
- package/dist/sdk/build-config.d.cts +4 -0
- package/dist/sdk/build-config.d.mts +4 -0
- package/dist/sdk/build-config.mjs +1 -1
- package/dist/sdk/remote-config.cjs +1 -1
- package/dist/sdk/remote-config.d.cts +8 -0
- package/dist/sdk/remote-config.d.mts +8 -0
- package/dist/sdk/remote-config.mjs +1 -1
- package/dist/sdk/server-tracing.cjs +1 -1
- package/dist/sdk/server-tracing.d.cts +7 -5
- package/dist/sdk/server-tracing.d.mts +7 -5
- package/dist/sdk/server-tracing.mjs +1 -1
- package/package.json +1 -1
|
@@ -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_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_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)),
|
|
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;
|
|
@@ -24,19 +24,21 @@ export declare const DEFAULT_SERVER_TRACING_MODE = "full";
|
|
|
24
24
|
/** Per-attempt and flush ceiling for direct exports on Vercel, where a flush holds the invocation open. */
|
|
25
25
|
export declare const VERCEL_EXPORT_TIMEOUT_MS = 2000;
|
|
26
26
|
/**
|
|
27
|
-
* Resolve the server tracing mode from the
|
|
28
|
-
* configuration
|
|
29
|
-
* {@link DEFAULT_SERVER_TRACING_MODE}. `vercel` reports whether
|
|
30
|
-
*
|
|
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.
|
|
31
32
|
*/
|
|
32
33
|
export declare function resolveServerTracing(opts?: {
|
|
33
34
|
readonly injected?: unknown;
|
|
35
|
+
readonly platform?: unknown;
|
|
34
36
|
readonly env?: Record<string, string | undefined> | undefined;
|
|
35
37
|
}): {
|
|
36
38
|
mode: "drain" | "full";
|
|
37
39
|
vercel: boolean;
|
|
38
40
|
};
|
|
39
|
-
/** Reads the build-injected {@link SERVER_TRACING_GLOBAL}
|
|
41
|
+
/** Reads the build-injected {@link SERVER_TRACING_GLOBAL} and {@link PLATFORM_GLOBAL} globals. */
|
|
40
42
|
export declare function readServerTracing(env?: Record<string, string | undefined> | undefined): {
|
|
41
43
|
mode: "drain" | "full";
|
|
42
44
|
vercel: boolean;
|
|
@@ -24,19 +24,21 @@ export declare const DEFAULT_SERVER_TRACING_MODE = "full";
|
|
|
24
24
|
/** Per-attempt and flush ceiling for direct exports on Vercel, where a flush holds the invocation open. */
|
|
25
25
|
export declare const VERCEL_EXPORT_TIMEOUT_MS = 2000;
|
|
26
26
|
/**
|
|
27
|
-
* Resolve the server tracing mode from the
|
|
28
|
-
* configuration
|
|
29
|
-
* {@link DEFAULT_SERVER_TRACING_MODE}. `vercel` reports whether
|
|
30
|
-
*
|
|
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.
|
|
31
32
|
*/
|
|
32
33
|
export declare function resolveServerTracing(opts?: {
|
|
33
34
|
readonly injected?: unknown;
|
|
35
|
+
readonly platform?: unknown;
|
|
34
36
|
readonly env?: Record<string, string | undefined> | undefined;
|
|
35
37
|
}): {
|
|
36
38
|
mode: "drain" | "full";
|
|
37
39
|
vercel: boolean;
|
|
38
40
|
};
|
|
39
|
-
/** Reads the build-injected {@link SERVER_TRACING_GLOBAL}
|
|
41
|
+
/** Reads the build-injected {@link SERVER_TRACING_GLOBAL} and {@link PLATFORM_GLOBAL} globals. */
|
|
40
42
|
export declare function readServerTracing(env?: Record<string, string | undefined> | undefined): {
|
|
41
43
|
mode: "drain" | "full";
|
|
42
44
|
vercel: boolean;
|
|
@@ -1 +1 @@
|
|
|
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)),
|
|
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};
|