@interfy/client 0.0.12 → 1.0.0
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 +194 -1
- package/dist/client.d.ts +42 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +217 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +7 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +14 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +8 -15
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -108
- package/dist/index.js.map +1 -0
- package/dist/services/BPMService.d.ts +15 -0
- package/dist/services/BPMService.d.ts.map +1 -0
- package/dist/services/BPMService.js +50 -0
- package/dist/services/BPMService.js.map +1 -0
- package/dist/services/CustomTablesService.d.ts +17 -1
- package/dist/services/CustomTablesService.d.ts.map +1 -0
- package/dist/services/CustomTablesService.js +56 -104
- package/dist/services/CustomTablesService.js.map +1 -0
- package/dist/services/FormFileService.d.ts +8 -1
- package/dist/services/FormFileService.d.ts.map +1 -0
- package/dist/services/FormFileService.js +15 -22
- package/dist/services/FormFileService.js.map +1 -0
- package/dist/services/OrganizationalUnitService.d.ts +9 -0
- package/dist/services/OrganizationalUnitService.d.ts.map +1 -0
- package/dist/services/OrganizationalUnitService.js +20 -0
- package/dist/services/OrganizationalUnitService.js.map +1 -0
- package/dist/services/UserService.d.ts +19 -1
- package/dist/services/UserService.d.ts.map +1 -0
- package/dist/services/UserService.js +49 -19
- package/dist/services/UserService.js.map +1 -0
- package/dist/services/ecm/DocumentService.d.ts +24 -0
- package/dist/services/ecm/DocumentService.d.ts.map +1 -0
- package/dist/services/ecm/DocumentService.js +30 -0
- package/dist/services/ecm/DocumentService.js.map +1 -0
- package/dist/services/ecm/FileService.d.ts +11 -0
- package/dist/services/ecm/FileService.d.ts.map +1 -0
- package/dist/services/ecm/FileService.js +31 -0
- package/dist/services/ecm/FileService.js.map +1 -0
- package/dist/types.d.ts +92 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/{models/authentication.js → types.js} +3 -2
- package/dist/types.js.map +1 -0
- package/package.json +11 -6
- package/dist/models/CustomTable.d.ts +0 -7
- package/dist/models/CustomTable.js +0 -10
- package/dist/models/CustomTableField.d.ts +0 -4
- package/dist/models/CustomTableField.js +0 -8
- package/dist/models/ECM/Document.d.ts +0 -6
- package/dist/models/ECM/Document.js +0 -10
- package/dist/models/ECM/File.d.ts +0 -9
- package/dist/models/ECM/File.js +0 -13
- package/dist/models/User.d.ts +0 -10
- package/dist/models/User.js +0 -14
- package/dist/models/authentication.d.ts +0 -19
- package/dist/services/ECM/DocumentService.d.ts +0 -1
- package/dist/services/ECM/DocumentService.js +0 -46
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export declare enum AuthenticationType {
|
|
2
|
+
Basic = 0,
|
|
3
|
+
OAuthClient = 1
|
|
4
|
+
}
|
|
5
|
+
export interface ClientCredentials {
|
|
6
|
+
client_id: string;
|
|
7
|
+
client_secret: string;
|
|
8
|
+
scope: string;
|
|
9
|
+
}
|
|
10
|
+
export interface BasicCredentials {
|
|
11
|
+
username: string;
|
|
12
|
+
password: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AuthenticationConfig {
|
|
15
|
+
type: AuthenticationType;
|
|
16
|
+
client_credentials?: ClientCredentials;
|
|
17
|
+
basic_credentials?: BasicCredentials;
|
|
18
|
+
}
|
|
19
|
+
export interface User {
|
|
20
|
+
id: number;
|
|
21
|
+
username: string;
|
|
22
|
+
name: string;
|
|
23
|
+
surname: string;
|
|
24
|
+
email: string;
|
|
25
|
+
active: boolean;
|
|
26
|
+
admin: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface CustomTableField {
|
|
29
|
+
name: string;
|
|
30
|
+
}
|
|
31
|
+
export interface CustomTable {
|
|
32
|
+
id: number;
|
|
33
|
+
name: string;
|
|
34
|
+
fields: CustomTableField[];
|
|
35
|
+
}
|
|
36
|
+
export interface CustomTableRow {
|
|
37
|
+
id: number;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
export interface ECMDocument {
|
|
41
|
+
_id: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
folder_id: string;
|
|
44
|
+
template_id?: string;
|
|
45
|
+
fields?: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
export interface ECMFile {
|
|
48
|
+
_id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
hash_name: string;
|
|
51
|
+
file_type: string;
|
|
52
|
+
file_size: number;
|
|
53
|
+
created_by: number;
|
|
54
|
+
}
|
|
55
|
+
export interface RemoteFileConfig {
|
|
56
|
+
remote_path: string;
|
|
57
|
+
name: string;
|
|
58
|
+
file_type: string;
|
|
59
|
+
file_size: number;
|
|
60
|
+
creator?: number;
|
|
61
|
+
legal_validity?: Record<string, unknown>;
|
|
62
|
+
}
|
|
63
|
+
export interface BPMProcess {
|
|
64
|
+
id: number;
|
|
65
|
+
name: string;
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
}
|
|
68
|
+
export interface BPMCase {
|
|
69
|
+
id: number;
|
|
70
|
+
[key: string]: unknown;
|
|
71
|
+
}
|
|
72
|
+
export interface BPMStage {
|
|
73
|
+
id: number;
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
export interface BPMVariable {
|
|
77
|
+
id: number;
|
|
78
|
+
name: string;
|
|
79
|
+
[key: string]: unknown;
|
|
80
|
+
}
|
|
81
|
+
export interface StartCaseData {
|
|
82
|
+
starting_stage: number;
|
|
83
|
+
context?: Record<string, unknown>;
|
|
84
|
+
data?: Record<string, unknown>;
|
|
85
|
+
active?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface OrganizationalUnit {
|
|
88
|
+
id: number;
|
|
89
|
+
name: string;
|
|
90
|
+
[key: string]: unknown;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1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B;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
//
|
|
2
|
+
// Authentication
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.AuthenticationType = void 0;
|
|
5
5
|
var AuthenticationType;
|
|
6
6
|
(function (AuthenticationType) {
|
|
7
7
|
AuthenticationType[AuthenticationType["Basic"] = 0] = "Basic";
|
|
8
8
|
AuthenticationType[AuthenticationType["OAuthClient"] = 1] = "OAuthClient";
|
|
9
|
-
})(AuthenticationType
|
|
9
|
+
})(AuthenticationType || (exports.AuthenticationType = AuthenticationType = {}));
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AAEjB,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,6DAAK,CAAA;IACL,yEAAW,CAAA;AACb,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B"}
|
package/package.json
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interfy/client",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TypeScript client for the Interfy API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
6
7
|
"scripts": {
|
|
7
|
-
"test": "
|
|
8
|
+
"test": "jest",
|
|
8
9
|
"build": "tsc",
|
|
9
10
|
"prepare": "npm run build"
|
|
10
11
|
},
|
|
11
12
|
"author": "",
|
|
12
13
|
"license": "ISC",
|
|
13
14
|
"dependencies": {
|
|
14
|
-
"axios": "^
|
|
15
|
+
"axios": "^1.7.0",
|
|
16
|
+
"form-data": "^4.0.0"
|
|
15
17
|
},
|
|
16
18
|
"repository": "github:interfy/api-client-js",
|
|
17
19
|
"devDependencies": {
|
|
18
|
-
"@types/
|
|
19
|
-
"
|
|
20
|
+
"@types/jest": "^30.0.0",
|
|
21
|
+
"@types/node": "^20.0.0",
|
|
22
|
+
"jest": "^30.2.0",
|
|
23
|
+
"ts-jest": "^29.4.6",
|
|
24
|
+
"typescript": "^5.5.0"
|
|
20
25
|
},
|
|
21
26
|
"files": [
|
|
22
27
|
"dist"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export default class File {
|
|
2
|
-
_id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
hash_name: string;
|
|
5
|
-
file_type: string;
|
|
6
|
-
file_size: number;
|
|
7
|
-
created_by: number;
|
|
8
|
-
constructor(_id: string, name: string, hash_name: string, file_type: string, file_size: number, created_by: number);
|
|
9
|
-
}
|
package/dist/models/ECM/File.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class File {
|
|
4
|
-
constructor(_id, name, hash_name, file_type, file_size, created_by) {
|
|
5
|
-
this._id = _id;
|
|
6
|
-
this.name = name;
|
|
7
|
-
this.hash_name = hash_name;
|
|
8
|
-
this.file_type = file_type;
|
|
9
|
-
this.file_size = file_size;
|
|
10
|
-
this.created_by = created_by;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.default = File;
|
package/dist/models/User.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default class User {
|
|
2
|
-
id: number;
|
|
3
|
-
username: string;
|
|
4
|
-
name: string;
|
|
5
|
-
surname: string;
|
|
6
|
-
email: string;
|
|
7
|
-
active: boolean;
|
|
8
|
-
admin: boolean;
|
|
9
|
-
constructor(id: number, username: string, name: string, surname: string, email: string, active: boolean, admin: boolean);
|
|
10
|
-
}
|
package/dist/models/User.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class User {
|
|
4
|
-
constructor(id, username, name, surname, email, active, admin) {
|
|
5
|
-
this.id = id;
|
|
6
|
-
this.username = username;
|
|
7
|
-
this.name = name;
|
|
8
|
-
this.surname = surname;
|
|
9
|
-
this.email = email;
|
|
10
|
-
this.active = active;
|
|
11
|
-
this.admin = admin;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.default = User;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
interface ClientCredentials {
|
|
2
|
-
client_id: string;
|
|
3
|
-
client_secret: string;
|
|
4
|
-
scope: string;
|
|
5
|
-
}
|
|
6
|
-
interface BasicCredentials {
|
|
7
|
-
username: string;
|
|
8
|
-
password: string;
|
|
9
|
-
}
|
|
10
|
-
export declare enum AuthenticationType {
|
|
11
|
-
Basic = 0,
|
|
12
|
-
OAuthClient = 1
|
|
13
|
-
}
|
|
14
|
-
export interface AuthenticationConfig {
|
|
15
|
-
type: AuthenticationType;
|
|
16
|
-
client_credentials?: ClientCredentials;
|
|
17
|
-
basic_credentials?: BasicCredentials;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const authentication_1 = require("../../models/authentication");
|
|
13
|
-
module.exports = function DocumentService(client) {
|
|
14
|
-
return {
|
|
15
|
-
getDocument(id) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
let endpoint = 'ecm/documents/' + id;
|
|
18
|
-
if (client.authenticationConfig.type == authentication_1.AuthenticationType.OAuthClient) {
|
|
19
|
-
endpoint = 'client/' + endpoint;
|
|
20
|
-
}
|
|
21
|
-
let response = yield client.makeRequest('GET', endpoint);
|
|
22
|
-
return response.data;
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
createDocument(data) {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
let endpoint = 'ecm/documents';
|
|
28
|
-
if (client.authenticationConfig.type == authentication_1.AuthenticationType.OAuthClient) {
|
|
29
|
-
endpoint = 'client/' + endpoint;
|
|
30
|
-
}
|
|
31
|
-
let response = yield client.makeRequest('POST', endpoint, data);
|
|
32
|
-
return response.data;
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
updateDocument(document, data) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
let endpoint = 'ecm/documents/' + document._id;
|
|
38
|
-
if (client.authenticationConfig.type == authentication_1.AuthenticationType.OAuthClient) {
|
|
39
|
-
endpoint = 'client/' + endpoint;
|
|
40
|
-
}
|
|
41
|
-
let response = yield client.makeRequest('PUT', endpoint, data);
|
|
42
|
-
return response.data;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
};
|