totalum-api-sdk 1.0.0 → 1.0.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.
- package/index.js +1 -1
- package/index.ts +18 -9
- package/package.json +4 -2
package/index.js
CHANGED
|
@@ -44,7 +44,7 @@ const endpoints = {
|
|
|
44
44
|
getObjectById: 'api/v1/crud/:typeId/:id',
|
|
45
45
|
getObjects: 'api/v1/crud/:typeId',
|
|
46
46
|
createObject: 'api/v1/crud/:typeId',
|
|
47
|
-
editObjectProperties: 'api/v1/crud/:typeId/:id
|
|
47
|
+
editObjectProperties: 'api/v1/crud/:typeId/:id',
|
|
48
48
|
deleteObject: 'api/v1/crud/:typeId/:id',
|
|
49
49
|
deleteObjectAndSubElements: 'api/v1/crud/:typeId/:id/:pageId/subelements',
|
|
50
50
|
updateLastUsersActions: 'api/v1/crud/:typeId/:id/lastUsersActions'
|
package/index.ts
CHANGED
|
@@ -39,7 +39,7 @@ export interface ISearchQueryFilterOr {
|
|
|
39
39
|
or: ISearchQueryFilterOptions[]
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
interface ISearchQuerySort{
|
|
42
|
+
export interface ISearchQuerySort{
|
|
43
43
|
[key : string]: 1 | -1
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -64,27 +64,36 @@ export interface DataValues {
|
|
|
64
64
|
typeId: string,
|
|
65
65
|
id: string,
|
|
66
66
|
_id: string,
|
|
67
|
-
properties:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
properties: DataProperties,
|
|
68
|
+
updates?: string,
|
|
69
|
+
createdAt?: Date,
|
|
70
|
+
updatedAt?: Date,
|
|
71
|
+
lastUsersActions?: {
|
|
72
|
+
[key: string]: any
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface DataProperties {
|
|
77
|
+
[key: string] : {
|
|
78
|
+
value: fieldValuesEnabled,
|
|
71
79
|
},
|
|
72
80
|
}
|
|
73
81
|
|
|
82
|
+
|
|
74
83
|
// ENDPOINTS
|
|
75
84
|
const endpoints = {
|
|
76
85
|
crud: {
|
|
77
86
|
getObjectById: 'api/v1/crud/:typeId/:id',
|
|
78
87
|
getObjects: 'api/v1/crud/:typeId',
|
|
79
88
|
createObject: 'api/v1/crud/:typeId',
|
|
80
|
-
editObjectProperties: 'api/v1/crud/:typeId/:id
|
|
89
|
+
editObjectProperties: 'api/v1/crud/:typeId/:id',
|
|
81
90
|
deleteObject: 'api/v1/crud/:typeId/:id',
|
|
82
91
|
deleteObjectAndSubElements: 'api/v1/crud/:typeId/:id/:pageId/subelements',
|
|
83
92
|
updateLastUsersActions: 'api/v1/crud/:typeId/:id/lastUsersActions'
|
|
84
93
|
},
|
|
85
94
|
}
|
|
86
95
|
|
|
87
|
-
interface AuthOptions {
|
|
96
|
+
export interface AuthOptions {
|
|
88
97
|
token?:{
|
|
89
98
|
accessToken: string
|
|
90
99
|
},
|
|
@@ -103,7 +112,7 @@ export class TotalumApiSdk {
|
|
|
103
112
|
this.authOptions = authOptions;
|
|
104
113
|
if (this.authOptions.token?.accessToken){
|
|
105
114
|
this.headers = {
|
|
106
|
-
authorization: '
|
|
115
|
+
authorization: 'Bearer ' + this.authOptions.token.accessToken
|
|
107
116
|
}
|
|
108
117
|
} else if(this.authOptions.apiKey?.apiKey && this.authOptions.apiKey?.organizationId) {
|
|
109
118
|
this.headers = {
|
|
@@ -139,7 +148,7 @@ export class TotalumApiSdk {
|
|
|
139
148
|
return axios.patch(url, properties, {headers: this.headers});
|
|
140
149
|
}
|
|
141
150
|
|
|
142
|
-
public async createItem(itemType:string, item:
|
|
151
|
+
public async createItem(itemType:string, item:DataProperties){
|
|
143
152
|
const url = this.getUrl(endpoints.crud.createObject, {typeId: itemType});
|
|
144
153
|
return axios.post(url, item, {headers: this.headers});
|
|
145
154
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "totalum-api-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Totalum sdk wraper of totalum api",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build":"tsc"
|
|
8
|
+
},
|
|
7
9
|
"author": "Totalum",
|
|
8
10
|
"license": "ISC",
|
|
9
11
|
"devDependencies": {
|