@nhvbeauty/tpl 0.1.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/LICENSE +15 -0
- package/lib/entities/@shared/entity.d.ts +5 -0
- package/lib/entities/@shared/entity.js +10 -0
- package/lib/entities/@shared/entity.js.map +1 -0
- package/lib/entities/auth/index.d.ts +5 -0
- package/lib/entities/auth/index.js +22 -0
- package/lib/entities/auth/index.js.map +1 -0
- package/lib/entities/auth/interfaces/login.interface.d.ts +9 -0
- package/lib/entities/auth/interfaces/login.interface.js +3 -0
- package/lib/entities/auth/interfaces/login.interface.js.map +1 -0
- package/lib/entities/orders/index.d.ts +5 -0
- package/lib/entities/orders/index.js +27 -0
- package/lib/entities/orders/index.js.map +1 -0
- package/lib/entities/orders/interfaces/find.interface.d.ts +110 -0
- package/lib/entities/orders/interfaces/find.interface.js +3 -0
- package/lib/entities/orders/interfaces/find.interface.js.map +1 -0
- package/lib/exceptions/tpl-api.exception.d.ts +5 -0
- package/lib/exceptions/tpl-api.exception.js +13 -0
- package/lib/exceptions/tpl-api.exception.js.map +1 -0
- package/lib/helpers/types/newable.type.d.ts +1 -0
- package/lib/helpers/types/newable.type.js +3 -0
- package/lib/helpers/types/newable.type.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces/auth.d.ts +9 -0
- package/lib/interfaces/auth.js +3 -0
- package/lib/interfaces/auth.js.map +1 -0
- package/lib/providers/ioc.d.ts +2 -0
- package/lib/providers/ioc.js +8 -0
- package/lib/providers/ioc.js.map +1 -0
- package/lib/repositories/tpl.repository.d.ts +10 -0
- package/lib/repositories/tpl.repository.interface.d.ts +13 -0
- package/lib/repositories/tpl.repository.interface.js +3 -0
- package/lib/repositories/tpl.repository.interface.js.map +1 -0
- package/lib/repositories/tpl.repository.js +69 -0
- package/lib/repositories/tpl.repository.js.map +1 -0
- package/lib/tpl.d.ts +9 -0
- package/lib/tpl.js +41 -0
- package/lib/tpl.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Copyright 2026 Bruno França
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
14
|
+
|
|
15
|
+
**Commons Clause**: The Software may not be used for commercial purposes.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/entities/@shared/entity.ts"],"names":[],"mappings":";;;AAMA,MAAsB,MAAM;IAS1B,YAAY,UAA0B;QACpC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;CACF;AAZD,wBAYC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
exports.Auth = void 0;
|
|
13
|
+
const entity_1 = require("../@shared/entity");
|
|
14
|
+
class Auth extends entity_1.Entity {
|
|
15
|
+
login(body) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
return yield this.repository.requestWithoutAuth('/get/auth', body);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.Auth = Auth;
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entities/auth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,8CAA0C;AAQ1C,MAAa,IAAK,SAAQ,eAAM;IACjB,KAAK,CAAC,IAAgB;;YACjC,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAI7C,WAAW,EACX,IAAI,CACL,CAAA;QACH,CAAC;KAAA;CACF;AAVD,oBAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.interface.js","sourceRoot":"","sources":["../../../../src/entities/auth/interfaces/login.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
exports.Orders = void 0;
|
|
13
|
+
const entity_1 = require("../@shared/entity");
|
|
14
|
+
class Orders extends entity_1.Entity {
|
|
15
|
+
get(params) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
return yield this.repository.request({
|
|
18
|
+
endpoint: '/get/orderdetail',
|
|
19
|
+
body: {
|
|
20
|
+
order: params,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.Orders = Orders;
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entities/orders/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,8CAA0C;AAE1C,MAAa,MAAO,SAAQ,eAAM;IAInB,GAAG,CACd,MAAmB;;YAEnB,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;gBACnC,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,KAAK,EAAE,MAAM;iBACd;aACF,CAAC,CAAA;QACJ,CAAC;KAAA;CACF;AAdD,wBAcC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export type IFindParams = {
|
|
2
|
+
id: number | bigint;
|
|
3
|
+
} | {
|
|
4
|
+
number: string;
|
|
5
|
+
};
|
|
6
|
+
export interface IFindResponse {
|
|
7
|
+
code: number;
|
|
8
|
+
message: string;
|
|
9
|
+
order: {
|
|
10
|
+
code: number;
|
|
11
|
+
message: string;
|
|
12
|
+
info: {
|
|
13
|
+
id: string;
|
|
14
|
+
number: string;
|
|
15
|
+
date: string;
|
|
16
|
+
prediction: string | null;
|
|
17
|
+
iderp: string | null;
|
|
18
|
+
note: string | null;
|
|
19
|
+
};
|
|
20
|
+
deliveryTo: {
|
|
21
|
+
to: string;
|
|
22
|
+
document: string;
|
|
23
|
+
mail: string;
|
|
24
|
+
phone: string;
|
|
25
|
+
street: string;
|
|
26
|
+
number: string;
|
|
27
|
+
district: string;
|
|
28
|
+
complement: string;
|
|
29
|
+
city: string;
|
|
30
|
+
state: string;
|
|
31
|
+
zipcode: string;
|
|
32
|
+
};
|
|
33
|
+
shippment: {
|
|
34
|
+
nick: string;
|
|
35
|
+
method: string | null;
|
|
36
|
+
vol: string;
|
|
37
|
+
tracker: string;
|
|
38
|
+
trackerUrl: string;
|
|
39
|
+
url: string | null;
|
|
40
|
+
};
|
|
41
|
+
wharehouse: string | null;
|
|
42
|
+
items: {
|
|
43
|
+
sku: string;
|
|
44
|
+
item: string;
|
|
45
|
+
name: string;
|
|
46
|
+
amount: string;
|
|
47
|
+
unity: string;
|
|
48
|
+
part: string | null;
|
|
49
|
+
cubedWeight: number;
|
|
50
|
+
serial: unknown[];
|
|
51
|
+
}[];
|
|
52
|
+
internalevents: {
|
|
53
|
+
created: string | null;
|
|
54
|
+
os: string | null;
|
|
55
|
+
withoutBalance: string | null;
|
|
56
|
+
invoice: string | null;
|
|
57
|
+
startPicking: string | null;
|
|
58
|
+
endPicking: string | null;
|
|
59
|
+
startCheckout: string | null;
|
|
60
|
+
endCheckout: string | null;
|
|
61
|
+
dispatched: string | null;
|
|
62
|
+
in_transit: string | null;
|
|
63
|
+
out_for_delivery: string | null;
|
|
64
|
+
delivered: string | null;
|
|
65
|
+
fail: string | null;
|
|
66
|
+
cancelled: string | null;
|
|
67
|
+
};
|
|
68
|
+
summarybyvolume: {
|
|
69
|
+
tracking: string;
|
|
70
|
+
vol: number;
|
|
71
|
+
created: string;
|
|
72
|
+
deliveryforecast: string | null;
|
|
73
|
+
outfordelivery: string | null;
|
|
74
|
+
intransit: string | null;
|
|
75
|
+
delivered: string | null;
|
|
76
|
+
deliveryfailure: string | null;
|
|
77
|
+
}[];
|
|
78
|
+
shippingevents: {
|
|
79
|
+
internalCode: number;
|
|
80
|
+
code: string;
|
|
81
|
+
info: string;
|
|
82
|
+
complement: string | null;
|
|
83
|
+
date: string;
|
|
84
|
+
final: string;
|
|
85
|
+
volume: string;
|
|
86
|
+
}[];
|
|
87
|
+
invoice: {
|
|
88
|
+
number: string;
|
|
89
|
+
series: string;
|
|
90
|
+
emission: string;
|
|
91
|
+
weight: string;
|
|
92
|
+
volumes: string;
|
|
93
|
+
value: string;
|
|
94
|
+
key: string;
|
|
95
|
+
document: string;
|
|
96
|
+
}[];
|
|
97
|
+
resend: {
|
|
98
|
+
id: string;
|
|
99
|
+
order: string;
|
|
100
|
+
inserted: string;
|
|
101
|
+
situation: string;
|
|
102
|
+
by: string;
|
|
103
|
+
} | [];
|
|
104
|
+
wms: {
|
|
105
|
+
weight: number;
|
|
106
|
+
weightm3: string;
|
|
107
|
+
volumes: string;
|
|
108
|
+
} | null;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find.interface.js","sourceRoot":"","sources":["../../../../src/entities/orders/interfaces/find.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TplApiError = void 0;
|
|
4
|
+
class TplApiError extends Error {
|
|
5
|
+
constructor(message, statusCode, response) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.statusCode = statusCode;
|
|
8
|
+
this.response = response;
|
|
9
|
+
this.name = 'TplApiError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.TplApiError = TplApiError;
|
|
13
|
+
//# sourceMappingURL=tpl-api.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tpl-api.exception.js","sourceRoot":"","sources":["../../src/exceptions/tpl-api.exception.ts"],"names":[],"mappings":";;;AAGA,MAAa,WAAY,SAAQ,KAAK;IACpC,YACE,OAAe,EACR,UAAmB,EACnB,QAAc;QAErB,KAAK,CAAC,OAAO,CAAC,CAAA;QAHP,eAAU,GAAV,UAAU,CAAS;QACnB,aAAQ,GAAR,QAAQ,CAAM;QAGrB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAA;IAC3B,CAAC;CACF;AATD,kCASC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Newable<T> = new (...args: any[]) => T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"newable.type.js","sourceRoot":"","sources":["../../../src/helpers/types/newable.type.ts"],"names":[],"mappings":""}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tpl';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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("./tpl"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/interfaces/auth.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRepository = getRepository;
|
|
4
|
+
const tpl_repository_1 = require("src/repositories/tpl.repository");
|
|
5
|
+
function getRepository(authToken, baseUrl) {
|
|
6
|
+
return new tpl_repository_1.TplRepository(authToken, baseUrl);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=ioc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ioc.js","sourceRoot":"","sources":["../../src/providers/ioc.ts"],"names":[],"mappings":";;AAQA,sCAKC;AAZD,oEAA+D;AAO/D,SAAgB,aAAa,CAC3B,SAA6B,EAC7B,OAAe;IAEf,OAAO,IAAI,8BAAa,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC9C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDefaultParams, IRequestOptions, ITplRepository } from './tpl.repository.interface';
|
|
2
|
+
export declare class TplRepository implements ITplRepository {
|
|
3
|
+
private readonly baseUrl;
|
|
4
|
+
private authToken?;
|
|
5
|
+
constructor(authToken: string | undefined, baseUrl: string);
|
|
6
|
+
setAuthToken(token: string): void;
|
|
7
|
+
clearAuthToken(): void;
|
|
8
|
+
request<TBody = any, TResponse = any>(options: IRequestOptions<TBody>): Promise<TResponse>;
|
|
9
|
+
requestWithoutAuth<TBody = any, TResponse = any>(endpoint: string, body?: TBody, params?: IDefaultParams): Promise<TResponse>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type IDefaultParams = Record<string, number | number[] | string | string[] | boolean | Date | undefined>;
|
|
2
|
+
export type IDefaultHeaders = Record<string, string>;
|
|
3
|
+
export interface IRequestOptions<TBody = any> {
|
|
4
|
+
endpoint: string;
|
|
5
|
+
body?: TBody;
|
|
6
|
+
params?: IDefaultParams;
|
|
7
|
+
headers?: IDefaultHeaders;
|
|
8
|
+
includeAuth?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ITplRepository {
|
|
11
|
+
request: <TBody = any, TResponse = any>(options: IRequestOptions<TBody>) => Promise<TResponse>;
|
|
12
|
+
requestWithoutAuth: <TBody = any, TResponse = any>(endpoint: string, body?: TBody, params?: IDefaultParams) => Promise<TResponse>;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tpl.repository.interface.js","sourceRoot":"","sources":["../../src/repositories/tpl.repository.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
exports.TplRepository = void 0;
|
|
13
|
+
const tpl_api_exception_1 = require("../exceptions/tpl-api.exception");
|
|
14
|
+
class TplRepository {
|
|
15
|
+
constructor(authToken, baseUrl) {
|
|
16
|
+
this.authToken = authToken;
|
|
17
|
+
this.baseUrl = baseUrl.replace(/\/$/, '');
|
|
18
|
+
}
|
|
19
|
+
setAuthToken(token) {
|
|
20
|
+
this.authToken = token;
|
|
21
|
+
}
|
|
22
|
+
clearAuthToken() {
|
|
23
|
+
this.authToken = undefined;
|
|
24
|
+
}
|
|
25
|
+
request(options) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const { endpoint, body = {}, headers, includeAuth = true, } = options;
|
|
28
|
+
const url = `${this.baseUrl}${endpoint}`;
|
|
29
|
+
const requestBody = Object.assign({}, body);
|
|
30
|
+
if (includeAuth) {
|
|
31
|
+
if (!this.authToken) {
|
|
32
|
+
throw new tpl_api_exception_1.TplApiError('Authentication token is required for this request. Please login first.', 401);
|
|
33
|
+
}
|
|
34
|
+
requestBody.auth = this.authToken;
|
|
35
|
+
}
|
|
36
|
+
const defaultHeaders = Object.assign({ 'Content-Type': 'application/json' }, headers);
|
|
37
|
+
try {
|
|
38
|
+
const response = yield fetch(url, {
|
|
39
|
+
method: 'POST',
|
|
40
|
+
headers: defaultHeaders,
|
|
41
|
+
body: JSON.stringify(requestBody),
|
|
42
|
+
});
|
|
43
|
+
if (!response.ok) {
|
|
44
|
+
const errorData = yield response.json().catch(() => ({}));
|
|
45
|
+
throw new tpl_api_exception_1.TplApiError(errorData.message || `HTTP Error ${response.status}`, response.status, errorData);
|
|
46
|
+
}
|
|
47
|
+
return yield response.json();
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (error instanceof tpl_api_exception_1.TplApiError) {
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
throw new tpl_api_exception_1.TplApiError(error instanceof Error ? error.message : 'Unknown error occurred');
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
requestWithoutAuth(endpoint, body, params) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return this.request({
|
|
60
|
+
endpoint,
|
|
61
|
+
body,
|
|
62
|
+
params,
|
|
63
|
+
includeAuth: false,
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.TplRepository = TplRepository;
|
|
69
|
+
//# sourceMappingURL=tpl.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tpl.repository.js","sourceRoot":"","sources":["../../src/repositories/tpl.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,uEAA6D;AAK7D,MAAa,aAAa;IAIxB,YAAY,SAA6B,EAAE,OAAe;QACxD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IAC3C,CAAC;IAMM,YAAY,CAAC,KAAa;QAC/B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;IACxB,CAAC;IAKM,cAAc;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAKK,OAAO,CACX,OAA+B;;YAE/B,MAAM,EACJ,QAAQ,EACR,IAAI,GAAG,EAAW,EAClB,OAAO,EACP,WAAW,GAAG,IAAI,GACnB,GAAG,OAAO,CAAA;YACX,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,QAAQ,EAAE,CAAA;YAExC,MAAM,WAAW,qBAAa,IAAI,CAAE,CAAA;YAEpC,IAAI,WAAW,EAAE,CAAC;gBAChB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;oBACpB,MAAM,IAAI,+BAAW,CACnB,wEAAwE,EACxE,GAAG,CACJ,CAAA;gBACH,CAAC;gBACD,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAA;YACnC,CAAC;YAED,MAAM,cAAc,mBAClB,cAAc,EAAE,kBAAkB,IAC/B,OAAO,CACX,CAAA;YAED,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;oBAChC,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,cAAc;oBACvB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;iBAClC,CAAC,CAAA;gBAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;oBACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;oBACzD,MAAM,IAAI,+BAAW,CACnB,SAAS,CAAC,OAAO,IAAI,cAAc,QAAQ,CAAC,MAAM,EAAE,EACpD,QAAQ,CAAC,MAAM,EACf,SAAS,CACV,CAAA;gBACH,CAAC;gBAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAC9B,CAAC;YACD,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,KAAK,YAAY,+BAAW,EAAE,CAAC;oBACjC,MAAM,KAAK,CAAA;gBACb,CAAC;gBAED,MAAM,IAAI,+BAAW,CACnB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAClE,CAAA;YACH,CAAC;QACH,CAAC;KAAA;IAKK,kBAAkB,CACtB,QAAgB,EAChB,IAAY,EACZ,MAAuB;;YAEvB,OAAO,IAAI,CAAC,OAAO,CAAmB;gBACpC,QAAQ;gBACR,IAAI;gBACJ,MAAM;gBACN,WAAW,EAAE,KAAK;aACnB,CAAC,CAAA;QACJ,CAAC;KAAA;CACF;AAnGD,sCAmGC"}
|
package/lib/tpl.d.ts
ADDED
package/lib/tpl.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _Tpl_repository, _Tpl_modules;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.Tpl = void 0;
|
|
16
|
+
const auth_1 = require("./entities/auth");
|
|
17
|
+
const orders_1 = require("./entities/orders");
|
|
18
|
+
const ioc_1 = require("./providers/ioc");
|
|
19
|
+
class Tpl {
|
|
20
|
+
constructor(authToken, baseUrl = 'https://oms.tpl.com.br/api') {
|
|
21
|
+
_Tpl_repository.set(this, void 0);
|
|
22
|
+
_Tpl_modules.set(this, void 0);
|
|
23
|
+
__classPrivateFieldSet(this, _Tpl_repository, (0, ioc_1.getRepository)(authToken || undefined, baseUrl), "f");
|
|
24
|
+
__classPrivateFieldSet(this, _Tpl_modules, {}, "f");
|
|
25
|
+
}
|
|
26
|
+
getModule(EntityClass) {
|
|
27
|
+
if (!__classPrivateFieldGet(this, _Tpl_modules, "f")[EntityClass.name]) {
|
|
28
|
+
__classPrivateFieldGet(this, _Tpl_modules, "f")[EntityClass.name] = new EntityClass(__classPrivateFieldGet(this, _Tpl_repository, "f"));
|
|
29
|
+
}
|
|
30
|
+
return __classPrivateFieldGet(this, _Tpl_modules, "f")[EntityClass.name];
|
|
31
|
+
}
|
|
32
|
+
get auth() {
|
|
33
|
+
return this.getModule(auth_1.Auth);
|
|
34
|
+
}
|
|
35
|
+
get orders() {
|
|
36
|
+
return this.getModule(orders_1.Orders);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.Tpl = Tpl;
|
|
40
|
+
_Tpl_repository = new WeakMap(), _Tpl_modules = new WeakMap();
|
|
41
|
+
//# sourceMappingURL=tpl.js.map
|
package/lib/tpl.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tpl.js","sourceRoot":"","sources":["../src/tpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,0CAAsC;AACtC,8CAA0C;AAC1C,yCAA+C;AAE/C,MAAa,GAAG;IAmBd,YACE,SAAkB,EAClB,UAAkB,4BAA4B;QApBhD,kCAA2B;QAC3B,+BAA4C;QAqB1C,uBAAA,IAAI,mBAAe,IAAA,mBAAa,EAAC,SAAS,IAAI,SAAS,EAAE,OAAO,CAAC,MAAA,CAAA;QACjE,uBAAA,IAAI,gBAAY,EAAE,MAAA,CAAA;IACpB,CAAC;IAQO,SAAS,CAAmB,WAAuB;QACzD,IAAI,CAAC,uBAAA,IAAI,oBAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,uBAAA,IAAI,oBAAS,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,WAAW,CAAC,uBAAA,IAAI,uBAAY,CAAC,CAAA;QACrE,CAAC;QACD,OAAO,uBAAA,IAAI,oBAAS,CAAC,WAAW,CAAC,IAAI,CAAM,CAAA;IAC7C,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,WAAI,CAAC,CAAA;IAC7B,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,eAAM,CAAC,CAAA;IAC/B,CAAC;CACF;AA/CD,kBA+CC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nhvbeauty/tpl",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Pacote de integração com a API da TPL",
|
|
5
|
+
"directories": {
|
|
6
|
+
"test": "test"
|
|
7
|
+
},
|
|
8
|
+
"author": "Bruno França",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"homepage": "https://github.com/nhvgrupo/tpl#readme",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/nhvgrupo/tpl.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/nhvgrupo/tpl/issues"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"javascript",
|
|
20
|
+
"api",
|
|
21
|
+
"typescript",
|
|
22
|
+
"integration",
|
|
23
|
+
"js",
|
|
24
|
+
"ts",
|
|
25
|
+
"tpl"
|
|
26
|
+
],
|
|
27
|
+
"main": "lib/index.js",
|
|
28
|
+
"files": [
|
|
29
|
+
"lib/**/*"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc --project tsconfig.build.json",
|
|
33
|
+
"lint": "eslint --fix 'src/**/*.ts'",
|
|
34
|
+
"test": "npm run build && jest --config jest.config.ts",
|
|
35
|
+
"test:coverage": "jest --config jest.config.ts --coverage"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"axios": "^1.13.3"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@antfu/eslint-config": "^7.2.0",
|
|
42
|
+
"eslint": "^9.39.2",
|
|
43
|
+
"typescript": "^5.9.3"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
}
|
|
48
|
+
}
|