@cloudflare/workers-types 4.20260227.0 → 4.20260228.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 +401 -17
- package/2021-11-03/index.ts +401 -17
- package/2022-01-31/index.d.ts +401 -17
- package/2022-01-31/index.ts +401 -17
- package/2022-03-21/index.d.ts +401 -17
- package/2022-03-21/index.ts +401 -17
- package/2022-08-04/index.d.ts +401 -17
- package/2022-08-04/index.ts +401 -17
- package/2022-10-31/index.d.ts +401 -17
- package/2022-10-31/index.ts +401 -17
- package/2022-11-30/index.d.ts +401 -17
- package/2022-11-30/index.ts +401 -17
- package/2023-03-01/index.d.ts +401 -17
- package/2023-03-01/index.ts +401 -17
- package/2023-07-01/index.d.ts +401 -17
- package/2023-07-01/index.ts +401 -17
- package/experimental/index.d.ts +429 -23
- package/experimental/index.ts +429 -23
- package/index.d.ts +401 -17
- package/index.ts +401 -17
- package/latest/index.d.ts +401 -17
- package/latest/index.ts +401 -17
- package/oldest/index.d.ts +401 -17
- package/oldest/index.ts +401 -17
- package/package.json +1 -1
package/latest/index.ts
CHANGED
|
@@ -3890,6 +3890,190 @@ export declare abstract class Performance {
|
|
|
3890
3890
|
get timeOrigin(): number;
|
|
3891
3891
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
|
|
3892
3892
|
now(): number;
|
|
3893
|
+
/**
|
|
3894
|
+
* The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
|
|
3895
|
+
*
|
|
3896
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
|
|
3897
|
+
*/
|
|
3898
|
+
toJSON(): object;
|
|
3899
|
+
}
|
|
3900
|
+
// AI Search V2 API Error Interfaces
|
|
3901
|
+
export interface AiSearchInternalError extends Error {}
|
|
3902
|
+
export interface AiSearchNotFoundError extends Error {}
|
|
3903
|
+
export interface AiSearchNameNotSetError extends Error {}
|
|
3904
|
+
// Filter types (shared with AutoRAG for compatibility)
|
|
3905
|
+
export type ComparisonFilter = {
|
|
3906
|
+
key: string;
|
|
3907
|
+
type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
3908
|
+
value: string | number | boolean;
|
|
3909
|
+
};
|
|
3910
|
+
export type CompoundFilter = {
|
|
3911
|
+
type: "and" | "or";
|
|
3912
|
+
filters: ComparisonFilter[];
|
|
3913
|
+
};
|
|
3914
|
+
// AI Search V2 Request Types
|
|
3915
|
+
export type AiSearchSearchRequest = {
|
|
3916
|
+
messages: Array<{
|
|
3917
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3918
|
+
content: string | null;
|
|
3919
|
+
}>;
|
|
3920
|
+
ai_search_options?: {
|
|
3921
|
+
retrieval?: {
|
|
3922
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3923
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3924
|
+
match_threshold?: number;
|
|
3925
|
+
/** Maximum number of results (1-50, default 10) */
|
|
3926
|
+
max_num_results?: number;
|
|
3927
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3928
|
+
/** Context expansion (0-3, default 0) */
|
|
3929
|
+
context_expansion?: number;
|
|
3930
|
+
[key: string]: unknown;
|
|
3931
|
+
};
|
|
3932
|
+
query_rewrite?: {
|
|
3933
|
+
enabled?: boolean;
|
|
3934
|
+
model?: string;
|
|
3935
|
+
rewrite_prompt?: string;
|
|
3936
|
+
[key: string]: unknown;
|
|
3937
|
+
};
|
|
3938
|
+
reranking?: {
|
|
3939
|
+
/** Enable reranking (default false) */
|
|
3940
|
+
enabled?: boolean;
|
|
3941
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3942
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3943
|
+
match_threshold?: number;
|
|
3944
|
+
[key: string]: unknown;
|
|
3945
|
+
};
|
|
3946
|
+
[key: string]: unknown;
|
|
3947
|
+
};
|
|
3948
|
+
};
|
|
3949
|
+
export type AiSearchChatCompletionsRequest = {
|
|
3950
|
+
messages: Array<{
|
|
3951
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3952
|
+
content: string | null;
|
|
3953
|
+
}>;
|
|
3954
|
+
model?: string;
|
|
3955
|
+
stream?: boolean;
|
|
3956
|
+
ai_search_options?: {
|
|
3957
|
+
retrieval?: {
|
|
3958
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3959
|
+
match_threshold?: number;
|
|
3960
|
+
max_num_results?: number;
|
|
3961
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3962
|
+
context_expansion?: number;
|
|
3963
|
+
[key: string]: unknown;
|
|
3964
|
+
};
|
|
3965
|
+
query_rewrite?: {
|
|
3966
|
+
enabled?: boolean;
|
|
3967
|
+
model?: string;
|
|
3968
|
+
rewrite_prompt?: string;
|
|
3969
|
+
[key: string]: unknown;
|
|
3970
|
+
};
|
|
3971
|
+
reranking?: {
|
|
3972
|
+
enabled?: boolean;
|
|
3973
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3974
|
+
match_threshold?: number;
|
|
3975
|
+
[key: string]: unknown;
|
|
3976
|
+
};
|
|
3977
|
+
[key: string]: unknown;
|
|
3978
|
+
};
|
|
3979
|
+
[key: string]: unknown;
|
|
3980
|
+
};
|
|
3981
|
+
// AI Search V2 Response Types
|
|
3982
|
+
export type AiSearchSearchResponse = {
|
|
3983
|
+
search_query: string;
|
|
3984
|
+
chunks: Array<{
|
|
3985
|
+
id: string;
|
|
3986
|
+
type: string;
|
|
3987
|
+
/** Match score (0-1) */
|
|
3988
|
+
score: number;
|
|
3989
|
+
text: string;
|
|
3990
|
+
item: {
|
|
3991
|
+
timestamp?: number;
|
|
3992
|
+
key: string;
|
|
3993
|
+
metadata?: Record<string, unknown>;
|
|
3994
|
+
};
|
|
3995
|
+
scoring_details?: {
|
|
3996
|
+
/** Keyword match score (0-1) */
|
|
3997
|
+
keyword_score?: number;
|
|
3998
|
+
/** Vector similarity score (0-1) */
|
|
3999
|
+
vector_score?: number;
|
|
4000
|
+
};
|
|
4001
|
+
}>;
|
|
4002
|
+
};
|
|
4003
|
+
export type AiSearchListResponse = Array<{
|
|
4004
|
+
id: string;
|
|
4005
|
+
internal_id?: string;
|
|
4006
|
+
account_id?: string;
|
|
4007
|
+
account_tag?: string;
|
|
4008
|
+
/** Whether the instance is enabled (default true) */
|
|
4009
|
+
enable?: boolean;
|
|
4010
|
+
type?: "r2" | "web-crawler";
|
|
4011
|
+
source?: string;
|
|
4012
|
+
[key: string]: unknown;
|
|
4013
|
+
}>;
|
|
4014
|
+
export type AiSearchConfig = {
|
|
4015
|
+
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
4016
|
+
id: string;
|
|
4017
|
+
type: "r2" | "web-crawler";
|
|
4018
|
+
source: string;
|
|
4019
|
+
source_params?: object;
|
|
4020
|
+
/** Token ID (UUID format) */
|
|
4021
|
+
token_id?: string;
|
|
4022
|
+
ai_gateway_id?: string;
|
|
4023
|
+
/** Enable query rewriting (default false) */
|
|
4024
|
+
rewrite_query?: boolean;
|
|
4025
|
+
/** Enable reranking (default false) */
|
|
4026
|
+
reranking?: boolean;
|
|
4027
|
+
embedding_model?: string;
|
|
4028
|
+
ai_search_model?: string;
|
|
4029
|
+
};
|
|
4030
|
+
export type AiSearchInstance = {
|
|
4031
|
+
id: string;
|
|
4032
|
+
enable?: boolean;
|
|
4033
|
+
type?: "r2" | "web-crawler";
|
|
4034
|
+
source?: string;
|
|
4035
|
+
[key: string]: unknown;
|
|
4036
|
+
};
|
|
4037
|
+
// AI Search Instance Service - Instance-level operations
|
|
4038
|
+
export declare abstract class AiSearchInstanceService {
|
|
4039
|
+
/**
|
|
4040
|
+
* Search the AI Search instance for relevant chunks.
|
|
4041
|
+
* @param params Search request with messages and AI search options
|
|
4042
|
+
* @returns Search response with matching chunks
|
|
4043
|
+
*/
|
|
4044
|
+
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4045
|
+
/**
|
|
4046
|
+
* Generate chat completions with AI Search context.
|
|
4047
|
+
* @param params Chat completions request with optional streaming
|
|
4048
|
+
* @returns Response object (if streaming) or chat completion result
|
|
4049
|
+
*/
|
|
4050
|
+
chatCompletions(
|
|
4051
|
+
params: AiSearchChatCompletionsRequest,
|
|
4052
|
+
): Promise<Response | object>;
|
|
4053
|
+
/**
|
|
4054
|
+
* Delete this AI Search instance.
|
|
4055
|
+
*/
|
|
4056
|
+
delete(): Promise<void>;
|
|
4057
|
+
}
|
|
4058
|
+
// AI Search Account Service - Account-level operations
|
|
4059
|
+
export declare abstract class AiSearchAccountService {
|
|
4060
|
+
/**
|
|
4061
|
+
* List all AI Search instances in the account.
|
|
4062
|
+
* @returns Array of AI Search instances
|
|
4063
|
+
*/
|
|
4064
|
+
list(): Promise<AiSearchListResponse>;
|
|
4065
|
+
/**
|
|
4066
|
+
* Get an AI Search instance by ID.
|
|
4067
|
+
* @param name Instance ID
|
|
4068
|
+
* @returns Instance service for performing operations
|
|
4069
|
+
*/
|
|
4070
|
+
get(name: string): AiSearchInstanceService;
|
|
4071
|
+
/**
|
|
4072
|
+
* Create a new AI Search instance.
|
|
4073
|
+
* @param config Instance configuration
|
|
4074
|
+
* @returns Instance service for performing operations
|
|
4075
|
+
*/
|
|
4076
|
+
create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
|
|
3893
4077
|
}
|
|
3894
4078
|
export type AiImageClassificationInput = {
|
|
3895
4079
|
image: number[];
|
|
@@ -9391,6 +9575,48 @@ export declare abstract class Ai<
|
|
|
9391
9575
|
> {
|
|
9392
9576
|
aiGatewayLogId: string | null;
|
|
9393
9577
|
gateway(gatewayId: string): AiGateway;
|
|
9578
|
+
/**
|
|
9579
|
+
* Access the AI Search API for managing AI-powered search instances.
|
|
9580
|
+
*
|
|
9581
|
+
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
9582
|
+
* - Account-level operations: `list()`, `create()`
|
|
9583
|
+
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
9584
|
+
*
|
|
9585
|
+
* @example
|
|
9586
|
+
* ```typescript
|
|
9587
|
+
* // List all AI Search instances
|
|
9588
|
+
* const instances = await env.AI.aiSearch.list();
|
|
9589
|
+
*
|
|
9590
|
+
* // Search an instance
|
|
9591
|
+
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
9592
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9593
|
+
* ai_search_options: {
|
|
9594
|
+
* retrieval: { max_num_results: 10 }
|
|
9595
|
+
* }
|
|
9596
|
+
* });
|
|
9597
|
+
*
|
|
9598
|
+
* // Generate chat completions with AI Search context
|
|
9599
|
+
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
9600
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9601
|
+
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
9602
|
+
* });
|
|
9603
|
+
* ```
|
|
9604
|
+
*/
|
|
9605
|
+
aiSearch(): AiSearchAccountService;
|
|
9606
|
+
/**
|
|
9607
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9608
|
+
* Use `env.AI.aiSearch` instead for better API design and new features.
|
|
9609
|
+
*
|
|
9610
|
+
* Migration guide:
|
|
9611
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9612
|
+
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
9613
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9614
|
+
*
|
|
9615
|
+
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
9616
|
+
*
|
|
9617
|
+
* @see AiSearchAccountService
|
|
9618
|
+
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
9619
|
+
*/
|
|
9394
9620
|
autorag(autoragId: string): AutoRAG;
|
|
9395
9621
|
run<
|
|
9396
9622
|
Name extends keyof AiModelList,
|
|
@@ -9547,19 +9773,30 @@ export declare abstract class AiGateway {
|
|
|
9547
9773
|
): Promise<Response>;
|
|
9548
9774
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
9549
9775
|
}
|
|
9776
|
+
/**
|
|
9777
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
|
|
9778
|
+
* @see AiSearchInternalError
|
|
9779
|
+
*/
|
|
9550
9780
|
export interface AutoRAGInternalError extends Error {}
|
|
9781
|
+
/**
|
|
9782
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
|
|
9783
|
+
* @see AiSearchNotFoundError
|
|
9784
|
+
*/
|
|
9551
9785
|
export interface AutoRAGNotFoundError extends Error {}
|
|
9786
|
+
/**
|
|
9787
|
+
* @deprecated This error type is no longer used in the AI Search API.
|
|
9788
|
+
*/
|
|
9552
9789
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
9790
|
+
/**
|
|
9791
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
|
|
9792
|
+
* @see AiSearchNameNotSetError
|
|
9793
|
+
*/
|
|
9553
9794
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
export type CompoundFilter = {
|
|
9560
|
-
type: "and" | "or";
|
|
9561
|
-
filters: ComparisonFilter[];
|
|
9562
|
-
};
|
|
9795
|
+
/**
|
|
9796
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9797
|
+
* Use AiSearchSearchRequest with the new API instead.
|
|
9798
|
+
* @see AiSearchSearchRequest
|
|
9799
|
+
*/
|
|
9563
9800
|
export type AutoRagSearchRequest = {
|
|
9564
9801
|
query: string;
|
|
9565
9802
|
filters?: CompoundFilter | ComparisonFilter;
|
|
@@ -9574,16 +9811,31 @@ export type AutoRagSearchRequest = {
|
|
|
9574
9811
|
};
|
|
9575
9812
|
rewrite_query?: boolean;
|
|
9576
9813
|
};
|
|
9814
|
+
/**
|
|
9815
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9816
|
+
* Use AiSearchChatCompletionsRequest with the new API instead.
|
|
9817
|
+
* @see AiSearchChatCompletionsRequest
|
|
9818
|
+
*/
|
|
9577
9819
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
9578
9820
|
stream?: boolean;
|
|
9579
9821
|
system_prompt?: string;
|
|
9580
9822
|
};
|
|
9823
|
+
/**
|
|
9824
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9825
|
+
* Use AiSearchChatCompletionsRequest with stream: true instead.
|
|
9826
|
+
* @see AiSearchChatCompletionsRequest
|
|
9827
|
+
*/
|
|
9581
9828
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
9582
9829
|
AutoRagAiSearchRequest,
|
|
9583
9830
|
"stream"
|
|
9584
9831
|
> & {
|
|
9585
9832
|
stream: true;
|
|
9586
9833
|
};
|
|
9834
|
+
/**
|
|
9835
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9836
|
+
* Use AiSearchSearchResponse with the new API instead.
|
|
9837
|
+
* @see AiSearchSearchResponse
|
|
9838
|
+
*/
|
|
9587
9839
|
export type AutoRagSearchResponse = {
|
|
9588
9840
|
object: "vector_store.search_results.page";
|
|
9589
9841
|
search_query: string;
|
|
@@ -9600,6 +9852,11 @@ export type AutoRagSearchResponse = {
|
|
|
9600
9852
|
has_more: boolean;
|
|
9601
9853
|
next_page: string | null;
|
|
9602
9854
|
};
|
|
9855
|
+
/**
|
|
9856
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9857
|
+
* Use AiSearchListResponse with the new API instead.
|
|
9858
|
+
* @see AiSearchListResponse
|
|
9859
|
+
*/
|
|
9603
9860
|
export type AutoRagListResponse = {
|
|
9604
9861
|
id: string;
|
|
9605
9862
|
enable: boolean;
|
|
@@ -9609,14 +9866,51 @@ export type AutoRagListResponse = {
|
|
|
9609
9866
|
paused: boolean;
|
|
9610
9867
|
status: string;
|
|
9611
9868
|
}[];
|
|
9869
|
+
/**
|
|
9870
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9871
|
+
* The new API returns different response formats for chat completions.
|
|
9872
|
+
*/
|
|
9612
9873
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
9613
9874
|
response: string;
|
|
9614
9875
|
};
|
|
9876
|
+
/**
|
|
9877
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9878
|
+
* Use the new AI Search API instead: `env.AI.aiSearch`
|
|
9879
|
+
*
|
|
9880
|
+
* Migration guide:
|
|
9881
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9882
|
+
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
9883
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9884
|
+
*
|
|
9885
|
+
* @see AiSearchAccountService
|
|
9886
|
+
* @see AiSearchInstanceService
|
|
9887
|
+
*/
|
|
9615
9888
|
export declare abstract class AutoRAG {
|
|
9889
|
+
/**
|
|
9890
|
+
* @deprecated Use `env.AI.aiSearch.list()` instead.
|
|
9891
|
+
* @see AiSearchAccountService.list
|
|
9892
|
+
*/
|
|
9616
9893
|
list(): Promise<AutoRagListResponse>;
|
|
9894
|
+
/**
|
|
9895
|
+
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
|
|
9896
|
+
* Note: The new API uses a messages array instead of a query string.
|
|
9897
|
+
* @see AiSearchInstanceService.search
|
|
9898
|
+
*/
|
|
9617
9899
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
9900
|
+
/**
|
|
9901
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9902
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9903
|
+
*/
|
|
9618
9904
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
9905
|
+
/**
|
|
9906
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9907
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9908
|
+
*/
|
|
9619
9909
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
9910
|
+
/**
|
|
9911
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9912
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9913
|
+
*/
|
|
9620
9914
|
aiSearch(
|
|
9621
9915
|
params: AutoRagAiSearchRequest,
|
|
9622
9916
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
@@ -11018,6 +11312,86 @@ export type ImageOutputOptions = {
|
|
|
11018
11312
|
background?: string;
|
|
11019
11313
|
anim?: boolean;
|
|
11020
11314
|
};
|
|
11315
|
+
export interface ImageMetadata {
|
|
11316
|
+
id: string;
|
|
11317
|
+
filename?: string;
|
|
11318
|
+
uploaded?: string;
|
|
11319
|
+
requireSignedURLs: boolean;
|
|
11320
|
+
meta?: Record<string, unknown>;
|
|
11321
|
+
variants: string[];
|
|
11322
|
+
draft?: boolean;
|
|
11323
|
+
creator?: string;
|
|
11324
|
+
}
|
|
11325
|
+
export interface ImageUploadOptions {
|
|
11326
|
+
id?: string;
|
|
11327
|
+
filename?: string;
|
|
11328
|
+
requireSignedURLs?: boolean;
|
|
11329
|
+
metadata?: Record<string, unknown>;
|
|
11330
|
+
creator?: string;
|
|
11331
|
+
encoding?: "base64";
|
|
11332
|
+
}
|
|
11333
|
+
export interface ImageUpdateOptions {
|
|
11334
|
+
requireSignedURLs?: boolean;
|
|
11335
|
+
metadata?: Record<string, unknown>;
|
|
11336
|
+
creator?: string;
|
|
11337
|
+
}
|
|
11338
|
+
export interface ImageListOptions {
|
|
11339
|
+
limit?: number;
|
|
11340
|
+
cursor?: string;
|
|
11341
|
+
sortOrder?: "asc" | "desc";
|
|
11342
|
+
creator?: string;
|
|
11343
|
+
}
|
|
11344
|
+
export interface ImageList {
|
|
11345
|
+
images: ImageMetadata[];
|
|
11346
|
+
cursor?: string;
|
|
11347
|
+
listComplete: boolean;
|
|
11348
|
+
}
|
|
11349
|
+
export interface HostedImagesBinding {
|
|
11350
|
+
/**
|
|
11351
|
+
* Get detailed metadata for a hosted image
|
|
11352
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11353
|
+
* @returns Image metadata, or null if not found
|
|
11354
|
+
*/
|
|
11355
|
+
details(imageId: string): Promise<ImageMetadata | null>;
|
|
11356
|
+
/**
|
|
11357
|
+
* Get the raw image data for a hosted image
|
|
11358
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11359
|
+
* @returns ReadableStream of image bytes, or null if not found
|
|
11360
|
+
*/
|
|
11361
|
+
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
11362
|
+
/**
|
|
11363
|
+
* Upload a new hosted image
|
|
11364
|
+
* @param image The image file to upload
|
|
11365
|
+
* @param options Upload configuration
|
|
11366
|
+
* @returns Metadata for the uploaded image
|
|
11367
|
+
* @throws {@link ImagesError} if upload fails
|
|
11368
|
+
*/
|
|
11369
|
+
upload(
|
|
11370
|
+
image: ReadableStream<Uint8Array> | ArrayBuffer,
|
|
11371
|
+
options?: ImageUploadOptions,
|
|
11372
|
+
): Promise<ImageMetadata>;
|
|
11373
|
+
/**
|
|
11374
|
+
* Update hosted image metadata
|
|
11375
|
+
* @param imageId The ID of the image
|
|
11376
|
+
* @param options Properties to update
|
|
11377
|
+
* @returns Updated image metadata
|
|
11378
|
+
* @throws {@link ImagesError} if update fails
|
|
11379
|
+
*/
|
|
11380
|
+
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
|
|
11381
|
+
/**
|
|
11382
|
+
* Delete a hosted image
|
|
11383
|
+
* @param imageId The ID of the image
|
|
11384
|
+
* @returns True if deleted, false if not found
|
|
11385
|
+
*/
|
|
11386
|
+
delete(imageId: string): Promise<boolean>;
|
|
11387
|
+
/**
|
|
11388
|
+
* List hosted images with pagination
|
|
11389
|
+
* @param options List configuration
|
|
11390
|
+
* @returns List of images with pagination info
|
|
11391
|
+
* @throws {@link ImagesError} if list fails
|
|
11392
|
+
*/
|
|
11393
|
+
list(options?: ImageListOptions): Promise<ImageList>;
|
|
11394
|
+
}
|
|
11021
11395
|
export interface ImagesBinding {
|
|
11022
11396
|
/**
|
|
11023
11397
|
* Get image metadata (type, width and height)
|
|
@@ -11037,6 +11411,10 @@ export interface ImagesBinding {
|
|
|
11037
11411
|
stream: ReadableStream<Uint8Array>,
|
|
11038
11412
|
options?: ImageInputOptions,
|
|
11039
11413
|
): ImageTransformer;
|
|
11414
|
+
/**
|
|
11415
|
+
* Access hosted images CRUD operations
|
|
11416
|
+
*/
|
|
11417
|
+
readonly hosted: HostedImagesBinding;
|
|
11040
11418
|
}
|
|
11041
11419
|
export interface ImageTransformer {
|
|
11042
11420
|
/**
|
|
@@ -11107,8 +11485,14 @@ export interface MediaTransformer {
|
|
|
11107
11485
|
* @returns A generator for producing the transformed media output
|
|
11108
11486
|
*/
|
|
11109
11487
|
transform(
|
|
11110
|
-
transform
|
|
11488
|
+
transform?: MediaTransformationInputOptions,
|
|
11111
11489
|
): MediaTransformationGenerator;
|
|
11490
|
+
/**
|
|
11491
|
+
* Generates the final media output with specified options.
|
|
11492
|
+
* @param output - Configuration for the output format and parameters
|
|
11493
|
+
* @returns The final transformation result containing the transformed media
|
|
11494
|
+
*/
|
|
11495
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11112
11496
|
}
|
|
11113
11497
|
/**
|
|
11114
11498
|
* Generator for producing media transformation results.
|
|
@@ -11120,7 +11504,7 @@ export interface MediaTransformationGenerator {
|
|
|
11120
11504
|
* @param output - Configuration for the output format and parameters
|
|
11121
11505
|
* @returns The final transformation result containing the transformed media
|
|
11122
11506
|
*/
|
|
11123
|
-
output(output
|
|
11507
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11124
11508
|
}
|
|
11125
11509
|
/**
|
|
11126
11510
|
* Result of a media transformation operation.
|
|
@@ -11129,19 +11513,19 @@ export interface MediaTransformationGenerator {
|
|
|
11129
11513
|
export interface MediaTransformationResult {
|
|
11130
11514
|
/**
|
|
11131
11515
|
* Returns the transformed media as a readable stream of bytes.
|
|
11132
|
-
* @returns A
|
|
11516
|
+
* @returns A promise containing a readable stream with the transformed media
|
|
11133
11517
|
*/
|
|
11134
|
-
media(): ReadableStream<Uint8Array
|
|
11518
|
+
media(): Promise<ReadableStream<Uint8Array>>;
|
|
11135
11519
|
/**
|
|
11136
11520
|
* Returns the transformed media as an HTTP response object.
|
|
11137
|
-
* @returns The transformed media as a Response
|
|
11521
|
+
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
|
|
11138
11522
|
*/
|
|
11139
|
-
response(): Response
|
|
11523
|
+
response(): Promise<Response>;
|
|
11140
11524
|
/**
|
|
11141
11525
|
* Returns the MIME type of the transformed media.
|
|
11142
|
-
* @returns
|
|
11526
|
+
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
11143
11527
|
*/
|
|
11144
|
-
contentType(): string
|
|
11528
|
+
contentType(): Promise<string>;
|
|
11145
11529
|
}
|
|
11146
11530
|
/**
|
|
11147
11531
|
* Configuration options for transforming media input.
|