@vcp-dev/site-edit-engine 0.10.70 → 0.11.2

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.
@@ -1,29 +0,0 @@
1
- export type SiteEditProjectFileInfo = {
2
- path: string;
3
- sizeBytes: number;
4
- };
5
- export type SiteEditProjectFileListTruncationReason = "max-files" | "max-depth" | "max-total-bytes";
6
- export type SiteEditProjectFileListResult = {
7
- files: SiteEditProjectFileInfo[];
8
- truncated?: {
9
- reasons: SiteEditProjectFileListTruncationReason[];
10
- };
11
- };
12
- export interface SiteEditProjectFileSystem {
13
- readFile(file: string): Promise<string>;
14
- readFileBytes?(file: string): Promise<Uint8Array>;
15
- getFileInfo?(file: string): Promise<SiteEditProjectFileInfo | null>;
16
- writeFile(file: string, content: string): Promise<void>;
17
- /** Atomically creates a new file and fails when the target already exists. */
18
- createExclusive?(file: string, content: string): Promise<void>;
19
- deleteFile(file: string): Promise<void>;
20
- exists(file: string): Promise<boolean>;
21
- listFiles?(input?: {
22
- roots?: string[];
23
- maxFiles?: number;
24
- maxDepth?: number;
25
- maxTotalBytes?: number;
26
- }): Promise<SiteEditProjectFileInfo[] | SiteEditProjectFileListResult>;
27
- getVersion(file: string): number;
28
- bumpVersion(file: string): number;
29
- }
package/dist/runtime.d.ts DELETED
@@ -1,328 +0,0 @@
1
- import type { SiteEditCompositionSelector, SiteEditOperationSelectionRef } from "@vcp-dev/contracts";
2
- import { type SiteEditResolveSourceLocationInput } from "@vcp-dev/contracts";
3
- import type { SiteEditEngineRuntime, SiteEditEngineRuntimeOptions, SiteEditPlanOperationResult } from "./types.js";
4
- export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRuntime {
5
- private readonly options;
6
- private readonly engine;
7
- private readonly fileSystem;
8
- constructor(options: SiteEditEngineRuntimeOptions);
9
- get status(): SiteEditEngineRuntime["status"];
10
- initializeComposition(composition: SiteEditCompositionSelector): Promise<void>;
11
- getDocument(composition: SiteEditCompositionSelector): {
12
- siteId: string;
13
- snapshotId: string;
14
- composition: {
15
- routeId: string;
16
- effectiveTemplateId?: string | undefined;
17
- };
18
- version: number;
19
- entries: {
20
- key: string;
21
- operationSummary: {
22
- canUpdateText: boolean;
23
- canInsertChild: boolean;
24
- canMove: boolean;
25
- canRemove: boolean;
26
- };
27
- parentKey?: string | null | undefined;
28
- pageCompositionUnitKey?: string | undefined;
29
- pageCompositionActionScope?: {
30
- kind: "route-unit";
31
- } | {
32
- kind: "source-siblings";
33
- siblingKeys: string[];
34
- } | {
35
- kind: "unavailable";
36
- } | undefined;
37
- dynamicDataSummary?: {
38
- hasDynamicData: boolean;
39
- sourceKinds: ("vcp-cms-collection" | "vcp-cms-form" | "vcp-cms-settings" | "vcp-cms-navigation" | "site-api-route" | "external-api" | "unknown-api")[];
40
- collections?: string[] | undefined;
41
- primaryEndpoint?: string | undefined;
42
- primaryCollection?: string | undefined;
43
- primaryFieldPath?: string | undefined;
44
- } | undefined;
45
- }[];
46
- pageComposition: {
47
- status: "supported";
48
- containerKey: string;
49
- hasBusinessMembers: boolean;
50
- placementUnitKeys: string[];
51
- placements: {
52
- placementKey: string;
53
- placementUnitKey: string;
54
- relation: "before" | "after" | "prepend" | "append";
55
- }[];
56
- } | {
57
- status: "unsupported";
58
- reason: "VERSION_STALE" | "RECOVERY_REQUIRED" | "MULTIPLE_PAGE_RETURNS" | "INDIRECT_RETURN_ONLY" | "PAGE_CONTAINER_AMBIGUOUS" | "NO_SAFE_PAGE_PLACEMENT" | "MEMBER_NOT_INDEPENDENT" | "UNSUPPORTED_ROUTE_STRUCTURE" | "RUNTIME_ANCHOR_UNRESOLVED" | "ROUTE_RETURN_NOT_FOUND";
59
- diagnostics: {
60
- code: string;
61
- message: string;
62
- }[];
63
- };
64
- };
65
- getStyleContext(composition: SiteEditCompositionSelector): {
66
- composition: {
67
- routeId: string;
68
- effectiveTemplateId?: string | undefined;
69
- };
70
- revision: string;
71
- entryCss: {
72
- path: string;
73
- content: string;
74
- hash?: string | undefined;
75
- };
76
- stylesheets: {
77
- path: string;
78
- content: string;
79
- hash?: string | undefined;
80
- }[];
81
- } | null;
82
- getObjectEditContext(key: string, composition: SiteEditCompositionSelector, selectionRef?: SiteEditOperationSelectionRef): {
83
- composition: {
84
- routeId: string;
85
- effectiveTemplateId?: string | undefined;
86
- };
87
- key: string;
88
- tag: string;
89
- label: string;
90
- isOpaque: boolean;
91
- ancestors: {
92
- key: string;
93
- label: string;
94
- tag: string;
95
- }[];
96
- componentName: string;
97
- sourceFile: string;
98
- capabilities: {
99
- composition: {
100
- routeId: string;
101
- effectiveTemplateId?: string | undefined;
102
- };
103
- key: string;
104
- canUpdateText: boolean;
105
- canInsertChild: boolean;
106
- canMove: boolean;
107
- canRemove: boolean;
108
- constraints: {
109
- kind: "component-boundary" | "repeat-region" | "conditional-region" | "opaque-region" | "void-element" | "read-only" | "cross-file-required" | "import-required";
110
- message: string;
111
- }[];
112
- editModes?: {
113
- updateText?: {
114
- mode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
115
- reasonCode?: string | undefined;
116
- } | undefined;
117
- insertChild?: {
118
- mode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
119
- reasonCode?: string | undefined;
120
- } | undefined;
121
- move?: {
122
- mode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
123
- reasonCode?: string | undefined;
124
- } | undefined;
125
- remove?: {
126
- mode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
127
- reasonCode?: string | undefined;
128
- } | undefined;
129
- } | undefined;
130
- };
131
- textSegments: {
132
- index: number;
133
- editable: boolean;
134
- sourceKind: "literal" | "binding" | "imported-binding" | "repeat-template" | null;
135
- }[];
136
- boundaryKind: "component-boundary" | "repeat-region" | "conditional-region" | "fragment-region" | "opaque-region" | null;
137
- linkSourceKind?: "unsupported" | "native-anchor" | "next-link" | undefined;
138
- sourceLocator?: {
139
- sourceFile: string;
140
- componentName: string;
141
- openingElementRange: {
142
- startLine: number;
143
- startColumn: number;
144
- endLine: number;
145
- endColumn: number;
146
- };
147
- structuralPath: string;
148
- textPreview?: string | undefined;
149
- } | undefined;
150
- provenanceChain?: {
151
- editMode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
152
- diagnostics: {
153
- code: string;
154
- message: string;
155
- }[];
156
- } | undefined;
157
- dynamicData?: {
158
- hasDynamicData: boolean;
159
- bindings: {
160
- sourceKind: "vcp-cms-collection" | "vcp-cms-form" | "vcp-cms-settings" | "vcp-cms-navigation" | "site-api-route" | "external-api" | "unknown-api";
161
- sourceType: "api-field" | "cms-field";
162
- targetKind: "repeat-region" | "conditional-region" | "text" | "attribute" | "richtext" | "component-prop";
163
- targetName: string;
164
- confidence: "exact" | "safe-derived" | "partial" | "unknown";
165
- readonly: true;
166
- evidence: {
167
- file: string;
168
- reason: string;
169
- symbol?: string | undefined;
170
- }[];
171
- endpointPattern?: string | undefined;
172
- operation?: string | undefined;
173
- collection?: string | undefined;
174
- fieldPath?: string | undefined;
175
- valuePath?: string | undefined;
176
- }[];
177
- } | undefined;
178
- properties?: {
179
- documentVersion: number;
180
- items: {
181
- name: string;
182
- source: {
183
- kind: "expression" | "literal" | "binding" | "repeat-template" | "boolean-shorthand";
184
- raw?: string | undefined;
185
- };
186
- resolution: {
187
- status: "resolved";
188
- value: import("@vcp-dev/contracts").SiteEditOperationValue;
189
- } | {
190
- status: "undefined";
191
- } | {
192
- status: "unresolved";
193
- };
194
- editMode: "direct" | "proxy" | "upstream" | "readonly" | "unsupported";
195
- sourceScope: "node" | "repeat-template" | "repeat-item";
196
- allowedWriteScopes: ("template" | "selection")[];
197
- diagnostics: {
198
- code: string;
199
- message: string;
200
- }[];
201
- effectiveWriteTarget?: {
202
- kind: "jsx-node" | "route-export" | "value-path" | "external-entry";
203
- isProxy: boolean;
204
- file?: string | undefined;
205
- displayPath?: string | undefined;
206
- sourceType?: "api-field" | "cms-field" | "i18n-message" | "config-entry" | undefined;
207
- sourceId?: string | undefined;
208
- } | undefined;
209
- }[];
210
- spreads: {
211
- raw: string;
212
- sourceRange: {
213
- start: number;
214
- end: number;
215
- };
216
- order: number;
217
- diagnostics: {
218
- code: string;
219
- message: string;
220
- }[];
221
- }[];
222
- creation: {
223
- selection: "direct" | "unsupported" | "materialize";
224
- template: "direct" | "unsupported";
225
- };
226
- selectionRef?: {
227
- key: string;
228
- instanceIndex?: number | undefined;
229
- instanceCount?: number | undefined;
230
- } | undefined;
231
- } | undefined;
232
- };
233
- getClassNameSource(key: string, composition: SiteEditCompositionSelector): {
234
- key: string;
235
- composition: {
236
- routeId: string;
237
- effectiveTemplateId?: string | undefined;
238
- };
239
- filePath: string;
240
- componentName: string;
241
- sourceKind: "expression" | "missing" | "stringLiteral";
242
- attrRaw: string | null;
243
- valueRaw: string | null;
244
- attrRange: {
245
- start: number;
246
- end: number;
247
- } | null;
248
- openingElementRange: {
249
- start: number;
250
- end: number;
251
- };
252
- version: {
253
- documentVersion: number;
254
- contentHash: string;
255
- };
256
- diagnostics: {
257
- code: "missing-class-name" | "unsupported-attribute-name" | "source-locator-warning" | "invalid-new-attr" | "version-conflict" | "write-failed";
258
- message: string;
259
- }[];
260
- computedStyle?: Record<string, string> | undefined;
261
- };
262
- getSourceTree(composition: SiteEditCompositionSelector): Promise<{
263
- composition: {
264
- routeId: string;
265
- effectiveTemplateId?: string | undefined;
266
- };
267
- nodes: import("@vcp-dev/contracts").SiteEditSourceTreeNode[];
268
- totalFiles: number;
269
- defaultPath?: string | undefined;
270
- truncated?: {
271
- reasons: ("max-files" | "max-depth" | "max-total-bytes")[];
272
- maxFiles: number;
273
- maxDepth: number;
274
- maxTotalBytes: number;
275
- } | undefined;
276
- }>;
277
- getSourceFile(input: {
278
- path: string;
279
- composition: SiteEditCompositionSelector;
280
- }): Promise<{
281
- composition: {
282
- routeId: string;
283
- effectiveTemplateId?: string | undefined;
284
- };
285
- path: string;
286
- sizeBytes: number;
287
- kind: "text";
288
- language: string;
289
- readonly: boolean;
290
- content: string;
291
- contentHash?: string | undefined;
292
- } | {
293
- composition: {
294
- routeId: string;
295
- effectiveTemplateId?: string | undefined;
296
- };
297
- path: string;
298
- sizeBytes: number;
299
- kind: "binary";
300
- language: null;
301
- readonly: true;
302
- mimeType: string;
303
- contentHash?: string | undefined;
304
- contentBase64?: string | undefined;
305
- previewUnavailableReason?: "too-large" | "unsupported-mime" | "bytes-unavailable" | undefined;
306
- }>;
307
- resolveSourceLocation(input: SiteEditResolveSourceLocationInput): {
308
- key: string;
309
- composition: {
310
- routeId: string;
311
- effectiveTemplateId?: string | undefined;
312
- };
313
- sourceFile: string;
314
- componentName: string;
315
- openingElementRange: {
316
- startLine: number;
317
- startColumn: number;
318
- endLine: number;
319
- endColumn: number;
320
- };
321
- structuralPath: string;
322
- textPreview?: string | undefined;
323
- };
324
- planOperation(request: Parameters<SiteEditEngineRuntime["planOperation"]>[0]): Promise<SiteEditPlanOperationResult>;
325
- dispose(): void;
326
- private createEngine;
327
- }
328
- export declare function createSiteEditEngineRuntime(options: SiteEditEngineRuntimeOptions): SiteEditEngineRuntime;
@@ -1,24 +0,0 @@
1
- import type { File } from "@babel/types";
2
- /** Public source parsing result; declaration files must not expose graph internals. */
3
- export type SiteEditSourceModuleResult = {
4
- ok: true;
5
- module: {
6
- readonly file: string;
7
- readonly source: string;
8
- readonly sourceHash: string;
9
- readonly ast: File;
10
- readonly imports: readonly {
11
- readonly specifier: string;
12
- }[];
13
- };
14
- } | {
15
- ok: false;
16
- diagnostic: {
17
- path: string;
18
- code: "parse-failed" | "import-resolve-failed" | "import-not-found" | "import-read-failed";
19
- message: string;
20
- details?: Record<string, unknown>;
21
- };
22
- };
23
- export declare function parseSourceModule(file: string, source: string): SiteEditSourceModuleResult;
24
- export declare function resolveImportBase(fromFile: string, specifier: string): string;
package/dist/types.d.ts DELETED
@@ -1,99 +0,0 @@
1
- import type { SiteEditCommandSuccess, SiteEditEvent, SiteEditGetClassNameSourceCommandResult, SiteEditGetClassNameSourceResult, SiteEditClassNameSourceStyleContext, SiteEditCompositionSelector, SiteEditCompositionContext, SiteEditObjectEditContext, SiteEditOperationCommandResult, SiteEditMutationContext, SiteEditOperationRequest, SiteEditOperationSelectionRef, SiteEditPatchPlan, SiteEditRenderDocument, SiteEditResolveSourceLocationInput, SiteEditSourceFileResponse, SiteEditSourceLocation, SiteEditSourceTreeResponse } from "@vcp-dev/contracts";
2
- import type { SiteEditProjectFileSystem } from "./public-file-system.js";
3
- import type { FileHistoryStore } from "./history/file-history-store.js";
4
- export type { SiteEditProjectFileSystem } from "./public-file-system.js";
5
- export interface SiteEditSnapshotFile {
6
- path: string;
7
- content: string;
8
- version?: number;
9
- }
10
- export interface SiteEditEngineRoute {
11
- routeId: string;
12
- entryFile: string;
13
- }
14
- export interface SiteEditEngineComposition {
15
- context: SiteEditCompositionContext;
16
- entryFile: string;
17
- }
18
- export interface SiteEditEngineRuntimeOptions {
19
- tenantId?: string;
20
- siteId: string;
21
- snapshotId: string;
22
- files: SiteEditSnapshotFile[];
23
- compositions: readonly SiteEditEngineComposition[];
24
- onEvent?: (event: SiteEditEvent) => void;
25
- dev?: boolean;
26
- historyStore?: FileHistoryStore;
27
- initialDocumentVersions?: readonly {
28
- composition: SiteEditCompositionContext;
29
- version: number;
30
- }[];
31
- /** Server resource Working Set only: defer missing translations until Agent validation. */
32
- resourceTranslationLocale?: string;
33
- }
34
- export interface SiteEditPlanOperationResult {
35
- result: SiteEditOperationCommandResult;
36
- patchPlan?: SiteEditPatchPlan;
37
- }
38
- export interface SiteEditEngineHistoryStatus {
39
- readonly canUndo: boolean;
40
- readonly canRedo: boolean;
41
- readonly undoDepth: number;
42
- readonly redoDepth: number;
43
- readonly recoveryRequired: boolean;
44
- }
45
- export interface SiteEditEngineRuntime {
46
- readonly status: "idle" | "building" | "ready" | "disposed";
47
- initializeComposition(composition: SiteEditCompositionSelector): Promise<void>;
48
- getDocument(composition: SiteEditCompositionSelector): SiteEditRenderDocument;
49
- getStyleContext(composition: SiteEditCompositionSelector): SiteEditClassNameSourceStyleContext | null;
50
- getObjectEditContext(key: string, composition: SiteEditCompositionSelector, selectionRef?: SiteEditOperationSelectionRef): SiteEditObjectEditContext;
51
- getClassNameSource(key: string, composition: SiteEditCompositionSelector): SiteEditGetClassNameSourceResult;
52
- getSourceTree(composition: SiteEditCompositionSelector): Promise<SiteEditSourceTreeResponse>;
53
- getSourceFile(input: {
54
- path: string;
55
- composition: SiteEditCompositionSelector;
56
- }): Promise<SiteEditSourceFileResponse>;
57
- resolveSourceLocation(input: SiteEditResolveSourceLocationInput): SiteEditSourceLocation;
58
- planOperation(request: SiteEditOperationRequest): Promise<SiteEditPlanOperationResult>;
59
- dispose(): void;
60
- }
61
- export interface PreviewSiteEditEngineRuntimeOptions {
62
- tenantId?: string;
63
- siteId: string;
64
- snapshotId: string;
65
- projectRoot: string;
66
- compositions: readonly SiteEditEngineComposition[];
67
- onEvent?: (event: SiteEditEvent) => void;
68
- dev?: boolean;
69
- fileSystem?: SiteEditProjectFileSystem;
70
- historyStore?: FileHistoryStore;
71
- initialDocumentVersions?: readonly {
72
- composition: SiteEditCompositionContext;
73
- version: number;
74
- }[];
75
- }
76
- export interface PreviewSiteEditEngineRuntime {
77
- readonly status: "idle" | "building" | "ready" | "error" | "disposed";
78
- initializeComposition(composition: SiteEditCompositionSelector): Promise<void>;
79
- registerComposition(composition: SiteEditCompositionContext, entryFile: string): void;
80
- unregisterComposition(composition: SiteEditCompositionSelector): void;
81
- getDocument(composition: SiteEditCompositionSelector): SiteEditCommandSuccess<SiteEditRenderDocument>;
82
- getStyleContext(composition: SiteEditCompositionSelector): SiteEditCommandSuccess<SiteEditClassNameSourceStyleContext | null>;
83
- getHistoryStatus(): Promise<SiteEditCommandSuccess<SiteEditEngineHistoryStatus>>;
84
- getObjectEditContext(key: string, composition: SiteEditCompositionSelector, selectionRef?: SiteEditOperationSelectionRef): SiteEditCommandSuccess<SiteEditObjectEditContext>;
85
- getClassNameSource(key: string, composition: SiteEditCompositionSelector): SiteEditGetClassNameSourceCommandResult;
86
- getSourceTree(composition: SiteEditCompositionSelector): Promise<SiteEditCommandSuccess<SiteEditSourceTreeResponse>>;
87
- getSourceFile(input: {
88
- path: string;
89
- composition: SiteEditCompositionSelector;
90
- }): Promise<SiteEditCommandSuccess<SiteEditSourceFileResponse>>;
91
- resolveSourceLocation(input: SiteEditResolveSourceLocationInput): SiteEditCommandSuccess<SiteEditSourceLocation>;
92
- refreshSourceForKey(key: string, composition: SiteEditCompositionSelector): Promise<void>;
93
- executeOperation(request: SiteEditOperationRequest, mutationContext?: SiteEditMutationContext): Promise<SiteEditOperationCommandResult>;
94
- undo(mutationContext?: SiteEditMutationContext): Promise<SiteEditOperationCommandResult>;
95
- redo(mutationContext?: SiteEditMutationContext): Promise<SiteEditOperationCommandResult>;
96
- notifyFileChanged(file: string): void;
97
- subscribe(listener: (event: SiteEditEvent) => void): () => void;
98
- dispose(): void;
99
- }