Skip to content

Commit

Permalink
version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
yeasir01 committed Jan 19, 2024
1 parent 07947c6 commit 748101e
Show file tree
Hide file tree
Showing 8 changed files with 2,982 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/khaki-flowers-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bpac-js": patch
---

ignore build files for prod
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ node_modules/
.changeset/
.vscode/
.github/
dist/
test/
lib/
*.js
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.changeset/
.github/
.vscode/
src/
test/
.eslintignore
tsup.config.js
tsconfig.json
117 changes: 117 additions & 0 deletions lib/index.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
type Data = {
[key: string]: string | Date;
};
type PrintConfig = {
copies: number;
printName: string;
quality: string;
};
type BrotherSdkConstructor = {
templatePath: string;
exportDir: string;
};
declare class BrotherSdk {
#private;
ready: boolean;
templatePath: string;
exportDir: string;
/**
* Constructor for the BrotherSdk class.
* @constructor
* @param {Object} options
* Configuration options.
* @param {String} options.templatePath
* Path (UNC) or URL to the template file Can be specified
* as \\your_server\your_folder\your_file for a file on a
* file-sharing server Can be specified as http://your_server/your_file
* for a template file URL.
* @param {String} options.exportDir
* The path for exporting generated templates.
*/
constructor({ templatePath, exportDir }: BrotherSdkConstructor);
/**
* @param {object} data
* An object containing key-value pairs, where each key represents an object ID,
* and the corresponding value is the text to be set on that object.
* @param {object} config
* Configuration options
* @param {number} config.copies
* The number of copies to be printed.
* @param {string} config.printName
* The name of the document to be printed.
* @param {keyof printQuality} config.quality
* Print quality.
* @returns {boolean}
* A promise that resolves with a boolean.
*/
print(data: Data, config: PrintConfig): Promise<boolean>;
/**
* @param {object} data
* An object containing key-value pairs, where each key represents an object ID,
* and the corresponding value is the text to be set on that object.
* @param {object} opts
* Config options.
* @param {string} opts.height
* If the vertical size (pixel) of the image to be acquired is specified as 0, it
* becomes a size that maintains the aspect ratio based on width.
* @param {string} opts.width
* Horizontal size (pixel) of the image to be acquired. If 0 is specified,
* it becomes a size that maintains the aspect ratio based on height.
* @returns {Promise<string>}
* returns a base64 string.
*/
getImageData(data: Data, opts: {
height: number;
width: number;
}): Promise<string>;
/**
* Asynchronously retrieves a list of installed printers compatible with the SDK.
* @returns {Promise<string[]>}
* A promise that resolves to an array of strings representing
* the names of installed printers compatible with the 'bpac' SDK.
* @throws {Error}
* If there's an issue while retrieving the printer list.
*
*/
static getPrinterList(): Promise<string[]>;
/**
* Asynchronously retrieves the name of currently selected printer for the instance.
*
* @returns {Promise<string>} A promise that resolves to a strings representing
* the name of the installed printer.
* @throws {Error} If there's an issue while retrieving the printer list.
*
*/
getPrinterName(): Promise<string>;
/**
* Asynchronously exports a file.
* @param {object} data
* An object containing key-value pairs, where each key represents
* an object ID, and the corresponding value is the text to be set on that object.
* @param {string} filePathOrFileName
* Path or file name with extension. If initiated with:
* - Full path (e.g., 'C:/Users/YourName/Desktop/Exported Labels/cool-label.lbx')
* - Only file name with extension (e.g., 'cool-label.lbx').
* @param {keyof fileType} encoding
* File encoding type.
* - default: Same type as the currently open template.
* - lbx: LBX file type.
* - lbl: P-touch Editor 4.2 (older format).
* - lbi: LBI file type.
* - bmp: BMP (monochrome).
* - paf: PAF file type.
* @param {number} resolution
* Resolution in dpi used for the conversion into bitmap format.
* Specifies the resolution of the output device.
* (Screen: 72 or 96; output to SC-2000: 600)
* If a value of 0 is specified, the printer resolution is used.
* Encoding is only valid for LBI format and BMP format.
* @returns {Promise<boolean>}
* A Promise that resolves to a boolean indicating the export status.
* @throws {Error}
* If an invalid encoding is supplied to the export method.
*/
export(data?: Data, filePathOrFileName?: string, encoding?: string, resolution?: number): Promise<any>;
}

export { BrotherSdk as default };
117 changes: 117 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
type Data = {
[key: string]: string | Date;
};
type PrintConfig = {
copies: number;
printName: string;
quality: string;
};
type BrotherSdkConstructor = {
templatePath: string;
exportDir: string;
};
declare class BrotherSdk {
#private;
ready: boolean;
templatePath: string;
exportDir: string;
/**
* Constructor for the BrotherSdk class.
* @constructor
* @param {Object} options
* Configuration options.
* @param {String} options.templatePath
* Path (UNC) or URL to the template file Can be specified
* as \\your_server\your_folder\your_file for a file on a
* file-sharing server Can be specified as http://your_server/your_file
* for a template file URL.
* @param {String} options.exportDir
* The path for exporting generated templates.
*/
constructor({ templatePath, exportDir }: BrotherSdkConstructor);
/**
* @param {object} data
* An object containing key-value pairs, where each key represents an object ID,
* and the corresponding value is the text to be set on that object.
* @param {object} config
* Configuration options
* @param {number} config.copies
* The number of copies to be printed.
* @param {string} config.printName
* The name of the document to be printed.
* @param {keyof printQuality} config.quality
* Print quality.
* @returns {boolean}
* A promise that resolves with a boolean.
*/
print(data: Data, config: PrintConfig): Promise<boolean>;
/**
* @param {object} data
* An object containing key-value pairs, where each key represents an object ID,
* and the corresponding value is the text to be set on that object.
* @param {object} opts
* Config options.
* @param {string} opts.height
* If the vertical size (pixel) of the image to be acquired is specified as 0, it
* becomes a size that maintains the aspect ratio based on width.
* @param {string} opts.width
* Horizontal size (pixel) of the image to be acquired. If 0 is specified,
* it becomes a size that maintains the aspect ratio based on height.
* @returns {Promise<string>}
* returns a base64 string.
*/
getImageData(data: Data, opts: {
height: number;
width: number;
}): Promise<string>;
/**
* Asynchronously retrieves a list of installed printers compatible with the SDK.
* @returns {Promise<string[]>}
* A promise that resolves to an array of strings representing
* the names of installed printers compatible with the 'bpac' SDK.
* @throws {Error}
* If there's an issue while retrieving the printer list.
*
*/
static getPrinterList(): Promise<string[]>;
/**
* Asynchronously retrieves the name of currently selected printer for the instance.
*
* @returns {Promise<string>} A promise that resolves to a strings representing
* the name of the installed printer.
* @throws {Error} If there's an issue while retrieving the printer list.
*
*/
getPrinterName(): Promise<string>;
/**
* Asynchronously exports a file.
* @param {object} data
* An object containing key-value pairs, where each key represents
* an object ID, and the corresponding value is the text to be set on that object.
* @param {string} filePathOrFileName
* Path or file name with extension. If initiated with:
* - Full path (e.g., 'C:/Users/YourName/Desktop/Exported Labels/cool-label.lbx')
* - Only file name with extension (e.g., 'cool-label.lbx').
* @param {keyof fileType} encoding
* File encoding type.
* - default: Same type as the currently open template.
* - lbx: LBX file type.
* - lbl: P-touch Editor 4.2 (older format).
* - lbi: LBI file type.
* - bmp: BMP (monochrome).
* - paf: PAF file type.
* @param {number} resolution
* Resolution in dpi used for the conversion into bitmap format.
* Specifies the resolution of the output device.
* (Screen: 72 or 96; output to SC-2000: 600)
* If a value of 0 is specified, the printer resolution is used.
* Encoding is only valid for LBI format and BMP format.
* @returns {Promise<boolean>}
* A Promise that resolves to a boolean indicating the export status.
* @throws {Error}
* If an invalid encoding is supplied to the export method.
*/
export(data?: Data, filePathOrFileName?: string, encoding?: string, resolution?: number): Promise<any>;
}

export { BrotherSdk as default };
Loading

0 comments on commit 748101e

Please sign in to comment.