@edgeiq/edgeiq-api-js 1.2.9 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/integrations.test.js +19 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +2 -0
- package/dist/filtersParser.js +2 -3
- package/dist/integrations/index.d.ts +3 -2
- package/dist/integrations/index.js +34 -0
- package/dist/integrations/models.d.ts +14 -0
- package/dist/secrets/index.d.ts +4 -1
- package/dist/secrets/index.js +26 -0
- package/dist/secrets/models.d.ts +1 -0
- package/package.json +1 -1
|
@@ -96,6 +96,25 @@ describe('Integrations', function () {
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
}); });
|
|
99
|
+
it('Gets integration events', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
100
|
+
var ievFilter, result;
|
|
101
|
+
return __generator(this, function (_a) {
|
|
102
|
+
switch (_a.label) {
|
|
103
|
+
case 0:
|
|
104
|
+
ievFilter = {
|
|
105
|
+
integration_id: {
|
|
106
|
+
operator: 'eq',
|
|
107
|
+
value: integration2._id,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
return [4, __1.Integrations.listIntegrationEvents(ievFilter)];
|
|
111
|
+
case 1:
|
|
112
|
+
result = _a.sent();
|
|
113
|
+
expect(result.integrationEvents).toEqual([]);
|
|
114
|
+
return [2];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}); });
|
|
99
118
|
it('Gets the first integration created by _id', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
100
119
|
var result;
|
|
101
120
|
return __generator(this, function (_a) {
|
package/dist/constants.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export declare const BaseEndpoints: {
|
|
|
71
71
|
gatewayCsvUpload: string;
|
|
72
72
|
ingestor: string;
|
|
73
73
|
integration: string;
|
|
74
|
+
integrationEvent: string;
|
|
74
75
|
pollableAttribute: string;
|
|
75
76
|
region: string;
|
|
76
77
|
report: string;
|
|
@@ -107,6 +108,7 @@ export declare const Endpoints: {
|
|
|
107
108
|
gatewayCommand: string;
|
|
108
109
|
ingestor: string;
|
|
109
110
|
integration: string;
|
|
111
|
+
integrationEvent: string;
|
|
110
112
|
pollableAttribute: string;
|
|
111
113
|
region: string;
|
|
112
114
|
report: string;
|
package/dist/constants.js
CHANGED
|
@@ -87,6 +87,7 @@ exports.BaseEndpoints = {
|
|
|
87
87
|
gatewayCsvUpload: 'gateway_csv_upload',
|
|
88
88
|
ingestor: 'ingestors',
|
|
89
89
|
integration: 'integrations',
|
|
90
|
+
integrationEvent: 'integration_events',
|
|
90
91
|
pollableAttribute: 'pollable_attributes',
|
|
91
92
|
region: 'regions',
|
|
92
93
|
report: 'reports',
|
|
@@ -123,6 +124,7 @@ exports.Endpoints = {
|
|
|
123
124
|
gatewayCommand: "" + exports.BaseEndpoints.gatewayCommand,
|
|
124
125
|
ingestor: "" + exports.BaseEndpoints.ingestor,
|
|
125
126
|
integration: "" + exports.BaseEndpoints.integration,
|
|
127
|
+
integrationEvent: "" + exports.BaseEndpoints.integrationEvent,
|
|
126
128
|
pollableAttribute: "" + exports.BaseEndpoints.pollableAttribute,
|
|
127
129
|
region: "" + exports.BaseEndpoints.region,
|
|
128
130
|
report: "" + exports.BaseEndpoints.report,
|
package/dist/filtersParser.js
CHANGED
|
@@ -4,9 +4,7 @@ exports.parseFilters = void 0;
|
|
|
4
4
|
var constants_1 = require("./constants");
|
|
5
5
|
var parseFilters = function (filters, pagination, noPagination) {
|
|
6
6
|
if (noPagination === void 0) { noPagination = false; }
|
|
7
|
-
var result = {
|
|
8
|
-
page_meta: true,
|
|
9
|
-
};
|
|
7
|
+
var result = {};
|
|
10
8
|
if (filters) {
|
|
11
9
|
for (var key in filters) {
|
|
12
10
|
if (Object.prototype.hasOwnProperty.call(filters, key)) {
|
|
@@ -43,6 +41,7 @@ var parseFilters = function (filters, pagination, noPagination) {
|
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
43
|
if (!noPagination) {
|
|
44
|
+
result['page_meta'] = true;
|
|
46
45
|
result['page'] = (pagination === null || pagination === void 0 ? void 0 : pagination.page) || constants_1.DefaultPagination.page;
|
|
47
46
|
result['per_page'] =
|
|
48
47
|
(pagination === null || pagination === void 0 ? void 0 : pagination.itemsPerPage) || constants_1.DefaultPagination.itemsPerPage;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BaseModelInterface } from '../core/ModelClass';
|
|
2
|
-
import { BulkActionResponse } from '../models';
|
|
3
|
-
import { Integration, IntegrationInput, IntegrationsFilters, PaginatedIntegrations } from './models';
|
|
2
|
+
import { BulkActionResponse, PaginationFilter } from '../models';
|
|
3
|
+
import { Integration, IntegrationInput, IntegrationsFilters, IntegrationEventsFilters, PaginatedIntegrations, PaginatedIntegrationEvents } from './models';
|
|
4
4
|
interface IntegrationsInterface extends BaseModelInterface<Integration, IntegrationInput, IntegrationsFilters, PaginatedIntegrations> {
|
|
5
5
|
deleteMultiple(ids: string[]): Promise<BulkActionResponse>;
|
|
6
6
|
update(integration: Integration): Promise<Integration>;
|
|
7
|
+
listIntegrationEvents(filters?: IntegrationEventsFilters, pagination?: PaginationFilter): Promise<PaginatedIntegrationEvents>;
|
|
7
8
|
}
|
|
8
9
|
export declare const Integrations: IntegrationsInterface;
|
|
9
10
|
export {};
|
|
@@ -237,6 +237,40 @@ exports.Integrations = (function (_super) {
|
|
|
237
237
|
});
|
|
238
238
|
});
|
|
239
239
|
};
|
|
240
|
+
class_1.listIntegrationEvents = function (filters, pagination) {
|
|
241
|
+
var _a, _b, _c, _d;
|
|
242
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
243
|
+
var axios, result, error_7;
|
|
244
|
+
return __generator(this, function (_e) {
|
|
245
|
+
switch (_e.label) {
|
|
246
|
+
case 0:
|
|
247
|
+
_e.trys.push([0, 2, , 3]);
|
|
248
|
+
this.logAction("Listing integration events with following filters: " + (filters !== null && filters !== void 0 ? filters : '{}') + ".\n And pagination " + (pagination !== null && pagination !== void 0 ? pagination : '{}'));
|
|
249
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
250
|
+
return [4, axios.get(constants_1.Endpoints.integrationEvent, {
|
|
251
|
+
params: (0, filtersParser_1.parseFilters)(filters, pagination),
|
|
252
|
+
})];
|
|
253
|
+
case 1:
|
|
254
|
+
result = _e.sent();
|
|
255
|
+
return [2, {
|
|
256
|
+
integrationEvents: (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources,
|
|
257
|
+
pagination: {
|
|
258
|
+
page: (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.page,
|
|
259
|
+
itemsPerPage: (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.per_page,
|
|
260
|
+
total: (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.total,
|
|
261
|
+
},
|
|
262
|
+
}];
|
|
263
|
+
case 2:
|
|
264
|
+
error_7 = _e.sent();
|
|
265
|
+
if ((0, helpers_1.isApiError)(error_7)) {
|
|
266
|
+
throw error_7;
|
|
267
|
+
}
|
|
268
|
+
throw error_7;
|
|
269
|
+
case 3: return [2];
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
};
|
|
240
274
|
return class_1;
|
|
241
275
|
}(ModelClass_1.BaseModelClass));
|
|
242
276
|
var checkRequiredValuesByType = function (integraion) {
|
|
@@ -59,3 +59,17 @@ export interface PaginatedIntegrations {
|
|
|
59
59
|
integrations: Integration[];
|
|
60
60
|
pagination: Pagination;
|
|
61
61
|
}
|
|
62
|
+
export declare type IntegrationEventType = 'info' | 'error';
|
|
63
|
+
export interface IntegrationEvent extends Base {
|
|
64
|
+
type: IntegrationEventType;
|
|
65
|
+
message: string;
|
|
66
|
+
integration_id: string;
|
|
67
|
+
}
|
|
68
|
+
export interface IntegrationEventsFilters extends Filters {
|
|
69
|
+
integration_id?: Filter;
|
|
70
|
+
type?: Filter;
|
|
71
|
+
}
|
|
72
|
+
export interface PaginatedIntegrationEvents {
|
|
73
|
+
integrationEvents: IntegrationEvent[];
|
|
74
|
+
pagination: Pagination;
|
|
75
|
+
}
|
package/dist/secrets/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BaseModelInterface } from '../core/ModelClass';
|
|
2
|
+
import { BulkActionResponse } from '../models';
|
|
2
3
|
import { Secret, SecretInput, SecretsFilters, PaginatedSecrets } from './models';
|
|
3
|
-
|
|
4
|
+
interface SecretsInterface extends BaseModelInterface<Secret, SecretInput, SecretsFilters, PaginatedSecrets> {
|
|
5
|
+
deleteMultiple(ids: string[]): Promise<BulkActionResponse>;
|
|
6
|
+
}
|
|
4
7
|
export declare const Secrets: SecretsInterface;
|
|
5
8
|
export {};
|
package/dist/secrets/index.js
CHANGED
|
@@ -169,5 +169,31 @@ exports.Secrets = (function (_super) {
|
|
|
169
169
|
});
|
|
170
170
|
});
|
|
171
171
|
};
|
|
172
|
+
class_1.deleteMultiple = function (ids) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
+
var axios, result, error_5;
|
|
175
|
+
return __generator(this, function (_a) {
|
|
176
|
+
switch (_a.label) {
|
|
177
|
+
case 0:
|
|
178
|
+
_a.trys.push([0, 2, , 3]);
|
|
179
|
+
this.logAction("Deleting secrets with id " + ids.join(', '));
|
|
180
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
181
|
+
return [4, axios.delete(constants_1.Endpoints.secret + "/bulk", {
|
|
182
|
+
data: { ids: ids },
|
|
183
|
+
})];
|
|
184
|
+
case 1:
|
|
185
|
+
result = _a.sent();
|
|
186
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
187
|
+
case 2:
|
|
188
|
+
error_5 = _a.sent();
|
|
189
|
+
if ((0, helpers_1.isApiError)(error_5)) {
|
|
190
|
+
throw error_5;
|
|
191
|
+
}
|
|
192
|
+
throw error_5;
|
|
193
|
+
case 3: return [2];
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
};
|
|
172
198
|
return class_1;
|
|
173
199
|
}(ModelClass_1.BaseModelClass));
|
package/dist/secrets/models.d.ts
CHANGED