@things-factory/integration-base 9.0.0-beta.80 → 9.0.1

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 (76) hide show
  1. package/dist-server/engine/task/headless-scrap.js +10 -1
  2. package/dist-server/engine/task/headless-scrap.js.map +1 -1
  3. package/dist-server/service/analysis/analysis-query.d.ts +3 -0
  4. package/dist-server/service/analysis/analysis-query.js +6 -1
  5. package/dist-server/service/analysis/analysis-query.js.map +1 -1
  6. package/dist-server/service/connection/connection-mutation.js +10 -8
  7. package/dist-server/service/connection/connection-mutation.js.map +1 -1
  8. package/dist-server/service/connection/connection-query.d.ts +3 -0
  9. package/dist-server/service/connection/connection-query.js +10 -3
  10. package/dist-server/service/connection/connection-query.js.map +1 -1
  11. package/dist-server/service/connection/connection-subscription.js +5 -1
  12. package/dist-server/service/connection/connection-subscription.js.map +1 -1
  13. package/dist-server/service/connection/connection-type.d.ts +1 -1
  14. package/dist-server/service/connection/connection-type.js +52 -46
  15. package/dist-server/service/connection/connection-type.js.map +1 -1
  16. package/dist-server/service/connector/connector-query.d.ts +4 -1
  17. package/dist-server/service/connector/connector-query.js +8 -5
  18. package/dist-server/service/connector/connector-query.js.map +1 -1
  19. package/dist-server/service/connector/connector-type.js +12 -9
  20. package/dist-server/service/connector/connector-type.js.map +1 -1
  21. package/dist-server/service/payload-log/payload-log-mutation.js +5 -5
  22. package/dist-server/service/payload-log/payload-log-mutation.js.map +1 -1
  23. package/dist-server/service/payload-log/payload-log-query.d.ts +3 -0
  24. package/dist-server/service/payload-log/payload-log-query.js +5 -2
  25. package/dist-server/service/payload-log/payload-log-query.js.map +1 -1
  26. package/dist-server/service/payload-log/payload-log-type.js +11 -11
  27. package/dist-server/service/payload-log/payload-log-type.js.map +1 -1
  28. package/dist-server/service/payload-log/payload-log.d.ts +1 -1
  29. package/dist-server/service/payload-log/payload-log.js +18 -14
  30. package/dist-server/service/payload-log/payload-log.js.map +1 -1
  31. package/dist-server/service/property-spec.js +12 -7
  32. package/dist-server/service/property-spec.js.map +1 -1
  33. package/dist-server/service/scenario/scenario-mutation.js +15 -14
  34. package/dist-server/service/scenario/scenario-mutation.js.map +1 -1
  35. package/dist-server/service/scenario/scenario-query.d.ts +3 -0
  36. package/dist-server/service/scenario/scenario-query.js +5 -2
  37. package/dist-server/service/scenario/scenario-query.js.map +1 -1
  38. package/dist-server/service/scenario/scenario-type.js +27 -24
  39. package/dist-server/service/scenario/scenario-type.js.map +1 -1
  40. package/dist-server/service/scenario/scenario.js +22 -19
  41. package/dist-server/service/scenario/scenario.js.map +1 -1
  42. package/dist-server/service/scenario-instance/scenario-instance-mutation.js +8 -3
  43. package/dist-server/service/scenario-instance/scenario-instance-mutation.js.map +1 -1
  44. package/dist-server/service/scenario-instance/scenario-instance-query.d.ts +3 -0
  45. package/dist-server/service/scenario-instance/scenario-instance-query.js +5 -2
  46. package/dist-server/service/scenario-instance/scenario-instance-query.js.map +1 -1
  47. package/dist-server/service/scenario-instance/scenario-instance-subscription.js +4 -1
  48. package/dist-server/service/scenario-instance/scenario-instance-subscription.js.map +1 -1
  49. package/dist-server/service/scenario-instance/scenario-instance-type.js +50 -41
  50. package/dist-server/service/scenario-instance/scenario-instance-type.js.map +1 -1
  51. package/dist-server/service/scenario-queue/scenario-queue-subscription.js +1 -0
  52. package/dist-server/service/scenario-queue/scenario-queue-subscription.js.map +1 -1
  53. package/dist-server/service/scenario-queue/scenario-queue-type.js +8 -8
  54. package/dist-server/service/scenario-queue/scenario-queue-type.js.map +1 -1
  55. package/dist-server/service/state-register/state-register-mutation.js +9 -7
  56. package/dist-server/service/state-register/state-register-mutation.js.map +1 -1
  57. package/dist-server/service/state-register/state-register-query.d.ts +3 -0
  58. package/dist-server/service/state-register/state-register-query.js +6 -3
  59. package/dist-server/service/state-register/state-register-query.js.map +1 -1
  60. package/dist-server/service/state-register/state-register-type.js +3 -3
  61. package/dist-server/service/state-register/state-register-type.js.map +1 -1
  62. package/dist-server/service/state-register/state-register.js +4 -2
  63. package/dist-server/service/state-register/state-register.js.map +1 -1
  64. package/dist-server/service/step/step-mutation.js +4 -2
  65. package/dist-server/service/step/step-mutation.js.map +1 -1
  66. package/dist-server/service/step/step-query.d.ts +3 -0
  67. package/dist-server/service/step/step-query.js +5 -2
  68. package/dist-server/service/step/step-query.js.map +1 -1
  69. package/dist-server/service/step/step-type.js +32 -32
  70. package/dist-server/service/step/step-type.js.map +1 -1
  71. package/dist-server/service/task-type/task-type-query.js +5 -3
  72. package/dist-server/service/task-type/task-type-query.js.map +1 -1
  73. package/dist-server/service/task-type/task-type-type.js +12 -9
  74. package/dist-server/service/task-type/task-type-type.js.map +1 -1
  75. package/dist-server/tsconfig.tsbuildinfo +1 -1
  76. package/package.json +11 -11
@@ -14,11 +14,11 @@ const DATABASE_TYPE = ORMCONFIG.type;
14
14
  var ConnectionStatus;
15
15
  (function (ConnectionStatus) {
16
16
  ConnectionStatus["CONNECTED"] = "CONNECTED";
17
- ConnectionStatus["DISCONNECTED"] = "DISCONNECTED";
17
+ ConnectionStatus["DISCONNECTED"] = "DISCONNECTED"; // Represents a terminated or inactive connection.
18
18
  })(ConnectionStatus || (exports.ConnectionStatus = ConnectionStatus = {}));
19
19
  (0, type_graphql_1.registerEnumType)(ConnectionStatus, {
20
20
  name: 'ConnectionStatus',
21
- description: 'state enumeration of a connection'
21
+ description: 'Enumeration of possible states for a connection.'
22
22
  });
23
23
  let Connection = class Connection {
24
24
  /**
@@ -50,12 +50,12 @@ let Connection = class Connection {
50
50
  exports.Connection = Connection;
51
51
  tslib_1.__decorate([
52
52
  (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
53
- (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.' }),
54
54
  tslib_1.__metadata("design:type", String)
55
55
  ], Connection.prototype, "id", void 0);
56
56
  tslib_1.__decorate([
57
57
  (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
58
- (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.' }),
59
59
  tslib_1.__metadata("design:type", shell_1.Domain
60
60
  /**
61
61
  * Stores the ID of the associated Domain.
@@ -68,24 +68,24 @@ tslib_1.__decorate([
68
68
  ], Connection.prototype, "domainId", void 0);
69
69
  tslib_1.__decorate([
70
70
  (0, typeorm_1.Column)(),
71
- (0, type_graphql_1.Field)(),
71
+ (0, type_graphql_1.Field)({ description: 'The name of the connection.' }),
72
72
  tslib_1.__metadata("design:type", String)
73
73
  ], Connection.prototype, "name", void 0);
74
74
  tslib_1.__decorate([
75
75
  (0, typeorm_1.Column)({
76
76
  nullable: true
77
77
  }),
78
- (0, type_graphql_1.Field)({ nullable: true }),
78
+ (0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description of the connection.' }),
79
79
  tslib_1.__metadata("design:type", String)
80
80
  ], Connection.prototype, "description", void 0);
81
81
  tslib_1.__decorate([
82
82
  (0, typeorm_1.Column)(),
83
- (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).' }),
84
84
  tslib_1.__metadata("design:type", String)
85
85
  ], Connection.prototype, "type", void 0);
86
86
  tslib_1.__decorate([
87
87
  (0, typeorm_1.ManyToOne)(type => auth_base_1.Appliance, { nullable: true }),
88
- (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.' }),
89
89
  tslib_1.__metadata("design:type", auth_base_1.Appliance
90
90
  /**
91
91
  * Stores the ID of the Appliance who delegate the connection.
@@ -98,16 +98,19 @@ tslib_1.__decorate([
98
98
  ], Connection.prototype, "edgeId", void 0);
99
99
  tslib_1.__decorate([
100
100
  (0, typeorm_1.Column)(),
101
- (0, type_graphql_1.Field)({ nullable: true }),
101
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The endpoint URL or address for the connection.' }),
102
102
  tslib_1.__metadata("design:type", String)
103
103
  ], Connection.prototype, "endpoint", void 0);
104
104
  tslib_1.__decorate([
105
105
  (0, typeorm_1.Column)({ nullable: true }),
106
- (0, type_graphql_1.Field)({ 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
+ }),
107
110
  tslib_1.__metadata("design:type", Boolean)
108
111
  ], Connection.prototype, "active", void 0);
109
112
  tslib_1.__decorate([
110
- (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).' }),
111
114
  tslib_1.__metadata("design:type", String)
112
115
  ], Connection.prototype, "state", void 0);
113
116
  tslib_1.__decorate([
@@ -128,12 +131,12 @@ tslib_1.__decorate([
128
131
  }
129
132
  : undefined
130
133
  }),
131
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
134
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'A key-value map of parameters for the connection.' }),
132
135
  tslib_1.__metadata("design:type", Object)
133
136
  ], Connection.prototype, "params", void 0);
134
137
  tslib_1.__decorate([
135
138
  (0, typeorm_1.CreateDateColumn)(),
136
- (0, type_graphql_1.Field)({ nullable: true }),
139
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the connection was created.' }),
137
140
  tslib_1.__metadata("design:type", Date
138
141
  /**
139
142
  * The date and time when the connection was last updated.
@@ -142,7 +145,7 @@ tslib_1.__decorate([
142
145
  ], Connection.prototype, "createdAt", void 0);
143
146
  tslib_1.__decorate([
144
147
  (0, typeorm_1.UpdateDateColumn)(),
145
- (0, type_graphql_1.Field)({ nullable: true }),
148
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when the connection was last updated.' }),
146
149
  tslib_1.__metadata("design:type", Date
147
150
  /**
148
151
  * Many-to-One relationship with the User entity who created the connection. Optional field.
@@ -151,7 +154,7 @@ tslib_1.__decorate([
151
154
  ], Connection.prototype, "updatedAt", void 0);
152
155
  tslib_1.__decorate([
153
156
  (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
154
- (0, type_graphql_1.Field)({ nullable: true }),
157
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The user who created the connection.' }),
155
158
  tslib_1.__metadata("design:type", auth_base_1.User
156
159
  /**
157
160
  * Stores the ID of the User who created the connection.
@@ -164,7 +167,7 @@ tslib_1.__decorate([
164
167
  ], Connection.prototype, "creatorId", void 0);
165
168
  tslib_1.__decorate([
166
169
  (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
167
- (0, type_graphql_1.Field)({ nullable: true }),
170
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The user who last updated the connection.' }),
168
171
  tslib_1.__metadata("design:type", auth_base_1.User
169
172
  /**
170
173
  * Stores the ID of the User who last updated the connection.
@@ -179,130 +182,133 @@ tslib_1.__decorate([
179
182
  exports.Connection = Connection = tslib_1.__decorate([
180
183
  (0, typeorm_1.Entity)(),
181
184
  (0, typeorm_1.Index)('ix_connection_0', (connection) => [connection.domain, connection.name], { unique: true }),
182
- (0, type_graphql_1.ObjectType)()
185
+ (0, type_graphql_1.ObjectType)({ description: 'Represents a configured connection to an external system or service.' })
183
186
  ], Connection);
184
187
  let ConnectionState = class ConnectionState {
185
188
  };
186
189
  exports.ConnectionState = ConnectionState;
187
190
  tslib_1.__decorate([
188
- (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.' }),
189
192
  tslib_1.__metadata("design:type", shell_1.Domain)
190
193
  ], ConnectionState.prototype, "domain", void 0);
191
194
  tslib_1.__decorate([
192
- (0, type_graphql_1.Field)({ nullable: true }),
195
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The unique identifier of the connection.' }),
193
196
  tslib_1.__metadata("design:type", String)
194
197
  ], ConnectionState.prototype, "id", void 0);
195
198
  tslib_1.__decorate([
196
- (0, type_graphql_1.Field)({ nullable: true }),
199
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The name of the connection.' }),
197
200
  tslib_1.__metadata("design:type", String)
198
201
  ], ConnectionState.prototype, "name", void 0);
199
202
  tslib_1.__decorate([
200
- (0, type_graphql_1.Field)({ nullable: true }),
203
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The description of the connection.' }),
201
204
  tslib_1.__metadata("design:type", String)
202
205
  ], ConnectionState.prototype, "description", void 0);
203
206
  tslib_1.__decorate([
204
- (0, type_graphql_1.Field)({ nullable: true }),
207
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The type of the connection.' }),
205
208
  tslib_1.__metadata("design:type", String)
206
209
  ], ConnectionState.prototype, "type", void 0);
207
210
  tslib_1.__decorate([
208
- (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.' }),
209
212
  tslib_1.__metadata("design:type", auth_base_1.Appliance)
210
213
  ], ConnectionState.prototype, "edge", void 0);
211
214
  tslib_1.__decorate([
212
- (0, type_graphql_1.Field)({ nullable: true }),
215
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The current status of the connection.' }),
213
216
  tslib_1.__metadata("design:type", String)
214
217
  ], ConnectionState.prototype, "state", void 0);
215
218
  tslib_1.__decorate([
216
- (0, type_graphql_1.Field)({ nullable: true }),
219
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The timestamp when this state was recorded.' }),
217
220
  tslib_1.__metadata("design:type", Date)
218
221
  ], ConnectionState.prototype, "timestamp", void 0);
219
222
  exports.ConnectionState = ConnectionState = tslib_1.__decorate([
220
- (0, type_graphql_1.ObjectType)()
223
+ (0, type_graphql_1.ObjectType)({ description: 'Represents the state of a connection at a point in time.' })
221
224
  ], ConnectionState);
222
225
  let NewConnection = class NewConnection {
223
226
  };
224
227
  exports.NewConnection = NewConnection;
225
228
  tslib_1.__decorate([
226
- (0, type_graphql_1.Field)(),
229
+ (0, type_graphql_1.Field)({ description: 'The name for the new connection.' }),
227
230
  tslib_1.__metadata("design:type", String)
228
231
  ], NewConnection.prototype, "name", void 0);
229
232
  tslib_1.__decorate([
230
- (0, type_graphql_1.Field)({ nullable: true }),
233
+ (0, type_graphql_1.Field)({ nullable: true, description: 'A detailed description for the new connection.' }),
231
234
  tslib_1.__metadata("design:type", String)
232
235
  ], NewConnection.prototype, "description", void 0);
233
236
  tslib_1.__decorate([
234
- (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).' }),
235
238
  tslib_1.__metadata("design:type", String)
236
239
  ], NewConnection.prototype, "type", void 0);
237
240
  tslib_1.__decorate([
238
- (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.' }),
239
242
  tslib_1.__metadata("design:type", auth_base_1.Appliance)
240
243
  ], NewConnection.prototype, "edge", void 0);
241
244
  tslib_1.__decorate([
242
- (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.' }),
243
246
  tslib_1.__metadata("design:type", String)
244
247
  ], NewConnection.prototype, "endpoint", void 0);
245
248
  tslib_1.__decorate([
246
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
249
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'A key-value map of parameters for the new connection.' }),
247
250
  tslib_1.__metadata("design:type", Object)
248
251
  ], NewConnection.prototype, "params", void 0);
249
252
  exports.NewConnection = NewConnection = tslib_1.__decorate([
250
- (0, type_graphql_1.InputType)()
253
+ (0, type_graphql_1.InputType)({ description: 'Input for creating a new connection.' })
251
254
  ], NewConnection);
252
255
  let ConnectionPatch = class ConnectionPatch {
253
256
  };
254
257
  exports.ConnectionPatch = ConnectionPatch;
255
258
  tslib_1.__decorate([
256
- (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.' }),
257
260
  tslib_1.__metadata("design:type", String)
258
261
  ], ConnectionPatch.prototype, "id", void 0);
259
262
  tslib_1.__decorate([
260
- (0, type_graphql_1.Field)({ nullable: true }),
263
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new name for the connection.' }),
261
264
  tslib_1.__metadata("design:type", String)
262
265
  ], ConnectionPatch.prototype, "name", void 0);
263
266
  tslib_1.__decorate([
264
- (0, type_graphql_1.Field)({ nullable: true }),
267
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new description for the connection.' }),
265
268
  tslib_1.__metadata("design:type", String)
266
269
  ], ConnectionPatch.prototype, "description", void 0);
267
270
  tslib_1.__decorate([
268
- (0, type_graphql_1.Field)({ nullable: true }),
271
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new type for the connection.' }),
269
272
  tslib_1.__metadata("design:type", String)
270
273
  ], ConnectionPatch.prototype, "type", void 0);
271
274
  tslib_1.__decorate([
272
- (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.' }),
273
276
  tslib_1.__metadata("design:type", auth_base_1.Appliance)
274
277
  ], ConnectionPatch.prototype, "edge", void 0);
275
278
  tslib_1.__decorate([
276
- (0, type_graphql_1.Field)({ nullable: true }),
279
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new endpoint for the connection.' }),
277
280
  tslib_1.__metadata("design:type", String)
278
281
  ], ConnectionPatch.prototype, "endpoint", void 0);
279
282
  tslib_1.__decorate([
280
- (0, type_graphql_1.Field)({ nullable: true }),
283
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The new active status for the connection.' }),
281
284
  tslib_1.__metadata("design:type", Boolean)
282
285
  ], ConnectionPatch.prototype, "active", void 0);
283
286
  tslib_1.__decorate([
284
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
287
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'The new parameters for the connection.' }),
285
288
  tslib_1.__metadata("design:type", Object)
286
289
  ], ConnectionPatch.prototype, "params", void 0);
287
290
  tslib_1.__decorate([
288
- (0, type_graphql_1.Field)({ nullable: true }),
291
+ (0, type_graphql_1.Field)({
292
+ nullable: true,
293
+ description: 'A flag indicating whether the connection is being created, updated, or deleted.'
294
+ }),
289
295
  tslib_1.__metadata("design:type", String)
290
296
  ], ConnectionPatch.prototype, "cuFlag", void 0);
291
297
  exports.ConnectionPatch = ConnectionPatch = tslib_1.__decorate([
292
- (0, type_graphql_1.InputType)()
298
+ (0, type_graphql_1.InputType)({ description: 'Input for updating (patching) an existing connection.' })
293
299
  ], ConnectionPatch);
294
300
  let ConnectionList = class ConnectionList {
295
301
  };
296
302
  exports.ConnectionList = ConnectionList;
297
303
  tslib_1.__decorate([
298
- (0, type_graphql_1.Field)(type => [Connection]),
304
+ (0, type_graphql_1.Field)(type => [Connection], { description: 'The list of connection items.' }),
299
305
  tslib_1.__metadata("design:type", Array)
300
306
  ], ConnectionList.prototype, "items", void 0);
301
307
  tslib_1.__decorate([
302
- (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.' }),
303
309
  tslib_1.__metadata("design:type", Number)
304
310
  ], ConnectionList.prototype, "total", void 0);
305
311
  exports.ConnectionList = ConnectionList = tslib_1.__decorate([
306
- (0, type_graphql_1.ObjectType)()
312
+ (0, type_graphql_1.ObjectType)({ description: 'A paginated list of connections.' })
307
313
  ], ConnectionList);
308
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,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;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;IAmJrB;;;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,IAAI,CAAC,MAAM,IAAI,EAAE;SAC1B,CAAC,CAAA;IACJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU;QACd,IAAI,CAAC;YACH,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;YAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,gCAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,0BAAiB,CAAC,YAAY,CAAC,IAAI,CA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EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACb;AAGb;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACtC,qBAAS;6CAAA;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACjB;AAG/B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACX;0BA1BJ,eAAe;IAD3B,IAAA,wBAAS,GAAE;GACC,eAAe,CA2B3B;AAGM,IAAM,cAAc,GAApB,MAAM,cAAc;CAM1B,CAAA;AANY,wCAAc;AAEzB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;;6CACT;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;6CACN;yBALF,cAAc;IAD1B,IAAA,yBAAU,GAAE;GACA,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',\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 * [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 })\n params: { [key: string]: any }\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\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()\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(type => ScalarObject, { nullable: true })\n params?: { [key: string]: any }\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(type => ScalarObject, { nullable: true })\n params?: { [key: string]: any }\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,CA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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,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
- connection(name: string, context: ResolverContext): Promise<ConnectorType>;
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 connection(name, context) {
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: 'To fetch a connector' }),
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, "connection", null);
62
+ ], ConnectorQuery.prototype, "connector", null);
60
63
  tslib_1.__decorate([
61
- (0, type_graphql_1.Query)(returns => connector_type_1.ConnectorList, { description: 'To fetch multiple connector' }),
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: 'To fetch the connector from a connection' }),
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;AAGxD,IAAM,cAAc,GAApB,MAAM,cAAc;IAEnB,AAAN,KAAK,CAAC,UAAU,CAAc,IAAY,EAAS,OAAwB;QACzE,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,YA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AAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;IACvD,mBAAA,IAAA,kBAAG,EAAC,MAAM,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;gDAWjD;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;;;;gDAsB/E;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;IAE1F,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@Resolver(ConnectorType)\nexport class ConnectorQuery {\n @Query(returns => ConnectorType, { description: 'To fetch a connector' })\n async connection(@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: 'To fetch multiple connector' })\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: 'To fetch the connector from a 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
+ {"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,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;gBAClC,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,aAAa,EAAE,SAAS,CAAC,aAAa;gBACtC,YAAY,EAAE,SAAS,CAAC,YAAY,IA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B,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], { nullable: true }),
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;CAezB,CAAA;AAfY,sCAAa;AAExB;IADC,IAAA,oBAAK,GAAE;;2CACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACP;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAGb;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACrB;AAG7B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACrB;wBAdZ,aAAa;IADzB,IAAA,yBAAU,GAAE;GACA,aAAa,CAezB;AAGM,IAAM,aAAa,GAAnB,MAAM,aAAa;CAMzB,CAAA;AANY,sCAAa;AAExB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC;;4CACT;AAGtB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;4CACN;wBALF,aAAa;IADzB,IAAA,yBAAU,GAAE;GACA,aAAa,CAMzB","sourcesContent":["import { ObjectType, Field, Int } from 'type-graphql'\nimport { PropertySpec } from '../property-spec'\n\n@ObjectType()\nexport class ConnectorType {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description: string\n\n @Field({ nullable: true })\n help?: string\n\n @Field(type => [PropertySpec], { nullable: true })\n parameterSpec: PropertySpec[]\n\n @Field(type => [String], { nullable: true })\n taskPrefixes?: string[]\n}\n\n@ObjectType()\nexport class ConnectorList {\n @Field(type => [ConnectorType])\n items: ConnectorType[]\n\n @Field(type => Int)\n total: number\n}\n"]}
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"]}
@@ -80,7 +80,7 @@ let PayloadLogMutation = class PayloadLogMutation {
80
80
  exports.PayloadLogMutation = PayloadLogMutation;
81
81
  tslib_1.__decorate([
82
82
  (0, type_graphql_1.Directive)('@transaction'),
83
- (0, type_graphql_1.Mutation)(returns => payload_log_1.PayloadLog, { description: 'To create new PayloadLog' }),
83
+ (0, type_graphql_1.Mutation)(returns => payload_log_1.PayloadLog, { description: 'Creates a new payload log.' }),
84
84
  tslib_1.__param(0, (0, type_graphql_1.Arg)('payloadLog')),
85
85
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
86
86
  tslib_1.__metadata("design:type", Function),
@@ -89,7 +89,7 @@ tslib_1.__decorate([
89
89
  ], PayloadLogMutation.prototype, "createPayloadLog", null);
90
90
  tslib_1.__decorate([
91
91
  (0, type_graphql_1.Directive)('@transaction'),
92
- (0, type_graphql_1.Mutation)(returns => payload_log_1.PayloadLog, { description: 'To modify PayloadLog information' }),
92
+ (0, type_graphql_1.Mutation)(returns => payload_log_1.PayloadLog, { description: 'Updates an existing payload log.' }),
93
93
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
94
94
  tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
95
95
  tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
@@ -99,7 +99,7 @@ tslib_1.__decorate([
99
99
  ], PayloadLogMutation.prototype, "updatePayloadLog", null);
100
100
  tslib_1.__decorate([
101
101
  (0, type_graphql_1.Directive)('@transaction'),
102
- (0, type_graphql_1.Mutation)(returns => [payload_log_1.PayloadLog], { description: "To modify multiple PayloadLogs' information" }),
102
+ (0, type_graphql_1.Mutation)(returns => [payload_log_1.PayloadLog], { description: 'Updates multiple payload logs at once.' }),
103
103
  tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [payload_log_type_1.PayloadLogPatch])),
104
104
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
105
105
  tslib_1.__metadata("design:type", Function),
@@ -108,7 +108,7 @@ tslib_1.__decorate([
108
108
  ], PayloadLogMutation.prototype, "updateMultiplePayloadLog", null);
109
109
  tslib_1.__decorate([
110
110
  (0, type_graphql_1.Directive)('@transaction'),
111
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete PayloadLog' }),
111
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'Deletes a single payload log by its ID.' }),
112
112
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
113
113
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
114
114
  tslib_1.__metadata("design:type", Function),
@@ -117,7 +117,7 @@ tslib_1.__decorate([
117
117
  ], PayloadLogMutation.prototype, "deletePayloadLog", null);
118
118
  tslib_1.__decorate([
119
119
  (0, type_graphql_1.Directive)('@transaction'),
120
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple payloadLogs' }),
120
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'Deletes multiple payload logs by their IDs.' }),
121
121
  tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
122
122
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
123
123
  tslib_1.__metadata("design:type", Function),
@@ -1 +1 @@
1
- {"version":3,"file":"payload-log-mutation.js","sourceRoot":"","sources":["../../../server/service/payload-log/payload-log-mutation.ts"],"names":[],"mappings":";;;AAyHA,4CA6BC;;AAtJD,+CAAsE;AACtE,qCAA4B;AAG5B,6CAA4C;AAC5C,iDAA6D;AAE7D,+CAAuD;AACvD,yDAAmE;AAG5D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAGvB,AAAN,KAAK,CAAC,gBAAgB,CACD,UAAyB,EACrC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,wBAAU,CAAC,CAAC,IAAI,CAAC;YAC7C,GAAG,UAAU;YACb,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,gBAAgB,CACT,EAAU,EACP,KAAsB,EAC7B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAA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port { In } from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { logger } from '@things-factory/env'\nimport { Domain, getRepository } from '@things-factory/shell'\n\nimport { PayloadLog, PayloadType } from './payload-log'\nimport { NewPayloadLog, PayloadLogPatch } from './payload-log-type'\n\n@Resolver(PayloadLog)\nexport class PayloadLogMutation {\n @Directive('@transaction')\n @Mutation(returns => PayloadLog, { description: 'To create new PayloadLog' })\n async createPayloadLog(\n @Arg('payloadLog') payloadLog: NewPayloadLog,\n @Ctx() context: ResolverContext\n ): Promise<PayloadLog> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(PayloadLog).save({\n ...payloadLog,\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => PayloadLog, { description: 'To modify PayloadLog information' })\n async updatePayloadLog(\n @Arg('id') id: string,\n @Arg('patch') patch: PayloadLogPatch,\n @Ctx() context: ResolverContext\n ): Promise<PayloadLog> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(PayloadLog)\n const payloadLog = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n return await repository.save({\n ...payloadLog,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [PayloadLog], { description: \"To modify multiple PayloadLogs' information\" })\n async updateMultiplePayloadLog(\n @Arg('patches', type => [PayloadLogPatch]) patches: PayloadLogPatch[],\n @Ctx() context: ResolverContext\n ): Promise<PayloadLog[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const payloadLogRepo = tx.getRepository(PayloadLog)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await payloadLogRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const payloadLog = await payloadLogRepo.findOneBy({ id: newRecord.id })\n\n const result = await payloadLogRepo.save({\n ...payloadLog,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete PayloadLog' })\n async deletePayloadLog(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(PayloadLog).delete({ domain: { id: domain.id }, id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple payloadLogs' })\n async deletePayloadLogs(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(PayloadLog).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n}\n\nexport async function createPayloadLog(\n name: string,\n endpoint: string,\n request: string,\n response: string,\n context: any,\n type: PayloadType = PayloadType.EGESTION,\n src: string = null\n): Promise<void> {\n try {\n const { domain, user }: { domain: Domain; user: User } = context?.state\n\n // disabled due to high db server usage\n await getRepository(PayloadLog).save({\n name,\n domain,\n endpoint,\n request,\n response,\n type,\n src,\n createdBy: user,\n updatedBy: user,\n createdAt: new Date(),\n updatedAt: new Date()\n })\n } catch (error) {\n logger.error(`PayloadLog Error`, error)\n }\n}\n"]}
1
+ {"version":3,"file":"payload-log-mutation.js","sourceRoot":"","sources":["../../../server/service/payload-log/payload-log-mutation.ts"],"names":[],"mappings":";;;AAyHA,4CA6BC;;AAtJD,+CAAsE;AACtE,qCAA4B;AAG5B,6CAA4C;AAC5C,iDAA6D;AAE7D,+CAAuD;AACvD,yDAAmE;AAG5D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAGvB,AAAN,KAAK,CAAC,gBAAgB,CACD,UA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,CAAC,IAAI,CAAC;YACnC,IAAI;YACJ,MAAM;YACN,QAAQ;YACR,OAAO;YACP,QAAQ;YACR,IAAI;YACJ,GAAG;YACH,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,YAAM,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAA;IACzC,CAAC;AACH,CAAC","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { logger } from '@things-factory/env'\nimport { Domain, getRepository } from '@things-factory/shell'\n\nimport { PayloadLog, PayloadType } from './payload-log'\nimport { NewPayloadLog, PayloadLogPatch } from './payload-log-type'\n\n@Resolver(PayloadLog)\nexport class PayloadLogMutation {\n @Directive('@transaction')\n @Mutation(returns => PayloadLog, { description: 'Creates a new payload log.' })\n async createPayloadLog(\n @Arg('payloadLog') payloadLog: NewPayloadLog,\n @Ctx() context: ResolverContext\n ): Promise<PayloadLog> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(PayloadLog).save({\n ...payloadLog,\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => PayloadLog, { description: 'Updates an existing payload log.' })\n async updatePayloadLog(\n @Arg('id') id: string,\n @Arg('patch') patch: PayloadLogPatch,\n @Ctx() context: ResolverContext\n ): Promise<PayloadLog> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(PayloadLog)\n const payloadLog = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n return await repository.save({\n ...payloadLog,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [PayloadLog], { description: 'Updates multiple payload logs at once.' })\n async updateMultiplePayloadLog(\n @Arg('patches', type => [PayloadLogPatch]) patches: PayloadLogPatch[],\n @Ctx() context: ResolverContext\n ): Promise<PayloadLog[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const payloadLogRepo = tx.getRepository(PayloadLog)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await payloadLogRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const payloadLog = await payloadLogRepo.findOneBy({ id: newRecord.id })\n\n const result = await payloadLogRepo.save({\n ...payloadLog,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'Deletes a single payload log by its ID.' })\n async deletePayloadLog(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(PayloadLog).delete({ domain: { id: domain.id }, id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'Deletes multiple payload logs by their IDs.' })\n async deletePayloadLogs(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(PayloadLog).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n}\n\nexport async function createPayloadLog(\n name: string,\n endpoint: string,\n request: string,\n response: string,\n context: any,\n type: PayloadType = PayloadType.EGESTION,\n src: string = null\n): Promise<void> {\n try {\n const { domain, user }: { domain: Domain; user: User } = context?.state\n\n // disabled due to high db server usage\n await getRepository(PayloadLog).save({\n name,\n domain,\n endpoint,\n request,\n response,\n type,\n src,\n createdBy: user,\n updatedBy: user,\n createdAt: new Date(),\n updatedAt: new Date()\n })\n } catch (error) {\n logger.error(`PayloadLog Error`, error)\n }\n}\n"]}
@@ -2,6 +2,9 @@ import { User } from '@things-factory/auth-base';
2
2
  import { Domain, ListParam } from '@things-factory/shell';
3
3
  import { PayloadLog } from './payload-log';
4
4
  import { PayloadLogList } from './payload-log-type';
5
+ /**
6
+ * @description Provides GraphQL resolvers for the PayloadLog entity.
7
+ */
5
8
  export declare class PayloadLogQuery {
6
9
  payloadLog(id: string, context: ResolverContext): Promise<PayloadLog>;
7
10
  payloadLogs(params: ListParam, context: ResolverContext): Promise<PayloadLogList>;