@proveanything/smartlinks 1.7.9 → 1.7.10

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.
@@ -252,13 +252,22 @@ export declare namespace order {
252
252
  * includeItems: true
253
253
  * })
254
254
  *
255
- * // Find orders containing a specific product batch
255
+ * // Find orders containing a specific product batch
256
256
  * const batchOrders = await order.query('coll_123', {
257
257
  * query: {
258
- * item: {
259
- * productId: 'prod_789',
260
- * batchId: 'BATCH-2024-001'
261
- * }
258
+ * productId: 'prod_789',
259
+ * batchId: 'BATCH-2024-001'
260
+ * },
261
+ * includeItems: true
262
+ * })
263
+ *
264
+ * // Find an order containing one of several specific items
265
+ * const matched = await order.query('coll_123', {
266
+ * query: {
267
+ * items: [
268
+ * { itemType: 'tag', itemId: 'TAG001' },
269
+ * { itemType: 'serial', itemId: 'SN12345' }
270
+ * ]
262
271
  * },
263
272
  * includeItems: true
264
273
  * })
package/dist/api/order.js CHANGED
@@ -287,9 +287,11 @@ export var order;
287
287
  }
288
288
  order.lookup = lookup;
289
289
  function validateOrderQuery(data) {
290
- var _a;
291
- if (((_a = data.query) === null || _a === void 0 ? void 0 : _a.item) && !data.query.item.productId) {
292
- throw new Error('query.item.productId is required when using item-level order filters');
290
+ const query = data.query;
291
+ if (!query)
292
+ return;
293
+ if ((query.batchId || query.variantId) && !query.productId) {
294
+ throw new Error('query.productId is required when using query.batchId or query.variantId');
293
295
  }
294
296
  }
295
297
  /**
@@ -325,13 +327,22 @@ export var order;
325
327
  * includeItems: true
326
328
  * })
327
329
  *
328
- * // Find orders containing a specific product batch
330
+ * // Find orders containing a specific product batch
329
331
  * const batchOrders = await order.query('coll_123', {
330
332
  * query: {
331
- * item: {
332
- * productId: 'prod_789',
333
- * batchId: 'BATCH-2024-001'
334
- * }
333
+ * productId: 'prod_789',
334
+ * batchId: 'BATCH-2024-001'
335
+ * },
336
+ * includeItems: true
337
+ * })
338
+ *
339
+ * // Find an order containing one of several specific items
340
+ * const matched = await order.query('coll_123', {
341
+ * query: {
342
+ * items: [
343
+ * { itemType: 'tag', itemId: 'TAG001' },
344
+ * { itemType: 'serial', itemId: 'SN12345' }
345
+ * ]
335
346
  * },
336
347
  * includeItems: true
337
348
  * })
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.7.9 | Generated: 2026-03-12T17:26:42.940Z
3
+ Version: 1.7.10 | Generated: 2026-03-12T18:05:02.102Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -4503,38 +4503,34 @@ interface GetOrderItemsResponse {
4503
4503
  }
4504
4504
  ```
4505
4505
 
4506
- **QueryOrderItemFilter** (interface)
4507
- ```typescript
4508
- interface QueryOrderItemFilter {
4509
- productId: string
4510
- batchId?: string
4511
- variantId?: string
4512
- }
4513
- ```
4514
-
4515
- **QueryOrdersFilter** (interface)
4506
+ **QueryOrdersRequest** (interface)
4516
4507
  ```typescript
4517
- interface QueryOrdersFilter {
4508
+ interface QueryOrdersRequest {
4509
+ query?: {
4518
4510
  status?: string
4519
4511
  orderRef?: string
4520
4512
  customerId?: string
4521
- createdAfter?: string // ISO 8601 date
4522
- createdBefore?: string // ISO 8601 date
4523
- updatedAfter?: string // ISO 8601 date
4524
- updatedBefore?: string // ISO 8601 date
4513
+ createdAfter?: string // ISO 8601 date
4514
+ createdBefore?: string // ISO 8601 date
4515
+ updatedAfter?: string // ISO 8601 date
4516
+ updatedBefore?: string // ISO 8601 date
4525
4517
  minItemCount?: number
4526
4518
  maxItemCount?: number
4519
+ productId?: string
4520
+ batchId?: string
4521
+ variantId?: string
4522
+ itemType?: 'tag' | 'proof' | 'serial'
4523
+ itemId?: string
4524
+ itemCollectionId?: string
4525
+ itemMetadata?: Record<string, any>
4526
+ items?: Array<{
4527
+ itemType: 'tag' | 'proof' | 'serial'
4528
+ itemId: string
4529
+ }>
4527
4530
  metadata?: Record<string, any>
4528
- item?: QueryOrderItemFilter
4529
4531
  sortBy?: string
4530
4532
  sortOrder?: 'asc' | 'desc'
4531
- }
4532
- ```
4533
-
4534
- **QueryOrdersRequest** (interface)
4535
- ```typescript
4536
- interface QueryOrdersRequest {
4537
- query?: QueryOrdersFilter
4533
+ }
4538
4534
  limit?: number // Optional: Max results (default: 100)
4539
4535
  offset?: number // Optional: Pagination offset (default: 0)
4540
4536
  includeItems?: boolean // Optional: Include items array (default: false)
@@ -6430,7 +6426,7 @@ Find all orders containing specific items (tags, proofs, or serial numbers). Use
6430
6426
 
6431
6427
  **query**(collectionId: string,
6432
6428
  data: QueryOrdersRequest) → `Promise<QueryOrdersResponse>`
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 }) ```
6429
+ 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: { productId: 'prod_789', batchId: 'BATCH-2024-001' }, includeItems: true }) // Find an order containing one of several specific items const matched = await order.query('coll_123', { query: { items: [ { itemType: 'tag', itemId: 'TAG001' }, { itemType: 'serial', itemId: 'SN12345' } ] }, includeItems: true }) ```
6434
6430
 
6435
6431
  **reports**(collectionId: string,
6436
6432
  params?: ReportsParams) → `Promise<ReportsResponse>`
package/dist/openapi.yaml CHANGED
@@ -15881,20 +15881,12 @@ components:
15881
15881
  - items
15882
15882
  - limit
15883
15883
  - offset
15884
- QueryOrderItemFilter:
15885
- type: object
15886
- properties:
15887
- productId:
15888
- type: string
15889
- batchId:
15890
- type: string
15891
- variantId:
15892
- type: string
15893
- required:
15894
- - productId
15895
- QueryOrdersFilter:
15884
+ QueryOrdersRequest:
15896
15885
  type: object
15897
15886
  properties:
15887
+ query:
15888
+ type: object
15889
+ additionalProperties: true
15898
15890
  status:
15899
15891
  type: string
15900
15892
  orderRef:
@@ -15913,11 +15905,31 @@ components:
15913
15905
  type: number
15914
15906
  maxItemCount:
15915
15907
  type: number
15908
+ productId:
15909
+ type: string
15910
+ batchId:
15911
+ type: string
15912
+ variantId:
15913
+ type: string
15914
+ itemType:
15915
+ type: string
15916
+ enum:
15917
+ - tag
15918
+ - proof
15919
+ - serial
15920
+ itemId:
15921
+ type: string
15922
+ itemCollectionId:
15923
+ type: string
15924
+ itemMetadata:
15925
+ type: object
15926
+ additionalProperties: true
15927
+ items:
15928
+ type: object
15929
+ additionalProperties: true
15916
15930
  metadata:
15917
15931
  type: object
15918
15932
  additionalProperties: true
15919
- item:
15920
- $ref: "#/components/schemas/QueryOrderItemFilter"
15921
15933
  sortBy:
15922
15934
  type: string
15923
15935
  sortOrder:
@@ -15925,17 +15937,15 @@ components:
15925
15937
  enum:
15926
15938
  - asc
15927
15939
  - desc
15928
- QueryOrdersRequest:
15929
- type: object
15930
- properties:
15931
- query:
15932
- $ref: "#/components/schemas/QueryOrdersFilter"
15933
15940
  limit:
15934
15941
  type: number
15935
15942
  offset:
15936
15943
  type: number
15937
15944
  includeItems:
15938
15945
  type: boolean
15946
+ required:
15947
+ - itemType
15948
+ - itemId
15939
15949
  QueryOrdersResponse:
15940
15950
  type: object
15941
15951
  properties:
@@ -175,38 +175,35 @@ 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
- }
205
178
  /**
206
179
  * Request for advanced order querying.
207
180
  */
208
181
  export interface QueryOrdersRequest {
209
- query?: QueryOrdersFilter;
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
+ productId?: string;
193
+ batchId?: string;
194
+ variantId?: string;
195
+ itemType?: 'tag' | 'proof' | 'serial';
196
+ itemId?: string;
197
+ itemCollectionId?: string;
198
+ itemMetadata?: Record<string, any>;
199
+ items?: Array<{
200
+ itemType: 'tag' | 'proof' | 'serial';
201
+ itemId: string;
202
+ }>;
203
+ metadata?: Record<string, any>;
204
+ sortBy?: string;
205
+ sortOrder?: 'asc' | 'desc';
206
+ };
210
207
  limit?: number;
211
208
  offset?: number;
212
209
  includeItems?: boolean;
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.7.9 | Generated: 2026-03-12T17:26:42.940Z
3
+ Version: 1.7.10 | Generated: 2026-03-12T18:05:02.102Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -4503,38 +4503,34 @@ interface GetOrderItemsResponse {
4503
4503
  }
4504
4504
  ```
4505
4505
 
4506
- **QueryOrderItemFilter** (interface)
4507
- ```typescript
4508
- interface QueryOrderItemFilter {
4509
- productId: string
4510
- batchId?: string
4511
- variantId?: string
4512
- }
4513
- ```
4514
-
4515
- **QueryOrdersFilter** (interface)
4506
+ **QueryOrdersRequest** (interface)
4516
4507
  ```typescript
4517
- interface QueryOrdersFilter {
4508
+ interface QueryOrdersRequest {
4509
+ query?: {
4518
4510
  status?: string
4519
4511
  orderRef?: string
4520
4512
  customerId?: string
4521
- createdAfter?: string // ISO 8601 date
4522
- createdBefore?: string // ISO 8601 date
4523
- updatedAfter?: string // ISO 8601 date
4524
- updatedBefore?: string // ISO 8601 date
4513
+ createdAfter?: string // ISO 8601 date
4514
+ createdBefore?: string // ISO 8601 date
4515
+ updatedAfter?: string // ISO 8601 date
4516
+ updatedBefore?: string // ISO 8601 date
4525
4517
  minItemCount?: number
4526
4518
  maxItemCount?: number
4519
+ productId?: string
4520
+ batchId?: string
4521
+ variantId?: string
4522
+ itemType?: 'tag' | 'proof' | 'serial'
4523
+ itemId?: string
4524
+ itemCollectionId?: string
4525
+ itemMetadata?: Record<string, any>
4526
+ items?: Array<{
4527
+ itemType: 'tag' | 'proof' | 'serial'
4528
+ itemId: string
4529
+ }>
4527
4530
  metadata?: Record<string, any>
4528
- item?: QueryOrderItemFilter
4529
4531
  sortBy?: string
4530
4532
  sortOrder?: 'asc' | 'desc'
4531
- }
4532
- ```
4533
-
4534
- **QueryOrdersRequest** (interface)
4535
- ```typescript
4536
- interface QueryOrdersRequest {
4537
- query?: QueryOrdersFilter
4533
+ }
4538
4534
  limit?: number // Optional: Max results (default: 100)
4539
4535
  offset?: number // Optional: Pagination offset (default: 0)
4540
4536
  includeItems?: boolean // Optional: Include items array (default: false)
@@ -6430,7 +6426,7 @@ Find all orders containing specific items (tags, proofs, or serial numbers). Use
6430
6426
 
6431
6427
  **query**(collectionId: string,
6432
6428
  data: QueryOrdersRequest) → `Promise<QueryOrdersResponse>`
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 }) ```
6429
+ 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: { productId: 'prod_789', batchId: 'BATCH-2024-001' }, includeItems: true }) // Find an order containing one of several specific items const matched = await order.query('coll_123', { query: { items: [ { itemType: 'tag', itemId: 'TAG001' }, { itemType: 'serial', itemId: 'SN12345' } ] }, includeItems: true }) ```
6434
6430
 
6435
6431
  **reports**(collectionId: string,
6436
6432
  params?: ReportsParams) → `Promise<ReportsResponse>`
package/openapi.yaml CHANGED
@@ -15881,20 +15881,12 @@ components:
15881
15881
  - items
15882
15882
  - limit
15883
15883
  - offset
15884
- QueryOrderItemFilter:
15885
- type: object
15886
- properties:
15887
- productId:
15888
- type: string
15889
- batchId:
15890
- type: string
15891
- variantId:
15892
- type: string
15893
- required:
15894
- - productId
15895
- QueryOrdersFilter:
15884
+ QueryOrdersRequest:
15896
15885
  type: object
15897
15886
  properties:
15887
+ query:
15888
+ type: object
15889
+ additionalProperties: true
15898
15890
  status:
15899
15891
  type: string
15900
15892
  orderRef:
@@ -15913,11 +15905,31 @@ components:
15913
15905
  type: number
15914
15906
  maxItemCount:
15915
15907
  type: number
15908
+ productId:
15909
+ type: string
15910
+ batchId:
15911
+ type: string
15912
+ variantId:
15913
+ type: string
15914
+ itemType:
15915
+ type: string
15916
+ enum:
15917
+ - tag
15918
+ - proof
15919
+ - serial
15920
+ itemId:
15921
+ type: string
15922
+ itemCollectionId:
15923
+ type: string
15924
+ itemMetadata:
15925
+ type: object
15926
+ additionalProperties: true
15927
+ items:
15928
+ type: object
15929
+ additionalProperties: true
15916
15930
  metadata:
15917
15931
  type: object
15918
15932
  additionalProperties: true
15919
- item:
15920
- $ref: "#/components/schemas/QueryOrderItemFilter"
15921
15933
  sortBy:
15922
15934
  type: string
15923
15935
  sortOrder:
@@ -15925,17 +15937,15 @@ components:
15925
15937
  enum:
15926
15938
  - asc
15927
15939
  - desc
15928
- QueryOrdersRequest:
15929
- type: object
15930
- properties:
15931
- query:
15932
- $ref: "#/components/schemas/QueryOrdersFilter"
15933
15940
  limit:
15934
15941
  type: number
15935
15942
  offset:
15936
15943
  type: number
15937
15944
  includeItems:
15938
15945
  type: boolean
15946
+ required:
15947
+ - itemType
15948
+ - itemId
15939
15949
  QueryOrdersResponse:
15940
15950
  type: object
15941
15951
  properties:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.7.9",
3
+ "version": "1.7.10",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",