@things-factory/integration-base 9.0.0-beta.8 → 9.0.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/controllers/publish-data.js +7 -2
- package/dist-server/controllers/publish-data.js.map +1 -1
- package/dist-server/engine/analyzer/analyze-integration.js +1 -1
- package/dist-server/engine/analyzer/analyze-integration.js.map +1 -1
- package/dist-server/engine/connection-manager.js +41 -40
- package/dist-server/engine/connection-manager.js.map +1 -1
- package/dist-server/engine/connector/graphql-connector.js +4 -1
- package/dist-server/engine/connector/graphql-connector.js.map +1 -1
- package/dist-server/engine/connector/headless-connector.js +1 -2
- package/dist-server/engine/connector/headless-connector.js.map +1 -1
- package/dist-server/engine/connector/http-connector.js +5 -1
- package/dist-server/engine/connector/http-connector.js.map +1 -1
- package/dist-server/engine/connector/operato-connector.js +10 -8
- package/dist-server/engine/connector/operato-connector.js.map +1 -1
- package/dist-server/engine/connector/oracle-connector.js +2 -2
- package/dist-server/engine/connector/oracle-connector.js.map +1 -1
- package/dist-server/engine/connector/postgresql-connector.js +3 -3
- package/dist-server/engine/connector/postgresql-connector.js.map +1 -1
- package/dist-server/engine/connector/proxy-connector.js +1 -1
- package/dist-server/engine/connector/proxy-connector.js.map +1 -1
- package/dist-server/engine/index.d.ts +2 -2
- package/dist-server/engine/index.js +2 -2
- package/dist-server/engine/index.js.map +1 -1
- package/dist-server/engine/scenario-engine.js +10 -7
- package/dist-server/engine/scenario-engine.js.map +1 -1
- package/dist-server/engine/task/headless-post.js +3 -1
- package/dist-server/engine/task/headless-post.js.map +1 -1
- package/dist-server/engine/task/headless-scrap.js +36 -4
- package/dist-server/engine/task/headless-scrap.js.map +1 -1
- package/dist-server/engine/task/http-get.js +4 -1
- package/dist-server/engine/task/http-get.js.map +1 -1
- package/dist-server/engine/task/http-post.js +4 -1
- package/dist-server/engine/task/http-post.js.map +1 -1
- package/dist-server/engine/task/mqtt-publish.js +29 -6
- package/dist-server/engine/task/mqtt-publish.js.map +1 -1
- package/dist-server/engine/task/mqtt-subscribe.d.ts +84 -0
- package/dist-server/engine/task/mqtt-subscribe.js +197 -79
- package/dist-server/engine/task/mqtt-subscribe.js.map +1 -1
- package/dist-server/engine/task/mssql-procedure.js +1 -1
- package/dist-server/engine/task/mssql-procedure.js.map +1 -1
- package/dist-server/engine/task/oracle-procedure.js +10 -10
- package/dist-server/engine/task/oracle-procedure.js.map +1 -1
- package/dist-server/engine/task/pick-pending-scenario.js +5 -1
- package/dist-server/engine/task/pick-pending-scenario.js.map +1 -1
- package/dist-server/engine/task/state-group-read.js +1 -2
- package/dist-server/engine/task/state-group-read.js.map +1 -1
- package/dist-server/engine/task/state-read.js +1 -2
- package/dist-server/engine/task/state-read.js.map +1 -1
- package/dist-server/engine/task/state-write.js +1 -2
- package/dist-server/engine/task/state-write.js.map +1 -1
- package/dist-server/engine/task/stop-scenario.js +3 -3
- package/dist-server/engine/task/stop-scenario.js.map +1 -1
- package/dist-server/engine/task/sub-scenario.js +5 -2
- package/dist-server/engine/task/sub-scenario.js.map +1 -1
- package/dist-server/engine/task/switch-range-scenario.js +5 -2
- package/dist-server/engine/task/switch-range-scenario.js.map +1 -1
- package/dist-server/engine/task/switch-scenario.js +5 -2
- package/dist-server/engine/task/switch-scenario.js.map +1 -1
- package/dist-server/engine/task/variables.js +1 -1
- package/dist-server/engine/task/variables.js.map +1 -1
- package/dist-server/engine/task-registry.js +4 -2
- package/dist-server/engine/task-registry.js.map +1 -1
- package/dist-server/index.d.ts +6 -6
- package/dist-server/index.js +10 -10
- package/dist-server/index.js.map +1 -1
- package/dist-server/routers/scenario-schedule-callback-router.js +2 -2
- package/dist-server/routers/scenario-schedule-callback-router.js.map +1 -1
- package/dist-server/routes.js +8 -7
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/analysis/analysis-query.d.ts +3 -0
- package/dist-server/service/analysis/analysis-query.js +6 -1
- package/dist-server/service/analysis/analysis-query.js.map +1 -1
- package/dist-server/service/connection/connection-mutation.d.ts +3 -1
- package/dist-server/service/connection/connection-mutation.js +69 -21
- package/dist-server/service/connection/connection-mutation.js.map +1 -1
- package/dist-server/service/connection/connection-query.d.ts +3 -0
- package/dist-server/service/connection/connection-query.js +22 -6
- package/dist-server/service/connection/connection-query.js.map +1 -1
- package/dist-server/service/connection/connection-subscription.js +14 -8
- package/dist-server/service/connection/connection-subscription.js.map +1 -1
- package/dist-server/service/connection/connection-type.d.ts +15 -4
- package/dist-server/service/connection/connection-type.js +78 -58
- package/dist-server/service/connection/connection-type.js.map +1 -1
- package/dist-server/service/connector/connector-query.d.ts +4 -1
- package/dist-server/service/connector/connector-query.js +8 -5
- package/dist-server/service/connector/connector-query.js.map +1 -1
- package/dist-server/service/connector/connector-type.js +12 -9
- package/dist-server/service/connector/connector-type.js.map +1 -1
- package/dist-server/service/payload-log/payload-log-mutation.js +30 -12
- package/dist-server/service/payload-log/payload-log-mutation.js.map +1 -1
- package/dist-server/service/payload-log/payload-log-query.d.ts +3 -0
- package/dist-server/service/payload-log/payload-log-query.js +5 -2
- package/dist-server/service/payload-log/payload-log-query.js.map +1 -1
- package/dist-server/service/payload-log/payload-log-type.js +11 -11
- package/dist-server/service/payload-log/payload-log-type.js.map +1 -1
- package/dist-server/service/payload-log/payload-log.d.ts +1 -1
- package/dist-server/service/payload-log/payload-log.js +18 -14
- package/dist-server/service/payload-log/payload-log.js.map +1 -1
- package/dist-server/service/property-spec.js +12 -7
- package/dist-server/service/property-spec.js.map +1 -1
- package/dist-server/service/scenario/scenario-mutation.js +71 -26
- package/dist-server/service/scenario/scenario-mutation.js.map +1 -1
- package/dist-server/service/scenario/scenario-query.d.ts +3 -0
- package/dist-server/service/scenario/scenario-query.js +7 -5
- package/dist-server/service/scenario/scenario-query.js.map +1 -1
- package/dist-server/service/scenario/scenario-type.js +27 -24
- package/dist-server/service/scenario/scenario-type.js.map +1 -1
- package/dist-server/service/scenario/scenario.js +27 -24
- package/dist-server/service/scenario/scenario.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-mutation.js +8 -3
- package/dist-server/service/scenario-instance/scenario-instance-mutation.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-query.d.ts +3 -0
- package/dist-server/service/scenario-instance/scenario-instance-query.js +5 -2
- package/dist-server/service/scenario-instance/scenario-instance-query.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-subscription.js +10 -9
- package/dist-server/service/scenario-instance/scenario-instance-subscription.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-type.js +76 -71
- package/dist-server/service/scenario-instance/scenario-instance-type.js.map +1 -1
- package/dist-server/service/scenario-queue/scenario-queue-subscription.js +4 -4
- package/dist-server/service/scenario-queue/scenario-queue-subscription.js.map +1 -1
- package/dist-server/service/scenario-queue/scenario-queue-type.js +8 -8
- package/dist-server/service/scenario-queue/scenario-queue-type.js.map +1 -1
- package/dist-server/service/state-register/data-resolver.js +3 -4
- package/dist-server/service/state-register/data-resolver.js.map +1 -1
- package/dist-server/service/state-register/state-register-mutation.js +41 -16
- package/dist-server/service/state-register/state-register-mutation.js.map +1 -1
- package/dist-server/service/state-register/state-register-query.d.ts +3 -0
- package/dist-server/service/state-register/state-register-query.js +7 -4
- package/dist-server/service/state-register/state-register-query.js.map +1 -1
- package/dist-server/service/state-register/state-register-type.js +3 -3
- package/dist-server/service/state-register/state-register-type.js.map +1 -1
- package/dist-server/service/state-register/state-register.js +4 -2
- package/dist-server/service/state-register/state-register.js.map +1 -1
- package/dist-server/service/step/step-mutation.js +13 -5
- package/dist-server/service/step/step-mutation.js.map +1 -1
- package/dist-server/service/step/step-query.d.ts +3 -0
- package/dist-server/service/step/step-query.js +5 -2
- package/dist-server/service/step/step-query.js.map +1 -1
- package/dist-server/service/step/step-type.d.ts +11 -3
- package/dist-server/service/step/step-type.js +54 -35
- package/dist-server/service/step/step-type.js.map +1 -1
- package/dist-server/service/task-type/task-type-query.js +5 -3
- package/dist-server/service/task-type/task-type-query.js.map +1 -1
- package/dist-server/service/task-type/task-type-type.js +12 -9
- package/dist-server/service/task-type/task-type-type.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/integration/task/headless-scrap.ja.md +11 -4
- package/helps/integration/task/headless-scrap.ko.md +12 -5
- package/helps/integration/task/headless-scrap.md +10 -3
- package/helps/integration/task/headless-scrap.ms.md +9 -2
- package/helps/integration/task/headless-scrap.zh.md +9 -2
- package/package.json +12 -12
- package/translations/en.json +6 -1
- package/translations/ja.json +6 -1
- package/translations/ko.json +6 -1
- package/translations/ms.json +6 -1
- package/translations/zh.json +6 -1
@@ -9,14 +9,16 @@ const env_1 = require("@things-factory/env");
|
|
9
9
|
const shell_1 = require("@things-factory/shell");
|
10
10
|
const engine_1 = require("../../engine");
|
11
11
|
const proxy_connector_1 = require("../../engine/connector/proxy-connector");
|
12
|
+
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
13
|
+
const DATABASE_TYPE = ORMCONFIG.type;
|
12
14
|
var ConnectionStatus;
|
13
15
|
(function (ConnectionStatus) {
|
14
16
|
ConnectionStatus["CONNECTED"] = "CONNECTED";
|
15
|
-
ConnectionStatus["DISCONNECTED"] = "DISCONNECTED";
|
17
|
+
ConnectionStatus["DISCONNECTED"] = "DISCONNECTED"; // Represents a terminated or inactive connection.
|
16
18
|
})(ConnectionStatus || (exports.ConnectionStatus = ConnectionStatus = {}));
|
17
19
|
(0, type_graphql_1.registerEnumType)(ConnectionStatus, {
|
18
20
|
name: 'ConnectionStatus',
|
19
|
-
description: '
|
21
|
+
description: 'Enumeration of possible states for a connection.'
|
20
22
|
});
|
21
23
|
let Connection = class Connection {
|
22
24
|
/**
|
@@ -26,14 +28,10 @@ let Connection = class Connection {
|
|
26
28
|
async connect() {
|
27
29
|
const { type, edge } = this;
|
28
30
|
const connector = edge ? proxy_connector_1.ProxyConnector.instance : engine_1.ConnectionManager.getConnector(type);
|
29
|
-
|
30
|
-
|
31
|
-
params
|
32
|
-
}
|
33
|
-
catch (ex) {
|
34
|
-
env_1.logger.error(`connection '${this.name}' params should be JSON format`, ex);
|
35
|
-
}
|
36
|
-
await connector.connect(Object.assign(Object.assign({}, this), { params }));
|
31
|
+
await connector.connect({
|
32
|
+
...this,
|
33
|
+
params: this.params || {}
|
34
|
+
});
|
37
35
|
}
|
38
36
|
/**
|
39
37
|
* @brief Asynchronous method to disconnect the connection.
|
@@ -52,12 +50,12 @@ let Connection = class Connection {
|
|
52
50
|
exports.Connection = Connection;
|
53
51
|
tslib_1.__decorate([
|
54
52
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
55
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
53
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the connection.' }),
|
56
54
|
tslib_1.__metadata("design:type", String)
|
57
55
|
], Connection.prototype, "id", void 0);
|
58
56
|
tslib_1.__decorate([
|
59
57
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
60
|
-
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true }),
|
58
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain to which this connection belongs.' }),
|
61
59
|
tslib_1.__metadata("design:type", shell_1.Domain
|
62
60
|
/**
|
63
61
|
* Stores the ID of the associated Domain.
|
@@ -70,24 +68,24 @@ tslib_1.__decorate([
|
|
70
68
|
], Connection.prototype, "domainId", void 0);
|
71
69
|
tslib_1.__decorate([
|
72
70
|
(0, typeorm_1.Column)(),
|
73
|
-
(0, type_graphql_1.Field)(),
|
71
|
+
(0, type_graphql_1.Field)({ description: 'The name of the connection.' }),
|
74
72
|
tslib_1.__metadata("design:type", String)
|
75
73
|
], Connection.prototype, "name", void 0);
|
76
74
|
tslib_1.__decorate([
|
77
75
|
(0, typeorm_1.Column)({
|
78
76
|
nullable: true
|
79
77
|
}),
|
80
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
78
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description of the connection.' }),
|
81
79
|
tslib_1.__metadata("design:type", String)
|
82
80
|
], Connection.prototype, "description", void 0);
|
83
81
|
tslib_1.__decorate([
|
84
82
|
(0, typeorm_1.Column)(),
|
85
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
83
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The type of the connection (e.g., tcp, http, mqtt).' }),
|
86
84
|
tslib_1.__metadata("design:type", String)
|
87
85
|
], Connection.prototype, "type", void 0);
|
88
86
|
tslib_1.__decorate([
|
89
87
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.Appliance, { nullable: true }),
|
90
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
88
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The edge appliance that delegates this connection, if any.' }),
|
91
89
|
tslib_1.__metadata("design:type", auth_base_1.Appliance
|
92
90
|
/**
|
93
91
|
* Stores the ID of the Appliance who delegate the connection.
|
@@ -100,26 +98,45 @@ tslib_1.__decorate([
|
|
100
98
|
], Connection.prototype, "edgeId", void 0);
|
101
99
|
tslib_1.__decorate([
|
102
100
|
(0, typeorm_1.Column)(),
|
103
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
101
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The endpoint URL or address for the connection.' }),
|
104
102
|
tslib_1.__metadata("design:type", String)
|
105
103
|
], Connection.prototype, "endpoint", void 0);
|
106
104
|
tslib_1.__decorate([
|
107
105
|
(0, typeorm_1.Column)({ nullable: true }),
|
108
|
-
(0, type_graphql_1.Field)({
|
106
|
+
(0, type_graphql_1.Field)({
|
107
|
+
nullable: true,
|
108
|
+
description: 'Indicates whether the connection is currently active and should be maintained.'
|
109
|
+
}),
|
109
110
|
tslib_1.__metadata("design:type", Boolean)
|
110
111
|
], Connection.prototype, "active", void 0);
|
111
112
|
tslib_1.__decorate([
|
112
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
113
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The current status of the connection (e.g., CONNECTED, DISCONNECTED).' }),
|
113
114
|
tslib_1.__metadata("design:type", String)
|
114
115
|
], Connection.prototype, "state", void 0);
|
115
116
|
tslib_1.__decorate([
|
116
|
-
(0, typeorm_1.Column)({
|
117
|
-
|
118
|
-
|
117
|
+
(0, typeorm_1.Column)({
|
118
|
+
type: DATABASE_TYPE == 'postgres' ? 'varchar' : 'simple-json',
|
119
|
+
nullable: true,
|
120
|
+
transformer: DATABASE_TYPE == 'postgres'
|
121
|
+
? {
|
122
|
+
to: (value) => JSON.stringify(value),
|
123
|
+
from: (value) => {
|
124
|
+
try {
|
125
|
+
return JSON.parse(value);
|
126
|
+
}
|
127
|
+
catch (error) {
|
128
|
+
return null;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
: undefined
|
133
|
+
}),
|
134
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'A key-value map of parameters for the connection.' }),
|
135
|
+
tslib_1.__metadata("design:type", Object)
|
119
136
|
], Connection.prototype, "params", void 0);
|
120
137
|
tslib_1.__decorate([
|
121
138
|
(0, typeorm_1.CreateDateColumn)(),
|
122
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
139
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the connection was created.' }),
|
123
140
|
tslib_1.__metadata("design:type", Date
|
124
141
|
/**
|
125
142
|
* The date and time when the connection was last updated.
|
@@ -128,7 +145,7 @@ tslib_1.__decorate([
|
|
128
145
|
], Connection.prototype, "createdAt", void 0);
|
129
146
|
tslib_1.__decorate([
|
130
147
|
(0, typeorm_1.UpdateDateColumn)(),
|
131
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
148
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the connection was last updated.' }),
|
132
149
|
tslib_1.__metadata("design:type", Date
|
133
150
|
/**
|
134
151
|
* Many-to-One relationship with the User entity who created the connection. Optional field.
|
@@ -137,7 +154,7 @@ tslib_1.__decorate([
|
|
137
154
|
], Connection.prototype, "updatedAt", void 0);
|
138
155
|
tslib_1.__decorate([
|
139
156
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
140
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
157
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The user who created the connection.' }),
|
141
158
|
tslib_1.__metadata("design:type", auth_base_1.User
|
142
159
|
/**
|
143
160
|
* Stores the ID of the User who created the connection.
|
@@ -150,7 +167,7 @@ tslib_1.__decorate([
|
|
150
167
|
], Connection.prototype, "creatorId", void 0);
|
151
168
|
tslib_1.__decorate([
|
152
169
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
153
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
170
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The user who last updated the connection.' }),
|
154
171
|
tslib_1.__metadata("design:type", auth_base_1.User
|
155
172
|
/**
|
156
173
|
* Stores the ID of the User who last updated the connection.
|
@@ -165,130 +182,133 @@ tslib_1.__decorate([
|
|
165
182
|
exports.Connection = Connection = tslib_1.__decorate([
|
166
183
|
(0, typeorm_1.Entity)(),
|
167
184
|
(0, typeorm_1.Index)('ix_connection_0', (connection) => [connection.domain, connection.name], { unique: true }),
|
168
|
-
(0, type_graphql_1.ObjectType)()
|
185
|
+
(0, type_graphql_1.ObjectType)({ description: 'Represents a configured connection to an external system or service.' })
|
169
186
|
], Connection);
|
170
187
|
let ConnectionState = class ConnectionState {
|
171
188
|
};
|
172
189
|
exports.ConnectionState = ConnectionState;
|
173
190
|
tslib_1.__decorate([
|
174
|
-
(0, type_graphql_1.Field)(type => shell_1.Domain),
|
191
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { description: 'The domain of the connection.' }),
|
175
192
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
176
193
|
], ConnectionState.prototype, "domain", void 0);
|
177
194
|
tslib_1.__decorate([
|
178
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
195
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The unique identifier of the connection.' }),
|
179
196
|
tslib_1.__metadata("design:type", String)
|
180
197
|
], ConnectionState.prototype, "id", void 0);
|
181
198
|
tslib_1.__decorate([
|
182
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
199
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The name of the connection.' }),
|
183
200
|
tslib_1.__metadata("design:type", String)
|
184
201
|
], ConnectionState.prototype, "name", void 0);
|
185
202
|
tslib_1.__decorate([
|
186
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
203
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The description of the connection.' }),
|
187
204
|
tslib_1.__metadata("design:type", String)
|
188
205
|
], ConnectionState.prototype, "description", void 0);
|
189
206
|
tslib_1.__decorate([
|
190
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
207
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The type of the connection.' }),
|
191
208
|
tslib_1.__metadata("design:type", String)
|
192
209
|
], ConnectionState.prototype, "type", void 0);
|
193
210
|
tslib_1.__decorate([
|
194
|
-
(0, type_graphql_1.Field)(type => auth_base_1.Appliance, { nullable: true }),
|
211
|
+
(0, type_graphql_1.Field)(type => auth_base_1.Appliance, { nullable: true, description: 'The edge appliance associated with the connection.' }),
|
195
212
|
tslib_1.__metadata("design:type", auth_base_1.Appliance)
|
196
213
|
], ConnectionState.prototype, "edge", void 0);
|
197
214
|
tslib_1.__decorate([
|
198
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
215
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The current status of the connection.' }),
|
199
216
|
tslib_1.__metadata("design:type", String)
|
200
217
|
], ConnectionState.prototype, "state", void 0);
|
201
218
|
tslib_1.__decorate([
|
202
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
219
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when this state was recorded.' }),
|
203
220
|
tslib_1.__metadata("design:type", Date)
|
204
221
|
], ConnectionState.prototype, "timestamp", void 0);
|
205
222
|
exports.ConnectionState = ConnectionState = tslib_1.__decorate([
|
206
|
-
(0, type_graphql_1.ObjectType)()
|
223
|
+
(0, type_graphql_1.ObjectType)({ description: 'Represents the state of a connection at a point in time.' })
|
207
224
|
], ConnectionState);
|
208
225
|
let NewConnection = class NewConnection {
|
209
226
|
};
|
210
227
|
exports.NewConnection = NewConnection;
|
211
228
|
tslib_1.__decorate([
|
212
|
-
(0, type_graphql_1.Field)(),
|
229
|
+
(0, type_graphql_1.Field)({ description: 'The name for the new connection.' }),
|
213
230
|
tslib_1.__metadata("design:type", String)
|
214
231
|
], NewConnection.prototype, "name", void 0);
|
215
232
|
tslib_1.__decorate([
|
216
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
233
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description for the new connection.' }),
|
217
234
|
tslib_1.__metadata("design:type", String)
|
218
235
|
], NewConnection.prototype, "description", void 0);
|
219
236
|
tslib_1.__decorate([
|
220
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
237
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The type of the new connection (e.g., tcp, http, mqtt).' }),
|
221
238
|
tslib_1.__metadata("design:type", String)
|
222
239
|
], NewConnection.prototype, "type", void 0);
|
223
240
|
tslib_1.__decorate([
|
224
|
-
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true }),
|
241
|
+
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'Reference to the edge appliance for the new connection.' }),
|
225
242
|
tslib_1.__metadata("design:type", auth_base_1.Appliance)
|
226
243
|
], NewConnection.prototype, "edge", void 0);
|
227
244
|
tslib_1.__decorate([
|
228
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
245
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The endpoint URL or address for the new connection.' }),
|
229
246
|
tslib_1.__metadata("design:type", String)
|
230
247
|
], NewConnection.prototype, "endpoint", void 0);
|
231
248
|
tslib_1.__decorate([
|
232
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
233
|
-
tslib_1.__metadata("design:type",
|
249
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'A key-value map of parameters for the new connection.' }),
|
250
|
+
tslib_1.__metadata("design:type", Object)
|
234
251
|
], NewConnection.prototype, "params", void 0);
|
235
252
|
exports.NewConnection = NewConnection = tslib_1.__decorate([
|
236
|
-
(0, type_graphql_1.InputType)()
|
253
|
+
(0, type_graphql_1.InputType)({ description: 'Input for creating a new connection.' })
|
237
254
|
], NewConnection);
|
238
255
|
let ConnectionPatch = class ConnectionPatch {
|
239
256
|
};
|
240
257
|
exports.ConnectionPatch = ConnectionPatch;
|
241
258
|
tslib_1.__decorate([
|
242
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
259
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The unique identifier of the connection to update.' }),
|
243
260
|
tslib_1.__metadata("design:type", String)
|
244
261
|
], ConnectionPatch.prototype, "id", void 0);
|
245
262
|
tslib_1.__decorate([
|
246
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
263
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new name for the connection.' }),
|
247
264
|
tslib_1.__metadata("design:type", String)
|
248
265
|
], ConnectionPatch.prototype, "name", void 0);
|
249
266
|
tslib_1.__decorate([
|
250
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
267
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new description for the connection.' }),
|
251
268
|
tslib_1.__metadata("design:type", String)
|
252
269
|
], ConnectionPatch.prototype, "description", void 0);
|
253
270
|
tslib_1.__decorate([
|
254
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
271
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new type for the connection.' }),
|
255
272
|
tslib_1.__metadata("design:type", String)
|
256
273
|
], ConnectionPatch.prototype, "type", void 0);
|
257
274
|
tslib_1.__decorate([
|
258
|
-
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true }),
|
275
|
+
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'The new edge appliance for the connection.' }),
|
259
276
|
tslib_1.__metadata("design:type", auth_base_1.Appliance)
|
260
277
|
], ConnectionPatch.prototype, "edge", void 0);
|
261
278
|
tslib_1.__decorate([
|
262
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
279
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new endpoint for the connection.' }),
|
263
280
|
tslib_1.__metadata("design:type", String)
|
264
281
|
], ConnectionPatch.prototype, "endpoint", void 0);
|
265
282
|
tslib_1.__decorate([
|
266
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
283
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The new active status for the connection.' }),
|
267
284
|
tslib_1.__metadata("design:type", Boolean)
|
268
285
|
], ConnectionPatch.prototype, "active", void 0);
|
269
286
|
tslib_1.__decorate([
|
270
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
271
|
-
tslib_1.__metadata("design:type",
|
287
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'The new parameters for the connection.' }),
|
288
|
+
tslib_1.__metadata("design:type", Object)
|
272
289
|
], ConnectionPatch.prototype, "params", void 0);
|
273
290
|
tslib_1.__decorate([
|
274
|
-
(0, type_graphql_1.Field)({
|
291
|
+
(0, type_graphql_1.Field)({
|
292
|
+
nullable: true,
|
293
|
+
description: 'A flag indicating whether the connection is being created, updated, or deleted.'
|
294
|
+
}),
|
275
295
|
tslib_1.__metadata("design:type", String)
|
276
296
|
], ConnectionPatch.prototype, "cuFlag", void 0);
|
277
297
|
exports.ConnectionPatch = ConnectionPatch = tslib_1.__decorate([
|
278
|
-
(0, type_graphql_1.InputType)()
|
298
|
+
(0, type_graphql_1.InputType)({ description: 'Input for updating (patching) an existing connection.' })
|
279
299
|
], ConnectionPatch);
|
280
300
|
let ConnectionList = class ConnectionList {
|
281
301
|
};
|
282
302
|
exports.ConnectionList = ConnectionList;
|
283
303
|
tslib_1.__decorate([
|
284
|
-
(0, type_graphql_1.Field)(type => [Connection]),
|
304
|
+
(0, type_graphql_1.Field)(type => [Connection], { description: 'The list of connection items.' }),
|
285
305
|
tslib_1.__metadata("design:type", Array)
|
286
306
|
], ConnectionList.prototype, "items", void 0);
|
287
307
|
tslib_1.__decorate([
|
288
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
308
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'The total number of connections.' }),
|
289
309
|
tslib_1.__metadata("design:type", Number)
|
290
310
|
], ConnectionList.prototype, "total", void 0);
|
291
311
|
exports.ConnectionList = ConnectionList = tslib_1.__decorate([
|
292
|
-
(0, type_graphql_1.ObjectType)()
|
312
|
+
(0, type_graphql_1.ObjectType)({ description: 'A paginated list of connections.' })
|
293
313
|
], ConnectionList);
|
294
314
|
//# sourceMappingURL=connection-type.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"connection-type.js","sourceRoot":"","sources":["../../../server/service/connection/connection-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAsF;AACtF,qCASgB;AAEhB,yDAA2D;AAC3D,6CAA4C;AAC5C,iDAAyD;AAEzD,yCAAgD;AAChD,4EAAuE;AAEvE,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,2CAAuB,CAAA;IACvB,iDAA6B,CAAA;AAC/B,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAA,+BAAgB,EAAC,gBAAgB,EAAE;IACjC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,mCAAmC;CACjD,CAAC,CAAA;AAKK,IAAM,UAAU,GAAhB,MAAM,UAAU;IA8HrB;;;OAGG;IACH,KA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ateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { User, Appliance } from '@things-factory/auth-base'\nimport { logger } from '@things-factory/env'\nimport { Domain, ObjectRef } from '@things-factory/shell'\n\nimport { ConnectionManager } from '../../engine'\nimport { ProxyConnector } from '../../engine/connector/proxy-connector'\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 /**\n * Unique identifier for the connection, generated in UUID format.\n */\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n /**\n * Many-to-One relationship with the Domain entity.\n */\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true })\n domain: Domain\n\n /**\n * Stores the ID of the associated Domain.\n */\n @RelationId((connection: Connection) => connection.domain)\n domainId: string\n\n /**\n * The name of the connection.\n */\n @Column()\n @Field()\n name: string\n\n /**\n * Optional description for the connection.\n */\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n description: string\n\n /**\n * The type of the connection.\n */\n @Column()\n @Field({ nullable: true })\n type: string\n\n /**\n * Many-to-One relationship with the Appliance entity which delegate the connection. Optional field.\n */\n @ManyToOne(type => Appliance, { nullable: true })\n @Field({ nullable: true })\n edge: Appliance\n\n /**\n * Stores the ID of the Appliance who delegate the connection.\n */\n @RelationId((connection: Connection) => connection.edge)\n edgeId: string\n\n /**\n * The endpoint for the connection.\n */\n @Column()\n @Field({ nullable: true })\n endpoint: string\n\n /**\n * Indicates the active status of the connection.\n */\n @Column({ nullable: true })\n @Field({ nullable: true })\n active: boolean\n\n /**\n * The status of the connection, using the ConnectionStatus type.\n */\n @Field({ nullable: true })\n state: ConnectionStatus\n\n /**\n * Additional parameters for the connection, stored as a JSON string.\n */\n @Column({ nullable: true })\n @Field({ nullable: true })\n params: string\n\n /**\n * The date and time when the connection was created.\n */\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt: Date\n\n /**\n * The date and time when the connection was last updated.\n */\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt: Date\n\n /**\n * Many-to-One relationship with the User entity who created the connection. Optional field.\n */\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n creator: User\n\n /**\n * Stores the ID of the User who created the connection.\n */\n @RelationId((connection: Connection) => connection.creator)\n creatorId: string\n\n /**\n * Many-to-One relationship with the User entity who last updated the connection.\n * Optional field.\n */\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n updater: User\n\n /**\n * Stores the ID of the User who last updated the connection.\n *\n */\n @RelationId((connection: Connection) => connection.updater)\n updaterId: string\n\n /**\n * Asynchronous method to establish the connection.\n *\n */\n async connect() {\n const { type, edge } = this\n const connector = edge ? ProxyConnector.instance : ConnectionManager.getConnector(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 /**\n * @brief Asynchronous method to disconnect the connection.\n *\n */\n async disconnect() {\n try {\n const { type, edge } = this\n const connector = edge ? ProxyConnector.instance : ConnectionManager.getConnector(type)\n await connector.disconnect(this)\n } finally {\n }\n }\n}\n\n/**\n * Connection의 params의 원 타입과 사용 시에 타입 불일치로 인해 임시적으로 생성한 타입으로\n * 추후, 타입 일치를 통해서 제거할 예정임.\n *\n */\nexport interface InputConnection extends Connection {\n params: any\n}\n\n@ObjectType()\nexport class ConnectionState {\n @Field(type => Domain)\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(type => Appliance, { nullable: true })\n edge?: Appliance\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(type => ObjectRef, { nullable: true })\n edge?: Appliance\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(type => ObjectRef, { nullable: true })\n edge?: Appliance\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({ nullable: true })\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
|
+
{"version":3,"file":"connection-type.js","sourceRoot":"","sources":["../../../server/service/connection/connection-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAsF;AACtF,qCASgB;AAEhB,yDAA2D;AAC3D,6CAA4C;AAC5C,iDAAuE;AAEvE,yCAAgD;AAChD,4EAAuE;AAEvE,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAEpC,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,2CAAuB,CAAA;IACvB,iDAA6B,CAAA,CAAC,kDAAkD;AAClF,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAA,+BAAgB,EAAC,gBAAgB,EAAE;IACjC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kDAAkD;CAChE,CAAC,CAAA;AAKK,IAAM,UAAU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,uDAAuD,EAAE,CAAC;GACvE,eAAe,CA8B3B;AAGM,IAAM,cAAc,GAApB,MAAM,cAAc;CAM1B,CAAA;AANY,wCAAc;AAEzB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;;6CAC3D;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;;6CAC3D;yBALF,cAAc;IAD1B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;GACnD,cAAc,CAM1B","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, Appliance } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain, ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { ConnectionManager } from '../../engine'\nimport { ProxyConnector } from '../../engine/connector/proxy-connector'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\nexport enum ConnectionStatus {\n CONNECTED = 'CONNECTED', // Represents an active, established connection.\n DISCONNECTED = 'DISCONNECTED' // Represents a terminated or inactive connection.\n}\n\nregisterEnumType(ConnectionStatus, {\n name: 'ConnectionStatus',\n description: 'Enumeration of possible states for a connection.'\n})\n\n@Entity()\n@Index('ix_connection_0', (connection: Connection) => [connection.domain, connection.name], { unique: true })\n@ObjectType({ description: 'Represents a configured connection to an external system or service.' })\nexport class Connection {\n /**\n * Unique identifier for the connection, generated in UUID format.\n */\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier for the connection.' })\n readonly id: string\n\n /**\n * Many-to-One relationship with the Domain entity.\n */\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain to which this connection belongs.' })\n domain: Domain\n\n /**\n * Stores the ID of the associated Domain.\n */\n @RelationId((connection: Connection) => connection.domain)\n domainId: string\n\n /**\n * The name of the connection.\n */\n @Column()\n @Field({ description: 'The name of the connection.' })\n name: string\n\n /**\n * Optional description for the connection.\n */\n @Column({\n nullable: true\n })\n @Field({ nullable: true, description: 'A detailed description of the connection.' })\n description: string\n\n /**\n * The type of the connection.\n */\n @Column()\n @Field({ nullable: true, description: 'The type of the connection (e.g., tcp, http, mqtt).' })\n type: string\n\n /**\n * Many-to-One relationship with the Appliance entity which delegate the connection. Optional field.\n */\n @ManyToOne(type => Appliance, { nullable: true })\n @Field({ nullable: true, description: 'The edge appliance that delegates this connection, if any.' })\n edge: Appliance\n\n /**\n * Stores the ID of the Appliance who delegate the connection.\n */\n @RelationId((connection: Connection) => connection.edge)\n edgeId: string\n\n /**\n * The endpoint for the connection.\n */\n @Column()\n @Field({ nullable: true, description: 'The endpoint URL or address for the connection.' })\n endpoint: string\n\n /**\n * Indicates the active status of the connection.\n */\n @Column({ nullable: true })\n @Field({\n nullable: true,\n description: 'Indicates whether the connection is currently active and should be maintained.'\n })\n active: boolean\n\n /**\n * The status of the connection, using the ConnectionStatus type.\n */\n @Field({ nullable: true, description: 'The current status of the connection (e.g., CONNECTED, DISCONNECTED).' })\n state: ConnectionStatus\n\n /**\n * Additional parameters for the connection, stored as a JSON string.\n *\n * [Caution]\n * 이 컬럼타입은 postgres 데이터베이스에서는 varchar 타입을 유지한다.\n * 이는 데이터베이스 타입을 변경하면 기존 데이터가 손실될 수 있기 때문이다.\n * 'simple-json' 타입으로 변경 전에 postgres 데이타베이스에 이미 varchar 타입으로 사용한 사례가 많기 때문이다.\n */\n @Column({\n type: DATABASE_TYPE == 'postgres' ? 'varchar' : 'simple-json',\n nullable: true,\n transformer:\n DATABASE_TYPE == 'postgres'\n ? {\n to: (value: any) => JSON.stringify(value),\n from: (value: string) => {\n try {\n return JSON.parse(value)\n } catch (error) {\n return null\n }\n }\n }\n : undefined\n })\n @Field(type => ScalarObject, { nullable: true, description: 'A key-value map of parameters for the connection.' })\n params: { [key: string]: any }\n\n /**\n * The date and time when the connection was created.\n */\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the connection was created.' })\n createdAt: Date\n\n /**\n * The date and time when the connection was last updated.\n */\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The timestamp when the connection was last updated.' })\n updatedAt: Date\n\n /**\n * Many-to-One relationship with the User entity who created the connection. Optional field.\n */\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true, description: 'The user who created the connection.' })\n creator: User\n\n /**\n * Stores the ID of the User who created the connection.\n */\n @RelationId((connection: Connection) => connection.creator)\n creatorId: string\n\n /**\n * Many-to-One relationship with the User entity who last updated the connection.\n * Optional field.\n */\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true, description: 'The user who last updated the connection.' })\n updater: User\n\n /**\n * Stores the ID of the User who last updated the connection.\n *\n */\n @RelationId((connection: Connection) => connection.updater)\n updaterId: string\n\n /**\n * Asynchronous method to establish the connection.\n *\n */\n async connect() {\n const { type, edge } = this\n const connector = edge ? ProxyConnector.instance : ConnectionManager.getConnector(type)\n\n await connector.connect({\n ...this,\n params: this.params || {}\n })\n }\n\n /**\n * @brief Asynchronous method to disconnect the connection.\n *\n */\n async disconnect() {\n try {\n const { type, edge } = this\n const connector = edge ? ProxyConnector.instance : ConnectionManager.getConnector(type)\n await connector.disconnect(this)\n } finally {\n }\n }\n}\n\n/**\n * Connection의 params의 원 타입과 사용 시에 타입 불일치로 인해 임시적으로 생성한 타입으로\n * 추후, 타입 일치를 통해서 제거할 예정임.\n *\n */\nexport interface InputConnection extends Connection {\n params: any\n}\n\n@ObjectType({ description: 'Represents the state of a connection at a point in time.' })\nexport class ConnectionState {\n @Field(type => Domain, { description: 'The domain of the connection.' })\n domain?: Domain\n\n @Field({ nullable: true, description: 'The unique identifier of the connection.' })\n id?: string\n\n @Field({ nullable: true, description: 'The name of the connection.' })\n name?: string\n\n @Field({ nullable: true, description: 'The description of the connection.' })\n description?: string\n\n @Field({ nullable: true, description: 'The type of the connection.' })\n type?: string\n\n @Field(type => Appliance, { nullable: true, description: 'The edge appliance associated with the connection.' })\n edge?: Appliance\n\n @Field({ nullable: true, description: 'The current status of the connection.' })\n state?: ConnectionStatus\n\n @Field({ nullable: true, description: 'The timestamp when this state was recorded.' })\n timestamp?: Date\n}\n\n@InputType({ description: 'Input for creating a new connection.' })\nexport class NewConnection {\n @Field({ description: 'The name for the new connection.' })\n name: string\n\n @Field({ nullable: true, description: 'A detailed description for the new connection.' })\n description?: string\n\n @Field({ nullable: true, description: 'The type of the new connection (e.g., tcp, http, mqtt).' })\n type?: string\n\n @Field(type => ObjectRef, { nullable: true, description: 'Reference to the edge appliance for the new connection.' })\n edge?: Appliance\n\n @Field({ nullable: true, description: 'The endpoint URL or address for the new connection.' })\n endpoint?: string\n\n @Field(type => ScalarObject, { nullable: true, description: 'A key-value map of parameters for the new connection.' })\n params?: { [key: string]: any }\n}\n\n@InputType({ description: 'Input for updating (patching) an existing connection.' })\nexport class ConnectionPatch {\n @Field(type => ID, { nullable: true, description: 'The unique identifier of the connection to update.' })\n id: string\n\n @Field({ nullable: true, description: 'The new name for the connection.' })\n name?: string\n\n @Field({ nullable: true, description: 'The new description for the connection.' })\n description?: string\n\n @Field({ nullable: true, description: 'The new type for the connection.' })\n type?: string\n\n @Field(type => ObjectRef, { nullable: true, description: 'The new edge appliance for the connection.' })\n edge?: Appliance\n\n @Field({ nullable: true, description: 'The new endpoint for the connection.' })\n endpoint?: string\n\n @Field({ nullable: true, description: 'The new active status for the connection.' })\n active?: boolean\n\n @Field(type => ScalarObject, { nullable: true, description: 'The new parameters for the connection.' })\n params?: { [key: string]: any }\n\n @Field({\n nullable: true,\n description: 'A flag indicating whether the connection is being created, updated, or deleted.'\n })\n cuFlag?: string\n}\n\n@ObjectType({ description: 'A paginated list of connections.' })\nexport class ConnectionList {\n @Field(type => [Connection], { description: 'The list of connection items.' })\n items: Connection[]\n\n @Field(type => Int, { description: 'The total number of connections.' })\n total: number\n}\n"]}
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import { ConnectorList, ConnectorType } from './connector-type';
|
2
|
+
/**
|
3
|
+
* @description Provides GraphQL resolvers for connector types.
|
4
|
+
*/
|
2
5
|
export declare class ConnectorQuery {
|
3
|
-
|
6
|
+
connector(name: string, context: ResolverContext): Promise<ConnectorType>;
|
4
7
|
connectors(): Promise<ConnectorList>;
|
5
8
|
connectorByConnection(connectionName: string, context: ResolverContext): Promise<ConnectorType>;
|
6
9
|
}
|
@@ -7,8 +7,11 @@ const shell_1 = require("@things-factory/shell");
|
|
7
7
|
const connection_manager_1 = require("../../engine/connection-manager");
|
8
8
|
const connection_type_1 = require("../connection/connection-type");
|
9
9
|
const connector_type_1 = require("./connector-type");
|
10
|
+
/**
|
11
|
+
* @description Provides GraphQL resolvers for connector types.
|
12
|
+
*/
|
10
13
|
let ConnectorQuery = class ConnectorQuery {
|
11
|
-
async
|
14
|
+
async connector(name, context) {
|
12
15
|
// @ts-ignore
|
13
16
|
const { description, help, parameterSpec, taskPrefixes } = connection_manager_1.ConnectionManager.getConnector(name) || {};
|
14
17
|
return {
|
@@ -50,21 +53,21 @@ let ConnectorQuery = class ConnectorQuery {
|
|
50
53
|
};
|
51
54
|
exports.ConnectorQuery = ConnectorQuery;
|
52
55
|
tslib_1.__decorate([
|
53
|
-
(0, type_graphql_1.Query)(returns => connector_type_1.ConnectorType, { description: '
|
56
|
+
(0, type_graphql_1.Query)(returns => connector_type_1.ConnectorType, { description: 'Fetches a single connector type by its name.' }),
|
54
57
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
|
55
58
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
56
59
|
tslib_1.__metadata("design:type", Function),
|
57
60
|
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
58
61
|
tslib_1.__metadata("design:returntype", Promise)
|
59
|
-
], ConnectorQuery.prototype, "
|
62
|
+
], ConnectorQuery.prototype, "connector", null);
|
60
63
|
tslib_1.__decorate([
|
61
|
-
(0, type_graphql_1.Query)(returns => connector_type_1.ConnectorList, { description: '
|
64
|
+
(0, type_graphql_1.Query)(returns => connector_type_1.ConnectorList, { description: 'Fetches a list of all available connector types.' }),
|
62
65
|
tslib_1.__metadata("design:type", Function),
|
63
66
|
tslib_1.__metadata("design:paramtypes", []),
|
64
67
|
tslib_1.__metadata("design:returntype", Promise)
|
65
68
|
], ConnectorQuery.prototype, "connectors", null);
|
66
69
|
tslib_1.__decorate([
|
67
|
-
(0, type_graphql_1.Query)(returns => connector_type_1.ConnectorType, { description: '
|
70
|
+
(0, type_graphql_1.Query)(returns => connector_type_1.ConnectorType, { description: 'Fetches the connector type associated with a specific connection.' }),
|
68
71
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('connectionName')),
|
69
72
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
70
73
|
tslib_1.__metadata("design:type", Function),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"connector-query.js","sourceRoot":"","sources":["../../../server/service/connector/connector-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwD;AAExD,iDAAqD;AAErD,wEAAmE;AACnE,mEAA0D;AAC1D,qDAA+D;
|
1
|
+
{"version":3,"file":"connector-query.js","sourceRoot":"","sources":["../../../server/service/connector/connector-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwD;AAExD,iDAAqD;AAErD,wEAAmE;AACnE,mEAA0D;AAC1D,qDAA+D;AAE/D;;GAEG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAc;IAEnB,AAAN,KAAK,CAAC,SAAS,CAAc,IAAY,EAAS,OAAwB;QACxE,aAAa;QACb,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,sCAAiB,CAAC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,sCAAiB,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAS,CAAA;IAC/E,CAAC;CACF,CAAA;AApDY,wCAAc;AAEnB;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;IAChF,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+CAWhD;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,WAAW,EAAE,kDAAkD,EAAE,CAAC;;;;gDAsBpG;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,WAAW,EAAE,mEAAmE,EAAE,CAAC;IAEnH,mBAAA,IAAA,kBAAG,EAAC,gBAAgB,CAAC,CAAA;IACrB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2DASP;yBAnDU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,cAAc,CAoD1B","sourcesContent":["import { Arg, Ctx, Query, Resolver } from 'type-graphql'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { ConnectionManager } from '../../engine/connection-manager'\nimport { Connection } from '../connection/connection-type'\nimport { ConnectorList, ConnectorType } from './connector-type'\n\n/**\n * @description Provides GraphQL resolvers for connector types.\n */\n@Resolver(ConnectorType)\nexport class ConnectorQuery {\n @Query(returns => ConnectorType, { description: 'Fetches a single connector type by its name.' })\n async connector(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<ConnectorType> {\n // @ts-ignore\n const { description, help, parameterSpec, taskPrefixes } = ConnectionManager.getConnector(name) || {}\n\n return {\n name,\n description,\n help,\n parameterSpec,\n taskPrefixes: taskPrefixes || []\n }\n }\n\n @Query(returns => ConnectorList, { description: 'Fetches a list of all available connector types.' })\n async connectors(): Promise<ConnectorList> {\n var connectors = ConnectionManager.getConnectors()\n var items = Object.keys(connectors)\n .map(name => {\n var connector = connectors[name]\n return {\n name,\n description: connector.description,\n help: connector.help,\n parameterSpec: connector.parameterSpec,\n taskPrefixes: connector.taskPrefixes || []\n }\n })\n .sort((x, y) => {\n return x.name < y.name ? -1 : 1\n })\n\n return {\n items,\n total: items.length\n }\n }\n\n @Query(returns => ConnectorType, { description: 'Fetches the connector type associated with a specific connection.' })\n async connectorByConnection(\n @Arg('connectionName') connectionName: string,\n @Ctx() context: ResolverContext\n ): Promise<ConnectorType> {\n const { domain } = context.state\n\n var connection = await getRepository(Connection).findOne({\n where: { domain: { id: domain.id }, name: connectionName }\n })\n\n return connection && (ConnectionManager.getConnector(connection.type) as any)\n }\n}\n"]}
|
@@ -8,40 +8,43 @@ let ConnectorType = class ConnectorType {
|
|
8
8
|
};
|
9
9
|
exports.ConnectorType = ConnectorType;
|
10
10
|
tslib_1.__decorate([
|
11
|
-
(0, type_graphql_1.Field)(),
|
11
|
+
(0, type_graphql_1.Field)({ description: 'The unique name of the connector type.' }),
|
12
12
|
tslib_1.__metadata("design:type", String)
|
13
13
|
], ConnectorType.prototype, "name", void 0);
|
14
14
|
tslib_1.__decorate([
|
15
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
15
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A brief description of the connector.' }),
|
16
16
|
tslib_1.__metadata("design:type", String)
|
17
17
|
], ConnectorType.prototype, "description", void 0);
|
18
18
|
tslib_1.__decorate([
|
19
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
19
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A URL or text providing more detailed help information.' }),
|
20
20
|
tslib_1.__metadata("design:type", String)
|
21
21
|
], ConnectorType.prototype, "help", void 0);
|
22
22
|
tslib_1.__decorate([
|
23
|
-
(0, type_graphql_1.Field)(type => [property_spec_1.PropertySpec], {
|
23
|
+
(0, type_graphql_1.Field)(type => [property_spec_1.PropertySpec], {
|
24
|
+
nullable: true,
|
25
|
+
description: 'A list of parameters required to configure this connector type.'
|
26
|
+
}),
|
24
27
|
tslib_1.__metadata("design:type", Array)
|
25
28
|
], ConnectorType.prototype, "parameterSpec", void 0);
|
26
29
|
tslib_1.__decorate([
|
27
|
-
(0, type_graphql_1.Field)(type => [String], { nullable: true }),
|
30
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'A list of task prefixes that this connector can handle.' }),
|
28
31
|
tslib_1.__metadata("design:type", Array)
|
29
32
|
], ConnectorType.prototype, "taskPrefixes", void 0);
|
30
33
|
exports.ConnectorType = ConnectorType = tslib_1.__decorate([
|
31
|
-
(0, type_graphql_1.ObjectType)()
|
34
|
+
(0, type_graphql_1.ObjectType)({ description: 'Describes a type of connector, which handles communication for a specific protocol.' })
|
32
35
|
], ConnectorType);
|
33
36
|
let ConnectorList = class ConnectorList {
|
34
37
|
};
|
35
38
|
exports.ConnectorList = ConnectorList;
|
36
39
|
tslib_1.__decorate([
|
37
|
-
(0, type_graphql_1.Field)(type => [ConnectorType]),
|
40
|
+
(0, type_graphql_1.Field)(type => [ConnectorType], { description: 'The list of connector type items.' }),
|
38
41
|
tslib_1.__metadata("design:type", Array)
|
39
42
|
], ConnectorList.prototype, "items", void 0);
|
40
43
|
tslib_1.__decorate([
|
41
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
44
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'The total number of connector types.' }),
|
42
45
|
tslib_1.__metadata("design:type", Number)
|
43
46
|
], ConnectorList.prototype, "total", void 0);
|
44
47
|
exports.ConnectorList = ConnectorList = tslib_1.__decorate([
|
45
|
-
(0, type_graphql_1.ObjectType)()
|
48
|
+
(0, type_graphql_1.ObjectType)({ description: 'A paginated list of connector types.' })
|
46
49
|
], ConnectorList);
|
47
50
|
//# sourceMappingURL=connector-type.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"connector-type.js","sourceRoot":"","sources":["../../../server/service/connector/connector-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAqD;AACrD,oDAA+C;AAGxC,IAAM,aAAa,GAAnB,MAAM,aAAa;
|
1
|
+
{"version":3,"file":"connector-type.js","sourceRoot":"","sources":["../../../server/service/connector/connector-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAqD;AACrD,oDAA+C;AAGxC,IAAM,aAAa,GAAnB,MAAM,aAAa;CAkBzB,CAAA;AAlBY,sCAAa;AAExB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;;2CACrD;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;;kDAC7D;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,yDAAyD,EAAE,CAAC;;2CACrF;AAMb;IAJC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAY,CAAC,EAAE;QAC7B,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,iEAAiE;KAC/E,CAAC;;oDAC2B;AAG7B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,yDAAyD,EAAE,CAAC;;mDAC7F;wBAjBZ,aAAa;IADzB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qFAAqF,EAAE,CAAC;GACtG,aAAa,CAkBzB;AAGM,IAAM,aAAa,GAAnB,MAAM,aAAa;CAMzB,CAAA;AANY,sCAAa;AAExB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,EAAE,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;;4CAC/D;AAGtB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;;4CAC/D;wBALF,aAAa;IADzB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;GACvD,aAAa,CAMzB","sourcesContent":["import { ObjectType, Field, Int } from 'type-graphql'\nimport { PropertySpec } from '../property-spec'\n\n@ObjectType({ description: 'Describes a type of connector, which handles communication for a specific protocol.' })\nexport class ConnectorType {\n @Field({ description: 'The unique name of the connector type.' })\n name: string\n\n @Field({ nullable: true, description: 'A brief description of the connector.' })\n description: string\n\n @Field({ nullable: true, description: 'A URL or text providing more detailed help information.' })\n help?: string\n\n @Field(type => [PropertySpec], {\n nullable: true,\n description: 'A list of parameters required to configure this connector type.'\n })\n parameterSpec: PropertySpec[]\n\n @Field(type => [String], { nullable: true, description: 'A list of task prefixes that this connector can handle.' })\n taskPrefixes?: string[]\n}\n\n@ObjectType({ description: 'A paginated list of connector types.' })\nexport class ConnectorList {\n @Field(type => [ConnectorType], { description: 'The list of connector type items.' })\n items: ConnectorType[]\n\n @Field(type => Int, { description: 'The total number of connector types.' })\n total: number\n}\n"]}
|