@prisma-next/cli 0.3.0-dev.7 → 0.3.0-dev.71
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/LICENSE +201 -0
- package/README.md +314 -80
- package/dist/cli-errors-JlPTsazx.mjs +3 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.js +1 -2376
- package/dist/cli.mjs +198 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/client-PimzSD1f.mjs +981 -0
- package/dist/client-PimzSD1f.mjs.map +1 -0
- package/dist/commands/contract-emit.d.mts +7 -0
- package/dist/commands/contract-emit.d.mts.map +1 -0
- package/dist/commands/contract-emit.mjs +150 -0
- package/dist/commands/contract-emit.mjs.map +1 -0
- package/dist/commands/db-init.d.mts +7 -0
- package/dist/commands/db-init.d.mts.map +1 -0
- package/dist/commands/db-init.mjs +132 -0
- package/dist/commands/db-init.mjs.map +1 -0
- package/dist/commands/db-introspect.d.mts +7 -0
- package/dist/commands/db-introspect.d.mts.map +1 -0
- package/dist/commands/db-introspect.mjs +117 -0
- package/dist/commands/db-introspect.mjs.map +1 -0
- package/dist/commands/db-schema-verify.d.mts +7 -0
- package/dist/commands/db-schema-verify.d.mts.map +1 -0
- package/dist/commands/db-schema-verify.mjs +119 -0
- package/dist/commands/db-schema-verify.mjs.map +1 -0
- package/dist/commands/db-sign.d.mts +7 -0
- package/dist/commands/db-sign.d.mts.map +1 -0
- package/dist/commands/db-sign.mjs +141 -0
- package/dist/commands/db-sign.mjs.map +1 -0
- package/dist/commands/db-update.d.mts +7 -0
- package/dist/commands/db-update.d.mts.map +1 -0
- package/dist/commands/db-update.mjs +121 -0
- package/dist/commands/db-update.mjs.map +1 -0
- package/dist/commands/db-verify.d.mts +7 -0
- package/dist/commands/db-verify.d.mts.map +1 -0
- package/dist/commands/db-verify.mjs +132 -0
- package/dist/commands/db-verify.mjs.map +1 -0
- package/dist/commands/migration-apply.d.mts +23 -0
- package/dist/commands/migration-apply.d.mts.map +1 -0
- package/dist/commands/migration-apply.mjs +249 -0
- package/dist/commands/migration-apply.mjs.map +1 -0
- package/dist/commands/migration-plan.d.mts +25 -0
- package/dist/commands/migration-plan.d.mts.map +1 -0
- package/dist/commands/migration-plan.mjs +266 -0
- package/dist/commands/migration-plan.mjs.map +1 -0
- package/dist/commands/migration-show.d.mts +28 -0
- package/dist/commands/migration-show.d.mts.map +1 -0
- package/dist/commands/migration-show.mjs +138 -0
- package/dist/commands/migration-show.mjs.map +1 -0
- package/dist/commands/migration-status.d.mts +35 -0
- package/dist/commands/migration-status.d.mts.map +1 -0
- package/dist/commands/migration-status.mjs +259 -0
- package/dist/commands/migration-status.mjs.map +1 -0
- package/dist/commands/migration-verify.d.mts +16 -0
- package/dist/commands/migration-verify.d.mts.map +1 -0
- package/dist/commands/migration-verify.mjs +86 -0
- package/dist/commands/migration-verify.mjs.map +1 -0
- package/dist/config-loader-PPf4CtDj.mjs +43 -0
- package/dist/config-loader-PPf4CtDj.mjs.map +1 -0
- package/dist/{config-loader.d.ts → config-loader.d.mts} +8 -3
- package/dist/config-loader.d.mts.map +1 -0
- package/dist/config-loader.mjs +3 -0
- package/dist/exports/config-types.d.mts +2 -0
- package/dist/exports/config-types.mjs +3 -0
- package/dist/exports/control-api.d.mts +621 -0
- package/dist/exports/control-api.d.mts.map +1 -0
- package/dist/exports/control-api.mjs +97 -0
- package/dist/exports/control-api.mjs.map +1 -0
- package/dist/{load-ts-contract.d.ts → exports/index.d.mts} +10 -5
- package/dist/exports/index.d.mts.map +1 -0
- package/dist/exports/index.mjs +130 -0
- package/dist/exports/index.mjs.map +1 -0
- package/dist/extract-sql-ddl-BmlKvk4o.mjs +26 -0
- package/dist/extract-sql-ddl-BmlKvk4o.mjs.map +1 -0
- package/dist/framework-components-CjV_jD8f.mjs +59 -0
- package/dist/framework-components-CjV_jD8f.mjs.map +1 -0
- package/dist/migration-command-scaffold-DfY_F3ev.mjs +97 -0
- package/dist/migration-command-scaffold-DfY_F3ev.mjs.map +1 -0
- package/dist/progress-adapter-DENrzF6I.mjs +49 -0
- package/dist/progress-adapter-DENrzF6I.mjs.map +1 -0
- package/dist/result-handler-iA9JtUC7.mjs +1186 -0
- package/dist/result-handler-iA9JtUC7.mjs.map +1 -0
- package/package.json +75 -38
- package/src/cli.ts +43 -0
- package/src/commands/contract-emit.ts +221 -111
- package/src/commands/db-init.ts +217 -426
- package/src/commands/db-introspect.ts +148 -185
- package/src/commands/db-schema-verify.ts +162 -149
- package/src/commands/db-sign.ts +215 -202
- package/src/commands/db-update.ts +220 -0
- package/src/commands/db-verify.ts +193 -156
- package/src/commands/migration-apply.ts +431 -0
- package/src/commands/migration-plan.ts +446 -0
- package/src/commands/migration-show.ts +255 -0
- package/src/commands/migration-status.ts +436 -0
- package/src/commands/migration-verify.ts +151 -0
- package/src/config-loader.ts +13 -3
- package/src/control-api/client.ts +605 -0
- package/src/control-api/errors.ts +9 -0
- package/src/control-api/operations/contract-emit.ts +161 -0
- package/src/control-api/operations/db-init.ts +286 -0
- package/src/control-api/operations/db-update.ts +221 -0
- package/src/control-api/operations/extract-sql-ddl.ts +47 -0
- package/src/control-api/operations/migration-apply.ts +195 -0
- package/src/control-api/operations/migration-helpers.ts +49 -0
- package/src/control-api/types.ts +687 -0
- package/src/exports/config-types.ts +3 -3
- package/src/exports/control-api.ts +53 -0
- package/src/load-ts-contract.ts +16 -11
- package/src/utils/cli-errors.ts +3 -1
- package/src/utils/command-helpers.ts +92 -3
- package/src/utils/framework-components.ts +11 -30
- package/src/utils/migration-command-scaffold.ts +190 -0
- package/src/utils/output.ts +363 -25
- package/src/utils/progress-adapter.ts +86 -0
- package/dist/chunk-464LNZCE.js +0 -134
- package/dist/chunk-464LNZCE.js.map +0 -1
- package/dist/chunk-BZMBKEEQ.js +0 -997
- package/dist/chunk-BZMBKEEQ.js.map +0 -1
- package/dist/chunk-HWYQOCAJ.js +0 -47
- package/dist/chunk-HWYQOCAJ.js.map +0 -1
- package/dist/chunk-ZKYEJROM.js +0 -94
- package/dist/chunk-ZKYEJROM.js.map +0 -1
- package/dist/cli.d.ts +0 -2
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/contract-emit.d.ts +0 -3
- package/dist/commands/contract-emit.d.ts.map +0 -1
- package/dist/commands/contract-emit.js +0 -9
- package/dist/commands/contract-emit.js.map +0 -1
- package/dist/commands/db-init.d.ts +0 -3
- package/dist/commands/db-init.d.ts.map +0 -1
- package/dist/commands/db-init.js +0 -341
- package/dist/commands/db-init.js.map +0 -1
- package/dist/commands/db-introspect.d.ts +0 -3
- package/dist/commands/db-introspect.d.ts.map +0 -1
- package/dist/commands/db-introspect.js +0 -190
- package/dist/commands/db-introspect.js.map +0 -1
- package/dist/commands/db-schema-verify.d.ts +0 -3
- package/dist/commands/db-schema-verify.d.ts.map +0 -1
- package/dist/commands/db-schema-verify.js +0 -164
- package/dist/commands/db-schema-verify.js.map +0 -1
- package/dist/commands/db-sign.d.ts +0 -3
- package/dist/commands/db-sign.d.ts.map +0 -1
- package/dist/commands/db-sign.js +0 -199
- package/dist/commands/db-sign.js.map +0 -1
- package/dist/commands/db-verify.d.ts +0 -3
- package/dist/commands/db-verify.d.ts.map +0 -1
- package/dist/commands/db-verify.js +0 -173
- package/dist/commands/db-verify.js.map +0 -1
- package/dist/config-loader.d.ts.map +0 -1
- package/dist/config-loader.js +0 -7
- package/dist/config-loader.js.map +0 -1
- package/dist/exports/config-types.d.ts +0 -3
- package/dist/exports/config-types.d.ts.map +0 -1
- package/dist/exports/config-types.js +0 -6
- package/dist/exports/config-types.js.map +0 -1
- package/dist/exports/index.d.ts +0 -4
- package/dist/exports/index.d.ts.map +0 -1
- package/dist/exports/index.js +0 -175
- package/dist/exports/index.js.map +0 -1
- package/dist/load-ts-contract.d.ts.map +0 -1
- package/dist/utils/action.d.ts +0 -16
- package/dist/utils/action.d.ts.map +0 -1
- package/dist/utils/cli-errors.d.ts +0 -7
- package/dist/utils/cli-errors.d.ts.map +0 -1
- package/dist/utils/command-helpers.d.ts +0 -12
- package/dist/utils/command-helpers.d.ts.map +0 -1
- package/dist/utils/framework-components.d.ts +0 -81
- package/dist/utils/framework-components.d.ts.map +0 -1
- package/dist/utils/global-flags.d.ts +0 -25
- package/dist/utils/global-flags.d.ts.map +0 -1
- package/dist/utils/output.d.ts +0 -142
- package/dist/utils/output.d.ts.map +0 -1
- package/dist/utils/result-handler.d.ts +0 -15
- package/dist/utils/result-handler.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/action.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { Result } from '@prisma-next/utils/result';
|
|
2
|
-
import { notOk, ok } from '@prisma-next/utils/result';
|
|
3
|
-
import { CliStructuredError } from './cli-errors';
|
|
4
|
-
|
|
5
|
-
export type CliResult<T> = Result<T, CliStructuredError>;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Performs an async action and catches structured errors, returning a Result.
|
|
9
|
-
* Only catches CliStructuredError instances - other errors are allowed to propagate (fail fast).
|
|
10
|
-
* If the function throws a CliStructuredError, it's caught and converted to a NotOk result.
|
|
11
|
-
*/
|
|
12
|
-
export async function performAction<T>(fn: () => Promise<T>): Promise<CliResult<T>> {
|
|
13
|
-
try {
|
|
14
|
-
const value = await fn();
|
|
15
|
-
return ok(value);
|
|
16
|
-
} catch (error) {
|
|
17
|
-
// Only catch structured errors - let other errors propagate (fail fast)
|
|
18
|
-
if (error instanceof CliStructuredError) {
|
|
19
|
-
return notOk(error);
|
|
20
|
-
}
|
|
21
|
-
// Re-throw non-structured errors to fail fast
|
|
22
|
-
throw error;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Wraps a synchronous function to catch structured errors and return a Result.
|
|
28
|
-
* Only catches CliStructuredError instances - other errors are allowed to propagate (fail fast).
|
|
29
|
-
* If the function throws a CliStructuredError, it's caught and converted to a NotOk result.
|
|
30
|
-
*/
|
|
31
|
-
export function wrapSync<T>(fn: () => T): CliResult<T> {
|
|
32
|
-
try {
|
|
33
|
-
const value = fn();
|
|
34
|
-
return ok(value);
|
|
35
|
-
} catch (error) {
|
|
36
|
-
// Only catch structured errors - let other errors propagate (fail fast)
|
|
37
|
-
if (error instanceof CliStructuredError) {
|
|
38
|
-
return notOk(error);
|
|
39
|
-
}
|
|
40
|
-
// Re-throw non-structured errors to fail fast
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
}
|
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
|
-
}
|