@prisma-next/cli 0.12.0-dev.1 → 0.12.0-dev.11
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/cli.mjs +4 -4
- package/dist/{client-KgJorIvG.mjs → client-CDr4o07S.mjs} +18 -5
- package/dist/client-CDr4o07S.mjs.map +1 -0
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.mjs +2 -2
- package/dist/commands/db-schema.mjs +1 -1
- package/dist/commands/db-sign.mjs +1 -1
- package/dist/commands/db-update.mjs +2 -2
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +1 -1
- package/dist/commands/migrate.mjs +1 -1
- package/dist/commands/migration-graph.d.mts +20 -2
- package/dist/commands/migration-graph.d.mts.map +1 -1
- package/dist/commands/migration-graph.mjs +2 -2
- package/dist/commands/migration-list.d.mts +1 -1
- package/dist/commands/migration-log.d.mts +1 -1
- package/dist/commands/migration-log.mjs +1 -1
- package/dist/commands/migration-show.d.mts +1 -1
- package/dist/commands/migration-show.mjs +1 -1
- package/dist/commands/migration-status.mjs +2 -2
- package/dist/commands/migration-status.mjs.map +1 -1
- package/dist/commands/ref.d.mts +1 -1
- package/dist/{contract-infer-D8uEbJuu.mjs → contract-infer-C8J1WMvO.mjs} +2 -2
- package/dist/{contract-infer-D8uEbJuu.mjs.map → contract-infer-C8J1WMvO.mjs.map} +1 -1
- package/dist/{db-verify-v_vUKXTU.mjs → db-verify-BeRHwN8M.mjs} +2 -2
- package/dist/{db-verify-v_vUKXTU.mjs.map → db-verify-BeRHwN8M.mjs.map} +1 -1
- package/dist/exports/control-api.d.mts +1 -1
- package/dist/exports/control-api.d.mts.map +1 -1
- package/dist/exports/control-api.mjs +1 -1
- package/dist/{inspect-live-schema-C6ohV_oQ.mjs → inspect-live-schema-BlKR2Zln.mjs} +2 -2
- package/dist/{inspect-live-schema-C6ohV_oQ.mjs.map → inspect-live-schema-BlKR2Zln.mjs.map} +1 -1
- package/dist/{migration-command-scaffold-CjvwO6at.mjs → migration-command-scaffold-BAGUiGOK.mjs} +2 -2
- package/dist/{migration-command-scaffold-CjvwO6at.mjs.map → migration-command-scaffold-BAGUiGOK.mjs.map} +1 -1
- package/dist/{migration-graph-D7DVUElV.mjs → migration-graph-C9WC-7eO.mjs} +324 -78
- package/dist/migration-graph-C9WC-7eO.mjs.map +1 -0
- package/dist/{types-Dt_SfqFm.d.mts → types-CeC5ec2Y.d.mts} +8 -2
- package/dist/{types-Dt_SfqFm.d.mts.map → types-CeC5ec2Y.d.mts.map} +1 -1
- package/package.json +18 -18
- package/src/commands/migration-graph.ts +43 -2
- package/src/commands/migration-status.ts +1 -1
- package/src/control-api/client.ts +11 -1
- package/src/control-api/operations/apply.ts +1 -0
- package/src/control-api/operations/migration-apply.ts +10 -3
- package/src/control-api/types.ts +12 -1
- package/src/utils/formatters/migration-graph-lane-colors.ts +31 -0
- package/src/utils/formatters/migration-graph-layout.ts +27 -5
- package/src/utils/formatters/migration-graph-tree-render.ts +360 -51
- package/dist/client-KgJorIvG.mjs.map +0 -1
- package/dist/migration-graph-D7DVUElV.mjs.map +0 -1
package/src/control-api/types.ts
CHANGED
|
@@ -2,7 +2,11 @@ import type {
|
|
|
2
2
|
ContractSourceDiagnostics,
|
|
3
3
|
ContractSourceProvider,
|
|
4
4
|
} from '@prisma-next/config/config-types';
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
Contract,
|
|
7
|
+
ContractMarkerRecord,
|
|
8
|
+
LedgerEntryRecord,
|
|
9
|
+
} from '@prisma-next/contract/types';
|
|
6
10
|
import type {
|
|
7
11
|
ControlAdapterDescriptor,
|
|
8
12
|
ControlDriverDescriptor,
|
|
@@ -876,6 +880,13 @@ export interface ControlClient {
|
|
|
876
880
|
*/
|
|
877
881
|
readAllMarkers(): Promise<ReadonlyMap<string, ContractMarkerRecord>>;
|
|
878
882
|
|
|
883
|
+
/**
|
|
884
|
+
* Reads the per-migration ledger journal for `space` in apply order.
|
|
885
|
+
* Returns an empty array when the ledger store does not yet exist or
|
|
886
|
+
* has no rows for that space.
|
|
887
|
+
*/
|
|
888
|
+
readLedger(space?: string): Promise<readonly LedgerEntryRecord[]>;
|
|
889
|
+
|
|
879
890
|
/**
|
|
880
891
|
* Applies pre-planned on-disk migrations to the database.
|
|
881
892
|
* Each migration runs in its own transaction with full execution checks.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createColors } from 'colorette';
|
|
2
|
+
|
|
3
|
+
export type LaneColorizer = (text: string) => string;
|
|
4
|
+
|
|
5
|
+
const { magenta, cyan, green, yellow, blueBright, red } = createColors({ useColor: true });
|
|
6
|
+
|
|
7
|
+
export const LANE_COLOR_CYCLE: readonly LaneColorizer[] = [
|
|
8
|
+
magenta,
|
|
9
|
+
cyan,
|
|
10
|
+
green,
|
|
11
|
+
yellow,
|
|
12
|
+
blueBright,
|
|
13
|
+
red,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The hue for a gutter column. The leftmost lane (column 0) is **neutral** — it
|
|
18
|
+
* has nothing to be told apart from in the common single-lane linear case, so
|
|
19
|
+
* the renderer dims it rather than tinting it; the rotating palette is reserved
|
|
20
|
+
* for columns ≥ 1 (where a second lane exists to distinguish). Callers must dim
|
|
21
|
+
* column 0 themselves; this returns identity for it as a guard. A lane freed and
|
|
22
|
+
* reused by a later branch keeps its column's hue — coloring is by position, not
|
|
23
|
+
* branch identity, exactly like `git log --graph`.
|
|
24
|
+
*/
|
|
25
|
+
export function laneColorForColumn(column: number): LaneColorizer {
|
|
26
|
+
if (column <= 0) {
|
|
27
|
+
return (text) => text;
|
|
28
|
+
}
|
|
29
|
+
const colorizer = LANE_COLOR_CYCLE[(column - 1) % LANE_COLOR_CYCLE.length];
|
|
30
|
+
return colorizer ?? ((text) => text);
|
|
31
|
+
}
|
|
@@ -379,6 +379,7 @@ function emptyCells(width: number): StructuralCell[] {
|
|
|
379
379
|
function buildBranchConnectorCells(
|
|
380
380
|
startLane: number,
|
|
381
381
|
endLane: number,
|
|
382
|
+
fanTargetLanes: ReadonlySet<number>,
|
|
382
383
|
activeLanes: ReadonlySet<number>,
|
|
383
384
|
gridWidth: number,
|
|
384
385
|
): StructuralCell[] {
|
|
@@ -393,7 +394,13 @@ function buildBranchConnectorCells(
|
|
|
393
394
|
} else if (lane === endLane) {
|
|
394
395
|
cells[lane] = { kind: 'branch-corner' };
|
|
395
396
|
} else if (lane > startLane && lane < endLane) {
|
|
396
|
-
|
|
397
|
+
if (fanTargetLanes.has(lane)) {
|
|
398
|
+
cells[lane] = { kind: 'branch-tee' };
|
|
399
|
+
} else if (activeLanes.has(lane)) {
|
|
400
|
+
cells[lane] = { kind: 'arc-crossing' };
|
|
401
|
+
} else {
|
|
402
|
+
cells[lane] = { kind: 'branch-tee' };
|
|
403
|
+
}
|
|
397
404
|
}
|
|
398
405
|
}
|
|
399
406
|
return cells;
|
|
@@ -402,6 +409,7 @@ function buildBranchConnectorCells(
|
|
|
402
409
|
function buildMergeConnectorCells(
|
|
403
410
|
startLane: number,
|
|
404
411
|
endLane: number,
|
|
412
|
+
fanTargetLanes: ReadonlySet<number>,
|
|
405
413
|
activeLanes: ReadonlySet<number>,
|
|
406
414
|
gridWidth: number,
|
|
407
415
|
): StructuralCell[] {
|
|
@@ -416,7 +424,13 @@ function buildMergeConnectorCells(
|
|
|
416
424
|
} else if (lane === endLane) {
|
|
417
425
|
cells[lane] = { kind: 'merge-corner' };
|
|
418
426
|
} else if (lane > startLane && lane < endLane) {
|
|
419
|
-
|
|
427
|
+
if (fanTargetLanes.has(lane)) {
|
|
428
|
+
cells[lane] = { kind: 'merge-tee' };
|
|
429
|
+
} else if (activeLanes.has(lane)) {
|
|
430
|
+
cells[lane] = { kind: 'arc-crossing' };
|
|
431
|
+
} else {
|
|
432
|
+
cells[lane] = { kind: 'horizontal-pass' };
|
|
433
|
+
}
|
|
420
434
|
}
|
|
421
435
|
}
|
|
422
436
|
return cells;
|
|
@@ -922,13 +936,14 @@ function layoutComponent(
|
|
|
922
936
|
const endLane = Math.max(...laneIndices);
|
|
923
937
|
ensureGridWidth(endLane + 1);
|
|
924
938
|
const activeLanes = new Set(activeLaneIndices());
|
|
939
|
+
const fanTargetLanes = new Set(laneIndices);
|
|
925
940
|
rows.push({
|
|
926
941
|
kind: 'merge-connector',
|
|
927
942
|
contractHash,
|
|
928
943
|
startLane,
|
|
929
944
|
endLane,
|
|
930
945
|
branchCount: laneIndices.length,
|
|
931
|
-
cells: buildMergeConnectorCells(startLane, endLane, activeLanes, gridWidth),
|
|
946
|
+
cells: buildMergeConnectorCells(startLane, endLane, fanTargetLanes, activeLanes, gridWidth),
|
|
932
947
|
});
|
|
933
948
|
for (const index of laneIndices) {
|
|
934
949
|
if (index !== startLane) setLane(index, null);
|
|
@@ -941,6 +956,7 @@ function layoutComponent(
|
|
|
941
956
|
startLane: number,
|
|
942
957
|
endLane: number,
|
|
943
958
|
branchCount: number,
|
|
959
|
+
fanTargetLanes: readonly number[],
|
|
944
960
|
): void {
|
|
945
961
|
ensureGridWidth(endLane + 1);
|
|
946
962
|
const activeLanes = new Set(activeLaneIndices());
|
|
@@ -950,7 +966,13 @@ function layoutComponent(
|
|
|
950
966
|
startLane,
|
|
951
967
|
endLane,
|
|
952
968
|
branchCount,
|
|
953
|
-
cells: buildBranchConnectorCells(
|
|
969
|
+
cells: buildBranchConnectorCells(
|
|
970
|
+
startLane,
|
|
971
|
+
endLane,
|
|
972
|
+
new Set(fanTargetLanes),
|
|
973
|
+
activeLanes,
|
|
974
|
+
gridWidth,
|
|
975
|
+
),
|
|
954
976
|
});
|
|
955
977
|
}
|
|
956
978
|
|
|
@@ -1046,7 +1068,7 @@ function layoutComponent(
|
|
|
1046
1068
|
|
|
1047
1069
|
if (groups.length >= 2) {
|
|
1048
1070
|
const endLane = Math.max(...laneForGroup);
|
|
1049
|
-
emitBranchConnector(node, column, endLane, groups.length);
|
|
1071
|
+
emitBranchConnector(node, column, endLane, groups.length, laneForGroup);
|
|
1050
1072
|
}
|
|
1051
1073
|
|
|
1052
1074
|
for (let groupIndex = 0; groupIndex < groups.length; groupIndex++) {
|