@things-factory/shell 8.0.2 → 9.0.0-beta.12
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 +0 -1
- package/bin/things-factory-migration +6 -3
- package/client/themes/calendar-theme.css +3 -1
- package/client/themes/index.css +2 -1
- package/dist-server/index.d.ts +12 -12
- package/dist-server/index.js +12 -12
- package/dist-server/index.js.map +1 -1
- package/dist-server/initializers/database.js +4 -10
- package/dist-server/initializers/database.js.map +1 -1
- package/dist-server/initializers/ormconfig.d.ts +2 -0
- package/dist-server/initializers/ormconfig.js +30 -0
- package/dist-server/initializers/ormconfig.js.map +1 -0
- package/dist-server/middlewares/domain-middleware.js +2 -2
- package/dist-server/middlewares/domain-middleware.js.map +1 -1
- package/dist-server/middlewares/index.d.ts +1 -1
- package/dist-server/middlewares/index.js +3 -3
- package/dist-server/middlewares/index.js.map +1 -1
- package/dist-server/migrations/1000000000000-SeedDomain.js +4 -4
- package/dist-server/migrations/1000000000000-SeedDomain.js.map +1 -1
- package/dist-server/migrations/index.js.map +1 -1
- package/dist-server/process-cleaner.d.ts +1 -0
- package/dist-server/process-cleaner.js +92 -0
- package/dist-server/process-cleaner.js.map +1 -0
- package/dist-server/routers/domain-router.js +3 -3
- package/dist-server/routers/domain-router.js.map +1 -1
- package/dist-server/routers/global-router.js +6 -6
- package/dist-server/routers/global-router.js.map +1 -1
- package/dist-server/routers/index.d.ts +3 -3
- package/dist-server/routers/index.js +3 -3
- package/dist-server/routers/index.js.map +1 -1
- package/dist-server/schema.js +5 -4
- package/dist-server/schema.js.map +1 -1
- package/dist-server/server-dev.js +37 -39
- package/dist-server/server-dev.js.map +1 -1
- package/dist-server/server.js +33 -35
- package/dist-server/server.js.map +1 -1
- package/dist-server/service/attribute-set/attribute-set-item-type.js +3 -3
- package/dist-server/service/attribute-set/attribute-set-item-type.js.map +1 -1
- package/dist-server/service/attribute-set/attribute-set-mutation.d.ts +2 -2
- package/dist-server/service/attribute-set/attribute-set-mutation.js +16 -16
- package/dist-server/service/attribute-set/attribute-set-mutation.js.map +1 -1
- package/dist-server/service/attribute-set/attribute-set-query.d.ts +3 -3
- package/dist-server/service/attribute-set/attribute-set-query.js +15 -15
- package/dist-server/service/attribute-set/attribute-set-query.js.map +1 -1
- package/dist-server/service/attribute-set/attribute-set-type.d.ts +2 -2
- package/dist-server/service/attribute-set/attribute-set-type.js +5 -5
- package/dist-server/service/attribute-set/attribute-set-type.js.map +1 -1
- package/dist-server/service/attribute-set/attribute-set.d.ts +1 -1
- package/dist-server/service/attribute-set/attribute-set.js +2 -2
- package/dist-server/service/attribute-set/attribute-set.js.map +1 -1
- package/dist-server/service/attribute-set/index.d.ts +3 -3
- package/dist-server/service/attribute-set/index.js +5 -5
- package/dist-server/service/attribute-set/index.js.map +1 -1
- package/dist-server/service/common-types/index.d.ts +6 -6
- package/dist-server/service/common-types/index.js +6 -6
- package/dist-server/service/common-types/index.js.map +1 -1
- package/dist-server/service/common-types/list-param.js +2 -2
- package/dist-server/service/common-types/list-param.js.map +1 -1
- package/dist-server/service/common-types/log.js +2 -2
- package/dist-server/service/common-types/log.js.map +1 -1
- package/dist-server/service/common-types/scalar-object.d.ts +2 -1
- package/dist-server/service/common-types/scalar-object.js +2 -2
- package/dist-server/service/common-types/scalar-object.js.map +1 -1
- package/dist-server/service/directive-transaction/index.d.ts +1 -1
- package/dist-server/service/directive-transaction/index.js +1 -1
- package/dist-server/service/directive-transaction/index.js.map +1 -1
- package/dist-server/service/directive-transaction/transaction.js +2 -2
- package/dist-server/service/directive-transaction/transaction.js.map +1 -1
- package/dist-server/service/domain/domain-mutation.d.ts +2 -2
- package/dist-server/service/domain/domain-mutation.js +21 -21
- package/dist-server/service/domain/domain-mutation.js.map +1 -1
- package/dist-server/service/domain/domain-query.d.ts +3 -3
- package/dist-server/service/domain/domain-query.js +18 -18
- package/dist-server/service/domain/domain-query.js.map +1 -1
- package/dist-server/service/domain/domain-types.d.ts +2 -2
- package/dist-server/service/domain/domain-types.js +6 -6
- package/dist-server/service/domain/domain-types.js.map +1 -1
- package/dist-server/service/domain/domain.js +3 -3
- package/dist-server/service/domain/domain.js.map +1 -1
- package/dist-server/service/domain/index.d.ts +3 -3
- package/dist-server/service/domain/index.js +5 -5
- package/dist-server/service/domain/index.js.map +1 -1
- package/dist-server/service/index.d.ts +7 -7
- package/dist-server/service/index.js +16 -16
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/subscription-data/data-resolver.d.ts +1 -1
- package/dist-server/service/subscription-data/data-resolver.js +4 -4
- package/dist-server/service/subscription-data/data-resolver.js.map +1 -1
- package/dist-server/service/subscription-data/data-types.d.ts +1 -1
- package/dist-server/service/subscription-data/data-types.js +5 -5
- package/dist-server/service/subscription-data/data-types.js.map +1 -1
- package/dist-server/service/subscription-data/index.d.ts +1 -1
- package/dist-server/service/subscription-data/index.js +2 -2
- package/dist-server/service/subscription-data/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/dist-server/typeorm/encrypt-transform.js +3 -3
- package/dist-server/typeorm/encrypt-transform.js.map +1 -1
- package/dist-server/utils/get-query-builder-from-list-params.d.ts +2 -2
- package/dist-server/utils/get-query-builder-from-list-params.js +5 -5
- package/dist-server/utils/get-query-builder-from-list-params.js.map +1 -1
- package/dist-server/utils/index.d.ts +8 -8
- package/dist-server/utils/index.js +8 -8
- package/dist-server/utils/index.js.map +1 -1
- package/dist-server/utils/list-param-adjuster.d.ts +1 -1
- package/dist-server/utils/list-param-adjuster.js.map +1 -1
- package/dist-server/utils/list-params-converter.d.ts +2 -2
- package/dist-server/utils/list-params-converter.js +2 -2
- package/dist-server/utils/list-params-converter.js.map +1 -1
- package/dist-server/utils/list-query-builder.d.ts +1 -1
- package/dist-server/utils/list-query-builder.js +7 -7
- package/dist-server/utils/list-query-builder.js.map +1 -1
- package/dist-server/utils/publish-progress.js +2 -2
- package/dist-server/utils/publish-progress.js.map +1 -1
- package/package.json +16 -19
- package/views/public/home.html +0 -1
- package/client/hot-client/hot.js +0 -140
- package/client/hot-client/index.js +0 -103
- package/client/hot-client/log.js +0 -44
- package/client/hot-client/socket.js +0 -63
- package/ormconfig.js +0 -31
- package/server/graphql-local-client.ts +0 -59
- package/server/index.ts +0 -13
- package/server/initializers/database.ts +0 -96
- package/server/initializers/naming-strategy.ts +0 -14
- package/server/middlewares/domain-middleware.ts +0 -60
- package/server/middlewares/index.ts +0 -43
- package/server/migrations/1000000000000-SeedDomain.ts +0 -37
- package/server/migrations/index.ts +0 -9
- package/server/pubsub-log-transport.ts +0 -59
- package/server/pubsub.ts +0 -84
- package/server/routers/domain-router.ts +0 -13
- package/server/routers/global-router.ts +0 -76
- package/server/routers/graphql-router.ts +0 -3
- package/server/routers/index.ts +0 -3
- package/server/schema.ts +0 -163
- package/server/server-dev.ts +0 -305
- package/server/server.ts +0 -296
- package/server/service/attribute-set/attribute-set-item-type.ts +0 -65
- package/server/service/attribute-set/attribute-set-mutation.ts +0 -125
- package/server/service/attribute-set/attribute-set-query.ts +0 -36
- package/server/service/attribute-set/attribute-set-type.ts +0 -46
- package/server/service/attribute-set/attribute-set.ts +0 -35
- package/server/service/attribute-set/index.ts +0 -6
- package/server/service/common-types/index.ts +0 -6
- package/server/service/common-types/list-param.ts +0 -61
- package/server/service/common-types/log.ts +0 -17
- package/server/service/common-types/object-ref.ts +0 -13
- package/server/service/common-types/scalar-any.ts +0 -44
- package/server/service/common-types/scalar-date.ts +0 -22
- package/server/service/common-types/scalar-object.ts +0 -15
- package/server/service/directive-transaction/index.ts +0 -1
- package/server/service/directive-transaction/transaction.ts +0 -40
- package/server/service/domain/domain-mutation.ts +0 -120
- package/server/service/domain/domain-query.ts +0 -48
- package/server/service/domain/domain-types.ts +0 -63
- package/server/service/domain/domain.ts +0 -147
- package/server/service/domain/index.ts +0 -6
- package/server/service/index.ts +0 -32
- package/server/service/subscription-data/data-resolver.ts +0 -37
- package/server/service/subscription-data/data-types.ts +0 -16
- package/server/service/subscription-data/index.ts +0 -4
- package/server/typeorm/encrypt-transform.ts +0 -70
- package/server/typeorm/get-data-encryption-key.ts +0 -13
- package/server/typeorm/json5-transform.ts +0 -26
- package/server/typeorm/round-transform.ts +0 -20
- package/server/utils/condition-builder.ts +0 -145
- package/server/utils/get-domain.ts +0 -226
- package/server/utils/get-query-builder-from-list-params.ts +0 -469
- package/server/utils/get-times-for-period.ts +0 -60
- package/server/utils/index.ts +0 -8
- package/server/utils/list-param-adjuster.ts +0 -21
- package/server/utils/list-params-converter.ts +0 -200
- package/server/utils/list-query-builder.ts +0 -120
- package/server/utils/publish-progress.ts +0 -23
@@ -5,14 +5,14 @@ const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
6
6
|
const typeorm_1 = require("typeorm");
|
7
7
|
const utils_1 = require("@things-factory/utils");
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const
|
8
|
+
const database_js_1 = require("../../initializers/database.js");
|
9
|
+
const domain_js_1 = require("./domain.js");
|
10
|
+
const domain_types_js_1 = require("./domain-types.js");
|
11
|
+
const scalar_object_js_1 = require("../common-types/scalar-object.js");
|
12
12
|
let DomainMutation = class DomainMutation {
|
13
13
|
async createDomain(domainInput) {
|
14
14
|
const { name, description } = domainInput;
|
15
|
-
const domainRepo = (0,
|
15
|
+
const domainRepo = (0, database_js_1.getRepository)(domain_js_1.Domain);
|
16
16
|
const subdomain = (0, utils_1.slugger)(name);
|
17
17
|
const domain = await domainRepo.findOneBy({ subdomain });
|
18
18
|
if (domain) {
|
@@ -21,15 +21,15 @@ let DomainMutation = class DomainMutation {
|
|
21
21
|
return await domainRepo.save({ name, description, subdomain });
|
22
22
|
}
|
23
23
|
async deleteDomain(name) {
|
24
|
-
return await (0,
|
24
|
+
return await (0, database_js_1.getRepository)(domain_js_1.Domain).delete({ name });
|
25
25
|
}
|
26
26
|
async deleteDomains(names) {
|
27
|
-
const domains = await (0,
|
27
|
+
const domains = await (0, database_js_1.getRepository)(domain_js_1.Domain).find({ where: { name: (0, typeorm_1.In)(names) } });
|
28
28
|
const domainIds = domains.map(domain => domain.id);
|
29
|
-
await (0,
|
29
|
+
await (0, database_js_1.getRepository)(domain_js_1.Domain).delete({ id: (0, typeorm_1.In)(domainIds) });
|
30
30
|
}
|
31
31
|
async updateDomain(name, patch) {
|
32
|
-
const repository = (0,
|
32
|
+
const repository = (0, database_js_1.getRepository)(domain_js_1.Domain);
|
33
33
|
const domain = await repository.findOneBy({ name });
|
34
34
|
if (patch.parent && patch.parent.id == domain.id) {
|
35
35
|
delete patch.parent;
|
@@ -37,7 +37,7 @@ let DomainMutation = class DomainMutation {
|
|
37
37
|
return await repository.save(Object.assign(Object.assign({}, domain), patch));
|
38
38
|
}
|
39
39
|
async updateDomains(patches) {
|
40
|
-
const domainRepo = (0,
|
40
|
+
const domainRepo = (0, database_js_1.getRepository)(domain_js_1.Domain);
|
41
41
|
const patchIds = patches.filter((patch) => patch.id);
|
42
42
|
if (patchIds.length > 0) {
|
43
43
|
patchIds.forEach(async (updateRecord) => {
|
@@ -55,7 +55,7 @@ let DomainMutation = class DomainMutation {
|
|
55
55
|
}
|
56
56
|
async updateSecureIPList(iplist, context) {
|
57
57
|
const { domain } = context.state;
|
58
|
-
const repository = (0,
|
58
|
+
const repository = (0, database_js_1.getRepository)(domain_js_1.Domain);
|
59
59
|
// const domain: Domain = await repository.findOneBy({ id })
|
60
60
|
const { iplist: result } = await repository.save(Object.assign(Object.assign({}, domain), { iplist }));
|
61
61
|
return result;
|
@@ -65,16 +65,16 @@ exports.DomainMutation = DomainMutation;
|
|
65
65
|
tslib_1.__decorate([
|
66
66
|
(0, type_graphql_1.Directive)('@transaction'),
|
67
67
|
(0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
|
68
|
-
(0, type_graphql_1.Mutation)(returns =>
|
68
|
+
(0, type_graphql_1.Mutation)(returns => domain_js_1.Domain, { description: 'To create domain (Only superuser is granted this privilege.)' }),
|
69
69
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('domainInput')),
|
70
70
|
tslib_1.__metadata("design:type", Function),
|
71
|
-
tslib_1.__metadata("design:paramtypes", [
|
71
|
+
tslib_1.__metadata("design:paramtypes", [domain_types_js_1.DomainPatch]),
|
72
72
|
tslib_1.__metadata("design:returntype", Promise)
|
73
73
|
], DomainMutation.prototype, "createDomain", null);
|
74
74
|
tslib_1.__decorate([
|
75
75
|
(0, type_graphql_1.Directive)('@transaction'),
|
76
76
|
(0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
|
77
|
-
(0, type_graphql_1.Mutation)(returns =>
|
77
|
+
(0, type_graphql_1.Mutation)(returns => domain_js_1.Domain, { description: 'To delete domain (Only superuser is granted this privilege.)' }),
|
78
78
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
|
79
79
|
tslib_1.__metadata("design:type", Function),
|
80
80
|
tslib_1.__metadata("design:paramtypes", [String]),
|
@@ -94,13 +94,13 @@ tslib_1.__decorate([
|
|
94
94
|
tslib_1.__decorate([
|
95
95
|
(0, type_graphql_1.Directive)('@transaction'),
|
96
96
|
(0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
|
97
|
-
(0, type_graphql_1.Mutation)(returns =>
|
97
|
+
(0, type_graphql_1.Mutation)(returns => domain_js_1.Domain, {
|
98
98
|
description: 'To update domain (Only superuser is granted this privilege.)'
|
99
99
|
}),
|
100
100
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
|
101
|
-
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch', () =>
|
101
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch', () => domain_types_js_1.DomainPatch)),
|
102
102
|
tslib_1.__metadata("design:type", Function),
|
103
|
-
tslib_1.__metadata("design:paramtypes", [String,
|
103
|
+
tslib_1.__metadata("design:paramtypes", [String, domain_types_js_1.DomainPatch]),
|
104
104
|
tslib_1.__metadata("design:returntype", Promise)
|
105
105
|
], DomainMutation.prototype, "updateDomain", null);
|
106
106
|
tslib_1.__decorate([
|
@@ -109,7 +109,7 @@ tslib_1.__decorate([
|
|
109
109
|
(0, type_graphql_1.Mutation)(returns => Boolean, {
|
110
110
|
description: 'To update multiple domains (Only superuser is granted this privilege.)'
|
111
111
|
}),
|
112
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', () => [
|
112
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', () => [domain_types_js_1.DomainPatch])),
|
113
113
|
tslib_1.__metadata("design:type", Function),
|
114
114
|
tslib_1.__metadata("design:paramtypes", [Array]),
|
115
115
|
tslib_1.__metadata("design:returntype", Promise)
|
@@ -117,14 +117,14 @@ tslib_1.__decorate([
|
|
117
117
|
tslib_1.__decorate([
|
118
118
|
(0, type_graphql_1.Directive)('@transaction'),
|
119
119
|
(0, type_graphql_1.Directive)('@privilege(category: "security", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
|
120
|
-
(0, type_graphql_1.Mutation)(returns =>
|
121
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('iplist', type =>
|
120
|
+
(0, type_graphql_1.Mutation)(returns => scalar_object_js_1.ScalarObject, { nullable: true, description: 'To update secure IP list for domain' }),
|
121
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('iplist', type => scalar_object_js_1.ScalarObject)),
|
122
122
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
123
123
|
tslib_1.__metadata("design:type", Function),
|
124
124
|
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
125
125
|
tslib_1.__metadata("design:returntype", Promise)
|
126
126
|
], DomainMutation.prototype, "updateSecureIPList", null);
|
127
127
|
exports.DomainMutation = DomainMutation = tslib_1.__decorate([
|
128
|
-
(0, type_graphql_1.Resolver)(
|
128
|
+
(0, type_graphql_1.Resolver)(domain_js_1.Domain)
|
129
129
|
], DomainMutation);
|
130
130
|
//# sourceMappingURL=domain-mutation.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain-mutation.js","sourceRoot":"","sources":["../../../server/service/domain/domain-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAyF;AACzF,qCAAwC;AAExC,iDAA+C;AAE/C,
|
1
|
+
{"version":3,"file":"domain-mutation.js","sourceRoot":"","sources":["../../../server/service/domain/domain-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAyF;AACzF,qCAAwC;AAExC,iDAA+C;AAE/C,gEAA8D;AAE9D,2CAA4C;AAC5C,uDAA+C;AAC/C,uEAA+D;AAGxD,IAAM,cAAc,GAApB,MAAM,cAAc;IAInB,AAAN,KAAK,CAAC,YAAY,CAAqB,WAAwB;QAC7D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,WAAW,CAAA;QACzC,MAAM,UAAU,GAAuB,IAAA,2BAAa,EAAC,kBAAM,CAAC,CAAA;QAC5D,MAAM,SAAS,GAAW,IAAA,eAAO,EAAC,IAAI,CAAC,CAAA;QAEvC,MAAM,MAAM,GAAW,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;QAChE,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;QACzC,CAAC;QAED,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAA;IAChE,CAAC;IAKK,AAAN,KAAK,CAAC,YAAY,CAAc,IAAY;QAC1C,OAAO,MAAM,IAAA,2BAAa,EAAC,kBAAM,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IACrD,CAAC;IAOK,AAAN,KAAK,CAAC,aAAa,CAA+B,KAAe;QAC/D,MAAM,OAAO,GAAa,MAAM,IAAA,2BAAa,EAAC,kBAAM,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,YAAE,EAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA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CAAC,+BAAY,CAAC,CAAA;IACnC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;wDAYP;yBA1GU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,kBAAM,CAAC;GACJ,cAAc,CA2G1B","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, Root } from 'type-graphql'\nimport { In, Repository } from 'typeorm'\n\nimport { slugger } from '@things-factory/utils'\n\nimport { getRepository } from '../../initializers/database.js'\n\nimport { Domain, IPList } from './domain.js'\nimport { DomainPatch } from './domain-types.js'\nimport { ScalarObject } from '../common-types/scalar-object.js'\n\n@Resolver(Domain)\nexport class DomainMutation {\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To create domain (Only superuser is granted this privilege.)' })\n async createDomain(@Arg('domainInput') domainInput: DomainPatch) {\n const { name, description } = domainInput\n const domainRepo: Repository<Domain> = getRepository(Domain)\n const subdomain: string = slugger(name)\n\n const domain: Domain = await domainRepo.findOneBy({ subdomain })\n if (domain) {\n throw new Error('domain is duplicated')\n }\n\n return await domainRepo.save({ name, description, subdomain })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To delete domain (Only superuser is granted this privilege.)' })\n async deleteDomain(@Arg('name') name: string) {\n return await getRepository(Domain).delete({ name })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To delete multiple domains (Only superuser is granted this privilege.)'\n })\n async deleteDomains(@Arg('names', () => [String]) names: string[]) {\n const domains: Domain[] = await getRepository(Domain).find({ where: { name: In(names) } })\n const domainIds: string[] = domains.map(domain => domain.id)\n\n await getRepository(Domain).delete({ id: In(domainIds) })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, {\n description: 'To update domain (Only superuser is granted this privilege.)'\n })\n async updateDomain(@Arg('name') name: string, @Arg('patch', () => DomainPatch) patch: DomainPatch) {\n const repository = getRepository(Domain)\n const domain: Domain = await repository.findOneBy({ name })\n\n if (patch.parent && patch.parent.id == domain.id) {\n delete patch.parent\n }\n\n return await repository.save({\n ...domain,\n ...patch\n } as any)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To update multiple domains (Only superuser is granted this privilege.)'\n })\n async updateDomains(@Arg('patches', () => [DomainPatch]) patches: DomainPatch[]): Promise<boolean> {\n const domainRepo: Repository<Domain> = getRepository(Domain)\n\n const patchIds = patches.filter((patch: any) => patch.id)\n\n if (patchIds.length > 0) {\n patchIds.forEach(async updateRecord => {\n const domain: Domain = await domainRepo.findOne({ where: { id: updateRecord.id } })\n\n if (updateRecord.name) {\n updateRecord.subdomain = slugger(updateRecord.name)\n }\n\n if (updateRecord.parent && updateRecord.parent.id == domain.id) {\n delete updateRecord.parent\n }\n\n await domainRepo.save({\n ...domain,\n ...updateRecord\n } as any)\n })\n }\n\n return true\n }\n\n @Directive('@transaction')\n @Directive(\n '@privilege(category: \"security\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)'\n )\n @Mutation(returns => ScalarObject, { nullable: true, description: 'To update secure IP list for domain' })\n async updateSecureIPList(\n @Arg('iplist', type => ScalarObject) iplist: IPList,\n @Ctx() context: any\n ): Promise<IPList | null> {\n const { domain } = context.state\n const repository = getRepository(Domain)\n // const domain: Domain = await repository.findOneBy({ id })\n\n const { iplist: result } = await repository.save({\n ...domain,\n iplist\n } as any)\n\n return result\n }\n}\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { ListParam } from '../common-types/list-param';
|
2
|
-
import { Domain, IPList } from './domain';
|
3
|
-
import { DomainList } from './domain-types';
|
1
|
+
import { ListParam } from '../common-types/list-param.js';
|
2
|
+
import { Domain, IPList } from './domain.js';
|
3
|
+
import { DomainList } from './domain-types.js';
|
4
4
|
export declare class DomainQuery {
|
5
5
|
domain(id: string, context: any): Promise<Domain>;
|
6
6
|
domains(params: ListParam, context: any): Promise<DomainList>;
|
@@ -3,20 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DomainQuery = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
6
|
-
const
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const
|
6
|
+
const database_js_1 = require("../../initializers/database.js");
|
7
|
+
const get_query_builder_from_list_params_js_1 = require("../../utils/get-query-builder-from-list-params.js");
|
8
|
+
const list_param_js_1 = require("../common-types/list-param.js");
|
9
|
+
const domain_js_1 = require("./domain.js");
|
10
|
+
const domain_types_js_1 = require("./domain-types.js");
|
11
|
+
const scalar_object_js_1 = require("../common-types/scalar-object.js");
|
12
12
|
let DomainQuery = class DomainQuery {
|
13
13
|
async domain(id, context) {
|
14
|
-
const repository = (0,
|
14
|
+
const repository = (0, database_js_1.getRepository)(domain_js_1.Domain);
|
15
15
|
return await repository.findOneBy({ id });
|
16
16
|
}
|
17
17
|
async domains(params, context) {
|
18
|
-
const queryBuilder = await (0,
|
19
|
-
repository: (0,
|
18
|
+
const queryBuilder = await (0, get_query_builder_from_list_params_js_1.getQueryBuilderFromListParams)({
|
19
|
+
repository: (0, database_js_1.getRepository)(domain_js_1.Domain),
|
20
20
|
alias: 'ContactPoint',
|
21
21
|
params,
|
22
22
|
searchables: ['name', 'description', 'subdomain']
|
@@ -29,13 +29,13 @@ let DomainQuery = class DomainQuery {
|
|
29
29
|
return domain.iplist;
|
30
30
|
}
|
31
31
|
async parent(domain) {
|
32
|
-
return domain.parentId && (await (0,
|
32
|
+
return domain.parentId && (await (0, database_js_1.getRepository)(domain_js_1.Domain).findOneBy({ id: domain.parentId }));
|
33
33
|
}
|
34
34
|
};
|
35
35
|
exports.DomainQuery = DomainQuery;
|
36
36
|
tslib_1.__decorate([
|
37
37
|
(0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
|
38
|
-
(0, type_graphql_1.Query)(returns =>
|
38
|
+
(0, type_graphql_1.Query)(returns => domain_js_1.Domain, { description: 'To fetch domain' }),
|
39
39
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
40
40
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
41
41
|
tslib_1.__metadata("design:type", Function),
|
@@ -44,29 +44,29 @@ tslib_1.__decorate([
|
|
44
44
|
], DomainQuery.prototype, "domain", null);
|
45
45
|
tslib_1.__decorate([
|
46
46
|
(0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
|
47
|
-
(0, type_graphql_1.Query)(returns =>
|
48
|
-
tslib_1.__param(0, (0, type_graphql_1.Args)(type =>
|
47
|
+
(0, type_graphql_1.Query)(returns => domain_types_js_1.DomainList, { description: 'To fetch all domains (Only superuser is granted this privilege.)' }),
|
48
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)(type => list_param_js_1.ListParam)),
|
49
49
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
50
50
|
tslib_1.__metadata("design:type", Function),
|
51
|
-
tslib_1.__metadata("design:paramtypes", [
|
51
|
+
tslib_1.__metadata("design:paramtypes", [list_param_js_1.ListParam, Object]),
|
52
52
|
tslib_1.__metadata("design:returntype", Promise)
|
53
53
|
], DomainQuery.prototype, "domains", null);
|
54
54
|
tslib_1.__decorate([
|
55
55
|
(0, type_graphql_1.Directive)('@privilege(category: "security", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
|
56
|
-
(0, type_graphql_1.Query)(returns =>
|
56
|
+
(0, type_graphql_1.Query)(returns => scalar_object_js_1.ScalarObject, { nullable: true, description: 'To fetch domain' }),
|
57
57
|
tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
|
58
58
|
tslib_1.__metadata("design:type", Function),
|
59
59
|
tslib_1.__metadata("design:paramtypes", [Object]),
|
60
60
|
tslib_1.__metadata("design:returntype", Promise)
|
61
61
|
], DomainQuery.prototype, "secureIPList", null);
|
62
62
|
tslib_1.__decorate([
|
63
|
-
(0, type_graphql_1.FieldResolver)(type =>
|
63
|
+
(0, type_graphql_1.FieldResolver)(type => domain_js_1.Domain),
|
64
64
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
65
65
|
tslib_1.__metadata("design:type", Function),
|
66
|
-
tslib_1.__metadata("design:paramtypes", [
|
66
|
+
tslib_1.__metadata("design:paramtypes", [domain_js_1.Domain]),
|
67
67
|
tslib_1.__metadata("design:returntype", Promise)
|
68
68
|
], DomainQuery.prototype, "parent", null);
|
69
69
|
exports.DomainQuery = DomainQuery = tslib_1.__decorate([
|
70
|
-
(0, type_graphql_1.Resolver)(
|
70
|
+
(0, type_graphql_1.Resolver)(domain_js_1.Domain)
|
71
71
|
], DomainQuery);
|
72
72
|
//# sourceMappingURL=domain-query.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain-query.js","sourceRoot":"","sources":["../../../server/service/domain/domain-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwG;
|
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,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IAC3C,CAAC;IAIK,AAAN,KAAK,CAAC,OAAO,CAA0B,MAAiB,EAAS,OAAY;QAC3E,MAAM,YAAY,GAAG,MAAM,IAAA,qEAA6B,EAAC;YACvD,UAAU,EAAE,IAAA,2BAAa,EAAC,kBAAM,CA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AwG,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,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DomainList = exports.DomainPatch = exports.DomainInput = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
6
|
-
const
|
7
|
-
const
|
6
|
+
const domain_js_1 = require("./domain.js");
|
7
|
+
const index_js_1 = require("../common-types/index.js");
|
8
8
|
let DomainInput = class DomainInput {
|
9
9
|
};
|
10
10
|
exports.DomainInput = DomainInput;
|
@@ -51,8 +51,8 @@ tslib_1.__decorate([
|
|
51
51
|
tslib_1.__metadata("design:type", String)
|
52
52
|
], DomainPatch.prototype, "owner", void 0);
|
53
53
|
tslib_1.__decorate([
|
54
|
-
(0, type_graphql_1.Field)(type =>
|
55
|
-
tslib_1.__metadata("design:type",
|
54
|
+
(0, type_graphql_1.Field)(type => index_js_1.ObjectRef, { nullable: true }),
|
55
|
+
tslib_1.__metadata("design:type", index_js_1.ObjectRef)
|
56
56
|
], DomainPatch.prototype, "parent", void 0);
|
57
57
|
tslib_1.__decorate([
|
58
58
|
(0, type_graphql_1.Field)({ nullable: true }),
|
@@ -67,7 +67,7 @@ tslib_1.__decorate([
|
|
67
67
|
tslib_1.__metadata("design:type", String)
|
68
68
|
], DomainPatch.prototype, "contentImage", void 0);
|
69
69
|
tslib_1.__decorate([
|
70
|
-
(0, type_graphql_1.Field)(type =>
|
70
|
+
(0, type_graphql_1.Field)(type => index_js_1.ScalarObject, { nullable: true }),
|
71
71
|
tslib_1.__metadata("design:type", Object)
|
72
72
|
], DomainPatch.prototype, "attributes", void 0);
|
73
73
|
tslib_1.__decorate([
|
@@ -81,7 +81,7 @@ let DomainList = class DomainList {
|
|
81
81
|
};
|
82
82
|
exports.DomainList = DomainList;
|
83
83
|
tslib_1.__decorate([
|
84
|
-
(0, type_graphql_1.Field)(type => [
|
84
|
+
(0, type_graphql_1.Field)(type => [domain_js_1.Domain], { nullable: true }),
|
85
85
|
tslib_1.__metadata("design:type", Array)
|
86
86
|
], DomainList.prototype, "items", void 0);
|
87
87
|
tslib_1.__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain-types.js","sourceRoot":"","sources":["../../../server/service/domain/domain-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,
|
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"]}
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
5
5
|
const typeorm_1 = require("typeorm");
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
7
7
|
const env_1 = require("@things-factory/env");
|
8
|
-
const
|
8
|
+
const scalar_object_js_1 = require("../common-types/scalar-object.js");
|
9
9
|
const numericTypes = ['int', 'int2', 'int4', 'int8', 'integer', 'tinyint', 'smallint', 'mediumint', 'bigint'];
|
10
10
|
const generatedStrategy = ['uuid', 'rowid', 'increment', 'identity'];
|
11
11
|
const domainPrimaryOption = env_1.config.get('domainPrimaryOption');
|
@@ -119,12 +119,12 @@ tslib_1.__decorate([
|
|
119
119
|
], Domain.prototype, "theme", void 0);
|
120
120
|
tslib_1.__decorate([
|
121
121
|
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
122
|
-
(0, type_graphql_1.Field)(type =>
|
122
|
+
(0, type_graphql_1.Field)(type => scalar_object_js_1.ScalarObject, { nullable: true }),
|
123
123
|
tslib_1.__metadata("design:type", Object)
|
124
124
|
], Domain.prototype, "iplist", void 0);
|
125
125
|
tslib_1.__decorate([
|
126
126
|
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
127
|
-
(0, type_graphql_1.Field)(type =>
|
127
|
+
(0, type_graphql_1.Field)(type => scalar_object_js_1.ScalarObject, { nullable: true }),
|
128
128
|
tslib_1.__metadata("design:type", Object)
|
129
129
|
], Domain.prototype, "attributes", void 0);
|
130
130
|
tslib_1.__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../server/service/domain/domain.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAA+D;AAC/D,6CAA4C;AAC5C,
|
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,YAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;AAC7D,MAAM,iBAAiB,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,IAAI,CAAA;AACnD,MAAM,qBAAqB,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,QAAQ,CAAA;AAkBpD,IAAM,MAAM,GAAZ,MAAM,MAAM;CA6GlB,CAAA;AA7GY,wBAAM;AAgCR;IA/BR,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;IACjB,IAAA,gBAAM,EACL,mBAAmB;QACjB,CAAC,CAAC;YACE,IAAI,EAAE,iBAAiB;YACvB,OAAO,EAAE,IAAI;YACb,WAAW,EAAE;gBACX,uCAAuC;gBACvC,IA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ne,\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"]}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Domain } from './domain';
|
2
|
-
import { DomainQuery } from './domain-query';
|
3
|
-
import { DomainMutation } from './domain-mutation';
|
1
|
+
import { Domain } from './domain.js';
|
2
|
+
import { DomainQuery } from './domain-query.js';
|
3
|
+
import { DomainMutation } from './domain-mutation.js';
|
4
4
|
export declare const entities: (typeof Domain)[];
|
5
5
|
export declare const resolvers: (typeof DomainQuery | typeof DomainMutation)[];
|
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.resolvers = exports.entities = void 0;
|
4
|
-
const
|
5
|
-
const
|
6
|
-
const
|
7
|
-
exports.entities = [
|
8
|
-
exports.resolvers = [
|
4
|
+
const domain_js_1 = require("./domain.js");
|
5
|
+
const domain_query_js_1 = require("./domain-query.js");
|
6
|
+
const domain_mutation_js_1 = require("./domain-mutation.js");
|
7
|
+
exports.entities = [domain_js_1.Domain];
|
8
|
+
exports.resolvers = [domain_query_js_1.DomainQuery, domain_mutation_js_1.DomainMutation];
|
9
9
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/domain/index.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/domain/index.ts"],"names":[],"mappings":";;;AAAA,2CAAoC;AACpC,uDAA+C;AAC/C,6DAAqD;AAExC,QAAA,QAAQ,GAAG,CAAC,kBAAM,CAAC,CAAA;AACnB,QAAA,SAAS,GAAG,CAAC,6BAAW,EAAE,mCAAc,CAAC,CAAA","sourcesContent":["import { Domain } from './domain.js'\nimport { DomainQuery } from './domain-query.js'\nimport { DomainMutation } from './domain-mutation.js'\n\nexport const entities = [Domain]\nexport const resolvers = [DomainQuery, DomainMutation]\n"]}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
export * from './common-types';
|
2
|
-
export * from './domain/domain';
|
3
|
-
export * from './domain/domain';
|
4
|
-
export * from './domain/domain-types';
|
5
|
-
export * from './subscription-data/data-types';
|
6
|
-
export declare const entities: (typeof import("./domain/domain").Domain | typeof import("./attribute-set/attribute-set").AttributeSet)[];
|
1
|
+
export * from './common-types/index.js';
|
2
|
+
export * from './domain/domain.js';
|
3
|
+
export * from './domain/domain.js';
|
4
|
+
export * from './domain/domain-types.js';
|
5
|
+
export * from './subscription-data/data-types.js';
|
6
|
+
export declare const entities: (typeof import("./domain/domain.js").Domain | typeof import("./attribute-set/attribute-set.js").AttributeSet)[];
|
7
7
|
export declare const schema: {
|
8
8
|
typeDefs: {
|
9
9
|
transactionDirectiveTypeDefs: import("graphql").DocumentNode;
|
10
10
|
};
|
11
|
-
resolverClasses: (typeof import("./domain/domain-query").DomainQuery | typeof import("./domain/domain-mutation").DomainMutation | typeof import("./attribute-set/attribute-set-query").AttributeSetQuery | typeof import("./attribute-set/attribute-set-mutation").AttributeSetMutation | typeof import("./subscription-data/data-resolver").DataResolver)[];
|
11
|
+
resolverClasses: (typeof import("./domain/domain-query.js").DomainQuery | typeof import("./domain/domain-mutation.js").DomainMutation | typeof import("./attribute-set/attribute-set-query.js").AttributeSetQuery | typeof import("./attribute-set/attribute-set-mutation.js").AttributeSetMutation | typeof import("./subscription-data/data-resolver.js").DataResolver)[];
|
12
12
|
directives: {
|
13
13
|
transaction: (schema: import("graphql").GraphQLSchema) => import("graphql").GraphQLSchema;
|
14
14
|
};
|
@@ -2,33 +2,33 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.schema = exports.entities = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
|
-
const
|
6
|
-
const
|
7
|
-
const
|
8
|
-
const
|
9
|
-
tslib_1.__exportStar(require("./common-types"), exports);
|
10
|
-
tslib_1.__exportStar(require("./domain/domain"), exports);
|
11
|
-
tslib_1.__exportStar(require("./domain/domain"), exports);
|
5
|
+
const index_js_1 = require("./directive-transaction/index.js");
|
6
|
+
const index_js_2 = require("./domain/index.js");
|
7
|
+
const index_js_3 = require("./attribute-set/index.js");
|
8
|
+
const index_js_4 = require("./subscription-data/index.js");
|
9
|
+
tslib_1.__exportStar(require("./common-types/index.js"), exports);
|
10
|
+
tslib_1.__exportStar(require("./domain/domain.js"), exports);
|
11
|
+
tslib_1.__exportStar(require("./domain/domain.js"), exports);
|
12
12
|
/* EXPORT TYPES */
|
13
|
-
tslib_1.__exportStar(require("./domain/domain-types"), exports);
|
14
|
-
tslib_1.__exportStar(require("./subscription-data/data-types"), exports);
|
13
|
+
tslib_1.__exportStar(require("./domain/domain-types.js"), exports);
|
14
|
+
tslib_1.__exportStar(require("./subscription-data/data-types.js"), exports);
|
15
15
|
exports.entities = [
|
16
16
|
/* Entities */
|
17
|
-
...
|
18
|
-
...
|
17
|
+
...index_js_3.entities,
|
18
|
+
...index_js_2.entities
|
19
19
|
];
|
20
20
|
exports.schema = {
|
21
21
|
typeDefs: {
|
22
|
-
transactionDirectiveTypeDefs:
|
22
|
+
transactionDirectiveTypeDefs: index_js_1.transactionDirectiveTypeDefs
|
23
23
|
},
|
24
24
|
resolverClasses: [
|
25
25
|
/* Resolvers */
|
26
|
-
...
|
27
|
-
...
|
28
|
-
...
|
26
|
+
...index_js_3.resolvers,
|
27
|
+
...index_js_2.resolvers,
|
28
|
+
...index_js_4.resolvers
|
29
29
|
],
|
30
30
|
directives: {
|
31
|
-
transaction:
|
31
|
+
transaction: index_js_1.transactionDirectiveResolver
|
32
32
|
}
|
33
33
|
};
|
34
34
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,+DAA6G;AAC7G,gDAA4F;AAC5F,uDAAyG;AACzG,2DAAqF;AAErF,kEAAuC;AACvC,6DAAkC;AAClC,6DAAkC;AAElC,kBAAkB;AAClB,mEAAwC;AACxC,4EAAiD;AAEpC,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,mBAAiB;IACpB,GAAG,mBAAc;CAClB,CAAA;AACY,QAAA,MAAM,GAAG;IACpB,QAAQ,EAAE;QACR,4BAA4B,EAA5B,uCAA4B;KAC7B;IACD,eAAe,EAAE;QACf,eAAe;QACf,GAAG,oBAAkB;QACrB,GAAG,oBAAe;QAClB,GAAG,oBAAyB;KAC7B;IACD,UAAU,EAAE;QACV,WAAW,EAAE,uCAA4B;KAC1C;CACF,CAAA","sourcesContent":["import { transactionDirectiveResolver, transactionDirectiveTypeDefs } from './directive-transaction/index.js'\nimport { entities as DomainEntities, resolvers as DomainResolvers } from './domain/index.js'\nimport { entities as AttributeEntities, resolvers as AttributeResolvers } from './attribute-set/index.js'\nimport { resolvers as SubscriptionDataResolvers } from './subscription-data/index.js'\n\nexport * from './common-types/index.js'\nexport * from './domain/domain.js'\nexport * from './domain/domain.js'\n\n/* EXPORT TYPES */\nexport * from './domain/domain-types.js'\nexport * from './subscription-data/data-types.js'\n\nexport const entities = [\n /* Entities */\n ...AttributeEntities,\n ...DomainEntities\n]\nexport const schema = {\n typeDefs: {\n transactionDirectiveTypeDefs\n },\n resolverClasses: [\n /* Resolvers */\n ...AttributeResolvers,\n ...DomainResolvers,\n ...SubscriptionDataResolvers\n ],\n directives: {\n transaction: transactionDirectiveResolver\n }\n}\n"]}
|
@@ -4,8 +4,8 @@ exports.DataResolver = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const graphql_yoga_1 = require("graphql-yoga");
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const pubsub_js_1 = require("../../pubsub.js");
|
8
|
+
const data_types_js_1 = require("./data-types.js");
|
9
9
|
/* 이 Resolver는 @things-factory/integration-base 에서 Overide 된다. (state-register를 사용하기 위해서) */
|
10
10
|
let DataResolver = class DataResolver {
|
11
11
|
data(payload, tag) {
|
@@ -27,7 +27,7 @@ tslib_1.__decorate([
|
|
27
27
|
if (!((_a = user.domains) === null || _a === void 0 ? void 0 : _a.find(d => d.subdomain === subdomain)) && !process.superUserGranted(domain, user)) {
|
28
28
|
throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`);
|
29
29
|
}
|
30
|
-
return (0, graphql_yoga_1.pipe)(
|
30
|
+
return (0, graphql_yoga_1.pipe)(pubsub_js_1.pubsub.subscribe('data'), (0, graphql_yoga_1.filter)((payload) => {
|
31
31
|
const { domain: pdomain, tag: ptag, data } = payload.data;
|
32
32
|
return tag === ptag && subdomain === (pdomain === null || pdomain === void 0 ? void 0 : pdomain.subdomain);
|
33
33
|
}));
|
@@ -37,7 +37,7 @@ tslib_1.__decorate([
|
|
37
37
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('tag')),
|
38
38
|
tslib_1.__metadata("design:type", Function),
|
39
39
|
tslib_1.__metadata("design:paramtypes", [Object, String]),
|
40
|
-
tslib_1.__metadata("design:returntype",
|
40
|
+
tslib_1.__metadata("design:returntype", data_types_js_1.Data)
|
41
41
|
], DataResolver.prototype, "data", null);
|
42
42
|
exports.DataResolver = DataResolver = tslib_1.__decorate([
|
43
43
|
(0, type_graphql_1.Resolver)()
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"data-resolver.js","sourceRoot":"","sources":["../../../server/service/subscription-data/data-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAA2C;AAC3C,+CAAgE;AAEhE
|
1
|
+
{"version":3,"file":"data-resolver.js","sourceRoot":"","sources":["../../../server/service/subscription-data/data-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAA2C;AAC3C,+CAAgE;AAEhE,+CAAwC;AACxC,mDAAsC;AAEtC,4FAA4F;AAErF,IAAM,YAAY,GAAlB,MAAM,YAAY;IAyBvB,IAAI,CAAS,OAAuB,EAAc,GAAW;QAC3D,OAAO,OAAO,CAAC,IAAI,CAAA;IACrB,CAAC;CACF,CAAA;AA5BY,oCAAY;AAyBvB;IAxBC,IAAA,2BAAY,EAAC;QACZ,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;;YACrC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;YACtC,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;YACpB,MAAM,SAAS,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,CAAA;YAEnC,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;YAC5C,CAAC;YAED,YAAY;YACZ,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAA,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;gBACnG,MAAM,IAAI,KAAK,CAAC,UAAU,SAAS,6BAA6B,IAAI,CAAC,KAAK,IAAI,CAAC,CAAA;YACjF,CAAC;YAED,OAAO,IAAA,mBAAI,EACT,kBAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EACxB,IAAA,qBAAM,EAAC,CAAC,OAAuB,EAAE,EAAE;gBACjC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAA;gBACzD,OAAO,GAAG,KAAK,IAAI,IAAI,SAAS,MAAK,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAA,CAAA;YACzD,CAAC,CAAC,CACH,CAAA;QACH,CAAC;KACF,CAAC;IACI,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAA2B,mBAAA,IAAA,kBAAG,EAAC,KAAK,CAAC,CAAA;;;4CAAe,oBAAI;wCAEnE;uBA3BU,YAAY;IADxB,IAAA,uBAAQ,GAAE;GACE,YAAY,CA4BxB","sourcesContent":["import { filter, pipe } from 'graphql-yoga'\nimport { Arg, Resolver, Root, Subscription } from 'type-graphql'\n\nimport { pubsub } from '../../pubsub.js'\nimport { Data } from './data-types.js'\n\n/* 이 Resolver는 @things-factory/integration-base 에서 Overide 된다. (state-register를 사용하기 위해서) */\n@Resolver()\nexport class DataResolver {\n @Subscription({\n subscribe: ({ args, context, info }) => {\n const { domain, user } = context.state\n const { tag } = args\n const subdomain = domain?.subdomain\n\n if (!domain || !tag) {\n throw new Error('domain and tag required')\n }\n\n //@ts-ignore\n if (!user.domains?.find(d => d.subdomain === subdomain) && !process.superUserGranted(domain, user)) {\n throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`)\n }\n\n return pipe(\n pubsub.subscribe('data'),\n filter((payload: { data: Data }) => {\n const { domain: pdomain, tag: ptag, data } = payload.data\n return tag === ptag && subdomain === pdomain?.subdomain\n })\n )\n }\n })\n data(@Root() payload: { data: Data }, @Arg('tag') tag: string): Data {\n return payload.data\n }\n}\n"]}
|