@uxland/primary-shell 7.11.4 → 7.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{component-CSEGzgXw.js → component-DpOVlzni.js} +2 -2
- package/dist/{component-CSEGzgXw.js.map → component-DpOVlzni.js.map} +1 -1
- package/dist/{index-U-UQuOAE.js → index-DKMqJFrU.js} +10748 -10345
- package/dist/index-DKMqJFrU.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +977 -925
- package/dist/index.umd.cjs.map +1 -1
- package/dist/primary/shell/src/api/api.d.ts +2 -0
- package/dist/primary/shell/src/api/plugin-busy-manager/plugin-busy-manager.d.ts +13 -27
- package/dist/primary/shell/src/api/quick-action-busy-manager/quick-action-busy-manager.d.ts +20 -0
- package/dist/primary/shell/src/api/quick-action-busy-manager/quick-action-busy-manager.test.d.ts +1 -0
- package/package.json +4 -4
- package/src/api/api.ts +8 -1
- package/src/api/broker/factory.ts +25 -14
- package/src/api/plugin-busy-manager/plugin-busy-manager.test.ts +40 -90
- package/src/api/plugin-busy-manager/plugin-busy-manager.ts +22 -61
- package/src/api/quick-action-busy-manager/quick-action-busy-manager.test.ts +69 -0
- package/src/api/quick-action-busy-manager/quick-action-busy-manager.ts +50 -0
- package/src/features/exit/handler.test.ts +9 -9
- package/src/features/exit/handler.ts +1 -1
- package/dist/index-U-UQuOAE.js.map +0 -1
|
@@ -20,7 +20,7 @@ vi.mock("../../disposer", () => ({
|
|
|
20
20
|
const createMockApi = (): PrimariaApi =>
|
|
21
21
|
({
|
|
22
22
|
pluginBusyManager: {
|
|
23
|
-
|
|
23
|
+
getTasks: vi.fn(),
|
|
24
24
|
},
|
|
25
25
|
interactionService: {
|
|
26
26
|
confirm: vi.fn(),
|
|
@@ -42,7 +42,7 @@ describe("ExitShellHandler", () => {
|
|
|
42
42
|
|
|
43
43
|
it("should dispose and raise custom close event if no busy tasks and message has ecapEvent", async () => {
|
|
44
44
|
const message = { ecapEvent: {} } as ExitShell;
|
|
45
|
-
mockApi.pluginBusyManager.
|
|
45
|
+
mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue([]);
|
|
46
46
|
(disposePlugins as any).mockResolvedValue(undefined);
|
|
47
47
|
|
|
48
48
|
await handler.handle(message);
|
|
@@ -54,7 +54,7 @@ describe("ExitShellHandler", () => {
|
|
|
54
54
|
|
|
55
55
|
it("should dispose and raise default close event if no busy tasks and no ecapEvent in message", async () => {
|
|
56
56
|
const message = {} as ExitShell;
|
|
57
|
-
mockApi.pluginBusyManager.
|
|
57
|
+
mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue([]);
|
|
58
58
|
(disposePlugins as any).mockResolvedValue(undefined);
|
|
59
59
|
|
|
60
60
|
await handler.handle(message);
|
|
@@ -68,7 +68,7 @@ describe("ExitShellHandler", () => {
|
|
|
68
68
|
it("should ask for confirmation if there are busy tasks", async () => {
|
|
69
69
|
const busyTasks: PluginBusyTask[] = [{ pluginId: "x" }] as any;
|
|
70
70
|
const message = { ecapEvent: {} } as ExitShell;
|
|
71
|
-
mockApi.pluginBusyManager.
|
|
71
|
+
mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue(busyTasks);
|
|
72
72
|
mockApi.interactionService.confirm = vi.fn().mockResolvedValue({ confirmed: true });
|
|
73
73
|
(disposePlugins as any).mockResolvedValue(undefined);
|
|
74
74
|
|
|
@@ -92,7 +92,7 @@ describe("ExitShellHandler", () => {
|
|
|
92
92
|
it("should not continue if confirmation is declined", async () => {
|
|
93
93
|
const busyTasks: PluginBusyTask[] = [{ pluginId: "x" }] as any;
|
|
94
94
|
const message = { ecapEvent: {} } as ExitShell;
|
|
95
|
-
mockApi.pluginBusyManager.
|
|
95
|
+
mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue(busyTasks);
|
|
96
96
|
mockApi.interactionService.confirm = vi.fn().mockResolvedValue({ confirmed: false });
|
|
97
97
|
|
|
98
98
|
await handler.handle(message);
|
|
@@ -107,7 +107,7 @@ describe("ExitShellHandler", () => {
|
|
|
107
107
|
it("should handle errors and raise custom close event if message has ecapEvent", async () => {
|
|
108
108
|
const error = new Error("Something went wrong");
|
|
109
109
|
const message = { ecapEvent: {} } as ExitShell;
|
|
110
|
-
mockApi.pluginBusyManager.
|
|
110
|
+
mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue([]);
|
|
111
111
|
(disposePlugins as any).mockRejectedValue(error);
|
|
112
112
|
|
|
113
113
|
await handler.handle(message);
|
|
@@ -120,7 +120,7 @@ describe("ExitShellHandler", () => {
|
|
|
120
120
|
it("should handle errors and raise default close event if message has no ecapEvent", async () => {
|
|
121
121
|
const error = new Error("Something went wrong");
|
|
122
122
|
const message = {} as ExitShell;
|
|
123
|
-
mockApi.pluginBusyManager.
|
|
123
|
+
mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue([]);
|
|
124
124
|
(disposePlugins as any).mockRejectedValue(error);
|
|
125
125
|
|
|
126
126
|
await handler.handle(message);
|
|
@@ -132,7 +132,7 @@ describe("ExitShellHandler", () => {
|
|
|
132
132
|
|
|
133
133
|
it("should proceed if disposePlugins takes longer than 10 seconds", async () => {
|
|
134
134
|
const message = { ecapEvent: {} } as ExitShell;
|
|
135
|
-
mockApi.pluginBusyManager.
|
|
135
|
+
mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue([]);
|
|
136
136
|
(disposePlugins as any).mockImplementation(() => new Promise((resolve) => setTimeout(resolve, 11000)));
|
|
137
137
|
|
|
138
138
|
await handler.handle(message);
|
|
@@ -143,7 +143,7 @@ describe("ExitShellHandler", () => {
|
|
|
143
143
|
}, 15000);
|
|
144
144
|
|
|
145
145
|
it("should raise raiseCloseEvent if no exitEvent is passed", async () => {
|
|
146
|
-
mockApi.pluginBusyManager.
|
|
146
|
+
mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue([]);
|
|
147
147
|
(disposePlugins as any).mockResolvedValue(undefined);
|
|
148
148
|
|
|
149
149
|
await handler.handle(undefined as any);
|
|
@@ -14,7 +14,7 @@ export class ExitShellHandler {
|
|
|
14
14
|
const evt = exitEvent && exitEvent.ecapEvent !== undefined ? exitEvent : undefined;
|
|
15
15
|
|
|
16
16
|
try {
|
|
17
|
-
const busyTasks = this.api.pluginBusyManager.
|
|
17
|
+
const busyTasks = this.api.pluginBusyManager.getTasks();
|
|
18
18
|
if (busyTasks.length > 0) {
|
|
19
19
|
const { confirmed } = await this.askForClose(busyTasks);
|
|
20
20
|
if (!confirmed) return;
|