sinfactura-types 1.10.417 → 1.10.419
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/audit.d.ts +6 -0
- package/dist/cjs/order.js +4 -0
- package/dist/cjs/return.js +12 -0
- package/dist/customer.d.ts +52 -0
- package/dist/order.d.ts +4 -1
- package/dist/order.js +4 -0
- package/dist/return.d.ts +118 -2
- package/dist/return.js +11 -1
- package/dist/stock.d.ts +11 -0
- package/dist/userActivity.d.ts +18 -1
- package/package.json +1 -1
package/dist/audit.d.ts
CHANGED
|
@@ -45,6 +45,12 @@ declare global {
|
|
|
45
45
|
cursor?: string;
|
|
46
46
|
}
|
|
47
47
|
type OrderAuditAction = 'order_created' | 'order_edited' | 'order_ready' | 'order_delivered' | 'order_delivery_cancelled' | 'order_disabled' | 'order_enabled' | 'order_returned'
|
|
48
|
+
/**
|
|
49
|
+
* One line of a committed return changed `ReturnItem.disposition` — the
|
|
50
|
+
* inspection outcome, and the stock it moved. Never a money change: the
|
|
51
|
+
* credit and the credit note settle at intake.
|
|
52
|
+
*/
|
|
53
|
+
| 'return_line_regraded'
|
|
48
54
|
/** Customer (or operator) cancellation — distinct from `order_disabled`. */
|
|
49
55
|
| 'order_cancelled'
|
|
50
56
|
/**
|
package/dist/cjs/order.js
CHANGED
|
@@ -121,6 +121,9 @@ exports.isTerminalOrderFulfilmentStatus = isTerminalOrderFulfilmentStatus;
|
|
|
121
121
|
* client that is retrying the wrong transition.
|
|
122
122
|
* - `ORDER_ILLEGAL_TRANSITION` · 409 · `ORDER_VERSION_CONFLICT` · 409
|
|
123
123
|
* - `CUSTOMER_NOT_FOUND` · 404 · `ORDER_HAS_NO_CUSTOMER` · 409
|
|
124
|
+
* - `CUSTOMER_MERGED` · 409 — the order's customer was folded into another, so
|
|
125
|
+
* its balance can no longer move; `data.mergedInto` names the survivor
|
|
126
|
+
* (`CustomerMergedRefusalData`). Nothing was written.
|
|
124
127
|
* - `FX_CONVERSION_UNAVAILABLE` · 503 — no rate for the order's currency pair.
|
|
125
128
|
* - `ROLE_FORBIDDEN` · 403
|
|
126
129
|
*
|
|
@@ -148,6 +151,7 @@ exports.ORDER_ERROR_CODES = [
|
|
|
148
151
|
'ORDER_ILLEGAL_TRANSITION',
|
|
149
152
|
'ORDER_VERSION_CONFLICT',
|
|
150
153
|
'CUSTOMER_NOT_FOUND',
|
|
154
|
+
'CUSTOMER_MERGED',
|
|
151
155
|
'ORDER_HAS_NO_CUSTOMER',
|
|
152
156
|
'FX_CONVERSION_UNAVAILABLE',
|
|
153
157
|
'ROLE_FORBIDDEN',
|
package/dist/cjs/return.js
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RETURN_LINE_DISPOSITIONS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Every state a returned line's physical disposition can be in, as a runtime
|
|
6
|
+
* value so the api's Zod enum, the app's picker and the union below derive
|
|
7
|
+
* from ONE list. See {@link ReturnLineDisposition} for the machine.
|
|
8
|
+
*/
|
|
9
|
+
exports.RETURN_LINE_DISPOSITIONS = [
|
|
10
|
+
'pending_inspection',
|
|
11
|
+
'suspicious',
|
|
12
|
+
'confirmed_sellable',
|
|
13
|
+
'confirmed_damaged',
|
|
14
|
+
];
|
package/dist/customer.d.ts
CHANGED
|
@@ -572,6 +572,58 @@ declare global {
|
|
|
572
572
|
* Nothing was written.
|
|
573
573
|
*/
|
|
574
574
|
| 'CUSTOMER_MERGE_SOURCE_HAS_PENDING_MERGE';
|
|
575
|
+
/**
|
|
576
|
+
* The refusal every operator write that MOVES `Customer.balance` answers when
|
|
577
|
+
* the customer it names was folded into another by a merge (the row carries
|
|
578
|
+
* `mergedInto`): `409`, nothing written, `data` is
|
|
579
|
+
* {@link CustomerMergedRefusalData}. Re-issue the movement against
|
|
580
|
+
* `data.mergedInto`, the survivor, which now holds the balance.
|
|
581
|
+
*
|
|
582
|
+
* Answered by `POST /account` (a movement), `DELETE /account`, `POST` and
|
|
583
|
+
* `DELETE /payments/{source}/{paymentId}/link` (link with credit, unlink),
|
|
584
|
+
* and `POST /orders` (create, `mode: 'delivery'`, `mode: 'return'`).
|
|
585
|
+
*
|
|
586
|
+
* HOW it is decided differs by writer, and only the first kind covers a merge
|
|
587
|
+
* that lands after the handler's read:
|
|
588
|
+
* - by the write's own condition — every balance Update, and on order CREATE
|
|
589
|
+
* the CUSTOMER `lastBuy` item of the checkout transaction (the create also
|
|
590
|
+
* refuses early, on a consistent read, before it allocates an order id);
|
|
591
|
+
* - by a PRE-WRITE read — the unlink's owner-mismatch refusals (merge in
|
|
592
|
+
* progress, a third owner, an erased merged row, an unacknowledged
|
|
593
|
+
* `customer-merged` refund flag), decided off the credit row's owner before
|
|
594
|
+
* any write; the ACCOUNT delete then pins that owner, so a later re-point
|
|
595
|
+
* answers `LINK_LOCKED` / `concurrent-account-mutation` rather than this code.
|
|
596
|
+
*
|
|
597
|
+
* An unlink of a payment linked BEFORE a finished merge is not refused — it
|
|
598
|
+
* reverses on the survivor, whose ledger row it now is.
|
|
599
|
+
*/
|
|
600
|
+
type CustomerBalanceWriteErrorCode = 'CUSTOMER_MERGED'
|
|
601
|
+
/**
|
|
602
|
+
* `DELETE /payments/{source}/{paymentId}/link` only: the credit row is a
|
|
603
|
+
* LEGACY row naming no customer, and the payment's customer was erased —
|
|
604
|
+
* so whether it had been merged first (and where its money went) is no
|
|
605
|
+
* longer provable. `409`, nothing written; `data` is absent.
|
|
606
|
+
*/
|
|
607
|
+
| 'CUSTOMER_ANONYMIZED';
|
|
608
|
+
/**
|
|
609
|
+
* `data` on a `409 CUSTOMER_MERGED`.
|
|
610
|
+
*
|
|
611
|
+
* What to do depends on how the refused write addressed its customer: a
|
|
612
|
+
* write addressed BY CUSTOMER (`POST /account`) is re-issued against
|
|
613
|
+
* `mergedInto`; one addressed by an order, a ledger row or a payment cannot
|
|
614
|
+
* be re-targeted, and needs the merge to finish (`mergeState`) or a
|
|
615
|
+
* compensating movement.
|
|
616
|
+
*/
|
|
617
|
+
interface CustomerMergedRefusalData {
|
|
618
|
+
/** The survivor — the customer the money belongs on now. */
|
|
619
|
+
mergedInto: string;
|
|
620
|
+
/**
|
|
621
|
+
* The merge as the merged row stands. ABSENT when an erasure has since
|
|
622
|
+
* removed the markers and `mergedInto` was recovered from the ledger row
|
|
623
|
+
* the merge re-pointed.
|
|
624
|
+
*/
|
|
625
|
+
mergeState?: 'in-progress' | 'done';
|
|
626
|
+
}
|
|
575
627
|
/**
|
|
576
628
|
* The outcome of one `POST /customers { mode: 'merge' }` run.
|
|
577
629
|
*
|
package/dist/order.d.ts
CHANGED
|
@@ -1524,6 +1524,9 @@ export declare const isTerminalOrderFulfilmentStatus: (status: OrderFulfilmentSt
|
|
|
1524
1524
|
* client that is retrying the wrong transition.
|
|
1525
1525
|
* - `ORDER_ILLEGAL_TRANSITION` · 409 · `ORDER_VERSION_CONFLICT` · 409
|
|
1526
1526
|
* - `CUSTOMER_NOT_FOUND` · 404 · `ORDER_HAS_NO_CUSTOMER` · 409
|
|
1527
|
+
* - `CUSTOMER_MERGED` · 409 — the order's customer was folded into another, so
|
|
1528
|
+
* its balance can no longer move; `data.mergedInto` names the survivor
|
|
1529
|
+
* (`CustomerMergedRefusalData`). Nothing was written.
|
|
1527
1530
|
* - `FX_CONVERSION_UNAVAILABLE` · 503 — no rate for the order's currency pair.
|
|
1528
1531
|
* - `ROLE_FORBIDDEN` · 403
|
|
1529
1532
|
*
|
|
@@ -1542,6 +1545,6 @@ export declare const isTerminalOrderFulfilmentStatus: (status: OrderFulfilmentSt
|
|
|
1542
1545
|
* `SUBSCRIPTION_READONLY`) sit on the order CREATE leg only: an edit is not a new
|
|
1543
1546
|
* order, so `bareOrderPostHandler` routes past `requireMetered` entirely.
|
|
1544
1547
|
*/
|
|
1545
|
-
export declare const ORDER_ERROR_CODES: readonly ["ORDER_NOT_FOUND", "ORDER_LOCKED", "ORDER_NOT_READY", "ORDER_DELIVERED_ANOTHER_DAY", "ORDER_DELIVERY_STATE_UNCHANGED", "ORDER_ILLEGAL_TRANSITION", "ORDER_VERSION_CONFLICT", "CUSTOMER_NOT_FOUND", "ORDER_HAS_NO_CUSTOMER", "FX_CONVERSION_UNAVAILABLE", "ROLE_FORBIDDEN", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSE", "IDEMPOTENCY_IN_PROGRESS", "IDEMPOTENCY_LOCK_CONTENTION", "IDEMPOTENCY_KEY_FAILED", "IDEMPOTENT_RESPONSE_NOT_CACHED"];
|
|
1548
|
+
export declare const ORDER_ERROR_CODES: readonly ["ORDER_NOT_FOUND", "ORDER_LOCKED", "ORDER_NOT_READY", "ORDER_DELIVERED_ANOTHER_DAY", "ORDER_DELIVERY_STATE_UNCHANGED", "ORDER_ILLEGAL_TRANSITION", "ORDER_VERSION_CONFLICT", "CUSTOMER_NOT_FOUND", "CUSTOMER_MERGED", "ORDER_HAS_NO_CUSTOMER", "FX_CONVERSION_UNAVAILABLE", "ROLE_FORBIDDEN", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSE", "IDEMPOTENCY_IN_PROGRESS", "IDEMPOTENCY_LOCK_CONTENTION", "IDEMPOTENCY_KEY_FAILED", "IDEMPOTENT_RESPONSE_NOT_CACHED"];
|
|
1546
1549
|
export type OrderErrorCode = (typeof ORDER_ERROR_CODES)[number];
|
|
1547
1550
|
export {};
|
package/dist/order.js
CHANGED
|
@@ -115,6 +115,9 @@ export const isTerminalOrderFulfilmentStatus = (status) => ORDER_FULFILMENT_TRAN
|
|
|
115
115
|
* client that is retrying the wrong transition.
|
|
116
116
|
* - `ORDER_ILLEGAL_TRANSITION` · 409 · `ORDER_VERSION_CONFLICT` · 409
|
|
117
117
|
* - `CUSTOMER_NOT_FOUND` · 404 · `ORDER_HAS_NO_CUSTOMER` · 409
|
|
118
|
+
* - `CUSTOMER_MERGED` · 409 — the order's customer was folded into another, so
|
|
119
|
+
* its balance can no longer move; `data.mergedInto` names the survivor
|
|
120
|
+
* (`CustomerMergedRefusalData`). Nothing was written.
|
|
118
121
|
* - `FX_CONVERSION_UNAVAILABLE` · 503 — no rate for the order's currency pair.
|
|
119
122
|
* - `ROLE_FORBIDDEN` · 403
|
|
120
123
|
*
|
|
@@ -142,6 +145,7 @@ export const ORDER_ERROR_CODES = [
|
|
|
142
145
|
'ORDER_ILLEGAL_TRANSITION',
|
|
143
146
|
'ORDER_VERSION_CONFLICT',
|
|
144
147
|
'CUSTOMER_NOT_FOUND',
|
|
148
|
+
'CUSTOMER_MERGED',
|
|
145
149
|
'ORDER_HAS_NO_CUSTOMER',
|
|
146
150
|
'FX_CONVERSION_UNAVAILABLE',
|
|
147
151
|
'ROLE_FORBIDDEN',
|
package/dist/return.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every state a returned line's physical disposition can be in, as a runtime
|
|
3
|
+
* value so the api's Zod enum, the app's picker and the union below derive
|
|
4
|
+
* from ONE list. See {@link ReturnLineDisposition} for the machine.
|
|
5
|
+
*/
|
|
6
|
+
export declare const RETURN_LINE_DISPOSITIONS: readonly ["pending_inspection", "suspicious", "confirmed_sellable", "confirmed_damaged"];
|
|
1
7
|
declare global {
|
|
2
8
|
interface Return {
|
|
3
9
|
storeId: string;
|
|
@@ -233,10 +239,67 @@ declare global {
|
|
|
233
239
|
*/
|
|
234
240
|
cost?: number;
|
|
235
241
|
ivaType: number;
|
|
242
|
+
/**
|
|
243
|
+
* The operator's declaration at the counter, IMMUTABLE once written — it is
|
|
244
|
+
* printed on the return receipt. What happened to the unit afterwards is
|
|
245
|
+
* {@link ReturnItem.disposition}, never a rewrite of this field.
|
|
246
|
+
*/
|
|
236
247
|
condition: 'sellable' | 'damaged';
|
|
237
|
-
/**
|
|
248
|
+
/**
|
|
249
|
+
* Whether this line went back into sellable stock AT INTAKE — SERVER-DERIVED
|
|
250
|
+
* from `condition === 'sellable'` (forced `false` on a service line), never
|
|
251
|
+
* client-accepted. Immutable like `condition`: a later re-grade moves stock
|
|
252
|
+
* through `disposition`, not by rewriting this.
|
|
253
|
+
*/
|
|
238
254
|
restock: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Where the unit stands NOW, after inspection. Moved only by
|
|
257
|
+
* `POST /orders { mode: 'return-disposition' }`, and only a crossing into or
|
|
258
|
+
* out of `confirmed_sellable` moves stock.
|
|
259
|
+
*
|
|
260
|
+
* ⚠️ OPTIONAL PERMANENTLY. Absent on every line no one has re-graded — every
|
|
261
|
+
* row written before the field existed included, since this platform never
|
|
262
|
+
* backfills. Absence is a legal final state whose EFFECTIVE value is derived,
|
|
263
|
+
* never a migration gap: `restock === true` reads as `confirmed_sellable`
|
|
264
|
+
* (the unit was shelved at intake), `condition === 'damaged'` as
|
|
265
|
+
* `pending_inspection` (it never was), and a sellable line with
|
|
266
|
+
* `restock === false` — a service line, labour with no shelf — has no
|
|
267
|
+
* disposition at all and cannot be re-graded.
|
|
268
|
+
*
|
|
269
|
+
* ⚠️ Key the derivation on `restock`, never on `condition` alone: a service
|
|
270
|
+
* line is declared `sellable` and was never counted, so reading it as
|
|
271
|
+
* `confirmed_sellable` would let a re-grade write off stock that never
|
|
272
|
+
* existed.
|
|
273
|
+
*/
|
|
274
|
+
disposition?: ReturnLineDisposition;
|
|
275
|
+
/** ms epoch of the last disposition change. Present only alongside `disposition`. */
|
|
276
|
+
dispositionAt?: number;
|
|
277
|
+
/** The staff `userId` who made the last disposition change. Present only alongside `disposition`. */
|
|
278
|
+
dispositionBy?: string;
|
|
279
|
+
/**
|
|
280
|
+
* Operator's note on the last disposition change ("caja abierta, sin uso").
|
|
281
|
+
* ⚠️ Never personal data — it is operator-authored and unscrubbed.
|
|
282
|
+
*/
|
|
283
|
+
dispositionNote?: string;
|
|
239
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* A returned line's physical disposition — decoupled from the money, which
|
|
287
|
+
* settles at intake and is never reopened by a change here.
|
|
288
|
+
*
|
|
289
|
+
* - `pending_inspection` — on the counter, not assessed yet. Not on hand.
|
|
290
|
+
* - `suspicious` — visibly used, possibly not our unit, possibly the
|
|
291
|
+
* customer's damage. Not on hand.
|
|
292
|
+
* - `confirmed_sellable` — inspected and back in sellable stock. The ONLY
|
|
293
|
+
* state in which the unit counts toward on-hand.
|
|
294
|
+
* - `confirmed_damaged` — inspected and confirmed unsellable. Not on hand; the
|
|
295
|
+
* state a supplier claim should attach to.
|
|
296
|
+
*
|
|
297
|
+
* Legal transitions: `pending_inspection → suspicious | confirmed_sellable |
|
|
298
|
+
* confirmed_damaged`, `suspicious → confirmed_sellable | confirmed_damaged`,
|
|
299
|
+
* and `confirmed_sellable ⇄ confirmed_damaged`. Nothing ever returns to
|
|
300
|
+
* `pending_inspection`, and none of the four is terminal.
|
|
301
|
+
*/
|
|
302
|
+
type ReturnLineDisposition = 'pending_inspection' | 'suspicious' | 'confirmed_sellable' | 'confirmed_damaged';
|
|
240
303
|
/**
|
|
241
304
|
* Bounded projection of a return, embedded on `Order.returns` so the order
|
|
242
305
|
* read path renders return chips and per-line returned quantities without a
|
|
@@ -260,11 +323,16 @@ declare global {
|
|
|
260
323
|
* worth offering. Only `PARTIAL_NC_AFIP_DOWN` is retryable.
|
|
261
324
|
*/
|
|
262
325
|
ncErrorCode?: ReturnCreditNoteErrorCode;
|
|
263
|
-
/**
|
|
326
|
+
/**
|
|
327
|
+
* Per-line returned quantities, keyed by originating order-array index.
|
|
328
|
+
* `disposition` mirrors `ReturnItem.disposition` and is absent under the
|
|
329
|
+
* same rule — derive it the same way.
|
|
330
|
+
*/
|
|
264
331
|
items: {
|
|
265
332
|
orderItemIndex: number;
|
|
266
333
|
quantity: number;
|
|
267
334
|
condition: 'sellable' | 'damaged';
|
|
335
|
+
disposition?: ReturnLineDisposition;
|
|
268
336
|
}[];
|
|
269
337
|
}
|
|
270
338
|
type ReturnReason = 'defective' | 'wrong_item' | 'damaged_shipping' | 'customer_changed_mind' | 'not_as_described' | 'duplicate_order' | 'price_adjustment' | 'billing_error' | 'other';
|
|
@@ -359,5 +427,53 @@ declare global {
|
|
|
359
427
|
mode: 'return-credit-note';
|
|
360
428
|
returnId: string;
|
|
361
429
|
}
|
|
430
|
+
/**
|
|
431
|
+
* `POST /orders` with `mode: 'return-disposition'` — re-grade ONE line of a
|
|
432
|
+
* committed return. ADMIN/MANAGER only, and the `Idempotency-Key` header is
|
|
433
|
+
* REQUIRED. Answers the whole updated `Return`.
|
|
434
|
+
*
|
|
435
|
+
* Moves stock only across the `confirmed_sellable` boundary: into it, the
|
|
436
|
+
* line's units return to stock (an `INCOME#` row tagged with the return);
|
|
437
|
+
* out of it, they are written off (a `SALE#` row with
|
|
438
|
+
* `adjustmentReason: 'breakage'`). Never touches `Return.total`, the
|
|
439
|
+
* customer's credit or the credit note.
|
|
440
|
+
*/
|
|
441
|
+
interface ReturnDispositionRequest {
|
|
442
|
+
mode: 'return-disposition';
|
|
443
|
+
returnId: string;
|
|
444
|
+
/** The line, by its index in the originating `Order.items` — `ReturnItem.orderItemIndex`. */
|
|
445
|
+
orderItemIndex: number;
|
|
446
|
+
disposition: ReturnLineDisposition;
|
|
447
|
+
/**
|
|
448
|
+
* The state the client last saw. When sent and the line has moved since,
|
|
449
|
+
* the request is refused `409 RETURN_DISPOSITION_CONFLICT` rather than
|
|
450
|
+
* applied on top of someone else's decision.
|
|
451
|
+
*/
|
|
452
|
+
expectedDisposition?: ReturnLineDisposition;
|
|
453
|
+
/** Capped at `MAX_STOCK_ADJUSTMENT_NOTE_BYTES` UTF-8 bytes. Never personal data. */
|
|
454
|
+
note?: string;
|
|
455
|
+
/**
|
|
456
|
+
* The depósito the units enter or leave, on a store whose `stockAuthority`
|
|
457
|
+
* is `'depositos'`. Absent: the originating order line's depósito, else the
|
|
458
|
+
* primary. Ignored on a store that has not switched.
|
|
459
|
+
*/
|
|
460
|
+
warehouseId?: string;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* The refusals `mode: 'return-disposition'` answers with, beside the shared
|
|
464
|
+
* `IDEMPOTENCY_KEY_REQUIRED` / `ADMIN_REQUIRED` / `VALIDATION_FAILED`.
|
|
465
|
+
*
|
|
466
|
+
* - `RETURN_NOT_FOUND` (404) — no such return, or it is not a customer return.
|
|
467
|
+
* - `RETURN_LINE_NOT_FOUND` (404) — the return has no line at that index.
|
|
468
|
+
* - `RETURN_DISPOSITION_NOT_STOCKED` (409) — a service line; labour has no
|
|
469
|
+
* shelf to re-grade onto.
|
|
470
|
+
* - `RETURN_DISPOSITION_INVALID_TRANSITION` (409) — not a legal edge from the
|
|
471
|
+
* line's current state (including a no-op to the same state).
|
|
472
|
+
* - `RETURN_DISPOSITION_CONFLICT` (409) — the line moved since it was read, or
|
|
473
|
+
* since the `expectedDisposition` the client sent. Re-read and retry.
|
|
474
|
+
* - `PRODUCT_NOT_FOUND` (404) — the line's product was deleted.
|
|
475
|
+
* - `RETURN_DISPOSITION_FAILED` (502) — anything else the write refused.
|
|
476
|
+
*/
|
|
477
|
+
type ReturnDispositionErrorCode = 'RETURN_NOT_FOUND' | 'RETURN_LINE_NOT_FOUND' | 'RETURN_DISPOSITION_NOT_STOCKED' | 'RETURN_DISPOSITION_INVALID_TRANSITION' | 'RETURN_DISPOSITION_CONFLICT' | 'PRODUCT_NOT_FOUND' | 'RETURN_DISPOSITION_FAILED';
|
|
362
478
|
}
|
|
363
479
|
export {};
|
package/dist/return.js
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Every state a returned line's physical disposition can be in, as a runtime
|
|
3
|
+
* value so the api's Zod enum, the app's picker and the union below derive
|
|
4
|
+
* from ONE list. See {@link ReturnLineDisposition} for the machine.
|
|
5
|
+
*/
|
|
6
|
+
export const RETURN_LINE_DISPOSITIONS = [
|
|
7
|
+
'pending_inspection',
|
|
8
|
+
'suspicious',
|
|
9
|
+
'confirmed_sellable',
|
|
10
|
+
'confirmed_damaged',
|
|
11
|
+
];
|
package/dist/stock.d.ts
CHANGED
|
@@ -351,6 +351,17 @@ declare global {
|
|
|
351
351
|
* counted under both.
|
|
352
352
|
*/
|
|
353
353
|
serviceOrderId?: string;
|
|
354
|
+
/**
|
|
355
|
+
* Set when this outflow writes off a RETURNED unit that a re-grade moved
|
|
356
|
+
* out of `confirmed_sellable` (`POST /orders { mode: 'return-disposition' }`).
|
|
357
|
+
* Always beside `adjustmentReason: 'breakage'`, so every revenue view
|
|
358
|
+
* already excludes it; it carries no `orderId`, on purpose, for the same
|
|
359
|
+
* reason. Mirrors `StockIncomeWrite.returnId`, which tags the units coming
|
|
360
|
+
* back in.
|
|
361
|
+
*/
|
|
362
|
+
returnId?: string;
|
|
363
|
+
/** Index of the re-graded line in the originating `Order.items`. Present alongside `returnId`. */
|
|
364
|
+
orderItemIndex?: number;
|
|
354
365
|
price?: number;
|
|
355
366
|
/**
|
|
356
367
|
* The batch these units left from, on a lot-tracked product. Same field,
|
package/dist/userActivity.d.ts
CHANGED
|
@@ -184,6 +184,23 @@ declare global {
|
|
|
184
184
|
/** NC lifecycle at the moment the return committed. */
|
|
185
185
|
nc_status: ReturnCreditNoteStatus;
|
|
186
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* An operator re-graded one line of a committed return — its
|
|
189
|
+
* `ReturnItem.disposition` moved. `stock_delta` is what the change did to
|
|
190
|
+
* on-hand: `+quantity` into `confirmed_sellable`, `-quantity` out of it, `0`
|
|
191
|
+
* otherwise. Never a money change.
|
|
192
|
+
*/
|
|
193
|
+
interface ReturnLineRegradedEvent extends UserActivityEventBase {
|
|
194
|
+
event: 'Return Line Regraded';
|
|
195
|
+
order_id: string;
|
|
196
|
+
return_id: string;
|
|
197
|
+
order_item_index: number;
|
|
198
|
+
product_id: string;
|
|
199
|
+
from_disposition: ReturnLineDisposition;
|
|
200
|
+
to_disposition: ReturnLineDisposition;
|
|
201
|
+
quantity: number;
|
|
202
|
+
stock_delta: number;
|
|
203
|
+
}
|
|
187
204
|
interface PriceListChange {
|
|
188
205
|
list_id: number;
|
|
189
206
|
from: number;
|
|
@@ -1173,7 +1190,7 @@ declare global {
|
|
|
1173
1190
|
carrier?: string;
|
|
1174
1191
|
tracking_set: boolean;
|
|
1175
1192
|
}
|
|
1176
|
-
type UserActivityEvent = CustomerConsentImportedEvent | CustomerConsentImportCompletedEvent | UserLoggedInEvent | UserLoggedOutEvent | UserPasswordChangedEvent | UserSuspendedEvent | TwoFactorEnrolledEvent | TwoFactorDisabledEvent | TwoFactorResetEvent | TwoFactorRecoveryCodesGeneratedEvent | StoreSettingsUpdatedEvent | PlanChangedEvent | InvoiceCreatedEvent | OrderCreatedEvent | OrderCancelledEvent | OrderEditedEvent | OrderReturnedEvent | ProductPriceChangedEvent | CustomerCreatedEvent | CustomerEditedEvent | CustomerRecordServedEvent | CustomerCreditCheckPerformedEvent | CustomersMergedEvent | CashDrawerOpenedEvent | CashDrawerClosedEvent | TenantImpersonatedEvent | SecretRotatedEvent | UserCreatedEvent | UserUpdatedEvent | ProductCreatedEvent | ProductUpdatedEvent | StockIncomeCreatedEvent | StockAdjustedEvent | CategoryCreatedEvent | CategoryUpdatedEvent | BrandCreatedEvent | BrandUpdatedEvent | SupplierCreatedEvent | SupplierUpdatedEvent | SupplierInvoiceCreatedEvent | SupplierInvoiceMatchOverriddenEvent | SupplierClaimRaisedEvent | SupplierClaimStatusChangedEvent | SupplierAccountCreatedEvent | SupplierAccountUpdatedEvent | AccountCreatedEvent | AccountDeletedEvent | BasketUpdatedEvent | BasketDiscountGrantedEvent | BasketDeletedEvent | CashDrawerMovementEvent | PaymentCreatedEvent | PaymentLinkedEvent | PaymentUnlinkedEvent | PaymentLinkageUpdatedEvent | CreditLimitOverriddenEvent | AppointmentSelfBookingBlockOverriddenEvent | AppointmentSelfBookingBlockLiftedEvent | NotificationReadEvent | LogDeletedEvent | PlanCreatedEvent | StoreMaintenanceToggledEvent | PlatformMaintenanceToggledEvent | MaintenanceBroadcastSentEvent | TenantCreatedEvent | LiteralUpdatedEvent | SupportTicketCreatedEvent | SupportTicketUpdatedEvent | AuditTrailViewedEvent | ReportViewedEvent | CustomerPiiViewedEvent | CashDrawerUiOpenedEvent | CashDrawerUiClosedEvent | ExportInitiatedEvent | ImpersonationUiStartedEvent | ImpersonationUiEndedEvent | PaymentViewedEvent | InvoiceViewedEvent | CustomerDetailViewedEvent | SupplierAccountViewedEvent | SearchPerformedEvent | ActionDeniedEvent | TwoFactorChallengeShownEvent | TwoFactorCodeValidationFailedEvent | TwoFactorEnrollmentStartedEvent | TwoFactorRecoveryCodesRevealedEvent | TwoFactorResetInitiatedEvent | IntegrationTokenRefreshedEvent | WaitlistConvertedEvent | PlatformConfigUpdatedEvent | MlChannelStatusChangedEvent | IntegrationConnectionChangedEvent | PrintRuleCreatedEvent | PrintRuleEditedEvent | PrintRuleDeletedEvent | WebhookCreatedEvent | WebhookUpdatedEvent | WebhookDeletedEvent | PrinterActiveToggledEvent | PrinterRawFormatsUpdatedEvent | PrinterProfileUpdatedEvent | PlanTemplateUpdatedEvent | SupplierAccountDeletedEvent | CustomerPasswordResetInitiatedEvent | UserSessionsRevokedEvent | UserAnonymizedEvent | UserPasswordResetInitiatedByOperatorEvent | AgentCommandDispatchedEvent | RmaRequestedEvent | RmaTransitionedEvent | RmaTrackingUpdatedEvent | ClockedInEvent | ClockedOutEvent | AttendanceCorrectedEvent;
|
|
1193
|
+
type UserActivityEvent = CustomerConsentImportedEvent | CustomerConsentImportCompletedEvent | UserLoggedInEvent | UserLoggedOutEvent | UserPasswordChangedEvent | UserSuspendedEvent | TwoFactorEnrolledEvent | TwoFactorDisabledEvent | TwoFactorResetEvent | TwoFactorRecoveryCodesGeneratedEvent | StoreSettingsUpdatedEvent | PlanChangedEvent | InvoiceCreatedEvent | OrderCreatedEvent | OrderCancelledEvent | OrderEditedEvent | OrderReturnedEvent | ReturnLineRegradedEvent | ProductPriceChangedEvent | CustomerCreatedEvent | CustomerEditedEvent | CustomerRecordServedEvent | CustomerCreditCheckPerformedEvent | CustomersMergedEvent | CashDrawerOpenedEvent | CashDrawerClosedEvent | TenantImpersonatedEvent | SecretRotatedEvent | UserCreatedEvent | UserUpdatedEvent | ProductCreatedEvent | ProductUpdatedEvent | StockIncomeCreatedEvent | StockAdjustedEvent | CategoryCreatedEvent | CategoryUpdatedEvent | BrandCreatedEvent | BrandUpdatedEvent | SupplierCreatedEvent | SupplierUpdatedEvent | SupplierInvoiceCreatedEvent | SupplierInvoiceMatchOverriddenEvent | SupplierClaimRaisedEvent | SupplierClaimStatusChangedEvent | SupplierAccountCreatedEvent | SupplierAccountUpdatedEvent | AccountCreatedEvent | AccountDeletedEvent | BasketUpdatedEvent | BasketDiscountGrantedEvent | BasketDeletedEvent | CashDrawerMovementEvent | PaymentCreatedEvent | PaymentLinkedEvent | PaymentUnlinkedEvent | PaymentLinkageUpdatedEvent | CreditLimitOverriddenEvent | AppointmentSelfBookingBlockOverriddenEvent | AppointmentSelfBookingBlockLiftedEvent | NotificationReadEvent | LogDeletedEvent | PlanCreatedEvent | StoreMaintenanceToggledEvent | PlatformMaintenanceToggledEvent | MaintenanceBroadcastSentEvent | TenantCreatedEvent | LiteralUpdatedEvent | SupportTicketCreatedEvent | SupportTicketUpdatedEvent | AuditTrailViewedEvent | ReportViewedEvent | CustomerPiiViewedEvent | CashDrawerUiOpenedEvent | CashDrawerUiClosedEvent | ExportInitiatedEvent | ImpersonationUiStartedEvent | ImpersonationUiEndedEvent | PaymentViewedEvent | InvoiceViewedEvent | CustomerDetailViewedEvent | SupplierAccountViewedEvent | SearchPerformedEvent | ActionDeniedEvent | TwoFactorChallengeShownEvent | TwoFactorCodeValidationFailedEvent | TwoFactorEnrollmentStartedEvent | TwoFactorRecoveryCodesRevealedEvent | TwoFactorResetInitiatedEvent | IntegrationTokenRefreshedEvent | WaitlistConvertedEvent | PlatformConfigUpdatedEvent | MlChannelStatusChangedEvent | IntegrationConnectionChangedEvent | PrintRuleCreatedEvent | PrintRuleEditedEvent | PrintRuleDeletedEvent | WebhookCreatedEvent | WebhookUpdatedEvent | WebhookDeletedEvent | PrinterActiveToggledEvent | PrinterRawFormatsUpdatedEvent | PrinterProfileUpdatedEvent | PlanTemplateUpdatedEvent | SupplierAccountDeletedEvent | CustomerPasswordResetInitiatedEvent | UserSessionsRevokedEvent | UserAnonymizedEvent | UserPasswordResetInitiatedByOperatorEvent | AgentCommandDispatchedEvent | RmaRequestedEvent | RmaTransitionedEvent | RmaTrackingUpdatedEvent | ClockedInEvent | ClockedOutEvent | AttendanceCorrectedEvent;
|
|
1177
1194
|
}
|
|
1178
1195
|
/**
|
|
1179
1196
|
* Canonical whitelist of UI-only `UserActivityEvent` variant names. Imported by
|