@cloudflare/workers-shared
Version:
Package that is used at Cloudflare to power some internal features of Cloudflare Workers.
75 lines (74 loc) • 2.9 kB
TypeScript
import { z } from "zod";
export declare const RouterConfigSchema: z.ZodObject<{
account_id: z.ZodOptional<z.ZodNumber>;
script_id: z.ZodOptional<z.ZodNumber>;
invoke_user_worker_ahead_of_assets: z.ZodOptional<z.ZodBoolean>;
has_user_worker: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
account_id?: number;
script_id?: number;
invoke_user_worker_ahead_of_assets?: boolean;
has_user_worker?: boolean;
}, {
account_id?: number;
script_id?: number;
invoke_user_worker_ahead_of_assets?: boolean;
has_user_worker?: boolean;
}>;
export declare const AssetConfigSchema: z.ZodObject<{
account_id: z.ZodOptional<z.ZodNumber>;
script_id: z.ZodOptional<z.ZodNumber>;
compatibility_date: z.ZodOptional<z.ZodString>;
compatibility_flags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
html_handling: z.ZodOptional<z.ZodEnum<["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]>>;
not_found_handling: z.ZodOptional<z.ZodEnum<["single-page-application", "404-page", "none"]>>;
}, "strip", z.ZodTypeAny, {
account_id?: number;
script_id?: number;
compatibility_date?: string;
compatibility_flags?: string[];
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
not_found_handling?: "none" | "single-page-application" | "404-page";
}, {
account_id?: number;
script_id?: number;
compatibility_date?: string;
compatibility_flags?: string[];
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
not_found_handling?: "none" | "single-page-application" | "404-page";
}>;
export type RouterConfig = z.infer<typeof RouterConfigSchema>;
export type AssetConfig = z.infer<typeof AssetConfigSchema>;
export interface UnsafePerformanceTimer {
readonly timeOrigin: number;
now: () => number;
}
export interface JaegerTracing {
enterSpan<T extends unknown[], R = void>(name: string, span: (s: Span, ...args: T) => R, ...args: T): R;
getSpanContext(): SpanContext | null;
runWithSpanContext<T extends unknown[]>(spanContext: SpanContext | null, callback: (...args: T) => unknown, ...args: T): unknown;
readonly traceId: string | null;
readonly spanId: string | null;
readonly parentSpanId: string | null;
readonly cfTraceIdHeader: string | null;
}
export interface Span {
addLogs(logs: JaegerRecord): void;
setTags(tags: JaegerRecord): void;
end(): void;
isRecording: boolean;
}
export interface SpanContext {
traceId: string;
spanId: string;
parentSpanId: string;
traceFlags: number;
}
export type JaegerValue = string | number | boolean;
export type JaegerRecord = Record<string, JaegerValue>;
export interface ColoMetadata {
metalId: number;
coloId: number;
coloRegion: string;
coloTier: number;
}