@things-factory/shell 9.0.0-beta.21 → 9.0.0-beta.8
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/_index.html +1 -0
- package/config/config.development.js +1 -1
- package/config/config.production.js +14 -1
- package/dist-server/middlewares/domain-middleware.js +3 -3
- package/dist-server/middlewares/domain-middleware.js.map +1 -1
- package/dist-server/service/domain/domain-query.d.ts +0 -1
- package/dist-server/service/domain/domain-query.js +0 -12
- package/dist-server/service/domain/domain-query.js.map +1 -1
- package/dist-server/service/domain/domain-types.d.ts +0 -2
- package/dist-server/service/domain/domain-types.js +0 -8
- package/dist-server/service/domain/domain-types.js.map +1 -1
- package/dist-server/service/domain/domain.js +35 -1
- package/dist-server/service/domain/domain.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/dist-server/utils/get-domain.d.ts +10 -3
- package/dist-server/utils/get-domain.js +71 -52
- package/dist-server/utils/get-domain.js.map +1 -1
- package/dist-server/utils/get-query-builder-from-list-params.js.map +1 -1
- package/dist-server/utils/get-times-for-period.d.ts +4 -24
- package/dist-server/utils/get-times-for-period.js +5 -42
- package/dist-server/utils/get-times-for-period.js.map +1 -1
- package/package.json +6 -5
- package/views/public/home.html +1 -0
package/_index.html
CHANGED
@@ -51,6 +51,7 @@
|
|
51
51
|
|
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
|
+
<link href="/node_modules/@material-design-icons/font/index.css" rel="stylesheet" />
|
54
55
|
<link href="/node_modules/material-symbols/index.css" rel="stylesheet" />
|
55
56
|
<link href="/node_modules/@fontsource/roboto/index.css" rel="stylesheet" />
|
56
57
|
<link rel="stylesheet" href="/theme.css" />
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module.exports = {
|
2
|
-
|
2
|
+
domainType: '',
|
3
3
|
port: 3000,
|
4
4
|
subdomainOffset: 2,
|
5
5
|
keepAliveTimeout: 65000,
|
@@ -98,6 +98,19 @@ module.exports = {
|
|
98
98
|
* }
|
99
99
|
**/
|
100
100
|
|
101
|
+
/**
|
102
|
+
* Domain Primary Colulumn Configuration
|
103
|
+
* support
|
104
|
+
* Types : "int","int2","int4","int8","integer","tinyint","smallint","mediumint","bigint",'uuid'
|
105
|
+
* Strategy = 'uuid','rowid',"increment","identity"
|
106
|
+
* by defualt use uuid auto generated id
|
107
|
+
* ie.
|
108
|
+
* domainPrimaryOption:{
|
109
|
+
* type:'int8',
|
110
|
+
* strategy:null
|
111
|
+
* }
|
112
|
+
*/
|
113
|
+
|
101
114
|
/*
|
102
115
|
* pubsub configuration
|
103
116
|
* ie.
|
@@ -8,9 +8,9 @@ async function domainMiddleware(context, next) {
|
|
8
8
|
var { domain } = context.state;
|
9
9
|
if (!domain) {
|
10
10
|
/*
|
11
|
-
* The
|
12
|
-
* For purposes such as API calls, the target
|
13
|
-
* So, we don't check
|
11
|
+
* The domainType should be checked only when signin and checkin.
|
12
|
+
* For purposes such as API calls, the target domainType may be different from the system domainType.
|
13
|
+
* So, we don't check domainType here.
|
14
14
|
*/
|
15
15
|
domain = await (0, get_domain_js_1.getDomainFromURL)(context);
|
16
16
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain-middleware.js","sourceRoot":"","sources":["../../server/middlewares/domain-middleware.ts"],"names":[],"mappings":";;AAGA,4CAwDC;;AA3DD,oEAAkC;AAClC,0DAAyD;AAElD,KAAK,UAAU,gBAAgB,CAAC,OAAY,EAAE,IAAS;IAC5D,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC9B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ;;;;WAIG;QACH,MAAM,GAAG,MAAM,IAAA,gCAAgB,EAAC,OAAO,CAAC,CAAA;IAC1C,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,EAAE,GAAG,oBAAS,CAAC,WAAW,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;YAEF,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAA;YAE9B,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO,CAAC,KAAK,CAAC,oBAAoB,GAAG,UAAU,CAAA;YACjD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;IAE7B,OAAO,IAAI,EAAE,CAAA;AACf,CAAC","sourcesContent":["import requestIp from 'request-ip'\nimport { getDomainFromURL } from '../utils/get-domain.js'\n\nexport async function domainMiddleware(context: any, next: any) {\n var { domain } = context.state\n if (!domain) {\n /*\n * The
|
1
|
+
{"version":3,"file":"domain-middleware.js","sourceRoot":"","sources":["../../server/middlewares/domain-middleware.ts"],"names":[],"mappings":";;AAGA,4CAwDC;;AA3DD,oEAAkC;AAClC,0DAAyD;AAElD,KAAK,UAAU,gBAAgB,CAAC,OAAY,EAAE,IAAS;IAC5D,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC9B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ;;;;WAIG;QACH,MAAM,GAAG,MAAM,IAAA,gCAAgB,EAAC,OAAO,CAAC,CAAA;IAC1C,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,EAAE,GAAG,oBAAS,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAC7C,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,aAAa,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAA;QAEnG,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrD,kBAAkB;YAClB,MAAM,WAAW,GACf,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;gBACxB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oBACpB,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBAClC,CAAC,CAAC,CAAA;YAEJ,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,OAAO,CAAC,MAAM,GAAG,GAAG,CAAA;gBACpB,OAAM;YACR,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,WAAW,GACf,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;gBACxB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oBACpB,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBAClC,CAAC,CAAC,CAAA;YAEJ,IAAI,WAAW,EAAE,CAAC;gBAChB,OAAO,CAAC,MAAM,GAAG,GAAG,CAAA;gBACpB,OAAM;YACR,CAAC;QACH,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7D,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACrC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAClC,CAAC,CAAC,CAAA;YAEF,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAA;YAE9B,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO,CAAC,KAAK,CAAC,oBAAoB,GAAG,UAAU,CAAA;YACjD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;IAE7B,OAAO,IAAI,EAAE,CAAA;AACf,CAAC","sourcesContent":["import requestIp from 'request-ip'\nimport { getDomainFromURL } from '../utils/get-domain.js'\n\nexport async function domainMiddleware(context: any, next: any) {\n var { domain } = context.state\n if (!domain) {\n /*\n * The domainType should be checked only when signin and checkin.\n * For purposes such as API calls, the target domainType may be different from the system domainType.\n * So, we don't check domainType here.\n */\n domain = await getDomainFromURL(context)\n }\n\n if (domain) {\n const ip = requestIp.getClientIp(context.req)\n const { whitelist = [], blacklist = [], protectedlist = [], privileges = [] } = domain.iplist || {}\n\n if (Array.isArray(whitelist) && whitelist.length > 0) {\n /* whitelist 우선 */\n const whitelisted =\n Array.isArray(whitelist) &&\n whitelist.some(item => {\n return new RegExp(item).test(ip)\n })\n\n if (!whitelisted) {\n context.status = 403\n return\n }\n } else {\n const blacklisted =\n Array.isArray(blacklist) &&\n blacklist.some(item => {\n return new RegExp(item).test(ip)\n })\n\n if (blacklisted) {\n context.status = 403\n return\n }\n }\n\n if (Array.isArray(protectedlist) && protectedlist.length > 0) {\n const safe = protectedlist.some(item => {\n return new RegExp(item).test(ip)\n })\n\n context.state.unsafeIP = !safe\n\n if (!safe) {\n context.state.prohibitedPrivileges = privileges\n }\n }\n }\n\n context.state.domain = domain\n\n return next()\n}\n"]}
|
@@ -2,7 +2,6 @@ import { ListParam } from '../common-types/list-param.js';
|
|
2
2
|
import { Domain, IPList } from './domain.js';
|
3
3
|
import { DomainList } from './domain-types.js';
|
4
4
|
export declare class DomainQuery {
|
5
|
-
domainTypes(context: any): Promise<String[]>;
|
6
5
|
domain(id: string, context: any): Promise<Domain>;
|
7
6
|
domains(params: ListParam, context: any): Promise<DomainList>;
|
8
7
|
secureIPList(context: any): Promise<IPList | null>;
|
@@ -9,11 +9,7 @@ const list_param_js_1 = require("../common-types/list-param.js");
|
|
9
9
|
const domain_js_1 = require("./domain.js");
|
10
10
|
const domain_types_js_1 = require("./domain-types.js");
|
11
11
|
const scalar_object_js_1 = require("../common-types/scalar-object.js");
|
12
|
-
const env_1 = require("@things-factory/env");
|
13
12
|
let DomainQuery = class DomainQuery {
|
14
|
-
async domainTypes(context) {
|
15
|
-
return env_1.config.get('domainTypes') || ['domain'];
|
16
|
-
}
|
17
13
|
async domain(id, context) {
|
18
14
|
const repository = (0, database_js_1.getRepository)(domain_js_1.Domain);
|
19
15
|
return await repository.findOneBy({ id });
|
@@ -37,14 +33,6 @@ let DomainQuery = class DomainQuery {
|
|
37
33
|
}
|
38
34
|
};
|
39
35
|
exports.DomainQuery = DomainQuery;
|
40
|
-
tslib_1.__decorate([
|
41
|
-
(0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
|
42
|
-
(0, type_graphql_1.Query)(returns => [String], { description: 'To fetch domain' }),
|
43
|
-
tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
|
44
|
-
tslib_1.__metadata("design:type", Function),
|
45
|
-
tslib_1.__metadata("design:paramtypes", [Object]),
|
46
|
-
tslib_1.__metadata("design:returntype", Promise)
|
47
|
-
], DomainQuery.prototype, "domainTypes", null);
|
48
36
|
tslib_1.__decorate([
|
49
37
|
(0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
|
50
38
|
(0, type_graphql_1.Query)(returns => domain_js_1.Domain, { description: 'To fetch domain' }),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain-query.js","sourceRoot":"","sources":["../../../server/service/domain/domain-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwG;AAExG,gEAA8D;AAC9D,6GAAiG;AAEjG,iEAAyD;AACzD,2CAA4C;AAC5C,uDAA8C;AAC9C,uEAA+D;
|
1
|
+
{"version":3,"file":"domain-query.js","sourceRoot":"","sources":["../../../server/service/domain/domain-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwG;AAExG,gEAA8D;AAC9D,6GAAiG;AAEjG,iEAAyD;AACzD,2CAA4C;AAC5C,uDAA8C;AAC9C,uEAA+D;AAGxD,IAAM,WAAW,GAAjB,MAAM,WAAW;IAGhB,AAAN,KAAK,CAAC,MAAM,CAAY,EAAU,EAAS,OAAY;QACrD,MAAM,UAAU,GAAG,IAAA,2BAAa,EAAC,kBAAM,CAAC,CAAA;QAExC,OAAO,MAAM,UA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AAE,EAAE,WAAW,EAAE,kEAAkE,EAAE,CAAC;IACnG,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,yBAAS,CAAC,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,yBAAS;;0CAWvD;AAIK;IAFL,IAAA,wBAAS,EAAC,wGAAwG,CAAC;IACnH,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,+BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IAC/D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+CAGxB;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAS,kBAAM;;yCAElC;sBAlCU,WAAW;IADvB,IAAA,uBAAQ,EAAC,kBAAM,CAAC;GACJ,WAAW,CAmCvB","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, FieldResolver, Root } from 'type-graphql'\n\nimport { getRepository } from '../../initializers/database.js'\nimport { getQueryBuilderFromListParams } from '../../utils/get-query-builder-from-list-params.js'\n\nimport { ListParam } from '../common-types/list-param.js'\nimport { Domain, IPList } from './domain.js'\nimport { DomainList } from './domain-types.js'\nimport { ScalarObject } from '../common-types/scalar-object.js'\n\n@Resolver(Domain)\nexport class DomainQuery {\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => Domain, { description: 'To fetch domain' })\n async domain(@Arg('id') id: string, @Ctx() context: any): Promise<Domain> {\n const repository = getRepository(Domain)\n\n return await repository.findOneBy({ id })\n }\n\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => DomainList, { description: 'To fetch all domains (Only superuser is granted this privilege.)' })\n async domains(@Args(type => ListParam) params: ListParam, @Ctx() context: any): Promise<DomainList> {\n const queryBuilder = await getQueryBuilderFromListParams({\n repository: getRepository(Domain),\n alias: 'ContactPoint',\n params,\n searchables: ['name', 'description', 'subdomain']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => ScalarObject, { nullable: true, description: 'To fetch domain' })\n async secureIPList(@Ctx() context: any): Promise<IPList | null> {\n const { domain } = context.state\n return domain.iplist\n }\n\n @FieldResolver(type => Domain)\n async parent(@Root() domain: Domain): Promise<Domain> {\n return domain.parentId && (await getRepository(Domain).findOneBy({ id: domain.parentId }))\n }\n}\n"]}
|
@@ -3,7 +3,6 @@ import { ObjectRef } from '../common-types/index.js';
|
|
3
3
|
export declare class DomainInput {
|
4
4
|
name: string;
|
5
5
|
description?: string;
|
6
|
-
extType?: string;
|
7
6
|
}
|
8
7
|
export declare class DomainPatch {
|
9
8
|
id?: string;
|
@@ -17,7 +16,6 @@ export declare class DomainPatch {
|
|
17
16
|
brandName?: string;
|
18
17
|
brandImage?: string;
|
19
18
|
contentImage?: string;
|
20
|
-
extType?: string;
|
21
19
|
attributes?: any;
|
22
20
|
theme?: string;
|
23
21
|
}
|
@@ -16,10 +16,6 @@ tslib_1.__decorate([
|
|
16
16
|
(0, type_graphql_1.Field)({ nullable: true }),
|
17
17
|
tslib_1.__metadata("design:type", String)
|
18
18
|
], DomainInput.prototype, "description", void 0);
|
19
|
-
tslib_1.__decorate([
|
20
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
21
|
-
tslib_1.__metadata("design:type", String)
|
22
|
-
], DomainInput.prototype, "extType", void 0);
|
23
19
|
exports.DomainInput = DomainInput = tslib_1.__decorate([
|
24
20
|
(0, type_graphql_1.InputType)()
|
25
21
|
], DomainInput);
|
@@ -70,10 +66,6 @@ tslib_1.__decorate([
|
|
70
66
|
(0, type_graphql_1.Field)({ nullable: true }),
|
71
67
|
tslib_1.__metadata("design:type", String)
|
72
68
|
], DomainPatch.prototype, "contentImage", void 0);
|
73
|
-
tslib_1.__decorate([
|
74
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
75
|
-
tslib_1.__metadata("design:type", String)
|
76
|
-
], DomainPatch.prototype, "extType", void 0);
|
77
69
|
tslib_1.__decorate([
|
78
70
|
(0, type_graphql_1.Field)(type => index_js_1.ScalarObject, { nullable: true }),
|
79
71
|
tslib_1.__metadata("design:type", Object)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain-types.js","sourceRoot":"","sources":["../../../server/service/domain/domain-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,2CAA4C;AAC5C,uDAAkE;AAG3D,IAAM,WAAW,GAAjB,MAAM,WAAW;
|
1
|
+
{"version":3,"file":"domain-types.js","sourceRoot":"","sources":["../../../server/service/domain/domain-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,2CAA4C;AAC5C,uDAAkE;AAG3D,IAAM,WAAW,GAAjB,MAAM,WAAW;CAMvB,CAAA;AANY,kCAAW;AAEtB;IADC,IAAA,oBAAK,GAAE;;yCACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACN;sBALT,WAAW;IADvB,IAAA,wBAAS,GAAE;GACC,WAAW,CAMvB;AAGM,IAAM,WAAW,GAAjB,MAAM,WAAW;CAuCvB,CAAA;AAvCY,kCAAW;AAEtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCACf;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACb,OAAO;+CAAA;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACR;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACZ;AAGd;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACpC,oBAAS;2CAAA;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACR;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACP;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACL;AAGrB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,uBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CAChC;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACZ;sBAtCH,WAAW;IADvB,IAAA,wBAAS,GAAE;GACC,WAAW,CAuCvB;AAGM,IAAM,UAAU,GAAhB,MAAM,UAAU;CAMtB,CAAA;AANY,gCAAU;AAErB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,kBAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC7B;AAGf;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC1B;qBALF,UAAU;IADtB,IAAA,yBAAU,GAAE;GACA,UAAU,CAMtB","sourcesContent":["import { ObjectType, InputType, Field, Int } from 'type-graphql'\nimport { Domain, IPList } from './domain.js'\nimport { ObjectRef, ScalarObject } from '../common-types/index.js'\n\n@InputType()\nexport class DomainInput {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n}\n\n@InputType()\nexport class DomainPatch {\n @Field({ nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n timezone?: string\n\n @Field({ nullable: true })\n systemFlag?: Boolean\n\n @Field({ nullable: true })\n subdomain?: string\n\n @Field({ nullable: true })\n owner?: string\n\n @Field(type => ObjectRef, { nullable: true })\n parent?: ObjectRef\n\n @Field({ nullable: true })\n brandName?: string\n\n @Field({ nullable: true })\n brandImage?: string\n\n @Field({ nullable: true })\n contentImage?: string\n\n @Field(type => ScalarObject, { nullable: true })\n attributes?: any\n\n @Field({ nullable: true })\n theme?: string\n}\n\n@ObjectType()\nexport class DomainList {\n @Field(type => [Domain], { nullable: true })\n items: Domain[]\n\n @Field(type => Int, { nullable: true })\n total: number\n}\n"]}
|
@@ -4,13 +4,47 @@ exports.Domain = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const typeorm_1 = require("typeorm");
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
7
|
+
const env_1 = require("@things-factory/env");
|
7
8
|
const scalar_object_js_1 = require("../common-types/scalar-object.js");
|
9
|
+
const numericTypes = ['int', 'int2', 'int4', 'int8', 'integer', 'tinyint', 'smallint', 'mediumint', 'bigint'];
|
10
|
+
const generatedStrategy = ['uuid', 'rowid', 'increment', 'identity'];
|
11
|
+
const domainPrimaryOption = env_1.config.get('domainPrimaryOption');
|
12
|
+
const domainPrimaryType = domainPrimaryOption === null || domainPrimaryOption === void 0 ? void 0 : domainPrimaryOption.type;
|
13
|
+
const domainPrimaryStrategy = domainPrimaryOption === null || domainPrimaryOption === void 0 ? void 0 : domainPrimaryOption.strategy;
|
8
14
|
let Domain = class Domain {
|
9
15
|
};
|
10
16
|
exports.Domain = Domain;
|
11
17
|
tslib_1.__decorate([
|
12
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
13
18
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
19
|
+
(0, typeorm_1.Column)(domainPrimaryOption
|
20
|
+
? {
|
21
|
+
type: domainPrimaryType,
|
22
|
+
primary: true,
|
23
|
+
transformer: {
|
24
|
+
//from(value: DatabaseType): EntityType
|
25
|
+
from: value => {
|
26
|
+
return value;
|
27
|
+
},
|
28
|
+
//to(value: EntityType): DatabaseType
|
29
|
+
to: value => {
|
30
|
+
if (!value) {
|
31
|
+
value = 0;
|
32
|
+
}
|
33
|
+
if (numericTypes.indexOf(domainPrimaryType) >= 0) {
|
34
|
+
return parseInt(value);
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
return value;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
},
|
41
|
+
generated: generatedStrategy.indexOf(domainPrimaryStrategy) >= 0 ? domainPrimaryStrategy : false
|
42
|
+
}
|
43
|
+
: {
|
44
|
+
type: 'uuid',
|
45
|
+
primary: true,
|
46
|
+
generated: 'uuid'
|
47
|
+
}),
|
14
48
|
tslib_1.__metadata("design:type", String)
|
15
49
|
], Domain.prototype, "id", void 0);
|
16
50
|
tslib_1.__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,qCAUgB;AAChB,+CAA+D;AAC/D,6CAA4C;AAC5C,uEAA+D;AAE/D,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAA;AAC7G,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC,CAAA;AACpE,MAAM,mBAAmB,GAAG,Y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EAAE,IAAI,EAAE,CAAC;IACzB,IAAA,0BAAgB,GAAE;sCACR,IAAI;yCAAA;AAIf;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,IAAI;yCAAA;iBA5GL,MAAM;IANlB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,aAAa,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE;QAC9E,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,sBAAsB;KAC9B,CAAC;IACD,IAAA,yBAAU,GAAE;GACA,MAAM,CA6GlB","sourcesContent":["import {\n Column,\n CreateDateColumn,\n ManyToOne,\n OneToMany,\n RelationId,\n Entity,\n Index,\n UpdateDateColumn,\n DeleteDateColumn\n} from 'typeorm'\nimport { ObjectType, Directive, Field, ID } from 'type-graphql'\nimport { config } from '@things-factory/env'\nimport { ScalarObject } from '../common-types/scalar-object.js'\n\nconst numericTypes = ['int', 'int2', 'int4', 'int8', 'integer', 'tinyint', 'smallint', 'mediumint', 'bigint']\nconst generatedStrategy = ['uuid', 'rowid', 'increment', 'identity']\nconst domainPrimaryOption = config.get('domainPrimaryOption')\nconst domainPrimaryType = domainPrimaryOption?.type\nconst domainPrimaryStrategy = domainPrimaryOption?.strategy\n\nexport type IPList = {\n whitelist?: string[]\n blacklist?: string[]\n protectedlist?: string[]\n privileges?: {\n category: string\n privilege: string\n }[]\n}\n\n@Entity()\n@Index('ix_domain_0', (domain: Domain) => [domain.subdomain, domain.deletedAt], {\n unique: true,\n where: '\"deleted_at\" IS NULL'\n})\n@ObjectType()\nexport class Domain {\n @Field(type => ID)\n @Column(\n domainPrimaryOption\n ? {\n type: domainPrimaryType,\n primary: true,\n transformer: {\n //from(value: DatabaseType): EntityType\n from: value => {\n return value\n },\n //to(value: EntityType): DatabaseType\n to: value => {\n if (!value) {\n value = 0\n }\n if (numericTypes.indexOf(domainPrimaryType) >= 0) {\n return parseInt(value)\n } else {\n return value\n }\n }\n },\n generated: generatedStrategy.indexOf(domainPrimaryStrategy) >= 0 ? domainPrimaryStrategy : false\n }\n : {\n type: 'uuid',\n primary: true,\n generated: 'uuid'\n }\n )\n readonly id: string\n\n @Field()\n @Column({ unique: true })\n name: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n description: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n extType: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n timezone: string\n\n @Directive('@deprecated(reason: \"Use `parent`\")')\n @Field({ nullable: true })\n @Column({ default: false })\n systemFlag: boolean\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n subdomain: string\n\n @Field({ nullable: true })\n @ManyToOne(type => Domain, { nullable: true })\n parent: Domain\n\n @RelationId((domain: Domain) => domain.parent)\n parentId?: string\n\n @OneToMany(type => Domain, domain => domain.parent)\n @Field(type => Domain, { nullable: true })\n children: Domain[]\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n brandName: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n brandImage: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n contentImage: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n owner: string\n\n @Field({ nullable: true })\n @Column({ nullable: true })\n theme: string\n\n @Column('simple-json', { nullable: true })\n @Field(type => ScalarObject, { nullable: true })\n iplist?: IPList\n\n @Column('simple-json', { nullable: true })\n @Field(type => ScalarObject, { nullable: true })\n attributes?: any\n\n @Field({ nullable: true })\n @CreateDateColumn()\n createdAt: Date\n\n @Field({ nullable: true })\n @UpdateDateColumn()\n updatedAt: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n}\n"]}
|