@prisma-next/cli 0.3.0-dev.9 → 0.3.0-pr.100.2
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/README.md +111 -27
- package/dist/{chunk-BZMBKEEQ.js → chunk-AGOTG4L3.js} +44 -76
- package/dist/chunk-AGOTG4L3.js.map +1 -0
- package/dist/chunk-HLLI4YL7.js +180 -0
- package/dist/chunk-HLLI4YL7.js.map +1 -0
- package/dist/chunk-VG2R7DGF.js +735 -0
- package/dist/chunk-VG2R7DGF.js.map +1 -0
- package/dist/cli.js +1502 -942
- package/dist/cli.js.map +1 -1
- package/dist/commands/contract-emit.d.ts.map +1 -1
- package/dist/commands/contract-emit.js +3 -2
- package/dist/commands/db-init.d.ts.map +1 -1
- package/dist/commands/db-init.js +205 -285
- package/dist/commands/db-init.js.map +1 -1
- package/dist/commands/db-introspect.d.ts.map +1 -1
- package/dist/commands/db-introspect.js +108 -139
- package/dist/commands/db-introspect.js.map +1 -1
- package/dist/commands/db-schema-verify.d.ts.map +1 -1
- package/dist/commands/db-schema-verify.js +120 -109
- package/dist/commands/db-schema-verify.js.map +1 -1
- package/dist/commands/db-sign.d.ts.map +1 -1
- package/dist/commands/db-sign.js +152 -152
- package/dist/commands/db-sign.js.map +1 -1
- package/dist/commands/db-verify.d.ts.map +1 -1
- package/dist/commands/db-verify.js +142 -118
- package/dist/commands/db-verify.js.map +1 -1
- package/dist/control-api/client.d.ts +13 -0
- package/dist/control-api/client.d.ts.map +1 -0
- package/dist/control-api/operations/db-init.d.ts +29 -0
- package/dist/control-api/operations/db-init.d.ts.map +1 -0
- package/dist/control-api/types.d.ts +387 -0
- package/dist/control-api/types.d.ts.map +1 -0
- package/dist/exports/control-api.d.ts +13 -0
- package/dist/exports/control-api.d.ts.map +1 -0
- package/dist/exports/control-api.js +7 -0
- package/dist/exports/control-api.js.map +1 -0
- package/dist/exports/index.js +3 -2
- package/dist/exports/index.js.map +1 -1
- package/dist/utils/cli-errors.d.ts +1 -1
- package/dist/utils/cli-errors.d.ts.map +1 -1
- package/dist/utils/progress-adapter.d.ts +26 -0
- package/dist/utils/progress-adapter.d.ts.map +1 -0
- package/package.json +20 -16
- package/src/commands/contract-emit.ts +179 -102
- package/src/commands/db-init.ts +263 -355
- package/src/commands/db-introspect.ts +151 -180
- package/src/commands/db-schema-verify.ts +151 -145
- package/src/commands/db-sign.ts +202 -196
- package/src/commands/db-verify.ts +180 -151
- package/src/control-api/client.ts +589 -0
- package/src/control-api/operations/db-init.ts +281 -0
- package/src/control-api/types.ts +461 -0
- package/src/exports/control-api.ts +46 -0
- package/src/utils/cli-errors.ts +1 -1
- package/src/utils/progress-adapter.ts +86 -0
- package/dist/chunk-BZMBKEEQ.js.map +0 -1
- package/dist/chunk-CVNWLFXO.js +0 -91
- package/dist/chunk-CVNWLFXO.js.map +0 -1
- package/dist/chunk-QUPBU4KV.js +0 -131
- package/dist/chunk-QUPBU4KV.js.map +0 -1
- package/dist/utils/action.d.ts +0 -16
- package/dist/utils/action.d.ts.map +0 -1
- package/dist/utils/spinner.d.ts +0 -29
- package/dist/utils/spinner.d.ts.map +0 -1
- package/src/utils/action.ts +0 -43
- package/src/utils/spinner.ts +0 -67
package/src/utils/spinner.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import ora from 'ora';
|
|
2
|
-
import type { GlobalFlags } from './global-flags';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Options for the withSpinner helper function.
|
|
6
|
-
*/
|
|
7
|
-
interface WithSpinnerOptions {
|
|
8
|
-
/**
|
|
9
|
-
* The message to display in the spinner.
|
|
10
|
-
*/
|
|
11
|
-
readonly message: string;
|
|
12
|
-
/**
|
|
13
|
-
* Global flags that control spinner behavior (quiet, json, color).
|
|
14
|
-
*/
|
|
15
|
-
readonly flags: GlobalFlags;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Wraps an async operation with a spinner.
|
|
20
|
-
*
|
|
21
|
-
* The spinner respects:
|
|
22
|
-
* - `flags.quiet`: No spinner if quiet mode is enabled
|
|
23
|
-
* - `flags.json === 'object'`: No spinner if JSON output is enabled
|
|
24
|
-
* - Non-TTY environments: No spinner if stdout is not a TTY
|
|
25
|
-
*
|
|
26
|
-
* @param operation - The async operation to execute
|
|
27
|
-
* @param options - Spinner configuration options
|
|
28
|
-
* @returns The result of the operation
|
|
29
|
-
*/
|
|
30
|
-
export async function withSpinner<T>(
|
|
31
|
-
operation: () => Promise<T>,
|
|
32
|
-
options: WithSpinnerOptions,
|
|
33
|
-
): Promise<T> {
|
|
34
|
-
const { message, flags } = options;
|
|
35
|
-
|
|
36
|
-
// Skip spinner if quiet, JSON output, or non-TTY
|
|
37
|
-
const shouldShowSpinner = !flags.quiet && flags.json !== 'object' && process.stdout.isTTY;
|
|
38
|
-
|
|
39
|
-
if (!shouldShowSpinner) {
|
|
40
|
-
// Just execute the operation without spinner
|
|
41
|
-
return operation();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Start spinner immediately
|
|
45
|
-
const startTime = Date.now();
|
|
46
|
-
const spinner = ora({
|
|
47
|
-
text: message,
|
|
48
|
-
color: flags.color !== false ? 'cyan' : false,
|
|
49
|
-
}).start();
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
// Execute the operation
|
|
53
|
-
const result = await operation();
|
|
54
|
-
|
|
55
|
-
// Mark spinner as succeeded
|
|
56
|
-
const elapsed = Date.now() - startTime;
|
|
57
|
-
spinner.succeed(`${message} (${elapsed}ms)`);
|
|
58
|
-
|
|
59
|
-
return result;
|
|
60
|
-
} catch (error) {
|
|
61
|
-
// Mark spinner as failed
|
|
62
|
-
spinner.fail(`${message} failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
63
|
-
|
|
64
|
-
// Re-throw the error
|
|
65
|
-
throw error;
|
|
66
|
-
}
|
|
67
|
-
}
|