@nemphi/sdk 0.2.5272 → 0.3.5324
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/generated/inventory/client.d.ts +29 -1
- package/dist/generated/inventory/client.d.ts.map +1 -1
- package/dist/generated/inventory/client.js +9 -1
- package/dist/generated/inventory/client.js.map +1 -1
- package/dist/generated/inventory/index.d.ts +2 -2
- package/dist/generated/inventory/index.d.ts.map +1 -1
- package/dist/generated/inventory/models.d.ts +127 -0
- package/dist/generated/inventory/models.d.ts.map +1 -1
- package/dist/generated/inventory/models.js +91 -0
- package/dist/generated/inventory/models.js.map +1 -1
- package/dist/index.d.ts +156 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +104 -138
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -577,9 +577,9 @@ export interface Notification {
|
|
|
577
577
|
seq?: number;
|
|
578
578
|
}
|
|
579
579
|
/**
|
|
580
|
-
* One realtime event of the workspace (`openRealtimeSocket
|
|
581
|
-
* `
|
|
582
|
-
* `GET /v1/events/socket`).
|
|
580
|
+
* One realtime event of the workspace (`openRealtimeSocket` and
|
|
581
|
+
* `streamEvents`, the frames of `GET /v1/events/stream` and
|
|
582
|
+
* `GET /v1/events/socket`), or of one chat thread (`streamThread`).
|
|
583
583
|
* `action` and `notification` are wakeups — re-read the surface, the row
|
|
584
584
|
* itself comes by cursor; the rest is state that only matters while
|
|
585
585
|
* someone is watching.
|
|
@@ -653,6 +653,13 @@ export type RealtimeEvent = {
|
|
|
653
653
|
/** ISO instant after which a reader drops them unless the signal repeats. */
|
|
654
654
|
until: string;
|
|
655
655
|
};
|
|
656
|
+
/**
|
|
657
|
+
* One frame of a chat thread's own stream (`streamThread`): a piece of the
|
|
658
|
+
* answer a run is writing (`run_delta`), or a run step's end (`run`).
|
|
659
|
+
*/
|
|
660
|
+
export type ThreadStreamEvent = Extract<RealtimeEvent, {
|
|
661
|
+
type: "run" | "run_delta";
|
|
662
|
+
}>;
|
|
656
663
|
/** Where a person is typing: a chat thread or a marketing inbox conversation. */
|
|
657
664
|
export type TypingScope = Extract<RealtimeEvent, {
|
|
658
665
|
type: "typing";
|
|
@@ -671,7 +678,7 @@ export interface RealtimeSocketOptions {
|
|
|
671
678
|
/** Called when a poll fails after one answered. */
|
|
672
679
|
onClose?: () => void;
|
|
673
680
|
/**
|
|
674
|
-
* Ignored: the subscription
|
|
681
|
+
* Ignored: the subscription reads `GET /v1/events/stream` over `fetch`
|
|
675
682
|
* rather than holding a WebSocket. Kept so existing callers compile.
|
|
676
683
|
*/
|
|
677
684
|
webSocket?: (url: string, headers: Record<string, string>) => WebSocket;
|
|
@@ -3190,6 +3197,114 @@ export interface InventoryValuation {
|
|
|
3190
3197
|
difference_cents?: number;
|
|
3191
3198
|
in_agreement?: boolean;
|
|
3192
3199
|
}
|
|
3200
|
+
/** One item × warehouse on the inventory page (`inventory.overview`). */
|
|
3201
|
+
export interface InventoryOverviewLevel extends StockLevel {
|
|
3202
|
+
quantity_on_rent: number;
|
|
3203
|
+
quantity_reserved: number;
|
|
3204
|
+
quantity_available: number;
|
|
3205
|
+
rentable: boolean;
|
|
3206
|
+
/** Units in and out (both positive) in the month asked for. */
|
|
3207
|
+
month_in: number;
|
|
3208
|
+
month_out: number;
|
|
3209
|
+
/** The owned quantity at each of the last twelve week ends, oldest first; the last is today. */
|
|
3210
|
+
trend: number[];
|
|
3211
|
+
}
|
|
3212
|
+
/** A month's movements of one type in one warehouse, summed. */
|
|
3213
|
+
export interface InventoryOverviewFlow {
|
|
3214
|
+
warehouse_id: string;
|
|
3215
|
+
/** A StockMovementType, or a rental custody move (rental_out, rental_return, rental_loss). */
|
|
3216
|
+
movement_type: string;
|
|
3217
|
+
/** Signed: positive in, negative out. */
|
|
3218
|
+
quantity: number;
|
|
3219
|
+
value_cents: number;
|
|
3220
|
+
movements: number;
|
|
3221
|
+
}
|
|
3222
|
+
/** One movement of the month on the inventory page. */
|
|
3223
|
+
export interface InventoryOverviewMovement {
|
|
3224
|
+
id: string;
|
|
3225
|
+
item_id: string;
|
|
3226
|
+
item_code: string | null;
|
|
3227
|
+
item_name: string;
|
|
3228
|
+
unit_code: string;
|
|
3229
|
+
warehouse_id: string;
|
|
3230
|
+
/** A StockMovementType, or a rental custody move (rental_out, rental_return, rental_loss). */
|
|
3231
|
+
movement_type: string;
|
|
3232
|
+
quantity: number;
|
|
3233
|
+
unit_cost_cents: number;
|
|
3234
|
+
total_cost_cents: number;
|
|
3235
|
+
occurred_at: string;
|
|
3236
|
+
reference: string | null;
|
|
3237
|
+
notes: string | null;
|
|
3238
|
+
source_type: string | null;
|
|
3239
|
+
}
|
|
3240
|
+
/** An open physical count with what has been found so far. */
|
|
3241
|
+
export interface InventoryOverviewCount {
|
|
3242
|
+
id: string;
|
|
3243
|
+
warehouse_id: string;
|
|
3244
|
+
counted_on: string;
|
|
3245
|
+
reference: string | null;
|
|
3246
|
+
lines: {
|
|
3247
|
+
item_id: string;
|
|
3248
|
+
expected_quantity: number;
|
|
3249
|
+
counted_quantity: number | null;
|
|
3250
|
+
}[];
|
|
3251
|
+
}
|
|
3252
|
+
/** The inventory page in one read (`inventory.overview`). Values in cents. */
|
|
3253
|
+
export interface InventoryOverview {
|
|
3254
|
+
today: string;
|
|
3255
|
+
/** YYYY-MM whose movements and flows these are. */
|
|
3256
|
+
month: string;
|
|
3257
|
+
currency: string;
|
|
3258
|
+
warehouses: {
|
|
3259
|
+
id: string;
|
|
3260
|
+
code: string;
|
|
3261
|
+
name: string;
|
|
3262
|
+
is_default: boolean;
|
|
3263
|
+
active: boolean;
|
|
3264
|
+
}[];
|
|
3265
|
+
/** The active items that keep stock. */
|
|
3266
|
+
items: {
|
|
3267
|
+
id: string;
|
|
3268
|
+
code: string | null;
|
|
3269
|
+
name: string;
|
|
3270
|
+
unit_code: string;
|
|
3271
|
+
reorder_point: number | null;
|
|
3272
|
+
}[];
|
|
3273
|
+
levels: InventoryOverviewLevel[];
|
|
3274
|
+
flows: InventoryOverviewFlow[];
|
|
3275
|
+
movements: InventoryOverviewMovement[];
|
|
3276
|
+
/** Twelve months per warehouse ending with `month`: value in, out and at close. */
|
|
3277
|
+
history: {
|
|
3278
|
+
warehouse_id: string;
|
|
3279
|
+
months: {
|
|
3280
|
+
month: string;
|
|
3281
|
+
in_cents: number;
|
|
3282
|
+
out_cents: number;
|
|
3283
|
+
closing_cents: number;
|
|
3284
|
+
}[];
|
|
3285
|
+
}[];
|
|
3286
|
+
stock_value_cents: number;
|
|
3287
|
+
ledger_balance_cents: number;
|
|
3288
|
+
difference_cents: number;
|
|
3289
|
+
low_stock_count: number;
|
|
3290
|
+
reorder: {
|
|
3291
|
+
estimated_total_cost_cents: number;
|
|
3292
|
+
suggestions: ReorderSuggestion[];
|
|
3293
|
+
};
|
|
3294
|
+
open_counts: InventoryOverviewCount[];
|
|
3295
|
+
/** Whether there were more levels or movements than the page carries. */
|
|
3296
|
+
truncated: boolean;
|
|
3297
|
+
/** Which of the page's writes the caller's role reaches. */
|
|
3298
|
+
can: {
|
|
3299
|
+
adjust: boolean;
|
|
3300
|
+
transfer: boolean;
|
|
3301
|
+
count_start: boolean;
|
|
3302
|
+
count_record: boolean;
|
|
3303
|
+
count_post: boolean;
|
|
3304
|
+
opening_balance: boolean;
|
|
3305
|
+
warehouses_create: boolean;
|
|
3306
|
+
};
|
|
3307
|
+
}
|
|
3193
3308
|
export interface ReorderSuggestion {
|
|
3194
3309
|
item_id: string;
|
|
3195
3310
|
item_code: string | null;
|
|
@@ -8586,22 +8701,48 @@ export interface NemphiClient {
|
|
|
8586
8701
|
next_before?: number;
|
|
8587
8702
|
}>;
|
|
8588
8703
|
/**
|
|
8589
|
-
*
|
|
8590
|
-
*
|
|
8704
|
+
* One connection to the workspace's realtime stream
|
|
8705
|
+
* (`GET /v1/events/stream`, server-sent events): every frame it carries,
|
|
8706
|
+
* checked by its `type`, until the connection ends (the server closes a
|
|
8707
|
+
* stream after 15 minutes) or `signal` aborts. `action` and
|
|
8708
|
+
* `notification` are wake-ups naming a row; read the row back. The
|
|
8709
|
+
* stream keeps no position, so a reader that connects again re-reads
|
|
8710
|
+
* what it shows. `openRealtimeSocket` reconnects for you.
|
|
8591
8711
|
*/
|
|
8592
8712
|
streamEvents(opts?: {
|
|
8713
|
+
/** @deprecated Ignored: the stream keeps no position. */
|
|
8593
8714
|
cursor?: number;
|
|
8594
8715
|
signal?: AbortSignal;
|
|
8595
|
-
}): AsyncGenerator<
|
|
8716
|
+
}): AsyncGenerator<RealtimeEvent, void, void>;
|
|
8596
8717
|
/**
|
|
8597
|
-
* The workspace's realtime events
|
|
8598
|
-
*
|
|
8599
|
-
*
|
|
8600
|
-
*
|
|
8601
|
-
* that changed. Each poll keeps the caller online. The web app polls the
|
|
8602
|
-
* same route through its own server route.
|
|
8718
|
+
* The workspace's realtime events from `GET /v1/events/stream`, opened
|
|
8719
|
+
* again with backoff whenever it drops, until `close()`: the ledger and
|
|
8720
|
+
* the caller's notifications as wake-ups, the workspace's frames as they
|
|
8721
|
+
* are, and who is online. The connection keeps the caller online.
|
|
8603
8722
|
*/
|
|
8604
8723
|
openRealtimeSocket(options: RealtimeSocketOptions): RealtimeSocket;
|
|
8724
|
+
/**
|
|
8725
|
+
* One chat thread's own stream (`GET /v1/threads/{id}/stream`), for a
|
|
8726
|
+
* member who sits in it: the answers its agent runs are writing
|
|
8727
|
+
* (`run_delta`) and each run step's end (`run`). It opens the stream
|
|
8728
|
+
* again with backoff whenever it drops or the server ends it, until
|
|
8729
|
+
* `signal` aborts; a refusal that will not change (401, 403, the thread
|
|
8730
|
+
* not found as 404) throws an `ApiError`.
|
|
8731
|
+
*
|
|
8732
|
+
* Every connection first replays the turn being written, so a reader
|
|
8733
|
+
* that reconnects mid-answer has all of it. Fold the pieces by
|
|
8734
|
+
* `(seq, n)`: a later `seq` starts the run's text over, a piece already
|
|
8735
|
+
* held (the same `seq`, an `n` at or below the last) changes nothing.
|
|
8736
|
+
* The answer itself always lands as a message; a `run` frame whose
|
|
8737
|
+
* outcome is `continue` or `parked` means the text so far was preamble.
|
|
8738
|
+
* A step that ended while the stream was down is not replayed, so
|
|
8739
|
+
* `onOpen` after the first is the moment to re-read the thread.
|
|
8740
|
+
*/
|
|
8741
|
+
streamThread(threadId: string, opts?: {
|
|
8742
|
+
signal?: AbortSignal;
|
|
8743
|
+
/** Called each time the stream answers. */
|
|
8744
|
+
onOpen?: () => void;
|
|
8745
|
+
}): AsyncGenerator<ThreadStreamEvent, void, void>;
|
|
8605
8746
|
/** Say the caller is writing in a thread or an inbox conversation (`POST /v1/events/typing`); nothing is stored. */
|
|
8606
8747
|
sendTyping(input: {
|
|
8607
8748
|
scope: TypingScope;
|
|
@@ -8765,6 +8906,8 @@ export interface NemphiClient {
|
|
|
8765
8906
|
warehouse_id?: string;
|
|
8766
8907
|
limit?: number;
|
|
8767
8908
|
}): Promise<ReorderSuggestion[]>;
|
|
8909
|
+
/** The inventory page in one read; `month` is YYYY-MM, this month when omitted. */
|
|
8910
|
+
inventoryOverview(month?: string): Promise<InventoryOverview>;
|
|
8768
8911
|
adjustStock(input: {
|
|
8769
8912
|
item_id: string;
|
|
8770
8913
|
warehouse_id?: string;
|