@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-01-31/index.d.ts
CHANGED
|
@@ -3808,6 +3808,190 @@ declare abstract class Performance {
|
|
|
3808
3808
|
get timeOrigin(): number;
|
|
3809
3809
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
|
|
3810
3810
|
now(): number;
|
|
3811
|
+
/**
|
|
3812
|
+
* The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
|
|
3813
|
+
*
|
|
3814
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
|
|
3815
|
+
*/
|
|
3816
|
+
toJSON(): object;
|
|
3817
|
+
}
|
|
3818
|
+
// AI Search V2 API Error Interfaces
|
|
3819
|
+
interface AiSearchInternalError extends Error {}
|
|
3820
|
+
interface AiSearchNotFoundError extends Error {}
|
|
3821
|
+
interface AiSearchNameNotSetError extends Error {}
|
|
3822
|
+
// Filter types (shared with AutoRAG for compatibility)
|
|
3823
|
+
type ComparisonFilter = {
|
|
3824
|
+
key: string;
|
|
3825
|
+
type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
3826
|
+
value: string | number | boolean;
|
|
3827
|
+
};
|
|
3828
|
+
type CompoundFilter = {
|
|
3829
|
+
type: "and" | "or";
|
|
3830
|
+
filters: ComparisonFilter[];
|
|
3831
|
+
};
|
|
3832
|
+
// AI Search V2 Request Types
|
|
3833
|
+
type AiSearchSearchRequest = {
|
|
3834
|
+
messages: Array<{
|
|
3835
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3836
|
+
content: string | null;
|
|
3837
|
+
}>;
|
|
3838
|
+
ai_search_options?: {
|
|
3839
|
+
retrieval?: {
|
|
3840
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3841
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3842
|
+
match_threshold?: number;
|
|
3843
|
+
/** Maximum number of results (1-50, default 10) */
|
|
3844
|
+
max_num_results?: number;
|
|
3845
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3846
|
+
/** Context expansion (0-3, default 0) */
|
|
3847
|
+
context_expansion?: number;
|
|
3848
|
+
[key: string]: unknown;
|
|
3849
|
+
};
|
|
3850
|
+
query_rewrite?: {
|
|
3851
|
+
enabled?: boolean;
|
|
3852
|
+
model?: string;
|
|
3853
|
+
rewrite_prompt?: string;
|
|
3854
|
+
[key: string]: unknown;
|
|
3855
|
+
};
|
|
3856
|
+
reranking?: {
|
|
3857
|
+
/** Enable reranking (default false) */
|
|
3858
|
+
enabled?: boolean;
|
|
3859
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3860
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3861
|
+
match_threshold?: number;
|
|
3862
|
+
[key: string]: unknown;
|
|
3863
|
+
};
|
|
3864
|
+
[key: string]: unknown;
|
|
3865
|
+
};
|
|
3866
|
+
};
|
|
3867
|
+
type AiSearchChatCompletionsRequest = {
|
|
3868
|
+
messages: Array<{
|
|
3869
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3870
|
+
content: string | null;
|
|
3871
|
+
}>;
|
|
3872
|
+
model?: string;
|
|
3873
|
+
stream?: boolean;
|
|
3874
|
+
ai_search_options?: {
|
|
3875
|
+
retrieval?: {
|
|
3876
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3877
|
+
match_threshold?: number;
|
|
3878
|
+
max_num_results?: number;
|
|
3879
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3880
|
+
context_expansion?: number;
|
|
3881
|
+
[key: string]: unknown;
|
|
3882
|
+
};
|
|
3883
|
+
query_rewrite?: {
|
|
3884
|
+
enabled?: boolean;
|
|
3885
|
+
model?: string;
|
|
3886
|
+
rewrite_prompt?: string;
|
|
3887
|
+
[key: string]: unknown;
|
|
3888
|
+
};
|
|
3889
|
+
reranking?: {
|
|
3890
|
+
enabled?: boolean;
|
|
3891
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3892
|
+
match_threshold?: number;
|
|
3893
|
+
[key: string]: unknown;
|
|
3894
|
+
};
|
|
3895
|
+
[key: string]: unknown;
|
|
3896
|
+
};
|
|
3897
|
+
[key: string]: unknown;
|
|
3898
|
+
};
|
|
3899
|
+
// AI Search V2 Response Types
|
|
3900
|
+
type AiSearchSearchResponse = {
|
|
3901
|
+
search_query: string;
|
|
3902
|
+
chunks: Array<{
|
|
3903
|
+
id: string;
|
|
3904
|
+
type: string;
|
|
3905
|
+
/** Match score (0-1) */
|
|
3906
|
+
score: number;
|
|
3907
|
+
text: string;
|
|
3908
|
+
item: {
|
|
3909
|
+
timestamp?: number;
|
|
3910
|
+
key: string;
|
|
3911
|
+
metadata?: Record<string, unknown>;
|
|
3912
|
+
};
|
|
3913
|
+
scoring_details?: {
|
|
3914
|
+
/** Keyword match score (0-1) */
|
|
3915
|
+
keyword_score?: number;
|
|
3916
|
+
/** Vector similarity score (0-1) */
|
|
3917
|
+
vector_score?: number;
|
|
3918
|
+
};
|
|
3919
|
+
}>;
|
|
3920
|
+
};
|
|
3921
|
+
type AiSearchListResponse = Array<{
|
|
3922
|
+
id: string;
|
|
3923
|
+
internal_id?: string;
|
|
3924
|
+
account_id?: string;
|
|
3925
|
+
account_tag?: string;
|
|
3926
|
+
/** Whether the instance is enabled (default true) */
|
|
3927
|
+
enable?: boolean;
|
|
3928
|
+
type?: "r2" | "web-crawler";
|
|
3929
|
+
source?: string;
|
|
3930
|
+
[key: string]: unknown;
|
|
3931
|
+
}>;
|
|
3932
|
+
type AiSearchConfig = {
|
|
3933
|
+
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3934
|
+
id: string;
|
|
3935
|
+
type: "r2" | "web-crawler";
|
|
3936
|
+
source: string;
|
|
3937
|
+
source_params?: object;
|
|
3938
|
+
/** Token ID (UUID format) */
|
|
3939
|
+
token_id?: string;
|
|
3940
|
+
ai_gateway_id?: string;
|
|
3941
|
+
/** Enable query rewriting (default false) */
|
|
3942
|
+
rewrite_query?: boolean;
|
|
3943
|
+
/** Enable reranking (default false) */
|
|
3944
|
+
reranking?: boolean;
|
|
3945
|
+
embedding_model?: string;
|
|
3946
|
+
ai_search_model?: string;
|
|
3947
|
+
};
|
|
3948
|
+
type AiSearchInstance = {
|
|
3949
|
+
id: string;
|
|
3950
|
+
enable?: boolean;
|
|
3951
|
+
type?: "r2" | "web-crawler";
|
|
3952
|
+
source?: string;
|
|
3953
|
+
[key: string]: unknown;
|
|
3954
|
+
};
|
|
3955
|
+
// AI Search Instance Service - Instance-level operations
|
|
3956
|
+
declare abstract class AiSearchInstanceService {
|
|
3957
|
+
/**
|
|
3958
|
+
* Search the AI Search instance for relevant chunks.
|
|
3959
|
+
* @param params Search request with messages and AI search options
|
|
3960
|
+
* @returns Search response with matching chunks
|
|
3961
|
+
*/
|
|
3962
|
+
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
3963
|
+
/**
|
|
3964
|
+
* Generate chat completions with AI Search context.
|
|
3965
|
+
* @param params Chat completions request with optional streaming
|
|
3966
|
+
* @returns Response object (if streaming) or chat completion result
|
|
3967
|
+
*/
|
|
3968
|
+
chatCompletions(
|
|
3969
|
+
params: AiSearchChatCompletionsRequest,
|
|
3970
|
+
): Promise<Response | object>;
|
|
3971
|
+
/**
|
|
3972
|
+
* Delete this AI Search instance.
|
|
3973
|
+
*/
|
|
3974
|
+
delete(): Promise<void>;
|
|
3975
|
+
}
|
|
3976
|
+
// AI Search Account Service - Account-level operations
|
|
3977
|
+
declare abstract class AiSearchAccountService {
|
|
3978
|
+
/**
|
|
3979
|
+
* List all AI Search instances in the account.
|
|
3980
|
+
* @returns Array of AI Search instances
|
|
3981
|
+
*/
|
|
3982
|
+
list(): Promise<AiSearchListResponse>;
|
|
3983
|
+
/**
|
|
3984
|
+
* Get an AI Search instance by ID.
|
|
3985
|
+
* @param name Instance ID
|
|
3986
|
+
* @returns Instance service for performing operations
|
|
3987
|
+
*/
|
|
3988
|
+
get(name: string): AiSearchInstanceService;
|
|
3989
|
+
/**
|
|
3990
|
+
* Create a new AI Search instance.
|
|
3991
|
+
* @param config Instance configuration
|
|
3992
|
+
* @returns Instance service for performing operations
|
|
3993
|
+
*/
|
|
3994
|
+
create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
|
|
3811
3995
|
}
|
|
3812
3996
|
type AiImageClassificationInput = {
|
|
3813
3997
|
image: number[];
|
|
@@ -9306,6 +9490,48 @@ type AiModelListType = Record<string, any>;
|
|
|
9306
9490
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
9307
9491
|
aiGatewayLogId: string | null;
|
|
9308
9492
|
gateway(gatewayId: string): AiGateway;
|
|
9493
|
+
/**
|
|
9494
|
+
* Access the AI Search API for managing AI-powered search instances.
|
|
9495
|
+
*
|
|
9496
|
+
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
9497
|
+
* - Account-level operations: `list()`, `create()`
|
|
9498
|
+
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
9499
|
+
*
|
|
9500
|
+
* @example
|
|
9501
|
+
* ```typescript
|
|
9502
|
+
* // List all AI Search instances
|
|
9503
|
+
* const instances = await env.AI.aiSearch.list();
|
|
9504
|
+
*
|
|
9505
|
+
* // Search an instance
|
|
9506
|
+
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
9507
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9508
|
+
* ai_search_options: {
|
|
9509
|
+
* retrieval: { max_num_results: 10 }
|
|
9510
|
+
* }
|
|
9511
|
+
* });
|
|
9512
|
+
*
|
|
9513
|
+
* // Generate chat completions with AI Search context
|
|
9514
|
+
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
9515
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9516
|
+
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
9517
|
+
* });
|
|
9518
|
+
* ```
|
|
9519
|
+
*/
|
|
9520
|
+
aiSearch(): AiSearchAccountService;
|
|
9521
|
+
/**
|
|
9522
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9523
|
+
* Use `env.AI.aiSearch` instead for better API design and new features.
|
|
9524
|
+
*
|
|
9525
|
+
* Migration guide:
|
|
9526
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9527
|
+
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
9528
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9529
|
+
*
|
|
9530
|
+
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
9531
|
+
*
|
|
9532
|
+
* @see AiSearchAccountService
|
|
9533
|
+
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
9534
|
+
*/
|
|
9309
9535
|
autorag(autoragId: string): AutoRAG;
|
|
9310
9536
|
run<
|
|
9311
9537
|
Name extends keyof AiModelList,
|
|
@@ -9462,19 +9688,30 @@ declare abstract class AiGateway {
|
|
|
9462
9688
|
): Promise<Response>;
|
|
9463
9689
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
9464
9690
|
}
|
|
9691
|
+
/**
|
|
9692
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
|
|
9693
|
+
* @see AiSearchInternalError
|
|
9694
|
+
*/
|
|
9465
9695
|
interface AutoRAGInternalError extends Error {}
|
|
9696
|
+
/**
|
|
9697
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
|
|
9698
|
+
* @see AiSearchNotFoundError
|
|
9699
|
+
*/
|
|
9466
9700
|
interface AutoRAGNotFoundError extends Error {}
|
|
9701
|
+
/**
|
|
9702
|
+
* @deprecated This error type is no longer used in the AI Search API.
|
|
9703
|
+
*/
|
|
9467
9704
|
interface AutoRAGUnauthorizedError extends Error {}
|
|
9705
|
+
/**
|
|
9706
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
|
|
9707
|
+
* @see AiSearchNameNotSetError
|
|
9708
|
+
*/
|
|
9468
9709
|
interface AutoRAGNameNotSetError extends Error {}
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
type CompoundFilter = {
|
|
9475
|
-
type: "and" | "or";
|
|
9476
|
-
filters: ComparisonFilter[];
|
|
9477
|
-
};
|
|
9710
|
+
/**
|
|
9711
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9712
|
+
* Use AiSearchSearchRequest with the new API instead.
|
|
9713
|
+
* @see AiSearchSearchRequest
|
|
9714
|
+
*/
|
|
9478
9715
|
type AutoRagSearchRequest = {
|
|
9479
9716
|
query: string;
|
|
9480
9717
|
filters?: CompoundFilter | ComparisonFilter;
|
|
@@ -9489,16 +9726,31 @@ type AutoRagSearchRequest = {
|
|
|
9489
9726
|
};
|
|
9490
9727
|
rewrite_query?: boolean;
|
|
9491
9728
|
};
|
|
9729
|
+
/**
|
|
9730
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9731
|
+
* Use AiSearchChatCompletionsRequest with the new API instead.
|
|
9732
|
+
* @see AiSearchChatCompletionsRequest
|
|
9733
|
+
*/
|
|
9492
9734
|
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
9493
9735
|
stream?: boolean;
|
|
9494
9736
|
system_prompt?: string;
|
|
9495
9737
|
};
|
|
9738
|
+
/**
|
|
9739
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9740
|
+
* Use AiSearchChatCompletionsRequest with stream: true instead.
|
|
9741
|
+
* @see AiSearchChatCompletionsRequest
|
|
9742
|
+
*/
|
|
9496
9743
|
type AutoRagAiSearchRequestStreaming = Omit<
|
|
9497
9744
|
AutoRagAiSearchRequest,
|
|
9498
9745
|
"stream"
|
|
9499
9746
|
> & {
|
|
9500
9747
|
stream: true;
|
|
9501
9748
|
};
|
|
9749
|
+
/**
|
|
9750
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9751
|
+
* Use AiSearchSearchResponse with the new API instead.
|
|
9752
|
+
* @see AiSearchSearchResponse
|
|
9753
|
+
*/
|
|
9502
9754
|
type AutoRagSearchResponse = {
|
|
9503
9755
|
object: "vector_store.search_results.page";
|
|
9504
9756
|
search_query: string;
|
|
@@ -9515,6 +9767,11 @@ type AutoRagSearchResponse = {
|
|
|
9515
9767
|
has_more: boolean;
|
|
9516
9768
|
next_page: string | null;
|
|
9517
9769
|
};
|
|
9770
|
+
/**
|
|
9771
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9772
|
+
* Use AiSearchListResponse with the new API instead.
|
|
9773
|
+
* @see AiSearchListResponse
|
|
9774
|
+
*/
|
|
9518
9775
|
type AutoRagListResponse = {
|
|
9519
9776
|
id: string;
|
|
9520
9777
|
enable: boolean;
|
|
@@ -9524,14 +9781,51 @@ type AutoRagListResponse = {
|
|
|
9524
9781
|
paused: boolean;
|
|
9525
9782
|
status: string;
|
|
9526
9783
|
}[];
|
|
9784
|
+
/**
|
|
9785
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9786
|
+
* The new API returns different response formats for chat completions.
|
|
9787
|
+
*/
|
|
9527
9788
|
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
9528
9789
|
response: string;
|
|
9529
9790
|
};
|
|
9791
|
+
/**
|
|
9792
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9793
|
+
* Use the new AI Search API instead: `env.AI.aiSearch`
|
|
9794
|
+
*
|
|
9795
|
+
* Migration guide:
|
|
9796
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9797
|
+
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
9798
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9799
|
+
*
|
|
9800
|
+
* @see AiSearchAccountService
|
|
9801
|
+
* @see AiSearchInstanceService
|
|
9802
|
+
*/
|
|
9530
9803
|
declare abstract class AutoRAG {
|
|
9804
|
+
/**
|
|
9805
|
+
* @deprecated Use `env.AI.aiSearch.list()` instead.
|
|
9806
|
+
* @see AiSearchAccountService.list
|
|
9807
|
+
*/
|
|
9531
9808
|
list(): Promise<AutoRagListResponse>;
|
|
9809
|
+
/**
|
|
9810
|
+
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
|
|
9811
|
+
* Note: The new API uses a messages array instead of a query string.
|
|
9812
|
+
* @see AiSearchInstanceService.search
|
|
9813
|
+
*/
|
|
9532
9814
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
9815
|
+
/**
|
|
9816
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9817
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9818
|
+
*/
|
|
9533
9819
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
9820
|
+
/**
|
|
9821
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9822
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9823
|
+
*/
|
|
9534
9824
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
9825
|
+
/**
|
|
9826
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9827
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9828
|
+
*/
|
|
9535
9829
|
aiSearch(
|
|
9536
9830
|
params: AutoRagAiSearchRequest,
|
|
9537
9831
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
@@ -10928,6 +11222,86 @@ type ImageOutputOptions = {
|
|
|
10928
11222
|
background?: string;
|
|
10929
11223
|
anim?: boolean;
|
|
10930
11224
|
};
|
|
11225
|
+
interface ImageMetadata {
|
|
11226
|
+
id: string;
|
|
11227
|
+
filename?: string;
|
|
11228
|
+
uploaded?: string;
|
|
11229
|
+
requireSignedURLs: boolean;
|
|
11230
|
+
meta?: Record<string, unknown>;
|
|
11231
|
+
variants: string[];
|
|
11232
|
+
draft?: boolean;
|
|
11233
|
+
creator?: string;
|
|
11234
|
+
}
|
|
11235
|
+
interface ImageUploadOptions {
|
|
11236
|
+
id?: string;
|
|
11237
|
+
filename?: string;
|
|
11238
|
+
requireSignedURLs?: boolean;
|
|
11239
|
+
metadata?: Record<string, unknown>;
|
|
11240
|
+
creator?: string;
|
|
11241
|
+
encoding?: "base64";
|
|
11242
|
+
}
|
|
11243
|
+
interface ImageUpdateOptions {
|
|
11244
|
+
requireSignedURLs?: boolean;
|
|
11245
|
+
metadata?: Record<string, unknown>;
|
|
11246
|
+
creator?: string;
|
|
11247
|
+
}
|
|
11248
|
+
interface ImageListOptions {
|
|
11249
|
+
limit?: number;
|
|
11250
|
+
cursor?: string;
|
|
11251
|
+
sortOrder?: "asc" | "desc";
|
|
11252
|
+
creator?: string;
|
|
11253
|
+
}
|
|
11254
|
+
interface ImageList {
|
|
11255
|
+
images: ImageMetadata[];
|
|
11256
|
+
cursor?: string;
|
|
11257
|
+
listComplete: boolean;
|
|
11258
|
+
}
|
|
11259
|
+
interface HostedImagesBinding {
|
|
11260
|
+
/**
|
|
11261
|
+
* Get detailed metadata for a hosted image
|
|
11262
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11263
|
+
* @returns Image metadata, or null if not found
|
|
11264
|
+
*/
|
|
11265
|
+
details(imageId: string): Promise<ImageMetadata | null>;
|
|
11266
|
+
/**
|
|
11267
|
+
* Get the raw image data for a hosted image
|
|
11268
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11269
|
+
* @returns ReadableStream of image bytes, or null if not found
|
|
11270
|
+
*/
|
|
11271
|
+
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
11272
|
+
/**
|
|
11273
|
+
* Upload a new hosted image
|
|
11274
|
+
* @param image The image file to upload
|
|
11275
|
+
* @param options Upload configuration
|
|
11276
|
+
* @returns Metadata for the uploaded image
|
|
11277
|
+
* @throws {@link ImagesError} if upload fails
|
|
11278
|
+
*/
|
|
11279
|
+
upload(
|
|
11280
|
+
image: ReadableStream<Uint8Array> | ArrayBuffer,
|
|
11281
|
+
options?: ImageUploadOptions,
|
|
11282
|
+
): Promise<ImageMetadata>;
|
|
11283
|
+
/**
|
|
11284
|
+
* Update hosted image metadata
|
|
11285
|
+
* @param imageId The ID of the image
|
|
11286
|
+
* @param options Properties to update
|
|
11287
|
+
* @returns Updated image metadata
|
|
11288
|
+
* @throws {@link ImagesError} if update fails
|
|
11289
|
+
*/
|
|
11290
|
+
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
|
|
11291
|
+
/**
|
|
11292
|
+
* Delete a hosted image
|
|
11293
|
+
* @param imageId The ID of the image
|
|
11294
|
+
* @returns True if deleted, false if not found
|
|
11295
|
+
*/
|
|
11296
|
+
delete(imageId: string): Promise<boolean>;
|
|
11297
|
+
/**
|
|
11298
|
+
* List hosted images with pagination
|
|
11299
|
+
* @param options List configuration
|
|
11300
|
+
* @returns List of images with pagination info
|
|
11301
|
+
* @throws {@link ImagesError} if list fails
|
|
11302
|
+
*/
|
|
11303
|
+
list(options?: ImageListOptions): Promise<ImageList>;
|
|
11304
|
+
}
|
|
10931
11305
|
interface ImagesBinding {
|
|
10932
11306
|
/**
|
|
10933
11307
|
* Get image metadata (type, width and height)
|
|
@@ -10947,6 +11321,10 @@ interface ImagesBinding {
|
|
|
10947
11321
|
stream: ReadableStream<Uint8Array>,
|
|
10948
11322
|
options?: ImageInputOptions,
|
|
10949
11323
|
): ImageTransformer;
|
|
11324
|
+
/**
|
|
11325
|
+
* Access hosted images CRUD operations
|
|
11326
|
+
*/
|
|
11327
|
+
readonly hosted: HostedImagesBinding;
|
|
10950
11328
|
}
|
|
10951
11329
|
interface ImageTransformer {
|
|
10952
11330
|
/**
|
|
@@ -11017,8 +11395,14 @@ interface MediaTransformer {
|
|
|
11017
11395
|
* @returns A generator for producing the transformed media output
|
|
11018
11396
|
*/
|
|
11019
11397
|
transform(
|
|
11020
|
-
transform
|
|
11398
|
+
transform?: MediaTransformationInputOptions,
|
|
11021
11399
|
): MediaTransformationGenerator;
|
|
11400
|
+
/**
|
|
11401
|
+
* Generates the final media output with specified options.
|
|
11402
|
+
* @param output - Configuration for the output format and parameters
|
|
11403
|
+
* @returns The final transformation result containing the transformed media
|
|
11404
|
+
*/
|
|
11405
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11022
11406
|
}
|
|
11023
11407
|
/**
|
|
11024
11408
|
* Generator for producing media transformation results.
|
|
@@ -11030,7 +11414,7 @@ interface MediaTransformationGenerator {
|
|
|
11030
11414
|
* @param output - Configuration for the output format and parameters
|
|
11031
11415
|
* @returns The final transformation result containing the transformed media
|
|
11032
11416
|
*/
|
|
11033
|
-
output(output
|
|
11417
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
11034
11418
|
}
|
|
11035
11419
|
/**
|
|
11036
11420
|
* Result of a media transformation operation.
|
|
@@ -11039,19 +11423,19 @@ interface MediaTransformationGenerator {
|
|
|
11039
11423
|
interface MediaTransformationResult {
|
|
11040
11424
|
/**
|
|
11041
11425
|
* Returns the transformed media as a readable stream of bytes.
|
|
11042
|
-
* @returns A
|
|
11426
|
+
* @returns A promise containing a readable stream with the transformed media
|
|
11043
11427
|
*/
|
|
11044
|
-
media(): ReadableStream<Uint8Array
|
|
11428
|
+
media(): Promise<ReadableStream<Uint8Array>>;
|
|
11045
11429
|
/**
|
|
11046
11430
|
* Returns the transformed media as an HTTP response object.
|
|
11047
|
-
* @returns The transformed media as a Response
|
|
11431
|
+
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
|
|
11048
11432
|
*/
|
|
11049
|
-
response(): Response
|
|
11433
|
+
response(): Promise<Response>;
|
|
11050
11434
|
/**
|
|
11051
11435
|
* Returns the MIME type of the transformed media.
|
|
11052
|
-
* @returns
|
|
11436
|
+
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
11053
11437
|
*/
|
|
11054
|
-
contentType(): string
|
|
11438
|
+
contentType(): Promise<string>;
|
|
11055
11439
|
}
|
|
11056
11440
|
/**
|
|
11057
11441
|
* Configuration options for transforming media input.
|