@proveanything/smartlinks 1.16.0 → 1.16.1
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/lots.d.ts +17 -4
- package/dist/api/lots.js +24 -7
- package/dist/docs/API_SUMMARY.md +74 -5
- package/dist/docs/lots.md +19 -2
- package/dist/openapi.yaml +152 -0
- package/dist/types/lots.d.ts +4 -0
- package/docs/API_SUMMARY.md +74 -5
- package/docs/lots.md +19 -2
- package/openapi.yaml +152 -0
- package/package.json +1 -1
package/dist/api/lots.d.ts
CHANGED
|
@@ -10,16 +10,29 @@ export declare namespace lots {
|
|
|
10
10
|
function create(collectionId: string, lot: LotCreateInput): Promise<Lot>;
|
|
11
11
|
/** List lots (summary rows; `payload`/`productIds` omitted). Filter by status, search, or containing productId. */
|
|
12
12
|
function list(collectionId: string, params?: ListLotsParams): Promise<Lot[]>;
|
|
13
|
-
/** Get the full lot record. */
|
|
14
|
-
function get(collectionId: string, lotId: string
|
|
13
|
+
/** Get the full lot record. Pass `{ includeDeleted: true }` to fetch a soft-deleted one. */
|
|
14
|
+
function get(collectionId: string, lotId: string, opts?: {
|
|
15
|
+
includeDeleted?: boolean;
|
|
16
|
+
}): Promise<Lot>;
|
|
15
17
|
/** Look up a lot by its number (case-insensitive) — used by scan/resolver flows. */
|
|
16
|
-
function getByNumber(collectionId: string, lotNumber: string
|
|
18
|
+
function getByNumber(collectionId: string, lotNumber: string, opts?: {
|
|
19
|
+
includeDeleted?: boolean;
|
|
20
|
+
}): Promise<Lot>;
|
|
17
21
|
/** Update a lot. Re-resolves members if the selector changed (response then carries `diff`). */
|
|
18
22
|
function update(collectionId: string, lotId: string, lot: LotUpdateInput): Promise<Lot>;
|
|
19
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Soft-delete a lot — recoverable, and frees its `lotNumber` for reuse. Distinct from
|
|
25
|
+
* {@link archive}. Hidden from reads unless `{ includeDeleted: true }`; undo with {@link restore}.
|
|
26
|
+
*/
|
|
27
|
+
function remove(collectionId: string, lotId: string): Promise<{
|
|
28
|
+
success: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
/** Archive a lot — a live lifecycle state (stays visible, keeps its number). Not a delete. */
|
|
20
31
|
function archive(collectionId: string, lotId: string): Promise<{
|
|
21
32
|
success: boolean;
|
|
22
33
|
}>;
|
|
34
|
+
/** Restore a soft-deleted lot. Rejects (409) if a live lot now uses the same number. */
|
|
35
|
+
function restore(collectionId: string, lotId: string): Promise<Lot>;
|
|
23
36
|
/** Re-resolve members from the current selector; returns the lot + a member diff. */
|
|
24
37
|
function resolve(collectionId: string, lotId: string): Promise<ResolveLotResponse>;
|
|
25
38
|
/** Paginated member product summaries. */
|
package/dist/api/lots.js
CHANGED
|
@@ -22,6 +22,8 @@ export var lots;
|
|
|
22
22
|
qs.append('search', params.search);
|
|
23
23
|
if (params.productId)
|
|
24
24
|
qs.append('productId', params.productId);
|
|
25
|
+
if (params.includeDeleted)
|
|
26
|
+
qs.append('includeDeleted', 'true');
|
|
25
27
|
const s = qs.toString();
|
|
26
28
|
return s ? `?${s}` : '';
|
|
27
29
|
}
|
|
@@ -46,14 +48,16 @@ export var lots;
|
|
|
46
48
|
return res.lots;
|
|
47
49
|
}
|
|
48
50
|
lots.list = list;
|
|
49
|
-
/** Get the full lot record. */
|
|
50
|
-
async function get(collectionId, lotId) {
|
|
51
|
-
|
|
51
|
+
/** Get the full lot record. Pass `{ includeDeleted: true }` to fetch a soft-deleted one. */
|
|
52
|
+
async function get(collectionId, lotId, opts = {}) {
|
|
53
|
+
const qs = opts.includeDeleted ? '?includeDeleted=true' : '';
|
|
54
|
+
return request(`${adminBase(collectionId)}/${encodeURIComponent(lotId)}${qs}`);
|
|
52
55
|
}
|
|
53
56
|
lots.get = get;
|
|
54
57
|
/** Look up a lot by its number (case-insensitive) — used by scan/resolver flows. */
|
|
55
|
-
async function getByNumber(collectionId, lotNumber) {
|
|
56
|
-
|
|
58
|
+
async function getByNumber(collectionId, lotNumber, opts = {}) {
|
|
59
|
+
const qs = opts.includeDeleted ? '?includeDeleted=true' : '';
|
|
60
|
+
return request(`${adminBase(collectionId)}/by-number/${encodeURIComponent(lotNumber)}${qs}`);
|
|
57
61
|
}
|
|
58
62
|
lots.getByNumber = getByNumber;
|
|
59
63
|
/** Update a lot. Re-resolves members if the selector changed (response then carries `diff`). */
|
|
@@ -61,11 +65,24 @@ export var lots;
|
|
|
61
65
|
return put(`${adminBase(collectionId)}/${encodeURIComponent(lotId)}`, lot);
|
|
62
66
|
}
|
|
63
67
|
lots.update = update;
|
|
64
|
-
/**
|
|
65
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Soft-delete a lot — recoverable, and frees its `lotNumber` for reuse. Distinct from
|
|
70
|
+
* {@link archive}. Hidden from reads unless `{ includeDeleted: true }`; undo with {@link restore}.
|
|
71
|
+
*/
|
|
72
|
+
async function remove(collectionId, lotId) {
|
|
66
73
|
return del(`${adminBase(collectionId)}/${encodeURIComponent(lotId)}`);
|
|
67
74
|
}
|
|
75
|
+
lots.remove = remove;
|
|
76
|
+
/** Archive a lot — a live lifecycle state (stays visible, keeps its number). Not a delete. */
|
|
77
|
+
async function archive(collectionId, lotId) {
|
|
78
|
+
return post(`${adminBase(collectionId)}/${encodeURIComponent(lotId)}/archive`, {});
|
|
79
|
+
}
|
|
68
80
|
lots.archive = archive;
|
|
81
|
+
/** Restore a soft-deleted lot. Rejects (409) if a live lot now uses the same number. */
|
|
82
|
+
async function restore(collectionId, lotId) {
|
|
83
|
+
return post(`${adminBase(collectionId)}/${encodeURIComponent(lotId)}/restore`, {});
|
|
84
|
+
}
|
|
85
|
+
lots.restore = restore;
|
|
69
86
|
/** Re-resolve members from the current selector; returns the lot + a member diff. */
|
|
70
87
|
async function resolve(collectionId, lotId) {
|
|
71
88
|
return post(`${adminBase(collectionId)}/${encodeURIComponent(lotId)}/resolve`, {});
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.16.
|
|
3
|
+
Version: 1.16.1 | Generated: 2026-09-01T15:57:41.258Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -3058,6 +3058,63 @@ interface AccountInfoResponse {
|
|
|
3058
3058
|
|
|
3059
3059
|
### authKit
|
|
3060
3060
|
|
|
3061
|
+
**AuthTelemetryEvent** (interface)
|
|
3062
|
+
```typescript
|
|
3063
|
+
interface AuthTelemetryEvent {
|
|
3064
|
+
eventId: string
|
|
3065
|
+
correlationId: string
|
|
3066
|
+
clientId: string
|
|
3067
|
+
collectionId?: string
|
|
3068
|
+
type: AuthEventType
|
|
3069
|
+
flow: AuthFlow
|
|
3070
|
+
ts: string
|
|
3071
|
+
durationMs?: number
|
|
3072
|
+
outcome?: 'success' | 'error' | 'stalled' | 'abandoned'
|
|
3073
|
+
error?: {
|
|
3074
|
+
code?: string
|
|
3075
|
+
statusCode?: number
|
|
3076
|
+
message?: string
|
|
3077
|
+
name?: string
|
|
3078
|
+
stack?: string
|
|
3079
|
+
endpoint?: string
|
|
3080
|
+
}
|
|
3081
|
+
context: {
|
|
3082
|
+
sdkVersion: string
|
|
3083
|
+
authKitVersion: string
|
|
3084
|
+
mode: 'standalone' | 'embedded' | 'proxy' | 'native'
|
|
3085
|
+
route?: string
|
|
3086
|
+
deepLinkMode?: string
|
|
3087
|
+
userAgent: string
|
|
3088
|
+
platform?: string
|
|
3089
|
+
language?: string
|
|
3090
|
+
online: boolean
|
|
3091
|
+
viewport?: { w: number; h: number }
|
|
3092
|
+
darkMode?: boolean
|
|
3093
|
+
}
|
|
3094
|
+
subject?: { uid?: string; emailHash?: string }
|
|
3095
|
+
}
|
|
3096
|
+
```
|
|
3097
|
+
|
|
3098
|
+
**TelemetryIngestResponse** (interface)
|
|
3099
|
+
```typescript
|
|
3100
|
+
interface TelemetryIngestResponse {
|
|
3101
|
+
accepted: number
|
|
3102
|
+
rejected: number
|
|
3103
|
+
rejectedIds: string[]
|
|
3104
|
+
}
|
|
3105
|
+
```
|
|
3106
|
+
|
|
3107
|
+
**AuthKitTelemetryConfig** (interface)
|
|
3108
|
+
```typescript
|
|
3109
|
+
interface AuthKitTelemetryConfig {
|
|
3110
|
+
enabled?: boolean
|
|
3111
|
+
successSampleRate?: number
|
|
3112
|
+
captureJsErrors?: boolean
|
|
3113
|
+
stallThresholdMs?: number
|
|
3114
|
+
retentionDays?: number
|
|
3115
|
+
}
|
|
3116
|
+
```
|
|
3117
|
+
|
|
3061
3118
|
**AuthKitUser** (interface)
|
|
3062
3119
|
```typescript
|
|
3063
3120
|
interface AuthKitUser {
|
|
@@ -3521,6 +3578,10 @@ interface AuthKitLockoutPolicy {
|
|
|
3521
3578
|
}
|
|
3522
3579
|
```
|
|
3523
3580
|
|
|
3581
|
+
**AuthEventType** = ``
|
|
3582
|
+
|
|
3583
|
+
**AuthFlow** = ``
|
|
3584
|
+
|
|
3524
3585
|
**RefreshErrorCode** = ``
|
|
3525
3586
|
|
|
3526
3587
|
**AuthKitErrorCode** = ``
|
|
@@ -6389,6 +6450,7 @@ interface Lot {
|
|
|
6389
6450
|
updatedBy?: string | null
|
|
6390
6451
|
createdAt: string
|
|
6391
6452
|
updatedAt: string
|
|
6453
|
+
deletedAt?: string | null
|
|
6392
6454
|
}
|
|
6393
6455
|
```
|
|
6394
6456
|
|
|
@@ -6412,6 +6474,7 @@ interface ListLotsParams {
|
|
|
6412
6474
|
status?: LotStatus
|
|
6413
6475
|
search?: string
|
|
6414
6476
|
productId?: string
|
|
6477
|
+
includeDeleted?: boolean
|
|
6415
6478
|
}
|
|
6416
6479
|
```
|
|
6417
6480
|
|
|
@@ -9898,17 +9961,23 @@ Create a lot (resolves its selector into members).
|
|
|
9898
9961
|
**list**(collectionId: string, params: ListLotsParams = {}) → `Promise<Lot[]>`
|
|
9899
9962
|
List lots (summary rows; `payload`/`productIds` omitted). Filter by status, search, or containing productId.
|
|
9900
9963
|
|
|
9901
|
-
**get**(collectionId: string, lotId: string) → `Promise<Lot>`
|
|
9902
|
-
Get the full lot record.
|
|
9964
|
+
**get**(collectionId: string, lotId: string, opts: { includeDeleted?: boolean } = {}) → `Promise<Lot>`
|
|
9965
|
+
Get the full lot record. Pass `{ includeDeleted: true }` to fetch a soft-deleted one.
|
|
9903
9966
|
|
|
9904
|
-
**getByNumber**(collectionId: string, lotNumber: string) → `Promise<Lot>`
|
|
9967
|
+
**getByNumber**(collectionId: string, lotNumber: string, opts: { includeDeleted?: boolean } = {}) → `Promise<Lot>`
|
|
9905
9968
|
Look up a lot by its number (case-insensitive) — used by scan/resolver flows.
|
|
9906
9969
|
|
|
9907
9970
|
**update**(collectionId: string, lotId: string, lot: LotUpdateInput) → `Promise<Lot>`
|
|
9908
9971
|
Update a lot. Re-resolves members if the selector changed (response then carries `diff`).
|
|
9909
9972
|
|
|
9973
|
+
**remove**(collectionId: string, lotId: string) → `Promise<`
|
|
9974
|
+
Soft-delete a lot — recoverable, and frees its `lotNumber` for reuse. Distinct from {@link archive}. Hidden from reads unless `{ includeDeleted: true }`; undo with {@link restore}.
|
|
9975
|
+
|
|
9910
9976
|
**archive**(collectionId: string, lotId: string) → `Promise<`
|
|
9911
|
-
|
|
9977
|
+
Archive a lot — a live lifecycle state (stays visible, keeps its number). Not a delete.
|
|
9978
|
+
|
|
9979
|
+
**restore**(collectionId: string, lotId: string) → `Promise<Lot>`
|
|
9980
|
+
Restore a soft-deleted lot. Rejects (409) if a live lot now uses the same number.
|
|
9912
9981
|
|
|
9913
9982
|
**resolve**(collectionId: string, lotId: string) → `Promise<ResolveLotResponse>`
|
|
9914
9983
|
Re-resolve members from the current selector; returns the lot + a member diff.
|
package/dist/docs/lots.md
CHANGED
|
@@ -18,9 +18,22 @@ truth for its shared data.
|
|
|
18
18
|
- `{ mode: 'products', productIds: [...] }` — an explicit list.
|
|
19
19
|
- **`productIds` / `productCount`** — the materialised snapshot of resolved members (re-resolved on create, on selector change, and on demand via `resolve`).
|
|
20
20
|
- **`payload`** — shared lot data (dates, supplier ref, custom fields). Lives only on the lot.
|
|
21
|
-
- **`status`** — `open` → `closed` → `recalled` → `archived`.
|
|
21
|
+
- **`status`** — `open` → `closed` → `recalled` → `archived`. A live lifecycle state, distinct from deletion.
|
|
22
22
|
- **`destination`** — optional lot-level redirect; wins over the product's on a lot-scoped scan.
|
|
23
23
|
|
|
24
|
+
### Archive vs delete
|
|
25
|
+
|
|
26
|
+
Two separate ideas — mirroring the platform's `deletedAt` convention:
|
|
27
|
+
|
|
28
|
+
| | `archive` (`status: 'archived'`) | `remove` (soft-delete, `deletedAt`) |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| Record | stays **live** & visible | **hidden** from reads unless `includeDeleted: true` |
|
|
31
|
+
| `lotNumber` | **stays reserved** | **freed** for reuse by a new lot |
|
|
32
|
+
| AI(10) scan | not resolved (excluded) | not resolved |
|
|
33
|
+
| Reversible | change status back | `restore` (409 if the number was taken by a live lot) |
|
|
34
|
+
|
|
35
|
+
Nothing is ever hard-deleted (joins/history stay intact). Use **archive** for "this run is done, keep it around"; use **remove** for "this was a mistake, and I want the number back."
|
|
36
|
+
|
|
24
37
|
---
|
|
25
38
|
|
|
26
39
|
## SDK — `SL.lots.*`
|
|
@@ -50,7 +63,11 @@ const containing = await lots.list(collectionId, { productId: 'prd_abc' }) // r
|
|
|
50
63
|
const updated = await lots.update(collectionId, lot.id, { status: 'closed' })
|
|
51
64
|
const { diff } = await lots.resolve(collectionId, lot.id) // { added, removed }
|
|
52
65
|
const members = await lots.listProducts(collectionId, lot.id, { page: 1, limit: 50 })
|
|
53
|
-
|
|
66
|
+
|
|
67
|
+
await lots.archive(collectionId, lot.id) // live, keeps its number
|
|
68
|
+
await lots.remove(collectionId, lot.id) // soft-delete, frees the number
|
|
69
|
+
const withDeleted = await lots.list(collectionId, { includeDeleted: true })
|
|
70
|
+
const restored = await lots.restore(collectionId, lot.id) // undo a soft-delete
|
|
54
71
|
|
|
55
72
|
// Cross-app reads
|
|
56
73
|
const publicLots = await lots.publicList(collectionId)
|
package/dist/openapi.yaml
CHANGED
|
@@ -4996,6 +4996,38 @@ paths:
|
|
|
4996
4996
|
description: Unauthorized
|
|
4997
4997
|
404:
|
|
4998
4998
|
description: Not found
|
|
4999
|
+
/admin/collection/{collectionId}/lots/{lotId}/restore:
|
|
5000
|
+
post:
|
|
5001
|
+
tags:
|
|
5002
|
+
- lots
|
|
5003
|
+
summary: Restore a soft-deleted lot.
|
|
5004
|
+
operationId: lots_restore
|
|
5005
|
+
security:
|
|
5006
|
+
- bearerAuth: []
|
|
5007
|
+
parameters:
|
|
5008
|
+
- name: collectionId
|
|
5009
|
+
in: path
|
|
5010
|
+
required: true
|
|
5011
|
+
schema:
|
|
5012
|
+
type: string
|
|
5013
|
+
- name: lotId
|
|
5014
|
+
in: path
|
|
5015
|
+
required: true
|
|
5016
|
+
schema:
|
|
5017
|
+
type: string
|
|
5018
|
+
responses:
|
|
5019
|
+
200:
|
|
5020
|
+
description: Success
|
|
5021
|
+
content:
|
|
5022
|
+
application/json:
|
|
5023
|
+
schema:
|
|
5024
|
+
$ref: "#/components/schemas/Lot"
|
|
5025
|
+
400:
|
|
5026
|
+
description: Bad request
|
|
5027
|
+
401:
|
|
5028
|
+
description: Unauthorized
|
|
5029
|
+
404:
|
|
5030
|
+
description: Not found
|
|
4999
5031
|
/admin/collection/{collectionId}/lots{params}:
|
|
5000
5032
|
get:
|
|
5001
5033
|
tags:
|
|
@@ -19105,6 +19137,122 @@ components:
|
|
|
19105
19137
|
- auth_time
|
|
19106
19138
|
- iat
|
|
19107
19139
|
- features
|
|
19140
|
+
AuthTelemetryEvent:
|
|
19141
|
+
type: object
|
|
19142
|
+
properties:
|
|
19143
|
+
eventId:
|
|
19144
|
+
type: string
|
|
19145
|
+
correlationId:
|
|
19146
|
+
type: string
|
|
19147
|
+
clientId:
|
|
19148
|
+
type: string
|
|
19149
|
+
collectionId:
|
|
19150
|
+
type: string
|
|
19151
|
+
type:
|
|
19152
|
+
$ref: "#/components/schemas/AuthEventType"
|
|
19153
|
+
flow:
|
|
19154
|
+
$ref: "#/components/schemas/AuthFlow"
|
|
19155
|
+
ts:
|
|
19156
|
+
type: string
|
|
19157
|
+
durationMs:
|
|
19158
|
+
type: number
|
|
19159
|
+
outcome:
|
|
19160
|
+
type: string
|
|
19161
|
+
enum:
|
|
19162
|
+
- success
|
|
19163
|
+
- error
|
|
19164
|
+
- stalled
|
|
19165
|
+
- abandoned
|
|
19166
|
+
error:
|
|
19167
|
+
type: object
|
|
19168
|
+
additionalProperties: true
|
|
19169
|
+
code:
|
|
19170
|
+
type: string
|
|
19171
|
+
statusCode:
|
|
19172
|
+
type: number
|
|
19173
|
+
message:
|
|
19174
|
+
type: string
|
|
19175
|
+
name:
|
|
19176
|
+
type: string
|
|
19177
|
+
stack:
|
|
19178
|
+
type: string
|
|
19179
|
+
endpoint:
|
|
19180
|
+
type: string
|
|
19181
|
+
context:
|
|
19182
|
+
type: object
|
|
19183
|
+
additionalProperties: true
|
|
19184
|
+
sdkVersion:
|
|
19185
|
+
type: string
|
|
19186
|
+
authKitVersion:
|
|
19187
|
+
type: string
|
|
19188
|
+
mode:
|
|
19189
|
+
type: string
|
|
19190
|
+
enum:
|
|
19191
|
+
- standalone
|
|
19192
|
+
- embedded
|
|
19193
|
+
- proxy
|
|
19194
|
+
- native
|
|
19195
|
+
route:
|
|
19196
|
+
type: string
|
|
19197
|
+
deepLinkMode:
|
|
19198
|
+
type: string
|
|
19199
|
+
userAgent:
|
|
19200
|
+
type: string
|
|
19201
|
+
platform:
|
|
19202
|
+
type: string
|
|
19203
|
+
language:
|
|
19204
|
+
type: string
|
|
19205
|
+
online:
|
|
19206
|
+
type: boolean
|
|
19207
|
+
viewport:
|
|
19208
|
+
type: object
|
|
19209
|
+
additionalProperties: true
|
|
19210
|
+
darkMode:
|
|
19211
|
+
type: boolean
|
|
19212
|
+
subject:
|
|
19213
|
+
type: object
|
|
19214
|
+
additionalProperties: true
|
|
19215
|
+
required:
|
|
19216
|
+
- eventId
|
|
19217
|
+
- correlationId
|
|
19218
|
+
- clientId
|
|
19219
|
+
- type
|
|
19220
|
+
- flow
|
|
19221
|
+
- ts
|
|
19222
|
+
- context
|
|
19223
|
+
- sdkVersion
|
|
19224
|
+
- authKitVersion
|
|
19225
|
+
- mode
|
|
19226
|
+
- userAgent
|
|
19227
|
+
- online
|
|
19228
|
+
TelemetryIngestResponse:
|
|
19229
|
+
type: object
|
|
19230
|
+
properties:
|
|
19231
|
+
accepted:
|
|
19232
|
+
type: number
|
|
19233
|
+
rejected:
|
|
19234
|
+
type: number
|
|
19235
|
+
rejectedIds:
|
|
19236
|
+
type: array
|
|
19237
|
+
items:
|
|
19238
|
+
type: string
|
|
19239
|
+
required:
|
|
19240
|
+
- accepted
|
|
19241
|
+
- rejected
|
|
19242
|
+
- rejectedIds
|
|
19243
|
+
AuthKitTelemetryConfig:
|
|
19244
|
+
type: object
|
|
19245
|
+
properties:
|
|
19246
|
+
enabled:
|
|
19247
|
+
type: boolean
|
|
19248
|
+
successSampleRate:
|
|
19249
|
+
type: number
|
|
19250
|
+
captureJsErrors:
|
|
19251
|
+
type: boolean
|
|
19252
|
+
stallThresholdMs:
|
|
19253
|
+
type: number
|
|
19254
|
+
retentionDays:
|
|
19255
|
+
type: number
|
|
19108
19256
|
AuthKitUser:
|
|
19109
19257
|
type: object
|
|
19110
19258
|
properties:
|
|
@@ -23737,6 +23885,8 @@ components:
|
|
|
23737
23885
|
type: string
|
|
23738
23886
|
updatedAt:
|
|
23739
23887
|
type: string
|
|
23888
|
+
deletedAt:
|
|
23889
|
+
type: string
|
|
23740
23890
|
required:
|
|
23741
23891
|
- id
|
|
23742
23892
|
- collectionId
|
|
@@ -23777,6 +23927,8 @@ components:
|
|
|
23777
23927
|
type: string
|
|
23778
23928
|
productId:
|
|
23779
23929
|
type: string
|
|
23930
|
+
includeDeleted:
|
|
23931
|
+
type: boolean
|
|
23780
23932
|
ListLotsResponse:
|
|
23781
23933
|
type: object
|
|
23782
23934
|
properties:
|
package/dist/types/lots.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export interface Lot {
|
|
|
39
39
|
updatedBy?: string | null;
|
|
40
40
|
createdAt: string;
|
|
41
41
|
updatedAt: string;
|
|
42
|
+
/** Soft-delete timestamp (recoverable). `null` for live lots. Distinct from `status:'archived'`. */
|
|
43
|
+
deletedAt?: string | null;
|
|
42
44
|
}
|
|
43
45
|
export interface LotCreateInput {
|
|
44
46
|
lotNumber: string;
|
|
@@ -57,6 +59,8 @@ export interface ListLotsParams {
|
|
|
57
59
|
search?: string;
|
|
58
60
|
/** Reverse lookup — lots containing this product id. */
|
|
59
61
|
productId?: string;
|
|
62
|
+
/** Admin only: include soft-deleted lots (default false). */
|
|
63
|
+
includeDeleted?: boolean;
|
|
60
64
|
}
|
|
61
65
|
export interface ListLotsResponse {
|
|
62
66
|
lots: Lot[];
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.16.
|
|
3
|
+
Version: 1.16.1 | Generated: 2026-09-01T15:57:41.258Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -3058,6 +3058,63 @@ interface AccountInfoResponse {
|
|
|
3058
3058
|
|
|
3059
3059
|
### authKit
|
|
3060
3060
|
|
|
3061
|
+
**AuthTelemetryEvent** (interface)
|
|
3062
|
+
```typescript
|
|
3063
|
+
interface AuthTelemetryEvent {
|
|
3064
|
+
eventId: string
|
|
3065
|
+
correlationId: string
|
|
3066
|
+
clientId: string
|
|
3067
|
+
collectionId?: string
|
|
3068
|
+
type: AuthEventType
|
|
3069
|
+
flow: AuthFlow
|
|
3070
|
+
ts: string
|
|
3071
|
+
durationMs?: number
|
|
3072
|
+
outcome?: 'success' | 'error' | 'stalled' | 'abandoned'
|
|
3073
|
+
error?: {
|
|
3074
|
+
code?: string
|
|
3075
|
+
statusCode?: number
|
|
3076
|
+
message?: string
|
|
3077
|
+
name?: string
|
|
3078
|
+
stack?: string
|
|
3079
|
+
endpoint?: string
|
|
3080
|
+
}
|
|
3081
|
+
context: {
|
|
3082
|
+
sdkVersion: string
|
|
3083
|
+
authKitVersion: string
|
|
3084
|
+
mode: 'standalone' | 'embedded' | 'proxy' | 'native'
|
|
3085
|
+
route?: string
|
|
3086
|
+
deepLinkMode?: string
|
|
3087
|
+
userAgent: string
|
|
3088
|
+
platform?: string
|
|
3089
|
+
language?: string
|
|
3090
|
+
online: boolean
|
|
3091
|
+
viewport?: { w: number; h: number }
|
|
3092
|
+
darkMode?: boolean
|
|
3093
|
+
}
|
|
3094
|
+
subject?: { uid?: string; emailHash?: string }
|
|
3095
|
+
}
|
|
3096
|
+
```
|
|
3097
|
+
|
|
3098
|
+
**TelemetryIngestResponse** (interface)
|
|
3099
|
+
```typescript
|
|
3100
|
+
interface TelemetryIngestResponse {
|
|
3101
|
+
accepted: number
|
|
3102
|
+
rejected: number
|
|
3103
|
+
rejectedIds: string[]
|
|
3104
|
+
}
|
|
3105
|
+
```
|
|
3106
|
+
|
|
3107
|
+
**AuthKitTelemetryConfig** (interface)
|
|
3108
|
+
```typescript
|
|
3109
|
+
interface AuthKitTelemetryConfig {
|
|
3110
|
+
enabled?: boolean
|
|
3111
|
+
successSampleRate?: number
|
|
3112
|
+
captureJsErrors?: boolean
|
|
3113
|
+
stallThresholdMs?: number
|
|
3114
|
+
retentionDays?: number
|
|
3115
|
+
}
|
|
3116
|
+
```
|
|
3117
|
+
|
|
3061
3118
|
**AuthKitUser** (interface)
|
|
3062
3119
|
```typescript
|
|
3063
3120
|
interface AuthKitUser {
|
|
@@ -3521,6 +3578,10 @@ interface AuthKitLockoutPolicy {
|
|
|
3521
3578
|
}
|
|
3522
3579
|
```
|
|
3523
3580
|
|
|
3581
|
+
**AuthEventType** = ``
|
|
3582
|
+
|
|
3583
|
+
**AuthFlow** = ``
|
|
3584
|
+
|
|
3524
3585
|
**RefreshErrorCode** = ``
|
|
3525
3586
|
|
|
3526
3587
|
**AuthKitErrorCode** = ``
|
|
@@ -6389,6 +6450,7 @@ interface Lot {
|
|
|
6389
6450
|
updatedBy?: string | null
|
|
6390
6451
|
createdAt: string
|
|
6391
6452
|
updatedAt: string
|
|
6453
|
+
deletedAt?: string | null
|
|
6392
6454
|
}
|
|
6393
6455
|
```
|
|
6394
6456
|
|
|
@@ -6412,6 +6474,7 @@ interface ListLotsParams {
|
|
|
6412
6474
|
status?: LotStatus
|
|
6413
6475
|
search?: string
|
|
6414
6476
|
productId?: string
|
|
6477
|
+
includeDeleted?: boolean
|
|
6415
6478
|
}
|
|
6416
6479
|
```
|
|
6417
6480
|
|
|
@@ -9898,17 +9961,23 @@ Create a lot (resolves its selector into members).
|
|
|
9898
9961
|
**list**(collectionId: string, params: ListLotsParams = {}) → `Promise<Lot[]>`
|
|
9899
9962
|
List lots (summary rows; `payload`/`productIds` omitted). Filter by status, search, or containing productId.
|
|
9900
9963
|
|
|
9901
|
-
**get**(collectionId: string, lotId: string) → `Promise<Lot>`
|
|
9902
|
-
Get the full lot record.
|
|
9964
|
+
**get**(collectionId: string, lotId: string, opts: { includeDeleted?: boolean } = {}) → `Promise<Lot>`
|
|
9965
|
+
Get the full lot record. Pass `{ includeDeleted: true }` to fetch a soft-deleted one.
|
|
9903
9966
|
|
|
9904
|
-
**getByNumber**(collectionId: string, lotNumber: string) → `Promise<Lot>`
|
|
9967
|
+
**getByNumber**(collectionId: string, lotNumber: string, opts: { includeDeleted?: boolean } = {}) → `Promise<Lot>`
|
|
9905
9968
|
Look up a lot by its number (case-insensitive) — used by scan/resolver flows.
|
|
9906
9969
|
|
|
9907
9970
|
**update**(collectionId: string, lotId: string, lot: LotUpdateInput) → `Promise<Lot>`
|
|
9908
9971
|
Update a lot. Re-resolves members if the selector changed (response then carries `diff`).
|
|
9909
9972
|
|
|
9973
|
+
**remove**(collectionId: string, lotId: string) → `Promise<`
|
|
9974
|
+
Soft-delete a lot — recoverable, and frees its `lotNumber` for reuse. Distinct from {@link archive}. Hidden from reads unless `{ includeDeleted: true }`; undo with {@link restore}.
|
|
9975
|
+
|
|
9910
9976
|
**archive**(collectionId: string, lotId: string) → `Promise<`
|
|
9911
|
-
|
|
9977
|
+
Archive a lot — a live lifecycle state (stays visible, keeps its number). Not a delete.
|
|
9978
|
+
|
|
9979
|
+
**restore**(collectionId: string, lotId: string) → `Promise<Lot>`
|
|
9980
|
+
Restore a soft-deleted lot. Rejects (409) if a live lot now uses the same number.
|
|
9912
9981
|
|
|
9913
9982
|
**resolve**(collectionId: string, lotId: string) → `Promise<ResolveLotResponse>`
|
|
9914
9983
|
Re-resolve members from the current selector; returns the lot + a member diff.
|
package/docs/lots.md
CHANGED
|
@@ -18,9 +18,22 @@ truth for its shared data.
|
|
|
18
18
|
- `{ mode: 'products', productIds: [...] }` — an explicit list.
|
|
19
19
|
- **`productIds` / `productCount`** — the materialised snapshot of resolved members (re-resolved on create, on selector change, and on demand via `resolve`).
|
|
20
20
|
- **`payload`** — shared lot data (dates, supplier ref, custom fields). Lives only on the lot.
|
|
21
|
-
- **`status`** — `open` → `closed` → `recalled` → `archived`.
|
|
21
|
+
- **`status`** — `open` → `closed` → `recalled` → `archived`. A live lifecycle state, distinct from deletion.
|
|
22
22
|
- **`destination`** — optional lot-level redirect; wins over the product's on a lot-scoped scan.
|
|
23
23
|
|
|
24
|
+
### Archive vs delete
|
|
25
|
+
|
|
26
|
+
Two separate ideas — mirroring the platform's `deletedAt` convention:
|
|
27
|
+
|
|
28
|
+
| | `archive` (`status: 'archived'`) | `remove` (soft-delete, `deletedAt`) |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| Record | stays **live** & visible | **hidden** from reads unless `includeDeleted: true` |
|
|
31
|
+
| `lotNumber` | **stays reserved** | **freed** for reuse by a new lot |
|
|
32
|
+
| AI(10) scan | not resolved (excluded) | not resolved |
|
|
33
|
+
| Reversible | change status back | `restore` (409 if the number was taken by a live lot) |
|
|
34
|
+
|
|
35
|
+
Nothing is ever hard-deleted (joins/history stay intact). Use **archive** for "this run is done, keep it around"; use **remove** for "this was a mistake, and I want the number back."
|
|
36
|
+
|
|
24
37
|
---
|
|
25
38
|
|
|
26
39
|
## SDK — `SL.lots.*`
|
|
@@ -50,7 +63,11 @@ const containing = await lots.list(collectionId, { productId: 'prd_abc' }) // r
|
|
|
50
63
|
const updated = await lots.update(collectionId, lot.id, { status: 'closed' })
|
|
51
64
|
const { diff } = await lots.resolve(collectionId, lot.id) // { added, removed }
|
|
52
65
|
const members = await lots.listProducts(collectionId, lot.id, { page: 1, limit: 50 })
|
|
53
|
-
|
|
66
|
+
|
|
67
|
+
await lots.archive(collectionId, lot.id) // live, keeps its number
|
|
68
|
+
await lots.remove(collectionId, lot.id) // soft-delete, frees the number
|
|
69
|
+
const withDeleted = await lots.list(collectionId, { includeDeleted: true })
|
|
70
|
+
const restored = await lots.restore(collectionId, lot.id) // undo a soft-delete
|
|
54
71
|
|
|
55
72
|
// Cross-app reads
|
|
56
73
|
const publicLots = await lots.publicList(collectionId)
|
package/openapi.yaml
CHANGED
|
@@ -4996,6 +4996,38 @@ paths:
|
|
|
4996
4996
|
description: Unauthorized
|
|
4997
4997
|
404:
|
|
4998
4998
|
description: Not found
|
|
4999
|
+
/admin/collection/{collectionId}/lots/{lotId}/restore:
|
|
5000
|
+
post:
|
|
5001
|
+
tags:
|
|
5002
|
+
- lots
|
|
5003
|
+
summary: Restore a soft-deleted lot.
|
|
5004
|
+
operationId: lots_restore
|
|
5005
|
+
security:
|
|
5006
|
+
- bearerAuth: []
|
|
5007
|
+
parameters:
|
|
5008
|
+
- name: collectionId
|
|
5009
|
+
in: path
|
|
5010
|
+
required: true
|
|
5011
|
+
schema:
|
|
5012
|
+
type: string
|
|
5013
|
+
- name: lotId
|
|
5014
|
+
in: path
|
|
5015
|
+
required: true
|
|
5016
|
+
schema:
|
|
5017
|
+
type: string
|
|
5018
|
+
responses:
|
|
5019
|
+
200:
|
|
5020
|
+
description: Success
|
|
5021
|
+
content:
|
|
5022
|
+
application/json:
|
|
5023
|
+
schema:
|
|
5024
|
+
$ref: "#/components/schemas/Lot"
|
|
5025
|
+
400:
|
|
5026
|
+
description: Bad request
|
|
5027
|
+
401:
|
|
5028
|
+
description: Unauthorized
|
|
5029
|
+
404:
|
|
5030
|
+
description: Not found
|
|
4999
5031
|
/admin/collection/{collectionId}/lots{params}:
|
|
5000
5032
|
get:
|
|
5001
5033
|
tags:
|
|
@@ -19105,6 +19137,122 @@ components:
|
|
|
19105
19137
|
- auth_time
|
|
19106
19138
|
- iat
|
|
19107
19139
|
- features
|
|
19140
|
+
AuthTelemetryEvent:
|
|
19141
|
+
type: object
|
|
19142
|
+
properties:
|
|
19143
|
+
eventId:
|
|
19144
|
+
type: string
|
|
19145
|
+
correlationId:
|
|
19146
|
+
type: string
|
|
19147
|
+
clientId:
|
|
19148
|
+
type: string
|
|
19149
|
+
collectionId:
|
|
19150
|
+
type: string
|
|
19151
|
+
type:
|
|
19152
|
+
$ref: "#/components/schemas/AuthEventType"
|
|
19153
|
+
flow:
|
|
19154
|
+
$ref: "#/components/schemas/AuthFlow"
|
|
19155
|
+
ts:
|
|
19156
|
+
type: string
|
|
19157
|
+
durationMs:
|
|
19158
|
+
type: number
|
|
19159
|
+
outcome:
|
|
19160
|
+
type: string
|
|
19161
|
+
enum:
|
|
19162
|
+
- success
|
|
19163
|
+
- error
|
|
19164
|
+
- stalled
|
|
19165
|
+
- abandoned
|
|
19166
|
+
error:
|
|
19167
|
+
type: object
|
|
19168
|
+
additionalProperties: true
|
|
19169
|
+
code:
|
|
19170
|
+
type: string
|
|
19171
|
+
statusCode:
|
|
19172
|
+
type: number
|
|
19173
|
+
message:
|
|
19174
|
+
type: string
|
|
19175
|
+
name:
|
|
19176
|
+
type: string
|
|
19177
|
+
stack:
|
|
19178
|
+
type: string
|
|
19179
|
+
endpoint:
|
|
19180
|
+
type: string
|
|
19181
|
+
context:
|
|
19182
|
+
type: object
|
|
19183
|
+
additionalProperties: true
|
|
19184
|
+
sdkVersion:
|
|
19185
|
+
type: string
|
|
19186
|
+
authKitVersion:
|
|
19187
|
+
type: string
|
|
19188
|
+
mode:
|
|
19189
|
+
type: string
|
|
19190
|
+
enum:
|
|
19191
|
+
- standalone
|
|
19192
|
+
- embedded
|
|
19193
|
+
- proxy
|
|
19194
|
+
- native
|
|
19195
|
+
route:
|
|
19196
|
+
type: string
|
|
19197
|
+
deepLinkMode:
|
|
19198
|
+
type: string
|
|
19199
|
+
userAgent:
|
|
19200
|
+
type: string
|
|
19201
|
+
platform:
|
|
19202
|
+
type: string
|
|
19203
|
+
language:
|
|
19204
|
+
type: string
|
|
19205
|
+
online:
|
|
19206
|
+
type: boolean
|
|
19207
|
+
viewport:
|
|
19208
|
+
type: object
|
|
19209
|
+
additionalProperties: true
|
|
19210
|
+
darkMode:
|
|
19211
|
+
type: boolean
|
|
19212
|
+
subject:
|
|
19213
|
+
type: object
|
|
19214
|
+
additionalProperties: true
|
|
19215
|
+
required:
|
|
19216
|
+
- eventId
|
|
19217
|
+
- correlationId
|
|
19218
|
+
- clientId
|
|
19219
|
+
- type
|
|
19220
|
+
- flow
|
|
19221
|
+
- ts
|
|
19222
|
+
- context
|
|
19223
|
+
- sdkVersion
|
|
19224
|
+
- authKitVersion
|
|
19225
|
+
- mode
|
|
19226
|
+
- userAgent
|
|
19227
|
+
- online
|
|
19228
|
+
TelemetryIngestResponse:
|
|
19229
|
+
type: object
|
|
19230
|
+
properties:
|
|
19231
|
+
accepted:
|
|
19232
|
+
type: number
|
|
19233
|
+
rejected:
|
|
19234
|
+
type: number
|
|
19235
|
+
rejectedIds:
|
|
19236
|
+
type: array
|
|
19237
|
+
items:
|
|
19238
|
+
type: string
|
|
19239
|
+
required:
|
|
19240
|
+
- accepted
|
|
19241
|
+
- rejected
|
|
19242
|
+
- rejectedIds
|
|
19243
|
+
AuthKitTelemetryConfig:
|
|
19244
|
+
type: object
|
|
19245
|
+
properties:
|
|
19246
|
+
enabled:
|
|
19247
|
+
type: boolean
|
|
19248
|
+
successSampleRate:
|
|
19249
|
+
type: number
|
|
19250
|
+
captureJsErrors:
|
|
19251
|
+
type: boolean
|
|
19252
|
+
stallThresholdMs:
|
|
19253
|
+
type: number
|
|
19254
|
+
retentionDays:
|
|
19255
|
+
type: number
|
|
19108
19256
|
AuthKitUser:
|
|
19109
19257
|
type: object
|
|
19110
19258
|
properties:
|
|
@@ -23737,6 +23885,8 @@ components:
|
|
|
23737
23885
|
type: string
|
|
23738
23886
|
updatedAt:
|
|
23739
23887
|
type: string
|
|
23888
|
+
deletedAt:
|
|
23889
|
+
type: string
|
|
23740
23890
|
required:
|
|
23741
23891
|
- id
|
|
23742
23892
|
- collectionId
|
|
@@ -23777,6 +23927,8 @@ components:
|
|
|
23777
23927
|
type: string
|
|
23778
23928
|
productId:
|
|
23779
23929
|
type: string
|
|
23930
|
+
includeDeleted:
|
|
23931
|
+
type: boolean
|
|
23780
23932
|
ListLotsResponse:
|
|
23781
23933
|
type: object
|
|
23782
23934
|
properties:
|