@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.
@@ -1,5 +1,8 @@
1
1
  import type { Bridge } from '../bridge';
2
2
  import type { LocalData } from '../types';
3
+ /**
4
+ * @internal
5
+ */
3
6
  export declare class ResizeTracker<DATA extends LocalData = LocalData> {
4
7
  private bridge;
5
8
  private observer;
package/dist/lib/ui.d.ts CHANGED
@@ -1,8 +1,40 @@
1
1
  import type { Bridge } from '../bridge';
2
- import type { ExtensionIdentifier, LocalData, OpenModalOptions } from '../types';
2
+ import type { ExtensionIdentifier, FileUploadType, LocalData, OpenModalOptions, PayloadForFileUploadType, ResponseForFileUploadType } from '../types';
3
+ /**
4
+ * Invoke UI features within the main Falcon Console.
5
+ */
3
6
  export declare class UI<DATA extends LocalData = LocalData> {
4
7
  private bridge;
5
8
  constructor(bridge: Bridge<DATA>);
6
- openModal<PAYLOAD = unknown>(extension: ExtensionIdentifier, title: string, options?: OpenModalOptions): Promise<PAYLOAD>;
9
+ /**
10
+ * Open a modal within the Falcon Console, rendering an UI extension of your choice.
11
+ *
12
+ * ```js
13
+ * const result = await api.ui.openModal({ id: '<extension ID as defined in the manifest>', type: 'extension' }, 'Modal title', {
14
+ path: '/foo',
15
+ data: { foo: 'bar' },
16
+ size: 'lg',
17
+ align: 'top',
18
+ });
19
+ ```
20
+ *
21
+ * @param extension The identifier of the extension, consisting of {@link ExtensionIdentifier.id} and {@link ExtensionIdentifier.type}
22
+ * @param title The title to render in the header of the modal
23
+ * @param options
24
+ * @returns a Promise that resolves with the data passed to {@link closeModal}, or `undefined` if the user dismisses it
25
+ */
26
+ openModal<PAYLOAD = unknown>(extension: ExtensionIdentifier, title: string, options?: OpenModalOptions): Promise<PAYLOAD | undefined>;
27
+ /**
28
+ * 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.
29
+ *
30
+ * @param payload the data to return to the caller that opened the modal as the value of the resolved promise
31
+ */
7
32
  closeModal<PAYLOAD = unknown>(payload?: PAYLOAD): void;
33
+ /**
34
+ * This opens a file upload modal inside the Falcon Console, to support file uploads, even large binary files.
35
+ *
36
+ * @param fileUploadType the type of file upload
37
+ * @param initialData data that you want to pre-populate the form with
38
+ */
39
+ uploadFile<TYPE extends FileUploadType>(fileUploadType: TYPE, initialData?: PayloadForFileUploadType<TYPE>): Promise<ResponseForFileUploadType<TYPE> | undefined>;
8
40
  }
package/dist/types.d.ts CHANGED
@@ -25,15 +25,36 @@ export interface UserData {
25
25
  uuid: string;
26
26
  username: string;
27
27
  }
28
+ /**
29
+ * The minimum {@link FalconApi.data} every UI extension receives from the Falcon Console.
30
+ */
28
31
  export interface LocalData {
29
32
  app: {
30
33
  id: string;
31
34
  };
35
+ /**
36
+ * Details of the currently signed in user
37
+ */
32
38
  user: UserData;
39
+ /**
40
+ * The current light or dark mode in the Falcon Console
41
+ */
33
42
  theme: Theme;
43
+ /**
44
+ * Current customer ID
45
+ */
34
46
  cid: string;
47
+ /**
48
+ * The locale of the current user, e.g. 'en-us'
49
+ */
35
50
  locale: string;
51
+ /**
52
+ * Timezone of the current user, e.g. 'America/New_York'
53
+ */
36
54
  timezone?: string;
55
+ /**
56
+ * The date format preferred by the current user, in a [`moment.js` format](https://momentjs.com/docs/#/displaying/format/)
57
+ */
37
58
  dateFormat?: string;
38
59
  [key: string]: unknown;
39
60
  }
@@ -130,8 +151,17 @@ export interface CollectionResponseMessage extends BaseMessage {
130
151
  }
131
152
  export interface OpenModalOptions {
132
153
  path?: string;
154
+ /**
155
+ * additional local data to pass to the modal's extension
156
+ */
133
157
  data?: Record<string, unknown>;
158
+ /**
159
+ * Vertical alignment of the modal, "top" or undefined (Default is center)
160
+ */
134
161
  align?: 'top';
162
+ /**
163
+ * Width of the modal (Default is "md")
164
+ */
135
165
  size?: 'sm' | 'md' | 'lg' | 'xl';
136
166
  }
137
167
  export interface OpenModalRequestMessage extends BaseMessage {
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type FalconPublicApis from './apis/public-api';
1
+ import FalconApi from 'api';
2
2
  import type { LocalData, MessageEnvelope, ResponseMessage } from './types';
3
- export declare function assertConnection(falcon: FalconPublicApis): void;
3
+ export declare function assertConnection<DATA extends LocalData>(falcon: FalconApi<DATA>): void;
4
4
  export declare function isValidResponse<DATA extends LocalData>(event: MessageEvent<MessageEnvelope<ResponseMessage<DATA>> | any>): event is MessageEvent<MessageEnvelope<ResponseMessage<DATA>>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdstrike/foundry-js",
3
- "version": "0.8.2",
3
+ "version": "0.10.0",
4
4
  "description": "foundry.js is the JavaScript SDK for authoring UI Extensions for CrowdStrike's Foundry platform.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,77 +0,0 @@
1
- /**
2
- *
3
- * This file is autogenerated.
4
- *
5
- * DO NOT EDIT DIRECTLY
6
- *
7
- **/
8
- import type { Bridge } from '../../bridge';
9
- import type { ApiResponsePayload, BaseApiRequestMessage, BaseApiResponseMessage, BaseUrlParams, QueryParam } from '../../types';
10
- export type ActorsRequestApi = 'actors';
11
- export type CommonApiResponseMessage = BaseApiResponseMessage<ApiResponsePayload>;
12
- export interface CommonApiRequestMessage extends BaseApiRequestMessage<BaseUrlParams, unknown> {
13
- api: ActorsRequestApi;
14
- }
15
- export interface GetEntitiesActorsGetV2QueryParams extends BaseUrlParams {
16
- ids?: QueryParam;
17
- }
18
- export type GetEntitiesActorsGetV2ApiResponse = ApiResponsePayload;
19
- export type GetEntitiesActorsGetV2ResponseMessage = BaseApiResponseMessage<GetEntitiesActorsGetV2ApiResponse>;
20
- export interface GetEntitiesActorsGetV2RequestMessage extends BaseApiRequestMessage<GetEntitiesActorsGetV2QueryParams> {
21
- api: ActorsRequestApi;
22
- method: 'getEntitiesActorsGetV2';
23
- }
24
- export interface GetQueriesActorsV2QueryParams extends BaseUrlParams {
25
- filter?: string;
26
- limit?: QueryParam;
27
- offset?: QueryParam;
28
- q?: QueryParam;
29
- sort?: QueryParam;
30
- }
31
- export type GetQueriesActorsV2ApiResponse = ApiResponsePayload;
32
- export type GetQueriesActorsV2ResponseMessage = BaseApiResponseMessage<GetQueriesActorsV2ApiResponse>;
33
- export interface GetQueriesActorsV2RequestMessage extends BaseApiRequestMessage<GetQueriesActorsV2QueryParams> {
34
- api: ActorsRequestApi;
35
- method: 'getQueriesActorsV2';
36
- }
37
- export type PostAggregatesActorsGetV2QueryParams = BaseUrlParams;
38
- export type PostAggregatesActorsGetV2ApiResponse = ApiResponsePayload;
39
- export interface PostAggregatesActorsGetV2PostData {
40
- }
41
- export type PostAggregatesActorsGetV2ResponseMessage = BaseApiResponseMessage<PostAggregatesActorsGetV2ApiResponse>;
42
- export interface PostAggregatesActorsGetV2RequestMessage extends BaseApiRequestMessage<PostAggregatesActorsGetV2QueryParams, PostAggregatesActorsGetV2PostData> {
43
- api: ActorsRequestApi;
44
- method: 'postAggregatesActorsGetV2';
45
- }
46
- export interface PostEntitiesActorsGetV2QueryParams extends BaseUrlParams {
47
- ids?: QueryParam;
48
- }
49
- export type PostEntitiesActorsGetV2ApiResponse = ApiResponsePayload;
50
- export interface PostEntitiesActorsGetV2PostData {
51
- }
52
- export type PostEntitiesActorsGetV2ResponseMessage = BaseApiResponseMessage<PostEntitiesActorsGetV2ApiResponse>;
53
- export interface PostEntitiesActorsGetV2RequestMessage extends BaseApiRequestMessage<PostEntitiesActorsGetV2QueryParams, PostEntitiesActorsGetV2PostData> {
54
- api: ActorsRequestApi;
55
- method: 'postEntitiesActorsGetV2';
56
- }
57
- export type PostEntitiesMitreV1QueryParams = BaseUrlParams;
58
- export type PostEntitiesMitreV1ApiResponse = ApiResponsePayload;
59
- export interface PostEntitiesMitreV1PostData {
60
- }
61
- export type PostEntitiesMitreV1ResponseMessage = BaseApiResponseMessage<PostEntitiesMitreV1ApiResponse>;
62
- export interface PostEntitiesMitreV1RequestMessage extends BaseApiRequestMessage<PostEntitiesMitreV1QueryParams, PostEntitiesMitreV1PostData> {
63
- api: ActorsRequestApi;
64
- method: 'postEntitiesMitreV1';
65
- }
66
- export type ActorsApiRequestMessage = GetEntitiesActorsGetV2RequestMessage | GetQueriesActorsV2RequestMessage | PostAggregatesActorsGetV2RequestMessage | PostEntitiesActorsGetV2RequestMessage | PostEntitiesMitreV1RequestMessage;
67
- export type ActorsApiResponseMessage = GetEntitiesActorsGetV2ResponseMessage | GetQueriesActorsV2ResponseMessage | PostAggregatesActorsGetV2ResponseMessage | PostEntitiesActorsGetV2ResponseMessage | PostEntitiesMitreV1ResponseMessage;
68
- export declare class ActorsApiBridge {
69
- private bridge;
70
- constructor(bridge: Bridge);
71
- getBridge(): Bridge<import("../../types").LocalData>;
72
- getEntitiesActorsGetV2(urlParams?: GetEntitiesActorsGetV2QueryParams): Promise<GetEntitiesActorsGetV2ApiResponse>;
73
- getQueriesActorsV2(urlParams?: GetQueriesActorsV2QueryParams): Promise<GetQueriesActorsV2ApiResponse>;
74
- postAggregatesActorsGetV2(postBody: PostAggregatesActorsGetV2PostData, urlParams?: PostAggregatesActorsGetV2QueryParams): Promise<PostAggregatesActorsGetV2ApiResponse>;
75
- postEntitiesActorsGetV2(postBody: PostEntitiesActorsGetV2PostData, urlParams?: PostEntitiesActorsGetV2QueryParams): Promise<PostEntitiesActorsGetV2ApiResponse>;
76
- postEntitiesMitreV1(postBody: PostEntitiesMitreV1PostData, urlParams?: PostEntitiesMitreV1QueryParams): Promise<PostEntitiesMitreV1ApiResponse>;
77
- }