@cloudflare/workers-types 4.20260218.0 → 4.20260226.1
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 +395 -17
- package/2021-11-03/index.ts +395 -17
- package/2022-01-31/index.d.ts +395 -17
- package/2022-01-31/index.ts +395 -17
- package/2022-03-21/index.d.ts +395 -17
- package/2022-03-21/index.ts +395 -17
- package/2022-08-04/index.d.ts +395 -17
- package/2022-08-04/index.ts +395 -17
- package/2022-10-31/index.d.ts +395 -17
- package/2022-10-31/index.ts +395 -17
- package/2022-11-30/index.d.ts +395 -17
- package/2022-11-30/index.ts +395 -17
- package/2023-03-01/index.d.ts +395 -17
- package/2023-03-01/index.ts +395 -17
- package/2023-07-01/index.d.ts +395 -17
- package/2023-07-01/index.ts +395 -17
- package/experimental/index.d.ts +442 -20
- package/experimental/index.ts +442 -20
- package/index.d.ts +395 -17
- package/index.ts +395 -17
- package/latest/index.d.ts +395 -17
- package/latest/index.ts +395 -17
- package/oldest/index.d.ts +395 -17
- package/oldest/index.ts +395 -17
- package/package.json +1 -1
package/2022-11-30/index.ts
CHANGED
|
@@ -3852,6 +3852,184 @@ export declare abstract class Performance {
|
|
|
3852
3852
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
|
|
3853
3853
|
now(): number;
|
|
3854
3854
|
}
|
|
3855
|
+
// AI Search V2 API Error Interfaces
|
|
3856
|
+
export interface AiSearchInternalError extends Error {}
|
|
3857
|
+
export interface AiSearchNotFoundError extends Error {}
|
|
3858
|
+
export interface AiSearchNameNotSetError extends Error {}
|
|
3859
|
+
// Filter types (shared with AutoRAG for compatibility)
|
|
3860
|
+
export type ComparisonFilter = {
|
|
3861
|
+
key: string;
|
|
3862
|
+
type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
3863
|
+
value: string | number | boolean;
|
|
3864
|
+
};
|
|
3865
|
+
export type CompoundFilter = {
|
|
3866
|
+
type: "and" | "or";
|
|
3867
|
+
filters: ComparisonFilter[];
|
|
3868
|
+
};
|
|
3869
|
+
// AI Search V2 Request Types
|
|
3870
|
+
export type AiSearchSearchRequest = {
|
|
3871
|
+
messages: Array<{
|
|
3872
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3873
|
+
content: string | null;
|
|
3874
|
+
}>;
|
|
3875
|
+
ai_search_options?: {
|
|
3876
|
+
retrieval?: {
|
|
3877
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3878
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3879
|
+
match_threshold?: number;
|
|
3880
|
+
/** Maximum number of results (1-50, default 10) */
|
|
3881
|
+
max_num_results?: number;
|
|
3882
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3883
|
+
/** Context expansion (0-3, default 0) */
|
|
3884
|
+
context_expansion?: number;
|
|
3885
|
+
[key: string]: unknown;
|
|
3886
|
+
};
|
|
3887
|
+
query_rewrite?: {
|
|
3888
|
+
enabled?: boolean;
|
|
3889
|
+
model?: string;
|
|
3890
|
+
rewrite_prompt?: string;
|
|
3891
|
+
[key: string]: unknown;
|
|
3892
|
+
};
|
|
3893
|
+
reranking?: {
|
|
3894
|
+
/** Enable reranking (default false) */
|
|
3895
|
+
enabled?: boolean;
|
|
3896
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3897
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3898
|
+
match_threshold?: number;
|
|
3899
|
+
[key: string]: unknown;
|
|
3900
|
+
};
|
|
3901
|
+
[key: string]: unknown;
|
|
3902
|
+
};
|
|
3903
|
+
};
|
|
3904
|
+
export type AiSearchChatCompletionsRequest = {
|
|
3905
|
+
messages: Array<{
|
|
3906
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3907
|
+
content: string | null;
|
|
3908
|
+
}>;
|
|
3909
|
+
model?: string;
|
|
3910
|
+
stream?: boolean;
|
|
3911
|
+
ai_search_options?: {
|
|
3912
|
+
retrieval?: {
|
|
3913
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3914
|
+
match_threshold?: number;
|
|
3915
|
+
max_num_results?: number;
|
|
3916
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3917
|
+
context_expansion?: number;
|
|
3918
|
+
[key: string]: unknown;
|
|
3919
|
+
};
|
|
3920
|
+
query_rewrite?: {
|
|
3921
|
+
enabled?: boolean;
|
|
3922
|
+
model?: string;
|
|
3923
|
+
rewrite_prompt?: string;
|
|
3924
|
+
[key: string]: unknown;
|
|
3925
|
+
};
|
|
3926
|
+
reranking?: {
|
|
3927
|
+
enabled?: boolean;
|
|
3928
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3929
|
+
match_threshold?: number;
|
|
3930
|
+
[key: string]: unknown;
|
|
3931
|
+
};
|
|
3932
|
+
[key: string]: unknown;
|
|
3933
|
+
};
|
|
3934
|
+
[key: string]: unknown;
|
|
3935
|
+
};
|
|
3936
|
+
// AI Search V2 Response Types
|
|
3937
|
+
export type AiSearchSearchResponse = {
|
|
3938
|
+
search_query: string;
|
|
3939
|
+
chunks: Array<{
|
|
3940
|
+
id: string;
|
|
3941
|
+
type: string;
|
|
3942
|
+
/** Match score (0-1) */
|
|
3943
|
+
score: number;
|
|
3944
|
+
text: string;
|
|
3945
|
+
item: {
|
|
3946
|
+
timestamp?: number;
|
|
3947
|
+
key: string;
|
|
3948
|
+
metadata?: Record<string, unknown>;
|
|
3949
|
+
};
|
|
3950
|
+
scoring_details?: {
|
|
3951
|
+
/** Keyword match score (0-1) */
|
|
3952
|
+
keyword_score?: number;
|
|
3953
|
+
/** Vector similarity score (0-1) */
|
|
3954
|
+
vector_score?: number;
|
|
3955
|
+
};
|
|
3956
|
+
}>;
|
|
3957
|
+
};
|
|
3958
|
+
export type AiSearchListResponse = Array<{
|
|
3959
|
+
id: string;
|
|
3960
|
+
internal_id?: string;
|
|
3961
|
+
account_id?: string;
|
|
3962
|
+
account_tag?: string;
|
|
3963
|
+
/** Whether the instance is enabled (default true) */
|
|
3964
|
+
enable?: boolean;
|
|
3965
|
+
type?: "r2" | "web-crawler";
|
|
3966
|
+
source?: string;
|
|
3967
|
+
[key: string]: unknown;
|
|
3968
|
+
}>;
|
|
3969
|
+
export type AiSearchConfig = {
|
|
3970
|
+
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3971
|
+
id: string;
|
|
3972
|
+
type: "r2" | "web-crawler";
|
|
3973
|
+
source: string;
|
|
3974
|
+
source_params?: object;
|
|
3975
|
+
/** Token ID (UUID format) */
|
|
3976
|
+
token_id?: string;
|
|
3977
|
+
ai_gateway_id?: string;
|
|
3978
|
+
/** Enable query rewriting (default false) */
|
|
3979
|
+
rewrite_query?: boolean;
|
|
3980
|
+
/** Enable reranking (default false) */
|
|
3981
|
+
reranking?: boolean;
|
|
3982
|
+
embedding_model?: string;
|
|
3983
|
+
ai_search_model?: string;
|
|
3984
|
+
};
|
|
3985
|
+
export type AiSearchInstance = {
|
|
3986
|
+
id: string;
|
|
3987
|
+
enable?: boolean;
|
|
3988
|
+
type?: "r2" | "web-crawler";
|
|
3989
|
+
source?: string;
|
|
3990
|
+
[key: string]: unknown;
|
|
3991
|
+
};
|
|
3992
|
+
// AI Search Instance Service - Instance-level operations
|
|
3993
|
+
export declare abstract class AiSearchInstanceService {
|
|
3994
|
+
/**
|
|
3995
|
+
* Search the AI Search instance for relevant chunks.
|
|
3996
|
+
* @param params Search request with messages and AI search options
|
|
3997
|
+
* @returns Search response with matching chunks
|
|
3998
|
+
*/
|
|
3999
|
+
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4000
|
+
/**
|
|
4001
|
+
* Generate chat completions with AI Search context.
|
|
4002
|
+
* @param params Chat completions request with optional streaming
|
|
4003
|
+
* @returns Response object (if streaming) or chat completion result
|
|
4004
|
+
*/
|
|
4005
|
+
chatCompletions(
|
|
4006
|
+
params: AiSearchChatCompletionsRequest,
|
|
4007
|
+
): Promise<Response | object>;
|
|
4008
|
+
/**
|
|
4009
|
+
* Delete this AI Search instance.
|
|
4010
|
+
*/
|
|
4011
|
+
delete(): Promise<void>;
|
|
4012
|
+
}
|
|
4013
|
+
// AI Search Account Service - Account-level operations
|
|
4014
|
+
export declare abstract class AiSearchAccountService {
|
|
4015
|
+
/**
|
|
4016
|
+
* List all AI Search instances in the account.
|
|
4017
|
+
* @returns Array of AI Search instances
|
|
4018
|
+
*/
|
|
4019
|
+
list(): Promise<AiSearchListResponse>;
|
|
4020
|
+
/**
|
|
4021
|
+
* Get an AI Search instance by ID.
|
|
4022
|
+
* @param name Instance ID
|
|
4023
|
+
* @returns Instance service for performing operations
|
|
4024
|
+
*/
|
|
4025
|
+
get(name: string): AiSearchInstanceService;
|
|
4026
|
+
/**
|
|
4027
|
+
* Create a new AI Search instance.
|
|
4028
|
+
* @param config Instance configuration
|
|
4029
|
+
* @returns Instance service for performing operations
|
|
4030
|
+
*/
|
|
4031
|
+
create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
|
|
4032
|
+
}
|
|
3855
4033
|
export type AiImageClassificationInput = {
|
|
3856
4034
|
image: number[];
|
|
3857
4035
|
};
|
|
@@ -9352,6 +9530,48 @@ export declare abstract class Ai<
|
|
|
9352
9530
|
> {
|
|
9353
9531
|
aiGatewayLogId: string | null;
|
|
9354
9532
|
gateway(gatewayId: string): AiGateway;
|
|
9533
|
+
/**
|
|
9534
|
+
* Access the AI Search API for managing AI-powered search instances.
|
|
9535
|
+
*
|
|
9536
|
+
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
9537
|
+
* - Account-level operations: `list()`, `create()`
|
|
9538
|
+
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
9539
|
+
*
|
|
9540
|
+
* @example
|
|
9541
|
+
* ```typescript
|
|
9542
|
+
* // List all AI Search instances
|
|
9543
|
+
* const instances = await env.AI.aiSearch.list();
|
|
9544
|
+
*
|
|
9545
|
+
* // Search an instance
|
|
9546
|
+
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
9547
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9548
|
+
* ai_search_options: {
|
|
9549
|
+
* retrieval: { max_num_results: 10 }
|
|
9550
|
+
* }
|
|
9551
|
+
* });
|
|
9552
|
+
*
|
|
9553
|
+
* // Generate chat completions with AI Search context
|
|
9554
|
+
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
9555
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9556
|
+
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
9557
|
+
* });
|
|
9558
|
+
* ```
|
|
9559
|
+
*/
|
|
9560
|
+
aiSearch(): AiSearchAccountService;
|
|
9561
|
+
/**
|
|
9562
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9563
|
+
* Use `env.AI.aiSearch` instead for better API design and new features.
|
|
9564
|
+
*
|
|
9565
|
+
* Migration guide:
|
|
9566
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9567
|
+
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
9568
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9569
|
+
*
|
|
9570
|
+
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
9571
|
+
*
|
|
9572
|
+
* @see AiSearchAccountService
|
|
9573
|
+
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
9574
|
+
*/
|
|
9355
9575
|
autorag(autoragId: string): AutoRAG;
|
|
9356
9576
|
run<
|
|
9357
9577
|
Name extends keyof AiModelList,
|
|
@@ -9508,19 +9728,30 @@ export declare abstract class AiGateway {
|
|
|
9508
9728
|
): Promise<Response>;
|
|
9509
9729
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
9510
9730
|
}
|
|
9731
|
+
/**
|
|
9732
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
|
|
9733
|
+
* @see AiSearchInternalError
|
|
9734
|
+
*/
|
|
9511
9735
|
export interface AutoRAGInternalError extends Error {}
|
|
9736
|
+
/**
|
|
9737
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
|
|
9738
|
+
* @see AiSearchNotFoundError
|
|
9739
|
+
*/
|
|
9512
9740
|
export interface AutoRAGNotFoundError extends Error {}
|
|
9741
|
+
/**
|
|
9742
|
+
* @deprecated This error type is no longer used in the AI Search API.
|
|
9743
|
+
*/
|
|
9513
9744
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
9745
|
+
/**
|
|
9746
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
|
|
9747
|
+
* @see AiSearchNameNotSetError
|
|
9748
|
+
*/
|
|
9514
9749
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
export type CompoundFilter = {
|
|
9521
|
-
type: "and" | "or";
|
|
9522
|
-
filters: ComparisonFilter[];
|
|
9523
|
-
};
|
|
9750
|
+
/**
|
|
9751
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9752
|
+
* Use AiSearchSearchRequest with the new API instead.
|
|
9753
|
+
* @see AiSearchSearchRequest
|
|
9754
|
+
*/
|
|
9524
9755
|
export type AutoRagSearchRequest = {
|
|
9525
9756
|
query: string;
|
|
9526
9757
|
filters?: CompoundFilter | ComparisonFilter;
|
|
@@ -9535,16 +9766,31 @@ export type AutoRagSearchRequest = {
|
|
|
9535
9766
|
};
|
|
9536
9767
|
rewrite_query?: boolean;
|
|
9537
9768
|
};
|
|
9769
|
+
/**
|
|
9770
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9771
|
+
* Use AiSearchChatCompletionsRequest with the new API instead.
|
|
9772
|
+
* @see AiSearchChatCompletionsRequest
|
|
9773
|
+
*/
|
|
9538
9774
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
9539
9775
|
stream?: boolean;
|
|
9540
9776
|
system_prompt?: string;
|
|
9541
9777
|
};
|
|
9778
|
+
/**
|
|
9779
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9780
|
+
* Use AiSearchChatCompletionsRequest with stream: true instead.
|
|
9781
|
+
* @see AiSearchChatCompletionsRequest
|
|
9782
|
+
*/
|
|
9542
9783
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
9543
9784
|
AutoRagAiSearchRequest,
|
|
9544
9785
|
"stream"
|
|
9545
9786
|
> & {
|
|
9546
9787
|
stream: true;
|
|
9547
9788
|
};
|
|
9789
|
+
/**
|
|
9790
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9791
|
+
* Use AiSearchSearchResponse with the new API instead.
|
|
9792
|
+
* @see AiSearchSearchResponse
|
|
9793
|
+
*/
|
|
9548
9794
|
export type AutoRagSearchResponse = {
|
|
9549
9795
|
object: "vector_store.search_results.page";
|
|
9550
9796
|
search_query: string;
|
|
@@ -9561,6 +9807,11 @@ export type AutoRagSearchResponse = {
|
|
|
9561
9807
|
has_more: boolean;
|
|
9562
9808
|
next_page: string | null;
|
|
9563
9809
|
};
|
|
9810
|
+
/**
|
|
9811
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9812
|
+
* Use AiSearchListResponse with the new API instead.
|
|
9813
|
+
* @see AiSearchListResponse
|
|
9814
|
+
*/
|
|
9564
9815
|
export type AutoRagListResponse = {
|
|
9565
9816
|
id: string;
|
|
9566
9817
|
enable: boolean;
|
|
@@ -9570,14 +9821,51 @@ export type AutoRagListResponse = {
|
|
|
9570
9821
|
paused: boolean;
|
|
9571
9822
|
status: string;
|
|
9572
9823
|
}[];
|
|
9824
|
+
/**
|
|
9825
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9826
|
+
* The new API returns different response formats for chat completions.
|
|
9827
|
+
*/
|
|
9573
9828
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
9574
9829
|
response: string;
|
|
9575
9830
|
};
|
|
9831
|
+
/**
|
|
9832
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9833
|
+
* Use the new AI Search API instead: `env.AI.aiSearch`
|
|
9834
|
+
*
|
|
9835
|
+
* Migration guide:
|
|
9836
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9837
|
+
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
9838
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9839
|
+
*
|
|
9840
|
+
* @see AiSearchAccountService
|
|
9841
|
+
* @see AiSearchInstanceService
|
|
9842
|
+
*/
|
|
9576
9843
|
export declare abstract class AutoRAG {
|
|
9844
|
+
/**
|
|
9845
|
+
* @deprecated Use `env.AI.aiSearch.list()` instead.
|
|
9846
|
+
* @see AiSearchAccountService.list
|
|
9847
|
+
*/
|
|
9577
9848
|
list(): Promise<AutoRagListResponse>;
|
|
9849
|
+
/**
|
|
9850
|
+
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
|
|
9851
|
+
* Note: The new API uses a messages array instead of a query string.
|
|
9852
|
+
* @see AiSearchInstanceService.search
|
|
9853
|
+
*/
|
|
9578
9854
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
9855
|
+
/**
|
|
9856
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9857
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9858
|
+
*/
|
|
9579
9859
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
9860
|
+
/**
|
|
9861
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9862
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9863
|
+
*/
|
|
9580
9864
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
9865
|
+
/**
|
|
9866
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9867
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9868
|
+
*/
|
|
9581
9869
|
aiSearch(
|
|
9582
9870
|
params: AutoRagAiSearchRequest,
|
|
9583
9871
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
@@ -10979,6 +11267,86 @@ export type ImageOutputOptions = {
|
|
|
10979
11267
|
background?: string;
|
|
10980
11268
|
anim?: boolean;
|
|
10981
11269
|
};
|
|
11270
|
+
export interface ImageMetadata {
|
|
11271
|
+
id: string;
|
|
11272
|
+
filename?: string;
|
|
11273
|
+
uploaded?: string;
|
|
11274
|
+
requireSignedURLs: boolean;
|
|
11275
|
+
meta?: Record<string, unknown>;
|
|
11276
|
+
variants: string[];
|
|
11277
|
+
draft?: boolean;
|
|
11278
|
+
creator?: string;
|
|
11279
|
+
}
|
|
11280
|
+
export interface ImageUploadOptions {
|
|
11281
|
+
id?: string;
|
|
11282
|
+
filename?: string;
|
|
11283
|
+
requireSignedURLs?: boolean;
|
|
11284
|
+
metadata?: Record<string, unknown>;
|
|
11285
|
+
creator?: string;
|
|
11286
|
+
encoding?: "base64";
|
|
11287
|
+
}
|
|
11288
|
+
export interface ImageUpdateOptions {
|
|
11289
|
+
requireSignedURLs?: boolean;
|
|
11290
|
+
metadata?: Record<string, unknown>;
|
|
11291
|
+
creator?: string;
|
|
11292
|
+
}
|
|
11293
|
+
export interface ImageListOptions {
|
|
11294
|
+
limit?: number;
|
|
11295
|
+
cursor?: string;
|
|
11296
|
+
sortOrder?: "asc" | "desc";
|
|
11297
|
+
creator?: string;
|
|
11298
|
+
}
|
|
11299
|
+
export interface ImageList {
|
|
11300
|
+
images: ImageMetadata[];
|
|
11301
|
+
cursor?: string;
|
|
11302
|
+
listComplete: boolean;
|
|
11303
|
+
}
|
|
11304
|
+
export interface HostedImagesBinding {
|
|
11305
|
+
/**
|
|
11306
|
+
* Get detailed metadata for a hosted image
|
|
11307
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11308
|
+
* @returns Image metadata, or null if not found
|
|
11309
|
+
*/
|
|
11310
|
+
details(imageId: string): Promise<ImageMetadata | null>;
|
|
11311
|
+
/**
|
|
11312
|
+
* Get the raw image data for a hosted image
|
|
11313
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11314
|
+
* @returns ReadableStream of image bytes, or null if not found
|
|
11315
|
+
*/
|
|
11316
|
+
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
11317
|
+
/**
|
|
11318
|
+
* Upload a new hosted image
|
|
11319
|
+
* @param image The image file to upload
|
|
11320
|
+
* @param options Upload configuration
|
|
11321
|
+
* @returns Metadata for the uploaded image
|
|
11322
|
+
* @throws {@link ImagesError} if upload fails
|
|
11323
|
+
*/
|
|
11324
|
+
upload(
|
|
11325
|
+
image: ReadableStream<Uint8Array> | ArrayBuffer,
|
|
11326
|
+
options?: ImageUploadOptions,
|
|
11327
|
+
): Promise<ImageMetadata>;
|
|
11328
|
+
/**
|
|
11329
|
+
* Update hosted image metadata
|
|
11330
|
+
* @param imageId The ID of the image
|
|
11331
|
+
* @param options Properties to update
|
|
11332
|
+
* @returns Updated image metadata
|
|
11333
|
+
* @throws {@link ImagesError} if update fails
|
|
11334
|
+
*/
|
|
11335
|
+
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
|
|
11336
|
+
/**
|
|
11337
|
+
* Delete a hosted image
|
|
11338
|
+
* @param imageId The ID of the image
|
|
11339
|
+
* @returns True if deleted, false if not found
|
|
11340
|
+
*/
|
|
11341
|
+
delete(imageId: string): Promise<boolean>;
|
|
11342
|
+
/**
|
|
11343
|
+
* List hosted images with pagination
|
|
11344
|
+
* @param options List configuration
|
|
11345
|
+
* @returns List of images with pagination info
|
|
11346
|
+
* @throws {@link ImagesError} if list fails
|
|
11347
|
+
*/
|
|
11348
|
+
list(options?: ImageListOptions): Promise<ImageList>;
|
|
11349
|
+
}
|
|
10982
11350
|
export interface ImagesBinding {
|
|
10983
11351
|
/**
|
|
10984
11352
|
* Get image metadata (type, width and height)
|
|
@@ -10998,6 +11366,10 @@ export interface ImagesBinding {
|
|
|
10998
11366
|
stream: ReadableStream<Uint8Array>,
|
|
10999
11367
|
options?: ImageInputOptions,
|
|
11000
11368
|
): ImageTransformer;
|
|
11369
|
+
/**
|
|
11370
|
+
* Access hosted images CRUD operations
|
|
11371
|
+
*/
|
|
11372
|
+
readonly hosted: HostedImagesBinding;
|
|
11001
11373
|
}
|
|
11002
11374
|
export interface ImageTransformer {
|
|
11003
11375
|
/**
|
|
@@ -11068,8 +11440,14 @@ export interface MediaTransformer {
|
|
|
11068
11440
|
* @returns A generator for producing the transformed media output
|
|
11069
11441
|
*/
|
|
11070
11442
|
transform(
|
|
11071
|
-
transform
|
|
11443
|
+
transform?: MediaTransformationInputOptions,
|
|
11072
11444
|
): MediaTransformationGenerator;
|
|
11445
|
+
/**
|
|
11446
|
+
* Generates the final media output with specified options.
|
|
11447
|
+
* @param output - Configuration for the output format and parameters
|
|
11448
|
+
* @returns The final transformation result containing the transformed media
|
|
11449
|
+
*/
|
|
11450
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11073
11451
|
}
|
|
11074
11452
|
/**
|
|
11075
11453
|
* Generator for producing media transformation results.
|
|
@@ -11081,7 +11459,7 @@ export interface MediaTransformationGenerator {
|
|
|
11081
11459
|
* @param output - Configuration for the output format and parameters
|
|
11082
11460
|
* @returns The final transformation result containing the transformed media
|
|
11083
11461
|
*/
|
|
11084
|
-
output(output
|
|
11462
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11085
11463
|
}
|
|
11086
11464
|
/**
|
|
11087
11465
|
* Result of a media transformation operation.
|
|
@@ -11090,19 +11468,19 @@ export interface MediaTransformationGenerator {
|
|
|
11090
11468
|
export interface MediaTransformationResult {
|
|
11091
11469
|
/**
|
|
11092
11470
|
* Returns the transformed media as a readable stream of bytes.
|
|
11093
|
-
* @returns A
|
|
11471
|
+
* @returns A promise containing a readable stream with the transformed media
|
|
11094
11472
|
*/
|
|
11095
|
-
media(): ReadableStream<Uint8Array
|
|
11473
|
+
media(): Promise<ReadableStream<Uint8Array>>;
|
|
11096
11474
|
/**
|
|
11097
11475
|
* Returns the transformed media as an HTTP response object.
|
|
11098
|
-
* @returns The transformed media as a Response
|
|
11476
|
+
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
|
|
11099
11477
|
*/
|
|
11100
|
-
response(): Response
|
|
11478
|
+
response(): Promise<Response>;
|
|
11101
11479
|
/**
|
|
11102
11480
|
* Returns the MIME type of the transformed media.
|
|
11103
|
-
* @returns
|
|
11481
|
+
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
11104
11482
|
*/
|
|
11105
|
-
contentType(): string
|
|
11483
|
+
contentType(): Promise<string>;
|
|
11106
11484
|
}
|
|
11107
11485
|
/**
|
|
11108
11486
|
* Configuration options for transforming media input.
|