@miguelmorales13/nestkit 0.29.0 → 0.31.0

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.
@@ -0,0 +1,201 @@
1
+ import type { I18nMessage } from '../../i18n/message.js';
2
+ import type { CredentialsCipher } from '../connect/credentials-cipher.js';
3
+ import { OPENPAY_PROVIDER_ERROR, type BankTransfer, type OpenpayCredentials, type OpenpayCustomer, type OpenpayMethod, type OpenpayPaymentState } from './openpay-api.js';
4
+ /** What is persisted (encrypted JSON) per connected merchant. Keep the names if you already have rows. */
5
+ export interface OpenpayStoredCredentials extends OpenpayCredentials {
6
+ /** Partner token, kept to fetch the merchant again; Openpay's own secret key does not expire. */
7
+ refreshToken?: string;
8
+ /** Basic-auth password that Openpay sends back on every notice for this merchant. */
9
+ webhookPassword: string;
10
+ /** Openpay's own view of the account (`active`…): a freshly registered merchant may still be confirming. */
11
+ merchantStatus?: string;
12
+ }
13
+ /** One connected merchant of a tenant (a store, a branch…). What your database row looks like. */
14
+ export interface OpenpayConnectionRecord {
15
+ /** The tenant that owns it. One connection per tenant. */
16
+ scopeId: string;
17
+ encryptedCredentials: string;
18
+ /** Goes in the webhook URL and is the Basic-auth user. Unique. */
19
+ webhookToken: string;
20
+ webhookId: string | null;
21
+ /** The code Openpay sent to activate the webhook, until it is used. */
22
+ verificationCode: string | null;
23
+ /** Keys of one environment only: a sandbox merchant never charges for real. */
24
+ sandbox: boolean;
25
+ active: boolean;
26
+ createdAt: Date;
27
+ }
28
+ /**
29
+ * Where connections live. Implement it over any table. `findByWebhookToken` runs without a tenant in context (the
30
+ * webhook), so it needs an implementation that is allowed to cross tenants.
31
+ */
32
+ export interface OpenpayConnectionStore {
33
+ find(scopeId: string): Promise<OpenpayConnectionRecord | null>;
34
+ /** Insert or replace the tenant's only connection. */
35
+ upsert(data: Omit<OpenpayConnectionRecord, 'createdAt'>): Promise<OpenpayConnectionRecord>;
36
+ update(scopeId: string, patch: Partial<Omit<OpenpayConnectionRecord, 'scopeId' | 'createdAt'>>): Promise<void>;
37
+ /** `false` when the tenant had none. */
38
+ delete(scopeId: string): Promise<boolean>;
39
+ findByWebhookToken(token: string): Promise<OpenpayConnectionRecord | null>;
40
+ }
41
+ /** An Openpay partner application: what Openpay emailed when the partner registered (sandbox and production differ). */
42
+ export interface OpenpayPartner {
43
+ clientId: string;
44
+ clientSecret: string;
45
+ /** Character for character the URL registered on the partner form. */
46
+ redirectUri: string;
47
+ }
48
+ export type OpenpayMessageKey = 'notConfigured' | 'notConnected' | 'badState' | 'notAuthorized' | 'refundUnsupported' | 'minimumAmount';
49
+ type Message = string | I18nMessage;
50
+ export interface OpenpayConnectionsOptions {
51
+ store: OpenpayConnectionStore;
52
+ /** Without it the whole feature reports `available === false`. Build it with `CredentialsCipher.fromHex`. */
53
+ cipher: CredentialsCipher | null | (() => CredentialsCipher | null);
54
+ /** Your partner application for the environment in use; `null` when it is not configured. */
55
+ partner: OpenpayPartner | null | (() => OpenpayPartner | null);
56
+ /** `true` while testing against Openpay's sandbox. Default `false`. */
57
+ sandbox?: boolean | (() => boolean);
58
+ /** Secret that signs the OAuth `state`. */
59
+ stateSecret: string | (() => string | undefined);
60
+ /** Public URL of your API that receives the notices, given the connection's token. */
61
+ publicWebhookUrl: (webhookToken: string) => string;
62
+ /** The `fetch` for Openpay (timeouts, retries, alerts). Charges are idempotent by `orderId`, so retrying is safe. */
63
+ fetchImpl?: (scopeId?: string) => typeof fetch;
64
+ /** Test doubles. */
65
+ apiBaseUrl?: string;
66
+ dashboardBaseUrl?: string;
67
+ /** Smallest amount Openpay accepts, in cents. Default 1000 (MX$10). */
68
+ minimumCents?: number;
69
+ messages?: Partial<Record<OpenpayMessageKey, Message>>;
70
+ }
71
+ /** The connection without its secrets, ready to show. */
72
+ export interface OpenpayConnectionView {
73
+ connected: boolean;
74
+ /** Connected and Openpay confirms the account: it can charge. */
75
+ ready: boolean;
76
+ sandbox: boolean;
77
+ merchantId: string | null;
78
+ merchantStatus: string | null;
79
+ /** The webhook is active: payments confirm on their own. If not, `lookup` still tells the truth. */
80
+ notices: boolean;
81
+ }
82
+ export interface OpenpayPaymentInput {
83
+ method: OpenpayMethod;
84
+ /** Your id for the sale: comes back in the notice and prevents charging the same sale twice. */
85
+ reference: string;
86
+ description: string;
87
+ amountCents: number;
88
+ customer?: OpenpayCustomer;
89
+ /** Card only: where the buyer lands after paying. */
90
+ returnUrl?: string;
91
+ /** Transfer only: last day to pay. Default 3 days. */
92
+ dueDate?: Date;
93
+ sendEmail?: boolean;
94
+ clientIp?: string;
95
+ }
96
+ export interface OpenpayPayment {
97
+ method: OpenpayMethod;
98
+ chargeId: string;
99
+ reference: string;
100
+ state: OpenpayPaymentState;
101
+ /** Card: Openpay's form. Transfer: the printable receipt with the CLABE (only while pending). */
102
+ url: string;
103
+ /** Transfer only: what to show the buyer. */
104
+ transfer: BankTransfer | null;
105
+ }
106
+ export interface OpenpayLookup {
107
+ chargeId: string;
108
+ method: string;
109
+ reference: string | null;
110
+ state: OpenpayPaymentState;
111
+ paidCents: number | null;
112
+ }
113
+ /** What a notice means once Openpay itself confirmed it. */
114
+ export type OpenpayNotice = {
115
+ kind: 'payment';
116
+ scopeId: string;
117
+ chargeId: string;
118
+ reference: string | null;
119
+ state: OpenpayPaymentState;
120
+ paidCents: number | null;
121
+ method: string;
122
+ } | {
123
+ kind: 'verification';
124
+ scopeId: string;
125
+ } | {
126
+ kind: 'ignored';
127
+ };
128
+ /**
129
+ * Everything around Openpay for a multi-tenant app: the merchant signs in (or registers) at Openpay, authorizes you
130
+ * through OAuth and you charge on THEIR account — cards through Openpay's hosted form and bank transfers (SPEI) with a
131
+ * CLABE and a reference. No keys are typed in; the money never passes through you. Payments confirm through a webhook
132
+ * that this class registers for them, and the state is always re-read from Openpay.
133
+ *
134
+ * Framework-free: persistence is the {@link OpenpayConnectionStore} port, secrets go through a
135
+ * {@link CredentialsCipher}, and what changes between sandbox and production is an option.
136
+ */
137
+ export declare class OpenpayConnections {
138
+ private readonly o;
139
+ private readonly log;
140
+ private readonly msg;
141
+ constructor(o: OpenpayConnectionsOptions);
142
+ private get cipher();
143
+ private get partner();
144
+ private get sandbox();
145
+ private get stateSecret();
146
+ private dashboard;
147
+ private http;
148
+ private apiOptions;
149
+ /** The feature is on: a cipher, a partner application and a signing secret are configured. */
150
+ get available(): boolean;
151
+ private requireCipher;
152
+ private credentialsOf;
153
+ private recordOf;
154
+ private apiOf;
155
+ /**
156
+ * Where to send the merchant: Openpay lets them pick "use my account" (they sign in and authorize) or "new account"
157
+ * (they register right there). `extra` rides in the signed `state` and comes back from {@link complete}.
158
+ */
159
+ authorizationUrl(scopeId: string, extra?: Record<string, string>): string;
160
+ /** Reads the callback's `state` without trading the code: who started the flow (and what they sent along). */
161
+ readState<T extends Record<string, string> = Record<string, string>>(state: string | undefined): (T & {
162
+ scopeId: string;
163
+ }) | null;
164
+ /**
165
+ * Trades the callback's `code` for the merchant's keys, saves them encrypted and registers the webhook that
166
+ * confirms payments. A failure of the webhook does not undo the connection: charges still work and `lookup` reads
167
+ * the truth; call {@link ensureNotices} to retry.
168
+ */
169
+ complete(input: {
170
+ code?: string;
171
+ state?: string;
172
+ error?: string;
173
+ }): Promise<{
174
+ scopeId: string;
175
+ extra: Record<string, string>;
176
+ view: OpenpayConnectionView;
177
+ }>;
178
+ private oauth;
179
+ /** Registers (or repairs) the webhook so paid sales confirm by themselves. Safe to call again. */
180
+ ensureNotices(scopeId: string): Promise<boolean>;
181
+ private dropWebhook;
182
+ view(scopeId: string, known?: OpenpayConnectionRecord | null): Promise<OpenpayConnectionView>;
183
+ /** Disconnects: removes the webhook (best effort) and forgets the keys. */
184
+ disconnect(scopeId: string): Promise<boolean>;
185
+ /** Opens a charge on the merchant's account: a card link or a bank transfer with CLABE. */
186
+ createPayment(scopeId: string, p: OpenpayPaymentInput): Promise<OpenpayPayment>;
187
+ /** The state of a charge according to Openpay. */
188
+ lookup(scopeId: string, chargeId: string): Promise<OpenpayLookup>;
189
+ /** Gives money back on a card charge (Openpay does not refund SPEI). `amountCents` omitted = all of it. */
190
+ refund(scopeId: string, chargeId: string, amountCents?: number, description?: string): Promise<OpenpayLookup>;
191
+ private text;
192
+ /**
193
+ * Handles a webhook call. `token` is the last segment of the URL, `authorization` the `Authorization` header (HTTP
194
+ * Basic, user = token, password = the one stored for the merchant). A payment notice is never believed: the charge
195
+ * is read again from Openpay and only that answer counts. Always answer 200 to what this returns; throw only for a
196
+ * wrong password so a forged call learns nothing.
197
+ */
198
+ handleNotice(token: string, authorization: string | undefined, body: unknown): Promise<OpenpayNotice>;
199
+ private validBasic;
200
+ }
201
+ export { OPENPAY_PROVIDER_ERROR };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Minimal ESC/POS builder: enough for a receipt and the cash drawer. Chainable; `bytes()` returns what to send.
3
+ */
4
+ export declare class EscPosBuilder {
5
+ private readonly out;
6
+ /** Reset and select CP858 so accents print. */
7
+ init(): this;
8
+ text(value: string): this;
9
+ line(value?: string): this;
10
+ feed(lines?: number): this;
11
+ align(to: 'left' | 'center' | 'right'): this;
12
+ bold(on: boolean): this;
13
+ /** 1 = normal, 2 = double width and height. */
14
+ size(multiplier: 1 | 2): this;
15
+ /** Feed and cut (partial). */
16
+ cut(): this;
17
+ /**
18
+ * Pulse the cash drawer through the printer's RJ11 (the drawer has no connection of its own). Both kick pins are
19
+ * pulsed: drawers are wired to pin 2 or to pin 5 depending on the model, and a pulse on the wrong one does nothing.
20
+ */
21
+ openDrawer(): this;
22
+ raw(bytes: ArrayLike<number>): this;
23
+ bytes(): Uint8Array;
24
+ /** What `PrintQueue.enqueue` takes as `payload`. */
25
+ toBase64(): string;
26
+ }
@@ -0,0 +1,302 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }require('../chunk-LRX7AMSS.cjs');
2
+
3
+ // src/printing/print-queue.ts
4
+ var _crypto = require('crypto');
5
+
6
+ // src/printing/printing.types.ts
7
+ var DEFAULT_CONNECTION_TTL_MS = 45e3;
8
+ var DEFAULT_JOB_TTL_MS = 15 * 6e4;
9
+ var DEFAULT_CLAIM_TTL_MS = 6e4;
10
+ var DEFAULT_MAX_ATTEMPTS = 3;
11
+ var DEFAULT_MAX_PAYLOAD_CHARS = Math.ceil(256 * 1024 * 4 / 3);
12
+
13
+ // src/printing/print-queue.ts
14
+ var PrintQueue = class {
15
+ constructor(store, options = {}) {
16
+ this.store = store;
17
+ this.jobTtl = _nullishCoalesce(options.jobTtlMs, () => ( DEFAULT_JOB_TTL_MS));
18
+ this.claimTtl = _nullishCoalesce(options.claimTtlMs, () => ( DEFAULT_CLAIM_TTL_MS));
19
+ this.maxAttempts = _nullishCoalesce(options.maxAttempts, () => ( DEFAULT_MAX_ATTEMPTS));
20
+ this.maxPayload = _nullishCoalesce(options.maxPayloadChars, () => ( DEFAULT_MAX_PAYLOAD_CHARS));
21
+ this.now = _nullishCoalesce(options.now, () => ( Date.now));
22
+ }
23
+ /** Same `idempotencyKey` returns the job already queued (`duplicate: true`) instead of queuing a second one. */
24
+ async enqueue(input) {
25
+ if (!input.payload || input.payload.length > this.maxPayload || !/^[A-Za-z0-9+/]+={0,2}$/.test(input.payload)) {
26
+ throw new Error("invalid print payload");
27
+ }
28
+ const key = _nullishCoalesce(input.idempotencyKey, () => ( null));
29
+ if (key) {
30
+ const prior = await this.store.findByKey(input.tenant, key);
31
+ if (prior) return { job: prior, duplicate: true };
32
+ }
33
+ const now = this.now();
34
+ const job = {
35
+ id: _crypto.randomUUID.call(void 0, ),
36
+ tenant: input.tenant,
37
+ printerId: input.printerId,
38
+ use: input.use,
39
+ payload: input.payload,
40
+ status: "pending",
41
+ attempts: 0,
42
+ idempotencyKey: key,
43
+ error: null,
44
+ createdAt: now,
45
+ claimedAt: null,
46
+ claimedBy: null,
47
+ finishedAt: null,
48
+ expiresAt: now + this.jobTtl
49
+ };
50
+ await this.store.insert(job);
51
+ return { job, duplicate: false };
52
+ }
53
+ /** What a station asks for: the jobs of the printers it holds. Never hands the same job to two stations. */
54
+ async claim(tenant, stationId, printerIds, limit = 5) {
55
+ if (printerIds.length === 0) return [];
56
+ const now = this.now();
57
+ await this.store.expire(tenant, now);
58
+ return this.store.claim(tenant, printerIds, stationId, now, this.claimTtl, limit);
59
+ }
60
+ /** The station printed it. */
61
+ async done(tenant, jobId, stationId) {
62
+ return this.store.finish(tenant, jobId, stationId, { status: "done", error: null, finishedAt: this.now() });
63
+ }
64
+ /** The station could not print it: back to the queue until `maxAttempts`, then `failed`. Returns the final status. */
65
+ async fail(tenant, jobId, stationId, error) {
66
+ const job = await this.store.get(tenant, jobId);
67
+ if (!job) return null;
68
+ if (job.attempts >= this.maxAttempts) {
69
+ const ok = await this.store.finish(tenant, jobId, stationId, { status: "failed", error, finishedAt: this.now() });
70
+ return ok ? "failed" : null;
71
+ }
72
+ return await this.store.release(tenant, jobId, stationId, error) ? "pending" : null;
73
+ }
74
+ /** Jobs still waiting or being printed, oldest first (the «n en cola» of the screen). */
75
+ open(tenant) {
76
+ return this.store.listOpen(tenant);
77
+ }
78
+ };
79
+
80
+ // src/printing/memory.store.ts
81
+ var MemoryPrintJobStore = class {
82
+ constructor() {
83
+ this.rows = /* @__PURE__ */ new Map();
84
+ }
85
+ async insert(job) {
86
+ this.rows.set(job.id, { ...job });
87
+ }
88
+ async findByKey(tenant, key) {
89
+ for (const j of this.rows.values()) if (j.tenant === tenant && j.idempotencyKey === key) return { ...j };
90
+ return null;
91
+ }
92
+ async get(tenant, id) {
93
+ const j = this.rows.get(id);
94
+ return j && j.tenant === tenant ? { ...j } : null;
95
+ }
96
+ async claim(tenant, printerIds, by, now, claimTtlMs, limit) {
97
+ const taken = [];
98
+ const open = [...this.rows.values()].filter(
99
+ (j) => j.tenant === tenant && printerIds.includes(j.printerId) && (j.status === "pending" || j.status === "claimed" && now - (_nullishCoalesce(j.claimedAt, () => ( 0))) > claimTtlMs)
100
+ ).sort((a, b) => a.createdAt - b.createdAt).slice(0, limit);
101
+ for (const j of open) {
102
+ j.status = "claimed";
103
+ j.claimedAt = now;
104
+ j.claimedBy = by;
105
+ j.attempts += 1;
106
+ taken.push({ ...j });
107
+ }
108
+ return taken;
109
+ }
110
+ async finish(tenant, id, by, patch) {
111
+ const j = this.rows.get(id);
112
+ if (!j || j.tenant !== tenant || j.status !== "claimed" || j.claimedBy !== by) return false;
113
+ Object.assign(j, patch);
114
+ return true;
115
+ }
116
+ async release(tenant, id, by, error) {
117
+ const j = this.rows.get(id);
118
+ if (!j || j.tenant !== tenant || j.status !== "claimed" || j.claimedBy !== by) return false;
119
+ j.status = "pending";
120
+ j.claimedAt = null;
121
+ j.claimedBy = null;
122
+ j.error = error;
123
+ return true;
124
+ }
125
+ async listOpen(tenant) {
126
+ return [...this.rows.values()].filter((j) => j.tenant === tenant && (j.status === "pending" || j.status === "claimed")).sort((a, b) => a.createdAt - b.createdAt).map((j) => ({ ...j }));
127
+ }
128
+ async expire(tenant, now) {
129
+ let n = 0;
130
+ for (const [id, j] of this.rows) {
131
+ if (j.tenant === tenant && (j.status === "pending" || j.status === "claimed") && j.expiresAt <= now) {
132
+ this.rows.delete(id);
133
+ n += 1;
134
+ }
135
+ }
136
+ return n;
137
+ }
138
+ };
139
+
140
+ // src/printing/printer-status.ts
141
+ function printerStatus(printer, now, ttlMs = DEFAULT_CONNECTION_TTL_MS) {
142
+ if (!printer.station) return "never";
143
+ return now - printer.station.at <= ttlMs ? "connected" : "disconnected";
144
+ }
145
+ function pickPrinter(printers, use, now, ttlMs = DEFAULT_CONNECTION_TTL_MS) {
146
+ const serving = printers.filter((p) => p.uses.includes(use));
147
+ return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(serving.find((p) => printerStatus(p, now, ttlMs) === "connected"), () => ( serving.find((p) => p.station))), () => ( serving[0])), () => ( null));
148
+ }
149
+ function disconnectedUses(printers, now, ttlMs = DEFAULT_CONNECTION_TTL_MS) {
150
+ const uses = new Set(printers.flatMap((p) => p.uses));
151
+ return [...uses].filter((u) => printers.every((p) => !p.uses.includes(u) || printerStatus(p, now, ttlMs) !== "connected"));
152
+ }
153
+
154
+ // src/printing/escpos.ts
155
+ var ESC = 27;
156
+ var GS = 29;
157
+ var LF = 10;
158
+ var CP858 = {
159
+ \u00C7: 128,
160
+ \u00FC: 129,
161
+ \u00E9: 130,
162
+ \u00E2: 131,
163
+ \u00E4: 132,
164
+ \u00E0: 133,
165
+ \u00E5: 134,
166
+ \u00E7: 135,
167
+ \u00EA: 136,
168
+ \u00EB: 137,
169
+ \u00E8: 138,
170
+ \u00EF: 139,
171
+ \u00EE: 140,
172
+ \u00EC: 141,
173
+ \u00C4: 142,
174
+ \u00C5: 143,
175
+ \u00C9: 144,
176
+ \u00E6: 145,
177
+ \u00C6: 146,
178
+ \u00F4: 147,
179
+ \u00F6: 148,
180
+ \u00F2: 149,
181
+ \u00FB: 150,
182
+ \u00F9: 151,
183
+ \u00FF: 152,
184
+ \u00D6: 153,
185
+ \u00DC: 154,
186
+ \u00F8: 155,
187
+ "\xA3": 156,
188
+ \u00D8: 157,
189
+ "\xD7": 158,
190
+ \u00E1: 160,
191
+ \u00ED: 161,
192
+ \u00F3: 162,
193
+ \u00FA: 163,
194
+ \u00F1: 164,
195
+ \u00D1: 165,
196
+ \u00AA: 166,
197
+ \u00BA: 167,
198
+ "\xBF": 168,
199
+ "\xAE": 169,
200
+ "\xAC": 170,
201
+ "\xBD": 171,
202
+ "\xBC": 172,
203
+ "\xA1": 173,
204
+ "\xAB": 174,
205
+ "\xBB": 175,
206
+ \u00C1: 181,
207
+ \u00C2: 182,
208
+ \u00C0: 183,
209
+ "\xA9": 184,
210
+ \u00C3: 198,
211
+ \u00E3: 199,
212
+ \u00CA: 210,
213
+ \u00CB: 211,
214
+ \u00C8: 212,
215
+ \u00CD: 214,
216
+ \u00CE: 215,
217
+ \u00CF: 216,
218
+ \u00CC: 222,
219
+ \u00D3: 224,
220
+ \u00D4: 226,
221
+ \u00D2: 227,
222
+ \u00D5: 228,
223
+ \u00F5: 229,
224
+ \u00DA: 233,
225
+ \u00DB: 234,
226
+ \u00D9: 235,
227
+ "\u20AC": 213
228
+ };
229
+ var EscPosBuilder = class {
230
+ constructor() {
231
+ this.out = [];
232
+ }
233
+ /** Reset and select CP858 so accents print. */
234
+ init() {
235
+ this.out.push(ESC, 64, ESC, 116, 19);
236
+ return this;
237
+ }
238
+ text(value) {
239
+ for (const ch of value) {
240
+ const code = ch.codePointAt(0);
241
+ this.out.push(code < 128 ? code : _nullishCoalesce(CP858[ch], () => ( 63)));
242
+ }
243
+ return this;
244
+ }
245
+ line(value = "") {
246
+ return this.text(value).feed(1);
247
+ }
248
+ feed(lines = 1) {
249
+ for (let i = 0; i < lines; i += 1) this.out.push(LF);
250
+ return this;
251
+ }
252
+ align(to) {
253
+ this.out.push(ESC, 97, to === "left" ? 0 : to === "center" ? 1 : 2);
254
+ return this;
255
+ }
256
+ bold(on) {
257
+ this.out.push(ESC, 69, on ? 1 : 0);
258
+ return this;
259
+ }
260
+ /** 1 = normal, 2 = double width and height. */
261
+ size(multiplier) {
262
+ this.out.push(GS, 33, multiplier === 2 ? 17 : 0);
263
+ return this;
264
+ }
265
+ /** Feed and cut (partial). */
266
+ cut() {
267
+ this.out.push(GS, 86, 66, 3);
268
+ return this;
269
+ }
270
+ /**
271
+ * Pulse the cash drawer through the printer's RJ11 (the drawer has no connection of its own). Both kick pins are
272
+ * pulsed: drawers are wired to pin 2 or to pin 5 depending on the model, and a pulse on the wrong one does nothing.
273
+ */
274
+ openDrawer() {
275
+ this.out.push(ESC, 112, 0, 50, 200, ESC, 112, 1, 50, 200);
276
+ return this;
277
+ }
278
+ raw(bytes) {
279
+ for (let i = 0; i < bytes.length; i += 1) this.out.push(bytes[i] & 255);
280
+ return this;
281
+ }
282
+ bytes() {
283
+ return Uint8Array.from(this.out);
284
+ }
285
+ /** What `PrintQueue.enqueue` takes as `payload`. */
286
+ toBase64() {
287
+ return Buffer.from(this.bytes()).toString("base64");
288
+ }
289
+ };
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+ exports.DEFAULT_CLAIM_TTL_MS = DEFAULT_CLAIM_TTL_MS; exports.DEFAULT_CONNECTION_TTL_MS = DEFAULT_CONNECTION_TTL_MS; exports.DEFAULT_JOB_TTL_MS = DEFAULT_JOB_TTL_MS; exports.DEFAULT_MAX_ATTEMPTS = DEFAULT_MAX_ATTEMPTS; exports.DEFAULT_MAX_PAYLOAD_CHARS = DEFAULT_MAX_PAYLOAD_CHARS; exports.EscPosBuilder = EscPosBuilder; exports.MemoryPrintJobStore = MemoryPrintJobStore; exports.PrintQueue = PrintQueue; exports.disconnectedUses = disconnectedUses; exports.pickPrinter = pickPrinter; exports.printerStatus = printerStatus;
@@ -0,0 +1,7 @@
1
+ export { PrintQueue } from './print-queue.js';
2
+ export type { EnqueueResult } from './print-queue.js';
3
+ export { MemoryPrintJobStore } from './memory.store.js';
4
+ export { printerStatus, pickPrinter, disconnectedUses } from './printer-status.js';
5
+ export { EscPosBuilder } from './escpos.js';
6
+ export { DEFAULT_CLAIM_TTL_MS, DEFAULT_CONNECTION_TTL_MS, DEFAULT_JOB_TTL_MS, DEFAULT_MAX_ATTEMPTS, DEFAULT_MAX_PAYLOAD_CHARS, } from './printing.types.js';
7
+ export type { EnqueueInput, PrintJob, PrintJobStatus, PrintJobStorePort, PrintQueueOptions, PrinterRecord, PrinterStation, PrinterStatus, PrinterTransport, } from './printing.types.js';