@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-10-31/index.ts
CHANGED
|
@@ -3846,6 +3846,190 @@ export declare abstract class Performance {
|
|
|
3846
3846
|
get timeOrigin(): number;
|
|
3847
3847
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
|
|
3848
3848
|
now(): number;
|
|
3849
|
+
/**
|
|
3850
|
+
* The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
|
|
3851
|
+
*
|
|
3852
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
|
|
3853
|
+
*/
|
|
3854
|
+
toJSON(): object;
|
|
3855
|
+
}
|
|
3856
|
+
// AI Search V2 API Error Interfaces
|
|
3857
|
+
export interface AiSearchInternalError extends Error {}
|
|
3858
|
+
export interface AiSearchNotFoundError extends Error {}
|
|
3859
|
+
export interface AiSearchNameNotSetError extends Error {}
|
|
3860
|
+
// Filter types (shared with AutoRAG for compatibility)
|
|
3861
|
+
export type ComparisonFilter = {
|
|
3862
|
+
key: string;
|
|
3863
|
+
type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
3864
|
+
value: string | number | boolean;
|
|
3865
|
+
};
|
|
3866
|
+
export type CompoundFilter = {
|
|
3867
|
+
type: "and" | "or";
|
|
3868
|
+
filters: ComparisonFilter[];
|
|
3869
|
+
};
|
|
3870
|
+
// AI Search V2 Request Types
|
|
3871
|
+
export type AiSearchSearchRequest = {
|
|
3872
|
+
messages: Array<{
|
|
3873
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3874
|
+
content: string | null;
|
|
3875
|
+
}>;
|
|
3876
|
+
ai_search_options?: {
|
|
3877
|
+
retrieval?: {
|
|
3878
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3879
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3880
|
+
match_threshold?: number;
|
|
3881
|
+
/** Maximum number of results (1-50, default 10) */
|
|
3882
|
+
max_num_results?: number;
|
|
3883
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3884
|
+
/** Context expansion (0-3, default 0) */
|
|
3885
|
+
context_expansion?: number;
|
|
3886
|
+
[key: string]: unknown;
|
|
3887
|
+
};
|
|
3888
|
+
query_rewrite?: {
|
|
3889
|
+
enabled?: boolean;
|
|
3890
|
+
model?: string;
|
|
3891
|
+
rewrite_prompt?: string;
|
|
3892
|
+
[key: string]: unknown;
|
|
3893
|
+
};
|
|
3894
|
+
reranking?: {
|
|
3895
|
+
/** Enable reranking (default false) */
|
|
3896
|
+
enabled?: boolean;
|
|
3897
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3898
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3899
|
+
match_threshold?: number;
|
|
3900
|
+
[key: string]: unknown;
|
|
3901
|
+
};
|
|
3902
|
+
[key: string]: unknown;
|
|
3903
|
+
};
|
|
3904
|
+
};
|
|
3905
|
+
export type AiSearchChatCompletionsRequest = {
|
|
3906
|
+
messages: Array<{
|
|
3907
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3908
|
+
content: string | null;
|
|
3909
|
+
}>;
|
|
3910
|
+
model?: string;
|
|
3911
|
+
stream?: boolean;
|
|
3912
|
+
ai_search_options?: {
|
|
3913
|
+
retrieval?: {
|
|
3914
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3915
|
+
match_threshold?: number;
|
|
3916
|
+
max_num_results?: number;
|
|
3917
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3918
|
+
context_expansion?: number;
|
|
3919
|
+
[key: string]: unknown;
|
|
3920
|
+
};
|
|
3921
|
+
query_rewrite?: {
|
|
3922
|
+
enabled?: boolean;
|
|
3923
|
+
model?: string;
|
|
3924
|
+
rewrite_prompt?: string;
|
|
3925
|
+
[key: string]: unknown;
|
|
3926
|
+
};
|
|
3927
|
+
reranking?: {
|
|
3928
|
+
enabled?: boolean;
|
|
3929
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3930
|
+
match_threshold?: number;
|
|
3931
|
+
[key: string]: unknown;
|
|
3932
|
+
};
|
|
3933
|
+
[key: string]: unknown;
|
|
3934
|
+
};
|
|
3935
|
+
[key: string]: unknown;
|
|
3936
|
+
};
|
|
3937
|
+
// AI Search V2 Response Types
|
|
3938
|
+
export type AiSearchSearchResponse = {
|
|
3939
|
+
search_query: string;
|
|
3940
|
+
chunks: Array<{
|
|
3941
|
+
id: string;
|
|
3942
|
+
type: string;
|
|
3943
|
+
/** Match score (0-1) */
|
|
3944
|
+
score: number;
|
|
3945
|
+
text: string;
|
|
3946
|
+
item: {
|
|
3947
|
+
timestamp?: number;
|
|
3948
|
+
key: string;
|
|
3949
|
+
metadata?: Record<string, unknown>;
|
|
3950
|
+
};
|
|
3951
|
+
scoring_details?: {
|
|
3952
|
+
/** Keyword match score (0-1) */
|
|
3953
|
+
keyword_score?: number;
|
|
3954
|
+
/** Vector similarity score (0-1) */
|
|
3955
|
+
vector_score?: number;
|
|
3956
|
+
};
|
|
3957
|
+
}>;
|
|
3958
|
+
};
|
|
3959
|
+
export type AiSearchListResponse = Array<{
|
|
3960
|
+
id: string;
|
|
3961
|
+
internal_id?: string;
|
|
3962
|
+
account_id?: string;
|
|
3963
|
+
account_tag?: string;
|
|
3964
|
+
/** Whether the instance is enabled (default true) */
|
|
3965
|
+
enable?: boolean;
|
|
3966
|
+
type?: "r2" | "web-crawler";
|
|
3967
|
+
source?: string;
|
|
3968
|
+
[key: string]: unknown;
|
|
3969
|
+
}>;
|
|
3970
|
+
export type AiSearchConfig = {
|
|
3971
|
+
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3972
|
+
id: string;
|
|
3973
|
+
type: "r2" | "web-crawler";
|
|
3974
|
+
source: string;
|
|
3975
|
+
source_params?: object;
|
|
3976
|
+
/** Token ID (UUID format) */
|
|
3977
|
+
token_id?: string;
|
|
3978
|
+
ai_gateway_id?: string;
|
|
3979
|
+
/** Enable query rewriting (default false) */
|
|
3980
|
+
rewrite_query?: boolean;
|
|
3981
|
+
/** Enable reranking (default false) */
|
|
3982
|
+
reranking?: boolean;
|
|
3983
|
+
embedding_model?: string;
|
|
3984
|
+
ai_search_model?: string;
|
|
3985
|
+
};
|
|
3986
|
+
export type AiSearchInstance = {
|
|
3987
|
+
id: string;
|
|
3988
|
+
enable?: boolean;
|
|
3989
|
+
type?: "r2" | "web-crawler";
|
|
3990
|
+
source?: string;
|
|
3991
|
+
[key: string]: unknown;
|
|
3992
|
+
};
|
|
3993
|
+
// AI Search Instance Service - Instance-level operations
|
|
3994
|
+
export declare abstract class AiSearchInstanceService {
|
|
3995
|
+
/**
|
|
3996
|
+
* Search the AI Search instance for relevant chunks.
|
|
3997
|
+
* @param params Search request with messages and AI search options
|
|
3998
|
+
* @returns Search response with matching chunks
|
|
3999
|
+
*/
|
|
4000
|
+
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4001
|
+
/**
|
|
4002
|
+
* Generate chat completions with AI Search context.
|
|
4003
|
+
* @param params Chat completions request with optional streaming
|
|
4004
|
+
* @returns Response object (if streaming) or chat completion result
|
|
4005
|
+
*/
|
|
4006
|
+
chatCompletions(
|
|
4007
|
+
params: AiSearchChatCompletionsRequest,
|
|
4008
|
+
): Promise<Response | object>;
|
|
4009
|
+
/**
|
|
4010
|
+
* Delete this AI Search instance.
|
|
4011
|
+
*/
|
|
4012
|
+
delete(): Promise<void>;
|
|
4013
|
+
}
|
|
4014
|
+
// AI Search Account Service - Account-level operations
|
|
4015
|
+
export declare abstract class AiSearchAccountService {
|
|
4016
|
+
/**
|
|
4017
|
+
* List all AI Search instances in the account.
|
|
4018
|
+
* @returns Array of AI Search instances
|
|
4019
|
+
*/
|
|
4020
|
+
list(): Promise<AiSearchListResponse>;
|
|
4021
|
+
/**
|
|
4022
|
+
* Get an AI Search instance by ID.
|
|
4023
|
+
* @param name Instance ID
|
|
4024
|
+
* @returns Instance service for performing operations
|
|
4025
|
+
*/
|
|
4026
|
+
get(name: string): AiSearchInstanceService;
|
|
4027
|
+
/**
|
|
4028
|
+
* Create a new AI Search instance.
|
|
4029
|
+
* @param config Instance configuration
|
|
4030
|
+
* @returns Instance service for performing operations
|
|
4031
|
+
*/
|
|
4032
|
+
create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
|
|
3849
4033
|
}
|
|
3850
4034
|
export type AiImageClassificationInput = {
|
|
3851
4035
|
image: number[];
|
|
@@ -9347,6 +9531,48 @@ export declare abstract class Ai<
|
|
|
9347
9531
|
> {
|
|
9348
9532
|
aiGatewayLogId: string | null;
|
|
9349
9533
|
gateway(gatewayId: string): AiGateway;
|
|
9534
|
+
/**
|
|
9535
|
+
* Access the AI Search API for managing AI-powered search instances.
|
|
9536
|
+
*
|
|
9537
|
+
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
9538
|
+
* - Account-level operations: `list()`, `create()`
|
|
9539
|
+
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
9540
|
+
*
|
|
9541
|
+
* @example
|
|
9542
|
+
* ```typescript
|
|
9543
|
+
* // List all AI Search instances
|
|
9544
|
+
* const instances = await env.AI.aiSearch.list();
|
|
9545
|
+
*
|
|
9546
|
+
* // Search an instance
|
|
9547
|
+
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
9548
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9549
|
+
* ai_search_options: {
|
|
9550
|
+
* retrieval: { max_num_results: 10 }
|
|
9551
|
+
* }
|
|
9552
|
+
* });
|
|
9553
|
+
*
|
|
9554
|
+
* // Generate chat completions with AI Search context
|
|
9555
|
+
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
9556
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9557
|
+
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
9558
|
+
* });
|
|
9559
|
+
* ```
|
|
9560
|
+
*/
|
|
9561
|
+
aiSearch(): AiSearchAccountService;
|
|
9562
|
+
/**
|
|
9563
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9564
|
+
* Use `env.AI.aiSearch` instead for better API design and new features.
|
|
9565
|
+
*
|
|
9566
|
+
* Migration guide:
|
|
9567
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9568
|
+
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
9569
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9570
|
+
*
|
|
9571
|
+
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
9572
|
+
*
|
|
9573
|
+
* @see AiSearchAccountService
|
|
9574
|
+
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
9575
|
+
*/
|
|
9350
9576
|
autorag(autoragId: string): AutoRAG;
|
|
9351
9577
|
run<
|
|
9352
9578
|
Name extends keyof AiModelList,
|
|
@@ -9503,19 +9729,30 @@ export declare abstract class AiGateway {
|
|
|
9503
9729
|
): Promise<Response>;
|
|
9504
9730
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
9505
9731
|
}
|
|
9732
|
+
/**
|
|
9733
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
|
|
9734
|
+
* @see AiSearchInternalError
|
|
9735
|
+
*/
|
|
9506
9736
|
export interface AutoRAGInternalError extends Error {}
|
|
9737
|
+
/**
|
|
9738
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
|
|
9739
|
+
* @see AiSearchNotFoundError
|
|
9740
|
+
*/
|
|
9507
9741
|
export interface AutoRAGNotFoundError extends Error {}
|
|
9742
|
+
/**
|
|
9743
|
+
* @deprecated This error type is no longer used in the AI Search API.
|
|
9744
|
+
*/
|
|
9508
9745
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
9746
|
+
/**
|
|
9747
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
|
|
9748
|
+
* @see AiSearchNameNotSetError
|
|
9749
|
+
*/
|
|
9509
9750
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
export type CompoundFilter = {
|
|
9516
|
-
type: "and" | "or";
|
|
9517
|
-
filters: ComparisonFilter[];
|
|
9518
|
-
};
|
|
9751
|
+
/**
|
|
9752
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9753
|
+
* Use AiSearchSearchRequest with the new API instead.
|
|
9754
|
+
* @see AiSearchSearchRequest
|
|
9755
|
+
*/
|
|
9519
9756
|
export type AutoRagSearchRequest = {
|
|
9520
9757
|
query: string;
|
|
9521
9758
|
filters?: CompoundFilter | ComparisonFilter;
|
|
@@ -9530,16 +9767,31 @@ export type AutoRagSearchRequest = {
|
|
|
9530
9767
|
};
|
|
9531
9768
|
rewrite_query?: boolean;
|
|
9532
9769
|
};
|
|
9770
|
+
/**
|
|
9771
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9772
|
+
* Use AiSearchChatCompletionsRequest with the new API instead.
|
|
9773
|
+
* @see AiSearchChatCompletionsRequest
|
|
9774
|
+
*/
|
|
9533
9775
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
9534
9776
|
stream?: boolean;
|
|
9535
9777
|
system_prompt?: string;
|
|
9536
9778
|
};
|
|
9779
|
+
/**
|
|
9780
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9781
|
+
* Use AiSearchChatCompletionsRequest with stream: true instead.
|
|
9782
|
+
* @see AiSearchChatCompletionsRequest
|
|
9783
|
+
*/
|
|
9537
9784
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
9538
9785
|
AutoRagAiSearchRequest,
|
|
9539
9786
|
"stream"
|
|
9540
9787
|
> & {
|
|
9541
9788
|
stream: true;
|
|
9542
9789
|
};
|
|
9790
|
+
/**
|
|
9791
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9792
|
+
* Use AiSearchSearchResponse with the new API instead.
|
|
9793
|
+
* @see AiSearchSearchResponse
|
|
9794
|
+
*/
|
|
9543
9795
|
export type AutoRagSearchResponse = {
|
|
9544
9796
|
object: "vector_store.search_results.page";
|
|
9545
9797
|
search_query: string;
|
|
@@ -9556,6 +9808,11 @@ export type AutoRagSearchResponse = {
|
|
|
9556
9808
|
has_more: boolean;
|
|
9557
9809
|
next_page: string | null;
|
|
9558
9810
|
};
|
|
9811
|
+
/**
|
|
9812
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9813
|
+
* Use AiSearchListResponse with the new API instead.
|
|
9814
|
+
* @see AiSearchListResponse
|
|
9815
|
+
*/
|
|
9559
9816
|
export type AutoRagListResponse = {
|
|
9560
9817
|
id: string;
|
|
9561
9818
|
enable: boolean;
|
|
@@ -9565,14 +9822,51 @@ export type AutoRagListResponse = {
|
|
|
9565
9822
|
paused: boolean;
|
|
9566
9823
|
status: string;
|
|
9567
9824
|
}[];
|
|
9825
|
+
/**
|
|
9826
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9827
|
+
* The new API returns different response formats for chat completions.
|
|
9828
|
+
*/
|
|
9568
9829
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
9569
9830
|
response: string;
|
|
9570
9831
|
};
|
|
9832
|
+
/**
|
|
9833
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9834
|
+
* Use the new AI Search API instead: `env.AI.aiSearch`
|
|
9835
|
+
*
|
|
9836
|
+
* Migration guide:
|
|
9837
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9838
|
+
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
9839
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9840
|
+
*
|
|
9841
|
+
* @see AiSearchAccountService
|
|
9842
|
+
* @see AiSearchInstanceService
|
|
9843
|
+
*/
|
|
9571
9844
|
export declare abstract class AutoRAG {
|
|
9845
|
+
/**
|
|
9846
|
+
* @deprecated Use `env.AI.aiSearch.list()` instead.
|
|
9847
|
+
* @see AiSearchAccountService.list
|
|
9848
|
+
*/
|
|
9572
9849
|
list(): Promise<AutoRagListResponse>;
|
|
9850
|
+
/**
|
|
9851
|
+
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
|
|
9852
|
+
* Note: The new API uses a messages array instead of a query string.
|
|
9853
|
+
* @see AiSearchInstanceService.search
|
|
9854
|
+
*/
|
|
9573
9855
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
9856
|
+
/**
|
|
9857
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9858
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9859
|
+
*/
|
|
9574
9860
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
9861
|
+
/**
|
|
9862
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9863
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9864
|
+
*/
|
|
9575
9865
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
9866
|
+
/**
|
|
9867
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9868
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9869
|
+
*/
|
|
9576
9870
|
aiSearch(
|
|
9577
9871
|
params: AutoRagAiSearchRequest,
|
|
9578
9872
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
@@ -10974,6 +11268,86 @@ export type ImageOutputOptions = {
|
|
|
10974
11268
|
background?: string;
|
|
10975
11269
|
anim?: boolean;
|
|
10976
11270
|
};
|
|
11271
|
+
export interface ImageMetadata {
|
|
11272
|
+
id: string;
|
|
11273
|
+
filename?: string;
|
|
11274
|
+
uploaded?: string;
|
|
11275
|
+
requireSignedURLs: boolean;
|
|
11276
|
+
meta?: Record<string, unknown>;
|
|
11277
|
+
variants: string[];
|
|
11278
|
+
draft?: boolean;
|
|
11279
|
+
creator?: string;
|
|
11280
|
+
}
|
|
11281
|
+
export interface ImageUploadOptions {
|
|
11282
|
+
id?: string;
|
|
11283
|
+
filename?: string;
|
|
11284
|
+
requireSignedURLs?: boolean;
|
|
11285
|
+
metadata?: Record<string, unknown>;
|
|
11286
|
+
creator?: string;
|
|
11287
|
+
encoding?: "base64";
|
|
11288
|
+
}
|
|
11289
|
+
export interface ImageUpdateOptions {
|
|
11290
|
+
requireSignedURLs?: boolean;
|
|
11291
|
+
metadata?: Record<string, unknown>;
|
|
11292
|
+
creator?: string;
|
|
11293
|
+
}
|
|
11294
|
+
export interface ImageListOptions {
|
|
11295
|
+
limit?: number;
|
|
11296
|
+
cursor?: string;
|
|
11297
|
+
sortOrder?: "asc" | "desc";
|
|
11298
|
+
creator?: string;
|
|
11299
|
+
}
|
|
11300
|
+
export interface ImageList {
|
|
11301
|
+
images: ImageMetadata[];
|
|
11302
|
+
cursor?: string;
|
|
11303
|
+
listComplete: boolean;
|
|
11304
|
+
}
|
|
11305
|
+
export interface HostedImagesBinding {
|
|
11306
|
+
/**
|
|
11307
|
+
* Get detailed metadata for a hosted image
|
|
11308
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11309
|
+
* @returns Image metadata, or null if not found
|
|
11310
|
+
*/
|
|
11311
|
+
details(imageId: string): Promise<ImageMetadata | null>;
|
|
11312
|
+
/**
|
|
11313
|
+
* Get the raw image data for a hosted image
|
|
11314
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11315
|
+
* @returns ReadableStream of image bytes, or null if not found
|
|
11316
|
+
*/
|
|
11317
|
+
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
11318
|
+
/**
|
|
11319
|
+
* Upload a new hosted image
|
|
11320
|
+
* @param image The image file to upload
|
|
11321
|
+
* @param options Upload configuration
|
|
11322
|
+
* @returns Metadata for the uploaded image
|
|
11323
|
+
* @throws {@link ImagesError} if upload fails
|
|
11324
|
+
*/
|
|
11325
|
+
upload(
|
|
11326
|
+
image: ReadableStream<Uint8Array> | ArrayBuffer,
|
|
11327
|
+
options?: ImageUploadOptions,
|
|
11328
|
+
): Promise<ImageMetadata>;
|
|
11329
|
+
/**
|
|
11330
|
+
* Update hosted image metadata
|
|
11331
|
+
* @param imageId The ID of the image
|
|
11332
|
+
* @param options Properties to update
|
|
11333
|
+
* @returns Updated image metadata
|
|
11334
|
+
* @throws {@link ImagesError} if update fails
|
|
11335
|
+
*/
|
|
11336
|
+
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
|
|
11337
|
+
/**
|
|
11338
|
+
* Delete a hosted image
|
|
11339
|
+
* @param imageId The ID of the image
|
|
11340
|
+
* @returns True if deleted, false if not found
|
|
11341
|
+
*/
|
|
11342
|
+
delete(imageId: string): Promise<boolean>;
|
|
11343
|
+
/**
|
|
11344
|
+
* List hosted images with pagination
|
|
11345
|
+
* @param options List configuration
|
|
11346
|
+
* @returns List of images with pagination info
|
|
11347
|
+
* @throws {@link ImagesError} if list fails
|
|
11348
|
+
*/
|
|
11349
|
+
list(options?: ImageListOptions): Promise<ImageList>;
|
|
11350
|
+
}
|
|
10977
11351
|
export interface ImagesBinding {
|
|
10978
11352
|
/**
|
|
10979
11353
|
* Get image metadata (type, width and height)
|
|
@@ -10993,6 +11367,10 @@ export interface ImagesBinding {
|
|
|
10993
11367
|
stream: ReadableStream<Uint8Array>,
|
|
10994
11368
|
options?: ImageInputOptions,
|
|
10995
11369
|
): ImageTransformer;
|
|
11370
|
+
/**
|
|
11371
|
+
* Access hosted images CRUD operations
|
|
11372
|
+
*/
|
|
11373
|
+
readonly hosted: HostedImagesBinding;
|
|
10996
11374
|
}
|
|
10997
11375
|
export interface ImageTransformer {
|
|
10998
11376
|
/**
|
|
@@ -11063,8 +11441,14 @@ export interface MediaTransformer {
|
|
|
11063
11441
|
* @returns A generator for producing the transformed media output
|
|
11064
11442
|
*/
|
|
11065
11443
|
transform(
|
|
11066
|
-
transform
|
|
11444
|
+
transform?: MediaTransformationInputOptions,
|
|
11067
11445
|
): MediaTransformationGenerator;
|
|
11446
|
+
/**
|
|
11447
|
+
* Generates the final media output with specified options.
|
|
11448
|
+
* @param output - Configuration for the output format and parameters
|
|
11449
|
+
* @returns The final transformation result containing the transformed media
|
|
11450
|
+
*/
|
|
11451
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11068
11452
|
}
|
|
11069
11453
|
/**
|
|
11070
11454
|
* Generator for producing media transformation results.
|
|
@@ -11076,7 +11460,7 @@ export interface MediaTransformationGenerator {
|
|
|
11076
11460
|
* @param output - Configuration for the output format and parameters
|
|
11077
11461
|
* @returns The final transformation result containing the transformed media
|
|
11078
11462
|
*/
|
|
11079
|
-
output(output
|
|
11463
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11080
11464
|
}
|
|
11081
11465
|
/**
|
|
11082
11466
|
* Result of a media transformation operation.
|
|
@@ -11085,19 +11469,19 @@ export interface MediaTransformationGenerator {
|
|
|
11085
11469
|
export interface MediaTransformationResult {
|
|
11086
11470
|
/**
|
|
11087
11471
|
* Returns the transformed media as a readable stream of bytes.
|
|
11088
|
-
* @returns A
|
|
11472
|
+
* @returns A promise containing a readable stream with the transformed media
|
|
11089
11473
|
*/
|
|
11090
|
-
media(): ReadableStream<Uint8Array
|
|
11474
|
+
media(): Promise<ReadableStream<Uint8Array>>;
|
|
11091
11475
|
/**
|
|
11092
11476
|
* Returns the transformed media as an HTTP response object.
|
|
11093
|
-
* @returns The transformed media as a Response
|
|
11477
|
+
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
|
|
11094
11478
|
*/
|
|
11095
|
-
response(): Response
|
|
11479
|
+
response(): Promise<Response>;
|
|
11096
11480
|
/**
|
|
11097
11481
|
* Returns the MIME type of the transformed media.
|
|
11098
|
-
* @returns
|
|
11482
|
+
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
11099
11483
|
*/
|
|
11100
|
-
contentType(): string
|
|
11484
|
+
contentType(): Promise<string>;
|
|
11101
11485
|
}
|
|
11102
11486
|
/**
|
|
11103
11487
|
* Configuration options for transforming media input.
|