@things-factory/process 10.0.0-beta.9 → 10.0.0-y.0
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-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/middlewares/index.d.ts +2 -1
- package/dist-server/middlewares/index.js +1 -1
- package/dist-server/middlewares/index.js.map +1 -1
- package/dist-server/service/process-instance/process-instance-subscription.js +2 -2
- package/dist-server/service/process-instance/process-instance-subscription.js.map +1 -1
- package/dist-server/service/process-thread/process-thread-subscription.js +2 -2
- package/dist-server/service/process-thread/process-thread-subscription.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import Koa from 'koa';
|
|
2
|
+
export declare function initMiddlewares(_app: Koa): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initMiddlewares = initMiddlewares;
|
|
4
|
-
function initMiddlewares(
|
|
4
|
+
function initMiddlewares(_app) {
|
|
5
5
|
/* can add middlewares into app */
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;AAEA,0CAEC;AAFD,SAAgB,eAAe,CAAC,IAAS;IACvC,kCAAkC;AACpC,CAAC","sourcesContent":["import Koa from 'koa'\n\nexport function initMiddlewares(_app: Koa) {\n /* can add middlewares into app */\n}\n"]}
|
|
@@ -15,13 +15,13 @@ let ProcessInstanceSubscription = class ProcessInstanceSubscription {
|
|
|
15
15
|
exports.ProcessInstanceSubscription = ProcessInstanceSubscription;
|
|
16
16
|
tslib_1.__decorate([
|
|
17
17
|
(0, type_graphql_1.Subscription)({
|
|
18
|
-
subscribe: ({ args, context, info }) => {
|
|
18
|
+
subscribe: async ({ args, context, info }) => {
|
|
19
19
|
const { domain, user } = context.state;
|
|
20
20
|
const subdomain = domain?.subdomain;
|
|
21
21
|
if (!domain) {
|
|
22
22
|
throw new Error('domain required');
|
|
23
23
|
}
|
|
24
|
-
if (!user.domains?.find(d => d.subdomain === subdomain) && !process.superUserGranted(domain, user)) {
|
|
24
|
+
if (!user.domains?.find(d => d.subdomain === subdomain) && !(await process.superUserGranted(domain, user))) {
|
|
25
25
|
throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`);
|
|
26
26
|
}
|
|
27
27
|
return (0, graphql_yoga_1.pipe)(shell_1.pubsub.subscribe('process-instance'), (0, graphql_yoga_1.filter)(async (payload) => {
|
|
@@ -1 +1 @@
|
|
|
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;QACnE,OAAO,OAAO,CAAC,eAAe,CAAA;IAChC,CAAC;CACF,CAAA;AApCY,kEAA2B;AAiCtC;IAhCC,IAAA,2BAAY,EAAC;QACZ,SAAS,EAAE,
|
|
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;QACnE,OAAO,OAAO,CAAC,eAAe,CAAA;IAChC,CAAC;CACF,CAAA;AAp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CAAC;IACe,mBAAA,IAAA,mBAAI,GAAE,CAAA;;;4CAAiD,kCAAe;kEAEtF;sCAnCU,2BAA2B;IADvC,IAAA,uBAAQ,EAAC,kCAAe,CAAC;GACb,2BAA2B,CAoCvC","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: async ({ 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) && !(await 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"]}
|
|
@@ -15,13 +15,13 @@ let ProcessThreadSubscription = class ProcessThreadSubscription {
|
|
|
15
15
|
exports.ProcessThreadSubscription = ProcessThreadSubscription;
|
|
16
16
|
tslib_1.__decorate([
|
|
17
17
|
(0, type_graphql_1.Subscription)({
|
|
18
|
-
subscribe: ({ args, context, info }) => {
|
|
18
|
+
subscribe: async ({ args, context, info }) => {
|
|
19
19
|
const { domain, user } = context.state;
|
|
20
20
|
const subdomain = domain?.subdomain;
|
|
21
21
|
if (!domain) {
|
|
22
22
|
throw new Error('domain required');
|
|
23
23
|
}
|
|
24
|
-
if (!user.domains?.find(d => d.subdomain === subdomain) && !process.superUserGranted(domain, user)) {
|
|
24
|
+
if (!user.domains?.find(d => d.subdomain === subdomain) && !(await process.superUserGranted(domain, user))) {
|
|
25
25
|
throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`);
|
|
26
26
|
}
|
|
27
27
|
return (0, graphql_yoga_1.pipe)(shell_1.pubsub.subscribe('process-thread'), (0, graphql_yoga_1.filter)(async (payload) => {
|
|
@@ -1 +1 @@
|
|
|
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;AAEhD,qDAAgD;AAGzC,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IA6BpC,aAAa,CAAS,OAAyC;QAC7D,OAAO,OAAO,CAAC,aAAa,CAAA;IAC9B,CAAC;CACF,CAAA;AAhCY,8DAAyB;AA6BpC;IA5BC,IAAA,2BAAY,EAAC;QACZ,SAAS,EAAE,
|
|
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;AAEhD,qDAAgD;AAGzC,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IA6BpC,aAAa,CAAS,OAAyC;QAC7D,OAAO,OAAO,CAAC,aAAa,CAAA;IAC9B,CAAC;CACF,CAAA;AAhCY,8DAAyB;AA6BpC;IA5BC,IAAA,2BAAY,EAAC;QACZ,SAAS,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;YAC3C,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;YACtC,MAAM,SAAS,GAAG,MAAM,EAAE,SAAS,CAAA;YAEnC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;YACpC,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;gBAC3G,MAAM,IAAI,KAAK,CAAC,UAAU,SAAS,6BAA6B,IAAI,CAAC,KAAK,IAAI,CAAC,CAAA;YACjF,CAAC;YAED,OAAO,IAAA,mBAAI,EACT,cAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAClC,IAAA,qBAAM,EAAC,KAAK,EAAE,OAAyC,EAAE,EAAE;gBACzD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAA;gBACjC,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAA;gBAElC,IAAI,QAAQ,KAAK,MAAM,EAAE,EAAE,EAAE,CAAC;oBAC5B,OAAO,KAAK,CAAA;gBACd,CAAC;gBAED,OAAO,MAAM,gBAAI,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;YACzE,CAAC,CAAC,CACH,CAAA;QACH,CAAC;KACF,CAAC;IACa,mBAAA,IAAA,mBAAI,GAAE,CAAA;;;4CAA6C,8BAAa;8DAE9E;oCA/BU,yBAAyB;IADrC,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,yBAAyB,CAgCrC","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: async ({ 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) && !(await 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"]}
|