@proveanything/smartlinks 1.9.22 → 1.10.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.
- package/dist/api/appObjects.d.ts +61 -1
- package/dist/api/appObjects.js +88 -8
- package/dist/docs/API_SUMMARY.md +162 -4
- package/dist/docs/app-objects.md +266 -2
- package/dist/docs/records-admin-pattern.md +32 -13
- package/dist/docs/ui-utils.md +3 -3
- package/dist/openapi.yaml +1073 -808
- package/dist/types/appObjects.d.ts +223 -2
- package/docs/API_SUMMARY.md +162 -4
- package/docs/app-objects.md +266 -2
- package/docs/records-admin-pattern.md +32 -13
- package/docs/ui-utils.md +3 -3
- package/openapi.yaml +1073 -808
- package/package.json +1 -1
package/dist/api/appObjects.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppCase, CreateCaseInput, UpdateCaseInput, AppendHistoryInput, CaseSummaryRequest, CaseSummaryResponse, CaseListQueryParams, AppThread, CreateThreadInput, UpdateThreadInput, ReplyInput, ThreadListQueryParams, AppRecord, CreateRecordInput, CreateRecordResponse, UpdateRecordInput, RecordListQueryParams, PaginatedResponse, AggregateRequest, AggregateResponse, RelatedResponse } from '../types/appObjects';
|
|
1
|
+
import type { AppCase, CreateCaseInput, UpdateCaseInput, AppendHistoryInput, CaseSummaryRequest, CaseSummaryResponse, CaseListQueryParams, AppThread, CreateThreadInput, UpdateThreadInput, ReplyInput, ThreadListQueryParams, AppRecord, CreateRecordInput, CreateRecordResponse, UpdateRecordInput, UpsertRecordInput, UpsertRecordResponse, MatchRecordsInput, MatchResult, BulkUpsertItem, BulkUpsertResult, BulkDeleteResult, BulkDeleteInput, RecordListQueryParams, PaginatedResponse, AggregateRequest, AggregateResponse, RelatedResponse } from '../types/appObjects';
|
|
2
2
|
export declare namespace app {
|
|
3
3
|
namespace cases {
|
|
4
4
|
/**
|
|
@@ -179,5 +179,65 @@ export declare namespace app {
|
|
|
179
179
|
* POST /records/aggregate
|
|
180
180
|
*/
|
|
181
181
|
function aggregate(collectionId: string, appId: string, request: AggregateRequest, admin?: boolean): Promise<AggregateResponse>;
|
|
182
|
+
/**
|
|
183
|
+
* Restore a soft-deleted record.
|
|
184
|
+
* POST /records/:recordId/restore (admin only)
|
|
185
|
+
*/
|
|
186
|
+
function restore(collectionId: string, appId: string, recordId: string): Promise<AppRecord>;
|
|
187
|
+
/**
|
|
188
|
+
* Upsert a record by ref — creates if no record with that ref exists,
|
|
189
|
+
* otherwise updates. Scope, specificity, and ref are canonicalized on write.
|
|
190
|
+
* POST /records/upsert (admin only)
|
|
191
|
+
*/
|
|
192
|
+
function upsert(collectionId: string, appId: string, input: UpsertRecordInput): Promise<UpsertRecordResponse>;
|
|
193
|
+
/**
|
|
194
|
+
* Match records against a runtime target scope.
|
|
195
|
+
* Returns records whose scope is satisfied by the target,
|
|
196
|
+
* ordered by specificity descending (most specific first).
|
|
197
|
+
* POST /records/match
|
|
198
|
+
*
|
|
199
|
+
* @param admin - false for public endpoint (visibility-filtered), true for admin
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* const { records, best } = await app.records.match(collectionId, appId, {
|
|
204
|
+
* target: { productId: 'prod_abc', facets: { tier: ['gold'] } },
|
|
205
|
+
* strategy: 'best',
|
|
206
|
+
* recordType: 'nutrition',
|
|
207
|
+
* }, true);
|
|
208
|
+
* // best.nutrition → the single highest-specificity nutrition record
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
function match(collectionId: string, appId: string, input: MatchRecordsInput, admin?: boolean): Promise<MatchResult>;
|
|
212
|
+
/**
|
|
213
|
+
* Upsert up to 500 records in a single transaction.
|
|
214
|
+
* Each row is individually error-isolated — a failure on one row does not
|
|
215
|
+
* abort the others.
|
|
216
|
+
* POST /records/bulk-upsert (admin only)
|
|
217
|
+
*/
|
|
218
|
+
function bulkUpsert(collectionId: string, appId: string, records: BulkUpsertItem[]): Promise<BulkUpsertResult>;
|
|
219
|
+
/**
|
|
220
|
+
* Soft-delete records in bulk.
|
|
221
|
+
* Supports two modes:
|
|
222
|
+
* - **refs mode**: explicit list of refs (max 1000)
|
|
223
|
+
* - **scope mode**: delete by scope anchor (productId / variantId / etc.)
|
|
224
|
+
*
|
|
225
|
+
* POST /records/bulk-delete (admin only)
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* // Refs mode
|
|
230
|
+
* await app.records.bulkDelete(collectionId, appId, {
|
|
231
|
+
* refs: ['product:prod_abc', 'product:prod_xyz'],
|
|
232
|
+
* recordType: 'nutrition',
|
|
233
|
+
* });
|
|
234
|
+
*
|
|
235
|
+
* // Scope mode
|
|
236
|
+
* await app.records.bulkDelete(collectionId, appId, {
|
|
237
|
+
* scope: { productId: 'prod_abc' },
|
|
238
|
+
* });
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
function bulkDelete(collectionId: string, appId: string, input: BulkDeleteInput): Promise<BulkDeleteResult>;
|
|
182
242
|
}
|
|
183
243
|
}
|
package/dist/api/appObjects.js
CHANGED
|
@@ -176,7 +176,7 @@ export var app;
|
|
|
176
176
|
})(threads = app.threads || (app.threads = {}));
|
|
177
177
|
// ==================== RECORDS ====================
|
|
178
178
|
let records;
|
|
179
|
-
(function (
|
|
179
|
+
(function (records_1) {
|
|
180
180
|
/**
|
|
181
181
|
* Build the base path for records endpoints
|
|
182
182
|
*/
|
|
@@ -199,7 +199,7 @@ export var app;
|
|
|
199
199
|
const path = basePath(collectionId, appId, admin);
|
|
200
200
|
return post(path, input);
|
|
201
201
|
}
|
|
202
|
-
|
|
202
|
+
records_1.create = create;
|
|
203
203
|
/**
|
|
204
204
|
* List records with optional query parameters
|
|
205
205
|
* GET /records
|
|
@@ -209,7 +209,7 @@ export var app;
|
|
|
209
209
|
const queryParams = params ? buildQueryString(params) : '';
|
|
210
210
|
return request(`${path}${queryParams}`);
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
records_1.list = list;
|
|
213
213
|
/**
|
|
214
214
|
* Get a single record by ID
|
|
215
215
|
* GET /records/:recordId
|
|
@@ -218,7 +218,7 @@ export var app;
|
|
|
218
218
|
const path = `${basePath(collectionId, appId, admin)}/${encodeURIComponent(recordId)}`;
|
|
219
219
|
return request(path);
|
|
220
220
|
}
|
|
221
|
-
|
|
221
|
+
records_1.get = get;
|
|
222
222
|
/**
|
|
223
223
|
* Update a record
|
|
224
224
|
* PATCH /records/:recordId
|
|
@@ -228,7 +228,7 @@ export var app;
|
|
|
228
228
|
const path = `${basePath(collectionId, appId, admin)}/${encodeURIComponent(recordId)}`;
|
|
229
229
|
return patch(path, input);
|
|
230
230
|
}
|
|
231
|
-
|
|
231
|
+
records_1.update = update;
|
|
232
232
|
/**
|
|
233
233
|
* Amend the `data` zone of a record using an anonymous edit token.
|
|
234
234
|
* PATCH /records/:recordId (public endpoint, no auth)
|
|
@@ -279,7 +279,7 @@ export var app;
|
|
|
279
279
|
const path = `${basePath(collectionId, appId, false)}/${encodeURIComponent(recordId)}`;
|
|
280
280
|
return patch(path, { data }, { 'X-Edit-Token': editToken });
|
|
281
281
|
}
|
|
282
|
-
|
|
282
|
+
records_1.updateWithToken = updateWithToken;
|
|
283
283
|
/**
|
|
284
284
|
* Soft delete a record
|
|
285
285
|
* DELETE /records/:recordId
|
|
@@ -288,7 +288,7 @@ export var app;
|
|
|
288
288
|
const path = `${basePath(collectionId, appId, admin)}/${encodeURIComponent(recordId)}`;
|
|
289
289
|
return del(path);
|
|
290
290
|
}
|
|
291
|
-
|
|
291
|
+
records_1.remove = remove;
|
|
292
292
|
/**
|
|
293
293
|
* Get aggregate statistics for records
|
|
294
294
|
* POST /records/aggregate
|
|
@@ -297,7 +297,87 @@ export var app;
|
|
|
297
297
|
const path = `${basePath(collectionId, appId, admin)}/aggregate`;
|
|
298
298
|
return post(path, request);
|
|
299
299
|
}
|
|
300
|
-
|
|
300
|
+
records_1.aggregate = aggregate;
|
|
301
|
+
/**
|
|
302
|
+
* Restore a soft-deleted record.
|
|
303
|
+
* POST /records/:recordId/restore (admin only)
|
|
304
|
+
*/
|
|
305
|
+
async function restore(collectionId, appId, recordId) {
|
|
306
|
+
const path = `${basePath(collectionId, appId, true)}/${encodeURIComponent(recordId)}/restore`;
|
|
307
|
+
return post(path, {});
|
|
308
|
+
}
|
|
309
|
+
records_1.restore = restore;
|
|
310
|
+
/**
|
|
311
|
+
* Upsert a record by ref — creates if no record with that ref exists,
|
|
312
|
+
* otherwise updates. Scope, specificity, and ref are canonicalized on write.
|
|
313
|
+
* POST /records/upsert (admin only)
|
|
314
|
+
*/
|
|
315
|
+
async function upsert(collectionId, appId, input) {
|
|
316
|
+
const path = `${basePath(collectionId, appId, true)}/upsert`;
|
|
317
|
+
return post(path, input);
|
|
318
|
+
}
|
|
319
|
+
records_1.upsert = upsert;
|
|
320
|
+
/**
|
|
321
|
+
* Match records against a runtime target scope.
|
|
322
|
+
* Returns records whose scope is satisfied by the target,
|
|
323
|
+
* ordered by specificity descending (most specific first).
|
|
324
|
+
* POST /records/match
|
|
325
|
+
*
|
|
326
|
+
* @param admin - false for public endpoint (visibility-filtered), true for admin
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```ts
|
|
330
|
+
* const { records, best } = await app.records.match(collectionId, appId, {
|
|
331
|
+
* target: { productId: 'prod_abc', facets: { tier: ['gold'] } },
|
|
332
|
+
* strategy: 'best',
|
|
333
|
+
* recordType: 'nutrition',
|
|
334
|
+
* }, true);
|
|
335
|
+
* // best.nutrition → the single highest-specificity nutrition record
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
async function match(collectionId, appId, input, admin = false) {
|
|
339
|
+
const path = `${basePath(collectionId, appId, admin)}/match`;
|
|
340
|
+
return post(path, input);
|
|
341
|
+
}
|
|
342
|
+
records_1.match = match;
|
|
343
|
+
/**
|
|
344
|
+
* Upsert up to 500 records in a single transaction.
|
|
345
|
+
* Each row is individually error-isolated — a failure on one row does not
|
|
346
|
+
* abort the others.
|
|
347
|
+
* POST /records/bulk-upsert (admin only)
|
|
348
|
+
*/
|
|
349
|
+
async function bulkUpsert(collectionId, appId, records) {
|
|
350
|
+
const path = `${basePath(collectionId, appId, true)}/bulk-upsert`;
|
|
351
|
+
return post(path, { records });
|
|
352
|
+
}
|
|
353
|
+
records_1.bulkUpsert = bulkUpsert;
|
|
354
|
+
/**
|
|
355
|
+
* Soft-delete records in bulk.
|
|
356
|
+
* Supports two modes:
|
|
357
|
+
* - **refs mode**: explicit list of refs (max 1000)
|
|
358
|
+
* - **scope mode**: delete by scope anchor (productId / variantId / etc.)
|
|
359
|
+
*
|
|
360
|
+
* POST /records/bulk-delete (admin only)
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* // Refs mode
|
|
365
|
+
* await app.records.bulkDelete(collectionId, appId, {
|
|
366
|
+
* refs: ['product:prod_abc', 'product:prod_xyz'],
|
|
367
|
+
* recordType: 'nutrition',
|
|
368
|
+
* });
|
|
369
|
+
*
|
|
370
|
+
* // Scope mode
|
|
371
|
+
* await app.records.bulkDelete(collectionId, appId, {
|
|
372
|
+
* scope: { productId: 'prod_abc' },
|
|
373
|
+
* });
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
async function bulkDelete(collectionId, appId, input) {
|
|
377
|
+
const path = `${basePath(collectionId, appId, true)}/bulk-delete`;
|
|
378
|
+
return post(path, input);
|
|
379
|
+
}
|
|
380
|
+
records_1.bulkDelete = bulkDelete;
|
|
301
381
|
})(records = app.records || (app.records = {}));
|
|
302
382
|
})(app || (app = {})); // end namespace app
|
|
303
383
|
// ==================== HELPERS ====================
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.10.0 | Generated: 2026-04-25T13:26:09.113Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -1880,6 +1880,117 @@ interface ReplyInput {
|
|
|
1880
1880
|
}
|
|
1881
1881
|
```
|
|
1882
1882
|
|
|
1883
|
+
**ScopeFacetClause** (interface)
|
|
1884
|
+
```typescript
|
|
1885
|
+
interface ScopeFacetClause {
|
|
1886
|
+
key: string
|
|
1887
|
+
valueKeys: string[]
|
|
1888
|
+
}
|
|
1889
|
+
```
|
|
1890
|
+
|
|
1891
|
+
**RecordScope** (interface)
|
|
1892
|
+
```typescript
|
|
1893
|
+
interface RecordScope {
|
|
1894
|
+
productId?: string
|
|
1895
|
+
variantId?: string
|
|
1896
|
+
proofId?: string
|
|
1897
|
+
batchId?: string
|
|
1898
|
+
* Arbitrary facet clauses.
|
|
1899
|
+
* Clauses are ANDed together; valueKeys within a clause are ORed.
|
|
1900
|
+
facets?: ScopeFacetClause[]
|
|
1901
|
+
}
|
|
1902
|
+
```
|
|
1903
|
+
|
|
1904
|
+
**RecordTarget** (interface)
|
|
1905
|
+
```typescript
|
|
1906
|
+
interface RecordTarget {
|
|
1907
|
+
productId?: string
|
|
1908
|
+
variantId?: string
|
|
1909
|
+
proofId?: string
|
|
1910
|
+
batchId?: string
|
|
1911
|
+
* Facet values the caller possesses, keyed by facet key.
|
|
1912
|
+
* A scope clause is satisfied if ANY of the clause's valueKeys appears here.
|
|
1913
|
+
facets?: Record<string, string[]>
|
|
1914
|
+
}
|
|
1915
|
+
```
|
|
1916
|
+
|
|
1917
|
+
**BulkUpsertItem** (interface)
|
|
1918
|
+
```typescript
|
|
1919
|
+
interface BulkUpsertItem {
|
|
1920
|
+
ref: string
|
|
1921
|
+
recordType?: string
|
|
1922
|
+
customId?: string
|
|
1923
|
+
sourceSystem?: string
|
|
1924
|
+
startsAt?: string | null
|
|
1925
|
+
expiresAt?: string | null
|
|
1926
|
+
status?: string | null
|
|
1927
|
+
scope?: RecordScope
|
|
1928
|
+
data?: Record<string, unknown> | null
|
|
1929
|
+
metadata?: Record<string, unknown> | null
|
|
1930
|
+
}
|
|
1931
|
+
```
|
|
1932
|
+
|
|
1933
|
+
**BulkUpsertResult** (interface)
|
|
1934
|
+
```typescript
|
|
1935
|
+
interface BulkUpsertResult {
|
|
1936
|
+
saved: number
|
|
1937
|
+
failed: number
|
|
1938
|
+
results: Array<
|
|
1939
|
+
| { index: number; status: 'created'; id: string; ref: string; created: true }
|
|
1940
|
+
| { index: number; status: 'updated'; id: string; ref: string; created: false }
|
|
1941
|
+
| { index: number; status: 'error'; error: string }
|
|
1942
|
+
>
|
|
1943
|
+
}
|
|
1944
|
+
```
|
|
1945
|
+
|
|
1946
|
+
**BulkDeleteResult** (interface)
|
|
1947
|
+
```typescript
|
|
1948
|
+
interface BulkDeleteResult {
|
|
1949
|
+
deleted: number
|
|
1950
|
+
}
|
|
1951
|
+
```
|
|
1952
|
+
|
|
1953
|
+
**MatchResult** (interface)
|
|
1954
|
+
```typescript
|
|
1955
|
+
interface MatchResult {
|
|
1956
|
+
records: MatchedRecord[]
|
|
1957
|
+
* Only present when strategy is 'best'.
|
|
1958
|
+
* The single highest-specificity record per recordType.
|
|
1959
|
+
best?: Record<string, MatchedRecord>
|
|
1960
|
+
}
|
|
1961
|
+
```
|
|
1962
|
+
|
|
1963
|
+
**UpsertRecordInput** (interface)
|
|
1964
|
+
```typescript
|
|
1965
|
+
interface UpsertRecordInput {
|
|
1966
|
+
ref: string
|
|
1967
|
+
recordType?: string
|
|
1968
|
+
customId?: string
|
|
1969
|
+
sourceSystem?: string
|
|
1970
|
+
startsAt?: string | null
|
|
1971
|
+
expiresAt?: string | null
|
|
1972
|
+
status?: string | null
|
|
1973
|
+
scope?: RecordScope
|
|
1974
|
+
data?: Record<string, unknown> | null
|
|
1975
|
+
metadata?: Record<string, unknown> | null
|
|
1976
|
+
}
|
|
1977
|
+
```
|
|
1978
|
+
|
|
1979
|
+
**MatchRecordsInput** (interface)
|
|
1980
|
+
```typescript
|
|
1981
|
+
interface MatchRecordsInput {
|
|
1982
|
+
target: RecordTarget
|
|
1983
|
+
* 'all' — return all matching records (default)
|
|
1984
|
+
* 'best' — return the highest-specificity record per recordType
|
|
1985
|
+
strategy?: 'all' | 'best'
|
|
1986
|
+
recordType?: string
|
|
1987
|
+
limit?: number
|
|
1988
|
+
includeScheduled?: boolean
|
|
1989
|
+
includeExpired?: boolean
|
|
1990
|
+
at?: string
|
|
1991
|
+
}
|
|
1992
|
+
```
|
|
1993
|
+
|
|
1883
1994
|
**AppRecord** (interface)
|
|
1884
1995
|
```typescript
|
|
1885
1996
|
interface AppRecord {
|
|
@@ -1888,9 +1999,11 @@ interface AppRecord {
|
|
|
1888
1999
|
collectionId: string
|
|
1889
2000
|
appId: string
|
|
1890
2001
|
visibility: Visibility
|
|
1891
|
-
recordType: string
|
|
2002
|
+
recordType: string | null
|
|
1892
2003
|
ref: string | null
|
|
1893
|
-
|
|
2004
|
+
customId: string | null
|
|
2005
|
+
sourceSystem: string | null
|
|
2006
|
+
status: string | null
|
|
1894
2007
|
productId: string | null
|
|
1895
2008
|
proofId: string | null
|
|
1896
2009
|
contactId: string | null
|
|
@@ -1903,9 +2016,16 @@ interface AppRecord {
|
|
|
1903
2016
|
startsAt: string | null
|
|
1904
2017
|
expiresAt: string | null
|
|
1905
2018
|
deletedAt: string | null // admin only
|
|
2019
|
+
* Structured scope definition. Empty object means universal.
|
|
2020
|
+
* Platform-canonicalized on write (keys sorted, valueKeys deduplicated).
|
|
2021
|
+
scope: RecordScope
|
|
2022
|
+
* Numeric specificity score computed from scope.
|
|
2023
|
+
* Higher = more specific. 0 = universal scope.
|
|
2024
|
+
specificity: number
|
|
1906
2025
|
data: Record<string, unknown>
|
|
1907
2026
|
owner: Record<string, unknown>
|
|
1908
2027
|
admin: Record<string, unknown> // admin only
|
|
2028
|
+
metadata: Record<string, unknown> | null
|
|
1909
2029
|
}
|
|
1910
2030
|
```
|
|
1911
2031
|
|
|
@@ -1914,7 +2034,7 @@ interface AppRecord {
|
|
|
1914
2034
|
interface CreateRecordInput {
|
|
1915
2035
|
recordType: string
|
|
1916
2036
|
visibility?: Visibility // default 'owner'
|
|
1917
|
-
ref?: string
|
|
2037
|
+
ref?: string // derived from scope if omitted and scope provided
|
|
1918
2038
|
status?: string // default 'active'
|
|
1919
2039
|
productId?: string
|
|
1920
2040
|
proofId?: string
|
|
@@ -1925,9 +2045,13 @@ interface CreateRecordInput {
|
|
|
1925
2045
|
parentId?: string
|
|
1926
2046
|
startsAt?: string // ISO 8601
|
|
1927
2047
|
expiresAt?: string
|
|
2048
|
+
scope?: RecordScope
|
|
2049
|
+
customId?: string
|
|
2050
|
+
sourceSystem?: string
|
|
1928
2051
|
data?: Record<string, unknown>
|
|
1929
2052
|
owner?: Record<string, unknown>
|
|
1930
2053
|
admin?: Record<string, unknown> // admin only
|
|
2054
|
+
metadata?: Record<string, unknown>
|
|
1931
2055
|
}
|
|
1932
2056
|
```
|
|
1933
2057
|
|
|
@@ -1943,6 +2067,10 @@ interface UpdateRecordInput {
|
|
|
1943
2067
|
recordType?: string
|
|
1944
2068
|
startsAt?: string
|
|
1945
2069
|
expiresAt?: string
|
|
2070
|
+
scope?: RecordScope
|
|
2071
|
+
customId?: string
|
|
2072
|
+
sourceSystem?: string
|
|
2073
|
+
metadata?: Record<string, unknown>
|
|
1946
2074
|
}
|
|
1947
2075
|
```
|
|
1948
2076
|
|
|
@@ -2010,6 +2138,10 @@ interface PublicCreateBranch {
|
|
|
2010
2138
|
|
|
2011
2139
|
**CallerRole** = `'admin' | 'owner' | 'public'`
|
|
2012
2140
|
|
|
2141
|
+
**BulkDeleteInput** = ``
|
|
2142
|
+
|
|
2143
|
+
**MatchedAtLevel** = ``
|
|
2144
|
+
|
|
2013
2145
|
### asset
|
|
2014
2146
|
|
|
2015
2147
|
**Asset** (interface)
|
|
@@ -7148,6 +7280,32 @@ Soft delete a record DELETE /records/:recordId
|
|
|
7148
7280
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
7149
7281
|
Get aggregate statistics for records POST /records/aggregate
|
|
7150
7282
|
|
|
7283
|
+
**restore**(collectionId: string,
|
|
7284
|
+
appId: string,
|
|
7285
|
+
recordId: string) → `Promise<AppRecord>`
|
|
7286
|
+
Restore a soft-deleted record. POST /records/:recordId/restore (admin only)
|
|
7287
|
+
|
|
7288
|
+
**upsert**(collectionId: string,
|
|
7289
|
+
appId: string,
|
|
7290
|
+
input: UpsertRecordInput) → `Promise<UpsertRecordResponse>`
|
|
7291
|
+
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)
|
|
7292
|
+
|
|
7293
|
+
**match**(collectionId: string,
|
|
7294
|
+
appId: string,
|
|
7295
|
+
input: MatchRecordsInput,
|
|
7296
|
+
admin: boolean = false) → `Promise<MatchResult>`
|
|
7297
|
+
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 ```
|
|
7298
|
+
|
|
7299
|
+
**bulkUpsert**(collectionId: string,
|
|
7300
|
+
appId: string,
|
|
7301
|
+
records: BulkUpsertItem[]) → `Promise<BulkUpsertResult>`
|
|
7302
|
+
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)
|
|
7303
|
+
|
|
7304
|
+
**bulkDelete**(collectionId: string,
|
|
7305
|
+
appId: string,
|
|
7306
|
+
input: BulkDeleteInput) → `Promise<BulkDeleteResult>`
|
|
7307
|
+
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' }, }); ```
|
|
7308
|
+
|
|
7151
7309
|
### app.threads
|
|
7152
7310
|
|
|
7153
7311
|
Conversation-oriented app objects for comments, discussions, Q&A, and reply-driven experiences.
|