@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/2022-08-04/index.ts
CHANGED
|
@@ -3826,6 +3826,190 @@ export declare abstract class Performance {
|
|
|
3826
3826
|
get timeOrigin(): number;
|
|
3827
3827
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
|
|
3828
3828
|
now(): number;
|
|
3829
|
+
/**
|
|
3830
|
+
* The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
|
|
3831
|
+
*
|
|
3832
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
|
|
3833
|
+
*/
|
|
3834
|
+
toJSON(): object;
|
|
3835
|
+
}
|
|
3836
|
+
// AI Search V2 API Error Interfaces
|
|
3837
|
+
export interface AiSearchInternalError extends Error {}
|
|
3838
|
+
export interface AiSearchNotFoundError extends Error {}
|
|
3839
|
+
export interface AiSearchNameNotSetError extends Error {}
|
|
3840
|
+
// Filter types (shared with AutoRAG for compatibility)
|
|
3841
|
+
export type ComparisonFilter = {
|
|
3842
|
+
key: string;
|
|
3843
|
+
type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
3844
|
+
value: string | number | boolean;
|
|
3845
|
+
};
|
|
3846
|
+
export type CompoundFilter = {
|
|
3847
|
+
type: "and" | "or";
|
|
3848
|
+
filters: ComparisonFilter[];
|
|
3849
|
+
};
|
|
3850
|
+
// AI Search V2 Request Types
|
|
3851
|
+
export type AiSearchSearchRequest = {
|
|
3852
|
+
messages: Array<{
|
|
3853
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3854
|
+
content: string | null;
|
|
3855
|
+
}>;
|
|
3856
|
+
ai_search_options?: {
|
|
3857
|
+
retrieval?: {
|
|
3858
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3859
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3860
|
+
match_threshold?: number;
|
|
3861
|
+
/** Maximum number of results (1-50, default 10) */
|
|
3862
|
+
max_num_results?: number;
|
|
3863
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3864
|
+
/** Context expansion (0-3, default 0) */
|
|
3865
|
+
context_expansion?: number;
|
|
3866
|
+
[key: string]: unknown;
|
|
3867
|
+
};
|
|
3868
|
+
query_rewrite?: {
|
|
3869
|
+
enabled?: boolean;
|
|
3870
|
+
model?: string;
|
|
3871
|
+
rewrite_prompt?: string;
|
|
3872
|
+
[key: string]: unknown;
|
|
3873
|
+
};
|
|
3874
|
+
reranking?: {
|
|
3875
|
+
/** Enable reranking (default false) */
|
|
3876
|
+
enabled?: boolean;
|
|
3877
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3878
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3879
|
+
match_threshold?: number;
|
|
3880
|
+
[key: string]: unknown;
|
|
3881
|
+
};
|
|
3882
|
+
[key: string]: unknown;
|
|
3883
|
+
};
|
|
3884
|
+
};
|
|
3885
|
+
export type AiSearchChatCompletionsRequest = {
|
|
3886
|
+
messages: Array<{
|
|
3887
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3888
|
+
content: string | null;
|
|
3889
|
+
}>;
|
|
3890
|
+
model?: string;
|
|
3891
|
+
stream?: boolean;
|
|
3892
|
+
ai_search_options?: {
|
|
3893
|
+
retrieval?: {
|
|
3894
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3895
|
+
match_threshold?: number;
|
|
3896
|
+
max_num_results?: number;
|
|
3897
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3898
|
+
context_expansion?: number;
|
|
3899
|
+
[key: string]: unknown;
|
|
3900
|
+
};
|
|
3901
|
+
query_rewrite?: {
|
|
3902
|
+
enabled?: boolean;
|
|
3903
|
+
model?: string;
|
|
3904
|
+
rewrite_prompt?: string;
|
|
3905
|
+
[key: string]: unknown;
|
|
3906
|
+
};
|
|
3907
|
+
reranking?: {
|
|
3908
|
+
enabled?: boolean;
|
|
3909
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3910
|
+
match_threshold?: number;
|
|
3911
|
+
[key: string]: unknown;
|
|
3912
|
+
};
|
|
3913
|
+
[key: string]: unknown;
|
|
3914
|
+
};
|
|
3915
|
+
[key: string]: unknown;
|
|
3916
|
+
};
|
|
3917
|
+
// AI Search V2 Response Types
|
|
3918
|
+
export type AiSearchSearchResponse = {
|
|
3919
|
+
search_query: string;
|
|
3920
|
+
chunks: Array<{
|
|
3921
|
+
id: string;
|
|
3922
|
+
type: string;
|
|
3923
|
+
/** Match score (0-1) */
|
|
3924
|
+
score: number;
|
|
3925
|
+
text: string;
|
|
3926
|
+
item: {
|
|
3927
|
+
timestamp?: number;
|
|
3928
|
+
key: string;
|
|
3929
|
+
metadata?: Record<string, unknown>;
|
|
3930
|
+
};
|
|
3931
|
+
scoring_details?: {
|
|
3932
|
+
/** Keyword match score (0-1) */
|
|
3933
|
+
keyword_score?: number;
|
|
3934
|
+
/** Vector similarity score (0-1) */
|
|
3935
|
+
vector_score?: number;
|
|
3936
|
+
};
|
|
3937
|
+
}>;
|
|
3938
|
+
};
|
|
3939
|
+
export type AiSearchListResponse = Array<{
|
|
3940
|
+
id: string;
|
|
3941
|
+
internal_id?: string;
|
|
3942
|
+
account_id?: string;
|
|
3943
|
+
account_tag?: string;
|
|
3944
|
+
/** Whether the instance is enabled (default true) */
|
|
3945
|
+
enable?: boolean;
|
|
3946
|
+
type?: "r2" | "web-crawler";
|
|
3947
|
+
source?: string;
|
|
3948
|
+
[key: string]: unknown;
|
|
3949
|
+
}>;
|
|
3950
|
+
export type AiSearchConfig = {
|
|
3951
|
+
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3952
|
+
id: string;
|
|
3953
|
+
type: "r2" | "web-crawler";
|
|
3954
|
+
source: string;
|
|
3955
|
+
source_params?: object;
|
|
3956
|
+
/** Token ID (UUID format) */
|
|
3957
|
+
token_id?: string;
|
|
3958
|
+
ai_gateway_id?: string;
|
|
3959
|
+
/** Enable query rewriting (default false) */
|
|
3960
|
+
rewrite_query?: boolean;
|
|
3961
|
+
/** Enable reranking (default false) */
|
|
3962
|
+
reranking?: boolean;
|
|
3963
|
+
embedding_model?: string;
|
|
3964
|
+
ai_search_model?: string;
|
|
3965
|
+
};
|
|
3966
|
+
export type AiSearchInstance = {
|
|
3967
|
+
id: string;
|
|
3968
|
+
enable?: boolean;
|
|
3969
|
+
type?: "r2" | "web-crawler";
|
|
3970
|
+
source?: string;
|
|
3971
|
+
[key: string]: unknown;
|
|
3972
|
+
};
|
|
3973
|
+
// AI Search Instance Service - Instance-level operations
|
|
3974
|
+
export declare abstract class AiSearchInstanceService {
|
|
3975
|
+
/**
|
|
3976
|
+
* Search the AI Search instance for relevant chunks.
|
|
3977
|
+
* @param params Search request with messages and AI search options
|
|
3978
|
+
* @returns Search response with matching chunks
|
|
3979
|
+
*/
|
|
3980
|
+
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
3981
|
+
/**
|
|
3982
|
+
* Generate chat completions with AI Search context.
|
|
3983
|
+
* @param params Chat completions request with optional streaming
|
|
3984
|
+
* @returns Response object (if streaming) or chat completion result
|
|
3985
|
+
*/
|
|
3986
|
+
chatCompletions(
|
|
3987
|
+
params: AiSearchChatCompletionsRequest,
|
|
3988
|
+
): Promise<Response | object>;
|
|
3989
|
+
/**
|
|
3990
|
+
* Delete this AI Search instance.
|
|
3991
|
+
*/
|
|
3992
|
+
delete(): Promise<void>;
|
|
3993
|
+
}
|
|
3994
|
+
// AI Search Account Service - Account-level operations
|
|
3995
|
+
export declare abstract class AiSearchAccountService {
|
|
3996
|
+
/**
|
|
3997
|
+
* List all AI Search instances in the account.
|
|
3998
|
+
* @returns Array of AI Search instances
|
|
3999
|
+
*/
|
|
4000
|
+
list(): Promise<AiSearchListResponse>;
|
|
4001
|
+
/**
|
|
4002
|
+
* Get an AI Search instance by ID.
|
|
4003
|
+
* @param name Instance ID
|
|
4004
|
+
* @returns Instance service for performing operations
|
|
4005
|
+
*/
|
|
4006
|
+
get(name: string): AiSearchInstanceService;
|
|
4007
|
+
/**
|
|
4008
|
+
* Create a new AI Search instance.
|
|
4009
|
+
* @param config Instance configuration
|
|
4010
|
+
* @returns Instance service for performing operations
|
|
4011
|
+
*/
|
|
4012
|
+
create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
|
|
3829
4013
|
}
|
|
3830
4014
|
export type AiImageClassificationInput = {
|
|
3831
4015
|
image: number[];
|
|
@@ -9327,6 +9511,48 @@ export declare abstract class Ai<
|
|
|
9327
9511
|
> {
|
|
9328
9512
|
aiGatewayLogId: string | null;
|
|
9329
9513
|
gateway(gatewayId: string): AiGateway;
|
|
9514
|
+
/**
|
|
9515
|
+
* Access the AI Search API for managing AI-powered search instances.
|
|
9516
|
+
*
|
|
9517
|
+
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
9518
|
+
* - Account-level operations: `list()`, `create()`
|
|
9519
|
+
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
9520
|
+
*
|
|
9521
|
+
* @example
|
|
9522
|
+
* ```typescript
|
|
9523
|
+
* // List all AI Search instances
|
|
9524
|
+
* const instances = await env.AI.aiSearch.list();
|
|
9525
|
+
*
|
|
9526
|
+
* // Search an instance
|
|
9527
|
+
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
9528
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9529
|
+
* ai_search_options: {
|
|
9530
|
+
* retrieval: { max_num_results: 10 }
|
|
9531
|
+
* }
|
|
9532
|
+
* });
|
|
9533
|
+
*
|
|
9534
|
+
* // Generate chat completions with AI Search context
|
|
9535
|
+
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
9536
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9537
|
+
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
9538
|
+
* });
|
|
9539
|
+
* ```
|
|
9540
|
+
*/
|
|
9541
|
+
aiSearch(): AiSearchAccountService;
|
|
9542
|
+
/**
|
|
9543
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9544
|
+
* Use `env.AI.aiSearch` instead for better API design and new features.
|
|
9545
|
+
*
|
|
9546
|
+
* Migration guide:
|
|
9547
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9548
|
+
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
9549
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9550
|
+
*
|
|
9551
|
+
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
9552
|
+
*
|
|
9553
|
+
* @see AiSearchAccountService
|
|
9554
|
+
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
9555
|
+
*/
|
|
9330
9556
|
autorag(autoragId: string): AutoRAG;
|
|
9331
9557
|
run<
|
|
9332
9558
|
Name extends keyof AiModelList,
|
|
@@ -9483,19 +9709,30 @@ export declare abstract class AiGateway {
|
|
|
9483
9709
|
): Promise<Response>;
|
|
9484
9710
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
9485
9711
|
}
|
|
9712
|
+
/**
|
|
9713
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
|
|
9714
|
+
* @see AiSearchInternalError
|
|
9715
|
+
*/
|
|
9486
9716
|
export interface AutoRAGInternalError extends Error {}
|
|
9717
|
+
/**
|
|
9718
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
|
|
9719
|
+
* @see AiSearchNotFoundError
|
|
9720
|
+
*/
|
|
9487
9721
|
export interface AutoRAGNotFoundError extends Error {}
|
|
9722
|
+
/**
|
|
9723
|
+
* @deprecated This error type is no longer used in the AI Search API.
|
|
9724
|
+
*/
|
|
9488
9725
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
9726
|
+
/**
|
|
9727
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
|
|
9728
|
+
* @see AiSearchNameNotSetError
|
|
9729
|
+
*/
|
|
9489
9730
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
export type CompoundFilter = {
|
|
9496
|
-
type: "and" | "or";
|
|
9497
|
-
filters: ComparisonFilter[];
|
|
9498
|
-
};
|
|
9731
|
+
/**
|
|
9732
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9733
|
+
* Use AiSearchSearchRequest with the new API instead.
|
|
9734
|
+
* @see AiSearchSearchRequest
|
|
9735
|
+
*/
|
|
9499
9736
|
export type AutoRagSearchRequest = {
|
|
9500
9737
|
query: string;
|
|
9501
9738
|
filters?: CompoundFilter | ComparisonFilter;
|
|
@@ -9510,16 +9747,31 @@ export type AutoRagSearchRequest = {
|
|
|
9510
9747
|
};
|
|
9511
9748
|
rewrite_query?: boolean;
|
|
9512
9749
|
};
|
|
9750
|
+
/**
|
|
9751
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9752
|
+
* Use AiSearchChatCompletionsRequest with the new API instead.
|
|
9753
|
+
* @see AiSearchChatCompletionsRequest
|
|
9754
|
+
*/
|
|
9513
9755
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
9514
9756
|
stream?: boolean;
|
|
9515
9757
|
system_prompt?: string;
|
|
9516
9758
|
};
|
|
9759
|
+
/**
|
|
9760
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9761
|
+
* Use AiSearchChatCompletionsRequest with stream: true instead.
|
|
9762
|
+
* @see AiSearchChatCompletionsRequest
|
|
9763
|
+
*/
|
|
9517
9764
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
9518
9765
|
AutoRagAiSearchRequest,
|
|
9519
9766
|
"stream"
|
|
9520
9767
|
> & {
|
|
9521
9768
|
stream: true;
|
|
9522
9769
|
};
|
|
9770
|
+
/**
|
|
9771
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9772
|
+
* Use AiSearchSearchResponse with the new API instead.
|
|
9773
|
+
* @see AiSearchSearchResponse
|
|
9774
|
+
*/
|
|
9523
9775
|
export type AutoRagSearchResponse = {
|
|
9524
9776
|
object: "vector_store.search_results.page";
|
|
9525
9777
|
search_query: string;
|
|
@@ -9536,6 +9788,11 @@ export type AutoRagSearchResponse = {
|
|
|
9536
9788
|
has_more: boolean;
|
|
9537
9789
|
next_page: string | null;
|
|
9538
9790
|
};
|
|
9791
|
+
/**
|
|
9792
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9793
|
+
* Use AiSearchListResponse with the new API instead.
|
|
9794
|
+
* @see AiSearchListResponse
|
|
9795
|
+
*/
|
|
9539
9796
|
export type AutoRagListResponse = {
|
|
9540
9797
|
id: string;
|
|
9541
9798
|
enable: boolean;
|
|
@@ -9545,14 +9802,51 @@ export type AutoRagListResponse = {
|
|
|
9545
9802
|
paused: boolean;
|
|
9546
9803
|
status: string;
|
|
9547
9804
|
}[];
|
|
9805
|
+
/**
|
|
9806
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9807
|
+
* The new API returns different response formats for chat completions.
|
|
9808
|
+
*/
|
|
9548
9809
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
9549
9810
|
response: string;
|
|
9550
9811
|
};
|
|
9812
|
+
/**
|
|
9813
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9814
|
+
* Use the new AI Search API instead: `env.AI.aiSearch`
|
|
9815
|
+
*
|
|
9816
|
+
* Migration guide:
|
|
9817
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9818
|
+
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
9819
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9820
|
+
*
|
|
9821
|
+
* @see AiSearchAccountService
|
|
9822
|
+
* @see AiSearchInstanceService
|
|
9823
|
+
*/
|
|
9551
9824
|
export declare abstract class AutoRAG {
|
|
9825
|
+
/**
|
|
9826
|
+
* @deprecated Use `env.AI.aiSearch.list()` instead.
|
|
9827
|
+
* @see AiSearchAccountService.list
|
|
9828
|
+
*/
|
|
9552
9829
|
list(): Promise<AutoRagListResponse>;
|
|
9830
|
+
/**
|
|
9831
|
+
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
|
|
9832
|
+
* Note: The new API uses a messages array instead of a query string.
|
|
9833
|
+
* @see AiSearchInstanceService.search
|
|
9834
|
+
*/
|
|
9553
9835
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
9836
|
+
/**
|
|
9837
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9838
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9839
|
+
*/
|
|
9554
9840
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
9841
|
+
/**
|
|
9842
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9843
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9844
|
+
*/
|
|
9555
9845
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
9846
|
+
/**
|
|
9847
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9848
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9849
|
+
*/
|
|
9556
9850
|
aiSearch(
|
|
9557
9851
|
params: AutoRagAiSearchRequest,
|
|
9558
9852
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
@@ -10954,6 +11248,86 @@ export type ImageOutputOptions = {
|
|
|
10954
11248
|
background?: string;
|
|
10955
11249
|
anim?: boolean;
|
|
10956
11250
|
};
|
|
11251
|
+
export interface ImageMetadata {
|
|
11252
|
+
id: string;
|
|
11253
|
+
filename?: string;
|
|
11254
|
+
uploaded?: string;
|
|
11255
|
+
requireSignedURLs: boolean;
|
|
11256
|
+
meta?: Record<string, unknown>;
|
|
11257
|
+
variants: string[];
|
|
11258
|
+
draft?: boolean;
|
|
11259
|
+
creator?: string;
|
|
11260
|
+
}
|
|
11261
|
+
export interface ImageUploadOptions {
|
|
11262
|
+
id?: string;
|
|
11263
|
+
filename?: string;
|
|
11264
|
+
requireSignedURLs?: boolean;
|
|
11265
|
+
metadata?: Record<string, unknown>;
|
|
11266
|
+
creator?: string;
|
|
11267
|
+
encoding?: "base64";
|
|
11268
|
+
}
|
|
11269
|
+
export interface ImageUpdateOptions {
|
|
11270
|
+
requireSignedURLs?: boolean;
|
|
11271
|
+
metadata?: Record<string, unknown>;
|
|
11272
|
+
creator?: string;
|
|
11273
|
+
}
|
|
11274
|
+
export interface ImageListOptions {
|
|
11275
|
+
limit?: number;
|
|
11276
|
+
cursor?: string;
|
|
11277
|
+
sortOrder?: "asc" | "desc";
|
|
11278
|
+
creator?: string;
|
|
11279
|
+
}
|
|
11280
|
+
export interface ImageList {
|
|
11281
|
+
images: ImageMetadata[];
|
|
11282
|
+
cursor?: string;
|
|
11283
|
+
listComplete: boolean;
|
|
11284
|
+
}
|
|
11285
|
+
export interface HostedImagesBinding {
|
|
11286
|
+
/**
|
|
11287
|
+
* Get detailed metadata for a hosted image
|
|
11288
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11289
|
+
* @returns Image metadata, or null if not found
|
|
11290
|
+
*/
|
|
11291
|
+
details(imageId: string): Promise<ImageMetadata | null>;
|
|
11292
|
+
/**
|
|
11293
|
+
* Get the raw image data for a hosted image
|
|
11294
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11295
|
+
* @returns ReadableStream of image bytes, or null if not found
|
|
11296
|
+
*/
|
|
11297
|
+
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
11298
|
+
/**
|
|
11299
|
+
* Upload a new hosted image
|
|
11300
|
+
* @param image The image file to upload
|
|
11301
|
+
* @param options Upload configuration
|
|
11302
|
+
* @returns Metadata for the uploaded image
|
|
11303
|
+
* @throws {@link ImagesError} if upload fails
|
|
11304
|
+
*/
|
|
11305
|
+
upload(
|
|
11306
|
+
image: ReadableStream<Uint8Array> | ArrayBuffer,
|
|
11307
|
+
options?: ImageUploadOptions,
|
|
11308
|
+
): Promise<ImageMetadata>;
|
|
11309
|
+
/**
|
|
11310
|
+
* Update hosted image metadata
|
|
11311
|
+
* @param imageId The ID of the image
|
|
11312
|
+
* @param options Properties to update
|
|
11313
|
+
* @returns Updated image metadata
|
|
11314
|
+
* @throws {@link ImagesError} if update fails
|
|
11315
|
+
*/
|
|
11316
|
+
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
|
|
11317
|
+
/**
|
|
11318
|
+
* Delete a hosted image
|
|
11319
|
+
* @param imageId The ID of the image
|
|
11320
|
+
* @returns True if deleted, false if not found
|
|
11321
|
+
*/
|
|
11322
|
+
delete(imageId: string): Promise<boolean>;
|
|
11323
|
+
/**
|
|
11324
|
+
* List hosted images with pagination
|
|
11325
|
+
* @param options List configuration
|
|
11326
|
+
* @returns List of images with pagination info
|
|
11327
|
+
* @throws {@link ImagesError} if list fails
|
|
11328
|
+
*/
|
|
11329
|
+
list(options?: ImageListOptions): Promise<ImageList>;
|
|
11330
|
+
}
|
|
10957
11331
|
export interface ImagesBinding {
|
|
10958
11332
|
/**
|
|
10959
11333
|
* Get image metadata (type, width and height)
|
|
@@ -10973,6 +11347,10 @@ export interface ImagesBinding {
|
|
|
10973
11347
|
stream: ReadableStream<Uint8Array>,
|
|
10974
11348
|
options?: ImageInputOptions,
|
|
10975
11349
|
): ImageTransformer;
|
|
11350
|
+
/**
|
|
11351
|
+
* Access hosted images CRUD operations
|
|
11352
|
+
*/
|
|
11353
|
+
readonly hosted: HostedImagesBinding;
|
|
10976
11354
|
}
|
|
10977
11355
|
export interface ImageTransformer {
|
|
10978
11356
|
/**
|
|
@@ -11043,8 +11421,14 @@ export interface MediaTransformer {
|
|
|
11043
11421
|
* @returns A generator for producing the transformed media output
|
|
11044
11422
|
*/
|
|
11045
11423
|
transform(
|
|
11046
|
-
transform
|
|
11424
|
+
transform?: MediaTransformationInputOptions,
|
|
11047
11425
|
): MediaTransformationGenerator;
|
|
11426
|
+
/**
|
|
11427
|
+
* Generates the final media output with specified options.
|
|
11428
|
+
* @param output - Configuration for the output format and parameters
|
|
11429
|
+
* @returns The final transformation result containing the transformed media
|
|
11430
|
+
*/
|
|
11431
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11048
11432
|
}
|
|
11049
11433
|
/**
|
|
11050
11434
|
* Generator for producing media transformation results.
|
|
@@ -11056,7 +11440,7 @@ export interface MediaTransformationGenerator {
|
|
|
11056
11440
|
* @param output - Configuration for the output format and parameters
|
|
11057
11441
|
* @returns The final transformation result containing the transformed media
|
|
11058
11442
|
*/
|
|
11059
|
-
output(output
|
|
11443
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11060
11444
|
}
|
|
11061
11445
|
/**
|
|
11062
11446
|
* Result of a media transformation operation.
|
|
@@ -11065,19 +11449,19 @@ export interface MediaTransformationGenerator {
|
|
|
11065
11449
|
export interface MediaTransformationResult {
|
|
11066
11450
|
/**
|
|
11067
11451
|
* Returns the transformed media as a readable stream of bytes.
|
|
11068
|
-
* @returns A
|
|
11452
|
+
* @returns A promise containing a readable stream with the transformed media
|
|
11069
11453
|
*/
|
|
11070
|
-
media(): ReadableStream<Uint8Array
|
|
11454
|
+
media(): Promise<ReadableStream<Uint8Array>>;
|
|
11071
11455
|
/**
|
|
11072
11456
|
* Returns the transformed media as an HTTP response object.
|
|
11073
|
-
* @returns The transformed media as a Response
|
|
11457
|
+
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
|
|
11074
11458
|
*/
|
|
11075
|
-
response(): Response
|
|
11459
|
+
response(): Promise<Response>;
|
|
11076
11460
|
/**
|
|
11077
11461
|
* Returns the MIME type of the transformed media.
|
|
11078
|
-
* @returns
|
|
11462
|
+
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
11079
11463
|
*/
|
|
11080
|
-
contentType(): string
|
|
11464
|
+
contentType(): Promise<string>;
|
|
11081
11465
|
}
|
|
11082
11466
|
/**
|
|
11083
11467
|
* Configuration options for transforming media input.
|