store-scrapper-js-common 1.0.101 → 1.0.105
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/classes/command.d.ts +2 -0
- package/dist/classes/command.js.map +1 -1
- package/dist/dto/index.d.ts +2 -1
- package/dist/dto/index.js +3 -1
- package/dist/dto/index.js.map +1 -1
- package/dist/dto/store-config.dto.d.ts +11 -0
- package/dist/dto/store-config.dto.js +7 -0
- package/dist/dto/store-config.dto.js.map +1 -0
- package/dist/entities/category.d.ts +1 -0
- package/dist/entities/category.js.map +1 -1
- package/dist/entities/index.d.ts +3 -3
- package/dist/entities/index.js.map +1 -1
- package/dist/entities/store.d.ts +2 -9
- package/dist/entities/store.js +5 -0
- package/dist/entities/store.js.map +1 -1
- package/package.json +1 -1
- package/src/classes/command.ts +3 -0
- package/src/dto/index.ts +2 -1
- package/src/dto/store-config.dto.ts +15 -0
- package/src/entities/category.ts +2 -0
- package/src/entities/index.ts +2 -2
- package/src/entities/store.ts +3 -10
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ObjectLiteral } from './object-literal';
|
|
2
|
+
import { StoreConfig } from '../dto/store-config.dto';
|
|
2
3
|
export declare class Command {
|
|
3
4
|
name: string;
|
|
4
5
|
metadata?: ObjectLiteral;
|
|
5
6
|
storeId?: string;
|
|
7
|
+
storeConfig?: StoreConfig;
|
|
6
8
|
nextCommand?: string;
|
|
7
9
|
}
|
|
8
10
|
export declare const getCommandsStep: (crawlerSteps: SQSCommandNames[], currentStep?: SQSCommandNames) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"/","sources":["classes/command.ts"],"names":[],"mappings":";;;AACA,kDAA2C;
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"/","sources":["classes/command.ts"],"names":[],"mappings":";;;AACA,kDAA2C;AAG3C,MAAa,OAAO;CAUnB;AAVD,0BAUC;AAEY,QAAA,eAAe,GAAG,CAAC,YAA+B,EAAE,WAA6B,EACzB,EAAE;IACrE,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,IAAI,WAAW,EAAE;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC/C,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE;gBACnC,YAAY,GAAG,CAAC,CAAC;gBACjB,MAAM;aACP;SACF;KACF;IAED,MAAM,SAAS,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAElG,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AACjC,CAAC,CAAC;AAEW,QAAA,aAAa,GAAG,CAAC,IAAqB,EACjD,QAAwB,EACxB,OAAgB,EAChB,WAAoC,EACxB,EAAE,CAAC,CAAC;IAChB,IAAI;IACJ,QAAQ;IACR,OAAO;IACP,WAAW;CACZ,CAAC,CAAC;AAEH,IAAY,eAeX;AAfD,WAAY,eAAe;IACzB,gDAA6B,CAAA;IAC7B,wDAAqC,CAAA;IACrC,wCAAqB,CAAA;IACrB,8CAA2B,CAAA;IAC3B,4CAAyB,CAAA;IAEzB,sDAAmC,CAAA;IACnC,gEAA6C,CAAA;IAC7C,sDAAmC,CAAA;IACnC,oDAAiC,CAAA;IAEjC,gEAA6C,CAAA;IAC7C,sEAAmD,CAAA;IACnD,0DAAuC,CAAA;AACzC,CAAC,EAfW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAe1B;AAEY,QAAA,kBAAkB,GAAG,kBAAkB,CAAC;AACxC,QAAA,cAAc,GAAG,mBAAmB,CAAC;AAErC,QAAA,aAAa,GAAG,CAAC,OAAgB,EAAE,KAAc,EAAE,YAAqB,EAAW,EAAE;IAChG,MAAM,YAAY,GAAG,CAAC,iBAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,CAAC,KAAK,IAAI,sBAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACnG,MAAM,gBAAgB,GAAG,CAAC,iBAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,CAAC,YAAY,IAAI,0BAAkB,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;IAEpI,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,YAAY,CAAC;AAC5E,CAAC,CAAC","sourcesContent":["import { ObjectLiteral } from './object-literal';\nimport { isUrl } from '../utils/url-utils';\nimport { StoreConfig } from '../dto/store-config.dto';\n\nexport class Command {\n name: string;\n\n metadata?: ObjectLiteral;\n\n storeId?: string;\n\n storeConfig?: StoreConfig;\n\n nextCommand?: string;\n}\n\nexport const getCommandsStep = (crawlerSteps: SQSCommandNames[], currentStep?: SQSCommandNames)\n : {firstStep: SQSCommandNames, nextStep: SQSCommandNames | null} => {\n let currentIndex = 0;\n\n if (currentStep) {\n for (let i = 0; i < crawlerSteps.length; i += 1) {\n if (crawlerSteps[i] === currentStep) {\n currentIndex = i;\n break;\n }\n }\n }\n\n const firstStep = crawlerSteps[currentIndex];\n const nextStep = crawlerSteps.length > (currentIndex + 1) ? crawlerSteps[currentIndex + 1] : null;\n\n return { firstStep, nextStep };\n};\n\nexport const createCommand = (name: SQSCommandNames,\n metadata?: ObjectLiteral,\n storeId?: string,\n nextCommand?: SQSCommandNames | null)\n : Command => ({\n name,\n metadata,\n storeId,\n nextCommand,\n});\n\nexport enum SQSCommandNames {\n getMenuPages = 'getMenuPages',\n getCategoryPages = 'getCategoryPages',\n getPages = 'getPages',\n getProducts = 'getProducts',\n getProduct = 'getProduct',\n\n persistCategory = 'persistCategory',\n persistCategoryPages = 'persistCategoryPages',\n persistProducts = 'persistProducts',\n persistProduct = 'persistProduct',\n\n processProductPrices = 'processProductPrices',\n processCategoryKeywords = 'processCategoryKeywords',\n processPriceStats = 'processPriceStats'\n}\n\nexport const SQSPersistenceName = 'PersistenceQueue';\nexport const SQSCommandName = 'StoreCommandQueue';\n\nexport const getNextSQSUrl = (command: Command, queue?: string, persistQueue?: string) : string => {\n const commandQueue = !isUrl(queue) ? process.env.SQSCommandUrl + (queue || SQSCommandName) : queue;\n const persistenceQueue = !isUrl(persistQueue) ? process.env.SQSPersistenceUrl + (persistQueue || SQSPersistenceName) : persistQueue;\n\n return command.name.includes('persist') ? persistenceQueue : commandQueue;\n};\n"]}
|
package/dist/dto/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ProcessProductCategoryDto } from './process-product-category.dto';
|
|
2
|
+
import { StoreConfig } from './store-config.dto';
|
|
2
3
|
import { TelegramQueueCommandDto } from './telegram-queue-command.dto';
|
|
3
|
-
export { ProcessProductCategoryDto, TelegramQueueCommandDto };
|
|
4
|
+
export { ProcessProductCategoryDto, TelegramQueueCommandDto, StoreConfig };
|
package/dist/dto/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TelegramQueueCommandDto = exports.ProcessProductCategoryDto = void 0;
|
|
3
|
+
exports.StoreConfig = exports.TelegramQueueCommandDto = exports.ProcessProductCategoryDto = void 0;
|
|
4
4
|
const process_product_category_dto_1 = require("./process-product-category.dto");
|
|
5
5
|
Object.defineProperty(exports, "ProcessProductCategoryDto", { enumerable: true, get: function () { return process_product_category_dto_1.ProcessProductCategoryDto; } });
|
|
6
|
+
const store_config_dto_1 = require("./store-config.dto");
|
|
7
|
+
Object.defineProperty(exports, "StoreConfig", { enumerable: true, get: function () { return store_config_dto_1.StoreConfig; } });
|
|
6
8
|
const telegram_queue_command_dto_1 = require("./telegram-queue-command.dto");
|
|
7
9
|
Object.defineProperty(exports, "TelegramQueueCommandDto", { enumerable: true, get: function () { return telegram_queue_command_dto_1.TelegramQueueCommandDto; } });
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
package/dist/dto/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["dto/index.ts"],"names":[],"mappings":";;;AAAA,iFAA2E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["dto/index.ts"],"names":[],"mappings":";;;AAAA,iFAA2E;AAIlE,0GAJA,wDAAyB,OAIA;AAHlC,yDAAiD;AAGY,4FAHpD,8BAAW,OAGoD;AAFxE,6EAAuE;AAEnC,wGAF3B,oDAAuB,OAE2B","sourcesContent":["import { ProcessProductCategoryDto } from './process-product-category.dto';\nimport { StoreConfig } from './store-config.dto';\nimport { TelegramQueueCommandDto } from './telegram-queue-command.dto';\n\nexport { ProcessProductCategoryDto, TelegramQueueCommandDto, StoreConfig };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-config.dto.js","sourceRoot":"/","sources":["dto/store-config.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;CAcvB;AAdD,kCAcC","sourcesContent":["export class StoreConfig {\n name: string;\n\n filterCategories?: string[];\n\n skipCategories?: string[];\n\n cacheMenu?: boolean;\n\n headers?: {[key: string]: any};\n\n includeProductsWithoutStock?: boolean;\n\n [key: string]: any\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category.js","sourceRoot":"/","sources":["entities/category.ts"],"names":[],"mappings":";;;;;;;;;AAAA,qCAAiC;AACjC,mDAA+C;AAO/C,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,4BAAY;
|
|
1
|
+
{"version":3,"file":"category.js","sourceRoot":"/","sources":["entities/category.ts"],"names":[],"mappings":";;;;;;;;;AAAA,qCAAiC;AACjC,mDAA+C;AAO/C,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,4BAAY;CAgBzC,CAAA;AAhBY,QAAQ;IADpB,gBAAM,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;GACrB,QAAQ,CAgBpB;AAhBY,4BAAQ","sourcesContent":["import { Entity } from 'typeorm';\nimport { AbstractBase } from './abstract-base';\nimport { ObjectLiteral } from '../classes';\nimport { Product } from './product';\nimport { CATEGORY_ENUM } from './keyword';\n\n// Mucho webeo cambiarle el nombre a todas las clases..\n@Entity({ name: 'categoryMenus' })\nexport class Category extends AbstractBase {\n category?: CATEGORY_ENUM;\n\n name?: string;\n\n path?: string;\n\n url: string;\n\n sourceUrl?: string;\n\n metadata?: ObjectLiteral;\n\n products?: Product[];\n\n [key: string]: any;\n}\n"]}
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StoreQueueConfig, Store, CountryEnum, PriorityEnum
|
|
1
|
+
import { StoreQueueConfig, Store, CountryEnum, PriorityEnum } from './store';
|
|
2
2
|
import { Product, UpdateReasonEnum, CurrencyEnum, ProductAttributes, ConditionalPrice } from './product';
|
|
3
3
|
import { Price, MeasurementUnitEnum } from './price';
|
|
4
4
|
import { Category } from './category';
|
|
@@ -8,5 +8,5 @@ import { User } from './user';
|
|
|
8
8
|
import { AlertConditions } from './alert-conditions';
|
|
9
9
|
import { PricesStats } from './prices-stats';
|
|
10
10
|
import { CategoryEntity } from './category-entity';
|
|
11
|
-
export declare const Entities: (typeof
|
|
12
|
-
export { Store, Product, Price, Category, CategoryEntity, AbstractBase, Keyword, CONDITION_FIELD_ENUM, CONDITION_ENUM, CATEGORY_ENUM, User, AlertConditions, StoreQueueConfig,
|
|
11
|
+
export declare const Entities: (typeof Keyword | typeof Price | typeof Product | typeof Store | typeof User)[];
|
|
12
|
+
export { Store, Product, Price, Category, CategoryEntity, AbstractBase, Keyword, CONDITION_FIELD_ENUM, CONDITION_ENUM, CATEGORY_ENUM, User, AlertConditions, StoreQueueConfig, CountryEnum, PriorityEnum, CurrencyEnum, UpdateReasonEnum, ConditionalPrice, ProductAttributes, MeasurementUnitEnum, PricesStats, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["entities/index.ts"],"names":[],"mappings":";;;AAAA,mCAEiB;AAoBf,sFArBkB,aAAK,OAqBlB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["entities/index.ts"],"names":[],"mappings":";;;AAAA,mCAEiB;AAoBf,sFArBkB,aAAK,OAqBlB;AACmE,4FAtB/C,mBAAW,OAsB+C;AAAE,6FAtB/C,oBAAY,OAsB+C;AApBnG,uCAEmB;AAiBV,wFAlBP,iBAAO,OAkBO;AAEA,iGApBL,0BAAgB,OAoBK;AAA9B,6FApB2B,sBAAY,OAoB3B;AAlBd,mCAAqD;AAgBnC,sFAhBT,aAAK,OAgBS;AAEgD,oGAlBvD,2BAAmB,OAkBuD;AAjB1F,yCAAsC;AAeb,yFAfhB,mBAAQ,OAegB;AAdjC,mDAA+C;AAcI,6FAd1C,4BAAY,OAc0C;AAb/D,uCAEmB;AAW8C,wFAZ/D,iBAAO,OAY+D;AACtD,8FAbP,uBAAa,OAaO;AAA7B,+FAbwB,wBAAc,OAaxB;AAD0D,qGAZhC,8BAAoB,OAYgC;AAV9F,iCAA8B;AAWG,qFAXxB,WAAI,OAWwB;AAVrC,yDAAqD;AAUd,gGAV9B,kCAAe,OAU8B;AATtD,iDAA6C;AAU+C,4FAVnF,0BAAW,OAUmF;AATvG,uDAAmD;AAOhB,+FAP1B,gCAAc,OAO0B;AALpC,QAAA,QAAQ,GAAG;IACtB,aAAK,EAAE,iBAAO,EAAE,aAAK,EAAE,iBAAO,EAAE,WAAI;CACrC,CAAC","sourcesContent":["import {\n StoreQueueConfig, Store, CountryEnum, PriorityEnum,\n} from './store';\nimport {\n Product, UpdateReasonEnum, CurrencyEnum, ProductAttributes, ConditionalPrice,\n} from './product';\nimport { Price, MeasurementUnitEnum } from './price';\nimport { Category } from './category';\nimport { AbstractBase } from './abstract-base';\nimport {\n Keyword, CATEGORY_ENUM, CONDITION_ENUM, CONDITION_FIELD_ENUM,\n} from './keyword';\nimport { User } from './user';\nimport { AlertConditions } from './alert-conditions';\nimport { PricesStats } from './prices-stats';\nimport { CategoryEntity } from './category-entity';\n\nexport const Entities = [\n Store, Product, Price, Keyword, User,\n];\n\nexport {\n Store, Product, Price, Category, CategoryEntity, AbstractBase, Keyword, CONDITION_FIELD_ENUM,\n CONDITION_ENUM, CATEGORY_ENUM, User, AlertConditions, StoreQueueConfig, CountryEnum, PriorityEnum,\n CurrencyEnum, UpdateReasonEnum, ConditionalPrice, ProductAttributes, MeasurementUnitEnum, PricesStats,\n};\n"]}
|
package/dist/entities/store.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AbstractBase } from './abstract-base';
|
|
2
|
+
import { CATEGORY_ENUM } from './keyword';
|
|
2
3
|
import { CurrencyEnum } from './product';
|
|
3
4
|
import { ObjectLiteral } from '../classes';
|
|
4
|
-
import {
|
|
5
|
+
import { StoreConfig } from '../dto/store-config.dto';
|
|
5
6
|
export interface StoreQueueConfig {
|
|
6
7
|
name?: string;
|
|
7
8
|
concurrency?: number;
|
|
@@ -10,14 +11,6 @@ export interface StoreQueueConfig {
|
|
|
10
11
|
duration: number;
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
|
-
export interface StoreConfig {
|
|
14
|
-
name: string;
|
|
15
|
-
filterCategories?: string[];
|
|
16
|
-
skipCategories?: string[];
|
|
17
|
-
cacheMenus?: boolean;
|
|
18
|
-
headers?: ObjectLiteral;
|
|
19
|
-
proxySettings?: ObjectLiteral;
|
|
20
|
-
}
|
|
21
14
|
export declare enum CountryEnum {
|
|
22
15
|
CHILE = "chile",
|
|
23
16
|
ARGENTINA = "argentina",
|
package/dist/entities/store.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.Store = exports.PriorityEnum = exports.CountryEnum = void 0;
|
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
const abstract_base_1 = require("./abstract-base");
|
|
16
|
+
const store_config_dto_1 = require("../dto/store-config.dto");
|
|
16
17
|
var CountryEnum;
|
|
17
18
|
(function (CountryEnum) {
|
|
18
19
|
CountryEnum["CHILE"] = "chile";
|
|
@@ -91,6 +92,10 @@ __decorate([
|
|
|
91
92
|
typeorm_1.Column(),
|
|
92
93
|
__metadata("design:type", String)
|
|
93
94
|
], Store.prototype, "defaultCurrency", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
typeorm_1.Column(),
|
|
97
|
+
__metadata("design:type", store_config_dto_1.StoreConfig)
|
|
98
|
+
], Store.prototype, "config", void 0);
|
|
94
99
|
__decorate([
|
|
95
100
|
typeorm_1.Column(),
|
|
96
101
|
__metadata("design:type", Object)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"/","sources":["entities/store.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAEiB;AACjB,qDAA6C;AAC7C,mDAA+C;
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"/","sources":["entities/store.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAEiB;AACjB,qDAA6C;AAC7C,mDAA+C;AAI/C,8DAAsD;AAatD,IAAY,WAKX;AALD,WAAY,WAAW;IACnB,8BAAe,CAAA;IACf,sCAAuB,CAAA;IACvB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACrB,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB;AAED,IAAY,YASX;AATD,WAAY,YAAY;IACpB,uCAAuB,CAAA;IACvB,6BAAa,CAAA;IACb,iCAAiB,CAAA;IACjB,2BAAW,CAAA;IAEX,yCAAyB,CAAA;IACzB,6CAA6B,CAAA;IAC7B,uCAAuB,CAAA;AAC3B,CAAC,EATW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QASvB;AAID,IAAa,KAAK,GAAlB,MAAa,KAAM,SAAQ,4BAAY;IAAvC;;QA0BI,YAAO,GAAG,IAAI,CAAC;IA0BnB,CAAC;CAAA,CAAA;AAhDG;IAHC,gBAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC3B,eAAK,EAAE;IACP,4BAAU,EAAE;;mCACA;AAGb;IADC,gBAAM,EAAE;;0CACY;AAIrB;IAFC,gBAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC3B,4BAAU,EAAE;;kCACD;AAGZ;IADC,gBAAM,EAAE;;yCACoB;AAG7B;IADC,gBAAM,EAAE;;uCACe;AAGxB;IADC,gBAAM,EAAE;;mCACI;AAGb;IADC,gBAAM,EAAE;;6CACe;AAGxB;IADC,gBAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;sCAC5B;AAGf;IADC,gBAAM,EAAE;;oCACK;AAGd;IADC,gBAAM,EAAE;;2CACY;AAGrB;IADC,gBAAM,EAAE;;+CAC6B;AAGtC;IADC,gBAAM,EAAE;;sCACsB;AAG/B;IADC,gBAAM,EAAE;;8CAC+B;AAGxC;IADC,gBAAM,EAAE;8BACA,8BAAW;qCAAC;AAGrB;IADC,gBAAM,EAAE;;4CAKR;AAnDQ,KAAK;IAFjB,gBAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC1B,gBAAM,CAAC,CAAC,KAAK,CAAC,CAAC;GACH,KAAK,CAoDjB;AApDY,sBAAK","sourcesContent":["import {\n Column, Entity, Index, Unique,\n} from 'typeorm';\nimport { IsNotEmpty } from 'class-validator';\nimport { AbstractBase } from './abstract-base';\nimport { CATEGORY_ENUM } from './keyword';\nimport { CurrencyEnum } from './product';\nimport { ObjectLiteral } from '../classes';\nimport { StoreConfig } from '../dto/store-config.dto';\n\nexport interface StoreQueueConfig {\n name?: string;\n concurrency?: number;\n rateLimiter?: {\n /** Max numbers of jobs processed */\n max: number,\n /** Per duration in milliseconds */\n duration: number\n }\n}\n\nexport enum CountryEnum {\n CHILE = 'chile',\n ARGENTINA = 'argentina',\n PERU = 'peru',\n BRAZIL = 'brazil'\n}\n\nexport enum PriorityEnum {\n VERY_HIGH = 'very_high',\n HIGH = 'high',\n MEDIUM = 'medium',\n LOW = 'low',\n\n SHOES_HIGH = 'shoes_high',\n SHOES_MEDIUM = 'shoes_medium',\n SHOES_LOW = 'shoes_low',\n}\n\n@Entity({ name: 'stores' })\n@Unique(['url'])\nexport class Store extends AbstractBase {\n @Column({ nullable: false })\n @Index()\n @IsNotEmpty()\n name: string;\n\n @Column()\n displayName?: string;\n\n @Column({ nullable: false })\n @IsNotEmpty()\n url: string;\n\n @Column()\n categories?: CATEGORY_ENUM[];\n\n @Column()\n priority?: PriorityEnum;\n\n @Column()\n type: string;\n\n @Column()\n parentStoreRef?: string;\n\n @Column({ default: true, type: 'boolean' })\n enabled = true;\n\n @Column()\n queue: string;\n\n @Column()\n persistQueue: string;\n\n @Column()\n storeQueueConfig?: StoreQueueConfig[];\n\n @Column()\n country?: CountryEnum | string;\n\n @Column()\n defaultCurrency?: CurrencyEnum | string;\n\n @Column()\n config?: StoreConfig;\n\n @Column()\n scraperConfig?: {\n filterCategories?: string[];\n skipCategories?: string[];\n headers?: ObjectLiteral;\n }\n}\n"]}
|
package/package.json
CHANGED
package/src/classes/command.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ObjectLiteral } from './object-literal';
|
|
2
2
|
import { isUrl } from '../utils/url-utils';
|
|
3
|
+
import { StoreConfig } from '../dto/store-config.dto';
|
|
3
4
|
|
|
4
5
|
export class Command {
|
|
5
6
|
name: string;
|
|
@@ -8,6 +9,8 @@ export class Command {
|
|
|
8
9
|
|
|
9
10
|
storeId?: string;
|
|
10
11
|
|
|
12
|
+
storeConfig?: StoreConfig;
|
|
13
|
+
|
|
11
14
|
nextCommand?: string;
|
|
12
15
|
}
|
|
13
16
|
|
package/src/dto/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProcessProductCategoryDto } from './process-product-category.dto';
|
|
2
|
+
import { StoreConfig } from './store-config.dto';
|
|
2
3
|
import { TelegramQueueCommandDto } from './telegram-queue-command.dto';
|
|
3
4
|
|
|
4
|
-
export { ProcessProductCategoryDto, TelegramQueueCommandDto };
|
|
5
|
+
export { ProcessProductCategoryDto, TelegramQueueCommandDto, StoreConfig };
|
package/src/entities/category.ts
CHANGED
package/src/entities/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
StoreQueueConfig, Store, CountryEnum, PriorityEnum,
|
|
2
|
+
StoreQueueConfig, Store, CountryEnum, PriorityEnum,
|
|
3
3
|
} from './store';
|
|
4
4
|
import {
|
|
5
5
|
Product, UpdateReasonEnum, CurrencyEnum, ProductAttributes, ConditionalPrice,
|
|
@@ -21,6 +21,6 @@ export const Entities = [
|
|
|
21
21
|
|
|
22
22
|
export {
|
|
23
23
|
Store, Product, Price, Category, CategoryEntity, AbstractBase, Keyword, CONDITION_FIELD_ENUM,
|
|
24
|
-
CONDITION_ENUM, CATEGORY_ENUM, User, AlertConditions, StoreQueueConfig,
|
|
24
|
+
CONDITION_ENUM, CATEGORY_ENUM, User, AlertConditions, StoreQueueConfig, CountryEnum, PriorityEnum,
|
|
25
25
|
CurrencyEnum, UpdateReasonEnum, ConditionalPrice, ProductAttributes, MeasurementUnitEnum, PricesStats,
|
|
26
26
|
};
|
package/src/entities/store.ts
CHANGED
|
@@ -3,9 +3,10 @@ import {
|
|
|
3
3
|
} from 'typeorm';
|
|
4
4
|
import { IsNotEmpty } from 'class-validator';
|
|
5
5
|
import { AbstractBase } from './abstract-base';
|
|
6
|
+
import { CATEGORY_ENUM } from './keyword';
|
|
6
7
|
import { CurrencyEnum } from './product';
|
|
7
8
|
import { ObjectLiteral } from '../classes';
|
|
8
|
-
import {
|
|
9
|
+
import { StoreConfig } from '../dto/store-config.dto';
|
|
9
10
|
|
|
10
11
|
export interface StoreQueueConfig {
|
|
11
12
|
name?: string;
|
|
@@ -18,15 +19,6 @@ export interface StoreQueueConfig {
|
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
export interface StoreConfig {
|
|
22
|
-
name: string;
|
|
23
|
-
filterCategories?: string[];
|
|
24
|
-
skipCategories?: string[];
|
|
25
|
-
cacheMenus?: boolean;
|
|
26
|
-
headers?: ObjectLiteral;
|
|
27
|
-
proxySettings?: ObjectLiteral;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
22
|
export enum CountryEnum {
|
|
31
23
|
CHILE = 'chile',
|
|
32
24
|
ARGENTINA = 'argentina',
|
|
@@ -90,6 +82,7 @@ export class Store extends AbstractBase {
|
|
|
90
82
|
@Column()
|
|
91
83
|
defaultCurrency?: CurrencyEnum | string;
|
|
92
84
|
|
|
85
|
+
@Column()
|
|
93
86
|
config?: StoreConfig;
|
|
94
87
|
|
|
95
88
|
@Column()
|