@crowdstrike/foundry-js 0.8.2 → 0.10.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/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 +86 -3
- 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 +16 -6
- 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 +301 -156
- package/dist/index.js.map +1 -1
- package/dist/lib/resize-tracker.d.ts +3 -0
- package/dist/lib/ui.d.ts +34 -2
- package/dist/types.d.ts +30 -0
- package/dist/utils.d.ts +2 -2
- package/package.json +1 -1
- package/dist/apis/actors/index.d.ts +0 -77
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',
|
@@ -2354,67 +2314,75 @@ class WorkflowsApiBridge {
|
|
2354
2314
|
*
|
2355
2315
|
**/
|
2356
2316
|
class FalconPublicApis {
|
2357
|
-
|
2358
|
-
|
2359
|
-
|
2360
|
-
return new ActorsApiBridge(this.bridge);
|
2317
|
+
api;
|
2318
|
+
constructor(api) {
|
2319
|
+
this.api = api;
|
2361
2320
|
}
|
2362
2321
|
get alerts() {
|
2363
|
-
assertConnection(this);
|
2364
|
-
return new AlertsApiBridge(this.bridge);
|
2322
|
+
assertConnection(this.api);
|
2323
|
+
return new AlertsApiBridge(this.api.bridge);
|
2365
2324
|
}
|
2366
2325
|
get detects() {
|
2367
|
-
assertConnection(this);
|
2368
|
-
return new DetectsApiBridge(this.bridge);
|
2326
|
+
assertConnection(this.api);
|
2327
|
+
return new DetectsApiBridge(this.api.bridge);
|
2369
2328
|
}
|
2370
2329
|
get devices() {
|
2371
|
-
assertConnection(this);
|
2372
|
-
return new DevicesApiBridge(this.bridge);
|
2330
|
+
assertConnection(this.api);
|
2331
|
+
return new DevicesApiBridge(this.api.bridge);
|
2373
2332
|
}
|
2374
2333
|
get fwmgr() {
|
2375
|
-
assertConnection(this);
|
2376
|
-
return new FwmgrApiBridge(this.bridge);
|
2334
|
+
assertConnection(this.api);
|
2335
|
+
return new FwmgrApiBridge(this.api.bridge);
|
2377
2336
|
}
|
2378
2337
|
get incidents() {
|
2379
|
-
assertConnection(this);
|
2380
|
-
return new IncidentsApiBridge(this.bridge);
|
2338
|
+
assertConnection(this.api);
|
2339
|
+
return new IncidentsApiBridge(this.api.bridge);
|
2381
2340
|
}
|
2382
2341
|
get mitre() {
|
2383
|
-
assertConnection(this);
|
2384
|
-
return new MitreApiBridge(this.bridge);
|
2342
|
+
assertConnection(this.api);
|
2343
|
+
return new MitreApiBridge(this.api.bridge);
|
2385
2344
|
}
|
2345
|
+
/**
|
2346
|
+
* @internal
|
2347
|
+
*/
|
2386
2348
|
get plugins() {
|
2387
|
-
assertConnection(this);
|
2388
|
-
return new PluginsApiBridge(this.bridge);
|
2349
|
+
assertConnection(this.api);
|
2350
|
+
return new PluginsApiBridge(this.api.bridge);
|
2389
2351
|
}
|
2390
2352
|
get remoteResponse() {
|
2391
|
-
assertConnection(this);
|
2392
|
-
return new RemoteResponseApiBridge(this.bridge);
|
2353
|
+
assertConnection(this.api);
|
2354
|
+
return new RemoteResponseApiBridge(this.api.bridge);
|
2393
2355
|
}
|
2394
2356
|
get userManagement() {
|
2395
|
-
assertConnection(this);
|
2396
|
-
return new UserManagementApiBridge(this.bridge);
|
2357
|
+
assertConnection(this.api);
|
2358
|
+
return new UserManagementApiBridge(this.api.bridge);
|
2397
2359
|
}
|
2398
2360
|
get workflows() {
|
2399
|
-
assertConnection(this);
|
2400
|
-
return new WorkflowsApiBridge(this.bridge);
|
2361
|
+
assertConnection(this.api);
|
2362
|
+
return new WorkflowsApiBridge(this.api.bridge);
|
2401
2363
|
}
|
2364
|
+
/**
|
2365
|
+
* @internal
|
2366
|
+
*/
|
2402
2367
|
get customobjects() {
|
2403
|
-
assertConnection(this);
|
2404
|
-
return new CustomobjectsApiBridge(this.bridge);
|
2368
|
+
assertConnection(this.api);
|
2369
|
+
return new CustomobjectsApiBridge(this.api.bridge);
|
2405
2370
|
}
|
2371
|
+
/**
|
2372
|
+
* @internal
|
2373
|
+
*/
|
2406
2374
|
get faasGateway() {
|
2407
|
-
assertConnection(this);
|
2408
|
-
return new FaasGatewayApiBridge(this.bridge);
|
2375
|
+
assertConnection(this.api);
|
2376
|
+
return new FaasGatewayApiBridge(this.api.bridge);
|
2409
2377
|
}
|
2378
|
+
/**
|
2379
|
+
* @internal
|
2380
|
+
*/
|
2410
2381
|
get loggingapi() {
|
2411
|
-
assertConnection(this);
|
2412
|
-
return new LoggingapiApiBridge(this.bridge);
|
2382
|
+
assertConnection(this.api);
|
2383
|
+
return new LoggingapiApiBridge(this.api.bridge);
|
2413
2384
|
}
|
2414
2385
|
}
|
2415
|
-
__decorate([
|
2416
|
-
Memoize()
|
2417
|
-
], FalconPublicApis.prototype, "actors", null);
|
2418
2386
|
__decorate([
|
2419
2387
|
Memoize()
|
2420
2388
|
], FalconPublicApis.prototype, "alerts", null);
|
@@ -2463,7 +2431,7 @@ class ApiIntegration {
|
|
2463
2431
|
this.definition = definition;
|
2464
2432
|
}
|
2465
2433
|
async execute({ request } = {}) {
|
2466
|
-
return this.falcon.plugins.postEntitiesExecuteV1({
|
2434
|
+
return this.falcon.api.plugins.postEntitiesExecuteV1({
|
2467
2435
|
resources: [
|
2468
2436
|
{
|
2469
2437
|
definition_id: this.definition.definitionId,
|
@@ -2483,8 +2451,17 @@ class CloudFunction {
|
|
2483
2451
|
static PATCH = 'PATCH';
|
2484
2452
|
static PUT = 'PUT';
|
2485
2453
|
static DELETE = 'DELETE';
|
2454
|
+
/**
|
2455
|
+
* @internal
|
2456
|
+
*/
|
2486
2457
|
pollTimeout = 500;
|
2458
|
+
/**
|
2459
|
+
* @internal
|
2460
|
+
*/
|
2487
2461
|
intervalId;
|
2462
|
+
/**
|
2463
|
+
* @internal
|
2464
|
+
*/
|
2488
2465
|
constructor(falcon, definition) {
|
2489
2466
|
this.falcon = falcon;
|
2490
2467
|
this.definition = definition;
|
@@ -2499,7 +2476,7 @@ class CloudFunction {
|
|
2499
2476
|
function_name: this.definition.name,
|
2500
2477
|
function_version: this.definition.version,
|
2501
2478
|
};
|
2502
|
-
const result = await this.falcon.faasGateway.postEntitiesExecutionV1({
|
2479
|
+
const result = await this.falcon.api.faasGateway.postEntitiesExecutionV1({
|
2503
2480
|
...functionDefinition,
|
2504
2481
|
payload: {
|
2505
2482
|
path,
|
@@ -2523,7 +2500,7 @@ class CloudFunction {
|
|
2523
2500
|
});
|
2524
2501
|
}
|
2525
2502
|
async getExecutionResult(executionId) {
|
2526
|
-
const resultResponse = await this.falcon.faasGateway.getEntitiesExecutionV1({
|
2503
|
+
const resultResponse = await this.falcon.api.faasGateway.getEntitiesExecutionV1({
|
2527
2504
|
id: executionId,
|
2528
2505
|
});
|
2529
2506
|
const executionResult = resultResponse?.resources?.[0];
|
@@ -2663,6 +2640,13 @@ class Collection {
|
|
2663
2640
|
this.falcon = falcon;
|
2664
2641
|
this.definition = definition;
|
2665
2642
|
}
|
2643
|
+
/**
|
2644
|
+
* Write data to the collection
|
2645
|
+
*
|
2646
|
+
* @param key
|
2647
|
+
* @param data
|
2648
|
+
* @returns
|
2649
|
+
*/
|
2666
2650
|
async write(key, data) {
|
2667
2651
|
return this.falcon.bridge.postMessage({
|
2668
2652
|
type: 'collection',
|
@@ -2674,6 +2658,12 @@ class Collection {
|
|
2674
2658
|
},
|
2675
2659
|
});
|
2676
2660
|
}
|
2661
|
+
/**
|
2662
|
+
* Read the data for the given `key`
|
2663
|
+
*
|
2664
|
+
* @param key
|
2665
|
+
* @returns
|
2666
|
+
*/
|
2677
2667
|
async read(key) {
|
2678
2668
|
return this.falcon.bridge.postMessage({
|
2679
2669
|
type: 'collection',
|
@@ -2684,6 +2674,12 @@ class Collection {
|
|
2684
2674
|
},
|
2685
2675
|
});
|
2686
2676
|
}
|
2677
|
+
/**
|
2678
|
+
* Delete the data for the given `key`
|
2679
|
+
*
|
2680
|
+
* @param key
|
2681
|
+
* @returns
|
2682
|
+
*/
|
2687
2683
|
async delete(key) {
|
2688
2684
|
return this.falcon.bridge.postMessage({
|
2689
2685
|
type: 'collection',
|
@@ -2694,6 +2690,12 @@ class Collection {
|
|
2694
2690
|
},
|
2695
2691
|
});
|
2696
2692
|
}
|
2693
|
+
/**
|
2694
|
+
* Search for data
|
2695
|
+
*
|
2696
|
+
* @param searchDefinition
|
2697
|
+
* @returns
|
2698
|
+
*/
|
2697
2699
|
async search({ filter, offset, sort, limit, }) {
|
2698
2700
|
return this.falcon.bridge.postMessage({
|
2699
2701
|
type: 'collection',
|
@@ -2714,7 +2716,16 @@ class Logscale {
|
|
2714
2716
|
constructor(falcon) {
|
2715
2717
|
this.falcon = falcon;
|
2716
2718
|
}
|
2717
|
-
|
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) {
|
2718
2729
|
return this.falcon.bridge.postMessage({
|
2719
2730
|
type: 'loggingapi',
|
2720
2731
|
payload: {
|
@@ -2726,21 +2737,37 @@ class Logscale {
|
|
2726
2737
|
},
|
2727
2738
|
});
|
2728
2739
|
}
|
2729
|
-
|
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) {
|
2730
2749
|
return this.falcon.bridge.postMessage({
|
2731
2750
|
type: 'loggingapi',
|
2732
2751
|
payload: {
|
2733
2752
|
type: 'dynamic-execute',
|
2734
|
-
data,
|
2753
|
+
data: query,
|
2735
2754
|
},
|
2736
2755
|
});
|
2737
2756
|
}
|
2738
|
-
|
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) {
|
2739
2766
|
return this.falcon.bridge.postMessage({
|
2740
2767
|
type: 'loggingapi',
|
2741
2768
|
payload: {
|
2742
2769
|
type: 'saved-query-execute',
|
2743
|
-
data,
|
2770
|
+
data: savedQuery,
|
2744
2771
|
},
|
2745
2772
|
});
|
2746
2773
|
}
|
@@ -2795,6 +2822,9 @@ class Navigation {
|
|
2795
2822
|
}
|
2796
2823
|
}
|
2797
2824
|
|
2825
|
+
/**
|
2826
|
+
* @internal
|
2827
|
+
*/
|
2798
2828
|
class ResizeTracker {
|
2799
2829
|
bridge;
|
2800
2830
|
observer;
|
@@ -2817,11 +2847,31 @@ class ResizeTracker {
|
|
2817
2847
|
}
|
2818
2848
|
}
|
2819
2849
|
|
2850
|
+
/**
|
2851
|
+
* Invoke UI features within the main Falcon Console.
|
2852
|
+
*/
|
2820
2853
|
class UI {
|
2821
2854
|
bridge;
|
2822
2855
|
constructor(bridge) {
|
2823
2856
|
this.bridge = bridge;
|
2824
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
|
+
*/
|
2825
2875
|
async openModal(extension, title, options = {}) {
|
2826
2876
|
const result = await this.bridge.postMessage({
|
2827
2877
|
type: 'openModal',
|
@@ -2836,27 +2886,94 @@ class UI {
|
|
2836
2886
|
}
|
2837
2887
|
return result;
|
2838
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
|
+
*/
|
2839
2894
|
closeModal(payload) {
|
2840
2895
|
this.bridge.sendUnidirectionalMessage({
|
2841
2896
|
type: 'closeModal',
|
2842
2897
|
payload,
|
2843
2898
|
});
|
2844
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
|
+
*/
|
2906
|
+
async uploadFile(fileUploadType, initialData) {
|
2907
|
+
return this.bridge.postMessage({
|
2908
|
+
type: 'fileUpload',
|
2909
|
+
fileUploadType,
|
2910
|
+
payload: initialData,
|
2911
|
+
});
|
2912
|
+
}
|
2845
2913
|
}
|
2846
2914
|
|
2847
|
-
|
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
|
+
*/
|
2929
|
+
class FalconApi {
|
2930
|
+
/**
|
2931
|
+
* @internal
|
2932
|
+
*/
|
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
|
+
*/
|
2848
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
|
+
*/
|
2849
2951
|
data;
|
2952
|
+
/**
|
2953
|
+
* @internal
|
2954
|
+
*/
|
2850
2955
|
bridge = new Bridge({
|
2851
2956
|
onDataUpdate: (data) => this.handleDataUpdate(data),
|
2852
2957
|
onBroadcast: (msg) => this.handleBroadcastMessage(msg),
|
2853
2958
|
onLivereload: () => this.handleLivereloadMessage(),
|
2854
2959
|
});
|
2960
|
+
/**
|
2961
|
+
* Namespace for all the {@link FalconPublicApis | Falcon Cloud APIs} you have access to with this SDK.
|
2962
|
+
*/
|
2963
|
+
api = new FalconPublicApis(this);
|
2964
|
+
/**
|
2965
|
+
* The {@link UI} class contains methods to invoke UI features within the main Falcon Console.
|
2966
|
+
*/
|
2855
2967
|
ui = new UI(this.bridge);
|
2856
2968
|
resizeTracker;
|
2857
2969
|
cloudFunctions = [];
|
2858
2970
|
apiIntegrations = [];
|
2859
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
|
+
*/
|
2860
2977
|
async connect() {
|
2861
2978
|
const { origin, data } = await this.bridge.postMessage({ type: 'connect' });
|
2862
2979
|
this.bridge.setOrigin(origin);
|
@@ -2865,19 +2982,23 @@ class FalconApi extends FalconPublicApis {
|
|
2865
2982
|
this.resizeTracker = new ResizeTracker(this.bridge);
|
2866
2983
|
this.isConnected = true;
|
2867
2984
|
}
|
2985
|
+
/**
|
2986
|
+
* The ID of the Foundry app this UI extension belongs to.
|
2987
|
+
*/
|
2868
2988
|
get appId() {
|
2869
2989
|
return this.data?.app.id;
|
2870
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
|
+
*/
|
2871
2999
|
sendBroadcast(payload) {
|
2872
3000
|
this.bridge.sendUnidirectionalMessage({ type: 'broadcast', payload });
|
2873
3001
|
}
|
2874
|
-
async uploadFile(fileUploadType, initialData) {
|
2875
|
-
return this.bridge.postMessage({
|
2876
|
-
type: 'fileUpload',
|
2877
|
-
fileUploadType,
|
2878
|
-
payload: initialData,
|
2879
|
-
});
|
2880
|
-
}
|
2881
3002
|
handleDataUpdate(dataMessage) {
|
2882
3003
|
this.data = dataMessage.payload;
|
2883
3004
|
this.updateTheme(this.data.theme);
|
@@ -2897,34 +3018,58 @@ class FalconApi extends FalconPublicApis {
|
|
2897
3018
|
document.documentElement.classList.add(activeTheme);
|
2898
3019
|
document.documentElement.classList.remove(inactiveTheme);
|
2899
3020
|
}
|
3021
|
+
/**
|
3022
|
+
* Create a {@link CloudFunction} to integrate with Falcon's "Function as a Service" platform.
|
3023
|
+
*
|
3024
|
+
* @param definition
|
3025
|
+
* @returns
|
3026
|
+
*/
|
2900
3027
|
cloudFunction(definition) {
|
2901
3028
|
assertConnection(this);
|
2902
3029
|
const cf = new CloudFunction(this, definition);
|
2903
3030
|
this.cloudFunctions.push(cf);
|
2904
3031
|
return cf;
|
2905
3032
|
}
|
3033
|
+
/**
|
3034
|
+
* Create an {@link ApiIntegration} to call external APIs.
|
3035
|
+
*
|
3036
|
+
* @param defintition
|
3037
|
+
* @returns
|
3038
|
+
*/
|
2906
3039
|
apiIntegration({ definitionId, operationId, }) {
|
2907
3040
|
assertConnection(this);
|
2908
3041
|
if (!this.data) {
|
2909
3042
|
throw Error('Data from console is missing');
|
2910
3043
|
}
|
2911
|
-
const
|
3044
|
+
const apiIntegration = new ApiIntegration(this, {
|
2912
3045
|
operationId,
|
2913
3046
|
definitionId: definitionId ?? this.data?.app.id,
|
2914
3047
|
});
|
2915
|
-
this.apiIntegrations.push(
|
2916
|
-
return
|
2917
|
-
}
|
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
|
+
*/
|
2918
3057
|
collection({ collection }) {
|
2919
3058
|
assertConnection(this);
|
2920
3059
|
const co = new Collection(this, { collection });
|
2921
3060
|
this.collections.push(co);
|
2922
3061
|
return co;
|
2923
3062
|
}
|
3063
|
+
/**
|
3064
|
+
* The {@link Navigation} class provides functionality to navigate to other pages.
|
3065
|
+
*/
|
2924
3066
|
get navigation() {
|
2925
3067
|
assertConnection(this);
|
2926
3068
|
return new Navigation(this);
|
2927
3069
|
}
|
3070
|
+
/**
|
3071
|
+
* The {@link Logscale} class allows you to read and write to your custom LogScale repository.
|
3072
|
+
*/
|
2928
3073
|
get logscale() {
|
2929
3074
|
assertConnection(this);
|
2930
3075
|
return new Logscale(this);
|