@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/2021-11-03/index.d.ts
CHANGED
|
@@ -3742,6 +3742,184 @@ declare abstract class Performance {
|
|
|
3742
3742
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
|
|
3743
3743
|
now(): number;
|
|
3744
3744
|
}
|
|
3745
|
+
// AI Search V2 API Error Interfaces
|
|
3746
|
+
interface AiSearchInternalError extends Error {}
|
|
3747
|
+
interface AiSearchNotFoundError extends Error {}
|
|
3748
|
+
interface AiSearchNameNotSetError extends Error {}
|
|
3749
|
+
// Filter types (shared with AutoRAG for compatibility)
|
|
3750
|
+
type ComparisonFilter = {
|
|
3751
|
+
key: string;
|
|
3752
|
+
type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte";
|
|
3753
|
+
value: string | number | boolean;
|
|
3754
|
+
};
|
|
3755
|
+
type CompoundFilter = {
|
|
3756
|
+
type: "and" | "or";
|
|
3757
|
+
filters: ComparisonFilter[];
|
|
3758
|
+
};
|
|
3759
|
+
// AI Search V2 Request Types
|
|
3760
|
+
type AiSearchSearchRequest = {
|
|
3761
|
+
messages: Array<{
|
|
3762
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3763
|
+
content: string | null;
|
|
3764
|
+
}>;
|
|
3765
|
+
ai_search_options?: {
|
|
3766
|
+
retrieval?: {
|
|
3767
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3768
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3769
|
+
match_threshold?: number;
|
|
3770
|
+
/** Maximum number of results (1-50, default 10) */
|
|
3771
|
+
max_num_results?: number;
|
|
3772
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3773
|
+
/** Context expansion (0-3, default 0) */
|
|
3774
|
+
context_expansion?: number;
|
|
3775
|
+
[key: string]: unknown;
|
|
3776
|
+
};
|
|
3777
|
+
query_rewrite?: {
|
|
3778
|
+
enabled?: boolean;
|
|
3779
|
+
model?: string;
|
|
3780
|
+
rewrite_prompt?: string;
|
|
3781
|
+
[key: string]: unknown;
|
|
3782
|
+
};
|
|
3783
|
+
reranking?: {
|
|
3784
|
+
/** Enable reranking (default false) */
|
|
3785
|
+
enabled?: boolean;
|
|
3786
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3787
|
+
/** Match threshold (0-1, default 0.4) */
|
|
3788
|
+
match_threshold?: number;
|
|
3789
|
+
[key: string]: unknown;
|
|
3790
|
+
};
|
|
3791
|
+
[key: string]: unknown;
|
|
3792
|
+
};
|
|
3793
|
+
};
|
|
3794
|
+
type AiSearchChatCompletionsRequest = {
|
|
3795
|
+
messages: Array<{
|
|
3796
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3797
|
+
content: string | null;
|
|
3798
|
+
}>;
|
|
3799
|
+
model?: string;
|
|
3800
|
+
stream?: boolean;
|
|
3801
|
+
ai_search_options?: {
|
|
3802
|
+
retrieval?: {
|
|
3803
|
+
retrieval_type?: "vector" | "keyword" | "hybrid";
|
|
3804
|
+
match_threshold?: number;
|
|
3805
|
+
max_num_results?: number;
|
|
3806
|
+
filters?: CompoundFilter | ComparisonFilter;
|
|
3807
|
+
context_expansion?: number;
|
|
3808
|
+
[key: string]: unknown;
|
|
3809
|
+
};
|
|
3810
|
+
query_rewrite?: {
|
|
3811
|
+
enabled?: boolean;
|
|
3812
|
+
model?: string;
|
|
3813
|
+
rewrite_prompt?: string;
|
|
3814
|
+
[key: string]: unknown;
|
|
3815
|
+
};
|
|
3816
|
+
reranking?: {
|
|
3817
|
+
enabled?: boolean;
|
|
3818
|
+
model?: "@cf/baai/bge-reranker-base" | "";
|
|
3819
|
+
match_threshold?: number;
|
|
3820
|
+
[key: string]: unknown;
|
|
3821
|
+
};
|
|
3822
|
+
[key: string]: unknown;
|
|
3823
|
+
};
|
|
3824
|
+
[key: string]: unknown;
|
|
3825
|
+
};
|
|
3826
|
+
// AI Search V2 Response Types
|
|
3827
|
+
type AiSearchSearchResponse = {
|
|
3828
|
+
search_query: string;
|
|
3829
|
+
chunks: Array<{
|
|
3830
|
+
id: string;
|
|
3831
|
+
type: string;
|
|
3832
|
+
/** Match score (0-1) */
|
|
3833
|
+
score: number;
|
|
3834
|
+
text: string;
|
|
3835
|
+
item: {
|
|
3836
|
+
timestamp?: number;
|
|
3837
|
+
key: string;
|
|
3838
|
+
metadata?: Record<string, unknown>;
|
|
3839
|
+
};
|
|
3840
|
+
scoring_details?: {
|
|
3841
|
+
/** Keyword match score (0-1) */
|
|
3842
|
+
keyword_score?: number;
|
|
3843
|
+
/** Vector similarity score (0-1) */
|
|
3844
|
+
vector_score?: number;
|
|
3845
|
+
};
|
|
3846
|
+
}>;
|
|
3847
|
+
};
|
|
3848
|
+
type AiSearchListResponse = Array<{
|
|
3849
|
+
id: string;
|
|
3850
|
+
internal_id?: string;
|
|
3851
|
+
account_id?: string;
|
|
3852
|
+
account_tag?: string;
|
|
3853
|
+
/** Whether the instance is enabled (default true) */
|
|
3854
|
+
enable?: boolean;
|
|
3855
|
+
type?: "r2" | "web-crawler";
|
|
3856
|
+
source?: string;
|
|
3857
|
+
[key: string]: unknown;
|
|
3858
|
+
}>;
|
|
3859
|
+
type AiSearchConfig = {
|
|
3860
|
+
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3861
|
+
id: string;
|
|
3862
|
+
type: "r2" | "web-crawler";
|
|
3863
|
+
source: string;
|
|
3864
|
+
source_params?: object;
|
|
3865
|
+
/** Token ID (UUID format) */
|
|
3866
|
+
token_id?: string;
|
|
3867
|
+
ai_gateway_id?: string;
|
|
3868
|
+
/** Enable query rewriting (default false) */
|
|
3869
|
+
rewrite_query?: boolean;
|
|
3870
|
+
/** Enable reranking (default false) */
|
|
3871
|
+
reranking?: boolean;
|
|
3872
|
+
embedding_model?: string;
|
|
3873
|
+
ai_search_model?: string;
|
|
3874
|
+
};
|
|
3875
|
+
type AiSearchInstance = {
|
|
3876
|
+
id: string;
|
|
3877
|
+
enable?: boolean;
|
|
3878
|
+
type?: "r2" | "web-crawler";
|
|
3879
|
+
source?: string;
|
|
3880
|
+
[key: string]: unknown;
|
|
3881
|
+
};
|
|
3882
|
+
// AI Search Instance Service - Instance-level operations
|
|
3883
|
+
declare abstract class AiSearchInstanceService {
|
|
3884
|
+
/**
|
|
3885
|
+
* Search the AI Search instance for relevant chunks.
|
|
3886
|
+
* @param params Search request with messages and AI search options
|
|
3887
|
+
* @returns Search response with matching chunks
|
|
3888
|
+
*/
|
|
3889
|
+
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
3890
|
+
/**
|
|
3891
|
+
* Generate chat completions with AI Search context.
|
|
3892
|
+
* @param params Chat completions request with optional streaming
|
|
3893
|
+
* @returns Response object (if streaming) or chat completion result
|
|
3894
|
+
*/
|
|
3895
|
+
chatCompletions(
|
|
3896
|
+
params: AiSearchChatCompletionsRequest,
|
|
3897
|
+
): Promise<Response | object>;
|
|
3898
|
+
/**
|
|
3899
|
+
* Delete this AI Search instance.
|
|
3900
|
+
*/
|
|
3901
|
+
delete(): Promise<void>;
|
|
3902
|
+
}
|
|
3903
|
+
// AI Search Account Service - Account-level operations
|
|
3904
|
+
declare abstract class AiSearchAccountService {
|
|
3905
|
+
/**
|
|
3906
|
+
* List all AI Search instances in the account.
|
|
3907
|
+
* @returns Array of AI Search instances
|
|
3908
|
+
*/
|
|
3909
|
+
list(): Promise<AiSearchListResponse>;
|
|
3910
|
+
/**
|
|
3911
|
+
* Get an AI Search instance by ID.
|
|
3912
|
+
* @param name Instance ID
|
|
3913
|
+
* @returns Instance service for performing operations
|
|
3914
|
+
*/
|
|
3915
|
+
get(name: string): AiSearchInstanceService;
|
|
3916
|
+
/**
|
|
3917
|
+
* Create a new AI Search instance.
|
|
3918
|
+
* @param config Instance configuration
|
|
3919
|
+
* @returns Instance service for performing operations
|
|
3920
|
+
*/
|
|
3921
|
+
create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
|
|
3922
|
+
}
|
|
3745
3923
|
type AiImageClassificationInput = {
|
|
3746
3924
|
image: number[];
|
|
3747
3925
|
};
|
|
@@ -9239,6 +9417,48 @@ type AiModelListType = Record<string, any>;
|
|
|
9239
9417
|
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
9240
9418
|
aiGatewayLogId: string | null;
|
|
9241
9419
|
gateway(gatewayId: string): AiGateway;
|
|
9420
|
+
/**
|
|
9421
|
+
* Access the AI Search API for managing AI-powered search instances.
|
|
9422
|
+
*
|
|
9423
|
+
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
9424
|
+
* - Account-level operations: `list()`, `create()`
|
|
9425
|
+
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
9426
|
+
*
|
|
9427
|
+
* @example
|
|
9428
|
+
* ```typescript
|
|
9429
|
+
* // List all AI Search instances
|
|
9430
|
+
* const instances = await env.AI.aiSearch.list();
|
|
9431
|
+
*
|
|
9432
|
+
* // Search an instance
|
|
9433
|
+
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
9434
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9435
|
+
* ai_search_options: {
|
|
9436
|
+
* retrieval: { max_num_results: 10 }
|
|
9437
|
+
* }
|
|
9438
|
+
* });
|
|
9439
|
+
*
|
|
9440
|
+
* // Generate chat completions with AI Search context
|
|
9441
|
+
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
9442
|
+
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
9443
|
+
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
9444
|
+
* });
|
|
9445
|
+
* ```
|
|
9446
|
+
*/
|
|
9447
|
+
aiSearch(): AiSearchAccountService;
|
|
9448
|
+
/**
|
|
9449
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9450
|
+
* Use `env.AI.aiSearch` instead for better API design and new features.
|
|
9451
|
+
*
|
|
9452
|
+
* Migration guide:
|
|
9453
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9454
|
+
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
9455
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9456
|
+
*
|
|
9457
|
+
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
9458
|
+
*
|
|
9459
|
+
* @see AiSearchAccountService
|
|
9460
|
+
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
9461
|
+
*/
|
|
9242
9462
|
autorag(autoragId: string): AutoRAG;
|
|
9243
9463
|
run<
|
|
9244
9464
|
Name extends keyof AiModelList,
|
|
@@ -9395,19 +9615,30 @@ declare abstract class AiGateway {
|
|
|
9395
9615
|
): Promise<Response>;
|
|
9396
9616
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
9397
9617
|
}
|
|
9618
|
+
/**
|
|
9619
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
|
|
9620
|
+
* @see AiSearchInternalError
|
|
9621
|
+
*/
|
|
9398
9622
|
interface AutoRAGInternalError extends Error {}
|
|
9623
|
+
/**
|
|
9624
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
|
|
9625
|
+
* @see AiSearchNotFoundError
|
|
9626
|
+
*/
|
|
9399
9627
|
interface AutoRAGNotFoundError extends Error {}
|
|
9628
|
+
/**
|
|
9629
|
+
* @deprecated This error type is no longer used in the AI Search API.
|
|
9630
|
+
*/
|
|
9400
9631
|
interface AutoRAGUnauthorizedError extends Error {}
|
|
9632
|
+
/**
|
|
9633
|
+
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
|
|
9634
|
+
* @see AiSearchNameNotSetError
|
|
9635
|
+
*/
|
|
9401
9636
|
interface AutoRAGNameNotSetError extends Error {}
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
type CompoundFilter = {
|
|
9408
|
-
type: "and" | "or";
|
|
9409
|
-
filters: ComparisonFilter[];
|
|
9410
|
-
};
|
|
9637
|
+
/**
|
|
9638
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9639
|
+
* Use AiSearchSearchRequest with the new API instead.
|
|
9640
|
+
* @see AiSearchSearchRequest
|
|
9641
|
+
*/
|
|
9411
9642
|
type AutoRagSearchRequest = {
|
|
9412
9643
|
query: string;
|
|
9413
9644
|
filters?: CompoundFilter | ComparisonFilter;
|
|
@@ -9422,16 +9653,31 @@ type AutoRagSearchRequest = {
|
|
|
9422
9653
|
};
|
|
9423
9654
|
rewrite_query?: boolean;
|
|
9424
9655
|
};
|
|
9656
|
+
/**
|
|
9657
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9658
|
+
* Use AiSearchChatCompletionsRequest with the new API instead.
|
|
9659
|
+
* @see AiSearchChatCompletionsRequest
|
|
9660
|
+
*/
|
|
9425
9661
|
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
9426
9662
|
stream?: boolean;
|
|
9427
9663
|
system_prompt?: string;
|
|
9428
9664
|
};
|
|
9665
|
+
/**
|
|
9666
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9667
|
+
* Use AiSearchChatCompletionsRequest with stream: true instead.
|
|
9668
|
+
* @see AiSearchChatCompletionsRequest
|
|
9669
|
+
*/
|
|
9429
9670
|
type AutoRagAiSearchRequestStreaming = Omit<
|
|
9430
9671
|
AutoRagAiSearchRequest,
|
|
9431
9672
|
"stream"
|
|
9432
9673
|
> & {
|
|
9433
9674
|
stream: true;
|
|
9434
9675
|
};
|
|
9676
|
+
/**
|
|
9677
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9678
|
+
* Use AiSearchSearchResponse with the new API instead.
|
|
9679
|
+
* @see AiSearchSearchResponse
|
|
9680
|
+
*/
|
|
9435
9681
|
type AutoRagSearchResponse = {
|
|
9436
9682
|
object: "vector_store.search_results.page";
|
|
9437
9683
|
search_query: string;
|
|
@@ -9448,6 +9694,11 @@ type AutoRagSearchResponse = {
|
|
|
9448
9694
|
has_more: boolean;
|
|
9449
9695
|
next_page: string | null;
|
|
9450
9696
|
};
|
|
9697
|
+
/**
|
|
9698
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9699
|
+
* Use AiSearchListResponse with the new API instead.
|
|
9700
|
+
* @see AiSearchListResponse
|
|
9701
|
+
*/
|
|
9451
9702
|
type AutoRagListResponse = {
|
|
9452
9703
|
id: string;
|
|
9453
9704
|
enable: boolean;
|
|
@@ -9457,14 +9708,51 @@ type AutoRagListResponse = {
|
|
|
9457
9708
|
paused: boolean;
|
|
9458
9709
|
status: string;
|
|
9459
9710
|
}[];
|
|
9711
|
+
/**
|
|
9712
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9713
|
+
* The new API returns different response formats for chat completions.
|
|
9714
|
+
*/
|
|
9460
9715
|
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
9461
9716
|
response: string;
|
|
9462
9717
|
};
|
|
9718
|
+
/**
|
|
9719
|
+
* @deprecated AutoRAG has been replaced by AI Search.
|
|
9720
|
+
* Use the new AI Search API instead: `env.AI.aiSearch`
|
|
9721
|
+
*
|
|
9722
|
+
* Migration guide:
|
|
9723
|
+
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
9724
|
+
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
9725
|
+
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
9726
|
+
*
|
|
9727
|
+
* @see AiSearchAccountService
|
|
9728
|
+
* @see AiSearchInstanceService
|
|
9729
|
+
*/
|
|
9463
9730
|
declare abstract class AutoRAG {
|
|
9731
|
+
/**
|
|
9732
|
+
* @deprecated Use `env.AI.aiSearch.list()` instead.
|
|
9733
|
+
* @see AiSearchAccountService.list
|
|
9734
|
+
*/
|
|
9464
9735
|
list(): Promise<AutoRagListResponse>;
|
|
9736
|
+
/**
|
|
9737
|
+
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
|
|
9738
|
+
* Note: The new API uses a messages array instead of a query string.
|
|
9739
|
+
* @see AiSearchInstanceService.search
|
|
9740
|
+
*/
|
|
9465
9741
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
9742
|
+
/**
|
|
9743
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9744
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9745
|
+
*/
|
|
9466
9746
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
9747
|
+
/**
|
|
9748
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9749
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9750
|
+
*/
|
|
9467
9751
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
9752
|
+
/**
|
|
9753
|
+
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
|
|
9754
|
+
* @see AiSearchInstanceService.chatCompletions
|
|
9755
|
+
*/
|
|
9468
9756
|
aiSearch(
|
|
9469
9757
|
params: AutoRagAiSearchRequest,
|
|
9470
9758
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
@@ -10861,6 +11149,86 @@ type ImageOutputOptions = {
|
|
|
10861
11149
|
background?: string;
|
|
10862
11150
|
anim?: boolean;
|
|
10863
11151
|
};
|
|
11152
|
+
interface ImageMetadata {
|
|
11153
|
+
id: string;
|
|
11154
|
+
filename?: string;
|
|
11155
|
+
uploaded?: string;
|
|
11156
|
+
requireSignedURLs: boolean;
|
|
11157
|
+
meta?: Record<string, unknown>;
|
|
11158
|
+
variants: string[];
|
|
11159
|
+
draft?: boolean;
|
|
11160
|
+
creator?: string;
|
|
11161
|
+
}
|
|
11162
|
+
interface ImageUploadOptions {
|
|
11163
|
+
id?: string;
|
|
11164
|
+
filename?: string;
|
|
11165
|
+
requireSignedURLs?: boolean;
|
|
11166
|
+
metadata?: Record<string, unknown>;
|
|
11167
|
+
creator?: string;
|
|
11168
|
+
encoding?: "base64";
|
|
11169
|
+
}
|
|
11170
|
+
interface ImageUpdateOptions {
|
|
11171
|
+
requireSignedURLs?: boolean;
|
|
11172
|
+
metadata?: Record<string, unknown>;
|
|
11173
|
+
creator?: string;
|
|
11174
|
+
}
|
|
11175
|
+
interface ImageListOptions {
|
|
11176
|
+
limit?: number;
|
|
11177
|
+
cursor?: string;
|
|
11178
|
+
sortOrder?: "asc" | "desc";
|
|
11179
|
+
creator?: string;
|
|
11180
|
+
}
|
|
11181
|
+
interface ImageList {
|
|
11182
|
+
images: ImageMetadata[];
|
|
11183
|
+
cursor?: string;
|
|
11184
|
+
listComplete: boolean;
|
|
11185
|
+
}
|
|
11186
|
+
interface HostedImagesBinding {
|
|
11187
|
+
/**
|
|
11188
|
+
* Get detailed metadata for a hosted image
|
|
11189
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11190
|
+
* @returns Image metadata, or null if not found
|
|
11191
|
+
*/
|
|
11192
|
+
details(imageId: string): Promise<ImageMetadata | null>;
|
|
11193
|
+
/**
|
|
11194
|
+
* Get the raw image data for a hosted image
|
|
11195
|
+
* @param imageId The ID of the image (UUID or custom ID)
|
|
11196
|
+
* @returns ReadableStream of image bytes, or null if not found
|
|
11197
|
+
*/
|
|
11198
|
+
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
11199
|
+
/**
|
|
11200
|
+
* Upload a new hosted image
|
|
11201
|
+
* @param image The image file to upload
|
|
11202
|
+
* @param options Upload configuration
|
|
11203
|
+
* @returns Metadata for the uploaded image
|
|
11204
|
+
* @throws {@link ImagesError} if upload fails
|
|
11205
|
+
*/
|
|
11206
|
+
upload(
|
|
11207
|
+
image: ReadableStream<Uint8Array> | ArrayBuffer,
|
|
11208
|
+
options?: ImageUploadOptions,
|
|
11209
|
+
): Promise<ImageMetadata>;
|
|
11210
|
+
/**
|
|
11211
|
+
* Update hosted image metadata
|
|
11212
|
+
* @param imageId The ID of the image
|
|
11213
|
+
* @param options Properties to update
|
|
11214
|
+
* @returns Updated image metadata
|
|
11215
|
+
* @throws {@link ImagesError} if update fails
|
|
11216
|
+
*/
|
|
11217
|
+
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
|
|
11218
|
+
/**
|
|
11219
|
+
* Delete a hosted image
|
|
11220
|
+
* @param imageId The ID of the image
|
|
11221
|
+
* @returns True if deleted, false if not found
|
|
11222
|
+
*/
|
|
11223
|
+
delete(imageId: string): Promise<boolean>;
|
|
11224
|
+
/**
|
|
11225
|
+
* List hosted images with pagination
|
|
11226
|
+
* @param options List configuration
|
|
11227
|
+
* @returns List of images with pagination info
|
|
11228
|
+
* @throws {@link ImagesError} if list fails
|
|
11229
|
+
*/
|
|
11230
|
+
list(options?: ImageListOptions): Promise<ImageList>;
|
|
11231
|
+
}
|
|
10864
11232
|
interface ImagesBinding {
|
|
10865
11233
|
/**
|
|
10866
11234
|
* Get image metadata (type, width and height)
|
|
@@ -10880,6 +11248,10 @@ interface ImagesBinding {
|
|
|
10880
11248
|
stream: ReadableStream<Uint8Array>,
|
|
10881
11249
|
options?: ImageInputOptions,
|
|
10882
11250
|
): ImageTransformer;
|
|
11251
|
+
/**
|
|
11252
|
+
* Access hosted images CRUD operations
|
|
11253
|
+
*/
|
|
11254
|
+
readonly hosted: HostedImagesBinding;
|
|
10883
11255
|
}
|
|
10884
11256
|
interface ImageTransformer {
|
|
10885
11257
|
/**
|
|
@@ -10950,8 +11322,14 @@ interface MediaTransformer {
|
|
|
10950
11322
|
* @returns A generator for producing the transformed media output
|
|
10951
11323
|
*/
|
|
10952
11324
|
transform(
|
|
10953
|
-
transform
|
|
11325
|
+
transform?: MediaTransformationInputOptions,
|
|
10954
11326
|
): MediaTransformationGenerator;
|
|
11327
|
+
/**
|
|
11328
|
+
* Generates the final media output with specified options.
|
|
11329
|
+
* @param output - Configuration for the output format and parameters
|
|
11330
|
+
* @returns The final transformation result containing the transformed media
|
|
11331
|
+
*/
|
|
11332
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
10955
11333
|
}
|
|
10956
11334
|
/**
|
|
10957
11335
|
* Generator for producing media transformation results.
|
|
@@ -10963,7 +11341,7 @@ interface MediaTransformationGenerator {
|
|
|
10963
11341
|
* @param output - Configuration for the output format and parameters
|
|
10964
11342
|
* @returns The final transformation result containing the transformed media
|
|
10965
11343
|
*/
|
|
10966
|
-
output(output
|
|
11344
|
+
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
|
|
10967
11345
|
}
|
|
10968
11346
|
/**
|
|
10969
11347
|
* Result of a media transformation operation.
|
|
@@ -10972,19 +11350,19 @@ interface MediaTransformationGenerator {
|
|
|
10972
11350
|
interface MediaTransformationResult {
|
|
10973
11351
|
/**
|
|
10974
11352
|
* Returns the transformed media as a readable stream of bytes.
|
|
10975
|
-
* @returns A
|
|
11353
|
+
* @returns A promise containing a readable stream with the transformed media
|
|
10976
11354
|
*/
|
|
10977
|
-
media(): ReadableStream<Uint8Array
|
|
11355
|
+
media(): Promise<ReadableStream<Uint8Array>>;
|
|
10978
11356
|
/**
|
|
10979
11357
|
* Returns the transformed media as an HTTP response object.
|
|
10980
|
-
* @returns The transformed media as a Response
|
|
11358
|
+
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
|
|
10981
11359
|
*/
|
|
10982
|
-
response(): Response
|
|
11360
|
+
response(): Promise<Response>;
|
|
10983
11361
|
/**
|
|
10984
11362
|
* Returns the MIME type of the transformed media.
|
|
10985
|
-
* @returns
|
|
11363
|
+
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
|
|
10986
11364
|
*/
|
|
10987
|
-
contentType(): string
|
|
11365
|
+
contentType(): Promise<string>;
|
|
10988
11366
|
}
|
|
10989
11367
|
/**
|
|
10990
11368
|
* Configuration options for transforming media input.
|