@things-factory/shell 5.0.0-alpha.38 → 5.0.0-alpha.39
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.
@@ -39,6 +39,19 @@ module.exports = {
|
|
39
39
|
* }
|
40
40
|
**/
|
41
41
|
|
42
|
+
/**
|
43
|
+
* Domain Primary Colulumn Configuration
|
44
|
+
* support
|
45
|
+
* Types : "int","int2","int4","int8","integer","tinyint","smallint","mediumint","bigint",'uuid'
|
46
|
+
* Strategy = 'uuid','rowid',"increment","identity"
|
47
|
+
* by defualt use uuid auto generated id
|
48
|
+
* ie.
|
49
|
+
* domainPrimaryOption:{
|
50
|
+
* type:'int8',
|
51
|
+
* strategy:null
|
52
|
+
* }
|
53
|
+
*/
|
54
|
+
|
42
55
|
/*
|
43
56
|
* pubsub configuration
|
44
57
|
* ie.
|
@@ -12,11 +12,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Domain = void 0;
|
13
13
|
const typeorm_1 = require("typeorm");
|
14
14
|
const type_graphql_1 = require("type-graphql");
|
15
|
+
const env_1 = require("@things-factory/env");
|
16
|
+
const numericTypes = ["int", "int2", "int4", "int8", "integer", "tinyint", "smallint", "mediumint", "bigint"];
|
17
|
+
const generatedStrategy = ['uuid', 'rowid', "increment", "identity"];
|
18
|
+
const domainPrimaryOption = env_1.config.get('domainPrimaryOption');
|
19
|
+
const domainPrimaryType = domainPrimaryOption === null || domainPrimaryOption === void 0 ? void 0 : domainPrimaryOption.type;
|
20
|
+
const domainPrimaryStrategy = domainPrimaryOption === null || domainPrimaryOption === void 0 ? void 0 : domainPrimaryOption.strategy;
|
15
21
|
let Domain = class Domain {
|
16
22
|
};
|
17
23
|
__decorate([
|
18
24
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
19
|
-
(0, typeorm_1.
|
25
|
+
(0, typeorm_1.Column)(domainPrimaryOption ?
|
26
|
+
{
|
27
|
+
type: domainPrimaryType,
|
28
|
+
primary: true,
|
29
|
+
transformer: {
|
30
|
+
//from(value: DatabaseType): EntityType
|
31
|
+
from: (value) => {
|
32
|
+
return value;
|
33
|
+
},
|
34
|
+
//to(value: EntityType): DatabaseType
|
35
|
+
to: (value) => {
|
36
|
+
if (!value) {
|
37
|
+
value = 0;
|
38
|
+
}
|
39
|
+
if (numericTypes.indexOf(domainPrimaryType) >= 0) {
|
40
|
+
return parseInt(value);
|
41
|
+
}
|
42
|
+
else {
|
43
|
+
return value;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
},
|
47
|
+
generated: generatedStrategy.indexOf(domainPrimaryStrategy) >= 0 ? domainPrimaryStrategy : false
|
48
|
+
} : {
|
49
|
+
type: 'uuid',
|
50
|
+
primary: true,
|
51
|
+
generated: 'uuid'
|
52
|
+
}),
|
20
53
|
__metadata("design:type", String)
|
21
54
|
], Domain.prototype, "id", void 0);
|
22
55
|
__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../server/service/domain/domain.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
1
|
+
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../server/service/domain/domain.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAmF;AACnF,+CAAoD;AACpD,6CAA4C;AAE5C,MAAM,YAAY,GAAG,CAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,SAAS,EAAC,SAAS,EAAC,UAAU,EAAC,WAAW,EAAC,QAAQ,CAAC,CAAA;AACrG,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAC,OAAO,EAAC,WAAW,EAAC,UAAU,CAAC,CAAA;AACjE,MAAM,mBAAmB,GAAE,YAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;AAC5D,MAAM,iBAAiB,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,IAAI,CAAA;AACnD,MAAM,qBAAqB,G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I,EAAE,CAAC;IACzB,IAAA,0BAAgB,GAAE;8BACR,IAAI;yCAAA;AAIf;IAFC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACzB,IAAA,0BAAgB,GAAE;8BACR,IAAI;yCAAA;AAvGJ,MAAM;IAHlB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,aAAa,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC9E,IAAA,yBAAU,GAAE;GACA,MAAM,CAwGlB;AAxGY,wBAAM"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/shell",
|
3
|
-
"version": "5.0.0-alpha.
|
3
|
+
"version": "5.0.0-alpha.39",
|
4
4
|
"description": "Core module for framework",
|
5
5
|
"bin": {
|
6
6
|
"things-factory": "bin/things-factory",
|
@@ -36,7 +36,7 @@
|
|
36
36
|
"@graphql-tools/schema": "^8.3.2",
|
37
37
|
"@graphql-tools/utils": "^8.6.2",
|
38
38
|
"@hatiolab/koa-webpack": "^6.0.0",
|
39
|
-
"@hatiolab/things-scene": "^3.0.
|
39
|
+
"@hatiolab/things-scene": "^3.0.2",
|
40
40
|
"@koa/cors": "^3.1.0",
|
41
41
|
"@material/mwc-button": "^0.25.3",
|
42
42
|
"@material/mwc-fab": "^0.25.3",
|
@@ -50,10 +50,10 @@
|
|
50
50
|
"@operato/layout": "1.0.0-beta.5",
|
51
51
|
"@operato/shell": "1.0.0-beta.5",
|
52
52
|
"@operato/utils": "1.0.0-beta.5",
|
53
|
-
"@things-factory/ejs-remote": "^5.0.0-alpha.
|
54
|
-
"@things-factory/env": "^5.0.0-alpha.
|
55
|
-
"@things-factory/styles": "^5.0.0-alpha.
|
56
|
-
"@things-factory/utils": "^5.0.0-alpha.
|
53
|
+
"@things-factory/ejs-remote": "^5.0.0-alpha.39",
|
54
|
+
"@things-factory/env": "^5.0.0-alpha.39",
|
55
|
+
"@things-factory/styles": "^5.0.0-alpha.39",
|
56
|
+
"@things-factory/utils": "^5.0.0-alpha.39",
|
57
57
|
"@webcomponents/webcomponentsjs": "^2.6.0",
|
58
58
|
"@webpack-contrib/schema-utils": "^1.0.0-beta.0",
|
59
59
|
"apollo-server-core": "^3.6.4",
|
@@ -108,7 +108,7 @@
|
|
108
108
|
"redux-thunk": "^2.3.0",
|
109
109
|
"regenerator-runtime": "^0.13.2",
|
110
110
|
"reselect": "^4.0.0",
|
111
|
-
"sass": "^1.
|
111
|
+
"sass": "^1.50.1",
|
112
112
|
"scrollbooster": "^3.0.2",
|
113
113
|
"subscriptions-transport-ws": "^0.11.0",
|
114
114
|
"sweetalert2": "^10.9.0",
|
@@ -129,5 +129,5 @@
|
|
129
129
|
"resolutions": {
|
130
130
|
"core-js": "^3.16.0"
|
131
131
|
},
|
132
|
-
"gitHead": "
|
132
|
+
"gitHead": "23e58562a4724f157c3bc492cdedb7e32efee6a1"
|
133
133
|
}
|
@@ -1,12 +1,47 @@
|
|
1
|
-
import { Column, CreateDateColumn, Entity, Index,
|
1
|
+
import { Column, CreateDateColumn, Entity, Index, UpdateDateColumn } from 'typeorm'
|
2
2
|
import { ObjectType, Field, ID } from 'type-graphql'
|
3
|
+
import { config } from '@things-factory/env'
|
4
|
+
|
5
|
+
const numericTypes = ["int","int2","int4","int8","integer","tinyint","smallint","mediumint","bigint"]
|
6
|
+
const generatedStrategy = ['uuid','rowid',"increment","identity"]
|
7
|
+
const domainPrimaryOption =config.get('domainPrimaryOption')
|
8
|
+
const domainPrimaryType = domainPrimaryOption?.type
|
9
|
+
const domainPrimaryStrategy = domainPrimaryOption?.strategy
|
3
10
|
|
4
11
|
@Entity()
|
5
12
|
@Index('ix_domain_0', (domain: Domain) => [domain.subdomain], { unique: true })
|
6
13
|
@ObjectType()
|
7
14
|
export class Domain {
|
8
15
|
@Field(type => ID)
|
9
|
-
@
|
16
|
+
@Column(
|
17
|
+
domainPrimaryOption?
|
18
|
+
{
|
19
|
+
type: domainPrimaryType,
|
20
|
+
primary:true,
|
21
|
+
transformer: {
|
22
|
+
//from(value: DatabaseType): EntityType
|
23
|
+
from: (value) => {
|
24
|
+
return value
|
25
|
+
},
|
26
|
+
//to(value: EntityType): DatabaseType
|
27
|
+
to: (value) => {
|
28
|
+
if(!value){
|
29
|
+
value = 0
|
30
|
+
}
|
31
|
+
if(numericTypes.indexOf(domainPrimaryType)>=0){
|
32
|
+
return parseInt(value)
|
33
|
+
}else{
|
34
|
+
return value
|
35
|
+
}
|
36
|
+
}
|
37
|
+
},
|
38
|
+
generated:generatedStrategy.indexOf(domainPrimaryStrategy)>=0?domainPrimaryStrategy:false
|
39
|
+
}:{
|
40
|
+
type: 'uuid',
|
41
|
+
primary:true,
|
42
|
+
generated:'uuid'
|
43
|
+
}
|
44
|
+
)
|
10
45
|
readonly id: string
|
11
46
|
|
12
47
|
@Field()
|