@nhvbeauty/tpl 0.2.0 → 0.3.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/lib/entities/products/index.d.ts +5 -0
- package/lib/entities/products/index.js +28 -0
- package/lib/entities/products/index.js.map +1 -0
- package/lib/entities/products/interfaces/products.interface.d.ts +28 -0
- package/lib/entities/products/interfaces/products.interface.js +3 -0
- package/lib/entities/products/interfaces/products.interface.js.map +1 -0
- package/lib/tpl.d.ts +2 -0
- package/lib/tpl.js +4 -0
- package/lib/tpl.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,28 @@
|
|
|
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.Products = void 0;
|
|
13
|
+
const entity_1 = require("../@shared/entity");
|
|
14
|
+
class Products extends entity_1.Entity {
|
|
15
|
+
find(skus) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const skuList = !skus || skus.length === 0
|
|
18
|
+
? [{ sku: '*' }]
|
|
19
|
+
: skus.map((sku) => ({ sku }));
|
|
20
|
+
return yield this.repository.request({
|
|
21
|
+
endpoint: '/get/products',
|
|
22
|
+
body: { skus: skuList },
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.Products = Products;
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entities/products/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,8CAA0C;AAE1C,MAAa,QAAS,SAAQ,eAAM;IACrB,IAAI,CAAC,IAAe;;YAC/B,MAAM,OAAO,GACX,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;gBACxB,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;gBAChB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;YAElC,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;gBACnC,QAAQ,EAAE,eAAe;gBACzB,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;aACxB,CAAC,CAAA;QACJ,CAAC;KAAA;CACF;AAZD,4BAYC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface IProductsBody {
|
|
2
|
+
skus: Array<{
|
|
3
|
+
sku: string;
|
|
4
|
+
}>;
|
|
5
|
+
}
|
|
6
|
+
export interface IProductComposition {
|
|
7
|
+
sku: string;
|
|
8
|
+
ean: string;
|
|
9
|
+
descricao: string;
|
|
10
|
+
unidade: string | null;
|
|
11
|
+
use: number;
|
|
12
|
+
amount: number;
|
|
13
|
+
}
|
|
14
|
+
export interface IProduct {
|
|
15
|
+
type: 'P' | 'K';
|
|
16
|
+
ean: string;
|
|
17
|
+
sku: string;
|
|
18
|
+
kit: string;
|
|
19
|
+
descricao: string;
|
|
20
|
+
unidade: string | null;
|
|
21
|
+
code: number;
|
|
22
|
+
amount: number;
|
|
23
|
+
composition: IProductComposition[];
|
|
24
|
+
}
|
|
25
|
+
export interface IProductsResponse {
|
|
26
|
+
code: number;
|
|
27
|
+
stock: IProduct[];
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.interface.js","sourceRoot":"","sources":["../../../../src/entities/products/interfaces/products.interface.ts"],"names":[],"mappings":""}
|
package/lib/tpl.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Auth } from './entities/auth';
|
|
2
2
|
import { Orders } from './entities/orders';
|
|
3
|
+
import { Products } from './entities/products';
|
|
3
4
|
import { Shipping } from './entities/shipping';
|
|
4
5
|
export declare class Tpl {
|
|
5
6
|
#private;
|
|
@@ -8,4 +9,5 @@ export declare class Tpl {
|
|
|
8
9
|
get auth(): Auth;
|
|
9
10
|
get orders(): Orders;
|
|
10
11
|
get shipping(): Shipping;
|
|
12
|
+
get products(): Products;
|
|
11
13
|
}
|
package/lib/tpl.js
CHANGED
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.Tpl = void 0;
|
|
16
16
|
const auth_1 = require("./entities/auth");
|
|
17
17
|
const orders_1 = require("./entities/orders");
|
|
18
|
+
const products_1 = require("./entities/products");
|
|
18
19
|
const shipping_1 = require("./entities/shipping");
|
|
19
20
|
const ioc_1 = require("./providers/ioc");
|
|
20
21
|
class Tpl {
|
|
@@ -39,6 +40,9 @@ class Tpl {
|
|
|
39
40
|
get shipping() {
|
|
40
41
|
return this.getModule(shipping_1.Shipping);
|
|
41
42
|
}
|
|
43
|
+
get products() {
|
|
44
|
+
return this.getModule(products_1.Products);
|
|
45
|
+
}
|
|
42
46
|
}
|
|
43
47
|
exports.Tpl = Tpl;
|
|
44
48
|
_Tpl_repository = new WeakMap(), _Tpl_modules = new WeakMap();
|
package/lib/tpl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tpl.js","sourceRoot":"","sources":["../src/tpl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,0C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A,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;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC,mBAAQ,CAAC,CAAA;IACjC,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC,mBAAQ,CAAC,CAAA;IACjC,CAAC;CACF;AAvDD,kBAuDC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nhvbeauty/tpl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Pacote de integração com a API da TPL",
|
|
5
5
|
"directories": {
|
|
6
6
|
"test": "test"
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"main": "lib/index.js",
|
|
28
28
|
"files": [
|
|
29
|
+
"README.md",
|
|
29
30
|
"lib/**/*"
|
|
30
31
|
],
|
|
31
32
|
"scripts": {
|