@proveanything/smartlinks 2.1.16 → 2.1.18
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/adminViews.d.ts +85 -0
- package/dist/adminViews.js +259 -0
- package/dist/api/errors.d.ts +10 -0
- package/dist/api/errors.js +17 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +3 -0
- package/dist/api/operations.d.ts +36 -0
- package/dist/api/operations.js +56 -0
- package/dist/api/order.d.ts +12 -1
- package/dist/api/order.js +15 -0
- package/dist/api/partner.d.ts +7 -1
- package/dist/api/partner.js +9 -0
- package/dist/api/userGroups.d.ts +78 -0
- package/dist/api/userGroups.js +124 -0
- package/dist/docs/API_SUMMARY.md +699 -46
- package/dist/docs/admin-views.md +125 -0
- package/dist/docs/app-manifest.md +2 -0
- package/dist/docs/app-objects.md +23 -0
- package/dist/docs/operations.md +281 -0
- package/dist/docs/overview.md +3 -0
- package/dist/docs/server-functions.md +106 -0
- package/dist/docs/tag-ranges.md +8 -0
- package/dist/docs/user-groups.md +168 -0
- package/dist/docs/utils.md +17 -0
- package/dist/http.js +4 -0
- package/dist/iframeResponder.d.ts +15 -0
- package/dist/iframeResponder.js +39 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/openapi.yaml +1426 -276
- package/dist/testing/index.d.ts +29 -0
- package/dist/testing/index.js +178 -1
- package/dist/types/appManifest.d.ts +170 -0
- package/dist/types/appObjects.d.ts +22 -1
- package/dist/types/claimSet.d.ts +2 -0
- package/dist/types/clientLog.d.ts +46 -0
- package/dist/types/clientLog.js +1 -0
- package/dist/types/containers.d.ts +8 -0
- package/dist/types/iframeResponder.d.ts +16 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +3 -0
- package/dist/types/operations.d.ts +598 -0
- package/dist/types/operations.js +8 -0
- package/dist/types/order.d.ts +35 -6
- package/dist/types/userGroups.d.ts +103 -0
- package/dist/types/userGroups.js +5 -0
- package/dist/utils/conditions.d.ts +7 -0
- package/dist/utils/conditions.js +16 -9
- package/docs/API_SUMMARY.md +699 -46
- package/docs/admin-views.md +125 -0
- package/docs/app-manifest.md +2 -0
- package/docs/app-objects.md +23 -0
- package/docs/operations.md +281 -0
- package/docs/overview.md +3 -0
- package/docs/server-functions.md +106 -0
- package/docs/tag-ranges.md +8 -0
- package/docs/user-groups.md +168 -0
- package/docs/utils.md +17 -0
- package/openapi.yaml +1426 -276
- 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.18 | Generated: 2026-11-14T16:27:34.105Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -144,6 +144,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
144
144
|
- **bookings** - Functions for bookings operations
|
|
145
145
|
- **config** - Functions for config operations
|
|
146
146
|
- **containers** - Functions for containers operations
|
|
147
|
+
- **errors** - Functions for errors operations
|
|
147
148
|
- **facets** - Functions for facets operations
|
|
148
149
|
- **functions** - Functions for functions operations
|
|
149
150
|
- **http** - Functions for http operations
|
|
@@ -153,6 +154,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
153
154
|
- **location** - Functions for location operations
|
|
154
155
|
- **lots** - Functions for lots operations
|
|
155
156
|
- **navigation** - Functions for navigation operations
|
|
157
|
+
- **operations** - Functions for operations operations
|
|
156
158
|
- **order** - Functions for order operations
|
|
157
159
|
- **partner** - Functions for partner operations
|
|
158
160
|
- **products** - Functions for products operations
|
|
@@ -162,6 +164,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
162
164
|
- **tags** - Functions for tags operations
|
|
163
165
|
- **template** - Functions for template operations
|
|
164
166
|
- **translations** - Functions for translations operations
|
|
167
|
+
- **userGroups** - Functions for userGroups operations
|
|
165
168
|
|
|
166
169
|
## HTTP Utilities
|
|
167
170
|
|
|
@@ -2698,6 +2701,7 @@ interface AppFunctionDef {
|
|
|
2698
2701
|
visibility?: AppFunctionVisibility;
|
|
2699
2702
|
authority?: AppFunctionAuthority;
|
|
2700
2703
|
elevated?: boolean;
|
|
2704
|
+
userGroups?: string[];
|
|
2701
2705
|
capabilities?: string[];
|
|
2702
2706
|
dataScope?: 'collection' | 'global';
|
|
2703
2707
|
inputs?: AppFunctionInputs;
|
|
@@ -2838,11 +2842,51 @@ interface ServerFunctionBookings {
|
|
|
2838
2842
|
}
|
|
2839
2843
|
```
|
|
2840
2844
|
|
|
2845
|
+
**AppHistoryEvent** (interface)
|
|
2846
|
+
```typescript
|
|
2847
|
+
interface AppHistoryEvent {
|
|
2848
|
+
id: string;
|
|
2849
|
+
at: string;
|
|
2850
|
+
type: string;
|
|
2851
|
+
entityId: string | null;
|
|
2852
|
+
data: Record<string, any>;
|
|
2853
|
+
actorType: 'user' | 'contact' | null;
|
|
2854
|
+
actorId: string | null;
|
|
2855
|
+
}
|
|
2856
|
+
```
|
|
2857
|
+
|
|
2858
|
+
**AppHistoryQuery** (interface)
|
|
2859
|
+
```typescript
|
|
2860
|
+
interface AppHistoryQuery {
|
|
2861
|
+
types?: string | string[];
|
|
2862
|
+
entityId?: string;
|
|
2863
|
+
data?: Record<string, string | number | boolean | Array<string | number | boolean>>;
|
|
2864
|
+
from?: string;
|
|
2865
|
+
to?: string;
|
|
2866
|
+
limit?: number;
|
|
2867
|
+
}
|
|
2868
|
+
```
|
|
2869
|
+
|
|
2841
2870
|
**ServerFunctionSl** (interface)
|
|
2842
2871
|
```typescript
|
|
2843
2872
|
interface ServerFunctionSl {
|
|
2873
|
+
workOrders: WorkOrdersApi;
|
|
2874
|
+
stock: StockApi;
|
|
2875
|
+
boms: BomsApi;
|
|
2876
|
+
madeFrom: MadeFromApi;
|
|
2877
|
+
operations: OperationsApi;
|
|
2844
2878
|
bookings: ServerFunctionBookings;
|
|
2845
|
-
appRecords: {
|
|
2879
|
+
appRecords: {
|
|
2880
|
+
claim(fields: Record<string, any>): Promise<AppRecordClaimResult>;
|
|
2881
|
+
adjust(recordId: string, by: Record<string, number>, opts?: { atLeast?: Record<string, number>; atMost?: Record<string, number> }): Promise<any>;
|
|
2882
|
+
aggregate(params?: import('./appObjects').AggregateRequest): Promise<import('./appObjects').AggregateResponse & Record<string, unknown>>;
|
|
2883
|
+
[method: string]: any;
|
|
2884
|
+
};
|
|
2885
|
+
transaction(ops: RecordTransactionOp[], opts?: { idempotencyKey?: string }): Promise<{ results: any[]; replayed: boolean }>;
|
|
2886
|
+
history: {
|
|
2887
|
+
log(type: string, data?: Record<string, any>, opts?: { entityId?: string }): Promise<{ id: string }>;
|
|
2888
|
+
query(params?: AppHistoryQuery): Promise<AppHistoryEvent[]>;
|
|
2889
|
+
};
|
|
2846
2890
|
counters: ServerFunctionCounters;
|
|
2847
2891
|
tags: { resolve(id: string): Promise<ResolvedTag | null> };
|
|
2848
2892
|
contacts: {
|
|
@@ -2866,6 +2910,7 @@ interface ServerFunctionCaller {
|
|
|
2866
2910
|
origin?: string | null;
|
|
2867
2911
|
ip?: string | null;
|
|
2868
2912
|
via: AppFunctionTriggerType;
|
|
2913
|
+
userGroups: readonly string[];
|
|
2869
2914
|
}
|
|
2870
2915
|
```
|
|
2871
2916
|
|
|
@@ -3012,6 +3057,20 @@ interface PublicView {
|
|
|
3012
3057
|
}
|
|
3013
3058
|
```
|
|
3014
3059
|
|
|
3060
|
+
**AdminView** (interface)
|
|
3061
|
+
```typescript
|
|
3062
|
+
interface AdminView {
|
|
3063
|
+
id: string;
|
|
3064
|
+
title: string;
|
|
3065
|
+
path: string;
|
|
3066
|
+
group?: 'main' | 'settings' | 'record';
|
|
3067
|
+
within?: string;
|
|
3068
|
+
icon?: string;
|
|
3069
|
+
description?: string;
|
|
3070
|
+
params?: Record<string, string>;
|
|
3071
|
+
}
|
|
3072
|
+
```
|
|
3073
|
+
|
|
3015
3074
|
**AppManifest** (interface)
|
|
3016
3075
|
```typescript
|
|
3017
3076
|
interface AppManifest {
|
|
@@ -3047,6 +3106,7 @@ interface AppManifest {
|
|
|
3047
3106
|
};
|
|
3048
3107
|
linkable?: DeepLinkEntry[];
|
|
3049
3108
|
publicViews?: PublicView[];
|
|
3109
|
+
adminViews?: AdminView[];
|
|
3050
3110
|
executor?: AppManifestExecutor;
|
|
3051
3111
|
functions?: AppManifestFunctions;
|
|
3052
3112
|
realtime?: { channels: RealtimeChannelDeclaration[] };
|
|
@@ -3298,6 +3358,8 @@ interface GetCollectionWidgetsOptions {
|
|
|
3298
3358
|
|
|
3299
3359
|
**AppFunctionAuthority** = `'caller' | 'collection'`
|
|
3300
3360
|
|
|
3361
|
+
**RecordTransactionOp** = ``
|
|
3362
|
+
|
|
3301
3363
|
### appObjects
|
|
3302
3364
|
|
|
3303
3365
|
**PaginatedResponse<T>** (interface)
|
|
@@ -3324,9 +3386,12 @@ interface AggregateRequest {
|
|
|
3324
3386
|
created_at?: { gte?: string; lte?: string }
|
|
3325
3387
|
closed_at?: '__notnull__' | { gte?: string; lte?: string } // cases only
|
|
3326
3388
|
expires_at?: { lte?: string } // records only
|
|
3389
|
+
updated_at?: { gte?: string; lte?: string } // records only
|
|
3390
|
+
data?: Record<string, string | number | boolean | Array<string | number | boolean>>
|
|
3391
|
+
dataRange?: Record<string, { gte?: number; gt?: number; lte?: number; lt?: number }>
|
|
3327
3392
|
}
|
|
3328
|
-
groupBy?: string[]
|
|
3329
|
-
metrics?: string[]
|
|
3393
|
+
groupBy?: string[]
|
|
3394
|
+
metrics?: string[]
|
|
3330
3395
|
timeSeriesField?: string // e.g. 'created_at'
|
|
3331
3396
|
timeSeriesInterval?: 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'
|
|
3332
3397
|
}
|
|
@@ -3335,7 +3400,7 @@ interface AggregateRequest {
|
|
|
3335
3400
|
**AggregateResponse** (interface)
|
|
3336
3401
|
```typescript
|
|
3337
3402
|
interface AggregateResponse {
|
|
3338
|
-
groups?: ({ count
|
|
3403
|
+
groups?: ({ count?: number } & Record<string, unknown>)[]
|
|
3339
3404
|
timeSeries?: ({ bucket: string; count: number } & Record<string, unknown>)[]
|
|
3340
3405
|
count?: number
|
|
3341
3406
|
avg_close_time_seconds?: number
|
|
@@ -5966,6 +6031,7 @@ interface PartnerTagHit {
|
|
|
5966
6031
|
set: PartnerClaimSet | null
|
|
5967
6032
|
tag: ClaimSetRangeTag & { url: string | null }
|
|
5968
6033
|
range: ClaimSetRange | null
|
|
6034
|
+
group: ClaimSetRange | null
|
|
5969
6035
|
}
|
|
5970
6036
|
```
|
|
5971
6037
|
|
|
@@ -5993,6 +6059,48 @@ type ClaimSetScope = { collectionId: string }
|
|
|
5993
6059
|
|
|
5994
6060
|
**ClaimSetImportResult** = ``
|
|
5995
6061
|
|
|
6062
|
+
### clientLog
|
|
6063
|
+
|
|
6064
|
+
**ClientErrorReport** (interface)
|
|
6065
|
+
```typescript
|
|
6066
|
+
interface ClientErrorReport {
|
|
6067
|
+
app?: string
|
|
6068
|
+
appVersion?: string
|
|
6069
|
+
collectionId?: string
|
|
6070
|
+
operation?: string
|
|
6071
|
+
severity?: 'debug' | 'info' | 'warning' | 'error' | 'critical'
|
|
6072
|
+
errorCode?: string
|
|
6073
|
+
errorType?: string
|
|
6074
|
+
message?: string
|
|
6075
|
+
stack?: string
|
|
6076
|
+
entityType?: string
|
|
6077
|
+
entityId?: string
|
|
6078
|
+
labels?: Record<string, unknown>
|
|
6079
|
+
context?: Record<string, unknown>
|
|
6080
|
+
refId?: string
|
|
6081
|
+
correlationId?: string
|
|
6082
|
+
}
|
|
6083
|
+
```
|
|
6084
|
+
|
|
6085
|
+
**ClientErrorEvent** (interface)
|
|
6086
|
+
```typescript
|
|
6087
|
+
interface ClientErrorEvent {
|
|
6088
|
+
id: string
|
|
6089
|
+
time: string
|
|
6090
|
+
event_category: string
|
|
6091
|
+
event_action: string | null
|
|
6092
|
+
log_level: string
|
|
6093
|
+
error_code: string | null
|
|
6094
|
+
error_message: string | null
|
|
6095
|
+
service_name: string | null
|
|
6096
|
+
service_version: string | null
|
|
6097
|
+
collection_id: string | null
|
|
6098
|
+
user_id: string | null
|
|
6099
|
+
labels: Record<string, unknown> | null
|
|
6100
|
+
context: Record<string, unknown> | null
|
|
6101
|
+
}
|
|
6102
|
+
```
|
|
6103
|
+
|
|
5996
6104
|
### collection
|
|
5997
6105
|
|
|
5998
6106
|
**Collection** (interface)
|
|
@@ -7263,6 +7371,7 @@ interface Container {
|
|
|
7263
7371
|
status: ContainerStatus
|
|
7264
7372
|
metadata?: Record<string, any>
|
|
7265
7373
|
parentContainerId?: string
|
|
7374
|
+
fixed?: boolean
|
|
7266
7375
|
children?: Container[]
|
|
7267
7376
|
items?: ContainerItem[]
|
|
7268
7377
|
createdAt: string
|
|
@@ -7298,6 +7407,7 @@ interface CreateContainerInput {
|
|
|
7298
7407
|
status?: ContainerStatus
|
|
7299
7408
|
metadata?: Record<string, any>
|
|
7300
7409
|
parentContainerId?: string
|
|
7410
|
+
fixed?: boolean
|
|
7301
7411
|
}
|
|
7302
7412
|
```
|
|
7303
7413
|
|
|
@@ -7311,6 +7421,7 @@ interface UpdateContainerInput {
|
|
|
7311
7421
|
status?: ContainerStatus
|
|
7312
7422
|
metadata?: Record<string, any>
|
|
7313
7423
|
parentContainerId?: string | null
|
|
7424
|
+
fixed?: boolean
|
|
7314
7425
|
}
|
|
7315
7426
|
```
|
|
7316
7427
|
|
|
@@ -7801,6 +7912,8 @@ interface IframeResponderOptions {
|
|
|
7801
7912
|
) => Promise<void>;
|
|
7802
7913
|
onAuthLogout?: () => Promise<void>;
|
|
7803
7914
|
onRouteChange?: (path: string, state: Record<string, string>) => void;
|
|
7915
|
+
onNavigable?: (info: { views: string[]; chrome: 'none' | 'full' }) => void;
|
|
7916
|
+
onNavigateResult?: (result: { ok: boolean; view: string | null; path: string | null; reason?: string }) => void;
|
|
7804
7917
|
autoHeight?: boolean | { minHeight?: number };
|
|
7805
7918
|
onResize?: (height: number) => void;
|
|
7806
7919
|
onError?: (error: Error) => void;
|
|
@@ -7830,7 +7943,9 @@ interface SmartlinksIframeMessage {
|
|
|
7830
7943
|
| 'smartlinks:redirect'
|
|
7831
7944
|
| 'smartlinks:authkit:login'
|
|
7832
7945
|
| 'smartlinks:authkit:logout'
|
|
7833
|
-
| 'smartlinks:authkit:redirect'
|
|
7946
|
+
| 'smartlinks:authkit:redirect'
|
|
7947
|
+
| 'smartlinks:navigable'
|
|
7948
|
+
| 'smartlinks:navigate-result';
|
|
7834
7949
|
payload: Record<string, any>;
|
|
7835
7950
|
messageId?: string;
|
|
7836
7951
|
}
|
|
@@ -9556,6 +9671,355 @@ interface TagContext {
|
|
|
9556
9671
|
|
|
9557
9672
|
**TagStatus** = `'valid' | 'rescan' | 'invalid' | 'error'`
|
|
9558
9673
|
|
|
9674
|
+
### operations
|
|
9675
|
+
|
|
9676
|
+
**WorkOrderStage** (interface)
|
|
9677
|
+
```typescript
|
|
9678
|
+
interface WorkOrderStage {
|
|
9679
|
+
key: string
|
|
9680
|
+
position: number
|
|
9681
|
+
status: WorkOrderStageStatus
|
|
9682
|
+
plannedStart: string | null
|
|
9683
|
+
plannedEnd: string | null
|
|
9684
|
+
startedAt: string | null
|
|
9685
|
+
doneAt: string | null
|
|
9686
|
+
quantityDone: number
|
|
9687
|
+
quantityScrapped: number
|
|
9688
|
+
data: Record<string, any>
|
|
9689
|
+
}
|
|
9690
|
+
```
|
|
9691
|
+
|
|
9692
|
+
**WorkOrder** (interface)
|
|
9693
|
+
```typescript
|
|
9694
|
+
interface WorkOrder {
|
|
9695
|
+
id: string
|
|
9696
|
+
collectionId: string
|
|
9697
|
+
appId: string
|
|
9698
|
+
ref: string
|
|
9699
|
+
kind: string | null
|
|
9700
|
+
productId: string | null
|
|
9701
|
+
variantId: string | null
|
|
9702
|
+
quantity: number
|
|
9703
|
+
unit: string
|
|
9704
|
+
dueAt: string | null
|
|
9705
|
+
priority: number
|
|
9706
|
+
status: WorkOrderStatus
|
|
9707
|
+
statusReason: string | null
|
|
9708
|
+
orderId: string | null
|
|
9709
|
+
orderItemId: string | null
|
|
9710
|
+
parentId: string | null
|
|
9711
|
+
outputBatchId: string | null
|
|
9712
|
+
stages: WorkOrderStage[]
|
|
9713
|
+
currentStage: string | null
|
|
9714
|
+
late: boolean
|
|
9715
|
+
data: Record<string, any>
|
|
9716
|
+
createdBy: string | null
|
|
9717
|
+
createdAt: string
|
|
9718
|
+
updatedAt: string
|
|
9719
|
+
closedAt: string | null
|
|
9720
|
+
}
|
|
9721
|
+
```
|
|
9722
|
+
|
|
9723
|
+
**CreateWorkOrderInput** (interface)
|
|
9724
|
+
```typescript
|
|
9725
|
+
interface CreateWorkOrderInput {
|
|
9726
|
+
ref: string
|
|
9727
|
+
kind?: string
|
|
9728
|
+
productId?: string
|
|
9729
|
+
variantId?: string
|
|
9730
|
+
quantity?: number
|
|
9731
|
+
unit?: string
|
|
9732
|
+
dueAt?: string | null
|
|
9733
|
+
priority?: number
|
|
9734
|
+
orderId?: string
|
|
9735
|
+
orderItemId?: string
|
|
9736
|
+
parentId?: string
|
|
9737
|
+
outputBatchId?: string
|
|
9738
|
+
data?: Record<string, any>
|
|
9739
|
+
stages?: WorkOrderStageInput[]
|
|
9740
|
+
}
|
|
9741
|
+
```
|
|
9742
|
+
|
|
9743
|
+
**WorkOrderListParams** (interface)
|
|
9744
|
+
```typescript
|
|
9745
|
+
interface WorkOrderListParams {
|
|
9746
|
+
status?: WorkOrderStatus | WorkOrderStatus[]
|
|
9747
|
+
appId?: string
|
|
9748
|
+
productId?: string
|
|
9749
|
+
orderId?: string
|
|
9750
|
+
parentId?: string
|
|
9751
|
+
kind?: string
|
|
9752
|
+
late?: boolean
|
|
9753
|
+
dueFrom?: string
|
|
9754
|
+
dueTo?: string
|
|
9755
|
+
q?: string
|
|
9756
|
+
sort?: 'due' | 'priority' | 'created' | 'ref'
|
|
9757
|
+
limit?: number
|
|
9758
|
+
offset?: number
|
|
9759
|
+
}
|
|
9760
|
+
```
|
|
9761
|
+
|
|
9762
|
+
**WorkOrdersApi** (interface)
|
|
9763
|
+
```typescript
|
|
9764
|
+
interface WorkOrdersApi {
|
|
9765
|
+
get(idOrRef: string): Promise<WorkOrder | null>
|
|
9766
|
+
list(params?: WorkOrderListParams): Promise<{ items: WorkOrder[]; total: number; limit: number; offset: number }>
|
|
9767
|
+
create(input: CreateWorkOrderInput): Promise<WorkOrder>
|
|
9768
|
+
update(idOrRef: string, patch: UpdateWorkOrderInput, opts?: { reason?: string }): Promise<WorkOrder>
|
|
9769
|
+
setStatus(idOrRef: string, status: WorkOrderStatus, opts?: { reason?: string }): Promise<WorkOrder>
|
|
9770
|
+
remove(idOrRef: string): Promise<{ id: string; deleted: true }>
|
|
9771
|
+
startStage(idOrRef: string, stage: string): Promise<WorkOrder>
|
|
9772
|
+
progress(idOrRef: string, stage: string, by: { done?: number; scrapped?: number }, opts?: { reason?: string; note?: string }): Promise<WorkOrder>
|
|
9773
|
+
completeStage(idOrRef: string, stage: string, opts?: { closeWorkOrder?: boolean }): Promise<WorkOrder>
|
|
9774
|
+
skipStage(idOrRef: string, stage: string, opts: { reason: string }): Promise<WorkOrder>
|
|
9775
|
+
planStage(idOrRef: string, stage: string, plan: { plannedStart?: string | null; plannedEnd?: string | null; data?: Record<string, any> }): Promise<WorkOrder>
|
|
9776
|
+
setStages(idOrRef: string, stages: WorkOrderStageInput[]): Promise<WorkOrder>
|
|
9777
|
+
}
|
|
9778
|
+
```
|
|
9779
|
+
|
|
9780
|
+
**StockTarget** (interface)
|
|
9781
|
+
```typescript
|
|
9782
|
+
interface StockTarget {
|
|
9783
|
+
type: string; id: string
|
|
9784
|
+
}
|
|
9785
|
+
```
|
|
9786
|
+
|
|
9787
|
+
**StockLine** (interface)
|
|
9788
|
+
```typescript
|
|
9789
|
+
interface StockLine {
|
|
9790
|
+
id: string
|
|
9791
|
+
containerId: string
|
|
9792
|
+
productId: string
|
|
9793
|
+
variantId: string | null
|
|
9794
|
+
batchId: string | null
|
|
9795
|
+
state: StockState
|
|
9796
|
+
allocatedTo: StockTarget | null
|
|
9797
|
+
quantity: number
|
|
9798
|
+
unit: string
|
|
9799
|
+
updatedAt: string
|
|
9800
|
+
}
|
|
9801
|
+
```
|
|
9802
|
+
|
|
9803
|
+
**StockTotals** (interface)
|
|
9804
|
+
```typescript
|
|
9805
|
+
interface StockTotals {
|
|
9806
|
+
available: number; allocated: number; held: number; quarantine: number; total: number; unit: string | null
|
|
9807
|
+
}
|
|
9808
|
+
```
|
|
9809
|
+
|
|
9810
|
+
**StockItem** (interface)
|
|
9811
|
+
```typescript
|
|
9812
|
+
interface StockItem {
|
|
9813
|
+
productId: string; variantId?: string; batchId?: string; quantity: number; unit?: string
|
|
9814
|
+
}
|
|
9815
|
+
```
|
|
9816
|
+
|
|
9817
|
+
**StockMovementExtras** (interface)
|
|
9818
|
+
```typescript
|
|
9819
|
+
interface StockMovementExtras {
|
|
9820
|
+
workOrderId?: string; reason?: string; note?: string
|
|
9821
|
+
}
|
|
9822
|
+
```
|
|
9823
|
+
|
|
9824
|
+
**StockMovementOptions** (interface)
|
|
9825
|
+
```typescript
|
|
9826
|
+
interface StockMovementOptions {
|
|
9827
|
+
idempotencyKey?: string
|
|
9828
|
+
}
|
|
9829
|
+
```
|
|
9830
|
+
|
|
9831
|
+
**StockMovement** (interface)
|
|
9832
|
+
```typescript
|
|
9833
|
+
interface StockMovement {
|
|
9834
|
+
movementId: string
|
|
9835
|
+
kind: 'receive' | 'produce' | 'consume' | 'move' | 'allocate' | 'release' | 'hold' | 'unhold' | 'adjust'
|
|
9836
|
+
productId: string
|
|
9837
|
+
quantity: number
|
|
9838
|
+
unit: string
|
|
9839
|
+
from?: (StockLine & { emptied?: boolean }) | null
|
|
9840
|
+
to?: StockLine | null
|
|
9841
|
+
replayed: boolean
|
|
9842
|
+
}
|
|
9843
|
+
```
|
|
9844
|
+
|
|
9845
|
+
**StockPosition** (interface)
|
|
9846
|
+
```typescript
|
|
9847
|
+
interface StockPosition {
|
|
9848
|
+
product: { id: string; variantId: string | null; name: string | null; unit: string | null }
|
|
9849
|
+
onHand: StockTotals
|
|
9850
|
+
where: Array<{ containerId: string; container: StockWhereLine['container']; path: string; place: StockWhereLine['place']; quantity: number; batchId: string | null; state: StockState; allocatedTo: StockTarget | null }>
|
|
9851
|
+
onOrder: { total: number; lines: Array<{ orderId: string; orderRef: string | null; supplier: string | null; quantity: number; dueAt: string | null }> }
|
|
9852
|
+
beingMade: { total: number; lines: Array<{ workOrderId: string; ref: string; quantity: number; stage: string | null; status: WorkOrderStatus; dueAt: string | null }> }
|
|
9853
|
+
needed: { total: number; lines: Array<{ orderId?: string; orderRef?: string | null; workOrderId?: string; ref?: string; forProductId: string; quantity: number; neededBy: string | null; why: 'ordered' | 'work order' | 'order, not yet in production' }> }
|
|
9854
|
+
projected: Array<{ date: string; balance: number }>
|
|
9855
|
+
shortfall: { quantity: number; firstShortOn: string } | null
|
|
9856
|
+
horizonDays: number
|
|
9857
|
+
undatedLines?: number
|
|
9858
|
+
asOf: string
|
|
9859
|
+
sources: { stock: string; orders: string; workOrders: string }
|
|
9860
|
+
}
|
|
9861
|
+
```
|
|
9862
|
+
|
|
9863
|
+
**StockApi** (interface)
|
|
9864
|
+
```typescript
|
|
9865
|
+
interface StockApi {
|
|
9866
|
+
lines(params?: { containerId?: string; productId?: string; variantId?: string; batchId?: string; state?: StockState; allocatedTo?: StockTarget; limit?: number; offset?: number }): Promise<{ items: StockLine[]; total: number; limit: number; offset: number }>
|
|
9867
|
+
totals(params: { productId: string; variantId?: string; batchId?: string }): Promise<StockTotals>
|
|
9868
|
+
where(params: { productId: string; variantId?: string; batchId?: string; state?: StockState }): Promise<StockWhereLine[]>
|
|
9869
|
+
position(params: { productId: string; variantId?: string; horizonDays?: number; includeWhere?: boolean }): Promise<StockPosition>
|
|
9870
|
+
short(params?: { horizonDays?: number; limit?: number }): Promise<{ horizonDays: number; items: Array<{ product: StockPosition['product']; shortfall: NonNullable<StockPosition['shortfall']>; onHand: StockTotals; onOrder: number; beingMade: number; needed: number }>; checked: number; asOf: string }>
|
|
9871
|
+
receive(input: StockItem & StockMovementExtras & { containerId: string; state?: 'available' | 'held' | 'quarantine' }, opts?: StockMovementOptions): Promise<StockMovement>
|
|
9872
|
+
produce(input: StockItem & StockMovementExtras & { containerId: string; state?: 'available' | 'held' | 'quarantine' }, opts?: StockMovementOptions): Promise<StockMovement>
|
|
9873
|
+
consume(input: StockItem & StockMovementExtras & { containerId: string; allocatedTo?: StockTarget }, opts?: StockMovementOptions): Promise<StockMovement>
|
|
9874
|
+
move(input: StockItem & StockMovementExtras & { from: string; to: string; state?: StockState; allocatedTo?: StockTarget }, opts?: StockMovementOptions): Promise<StockMovement>
|
|
9875
|
+
allocate(input: StockItem & StockMovementExtras & { containerId: string; to: StockTarget }, opts?: StockMovementOptions): Promise<StockMovement>
|
|
9876
|
+
release(input: StockItem & StockMovementExtras & { containerId: string; from: StockTarget }, opts?: StockMovementOptions): Promise<StockMovement>
|
|
9877
|
+
hold(input: StockItem & StockMovementExtras & { containerId: string; state?: 'held' | 'quarantine'; reason: string }, opts?: StockMovementOptions): Promise<StockMovement>
|
|
9878
|
+
unhold(input: StockItem & StockMovementExtras & { containerId: string; state?: 'held' | 'quarantine'; reason: string }, opts?: StockMovementOptions): Promise<StockMovement>
|
|
9879
|
+
adjust(input: Omit<StockItem, 'quantity'> & StockMovementExtras & { containerId: string; by: number; state?: 'available' | 'held' | 'quarantine'; reason: string }, opts?: StockMovementOptions): Promise<StockMovement>
|
|
9880
|
+
}
|
|
9881
|
+
```
|
|
9882
|
+
|
|
9883
|
+
**BomLine** (interface)
|
|
9884
|
+
```typescript
|
|
9885
|
+
interface BomLine {
|
|
9886
|
+
componentProductId: string; componentVariantId?: string | null; quantity: number; unit?: string; optional?: boolean; note?: string | null
|
|
9887
|
+
}
|
|
9888
|
+
```
|
|
9889
|
+
|
|
9890
|
+
**Bom** (interface)
|
|
9891
|
+
```typescript
|
|
9892
|
+
interface Bom {
|
|
9893
|
+
id: string
|
|
9894
|
+
productId: string
|
|
9895
|
+
variantId: string | null
|
|
9896
|
+
version: number
|
|
9897
|
+
validFrom: string
|
|
9898
|
+
validTo: string | null
|
|
9899
|
+
yields: number
|
|
9900
|
+
note: string | null
|
|
9901
|
+
lines: Array<{ componentProductId: string; componentVariantId: string | null; quantity: number; unit: string; optional: boolean; note: string | null }>
|
|
9902
|
+
data: Record<string, any>
|
|
9903
|
+
createdBy: string | null
|
|
9904
|
+
createdAt: string
|
|
9905
|
+
}
|
|
9906
|
+
```
|
|
9907
|
+
|
|
9908
|
+
**BomTreeNode** (interface)
|
|
9909
|
+
```typescript
|
|
9910
|
+
interface BomTreeNode {
|
|
9911
|
+
productId: string; variantId: string | null; quantity: number; unit: string; optional: boolean; components: BomTreeNode[]
|
|
9912
|
+
}
|
|
9913
|
+
```
|
|
9914
|
+
|
|
9915
|
+
**BomExplosion** (interface)
|
|
9916
|
+
```typescript
|
|
9917
|
+
interface BomExplosion {
|
|
9918
|
+
productId: string
|
|
9919
|
+
variantId: string | null
|
|
9920
|
+
quantity: number
|
|
9921
|
+
hasBom: boolean
|
|
9922
|
+
tree: BomTreeNode[]
|
|
9923
|
+
materials: Array<{ productId: string; variantId: string | null; quantity: number; unit: string }>
|
|
9924
|
+
}
|
|
9925
|
+
```
|
|
9926
|
+
|
|
9927
|
+
**BomsApi** (interface)
|
|
9928
|
+
```typescript
|
|
9929
|
+
interface BomsApi {
|
|
9930
|
+
current(params: { productId: string; variantId?: string; at?: string }): Promise<Bom | null>
|
|
9931
|
+
versions(params: { productId: string; variantId?: string }): Promise<Bom[]>
|
|
9932
|
+
whereUsed(params: { componentProductId: string }): Promise<Array<{ productId: string; variantId: string | null; quantity: number; unit: string; yields: number; optional: boolean }>>
|
|
9933
|
+
explode(params: { productId: string; variantId?: string; quantity?: number; at?: string; includeOptional?: boolean }): Promise<BomExplosion>
|
|
9934
|
+
set(input: { productId: string; variantId?: string; lines: BomLine[]; yields?: number; note?: string; validFrom?: string; data?: Record<string, any> }): Promise<Bom>
|
|
9935
|
+
end(params: { productId: string; variantId?: string }): Promise<Bom | null>
|
|
9936
|
+
}
|
|
9937
|
+
```
|
|
9938
|
+
|
|
9939
|
+
**MadeFromSubject** (interface)
|
|
9940
|
+
```typescript
|
|
9941
|
+
interface MadeFromSubject {
|
|
9942
|
+
type: 'batch' | 'proof'; id: string
|
|
9943
|
+
}
|
|
9944
|
+
```
|
|
9945
|
+
|
|
9946
|
+
**MadeFromSource** (interface)
|
|
9947
|
+
```typescript
|
|
9948
|
+
interface MadeFromSource {
|
|
9949
|
+
type: 'batch' | 'proof' | 'product'; id: string
|
|
9950
|
+
}
|
|
9951
|
+
```
|
|
9952
|
+
|
|
9953
|
+
**MadeFromEntry** (interface)
|
|
9954
|
+
```typescript
|
|
9955
|
+
interface MadeFromEntry {
|
|
9956
|
+
id: string
|
|
9957
|
+
subject: MadeFromSubject
|
|
9958
|
+
source: MadeFromSource
|
|
9959
|
+
productId: string | null
|
|
9960
|
+
quantity: number | null
|
|
9961
|
+
unit: string | null
|
|
9962
|
+
workOrderId: string | null
|
|
9963
|
+
at: string
|
|
9964
|
+
by: string | null
|
|
9965
|
+
endedAt: string | null
|
|
9966
|
+
data: Record<string, any>
|
|
9967
|
+
}
|
|
9968
|
+
```
|
|
9969
|
+
|
|
9970
|
+
**MadeFromTraceNode** (interface)
|
|
9971
|
+
```typescript
|
|
9972
|
+
interface MadeFromTraceNode {
|
|
9973
|
+
source: MadeFromSource; productId: string | null; quantity: number | null; unit: string | null; at: string; workOrderId: string | null; madeFrom: MadeFromTraceNode[]
|
|
9974
|
+
}
|
|
9975
|
+
```
|
|
9976
|
+
|
|
9977
|
+
**MadeFromApi** (interface)
|
|
9978
|
+
```typescript
|
|
9979
|
+
interface MadeFromApi {
|
|
9980
|
+
of(subject: MadeFromSubject, opts?: { at?: string; includeEnded?: boolean }): Promise<MadeFromEntry[]>
|
|
9981
|
+
usedIn(source: MadeFromSource, opts?: { includeEnded?: boolean }): Promise<MadeFromEntry[]>
|
|
9982
|
+
trace(subject: MadeFromSubject, opts?: { depth?: number }): Promise<{ subject: MadeFromSubject; madeFrom: MadeFromTraceNode[] }>
|
|
9983
|
+
record(input: { subject: MadeFromSubject; sources: Array<MadeFromSource & { productId?: string; quantity?: number; unit?: string; data?: Record<string, any> }>; workOrderId?: string; at?: string }): Promise<MadeFromEntry[]>
|
|
9984
|
+
end(id: string, opts: { reason: string }): Promise<MadeFromEntry>
|
|
9985
|
+
}
|
|
9986
|
+
```
|
|
9987
|
+
|
|
9988
|
+
**OperationStep** (interface)
|
|
9989
|
+
```typescript
|
|
9990
|
+
interface OperationStep {
|
|
9991
|
+
op: string; args: any[]
|
|
9992
|
+
}
|
|
9993
|
+
```
|
|
9994
|
+
|
|
9995
|
+
**OperationsApi** (interface)
|
|
9996
|
+
```typescript
|
|
9997
|
+
interface OperationsApi {
|
|
9998
|
+
transaction(steps: OperationStep[]): Promise<{ results: any[] }>
|
|
9999
|
+
}
|
|
10000
|
+
```
|
|
10001
|
+
|
|
10002
|
+
**OperationsAdmin** (interface)
|
|
10003
|
+
```typescript
|
|
10004
|
+
interface OperationsAdmin {
|
|
10005
|
+
workOrders: WorkOrdersApi
|
|
10006
|
+
stock: StockApi
|
|
10007
|
+
boms: BomsApi
|
|
10008
|
+
madeFrom: MadeFromApi
|
|
10009
|
+
transaction: OperationsApi['transaction']
|
|
10010
|
+
}
|
|
10011
|
+
```
|
|
10012
|
+
|
|
10013
|
+
**WorkOrderStatus** = `'open' | 'on-hold' | 'blocked' | 'done' | 'cancelled'`
|
|
10014
|
+
|
|
10015
|
+
**WorkOrderStageStatus** = `'pending' | 'active' | 'done' | 'skipped'`
|
|
10016
|
+
|
|
10017
|
+
**WorkOrderStageInput** = `string | { key: string`
|
|
10018
|
+
|
|
10019
|
+
**UpdateWorkOrderInput** = `Partial<Omit<CreateWorkOrderInput, 'ref' | 'stages' | 'parentId'>>`
|
|
10020
|
+
|
|
10021
|
+
**StockState** = `'available' | 'allocated' | 'held' | 'quarantine'`
|
|
10022
|
+
|
|
9559
10023
|
### order
|
|
9560
10024
|
|
|
9561
10025
|
**OrderItem** (interface)
|
|
@@ -9563,18 +10027,44 @@ interface TagContext {
|
|
|
9563
10027
|
interface OrderItem {
|
|
9564
10028
|
id: string // UUID
|
|
9565
10029
|
orderId: string // Parent order ID
|
|
9566
|
-
itemType: 'tag' | 'proof' | 'serial' // Type of item
|
|
9567
|
-
itemId: string // The tag ID, proof ID, or serial number
|
|
10030
|
+
itemType: 'tag' | 'proof' | 'serial' | 'product' // Type of item ('product' = a quantity line)
|
|
10031
|
+
itemId: string // The tag ID, proof ID, or serial number (the product ID on a quantity line)
|
|
9568
10032
|
collectionId?: string // Collection ID
|
|
9569
10033
|
productId?: string // Product ID
|
|
9570
10034
|
variantId?: string | null // Variant ID
|
|
9571
10035
|
batchId?: string | null // Batch ID
|
|
10036
|
+
quantity: number // How many (1 for an identified thing)
|
|
10037
|
+
unit?: string | null // The unit the quantity is in
|
|
10038
|
+
quantityDone: number // Shipped (sales) or received (purchase) so far
|
|
10039
|
+
dueAt?: string | null // When this line is wanted or expected, if different from the order's
|
|
9572
10040
|
metadata: Record<string, any> // Item-specific metadata
|
|
9573
10041
|
createdAt: string // ISO 8601 timestamp
|
|
9574
10042
|
order?: OrderSummary // Optional order summary (when includeOrder=true)
|
|
9575
10043
|
}
|
|
9576
10044
|
```
|
|
9577
10045
|
|
|
10046
|
+
**OrderItemInput** (interface)
|
|
10047
|
+
```typescript
|
|
10048
|
+
interface OrderItemInput {
|
|
10049
|
+
itemType: 'tag' | 'proof' | 'serial' // Required: Type of item
|
|
10050
|
+
itemId: string // Required: Item identifier
|
|
10051
|
+
metadata?: Record<string, any> // Optional: Item-specific data
|
|
10052
|
+
}
|
|
10053
|
+
```
|
|
10054
|
+
|
|
10055
|
+
**OrderQuantityLineInput** (interface)
|
|
10056
|
+
```typescript
|
|
10057
|
+
interface OrderQuantityLineInput {
|
|
10058
|
+
itemType?: 'product'
|
|
10059
|
+
productId: string // Required: The product
|
|
10060
|
+
variantId?: string
|
|
10061
|
+
quantity: number // Required: How many
|
|
10062
|
+
unit?: string
|
|
10063
|
+
dueAt?: string // Optional: When this line is wanted or expected
|
|
10064
|
+
metadata?: Record<string, any>
|
|
10065
|
+
}
|
|
10066
|
+
```
|
|
10067
|
+
|
|
9578
10068
|
**OrderSummary** (interface)
|
|
9579
10069
|
```typescript
|
|
9580
10070
|
interface OrderSummary {
|
|
@@ -9595,6 +10085,9 @@ interface Order {
|
|
|
9595
10085
|
orderRef?: string // Customer's own order reference/ID (e.g., "ORD-12345")
|
|
9596
10086
|
customerId?: string // Customer's own customer ID (can map to CRM/contacts)
|
|
9597
10087
|
status: string // e.g., "pending", "processing", "shipped", "completed"
|
|
10088
|
+
direction: OrderDirection // 'sales' (someone wants it from us) or 'purchase' (we want it from a supplier)
|
|
10089
|
+
partyId?: string | null // The supplier, on a purchase order
|
|
10090
|
+
dueAt?: string | null // When it is wanted or expected
|
|
9598
10091
|
itemCount: number // Cached count of items (maintained automatically)
|
|
9599
10092
|
metadata: {
|
|
9600
10093
|
productSummary?: Record<string, number> // productId -> count (auto-maintained)
|
|
@@ -9609,11 +10102,10 @@ interface Order {
|
|
|
9609
10102
|
**CreateOrderRequest** (interface)
|
|
9610
10103
|
```typescript
|
|
9611
10104
|
interface CreateOrderRequest {
|
|
9612
|
-
items: Array<
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
}>
|
|
10105
|
+
items: Array<OrderItemInput | OrderQuantityLineInput>
|
|
10106
|
+
direction?: OrderDirection // Optional: 'sales' (default) or 'purchase'
|
|
10107
|
+
partyId?: string // Optional: The supplier, on a purchase order
|
|
10108
|
+
dueAt?: string // Optional: When it is wanted or expected
|
|
9617
10109
|
orderRef?: string // Optional: Your own order reference/ID
|
|
9618
10110
|
customerId?: string // Optional: Your customer ID
|
|
9619
10111
|
status?: string // Optional: Order status (default: "pending")
|
|
@@ -9631,6 +10123,9 @@ interface GetOrderParams {
|
|
|
9631
10123
|
**UpdateOrderRequest** (interface)
|
|
9632
10124
|
```typescript
|
|
9633
10125
|
interface UpdateOrderRequest {
|
|
10126
|
+
direction?: OrderDirection // Optional: 'sales' or 'purchase'
|
|
10127
|
+
partyId?: string | null // Optional: The supplier
|
|
10128
|
+
dueAt?: string | null // Optional: When it is wanted or expected
|
|
9634
10129
|
orderRef?: string // Optional: Update order reference
|
|
9635
10130
|
customerId?: string // Optional: Update customer ID
|
|
9636
10131
|
status?: string // Optional: Update status
|
|
@@ -9653,6 +10148,8 @@ interface ListOrdersRequest {
|
|
|
9653
10148
|
status?: string // Optional: Filter by status
|
|
9654
10149
|
orderRef?: string // Optional: Filter by order reference
|
|
9655
10150
|
customerId?: string // Optional: Filter by customer ID
|
|
10151
|
+
direction?: OrderDirection // Optional: Only sales, or only purchase, orders
|
|
10152
|
+
partyId?: string // Optional: Filter by supplier
|
|
9656
10153
|
includeItems?: boolean // Optional: Include items array (default: false)
|
|
9657
10154
|
}
|
|
9658
10155
|
```
|
|
@@ -10042,6 +10539,8 @@ interface CollectionSummaryResponse {
|
|
|
10042
10539
|
}
|
|
10043
10540
|
```
|
|
10044
10541
|
|
|
10542
|
+
**OrderDirection** = `'sales' | 'purchase'`
|
|
10543
|
+
|
|
10045
10544
|
### product
|
|
10046
10545
|
|
|
10047
10546
|
**ProductKey** (interface)
|
|
@@ -11048,6 +11547,107 @@ interface TranslationUpdateRequest {
|
|
|
11048
11547
|
|
|
11049
11548
|
**TranslationLookupRequest** = `TranslationLookupSingleRequest | TranslationLookupBatchRequest`
|
|
11050
11549
|
|
|
11550
|
+
### userGroups
|
|
11551
|
+
|
|
11552
|
+
**UserGroup** (interface)
|
|
11553
|
+
```typescript
|
|
11554
|
+
interface UserGroup {
|
|
11555
|
+
id: string
|
|
11556
|
+
collectionId?: string
|
|
11557
|
+
key?: string
|
|
11558
|
+
name: string
|
|
11559
|
+
description?: string
|
|
11560
|
+
members?: string[]
|
|
11561
|
+
createdAt?: string
|
|
11562
|
+
updatedAt?: string
|
|
11563
|
+
deleted?: boolean
|
|
11564
|
+
deletedAt?: string | null
|
|
11565
|
+
[extra: string]: any
|
|
11566
|
+
}
|
|
11567
|
+
```
|
|
11568
|
+
|
|
11569
|
+
**CreateUserGroupRequest** (interface)
|
|
11570
|
+
```typescript
|
|
11571
|
+
interface CreateUserGroupRequest {
|
|
11572
|
+
name: string
|
|
11573
|
+
key?: string
|
|
11574
|
+
description?: string
|
|
11575
|
+
members?: string[]
|
|
11576
|
+
[extra: string]: any
|
|
11577
|
+
}
|
|
11578
|
+
```
|
|
11579
|
+
|
|
11580
|
+
**UpdateUserGroupRequest** (interface)
|
|
11581
|
+
```typescript
|
|
11582
|
+
interface UpdateUserGroupRequest {
|
|
11583
|
+
name?: string
|
|
11584
|
+
description?: string
|
|
11585
|
+
members?: string[]
|
|
11586
|
+
[extra: string]: any
|
|
11587
|
+
}
|
|
11588
|
+
```
|
|
11589
|
+
|
|
11590
|
+
**UserGroupMember** (interface)
|
|
11591
|
+
```typescript
|
|
11592
|
+
interface UserGroupMember {
|
|
11593
|
+
uid: string
|
|
11594
|
+
name?: string | null
|
|
11595
|
+
email?: string | null
|
|
11596
|
+
}
|
|
11597
|
+
```
|
|
11598
|
+
|
|
11599
|
+
**UserGroupRef** (interface)
|
|
11600
|
+
```typescript
|
|
11601
|
+
interface UserGroupRef {
|
|
11602
|
+
id: string
|
|
11603
|
+
key: string | null
|
|
11604
|
+
name: string | null
|
|
11605
|
+
}
|
|
11606
|
+
```
|
|
11607
|
+
|
|
11608
|
+
**MyUserGroups** (interface)
|
|
11609
|
+
```typescript
|
|
11610
|
+
interface MyUserGroups {
|
|
11611
|
+
userGroups: string[]
|
|
11612
|
+
userGroupIds: string[]
|
|
11613
|
+
}
|
|
11614
|
+
```
|
|
11615
|
+
|
|
11616
|
+
**UserGroupChange** (interface)
|
|
11617
|
+
```typescript
|
|
11618
|
+
interface UserGroupChange {
|
|
11619
|
+
id: string
|
|
11620
|
+
at: string
|
|
11621
|
+
type: UserGroupChangeType
|
|
11622
|
+
entityId: string | null
|
|
11623
|
+
data: {
|
|
11624
|
+
userGroupId: string
|
|
11625
|
+
key: string | null
|
|
11626
|
+
name: string | null
|
|
11627
|
+
userId?: string
|
|
11628
|
+
previousName?: string | null
|
|
11629
|
+
members?: string[]
|
|
11630
|
+
}
|
|
11631
|
+
actorType: string | null
|
|
11632
|
+
actorId: string | null
|
|
11633
|
+
}
|
|
11634
|
+
```
|
|
11635
|
+
|
|
11636
|
+
**UserGroupHistoryParams** (interface)
|
|
11637
|
+
```typescript
|
|
11638
|
+
interface UserGroupHistoryParams {
|
|
11639
|
+
userGroupId?: string
|
|
11640
|
+
userId?: string
|
|
11641
|
+
from?: string
|
|
11642
|
+
to?: string
|
|
11643
|
+
limit?: number
|
|
11644
|
+
}
|
|
11645
|
+
```
|
|
11646
|
+
|
|
11647
|
+
**AddUserGroupMemberRequest** = ``
|
|
11648
|
+
|
|
11649
|
+
**UserGroupChangeType** = ``
|
|
11650
|
+
|
|
11051
11651
|
### variant
|
|
11052
11652
|
|
|
11053
11653
|
**VariantResponse** (interface)
|
|
@@ -12830,6 +13430,10 @@ Update a crate for a collection (admin only). ```typescript const updated = awai
|
|
|
12830
13430
|
crateId: string) → `Promise<DeleteCrateResponse>`
|
|
12831
13431
|
Delete a crate for a collection (admin only). This performs a soft delete. ```typescript await crate.remove('coll_123', 'crate_abc123') ```
|
|
12832
13432
|
|
|
13433
|
+
### errors
|
|
13434
|
+
|
|
13435
|
+
**report**(event: ClientErrorReport) → `Promise<`
|
|
13436
|
+
|
|
12833
13437
|
### facets
|
|
12834
13438
|
|
|
12835
13439
|
**list**(collectionId: string,
|
|
@@ -13348,97 +13952,108 @@ Validate an NFC tag payload (public). POST /public/nfc/validate
|
|
|
13348
13952
|
**lookupTag**(tagId: string) → `Promise<NfcTagInfo[]>`
|
|
13349
13953
|
Lookup a tag by its ID (public). GET /public/nfc/findByTag/:tagId
|
|
13350
13954
|
|
|
13955
|
+
### operations
|
|
13956
|
+
|
|
13957
|
+
**admin**(collectionId: string, opts: { appId?: string } = {}) → `OperationsAdmin`
|
|
13958
|
+
The operations objects for one collection (admin). but a work order is always created for an app, so `workOrders.create` needs this. ```typescript const ops = operations.admin('coll_123', { appId: 'production' }) const caps = await ops.stock.position({ productId: 'brass-cap', horizonDays: 90 }) caps.onHand.available // 400 caps.shortfall // { quantity: 140, firstShortOn: '2026-12-14' } | null await ops.stock.move({ from: binId, to: cageId, productId: 'brass-cap', quantity: 100 }) await ops.workOrders.setStatus('19264', 'on-hold', { reason: 'Waiting for caps' }) ```
|
|
13959
|
+
|
|
13960
|
+
**describe**(collectionId: string) → `Promise<`
|
|
13961
|
+
What the server offers, by group: `{ workOrders: [...], stock: [...], boms: [...], madeFrom: [...] }`.
|
|
13962
|
+
|
|
13351
13963
|
### order
|
|
13352
13964
|
|
|
13353
|
-
**create**(collectionId: string,
|
|
13965
|
+
**create**(collectionId: string,
|
|
13354
13966
|
data: CreateOrderRequest) → `Promise<CreateOrderResponse>`
|
|
13355
13967
|
Create a new order with items. ```typescript const order = await order.create('coll_123', { orderRef: 'ORD-12345', customerId: 'CUST-789', items: [ { itemType: 'tag', itemId: 'TAG001' }, { itemType: 'tag', itemId: 'TAG002' }, { itemType: 'serial', itemId: 'SN12345' } ], status: 'pending', metadata: { shipmentId: 'SHIP-789', destination: 'Warehouse B' } }) ```
|
|
13356
13968
|
|
|
13357
|
-
**get**(collectionId: string,
|
|
13358
|
-
orderId: string,
|
|
13969
|
+
**get**(collectionId: string,
|
|
13970
|
+
orderId: string,
|
|
13359
13971
|
params?: GetOrderParams) → `Promise<GetOrderResponse>`
|
|
13360
13972
|
Get a single order by ID. ```typescript // Get order without items (faster) const order = await order.get('coll_123', 'order_abc123') console.log(`Order has ${order.itemCount} items`) // Get order with items const orderWithItems = await order.get('coll_123', 'order_abc123', { includeItems: true }) console.log(orderWithItems.items) // Items array available ```
|
|
13361
13973
|
|
|
13362
|
-
**update**(collectionId: string,
|
|
13363
|
-
orderId: string,
|
|
13974
|
+
**update**(collectionId: string,
|
|
13975
|
+
orderId: string,
|
|
13364
13976
|
data: UpdateOrderRequest) → `Promise<UpdateOrderResponse>`
|
|
13365
13977
|
Update order status or metadata. Items are managed separately via addItems/removeItems. ```typescript const updated = await order.update('coll_123', 'order_abc123', { status: 'shipped', metadata: { trackingNumber: '1Z999AA10123456784', shippedAt: '2026-02-02T14:30:00Z' } }) ```
|
|
13366
13978
|
|
|
13367
|
-
**remove**(collectionId: string,
|
|
13979
|
+
**remove**(collectionId: string,
|
|
13368
13980
|
orderId: string) → `Promise<DeleteOrderResponse>`
|
|
13369
13981
|
Delete an order and all its items (cascade delete). ```typescript await order.remove('coll_123', 'order_abc123') ```
|
|
13370
13982
|
|
|
13371
|
-
**list**(collectionId: string,
|
|
13983
|
+
**list**(collectionId: string,
|
|
13372
13984
|
params?: ListOrdersRequest) → `Promise<ListOrdersResponse>`
|
|
13373
13985
|
List orders for a collection with optional filters and pagination. Orders are returned in descending order by createdAt (newest first). ```typescript // List all orders (without items for better performance) const all = await order.list('coll_123') // List with filters const pending = await order.list('coll_123', { status: 'pending', limit: 50, offset: 0 }) // Filter by customer with items const customerOrders = await order.list('coll_123', { customerId: 'CUST-789', includeItems: true }) ```
|
|
13374
13986
|
|
|
13375
|
-
**getItems**(collectionId: string,
|
|
13376
|
-
orderId: string,
|
|
13987
|
+
**getItems**(collectionId: string,
|
|
13988
|
+
orderId: string,
|
|
13377
13989
|
params?: GetOrderItemsParams) → `Promise<GetOrderItemsResponse>`
|
|
13378
13990
|
Get items from an order with pagination support. Use this for orders with many items instead of includeItems. ```typescript // Get first page of items const page1 = await order.getItems('coll_123', 'order_abc123', { limit: 100, offset: 0 }) // Get next page const page2 = await order.getItems('coll_123', 'order_abc123', { limit: 100, offset: 100 }) ```
|
|
13379
13991
|
|
|
13380
|
-
**addItems**(collectionId: string,
|
|
13381
|
-
orderId: string,
|
|
13992
|
+
**addItems**(collectionId: string,
|
|
13993
|
+
orderId: string,
|
|
13382
13994
|
data: AddItemsRequest) → `Promise<AddItemsResponse>`
|
|
13383
13995
|
Add additional items to an existing order. ```typescript const updated = await order.addItems('coll_123', 'order_abc123', { items: [ { itemType: 'tag', itemId: 'TAG003' }, { itemType: 'proof', itemId: 'proof_xyz' } ] }) console.log(`Order now has ${updated.itemCount} items`) ```
|
|
13384
13996
|
|
|
13385
|
-
**
|
|
13386
|
-
|
|
13997
|
+
**lineDone**(collectionId: string, orderId: string, itemId: string, by: number) → `Promise<OrderItem>`
|
|
13998
|
+
Add to (or take from) how much of a line has been shipped or received. Atomic, so two receipts at once both count; it can't go below zero. ```typescript // 20 more caps arrived against a purchase order line await order.lineDone('coll_123', orderId, lineId, 20) ```
|
|
13999
|
+
|
|
14000
|
+
**removeItems**(collectionId: string,
|
|
14001
|
+
orderId: string,
|
|
13387
14002
|
data: RemoveItemsRequest) → `Promise<RemoveItemsResponse>`
|
|
13388
|
-
|
|
14003
|
+
Add to (or take from) how much of a line has been shipped or received. Atomic, so two receipts at once both count; it can't go below zero. ```typescript // 20 more caps arrived against a purchase order line await order.lineDone('coll_123', orderId, lineId, 20) ```
|
|
13389
14004
|
|
|
13390
|
-
**lookup**(collectionId: string,
|
|
14005
|
+
**lookup**(collectionId: string,
|
|
13391
14006
|
data: LookupOrdersRequest) → `Promise<LookupOrdersResponse>`
|
|
13392
14007
|
Find all orders containing specific items (tags, proofs, or serial numbers). Use case: Scan a tag and immediately see if it's part of any order. ```typescript // Scan a tag and find associated orders const result = await order.lookup('coll_123', { items: [ { itemType: 'tag', itemId: 'TAG001' } ] }) if (result.orders.length > 0) { console.log(`Tag is part of ${result.orders.length} order(s)`) result.orders.forEach(ord => { console.log(`Order ${ord.orderRef}: ${ord.status}`) }) } // Batch lookup multiple items const batchResult = await order.lookup('coll_123', { items: [ { itemType: 'tag', itemId: 'TAG001' }, { itemType: 'serial', itemId: 'SN12345' }, { itemType: 'proof', itemId: 'proof_xyz' } ] }) ```
|
|
13393
14008
|
|
|
13394
|
-
**query**(collectionId: string,
|
|
14009
|
+
**query**(collectionId: string,
|
|
13395
14010
|
data: QueryOrdersRequest) → `Promise<QueryOrdersResponse>`
|
|
13396
14011
|
Advanced query for orders with order-level and item-level filtering. More powerful than the basic list() function. ```typescript // Find pending orders created in January 2026 const result = await order.query('coll_123', { query: { status: 'pending', createdAfter: '2026-01-01T00:00:00Z', createdBefore: '2026-02-01T00:00:00Z', sortBy: 'createdAt', sortOrder: 'desc' }, limit: 50 }) // Find orders with specific metadata and item count const highPriority = await order.query('coll_123', { query: { metadata: { priority: 'high' }, minItemCount: 10, maxItemCount: 100 }, includeItems: true }) // Find orders containing a specific product batch const batchOrders = await order.query('coll_123', { query: { productId: 'prod_789', batchId: 'BATCH-2024-001' }, includeItems: true }) // Find an order containing one of several specific items const matched = await order.query('coll_123', { query: { items: [ { itemType: 'tag', itemId: 'TAG001' }, { itemType: 'serial', itemId: 'SN12345' } ] }, includeItems: true }) ```
|
|
13397
14012
|
|
|
13398
|
-
**reports**(collectionId: string,
|
|
14013
|
+
**reports**(collectionId: string,
|
|
13399
14014
|
params?: ReportsParams) → `Promise<ReportsResponse>`
|
|
13400
14015
|
Get reports and aggregations for orders. Provides analytics grouped by status, customer, product, date, etc. ```typescript // Get order counts by status const statusReport = await order.reports('coll_123', { groupByStatus: true }) console.log(statusReport.ordersByStatus) // { pending: 45, shipped: 123, completed: 789 } // Get comprehensive analytics const fullReport = await order.reports('coll_123', { groupByStatus: true, groupByProduct: true, includeItemStats: true, createdAfter: '2026-01-01T00:00:00Z' }) console.log(fullReport.itemStats?.avgItemsPerOrder) // Get top 10 customers by order count const topCustomers = await order.reports('coll_123', { groupByCustomer: true, topN: 10 }) ```
|
|
13401
14016
|
|
|
13402
|
-
**findByProduct**(collectionId: string,
|
|
13403
|
-
productId: string,
|
|
14017
|
+
**findByProduct**(collectionId: string,
|
|
14018
|
+
productId: string,
|
|
13404
14019
|
params?: LookupByProductParams) → `Promise<LookupByProductResponse>`
|
|
13405
14020
|
Find all orders containing items with a specific product ID. Uses the automatic productSummary tracking in order metadata. ```typescript // Find all orders with a specific product const result = await order.findByProduct('coll_123', 'product_abc123', { limit: 50, includeItems: false }) result.orders.forEach(ord => { const count = ord.metadata.productSummary?.['product_abc123'] ?? 0 console.log(`Order ${ord.orderRef} has ${count} items of this product`) }) ```
|
|
13406
14021
|
|
|
13407
|
-
**getAnalytics**(collectionId: string,
|
|
14022
|
+
**getAnalytics**(collectionId: string,
|
|
13408
14023
|
orderId: string) → `Promise<OrderAnalyticsResponse>`
|
|
13409
14024
|
Get comprehensive scan analytics for all tags in an order. Returns scan counts, timestamps, locations, devices, and per-tag summaries. ```typescript const analytics = await order.getAnalytics('coll_123', 'order_abc123') if (analytics.analytics) { console.log(`Total scans: ${analytics.analytics.totalScans}`) console.log(`Admin scans: ${analytics.analytics.adminScans}`) console.log(`Created at: ${analytics.analytics.estimatedCreatedAt}`) console.log(`Unique locations: ${analytics.analytics.uniqueLocations}`) analytics.analytics.tagSummaries.forEach(tag => { console.log(`Tag ${tag.tagId}: ${tag.totalScans} scans`) }) } ```
|
|
13410
14025
|
|
|
13411
|
-
**getTimeline**(collectionId: string,
|
|
13412
|
-
orderId: string,
|
|
14026
|
+
**getTimeline**(collectionId: string,
|
|
14027
|
+
orderId: string,
|
|
13413
14028
|
params?: TimelineRequest) → `Promise<TimelineResponse>`
|
|
13414
14029
|
Get chronological timeline of all scan events for an order's tags. Supports filtering by date range and admin/customer scans. ```typescript // Get all scan events const timeline = await order.getTimeline('coll_123', 'order_abc123') timeline.timeline.forEach(event => { console.log(`${event.timestamp}: ${event.eventType} by ${event.isAdmin ? 'admin' : 'customer'}`) }) // Get admin scans only from last week const adminScans = await order.getTimeline('coll_123', 'order_abc123', { isAdmin: true, from: '2026-02-01T00:00:00Z', limit: 500 }) ```
|
|
13415
14030
|
|
|
13416
|
-
**getLocationHistory**(collectionId: string,
|
|
13417
|
-
orderId: string,
|
|
14031
|
+
**getLocationHistory**(collectionId: string,
|
|
14032
|
+
orderId: string,
|
|
13418
14033
|
params?: LocationRequest) → `Promise<LocationResponse>`
|
|
13419
14034
|
Get location-based scan history for an order's tags. Shows where the order's tags have been scanned. ```typescript const locations = await order.getLocationHistory('coll_123', 'order_abc123', { limit: 100 }) console.log(`Order scanned in ${locations.count} locations`) locations.locations.forEach(scan => { console.log(`${scan.location} at ${scan.timestamp}`) }) ```
|
|
13420
14035
|
|
|
13421
|
-
**getBulkAnalytics**(collectionId: string,
|
|
14036
|
+
**getBulkAnalytics**(collectionId: string,
|
|
13422
14037
|
data: BulkAnalyticsRequest) → `Promise<BulkAnalyticsResponse>`
|
|
13423
14038
|
Get analytics summary for multiple orders at once. Efficient way to retrieve scan data for many orders. ```typescript const bulk = await order.getBulkAnalytics('coll_123', { orderIds: ['order_1', 'order_2', 'order_3'], from: '2026-01-01T00:00:00Z' }) bulk.results.forEach(result => { if (result.analytics) { console.log(`${result.orderRef}: ${result.analytics.totalScans} scans`) } }) ```
|
|
13424
14039
|
|
|
13425
|
-
**getCollectionSummary**(collectionId: string,
|
|
14040
|
+
**getCollectionSummary**(collectionId: string,
|
|
13426
14041
|
params?: SummaryRequest) → `Promise<CollectionSummaryResponse>`
|
|
13427
14042
|
Get collection-wide analytics summary across all orders. Returns daily scan counts and admin activity overview. ```typescript // Get all-time collection summary const summary = await order.getCollectionSummary('coll_123') console.log(`Admin activity count: ${summary.adminActivity.count}`) console.log('Scans by day:') summary.scansByDay.forEach(day => { console.log(` ${day.date}: ${day.scanCount} scans`) }) // Get summary for last 30 days const recentSummary = await order.getCollectionSummary('coll_123', { from: '2026-01-08T00:00:00Z', to: '2026-02-08T00:00:00Z' }) ```
|
|
13428
14043
|
|
|
13429
|
-
**findOrdersByProduct**(collectionId: string,
|
|
13430
|
-
productId: string,
|
|
14044
|
+
**findOrdersByProduct**(collectionId: string,
|
|
14045
|
+
productId: string,
|
|
13431
14046
|
params?: FindOrdersByAttributeParams) → `Promise<FindOrdersByAttributeResponse>`
|
|
13432
14047
|
Find all orders containing items from a specific product. Uses indexed queries for fast lookups across order items. ```typescript // Find all orders containing a product const { orders, limit, offset } = await order.findOrdersByProduct('coll_123', 'prod_789', { limit: 100 }) console.log(`Product appears in ${orders.length} orders`) ```
|
|
13433
14048
|
|
|
13434
|
-
**findItemsByProduct**(collectionId: string,
|
|
13435
|
-
productId: string,
|
|
14049
|
+
**findItemsByProduct**(collectionId: string,
|
|
14050
|
+
productId: string,
|
|
13436
14051
|
params?: FindItemsByAttributeParams) → `Promise<FindItemsByAttributeResponse>`
|
|
13437
14052
|
Get individual order items for a specific product. Returns all matching items with optional order summary. ```typescript // Get all items for a product const { items } = await order.findItemsByProduct('coll_123', 'prod_789', { includeOrder: true }) console.log(`Product delivered in ${items.length} order items`) ```
|
|
13438
14053
|
|
|
13439
|
-
**getOrderIdsByAttribute**(collectionId: string,
|
|
13440
|
-
attribute: 'productId',
|
|
13441
|
-
value: string,
|
|
14054
|
+
**getOrderIdsByAttribute**(collectionId: string,
|
|
14055
|
+
attribute: 'productId',
|
|
14056
|
+
value: string,
|
|
13442
14057
|
params?: GetOrderIdsParams) → `Promise<GetOrderIdsResponse>`
|
|
13443
14058
|
Get unique order IDs containing items for a specific product. Lightweight query that only returns order IDs, not full order objects. ```typescript // Get order IDs for a product const productOrders = await order.getOrderIdsByAttribute( 'coll_123', 'productId', 'prod_789', { limit: 500 } ) ```
|
|
13444
14059
|
|
|
@@ -13462,6 +14077,9 @@ A new claim set for the partner, on one of its tap domains (owners and admins).
|
|
|
13462
14077
|
**lookupTags**(partnerId: string, query: { uid?: string; code?: string }) → `Promise<PartnerTagHit[]>`
|
|
13463
14078
|
Find a tag across the partner's sets by its chip UID (8 or 14 hex) or its code (printed or bare). Never returns keys.
|
|
13464
14079
|
|
|
14080
|
+
**tagAttempts**(partnerId: string, uid: string) → `Promise<ClientErrorEvent[]>`
|
|
14081
|
+
What phones reported about one chip (errors.report with entityType 'tag'), newest first: a tag that failed to program or register, with the host's NFC log in context. For a chip in the partner's sets, or attempts that named one of them.
|
|
14082
|
+
|
|
13465
14083
|
### podcast
|
|
13466
14084
|
|
|
13467
14085
|
**generate**(collectionId: string,
|
|
@@ -14058,6 +14676,41 @@ Create or update a user data item. The item object must include an `id` field. `
|
|
|
14058
14676
|
**remove**(appId: string, itemId: string) → `Promise<void>`
|
|
14059
14677
|
Delete a user data item by ID. ```typescript await userAppData.remove('garden-planner', 'bed-1'); ```
|
|
14060
14678
|
|
|
14679
|
+
### userGroups
|
|
14680
|
+
|
|
14681
|
+
**mine**(collectionId: string) → `Promise<MyUserGroups>`
|
|
14682
|
+
The signed-in person's own user groups in this collection. Not signed in → both lists empty. Nobody can ask about anyone else with this. ```typescript const { userGroups: mine } = await userGroups.mine('coll_123') const canRelease = mine.includes('qc-controller') ```
|
|
14683
|
+
|
|
14684
|
+
**list**(collectionId: string) → `Promise<UserGroup[]>`
|
|
14685
|
+
Every user group in the collection (admin).
|
|
14686
|
+
|
|
14687
|
+
**get**(collectionId: string, userGroupId: string) → `Promise<UserGroup>`
|
|
14688
|
+
One user group (admin).
|
|
14689
|
+
|
|
14690
|
+
**create**(collectionId: string, data: CreateUserGroupRequest) → `Promise<UserGroup>`
|
|
14691
|
+
Create a user group (admin). Its key is made from the name unless you give one. ```typescript const qc = await userGroups.create('coll_123', { name: 'QC Controllers' }) qc.key // 'qc-controllers' ```
|
|
14692
|
+
|
|
14693
|
+
**update**(collectionId: string, userGroupId: string, data: UpdateUserGroupRequest) → `Promise<UserGroup>`
|
|
14694
|
+
Change a user group (admin): its name, description, or anything else you keep on it. The key stays. To change who is in it, prefer `addMember` / `removeMember`: saving a whole `members` list here can overwrite a change someone else made at the same moment.
|
|
14695
|
+
|
|
14696
|
+
**remove**(collectionId: string, userGroupId: string) → `Promise<UserGroup>`
|
|
14697
|
+
Delete a user group (admin). Its members lose whatever it allowed.
|
|
14698
|
+
|
|
14699
|
+
**members**(collectionId: string, userGroupId: string) → `Promise<UserGroupMember[]>`
|
|
14700
|
+
The people in a user group, with name and email (admin).
|
|
14701
|
+
|
|
14702
|
+
**addMember**(collectionId: string, userGroupId: string, who: AddUserGroupMemberRequest) → `Promise<UserGroup>`
|
|
14703
|
+
Add one person (admin), by user id or by email. By email, the person is found in the collection's logins or added to them (no welcome email is sent). Adding someone who is already in changes nothing. ```typescript await userGroups.addMember('coll_123', qc.id, { email: 'sam@example.com', name: 'Sam' }) ```
|
|
14704
|
+
|
|
14705
|
+
**removeMember**(collectionId: string, userGroupId: string, userId: string) → `Promise<UserGroup>`
|
|
14706
|
+
Remove one person (admin).
|
|
14707
|
+
|
|
14708
|
+
**history**(collectionId: string, params: UserGroupHistoryParams = {}) → `Promise<UserGroupChange[]>`
|
|
14709
|
+
What changed, newest first (admin): user groups created, renamed and deleted, and every person added or removed, each with the admin who did it (`actorId`) and when (`at`). Give `userGroupId` for one user group, `userId` for everything about one person, or neither for the whole collection. Covers the last 30 days unless you give `from` / `to` (at most 400 days). Takes about a second. ```typescript const who = await userGroups.history('coll_123', { userId: 'uid_1' }) // [{ at, type: 'usergroup.member-added', actorId: 'uid_admin', data: { key: 'qc-controllers', userId: 'uid_1', … } }] ```
|
|
14710
|
+
|
|
14711
|
+
**ofUser**(collectionId: string, userId: string) → `Promise<UserGroupRef[]>`
|
|
14712
|
+
The user groups one person is in (admin).
|
|
14713
|
+
|
|
14061
14714
|
### variant
|
|
14062
14715
|
|
|
14063
14716
|
**get**(collectionId: string,
|