sinfactura-types 1.10.2 → 1.10.4
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/print.d.ts +33 -0
- package/dist/socket.d.ts +36 -1
- package/dist/userActivity.d.ts +20 -1
- package/package.json +1 -1
package/dist/print.d.ts
CHANGED
|
@@ -230,5 +230,38 @@ declare global {
|
|
|
230
230
|
*/
|
|
231
231
|
printerId?: string;
|
|
232
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* One mapping in the agent's `export_local_rules` frame — the migration of
|
|
235
|
+
* agent-local routing into `PRINT_RULE#${storeId}` (api#2010 /
|
|
236
|
+
* sinfactura/print#183, #156 phase 5).
|
|
237
|
+
*
|
|
238
|
+
* The agent resolves its own slot setting to a `printerId`, by matching the
|
|
239
|
+
* stored OS printer name against its **current enumerated set**. The BE never
|
|
240
|
+
* matches on name: `PrintPrinter.name` is a display label, not unique across
|
|
241
|
+
* agents, and explicitly not a key.
|
|
242
|
+
*/
|
|
243
|
+
interface PrintLocalRuleExport {
|
|
244
|
+
useCase: PrintUseCase;
|
|
245
|
+
printerId: string;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* A local slot the agent could NOT resolve to a registered printer, reported
|
|
249
|
+
* rather than dropped — a store's mapping must never vanish silently.
|
|
250
|
+
*
|
|
251
|
+
* Keyed by `useCase` so it shares units with `PrintLocalRuleExport`: one
|
|
252
|
+
* unresolvable `tags` slot is TWO unrouted use cases (`tag` + `label`), so
|
|
253
|
+
* slot-keyed entries would make the seeded/skipped counts incomparable.
|
|
254
|
+
* `slot` is retained anyway, because an operator configures slots, not use
|
|
255
|
+
* cases, and it is what tells them which printer to fix.
|
|
256
|
+
*/
|
|
257
|
+
interface PrintLocalRuleSkip {
|
|
258
|
+
useCase: PrintUseCase;
|
|
259
|
+
/** Agent-local slot name — `orders` | `invoices` | `tags`. */
|
|
260
|
+
slot: string;
|
|
261
|
+
/** The OS printer name the slot still points at. */
|
|
262
|
+
printerName: string;
|
|
263
|
+
/** Free text from the agent; recorded for support, never parsed. */
|
|
264
|
+
reason: string;
|
|
265
|
+
}
|
|
233
266
|
}
|
|
234
267
|
export {};
|
package/dist/socket.d.ts
CHANGED
|
@@ -124,8 +124,43 @@ export interface SocketRegisterPrintersMessage {
|
|
|
124
124
|
printers: PrintPrinterReport[];
|
|
125
125
|
[key: string]: unknown;
|
|
126
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Agent → BE, migration of the agent's local `useCase → printer` config into
|
|
129
|
+
* `PRINT_RULE#${storeId}` (api#2010 / sinfactura/print#183, #156 phase 5).
|
|
130
|
+
*
|
|
131
|
+
* **A distinct action, not a field on `register_printers`** — deliberately, and
|
|
132
|
+
* the failure modes are why. An unknown ACTION fails the api's discriminated
|
|
133
|
+
* union with a visible `400`; an unknown FIELD passes the loose gate and is then
|
|
134
|
+
* silently stripped by the handler's schema, so an agent shipping ahead of the
|
|
135
|
+
* BE would migrate nothing and still look healthy. `register_printers` also
|
|
136
|
+
* recurs on every reconnect, and a one-shot payload has no business riding it.
|
|
137
|
+
*
|
|
138
|
+
* Sent after a successful `register_printers` — the registry must exist before a
|
|
139
|
+
* rule can point into it — and **on every connect** rather than once per
|
|
140
|
+
* install. The agent cannot observe delivery (its frame is handed to the
|
|
141
|
+
* renderer, which may drop it, and the socket does not serialise), so a local
|
|
142
|
+
* "already exported" flag would turn one lost race into a store that never
|
|
143
|
+
* migrates. Exactly-once is the BE's `PRINT_AGENT#` marker alone; a repeat costs
|
|
144
|
+
* one failed conditional write.
|
|
145
|
+
*
|
|
146
|
+
* `agentId` is deliberately **not declared**, and unlike
|
|
147
|
+
* `SocketRegisterPrintersMessage` the api will not accept an advisory one — it
|
|
148
|
+
* comes from the authenticated SOCKET row only. Writing routing rules has a
|
|
149
|
+
* wider blast radius than writing a registry row.
|
|
150
|
+
*
|
|
151
|
+
* ⚠️ An EMPTY frame (no `rules`, no `skipped`) is not sent, and the api no-ops on
|
|
152
|
+
* one: otherwise a fresh install consumes the once-only marker and completes
|
|
153
|
+
* migration having seeded nothing, so anything configured locally afterwards
|
|
154
|
+
* could never migrate.
|
|
155
|
+
*/
|
|
156
|
+
export interface SocketExportLocalRulesMessage {
|
|
157
|
+
action: 'export_local_rules';
|
|
158
|
+
rules: PrintLocalRuleExport[];
|
|
159
|
+
skipped?: PrintLocalRuleSkip[];
|
|
160
|
+
[key: string]: unknown;
|
|
161
|
+
}
|
|
127
162
|
/** Any client→server JSON frame. */
|
|
128
|
-
export type ClientSocketMessage = SocketAuthMessage | SocketLogsMessage | SocketHeartbeatMessage | SocketAckMessage | SocketRegisterPrintersMessage;
|
|
163
|
+
export type ClientSocketMessage = SocketAuthMessage | SocketLogsMessage | SocketHeartbeatMessage | SocketAckMessage | SocketRegisterPrintersMessage | SocketExportLocalRulesMessage;
|
|
129
164
|
/**
|
|
130
165
|
* Why the backend refused the handshake (api#977 / app#1353).
|
|
131
166
|
*
|
package/dist/userActivity.d.ts
CHANGED
|
@@ -443,7 +443,26 @@ declare global {
|
|
|
443
443
|
from_status: ProductChannelStatus;
|
|
444
444
|
to_status: ProductChannelStatus;
|
|
445
445
|
}
|
|
446
|
-
|
|
446
|
+
interface PrintRuleCreatedEvent extends UserActivityEventBase {
|
|
447
|
+
event: 'Print Rule Created';
|
|
448
|
+
use_case: PrintUseCase;
|
|
449
|
+
agent_id: string;
|
|
450
|
+
printer_id: string;
|
|
451
|
+
}
|
|
452
|
+
interface PrintRuleEditedEvent extends UserActivityEventBase {
|
|
453
|
+
event: 'Print Rule Edited';
|
|
454
|
+
use_case: PrintUseCase;
|
|
455
|
+
agent_id: string;
|
|
456
|
+
printer_id: string;
|
|
457
|
+
fields_changed: string[];
|
|
458
|
+
}
|
|
459
|
+
interface PrintRuleDeletedEvent extends UserActivityEventBase {
|
|
460
|
+
event: 'Print Rule Deleted';
|
|
461
|
+
use_case: PrintUseCase;
|
|
462
|
+
agent_id: string;
|
|
463
|
+
printer_id: string;
|
|
464
|
+
}
|
|
465
|
+
type UserActivityEvent = UserLoggedInEvent | UserLoggedOutEvent | UserPasswordChangedEvent | UserSuspendedEvent | TwoFactorEnrolledEvent | TwoFactorDisabledEvent | TwoFactorResetEvent | TwoFactorRecoveryCodesGeneratedEvent | StorePaletteChangedEvent | StoreSettingsUpdatedEvent | PlanChangedEvent | InvoiceCreatedEvent | OrderCreatedEvent | OrderCancelledEvent | OrderEditedEvent | OrderReturnedEvent | ProductPriceChangedEvent | CustomerCreatedEvent | CustomerEditedEvent | CashDrawerOpenedEvent | CashDrawerClosedEvent | TenantImpersonatedEvent | SecretRotatedEvent | UserCreatedEvent | UserUpdatedEvent | ProductCreatedEvent | ProductUpdatedEvent | StockIncomeCreatedEvent | CategoryCreatedEvent | CategoryUpdatedEvent | BrandCreatedEvent | BrandUpdatedEvent | SupplierCreatedEvent | SupplierUpdatedEvent | SupplierInvoiceCreatedEvent | SupplierAccountCreatedEvent | SupplierAccountUpdatedEvent | AccountCreatedEvent | AccountDeletedEvent | BasketUpdatedEvent | BasketDeletedEvent | CashDrawerMovementEvent | PaymentCreatedEvent | PaymentLinkedEvent | PaymentUnlinkedEvent | PaymentLinkageUpdatedEvent | NotificationReadEvent | LogDeletedEvent | PlanCreatedEvent | StoreMaintenanceToggledEvent | PlatformMaintenanceToggledEvent | 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 | PrintRuleCreatedEvent | PrintRuleEditedEvent | PrintRuleDeletedEvent;
|
|
447
466
|
}
|
|
448
467
|
/**
|
|
449
468
|
* Canonical whitelist of UI-only `UserActivityEvent` variant names — the 8
|