totalum-api-sdk 2.0.21 → 2.0.22
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/README.MD +520 -520
- package/dist/common/endpoints.js +44 -44
- package/dist/common/interfaces.js +3 -3
- package/dist/index.js +58 -58
- package/dist/services/CrudService.js +93 -93
- package/dist/services/FilesService.js +61 -61
- package/dist/services/FilterService.js +49 -49
- package/dist/services/GoogleService.js +53 -53
- package/dist/services/OpenaiService.js +62 -62
- package/dist/totalum-styles.css +73 -1779
- package/dist/utils.js +13 -13
- package/package.json +28 -28
- package/dist/common/endpoints.d.ts +0 -40
- package/dist/common/interfaces.d.ts +0 -73
- package/dist/index.d.ts +0 -18
- package/dist/services/CrudService.d.ts +0 -35
- package/dist/services/FilesService.d.ts +0 -20
- package/dist/services/FilterService.d.ts +0 -8
- package/dist/services/GoogleService.d.ts +0 -15
- package/dist/services/OpenaiService.d.ts +0 -38
- package/dist/utils.d.ts +0 -3
package/dist/utils.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UtilsService = void 0;
|
|
4
|
-
class UtilsService {
|
|
5
|
-
static getUrl(baseUrl, pattern, params) {
|
|
6
|
-
let url = baseUrl + pattern;
|
|
7
|
-
for (const key in params) {
|
|
8
|
-
url = url.replace(`:${key}`, params[key]);
|
|
9
|
-
}
|
|
10
|
-
return url;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.UtilsService = UtilsService;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UtilsService = void 0;
|
|
4
|
+
class UtilsService {
|
|
5
|
+
static getUrl(baseUrl, pattern, params) {
|
|
6
|
+
let url = baseUrl + pattern;
|
|
7
|
+
for (const key in params) {
|
|
8
|
+
url = url.replace(`:${key}`, params[key]);
|
|
9
|
+
}
|
|
10
|
+
return url;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.UtilsService = UtilsService;
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "totalum-api-sdk",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "Totalum sdk wrapper and utils of totalum api",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "tsc; npx webpack"
|
|
12
|
-
},
|
|
13
|
-
"author": "Totalum",
|
|
14
|
-
"license": "ISC",
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@types/qs": "^6.9.7",
|
|
17
|
-
"ts-loader": "^9.5.0",
|
|
18
|
-
"typescript": "^5.1.3",
|
|
19
|
-
"webpack": "^5.89.0",
|
|
20
|
-
"webpack-cli": "^5.1.4"
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@types/axios": "^0.14.0",
|
|
24
|
-
"axios": "^1.4.0",
|
|
25
|
-
"openai": "^4.4.0",
|
|
26
|
-
"qs": "^6.11.2"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "totalum-api-sdk",
|
|
3
|
+
"version": "2.0.22",
|
|
4
|
+
"description": "Totalum sdk wrapper and utils of totalum api",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc; npx webpack"
|
|
12
|
+
},
|
|
13
|
+
"author": "Totalum",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/qs": "^6.9.7",
|
|
17
|
+
"ts-loader": "^9.5.0",
|
|
18
|
+
"typescript": "^5.1.3",
|
|
19
|
+
"webpack": "^5.89.0",
|
|
20
|
+
"webpack-cli": "^5.1.4"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@types/axios": "^0.14.0",
|
|
24
|
+
"axios": "^1.4.0",
|
|
25
|
+
"openai": "^4.4.0",
|
|
26
|
+
"qs": "^6.11.2"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export declare const endpoints: {
|
|
2
|
-
crud: {
|
|
3
|
-
getObjectById: string;
|
|
4
|
-
getObjects: string;
|
|
5
|
-
createObject: string;
|
|
6
|
-
editObjectProperties: string;
|
|
7
|
-
deleteObject: string;
|
|
8
|
-
deleteObjectAndSubElements: string;
|
|
9
|
-
updateLastUsersActions: string;
|
|
10
|
-
addManyToManyReference: string;
|
|
11
|
-
dropManyToManyReference: string;
|
|
12
|
-
getManyToManyReferencesItems: string;
|
|
13
|
-
};
|
|
14
|
-
files: {
|
|
15
|
-
uploadFile: string;
|
|
16
|
-
getDownloadUrl: string;
|
|
17
|
-
deleteFile: string;
|
|
18
|
-
ocrOfImage: string;
|
|
19
|
-
ocrOfPdf: string;
|
|
20
|
-
};
|
|
21
|
-
filter: {
|
|
22
|
-
lookUpFilter: string;
|
|
23
|
-
customMongoFilter: string;
|
|
24
|
-
runCustomAggregationQuery: string;
|
|
25
|
-
};
|
|
26
|
-
pdfTemplate: {
|
|
27
|
-
generatePdfByTemplate: string;
|
|
28
|
-
};
|
|
29
|
-
googleIntegration: {
|
|
30
|
-
getEmails: string;
|
|
31
|
-
sendEmail: string;
|
|
32
|
-
getCalendarEvents: string;
|
|
33
|
-
createCalendarEvent: string;
|
|
34
|
-
};
|
|
35
|
-
openai: {
|
|
36
|
-
createCompletion: string;
|
|
37
|
-
createChatCompletion: string;
|
|
38
|
-
generateImage: string;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
export interface StructureLevels {
|
|
2
|
-
id: string;
|
|
3
|
-
typeId: string;
|
|
4
|
-
propertyId?: string;
|
|
5
|
-
children: Array<StructureLevels>;
|
|
6
|
-
}
|
|
7
|
-
export interface FilterSearchQueryI {
|
|
8
|
-
filter?: FiltersArrayI;
|
|
9
|
-
sort?: ISearchQuerySort;
|
|
10
|
-
pagination?: {
|
|
11
|
-
limit?: number;
|
|
12
|
-
page?: number;
|
|
13
|
-
skip?: number;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export type FilterLookupSearchQueryI = {
|
|
17
|
-
pagination: {
|
|
18
|
-
limit?: number;
|
|
19
|
-
page?: number;
|
|
20
|
-
skip?: number;
|
|
21
|
-
};
|
|
22
|
-
filters: FilterStructureLevelsI;
|
|
23
|
-
};
|
|
24
|
-
export interface FilterStructureLevelsI extends StructureLevels {
|
|
25
|
-
filters?: FiltersArrayI;
|
|
26
|
-
children: FilterStructureLevelsI[];
|
|
27
|
-
}
|
|
28
|
-
export type FiltersArrayI = Array<ISearchQueryFilterOr | ISearchQueryFilterOptions>;
|
|
29
|
-
export interface ISearchQueryFilterOr {
|
|
30
|
-
or: ISearchQueryFilterOptions[];
|
|
31
|
-
}
|
|
32
|
-
export interface ISearchQuerySort {
|
|
33
|
-
[key: string]: 1 | -1;
|
|
34
|
-
}
|
|
35
|
-
export interface ISearchQueryFilterOptions {
|
|
36
|
-
[key: string]: number | Date | boolean | string | PropertyQueryOptionsI;
|
|
37
|
-
}
|
|
38
|
-
export interface PropertyQueryOptionsI {
|
|
39
|
-
regex?: number | string;
|
|
40
|
-
options?: 'i' | 'm' | 'x' | 's';
|
|
41
|
-
gte?: number | Date;
|
|
42
|
-
lte?: number | Date;
|
|
43
|
-
gt?: number | Date;
|
|
44
|
-
lt?: number | Date;
|
|
45
|
-
}
|
|
46
|
-
export type fieldValuesEnabled = string | number | boolean | Date | {
|
|
47
|
-
name: string;
|
|
48
|
-
} | {
|
|
49
|
-
lastUsersActions?: {
|
|
50
|
-
[key: string]: any;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
export interface DataValues {
|
|
54
|
-
_id: string;
|
|
55
|
-
createdAt: Date;
|
|
56
|
-
updatedAt: Date;
|
|
57
|
-
[key: string]: fieldValuesEnabled;
|
|
58
|
-
}
|
|
59
|
-
export interface DataProperties {
|
|
60
|
-
[key: string]: fieldValuesEnabled | {
|
|
61
|
-
name: string;
|
|
62
|
-
previousFilename: string;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
export interface AuthOptions {
|
|
66
|
-
token?: {
|
|
67
|
-
accessToken: string;
|
|
68
|
-
};
|
|
69
|
-
apiKey?: {
|
|
70
|
-
'api-key': string;
|
|
71
|
-
};
|
|
72
|
-
baseUrl?: string;
|
|
73
|
-
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AuthOptions } from './common/interfaces';
|
|
2
|
-
import { OpenaiService } from './services/OpenaiService';
|
|
3
|
-
import { FilterService } from './services/FilterService';
|
|
4
|
-
import { FilesService } from './services/FilesService';
|
|
5
|
-
import { CrudService } from './services/CrudService';
|
|
6
|
-
export * from './common/interfaces';
|
|
7
|
-
export declare class TotalumApiSdk {
|
|
8
|
-
private authOptions;
|
|
9
|
-
private _baseUrl;
|
|
10
|
-
private _headers;
|
|
11
|
-
openai: OpenaiService;
|
|
12
|
-
files: FilesService;
|
|
13
|
-
filter: FilterService;
|
|
14
|
-
crud: CrudService;
|
|
15
|
-
constructor(authOptions: AuthOptions);
|
|
16
|
-
changeBaseUrl(newBaseUrl: string): void;
|
|
17
|
-
private setRequestData;
|
|
18
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { FilterSearchQueryI, DataProperties } from "../common/interfaces";
|
|
2
|
-
export declare class CrudService {
|
|
3
|
-
private headers;
|
|
4
|
-
private baseUrl;
|
|
5
|
-
constructor(baseUrl: string, headers: any);
|
|
6
|
-
getItemById(itemType: string, id: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
7
|
-
getItems(itemType: string, query?: FilterSearchQueryI): Promise<import("axios").AxiosResponse<any, any>>;
|
|
8
|
-
deleteItemById(itemType: string, id: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
9
|
-
editItemById(itemType: string, id: string, properties: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
10
|
-
createItem(itemType: string, item: DataProperties): Promise<import("axios").AxiosResponse<any, any>>;
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param typeId the type id of the item (table name)
|
|
14
|
-
* @param id the id of the item that we want to add a many to many reference
|
|
15
|
-
* @param propertyId the property that we want to add a many to many reference
|
|
16
|
-
* @param referenceId the id of the item that we want to add as a many to many reference
|
|
17
|
-
*/
|
|
18
|
-
addManyToManyReferenceItem(type: string, id: string, propertyName: string, referenceId: string): Promise<any>;
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @param typeId the type id of the item (table name)
|
|
22
|
-
* @param id the id of the item that we want to drop a many to many reference
|
|
23
|
-
* @param propertyId the property that we want to drop a many to many reference
|
|
24
|
-
* @param referenceId the id of the item that we want to drop as a many to many reference
|
|
25
|
-
*/
|
|
26
|
-
dropManyToManyReferenceItem(type: string, id: string, propertyName: string, referenceId: string): Promise<any>;
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
* @param typeId the type id of the item (table name)
|
|
30
|
-
* @param id the id of the item that we want to get many to many references
|
|
31
|
-
* @param propertyName the property that we want to get many to many references
|
|
32
|
-
* @param query the query to filter and sort the results
|
|
33
|
-
*/
|
|
34
|
-
getManyToManyReferencesItems(type: string, id: string, propertyName: string, query?: FilterSearchQueryI): Promise<any>;
|
|
35
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare class FilesService {
|
|
2
|
-
private headers;
|
|
3
|
-
private baseUrl;
|
|
4
|
-
constructor(baseUrl: string, headers: any);
|
|
5
|
-
uploadFile(fileFormData: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @param fileName
|
|
9
|
-
* @param options options.expirationTime - is the time in milliseconds that the signed URL should be valid for. The default is 128 hours
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
getDownloadUrl(fileName: string, options?: {
|
|
13
|
-
expirationTime?: number;
|
|
14
|
-
}): Promise<import("axios").AxiosResponse<any, any>>;
|
|
15
|
-
generatePdfByTemplate(id: string, variables: {
|
|
16
|
-
[variableName: string]: any;
|
|
17
|
-
}, name: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
18
|
-
ocrOfImage(fileName: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
19
|
-
ocrOfPdf(fileName: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
20
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FilterLookupSearchQueryI } from "../common/interfaces";
|
|
2
|
-
export declare class FilterService {
|
|
3
|
-
private headers;
|
|
4
|
-
private baseUrl;
|
|
5
|
-
constructor(baseUrl: string, headers: any);
|
|
6
|
-
lookUpFilter(idPage: string, query: FilterLookupSearchQueryI, idsOfMultipleNodesToSearch?: string[], returnCount?: boolean): Promise<import("axios").AxiosResponse<any, any>>;
|
|
7
|
-
runCustomMongoAggregationQuery(type: string, customMongoQuery: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
8
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { GoogleCalendarI } from "../common/interfaces";
|
|
2
|
-
export declare class GoogleService {
|
|
3
|
-
private headers;
|
|
4
|
-
private baseUrl;
|
|
5
|
-
constructor(baseUrl: string, headers: any);
|
|
6
|
-
getGoogleAccountEmails(accountEmail: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
7
|
-
googleAccountSendEmail(accountEmail: string, body: {
|
|
8
|
-
to: string;
|
|
9
|
-
subject: string;
|
|
10
|
-
message?: string;
|
|
11
|
-
html?: string;
|
|
12
|
-
}): Promise<import("axios").AxiosResponse<any, any>>;
|
|
13
|
-
getGoogleCalendarEvents(accountEmail: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
14
|
-
createCalendarEvent(accountEmail: string, body: GoogleCalendarI): Promise<import("axios").AxiosResponse<any, any>>;
|
|
15
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { AxiosResponse } from "axios";
|
|
2
|
-
import { Completion } from "openai/resources";
|
|
3
|
-
import { ChatCompletionCreateParamsBase } from "openai/resources/chat/completions";
|
|
4
|
-
import { CompletionCreateParamsBase } from "openai/resources/completions";
|
|
5
|
-
export declare class OpenaiService {
|
|
6
|
-
private headers;
|
|
7
|
-
private baseUrl;
|
|
8
|
-
constructor(baseUrl: string, headers: any);
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* @param body the openai completion body, more info here: https://platform.openai.com/docs/api-reference/completions/create
|
|
12
|
-
* @returns the completion provided by openai api
|
|
13
|
-
* @deprecated use createChatCompletion instead
|
|
14
|
-
*/
|
|
15
|
-
createCompletion(body: CompletionCreateParamsBase): Promise<AxiosResponse<{
|
|
16
|
-
data: Completion;
|
|
17
|
-
}>>;
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param body the openai chat completion body, more info here: https://platform.openai.com/docs/api-reference/chat/create
|
|
21
|
-
* @returns the chat completion provided by openai api
|
|
22
|
-
*/
|
|
23
|
-
createChatCompletion(body: ChatCompletionCreateParamsBase): Promise<AxiosResponse<{
|
|
24
|
-
data: Completion;
|
|
25
|
-
}>>;
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param body the openai chat completion body, more info here: https://platform.openai.com/docs/api-reference/chat/create
|
|
29
|
-
* @returns the chat completion provided by openai api
|
|
30
|
-
*/
|
|
31
|
-
generateImage(body: {
|
|
32
|
-
prompt: string;
|
|
33
|
-
size: '256x256' | '512x512' | '1024x1024';
|
|
34
|
-
fileName: string;
|
|
35
|
-
}): Promise<AxiosResponse<{
|
|
36
|
-
data: Completion;
|
|
37
|
-
}>>;
|
|
38
|
-
}
|
package/dist/utils.d.ts
DELETED