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