@reservation-studio/electron-types 0.0.31 → 0.0.33

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.
Files changed (25) hide show
  1. package/README.md +21 -11
  2. package/dist/api/exports.d.ts +2 -5
  3. package/dist/api/exports.js +1 -4
  4. package/dist/interfaces/{api.interface.d.ts → public/api.interface.d.ts} +17 -16
  5. package/dist/interfaces/public/fiscal-device/device.types.d.ts +228 -0
  6. package/dist/interfaces/public/fiscal-device/device.types.js +12 -0
  7. package/dist/interfaces/public/fiscal-device/diagnostics.types.d.ts +47 -0
  8. package/dist/interfaces/public/fiscal-device/errors.types.d.ts +78 -0
  9. package/dist/interfaces/public/fiscal-device/errors.types.js +50 -0
  10. package/dist/interfaces/public/fiscal-device/index.d.ts +5 -0
  11. package/dist/interfaces/public/fiscal-device/index.js +21 -0
  12. package/dist/interfaces/public/fiscal-device/receipts.types.d.ts +170 -0
  13. package/dist/interfaces/{fiscal-device.interface.js → public/fiscal-device/receipts.types.js} +1 -8
  14. package/dist/interfaces/public/fiscal-device/shared.types.d.ts +36 -0
  15. package/dist/interfaces/public/fiscal-device/shared.types.js +10 -0
  16. package/dist/interfaces/public/http.interface.js +2 -0
  17. package/dist/interfaces/public/index.d.ts +4 -0
  18. package/dist/interfaces/public/index.js +20 -0
  19. package/package.json +1 -1
  20. package/dist/interfaces/fiscal-device.interface.d.ts +0 -469
  21. /package/dist/interfaces/{api.interface.js → public/api.interface.js} +0 -0
  22. /package/dist/interfaces/{certificate-info.interface.d.ts → public/certificate-info.interface.d.ts} +0 -0
  23. /package/dist/interfaces/{certificate-info.interface.js → public/certificate-info.interface.js} +0 -0
  24. /package/dist/interfaces/{http.interface.js → public/fiscal-device/diagnostics.types.js} +0 -0
  25. /package/dist/interfaces/{http.interface.d.ts → public/http.interface.d.ts} +0 -0
package/README.md CHANGED
@@ -272,7 +272,7 @@ interface OperatorInfo {
272
272
 
273
273
  ### FiscalReceipt
274
274
 
275
- ````typescript
275
+ ```typescript
276
276
  interface FiscalReceipt {
277
277
  operator: OperatorInfo;
278
278
  uniqueSaleNumber: string; // numeric string up to 7 digits
@@ -280,6 +280,7 @@ interface FiscalReceipt {
280
280
  payments: FiscalPayment[];
281
281
  client?: FiscalClient;
282
282
  }
283
+ ```
283
284
 
284
285
  ### NonFiscalReceipt
285
286
 
@@ -290,9 +291,7 @@ interface NonFiscalReceipt {
290
291
  payments?: FiscalPayment[];
291
292
  client?: FiscalClient;
292
293
  }
293
- ````
294
-
295
- ````
294
+ ```
296
295
 
297
296
  ### FiscalReceiptItem
298
297
 
@@ -304,7 +303,7 @@ interface FiscalReceiptItem {
304
303
  vatGroup: FiscalVATGroup;
305
304
  discount?: number;
306
305
  }
307
- ````
306
+ ```
308
307
 
309
308
  ### FiscalPayment
310
309
 
@@ -366,14 +365,20 @@ interface FiscalMemoryRecord {
366
365
 
367
366
  ```typescript
368
367
  interface FiscalDeviceStatus {
369
- connected?: boolean;
370
- hasPaper?: boolean;
371
- fiscalMemoryFull?: boolean;
372
- fiscalReceiptOpen?: boolean;
373
- nonFiscalReceiptOpen?: boolean;
374
- printingAllowed?: boolean;
368
+ connected: boolean;
369
+ paperStatus: PaperStatus;
370
+ fiscalMemoryFull: boolean;
371
+ fiscalReceiptOpen: boolean;
372
+ nonFiscalReceiptOpen: boolean;
373
+ readyToPrint: boolean;
375
374
  messages: FiscalResponseMessage[];
376
375
  }
376
+
377
+ enum PaperStatus {
378
+ Ok = 'ok',
379
+ Low = 'low',
380
+ Out = 'out'
381
+ }
377
382
  ```
378
383
 
379
384
  ### FiscalResponseMessage
@@ -386,6 +391,11 @@ interface FiscalResponseMessage {
386
391
  }
387
392
  ```
388
393
 
394
+ ### Fiscal IPC Errors
395
+
396
+ Fiscal IPC calls throw a structured `FiscalDeviceErrorPayload` on failure. Consumers should display the payload `message` and use optional `details`, `status`, and `validationErrors` for diagnostics.
397
+ Because Electron IPC serializes thrown values, payloads are encoded as JSON in the error message when crossing the renderer boundary.
398
+
389
399
  ### ReversalReceipt
390
400
 
391
401
  ```typescript
@@ -1,10 +1,7 @@
1
- import { ApiInterface } from '../interfaces/api.interface';
1
+ import { ApiInterface } from '../interfaces/public';
2
2
  declare global {
3
3
  interface Window {
4
4
  ReservationStudioElectron: ApiInterface;
5
5
  }
6
6
  }
7
- export * from '../interfaces/api.interface';
8
- export * from '../interfaces/fiscal-device.interface';
9
- export * from '../interfaces/certificate-info.interface';
10
- export * from '../interfaces/http.interface';
7
+ export * from '../interfaces/public';
@@ -14,7 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("../interfaces/api.interface"), exports);
18
- __exportStar(require("../interfaces/fiscal-device.interface"), exports);
19
- __exportStar(require("../interfaces/certificate-info.interface"), exports);
20
- __exportStar(require("../interfaces/http.interface"), exports);
17
+ __exportStar(require("../interfaces/public"), exports);
@@ -1,7 +1,7 @@
1
1
  import { CertificateInfo } from './certificate-info.interface';
2
2
  import { HttpOptions, HttpResponse } from './http.interface';
3
- import { EnvironmentEnum } from '../enums/envirovment.enum';
4
- import { DeviceInfo, FiscalDeviceDiagnosticsOptions, FiscalDeviceDiagnosticsResult, FiscalDeviceResponse, FiscalDeviceStatus, FiscalMemoryRecord, FiscalReceipt, FiscalResponse, NonFiscalReceipt, ReversalReceipt } from './fiscal-device.interface';
3
+ import { EnvironmentEnum } from '../../enums/envirovment.enum';
4
+ import { DeviceInfo, FiscalDeviceDiagnosticsOptions, FiscalDeviceDiagnosticsResult, FiscalDeviceResponse, FiscalDeviceStatus, FiscalMemoryRecord, FiscalReceipt, FiscalResponse, NonFiscalReceipt, ReversalReceipt } from './fiscal-device';
5
5
  export interface ApiInterface {
6
6
  /**
7
7
  * An object representing operations related to certificates.
@@ -82,6 +82,7 @@ export interface ApiInterface {
82
82
  /**
83
83
  * An object representing operations related to fiscal devices.
84
84
  * All methods automatically initialize fiscal devices when needed.
85
+ * All methods can throw a FiscalDeviceErrorPayload on failure.
85
86
  */
86
87
  fiscalDevices: {
87
88
  /**
@@ -101,7 +102,7 @@ export interface ApiInterface {
101
102
  *
102
103
  * @param {string} deviceId - Device identifier from list/scan.
103
104
  * @return {Promise<DeviceInfo>} A promise that resolves to the detailed device information.
104
- * @throws {Error} If the device with the specified deviceId is not found.
105
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
105
106
  */
106
107
  getDeviceInfo(deviceId: string): Promise<DeviceInfo>;
107
108
  /**
@@ -110,7 +111,7 @@ export interface ApiInterface {
110
111
  * @param {FiscalReceipt} receipt - The receipt to print.
111
112
  * @param {string} deviceId - Device identifier from list/scan.
112
113
  * @return {Promise<FiscalResponse>} A promise that resolves to the fiscal response.
113
- * @throws {Error} If the device with the specified deviceId is not found.
114
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
114
115
  */
115
116
  printReceipt(receipt: FiscalReceipt, deviceId: string): Promise<FiscalResponse>;
116
117
  /**
@@ -119,7 +120,7 @@ export interface ApiInterface {
119
120
  * @param {NonFiscalReceipt} receipt - The receipt object containing details to be printed as a non-fiscal receipt.
120
121
  * @param {string} deviceId - Device identifier from list/scan.
121
122
  * @return {Promise<FiscalResponse>} A promise that resolves to a FiscalResponse object indicating the result of the operation.
122
- * @throws {Error} If the device with the specified deviceId is not found.
123
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
123
124
  */
124
125
  printNonFiscalReceipt(receipt: NonFiscalReceipt, deviceId: string): Promise<FiscalResponse>;
125
126
  /**
@@ -128,7 +129,7 @@ export interface ApiInterface {
128
129
  * @param {ReversalReceipt} receipt - The reversal receipt to print.
129
130
  * @param {string} deviceId - Device identifier from list/scan.
130
131
  * @return {Promise<FiscalResponse>} A promise that resolves to the fiscal response.
131
- * @throws {Error} If the device with the specified deviceId is not found.
132
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
132
133
  */
133
134
  printReversalReceipt(receipt: ReversalReceipt, deviceId: string): Promise<FiscalResponse>;
134
135
  /**
@@ -136,7 +137,7 @@ export interface ApiInterface {
136
137
  *
137
138
  * @param {string} deviceId - Device identifier from list/scan.
138
139
  * @return {Promise<FiscalMemoryRecord>} A promise that resolves to the last fiscal memory record.
139
- * @throws {Error} If the device with the specified deviceId is not found.
140
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
140
141
  */
141
142
  getLastFiscalRecord(deviceId: string): Promise<FiscalMemoryRecord>;
142
143
  /**
@@ -144,7 +145,7 @@ export interface ApiInterface {
144
145
  *
145
146
  * @param {string} deviceId - Device identifier from list/scan.
146
147
  * @return {Promise<FiscalDeviceStatus>} A promise that resolves to the status of the device.
147
- * @throws {Error} If the device with the specified deviceId is not found.
148
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
148
149
  */
149
150
  getStatus(deviceId: string): Promise<FiscalDeviceStatus>;
150
151
  /**
@@ -152,7 +153,7 @@ export interface ApiInterface {
152
153
  *
153
154
  * @param {string} deviceId - Device identifier from list/scan.
154
155
  * @return {Promise<boolean>} A promise that resolves to true if printing was successful.
155
- * @throws {Error} If the device with the specified deviceId is not found.
156
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
156
157
  */
157
158
  printXReport(deviceId: string): Promise<boolean>;
158
159
  /**
@@ -160,7 +161,7 @@ export interface ApiInterface {
160
161
  *
161
162
  * @param {string} deviceId - Device identifier from list/scan.
162
163
  * @return {Promise<boolean>} A promise that resolves to true if printing was successful.
163
- * @throws {Error} If the device with the specified deviceId is not found.
164
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
164
165
  */
165
166
  printZReport(deviceId: string): Promise<boolean>;
166
167
  /**
@@ -169,7 +170,7 @@ export interface ApiInterface {
169
170
  * @param {number} amount - The amount to deposit.
170
171
  * @param {string} deviceId - Device identifier from list/scan.
171
172
  * @return {Promise<boolean>} A promise that resolves to true if the deposit was successful.
172
- * @throws {Error} If the device with the specified deviceId is not found.
173
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
173
174
  */
174
175
  depositMoney(amount: number, deviceId: string): Promise<boolean>;
175
176
  /**
@@ -178,7 +179,7 @@ export interface ApiInterface {
178
179
  * @param {number} amount - The amount to withdraw.
179
180
  * @param {string} deviceId - Device identifier from list/scan.
180
181
  * @return {Promise<boolean>} A promise that resolves to true if the withdrawal was successful.
181
- * @throws {Error} If the device with the specified deviceId is not found.
182
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
182
183
  */
183
184
  withdrawMoney(amount: number, deviceId: string): Promise<boolean>;
184
185
  /**
@@ -186,7 +187,7 @@ export interface ApiInterface {
186
187
  *
187
188
  * @param {string} deviceId - Device identifier from list/scan.
188
189
  * @return {Promise<number>} A promise that resolves to the current cash amount.
189
- * @throws {Error} If the device with the specified deviceId is not found.
190
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
190
191
  */
191
192
  getCashAmount(deviceId: string): Promise<number>;
192
193
  /**
@@ -195,7 +196,7 @@ export interface ApiInterface {
195
196
  * @param {Date} dateTime - The date and time to set.
196
197
  * @param {string} deviceId - Device identifier from list/scan.
197
198
  * @return {Promise<boolean>} A promise that resolves to true if setting was successful.
198
- * @throws {Error} If the device with the specified deviceId is not found.
199
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
199
200
  */
200
201
  setDateTime(dateTime: Date, deviceId: string): Promise<boolean>;
201
202
  /**
@@ -203,7 +204,7 @@ export interface ApiInterface {
203
204
  *
204
205
  * @param {string} deviceId - Device identifier from list/scan.
205
206
  * @return {Promise<Date>} A promise that resolves to the device date/time.
206
- * @throws {Error} If the device with the specified deviceId is not found.
207
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
207
208
  */
208
209
  getDateTime(deviceId: string): Promise<Date>;
209
210
  /**
@@ -211,7 +212,7 @@ export interface ApiInterface {
211
212
  *
212
213
  * @param {string} deviceId - Device identifier from list/scan.
213
214
  * @return {Promise<boolean>} A promise that resolves to true if printing was successful.
214
- * @throws {Error} If the device with the specified deviceId is not found.
215
+ * @throws {FiscalDeviceErrorPayload} If the device with the specified deviceId is not found.
215
216
  */
216
217
  printDuplicate(deviceId: string): Promise<boolean>;
217
218
  /**
@@ -0,0 +1,228 @@
1
+ import { DeviceId, TransportType } from './shared.types';
2
+ import { FiscalPaymentType, FiscalVATGroup } from './receipts.types';
3
+ export interface DeviceCapabilities {
4
+ supportedOperations: {
5
+ printFiscalReceipt: boolean;
6
+ printNonFiscalReceipt: boolean;
7
+ printReversalReceipt: boolean;
8
+ printXReport: boolean;
9
+ printZReport: boolean;
10
+ printDuplicate: boolean;
11
+ depositMoney: boolean;
12
+ withdrawMoney: boolean;
13
+ getCashAmount: boolean;
14
+ setDateTime: boolean;
15
+ getDateTime: boolean;
16
+ getLastFiscalRecord: boolean;
17
+ getStatus: boolean;
18
+ printBarcode: boolean;
19
+ };
20
+ supportsInvoices: boolean;
21
+ supportsRefunds: boolean;
22
+ supportsCreditNotes: boolean;
23
+ maxItemTextLength: number;
24
+ maxCommentTextLength: number;
25
+ maxOperatorPasswordLength: number;
26
+ vatGroups: FiscalVATGroup[];
27
+ paymentTypes: FiscalPaymentType[];
28
+ }
29
+ /**
30
+ * Interface for fiscal memory record
31
+ */
32
+ export interface FiscalMemoryRecord {
33
+ /**
34
+ * The number of the record
35
+ */
36
+ number: string;
37
+ /**
38
+ * The date of the record
39
+ */
40
+ date: Date;
41
+ /**
42
+ * The total amount of the record
43
+ */
44
+ total: number;
45
+ }
46
+ /**
47
+ * Interface for fiscal device status
48
+ */
49
+ export declare enum PaperStatus {
50
+ Ok = "ok",
51
+ Low = "low",
52
+ Out = "out"
53
+ }
54
+ export interface FiscalDeviceStatus {
55
+ /**
56
+ * High-level paper status derived from device flags.
57
+ */
58
+ paperStatus: PaperStatus;
59
+ /**
60
+ * Whether the device is connected
61
+ */
62
+ connected: boolean;
63
+ /**
64
+ * Whether the fiscal memory is full
65
+ */
66
+ fiscalMemoryFull: boolean;
67
+ /**
68
+ * Whether a fiscal receipt is currently open
69
+ */
70
+ fiscalReceiptOpen: boolean;
71
+ /**
72
+ * Whether a non-fiscal receipt is currently open
73
+ */
74
+ nonFiscalReceiptOpen: boolean;
75
+ /**
76
+ * Whether the device is ready to accept print commands.
77
+ */
78
+ readyToPrint: boolean;
79
+ /**
80
+ * The messages returned by the fiscal device
81
+ */
82
+ messages: FiscalResponseMessage[];
83
+ /**
84
+ * Raw status bytes, if available
85
+ */
86
+ rawStatusBytes?: number[];
87
+ }
88
+ /**
89
+ * Interface for fiscal device information in list responses
90
+ */
91
+ export interface FiscalDeviceResponse {
92
+ /**
93
+ * Device identifier (stable for the device model/serial)
94
+ */
95
+ deviceId: DeviceId;
96
+ /**
97
+ * The manufacturer of the fiscal device
98
+ */
99
+ manufacturer: string;
100
+ /**
101
+ * The model name of the fiscal device
102
+ */
103
+ model: string;
104
+ /**
105
+ * The serial number of the fiscal device
106
+ */
107
+ serialNumber: string;
108
+ /**
109
+ * Transport type used to access the device
110
+ */
111
+ transport?: TransportType;
112
+ /**
113
+ * Device capabilities
114
+ */
115
+ capabilities?: DeviceCapabilities;
116
+ }
117
+ /**
118
+ * Interface for detailed device information
119
+ */
120
+ export interface DeviceInfo {
121
+ /**
122
+ * Device identifier (stable for the device model/serial)
123
+ */
124
+ deviceId: DeviceId;
125
+ /**
126
+ * The serial number of the fiscal device
127
+ */
128
+ serialNumber: string;
129
+ /**
130
+ * The fiscal memory serial number
131
+ */
132
+ fiscalMemorySerialNumber: string;
133
+ /**
134
+ * The manufacturer of the fiscal device
135
+ */
136
+ manufacturer: string;
137
+ /**
138
+ * The model name of the fiscal device
139
+ */
140
+ model: string;
141
+ /**
142
+ * Driver identifier
143
+ */
144
+ driverId?: string;
145
+ /**
146
+ * Transport type
147
+ */
148
+ transport?: TransportType;
149
+ /**
150
+ * The firmware version of the fiscal device
151
+ */
152
+ firmwareVersion: string;
153
+ /**
154
+ * The current date and time of the fiscal device
155
+ */
156
+ currentDateTime?: string;
157
+ /**
158
+ * The maximum length of item text
159
+ */
160
+ itemTextMaxLength: number;
161
+ /**
162
+ * The maximum length of comment text
163
+ */
164
+ commentTextMaxLength: number;
165
+ /**
166
+ * The maximum length of operator password
167
+ */
168
+ operatorPasswordMaxLength: number;
169
+ /**
170
+ * The supported payment types
171
+ */
172
+ supportedPaymentTypes: FiscalPaymentType[];
173
+ }
174
+ /**
175
+ * Interface for fiscal response
176
+ */
177
+ export interface FiscalResponse {
178
+ /**
179
+ * The receipt number (if applicable)
180
+ */
181
+ number?: string;
182
+ /**
183
+ * Represents a unique identifier for a receipt generated for a particular sale.
184
+ * This variable is used to ensure that each sale has a distinct and traceable number.
185
+ * It may be undefined if no sale has been processed or the number has not been generated yet.
186
+ */
187
+ generatedUniqueSaleNumber?: string;
188
+ /**
189
+ * The receipt date and time (if applicable)
190
+ */
191
+ datetime?: string;
192
+ /**
193
+ * The receipt amount (if applicable)
194
+ */
195
+ amount?: number;
196
+ /**
197
+ * Represents an optional piece of information regarding a device.
198
+ * This variable can store details such as the device's specifications,
199
+ * status, or metadata, depending on the structure of the `DeviceInfo` type.
200
+ *
201
+ * The value of `deviceInfo` may be undefined if no device information is available.
202
+ *
203
+ * @type {DeviceInfo | undefined}
204
+ */
205
+ deviceInfo?: DeviceInfo;
206
+ /**
207
+ * The messages returned by the fiscal device
208
+ */
209
+ messages: FiscalResponseMessage[];
210
+ }
211
+ /**
212
+ * Interface for fiscal response message
213
+ */
214
+ export interface FiscalResponseMessage {
215
+ /**
216
+ * The type of the message
217
+ */
218
+ type: 'info' | 'warning' | 'error';
219
+ /**
220
+ * The code of the message (if applicable).
221
+ * Daisy example codes: E301 (out of paper), W301/W302 (paper low), E999 (general error).
222
+ */
223
+ code?: string;
224
+ /**
225
+ * The text of the message
226
+ */
227
+ text: string;
228
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaperStatus = void 0;
4
+ /**
5
+ * Interface for fiscal device status
6
+ */
7
+ var PaperStatus;
8
+ (function (PaperStatus) {
9
+ PaperStatus["Ok"] = "ok";
10
+ PaperStatus["Low"] = "low";
11
+ PaperStatus["Out"] = "out";
12
+ })(PaperStatus || (exports.PaperStatus = PaperStatus = {}));
@@ -0,0 +1,47 @@
1
+ import { DeviceId, OperatorInfo } from './shared.types';
2
+ import { FiscalVATGroup } from './receipts.types';
3
+ import { DeviceInfo, FiscalDeviceStatus, FiscalMemoryRecord, FiscalResponse } from './device.types';
4
+ export type FiscalDeviceDiagnosticStepName = 'deviceInfo' | 'status' | 'lastFiscalRecord' | 'cashAmount' | 'nonFiscalReceipt';
5
+ export interface FiscalDeviceDiagnosticStepBase {
6
+ name: FiscalDeviceDiagnosticStepName;
7
+ ok: boolean;
8
+ startedAt: string;
9
+ finishedAt: string;
10
+ skipped?: boolean;
11
+ skipReason?: string;
12
+ error?: string;
13
+ }
14
+ export interface FiscalDeviceDiagnosticStepDeviceInfo extends FiscalDeviceDiagnosticStepBase {
15
+ name: 'deviceInfo';
16
+ data?: DeviceInfo;
17
+ }
18
+ export interface FiscalDeviceDiagnosticStepStatus extends FiscalDeviceDiagnosticStepBase {
19
+ name: 'status';
20
+ data?: FiscalDeviceStatus;
21
+ }
22
+ export interface FiscalDeviceDiagnosticStepLastFiscalRecord extends FiscalDeviceDiagnosticStepBase {
23
+ name: 'lastFiscalRecord';
24
+ data?: FiscalMemoryRecord;
25
+ }
26
+ export interface FiscalDeviceDiagnosticStepCashAmount extends FiscalDeviceDiagnosticStepBase {
27
+ name: 'cashAmount';
28
+ data?: number;
29
+ }
30
+ export interface FiscalDeviceDiagnosticStepNonFiscalReceipt extends FiscalDeviceDiagnosticStepBase {
31
+ name: 'nonFiscalReceipt';
32
+ data?: FiscalResponse;
33
+ }
34
+ export type FiscalDeviceDiagnosticStep = FiscalDeviceDiagnosticStepDeviceInfo | FiscalDeviceDiagnosticStepStatus | FiscalDeviceDiagnosticStepLastFiscalRecord | FiscalDeviceDiagnosticStepCashAmount | FiscalDeviceDiagnosticStepNonFiscalReceipt;
35
+ export interface FiscalDeviceDiagnosticsOptions {
36
+ operator: OperatorInfo;
37
+ amount?: number;
38
+ vatGroup?: FiscalVATGroup;
39
+ itemName?: string;
40
+ }
41
+ export interface FiscalDeviceDiagnosticsResult {
42
+ deviceId: DeviceId;
43
+ ok: boolean;
44
+ startedAt: string;
45
+ finishedAt: string;
46
+ steps: FiscalDeviceDiagnosticStep[];
47
+ }
@@ -0,0 +1,78 @@
1
+ import { DeviceId, TransportType } from './shared.types';
2
+ import { FiscalDeviceStatus } from './device.types';
3
+ /**
4
+ * Enum for fiscal device error codes
5
+ */
6
+ export declare enum FiscalErrorCode {
7
+ CONNECTION_ERROR = "CONNECTION_ERROR",
8
+ DEVICE_NOT_FOUND = "DEVICE_NOT_FOUND",
9
+ COMMUNICATION_ERROR = "COMMUNICATION_ERROR",
10
+ TIMEOUT_ERROR = "TIMEOUT_ERROR",
11
+ OPERATION_FAILED = "OPERATION_FAILED",
12
+ INVALID_COMMAND = "INVALID_COMMAND",
13
+ UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION",
14
+ DEVICE_BUSY = "DEVICE_BUSY",
15
+ DEVICE_OFFLINE = "DEVICE_OFFLINE",
16
+ DEVICE_ERROR = "DEVICE_ERROR",
17
+ DEVICE_STATUS_ERROR = "DEVICE_STATUS_ERROR",
18
+ FISCAL_MEMORY_FULL = "FISCAL_MEMORY_FULL",
19
+ FISCAL_MEMORY_ERROR = "FISCAL_MEMORY_ERROR",
20
+ OUT_OF_PAPER = "OUT_OF_PAPER",
21
+ PRINTER_ERROR = "PRINTER_ERROR",
22
+ AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED",
23
+ INVALID_OPERATOR = "INVALID_OPERATOR",
24
+ WRONG_PASSWORD = "WRONG_PASSWORD",
25
+ VALIDATION_ERROR = "VALIDATION_ERROR",
26
+ INVALID_DATA = "INVALID_DATA",
27
+ REQUIRED_FIELD_MISSING = "REQUIRED_FIELD_MISSING",
28
+ RECEIPT_ERROR = "RECEIPT_ERROR",
29
+ RECEIPT_OPEN_ERROR = "RECEIPT_OPEN_ERROR",
30
+ PAYMENT_ERROR = "PAYMENT_ERROR",
31
+ REPORT_ERROR = "REPORT_ERROR",
32
+ REPORT_GENERATION_ERROR = "REPORT_GENERATION_ERROR",
33
+ CONFIGURATION_ERROR = "CONFIGURATION_ERROR",
34
+ INVALID_CONFIGURATION = "INVALID_CONFIGURATION",
35
+ UNKNOWN_ERROR = "UNKNOWN_ERROR",
36
+ INTERNAL_ERROR = "INTERNAL_ERROR"
37
+ }
38
+ export type FiscalDeviceErrorName = 'FiscalDeviceError' | 'FiscalDeviceOperationError' | 'FiscalDeviceConnectionError' | 'FiscalDeviceStatusError' | 'FiscalDeviceTimeoutError' | 'FiscalDeviceValidationError';
39
+ /**
40
+ * Context attached to fiscal device errors to help external integrations.
41
+ */
42
+ export interface FiscalDeviceErrorContext {
43
+ /**
44
+ * Device identifier from list/scan.
45
+ */
46
+ deviceId?: DeviceId;
47
+ /**
48
+ * IPC action or higher-level operation label.
49
+ */
50
+ action?: string;
51
+ /**
52
+ * Driver identifier, if known.
53
+ */
54
+ driverId?: string;
55
+ /**
56
+ * Transport type used for the connection.
57
+ */
58
+ transport?: TransportType;
59
+ /**
60
+ * Driver-level operation name (e.g. printReceipt, getStatus).
61
+ */
62
+ operation?: string;
63
+ }
64
+ /**
65
+ * Standardized error payload for fiscal device operations.
66
+ * This is the shape exposed to external systems over IPC.
67
+ */
68
+ export interface FiscalDeviceErrorPayload {
69
+ name: FiscalDeviceErrorName;
70
+ message: string;
71
+ code: FiscalErrorCode;
72
+ retryable: boolean;
73
+ timestamp: string;
74
+ context?: FiscalDeviceErrorContext;
75
+ validationErrors?: string[];
76
+ status?: FiscalDeviceStatus;
77
+ details?: Record<string, unknown>;
78
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FiscalErrorCode = void 0;
4
+ /**
5
+ * Enum for fiscal device error codes
6
+ */
7
+ var FiscalErrorCode;
8
+ (function (FiscalErrorCode) {
9
+ // Connection errors
10
+ FiscalErrorCode["CONNECTION_ERROR"] = "CONNECTION_ERROR";
11
+ FiscalErrorCode["DEVICE_NOT_FOUND"] = "DEVICE_NOT_FOUND";
12
+ FiscalErrorCode["COMMUNICATION_ERROR"] = "COMMUNICATION_ERROR";
13
+ FiscalErrorCode["TIMEOUT_ERROR"] = "TIMEOUT_ERROR";
14
+ // Operation errors
15
+ FiscalErrorCode["OPERATION_FAILED"] = "OPERATION_FAILED";
16
+ FiscalErrorCode["INVALID_COMMAND"] = "INVALID_COMMAND";
17
+ FiscalErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION";
18
+ // Device status errors
19
+ FiscalErrorCode["DEVICE_BUSY"] = "DEVICE_BUSY";
20
+ FiscalErrorCode["DEVICE_OFFLINE"] = "DEVICE_OFFLINE";
21
+ FiscalErrorCode["DEVICE_ERROR"] = "DEVICE_ERROR";
22
+ FiscalErrorCode["DEVICE_STATUS_ERROR"] = "DEVICE_STATUS_ERROR";
23
+ // Fiscal memory errors
24
+ FiscalErrorCode["FISCAL_MEMORY_FULL"] = "FISCAL_MEMORY_FULL";
25
+ FiscalErrorCode["FISCAL_MEMORY_ERROR"] = "FISCAL_MEMORY_ERROR";
26
+ // Paper errors
27
+ FiscalErrorCode["OUT_OF_PAPER"] = "OUT_OF_PAPER";
28
+ FiscalErrorCode["PRINTER_ERROR"] = "PRINTER_ERROR";
29
+ // Authentication errors
30
+ FiscalErrorCode["AUTHENTICATION_FAILED"] = "AUTHENTICATION_FAILED";
31
+ FiscalErrorCode["INVALID_OPERATOR"] = "INVALID_OPERATOR";
32
+ FiscalErrorCode["WRONG_PASSWORD"] = "WRONG_PASSWORD";
33
+ // Validation errors
34
+ FiscalErrorCode["VALIDATION_ERROR"] = "VALIDATION_ERROR";
35
+ FiscalErrorCode["INVALID_DATA"] = "INVALID_DATA";
36
+ FiscalErrorCode["REQUIRED_FIELD_MISSING"] = "REQUIRED_FIELD_MISSING";
37
+ // Fiscal receipt errors
38
+ FiscalErrorCode["RECEIPT_ERROR"] = "RECEIPT_ERROR";
39
+ FiscalErrorCode["RECEIPT_OPEN_ERROR"] = "RECEIPT_OPEN_ERROR";
40
+ FiscalErrorCode["PAYMENT_ERROR"] = "PAYMENT_ERROR";
41
+ // Report errors
42
+ FiscalErrorCode["REPORT_ERROR"] = "REPORT_ERROR";
43
+ FiscalErrorCode["REPORT_GENERATION_ERROR"] = "REPORT_GENERATION_ERROR";
44
+ // Configuration errors
45
+ FiscalErrorCode["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
46
+ FiscalErrorCode["INVALID_CONFIGURATION"] = "INVALID_CONFIGURATION";
47
+ // Generic errors
48
+ FiscalErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
49
+ FiscalErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
50
+ })(FiscalErrorCode || (exports.FiscalErrorCode = FiscalErrorCode = {}));
@@ -0,0 +1,5 @@
1
+ export * from './shared.types';
2
+ export * from './receipts.types';
3
+ export * from './device.types';
4
+ export * from './diagnostics.types';
5
+ export * from './errors.types';