@things-factory/routing-base 5.0.0-alpha.52 → 5.0.0-alpha.56
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/operation/operation-query.js +7 -2
- package/dist-server/service/operation/operation-query.js.map +1 -1
- package/dist-server/service/routing/routing-query.js +7 -2
- package/dist-server/service/routing/routing-query.js.map +1 -1
- package/dist-server/service/routing-item/routing-item-query.js +33 -17
- package/dist-server/service/routing-item/routing-item-query.js.map +1 -1
- package/package.json +5 -5
- package/server/service/operation/operation-query.ts +9 -3
- package/server/service/routing/routing-query.ts +9 -3
- package/server/service/routing-item/routing-item-query.ts +25 -16
|
@@ -30,8 +30,13 @@ let OperationQuery = class OperationQuery {
|
|
|
30
30
|
}
|
|
31
31
|
async operations(params, context) {
|
|
32
32
|
const { domain } = context.state;
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
34
|
+
repository: (0, typeorm_1.getRepository)(operation_1.Operation),
|
|
35
|
+
params,
|
|
36
|
+
domain,
|
|
37
|
+
searchables: ['name', 'description']
|
|
38
|
+
});
|
|
39
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
|
35
40
|
return { items, total };
|
|
36
41
|
}
|
|
37
42
|
async domain(operation) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-query.js","sourceRoot":"","sources":["../../../server/service/operation/operation-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAAmF;AACnF,qCAAuC;AAEvC,qEAA4D;AAC5D,yDAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"operation-query.js","sourceRoot":"","sources":["../../../server/service/operation/operation-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAAmF;AACnF,qCAAuC;AAEvC,qEAA4D;AAC5D,yDAAgD;AAChD,iDAAwF;AAExF,2CAAuC;AACvC,qDAAgD;AA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,IAAA,uBAAQ,EAAC,qBAAS,CAAC;GACP,cAAc,CAoD1B;AApDY,wCAAc"}
|
|
@@ -30,8 +30,13 @@ let RoutingQuery = class RoutingQuery {
|
|
|
30
30
|
}
|
|
31
31
|
async routings(params, context) {
|
|
32
32
|
const { domain } = context.state;
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
34
|
+
repository: (0, typeorm_1.getRepository)(routing_1.Routing),
|
|
35
|
+
params,
|
|
36
|
+
domain,
|
|
37
|
+
searchables: ['name']
|
|
38
|
+
});
|
|
39
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
|
35
40
|
return { items, total };
|
|
36
41
|
}
|
|
37
42
|
async domain(routing) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing-query.js","sourceRoot":"","sources":["../../../server/service/routing/routing-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAAmF;AACnF,qCAAuC;AAEvC,yDAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"routing-query.js","sourceRoot":"","sources":["../../../server/service/routing/routing-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAAmF;AACnF,qCAAuC;AAEvC,yDAAgD;AAChD,iDAAwF;AAExF,sDAAkD;AAClD,uCAAmC;AACnC,iDAA4C;AAG5C,IAAa,YAAY,GAAzB,MAAa,YAAY;IAEvB,KAAK,CAAC,OAAO,CAAY,EAAU,EAAS,OAAY;QACtD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,uBAAa,EAAC,iBAAO,CAAC,CAAC,OAAO,CAAC;YAC1C,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACxB,CAAC,CAAA;IACJ,CAAC;IAGD,KAAK,CAAC,QAAQ,CAAS,MAAiB,EAAS,OAAY;QAC3D,MAAM,EAAE,MAAM,EAA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AC,qBAAS,CAAC,CAAC,KAAK,CACpD;;;;;;;;;;;;;gCAa4B,SAAS;;;;;;;;;sCASH,SAAS;;;;;;;;;4CASH,SAAS;;8CAEP,WAAW;;;;OAIlD,CACJ,CAAA;IAED,OAAO,SAAS,CAAA;AAClB,CAAC;AA3CD,sCA2CC;AAEM,KAAK,UAAU,aAAa,CAAC,SAAiB,EAAE,OAAY;IACjE,MAAM,SAAS,GAAG,MAAM,IAAA,uBAAa,EAAC,qBAAS,CAAC,CAAC,KAAK,CACpD;;;;;;;;;;;;;gCAa4B,SAAS;;;;;;;;;sCASH,SAAS;;;OAGxC,CACJ,CAAA;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AA9BD,sCA8BC"}
|
|
@@ -18,22 +18,32 @@ const type_graphql_1 = require("type-graphql");
|
|
|
18
18
|
const typeorm_1 = require("typeorm");
|
|
19
19
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
20
20
|
const shell_1 = require("@things-factory/shell");
|
|
21
|
+
const operation_1 = require("../operation/operation");
|
|
22
|
+
const routing_1 = require("../routing/routing");
|
|
21
23
|
const routing_item_1 = require("./routing-item");
|
|
22
24
|
const routing_item_type_1 = require("./routing-item-type");
|
|
23
25
|
let RoutingItemQuery = class RoutingItemQuery {
|
|
24
|
-
async routingItem(routing, context) {
|
|
25
|
-
const { domain } = context.state;
|
|
26
|
-
return await (0, typeorm_1.getRepository)(routing_item_1.RoutingItem).findOne({
|
|
27
|
-
relations: ['routing'],
|
|
28
|
-
where: { domain, routing }
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
26
|
async routingItems(params, context) {
|
|
32
27
|
const { domain } = context.state;
|
|
33
|
-
const
|
|
34
|
-
|
|
28
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
29
|
+
repository: (0, typeorm_1.getRepository)(routing_item_1.RoutingItem),
|
|
30
|
+
params,
|
|
31
|
+
domain,
|
|
32
|
+
alias: 'ri',
|
|
33
|
+
searchables: ['name', 'description']
|
|
34
|
+
});
|
|
35
|
+
const [items, total] = await queryBuilder
|
|
36
|
+
.leftJoinAndSelect('ri.routing', 'routing')
|
|
37
|
+
.leftJoinAndSelect('ri.operation', 'operation')
|
|
38
|
+
.getManyAndCount();
|
|
35
39
|
return { items, total };
|
|
36
40
|
}
|
|
41
|
+
async routing(routingItem) {
|
|
42
|
+
return routingItem.routing || (await (0, typeorm_1.getRepository)(routing_1.Routing).findOne(routingItem.routingId));
|
|
43
|
+
}
|
|
44
|
+
async operation(routingItem) {
|
|
45
|
+
return routingItem.operation || (await (0, typeorm_1.getRepository)(operation_1.Operation).findOne(routingItem.operationId));
|
|
46
|
+
}
|
|
37
47
|
async domain(routingItem) {
|
|
38
48
|
return await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(routingItem.domainId);
|
|
39
49
|
}
|
|
@@ -44,14 +54,6 @@ let RoutingItemQuery = class RoutingItemQuery {
|
|
|
44
54
|
return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(routingItem.creatorId);
|
|
45
55
|
}
|
|
46
56
|
};
|
|
47
|
-
__decorate([
|
|
48
|
-
(0, type_graphql_1.Query)(returns => routing_item_1.RoutingItem, { description: 'To fetch a RoutingItem' }),
|
|
49
|
-
__param(0, (0, type_graphql_1.Arg)('routing')),
|
|
50
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
51
|
-
__metadata("design:type", Function),
|
|
52
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
53
|
-
__metadata("design:returntype", Promise)
|
|
54
|
-
], RoutingItemQuery.prototype, "routingItem", null);
|
|
55
57
|
__decorate([
|
|
56
58
|
(0, type_graphql_1.Query)(returns => routing_item_type_1.RoutingItemList, { description: 'To fetch multiple RoutingItems' }),
|
|
57
59
|
__param(0, (0, type_graphql_1.Args)()),
|
|
@@ -60,6 +62,20 @@ __decorate([
|
|
|
60
62
|
__metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
|
|
61
63
|
__metadata("design:returntype", Promise)
|
|
62
64
|
], RoutingItemQuery.prototype, "routingItems", null);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, type_graphql_1.FieldResolver)(type => routing_1.Routing),
|
|
67
|
+
__param(0, (0, type_graphql_1.Root)()),
|
|
68
|
+
__metadata("design:type", Function),
|
|
69
|
+
__metadata("design:paramtypes", [routing_item_1.RoutingItem]),
|
|
70
|
+
__metadata("design:returntype", Promise)
|
|
71
|
+
], RoutingItemQuery.prototype, "routing", null);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, type_graphql_1.FieldResolver)(type => routing_1.Routing),
|
|
74
|
+
__param(0, (0, type_graphql_1.Root)()),
|
|
75
|
+
__metadata("design:type", Function),
|
|
76
|
+
__metadata("design:paramtypes", [routing_item_1.RoutingItem]),
|
|
77
|
+
__metadata("design:returntype", Promise)
|
|
78
|
+
], RoutingItemQuery.prototype, "operation", null);
|
|
63
79
|
__decorate([
|
|
64
80
|
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
65
81
|
__param(0, (0, type_graphql_1.Root)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing-item-query.js","sourceRoot":"","sources":["../../../server/service/routing-item/routing-item-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"routing-item-query.js","sourceRoot":"","sources":["../../../server/service/routing-item/routing-item-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA8E;AAC9E,qCAAuC;AAEvC,yDAAgD;AAChD,iDAAwF;AAExF,sDAAkD;AAClD,gDAA4C;AAC5C,iDAA4C;AAC5C,2DAAqD;AAGrD,IAAa,gBAAgB,GAA7B,MAAa,gBAAgB;IAE3B,KAAK,CAAC,YAAY,CAAS,MAAiB,EAAS,OAAY;QAC/D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YA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AA;IACjE,CAAC;CACF,CAAA;AA3CC;IADC,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,mCAAe,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IACjE,WAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,WAAA,IAAA,kBAAG,GAAE,CAAA;;yDAAjB,iBAAS,oBAAT,iBAAS;;oDAiB3C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAO,CAAC;IAChB,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAc,0BAAW;;+CAE7C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAO,CAAC;IACd,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAc,0BAAW;;iDAE/C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAc,0BAAW;;8CAE5C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAc,0BAAW;;+CAE7C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAc,0BAAW;;+CAE7C;AA5CU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,gBAAgB,CA6C5B;AA7CY,4CAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/routing-base",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.56",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@things-factory/attachment-base": "^5.0.0-alpha.
|
|
28
|
-
"@things-factory/auth-base": "^5.0.0-alpha.
|
|
29
|
-
"@things-factory/shell": "^5.0.0-alpha.
|
|
27
|
+
"@things-factory/attachment-base": "^5.0.0-alpha.56",
|
|
28
|
+
"@things-factory/auth-base": "^5.0.0-alpha.56",
|
|
29
|
+
"@things-factory/shell": "^5.0.0-alpha.56"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "105413a014a3cacefc97550b8f23e46789465219"
|
|
32
32
|
}
|
|
@@ -3,7 +3,7 @@ import { getRepository } from 'typeorm'
|
|
|
3
3
|
|
|
4
4
|
import { Attachment } from '@things-factory/attachment-base'
|
|
5
5
|
import { User } from '@things-factory/auth-base'
|
|
6
|
-
import {
|
|
6
|
+
import { Domain, getQueryBuilderFromListParams, ListParam } from '@things-factory/shell'
|
|
7
7
|
|
|
8
8
|
import { Operation } from './operation'
|
|
9
9
|
import { OperationList } from './operation-type'
|
|
@@ -23,8 +23,14 @@ export class OperationQuery {
|
|
|
23
23
|
async operations(@Args() params: ListParam, @Ctx() context: any): Promise<OperationList> {
|
|
24
24
|
const { domain } = context.state
|
|
25
25
|
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
|
27
|
+
repository: getRepository(Operation),
|
|
28
|
+
params,
|
|
29
|
+
domain,
|
|
30
|
+
searchables: ['name', 'description']
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const [items, total] = await queryBuilder.getManyAndCount()
|
|
28
34
|
|
|
29
35
|
return { items, total }
|
|
30
36
|
}
|
|
@@ -2,7 +2,7 @@ import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graph
|
|
|
2
2
|
import { getRepository } from 'typeorm'
|
|
3
3
|
|
|
4
4
|
import { User } from '@things-factory/auth-base'
|
|
5
|
-
import {
|
|
5
|
+
import { Domain, getQueryBuilderFromListParams, ListParam } from '@things-factory/shell'
|
|
6
6
|
|
|
7
7
|
import { Operation } from '../operation/operation'
|
|
8
8
|
import { Routing } from './routing'
|
|
@@ -23,8 +23,14 @@ export class RoutingQuery {
|
|
|
23
23
|
async routings(@Args() params: ListParam, @Ctx() context: any): Promise<RoutingList> {
|
|
24
24
|
const { domain } = context.state
|
|
25
25
|
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
|
27
|
+
repository: getRepository(Routing),
|
|
28
|
+
params,
|
|
29
|
+
domain,
|
|
30
|
+
searchables: ['name']
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const [items, total] = await queryBuilder.getManyAndCount()
|
|
28
34
|
|
|
29
35
|
return { items, total }
|
|
30
36
|
}
|
|
@@ -1,37 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
|
|
2
2
|
import { getRepository } from 'typeorm'
|
|
3
3
|
|
|
4
4
|
import { User } from '@things-factory/auth-base'
|
|
5
|
-
import {
|
|
5
|
+
import { Domain, getQueryBuilderFromListParams, ListParam } from '@things-factory/shell'
|
|
6
6
|
|
|
7
|
+
import { Operation } from '../operation/operation'
|
|
8
|
+
import { Routing } from '../routing/routing'
|
|
7
9
|
import { RoutingItem } from './routing-item'
|
|
8
10
|
import { RoutingItemList } from './routing-item-type'
|
|
9
11
|
|
|
10
12
|
@Resolver(RoutingItem)
|
|
11
13
|
export class RoutingItemQuery {
|
|
12
|
-
@Query(returns => RoutingItem, { description: 'To fetch a RoutingItem' })
|
|
13
|
-
async routingItem(@Arg('routing') routing: string, @Ctx() context: any): Promise<RoutingItem> {
|
|
14
|
-
const { domain } = context.state
|
|
15
|
-
|
|
16
|
-
return await getRepository(RoutingItem).findOne({
|
|
17
|
-
relations: ['routing'],
|
|
18
|
-
where: { domain, routing }
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
14
|
@Query(returns => RoutingItemList, { description: 'To fetch multiple RoutingItems' })
|
|
23
15
|
async routingItems(@Args() params: ListParam, @Ctx() context: any): Promise<RoutingItemList> {
|
|
24
16
|
const { domain } = context.state
|
|
25
17
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
|
19
|
+
repository: getRepository(RoutingItem),
|
|
20
|
+
params,
|
|
21
|
+
domain,
|
|
22
|
+
alias: 'ri',
|
|
23
|
+
searchables: ['name', 'description']
|
|
30
24
|
})
|
|
31
25
|
|
|
26
|
+
const [items, total] = await queryBuilder
|
|
27
|
+
.leftJoinAndSelect('ri.routing', 'routing')
|
|
28
|
+
.leftJoinAndSelect('ri.operation', 'operation')
|
|
29
|
+
.getManyAndCount()
|
|
30
|
+
|
|
32
31
|
return { items, total }
|
|
33
32
|
}
|
|
34
33
|
|
|
34
|
+
@FieldResolver(type => Routing)
|
|
35
|
+
async routing(@Root() routingItem: RoutingItem): Promise<Domain> {
|
|
36
|
+
return routingItem.routing || (await getRepository(Routing).findOne(routingItem.routingId))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@FieldResolver(type => Routing)
|
|
40
|
+
async operation(@Root() routingItem: RoutingItem): Promise<Domain> {
|
|
41
|
+
return routingItem.operation || (await getRepository(Operation).findOne(routingItem.operationId))
|
|
42
|
+
}
|
|
43
|
+
|
|
35
44
|
@FieldResolver(type => Domain)
|
|
36
45
|
async domain(@Root() routingItem: RoutingItem): Promise<Domain> {
|
|
37
46
|
return await getRepository(Domain).findOne(routingItem.domainId)
|