@things-factory/integration-base 9.0.20 โ†’ 9.0.25

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.
Files changed (98) hide show
  1. package/dist-server/engine/analyzer/analyze-integration.js +2 -2
  2. package/dist-server/engine/analyzer/analyze-integration.js.map +1 -1
  3. package/dist-server/engine/connection-manager.d.ts +13 -1
  4. package/dist-server/engine/connection-manager.js +105 -7
  5. package/dist-server/engine/connection-manager.js.map +1 -1
  6. package/dist-server/engine/connector/headless-connector.d.ts +8 -0
  7. package/dist-server/engine/connector/headless-connector.js +4 -2
  8. package/dist-server/engine/connector/headless-connector.js.map +1 -1
  9. package/dist-server/engine/connector/mqtt-connector.d.ts +1 -0
  10. package/dist-server/engine/connector/mqtt-connector.js +4 -2
  11. package/dist-server/engine/connector/mqtt-connector.js.map +1 -1
  12. package/dist-server/engine/connector/mssql-connector.d.ts +4 -0
  13. package/dist-server/engine/connector/mssql-connector.js +4 -2
  14. package/dist-server/engine/connector/mssql-connector.js.map +1 -1
  15. package/dist-server/engine/connector/mysql-connector.d.ts +10 -2
  16. package/dist-server/engine/connector/mysql-connector.js +23 -18
  17. package/dist-server/engine/connector/mysql-connector.js.map +1 -1
  18. package/dist-server/engine/connector/operato-connector.d.ts +8 -2
  19. package/dist-server/engine/connector/operato-connector.js +2 -1
  20. package/dist-server/engine/connector/operato-connector.js.map +1 -1
  21. package/dist-server/engine/connector/oracle-connector.d.ts +3 -0
  22. package/dist-server/engine/connector/oracle-connector.js +4 -2
  23. package/dist-server/engine/connector/oracle-connector.js.map +1 -1
  24. package/dist-server/engine/connector/postgresql-connector.d.ts +13 -2
  25. package/dist-server/engine/connector/postgresql-connector.js +14 -6
  26. package/dist-server/engine/connector/postgresql-connector.js.map +1 -1
  27. package/dist-server/engine/connector/pyrun-connector.d.ts +1 -0
  28. package/dist-server/engine/connector/pyrun-connector.js +3 -3
  29. package/dist-server/engine/connector/pyrun-connector.js.map +1 -1
  30. package/dist-server/engine/edge-client.d.ts +1 -1
  31. package/dist-server/engine/edge-client.js.map +1 -1
  32. package/dist-server/engine/task/database-query.js +1 -1
  33. package/dist-server/engine/task/database-query.js.map +1 -1
  34. package/dist-server/engine/task/echo-receive.js +1 -1
  35. package/dist-server/engine/task/echo-receive.js.map +1 -1
  36. package/dist-server/engine/task/echo-send.js +1 -1
  37. package/dist-server/engine/task/echo-send.js.map +1 -1
  38. package/dist-server/engine/task/graphql-mutate.js +1 -1
  39. package/dist-server/engine/task/graphql-mutate.js.map +1 -1
  40. package/dist-server/engine/task/graphql-query.js +1 -1
  41. package/dist-server/engine/task/graphql-query.js.map +1 -1
  42. package/dist-server/engine/task/headless-post.js +1 -1
  43. package/dist-server/engine/task/headless-post.js.map +1 -1
  44. package/dist-server/engine/task/headless-scrap.js +1 -1
  45. package/dist-server/engine/task/headless-scrap.js.map +1 -1
  46. package/dist-server/engine/task/http-get.js +1 -1
  47. package/dist-server/engine/task/http-get.js.map +1 -1
  48. package/dist-server/engine/task/http-post.js +1 -1
  49. package/dist-server/engine/task/http-post.js.map +1 -1
  50. package/dist-server/engine/task/mqtt-publish.js +1 -1
  51. package/dist-server/engine/task/mqtt-publish.js.map +1 -1
  52. package/dist-server/engine/task/mqtt-subscribe.js +1 -1
  53. package/dist-server/engine/task/mqtt-subscribe.js.map +1 -1
  54. package/dist-server/engine/task/mssql-procedure.js +1 -1
  55. package/dist-server/engine/task/mssql-procedure.js.map +1 -1
  56. package/dist-server/engine/task/oracle-procedure.js +1 -1
  57. package/dist-server/engine/task/oracle-procedure.js.map +1 -1
  58. package/dist-server/engine/task/pyrun-execute.js +1 -1
  59. package/dist-server/engine/task/pyrun-execute.js.map +1 -1
  60. package/dist-server/engine/task/socket-listener.js +1 -1
  61. package/dist-server/engine/task/socket-listener.js.map +1 -1
  62. package/dist-server/service/connection/connection-mutation.d.ts +3 -1
  63. package/dist-server/service/connection/connection-mutation.js +62 -22
  64. package/dist-server/service/connection/connection-mutation.js.map +1 -1
  65. package/dist-server/service/connection/connection-query.d.ts +2 -1
  66. package/dist-server/service/connection/connection-query.js +14 -13
  67. package/dist-server/service/connection/connection-query.js.map +1 -1
  68. package/dist-server/service/connection/connection-subscription.js +6 -4
  69. package/dist-server/service/connection/connection-subscription.js.map +1 -1
  70. package/dist-server/service/connection/connection-type.d.ts +10 -99
  71. package/dist-server/service/connection/connection-type.js +36 -182
  72. package/dist-server/service/connection/connection-type.js.map +1 -1
  73. package/dist-server/service/connection/connection.d.ts +119 -0
  74. package/dist-server/service/connection/connection.js +239 -0
  75. package/dist-server/service/connection/connection.js.map +1 -0
  76. package/dist-server/service/connection/index.d.ts +1 -1
  77. package/dist-server/service/connection/index.js +2 -2
  78. package/dist-server/service/connection/index.js.map +1 -1
  79. package/dist-server/service/connector/connector-query.js +2 -2
  80. package/dist-server/service/connector/connector-query.js.map +1 -1
  81. package/dist-server/service/index.d.ts +1 -0
  82. package/dist-server/service/index.js +1 -0
  83. package/dist-server/service/index.js.map +1 -1
  84. package/dist-server/service/property-spec.d.ts +1 -0
  85. package/dist-server/service/property-spec.js +8 -1
  86. package/dist-server/service/property-spec.js.map +1 -1
  87. package/dist-server/service/scenario/scenario-mutation.js +1 -1
  88. package/dist-server/service/scenario/scenario-mutation.js.map +1 -1
  89. package/dist-server/service/scenario/scenario-query.js +3 -3
  90. package/dist-server/service/scenario/scenario-query.js.map +1 -1
  91. package/dist-server/service/scenario/scenario-type.js +4 -1
  92. package/dist-server/service/scenario/scenario-type.js.map +1 -1
  93. package/dist-server/service/scenario/scenario.js +1 -1
  94. package/dist-server/service/scenario/scenario.js.map +1 -1
  95. package/dist-server/service/task-type/task-type-query.js +2 -2
  96. package/dist-server/service/task-type/task-type-query.js.map +1 -1
  97. package/dist-server/tsconfig.tsbuildinfo +1 -1
  98. package/package.json +8 -8
@@ -1,189 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConnectionList = exports.ConnectionPatch = exports.NewConnection = exports.ConnectionState = exports.Connection = exports.ConnectionStatus = void 0;
3
+ exports.ConnectionList = exports.ConnectionPatch = exports.NewConnection = exports.ConnectionState = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
- const typeorm_1 = require("typeorm");
7
6
  const auth_base_1 = require("@things-factory/auth-base");
8
- const env_1 = require("@things-factory/env");
9
7
  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: this.params || {}
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
- exports.Connection = Connection;
51
- tslib_1.__decorate([
52
- (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
53
- (0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier for the connection.' }),
54
- tslib_1.__metadata("design:type", String)
55
- ], Connection.prototype, "id", void 0);
56
- tslib_1.__decorate([
57
- (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
58
- (0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain to which this connection belongs.' }),
59
- tslib_1.__metadata("design:type", shell_1.Domain
60
- /**
61
- * Stores the ID of the associated Domain.
62
- */
63
- )
64
- ], Connection.prototype, "domain", void 0);
65
- tslib_1.__decorate([
66
- (0, typeorm_1.RelationId)((connection) => connection.domain),
67
- tslib_1.__metadata("design:type", String)
68
- ], Connection.prototype, "domainId", void 0);
69
- tslib_1.__decorate([
70
- (0, typeorm_1.Column)(),
71
- (0, type_graphql_1.Field)({ description: 'The name of the connection.' }),
72
- tslib_1.__metadata("design:type", String)
73
- ], Connection.prototype, "name", void 0);
74
- tslib_1.__decorate([
75
- (0, typeorm_1.Column)({
76
- nullable: true
77
- }),
78
- (0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description of the connection.' }),
79
- tslib_1.__metadata("design:type", String)
80
- ], Connection.prototype, "description", void 0);
81
- tslib_1.__decorate([
82
- (0, typeorm_1.Column)(),
83
- (0, type_graphql_1.Field)({ nullable: true, description: 'The type of the connection (e.g., tcp, http, mqtt).' }),
84
- tslib_1.__metadata("design:type", String)
85
- ], Connection.prototype, "type", void 0);
86
- tslib_1.__decorate([
87
- (0, typeorm_1.ManyToOne)(type => auth_base_1.Appliance, { nullable: true }),
88
- (0, type_graphql_1.Field)({ nullable: true, description: 'The edge appliance that delegates this connection, if any.' }),
89
- tslib_1.__metadata("design:type", auth_base_1.Appliance
90
- /**
91
- * Stores the ID of the Appliance who delegate the connection.
92
- */
93
- )
94
- ], Connection.prototype, "edge", void 0);
95
- tslib_1.__decorate([
96
- (0, typeorm_1.RelationId)((connection) => connection.edge),
97
- tslib_1.__metadata("design:type", String)
98
- ], Connection.prototype, "edgeId", void 0);
99
- tslib_1.__decorate([
100
- (0, typeorm_1.Column)(),
101
- (0, type_graphql_1.Field)({ nullable: true, description: 'The endpoint URL or address for the connection.' }),
102
- tslib_1.__metadata("design:type", String)
103
- ], Connection.prototype, "endpoint", void 0);
104
- tslib_1.__decorate([
105
- (0, typeorm_1.Column)({ nullable: true }),
106
- (0, type_graphql_1.Field)({
107
- nullable: true,
108
- description: 'Indicates whether the connection is currently active and should be maintained.'
109
- }),
110
- tslib_1.__metadata("design:type", Boolean)
111
- ], Connection.prototype, "active", void 0);
112
- tslib_1.__decorate([
113
- (0, type_graphql_1.Field)({ nullable: true, description: 'The current status of the connection (e.g., CONNECTED, DISCONNECTED).' }),
114
- tslib_1.__metadata("design:type", String)
115
- ], Connection.prototype, "state", void 0);
116
- tslib_1.__decorate([
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)
136
- ], Connection.prototype, "params", void 0);
137
- tslib_1.__decorate([
138
- (0, typeorm_1.CreateDateColumn)(),
139
- (0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the connection was created.' }),
140
- tslib_1.__metadata("design:type", Date
141
- /**
142
- * The date and time when the connection was last updated.
143
- */
144
- )
145
- ], Connection.prototype, "createdAt", void 0);
146
- tslib_1.__decorate([
147
- (0, typeorm_1.UpdateDateColumn)(),
148
- (0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the connection was last updated.' }),
149
- tslib_1.__metadata("design:type", Date
150
- /**
151
- * Many-to-One relationship with the User entity who created the connection. Optional field.
152
- */
153
- )
154
- ], Connection.prototype, "updatedAt", void 0);
155
- tslib_1.__decorate([
156
- (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
157
- (0, type_graphql_1.Field)({ nullable: true, description: 'The user who created the connection.' }),
158
- tslib_1.__metadata("design:type", auth_base_1.User
159
- /**
160
- * Stores the ID of the User who created the connection.
161
- */
162
- )
163
- ], Connection.prototype, "creator", void 0);
164
- tslib_1.__decorate([
165
- (0, typeorm_1.RelationId)((connection) => connection.creator),
166
- tslib_1.__metadata("design:type", String)
167
- ], Connection.prototype, "creatorId", void 0);
168
- tslib_1.__decorate([
169
- (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
170
- (0, type_graphql_1.Field)({ nullable: true, description: 'The user who last updated the connection.' }),
171
- tslib_1.__metadata("design:type", auth_base_1.User
172
- /**
173
- * Stores the ID of the User who last updated the connection.
174
- *
175
- */
176
- )
177
- ], Connection.prototype, "updater", void 0);
178
- tslib_1.__decorate([
179
- (0, typeorm_1.RelationId)((connection) => connection.updater),
180
- tslib_1.__metadata("design:type", String)
181
- ], Connection.prototype, "updaterId", void 0);
182
- exports.Connection = Connection = tslib_1.__decorate([
183
- (0, typeorm_1.Entity)(),
184
- (0, typeorm_1.Index)('ix_connection_0', (connection) => [connection.domain, connection.name], { unique: true }),
185
- (0, type_graphql_1.ObjectType)({ description: 'Represents a configured connection to an external system or service.' })
186
- ], Connection);
8
+ const connection_1 = require("./connection");
9
+ const connection_2 = require("./connection");
187
10
  let ConnectionState = class ConnectionState {
188
11
  };
189
12
  exports.ConnectionState = ConnectionState;
@@ -207,6 +30,13 @@ tslib_1.__decorate([
207
30
  (0, type_graphql_1.Field)({ nullable: true, description: 'The type of the connection.' }),
208
31
  tslib_1.__metadata("design:type", String)
209
32
  ], ConnectionState.prototype, "type", void 0);
33
+ tslib_1.__decorate([
34
+ (0, type_graphql_1.Field)({
35
+ nullable: true,
36
+ description: 'When true, connection is created on-demand when needed and cleaned up after use.'
37
+ }),
38
+ tslib_1.__metadata("design:type", Boolean)
39
+ ], ConnectionState.prototype, "onDemand", void 0);
210
40
  tslib_1.__decorate([
211
41
  (0, type_graphql_1.Field)(type => auth_base_1.Appliance, { nullable: true, description: 'The edge appliance associated with the connection.' }),
212
42
  tslib_1.__metadata("design:type", auth_base_1.Appliance)
@@ -237,6 +67,13 @@ tslib_1.__decorate([
237
67
  (0, type_graphql_1.Field)({ nullable: true, description: 'The type of the new connection (e.g., tcp, http, mqtt).' }),
238
68
  tslib_1.__metadata("design:type", String)
239
69
  ], NewConnection.prototype, "type", void 0);
70
+ tslib_1.__decorate([
71
+ (0, type_graphql_1.Field)({
72
+ nullable: true,
73
+ description: 'When true, connection is created on-demand when needed and cleaned up after use.'
74
+ }),
75
+ tslib_1.__metadata("design:type", Boolean)
76
+ ], NewConnection.prototype, "onDemand", void 0);
240
77
  tslib_1.__decorate([
241
78
  (0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'Reference to the edge appliance for the new connection.' }),
242
79
  tslib_1.__metadata("design:type", auth_base_1.Appliance)
@@ -245,6 +82,13 @@ tslib_1.__decorate([
245
82
  (0, type_graphql_1.Field)({ nullable: true, description: 'The endpoint URL or address for the new connection.' }),
246
83
  tslib_1.__metadata("design:type", String)
247
84
  ], NewConnection.prototype, "endpoint", void 0);
85
+ tslib_1.__decorate([
86
+ (0, type_graphql_1.Field)({
87
+ nullable: true,
88
+ description: 'Whether to automatically connect when the application starts'
89
+ }),
90
+ tslib_1.__metadata("design:type", Boolean)
91
+ ], NewConnection.prototype, "active", void 0);
248
92
  tslib_1.__decorate([
249
93
  (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'A key-value map of parameters for the new connection.' }),
250
94
  tslib_1.__metadata("design:type", Object)
@@ -271,6 +115,13 @@ tslib_1.__decorate([
271
115
  (0, type_graphql_1.Field)({ nullable: true, description: 'The new type for the connection.' }),
272
116
  tslib_1.__metadata("design:type", String)
273
117
  ], ConnectionPatch.prototype, "type", void 0);
118
+ tslib_1.__decorate([
119
+ (0, type_graphql_1.Field)({
120
+ nullable: true,
121
+ description: 'When true, connection is created on-demand when needed and cleaned up after use.'
122
+ }),
123
+ tslib_1.__metadata("design:type", Boolean)
124
+ ], ConnectionPatch.prototype, "onDemand", void 0);
274
125
  tslib_1.__decorate([
275
126
  (0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: 'The new edge appliance for the connection.' }),
276
127
  tslib_1.__metadata("design:type", auth_base_1.Appliance)
@@ -280,7 +131,10 @@ tslib_1.__decorate([
280
131
  tslib_1.__metadata("design:type", String)
281
132
  ], ConnectionPatch.prototype, "endpoint", void 0);
282
133
  tslib_1.__decorate([
283
- (0, type_graphql_1.Field)({ nullable: true, description: 'The new active status for the connection.' }),
134
+ (0, type_graphql_1.Field)({
135
+ nullable: true,
136
+ description: 'Whether to automatically connect when the application starts'
137
+ }),
284
138
  tslib_1.__metadata("design:type", Boolean)
285
139
  ], ConnectionPatch.prototype, "active", void 0);
286
140
  tslib_1.__decorate([
@@ -301,7 +155,7 @@ let ConnectionList = class ConnectionList {
301
155
  };
302
156
  exports.ConnectionList = ConnectionList;
303
157
  tslib_1.__decorate([
304
- (0, type_graphql_1.Field)(type => [Connection], { description: 'The list of connection items.' }),
158
+ (0, type_graphql_1.Field)(type => [connection_1.Connection], { description: 'The list of connection items.' }),
305
159
  tslib_1.__metadata("design:type", Array)
306
160
  ], ConnectionList.prototype, "items", void 0);
307
161
  tslib_1.__decorate([
@@ -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,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,gB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,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;;+CACxE;AAM/B;IAJC,IAAA,oBAAK,EAAC;QACL,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,iFAAiF;KAC/F,CAAC;;+CACa;0BA7BJ,eAAe;IAD3B,IAAA,wBAAS,EAAC,EAAE,WAAW,EAAE,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
+ {"version":3,"file":"connection-type.js","sourceRoot":"","sources":["../../../server/service/connection/connection-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,yDAAqD;AACrD,iDAAuE;AAEvE,6CAAyC;AACzC,6CAA+C;AAYxC,IAAM,eAAe,GAArB,MAAM,eAAe;CA8B3B,CAAA;AA9BY,0CAAe;AAE1B;IADC,IAAA,oBAAK,EAA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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 } from 'type-graphql'\n\nimport { Appliance } from '@things-factory/auth-base'\nimport { Domain, ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { Connection } from './connection'\nimport { ConnectionStatus } from './connection'\n\n/**\n * Connection์˜ params์˜ ์› ํƒ€์ž…๊ณผ ์‚ฌ์šฉ ์‹œ์— ํƒ€์ž… ๋ถˆ์ผ์น˜๋กœ ์ธํ•ด ์ž„์‹œ์ ์œผ๋กœ ์ƒ์„ฑํ•œ ํƒ€์ž…์œผ๋กœ\n * ์ถ”ํ›„, ํƒ€์ž… ์ผ์น˜๋ฅผ ํ†ตํ•ด์„œ ์ œ๊ฑฐํ•  ์˜ˆ์ •์ž„.\n *\n */\nexport interface InputConnection extends Connection {\n params: { [key: string]: 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({\n nullable: true,\n description: 'When true, connection is created on-demand when needed and cleaned up after use.'\n })\n onDemand?: boolean\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({\n nullable: true,\n description: 'When true, connection is created on-demand when needed and cleaned up after use.'\n })\n onDemand: boolean\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({\n nullable: true,\n description: 'Whether to automatically connect when the application starts'\n })\n active?: boolean\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({\n nullable: true,\n description: 'When true, connection is created on-demand when needed and cleaned up after use.'\n })\n onDemand: boolean\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({\n nullable: true,\n description: 'Whether to automatically connect when the application starts'\n })\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"]}
@@ -0,0 +1,119 @@
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
+ * Whether to automatically connect when the application starts
46
+ */
47
+ active: boolean;
48
+ /**
49
+ * Indicates whether the connection should be created on-demand when needed.
50
+ */
51
+ onDemand: boolean;
52
+ /**
53
+ * The status of the connection, using the ConnectionStatus type.
54
+ */
55
+ state: ConnectionStatus;
56
+ /**
57
+ * Additional parameters for the connection, stored as a JSON string.
58
+ *
59
+ * [Caution]
60
+ * ์ด ์ปฌ๋Ÿผํƒ€์ž…์€ postgres ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ๋Š” varchar ํƒ€์ž…์„ ์œ ์ง€ํ•œ๋‹ค.
61
+ * ์ด๋Š” ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ํƒ€์ž…์„ ๋ณ€๊ฒฝํ•˜๋ฉด ๊ธฐ์กด ๋ฐ์ดํ„ฐ๊ฐ€ ์†์‹ค๋  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.
62
+ */
63
+ params: {
64
+ [key: string]: any;
65
+ };
66
+ /**
67
+ * The date and time when the connection was created.
68
+ */
69
+ createdAt: Date;
70
+ /**
71
+ * The date and time when the connection was last updated.
72
+ */
73
+ updatedAt: Date;
74
+ /**
75
+ * Many-to-One relationship with the User entity who created the connection. Optional field.
76
+ */
77
+ creator: User;
78
+ /**
79
+ * Stores the ID of the User who created the connection.
80
+ */
81
+ creatorId: string;
82
+ /**
83
+ * Many-to-One relationship with the User entity who last updated the connection.
84
+ * Optional field.
85
+ */
86
+ updater: User;
87
+ /**
88
+ * Stores the ID of the User who last updated the connection.
89
+ *
90
+ */
91
+ updaterId: string;
92
+ /**
93
+ * Asynchronous method to establish the connection.
94
+ *
95
+ */
96
+ connect(): Promise<void>;
97
+ /**
98
+ * @brief Asynchronous method to disconnect the connection.
99
+ *
100
+ */
101
+ disconnect(): Promise<void>;
102
+ /**
103
+ * Gets a parameter value with fallback to EnvVar.
104
+ * Priority: params โ†’ EnvVar (only for useDomainAttribute=true)
105
+ *
106
+ * @param key - The parameter key
107
+ * @param defaultValue - Optional default value
108
+ * @returns The parameter value or default value
109
+ */
110
+ getParameter(key: string, defaultValue?: any): Promise<any>;
111
+ /**
112
+ * Gets all parameters with resolved values (params + Domain attributes).
113
+ *
114
+ * @returns Object with all resolved parameter values
115
+ */
116
+ getResolvedParameters(): Promise<{
117
+ [key: string]: any;
118
+ }>;
119
+ }