@edraj/tsdmart 1.0.10 → 1.0.12

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/index.ts +17 -18
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
+ ## 1.0.10
2
+
3
+ - Implementing DMART apis up to TBD
4
+
1
5
  ## 1.0.8
2
6
 
3
- - Implementing DMART apis up to 1.1.12
7
+ - Implementing DMART apis up to 1.1.x
4
8
 
5
9
  ## 1.0.0
6
10
 
package/index.ts CHANGED
@@ -188,6 +188,7 @@ export enum ResourceType {
188
188
  content = "content",
189
189
  acl = "acl",
190
190
  comment = "comment",
191
+ reaction = "reaction",
191
192
  media = "media",
192
193
  locator = "locator",
193
194
  relationship = "relationship",
@@ -328,20 +329,20 @@ export default class Dmart {
328
329
  public static async login(shortname: string, password: string) {
329
330
  const {data} = await axios.post<
330
331
  ApiResponse & { records: Array<LoginResponseRecord> }
331
- >(this.baseURL + "/user/login", {shortname, password}, {headers});
332
+ >(`${this.baseURL}/user/login`, {shortname, password}, {headers});
332
333
  return data;
333
334
  }
334
335
 
335
336
  public static async loginBy(credentials: any, password: string) {
336
337
  const {data} = await axios.post<
337
338
  ApiResponse & { records: Array<LoginResponseRecord> }
338
- >(this.baseURL + "/user/login", {...credentials, password}, {headers});
339
+ >(`${this.baseURL}/user/login`, {...credentials, password}, {headers});
339
340
  return data;
340
341
  }
341
342
 
342
343
  public static async logout() {
343
344
  const {data} = await axios.post<ApiResponse>(
344
- this.baseURL + "/user/logout",
345
+ `${this.baseURL}/user/logout`,
345
346
  {},
346
347
  {headers}
347
348
  );
@@ -351,7 +352,7 @@ export default class Dmart {
351
352
  public static async create_user(request: any) {
352
353
  try {
353
354
  const {data} = await axios.post<ActionResponse>(
354
- this.baseURL + "/user/create",
355
+ `${this.baseURL}/user/create`,
355
356
  request,
356
357
  {headers}
357
358
  );
@@ -364,7 +365,7 @@ export default class Dmart {
364
365
  public static async update_user(request: any) {
365
366
  try {
366
367
  const {data} = await axios.post<ActionResponse>(
367
- this.baseURL + "/user/profile",
368
+ `${this.baseURL}/user/profile`,
368
369
  request,
369
370
  {headers}
370
371
  );
@@ -389,7 +390,7 @@ export default class Dmart {
389
390
  public static async get_profile() {
390
391
  try {
391
392
  const {data} = await axios.get<ProfileResponse>(
392
- this.baseURL + "/user/profile",
393
+ `${this.baseURL}/user/profile`,
393
394
  {
394
395
  headers,
395
396
  }
@@ -418,7 +419,7 @@ export default class Dmart {
418
419
  }
419
420
  query.subpath = query.subpath.replace(/\/+/g, "/");
420
421
  const {data} = await axios.post<ApiQueryResponse>(
421
- this.baseURL + `/${scope}/query`,
422
+ `${this.baseURL}/${scope}/query`,
422
423
  query,
423
424
  {headers, timeout: 3000}
424
425
  );
@@ -434,7 +435,7 @@ export default class Dmart {
434
435
  query.sort_by = "created_at";
435
436
  query.subpath = query.subpath.replace(/\/+/g, "/");
436
437
  const {data} = await axios.post<ApiQueryResponse>(
437
- this.baseURL + "/managed/csv",
438
+ `${this.baseURL}/managed/csv`,
438
439
  query,
439
440
  {headers}
440
441
  );
@@ -447,7 +448,7 @@ export default class Dmart {
447
448
  public static async space(action: ActionRequest): Promise<ActionResponse> {
448
449
  try {
449
450
  const {data} = await axios.post<ActionResponse>(
450
- this.baseURL + "/managed/space",
451
+ `${this.baseURL}/managed/space`,
451
452
  action,
452
453
  {headers}
453
454
  );
@@ -460,7 +461,7 @@ export default class Dmart {
460
461
  public static async request(action: ActionRequest): Promise<ActionResponse> {
461
462
  try {
462
463
  const {data} = await axios.post<ActionResponse>(
463
- this.baseURL + "/managed/request",
464
+ `${this.baseURL}/managed/request`,
464
465
  action,
465
466
  {headers}
466
467
  );
@@ -482,11 +483,9 @@ export default class Dmart {
482
483
  ): Promise<ResponseEntry | null> {
483
484
  try {
484
485
  if (!subpath || subpath == "/") subpath = "__root__";
486
+ const url = `${this.baseURL}/${scope}/entry/${resource_type}/${space_name}/${subpath}/${shortname}?retrieve_json_payload=${retrieve_json_payload}&retrieve_attachments=${retrieve_attachments}&validate_schema=${validate_schema}`;
485
487
  const {data} = await axios.get<ResponseEntry>(
486
- `${this.baseURL}/${scope}/entry/${resource_type}/${space_name}/${subpath}/${shortname}?retrieve_json_payload=${retrieve_json_payload}&retrieve_attachments=${retrieve_attachments}&validate_schema=${validate_schema}`.replace(
487
- /\/+/g,
488
- "/"
489
- ),
488
+ url.replace(/\/+/g, "/"),
490
489
  {headers}
491
490
  );
492
491
  return data;
@@ -532,7 +531,7 @@ export default class Dmart {
532
531
  const headers = {"Content-Type": "multipart/form-data"};
533
532
 
534
533
  const {data} = await axios.post<ApiResponse>(
535
- this.baseURL + "/managed/resource_with_payload",
534
+ `${this.baseURL}/managed/resource_with_payload`,
536
535
  form_data,
537
536
  {headers}
538
537
  );
@@ -622,7 +621,7 @@ export default class Dmart {
622
621
  public static async get_space_health(space_name: string) {
623
622
  const {data} = await axios.get<
624
623
  ApiQueryResponse & { attributes: { folders_report: Object } }
625
- >(this.baseURL + `/managed/health/${space_name}`, {headers});
624
+ >(`${this.baseURL}/managed/health/${space_name}`, {headers});
626
625
  return data;
627
626
  }
628
627
 
@@ -718,14 +717,14 @@ export default class Dmart {
718
717
  }
719
718
 
720
719
  public static async get_manifest() {
721
- const {data} = await axios.get<any>(this.baseURL + `/info/manifest`, {
720
+ const {data} = await axios.get<any>(`${this.baseURL}/info/manifest`, {
722
721
  headers,
723
722
  });
724
723
  return data;
725
724
  }
726
725
 
727
726
  public static async get_settings() {
728
- const {data} = await axios.get<any>(this.baseURL + `/info/settings`, {
727
+ const {data} = await axios.get<any>(`${this.baseURL}/info/settings`, {
729
728
  headers,
730
729
  });
731
730
  return data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edraj/tsdmart",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "A TypeScript implementation of the Dmart that depends on axios.",
5
5
  "author": "Kefah T. Issa",
6
6
  "email": "kefah.issa@gmail.com",