canopycms 0.11.1 → 0.12.1
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/CHANGELOG.md +174 -48
- package/dist/api/admin.d.ts +4 -4
- package/dist/api/branch-changes.d.ts +1 -0
- package/dist/api/branch-changes.js +1 -1
- package/dist/api/branch-entry-changes.d.ts +92 -7
- package/dist/api/branch-entry-changes.js +272 -38
- package/dist/api/branch-review.js +45 -13
- package/dist/api/branch-status.d.ts +12 -0
- package/dist/api/branch-status.js +13 -0
- package/dist/api/branch-update-from-base.d.ts +23 -0
- package/dist/api/branch-update-from-base.js +176 -0
- package/dist/api/branch.d.ts +5 -0
- package/dist/api/branch.js +1 -0
- package/dist/api/client.d.ts +17 -2
- package/dist/api/client.js +26 -0
- package/dist/api/comments.d.ts +2 -2
- package/dist/api/content.d.ts +38 -1
- package/dist/api/content.js +41 -5
- package/dist/api/merge-conflicts.d.ts +226 -0
- package/dist/api/merge-conflicts.js +674 -0
- package/dist/api/routes.js +2 -0
- package/dist/api/types.d.ts +7 -3
- package/dist/base-update.d.ts +26 -0
- package/dist/base-update.js +31 -0
- package/dist/branch-metadata-file.d.ts +51 -0
- package/dist/branch-metadata-file.js +11 -0
- package/dist/branch-schema-cache.d.ts +12 -0
- package/dist/branch-schema-cache.js +27 -2
- package/dist/cli/backfill-item-keys.d.ts +77 -0
- package/dist/cli/backfill-item-keys.js +320 -0
- package/dist/cli/cli.d.ts +1 -1
- package/dist/cli/cli.js +9713 -1493
- package/dist/cli/generate-ai-content.js +415 -244
- package/dist/cli/init.js +6 -0
- package/dist/cli/site-config.d.ts +14 -2
- package/dist/cli/site-config.js +20 -4
- package/dist/comment-store.d.ts +8 -0
- package/dist/comment-store.js +28 -0
- package/dist/content-index-generation.d.ts +1 -4
- package/dist/content-index-generation.js +1 -4
- package/dist/content-store.d.ts +65 -3
- package/dist/content-store.js +121 -15
- package/dist/editor/BranchManager.d.ts +4 -1
- package/dist/editor/BranchManager.js +9 -5
- package/dist/editor/Editor.js +549 -53
- package/dist/editor/EntryNavigator.d.ts +10 -2
- package/dist/editor/EntryNavigator.js +12 -4
- package/dist/editor/FormRenderer.d.ts +8 -2
- package/dist/editor/FormRenderer.js +5 -6
- package/dist/editor/base-update-wait.d.ts +74 -0
- package/dist/editor/base-update-wait.js +91 -0
- package/dist/editor/branch-status.js +1 -1
- package/dist/editor/components/BaseUpdateNotice.d.ts +12 -0
- package/dist/editor/components/BaseUpdateNotice.js +24 -0
- package/dist/editor/components/BranchPill.d.ts +4 -1
- package/dist/editor/components/BranchPill.js +5 -2
- package/dist/editor/components/ConflictsGroup.d.ts +100 -0
- package/dist/editor/components/ConflictsGroup.js +364 -0
- package/dist/editor/components/EditorHeader.d.ts +16 -1
- package/dist/editor/components/EditorHeader.js +92 -30
- package/dist/editor/components/EntryChangesDrawer.d.ts +52 -2
- package/dist/editor/components/EntryChangesDrawer.js +164 -162
- package/dist/editor/components/EntryHeader.d.ts +3 -1
- package/dist/editor/components/EntryHeader.js +4 -6
- package/dist/editor/components/GetLatestChangesButton.d.ts +15 -0
- package/dist/editor/components/GetLatestChangesButton.js +29 -0
- package/dist/editor/components/ReleaseHoldButton.d.ts +20 -0
- package/dist/editor/components/ReleaseHoldButton.js +36 -0
- package/dist/editor/components/RetryToastMessage.js +1 -1
- package/dist/editor/components/change-parts.d.ts +51 -0
- package/dist/editor/components/change-parts.js +171 -0
- package/dist/editor/conflict-cards.d.ts +90 -0
- package/dist/editor/conflict-cards.js +279 -0
- package/dist/editor/conflict-choices.d.ts +60 -0
- package/dist/editor/conflict-choices.js +108 -0
- package/dist/editor/conflict-notice.d.ts +25 -0
- package/dist/editor/conflict-notice.js +39 -0
- package/dist/editor/copy.d.ts +20 -0
- package/dist/editor/copy.js +20 -0
- package/dist/editor/entry-diff.d.ts +18 -2
- package/dist/editor/entry-diff.js +26 -32
- package/dist/editor/hooks/useBaseUpdate.d.ts +36 -0
- package/dist/editor/hooks/useBaseUpdate.js +269 -0
- package/dist/editor/hooks/useBranchManager.d.ts +6 -1
- package/dist/editor/hooks/useBranchManager.js +28 -7
- package/dist/editor/hooks/useBranchesData.js +3 -0
- package/dist/editor/hooks/useConflictChoices.d.ts +24 -0
- package/dist/editor/hooks/useConflictChoices.js +75 -0
- package/dist/editor/hooks/useConflictsData.d.ts +26 -0
- package/dist/editor/hooks/useConflictsData.js +89 -0
- package/dist/editor/hooks/useDraftManager.d.ts +5 -0
- package/dist/editor/hooks/useDraftManager.js +24 -8
- package/dist/editor/hooks/useEntryManager.d.ts +9 -0
- package/dist/editor/hooks/useEntryManager.js +5 -0
- package/dist/editor/release-hold.d.ts +12 -0
- package/dist/editor/release-hold.js +39 -0
- package/dist/editor/server-clock.d.ts +4 -0
- package/dist/editor/server-clock.js +15 -0
- package/dist/editor/undo-change.d.ts +52 -0
- package/dist/editor/undo-change.js +241 -0
- package/dist/git-manager.d.ts +5 -0
- package/dist/git-manager.js +30 -0
- package/dist/item-keys.d.ts +13 -0
- package/dist/item-keys.js +36 -14
- package/dist/merge/conflict-path.d.ts +40 -0
- package/dist/merge/conflict-path.js +128 -0
- package/dist/merge/diff3.d.ts +27 -0
- package/dist/merge/diff3.js +113 -0
- package/dist/merge/entry-merge.d.ts +94 -0
- package/dist/merge/entry-merge.js +875 -0
- package/dist/merge/list-alignment.d.ts +52 -0
- package/dist/merge/list-alignment.js +441 -0
- package/dist/merge/text-merge.d.ts +29 -0
- package/dist/merge/text-merge.js +59 -0
- package/dist/merge/value-equality.d.ts +18 -0
- package/dist/merge/value-equality.js +50 -0
- package/dist/merge-conflicts.d.ts +232 -0
- package/dist/merge-conflicts.js +451 -0
- package/dist/operating-mode/client-safe-strategy.d.ts +2 -0
- package/dist/operating-mode/client-safe-strategy.js +6 -0
- package/dist/operating-mode/types.d.ts +5 -0
- package/dist/services.d.ts +16 -1
- package/dist/services.js +82 -22
- package/dist/task-queue/cms-task-queue.d.ts +3 -1
- package/dist/types.d.ts +28 -2
- package/dist/utils/content-serialize.d.ts +18 -1
- package/dist/utils/content-serialize.js +12 -0
- package/dist/utils/content-write-lock.d.ts +3 -3
- package/dist/utils/content-write-lock.js +3 -3
- package/dist/utils/markdown-body-splice.d.ts +1 -1
- package/dist/utils/markdown-body-splice.js +1 -19
- package/dist/utils/markdown-parse.d.ts +9 -0
- package/dist/utils/markdown-parse.js +27 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/branch-merge.d.ts +53 -37
- package/dist/worker/branch-merge.js +139 -54
- package/dist/worker/cms-worker.d.ts +16 -3
- package/dist/worker/cms-worker.js +59 -12
- package/dist/worker/field-merge.d.ts +65 -0
- package/dist/worker/field-merge.js +636 -0
- package/dist/worker/git-sync.d.ts +1 -1
- package/dist/worker/git-sync.js +7 -6
- package/dist/worker/github-commits.d.ts +42 -10
- package/dist/worker/github-commits.js +287 -47
- package/dist/worker/github-gateway-http.js +17 -9
- package/dist/worker/github-gateway-wire.d.ts +21 -12
- package/dist/worker/github-gateway-wire.js +5 -1
- package/dist/worker/github-gateway.d.ts +10 -1
- package/dist/worker/github-gateway.js +18 -6
- package/dist/worker/github-transfer.d.ts +5 -3
- package/dist/worker/github-transfer.js +8 -5
- package/dist/worker/rebase.d.ts +5 -4
- package/dist/worker/rebase.js +293 -156
- package/dist/worker/task-runner.d.ts +1 -1
- package/dist/worker/task-runner.js +14 -2
- package/dist/worker/worker-context.d.ts +18 -2
- package/package.json +1 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The conflicts the worker's merges left on a branch (merge-conflicts.ts), for the editor to show
|
|
3
|
+
* and resolve: the list, one entry's conflicts with the three versions they compare, and the
|
|
4
|
+
* choices that resolve an entry-level one. A field conflict is resolved by an ordinary save
|
|
5
|
+
* (`resolvedConflicts`, api/content.ts), through {@link clearFieldConflicts}.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import type { BranchContext } from '../types.js';
|
|
9
|
+
import type { ApiResponse } from './types.js';
|
|
10
|
+
import type { DataPathSegment } from '../editor/entry-diff.js';
|
|
11
|
+
import type { FieldConflictKind, SidePaths } from '../merge/entry-merge.js';
|
|
12
|
+
import { type MergeConflictKind, type MergeSides, type ResolvedFieldConflict } from '../merge-conflicts.js';
|
|
13
|
+
import type { ContentId, LogicalPath } from '../paths/types.js';
|
|
14
|
+
import type { EntryChangeSide } from './branch-entry-changes.js';
|
|
15
|
+
/** One entry's open conflicts, as the list names them. */
|
|
16
|
+
export interface MergeConflictListItem {
|
|
17
|
+
contentId: string;
|
|
18
|
+
kind: MergeConflictKind;
|
|
19
|
+
/** Where the file is in the branch, or was, for one the branch deleted. */
|
|
20
|
+
path: string;
|
|
21
|
+
/** The entry's logical path; for a collection's settings, the collection's. */
|
|
22
|
+
logicalPath?: string;
|
|
23
|
+
/** Fields with a conflict open; 0 for an entry-level conflict. */
|
|
24
|
+
fieldCount: number;
|
|
25
|
+
/** The merge that last changed this entry's record. */
|
|
26
|
+
mergeSha: string;
|
|
27
|
+
}
|
|
28
|
+
export interface MergeConflictsData {
|
|
29
|
+
conflicts: MergeConflictListItem[];
|
|
30
|
+
/** Entries with conflicts open that this user may not read: counted, never named. */
|
|
31
|
+
hiddenCount: number;
|
|
32
|
+
/** Choices open on the branch, each field and each entry-level conflict, hidden ones included. */
|
|
33
|
+
openCount: number;
|
|
34
|
+
/**
|
|
35
|
+
* The branch's record was damaged and set aside, so Submit and Approve wait until an admin
|
|
36
|
+
* releases it (`POST /:branch/conflicts/release-hold`); the file it was moved to, for admins.
|
|
37
|
+
*/
|
|
38
|
+
held?: {
|
|
39
|
+
at: string;
|
|
40
|
+
aside?: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export type MergeConflictsResponse = ApiResponse<MergeConflictsData>;
|
|
44
|
+
/** A version a conflict compares that can't be shown. */
|
|
45
|
+
interface UnavailableConflictSide {
|
|
46
|
+
unavailable: 'too-large' | 'unreadable' | 'missing' | 'not-an-entry';
|
|
47
|
+
}
|
|
48
|
+
export type ConflictSide = EntryChangeSide | UnavailableConflictSide;
|
|
49
|
+
export interface EntryConflictField {
|
|
50
|
+
/** The record's name for the place: what `resolvedConflicts` sends back. */
|
|
51
|
+
key: string;
|
|
52
|
+
/**
|
|
53
|
+
* The key the "Show changes" drawer gives the place, under the entry's schema now. It differs from
|
|
54
|
+
* `key` only for a conflict the worker recorded without the schema.
|
|
55
|
+
*/
|
|
56
|
+
drawerKey: string;
|
|
57
|
+
dataPath: DataPathSegment[];
|
|
58
|
+
/**
|
|
59
|
+
* Where each of `sides`' versions holds the value, as `versions` reads it; absent for a version
|
|
60
|
+
* without the place. A list item can read under another key in one version than `dataPath`
|
|
61
|
+
* names, as one in a list a side left keyless does.
|
|
62
|
+
*/
|
|
63
|
+
sidePaths: SidePaths;
|
|
64
|
+
kind: FieldConflictKind;
|
|
65
|
+
/** A whole list item: resolving it keeps or removes the item. */
|
|
66
|
+
item?: true;
|
|
67
|
+
/** Long text merged by line, its conflicting regions found from the three versions. */
|
|
68
|
+
text?: true;
|
|
69
|
+
mergeSha: string;
|
|
70
|
+
/** What the author started from, and the versions of the merge that last found it. */
|
|
71
|
+
sides: MergeSides;
|
|
72
|
+
}
|
|
73
|
+
export interface EntryConflictData {
|
|
74
|
+
contentId: string;
|
|
75
|
+
kind: MergeConflictKind;
|
|
76
|
+
path: string;
|
|
77
|
+
logicalPath: string;
|
|
78
|
+
mergeSha: string;
|
|
79
|
+
sides: MergeSides;
|
|
80
|
+
fields: EntryConflictField[];
|
|
81
|
+
/** Every version a side names, by blob id, read as the editor reads an entry. */
|
|
82
|
+
versions: Record<string, ConflictSide>;
|
|
83
|
+
}
|
|
84
|
+
export type EntryConflictResponse = ApiResponse<EntryConflictData>;
|
|
85
|
+
/** What an entry-level conflict is resolved by. */
|
|
86
|
+
export type EntryConflictChoice = 'keep' | 'delete' | 'restore' | 'use-latest';
|
|
87
|
+
export type ResolveEntryConflictResponse = ApiResponse<{
|
|
88
|
+
contentId: string;
|
|
89
|
+
openCount: number;
|
|
90
|
+
}>;
|
|
91
|
+
/** A save's `resolvedConflicts`: field conflicts the saved values resolve. */
|
|
92
|
+
export declare const resolvedConflictsSchema: z.ZodArray<z.ZodObject<{
|
|
93
|
+
mergeSha: z.ZodString;
|
|
94
|
+
key: z.ZodString;
|
|
95
|
+
}, "strip", z.ZodTypeAny, {
|
|
96
|
+
key: string;
|
|
97
|
+
mergeSha: string;
|
|
98
|
+
}, {
|
|
99
|
+
key: string;
|
|
100
|
+
mergeSha: string;
|
|
101
|
+
}>, "many">;
|
|
102
|
+
/**
|
|
103
|
+
* Take the field conflicts `resolved` names off `contentId`'s record, each by its own merge and
|
|
104
|
+
* key, and resolve those it cleared. A pair the record no longer holds is ignored. For a save to
|
|
105
|
+
* call once the entry is written, inside its locks: the record's own locks come after them in
|
|
106
|
+
* the one lock order (docs/concurrency.md).
|
|
107
|
+
*/
|
|
108
|
+
export declare function clearFieldConflicts(branchContext: BranchContext, contentId: string, resolved: readonly ResolvedFieldConflict[]): Promise<ResolvedFieldConflict[]>;
|
|
109
|
+
declare const resolveBodySchema: z.ZodObject<{
|
|
110
|
+
/** The content id the record names the entry by. */
|
|
111
|
+
id: z.ZodType<ContentId, z.ZodTypeDef, ContentId>;
|
|
112
|
+
/** The merge that last changed the record, as the conflict was shown. */
|
|
113
|
+
mergeSha: z.ZodString;
|
|
114
|
+
/**
|
|
115
|
+
* `keep`: leave the branch as it is, for any kind; `delete`: delete the entry the latest
|
|
116
|
+
* version deleted (`deleted-on-base`); `restore`: put back the entry the branch deleted, as the
|
|
117
|
+
* latest version has it (`deleted-on-branch`); `use-latest`: replace an entry that can't be merged
|
|
118
|
+
* field by field with the latest version (`unreadable`).
|
|
119
|
+
*/
|
|
120
|
+
choice: z.ZodEnum<["keep", "delete", "restore", "use-latest"]>;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
id: string & {
|
|
123
|
+
readonly __brand: "ContentId";
|
|
124
|
+
};
|
|
125
|
+
mergeSha: string;
|
|
126
|
+
choice: "delete" | "restore" | "keep" | "use-latest";
|
|
127
|
+
}, {
|
|
128
|
+
id: string & {
|
|
129
|
+
readonly __brand: "ContentId";
|
|
130
|
+
};
|
|
131
|
+
mergeSha: string;
|
|
132
|
+
choice: "delete" | "restore" | "keep" | "use-latest";
|
|
133
|
+
}>;
|
|
134
|
+
export type ResolveEntryConflictBody = z.infer<typeof resolveBodySchema>;
|
|
135
|
+
export type ReleaseConflictsHoldResponse = ApiResponse<{
|
|
136
|
+
released: boolean;
|
|
137
|
+
}>;
|
|
138
|
+
export declare const MERGE_CONFLICT_ROUTES: {
|
|
139
|
+
readonly list: import("./route-builder.js").RouteDefinition<z.ZodObject<{
|
|
140
|
+
branch: z.ZodType<import("../paths/index.js").BranchName, z.ZodTypeDef, import("../paths/index.js").BranchName>;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
branch: string & {
|
|
143
|
+
readonly __brand: "BranchName";
|
|
144
|
+
};
|
|
145
|
+
}, {
|
|
146
|
+
branch: string & {
|
|
147
|
+
readonly __brand: "BranchName";
|
|
148
|
+
};
|
|
149
|
+
}>, undefined, MergeConflictsResponse>;
|
|
150
|
+
readonly releaseHold: import("./route-builder.js").RouteDefinition<z.ZodObject<{
|
|
151
|
+
branch: z.ZodType<import("../paths/index.js").BranchName, z.ZodTypeDef, import("../paths/index.js").BranchName>;
|
|
152
|
+
}, "strip", z.ZodTypeAny, {
|
|
153
|
+
branch: string & {
|
|
154
|
+
readonly __brand: "BranchName";
|
|
155
|
+
};
|
|
156
|
+
}, {
|
|
157
|
+
branch: string & {
|
|
158
|
+
readonly __brand: "BranchName";
|
|
159
|
+
};
|
|
160
|
+
}>, undefined, ReleaseConflictsHoldResponse>;
|
|
161
|
+
readonly entry: import("./route-builder.js").RouteDefinition<z.ZodObject<{
|
|
162
|
+
branch: z.ZodType<import("../paths/index.js").BranchName, z.ZodTypeDef, import("../paths/index.js").BranchName>;
|
|
163
|
+
entryPath: z.ZodType<LogicalPath, z.ZodTypeDef, LogicalPath>;
|
|
164
|
+
/** The entry's content id, which tells an entry from a collection at the same path. */
|
|
165
|
+
id: z.ZodOptional<z.ZodType<ContentId, z.ZodTypeDef, ContentId>>;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
branch: string & {
|
|
168
|
+
readonly __brand: "BranchName";
|
|
169
|
+
};
|
|
170
|
+
entryPath: string & {
|
|
171
|
+
readonly __brand: "LogicalPath";
|
|
172
|
+
};
|
|
173
|
+
id?: ContentId | undefined;
|
|
174
|
+
}, {
|
|
175
|
+
branch: string & {
|
|
176
|
+
readonly __brand: "BranchName";
|
|
177
|
+
};
|
|
178
|
+
entryPath: string & {
|
|
179
|
+
readonly __brand: "LogicalPath";
|
|
180
|
+
};
|
|
181
|
+
id?: ContentId | undefined;
|
|
182
|
+
}>, undefined, EntryConflictResponse>;
|
|
183
|
+
readonly resolveEntry: import("./route-builder.js").RouteDefinition<z.ZodObject<{
|
|
184
|
+
branch: z.ZodType<import("../paths/index.js").BranchName, z.ZodTypeDef, import("../paths/index.js").BranchName>;
|
|
185
|
+
entryPath: z.ZodType<LogicalPath, z.ZodTypeDef, LogicalPath>;
|
|
186
|
+
}, "strip", z.ZodTypeAny, {
|
|
187
|
+
branch: string & {
|
|
188
|
+
readonly __brand: "BranchName";
|
|
189
|
+
};
|
|
190
|
+
entryPath: string & {
|
|
191
|
+
readonly __brand: "LogicalPath";
|
|
192
|
+
};
|
|
193
|
+
}, {
|
|
194
|
+
branch: string & {
|
|
195
|
+
readonly __brand: "BranchName";
|
|
196
|
+
};
|
|
197
|
+
entryPath: string & {
|
|
198
|
+
readonly __brand: "LogicalPath";
|
|
199
|
+
};
|
|
200
|
+
}>, z.ZodObject<{
|
|
201
|
+
/** The content id the record names the entry by. */
|
|
202
|
+
id: z.ZodType<ContentId, z.ZodTypeDef, ContentId>;
|
|
203
|
+
/** The merge that last changed the record, as the conflict was shown. */
|
|
204
|
+
mergeSha: z.ZodString;
|
|
205
|
+
/**
|
|
206
|
+
* `keep`: leave the branch as it is, for any kind; `delete`: delete the entry the latest
|
|
207
|
+
* version deleted (`deleted-on-base`); `restore`: put back the entry the branch deleted, as the
|
|
208
|
+
* latest version has it (`deleted-on-branch`); `use-latest`: replace an entry that can't be merged
|
|
209
|
+
* field by field with the latest version (`unreadable`).
|
|
210
|
+
*/
|
|
211
|
+
choice: z.ZodEnum<["keep", "delete", "restore", "use-latest"]>;
|
|
212
|
+
}, "strip", z.ZodTypeAny, {
|
|
213
|
+
id: string & {
|
|
214
|
+
readonly __brand: "ContentId";
|
|
215
|
+
};
|
|
216
|
+
mergeSha: string;
|
|
217
|
+
choice: "delete" | "restore" | "keep" | "use-latest";
|
|
218
|
+
}, {
|
|
219
|
+
id: string & {
|
|
220
|
+
readonly __brand: "ContentId";
|
|
221
|
+
};
|
|
222
|
+
mergeSha: string;
|
|
223
|
+
choice: "delete" | "restore" | "keep" | "use-latest";
|
|
224
|
+
}>, ResolveEntryConflictResponse>;
|
|
225
|
+
};
|
|
226
|
+
export {};
|