@cemiar/cemiarlink-sdk 1.0.57 → 1.0.58
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 +651 -651
- package/dist/epic-api/index.d.ts +2 -0
- package/dist/epic-api/index.js +18 -0
- package/dist/epic-api/models/BaseModels.d.ts +34 -0
- package/dist/epic-api/models/BaseModels.js +2 -0
- package/dist/epic-api/models/EpicApiOptions.d.ts +12 -0
- package/dist/epic-api/models/EpicApiOptions.js +2 -0
- package/dist/epic-api/models/epic/Client.d.ts +203 -0
- package/dist/epic-api/models/epic/Client.js +2 -0
- package/dist/epic-api/models/epic/Form.d.ts +113 -0
- package/dist/epic-api/models/epic/Form.js +2 -0
- package/dist/epic-api/models/epic/Line.d.ts +146 -0
- package/dist/epic-api/models/epic/Line.js +2 -0
- package/dist/epic-api/models/epic/Organization.d.ts +31 -0
- package/dist/epic-api/models/epic/Organization.js +2 -0
- package/dist/epic-api/models/epic/Policy.d.ts +111 -0
- package/dist/epic-api/models/epic/Policy.js +2 -0
- package/dist/epic-api/models/epic/index.d.ts +5 -0
- package/dist/epic-api/models/epic/index.js +21 -0
- package/dist/epic-api/models/index.d.ts +3 -0
- package/dist/epic-api/models/index.js +19 -0
- package/dist/epic-api/modules/BaseModule.d.ts +14 -0
- package/dist/epic-api/modules/BaseModule.js +31 -0
- package/dist/epic-api/modules/ClientModule.d.ts +9 -0
- package/dist/epic-api/modules/ClientModule.js +24 -0
- package/dist/epic-api/modules/FormModule.d.ts +8 -0
- package/dist/epic-api/modules/FormModule.js +22 -0
- package/dist/epic-api/modules/PolicyModule.d.ts +11 -0
- package/dist/epic-api/modules/PolicyModule.js +30 -0
- package/dist/epic-api/services/EpicApiService.d.ts +29 -0
- package/dist/epic-api/services/EpicApiService.js +132 -0
- package/dist/epic-api/services/index.d.ts +1 -0
- package/dist/epic-api/services/index.js +17 -0
- package/dist/index.js +7 -17
- package/dist/models/index.js +7 -17
- package/dist/utils/Excel.js +1 -2
- package/package.json +42 -30
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Client"), exports);
|
|
18
|
+
__exportStar(require("./Policy"), exports);
|
|
19
|
+
__exportStar(require("./Form"), exports);
|
|
20
|
+
__exportStar(require("./Organization"), exports);
|
|
21
|
+
__exportStar(require("./Line"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./epic"), exports);
|
|
18
|
+
__exportStar(require("./BaseModels"), exports);
|
|
19
|
+
__exportStar(require("./EpicApiOptions"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Method } from 'axios';
|
|
2
|
+
import { BaseListResponse, ListParams, ListResponse } from '../models/BaseModels';
|
|
3
|
+
export type RequestFn = <T>(method: Method, path: string, data?: any, params?: any, headers?: Record<string, string>) => Promise<T>;
|
|
4
|
+
export declare abstract class BaseModule {
|
|
5
|
+
protected request: RequestFn;
|
|
6
|
+
protected readonly basePath: string;
|
|
7
|
+
protected readonly version: string;
|
|
8
|
+
constructor(request: RequestFn, basePath: string, version: string);
|
|
9
|
+
protected buildPath(endpoint: string): string;
|
|
10
|
+
protected getList<T>(endpoint: string, params?: ListParams): Promise<BaseListResponse<T>>;
|
|
11
|
+
protected getItemById<T>(endpoint: string, id: string): Promise<T>;
|
|
12
|
+
protected create<TPayload, TResponse>(endpoint: string, payload: TPayload): Promise<TResponse>;
|
|
13
|
+
protected toListResponse<T>(response: BaseListResponse<T>): ListResponse<T>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseModule = void 0;
|
|
4
|
+
class BaseModule {
|
|
5
|
+
constructor(request, basePath, version) {
|
|
6
|
+
this.request = request;
|
|
7
|
+
this.basePath = basePath;
|
|
8
|
+
this.version = version;
|
|
9
|
+
}
|
|
10
|
+
buildPath(endpoint) {
|
|
11
|
+
return `${this.basePath}/${this.version}/${endpoint}`;
|
|
12
|
+
}
|
|
13
|
+
async getList(endpoint, params) {
|
|
14
|
+
return this.request('GET', this.buildPath(endpoint), undefined, params);
|
|
15
|
+
}
|
|
16
|
+
async getItemById(endpoint, id) {
|
|
17
|
+
return this.request('GET', `${this.buildPath(endpoint)}/${id}`);
|
|
18
|
+
}
|
|
19
|
+
async create(endpoint, payload) {
|
|
20
|
+
return this.request('POST', this.buildPath(endpoint), payload);
|
|
21
|
+
}
|
|
22
|
+
toListResponse(response) {
|
|
23
|
+
const items = [].concat(...Object.values(response._embedded));
|
|
24
|
+
return {
|
|
25
|
+
items,
|
|
26
|
+
total: response.total,
|
|
27
|
+
links: response._links,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.BaseModule = BaseModule;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ClientFilter, ListResponse, Client, CreateClient, OrganizationFilter, Organization } from '../models';
|
|
2
|
+
import { BaseModule, RequestFn } from './BaseModule';
|
|
3
|
+
export declare class ClientModule extends BaseModule {
|
|
4
|
+
constructor(request: RequestFn);
|
|
5
|
+
getClients(params?: ClientFilter): Promise<ListResponse<Client>>;
|
|
6
|
+
getClientById(id: string): Promise<Client>;
|
|
7
|
+
createClient(data: CreateClient): Promise<Client>;
|
|
8
|
+
getClientOrganizations(clientId: string, params?: OrganizationFilter): Promise<ListResponse<Organization>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientModule = void 0;
|
|
4
|
+
const BaseModule_1 = require("./BaseModule");
|
|
5
|
+
class ClientModule extends BaseModule_1.BaseModule {
|
|
6
|
+
constructor(request) {
|
|
7
|
+
super(request, 'epic/client', 'v1');
|
|
8
|
+
}
|
|
9
|
+
async getClients(params) {
|
|
10
|
+
const response = await this.getList('clients', params);
|
|
11
|
+
return this.toListResponse(response);
|
|
12
|
+
}
|
|
13
|
+
async getClientById(id) {
|
|
14
|
+
return this.getItemById('clients', id);
|
|
15
|
+
}
|
|
16
|
+
async createClient(data) {
|
|
17
|
+
return this.create(`clients`, data);
|
|
18
|
+
}
|
|
19
|
+
async getClientOrganizations(clientId, params) {
|
|
20
|
+
const response = await this.getList(`clients/${clientId}/organizations`, params);
|
|
21
|
+
return this.toListResponse(response);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ClientModule = ClientModule;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SubmissionFormDefinition, SubmissionResponsesResult, UpdateSubmissionResponsesPayload, UpdateSubmissionResponsesResult } from '../models';
|
|
2
|
+
import { BaseModule, RequestFn } from './BaseModule';
|
|
3
|
+
export declare class FormModule extends BaseModule {
|
|
4
|
+
constructor(request: RequestFn);
|
|
5
|
+
getFormDefinition(clientId: string, submissionFormPk: string): Promise<SubmissionFormDefinition>;
|
|
6
|
+
getSubmissionResponses(clientId: string, submissionFormPk: string): Promise<SubmissionResponsesResult>;
|
|
7
|
+
updateSubmissionResponses(clientId: string, submissionFormPk: string, data: UpdateSubmissionResponsesPayload): Promise<UpdateSubmissionResponsesResult>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormModule = void 0;
|
|
4
|
+
const BaseModule_1 = require("./BaseModule");
|
|
5
|
+
class FormModule extends BaseModule_1.BaseModule {
|
|
6
|
+
constructor(request) {
|
|
7
|
+
super(request, 'pdc', 'v1');
|
|
8
|
+
}
|
|
9
|
+
async getFormDefinition(clientId, submissionFormPk) {
|
|
10
|
+
const response = await this.request('GET', `${this.basePath}/pde/clients/${clientId}/fetch-form/${submissionFormPk}`, undefined, undefined);
|
|
11
|
+
return response.content;
|
|
12
|
+
}
|
|
13
|
+
async getSubmissionResponses(clientId, submissionFormPk) {
|
|
14
|
+
const response = await this.request('GET', `${this.basePath}/pde/clients/${clientId}/form/${submissionFormPk}`, undefined, undefined);
|
|
15
|
+
return response.content;
|
|
16
|
+
}
|
|
17
|
+
async updateSubmissionResponses(clientId, submissionFormPk, data) {
|
|
18
|
+
const response = await this.request('POST', `${this.basePath}/pde/clients/${clientId}/form/${submissionFormPk}/bulk-save-responses`, data, undefined);
|
|
19
|
+
return response.content;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.FormModule = FormModule;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PolicyFilter, ListResponse, Policy, CreatePolicy, LineFilter, Line, CreateLine } from '../models';
|
|
2
|
+
import { BaseModule, RequestFn } from './BaseModule';
|
|
3
|
+
export declare class PolicyModule extends BaseModule {
|
|
4
|
+
constructor(request: RequestFn);
|
|
5
|
+
getPolicies(params?: PolicyFilter): Promise<ListResponse<Policy>>;
|
|
6
|
+
getPolicyById(id: string): Promise<Policy>;
|
|
7
|
+
createPolicy(data: CreatePolicy): Promise<Policy>;
|
|
8
|
+
getLines(params?: LineFilter): Promise<ListResponse<Line>>;
|
|
9
|
+
getLineById(id: string): Promise<Line>;
|
|
10
|
+
createLine(data: CreateLine): Promise<Line>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolicyModule = void 0;
|
|
4
|
+
const BaseModule_1 = require("./BaseModule");
|
|
5
|
+
class PolicyModule extends BaseModule_1.BaseModule {
|
|
6
|
+
constructor(request) {
|
|
7
|
+
super(request, '/epic/policy', 'v2');
|
|
8
|
+
}
|
|
9
|
+
async getPolicies(params) {
|
|
10
|
+
const response = await this.getList('policies', params);
|
|
11
|
+
return this.toListResponse(response);
|
|
12
|
+
}
|
|
13
|
+
async getPolicyById(id) {
|
|
14
|
+
return this.getItemById('policies', id);
|
|
15
|
+
}
|
|
16
|
+
async createPolicy(data) {
|
|
17
|
+
return this.create('policies', data);
|
|
18
|
+
}
|
|
19
|
+
async getLines(params) {
|
|
20
|
+
const response = await this.getList('lines', params);
|
|
21
|
+
return this.toListResponse(response);
|
|
22
|
+
}
|
|
23
|
+
async getLineById(id) {
|
|
24
|
+
return this.getItemById('lines', id);
|
|
25
|
+
}
|
|
26
|
+
async createLine(data) {
|
|
27
|
+
return this.create('lines', data);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.PolicyModule = PolicyModule;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EpicApiOptions } from '../models';
|
|
2
|
+
import { ClientModule } from '../modules/ClientModule';
|
|
3
|
+
import { FormModule } from '../modules/FormModule';
|
|
4
|
+
import { PolicyModule } from '../modules/PolicyModule';
|
|
5
|
+
export declare class EpicApiService {
|
|
6
|
+
private cemiarLinkClient;
|
|
7
|
+
private tokenClient;
|
|
8
|
+
private cemiarAuthClient;
|
|
9
|
+
private readonly clientId;
|
|
10
|
+
private readonly clientSecret;
|
|
11
|
+
private readonly accountId;
|
|
12
|
+
private readonly language;
|
|
13
|
+
private readonly apiEnv;
|
|
14
|
+
private epicApiToken;
|
|
15
|
+
private cemiarAuthToken;
|
|
16
|
+
private epicApiTokenPromise;
|
|
17
|
+
private cemiarAuthTokenPromise;
|
|
18
|
+
readonly Client: ClientModule;
|
|
19
|
+
readonly Policy: PolicyModule;
|
|
20
|
+
readonly Form: FormModule;
|
|
21
|
+
constructor(clientId: string, clientSecret: string, accountId: string, options: EpicApiOptions);
|
|
22
|
+
private request;
|
|
23
|
+
private getAccessToken;
|
|
24
|
+
private fetchAccessToken;
|
|
25
|
+
private getCemiarAuthAccessToken;
|
|
26
|
+
private fetchCemiarAuthToken;
|
|
27
|
+
private getEnvUrls;
|
|
28
|
+
private getTokenExpiration;
|
|
29
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EpicApiService = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const ClientModule_1 = require("../modules/ClientModule");
|
|
9
|
+
const FormModule_1 = require("../modules/FormModule");
|
|
10
|
+
const PolicyModule_1 = require("../modules/PolicyModule");
|
|
11
|
+
const DEV_URLS = {
|
|
12
|
+
cemiarLink: 'https://link.cemiar.dev/epic/api',
|
|
13
|
+
cemiarAuth: 'https://www.api.auth.cemiar.dev',
|
|
14
|
+
};
|
|
15
|
+
const PROD_URLS = {
|
|
16
|
+
cemiarLink: 'https://link.cemiar.pro/epic/api',
|
|
17
|
+
cemiarAuth: 'https://api.auth.cemiar.pro',
|
|
18
|
+
};
|
|
19
|
+
class EpicApiService {
|
|
20
|
+
constructor(clientId, clientSecret, accountId, options) {
|
|
21
|
+
var _a, _b, _c, _d, _e;
|
|
22
|
+
this.epicApiToken = null;
|
|
23
|
+
this.cemiarAuthToken = null;
|
|
24
|
+
this.epicApiTokenPromise = null;
|
|
25
|
+
this.cemiarAuthTokenPromise = null;
|
|
26
|
+
this.clientId = clientId;
|
|
27
|
+
this.clientSecret = clientSecret;
|
|
28
|
+
this.accountId = accountId;
|
|
29
|
+
this.language = (_a = options.language) !== null && _a !== void 0 ? _a : 'en-US';
|
|
30
|
+
this.apiEnv = (_b = options.apiEnv) !== null && _b !== void 0 ? _b : 'dev';
|
|
31
|
+
const urls = this.getEnvUrls(options.cemiarLink);
|
|
32
|
+
this.cemiarAuthClient = axios_1.default.create({
|
|
33
|
+
baseURL: urls.cemiarAuth,
|
|
34
|
+
headers: {
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
const cemiarLinkBaseURL = ((_c = options.cemiarLink) === null || _c === void 0 ? void 0 : _c.env) === 'local' ? options.cemiarLink.baseURL : urls.cemiarLink;
|
|
39
|
+
const taskId = ((_d = options.cemiarLink) === null || _d === void 0 ? void 0 : _d.env) !== 'local' ? (_e = options.cemiarLink) === null || _e === void 0 ? void 0 : _e.taskId : undefined;
|
|
40
|
+
this.cemiarLinkClient = axios_1.default.create({
|
|
41
|
+
baseURL: cemiarLinkBaseURL,
|
|
42
|
+
headers: {
|
|
43
|
+
taskId: taskId,
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
'Accept-Language': this.language,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
this.tokenClient = axios_1.default.create({
|
|
49
|
+
baseURL: cemiarLinkBaseURL,
|
|
50
|
+
headers: {
|
|
51
|
+
'Content-Type': 'application/json',
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
this.cemiarLinkClient.interceptors.request.use(async (config) => {
|
|
55
|
+
const accessToken = await this.getAccessToken();
|
|
56
|
+
config.headers['Authorization'] = `Bearer ${accessToken}`;
|
|
57
|
+
return config;
|
|
58
|
+
});
|
|
59
|
+
this.tokenClient.interceptors.request.use(async (config) => {
|
|
60
|
+
const accessToken = await this.getCemiarAuthAccessToken();
|
|
61
|
+
config.headers['Authorization'] = `Bearer ${accessToken}`;
|
|
62
|
+
return config;
|
|
63
|
+
});
|
|
64
|
+
const requestFn = this.request.bind(this);
|
|
65
|
+
this.Form = new FormModule_1.FormModule(requestFn);
|
|
66
|
+
this.Policy = new PolicyModule_1.PolicyModule(requestFn);
|
|
67
|
+
this.Client = new ClientModule_1.ClientModule(requestFn);
|
|
68
|
+
}
|
|
69
|
+
async request(method, path, data, params, headers) {
|
|
70
|
+
const { data: response } = await this.cemiarLinkClient.request({
|
|
71
|
+
method,
|
|
72
|
+
url: path,
|
|
73
|
+
data,
|
|
74
|
+
params,
|
|
75
|
+
headers,
|
|
76
|
+
});
|
|
77
|
+
return response;
|
|
78
|
+
}
|
|
79
|
+
async getAccessToken() {
|
|
80
|
+
if (this.epicApiToken && this.epicApiToken.expiration.getTime() > Date.now()) {
|
|
81
|
+
return this.epicApiToken.accessToken;
|
|
82
|
+
}
|
|
83
|
+
if (!this.epicApiTokenPromise) {
|
|
84
|
+
this.epicApiTokenPromise = this.fetchAccessToken().finally(() => {
|
|
85
|
+
this.epicApiTokenPromise = null;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return this.epicApiTokenPromise;
|
|
89
|
+
}
|
|
90
|
+
async fetchAccessToken() {
|
|
91
|
+
const { data } = await this.tokenClient.post(`/token/${this.apiEnv}/${this.accountId}`);
|
|
92
|
+
this.epicApiToken = {
|
|
93
|
+
accessToken: data.access_token,
|
|
94
|
+
tokenType: data.token_type,
|
|
95
|
+
expiration: this.getTokenExpiration(data.expires_in),
|
|
96
|
+
};
|
|
97
|
+
return this.epicApiToken.accessToken;
|
|
98
|
+
}
|
|
99
|
+
async getCemiarAuthAccessToken() {
|
|
100
|
+
if (this.cemiarAuthToken && this.cemiarAuthToken.expiration.getTime() > Date.now()) {
|
|
101
|
+
return this.cemiarAuthToken.accessToken;
|
|
102
|
+
}
|
|
103
|
+
if (!this.cemiarAuthTokenPromise) {
|
|
104
|
+
this.cemiarAuthTokenPromise = this.fetchCemiarAuthToken().finally(() => {
|
|
105
|
+
this.cemiarAuthTokenPromise = null;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return this.cemiarAuthTokenPromise;
|
|
109
|
+
}
|
|
110
|
+
async fetchCemiarAuthToken() {
|
|
111
|
+
const { data } = await this.cemiarAuthClient.post('auth/service/token', {
|
|
112
|
+
clientId: this.clientId,
|
|
113
|
+
clientSecret: this.clientSecret,
|
|
114
|
+
audiences: ['cemiar'],
|
|
115
|
+
});
|
|
116
|
+
this.cemiarAuthToken = {
|
|
117
|
+
accessToken: data.access_token,
|
|
118
|
+
tokenType: data.token_type,
|
|
119
|
+
expiration: this.getTokenExpiration(data.expires_in),
|
|
120
|
+
};
|
|
121
|
+
return this.cemiarAuthToken.accessToken;
|
|
122
|
+
}
|
|
123
|
+
getEnvUrls(options) {
|
|
124
|
+
if (!!options && options.env === 'prod')
|
|
125
|
+
return PROD_URLS;
|
|
126
|
+
return DEV_URLS;
|
|
127
|
+
}
|
|
128
|
+
getTokenExpiration(expiresIn) {
|
|
129
|
+
return new Date(Date.now() + (expiresIn - 10) * 1000); // Added a 10 second buffer to account for potential clock skew
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.EpicApiService = EpicApiService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './EpicApiService';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./EpicApiService"), exports);
|
package/dist/index.js
CHANGED
|
@@ -18,23 +18,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
20
|
};
|
|
21
|
-
var __importStar = (this && this.__importStar) ||
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
38
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
29
|
exports.Utils = exports.Exceptions = exports.Services = exports.Models = void 0;
|
|
40
30
|
// Services
|
package/dist/models/index.js
CHANGED
|
@@ -15,23 +15,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) ||
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
35
25
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
27
|
};
|
package/dist/utils/Excel.js
CHANGED
|
@@ -7,8 +7,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
7
7
|
const xlsx_1 = __importDefault(require("xlsx"));
|
|
8
8
|
class readXlsx {
|
|
9
9
|
static async getFromXLSX(path, sheetNumber) {
|
|
10
|
-
var _a;
|
|
11
|
-
var _b;
|
|
10
|
+
var _a, _b;
|
|
12
11
|
const file = xlsx_1.default.readFile(path);
|
|
13
12
|
const worksheet = file.Sheets[file.SheetNames[sheetNumber]];
|
|
14
13
|
if (!worksheet) {
|
package/package.json
CHANGED
|
@@ -1,30 +1,42 @@
|
|
|
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/index.js",
|
|
12
|
-
"module": "./dist/index.mjs",
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
14
|
-
"files": [
|
|
15
|
-
"dist"
|
|
16
|
-
],
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"axios": "^1.18.0",
|
|
19
|
-
"nodemailer": "^9.0.1",
|
|
20
|
-
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@types/node": "^18.19.0",
|
|
24
|
-
"@types/nodemailer": "^8.0.1"
|
|
25
|
-
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "rm -rf dist/ && tsc -p tsconfig.json",
|
|
28
|
-
"buildWindows": "rmdir /s /q dist & tsc -p tsconfig.json"
|
|
29
|
-
}
|
|
30
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@cemiar/cemiarlink-sdk",
|
|
3
|
+
"version": "1.0.58",
|
|
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/index.js",
|
|
12
|
+
"module": "./dist/index.mjs",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"axios": "^1.18.0",
|
|
19
|
+
"nodemailer": "^9.0.1",
|
|
20
|
+
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^18.19.0",
|
|
24
|
+
"@types/nodemailer": "^8.0.1"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "rm -rf dist/ && tsc -p tsconfig.json",
|
|
28
|
+
"buildWindows": "rmdir /s /q dist & tsc -p tsconfig.json"
|
|
29
|
+
},
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./epic-api": {
|
|
37
|
+
"types": "./dist/epic-api/index.d.ts",
|
|
38
|
+
"import": "./dist/epic-api/index.js",
|
|
39
|
+
"default": "./dist/epic-api/index.js"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|