@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-01-31/index.ts
CHANGED
|
@@ -3818,6 +3818,184 @@ export declare abstract class Performance {
|
|
|
3818
3818
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
|
|
3819
3819
|
now(): number;
|
|
3820
3820
|
}
|
|
3821
|
+
// AI Search V2 API Error Interfaces
|
|
3822
|
+
export interface AiSearchInternalError extends Error {}
|
|
3823
|
+
export interface AiSearchNotFoundError extends Error {}
|
|
3824
|
+
export interface AiSearchNameNotSetError extends Error {}
|
|
3825
|
+
// Filter types (shared with AutoRAG for compatibility)
|
|
3826
|
+
export type ComparisonFilter = {
|
|
3827
|
+
key: string;
|
|
3828
|
+
type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
3829
|
+
value: string | number | boolean;
|
|
3830
|
+
};
|
|
3831
|
+
export type CompoundFilter = {
|
|
3832
|
+
type: "and" | "or";
|
|
3833
|
+
filters: ComparisonFilter[];
|
|
3834
|
+
};
|
|
3835
|
+
// AI Search V2 Request Types
|
|
3836
|
+
export type AiSearchSearchRequest = {
|
|
3837
|
+
messages: Array<{
|
|
3838
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3839
|
+
content: string | null;
|
|
3840
|
+
}>;
|
|
3841
|
+
ai_search_options?: {
|
|
3842
|
+
retrieval?: {
|
|
3843
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3844
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3845
|
+
match_threshold?: number;
|
|
3846
|
+
/** Maximum number of results (1-50, default 10) */
|
|
3847
|
+
max_num_results?: number;
|
|
3848
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3849
|
+
/** Context expansion (0-3, default 0) */
|
|
3850
|
+
context_expansion?: number;
|
|
3851
|
+
[key: string]: unknown;
|
|
3852
|
+
};
|
|
3853
|
+
query_rewrite?: {
|
|
3854
|
+
enabled?: boolean;
|
|
3855
|
+
model?: string;
|
|
3856
|
+
rewrite_prompt?: string;
|
|
3857
|
+
[key: string]: unknown;
|
|
3858
|
+
};
|
|
3859
|
+
reranking?: {
|
|
3860
|
+
/** Enable reranking (default false) */
|
|
3861
|
+
enabled?: boolean;
|
|
3862
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3863
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3864
|
+
match_threshold?: number;
|
|
3865
|
+
[key: string]: unknown;
|
|
3866
|
+
};
|
|
3867
|
+
[key: string]: unknown;
|
|
3868
|
+
};
|
|
3869
|
+
};
|
|
3870
|
+
export type AiSearchChatCompletionsRequest = {
|
|
3871
|
+
messages: Array<{
|
|
3872
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3873
|
+
content: string | null;
|
|
3874
|
+
}>;
|
|
3875
|
+
model?: string;
|
|
3876
|
+
stream?: boolean;
|
|
3877
|
+
ai_search_options?: {
|
|
3878
|
+
retrieval?: {
|
|
3879
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3880
|
+
match_threshold?: number;
|
|
3881
|
+
max_num_results?: number;
|
|
3882
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3883
|
+
context_expansion?: number;
|
|
3884
|
+
[key: string]: unknown;
|
|
3885
|
+
};
|
|
3886
|
+
query_rewrite?: {
|
|
3887
|
+
enabled?: boolean;
|
|
3888
|
+
model?: string;
|
|
3889
|
+
rewrite_prompt?: string;
|
|
3890
|
+
[key: string]: unknown;
|
|
3891
|
+
};
|
|
3892
|
+
reranking?: {
|
|
3893
|
+
enabled?: boolean;
|
|
3894
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3895
|
+
match_threshold?: number;
|
|
3896
|
+
[key: string]: unknown;
|
|
3897
|
+
};
|
|
3898
|
+
[key: string]: unknown;
|
|
3899
|
+
};
|
|
3900
|
+
[key: string]: unknown;
|
|
3901
|
+
};
|
|
3902
|
+
// AI Search V2 Response Types
|
|
3903
|
+
export type AiSearchSearchResponse = {
|
|
3904
|
+
search_query: string;
|
|
3905
|
+
chunks: Array<{
|
|
3906
|
+
id: string;
|
|
3907
|
+
type: string;
|
|
3908
|
+
/** Match score (0-1) */
|
|
3909
|
+
score: number;
|
|
3910
|
+
text: string;
|
|
3911
|
+
item: {
|
|
3912
|
+
timestamp?: number;
|
|
3913
|
+
key: string;
|
|
3914
|
+
metadata?: Record<string, unknown>;
|
|
3915
|
+
};
|
|
3916
|
+
scoring_details?: {
|
|
3917
|
+
/** Keyword match score (0-1) */
|
|
3918
|
+
keyword_score?: number;
|
|
3919
|
+
/** Vector similarity score (0-1) */
|
|
3920
|
+
vector_score?: number;
|
|
3921
|
+
};
|
|
3922
|
+
}>;
|
|
3923
|
+
};
|
|
3924
|
+
export type AiSearchListResponse = Array<{
|
|
3925
|
+
id: string;
|
|
3926
|
+
internal_id?: string;
|
|
3927
|
+
account_id?: string;
|
|
3928
|
+
account_tag?: string;
|
|
3929
|
+
/** Whether the instance is enabled (default true) */
|
|
3930
|
+
enable?: boolean;
|
|
3931
|
+
type?: "r2" | "web-crawler";
|
|
3932
|
+
source?: string;
|
|
3933
|
+
[key: string]: unknown;
|
|
3934
|
+
}>;
|
|
3935
|
+
export type AiSearchConfig = {
|
|
3936
|
+
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3937
|
+
id: string;
|
|
3938
|
+
type: "r2" | "web-crawler";
|
|
3939
|
+
source: string;
|
|
3940
|
+
source_params?: object;
|
|
3941
|
+
/** Token ID (UUID format) */
|
|
3942
|
+
token_id?: string;
|
|
3943
|
+
ai_gateway_id?: string;
|
|
3944
|
+
/** Enable query rewriting (default false) */
|
|
3945
|
+
rewrite_query?: boolean;
|
|
3946
|
+
/** Enable reranking (default false) */
|
|
3947
|
+
reranking?: boolean;
|
|
3948
|
+
embedding_model?: string;
|
|
3949
|
+
ai_search_model?: string;
|
|
3950
|
+
};
|
|
3951
|
+
export type AiSearchInstance = {
|
|
3952
|
+
id: string;
|
|
3953
|
+
enable?: boolean;
|
|
3954
|
+
type?: "r2" | "web-crawler";
|
|
3955
|
+
source?: string;
|
|
3956
|
+
[key: string]: unknown;
|
|
3957
|
+
};
|
|
3958
|
+
// AI Search Instance Service - Instance-level operations
|
|
3959
|
+
export declare abstract class AiSearchInstanceService {
|
|
3960
|
+
/**
|
|
3961
|
+
* Search the AI Search instance for relevant chunks.
|
|
3962
|
+
* @param params Search request with messages and AI search options
|
|
3963
|
+
* @returns Search response with matching chunks
|
|
3964
|
+
*/
|
|
3965
|
+
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
3966
|
+
/**
|
|
3967
|
+
* Generate chat completions with AI Search context.
|
|
3968
|
+
* @param params Chat completions request with optional streaming
|
|
3969
|
+
* @returns Response object (if streaming) or chat completion result
|
|
3970
|
+
*/
|
|
3971
|
+
chatCompletions(
|
|
3972
|
+
params: AiSearchChatCompletionsRequest,
|
|
3973
|
+
): Promise<Response | object>;
|
|
3974
|
+
/**
|
|
3975
|
+
* Delete this AI Search instance.
|
|
3976
|
+
*/
|
|
3977
|
+
delete(): Promise<void>;
|
|
3978
|
+
}
|
|
3979
|
+
// AI Search Account Service - Account-level operations
|
|
3980
|
+
export declare abstract class AiSearchAccountService {
|
|
3981
|
+
/**
|
|
3982
|
+
* List all AI Search instances in the account.
|
|
3983
|
+
* @returns Array of AI Search instances
|
|
3984
|
+
*/
|
|
3985
|
+
list(): Promise<AiSearchListResponse>;
|
|
3986
|
+
/**
|
|
3987
|
+
* Get an AI Search instance by ID.
|
|
3988
|
+
* @param name Instance ID
|
|
3989
|
+
* @returns Instance service for performing operations
|
|
3990
|
+
*/
|
|
3991
|
+
get(name: string): AiSearchInstanceService;
|
|
3992
|
+
/**
|
|
3993
|
+
* Create a new AI Search instance.
|
|
3994
|
+
* @param config Instance configuration
|
|
3995
|
+
* @returns Instance service for performing operations
|
|
3996
|
+
*/
|
|
3997
|
+
create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
|
|
3998
|
+
}
|
|
3821
3999
|
export type AiImageClassificationInput = {
|
|
3822
4000
|
image: number[];
|
|
3823
4001
|
};
|
|
@@ -9318,6 +9496,48 @@ export declare abstract class Ai<
|
|
|
9318
9496
|
> {
|
|
9319
9497
|
aiGatewayLogId: string | null;
|
|
9320
9498
|
gateway(gatewayId: string): AiGateway;
|
|
9499
|
+
/**
|
|
9500
|
+
* Access the AI Search API for managing AI-powered search instances.
|
|
9501
|
+
*
|
|
9502
|
+
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
9503
|
+
* - Account-level operations: `list()`, `create()`
|
|
9504
|
+
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
9505
|
+
*
|
|
9506
|
+
* @example
|
|
9507
|
+
* ```typescript
|
|
9508
|
+
* // List all AI Search instances
|
|
9509
|
+
* const instances = await env.AI.aiSearch.list();
|
|
9510
|
+
*
|
|
9511
|
+
* // Search an instance
|
|
9512
|
+
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
9513
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9514
|
+
* ai_search_options: {
|
|
9515
|
+
* retrieval: { max_num_results: 10 }
|
|
9516
|
+
* }
|
|
9517
|
+
* });
|
|
9518
|
+
*
|
|
9519
|
+
* // Generate chat completions with AI Search context
|
|
9520
|
+
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
9521
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9522
|
+
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
9523
|
+
* });
|
|
9524
|
+
* ```
|
|
9525
|
+
*/
|
|
9526
|
+
aiSearch(): AiSearchAccountService;
|
|
9527
|
+
/**
|
|
9528
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9529
|
+
* Use `env.AI.aiSearch` instead for better API design and new features.
|
|
9530
|
+
*
|
|
9531
|
+
* Migration guide:
|
|
9532
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9533
|
+
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
9534
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9535
|
+
*
|
|
9536
|
+
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
9537
|
+
*
|
|
9538
|
+
* @see AiSearchAccountService
|
|
9539
|
+
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
9540
|
+
*/
|
|
9321
9541
|
autorag(autoragId: string): AutoRAG;
|
|
9322
9542
|
run<
|
|
9323
9543
|
Name extends keyof AiModelList,
|
|
@@ -9474,19 +9694,30 @@ export declare abstract class AiGateway {
|
|
|
9474
9694
|
): Promise<Response>;
|
|
9475
9695
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
9476
9696
|
}
|
|
9697
|
+
/**
|
|
9698
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
|
|
9699
|
+
* @see AiSearchInternalError
|
|
9700
|
+
*/
|
|
9477
9701
|
export interface AutoRAGInternalError extends Error {}
|
|
9702
|
+
/**
|
|
9703
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
|
|
9704
|
+
* @see AiSearchNotFoundError
|
|
9705
|
+
*/
|
|
9478
9706
|
export interface AutoRAGNotFoundError extends Error {}
|
|
9707
|
+
/**
|
|
9708
|
+
* @deprecated This error type is no longer used in the AI Search API.
|
|
9709
|
+
*/
|
|
9479
9710
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
9711
|
+
/**
|
|
9712
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
|
|
9713
|
+
* @see AiSearchNameNotSetError
|
|
9714
|
+
*/
|
|
9480
9715
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
|
|
9486
|
-
export type CompoundFilter = {
|
|
9487
|
-
type: "and" | "or";
|
|
9488
|
-
filters: ComparisonFilter[];
|
|
9489
|
-
};
|
|
9716
|
+
/**
|
|
9717
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9718
|
+
* Use AiSearchSearchRequest with the new API instead.
|
|
9719
|
+
* @see AiSearchSearchRequest
|
|
9720
|
+
*/
|
|
9490
9721
|
export type AutoRagSearchRequest = {
|
|
9491
9722
|
query: string;
|
|
9492
9723
|
filters?: CompoundFilter | ComparisonFilter;
|
|
@@ -9501,16 +9732,31 @@ export type AutoRagSearchRequest = {
|
|
|
9501
9732
|
};
|
|
9502
9733
|
rewrite_query?: boolean;
|
|
9503
9734
|
};
|
|
9735
|
+
/**
|
|
9736
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9737
|
+
* Use AiSearchChatCompletionsRequest with the new API instead.
|
|
9738
|
+
* @see AiSearchChatCompletionsRequest
|
|
9739
|
+
*/
|
|
9504
9740
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
9505
9741
|
stream?: boolean;
|
|
9506
9742
|
system_prompt?: string;
|
|
9507
9743
|
};
|
|
9744
|
+
/**
|
|
9745
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9746
|
+
* Use AiSearchChatCompletionsRequest with stream: true instead.
|
|
9747
|
+
* @see AiSearchChatCompletionsRequest
|
|
9748
|
+
*/
|
|
9508
9749
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
9509
9750
|
AutoRagAiSearchRequest,
|
|
9510
9751
|
"stream"
|
|
9511
9752
|
> & {
|
|
9512
9753
|
stream: true;
|
|
9513
9754
|
};
|
|
9755
|
+
/**
|
|
9756
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9757
|
+
* Use AiSearchSearchResponse with the new API instead.
|
|
9758
|
+
* @see AiSearchSearchResponse
|
|
9759
|
+
*/
|
|
9514
9760
|
export type AutoRagSearchResponse = {
|
|
9515
9761
|
object: "vector_store.search_results.page";
|
|
9516
9762
|
search_query: string;
|
|
@@ -9527,6 +9773,11 @@ export type AutoRagSearchResponse = {
|
|
|
9527
9773
|
has_more: boolean;
|
|
9528
9774
|
next_page: string | null;
|
|
9529
9775
|
};
|
|
9776
|
+
/**
|
|
9777
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9778
|
+
* Use AiSearchListResponse with the new API instead.
|
|
9779
|
+
* @see AiSearchListResponse
|
|
9780
|
+
*/
|
|
9530
9781
|
export type AutoRagListResponse = {
|
|
9531
9782
|
id: string;
|
|
9532
9783
|
enable: boolean;
|
|
@@ -9536,14 +9787,51 @@ export type AutoRagListResponse = {
|
|
|
9536
9787
|
paused: boolean;
|
|
9537
9788
|
status: string;
|
|
9538
9789
|
}[];
|
|
9790
|
+
/**
|
|
9791
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9792
|
+
* The new API returns different response formats for chat completions.
|
|
9793
|
+
*/
|
|
9539
9794
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
9540
9795
|
response: string;
|
|
9541
9796
|
};
|
|
9797
|
+
/**
|
|
9798
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9799
|
+
* Use the new AI Search API instead: `env.AI.aiSearch`
|
|
9800
|
+
*
|
|
9801
|
+
* Migration guide:
|
|
9802
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9803
|
+
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
9804
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9805
|
+
*
|
|
9806
|
+
* @see AiSearchAccountService
|
|
9807
|
+
* @see AiSearchInstanceService
|
|
9808
|
+
*/
|
|
9542
9809
|
export declare abstract class AutoRAG {
|
|
9810
|
+
/**
|
|
9811
|
+
* @deprecated Use `env.AI.aiSearch.list()` instead.
|
|
9812
|
+
* @see AiSearchAccountService.list
|
|
9813
|
+
*/
|
|
9543
9814
|
list(): Promise<AutoRagListResponse>;
|
|
9815
|
+
/**
|
|
9816
|
+
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
|
|
9817
|
+
* Note: The new API uses a messages array instead of a query string.
|
|
9818
|
+
* @see AiSearchInstanceService.search
|
|
9819
|
+
*/
|
|
9544
9820
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
9821
|
+
/**
|
|
9822
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9823
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9824
|
+
*/
|
|
9545
9825
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
9826
|
+
/**
|
|
9827
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9828
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9829
|
+
*/
|
|
9546
9830
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
9831
|
+
/**
|
|
9832
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9833
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9834
|
+
*/
|
|
9547
9835
|
aiSearch(
|
|
9548
9836
|
params: AutoRagAiSearchRequest,
|
|
9549
9837
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
@@ -10945,6 +11233,86 @@ export type ImageOutputOptions = {
|
|
|
10945
11233
|
background?: string;
|
|
10946
11234
|
anim?: boolean;
|
|
10947
11235
|
};
|
|
11236
|
+
export interface ImageMetadata {
|
|
11237
|
+
id: string;
|
|
11238
|
+
filename?: string;
|
|
11239
|
+
uploaded?: string;
|
|
11240
|
+
requireSignedURLs: boolean;
|
|
11241
|
+
meta?: Record<string, unknown>;
|
|
11242
|
+
variants: string[];
|
|
11243
|
+
draft?: boolean;
|
|
11244
|
+
creator?: string;
|
|
11245
|
+
}
|
|
11246
|
+
export interface ImageUploadOptions {
|
|
11247
|
+
id?: string;
|
|
11248
|
+
filename?: string;
|
|
11249
|
+
requireSignedURLs?: boolean;
|
|
11250
|
+
metadata?: Record<string, unknown>;
|
|
11251
|
+
creator?: string;
|
|
11252
|
+
encoding?: "base64";
|
|
11253
|
+
}
|
|
11254
|
+
export interface ImageUpdateOptions {
|
|
11255
|
+
requireSignedURLs?: boolean;
|
|
11256
|
+
metadata?: Record<string, unknown>;
|
|
11257
|
+
creator?: string;
|
|
11258
|
+
}
|
|
11259
|
+
export interface ImageListOptions {
|
|
11260
|
+
limit?: number;
|
|
11261
|
+
cursor?: string;
|
|
11262
|
+
sortOrder?: "asc" | "desc";
|
|
11263
|
+
creator?: string;
|
|
11264
|
+
}
|
|
11265
|
+
export interface ImageList {
|
|
11266
|
+
images: ImageMetadata[];
|
|
11267
|
+
cursor?: string;
|
|
11268
|
+
listComplete: boolean;
|
|
11269
|
+
}
|
|
11270
|
+
export interface HostedImagesBinding {
|
|
11271
|
+
/**
|
|
11272
|
+
* Get detailed metadata for a hosted image
|
|
11273
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11274
|
+
* @returns Image metadata, or null if not found
|
|
11275
|
+
*/
|
|
11276
|
+
details(imageId: string): Promise<ImageMetadata | null>;
|
|
11277
|
+
/**
|
|
11278
|
+
* Get the raw image data for a hosted image
|
|
11279
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11280
|
+
* @returns ReadableStream of image bytes, or null if not found
|
|
11281
|
+
*/
|
|
11282
|
+
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
11283
|
+
/**
|
|
11284
|
+
* Upload a new hosted image
|
|
11285
|
+
* @param image The image file to upload
|
|
11286
|
+
* @param options Upload configuration
|
|
11287
|
+
* @returns Metadata for the uploaded image
|
|
11288
|
+
* @throws {@link ImagesError} if upload fails
|
|
11289
|
+
*/
|
|
11290
|
+
upload(
|
|
11291
|
+
image: ReadableStream<Uint8Array> | ArrayBuffer,
|
|
11292
|
+
options?: ImageUploadOptions,
|
|
11293
|
+
): Promise<ImageMetadata>;
|
|
11294
|
+
/**
|
|
11295
|
+
* Update hosted image metadata
|
|
11296
|
+
* @param imageId The ID of the image
|
|
11297
|
+
* @param options Properties to update
|
|
11298
|
+
* @returns Updated image metadata
|
|
11299
|
+
* @throws {@link ImagesError} if update fails
|
|
11300
|
+
*/
|
|
11301
|
+
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
|
|
11302
|
+
/**
|
|
11303
|
+
* Delete a hosted image
|
|
11304
|
+
* @param imageId The ID of the image
|
|
11305
|
+
* @returns True if deleted, false if not found
|
|
11306
|
+
*/
|
|
11307
|
+
delete(imageId: string): Promise<boolean>;
|
|
11308
|
+
/**
|
|
11309
|
+
* List hosted images with pagination
|
|
11310
|
+
* @param options List configuration
|
|
11311
|
+
* @returns List of images with pagination info
|
|
11312
|
+
* @throws {@link ImagesError} if list fails
|
|
11313
|
+
*/
|
|
11314
|
+
list(options?: ImageListOptions): Promise<ImageList>;
|
|
11315
|
+
}
|
|
10948
11316
|
export interface ImagesBinding {
|
|
10949
11317
|
/**
|
|
10950
11318
|
* Get image metadata (type, width and height)
|
|
@@ -10964,6 +11332,10 @@ export interface ImagesBinding {
|
|
|
10964
11332
|
stream: ReadableStream<Uint8Array>,
|
|
10965
11333
|
options?: ImageInputOptions,
|
|
10966
11334
|
): ImageTransformer;
|
|
11335
|
+
/**
|
|
11336
|
+
* Access hosted images CRUD operations
|
|
11337
|
+
*/
|
|
11338
|
+
readonly hosted: HostedImagesBinding;
|
|
10967
11339
|
}
|
|
10968
11340
|
export interface ImageTransformer {
|
|
10969
11341
|
/**
|
|
@@ -11034,8 +11406,14 @@ export interface MediaTransformer {
|
|
|
11034
11406
|
* @returns A generator for producing the transformed media output
|
|
11035
11407
|
*/
|
|
11036
11408
|
transform(
|
|
11037
|
-
transform
|
|
11409
|
+
transform?: MediaTransformationInputOptions,
|
|
11038
11410
|
): MediaTransformationGenerator;
|
|
11411
|
+
/**
|
|
11412
|
+
* Generates the final media output with specified options.
|
|
11413
|
+
* @param output - Configuration for the output format and parameters
|
|
11414
|
+
* @returns The final transformation result containing the transformed media
|
|
11415
|
+
*/
|
|
11416
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11039
11417
|
}
|
|
11040
11418
|
/**
|
|
11041
11419
|
* Generator for producing media transformation results.
|
|
@@ -11047,7 +11425,7 @@ export interface MediaTransformationGenerator {
|
|
|
11047
11425
|
* @param output - Configuration for the output format and parameters
|
|
11048
11426
|
* @returns The final transformation result containing the transformed media
|
|
11049
11427
|
*/
|
|
11050
|
-
output(output
|
|
11428
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11051
11429
|
}
|
|
11052
11430
|
/**
|
|
11053
11431
|
* Result of a media transformation operation.
|
|
@@ -11056,19 +11434,19 @@ export interface MediaTransformationGenerator {
|
|
|
11056
11434
|
export interface MediaTransformationResult {
|
|
11057
11435
|
/**
|
|
11058
11436
|
* Returns the transformed media as a readable stream of bytes.
|
|
11059
|
-
* @returns A
|
|
11437
|
+
* @returns A promise containing a readable stream with the transformed media
|
|
11060
11438
|
*/
|
|
11061
|
-
media(): ReadableStream<Uint8Array
|
|
11439
|
+
media(): Promise<ReadableStream<Uint8Array>>;
|
|
11062
11440
|
/**
|
|
11063
11441
|
* Returns the transformed media as an HTTP response object.
|
|
11064
|
-
* @returns The transformed media as a Response
|
|
11442
|
+
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
|
|
11065
11443
|
*/
|
|
11066
|
-
response(): Response
|
|
11444
|
+
response(): Promise<Response>;
|
|
11067
11445
|
/**
|
|
11068
11446
|
* Returns the MIME type of the transformed media.
|
|
11069
|
-
* @returns
|
|
11447
|
+
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
11070
11448
|
*/
|
|
11071
|
-
contentType(): string
|
|
11449
|
+
contentType(): Promise<string>;
|
|
11072
11450
|
}
|
|
11073
11451
|
/**
|
|
11074
11452
|
* Configuration options for transforming media input.
|