@proveanything/smartlinks 1.7.5 → 1.7.8

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.
@@ -50,6 +50,83 @@ export interface ToolDefinition {
50
50
  };
51
51
  };
52
52
  }
53
+ /** Additional/native tool definition accepted by the Responses API. */
54
+ export interface ResponseTool {
55
+ type: string;
56
+ name?: string;
57
+ description?: string;
58
+ parameters?: Record<string, any>;
59
+ [key: string]: any;
60
+ }
61
+ /** Structured input item accepted by the Responses API. */
62
+ export interface ResponseInputItem {
63
+ role?: 'system' | 'user' | 'assistant' | 'function' | 'tool';
64
+ type?: string;
65
+ content?: string | ContentPart[];
66
+ name?: string;
67
+ function_call?: FunctionCall;
68
+ tool_calls?: ToolCall[];
69
+ tool_call_id?: string;
70
+ [key: string]: any;
71
+ }
72
+ /** Request for the Responses API. */
73
+ export interface ResponsesRequest {
74
+ model?: string;
75
+ input?: string | ResponseInputItem[];
76
+ messages?: ResponseInputItem[];
77
+ previous_response_id?: string;
78
+ conversation?: string | Record<string, any>;
79
+ tools?: Array<ToolDefinition | ResponseTool>;
80
+ tool_choice?: 'none' | 'auto' | 'required' | {
81
+ type: 'function';
82
+ function: {
83
+ name: string;
84
+ };
85
+ } | {
86
+ type: 'function';
87
+ name: string;
88
+ };
89
+ stream?: boolean;
90
+ temperature?: number;
91
+ max_output_tokens?: number;
92
+ store?: boolean;
93
+ instructions?: string;
94
+ include?: string[];
95
+ reasoning?: Record<string, any>;
96
+ parallel_tool_calls?: boolean;
97
+ truncation?: 'auto' | 'disabled';
98
+ text?: Record<string, any>;
99
+ metadata?: Record<string, string>;
100
+ prompt_cache_key?: string;
101
+ }
102
+ /** Response from the Responses API. */
103
+ export interface ResponsesResult {
104
+ id: string;
105
+ object: 'response';
106
+ created: number;
107
+ model: string;
108
+ status?: 'completed' | 'failed' | 'in_progress' | 'queued' | 'cancelled' | 'incomplete';
109
+ output: any[];
110
+ output_text: string;
111
+ usage: {
112
+ input_tokens: number;
113
+ output_tokens: number;
114
+ total_tokens: number;
115
+ };
116
+ error?: any;
117
+ incomplete_details?: {
118
+ reason?: 'max_output_tokens' | 'content_filter';
119
+ } | null;
120
+ previous_response_id?: string | null;
121
+ conversation?: unknown;
122
+ provider: 'openai';
123
+ responseTime: number;
124
+ }
125
+ /** Generic SSE event emitted by the Responses API. */
126
+ export interface ResponsesStreamEvent {
127
+ type: string;
128
+ [key: string]: any;
129
+ }
53
130
  /** Chat completion request */
54
131
  export interface ChatCompletionRequest {
55
132
  messages: ChatMessage[];
@@ -120,6 +197,16 @@ export interface AIModel {
120
197
  features: string[];
121
198
  recommended?: string;
122
199
  }
200
+ /** Filter parameters when listing models. */
201
+ export interface AIModelListParams {
202
+ provider?: 'gemini' | 'openai';
203
+ capability?: 'text' | 'vision' | 'audio' | 'code';
204
+ }
205
+ /** Model list response. */
206
+ export interface AIModelListResponse {
207
+ object: 'list';
208
+ data: AIModel[];
209
+ }
123
210
  /** Document chunk with embedding */
124
211
  export interface DocumentChunk {
125
212
  text: string;
@@ -175,24 +175,38 @@ export interface GetOrderItemsResponse {
175
175
  limit: number;
176
176
  offset: number;
177
177
  }
178
+ /**
179
+ * Item-level filters for advanced order querying.
180
+ * Batch and variant identifiers are only meaningful within a product.
181
+ */
182
+ export interface QueryOrderItemFilter {
183
+ productId: string;
184
+ batchId?: string;
185
+ variantId?: string;
186
+ }
187
+ /**
188
+ * Order-level and item-level filters for advanced order querying.
189
+ */
190
+ export interface QueryOrdersFilter {
191
+ status?: string;
192
+ orderRef?: string;
193
+ customerId?: string;
194
+ createdAfter?: string;
195
+ createdBefore?: string;
196
+ updatedAfter?: string;
197
+ updatedBefore?: string;
198
+ minItemCount?: number;
199
+ maxItemCount?: number;
200
+ metadata?: Record<string, any>;
201
+ item?: QueryOrderItemFilter;
202
+ sortBy?: string;
203
+ sortOrder?: 'asc' | 'desc';
204
+ }
178
205
  /**
179
206
  * Request for advanced order querying.
180
207
  */
181
208
  export interface QueryOrdersRequest {
182
- query?: {
183
- status?: string;
184
- orderRef?: string;
185
- customerId?: string;
186
- createdAfter?: string;
187
- createdBefore?: string;
188
- updatedAfter?: string;
189
- updatedBefore?: string;
190
- minItemCount?: number;
191
- maxItemCount?: number;
192
- metadata?: Record<string, any>;
193
- sortBy?: string;
194
- sortOrder?: 'asc' | 'desc';
195
- };
209
+ query?: QueryOrdersFilter;
196
210
  limit?: number;
197
211
  offset?: number;
198
212
  includeItems?: boolean;
@@ -302,7 +316,7 @@ export interface GetOrderIdsParams {
302
316
  export interface GetOrderIdsResponse {
303
317
  orderIds: string[];
304
318
  count: number;
305
- attribute: 'batchId' | 'productId' | 'variantId';
319
+ attribute: 'productId';
306
320
  value: string;
307
321
  }
308
322
  /**
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.7.5 | Generated: 2026-03-10T14:23:18.789Z
3
+ Version: 1.7.8 | Generated: 2026-03-12T16:18:35.207Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -431,6 +431,93 @@ interface ToolDefinition {
431
431
  }
432
432
  ```
433
433
 
434
+ **ResponseTool** (interface)
435
+ ```typescript
436
+ interface ResponseTool {
437
+ type: string
438
+ name?: string
439
+ description?: string
440
+ parameters?: Record<string, any>
441
+ [key: string]: any
442
+ }
443
+ ```
444
+
445
+ **ResponseInputItem** (interface)
446
+ ```typescript
447
+ interface ResponseInputItem {
448
+ role?: 'system' | 'user' | 'assistant' | 'function' | 'tool'
449
+ type?: string
450
+ content?: string | ContentPart[]
451
+ name?: string
452
+ function_call?: FunctionCall
453
+ tool_calls?: ToolCall[]
454
+ tool_call_id?: string
455
+ [key: string]: any
456
+ }
457
+ ```
458
+
459
+ **ResponsesRequest** (interface)
460
+ ```typescript
461
+ interface ResponsesRequest {
462
+ model?: string
463
+ input?: string | ResponseInputItem[]
464
+ messages?: ResponseInputItem[]
465
+ previous_response_id?: string
466
+ conversation?: string | Record<string, any>
467
+ tools?: Array<ToolDefinition | ResponseTool>
468
+ tool_choice?:
469
+ | 'none'
470
+ | 'auto'
471
+ | 'required'
472
+ | { type: 'function'; function: { name: string } }
473
+ | { type: 'function'; name: string }
474
+ stream?: boolean
475
+ temperature?: number
476
+ max_output_tokens?: number
477
+ store?: boolean
478
+ instructions?: string
479
+ include?: string[]
480
+ reasoning?: Record<string, any>
481
+ parallel_tool_calls?: boolean
482
+ truncation?: 'auto' | 'disabled'
483
+ text?: Record<string, any>
484
+ metadata?: Record<string, string>
485
+ prompt_cache_key?: string
486
+ }
487
+ ```
488
+
489
+ **ResponsesResult** (interface)
490
+ ```typescript
491
+ interface ResponsesResult {
492
+ id: string
493
+ object: 'response'
494
+ created: number
495
+ model: string
496
+ status?: 'completed' | 'failed' | 'in_progress' | 'queued' | 'cancelled' | 'incomplete'
497
+ output: any[]
498
+ output_text: string
499
+ usage: {
500
+ input_tokens: number
501
+ output_tokens: number
502
+ total_tokens: number
503
+ }
504
+ error?: any
505
+ incomplete_details?: { reason?: 'max_output_tokens' | 'content_filter' } | null
506
+ previous_response_id?: string | null
507
+ conversation?: unknown
508
+ provider: 'openai'
509
+ responseTime: number
510
+ }
511
+ ```
512
+
513
+ **ResponsesStreamEvent** (interface)
514
+ ```typescript
515
+ interface ResponsesStreamEvent {
516
+ type: string
517
+ [key: string]: any
518
+ }
519
+ ```
520
+
434
521
  **ChatCompletionRequest** (interface)
435
522
  ```typescript
436
523
  interface ChatCompletionRequest {
@@ -509,6 +596,22 @@ interface AIModel {
509
596
  }
510
597
  ```
511
598
 
599
+ **AIModelListParams** (interface)
600
+ ```typescript
601
+ interface AIModelListParams {
602
+ provider?: 'gemini' | 'openai'
603
+ capability?: 'text' | 'vision' | 'audio' | 'code'
604
+ }
605
+ ```
606
+
607
+ **AIModelListResponse** (interface)
608
+ ```typescript
609
+ interface AIModelListResponse {
610
+ object: 'list'
611
+ data: AIModel[]
612
+ }
613
+ ```
614
+
512
615
  **DocumentChunk** (interface)
513
616
  ```typescript
514
617
  interface DocumentChunk {
@@ -4400,23 +4503,38 @@ interface GetOrderItemsResponse {
4400
4503
  }
4401
4504
  ```
4402
4505
 
4403
- **QueryOrdersRequest** (interface)
4506
+ **QueryOrderItemFilter** (interface)
4404
4507
  ```typescript
4405
- interface QueryOrdersRequest {
4406
- query?: {
4508
+ interface QueryOrderItemFilter {
4509
+ productId: string
4510
+ batchId?: string
4511
+ variantId?: string
4512
+ }
4513
+ ```
4514
+
4515
+ **QueryOrdersFilter** (interface)
4516
+ ```typescript
4517
+ interface QueryOrdersFilter {
4407
4518
  status?: string
4408
4519
  orderRef?: string
4409
4520
  customerId?: string
4410
- createdAfter?: string // ISO 8601 date
4411
- createdBefore?: string // ISO 8601 date
4412
- updatedAfter?: string // ISO 8601 date
4413
- updatedBefore?: string // ISO 8601 date
4521
+ createdAfter?: string // ISO 8601 date
4522
+ createdBefore?: string // ISO 8601 date
4523
+ updatedAfter?: string // ISO 8601 date
4524
+ updatedBefore?: string // ISO 8601 date
4414
4525
  minItemCount?: number
4415
4526
  maxItemCount?: number
4416
4527
  metadata?: Record<string, any>
4528
+ item?: QueryOrderItemFilter
4417
4529
  sortBy?: string
4418
4530
  sortOrder?: 'asc' | 'desc'
4419
- }
4531
+ }
4532
+ ```
4533
+
4534
+ **QueryOrdersRequest** (interface)
4535
+ ```typescript
4536
+ interface QueryOrdersRequest {
4537
+ query?: QueryOrdersFilter
4420
4538
  limit?: number // Optional: Max results (default: 100)
4421
4539
  offset?: number // Optional: Pagination offset (default: 0)
4422
4540
  includeItems?: boolean // Optional: Include items array (default: false)
@@ -4537,7 +4655,7 @@ interface GetOrderIdsParams {
4537
4655
  interface GetOrderIdsResponse {
4538
4656
  orderIds: string[]
4539
4657
  count: number
4540
- attribute: 'batchId' | 'productId' | 'variantId'
4658
+ attribute: 'productId'
4541
4659
  value: string
4542
4660
  }
4543
4661
  ```
@@ -5271,90 +5389,6 @@ type AccountInfoResponse = {
5271
5389
 
5272
5390
  ## API Functions
5273
5391
 
5274
- ### ai
5275
-
5276
- **create**(collectionId: string,
5277
- request: ChatCompletionRequest) → `Promise<ChatCompletionResponse | AsyncIterable<ChatCompletionChunk>>`
5278
- Create a chat completion (streaming or non-streaming)
5279
-
5280
- **list**(collectionId: string) → `Promise<`
5281
- List available AI models
5282
-
5283
- **get**(collectionId: string, modelId: string) → `Promise<AIModel>`
5284
- Get specific model information
5285
-
5286
- **indexDocument**(collectionId: string,
5287
- request: IndexDocumentRequest) → `Promise<IndexDocumentResponse>`
5288
- Index a document for RAG
5289
-
5290
- **configureAssistant**(collectionId: string,
5291
- request: ConfigureAssistantRequest) → `Promise<ConfigureAssistantResponse>`
5292
- Configure AI assistant behavior
5293
-
5294
- **stats**(collectionId: string) → `Promise<SessionStatistics>`
5295
- Get session statistics
5296
-
5297
- **reset**(collectionId: string, userId: string) → `Promise<`
5298
- Reset rate limit for a user
5299
-
5300
- **generate**(collectionId: string,
5301
- request: GeneratePodcastRequest) → `Promise<GeneratePodcastResponse>`
5302
- Generate a NotebookLM-style conversational podcast from product documents
5303
-
5304
- **getStatus**(collectionId: string, podcastId: string) → `Promise<PodcastStatus>`
5305
- Get podcast generation status
5306
-
5307
- **generate**(collectionId: string,
5308
- request: TTSRequest) → `Promise<Blob>`
5309
- Generate text-to-speech audio
5310
-
5311
- **chat**(collectionId: string,
5312
- request: PublicChatRequest) → `Promise<PublicChatResponse>`
5313
- Chat with product assistant (RAG)
5314
-
5315
- **getSession**(collectionId: string, sessionId: string) → `Promise<Session>`
5316
- Get session history
5317
-
5318
- **clearSession**(collectionId: string, sessionId: string) → `Promise<`
5319
- Clear session history
5320
-
5321
- **getRateLimit**(collectionId: string, userId: string) → `Promise<RateLimitStatus>`
5322
- Check rate limit status
5323
-
5324
- **getToken**(collectionId: string,
5325
- request: EphemeralTokenRequest) → `Promise<EphemeralTokenResponse>`
5326
- Generate ephemeral token for Gemini Live
5327
-
5328
- **isSupported**() → `boolean`
5329
- Check if voice is supported in browser
5330
-
5331
- **listen**(language = 'en-US') → `Promise<string>`
5332
- Listen for voice input
5333
-
5334
- **speak**(text: string, options?: { voice?: string; rate?: number }) → `Promise<void>`
5335
- Speak text
5336
-
5337
- **generateContent**(collectionId: string,
5338
- params: AIGenerateContentRequest,
5339
- admin: boolean = true) → `Promise<any>`
5340
- Generate text/content via AI (admin)
5341
-
5342
- **generateImage**(collectionId: string, params: AIGenerateImageRequest) → `Promise<any>`
5343
- Generate an image via AI (admin)
5344
-
5345
- **searchPhotos**(collectionId: string,
5346
- params: AISearchPhotosRequest) → `Promise<AISearchPhotosPhoto[]>`
5347
- Search stock photos or similar via AI (admin)
5348
-
5349
- **uploadFile**(collectionId: string, params: any) → `Promise<any>`
5350
- Upload a file for AI usage (admin). Pass FormData for binary uploads.
5351
-
5352
- **createCache**(collectionId: string, params: any) → `Promise<any>`
5353
- Create or warm a cache for AI (admin)
5354
-
5355
- **postChat**(collectionId: string, params: any, admin: boolean = true) → `Promise<any>`
5356
- Post a chat message to the AI (admin or public)
5357
-
5358
5392
  ### app
5359
5393
 
5360
5394
  **create**(collectionId: string,
@@ -5823,6 +5857,94 @@ Get all tags/codes assigned to a specific batch. Shows which claim set codes hav
5823
5857
  **appendBulk**(collectionId: string,
5824
5858
  body: BroadcastAppendBulkBody) → `Promise<AppendBulkResult>`
5825
5859
 
5860
+ ### chat
5861
+
5862
+ **create**(collectionId: string,
5863
+ request: ResponsesRequest) → `Promise<ResponsesResult | AsyncIterable<ResponsesStreamEvent>>`
5864
+ Create a Responses API request (streaming or non-streaming)
5865
+
5866
+ **create**(collectionId: string,
5867
+ request: ChatCompletionRequest) → `Promise<ChatCompletionResponse | AsyncIterable<ChatCompletionChunk>>`
5868
+ Create a chat completion (streaming or non-streaming)
5869
+
5870
+ **list**(collectionId: string, params?: AIModelListParams) → `Promise<AIModelListResponse>`
5871
+ List available AI models
5872
+
5873
+ **get**(collectionId: string, modelId: string) → `Promise<AIModel>`
5874
+ Get specific model information
5875
+
5876
+ **indexDocument**(collectionId: string,
5877
+ request: IndexDocumentRequest) → `Promise<IndexDocumentResponse>`
5878
+ Index a document for RAG
5879
+
5880
+ **configureAssistant**(collectionId: string,
5881
+ request: ConfigureAssistantRequest) → `Promise<ConfigureAssistantResponse>`
5882
+ Configure AI assistant behavior
5883
+
5884
+ **stats**(collectionId: string) → `Promise<SessionStatistics>`
5885
+ Get session statistics
5886
+
5887
+ **reset**(collectionId: string, userId: string) → `Promise<`
5888
+ Reset rate limit for a user
5889
+
5890
+ **generate**(collectionId: string,
5891
+ request: GeneratePodcastRequest) → `Promise<GeneratePodcastResponse>`
5892
+ Generate a NotebookLM-style conversational podcast from product documents
5893
+
5894
+ **getStatus**(collectionId: string, podcastId: string) → `Promise<PodcastStatus>`
5895
+ Get podcast generation status
5896
+
5897
+ **generate**(collectionId: string,
5898
+ request: TTSRequest) → `Promise<Blob>`
5899
+ Generate text-to-speech audio
5900
+
5901
+ **chat**(collectionId: string,
5902
+ request: PublicChatRequest) → `Promise<PublicChatResponse>`
5903
+ Chat with product assistant (RAG)
5904
+
5905
+ **getSession**(collectionId: string, sessionId: string) → `Promise<Session>`
5906
+ Get session history
5907
+
5908
+ **clearSession**(collectionId: string, sessionId: string) → `Promise<`
5909
+ Clear session history
5910
+
5911
+ **getRateLimit**(collectionId: string, userId: string) → `Promise<RateLimitStatus>`
5912
+ Check rate limit status
5913
+
5914
+ **getToken**(collectionId: string,
5915
+ request: EphemeralTokenRequest) → `Promise<EphemeralTokenResponse>`
5916
+ Generate ephemeral token for Gemini Live
5917
+
5918
+ **isSupported**() → `boolean`
5919
+ Check if voice is supported in browser
5920
+
5921
+ **listen**(language = 'en-US') → `Promise<string>`
5922
+ Listen for voice input
5923
+
5924
+ **speak**(text: string, options?: { voice?: string; rate?: number }) → `Promise<void>`
5925
+ Speak text
5926
+
5927
+ **generateContent**(collectionId: string,
5928
+ params: AIGenerateContentRequest,
5929
+ admin: boolean = true) → `Promise<any>`
5930
+ Generate text/content via AI (admin)
5931
+
5932
+ **generateImage**(collectionId: string, params: AIGenerateImageRequest) → `Promise<any>`
5933
+ Generate an image via AI (admin)
5934
+
5935
+ **searchPhotos**(collectionId: string,
5936
+ params: AISearchPhotosRequest) → `Promise<AISearchPhotosPhoto[]>`
5937
+ Search stock photos or similar via AI (admin)
5938
+
5939
+ **uploadFile**(collectionId: string, params: any) → `Promise<any>`
5940
+ Upload a file for AI usage (admin). Pass FormData for binary uploads.
5941
+
5942
+ **createCache**(collectionId: string, params: any) → `Promise<any>`
5943
+ Create or warm a cache for AI (admin)
5944
+
5945
+ **postChat**(collectionId: string, params: any, admin: boolean = true) → `Promise<any>`
5946
+ Post a chat message to the AI (admin or public)
5947
+
5826
5948
  ### claimSet
5827
5949
 
5828
5950
  **getAllForCollection**(collectionId: string) → `Promise<any[]>`
@@ -6308,7 +6430,7 @@ Find all orders containing specific items (tags, proofs, or serial numbers). Use
6308
6430
 
6309
6431
  **query**(collectionId: string,
6310
6432
  data: QueryOrdersRequest) → `Promise<QueryOrdersResponse>`
6311
- Advanced query for orders with date filtering, metadata search, and sorting. More powerful than the basic list() function. ```typescript // Find pending orders created in January 2026 const result = await order.query('coll_123', { query: { status: 'pending', createdAfter: '2026-01-01T00:00:00Z', createdBefore: '2026-02-01T00:00:00Z', sortBy: 'createdAt', sortOrder: 'desc' }, limit: 50 }) // Find orders with specific metadata and item count const highPriority = await order.query('coll_123', { query: { metadata: { priority: 'high' }, minItemCount: 10, maxItemCount: 100 }, includeItems: true }) ```
6433
+ Advanced query for orders with order-level and item-level filtering. More powerful than the basic list() function. ```typescript // Find pending orders created in January 2026 const result = await order.query('coll_123', { query: { status: 'pending', createdAfter: '2026-01-01T00:00:00Z', createdBefore: '2026-02-01T00:00:00Z', sortBy: 'createdAt', sortOrder: 'desc' }, limit: 50 }) // Find orders with specific metadata and item count const highPriority = await order.query('coll_123', { query: { metadata: { priority: 'high' }, minItemCount: 10, maxItemCount: 100 }, includeItems: true }) // Find orders containing a specific product batch const batchOrders = await order.query('coll_123', { query: { item: { productId: 'prod_789', batchId: 'BATCH-2024-001' } }, includeItems: true }) ```
6312
6434
 
6313
6435
  **reports**(collectionId: string,
6314
6436
  params?: ReportsParams) → `Promise<ReportsResponse>`
@@ -6341,41 +6463,21 @@ Get analytics summary for multiple orders at once. Efficient way to retrieve sca
6341
6463
  params?: SummaryRequest) → `Promise<CollectionSummaryResponse>`
6342
6464
  Get collection-wide analytics summary across all orders. Returns daily scan counts and admin activity overview. ```typescript // Get all-time collection summary const summary = await order.getCollectionSummary('coll_123') console.log(`Admin activity count: ${summary.adminActivity.count}`) console.log('Scans by day:') summary.scansByDay.forEach(day => { console.log(` ${day.date}: ${day.scanCount} scans`) }) // Get summary for last 30 days const recentSummary = await order.getCollectionSummary('coll_123', { from: '2026-01-08T00:00:00Z', to: '2026-02-08T00:00:00Z' }) ```
6343
6465
 
6344
- **findByBatch**(collectionId: string,
6345
- batchId: string,
6346
- params?: FindOrdersByAttributeParams) → `Promise<FindOrdersByAttributeResponse>`
6347
- Find all orders containing items from a specific batch. Uses indexed queries for fast lookups across order items. ```typescript // Find orders with items from a specific batch const { orders } = await order.findByBatch('coll_123', 'BATCH-2024-001', { includeItems: true, limit: 50 }) // Get unique customers who received this batch const customers = [...new Set(orders.map(o => o.customerId).filter(Boolean))] console.log(`Batch delivered to ${customers.length} customers`) ```
6348
-
6349
6466
  **findOrdersByProduct**(collectionId: string,
6350
6467
  productId: string,
6351
6468
  params?: FindOrdersByAttributeParams) → `Promise<FindOrdersByAttributeResponse>`
6352
6469
  Find all orders containing items from a specific product. Uses indexed queries for fast lookups across order items. ```typescript // Find all orders containing a product const { orders, limit, offset } = await order.findOrdersByProduct('coll_123', 'prod_789', { limit: 100 }) console.log(`Product appears in ${orders.length} orders`) ```
6353
6470
 
6354
- **findByVariant**(collectionId: string,
6355
- variantId: string,
6356
- params?: FindOrdersByAttributeParams) → `Promise<FindOrdersByAttributeResponse>`
6357
- Find all orders containing items from a specific variant. Uses indexed queries for fast lookups across order items. ```typescript // Find orders with a specific variant const { orders } = await order.findByVariant('coll_123', 'var_456', { includeItems: true }) console.log(`Variant ${variantId} in ${orders.length} orders`) ```
6358
-
6359
- **findItemsByBatch**(collectionId: string,
6360
- batchId: string,
6361
- params?: FindItemsByAttributeParams) → `Promise<FindItemsByAttributeResponse>`
6362
- Get individual order items (not full orders) for a specific batch. Returns all matching items with optional order summary. ```typescript // Get items from a batch with order info const { items, count } = await order.findItemsByBatch('coll_123', 'BATCH-2024-001', { includeOrder: true, limit: 100 }) // Group by order status const byStatus = items.reduce((acc, item) => { const status = item.order?.status || 'unknown' acc[status] = (acc[status] || 0) + 1 return acc }, {}) ```
6363
-
6364
6471
  **findItemsByProduct**(collectionId: string,
6365
6472
  productId: string,
6366
6473
  params?: FindItemsByAttributeParams) → `Promise<FindItemsByAttributeResponse>`
6367
6474
  Get individual order items for a specific product. Returns all matching items with optional order summary. ```typescript // Get all items for a product const { items } = await order.findItemsByProduct('coll_123', 'prod_789', { includeOrder: true }) console.log(`Product delivered in ${items.length} order items`) ```
6368
6475
 
6369
- **findItemsByVariant**(collectionId: string,
6370
- variantId: string,
6371
- params?: FindItemsByAttributeParams) → `Promise<FindItemsByAttributeResponse>`
6372
- Get individual order items for a specific variant. Returns all matching items with optional order summary. ```typescript // Get variant items with order details const { items, count } = await order.findItemsByVariant('coll_123', 'var_456', { includeOrder: true, limit: 50 }) ```
6373
-
6374
6476
  **getOrderIdsByAttribute**(collectionId: string,
6375
- attribute: 'batchId' | 'productId' | 'variantId',
6477
+ attribute: 'productId',
6376
6478
  value: string,
6377
6479
  params?: GetOrderIdsParams) → `Promise<GetOrderIdsResponse>`
6378
- Get unique order IDs containing items matching the specified attribute. Lightweight query that only returns order IDs, not full order objects. ```typescript // Get order IDs for a batch (fast count) const { orderIds, count } = await order.getOrderIdsByAttribute( 'coll_123', 'batchId', 'BATCH-2024-001' ) console.log(`Batch appears in ${count} orders`) // Get order IDs for a product const productOrders = await order.getOrderIdsByAttribute( 'coll_123', 'productId', 'prod_789', { limit: 500 } ) ```
6480
+ Get unique order IDs containing items for a specific product. Lightweight query that only returns order IDs, not full order objects. ```typescript // Get order IDs for a product const productOrders = await order.getOrderIdsByAttribute( 'coll_123', 'productId', 'prod_789', { limit: 500 } ) ```
6379
6481
 
6380
6482
  ### product
6381
6483