@odg/chemical-x 1.29.0 → 2.0.1
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/Container.d.ts +3 -47
- package/dist/Container.js +3 -23
- package/dist/Container.js.map +1 -1
- package/dist/Helpers/index.d.ts +1 -1
- package/dist/Helpers/index.js +1 -1
- package/dist/Helpers/index.js.map +1 -1
- package/dist/Helpers/retry.d.ts +1 -1
- package/dist/Helpers/retry.js +2 -2
- package/dist/Helpers/retry.js.map +1 -1
- package/dist/Helpers/sleep.d.ts +1 -1
- package/dist/Helpers/{throwIf.d.ts → throw-if.d.ts} +1 -1
- package/dist/Helpers/{throwIf.js → throw-if.js} +1 -1
- package/dist/Helpers/throw-if.js.map +1 -0
- package/dist/Helpers/timeout.d.ts +1 -1
- package/dist/Helpers/timeout.js +1 -1
- package/dist/Helpers/timeout.js.map +1 -1
- package/dist/Interfaces/AttemptableFlow.d.ts +5 -5
- package/dist/Interfaces/RetryInterface.d.ts +6 -6
- package/dist/Interfaces/TimeoutInterface.d.ts +1 -1
- package/dist/Interfaces/index.d.ts +1 -1
- package/dist/Interfaces/index.js +0 -15
- package/dist/Interfaces/index.js.map +1 -1
- package/dist/Support/Arr.d.ts +1 -7
- package/dist/Support/Arr.js +0 -6
- package/dist/Support/Arr.js.map +1 -1
- package/dist/Support/Decorators/OdgDecorators.d.ts +15 -0
- package/dist/Support/Decorators/{ODGDecorators.js → OdgDecorators.js} +43 -28
- package/dist/Support/Decorators/OdgDecorators.js.map +1 -0
- package/dist/Support/Decorators/index.d.ts +1 -2
- package/dist/Support/Decorators/index.js +1 -2
- package/dist/Support/Decorators/index.js.map +1 -1
- package/dist/Support/Num.d.ts +1 -1
- package/dist/Support/Num.js.map +1 -1
- package/dist/Support/Str.d.ts +2 -2
- package/dist/Support/Str.js +6 -6
- package/dist/Support/Str.js.map +1 -1
- package/dist/crawler/@types/Browser.d.ts +1 -1
- package/dist/crawler/@types/Context.d.ts +1 -2
- package/dist/crawler/@types/ManagerBrowserType.d.ts +4 -4
- package/dist/crawler/@types/Page.d.ts +3 -4
- package/dist/crawler/Browser.d.ts +7 -7
- package/dist/crawler/Browser.js +1 -1
- package/dist/crawler/Browser.js.map +1 -1
- package/dist/crawler/BrowserManager.d.ts +5 -5
- package/dist/crawler/BrowserManager.js.map +1 -1
- package/dist/crawler/Context.d.ts +7 -7
- package/dist/crawler/Context.js +2 -2
- package/dist/crawler/Context.js.map +1 -1
- package/dist/crawler/Handlers/BaseHandler.d.ts +8 -7
- package/dist/crawler/Handlers/BaseHandler.js +3 -4
- package/dist/crawler/Handlers/BaseHandler.js.map +1 -1
- package/dist/crawler/Interfaces/HandlerInterface.d.ts +34 -15
- package/dist/crawler/Interfaces/PageInterface.d.ts +1 -1
- package/dist/crawler/Interfaces/index.d.ts +1 -1
- package/dist/crawler/Interfaces/index.js +0 -15
- package/dist/crawler/Interfaces/index.js.map +1 -1
- package/dist/crawler/Page.d.ts +5 -5
- package/dist/crawler/Page.js +1 -1
- package/dist/crawler/Page.js.map +1 -1
- package/dist/crawler/Pages/BasePage.d.ts +12 -19
- package/dist/crawler/Pages/BasePage.js +3 -13
- package/dist/crawler/Pages/BasePage.js.map +1 -1
- package/dist/crawler/Pages/Components/BaseComponentPage.d.ts +2 -2
- package/dist/crawler/Pages/Components/BaseComponentPage.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +37 -19
- package/dist/Helpers/throwIf.js.map +0 -1
- package/dist/Support/Decorators/GetterDecorator.d.ts +0 -1
- package/dist/Support/Decorators/GetterDecorator.js +0 -18
- package/dist/Support/Decorators/GetterDecorator.js.map +0 -1
- package/dist/Support/Decorators/ODGDecorators.d.ts +0 -15
- package/dist/Support/Decorators/ODGDecorators.js.map +0 -1
package/dist/Container.d.ts
CHANGED
|
@@ -1,51 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypedContainer } from "@inversifyjs/strongly-typed";
|
|
2
2
|
/**
|
|
3
|
-
* @template
|
|
4
|
-
* @template {string} Name Keyof of interface
|
|
3
|
+
* @template ContainerType
|
|
5
4
|
*/
|
|
6
|
-
export declare class Container<ContainerType extends
|
|
7
|
-
/**
|
|
8
|
-
* Get Container Item
|
|
9
|
-
*
|
|
10
|
-
* @template {string} Name Keyof of interface
|
|
11
|
-
* @param {Name} serviceIdentifier containerName
|
|
12
|
-
* @returns {ContainerType[Name]}
|
|
13
|
-
*/
|
|
14
|
-
get<Name extends keyof ContainerType>(serviceIdentifier: Name): ContainerType[Name];
|
|
15
|
-
get<Name>(serviceIdentifier: string): Name;
|
|
16
|
-
/**
|
|
17
|
-
* Get Container Item
|
|
18
|
-
*
|
|
19
|
-
* @template {string} Name
|
|
20
|
-
* @param {Name} serviceIdentifier containerName
|
|
21
|
-
* @returns {ContainerType[Name] | undefined}
|
|
22
|
-
*/
|
|
5
|
+
export declare class Container<ContainerType extends object = Record<string, unknown>> extends TypedContainer<ContainerType> {
|
|
23
6
|
getOptional<Name extends keyof ContainerType>(serviceIdentifier: Name): ContainerType[Name] | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Bind Container Item
|
|
26
|
-
*
|
|
27
|
-
* @template {string} Name
|
|
28
|
-
* @param {Name} serviceIdentifier containerName
|
|
29
|
-
* @returns {interfaces.BindingToSyntax<ContainerType[Name]>}
|
|
30
|
-
*/
|
|
31
|
-
bind<Name extends keyof ContainerType>(serviceIdentifier: Name): interfaces.BindingToSyntax<ContainerType[Name]>;
|
|
32
|
-
bind<Name>(serviceIdentifier: string): interfaces.BindingToSyntax<Name>;
|
|
33
|
-
/**
|
|
34
|
-
* Get Async Container Item
|
|
35
|
-
*
|
|
36
|
-
* @template {string} Name
|
|
37
|
-
* @param {Name} serviceIdentifier containerName
|
|
38
|
-
* @returns {Promise<ContainerType[Name]>}
|
|
39
|
-
*/
|
|
40
|
-
getAsync<Name extends keyof ContainerType>(serviceIdentifier: Name): Promise<ContainerType[Name]>;
|
|
41
|
-
getAsync<Name>(serviceIdentifier: interfaces.ServiceIdentifier<Name>): Promise<Name>;
|
|
42
|
-
/**
|
|
43
|
-
* Get Container Item
|
|
44
|
-
*
|
|
45
|
-
* @template {string} Name
|
|
46
|
-
* @param {Name} serviceIdentifier containerName
|
|
47
|
-
* @returns {boolean}
|
|
48
|
-
*/
|
|
49
|
-
isBound<Name extends keyof ContainerType>(serviceIdentifier: Name): boolean;
|
|
50
|
-
isBound<Name>(serviceIdentifier: string): Name;
|
|
51
7
|
}
|
package/dist/Container.js
CHANGED
|
@@ -1,36 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Container = void 0;
|
|
4
|
-
const
|
|
4
|
+
const strongly_typed_1 = require("@inversifyjs/strongly-typed");
|
|
5
5
|
/**
|
|
6
|
-
* @template
|
|
7
|
-
* @template {string} Name Keyof of interface
|
|
6
|
+
* @template ContainerType
|
|
8
7
|
*/
|
|
9
|
-
class Container extends
|
|
10
|
-
get(serviceIdentifier) {
|
|
11
|
-
return super.get(serviceIdentifier);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Get Container Item
|
|
15
|
-
*
|
|
16
|
-
* @template {string} Name
|
|
17
|
-
* @param {Name} serviceIdentifier containerName
|
|
18
|
-
* @returns {ContainerType[Name] | undefined}
|
|
19
|
-
*/
|
|
8
|
+
class Container extends strongly_typed_1.TypedContainer {
|
|
20
9
|
getOptional(serviceIdentifier) {
|
|
21
10
|
if (!this.isBound(serviceIdentifier))
|
|
22
11
|
return;
|
|
23
12
|
return super.get(serviceIdentifier);
|
|
24
13
|
}
|
|
25
|
-
bind(serviceIdentifier) {
|
|
26
|
-
return super.bind(serviceIdentifier);
|
|
27
|
-
}
|
|
28
|
-
async getAsync(serviceIdentifier) {
|
|
29
|
-
return super.getAsync(serviceIdentifier);
|
|
30
|
-
}
|
|
31
|
-
isBound(serviceIdentifier) {
|
|
32
|
-
return super.isBound(serviceIdentifier);
|
|
33
|
-
}
|
|
34
14
|
}
|
|
35
15
|
exports.Container = Container;
|
|
36
16
|
//# sourceMappingURL=Container.js.map
|
package/dist/Container.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Container.js","sourceRoot":"","sources":["../src/Container.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Container.js","sourceRoot":"","sources":["../src/Container.ts"],"names":[],"mappings":";;;AAAA,gEAA6D;AAE7D;;GAEG;AACH,MAAa,SAEX,SAAQ,+BAA6B;IAE5B,WAAW,CACd,iBAAuB;QAEvB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC;YAAE,OAAO;QAE7C,OAAO,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAwB,CAAC;IAC/D,CAAC;CAEJ;AAZD,8BAYC"}
|
package/dist/Helpers/index.d.ts
CHANGED
package/dist/Helpers/index.js
CHANGED
|
@@ -17,5 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./sleep"), exports);
|
|
18
18
|
__exportStar(require("./retry"), exports);
|
|
19
19
|
__exportStar(require("./timeout"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
20
|
+
__exportStar(require("./throw-if"), exports);
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AAExB,0CAAwB;AAExB,4CAA0B;AAE1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AAExB,0CAAwB;AAExB,4CAA0B;AAE1B,6CAA2B"}
|
package/dist/Helpers/retry.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { RetryOptionsInterface, RetryWhenDefaultInterface, RetryWhenResolveInterface } from "../Interfaces";
|
|
2
2
|
export declare function retry<ReturnType>(options: RetryOptionsInterface<ReturnType> & RetryWhenDefaultInterface): Promise<ReturnType>;
|
|
3
3
|
export declare function retry<ReturnType>(options: RetryOptionsInterface<ReturnType> & RetryWhenResolveInterface): Promise<ReturnType | undefined>;
|
package/dist/Helpers/retry.js
CHANGED
|
@@ -25,14 +25,14 @@ async function getWhen(exception, options) {
|
|
|
25
25
|
* Retry Function recursive
|
|
26
26
|
*
|
|
27
27
|
* @template {any} ReturnType
|
|
28
|
-
* @param {RetryOptionsInterface<ReturnType> & { attempt: number }} options
|
|
28
|
+
* @param {RetryOptionsInterface<ReturnType> & { attempt: number }} options Retry action all params options
|
|
29
29
|
* @returns {Promise<ReturnType | undefined>}
|
|
30
30
|
*/
|
|
31
31
|
async function retryHelper(options) {
|
|
32
32
|
(0, _1.throwIf)(typeof options.times !== "number" || Number.isNaN(options.times), () => new RetryException_1.RetryException("Attempt is not a number"));
|
|
33
33
|
try {
|
|
34
34
|
(0, _1.throwIf)(!!options.signal?.aborted, () => new exception_1.AbortException(exception_1.AbortException.parseOrDefault(options.signal?.reason, "Retry Aborted").message));
|
|
35
|
-
return await options.callback
|
|
35
|
+
return await options.callback(options.attempt, options.signal);
|
|
36
36
|
}
|
|
37
37
|
catch (exception) {
|
|
38
38
|
const when = await getWhen(exception, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/Helpers/retry.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/Helpers/retry.ts"],"names":[],"mappings":";;AAmFA,sBAOC;AA1FD,8CAAgD;AAEhD,mCAAqC;AACrC,+DAA4D;AAO5D,wBAAmC;AAEnC,KAAK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,CAC3G,CAAC;QAEF,OAAO,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;IAAC,OAAO,SAAkB,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE/C,IAAI,IAAI,KAAK,oBAAW,CAAC,OAAO,EAAE,CAAC;YAC/B,OAAO;QACX,CAAC;QAED,MAAM,IAAA,QAAK,EAAC,OAAO,CAAC,KAAK,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAE5D,OAAO,WAAW,CAAC;YACf,GAAG,OAAO;YACV,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,CAAC;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,CAAC;SAC/B,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAUM,KAAK,UAAU,KAAK,CACvB,OAA0C;IAE1C,OAAO,WAAW,CAAC;QACf,GAAG,OAAO;QACV,OAAO,EAAE,CAAC;KACb,CAAC,CAAC;AACP,CAAC"}
|
package/dist/Helpers/sleep.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Exception } from "@odg/exception";
|
|
2
2
|
export declare function throwIf(condition: true, exception: () => Exception): never;
|
|
3
3
|
export declare function throwIf(condition: false, exception: () => Exception): void;
|
|
4
4
|
export declare function throwIf(condition: boolean, exception: () => Exception): never | void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throw-if.js","sourceRoot":"","sources":["../../src/Helpers/throw-if.ts"],"names":[],"mappings":";;AA0BA,0BAIC;AAbD;;;;;;;;GAQG;AACH,SAAgB,OAAO,CAAC,SAAkB,EAAE,SAA0B;IAClE,IAAI,SAAS,EAAE,CAAC;QACZ,MAAM,SAAS,EAAE,CAAC;IACtB,CAAC;AACL,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TimeoutOptionsInterface } from "../Interfaces";
|
|
2
2
|
export declare function timeout<ReturnType>(options: TimeoutOptionsInterface<ReturnType>): Promise<ReturnType>;
|
package/dist/Helpers/timeout.js
CHANGED
|
@@ -10,7 +10,7 @@ async function timeout(options) {
|
|
|
10
10
|
}
|
|
11
11
|
return Promise.race([
|
|
12
12
|
Promise.resolve()
|
|
13
|
-
.then(async () => options.callback
|
|
13
|
+
.then(async () => options.callback()),
|
|
14
14
|
(0, _1.sleep)(options.timeout).then(() => {
|
|
15
15
|
throw new TimeoutException_1.TimeoutException(`${options.name || "Default"} - Timeout ${options.timeout}ms exceeded`);
|
|
16
16
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeout.js","sourceRoot":"","sources":["../../src/Helpers/timeout.ts"],"names":[],"mappings":";;AAQA,0BAcC;AAtBD,6CAAuD;AACvD,mEAAgE;AAKhE,wBAA0B;AAEnB,KAAK,UAAU,OAAO,CACzB,OAA4C;IAE5C,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,sCAAwB,CAAC,yBAAyB,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC;QAChB,OAAO,CAAC,OAAO,EAAE;aACZ,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"timeout.js","sourceRoot":"","sources":["../../src/Helpers/timeout.ts"],"names":[],"mappings":";;AAQA,0BAcC;AAtBD,6CAAuD;AACvD,mEAAgE;AAKhE,wBAA0B;AAEnB,KAAK,UAAU,OAAO,CACzB,OAA4C;IAE5C,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,sCAAwB,CAAC,yBAAyB,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC;QAChB,OAAO,CAAC,OAAO,EAAE;aACZ,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzC,IAAA,QAAK,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAC7B,MAAM,IAAI,mCAAgB,CAAC,GAAG,OAAO,CAAC,IAAK,IAAI,SAAS,cAAc,OAAO,CAAC,OAAO,aAAa,CAAC,CAAC;QACxG,CAAC,CAAC;KACL,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { Exception } from "@odg/exception";
|
|
2
|
+
import type { RetryAction } from "../Enums";
|
|
3
|
+
import type { RetryOptionsInterface } from ".";
|
|
4
4
|
export interface AttemptableInterface {
|
|
5
5
|
currentAttempt: number;
|
|
6
6
|
/**
|
|
@@ -24,7 +24,7 @@ export interface AttemptableInterface {
|
|
|
24
24
|
*
|
|
25
25
|
* Return a retry action to control retry behavior.
|
|
26
26
|
*
|
|
27
|
-
* @param {Exception} exception Exception
|
|
27
|
+
* @param {Exception} exception Last Exception to dispatch this function
|
|
28
28
|
* @param {number} attempt Current attempt (starts at 1).
|
|
29
29
|
* @returns {Promise<RetryAction>}
|
|
30
30
|
*/
|
|
@@ -35,7 +35,7 @@ export interface AttemptableInterface {
|
|
|
35
35
|
* Use this to handle final failure logic.
|
|
36
36
|
* You should re-throw the exception if needed.
|
|
37
37
|
*
|
|
38
|
-
* @param {Exception} exception
|
|
38
|
+
* @param {Exception} exception Last exception in attemptableFlow
|
|
39
39
|
* @returns {Promise<void>}
|
|
40
40
|
*/
|
|
41
41
|
failure?(exception: Exception): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { Exception } from "@odg/exception";
|
|
2
|
+
import type { PromiseOrSyncType } from "../types/index";
|
|
3
|
+
import type { RetryAction } from "../Enums";
|
|
4
4
|
/**
|
|
5
5
|
* Defines the options for a retry operation.
|
|
6
6
|
*
|
|
@@ -10,7 +10,7 @@ import { type RetryAction } from "../Enums";
|
|
|
10
10
|
export interface RetryOptionsInterface<ReturnType = undefined> {
|
|
11
11
|
/**
|
|
12
12
|
* Number of times to retry
|
|
13
|
-
* 0 = No retry
|
|
13
|
+
* 0,1 = No retry only first attempt
|
|
14
14
|
*
|
|
15
15
|
* @type {number}
|
|
16
16
|
* @memberof RetryOptionsInterface
|
|
@@ -71,7 +71,7 @@ export interface RetryWhenResolveInterface {
|
|
|
71
71
|
*
|
|
72
72
|
* @param {Exception} exception The exception caught during the attempt.
|
|
73
73
|
* @param {number} times The number of attempts made so far. (starts at 1).
|
|
74
|
-
* @returns {PromiseOrSyncType<RetryAction
|
|
74
|
+
* @returns {PromiseOrSyncType<RetryAction>}
|
|
75
75
|
*/
|
|
76
|
-
when?(exception: Exception, times: number): PromiseOrSyncType<RetryAction
|
|
76
|
+
when?(exception: Exception, times: number): PromiseOrSyncType<RetryAction>;
|
|
77
77
|
}
|
package/dist/Interfaces/index.js
CHANGED
|
@@ -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("../crawler/Interfaces"), exports);
|
|
18
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Interfaces/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Interfaces/index.ts"],"names":[],"mappings":""}
|
package/dist/Support/Arr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CloneableInterface } from "../Interfaces";
|
|
2
2
|
/**
|
|
3
3
|
* Arr Class Helper
|
|
4
4
|
*
|
|
@@ -9,12 +9,6 @@ import { type CloneableInterface } from "../Interfaces";
|
|
|
9
9
|
export declare class Arr<Type extends unknown[]> implements CloneableInterface {
|
|
10
10
|
private readonly subject;
|
|
11
11
|
constructor(subject: Type);
|
|
12
|
-
/**
|
|
13
|
-
* Clone This Object
|
|
14
|
-
*
|
|
15
|
-
* @memberof Arr
|
|
16
|
-
* @returns {Arr<Array<Type[number]>>}
|
|
17
|
-
*/
|
|
18
12
|
clone(): Arr<Array<Type[number]>>;
|
|
19
13
|
/**
|
|
20
14
|
* Get Array Class Properties
|
package/dist/Support/Arr.js
CHANGED
package/dist/Support/Arr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Arr.js","sourceRoot":"","sources":["../../src/Support/Arr.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,MAAa,GAAG;IAGS;IADrB,YACqB,OAAa;QAAb,YAAO,GAAP,OAAO,CAAM;
|
|
1
|
+
{"version":3,"file":"Arr.js","sourceRoot":"","sources":["../../src/Support/Arr.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,MAAa,GAAG;IAGS;IADrB,YACqB,OAAa;QAAb,YAAO,GAAP,OAAO,CAAM;IAElC,CAAC;IAEM,KAAK;QACR,OAAO,IAAI,GAAG,CAAC,CAAE,GAAG,IAAI,CAAC,OAAO,CAAE,CAAC,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACI,OAAO;QACV,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CAEJ;AArBD,kBAqBC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TypedContainer } from "@inversifyjs/strongly-typed";
|
|
2
|
+
import type { EventListener, EventNameType, EventObjectType, EventOptions } from "@odg/events";
|
|
3
|
+
import type { AttemptableInterface, GetterAccessInterface } from "../../Interfaces";
|
|
4
|
+
export declare class ODGDecorators {
|
|
5
|
+
protected static readonly metaDataPageOrHandler: string;
|
|
6
|
+
protected static readonly metaDataEvent: string;
|
|
7
|
+
static injectablePageOrHandler(name: string): CallableFunction;
|
|
8
|
+
static attemptableFlow<T extends new (...constructors: any[]) => AttemptableInterface>(): (constructor: T) => T;
|
|
9
|
+
static getterAccess<T extends new (..._ignore: never[]) => GetterAccessInterface>(): (targetClass: T) => T;
|
|
10
|
+
static registerListener(eventName: EventNameType, containerName: string, options: EventOptions): CallableFunction;
|
|
11
|
+
static getEvents<Events extends EventObjectType>(containerInstance: TypedContainer): EventListener<Events, keyof Events>;
|
|
12
|
+
static loadModule(containerInstance: TypedContainer): void;
|
|
13
|
+
private static getReflectEvents;
|
|
14
|
+
private static createGetterPropertyIntercept;
|
|
15
|
+
}
|
|
@@ -1,29 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ODGDecorators = void 0;
|
|
4
|
-
require("reflect-metadata");
|
|
5
4
|
const exception_1 = require("@odg/exception");
|
|
6
5
|
const inversify_1 = require("inversify");
|
|
7
6
|
const _helpers_1 = require("../../Helpers");
|
|
8
7
|
class ODGDecorators {
|
|
9
|
-
static
|
|
8
|
+
static metaDataPageOrHandler = "odg:bind-page-metadata";
|
|
10
9
|
static metaDataEvent = "odg:bind-events-metadata";
|
|
11
10
|
static injectablePageOrHandler(name) {
|
|
12
11
|
return (target) => {
|
|
13
12
|
(0, inversify_1.decorate)((0, inversify_1.injectable)(), target);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
(0, inversify_1.decorate)((0, inversify_1.injectFromHierarchy)({
|
|
14
|
+
extendConstructorArguments: true,
|
|
15
|
+
extendProperties: true,
|
|
16
|
+
lifecycle: {
|
|
17
|
+
extendPostConstructMethods: true,
|
|
18
|
+
extendPreDestroyMethods: true,
|
|
19
|
+
},
|
|
20
|
+
}), target);
|
|
21
|
+
const previousMetadata = Reflect.getMetadata(ODGDecorators.metaDataPageOrHandler, Reflect);
|
|
22
|
+
const newMetadata = [
|
|
23
|
+
{ target, name },
|
|
24
|
+
...previousMetadata ?? [],
|
|
25
|
+
];
|
|
26
|
+
Reflect.defineMetadata(ODGDecorators.metaDataPageOrHandler, newMetadata, Reflect);
|
|
20
27
|
};
|
|
21
28
|
}
|
|
22
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
30
|
static attemptableFlow() {
|
|
24
31
|
return (constructor) => class extends constructor {
|
|
32
|
+
currentAttempt = 0;
|
|
25
33
|
async execute() {
|
|
26
34
|
try {
|
|
35
|
+
this.currentAttempt = 1;
|
|
27
36
|
await (0, _helpers_1.retry)({
|
|
28
37
|
times: await this.attempt(),
|
|
29
38
|
sleep: await this.sleep?.(),
|
|
@@ -47,13 +56,16 @@ class ODGDecorators {
|
|
|
47
56
|
}
|
|
48
57
|
};
|
|
49
58
|
}
|
|
59
|
+
static getterAccess() {
|
|
60
|
+
return (targetClass) => this.createGetterPropertyIntercept(targetClass);
|
|
61
|
+
}
|
|
50
62
|
static registerListener(eventName, containerName, options) {
|
|
51
63
|
return () => {
|
|
52
64
|
const previousMetadata = this.getReflectEvents();
|
|
53
65
|
previousMetadata[eventName] ??= [];
|
|
54
66
|
previousMetadata[eventName].push({
|
|
55
|
-
containerName
|
|
56
|
-
options
|
|
67
|
+
containerName,
|
|
68
|
+
options,
|
|
57
69
|
});
|
|
58
70
|
Reflect.defineMetadata(ODGDecorators.metaDataEvent, previousMetadata, Reflect);
|
|
59
71
|
};
|
|
@@ -68,28 +80,31 @@ class ODGDecorators {
|
|
|
68
80
|
return allEvents;
|
|
69
81
|
}
|
|
70
82
|
static loadModule(containerInstance) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
static bindPageOrHandler(metadata, containerInstance) {
|
|
80
|
-
return (page) => {
|
|
81
|
-
const container = `PageOrHandler${metadata.name}`;
|
|
82
|
-
containerInstance.bind(container).to(metadata.target);
|
|
83
|
-
const value = containerInstance.get(container);
|
|
84
|
-
containerInstance.unbind(container);
|
|
85
|
-
value.page = page;
|
|
86
|
-
return value;
|
|
87
|
-
};
|
|
83
|
+
const provideMetadata = Reflect.getMetadata(ODGDecorators.metaDataPageOrHandler, Reflect) ?? [];
|
|
84
|
+
for (const metadata of provideMetadata) {
|
|
85
|
+
containerInstance
|
|
86
|
+
.bind(metadata.name)
|
|
87
|
+
.to(metadata.target)
|
|
88
|
+
.inTransientScope();
|
|
89
|
+
}
|
|
88
90
|
}
|
|
89
91
|
static getReflectEvents() {
|
|
90
92
|
const defaultItens = {};
|
|
91
93
|
return Reflect.getMetadata(ODGDecorators.metaDataEvent, Reflect) ?? defaultItens;
|
|
92
94
|
}
|
|
95
|
+
static createGetterPropertyIntercept(targetClass) {
|
|
96
|
+
return new Proxy(targetClass, {
|
|
97
|
+
construct(target, argumentsList, newTarget) {
|
|
98
|
+
const instance = Reflect.construct(target, argumentsList, newTarget);
|
|
99
|
+
return new Proxy(instance, {
|
|
100
|
+
get(object, property) {
|
|
101
|
+
const getter = "__get";
|
|
102
|
+
return object[getter](property, object[property]);
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
}
|
|
93
108
|
}
|
|
94
109
|
exports.ODGDecorators = ODGDecorators;
|
|
95
|
-
//# sourceMappingURL=
|
|
110
|
+
//# sourceMappingURL=OdgDecorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OdgDecorators.js","sourceRoot":"","sources":["../../../src/Support/Decorators/OdgDecorators.ts"],"names":[],"mappings":";;;AAQA,8CAAkD;AAClD,yCAImB;AAEnB,uCAAiC;AAIjC,MAAa,aAAa;IAEZ,MAAM,CAAU,qBAAqB,GAAW,wBAAwB,CAAC;IAEzE,MAAM,CAAU,aAAa,GAAW,0BAA0B,CAAC;IAEtE,MAAM,CAAC,uBAAuB,CAAC,IAAY;QAC9C,OAAO,CAAC,MAAiD,EAAE,EAAE;YACzD,IAAA,oBAAQ,EAAC,IAAA,sBAAU,GAAE,EAAE,MAAM,CAAC,CAAC;YAC/B,IAAA,oBAAQ,EAAC,IAAA,+BAAmB,EAAC;gBACzB,0BAA0B,EAAE,IAAI;gBAChC,gBAAgB,EAAE,IAAI;gBACtB,SAAS,EAAE;oBACP,0BAA0B,EAAE,IAAI;oBAChC,uBAAuB,EAAE,IAAI;iBAChC;aACJ,CAAC,EAAE,MAAM,CAAC,CAAC;YAEZ,MAAM,gBAAgB,GAAG,OAAO,CAAC,WAAW,CACxC,aAAa,CAAC,qBAAqB,EACnC,OAAO,CACQ,CAAC;YAEpB,MAAM,WAAW,GAAG;gBAChB,EAAE,MAAM,EAAE,IAAI,EAAE;gBAChB,GAAG,gBAAgB,IAAI,EAAE;aAC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CAAC;iBACnB,gBAAgB,EAAE,CAAC;QAC5B,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,gBAAgB;QAC3B,MAAM,YAAY,GAAG,EAGpB,CAAC;QAEF,OAAO,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,aAAa,EAAE,OAAO,CAGlD,IAAI,YAAY,CAAC;IAClC,CAAC;IAEO,MAAM,CAAC,6BAA6B,CACxC,WAAc;QAEd,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE;YAC1B,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS;gBACtC,MAAM,QAAQ,GAA0B,OAAO,CAAC,SAAS,CACrD,MAAM,EACN,aAAa,EACb,SAAS,CACa,CAAC;gBAE3B,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE;oBACvB,GAAG,CAAC,MAAM,EAAE,QAAQ;wBAChB,MAAM,MAAM,GAAG,OAAO,CAAC;wBAEvB,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAG,MAAkD,CAAC,QAAQ,CAAC,CAAC,CAAC;oBACnG,CAAC;iBACJ,CAAC,CAAC;YACP,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;;AAtJL,sCAwJC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./GetterDecorator";
|
|
1
|
+
export * from "./OdgDecorators";
|
|
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./GetterDecorator"), exports);
|
|
17
|
+
__exportStar(require("./OdgDecorators"), exports);
|
|
19
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Support/Decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Support/Decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
|
package/dist/Support/Num.d.ts
CHANGED
package/dist/Support/Num.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Num.js","sourceRoot":"","sources":["../../src/Support/Num.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,MAAa,GAAG;IAGS;IADrB,YACqB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;
|
|
1
|
+
{"version":3,"file":"Num.js","sourceRoot":"","sources":["../../src/Support/Num.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,MAAa,GAAG;IAGS;IADrB,YACqB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAEpC,CAAC;IAED;;;;OAIG;IACI,KAAK;QACR,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,QAAQ;QACX,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,QAAQ;QACX,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CAEJ;AAlCD,kBAkCC"}
|
package/dist/Support/Str.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CloneableInterface, NativeInterface } from "..";
|
|
2
2
|
import { Arr } from "./Arr";
|
|
3
3
|
import { Num } from "./Num";
|
|
4
4
|
/**
|
|
@@ -54,7 +54,7 @@ export declare class Str implements CloneableInterface, NativeInterface<string>
|
|
|
54
54
|
*
|
|
55
55
|
* @returns {this}
|
|
56
56
|
*/
|
|
57
|
-
formatUnicorn(
|
|
57
|
+
formatUnicorn(objectVariable: Record<string, number | string>): this;
|
|
58
58
|
/**
|
|
59
59
|
* Make a string's first character uppercase.
|
|
60
60
|
*
|
package/dist/Support/Str.js
CHANGED
|
@@ -36,9 +36,9 @@ class Str {
|
|
|
36
36
|
throw new MoneyMultipleResultException_1.MoneyMultipleResultException("Multiple results found");
|
|
37
37
|
const centLength = match.groups.cents?.length ?? 0;
|
|
38
38
|
const stringCurrent = new Str(match[0]).onlyNumbers().toString();
|
|
39
|
-
return new Num_1.Num(+(
|
|
40
|
-
+
|
|
41
|
-
+
|
|
39
|
+
return new Num_1.Num(+(stringCurrent.slice(0, Math.max(0, stringCurrent.length - centLength))
|
|
40
|
+
+ (match.groups.separatorCent ? "." : "")
|
|
41
|
+
+ (match.groups.separatorCent ? stringCurrent.slice(stringCurrent.length - centLength) : "")));
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Get all money values from a string and return a Arr<Num[]>
|
|
@@ -81,11 +81,11 @@ class Str {
|
|
|
81
81
|
*
|
|
82
82
|
* @returns {this}
|
|
83
83
|
*/
|
|
84
|
-
formatUnicorn(
|
|
85
|
-
for (const key in
|
|
84
|
+
formatUnicorn(objectVariable) {
|
|
85
|
+
for (const key in objectVariable) {
|
|
86
86
|
this.subject = this.subject.replaceAll(
|
|
87
87
|
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
88
|
-
new RegExp(
|
|
88
|
+
new RegExp(String.raw `\{\{\s*${key}\s*\}\}`, "gi"), String(objectVariable[key]));
|
|
89
89
|
}
|
|
90
90
|
return this;
|
|
91
91
|
}
|
package/dist/Support/Str.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Str.js","sourceRoot":"","sources":["../../src/Support/Str.ts"],"names":[],"mappings":";;;AACA,8CAAuD;AACvD,6FAA0F;AAE1F,+BAA4B;AAC5B,+BAA4B;AAE5B;;;;;;GAMG;AACH,MAAa,GAAG;IAMA;IAJZ,wDAAwD;IACvC,UAAU,GAAG,oFAAoF,C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;YACD,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7D,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,QAAQ;QACX,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,KAAK;QACR,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,QAAQ;QACX,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACK,mBAAmB;QACvB,8DAA8D;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACtE,CAAC;CAEJ;AA9JD,kBA8JC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ContextEngineInterface, ContextOptionsLibraryInterface, ContextChemicalXInterface } from "./Context";
|
|
2
2
|
export interface BrowserOptionsLibraryInterface {
|
|
3
3
|
/**
|
|
4
4
|
* Additional arguments to pass to the browser instance. The list of Chromium flags can be found
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type CreatePageFactoryType<
|
|
3
|
-
export type CreateContextFactoryType<
|
|
4
|
-
export type CreateBrowserFactoryType<
|
|
1
|
+
import type { BrowserChemicalXInterface, BrowserEngineInterface, ContextChemicalXInterface, ContextEngineInterface, PageChemicalXInterface, PageEngineInterface } from "..";
|
|
2
|
+
export type CreatePageFactoryType<ContextClassEngine extends ContextChemicalXInterface<ContextEngineInterface>, PageClassEngine extends PageEngineInterface> = (context: ContextClassEngine, page: PageClassEngine) => PageChemicalXInterface<PageClassEngine>;
|
|
3
|
+
export type CreateContextFactoryType<ContextClassEngine extends ContextEngineInterface, PageClassEngine extends PageEngineInterface> = (context: ContextClassEngine, newPage: CreatePageFactoryType<ContextChemicalXInterface<ContextClassEngine>, PageClassEngine>) => ContextChemicalXInterface<ContextClassEngine>;
|
|
4
|
+
export type CreateBrowserFactoryType<BrowserClassEngine extends BrowserEngineInterface, ContextClassEngine extends ContextEngineInterface, PageClassEngine extends PageEngineInterface> = (browser: BrowserClassEngine, newContext: CreateContextFactoryType<ContextClassEngine, PageClassEngine>, newPage: CreatePageFactoryType<ContextChemicalXInterface<ContextClassEngine>, PageClassEngine>) => BrowserChemicalXInterface<BrowserClassEngine, ContextClassEngine>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
$pageInstance: PageEngineType;
|
|
1
|
+
export type PageOptionsLibraryInterface = object;
|
|
2
|
+
export interface PageChemicalXInterface<PageClassEngine extends PageEngineInterface> {
|
|
3
|
+
$pageInstance: PageClassEngine;
|
|
5
4
|
}
|
|
6
5
|
export interface PageEngineInterface {
|
|
7
6
|
goto: CallableFunction;
|