@workers-community/workers-types 4.20250910.0 → 4.20250911.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/index.d.ts +94 -12
- package/index.ts +94 -12
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -294,6 +294,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
294
294
|
FixedLengthStream: typeof FixedLengthStream;
|
|
295
295
|
IdentityTransformStream: typeof IdentityTransformStream;
|
|
296
296
|
HTMLRewriter: typeof HTMLRewriter;
|
|
297
|
+
Performance: typeof Performance;
|
|
297
298
|
}
|
|
298
299
|
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
299
300
|
type: Type,
|
|
@@ -466,18 +467,6 @@ declare abstract class Navigator {
|
|
|
466
467
|
readonly userAgent: string;
|
|
467
468
|
readonly hardwareConcurrency: number;
|
|
468
469
|
}
|
|
469
|
-
/**
|
|
470
|
-
* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
|
|
471
|
-
* as well as timing of subrequests and other operations.
|
|
472
|
-
*
|
|
473
|
-
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
474
|
-
*/
|
|
475
|
-
interface Performance {
|
|
476
|
-
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
|
|
477
|
-
readonly timeOrigin: number;
|
|
478
|
-
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
|
|
479
|
-
now(): number;
|
|
480
|
-
}
|
|
481
470
|
interface AlarmInvocationInfo {
|
|
482
471
|
readonly isRetry: boolean;
|
|
483
472
|
readonly retryCount: number;
|
|
@@ -3105,6 +3094,99 @@ interface SyncKvListOptions {
|
|
|
3105
3094
|
reverse?: boolean;
|
|
3106
3095
|
limit?: number;
|
|
3107
3096
|
}
|
|
3097
|
+
/**
|
|
3098
|
+
* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
|
|
3099
|
+
* as well as timing of subrequests and other operations.
|
|
3100
|
+
*
|
|
3101
|
+
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
3102
|
+
*/
|
|
3103
|
+
declare abstract class Performance extends EventTarget {
|
|
3104
|
+
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
|
|
3105
|
+
get timeOrigin(): number;
|
|
3106
|
+
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
|
|
3107
|
+
now(): number;
|
|
3108
|
+
get eventCounts(): EventCounts;
|
|
3109
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearMarks) */
|
|
3110
|
+
clearMarks(name?: string): void;
|
|
3111
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearMeasures) */
|
|
3112
|
+
clearMeasures(name?: string): void;
|
|
3113
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearResourceTimings) */
|
|
3114
|
+
clearResourceTimings(): void;
|
|
3115
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntries) */
|
|
3116
|
+
getEntries(): PerformanceEntry[];
|
|
3117
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntriesByName) */
|
|
3118
|
+
getEntriesByName(name: string, type: string): PerformanceEntry[];
|
|
3119
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntriesByType) */
|
|
3120
|
+
getEntriesByType(type: string): PerformanceEntry[];
|
|
3121
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/mark) */
|
|
3122
|
+
mark(name: string, options?: PerformanceMarkOptions): PerformanceMark;
|
|
3123
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/measure) */
|
|
3124
|
+
measure(
|
|
3125
|
+
measureName: string,
|
|
3126
|
+
measureOptionsOrStartMark: PerformanceMeasureOptions | string,
|
|
3127
|
+
maybeEndMark?: string,
|
|
3128
|
+
): PerformanceMeasure;
|
|
3129
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/setResourceTimingBufferSize) */
|
|
3130
|
+
setResourceTimingBufferSize(size: number): void;
|
|
3131
|
+
}
|
|
3132
|
+
/**
|
|
3133
|
+
* PerformanceMark is an abstract interface for PerformanceEntry objects with an entryType of "mark". Entries of this type are created by calling performance.mark() to add a named DOMHighResTimeStamp (the mark) to the browser's performance timeline.
|
|
3134
|
+
*
|
|
3135
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMark)
|
|
3136
|
+
*/
|
|
3137
|
+
interface PerformanceMark extends PerformanceEntry {
|
|
3138
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMark/detail) */
|
|
3139
|
+
get detail(): any;
|
|
3140
|
+
}
|
|
3141
|
+
/**
|
|
3142
|
+
* PerformanceMeasure is an abstract interface for PerformanceEntry objects with an entryType of "measure". Entries of this type are created by calling performance.measure() to add a named DOMHighResTimeStamp (the measure) between two marks to the browser's performance timeline.
|
|
3143
|
+
*
|
|
3144
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMeasure)
|
|
3145
|
+
*/
|
|
3146
|
+
interface PerformanceMeasure extends PerformanceEntry {
|
|
3147
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMeasure/detail) */
|
|
3148
|
+
get detail(): any;
|
|
3149
|
+
}
|
|
3150
|
+
interface PerformanceMarkOptions {
|
|
3151
|
+
detail?: any;
|
|
3152
|
+
startTime?: number;
|
|
3153
|
+
}
|
|
3154
|
+
interface PerformanceMeasureOptions {
|
|
3155
|
+
detail?: any;
|
|
3156
|
+
start?: number;
|
|
3157
|
+
duration?: number;
|
|
3158
|
+
end?: number;
|
|
3159
|
+
}
|
|
3160
|
+
/**
|
|
3161
|
+
* Encapsulates a single performance metric that is part of the performance timeline. A performance entry can be directly created by making a performance mark or measure (for example by calling the mark() method) at an explicit point in an application. Performance entries are also created in indirect ways such as loading a resource (such as an image).
|
|
3162
|
+
*
|
|
3163
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry)
|
|
3164
|
+
*/
|
|
3165
|
+
declare abstract class PerformanceEntry {
|
|
3166
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/name) */
|
|
3167
|
+
get name(): string;
|
|
3168
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/entryType) */
|
|
3169
|
+
get entryType(): string;
|
|
3170
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/startTime) */
|
|
3171
|
+
get startTime(): number;
|
|
3172
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/duration) */
|
|
3173
|
+
get duration(): number;
|
|
3174
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/toJSON) */
|
|
3175
|
+
toJSON(): any;
|
|
3176
|
+
}
|
|
3177
|
+
interface EventCounts {
|
|
3178
|
+
get size(): number;
|
|
3179
|
+
get(eventType: string): number | undefined;
|
|
3180
|
+
has(eventType: string): boolean;
|
|
3181
|
+
entries(): IterableIterator<string[]>;
|
|
3182
|
+
keys(): IterableIterator<string>;
|
|
3183
|
+
values(): IterableIterator<number>;
|
|
3184
|
+
forEach(
|
|
3185
|
+
param1: (param0: number, param1: string, param2: EventCounts) => void,
|
|
3186
|
+
param2?: any,
|
|
3187
|
+
): void;
|
|
3188
|
+
[Symbol.iterator](): IterableIterator<string[]>;
|
|
3189
|
+
}
|
|
3108
3190
|
type AiImageClassificationInput = {
|
|
3109
3191
|
image: number[];
|
|
3110
3192
|
};
|
package/index.ts
CHANGED
|
@@ -294,6 +294,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
294
294
|
FixedLengthStream: typeof FixedLengthStream;
|
|
295
295
|
IdentityTransformStream: typeof IdentityTransformStream;
|
|
296
296
|
HTMLRewriter: typeof HTMLRewriter;
|
|
297
|
+
Performance: typeof Performance;
|
|
297
298
|
}
|
|
298
299
|
export declare function addEventListener<
|
|
299
300
|
Type extends keyof WorkerGlobalScopeEventMap,
|
|
@@ -471,18 +472,6 @@ export declare abstract class Navigator {
|
|
|
471
472
|
readonly userAgent: string;
|
|
472
473
|
readonly hardwareConcurrency: number;
|
|
473
474
|
}
|
|
474
|
-
/**
|
|
475
|
-
* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
|
|
476
|
-
* as well as timing of subrequests and other operations.
|
|
477
|
-
*
|
|
478
|
-
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
479
|
-
*/
|
|
480
|
-
export interface Performance {
|
|
481
|
-
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
|
|
482
|
-
readonly timeOrigin: number;
|
|
483
|
-
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
|
|
484
|
-
now(): number;
|
|
485
|
-
}
|
|
486
475
|
export interface AlarmInvocationInfo {
|
|
487
476
|
readonly isRetry: boolean;
|
|
488
477
|
readonly retryCount: number;
|
|
@@ -3116,6 +3105,99 @@ export interface SyncKvListOptions {
|
|
|
3116
3105
|
reverse?: boolean;
|
|
3117
3106
|
limit?: number;
|
|
3118
3107
|
}
|
|
3108
|
+
/**
|
|
3109
|
+
* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
|
|
3110
|
+
* as well as timing of subrequests and other operations.
|
|
3111
|
+
*
|
|
3112
|
+
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
3113
|
+
*/
|
|
3114
|
+
export declare abstract class Performance extends EventTarget {
|
|
3115
|
+
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
|
|
3116
|
+
get timeOrigin(): number;
|
|
3117
|
+
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
|
|
3118
|
+
now(): number;
|
|
3119
|
+
get eventCounts(): EventCounts;
|
|
3120
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearMarks) */
|
|
3121
|
+
clearMarks(name?: string): void;
|
|
3122
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearMeasures) */
|
|
3123
|
+
clearMeasures(name?: string): void;
|
|
3124
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/clearResourceTimings) */
|
|
3125
|
+
clearResourceTimings(): void;
|
|
3126
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntries) */
|
|
3127
|
+
getEntries(): PerformanceEntry[];
|
|
3128
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntriesByName) */
|
|
3129
|
+
getEntriesByName(name: string, type: string): PerformanceEntry[];
|
|
3130
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/getEntriesByType) */
|
|
3131
|
+
getEntriesByType(type: string): PerformanceEntry[];
|
|
3132
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/mark) */
|
|
3133
|
+
mark(name: string, options?: PerformanceMarkOptions): PerformanceMark;
|
|
3134
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/measure) */
|
|
3135
|
+
measure(
|
|
3136
|
+
measureName: string,
|
|
3137
|
+
measureOptionsOrStartMark: PerformanceMeasureOptions | string,
|
|
3138
|
+
maybeEndMark?: string,
|
|
3139
|
+
): PerformanceMeasure;
|
|
3140
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/setResourceTimingBufferSize) */
|
|
3141
|
+
setResourceTimingBufferSize(size: number): void;
|
|
3142
|
+
}
|
|
3143
|
+
/**
|
|
3144
|
+
* PerformanceMark is an abstract interface for PerformanceEntry objects with an entryType of "mark". Entries of this type are created by calling performance.mark() to add a named DOMHighResTimeStamp (the mark) to the browser's performance timeline.
|
|
3145
|
+
*
|
|
3146
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMark)
|
|
3147
|
+
*/
|
|
3148
|
+
export interface PerformanceMark extends PerformanceEntry {
|
|
3149
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMark/detail) */
|
|
3150
|
+
get detail(): any;
|
|
3151
|
+
}
|
|
3152
|
+
/**
|
|
3153
|
+
* PerformanceMeasure is an abstract interface for PerformanceEntry objects with an entryType of "measure". Entries of this type are created by calling performance.measure() to add a named DOMHighResTimeStamp (the measure) between two marks to the browser's performance timeline.
|
|
3154
|
+
*
|
|
3155
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMeasure)
|
|
3156
|
+
*/
|
|
3157
|
+
export interface PerformanceMeasure extends PerformanceEntry {
|
|
3158
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMeasure/detail) */
|
|
3159
|
+
get detail(): any;
|
|
3160
|
+
}
|
|
3161
|
+
export interface PerformanceMarkOptions {
|
|
3162
|
+
detail?: any;
|
|
3163
|
+
startTime?: number;
|
|
3164
|
+
}
|
|
3165
|
+
export interface PerformanceMeasureOptions {
|
|
3166
|
+
detail?: any;
|
|
3167
|
+
start?: number;
|
|
3168
|
+
duration?: number;
|
|
3169
|
+
end?: number;
|
|
3170
|
+
}
|
|
3171
|
+
/**
|
|
3172
|
+
* Encapsulates a single performance metric that is part of the performance timeline. A performance entry can be directly created by making a performance mark or measure (for example by calling the mark() method) at an explicit point in an application. Performance entries are also created in indirect ways such as loading a resource (such as an image).
|
|
3173
|
+
*
|
|
3174
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry)
|
|
3175
|
+
*/
|
|
3176
|
+
export declare abstract class PerformanceEntry {
|
|
3177
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/name) */
|
|
3178
|
+
get name(): string;
|
|
3179
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/entryType) */
|
|
3180
|
+
get entryType(): string;
|
|
3181
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/startTime) */
|
|
3182
|
+
get startTime(): number;
|
|
3183
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/duration) */
|
|
3184
|
+
get duration(): number;
|
|
3185
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/toJSON) */
|
|
3186
|
+
toJSON(): any;
|
|
3187
|
+
}
|
|
3188
|
+
export interface EventCounts {
|
|
3189
|
+
get size(): number;
|
|
3190
|
+
get(eventType: string): number | undefined;
|
|
3191
|
+
has(eventType: string): boolean;
|
|
3192
|
+
entries(): IterableIterator<string[]>;
|
|
3193
|
+
keys(): IterableIterator<string>;
|
|
3194
|
+
values(): IterableIterator<number>;
|
|
3195
|
+
forEach(
|
|
3196
|
+
param1: (param0: number, param1: string, param2: EventCounts) => void,
|
|
3197
|
+
param2?: any,
|
|
3198
|
+
): void;
|
|
3199
|
+
[Symbol.iterator](): IterableIterator<string[]>;
|
|
3200
|
+
}
|
|
3119
3201
|
export type AiImageClassificationInput = {
|
|
3120
3202
|
image: number[];
|
|
3121
3203
|
};
|