sinfactura-types 1.10.418 → 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/return.js +12 -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/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/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
|