@edraj/tsdmart 2.4.0 → 2.5.1

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 (2) hide show
  1. package/dmart.service.ts +14 -6
  2. package/package.json +1 -1
package/dmart.service.ts CHANGED
@@ -224,6 +224,8 @@ export class Dmart {
224
224
  }
225
225
  }
226
226
 
227
+
228
+
227
229
  public static async upload_with_payload(
228
230
  space_name: string,
229
231
  subpath: string,
@@ -340,10 +342,10 @@ export class Dmart {
340
342
  ext: string | null = null,
341
343
  scope: string = "managed"
342
344
  ) {
343
- return `/${scope}/payload/${resource_type}/${space_name}/${subpath.replace(
345
+ return `${axios.defaults.baseURL}/${scope}/payload/${resource_type}/${space_name}/${subpath.replace(
344
346
  /\/+$/,
345
347
  ""
346
- )}/${parent_shortname}/${shortname}${ext === null ? "" : ext}`;
348
+ )}/${parent_shortname}/${shortname}${ext === null ? "" : `.${ext}`}`;
347
349
  }
348
350
 
349
351
  public static async get_space_health(space_name: string) {
@@ -363,14 +365,20 @@ export class Dmart {
363
365
  space_name: string,
364
366
  subpath: string,
365
367
  shortname: string,
366
- schemaShortname: string = "",
367
- ext: string = ".json",
368
+ schemaShortname: string|null = null,
369
+ ext: string = "json",
368
370
  scope: string = "managed"
369
371
  ) {
370
372
  try {
373
+ let url = `${scope}/payload/${resource_type}/${space_name}/${subpath}/${shortname}`;
374
+
375
+ if(schemaShortname){
376
+ url += `.${schemaShortname}`
377
+ }
378
+ url += `.${ext}`
371
379
  const { data } = await axios.get<any>(
372
- `${scope}/payload/${resource_type}/${space_name}/${subpath}/${shortname}${schemaShortname}${ext}`,
373
- { headers }
380
+ url,
381
+ { headers }
374
382
  );
375
383
  return data;
376
384
  } catch (error: any) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edraj/tsdmart",
3
- "version": "2.4.0",
3
+ "version": "2.5.1",
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",