@things-factory/integration-base 5.0.7 → 6.0.0-alpha.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-server/engine/connection-manager.js +3 -6
- package/dist-server/engine/connection-manager.js.map +1 -1
- package/dist-server/engine/connector/echo-back-connector.js +3 -5
- package/dist-server/engine/connector/echo-back-connector.js.map +1 -1
- package/dist-server/engine/connector/echo-back-server.js +3 -5
- package/dist-server/engine/connector/echo-back-server.js.map +1 -1
- package/dist-server/engine/connector/graphql-connector.js +4 -4
- package/dist-server/engine/connector/graphql-connector.js.map +1 -1
- package/dist-server/engine/connector/http-connector.js +3 -3
- package/dist-server/engine/connector/http-connector.js.map +1 -1
- package/dist-server/engine/connector/index.js.map +1 -1
- package/dist-server/engine/connector/mqtt-connector.js +2 -4
- package/dist-server/engine/connector/mqtt-connector.js.map +1 -1
- package/dist-server/engine/connector/mssql-connector.js.map +1 -1
- package/dist-server/engine/connector/mysql-connector.js +2 -4
- package/dist-server/engine/connector/mysql-connector.js.map +1 -1
- package/dist-server/engine/connector/oracle-connector.js.map +1 -1
- package/dist-server/engine/connector/postgresql-connector.js.map +1 -1
- package/dist-server/engine/connector/socket-server.js +2 -4
- package/dist-server/engine/connector/socket-server.js.map +1 -1
- package/dist-server/engine/connector/sqlite-connector.js.map +1 -1
- package/dist-server/engine/index.js +4 -17
- package/dist-server/engine/index.js.map +1 -1
- package/dist-server/engine/pending-queue.js.map +1 -1
- package/dist-server/engine/scenario-engine.js +1 -2
- package/dist-server/engine/scenario-engine.js.map +1 -1
- package/dist-server/engine/task/book-up-scenario.js.map +1 -1
- package/dist-server/engine/task/database-query.js.map +1 -1
- package/dist-server/engine/task/echo-receive.js.map +1 -1
- package/dist-server/engine/task/echo-send.js.map +1 -1
- package/dist-server/engine/task/empty-check.js.map +1 -1
- package/dist-server/engine/task/end.js.map +1 -1
- package/dist-server/engine/task/floating-point.js +2 -4
- package/dist-server/engine/task/floating-point.js.map +1 -1
- package/dist-server/engine/task/goto.js.map +1 -1
- package/dist-server/engine/task/graphql-mutate.js +2 -4
- package/dist-server/engine/task/graphql-mutate.js.map +1 -1
- package/dist-server/engine/task/graphql-query.js +2 -4
- package/dist-server/engine/task/graphql-query.js.map +1 -1
- package/dist-server/engine/task/http-get.js +3 -5
- package/dist-server/engine/task/http-get.js.map +1 -1
- package/dist-server/engine/task/http-post.js +3 -5
- package/dist-server/engine/task/http-post.js.map +1 -1
- package/dist-server/engine/task/index.js.map +1 -1
- package/dist-server/engine/task/local-graphql-mutate.js +5 -6
- package/dist-server/engine/task/local-graphql-mutate.js.map +1 -1
- package/dist-server/engine/task/local-graphql-query.js +5 -6
- package/dist-server/engine/task/local-graphql-query.js.map +1 -1
- package/dist-server/engine/task/log.js.map +1 -1
- package/dist-server/engine/task/mqtt-publish.js.map +1 -1
- package/dist-server/engine/task/mqtt-subscribe.js +2 -4
- package/dist-server/engine/task/mqtt-subscribe.js.map +1 -1
- package/dist-server/engine/task/pick-pending-scenario.js +4 -4
- package/dist-server/engine/task/pick-pending-scenario.js.map +1 -1
- package/dist-server/engine/task/publish.js.map +1 -1
- package/dist-server/engine/task/reset-pending-queue.js.map +1 -1
- package/dist-server/engine/task/script.js.map +1 -1
- package/dist-server/engine/task/sleep.js.map +1 -1
- package/dist-server/engine/task/socket-listener.js.map +1 -1
- package/dist-server/engine/task/sub-scenario.js +3 -3
- package/dist-server/engine/task/sub-scenario.js.map +1 -1
- package/dist-server/engine/task/switch-goto.js.map +1 -1
- package/dist-server/engine/task/switch-range-goto.js.map +1 -1
- package/dist-server/engine/task/switch-range-scenario.js +2 -2
- package/dist-server/engine/task/switch-range-scenario.js.map +1 -1
- package/dist-server/engine/task/switch-range-set.js.map +1 -1
- package/dist-server/engine/task/switch-scenario.js +2 -2
- package/dist-server/engine/task/switch-scenario.js.map +1 -1
- package/dist-server/engine/task/switch-set.js.map +1 -1
- package/dist-server/engine/task/throw.js.map +1 -1
- package/dist-server/engine/task/utils/substitute.js.map +1 -1
- package/dist-server/engine/task/variables.js.map +1 -1
- package/dist-server/engine/task-registry.js.map +1 -1
- package/dist-server/engine/types.js.map +1 -1
- package/dist-server/index.js +4 -17
- package/dist-server/index.js.map +1 -1
- package/dist-server/migrations/index.js.map +1 -1
- package/dist-server/restful/index.js.map +1 -1
- package/dist-server/restful/unstable/index.js.map +1 -1
- package/dist-server/restful/unstable/run-scenario.js +2 -4
- package/dist-server/restful/unstable/run-scenario.js.map +1 -1
- package/dist-server/restful/unstable/scenario-instance.js +2 -4
- package/dist-server/restful/unstable/scenario-instance.js.map +1 -1
- package/dist-server/restful/unstable/scenario-instances.js +2 -4
- package/dist-server/restful/unstable/scenario-instances.js.map +1 -1
- package/dist-server/restful/unstable/scenario.js +2 -4
- package/dist-server/restful/unstable/scenario.js.map +1 -1
- package/dist-server/restful/unstable/scenarios.js +2 -4
- package/dist-server/restful/unstable/scenarios.js.map +1 -1
- package/dist-server/restful/unstable/start-scenario.js +2 -4
- package/dist-server/restful/unstable/start-scenario.js.map +1 -1
- package/dist-server/restful/unstable/stop-scenario.js +2 -4
- package/dist-server/restful/unstable/stop-scenario.js.map +1 -1
- package/dist-server/routers/scenario-view-router.js +8 -9
- package/dist-server/routers/scenario-view-router.js.map +1 -1
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/connection/connection-mutation.js +53 -63
- package/dist-server/service/connection/connection-mutation.js.map +1 -1
- package/dist-server/service/connection/connection-query.js +41 -54
- package/dist-server/service/connection/connection-query.js.map +1 -1
- package/dist-server/service/connection/connection-subscription.js +17 -30
- package/dist-server/service/connection/connection-subscription.js.map +1 -1
- package/dist-server/service/connection/connection-type.js +82 -91
- package/dist-server/service/connection/connection-type.js.map +1 -1
- package/dist-server/service/connection/index.js.map +1 -1
- package/dist-server/service/connector/connector-query.js +22 -33
- package/dist-server/service/connector/connector-query.js.map +1 -1
- package/dist-server/service/connector/connector-type.js +17 -25
- package/dist-server/service/connector/connector-type.js.map +1 -1
- package/dist-server/service/connector/index.js.map +1 -1
- package/dist-server/service/index.js +11 -24
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/payload-log/index.js.map +1 -1
- package/dist-server/service/payload-log/payload-log-mutation.js +44 -52
- package/dist-server/service/payload-log/payload-log-mutation.js.map +1 -1
- package/dist-server/service/payload-log/payload-log-query.js +35 -48
- package/dist-server/service/payload-log/payload-log-query.js.map +1 -1
- package/dist-server/service/payload-log/payload-log-type.js +20 -28
- package/dist-server/service/payload-log/payload-log-type.js.map +1 -1
- package/dist-server/service/payload-log/payload-log.js +35 -39
- package/dist-server/service/payload-log/payload-log.js.map +1 -1
- package/dist-server/service/property-spec.js +12 -21
- package/dist-server/service/property-spec.js.map +1 -1
- package/dist-server/service/scenario/index.js.map +1 -1
- package/dist-server/service/scenario/scenario-mutation.js +58 -64
- package/dist-server/service/scenario/scenario-mutation.js.map +1 -1
- package/dist-server/service/scenario/scenario-query.js +55 -68
- package/dist-server/service/scenario/scenario-query.js.map +1 -1
- package/dist-server/service/scenario/scenario-type.js +71 -80
- package/dist-server/service/scenario/scenario-type.js.map +1 -1
- package/dist-server/service/scenario-flow/scenario-flow.js +8 -17
- package/dist-server/service/scenario-flow/scenario-flow.js.map +1 -1
- package/dist-server/service/scenario-instance/index.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-mutation.js +28 -41
- package/dist-server/service/scenario-instance/scenario-instance-mutation.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-query.js +44 -56
- package/dist-server/service/scenario-instance/scenario-instance-query.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-subscription.js +17 -29
- package/dist-server/service/scenario-instance/scenario-instance-subscription.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-type.js +60 -71
- package/dist-server/service/scenario-instance/scenario-instance-type.js.map +1 -1
- package/dist-server/service/scenario-queue/index.js.map +1 -1
- package/dist-server/service/scenario-queue/scenario-queue-subscription.js +7 -18
- package/dist-server/service/scenario-queue/scenario-queue-subscription.js.map +1 -1
- package/dist-server/service/scenario-queue/scenario-queue-type.js +15 -24
- package/dist-server/service/scenario-queue/scenario-queue-type.js.map +1 -1
- package/dist-server/service/step/index.js.map +1 -1
- package/dist-server/service/step/step-mutation.js +18 -29
- package/dist-server/service/step/step-mutation.js.map +1 -1
- package/dist-server/service/step/step-query.js +41 -54
- package/dist-server/service/step/step-query.js.map +1 -1
- package/dist-server/service/step/step-type.js +66 -75
- package/dist-server/service/step/step-type.js.map +1 -1
- package/dist-server/service/task-type/index.js.map +1 -1
- package/dist-server/service/task-type/task-type-query.js +24 -35
- package/dist-server/service/task-type/task-type-query.js.map +1 -1
- package/dist-server/service/task-type/task-type-type.js +17 -25
- package/dist-server/service/task-type/task-type-type.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +8 -8
- package/server/engine/connection-manager.ts +1 -2
- package/server/engine/connector/graphql-connector.ts +5 -5
- package/server/engine/connector/http-connector.ts +5 -5
- package/server/engine/scenario-engine.ts +2 -2
- package/server/engine/task/local-graphql-mutate.ts +3 -2
- package/server/engine/task/local-graphql-query.ts +3 -2
- package/server/engine/task/pick-pending-scenario.ts +4 -3
- package/server/engine/task/sub-scenario.ts +3 -2
- package/server/engine/task/switch-range-scenario.ts +1 -2
- package/server/engine/task/switch-scenario.ts +1 -2
- package/server/engine/types.ts +1 -2
- package/server/routers/scenario-view-router.ts +8 -8
- package/server/service/connection/connection-mutation.ts +21 -13
- package/server/service/connection/connection-query.ts +8 -9
- package/server/service/connection/connection-subscription.ts +5 -4
- package/server/service/connector/connector-query.ts +9 -7
- package/server/service/payload-log/payload-log-mutation.ts +25 -21
- package/server/service/payload-log/payload-log-query.ts +7 -8
- package/server/service/payload-log/payload-log.ts +5 -2
- package/server/service/property-spec.ts +3 -2
- package/server/service/scenario/scenario-mutation.ts +26 -20
- package/server/service/scenario/scenario-query.ts +11 -12
- package/server/service/scenario-instance/scenario-instance-mutation.ts +8 -9
- package/server/service/scenario-instance/scenario-instance-query.ts +5 -2
- package/server/service/scenario-instance/scenario-instance-type.ts +4 -4
- package/server/service/scenario-queue/scenario-queue-type.ts +3 -2
- package/server/service/step/step-mutation.ts +5 -5
- package/server/service/step/step-query.ts +8 -9
- package/server/service/task-type/task-type-query.ts +10 -8
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var _a;
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.ConnectionQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
17
5
|
const type_graphql_1 = require("type-graphql");
|
|
18
|
-
const typeorm_1 = require("typeorm");
|
|
19
6
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
20
7
|
const shell_1 = require("@things-factory/shell");
|
|
21
8
|
const connection_manager_1 = require("../../engine/connection-manager");
|
|
@@ -23,8 +10,8 @@ const connection_type_1 = require("./connection-type");
|
|
|
23
10
|
let ConnectionQuery = class ConnectionQuery {
|
|
24
11
|
async connection(name, context) {
|
|
25
12
|
const { domain } = context.state;
|
|
26
|
-
var connection = await (0,
|
|
27
|
-
where: { domain, name },
|
|
13
|
+
var connection = await (0, shell_1.getRepository)(connection_type_1.Connection).findOne({
|
|
14
|
+
where: { domain: { id: domain.id }, name },
|
|
28
15
|
relations: ['domain']
|
|
29
16
|
});
|
|
30
17
|
return Object.assign(Object.assign({}, connection), { state: connection_manager_1.ConnectionManager.getConnectionInstance(connection)
|
|
@@ -34,7 +21,7 @@ let ConnectionQuery = class ConnectionQuery {
|
|
|
34
21
|
async connections(params, context) {
|
|
35
22
|
const { domain } = context.state;
|
|
36
23
|
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
37
|
-
repository: (0,
|
|
24
|
+
repository: (0, shell_1.getRepository)(connection_type_1.Connection),
|
|
38
25
|
params,
|
|
39
26
|
domain,
|
|
40
27
|
alias: 'connection',
|
|
@@ -57,61 +44,61 @@ let ConnectionQuery = class ConnectionQuery {
|
|
|
57
44
|
};
|
|
58
45
|
}
|
|
59
46
|
async domain(connection) {
|
|
60
|
-
return connection.domain || (await (0,
|
|
47
|
+
return connection.domain || (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: connection.domainId }));
|
|
61
48
|
}
|
|
62
49
|
async updater(connection) {
|
|
63
|
-
return await (0,
|
|
50
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: connection.updaterId });
|
|
64
51
|
}
|
|
65
52
|
async creator(connection) {
|
|
66
|
-
return await (0,
|
|
53
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: connection.creatorId });
|
|
67
54
|
}
|
|
68
55
|
};
|
|
69
|
-
__decorate([
|
|
56
|
+
tslib_1.__decorate([
|
|
70
57
|
(0, type_graphql_1.Query)(returns => connection_type_1.Connection, { description: 'To fetch a connection' }),
|
|
71
|
-
__param(0, (0, type_graphql_1.Arg)('name')),
|
|
72
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
73
|
-
__metadata("design:type", Function),
|
|
74
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
75
|
-
__metadata("design:returntype", Promise)
|
|
58
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
|
|
59
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
60
|
+
tslib_1.__metadata("design:type", Function),
|
|
61
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
62
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
76
63
|
], ConnectionQuery.prototype, "connection", null);
|
|
77
|
-
__decorate([
|
|
64
|
+
tslib_1.__decorate([
|
|
78
65
|
(0, type_graphql_1.Query)(returns => connection_type_1.ConnectionList, { description: 'To fetch multiple connections' }),
|
|
79
|
-
__param(0, (0, type_graphql_1.Args)()),
|
|
80
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
81
|
-
__metadata("design:type", Function),
|
|
82
|
-
__metadata("design:paramtypes", [
|
|
83
|
-
__metadata("design:returntype", Promise)
|
|
66
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
67
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
68
|
+
tslib_1.__metadata("design:type", Function),
|
|
69
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
70
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
84
71
|
], ConnectionQuery.prototype, "connections", null);
|
|
85
|
-
__decorate([
|
|
72
|
+
tslib_1.__decorate([
|
|
86
73
|
(0, type_graphql_1.Query)(returns => connection_type_1.ConnectionState, { description: 'To fetch the state of a connection' }),
|
|
87
|
-
__param(0, (0, type_graphql_1.Arg)('name')),
|
|
88
|
-
__param(1, (0, type_graphql_1.Ctx)()),
|
|
89
|
-
__metadata("design:type", Function),
|
|
90
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
91
|
-
__metadata("design:returntype", connection_type_1.ConnectionState)
|
|
74
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
|
|
75
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
76
|
+
tslib_1.__metadata("design:type", Function),
|
|
77
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
78
|
+
tslib_1.__metadata("design:returntype", connection_type_1.ConnectionState)
|
|
92
79
|
], ConnectionQuery.prototype, "fetchConnectionState", null);
|
|
93
|
-
__decorate([
|
|
80
|
+
tslib_1.__decorate([
|
|
94
81
|
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
95
|
-
__param(0, (0, type_graphql_1.Root)()),
|
|
96
|
-
__metadata("design:type", Function),
|
|
97
|
-
__metadata("design:paramtypes", [connection_type_1.Connection]),
|
|
98
|
-
__metadata("design:returntype", Promise)
|
|
82
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
83
|
+
tslib_1.__metadata("design:type", Function),
|
|
84
|
+
tslib_1.__metadata("design:paramtypes", [connection_type_1.Connection]),
|
|
85
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
99
86
|
], ConnectionQuery.prototype, "domain", null);
|
|
100
|
-
__decorate([
|
|
87
|
+
tslib_1.__decorate([
|
|
101
88
|
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
102
|
-
__param(0, (0, type_graphql_1.Root)()),
|
|
103
|
-
__metadata("design:type", Function),
|
|
104
|
-
__metadata("design:paramtypes", [connection_type_1.Connection]),
|
|
105
|
-
__metadata("design:returntype", Promise)
|
|
89
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
90
|
+
tslib_1.__metadata("design:type", Function),
|
|
91
|
+
tslib_1.__metadata("design:paramtypes", [connection_type_1.Connection]),
|
|
92
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
106
93
|
], ConnectionQuery.prototype, "updater", null);
|
|
107
|
-
__decorate([
|
|
94
|
+
tslib_1.__decorate([
|
|
108
95
|
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
109
|
-
__param(0, (0, type_graphql_1.Root)()),
|
|
110
|
-
__metadata("design:type", Function),
|
|
111
|
-
__metadata("design:paramtypes", [connection_type_1.Connection]),
|
|
112
|
-
__metadata("design:returntype", Promise)
|
|
96
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
97
|
+
tslib_1.__metadata("design:type", Function),
|
|
98
|
+
tslib_1.__metadata("design:paramtypes", [connection_type_1.Connection]),
|
|
99
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
113
100
|
], ConnectionQuery.prototype, "creator", null);
|
|
114
|
-
ConnectionQuery = __decorate([
|
|
101
|
+
ConnectionQuery = tslib_1.__decorate([
|
|
115
102
|
(0, type_graphql_1.Resolver)(connection_type_1.Connection)
|
|
116
103
|
], ConnectionQuery);
|
|
117
104
|
exports.ConnectionQuery = ConnectionQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-query.js","sourceRoot":"","sources":["../../../server/service/connection/connection-query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connection-query.js","sourceRoot":"","sources":["../../../server/service/connection/connection-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,yDAAgD;AAChD,iDAAuG;AAEvG,wEAAmE;AACnE,uDAAiG;AAGjG,IAAa,eAAe,GAA5B,MAAa,eAAe;IAE1B,KAAK,CAAC,UAAU,CAAc,IAAY,EAAS,OAAwB;QACzE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,IAAI,UAAU,GAAG,MAAM,IAAA,qBAAa,EAAC,4BAAU,CAAC,CAAC,OAAO,CAAC;YACvD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE;YAC1C,SAAS,EAAE,CAAC,QAAQ,CAAC;SACtB,CAAC,CAAA;QAEF,OAAO,gCACF,UAAU,KACb,KAAK,EAAE,sCAAiB,CAAC,qBAAqB,CAAC,UAAU,CA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AAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,4BAAU;;6CAE1C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,4BAAU;;8CAE3C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAa,4BAAU;;8CAE3C;AAlEU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,4BAAU,CAAC;GACR,eAAe,CAmE3B;AAnEY,0CAAe","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { ConnectionManager } from '../../engine/connection-manager'\nimport { Connection, ConnectionList, ConnectionState, ConnectionStatus } from './connection-type'\n\n@Resolver(Connection)\nexport class ConnectionQuery {\n @Query(returns => Connection, { description: 'To fetch a connection' })\n async connection(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<Connection> {\n const { domain } = context.state\n\n var connection = await getRepository(Connection).findOne({\n where: { domain: { id: domain.id }, name },\n relations: ['domain']\n })\n\n return {\n ...connection,\n state: ConnectionManager.getConnectionInstance(connection)\n ? ConnectionStatus.CONNECTED\n : ConnectionStatus.DISCONNECTED\n } as Connection\n }\n\n @Query(returns => ConnectionList, { description: 'To fetch multiple connections' })\n async connections(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ConnectionList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n repository: getRepository(Connection),\n params,\n domain,\n alias: 'connection',\n searchables: ['name', 'description', 'type', 'endpoint']\n })\n\n const [items, total] = await queryBuilder.leftJoinAndSelect('connection.domain', 'domain').getManyAndCount()\n\n items.forEach(connection => {\n connection['state'] = ConnectionManager.getConnectionInstance(connection)\n ? ConnectionStatus.CONNECTED\n : ConnectionStatus.DISCONNECTED\n })\n\n return { items, total }\n }\n\n @Query(returns => ConnectionState, { description: 'To fetch the state of a connection' })\n fetchConnectionState(@Arg('name') name: string, @Ctx() context: ResolverContext): ConnectionState {\n const { domain } = context.state\n\n var connection = ConnectionManager.getConnectionInstanceByName(domain, name)\n\n return {\n name,\n state: connection ? ConnectionStatus.CONNECTED : ConnectionStatus.DISCONNECTED\n }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() connection: Connection) {\n return connection.domain || (await getRepository(Domain).findOneBy({ id: connection.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() connection: Connection): Promise<User> {\n return await getRepository(User).findOneBy({ id: connection.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() connection: Connection): Promise<User> {\n return await getRepository(User).findOneBy({ id: connection.creatorId })\n }\n}\n"]}
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var _a;
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.ConnectionSubscription = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_subscriptions_1 = require("graphql-subscriptions");
|
|
17
6
|
const type_graphql_1 = require("type-graphql");
|
|
18
|
-
const typeorm_1 = require("typeorm");
|
|
19
|
-
const connection_type_1 = require("./connection-type");
|
|
20
7
|
const shell_1 = require("@things-factory/shell");
|
|
21
|
-
const graphql_subscriptions_1 = require("graphql-subscriptions");
|
|
22
8
|
const connection_manager_1 = require("../../engine/connection-manager");
|
|
9
|
+
const connection_type_1 = require("./connection-type");
|
|
23
10
|
const debug = require('debug')('things-factory:integration:connection-subscription');
|
|
24
11
|
let ConnectionSubscription = class ConnectionSubscription {
|
|
25
12
|
connectionState(payload, name) {
|
|
@@ -29,7 +16,7 @@ let ConnectionSubscription = class ConnectionSubscription {
|
|
|
29
16
|
return payload.log;
|
|
30
17
|
}
|
|
31
18
|
};
|
|
32
|
-
__decorate([
|
|
19
|
+
tslib_1.__decorate([
|
|
33
20
|
(0, type_graphql_1.Subscription)({
|
|
34
21
|
subscribe: (_, args, context, info) => {
|
|
35
22
|
var _a;
|
|
@@ -48,7 +35,7 @@ __decorate([
|
|
|
48
35
|
if (name) {
|
|
49
36
|
where['name'] = name;
|
|
50
37
|
}
|
|
51
|
-
var connections = await (0,
|
|
38
|
+
var connections = await (0, shell_1.getRepository)(connection_type_1.Connection).find({
|
|
52
39
|
where,
|
|
53
40
|
relations: ['domain']
|
|
54
41
|
});
|
|
@@ -67,13 +54,13 @@ __decorate([
|
|
|
67
54
|
})(_, args, context, info);
|
|
68
55
|
}
|
|
69
56
|
}),
|
|
70
|
-
__param(0, (0, type_graphql_1.Root)()),
|
|
71
|
-
__param(1, (0, type_graphql_1.Arg)('name', { nullable: true })),
|
|
72
|
-
__metadata("design:type", Function),
|
|
73
|
-
__metadata("design:paramtypes", [Object, String]),
|
|
74
|
-
__metadata("design:returntype", connection_type_1.ConnectionState)
|
|
57
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
58
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('name', { nullable: true })),
|
|
59
|
+
tslib_1.__metadata("design:type", Function),
|
|
60
|
+
tslib_1.__metadata("design:paramtypes", [Object, String]),
|
|
61
|
+
tslib_1.__metadata("design:returntype", connection_type_1.ConnectionState)
|
|
75
62
|
], ConnectionSubscription.prototype, "connectionState", null);
|
|
76
|
-
__decorate([
|
|
63
|
+
tslib_1.__decorate([
|
|
77
64
|
(0, type_graphql_1.Subscription)({
|
|
78
65
|
subscribe: (_, args, context, info) => {
|
|
79
66
|
var _a;
|
|
@@ -101,13 +88,13 @@ __decorate([
|
|
|
101
88
|
})(_, args, context, info);
|
|
102
89
|
}
|
|
103
90
|
}),
|
|
104
|
-
__param(0, (0, type_graphql_1.Root)()),
|
|
105
|
-
__param(1, (0, type_graphql_1.Arg)('level', { nullable: true })),
|
|
106
|
-
__metadata("design:type", Function),
|
|
107
|
-
__metadata("design:paramtypes", [Object, String]),
|
|
108
|
-
__metadata("design:returntype",
|
|
91
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
92
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('level', { nullable: true })),
|
|
93
|
+
tslib_1.__metadata("design:type", Function),
|
|
94
|
+
tslib_1.__metadata("design:paramtypes", [Object, String]),
|
|
95
|
+
tslib_1.__metadata("design:returntype", shell_1.Log)
|
|
109
96
|
], ConnectionSubscription.prototype, "connectionLog", null);
|
|
110
|
-
ConnectionSubscription = __decorate([
|
|
97
|
+
ConnectionSubscription = tslib_1.__decorate([
|
|
111
98
|
(0, type_graphql_1.Resolver)(connection_type_1.Connection)
|
|
112
99
|
], ConnectionSubscription);
|
|
113
100
|
exports.ConnectionSubscription = ConnectionSubscription;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-subscription.js","sourceRoot":"","sources":["../../../server/service/connection/connection-subscription.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connection-subscription.js","sourceRoot":"","sources":["../../../server/service/connection/connection-subscription.ts"],"names":[],"mappings":";;;;AAAA,iEAAkD;AAClD,+CAAgE;AAEhE,iDAAkE;AAElE,wEAAmE;AACnE,uDAAiF;AAEjF,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,oDAAoD,CAAC,CAAA;AAGpF,IAAa,sBAAsB,GAAnC,MAAa,sBAAsB;IAmDjC,eAAe,CACL,OAA6C,EACpB,IAAY;QAE7C,OAAO,OAAO,CAAC,eAAe,CAAA;IAChC,CAAC;IAuCD,aAAa,CAAS,OAAqB,EAAoC,KAAa;QAC1F,OAAO,OAAO,CAAC,GAAG,CAAA;IACpB,CAAC;CACF,CAAA;AA/CC;IAlDC,IAAA,2BAAY,EAAC;QACZ,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;;YACpC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;YACtC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;YACrB,MAAM,SAAS,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,CAAA;YAEnC,KAAK,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;YAC7B,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;aACpC;YAED,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAA,EAAE;gBACvD,MAAM,IAAI,KAAK,CAAC,UAAU,SAAS,6BAA6B,IAAI,CAAC,KAAK,IAAI,CAAC,CAAA;aAChF;YAED,OAAO,CAAC,QAAQ,CAAC,KA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C,CACF,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;QAC3B,CAAC;KACF,CAAC;IACa,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAyB,mBAAA,IAAA,kBAAG,EAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;;;4CAAiB,WAAG;2DAEjG;AAjGU,sBAAsB;IADlC,IAAA,uBAAQ,EAAC,4BAAU,CAAC;GACR,sBAAsB,CAkGlC;AAlGY,wDAAsB","sourcesContent":["import { withFilter } from 'graphql-subscriptions'\nimport { Arg, Resolver, Root, Subscription } from 'type-graphql'\n\nimport { getRepository, Log, pubsub } from '@things-factory/shell'\n\nimport { ConnectionManager } from '../../engine/connection-manager'\nimport { Connection, ConnectionState, ConnectionStatus } from './connection-type'\n\nconst debug = require('debug')('things-factory:integration:connection-subscription')\n\n@Resolver(Connection)\nexport class ConnectionSubscription {\n @Subscription({\n subscribe: (_, args, context, info) => {\n const { domain, user } = context.state\n const { name } = args\n const subdomain = domain?.subdomain\n\n debug('subscribe', subdomain)\n if (!domain) {\n throw new Error('domain required.')\n }\n\n if (!user.domains?.find(d => d.subdomain === subdomain)) {\n throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`)\n }\n\n process.nextTick(async () => {\n var where = { domain }\n if (name) {\n where['name'] = name\n }\n\n var connections = await getRepository(Connection).find({\n where,\n relations: ['domain']\n })\n\n connections.forEach(connection => {\n pubsub.publish('connection-state', {\n connectionState: {\n ...connection,\n state: ConnectionManager.getConnectionInstance(connection)\n ? ConnectionStatus.CONNECTED\n : ConnectionStatus.DISCONNECTED,\n timestamp: new Date()\n }\n })\n })\n })\n\n return withFilter(\n () => pubsub.asyncIterator('connection-state'),\n (payload, variables, context, info) => {\n const { domain: pdomain, name: pname } = payload.connectionState\n const { name } = variables\n\n return (!name || name === pname) && subdomain === pdomain?.subdomain\n }\n )(_, args, context, info)\n }\n })\n connectionState(\n @Root() payload: { connectionState: ConnectionState },\n @Arg('name', { nullable: true }) name: string\n ): ConnectionState {\n return payload.connectionState\n }\n\n @Subscription({\n subscribe: (_, args, context, info) => {\n const { domain, user } = context.state\n const { level } = args\n\n const subdomain = domain?.subdomain\n\n debug('subscribe', subdomain)\n\n if (!domain) {\n throw new Error('domain required')\n }\n\n if (!user.domains?.find(d => d.subdomain === subdomain)) {\n throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`)\n }\n\n return withFilter(\n () => pubsub.asyncIterator('connection-log'),\n (payload, variables, context, info) => {\n // TODO support domain filtering\n const { /* source, */ level: plevel } = payload.connectionLog\n // const { domain: pdomain } = source\n\n // if (subdomain !== pdomain?.subdomain) {\n // return false\n // }\n\n if (level && level !== plevel) {\n return false\n }\n\n return true\n }\n )(_, args, context, info)\n }\n })\n connectionLog(@Root() payload: { log: Log }, @Arg('level', { nullable: true }) level: string): Log {\n return payload.log\n }\n}\n"]}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var _a, _b, _c, _d;
|
|
12
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
3
|
exports.ConnectionList = exports.ConnectionPatch = exports.NewConnection = exports.ConnectionState = exports.Connection = exports.ConnectionStatus = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
14
5
|
const type_graphql_1 = require("type-graphql");
|
|
15
6
|
const typeorm_1 = require("typeorm");
|
|
16
7
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
@@ -47,93 +38,93 @@ let Connection = class Connection {
|
|
|
47
38
|
}
|
|
48
39
|
}
|
|
49
40
|
};
|
|
50
|
-
__decorate([
|
|
41
|
+
tslib_1.__decorate([
|
|
51
42
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
52
43
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
53
|
-
__metadata("design:type", String)
|
|
44
|
+
tslib_1.__metadata("design:type", String)
|
|
54
45
|
], Connection.prototype, "id", void 0);
|
|
55
|
-
__decorate([
|
|
46
|
+
tslib_1.__decorate([
|
|
56
47
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
57
48
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
58
|
-
__metadata("design:type",
|
|
49
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
59
50
|
], Connection.prototype, "domain", void 0);
|
|
60
|
-
__decorate([
|
|
51
|
+
tslib_1.__decorate([
|
|
61
52
|
(0, typeorm_1.RelationId)((connection) => connection.domain),
|
|
62
|
-
__metadata("design:type", String)
|
|
53
|
+
tslib_1.__metadata("design:type", String)
|
|
63
54
|
], Connection.prototype, "domainId", void 0);
|
|
64
|
-
__decorate([
|
|
55
|
+
tslib_1.__decorate([
|
|
65
56
|
(0, typeorm_1.Column)(),
|
|
66
57
|
(0, type_graphql_1.Field)(),
|
|
67
|
-
__metadata("design:type", String)
|
|
58
|
+
tslib_1.__metadata("design:type", String)
|
|
68
59
|
], Connection.prototype, "name", void 0);
|
|
69
|
-
__decorate([
|
|
60
|
+
tslib_1.__decorate([
|
|
70
61
|
(0, typeorm_1.Column)({
|
|
71
62
|
nullable: true
|
|
72
63
|
}),
|
|
73
64
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
74
|
-
__metadata("design:type", String)
|
|
65
|
+
tslib_1.__metadata("design:type", String)
|
|
75
66
|
], Connection.prototype, "description", void 0);
|
|
76
|
-
__decorate([
|
|
67
|
+
tslib_1.__decorate([
|
|
77
68
|
(0, typeorm_1.Column)(),
|
|
78
69
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
79
|
-
__metadata("design:type", String)
|
|
70
|
+
tslib_1.__metadata("design:type", String)
|
|
80
71
|
], Connection.prototype, "type", void 0);
|
|
81
|
-
__decorate([
|
|
72
|
+
tslib_1.__decorate([
|
|
82
73
|
(0, typeorm_1.Column)(),
|
|
83
74
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
84
|
-
__metadata("design:type", String)
|
|
75
|
+
tslib_1.__metadata("design:type", String)
|
|
85
76
|
], Connection.prototype, "endpoint", void 0);
|
|
86
|
-
__decorate([
|
|
77
|
+
tslib_1.__decorate([
|
|
87
78
|
(0, typeorm_1.Column)({
|
|
88
79
|
nullable: true
|
|
89
80
|
}),
|
|
90
81
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
91
|
-
__metadata("design:type", Boolean)
|
|
82
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
92
83
|
], Connection.prototype, "active", void 0);
|
|
93
|
-
__decorate([
|
|
84
|
+
tslib_1.__decorate([
|
|
94
85
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
95
|
-
__metadata("design:type", String)
|
|
86
|
+
tslib_1.__metadata("design:type", String)
|
|
96
87
|
], Connection.prototype, "state", void 0);
|
|
97
|
-
__decorate([
|
|
88
|
+
tslib_1.__decorate([
|
|
98
89
|
(0, typeorm_1.Column)({
|
|
99
90
|
nullable: true
|
|
100
91
|
}),
|
|
101
92
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
102
|
-
__metadata("design:type", String)
|
|
93
|
+
tslib_1.__metadata("design:type", String)
|
|
103
94
|
], Connection.prototype, "params", void 0);
|
|
104
|
-
__decorate([
|
|
95
|
+
tslib_1.__decorate([
|
|
105
96
|
(0, typeorm_1.CreateDateColumn)(),
|
|
106
97
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
107
|
-
__metadata("design:type", Date)
|
|
98
|
+
tslib_1.__metadata("design:type", Date)
|
|
108
99
|
], Connection.prototype, "createdAt", void 0);
|
|
109
|
-
__decorate([
|
|
100
|
+
tslib_1.__decorate([
|
|
110
101
|
(0, typeorm_1.UpdateDateColumn)(),
|
|
111
102
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
112
|
-
__metadata("design:type", Date)
|
|
103
|
+
tslib_1.__metadata("design:type", Date)
|
|
113
104
|
], Connection.prototype, "updatedAt", void 0);
|
|
114
|
-
__decorate([
|
|
105
|
+
tslib_1.__decorate([
|
|
115
106
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
116
107
|
nullable: true
|
|
117
108
|
}),
|
|
118
109
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
119
|
-
__metadata("design:type",
|
|
110
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
120
111
|
], Connection.prototype, "creator", void 0);
|
|
121
|
-
__decorate([
|
|
112
|
+
tslib_1.__decorate([
|
|
122
113
|
(0, typeorm_1.RelationId)((connection) => connection.creator),
|
|
123
|
-
__metadata("design:type", String)
|
|
114
|
+
tslib_1.__metadata("design:type", String)
|
|
124
115
|
], Connection.prototype, "creatorId", void 0);
|
|
125
|
-
__decorate([
|
|
116
|
+
tslib_1.__decorate([
|
|
126
117
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
127
118
|
nullable: true
|
|
128
119
|
}),
|
|
129
120
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
130
|
-
__metadata("design:type",
|
|
121
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
131
122
|
], Connection.prototype, "updater", void 0);
|
|
132
|
-
__decorate([
|
|
123
|
+
tslib_1.__decorate([
|
|
133
124
|
(0, typeorm_1.RelationId)((connection) => connection.creator),
|
|
134
|
-
__metadata("design:type", String)
|
|
125
|
+
tslib_1.__metadata("design:type", String)
|
|
135
126
|
], Connection.prototype, "updaterId", void 0);
|
|
136
|
-
Connection = __decorate([
|
|
127
|
+
Connection = tslib_1.__decorate([
|
|
137
128
|
(0, typeorm_1.Entity)(),
|
|
138
129
|
(0, typeorm_1.Index)('ix_connection_0', (connection) => [connection.domain, connection.name], { unique: true }),
|
|
139
130
|
(0, type_graphql_1.ObjectType)()
|
|
@@ -141,113 +132,113 @@ Connection = __decorate([
|
|
|
141
132
|
exports.Connection = Connection;
|
|
142
133
|
let ConnectionState = class ConnectionState {
|
|
143
134
|
};
|
|
144
|
-
__decorate([
|
|
135
|
+
tslib_1.__decorate([
|
|
145
136
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
146
|
-
__metadata("design:type",
|
|
137
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
147
138
|
], ConnectionState.prototype, "domain", void 0);
|
|
148
|
-
__decorate([
|
|
139
|
+
tslib_1.__decorate([
|
|
149
140
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
150
|
-
__metadata("design:type", String)
|
|
141
|
+
tslib_1.__metadata("design:type", String)
|
|
151
142
|
], ConnectionState.prototype, "id", void 0);
|
|
152
|
-
__decorate([
|
|
143
|
+
tslib_1.__decorate([
|
|
153
144
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
154
|
-
__metadata("design:type", String)
|
|
145
|
+
tslib_1.__metadata("design:type", String)
|
|
155
146
|
], ConnectionState.prototype, "name", void 0);
|
|
156
|
-
__decorate([
|
|
147
|
+
tslib_1.__decorate([
|
|
157
148
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
158
|
-
__metadata("design:type", String)
|
|
149
|
+
tslib_1.__metadata("design:type", String)
|
|
159
150
|
], ConnectionState.prototype, "description", void 0);
|
|
160
|
-
__decorate([
|
|
151
|
+
tslib_1.__decorate([
|
|
161
152
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
162
|
-
__metadata("design:type", String)
|
|
153
|
+
tslib_1.__metadata("design:type", String)
|
|
163
154
|
], ConnectionState.prototype, "type", void 0);
|
|
164
|
-
__decorate([
|
|
155
|
+
tslib_1.__decorate([
|
|
165
156
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
166
|
-
__metadata("design:type", String)
|
|
157
|
+
tslib_1.__metadata("design:type", String)
|
|
167
158
|
], ConnectionState.prototype, "state", void 0);
|
|
168
|
-
__decorate([
|
|
159
|
+
tslib_1.__decorate([
|
|
169
160
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
170
|
-
__metadata("design:type", Date)
|
|
161
|
+
tslib_1.__metadata("design:type", Date)
|
|
171
162
|
], ConnectionState.prototype, "timestamp", void 0);
|
|
172
|
-
ConnectionState = __decorate([
|
|
163
|
+
ConnectionState = tslib_1.__decorate([
|
|
173
164
|
(0, type_graphql_1.ObjectType)()
|
|
174
165
|
], ConnectionState);
|
|
175
166
|
exports.ConnectionState = ConnectionState;
|
|
176
167
|
let NewConnection = class NewConnection {
|
|
177
168
|
};
|
|
178
|
-
__decorate([
|
|
169
|
+
tslib_1.__decorate([
|
|
179
170
|
(0, type_graphql_1.Field)(),
|
|
180
|
-
__metadata("design:type", String)
|
|
171
|
+
tslib_1.__metadata("design:type", String)
|
|
181
172
|
], NewConnection.prototype, "name", void 0);
|
|
182
|
-
__decorate([
|
|
173
|
+
tslib_1.__decorate([
|
|
183
174
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
184
|
-
__metadata("design:type", String)
|
|
175
|
+
tslib_1.__metadata("design:type", String)
|
|
185
176
|
], NewConnection.prototype, "description", void 0);
|
|
186
|
-
__decorate([
|
|
177
|
+
tslib_1.__decorate([
|
|
187
178
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
188
|
-
__metadata("design:type", String)
|
|
179
|
+
tslib_1.__metadata("design:type", String)
|
|
189
180
|
], NewConnection.prototype, "type", void 0);
|
|
190
|
-
__decorate([
|
|
181
|
+
tslib_1.__decorate([
|
|
191
182
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
192
|
-
__metadata("design:type", String)
|
|
183
|
+
tslib_1.__metadata("design:type", String)
|
|
193
184
|
], NewConnection.prototype, "endpoint", void 0);
|
|
194
|
-
__decorate([
|
|
185
|
+
tslib_1.__decorate([
|
|
195
186
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
196
|
-
__metadata("design:type", String)
|
|
187
|
+
tslib_1.__metadata("design:type", String)
|
|
197
188
|
], NewConnection.prototype, "params", void 0);
|
|
198
|
-
NewConnection = __decorate([
|
|
189
|
+
NewConnection = tslib_1.__decorate([
|
|
199
190
|
(0, type_graphql_1.InputType)()
|
|
200
191
|
], NewConnection);
|
|
201
192
|
exports.NewConnection = NewConnection;
|
|
202
193
|
let ConnectionPatch = class ConnectionPatch {
|
|
203
194
|
};
|
|
204
|
-
__decorate([
|
|
195
|
+
tslib_1.__decorate([
|
|
205
196
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
206
|
-
__metadata("design:type", String)
|
|
197
|
+
tslib_1.__metadata("design:type", String)
|
|
207
198
|
], ConnectionPatch.prototype, "id", void 0);
|
|
208
|
-
__decorate([
|
|
199
|
+
tslib_1.__decorate([
|
|
209
200
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
210
|
-
__metadata("design:type", String)
|
|
201
|
+
tslib_1.__metadata("design:type", String)
|
|
211
202
|
], ConnectionPatch.prototype, "name", void 0);
|
|
212
|
-
__decorate([
|
|
203
|
+
tslib_1.__decorate([
|
|
213
204
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
214
|
-
__metadata("design:type", String)
|
|
205
|
+
tslib_1.__metadata("design:type", String)
|
|
215
206
|
], ConnectionPatch.prototype, "description", void 0);
|
|
216
|
-
__decorate([
|
|
207
|
+
tslib_1.__decorate([
|
|
217
208
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
218
|
-
__metadata("design:type", String)
|
|
209
|
+
tslib_1.__metadata("design:type", String)
|
|
219
210
|
], ConnectionPatch.prototype, "type", void 0);
|
|
220
|
-
__decorate([
|
|
211
|
+
tslib_1.__decorate([
|
|
221
212
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
222
|
-
__metadata("design:type", String)
|
|
213
|
+
tslib_1.__metadata("design:type", String)
|
|
223
214
|
], ConnectionPatch.prototype, "endpoint", void 0);
|
|
224
|
-
__decorate([
|
|
215
|
+
tslib_1.__decorate([
|
|
225
216
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
226
|
-
__metadata("design:type", Boolean)
|
|
217
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
227
218
|
], ConnectionPatch.prototype, "active", void 0);
|
|
228
|
-
__decorate([
|
|
219
|
+
tslib_1.__decorate([
|
|
229
220
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
230
|
-
__metadata("design:type", String)
|
|
221
|
+
tslib_1.__metadata("design:type", String)
|
|
231
222
|
], ConnectionPatch.prototype, "params", void 0);
|
|
232
|
-
__decorate([
|
|
223
|
+
tslib_1.__decorate([
|
|
233
224
|
(0, type_graphql_1.Field)(),
|
|
234
|
-
__metadata("design:type", String)
|
|
225
|
+
tslib_1.__metadata("design:type", String)
|
|
235
226
|
], ConnectionPatch.prototype, "cuFlag", void 0);
|
|
236
|
-
ConnectionPatch = __decorate([
|
|
227
|
+
ConnectionPatch = tslib_1.__decorate([
|
|
237
228
|
(0, type_graphql_1.InputType)()
|
|
238
229
|
], ConnectionPatch);
|
|
239
230
|
exports.ConnectionPatch = ConnectionPatch;
|
|
240
231
|
let ConnectionList = class ConnectionList {
|
|
241
232
|
};
|
|
242
|
-
__decorate([
|
|
233
|
+
tslib_1.__decorate([
|
|
243
234
|
(0, type_graphql_1.Field)(type => [Connection]),
|
|
244
|
-
__metadata("design:type", Array)
|
|
235
|
+
tslib_1.__metadata("design:type", Array)
|
|
245
236
|
], ConnectionList.prototype, "items", void 0);
|
|
246
|
-
__decorate([
|
|
237
|
+
tslib_1.__decorate([
|
|
247
238
|
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
248
|
-
__metadata("design:type", Number)
|
|
239
|
+
tslib_1.__metadata("design:type", Number)
|
|
249
240
|
], ConnectionList.prototype, "total", void 0);
|
|
250
|
-
ConnectionList = __decorate([
|
|
241
|
+
ConnectionList = tslib_1.__decorate([
|
|
251
242
|
(0, type_graphql_1.ObjectType)()
|
|
252
243
|
], ConnectionList);
|
|
253
244
|
exports.ConnectionList = ConnectionList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-type.js","sourceRoot":"","sources":["../../../server/service/connection/connection-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connection-type.js","sourceRoot":"","sources":["../../../server/service/connection/connection-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAsF;AACtF,qCASgB;AAEhB,yDAAgD;AAChD,6CAA4C;AAC5C,iDAA8C;AAE9C,yCAAgD;AAEhD,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,2CAAuB,CAAA;IACvB,iDAA6B,CAAA;AAC/B,CAAC,EAHW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAG3B;AAED,IAAA,+BAAgB,EAAC,gBAAgB,EAAE;IACjC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,mCAAmC;CACjD,CAAC,CAAA;AAKF,IAAa,UAAU,GAAvB,MAAa,UAAU;IAuErB,KAAK,CAAC,OAAO;QACX,IAAI,SAAS,GAAG,0BAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACzD,IAAI,MAAM,GAAG,EAAE,CAAA;QAEf,IAAI;YACF,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAA;SACzC;QAAC,OAAO,EAAE,EAAE;YACX,YAAM,CAAC,KAAK,CAAC,eAAe,IAAI,CA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;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC5B;AAGV;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACX;AAGf;IADC,IAAA,oBAAK,GAAE;;+CACM;AAvBH,eAAe;IAD3B,IAAA,wBAAS,GAAE;GACC,eAAe,CAwB3B;AAxBY,0CAAe;AA2B5B,IAAa,cAAc,GAA3B,MAAa,cAAc;CAM1B,CAAA;AAJC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;;6CACT;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;6CACN;AALF,cAAc;IAD1B,IAAA,yBAAU,GAAE;GACA,cAAc,CAM1B;AANY,wCAAc","sourcesContent":["import { Field, ID, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { logger } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { ConnectionManager } from '../../engine'\n\nexport enum ConnectionStatus {\n CONNECTED = 'CONNECTED',\n DISCONNECTED = 'DISCONNECTED'\n}\n\nregisterEnumType(ConnectionStatus, {\n name: 'ConnectionStatus',\n description: 'state enumeration of a connection'\n})\n\n@Entity()\n@Index('ix_connection_0', (connection: Connection) => [connection.domain, connection.name], { unique: true })\n@ObjectType()\nexport class Connection {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain: Domain\n\n @RelationId((connection: Connection) => connection.domain)\n domainId: string\n\n @Column()\n @Field()\n name: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n description: string\n\n @Column()\n @Field({ nullable: true })\n type: string\n\n @Column()\n @Field({ nullable: true })\n endpoint: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n active: boolean\n\n @Field({ nullable: true })\n state: ConnectionStatus\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n params: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt: Date\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n creator: User\n\n @RelationId((connection: Connection) => connection.creator)\n creatorId: string\n\n @ManyToOne(type => User, {\n nullable: true\n })\n @Field({ nullable: true })\n updater: User\n\n @RelationId((connection: Connection) => connection.creator)\n updaterId: string\n\n async connect() {\n var connector = ConnectionManager.getConnector(this.type)\n var params = {}\n\n try {\n params = JSON.parse(this.params || '{}')\n } catch (ex) {\n logger.error(`connection '${this.name}' params should be JSON format`, ex)\n }\n\n await connector.connect({\n ...this,\n params\n })\n }\n\n async disconnect() {\n try {\n var connector = ConnectionManager.getConnector(this.type)\n await connector.disconnect(this)\n } finally {\n }\n }\n}\n\n@ObjectType()\nexport class ConnectionState {\n @Field({ nullable: true })\n domain?: Domain\n\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 type?: string\n\n @Field({ nullable: true })\n state?: ConnectionStatus\n\n @Field({ nullable: true })\n timestamp?: Date\n}\n\n@InputType()\nexport class NewConnection {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n type?: string\n\n @Field({ nullable: true })\n endpoint?: string\n\n @Field({ nullable: true })\n params?: string\n}\n\n@InputType()\nexport class ConnectionPatch {\n @Field(type => ID, { 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 type?: string\n\n @Field({ nullable: true })\n endpoint?: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n params?: string\n\n @Field()\n cuFlag: string\n}\n\n@ObjectType()\nexport class ConnectionList {\n @Field(type => [Connection])\n items: Connection[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/connection/index.ts"],"names":[],"mappings":";;;AAAA,uDAA8C;AAC9C,yDAAoD;AACpD,+DAA0D;AAC1D,uEAAkE;AAErD,QAAA,QAAQ,GAAG,CAAC,4BAAU,CAAC,CAAA;AACvB,QAAA,SAAS,GAAG,CAAC,kCAAe,EAAE,wCAAkB,EAAE,gDAAsB,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/connection/index.ts"],"names":[],"mappings":";;;AAAA,uDAA8C;AAC9C,yDAAoD;AACpD,+DAA0D;AAC1D,uEAAkE;AAErD,QAAA,QAAQ,GAAG,CAAC,4BAAU,CAAC,CAAA;AACvB,QAAA,SAAS,GAAG,CAAC,kCAAe,EAAE,wCAAkB,EAAE,gDAAsB,CAAC,CAAA","sourcesContent":["import { Connection } from './connection-type'\nimport { ConnectionQuery } from './connection-query'\nimport { ConnectionMutation } from './connection-mutation'\nimport { ConnectionSubscription } from './connection-subscription'\n\nexport const entities = [Connection]\nexport const resolvers = [ConnectionQuery, ConnectionMutation, ConnectionSubscription]\n"]}
|