@edraj/tsdmart 1.0.9 → 1.0.10

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/README.md +2 -1
  2. package/index.ts +9 -6
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -4,7 +4,8 @@ A TypeScript implementation of the Dmart that depends on axios.
4
4
 
5
5
  ## APIs
6
6
 
7
- * `login(shortname: string, password: string) -> Promise<ApiResponse>` - Performs a login action.
7
+ * `login(shortname: string, password: string) -> Promise<ApiResponse>` - Performs a login action (shortname).
8
+ * `loginBy(credentials: dict, password: string) -> Promise<ApiResponse>` - Performs a login action but altering the default identifier that you can customise.
8
9
  * `logout() -> Promise<ApiResponse>` - Performs a logout action.
9
10
  * `create_user(request: any) -> Promise<ActionResponse>` - Creates a new user.
10
11
  * `update_user(request: any) -> Promise<ActionResponse>` - Updates an existing user.
package/index.ts CHANGED
@@ -121,6 +121,8 @@ export enum QueryType {
121
121
  spaces = "spaces",
122
122
  counters = "counters",
123
123
  reports = "reports",
124
+ attachments = "attachments",
125
+ attachments_aggregation = "attachments_aggregation"
124
126
  }
125
127
 
126
128
  export enum SortyType {
@@ -327,12 +329,13 @@ export default class Dmart {
327
329
  const {data} = await axios.post<
328
330
  ApiResponse & { records: Array<LoginResponseRecord> }
329
331
  >(this.baseURL + "/user/login", {shortname, password}, {headers});
330
- //console.log(JSON.stringify(data, null, 2));
331
- // FIXME settins Authorization is only needed when the code is running on the server
332
- /*headers.Authorization = "";
333
- if (data.status == Status.success && data.records.length > 0) {
334
- headers.Authorization = "Bearer " + data.records[0].attributes.access_token;
335
- }*/
332
+ return data;
333
+ }
334
+
335
+ public static async loginBy(credentials: any, password: string) {
336
+ const {data} = await axios.post<
337
+ ApiResponse & { records: Array<LoginResponseRecord> }
338
+ >(this.baseURL + "/user/login", {...credentials, password}, {headers});
336
339
  return data;
337
340
  }
338
341
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edraj/tsdmart",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
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",
@@ -21,6 +21,6 @@
21
21
  "typescript": "^5.4.2"
22
22
  },
23
23
  "dependencies": {
24
- "axios": "^1.6.8"
24
+ "axios": "^1.7.9"
25
25
  }
26
26
  }