@crowdstrike/foundry-js 0.5.1 → 0.6.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,5 @@
1
- import type FalconApi from '../api';
2
- import type { LocalData } from '../types';
1
+ import type FalconApi from "../api";
2
+ import type { LocalData } from "../types";
3
3
  interface FunctionDefinition {
4
4
  id: string;
5
5
  version: number;
@@ -11,6 +11,7 @@ interface PostParameters {
11
11
  headers?: Record<string, unknown>;
12
12
  }
13
13
  type PatchParameters = PostParameters;
14
+ type PutParameters = PostParameters;
14
15
  type DeleteParameters = PostParameters;
15
16
  interface GetParameters {
16
17
  path: string;
@@ -23,6 +24,7 @@ export declare class CloudFunction<DATA extends LocalData = LocalData> {
23
24
  static GET: "GET";
24
25
  static POST: "POST";
25
26
  static PATCH: "PATCH";
27
+ static PUT: "PUT";
26
28
  static DELETE: "DELETE";
27
29
  pollTimeout: number;
28
30
  intervalId?: number;
@@ -35,14 +37,16 @@ export declare class CloudFunction<DATA extends LocalData = LocalData> {
35
37
  queryParams: {
36
38
  [x: string]: string[];
37
39
  }[];
38
- get: (queryParams?: GetParameters['queryParams']) => Promise<unknown>;
39
- post: (body: PostParameters['body'], queryParams?: PostParameters['queryParams'], headers?: PostParameters['headers']) => Promise<unknown>;
40
- patch: (body: PatchParameters['body'], queryParams?: PatchParameters['queryParams'], headers?: PatchParameters['headers']) => Promise<unknown>;
41
- delete: (body: DeleteParameters['body'], queryParams?: DeleteParameters['queryParams'], headers?: DeleteParameters['headers']) => Promise<unknown>;
40
+ get: (queryParams?: GetParameters["queryParams"]) => Promise<unknown>;
41
+ post: (body: PostParameters["body"], queryParams?: PostParameters["queryParams"], headers?: PostParameters["headers"]) => Promise<unknown>;
42
+ patch: (body: PatchParameters["body"], queryParams?: PatchParameters["queryParams"], headers?: PatchParameters["headers"]) => Promise<unknown>;
43
+ put: (body: PutParameters["body"], queryParams?: PutParameters["queryParams"], headers?: PutParameters["headers"]) => Promise<unknown>;
44
+ delete: (body: DeleteParameters["body"], queryParams?: DeleteParameters["queryParams"], headers?: DeleteParameters["headers"]) => Promise<unknown>;
42
45
  };
43
46
  get({ path, queryParams, headers }: GetParameters): Promise<unknown>;
44
47
  post({ path, queryParams, body, headers }: PostParameters): Promise<unknown>;
45
48
  patch({ path, queryParams, body, headers }: PatchParameters): Promise<unknown>;
49
+ put({ path, queryParams, body, headers }: PutParameters): Promise<unknown>;
46
50
  delete({ path, queryParams, body, headers }: DeleteParameters): Promise<unknown>;
47
51
  destroy(): void;
48
52
  }
package/dist/index.js CHANGED
@@ -2372,10 +2372,11 @@ class ApiIntegration {
2372
2372
  class CloudFunction {
2373
2373
  falcon;
2374
2374
  definition;
2375
- static GET = 'GET';
2376
- static POST = 'POST';
2377
- static PATCH = 'PATCH';
2378
- static DELETE = 'DELETE';
2375
+ static GET = "GET";
2376
+ static POST = "POST";
2377
+ static PATCH = "PATCH";
2378
+ static PUT = "PUT";
2379
+ static DELETE = "DELETE";
2379
2380
  pollTimeout = 500;
2380
2381
  intervalId;
2381
2382
  constructor(falcon, definition) {
@@ -2435,7 +2436,7 @@ class CloudFunction {
2435
2436
  }, this.pollTimeout);
2436
2437
  }
2437
2438
  path(pathEntry) {
2438
- const urlPath = new URL(pathEntry, 'http://localhost');
2439
+ const urlPath = new URL(pathEntry, "http://localhost");
2439
2440
  const path = urlPath.pathname;
2440
2441
  const searchParams = [...urlPath.searchParams.entries()].map(([key, value]) => ({
2441
2442
  [key]: [value],
@@ -2458,7 +2459,15 @@ class CloudFunction {
2458
2459
  });
2459
2460
  },
2460
2461
  patch: async (body, queryParams = {}, headers = {}) => {
2461
- return this.post({
2462
+ return this.patch({
2463
+ path,
2464
+ queryParams: queryParams ?? searchParams ?? {},
2465
+ body,
2466
+ headers,
2467
+ });
2468
+ },
2469
+ put: async (body, queryParams = {}, headers = {}) => {
2470
+ return this.put({
2462
2471
  path,
2463
2472
  queryParams: queryParams ?? searchParams ?? {},
2464
2473
  body,
@@ -2466,7 +2475,7 @@ class CloudFunction {
2466
2475
  });
2467
2476
  },
2468
2477
  delete: async (body, queryParams = {}, headers = {}) => {
2469
- return this.post({
2478
+ return this.delete({
2470
2479
  path,
2471
2480
  queryParams: queryParams ?? searchParams ?? {},
2472
2481
  body,
@@ -2501,6 +2510,15 @@ class CloudFunction {
2501
2510
  headers,
2502
2511
  });
2503
2512
  }
2513
+ async put({ path, queryParams, body, headers }) {
2514
+ return this.execute({
2515
+ path,
2516
+ method: CloudFunction.PUT,
2517
+ body,
2518
+ queryParams,
2519
+ headers,
2520
+ });
2521
+ }
2504
2522
  async delete({ path, queryParams, body, headers }) {
2505
2523
  return this.execute({
2506
2524
  path,