@afilimax/core 0.2.2 → 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/dist/enums/marketplace.enum.d.ts +2 -1
- package/dist/enums/marketplace.enum.js +1 -0
- package/dist/helpers/config.helper.d.ts +14 -0
- package/dist/helpers/config.helper.js +18 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +17 -0
- package/dist/utils/url-validators/index.d.ts +10 -0
- package/dist/utils/url-validators/index.js +46 -0
- package/dist/utils/url-validators/is-aliexpress-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-aliexpress-product-url.util.js +7 -0
- package/dist/utils/url-validators/is-amazon-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-amazon-product-url.util.js +9 -0
- package/dist/utils/url-validators/is-americanas-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-americanas-product-url.util.js +7 -0
- package/dist/utils/url-validators/is-kabum-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-kabum-product-url.util.js +7 -0
- package/dist/utils/url-validators/is-magazine-luiza-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-magazine-luiza-product-url.util.js +9 -0
- package/dist/utils/url-validators/is-mercado-livre-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-mercado-livre-product-url.util.js +9 -0
- package/dist/utils/url-validators/is-pichau-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-pichau-product-url.util.js +7 -0
- package/dist/utils/url-validators/is-shopee-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-shopee-product-url.util.js +9 -0
- package/dist/utils/url-validators/is-temu-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-temu-product-url.util.js +7 -0
- package/dist/utils/url-validators/is-terabyte-shop-product-url.util.d.ts +1 -0
- package/dist/utils/url-validators/is-terabyte-shop-product-url.util.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const configHelper: {
|
|
2
|
+
domains: {
|
|
3
|
+
amazon: string[];
|
|
4
|
+
mercado_livre: string[];
|
|
5
|
+
shopee: string[];
|
|
6
|
+
aliexpress: string[];
|
|
7
|
+
magazine_luiza: string[];
|
|
8
|
+
kabum: string[];
|
|
9
|
+
terabyte_shop: string[];
|
|
10
|
+
pichau: string[];
|
|
11
|
+
americanas: string[];
|
|
12
|
+
temu: string[];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configHelper = void 0;
|
|
4
|
+
const enums_1 = require("../enums");
|
|
5
|
+
exports.configHelper = {
|
|
6
|
+
domains: {
|
|
7
|
+
[enums_1.Marketplace.Amazon]: ["amazon.com", "amazon.com.br", "amzn.to", "a.co"],
|
|
8
|
+
[enums_1.Marketplace.MercadoLivre]: ["mercadolivre.com.br", "mercadolivre.com"],
|
|
9
|
+
[enums_1.Marketplace.Shopee]: ["shopee.com.br", "shopee.com"],
|
|
10
|
+
[enums_1.Marketplace.AliExpress]: ["aliexpress.com"],
|
|
11
|
+
[enums_1.Marketplace.MagazineLuiza]: ["magazineluiza.com.br", "magazinevoce.com.br", "magazineluiza.onelink.me"],
|
|
12
|
+
[enums_1.Marketplace.Kabum]: ["kabum.com.br"],
|
|
13
|
+
[enums_1.Marketplace.TerabyteShop]: ["terabyteshop.com.br"],
|
|
14
|
+
[enums_1.Marketplace.Pichau]: ["pichau.com.br"],
|
|
15
|
+
[enums_1.Marketplace.Americanas]: ["americanas.com.br"],
|
|
16
|
+
[enums_1.Marketplace.Temu]: ["temu.com"],
|
|
17
|
+
},
|
|
18
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./url-validators";
|
|
@@ -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("./url-validators"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./is-amazon-product-url.util";
|
|
2
|
+
export * from "./is-aliexpress-product-url.util";
|
|
3
|
+
export * from "./is-shopee-product-url.util";
|
|
4
|
+
export * from "./is-terabyte-shop-product-url.util";
|
|
5
|
+
export * from "./is-kabum-product-url.util";
|
|
6
|
+
export * from "./is-pichau-product-url.util";
|
|
7
|
+
export * from "./is-temu-product-url.util";
|
|
8
|
+
export * from "./is-magazine-luiza-product-url.util";
|
|
9
|
+
export * from "./is-americanas-product-url.util";
|
|
10
|
+
export declare function isValidProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
exports.isValidProductUrl = isValidProductUrl;
|
|
18
|
+
const is_magazine_luiza_product_url_util_1 = require("./is-magazine-luiza-product-url.util");
|
|
19
|
+
const is_terabyte_shop_product_url_util_1 = require("./is-terabyte-shop-product-url.util");
|
|
20
|
+
const is_americanas_product_url_util_1 = require("./is-americanas-product-url.util");
|
|
21
|
+
const is_aliexpress_product_url_util_1 = require("./is-aliexpress-product-url.util");
|
|
22
|
+
const is_shopee_product_url_util_1 = require("./is-shopee-product-url.util");
|
|
23
|
+
const is_pichau_product_url_util_1 = require("./is-pichau-product-url.util");
|
|
24
|
+
const is_amazon_product_url_util_1 = require("./is-amazon-product-url.util");
|
|
25
|
+
const is_kabum_product_url_util_1 = require("./is-kabum-product-url.util");
|
|
26
|
+
const is_temu_product_url_util_1 = require("./is-temu-product-url.util");
|
|
27
|
+
__exportStar(require("./is-amazon-product-url.util"), exports);
|
|
28
|
+
__exportStar(require("./is-aliexpress-product-url.util"), exports);
|
|
29
|
+
__exportStar(require("./is-shopee-product-url.util"), exports);
|
|
30
|
+
__exportStar(require("./is-terabyte-shop-product-url.util"), exports);
|
|
31
|
+
__exportStar(require("./is-kabum-product-url.util"), exports);
|
|
32
|
+
__exportStar(require("./is-pichau-product-url.util"), exports);
|
|
33
|
+
__exportStar(require("./is-temu-product-url.util"), exports);
|
|
34
|
+
__exportStar(require("./is-magazine-luiza-product-url.util"), exports);
|
|
35
|
+
__exportStar(require("./is-americanas-product-url.util"), exports);
|
|
36
|
+
function isValidProductUrl(url) {
|
|
37
|
+
return ((0, is_amazon_product_url_util_1.isAmazonProductUrl)(url) ||
|
|
38
|
+
(0, is_aliexpress_product_url_util_1.isAliExpressProductUrl)(url) ||
|
|
39
|
+
(0, is_shopee_product_url_util_1.isShopeeProductUrl)(url) ||
|
|
40
|
+
(0, is_terabyte_shop_product_url_util_1.isTerabyteShopProductUrl)(url) ||
|
|
41
|
+
(0, is_kabum_product_url_util_1.isKabumProductUrl)(url) ||
|
|
42
|
+
(0, is_pichau_product_url_util_1.isPichauProductUrl)(url) ||
|
|
43
|
+
(0, is_temu_product_url_util_1.isTemuProductUrl)(url) ||
|
|
44
|
+
(0, is_magazine_luiza_product_url_util_1.isMagazineLuizaProductUrl)(url) ||
|
|
45
|
+
(0, is_americanas_product_url_util_1.isAmericanasProductUrl)(url));
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isAliExpressProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAliExpressProductUrl = isAliExpressProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isAliExpressProductUrl(url) {
|
|
6
|
+
return config_helper_1.configHelper.domains.aliexpress.some((domain) => url.includes(domain));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isAmazonProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAmazonProductUrl = isAmazonProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isAmazonProductUrl(url) {
|
|
6
|
+
const domainPattern = config_helper_1.configHelper.domains.amazon.join("|");
|
|
7
|
+
const amazonProductRegex = new RegExp(`https?://(?:www\\.)?(?:${domainPattern})/(?:.+/)?(?:gp/product|dp|exec/obidos/tg/detail|gp/aw/d|gp/offer-listing|d)/[\\w\\d]+|https://amzn\\.to/[\\w\\d]+`, "i");
|
|
8
|
+
return amazonProductRegex.test(url);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isAmericanasProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAmericanasProductUrl = isAmericanasProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isAmericanasProductUrl(url) {
|
|
6
|
+
return config_helper_1.configHelper.domains.americanas.some((domain) => url.includes(domain));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isKabumProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isKabumProductUrl = isKabumProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isKabumProductUrl(url) {
|
|
6
|
+
return config_helper_1.configHelper.domains.kabum.some((domain) => url.includes(domain));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isMagazineLuizaProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMagazineLuizaProductUrl = isMagazineLuizaProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isMagazineLuizaProductUrl(url) {
|
|
6
|
+
const domainPattern = config_helper_1.configHelper.domains.magazine_luiza.join("|");
|
|
7
|
+
const magazineLuizaRegex = new RegExp(`^https?://(?:www\\.)?(?:${domainPattern})/(?:.+)?`, "i");
|
|
8
|
+
return magazineLuizaRegex.test(url);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isMercadoLivreProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMercadoLivreProductUrl = isMercadoLivreProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isMercadoLivreProductUrl(url) {
|
|
6
|
+
const domainPattern = config_helper_1.configHelper.domains.mercado_livre.join("|");
|
|
7
|
+
const mercadoLivreProductRegex = new RegExp(`^https?://(?:www\\.|lista\\.|produto\\.)?(?:${domainPattern})/(?:[^/]+/)?(ML[AB]-?\\d{7,}|p/[\\w\\d]+|sec/[\\w\\d]+)`, "i");
|
|
8
|
+
return mercadoLivreProductRegex.test(url);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isPichauProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPichauProductUrl = isPichauProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isPichauProductUrl(url) {
|
|
6
|
+
return config_helper_1.configHelper.domains.pichau.some((domain) => url.includes(domain));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isShopeeProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isShopeeProductUrl = isShopeeProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isShopeeProductUrl(url) {
|
|
6
|
+
const domainPattern = config_helper_1.configHelper.domains.shopee.join("|");
|
|
7
|
+
const shopeeRegex = new RegExp(`^https?://(?:www\\.|s\\.)?(?:${domainPattern})/(?:.+-)?i\\.\\d+\\.\\d+|^https://shp\\.ee/[\\w\\d]+`, "i");
|
|
8
|
+
return shopeeRegex.test(url);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isTemuProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTemuProductUrl = isTemuProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isTemuProductUrl(url) {
|
|
6
|
+
return config_helper_1.configHelper.domains.temu.some((domain) => url.includes(domain));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isTerabyteShopProductUrl(url: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTerabyteShopProductUrl = isTerabyteShopProductUrl;
|
|
4
|
+
const config_helper_1 = require("../../helpers/config.helper");
|
|
5
|
+
function isTerabyteShopProductUrl(url) {
|
|
6
|
+
return config_helper_1.configHelper.domains.terabyte_shop.some((domain) => url.includes(domain));
|
|
7
|
+
}
|