@things-factory/board-service 7.0.0-alpha.0 → 7.0.0-alpha.18
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/dist-server/controllers/headless-model.js +7 -6
- package/dist-server/controllers/headless-model.js.map +1 -1
- package/dist-server/controllers/headless-playlist.js +2 -2
- package/dist-server/controllers/headless-playlist.js.map +1 -1
- package/dist-server/controllers/headless-pool-for-board.js +1 -1
- package/dist-server/controllers/headless-pool-for-board.js.map +1 -1
- package/dist-server/controllers/headless-pool-for-label.js +5 -5
- package/dist-server/controllers/headless-pool-for-label.js.map +1 -1
- package/dist-server/controllers/label-command.js +2 -2
- package/dist-server/controllers/label-command.js.map +1 -1
- package/dist-server/controllers/screenshot.js +2 -2
- package/dist-server/controllers/screenshot.js.map +1 -1
- package/dist-server/routers/board-print-router.js +13 -0
- package/dist-server/routers/board-print-router.js.map +1 -1
- package/dist-server/routers/standalone-board-service-router.js +12 -1
- package/dist-server/routers/standalone-board-service-router.js.map +1 -1
- package/dist-server/service/board/board-subscription.js +4 -4
- package/dist-server/service/board/board-subscription.js.map +1 -1
- package/dist-server/service/play-group/play-group-subscription.js +4 -4
- package/dist-server/service/play-group/play-group-subscription.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/server/controllers/headless-model.ts +6 -6
- package/server/controllers/headless-playlist.ts +2 -2
- package/server/controllers/headless-pool-for-board.ts +1 -1
- package/server/controllers/headless-pool-for-label.ts +3 -3
- package/server/controllers/label-command.ts +2 -2
- package/server/controllers/screenshot.ts +3 -2
- package/server/routers/board-print-router.ts +16 -0
- package/server/routers/standalone-board-service-router.ts +16 -1
- package/server/service/board/board-subscription.ts +7 -7
- package/server/service/play-group/play-group-subscription.ts +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/board-service",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.18",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@things-factory/auth-base": "^7.0.0-alpha.
|
|
27
|
+
"@things-factory/auth-base": "^7.0.0-alpha.18",
|
|
28
28
|
"@things-factory/env": "^7.0.0-alpha.0",
|
|
29
|
-
"@things-factory/fav-base": "^7.0.0-alpha.
|
|
30
|
-
"@things-factory/font-base": "^7.0.0-alpha.
|
|
31
|
-
"@things-factory/integration-base": "^7.0.0-alpha.
|
|
29
|
+
"@things-factory/fav-base": "^7.0.0-alpha.18",
|
|
30
|
+
"@things-factory/font-base": "^7.0.0-alpha.18",
|
|
31
|
+
"@things-factory/integration-base": "^7.0.0-alpha.18",
|
|
32
32
|
"@things-factory/operato-license-checker": "^4.0.4",
|
|
33
33
|
"content-disposition": "^0.5.3",
|
|
34
34
|
"generic-pool": "^3.8.2"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
37
|
"@thiagoelg/node-printer": "0.6.2",
|
|
38
|
-
"puppeteer": "^
|
|
38
|
+
"puppeteer": "^22.3.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "f695ce9c0e3a8f2d715d27a2e7674c9b9c6b1ee1"
|
|
41
41
|
}
|
|
@@ -4,7 +4,7 @@ import { getContextPath, getRepository } from '@things-factory/shell'
|
|
|
4
4
|
import { Board } from '../service/board/board'
|
|
5
5
|
import { BoardHistory } from '../service/board/board-history'
|
|
6
6
|
|
|
7
|
-
export const headlessModel = async (target,
|
|
7
|
+
export const headlessModel = async (target, draft: boolean = false) => {
|
|
8
8
|
var { domain, id, model, name } = target || {}
|
|
9
9
|
|
|
10
10
|
if (model) {
|
|
@@ -26,7 +26,7 @@ export const headlessModel = async (target, devmode: boolean = false) => {
|
|
|
26
26
|
throw 'parameter model or id mandatory'
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
if (!
|
|
29
|
+
if (!draft && board) {
|
|
30
30
|
const latestReleased =
|
|
31
31
|
board.state == 'released'
|
|
32
32
|
? board
|
|
@@ -37,12 +37,12 @@ export const headlessModel = async (target, devmode: boolean = false) => {
|
|
|
37
37
|
.limit(1)
|
|
38
38
|
.getOne()
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
model = (latestReleased || board).model
|
|
41
|
+
} else {
|
|
42
|
+
model = board.model
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
model = JSON.parse(
|
|
45
|
+
model = JSON.parse(model)
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
return {
|
|
@@ -3,7 +3,7 @@ import { getContextPath, getRepository } from '@things-factory/shell'
|
|
|
3
3
|
import { PlayGroup } from '../service/play-group/play-group'
|
|
4
4
|
import { BoardHistory } from '../service/board/board-history'
|
|
5
5
|
|
|
6
|
-
export const headlessPlaylist = async (target,
|
|
6
|
+
export const headlessPlaylist = async (target, draft: boolean = false) => {
|
|
7
7
|
var { domain, id, name } = target || {}
|
|
8
8
|
|
|
9
9
|
if (id || name) {
|
|
@@ -21,7 +21,7 @@ export const headlessPlaylist = async (target, devmode: boolean = false) => {
|
|
|
21
21
|
})
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
if (!
|
|
24
|
+
if (!draft && playGroup) {
|
|
25
25
|
const { boards } = playGroup
|
|
26
26
|
for (let board of boards) {
|
|
27
27
|
const latestReleased =
|
|
@@ -45,8 +45,8 @@ export function getHeadlessPool() {
|
|
|
45
45
|
)
|
|
46
46
|
|
|
47
47
|
setTimeout(async () => {
|
|
48
|
-
const
|
|
49
|
-
for await (const data of
|
|
48
|
+
const eventSource = pubsub.subscribe('notify-font-changed')
|
|
49
|
+
for await (const data of eventSource) {
|
|
50
50
|
headlessPool.clear()
|
|
51
51
|
}
|
|
52
52
|
})
|
|
@@ -65,7 +65,7 @@ async function initializeChromium() {
|
|
|
65
65
|
|
|
66
66
|
var launchSetting = {
|
|
67
67
|
args: ['--hide-scrollbars', '--mute-audio', '--no-sandbox', '--use-gl=egl'],
|
|
68
|
-
headless: '
|
|
68
|
+
headless: 'shell'
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
if (CHROMIUM_PATH) {
|
|
@@ -14,7 +14,7 @@ import { headlessModel } from './headless-model'
|
|
|
14
14
|
* @param {boolean} mirror 좌우반전
|
|
15
15
|
* @param {boolean} upsideDown 상하반전
|
|
16
16
|
*/
|
|
17
|
-
export const labelcommand = async ({ id, model, data, orientation, mirror = false, upsideDown = false, context }) => {
|
|
17
|
+
export const labelcommand = async ({ id, model, data, orientation, mirror = false, upsideDown = false, context, draft = false }) => {
|
|
18
18
|
const { domain } = context.state
|
|
19
19
|
|
|
20
20
|
const browser = (await getHeadlessPool().acquire()) as any
|
|
@@ -24,7 +24,7 @@ export const labelcommand = async ({ id, model, data, orientation, mirror = fals
|
|
|
24
24
|
|
|
25
25
|
const { page } = browser
|
|
26
26
|
|
|
27
|
-
var { model } = await headlessModel({ domain, model, id })
|
|
27
|
+
var { model } = await headlessModel({ domain, model, id }, draft)
|
|
28
28
|
|
|
29
29
|
const grf = await page.evaluate(
|
|
30
30
|
async (model, data, orientation, mirror, upsideDown) => {
|
|
@@ -14,7 +14,8 @@ export const screenshot = async ({
|
|
|
14
14
|
height: h = 0,
|
|
15
15
|
options = { encoding: 'base64' } as any,
|
|
16
16
|
isThumbnail = false,
|
|
17
|
-
context = {} as any
|
|
17
|
+
context = {} as any,
|
|
18
|
+
draft = false
|
|
18
19
|
} = {}) => {
|
|
19
20
|
const browser = (await getHeadlessPool().acquire()) as any
|
|
20
21
|
var screenshot = null
|
|
@@ -24,7 +25,7 @@ export const screenshot = async ({
|
|
|
24
25
|
}
|
|
25
26
|
const { domain, user } = context.state
|
|
26
27
|
|
|
27
|
-
var { model, base } = await headlessModel({ domain, id, model })
|
|
28
|
+
var { model, base } = await headlessModel({ domain, id, model }, draft)
|
|
28
29
|
const [fontsToUse, fontStyles] = await fonts(domain)
|
|
29
30
|
|
|
30
31
|
model.fonts = fontsToUse
|
|
@@ -24,6 +24,7 @@ boardPrintRouter.post('/print', async (context, next) => {
|
|
|
24
24
|
context.body = await printDirect(params.printerId, params.data)
|
|
25
25
|
})
|
|
26
26
|
|
|
27
|
+
// for webpage scrap => zpl image print(grf format) command for released version board
|
|
27
28
|
boardPrintRouter.get('/print-label/:id', async (context, next) => {
|
|
28
29
|
const { id } = context.params
|
|
29
30
|
let data = Object.keys(context.query).length ? context.query : null
|
|
@@ -37,3 +38,18 @@ boardPrintRouter.get('/print-label/:id', async (context, next) => {
|
|
|
37
38
|
// TODO: 동기화
|
|
38
39
|
context.body = printDirect(data.printerId, grf)
|
|
39
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
|
+
})
|
|
@@ -295,7 +295,7 @@ standaloneBoardServiceRouter.get('/board/pdf/:id', async (context, next) => {
|
|
|
295
295
|
context.body = result
|
|
296
296
|
})
|
|
297
297
|
|
|
298
|
-
// for webpage scrap => zpl image print(grf format) command
|
|
298
|
+
// for webpage scrap => zpl image print(grf format) command for released version board
|
|
299
299
|
standaloneBoardServiceRouter.get('/label-command/:id', async (context, next) => {
|
|
300
300
|
const { id } = context.params
|
|
301
301
|
|
|
@@ -309,3 +309,18 @@ standaloneBoardServiceRouter.get('/label-command/:id', async (context, next) =>
|
|
|
309
309
|
context.type = 'text/plain'
|
|
310
310
|
context.body = await labelcommand({ id, data, orientation, mirror, upsideDown, context } as any)
|
|
311
311
|
})
|
|
312
|
+
|
|
313
|
+
// for webpage scrap => zpl image print(grf format) command for draft version board
|
|
314
|
+
standaloneBoardServiceRouter.get('/label-command-draft/:id', async (context, next) => {
|
|
315
|
+
const { id } = context.params
|
|
316
|
+
|
|
317
|
+
const data = context.query
|
|
318
|
+
delete data.access_token
|
|
319
|
+
|
|
320
|
+
const orientation = data && data.orientation
|
|
321
|
+
const mirror = data && data.mirror
|
|
322
|
+
const upsideDown = data && data.upsideDown
|
|
323
|
+
|
|
324
|
+
context.type = 'text/plain'
|
|
325
|
+
context.body = await labelcommand({ id, data, orientation, mirror, upsideDown, context, draft: true } as any)
|
|
326
|
+
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Resolver, Subscription, Root, Arg } from 'type-graphql'
|
|
2
|
-
import {
|
|
2
|
+
import { filter, pipe } from 'graphql-yoga'
|
|
3
3
|
import { pubsub } from '@things-factory/shell'
|
|
4
4
|
import { Board } from './board'
|
|
5
5
|
|
|
6
6
|
@Resolver(Board)
|
|
7
7
|
export class BoardSubscription {
|
|
8
8
|
@Subscription({
|
|
9
|
-
subscribe: (
|
|
9
|
+
subscribe: ({ args, context, info }) => {
|
|
10
10
|
const { domain, user } = context.state
|
|
11
11
|
const { id } = args
|
|
12
12
|
const subdomain = domain?.subdomain
|
|
@@ -19,9 +19,9 @@ export class BoardSubscription {
|
|
|
19
19
|
throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
(payload
|
|
22
|
+
return pipe(
|
|
23
|
+
pubsub.subscribe('board'),
|
|
24
|
+
filter((payload: { board: Board }) => {
|
|
25
25
|
const { domainId, id: boardId } = payload.board
|
|
26
26
|
|
|
27
27
|
if (domainId !== domain.id) {
|
|
@@ -33,8 +33,8 @@ export class BoardSubscription {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
return true
|
|
36
|
-
}
|
|
37
|
-
)
|
|
36
|
+
})
|
|
37
|
+
)
|
|
38
38
|
}
|
|
39
39
|
})
|
|
40
40
|
board(@Root() payload: { board: Board }, @Arg('id') id: string): Board {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Resolver, Subscription, Root, Arg } from 'type-graphql'
|
|
2
|
-
import {
|
|
2
|
+
import { filter, pipe } from 'graphql-yoga'
|
|
3
3
|
import { pubsub } from '@things-factory/shell'
|
|
4
4
|
import { PlayGroup } from './play-group'
|
|
5
5
|
|
|
6
6
|
@Resolver(PlayGroup)
|
|
7
7
|
export class PlayGroupSubscription {
|
|
8
8
|
@Subscription({
|
|
9
|
-
subscribe: (
|
|
9
|
+
subscribe: ({ args, context, info }) => {
|
|
10
10
|
const { domain, user } = context.state
|
|
11
11
|
const { id } = args
|
|
12
12
|
const subdomain = domain?.subdomain
|
|
@@ -19,9 +19,9 @@ export class PlayGroupSubscription {
|
|
|
19
19
|
throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
(payload
|
|
22
|
+
return pipe(
|
|
23
|
+
pubsub.subscribe('play-group'),
|
|
24
|
+
filter((payload: { playGroup: PlayGroup }) => {
|
|
25
25
|
const { id: playGroupId, domainId } = payload.playGroup
|
|
26
26
|
|
|
27
27
|
if (domainId !== domain.id) {
|
|
@@ -33,8 +33,8 @@ export class PlayGroupSubscription {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
return true
|
|
36
|
-
}
|
|
37
|
-
)
|
|
36
|
+
})
|
|
37
|
+
)
|
|
38
38
|
}
|
|
39
39
|
})
|
|
40
40
|
playGroup(@Root() payload: { playGroup: PlayGroup }, @Arg('id') id: string): PlayGroup {
|