@edraj/tsdmart 2.3.0 → 2.3.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.
package/client.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import axios, { AxiosInstance, CreateAxiosDefaults } from "axios";
2
2
  import { Config } from "./config";
3
3
  import {
4
- ActionRequest,
5
- ClientError,
6
- ContentType,
7
- QueryRequest,
8
- ResourceType,
4
+ ActionRequest,
5
+ ClientError,
6
+ ContentType,
7
+ QueryRequest,
8
+ ResourceType,
9
9
  } from "./dmart.model";
10
10
  import { get_profile, login, logout } from "./services/auth";
11
11
  import { query, retrieve_entry } from "./services/query";
@@ -105,8 +105,10 @@ export class DmartClient {
105
105
  spaceName: string,
106
106
  schemaShortname: string,
107
107
  subpath: string,
108
- record: any
108
+ record: any,
109
+ resourceType?: string,
110
+ workflowShortname?: string
109
111
  ) {
110
- return submit(this.client, spaceName, schemaShortname, subpath, record);
112
+ return submit(this.client, spaceName, schemaShortname, subpath, record, resourceType, workflowShortname);
111
113
  }
112
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edraj/tsdmart",
3
- "version": "2.3.0",
3
+ "version": "2.3.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",
@@ -12,18 +12,43 @@ export const request = async (
12
12
  return res?.data;
13
13
  };
14
14
 
15
- // this is useless
15
+ // export const submit = async (
16
+ // client: AxiosInstance,
17
+ // spaceName: string,
18
+ // schemaShortname: string,
19
+ // subpath: string,
20
+ // record: any
21
+ // ) => {
22
+ // const { data } = await client.post(
23
+ // `public/submit/${spaceName}/${schemaShortname}/${subpath}`,
24
+ // record,
25
+ // { headers: Config.headers }
26
+ // );
27
+ // return data;
28
+ // };
29
+
30
+
16
31
  export const submit = async (
17
32
  client: AxiosInstance,
18
33
  spaceName: string,
19
34
  schemaShortname: string,
20
35
  subpath: string,
21
- record: any
36
+ record: any,
37
+ resourceType?: string,
38
+ workflowShortname?: string,
22
39
  ) => {
40
+ let url = `public/submit/${spaceName}`;
41
+ if (resourceType) {
42
+ url += `/${resourceType}`;
43
+ }
44
+ if (workflowShortname) {
45
+ url += `/${workflowShortname}`;
46
+ }
47
+ url += `/${schemaShortname}/${subpath}`;
23
48
  const { data } = await client.post(
24
- `public/submit/${spaceName}/${schemaShortname}/${subpath}`,
49
+ url,
25
50
  record,
26
51
  { headers: Config.headers }
27
52
  );
28
53
  return data;
29
- };
54
+ };