@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/latest/index.d.ts
CHANGED
|
@@ -3882,6 +3882,184 @@ declare abstract class Performance {
|
|
|
3882
3882
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
|
|
3883
3883
|
now(): number;
|
|
3884
3884
|
}
|
|
3885
|
+
// AI Search V2 API Error Interfaces
|
|
3886
|
+
interface AiSearchInternalError extends Error {}
|
|
3887
|
+
interface AiSearchNotFoundError extends Error {}
|
|
3888
|
+
interface AiSearchNameNotSetError extends Error {}
|
|
3889
|
+
// Filter types (shared with AutoRAG for compatibility)
|
|
3890
|
+
type ComparisonFilter = {
|
|
3891
|
+
key: string;
|
|
3892
|
+
type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
3893
|
+
value: string | number | boolean;
|
|
3894
|
+
};
|
|
3895
|
+
type CompoundFilter = {
|
|
3896
|
+
type: "and" | "or";
|
|
3897
|
+
filters: ComparisonFilter[];
|
|
3898
|
+
};
|
|
3899
|
+
// AI Search V2 Request Types
|
|
3900
|
+
type AiSearchSearchRequest = {
|
|
3901
|
+
messages: Array<{
|
|
3902
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3903
|
+
content: string | null;
|
|
3904
|
+
}>;
|
|
3905
|
+
ai_search_options?: {
|
|
3906
|
+
retrieval?: {
|
|
3907
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3908
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3909
|
+
match_threshold?: number;
|
|
3910
|
+
/** Maximum number of results (1-50, default 10) */
|
|
3911
|
+
max_num_results?: number;
|
|
3912
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3913
|
+
/** Context expansion (0-3, default 0) */
|
|
3914
|
+
context_expansion?: number;
|
|
3915
|
+
[key: string]: unknown;
|
|
3916
|
+
};
|
|
3917
|
+
query_rewrite?: {
|
|
3918
|
+
enabled?: boolean;
|
|
3919
|
+
model?: string;
|
|
3920
|
+
rewrite_prompt?: string;
|
|
3921
|
+
[key: string]: unknown;
|
|
3922
|
+
};
|
|
3923
|
+
reranking?: {
|
|
3924
|
+
/** Enable reranking (default false) */
|
|
3925
|
+
enabled?: boolean;
|
|
3926
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3927
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3928
|
+
match_threshold?: number;
|
|
3929
|
+
[key: string]: unknown;
|
|
3930
|
+
};
|
|
3931
|
+
[key: string]: unknown;
|
|
3932
|
+
};
|
|
3933
|
+
};
|
|
3934
|
+
type AiSearchChatCompletionsRequest = {
|
|
3935
|
+
messages: Array<{
|
|
3936
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3937
|
+
content: string | null;
|
|
3938
|
+
}>;
|
|
3939
|
+
model?: string;
|
|
3940
|
+
stream?: boolean;
|
|
3941
|
+
ai_search_options?: {
|
|
3942
|
+
retrieval?: {
|
|
3943
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3944
|
+
match_threshold?: number;
|
|
3945
|
+
max_num_results?: number;
|
|
3946
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3947
|
+
context_expansion?: number;
|
|
3948
|
+
[key: string]: unknown;
|
|
3949
|
+
};
|
|
3950
|
+
query_rewrite?: {
|
|
3951
|
+
enabled?: boolean;
|
|
3952
|
+
model?: string;
|
|
3953
|
+
rewrite_prompt?: string;
|
|
3954
|
+
[key: string]: unknown;
|
|
3955
|
+
};
|
|
3956
|
+
reranking?: {
|
|
3957
|
+
enabled?: boolean;
|
|
3958
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3959
|
+
match_threshold?: number;
|
|
3960
|
+
[key: string]: unknown;
|
|
3961
|
+
};
|
|
3962
|
+
[key: string]: unknown;
|
|
3963
|
+
};
|
|
3964
|
+
[key: string]: unknown;
|
|
3965
|
+
};
|
|
3966
|
+
// AI Search V2 Response Types
|
|
3967
|
+
type AiSearchSearchResponse = {
|
|
3968
|
+
search_query: string;
|
|
3969
|
+
chunks: Array<{
|
|
3970
|
+
id: string;
|
|
3971
|
+
type: string;
|
|
3972
|
+
/** Match score (0-1) */
|
|
3973
|
+
score: number;
|
|
3974
|
+
text: string;
|
|
3975
|
+
item: {
|
|
3976
|
+
timestamp?: number;
|
|
3977
|
+
key: string;
|
|
3978
|
+
metadata?: Record<string, unknown>;
|
|
3979
|
+
};
|
|
3980
|
+
scoring_details?: {
|
|
3981
|
+
/** Keyword match score (0-1) */
|
|
3982
|
+
keyword_score?: number;
|
|
3983
|
+
/** Vector similarity score (0-1) */
|
|
3984
|
+
vector_score?: number;
|
|
3985
|
+
};
|
|
3986
|
+
}>;
|
|
3987
|
+
};
|
|
3988
|
+
type AiSearchListResponse = Array<{
|
|
3989
|
+
id: string;
|
|
3990
|
+
internal_id?: string;
|
|
3991
|
+
account_id?: string;
|
|
3992
|
+
account_tag?: string;
|
|
3993
|
+
/** Whether the instance is enabled (default true) */
|
|
3994
|
+
enable?: boolean;
|
|
3995
|
+
type?: "r2" | "web-crawler";
|
|
3996
|
+
source?: string;
|
|
3997
|
+
[key: string]: unknown;
|
|
3998
|
+
}>;
|
|
3999
|
+
type AiSearchConfig = {
|
|
4000
|
+
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
4001
|
+
id: string;
|
|
4002
|
+
type: "r2" | "web-crawler";
|
|
4003
|
+
source: string;
|
|
4004
|
+
source_params?: object;
|
|
4005
|
+
/** Token ID (UUID format) */
|
|
4006
|
+
token_id?: string;
|
|
4007
|
+
ai_gateway_id?: string;
|
|
4008
|
+
/** Enable query rewriting (default false) */
|
|
4009
|
+
rewrite_query?: boolean;
|
|
4010
|
+
/** Enable reranking (default false) */
|
|
4011
|
+
reranking?: boolean;
|
|
4012
|
+
embedding_model?: string;
|
|
4013
|
+
ai_search_model?: string;
|
|
4014
|
+
};
|
|
4015
|
+
type AiSearchInstance = {
|
|
4016
|
+
id: string;
|
|
4017
|
+
enable?: boolean;
|
|
4018
|
+
type?: "r2" | "web-crawler";
|
|
4019
|
+
source?: string;
|
|
4020
|
+
[key: string]: unknown;
|
|
4021
|
+
};
|
|
4022
|
+
// AI Search Instance Service - Instance-level operations
|
|
4023
|
+
declare abstract class AiSearchInstanceService {
|
|
4024
|
+
/**
|
|
4025
|
+
* Search the AI Search instance for relevant chunks.
|
|
4026
|
+
* @param params Search request with messages and AI search options
|
|
4027
|
+
* @returns Search response with matching chunks
|
|
4028
|
+
*/
|
|
4029
|
+
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4030
|
+
/**
|
|
4031
|
+
* Generate chat completions with AI Search context.
|
|
4032
|
+
* @param params Chat completions request with optional streaming
|
|
4033
|
+
* @returns Response object (if streaming) or chat completion result
|
|
4034
|
+
*/
|
|
4035
|
+
chatCompletions(
|
|
4036
|
+
params: AiSearchChatCompletionsRequest,
|
|
4037
|
+
): Promise<Response | object>;
|
|
4038
|
+
/**
|
|
4039
|
+
* Delete this AI Search instance.
|
|
4040
|
+
*/
|
|
4041
|
+
delete(): Promise<void>;
|
|
4042
|
+
}
|
|
4043
|
+
// AI Search Account Service - Account-level operations
|
|
4044
|
+
declare abstract class AiSearchAccountService {
|
|
4045
|
+
/**
|
|
4046
|
+
* List all AI Search instances in the account.
|
|
4047
|
+
* @returns Array of AI Search instances
|
|
4048
|
+
*/
|
|
4049
|
+
list(): Promise<AiSearchListResponse>;
|
|
4050
|
+
/**
|
|
4051
|
+
* Get an AI Search instance by ID.
|
|
4052
|
+
* @param name Instance ID
|
|
4053
|
+
* @returns Instance service for performing operations
|
|
4054
|
+
*/
|
|
4055
|
+
get(name: string): AiSearchInstanceService;
|
|
4056
|
+
/**
|
|
4057
|
+
* Create a new AI Search instance.
|
|
4058
|
+
* @param config Instance configuration
|
|
4059
|
+
* @returns Instance service for performing operations
|
|
4060
|
+
*/
|
|
4061
|
+
create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
|
|
4062
|
+
}
|
|
3885
4063
|
type AiImageClassificationInput = {
|
|
3886
4064
|
image: number[];
|
|
3887
4065
|
};
|
|
@@ -9379,6 +9557,48 @@ type AiModelListType = Record<string, any>;
|
|
|
9379
9557
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
9380
9558
|
aiGatewayLogId: string | null;
|
|
9381
9559
|
gateway(gatewayId: string): AiGateway;
|
|
9560
|
+
/**
|
|
9561
|
+
* Access the AI Search API for managing AI-powered search instances.
|
|
9562
|
+
*
|
|
9563
|
+
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
9564
|
+
* - Account-level operations: `list()`, `create()`
|
|
9565
|
+
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
9566
|
+
*
|
|
9567
|
+
* @example
|
|
9568
|
+
* ```typescript
|
|
9569
|
+
* // List all AI Search instances
|
|
9570
|
+
* const instances = await env.AI.aiSearch.list();
|
|
9571
|
+
*
|
|
9572
|
+
* // Search an instance
|
|
9573
|
+
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
9574
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9575
|
+
* ai_search_options: {
|
|
9576
|
+
* retrieval: { max_num_results: 10 }
|
|
9577
|
+
* }
|
|
9578
|
+
* });
|
|
9579
|
+
*
|
|
9580
|
+
* // Generate chat completions with AI Search context
|
|
9581
|
+
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
9582
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9583
|
+
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
9584
|
+
* });
|
|
9585
|
+
* ```
|
|
9586
|
+
*/
|
|
9587
|
+
aiSearch(): AiSearchAccountService;
|
|
9588
|
+
/**
|
|
9589
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9590
|
+
* Use `env.AI.aiSearch` instead for better API design and new features.
|
|
9591
|
+
*
|
|
9592
|
+
* Migration guide:
|
|
9593
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9594
|
+
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
9595
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9596
|
+
*
|
|
9597
|
+
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
9598
|
+
*
|
|
9599
|
+
* @see AiSearchAccountService
|
|
9600
|
+
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
9601
|
+
*/
|
|
9382
9602
|
autorag(autoragId: string): AutoRAG;
|
|
9383
9603
|
run<
|
|
9384
9604
|
Name extends keyof AiModelList,
|
|
@@ -9535,19 +9755,30 @@ declare abstract class AiGateway {
|
|
|
9535
9755
|
): Promise<Response>;
|
|
9536
9756
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
9537
9757
|
}
|
|
9758
|
+
/**
|
|
9759
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
|
|
9760
|
+
* @see AiSearchInternalError
|
|
9761
|
+
*/
|
|
9538
9762
|
interface AutoRAGInternalError extends Error {}
|
|
9763
|
+
/**
|
|
9764
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
|
|
9765
|
+
* @see AiSearchNotFoundError
|
|
9766
|
+
*/
|
|
9539
9767
|
interface AutoRAGNotFoundError extends Error {}
|
|
9768
|
+
/**
|
|
9769
|
+
* @deprecated This error type is no longer used in the AI Search API.
|
|
9770
|
+
*/
|
|
9540
9771
|
interface AutoRAGUnauthorizedError extends Error {}
|
|
9772
|
+
/**
|
|
9773
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
|
|
9774
|
+
* @see AiSearchNameNotSetError
|
|
9775
|
+
*/
|
|
9541
9776
|
interface AutoRAGNameNotSetError extends Error {}
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
type CompoundFilter = {
|
|
9548
|
-
type: "and" | "or";
|
|
9549
|
-
filters: ComparisonFilter[];
|
|
9550
|
-
};
|
|
9777
|
+
/**
|
|
9778
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9779
|
+
* Use AiSearchSearchRequest with the new API instead.
|
|
9780
|
+
* @see AiSearchSearchRequest
|
|
9781
|
+
*/
|
|
9551
9782
|
type AutoRagSearchRequest = {
|
|
9552
9783
|
query: string;
|
|
9553
9784
|
filters?: CompoundFilter | ComparisonFilter;
|
|
@@ -9562,16 +9793,31 @@ type AutoRagSearchRequest = {
|
|
|
9562
9793
|
};
|
|
9563
9794
|
rewrite_query?: boolean;
|
|
9564
9795
|
};
|
|
9796
|
+
/**
|
|
9797
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9798
|
+
* Use AiSearchChatCompletionsRequest with the new API instead.
|
|
9799
|
+
* @see AiSearchChatCompletionsRequest
|
|
9800
|
+
*/
|
|
9565
9801
|
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
9566
9802
|
stream?: boolean;
|
|
9567
9803
|
system_prompt?: string;
|
|
9568
9804
|
};
|
|
9805
|
+
/**
|
|
9806
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9807
|
+
* Use AiSearchChatCompletionsRequest with stream: true instead.
|
|
9808
|
+
* @see AiSearchChatCompletionsRequest
|
|
9809
|
+
*/
|
|
9569
9810
|
type AutoRagAiSearchRequestStreaming = Omit<
|
|
9570
9811
|
AutoRagAiSearchRequest,
|
|
9571
9812
|
"stream"
|
|
9572
9813
|
> & {
|
|
9573
9814
|
stream: true;
|
|
9574
9815
|
};
|
|
9816
|
+
/**
|
|
9817
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9818
|
+
* Use AiSearchSearchResponse with the new API instead.
|
|
9819
|
+
* @see AiSearchSearchResponse
|
|
9820
|
+
*/
|
|
9575
9821
|
type AutoRagSearchResponse = {
|
|
9576
9822
|
object: "vector_store.search_results.page";
|
|
9577
9823
|
search_query: string;
|
|
@@ -9588,6 +9834,11 @@ type AutoRagSearchResponse = {
|
|
|
9588
9834
|
has_more: boolean;
|
|
9589
9835
|
next_page: string | null;
|
|
9590
9836
|
};
|
|
9837
|
+
/**
|
|
9838
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9839
|
+
* Use AiSearchListResponse with the new API instead.
|
|
9840
|
+
* @see AiSearchListResponse
|
|
9841
|
+
*/
|
|
9591
9842
|
type AutoRagListResponse = {
|
|
9592
9843
|
id: string;
|
|
9593
9844
|
enable: boolean;
|
|
@@ -9597,14 +9848,51 @@ type AutoRagListResponse = {
|
|
|
9597
9848
|
paused: boolean;
|
|
9598
9849
|
status: string;
|
|
9599
9850
|
}[];
|
|
9851
|
+
/**
|
|
9852
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9853
|
+
* The new API returns different response formats for chat completions.
|
|
9854
|
+
*/
|
|
9600
9855
|
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
9601
9856
|
response: string;
|
|
9602
9857
|
};
|
|
9858
|
+
/**
|
|
9859
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9860
|
+
* Use the new AI Search API instead: `env.AI.aiSearch`
|
|
9861
|
+
*
|
|
9862
|
+
* Migration guide:
|
|
9863
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9864
|
+
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
9865
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9866
|
+
*
|
|
9867
|
+
* @see AiSearchAccountService
|
|
9868
|
+
* @see AiSearchInstanceService
|
|
9869
|
+
*/
|
|
9603
9870
|
declare abstract class AutoRAG {
|
|
9871
|
+
/**
|
|
9872
|
+
* @deprecated Use `env.AI.aiSearch.list()` instead.
|
|
9873
|
+
* @see AiSearchAccountService.list
|
|
9874
|
+
*/
|
|
9604
9875
|
list(): Promise<AutoRagListResponse>;
|
|
9876
|
+
/**
|
|
9877
|
+
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
|
|
9878
|
+
* Note: The new API uses a messages array instead of a query string.
|
|
9879
|
+
* @see AiSearchInstanceService.search
|
|
9880
|
+
*/
|
|
9605
9881
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
9882
|
+
/**
|
|
9883
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9884
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9885
|
+
*/
|
|
9606
9886
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
9887
|
+
/**
|
|
9888
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9889
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9890
|
+
*/
|
|
9607
9891
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
9892
|
+
/**
|
|
9893
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9894
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9895
|
+
*/
|
|
9608
9896
|
aiSearch(
|
|
9609
9897
|
params: AutoRagAiSearchRequest,
|
|
9610
9898
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
@@ -11001,6 +11289,86 @@ type ImageOutputOptions = {
|
|
|
11001
11289
|
background?: string;
|
|
11002
11290
|
anim?: boolean;
|
|
11003
11291
|
};
|
|
11292
|
+
interface ImageMetadata {
|
|
11293
|
+
id: string;
|
|
11294
|
+
filename?: string;
|
|
11295
|
+
uploaded?: string;
|
|
11296
|
+
requireSignedURLs: boolean;
|
|
11297
|
+
meta?: Record<string, unknown>;
|
|
11298
|
+
variants: string[];
|
|
11299
|
+
draft?: boolean;
|
|
11300
|
+
creator?: string;
|
|
11301
|
+
}
|
|
11302
|
+
interface ImageUploadOptions {
|
|
11303
|
+
id?: string;
|
|
11304
|
+
filename?: string;
|
|
11305
|
+
requireSignedURLs?: boolean;
|
|
11306
|
+
metadata?: Record<string, unknown>;
|
|
11307
|
+
creator?: string;
|
|
11308
|
+
encoding?: "base64";
|
|
11309
|
+
}
|
|
11310
|
+
interface ImageUpdateOptions {
|
|
11311
|
+
requireSignedURLs?: boolean;
|
|
11312
|
+
metadata?: Record<string, unknown>;
|
|
11313
|
+
creator?: string;
|
|
11314
|
+
}
|
|
11315
|
+
interface ImageListOptions {
|
|
11316
|
+
limit?: number;
|
|
11317
|
+
cursor?: string;
|
|
11318
|
+
sortOrder?: "asc" | "desc";
|
|
11319
|
+
creator?: string;
|
|
11320
|
+
}
|
|
11321
|
+
interface ImageList {
|
|
11322
|
+
images: ImageMetadata[];
|
|
11323
|
+
cursor?: string;
|
|
11324
|
+
listComplete: boolean;
|
|
11325
|
+
}
|
|
11326
|
+
interface HostedImagesBinding {
|
|
11327
|
+
/**
|
|
11328
|
+
* Get detailed metadata for a hosted image
|
|
11329
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11330
|
+
* @returns Image metadata, or null if not found
|
|
11331
|
+
*/
|
|
11332
|
+
details(imageId: string): Promise<ImageMetadata | null>;
|
|
11333
|
+
/**
|
|
11334
|
+
* Get the raw image data for a hosted image
|
|
11335
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11336
|
+
* @returns ReadableStream of image bytes, or null if not found
|
|
11337
|
+
*/
|
|
11338
|
+
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
11339
|
+
/**
|
|
11340
|
+
* Upload a new hosted image
|
|
11341
|
+
* @param image The image file to upload
|
|
11342
|
+
* @param options Upload configuration
|
|
11343
|
+
* @returns Metadata for the uploaded image
|
|
11344
|
+
* @throws {@link ImagesError} if upload fails
|
|
11345
|
+
*/
|
|
11346
|
+
upload(
|
|
11347
|
+
image: ReadableStream<Uint8Array> | ArrayBuffer,
|
|
11348
|
+
options?: ImageUploadOptions,
|
|
11349
|
+
): Promise<ImageMetadata>;
|
|
11350
|
+
/**
|
|
11351
|
+
* Update hosted image metadata
|
|
11352
|
+
* @param imageId The ID of the image
|
|
11353
|
+
* @param options Properties to update
|
|
11354
|
+
* @returns Updated image metadata
|
|
11355
|
+
* @throws {@link ImagesError} if update fails
|
|
11356
|
+
*/
|
|
11357
|
+
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
|
|
11358
|
+
/**
|
|
11359
|
+
* Delete a hosted image
|
|
11360
|
+
* @param imageId The ID of the image
|
|
11361
|
+
* @returns True if deleted, false if not found
|
|
11362
|
+
*/
|
|
11363
|
+
delete(imageId: string): Promise<boolean>;
|
|
11364
|
+
/**
|
|
11365
|
+
* List hosted images with pagination
|
|
11366
|
+
* @param options List configuration
|
|
11367
|
+
* @returns List of images with pagination info
|
|
11368
|
+
* @throws {@link ImagesError} if list fails
|
|
11369
|
+
*/
|
|
11370
|
+
list(options?: ImageListOptions): Promise<ImageList>;
|
|
11371
|
+
}
|
|
11004
11372
|
interface ImagesBinding {
|
|
11005
11373
|
/**
|
|
11006
11374
|
* Get image metadata (type, width and height)
|
|
@@ -11020,6 +11388,10 @@ interface ImagesBinding {
|
|
|
11020
11388
|
stream: ReadableStream<Uint8Array>,
|
|
11021
11389
|
options?: ImageInputOptions,
|
|
11022
11390
|
): ImageTransformer;
|
|
11391
|
+
/**
|
|
11392
|
+
* Access hosted images CRUD operations
|
|
11393
|
+
*/
|
|
11394
|
+
readonly hosted: HostedImagesBinding;
|
|
11023
11395
|
}
|
|
11024
11396
|
interface ImageTransformer {
|
|
11025
11397
|
/**
|
|
@@ -11090,8 +11462,14 @@ interface MediaTransformer {
|
|
|
11090
11462
|
* @returns A generator for producing the transformed media output
|
|
11091
11463
|
*/
|
|
11092
11464
|
transform(
|
|
11093
|
-
transform
|
|
11465
|
+
transform?: MediaTransformationInputOptions,
|
|
11094
11466
|
): MediaTransformationGenerator;
|
|
11467
|
+
/**
|
|
11468
|
+
* Generates the final media output with specified options.
|
|
11469
|
+
* @param output - Configuration for the output format and parameters
|
|
11470
|
+
* @returns The final transformation result containing the transformed media
|
|
11471
|
+
*/
|
|
11472
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11095
11473
|
}
|
|
11096
11474
|
/**
|
|
11097
11475
|
* Generator for producing media transformation results.
|
|
@@ -11103,7 +11481,7 @@ interface MediaTransformationGenerator {
|
|
|
11103
11481
|
* @param output - Configuration for the output format and parameters
|
|
11104
11482
|
* @returns The final transformation result containing the transformed media
|
|
11105
11483
|
*/
|
|
11106
|
-
output(output
|
|
11484
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11107
11485
|
}
|
|
11108
11486
|
/**
|
|
11109
11487
|
* Result of a media transformation operation.
|
|
@@ -11112,19 +11490,19 @@ interface MediaTransformationGenerator {
|
|
|
11112
11490
|
interface MediaTransformationResult {
|
|
11113
11491
|
/**
|
|
11114
11492
|
* Returns the transformed media as a readable stream of bytes.
|
|
11115
|
-
* @returns A
|
|
11493
|
+
* @returns A promise containing a readable stream with the transformed media
|
|
11116
11494
|
*/
|
|
11117
|
-
media(): ReadableStream<Uint8Array
|
|
11495
|
+
media(): Promise<ReadableStream<Uint8Array>>;
|
|
11118
11496
|
/**
|
|
11119
11497
|
* Returns the transformed media as an HTTP response object.
|
|
11120
|
-
* @returns The transformed media as a Response
|
|
11498
|
+
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
|
|
11121
11499
|
*/
|
|
11122
|
-
response(): Response
|
|
11500
|
+
response(): Promise<Response>;
|
|
11123
11501
|
/**
|
|
11124
11502
|
* Returns the MIME type of the transformed media.
|
|
11125
|
-
* @returns
|
|
11503
|
+
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
11126
11504
|
*/
|
|
11127
|
-
contentType(): string
|
|
11505
|
+
contentType(): Promise<string>;
|
|
11128
11506
|
}
|
|
11129
11507
|
/**
|
|
11130
11508
|
* Configuration options for transforming media input.
|