@proveanything/smartlinks 1.8.12 → 1.9.0

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.
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.8.12 | Generated: 2026-03-22T11:27:19.142Z
3
+ Version: 1.9.0 | Generated: 2026-03-22T15:51:25.814Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -101,10 +101,12 @@ The Smartlinks SDK is organized into the following namespaces:
101
101
  - **attestation** - Functions for attestation operations
102
102
  - **attestations** - Functions for attestations operations
103
103
  - **containers** - Functions for containers operations
104
+ - **facets** - Functions for facets operations
104
105
  - **jobs** - Functions for jobs operations
105
106
  - **journeysAnalytics** - Functions for journeysAnalytics operations
106
107
  - **location** - Functions for location operations
107
108
  - **order** - Functions for order operations
109
+ - **products** - Functions for products operations
108
110
  - **realtime** - Functions for realtime operations
109
111
  - **tags** - Functions for tags operations
110
112
  - **template** - Functions for template operations
@@ -161,7 +163,7 @@ Returns true if the SDK currently has any auth credential set (bearer token or A
161
163
  Configure the SDK's built-in in-memory GET cache. The cache is transparent — it sits inside the HTTP layer and requires no changes to your existing API calls. All GET requests benefit automatically. Per-resource rules (collections/products → 1 h, proofs → 30 s, etc.) override this value. in-memory only (`'none'`, default). Ignored in Node.js. fallback, from the original fetch time (default: 7 days). `SmartlinksOfflineError` with stale data instead of propagating the network error. caches on page load/refresh. IndexedDB persists for offline. ```ts // Enable IndexedDB persistence for offline support configureSdkCache({ persistence: 'indexeddb' }) // Disable cache entirely in test environments configureSdkCache({ enabled: false }) // Keep caches across page refreshes (not recommended for production) configureSdkCache({ clearOnPageLoad: false }) ```
162
164
 
163
165
  **invalidateCache**(urlPattern?: string) → `void`
164
- Manually invalidate entries in the SDK's GET cache. *contains* this string is removed. Omit (or pass `undefined`) to wipe the entire cache. ```ts invalidateCache() // clear everything invalidateCache('/collection/abc123') // one specific collection invalidateCache('/product/') // all product responses ```
166
+ Manually invalidate entries in the SDK's GET cache. *contains* this string is removed. Omit (or pass `undefined`) to wipe the entire cache. ```ts invalidateCache() // clear everything invalidateCache('/collection/abc123') // one specific collection invalidateCache('/product/') // all legacy singular product responses invalidateCache('/products/') // all canonical plural product responses ```
165
167
 
166
168
  **proxyUploadFormData**(path: string,
167
169
  formData: FormData,
@@ -4175,6 +4177,194 @@ interface ErrorResponse {
4175
4177
  }
4176
4178
  ```
4177
4179
 
4180
+ ### facets
4181
+
4182
+ **FacetDefinition** (interface)
4183
+ ```typescript
4184
+ interface FacetDefinition {
4185
+ id?: string
4186
+ orgId?: string
4187
+ collectionId?: string | null
4188
+ key: string
4189
+ name: string
4190
+ description?: string | null
4191
+ cardinality?: "single" | "multi"
4192
+ kind?: "system" | "custom"
4193
+ hierarchical?: boolean
4194
+ reserved?: boolean
4195
+ enabled?: boolean
4196
+ sortOrder?: number | null
4197
+ config?: Record<string, JsonValue>
4198
+ createdAt?: string
4199
+ updatedAt?: string
4200
+ deletedAt?: string | null
4201
+ values?: FacetValue[]
4202
+ }
4203
+ ```
4204
+
4205
+ **FacetValue** (interface)
4206
+ ```typescript
4207
+ interface FacetValue {
4208
+ id?: string
4209
+ orgId?: string
4210
+ collectionId?: string | null
4211
+ facetDefinitionId?: string
4212
+ facetKey: string
4213
+ key: string
4214
+ slug?: string | null
4215
+ name: string
4216
+ shortName?: string | null
4217
+ description?: string | null
4218
+ color?: string | null
4219
+ icon?: string | null
4220
+ image?: Record<string, JsonValue> | null
4221
+ metadata?: Record<string, JsonValue>
4222
+ sortOrder?: number | null
4223
+ parentValueId?: string | null
4224
+ parentValueKey?: string | null
4225
+ enabled?: boolean
4226
+ createdAt?: string
4227
+ updatedAt?: string
4228
+ deletedAt?: string | null
4229
+ count?: number
4230
+ }
4231
+ ```
4232
+
4233
+ **FacetDefinitionWriteInput** (interface)
4234
+ ```typescript
4235
+ interface FacetDefinitionWriteInput {
4236
+ key?: string
4237
+ name: string
4238
+ description?: string | null
4239
+ cardinality?: "single" | "multi"
4240
+ kind?: "system" | "custom"
4241
+ hierarchical?: boolean
4242
+ reserved?: boolean
4243
+ enabled?: boolean
4244
+ sortOrder?: number | null
4245
+ config?: Record<string, JsonValue>
4246
+ }
4247
+ ```
4248
+
4249
+ **FacetValueWriteInput** (interface)
4250
+ ```typescript
4251
+ interface FacetValueWriteInput {
4252
+ key?: string
4253
+ slug?: string | null
4254
+ name: string
4255
+ shortName?: string | null
4256
+ description?: string | null
4257
+ color?: string | null
4258
+ icon?: string | null
4259
+ image?: Record<string, JsonValue> | null
4260
+ metadata?: Record<string, JsonValue>
4261
+ sortOrder?: number | null
4262
+ parentValueKey?: string | null
4263
+ enabled?: boolean
4264
+ }
4265
+ ```
4266
+
4267
+ **FacetListResponse** (interface)
4268
+ ```typescript
4269
+ interface FacetListResponse {
4270
+ items: FacetDefinition[]
4271
+ }
4272
+ ```
4273
+
4274
+ **FacetValueListResponse** (interface)
4275
+ ```typescript
4276
+ interface FacetValueListResponse {
4277
+ facet: FacetDefinition
4278
+ items: FacetValue[]
4279
+ }
4280
+ ```
4281
+
4282
+ **FacetValueResponse** (interface)
4283
+ ```typescript
4284
+ interface FacetValueResponse {
4285
+ facet: FacetDefinition
4286
+ item: FacetValue
4287
+ }
4288
+ ```
4289
+
4290
+ **FacetQueryRequest** (interface)
4291
+ ```typescript
4292
+ interface FacetQueryRequest {
4293
+ facetKeys?: string[]
4294
+ includeEmpty?: boolean
4295
+ includeDeleted?: boolean
4296
+ query?: ProductQueryRequest["query"] & {
4297
+ facetEquals?: Record<string, JsonValue | JsonValue[]>
4298
+ }
4299
+ }
4300
+ ```
4301
+
4302
+ **FacetBucket** (interface)
4303
+ ```typescript
4304
+ interface FacetBucket {
4305
+ facetKey: string
4306
+ valueKey: string
4307
+ name?: string
4308
+ count: number
4309
+ }
4310
+ ```
4311
+
4312
+ **FacetQueryResponse** (interface)
4313
+ ```typescript
4314
+ interface FacetQueryResponse {
4315
+ items: Array<{
4316
+ facet: FacetDefinition
4317
+ values: FacetValue[]
4318
+ }>
4319
+ buckets: FacetBucket[]
4320
+ meta?: {
4321
+ source?: "postgres"
4322
+ matchedProducts?: number
4323
+ }
4324
+ }
4325
+ ```
4326
+
4327
+ **FacetListParams** (interface)
4328
+ ```typescript
4329
+ interface FacetListParams {
4330
+ includeValues?: boolean
4331
+ includeDeleted?: boolean
4332
+ kind?: "system" | "custom"
4333
+ reserved?: boolean
4334
+ }
4335
+ ```
4336
+
4337
+ **PublicFacetListParams** (interface)
4338
+ ```typescript
4339
+ interface PublicFacetListParams {
4340
+ includeValues?: boolean
4341
+ }
4342
+ ```
4343
+
4344
+ **FacetGetParams** (interface)
4345
+ ```typescript
4346
+ interface FacetGetParams {
4347
+ includeValues?: boolean
4348
+ includeDeleted?: boolean
4349
+ }
4350
+ ```
4351
+
4352
+ **FacetValueListParams** (interface)
4353
+ ```typescript
4354
+ interface FacetValueListParams {
4355
+ includeDeleted?: boolean
4356
+ }
4357
+ ```
4358
+
4359
+ **FacetValueGetParams** (interface)
4360
+ ```typescript
4361
+ interface FacetValueGetParams {
4362
+ includeDeleted?: boolean
4363
+ }
4364
+ ```
4365
+
4366
+ **FacetValueDefinition** = `FacetValue`
4367
+
4178
4368
  ### iframeResponder
4179
4369
 
4180
4370
  **CachedData** (interface)
@@ -5578,46 +5768,175 @@ interface CollectionSummaryResponse {
5578
5768
 
5579
5769
  ### product
5580
5770
 
5581
- **Product** (interface)
5771
+ **ProductKey** (interface)
5582
5772
  ```typescript
5583
- interface Product {
5584
- id: string
5585
- name: string
5773
+ interface ProductKey {
5586
5774
  collectionId: string
5587
- description: string
5588
- gtin?: string
5775
+ id: string
5776
+ }
5777
+ ```
5778
+
5779
+ **ProductImageThumbnails** (interface)
5780
+ ```typescript
5781
+ interface ProductImageThumbnails {
5782
+ x100?: string
5783
+ x200?: string
5784
+ x512?: string
5785
+ }
5786
+ ```
5787
+
5788
+ **ProductImage** (interface)
5789
+ ```typescript
5790
+ interface ProductImage {
5791
+ id?: string
5792
+ collectionId?: string
5793
+ productId?: string
5794
+ site?: string
5795
+ name?: string
5796
+ cleanName?: string
5797
+ assetType?: string
5589
5798
  type?: string
5590
- * Hero image asset object.
5591
- * When creating/updating, you can pass either:
5592
- * - A full asset object with url and thumbnails
5593
- * - A string URL - the system will automatically fetch and store the image
5594
- heroImage: {
5799
+ url?: string
5800
+ thumbnails?: ProductImageThumbnails
5801
+ contentType?: string
5802
+ size?: string | number
5803
+ hash?: string
5804
+ createdAt?: ISODateString | null
5805
+ updatedAt?: ISODateString | null
5806
+ deletedAt?: ISODateString | null
5807
+ }
5808
+ ```
5809
+
5810
+ **ProductImageUrlInput** (interface)
5811
+ ```typescript
5812
+ interface ProductImageUrlInput {
5595
5813
  url: string
5596
- thumbnails: {
5597
- x100: string
5598
- x200: string
5599
- x512: string
5814
+ }
5815
+ ```
5816
+
5817
+ **AdditionalGtin** (interface)
5818
+ ```typescript
5819
+ interface AdditionalGtin {
5820
+ gtin: string
5821
+ owner?: boolean | null
5822
+ }
5823
+ ```
5824
+
5825
+ **ProductFacetValue** (interface)
5826
+ ```typescript
5827
+ interface ProductFacetValue {
5828
+ id?: string
5829
+ key: string
5830
+ slug?: string
5831
+ name: string
5832
+ shortName?: string
5833
+ description?: string
5834
+ color?: string
5835
+ icon?: string
5836
+ }
5837
+ ```
5838
+
5839
+ **ProductFacetMap** (interface)
5840
+ ```typescript
5841
+ interface ProductFacetMap {
5842
+ [facetKey: string]: ProductFacetValue[]
5843
+ }
5844
+ ```
5845
+
5846
+ **ProductQueryRequest** (interface)
5847
+ ```typescript
5848
+ interface ProductQueryRequest {
5849
+ query?: {
5850
+ search?: string
5851
+ status?: string[]
5852
+ category?: string[]
5853
+ type?: string[]
5854
+ schemaType?: string[]
5855
+ tags?: string[]
5856
+ productIds?: string[]
5857
+ sku?: string
5858
+ gtin?: string
5859
+ updatedAfter?: ISODateString
5860
+ updatedBefore?: ISODateString
5861
+ createdAfter?: ISODateString
5862
+ createdBefore?: ISODateString
5863
+ facetEquals?: Record<string, JsonValue>
5600
5864
  }
5865
+ sort?: Array<{
5866
+ field: string
5867
+ direction: 'asc' | 'desc'
5868
+ }>
5869
+ page?: {
5870
+ limit?: number
5871
+ offset?: number
5872
+ cursor?: string | null
5601
5873
  }
5602
- tags: {
5603
- [tagName: string]: boolean
5604
- } // Flexible map of tags with true/false values
5605
- data: {
5606
- [key: string]: any
5607
- } // Flexible key/value data map
5608
- admin?: {
5609
- allowAutoGenerateClaims?: boolean
5610
- lastSerialId?: number
5611
- [key: string]: any
5874
+ includeDeleted?: boolean
5875
+ }
5876
+ ```
5877
+
5878
+ **ProductWriteInput** (interface)
5879
+ ```typescript
5880
+ interface ProductWriteInput {
5881
+ id?: string
5882
+ name: string
5883
+ description?: string | null
5884
+ gtin?: string | null
5885
+ ownGtin?: boolean | null
5886
+ additionalGtins?: AdditionalGtin[]
5887
+ sku?: string | null
5888
+ schemaType?: string | null
5889
+ type?: string | null
5890
+ category?: string | null
5891
+ label?: string | null
5892
+ status?: string | null
5893
+ sortOrder?: number | null
5894
+ heroImage?: ProductImage | ProductImageUrlInput | string | null
5895
+ facets?: ProductFacetMap
5896
+ tags?: Record<string, boolean>
5897
+ data?: Record<string, JsonValue>
5898
+ admin?: ProductAdminData
5899
+ extra?: Record<string, JsonValue>
5900
+ validCollections?: string[]
5901
+ }
5902
+ ```
5903
+
5904
+ **ProductQueryResponse** (interface)
5905
+ ```typescript
5906
+ interface ProductQueryResponse {
5907
+ items: Product[]
5908
+ page?: {
5909
+ limit?: number
5910
+ offset?: number
5911
+ returned?: number
5912
+ total?: number
5913
+ hasMore?: boolean
5914
+ nextCursor?: string | null
5915
+ }
5916
+ meta?: {
5917
+ apiVersion?: 'v1'
5918
+ mode?: 'canonical-products' | 'legacy-product-compatibility'
5919
+ source?: 'postgres' | 'firestore' | 'compatibility-layer'
5920
+ queryMode?: 'canonical' | 'compatibility'
5921
+ unsupportedFilters?: string[]
5922
+ supportedSortFields?: string[]
5612
5923
  }
5613
5924
  }
5614
5925
  ```
5615
5926
 
5927
+ **JsonPrimitive** = `string | number | boolean | null`
5928
+
5929
+ **JsonValue** = ``
5930
+
5931
+ **ISODateString** = `string`
5932
+
5933
+ **ProductClaimCreateRequestBody** = `Omit<ProductClaimCreateInput, 'collectionId' | 'id'>`
5934
+
5616
5935
  **ProductResponse** = `Product`
5617
5936
 
5618
- **ProductCreateRequest** = `Omit<Product, 'id' | 'collectionId'> & {`
5937
+ **ProductCreateRequest** = `ProductWriteInput`
5619
5938
 
5620
- **ProductUpdateRequest** = `Partial<Omit<Product, 'id' | 'collectionId'>> & {`
5939
+ **ProductUpdateRequest** = `Partial<Omit<ProductWriteInput, 'id'>>`
5621
5940
 
5622
5941
  ### proof
5623
5942
 
@@ -6101,6 +6420,10 @@ type VerifyTokenResponse = {
6101
6420
  }
6102
6421
  ```
6103
6422
 
6423
+ ### products (api)
6424
+
6425
+ **ProductPublicFindParams** = `Record<`
6426
+
6104
6427
  ## API Functions
6105
6428
 
6106
6429
  ### analytics.admin
@@ -7083,6 +7406,67 @@ Update a crate for a collection (admin only). ```typescript const updated = awai
7083
7406
  crateId: string) → `Promise<DeleteCrateResponse>`
7084
7407
  Delete a crate for a collection (admin only). This performs a soft delete. ```typescript await crate.remove('coll_123', 'crate_abc123') ```
7085
7408
 
7409
+ ### facets
7410
+
7411
+ **list**(collectionId: string,
7412
+ params?: FacetListParams) → `Promise<FacetListResponse>`
7413
+
7414
+ **create**(collectionId: string,
7415
+ data: FacetDefinitionWriteInput) → `Promise<FacetDefinition>`
7416
+
7417
+ **get**(collectionId: string,
7418
+ facetKey: string,
7419
+ params?: FacetGetParams) → `Promise<FacetDefinition>`
7420
+
7421
+ **update**(collectionId: string,
7422
+ facetKey: string,
7423
+ data: FacetDefinitionWriteInput) → `Promise<FacetDefinition>`
7424
+
7425
+ **remove**(collectionId: string,
7426
+ facetKey: string) → `Promise<void>`
7427
+
7428
+ **listValues**(collectionId: string,
7429
+ facetKey: string,
7430
+ params?: FacetValueListParams) → `Promise<FacetValueListResponse>`
7431
+
7432
+ **createValue**(collectionId: string,
7433
+ facetKey: string,
7434
+ data: FacetValueWriteInput) → `Promise<FacetValueResponse>`
7435
+
7436
+ **getValue**(collectionId: string,
7437
+ facetKey: string,
7438
+ valueKey: string,
7439
+ params?: FacetValueGetParams) → `Promise<FacetValueResponse>`
7440
+
7441
+ **updateValue**(collectionId: string,
7442
+ facetKey: string,
7443
+ valueKey: string,
7444
+ data: FacetValueWriteInput) → `Promise<FacetValueResponse>`
7445
+
7446
+ **removeValue**(collectionId: string,
7447
+ facetKey: string,
7448
+ valueKey: string) → `Promise<void>`
7449
+
7450
+ **query**(collectionId: string,
7451
+ body: FacetQueryRequest) → `Promise<FacetQueryResponse>`
7452
+
7453
+ **publicList**(collectionId: string,
7454
+ params?: PublicFacetListParams) → `Promise<FacetListResponse>`
7455
+
7456
+ **publicGet**(collectionId: string,
7457
+ facetKey: string,
7458
+ params?: PublicFacetListParams) → `Promise<FacetDefinition>`
7459
+
7460
+ **publicListValues**(collectionId: string,
7461
+ facetKey: string) → `Promise<FacetValueListResponse>`
7462
+
7463
+ **publicGetValue**(collectionId: string,
7464
+ facetKey: string,
7465
+ valueKey: string) → `Promise<FacetValueResponse>`
7466
+
7467
+ **publicQuery**(collectionId: string,
7468
+ body: FacetQueryRequest) → `Promise<FacetQueryResponse>`
7469
+
7086
7470
  ### form
7087
7471
 
7088
7472
  **get**(collectionId: string, formId: string, admin?: boolean) → `Promise<any>`
@@ -7463,17 +7847,119 @@ Update a product for a collection (admin only). The `data` payload is a partial
7463
7847
  productId: string) → `Promise<void>`
7464
7848
  Delete a product for a collection (admin only).
7465
7849
 
7850
+ **query**(collectionId: string,
7851
+ body: ProductQueryRequest) → `Promise<ProductQueryResponse>`
7852
+
7853
+ **find**(collectionId: string,
7854
+ body: ProductQueryRequest) → `Promise<ProductQueryResponse>`
7855
+
7856
+ **publicFind**(collectionId: string,
7857
+ params?: ProductPublicFindParams) → `Promise<ProductResponse[]>`
7858
+
7859
+ **clone**(collectionId: string,
7860
+ productId: string,
7861
+ body: Record<string, JsonValue> = {}) → `Promise<ProductResponse>`
7862
+
7863
+ **listAssets**(collectionId: string,
7864
+ productId: string,
7865
+ admin?: boolean) → `Promise<unknown>`
7866
+
7867
+ **createClaimWindow**(collectionId: string,
7868
+ productId: string,
7869
+ body: Record<string, JsonValue>) → `Promise<unknown>`
7870
+
7871
+ **updateClaimWindow**(collectionId: string,
7872
+ productId: string,
7873
+ claimId: string,
7874
+ body: Record<string, JsonValue>) → `Promise<unknown>`
7875
+
7876
+ **refresh**(collectionId: string,
7877
+ productId: string) → `Promise<ProductResponse>`
7878
+
7466
7879
  **getSN**(collectionId: string,
7467
7880
  productId: string,
7468
7881
  startIndex: number = 0,
7469
- count: number = 10) → `Promise<any>`
7882
+ count: number = 10) → `Promise<unknown>`
7470
7883
  Get serial numbers for a product (admin only).
7471
7884
 
7472
7885
  **lookupSN**(collectionId: string,
7473
7886
  productId: string,
7474
- codeId: string) → `Promise<any>`
7887
+ codeId: string) → `Promise<unknown>`
7475
7888
  Look up a serial number by code for a product (admin only).
7476
7889
 
7890
+ **publicLookupClaim**(collectionId: string,
7891
+ productId: string,
7892
+ claimId: string) → `Promise<unknown>`
7893
+
7894
+ **publicCreateClaim**(collectionId: string,
7895
+ productId: string,
7896
+ body: ProductClaimCreateRequestBody) → `Promise<unknown>`
7897
+
7898
+ ### products
7899
+
7900
+ **get**(collectionId: string,
7901
+ productId: string,
7902
+ admin?: boolean) → `Promise<ProductResponse>`
7903
+
7904
+ **list**(collectionId: string,
7905
+ admin?: boolean) → `Promise<ProductResponse[]>`
7906
+
7907
+ **create**(collectionId: string,
7908
+ data: ProductCreateRequest) → `Promise<ProductResponse>`
7909
+
7910
+ **update**(collectionId: string,
7911
+ productId: string,
7912
+ data: ProductUpdateRequest) → `Promise<ProductResponse>`
7913
+
7914
+ **remove**(collectionId: string,
7915
+ productId: string) → `Promise<void>`
7916
+
7917
+ **query**(collectionId: string,
7918
+ body: ProductQueryRequest) → `Promise<ProductQueryResponse>`
7919
+
7920
+ **find**(collectionId: string,
7921
+ body: ProductQueryRequest | Record<string, JsonValue>) → `Promise<ProductQueryResponse>`
7922
+
7923
+ **publicFind**(collectionId: string,
7924
+ params?: ProductPublicFindParams) → `Promise<ProductResponse[]>`
7925
+
7926
+ **clone**(collectionId: string,
7927
+ productId: string,
7928
+ body: Record<string, JsonValue> = {}) → `Promise<ProductResponse>`
7929
+
7930
+ **listAssets**(collectionId: string,
7931
+ productId: string,
7932
+ admin?: boolean) → `Promise<unknown>`
7933
+
7934
+ **createClaimWindow**(collectionId: string,
7935
+ productId: string,
7936
+ body: Record<string, JsonValue>) → `Promise<unknown>`
7937
+
7938
+ **updateClaimWindow**(collectionId: string,
7939
+ productId: string,
7940
+ claimId: string,
7941
+ body: Record<string, JsonValue>) → `Promise<unknown>`
7942
+
7943
+ **refresh**(collectionId: string,
7944
+ productId: string) → `Promise<ProductResponse>`
7945
+
7946
+ **getSN**(collectionId: string,
7947
+ productId: string,
7948
+ startIndex: number = 0,
7949
+ count: number = 10) → `Promise<unknown>`
7950
+
7951
+ **lookupSN**(collectionId: string,
7952
+ productId: string,
7953
+ codeId: string) → `Promise<unknown>`
7954
+
7955
+ **publicLookupClaim**(collectionId: string,
7956
+ productId: string,
7957
+ claimId: string) → `Promise<unknown>`
7958
+
7959
+ **publicCreateClaim**(collectionId: string,
7960
+ productId: string,
7961
+ body: ProductClaimCreateRequestBody) → `Promise<unknown>`
7962
+
7477
7963
  ### proof
7478
7964
 
7479
7965
  **get**(collectionId: string,