@things-factory/shell 7.0.1-alpha.5 β†’ 7.0.1-alpha.55

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.
@@ -10,7 +10,7 @@ exports.roundTransformer = {
10
10
  * @param {number | null} value - Floating point value to round or null
11
11
  * @returns {number | null} - Rounded number or null
12
12
  */
13
- to: (value) => (value !== null && !isNaN(value) ? Math.round(value * 100) / 100 : null),
13
+ to: (value) => (value !== null && !isNaN(value) ? Math.round(value * 10000) / 10000 : undefined),
14
14
  /**
15
15
  * Returns the entity field value as it is without any transformation when reading from the database.
16
16
  * @param {number} value - Number value read from the database
@@ -1 +1 @@
1
- {"version":3,"file":"round-transform.js","sourceRoot":"","sources":["../../server/typeorm/round-transform.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,gBAAgB,GAAqB;IAChD;;;;OAIG;IACH,EAAE,EAAE,CAAC,KAAoB,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAEtG;;;;OAIG;IACH,IAAI,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK;CAC/B,CAAA","sourcesContent":["import { ValueTransformer } from 'typeorm'\n\n/**\n * ValueTransformer object for rounding floating point values.\n */\nexport const roundTransformer: ValueTransformer = {\n /**\n * Rounds the entity field value before storing it in the database.\n * @param {number | null} value - Floating point value to round or null\n * @returns {number | null} - Rounded number or null\n */\n to: (value: number | null) => (value !== null && !isNaN(value) ? Math.round(value * 100) / 100 : null),\n\n /**\n * Returns the entity field value as it is without any transformation when reading from the database.\n * @param {number} value - Number value read from the database\n * @returns {number} - The number value as is\n */\n from: (value: number) => value\n}\n"]}
1
+ {"version":3,"file":"round-transform.js","sourceRoot":"","sources":["../../server/typeorm/round-transform.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,gBAAgB,GAAqB;IAChD;;;;OAIG;IACH,EAAE,EAAE,CAAC,KAAoB,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAE/G;;;;OAIG;IACH,IAAI,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK;CAC/B,CAAA","sourcesContent":["import { ValueTransformer } from 'typeorm'\n\n/**\n * ValueTransformer object for rounding floating point values.\n */\nexport const roundTransformer: ValueTransformer = {\n /**\n * Rounds the entity field value before storing it in the database.\n * @param {number | null} value - Floating point value to round or null\n * @returns {number | null} - Rounded number or null\n */\n to: (value: number | null) => (value !== null && !isNaN(value) ? Math.round(value * 10000) / 10000 : undefined),\n\n /**\n * Returns the entity field value as it is without any transformation when reading from the database.\n * @param {number} value - Number value read from the database\n * @returns {number} - The number value as is\n */\n from: (value: number) => value\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/shell",
3
- "version": "7.0.1-alpha.5",
3
+ "version": "7.0.1-alpha.55",
4
4
  "description": "Core module for framework",
5
5
  "bin": {
6
6
  "things-factory": "bin/things-factory",
@@ -46,12 +46,11 @@
46
46
  "@koa/cors": "^5.0.0",
47
47
  "@material-design-icons/font": "^0.14.9",
48
48
  "@material/mwc-button": "^0.27.0",
49
- "@material/mwc-fab": "^0.27.0",
50
49
  "@material/mwc-icon": "^0.27.0",
51
50
  "@material/mwc-icon-button": "^0.27.0",
52
51
  "@material/mwc-slider": "^0.27.0",
53
52
  "@material/mwc-textfield": "^0.27.0",
54
- "@material/web": "^1.1.1",
53
+ "@material/web": "^1.4.0",
55
54
  "@open-wc/scoped-elements": "^2.1.3",
56
55
  "@operato/board": "^2.0.0-alpha.0",
57
56
  "@operato/graphql": "^2.0.0-alpha.0",
@@ -60,11 +59,12 @@
60
59
  "@operato/shell": "^2.0.0-alpha.0",
61
60
  "@operato/typeorm-history": "^2.0.0-alpha.0",
62
61
  "@operato/utils": "^2.0.0-alpha.0",
63
- "@things-factory/ejs-remote": "^7.0.1-alpha.0",
64
- "@things-factory/env": "^7.0.1-alpha.0",
62
+ "@things-factory/ejs-remote": "^7.0.1-alpha.55",
63
+ "@things-factory/env": "^7.0.1-alpha.55",
65
64
  "@things-factory/operato-license-checker": "^4.0.4",
66
- "@things-factory/styles": "^7.0.1-alpha.4",
67
- "@things-factory/utils": "^7.0.1-alpha.4",
65
+ "@things-factory/styles": "^7.0.1-alpha.43",
66
+ "@things-factory/utils": "^7.0.1-alpha.43",
67
+ "@webcomponents/scoped-custom-element-registry": "^0.0.9",
68
68
  "@webcomponents/webcomponentsjs": "^2.6.0",
69
69
  "args": "^5.0.0",
70
70
  "broadcastchannel-polyfill": "^1.0.1",
@@ -101,6 +101,7 @@
101
101
  "loader-utils": "^2.0.0",
102
102
  "lodash": "^4.17.21",
103
103
  "lodash-es": "^4.17.21",
104
+ "material-symbols": "^0.17.2",
104
105
  "mkdirp": "^1.0.4",
105
106
  "moment-timezone": "^0.5.43",
106
107
  "mqtt": "^4.3.4",
@@ -133,5 +134,5 @@
133
134
  "pg": "^8.7.3",
134
135
  "sqlite3": "^5.0.8"
135
136
  },
136
- "gitHead": "3a1ceb942521a89f14c4b16a323b506ff676d349"
137
+ "gitHead": "aeab58a019a928a4063057446538fc3d77cf3d77"
137
138
  }
@@ -20,7 +20,6 @@ import { useServer } from 'graphql-ws/lib/use/ws'
20
20
  import { createServer } from 'http'
21
21
  import Koa from 'koa'
22
22
  import koaBodyParser from 'koa-bodyparser'
23
- import koaStatic from 'koa-static'
24
23
  import compose from 'koa-compose'
25
24
  import { historyApiFallback } from 'koa2-connect-history-api-fallback'
26
25
  import { WebSocketServer } from 'ws'
@@ -269,17 +268,11 @@ const bootstrap = async () => {
269
268
  app.use(graphqlRouter.routes())
270
269
  app.use(graphqlRouter.allowedMethods())
271
270
 
272
- /* should follow this order : history-fallback => webpack-middleware => koaStatic */
271
+ /* should follow this order : history-fallback => webpack-middleware */
273
272
  app.use(historyApiFallback({ whiteList: [] }))
274
273
 
275
274
  app.use(middleware)
276
275
 
277
- app.use(
278
- koaStatic(compiler.outputPath, {
279
- index: false
280
- })
281
- )
282
-
283
276
  httpServer.listen({ port: PORT }, () => {
284
277
  logger.info(`πŸš€ Server ready at http://0.0.0.0:${PORT}/graphql`)
285
278
  logger.info(`πŸš€ Subscriptions ready at ws://0.0.0.0:${PORT}/graphql`)
@@ -9,7 +9,7 @@ export const roundTransformer: ValueTransformer = {
9
9
  * @param {number | null} value - Floating point value to round or null
10
10
  * @returns {number | null} - Rounded number or null
11
11
  */
12
- to: (value: number | null) => (value !== null && !isNaN(value) ? Math.round(value * 100) / 100 : null),
12
+ to: (value: number | null) => (value !== null && !isNaN(value) ? Math.round(value * 10000) / 10000 : undefined),
13
13
 
14
14
  /**
15
15
  * Returns the entity field value as it is without any transformation when reading from the database.
@@ -52,6 +52,7 @@
52
52
  <!-- Performance tip: hint to the browser to start the handshake for the fonts site -->
53
53
  <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin />
54
54
  <link href="/node_modules/@material-design-icons/font/index.css" rel="stylesheet" />
55
+ <link href="/node_modules/material-symbols/index.css" rel="stylesheet" />
55
56
  <link rel="stylesheet" href="/theme.css" />
56
57
 
57
58
  <style>
@@ -1,3 +0,0 @@
1
- export * from './oops-note'
2
- export * from './oops-spinner'
3
- export * from './oops-progress'
@@ -1,49 +0,0 @@
1
- import { LitElement, html, css } from 'lit'
2
-
3
- import '@material/mwc-icon'
4
-
5
- export class OopsNote extends LitElement {
6
- static get styles() {
7
- return css`
8
- :host {
9
- display: block;
10
- text-align: center;
11
- }
12
- mwc-icon {
13
- font: var(--oops-note-icon-font);
14
- color: var(--oops-note-icon-color);
15
- border: var(--oops-note-icon-border);
16
- border-radius: var(--oops-note-icon-border-radius);
17
- padding: var(--oops-note-icon-padding);
18
- }
19
- [title] {
20
- margin: var(--oops-note-title-margin);
21
- font: var(--oops-note-title-font);
22
- color: var(--oops-note-title-color);
23
- text-transform: capitalize;
24
- }
25
- [description] {
26
- font: var(--oops-note-description-font);
27
- color: var(--oops-note-description-color);
28
- }
29
- `
30
- }
31
-
32
- static get properties() {
33
- return {
34
- icon: String,
35
- title: String,
36
- description: String
37
- }
38
- }
39
-
40
- render() {
41
- return html`
42
- <mwc-icon>${this.icon}</mwc-icon>
43
- <div title>${this.title}</div>
44
- <div description>${this.description}</div>
45
- `
46
- }
47
- }
48
-
49
- customElements.define('oops-note', OopsNote)
@@ -1,81 +0,0 @@
1
- import gql from 'graphql-tag'
2
- import { html, LitElement } from 'lit'
3
-
4
- import { subscribe } from '@operato/graphql'
5
-
6
- export class OopsProgress extends LitElement {
7
- static get properties() {
8
- return {
9
- tag: String,
10
- subscription: Boolean
11
- }
12
- }
13
-
14
- render() {
15
- return html` <slot></slot> `
16
- }
17
-
18
- disconnectedCallback() {
19
- super.disconnectedCallback()
20
- this.stopSubscribe()
21
- }
22
-
23
- get subscription() {
24
- return this._subscription
25
- }
26
-
27
- set subscription(subscription) {
28
- console.warn('oops-progress#subscription is readonly property')
29
- }
30
-
31
- async updated(changes) {
32
- if (changes.has('tag') && this.subscription) {
33
- await this.stopSubscribe()
34
- }
35
- }
36
-
37
- async startSubscribe() {
38
- if (!this.tag || this._subscription) {
39
- return
40
- }
41
-
42
- this._subscription = await subscribe(
43
- {
44
- query: gql`
45
- subscription {
46
- data(tag: "${this.tag}") {
47
- tag
48
- data
49
- }
50
- }`
51
- },
52
- {
53
- next: async ({ data }) => {
54
- if (data) {
55
- const { progress = 0, message = '' } = data?.data?.data || {}
56
- this.dispatchEvent(
57
- new CustomEvent('progress', {
58
- detail: {
59
- progress,
60
- message
61
- }
62
- })
63
- )
64
-
65
- if (progress >= 100) {
66
- await this.stopSubscribe()
67
- this.dispatchEvent(new CustomEvent('finish'))
68
- }
69
- }
70
- }
71
- }
72
- )
73
- }
74
-
75
- async stopSubscribe() {
76
- await this._subscription?.unsubscribe()
77
- delete this._subscription
78
- }
79
- }
80
-
81
- customElements.define('oops-progress', OopsProgress)
@@ -1,31 +0,0 @@
1
- import { LitElement, html, css } from 'lit'
2
-
3
- export class OopsSpinner extends LitElement {
4
- static get styles() {
5
- return css`
6
- :host {
7
- width: 70px;
8
- height: 70px;
9
- margin: 0 auto;
10
- background: url(/assets/images/spinner.png) 0 0 no-repeat;
11
- background-size: 700%;
12
- animation: spinner steps(6) 2s infinite both;
13
- }
14
-
15
- @keyframes spinner {
16
- 0% {
17
- background-position: 0%;
18
- }
19
- 100% {
20
- background-position: 100%;
21
- }
22
- }
23
- `
24
- }
25
-
26
- render() {
27
- return html``
28
- }
29
- }
30
-
31
- customElements.define('oops-spinner', OopsSpinner)
@@ -1,73 +0,0 @@
1
- # OOPS Progress μ»΄ν¬λ„ŒνŠΈ
2
-
3
- κΈ΄ μ‹œκ°„ μ§„ν–‰λ˜λŠ” μž‘μ—…μ˜ μ§„ν–‰ 상황을 ν‘œν˜„ν•΄μ£ΌκΈ° μœ„ν•΄ μ„œλ²„μ— μ§„ν–‰μœ¨μ„ Subscribeν•˜λŠ” ν΄λΌμ΄μ–ΈνŠΈ μ»΄ν¬λ„ŒνŠΈμ΄λ‹€.
4
- 이 μ»΄ν¬λ„ŒνŠΈλŠ” 자체적으둜 μ‹œκ°μ  μš”μ†Œλ₯Ό ν¬ν•¨ν•˜μ§€ μ•Šμ§€λ§Œ, μ‹œκ°μ  ν‘œν˜„μ„ μœ„ν•΄μ„œ μžμ‹ λ…Έλ“œ(Light DOM)λ₯Ό 포함할 μˆ˜λŠ” μžˆλ‹€.
5
-
6
- ## properties
7
-
8
- - tag: String μ„œλΈŒμŠ€ν¬λ¦½μ…˜ νƒœκ·Έμ΄λ©°, μ„œλ²„μ˜ 'publishProgress'의 tag와 μΌμΉ˜μ‹œν‚€λ„λ‘ ν•œλ‹€.
9
- - subscription: String (readonly) 이 속성이 값을 κ°€μ§€κ³  있으면, μ„œλΈŒμŠ€ν¬λ¦½μ…˜ μ€‘μž„μ„ μ˜λ―Έν•œλ‹€.
10
-
11
- ## methods
12
-
13
- - startSubscribe() μ§„ν–‰μœ¨ ꡬ독을 μ‹œμž‘ν•œλ‹€.
14
- - stopSubscribe() μ§„ν–‰μœ¨ ꡬ독을 μ’…λ£Œν•œλ‹€.(μ„œλ²„μͺ½ μž‘μ—…μ˜ μ’…λ£Œλ₯Ό μ˜λ―Έν•˜μ§€ μ•ŠμœΌλ©°, ν΄λΌμ΄μ–ΈνŠΈμ—μ„œ ꡬ독을 μ’…λ£Œν•œλ‹€λŠ” μ˜λ―Έμž„.)
15
-
16
- ## event
17
-
18
- - progress(event) μ„œλ²„λ‘œλΆ€ν„° μ§„ν–‰μœ¨μ΄ Subscribe λ˜μ—ˆμ„ λ•Œ λ°œμƒν•œλ‹€.
19
- - event.detail : progress 값을 κ°–λŠ”λ‹€.
20
- - finish(event) μ§„ν–‰μœ¨μ΄ 100% λ„λ‹¬ν•˜λ©΄ λ°œμƒν•œλ‹€.
21
-
22
- ## μ˜ˆμ‹œ
23
-
24
- ### ν΄λΌμ΄μ–ΈνŠΈ μ‚¬μ΄λ“œ
25
-
26
- ```
27
- <oops-progress
28
- .tag='progress-pending-job'
29
- @progress=${e => {
30
- this.progress = e.detail
31
- }}
32
- @finish=${() => {
33
- console.log('complete')
34
- }}
35
- ?hidden=${progress < 0 || progress > 100}
36
- >
37
- <div>
38
- <mwc-linear-progress .progress=${progress / 100}></mwc-linear-progress>
39
- <span>Progress : ${progress} % (${message})</span>
40
- </div>
41
- </oops-progress>
42
-
43
- ```
44
-
45
- ### μ„œλ²„μ‚¬μ΄λ“œ
46
-
47
- ```
48
- import { sleep } from '@things-factory/utils'
49
-
50
- ...
51
-
52
- @Mutation(returns => String, { description: 'To reference of pending job progress' })
53
- async referencePendingJob(
54
- @Root() _,
55
- @Ctx() context: any
56
- ) : Promise<string> {
57
-
58
- const { domain } = context.state
59
-
60
- for(var i = 0;i <= 100;i++) {
61
- await sleep(100)
62
-
63
- publishProgress({
64
- domain,
65
- tag: 'progress-pending-job',
66
- progress: i,
67
- message: `${i * 10} / 1000`
68
- })
69
- }
70
-
71
- return 'success'
72
- }
73
- ```