@things-factory/reference-app 4.0.3 → 4.0.7

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.
Files changed (54) hide show
  1. package/Dockerfile +1 -1
  2. package/attachments/03176f83-6c50-4850-ab43-e6765b259afd.png +0 -0
  3. package/attachments/2b963bee-3ca5-4a86-95b7-e557b7eba8eb.html +5695 -0
  4. package/attachments/4880d6fb-7045-4c50-bfb9-daf83ecf6cc1.png +0 -0
  5. package/attachments/5bcde766-32e5-4cdc-ad9b-9e0139c122f4.txt +673 -0
  6. package/attachments/6f9d5fd4-6546-40c6-90c0-0207233ad12f.json +145 -0
  7. package/attachments/a1aaa123-4c8d-485e-9975-5b5b4add6a30.png +0 -0
  8. package/attachments/b2331d78-f55d-4b9e-8aae-34f80c1252b3.jpeg +0 -0
  9. package/attachments/b9a3e2fd-fe83-4394-8fc8-66478443f65e.png +0 -0
  10. package/attachments/be3d2cd7-d236-45af-b512-4f141c8e2cfc.pptx +0 -0
  11. package/attachments/d211b356-1619-4f2b-9b10-ed46b4fd82de.png +0 -0
  12. package/attachments/d445e1a1-a048-49d7-96f2-284ac00fe96a.png +0 -0
  13. package/attachments/d462b12b-d519-4d6c-861a-f56d2494b135.png +0 -0
  14. package/attachments/f63986fb-bef5-4b55-a342-6fd4abf26739.png +0 -0
  15. package/client/bootstrap.js +30 -0
  16. package/client/components/camera-capturer.js +29 -2
  17. package/client/components/ocr-viewpart.js +94 -0
  18. package/client/menu.js +1 -1
  19. package/client/pages/context-menu-page.js +91 -69
  20. package/client/pages/grist-mode-page.js +15 -15
  21. package/client/pages/label-scan-page.js +189 -0
  22. package/client/pages/ocr-page.js +4 -3
  23. package/client/route.js +4 -0
  24. package/config/config.development.js +5 -1
  25. package/db.sqlite +0 -0
  26. package/dist-server/service/reference/lambda-call.js +68 -0
  27. package/dist-server/service/reference/lambda-call.js.map +1 -0
  28. package/dist-server/service/reference/reference-query.js +26 -4
  29. package/dist-server/service/reference/reference-query.js.map +1 -1
  30. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +11 -6
  31. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +9 -14
  32. package/logs/application-2021-11-29-20.log +21 -0
  33. package/logs/application-2021-11-29-21.log +4 -0
  34. package/logs/application-2021-11-29-23.log +4 -0
  35. package/logs/{connections-2021-11-02-11.log → connections-2021-11-29-20.log} +0 -0
  36. package/logs/{connections-2021-11-03-11.log → connections-2021-11-29-21.log} +0 -0
  37. package/logs/{connections-2021-11-04-14.log → connections-2021-11-29-23.log} +0 -0
  38. package/package.json +44 -43
  39. package/server/service/reference/lambda-call.ts +69 -0
  40. package/server/service/reference/reference-query.ts +35 -7
  41. package/things-factory.config.js +4 -0
  42. package/translations/en.json +3 -2
  43. package/translations/ko.json +3 -2
  44. package/translations/ms.json +3 -2
  45. package/translations/zh.json +3 -2
  46. package/views/auth-page.html +0 -1
  47. package/attachments/69808491-8e6b-45e2-9bf8-dccea1c5b52e.png +0 -0
  48. package/attachments/7927fe8e-2246-453d-9869-7072b983437c.png +0 -0
  49. package/attachments/7d150574-01b8-4439-96a0-d57299f3ffcf.png +0 -0
  50. package/attachments/a1cf142c-f3c2-442c-b8d5-a7f9cc6a59b3.png +0 -0
  51. package/attachments/cb3ac834-ece0-4802-bef0-dfdc0fcd93bd.png +0 -0
  52. package/logs/application-2021-11-04-14.log +0 -4
  53. package/logs/application-2021-11-05-18.log +0 -6
  54. package/logs/connections-2021-11-05-18.log +0 -0
@@ -1,18 +1,23 @@
1
- import { Resolver, Mutation, Query, Root, Arg, Ctx, Directive } from 'type-graphql'
2
- import { GraphQLUpload, FileUpload } from 'graphql-upload'
3
- import { publishProgress } from '@things-factory/shell'
4
- import { sleep } from '@things-factory/utils'
1
+ import { FileUpload, GraphQLUpload } from 'graphql-upload'
2
+ import { Arg, Ctx, Query, Resolver, Root } from 'type-graphql'
3
+
5
4
  import { Attachment, createAttachments } from '@things-factory/attachment-base'
5
+ import { publishProgress, ScalarAny } from '@things-factory/shell'
6
+ import { sleep } from '@things-factory/utils'
7
+
8
+ import { interpretImages } from './lambda-call'
9
+
10
+ const debug = require('debug')('things-factory:reference-app')
6
11
 
7
12
  @Resolver()
8
13
  export class ReferenceQuery {
9
- @Query(returns => String, { description: 'To reference of ocr request' })
14
+ @Query(returns => ScalarAny, { description: 'To reference of ocr request' })
10
15
  async ocrRequest(
11
16
  @Root() _,
12
17
  @Arg('images', () => [GraphQLUpload])
13
18
  images: FileUpload[],
14
19
  @Ctx() context: any
15
- ): Promise<string> {
20
+ ): Promise<ScalarAny> {
16
21
  const { domain, user, tx } = context.state
17
22
  const all = Promise.all(images)
18
23
 
@@ -25,9 +30,32 @@ export class ReferenceQuery {
25
30
  }
26
31
  })
27
32
  await createAttachments(_, { attachments }, context)
33
+
34
+ const files = await Promise.all(
35
+ images.map(async file => {
36
+ const { createReadStream, filename, mimetype } = await file
37
+ const readStream = createReadStream()
38
+ const image = await this.streamToString(readStream)
39
+ // format is 'image/jpeg'
40
+ const formatArr = mimetype.split('/')
41
+ return { data: image, name: filename, format: formatArr[formatArr.length - 1] }
42
+ })
43
+ )
44
+ const res = await interpretImages(files)
45
+ console.log('interpretImages response', JSON.stringify(res, null, ' '))
46
+ return res.data?.upload?.result
28
47
  }
29
48
 
30
- return 'success'
49
+ return []
50
+ }
51
+
52
+ streamToString (stream) {
53
+ const chunks = [];
54
+ return new Promise((resolve, reject) => {
55
+ stream.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
56
+ stream.on('error', (err) => reject(err));
57
+ stream.on('end', () => resolve(Buffer.concat(chunks).toString('base64')));
58
+ })
31
59
  }
32
60
 
33
61
  @Query(returns => String, { description: 'To reference of pending job progress' })
@@ -56,6 +56,10 @@ export default {
56
56
  tagname: 'direct-print',
57
57
  page: 'direct-print'
58
58
  },
59
+ {
60
+ tagname: 'label-scan-page',
61
+ page: 'label-scan-page'
62
+ },
59
63
  {
60
64
  tagname: 'ghost-print-page',
61
65
  page: 'ghost-print-page'
@@ -6,5 +6,6 @@
6
6
  "field.color": "color",
7
7
  "field.role": "role",
8
8
  "field.dynamic_type": "dynamic type",
9
- "field.dynamic_value": "dynamic value"
10
- }
9
+ "field.dynamic_value": "dynamic value",
10
+ "text.ox-data-report-grand-total": "grand total"
11
+ }
@@ -6,5 +6,6 @@
6
6
  "field.color": "색상",
7
7
  "field.role": "역할",
8
8
  "field.dynamic_type": "변화 타입",
9
- "field.dynamic_value": "변화타입 값"
10
- }
9
+ "field.dynamic_value": "변화타입 값",
10
+ "text.ox-data-report-grand-total": "총합계"
11
+ }
@@ -6,5 +6,6 @@
6
6
  "field.color": "color",
7
7
  "field.role": "role",
8
8
  "field.dynamic_type": "dynamic type",
9
- "field.dynamic_value": "dynamic value"
10
- }
9
+ "field.dynamic_value": "dynamic value",
10
+ "text.ox-data-report-grand-total": "grand total"
11
+ }
@@ -6,5 +6,6 @@
6
6
  "field.color": "color",
7
7
  "field.role": "role",
8
8
  "field.dynamic_type": "dynamic type",
9
- "field.dynamic_value": "dynamic value"
10
- }
9
+ "field.dynamic_value": "dynamic value",
10
+ "text.ox-data-report-grand-total": "grand total"
11
+ }
@@ -80,7 +80,6 @@
80
80
  <!-- Load webcomponents-loader.js to check and load any polyfills your browser needs -->
81
81
  <script src="node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
82
82
  <script src="node_modules/web-animations-js/web-animations-next.min.js"></script>
83
- <script src="node_modules/@lottiefiles/lottie-player/dist/lottie-player.js"></script>
84
83
  <!-- Built with love using PWA Starter Kit -->
85
84
 
86
85
  <script src="<%- elementScript %>"></script>
@@ -1,4 +0,0 @@
1
- 2021-11-04T05:54:18.294Z info: File Storage is Ready.
2
- 2021-11-04T05:54:26.107Z info: Database connection established
3
- 2021-11-04T05:54:30.807Z info: 🚀 Server ready at http://0.0.0.0:3000/graphql
4
- 2021-11-04T05:54:30.812Z info: 🚀 Subscriptions ready at ws://0.0.0.0:3000/subscriptions
@@ -1,6 +0,0 @@
1
- 2021-11-05T09:19:08.124Z info: File Storage is Ready.
2
- 2021-11-05T09:19:12.759Z info: Database connection established
3
- 2021-11-05T09:19:47.437Z info: File Storage is Ready.
4
- 2021-11-05T09:19:51.042Z info: Database connection established
5
- 2021-11-05T09:19:51.851Z info: 🚀 Server ready at http://0.0.0.0:3000/graphql
6
- 2021-11-05T09:19:51.851Z info: 🚀 Subscriptions ready at ws://0.0.0.0:3000/subscriptions
File without changes