@odg/command 1.13.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents.md +148 -44
- package/dist/Generators/MakeFile.d.ts +56 -37
- package/dist/Generators/MakeFile.d.ts.map +1 -0
- package/dist/Generators/MakeFile.js +132 -66
- package/dist/Generators/MakeFile.js.map +1 -1
- package/dist/Generators/StubCreator.d.ts +2 -1
- package/dist/Generators/StubCreator.d.ts.map +1 -0
- package/dist/Generators/StubCreator.js +17 -42
- package/dist/Generators/StubCreator.js.map +1 -1
- package/dist/Registrations/pascal-to-dot-lower.d.ts +16 -0
- package/dist/Registrations/pascal-to-dot-lower.d.ts.map +1 -0
- package/dist/Registrations/pascal-to-dot-lower.js +31 -0
- package/dist/Registrations/pascal-to-dot-lower.js.map +1 -0
- package/dist/Registrations/register.d.ts +3 -0
- package/dist/Registrations/register.d.ts.map +1 -0
- package/dist/Registrations/register.js +222 -0
- package/dist/Registrations/register.js.map +1 -0
- package/dist/Registrations/ts-mutators.d.ts +41 -0
- package/dist/Registrations/ts-mutators.d.ts.map +1 -0
- package/dist/Registrations/ts-mutators.js +202 -0
- package/dist/Registrations/ts-mutators.js.map +1 -0
- package/dist/Registrations/types.d.ts +35 -0
- package/dist/Registrations/types.d.ts.map +1 -0
- package/dist/Registrations/types.js +3 -0
- package/dist/Registrations/types.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +107 -16
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +12 -11
- package/stubs/handler.stub +14 -36
- package/stubs/listener.stub +26 -0
- package/stubs/page.stub +2 -20
- package/stubs/selector.stub +2 -0
- package/stubs/event.stub +0 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odg/command",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "ODGCommander used to create files based in stubs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,23 +41,24 @@
|
|
|
41
41
|
"author": "Dragons Gamers <https://www.linkedin.com/in/victor-alves-odgodinho>",
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@odg/eslint-config": "^3.
|
|
45
|
-
"@odg/tsconfig": "^1.
|
|
44
|
+
"@odg/eslint-config": "^3.6.0",
|
|
45
|
+
"@odg/tsconfig": "^1.4.0",
|
|
46
46
|
"@types/node": ">=24",
|
|
47
|
-
"@vitest/coverage-istanbul": "^4.1.
|
|
47
|
+
"@vitest/coverage-istanbul": "^4.1.5",
|
|
48
48
|
"concurrently": "^9.2.1",
|
|
49
49
|
"reflect-metadata": "^0.2.2",
|
|
50
50
|
"rimraf": "^6.1.3",
|
|
51
|
-
"tsc-alias": "^1.8.
|
|
51
|
+
"tsc-alias": "^1.8.17",
|
|
52
52
|
"tsx": "^4.21.0",
|
|
53
53
|
"typescript": "^5.9.3",
|
|
54
|
-
"vite": "^8.0.
|
|
55
|
-
"vitest": "^4.1.
|
|
54
|
+
"vite": "^8.0.10",
|
|
55
|
+
"vitest": "^4.1.5"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@odg/chemical-x": "^2.
|
|
59
|
-
"@odg/exception": "^1.
|
|
60
|
-
"@odg/log": "^1.
|
|
61
|
-
"commander": "^14.0.3"
|
|
58
|
+
"@odg/chemical-x": "^2.6.0",
|
|
59
|
+
"@odg/exception": "^1.12.0",
|
|
60
|
+
"@odg/log": "^1.10.0",
|
|
61
|
+
"commander": "^14.0.3",
|
|
62
|
+
"ts-morph": "^28.0.0"
|
|
62
63
|
}
|
|
63
64
|
}
|
package/stubs/handler.stub
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type HandlerInterface,
|
|
3
2
|
type HandlerFunction,
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
type HandlerInterface,
|
|
4
|
+
type HandlerSolutionType,
|
|
6
5
|
ODGDecorators,
|
|
6
|
+
RetryAction,
|
|
7
7
|
} from "@odg/chemical-x";
|
|
8
|
-
import {
|
|
8
|
+
import type { Exception } from "@odg/exception";
|
|
9
9
|
|
|
10
10
|
import { ConfigName, ContainerName } from "@enums";
|
|
11
11
|
import { BaseHandler } from "@handlers/BaseHandler";
|
|
@@ -20,45 +20,23 @@ export class {{ HandlerClassName }} extends BaseHandler implements HandlerInterf
|
|
|
20
20
|
]);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* Return timeout for handler
|
|
25
|
-
*
|
|
26
|
-
* @returns {Promise<number>}
|
|
27
|
-
*/
|
|
28
23
|
public async getTimeout(): Promise<number> {
|
|
29
24
|
return this.config.get(ConfigName.HANDLER_TIMEOUT);
|
|
30
25
|
}
|
|
31
26
|
|
|
32
|
-
/**
|
|
33
|
-
* Return number attempt to test this handler
|
|
34
|
-
*
|
|
35
|
-
* @returns {Promise<number>}
|
|
36
|
-
*/
|
|
37
27
|
public async attempt(): Promise<number> {
|
|
38
28
|
return this.config.get(ConfigName.HANDLER_ATTEMPT);
|
|
39
29
|
}
|
|
40
30
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* @param {Exception} exception Exception error
|
|
45
|
-
* @param {number} attempt Current attempt
|
|
46
|
-
* @returns {Promise<RetryAction>}
|
|
47
|
-
*/
|
|
48
|
-
public async retrying(exception: Exception, attempt: number): Promise<RetryAction> {
|
|
49
|
-
await this.log.debug(`Step {{ HandlerClassName }}: Failed Attempt ${attempt}.`);
|
|
50
|
-
await this.log.warning(exception.message);
|
|
31
|
+
public override async retrying(exception: Exception, attempt: number): Promise<RetryAction> {
|
|
32
|
+
await this.logger.debug(`Step {{ HandlerClassName }}: Failed Attempt ${attempt}.`);
|
|
33
|
+
await this.logger.warning(exception.message);
|
|
51
34
|
|
|
52
35
|
return RetryAction.Default;
|
|
53
36
|
}
|
|
54
37
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
* @returns {Promise<void>}
|
|
59
|
-
*/
|
|
60
|
-
public async success(): Promise<void> {
|
|
61
|
-
await this.log.debug("Step {{ HandlerClassName }} finish with success.");
|
|
38
|
+
public override async success(): Promise<void> {
|
|
39
|
+
await this.logger.debug("Step {{ HandlerClassName }} finish with success.");
|
|
62
40
|
}
|
|
63
41
|
|
|
64
42
|
/**
|
|
@@ -69,7 +47,7 @@ export class {{ HandlerClassName }} extends BaseHandler implements HandlerInterf
|
|
|
69
47
|
* @returns {Promise<HandlerFunction>}
|
|
70
48
|
*/
|
|
71
49
|
public async identifySuccess(): Promise<HandlerFunction> {
|
|
72
|
-
return this.page.waitForSelector(this.$$s.
|
|
50
|
+
return this.page.waitForSelector(this.$$s.{{ HandlerPageSelectorBundle }}.success, { timeout: await this.getTimeout() })
|
|
73
51
|
.then(() => this.successSolution.bind(this));
|
|
74
52
|
}
|
|
75
53
|
|
|
@@ -81,17 +59,17 @@ export class {{ HandlerClassName }} extends BaseHandler implements HandlerInterf
|
|
|
81
59
|
* @returns {Promise<HandlerFunction>}
|
|
82
60
|
*/
|
|
83
61
|
public async identifyError(): Promise<HandlerFunction> {
|
|
84
|
-
return this.page.waitForSelector(this.$$s.
|
|
62
|
+
return this.page.waitForSelector(this.$$s.{{ HandlerPageSelectorBundle }}.example2, { timeout: await this.getTimeout() })
|
|
85
63
|
.then(() => this.errorSolution.bind(this));
|
|
86
64
|
}
|
|
87
65
|
|
|
88
66
|
/**
|
|
89
67
|
* Action if example handler
|
|
90
68
|
*
|
|
91
|
-
* @returns {Promise<
|
|
69
|
+
* @returns {Promise<HandlerSolutionType>}
|
|
92
70
|
*/
|
|
93
|
-
public async errorSolution(): Promise<
|
|
94
|
-
return
|
|
71
|
+
public async errorSolution(): Promise<HandlerSolutionType> {
|
|
72
|
+
return RetryAction.Resolve;
|
|
95
73
|
}
|
|
96
74
|
|
|
97
75
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ODGDecorators } from "@odg/chemical-x";
|
|
2
|
+
import type { EventListenerInterface } from "@odg/events";
|
|
3
|
+
import type { LoggerInterface } from "@odg/log";
|
|
4
|
+
|
|
5
|
+
import type { EventBrowserParameters, EventTypes } from "#types/EventsInterface";
|
|
6
|
+
import { ContainerName, EventName } from "@enums";
|
|
7
|
+
import { {{ EventBinding:UCFirst }}Page } from "@pages";
|
|
8
|
+
import { $inject } from "~/ContainerInject";
|
|
9
|
+
|
|
10
|
+
@ODGDecorators.injectable(ContainerName.{{ ListenerName:UCFirst }}EventListener, "Singleton")
|
|
11
|
+
@ODGDecorators.registerListener(EventName.{{ EventBinding:UCFirst }}Event, ContainerName.{{ ListenerName:UCFirst }}EventListener, {})
|
|
12
|
+
export class {{ ListenerName:UCFirst }}EventListener implements EventListenerInterface<EventTypes, EventName.{{ EventBinding:UCFirst }}Event> {
|
|
13
|
+
|
|
14
|
+
public constructor(
|
|
15
|
+
@$inject(ContainerName.Logger) public readonly logger: LoggerInterface,
|
|
16
|
+
@$inject(ContainerName.{{ EventBinding:UCFirst }}Page) public readonly {{ EventBinding:LCFirst }}Page: {{ EventBinding:UCFirst }}Page,
|
|
17
|
+
) {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async handler({ page }: EventBrowserParameters): Promise<void> {
|
|
21
|
+
await this.logger.debug("{{ ListenerName:UCFirst }}EventListener is sended");
|
|
22
|
+
|
|
23
|
+
await this.{{ EventBinding:LCFirst }}Page.setPage(page).execute();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
package/stubs/page.stub
CHANGED
|
@@ -3,38 +3,20 @@ import { ODGDecorators, type PageInterface } from "@odg/chemical-x";
|
|
|
3
3
|
import { ConfigName, ContainerName } from "@enums";
|
|
4
4
|
import { BasePage } from "@pages/BasePage";
|
|
5
5
|
import {
|
|
6
|
-
type {{ PageName:UCFirst }}SelectorType,
|
|
7
6
|
{{ PageName:LCFirst }}Selector,
|
|
7
|
+
type {{ PageName:UCFirst }}SelectorType,
|
|
8
8
|
} from "@selectors";
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* Generated page {{ PageName:UCFirst }}
|
|
12
|
-
*/
|
|
13
10
|
@ODGDecorators.injectable(ContainerName.{{ PageName:UCFirst }}Page)
|
|
14
11
|
@ODGDecorators.attemptableFlow()
|
|
15
12
|
export class {{ PageName:UCFirst }}Page extends BasePage implements PageInterface {
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
* Selector to {{ PageName:UCFirst }}Page
|
|
19
|
-
*
|
|
20
|
-
* @type {{{ PageName:UCFirst }}SelectorType}
|
|
21
|
-
*/
|
|
22
|
-
public $s: {{ PageName:UCFirst }}SelectorType = {{ PageName:LCFirst }}Selector;
|
|
14
|
+
public readonly $s: {{ PageName:UCFirst }}SelectorType = {{ PageName:LCFirst }}Selector;
|
|
23
15
|
|
|
24
|
-
/**
|
|
25
|
-
* Execute this step
|
|
26
|
-
*
|
|
27
|
-
* @returns {Promise<void>}
|
|
28
|
-
*/
|
|
29
16
|
public async execute(): Promise<void> {
|
|
30
17
|
// Create execution command step here and remove this comment
|
|
31
18
|
}
|
|
32
19
|
|
|
33
|
-
/**
|
|
34
|
-
* Number of attempt this step
|
|
35
|
-
*
|
|
36
|
-
* @returns {Promise<number>}
|
|
37
|
-
*/
|
|
38
20
|
public async attempt(): Promise<number> {
|
|
39
21
|
return this.config.get(ConfigName.PAGE_ATTEMPT);
|
|
40
22
|
}
|
package/stubs/selector.stub
CHANGED
package/stubs/event.stub
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ODGDecorators } from "@odg/chemical-x";
|
|
2
|
-
import { type EventListenerInterface } from "@odg/events";
|
|
3
|
-
import { LoggerInterface } from "@odg/log";
|
|
4
|
-
import { inject } from "inversify";
|
|
5
|
-
|
|
6
|
-
import { type EventBrowserParameters, type EventTypes } from "#types/EventsInterface";
|
|
7
|
-
import { ContainerName, EventName } from "@enums";
|
|
8
|
-
import { {{ EventName:UCFirst }}Page } from "@pages/{{ EventName:UCFirst }}Page";
|
|
9
|
-
|
|
10
|
-
@ODGDecorators.injectable(ContainerName.{{ EventName:UCFirst }}EventListener, "Singleton")
|
|
11
|
-
@ODGDecorators.registerListener(EventName.{{ EventName:UCFirst }}Event, ContainerName.{{ EventName:UCFirst }}EventListener, {})
|
|
12
|
-
export class {{ EventName:UCFirst }}EventListener implements EventListenerInterface<EventTypes, EventName.{{ EventName:UCFirst }}Event> {
|
|
13
|
-
|
|
14
|
-
public constructor(
|
|
15
|
-
@inject(ContainerName.Logger) public readonly log: LoggerInterface,
|
|
16
|
-
@inject(ContainerName.{{ EventName:UCFirst }}Page) public readonly {{ EventName:LCFirst }}Page: {{ EventName:UCFirst }}Page,
|
|
17
|
-
) {
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public async handler({ page }: EventBrowserParameters): Promise<void> {
|
|
21
|
-
await this.log.debug("{{ EventName:UCFirst }}EventListener is sended");
|
|
22
|
-
|
|
23
|
-
await this.{{ EventName:LCFirst }}Page.setPage(page).execute();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}
|