Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
Updated types for 2022-10-13 (#294)
Browse files Browse the repository at this point in the history
* Updated types for 2022-10-13

* fix overrides for iterator

* run prettier
  • Loading branch information
Frederik-Baetens authored Oct 13, 2022
1 parent 576062f commit fba318b
Show file tree
Hide file tree
Showing 4 changed files with 694 additions and 93 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-feet-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/workers-types": minor
---

Updated auto-generated types @ 2022-10-13
130 changes: 109 additions & 21 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,14 @@ declare type CryptoKeyAlgorithmVariant =
| CryptoKeyHmacKeyAlgorithm
| CryptoKeyRsaKeyAlgorithm
| CryptoKeyEllipticKeyAlgorithm
| CryptoKeyVoprfKeyAlgorithm
| CryptoKeyOprfKeyAlgorithm;
| CryptoKeyArbitraryKeyAlgorithm;

interface CryptoKeyArbitraryKeyAlgorithm {
name: string;
hash?: CryptoKeyKeyAlgorithm;
namedCurve?: string;
length?: number;
}

interface CryptoKeyEllipticKeyAlgorithm {
name: string;
Expand All @@ -270,11 +276,6 @@ interface CryptoKeyKeyAlgorithm {
name: string;
}

interface CryptoKeyOprfKeyAlgorithm {
name: string;
namedCurve: string;
}

interface CryptoKeyPair {
publicKey: CryptoKey;
privateKey: CryptoKey;
Expand All @@ -287,12 +288,6 @@ interface CryptoKeyRsaKeyAlgorithm {
hash?: CryptoKeyKeyAlgorithm;
}

interface CryptoKeyVoprfKeyAlgorithm {
name: string;
hash: CryptoKeyKeyAlgorithm;
namedCurve: string;
}

interface D1Database {
prepare(query: string): D1PreparedStatement;
dump(): Promise<ArrayBuffer>;
Expand All @@ -304,7 +299,7 @@ interface D1PreparedStatement {
bind(...values: any[]): D1PreparedStatement;
first<T = unknown>(colName?: string): Promise<T>;
run<T = unknown>(): Promise<D1Result<T>>;
all<T = unknown>(): Promise<D1Result<T[]>>;
all<T = unknown>(): Promise<D1Result<T>>;
raw<T = unknown>(): Promise<T[]>;
}

Expand Down Expand Up @@ -698,8 +693,8 @@ declare class FormData {
forEach<This = unknown>(
callback: (
this: This,
key: string,
value: File | string,
key: string,
parent: FormData
) => void,
thisArg?: This
Expand Down Expand Up @@ -739,7 +734,7 @@ declare class Headers {
append(name: string, value: string): void;
delete(name: string): void;
forEach<This = unknown>(
callback: (this: This, key: string, value: string, parent: Headers) => void,
callback: (this: This, value: string, key: string, parent: Headers) => void,
thisArg?: This
): void;
entries(): IterableIterator<[key: string, value: string]>;
Expand Down Expand Up @@ -784,7 +779,7 @@ interface IncomingRequestCfProperties {
botManagement?: IncomingRequestCfPropertiesBotManagement;
city?: string;
clientAcceptEncoding?: string;
clientTcpRtt: number;
clientTcpRtt?: number;
clientTrustScore?: number;
/**
* The three-letter airport code of the data center that the request
Expand Down Expand Up @@ -828,6 +823,8 @@ interface IncomingRequestCfProperties {
}

interface IncomingRequestCfPropertiesBotManagement {
corporateProxy: boolean;
ja3Hash?: string;
score: number;
staticResource: boolean;
verifiedBot: boolean;
Expand Down Expand Up @@ -1067,10 +1064,21 @@ interface R2Bucket {
| Blob,
options?: R2PutOptions
): Promise<R2Object>;
delete(key: string): Promise<void>;
delete(keys: string | string[]): Promise<void>;
list(options?: R2ListOptions): Promise<R2Objects>;
}

/**
* The checksums associated with the object.
*/
interface R2Checksums {
md5?: ArrayBuffer;
sha1?: ArrayBuffer;
sha256?: ArrayBuffer;
sha384?: ArrayBuffer;
sha512?: ArrayBuffer;
}

/**
* Perform the operation conditionally based on meeting the defined criteria.
*/
Expand Down Expand Up @@ -1141,6 +1149,7 @@ declare abstract class R2Object {
readonly size: number;
readonly etag: string;
readonly httpEtag: string;
readonly checksums: R2Checksums;
readonly uploaded: Date;
readonly httpMetadata?: R2HTTPMetadata;
readonly customMetadata?: Record<string, string>;
Expand Down Expand Up @@ -1168,9 +1177,14 @@ interface R2Objects {
}

interface R2PutOptions {
onlyIf?: R2Conditional | Headers;
httpMetadata?: R2HTTPMetadata | Headers;
customMetadata?: Record<string, string>;
md5?: ArrayBuffer | string;
sha1?: ArrayBuffer | string;
sha256?: ArrayBuffer | string;
sha384?: ArrayBuffer | string;
sha512?: ArrayBuffer | string;
}

declare type R2Range =
Expand Down Expand Up @@ -1404,8 +1418,10 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
* - json: instead of generating an image, outputs information about the
* image, in JSON format. The JSON object will contain image size
* (before and after resizing), source image’s MIME type, file size, etc.
* - jpeg: generate images in JPEG format.
* - png: generate images in PNG format.
*/
format?: "avif" | "webp" | "json";
format?: "avif" | "webp" | "json" | "jpeg" | "png";
/**
* Whether to preserve animation frames from input files. Default is true.
* Setting it to false reduces animations to still images. This setting is
Expand Down Expand Up @@ -1445,6 +1461,12 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
* entry is the topmost layer).
*/
draw?: RequestInitCfPropertiesImageDraw[];
/**
* Fetching image from authenticated origin. Setting this property will
* pass authentication headers (Authorization, Cookie, etc.) through to
* the origin.
*/
"origin-auth"?: "share-publicly";
}

interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
Expand Down Expand Up @@ -1593,7 +1615,7 @@ interface ServiceWorkerGlobalScopeStructuredCloneOptions {
declare type StreamPipeOptions = PipeToOptions;

interface StreamQueuingStrategy {
highWaterMark?: number;
highWaterMark?: bigint;
size(chunk: any): number;
}

Expand Down Expand Up @@ -1785,6 +1807,68 @@ declare class TextEncoderStream extends TransformStream {
constructor();
}

interface TraceEvent extends ExtendableEvent {
readonly traces: TraceItem[];
}

interface TraceException {
readonly timestamp: number;
readonly message: string;
readonly name: string;
}

interface TraceItem {
readonly event: TraceItemEventInfo | null;
readonly eventTimestamp: number | null;
readonly logs: TraceLog[];
readonly exceptions: TraceException[];
readonly scriptName: string | null;
readonly dispatchNamespace?: string;
readonly outcome: string;
}

interface TraceItemAlarmEventInfo {
readonly scheduledTime: Date;
}

declare type TraceItemEventInfo =
| TraceItemFetchEventInfo
| TraceItemScheduledEventInfo
| TraceItemAlarmEventInfo;

interface TraceItemFetchEventInfo {
readonly response?: TraceItemFetchEventInfoResponse;
readonly request: TraceItemFetchEventInfoRequest;
}

interface TraceItemFetchEventInfoRequest {
readonly cf?: Object;
readonly headers: Record<string, string>;
readonly method: string;
readonly url: string;
getUnredacted(): TraceItemFetchEventInfoRequest;
}

interface TraceItemFetchEventInfoResponse {
readonly status: number;
}

interface TraceItemScheduledEventInfo {
readonly scheduledTime: number;
readonly cron: string;
}

interface TraceLog {
readonly timestamp: number;
readonly level: string;
readonly message: Object;
}

interface TraceMetrics {
readonly cpuTime: number;
readonly wallTime: number;
}

declare class TransformStream {
constructor(
maybeTransformer?: Transformer,
Expand Down Expand Up @@ -1889,8 +1973,8 @@ declare class URLSearchParams {
forEach<This = unknown>(
callback: (
this: This,
key: string,
value: string,
key: string,
parent: URLSearchParams
) => void,
thisArg?: This
Expand Down Expand Up @@ -1933,6 +2017,10 @@ interface UnderlyingSource {
cancel?(reason?: any): any;
}

interface UnsafeTraceMetrics {
fromTrace(arg4: TraceItem): TraceMetrics;
}

declare class WebSocket extends EventTarget<WebSocketEventMap> {
constructor(url: string, protocols?: string[] | string);
accept(): void;
Expand Down
9 changes: 9 additions & 0 deletions overrides/http.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ declare class FormData {
entries(): IterableIterator<[key: string, value: File | string]>;
[Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;

keys(): IterableIterator<string>;
values(): IterableIterator<string | File>;

forEach<This = unknown>(
callback: (
this: This,
Expand All @@ -27,6 +30,9 @@ declare class Headers {
entries(): IterableIterator<[key: string, value: string]>;
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;

keys(): IterableIterator<string>;
values(): IterableIterator<string>;

forEach<This = unknown>(
callback: (this: This, value: string, key: string, parent: Headers) => void,
thisArg?: This
Expand All @@ -44,6 +50,9 @@ declare class URLSearchParams {
entries(): IterableIterator<[key: string, value: string]>;
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;

keys(): IterableIterator<string>;
values(): IterableIterator<string>;

forEach<This = unknown>(
callback: (
this: This,
Expand Down
Loading

0 comments on commit fba318b

Please sign in to comment.