@things-factory/shell 6.0.107 → 6.0.113
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/service/domain/domain-resolver.d.ts +1 -0
- package/dist-server/service/domain/domain-resolver.js +16 -0
- package/dist-server/service/domain/domain-resolver.js.map +1 -1
- package/dist-server/service/domain/domain-types.d.ts +3 -0
- package/dist-server/service/domain/domain-types.js +8 -0
- package/dist-server/service/domain/domain-types.js.map +1 -1
- package/dist-server/service/domain/domain.d.ts +2 -0
- package/dist-server/service/domain/domain.js +23 -32
- package/dist-server/service/domain/domain.js.map +1 -1
- package/dist-server/service/index.d.ts +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/server/service/domain/domain-resolver.ts +14 -1
- package/server/service/domain/domain-types.ts +7 -1
- package/server/service/domain/domain.ts +20 -32
- package/dist-server/service/attribute/attribute-item-type.d.ts +0 -29
- package/dist-server/service/attribute/attribute-item-type.js +0 -81
- package/dist-server/service/attribute/attribute-item-type.js.map +0 -1
- package/dist-server/service/attribute/attribute-mutation.d.ts +0 -10
- package/dist-server/service/attribute/attribute-mutation.js +0 -130
- package/dist-server/service/attribute/attribute-mutation.js.map +0 -1
- package/dist-server/service/attribute/attribute-query.d.ts +0 -8
- package/dist-server/service/attribute/attribute-query.js +0 -60
- package/dist-server/service/attribute/attribute-query.js.map +0 -1
- package/dist-server/service/attribute/attribute-type.d.ts +0 -19
- package/dist-server/service/attribute/attribute-type.js +0 -70
- package/dist-server/service/attribute/attribute-type.js.map +0 -1
- package/dist-server/service/attribute/attribute.d.ts +0 -9
- package/dist-server/service/attribute/attribute.js +0 -52
- package/dist-server/service/attribute/attribute.js.map +0 -1
- package/dist-server/service/attribute/index.d.ts +0 -5
- package/dist-server/service/attribute/index.js +0 -9
- package/dist-server/service/attribute/index.js.map +0 -1
@@ -56,6 +56,9 @@ let DomainResolver = class DomainResolver {
|
|
56
56
|
async updateDomain(name, patch) {
|
57
57
|
const repository = (0, database_1.getRepository)(domain_1.Domain);
|
58
58
|
const domain = await repository.findOneBy({ name });
|
59
|
+
if (patch.parent && patch.parent.id == domain.id) {
|
60
|
+
delete patch.parent;
|
61
|
+
}
|
59
62
|
return await repository.save(Object.assign(Object.assign({}, domain), patch));
|
60
63
|
}
|
61
64
|
async updateDomains(patches) {
|
@@ -67,11 +70,17 @@ let DomainResolver = class DomainResolver {
|
|
67
70
|
if (updateRecord.name) {
|
68
71
|
updateRecord.subdomain = (0, utils_1.slugger)(updateRecord.name);
|
69
72
|
}
|
73
|
+
if (updateRecord.parent && updateRecord.parent.id == domain.id) {
|
74
|
+
delete updateRecord.parent;
|
75
|
+
}
|
70
76
|
await domainRepo.save(Object.assign(Object.assign({}, domain), updateRecord));
|
71
77
|
});
|
72
78
|
}
|
73
79
|
return true;
|
74
80
|
}
|
81
|
+
async parent(domain) {
|
82
|
+
return domain.parentId && (await (0, database_1.getRepository)(domain_1.Domain).findOneBy({ id: domain.parentId }));
|
83
|
+
}
|
75
84
|
};
|
76
85
|
tslib_1.__decorate([
|
77
86
|
(0, type_graphql_1.Directive)('@privilege(category: "system", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
|
@@ -143,6 +152,13 @@ tslib_1.__decorate([
|
|
143
152
|
tslib_1.__metadata("design:paramtypes", [Array]),
|
144
153
|
tslib_1.__metadata("design:returntype", Promise)
|
145
154
|
], DomainResolver.prototype, "updateDomains", null);
|
155
|
+
tslib_1.__decorate([
|
156
|
+
(0, type_graphql_1.FieldResolver)(type => domain_1.Domain),
|
157
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
158
|
+
tslib_1.__metadata("design:type", Function),
|
159
|
+
tslib_1.__metadata("design:paramtypes", [domain_1.Domain]),
|
160
|
+
tslib_1.__metadata("design:returntype", Promise)
|
161
|
+
], DomainResolver.prototype, "parent", null);
|
146
162
|
DomainResolver = tslib_1.__decorate([
|
147
163
|
(0, type_graphql_1.Resolver)(domain_1.Domain)
|
148
164
|
], DomainResolver);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain-resolver.js","sourceRoot":"","sources":["../../../server/service/domain/domain-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AACnF,qCAAwC;AAExC,iDAA+C;AAE/C,0DAA2D;AAC3D,uGAA8F;AAE9F,2DAAsD;AACtD,qCAAiC;AACjC,iDAAwD;AAGjD,IAAM,cAAc,GAApB,MAAM,cAAc;IAGnB,AAAN,KAAK,CAAC,MAAM,CAAY,EAAU,EAAS,OAAY;QACrD,MAAM,UAAU,GAAG,IAAA,wBAAa,EAAC,eAAM,CAAC,CAAA;QAExC,OAAO,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IAC3C,CAAC;IAIK,AAAN,KAAK,CAAC,OAAO,CAAS,MAAiB,EAAS,OAAY;QAC1D,MAAM,YAAY,GAAG,MAAM,IAAA,kEAA6B,EAAC;YACvD,UAAU,EAAE,IAAA,wBAAa,EAAC,eAAM,CAAC;YACjC,KAAK,EAAE,cAAc;YACrB,MAAM;YACN,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC;SAClD,CAAC,CAAA;QAEF,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,YAAY,CAAC,eAAe,EAAE,CAAA;QAE3D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAED,mFAAmF;IACnF,uDAAuD;IACvD,uEAAuE;IACvE,kDAAkD;IAElD,uFAAuF;IACvF,qBAAqB;IACrB,8CAA8C;IAC9C,MAAM;IAEN,gBAAgB;IAChB,IAAI;IAKE,AAAN,KAAK,CAAC,YAAY,CAAqB,WAAwB;QAC7D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,WAAW,CAAA;QACzC,MAAM,UAAU,GAAuB,IAAA,wBAAa,EAAC,eAAM,CAAC,CAAA;QAC5D,M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C,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;QAC5B,WAAW,EAAE,wEAAwE;KACtF,CAAC;IACmB,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,0BAAW,CAAC,CAAC,CAAA;;;;mDAqBvD;AAjHU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,eAAM,CAAC;GACJ,cAAc,CAkH1B;AAlHY,wCAAc","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver } from 'type-graphql'\nimport { In, Repository } from 'typeorm'\n\nimport { slugger } from '@things-factory/utils'\n\nimport { getRepository } from '../../initializers/database'\nimport { getQueryBuilderFromListParams } from '../../utils/get-query-builder-from-list-params'\n\nimport { ListParam } from '../common-types/list-param'\nimport { Domain } from './domain'\nimport { DomainList, DomainPatch } from './domain-types'\n\n@Resolver(Domain)\nexport class DomainResolver {\n @Directive('@privilege(category: \"system\", privilege: \"query\", domainOwnerGranted: true, 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() 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 // @Query(returns => Boolean, { description: 'To check if given domain is exist' })\n // async checkExistsDomain(@Arg('name') name: string) {\n // const domainRepository: Repository<Domain> = getRepository(Domain)\n // const targetSubdomain: string = slugger(name)\n\n // const oldDomain = await domainRepository.findOneBy({ subdomain: targetSubdomain })\n // if (oldDomain) {\n // throw new Error('domain is duplicated')\n // }\n\n // return true\n // }\n\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 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 await domainRepo.save({\n ...domain,\n ...updateRecord\n } as any)\n })\n }\n\n return true\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"domain-resolver.js","sourceRoot":"","sources":["../../../server/service/domain/domain-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAAwG;AACxG,qCAAwC;AAExC,iDAA+C;AAE/C,0DAA2D;AAC3D,uGAA8F;AAE9F,2DAAsD;AACtD,qCAAiC;AACjC,iDAAwD;AAGjD,IAAM,cAAc,GAApB,MAAM,cAAc;IAGnB,AAAN,KAAK,CAAC,MAAM,CAAY,EAAU,EAAS,OAAY;QACrD,MAAM,UAAU,GAAG,IAAA,wBAAa,EAAC,eAAM,CAAC,CAAA;QAExC,OAAO,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IAC3C,CAAC;IAIK,AAAN,KAAK,CAAC,OAAO,CAAS,MAAiB,EAAS,OAAY;QAC1D,MAAM,YAAY,GAAG,MAAM,IAAA,kEAA6B,EAAC;YACvD,UAAU,EAAE,IAAA,wBAAa,EAAC,eAAM,CAAC;YACjC,KAAK,EAAE,cAAc;YACrB,MAAM;YACN,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC;SAClD,CAAC,CAAA;QAEF,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,YAAY,CAAC,eAAe,EAAE,CAAA;QAE3D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAED,mFAAmF;IACnF,uDAAuD;IACvD,uEAAuE;IACvE,kDAAkD;IAElD,uFAAuF;IACvF,qBAAqB;IACrB,8CAA8C;IAC9C,MAAM;IAEN,gBAAgB;IAChB,IAAI;IAKE,AAAN,KAAK,CAAC,YAAY,CAAqB,WAAwB;QAC7D,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IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;QAC5B,WAAW,EAAE,wEAAwE;KACtF,CAAC;IACmB,mBAAA,IAAA,kBAAG,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;;;;mDAKhD;AAOK;IALL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,eAAM,EAAE;QAC3B,WAAW,EAAE,8DAA8D;KAC5E,CAAC;IACkB,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,0BAAW,CAAC,CAAA;;qDAAQ,0BAAW;;kDAYhG;AAOK;IALL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;QAC5B,WAAW,EAAE,wEAAwE;KACtF,CAAC;IACmB,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,0BAAW,CAAC,CAAC,CAAA;;;;mDAyBvD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,eAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAS,eAAM;;4CAElC;AA9HU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,eAAM,CAAC;GACJ,cAAc,CA+H1B;AA/HY,wCAAc","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, FieldResolver, Root } from 'type-graphql'\nimport { In, Repository } from 'typeorm'\n\nimport { slugger } from '@things-factory/utils'\n\nimport { getRepository } from '../../initializers/database'\nimport { getQueryBuilderFromListParams } from '../../utils/get-query-builder-from-list-params'\n\nimport { ListParam } from '../common-types/list-param'\nimport { Domain } from './domain'\nimport { DomainList, DomainPatch } from './domain-types'\n\n@Resolver(Domain)\nexport class DomainResolver {\n @Directive('@privilege(category: \"system\", privilege: \"query\", domainOwnerGranted: true, 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() 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 // @Query(returns => Boolean, { description: 'To check if given domain is exist' })\n // async checkExistsDomain(@Arg('name') name: string) {\n // const domainRepository: Repository<Domain> = getRepository(Domain)\n // const targetSubdomain: string = slugger(name)\n\n // const oldDomain = await domainRepository.findOneBy({ subdomain: targetSubdomain })\n // if (oldDomain) {\n // throw new Error('domain is duplicated')\n // }\n\n // return true\n // }\n\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 @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"]}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { Domain } from './domain';
|
2
|
+
import { ObjectRef } from '../common-types';
|
2
3
|
export declare class DomainInput {
|
3
4
|
name: string;
|
4
5
|
description?: string;
|
@@ -10,6 +11,8 @@ export declare class DomainPatch {
|
|
10
11
|
timezone?: string;
|
11
12
|
systemFlag?: Boolean;
|
12
13
|
subdomain?: string;
|
14
|
+
owner?: string;
|
15
|
+
parent?: ObjectRef;
|
13
16
|
brandName?: string;
|
14
17
|
brandImage?: string;
|
15
18
|
contentImage?: string;
|
@@ -45,6 +45,14 @@ tslib_1.__decorate([
|
|
45
45
|
(0, type_graphql_1.Field)({ nullable: true }),
|
46
46
|
tslib_1.__metadata("design:type", String)
|
47
47
|
], DomainPatch.prototype, "subdomain", void 0);
|
48
|
+
tslib_1.__decorate([
|
49
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
50
|
+
tslib_1.__metadata("design:type", String)
|
51
|
+
], DomainPatch.prototype, "owner", void 0);
|
52
|
+
tslib_1.__decorate([
|
53
|
+
(0, type_graphql_1.Field)(type => common_types_1.ObjectRef, { nullable: true }),
|
54
|
+
tslib_1.__metadata("design:type", common_types_1.ObjectRef)
|
55
|
+
], DomainPatch.prototype, "parent", void 0);
|
48
56
|
tslib_1.__decorate([
|
49
57
|
(0, type_graphql_1.Field)({ nullable: true }),
|
50
58
|
tslib_1.__metadata("design:type", String)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain-types.js","sourceRoot":"","sources":["../../../server/service/domain/domain-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,qCAAiC;AACjC,
|
1
|
+
{"version":3,"file":"domain-types.js","sourceRoot":"","sources":["../../../server/service/domain/domain-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,qCAAiC;AACjC,kDAAyD;AAGlD,IAAM,WAAW,GAAjB,MAAM,WAAW;CAMvB,CAAA;AALC;IAAC,IAAA,oBAAK,GAAE;;yCACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACN;AALT,WAAW;IADvB,IA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E;GACC,WAAW,CAuCvB;AAvCY,kCAAW;AA0CjB,IAAM,UAAU,GAAhB,MAAM,UAAU;CAMtB,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,eAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC7B;AAEf;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC1B;AALF,UAAU;IADtB,IAAA,yBAAU,GAAE;GACA,UAAU,CAMtB;AANY,gCAAU","sourcesContent":["import { ObjectType, InputType, Field, Int } from 'type-graphql'\nimport { Domain } from './domain'\nimport { ObjectRef, ScalarObject } from '../common-types'\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"]}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
+
var Domain_1;
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
4
|
exports.Domain = void 0;
|
4
5
|
const tslib_1 = require("tslib");
|
@@ -11,7 +12,7 @@ const generatedStrategy = ['uuid', 'rowid', 'increment', 'identity'];
|
|
11
12
|
const domainPrimaryOption = env_1.config.get('domainPrimaryOption');
|
12
13
|
const domainPrimaryType = domainPrimaryOption === null || domainPrimaryOption === void 0 ? void 0 : domainPrimaryOption.type;
|
13
14
|
const domainPrimaryStrategy = domainPrimaryOption === null || domainPrimaryOption === void 0 ? void 0 : domainPrimaryOption.strategy;
|
14
|
-
let Domain = class Domain {
|
15
|
+
let Domain = Domain_1 = class Domain {
|
15
16
|
};
|
16
17
|
tslib_1.__decorate([
|
17
18
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
@@ -48,65 +49,57 @@ tslib_1.__decorate([
|
|
48
49
|
], Domain.prototype, "id", void 0);
|
49
50
|
tslib_1.__decorate([
|
50
51
|
(0, type_graphql_1.Field)(),
|
51
|
-
(0, typeorm_1.Column)({
|
52
|
-
unique: true
|
53
|
-
}),
|
52
|
+
(0, typeorm_1.Column)({ unique: true }),
|
54
53
|
tslib_1.__metadata("design:type", String)
|
55
54
|
], Domain.prototype, "name", void 0);
|
56
55
|
tslib_1.__decorate([
|
57
56
|
(0, type_graphql_1.Field)({ nullable: true }),
|
58
|
-
(0, typeorm_1.Column)({
|
59
|
-
nullable: true
|
60
|
-
}),
|
57
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
61
58
|
tslib_1.__metadata("design:type", String)
|
62
59
|
], Domain.prototype, "description", void 0);
|
63
60
|
tslib_1.__decorate([
|
64
61
|
(0, type_graphql_1.Field)({ nullable: true }),
|
65
|
-
(0, typeorm_1.Column)({
|
66
|
-
nullable: true
|
67
|
-
}),
|
62
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
68
63
|
tslib_1.__metadata("design:type", String)
|
69
64
|
], Domain.prototype, "extType", void 0);
|
70
65
|
tslib_1.__decorate([
|
71
66
|
(0, type_graphql_1.Field)({ nullable: true }),
|
72
|
-
(0, typeorm_1.Column)({
|
73
|
-
nullable: true
|
74
|
-
}),
|
67
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
75
68
|
tslib_1.__metadata("design:type", String)
|
76
69
|
], Domain.prototype, "timezone", void 0);
|
77
70
|
tslib_1.__decorate([
|
71
|
+
(0, type_graphql_1.Directive)('@deprecated(reason: "Use `parent`")'),
|
78
72
|
(0, type_graphql_1.Field)({ nullable: true }),
|
79
|
-
(0, typeorm_1.Column)({
|
80
|
-
default: false
|
81
|
-
}),
|
73
|
+
(0, typeorm_1.Column)({ default: false }),
|
82
74
|
tslib_1.__metadata("design:type", Boolean)
|
83
75
|
], Domain.prototype, "systemFlag", void 0);
|
84
76
|
tslib_1.__decorate([
|
85
77
|
(0, type_graphql_1.Field)({ nullable: true }),
|
86
|
-
(0, typeorm_1.Column)({
|
87
|
-
nullable: true
|
88
|
-
}),
|
78
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
89
79
|
tslib_1.__metadata("design:type", String)
|
90
80
|
], Domain.prototype, "subdomain", void 0);
|
91
81
|
tslib_1.__decorate([
|
92
82
|
(0, type_graphql_1.Field)({ nullable: true }),
|
93
|
-
(0, typeorm_1.
|
94
|
-
|
95
|
-
|
83
|
+
(0, typeorm_1.ManyToOne)(type => Domain_1, { nullable: true }),
|
84
|
+
tslib_1.__metadata("design:type", Domain)
|
85
|
+
], Domain.prototype, "parent", void 0);
|
86
|
+
tslib_1.__decorate([
|
87
|
+
(0, typeorm_1.RelationId)((domain) => domain.parent),
|
88
|
+
tslib_1.__metadata("design:type", String)
|
89
|
+
], Domain.prototype, "parentId", void 0);
|
90
|
+
tslib_1.__decorate([
|
91
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
92
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
96
93
|
tslib_1.__metadata("design:type", String)
|
97
94
|
], Domain.prototype, "brandName", void 0);
|
98
95
|
tslib_1.__decorate([
|
99
96
|
(0, type_graphql_1.Field)({ nullable: true }),
|
100
|
-
(0, typeorm_1.Column)({
|
101
|
-
nullable: true
|
102
|
-
}),
|
97
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
103
98
|
tslib_1.__metadata("design:type", String)
|
104
99
|
], Domain.prototype, "brandImage", void 0);
|
105
100
|
tslib_1.__decorate([
|
106
101
|
(0, type_graphql_1.Field)({ nullable: true }),
|
107
|
-
(0, typeorm_1.Column)({
|
108
|
-
nullable: true
|
109
|
-
}),
|
102
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
110
103
|
tslib_1.__metadata("design:type", String)
|
111
104
|
], Domain.prototype, "contentImage", void 0);
|
112
105
|
tslib_1.__decorate([
|
@@ -116,9 +109,7 @@ tslib_1.__decorate([
|
|
116
109
|
], Domain.prototype, "owner", void 0);
|
117
110
|
tslib_1.__decorate([
|
118
111
|
(0, type_graphql_1.Field)({ nullable: true }),
|
119
|
-
(0, typeorm_1.Column)({
|
120
|
-
nullable: true
|
121
|
-
}),
|
112
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
122
113
|
tslib_1.__metadata("design:type", String)
|
123
114
|
], Domain.prototype, "theme", void 0);
|
124
115
|
tslib_1.__decorate([
|
@@ -136,7 +127,7 @@ tslib_1.__decorate([
|
|
136
127
|
(0, typeorm_1.UpdateDateColumn)(),
|
137
128
|
tslib_1.__metadata("design:type", Date)
|
138
129
|
], Domain.prototype, "updatedAt", void 0);
|
139
|
-
Domain = tslib_1.__decorate([
|
130
|
+
Domain = Domain_1 = tslib_1.__decorate([
|
140
131
|
(0, typeorm_1.Entity)(),
|
141
132
|
(0, typeorm_1.Index)('ix_domain_0', (domain) => [domain.subdomain], { unique: true }),
|
142
133
|
(0, type_graphql_1.ObjectType)()
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../server/service/domain/domain.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../server/service/domain/domain.ts"],"names":[],"mappings":";;;;;AAAA,qCAA0G;AAC1G,+CAA+D;AAC/D,6CAA4C;AAC5C,kDAA8C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,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC9E,IAAA,yBAAU,GAAE;GACA,MAAM,CAiGlB;AAjGY,wBAAM","sourcesContent":["import { Column, CreateDateColumn, ManyToOne, RelationId, Entity, Index, UpdateDateColumn } from 'typeorm'\nimport { ObjectType, Directive, Field, ID } from 'type-graphql'\nimport { config } from '@things-factory/env'\nimport { ScalarObject } from '../common-types'\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\n@Entity()\n@Index('ix_domain_0', (domain: Domain) => [domain.subdomain], { unique: true })\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 @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 attributes?: any\n\n @Field({ nullable: true })\n @CreateDateColumn()\n createdAt: Date\n\n @Field({ nullable: true })\n @UpdateDateColumn()\n updatedAt: Date\n}\n"]}
|
@@ -8,7 +8,7 @@ export declare const schema: {
|
|
8
8
|
typeDefs: {
|
9
9
|
transactionDirectiveTypeDefs: import("graphql").DocumentNode;
|
10
10
|
};
|
11
|
-
resolverClasses: (typeof import("./
|
11
|
+
resolverClasses: (typeof import("./attribute-set/attribute-set-query").AttributeSetQuery | typeof import("./attribute-set/attribute-set-mutation").AttributeSetMutation | typeof import("./domain/domain-resolver").DomainResolver | typeof import("./subscription-data/data-resolver").DataResolver)[];
|
12
12
|
directives: {
|
13
13
|
transaction: (schema: import("graphql").GraphQLSchema) => import("graphql").GraphQLSchema;
|
14
14
|
};
|