@odg/chemical-x 1.28.0 → 2.0.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.
Files changed (77) hide show
  1. package/dist/Container.d.ts +3 -47
  2. package/dist/Container.js +3 -23
  3. package/dist/Container.js.map +1 -1
  4. package/dist/Helpers/index.d.ts +1 -1
  5. package/dist/Helpers/index.js +1 -1
  6. package/dist/Helpers/index.js.map +1 -1
  7. package/dist/Helpers/retry.d.ts +1 -1
  8. package/dist/Helpers/retry.js +2 -2
  9. package/dist/Helpers/retry.js.map +1 -1
  10. package/dist/Helpers/sleep.d.ts +1 -1
  11. package/dist/Helpers/{throwIf.d.ts → throw-if.d.ts} +1 -1
  12. package/dist/Helpers/{throwIf.js → throw-if.js} +1 -1
  13. package/dist/Helpers/throw-if.js.map +1 -0
  14. package/dist/Helpers/timeout.d.ts +1 -1
  15. package/dist/Helpers/timeout.js +1 -1
  16. package/dist/Helpers/timeout.js.map +1 -1
  17. package/dist/Interfaces/AttemptableFlow.d.ts +5 -5
  18. package/dist/Interfaces/RetryInterface.d.ts +6 -6
  19. package/dist/Interfaces/TimeoutInterface.d.ts +1 -1
  20. package/dist/Interfaces/index.d.ts +1 -1
  21. package/dist/Interfaces/index.js +0 -15
  22. package/dist/Interfaces/index.js.map +1 -1
  23. package/dist/Support/Arr.d.ts +1 -7
  24. package/dist/Support/Arr.js +0 -6
  25. package/dist/Support/Arr.js.map +1 -1
  26. package/dist/Support/Decorators/OdgDecorators.d.ts +16 -0
  27. package/dist/Support/Decorators/{ODGDecorators.js → OdgDecorators.js} +44 -25
  28. package/dist/Support/Decorators/OdgDecorators.js.map +1 -0
  29. package/dist/Support/Decorators/index.d.ts +1 -2
  30. package/dist/Support/Decorators/index.js +1 -2
  31. package/dist/Support/Decorators/index.js.map +1 -1
  32. package/dist/Support/Num.d.ts +1 -1
  33. package/dist/Support/Num.js.map +1 -1
  34. package/dist/Support/Str.d.ts +2 -2
  35. package/dist/Support/Str.js +6 -6
  36. package/dist/Support/Str.js.map +1 -1
  37. package/dist/crawler/@types/Browser.d.ts +1 -1
  38. package/dist/crawler/@types/Context.d.ts +1 -2
  39. package/dist/crawler/@types/ManagerBrowserType.d.ts +4 -4
  40. package/dist/crawler/@types/Page.d.ts +3 -4
  41. package/dist/crawler/Browser.d.ts +7 -7
  42. package/dist/crawler/Browser.js +1 -1
  43. package/dist/crawler/Browser.js.map +1 -1
  44. package/dist/crawler/BrowserManager.d.ts +5 -5
  45. package/dist/crawler/BrowserManager.js.map +1 -1
  46. package/dist/crawler/Context.d.ts +7 -7
  47. package/dist/crawler/Context.js +2 -2
  48. package/dist/crawler/Context.js.map +1 -1
  49. package/dist/crawler/Handlers/BaseHandler.d.ts +22 -20
  50. package/dist/crawler/Handlers/BaseHandler.js +25 -24
  51. package/dist/crawler/Handlers/BaseHandler.js.map +1 -1
  52. package/dist/crawler/Interfaces/HandlerInterface.d.ts +48 -14
  53. package/dist/crawler/Interfaces/HandlerInterface.js +0 -15
  54. package/dist/crawler/Interfaces/HandlerInterface.js.map +1 -1
  55. package/dist/crawler/Interfaces/PageInterface.d.ts +1 -1
  56. package/dist/crawler/Interfaces/index.d.ts +1 -1
  57. package/dist/crawler/Interfaces/index.js +0 -15
  58. package/dist/crawler/Interfaces/index.js.map +1 -1
  59. package/dist/crawler/Page.d.ts +5 -5
  60. package/dist/crawler/Page.js +1 -1
  61. package/dist/crawler/Page.js.map +1 -1
  62. package/dist/crawler/Pages/BasePage.d.ts +12 -19
  63. package/dist/crawler/Pages/BasePage.js +3 -13
  64. package/dist/crawler/Pages/BasePage.js.map +1 -1
  65. package/dist/crawler/Pages/Components/BaseComponentPage.d.ts +2 -2
  66. package/dist/crawler/Pages/Components/BaseComponentPage.js.map +1 -1
  67. package/dist/index.d.ts +1 -1
  68. package/dist/index.js +0 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/tsconfig.build.tsbuildinfo +1 -1
  71. package/package.json +37 -19
  72. package/dist/Helpers/throwIf.js.map +0 -1
  73. package/dist/Support/Decorators/GetterDecorator.d.ts +0 -1
  74. package/dist/Support/Decorators/GetterDecorator.js +0 -18
  75. package/dist/Support/Decorators/GetterDecorator.js.map +0 -1
  76. package/dist/Support/Decorators/ODGDecorators.d.ts +0 -15
  77. package/dist/Support/Decorators/ODGDecorators.js.map +0 -1
@@ -1,12 +1,12 @@
1
- import { type GetterAccessInterface } from "../Interfaces";
2
- import { type BrowserChemicalXInterface, type ContextChemicalXInterface, type ContextEngineInterface, type ContextOptionsLibraryInterface, type PageEngineInterface, CreateContextFactoryType, CreatePageFactoryType, type BrowserEngineInterface } from ".";
3
- export declare class Browser<BrowserEngineType extends BrowserEngineInterface, ContextEngineType extends ContextEngineInterface, PageEngineType extends PageEngineInterface> implements GetterAccessInterface, BrowserChemicalXInterface<BrowserEngineType, ContextEngineType> {
4
- readonly $browserInstance: BrowserEngineType;
1
+ import type { GetterAccessInterface } from "../Interfaces";
2
+ import { CreateContextFactoryType, CreatePageFactoryType, type BrowserChemicalXInterface, type BrowserEngineInterface, type ContextChemicalXInterface, type ContextEngineInterface, type ContextOptionsLibraryInterface, type PageEngineInterface } from ".";
3
+ export declare class Browser<BrowserClassEngine extends BrowserEngineInterface, ContextClassEngine extends ContextEngineInterface, PageClassEngine extends PageEngineInterface> implements GetterAccessInterface, BrowserChemicalXInterface<BrowserClassEngine, ContextClassEngine> {
4
+ readonly $browserInstance: BrowserClassEngine;
5
5
  private readonly $newContext;
6
6
  private readonly $newPage;
7
- constructor($browserInstance: BrowserEngineType, $newContext: CreateContextFactoryType<ContextEngineType, PageEngineType>, $newPage: CreatePageFactoryType<ContextChemicalXInterface<ContextEngineType>, PageEngineType>);
7
+ constructor($browserInstance: BrowserClassEngine, $newContext: CreateContextFactoryType<ContextClassEngine, PageClassEngine>, $newPage: CreatePageFactoryType<ContextChemicalXInterface<ContextClassEngine>, PageClassEngine>);
8
8
  defaultContextOptions(): Promise<ContextOptionsLibraryInterface>;
9
- newContext(options?: ContextOptionsLibraryInterface): Promise<ContextChemicalXInterface<ContextEngineType> & ContextEngineType>;
10
- contexts(): Array<ContextChemicalXInterface<ContextEngineType> & ContextEngineType>;
9
+ newContext(options?: ContextOptionsLibraryInterface): Promise<ContextChemicalXInterface<ContextClassEngine> & ContextClassEngine>;
10
+ contexts(): Array<ContextChemicalXInterface<ContextClassEngine> & ContextClassEngine>;
11
11
  __get(key: PropertyKey): unknown;
12
12
  }
@@ -51,7 +51,7 @@ let Browser = class Browser {
51
51
  };
52
52
  exports.Browser = Browser;
53
53
  exports.Browser = Browser = __decorate([
54
- (0, Decorators_1.getAccessDecorator)(),
54
+ Decorators_1.ODGDecorators.getterAccess(),
55
55
  __metadata("design:paramtypes", [Object, Function, Function])
56
56
  ], Browser);
57
57
  //# sourceMappingURL=Browser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Browser.js","sourceRoot":"","sources":["../../src/crawler/Browser.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oDAAyD;AAUlD,IAAM,OAAO,GAAb,MAAM,OAAO;IAOI;IACC;IACA;IAHrB,YACoB,gBAAmC,EAClC,WAAwE,EACxE,QAA6F;QAF9F,qBAAgB,GAAhB,gBAAgB,CAAmB;QAClC,gBAAW,GAAX,WAAW,CAA6D;QACxE,aAAQ,GAAR,QAAQ,CAAqF;IAGlH,CAAC;IAEM,KAAK,CAAC,qBAAqB;QAC9B,OAAO,EACN,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,UAAU,CACnB,OAAwC;QAExC,MAAM,WAAW,GAAG,CAChB,IAAI,CAAC,gBAAgB,CAAC,UAAU;eAC7B,IAAI,CAAC,gBAAgB,CAAC,6BAA6B;eACnD,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CACY,CAAC;QAE9D,OAAO,IAAI,CAAC,WAAW,CACnB,MAAM,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC1C,GAAG,MAAM,IAAI,CAAC,qBAAqB,EA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C3C,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;CAEJ,CAAA;AAhEY,0BAAO;kBAAP,OAAO;IADnB,0BAAa,CAAC,YAAY,EAAE;;GAChB,OAAO,CAgEnB"}
@@ -1,9 +1,9 @@
1
- import { type BrowserChemicalXInterface, type BrowserEngineInterface, type ContextChemicalXInterface, type ContextEngineInterface, type CreateBrowserFactoryType, type CreateContextFactoryType, type CreatePageFactoryType, type PageEngineInterface } from "..";
2
- export declare class BrowserManager<BrowserEngineType extends BrowserEngineInterface, ContextEngineType extends ContextEngineInterface, PageEngineType extends PageEngineInterface> {
1
+ import type { BrowserChemicalXInterface, BrowserEngineInterface, ContextChemicalXInterface, ContextEngineInterface, CreateBrowserFactoryType, CreateContextFactoryType, CreatePageFactoryType, PageEngineInterface } from "..";
2
+ export declare class BrowserManager<BrowserClassEngine extends BrowserEngineInterface, ContextClassEngine extends ContextEngineInterface, PageClassEngine extends PageEngineInterface> {
3
3
  private readonly $newBrowser;
4
4
  private readonly $newContext;
5
5
  private readonly $newPage;
6
- constructor($newBrowser: CreateBrowserFactoryType<BrowserEngineType, ContextEngineType, PageEngineType>, $newContext: CreateContextFactoryType<ContextEngineType, PageEngineType>, $newPage: CreatePageFactoryType<ContextChemicalXInterface<ContextEngineType>, PageEngineType>);
7
- newBrowser(browser: () => Promise<BrowserEngineType>): Promise<BrowserChemicalXInterface<BrowserEngineType, ContextEngineType> & BrowserEngineType>;
8
- newPersistentContext(context: () => Promise<ContextEngineType>): Promise<ContextChemicalXInterface<ContextEngineType> & ContextEngineType>;
6
+ constructor($newBrowser: CreateBrowserFactoryType<BrowserClassEngine, ContextClassEngine, PageClassEngine>, $newContext: CreateContextFactoryType<ContextClassEngine, PageClassEngine>, $newPage: CreatePageFactoryType<ContextChemicalXInterface<ContextClassEngine>, PageClassEngine>);
7
+ newBrowser(browser: () => Promise<BrowserClassEngine>): Promise<BrowserChemicalXInterface<BrowserClassEngine, ContextClassEngine> & BrowserClassEngine>;
8
+ newPersistentContext(context: () => Promise<ContextClassEngine>): Promise<ContextChemicalXInterface<ContextClassEngine> & ContextClassEngine>;
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BrowserManager.js","sourceRoot":"","sources":["../../src/crawler/BrowserManager.ts"],"names":[],"mappings":";;;AAWA,MAAa,cAAc;IAOF;IACA;IACA;IAHrB,YACqB,WAA2F,EAC3F,WAAwE,EACxE,QAA6F;QAF7F,gBAAW,GAAX,WAAW,CAAgF;QAC3F,gBAAW,GAAX,WAAW,CAA6D;QACxE,aAAQ,GAAR,QAAQ,CAAqF;IAElH,CAAC;IAEM,KAAK,CAAC,UAAU,CACnB,OAAyC;QAEzC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,OAAO,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAEnD,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAC7B,OAAyC;QAEzC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,OAAO,EAAE,EAAE,IAAI,CAAC,QAAQ,CAEjC,CAAC;IAC1B,CAAC;CAEJ;AA7BD,wCA6BC"}
1
+ {"version":3,"file":"BrowserManager.js","sourceRoot":"","sources":["../../src/crawler/BrowserManager.ts"],"names":[],"mappings":";;;AAWA,MAAa,cAAc;IAOF;IACA;IACA;IAHrB,YACqB,WAA8F,EAC9F,WAA0E,EAC1E,QAGhB;QALgB,gBAAW,GAAX,WAAW,CAAmF;QAC9F,gBAAW,GAAX,WAAW,CAA+D;QAC1E,aAAQ,GAAR,QAAQ,CAGxB;IAEL,CAAC;IAEM,KAAK,CAAC,UAAU,CACnB,OAA0C;QAE1C,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,OAAO,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAGlD,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAC7B,OAA0C;QAE1C,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,OAAO,EAAE,EAAE,IAAI,CAAC,QAAQ,CAEhC,CAAC;IAC3B,CAAC;CAEJ;AAjCD,wCAiCC"}
@@ -1,10 +1,10 @@
1
- import { type PageOptionsLibraryInterface, type ContextChemicalXInterface, type ContextEngineInterface, type CreatePageFactoryType, type GetterAccessInterface, type PageChemicalXInterface, type PageEngineInterface } from "..";
2
- export declare class Context<ContextEngineType extends ContextEngineInterface, PageEngineType extends PageEngineInterface> implements GetterAccessInterface, ContextChemicalXInterface<ContextEngineType> {
3
- readonly $contextInstance: ContextEngineType;
4
- readonly $newPage: CreatePageFactoryType<ContextChemicalXInterface<ContextEngineType>, PageEngineType>;
5
- constructor($contextInstance: ContextEngineType, $newPage: CreatePageFactoryType<ContextChemicalXInterface<ContextEngineType>, PageEngineType>);
1
+ import { type ContextChemicalXInterface, type ContextEngineInterface, type CreatePageFactoryType, type GetterAccessInterface, type PageChemicalXInterface, type PageEngineInterface, type PageOptionsLibraryInterface } from "..";
2
+ export declare class Context<ContextClassEngine extends ContextEngineInterface, PageClassEngine extends PageEngineInterface> implements GetterAccessInterface, ContextChemicalXInterface<ContextClassEngine> {
3
+ readonly $contextInstance: ContextClassEngine;
4
+ readonly $newPage: CreatePageFactoryType<ContextChemicalXInterface<ContextClassEngine>, PageClassEngine>;
5
+ constructor($contextInstance: ContextClassEngine, $newPage: CreatePageFactoryType<ContextChemicalXInterface<ContextClassEngine>, PageClassEngine>);
6
6
  defaultPageOptions(): Promise<PageOptionsLibraryInterface>;
7
- newPage(options?: Record<string, unknown>): Promise<PageChemicalXInterface<PageEngineType> & PageEngineType>;
8
- pages(): Array<PageChemicalXInterface<PageEngineType> & PageEngineType>;
7
+ newPage(options?: Record<string, unknown>): Promise<PageChemicalXInterface<PageClassEngine> & PageClassEngine>;
8
+ pages(): Array<PageChemicalXInterface<PageClassEngine> & PageClassEngine>;
9
9
  __get(key: PropertyKey): unknown;
10
10
  }
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Context = void 0;
13
- const Decorators_1 = require("../Support/Decorators");
13
+ const __1 = require("..");
14
14
  let Context = class Context {
15
15
  $contextInstance;
16
16
  $newPage;
@@ -43,7 +43,7 @@ let Context = class Context {
43
43
  };
44
44
  exports.Context = Context;
45
45
  exports.Context = Context = __decorate([
46
- (0, Decorators_1.getAccessDecorator)(),
46
+ __1.ODGDecorators.getterAccess(),
47
47
  __metadata("design:paramtypes", [Object, Function])
48
48
  ], Context);
49
49
  //# sourceMappingURL=Context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/crawler/Context.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAyD;AAalD,IAAM,OAAO,GAAb,MAAM,OAAO;IAMI;IACA;IAFpB,YACoB,gBAAmC,EACnC,QAA6F;QAD7F,qBAAgB,GAAhB,gBAAgB,CAAmB;QACnC,aAAQ,GAAR,QAAQ,CAAqF;IAGjH,CAAC;IAEM,KAAK,CAAC,kBAAkB;QAC3B,OAAO,EACN,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,OAAO,CAChB,OAAiC;QAEjC,OAAO,IAAI,CAAC,QAAQ,CAChB,IAAI,EACJ,MAAO,IAAI,CAAC,gBAAgB,CAAC,OAA4D,CACrF,IAAI,CAAC,gBAAgB,EACrB;YACI,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE;YAClC,GAAG,OAAO;SACb,CACJ,CACuD,CAAC;IACjE,CAAC;IAEM,KAAK;QACR,MAAM,KAAK,GAAI,IAAI,CAAC,gBAAgB,CAAC,KAAgC,EAAE,CAAC;QAExE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CACpC,IAAI,EACJ,IAAI,CACoD,CAAC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AI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CACpC,IAAI,EACJ,IAAI,CACsD,CAAC,CAAC;IACpE,CAAC;IAEM,KAAK,CAAC,GAAgB;QACzB,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACd,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAClC,CAAC;QAED,MAAM,aAAa,GAAI,IAAI,CAAC,gBAAiD,CAAC,GAAG,CAAC,CAAC;QAEnF,OAAO,OAAO,aAAa,KAAK,UAAU;YACtC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC;YAC3C,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;CAEJ,CAAA;AArDY,0BAAO;kBAAP,OAAO;IADnB,iBAAa,CAAC,YAAY,EAAE;;GAChB,OAAO,CAqDnB"}
@@ -1,49 +1,50 @@
1
1
  import { Exception } from "@odg/exception";
2
2
  import { RetryAction } from "../../Enums";
3
- import { type HandlerFunction, type HandlerInterface, type HandlerSolutionType } from "../../Interfaces";
4
- import { type PageEngineInterface } from "../@types";
5
- export declare abstract class BaseHandler<SelectorBaseType, PageEngineType extends PageEngineInterface> implements HandlerInterface {
6
- readonly page: PageEngineType;
7
- readonly $$s: SelectorBaseType;
3
+ import type { HandlerFunction, HandlerInterface, HandlerSolutionType } from "../../Interfaces";
4
+ import type { PageEngineInterface } from "../@types";
5
+ import type { SelectorType } from "../Selectors/SelectorsType";
6
+ export declare abstract class BaseHandler<PageClassEngine extends PageEngineInterface> implements HandlerInterface {
8
7
  currentAttempt: number;
9
- constructor(page: PageEngineType, $$s: SelectorBaseType);
8
+ page?: PageClassEngine;
9
+ abstract readonly $$s: Record<number | string | symbol, SelectorType>;
10
+ setPage(page: PageClassEngine): this;
10
11
  /**
11
- * Called if Handler end with success
12
+ * Called if the handler completes successfully.
12
13
  *
13
14
  * @memberof BaseHandler
14
15
  * @returns {Promise<void>}
15
16
  */
16
17
  success?(): Promise<void>;
17
18
  /**
18
- * Called if Handler end with fail or success
19
+ * Called when the handler finishes, regardless of success or failure.
19
20
  *
20
21
  * @memberof BaseHandler
21
- * @param {Exception} exception Exception if finish with error
22
+ * @param {Exception} exception The exception if the handler failed.
22
23
  * @returns {Promise<void>}
23
24
  */
24
25
  finish?(exception?: Exception): Promise<void>;
25
26
  /**
26
27
  * Called after each failed attempt.
27
28
  *
28
- * Return a retry action to control retry behavior.
29
+ * Return a `RetryAction` to control the retry behavior.
29
30
  *
30
- * @param {Exception} exception Exception
31
- * @param {number} attempt Current attempt
32
- * @returns {Promise<RetryAction>}
31
+ * @param {Exception} exception Exception that caused the retry.
32
+ * @param {number} attempt The current attempt number.
33
+ * @returns {Promise<RetryAction>} The action to take before the next retry.
33
34
  */
34
35
  retrying?(exception: Exception, attempt: number): Promise<RetryAction>;
35
36
  /**
36
37
  * Called when all attempts have failed.
37
38
  *
38
39
  * Use this to handle final failure logic.
39
- * You should re-throw the exception if needed.
40
+ * You should re-throw the exception if you want to propagate the error.
40
41
  *
41
- * @param {Exception} exception Exception
42
+ * @param {Exception} exception The final exception after all retries.
42
43
  * @returns {Promise<void>}
43
44
  */
44
45
  failure?(exception: Exception): Promise<void>;
45
46
  /**
46
- * Sleep time before retrying milliseconds
47
+ * The time in milliseconds to wait before the next retry attempt.
47
48
  *
48
49
  * @abstract
49
50
  * @memberof BaseHandler
@@ -51,19 +52,20 @@ export declare abstract class BaseHandler<SelectorBaseType, PageEngineType exten
51
52
  */
52
53
  sleep?(): Promise<number>;
53
54
  /**
54
- * Execute step With retry fail and finish
55
+ * Executes the handler with retry, failure, and finish logic.
55
56
  *
56
57
  * @returns {Promise<void>}
57
58
  */
58
59
  execute(): Promise<void>;
59
60
  /**
60
- * Use if you handler identify a successful response
61
+ * A convenience method to return a success solution.
61
62
  *
62
63
  * @returns {Promise<HandlerSolutionType>}
63
64
  */
64
65
  successSolution(): Promise<HandlerSolutionType>;
66
+ private executeHandlerFunction;
65
67
  /**
66
- * Possibility to wait for a handler
68
+ * Waits for and returns the handler function to be executed.
67
69
  *
68
70
  * @abstract
69
71
  * @memberof BaseHandler
@@ -71,7 +73,7 @@ export declare abstract class BaseHandler<SelectorBaseType, PageEngineType exten
71
73
  */
72
74
  abstract waitForHandler(): Promise<HandlerFunction>;
73
75
  /**
74
- * Number of Attempt to waitForHandler
76
+ * The total number of attempts to execute the handler.
75
77
  *
76
78
  * @abstract
77
79
  * @memberof BaseHandler
@@ -3,40 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseHandler = void 0;
4
4
  const exception_1 = require("@odg/exception");
5
5
  const _enums_1 = require("../../Enums");
6
- const RetryException_1 = require("../../Exceptions/RetryException");
7
6
  const _helpers_1 = require("../../Helpers");
8
7
  class BaseHandler {
9
- page;
10
- $$s;
11
8
  currentAttempt = 0;
12
- constructor(page, $$s) {
9
+ page;
10
+ setPage(page) {
13
11
  this.page = page;
14
- this.$$s = $$s;
12
+ return this;
15
13
  }
16
14
  /**
17
- * Execute step With retry fail and finish
15
+ * Executes the handler with retry, failure, and finish logic.
18
16
  *
19
17
  * @returns {Promise<void>}
20
18
  */
21
19
  async execute() {
22
20
  try {
23
- const handlerSolution = await (0, _helpers_1.retry)({
24
- callback: async (attempt) => {
25
- this.currentAttempt = attempt;
26
- const waitHandler = await this.waitForHandler();
27
- if (waitHandler instanceof exception_1.Exception) {
28
- return waitHandler;
29
- }
30
- const handlerSolutionCallback = await waitHandler.call(this);
31
- if ([_enums_1.RetryAction.Default, _enums_1.RetryAction.Retry].includes(handlerSolutionCallback)) {
32
- throw new RetryException_1.RetryException("Force Retry Action Default", undefined, handlerSolutionCallback);
33
- }
34
- return handlerSolutionCallback;
35
- },
36
- times: await this.attempt(),
37
- sleep: await this.sleep?.(),
38
- when: this.retrying?.bind(this),
39
- });
21
+ const handlerSolution = await this.executeHandlerFunction();
40
22
  if (handlerSolution instanceof exception_1.Exception) {
41
23
  throw handlerSolution;
42
24
  }
@@ -53,13 +35,32 @@ class BaseHandler {
53
35
  }
54
36
  }
55
37
  /**
56
- * Use if you handler identify a successful response
38
+ * A convenience method to return a success solution.
57
39
  *
58
40
  * @returns {Promise<HandlerSolutionType>}
59
41
  */
60
42
  async successSolution() {
61
43
  return _enums_1.RetryAction.Resolve;
62
44
  }
45
+ async executeHandlerFunction() {
46
+ const handlerSolution = await (0, _helpers_1.retry)({
47
+ callback: async () => {
48
+ ++this.currentAttempt;
49
+ const waitHandler = await this.waitForHandler();
50
+ if (waitHandler instanceof exception_1.Exception) {
51
+ return waitHandler;
52
+ }
53
+ return waitHandler.call(this);
54
+ },
55
+ times: await this.attempt(),
56
+ sleep: await this.sleep?.(),
57
+ when: this.retrying?.bind(this),
58
+ });
59
+ if (handlerSolution === _enums_1.RetryAction.Retry) {
60
+ return this.executeHandlerFunction();
61
+ }
62
+ return handlerSolution;
63
+ }
63
64
  }
64
65
  exports.BaseHandler = BaseHandler;
65
66
  //# sourceMappingURL=BaseHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseHandler.js","sourceRoot":"","sources":["../../../src/crawler/Handlers/BaseHandler.ts"],"names":[],"mappings":";;;AAAA,8CAA6D;AAE7D,mCAAqC;AACrC,+DAA4D;AAC5D,uCAAiC;AASjC,MAAsB,WAAW;IAQT;IACA;IAJb,cAAc,GAAW,CAAC,CAAC;IAElC,YACoB,IAAoB,EACpB,GAAqB;QADrB,SAAI,GAAJ,IAAI,CAAgB;QACpB,QAAG,GAAH,GAAG,CAAkB;IAEzC,CAAC;IAkDD;;;;OAIG;IACI,KAAK,CAAC,OAAO;QAChB,IAAI,CAAC;YACD,MAAM,eAAe,GAAG,MAAM,IAAA,gBAAK,EAAC;gBAChC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;oBACxB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;oBAC9B,MAAM,WAAW,G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C,cAAc,EAAE,CAAC;gBAEhD,IAAI,WAAW,YAAY,qBAAS,EAAE,CAAC;oBACnC,OAAO,WAAW,CAAC;gBACvB,CAAC;gBAED,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClC,CAAC;YACD,KAAK,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE;YAC3B,KAAK,EAAE,MAAM,IAAI,CAAC,KAAK,EAAE,EAAE;YAC3B,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC;SAClC,CAAC,CAAC;QAEH,IAAI,eAAe,KAAK,oBAAW,CAAC,KAAK,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC,sBAAsB,EAAE,CAAC;QACzC,CAAC;QAED,OAAO,eAAe,CAAC;IAC3B,CAAC;CAoBJ;AA5ID,kCA4IC"}
@@ -1,24 +1,58 @@
1
- import { type Exception } from "@odg/exception";
2
- import { type RetryAction } from "../../Enums";
3
- import { type AttemptableInterface } from "../../Interfaces/AttemptableFlow";
4
- export type HandlerSolutionType = Exception | Exclude<RetryAction, RetryAction.Throw>;
5
- export type HandlerFunction = Exception | (() => Promise<HandlerSolution | HandlerSolutionType>);
1
+ import type { Exception } from "@odg/exception";
2
+ import type { RetryAction } from "../../Enums";
3
+ import type { AttemptableInterface } from "../../Interfaces/AttemptableFlow";
6
4
  /**
7
- * State Handler Function
5
+ * Represents the possible return types from a handler function's execution.
8
6
  *
9
- * Resolve - To Resolve Handler
10
- * Retry - To Execute Handler retry
7
+ * This type union defines the allowed outcomes that can be returned by a handler,
8
+ * which guide the retry mechanism and control flow of the handler execution cycle.
11
9
  *
12
- * @deprecated Use RetryAction enum and HandlerSolutionType type instead
13
- * @enum {string}
10
+ * Handler functions can return the following values:
11
+ *
12
+ * - **`Exception`**: When an `Exception` instance is returned (not thrown), it indicates
13
+ * that an error occurred and the process must be interrupted. No further retries will be
14
+ * performed, and the handler will terminate with the returned error. This has the same
15
+ * utility as `RetryAction.Throw`, but `RetryAction.Throw` cannot be used in this context
16
+ * because no error has occurred yet - the return itself indicates the error condition.
17
+ *
18
+ * - **`RetryAction.Retry`**: Forces a retry by restarting the entire handler execution from
19
+ * the beginning. When this action is returned, the attempt counter is reset, so if you
20
+ * configured 3 attempts and return `RetryAction.Retry`, it will start counting the 3 attempts
21
+ * from zero again. Additionally, this action does *not* call the `retrying` method, which is
22
+ * normally called on all retry attempts. **Warning**: This is discouraged as improper use can
23
+ * lead to infinite loops.
24
+ *
25
+ * - **`RetryAction.Resolve`**: Indicates that the handler completed successfully. The expected
26
+ * condition was met, and the code can proceed to the next step of the robot workflow.
27
+ *
28
+ * The following `RetryAction` values are explicitly **not supported** and are excluded
29
+ * from this type:
30
+ *
31
+ * - **`RetryAction.Throw`**: Not supported in Handler Solutions. Use returning an `Exception`
32
+ * instance instead when you need to signal an error condition.
33
+ *
34
+ * - **`RetryAction.Default`**: Not supported in Handler Solutions. To simulate retry behavior
35
+ * when an error condition is detected, throw an exception instead (e.g., `throw new Exception("Page did not load")`).
36
+ * This will attempt the number of times configured in the `attempt` method. If all attempts
37
+ * fail and the same condition occurs again, it will terminate with that error or any other
38
+ * error that may have occurred.
14
39
  */
15
- export declare enum HandlerSolution {
16
- Resolve = "Resolve",
17
- Retry = "Retry"
18
- }
40
+ export type HandlerSolutionType = Exception | Exclude<RetryAction, RetryAction.Default | RetryAction.Throw>;
41
+ /**
42
+ * When an `Exception` *thrown* during a handler's execution,
43
+ * it will trigger the standard retry mechanism.
44
+ *
45
+ * `RetryAction.Throw` is explicitly excluded from `HandlerSolutionType` because
46
+ * returning it directly from a handler function has no specific effect in this context.
47
+ */
48
+ export type HandlerFunction = Exception | (() => Promise<HandlerSolutionType>);
19
49
  export interface HandlerInterface extends AttemptableInterface {
20
50
  /**
21
51
  * Execute step
52
+ * Waits for and returns the handler function to be executed.
53
+ *
54
+ * This method allows for preliminary checks or setup before returning the core
55
+ * logic of the handler, which will then be executed by the `BaseHandler`.
22
56
  *
23
57
  * @memberof HandlerInterface
24
58
  * @returns {Promise<HandlerFunction>}
@@ -1,18 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HandlerSolution = void 0;
4
- /**
5
- * State Handler Function
6
- *
7
- * Resolve - To Resolve Handler
8
- * Retry - To Execute Handler retry
9
- *
10
- * @deprecated Use RetryAction enum and HandlerSolutionType type instead
11
- * @enum {string}
12
- */
13
- var HandlerSolution;
14
- (function (HandlerSolution) {
15
- HandlerSolution["Resolve"] = "Resolve";
16
- HandlerSolution["Retry"] = "Retry";
17
- })(HandlerSolution || (exports.HandlerSolution = HandlerSolution = {}));
18
3
  //# sourceMappingURL=HandlerInterface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HandlerInterface.js","sourceRoot":"","sources":["../../../src/crawler/Interfaces/HandlerInterface.ts"],"names":[],"mappings":";;;AAUA;;;;;;;;GAQG;AACH,IAAY,eAGX;AAHD,WAAY,eAAe;IACvB,sCAAmB,CAAA;IACnB,kCAAe,CAAA;AACnB,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B"}
1
+ {"version":3,"file":"HandlerInterface.js","sourceRoot":"","sources":["../../../src/crawler/Interfaces/HandlerInterface.ts"],"names":[],"mappings":""}
@@ -1,3 +1,3 @@
1
- import { type AttemptableInterface } from "../../Interfaces";
1
+ import type { AttemptableInterface } from "../../Interfaces";
2
2
  export interface PageInterface extends AttemptableInterface {
3
3
  }
@@ -1,2 +1,2 @@
1
1
  export type * from "./PageInterface";
2
- export * from "./HandlerInterface";
2
+ export type * from "./HandlerInterface";
@@ -1,18 +1,3 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./HandlerInterface"), exports);
18
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/crawler/Interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/crawler/Interfaces/index.ts"],"names":[],"mappings":""}
@@ -1,8 +1,8 @@
1
1
  import { ContextChemicalXInterface, ContextEngineInterface, type GetterAccessInterface, type PageChemicalXInterface, type PageEngineInterface } from "..";
2
- export declare class Page<ContextEngineType extends ContextEngineInterface, PageEngineType extends PageEngineInterface> implements GetterAccessInterface, PageChemicalXInterface<PageEngineType> {
3
- readonly $context: ContextChemicalXInterface<ContextEngineType>;
4
- readonly $pageInstance: PageEngineType;
5
- constructor($context: ContextChemicalXInterface<ContextEngineType>, $pageInstance: PageEngineType);
6
- context(): ContextChemicalXInterface<ContextEngineType>;
2
+ export declare class Page<ContextClassEngine extends ContextEngineInterface, PageClassEngine extends PageEngineInterface> implements GetterAccessInterface, PageChemicalXInterface<PageClassEngine> {
3
+ readonly $context: ContextChemicalXInterface<ContextClassEngine>;
4
+ readonly $pageInstance: PageClassEngine;
5
+ constructor($context: ContextChemicalXInterface<ContextClassEngine>, $pageInstance: PageClassEngine);
6
+ context(): ContextChemicalXInterface<ContextClassEngine> & ContextClassEngine;
7
7
  __get(key: PropertyKey): unknown;
8
8
  }
@@ -33,7 +33,7 @@ let Page = class Page {
33
33
  };
34
34
  exports.Page = Page;
35
35
  exports.Page = Page = __decorate([
36
- (0, __1.getAccessDecorator)(),
36
+ __1.ODGDecorators.getterAccess(),
37
37
  __metadata("design:paramtypes", [Object, Object])
38
38
  ], Page);
39
39
  //# sourceMappingURL=Page.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Page.js","sourceRoot":"","sources":["../../src/crawler/Page.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAMY;AAGL,IAAM,IAAI,GAAV,MAAM,IAAI;IAMO;IACA;IAFpB,YACoB,QAAsD,EACtD,aAA6B;QAD7B,aAAQ,GAAR,QAAQ,CAA8C;QACtD,kBAAa,GAAb,aAAa,CAAgB;IAGjD,CAAC;IAEM,OAAO;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,GAAgB;QACzB,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACd,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAClC,CAAC;QAED,MAAM,aAAa,GAAI,IAAI,CAAC,aAA8C,CAAC,GAAG,CAAC,CAAC;QAEhF,OAAO,OAAO,aAAa,KAAK,UAAU;YACtC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;YACxC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;IAC/C,CAAC;CAEJ,CAAA;AA5BY,oBAAI;eAAJ,IAAI;IADhB,IAAA,sBAAkB,GAAE;;GACR,IAAI,CA4BhB"}
1
+ {"version":3,"file":"Page.js","sourceRoot":"","sources":["../../src/crawler/Page.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0BAOY;AAGL,IAAM,IAAI,GAAV,MAAM,IAAI;IAMO;IACA;IAFpB,YACoB,QAAuD,EACvD,aAA8B;QAD9B,aAAQ,GAAR,QAAQ,CAA+C;QACvD,kBAAa,GAAb,aAAa,CAAiB;IAGlD,CAAC;IAEM,OAAO;QACV,OAAO,IAAI,CAAC,QAA8E,CAAC;IAC/F,CAAC;IAEM,KAAK,CAAC,GAAgB;QACzB,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACd,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAClC,CAAC;QAED,MAAM,aAAa,GAAI,IAAI,CAAC,aAA8C,CAAC,GAAG,CAAC,CAAC;QAEhF,OAAO,OAAO,aAAa,KAAK,UAAU;YACtC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;YACxC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;IAC/C,CAAC;CAEJ,CAAA;AA5BY,oBAAI;eAAJ,IAAI;IADhB,iBAAa,CAAC,YAAY,EAAE;;GAChB,IAAI,CA4BhB"}
@@ -1,10 +1,8 @@
1
- import { type Exception } from "@odg/exception";
2
- import { type PageInterface, type RetryAction } from "../..";
3
- import { type PageEngineInterface } from "../index";
4
- import { type SelectorType } from "../Selectors/SelectorsType";
5
- export declare abstract class BasePage<SelectorBaseType, PageClassEngine extends PageEngineInterface> implements PageInterface {
6
- readonly page: PageClassEngine;
7
- readonly $$s: SelectorBaseType;
1
+ import type { Exception } from "@odg/exception";
2
+ import type { PageInterface, RetryAction } from "../..";
3
+ import type { PageEngineInterface } from "../index";
4
+ import type { SelectorType } from "../Selectors/SelectorsType";
5
+ export declare abstract class BasePage<PageClassEngine extends PageEngineInterface> implements PageInterface {
8
6
  /**
9
7
  * Current attempt number
10
8
  *
@@ -12,26 +10,21 @@ export declare abstract class BasePage<SelectorBaseType, PageClassEngine extends
12
10
  * @memberof BasePage
13
11
  */
14
12
  currentAttempt: number;
15
- constructor(page: PageClassEngine, $$s: SelectorBaseType);
13
+ page?: PageClassEngine;
16
14
  /**
17
- * Pre Start Page
15
+ * Selector of this page
18
16
  *
19
- * @deprecated removed (Empty function)
17
+ * @type {SelectorType}
20
18
  * @memberof BasePage
21
19
  */
22
- preStart(): Promise<void>;
20
+ abstract readonly $s?: SelectorType;
21
+ abstract readonly $$s?: Record<number | string | symbol, SelectorType>;
22
+ setPage(page: PageClassEngine): this;
23
23
  success?(): Promise<void>;
24
- finish?(exception?: Exception | undefined): Promise<void>;
24
+ finish?(exception?: Exception): Promise<void>;
25
25
  failure?(exception: Exception): Promise<void>;
26
26
  retrying?(exception: Exception, attempt: number): Promise<RetryAction>;
27
27
  sleep?(): Promise<number>;
28
- /**
29
- * Selector of this page
30
- *
31
- * @type {SelectorType}
32
- * @memberof BasePage
33
- */
34
- abstract readonly $s: SelectorType;
35
28
  abstract execute(): Promise<void>;
36
29
  abstract attempt(): Promise<number>;
37
30
  }
@@ -2,8 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BasePage = void 0;
4
4
  class BasePage {
5
- page;
6
- $$s;
7
5
  /**
8
6
  * Current attempt number
9
7
  *
@@ -11,18 +9,10 @@ class BasePage {
11
9
  * @memberof BasePage
12
10
  */
13
11
  currentAttempt = 0;
14
- constructor(page, $$s) {
12
+ page;
13
+ setPage(page) {
15
14
  this.page = page;
16
- this.$$s = $$s;
17
- }
18
- /**
19
- * Pre Start Page
20
- *
21
- * @deprecated removed (Empty function)
22
- * @memberof BasePage
23
- */
24
- async preStart() {
25
- // Deprecated AttemptableFlow implement currentAttempt Count
15
+ return this;
26
16
  }
27
17
  }
28
18
  exports.BasePage = BasePage;
@@ -1 +1 @@
1
- {"version":3,"file":"BasePage.js","sourceRoot":"","sources":["../../../src/crawler/Pages/BasePage.ts"],"names":[],"mappings":";;;AAMA,MAAsB,QAAQ;IAWN;IACA;IAVpB;;;;;OAKG;IACI,cAAc,GAAW,CAAC,CAAC;IAElC,YACoB,IAAqB,EACrB,GAAqB;QADrB,SAAI,GAAJ,IAAI,CAAiB;QACrB,QAAG,GAAH,GAAG,CAAkB;IAEzC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,QAAQ;QACjB,4DAA4D;IAChE,CAAC;CAyBJ;AAjDD,4BAiDC"}
1
+ {"version":3,"file":"BasePage.js","sourceRoot":"","sources":["../../../src/crawler/Pages/BasePage.ts"],"names":[],"mappings":";;;AAMA,MAAsB,QAAQ;IAI1B;;;;;OAKG;IACI,cAAc,GAAW,CAAC,CAAC;IAE3B,IAAI,CAAmB;IAYvB,OAAO,CAAC,IAAqB;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,OAAO,IAAI,CAAC;IAChB,CAAC;CAgBJ;AA5CD,4BA4CC"}
@@ -1,4 +1,4 @@
1
- import { type PageEngineInterface } from "../../index";
1
+ import type { PageEngineInterface } from "../../index";
2
2
  import { BasePage } from "../BasePage";
3
- export declare abstract class BaseComponentPage<SelectorBaseType, PageClassEngine extends PageEngineInterface> extends BasePage<SelectorBaseType, PageClassEngine> {
3
+ export declare abstract class BaseComponentPage<PageClassEngine extends PageEngineInterface> extends BasePage<PageClassEngine> {
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BaseComponentPage.js","sourceRoot":"","sources":["../../../../src/crawler/Pages/Components/BaseComponentPage.ts"],"names":[],"mappings":";;;AACA,0CAAuC;AAEvC,MAAsB,iBAGpB,SAAQ,mBAA2C;CAEpD;AALD,8CAKC"}
1
+ {"version":3,"file":"BaseComponentPage.js","sourceRoot":"","sources":["../../../../src/crawler/Pages/Components/BaseComponentPage.ts"],"names":[],"mappings":";;;AACA,0CAAuC;AAEvC,MAAsB,iBAEpB,SAAQ,mBAAyB;CAElC;AAJD,8CAIC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from "./Support";
2
2
  export * from "./Helpers/index";
3
3
  export * from "./crawler/index";
4
- export * from "./Interfaces";
4
+ export type * from "./Interfaces";
5
5
  export * from "./Exceptions";
6
6
  export * from "./Enums";
package/dist/index.js CHANGED
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Support"), exports);
18
18
  __exportStar(require("./Helpers/index"), exports);
19
19
  __exportStar(require("./crawler/index"), exports);
20
- __exportStar(require("./Interfaces"), exports);
21
20
  __exportStar(require("./Exceptions"), exports);
22
21
  __exportStar(require("./Enums"), exports);
23
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAE1B,kDAAgC;AAEhC,kDAAgC;AAEhC,+CAA6B;AAE7B,+CAA6B;AAE7B,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAE1B,kDAAgC;AAEhC,kDAAgC;AAIhC,+CAA6B;AAE7B,0CAAwB"}