@things-factory/integration-base 4.3.216 → 4.3.219

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.
@@ -17,12 +17,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.createPayloadLog = exports.PayloadType = exports.schema = exports.entities = void 0;
18
18
  const connection_1 = require("./connection");
19
19
  const connector_1 = require("./connector");
20
+ const integration_1 = require("./integration");
21
+ const payload_log_1 = require("./payload-log");
20
22
  const scenario_1 = require("./scenario");
21
23
  const scenario_instance_1 = require("./scenario-instance");
22
24
  const scenario_queue_1 = require("./scenario-queue");
23
25
  const step_1 = require("./step");
24
26
  const task_type_1 = require("./task-type");
25
- const payload_log_1 = require("./payload-log");
26
27
  __exportStar(require("./property-spec"), exports);
27
28
  __exportStar(require("./task-type/task-type-type"), exports);
28
29
  __exportStar(require("./connector/connector-type"), exports);
@@ -33,6 +34,7 @@ __exportStar(require("./scenario-queue/scenario-queue-type"), exports);
33
34
  __exportStar(require("./step/step-type"), exports);
34
35
  __exportStar(require("./scenario-flow/scenario-flow"), exports);
35
36
  __exportStar(require("./payload-log/payload-log"), exports);
37
+ __exportStar(require("./integration/integration"), exports);
36
38
  exports.entities = [
37
39
  ...task_type_1.entities,
38
40
  ...connector_1.entities,
@@ -41,7 +43,8 @@ exports.entities = [
41
43
  ...scenario_instance_1.entities,
42
44
  ...scenario_queue_1.entities,
43
45
  ...step_1.entities,
44
- ...payload_log_1.entities
46
+ ...payload_log_1.entities,
47
+ ...integration_1.entities
45
48
  ];
46
49
  exports.schema = {
47
50
  resolverClasses: [
@@ -52,7 +55,8 @@ exports.schema = {
52
55
  ...scenario_instance_1.resolvers,
53
56
  ...scenario_queue_1.resolvers,
54
57
  ...step_1.resolvers,
55
- ...payload_log_1.resolvers
58
+ ...payload_log_1.resolvers,
59
+ ...integration_1.resolvers
56
60
  ]
57
61
  };
58
62
  var payload_log_2 = require("./payload-log/payload-log");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAA+F;AAC/F,2CAA4F;AAC5F,yCAAyF;AACzF,2DAAkH;AAClH,qDAAyG;AACzG,iCAA6E;AAC7E,2CAA0F;AAC1F,+CAAgG;AAEhG,kDAA+B;AAC/B,6DAA0C;AAC1C,6DAA0C;AAC1C,+DAA4C;AAC5C,2DAAwC;AACxC,6EAA0D;AAC1D,uEAAoD;AACpD,mDAAgC;AAChC,gEAA6C;AAC7C,4DAAyC;AAE5B,QAAA,QAAQ,GAAG;IACtB,GAAG,oBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,qBAAkB;IACrB,GAAG,mBAAgB;IACnB,GAAG,4BAAwB;IAC3B,GAAG,yBAAqB;IACxB,GAAG,eAAY;IACf,GAAG,sBAAkB;CACtB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,GAAG,qBAAiB;QACpB,GAAG,qBAAkB;QACrB,GAAG,sBAAmB;QACtB,GAAG,oBAAiB;QACpB,GAAG,6BAAyB;QAC5B,GAAG,0BAAsB;QACzB,GAAG,gBAAa;QAChB,GAAG,uBAAmB;KACvB;CACF,CAAA;AAED,yDAAuD;AAA9C,0GAAA,WAAW,OAAA;AACpB,2EAAqE;AAA5D,wHAAA,gBAAgB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAA+F;AAC/F,2CAA4F;AAC5F,+CAAkG;AAClG,+CAAgG;AAChG,yCAAyF;AACzF,2DAAkH;AAClH,qDAAyG;AACzG,iCAA6E;AAC7E,2CAA0F;AAE1F,kDAA+B;AAC/B,6DAA0C;AAC1C,6DAA0C;AAC1C,+DAA4C;AAC5C,2DAAwC;AACxC,6EAA0D;AAC1D,uEAAoD;AACpD,mDAAgC;AAChC,gEAA6C;AAC7C,4DAAyC;AACzC,4DAAyC;AAE5B,QAAA,QAAQ,GAAG;IACtB,GAAG,oBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,qBAAkB;IACrB,GAAG,mBAAgB;IACnB,GAAG,4BAAwB;IAC3B,GAAG,yBAAqB;IACxB,GAAG,eAAY;IACf,GAAG,sBAAkB;IACrB,GAAG,sBAAmB;CACvB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,GAAG,qBAAiB;QACpB,GAAG,qBAAkB;QACrB,GAAG,sBAAmB;QACtB,GAAG,oBAAiB;QACpB,GAAG,6BAAyB;QAC5B,GAAG,0BAAsB;QACzB,GAAG,gBAAa;QAChB,GAAG,uBAAmB;QACtB,GAAG,uBAAoB;KACxB;CACF,CAAA;AAED,yDAAuD;AAA9C,0GAAA,WAAW,OAAA;AACpB,2EAAqE;AAA5D,wHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolvers = exports.entities = void 0;
4
+ const integration_1 = require("./integration");
5
+ const integration_query_1 = require("./integration-query");
6
+ const integration_mutation_1 = require("./integration-mutation");
7
+ exports.entities = [integration_1.Integration];
8
+ exports.resolvers = [integration_query_1.IntegrationQuery, integration_mutation_1.IntegrationMutation];
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/integration/index.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,2DAAsD;AACtD,iEAA4D;AAE/C,QAAA,QAAQ,GAAG,CAAC,yBAAW,CAAC,CAAA;AACxB,QAAA,SAAS,GAAG,CAAC,oCAAgB,EAAE,0CAAmB,CAAC,CAAA"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.IntegrationMutation = void 0;
16
+ const type_graphql_1 = require("type-graphql");
17
+ const typeorm_1 = require("typeorm");
18
+ const integration_1 = require("./integration");
19
+ const integration_type_1 = require("./integration-type");
20
+ let IntegrationMutation = class IntegrationMutation {
21
+ async createIntegration(integration, context) {
22
+ const { domain, user, tx } = context.state;
23
+ return await tx.getRepository(integration_1.Integration).save(Object.assign(Object.assign({}, integration), { domain, creator: user, updater: user }));
24
+ }
25
+ async updateIntegration(id, patch, context) {
26
+ const { domain, user, tx } = context.state;
27
+ const repository = tx.getRepository(integration_1.Integration);
28
+ const integration = await repository.findOne({
29
+ where: { domain, id }
30
+ });
31
+ return await repository.save(Object.assign(Object.assign(Object.assign({}, integration), patch), { updater: user }));
32
+ }
33
+ async updateMultipleIntegration(patches, context) {
34
+ const { domain, user, tx } = context.state;
35
+ let results = [];
36
+ const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
37
+ const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
38
+ const integrationRepo = tx.getRepository(integration_1.Integration);
39
+ if (_createRecords.length > 0) {
40
+ for (let i = 0; i < _createRecords.length; i++) {
41
+ const newRecord = _createRecords[i];
42
+ const result = await integrationRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
43
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
44
+ }
45
+ }
46
+ if (_updateRecords.length > 0) {
47
+ for (let i = 0; i < _updateRecords.length; i++) {
48
+ const newRecord = _updateRecords[i];
49
+ const integration = await integrationRepo.findOne(newRecord.id);
50
+ const result = await integrationRepo.save(Object.assign(Object.assign(Object.assign({}, integration), newRecord), { updater: user }));
51
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
52
+ }
53
+ }
54
+ return results;
55
+ }
56
+ async deleteIntegration(id, context) {
57
+ const { domain, tx } = context.state;
58
+ await tx.getRepository(integration_1.Integration).delete({ domain, id });
59
+ return true;
60
+ }
61
+ async deleteIntegrations(ids, context) {
62
+ const { domain, tx } = context.state;
63
+ await tx.getRepository(integration_1.Integration).delete({
64
+ domain,
65
+ id: (0, typeorm_1.In)(ids)
66
+ });
67
+ return true;
68
+ }
69
+ };
70
+ __decorate([
71
+ (0, type_graphql_1.Directive)('@transaction'),
72
+ (0, type_graphql_1.Mutation)(returns => integration_1.Integration, { description: 'To create new Integration' }),
73
+ __param(0, (0, type_graphql_1.Arg)('integration')),
74
+ __param(1, (0, type_graphql_1.Ctx)()),
75
+ __metadata("design:type", Function),
76
+ __metadata("design:paramtypes", [integration_type_1.NewIntegration, Object]),
77
+ __metadata("design:returntype", Promise)
78
+ ], IntegrationMutation.prototype, "createIntegration", null);
79
+ __decorate([
80
+ (0, type_graphql_1.Directive)('@transaction'),
81
+ (0, type_graphql_1.Mutation)(returns => integration_1.Integration, { description: 'To modify Integration information' }),
82
+ __param(0, (0, type_graphql_1.Arg)('id')),
83
+ __param(1, (0, type_graphql_1.Arg)('patch')),
84
+ __param(2, (0, type_graphql_1.Ctx)()),
85
+ __metadata("design:type", Function),
86
+ __metadata("design:paramtypes", [String, integration_type_1.IntegrationPatch, Object]),
87
+ __metadata("design:returntype", Promise)
88
+ ], IntegrationMutation.prototype, "updateIntegration", null);
89
+ __decorate([
90
+ (0, type_graphql_1.Directive)('@transaction'),
91
+ (0, type_graphql_1.Mutation)(returns => [integration_1.Integration], { description: "To modify multiple Integrations' information" }),
92
+ __param(0, (0, type_graphql_1.Arg)('patches', type => [integration_type_1.IntegrationPatch])),
93
+ __param(1, (0, type_graphql_1.Ctx)()),
94
+ __metadata("design:type", Function),
95
+ __metadata("design:paramtypes", [Array, Object]),
96
+ __metadata("design:returntype", Promise)
97
+ ], IntegrationMutation.prototype, "updateMultipleIntegration", null);
98
+ __decorate([
99
+ (0, type_graphql_1.Directive)('@transaction'),
100
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Integration' }),
101
+ __param(0, (0, type_graphql_1.Arg)('id')),
102
+ __param(1, (0, type_graphql_1.Ctx)()),
103
+ __metadata("design:type", Function),
104
+ __metadata("design:paramtypes", [String, Object]),
105
+ __metadata("design:returntype", Promise)
106
+ ], IntegrationMutation.prototype, "deleteIntegration", null);
107
+ __decorate([
108
+ (0, type_graphql_1.Directive)('@transaction'),
109
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple integrations' }),
110
+ __param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
111
+ __param(1, (0, type_graphql_1.Ctx)()),
112
+ __metadata("design:type", Function),
113
+ __metadata("design:paramtypes", [Array, Object]),
114
+ __metadata("design:returntype", Promise)
115
+ ], IntegrationMutation.prototype, "deleteIntegrations", null);
116
+ IntegrationMutation = __decorate([
117
+ (0, type_graphql_1.Resolver)(integration_1.Integration)
118
+ ], IntegrationMutation);
119
+ exports.IntegrationMutation = IntegrationMutation;
120
+ //# sourceMappingURL=integration-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-mutation.js","sourceRoot":"","sources":["../../../server/service/integration/integration-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsE;AACtE,qCAA2C;AAC3C,+CAA2C;AAC3C,yDAAqE;AAG9D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAA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wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;IAC9C,WAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;4DAKpD;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAE9E,WAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAUP;AAxGU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,yBAAW,CAAC;GACT,mBAAmB,CAyG/B;AAzGY,kDAAmB"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var _a;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.IntegrationQuery = void 0;
17
+ const type_graphql_1 = require("type-graphql");
18
+ const typeorm_1 = require("typeorm");
19
+ const shell_1 = require("@things-factory/shell");
20
+ const auth_base_1 = require("@things-factory/auth-base");
21
+ const integration_1 = require("./integration");
22
+ const integration_type_1 = require("./integration-type");
23
+ let IntegrationQuery = class IntegrationQuery {
24
+ async integration(id, context) {
25
+ const { domain } = context.state;
26
+ return await (0, typeorm_1.getRepository)(integration_1.Integration).findOne({
27
+ where: { domain, id }
28
+ });
29
+ }
30
+ async integrations(params, context) {
31
+ const { domain } = context.state;
32
+ const convertedParams = (0, shell_1.convertListParams)(params, domain.id);
33
+ const [items, total] = await (0, typeorm_1.getRepository)(integration_1.Integration).findAndCount(convertedParams);
34
+ return { items, total };
35
+ }
36
+ async domain(integration) {
37
+ return await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(integration.domainId);
38
+ }
39
+ async updater(integration) {
40
+ return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(integration.updaterId);
41
+ }
42
+ async creator(integration) {
43
+ return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(integration.creatorId);
44
+ }
45
+ };
46
+ __decorate([
47
+ (0, type_graphql_1.Query)(returns => integration_1.Integration, { description: 'To fetch a Integration' }),
48
+ __param(0, (0, type_graphql_1.Arg)('id')),
49
+ __param(1, (0, type_graphql_1.Ctx)()),
50
+ __metadata("design:type", Function),
51
+ __metadata("design:paramtypes", [String, Object]),
52
+ __metadata("design:returntype", Promise)
53
+ ], IntegrationQuery.prototype, "integration", null);
54
+ __decorate([
55
+ (0, type_graphql_1.Query)(returns => integration_type_1.IntegrationList, { description: 'To fetch multiple Integrations' }),
56
+ __param(0, (0, type_graphql_1.Args)()),
57
+ __param(1, (0, type_graphql_1.Ctx)()),
58
+ __metadata("design:type", Function),
59
+ __metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
60
+ __metadata("design:returntype", Promise)
61
+ ], IntegrationQuery.prototype, "integrations", null);
62
+ __decorate([
63
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
64
+ __param(0, (0, type_graphql_1.Root)()),
65
+ __metadata("design:type", Function),
66
+ __metadata("design:paramtypes", [integration_1.Integration]),
67
+ __metadata("design:returntype", Promise)
68
+ ], IntegrationQuery.prototype, "domain", null);
69
+ __decorate([
70
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
71
+ __param(0, (0, type_graphql_1.Root)()),
72
+ __metadata("design:type", Function),
73
+ __metadata("design:paramtypes", [integration_1.Integration]),
74
+ __metadata("design:returntype", Promise)
75
+ ], IntegrationQuery.prototype, "updater", null);
76
+ __decorate([
77
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
78
+ __param(0, (0, type_graphql_1.Root)()),
79
+ __metadata("design:type", Function),
80
+ __metadata("design:paramtypes", [integration_1.Integration]),
81
+ __metadata("design:returntype", Promise)
82
+ ], IntegrationQuery.prototype, "creator", null);
83
+ IntegrationQuery = __decorate([
84
+ (0, type_graphql_1.Resolver)(integration_1.Integration)
85
+ ], IntegrationQuery);
86
+ exports.IntegrationQuery = IntegrationQuery;
87
+ //# sourceMappingURL=integration-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-query.js","sourceRoot":"","sources":["../../../server/service/integration/integration-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA8F;AAC9F,qCAAuC;AACvC,iDAA4E;AAC5E,yDAAgD;AAChD,+CAA2C;AAC3C,yDAAoD;AAG7C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAErB,AAAN,KAAK,CAAC,WAAW,CAAY,EAAU,EAAS,OAAY;QAC1D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,uBAAa,EAAC,yBAAW,CAAC,CAAC,OAAO,CAAC;YAC9C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;SACtB,CAAC,CAAA;IACJ,C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IAAA,kBAAG,GAAE,CAAA;;yDAAjB,iBAAS,oBAAT,iBAAS;;oDAO3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAc,yBAAW;;8CAE5C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAc,yBAAW;;+CAE7C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAc,yBAAW;;+CAE7C;AAjCU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,yBAAW,CAAC;GACT,gBAAgB,CAkC5B;AAlCY,4CAAgB"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.IntegrationList = exports.IntegrationPatch = exports.NewIntegration = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const integration_1 = require("./integration");
15
+ let NewIntegration = class NewIntegration {
16
+ };
17
+ __decorate([
18
+ (0, type_graphql_1.Field)(),
19
+ __metadata("design:type", String)
20
+ ], NewIntegration.prototype, "name", void 0);
21
+ __decorate([
22
+ (0, type_graphql_1.Field)({ nullable: true }),
23
+ __metadata("design:type", String)
24
+ ], NewIntegration.prototype, "description", void 0);
25
+ __decorate([
26
+ (0, type_graphql_1.Field)({ nullable: true }),
27
+ __metadata("design:type", Boolean)
28
+ ], NewIntegration.prototype, "active", void 0);
29
+ __decorate([
30
+ (0, type_graphql_1.Field)({ nullable: true }),
31
+ __metadata("design:type", String)
32
+ ], NewIntegration.prototype, "params", void 0);
33
+ NewIntegration = __decorate([
34
+ (0, type_graphql_1.InputType)()
35
+ ], NewIntegration);
36
+ exports.NewIntegration = NewIntegration;
37
+ let IntegrationPatch = class IntegrationPatch {
38
+ };
39
+ __decorate([
40
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
41
+ __metadata("design:type", String)
42
+ ], IntegrationPatch.prototype, "id", void 0);
43
+ __decorate([
44
+ (0, type_graphql_1.Field)({ nullable: true }),
45
+ __metadata("design:type", String)
46
+ ], IntegrationPatch.prototype, "name", void 0);
47
+ __decorate([
48
+ (0, type_graphql_1.Field)({ nullable: true }),
49
+ __metadata("design:type", String)
50
+ ], IntegrationPatch.prototype, "description", void 0);
51
+ __decorate([
52
+ (0, type_graphql_1.Field)({ nullable: true }),
53
+ __metadata("design:type", Boolean)
54
+ ], IntegrationPatch.prototype, "active", void 0);
55
+ __decorate([
56
+ (0, type_graphql_1.Field)(),
57
+ __metadata("design:type", String)
58
+ ], IntegrationPatch.prototype, "cuFlag", void 0);
59
+ IntegrationPatch = __decorate([
60
+ (0, type_graphql_1.InputType)()
61
+ ], IntegrationPatch);
62
+ exports.IntegrationPatch = IntegrationPatch;
63
+ let IntegrationList = class IntegrationList {
64
+ };
65
+ __decorate([
66
+ (0, type_graphql_1.Field)(type => [integration_1.Integration]),
67
+ __metadata("design:type", Array)
68
+ ], IntegrationList.prototype, "items", void 0);
69
+ __decorate([
70
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
71
+ __metadata("design:type", Number)
72
+ ], IntegrationList.prototype, "total", void 0);
73
+ IntegrationList = __decorate([
74
+ (0, type_graphql_1.ObjectType)()
75
+ ], IntegrationList);
76
+ exports.IntegrationList = IntegrationList;
77
+ //# sourceMappingURL=integration-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-type.js","sourceRoot":"","sources":["../../../server/service/integration/integration-type.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAoE;AAEpE,+CAA2C;AAGpC,IAAM,cAAc,GAApB,MAAM,cAAc;CAY1B,CAAA;AAXC;IAAC,IAAA,oBAAK,GAAE;;4CACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACX;AAXJ,cAAc;IAD1B,IAAA,wBAAS,GAAE;GACC,cAAc,CAY1B;AAZY,wCAAc;AAepB,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAe5B,CAAA;AAdC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CAC3B;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAEhB;IAAC,IAAA,oBAAK,GAAE;;gDACM;AAdH,gBAAgB;IAD5B,IAAA,wBAAS,GAAE;GACC,gBAAgB,CAe5B;AAfY,4CAAgB;AAkBtB,IAAM,eAAe,GAArB,MAAM,eAAe;CAM3B,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,yBAAW,CAAC,CAAC;;8CACT;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;8CACN;AALF,eAAe;IAD3B,IAAA,yBAAU,GAAE;GACA,eAAe,CAM3B;AANY,0CAAe"}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var _a, _b, _c;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.Integration = exports.Platform = void 0;
14
+ const type_graphql_1 = require("type-graphql");
15
+ const typeorm_1 = require("typeorm");
16
+ const auth_base_1 = require("@things-factory/auth-base");
17
+ const shell_1 = require("@things-factory/shell");
18
+ var Platform;
19
+ (function (Platform) {
20
+ Platform["POWRUP"] = "POWRUP";
21
+ })(Platform = exports.Platform || (exports.Platform = {}));
22
+ (0, type_graphql_1.registerEnumType)(Platform, {
23
+ name: 'Platform',
24
+ description: 'platform enumeration of a integration'
25
+ });
26
+ let Integration = class Integration {
27
+ };
28
+ __decorate([
29
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
30
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
31
+ __metadata("design:type", String)
32
+ ], Integration.prototype, "id", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
35
+ (0, type_graphql_1.Field)({ nullable: true }),
36
+ __metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
37
+ ], Integration.prototype, "domain", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.RelationId)((integration) => integration.domain),
40
+ __metadata("design:type", String)
41
+ ], Integration.prototype, "domainId", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)(),
44
+ (0, type_graphql_1.Field)(),
45
+ __metadata("design:type", String)
46
+ ], Integration.prototype, "name", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({
49
+ nullable: true
50
+ }),
51
+ (0, type_graphql_1.Field)({ nullable: true }),
52
+ __metadata("design:type", String)
53
+ ], Integration.prototype, "description", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.Column)(),
56
+ (0, type_graphql_1.Field)(),
57
+ __metadata("design:type", String)
58
+ ], Integration.prototype, "platform", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({
61
+ nullable: true
62
+ }),
63
+ (0, type_graphql_1.Field)({ nullable: true }),
64
+ __metadata("design:type", Boolean)
65
+ ], Integration.prototype, "active", void 0);
66
+ __decorate([
67
+ (0, typeorm_1.CreateDateColumn)(),
68
+ (0, type_graphql_1.Field)({ nullable: true }),
69
+ __metadata("design:type", Date)
70
+ ], Integration.prototype, "createdAt", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.UpdateDateColumn)(),
73
+ (0, type_graphql_1.Field)({ nullable: true }),
74
+ __metadata("design:type", Date)
75
+ ], Integration.prototype, "updatedAt", void 0);
76
+ __decorate([
77
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
78
+ nullable: true
79
+ }),
80
+ (0, type_graphql_1.Field)({ nullable: true }),
81
+ __metadata("design:type", typeof (_b = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _b : Object)
82
+ ], Integration.prototype, "creator", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.RelationId)((integration) => integration.creator),
85
+ __metadata("design:type", String)
86
+ ], Integration.prototype, "creatorId", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
89
+ nullable: true
90
+ }),
91
+ (0, type_graphql_1.Field)({ nullable: true }),
92
+ __metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
93
+ ], Integration.prototype, "updater", void 0);
94
+ __decorate([
95
+ (0, typeorm_1.RelationId)((integration) => integration.creator),
96
+ __metadata("design:type", String)
97
+ ], Integration.prototype, "updaterId", void 0);
98
+ Integration = __decorate([
99
+ (0, typeorm_1.Entity)(),
100
+ (0, typeorm_1.Index)('ix_integration_0', (integration) => [integration.domain, integration.name], { unique: true }),
101
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for Integration' })
102
+ ], Integration);
103
+ exports.Integration = Integration;
104
+ //# sourceMappingURL=integration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration.js","sourceRoot":"","sources":["../../../server/service/integration/integration.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAsE;AACtE,qCASgB;AAEhB,yDAAgD;AAChD,iDAA8C;AAE9C,IAAY,QAEX;AAFD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;AACnB,CAAC,EAFW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAEnB;AAED,IAAA,+BAAgB,EAAC,QAAQ,EAAE;IACzB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,uCAAuC;CACrD,CAAC,CAAA;AAKK,IAAM,WAAW,GAAjB,MAAM,WAAW;CAyDvB,CAAA;AAxDC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;uCACC;AAEnB;IAAC,IAAA,mBAAS,EAAC,I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QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDAChB,gBAAI,oBAAJ,gBAAI;4CAAA;AAEd;IAAC,IAAA,oBAAU,EAAC,CAAC,WAAwB,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;;8CAC5C;AAxDP,WAAW;IAHvB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,kBAAkB,EAAE,CAAC,WAAwB,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACjH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;GACzC,WAAW,CAyDvB;AAzDY,kCAAW"}
@@ -4,7 +4,11 @@ const client_sqs_1 = require("@aws-sdk/client-sqs");
4
4
  const sqs_const_1 = require("./sqs-const");
5
5
  if (sqs_const_1.SQS) {
6
6
  const client = new client_sqs_1.SQSClient({
7
- region: sqs_const_1.SQS.region
7
+ region: sqs_const_1.SQS.region,
8
+ credentials: {
9
+ accessKeyId: sqs_const_1.SQS.accessKeyId,
10
+ secretAccessKey: sqs_const_1.SQS.secretAccessKey
11
+ }
8
12
  });
9
13
  /* send message to sqs */
10
14
  sqs_const_1.SQS.sendMessage = async ({ event }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"sqs-client.js","sourceRoot":"","sources":["../server/sqs-client.ts"],"names":[],"mappings":";;AAAA,oDAAmE;AAEnE,2CAAiC;AAEjC,IAAI,eAAG,EAAE;IACP,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC;QAC3B,MAAM,EAAE,eAAG,CAAC,MAAM;KACnB,CAAC,CAAA;IAEF,yBAAyB;IACzB,eAAG,CAAC,WAAW,GAAG,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QACpC,MAAM,EAAE,IAAI,EAAE,e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;YACvC,cAAc,EAAE,OAAO;YACvB,QAAQ,EAAE,yDAAyD,SAAS,EAAE;SAC/E,CAAA;QAED,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,+BAAkB,CAAC,MAAM,CAAC,CAAC,CAAA;QAC9D,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QAEhE,OAAO,IAAI,CAAA;IACb,CAAC,CAAA;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/integration-base",
3
- "version": "4.3.216",
3
+ "version": "4.3.219",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -40,5 +40,5 @@
40
40
  "promise-socket": "^7.0.0",
41
41
  "vm2": "^3.9.2"
42
42
  },
43
- "gitHead": "cc38341b8a9b9ef18d70eee81456fc90cf1ce785"
43
+ "gitHead": "b6b100adf5b9d8066b0b063b5e4bd804d4782880"
44
44
  }
@@ -1,11 +1,12 @@
1
1
  import { entities as ConnectionEntities, resolvers as ConnectionResolvers } from './connection'
2
2
  import { entities as ConnectorEntities, resolvers as ConnectorResolvers } from './connector'
3
+ import { entities as IntegrationEntities, resolvers as IntegrationResolvers } from './integration'
4
+ import { entities as PayloadLogEntities, resolvers as PayloadLogResolvers } from './payload-log'
3
5
  import { entities as ScenarioEntities, resolvers as ScenarioResolvers } from './scenario'
4
6
  import { entities as ScenarioInstanceEntities, resolvers as ScenarioInstanceResolvers } from './scenario-instance'
5
7
  import { entities as ScenarioQueueEntities, resolvers as ScenarioQueueResolvers } from './scenario-queue'
6
8
  import { entities as StepEntities, resolvers as StepResolvers } from './step'
7
9
  import { entities as TaskTypeEntities, resolvers as TaskTypeResolvers } from './task-type'
8
- import { entities as PayloadLogEntities, resolvers as PayloadLogResolvers } from './payload-log'
9
10
 
10
11
  export * from './property-spec'
11
12
  export * from './task-type/task-type-type'
@@ -17,6 +18,7 @@ export * from './scenario-queue/scenario-queue-type'
17
18
  export * from './step/step-type'
18
19
  export * from './scenario-flow/scenario-flow'
19
20
  export * from './payload-log/payload-log'
21
+ export * from './integration/integration'
20
22
 
21
23
  export const entities = [
22
24
  ...TaskTypeEntities,
@@ -26,7 +28,8 @@ export const entities = [
26
28
  ...ScenarioInstanceEntities,
27
29
  ...ScenarioQueueEntities,
28
30
  ...StepEntities,
29
- ...PayloadLogEntities
31
+ ...PayloadLogEntities,
32
+ ...IntegrationEntities
30
33
  ]
31
34
 
32
35
  export const schema = {
@@ -38,9 +41,10 @@ export const schema = {
38
41
  ...ScenarioInstanceResolvers,
39
42
  ...ScenarioQueueResolvers,
40
43
  ...StepResolvers,
41
- ...PayloadLogResolvers
44
+ ...PayloadLogResolvers,
45
+ ...IntegrationResolvers
42
46
  ]
43
47
  }
44
48
 
45
49
  export { PayloadType } from './payload-log/payload-log'
46
- export { createPayloadLog } from './payload-log/payload-log-mutation'
50
+ export { createPayloadLog } from './payload-log/payload-log-mutation'
@@ -0,0 +1,6 @@
1
+ import { Integration } from './integration'
2
+ import { IntegrationQuery } from './integration-query'
3
+ import { IntegrationMutation } from './integration-mutation'
4
+
5
+ export const entities = [Integration]
6
+ export const resolvers = [IntegrationQuery, IntegrationMutation]
@@ -0,0 +1,112 @@
1
+ import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
+ import { getRepository, In } from 'typeorm'
3
+ import { Integration } from './integration'
4
+ import { NewIntegration, IntegrationPatch } from './integration-type'
5
+
6
+ @Resolver(Integration)
7
+ export class IntegrationMutation {
8
+ @Directive('@transaction')
9
+ @Mutation(returns => Integration, { description: 'To create new Integration' })
10
+ async createIntegration(@Arg('integration') integration: NewIntegration, @Ctx() context: any): Promise<Integration> {
11
+ const { domain, user, tx } = context.state
12
+
13
+ return await tx.getRepository(Integration).save({
14
+ ...integration,
15
+ domain,
16
+ creator: user,
17
+ updater: user
18
+ })
19
+ }
20
+
21
+ @Directive('@transaction')
22
+ @Mutation(returns => Integration, { description: 'To modify Integration information' })
23
+ async updateIntegration(
24
+ @Arg('id') id: string,
25
+ @Arg('patch') patch: IntegrationPatch,
26
+ @Ctx() context: any
27
+ ): Promise<Integration> {
28
+ const { domain, user, tx } = context.state
29
+
30
+ const repository = tx.getRepository(Integration)
31
+ const integration = await repository.findOne({
32
+ where: { domain, id }
33
+ })
34
+
35
+ return await repository.save({
36
+ ...integration,
37
+ ...patch,
38
+ updater: user
39
+ })
40
+ }
41
+
42
+ @Directive('@transaction')
43
+ @Mutation(returns => [Integration], { description: "To modify multiple Integrations' information" })
44
+ async updateMultipleIntegration(
45
+ @Arg('patches', type => [IntegrationPatch]) patches: IntegrationPatch[],
46
+ @Ctx() context: any
47
+ ): Promise<Integration[]> {
48
+ const { domain, user, tx } = context.state
49
+
50
+ let results = []
51
+ const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
52
+ const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
53
+ const integrationRepo = tx.getRepository(Integration)
54
+
55
+ if (_createRecords.length > 0) {
56
+ for (let i = 0; i < _createRecords.length; i++) {
57
+ const newRecord = _createRecords[i]
58
+
59
+ const result = await integrationRepo.save({
60
+ ...newRecord,
61
+ domain,
62
+ creator: user,
63
+ updater: user
64
+ })
65
+
66
+ results.push({ ...result, cuFlag: '+' })
67
+ }
68
+ }
69
+
70
+ if (_updateRecords.length > 0) {
71
+ for (let i = 0; i < _updateRecords.length; i++) {
72
+ const newRecord = _updateRecords[i]
73
+ const integration = await integrationRepo.findOne(newRecord.id)
74
+
75
+ const result = await integrationRepo.save({
76
+ ...integration,
77
+ ...newRecord,
78
+ updater: user
79
+ })
80
+
81
+ results.push({ ...result, cuFlag: 'M' })
82
+ }
83
+ }
84
+
85
+ return results
86
+ }
87
+
88
+ @Directive('@transaction')
89
+ @Mutation(returns => Boolean, { description: 'To delete Integration' })
90
+ async deleteIntegration(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
91
+ const { domain, tx } = context.state
92
+
93
+ await tx.getRepository(Integration).delete({ domain, id })
94
+ return true
95
+ }
96
+
97
+ @Directive('@transaction')
98
+ @Mutation(returns => Boolean, { description: 'To delete multiple integrations' })
99
+ async deleteIntegrations(
100
+ @Arg('ids', type => [String]) ids: string[],
101
+ @Ctx() context: any
102
+ ): Promise<boolean> {
103
+ const { domain, tx } = context.state
104
+
105
+ await tx.getRepository(Integration).delete({
106
+ domain,
107
+ id: In(ids)
108
+ })
109
+
110
+ return true
111
+ }
112
+ }
@@ -0,0 +1,43 @@
1
+ import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
2
+ import { getRepository } from 'typeorm'
3
+ import { Domain, ListParam, convertListParams } from '@things-factory/shell'
4
+ import { User } from '@things-factory/auth-base'
5
+ import { Integration } from './integration'
6
+ import { IntegrationList } from './integration-type'
7
+
8
+ @Resolver(Integration)
9
+ export class IntegrationQuery {
10
+ @Query(returns => Integration, { description: 'To fetch a Integration' })
11
+ async integration(@Arg('id') id: string, @Ctx() context: any): Promise<Integration> {
12
+ const { domain } = context.state
13
+
14
+ return await getRepository(Integration).findOne({
15
+ where: { domain, id }
16
+ })
17
+ }
18
+
19
+ @Query(returns => IntegrationList, { description: 'To fetch multiple Integrations' })
20
+ async integrations(@Args() params: ListParam, @Ctx() context: any): Promise<IntegrationList> {
21
+ const { domain } = context.state
22
+
23
+ const convertedParams = convertListParams(params, domain.id)
24
+ const [items, total] = await getRepository(Integration).findAndCount(convertedParams)
25
+
26
+ return { items, total }
27
+ }
28
+
29
+ @FieldResolver(type => Domain)
30
+ async domain(@Root() integration: Integration): Promise<Domain> {
31
+ return await getRepository(Domain).findOne(integration.domainId)
32
+ }
33
+
34
+ @FieldResolver(type => User)
35
+ async updater(@Root() integration: Integration): Promise<User> {
36
+ return await getRepository(User).findOne(integration.updaterId)
37
+ }
38
+
39
+ @FieldResolver(type => User)
40
+ async creator(@Root() integration: Integration): Promise<User> {
41
+ return await getRepository(User).findOne(integration.creatorId)
42
+ }
43
+ }
@@ -0,0 +1,45 @@
1
+ import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'
2
+
3
+ import { Integration } from './integration'
4
+
5
+ @InputType()
6
+ export class NewIntegration {
7
+ @Field()
8
+ name: string
9
+
10
+ @Field({ nullable: true })
11
+ description?: string
12
+
13
+ @Field({ nullable: true })
14
+ active?: boolean
15
+
16
+ @Field({ nullable: true })
17
+ params?: string
18
+ }
19
+
20
+ @InputType()
21
+ export class IntegrationPatch {
22
+ @Field(type => ID, { nullable: true })
23
+ id?: string
24
+
25
+ @Field({ nullable: true })
26
+ name?: string
27
+
28
+ @Field({ nullable: true })
29
+ description?: string
30
+
31
+ @Field({ nullable: true })
32
+ active?: boolean
33
+
34
+ @Field()
35
+ cuFlag: string
36
+ }
37
+
38
+ @ObjectType()
39
+ export class IntegrationList {
40
+ @Field(type => [Integration])
41
+ items: Integration[]
42
+
43
+ @Field(type => Int)
44
+ total: number
45
+ }
@@ -0,0 +1,85 @@
1
+ import { Field, ID, ObjectType, registerEnumType } from 'type-graphql'
2
+ import {
3
+ Column,
4
+ CreateDateColumn,
5
+ Entity,
6
+ Index,
7
+ ManyToOne,
8
+ PrimaryGeneratedColumn,
9
+ RelationId,
10
+ UpdateDateColumn
11
+ } from 'typeorm'
12
+
13
+ import { User } from '@things-factory/auth-base'
14
+ import { Domain } from '@things-factory/shell'
15
+
16
+ export enum Platform {
17
+ POWRUP = 'POWRUP'
18
+ }
19
+
20
+ registerEnumType(Platform, {
21
+ name: 'Platform',
22
+ description: 'platform enumeration of a integration'
23
+ })
24
+
25
+ @Entity()
26
+ @Index('ix_integration_0', (integration: Integration) => [integration.domain, integration.name], { unique: true })
27
+ @ObjectType({ description: 'Entity for Integration' })
28
+ export class Integration {
29
+ @PrimaryGeneratedColumn('uuid')
30
+ @Field(type => ID)
31
+ readonly id: string
32
+
33
+ @ManyToOne(type => Domain)
34
+ @Field({ nullable: true })
35
+ domain?: Domain
36
+
37
+ @RelationId((integration: Integration) => integration.domain)
38
+ domainId?: string
39
+
40
+ @Column()
41
+ @Field()
42
+ name: string
43
+
44
+ @Column({
45
+ nullable: true
46
+ })
47
+ @Field({ nullable: true })
48
+ description?: string
49
+
50
+ @Column()
51
+ @Field()
52
+ platform: Platform
53
+
54
+ @Column({
55
+ nullable: true
56
+ })
57
+ @Field({ nullable: true })
58
+ active?: boolean
59
+
60
+ @CreateDateColumn()
61
+ @Field({ nullable: true })
62
+ createdAt?: Date
63
+
64
+ @UpdateDateColumn()
65
+ @Field({ nullable: true })
66
+ updatedAt?: Date
67
+
68
+ @ManyToOne(type => User, {
69
+ nullable: true
70
+ })
71
+ @Field({ nullable: true })
72
+ creator?: User
73
+
74
+ @RelationId((integration: Integration) => integration.creator)
75
+ creatorId?: string
76
+
77
+ @ManyToOne(type => User, {
78
+ nullable: true
79
+ })
80
+ @Field({ nullable: true })
81
+ updater?: User
82
+
83
+ @RelationId((integration: Integration) => integration.creator)
84
+ updaterId?: string
85
+ }
@@ -4,7 +4,11 @@ import { SQS } from './sqs-const'
4
4
 
5
5
  if (SQS) {
6
6
  const client = new SQSClient({
7
- region: SQS.region
7
+ region: SQS.region,
8
+ credentials: {
9
+ accessKeyId: SQS.accessKeyId,
10
+ secretAccessKey: SQS.secretAccessKey
11
+ }
8
12
  })
9
13
 
10
14
  /* send message to sqs */