@crowdstrike/foundry-js 0.8.2 → 0.9.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/api.d.ts +4 -3
- package/dist/apis/public-api.d.ts +4 -4
- package/dist/index.js +45 -40
- package/dist/index.js.map +1 -1
- package/dist/lib/ui.d.ts +2 -1
- package/dist/utils.d.ts +2 -2
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
@@ -7,15 +7,17 @@ import { Collection } from './abstraction/collection';
|
|
7
7
|
import { Logscale } from './abstraction/logscale';
|
8
8
|
import { Navigation } from './lib/navigation';
|
9
9
|
import { UI } from './lib/ui';
|
10
|
-
import type { CloudFunctionDefinition,
|
10
|
+
import type { CloudFunctionDefinition, LocalData } from './types';
|
11
11
|
interface EventMap<DATA extends LocalData> {
|
12
12
|
data: DATA;
|
13
13
|
broadcast: unknown;
|
14
14
|
}
|
15
|
-
export default class FalconApi<DATA extends LocalData = LocalData>
|
15
|
+
export default class FalconApi<DATA extends LocalData = LocalData> {
|
16
|
+
isConnected: boolean;
|
16
17
|
events: Emittery<EventMap<DATA>, EventMap<DATA> & import("emittery").OmnipresentEventData, DATA extends undefined ? "data" : never>;
|
17
18
|
data?: DATA;
|
18
19
|
bridge: Bridge<DATA>;
|
20
|
+
api: FalconPublicApis;
|
19
21
|
ui: UI<DATA>;
|
20
22
|
private resizeTracker?;
|
21
23
|
private cloudFunctions;
|
@@ -24,7 +26,6 @@ export default class FalconApi<DATA extends LocalData = LocalData> extends Falco
|
|
24
26
|
connect(): Promise<void>;
|
25
27
|
get appId(): string | undefined;
|
26
28
|
sendBroadcast(payload: unknown): void;
|
27
|
-
uploadFile<TYPE extends FileUploadType>(fileUploadType: TYPE, initialData?: PayloadForFileUploadType<TYPE>): Promise<ResponseForFileUploadType<TYPE> | undefined>;
|
28
29
|
private handleDataUpdate;
|
29
30
|
private handleBroadcastMessage;
|
30
31
|
private handleLivereloadMessage;
|
@@ -19,10 +19,10 @@ import { PluginsApiBridge } from './plugins';
|
|
19
19
|
import { RemoteResponseApiBridge } from './remote-response';
|
20
20
|
import { UserManagementApiBridge } from './user-management';
|
21
21
|
import { WorkflowsApiBridge } from './workflows';
|
22
|
-
import type
|
23
|
-
export default
|
24
|
-
|
25
|
-
|
22
|
+
import type FalconApi from 'api';
|
23
|
+
export default class FalconPublicApis {
|
24
|
+
private api;
|
25
|
+
constructor(api: FalconApi<any>);
|
26
26
|
get actors(): ActorsApiBridge;
|
27
27
|
get alerts(): AlertsApiBridge;
|
28
28
|
get detects(): DetectsApiBridge;
|
package/dist/index.js
CHANGED
@@ -2354,62 +2354,65 @@ class WorkflowsApiBridge {
|
|
2354
2354
|
*
|
2355
2355
|
**/
|
2356
2356
|
class FalconPublicApis {
|
2357
|
-
|
2357
|
+
api;
|
2358
|
+
constructor(api) {
|
2359
|
+
this.api = api;
|
2360
|
+
}
|
2358
2361
|
get actors() {
|
2359
|
-
assertConnection(this);
|
2360
|
-
return new ActorsApiBridge(this.bridge);
|
2362
|
+
assertConnection(this.api);
|
2363
|
+
return new ActorsApiBridge(this.api.bridge);
|
2361
2364
|
}
|
2362
2365
|
get alerts() {
|
2363
|
-
assertConnection(this);
|
2364
|
-
return new AlertsApiBridge(this.bridge);
|
2366
|
+
assertConnection(this.api);
|
2367
|
+
return new AlertsApiBridge(this.api.bridge);
|
2365
2368
|
}
|
2366
2369
|
get detects() {
|
2367
|
-
assertConnection(this);
|
2368
|
-
return new DetectsApiBridge(this.bridge);
|
2370
|
+
assertConnection(this.api);
|
2371
|
+
return new DetectsApiBridge(this.api.bridge);
|
2369
2372
|
}
|
2370
2373
|
get devices() {
|
2371
|
-
assertConnection(this);
|
2372
|
-
return new DevicesApiBridge(this.bridge);
|
2374
|
+
assertConnection(this.api);
|
2375
|
+
return new DevicesApiBridge(this.api.bridge);
|
2373
2376
|
}
|
2374
2377
|
get fwmgr() {
|
2375
|
-
assertConnection(this);
|
2376
|
-
return new FwmgrApiBridge(this.bridge);
|
2378
|
+
assertConnection(this.api);
|
2379
|
+
return new FwmgrApiBridge(this.api.bridge);
|
2377
2380
|
}
|
2378
2381
|
get incidents() {
|
2379
|
-
assertConnection(this);
|
2380
|
-
return new IncidentsApiBridge(this.bridge);
|
2382
|
+
assertConnection(this.api);
|
2383
|
+
return new IncidentsApiBridge(this.api.bridge);
|
2381
2384
|
}
|
2382
2385
|
get mitre() {
|
2383
|
-
assertConnection(this);
|
2384
|
-
return new MitreApiBridge(this.bridge);
|
2386
|
+
assertConnection(this.api);
|
2387
|
+
return new MitreApiBridge(this.api.bridge);
|
2385
2388
|
}
|
2386
2389
|
get plugins() {
|
2387
|
-
assertConnection(this);
|
2388
|
-
return new PluginsApiBridge(this.bridge);
|
2390
|
+
assertConnection(this.api);
|
2391
|
+
return new PluginsApiBridge(this.api.bridge);
|
2389
2392
|
}
|
2390
2393
|
get remoteResponse() {
|
2391
|
-
assertConnection(this);
|
2392
|
-
return new RemoteResponseApiBridge(this.bridge);
|
2394
|
+
assertConnection(this.api);
|
2395
|
+
return new RemoteResponseApiBridge(this.api.bridge);
|
2393
2396
|
}
|
2394
2397
|
get userManagement() {
|
2395
|
-
assertConnection(this);
|
2396
|
-
return new UserManagementApiBridge(this.bridge);
|
2398
|
+
assertConnection(this.api);
|
2399
|
+
return new UserManagementApiBridge(this.api.bridge);
|
2397
2400
|
}
|
2398
2401
|
get workflows() {
|
2399
|
-
assertConnection(this);
|
2400
|
-
return new WorkflowsApiBridge(this.bridge);
|
2402
|
+
assertConnection(this.api);
|
2403
|
+
return new WorkflowsApiBridge(this.api.bridge);
|
2401
2404
|
}
|
2402
2405
|
get customobjects() {
|
2403
|
-
assertConnection(this);
|
2404
|
-
return new CustomobjectsApiBridge(this.bridge);
|
2406
|
+
assertConnection(this.api);
|
2407
|
+
return new CustomobjectsApiBridge(this.api.bridge);
|
2405
2408
|
}
|
2406
2409
|
get faasGateway() {
|
2407
|
-
assertConnection(this);
|
2408
|
-
return new FaasGatewayApiBridge(this.bridge);
|
2410
|
+
assertConnection(this.api);
|
2411
|
+
return new FaasGatewayApiBridge(this.api.bridge);
|
2409
2412
|
}
|
2410
2413
|
get loggingapi() {
|
2411
|
-
assertConnection(this);
|
2412
|
-
return new LoggingapiApiBridge(this.bridge);
|
2414
|
+
assertConnection(this.api);
|
2415
|
+
return new LoggingapiApiBridge(this.api.bridge);
|
2413
2416
|
}
|
2414
2417
|
}
|
2415
2418
|
__decorate([
|
@@ -2463,7 +2466,7 @@ class ApiIntegration {
|
|
2463
2466
|
this.definition = definition;
|
2464
2467
|
}
|
2465
2468
|
async execute({ request } = {}) {
|
2466
|
-
return this.falcon.plugins.postEntitiesExecuteV1({
|
2469
|
+
return this.falcon.api.plugins.postEntitiesExecuteV1({
|
2467
2470
|
resources: [
|
2468
2471
|
{
|
2469
2472
|
definition_id: this.definition.definitionId,
|
@@ -2499,7 +2502,7 @@ class CloudFunction {
|
|
2499
2502
|
function_name: this.definition.name,
|
2500
2503
|
function_version: this.definition.version,
|
2501
2504
|
};
|
2502
|
-
const result = await this.falcon.faasGateway.postEntitiesExecutionV1({
|
2505
|
+
const result = await this.falcon.api.faasGateway.postEntitiesExecutionV1({
|
2503
2506
|
...functionDefinition,
|
2504
2507
|
payload: {
|
2505
2508
|
path,
|
@@ -2523,7 +2526,7 @@ class CloudFunction {
|
|
2523
2526
|
});
|
2524
2527
|
}
|
2525
2528
|
async getExecutionResult(executionId) {
|
2526
|
-
const resultResponse = await this.falcon.faasGateway.getEntitiesExecutionV1({
|
2529
|
+
const resultResponse = await this.falcon.api.faasGateway.getEntitiesExecutionV1({
|
2527
2530
|
id: executionId,
|
2528
2531
|
});
|
2529
2532
|
const executionResult = resultResponse?.resources?.[0];
|
@@ -2842,9 +2845,17 @@ class UI {
|
|
2842
2845
|
payload,
|
2843
2846
|
});
|
2844
2847
|
}
|
2848
|
+
async uploadFile(fileUploadType, initialData) {
|
2849
|
+
return this.bridge.postMessage({
|
2850
|
+
type: 'fileUpload',
|
2851
|
+
fileUploadType,
|
2852
|
+
payload: initialData,
|
2853
|
+
});
|
2854
|
+
}
|
2845
2855
|
}
|
2846
2856
|
|
2847
|
-
class FalconApi
|
2857
|
+
class FalconApi {
|
2858
|
+
isConnected = false;
|
2848
2859
|
events = new Emittery();
|
2849
2860
|
data;
|
2850
2861
|
bridge = new Bridge({
|
@@ -2852,6 +2863,7 @@ class FalconApi extends FalconPublicApis {
|
|
2852
2863
|
onBroadcast: (msg) => this.handleBroadcastMessage(msg),
|
2853
2864
|
onLivereload: () => this.handleLivereloadMessage(),
|
2854
2865
|
});
|
2866
|
+
api = new FalconPublicApis(this);
|
2855
2867
|
ui = new UI(this.bridge);
|
2856
2868
|
resizeTracker;
|
2857
2869
|
cloudFunctions = [];
|
@@ -2871,13 +2883,6 @@ class FalconApi extends FalconPublicApis {
|
|
2871
2883
|
sendBroadcast(payload) {
|
2872
2884
|
this.bridge.sendUnidirectionalMessage({ type: 'broadcast', payload });
|
2873
2885
|
}
|
2874
|
-
async uploadFile(fileUploadType, initialData) {
|
2875
|
-
return this.bridge.postMessage({
|
2876
|
-
type: 'fileUpload',
|
2877
|
-
fileUploadType,
|
2878
|
-
payload: initialData,
|
2879
|
-
});
|
2880
|
-
}
|
2881
2886
|
handleDataUpdate(dataMessage) {
|
2882
2887
|
this.data = dataMessage.payload;
|
2883
2888
|
this.updateTheme(this.data.theme);
|