@proveanything/smartlinks 3.0.0-alpha.1 → 3.0.0-alpha.2
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/README.md +7 -7
- package/dist/api/analytics.d.ts +5 -4
- package/dist/api/analytics.js +5 -4
- package/dist/api/appConfiguration.d.ts +23 -18
- package/dist/api/appConfiguration.js +24 -18
- package/dist/api/appObjects.d.ts +54 -10
- package/dist/api/appObjects.js +75 -40
- package/dist/api/asset.d.ts +28 -22
- package/dist/api/asset.js +45 -56
- package/dist/api/attestation.d.ts +11 -3
- package/dist/api/attestation.js +12 -3
- package/dist/api/attestations.d.ts +12 -8
- package/dist/api/attestations.js +18 -21
- package/dist/api/authKit.d.ts +15 -10
- package/dist/api/authKit.js +17 -11
- package/dist/api/batch.d.ts +36 -25
- package/dist/api/batch.js +46 -39
- package/dist/api/bookings.d.ts +18 -9
- package/dist/api/bookings.js +23 -13
- package/dist/api/broadcasts.js +3 -17
- package/dist/api/claimSet.d.ts +26 -12
- package/dist/api/claimSet.js +32 -24
- package/dist/api/collection.d.ts +15 -10
- package/dist/api/collection.js +17 -11
- package/dist/api/comms.d.ts +12 -6
- package/dist/api/comms.js +12 -6
- package/dist/api/conditions.d.ts +7 -6
- package/dist/api/conditions.js +8 -6
- package/dist/api/contact.d.ts +6 -2
- package/dist/api/contact.js +25 -60
- package/dist/api/containers.d.ts +14 -10
- package/dist/api/containers.js +19 -14
- package/dist/api/crate.js +7 -9
- package/dist/api/dpp.d.ts +20 -13
- package/dist/api/dpp.js +23 -15
- package/dist/api/facets.d.ts +38 -13
- package/dist/api/facets.js +40 -15
- package/dist/api/files.d.ts +5 -2
- package/dist/api/files.js +7 -4
- package/dist/api/form.d.ts +8 -5
- package/dist/api/form.js +9 -5
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +0 -1
- package/dist/api/integrations.d.ts +29 -17
- package/dist/api/integrations.js +32 -25
- package/dist/api/interactions.d.ts +11 -6
- package/dist/api/interactions.js +14 -23
- package/dist/api/jobs.d.ts +16 -6
- package/dist/api/jobs.js +30 -20
- package/dist/api/journeys.js +2 -14
- package/dist/api/journeysAnalytics.d.ts +8 -5
- package/dist/api/journeysAnalytics.js +8 -5
- package/dist/api/knowledge.d.ts +20 -14
- package/dist/api/knowledge.js +22 -15
- package/dist/api/location.d.ts +6 -3
- package/dist/api/location.js +8 -22
- package/dist/api/lots.d.ts +9 -5
- package/dist/api/lots.js +22 -26
- package/dist/api/loyalty.d.ts +25 -16
- package/dist/api/loyalty.js +33 -32
- package/dist/api/nfc.d.ts +3 -1
- package/dist/api/nfc.js +3 -1
- package/dist/api/order.d.ts +45 -39
- package/dist/api/order.js +48 -65
- package/dist/api/partner.d.ts +17 -14
- package/dist/api/partner.js +21 -22
- package/dist/api/products.d.ts +35 -12
- package/dist/api/products.js +36 -13
- package/dist/api/proof.d.ts +41 -19
- package/dist/api/proof.js +44 -23
- package/dist/api/segments.js +3 -15
- package/dist/api/serviceAccounts.d.ts +8 -5
- package/dist/api/serviceAccounts.js +9 -6
- package/dist/api/shop.d.ts +7 -5
- package/dist/api/shop.js +13 -19
- package/dist/api/subscriptions.d.ts +12 -10
- package/dist/api/subscriptions.js +17 -25
- package/dist/api/tags.d.ts +23 -20
- package/dist/api/tags.js +40 -52
- package/dist/api/template.d.ts +16 -11
- package/dist/api/template.js +19 -13
- package/dist/api/translations.js +2 -12
- package/dist/api/userGroups.d.ts +26 -16
- package/dist/api/userGroups.js +43 -30
- package/dist/api/variant.d.ts +10 -7
- package/dist/api/variant.js +11 -7
- package/dist/api/wallet.d.ts +14 -11
- package/dist/api/wallet.js +15 -12
- package/dist/docs/API_SUMMARY.md +289 -483
- package/dist/docs/ai.md +15 -15
- package/dist/docs/analytics.md +1 -1
- package/dist/docs/app-objects.md +4 -4
- package/dist/docs/attestations.md +8 -8
- package/dist/docs/contact-search.md +2 -3
- package/dist/docs/knowledge.md +3 -3
- package/dist/docs/lists.md +58 -15
- package/dist/docs/upgrading-to-3.md +238 -136
- package/dist/list.d.ts +12 -0
- package/dist/list.js +59 -0
- package/dist/openapi.yaml +301 -662
- package/dist/types/analytics.d.ts +7 -3
- package/dist/types/appObjects.d.ts +27 -12
- package/dist/types/appOptions.d.ts +2 -2
- package/dist/types/asset.d.ts +5 -6
- package/dist/types/attestations.d.ts +7 -9
- package/dist/types/batch.d.ts +5 -5
- package/dist/types/bookings.d.ts +10 -5
- package/dist/types/comms.d.ts +9 -5
- package/dist/types/contact.d.ts +7 -4
- package/dist/types/containers.d.ts +2 -1
- package/dist/types/facets.d.ts +14 -2
- package/dist/types/files.d.ts +3 -2
- package/dist/types/integrations.d.ts +2 -1
- package/dist/types/interaction.d.ts +15 -7
- package/dist/types/jobs.d.ts +1 -1
- package/dist/types/journeysAnalytics.d.ts +3 -2
- package/dist/types/knowledge.d.ts +6 -3
- package/dist/types/knowledge.js +0 -1
- package/dist/types/list.d.ts +30 -2
- package/dist/types/location.d.ts +7 -2
- package/dist/types/location.js +0 -1
- package/dist/types/lots.d.ts +5 -2
- package/dist/types/lots.js +0 -6
- package/dist/types/order.d.ts +22 -20
- package/dist/types/product.d.ts +28 -11
- package/dist/types/proof.d.ts +7 -8
- package/dist/types/tags.d.ts +5 -3
- package/dist/types/userGroups.d.ts +3 -3
- package/dist/types/userGroups.js +0 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/API_SUMMARY.md +289 -483
- package/docs/ai.md +15 -15
- package/docs/analytics.md +1 -1
- package/docs/app-objects.md +4 -4
- package/docs/attestations.md +8 -8
- package/docs/contact-search.md +2 -3
- package/docs/knowledge.md +3 -3
- package/docs/lists.md +58 -15
- package/docs/upgrading-to-3.md +238 -136
- package/openapi.yaml +301 -662
- package/package.json +1 -1
- package/scripts/lib/upgrade.mjs +216 -60
- package/scripts/upgrade.mjs +33 -10
- package/upgrade/3.json +2731 -2213
package/README.md
CHANGED
|
@@ -136,8 +136,8 @@ import { products } from '@proveanything/smartlinks'
|
|
|
136
136
|
|
|
137
137
|
await products.get(collectionId, productId)
|
|
138
138
|
const { items } = await products.list(collectionId)
|
|
139
|
-
await products.query(collectionId, {
|
|
140
|
-
await products.query(collectionId, {
|
|
139
|
+
await products.query(collectionId, { q: 'cabernet' }) // public
|
|
140
|
+
await products.query(collectionId, { q: 'cabernet' }, true) // admin
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
**AI-powered assistant or setup flow**
|
|
@@ -596,10 +596,10 @@ End-to-end explainer covering comms settings (unsubscribe, types), Web Push regi
|
|
|
596
596
|
### Async jobs
|
|
597
597
|
|
|
598
598
|
```ts
|
|
599
|
-
import {
|
|
599
|
+
import { jobs } from '@proveanything/smartlinks'
|
|
600
600
|
|
|
601
601
|
// Enqueue an async job
|
|
602
|
-
const queued = await
|
|
602
|
+
const queued = await jobs.enqueue('collectionId', {
|
|
603
603
|
task: 'email:daily-digest',
|
|
604
604
|
payload: { segmentId: 'seg_1' },
|
|
605
605
|
priority: 5,
|
|
@@ -607,13 +607,13 @@ const queued = await slAsync.enqueueAsyncJob('collectionId', {
|
|
|
607
607
|
})
|
|
608
608
|
|
|
609
609
|
// Check job status
|
|
610
|
-
const status = await
|
|
610
|
+
const status = await jobs.status('collectionId', queued.id)
|
|
611
611
|
|
|
612
612
|
// List recent jobs
|
|
613
|
-
const recent = await jobs.
|
|
613
|
+
const recent = await jobs.list('collectionId', { state: 'queued', limit: 20 })
|
|
614
614
|
|
|
615
615
|
// Get a single job
|
|
616
|
-
const job = await jobs.
|
|
616
|
+
const job = await jobs.get('collectionId', queued.id)
|
|
617
617
|
```
|
|
618
618
|
|
|
619
619
|
## Browser and React
|
package/dist/api/analytics.d.ts
CHANGED
|
@@ -40,15 +40,16 @@ export declare namespace analytics {
|
|
|
40
40
|
function timeseries(collectionId: string, body: AnalyticsTimeseriesRequest): Promise<AnalyticsTimeseriesResponse>;
|
|
41
41
|
function breakdown(collectionId: string, body: AnalyticsBreakdownRequest): Promise<AnalyticsBreakdownResponse>;
|
|
42
42
|
/**
|
|
43
|
-
* The raw events behind the reports, newest first unless `
|
|
43
|
+
* The raw events behind the reports, newest first unless `orderBy` says otherwise. Returns
|
|
44
44
|
* `{ items, nextCursor, source, sort }`: the event rows are in `items`; `nextCursor` is `null` on
|
|
45
|
-
* the last page. Page with `limit` and `cursor`.
|
|
45
|
+
* the last page. Page with `limit` and `cursor`; the time window is `from` / `to`.
|
|
46
46
|
*
|
|
47
47
|
* @example
|
|
48
48
|
* ```typescript
|
|
49
|
-
*
|
|
49
|
+
* const query = { source: 'events' as const, eventType: 'page_view', from: '2026-11-01T00:00:00Z', limit: 100 }
|
|
50
|
+
* let page = await analytics.admin.events(collectionId, { ...query, orderBy: [{ timestamp: 'asc' }] })
|
|
50
51
|
* while (page.nextCursor) {
|
|
51
|
-
* page = await analytics.admin.events(collectionId, {
|
|
52
|
+
* page = await analytics.admin.events(collectionId, { ...query, orderBy: [{ timestamp: 'asc' }], cursor: page.nextCursor })
|
|
52
53
|
* }
|
|
53
54
|
* ```
|
|
54
55
|
*/
|
package/dist/api/analytics.js
CHANGED
|
@@ -503,15 +503,16 @@ export var analytics;
|
|
|
503
503
|
}
|
|
504
504
|
admin.breakdown = breakdown;
|
|
505
505
|
/**
|
|
506
|
-
* The raw events behind the reports, newest first unless `
|
|
506
|
+
* The raw events behind the reports, newest first unless `orderBy` says otherwise. Returns
|
|
507
507
|
* `{ items, nextCursor, source, sort }`: the event rows are in `items`; `nextCursor` is `null` on
|
|
508
|
-
* the last page. Page with `limit` and `cursor`.
|
|
508
|
+
* the last page. Page with `limit` and `cursor`; the time window is `from` / `to`.
|
|
509
509
|
*
|
|
510
510
|
* @example
|
|
511
511
|
* ```typescript
|
|
512
|
-
*
|
|
512
|
+
* const query = { source: 'events' as const, eventType: 'page_view', from: '2026-11-01T00:00:00Z', limit: 100 }
|
|
513
|
+
* let page = await analytics.admin.events(collectionId, { ...query, orderBy: [{ timestamp: 'asc' }] })
|
|
513
514
|
* while (page.nextCursor) {
|
|
514
|
-
* page = await analytics.admin.events(collectionId, {
|
|
515
|
+
* page = await analytics.admin.events(collectionId, { ...query, orderBy: [{ timestamp: 'asc' }], cursor: page.nextCursor })
|
|
515
516
|
* }
|
|
516
517
|
* ```
|
|
517
518
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CollectionWidgetsResponse, GetCollectionWidgetsOptions } from "../types/appManifest.js";
|
|
2
2
|
import type { AppsConfigResponse } from "../types/collection.js";
|
|
3
|
-
import type { ListResult } from "../types/list.js";
|
|
3
|
+
import type { ListResult, ListOptions } from "../types/list.js";
|
|
4
4
|
import type { GetWidgetInstanceOptions, WidgetInstance, WidgetInstanceSummary, SystemBlock } from "../types/appConfiguration.js";
|
|
5
5
|
/**
|
|
6
6
|
* Options for collection/product-scoped app configuration.
|
|
@@ -48,7 +48,7 @@ export type AppConfigOptions = {
|
|
|
48
48
|
* });
|
|
49
49
|
*
|
|
50
50
|
* // Get all user's data for this app
|
|
51
|
-
* const { items: beds } = await userAppData.list('garden-planner');
|
|
51
|
+
* const { items: beds } = await userAppData.list('garden-planner', { limit: 50 });
|
|
52
52
|
*
|
|
53
53
|
* // Get specific item
|
|
54
54
|
* const bed = await userAppData.get('garden-planner', 'bed-1');
|
|
@@ -99,19 +99,21 @@ export declare namespace userAppData {
|
|
|
99
99
|
*/
|
|
100
100
|
function deleteConfig(appId: string): Promise<void>;
|
|
101
101
|
/**
|
|
102
|
-
* List
|
|
102
|
+
* List the user's data items for an app, a page at a time.
|
|
103
103
|
*
|
|
104
104
|
* @param appId - The app ID
|
|
105
|
-
* @
|
|
106
|
-
*
|
|
105
|
+
* @param options - `limit` (50 unless you say) and `cursor`
|
|
106
|
+
* @returns `{ items, nextCursor }`: the data items are in `items`, each with an `id` field; pass
|
|
107
|
+
* `nextCursor` back as `cursor` for the next page (null on the last).
|
|
107
108
|
*
|
|
108
109
|
* @example
|
|
109
110
|
* ```typescript
|
|
110
|
-
*
|
|
111
|
-
* //
|
|
111
|
+
* let page = await userAppData.list('garden-planner', { limit: 50 });
|
|
112
|
+
* // page.items: [{ id: 'bed-1', name: 'Vegetables', ... }, { id: 'bed-2', ... }]
|
|
113
|
+
* while (page.nextCursor) page = await userAppData.list('garden-planner', { limit: 50, cursor: page.nextCursor });
|
|
112
114
|
* ```
|
|
113
115
|
*/
|
|
114
|
-
function list(appId: string): Promise<ListResult<any>>;
|
|
116
|
+
function list(appId: string, options?: ListOptions): Promise<ListResult<any>>;
|
|
115
117
|
/**
|
|
116
118
|
* Get a specific user data item by ID.
|
|
117
119
|
*
|
|
@@ -286,20 +288,22 @@ export declare namespace appConfiguration {
|
|
|
286
288
|
* visibility, ownership, or relationships, prefer `app.records`, `app.cases`,
|
|
287
289
|
* or `app.threads` instead.
|
|
288
290
|
*
|
|
289
|
-
* @param opts - Options including appId and scope (collectionId, productId, etc.)
|
|
290
|
-
*
|
|
291
|
-
*
|
|
291
|
+
* @param opts - Options including appId and scope (collectionId, productId, etc.), plus paging:
|
|
292
|
+
* `limit` and `cursor`
|
|
293
|
+
* @returns `{ items, nextCursor, count }`: the data items are in `items`, 50 at a time unless you
|
|
294
|
+
* give a `limit` (at most 1000). Pass `nextCursor` back as `cursor` for the next page; `null`
|
|
295
|
+
* means that was the last one.
|
|
292
296
|
*
|
|
293
297
|
* @example
|
|
294
298
|
* ```typescript
|
|
295
|
-
* const {
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* }
|
|
299
|
+
* const scope = { appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123' }
|
|
300
|
+
* let page = await appConfiguration.getData({ ...scope, limit: 100 });
|
|
301
|
+
* while (page.nextCursor) {
|
|
302
|
+
* page = await appConfiguration.getData({ ...scope, limit: 100, cursor: page.nextCursor });
|
|
303
|
+
* }
|
|
300
304
|
* ```
|
|
301
305
|
*/
|
|
302
|
-
function getData(opts: AppConfigOptions): Promise<ListResult<any>>;
|
|
306
|
+
function getData(opts: AppConfigOptions & ListOptions): Promise<ListResult<any>>;
|
|
303
307
|
/**
|
|
304
308
|
* Get a single keyed data item by ID within a scope.
|
|
305
309
|
* This is ideal when you already know the exact ID of a simple scoped document.
|
|
@@ -375,7 +379,8 @@ export declare namespace appConfiguration {
|
|
|
375
379
|
* @param collectionId - The collection ID
|
|
376
380
|
* @param options - Optional settings (force: bypass cache)
|
|
377
381
|
* @returns `{ items, nextCursor }`: one entry per app with a widget, in `items`, with its manifest
|
|
378
|
-
* and bundle files.
|
|
382
|
+
* and bundle files. It always comes back whole: there is no `limit` or `cursor`, and `nextCursor`
|
|
383
|
+
* is always `null`.
|
|
379
384
|
* @throws ErrorResponse if the request fails
|
|
380
385
|
*
|
|
381
386
|
* @example
|
|
@@ -13,6 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
import { request, post, del } from "../http.js";
|
|
14
14
|
import * as cache from "../cache.js";
|
|
15
15
|
import { collection as collectionApi } from "./collection.js";
|
|
16
|
+
import { listQuery } from "../list.js";
|
|
16
17
|
function getWidgetsMap(config) {
|
|
17
18
|
if (!config || typeof config !== 'object' || Array.isArray(config))
|
|
18
19
|
return {};
|
|
@@ -60,7 +61,7 @@ function buildAppPath(opts, type) {
|
|
|
60
61
|
* });
|
|
61
62
|
*
|
|
62
63
|
* // Get all user's data for this app
|
|
63
|
-
* const { items: beds } = await userAppData.list('garden-planner');
|
|
64
|
+
* const { items: beds } = await userAppData.list('garden-planner', { limit: 50 });
|
|
64
65
|
*
|
|
65
66
|
* // Get specific item
|
|
66
67
|
* const bed = await userAppData.get('garden-planner', 'bed-1');
|
|
@@ -124,20 +125,22 @@ export var userAppData;
|
|
|
124
125
|
}
|
|
125
126
|
userAppData.deleteConfig = deleteConfig;
|
|
126
127
|
/**
|
|
127
|
-
* List
|
|
128
|
+
* List the user's data items for an app, a page at a time.
|
|
128
129
|
*
|
|
129
130
|
* @param appId - The app ID
|
|
130
|
-
* @
|
|
131
|
-
*
|
|
131
|
+
* @param options - `limit` (50 unless you say) and `cursor`
|
|
132
|
+
* @returns `{ items, nextCursor }`: the data items are in `items`, each with an `id` field; pass
|
|
133
|
+
* `nextCursor` back as `cursor` for the next page (null on the last).
|
|
132
134
|
*
|
|
133
135
|
* @example
|
|
134
136
|
* ```typescript
|
|
135
|
-
*
|
|
136
|
-
* //
|
|
137
|
+
* let page = await userAppData.list('garden-planner', { limit: 50 });
|
|
138
|
+
* // page.items: [{ id: 'bed-1', name: 'Vegetables', ... }, { id: 'bed-2', ... }]
|
|
139
|
+
* while (page.nextCursor) page = await userAppData.list('garden-planner', { limit: 50, cursor: page.nextCursor });
|
|
137
140
|
* ```
|
|
138
141
|
*/
|
|
139
|
-
async function list(appId) {
|
|
140
|
-
const path = `/public/auth/app/${encodeURIComponent(appId)}/data`;
|
|
142
|
+
async function list(appId, options = {}) {
|
|
143
|
+
const path = `/public/auth/app/${encodeURIComponent(appId)}/data${listQuery(options)}`;
|
|
141
144
|
return request(path);
|
|
142
145
|
}
|
|
143
146
|
userAppData.list = list;
|
|
@@ -368,22 +371,24 @@ export var appConfiguration;
|
|
|
368
371
|
* visibility, ownership, or relationships, prefer `app.records`, `app.cases`,
|
|
369
372
|
* or `app.threads` instead.
|
|
370
373
|
*
|
|
371
|
-
* @param opts - Options including appId and scope (collectionId, productId, etc.)
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
+
* @param opts - Options including appId and scope (collectionId, productId, etc.), plus paging:
|
|
375
|
+
* `limit` and `cursor`
|
|
376
|
+
* @returns `{ items, nextCursor, count }`: the data items are in `items`, 50 at a time unless you
|
|
377
|
+
* give a `limit` (at most 1000). Pass `nextCursor` back as `cursor` for the next page; `null`
|
|
378
|
+
* means that was the last one.
|
|
374
379
|
*
|
|
375
380
|
* @example
|
|
376
381
|
* ```typescript
|
|
377
|
-
* const {
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
* }
|
|
382
|
+
* const scope = { appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123' }
|
|
383
|
+
* let page = await appConfiguration.getData({ ...scope, limit: 100 });
|
|
384
|
+
* while (page.nextCursor) {
|
|
385
|
+
* page = await appConfiguration.getData({ ...scope, limit: 100, cursor: page.nextCursor });
|
|
386
|
+
* }
|
|
382
387
|
* ```
|
|
383
388
|
*/
|
|
384
389
|
async function getData(opts) {
|
|
385
390
|
const path = buildAppPath(opts, "data");
|
|
386
|
-
return request(path);
|
|
391
|
+
return request(`${path}${listQuery({ limit: opts.limit, cursor: opts.cursor })}`);
|
|
387
392
|
}
|
|
388
393
|
appConfiguration.getData = getData;
|
|
389
394
|
/**
|
|
@@ -477,7 +482,8 @@ export var appConfiguration;
|
|
|
477
482
|
* @param collectionId - The collection ID
|
|
478
483
|
* @param options - Optional settings (force: bypass cache)
|
|
479
484
|
* @returns `{ items, nextCursor }`: one entry per app with a widget, in `items`, with its manifest
|
|
480
|
-
* and bundle files.
|
|
485
|
+
* and bundle files. It always comes back whole: there is no `limit` or `cursor`, and `nextCursor`
|
|
486
|
+
* is always `null`.
|
|
481
487
|
* @throws ErrorResponse if the request fails
|
|
482
488
|
*
|
|
483
489
|
* @example
|
package/dist/api/appObjects.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StandardQuery, QueryResult, QueryDescription } from "../types/query.js";
|
|
2
|
-
import type { ListResult } from "../types/list.js";
|
|
2
|
+
import type { ListResult, ListOptions } from "../types/list.js";
|
|
3
3
|
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, ResolveAllParams, ResolveAllResult, PreviewRuleParams, PreviewRuleResult, AggregateRequest, AggregateResponse, RelatedResponse } from '../types/appObjects.js';
|
|
4
4
|
export declare namespace app {
|
|
5
5
|
/**
|
|
@@ -12,16 +12,20 @@ export declare namespace app {
|
|
|
12
12
|
* see every entry; the public API lists public records and lists the app declares public. Hold on
|
|
13
13
|
* to `version` and pass it back to get `{ unchanged: true }` when nothing changed.
|
|
14
14
|
*
|
|
15
|
-
* Returns `{ items, nextCursor, count?, version, mode }`: the entries are in `items`, already sorted
|
|
16
|
-
*
|
|
15
|
+
* Returns `{ items, nextCursor, count?, version, mode }`: the entries are in `items`, already sorted,
|
|
16
|
+
* 50 at a time unless you give a `limit` (at most 1000). Pass `nextCursor` back as `cursor` for the
|
|
17
|
+
* next page; `null` means that was the last one. `q` searches the entries.
|
|
17
18
|
*
|
|
18
19
|
* @example
|
|
19
20
|
* ```typescript
|
|
20
|
-
* const res = await app.options.get(collectionId, appId, 'type:machine', { admin: true })
|
|
21
|
+
* const res = await app.options.get(collectionId, appId, 'type:machine', { admin: true, limit: 200 })
|
|
21
22
|
* if (!res.unchanged) { options = res.items; version = res.version }
|
|
23
|
+
*
|
|
24
|
+
* // A type too large to send whole: search it
|
|
25
|
+
* const found = await app.options.get(collectionId, appId, 'type:machine', { q: 'mix', limit: 20 })
|
|
22
26
|
* ```
|
|
23
27
|
*/
|
|
24
|
-
function get(collectionId: string, appId: string, source: string, opts?: {
|
|
28
|
+
function get(collectionId: string, appId: string, source: string, opts?: ListOptions & {
|
|
25
29
|
q?: string;
|
|
26
30
|
version?: string;
|
|
27
31
|
admin?: boolean;
|
|
@@ -44,6 +48,7 @@ export declare namespace app {
|
|
|
44
48
|
*
|
|
45
49
|
* Returns `{ items, nextCursor, count }`: the cases are in `items`, `count` is how many match in
|
|
46
50
|
* all, and `nextCursor` is `null` on the last page. Page with `limit` and `cursor`.
|
|
51
|
+
* Sort with `orderBy`. A date field (`createdAt`, `updatedAt`, `closedAt`) takes a range: `{ gte, lte }`.
|
|
47
52
|
* `includeDeleted`, `contactId` and `assignedTo` are for admin calls (`admin = true`) only: the
|
|
48
53
|
* public list refuses a parameter it does not read.
|
|
49
54
|
*
|
|
@@ -54,6 +59,12 @@ export declare namespace app {
|
|
|
54
59
|
* while (page.nextCursor) {
|
|
55
60
|
* page = await app.cases.list(collectionId, appId, { status: 'open', limit: 50, cursor: page.nextCursor })
|
|
56
61
|
* }
|
|
62
|
+
*
|
|
63
|
+
* // This month's cases, most urgent first
|
|
64
|
+
* await app.cases.list(collectionId, appId, {
|
|
65
|
+
* createdAt: { gte: '2026-11-01T00:00:00Z', lte: '2026-11-30T23:59:59Z' },
|
|
66
|
+
* orderBy: [{ priority: 'desc' }, { createdAt: 'asc' }],
|
|
67
|
+
* })
|
|
57
68
|
* ```
|
|
58
69
|
*/
|
|
59
70
|
function list(collectionId: string, appId: string, params?: CaseListQueryParams, admin?: boolean): Promise<ListResult<AppCase>>;
|
|
@@ -108,6 +119,7 @@ export declare namespace app {
|
|
|
108
119
|
*
|
|
109
120
|
* Returns `{ items, nextCursor, count }`: the threads are in `items`, `count` is how many match in
|
|
110
121
|
* all, and `nextCursor` is `null` on the last page. Page with `limit` and `cursor`.
|
|
122
|
+
* Sort with `orderBy`. A date field (`createdAt`, `updatedAt`) takes a range: `{ gte, lte }`.
|
|
111
123
|
* `includeDeleted` and `contactId` are for admin calls (`admin = true`) only: the public list
|
|
112
124
|
* refuses a parameter it does not read.
|
|
113
125
|
*
|
|
@@ -118,6 +130,12 @@ export declare namespace app {
|
|
|
118
130
|
* while (page.nextCursor) {
|
|
119
131
|
* page = await app.threads.list(collectionId, appId, { parentType: 'case', parentId: caseId, limit: 50, cursor: page.nextCursor })
|
|
120
132
|
* }
|
|
133
|
+
*
|
|
134
|
+
* // The threads with the newest replies, started this month
|
|
135
|
+
* await app.threads.list(collectionId, appId, {
|
|
136
|
+
* createdAt: { gte: '2026-11-01T00:00:00Z' },
|
|
137
|
+
* orderBy: [{ lastReplyAt: 'desc' }],
|
|
138
|
+
* })
|
|
121
139
|
* ```
|
|
122
140
|
*/
|
|
123
141
|
function list(collectionId: string, appId: string, params?: ThreadListQueryParams, admin?: boolean): Promise<ListResult<AppThread>>;
|
|
@@ -201,6 +219,8 @@ export declare namespace app {
|
|
|
201
219
|
*
|
|
202
220
|
* Returns `{ items, nextCursor, count }`: the records are in `items`, `count` is how many match in
|
|
203
221
|
* all, and `nextCursor` is `null` on the last page. Page with `limit` and `cursor`.
|
|
222
|
+
* Search with `q`, sort with `orderBy`. A date field (`createdAt`, `updatedAt`, `startsAt`,
|
|
223
|
+
* `expiresAt`) takes a range: `{ gte, lte }`.
|
|
204
224
|
*
|
|
205
225
|
* Public/owner callers only receive records with `status: "active"`.
|
|
206
226
|
* Admin callers can query all statuses (for example `draft`/`archived`).
|
|
@@ -214,6 +234,14 @@ export declare namespace app {
|
|
|
214
234
|
* while (page.nextCursor) {
|
|
215
235
|
* page = await app.records.list(collectionId, appId, { recordType: 'tip', limit: 100, cursor: page.nextCursor })
|
|
216
236
|
* }
|
|
237
|
+
*
|
|
238
|
+
* // Tips about watering, changed this month, newest change first
|
|
239
|
+
* await app.records.list(collectionId, appId, {
|
|
240
|
+
* recordType: 'tip',
|
|
241
|
+
* q: 'watering',
|
|
242
|
+
* updatedAt: { gte: '2026-11-01T00:00:00Z' },
|
|
243
|
+
* orderBy: [{ updatedAt: 'desc' }],
|
|
244
|
+
* })
|
|
217
245
|
* ```
|
|
218
246
|
*/
|
|
219
247
|
function list(collectionId: string, appId: string, params?: RecordListQueryParams, admin?: boolean): Promise<ListResult<AppRecord>>;
|
|
@@ -301,8 +329,9 @@ export declare namespace app {
|
|
|
301
329
|
/**
|
|
302
330
|
* Match records against a runtime target scope.
|
|
303
331
|
* Returns `{ items, nextCursor, count, strategy }`: `items` are the records whose scope is satisfied
|
|
304
|
-
* by the target, most specific first, and `count` is how many matched.
|
|
305
|
-
*
|
|
332
|
+
* by the target, most specific first, and `count` is how many matched. Without a `limit` it answers
|
|
333
|
+
* up to 100. Give a `limit` (in `input`) to page: when there are more, pass `nextCursor` back as
|
|
334
|
+
* `cursor`.
|
|
306
335
|
* POST /records/match
|
|
307
336
|
*
|
|
308
337
|
* @param admin - false for public endpoint (visibility-filtered, active-only), true for admin
|
|
@@ -315,6 +344,13 @@ export declare namespace app {
|
|
|
315
344
|
* recordType: 'nutrition',
|
|
316
345
|
* }, true);
|
|
317
346
|
* const best = items[0] // the single highest-specificity nutrition record
|
|
347
|
+
*
|
|
348
|
+
* // 50 at a time
|
|
349
|
+
* const target = { productId: 'prod_abc' }
|
|
350
|
+
* let page = await app.records.match(collectionId, appId, { target, limit: 50 })
|
|
351
|
+
* while (page.nextCursor) {
|
|
352
|
+
* page = await app.records.match(collectionId, appId, { target, limit: 50, cursor: page.nextCursor })
|
|
353
|
+
* }
|
|
318
354
|
* ```
|
|
319
355
|
*/
|
|
320
356
|
function match(collectionId: string, appId: string, input: MatchRecordsInput, admin?: boolean): Promise<MatchResult>;
|
|
@@ -352,19 +388,27 @@ export declare namespace app {
|
|
|
352
388
|
* Resolve every applicable record for a product context in one call.
|
|
353
389
|
* Returns `{ items, nextCursor, count, context, truncated }`: `items` are the records across all
|
|
354
390
|
* tiers (proof, batch, variant, product, rule, facet, collection), deduplicated and sorted by
|
|
355
|
-
* specificity descending, each as `{ record, matchedAt, specificity }`.
|
|
356
|
-
*
|
|
391
|
+
* specificity descending, each as `{ record, matchedAt, specificity }`. Without a `limit` it answers
|
|
392
|
+
* up to 500. Give a `limit` (in `input`) to page: when there are more, pass `nextCursor` back as
|
|
393
|
+
* `cursor`.
|
|
357
394
|
* POST /records/resolve-all
|
|
358
395
|
*
|
|
359
396
|
* @param admin - false for public (visibility-filtered, active-only), true for admin (all statuses)
|
|
360
397
|
*
|
|
361
398
|
* @example
|
|
362
399
|
* ```ts
|
|
363
|
-
* const { items
|
|
400
|
+
* const { items } = await app.records.resolveAll(collectionId, appId, {
|
|
364
401
|
* context: { productId: 'prod_abc' },
|
|
365
402
|
* recordType: 'nutrition',
|
|
366
403
|
* })
|
|
367
404
|
* for (const { record, matchedAt } of items) console.log(matchedAt, record.data)
|
|
405
|
+
*
|
|
406
|
+
* // 100 at a time
|
|
407
|
+
* const context = { productId: 'prod_abc' }
|
|
408
|
+
* let page = await app.records.resolveAll(collectionId, appId, { context, limit: 100 })
|
|
409
|
+
* while (page.nextCursor) {
|
|
410
|
+
* page = await app.records.resolveAll(collectionId, appId, { context, limit: 100, cursor: page.nextCursor })
|
|
411
|
+
* }
|
|
368
412
|
* ```
|
|
369
413
|
*/
|
|
370
414
|
function resolveAll(collectionId: string, appId: string, input: ResolveAllParams, admin?: boolean): Promise<ResolveAllResult>;
|