@crowdstrike/foundry-js 0.2.2 → 0.5.0
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/abstraction/api-integration.d.ts +23 -0
- package/dist/abstraction/cloud-function.d.ts +49 -0
- package/dist/abstraction/collection.d.ts +20 -0
- package/dist/abstraction/logscale.d.ts +14 -0
- package/dist/api.d.ts +32 -2
- package/dist/apis/actors/index.d.ts +77 -0
- package/dist/apis/alerts/index.d.ts +126 -0
- package/dist/apis/available-apis.d.ts +1 -1
- package/dist/apis/customobjects/index.d.ts +89 -0
- package/dist/apis/detects/index.d.ts +93 -0
- package/dist/apis/devices/index.d.ts +270 -0
- package/dist/apis/faas-gateway/index.d.ts +41 -0
- package/dist/apis/fwmgr/index.d.ts +407 -0
- package/dist/apis/incidents/index.d.ts +112 -0
- package/dist/apis/loggingapi/index.d.ts +68 -0
- package/dist/apis/mitre/index.d.ts +31 -0
- package/dist/apis/plugins/index.d.ts +52 -0
- package/dist/apis/public-api.d.ts +25 -3
- package/dist/apis/remote-response/index.d.ts +74 -0
- package/dist/apis/types-response-for.d.ts +29 -0
- package/dist/apis/types.d.ts +30 -2
- package/dist/apis/workflows/index.d.ts +58 -0
- package/dist/bridge.d.ts +8 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2210 -332
- package/dist/index.js.map +1 -1
- package/dist/lib/navigation.d.ts +18 -0
- package/dist/lib/resize-tracker.d.ts +9 -0
- package/dist/lib/ui.d.ts +8 -0
- package/dist/types.d.ts +129 -10
- package/dist/utils.d.ts +2 -2
- package/package.json +1 -1
- package/dist/apis/incidents/bridge.d.ts +0 -15
- package/dist/apis/incidents/types.d.ts +0 -33
- package/dist/apis/remote-response/bridge.d.ts +0 -15
- package/dist/apis/remote-response/types.d.ts +0 -33
package/dist/index.js
CHANGED
@@ -1,3 +1,183 @@
|
|
1
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
2
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
3
|
+
// generators (like Math.random()).
|
4
|
+
let getRandomValues;
|
5
|
+
const rnds8 = new Uint8Array(16);
|
6
|
+
function rng() {
|
7
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
8
|
+
if (!getRandomValues) {
|
9
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
10
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
11
|
+
|
12
|
+
if (!getRandomValues) {
|
13
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
return getRandomValues(rnds8);
|
18
|
+
}
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
22
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
23
|
+
*/
|
24
|
+
|
25
|
+
const byteToHex = [];
|
26
|
+
|
27
|
+
for (let i = 0; i < 256; ++i) {
|
28
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
29
|
+
}
|
30
|
+
|
31
|
+
function unsafeStringify(arr, offset = 0) {
|
32
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
33
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
34
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
35
|
+
}
|
36
|
+
|
37
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
38
|
+
var native = {
|
39
|
+
randomUUID
|
40
|
+
};
|
41
|
+
|
42
|
+
function v4(options, buf, offset) {
|
43
|
+
if (native.randomUUID && !buf && !options) {
|
44
|
+
return native.randomUUID();
|
45
|
+
}
|
46
|
+
|
47
|
+
options = options || {};
|
48
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
49
|
+
|
50
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
51
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
52
|
+
|
53
|
+
if (buf) {
|
54
|
+
offset = offset || 0;
|
55
|
+
|
56
|
+
for (let i = 0; i < 16; ++i) {
|
57
|
+
buf[offset + i] = rnds[i];
|
58
|
+
}
|
59
|
+
|
60
|
+
return buf;
|
61
|
+
}
|
62
|
+
|
63
|
+
return unsafeStringify(rnds);
|
64
|
+
}
|
65
|
+
|
66
|
+
const VERSION = 'current';
|
67
|
+
|
68
|
+
function assertConnection(falcon) {
|
69
|
+
if (!falcon.isConnected) {
|
70
|
+
throw new Error('You cannot call this API before having established a connection to the host!');
|
71
|
+
}
|
72
|
+
}
|
73
|
+
function isValidResponse(
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
75
|
+
event) {
|
76
|
+
return !!event?.data?.meta?.messageId;
|
77
|
+
}
|
78
|
+
|
79
|
+
const CONNECTION_TIMEOUT = 5_000;
|
80
|
+
const API_TIMEOUT = 30_000;
|
81
|
+
const NAVIGATION_TIMEOUT = 5_000;
|
82
|
+
function timeoutForMessage(message) {
|
83
|
+
const timeout = message.type === 'connect'
|
84
|
+
? CONNECTION_TIMEOUT
|
85
|
+
: message.type === 'api'
|
86
|
+
? API_TIMEOUT
|
87
|
+
: message.type === 'navigateTo'
|
88
|
+
? NAVIGATION_TIMEOUT
|
89
|
+
: // Requests not explicitly covered above will not have a timeout. This includes 'fileUpload', which is a user interaction that can take any amount of time.
|
90
|
+
null;
|
91
|
+
// In tests we have mocked responses which do not require long timeouts
|
92
|
+
return timeout !== null && false ? 40 : timeout;
|
93
|
+
}
|
94
|
+
class Bridge {
|
95
|
+
onDataUpdate;
|
96
|
+
onBroadcast;
|
97
|
+
onLivereload;
|
98
|
+
pendingMessages = new Map();
|
99
|
+
targetOrigin = '*';
|
100
|
+
constructor({ onDataUpdate, onBroadcast, onLivereload, } = {}) {
|
101
|
+
this.onDataUpdate = onDataUpdate;
|
102
|
+
this.onBroadcast = onBroadcast;
|
103
|
+
this.onLivereload = onLivereload;
|
104
|
+
window.addEventListener('message', this.handleMessage);
|
105
|
+
}
|
106
|
+
destroy() {
|
107
|
+
window.removeEventListener('message', this.handleMessage);
|
108
|
+
}
|
109
|
+
setOrigin(origin) {
|
110
|
+
this.targetOrigin = origin;
|
111
|
+
}
|
112
|
+
sendUnidirectionalMessage(message) {
|
113
|
+
const messageId = v4();
|
114
|
+
const eventData = {
|
115
|
+
message,
|
116
|
+
meta: {
|
117
|
+
messageId,
|
118
|
+
version: VERSION,
|
119
|
+
},
|
120
|
+
};
|
121
|
+
window.parent.postMessage(eventData, this.targetOrigin);
|
122
|
+
}
|
123
|
+
// TODO: For some reason with adding more APIs, return type is not working
|
124
|
+
// Promise<PayloadOf<ResponseFor<REQ, DATA>>>
|
125
|
+
async postMessage(message) {
|
126
|
+
return new Promise((resolve, reject) => {
|
127
|
+
const messageId = v4();
|
128
|
+
let timeoutTimer;
|
129
|
+
const timeoutValue = timeoutForMessage(message);
|
130
|
+
if (timeoutValue !== null) {
|
131
|
+
timeoutTimer = setTimeout(() => {
|
132
|
+
reject(new Error(`Waiting for response from foundry host for "${message.type}" message (ID: ${messageId}) timed out after ${timeoutValue}ms`));
|
133
|
+
}, timeoutValue);
|
134
|
+
}
|
135
|
+
this.pendingMessages.set(messageId, (result) => {
|
136
|
+
if (timeoutTimer) {
|
137
|
+
clearTimeout(timeoutTimer);
|
138
|
+
}
|
139
|
+
resolve(result);
|
140
|
+
});
|
141
|
+
const eventData = {
|
142
|
+
message,
|
143
|
+
meta: {
|
144
|
+
messageId,
|
145
|
+
version: VERSION,
|
146
|
+
},
|
147
|
+
};
|
148
|
+
window.parent.postMessage(eventData, this.targetOrigin);
|
149
|
+
});
|
150
|
+
}
|
151
|
+
handleMessage = (event) => {
|
152
|
+
if (!isValidResponse(event)) {
|
153
|
+
return;
|
154
|
+
}
|
155
|
+
const { message } = event.data;
|
156
|
+
if (message.type === 'data') {
|
157
|
+
this.onDataUpdate?.(message);
|
158
|
+
// data update events are unidirectional and originated from the host, so there cannot be a callback waiting for this message
|
159
|
+
return;
|
160
|
+
}
|
161
|
+
if (message.type === 'broadcast') {
|
162
|
+
this.onBroadcast?.(message);
|
163
|
+
// data update events are unidirectional and are proxied via the host, so there cannot be a callback waiting for this message
|
164
|
+
return;
|
165
|
+
}
|
166
|
+
if (message.type === 'livereload') {
|
167
|
+
this.onLivereload?.(message);
|
168
|
+
// livereload events are unidirectional and are proxied via the host, so there cannot be a callback waiting for this message
|
169
|
+
return;
|
170
|
+
}
|
171
|
+
const { messageId } = event.data.meta;
|
172
|
+
const callback = this.pendingMessages.get(messageId);
|
173
|
+
if (!callback) {
|
174
|
+
throw new Error(`Received unexpected message`);
|
175
|
+
}
|
176
|
+
this.pendingMessages.delete(messageId);
|
177
|
+
callback(message.payload);
|
178
|
+
};
|
179
|
+
}
|
180
|
+
|
1
181
|
/******************************************************************************
|
2
182
|
Copyright (c) Microsoft Corporation.
|
3
183
|
|
@@ -20,237 +200,30 @@ function __decorate(decorators, target, key, desc) {
|
|
20
200
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
21
201
|
}
|
22
202
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
}
|
42
|
-
else {
|
43
|
-
throw 'Only put a Memoize() decorator on a method or get accessor.';
|
44
|
-
}
|
45
|
-
};
|
203
|
+
const anyMap = new WeakMap();
|
204
|
+
const eventsMap = new WeakMap();
|
205
|
+
const producersMap = new WeakMap();
|
206
|
+
|
207
|
+
const anyProducer = Symbol('anyProducer');
|
208
|
+
const resolvedPromise = Promise.resolve();
|
209
|
+
|
210
|
+
// Define symbols for "meta" events.
|
211
|
+
const listenerAdded = Symbol('listenerAdded');
|
212
|
+
const listenerRemoved = Symbol('listenerRemoved');
|
213
|
+
|
214
|
+
let canEmitMetaEvents = false;
|
215
|
+
let isGlobalDebugEnabled = false;
|
216
|
+
|
217
|
+
function assertEventName(eventName) {
|
218
|
+
if (typeof eventName !== 'string' && typeof eventName !== 'symbol' && typeof eventName !== 'number') {
|
219
|
+
throw new TypeError('`eventName` must be a string, symbol, or number');
|
220
|
+
}
|
46
221
|
}
|
47
|
-
|
48
|
-
function
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
if (!this.hasOwnProperty(propMapName)) {
|
53
|
-
Object.defineProperty(this, propMapName, {
|
54
|
-
configurable: false,
|
55
|
-
enumerable: false,
|
56
|
-
writable: false,
|
57
|
-
value: new Map()
|
58
|
-
});
|
59
|
-
}
|
60
|
-
let myMap = this[propMapName];
|
61
|
-
if (Array.isArray(tags)) {
|
62
|
-
for (const tag of tags) {
|
63
|
-
if (clearCacheTagsMap.has(tag)) {
|
64
|
-
clearCacheTagsMap.get(tag).push(myMap);
|
65
|
-
}
|
66
|
-
else {
|
67
|
-
clearCacheTagsMap.set(tag, [myMap]);
|
68
|
-
}
|
69
|
-
}
|
70
|
-
}
|
71
|
-
if (hashFunction || args.length > 0 || duration > 0) {
|
72
|
-
let hashKey;
|
73
|
-
if (hashFunction === true) {
|
74
|
-
hashKey = args.map(a => a.toString()).join('!');
|
75
|
-
}
|
76
|
-
else if (hashFunction) {
|
77
|
-
hashKey = hashFunction.apply(this, args);
|
78
|
-
}
|
79
|
-
else {
|
80
|
-
hashKey = args[0];
|
81
|
-
}
|
82
|
-
const timestampKey = `${hashKey}__timestamp`;
|
83
|
-
let isExpired = false;
|
84
|
-
if (duration > 0) {
|
85
|
-
if (!myMap.has(timestampKey)) {
|
86
|
-
isExpired = true;
|
87
|
-
}
|
88
|
-
else {
|
89
|
-
let timestamp = myMap.get(timestampKey);
|
90
|
-
isExpired = (Date.now() - timestamp) > duration;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
if (myMap.has(hashKey) && !isExpired) {
|
94
|
-
returnedValue = myMap.get(hashKey);
|
95
|
-
}
|
96
|
-
else {
|
97
|
-
returnedValue = originalMethod.apply(this, args);
|
98
|
-
myMap.set(hashKey, returnedValue);
|
99
|
-
if (duration > 0) {
|
100
|
-
myMap.set(timestampKey, Date.now());
|
101
|
-
}
|
102
|
-
}
|
103
|
-
}
|
104
|
-
else {
|
105
|
-
const hashKey = this;
|
106
|
-
if (myMap.has(hashKey)) {
|
107
|
-
returnedValue = myMap.get(hashKey);
|
108
|
-
}
|
109
|
-
else {
|
110
|
-
returnedValue = originalMethod.apply(this, args);
|
111
|
-
myMap.set(hashKey, returnedValue);
|
112
|
-
}
|
113
|
-
}
|
114
|
-
return returnedValue;
|
115
|
-
};
|
116
|
-
}
|
117
|
-
|
118
|
-
/**
|
119
|
-
*
|
120
|
-
* This file is autogenerated.
|
121
|
-
*
|
122
|
-
* DO NOT EDIT DIRECTLY
|
123
|
-
*
|
124
|
-
**/
|
125
|
-
class IncidentsApiBridge {
|
126
|
-
bridge;
|
127
|
-
constructor(bridge) {
|
128
|
-
this.bridge = bridge;
|
129
|
-
}
|
130
|
-
async getIncidentIds(urlParams = {}) {
|
131
|
-
const message = {
|
132
|
-
type: 'api',
|
133
|
-
api: 'incidents',
|
134
|
-
method: 'getQueriesIncidentsV1',
|
135
|
-
payload: {
|
136
|
-
params: urlParams,
|
137
|
-
},
|
138
|
-
};
|
139
|
-
return this.bridge.postMessage(message);
|
140
|
-
}
|
141
|
-
async getIncidentEntities(postBody, urlParams = {}) {
|
142
|
-
const message = {
|
143
|
-
type: 'api',
|
144
|
-
api: 'incidents',
|
145
|
-
method: 'postEntitiesIncidentsGetV1',
|
146
|
-
payload: {
|
147
|
-
body: postBody,
|
148
|
-
params: urlParams,
|
149
|
-
},
|
150
|
-
};
|
151
|
-
return this.bridge.postMessage(message);
|
152
|
-
}
|
153
|
-
}
|
154
|
-
|
155
|
-
/**
|
156
|
-
*
|
157
|
-
* This file is autogenerated.
|
158
|
-
*
|
159
|
-
* DO NOT EDIT DIRECTLY
|
160
|
-
*
|
161
|
-
**/
|
162
|
-
class RemoteResponseApiBridge {
|
163
|
-
bridge;
|
164
|
-
constructor(bridge) {
|
165
|
-
this.bridge = bridge;
|
166
|
-
}
|
167
|
-
async getScriptIds(urlParams = {}) {
|
168
|
-
const message = {
|
169
|
-
type: 'api',
|
170
|
-
api: 'remoteResponse',
|
171
|
-
method: 'getQueriesScriptsV1',
|
172
|
-
payload: { params: urlParams },
|
173
|
-
};
|
174
|
-
return this.bridge.postMessage(message);
|
175
|
-
}
|
176
|
-
async getScriptEntities(postBody, urlParams = {}) {
|
177
|
-
const message = {
|
178
|
-
type: 'api',
|
179
|
-
api: 'remoteResponse',
|
180
|
-
method: 'postEntitiesScriptsGetV2',
|
181
|
-
payload: { body: postBody, params: urlParams },
|
182
|
-
};
|
183
|
-
return this.bridge.postMessage(message);
|
184
|
-
}
|
185
|
-
}
|
186
|
-
|
187
|
-
function assertConnection(falcon) {
|
188
|
-
if (!falcon.isConnected) {
|
189
|
-
throw new Error('You cannot call this API before having established a connection to the host!');
|
190
|
-
}
|
191
|
-
}
|
192
|
-
function isValidResponse(
|
193
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
194
|
-
event) {
|
195
|
-
return !!event?.data?.meta?.messageId;
|
196
|
-
}
|
197
|
-
|
198
|
-
/**
|
199
|
-
*
|
200
|
-
* This file is autogenerated from the available APIs for App Platform.
|
201
|
-
*
|
202
|
-
* DO NOT EDIT DIRECTLY
|
203
|
-
*
|
204
|
-
* If you need to change the contents of this file please edit the above configuration file and
|
205
|
-
* then run:
|
206
|
-
*
|
207
|
-
* ```
|
208
|
-
* yarn cs-gen platform-apis
|
209
|
-
* ```
|
210
|
-
*
|
211
|
-
**/
|
212
|
-
class FalconPublicApis {
|
213
|
-
isConnected = false;
|
214
|
-
get incidents() {
|
215
|
-
assertConnection(this);
|
216
|
-
return new IncidentsApiBridge(this.bridge);
|
217
|
-
}
|
218
|
-
get remoteResponse() {
|
219
|
-
assertConnection(this);
|
220
|
-
return new RemoteResponseApiBridge(this.bridge);
|
221
|
-
}
|
222
|
-
}
|
223
|
-
__decorate([
|
224
|
-
Memoize()
|
225
|
-
], FalconPublicApis.prototype, "incidents", null);
|
226
|
-
__decorate([
|
227
|
-
Memoize()
|
228
|
-
], FalconPublicApis.prototype, "remoteResponse", null);
|
229
|
-
|
230
|
-
const anyMap = new WeakMap();
|
231
|
-
const eventsMap = new WeakMap();
|
232
|
-
const producersMap = new WeakMap();
|
233
|
-
|
234
|
-
const anyProducer = Symbol('anyProducer');
|
235
|
-
const resolvedPromise = Promise.resolve();
|
236
|
-
|
237
|
-
// Define symbols for "meta" events.
|
238
|
-
const listenerAdded = Symbol('listenerAdded');
|
239
|
-
const listenerRemoved = Symbol('listenerRemoved');
|
240
|
-
|
241
|
-
let canEmitMetaEvents = false;
|
242
|
-
let isGlobalDebugEnabled = false;
|
243
|
-
|
244
|
-
function assertEventName(eventName) {
|
245
|
-
if (typeof eventName !== 'string' && typeof eventName !== 'symbol' && typeof eventName !== 'number') {
|
246
|
-
throw new TypeError('`eventName` must be a string, symbol, or number');
|
247
|
-
}
|
248
|
-
}
|
249
|
-
|
250
|
-
function assertListener(listener) {
|
251
|
-
if (typeof listener !== 'function') {
|
252
|
-
throw new TypeError('listener must be a function');
|
253
|
-
}
|
222
|
+
|
223
|
+
function assertListener(listener) {
|
224
|
+
if (typeof listener !== 'function') {
|
225
|
+
throw new TypeError('listener must be a function');
|
226
|
+
}
|
254
227
|
}
|
255
228
|
|
256
229
|
function getListeners(instance, eventName) {
|
@@ -764,126 +737,1963 @@ Object.defineProperty(Emittery, 'listenerRemoved', {
|
|
764
737
|
configurable: false,
|
765
738
|
});
|
766
739
|
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
let
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
740
|
+
function Memoize(args) {
|
741
|
+
let hashFunction;
|
742
|
+
let duration;
|
743
|
+
let tags;
|
744
|
+
if (typeof args === 'object') {
|
745
|
+
hashFunction = args.hashFunction;
|
746
|
+
duration = args.expiring;
|
747
|
+
tags = args.tags;
|
748
|
+
}
|
749
|
+
else {
|
750
|
+
hashFunction = args;
|
751
|
+
}
|
752
|
+
return (target, propertyKey, descriptor) => {
|
753
|
+
if (descriptor.value != null) {
|
754
|
+
descriptor.value = getNewFunction(descriptor.value, hashFunction, duration, tags);
|
755
|
+
}
|
756
|
+
else if (descriptor.get != null) {
|
757
|
+
descriptor.get = getNewFunction(descriptor.get, hashFunction, duration, tags);
|
758
|
+
}
|
759
|
+
else {
|
760
|
+
throw 'Only put a Memoize() decorator on a method or get accessor.';
|
761
|
+
}
|
762
|
+
};
|
763
|
+
}
|
764
|
+
const clearCacheTagsMap = new Map();
|
765
|
+
function getNewFunction(originalMethod, hashFunction, duration = 0, tags) {
|
766
|
+
const propMapName = Symbol(`__memoized_map__`);
|
767
|
+
return function (...args) {
|
768
|
+
let returnedValue;
|
769
|
+
if (!this.hasOwnProperty(propMapName)) {
|
770
|
+
Object.defineProperty(this, propMapName, {
|
771
|
+
configurable: false,
|
772
|
+
enumerable: false,
|
773
|
+
writable: false,
|
774
|
+
value: new Map()
|
775
|
+
});
|
776
|
+
}
|
777
|
+
let myMap = this[propMapName];
|
778
|
+
if (Array.isArray(tags)) {
|
779
|
+
for (const tag of tags) {
|
780
|
+
if (clearCacheTagsMap.has(tag)) {
|
781
|
+
clearCacheTagsMap.get(tag).push(myMap);
|
782
|
+
}
|
783
|
+
else {
|
784
|
+
clearCacheTagsMap.set(tag, [myMap]);
|
785
|
+
}
|
786
|
+
}
|
787
|
+
}
|
788
|
+
if (hashFunction || args.length > 0 || duration > 0) {
|
789
|
+
let hashKey;
|
790
|
+
if (hashFunction === true) {
|
791
|
+
hashKey = args.map(a => a.toString()).join('!');
|
792
|
+
}
|
793
|
+
else if (hashFunction) {
|
794
|
+
hashKey = hashFunction.apply(this, args);
|
795
|
+
}
|
796
|
+
else {
|
797
|
+
hashKey = args[0];
|
798
|
+
}
|
799
|
+
const timestampKey = `${hashKey}__timestamp`;
|
800
|
+
let isExpired = false;
|
801
|
+
if (duration > 0) {
|
802
|
+
if (!myMap.has(timestampKey)) {
|
803
|
+
isExpired = true;
|
804
|
+
}
|
805
|
+
else {
|
806
|
+
let timestamp = myMap.get(timestampKey);
|
807
|
+
isExpired = (Date.now() - timestamp) > duration;
|
808
|
+
}
|
809
|
+
}
|
810
|
+
if (myMap.has(hashKey) && !isExpired) {
|
811
|
+
returnedValue = myMap.get(hashKey);
|
812
|
+
}
|
813
|
+
else {
|
814
|
+
returnedValue = originalMethod.apply(this, args);
|
815
|
+
myMap.set(hashKey, returnedValue);
|
816
|
+
if (duration > 0) {
|
817
|
+
myMap.set(timestampKey, Date.now());
|
818
|
+
}
|
819
|
+
}
|
820
|
+
}
|
821
|
+
else {
|
822
|
+
const hashKey = this;
|
823
|
+
if (myMap.has(hashKey)) {
|
824
|
+
returnedValue = myMap.get(hashKey);
|
825
|
+
}
|
826
|
+
else {
|
827
|
+
returnedValue = originalMethod.apply(this, args);
|
828
|
+
myMap.set(hashKey, returnedValue);
|
829
|
+
}
|
830
|
+
}
|
831
|
+
return returnedValue;
|
832
|
+
};
|
833
|
+
}
|
777
834
|
|
778
|
-
|
779
|
-
|
835
|
+
/**
|
836
|
+
*
|
837
|
+
* This file is autogenerated.
|
838
|
+
*
|
839
|
+
* DO NOT EDIT DIRECTLY
|
840
|
+
*
|
841
|
+
**/
|
842
|
+
class ActorsApiBridge {
|
843
|
+
bridge;
|
844
|
+
constructor(bridge) {
|
845
|
+
this.bridge = bridge;
|
846
|
+
}
|
847
|
+
getBridge() {
|
848
|
+
return this.bridge;
|
849
|
+
}
|
850
|
+
async getEntitiesActorsGetV2(urlParams = {}) {
|
851
|
+
const message = {
|
852
|
+
type: 'api',
|
853
|
+
api: 'actors',
|
854
|
+
method: 'getEntitiesActorsGetV2',
|
855
|
+
payload: {
|
856
|
+
params: urlParams,
|
857
|
+
},
|
858
|
+
};
|
859
|
+
return this.bridge.postMessage(message);
|
860
|
+
}
|
861
|
+
async getQueriesActorsV2(urlParams = {}) {
|
862
|
+
const message = {
|
863
|
+
type: 'api',
|
864
|
+
api: 'actors',
|
865
|
+
method: 'getQueriesActorsV2',
|
866
|
+
payload: {
|
867
|
+
params: urlParams,
|
868
|
+
},
|
869
|
+
};
|
870
|
+
return this.bridge.postMessage(message);
|
871
|
+
}
|
872
|
+
async postAggregatesActorsGetV2(postBody, urlParams = {}) {
|
873
|
+
const message = {
|
874
|
+
type: 'api',
|
875
|
+
api: 'actors',
|
876
|
+
method: 'postAggregatesActorsGetV2',
|
877
|
+
payload: {
|
878
|
+
body: postBody,
|
879
|
+
params: urlParams,
|
880
|
+
},
|
881
|
+
};
|
882
|
+
return this.bridge.postMessage(message);
|
883
|
+
}
|
884
|
+
async postEntitiesActorsGetV2(postBody, urlParams = {}) {
|
885
|
+
const message = {
|
886
|
+
type: 'api',
|
887
|
+
api: 'actors',
|
888
|
+
method: 'postEntitiesActorsGetV2',
|
889
|
+
payload: {
|
890
|
+
body: postBody,
|
891
|
+
params: urlParams,
|
892
|
+
},
|
893
|
+
};
|
894
|
+
return this.bridge.postMessage(message);
|
895
|
+
}
|
896
|
+
async postEntitiesMitreV1(postBody, urlParams = {}) {
|
897
|
+
const message = {
|
898
|
+
type: 'api',
|
899
|
+
api: 'actors',
|
900
|
+
method: 'postEntitiesMitreV1',
|
901
|
+
payload: {
|
902
|
+
body: postBody,
|
903
|
+
params: urlParams,
|
904
|
+
},
|
905
|
+
};
|
906
|
+
return this.bridge.postMessage(message);
|
907
|
+
}
|
908
|
+
}
|
909
|
+
|
910
|
+
/**
|
911
|
+
*
|
912
|
+
* This file is autogenerated.
|
913
|
+
*
|
914
|
+
* DO NOT EDIT DIRECTLY
|
915
|
+
*
|
916
|
+
**/
|
917
|
+
class AlertsApiBridge {
|
918
|
+
bridge;
|
919
|
+
constructor(bridge) {
|
920
|
+
this.bridge = bridge;
|
921
|
+
}
|
922
|
+
getBridge() {
|
923
|
+
return this.bridge;
|
924
|
+
}
|
925
|
+
async deleteEntitiesSuppressedDevicesV1(urlParams = {}) {
|
926
|
+
const message = {
|
927
|
+
type: 'api',
|
928
|
+
api: 'alerts',
|
929
|
+
method: 'deleteEntitiesSuppressedDevicesV1',
|
930
|
+
payload: {
|
931
|
+
params: urlParams,
|
932
|
+
},
|
933
|
+
};
|
934
|
+
return this.bridge.postMessage(message);
|
935
|
+
}
|
936
|
+
async getQueriesAlertsV1(urlParams = {}) {
|
937
|
+
const message = {
|
938
|
+
type: 'api',
|
939
|
+
api: 'alerts',
|
940
|
+
method: 'getQueriesAlertsV1',
|
941
|
+
payload: {
|
942
|
+
params: urlParams,
|
943
|
+
},
|
944
|
+
};
|
945
|
+
return this.bridge.postMessage(message);
|
946
|
+
}
|
947
|
+
async patchCombinedAlertsV2(postBody, urlParams = {}) {
|
948
|
+
const message = {
|
949
|
+
type: 'api',
|
950
|
+
api: 'alerts',
|
951
|
+
method: 'patchCombinedAlertsV2',
|
952
|
+
payload: {
|
953
|
+
body: postBody,
|
954
|
+
params: urlParams,
|
955
|
+
},
|
956
|
+
};
|
957
|
+
return this.bridge.postMessage(message);
|
958
|
+
}
|
959
|
+
async patchEntitiesAlertsV2(postBody, urlParams = {}) {
|
960
|
+
const message = {
|
961
|
+
type: 'api',
|
962
|
+
api: 'alerts',
|
963
|
+
method: 'patchEntitiesAlertsV2',
|
964
|
+
payload: {
|
965
|
+
body: postBody,
|
966
|
+
params: urlParams,
|
967
|
+
},
|
968
|
+
};
|
969
|
+
return this.bridge.postMessage(message);
|
970
|
+
}
|
971
|
+
async patchEntitiesSuppressedDevicesV1(postBody, urlParams = {}) {
|
972
|
+
const message = {
|
973
|
+
type: 'api',
|
974
|
+
api: 'alerts',
|
975
|
+
method: 'patchEntitiesSuppressedDevicesV1',
|
976
|
+
payload: {
|
977
|
+
body: postBody,
|
978
|
+
params: urlParams,
|
979
|
+
},
|
980
|
+
};
|
981
|
+
return this.bridge.postMessage(message);
|
982
|
+
}
|
983
|
+
async postAggregatesAlertsV1(postBody, urlParams = {}) {
|
984
|
+
const message = {
|
985
|
+
type: 'api',
|
986
|
+
api: 'alerts',
|
987
|
+
method: 'postAggregatesAlertsV1',
|
988
|
+
payload: {
|
989
|
+
body: postBody,
|
990
|
+
params: urlParams,
|
991
|
+
},
|
992
|
+
};
|
993
|
+
return this.bridge.postMessage(message);
|
994
|
+
}
|
995
|
+
async postEntitiesAlertsV1(postBody, urlParams = {}) {
|
996
|
+
const message = {
|
997
|
+
type: 'api',
|
998
|
+
api: 'alerts',
|
999
|
+
method: 'postEntitiesAlertsV1',
|
1000
|
+
payload: {
|
1001
|
+
body: postBody,
|
1002
|
+
params: urlParams,
|
1003
|
+
},
|
1004
|
+
};
|
1005
|
+
return this.bridge.postMessage(message);
|
1006
|
+
}
|
1007
|
+
async postEntitiesSuppressedDevicesV1(postBody, urlParams = {}) {
|
1008
|
+
const message = {
|
1009
|
+
type: 'api',
|
1010
|
+
api: 'alerts',
|
1011
|
+
method: 'postEntitiesSuppressedDevicesV1',
|
1012
|
+
payload: {
|
1013
|
+
body: postBody,
|
1014
|
+
params: urlParams,
|
1015
|
+
},
|
1016
|
+
};
|
1017
|
+
return this.bridge.postMessage(message);
|
1018
|
+
}
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
/**
|
1022
|
+
*
|
1023
|
+
* This file is autogenerated.
|
1024
|
+
*
|
1025
|
+
* DO NOT EDIT DIRECTLY
|
1026
|
+
*
|
1027
|
+
**/
|
1028
|
+
class CustomobjectsApiBridge {
|
1029
|
+
bridge;
|
1030
|
+
constructor(bridge) {
|
1031
|
+
this.bridge = bridge;
|
1032
|
+
}
|
1033
|
+
getBridge() {
|
1034
|
+
return this.bridge;
|
1035
|
+
}
|
1036
|
+
async deleteV1CollectionsCollectionNameObjectsObjectKey(urlParams = {}) {
|
1037
|
+
const message = {
|
1038
|
+
type: 'api',
|
1039
|
+
api: 'customobjects',
|
1040
|
+
method: 'deleteV1CollectionsCollectionNameObjectsObjectKey',
|
1041
|
+
payload: {
|
1042
|
+
params: urlParams,
|
1043
|
+
},
|
1044
|
+
};
|
1045
|
+
return this.bridge.postMessage(message);
|
1046
|
+
}
|
1047
|
+
async getV1Collections(urlParams = {}) {
|
1048
|
+
const message = {
|
1049
|
+
type: 'api',
|
1050
|
+
api: 'customobjects',
|
1051
|
+
method: 'getV1Collections',
|
1052
|
+
payload: {
|
1053
|
+
params: urlParams,
|
1054
|
+
},
|
1055
|
+
};
|
1056
|
+
return this.bridge.postMessage(message);
|
1057
|
+
}
|
1058
|
+
async getV1CollectionsCollectionNameObjects(urlParams = {}) {
|
1059
|
+
const message = {
|
1060
|
+
type: 'api',
|
1061
|
+
api: 'customobjects',
|
1062
|
+
method: 'getV1CollectionsCollectionNameObjects',
|
1063
|
+
payload: {
|
1064
|
+
params: urlParams,
|
1065
|
+
},
|
1066
|
+
};
|
1067
|
+
return this.bridge.postMessage(message);
|
1068
|
+
}
|
1069
|
+
async getV1CollectionsCollectionNameObjectsObjectKey(urlParams = {}) {
|
1070
|
+
const message = {
|
1071
|
+
type: 'api',
|
1072
|
+
api: 'customobjects',
|
1073
|
+
method: 'getV1CollectionsCollectionNameObjectsObjectKey',
|
1074
|
+
payload: {
|
1075
|
+
params: urlParams,
|
1076
|
+
},
|
1077
|
+
};
|
1078
|
+
return this.bridge.postMessage(message);
|
1079
|
+
}
|
1080
|
+
async getV1CollectionsCollectionNameObjectsObjectKeyMetadata(urlParams = {}) {
|
1081
|
+
const message = {
|
1082
|
+
type: 'api',
|
1083
|
+
api: 'customobjects',
|
1084
|
+
method: 'getV1CollectionsCollectionNameObjectsObjectKeyMetadata',
|
1085
|
+
payload: {
|
1086
|
+
params: urlParams,
|
1087
|
+
},
|
1088
|
+
};
|
1089
|
+
return this.bridge.postMessage(message);
|
1090
|
+
}
|
1091
|
+
async postV1CollectionsCollectionNameObjects(postBody, urlParams = {}) {
|
1092
|
+
const message = {
|
1093
|
+
type: 'api',
|
1094
|
+
api: 'customobjects',
|
1095
|
+
method: 'postV1CollectionsCollectionNameObjects',
|
1096
|
+
payload: {
|
1097
|
+
body: postBody,
|
1098
|
+
params: urlParams,
|
1099
|
+
},
|
1100
|
+
};
|
1101
|
+
return this.bridge.postMessage(message);
|
1102
|
+
}
|
1103
|
+
async putV1CollectionsCollectionNameObjectsObjectKey(postBody, urlParams = {}) {
|
1104
|
+
const message = {
|
1105
|
+
type: 'api',
|
1106
|
+
api: 'customobjects',
|
1107
|
+
method: 'putV1CollectionsCollectionNameObjectsObjectKey',
|
1108
|
+
payload: {
|
1109
|
+
body: postBody,
|
1110
|
+
params: urlParams,
|
1111
|
+
},
|
1112
|
+
};
|
1113
|
+
return this.bridge.postMessage(message);
|
1114
|
+
}
|
1115
|
+
}
|
1116
|
+
|
1117
|
+
/**
|
1118
|
+
*
|
1119
|
+
* This file is autogenerated.
|
1120
|
+
*
|
1121
|
+
* DO NOT EDIT DIRECTLY
|
1122
|
+
*
|
1123
|
+
**/
|
1124
|
+
class DetectsApiBridge {
|
1125
|
+
bridge;
|
1126
|
+
constructor(bridge) {
|
1127
|
+
this.bridge = bridge;
|
1128
|
+
}
|
1129
|
+
getBridge() {
|
1130
|
+
return this.bridge;
|
1131
|
+
}
|
1132
|
+
async getEntitiesSuppressedDevicesV1(urlParams = {}) {
|
1133
|
+
const message = {
|
1134
|
+
type: 'api',
|
1135
|
+
api: 'detects',
|
1136
|
+
method: 'getEntitiesSuppressedDevicesV1',
|
1137
|
+
payload: {
|
1138
|
+
params: urlParams,
|
1139
|
+
},
|
1140
|
+
};
|
1141
|
+
return this.bridge.postMessage(message);
|
1142
|
+
}
|
1143
|
+
async patchEntitiesDetectsV2(postBody, urlParams = {}) {
|
1144
|
+
const message = {
|
1145
|
+
type: 'api',
|
1146
|
+
api: 'detects',
|
1147
|
+
method: 'patchEntitiesDetectsV2',
|
1148
|
+
payload: {
|
1149
|
+
body: postBody,
|
1150
|
+
params: urlParams,
|
1151
|
+
},
|
1152
|
+
};
|
1153
|
+
return this.bridge.postMessage(message);
|
1154
|
+
}
|
1155
|
+
async patchQueriesDetectsV1(postBody, urlParams = {}) {
|
1156
|
+
const message = {
|
1157
|
+
type: 'api',
|
1158
|
+
api: 'detects',
|
1159
|
+
method: 'patchQueriesDetectsV1',
|
1160
|
+
payload: {
|
1161
|
+
body: postBody,
|
1162
|
+
params: urlParams,
|
1163
|
+
},
|
1164
|
+
};
|
1165
|
+
return this.bridge.postMessage(message);
|
1166
|
+
}
|
1167
|
+
async patchQueriesDetectsV2(postBody, urlParams = {}) {
|
1168
|
+
const message = {
|
1169
|
+
type: 'api',
|
1170
|
+
api: 'detects',
|
1171
|
+
method: 'patchQueriesDetectsV2',
|
1172
|
+
payload: {
|
1173
|
+
body: postBody,
|
1174
|
+
params: urlParams,
|
1175
|
+
},
|
1176
|
+
};
|
1177
|
+
return this.bridge.postMessage(message);
|
1178
|
+
}
|
1179
|
+
async postAggregatesDetectsGetV1(postBody, urlParams = {}) {
|
1180
|
+
const message = {
|
1181
|
+
type: 'api',
|
1182
|
+
api: 'detects',
|
1183
|
+
method: 'postAggregatesDetectsGetV1',
|
1184
|
+
payload: {
|
1185
|
+
body: postBody,
|
1186
|
+
params: urlParams,
|
1187
|
+
},
|
1188
|
+
};
|
1189
|
+
return this.bridge.postMessage(message);
|
1190
|
+
}
|
1191
|
+
async postEntitiesSummariesGetV1(postBody, urlParams = {}) {
|
1192
|
+
const message = {
|
1193
|
+
type: 'api',
|
1194
|
+
api: 'detects',
|
1195
|
+
method: 'postEntitiesSummariesGetV1',
|
1196
|
+
payload: {
|
1197
|
+
body: postBody,
|
1198
|
+
params: urlParams,
|
1199
|
+
},
|
1200
|
+
};
|
1201
|
+
return this.bridge.postMessage(message);
|
1202
|
+
}
|
1203
|
+
async postEntitiesSuppressedDevicesV1(postBody, urlParams = {}) {
|
1204
|
+
const message = {
|
1205
|
+
type: 'api',
|
1206
|
+
api: 'detects',
|
1207
|
+
method: 'postEntitiesSuppressedDevicesV1',
|
1208
|
+
payload: {
|
1209
|
+
body: postBody,
|
1210
|
+
params: urlParams,
|
1211
|
+
},
|
1212
|
+
};
|
1213
|
+
return this.bridge.postMessage(message);
|
1214
|
+
}
|
1215
|
+
}
|
1216
|
+
|
1217
|
+
/**
|
1218
|
+
*
|
1219
|
+
* This file is autogenerated.
|
1220
|
+
*
|
1221
|
+
* DO NOT EDIT DIRECTLY
|
1222
|
+
*
|
1223
|
+
**/
|
1224
|
+
class DevicesApiBridge {
|
1225
|
+
bridge;
|
1226
|
+
constructor(bridge) {
|
1227
|
+
this.bridge = bridge;
|
1228
|
+
}
|
1229
|
+
getBridge() {
|
1230
|
+
return this.bridge;
|
1231
|
+
}
|
1232
|
+
async deleteEntitiesGroupsV1(urlParams) {
|
1233
|
+
const message = {
|
1234
|
+
type: 'api',
|
1235
|
+
api: 'devices',
|
1236
|
+
method: 'deleteEntitiesGroupsV1',
|
1237
|
+
payload: {
|
1238
|
+
params: urlParams,
|
1239
|
+
},
|
1240
|
+
};
|
1241
|
+
return this.bridge.postMessage(message);
|
1242
|
+
}
|
1243
|
+
async getAggregatesBucketsV1(urlParams) {
|
1244
|
+
const message = {
|
1245
|
+
type: 'api',
|
1246
|
+
api: 'devices',
|
1247
|
+
method: 'getAggregatesBucketsV1',
|
1248
|
+
payload: {
|
1249
|
+
params: urlParams,
|
1250
|
+
},
|
1251
|
+
};
|
1252
|
+
return this.bridge.postMessage(message);
|
1253
|
+
}
|
1254
|
+
async getAggregatesTagPrefixCountsV1(urlParams) {
|
1255
|
+
const message = {
|
1256
|
+
type: 'api',
|
1257
|
+
api: 'devices',
|
1258
|
+
method: 'getAggregatesTagPrefixCountsV1',
|
1259
|
+
payload: {
|
1260
|
+
params: urlParams,
|
1261
|
+
},
|
1262
|
+
};
|
1263
|
+
return this.bridge.postMessage(message);
|
1264
|
+
}
|
1265
|
+
async getEntitiesGroupsV1(urlParams) {
|
1266
|
+
const message = {
|
1267
|
+
type: 'api',
|
1268
|
+
api: 'devices',
|
1269
|
+
method: 'getEntitiesGroupsV1',
|
1270
|
+
payload: {
|
1271
|
+
params: urlParams,
|
1272
|
+
},
|
1273
|
+
};
|
1274
|
+
return this.bridge.postMessage(message);
|
1275
|
+
}
|
1276
|
+
async getEntitiesReleasesV1(urlParams) {
|
1277
|
+
const message = {
|
1278
|
+
type: 'api',
|
1279
|
+
api: 'devices',
|
1280
|
+
method: 'getEntitiesReleasesV1',
|
1281
|
+
payload: {
|
1282
|
+
params: urlParams,
|
1283
|
+
},
|
1284
|
+
};
|
1285
|
+
return this.bridge.postMessage(message);
|
1286
|
+
}
|
1287
|
+
async getEntitiesRespondV1(urlParams = {}) {
|
1288
|
+
const message = {
|
1289
|
+
type: 'api',
|
1290
|
+
api: 'devices',
|
1291
|
+
method: 'getEntitiesRespondV1',
|
1292
|
+
payload: {
|
1293
|
+
params: urlParams,
|
1294
|
+
},
|
1295
|
+
};
|
1296
|
+
return this.bridge.postMessage(message);
|
1297
|
+
}
|
1298
|
+
async getQueriesAvailableGroupsV1(urlParams = {}) {
|
1299
|
+
const message = {
|
1300
|
+
type: 'api',
|
1301
|
+
api: 'devices',
|
1302
|
+
method: 'getQueriesAvailableGroupsV1',
|
1303
|
+
payload: {
|
1304
|
+
params: urlParams,
|
1305
|
+
},
|
1306
|
+
};
|
1307
|
+
return this.bridge.postMessage(message);
|
1308
|
+
}
|
1309
|
+
async getQueriesDevicesHiddenV2(urlParams = {}) {
|
1310
|
+
const message = {
|
1311
|
+
type: 'api',
|
1312
|
+
api: 'devices',
|
1313
|
+
method: 'getQueriesDevicesHiddenV2',
|
1314
|
+
payload: {
|
1315
|
+
params: urlParams,
|
1316
|
+
},
|
1317
|
+
};
|
1318
|
+
return this.bridge.postMessage(message);
|
1319
|
+
}
|
1320
|
+
async getQueriesDevicesV2(urlParams = {}) {
|
1321
|
+
const message = {
|
1322
|
+
type: 'api',
|
1323
|
+
api: 'devices',
|
1324
|
+
method: 'getQueriesDevicesV2',
|
1325
|
+
payload: {
|
1326
|
+
params: urlParams,
|
1327
|
+
},
|
1328
|
+
};
|
1329
|
+
return this.bridge.postMessage(message);
|
1330
|
+
}
|
1331
|
+
async getQueriesGroupsV1(urlParams = {}) {
|
1332
|
+
const message = {
|
1333
|
+
type: 'api',
|
1334
|
+
api: 'devices',
|
1335
|
+
method: 'getQueriesGroupsV1',
|
1336
|
+
payload: {
|
1337
|
+
params: urlParams,
|
1338
|
+
},
|
1339
|
+
};
|
1340
|
+
return this.bridge.postMessage(message);
|
1341
|
+
}
|
1342
|
+
async patchEntitiesDevicesTagsV2(postBody, urlParams = {}) {
|
1343
|
+
const message = {
|
1344
|
+
type: 'api',
|
1345
|
+
api: 'devices',
|
1346
|
+
method: 'patchEntitiesDevicesTagsV2',
|
1347
|
+
payload: {
|
1348
|
+
body: postBody,
|
1349
|
+
params: urlParams,
|
1350
|
+
},
|
1351
|
+
};
|
1352
|
+
return this.bridge.postMessage(message);
|
1353
|
+
}
|
1354
|
+
async patchEntitiesGroupsV1(postBody, urlParams = {}) {
|
1355
|
+
const message = {
|
1356
|
+
type: 'api',
|
1357
|
+
api: 'devices',
|
1358
|
+
method: 'patchEntitiesGroupsV1',
|
1359
|
+
payload: {
|
1360
|
+
body: postBody,
|
1361
|
+
params: urlParams,
|
1362
|
+
},
|
1363
|
+
};
|
1364
|
+
return this.bridge.postMessage(message);
|
1365
|
+
}
|
1366
|
+
async postAggregatesDevicesGetV1(postBody, urlParams = {}) {
|
1367
|
+
const message = {
|
1368
|
+
type: 'api',
|
1369
|
+
api: 'devices',
|
1370
|
+
method: 'postAggregatesDevicesGetV1',
|
1371
|
+
payload: {
|
1372
|
+
body: postBody,
|
1373
|
+
params: urlParams,
|
1374
|
+
},
|
1375
|
+
};
|
1376
|
+
return this.bridge.postMessage(message);
|
1377
|
+
}
|
1378
|
+
async postCombinedDevicesLoginHistoryV1(postBody, urlParams = {}) {
|
1379
|
+
const message = {
|
1380
|
+
type: 'api',
|
1381
|
+
api: 'devices',
|
1382
|
+
method: 'postCombinedDevicesLoginHistoryV1',
|
1383
|
+
payload: {
|
1384
|
+
body: postBody,
|
1385
|
+
params: urlParams,
|
1386
|
+
},
|
1387
|
+
};
|
1388
|
+
return this.bridge.postMessage(message);
|
1389
|
+
}
|
1390
|
+
async postEntitiesDevicesActionsV4(postBody, urlParams = {}) {
|
1391
|
+
const message = {
|
1392
|
+
type: 'api',
|
1393
|
+
api: 'devices',
|
1394
|
+
method: 'postEntitiesDevicesActionsV4',
|
1395
|
+
payload: {
|
1396
|
+
body: postBody,
|
1397
|
+
params: urlParams,
|
1398
|
+
},
|
1399
|
+
};
|
1400
|
+
return this.bridge.postMessage(message);
|
1401
|
+
}
|
1402
|
+
async postEntitiesDevicesHiddenActionsV4(postBody, urlParams = {}) {
|
1403
|
+
const message = {
|
1404
|
+
type: 'api',
|
1405
|
+
api: 'devices',
|
1406
|
+
method: 'postEntitiesDevicesHiddenActionsV4',
|
1407
|
+
payload: {
|
1408
|
+
body: postBody,
|
1409
|
+
params: urlParams,
|
1410
|
+
},
|
1411
|
+
};
|
1412
|
+
return this.bridge.postMessage(message);
|
1413
|
+
}
|
1414
|
+
async postEntitiesDevicesReportsV1(postBody, urlParams = {}) {
|
1415
|
+
const message = {
|
1416
|
+
type: 'api',
|
1417
|
+
api: 'devices',
|
1418
|
+
method: 'postEntitiesDevicesReportsV1',
|
1419
|
+
payload: {
|
1420
|
+
body: postBody,
|
1421
|
+
params: urlParams,
|
1422
|
+
},
|
1423
|
+
};
|
1424
|
+
return this.bridge.postMessage(message);
|
1425
|
+
}
|
1426
|
+
async postEntitiesDevicesV2(postBody, urlParams = {}) {
|
1427
|
+
const message = {
|
1428
|
+
type: 'api',
|
1429
|
+
api: 'devices',
|
1430
|
+
method: 'postEntitiesDevicesV2',
|
1431
|
+
payload: {
|
1432
|
+
body: postBody,
|
1433
|
+
params: urlParams,
|
1434
|
+
},
|
1435
|
+
};
|
1436
|
+
return this.bridge.postMessage(message);
|
1437
|
+
}
|
1438
|
+
async postEntitiesGroupActionsV1(postBody, urlParams) {
|
1439
|
+
const message = {
|
1440
|
+
type: 'api',
|
1441
|
+
api: 'devices',
|
1442
|
+
method: 'postEntitiesGroupActionsV1',
|
1443
|
+
payload: {
|
1444
|
+
body: postBody,
|
1445
|
+
params: urlParams,
|
1446
|
+
},
|
1447
|
+
};
|
1448
|
+
return this.bridge.postMessage(message);
|
1449
|
+
}
|
1450
|
+
async postEntitiesGroupsV1(postBody, urlParams = {}) {
|
1451
|
+
const message = {
|
1452
|
+
type: 'api',
|
1453
|
+
api: 'devices',
|
1454
|
+
method: 'postEntitiesGroupsV1',
|
1455
|
+
payload: {
|
1456
|
+
body: postBody,
|
1457
|
+
params: urlParams,
|
1458
|
+
},
|
1459
|
+
};
|
1460
|
+
return this.bridge.postMessage(message);
|
1461
|
+
}
|
1462
|
+
async postEntitiesReleasesV1(postBody, urlParams) {
|
1463
|
+
const message = {
|
1464
|
+
type: 'api',
|
1465
|
+
api: 'devices',
|
1466
|
+
method: 'postEntitiesReleasesV1',
|
1467
|
+
payload: {
|
1468
|
+
body: postBody,
|
1469
|
+
params: urlParams,
|
1470
|
+
},
|
1471
|
+
};
|
1472
|
+
return this.bridge.postMessage(message);
|
1473
|
+
}
|
1474
|
+
}
|
1475
|
+
|
1476
|
+
/**
|
1477
|
+
*
|
1478
|
+
* This file is autogenerated.
|
1479
|
+
*
|
1480
|
+
* DO NOT EDIT DIRECTLY
|
1481
|
+
*
|
1482
|
+
**/
|
1483
|
+
class FaasGatewayApiBridge {
|
1484
|
+
bridge;
|
1485
|
+
constructor(bridge) {
|
1486
|
+
this.bridge = bridge;
|
1487
|
+
}
|
1488
|
+
getBridge() {
|
1489
|
+
return this.bridge;
|
1490
|
+
}
|
1491
|
+
async getEntitiesExecutionV1(urlParams) {
|
1492
|
+
const message = {
|
1493
|
+
type: 'api',
|
1494
|
+
api: 'faasGateway',
|
1495
|
+
method: 'getEntitiesExecutionV1',
|
1496
|
+
payload: {
|
1497
|
+
params: urlParams,
|
1498
|
+
},
|
1499
|
+
};
|
1500
|
+
return this.bridge.postMessage(message);
|
1501
|
+
}
|
1502
|
+
async postEntitiesExecutionV1(postBody, urlParams = {}) {
|
1503
|
+
const message = {
|
1504
|
+
type: 'api',
|
1505
|
+
api: 'faasGateway',
|
1506
|
+
method: 'postEntitiesExecutionV1',
|
1507
|
+
payload: {
|
1508
|
+
body: postBody,
|
1509
|
+
params: urlParams,
|
1510
|
+
},
|
1511
|
+
};
|
1512
|
+
return this.bridge.postMessage(message);
|
1513
|
+
}
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
/**
|
1517
|
+
*
|
1518
|
+
* This file is autogenerated.
|
1519
|
+
*
|
1520
|
+
* DO NOT EDIT DIRECTLY
|
1521
|
+
*
|
1522
|
+
**/
|
1523
|
+
class FwmgrApiBridge {
|
1524
|
+
bridge;
|
1525
|
+
constructor(bridge) {
|
1526
|
+
this.bridge = bridge;
|
1527
|
+
}
|
1528
|
+
getBridge() {
|
1529
|
+
return this.bridge;
|
1530
|
+
}
|
1531
|
+
async deleteEntitiesNetworkLocationsV1(urlParams) {
|
1532
|
+
const message = {
|
1533
|
+
type: 'api',
|
1534
|
+
api: 'fwmgr',
|
1535
|
+
method: 'deleteEntitiesNetworkLocationsV1',
|
1536
|
+
payload: {
|
1537
|
+
params: urlParams,
|
1538
|
+
},
|
1539
|
+
};
|
1540
|
+
return this.bridge.postMessage(message);
|
1541
|
+
}
|
1542
|
+
async deleteEntitiesPoliciesV1(urlParams) {
|
1543
|
+
const message = {
|
1544
|
+
type: 'api',
|
1545
|
+
api: 'fwmgr',
|
1546
|
+
method: 'deleteEntitiesPoliciesV1',
|
1547
|
+
payload: {
|
1548
|
+
params: urlParams,
|
1549
|
+
},
|
1550
|
+
};
|
1551
|
+
return this.bridge.postMessage(message);
|
1552
|
+
}
|
1553
|
+
async deleteEntitiesRuleGroupsV1(urlParams) {
|
1554
|
+
const message = {
|
1555
|
+
type: 'api',
|
1556
|
+
api: 'fwmgr',
|
1557
|
+
method: 'deleteEntitiesRuleGroupsV1',
|
1558
|
+
payload: {
|
1559
|
+
params: urlParams,
|
1560
|
+
},
|
1561
|
+
};
|
1562
|
+
return this.bridge.postMessage(message);
|
1563
|
+
}
|
1564
|
+
async getEntitiesEventsV1(urlParams) {
|
1565
|
+
const message = {
|
1566
|
+
type: 'api',
|
1567
|
+
api: 'fwmgr',
|
1568
|
+
method: 'getEntitiesEventsV1',
|
1569
|
+
payload: {
|
1570
|
+
params: urlParams,
|
1571
|
+
},
|
1572
|
+
};
|
1573
|
+
return this.bridge.postMessage(message);
|
1574
|
+
}
|
1575
|
+
async getEntitiesFirewallFieldsV1(urlParams) {
|
1576
|
+
const message = {
|
1577
|
+
type: 'api',
|
1578
|
+
api: 'fwmgr',
|
1579
|
+
method: 'getEntitiesFirewallFieldsV1',
|
1580
|
+
payload: {
|
1581
|
+
params: urlParams,
|
1582
|
+
},
|
1583
|
+
};
|
1584
|
+
return this.bridge.postMessage(message);
|
1585
|
+
}
|
1586
|
+
async getEntitiesNetworkLocationsDetailsV1(urlParams) {
|
1587
|
+
const message = {
|
1588
|
+
type: 'api',
|
1589
|
+
api: 'fwmgr',
|
1590
|
+
method: 'getEntitiesNetworkLocationsDetailsV1',
|
1591
|
+
payload: {
|
1592
|
+
params: urlParams,
|
1593
|
+
},
|
1594
|
+
};
|
1595
|
+
return this.bridge.postMessage(message);
|
1596
|
+
}
|
1597
|
+
async getEntitiesNetworkLocationsV1(urlParams) {
|
1598
|
+
const message = {
|
1599
|
+
type: 'api',
|
1600
|
+
api: 'fwmgr',
|
1601
|
+
method: 'getEntitiesNetworkLocationsV1',
|
1602
|
+
payload: {
|
1603
|
+
params: urlParams,
|
1604
|
+
},
|
1605
|
+
};
|
1606
|
+
return this.bridge.postMessage(message);
|
1607
|
+
}
|
1608
|
+
async getEntitiesPlatformsV1(urlParams) {
|
1609
|
+
const message = {
|
1610
|
+
type: 'api',
|
1611
|
+
api: 'fwmgr',
|
1612
|
+
method: 'getEntitiesPlatformsV1',
|
1613
|
+
payload: {
|
1614
|
+
params: urlParams,
|
1615
|
+
},
|
1616
|
+
};
|
1617
|
+
return this.bridge.postMessage(message);
|
1618
|
+
}
|
1619
|
+
async getEntitiesPoliciesV1(urlParams) {
|
1620
|
+
const message = {
|
1621
|
+
type: 'api',
|
1622
|
+
api: 'fwmgr',
|
1623
|
+
method: 'getEntitiesPoliciesV1',
|
1624
|
+
payload: {
|
1625
|
+
params: urlParams,
|
1626
|
+
},
|
1627
|
+
};
|
1628
|
+
return this.bridge.postMessage(message);
|
1629
|
+
}
|
1630
|
+
async getEntitiesRuleGroupsV1(urlParams) {
|
1631
|
+
const message = {
|
1632
|
+
type: 'api',
|
1633
|
+
api: 'fwmgr',
|
1634
|
+
method: 'getEntitiesRuleGroupsV1',
|
1635
|
+
payload: {
|
1636
|
+
params: urlParams,
|
1637
|
+
},
|
1638
|
+
};
|
1639
|
+
return this.bridge.postMessage(message);
|
1640
|
+
}
|
1641
|
+
async getEntitiesRulesV1(urlParams) {
|
1642
|
+
const message = {
|
1643
|
+
type: 'api',
|
1644
|
+
api: 'fwmgr',
|
1645
|
+
method: 'getEntitiesRulesV1',
|
1646
|
+
payload: {
|
1647
|
+
params: urlParams,
|
1648
|
+
},
|
1649
|
+
};
|
1650
|
+
return this.bridge.postMessage(message);
|
1651
|
+
}
|
1652
|
+
async getLibraryEntitiesRuleGroupsV1(urlParams) {
|
1653
|
+
const message = {
|
1654
|
+
type: 'api',
|
1655
|
+
api: 'fwmgr',
|
1656
|
+
method: 'getLibraryEntitiesRuleGroupsV1',
|
1657
|
+
payload: {
|
1658
|
+
params: urlParams,
|
1659
|
+
},
|
1660
|
+
};
|
1661
|
+
return this.bridge.postMessage(message);
|
1662
|
+
}
|
1663
|
+
async getLibraryQueriesRuleGroupsV1(urlParams = {}) {
|
1664
|
+
const message = {
|
1665
|
+
type: 'api',
|
1666
|
+
api: 'fwmgr',
|
1667
|
+
method: 'getLibraryQueriesRuleGroupsV1',
|
1668
|
+
payload: {
|
1669
|
+
params: urlParams,
|
1670
|
+
},
|
1671
|
+
};
|
1672
|
+
return this.bridge.postMessage(message);
|
1673
|
+
}
|
1674
|
+
async getQueriesEventsV1(urlParams = {}) {
|
1675
|
+
const message = {
|
1676
|
+
type: 'api',
|
1677
|
+
api: 'fwmgr',
|
1678
|
+
method: 'getQueriesEventsV1',
|
1679
|
+
payload: {
|
1680
|
+
params: urlParams,
|
1681
|
+
},
|
1682
|
+
};
|
1683
|
+
return this.bridge.postMessage(message);
|
1684
|
+
}
|
1685
|
+
async getQueriesFirewallFieldsV1(urlParams = {}) {
|
1686
|
+
const message = {
|
1687
|
+
type: 'api',
|
1688
|
+
api: 'fwmgr',
|
1689
|
+
method: 'getQueriesFirewallFieldsV1',
|
1690
|
+
payload: {
|
1691
|
+
params: urlParams,
|
1692
|
+
},
|
1693
|
+
};
|
1694
|
+
return this.bridge.postMessage(message);
|
1695
|
+
}
|
1696
|
+
async getQueriesNetworkLocationsV1(urlParams = {}) {
|
1697
|
+
const message = {
|
1698
|
+
type: 'api',
|
1699
|
+
api: 'fwmgr',
|
1700
|
+
method: 'getQueriesNetworkLocationsV1',
|
1701
|
+
payload: {
|
1702
|
+
params: urlParams,
|
1703
|
+
},
|
1704
|
+
};
|
1705
|
+
return this.bridge.postMessage(message);
|
1706
|
+
}
|
1707
|
+
async getQueriesPlatformsV1(urlParams = {}) {
|
1708
|
+
const message = {
|
1709
|
+
type: 'api',
|
1710
|
+
api: 'fwmgr',
|
1711
|
+
method: 'getQueriesPlatformsV1',
|
1712
|
+
payload: {
|
1713
|
+
params: urlParams,
|
1714
|
+
},
|
1715
|
+
};
|
1716
|
+
return this.bridge.postMessage(message);
|
1717
|
+
}
|
1718
|
+
async getQueriesPolicyRulesV1(urlParams = {}) {
|
1719
|
+
const message = {
|
1720
|
+
type: 'api',
|
1721
|
+
api: 'fwmgr',
|
1722
|
+
method: 'getQueriesPolicyRulesV1',
|
1723
|
+
payload: {
|
1724
|
+
params: urlParams,
|
1725
|
+
},
|
1726
|
+
};
|
1727
|
+
return this.bridge.postMessage(message);
|
1728
|
+
}
|
1729
|
+
async getQueriesRuleGroupsV1(urlParams = {}) {
|
1730
|
+
const message = {
|
1731
|
+
type: 'api',
|
1732
|
+
api: 'fwmgr',
|
1733
|
+
method: 'getQueriesRuleGroupsV1',
|
1734
|
+
payload: {
|
1735
|
+
params: urlParams,
|
1736
|
+
},
|
1737
|
+
};
|
1738
|
+
return this.bridge.postMessage(message);
|
1739
|
+
}
|
1740
|
+
async getQueriesRulesV1(urlParams = {}) {
|
1741
|
+
const message = {
|
1742
|
+
type: 'api',
|
1743
|
+
api: 'fwmgr',
|
1744
|
+
method: 'getQueriesRulesV1',
|
1745
|
+
payload: {
|
1746
|
+
params: urlParams,
|
1747
|
+
},
|
1748
|
+
};
|
1749
|
+
return this.bridge.postMessage(message);
|
1750
|
+
}
|
1751
|
+
async patchEntitiesNetworkLocationsV1(postBody, urlParams = {}) {
|
1752
|
+
const message = {
|
1753
|
+
type: 'api',
|
1754
|
+
api: 'fwmgr',
|
1755
|
+
method: 'patchEntitiesNetworkLocationsV1',
|
1756
|
+
payload: {
|
1757
|
+
body: postBody,
|
1758
|
+
params: urlParams,
|
1759
|
+
},
|
1760
|
+
};
|
1761
|
+
return this.bridge.postMessage(message);
|
1762
|
+
}
|
1763
|
+
async patchEntitiesRuleGroupsV1(postBody, urlParams = {}) {
|
1764
|
+
const message = {
|
1765
|
+
type: 'api',
|
1766
|
+
api: 'fwmgr',
|
1767
|
+
method: 'patchEntitiesRuleGroupsV1',
|
1768
|
+
payload: {
|
1769
|
+
body: postBody,
|
1770
|
+
params: urlParams,
|
1771
|
+
},
|
1772
|
+
};
|
1773
|
+
return this.bridge.postMessage(message);
|
1774
|
+
}
|
1775
|
+
async postAggregatesEventsGetV1(postBody, urlParams = {}) {
|
1776
|
+
const message = {
|
1777
|
+
type: 'api',
|
1778
|
+
api: 'fwmgr',
|
1779
|
+
method: 'postAggregatesEventsGetV1',
|
1780
|
+
payload: {
|
1781
|
+
body: postBody,
|
1782
|
+
params: urlParams,
|
1783
|
+
},
|
1784
|
+
};
|
1785
|
+
return this.bridge.postMessage(message);
|
1786
|
+
}
|
1787
|
+
async postAggregatesPolicyRulesGetV1(postBody, urlParams = {}) {
|
1788
|
+
const message = {
|
1789
|
+
type: 'api',
|
1790
|
+
api: 'fwmgr',
|
1791
|
+
method: 'postAggregatesPolicyRulesGetV1',
|
1792
|
+
payload: {
|
1793
|
+
body: postBody,
|
1794
|
+
params: urlParams,
|
1795
|
+
},
|
1796
|
+
};
|
1797
|
+
return this.bridge.postMessage(message);
|
1798
|
+
}
|
1799
|
+
async postAggregatesRuleGroupsGetV1(postBody, urlParams = {}) {
|
1800
|
+
const message = {
|
1801
|
+
type: 'api',
|
1802
|
+
api: 'fwmgr',
|
1803
|
+
method: 'postAggregatesRuleGroupsGetV1',
|
1804
|
+
payload: {
|
1805
|
+
body: postBody,
|
1806
|
+
params: urlParams,
|
1807
|
+
},
|
1808
|
+
};
|
1809
|
+
return this.bridge.postMessage(message);
|
1810
|
+
}
|
1811
|
+
async postAggregatesRulesGetV1(postBody, urlParams = {}) {
|
1812
|
+
const message = {
|
1813
|
+
type: 'api',
|
1814
|
+
api: 'fwmgr',
|
1815
|
+
method: 'postAggregatesRulesGetV1',
|
1816
|
+
payload: {
|
1817
|
+
body: postBody,
|
1818
|
+
params: urlParams,
|
1819
|
+
},
|
1820
|
+
};
|
1821
|
+
return this.bridge.postMessage(message);
|
1822
|
+
}
|
1823
|
+
async postEntitiesNetworkLocationsMetadataV1(postBody, urlParams = {}) {
|
1824
|
+
const message = {
|
1825
|
+
type: 'api',
|
1826
|
+
api: 'fwmgr',
|
1827
|
+
method: 'postEntitiesNetworkLocationsMetadataV1',
|
1828
|
+
payload: {
|
1829
|
+
body: postBody,
|
1830
|
+
params: urlParams,
|
1831
|
+
},
|
1832
|
+
};
|
1833
|
+
return this.bridge.postMessage(message);
|
1834
|
+
}
|
1835
|
+
async postEntitiesNetworkLocationsPrecedenceV1(postBody, urlParams = {}) {
|
1836
|
+
const message = {
|
1837
|
+
type: 'api',
|
1838
|
+
api: 'fwmgr',
|
1839
|
+
method: 'postEntitiesNetworkLocationsPrecedenceV1',
|
1840
|
+
payload: {
|
1841
|
+
body: postBody,
|
1842
|
+
params: urlParams,
|
1843
|
+
},
|
1844
|
+
};
|
1845
|
+
return this.bridge.postMessage(message);
|
1846
|
+
}
|
1847
|
+
async postEntitiesNetworkLocationsV1(postBody, urlParams = {}) {
|
1848
|
+
const message = {
|
1849
|
+
type: 'api',
|
1850
|
+
api: 'fwmgr',
|
1851
|
+
method: 'postEntitiesNetworkLocationsV1',
|
1852
|
+
payload: {
|
1853
|
+
body: postBody,
|
1854
|
+
params: urlParams,
|
1855
|
+
},
|
1856
|
+
};
|
1857
|
+
return this.bridge.postMessage(message);
|
1858
|
+
}
|
1859
|
+
async postEntitiesOntologyV1(postBody, urlParams = {}) {
|
1860
|
+
const message = {
|
1861
|
+
type: 'api',
|
1862
|
+
api: 'fwmgr',
|
1863
|
+
method: 'postEntitiesOntologyV1',
|
1864
|
+
payload: {
|
1865
|
+
body: postBody,
|
1866
|
+
params: urlParams,
|
1867
|
+
},
|
1868
|
+
};
|
1869
|
+
return this.bridge.postMessage(message);
|
1870
|
+
}
|
1871
|
+
async postEntitiesRuleGroupsV1(postBody, urlParams = {}) {
|
1872
|
+
const message = {
|
1873
|
+
type: 'api',
|
1874
|
+
api: 'fwmgr',
|
1875
|
+
method: 'postEntitiesRuleGroupsV1',
|
1876
|
+
payload: {
|
1877
|
+
body: postBody,
|
1878
|
+
params: urlParams,
|
1879
|
+
},
|
1880
|
+
};
|
1881
|
+
return this.bridge.postMessage(message);
|
1882
|
+
}
|
1883
|
+
async postEntitiesRulesValidateFilepathV1(postBody, urlParams = {}) {
|
1884
|
+
const message = {
|
1885
|
+
type: 'api',
|
1886
|
+
api: 'fwmgr',
|
1887
|
+
method: 'postEntitiesRulesValidateFilepathV1',
|
1888
|
+
payload: {
|
1889
|
+
body: postBody,
|
1890
|
+
params: urlParams,
|
1891
|
+
},
|
1892
|
+
};
|
1893
|
+
return this.bridge.postMessage(message);
|
1894
|
+
}
|
1895
|
+
async putEntitiesNetworkLocationsV1(postBody, urlParams = {}) {
|
1896
|
+
const message = {
|
1897
|
+
type: 'api',
|
1898
|
+
api: 'fwmgr',
|
1899
|
+
method: 'putEntitiesNetworkLocationsV1',
|
1900
|
+
payload: {
|
1901
|
+
body: postBody,
|
1902
|
+
params: urlParams,
|
1903
|
+
},
|
1904
|
+
};
|
1905
|
+
return this.bridge.postMessage(message);
|
1906
|
+
}
|
1907
|
+
async putEntitiesPoliciesV2(postBody, urlParams = {}) {
|
1908
|
+
const message = {
|
1909
|
+
type: 'api',
|
1910
|
+
api: 'fwmgr',
|
1911
|
+
method: 'putEntitiesPoliciesV2',
|
1912
|
+
payload: {
|
1913
|
+
body: postBody,
|
1914
|
+
params: urlParams,
|
1915
|
+
},
|
1916
|
+
};
|
1917
|
+
return this.bridge.postMessage(message);
|
1918
|
+
}
|
1919
|
+
}
|
1920
|
+
|
1921
|
+
/**
|
1922
|
+
*
|
1923
|
+
* This file is autogenerated.
|
1924
|
+
*
|
1925
|
+
* DO NOT EDIT DIRECTLY
|
1926
|
+
*
|
1927
|
+
**/
|
1928
|
+
class IncidentsApiBridge {
|
1929
|
+
bridge;
|
1930
|
+
constructor(bridge) {
|
1931
|
+
this.bridge = bridge;
|
1932
|
+
}
|
1933
|
+
getBridge() {
|
1934
|
+
return this.bridge;
|
1935
|
+
}
|
1936
|
+
async getCombinedCrowdscoresV1(urlParams = {}) {
|
1937
|
+
const message = {
|
1938
|
+
type: 'api',
|
1939
|
+
api: 'incidents',
|
1940
|
+
method: 'getCombinedCrowdscoresV1',
|
1941
|
+
payload: {
|
1942
|
+
params: urlParams,
|
1943
|
+
},
|
1944
|
+
};
|
1945
|
+
return this.bridge.postMessage(message);
|
1946
|
+
}
|
1947
|
+
async getQueriesBehaviorsV1(urlParams = {}) {
|
1948
|
+
const message = {
|
1949
|
+
type: 'api',
|
1950
|
+
api: 'incidents',
|
1951
|
+
method: 'getQueriesBehaviorsV1',
|
1952
|
+
payload: {
|
1953
|
+
params: urlParams,
|
1954
|
+
},
|
1955
|
+
};
|
1956
|
+
return this.bridge.postMessage(message);
|
1957
|
+
}
|
1958
|
+
async getQueriesIncidentsV1(urlParams = {}) {
|
1959
|
+
const message = {
|
1960
|
+
type: 'api',
|
1961
|
+
api: 'incidents',
|
1962
|
+
method: 'getQueriesIncidentsV1',
|
1963
|
+
payload: {
|
1964
|
+
params: urlParams,
|
1965
|
+
},
|
1966
|
+
};
|
1967
|
+
return this.bridge.postMessage(message);
|
1968
|
+
}
|
1969
|
+
async postAggregatesBehaviorsGetV1(postBody, urlParams = {}) {
|
1970
|
+
const message = {
|
1971
|
+
type: 'api',
|
1972
|
+
api: 'incidents',
|
1973
|
+
method: 'postAggregatesBehaviorsGetV1',
|
1974
|
+
payload: {
|
1975
|
+
body: postBody,
|
1976
|
+
params: urlParams,
|
1977
|
+
},
|
1978
|
+
};
|
1979
|
+
return this.bridge.postMessage(message);
|
1980
|
+
}
|
1981
|
+
async postAggregatesIncidentsGetV1(postBody, urlParams = {}) {
|
1982
|
+
const message = {
|
1983
|
+
type: 'api',
|
1984
|
+
api: 'incidents',
|
1985
|
+
method: 'postAggregatesIncidentsGetV1',
|
1986
|
+
payload: {
|
1987
|
+
body: postBody,
|
1988
|
+
params: urlParams,
|
1989
|
+
},
|
1990
|
+
};
|
1991
|
+
return this.bridge.postMessage(message);
|
1992
|
+
}
|
1993
|
+
async postEntitiesBehaviorsGetV1(postBody, urlParams = {}) {
|
1994
|
+
const message = {
|
1995
|
+
type: 'api',
|
1996
|
+
api: 'incidents',
|
1997
|
+
method: 'postEntitiesBehaviorsGetV1',
|
1998
|
+
payload: {
|
1999
|
+
body: postBody,
|
2000
|
+
params: urlParams,
|
2001
|
+
},
|
2002
|
+
};
|
2003
|
+
return this.bridge.postMessage(message);
|
2004
|
+
}
|
2005
|
+
async postEntitiesIncidentActionsV1(postBody, urlParams = {}) {
|
2006
|
+
const message = {
|
2007
|
+
type: 'api',
|
2008
|
+
api: 'incidents',
|
2009
|
+
method: 'postEntitiesIncidentActionsV1',
|
2010
|
+
payload: {
|
2011
|
+
body: postBody,
|
2012
|
+
params: urlParams,
|
2013
|
+
},
|
2014
|
+
};
|
2015
|
+
return this.bridge.postMessage(message);
|
2016
|
+
}
|
2017
|
+
async postEntitiesIncidentsGetV1(postBody, urlParams = {}) {
|
2018
|
+
const message = {
|
2019
|
+
type: 'api',
|
2020
|
+
api: 'incidents',
|
2021
|
+
method: 'postEntitiesIncidentsGetV1',
|
2022
|
+
payload: {
|
2023
|
+
body: postBody,
|
2024
|
+
params: urlParams,
|
2025
|
+
},
|
2026
|
+
};
|
2027
|
+
return this.bridge.postMessage(message);
|
2028
|
+
}
|
2029
|
+
}
|
2030
|
+
|
2031
|
+
/**
|
2032
|
+
*
|
2033
|
+
* This file is autogenerated.
|
2034
|
+
*
|
2035
|
+
* DO NOT EDIT DIRECTLY
|
2036
|
+
*
|
2037
|
+
**/
|
2038
|
+
class LoggingapiApiBridge {
|
2039
|
+
bridge;
|
2040
|
+
constructor(bridge) {
|
2041
|
+
this.bridge = bridge;
|
2042
|
+
}
|
2043
|
+
getBridge() {
|
2044
|
+
return this.bridge;
|
2045
|
+
}
|
2046
|
+
async getEntitiesSavedSearchesExecuteV1(urlParams) {
|
2047
|
+
const message = {
|
2048
|
+
type: 'api',
|
2049
|
+
api: 'loggingapi',
|
2050
|
+
method: 'getEntitiesSavedSearchesExecuteV1',
|
2051
|
+
payload: {
|
2052
|
+
params: urlParams,
|
2053
|
+
},
|
2054
|
+
};
|
2055
|
+
return this.bridge.postMessage(message);
|
2056
|
+
}
|
2057
|
+
async postEntitiesSavedSearchesExecuteV1(postBody, urlParams = {}) {
|
2058
|
+
const message = {
|
2059
|
+
type: 'api',
|
2060
|
+
api: 'loggingapi',
|
2061
|
+
method: 'postEntitiesSavedSearchesExecuteV1',
|
2062
|
+
payload: {
|
2063
|
+
body: postBody,
|
2064
|
+
params: urlParams,
|
2065
|
+
},
|
2066
|
+
};
|
2067
|
+
return this.bridge.postMessage(message);
|
2068
|
+
}
|
2069
|
+
}
|
2070
|
+
|
2071
|
+
/**
|
2072
|
+
*
|
2073
|
+
* This file is autogenerated.
|
2074
|
+
*
|
2075
|
+
* DO NOT EDIT DIRECTLY
|
2076
|
+
*
|
2077
|
+
**/
|
2078
|
+
class MitreApiBridge {
|
2079
|
+
bridge;
|
2080
|
+
constructor(bridge) {
|
2081
|
+
this.bridge = bridge;
|
2082
|
+
}
|
2083
|
+
getBridge() {
|
2084
|
+
return this.bridge;
|
2085
|
+
}
|
2086
|
+
async getEntitiesMatrixV1(urlParams = {}) {
|
2087
|
+
const message = {
|
2088
|
+
type: 'api',
|
2089
|
+
api: 'mitre',
|
2090
|
+
method: 'getEntitiesMatrixV1',
|
2091
|
+
payload: {
|
2092
|
+
params: urlParams,
|
2093
|
+
},
|
2094
|
+
};
|
2095
|
+
return this.bridge.postMessage(message);
|
2096
|
+
}
|
2097
|
+
}
|
2098
|
+
|
2099
|
+
/**
|
2100
|
+
*
|
2101
|
+
* This file is autogenerated.
|
2102
|
+
*
|
2103
|
+
* DO NOT EDIT DIRECTLY
|
2104
|
+
*
|
2105
|
+
**/
|
2106
|
+
class PluginsApiBridge {
|
2107
|
+
bridge;
|
2108
|
+
constructor(bridge) {
|
2109
|
+
this.bridge = bridge;
|
2110
|
+
}
|
2111
|
+
getBridge() {
|
2112
|
+
return this.bridge;
|
2113
|
+
}
|
2114
|
+
async getEntitiesConfigsV1(urlParams = {}) {
|
2115
|
+
const message = {
|
2116
|
+
type: 'api',
|
2117
|
+
api: 'plugins',
|
2118
|
+
method: 'getEntitiesConfigsV1',
|
2119
|
+
payload: {
|
2120
|
+
params: urlParams,
|
2121
|
+
},
|
2122
|
+
};
|
2123
|
+
return this.bridge.postMessage(message);
|
2124
|
+
}
|
2125
|
+
async postEntitiesExecuteDraftV1(postBody, urlParams = {}) {
|
2126
|
+
const message = {
|
2127
|
+
type: 'api',
|
2128
|
+
api: 'plugins',
|
2129
|
+
method: 'postEntitiesExecuteDraftV1',
|
2130
|
+
payload: {
|
2131
|
+
body: postBody,
|
2132
|
+
params: urlParams,
|
2133
|
+
},
|
2134
|
+
};
|
2135
|
+
return this.bridge.postMessage(message);
|
2136
|
+
}
|
2137
|
+
async postEntitiesExecuteV1(postBody, urlParams = {}) {
|
2138
|
+
const message = {
|
2139
|
+
type: 'api',
|
2140
|
+
api: 'plugins',
|
2141
|
+
method: 'postEntitiesExecuteV1',
|
2142
|
+
payload: {
|
2143
|
+
body: postBody,
|
2144
|
+
params: urlParams,
|
2145
|
+
},
|
2146
|
+
};
|
2147
|
+
return this.bridge.postMessage(message);
|
2148
|
+
}
|
2149
|
+
}
|
2150
|
+
|
2151
|
+
/**
|
2152
|
+
*
|
2153
|
+
* This file is autogenerated.
|
2154
|
+
*
|
2155
|
+
* DO NOT EDIT DIRECTLY
|
2156
|
+
*
|
2157
|
+
**/
|
2158
|
+
class RemoteResponseApiBridge {
|
2159
|
+
bridge;
|
2160
|
+
constructor(bridge) {
|
2161
|
+
this.bridge = bridge;
|
2162
|
+
}
|
2163
|
+
getBridge() {
|
2164
|
+
return this.bridge;
|
2165
|
+
}
|
2166
|
+
async getScriptIds(urlParams = {}) {
|
2167
|
+
const message = {
|
2168
|
+
type: 'api',
|
2169
|
+
api: 'remoteResponse',
|
2170
|
+
method: 'getQueriesScriptsV1',
|
2171
|
+
payload: {
|
2172
|
+
params: urlParams,
|
2173
|
+
},
|
2174
|
+
};
|
2175
|
+
return this.bridge.postMessage(message);
|
2176
|
+
}
|
2177
|
+
async getScriptEntities(postBody, urlParams = {}) {
|
2178
|
+
const message = {
|
2179
|
+
type: 'api',
|
2180
|
+
api: 'remoteResponse',
|
2181
|
+
method: 'postEntitiesScriptsGetV2',
|
2182
|
+
payload: {
|
2183
|
+
body: postBody,
|
2184
|
+
params: urlParams,
|
2185
|
+
},
|
2186
|
+
};
|
2187
|
+
return this.bridge.postMessage(message);
|
2188
|
+
}
|
2189
|
+
}
|
2190
|
+
|
2191
|
+
/**
|
2192
|
+
*
|
2193
|
+
* This file is autogenerated.
|
2194
|
+
*
|
2195
|
+
* DO NOT EDIT DIRECTLY
|
2196
|
+
*
|
2197
|
+
**/
|
2198
|
+
class WorkflowsApiBridge {
|
2199
|
+
bridge;
|
2200
|
+
constructor(bridge) {
|
2201
|
+
this.bridge = bridge;
|
2202
|
+
}
|
2203
|
+
getBridge() {
|
2204
|
+
return this.bridge;
|
2205
|
+
}
|
2206
|
+
async getEntitiesExecutionResultsV1(urlParams) {
|
2207
|
+
const message = {
|
2208
|
+
type: 'api',
|
2209
|
+
api: 'workflows',
|
2210
|
+
method: 'getEntitiesExecutionResultsV1',
|
2211
|
+
payload: {
|
2212
|
+
params: urlParams,
|
2213
|
+
},
|
2214
|
+
};
|
2215
|
+
return this.bridge.postMessage(message);
|
2216
|
+
}
|
2217
|
+
async postEntitiesExecuteV1(postBody, urlParams = {}) {
|
2218
|
+
const message = {
|
2219
|
+
type: 'api',
|
2220
|
+
api: 'workflows',
|
2221
|
+
method: 'postEntitiesExecuteV1',
|
2222
|
+
payload: {
|
2223
|
+
body: postBody,
|
2224
|
+
params: urlParams,
|
2225
|
+
},
|
2226
|
+
};
|
2227
|
+
return this.bridge.postMessage(message);
|
2228
|
+
}
|
2229
|
+
async postEntitiesExecutionActionsV1(postBody, urlParams) {
|
2230
|
+
const message = {
|
2231
|
+
type: 'api',
|
2232
|
+
api: 'workflows',
|
2233
|
+
method: 'postEntitiesExecutionActionsV1',
|
2234
|
+
payload: {
|
2235
|
+
body: postBody,
|
2236
|
+
params: urlParams,
|
2237
|
+
},
|
2238
|
+
};
|
2239
|
+
return this.bridge.postMessage(message);
|
2240
|
+
}
|
2241
|
+
}
|
2242
|
+
|
2243
|
+
/**
|
2244
|
+
*
|
2245
|
+
* This file is autogenerated from the available APIs for App Platform.
|
2246
|
+
*
|
2247
|
+
* DO NOT EDIT DIRECTLY
|
2248
|
+
*
|
2249
|
+
* If you need to change the contents of this file please edit the above configuration file and
|
2250
|
+
* then run:
|
2251
|
+
*
|
2252
|
+
* ```
|
2253
|
+
* yarn cs-gen platform-apis
|
2254
|
+
* ```
|
2255
|
+
*
|
2256
|
+
**/
|
2257
|
+
class FalconPublicApis {
|
2258
|
+
isConnected = false;
|
2259
|
+
get actors() {
|
2260
|
+
assertConnection(this);
|
2261
|
+
return new ActorsApiBridge(this.bridge);
|
2262
|
+
}
|
2263
|
+
get alerts() {
|
2264
|
+
assertConnection(this);
|
2265
|
+
return new AlertsApiBridge(this.bridge);
|
2266
|
+
}
|
2267
|
+
get detects() {
|
2268
|
+
assertConnection(this);
|
2269
|
+
return new DetectsApiBridge(this.bridge);
|
2270
|
+
}
|
2271
|
+
get devices() {
|
2272
|
+
assertConnection(this);
|
2273
|
+
return new DevicesApiBridge(this.bridge);
|
2274
|
+
}
|
2275
|
+
get fwmgr() {
|
2276
|
+
assertConnection(this);
|
2277
|
+
return new FwmgrApiBridge(this.bridge);
|
2278
|
+
}
|
2279
|
+
get incidents() {
|
2280
|
+
assertConnection(this);
|
2281
|
+
return new IncidentsApiBridge(this.bridge);
|
2282
|
+
}
|
2283
|
+
get mitre() {
|
2284
|
+
assertConnection(this);
|
2285
|
+
return new MitreApiBridge(this.bridge);
|
2286
|
+
}
|
2287
|
+
get plugins() {
|
2288
|
+
assertConnection(this);
|
2289
|
+
return new PluginsApiBridge(this.bridge);
|
2290
|
+
}
|
2291
|
+
get remoteResponse() {
|
2292
|
+
assertConnection(this);
|
2293
|
+
return new RemoteResponseApiBridge(this.bridge);
|
2294
|
+
}
|
2295
|
+
get workflows() {
|
2296
|
+
assertConnection(this);
|
2297
|
+
return new WorkflowsApiBridge(this.bridge);
|
2298
|
+
}
|
2299
|
+
get customobjects() {
|
2300
|
+
assertConnection(this);
|
2301
|
+
return new CustomobjectsApiBridge(this.bridge);
|
2302
|
+
}
|
2303
|
+
get faasGateway() {
|
2304
|
+
assertConnection(this);
|
2305
|
+
return new FaasGatewayApiBridge(this.bridge);
|
2306
|
+
}
|
2307
|
+
get loggingapi() {
|
2308
|
+
assertConnection(this);
|
2309
|
+
return new LoggingapiApiBridge(this.bridge);
|
780
2310
|
}
|
781
|
-
}
|
782
|
-
|
783
|
-
return getRandomValues(rnds8);
|
784
2311
|
}
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
2312
|
+
__decorate([
|
2313
|
+
Memoize()
|
2314
|
+
], FalconPublicApis.prototype, "actors", null);
|
2315
|
+
__decorate([
|
2316
|
+
Memoize()
|
2317
|
+
], FalconPublicApis.prototype, "alerts", null);
|
2318
|
+
__decorate([
|
2319
|
+
Memoize()
|
2320
|
+
], FalconPublicApis.prototype, "detects", null);
|
2321
|
+
__decorate([
|
2322
|
+
Memoize()
|
2323
|
+
], FalconPublicApis.prototype, "devices", null);
|
2324
|
+
__decorate([
|
2325
|
+
Memoize()
|
2326
|
+
], FalconPublicApis.prototype, "fwmgr", null);
|
2327
|
+
__decorate([
|
2328
|
+
Memoize()
|
2329
|
+
], FalconPublicApis.prototype, "incidents", null);
|
2330
|
+
__decorate([
|
2331
|
+
Memoize()
|
2332
|
+
], FalconPublicApis.prototype, "mitre", null);
|
2333
|
+
__decorate([
|
2334
|
+
Memoize()
|
2335
|
+
], FalconPublicApis.prototype, "plugins", null);
|
2336
|
+
__decorate([
|
2337
|
+
Memoize()
|
2338
|
+
], FalconPublicApis.prototype, "remoteResponse", null);
|
2339
|
+
__decorate([
|
2340
|
+
Memoize()
|
2341
|
+
], FalconPublicApis.prototype, "workflows", null);
|
2342
|
+
__decorate([
|
2343
|
+
Memoize()
|
2344
|
+
], FalconPublicApis.prototype, "customobjects", null);
|
2345
|
+
__decorate([
|
2346
|
+
Memoize()
|
2347
|
+
], FalconPublicApis.prototype, "faasGateway", null);
|
2348
|
+
__decorate([
|
2349
|
+
Memoize()
|
2350
|
+
], FalconPublicApis.prototype, "loggingapi", null);
|
2351
|
+
|
2352
|
+
class ApiIntegration {
|
2353
|
+
falcon;
|
2354
|
+
definition;
|
2355
|
+
constructor(falcon, definition) {
|
2356
|
+
this.falcon = falcon;
|
2357
|
+
this.definition = definition;
|
2358
|
+
}
|
2359
|
+
async execute({ request } = {}) {
|
2360
|
+
return this.falcon.plugins.postEntitiesExecuteV1({
|
2361
|
+
resources: [
|
2362
|
+
{
|
2363
|
+
definition_id: this.definition.definitionId,
|
2364
|
+
operation_id: this.definition.operationId,
|
2365
|
+
request,
|
2366
|
+
},
|
2367
|
+
],
|
2368
|
+
});
|
2369
|
+
}
|
795
2370
|
}
|
796
2371
|
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
2372
|
+
class CloudFunction {
|
2373
|
+
falcon;
|
2374
|
+
definition;
|
2375
|
+
static GET = 'GET';
|
2376
|
+
static POST = 'POST';
|
2377
|
+
static PATCH = 'PATCH';
|
2378
|
+
static DELETE = 'DELETE';
|
2379
|
+
pollTimeout = 500;
|
2380
|
+
intervalId;
|
2381
|
+
constructor(falcon, definition) {
|
2382
|
+
this.falcon = falcon;
|
2383
|
+
this.definition = definition;
|
2384
|
+
}
|
2385
|
+
async execute({ path, method, queryParams, body, headers, }) {
|
2386
|
+
const result = await this.falcon.faasGateway.postEntitiesExecutionV1({
|
2387
|
+
function_id: this.definition.id,
|
2388
|
+
function_version: this.definition.version,
|
2389
|
+
payload: {
|
2390
|
+
path,
|
2391
|
+
method,
|
2392
|
+
body,
|
2393
|
+
headers,
|
2394
|
+
query_params: queryParams,
|
2395
|
+
},
|
2396
|
+
});
|
2397
|
+
return new Promise((resolve, reject) => {
|
2398
|
+
const execution = result?.resources?.[0];
|
2399
|
+
if (!execution?.execution_id) {
|
2400
|
+
reject(result?.errors);
|
2401
|
+
}
|
2402
|
+
else {
|
2403
|
+
this.pollForResult({
|
2404
|
+
resolve,
|
2405
|
+
reject,
|
2406
|
+
executionId: execution?.execution_id,
|
2407
|
+
});
|
2408
|
+
}
|
2409
|
+
});
|
2410
|
+
}
|
2411
|
+
async getExecutionResult(executionId) {
|
2412
|
+
const resultResponse = await this.falcon.faasGateway.getEntitiesExecutionV1({
|
2413
|
+
id: executionId,
|
2414
|
+
});
|
2415
|
+
const executionResult = resultResponse?.resources?.[0];
|
2416
|
+
return executionResult?.payload;
|
2417
|
+
}
|
2418
|
+
pollForResult({ resolve, reject, executionId, }) {
|
2419
|
+
let exceptionRetries = 2;
|
2420
|
+
this.intervalId = window.setInterval(async () => {
|
2421
|
+
try {
|
2422
|
+
const payload = await this.getExecutionResult(executionId);
|
2423
|
+
if (payload) {
|
2424
|
+
window.clearInterval(this.intervalId);
|
2425
|
+
resolve(payload);
|
2426
|
+
}
|
2427
|
+
}
|
2428
|
+
catch (e) {
|
2429
|
+
if (exceptionRetries <= 0) {
|
2430
|
+
window.clearInterval(this.intervalId);
|
2431
|
+
reject(e);
|
2432
|
+
}
|
2433
|
+
exceptionRetries--;
|
2434
|
+
}
|
2435
|
+
}, this.pollTimeout);
|
2436
|
+
}
|
2437
|
+
path(pathEntry) {
|
2438
|
+
const urlPath = new URL(pathEntry, 'http://localhost');
|
2439
|
+
const path = urlPath.pathname;
|
2440
|
+
const searchParams = [...urlPath.searchParams.entries()].map(([key, value]) => ({
|
2441
|
+
[key]: [value],
|
2442
|
+
}));
|
2443
|
+
return {
|
2444
|
+
path,
|
2445
|
+
queryParams: searchParams,
|
2446
|
+
get: async (queryParams = {}) => {
|
2447
|
+
return this.get({
|
2448
|
+
path,
|
2449
|
+
queryParams: queryParams ?? searchParams ?? {},
|
2450
|
+
});
|
2451
|
+
},
|
2452
|
+
post: async (body, queryParams = {}, headers = {}) => {
|
2453
|
+
return this.post({
|
2454
|
+
path,
|
2455
|
+
queryParams: queryParams ?? searchParams ?? {},
|
2456
|
+
body,
|
2457
|
+
headers,
|
2458
|
+
});
|
2459
|
+
},
|
2460
|
+
patch: async (body, queryParams = {}, headers = {}) => {
|
2461
|
+
return this.post({
|
2462
|
+
path,
|
2463
|
+
queryParams: queryParams ?? searchParams ?? {},
|
2464
|
+
body,
|
2465
|
+
headers,
|
2466
|
+
});
|
2467
|
+
},
|
2468
|
+
delete: async (body, queryParams = {}, headers = {}) => {
|
2469
|
+
return this.post({
|
2470
|
+
path,
|
2471
|
+
queryParams: queryParams ?? searchParams ?? {},
|
2472
|
+
body,
|
2473
|
+
headers,
|
2474
|
+
});
|
2475
|
+
},
|
2476
|
+
};
|
2477
|
+
}
|
2478
|
+
async get({ path, queryParams, headers }) {
|
2479
|
+
return this.execute({
|
2480
|
+
path,
|
2481
|
+
method: CloudFunction.GET,
|
2482
|
+
queryParams,
|
2483
|
+
headers,
|
2484
|
+
});
|
2485
|
+
}
|
2486
|
+
async post({ path, queryParams, body, headers }) {
|
2487
|
+
return this.execute({
|
2488
|
+
path,
|
2489
|
+
method: CloudFunction.POST,
|
2490
|
+
body,
|
2491
|
+
queryParams,
|
2492
|
+
headers,
|
2493
|
+
});
|
2494
|
+
}
|
2495
|
+
async patch({ path, queryParams, body, headers }) {
|
2496
|
+
return this.execute({
|
2497
|
+
path,
|
2498
|
+
method: CloudFunction.PATCH,
|
2499
|
+
body,
|
2500
|
+
queryParams,
|
2501
|
+
headers,
|
2502
|
+
});
|
2503
|
+
}
|
2504
|
+
async delete({ path, queryParams, body, headers }) {
|
2505
|
+
return this.execute({
|
2506
|
+
path,
|
2507
|
+
method: CloudFunction.DELETE,
|
2508
|
+
body,
|
2509
|
+
queryParams,
|
2510
|
+
headers,
|
2511
|
+
});
|
2512
|
+
}
|
2513
|
+
destroy() {
|
2514
|
+
if (this.intervalId) {
|
2515
|
+
window.clearInterval(this.intervalId);
|
2516
|
+
this.intervalId = undefined;
|
2517
|
+
}
|
2518
|
+
}
|
801
2519
|
}
|
802
2520
|
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
2521
|
+
class Collection {
|
2522
|
+
falcon;
|
2523
|
+
definition;
|
2524
|
+
constructor(falcon, definition) {
|
2525
|
+
this.falcon = falcon;
|
2526
|
+
this.definition = definition;
|
2527
|
+
}
|
2528
|
+
async write(key, data) {
|
2529
|
+
return this.falcon.bridge.postMessage({
|
2530
|
+
type: 'collection',
|
2531
|
+
payload: {
|
2532
|
+
type: 'write',
|
2533
|
+
key,
|
2534
|
+
collection: this.definition.collection,
|
2535
|
+
data,
|
2536
|
+
},
|
2537
|
+
});
|
2538
|
+
}
|
2539
|
+
async read(key) {
|
2540
|
+
return this.falcon.bridge.postMessage({
|
2541
|
+
type: 'collection',
|
2542
|
+
payload: {
|
2543
|
+
type: 'read',
|
2544
|
+
key,
|
2545
|
+
collection: this.definition.collection,
|
2546
|
+
},
|
2547
|
+
});
|
2548
|
+
}
|
2549
|
+
async delete(key) {
|
2550
|
+
return this.falcon.bridge.postMessage({
|
2551
|
+
type: 'collection',
|
2552
|
+
payload: {
|
2553
|
+
type: 'delete',
|
2554
|
+
key,
|
2555
|
+
collection: this.definition.collection,
|
2556
|
+
},
|
2557
|
+
});
|
2558
|
+
}
|
2559
|
+
async search({ startKey, endKey, limit }) {
|
2560
|
+
return this.falcon.bridge.postMessage({
|
2561
|
+
type: 'collection',
|
2562
|
+
payload: {
|
2563
|
+
type: 'search',
|
2564
|
+
startKey,
|
2565
|
+
endKey,
|
2566
|
+
limit,
|
2567
|
+
collection: this.definition.collection,
|
2568
|
+
},
|
2569
|
+
});
|
824
2570
|
}
|
825
|
-
|
826
|
-
return buf;
|
827
|
-
}
|
828
|
-
|
829
|
-
return unsafeStringify(rnds);
|
830
2571
|
}
|
831
2572
|
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
onDataUpdate;
|
837
|
-
pendingMessages = new Map();
|
838
|
-
targetOrigin = '*';
|
839
|
-
constructor({ onDataUpdate } = {}) {
|
840
|
-
this.onDataUpdate = onDataUpdate;
|
841
|
-
window.addEventListener('message', this.handleMessage);
|
2573
|
+
class Logscale {
|
2574
|
+
falcon;
|
2575
|
+
constructor(falcon) {
|
2576
|
+
this.falcon = falcon;
|
842
2577
|
}
|
843
|
-
|
844
|
-
|
2578
|
+
async write(data, properties) {
|
2579
|
+
return this.falcon.bridge.postMessage({
|
2580
|
+
type: 'loggingapi',
|
2581
|
+
payload: {
|
2582
|
+
type: 'ingest',
|
2583
|
+
data,
|
2584
|
+
tag: properties?.tag,
|
2585
|
+
tagSource: properties?.tagSource,
|
2586
|
+
testData: properties?.testData,
|
2587
|
+
},
|
2588
|
+
});
|
845
2589
|
}
|
846
|
-
|
847
|
-
this.
|
2590
|
+
async query(data) {
|
2591
|
+
return this.falcon.bridge.postMessage({
|
2592
|
+
type: 'loggingapi',
|
2593
|
+
payload: {
|
2594
|
+
type: 'dynamic-execute',
|
2595
|
+
data,
|
2596
|
+
},
|
2597
|
+
});
|
848
2598
|
}
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
2599
|
+
}
|
2600
|
+
|
2601
|
+
const ALLOWED_TARGETS = ['_self', '_blank'];
|
2602
|
+
class Navigation {
|
2603
|
+
falcon;
|
2604
|
+
constructor(falcon) {
|
2605
|
+
this.falcon = falcon;
|
2606
|
+
}
|
2607
|
+
async navigateTo({ path, type, target, metaKey, ctrlKey, shiftKey, }) {
|
2608
|
+
await this.falcon.bridge.postMessage({
|
2609
|
+
type: 'navigateTo',
|
2610
|
+
payload: {
|
2611
|
+
path,
|
2612
|
+
type: type ?? 'falcon',
|
2613
|
+
target: target ?? '_self',
|
2614
|
+
metaKey: metaKey ?? false,
|
2615
|
+
ctrlKey: ctrlKey ?? false,
|
2616
|
+
shiftKey: shiftKey ?? false,
|
2617
|
+
},
|
867
2618
|
});
|
868
2619
|
}
|
869
|
-
|
870
|
-
if (!
|
871
|
-
|
2620
|
+
async onClick(event, defaultTarget = '_self', defaultType = 'falcon') {
|
2621
|
+
if (!(event instanceof Event)) {
|
2622
|
+
throw Error('"event" property should be subclass of Event');
|
872
2623
|
}
|
873
|
-
|
874
|
-
if (message.type === 'data') {
|
875
|
-
this.onDataUpdate?.(message);
|
876
|
-
// data update events are unidirectional and originated from the host, so there cannot be a callback waiting for this message
|
2624
|
+
if (!('preventDefault' in event)) {
|
877
2625
|
return;
|
878
2626
|
}
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
throw new Error(`Received unexpected message`);
|
2627
|
+
event.preventDefault();
|
2628
|
+
if (!(event.target instanceof HTMLAnchorElement)) {
|
2629
|
+
throw Error(`event target is not an anchor element, ${event.target}`);
|
883
2630
|
}
|
884
|
-
|
885
|
-
|
886
|
-
|
2631
|
+
const path = event.target.getAttribute('href');
|
2632
|
+
defaultTarget =
|
2633
|
+
event.target.getAttribute('target') ??
|
2634
|
+
defaultTarget;
|
2635
|
+
const type = (event.target.dataset?.type ??
|
2636
|
+
defaultType);
|
2637
|
+
if (defaultTarget === null ||
|
2638
|
+
!ALLOWED_TARGETS.includes(defaultTarget)) {
|
2639
|
+
throw new Error('Target should be _self or _blank');
|
2640
|
+
}
|
2641
|
+
const target = defaultTarget;
|
2642
|
+
if (path === undefined || path === null) {
|
2643
|
+
throw new Error('Navigation path is missing. Make sure you have added navigation.onClick on the `a` tag and `href` is present.');
|
2644
|
+
}
|
2645
|
+
const { metaKey, ctrlKey, shiftKey } = event;
|
2646
|
+
await this.navigateTo({ path, type, target, metaKey, ctrlKey, shiftKey });
|
2647
|
+
}
|
2648
|
+
}
|
2649
|
+
|
2650
|
+
class ResizeTracker {
|
2651
|
+
bridge;
|
2652
|
+
observer;
|
2653
|
+
constructor(bridge) {
|
2654
|
+
this.bridge = bridge;
|
2655
|
+
this.observer = new ResizeObserver((entries) => this.handleResizeEvent(entries));
|
2656
|
+
this.observer.observe(document.body);
|
2657
|
+
}
|
2658
|
+
handleResizeEvent(entries) {
|
2659
|
+
const { height } = entries[0].contentRect;
|
2660
|
+
this.bridge.sendUnidirectionalMessage({
|
2661
|
+
type: 'resize',
|
2662
|
+
payload: {
|
2663
|
+
height,
|
2664
|
+
},
|
2665
|
+
});
|
2666
|
+
}
|
2667
|
+
destroy() {
|
2668
|
+
this.observer.disconnect();
|
2669
|
+
}
|
2670
|
+
}
|
2671
|
+
|
2672
|
+
class UI {
|
2673
|
+
bridge;
|
2674
|
+
constructor(bridge) {
|
2675
|
+
this.bridge = bridge;
|
2676
|
+
}
|
2677
|
+
async openModal(extension, title, options = {}) {
|
2678
|
+
const result = await this.bridge.postMessage({
|
2679
|
+
type: 'openModal',
|
2680
|
+
payload: {
|
2681
|
+
extension,
|
2682
|
+
title,
|
2683
|
+
options,
|
2684
|
+
},
|
2685
|
+
});
|
2686
|
+
if (result instanceof Error) {
|
2687
|
+
throw result;
|
2688
|
+
}
|
2689
|
+
return result;
|
2690
|
+
}
|
2691
|
+
closeModal(payload) {
|
2692
|
+
this.bridge.sendUnidirectionalMessage({
|
2693
|
+
type: 'closeModal',
|
2694
|
+
payload,
|
2695
|
+
});
|
2696
|
+
}
|
887
2697
|
}
|
888
2698
|
|
889
2699
|
class FalconApi extends FalconPublicApis {
|
@@ -891,21 +2701,89 @@ class FalconApi extends FalconPublicApis {
|
|
891
2701
|
data;
|
892
2702
|
bridge = new Bridge({
|
893
2703
|
onDataUpdate: (data) => this.handleDataUpdate(data),
|
2704
|
+
onBroadcast: (msg) => this.handleBroadcastMessage(msg),
|
2705
|
+
onLivereload: () => this.handleLivereloadMessage(),
|
894
2706
|
});
|
2707
|
+
ui = new UI(this.bridge);
|
2708
|
+
resizeTracker;
|
2709
|
+
cloudFunctions = [];
|
2710
|
+
apiIntegrations = [];
|
2711
|
+
collections = [];
|
895
2712
|
async connect() {
|
896
2713
|
const { origin, data } = await this.bridge.postMessage({ type: 'connect' });
|
897
2714
|
this.bridge.setOrigin(origin);
|
898
2715
|
this.data = data;
|
2716
|
+
this.updateTheme(data?.theme);
|
2717
|
+
this.resizeTracker = new ResizeTracker(this.bridge);
|
899
2718
|
this.isConnected = true;
|
900
2719
|
}
|
2720
|
+
sendBroadcast(payload) {
|
2721
|
+
this.bridge.sendUnidirectionalMessage({ type: 'broadcast', payload });
|
2722
|
+
}
|
2723
|
+
async uploadFile(fileUploadType, initialData) {
|
2724
|
+
return this.bridge.postMessage({
|
2725
|
+
type: 'fileUpload',
|
2726
|
+
fileUploadType,
|
2727
|
+
payload: initialData,
|
2728
|
+
});
|
2729
|
+
}
|
901
2730
|
handleDataUpdate(dataMessage) {
|
902
2731
|
this.data = dataMessage.payload;
|
2732
|
+
this.updateTheme(this.data.theme);
|
903
2733
|
this.events.emit('data', this.data);
|
904
2734
|
}
|
2735
|
+
handleBroadcastMessage(message) {
|
2736
|
+
this.events.emit('broadcast', message.payload);
|
2737
|
+
}
|
2738
|
+
handleLivereloadMessage() {
|
2739
|
+
document.location.reload();
|
2740
|
+
}
|
2741
|
+
updateTheme(activeTheme) {
|
2742
|
+
if (!activeTheme) {
|
2743
|
+
return;
|
2744
|
+
}
|
2745
|
+
const inactiveTheme = activeTheme === 'theme-dark' ? 'theme-light' : 'theme-dark';
|
2746
|
+
document.documentElement.classList.add(activeTheme);
|
2747
|
+
document.documentElement.classList.remove(inactiveTheme);
|
2748
|
+
}
|
2749
|
+
cloudFunction({ id, version }) {
|
2750
|
+
assertConnection(this);
|
2751
|
+
const cf = new CloudFunction(this, { id, version });
|
2752
|
+
this.cloudFunctions.push(cf);
|
2753
|
+
return cf;
|
2754
|
+
}
|
2755
|
+
apiIntegration({ definitionId, operationId }) {
|
2756
|
+
assertConnection(this);
|
2757
|
+
const cf = new ApiIntegration(this, { operationId, definitionId });
|
2758
|
+
this.apiIntegrations.push(cf);
|
2759
|
+
return cf;
|
2760
|
+
}
|
2761
|
+
collection({ collection }) {
|
2762
|
+
assertConnection(this);
|
2763
|
+
const co = new Collection(this, { collection });
|
2764
|
+
this.collections.push(co);
|
2765
|
+
return co;
|
2766
|
+
}
|
2767
|
+
get navigation() {
|
2768
|
+
assertConnection(this);
|
2769
|
+
return new Navigation(this);
|
2770
|
+
}
|
2771
|
+
get logscale() {
|
2772
|
+
assertConnection(this);
|
2773
|
+
return new Logscale(this);
|
2774
|
+
}
|
905
2775
|
destroy() {
|
2776
|
+
this.cloudFunctions.forEach((cf) => cf.destroy());
|
2777
|
+
this.resizeTracker?.destroy();
|
906
2778
|
this.bridge.destroy();
|
907
2779
|
}
|
908
2780
|
}
|
2781
|
+
__decorate([
|
2782
|
+
Memoize()
|
2783
|
+
], FalconApi.prototype, "navigation", null);
|
2784
|
+
__decorate([
|
2785
|
+
Memoize()
|
2786
|
+
], FalconApi.prototype, "logscale", null);
|
909
2787
|
|
910
|
-
export { FalconApi as default };
|
2788
|
+
export { Bridge, FalconApi as default };
|
911
2789
|
//# sourceMappingURL=index.js.map
|