@things-factory/shell 7.0.0-alpha.8 → 7.0.1-alpha.0
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/graphql-local-client.js +3 -3
- package/dist-server/graphql-local-client.js.map +1 -1
- package/dist-server/index.d.ts +1 -0
- package/dist-server/index.js +1 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/dist-server/typeorm/round-transform.d.ts +5 -0
- package/dist-server/typeorm/round-transform.js +21 -0
- package/dist-server/typeorm/round-transform.js.map +1 -0
- package/package.json +8 -8
- package/server/graphql-local-client.ts +4 -4
- package/server/index.ts +2 -0
- package/server/typeorm/round-transform.ts +20 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.roundTransformer = void 0;
|
4
|
+
/**
|
5
|
+
* ValueTransformer object for rounding floating point values.
|
6
|
+
*/
|
7
|
+
exports.roundTransformer = {
|
8
|
+
/**
|
9
|
+
* Rounds the entity field value before storing it in the database.
|
10
|
+
* @param {number | null} value - Floating point value to round or null
|
11
|
+
* @returns {number | null} - Rounded number or null
|
12
|
+
*/
|
13
|
+
to: (value) => (value !== null && !isNaN(value) ? Math.round(value * 100) / 100 : null),
|
14
|
+
/**
|
15
|
+
* Returns the entity field value as it is without any transformation when reading from the database.
|
16
|
+
* @param {number} value - Number value read from the database
|
17
|
+
* @returns {number} - The number value as is
|
18
|
+
*/
|
19
|
+
from: (value) => value
|
20
|
+
};
|
21
|
+
//# sourceMappingURL=round-transform.js.map
|
@@ -0,0 +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"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/shell",
|
3
|
-
"version": "7.0.
|
3
|
+
"version": "7.0.1-alpha.0",
|
4
4
|
"description": "Core module for framework",
|
5
5
|
"bin": {
|
6
6
|
"things-factory": "bin/things-factory",
|
@@ -41,9 +41,9 @@
|
|
41
41
|
"@graphql-tools/merge": "^8.3.0",
|
42
42
|
"@graphql-tools/schema": "^8.5.0",
|
43
43
|
"@graphql-tools/utils": "^8.8.0",
|
44
|
-
"@hatiolab/koa-webpack": "^
|
44
|
+
"@hatiolab/koa-webpack": "^6.0.0",
|
45
45
|
"@hatiolab/things-scene": "^3.2.0",
|
46
|
-
"@koa/cors": "^
|
46
|
+
"@koa/cors": "^5.0.0",
|
47
47
|
"@material-design-icons/font": "^0.14.9",
|
48
48
|
"@material/mwc-button": "^0.27.0",
|
49
49
|
"@material/mwc-fab": "^0.27.0",
|
@@ -60,11 +60,11 @@
|
|
60
60
|
"@operato/shell": "^2.0.0-alpha.0",
|
61
61
|
"@operato/typeorm-history": "^2.0.0-alpha.0",
|
62
62
|
"@operato/utils": "^2.0.0-alpha.0",
|
63
|
-
"@things-factory/ejs-remote": "^7.0.
|
64
|
-
"@things-factory/env": "^7.0.
|
63
|
+
"@things-factory/ejs-remote": "^7.0.1-alpha.0",
|
64
|
+
"@things-factory/env": "^7.0.1-alpha.0",
|
65
65
|
"@things-factory/operato-license-checker": "^4.0.4",
|
66
|
-
"@things-factory/styles": "^7.0.
|
67
|
-
"@things-factory/utils": "^7.0.
|
66
|
+
"@things-factory/styles": "^7.0.1-alpha.0",
|
67
|
+
"@things-factory/utils": "^7.0.1-alpha.0",
|
68
68
|
"@webcomponents/webcomponentsjs": "^2.6.0",
|
69
69
|
"args": "^5.0.0",
|
70
70
|
"broadcastchannel-polyfill": "^1.0.1",
|
@@ -134,5 +134,5 @@
|
|
134
134
|
"pg": "^8.7.3",
|
135
135
|
"sqlite3": "^5.0.8"
|
136
136
|
},
|
137
|
-
"gitHead": "
|
137
|
+
"gitHead": "d18cdb7648bd2003f11278ec7bc8df74edbd31fc"
|
138
138
|
}
|
@@ -19,10 +19,6 @@ const defaultOptions: any = {
|
|
19
19
|
}
|
20
20
|
}
|
21
21
|
|
22
|
-
const cache = new InMemoryCache({
|
23
|
-
addTypename: false
|
24
|
-
})
|
25
|
-
|
26
22
|
/**
|
27
23
|
* GraphqlLocalClient is a utility class for initializing an Apollo Client for a local GraphQL schema.
|
28
24
|
* It provides a static `init` method for setting up the client with a schema and an app context.
|
@@ -42,6 +38,10 @@ export class GraphqlLocalClient {
|
|
42
38
|
* @param {object} app - The application context to be passed in as part of the execution context.
|
43
39
|
*/
|
44
40
|
static init(schema, app) {
|
41
|
+
const cache = new InMemoryCache({
|
42
|
+
addTypename: false
|
43
|
+
})
|
44
|
+
|
45
45
|
GraphqlLocalClient.client = new ApolloClient({
|
46
46
|
defaultOptions,
|
47
47
|
cache,
|
package/server/index.ts
CHANGED
@@ -7,5 +7,7 @@ export * from './pubsub-log-transport'
|
|
7
7
|
export * from './middlewares'
|
8
8
|
export * from './graphql-local-client'
|
9
9
|
export * from './service'
|
10
|
+
|
10
11
|
export * from './typeorm/encrypt-transform'
|
11
12
|
export * from './typeorm/json5-transform'
|
13
|
+
export * from './typeorm/round-transform'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { ValueTransformer } from 'typeorm'
|
2
|
+
|
3
|
+
/**
|
4
|
+
* ValueTransformer object for rounding floating point values.
|
5
|
+
*/
|
6
|
+
export const roundTransformer: ValueTransformer = {
|
7
|
+
/**
|
8
|
+
* Rounds the entity field value before storing it in the database.
|
9
|
+
* @param {number | null} value - Floating point value to round or null
|
10
|
+
* @returns {number | null} - Rounded number or null
|
11
|
+
*/
|
12
|
+
to: (value: number | null) => (value !== null && !isNaN(value) ? Math.round(value * 100) / 100 : null),
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Returns the entity field value as it is without any transformation when reading from the database.
|
16
|
+
* @param {number} value - Number value read from the database
|
17
|
+
* @returns {number} - The number value as is
|
18
|
+
*/
|
19
|
+
from: (value: number) => value
|
20
|
+
}
|