@dizmo/dcs-client-library 4.0.1 → 4.1.2

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.
@@ -2,11 +2,13 @@ import { CreateNeed, Need, UpdateNeed, UpdateResult } from "../types/types";
2
2
  declare function createNeed(need: CreateNeed): Promise<UpdateResult>;
3
3
  declare function deleteNeed(needId: string): Promise<void>;
4
4
  declare function updateNeed(needId: string, needUpdate: UpdateNeed): Promise<void>;
5
- declare function getNeeds(type: string): Promise<Need[]>;
5
+ declare function getNeed(needId: string): Promise<Need>;
6
+ declare function getNeeds(type?: string): Promise<Need[]>;
6
7
  export declare const needs: {
7
8
  createNeed: typeof createNeed;
8
9
  deleteNeed: typeof deleteNeed;
9
10
  updateNeed: typeof updateNeed;
11
+ getNeed: typeof getNeed;
10
12
  getNeeds: typeof getNeeds;
11
13
  };
12
14
  export {};
@@ -20,10 +20,15 @@ async function updateNeed(needId, needUpdate) {
20
20
  const requestOptions = getRequestOptions("PUT", token, needUpdate);
21
21
  await getData(`/needs/need/${needId}`, requestOptions);
22
22
  }
23
+ async function getNeed(needId) {
24
+ validateString(needId, "Function: getNeed, Value: needId");
25
+ const token = await getToken();
26
+ const requestOptions = getRequestOptions("GET", token);
27
+ return (await getData(`/needs/need/${needId}`, requestOptions));
28
+ }
23
29
  async function getNeeds(type) {
24
- validateString(type, "Function: getNeeds, Value: type");
25
30
  const token = await getToken();
26
- const body = { type };
31
+ const body = { ...(type ? { type } : {}) };
27
32
  const requestOptions = getRequestOptions("POST", token, body);
28
33
  return (await getData(`/needs/getneeds`, requestOptions));
29
34
  }
@@ -31,5 +36,6 @@ export const needs = {
31
36
  createNeed,
32
37
  deleteNeed,
33
38
  updateNeed,
39
+ getNeed,
34
40
  getNeeds
35
41
  };
@@ -25,6 +25,8 @@ export type Filter = {
25
25
  or: Filter[];
26
26
  } | {
27
27
  not: Filter;
28
+ } | {
29
+ in: [string, string[]];
28
30
  } | null;
29
31
  export type AllocationFilter = {
30
32
  root?: Filter;
@@ -405,7 +407,7 @@ export type Need = CreateNeed & {
405
407
  _datatype: "need";
406
408
  };
407
409
  export type GetNeeds = {
408
- type: string;
410
+ type?: string;
409
411
  };
410
412
  export type DeepLResponse = {
411
413
  text: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dizmo/dcs-client-library",
3
- "version": "4.0.1",
3
+ "version": "4.1.2",
4
4
  "description": "A library that allows connection and management of dcs",
5
5
  "source": "source/index.ts",
6
6
  "main": "dist/index.js",