@things-factory/board-service 7.1.22 → 7.1.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/board-service",
3
- "version": "7.1.22",
3
+ "version": "7.1.24",
4
4
  "main": "dist-server/index.js",
5
5
  "things-factory": true,
6
6
  "author": "",
@@ -23,18 +23,15 @@
23
23
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create ./server/migrations/migration"
24
24
  },
25
25
  "dependencies": {
26
- "@things-factory/auth-base": "^7.1.22",
26
+ "@things-factory/auth-base": "^7.1.24",
27
27
  "@things-factory/env": "^7.1.16",
28
- "@things-factory/fav-base": "^7.1.22",
29
- "@things-factory/font-base": "^7.1.22",
30
- "@things-factory/integration-base": "^7.1.22",
28
+ "@things-factory/fav-base": "^7.1.24",
29
+ "@things-factory/font-base": "^7.1.24",
30
+ "@things-factory/integration-base": "^7.1.24",
31
31
  "@things-factory/operato-license-checker": "^4.0.4",
32
32
  "content-disposition": "^0.5.3",
33
- "generic-pool": "^3.8.2"
33
+ "generic-pool": "^3.8.2",
34
+ "puppeteer": "^23.0.0"
34
35
  },
35
- "optionalDependencies": {
36
- "@thiagoelg/node-printer": "0.6.2",
37
- "puppeteer": "22.12.1"
38
- },
39
- "gitHead": "b4b8efde4096ab1ec02bcf7623e32131254cbfd0"
36
+ "gitHead": "1838925b39cce3caa8e49a6dd2c15796af567695"
40
37
  }
@@ -1,14 +1,8 @@
1
- import { printDirect, getPrinters } from './print'
2
1
  import { labelcommand as boardToZpl } from './label-command'
3
2
  import { pdf as boardToPdf } from './pdf'
4
3
  import { headlessModel } from './headless-model'
5
4
  import { fonts } from './fonts'
6
5
 
7
- export const Printer = {
8
- printDirect,
9
- getPrinters
10
- }
11
-
12
6
  export const BoardFunc = {
13
7
  boardToZpl,
14
8
  boardToPdf,
package/server/routes.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { boardPrintRouter } from './routers/board-print-router'
2
1
  import { config } from '@things-factory/env'
3
2
  import { getHeadlessPool as getHeadlessPoolForBoard } from './controllers/headless-pool-for-board'
4
3
  import { getHeadlessPool as getHeadlessPoolForLabel } from './controllers/headless-pool-for-label'
@@ -15,14 +14,12 @@ process.on('bootstrap-module-global-public-route' as any, (app, domainGlobalPubl
15
14
 
16
15
  process.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {
17
16
  if (isPathBaseDomain) {
18
- domainPrivateRouter.use('/domain/:domain', boardPrintRouter.routes(), boardPrintRouter.allowedMethods())
19
17
  domainPrivateRouter.use(
20
18
  '/domain/:domain',
21
19
  standaloneBoardServiceRouter.routes(),
22
20
  standaloneBoardServiceRouter.allowedMethods()
23
21
  )
24
22
  } else {
25
- domainPrivateRouter.use('', boardPrintRouter.routes(), boardPrintRouter.allowedMethods())
26
23
  domainPrivateRouter.use('', standaloneBoardServiceRouter.routes(), standaloneBoardServiceRouter.allowedMethods())
27
24
  }
28
25
  })
@@ -1,21 +0,0 @@
1
- /**
2
- * shoot raw data to printer
3
- *
4
- * @param printer Printer ID
5
- * @param command Raw command
6
- */
7
- export declare function printDirect(printer: any, command: any): Promise<void>;
8
- /**
9
- * get all installed printers
10
- */
11
- export declare function getPrinters(): any;
12
- /**
13
- * get specific printer by name
14
- * @param printerName printer name
15
- */
16
- export declare function getPrinter(printerName: any): any;
17
- /**
18
- * get default printer name
19
- */
20
- export declare function getDefaultPrinterName(): any;
21
- export declare function getSupportedPrintFormats(): any;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printDirect = printDirect;
4
- exports.getPrinters = getPrinters;
5
- exports.getPrinter = getPrinter;
6
- exports.getDefaultPrinterName = getDefaultPrinterName;
7
- exports.getSupportedPrintFormats = getSupportedPrintFormats;
8
- const env_1 = require("@things-factory/env");
9
- try {
10
- var print = require('@thiagoelg/node-printer');
11
- }
12
- catch (e) {
13
- env_1.logger.error(e);
14
- }
15
- /**
16
- * shoot raw data to printer
17
- *
18
- * @param printer Printer ID
19
- * @param command Raw command
20
- */
21
- async function printDirect(printer, command) {
22
- print &&
23
- (await print.printDirect({
24
- data: command,
25
- printer,
26
- docname: 'RAW print',
27
- success: function (jobId) {
28
- console.log(`Job ID: ${jobId}`);
29
- },
30
- error: function (error) {
31
- env_1.logger.error(error);
32
- }
33
- }));
34
- }
35
- /**
36
- * get all installed printers
37
- */
38
- function getPrinters() {
39
- return (print === null || print === void 0 ? void 0 : print.getPrinters()) || [];
40
- }
41
- /**
42
- * get specific printer by name
43
- * @param printerName printer name
44
- */
45
- function getPrinter(printerName) {
46
- return print === null || print === void 0 ? void 0 : print.getPrinter(printerName);
47
- }
48
- /**
49
- * get default printer name
50
- */
51
- function getDefaultPrinterName() {
52
- return print === null || print === void 0 ? void 0 : print.getDefaultPrinterName();
53
- }
54
- function getSupportedPrintFormats() {
55
- return print === null || print === void 0 ? void 0 : print.getSupportedPrintFormats();
56
- }
57
- //# sourceMappingURL=print.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"print.js","sourceRoot":"","sources":["../../server/controllers/print.ts"],"names":[],"mappings":";;AAcA,kCAaC;AAKD,kCAEC;AAMD,gCAEC;AAKD,sDAEC;AAED,4DAEC;AArDD,6CAA4C;AAE5C,IAAI,CAAC;IACH,IAAI,KAAK,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;AAChD,CAAC;AAAC,OAAO,CAAC,EAAE,CAAC;IACX,YAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,WAAW,CAAC,OAAO,EAAE,OAAO;IAChD,KAAK;QACH,CAAC,MAAM,KAAK,CAAC,WAAW,CAAC;YACvB,IAAI,EAAE,OAAO;YACb,OAAO;YACP,OAAO,EAAE,WAAW;YACpB,OAAO,EAAE,UAAU,KAAK;gBACtB,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,CAAC,CAAA;YACjC,CAAC;YACD,KAAK,EAAE,UAAU,KAAK;gBACpB,YAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACrB,CAAC;SACF,CAAC,CAAC,CAAA;AACP,CAAC;AAED;;GAEG;AACH,SAAgB,WAAW;IACzB,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE,KAAI,EAAE,CAAA;AACnC,CAAC;AAED;;;GAGG;AACH,SAAgB,UAAU,CAAC,WAAW;IACpC,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,CAAC,WAAW,CAAC,CAAA;AACvC,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB;IACnC,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,qBAAqB,EAAE,CAAA;AACvC,CAAC;AAED,SAAgB,wBAAwB;IACtC,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,wBAAwB,EAAE,CAAA;AAC1C,CAAC","sourcesContent":["import { logger } from '@things-factory/env'\n\ntry {\n var print = require('@thiagoelg/node-printer')\n} catch (e) {\n logger.error(e)\n}\n\n/**\n * shoot raw data to printer\n *\n * @param printer Printer ID\n * @param command Raw command\n */\nexport async function printDirect(printer, command) {\n print &&\n (await print.printDirect({\n data: command,\n printer,\n docname: 'RAW print',\n success: function (jobId) {\n console.log(`Job ID: ${jobId}`)\n },\n error: function (error) {\n logger.error(error)\n }\n }))\n}\n\n/**\n * get all installed printers\n */\nexport function getPrinters() {\n return print?.getPrinters() || []\n}\n\n/**\n * get specific printer by name\n * @param printerName printer name\n */\nexport function getPrinter(printerName) {\n return print?.getPrinter(printerName)\n}\n\n/**\n * get default printer name\n */\nexport function getDefaultPrinterName() {\n return print?.getDefaultPrinterName()\n}\n\nexport function getSupportedPrintFormats() {\n return print?.getSupportedPrintFormats()\n}\n"]}
@@ -1 +0,0 @@
1
- export declare const boardPrintRouter: any;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.boardPrintRouter = void 0;
4
- const tslib_1 = require("tslib");
5
- const koa_router_1 = tslib_1.__importDefault(require("koa-router"));
6
- const label_command_1 = require("../controllers/label-command");
7
- const print_1 = require("../controllers/print");
8
- exports.boardPrintRouter = new koa_router_1.default();
9
- /**
10
- * ?printerId=printer_id&data=grf_string
11
- */
12
- exports.boardPrintRouter.get('/print', async (context, next) => {
13
- let data = Object.keys(context.query).length ? context.query : null;
14
- context.body = await (0, print_1.printDirect)(data.printerId, data.data);
15
- });
16
- /**
17
- * { printerId: 'printer driver ID', data: 'grf string' }
18
- */
19
- exports.boardPrintRouter.post('/print', async (context, next) => {
20
- let params = context.request.body;
21
- context.type = 'text/plain';
22
- context.body = await (0, print_1.printDirect)(params.printerId, params.data);
23
- });
24
- // for webpage scrap => zpl image print(grf format) command for released version board
25
- exports.boardPrintRouter.get('/print-label/:id', async (context, next) => {
26
- const { id } = context.params;
27
- let data = Object.keys(context.query).length ? context.query : null;
28
- let orientation = data && data.orientation;
29
- let mirror = data && data.mirror;
30
- let upsideDown = data && data.upsideDown;
31
- let grf = await (0, label_command_1.labelcommand)({ id, data, orientation, mirror, upsideDown, context });
32
- context.type = 'text/plain';
33
- // TODO: 동기화
34
- context.body = (0, print_1.printDirect)(data.printerId, grf);
35
- });
36
- // for webpage scrap => zpl image print(grf format) command for draft version board
37
- exports.boardPrintRouter.get('/print-label-draft/:id', async (context, next) => {
38
- const { id } = context.params;
39
- let data = Object.keys(context.query).length ? context.query : null;
40
- let orientation = data && data.orientation;
41
- let mirror = data && data.mirror;
42
- let upsideDown = data && data.upsideDown;
43
- let grf = await (0, label_command_1.labelcommand)({ id, data, orientation, mirror, upsideDown, context, draft: true });
44
- context.type = 'text/plain';
45
- // TODO: 동기화
46
- context.body = (0, print_1.printDirect)(data.printerId, grf);
47
- });
48
- //# sourceMappingURL=board-print-router.js.map
@@ -1 +0,0 @@
1
- {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AW,EAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;AACjD,CAAC,CAAC,CAAA","sourcesContent":["import Router from 'koa-router'\n\nimport { labelcommand } from '../controllers/label-command'\nimport { printDirect } from '../controllers/print'\n\nexport const boardPrintRouter = new Router()\n\n/**\n * ?printerId=printer_id&data=grf_string\n */\nboardPrintRouter.get('/print', async (context, next) => {\n let data = Object.keys(context.query).length ? context.query : null\n\n context.body = await printDirect(data.printerId, data.data)\n})\n\n/**\n * { printerId: 'printer driver ID', data: 'grf string' }\n */\nboardPrintRouter.post('/print', async (context, next) => {\n let params = context.request.body\n\n context.type = 'text/plain'\n context.body = await printDirect(params.printerId, params.data)\n})\n\n// for webpage scrap => zpl image print(grf format) command for released version board\nboardPrintRouter.get('/print-label/:id', async (context, next) => {\n const { id } = context.params\n let data = Object.keys(context.query).length ? context.query : null\n\n let orientation = data && data.orientation\n let mirror = data && data.mirror\n let upsideDown = data && data.upsideDown\n let grf = await labelcommand({ id, data, orientation, mirror, upsideDown, context } as any)\n\n context.type = 'text/plain'\n // TODO: 동기화\n context.body = printDirect(data.printerId, grf)\n})\n\n// for webpage scrap => zpl image print(grf format) command for draft version board\nboardPrintRouter.get('/print-label-draft/:id', async (context, next) => {\n const { id } = context.params\n let data = Object.keys(context.query).length ? context.query : null\n\n let orientation = data && data.orientation\n let mirror = data && data.mirror\n let upsideDown = data && data.upsideDown\n let grf = await labelcommand({ id, data, orientation, mirror, upsideDown, context, draft: true } as any)\n\n context.type = 'text/plain'\n // TODO: 동기화\n context.body = printDirect(data.printerId, grf)\n})\n"]}
@@ -1,54 +0,0 @@
1
- import { logger } from '@things-factory/env'
2
-
3
- try {
4
- var print = require('@thiagoelg/node-printer')
5
- } catch (e) {
6
- logger.error(e)
7
- }
8
-
9
- /**
10
- * shoot raw data to printer
11
- *
12
- * @param printer Printer ID
13
- * @param command Raw command
14
- */
15
- export async function printDirect(printer, command) {
16
- print &&
17
- (await print.printDirect({
18
- data: command,
19
- printer,
20
- docname: 'RAW print',
21
- success: function (jobId) {
22
- console.log(`Job ID: ${jobId}`)
23
- },
24
- error: function (error) {
25
- logger.error(error)
26
- }
27
- }))
28
- }
29
-
30
- /**
31
- * get all installed printers
32
- */
33
- export function getPrinters() {
34
- return print?.getPrinters() || []
35
- }
36
-
37
- /**
38
- * get specific printer by name
39
- * @param printerName printer name
40
- */
41
- export function getPrinter(printerName) {
42
- return print?.getPrinter(printerName)
43
- }
44
-
45
- /**
46
- * get default printer name
47
- */
48
- export function getDefaultPrinterName() {
49
- return print?.getDefaultPrinterName()
50
- }
51
-
52
- export function getSupportedPrintFormats() {
53
- return print?.getSupportedPrintFormats()
54
- }
@@ -1,55 +0,0 @@
1
- import Router from 'koa-router'
2
-
3
- import { labelcommand } from '../controllers/label-command'
4
- import { printDirect } from '../controllers/print'
5
-
6
- export const boardPrintRouter = new Router()
7
-
8
- /**
9
- * ?printerId=printer_id&data=grf_string
10
- */
11
- boardPrintRouter.get('/print', async (context, next) => {
12
- let data = Object.keys(context.query).length ? context.query : null
13
-
14
- context.body = await printDirect(data.printerId, data.data)
15
- })
16
-
17
- /**
18
- * { printerId: 'printer driver ID', data: 'grf string' }
19
- */
20
- boardPrintRouter.post('/print', async (context, next) => {
21
- let params = context.request.body
22
-
23
- context.type = 'text/plain'
24
- context.body = await printDirect(params.printerId, params.data)
25
- })
26
-
27
- // for webpage scrap => zpl image print(grf format) command for released version board
28
- boardPrintRouter.get('/print-label/:id', async (context, next) => {
29
- const { id } = context.params
30
- let data = Object.keys(context.query).length ? context.query : null
31
-
32
- let orientation = data && data.orientation
33
- let mirror = data && data.mirror
34
- let upsideDown = data && data.upsideDown
35
- let grf = await labelcommand({ id, data, orientation, mirror, upsideDown, context } as any)
36
-
37
- context.type = 'text/plain'
38
- // TODO: 동기화
39
- context.body = printDirect(data.printerId, grf)
40
- })
41
-
42
- // for webpage scrap => zpl image print(grf format) command for draft version board
43
- boardPrintRouter.get('/print-label-draft/:id', async (context, next) => {
44
- const { id } = context.params
45
- let data = Object.keys(context.query).length ? context.query : null
46
-
47
- let orientation = data && data.orientation
48
- let mirror = data && data.mirror
49
- let upsideDown = data && data.upsideDown
50
- let grf = await labelcommand({ id, data, orientation, mirror, upsideDown, context, draft: true } as any)
51
-
52
- context.type = 'text/plain'
53
- // TODO: 동기화
54
- context.body = printDirect(data.printerId, grf)
55
- })