@prisma-next/cli 0.5.0-dev.27 → 0.5.0-dev.28

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 (76) hide show
  1. package/dist/cli.mjs +11 -3
  2. package/dist/cli.mjs.map +1 -1
  3. package/dist/{client-CJT9lqBd.mjs → client-keSCAgjW.mjs} +14 -7
  4. package/dist/client-keSCAgjW.mjs.map +1 -0
  5. package/dist/commands/contract-emit.mjs +5 -0
  6. package/dist/commands/contract-infer.d.mts.map +1 -1
  7. package/dist/commands/contract-infer.mjs +7 -1
  8. package/dist/commands/db-init.d.mts.map +1 -1
  9. package/dist/commands/db-init.mjs +6 -4
  10. package/dist/commands/db-init.mjs.map +1 -1
  11. package/dist/commands/db-schema.mjs +5 -2
  12. package/dist/commands/db-schema.mjs.map +1 -1
  13. package/dist/commands/db-sign.mjs +3 -2
  14. package/dist/commands/db-sign.mjs.map +1 -1
  15. package/dist/commands/db-update.mjs +5 -4
  16. package/dist/commands/db-update.mjs.map +1 -1
  17. package/dist/commands/db-verify.mjs +3 -2
  18. package/dist/commands/db-verify.mjs.map +1 -1
  19. package/dist/commands/migration-apply.mjs +3 -2
  20. package/dist/commands/migration-apply.mjs.map +1 -1
  21. package/dist/commands/migration-plan.d.mts +7 -1
  22. package/dist/commands/migration-plan.d.mts.map +1 -1
  23. package/dist/commands/migration-plan.mjs +9 -9
  24. package/dist/commands/migration-plan.mjs.map +1 -1
  25. package/dist/commands/migration-ref.d.mts +1 -1
  26. package/dist/commands/migration-show.d.mts +9 -2
  27. package/dist/commands/migration-show.d.mts.map +1 -1
  28. package/dist/commands/migration-show.mjs +12 -5
  29. package/dist/commands/migration-show.mjs.map +1 -1
  30. package/dist/commands/migration-status.mjs +6 -1
  31. package/dist/{contract-emit-LjzCoicC.mjs → contract-emit-DS5NzZh2.mjs} +2 -0
  32. package/dist/{contract-infer-CPQRrGmy.mjs → contract-infer-GztVCOCJ.mjs} +8 -16
  33. package/dist/contract-infer-GztVCOCJ.mjs.map +1 -0
  34. package/dist/exports/control-api.d.mts +35 -3
  35. package/dist/exports/control-api.d.mts.map +1 -1
  36. package/dist/exports/control-api.mjs +3 -1
  37. package/dist/exports/index.mjs +5 -0
  38. package/dist/exports/index.mjs.map +1 -1
  39. package/dist/exports/init-output.mjs +1 -1
  40. package/dist/{init-BKgjxw6r.mjs → init-DAbQMxIR.mjs} +3 -3
  41. package/dist/{init-BKgjxw6r.mjs.map → init-DAbQMxIR.mjs.map} +1 -1
  42. package/dist/{inspect-live-schema-CLchu1d-.mjs → inspect-live-schema-BaR9ISwa.mjs} +5 -5
  43. package/dist/inspect-live-schema-BaR9ISwa.mjs.map +1 -0
  44. package/dist/{migration-command-scaffold-BP50SzoG.mjs → migration-command-scaffold-D1dWuEWQ.mjs} +2 -2
  45. package/dist/{migration-command-scaffold-BP50SzoG.mjs.map → migration-command-scaffold-D1dWuEWQ.mjs.map} +1 -1
  46. package/dist/{migration-status-CMjpUefa.mjs → migration-status-CP5k8O5i.mjs} +2 -2
  47. package/dist/{migration-status-CMjpUefa.mjs.map → migration-status-CP5k8O5i.mjs.map} +1 -1
  48. package/dist/{migrations-CYYmURZx.mjs → migrations-MEoKMiV5.mjs} +39 -17
  49. package/dist/migrations-MEoKMiV5.mjs.map +1 -0
  50. package/dist/{output-BiO7kt87.mjs → output-BpcQrnnq.mjs} +1 -1
  51. package/dist/{output-BiO7kt87.mjs.map → output-BpcQrnnq.mjs.map} +1 -1
  52. package/dist/{verify-BumcH6Ry.mjs → verify-BT9tgCOH.mjs} +1 -1
  53. package/dist/{verify-BumcH6Ry.mjs.map → verify-BT9tgCOH.mjs.map} +1 -1
  54. package/package.json +14 -14
  55. package/src/commands/contract-infer.ts +7 -20
  56. package/src/commands/db-init.ts +1 -0
  57. package/src/commands/db-update.ts +1 -1
  58. package/src/commands/inspect-live-schema.ts +10 -5
  59. package/src/commands/migration-plan.ts +20 -9
  60. package/src/commands/migration-show.ts +26 -6
  61. package/src/control-api/client.ts +21 -0
  62. package/src/control-api/operations/db-init.ts +5 -3
  63. package/src/control-api/operations/db-update.ts +5 -3
  64. package/src/control-api/types.ts +37 -2
  65. package/src/utils/formatters/migrations.ts +58 -20
  66. package/dist/client-CJT9lqBd.mjs.map +0 -1
  67. package/dist/contract-infer-CPQRrGmy.mjs.map +0 -1
  68. package/dist/extract-operation-statements-CU-Pp4-N.mjs +0 -13
  69. package/dist/extract-operation-statements-CU-Pp4-N.mjs.map +0 -1
  70. package/dist/extract-sql-ddl-Bm0Mm0IT.mjs +0 -26
  71. package/dist/extract-sql-ddl-Bm0Mm0IT.mjs.map +0 -1
  72. package/dist/inspect-live-schema-CLchu1d-.mjs.map +0 -1
  73. package/dist/migrations-CYYmURZx.mjs.map +0 -1
  74. package/src/control-api/operations/extract-operation-statements.ts +0 -14
  75. package/src/control-api/operations/extract-sql-ddl.ts +0 -47
  76. /package/dist/{cli-errors-BJLUczXT.d.mts → cli-errors-DDeVsP2Y.d.mts} +0 -0
@@ -1,47 +0,0 @@
1
- import type { MigrationPlanOperation } from '@prisma-next/framework-components/control';
2
-
3
- /**
4
- * Shape of an SQL execute step on SqlMigrationPlanOperation.
5
- * Used for runtime type narrowing without importing the concrete SQL type.
6
- */
7
- interface SqlExecuteStep {
8
- readonly sql: string;
9
- }
10
-
11
- function isDdlStatement(sqlStatement: string): boolean {
12
- const trimmed = sqlStatement.trim().toLowerCase();
13
- return (
14
- trimmed.startsWith('create ') || trimmed.startsWith('alter ') || trimmed.startsWith('drop ')
15
- );
16
- }
17
-
18
- function hasExecuteSteps(
19
- operation: MigrationPlanOperation,
20
- ): operation is MigrationPlanOperation & { readonly execute: readonly SqlExecuteStep[] } {
21
- const candidate = operation as unknown as Record<string, unknown>;
22
- if (!('execute' in candidate) || !Array.isArray(candidate['execute'])) {
23
- return false;
24
- }
25
- return candidate['execute'].every(
26
- (step: unknown) => typeof step === 'object' && step !== null && 'sql' in step,
27
- );
28
- }
29
-
30
- /**
31
- * Extracts a best-effort SQL DDL preview for CLI plan output.
32
- * This helper is presentation-only and is never used to decide migration correctness.
33
- */
34
- export function extractSqlDdl(operations: readonly MigrationPlanOperation[]): string[] {
35
- const statements: string[] = [];
36
- for (const operation of operations) {
37
- if (!hasExecuteSteps(operation)) {
38
- continue;
39
- }
40
- for (const step of operation.execute) {
41
- if (typeof step.sql === 'string' && isDdlStatement(step.sql)) {
42
- statements.push(step.sql.trim());
43
- }
44
- }
45
- }
46
- return statements;
47
- }