@crowdstrike/foundry-js 0.9.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstraction/cloud-function.d.ts +14 -5
- package/dist/abstraction/collection.d.ts +29 -0
- package/dist/abstraction/logscale.d.ts +21 -2
- package/dist/api.d.ts +82 -0
- package/dist/apis/available-apis.d.ts +1 -1
- package/dist/apis/devices/index.d.ts +78 -32
- package/dist/apis/mitre/index.d.ts +8 -8
- package/dist/apis/public-api.d.ts +13 -3
- package/dist/apis/remote-response/index.d.ts +2 -12
- package/dist/apis/types-response-for.d.ts +14 -15
- package/dist/apis/types.d.ts +3 -4
- package/dist/index.js +259 -119
- package/dist/index.js.map +1 -1
- package/dist/lib/resize-tracker.d.ts +3 -0
- package/dist/lib/ui.d.ts +32 -1
- package/dist/types.d.ts +38 -0
- package/package.json +1 -1
- package/dist/apis/actors/index.d.ts +0 -77
package/dist/apis/types.d.ts
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
* DO NOT EDIT DIRECTLY
|
6
6
|
*
|
7
7
|
**/
|
8
|
-
import { ActorsApiRequestMessage, ActorsApiResponseMessage } from './actors';
|
9
8
|
import { AlertsApiRequestMessage, AlertsApiResponseMessage } from './alerts';
|
10
9
|
import { CustomobjectsApiRequestMessage, CustomobjectsApiResponseMessage } from './customobjects';
|
11
10
|
import { DetectsApiRequestMessage, DetectsApiResponseMessage } from './detects';
|
@@ -19,6 +18,6 @@ import { PluginsApiRequestMessage, PluginsApiResponseMessage } from './plugins';
|
|
19
18
|
import { RemoteResponseApiRequestMessage, RemoteResponseApiResponseMessage } from './remote-response';
|
20
19
|
import { UserManagementApiRequestMessage, UserManagementApiResponseMessage } from './user-management';
|
21
20
|
import { WorkflowsApiRequestMessage, WorkflowsApiResponseMessage } from './workflows';
|
22
|
-
export {
|
23
|
-
export type ApiRequestMessage =
|
24
|
-
export type ApiResponseMessage =
|
21
|
+
export { AlertsApiRequestMessage, AlertsApiResponseMessage, DetectsApiRequestMessage, DetectsApiResponseMessage, DevicesApiRequestMessage, DevicesApiResponseMessage, FwmgrApiRequestMessage, FwmgrApiResponseMessage, IncidentsApiRequestMessage, IncidentsApiResponseMessage, MitreApiRequestMessage, MitreApiResponseMessage, PluginsApiRequestMessage, PluginsApiResponseMessage, RemoteResponseApiRequestMessage, RemoteResponseApiResponseMessage, UserManagementApiRequestMessage, UserManagementApiResponseMessage, WorkflowsApiRequestMessage, WorkflowsApiResponseMessage, CustomobjectsApiRequestMessage, CustomobjectsApiResponseMessage, FaasGatewayApiRequestMessage, FaasGatewayApiResponseMessage, LoggingapiApiRequestMessage, LoggingapiApiResponseMessage, };
|
22
|
+
export type ApiRequestMessage = AlertsApiRequestMessage | DetectsApiRequestMessage | DevicesApiRequestMessage | FwmgrApiRequestMessage | IncidentsApiRequestMessage | MitreApiRequestMessage | PluginsApiRequestMessage | RemoteResponseApiRequestMessage | UserManagementApiRequestMessage | WorkflowsApiRequestMessage | CustomobjectsApiRequestMessage | FaasGatewayApiRequestMessage | LoggingapiApiRequestMessage;
|
23
|
+
export type ApiResponseMessage = AlertsApiResponseMessage | DetectsApiResponseMessage | DevicesApiResponseMessage | FwmgrApiResponseMessage | IncidentsApiResponseMessage | MitreApiResponseMessage | PluginsApiResponseMessage | RemoteResponseApiResponseMessage | UserManagementApiResponseMessage | WorkflowsApiResponseMessage | CustomobjectsApiResponseMessage | FaasGatewayApiResponseMessage | LoggingapiApiResponseMessage;
|
package/dist/index.js
CHANGED
@@ -830,81 +830,6 @@ function getNewFunction(originalMethod, hashFunction, duration = 0, tags) {
|
|
830
830
|
};
|
831
831
|
}
|
832
832
|
|
833
|
-
/**
|
834
|
-
*
|
835
|
-
* This file is autogenerated.
|
836
|
-
*
|
837
|
-
* DO NOT EDIT DIRECTLY
|
838
|
-
*
|
839
|
-
**/
|
840
|
-
class ActorsApiBridge {
|
841
|
-
bridge;
|
842
|
-
constructor(bridge) {
|
843
|
-
this.bridge = bridge;
|
844
|
-
}
|
845
|
-
getBridge() {
|
846
|
-
return this.bridge;
|
847
|
-
}
|
848
|
-
async getEntitiesActorsGetV2(urlParams = {}) {
|
849
|
-
const message = {
|
850
|
-
type: 'api',
|
851
|
-
api: 'actors',
|
852
|
-
method: 'getEntitiesActorsGetV2',
|
853
|
-
payload: {
|
854
|
-
params: urlParams,
|
855
|
-
},
|
856
|
-
};
|
857
|
-
return this.bridge.postMessage(message);
|
858
|
-
}
|
859
|
-
async getQueriesActorsV2(urlParams = {}) {
|
860
|
-
const message = {
|
861
|
-
type: 'api',
|
862
|
-
api: 'actors',
|
863
|
-
method: 'getQueriesActorsV2',
|
864
|
-
payload: {
|
865
|
-
params: urlParams,
|
866
|
-
},
|
867
|
-
};
|
868
|
-
return this.bridge.postMessage(message);
|
869
|
-
}
|
870
|
-
async postAggregatesActorsGetV2(postBody, urlParams = {}) {
|
871
|
-
const message = {
|
872
|
-
type: 'api',
|
873
|
-
api: 'actors',
|
874
|
-
method: 'postAggregatesActorsGetV2',
|
875
|
-
payload: {
|
876
|
-
body: postBody,
|
877
|
-
params: urlParams,
|
878
|
-
},
|
879
|
-
};
|
880
|
-
return this.bridge.postMessage(message);
|
881
|
-
}
|
882
|
-
async postEntitiesActorsGetV2(postBody, urlParams = {}) {
|
883
|
-
const message = {
|
884
|
-
type: 'api',
|
885
|
-
api: 'actors',
|
886
|
-
method: 'postEntitiesActorsGetV2',
|
887
|
-
payload: {
|
888
|
-
body: postBody,
|
889
|
-
params: urlParams,
|
890
|
-
},
|
891
|
-
};
|
892
|
-
return this.bridge.postMessage(message);
|
893
|
-
}
|
894
|
-
async postEntitiesMitreV1(postBody, urlParams = {}) {
|
895
|
-
const message = {
|
896
|
-
type: 'api',
|
897
|
-
api: 'actors',
|
898
|
-
method: 'postEntitiesMitreV1',
|
899
|
-
payload: {
|
900
|
-
body: postBody,
|
901
|
-
params: urlParams,
|
902
|
-
},
|
903
|
-
};
|
904
|
-
return this.bridge.postMessage(message);
|
905
|
-
}
|
906
|
-
}
|
907
|
-
|
908
833
|
/**
|
909
834
|
*
|
910
835
|
* This file is autogenerated.
|
@@ -1249,44 +1174,44 @@ class DevicesApiBridge {
|
|
1249
1174
|
};
|
1250
1175
|
return this.bridge.postMessage(message);
|
1251
1176
|
}
|
1252
|
-
async
|
1177
|
+
async getAggregatesFgaTagPrefixCountsV1(urlParams) {
|
1253
1178
|
const message = {
|
1254
1179
|
type: 'api',
|
1255
1180
|
api: 'devices',
|
1256
|
-
method: '
|
1181
|
+
method: 'getAggregatesFgaTagPrefixCountsV1',
|
1257
1182
|
payload: {
|
1258
1183
|
params: urlParams,
|
1259
1184
|
},
|
1260
1185
|
};
|
1261
1186
|
return this.bridge.postMessage(message);
|
1262
1187
|
}
|
1263
|
-
async
|
1188
|
+
async getAggregatesTagPrefixCountsV1(urlParams) {
|
1264
1189
|
const message = {
|
1265
1190
|
type: 'api',
|
1266
1191
|
api: 'devices',
|
1267
|
-
method: '
|
1192
|
+
method: 'getAggregatesTagPrefixCountsV1',
|
1268
1193
|
payload: {
|
1269
1194
|
params: urlParams,
|
1270
1195
|
},
|
1271
1196
|
};
|
1272
1197
|
return this.bridge.postMessage(message);
|
1273
1198
|
}
|
1274
|
-
async
|
1199
|
+
async getEntitiesFgaGroupsV1(urlParams) {
|
1275
1200
|
const message = {
|
1276
1201
|
type: 'api',
|
1277
1202
|
api: 'devices',
|
1278
|
-
method: '
|
1203
|
+
method: 'getEntitiesFgaGroupsV1',
|
1279
1204
|
payload: {
|
1280
1205
|
params: urlParams,
|
1281
1206
|
},
|
1282
1207
|
};
|
1283
1208
|
return this.bridge.postMessage(message);
|
1284
1209
|
}
|
1285
|
-
async
|
1210
|
+
async getEntitiesGroupsV1(urlParams) {
|
1286
1211
|
const message = {
|
1287
1212
|
type: 'api',
|
1288
1213
|
api: 'devices',
|
1289
|
-
method: '
|
1214
|
+
method: 'getEntitiesGroupsV1',
|
1290
1215
|
payload: {
|
1291
1216
|
params: urlParams,
|
1292
1217
|
},
|
@@ -1337,6 +1262,17 @@ class DevicesApiBridge {
|
|
1337
1262
|
};
|
1338
1263
|
return this.bridge.postMessage(message);
|
1339
1264
|
}
|
1265
|
+
async getQueriesFgaGroupsV1(urlParams = {}) {
|
1266
|
+
const message = {
|
1267
|
+
type: 'api',
|
1268
|
+
api: 'devices',
|
1269
|
+
method: 'getQueriesFgaGroupsV1',
|
1270
|
+
payload: {
|
1271
|
+
params: urlParams,
|
1272
|
+
},
|
1273
|
+
};
|
1274
|
+
return this.bridge.postMessage(message);
|
1275
|
+
}
|
1340
1276
|
async getQueriesGroupsV1(urlParams = {}) {
|
1341
1277
|
const message = {
|
1342
1278
|
type: 'api',
|
@@ -1384,6 +1320,18 @@ class DevicesApiBridge {
|
|
1384
1320
|
};
|
1385
1321
|
return this.bridge.postMessage(message);
|
1386
1322
|
}
|
1323
|
+
async postAggregatesFgaHostsGetV1(postBody, urlParams = {}) {
|
1324
|
+
const message = {
|
1325
|
+
type: 'api',
|
1326
|
+
api: 'devices',
|
1327
|
+
method: 'postAggregatesFgaHostsGetV1',
|
1328
|
+
payload: {
|
1329
|
+
body: postBody,
|
1330
|
+
params: urlParams,
|
1331
|
+
},
|
1332
|
+
};
|
1333
|
+
return this.bridge.postMessage(message);
|
1334
|
+
}
|
1387
1335
|
async postCombinedDevicesLoginHistoryV1(postBody, urlParams = {}) {
|
1388
1336
|
const message = {
|
1389
1337
|
type: 'api',
|
@@ -1396,6 +1344,18 @@ class DevicesApiBridge {
|
|
1396
1344
|
};
|
1397
1345
|
return this.bridge.postMessage(message);
|
1398
1346
|
}
|
1347
|
+
async postCombinedFgaHostsLoginHistoryV1(postBody, urlParams = {}) {
|
1348
|
+
const message = {
|
1349
|
+
type: 'api',
|
1350
|
+
api: 'devices',
|
1351
|
+
method: 'postCombinedFgaHostsLoginHistoryV1',
|
1352
|
+
payload: {
|
1353
|
+
body: postBody,
|
1354
|
+
params: urlParams,
|
1355
|
+
},
|
1356
|
+
};
|
1357
|
+
return this.bridge.postMessage(message);
|
1358
|
+
}
|
1399
1359
|
async postEntitiesDevicesActionsV4(postBody, urlParams = {}) {
|
1400
1360
|
const message = {
|
1401
1361
|
type: 'api',
|
@@ -1444,11 +1404,11 @@ class DevicesApiBridge {
|
|
1444
1404
|
};
|
1445
1405
|
return this.bridge.postMessage(message);
|
1446
1406
|
}
|
1447
|
-
async
|
1407
|
+
async postEntitiesFgaHostsReportsV1(postBody, urlParams = {}) {
|
1448
1408
|
const message = {
|
1449
1409
|
type: 'api',
|
1450
1410
|
api: 'devices',
|
1451
|
-
method: '
|
1411
|
+
method: 'postEntitiesFgaHostsReportsV1',
|
1452
1412
|
payload: {
|
1453
1413
|
body: postBody,
|
1454
1414
|
params: urlParams,
|
@@ -1456,11 +1416,11 @@ class DevicesApiBridge {
|
|
1456
1416
|
};
|
1457
1417
|
return this.bridge.postMessage(message);
|
1458
1418
|
}
|
1459
|
-
async
|
1419
|
+
async postEntitiesFgaHostsV1(postBody, urlParams = {}) {
|
1460
1420
|
const message = {
|
1461
1421
|
type: 'api',
|
1462
1422
|
api: 'devices',
|
1463
|
-
method: '
|
1423
|
+
method: 'postEntitiesFgaHostsV1',
|
1464
1424
|
payload: {
|
1465
1425
|
body: postBody,
|
1466
1426
|
params: urlParams,
|
@@ -1468,11 +1428,23 @@ class DevicesApiBridge {
|
|
1468
1428
|
};
|
1469
1429
|
return this.bridge.postMessage(message);
|
1470
1430
|
}
|
1471
|
-
async
|
1431
|
+
async postEntitiesGroupActionsV1(postBody, urlParams) {
|
1472
1432
|
const message = {
|
1473
1433
|
type: 'api',
|
1474
1434
|
api: 'devices',
|
1475
|
-
method: '
|
1435
|
+
method: 'postEntitiesGroupActionsV1',
|
1436
|
+
payload: {
|
1437
|
+
body: postBody,
|
1438
|
+
params: urlParams,
|
1439
|
+
},
|
1440
|
+
};
|
1441
|
+
return this.bridge.postMessage(message);
|
1442
|
+
}
|
1443
|
+
async postEntitiesGroupsV1(postBody, urlParams = {}) {
|
1444
|
+
const message = {
|
1445
|
+
type: 'api',
|
1446
|
+
api: 'devices',
|
1447
|
+
method: 'postEntitiesGroupsV1',
|
1476
1448
|
payload: {
|
1477
1449
|
body: postBody,
|
1478
1450
|
params: urlParams,
|
@@ -2092,11 +2064,11 @@ class MitreApiBridge {
|
|
2092
2064
|
getBridge() {
|
2093
2065
|
return this.bridge;
|
2094
2066
|
}
|
2095
|
-
async
|
2067
|
+
async getIntelMitreEntitiesMatrixV1(urlParams = {}) {
|
2096
2068
|
const message = {
|
2097
2069
|
type: 'api',
|
2098
2070
|
api: 'mitre',
|
2099
|
-
method: '
|
2071
|
+
method: 'getIntelMitreEntitiesMatrixV1',
|
2100
2072
|
payload: {
|
2101
2073
|
params: urlParams,
|
2102
2074
|
},
|
@@ -2228,18 +2200,6 @@ class RemoteResponseApiBridge {
|
|
2228
2200
|
};
|
2229
2201
|
return this.bridge.postMessage(message);
|
2230
2202
|
}
|
2231
|
-
async postEntitiesAppRefreshSessionsV1(postBody, urlParams = {}) {
|
2232
|
-
const message = {
|
2233
|
-
type: 'api',
|
2234
|
-
api: 'remoteResponse',
|
2235
|
-
method: 'postEntitiesAppRefreshSessionsV1',
|
2236
|
-
payload: {
|
2237
|
-
body: postBody,
|
2238
|
-
params: urlParams,
|
2239
|
-
},
|
2240
|
-
};
|
2241
|
-
return this.bridge.postMessage(message);
|
2242
|
-
}
|
2243
2203
|
async postEntitiesAppSessionsV1(postBody, urlParams = {}) {
|
2244
2204
|
const message = {
|
2245
2205
|
type: 'api',
|
@@ -2358,10 +2318,6 @@ class FalconPublicApis {
|
|
2358
2318
|
constructor(api) {
|
2359
2319
|
this.api = api;
|
2360
2320
|
}
|
2361
|
-
get actors() {
|
2362
|
-
assertConnection(this.api);
|
2363
|
-
return new ActorsApiBridge(this.api.bridge);
|
2364
|
-
}
|
2365
2321
|
get alerts() {
|
2366
2322
|
assertConnection(this.api);
|
2367
2323
|
return new AlertsApiBridge(this.api.bridge);
|
@@ -2386,6 +2342,9 @@ class FalconPublicApis {
|
|
2386
2342
|
assertConnection(this.api);
|
2387
2343
|
return new MitreApiBridge(this.api.bridge);
|
2388
2344
|
}
|
2345
|
+
/**
|
2346
|
+
* @internal
|
2347
|
+
*/
|
2389
2348
|
get plugins() {
|
2390
2349
|
assertConnection(this.api);
|
2391
2350
|
return new PluginsApiBridge(this.api.bridge);
|
@@ -2402,22 +2361,28 @@ class FalconPublicApis {
|
|
2402
2361
|
assertConnection(this.api);
|
2403
2362
|
return new WorkflowsApiBridge(this.api.bridge);
|
2404
2363
|
}
|
2364
|
+
/**
|
2365
|
+
* @internal
|
2366
|
+
*/
|
2405
2367
|
get customobjects() {
|
2406
2368
|
assertConnection(this.api);
|
2407
2369
|
return new CustomobjectsApiBridge(this.api.bridge);
|
2408
2370
|
}
|
2371
|
+
/**
|
2372
|
+
* @internal
|
2373
|
+
*/
|
2409
2374
|
get faasGateway() {
|
2410
2375
|
assertConnection(this.api);
|
2411
2376
|
return new FaasGatewayApiBridge(this.api.bridge);
|
2412
2377
|
}
|
2378
|
+
/**
|
2379
|
+
* @internal
|
2380
|
+
*/
|
2413
2381
|
get loggingapi() {
|
2414
2382
|
assertConnection(this.api);
|
2415
2383
|
return new LoggingapiApiBridge(this.api.bridge);
|
2416
2384
|
}
|
2417
2385
|
}
|
2418
|
-
__decorate([
|
2419
|
-
Memoize()
|
2420
|
-
], FalconPublicApis.prototype, "actors", null);
|
2421
2386
|
__decorate([
|
2422
2387
|
Memoize()
|
2423
2388
|
], FalconPublicApis.prototype, "alerts", null);
|
@@ -2486,8 +2451,17 @@ class CloudFunction {
|
|
2486
2451
|
static PATCH = 'PATCH';
|
2487
2452
|
static PUT = 'PUT';
|
2488
2453
|
static DELETE = 'DELETE';
|
2454
|
+
/**
|
2455
|
+
* @internal
|
2456
|
+
*/
|
2489
2457
|
pollTimeout = 500;
|
2458
|
+
/**
|
2459
|
+
* @internal
|
2460
|
+
*/
|
2490
2461
|
intervalId;
|
2462
|
+
/**
|
2463
|
+
* @internal
|
2464
|
+
*/
|
2491
2465
|
constructor(falcon, definition) {
|
2492
2466
|
this.falcon = falcon;
|
2493
2467
|
this.definition = definition;
|
@@ -2666,6 +2640,13 @@ class Collection {
|
|
2666
2640
|
this.falcon = falcon;
|
2667
2641
|
this.definition = definition;
|
2668
2642
|
}
|
2643
|
+
/**
|
2644
|
+
* Write data to the collection
|
2645
|
+
*
|
2646
|
+
* @param key
|
2647
|
+
* @param data
|
2648
|
+
* @returns
|
2649
|
+
*/
|
2669
2650
|
async write(key, data) {
|
2670
2651
|
return this.falcon.bridge.postMessage({
|
2671
2652
|
type: 'collection',
|
@@ -2677,6 +2658,12 @@ class Collection {
|
|
2677
2658
|
},
|
2678
2659
|
});
|
2679
2660
|
}
|
2661
|
+
/**
|
2662
|
+
* Read the data for the given `key`
|
2663
|
+
*
|
2664
|
+
* @param key
|
2665
|
+
* @returns
|
2666
|
+
*/
|
2680
2667
|
async read(key) {
|
2681
2668
|
return this.falcon.bridge.postMessage({
|
2682
2669
|
type: 'collection',
|
@@ -2687,6 +2674,12 @@ class Collection {
|
|
2687
2674
|
},
|
2688
2675
|
});
|
2689
2676
|
}
|
2677
|
+
/**
|
2678
|
+
* Delete the data for the given `key`
|
2679
|
+
*
|
2680
|
+
* @param key
|
2681
|
+
* @returns
|
2682
|
+
*/
|
2690
2683
|
async delete(key) {
|
2691
2684
|
return this.falcon.bridge.postMessage({
|
2692
2685
|
type: 'collection',
|
@@ -2697,6 +2690,12 @@ class Collection {
|
|
2697
2690
|
},
|
2698
2691
|
});
|
2699
2692
|
}
|
2693
|
+
/**
|
2694
|
+
* Search for data
|
2695
|
+
*
|
2696
|
+
* @param searchDefinition
|
2697
|
+
* @returns
|
2698
|
+
*/
|
2700
2699
|
async search({ filter, offset, sort, limit, }) {
|
2701
2700
|
return this.falcon.bridge.postMessage({
|
2702
2701
|
type: 'collection',
|
@@ -2717,7 +2716,16 @@ class Logscale {
|
|
2717
2716
|
constructor(falcon) {
|
2718
2717
|
this.falcon = falcon;
|
2719
2718
|
}
|
2720
|
-
|
2719
|
+
/**
|
2720
|
+
* Write data to LogScale
|
2721
|
+
*
|
2722
|
+
* @param data
|
2723
|
+
* @param properties
|
2724
|
+
* @returns
|
2725
|
+
*/
|
2726
|
+
async write(
|
2727
|
+
// @todo the proper type here is unclear - we need to make clear how the user needs to call this
|
2728
|
+
data, properties) {
|
2721
2729
|
return this.falcon.bridge.postMessage({
|
2722
2730
|
type: 'loggingapi',
|
2723
2731
|
payload: {
|
@@ -2729,21 +2737,37 @@ class Logscale {
|
|
2729
2737
|
},
|
2730
2738
|
});
|
2731
2739
|
}
|
2732
|
-
|
2740
|
+
/**
|
2741
|
+
* Execute a dynamic query
|
2742
|
+
*
|
2743
|
+
* @param query
|
2744
|
+
* @returns Promise that resolves with the data
|
2745
|
+
*/
|
2746
|
+
async query(
|
2747
|
+
// @todo the proper type here is unclear - we need to make clear how the user needs to call this
|
2748
|
+
query) {
|
2733
2749
|
return this.falcon.bridge.postMessage({
|
2734
2750
|
type: 'loggingapi',
|
2735
2751
|
payload: {
|
2736
2752
|
type: 'dynamic-execute',
|
2737
|
-
data,
|
2753
|
+
data: query,
|
2738
2754
|
},
|
2739
2755
|
});
|
2740
2756
|
}
|
2741
|
-
|
2757
|
+
/**
|
2758
|
+
* Execute a saved query
|
2759
|
+
*
|
2760
|
+
* @param savedQuery
|
2761
|
+
* @returns
|
2762
|
+
*/
|
2763
|
+
async savedQuery(
|
2764
|
+
// @todo the proper type here is unclear - we need to make clear how the user needs to call this
|
2765
|
+
savedQuery) {
|
2742
2766
|
return this.falcon.bridge.postMessage({
|
2743
2767
|
type: 'loggingapi',
|
2744
2768
|
payload: {
|
2745
2769
|
type: 'saved-query-execute',
|
2746
|
-
data,
|
2770
|
+
data: savedQuery,
|
2747
2771
|
},
|
2748
2772
|
});
|
2749
2773
|
}
|
@@ -2798,6 +2822,9 @@ class Navigation {
|
|
2798
2822
|
}
|
2799
2823
|
}
|
2800
2824
|
|
2825
|
+
/**
|
2826
|
+
* @internal
|
2827
|
+
*/
|
2801
2828
|
class ResizeTracker {
|
2802
2829
|
bridge;
|
2803
2830
|
observer;
|
@@ -2820,11 +2847,31 @@ class ResizeTracker {
|
|
2820
2847
|
}
|
2821
2848
|
}
|
2822
2849
|
|
2850
|
+
/**
|
2851
|
+
* Invoke UI features within the main Falcon Console.
|
2852
|
+
*/
|
2823
2853
|
class UI {
|
2824
2854
|
bridge;
|
2825
2855
|
constructor(bridge) {
|
2826
2856
|
this.bridge = bridge;
|
2827
2857
|
}
|
2858
|
+
/**
|
2859
|
+
* Open a modal within the Falcon Console, rendering an UI extension of your choice.
|
2860
|
+
*
|
2861
|
+
* ```js
|
2862
|
+
* const result = await api.ui.openModal({ id: '<extension ID as defined in the manifest>', type: 'extension' }, 'Modal title', {
|
2863
|
+
path: '/foo',
|
2864
|
+
data: { foo: 'bar' },
|
2865
|
+
size: 'lg',
|
2866
|
+
align: 'top',
|
2867
|
+
});
|
2868
|
+
```
|
2869
|
+
*
|
2870
|
+
* @param extension The identifier of the extension, consisting of {@link ExtensionIdentifier.id} and {@link ExtensionIdentifier.type}
|
2871
|
+
* @param title The title to render in the header of the modal
|
2872
|
+
* @param options
|
2873
|
+
* @returns a Promise that resolves with the data passed to {@link closeModal}, or `undefined` if the user dismisses it
|
2874
|
+
*/
|
2828
2875
|
async openModal(extension, title, options = {}) {
|
2829
2876
|
const result = await this.bridge.postMessage({
|
2830
2877
|
type: 'openModal',
|
@@ -2839,12 +2886,23 @@ class UI {
|
|
2839
2886
|
}
|
2840
2887
|
return result;
|
2841
2888
|
}
|
2889
|
+
/**
|
2890
|
+
* Close a modal already opened via {@link openModal}. This can be called both by the extension that is rendered inside the modal or by the extension that opened the modal.
|
2891
|
+
*
|
2892
|
+
* @param payload the data to return to the caller that opened the modal as the value of the resolved promise
|
2893
|
+
*/
|
2842
2894
|
closeModal(payload) {
|
2843
2895
|
this.bridge.sendUnidirectionalMessage({
|
2844
2896
|
type: 'closeModal',
|
2845
2897
|
payload,
|
2846
2898
|
});
|
2847
2899
|
}
|
2900
|
+
/**
|
2901
|
+
* This opens a file upload modal inside the Falcon Console, to support file uploads, even large binary files.
|
2902
|
+
*
|
2903
|
+
* @param fileUploadType the type of file upload
|
2904
|
+
* @param initialData data that you want to pre-populate the form with
|
2905
|
+
*/
|
2848
2906
|
async uploadFile(fileUploadType, initialData) {
|
2849
2907
|
return this.bridge.postMessage({
|
2850
2908
|
type: 'fileUpload',
|
@@ -2854,21 +2912,68 @@ class UI {
|
|
2854
2912
|
}
|
2855
2913
|
}
|
2856
2914
|
|
2915
|
+
/**
|
2916
|
+
* This is the main class and only entrypoint for engaging with the Falcon APIs from an Foundry UI extension or page.
|
2917
|
+
*
|
2918
|
+
* At the very minimum, you would have to instantiate the class and connect to the Falcon Console:
|
2919
|
+
*
|
2920
|
+
* ```js
|
2921
|
+
* import FalconApi from '@crowdstrike/foundry-js';
|
2922
|
+
*
|
2923
|
+
* const api = new FalconApi();
|
2924
|
+
*
|
2925
|
+
* await api.connect();
|
2926
|
+
* ```
|
2927
|
+
*
|
2928
|
+
*/
|
2857
2929
|
class FalconApi {
|
2930
|
+
/**
|
2931
|
+
* @internal
|
2932
|
+
*/
|
2858
2933
|
isConnected = false;
|
2934
|
+
/**
|
2935
|
+
* An event emitter that allows you to subscribe to events issued by the Falcon Console.
|
2936
|
+
*
|
2937
|
+
* Currently supported event types:
|
2938
|
+
* * `data`: fires when {@link data} is updated.
|
2939
|
+
* * `broadcast`: this event is received when another extension of the same app has send a `broadcast` event via {@link sendBroadcast}.
|
2940
|
+
*
|
2941
|
+
* ```js
|
2942
|
+
* api.events.on('data', (newData) => console.log('new data received:', newData));
|
2943
|
+
* ```
|
2944
|
+
*/
|
2859
2945
|
events = new Emittery();
|
2946
|
+
/**
|
2947
|
+
* The "local data" that your extension receives from the Falcon Console. This can vary depending on the state of the Falcon Console and the socket of the extension.
|
2948
|
+
*
|
2949
|
+
* At the very least it will contain the data specified by the {@link LocalData} interface.
|
2950
|
+
*/
|
2860
2951
|
data;
|
2952
|
+
/**
|
2953
|
+
* @internal
|
2954
|
+
*/
|
2861
2955
|
bridge = new Bridge({
|
2862
2956
|
onDataUpdate: (data) => this.handleDataUpdate(data),
|
2863
2957
|
onBroadcast: (msg) => this.handleBroadcastMessage(msg),
|
2864
2958
|
onLivereload: () => this.handleLivereloadMessage(),
|
2865
2959
|
});
|
2960
|
+
/**
|
2961
|
+
* Namespace for all the {@link FalconPublicApis | Falcon Cloud APIs} you have access to with this SDK.
|
2962
|
+
*/
|
2866
2963
|
api = new FalconPublicApis(this);
|
2964
|
+
/**
|
2965
|
+
* The {@link UI} class contains methods to invoke UI features within the main Falcon Console.
|
2966
|
+
*/
|
2867
2967
|
ui = new UI(this.bridge);
|
2868
2968
|
resizeTracker;
|
2869
2969
|
cloudFunctions = [];
|
2870
2970
|
apiIntegrations = [];
|
2871
2971
|
collections = [];
|
2972
|
+
/**
|
2973
|
+
* Connect to the main Falcon Console from within your UI extension.
|
2974
|
+
*
|
2975
|
+
* This establishes a connection to send messages between the extension and the Falcon Console. Only when established you will be able to call other APIs.
|
2976
|
+
*/
|
2872
2977
|
async connect() {
|
2873
2978
|
const { origin, data } = await this.bridge.postMessage({ type: 'connect' });
|
2874
2979
|
this.bridge.setOrigin(origin);
|
@@ -2877,9 +2982,20 @@ class FalconApi {
|
|
2877
2982
|
this.resizeTracker = new ResizeTracker(this.bridge);
|
2878
2983
|
this.isConnected = true;
|
2879
2984
|
}
|
2985
|
+
/**
|
2986
|
+
* The ID of the Foundry app this UI extension belongs to.
|
2987
|
+
*/
|
2880
2988
|
get appId() {
|
2881
2989
|
return this.data?.app.id;
|
2882
2990
|
}
|
2991
|
+
/**
|
2992
|
+
* Sending broadcast messages is a mechanism for allowing communication between different UI extensions, when they are displayed at the same time.
|
2993
|
+
* When sending a broadcast message, other extensions need to listen for the `broadcast` event on the {@link events} event emitter.
|
2994
|
+
*
|
2995
|
+
* Note that broadcast messages are only dispatched between UI extensions of the same app!
|
2996
|
+
*
|
2997
|
+
* @param payload the data you want to send to other UI extensions
|
2998
|
+
*/
|
2883
2999
|
sendBroadcast(payload) {
|
2884
3000
|
this.bridge.sendUnidirectionalMessage({ type: 'broadcast', payload });
|
2885
3001
|
}
|
@@ -2902,34 +3018,58 @@ class FalconApi {
|
|
2902
3018
|
document.documentElement.classList.add(activeTheme);
|
2903
3019
|
document.documentElement.classList.remove(inactiveTheme);
|
2904
3020
|
}
|
3021
|
+
/**
|
3022
|
+
* Create a {@link CloudFunction} to integrate with Falcon's "Function as a Service" platform.
|
3023
|
+
*
|
3024
|
+
* @param definition
|
3025
|
+
* @returns
|
3026
|
+
*/
|
2905
3027
|
cloudFunction(definition) {
|
2906
3028
|
assertConnection(this);
|
2907
3029
|
const cf = new CloudFunction(this, definition);
|
2908
3030
|
this.cloudFunctions.push(cf);
|
2909
3031
|
return cf;
|
2910
3032
|
}
|
3033
|
+
/**
|
3034
|
+
* Create an {@link ApiIntegration} to call external APIs.
|
3035
|
+
*
|
3036
|
+
* @param defintition
|
3037
|
+
* @returns
|
3038
|
+
*/
|
2911
3039
|
apiIntegration({ definitionId, operationId, }) {
|
2912
3040
|
assertConnection(this);
|
2913
3041
|
if (!this.data) {
|
2914
3042
|
throw Error('Data from console is missing');
|
2915
3043
|
}
|
2916
|
-
const
|
3044
|
+
const apiIntegration = new ApiIntegration(this, {
|
2917
3045
|
operationId,
|
2918
3046
|
definitionId: definitionId ?? this.data?.app.id,
|
2919
3047
|
});
|
2920
|
-
this.apiIntegrations.push(
|
2921
|
-
return
|
2922
|
-
}
|
3048
|
+
this.apiIntegrations.push(apiIntegration);
|
3049
|
+
return apiIntegration;
|
3050
|
+
}
|
3051
|
+
/**
|
3052
|
+
* Create a {@link Collection} to write to and query Falcon's custom storage service.
|
3053
|
+
*
|
3054
|
+
* @param definition
|
3055
|
+
* @returns
|
3056
|
+
*/
|
2923
3057
|
collection({ collection }) {
|
2924
3058
|
assertConnection(this);
|
2925
3059
|
const co = new Collection(this, { collection });
|
2926
3060
|
this.collections.push(co);
|
2927
3061
|
return co;
|
2928
3062
|
}
|
3063
|
+
/**
|
3064
|
+
* The {@link Navigation} class provides functionality to navigate to other pages.
|
3065
|
+
*/
|
2929
3066
|
get navigation() {
|
2930
3067
|
assertConnection(this);
|
2931
3068
|
return new Navigation(this);
|
2932
3069
|
}
|
3070
|
+
/**
|
3071
|
+
* The {@link Logscale} class allows you to read and write to your custom LogScale repository.
|
3072
|
+
*/
|
2933
3073
|
get logscale() {
|
2934
3074
|
assertConnection(this);
|
2935
3075
|
return new Logscale(this);
|