@dev.fast/diffr 0.1.20 → 0.1.22
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/contract.d.ts +23 -1
- package/dist/contract.js +23 -0
- package/package.json +7 -7
- package/src/contract.ts +49 -0
package/dist/contract.d.ts
CHANGED
|
@@ -26,7 +26,10 @@ export type StructuralDiffEvent = {
|
|
|
26
26
|
} | ({
|
|
27
27
|
type: "file";
|
|
28
28
|
file: StructuralPairing<StructuralFileRef>;
|
|
29
|
-
} & StructuralOutcome) | {
|
|
29
|
+
} & StructuralOutcome) | ({
|
|
30
|
+
type: "update";
|
|
31
|
+
file: StructuralPairing<StructuralFileRef>;
|
|
32
|
+
} & StructuralUpdate) | {
|
|
30
33
|
type: "complete";
|
|
31
34
|
succeeded: number;
|
|
32
35
|
failed: number;
|
|
@@ -42,6 +45,25 @@ export type StructuralOutcome = {
|
|
|
42
45
|
diff?: never;
|
|
43
46
|
};
|
|
44
47
|
export declare const StructuralOutcomeSchema: z.ZodType<StructuralOutcome>;
|
|
48
|
+
/**
|
|
49
|
+
* An update record carries the regions whose visibility deferred plugins
|
|
50
|
+
* changed, by region `id`, and the file's new `stats.visible`; or their error.
|
|
51
|
+
*/
|
|
52
|
+
export type StructuralUpdate = {
|
|
53
|
+
regions: StructuralRegionVisibility[];
|
|
54
|
+
visible: StructuralLineCounts;
|
|
55
|
+
error?: never;
|
|
56
|
+
} | {
|
|
57
|
+
error: StructuralProblem;
|
|
58
|
+
regions?: never;
|
|
59
|
+
visible?: never;
|
|
60
|
+
};
|
|
61
|
+
export declare const StructuralUpdateSchema: z.ZodType<StructuralUpdate>;
|
|
62
|
+
/** A region's new visibility; absent fields are open and unlabelled. */
|
|
63
|
+
export type StructuralRegionVisibility = {
|
|
64
|
+
id: number;
|
|
65
|
+
} & StructuralVisibility;
|
|
66
|
+
export declare const StructuralRegionVisibilitySchema: z.ZodType<StructuralRegionVisibility>;
|
|
45
67
|
export type StructuralSnapshot = {
|
|
46
68
|
type: "revision";
|
|
47
69
|
rev: string;
|
package/dist/contract.js
CHANGED
|
@@ -28,6 +28,12 @@ export const StructuralDiffEventSchema = z.lazy(() => z.union([
|
|
|
28
28
|
file: structuralPairingSchema(StructuralFileRefSchema),
|
|
29
29
|
})
|
|
30
30
|
.and(StructuralOutcomeSchema),
|
|
31
|
+
z
|
|
32
|
+
.object({
|
|
33
|
+
type: z.literal("update"),
|
|
34
|
+
file: structuralPairingSchema(StructuralFileRefSchema),
|
|
35
|
+
})
|
|
36
|
+
.and(StructuralUpdateSchema),
|
|
31
37
|
z.object({
|
|
32
38
|
type: z.literal("complete"),
|
|
33
39
|
succeeded: structuralU32,
|
|
@@ -39,6 +45,23 @@ export const StructuralOutcomeSchema = z.lazy(() => z.union([
|
|
|
39
45
|
z.object({ diff: StructuralDiffSchema, error: z.never().optional() }),
|
|
40
46
|
z.object({ error: StructuralProblemSchema, diff: z.never().optional() }),
|
|
41
47
|
]));
|
|
48
|
+
export const StructuralUpdateSchema = z.lazy(() => z.union([
|
|
49
|
+
z.object({
|
|
50
|
+
regions: z.array(StructuralRegionVisibilitySchema),
|
|
51
|
+
visible: StructuralLineCountsSchema,
|
|
52
|
+
error: z.never().optional(),
|
|
53
|
+
}),
|
|
54
|
+
z.object({
|
|
55
|
+
error: StructuralProblemSchema,
|
|
56
|
+
regions: z.never().optional(),
|
|
57
|
+
visible: z.never().optional(),
|
|
58
|
+
}),
|
|
59
|
+
]));
|
|
60
|
+
export const StructuralRegionVisibilitySchema = z.lazy(() => z.object({
|
|
61
|
+
id: structuralU32,
|
|
62
|
+
collapsed: z.boolean().optional(),
|
|
63
|
+
label: z.string().optional(),
|
|
64
|
+
}));
|
|
42
65
|
export const StructuralSnapshotSchema = z.lazy(() => z.union([
|
|
43
66
|
z.object({ type: z.literal("revision"), rev: z.string() }),
|
|
44
67
|
z.object({ type: z.literal("index") }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev.fast/diffr",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "diffr's NDJSON wire contract, validators, and the diffr binary for this platform",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"zod": "^4.0.0"
|
|
37
37
|
},
|
|
38
38
|
"optionalDependencies": {
|
|
39
|
-
"@dev.fast/diffr-darwin-arm64": "0.1.
|
|
40
|
-
"@dev.fast/diffr-darwin-x64": "0.1.
|
|
41
|
-
"@dev.fast/diffr-linux-x64": "0.1.
|
|
42
|
-
"@dev.fast/diffr-linux-arm64": "0.1.
|
|
43
|
-
"@dev.fast/diffr-win32-x64": "0.1.
|
|
39
|
+
"@dev.fast/diffr-darwin-arm64": "0.1.22",
|
|
40
|
+
"@dev.fast/diffr-darwin-x64": "0.1.22",
|
|
41
|
+
"@dev.fast/diffr-linux-x64": "0.1.22",
|
|
42
|
+
"@dev.fast/diffr-linux-arm64": "0.1.22",
|
|
43
|
+
"@dev.fast/diffr-win32-x64": "0.1.22"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "24.12.2",
|
|
47
47
|
"typescript": "5.9.3",
|
|
48
48
|
"vitest": "4.1.11",
|
|
49
|
-
"zod": "4.6.
|
|
49
|
+
"zod": "4.6.6"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=20"
|
package/src/contract.ts
CHANGED
|
@@ -38,6 +38,10 @@ export type StructuralDiffEvent =
|
|
|
38
38
|
type: "file";
|
|
39
39
|
file: StructuralPairing<StructuralFileRef>;
|
|
40
40
|
} & StructuralOutcome)
|
|
41
|
+
| ({
|
|
42
|
+
type: "update";
|
|
43
|
+
file: StructuralPairing<StructuralFileRef>;
|
|
44
|
+
} & StructuralUpdate)
|
|
41
45
|
| {
|
|
42
46
|
type: "complete";
|
|
43
47
|
succeeded: number;
|
|
@@ -61,6 +65,12 @@ export const StructuralDiffEventSchema: z.ZodType<StructuralDiffEvent> = z.lazy(
|
|
|
61
65
|
file: structuralPairingSchema(StructuralFileRefSchema),
|
|
62
66
|
})
|
|
63
67
|
.and(StructuralOutcomeSchema),
|
|
68
|
+
z
|
|
69
|
+
.object({
|
|
70
|
+
type: z.literal("update"),
|
|
71
|
+
file: structuralPairingSchema(StructuralFileRefSchema),
|
|
72
|
+
})
|
|
73
|
+
.and(StructuralUpdateSchema),
|
|
64
74
|
z.object({
|
|
65
75
|
type: z.literal("complete"),
|
|
66
76
|
succeeded: structuralU32,
|
|
@@ -83,6 +93,45 @@ export const StructuralOutcomeSchema: z.ZodType<StructuralOutcome> = z.lazy(
|
|
|
83
93
|
]),
|
|
84
94
|
);
|
|
85
95
|
|
|
96
|
+
/**
|
|
97
|
+
* An update record carries the regions whose visibility deferred plugins
|
|
98
|
+
* changed, by region `id`, and the file's new `stats.visible`; or their error.
|
|
99
|
+
*/
|
|
100
|
+
export type StructuralUpdate =
|
|
101
|
+
| {
|
|
102
|
+
regions: StructuralRegionVisibility[];
|
|
103
|
+
visible: StructuralLineCounts;
|
|
104
|
+
error?: never;
|
|
105
|
+
}
|
|
106
|
+
| { error: StructuralProblem; regions?: never; visible?: never };
|
|
107
|
+
|
|
108
|
+
export const StructuralUpdateSchema: z.ZodType<StructuralUpdate> = z.lazy(() =>
|
|
109
|
+
z.union([
|
|
110
|
+
z.object({
|
|
111
|
+
regions: z.array(StructuralRegionVisibilitySchema),
|
|
112
|
+
visible: StructuralLineCountsSchema,
|
|
113
|
+
error: z.never().optional(),
|
|
114
|
+
}),
|
|
115
|
+
z.object({
|
|
116
|
+
error: StructuralProblemSchema,
|
|
117
|
+
regions: z.never().optional(),
|
|
118
|
+
visible: z.never().optional(),
|
|
119
|
+
}),
|
|
120
|
+
]),
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
/** A region's new visibility; absent fields are open and unlabelled. */
|
|
124
|
+
export type StructuralRegionVisibility = { id: number } & StructuralVisibility;
|
|
125
|
+
|
|
126
|
+
export const StructuralRegionVisibilitySchema: z.ZodType<StructuralRegionVisibility> =
|
|
127
|
+
z.lazy(() =>
|
|
128
|
+
z.object({
|
|
129
|
+
id: structuralU32,
|
|
130
|
+
collapsed: z.boolean().optional(),
|
|
131
|
+
label: z.string().optional(),
|
|
132
|
+
}),
|
|
133
|
+
);
|
|
134
|
+
|
|
86
135
|
export type StructuralSnapshot =
|
|
87
136
|
| { type: "revision"; rev: string }
|
|
88
137
|
| { type: "index" }
|