@ollie-shop/cli 0.2.0 → 0.3.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 (182) hide show
  1. package/.turbo/turbo-build.log +2 -11
  2. package/CHANGELOG.md +13 -7
  3. package/CLAUDE_CLI.md +265 -0
  4. package/README.md +704 -8
  5. package/__tests__/mocks/console.ts +22 -0
  6. package/__tests__/mocks/core.ts +137 -0
  7. package/__tests__/mocks/index.ts +4 -0
  8. package/__tests__/mocks/inquirer.ts +16 -0
  9. package/__tests__/mocks/progress.ts +19 -0
  10. package/dist/__tests__/helpers/cli-test-helper.d.ts +89 -0
  11. package/dist/__tests__/helpers/cli-test-helper.d.ts.map +1 -0
  12. package/dist/__tests__/helpers/cli-test-helper.js +220 -0
  13. package/dist/__tests__/mocks/index.d.ts +69 -0
  14. package/dist/__tests__/mocks/index.d.ts.map +1 -0
  15. package/dist/__tests__/mocks/index.js +77 -0
  16. package/dist/actions/component.actions.d.ts +14 -0
  17. package/dist/actions/component.actions.d.ts.map +1 -0
  18. package/dist/actions/component.actions.js +273 -0
  19. package/dist/actions/function.actions.d.ts +15 -0
  20. package/dist/actions/function.actions.d.ts.map +1 -0
  21. package/dist/actions/function.actions.js +254 -0
  22. package/dist/actions/project.actions.d.ts +17 -0
  23. package/dist/actions/project.actions.d.ts.map +1 -0
  24. package/dist/actions/project.actions.js +97 -0
  25. package/dist/actions/version.actions.d.ts +19 -0
  26. package/dist/actions/version.actions.d.ts.map +1 -0
  27. package/dist/actions/version.actions.js +216 -0
  28. package/dist/commands/component.d.ts +3 -0
  29. package/dist/commands/component.d.ts.map +1 -0
  30. package/dist/commands/component.js +192 -0
  31. package/dist/commands/docs.d.ts +3 -0
  32. package/dist/commands/docs.d.ts.map +1 -0
  33. package/dist/commands/docs.js +16 -0
  34. package/dist/commands/function.d.ts +3 -0
  35. package/dist/commands/function.d.ts.map +1 -0
  36. package/dist/commands/function.js +243 -0
  37. package/dist/commands/help.d.ts +3 -0
  38. package/dist/commands/help.d.ts.map +1 -0
  39. package/dist/commands/help.js +20 -0
  40. package/dist/commands/index.d.ts +3 -0
  41. package/dist/commands/index.d.ts.map +1 -0
  42. package/dist/commands/index.js +26 -0
  43. package/dist/commands/login.d.ts +3 -0
  44. package/dist/commands/login.d.ts.map +1 -0
  45. package/dist/commands/login.js +175 -0
  46. package/dist/commands/project.d.ts +3 -0
  47. package/dist/commands/project.d.ts.map +1 -0
  48. package/dist/commands/project.js +78 -0
  49. package/dist/commands/store-version.d.ts +3 -0
  50. package/dist/commands/store-version.d.ts.map +1 -0
  51. package/dist/commands/store-version.js +241 -0
  52. package/dist/commands/version.d.ts +3 -0
  53. package/dist/commands/version.d.ts.map +1 -0
  54. package/dist/commands/version.js +46 -0
  55. package/dist/commands/whoami.d.ts +3 -0
  56. package/dist/commands/whoami.d.ts.map +1 -0
  57. package/dist/commands/whoami.js +41 -0
  58. package/dist/index.d.ts +3 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +88 -478
  61. package/dist/prompts/component.prompts.d.ts +14 -0
  62. package/dist/prompts/component.prompts.d.ts.map +1 -0
  63. package/dist/prompts/component.prompts.js +75 -0
  64. package/dist/prompts/function.prompts.d.ts +21 -0
  65. package/dist/prompts/function.prompts.d.ts.map +1 -0
  66. package/dist/prompts/function.prompts.js +127 -0
  67. package/dist/schemas/command.schema.d.ts +516 -0
  68. package/dist/schemas/command.schema.d.ts.map +1 -0
  69. package/dist/schemas/command.schema.js +267 -0
  70. package/dist/types/index.d.ts +147 -0
  71. package/dist/types/index.d.ts.map +1 -0
  72. package/dist/types/index.js +18 -0
  73. package/dist/utils/auth.d.ts +4 -0
  74. package/dist/utils/auth.d.ts.map +1 -0
  75. package/dist/utils/auth.js +26 -0
  76. package/dist/utils/cli-progress-reporter.d.ts +12 -0
  77. package/dist/utils/cli-progress-reporter.d.ts.map +1 -0
  78. package/dist/utils/cli-progress-reporter.js +77 -0
  79. package/dist/utils/command-builder.d.ts +22 -0
  80. package/dist/utils/command-builder.d.ts.map +1 -0
  81. package/dist/utils/command-builder.js +268 -0
  82. package/dist/utils/command-helpers.d.ts +19 -0
  83. package/dist/utils/command-helpers.d.ts.map +1 -0
  84. package/dist/utils/command-helpers.js +79 -0
  85. package/dist/utils/command-parser.d.ts +146 -0
  86. package/dist/utils/command-parser.d.ts.map +1 -0
  87. package/dist/utils/command-parser.js +179 -0
  88. package/dist/utils/command-suggestions.d.ts +35 -0
  89. package/dist/utils/command-suggestions.d.ts.map +1 -0
  90. package/dist/utils/command-suggestions.js +152 -0
  91. package/dist/utils/console.d.ts +44 -0
  92. package/dist/utils/console.d.ts.map +1 -0
  93. package/dist/utils/console.js +233 -0
  94. package/dist/utils/constants.d.ts +8 -0
  95. package/dist/utils/constants.d.ts.map +1 -0
  96. package/dist/utils/constants.js +10 -0
  97. package/dist/utils/context-detector.d.ts +12 -0
  98. package/dist/utils/context-detector.d.ts.map +1 -0
  99. package/dist/utils/context-detector.js +155 -0
  100. package/dist/utils/enhanced-error-handler.d.ts +47 -0
  101. package/dist/utils/enhanced-error-handler.d.ts.map +1 -0
  102. package/dist/utils/enhanced-error-handler.js +221 -0
  103. package/dist/utils/error-handler.d.ts +3 -0
  104. package/dist/utils/error-handler.d.ts.map +1 -0
  105. package/dist/utils/error-handler.js +55 -0
  106. package/dist/utils/errors.d.ts +44 -0
  107. package/dist/utils/errors.d.ts.map +1 -0
  108. package/dist/utils/errors.js +76 -0
  109. package/dist/utils/interactive-builder.d.ts +22 -0
  110. package/dist/utils/interactive-builder.d.ts.map +1 -0
  111. package/dist/utils/interactive-builder.js +246 -0
  112. package/dist/utils/rich-progress.d.ts +59 -0
  113. package/dist/utils/rich-progress.d.ts.map +1 -0
  114. package/dist/utils/rich-progress.js +234 -0
  115. package/dist/utils/store.d.ts +11 -0
  116. package/dist/utils/store.d.ts.map +1 -0
  117. package/dist/utils/store.js +19 -0
  118. package/dist/utils/validation-error-formatter.d.ts +25 -0
  119. package/dist/utils/validation-error-formatter.d.ts.map +1 -0
  120. package/dist/utils/validation-error-formatter.js +258 -0
  121. package/dist/utils/validation-helpers.d.ts +60 -0
  122. package/dist/utils/validation-helpers.d.ts.map +1 -0
  123. package/dist/utils/validation-helpers.js +152 -0
  124. package/package.json +43 -11
  125. package/src/__tests__/helpers/cli-test-helper.ts +281 -0
  126. package/src/__tests__/mocks/index.ts +142 -0
  127. package/src/actions/component.actions.ts +334 -0
  128. package/src/actions/function.actions.ts +313 -0
  129. package/src/actions/project.actions.ts +126 -0
  130. package/src/actions/version.actions.ts +233 -0
  131. package/src/commands/__tests__/component-validation.test.ts +250 -0
  132. package/src/commands/__tests__/component.test.ts +321 -0
  133. package/src/commands/__tests__/function-validation.test.ts +220 -0
  134. package/src/commands/__tests__/function.test.ts +286 -0
  135. package/src/commands/__tests__/store-version-validation.test.ts +414 -0
  136. package/src/commands/__tests__/store-version.test.ts +405 -0
  137. package/src/commands/__tests__/version.test.ts +71 -0
  138. package/src/commands/component.ts +188 -0
  139. package/src/commands/docs.ts +11 -11
  140. package/src/commands/function.ts +252 -0
  141. package/src/commands/help.ts +8 -18
  142. package/src/commands/index.ts +14 -7
  143. package/src/commands/login.ts +19 -79
  144. package/src/commands/project.ts +107 -0
  145. package/src/commands/store-version.ts +242 -0
  146. package/src/commands/version.ts +45 -8
  147. package/src/commands/whoami.ts +8 -13
  148. package/src/index.ts +108 -34
  149. package/src/prompts/component.prompts.ts +94 -0
  150. package/src/prompts/function.prompts.ts +168 -0
  151. package/src/schemas/command.schema.ts +354 -0
  152. package/src/types/index.ts +183 -0
  153. package/src/utils/__tests__/command-parser.test.ts +159 -0
  154. package/src/utils/__tests__/command-suggestions.test.ts +185 -0
  155. package/src/utils/__tests__/console.test.ts +192 -0
  156. package/src/utils/__tests__/context-detector.test.ts +258 -0
  157. package/src/utils/__tests__/enhanced-error-handler.test.ts +137 -0
  158. package/src/utils/__tests__/error-handler.test.ts +107 -0
  159. package/src/utils/__tests__/rich-progress.test.ts +170 -0
  160. package/src/utils/__tests__/validation-error-formatter.test.ts +175 -0
  161. package/src/utils/__tests__/validation-helpers.test.ts +125 -0
  162. package/src/utils/auth.ts +0 -1
  163. package/src/utils/cli-progress-reporter.ts +84 -0
  164. package/src/utils/command-builder.ts +390 -0
  165. package/src/utils/command-helpers.ts +83 -0
  166. package/src/utils/command-parser.ts +250 -0
  167. package/src/utils/command-suggestions.ts +176 -0
  168. package/src/utils/console.ts +291 -0
  169. package/src/utils/context-detector.ts +177 -0
  170. package/src/utils/enhanced-error-handler.ts +264 -0
  171. package/src/utils/error-handler.ts +60 -0
  172. package/src/utils/errors.ts +125 -0
  173. package/src/utils/interactive-builder.ts +271 -0
  174. package/src/utils/rich-progress.ts +320 -0
  175. package/src/utils/validation-error-formatter.ts +337 -0
  176. package/src/utils/validation-helpers.ts +192 -0
  177. package/tsconfig.json +13 -7
  178. package/vitest.config.ts +28 -0
  179. package/vitest.setup.ts +29 -0
  180. package/src/commands/validate.ts +0 -62
  181. package/src/utils/core.ts +0 -105
  182. package/tsup.config.ts +0 -15
@@ -0,0 +1,281 @@
1
+ import { Command } from "@commander-js/extra-typings";
2
+ import { expect, vi } from "vitest";
3
+
4
+ /**
5
+ * CLI Testing Helper for Commander.js applications
6
+ * Based on best practices for testing CLI applications with Vitest
7
+ */
8
+
9
+ export interface CLITestResult {
10
+ exitCode: number;
11
+ stdout: string[];
12
+ stderr: string[];
13
+ error?: Error;
14
+ }
15
+
16
+ export interface ProcessMocks {
17
+ exit: ReturnType<typeof vi.fn>;
18
+ stdout: {
19
+ write: ReturnType<typeof vi.fn>;
20
+ };
21
+ stderr: {
22
+ write: ReturnType<typeof vi.fn>;
23
+ };
24
+ }
25
+
26
+ export interface ConsoleMocks {
27
+ log: ReturnType<typeof vi.fn>;
28
+ error: ReturnType<typeof vi.fn>;
29
+ warn: ReturnType<typeof vi.fn>;
30
+ info: ReturnType<typeof vi.fn>;
31
+ }
32
+
33
+ /**
34
+ * Create a test-friendly Commander.js program that captures output
35
+ * and prevents process.exit from terminating the test
36
+ */
37
+ export function createTestProgram(): {
38
+ program: Command;
39
+ mocks: {
40
+ process: ProcessMocks;
41
+ console: ConsoleMocks;
42
+ };
43
+ getResult: () => CLITestResult;
44
+ } {
45
+ const stdout: string[] = [];
46
+ const stderr: string[] = [];
47
+ let exitCode = 0;
48
+ let capturedError: Error | undefined;
49
+
50
+ // Mock process methods
51
+ const processMocks: ProcessMocks = {
52
+ exit: vi.fn((code = 0) => {
53
+ exitCode = code;
54
+ // Throw error instead of exiting to prevent test termination
55
+ throw new Error(`process.exit(${code})`);
56
+ }),
57
+ stdout: {
58
+ write: vi.fn((data: string) => {
59
+ stdout.push(data);
60
+ return true;
61
+ }),
62
+ },
63
+ stderr: {
64
+ write: vi.fn((data: string) => {
65
+ stderr.push(data);
66
+ return true;
67
+ }),
68
+ },
69
+ };
70
+
71
+ // Mock console methods
72
+ const consoleMocks: ConsoleMocks = {
73
+ log: vi.fn((...args: unknown[]) => {
74
+ stdout.push(`${args.join(" ")}\n`);
75
+ }),
76
+ error: vi.fn((...args: unknown[]) => {
77
+ stderr.push(`${args.join(" ")}\n`);
78
+ }),
79
+ warn: vi.fn((...args: unknown[]) => {
80
+ stderr.push(`${args.join(" ")}\n`);
81
+ }),
82
+ info: vi.fn((...args: unknown[]) => {
83
+ stdout.push(`${args.join(" ")}\n`);
84
+ }),
85
+ };
86
+
87
+ // Apply mocks
88
+ vi.spyOn(process, "exit").mockImplementation(((code?: number | undefined) => {
89
+ throw new Error(`Process exit with code ${code}`);
90
+ }) as never);
91
+ vi.spyOn(process.stdout, "write").mockImplementation(
92
+ processMocks.stdout.write,
93
+ );
94
+ vi.spyOn(process.stderr, "write").mockImplementation(
95
+ processMocks.stderr.write,
96
+ );
97
+ vi.spyOn(console, "log").mockImplementation(consoleMocks.log);
98
+ vi.spyOn(console, "error").mockImplementation(consoleMocks.error);
99
+ vi.spyOn(console, "warn").mockImplementation(consoleMocks.warn);
100
+ vi.spyOn(console, "info").mockImplementation(consoleMocks.info);
101
+
102
+ // Also mock global.console which is used by the CLI console utility
103
+ vi.spyOn(global.console, "log").mockImplementation(consoleMocks.log);
104
+ vi.spyOn(global.console, "error").mockImplementation(consoleMocks.error);
105
+ vi.spyOn(global.console, "warn").mockImplementation(consoleMocks.warn);
106
+ vi.spyOn(global.console, "info").mockImplementation(consoleMocks.info);
107
+
108
+ // Create program with exitOverride to handle errors gracefully
109
+ const program = new Command();
110
+ program
111
+ .exitOverride((err) => {
112
+ capturedError = err;
113
+ exitCode = err.exitCode || 1;
114
+ throw err;
115
+ })
116
+ .configureOutput({
117
+ writeOut: (str) => {
118
+ stdout.push(str);
119
+ },
120
+ writeErr: (str) => {
121
+ stderr.push(str);
122
+ },
123
+ });
124
+
125
+ const getResult = (): CLITestResult => ({
126
+ exitCode,
127
+ stdout: [...stdout],
128
+ stderr: [...stderr],
129
+ error: capturedError,
130
+ });
131
+
132
+ return {
133
+ program,
134
+ mocks: {
135
+ process: processMocks,
136
+ console: consoleMocks,
137
+ },
138
+ getResult,
139
+ };
140
+ }
141
+
142
+ /**
143
+ * Execute a CLI command with arguments and capture the result
144
+ */
145
+ export async function executeCLI(
146
+ program: Command,
147
+ args: string[],
148
+ options: { from: "node" | "electron" | "user" } = { from: "user" },
149
+ ): Promise<CLITestResult> {
150
+ const stdout: string[] = [];
151
+ const stderr: string[] = [];
152
+ let exitCode = 0;
153
+ let capturedError: Error | undefined;
154
+
155
+ // Capture output
156
+ const originalWriteOut = program.configureOutput().writeOut;
157
+ const originalWriteErr = program.configureOutput().writeErr;
158
+
159
+ program.configureOutput({
160
+ writeOut: (str) => {
161
+ stdout.push(str);
162
+ if (originalWriteOut) originalWriteOut(str);
163
+ },
164
+ writeErr: (str) => {
165
+ stderr.push(str);
166
+ if (originalWriteErr) originalWriteErr(str);
167
+ },
168
+ });
169
+
170
+ try {
171
+ await program.parseAsync(args, options);
172
+ } catch (error) {
173
+ capturedError = error as Error;
174
+
175
+ // Handle Commander.js specific errors
176
+ if (error && typeof error === "object" && "code" in error) {
177
+ const commanderError = error as { code: string; exitCode: number };
178
+ exitCode = commanderError.exitCode || 1;
179
+ } else if (
180
+ error instanceof Error &&
181
+ error.message.includes("process.exit")
182
+ ) {
183
+ // Handle our mocked process.exit
184
+ const match = error.message.match(/process\.exit\((\d+)\)/);
185
+ exitCode = match?.[1] ? Number.parseInt(match[1], 10) : 1;
186
+ } else {
187
+ exitCode = 1;
188
+ }
189
+ }
190
+
191
+ return {
192
+ exitCode,
193
+ stdout,
194
+ stderr,
195
+ error: capturedError,
196
+ };
197
+ }
198
+
199
+ /**
200
+ * Reset all CLI test mocks between tests
201
+ */
202
+ export function resetCLIMocks(): void {
203
+ vi.clearAllMocks();
204
+ vi.restoreAllMocks();
205
+ }
206
+
207
+ /**
208
+ * Create mock for inquirer prompts
209
+ */
210
+ export function createInquirerMock(responses: Record<string, unknown>) {
211
+ return {
212
+ prompt: vi
213
+ .fn()
214
+ .mockImplementation(
215
+ (questions: Array<{ name?: string; [key: string]: unknown }>) => {
216
+ const answers: Record<string, unknown> = {};
217
+ for (const question of questions) {
218
+ if (question.name && responses[question.name] !== undefined) {
219
+ answers[question.name] = responses[question.name];
220
+ }
221
+ }
222
+ return Promise.resolve(answers);
223
+ },
224
+ ),
225
+ };
226
+ }
227
+
228
+ /**
229
+ * Create mock for ora spinner
230
+ */
231
+ export function createSpinnerMock() {
232
+ const mock = {
233
+ start: vi.fn().mockReturnThis(),
234
+ stop: vi.fn().mockReturnThis(),
235
+ succeed: vi.fn().mockReturnThis(),
236
+ fail: vi.fn().mockReturnThis(),
237
+ warn: vi.fn().mockReturnThis(),
238
+ info: vi.fn().mockReturnThis(),
239
+ text: "",
240
+ isSpinning: false,
241
+ };
242
+
243
+ return {
244
+ mock,
245
+ create: vi.fn(() => mock),
246
+ };
247
+ }
248
+
249
+ /**
250
+ * Assert CLI output contains expected text
251
+ */
252
+ export function expectCLIOutput(
253
+ result: CLITestResult,
254
+ expected: {
255
+ stdout?: string | RegExp;
256
+ stderr?: string | RegExp;
257
+ exitCode?: number;
258
+ },
259
+ ) {
260
+ if (expected.exitCode !== undefined) {
261
+ expect(result.exitCode).toBe(expected.exitCode);
262
+ }
263
+
264
+ if (expected.stdout !== undefined) {
265
+ const stdoutText = result.stdout.join("");
266
+ if (typeof expected.stdout === "string") {
267
+ expect(stdoutText).toContain(expected.stdout);
268
+ } else {
269
+ expect(stdoutText).toMatch(expected.stdout);
270
+ }
271
+ }
272
+
273
+ if (expected.stderr !== undefined) {
274
+ const stderrText = result.stderr.join("");
275
+ if (typeof expected.stderr === "string") {
276
+ expect(stderrText).toContain(expected.stderr);
277
+ } else {
278
+ expect(stderrText).toMatch(expected.stderr);
279
+ }
280
+ }
281
+ }
@@ -0,0 +1,142 @@
1
+ import { vi } from "vitest";
2
+
3
+ export interface MockConsole {
4
+ success: ReturnType<typeof vi.fn>;
5
+ error: ReturnType<typeof vi.fn>;
6
+ info: ReturnType<typeof vi.fn>;
7
+ warn: ReturnType<typeof vi.fn>;
8
+ hint: ReturnType<typeof vi.fn>;
9
+ spinner: ReturnType<typeof vi.fn>;
10
+ log: ReturnType<typeof vi.fn>;
11
+ dim: ReturnType<typeof vi.fn>;
12
+ }
13
+
14
+ export interface MockInquirer {
15
+ prompt: ReturnType<typeof vi.fn>;
16
+ select: ReturnType<typeof vi.fn>;
17
+ input: ReturnType<typeof vi.fn>;
18
+ confirm: ReturnType<typeof vi.fn>;
19
+ }
20
+
21
+ export interface MockSpinner {
22
+ succeed: ReturnType<typeof vi.fn>;
23
+ fail: ReturnType<typeof vi.fn>;
24
+ start: ReturnType<typeof vi.fn>;
25
+ stop: ReturnType<typeof vi.fn>;
26
+ }
27
+
28
+ export interface MockCore {
29
+ listComponents: ReturnType<typeof vi.fn>;
30
+ createComponent: ReturnType<typeof vi.fn>;
31
+ deployComponent: ReturnType<typeof vi.fn>;
32
+ deleteComponent: ReturnType<typeof vi.fn>;
33
+ listFunctions: ReturnType<typeof vi.fn>;
34
+ createFunction: ReturnType<typeof vi.fn>;
35
+ deployFunction: ReturnType<typeof vi.fn>;
36
+ deleteFunction: ReturnType<typeof vi.fn>;
37
+ listVersions: ReturnType<typeof vi.fn>;
38
+ createVersion: ReturnType<typeof vi.fn>;
39
+ setDefaultVersion: ReturnType<typeof vi.fn>;
40
+ deleteVersion: ReturnType<typeof vi.fn>;
41
+ }
42
+
43
+ export function createMockConsole(): MockConsole {
44
+ return {
45
+ success: vi.fn(),
46
+ error: vi.fn(),
47
+ info: vi.fn(),
48
+ warn: vi.fn(),
49
+ hint: vi.fn(),
50
+ spinner: vi.fn(() => createMockSpinner()),
51
+ log: vi.fn(),
52
+ dim: vi.fn(),
53
+ };
54
+ }
55
+
56
+ export function createMockInquirer(): MockInquirer {
57
+ return {
58
+ prompt: vi.fn(),
59
+ select: vi.fn(),
60
+ input: vi.fn(),
61
+ confirm: vi.fn(),
62
+ };
63
+ }
64
+
65
+ export function createMockSpinner(): MockSpinner {
66
+ return {
67
+ succeed: vi.fn(),
68
+ fail: vi.fn(),
69
+ start: vi.fn(),
70
+ stop: vi.fn(),
71
+ };
72
+ }
73
+
74
+ export function createMockCore(): MockCore & {
75
+ versionService: {
76
+ list: ReturnType<typeof vi.fn>;
77
+ create: ReturnType<typeof vi.fn>;
78
+ setDefault: ReturnType<typeof vi.fn>;
79
+ delete: ReturnType<typeof vi.fn>;
80
+ clone: ReturnType<typeof vi.fn>;
81
+ activate: ReturnType<typeof vi.fn>;
82
+ deactivate: ReturnType<typeof vi.fn>;
83
+ };
84
+ projectService: {
85
+ getProjectInfo: ReturnType<typeof vi.fn>;
86
+ };
87
+ componentService: {
88
+ list: ReturnType<typeof vi.fn>;
89
+ create: ReturnType<typeof vi.fn>;
90
+ deploy: ReturnType<typeof vi.fn>;
91
+ delete: ReturnType<typeof vi.fn>;
92
+ };
93
+ functionService: {
94
+ list: ReturnType<typeof vi.fn>;
95
+ create: ReturnType<typeof vi.fn>;
96
+ deploy: ReturnType<typeof vi.fn>;
97
+ delete: ReturnType<typeof vi.fn>;
98
+ update: ReturnType<typeof vi.fn>;
99
+ test: ReturnType<typeof vi.fn>;
100
+ };
101
+ } {
102
+ return {
103
+ listComponents: vi.fn(),
104
+ createComponent: vi.fn(),
105
+ deployComponent: vi.fn(),
106
+ deleteComponent: vi.fn(),
107
+ listFunctions: vi.fn(),
108
+ createFunction: vi.fn(),
109
+ deployFunction: vi.fn(),
110
+ deleteFunction: vi.fn(),
111
+ listVersions: vi.fn(),
112
+ createVersion: vi.fn(),
113
+ setDefaultVersion: vi.fn(),
114
+ deleteVersion: vi.fn(),
115
+ versionService: {
116
+ list: vi.fn(),
117
+ create: vi.fn(),
118
+ setDefault: vi.fn(),
119
+ delete: vi.fn(),
120
+ clone: vi.fn(),
121
+ activate: vi.fn(),
122
+ deactivate: vi.fn(),
123
+ },
124
+ projectService: {
125
+ getProjectInfo: vi.fn(),
126
+ },
127
+ componentService: {
128
+ list: vi.fn(),
129
+ create: vi.fn(),
130
+ deploy: vi.fn(),
131
+ delete: vi.fn(),
132
+ },
133
+ functionService: {
134
+ list: vi.fn(),
135
+ create: vi.fn(),
136
+ deploy: vi.fn(),
137
+ delete: vi.fn(),
138
+ update: vi.fn(),
139
+ test: vi.fn(),
140
+ },
141
+ };
142
+ }