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