@things-factory/integration-base 9.0.15 → 9.0.24
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/analyzer/analyze-integration.js +2 -2
- package/dist-server/engine/analyzer/analyze-integration.js.map +1 -1
- package/dist-server/engine/connection-manager.js +6 -4
- package/dist-server/engine/connection-manager.js.map +1 -1
- package/dist-server/engine/connector/headless-connector.d.ts +8 -0
- package/dist-server/engine/connector/headless-connector.js +4 -2
- package/dist-server/engine/connector/headless-connector.js.map +1 -1
- package/dist-server/engine/connector/mqtt-connector.d.ts +1 -0
- package/dist-server/engine/connector/mqtt-connector.js +4 -2
- package/dist-server/engine/connector/mqtt-connector.js.map +1 -1
- package/dist-server/engine/connector/mssql-connector.d.ts +4 -0
- package/dist-server/engine/connector/mssql-connector.js +4 -2
- package/dist-server/engine/connector/mssql-connector.js.map +1 -1
- package/dist-server/engine/connector/mysql-connector.d.ts +10 -2
- package/dist-server/engine/connector/mysql-connector.js +23 -18
- package/dist-server/engine/connector/mysql-connector.js.map +1 -1
- package/dist-server/engine/connector/operato-connector.d.ts +8 -2
- package/dist-server/engine/connector/operato-connector.js +2 -1
- package/dist-server/engine/connector/operato-connector.js.map +1 -1
- package/dist-server/engine/connector/oracle-connector.d.ts +3 -0
- package/dist-server/engine/connector/oracle-connector.js +4 -2
- package/dist-server/engine/connector/oracle-connector.js.map +1 -1
- package/dist-server/engine/connector/postgresql-connector.d.ts +13 -2
- package/dist-server/engine/connector/postgresql-connector.js +14 -6
- package/dist-server/engine/connector/postgresql-connector.js.map +1 -1
- package/dist-server/engine/connector/pyrun-connector.d.ts +1 -0
- package/dist-server/engine/connector/pyrun-connector.js +3 -3
- package/dist-server/engine/connector/pyrun-connector.js.map +1 -1
- package/dist-server/engine/edge-client.d.ts +1 -1
- package/dist-server/engine/edge-client.js.map +1 -1
- package/dist-server/service/connection/connection-mutation.d.ts +2 -1
- package/dist-server/service/connection/connection-mutation.js +19 -18
- package/dist-server/service/connection/connection-mutation.js.map +1 -1
- package/dist-server/service/connection/connection-query.d.ts +2 -1
- package/dist-server/service/connection/connection-query.js +14 -13
- package/dist-server/service/connection/connection-query.js.map +1 -1
- package/dist-server/service/connection/connection-subscription.js +5 -4
- package/dist-server/service/connection/connection-subscription.js.map +1 -1
- package/dist-server/service/connection/connection-type.d.ts +6 -99
- package/dist-server/service/connection/connection-type.js +4 -181
- package/dist-server/service/connection/connection-type.js.map +1 -1
- package/dist-server/service/connection/connection.d.ts +115 -0
- package/dist-server/service/connection/connection.js +231 -0
- package/dist-server/service/connection/connection.js.map +1 -0
- package/dist-server/service/connection/index.d.ts +1 -1
- package/dist-server/service/connection/index.js +2 -2
- package/dist-server/service/connection/index.js.map +1 -1
- package/dist-server/service/connector/connector-query.js +2 -2
- package/dist-server/service/connector/connector-query.js.map +1 -1
- package/dist-server/service/index.d.ts +1 -0
- package/dist-server/service/index.js +1 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/property-spec.d.ts +1 -0
- package/dist-server/service/property-spec.js +8 -1
- package/dist-server/service/property-spec.js.map +1 -1
- package/dist-server/service/scenario/scenario-query.js +3 -3
- package/dist-server/service/scenario/scenario-query.js.map +1 -1
- package/dist-server/service/task-type/task-type-query.js +2 -2
- package/dist-server/service/task-type/task-type-query.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
@@ -0,0 +1,115 @@
|
|
1
|
+
import { User, Appliance } from '@things-factory/auth-base';
|
2
|
+
import { Domain } from '@things-factory/shell';
|
3
|
+
export declare enum ConnectionStatus {
|
4
|
+
CONNECTED = "CONNECTED",// Represents an active, established connection.
|
5
|
+
DISCONNECTED = "DISCONNECTED"
|
6
|
+
}
|
7
|
+
export declare class Connection {
|
8
|
+
/**
|
9
|
+
* Unique identifier for the connection, generated in UUID format.
|
10
|
+
*/
|
11
|
+
readonly id: string;
|
12
|
+
/**
|
13
|
+
* Many-to-One relationship with the Domain entity.
|
14
|
+
*/
|
15
|
+
domain: Domain;
|
16
|
+
/**
|
17
|
+
* Stores the ID of the associated Domain.
|
18
|
+
*/
|
19
|
+
domainId: string;
|
20
|
+
/**
|
21
|
+
* The name of the connection.
|
22
|
+
*/
|
23
|
+
name: string;
|
24
|
+
/**
|
25
|
+
* Optional description for the connection.
|
26
|
+
*/
|
27
|
+
description: string;
|
28
|
+
/**
|
29
|
+
* The type of the connection.
|
30
|
+
*/
|
31
|
+
type: string;
|
32
|
+
/**
|
33
|
+
* Many-to-One relationship with the Appliance entity which delegate the connection. Optional field.
|
34
|
+
*/
|
35
|
+
edge: Appliance;
|
36
|
+
/**
|
37
|
+
* Stores the ID of the Appliance who delegate the connection.
|
38
|
+
*/
|
39
|
+
edgeId: string;
|
40
|
+
/**
|
41
|
+
* The endpoint for the connection.
|
42
|
+
*/
|
43
|
+
endpoint: string;
|
44
|
+
/**
|
45
|
+
* Indicates the active status of the connection.
|
46
|
+
*/
|
47
|
+
active: boolean;
|
48
|
+
/**
|
49
|
+
* The status of the connection, using the ConnectionStatus type.
|
50
|
+
*/
|
51
|
+
state: ConnectionStatus;
|
52
|
+
/**
|
53
|
+
* Additional parameters for the connection, stored as a JSON string.
|
54
|
+
*
|
55
|
+
* [Caution]
|
56
|
+
* 이 컬럼타입은 postgres 데이터베이스에서는 varchar 타입을 유지한다.
|
57
|
+
* 이는 데이터베이스 타입을 변경하면 기존 데이터가 손실될 수 있기 때문이다.
|
58
|
+
*/
|
59
|
+
params: {
|
60
|
+
[key: string]: any;
|
61
|
+
};
|
62
|
+
/**
|
63
|
+
* The date and time when the connection was created.
|
64
|
+
*/
|
65
|
+
createdAt: Date;
|
66
|
+
/**
|
67
|
+
* The date and time when the connection was last updated.
|
68
|
+
*/
|
69
|
+
updatedAt: Date;
|
70
|
+
/**
|
71
|
+
* Many-to-One relationship with the User entity who created the connection. Optional field.
|
72
|
+
*/
|
73
|
+
creator: User;
|
74
|
+
/**
|
75
|
+
* Stores the ID of the User who created the connection.
|
76
|
+
*/
|
77
|
+
creatorId: string;
|
78
|
+
/**
|
79
|
+
* Many-to-One relationship with the User entity who last updated the connection.
|
80
|
+
* Optional field.
|
81
|
+
*/
|
82
|
+
updater: User;
|
83
|
+
/**
|
84
|
+
* Stores the ID of the User who last updated the connection.
|
85
|
+
*
|
86
|
+
*/
|
87
|
+
updaterId: string;
|
88
|
+
/**
|
89
|
+
* Asynchronous method to establish the connection.
|
90
|
+
*
|
91
|
+
*/
|
92
|
+
connect(): Promise<void>;
|
93
|
+
/**
|
94
|
+
* @brief Asynchronous method to disconnect the connection.
|
95
|
+
*
|
96
|
+
*/
|
97
|
+
disconnect(): Promise<void>;
|
98
|
+
/**
|
99
|
+
* Gets a parameter value with fallback to EnvVar.
|
100
|
+
* Priority: params → EnvVar (only for useDomainAttribute=true)
|
101
|
+
*
|
102
|
+
* @param key - The parameter key
|
103
|
+
* @param defaultValue - Optional default value
|
104
|
+
* @returns The parameter value or default value
|
105
|
+
*/
|
106
|
+
getParameter(key: string, defaultValue?: any): Promise<any>;
|
107
|
+
/**
|
108
|
+
* Gets all parameters with resolved values (params + Domain attributes).
|
109
|
+
*
|
110
|
+
* @returns Object with all resolved parameter values
|
111
|
+
*/
|
112
|
+
getResolvedParameters(): Promise<{
|
113
|
+
[key: string]: any;
|
114
|
+
}>;
|
115
|
+
}
|
@@ -0,0 +1,231 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Connection = exports.ConnectionStatus = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
6
|
+
const typeorm_1 = require("typeorm");
|
7
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
8
|
+
const env_1 = require("@things-factory/env");
|
9
|
+
const shell_1 = require("@things-factory/shell");
|
10
|
+
const engine_1 = require("../../engine");
|
11
|
+
const proxy_connector_1 = require("../../engine/connector/proxy-connector");
|
12
|
+
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
13
|
+
const DATABASE_TYPE = ORMCONFIG.type;
|
14
|
+
var ConnectionStatus;
|
15
|
+
(function (ConnectionStatus) {
|
16
|
+
ConnectionStatus["CONNECTED"] = "CONNECTED";
|
17
|
+
ConnectionStatus["DISCONNECTED"] = "DISCONNECTED"; // Represents a terminated or inactive connection.
|
18
|
+
})(ConnectionStatus || (exports.ConnectionStatus = ConnectionStatus = {}));
|
19
|
+
(0, type_graphql_1.registerEnumType)(ConnectionStatus, {
|
20
|
+
name: 'ConnectionStatus',
|
21
|
+
description: 'Enumeration of possible states for a connection.'
|
22
|
+
});
|
23
|
+
let Connection = class Connection {
|
24
|
+
/**
|
25
|
+
* Asynchronous method to establish the connection.
|
26
|
+
*
|
27
|
+
*/
|
28
|
+
async connect() {
|
29
|
+
const { type, edge } = this;
|
30
|
+
const connector = edge ? proxy_connector_1.ProxyConnector.instance : engine_1.ConnectionManager.getConnector(type);
|
31
|
+
await connector.connect({
|
32
|
+
...this,
|
33
|
+
params: await this.getResolvedParameters() // 🔐 해결된 파라미터 사용
|
34
|
+
});
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* @brief Asynchronous method to disconnect the connection.
|
38
|
+
*
|
39
|
+
*/
|
40
|
+
async disconnect() {
|
41
|
+
try {
|
42
|
+
const { type, edge } = this;
|
43
|
+
const connector = edge ? proxy_connector_1.ProxyConnector.instance : engine_1.ConnectionManager.getConnector(type);
|
44
|
+
await connector.disconnect(this);
|
45
|
+
}
|
46
|
+
finally {
|
47
|
+
}
|
48
|
+
}
|
49
|
+
/**
|
50
|
+
* Gets a parameter value with fallback to EnvVar.
|
51
|
+
* Priority: params → EnvVar (only for useDomainAttribute=true)
|
52
|
+
*
|
53
|
+
* @param key - The parameter key
|
54
|
+
* @param defaultValue - Optional default value
|
55
|
+
* @returns The parameter value or default value
|
56
|
+
*/
|
57
|
+
async getParameter(key, defaultValue) {
|
58
|
+
// 1. params에서 직접 값 확인 (null/undefined가 아닌 경우)
|
59
|
+
if (this.params?.[key] !== null && this.params?.[key] !== undefined && this.params?.[key] !== '') {
|
60
|
+
return this.params[key];
|
61
|
+
}
|
62
|
+
// 2. useDomainAttribute가 true인 경우에만 EnvVar에서 조회
|
63
|
+
const connector = engine_1.ConnectionManager.getConnector(this.type);
|
64
|
+
const paramSpec = connector?.parameterSpec?.find(spec => spec.name === key);
|
65
|
+
if (paramSpec?.useDomainAttribute) {
|
66
|
+
const envVarKey = `Connection::${this.name}::${key}`;
|
67
|
+
const envVarRepository = (0, shell_1.getRepository)(shell_1.EnvVar);
|
68
|
+
const envVar = await envVarRepository.findOne({
|
69
|
+
where: { domain: { id: this.domainId }, name: envVarKey, active: true }
|
70
|
+
});
|
71
|
+
if (envVar) {
|
72
|
+
return envVar.value;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
// 3. useDomainAttribute가 false인 경우 기본값 반환
|
76
|
+
return defaultValue;
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* Gets all parameters with resolved values (params + Domain attributes).
|
80
|
+
*
|
81
|
+
* @returns Object with all resolved parameter values
|
82
|
+
*/
|
83
|
+
async getResolvedParameters() {
|
84
|
+
const resolved = {};
|
85
|
+
const connector = engine_1.ConnectionManager.getConnector(this.type);
|
86
|
+
const paramSpecs = connector?.parameterSpec || [];
|
87
|
+
for (const spec of paramSpecs) {
|
88
|
+
const key = spec.name;
|
89
|
+
resolved[key] = await this.getParameter(key);
|
90
|
+
}
|
91
|
+
return resolved;
|
92
|
+
}
|
93
|
+
};
|
94
|
+
exports.Connection = Connection;
|
95
|
+
tslib_1.__decorate([
|
96
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
97
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the connection.' }),
|
98
|
+
tslib_1.__metadata("design:type", String)
|
99
|
+
], Connection.prototype, "id", void 0);
|
100
|
+
tslib_1.__decorate([
|
101
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
102
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain to which this connection belongs.' }),
|
103
|
+
tslib_1.__metadata("design:type", shell_1.Domain
|
104
|
+
/**
|
105
|
+
* Stores the ID of the associated Domain.
|
106
|
+
*/
|
107
|
+
)
|
108
|
+
], Connection.prototype, "domain", void 0);
|
109
|
+
tslib_1.__decorate([
|
110
|
+
(0, typeorm_1.RelationId)((connection) => connection.domain),
|
111
|
+
tslib_1.__metadata("design:type", String)
|
112
|
+
], Connection.prototype, "domainId", void 0);
|
113
|
+
tslib_1.__decorate([
|
114
|
+
(0, typeorm_1.Column)(),
|
115
|
+
(0, type_graphql_1.Field)({ description: 'The name of the connection.' }),
|
116
|
+
tslib_1.__metadata("design:type", String)
|
117
|
+
], Connection.prototype, "name", void 0);
|
118
|
+
tslib_1.__decorate([
|
119
|
+
(0, typeorm_1.Column)({
|
120
|
+
nullable: true
|
121
|
+
}),
|
122
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description of the connection.' }),
|
123
|
+
tslib_1.__metadata("design:type", String)
|
124
|
+
], Connection.prototype, "description", void 0);
|
125
|
+
tslib_1.__decorate([
|
126
|
+
(0, typeorm_1.Column)(),
|
127
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The type of the connection (e.g., tcp, http, mqtt).' }),
|
128
|
+
tslib_1.__metadata("design:type", String)
|
129
|
+
], Connection.prototype, "type", void 0);
|
130
|
+
tslib_1.__decorate([
|
131
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.Appliance, { nullable: true }),
|
132
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The edge appliance that delegates this connection, if any.' }),
|
133
|
+
tslib_1.__metadata("design:type", auth_base_1.Appliance
|
134
|
+
/**
|
135
|
+
* Stores the ID of the Appliance who delegate the connection.
|
136
|
+
*/
|
137
|
+
)
|
138
|
+
], Connection.prototype, "edge", void 0);
|
139
|
+
tslib_1.__decorate([
|
140
|
+
(0, typeorm_1.RelationId)((connection) => connection.edge),
|
141
|
+
tslib_1.__metadata("design:type", String)
|
142
|
+
], Connection.prototype, "edgeId", void 0);
|
143
|
+
tslib_1.__decorate([
|
144
|
+
(0, typeorm_1.Column)(),
|
145
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The endpoint URL or address for the connection.' }),
|
146
|
+
tslib_1.__metadata("design:type", String)
|
147
|
+
], Connection.prototype, "endpoint", void 0);
|
148
|
+
tslib_1.__decorate([
|
149
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
150
|
+
(0, type_graphql_1.Field)({
|
151
|
+
nullable: true,
|
152
|
+
description: 'Indicates whether the connection is currently active and should be maintained.'
|
153
|
+
}),
|
154
|
+
tslib_1.__metadata("design:type", Boolean)
|
155
|
+
], Connection.prototype, "active", void 0);
|
156
|
+
tslib_1.__decorate([
|
157
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The current status of the connection (e.g., CONNECTED, DISCONNECTED).' }),
|
158
|
+
tslib_1.__metadata("design:type", String)
|
159
|
+
], Connection.prototype, "state", void 0);
|
160
|
+
tslib_1.__decorate([
|
161
|
+
(0, typeorm_1.Column)({
|
162
|
+
type: DATABASE_TYPE == 'postgres' ? 'varchar' : 'simple-json',
|
163
|
+
nullable: true,
|
164
|
+
transformer: DATABASE_TYPE == 'postgres'
|
165
|
+
? {
|
166
|
+
to: (value) => JSON.stringify(value),
|
167
|
+
from: (value) => {
|
168
|
+
try {
|
169
|
+
return JSON.parse(value);
|
170
|
+
}
|
171
|
+
catch (error) {
|
172
|
+
return null;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
}
|
176
|
+
: undefined
|
177
|
+
}),
|
178
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'A key-value map of parameters for the connection.' }),
|
179
|
+
tslib_1.__metadata("design:type", Object)
|
180
|
+
], Connection.prototype, "params", void 0);
|
181
|
+
tslib_1.__decorate([
|
182
|
+
(0, typeorm_1.CreateDateColumn)(),
|
183
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the connection was created.' }),
|
184
|
+
tslib_1.__metadata("design:type", Date
|
185
|
+
/**
|
186
|
+
* The date and time when the connection was last updated.
|
187
|
+
*/
|
188
|
+
)
|
189
|
+
], Connection.prototype, "createdAt", void 0);
|
190
|
+
tslib_1.__decorate([
|
191
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
192
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the connection was last updated.' }),
|
193
|
+
tslib_1.__metadata("design:type", Date
|
194
|
+
/**
|
195
|
+
* Many-to-One relationship with the User entity who created the connection. Optional field.
|
196
|
+
*/
|
197
|
+
)
|
198
|
+
], Connection.prototype, "updatedAt", void 0);
|
199
|
+
tslib_1.__decorate([
|
200
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
201
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The user who created the connection.' }),
|
202
|
+
tslib_1.__metadata("design:type", auth_base_1.User
|
203
|
+
/**
|
204
|
+
* Stores the ID of the User who created the connection.
|
205
|
+
*/
|
206
|
+
)
|
207
|
+
], Connection.prototype, "creator", void 0);
|
208
|
+
tslib_1.__decorate([
|
209
|
+
(0, typeorm_1.RelationId)((connection) => connection.creator),
|
210
|
+
tslib_1.__metadata("design:type", String)
|
211
|
+
], Connection.prototype, "creatorId", void 0);
|
212
|
+
tslib_1.__decorate([
|
213
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
214
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The user who last updated the connection.' }),
|
215
|
+
tslib_1.__metadata("design:type", auth_base_1.User
|
216
|
+
/**
|
217
|
+
* Stores the ID of the User who last updated the connection.
|
218
|
+
*
|
219
|
+
*/
|
220
|
+
)
|
221
|
+
], Connection.prototype, "updater", void 0);
|
222
|
+
tslib_1.__decorate([
|
223
|
+
(0, typeorm_1.RelationId)((connection) => connection.updater),
|
224
|
+
tslib_1.__metadata("design:type", String)
|
225
|
+
], Connection.prototype, "updaterId", void 0);
|
226
|
+
exports.Connection = Connection = tslib_1.__decorate([
|
227
|
+
(0, typeorm_1.Entity)(),
|
228
|
+
(0, typeorm_1.Index)('ix_connection_0', (connection) => [connection.domain, connection.name], { unique: true }),
|
229
|
+
(0, type_graphql_1.ObjectType)({ description: 'Represents a configured connection to an external system or service.' })
|
230
|
+
], Connection);
|
231
|
+
//# sourceMappingURL=connection.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../server/service/connection/connection.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCASgB;AAEhB,yDAA2D;AAC3D,6CAA4C;AAC5C,iDAA2G;AAE3G,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,GAAhB,MAAM,UAAU;IAkKrB;;;OAGG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;QAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,gCAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,0BAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;QAEvF,MAAM,SAAS,CAAC,OAAO,CAAC;YACtB,GAAG,IAAI;YACP,MAAM,EAAE,MAA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AAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;sCAC3E,gBAAI;IAEb;;;OAGG;;2CALU;AAOb;IADC,IAAA,oBAAU,EAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;;6CAC1C;qBAhKN,UAAU;IAHtB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,iBAAiB,EAAE,CAAC,UAAsB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC5G,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,sEAAsE,EAAE,CAAC;GACvF,UAAU,CAiPtB","sourcesContent":["import { Field, ID, 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, EnvVar, ScalarObject, encryptJsonTransformer, getRepository } 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 */\n // TODO: 암호화 처리가 필요하면, 이렇게 설정을 변경하라.\n // @Column({\n // type:\n // DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n // ? 'longtext'\n // : DATABASE_TYPE == 'oracle'\n // ? 'clob'\n // : DATABASE_TYPE == 'mssql'\n // ? 'nvarchar'\n // : 'varchar', // PostgreSQL, SQLite\n // length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined,\n // transformer: encryptJsonTransformer\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: await this.getResolvedParameters() // 🔐 해결된 파라미터 사용\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 * Gets a parameter value with fallback to EnvVar.\n * Priority: params → EnvVar (only for useDomainAttribute=true)\n *\n * @param key - The parameter key\n * @param defaultValue - Optional default value\n * @returns The parameter value or default value\n */\n async getParameter(key: string, defaultValue?: any): Promise<any> {\n // 1. params에서 직접 값 확인 (null/undefined가 아닌 경우)\n if (this.params?.[key] !== null && this.params?.[key] !== undefined && this.params?.[key] !== '') {\n return this.params[key]\n }\n\n // 2. useDomainAttribute가 true인 경우에만 EnvVar에서 조회\n const connector = ConnectionManager.getConnector(this.type)\n const paramSpec = connector?.parameterSpec?.find(spec => spec.name === key)\n\n if (paramSpec?.useDomainAttribute) {\n const envVarKey = `Connection::${this.name}::${key}`\n const envVarRepository = getRepository<EnvVar>(EnvVar)\n const envVar = await envVarRepository.findOne({\n where: { domain: { id: this.domainId }, name: envVarKey, active: true }\n })\n\n if (envVar) {\n return envVar.value\n }\n }\n\n // 3. useDomainAttribute가 false인 경우 기본값 반환\n return defaultValue\n }\n\n /**\n * Gets all parameters with resolved values (params + Domain attributes).\n *\n * @returns Object with all resolved parameter values\n */\n async getResolvedParameters(): Promise<{ [key: string]: any }> {\n const resolved = {}\n\n const connector = ConnectionManager.getConnector(this.type)\n const paramSpecs = connector?.parameterSpec || []\n\n for (const spec of paramSpecs) {\n const key = spec.name\n resolved[key] = await this.getParameter(key)\n }\n\n return resolved\n }\n}\n"]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Connection } from './connection
|
1
|
+
import { Connection } from './connection';
|
2
2
|
import { ConnectionQuery } from './connection-query';
|
3
3
|
import { ConnectionMutation } from './connection-mutation';
|
4
4
|
import { ConnectionSubscription } from './connection-subscription';
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.resolvers = exports.entities = void 0;
|
4
|
-
const
|
4
|
+
const connection_1 = require("./connection");
|
5
5
|
const connection_query_1 = require("./connection-query");
|
6
6
|
const connection_mutation_1 = require("./connection-mutation");
|
7
7
|
const connection_subscription_1 = require("./connection-subscription");
|
8
|
-
exports.entities = [
|
8
|
+
exports.entities = [connection_1.Connection];
|
9
9
|
exports.resolvers = [connection_query_1.ConnectionQuery, connection_mutation_1.ConnectionMutation, connection_subscription_1.ConnectionSubscription];
|
10
10
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/connection/index.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/connection/index.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,yDAAoD;AACpD,+DAA0D;AAC1D,uEAAkE;AAErD,QAAA,QAAQ,GAAG,CAAC,uBAAU,CAAC,CAAA;AACvB,QAAA,SAAS,GAAG,CAAC,kCAAe,EAAE,wCAAkB,EAAE,gDAAsB,CAAC,CAAA","sourcesContent":["import { Connection } from './connection'\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"]}
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
6
6
|
const shell_1 = require("@things-factory/shell");
|
7
7
|
const connection_manager_1 = require("../../engine/connection-manager");
|
8
|
-
const
|
8
|
+
const connection_1 = require("../connection/connection");
|
9
9
|
const connector_type_1 = require("./connector-type");
|
10
10
|
/**
|
11
11
|
* @description Provides GraphQL resolvers for connector types.
|
@@ -45,7 +45,7 @@ let ConnectorQuery = class ConnectorQuery {
|
|
45
45
|
}
|
46
46
|
async connectorByConnection(connectionName, context) {
|
47
47
|
const { domain } = context.state;
|
48
|
-
var connection = await (0, shell_1.getRepository)(
|
48
|
+
var connection = await (0, shell_1.getRepository)(connection_1.Connection).findOne({
|
49
49
|
where: { domain: { id: domain.id }, name: connectionName }
|
50
50
|
});
|
51
51
|
return connection && connection_manager_1.ConnectionManager.getConnector(connection.type);
|
@@ -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,
|
1
|
+
{"version":3,"file":"connector-query.js","sourceRoot":"","sources":["../../../server/service/connector/connector-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwD;AAExD,iDAAqD;AAErD,wEAAmE;AACnE,yDAAqD;AACrD,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,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAAA;QAErG,OAAO;YACL,IAAI;YACJ,WAAW;YACX,IAAI;YACJ,aAAa;YACb,YAAY,EAAE,YAAY,IAAI,EAAE;SACjC,CAAA;IACH,CAAC;IAGK,AAAN,KAAK,CAAC,UAAU;QACd,IAAI,UAAU,GAAG,sCAAiB,CAAC,aAAa,EAAE,CAAA;QAClD,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;aAChC,GAAG,CAAC,IAAI,CAAC,EAAE;YACV,IAAI,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;YAChC,OAAO;gBACL,IAAI;gBACJ,WAAW,EAAE,SAAS,CAAC,WAAW;gBACl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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'\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"]}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export * from './property-spec';
|
2
2
|
export * from './task-type/task-type-type';
|
3
3
|
export * from './connector/connector-type';
|
4
|
+
export * from './connection/connection';
|
4
5
|
export * from './connection/connection-type';
|
5
6
|
export * from './scenario/scenario';
|
6
7
|
export * from './scenario-instance/scenario-instance-type';
|
@@ -15,6 +15,7 @@ const analysis_1 = require("./analysis");
|
|
15
15
|
tslib_1.__exportStar(require("./property-spec"), exports);
|
16
16
|
tslib_1.__exportStar(require("./task-type/task-type-type"), exports);
|
17
17
|
tslib_1.__exportStar(require("./connector/connector-type"), exports);
|
18
|
+
tslib_1.__exportStar(require("./connection/connection"), exports);
|
18
19
|
tslib_1.__exportStar(require("./connection/connection-type"), exports);
|
19
20
|
tslib_1.__exportStar(require("./scenario/scenario"), exports);
|
20
21
|
tslib_1.__exportStar(require("./scenario-instance/scenario-instance-type"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,6CAA+F;AAC/F,2CAA4F;AAC5F,yCAAyF;AACzF,2DAAkH;AAClH,qDAAyG;AACzG,iCAA6E;AAC7E,2CAA0F;AAC1F,+CAAgG;AAChG,qDAAyG;AACzG,yCAAkE;AAElE,0DAA+B;AAC/B,qEAA0C;AAC1C,qEAA0C;AAC1C,uEAA4C;AAC5C,8DAAmC;AACnC,qFAA0D;AAC1D,+EAAoD;AACpD,2DAAgC;AAChC,wEAA6C;AAC7C,oEAAyC;AACzC,0EAA+C;AAElC,QAAA,QAAQ,GAAG;IACtB,GAAG,oBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,qBAAkB;IACrB,GAAG,mBAAgB;IACnB,GAAG,4BAAwB;IAC3B,GAAG,yBAAqB;IACxB,GAAG,eAAY;IACf,GAAG,sBAAkB;IACrB,GAAG,yBAAqB;CACzB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,GAAG,qBAAiB;QACpB,GAAG,qBAAkB;QACrB,GAAG,sBAAmB;QACtB,GAAG,oBAAiB;QACpB,GAAG,6BAAyB;QAC5B,GAAG,0BAAsB;QACzB,GAAG,gBAAa;QAChB,GAAG,uBAAmB;QACtB,GAAG,oBAAwB;QAC3B,GAAG,0BAAsB;KAC1B;CACF,CAAA;AAED,yDAAuD;AAA9C,0GAAA,WAAW,OAAA;AACpB,2EAAqE;AAA5D,wHAAA,gBAAgB,OAAA","sourcesContent":["import { entities as ConnectionEntities, resolvers as ConnectionResolvers } from './connection'\nimport { entities as ConnectorEntities, resolvers as ConnectorResolvers } from './connector'\nimport { entities as ScenarioEntities, resolvers as ScenarioResolvers } from './scenario'\nimport { entities as ScenarioInstanceEntities, resolvers as ScenarioInstanceResolvers } from './scenario-instance'\nimport { entities as ScenarioQueueEntities, resolvers as ScenarioQueueResolvers } from './scenario-queue'\nimport { entities as StepEntities, resolvers as StepResolvers } from './step'\nimport { entities as TaskTypeEntities, resolvers as TaskTypeResolvers } from './task-type'\nimport { entities as PayloadLogEntities, resolvers as PayloadLogResolvers } from './payload-log'\nimport { entities as StateRegisterEntities, resolvers as StateRegisterResolvers } from './state-register'\nimport { resolvers as IntegrationAnalysisQuery } from './analysis'\n\nexport * from './property-spec'\nexport * from './task-type/task-type-type'\nexport * from './connector/connector-type'\nexport * from './connection/connection-type'\nexport * from './scenario/scenario'\nexport * from './scenario-instance/scenario-instance-type'\nexport * from './scenario-queue/scenario-queue-type'\nexport * from './step/step-type'\nexport * from './scenario-flow/scenario-flow'\nexport * from './payload-log/payload-log'\nexport * from './state-register/state-register'\n\nexport const entities = [\n ...TaskTypeEntities,\n ...ConnectorEntities,\n ...ConnectionEntities,\n ...ScenarioEntities,\n ...ScenarioInstanceEntities,\n ...ScenarioQueueEntities,\n ...StepEntities,\n ...PayloadLogEntities,\n ...StateRegisterEntities\n]\n\nexport const schema = {\n resolverClasses: [\n ...TaskTypeResolvers,\n ...ConnectorResolvers,\n ...ConnectionResolvers,\n ...ScenarioResolvers,\n ...ScenarioInstanceResolvers,\n ...ScenarioQueueResolvers,\n ...StepResolvers,\n ...PayloadLogResolvers,\n ...IntegrationAnalysisQuery,\n ...StateRegisterResolvers\n ]\n}\n\nexport { PayloadType } from './payload-log/payload-log'\nexport { createPayloadLog } from './payload-log/payload-log-mutation'\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,6CAA+F;AAC/F,2CAA4F;AAC5F,yCAAyF;AACzF,2DAAkH;AAClH,qDAAyG;AACzG,iCAA6E;AAC7E,2CAA0F;AAC1F,+CAAgG;AAChG,qDAAyG;AACzG,yCAAkE;AAElE,0DAA+B;AAC/B,qEAA0C;AAC1C,qEAA0C;AAC1C,kEAAuC;AACvC,uEAA4C;AAC5C,8DAAmC;AACnC,qFAA0D;AAC1D,+EAAoD;AACpD,2DAAgC;AAChC,wEAA6C;AAC7C,oEAAyC;AACzC,0EAA+C;AAElC,QAAA,QAAQ,GAAG;IACtB,GAAG,oBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,qBAAkB;IACrB,GAAG,mBAAgB;IACnB,GAAG,4BAAwB;IAC3B,GAAG,yBAAqB;IACxB,GAAG,eAAY;IACf,GAAG,sBAAkB;IACrB,GAAG,yBAAqB;CACzB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,GAAG,qBAAiB;QACpB,GAAG,qBAAkB;QACrB,GAAG,sBAAmB;QACtB,GAAG,oBAAiB;QACpB,GAAG,6BAAyB;QAC5B,GAAG,0BAAsB;QACzB,GAAG,gBAAa;QAChB,GAAG,uBAAmB;QACtB,GAAG,oBAAwB;QAC3B,GAAG,0BAAsB;KAC1B;CACF,CAAA;AAED,yDAAuD;AAA9C,0GAAA,WAAW,OAAA;AACpB,2EAAqE;AAA5D,wHAAA,gBAAgB,OAAA","sourcesContent":["import { entities as ConnectionEntities, resolvers as ConnectionResolvers } from './connection'\nimport { entities as ConnectorEntities, resolvers as ConnectorResolvers } from './connector'\nimport { entities as ScenarioEntities, resolvers as ScenarioResolvers } from './scenario'\nimport { entities as ScenarioInstanceEntities, resolvers as ScenarioInstanceResolvers } from './scenario-instance'\nimport { entities as ScenarioQueueEntities, resolvers as ScenarioQueueResolvers } from './scenario-queue'\nimport { entities as StepEntities, resolvers as StepResolvers } from './step'\nimport { entities as TaskTypeEntities, resolvers as TaskTypeResolvers } from './task-type'\nimport { entities as PayloadLogEntities, resolvers as PayloadLogResolvers } from './payload-log'\nimport { entities as StateRegisterEntities, resolvers as StateRegisterResolvers } from './state-register'\nimport { resolvers as IntegrationAnalysisQuery } from './analysis'\n\nexport * from './property-spec'\nexport * from './task-type/task-type-type'\nexport * from './connector/connector-type'\nexport * from './connection/connection'\nexport * from './connection/connection-type'\nexport * from './scenario/scenario'\nexport * from './scenario-instance/scenario-instance-type'\nexport * from './scenario-queue/scenario-queue-type'\nexport * from './step/step-type'\nexport * from './scenario-flow/scenario-flow'\nexport * from './payload-log/payload-log'\nexport * from './state-register/state-register'\n\nexport const entities = [\n ...TaskTypeEntities,\n ...ConnectorEntities,\n ...ConnectionEntities,\n ...ScenarioEntities,\n ...ScenarioInstanceEntities,\n ...ScenarioQueueEntities,\n ...StepEntities,\n ...PayloadLogEntities,\n ...StateRegisterEntities\n]\n\nexport const schema = {\n resolverClasses: [\n ...TaskTypeResolvers,\n ...ConnectorResolvers,\n ...ConnectionResolvers,\n ...ScenarioResolvers,\n ...ScenarioInstanceResolvers,\n ...ScenarioQueueResolvers,\n ...StepResolvers,\n ...PayloadLogResolvers,\n ...IntegrationAnalysisQuery,\n ...StateRegisterResolvers\n ]\n}\n\nexport { PayloadType } from './payload-log/payload-log'\nexport { createPayloadLog } from './payload-log/payload-log-mutation'\n"]}
|
@@ -8,7 +8,7 @@ let PropertySpec = class PropertySpec {
|
|
8
8
|
};
|
9
9
|
exports.PropertySpec = PropertySpec;
|
10
10
|
tslib_1.__decorate([
|
11
|
-
(0, type_graphql_1.Field)({ description: 'The data type of the property (e.g., text, number, boolean, select).' }),
|
11
|
+
(0, type_graphql_1.Field)({ description: 'The data type of the property (e.g., text, number, boolean, select, password).' }),
|
12
12
|
tslib_1.__metadata("design:type", String)
|
13
13
|
], PropertySpec.prototype, "type", void 0);
|
14
14
|
tslib_1.__decorate([
|
@@ -34,6 +34,13 @@ tslib_1.__decorate([
|
|
34
34
|
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'CSS styles to be applied to the input field.' }),
|
35
35
|
tslib_1.__metadata("design:type", Object)
|
36
36
|
], PropertySpec.prototype, "styles", void 0);
|
37
|
+
tslib_1.__decorate([
|
38
|
+
(0, type_graphql_1.Field)({
|
39
|
+
nullable: true,
|
40
|
+
description: 'Whether this property should use Domain attributes for secure storage instead of direct params.'
|
41
|
+
}),
|
42
|
+
tslib_1.__metadata("design:type", Boolean)
|
43
|
+
], PropertySpec.prototype, "useDomainAttribute", void 0);
|
37
44
|
exports.PropertySpec = PropertySpec = tslib_1.__decorate([
|
38
45
|
(0, type_graphql_1.ObjectType)({
|
39
46
|
description: 'Describes a single property for a component or a step, used for UI rendering and configuration.'
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"property-spec.js","sourceRoot":"","sources":["../../server/service/property-spec.ts"],"names":[],"mappings":";;;;AAAA,+CAAgD;AAEhD,iDAAoD;AAK7C,IAAM,YAAY,GAAlB,MAAM,YAAY;
|
1
|
+
{"version":3,"file":"property-spec.js","sourceRoot":"","sources":["../../server/service/property-spec.ts"],"names":[],"mappings":";;;;AAAA,+CAAgD;AAEhD,iDAAoD;AAK7C,IAAM,YAAY,GAAlB,MAAM,YAAY;CA2BxB,CAAA;AA3BY,oCAAY;AAEvB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,gFAAgF,EAAE,CAAC;;0CAC7F;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,yDAAyD,EAAE,CAAC;;2CACrE;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,qEAAqE,EAAE,CAAC;;0CAClF;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;;iDAC5D;AAMpB;IAJC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE;QAC3B,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,0EAA0E;KACxF,CAAC;;8CAC+B;AAGjC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;;4CAC9E;AAM/B;IAJC,IAAA,oBAAK,EAAC;QACL,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,iGAAiG;KAC/G,CAAC;;wDAC0B;uBA1BjB,YAAY;IAHxB,IAAA,yBAAU,EAAC;QACV,WAAW,EAAE,iGAAiG;KAC/G,CAAC;GACW,YAAY,CA2BxB","sourcesContent":["import { Field, ObjectType } from 'type-graphql'\n\nimport { ScalarObject } from '@things-factory/shell'\n\n@ObjectType({\n description: 'Describes a single property for a component or a step, used for UI rendering and configuration.'\n})\nexport class PropertySpec {\n @Field({ description: 'The data type of the property (e.g., text, number, boolean, select, password).' })\n type: string\n\n @Field({ description: 'The human-readable label for the property, shown in UI.' })\n label: string\n\n @Field({ description: 'The name of the property, used as the key in configuration objects.' })\n name: string\n\n @Field({ nullable: true, description: 'Placeholder text for the input field.' })\n placeholder?: string\n\n @Field(type => ScalarObject, {\n nullable: true,\n description: 'Additional properties specific to the type (e.g., options for a select).'\n })\n property?: { [key: string]: any }\n\n @Field(type => ScalarObject, { nullable: true, description: 'CSS styles to be applied to the input field.' })\n styles?: { [key: string]: any }\n\n @Field({\n nullable: true,\n description: 'Whether this property should use Domain attributes for secure storage instead of direct params.'\n })\n useDomainAttribute?: boolean\n}\n"]}
|
@@ -11,7 +11,7 @@ const scenario_instance_type_1 = require("../scenario-instance/scenario-instance
|
|
11
11
|
const step_type_1 = require("../step/step-type");
|
12
12
|
const scenario_1 = require("./scenario");
|
13
13
|
const scenario_type_1 = require("./scenario-type");
|
14
|
-
const
|
14
|
+
const connection_1 = require("../connection/connection");
|
15
15
|
/**
|
16
16
|
* @description Provides GraphQL resolvers for the Scenario entity.
|
17
17
|
*/
|
@@ -125,7 +125,7 @@ tslib_1.__decorate([
|
|
125
125
|
tslib_1.__metadata("design:returntype", Promise)
|
126
126
|
], ScenarioQuery.prototype, "steps", null);
|
127
127
|
tslib_1.__decorate([
|
128
|
-
(0, type_graphql_1.FieldResolver)(type => [
|
128
|
+
(0, type_graphql_1.FieldResolver)(type => [connection_1.Connection]),
|
129
129
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
130
130
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
131
131
|
tslib_1.__metadata("design:type", Function),
|
@@ -133,7 +133,7 @@ tslib_1.__decorate([
|
|
133
133
|
tslib_1.__metadata("design:returntype", Promise)
|
134
134
|
], ScenarioQuery.prototype, "connectionNames", null);
|
135
135
|
tslib_1.__decorate([
|
136
|
-
(0, type_graphql_1.FieldResolver)(type => [
|
136
|
+
(0, type_graphql_1.FieldResolver)(type => [connection_1.Connection]),
|
137
137
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
138
138
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
139
139
|
tslib_1.__metadata("design:type", Function),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scenario-query.js","sourceRoot":"","sources":["../../../server/service/scenario/scenario-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qCAAqC;AAErC,yDAAsD;AACtD,iDAAuG;AAEvG,yCAA6C;AAC7C,wFAAsG;AACtG,iDAAwC;AACxC,yCAAqC;AACrC,mDAA8C;AAC9C,
|
1
|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import { User, Role } from '@things-factory/auth-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { ScenarioEngine } from '../../engine'\nimport { ScenarioInstance, ScenarioInstanceStatus } from '../scenario-instance/scenario-instance-type'\nimport { Step } from '../step/step-type'\nimport { Scenario } from './scenario'\nimport { ScenarioList } from './scenario-type'\nimport { Connection } from '../connection/connection'\n\n/**\n * @description Provides GraphQL resolvers for the Scenario entity.\n */\n@Resolver(Scenario)\nexport class ScenarioQuery {\n @Directive('@privilege(category: \"scenario\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => Scenario, { description: 'Fetches a single scenario by its ID.' })\n async scenario(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Scenario> {\n const { domain } = context.state\n\n const scenario = await getRepository(Scenario).findOne({ where: { id } })\n if (domain.id == scenario.domainId || domain.parentId == scenario.domainId) {\n return scenario\n }\n }\n\n @Directive('@privilege(category: \"scenario\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => ScenarioList, { description: 'Fetches a paginated list of scenarios.' })\n async scenarios(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<ScenarioList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n repository: getRepository(Scenario),\n params,\n domain,\n searchables: ['name', 'description', 'type']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() scenario: Scenario) {\n return await getRepository(Domain).findOneBy({ id: scenario.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() scenario: Scenario): Promise<User> {\n return await getRepository(User).findOneBy({ id: scenario.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() scenario: Scenario): Promise<User> {\n return await getRepository(User).findOneBy({ id: scenario.creatorId })\n }\n\n @FieldResolver(type => [Step])\n async steps(@Root() scenario: Scenario, @Ctx() context: ResolverContext): Promise<Step[]> {\n const { domain } = context.state\n\n return await getRepository(Step).find({\n where: { domain: { id: domain.id }, scenario: { id: scenario.id } }\n })\n }\n\n @FieldResolver(type => [Connection])\n async connectionNames(@Root() scenario: Scenario, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n\n const steps = await getRepository(Step).find({\n where: { domain: { id: domain.id }, scenario: { id: scenario.id }, connection: Not(IsNull()) }\n })\n\n return steps.map(step => step.connection).filter(Boolean)\n }\n\n @FieldResolver(type => [Connection])\n async publishTags(@Root() scenario: Scenario, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n\n const steps = await getRepository(Step).find({\n where: { domain: { id: domain.id }, scenario: { id: scenario.id }, task: 'publish' }\n })\n\n return steps.map(step => step.params?.tag).filter(Boolean)\n }\n\n @FieldResolver(type => String, { nullable: true })\n async state(@Root() scenario: Scenario, @Ctx() context: ResolverContext): Promise<string> {\n const { domain } = context.state\n\n var instance = ScenarioEngine.getScenarioInstance(domain, scenario.name)\n return instance && ScenarioInstanceStatus[instance.context?.state]\n }\n\n @FieldResolver(type => [ScenarioInstance], { nullable: true })\n async instances(@Root() scenario: Scenario, @Ctx() context: ResolverContext): Promise<ScenarioInstance[]> {\n const { domain } = context.state\n\n return ScenarioEngine.getScenarioInstances(domain, scenario.name)\n }\n\n @FieldResolver(type => Role)\n async role(@Root() scenario: Scenario) {\n return scenario.roleId && (await getRepository(Role).findOneBy({ id: scenario.roleId }))\n }\n}\n"]}
|
@@ -6,7 +6,7 @@ const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const shell_1 = require("@things-factory/shell");
|
7
7
|
const connection_manager_1 = require("../../engine/connection-manager");
|
8
8
|
const task_registry_1 = require("../../engine/task-registry");
|
9
|
-
const
|
9
|
+
const connection_1 = require("../connection/connection");
|
10
10
|
const task_type_type_1 = require("./task-type-type");
|
11
11
|
let TaskTypeQuery = class TaskTypeQuery {
|
12
12
|
taskType(name, context) {
|
@@ -43,7 +43,7 @@ let TaskTypeQuery = class TaskTypeQuery {
|
|
43
43
|
async taskTypesByConnection(connectionName, context) {
|
44
44
|
var taskPrefixes = [];
|
45
45
|
if (connectionName) {
|
46
|
-
var connection = await (0, shell_1.getRepository)(
|
46
|
+
var connection = await (0, shell_1.getRepository)(connection_1.Connection).findOne({
|
47
47
|
where: { domain: { id: context.state.domain.id }, name: connectionName }
|
48
48
|
});
|
49
49
|
if (connection) {
|