@cloudflare/workers-types 4.20260218.0 → 4.20260226.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2021-11-03/index.d.ts +395 -17
- package/2021-11-03/index.ts +395 -17
- package/2022-01-31/index.d.ts +395 -17
- package/2022-01-31/index.ts +395 -17
- package/2022-03-21/index.d.ts +395 -17
- package/2022-03-21/index.ts +395 -17
- package/2022-08-04/index.d.ts +395 -17
- package/2022-08-04/index.ts +395 -17
- package/2022-10-31/index.d.ts +395 -17
- package/2022-10-31/index.ts +395 -17
- package/2022-11-30/index.d.ts +395 -17
- package/2022-11-30/index.ts +395 -17
- package/2023-03-01/index.d.ts +395 -17
- package/2023-03-01/index.ts +395 -17
- package/2023-07-01/index.d.ts +395 -17
- package/2023-07-01/index.ts +395 -17
- package/experimental/index.d.ts +442 -20
- package/experimental/index.ts +442 -20
- package/index.d.ts +395 -17
- package/index.ts +395 -17
- package/latest/index.d.ts +395 -17
- package/latest/index.ts +395 -17
- package/oldest/index.d.ts +395 -17
- package/oldest/index.ts +395 -17
- package/package.json +1 -1
package/2022-08-04/index.d.ts
CHANGED
|
@@ -3818,6 +3818,184 @@ 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
|
+
interface AiSearchInternalError extends Error {}
|
|
3823
|
+
interface AiSearchNotFoundError extends Error {}
|
|
3824
|
+
interface AiSearchNameNotSetError extends Error {}
|
|
3825
|
+
// Filter types (shared with AutoRAG for compatibility)
|
|
3826
|
+
type ComparisonFilter = {
|
|
3827
|
+
key: string;
|
|
3828
|
+
type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
3829
|
+
value: string | number | boolean;
|
|
3830
|
+
};
|
|
3831
|
+
type CompoundFilter = {
|
|
3832
|
+
type: "and" | "or";
|
|
3833
|
+
filters: ComparisonFilter[];
|
|
3834
|
+
};
|
|
3835
|
+
// AI Search V2 Request Types
|
|
3836
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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
|
type AiImageClassificationInput = {
|
|
3822
4000
|
image: number[];
|
|
3823
4001
|
};
|
|
@@ -9315,6 +9493,48 @@ type AiModelListType = Record<string, any>;
|
|
|
9315
9493
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
9316
9494
|
aiGatewayLogId: string | null;
|
|
9317
9495
|
gateway(gatewayId: string): AiGateway;
|
|
9496
|
+
/**
|
|
9497
|
+
* Access the AI Search API for managing AI-powered search instances.
|
|
9498
|
+
*
|
|
9499
|
+
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
9500
|
+
* - Account-level operations: `list()`, `create()`
|
|
9501
|
+
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
9502
|
+
*
|
|
9503
|
+
* @example
|
|
9504
|
+
* ```typescript
|
|
9505
|
+
* // List all AI Search instances
|
|
9506
|
+
* const instances = await env.AI.aiSearch.list();
|
|
9507
|
+
*
|
|
9508
|
+
* // Search an instance
|
|
9509
|
+
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
9510
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9511
|
+
* ai_search_options: {
|
|
9512
|
+
* retrieval: { max_num_results: 10 }
|
|
9513
|
+
* }
|
|
9514
|
+
* });
|
|
9515
|
+
*
|
|
9516
|
+
* // Generate chat completions with AI Search context
|
|
9517
|
+
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
9518
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9519
|
+
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
9520
|
+
* });
|
|
9521
|
+
* ```
|
|
9522
|
+
*/
|
|
9523
|
+
aiSearch(): AiSearchAccountService;
|
|
9524
|
+
/**
|
|
9525
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9526
|
+
* Use `env.AI.aiSearch` instead for better API design and new features.
|
|
9527
|
+
*
|
|
9528
|
+
* Migration guide:
|
|
9529
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9530
|
+
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
9531
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9532
|
+
*
|
|
9533
|
+
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
9534
|
+
*
|
|
9535
|
+
* @see AiSearchAccountService
|
|
9536
|
+
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
9537
|
+
*/
|
|
9318
9538
|
autorag(autoragId: string): AutoRAG;
|
|
9319
9539
|
run<
|
|
9320
9540
|
Name extends keyof AiModelList,
|
|
@@ -9471,19 +9691,30 @@ declare abstract class AiGateway {
|
|
|
9471
9691
|
): Promise<Response>;
|
|
9472
9692
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
9473
9693
|
}
|
|
9694
|
+
/**
|
|
9695
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
|
|
9696
|
+
* @see AiSearchInternalError
|
|
9697
|
+
*/
|
|
9474
9698
|
interface AutoRAGInternalError extends Error {}
|
|
9699
|
+
/**
|
|
9700
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
|
|
9701
|
+
* @see AiSearchNotFoundError
|
|
9702
|
+
*/
|
|
9475
9703
|
interface AutoRAGNotFoundError extends Error {}
|
|
9704
|
+
/**
|
|
9705
|
+
* @deprecated This error type is no longer used in the AI Search API.
|
|
9706
|
+
*/
|
|
9476
9707
|
interface AutoRAGUnauthorizedError extends Error {}
|
|
9708
|
+
/**
|
|
9709
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
|
|
9710
|
+
* @see AiSearchNameNotSetError
|
|
9711
|
+
*/
|
|
9477
9712
|
interface AutoRAGNameNotSetError extends Error {}
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
type CompoundFilter = {
|
|
9484
|
-
type: "and" | "or";
|
|
9485
|
-
filters: ComparisonFilter[];
|
|
9486
|
-
};
|
|
9713
|
+
/**
|
|
9714
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9715
|
+
* Use AiSearchSearchRequest with the new API instead.
|
|
9716
|
+
* @see AiSearchSearchRequest
|
|
9717
|
+
*/
|
|
9487
9718
|
type AutoRagSearchRequest = {
|
|
9488
9719
|
query: string;
|
|
9489
9720
|
filters?: CompoundFilter | ComparisonFilter;
|
|
@@ -9498,16 +9729,31 @@ type AutoRagSearchRequest = {
|
|
|
9498
9729
|
};
|
|
9499
9730
|
rewrite_query?: boolean;
|
|
9500
9731
|
};
|
|
9732
|
+
/**
|
|
9733
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9734
|
+
* Use AiSearchChatCompletionsRequest with the new API instead.
|
|
9735
|
+
* @see AiSearchChatCompletionsRequest
|
|
9736
|
+
*/
|
|
9501
9737
|
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
9502
9738
|
stream?: boolean;
|
|
9503
9739
|
system_prompt?: string;
|
|
9504
9740
|
};
|
|
9741
|
+
/**
|
|
9742
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9743
|
+
* Use AiSearchChatCompletionsRequest with stream: true instead.
|
|
9744
|
+
* @see AiSearchChatCompletionsRequest
|
|
9745
|
+
*/
|
|
9505
9746
|
type AutoRagAiSearchRequestStreaming = Omit<
|
|
9506
9747
|
AutoRagAiSearchRequest,
|
|
9507
9748
|
"stream"
|
|
9508
9749
|
> & {
|
|
9509
9750
|
stream: true;
|
|
9510
9751
|
};
|
|
9752
|
+
/**
|
|
9753
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9754
|
+
* Use AiSearchSearchResponse with the new API instead.
|
|
9755
|
+
* @see AiSearchSearchResponse
|
|
9756
|
+
*/
|
|
9511
9757
|
type AutoRagSearchResponse = {
|
|
9512
9758
|
object: "vector_store.search_results.page";
|
|
9513
9759
|
search_query: string;
|
|
@@ -9524,6 +9770,11 @@ type AutoRagSearchResponse = {
|
|
|
9524
9770
|
has_more: boolean;
|
|
9525
9771
|
next_page: string | null;
|
|
9526
9772
|
};
|
|
9773
|
+
/**
|
|
9774
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9775
|
+
* Use AiSearchListResponse with the new API instead.
|
|
9776
|
+
* @see AiSearchListResponse
|
|
9777
|
+
*/
|
|
9527
9778
|
type AutoRagListResponse = {
|
|
9528
9779
|
id: string;
|
|
9529
9780
|
enable: boolean;
|
|
@@ -9533,14 +9784,51 @@ type AutoRagListResponse = {
|
|
|
9533
9784
|
paused: boolean;
|
|
9534
9785
|
status: string;
|
|
9535
9786
|
}[];
|
|
9787
|
+
/**
|
|
9788
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9789
|
+
* The new API returns different response formats for chat completions.
|
|
9790
|
+
*/
|
|
9536
9791
|
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
9537
9792
|
response: string;
|
|
9538
9793
|
};
|
|
9794
|
+
/**
|
|
9795
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9796
|
+
* Use the new AI Search API instead: `env.AI.aiSearch`
|
|
9797
|
+
*
|
|
9798
|
+
* Migration guide:
|
|
9799
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9800
|
+
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
9801
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9802
|
+
*
|
|
9803
|
+
* @see AiSearchAccountService
|
|
9804
|
+
* @see AiSearchInstanceService
|
|
9805
|
+
*/
|
|
9539
9806
|
declare abstract class AutoRAG {
|
|
9807
|
+
/**
|
|
9808
|
+
* @deprecated Use `env.AI.aiSearch.list()` instead.
|
|
9809
|
+
* @see AiSearchAccountService.list
|
|
9810
|
+
*/
|
|
9540
9811
|
list(): Promise<AutoRagListResponse>;
|
|
9812
|
+
/**
|
|
9813
|
+
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
|
|
9814
|
+
* Note: The new API uses a messages array instead of a query string.
|
|
9815
|
+
* @see AiSearchInstanceService.search
|
|
9816
|
+
*/
|
|
9541
9817
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
9818
|
+
/**
|
|
9819
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9820
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9821
|
+
*/
|
|
9542
9822
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
9823
|
+
/**
|
|
9824
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9825
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9826
|
+
*/
|
|
9543
9827
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
9828
|
+
/**
|
|
9829
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9830
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9831
|
+
*/
|
|
9544
9832
|
aiSearch(
|
|
9545
9833
|
params: AutoRagAiSearchRequest,
|
|
9546
9834
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
@@ -10937,6 +11225,86 @@ type ImageOutputOptions = {
|
|
|
10937
11225
|
background?: string;
|
|
10938
11226
|
anim?: boolean;
|
|
10939
11227
|
};
|
|
11228
|
+
interface ImageMetadata {
|
|
11229
|
+
id: string;
|
|
11230
|
+
filename?: string;
|
|
11231
|
+
uploaded?: string;
|
|
11232
|
+
requireSignedURLs: boolean;
|
|
11233
|
+
meta?: Record<string, unknown>;
|
|
11234
|
+
variants: string[];
|
|
11235
|
+
draft?: boolean;
|
|
11236
|
+
creator?: string;
|
|
11237
|
+
}
|
|
11238
|
+
interface ImageUploadOptions {
|
|
11239
|
+
id?: string;
|
|
11240
|
+
filename?: string;
|
|
11241
|
+
requireSignedURLs?: boolean;
|
|
11242
|
+
metadata?: Record<string, unknown>;
|
|
11243
|
+
creator?: string;
|
|
11244
|
+
encoding?: "base64";
|
|
11245
|
+
}
|
|
11246
|
+
interface ImageUpdateOptions {
|
|
11247
|
+
requireSignedURLs?: boolean;
|
|
11248
|
+
metadata?: Record<string, unknown>;
|
|
11249
|
+
creator?: string;
|
|
11250
|
+
}
|
|
11251
|
+
interface ImageListOptions {
|
|
11252
|
+
limit?: number;
|
|
11253
|
+
cursor?: string;
|
|
11254
|
+
sortOrder?: "asc" | "desc";
|
|
11255
|
+
creator?: string;
|
|
11256
|
+
}
|
|
11257
|
+
interface ImageList {
|
|
11258
|
+
images: ImageMetadata[];
|
|
11259
|
+
cursor?: string;
|
|
11260
|
+
listComplete: boolean;
|
|
11261
|
+
}
|
|
11262
|
+
interface HostedImagesBinding {
|
|
11263
|
+
/**
|
|
11264
|
+
* Get detailed metadata for a hosted image
|
|
11265
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11266
|
+
* @returns Image metadata, or null if not found
|
|
11267
|
+
*/
|
|
11268
|
+
details(imageId: string): Promise<ImageMetadata | null>;
|
|
11269
|
+
/**
|
|
11270
|
+
* Get the raw image data for a hosted image
|
|
11271
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11272
|
+
* @returns ReadableStream of image bytes, or null if not found
|
|
11273
|
+
*/
|
|
11274
|
+
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
11275
|
+
/**
|
|
11276
|
+
* Upload a new hosted image
|
|
11277
|
+
* @param image The image file to upload
|
|
11278
|
+
* @param options Upload configuration
|
|
11279
|
+
* @returns Metadata for the uploaded image
|
|
11280
|
+
* @throws {@link ImagesError} if upload fails
|
|
11281
|
+
*/
|
|
11282
|
+
upload(
|
|
11283
|
+
image: ReadableStream<Uint8Array> | ArrayBuffer,
|
|
11284
|
+
options?: ImageUploadOptions,
|
|
11285
|
+
): Promise<ImageMetadata>;
|
|
11286
|
+
/**
|
|
11287
|
+
* Update hosted image metadata
|
|
11288
|
+
* @param imageId The ID of the image
|
|
11289
|
+
* @param options Properties to update
|
|
11290
|
+
* @returns Updated image metadata
|
|
11291
|
+
* @throws {@link ImagesError} if update fails
|
|
11292
|
+
*/
|
|
11293
|
+
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
|
|
11294
|
+
/**
|
|
11295
|
+
* Delete a hosted image
|
|
11296
|
+
* @param imageId The ID of the image
|
|
11297
|
+
* @returns True if deleted, false if not found
|
|
11298
|
+
*/
|
|
11299
|
+
delete(imageId: string): Promise<boolean>;
|
|
11300
|
+
/**
|
|
11301
|
+
* List hosted images with pagination
|
|
11302
|
+
* @param options List configuration
|
|
11303
|
+
* @returns List of images with pagination info
|
|
11304
|
+
* @throws {@link ImagesError} if list fails
|
|
11305
|
+
*/
|
|
11306
|
+
list(options?: ImageListOptions): Promise<ImageList>;
|
|
11307
|
+
}
|
|
10940
11308
|
interface ImagesBinding {
|
|
10941
11309
|
/**
|
|
10942
11310
|
* Get image metadata (type, width and height)
|
|
@@ -10956,6 +11324,10 @@ interface ImagesBinding {
|
|
|
10956
11324
|
stream: ReadableStream<Uint8Array>,
|
|
10957
11325
|
options?: ImageInputOptions,
|
|
10958
11326
|
): ImageTransformer;
|
|
11327
|
+
/**
|
|
11328
|
+
* Access hosted images CRUD operations
|
|
11329
|
+
*/
|
|
11330
|
+
readonly hosted: HostedImagesBinding;
|
|
10959
11331
|
}
|
|
10960
11332
|
interface ImageTransformer {
|
|
10961
11333
|
/**
|
|
@@ -11026,8 +11398,14 @@ interface MediaTransformer {
|
|
|
11026
11398
|
* @returns A generator for producing the transformed media output
|
|
11027
11399
|
*/
|
|
11028
11400
|
transform(
|
|
11029
|
-
transform
|
|
11401
|
+
transform?: MediaTransformationInputOptions,
|
|
11030
11402
|
): MediaTransformationGenerator;
|
|
11403
|
+
/**
|
|
11404
|
+
* Generates the final media output with specified options.
|
|
11405
|
+
* @param output - Configuration for the output format and parameters
|
|
11406
|
+
* @returns The final transformation result containing the transformed media
|
|
11407
|
+
*/
|
|
11408
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11031
11409
|
}
|
|
11032
11410
|
/**
|
|
11033
11411
|
* Generator for producing media transformation results.
|
|
@@ -11039,7 +11417,7 @@ interface MediaTransformationGenerator {
|
|
|
11039
11417
|
* @param output - Configuration for the output format and parameters
|
|
11040
11418
|
* @returns The final transformation result containing the transformed media
|
|
11041
11419
|
*/
|
|
11042
|
-
output(output
|
|
11420
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11043
11421
|
}
|
|
11044
11422
|
/**
|
|
11045
11423
|
* Result of a media transformation operation.
|
|
@@ -11048,19 +11426,19 @@ interface MediaTransformationGenerator {
|
|
|
11048
11426
|
interface MediaTransformationResult {
|
|
11049
11427
|
/**
|
|
11050
11428
|
* Returns the transformed media as a readable stream of bytes.
|
|
11051
|
-
* @returns A
|
|
11429
|
+
* @returns A promise containing a readable stream with the transformed media
|
|
11052
11430
|
*/
|
|
11053
|
-
media(): ReadableStream<Uint8Array
|
|
11431
|
+
media(): Promise<ReadableStream<Uint8Array>>;
|
|
11054
11432
|
/**
|
|
11055
11433
|
* Returns the transformed media as an HTTP response object.
|
|
11056
|
-
* @returns The transformed media as a Response
|
|
11434
|
+
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
|
|
11057
11435
|
*/
|
|
11058
|
-
response(): Response
|
|
11436
|
+
response(): Promise<Response>;
|
|
11059
11437
|
/**
|
|
11060
11438
|
* Returns the MIME type of the transformed media.
|
|
11061
|
-
* @returns
|
|
11439
|
+
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
11062
11440
|
*/
|
|
11063
|
-
contentType(): string
|
|
11441
|
+
contentType(): Promise<string>;
|
|
11064
11442
|
}
|
|
11065
11443
|
/**
|
|
11066
11444
|
* Configuration options for transforming media input.
|