@things-factory/process 7.0.0-alpha.0 → 7.0.0-alpha.10
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/client/pages/process/process-list-page.ts +1 -1
- package/dist-client/pages/process/process-list-page.js +1 -1
- package/dist-client/pages/process/process-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/process-instance/process-instance-subscription.js +6 -11
- package/dist-server/service/process-instance/process-instance-subscription.js.map +1 -1
- package/dist-server/service/process-thread/process-thread-subscription.js +6 -5
- package/dist-server/service/process-thread/process-thread-subscription.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/server/service/process-instance/process-instance-subscription.ts +9 -15
- package/server/service/process-thread/process-thread-subscription.ts +9 -8
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProcessInstanceSubscription = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const graphql_yoga_1 = require("graphql-yoga");
|
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
|
7
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
7
|
const shell_1 = require("@things-factory/shell");
|
|
8
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
9
|
const process_instance_1 = require("./process-instance");
|
|
10
10
|
let ProcessInstanceSubscription = class ProcessInstanceSubscription {
|
|
11
11
|
processInstance(payload) {
|
|
@@ -14,7 +14,7 @@ let ProcessInstanceSubscription = class ProcessInstanceSubscription {
|
|
|
14
14
|
};
|
|
15
15
|
tslib_1.__decorate([
|
|
16
16
|
(0, type_graphql_1.Subscription)({
|
|
17
|
-
subscribe: (
|
|
17
|
+
subscribe: ({ args, context, info }) => {
|
|
18
18
|
var _a;
|
|
19
19
|
const { domain, user } = context.state;
|
|
20
20
|
const subdomain = domain === null || domain === void 0 ? void 0 : domain.subdomain;
|
|
@@ -24,7 +24,7 @@ tslib_1.__decorate([
|
|
|
24
24
|
if (!((_a = user.domains) === null || _a === void 0 ? void 0 : _a.find(d => d.subdomain === subdomain)) && !process.superUserGranted(domain, user)) {
|
|
25
25
|
throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`);
|
|
26
26
|
}
|
|
27
|
-
return (0,
|
|
27
|
+
return (0, graphql_yoga_1.pipe)(shell_1.pubsub.subscribe('process-instance'), (0, graphql_yoga_1.filter)(async (payload) => {
|
|
28
28
|
const { processInstance } = payload;
|
|
29
29
|
const { domainId } = processInstance;
|
|
30
30
|
if (domainId !== (domain === null || domain === void 0 ? void 0 : domain.id)) {
|
|
@@ -33,13 +33,8 @@ tslib_1.__decorate([
|
|
|
33
33
|
if (processInstance.creatorId === user.id) {
|
|
34
34
|
return true;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
where: { id: user.id },
|
|
39
|
-
relations: ['roles']
|
|
40
|
-
});
|
|
41
|
-
return !!userWithRoles.roles.find(role => role.id === processInstance.assigneeRoleId);
|
|
42
|
-
})(_, args, context, info);
|
|
36
|
+
return await auth_base_1.User.hasPrivilege('query', 'process-instance', domain, user);
|
|
37
|
+
}));
|
|
43
38
|
}
|
|
44
39
|
}),
|
|
45
40
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-instance-subscription.js","sourceRoot":"","sources":["../../../server/service/process-instance/process-instance-subscription.ts"],"names":[],"mappings":";;;;AAAA
|
|
1
|
+
{"version":3,"file":"process-instance-subscription.js","sourceRoot":"","sources":["../../../server/service/process-instance/process-instance-subscription.ts"],"names":[],"mappings":";;;;AAAA,+CAA2C;AAC3C,+CAA2D;AAE3D,iDAA8C;AAC9C,yDAAgD;AAEhD,yDAAoD;AAG7C,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAiCtC,eAAe,CAAS,OAA6C;QACn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3E,CAAC,CAAC,CACH,CAAA;QACH,CAAC;KACF,CAAC;IACe,mBAAA,IAAA,mBAAI,GAAE,CAAA;;;4CAAiD,kCAAe;kEAEtF;AAnCU,2BAA2B;IADvC,IAAA,uBAAQ,EAAC,kCAAe,CAAC;GACb,2BAA2B,CAoCvC;AApCY,kEAA2B","sourcesContent":["import { filter, pipe } from 'graphql-yoga'\nimport { Resolver, Root, Subscription } from 'type-graphql'\n\nimport { pubsub } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nimport { ProcessInstance } from './process-instance'\n\n@Resolver(ProcessInstance)\nexport class ProcessInstanceSubscription {\n @Subscription({\n subscribe: ({ args, context, info }) => {\n const { domain, user } = context.state\n const subdomain = domain?.subdomain\n\n if (!domain) {\n throw new Error('domain required')\n }\n\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('process-instance'),\n filter(async (payload: { processInstance: ProcessInstance }) => {\n const { processInstance } = payload\n const { domainId } = processInstance\n\n if (domainId !== domain?.id) {\n return false\n }\n\n if (processInstance.creatorId === user.id) {\n return true\n }\n\n return await User.hasPrivilege('query', 'process-instance', domain, user)\n })\n )\n }\n })\n processInstance(@Root() payload: { processInstance: ProcessInstance }): ProcessInstance {\n return payload.processInstance\n }\n}\n"]}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProcessThreadSubscription = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const graphql_yoga_1 = require("graphql-yoga");
|
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
|
7
7
|
const shell_1 = require("@things-factory/shell");
|
|
8
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
9
|
const process_thread_1 = require("./process-thread");
|
|
9
10
|
let ProcessThreadSubscription = class ProcessThreadSubscription {
|
|
10
11
|
processThread(payload) {
|
|
@@ -13,7 +14,7 @@ let ProcessThreadSubscription = class ProcessThreadSubscription {
|
|
|
13
14
|
};
|
|
14
15
|
tslib_1.__decorate([
|
|
15
16
|
(0, type_graphql_1.Subscription)({
|
|
16
|
-
subscribe: (
|
|
17
|
+
subscribe: ({ args, context, info }) => {
|
|
17
18
|
var _a;
|
|
18
19
|
const { domain, user } = context.state;
|
|
19
20
|
const subdomain = domain === null || domain === void 0 ? void 0 : domain.subdomain;
|
|
@@ -23,14 +24,14 @@ tslib_1.__decorate([
|
|
|
23
24
|
if (!((_a = user.domains) === null || _a === void 0 ? void 0 : _a.find(d => d.subdomain === subdomain)) && !process.superUserGranted(domain, user)) {
|
|
24
25
|
throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`);
|
|
25
26
|
}
|
|
26
|
-
return (0,
|
|
27
|
+
return (0, graphql_yoga_1.pipe)(shell_1.pubsub.subscribe('process-thread'), (0, graphql_yoga_1.filter)(async (payload) => {
|
|
27
28
|
const { processThread } = payload;
|
|
28
29
|
const { domainId } = processThread;
|
|
29
30
|
if (domainId !== (domain === null || domain === void 0 ? void 0 : domain.id)) {
|
|
30
31
|
return false;
|
|
31
32
|
}
|
|
32
|
-
return
|
|
33
|
-
})
|
|
33
|
+
return await auth_base_1.User.hasPrivilege('query', 'process-thread', domain, user);
|
|
34
|
+
}));
|
|
34
35
|
}
|
|
35
36
|
}),
|
|
36
37
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-thread-subscription.js","sourceRoot":"","sources":["../../../server/service/process-thread/process-thread-subscription.ts"],"names":[],"mappings":";;;;AAAA
|
|
1
|
+
{"version":3,"file":"process-thread-subscription.js","sourceRoot":"","sources":["../../../server/service/process-thread/process-thread-subscription.ts"],"names":[],"mappings":";;;;AAAA,+CAA2C;AAC3C,+CAA2D;AAE3D,iDAA8C;AAC9C,yDAAgD;AA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AC,CAAC,CACH,CAAA;QACH,CAAC;KACF,CAAC;IACa,mBAAA,IAAA,mBAAI,GAAE,CAAA;;;4CAA6C,8BAAa;8DAE9E;AA/BU,yBAAyB;IADrC,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,yBAAyB,CAgCrC;AAhCY,8DAAyB","sourcesContent":["import { filter, pipe } from 'graphql-yoga'\nimport { Resolver, Root, Subscription } from 'type-graphql'\n\nimport { pubsub } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nimport { ProcessThread } from './process-thread'\n\n@Resolver(ProcessThread)\nexport class ProcessThreadSubscription {\n @Subscription({\n subscribe: ({ args, context, info }) => {\n const { domain, user } = context.state\n const subdomain = domain?.subdomain\n\n if (!domain) {\n throw new Error('domain required')\n }\n\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('process-thread'),\n filter(async (payload: { processThread: ProcessThread }) => {\n const { processThread } = payload\n const { domainId } = processThread\n\n if (domainId !== domain?.id) {\n return false\n }\n\n return await User.hasPrivilege('query', 'process-thread', domain, user)\n })\n )\n }\n })\n processThread(@Root() payload: { processThread: ProcessThread }): ProcessThread {\n return payload.processThread\n }\n}\n"]}
|