memobirdsdk 1.0.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.
- package/README.md +483 -0
- package/dist/api/bind.d.ts +24 -0
- package/dist/api/bind.d.ts.map +1 -0
- package/dist/api/bind.js +49 -0
- package/dist/api/bind.js.map +1 -0
- package/dist/api/image.d.ts +25 -0
- package/dist/api/image.d.ts.map +1 -0
- package/dist/api/image.js +46 -0
- package/dist/api/image.js.map +1 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +9 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/print.d.ts +71 -0
- package/dist/api/print.d.ts.map +1 -0
- package/dist/api/print.js +147 -0
- package/dist/api/print.js.map +1 -0
- package/dist/api/status.d.ts +24 -0
- package/dist/api/status.d.ts.map +1 -0
- package/dist/api/status.js +47 -0
- package/dist/api/status.js.map +1 -0
- package/dist/client.d.ts +204 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +250 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +18 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +23 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors/APIError.d.ts +16 -0
- package/dist/errors/APIError.d.ts.map +1 -0
- package/dist/errors/APIError.js +21 -0
- package/dist/errors/APIError.js.map +1 -0
- package/dist/errors/MemobirdError.d.ts +13 -0
- package/dist/errors/MemobirdError.d.ts.map +1 -0
- package/dist/errors/MemobirdError.js +18 -0
- package/dist/errors/MemobirdError.js.map +1 -0
- package/dist/errors/NetworkError.d.ts +14 -0
- package/dist/errors/NetworkError.d.ts.map +1 -0
- package/dist/errors/NetworkError.js +18 -0
- package/dist/errors/NetworkError.js.map +1 -0
- package/dist/errors/ValidationError.d.ts +14 -0
- package/dist/errors/ValidationError.d.ts.map +1 -0
- package/dist/errors/ValidationError.js +18 -0
- package/dist/errors/ValidationError.js.map +1 -0
- package/dist/errors/index.d.ts +9 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +9 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/types/api.d.ts +122 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +2 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/common.d.ts +27 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +15 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/config.d.ts +32 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/content-formatter.d.ts +49 -0
- package/dist/utils/content-formatter.d.ts.map +1 -0
- package/dist/utils/content-formatter.js +65 -0
- package/dist/utils/content-formatter.js.map +1 -0
- package/dist/utils/encoding.d.ts +32 -0
- package/dist/utils/encoding.d.ts.map +1 -0
- package/dist/utils/encoding.js +50 -0
- package/dist/utils/encoding.js.map +1 -0
- package/dist/utils/image.d.ts +42 -0
- package/dist/utils/image.d.ts.map +1 -0
- package/dist/utils/image.js +58 -0
- package/dist/utils/image.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +10 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/retry.d.ts +70 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +132 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/timestamp.d.ts +27 -0
- package/dist/utils/timestamp.d.ts.map +1 -0
- package/dist/utils/timestamp.js +38 -0
- package/dist/utils/timestamp.js.map +1 -0
- package/package.json +63 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import got, {} from 'got';
|
|
2
|
+
import { RetryStrategy } from './utils/retry.js';
|
|
3
|
+
import { formatTextContent, formatImageContent } from './utils/content-formatter.js';
|
|
4
|
+
import { bindUser } from './api/bind.js';
|
|
5
|
+
import { printPaper, printFromUrl, printFromHtml } from './api/print.js';
|
|
6
|
+
import { getPrintStatus } from './api/status.js';
|
|
7
|
+
import { convertToMonochrome } from './api/image.js';
|
|
8
|
+
import { BASE_URL, DEFAULT_TIMEOUT, DEFAULT_RETRY_CONFIG } from './constants.js';
|
|
9
|
+
/**
|
|
10
|
+
* Main Memobird SDK client for interacting with the Memobird API
|
|
11
|
+
*
|
|
12
|
+
* This class provides a convenient interface for all Memobird operations including
|
|
13
|
+
* user binding, printing text/images, checking print status, and converting images.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const client = new MemobirdClient({
|
|
18
|
+
* ak: 'your-access-key-from-open.memobird.cn'
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Bind user to device
|
|
22
|
+
* const bindResult = await client.bindUser('device-id', 'user-123');
|
|
23
|
+
*
|
|
24
|
+
* // Print text (auto-converts to GBK)
|
|
25
|
+
* await client.printText('Hello World!', 'device-id', bindResult.showapi_userid!);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export class MemobirdClient {
|
|
29
|
+
config;
|
|
30
|
+
httpClient;
|
|
31
|
+
retryStrategy;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new MemobirdClient instance
|
|
34
|
+
*
|
|
35
|
+
* @param config - SDK configuration options
|
|
36
|
+
* @param config.ak - Access Key from open.memobird.cn (required)
|
|
37
|
+
* @param config.baseUrl - Base URL for API (default: 'http://open.memobird.cn/home')
|
|
38
|
+
* @param config.timeout - Request timeout in ms (default: 30000)
|
|
39
|
+
* @param config.retry - Retry configuration
|
|
40
|
+
* @param config.httpOptions - Additional got HTTP client options
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const client = new MemobirdClient({
|
|
45
|
+
* ak: 'your-access-key',
|
|
46
|
+
* timeout: 60000,
|
|
47
|
+
* retry: {
|
|
48
|
+
* maxRetries: 5,
|
|
49
|
+
* initialDelay: 2000
|
|
50
|
+
* }
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
constructor(config) {
|
|
55
|
+
this.config = {
|
|
56
|
+
baseUrl: BASE_URL,
|
|
57
|
+
timeout: DEFAULT_TIMEOUT,
|
|
58
|
+
retry: DEFAULT_RETRY_CONFIG,
|
|
59
|
+
...config,
|
|
60
|
+
};
|
|
61
|
+
// Initialize HTTP client with got
|
|
62
|
+
const timeout = this.config.timeout !== undefined ? this.config.timeout : DEFAULT_TIMEOUT;
|
|
63
|
+
const baseUrl = this.config.baseUrl !== undefined ? this.config.baseUrl : BASE_URL;
|
|
64
|
+
this.httpClient = got.extend({
|
|
65
|
+
prefixUrl: baseUrl,
|
|
66
|
+
timeout: {
|
|
67
|
+
request: timeout,
|
|
68
|
+
},
|
|
69
|
+
responseType: 'json',
|
|
70
|
+
throwHttpErrors: false, // Handle errors manually
|
|
71
|
+
retry: { limit: 0 }, // Use our custom retry logic
|
|
72
|
+
...(this.config.httpOptions || {}),
|
|
73
|
+
});
|
|
74
|
+
// Initialize retry strategy
|
|
75
|
+
this.retryStrategy = new RetryStrategy(this.config.retry);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Binds a user identifier to a Memobird device
|
|
79
|
+
*
|
|
80
|
+
* This creates an association between your user ID and a physical device.
|
|
81
|
+
* The device ID can be obtained by double-clicking the physical device,
|
|
82
|
+
* which will print out the device ID.
|
|
83
|
+
*
|
|
84
|
+
* @param memobirdID - Device ID from the physical device
|
|
85
|
+
* @param useridentifying - Your unique user identifier
|
|
86
|
+
* @returns Promise resolving to binding response with showapi_userid
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* const response = await client.bindUser('fb93bfff504c020a', 'user-123');
|
|
91
|
+
* console.log('User ID:', response.showapi_userid);
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
async bindUser(memobirdID, useridentifying) {
|
|
95
|
+
return this.retryStrategy.execute(() => bindUser(this.httpClient, this.config.ak, memobirdID, useridentifying));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Prints text content to a Memobird device
|
|
99
|
+
*
|
|
100
|
+
* Text is automatically converted from UTF-8 to GBK Base64 encoding as required by the API.
|
|
101
|
+
* Supports Chinese characters and other multi-byte text.
|
|
102
|
+
*
|
|
103
|
+
* @param text - Text content to print
|
|
104
|
+
* @param memobirdID - Device ID
|
|
105
|
+
* @param userID - User ID from binding response
|
|
106
|
+
* @returns Promise resolving to print response with printcontentid
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* const response = await client.printText(
|
|
111
|
+
* '你好世界!Hello World!',
|
|
112
|
+
* 'device-id',
|
|
113
|
+
* 123
|
|
114
|
+
* );
|
|
115
|
+
* console.log('Print ID:', response.printcontentid);
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
async printText(text, memobirdID, userID) {
|
|
119
|
+
const printcontent = formatTextContent(text);
|
|
120
|
+
return this.retryStrategy.execute(() => printPaper(this.httpClient, this.config.ak, printcontent, memobirdID, userID));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Prints image content to a Memobird device
|
|
124
|
+
*
|
|
125
|
+
* The image must be in monochrome bitmap format. Use {@link convertImageToMonochrome}
|
|
126
|
+
* to convert JPG/PNG images to the required format first.
|
|
127
|
+
*
|
|
128
|
+
* @param base64Image - Monochrome bitmap Base64 string
|
|
129
|
+
* @param memobirdID - Device ID
|
|
130
|
+
* @param userID - User ID from binding response
|
|
131
|
+
* @returns Promise resolving to print response
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* // First convert image
|
|
136
|
+
* const converted = await client.convertImageToMonochrome(jpgBase64);
|
|
137
|
+
*
|
|
138
|
+
* // Then print
|
|
139
|
+
* const response = await client.printImage(
|
|
140
|
+
* converted.result!,
|
|
141
|
+
* 'device-id',
|
|
142
|
+
* 123
|
|
143
|
+
* );
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
async printImage(base64Image, memobirdID, userID) {
|
|
147
|
+
const printcontent = formatImageContent(base64Image);
|
|
148
|
+
return this.retryStrategy.execute(() => printPaper(this.httpClient, this.config.ak, printcontent, memobirdID, userID));
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Prints content from a web URL
|
|
152
|
+
*
|
|
153
|
+
* Note: This works best with static or server-rendered pages. Pages rendered
|
|
154
|
+
* with AJAX may not work properly. Images must use complete URLs and CSS should
|
|
155
|
+
* be inline for best results.
|
|
156
|
+
*
|
|
157
|
+
* @param url - URL of the web page to print
|
|
158
|
+
* @param memobirdID - Device ID
|
|
159
|
+
* @param userID - User ID from binding response
|
|
160
|
+
* @returns Promise resolving to print response
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```typescript
|
|
164
|
+
* const response = await client.printFromUrl(
|
|
165
|
+
* 'https://example.com/page',
|
|
166
|
+
* 'device-id',
|
|
167
|
+
* 123
|
|
168
|
+
* );
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
async printFromUrl(url, memobirdID, userID) {
|
|
172
|
+
return this.retryStrategy.execute(() => printFromUrl(this.httpClient, this.config.ak, url, memobirdID, userID));
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Prints content from HTML source
|
|
176
|
+
*
|
|
177
|
+
* The HTML is automatically converted to GBK Base64 and URL encoded.
|
|
178
|
+
* For best results:
|
|
179
|
+
* - Use inline CSS (no external stylesheets)
|
|
180
|
+
* - Use complete URLs for images (not relative paths)
|
|
181
|
+
* - Keep content size reasonable
|
|
182
|
+
*
|
|
183
|
+
* @param html - HTML source code
|
|
184
|
+
* @param memobirdID - Device ID
|
|
185
|
+
* @param userID - User ID from binding response
|
|
186
|
+
* @returns Promise resolving to print response
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* const html = `
|
|
191
|
+
* <html>
|
|
192
|
+
* <body style="font-family: sans-serif;">
|
|
193
|
+
* <h1>Hello World</h1>
|
|
194
|
+
* <p>This is a test.</p>
|
|
195
|
+
* </body>
|
|
196
|
+
* </html>
|
|
197
|
+
* `;
|
|
198
|
+
* const response = await client.printFromHtml(html, 'device-id', 123);
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
async printFromHtml(html, memobirdID, userID) {
|
|
202
|
+
return this.retryStrategy.execute(() => printFromHtml(this.httpClient, this.config.ak, html, memobirdID, userID));
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Gets the print status of a submitted print job
|
|
206
|
+
*
|
|
207
|
+
* @param printcontentid - Print content ID from print response (can be string or number)
|
|
208
|
+
* @returns Promise resolving to print status response
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* const printResponse = await client.printText('Hello', 'device-id', 123);
|
|
213
|
+
* const status = await client.getPrintStatus(printResponse.printcontentid!);
|
|
214
|
+
*
|
|
215
|
+
* if (status.printflag === 1) {
|
|
216
|
+
* console.log('Print completed successfully');
|
|
217
|
+
* } else {
|
|
218
|
+
* console.log('Print pending or failed');
|
|
219
|
+
* }
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
async getPrintStatus(printcontentid) {
|
|
223
|
+
const contentId = String(printcontentid);
|
|
224
|
+
return this.retryStrategy.execute(() => getPrintStatus(this.httpClient, this.config.ak, contentId));
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Converts a JPG or PNG image to monochrome bitmap format
|
|
228
|
+
*
|
|
229
|
+
* The Memobird printer requires images in monochrome bitmap format.
|
|
230
|
+
* Use this method to convert standard images before printing.
|
|
231
|
+
* For best results, images should be 384px wide (the printer paper width).
|
|
232
|
+
*
|
|
233
|
+
* @param base64Image - JPG or PNG image as Base64 string
|
|
234
|
+
* @returns Promise resolving to converted image response with monochrome bitmap
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* const jpgBase64 = '...'; // Your JPG image
|
|
239
|
+
* const response = await client.convertImageToMonochrome(jpgBase64);
|
|
240
|
+
* const monochromeBase64 = response.result!;
|
|
241
|
+
*
|
|
242
|
+
* // Now print the converted image
|
|
243
|
+
* await client.printImage(monochromeBase64, 'device-id', 123);
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
async convertImageToMonochrome(base64Image) {
|
|
247
|
+
return this.retryStrategy.execute(() => convertToMonochrome(this.httpClient, this.config.ak, base64Image));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RetryConfig } from './types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Base URL for Memobird API
|
|
4
|
+
*/
|
|
5
|
+
export declare const BASE_URL = "http://open.memobird.cn/home";
|
|
6
|
+
/**
|
|
7
|
+
* Default HTTP request timeout in milliseconds
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_TIMEOUT = 30000;
|
|
10
|
+
/**
|
|
11
|
+
* Default retry configuration
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_RETRY_CONFIG: Required<RetryConfig>;
|
|
14
|
+
/**
|
|
15
|
+
* API success code
|
|
16
|
+
*/
|
|
17
|
+
export declare const API_SUCCESS_CODE = 1;
|
|
18
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,QAAQ,iCAAiC,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAMtD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base URL for Memobird API
|
|
3
|
+
*/
|
|
4
|
+
export const BASE_URL = 'http://open.memobird.cn/home';
|
|
5
|
+
/**
|
|
6
|
+
* Default HTTP request timeout in milliseconds
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_TIMEOUT = 30000;
|
|
9
|
+
/**
|
|
10
|
+
* Default retry configuration
|
|
11
|
+
*/
|
|
12
|
+
export const DEFAULT_RETRY_CONFIG = {
|
|
13
|
+
maxRetries: 3,
|
|
14
|
+
initialDelay: 1000,
|
|
15
|
+
backoffMultiplier: 2,
|
|
16
|
+
maxDelay: 10000,
|
|
17
|
+
retryStatusCodes: [408, 429, 500, 502, 503, 504],
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* API success code
|
|
21
|
+
*/
|
|
22
|
+
export const API_SUCCESS_CODE = 1;
|
|
23
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,8BAA8B,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA0B;IACzD,UAAU,EAAE,CAAC;IACb,YAAY,EAAE,IAAI;IAClB,iBAAiB,EAAE,CAAC;IACpB,QAAQ,EAAE,KAAK;IACf,gBAAgB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MemobirdError } from './MemobirdError.js';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when API returns a non-success response (showapi_res_code !== 1)
|
|
4
|
+
*/
|
|
5
|
+
export declare class APIError extends MemobirdError {
|
|
6
|
+
resCode: number;
|
|
7
|
+
resError: string;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new APIError
|
|
10
|
+
* @param message - Error message
|
|
11
|
+
* @param resCode - The showapi_res_code from API response
|
|
12
|
+
* @param resError - The showapi_res_error from API response
|
|
13
|
+
*/
|
|
14
|
+
constructor(message: string, resCode: number, resError: string);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=APIError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"APIError.d.ts","sourceRoot":"","sources":["../../src/errors/APIError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAAa;IAShC,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,MAAM;IATzB;;;;;OAKG;gBAED,OAAO,EAAE,MAAM,EACR,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM;CAK1B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MemobirdError } from './MemobirdError.js';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when API returns a non-success response (showapi_res_code !== 1)
|
|
4
|
+
*/
|
|
5
|
+
export class APIError extends MemobirdError {
|
|
6
|
+
resCode;
|
|
7
|
+
resError;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new APIError
|
|
10
|
+
* @param message - Error message
|
|
11
|
+
* @param resCode - The showapi_res_code from API response
|
|
12
|
+
* @param resError - The showapi_res_error from API response
|
|
13
|
+
*/
|
|
14
|
+
constructor(message, resCode, resError) {
|
|
15
|
+
super(message, 'API_ERROR');
|
|
16
|
+
this.resCode = resCode;
|
|
17
|
+
this.resError = resError;
|
|
18
|
+
this.name = 'APIError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=APIError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"APIError.js","sourceRoot":"","sources":["../../src/errors/APIError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,aAAa;IAShC;IACA;IATT;;;;;OAKG;IACH,YACE,OAAe,EACR,OAAe,EACf,QAAgB;QAEvB,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAHrB,YAAO,GAAP,OAAO,CAAQ;QACf,aAAQ,GAAR,QAAQ,CAAQ;QAGvB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for all Memobird SDK errors
|
|
3
|
+
*/
|
|
4
|
+
export declare class MemobirdError extends Error {
|
|
5
|
+
code?: string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new MemobirdError
|
|
8
|
+
* @param message - Error message
|
|
9
|
+
* @param code - Optional error code
|
|
10
|
+
*/
|
|
11
|
+
constructor(message: string, code?: string | undefined);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=MemobirdError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemobirdError.d.ts","sourceRoot":"","sources":["../../src/errors/MemobirdError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;IAQ7B,IAAI,CAAC;IAPd;;;;OAIG;gBAED,OAAO,EAAE,MAAM,EACR,IAAI,CAAC,oBAAQ;CAMvB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for all Memobird SDK errors
|
|
3
|
+
*/
|
|
4
|
+
export class MemobirdError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new MemobirdError
|
|
8
|
+
* @param message - Error message
|
|
9
|
+
* @param code - Optional error code
|
|
10
|
+
*/
|
|
11
|
+
constructor(message, code) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.name = 'MemobirdError';
|
|
15
|
+
Error.captureStackTrace(this, this.constructor);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=MemobirdError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemobirdError.js","sourceRoot":"","sources":["../../src/errors/MemobirdError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAQ7B;IAPT;;;;OAIG;IACH,YACE,OAAe,EACR,IAAa;QAEpB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFR,SAAI,GAAJ,IAAI,CAAS;QAGpB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MemobirdError } from './MemobirdError.js';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when network request fails
|
|
4
|
+
*/
|
|
5
|
+
export declare class NetworkError extends MemobirdError {
|
|
6
|
+
originalError?: Error | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new NetworkError
|
|
9
|
+
* @param message - Error message
|
|
10
|
+
* @param originalError - The original error that caused this failure
|
|
11
|
+
*/
|
|
12
|
+
constructor(message: string, originalError?: Error | undefined);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=NetworkError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkError.d.ts","sourceRoot":"","sources":["../../src/errors/NetworkError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,qBAAa,YAAa,SAAQ,aAAa;IAQpC,aAAa,CAAC;IAPvB;;;;OAIG;gBAED,OAAO,EAAE,MAAM,EACR,aAAa,CAAC,mBAAO;CAK/B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MemobirdError } from './MemobirdError.js';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when network request fails
|
|
4
|
+
*/
|
|
5
|
+
export class NetworkError extends MemobirdError {
|
|
6
|
+
originalError;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new NetworkError
|
|
9
|
+
* @param message - Error message
|
|
10
|
+
* @param originalError - The original error that caused this failure
|
|
11
|
+
*/
|
|
12
|
+
constructor(message, originalError) {
|
|
13
|
+
super(message, 'NETWORK_ERROR');
|
|
14
|
+
this.originalError = originalError;
|
|
15
|
+
this.name = 'NetworkError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=NetworkError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkError.js","sourceRoot":"","sources":["../../src/errors/NetworkError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,aAAa;IAQpC;IAPT;;;;OAIG;IACH,YACE,OAAe,EACR,aAAqB;QAE5B,KAAK,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAFzB,kBAAa,GAAb,aAAa,CAAQ;QAG5B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MemobirdError } from './MemobirdError.js';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when input validation fails
|
|
4
|
+
*/
|
|
5
|
+
export declare class ValidationError extends MemobirdError {
|
|
6
|
+
field?: string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new ValidationError
|
|
9
|
+
* @param message - Error message
|
|
10
|
+
* @param field - The field that failed validation
|
|
11
|
+
*/
|
|
12
|
+
constructor(message: string, field?: string | undefined);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ValidationError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationError.d.ts","sourceRoot":"","sources":["../../src/errors/ValidationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,qBAAa,eAAgB,SAAQ,aAAa;IAQvC,KAAK,CAAC;IAPf;;;;OAIG;gBAED,OAAO,EAAE,MAAM,EACR,KAAK,CAAC,oBAAQ;CAKxB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MemobirdError } from './MemobirdError.js';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when input validation fails
|
|
4
|
+
*/
|
|
5
|
+
export class ValidationError extends MemobirdError {
|
|
6
|
+
field;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new ValidationError
|
|
9
|
+
* @param message - Error message
|
|
10
|
+
* @param field - The field that failed validation
|
|
11
|
+
*/
|
|
12
|
+
constructor(message, field) {
|
|
13
|
+
super(message, 'VALIDATION_ERROR');
|
|
14
|
+
this.field = field;
|
|
15
|
+
this.name = 'ValidationError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ValidationError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationError.js","sourceRoot":"","sources":["../../src/errors/ValidationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,aAAa;IAQvC;IAPT;;;;OAIG;IACH,YACE,OAAe,EACR,KAAc;QAErB,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QAF5B,UAAK,GAAL,KAAK,CAAS;QAGrB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes for Memobird SDK
|
|
3
|
+
* @module errors
|
|
4
|
+
*/
|
|
5
|
+
export { MemobirdError } from './MemobirdError.js';
|
|
6
|
+
export { APIError } from './APIError.js';
|
|
7
|
+
export { NetworkError } from './NetworkError.js';
|
|
8
|
+
export { ValidationError } from './ValidationError.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes for Memobird SDK
|
|
3
|
+
* @module errors
|
|
4
|
+
*/
|
|
5
|
+
export { MemobirdError } from './MemobirdError.js';
|
|
6
|
+
export { APIError } from './APIError.js';
|
|
7
|
+
export { NetworkError } from './NetworkError.js';
|
|
8
|
+
export { ValidationError } from './ValidationError.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memobird SDK - TypeScript SDK for Memobird (咕咕机) thermal printer API
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { MemobirdClient } from 'memobirdsdk';
|
|
7
|
+
*
|
|
8
|
+
* const client = new MemobirdClient({ ak: 'your-access-key' });
|
|
9
|
+
* const bindResult = await client.bindUser('device-id', 'user-123');
|
|
10
|
+
* await client.printText('Hello World!', 'device-id', bindResult.showapi_userid!);
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @module memobirdsdk
|
|
14
|
+
*/
|
|
15
|
+
export { MemobirdClient } from './client.js';
|
|
16
|
+
export type * from './types/index.js';
|
|
17
|
+
export { textToGBKBase64, gbkBase64ToText, generateTimestamp, isValidTimestamp, formatTextContent, formatImageContent, formatMixedContent, isValidBase64Image, stripDataUrlPrefix, imageFileToBase64, RetryStrategy, } from './utils/index.js';
|
|
18
|
+
export { MemobirdError, APIError, NetworkError, ValidationError } from './errors/index.js';
|
|
19
|
+
export { BASE_URL, DEFAULT_TIMEOUT, DEFAULT_RETRY_CONFIG, API_SUCCESS_CODE } from './constants.js';
|
|
20
|
+
export { MemobirdClient as default } from './client.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,mBAAmB,kBAAkB,CAAC;AAGtC,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAG3F,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGnG,OAAO,EAAE,cAAc,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memobird SDK - TypeScript SDK for Memobird (咕咕机) thermal printer API
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { MemobirdClient } from 'memobirdsdk';
|
|
7
|
+
*
|
|
8
|
+
* const client = new MemobirdClient({ ak: 'your-access-key' });
|
|
9
|
+
* const bindResult = await client.bindUser('device-id', 'user-123');
|
|
10
|
+
* await client.printText('Hello World!', 'device-id', bindResult.showapi_userid!);
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @module memobirdsdk
|
|
14
|
+
*/
|
|
15
|
+
// Main client
|
|
16
|
+
export { MemobirdClient } from './client.js';
|
|
17
|
+
// Utilities
|
|
18
|
+
export { textToGBKBase64, gbkBase64ToText, generateTimestamp, isValidTimestamp, formatTextContent, formatImageContent, formatMixedContent, isValidBase64Image, stripDataUrlPrefix, imageFileToBase64, RetryStrategy, } from './utils/index.js';
|
|
19
|
+
// Errors
|
|
20
|
+
export { MemobirdError, APIError, NetworkError, ValidationError } from './errors/index.js';
|
|
21
|
+
// Constants
|
|
22
|
+
export { BASE_URL, DEFAULT_TIMEOUT, DEFAULT_RETRY_CONFIG, API_SUCCESS_CODE } from './constants.js';
|
|
23
|
+
// Default export
|
|
24
|
+
export { MemobirdClient as default } from './client.js';
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAK7C,YAAY;AACZ,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAE1B,SAAS;AACT,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE3F,YAAY;AACZ,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEnG,iBAAiB;AACjB,OAAO,EAAE,cAAc,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC"}
|