@drawnagency/primitives 0.1.97 → 0.1.99
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/{chunk-F2337B35.js → chunk-26ALJO4K.js} +1 -1
- package/dist/{chunk-S4L3ZFKM.js → chunk-3COSXTOY.js} +1 -1
- package/dist/{chunk-RHWWQV3J.js → chunk-BGHWUJFV.js} +1 -0
- package/dist/{chunk-QEHPGA5N.js → chunk-CZLYECHC.js} +20 -9
- package/dist/{chunk-YDXBJR74.js → chunk-EWNDBKYK.js} +1 -1
- package/dist/{chunk-EUSWEVOA.js → chunk-FAZFADJK.js} +9 -0
- package/dist/{chunk-XYCCXKVC.js → chunk-FOY5TF7D.js} +1 -1
- package/dist/{chunk-II3X7GLJ.js → chunk-GYCBWGVW.js} +1 -1
- package/dist/{chunk-FOEZNEF5.js → chunk-HKHEAH5F.js} +6 -6
- package/dist/{chunk-5BFPJWIO.js → chunk-KP4DWTPR.js} +3 -3
- package/dist/{chunk-KPP2CFW6.js → chunk-MUTHF2GT.js} +2 -2
- package/dist/{chunk-HJSE6SK5.js → chunk-REDDTTGJ.js} +3 -3
- package/dist/chunk-TGNS7D4F.js +200 -0
- package/dist/collab/rebase.d.ts.map +1 -1
- package/dist/collab/rebase.js +4 -2
- package/dist/components/editor/index.js +5 -5
- package/dist/components/primitives/index.js +6 -6
- package/dist/components/sections/brand-guide.js +6 -6
- package/dist/components/sections/register-schemas.js +9 -9
- package/dist/components/sections/register.js +9 -9
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/hooks/useEditorPersistence.d.ts +7 -0
- package/dist/hooks/useEditorPersistence.d.ts.map +1 -1
- package/dist/hooks/useEditorPublish.d.ts +6 -1
- package/dist/hooks/useEditorPublish.d.ts.map +1 -1
- package/dist/index.js +16 -12
- package/dist/lib/block-move.d.ts.map +1 -1
- package/dist/lib/dexie.d.ts.map +1 -1
- package/dist/lib/dexie.js +6 -1
- package/dist/lib/index-ops.d.ts +139 -2
- package/dist/lib/index-ops.d.ts.map +1 -1
- package/dist/lib/index-ops.js +189 -9
- package/dist/lib/index.js +5 -5
- package/dist/lib/loader.d.ts +6 -0
- package/dist/lib/loader.d.ts.map +1 -1
- package/dist/lib/pages.d.ts +18 -0
- package/dist/lib/pages.d.ts.map +1 -1
- package/dist/media/index.js +3 -3
- package/dist/media/provider.d.ts +0 -1
- package/dist/media/provider.d.ts.map +1 -1
- package/dist/schemas/index.js +5 -3
- package/dist/schemas/site-config.d.ts +1 -0
- package/dist/schemas/site-config.d.ts.map +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +3 -1
- package/dist/storage/types.d.ts +22 -5
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/types/database.d.ts +14 -3
- package/dist/types/database.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/collab/rebase.ts +15 -0
- package/src/components/shell/EditorShell.tsx +70 -11
- package/src/hooks/useEditorPersistence.ts +14 -0
- package/src/hooks/useEditorPublish.ts +17 -3
- package/src/lib/block-move.ts +15 -4
- package/src/lib/dexie.ts +6 -1
- package/src/lib/index-ops.ts +277 -7
- package/src/lib/loader.ts +32 -11
- package/src/lib/pages.ts +48 -0
- package/src/media/provider.ts +0 -1
- package/src/schemas/nav.ts +3 -3
- package/src/schemas/site-config.ts +3 -1
- package/src/storage/index.ts +1 -1
- package/src/storage/types.ts +25 -5
- package/src/types/database.ts +14 -3
- package/dist/chunk-ZD6XGRQM.js +0 -85
|
@@ -52,6 +52,11 @@ interface PublishDeps {
|
|
|
52
52
|
index: SiteIndex;
|
|
53
53
|
savedIds: string[];
|
|
54
54
|
}) => Promise<void>;
|
|
55
|
+
/** Injected by EditorShell. Receives non-fatal server warnings from a
|
|
56
|
+
* successful save (e.g. the nav.json replacement was declined by the
|
|
57
|
+
* degraded-nav guard) so the shell can surface them instead of the save
|
|
58
|
+
* reading as fully landed. */
|
|
59
|
+
onSaveWarnings?: (warnings: string[]) => void;
|
|
55
60
|
/** Test hook: overrides the per-request payload budget (default 4MB). */
|
|
56
61
|
saveChunkBudget?: number;
|
|
57
62
|
/** Injected by EditorShell. Mirrors this hook's in-flight-save state out to the
|
|
@@ -65,7 +70,7 @@ interface PublishDeps {
|
|
|
65
70
|
getEditGeneration?: () => number;
|
|
66
71
|
}
|
|
67
72
|
export type PublishAction = "idle" | "saving" | "publishing";
|
|
68
|
-
export declare function useEditorPublish({ flushNow, cancelPendingFlush, isConfigDirty, clearConfigDirty, siteIndexRef, siteConfig, sections, deletedSectionIds, onSuccess, mediaManifest, mediaManifestRef, manifestDirty, clearManifestDirty, pendingMediaItems, pendingMediaDeletions, onMediaPublished, onShasUpdated, onPublishComplete, getBaseVersion, recoverConflict, onBaselineCommitted, saveChunkBudget, savingRef, getEditGeneration, }: PublishDeps): {
|
|
73
|
+
export declare function useEditorPublish({ flushNow, cancelPendingFlush, isConfigDirty, clearConfigDirty, siteIndexRef, siteConfig, sections, deletedSectionIds, onSuccess, mediaManifest, mediaManifestRef, manifestDirty, clearManifestDirty, pendingMediaItems, pendingMediaDeletions, onMediaPublished, onShasUpdated, onPublishComplete, getBaseVersion, recoverConflict, onBaselineCommitted, onSaveWarnings, saveChunkBudget, savingRef, getEditGeneration, }: PublishDeps): {
|
|
69
74
|
publishAction: PublishAction;
|
|
70
75
|
publishFeedback: string | null;
|
|
71
76
|
saveProgress: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditorPublish.d.ts","sourceRoot":"","sources":["../../src/hooks/useEditorPublish.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAkD/D,UAAU,WAAW;IACnB,QAAQ,EA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AAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChI;;;mCAG+B;IAC/B,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC9C,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;+EAE2E;IAC3E,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC5C;;;+EAG2E;IAC3E,iBAAiB,CAAC,EAAE,MAAM,MAAM,CAAC;CAClC;AAQD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE7D,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,SAAS,EACT,iBAAiB,GAClB,EAAE,WAAW;;;;;;;EA6eb"}
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,10 @@ import {
|
|
|
2
2
|
ASSET_CACHE_CONTROL,
|
|
3
3
|
IDEMPOTENCY_KEY_RE,
|
|
4
4
|
IDEMPOTENCY_TRAILER,
|
|
5
|
+
IdempotencyLookupUnavailableError,
|
|
5
6
|
StorageConflictError,
|
|
6
7
|
withIdempotencyTrailer
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FAZFADJK.js";
|
|
8
9
|
import {
|
|
9
10
|
getCollabProvider,
|
|
10
11
|
setCollabProvider
|
|
@@ -29,7 +30,7 @@ import {
|
|
|
29
30
|
resolveMedia,
|
|
30
31
|
sanitizeMediaName,
|
|
31
32
|
setMediaProvider
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-3COSXTOY.js";
|
|
33
34
|
import {
|
|
34
35
|
AUDIENCE_COOKIE,
|
|
35
36
|
AUDIENCE_MAX_AGE_SECONDS,
|
|
@@ -58,7 +59,7 @@ import {
|
|
|
58
59
|
AudienceNameSchema,
|
|
59
60
|
MediaGridOptionsSchema,
|
|
60
61
|
slugifyAudienceName
|
|
61
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-FOY5TF7D.js";
|
|
62
63
|
import {
|
|
63
64
|
AudienceSchema,
|
|
64
65
|
RoleSchema,
|
|
@@ -91,7 +92,7 @@ import {
|
|
|
91
92
|
safeRedirect,
|
|
92
93
|
suggestAccessibleOn,
|
|
93
94
|
wcagLevel
|
|
94
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-CZLYECHC.js";
|
|
95
96
|
import {
|
|
96
97
|
curatedIcons,
|
|
97
98
|
getIcon
|
|
@@ -111,6 +112,11 @@ import {
|
|
|
111
112
|
import {
|
|
112
113
|
cn
|
|
113
114
|
} from "./chunk-7EOSDFS3.js";
|
|
115
|
+
import {
|
|
116
|
+
isSameOriginRequest,
|
|
117
|
+
requireSessionSecret,
|
|
118
|
+
safeNextPath
|
|
119
|
+
} from "./chunk-S2L3BPLS.js";
|
|
114
120
|
import {
|
|
115
121
|
audiencePasses,
|
|
116
122
|
groupDisplayLabel,
|
|
@@ -118,17 +124,12 @@ import {
|
|
|
118
124
|
navEntries,
|
|
119
125
|
pagesInNavOrder,
|
|
120
126
|
reconcileNav
|
|
121
|
-
} from "./chunk-
|
|
122
|
-
import {
|
|
123
|
-
isSameOriginRequest,
|
|
124
|
-
requireSessionSecret,
|
|
125
|
-
safeNextPath
|
|
126
|
-
} from "./chunk-S2L3BPLS.js";
|
|
127
|
+
} from "./chunk-TGNS7D4F.js";
|
|
127
128
|
import "./chunk-5BM2Y3NJ.js";
|
|
128
129
|
import {
|
|
129
130
|
NavEntrySchema,
|
|
130
131
|
NavFileSchema
|
|
131
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-REDDTTGJ.js";
|
|
132
133
|
import {
|
|
133
134
|
getSectionContentSchema,
|
|
134
135
|
getSectionSchema
|
|
@@ -158,6 +159,7 @@ import {
|
|
|
158
159
|
PageSchema,
|
|
159
160
|
PageStatusSchema,
|
|
160
161
|
RESERVED_SLUGS,
|
|
162
|
+
SLUG_RE,
|
|
161
163
|
SectionMetaSchema,
|
|
162
164
|
SingleMediaReferenceSchema,
|
|
163
165
|
SiteConfigSchema,
|
|
@@ -165,7 +167,7 @@ import {
|
|
|
165
167
|
TextLineSchema,
|
|
166
168
|
VariantSchema,
|
|
167
169
|
normalizeSiteIndex
|
|
168
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-BGHWUJFV.js";
|
|
169
171
|
import "./chunk-FM4M4Q2W.js";
|
|
170
172
|
import "./chunk-NSCT3AMV.js";
|
|
171
173
|
import {
|
|
@@ -191,6 +193,7 @@ export {
|
|
|
191
193
|
HexColorSchema,
|
|
192
194
|
IDEMPOTENCY_KEY_RE,
|
|
193
195
|
IDEMPOTENCY_TRAILER,
|
|
196
|
+
IdempotencyLookupUnavailableError,
|
|
194
197
|
ImageManifestSchema,
|
|
195
198
|
IndexSchema,
|
|
196
199
|
IndexUpdateMessageSchema,
|
|
@@ -213,6 +216,7 @@ export {
|
|
|
213
216
|
RoleSchema,
|
|
214
217
|
SESSION_COOKIE,
|
|
215
218
|
SESSION_MAX_AGE_SECONDS,
|
|
219
|
+
SLUG_RE,
|
|
216
220
|
SavedMessageSchema,
|
|
217
221
|
SectionMetaSchema,
|
|
218
222
|
SectionUpdateMessageSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-move.d.ts","sourceRoot":"","sources":["../../src/lib/block-move.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"block-move.d.ts","sourceRoot":"","sources":["../../src/lib/block-move.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,wBAAwB,CAAC;AAcrE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,wJAAwJ;IACxJ,OAAO,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB;AA2BD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,SAAS,EACf,KAAK,GAAE,MAAM,MAAqB,GACjC,eAAe,CAwFjB"}
|
package/dist/lib/dexie.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dexie.d.ts","sourceRoot":"","sources":["../../src/lib/dexie.ts"],"names":[],"mappings":"AACA,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1E;AAED,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAGlE;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAMvD;AAMD,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EAAE,EACjB,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;uEACuE;AACvE,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,UAAU,GAAG,UAAU,GAC9B,OAAO,CAAC,MAAM,CAAC,CAKjB;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAEtE;AAED,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE"}
|
package/dist/lib/dexie.js
CHANGED
|
@@ -251,7 +251,12 @@ async function persistAll(sections, siteIndex, deletedSectionIds, siteConfig) {
|
|
|
251
251
|
pages: siteIndex.pages,
|
|
252
252
|
sections: siteIndex.sections,
|
|
253
253
|
nav: siteIndex.nav,
|
|
254
|
-
|
|
254
|
+
// Record the deletion INTENT, not just its effect on the order. The
|
|
255
|
+
// restore path reads this back; when it was hardcoded `[]` that path
|
|
256
|
+
// had to re-derive deletions by diffing this snapshot against a fresh
|
|
257
|
+
// remote read, which treats a third party's additions (MCP connector,
|
|
258
|
+
// peer editor) as this editor's deletions.
|
|
259
|
+
deletedSections: deletedSectionIds ?? [],
|
|
255
260
|
updatedAt: now
|
|
256
261
|
});
|
|
257
262
|
await database.meta.put({
|
package/dist/lib/index-ops.d.ts
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { type SiteIndex } from "../schemas/site-config";
|
|
2
|
+
import { PageStatusSchema, type SiteIndex } from "../schemas/site-config";
|
|
3
|
+
/**
|
|
4
|
+
* Server-applied index deltas for the MCP connector's save path. An agent
|
|
5
|
+
* cannot reliably hand-transcribe a real site's 40–51 KB index into a tool
|
|
6
|
+
* parameter (two consecutive attempts each introduced an id-level slip), so
|
|
7
|
+
* structural edits are expressed as ops and applied here against the index the
|
|
8
|
+
* write is concurrency-checked against.
|
|
9
|
+
*
|
|
10
|
+
* Pure by contract: no I/O, no storage, no octokit. The caller owns reading the
|
|
11
|
+
* base index at the right commit and committing the result.
|
|
12
|
+
*/
|
|
13
|
+
declare const OpStatusSchema: z.ZodEnum<{
|
|
14
|
+
draft: "draft";
|
|
15
|
+
live: "live";
|
|
16
|
+
archived: "archived";
|
|
17
|
+
}>;
|
|
18
|
+
declare const SectionInsertSchema: z.ZodObject<{
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
21
|
+
draft: "draft";
|
|
22
|
+
live: "live";
|
|
23
|
+
archived: "archived";
|
|
24
|
+
}>>;
|
|
25
|
+
access: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
}, z.core.$strip>;
|
|
3
27
|
export declare const IndexOpSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4
28
|
op: z.ZodLiteral<"insertAfter">;
|
|
5
29
|
pageId: z.ZodString;
|
|
@@ -50,8 +74,119 @@ export declare const IndexOpSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
50
74
|
slug: z.ZodOptional<z.ZodString>;
|
|
51
75
|
showInNav: z.ZodOptional<z.ZodBoolean>;
|
|
52
76
|
access: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
77
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
78
|
+
live: "live";
|
|
79
|
+
archived: "archived";
|
|
80
|
+
}>>;
|
|
81
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
82
|
+
op: z.ZodLiteral<"addPage">;
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
title: z.ZodString;
|
|
85
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
86
|
+
showInNav: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
access: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
88
|
+
navGroupId: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
90
|
+
op: z.ZodLiteral<"removePage">;
|
|
91
|
+
pageId: z.ZodString;
|
|
92
|
+
removeSections: z.ZodOptional<z.ZodBoolean>;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
op: z.ZodLiteral<"addNavGroup">;
|
|
95
|
+
id: z.ZodString;
|
|
96
|
+
label: z.ZodOptional<z.ZodString>;
|
|
97
|
+
startCollapsed: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
+
pageIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
99
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
100
|
+
op: z.ZodLiteral<"removeNavGroup">;
|
|
101
|
+
groupId: z.ZodString;
|
|
102
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
103
|
+
op: z.ZodLiteral<"setNavGroupMeta">;
|
|
104
|
+
groupId: z.ZodString;
|
|
105
|
+
label: z.ZodOptional<z.ZodString>;
|
|
106
|
+
startCollapsed: z.ZodOptional<z.ZodBoolean>;
|
|
107
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
108
|
+
op: z.ZodLiteral<"movePageInNav">;
|
|
109
|
+
pageId: z.ZodString;
|
|
110
|
+
groupId: z.ZodNullable<z.ZodString>;
|
|
111
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
53
112
|
}, z.core.$strip>], "op">;
|
|
54
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Written out rather than `z.infer<typeof IndexOpSchema>`.
|
|
115
|
+
*
|
|
116
|
+
* The MCP SDK infers a tool's handler and JSON-Schema types from the Zod shape it
|
|
117
|
+
* is registered with, and at twelve union members each carrying several described
|
|
118
|
+
* optionals, re-deriving this union at that boundary overflowed tsc's stack — the
|
|
119
|
+
* `apps/mcp` typecheck segfaulted rather than failing with a diagnostic. Naming
|
|
120
|
+
* the type once caps that inference: consumers see this union directly instead of
|
|
121
|
+
* re-deriving it through the schema. `assertIndexOpTypesMatchSchema` in
|
|
122
|
+
* tests/lib/index-ops.test.ts pins the two together so they cannot drift.
|
|
123
|
+
*/
|
|
124
|
+
export type IndexOp = {
|
|
125
|
+
op: "insertAfter";
|
|
126
|
+
pageId: string;
|
|
127
|
+
afterId: string | null;
|
|
128
|
+
sections: SectionInsert[];
|
|
129
|
+
} | {
|
|
130
|
+
op: "insertAt";
|
|
131
|
+
pageId: string;
|
|
132
|
+
position: number;
|
|
133
|
+
sections: SectionInsert[];
|
|
134
|
+
} | {
|
|
135
|
+
op: "move";
|
|
136
|
+
pageId: string;
|
|
137
|
+
id: string;
|
|
138
|
+
afterId: string | null;
|
|
139
|
+
} | {
|
|
140
|
+
op: "remove";
|
|
141
|
+
ids: string[];
|
|
142
|
+
} | {
|
|
143
|
+
op: "setMeta";
|
|
144
|
+
id: string;
|
|
145
|
+
status?: OpStatus;
|
|
146
|
+
access?: string[];
|
|
147
|
+
} | {
|
|
148
|
+
op: "setPageMeta";
|
|
149
|
+
pageId: string;
|
|
150
|
+
title?: string;
|
|
151
|
+
slug?: string;
|
|
152
|
+
showInNav?: boolean;
|
|
153
|
+
access?: string[];
|
|
154
|
+
status?: PageStatus;
|
|
155
|
+
} | {
|
|
156
|
+
op: "addPage";
|
|
157
|
+
id: string;
|
|
158
|
+
title: string;
|
|
159
|
+
slug?: string;
|
|
160
|
+
showInNav?: boolean;
|
|
161
|
+
access?: string[];
|
|
162
|
+
navGroupId?: string;
|
|
163
|
+
} | {
|
|
164
|
+
op: "removePage";
|
|
165
|
+
pageId: string;
|
|
166
|
+
removeSections?: boolean;
|
|
167
|
+
} | {
|
|
168
|
+
op: "addNavGroup";
|
|
169
|
+
id: string;
|
|
170
|
+
label?: string;
|
|
171
|
+
startCollapsed?: boolean;
|
|
172
|
+
pageIds?: string[];
|
|
173
|
+
} | {
|
|
174
|
+
op: "removeNavGroup";
|
|
175
|
+
groupId: string;
|
|
176
|
+
} | {
|
|
177
|
+
op: "setNavGroupMeta";
|
|
178
|
+
groupId: string;
|
|
179
|
+
label?: string;
|
|
180
|
+
startCollapsed?: boolean;
|
|
181
|
+
} | {
|
|
182
|
+
op: "movePageInNav";
|
|
183
|
+
pageId: string;
|
|
184
|
+
groupId: string | null;
|
|
185
|
+
position?: number;
|
|
186
|
+
};
|
|
187
|
+
type OpStatus = z.infer<typeof OpStatusSchema>;
|
|
188
|
+
type PageStatus = z.infer<typeof PageStatusSchema>;
|
|
189
|
+
type SectionInsert = z.infer<typeof SectionInsertSchema>;
|
|
55
190
|
export type ApplyIndexOpsResult = {
|
|
56
191
|
ok: true;
|
|
57
192
|
index: SiteIndex;
|
|
@@ -73,5 +208,7 @@ export declare function collectPostedTypes(sections: {
|
|
|
73
208
|
* ops-only save touched anything at all. `setPageMeta` names no section.
|
|
74
209
|
*/
|
|
75
210
|
export declare function opTouchedSectionIds(ops: IndexOp[]): string[];
|
|
211
|
+
export declare function opsTouchNav(ops: IndexOp[]): boolean;
|
|
76
212
|
export declare function applyIndexOps(rawIndex: unknown, ops: IndexOp[], newSectionTypes: Record<string, string>): ApplyIndexOpsResult;
|
|
213
|
+
export {};
|
|
77
214
|
//# sourceMappingURL=index-ops.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-ops.d.ts","sourceRoot":"","sources":["../../src/lib/index-ops.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"index-ops.d.ts","sourceRoot":"","sources":["../../src/lib/index-ops.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAe,gBAAgB,EAA2B,KAAK,SAAS,EAAoB,MAAM,wBAA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,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GACxE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC,wEAAwE;AACxE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAAE,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOnH;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAQ5D;AAcD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,OAAO,CAEnD;AAiCD,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,OAAO,EACjB,GAAG,EAAE,OAAO,EAAE,EACd,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,mBAAmB,CAiVrB"}
|
package/dist/lib/index-ops.js
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addGroup,
|
|
3
|
+
addPage,
|
|
4
|
+
deleteGroup,
|
|
5
|
+
deletePage,
|
|
6
|
+
groupOfPage,
|
|
7
|
+
moveNavEntry,
|
|
8
|
+
navEntries,
|
|
9
|
+
reconcileNav,
|
|
10
|
+
renameGroup,
|
|
11
|
+
setGroupStartCollapsed,
|
|
12
|
+
slugifyPageSlug,
|
|
13
|
+
uniquePageSlug
|
|
14
|
+
} from "../chunk-TGNS7D4F.js";
|
|
1
15
|
import {
|
|
2
16
|
IndexSchema,
|
|
3
|
-
|
|
4
|
-
|
|
17
|
+
PageStatusSchema,
|
|
18
|
+
RESERVED_SLUGS,
|
|
19
|
+
SLUG_RE
|
|
20
|
+
} from "../chunk-BGHWUJFV.js";
|
|
5
21
|
import "../chunk-FM4M4Q2W.js";
|
|
6
22
|
import "../chunk-JSBRDJBE.js";
|
|
7
23
|
|
|
@@ -9,6 +25,7 @@ import "../chunk-JSBRDJBE.js";
|
|
|
9
25
|
import { z } from "zod";
|
|
10
26
|
var OpStatusSchema = z.enum(["draft", "live", "archived"]);
|
|
11
27
|
var SAFE_SECTION_ID = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
28
|
+
var SAFE_ENTITY_ID = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
12
29
|
var SectionInsertSchema = z.object({
|
|
13
30
|
id: z.string().regex(SAFE_SECTION_ID, "Section ids may only contain letters, numbers, dashes and underscores (max 64 chars) \u2014 they become filenames.").describe("The new section's id: letters, numbers, dashes, underscores; max 64 chars. Must not already exist in the index."),
|
|
14
31
|
status: OpStatusSchema.optional().describe('Defaults to "draft" \u2014 invisible to viewers until promoted to "live".'),
|
|
@@ -49,7 +66,45 @@ var IndexOpSchema = z.discriminatedUnion("op", [
|
|
|
49
66
|
title: z.string().optional().describe("New page title."),
|
|
50
67
|
slug: z.string().optional().describe("New URL slug (lowercase words joined by dashes). Not settable on the home page, whose slug is always empty."),
|
|
51
68
|
showInNav: z.boolean().optional().describe("Whether the page appears in site navigation."),
|
|
52
|
-
access: z.array(z.string()).optional().describe("New audience slugs from list_audiences; [] means everyone.")
|
|
69
|
+
access: z.array(z.string()).optional().describe("New audience slugs from list_audiences; [] means everyone."),
|
|
70
|
+
status: PageStatusSchema.optional().describe('Page status. "archived" hides the page and its sections from viewers without deleting anything; the home page cannot be archived.')
|
|
71
|
+
}),
|
|
72
|
+
z.object({
|
|
73
|
+
op: z.literal("addPage"),
|
|
74
|
+
id: z.string().regex(SAFE_ENTITY_ID, "Page ids may only contain letters, numbers, dashes and underscores (max 64 chars).").describe("The new page's id: letters, numbers, dashes, underscores; max 64 chars. Must not already exist."),
|
|
75
|
+
title: z.string().describe("Page title, shown in navigation."),
|
|
76
|
+
slug: z.string().optional().describe("URL slug (lowercase words joined by dashes). Defaults to a unique slug derived from the title."),
|
|
77
|
+
showInNav: z.boolean().optional().describe("Whether the page appears in site navigation. Defaults to true."),
|
|
78
|
+
access: z.array(z.string()).optional().describe("Audience slugs from list_audiences. Defaults to [] (everyone)."),
|
|
79
|
+
navGroupId: z.string().optional().describe("Put the new page inside this existing nav group instead of at the top level.")
|
|
80
|
+
}),
|
|
81
|
+
z.object({
|
|
82
|
+
op: z.literal("removePage"),
|
|
83
|
+
pageId: z.string().describe("The page to delete. The home page cannot be deleted."),
|
|
84
|
+
removeSections: z.boolean().optional().describe("Required `true` when the page still holds sections \u2014 they are deleted with it and their content files removed. Without it a non-empty page is refused, so a page is never emptied by accident.")
|
|
85
|
+
}),
|
|
86
|
+
z.object({
|
|
87
|
+
op: z.literal("addNavGroup"),
|
|
88
|
+
id: z.string().regex(SAFE_ENTITY_ID, "Nav group ids may only contain letters, numbers, dashes and underscores (max 64 chars).").describe("The new group's id: letters, numbers, dashes, underscores; max 64 chars."),
|
|
89
|
+
label: z.string().optional().describe('Group heading in the sidebar. Blank renders as "Untitled group".'),
|
|
90
|
+
startCollapsed: z.boolean().optional().describe("Whether the group renders collapsed on first viewer load. Defaults to false."),
|
|
91
|
+
pageIds: z.array(z.string()).optional().describe("Existing page ids to move into the group, in order. A page belongs to at most one group, so listing it here removes it from wherever it was.")
|
|
92
|
+
}),
|
|
93
|
+
z.object({
|
|
94
|
+
op: z.literal("removeNavGroup"),
|
|
95
|
+
groupId: z.string().describe("The group to remove. Its member pages are NOT deleted \u2014 they become top-level nav entries at the group's former position.")
|
|
96
|
+
}),
|
|
97
|
+
z.object({
|
|
98
|
+
op: z.literal("setNavGroupMeta"),
|
|
99
|
+
groupId: z.string().describe("An existing nav group id."),
|
|
100
|
+
label: z.string().optional().describe("New sidebar heading."),
|
|
101
|
+
startCollapsed: z.boolean().optional().describe("Whether the group renders collapsed on first viewer load.")
|
|
102
|
+
}),
|
|
103
|
+
z.object({
|
|
104
|
+
op: z.literal("movePageInNav"),
|
|
105
|
+
pageId: z.string().describe("The page to reposition in the sidebar."),
|
|
106
|
+
groupId: z.string().nullable().describe("Destination group id, or null to move the page out to the top level."),
|
|
107
|
+
position: z.number().int().min(0).optional().describe("0-based slot within the destination (inside the group, or among top-level nav entries). Defaults to the end.")
|
|
53
108
|
})
|
|
54
109
|
]);
|
|
55
110
|
function collectPostedTypes(sections) {
|
|
@@ -69,7 +124,25 @@ function opTouchedSectionIds(ops) {
|
|
|
69
124
|
}
|
|
70
125
|
return [...ids];
|
|
71
126
|
}
|
|
127
|
+
var NAV_TOUCHING_OPS = /* @__PURE__ */ new Set([
|
|
128
|
+
"addPage",
|
|
129
|
+
"removePage",
|
|
130
|
+
"addNavGroup",
|
|
131
|
+
"removeNavGroup",
|
|
132
|
+
"setNavGroupMeta",
|
|
133
|
+
"movePageInNav"
|
|
134
|
+
]);
|
|
135
|
+
function opsTouchNav(ops) {
|
|
136
|
+
return ops.some((op) => NAV_TOUCHING_OPS.has(op.op));
|
|
137
|
+
}
|
|
72
138
|
var fmt = (ids) => ids.map((id) => `"${id}"`).join(", ");
|
|
139
|
+
function moveIntoGroup(index, pageId, groupId, position) {
|
|
140
|
+
const entries = navEntries(index);
|
|
141
|
+
const currentGroup = groupOfPage(index, pageId);
|
|
142
|
+
const from = currentGroup ? { groupId: currentGroup.id, index: currentGroup.pageIds.indexOf(pageId) } : { groupId: null, index: entries.findIndex((e) => e.kind === "page" && e.pageId === pageId) };
|
|
143
|
+
const destLength = groupId === null ? entries.length : entries.find((e) => e.kind === "group" && e.id === groupId)?.pageIds.length ?? 0;
|
|
144
|
+
return moveNavEntry(index, from, { groupId, index: position ?? destLength });
|
|
145
|
+
}
|
|
73
146
|
function applyIndexOps(rawIndex, ops, newSectionTypes) {
|
|
74
147
|
const base = IndexSchema.safeParse(rawIndex);
|
|
75
148
|
if (!base.success) {
|
|
@@ -78,14 +151,17 @@ function applyIndexOps(rawIndex, ops, newSectionTypes) {
|
|
|
78
151
|
error: "the site's current index could not be parsed, so indexOps cannot be applied \u2014 read it with get_site_index and post a repaired full `index` instead. " + base.error.issues.map((i) => i.message).join("; ")
|
|
79
152
|
};
|
|
80
153
|
}
|
|
81
|
-
const
|
|
154
|
+
const rawNav = rawIndex?.nav;
|
|
155
|
+
let index = {
|
|
82
156
|
...base.data,
|
|
83
157
|
pages: base.data.pages.map((p) => ({ ...p, order: [...p.order] })),
|
|
84
|
-
sections: Object.fromEntries(Object.entries(base.data.sections).map(([k, v]) => [k, { ...v }]))
|
|
158
|
+
sections: Object.fromEntries(Object.entries(base.data.sections).map(([k, v]) => [k, { ...v }])),
|
|
159
|
+
...Array.isArray(rawNav) ? { nav: rawNav } : {}
|
|
85
160
|
};
|
|
86
161
|
const removed = /* @__PURE__ */ new Set();
|
|
87
162
|
const warnings = [];
|
|
88
163
|
const fail = (error) => ({ ok: false, error });
|
|
164
|
+
let navTouched = false;
|
|
89
165
|
for (const [i, op] of ops.entries()) {
|
|
90
166
|
const at = `indexOps[${i}] ${op.op}`;
|
|
91
167
|
if (op.op === "insertAfter" || op.op === "insertAt") {
|
|
@@ -181,11 +257,112 @@ function applyIndexOps(rawIndex, ops, newSectionTypes) {
|
|
|
181
257
|
if (op.access !== void 0) meta.access = op.access;
|
|
182
258
|
continue;
|
|
183
259
|
}
|
|
184
|
-
if (op.
|
|
185
|
-
|
|
260
|
+
if (op.op === "addPage") {
|
|
261
|
+
if (index.pages.some((p) => p.id === op.id)) {
|
|
262
|
+
return fail(`${at}: a page with id "${op.id}" already exists \u2014 use setPageMeta to edit it.`);
|
|
263
|
+
}
|
|
264
|
+
let slug;
|
|
265
|
+
if (op.slug !== void 0) {
|
|
266
|
+
if (!SLUG_RE.test(op.slug)) {
|
|
267
|
+
return fail(`${at}: slug "${op.slug}" is not a valid URL slug \u2014 use lowercase words joined by dashes (e.g. "brand-guide").`);
|
|
268
|
+
}
|
|
269
|
+
if (RESERVED_SLUGS.includes(op.slug)) {
|
|
270
|
+
return fail(`${at}: slug "${op.slug}" is reserved by a platform route and would shadow this page. Pick another slug.`);
|
|
271
|
+
}
|
|
272
|
+
if (index.pages.some((p) => p.slug === op.slug)) {
|
|
273
|
+
return fail(`${at}: slug "${op.slug}" is already used by another page. Slugs must be unique.`);
|
|
274
|
+
}
|
|
275
|
+
slug = op.slug;
|
|
276
|
+
} else {
|
|
277
|
+
slug = uniquePageSlug(slugifyPageSlug(op.title), index.pages.map((p) => p.slug));
|
|
278
|
+
}
|
|
279
|
+
if (op.navGroupId !== void 0 && !navEntries(index).some((e) => e.kind === "group" && e.id === op.navGroupId)) {
|
|
280
|
+
return fail(`${at}: no nav group with id "${op.navGroupId}" \u2014 create it with addNavGroup first, or omit navGroupId to place the page at the top level.`);
|
|
281
|
+
}
|
|
282
|
+
index = addPage(index, op.id);
|
|
283
|
+
const created = index.pages.find((p) => p.id === op.id);
|
|
284
|
+
created.title = op.title;
|
|
285
|
+
created.slug = slug;
|
|
286
|
+
if (op.showInNav !== void 0) created.showInNav = op.showInNav;
|
|
287
|
+
if (op.access !== void 0) created.access = op.access;
|
|
288
|
+
if (op.navGroupId !== void 0) {
|
|
289
|
+
index = moveIntoGroup(index, op.id, op.navGroupId, void 0);
|
|
290
|
+
}
|
|
291
|
+
navTouched = true;
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if (op.op === "removePage") {
|
|
295
|
+
const page2 = index.pages.find((p) => p.id === op.pageId);
|
|
296
|
+
if (!page2) return fail(`${at}: no page with id "${op.pageId}" \u2014 page ids come from get_site_index.`);
|
|
297
|
+
if (page2.isHome) {
|
|
298
|
+
return fail(`${at}: the home page cannot be removed \u2014 it is the site's root. Promote a different page to home in the editor first.`);
|
|
299
|
+
}
|
|
300
|
+
if (page2.order.length > 0 && op.removeSections !== true) {
|
|
301
|
+
return fail(
|
|
302
|
+
`${at}: page "${op.pageId}" still holds ${page2.order.length} section(s) (${fmt(page2.order.slice(0, 5))}${page2.order.length > 5 ? ", \u2026" : ""}). Pass removeSections: true to delete them with the page, or move them elsewhere first with move ops.`
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
const result2 = deletePage(index, op.pageId);
|
|
306
|
+
index = result2.index;
|
|
307
|
+
for (const id of result2.removedSectionIds) removed.add(id);
|
|
308
|
+
navTouched = true;
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (op.op === "addNavGroup") {
|
|
312
|
+
const entries = navEntries(index);
|
|
313
|
+
if (entries.some((e) => e.kind === "group" && e.id === op.id)) {
|
|
314
|
+
return fail(`${at}: a nav group with id "${op.id}" already exists \u2014 use setNavGroupMeta to edit it.`);
|
|
315
|
+
}
|
|
316
|
+
const missing = (op.pageIds ?? []).filter((id) => !index.pages.some((p) => p.id === id));
|
|
317
|
+
if (missing.length > 0) {
|
|
318
|
+
return fail(`${at}: no page with id ${fmt(missing)} \u2014 page ids come from get_site_index.`);
|
|
319
|
+
}
|
|
320
|
+
index = addGroup(index, op.id);
|
|
321
|
+
if (op.label !== void 0) index = renameGroup(index, op.id, op.label);
|
|
322
|
+
if (op.startCollapsed !== void 0) index = setGroupStartCollapsed(index, op.id, op.startCollapsed);
|
|
323
|
+
for (const pageId of op.pageIds ?? []) index = moveIntoGroup(index, pageId, op.id, void 0);
|
|
324
|
+
navTouched = true;
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
if (op.op === "removeNavGroup") {
|
|
328
|
+
if (!navEntries(index).some((e) => e.kind === "group" && e.id === op.groupId)) {
|
|
329
|
+
return fail(`${at}: no nav group with id "${op.groupId}" \u2014 group ids come from the \`nav\` on get_site_index.`);
|
|
330
|
+
}
|
|
331
|
+
index = deleteGroup(index, op.groupId);
|
|
332
|
+
navTouched = true;
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
if (op.op === "setNavGroupMeta") {
|
|
336
|
+
if (op.label === void 0 && op.startCollapsed === void 0) {
|
|
337
|
+
return fail(`${at}: nothing to set \u2014 provide label and/or startCollapsed.`);
|
|
338
|
+
}
|
|
339
|
+
if (!navEntries(index).some((e) => e.kind === "group" && e.id === op.groupId)) {
|
|
340
|
+
return fail(`${at}: no nav group with id "${op.groupId}" \u2014 group ids come from the \`nav\` on get_site_index.`);
|
|
341
|
+
}
|
|
342
|
+
if (op.label !== void 0) index = renameGroup(index, op.groupId, op.label);
|
|
343
|
+
if (op.startCollapsed !== void 0) index = setGroupStartCollapsed(index, op.groupId, op.startCollapsed);
|
|
344
|
+
navTouched = true;
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
if (op.op === "movePageInNav") {
|
|
348
|
+
if (!index.pages.some((p) => p.id === op.pageId)) {
|
|
349
|
+
return fail(`${at}: no page with id "${op.pageId}" \u2014 page ids come from get_site_index.`);
|
|
350
|
+
}
|
|
351
|
+
if (op.groupId !== null && !navEntries(index).some((e) => e.kind === "group" && e.id === op.groupId)) {
|
|
352
|
+
return fail(`${at}: no nav group with id "${op.groupId}" \u2014 group ids come from the \`nav\` on get_site_index.`);
|
|
353
|
+
}
|
|
354
|
+
index = moveIntoGroup(index, op.pageId, op.groupId, op.position);
|
|
355
|
+
navTouched = true;
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
if (op.title === void 0 && op.slug === void 0 && op.showInNav === void 0 && op.access === void 0 && op.status === void 0) {
|
|
359
|
+
return fail(`${at}: nothing to set \u2014 provide title, slug, showInNav, access and/or status.`);
|
|
186
360
|
}
|
|
187
361
|
const page = index.pages.find((p) => p.id === op.pageId);
|
|
188
362
|
if (!page) return fail(`${at}: no page with id "${op.pageId}" \u2014 page ids come from get_site_index.`);
|
|
363
|
+
if (op.status === "archived" && page.isHome) {
|
|
364
|
+
return fail(`${at}: the home page cannot be archived \u2014 it is the site's root. Promote a different page to home in the editor first.`);
|
|
365
|
+
}
|
|
189
366
|
if (op.slug !== void 0 && page.isHome) {
|
|
190
367
|
return fail(`${at}: the home page's slug is always empty and cannot be set. Promote a different page to home in the editor if you need to change which page is the root.`);
|
|
191
368
|
}
|
|
@@ -195,6 +372,7 @@ function applyIndexOps(rawIndex, ops, newSectionTypes) {
|
|
|
195
372
|
if (op.title !== void 0) page.title = op.title;
|
|
196
373
|
if (op.slug !== void 0) page.slug = op.slug;
|
|
197
374
|
if (op.showInNav !== void 0) page.showInNav = op.showInNav;
|
|
375
|
+
if (op.status !== void 0) page.status = op.status;
|
|
198
376
|
if (op.access !== void 0) {
|
|
199
377
|
const dropped = page.access.filter((a) => !op.access.includes(a));
|
|
200
378
|
page.access = op.access;
|
|
@@ -213,11 +391,13 @@ function applyIndexOps(rawIndex, ops, newSectionTypes) {
|
|
|
213
391
|
if (!validated.success) {
|
|
214
392
|
return fail(`applying indexOps produced an invalid index: ${validated.error.issues.map((issue) => issue.message).join("; ")}`);
|
|
215
393
|
}
|
|
216
|
-
|
|
394
|
+
const result = navTouched ? { ...validated.data, nav: reconcileNav(index.nav ?? [], validated.data.pages) } : validated.data;
|
|
395
|
+
return { ok: true, index: result, removedIds, warnings };
|
|
217
396
|
}
|
|
218
397
|
export {
|
|
219
398
|
IndexOpSchema,
|
|
220
399
|
applyIndexOps,
|
|
221
400
|
collectPostedTypes,
|
|
222
|
-
opTouchedSectionIds
|
|
401
|
+
opTouchedSectionIds,
|
|
402
|
+
opsTouchNav
|
|
223
403
|
};
|
package/dist/lib/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
safeRedirect,
|
|
19
19
|
suggestAccessibleOn,
|
|
20
20
|
wcagLevel
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-CZLYECHC.js";
|
|
22
22
|
import {
|
|
23
23
|
curatedIcons,
|
|
24
24
|
getIcon
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
import {
|
|
39
39
|
cn
|
|
40
40
|
} from "../chunk-7EOSDFS3.js";
|
|
41
|
+
import "../chunk-S2L3BPLS.js";
|
|
41
42
|
import {
|
|
42
43
|
audiencePasses,
|
|
43
44
|
groupDisplayLabel,
|
|
@@ -45,10 +46,9 @@ import {
|
|
|
45
46
|
navEntries,
|
|
46
47
|
pagesInNavOrder,
|
|
47
48
|
reconcileNav
|
|
48
|
-
} from "../chunk-
|
|
49
|
-
import "../chunk-S2L3BPLS.js";
|
|
49
|
+
} from "../chunk-TGNS7D4F.js";
|
|
50
50
|
import "../chunk-5BM2Y3NJ.js";
|
|
51
|
-
import "../chunk-
|
|
51
|
+
import "../chunk-REDDTTGJ.js";
|
|
52
52
|
import "../chunk-TZQPOR5A.js";
|
|
53
53
|
import {
|
|
54
54
|
clearRegistry,
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
registerSchema,
|
|
62
62
|
registerSection
|
|
63
63
|
} from "../chunk-VKAGMEKE.js";
|
|
64
|
-
import "../chunk-
|
|
64
|
+
import "../chunk-BGHWUJFV.js";
|
|
65
65
|
import "../chunk-FM4M4Q2W.js";
|
|
66
66
|
import "../chunk-NSCT3AMV.js";
|
|
67
67
|
import {
|
package/dist/lib/loader.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ export interface LoadedSection {
|
|
|
7
7
|
export interface SiteContent {
|
|
8
8
|
sections: LoadedSection[];
|
|
9
9
|
index: SiteIndex;
|
|
10
|
+
/** True when nav.json was present but held entries this package version could
|
|
11
|
+
* not represent (unknown kinds, invalid shapes) — the returned nav is missing
|
|
12
|
+
* them. Writers must treat a degraded nav as read-only: wholesale-replacing
|
|
13
|
+
* nav.json from a degraded read permanently destroys the entries this
|
|
14
|
+
* version dropped. */
|
|
15
|
+
navDegraded: boolean;
|
|
10
16
|
}
|
|
11
17
|
/**
|
|
12
18
|
* Merge a validated index with raw section file contents.
|