@cloudflare/workers-types 4.20230904.0 → 4.20230922.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.
- package/2021-11-03/index.d.ts +480 -19
- package/2021-11-03/index.ts +480 -16
- package/2022-01-31/index.d.ts +480 -19
- package/2022-01-31/index.ts +480 -16
- package/2022-03-21/index.d.ts +490 -19
- package/2022-03-21/index.ts +490 -16
- package/2022-08-04/index.d.ts +490 -19
- package/2022-08-04/index.ts +490 -16
- package/2022-10-31/index.d.ts +490 -19
- package/2022-10-31/index.ts +490 -16
- package/2022-11-30/index.d.ts +490 -19
- package/2022-11-30/index.ts +490 -16
- package/2023-03-01/index.d.ts +490 -19
- package/2023-03-01/index.ts +490 -16
- package/2023-07-01/index.d.ts +490 -19
- package/2023-07-01/index.ts +490 -16
- package/experimental/index.d.ts +490 -19
- package/experimental/index.ts +490 -16
- package/index.d.ts +480 -19
- package/index.ts +480 -16
- package/oldest/index.d.ts +480 -19
- package/oldest/index.ts +480 -16
- package/package.json +1 -1
package/2023-07-01/index.d.ts
CHANGED
|
@@ -238,6 +238,14 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
238
238
|
FixedLengthStream: typeof FixedLengthStream;
|
|
239
239
|
IdentityTransformStream: typeof IdentityTransformStream;
|
|
240
240
|
HTMLRewriter: typeof HTMLRewriter;
|
|
241
|
+
GPUAdapter: typeof gpuGPUAdapter;
|
|
242
|
+
GPUOutOfMemoryError: typeof gpuGPUOutOfMemoryError;
|
|
243
|
+
GPUValidationError: typeof gpuGPUValidationError;
|
|
244
|
+
GPUInternalError: typeof gpuGPUInternalError;
|
|
245
|
+
GPUDeviceLostInfo: typeof gpuGPUDeviceLostInfo;
|
|
246
|
+
GPUBufferUsage: typeof gpuGPUBufferUsage;
|
|
247
|
+
GPUShaderStage: typeof gpuGPUShaderStage;
|
|
248
|
+
GPUMapMode: typeof gpuGPUMapMode;
|
|
241
249
|
}
|
|
242
250
|
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
243
251
|
type: Type,
|
|
@@ -353,6 +361,7 @@ declare abstract class PromiseRejectionEvent extends Event {
|
|
|
353
361
|
}
|
|
354
362
|
declare abstract class Navigator {
|
|
355
363
|
readonly userAgent: string;
|
|
364
|
+
readonly gpu: gpuGPU;
|
|
356
365
|
}
|
|
357
366
|
/** Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
|
|
358
367
|
declare interface Performance {
|
|
@@ -875,7 +884,7 @@ declare class TextDecoder {
|
|
|
875
884
|
}
|
|
876
885
|
declare class TextEncoder {
|
|
877
886
|
constructor();
|
|
878
|
-
encode(input?: string):
|
|
887
|
+
encode(input?: string): Uint8Array;
|
|
879
888
|
encodeInto(
|
|
880
889
|
input: string,
|
|
881
890
|
buffer: ArrayBuffer | ArrayBufferView
|
|
@@ -1923,6 +1932,305 @@ declare interface SocketAddress {
|
|
|
1923
1932
|
declare interface TlsOptions {
|
|
1924
1933
|
expectedServerHostname?: string;
|
|
1925
1934
|
}
|
|
1935
|
+
declare interface gpuGPU {
|
|
1936
|
+
requestAdapter(
|
|
1937
|
+
param1?: gpuGPURequestAdapterOptions
|
|
1938
|
+
): Promise<gpuGPUAdapter | null>;
|
|
1939
|
+
}
|
|
1940
|
+
declare abstract class gpuGPUAdapter {
|
|
1941
|
+
requestDevice(param1?: gpuGPUDeviceDescriptor): Promise<gpuGPUDevice>;
|
|
1942
|
+
requestAdapterInfo(unmaskHints?: string[]): Promise<gpuGPUAdapterInfo>;
|
|
1943
|
+
get features(): gpuGPUSupportedFeatures;
|
|
1944
|
+
get limits(): gpuGPUSupportedLimits;
|
|
1945
|
+
}
|
|
1946
|
+
declare interface gpuGPUDevice extends EventTarget {
|
|
1947
|
+
createBuffer(param1: gpuGPUBufferDescriptor): gpuGPUBuffer;
|
|
1948
|
+
createBindGroupLayout(
|
|
1949
|
+
descriptor: gpuGPUBindGroupLayoutDescriptor
|
|
1950
|
+
): gpuGPUBindGroupLayout;
|
|
1951
|
+
createBindGroup(descriptor: gpuGPUBindGroupDescriptor): gpuGPUBindGroup;
|
|
1952
|
+
createSampler(descriptor: gpuGPUSamplerDescriptor): gpuGPUSampler;
|
|
1953
|
+
createShaderModule(
|
|
1954
|
+
descriptor: gpuGPUShaderModuleDescriptor
|
|
1955
|
+
): gpuGPUShaderModule;
|
|
1956
|
+
createPipelineLayout(
|
|
1957
|
+
descriptor: gpuGPUPipelineLayoutDescriptor
|
|
1958
|
+
): gpuGPUPipelineLayout;
|
|
1959
|
+
createComputePipeline(
|
|
1960
|
+
descriptor: gpuGPUComputePipelineDescriptor
|
|
1961
|
+
): gpuGPUComputePipeline;
|
|
1962
|
+
createCommandEncoder(
|
|
1963
|
+
descriptor?: gpuGPUCommandEncoderDescriptor
|
|
1964
|
+
): gpuGPUCommandEncoder;
|
|
1965
|
+
destroy(): void;
|
|
1966
|
+
createQuerySet(descriptor: gpuGPUQuerySetDescriptor): gpuGPUQuerySet;
|
|
1967
|
+
pushErrorScope(filter: string): void;
|
|
1968
|
+
popErrorScope(): Promise<gpuGPUError | null>;
|
|
1969
|
+
get queue(): gpuGPUQueue;
|
|
1970
|
+
get lost(): Promise<gpuGPUDeviceLostInfo>;
|
|
1971
|
+
get features(): gpuGPUSupportedFeatures;
|
|
1972
|
+
get limits(): gpuGPUSupportedLimits;
|
|
1973
|
+
}
|
|
1974
|
+
declare interface gpuGPUDeviceDescriptor {
|
|
1975
|
+
label?: string;
|
|
1976
|
+
requiredFeatures?: string[];
|
|
1977
|
+
requiredLimits?: Record<string, number | bigint>;
|
|
1978
|
+
defaultQueue?: gpuGPUQueueDescriptor;
|
|
1979
|
+
}
|
|
1980
|
+
declare interface gpuGPUBufferDescriptor {
|
|
1981
|
+
label: string;
|
|
1982
|
+
size: number | bigint;
|
|
1983
|
+
usage: number;
|
|
1984
|
+
mappedAtCreation: boolean;
|
|
1985
|
+
}
|
|
1986
|
+
declare interface gpuGPUQueueDescriptor {
|
|
1987
|
+
label?: string;
|
|
1988
|
+
}
|
|
1989
|
+
declare abstract class gpuGPUBufferUsage {
|
|
1990
|
+
static readonly MAP_READ: number;
|
|
1991
|
+
static readonly MAP_WRITE: number;
|
|
1992
|
+
static readonly COPY_SRC: number;
|
|
1993
|
+
static readonly COPY_DST: number;
|
|
1994
|
+
static readonly INDEX: number;
|
|
1995
|
+
static readonly VERTEX: number;
|
|
1996
|
+
static readonly UNIFORM: number;
|
|
1997
|
+
static readonly STORAGE: number;
|
|
1998
|
+
static readonly INDIRECT: number;
|
|
1999
|
+
static readonly QUERY_RESOLVE: number;
|
|
2000
|
+
}
|
|
2001
|
+
declare interface gpuGPUBuffer {
|
|
2002
|
+
getMappedRange(size?: number | bigint, param2?: number | bigint): ArrayBuffer;
|
|
2003
|
+
unmap(): void;
|
|
2004
|
+
destroy(): void;
|
|
2005
|
+
mapAsync(
|
|
2006
|
+
mode: number,
|
|
2007
|
+
offset?: number | bigint,
|
|
2008
|
+
size?: number | bigint
|
|
2009
|
+
): Promise<void>;
|
|
2010
|
+
get size(): number | bigint;
|
|
2011
|
+
get usage(): number;
|
|
2012
|
+
get mapState(): string;
|
|
2013
|
+
}
|
|
2014
|
+
declare abstract class gpuGPUShaderStage {
|
|
2015
|
+
static readonly VERTEX: number;
|
|
2016
|
+
static readonly FRAGMENT: number;
|
|
2017
|
+
static readonly COMPUTE: number;
|
|
2018
|
+
}
|
|
2019
|
+
declare interface gpuGPUBindGroupLayoutDescriptor {
|
|
2020
|
+
label?: string;
|
|
2021
|
+
entries: gpuGPUBindGroupLayoutEntry[];
|
|
2022
|
+
}
|
|
2023
|
+
declare interface gpuGPUBindGroupLayoutEntry {
|
|
2024
|
+
binding: number;
|
|
2025
|
+
visibility: number;
|
|
2026
|
+
buffer?: gpuGPUBufferBindingLayout;
|
|
2027
|
+
sampler?: gpuGPUSamplerBindingLayout;
|
|
2028
|
+
texture?: gpuGPUTextureBindingLayout;
|
|
2029
|
+
storageTexture?: gpuGPUStorageTextureBindingLayout;
|
|
2030
|
+
}
|
|
2031
|
+
declare interface gpuGPUStorageTextureBindingLayout {
|
|
2032
|
+
access?: string;
|
|
2033
|
+
format: string;
|
|
2034
|
+
viewDimension?: string;
|
|
2035
|
+
}
|
|
2036
|
+
declare interface gpuGPUTextureBindingLayout {
|
|
2037
|
+
sampleType?: string;
|
|
2038
|
+
viewDimension?: string;
|
|
2039
|
+
multisampled?: boolean;
|
|
2040
|
+
}
|
|
2041
|
+
declare interface gpuGPUSamplerBindingLayout {
|
|
2042
|
+
type?: string;
|
|
2043
|
+
}
|
|
2044
|
+
declare interface gpuGPUBufferBindingLayout {
|
|
2045
|
+
type?: string;
|
|
2046
|
+
hasDynamicOffset?: boolean;
|
|
2047
|
+
minBindingSize?: number | bigint;
|
|
2048
|
+
}
|
|
2049
|
+
declare interface gpuGPUBindGroupLayout {}
|
|
2050
|
+
declare interface gpuGPUBindGroup {}
|
|
2051
|
+
declare interface gpuGPUBindGroupDescriptor {
|
|
2052
|
+
label?: string;
|
|
2053
|
+
layout: gpuGPUBindGroupLayout;
|
|
2054
|
+
entries: gpuGPUBindGroupEntry[];
|
|
2055
|
+
}
|
|
2056
|
+
declare interface gpuGPUBindGroupEntry {
|
|
2057
|
+
binding: number;
|
|
2058
|
+
resource: gpuGPUBufferBinding | gpuGPUSampler;
|
|
2059
|
+
}
|
|
2060
|
+
declare interface gpuGPUBufferBinding {
|
|
2061
|
+
buffer: gpuGPUBuffer;
|
|
2062
|
+
offset?: number | bigint;
|
|
2063
|
+
size?: number | bigint;
|
|
2064
|
+
}
|
|
2065
|
+
declare interface gpuGPUSampler {}
|
|
2066
|
+
declare interface gpuGPUSamplerDescriptor {
|
|
2067
|
+
label?: string;
|
|
2068
|
+
addressModeU?: string;
|
|
2069
|
+
addressModeV?: string;
|
|
2070
|
+
addressModeW?: string;
|
|
2071
|
+
magFilter?: string;
|
|
2072
|
+
minFilter?: string;
|
|
2073
|
+
mipmapFilter?: string;
|
|
2074
|
+
lodMinClamp?: number;
|
|
2075
|
+
lodMaxClamp?: number;
|
|
2076
|
+
compare: string;
|
|
2077
|
+
maxAnisotropy?: number;
|
|
2078
|
+
}
|
|
2079
|
+
declare interface gpuGPUShaderModule {
|
|
2080
|
+
getCompilationInfo(): Promise<gpuGPUCompilationInfo>;
|
|
2081
|
+
}
|
|
2082
|
+
declare interface gpuGPUShaderModuleDescriptor {
|
|
2083
|
+
label?: string;
|
|
2084
|
+
code: string;
|
|
2085
|
+
}
|
|
2086
|
+
declare interface gpuGPUPipelineLayout {}
|
|
2087
|
+
declare interface gpuGPUPipelineLayoutDescriptor {
|
|
2088
|
+
label?: string;
|
|
2089
|
+
bindGroupLayouts: gpuGPUBindGroupLayout[];
|
|
2090
|
+
}
|
|
2091
|
+
declare interface gpuGPUComputePipeline {
|
|
2092
|
+
getBindGroupLayout(index: number): gpuGPUBindGroupLayout;
|
|
2093
|
+
}
|
|
2094
|
+
declare interface gpuGPUComputePipelineDescriptor {
|
|
2095
|
+
label?: string;
|
|
2096
|
+
compute: gpuGPUProgrammableStage;
|
|
2097
|
+
layout: string | gpuGPUPipelineLayout;
|
|
2098
|
+
}
|
|
2099
|
+
declare interface gpuGPUProgrammableStage {
|
|
2100
|
+
module: gpuGPUShaderModule;
|
|
2101
|
+
entryPoint: string;
|
|
2102
|
+
constants?: Record<string, number>;
|
|
2103
|
+
}
|
|
2104
|
+
declare interface gpuGPUCommandEncoder {
|
|
2105
|
+
get label(): string;
|
|
2106
|
+
beginComputePass(
|
|
2107
|
+
descriptor?: gpuGPUComputePassDescriptor
|
|
2108
|
+
): gpuGPUComputePassEncoder;
|
|
2109
|
+
copyBufferToBuffer(
|
|
2110
|
+
source: gpuGPUBuffer,
|
|
2111
|
+
sourceOffset: number | bigint,
|
|
2112
|
+
destination: gpuGPUBuffer,
|
|
2113
|
+
destinationOffset: number | bigint,
|
|
2114
|
+
size: number | bigint
|
|
2115
|
+
): void;
|
|
2116
|
+
finish(param0?: gpuGPUCommandBufferDescriptor): gpuGPUCommandBuffer;
|
|
2117
|
+
}
|
|
2118
|
+
declare interface gpuGPUCommandEncoderDescriptor {
|
|
2119
|
+
label?: string;
|
|
2120
|
+
}
|
|
2121
|
+
declare interface gpuGPUComputePassEncoder {
|
|
2122
|
+
setPipeline(pipeline: gpuGPUComputePipeline): void;
|
|
2123
|
+
setBindGroup(
|
|
2124
|
+
index: number,
|
|
2125
|
+
bindGroup: gpuGPUBindGroup | null,
|
|
2126
|
+
dynamicOffsets?: Iterable<number>
|
|
2127
|
+
): void;
|
|
2128
|
+
dispatchWorkgroups(
|
|
2129
|
+
workgroupCountX: number,
|
|
2130
|
+
workgroupCountY?: number,
|
|
2131
|
+
workgroupCountZ?: number
|
|
2132
|
+
): void;
|
|
2133
|
+
end(): void;
|
|
2134
|
+
}
|
|
2135
|
+
declare interface gpuGPUComputePassDescriptor {
|
|
2136
|
+
label?: string;
|
|
2137
|
+
timestampWrites?: gpuGPUComputePassTimestampWrite[];
|
|
2138
|
+
}
|
|
2139
|
+
declare interface gpuGPUQuerySet {}
|
|
2140
|
+
declare interface gpuGPUQuerySetDescriptor {
|
|
2141
|
+
label?: string;
|
|
2142
|
+
}
|
|
2143
|
+
declare interface gpuGPUComputePassTimestampWrite {
|
|
2144
|
+
querySet: gpuGPUQuerySet;
|
|
2145
|
+
queryIndex: number;
|
|
2146
|
+
location: string;
|
|
2147
|
+
}
|
|
2148
|
+
declare interface gpuGPUCommandBufferDescriptor {
|
|
2149
|
+
label?: string;
|
|
2150
|
+
}
|
|
2151
|
+
declare interface gpuGPUCommandBuffer {}
|
|
2152
|
+
declare interface gpuGPUQueue {
|
|
2153
|
+
submit(commandBuffers: gpuGPUCommandBuffer[]): void;
|
|
2154
|
+
writeBuffer(
|
|
2155
|
+
buffer: gpuGPUBuffer,
|
|
2156
|
+
bufferOffset: number | bigint,
|
|
2157
|
+
data: ArrayBuffer | ArrayBufferView,
|
|
2158
|
+
dataOffset?: number | bigint,
|
|
2159
|
+
size?: number | bigint
|
|
2160
|
+
): void;
|
|
2161
|
+
}
|
|
2162
|
+
declare abstract class gpuGPUMapMode {
|
|
2163
|
+
static readonly READ: number;
|
|
2164
|
+
static readonly WRITE: number;
|
|
2165
|
+
}
|
|
2166
|
+
declare interface gpuGPURequestAdapterOptions {
|
|
2167
|
+
powerPreference: string;
|
|
2168
|
+
forceFallbackAdapter?: boolean;
|
|
2169
|
+
}
|
|
2170
|
+
declare interface gpuGPUAdapterInfo {
|
|
2171
|
+
get vendor(): string;
|
|
2172
|
+
get architecture(): string;
|
|
2173
|
+
get device(): string;
|
|
2174
|
+
get description(): string;
|
|
2175
|
+
}
|
|
2176
|
+
declare interface gpuGPUSupportedFeatures {
|
|
2177
|
+
has(name: string): boolean;
|
|
2178
|
+
keys(): string[];
|
|
2179
|
+
}
|
|
2180
|
+
declare interface gpuGPUSupportedLimits {
|
|
2181
|
+
get maxTextureDimension1D(): number;
|
|
2182
|
+
get maxTextureDimension2D(): number;
|
|
2183
|
+
get maxTextureDimension3D(): number;
|
|
2184
|
+
get maxTextureArrayLayers(): number;
|
|
2185
|
+
get maxBindGroups(): number;
|
|
2186
|
+
get maxBindingsPerBindGroup(): number;
|
|
2187
|
+
get maxDynamicUniformBuffersPerPipelineLayout(): number;
|
|
2188
|
+
get maxDynamicStorageBuffersPerPipelineLayout(): number;
|
|
2189
|
+
get maxSampledTexturesPerShaderStage(): number;
|
|
2190
|
+
get maxSamplersPerShaderStage(): number;
|
|
2191
|
+
get maxStorageBuffersPerShaderStage(): number;
|
|
2192
|
+
get maxStorageTexturesPerShaderStage(): number;
|
|
2193
|
+
get maxUniformBuffersPerShaderStage(): number;
|
|
2194
|
+
get maxUniformBufferBindingSize(): number | bigint;
|
|
2195
|
+
get maxStorageBufferBindingSize(): number | bigint;
|
|
2196
|
+
get minUniformBufferOffsetAlignment(): number;
|
|
2197
|
+
get minStorageBufferOffsetAlignment(): number;
|
|
2198
|
+
get maxVertexBuffers(): number;
|
|
2199
|
+
get maxBufferSize(): number | bigint;
|
|
2200
|
+
get maxVertexAttributes(): number;
|
|
2201
|
+
get maxVertexBufferArrayStride(): number;
|
|
2202
|
+
get maxInterStageShaderComponents(): number;
|
|
2203
|
+
get maxInterStageShaderVariables(): number;
|
|
2204
|
+
get maxColorAttachments(): number;
|
|
2205
|
+
get maxColorAttachmentBytesPerSample(): number;
|
|
2206
|
+
get maxComputeWorkgroupStorageSize(): number;
|
|
2207
|
+
get maxComputeInvocationsPerWorkgroup(): number;
|
|
2208
|
+
get maxComputeWorkgroupSizeX(): number;
|
|
2209
|
+
get maxComputeWorkgroupSizeY(): number;
|
|
2210
|
+
get maxComputeWorkgroupSizeZ(): number;
|
|
2211
|
+
get maxComputeWorkgroupsPerDimension(): number;
|
|
2212
|
+
}
|
|
2213
|
+
declare abstract class gpuGPUError {
|
|
2214
|
+
get message(): string;
|
|
2215
|
+
}
|
|
2216
|
+
declare abstract class gpuGPUOutOfMemoryError extends gpuGPUError {}
|
|
2217
|
+
declare abstract class gpuGPUInternalError extends gpuGPUError {}
|
|
2218
|
+
declare abstract class gpuGPUValidationError extends gpuGPUError {}
|
|
2219
|
+
declare abstract class gpuGPUDeviceLostInfo {
|
|
2220
|
+
get message(): string;
|
|
2221
|
+
get reason(): string;
|
|
2222
|
+
}
|
|
2223
|
+
declare interface gpuGPUCompilationMessage {
|
|
2224
|
+
get message(): string;
|
|
2225
|
+
get type(): string;
|
|
2226
|
+
get lineNum(): number;
|
|
2227
|
+
get linePos(): number;
|
|
2228
|
+
get offset(): number;
|
|
2229
|
+
get length(): number;
|
|
2230
|
+
}
|
|
2231
|
+
declare interface gpuGPUCompilationInfo {
|
|
2232
|
+
get messages(): gpuGPUCompilationMessage[];
|
|
2233
|
+
}
|
|
1926
2234
|
declare interface BasicImageTransformations {
|
|
1927
2235
|
/**
|
|
1928
2236
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2894,9 +3202,6 @@ declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
|
2894
3202
|
declare type CfProperties<HostMetadata = unknown> =
|
|
2895
3203
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2896
3204
|
| RequestInitCfProperties;
|
|
2897
|
-
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2898
|
-
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2899
|
-
// https://opensource.org/licenses/Apache-2.0
|
|
2900
3205
|
declare interface D1Result<T = unknown> {
|
|
2901
3206
|
results: T[];
|
|
2902
3207
|
success: true;
|
|
@@ -2921,9 +3226,6 @@ declare abstract class D1PreparedStatement {
|
|
|
2921
3226
|
all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
2922
3227
|
raw<T = unknown[]>(): Promise<T[]>;
|
|
2923
3228
|
}
|
|
2924
|
-
// Copyright (c) 2023 Cloudflare, Inc.
|
|
2925
|
-
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2926
|
-
// https://opensource.org/licenses/Apache-2.0
|
|
2927
3229
|
/**
|
|
2928
3230
|
* An email message that can be sent from a Worker.
|
|
2929
3231
|
*/
|
|
@@ -2988,9 +3290,53 @@ declare module "cloudflare:email" {
|
|
|
2988
3290
|
};
|
|
2989
3291
|
export { _EmailMessage as EmailMessage };
|
|
2990
3292
|
}
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
3293
|
+
declare interface Hyperdrive {
|
|
3294
|
+
/**
|
|
3295
|
+
* Connect directly to Hyperdrive as if it's your database, returning a TCP socket.
|
|
3296
|
+
*
|
|
3297
|
+
* Calling this method returns an idential socket to if you call
|
|
3298
|
+
* `connect("host:port")` using the `host` and `port` fields from this object.
|
|
3299
|
+
* Pick whichever approach works better with your preferred DB client library.
|
|
3300
|
+
*
|
|
3301
|
+
* Note that this socket is not yet authenticated -- it's expected that your
|
|
3302
|
+
* code (or preferably, the client library of your choice) will authenticate
|
|
3303
|
+
* using the information in this class's readonly fields.
|
|
3304
|
+
*/
|
|
3305
|
+
connect(): Socket;
|
|
3306
|
+
/**
|
|
3307
|
+
* A valid DB connection string that can be passed straight into the typical
|
|
3308
|
+
* client library/driver/ORM. This will typically be the easiest way to use
|
|
3309
|
+
* Hyperdrive.
|
|
3310
|
+
*/
|
|
3311
|
+
readonly connectionString: string;
|
|
3312
|
+
/*
|
|
3313
|
+
* A randomly generated hostname that is only valid within the context of the
|
|
3314
|
+
* currently running Worker which, when passed into `connect()` function from
|
|
3315
|
+
* the "cloudflare:sockets" module, will connect to the Hyperdrive instance
|
|
3316
|
+
* for your database.
|
|
3317
|
+
*/
|
|
3318
|
+
readonly host: string;
|
|
3319
|
+
/*
|
|
3320
|
+
* The port that must be paired the the host field when connecting.
|
|
3321
|
+
*/
|
|
3322
|
+
readonly port: string;
|
|
3323
|
+
/*
|
|
3324
|
+
* The username to use when authenticating to your database via Hyperdrive.
|
|
3325
|
+
* Unlike the host and password, this will be the same every time
|
|
3326
|
+
*/
|
|
3327
|
+
readonly user: string;
|
|
3328
|
+
/*
|
|
3329
|
+
* The randomly generated password to use when authenticating to your
|
|
3330
|
+
* database via Hyperdrive. Like the host field, this password is only valid
|
|
3331
|
+
* within the context of the currently running Worker instance from which
|
|
3332
|
+
* it's read.
|
|
3333
|
+
*/
|
|
3334
|
+
readonly password: string;
|
|
3335
|
+
/*
|
|
3336
|
+
* The name of the database to connect to.
|
|
3337
|
+
*/
|
|
3338
|
+
readonly database: string;
|
|
3339
|
+
}
|
|
2994
3340
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2995
3341
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2996
3342
|
request: Request;
|
|
@@ -3037,13 +3383,10 @@ declare type PagesPluginFunction<
|
|
|
3037
3383
|
declare module "assets:*" {
|
|
3038
3384
|
export const onRequest: PagesFunction;
|
|
3039
3385
|
}
|
|
3040
|
-
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3041
|
-
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3042
|
-
// https://opensource.org/licenses/Apache-2.0
|
|
3043
|
-
// https://developers.cloudflare.com/pub-sub/
|
|
3044
3386
|
// PubSubMessage represents an incoming PubSub message.
|
|
3045
3387
|
// The message includes metadata about the broker, the client, and the payload
|
|
3046
3388
|
// itself.
|
|
3389
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
3047
3390
|
declare interface PubSubMessage {
|
|
3048
3391
|
// Message ID
|
|
3049
3392
|
readonly mid: number;
|
|
@@ -3074,9 +3417,6 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
3074
3417
|
// Key Identifier of the JWK
|
|
3075
3418
|
readonly kid: string;
|
|
3076
3419
|
}
|
|
3077
|
-
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3078
|
-
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3079
|
-
// https://opensource.org/licenses/Apache-2.0
|
|
3080
3420
|
declare module "cloudflare:sockets" {
|
|
3081
3421
|
function _connect(
|
|
3082
3422
|
address: string | SocketAddress,
|
|
@@ -3084,10 +3424,141 @@ declare module "cloudflare:sockets" {
|
|
|
3084
3424
|
): Socket;
|
|
3085
3425
|
export { _connect as connect };
|
|
3086
3426
|
}
|
|
3087
|
-
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3427
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
3088
3428
|
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3089
3429
|
// https://opensource.org/licenses/Apache-2.0
|
|
3090
|
-
|
|
3430
|
+
/**
|
|
3431
|
+
* Additional information to associate with a vector.
|
|
3432
|
+
*/
|
|
3433
|
+
declare type VectorizeVectorMetadata =
|
|
3434
|
+
| string
|
|
3435
|
+
| number
|
|
3436
|
+
| boolean
|
|
3437
|
+
| string[]
|
|
3438
|
+
| Record<string, string | number | boolean | string[]>;
|
|
3439
|
+
declare type VectorFloatArray = Float32Array | Float64Array;
|
|
3440
|
+
declare interface VectorizeError {
|
|
3441
|
+
code?: number;
|
|
3442
|
+
error: string;
|
|
3443
|
+
}
|
|
3444
|
+
/**
|
|
3445
|
+
* Supported distance metrics for an index.
|
|
3446
|
+
* Distance metrics determine how other "similar" vectors are determined.
|
|
3447
|
+
*/
|
|
3448
|
+
declare type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
3449
|
+
declare interface VectorizeQueryOptions {
|
|
3450
|
+
topK?: number;
|
|
3451
|
+
namespace?: string;
|
|
3452
|
+
returnVectors?: boolean;
|
|
3453
|
+
}
|
|
3454
|
+
/**
|
|
3455
|
+
* Information about the configuration of an index.
|
|
3456
|
+
*/
|
|
3457
|
+
declare type VectorizeIndexConfig =
|
|
3458
|
+
| {
|
|
3459
|
+
dimensions: number;
|
|
3460
|
+
metric: VectorizeDistanceMetric;
|
|
3461
|
+
}
|
|
3462
|
+
| {
|
|
3463
|
+
preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity
|
|
3464
|
+
};
|
|
3465
|
+
/**
|
|
3466
|
+
* Metadata about an existing index.
|
|
3467
|
+
*/
|
|
3468
|
+
declare interface VectorizeIndexDetails {
|
|
3469
|
+
/** The unique ID of the index */
|
|
3470
|
+
readonly id: string;
|
|
3471
|
+
/** The name of the index. */
|
|
3472
|
+
name: string;
|
|
3473
|
+
/** (optional) A human readable description for the index. */
|
|
3474
|
+
description?: string;
|
|
3475
|
+
/** The index configuration, including the dimension size and distance metric. */
|
|
3476
|
+
config: VectorizeIndexConfig;
|
|
3477
|
+
/** The number of records containing vectors within the index. */
|
|
3478
|
+
vectorsCount: number;
|
|
3479
|
+
}
|
|
3480
|
+
/**
|
|
3481
|
+
* Represents a single vector value set along with its associated metadata.
|
|
3482
|
+
*/
|
|
3483
|
+
declare interface VectorizeVector {
|
|
3484
|
+
/** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */
|
|
3485
|
+
id: string;
|
|
3486
|
+
/** The vector values */
|
|
3487
|
+
values: VectorFloatArray | number[];
|
|
3488
|
+
/** The namespace this vector belongs to. */
|
|
3489
|
+
namespace?: string;
|
|
3490
|
+
/** Metadata associated with the binding. Includes the values of the other fields and potentially additional details. */
|
|
3491
|
+
metadata?: Record<string, VectorizeVectorMetadata>;
|
|
3492
|
+
}
|
|
3493
|
+
/**
|
|
3494
|
+
* Represents a matched vector for a query along with its score and (if specified) the matching vector information.
|
|
3495
|
+
*/
|
|
3496
|
+
declare interface VectorizeMatch {
|
|
3497
|
+
/** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */
|
|
3498
|
+
vectorId: string;
|
|
3499
|
+
/** The score or rank for similarity, when returned as a result */
|
|
3500
|
+
score: number;
|
|
3501
|
+
/** Vector data for the match. Included only if the user specified they want it returned (via {@link VectorizeQueryOptions}). */
|
|
3502
|
+
vector?: VectorizeVector;
|
|
3503
|
+
}
|
|
3504
|
+
/**
|
|
3505
|
+
* A set of vector {@link VectorizeMatch} for a particular query.
|
|
3506
|
+
*/
|
|
3507
|
+
declare interface VectorizeMatches {
|
|
3508
|
+
matches: VectorizeMatch[];
|
|
3509
|
+
count: number;
|
|
3510
|
+
}
|
|
3511
|
+
/**
|
|
3512
|
+
* Results of an operation that performed a mutation on a set of vectors.
|
|
3513
|
+
* Here, `ids` is a list of vectors that were successfully processed.
|
|
3514
|
+
*/
|
|
3515
|
+
declare interface VectorizeVectorMutation {
|
|
3516
|
+
/* List of ids of vectors that were successfully processed. */
|
|
3517
|
+
ids: string[];
|
|
3518
|
+
/* Total count of the number of processed vectors. */
|
|
3519
|
+
count: number;
|
|
3520
|
+
}
|
|
3521
|
+
declare abstract class VectorizeIndex {
|
|
3522
|
+
/**
|
|
3523
|
+
* Get information about the currently bound index.
|
|
3524
|
+
* @returns A promise that resolves with information about the current index.
|
|
3525
|
+
*/
|
|
3526
|
+
public describe(): Promise<VectorizeIndexDetails>;
|
|
3527
|
+
/**
|
|
3528
|
+
* Use the provided vector to perform a similarity search across the index.
|
|
3529
|
+
* @param vector Input vector that will be used to drive the similarity search.
|
|
3530
|
+
* @param options Configuration options to massage the returned data.
|
|
3531
|
+
* @returns A promise that resolves with matched and scored vectors.
|
|
3532
|
+
*/
|
|
3533
|
+
public query(
|
|
3534
|
+
vector: VectorFloatArray | number[],
|
|
3535
|
+
options: VectorizeQueryOptions
|
|
3536
|
+
): Promise<VectorizeMatches>;
|
|
3537
|
+
/**
|
|
3538
|
+
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
3539
|
+
* @param vectors List of vectors that will be inserted.
|
|
3540
|
+
* @returns A promise that resolves with the ids & count of records that were successfully processed.
|
|
3541
|
+
*/
|
|
3542
|
+
public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
|
|
3543
|
+
/**
|
|
3544
|
+
* Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
|
|
3545
|
+
* @param vectors List of vectors that will be upserted.
|
|
3546
|
+
* @returns A promise that resolves with the ids & count of records that were successfully processed.
|
|
3547
|
+
*/
|
|
3548
|
+
public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
|
|
3549
|
+
/**
|
|
3550
|
+
* Delete a list of vectors with a matching id.
|
|
3551
|
+
* @param ids List of vector ids that should be deleted.
|
|
3552
|
+
* @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).
|
|
3553
|
+
*/
|
|
3554
|
+
public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;
|
|
3555
|
+
/**
|
|
3556
|
+
* Get a list of vectors with a matching id.
|
|
3557
|
+
* @param ids List of vector ids that should be returned.
|
|
3558
|
+
* @returns A promise that resolves with the raw unscored vectors matching the id set.
|
|
3559
|
+
*/
|
|
3560
|
+
public getByIds(ids: string[]): Promise<VectorizeVector[]>;
|
|
3561
|
+
}
|
|
3091
3562
|
declare interface DynamicDispatchLimits {
|
|
3092
3563
|
/**
|
|
3093
3564
|
* Limit CPU time in milliseconds.
|