@cemiar/cemiarlink-sdk 1.0.10 → 1.0.11
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 +2 -2
- package/dist/models/epic/Attachment.d.ts +2 -0
- package/dist/services/Admin.d.ts +5 -0
- package/dist/services/Admin.js +21 -0
- package/dist/services/BaseEpicService.d.ts +4 -0
- package/dist/services/BaseEpicService.js +4 -0
- package/dist/services/Epic.d.ts +4 -0
- package/dist/services/Epic.js +4 -0
- package/dist/services/JobEpicService.d.ts +4 -0
- package/dist/services/JobEpicService.js +4 -0
- package/dist/services/Mail.d.ts +4 -0
- package/dist/services/Mail.js +9 -1
- package/dist/services/MultiCarrierScheduleEpicService.d.ts +4 -0
- package/dist/services/MultiCarrierScheduleEpicService.js +4 -0
- package/package.json +37 -37
package/README.md
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
# @cemiar/cemiarlink-sdk
|
|
2
|
-
|
|
1
|
+
# @cemiar/cemiarlink-sdk
|
|
2
|
+
|
package/dist/services/Admin.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ import { FlashPaymentRequest } from "../models/admin/Primaco";
|
|
|
5
5
|
import { Counter } from "../models/admin/Counter";
|
|
6
6
|
import { BusMessagePayload } from "../models/admin/BusMessage";
|
|
7
7
|
import { Email, EmailAws, SendMailResult } from "../models/admin/Email";
|
|
8
|
+
/**
|
|
9
|
+
* AdminService provides administration features for tasks, reports, PDF documents, data extraction, messaging, and emails.
|
|
10
|
+
* It offers methods to interact with the Cemiar admin API for various business operations.
|
|
11
|
+
*/
|
|
8
12
|
export declare class AdminService {
|
|
9
13
|
axiosInstance: AxiosInstance;
|
|
10
14
|
taskId?: string;
|
|
@@ -17,6 +21,7 @@ export declare class AdminService {
|
|
|
17
21
|
extractInsurerFromBase64(payload: ExtractBody): Promise<ExtractInsurerResponse>;
|
|
18
22
|
extractVehicles(payload: object): Promise<any>;
|
|
19
23
|
azureOCRExtraction(payload: object): Promise<AzureOCRResponse[]>;
|
|
24
|
+
getPdfText(fileContentBase64: string, engine?: string, page?: string): Promise<string[]>;
|
|
20
25
|
sendTextMessage(message: string, phoneNumber: string, name: string, enterprise: string | undefined): Promise<void>;
|
|
21
26
|
getModuleConfig(): Promise<any>;
|
|
22
27
|
getReportData<T>(date: string, fileName: string, sheetNumber: number): Promise<T[]>;
|
package/dist/services/Admin.js
CHANGED
|
@@ -9,6 +9,10 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const MissingInfo_1 = require("../exceptions/MissingInfo");
|
|
10
10
|
const Excel_1 = __importDefault(require("../utils/Excel"));
|
|
11
11
|
const AxiosClient_1 = require("../utils/AxiosClient");
|
|
12
|
+
/**
|
|
13
|
+
* AdminService provides administration features for tasks, reports, PDF documents, data extraction, messaging, and emails.
|
|
14
|
+
* It offers methods to interact with the Cemiar admin API for various business operations.
|
|
15
|
+
*/
|
|
12
16
|
class AdminService {
|
|
13
17
|
constructor(adminUrl, headers, taskId) {
|
|
14
18
|
this.taskId = taskId;
|
|
@@ -56,6 +60,23 @@ class AdminService {
|
|
|
56
60
|
const { data: extraction } = await this.axiosInstance.post('pdfReader/azureOCR', payload);
|
|
57
61
|
return extraction.data;
|
|
58
62
|
}
|
|
63
|
+
async getPdfText(fileContentBase64, engine, page) {
|
|
64
|
+
let url = "pdfReader/base64ToText";
|
|
65
|
+
const queryParams = [];
|
|
66
|
+
if (engine && engine !== "") {
|
|
67
|
+
queryParams.push(`engine=${engine}`);
|
|
68
|
+
}
|
|
69
|
+
if (page && page !== "") {
|
|
70
|
+
queryParams.push(`page=${page}`);
|
|
71
|
+
}
|
|
72
|
+
if (queryParams.length > 0) {
|
|
73
|
+
url = `${url}?${queryParams.join("&")}`;
|
|
74
|
+
}
|
|
75
|
+
const response = await this.axiosInstance.post(url, {
|
|
76
|
+
base64: fileContentBase64,
|
|
77
|
+
});
|
|
78
|
+
return response.data;
|
|
79
|
+
}
|
|
59
80
|
async sendTextMessage(message, phoneNumber, name, enterprise) {
|
|
60
81
|
var _a;
|
|
61
82
|
try {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
* BaseEpicService provides common HTTP methods and error handling for Epic API services.
|
|
4
|
+
* It wraps Axios and offers generic get, getOne, put, post, and delete methods for API communication.
|
|
5
|
+
*/
|
|
2
6
|
export declare class BaseEpicService {
|
|
3
7
|
axiosInstance: AxiosInstance;
|
|
4
8
|
constructor(epicUrl: string | undefined, headers: any);
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseEpicService = void 0;
|
|
4
4
|
const AxiosClient_1 = require("../utils/AxiosClient");
|
|
5
|
+
/**
|
|
6
|
+
* BaseEpicService provides common HTTP methods and error handling for Epic API services.
|
|
7
|
+
* It wraps Axios and offers generic get, getOne, put, post, and delete methods for API communication.
|
|
8
|
+
*/
|
|
5
9
|
class BaseEpicService {
|
|
6
10
|
constructor(epicUrl, headers) {
|
|
7
11
|
this.axiosInstance = new AxiosClient_1.AxiosClient(epicUrl, headers).getInstance();
|
package/dist/services/Epic.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ import { Broker } from "../models/epic/Broker";
|
|
|
25
25
|
import { Employee } from "../models/epic/Employee";
|
|
26
26
|
import { CreatePaymentTransaction, CreateTransaction, FinanceTransaction, FinanceTransactionResult, Transaction, TransactionApplyCreditsToDebits } from "../models/epic/Transaction";
|
|
27
27
|
import { Vehicle } from "../models/epic/Vehicle";
|
|
28
|
+
/**
|
|
29
|
+
* EpicService provides methods to interact with the Epic API for activities, attachments, policies, transactions, and more.
|
|
30
|
+
* It extends BaseEpicService and includes job and multi-carrier schedule services for specialized operations.
|
|
31
|
+
*/
|
|
28
32
|
export declare class EpicService extends BaseEpicService {
|
|
29
33
|
job: JobEpicService;
|
|
30
34
|
multiCarrierSchedule: MultiCarrierScheduleEpicService;
|
package/dist/services/Epic.js
CHANGED
|
@@ -5,6 +5,10 @@ const EpicException_1 = require("../exceptions/EpicException");
|
|
|
5
5
|
const BaseEpicService_1 = require("./BaseEpicService");
|
|
6
6
|
const JobEpicService_1 = require("./JobEpicService");
|
|
7
7
|
const MultiCarrierScheduleEpicService_1 = require("./MultiCarrierScheduleEpicService");
|
|
8
|
+
/**
|
|
9
|
+
* EpicService provides methods to interact with the Epic API for activities, attachments, policies, transactions, and more.
|
|
10
|
+
* It extends BaseEpicService and includes job and multi-carrier schedule services for specialized operations.
|
|
11
|
+
*/
|
|
8
12
|
class EpicService extends BaseEpicService_1.BaseEpicService {
|
|
9
13
|
constructor(epicUrl, headers) {
|
|
10
14
|
super(epicUrl, headers);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { BaseEpicService } from "./BaseEpicService";
|
|
2
2
|
import { DirectBillCommission, Reconciliation } from "../models/epic/DirectBillCommission";
|
|
3
|
+
/**
|
|
4
|
+
* JobEpicService provides methods for job-related Epic API operations such as reconciliation and direct bill commission updates.
|
|
5
|
+
* It extends BaseEpicService for common API functionality.
|
|
6
|
+
*/
|
|
3
7
|
export declare class JobEpicService extends BaseEpicService {
|
|
4
8
|
readonly baseUrl = "job";
|
|
5
9
|
reconcile(payload: Reconciliation): Promise<string>;
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.JobEpicService = void 0;
|
|
4
4
|
const BaseEpicService_1 = require("./BaseEpicService");
|
|
5
|
+
/**
|
|
6
|
+
* JobEpicService provides methods for job-related Epic API operations such as reconciliation and direct bill commission updates.
|
|
7
|
+
* It extends BaseEpicService for common API functionality.
|
|
8
|
+
*/
|
|
5
9
|
class JobEpicService extends BaseEpicService_1.BaseEpicService {
|
|
6
10
|
constructor() {
|
|
7
11
|
super(...arguments);
|
package/dist/services/Mail.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ import { EmailReport } from '../models/mail/EmailReport';
|
|
|
5
5
|
import GetEmailReportOptions from '../models/mail/GetEmailReportOptions';
|
|
6
6
|
import { GMailFolder } from '../models/mail/GmailMail';
|
|
7
7
|
import { TransactionWatch } from '../models/mail/TransactionWatchList';
|
|
8
|
+
/**
|
|
9
|
+
* MailService provides email-related features such as sending emails, managing folders, retrieving messages, and handling attachments.
|
|
10
|
+
* It uses Nodemailer and Axios for communication with Gmail and the Cemiar mail API.
|
|
11
|
+
*/
|
|
8
12
|
export declare class MailService {
|
|
9
13
|
user?: string;
|
|
10
14
|
axiosInstance: AxiosInstance;
|
package/dist/services/Mail.js
CHANGED
|
@@ -7,6 +7,10 @@ exports.MailService = void 0;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const nodemailer_1 = __importDefault(require("nodemailer"));
|
|
9
9
|
const AxiosClient_1 = require("../utils/AxiosClient");
|
|
10
|
+
/**
|
|
11
|
+
* MailService provides email-related features such as sending emails, managing folders, retrieving messages, and handling attachments.
|
|
12
|
+
* It uses Nodemailer and Axios for communication with Gmail and the Cemiar mail API.
|
|
13
|
+
*/
|
|
10
14
|
class MailService {
|
|
11
15
|
constructor(mailUrl, headers, user, password) {
|
|
12
16
|
this.axiosInstance = new AxiosClient_1.AxiosClient(mailUrl, headers).getInstance();
|
|
@@ -94,7 +98,11 @@ class MailService {
|
|
|
94
98
|
return textPart ? Buffer.from(textPart.body.data, 'base64').toString('binary') : '';
|
|
95
99
|
}
|
|
96
100
|
extractRecipientEmail(headers) {
|
|
97
|
-
const
|
|
101
|
+
const toHeader = headers.find((header) => header.name === 'To');
|
|
102
|
+
if (!toHeader || typeof toHeader.value !== 'string') {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
const from = toHeader.value;
|
|
98
106
|
const emailPattern = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/;
|
|
99
107
|
const match = from.match(emailPattern);
|
|
100
108
|
return match ? match[0] : null;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { BaseEpicService } from "./BaseEpicService";
|
|
2
2
|
import { MultiCarrierScheduleModel } from "../models/epic/MultiCarrierSchedule";
|
|
3
|
+
/**
|
|
4
|
+
* MultiCarrierScheduleEpicService provides methods to manage multi-carrier schedules via the Epic API.
|
|
5
|
+
* It extends BaseEpicService for common API functionality.
|
|
6
|
+
*/
|
|
3
7
|
export declare class MultiCarrierScheduleEpicService extends BaseEpicService {
|
|
4
8
|
readonly baseUrl = "multiCarrierSchedule";
|
|
5
9
|
getMultiCarrierSchedules(req: MultiCarrierScheduleModel.GetRequest): Promise<MultiCarrierScheduleModel.MultiCarrierSchedule[]>;
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MultiCarrierScheduleEpicService = void 0;
|
|
4
4
|
const BaseEpicService_1 = require("./BaseEpicService");
|
|
5
|
+
/**
|
|
6
|
+
* MultiCarrierScheduleEpicService provides methods to manage multi-carrier schedules via the Epic API.
|
|
7
|
+
* It extends BaseEpicService for common API functionality.
|
|
8
|
+
*/
|
|
5
9
|
class MultiCarrierScheduleEpicService extends BaseEpicService_1.BaseEpicService {
|
|
6
10
|
constructor() {
|
|
7
11
|
super(...arguments);
|
package/package.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@cemiar/cemiarlink-sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "CemiarLink SDK to access CemiarLink API services",
|
|
5
|
-
"engines": {
|
|
6
|
-
"npm": ">=9.5.1",
|
|
7
|
-
"node": ">=18.16.0"
|
|
8
|
-
},
|
|
9
|
-
"author": "Cemiar",
|
|
10
|
-
"license": "ISC",
|
|
11
|
-
"main": "dist/services/Admin.js",
|
|
12
|
-
"module": "./dist/services/Admin.mjs",
|
|
13
|
-
"types": "./dist/services/Admin.d.ts",
|
|
14
|
-
"files": [
|
|
15
|
-
"dist"
|
|
16
|
-
],
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"axios": "^1.13.5",
|
|
19
|
-
"path": "^0.12.7",
|
|
20
|
-
"xlsx": "^0.18.5",
|
|
21
|
-
"nodemailer": "^7.0.11",
|
|
22
|
-
"fs": "^0.0.1-security",
|
|
23
|
-
"@types/nodemailer": "^7.0.11"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"ts-node": "^10.9.2"
|
|
27
|
-
},
|
|
28
|
-
"scripts": {
|
|
29
|
-
"build": "rm -rf dist/ && tsc -p tsconfig.json",
|
|
30
|
-
"buildWindows": "rmdir /s /q dist & tsc -p tsconfig.json"
|
|
31
|
-
},
|
|
32
|
-
"overrides": {
|
|
33
|
-
"xlsx": {
|
|
34
|
-
"sheetjs": "^2.0.0"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@cemiar/cemiarlink-sdk",
|
|
3
|
+
"version": "1.0.11",
|
|
4
|
+
"description": "CemiarLink SDK to access CemiarLink API services",
|
|
5
|
+
"engines": {
|
|
6
|
+
"npm": ">=9.5.1",
|
|
7
|
+
"node": ">=18.16.0"
|
|
8
|
+
},
|
|
9
|
+
"author": "Cemiar",
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"main": "dist/services/Admin.js",
|
|
12
|
+
"module": "./dist/services/Admin.mjs",
|
|
13
|
+
"types": "./dist/services/Admin.d.ts",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"axios": "^1.13.5",
|
|
19
|
+
"path": "^0.12.7",
|
|
20
|
+
"xlsx": "^0.18.5",
|
|
21
|
+
"nodemailer": "^7.0.11",
|
|
22
|
+
"fs": "^0.0.1-security",
|
|
23
|
+
"@types/nodemailer": "^7.0.11"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"ts-node": "^10.9.2"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "rm -rf dist/ && tsc -p tsconfig.json",
|
|
30
|
+
"buildWindows": "rmdir /s /q dist & tsc -p tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
"overrides": {
|
|
33
|
+
"xlsx": {
|
|
34
|
+
"sheetjs": "^2.0.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|