@proveanything/smartlinks 2.1.22 → 2.1.24
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/dist/adminCardsView.d.ts +1 -1
- package/dist/adminCardsView.js +70 -55
- package/dist/api/appObjects.d.ts +26 -0
- package/dist/api/appObjects.js +31 -1
- package/dist/api/conditions.d.ts +51 -0
- package/dist/api/conditions.js +57 -0
- package/dist/api/contact.d.ts +23 -0
- package/dist/api/contact.js +30 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/products.d.ts +22 -0
- package/dist/api/products.js +29 -0
- package/dist/api/proof.d.ts +30 -0
- package/dist/api/proof.js +37 -0
- package/dist/docs/API_SUMMARY.md +322 -172
- package/dist/docs/admin-cards.md +1 -1
- package/dist/docs/app-docs.md +73 -0
- package/dist/docs/app-manifest.md +20 -0
- package/dist/docs/standard-query.md +187 -0
- package/dist/docs/utils.md +22 -8
- package/dist/openapi.yaml +462 -0
- package/dist/types/adminCards.d.ts +2 -1
- package/dist/types/appManifest.d.ts +29 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/query.d.ts +121 -0
- package/dist/types/query.js +5 -0
- package/dist/utils/conditions.d.ts +1 -1
- package/dist/utils/conditions.js +21 -6
- package/docs/API_SUMMARY.md +322 -172
- package/docs/admin-cards.md +1 -1
- package/docs/app-docs.md +73 -0
- package/docs/app-manifest.md +20 -0
- package/docs/standard-query.md +187 -0
- package/docs/utils.md +22 -8
- package/openapi.yaml +462 -0
- package/package.json +1 -1
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.24 | Generated: 2026-11-19T13:27:14.982Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -9,6 +9,7 @@ This is a concise summary of all available API functions and types.
|
|
|
9
9
|
For detailed guides on specific features:
|
|
10
10
|
|
|
11
11
|
- **[SmartLinks Microapp Overview](overview.md)** - Platform architecture, data model, auth patterns, storage, anti-patterns, and quick-reference for all SDK docs
|
|
12
|
+
- **[The Standard Query](standard-query.md)** - One request body to filter, sort, page, count, total and follow links, the same on proofs, contacts, products and app records: `proof.query`, `contact.query`, `products.standardQuery`, `app.records.query`
|
|
12
13
|
- **[Assets](assets.md)** - Asset object, AssetRef, upload, replace, soft-delete, restore, bulk-delete, and public token-based uploads
|
|
13
14
|
- **[AI & Chat Completions](ai.md)** - Chat completions, RAG (document-grounded Q&A), voice integration, streaming, tool calling, podcast generation
|
|
14
15
|
- **[Translations](translations.md)** - Runtime translation lookup, browser-side IndexedDB caching, and admin translation management
|
|
@@ -143,6 +144,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
143
144
|
- **attestation** - Functions for attestation operations
|
|
144
145
|
- **attestations** - Functions for attestations operations
|
|
145
146
|
- **bookings** - Functions for bookings operations
|
|
147
|
+
- **conditions** - Functions for conditions operations
|
|
146
148
|
- **config** - Functions for config operations
|
|
147
149
|
- **containers** - Functions for containers operations
|
|
148
150
|
- **errors** - Functions for errors operations
|
|
@@ -538,7 +540,7 @@ interface AdminCardPayload {
|
|
|
538
540
|
trend?: { direction: 'up' | 'down' | 'flat'; label?: string; good?: boolean }
|
|
539
541
|
status?: { tone: 'ok' | 'attention' | 'neutral' | 'error'; text: string }
|
|
540
542
|
progress?: { done: number; total: number; label?: string }
|
|
541
|
-
items?: Array<{ title: string; subtitle?: string; meta?: string; path?: string }>
|
|
543
|
+
items?: Array<{ title: string; subtitle?: string; meta?: string; path?: string; image?: string }>
|
|
542
544
|
todo?: Array<{ text: string; action?: AdminCardAction }>
|
|
543
545
|
actions?: AdminCardAction[]
|
|
544
546
|
empty?: { text: string; action?: AdminCardAction }
|
|
@@ -3206,10 +3208,29 @@ interface AppManifest {
|
|
|
3206
3208
|
headless?: AppHeadlessDeclaration;
|
|
3207
3209
|
connector?: AppConnectorDeclaration;
|
|
3208
3210
|
assistant?: AppAssistantDeclaration;
|
|
3211
|
+
docs?: AppDocsDeclaration;
|
|
3209
3212
|
[key: string]: any;
|
|
3210
3213
|
}
|
|
3211
3214
|
```
|
|
3212
3215
|
|
|
3216
|
+
**AppDocsPage** (interface)
|
|
3217
|
+
```typescript
|
|
3218
|
+
interface AppDocsPage {
|
|
3219
|
+
file: string;
|
|
3220
|
+
title: string;
|
|
3221
|
+
description?: string;
|
|
3222
|
+
audience?: AppDocsAudience;
|
|
3223
|
+
}
|
|
3224
|
+
```
|
|
3225
|
+
|
|
3226
|
+
**AppDocsDeclaration** (interface)
|
|
3227
|
+
```typescript
|
|
3228
|
+
interface AppDocsDeclaration {
|
|
3229
|
+
pages: AppDocsPage[];
|
|
3230
|
+
listed?: boolean;
|
|
3231
|
+
}
|
|
3232
|
+
```
|
|
3233
|
+
|
|
3213
3234
|
**AppAssistantFile** (interface)
|
|
3214
3235
|
```typescript
|
|
3215
3236
|
interface AppAssistantFile {
|
|
@@ -3481,6 +3502,8 @@ interface GetCollectionWidgetsOptions {
|
|
|
3481
3502
|
type ServerFunctionFileInput = { base64: string; contentType: string }
|
|
3482
3503
|
```
|
|
3483
3504
|
|
|
3505
|
+
**AppDocsAudience** = `'team' | 'admin' | 'customer' | 'developer'`
|
|
3506
|
+
|
|
3484
3507
|
### appObjects
|
|
3485
3508
|
|
|
3486
3509
|
**PaginatedResponse<T>** (interface)
|
|
@@ -11364,6 +11387,72 @@ interface QrShortCodeLookupResponse {
|
|
|
11364
11387
|
}
|
|
11365
11388
|
```
|
|
11366
11389
|
|
|
11390
|
+
### query
|
|
11391
|
+
|
|
11392
|
+
**QueryFieldTest** (interface)
|
|
11393
|
+
```typescript
|
|
11394
|
+
interface QueryFieldTest {
|
|
11395
|
+
eq?: QueryValue
|
|
11396
|
+
ne?: QueryValue
|
|
11397
|
+
gt?: QueryValue
|
|
11398
|
+
gte?: QueryValue
|
|
11399
|
+
lt?: QueryValue
|
|
11400
|
+
lte?: QueryValue
|
|
11401
|
+
in?: QueryValue[]
|
|
11402
|
+
nin?: QueryValue[]
|
|
11403
|
+
contains?: string
|
|
11404
|
+
startsWith?: string
|
|
11405
|
+
isNull?: boolean
|
|
11406
|
+
has?: string
|
|
11407
|
+
hasAny?: string[]
|
|
11408
|
+
hasAll?: string[]
|
|
11409
|
+
}
|
|
11410
|
+
```
|
|
11411
|
+
|
|
11412
|
+
**QueryWhere** (interface)
|
|
11413
|
+
```typescript
|
|
11414
|
+
interface QueryWhere {
|
|
11415
|
+
and?: QueryWhere[]
|
|
11416
|
+
or?: QueryWhere[]
|
|
11417
|
+
not?: QueryWhere
|
|
11418
|
+
[field: string]: QueryValue | QueryFieldTest | QueryKeyedTest | QueryWhere | QueryWhere[] | undefined
|
|
11419
|
+
}
|
|
11420
|
+
```
|
|
11421
|
+
|
|
11422
|
+
**StandardQuery** (interface)
|
|
11423
|
+
```typescript
|
|
11424
|
+
interface StandardQuery {
|
|
11425
|
+
where?: QueryWhere
|
|
11426
|
+
orderBy?: Array<Record<string, 'asc' | 'desc'>>
|
|
11427
|
+
limit?: number
|
|
11428
|
+
cursor?: string | null
|
|
11429
|
+
select?: string[]
|
|
11430
|
+
count?: boolean
|
|
11431
|
+
groupBy?: string[]
|
|
11432
|
+
aggregates?: Record<string, QueryAggregate>
|
|
11433
|
+
expand?: string[] | Record<string, string[] | true>
|
|
11434
|
+
}
|
|
11435
|
+
```
|
|
11436
|
+
|
|
11437
|
+
**QueryDescription** (interface)
|
|
11438
|
+
```typescript
|
|
11439
|
+
interface QueryDescription {
|
|
11440
|
+
name: string
|
|
11441
|
+
fields: Record<string, { type: 'string' | 'number' | 'boolean' | 'date' | 'list' | 'keyed' | 'json'; about?: string; can: string[] }>
|
|
11442
|
+
count: boolean
|
|
11443
|
+
aggregates: boolean
|
|
11444
|
+
links: Record<string, { to: string; by: string; about?: string }>
|
|
11445
|
+
limits: { limit: number; groups: number }
|
|
11446
|
+
shape: string
|
|
11447
|
+
}
|
|
11448
|
+
```
|
|
11449
|
+
|
|
11450
|
+
**QueryValue** = `string | number | boolean`
|
|
11451
|
+
|
|
11452
|
+
**QueryKeyedTest** = `Record<string, QueryValue | { eq?: QueryValue`
|
|
11453
|
+
|
|
11454
|
+
**QueryAggregate** = ``
|
|
11455
|
+
|
|
11367
11456
|
### realtime
|
|
11368
11457
|
|
|
11369
11458
|
**RealtimeTokenRequest** (interface)
|
|
@@ -12302,6 +12391,10 @@ type VerifyTokenResponse = {
|
|
|
12302
12391
|
}
|
|
12303
12392
|
```
|
|
12304
12393
|
|
|
12394
|
+
### conditions (api)
|
|
12395
|
+
|
|
12396
|
+
**SaveConditionRequest** = `Omit<SavedCondition, "id" | "deleted">`
|
|
12397
|
+
|
|
12305
12398
|
### functions (api)
|
|
12306
12399
|
|
|
12307
12400
|
**FunctionListEntry** (interface)
|
|
@@ -12674,70 +12767,70 @@ Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when availabl
|
|
|
12674
12767
|
|
|
12675
12768
|
Workflow-oriented app objects for issues, requests, claims, and tasks that move through statuses and often need assignment or history.
|
|
12676
12769
|
|
|
12677
|
-
**create**(collectionId: string,
|
|
12678
|
-
appId: string,
|
|
12679
|
-
input: CreateCaseInput,
|
|
12770
|
+
**create**(collectionId: string,
|
|
12771
|
+
appId: string,
|
|
12772
|
+
input: CreateCaseInput,
|
|
12680
12773
|
admin: boolean = false) → `Promise<AppCase>`
|
|
12681
12774
|
Create a new case POST /cases
|
|
12682
12775
|
|
|
12683
|
-
**list**(collectionId: string,
|
|
12684
|
-
appId: string,
|
|
12685
|
-
params?: CaseListQueryParams,
|
|
12776
|
+
**list**(collectionId: string,
|
|
12777
|
+
appId: string,
|
|
12778
|
+
params?: CaseListQueryParams,
|
|
12686
12779
|
admin: boolean = false) → `Promise<PaginatedResponse<AppCase>>`
|
|
12687
12780
|
List cases with optional query parameters GET /cases
|
|
12688
12781
|
|
|
12689
|
-
**get**(collectionId: string,
|
|
12690
|
-
appId: string,
|
|
12691
|
-
caseId: string,
|
|
12782
|
+
**get**(collectionId: string,
|
|
12783
|
+
appId: string,
|
|
12784
|
+
caseId: string,
|
|
12692
12785
|
admin: boolean = false) → `Promise<AppCase>`
|
|
12693
12786
|
Get a single case by ID GET /cases/:caseId
|
|
12694
12787
|
|
|
12695
|
-
**update**(collectionId: string,
|
|
12696
|
-
appId: string,
|
|
12697
|
-
caseId: string,
|
|
12698
|
-
input: UpdateCaseInput,
|
|
12788
|
+
**update**(collectionId: string,
|
|
12789
|
+
appId: string,
|
|
12790
|
+
caseId: string,
|
|
12791
|
+
input: UpdateCaseInput,
|
|
12699
12792
|
admin: boolean = false) → `Promise<AppCase>`
|
|
12700
12793
|
Update a case PATCH /cases/:caseId Admin can update any field, public (owner) can only update data and owner zones
|
|
12701
12794
|
|
|
12702
|
-
**remove**(collectionId: string,
|
|
12703
|
-
appId: string,
|
|
12704
|
-
caseId: string,
|
|
12795
|
+
**remove**(collectionId: string,
|
|
12796
|
+
appId: string,
|
|
12797
|
+
caseId: string,
|
|
12705
12798
|
admin: boolean = false) → `Promise<`
|
|
12706
12799
|
Soft delete a case DELETE /cases/:caseId
|
|
12707
12800
|
|
|
12708
|
-
**aggregate**(collectionId: string,
|
|
12709
|
-
appId: string,
|
|
12710
|
-
request: AggregateRequest,
|
|
12801
|
+
**aggregate**(collectionId: string,
|
|
12802
|
+
appId: string,
|
|
12803
|
+
request: AggregateRequest,
|
|
12711
12804
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
12712
12805
|
Get aggregate statistics for cases POST /cases/aggregate
|
|
12713
12806
|
|
|
12714
|
-
**summary**(collectionId: string,
|
|
12715
|
-
appId: string,
|
|
12807
|
+
**summary**(collectionId: string,
|
|
12808
|
+
appId: string,
|
|
12716
12809
|
request?: CaseSummaryRequest) → `Promise<CaseSummaryResponse>`
|
|
12717
12810
|
Get case summary (admin only) POST /cases/summary
|
|
12718
12811
|
|
|
12719
|
-
**appendHistory**(collectionId: string,
|
|
12720
|
-
appId: string,
|
|
12721
|
-
caseId: string,
|
|
12812
|
+
**appendHistory**(collectionId: string,
|
|
12813
|
+
appId: string,
|
|
12814
|
+
caseId: string,
|
|
12722
12815
|
input: AppendHistoryInput) → `Promise<AppCase>`
|
|
12723
12816
|
Append an entry to case history (admin only) POST /cases/:caseId/history
|
|
12724
12817
|
|
|
12725
|
-
**related**(collectionId: string,
|
|
12726
|
-
appId: string,
|
|
12818
|
+
**related**(collectionId: string,
|
|
12819
|
+
appId: string,
|
|
12727
12820
|
caseId: string) → `Promise<RelatedResponse>`
|
|
12728
12821
|
Get related threads and records for a case (admin only) GET /cases/:caseId/related
|
|
12729
12822
|
|
|
12730
12823
|
### app.options
|
|
12731
12824
|
|
|
12732
|
-
**get**(collectionId: string,
|
|
12733
|
-
appId: string,
|
|
12734
|
-
source: string,
|
|
12825
|
+
**get**(collectionId: string,
|
|
12826
|
+
appId: string,
|
|
12827
|
+
source: string,
|
|
12735
12828
|
opts: { q?: string; version?: string; admin?: boolean } = {},) → `Promise<import('../types/appOptions').AppOptionsResponse>`
|
|
12736
12829
|
`source` = `type:<record type or declared type id>` | `list:<list id>`. Admins (`admin: true`) see every entry; the public API lists public records and lists the app declares public. Hold on to `version` and pass it back to get `{ unchanged: true }` when nothing changed.
|
|
12737
12830
|
|
|
12738
|
-
**saveList**(collectionId: string,
|
|
12739
|
-
appId: string,
|
|
12740
|
-
listId: string,
|
|
12831
|
+
**saveList**(collectionId: string,
|
|
12832
|
+
appId: string,
|
|
12833
|
+
listId: string,
|
|
12741
12834
|
values: import('../types/appOptions') → `void`
|
|
12742
12835
|
Save a value list's values, in order (admins). Codes never change and are never lost: a value left out stays, switched off, at the end. → the list as saved.
|
|
12743
12836
|
|
|
@@ -12745,84 +12838,92 @@ Save a value list's values, in order (admins). Codes never change and are never
|
|
|
12745
12838
|
|
|
12746
12839
|
General-purpose structured app objects. Use these when a simple scoped data item grows into something queryable, lifecycle-aware, or access-controlled.
|
|
12747
12840
|
|
|
12748
|
-
**create**(collectionId: string,
|
|
12749
|
-
appId: string,
|
|
12750
|
-
input: CreateRecordInput,
|
|
12841
|
+
**create**(collectionId: string,
|
|
12842
|
+
appId: string,
|
|
12843
|
+
input: CreateRecordInput,
|
|
12751
12844
|
admin: boolean = false) → `Promise<CreateRecordResponse>`
|
|
12752
12845
|
Create a new record POST /records When called on the public endpoint (admin = false) with an anonymous caller, and the app's `publicCreate.records.anonymous.edit.editToken` policy is enabled, the response includes a one-time `editToken` string. Store it immediately — it is never returned again.
|
|
12753
12846
|
|
|
12754
|
-
**
|
|
12755
|
-
appId: string,
|
|
12756
|
-
|
|
12847
|
+
**query**(collectionId: string,
|
|
12848
|
+
appId: string,
|
|
12849
|
+
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
12850
|
+
The standard query on an app's records (admin only): filter, sort, page, count and total in one call, reaching into a record's own fields by path, and following a record to its `product` and its `contact`. POST /admin/collection/:collectionId/app/:appId/records/query Fields: id, recordType, ref, status, visibility, customId, productId, variantId, batchId, proofId, contactId, authorId, parentType, parentId, createdAt, updatedAt, startsAt, expiresAt, and the documents data, owner and admin, reached by path: `"data.status"`, `"data.line.name"`. ```typescript // How many work orders by status, and how many units on each await app.records.query(collectionId, appId, { where: { recordType: 'work_order' }, groupBy: ['data.status'], aggregates: { orders: { count: true }, units: { sum: 'data.qty' } }, }) ```
|
|
12851
|
+
|
|
12852
|
+
**queryFields**(collectionId: string, appId: string) → `Promise<QueryDescription>`
|
|
12853
|
+
What a records query can use: its fields, what each can filter, sort, group or total, and its links. GET /admin/collection/:collectionId/app/:appId/records/query
|
|
12854
|
+
|
|
12855
|
+
**list**(collectionId: string,
|
|
12856
|
+
appId: string,
|
|
12857
|
+
params?: RecordListQueryParams,
|
|
12757
12858
|
admin: boolean = false) → `Promise<PaginatedResponse<AppRecord>>`
|
|
12758
12859
|
List records with optional query parameters GET /records Public/owner callers only receive records with `status: "active"`. Admin callers can query all statuses (for example `draft`/`archived`).
|
|
12759
12860
|
|
|
12760
|
-
**get**(collectionId: string,
|
|
12761
|
-
appId: string,
|
|
12762
|
-
recordId: string,
|
|
12861
|
+
**get**(collectionId: string,
|
|
12862
|
+
appId: string,
|
|
12863
|
+
recordId: string,
|
|
12763
12864
|
admin: boolean = false) → `Promise<AppRecord>`
|
|
12764
12865
|
Get a single record by ID GET /records/:recordId
|
|
12765
12866
|
|
|
12766
|
-
**update**(collectionId: string,
|
|
12767
|
-
appId: string,
|
|
12768
|
-
recordId: string,
|
|
12769
|
-
input: UpdateRecordInput,
|
|
12867
|
+
**update**(collectionId: string,
|
|
12868
|
+
appId: string,
|
|
12869
|
+
recordId: string,
|
|
12870
|
+
input: UpdateRecordInput,
|
|
12770
12871
|
admin: boolean = false) → `Promise<AppRecord>`
|
|
12771
12872
|
Update a record PATCH /records/:recordId Admin can update any field, public (owner) can only update data and owner
|
|
12772
12873
|
|
|
12773
|
-
**updateWithToken**(collectionId: string,
|
|
12774
|
-
appId: string,
|
|
12775
|
-
recordId: string,
|
|
12776
|
-
data: Record<string, unknown>,
|
|
12874
|
+
**updateWithToken**(collectionId: string,
|
|
12875
|
+
appId: string,
|
|
12876
|
+
recordId: string,
|
|
12877
|
+
data: Record<string, unknown>,
|
|
12777
12878
|
editToken: string) → `Promise<AppRecord>`
|
|
12778
12879
|
Amend the `data` zone of a record using an anonymous edit token. PATCH /records/:recordId (public endpoint, no auth) This is the follow-up call after an anonymous `create()` that returned an `editToken`. Present the token via `X-Edit-Token` — the server validates it with a constant-time comparison and, if `windowMinutes` is configured in the policy, checks that the token has not expired. **Scope:** only the `data` zone may be modified via this path. `owner`, `admin`, `status`, `visibility`, and indexed fields are immutable to anonymous token holders. ```ts const record = await app.records.create(collectionId, appId, { recordType: 'payment', visibility: 'public', data: { amount: 9900, currency: 'USD' }, }) const { editToken } = record // store this immediately! // Later, once the payment gateway confirms: const updated = await app.records.updateWithToken( collectionId, appId, record.id, { amount: 9900, currency: 'USD', transactionId: 'txn_abc123' }, editToken, ) ``` ### Error codes | HTTP | `errorCode` | Meaning | |------|-----------------------|---------------------------------------------------| | 401 | `UNAUTHORIZED` | No auth token and no `X-Edit-Token` header | | 403 | `FORBIDDEN` | Policy not enabled, or token does not match | | 403 | `EDIT_WINDOW_EXPIRED` | `windowMinutes` elapsed since record creation | | 404 | `NOT_FOUND` | Record does not exist |
|
|
12779
12880
|
|
|
12780
|
-
**remove**(collectionId: string,
|
|
12781
|
-
appId: string,
|
|
12782
|
-
recordId: string,
|
|
12881
|
+
**remove**(collectionId: string,
|
|
12882
|
+
appId: string,
|
|
12883
|
+
recordId: string,
|
|
12783
12884
|
admin: boolean = false) → `Promise<`
|
|
12784
12885
|
Soft delete a record DELETE /records/:recordId
|
|
12785
12886
|
|
|
12786
|
-
**aggregate**(collectionId: string,
|
|
12787
|
-
appId: string,
|
|
12788
|
-
request: AggregateRequest,
|
|
12887
|
+
**aggregate**(collectionId: string,
|
|
12888
|
+
appId: string,
|
|
12889
|
+
request: AggregateRequest,
|
|
12789
12890
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
12790
12891
|
Get aggregate statistics for records POST /records/aggregate
|
|
12791
12892
|
|
|
12792
|
-
**restore**(collectionId: string,
|
|
12793
|
-
appId: string,
|
|
12893
|
+
**restore**(collectionId: string,
|
|
12894
|
+
appId: string,
|
|
12794
12895
|
recordId: string) → `Promise<AppRecord>`
|
|
12795
12896
|
Restore a soft-deleted record. POST /records/:recordId/restore (admin only)
|
|
12796
12897
|
|
|
12797
|
-
**upsert**(collectionId: string,
|
|
12798
|
-
appId: string,
|
|
12898
|
+
**upsert**(collectionId: string,
|
|
12899
|
+
appId: string,
|
|
12799
12900
|
input: UpsertRecordInput) → `Promise<UpsertRecordResponse>`
|
|
12800
12901
|
Upsert a record by ref — creates if no record with that ref exists, otherwise updates. Scope, specificity, and ref are canonicalized on write. POST /records/upsert (admin only)
|
|
12801
12902
|
|
|
12802
|
-
**match**(collectionId: string,
|
|
12803
|
-
appId: string,
|
|
12804
|
-
input: MatchRecordsInput,
|
|
12903
|
+
**match**(collectionId: string,
|
|
12904
|
+
appId: string,
|
|
12905
|
+
input: MatchRecordsInput,
|
|
12805
12906
|
admin: boolean = false) → `Promise<MatchResult>`
|
|
12806
12907
|
Match records against a runtime target scope. Returns records whose scope is satisfied by the target, ordered by specificity descending (most specific first). POST /records/match ```ts const { records, best } = await app.records.match(collectionId, appId, { target: { productId: 'prod_abc', facets: { tier: ['gold'] } }, strategy: 'best', recordType: 'nutrition', }, true); // best.nutrition → the single highest-specificity nutrition record ```
|
|
12807
12908
|
|
|
12808
|
-
**bulkUpsert**(collectionId: string,
|
|
12809
|
-
appId: string,
|
|
12909
|
+
**bulkUpsert**(collectionId: string,
|
|
12910
|
+
appId: string,
|
|
12810
12911
|
records: BulkUpsertItem[]) → `Promise<BulkUpsertResult>`
|
|
12811
12912
|
Upsert up to 500 records in a single transaction. Each row is individually error-isolated — a failure on one row does not abort the others. POST /records/bulk-upsert (admin only)
|
|
12812
12913
|
|
|
12813
|
-
**bulkDelete**(collectionId: string,
|
|
12814
|
-
appId: string,
|
|
12914
|
+
**bulkDelete**(collectionId: string,
|
|
12915
|
+
appId: string,
|
|
12815
12916
|
input: BulkDeleteInput) → `Promise<BulkDeleteResult>`
|
|
12816
12917
|
Soft-delete records in bulk. Supports two modes: - **refs mode**: explicit list of refs (max 1000) - **scope mode**: delete by scope anchor (productId / variantId / etc.) POST /records/bulk-delete (admin only) ```ts // Refs mode await app.records.bulkDelete(collectionId, appId, { refs: ['product:prod_abc', 'product:prod_xyz'], recordType: 'nutrition', }); // Scope mode await app.records.bulkDelete(collectionId, appId, { scope: { productId: 'prod_abc' }, }); ```
|
|
12817
12918
|
|
|
12818
|
-
**resolveAll**(collectionId: string,
|
|
12819
|
-
appId: string,
|
|
12820
|
-
input: ResolveAllParams,
|
|
12919
|
+
**resolveAll**(collectionId: string,
|
|
12920
|
+
appId: string,
|
|
12921
|
+
input: ResolveAllParams,
|
|
12821
12922
|
admin: boolean = false) → `Promise<ResolveAllResult>`
|
|
12822
12923
|
Resolve every applicable record for a product context in one call. Returns records across all tiers (proof, batch, variant, product, rule, facet, collection) deduplicated and sorted by specificity descending. POST /records/resolve-all
|
|
12823
12924
|
|
|
12824
|
-
**previewRule**(collectionId: string,
|
|
12825
|
-
appId: string,
|
|
12925
|
+
**previewRule**(collectionId: string,
|
|
12926
|
+
appId: string,
|
|
12826
12927
|
input: PreviewRuleParams) → `Promise<PreviewRuleResult>`
|
|
12827
12928
|
Preview which products in the collection match a given facetRule. Admin only. Use for live "matches N products" feedback while authoring a rule. POST /records/preview-rule
|
|
12828
12929
|
|
|
@@ -12830,54 +12931,54 @@ Preview which products in the collection match a given facetRule. Admin only. Us
|
|
|
12830
12931
|
|
|
12831
12932
|
Conversation-oriented app objects for comments, discussions, Q&A, and reply-driven experiences.
|
|
12832
12933
|
|
|
12833
|
-
**create**(collectionId: string,
|
|
12834
|
-
appId: string,
|
|
12835
|
-
input: CreateThreadInput,
|
|
12934
|
+
**create**(collectionId: string,
|
|
12935
|
+
appId: string,
|
|
12936
|
+
input: CreateThreadInput,
|
|
12836
12937
|
admin: boolean = false) → `Promise<AppThread>`
|
|
12837
12938
|
Create a new thread POST /threads
|
|
12838
12939
|
|
|
12839
|
-
**list**(collectionId: string,
|
|
12840
|
-
appId: string,
|
|
12841
|
-
params?: ThreadListQueryParams,
|
|
12940
|
+
**list**(collectionId: string,
|
|
12941
|
+
appId: string,
|
|
12942
|
+
params?: ThreadListQueryParams,
|
|
12842
12943
|
admin: boolean = false) → `Promise<PaginatedResponse<AppThread>>`
|
|
12843
12944
|
List threads with optional query parameters GET /threads
|
|
12844
12945
|
|
|
12845
|
-
**get**(collectionId: string,
|
|
12846
|
-
appId: string,
|
|
12847
|
-
threadId: string,
|
|
12946
|
+
**get**(collectionId: string,
|
|
12947
|
+
appId: string,
|
|
12948
|
+
threadId: string,
|
|
12848
12949
|
admin: boolean = false) → `Promise<AppThread>`
|
|
12849
12950
|
Get a single thread by ID GET /threads/:threadId
|
|
12850
12951
|
|
|
12851
|
-
**update**(collectionId: string,
|
|
12852
|
-
appId: string,
|
|
12853
|
-
threadId: string,
|
|
12854
|
-
input: UpdateThreadInput,
|
|
12952
|
+
**update**(collectionId: string,
|
|
12953
|
+
appId: string,
|
|
12954
|
+
threadId: string,
|
|
12955
|
+
input: UpdateThreadInput,
|
|
12855
12956
|
admin: boolean = false) → `Promise<AppThread>`
|
|
12856
12957
|
Update a thread PATCH /threads/:threadId Admin can update any field, public (owner) can only update body, tags, data, owner
|
|
12857
12958
|
|
|
12858
|
-
**remove**(collectionId: string,
|
|
12859
|
-
appId: string,
|
|
12860
|
-
threadId: string,
|
|
12959
|
+
**remove**(collectionId: string,
|
|
12960
|
+
appId: string,
|
|
12961
|
+
threadId: string,
|
|
12861
12962
|
admin: boolean = false) → `Promise<`
|
|
12862
12963
|
Soft delete a thread DELETE /threads/:threadId
|
|
12863
12964
|
|
|
12864
|
-
**reply**(collectionId: string,
|
|
12865
|
-
appId: string,
|
|
12866
|
-
threadId: string,
|
|
12867
|
-
input: ReplyInput,
|
|
12965
|
+
**reply**(collectionId: string,
|
|
12966
|
+
appId: string,
|
|
12967
|
+
threadId: string,
|
|
12968
|
+
input: ReplyInput,
|
|
12868
12969
|
admin: boolean = false) → `Promise<AppThread>`
|
|
12869
12970
|
Add a reply to a thread POST /threads/:threadId/reply Atomically appends to replies array, increments replyCount, updates lastReplyAt
|
|
12870
12971
|
|
|
12871
|
-
**deleteReply**(collectionId: string,
|
|
12872
|
-
appId: string,
|
|
12873
|
-
threadId: string,
|
|
12874
|
-
replyId: string,
|
|
12972
|
+
**deleteReply**(collectionId: string,
|
|
12973
|
+
appId: string,
|
|
12974
|
+
threadId: string,
|
|
12975
|
+
replyId: string,
|
|
12875
12976
|
admin: boolean = false) → `Promise<AppThread>`
|
|
12876
12977
|
Delete a single reply from a thread by its reply id (moderation). DELETE /threads/:threadId/reply/:replyId Authorised for the reply's author, the proof owner, or a collection admin.
|
|
12877
12978
|
|
|
12878
|
-
**aggregate**(collectionId: string,
|
|
12879
|
-
appId: string,
|
|
12880
|
-
request: AggregateRequest,
|
|
12979
|
+
**aggregate**(collectionId: string,
|
|
12980
|
+
appId: string,
|
|
12981
|
+
request: AggregateRequest,
|
|
12881
12982
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
12882
12983
|
Get aggregate statistics for threads POST /threads/aggregate
|
|
12883
12984
|
|
|
@@ -13818,6 +13919,23 @@ Logging: Append a single communication event. POST /admin/collection/:collection
|
|
|
13818
13919
|
body: LogBulkCommunicationEventsBody | ({ sourceId: string; ids: string[]; idField?: 'userId'|'contactId'; [k: string]: any }) → `void`
|
|
13819
13920
|
Logging: Append many communication events for a list of IDs. POST /admin/collection/:collectionId/comm/log/bulk
|
|
13820
13921
|
|
|
13922
|
+
### conditions
|
|
13923
|
+
|
|
13924
|
+
**list**(collectionId: string, admin = false) → `Promise<SavedCondition[]>`
|
|
13925
|
+
Every saved condition in the collection (removed ones left out).
|
|
13926
|
+
|
|
13927
|
+
**get**(collectionId: string, conditionId: string, admin = false) → `Promise<SavedCondition>`
|
|
13928
|
+
One saved condition. Public reads 404 for a removed one; an admin read returns it with `deleted: true`. ```typescript const ukOnly = await conditions.get('coll_123', 'nfCmuWDY') ```
|
|
13929
|
+
|
|
13930
|
+
**create**(collectionId: string, data: SaveConditionRequest) → `Promise<SavedCondition>`
|
|
13931
|
+
Save a new condition (admin). ```typescript const c = await conditions.create('coll_123', { title: 'UK only', type: 'and', conditions: [{ type: 'country', countries: ['GB'], contains: true }], }) ```
|
|
13932
|
+
|
|
13933
|
+
**update**(collectionId: string, conditionId: string, data: Partial<SaveConditionRequest>) → `Promise<SavedCondition>`
|
|
13934
|
+
Change a saved condition (admin). Send the fields to change; `conditions` is replaced whole.
|
|
13935
|
+
|
|
13936
|
+
**remove**(collectionId: string, conditionId: string) → `Promise<SavedCondition>`
|
|
13937
|
+
Remove a saved condition (admin). It's kept, marked deleted, and passes for everyone from then on.
|
|
13938
|
+
|
|
13821
13939
|
### config
|
|
13822
13940
|
|
|
13823
13941
|
**getFields**() → `Promise<FieldDefinition[]>`
|
|
@@ -13828,56 +13946,74 @@ Returns all proof type definitions. Proof types are templates that specify which
|
|
|
13828
13946
|
|
|
13829
13947
|
### contact
|
|
13830
13948
|
|
|
13949
|
+
**query**(collectionId: string,
|
|
13950
|
+
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
13951
|
+
The standard query on contacts (admin only): filter, sort, page, count and total in one call. POST /admin/collection/:collectionId/contacts/query Fields: contactId, userId, firstName, lastName, displayName, company, email, phone, tags, source, locale, createdAt, updatedAt. Email and phone are the contact's main one. Deleted and erased contacts are never returned. ```typescript await contact.query(collectionId, { where: { tags: { hasAny: ['vip', 'trade'] }, createdAt: { gte: '2026-01-01' } }, select: ['contactId', 'firstName', 'email'], count: true, }) await contact.query(collectionId, { groupBy: ['company'], aggregates: { people: { count: true } } }) ```
|
|
13952
|
+
|
|
13953
|
+
**queryFields**(collectionId: string) → `Promise<QueryDescription>`
|
|
13954
|
+
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
13955
|
+
|
|
13831
13956
|
**create**(collectionId: string, data: ContactCreateRequest) → `Promise<ContactResponse>`
|
|
13957
|
+
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
13832
13958
|
|
|
13833
|
-
**list**(collectionId: string,
|
|
13959
|
+
**list**(collectionId: string,
|
|
13834
13960
|
params?: { limit?: number; offset?: number; includeDeleted?: boolean }) → `Promise<ContactListResponse>`
|
|
13835
|
-
|
|
13836
|
-
|
|
13837
|
-
|
|
13838
|
-
|
|
13839
|
-
|
|
13840
|
-
|
|
13841
|
-
|
|
13842
|
-
|
|
13843
|
-
|
|
13844
|
-
|
|
13845
|
-
|
|
13846
|
-
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
|
|
13851
|
-
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13961
|
+
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
13962
|
+
|
|
13963
|
+
**search**({
|
|
13964
|
+
collectionId,
|
|
13965
|
+
q,
|
|
13966
|
+
typeahead,
|
|
13967
|
+
email,
|
|
13968
|
+
phone,
|
|
13969
|
+
id,
|
|
13970
|
+
userId,
|
|
13971
|
+
tags,
|
|
13972
|
+
tagsAll,
|
|
13973
|
+
source,
|
|
13974
|
+
locale,
|
|
13975
|
+
createdFrom,
|
|
13976
|
+
createdTo,
|
|
13977
|
+
externalIdKey,
|
|
13978
|
+
externalIdValue,
|
|
13979
|
+
customFieldKey,
|
|
13980
|
+
customFieldValue,
|
|
13981
|
+
limit,
|
|
13982
|
+
offset,
|
|
13856
13983
|
}: ContactSearchParams) → `Promise<ContactSearchResponse>`
|
|
13984
|
+
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
13857
13985
|
|
|
13858
|
-
**get**(collectionId: string,
|
|
13859
|
-
contactId: string,
|
|
13986
|
+
**get**(collectionId: string,
|
|
13987
|
+
contactId: string,
|
|
13860
13988
|
params?: { includeDeleted?: boolean }) → `Promise<ContactResponse>`
|
|
13989
|
+
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
13861
13990
|
|
|
13862
|
-
**update**(collectionId: string,
|
|
13863
|
-
contactId: string,
|
|
13991
|
+
**update**(collectionId: string,
|
|
13992
|
+
contactId: string,
|
|
13864
13993
|
data: ContactUpdateRequest) → `Promise<ContactResponse>`
|
|
13994
|
+
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
13865
13995
|
|
|
13866
13996
|
**remove**(collectionId: string, contactId: string) → `Promise<void>`
|
|
13997
|
+
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
13867
13998
|
|
|
13868
|
-
**lookup**(collectionId: string,
|
|
13999
|
+
**lookup**(collectionId: string,
|
|
13869
14000
|
params: { email?: string; phone?: string }) → `Promise<ContactResponse>`
|
|
14001
|
+
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
13870
14002
|
|
|
13871
|
-
**upsert**(collectionId: string,
|
|
14003
|
+
**upsert**(collectionId: string,
|
|
13872
14004
|
data: ContactCreateRequest) → `Promise<ContactResponse>`
|
|
14005
|
+
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
13873
14006
|
|
|
13874
|
-
**publicUpsert**(collectionId: string,
|
|
14007
|
+
**publicUpsert**(collectionId: string,
|
|
13875
14008
|
data: PublicContactUpsertRequest) → `Promise<PublicContactUpsertResponse>`
|
|
14009
|
+
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
13876
14010
|
|
|
13877
14011
|
**publicGetMine**(collectionId: string) → `Promise<PublicGetMyContactResponse>`
|
|
14012
|
+
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
13878
14013
|
|
|
13879
|
-
**publicUpdateMine**(collectionId: string,
|
|
14014
|
+
**publicUpdateMine**(collectionId: string,
|
|
13880
14015
|
data: ContactPatch) → `Promise<PublicUpdateMyContactResponse>`
|
|
14016
|
+
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
13881
14017
|
|
|
13882
14018
|
**publicGetSchema**(collectionId: string) → `Promise<ContactSchemaResponse>`
|
|
13883
14019
|
Public: Get the contact schema for a collection. GET /public/collection/:collectionId/contact/schema Returns a ContactSchemaResponse describing all publicly visible contact fields. Core fields and collection-defined custom fields are merged into a single flat schema. Fields not in `publicVisibleFields` are stripped entirely from the response. Fields visible but not in `publicEditableFields` have `ui:disabled: true` in `uiSchema`. Use `fieldOrder` to render fields in the correct sequence, and `evaluateConditions` from the types package to handle conditional field visibility. ```typescript import { contact, evaluateConditions } from '@proveanything/smartlinks' const schema = await contact.publicGetSchema(collectionId) for (const fieldId of schema.fieldOrder) { const property = schema.schema.properties[fieldId] const ui = schema.uiSchema[fieldId] || {} const visible = evaluateConditions(property.conditions, property.showWhen, formValues) const disabled = ui['ui:disabled'] === true if (visible) renderField({ fieldId, property, ui, disabled }) } ```
|
|
@@ -13885,20 +14021,20 @@ Public: Get the contact schema for a collection. GET /public/collection/:collect
|
|
|
13885
14021
|
**erase**(collectionId: string, contactId: string, body?: any) → `Promise<ContactResponse>`
|
|
13886
14022
|
Public: Get the contact schema for a collection. GET /public/collection/:collectionId/contact/schema Returns a ContactSchemaResponse describing all publicly visible contact fields. Core fields and collection-defined custom fields are merged into a single flat schema. Fields not in `publicVisibleFields` are stripped entirely from the response. Fields visible but not in `publicEditableFields` have `ui:disabled: true` in `uiSchema`. Use `fieldOrder` to render fields in the correct sequence, and `evaluateConditions` from the types package to handle conditional field visibility. ```typescript import { contact, evaluateConditions } from '@proveanything/smartlinks' const schema = await contact.publicGetSchema(collectionId) for (const fieldId of schema.fieldOrder) { const property = schema.schema.properties[fieldId] const ui = schema.uiSchema[fieldId] || {} const visible = evaluateConditions(property.conditions, property.showWhen, formValues) const disabled = ui['ui:disabled'] === true if (visible) renderField({ fieldId, property, ui, disabled }) } ```
|
|
13887
14023
|
|
|
13888
|
-
**findDuplicates**(collectionId: string,
|
|
14024
|
+
**findDuplicates**(collectionId: string,
|
|
13889
14025
|
params?: { limit?: number; offset?: number }) → `Promise<ContactDuplicatesResponse>`
|
|
13890
14026
|
Admin: pairs of contacts that look like one person. GET /admin/collection/:collectionId/contacts/duplicates The pattern it finds: someone the collection knew by email first (an import, a list, a form) who later signed in. Their sign-in got a second contact, which could not take the email the first one already held — so one contact has the email and no sign-in, the other the sign-in (and everything they did) and no email. The match is made on the server, on verified addresses only. Checks a window of contacts per call; while `more` is true, call again with `offset` moved on by `scanned`. ```typescript const { pairs } = await contact.findDuplicates(collectionId) for (const pair of pairs) { await contact.merge(collectionId, pair.keep.contactId, pair.merge.contactId) } ```
|
|
13891
14027
|
|
|
13892
|
-
**merge**(collectionId: string,
|
|
13893
|
-
keepContactId: string,
|
|
14028
|
+
**merge**(collectionId: string,
|
|
14029
|
+
keepContactId: string,
|
|
13894
14030
|
fromContactId: string) → `Promise<ContactMergeResponse>`
|
|
13895
14031
|
Admin: fold contact `fromContactId` INTO contact `keepContactId`. POST /admin/collection/:collectionId/contacts/:keepContactId/merge The kept contact gains the other's sign-in, emails and phones, and anything it had no value for; its own values win. Everything recorded against the other contact moves to the kept one. Consent is never loosened: an opt-out on either contact stays an opt-out. The other contact is soft-deleted and marked with `customFields.mergedInto`. Refused (HTTP 409, `error` = a `ContactMergeErrorCode`) when the two have different sign-ins (`LOGIN_CONFLICT`) or are both members of the same loyalty scheme (`LOYALTY_CONFLICT`).
|
|
13896
14032
|
|
|
13897
|
-
**linkLogin**(collectionId: string,
|
|
14033
|
+
**linkLogin**(collectionId: string,
|
|
13898
14034
|
userId: string) → `Promise<ContactLinkLoginResponse>`
|
|
13899
14035
|
Admin: the contact that carries a sign-in, attaching the sign-in first to the contact that already holds its verified email or phone. POST /admin/collection/:collectionId/contacts/link-login For a service about to create a contact for a `userId`: call this first and only create when it throws 404 (`NOTHING_TO_LINK`), so a person the collection already knows by email stays one contact. The address is read from the sign-in itself and must be verified; nothing the caller says about an email is used. Never creates a contact. ```typescript let contactId: string try { contactId = (await contact.linkLogin(collectionId, userId)).contactId } catch (err) { if (err.statusCode !== 404) throw err contactId = (await contact.create(collectionId, { userId, source: 'my-service' })).contactId } ```
|
|
13900
14036
|
|
|
13901
|
-
**getUser**(collectionId: string,
|
|
14037
|
+
**getUser**(collectionId: string,
|
|
13902
14038
|
userId: string,) → `Promise<UserSearchResponse>`
|
|
13903
14039
|
Admin: the contact that carries a sign-in, attaching the sign-in first to the contact that already holds its verified email or phone. POST /admin/collection/:collectionId/contacts/link-login For a service about to create a contact for a `userId`: call this first and only create when it throws 404 (`NOTHING_TO_LINK`), so a person the collection already knows by email stays one contact. The address is read from the sign-in itself and must be verified; nothing the caller says about an email is used. Never creates a contact. ```typescript let contactId: string try { contactId = (await contact.linkLogin(collectionId, userId)).contactId } catch (err) { if (err.statusCode !== 404) throw err contactId = (await contact.create(collectionId, { userId, source: 'my-service' })).contactId } ```
|
|
13904
14040
|
|
|
@@ -14728,76 +14864,90 @@ Look up a serial number by code for a product (admin only).
|
|
|
14728
14864
|
|
|
14729
14865
|
### products
|
|
14730
14866
|
|
|
14731
|
-
**get**(collectionId: string,
|
|
14732
|
-
productId: string,
|
|
14867
|
+
**get**(collectionId: string,
|
|
14868
|
+
productId: string,
|
|
14733
14869
|
admin?: boolean) → `Promise<ProductResponse>`
|
|
14734
14870
|
|
|
14735
|
-
**list**(collectionId: string,
|
|
14871
|
+
**list**(collectionId: string,
|
|
14736
14872
|
admin?: boolean) → `Promise<ProductResponse[]>`
|
|
14737
14873
|
|
|
14738
|
-
**create**(collectionId: string,
|
|
14874
|
+
**create**(collectionId: string,
|
|
14739
14875
|
data: ProductCreateRequest) → `Promise<ProductResponse>`
|
|
14740
14876
|
|
|
14741
|
-
**update**(collectionId: string,
|
|
14742
|
-
productId: string,
|
|
14877
|
+
**update**(collectionId: string,
|
|
14878
|
+
productId: string,
|
|
14743
14879
|
data: ProductUpdateRequest) → `Promise<ProductResponse>`
|
|
14744
14880
|
|
|
14745
|
-
**remove**(collectionId: string,
|
|
14881
|
+
**remove**(collectionId: string,
|
|
14746
14882
|
productId: string) → `Promise<void>`
|
|
14747
14883
|
|
|
14748
|
-
**query**(collectionId: string,
|
|
14749
|
-
body: ProductQueryRequest,
|
|
14884
|
+
**query**(collectionId: string,
|
|
14885
|
+
body: ProductQueryRequest,
|
|
14750
14886
|
admin?: boolean) → `Promise<ProductQueryResponse>`
|
|
14751
14887
|
Query products in a collection with filtering, sorting, and pagination. authenticated admin context). Defaults to `false`, which targets the `/public` endpoint — consistent with `get`, `list`, and `listAssets`. ```typescript // Public query (default) await products.query(collectionId, { query: { search: 'cabernet' } }) // Admin query (authenticated) await products.query(collectionId, { query: { search: 'cabernet' } }, true) ```
|
|
14752
14888
|
|
|
14753
|
-
**
|
|
14754
|
-
|
|
14889
|
+
**standardQuery**(collectionId: string,
|
|
14890
|
+
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
14891
|
+
The standard query on products (admin only): the one query shape every resource is moving to, with counts, totals and filtering by facet. It sits beside `products.query`, whose own body is unchanged. POST /admin/collection/:collectionId/products/standard/query Fields: id, name, description, sku, gtin, schemaType, status, sortOrder, createdAt, updatedAt, facets. Facets are filtered by key: the facet by its key or name, the value by its key or name. ```typescript await products.standardQuery(collectionId, { where: { facets: { brand: 'Breville', category: { in: ['Toasters', 'Kettles'] } }, status: 'active' }, select: ['id', 'name', 'sku'], count: true, }) ```
|
|
14892
|
+
|
|
14893
|
+
**standardQueryFields**(collectionId: string) → `Promise<QueryDescription>`
|
|
14894
|
+
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
14895
|
+
|
|
14896
|
+
**clone**(collectionId: string,
|
|
14897
|
+
productId: string,
|
|
14755
14898
|
body: Record<string, JsonValue> = {}) → `Promise<ProductResponse>`
|
|
14756
|
-
|
|
14899
|
+
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
14757
14900
|
|
|
14758
|
-
**listAssets**(collectionId: string,
|
|
14759
|
-
productId: string,
|
|
14901
|
+
**listAssets**(collectionId: string,
|
|
14902
|
+
productId: string,
|
|
14760
14903
|
admin?: boolean) → `Promise<unknown>`
|
|
14761
|
-
|
|
14904
|
+
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
14762
14905
|
|
|
14763
|
-
**createClaimWindow**(collectionId: string,
|
|
14764
|
-
productId: string,
|
|
14906
|
+
**createClaimWindow**(collectionId: string,
|
|
14907
|
+
productId: string,
|
|
14765
14908
|
body: Record<string, JsonValue>) → `Promise<unknown>`
|
|
14766
|
-
|
|
14909
|
+
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
14767
14910
|
|
|
14768
|
-
**updateClaimWindow**(collectionId: string,
|
|
14769
|
-
productId: string,
|
|
14770
|
-
claimId: string,
|
|
14911
|
+
**updateClaimWindow**(collectionId: string,
|
|
14912
|
+
productId: string,
|
|
14913
|
+
claimId: string,
|
|
14771
14914
|
body: Record<string, JsonValue>) → `Promise<unknown>`
|
|
14772
|
-
|
|
14915
|
+
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
14773
14916
|
|
|
14774
|
-
**refresh**(collectionId: string,
|
|
14917
|
+
**refresh**(collectionId: string,
|
|
14775
14918
|
productId: string) → `Promise<ProductResponse>`
|
|
14776
|
-
|
|
14919
|
+
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
14777
14920
|
|
|
14778
|
-
**getSN**(collectionId: string,
|
|
14779
|
-
productId: string,
|
|
14780
|
-
startIndex: number = 0,
|
|
14921
|
+
**getSN**(collectionId: string,
|
|
14922
|
+
productId: string,
|
|
14923
|
+
startIndex: number = 0,
|
|
14781
14924
|
count: number = 10) → `Promise<unknown>`
|
|
14782
|
-
|
|
14925
|
+
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
14783
14926
|
|
|
14784
|
-
**lookupSN**(collectionId: string,
|
|
14785
|
-
productId: string,
|
|
14927
|
+
**lookupSN**(collectionId: string,
|
|
14928
|
+
productId: string,
|
|
14786
14929
|
codeId: string) → `Promise<unknown>`
|
|
14787
|
-
|
|
14930
|
+
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
14788
14931
|
|
|
14789
|
-
**publicLookupClaim**(collectionId: string,
|
|
14790
|
-
productId: string,
|
|
14932
|
+
**publicLookupClaim**(collectionId: string,
|
|
14933
|
+
productId: string,
|
|
14791
14934
|
claimId: string) → `Promise<unknown>`
|
|
14792
|
-
|
|
14935
|
+
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
14793
14936
|
|
|
14794
|
-
**publicCreateClaim**(collectionId: string,
|
|
14795
|
-
productId: string,
|
|
14937
|
+
**publicCreateClaim**(collectionId: string,
|
|
14938
|
+
productId: string,
|
|
14796
14939
|
body: ProductClaimCreateRequestBody) → `Promise<unknown>`
|
|
14797
|
-
|
|
14940
|
+
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
14798
14941
|
|
|
14799
14942
|
### proof
|
|
14800
14943
|
|
|
14944
|
+
**query**(collectionId: string,
|
|
14945
|
+
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
14946
|
+
The standard query on proofs (admin only): filter, sort, page, count and total a collection's proofs in one call, and follow a proof to its `product` and its `owner` (the owner's contact). POST /admin/collection/:collectionId/proof/query Fields: id, productId, userId (the owner's login id), batchId, variantId, lotId, status, claimable, createdAt, updatedAt. A proof's own values are not returned by this call. ```typescript // How many people own each product await proof.query(collectionId, { where: { userId: { isNull: false } }, groupBy: ['productId'], aggregates: { owners: { countDistinct: 'userId' } }, }) // The most recent owner of a product, with their name await proof.query(collectionId, { where: { productId: 'toaster', userId: { isNull: false } }, orderBy: [{ createdAt: 'desc' }], limit: 1, expand: { owner: ['firstName', 'lastName', 'email'] }, }) ```
|
|
14947
|
+
|
|
14948
|
+
**queryFields**(collectionId: string) → `Promise<QueryDescription>`
|
|
14949
|
+
What a proofs query can use: its fields, what each can filter, sort, group or total, and its links. GET /admin/collection/:collectionId/proof/query
|
|
14950
|
+
|
|
14801
14951
|
**get**(collectionId: string,
|
|
14802
14952
|
productId: string,
|
|
14803
14953
|
proofId: string,
|