@vcp-dev/site-edit-engine 0.6.11 → 0.7.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/README.md +5 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +11 -11
- package/dist/internal/protocol/capability.d.ts +2 -0
- package/dist/internal/protocol/event.d.ts +8 -4
- package/dist/internal/protocol/operation.d.ts +3 -1
- package/dist/internal/protocol/render.d.ts +4 -1
- package/dist/next-app-router.d.ts +2 -1
- package/dist/next-app-router.js +1 -1
- package/dist/page-template-managed-source.d.ts +59 -0
- package/dist/preview-runtime.d.ts +295 -22
- package/dist/runtime.d.ts +44 -15
- package/dist/types.d.ts +32 -22
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SiteEditCommandSuccess,
|
|
1
|
+
import type { SiteEditCommandSuccess, SiteEditCompositionContext, SiteEditCompositionSelector, SiteEditMutationContext, SiteEditResolveSourceLocationInput } from "@vcp-dev/contracts";
|
|
2
2
|
import type { SiteEditEngineHistoryStatus, PreviewSiteEditEngineRuntime, PreviewSiteEditEngineRuntimeOptions } from "./types.js";
|
|
3
3
|
export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSiteEditEngineRuntime {
|
|
4
4
|
private readonly options;
|
|
@@ -6,15 +6,22 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
6
6
|
private readonly listeners;
|
|
7
7
|
constructor(options: PreviewSiteEditEngineRuntimeOptions);
|
|
8
8
|
get status(): PreviewSiteEditEngineRuntime["status"];
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
getDocument(
|
|
9
|
+
initializeComposition(composition: SiteEditCompositionSelector): Promise<void>;
|
|
10
|
+
registerComposition(composition: SiteEditCompositionContext, entryFile: string): void;
|
|
11
|
+
unregisterComposition(composition: SiteEditCompositionSelector): void;
|
|
12
|
+
getDocument(composition: SiteEditCompositionSelector): {
|
|
13
13
|
ok: true;
|
|
14
|
+
composition: {
|
|
15
|
+
routeId: string;
|
|
16
|
+
effectiveTemplateId?: string | undefined;
|
|
17
|
+
};
|
|
14
18
|
data: {
|
|
15
19
|
siteId: string;
|
|
16
20
|
snapshotId: string;
|
|
17
|
-
|
|
21
|
+
composition: {
|
|
22
|
+
routeId: string;
|
|
23
|
+
effectiveTemplateId?: string | undefined;
|
|
24
|
+
};
|
|
18
25
|
version: number;
|
|
19
26
|
entries: {
|
|
20
27
|
key: string;
|
|
@@ -53,9 +60,17 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
53
60
|
};
|
|
54
61
|
};
|
|
55
62
|
};
|
|
56
|
-
getStyleContext(
|
|
63
|
+
getStyleContext(composition: SiteEditCompositionSelector): {
|
|
57
64
|
ok: true;
|
|
65
|
+
composition: {
|
|
66
|
+
routeId: string;
|
|
67
|
+
effectiveTemplateId?: string | undefined;
|
|
68
|
+
};
|
|
58
69
|
data: {
|
|
70
|
+
composition: {
|
|
71
|
+
routeId: string;
|
|
72
|
+
effectiveTemplateId?: string | undefined;
|
|
73
|
+
};
|
|
59
74
|
revision: string;
|
|
60
75
|
entryCss: {
|
|
61
76
|
path: string;
|
|
@@ -70,9 +85,17 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
70
85
|
} | null;
|
|
71
86
|
};
|
|
72
87
|
getHistoryStatus(): Promise<SiteEditCommandSuccess<SiteEditEngineHistoryStatus>>;
|
|
73
|
-
getObjectEditContext(key: string,
|
|
88
|
+
getObjectEditContext(key: string, composition: SiteEditCompositionSelector): {
|
|
74
89
|
readonly ok: true;
|
|
90
|
+
readonly composition: {
|
|
91
|
+
routeId: string;
|
|
92
|
+
effectiveTemplateId?: string | undefined;
|
|
93
|
+
};
|
|
75
94
|
readonly data: {
|
|
95
|
+
composition: {
|
|
96
|
+
routeId: string;
|
|
97
|
+
effectiveTemplateId?: string | undefined;
|
|
98
|
+
};
|
|
76
99
|
key: string;
|
|
77
100
|
tag: string;
|
|
78
101
|
label: string;
|
|
@@ -85,6 +108,10 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
85
108
|
componentName: string;
|
|
86
109
|
sourceFile: string;
|
|
87
110
|
capabilities: {
|
|
111
|
+
composition: {
|
|
112
|
+
routeId: string;
|
|
113
|
+
effectiveTemplateId?: string | undefined;
|
|
114
|
+
};
|
|
88
115
|
key: string;
|
|
89
116
|
canUpdateText: boolean;
|
|
90
117
|
canInsertChild: boolean;
|
|
@@ -161,11 +188,18 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
161
188
|
} | undefined;
|
|
162
189
|
};
|
|
163
190
|
};
|
|
164
|
-
getClassNameSource(key: string,
|
|
191
|
+
getClassNameSource(key: string, composition: SiteEditCompositionSelector): {
|
|
165
192
|
readonly ok: true;
|
|
193
|
+
readonly composition: {
|
|
194
|
+
routeId: string;
|
|
195
|
+
effectiveTemplateId?: string | undefined;
|
|
196
|
+
};
|
|
166
197
|
readonly data: {
|
|
167
198
|
key: string;
|
|
168
|
-
|
|
199
|
+
composition: {
|
|
200
|
+
routeId: string;
|
|
201
|
+
effectiveTemplateId?: string | undefined;
|
|
202
|
+
};
|
|
169
203
|
filePath: string;
|
|
170
204
|
componentName: string;
|
|
171
205
|
sourceKind: "expression" | "missing" | "stringLiteral";
|
|
@@ -190,9 +224,17 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
190
224
|
computedStyle?: Record<string, string> | undefined;
|
|
191
225
|
};
|
|
192
226
|
};
|
|
193
|
-
getSourceTree(): Promise<{
|
|
227
|
+
getSourceTree(composition: SiteEditCompositionSelector): Promise<{
|
|
194
228
|
ok: true;
|
|
229
|
+
composition: {
|
|
230
|
+
routeId: string;
|
|
231
|
+
effectiveTemplateId?: string | undefined;
|
|
232
|
+
};
|
|
195
233
|
data: {
|
|
234
|
+
composition: {
|
|
235
|
+
routeId: string;
|
|
236
|
+
effectiveTemplateId?: string | undefined;
|
|
237
|
+
};
|
|
196
238
|
nodes: import("@vcp-dev/contracts").SiteEditSourceTreeNode[];
|
|
197
239
|
totalFiles: number;
|
|
198
240
|
defaultPath?: string | undefined;
|
|
@@ -206,9 +248,18 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
206
248
|
}>;
|
|
207
249
|
getSourceFile(input: {
|
|
208
250
|
path: string;
|
|
251
|
+
composition: SiteEditCompositionSelector;
|
|
209
252
|
}): Promise<{
|
|
210
253
|
ok: true;
|
|
254
|
+
composition: {
|
|
255
|
+
routeId: string;
|
|
256
|
+
effectiveTemplateId?: string | undefined;
|
|
257
|
+
};
|
|
211
258
|
data: {
|
|
259
|
+
composition: {
|
|
260
|
+
routeId: string;
|
|
261
|
+
effectiveTemplateId?: string | undefined;
|
|
262
|
+
};
|
|
212
263
|
path: string;
|
|
213
264
|
sizeBytes: number;
|
|
214
265
|
kind: "text";
|
|
@@ -217,6 +268,10 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
217
268
|
content: string;
|
|
218
269
|
contentHash?: string | undefined;
|
|
219
270
|
} | {
|
|
271
|
+
composition: {
|
|
272
|
+
routeId: string;
|
|
273
|
+
effectiveTemplateId?: string | undefined;
|
|
274
|
+
};
|
|
220
275
|
path: string;
|
|
221
276
|
sizeBytes: number;
|
|
222
277
|
kind: "binary";
|
|
@@ -230,8 +285,16 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
230
285
|
}>;
|
|
231
286
|
resolveSourceLocation(input: SiteEditResolveSourceLocationInput): {
|
|
232
287
|
ok: true;
|
|
288
|
+
composition: {
|
|
289
|
+
routeId: string;
|
|
290
|
+
effectiveTemplateId?: string | undefined;
|
|
291
|
+
};
|
|
233
292
|
data: {
|
|
234
293
|
key: string;
|
|
294
|
+
composition: {
|
|
295
|
+
routeId: string;
|
|
296
|
+
effectiveTemplateId?: string | undefined;
|
|
297
|
+
};
|
|
235
298
|
sourceFile: string;
|
|
236
299
|
componentName: string;
|
|
237
300
|
openingElementRange: {
|
|
@@ -241,31 +304,199 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
241
304
|
endColumn: number;
|
|
242
305
|
};
|
|
243
306
|
structuralPath: string;
|
|
244
|
-
routeId?: string | undefined;
|
|
245
307
|
textPreview?: string | undefined;
|
|
246
308
|
};
|
|
247
309
|
};
|
|
248
|
-
refreshSourceForKey(key: string,
|
|
249
|
-
executeOperation(request: Parameters<PreviewSiteEditEngineRuntime["executeOperation"]>[0], mutationContext?: SiteEditMutationContext): Promise<
|
|
250
|
-
|
|
310
|
+
refreshSourceForKey(key: string, composition: SiteEditCompositionSelector): Promise<void>;
|
|
311
|
+
executeOperation(request: Parameters<PreviewSiteEditEngineRuntime["executeOperation"]>[0], mutationContext?: SiteEditMutationContext): Promise<SiteEditCommandSuccess<{
|
|
312
|
+
requestId: string;
|
|
313
|
+
kind: "insert-child" | "update-text" | "update-array-item" | "remove-node" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
|
|
314
|
+
composition: {
|
|
315
|
+
routeId: string;
|
|
316
|
+
effectiveTemplateId?: string | undefined;
|
|
317
|
+
};
|
|
318
|
+
target: {
|
|
319
|
+
kind: "node";
|
|
320
|
+
key: string;
|
|
321
|
+
} | {
|
|
322
|
+
kind: "page-unit";
|
|
323
|
+
composition: {
|
|
324
|
+
routeId: string;
|
|
325
|
+
effectiveTemplateId?: string | undefined;
|
|
326
|
+
};
|
|
327
|
+
placementUnitKey: string;
|
|
328
|
+
} | {
|
|
329
|
+
kind: "route";
|
|
330
|
+
composition: {
|
|
331
|
+
routeId: string;
|
|
332
|
+
effectiveTemplateId?: string | undefined;
|
|
333
|
+
};
|
|
334
|
+
} | {
|
|
335
|
+
kind: "source-file";
|
|
336
|
+
path: string;
|
|
337
|
+
} | {
|
|
338
|
+
kind: "source-batch";
|
|
339
|
+
paths: string[];
|
|
340
|
+
} | {
|
|
341
|
+
kind: "project";
|
|
342
|
+
};
|
|
343
|
+
resultVersion: number;
|
|
344
|
+
affectedFiles?: string[] | undefined;
|
|
345
|
+
selectionRef?: {
|
|
346
|
+
key: string;
|
|
347
|
+
instanceIndex?: number | undefined;
|
|
348
|
+
instanceCount?: number | undefined;
|
|
349
|
+
} | undefined;
|
|
350
|
+
output?: {
|
|
351
|
+
kind: "insert-page-resource";
|
|
352
|
+
package_instance_id: string;
|
|
353
|
+
pages: {
|
|
354
|
+
template_page_id: string;
|
|
355
|
+
title: string;
|
|
356
|
+
final_route: string;
|
|
357
|
+
route_file_path: string;
|
|
358
|
+
}[];
|
|
359
|
+
} | {
|
|
360
|
+
kind: "delete-page-source";
|
|
361
|
+
deleted_files: string[];
|
|
362
|
+
updated_files: string[];
|
|
363
|
+
preserved_shared_files: string[];
|
|
364
|
+
warnings: string[];
|
|
365
|
+
} | undefined;
|
|
366
|
+
}> | import("@vcp-dev/contracts").SiteEditCommandFailure<"VERSION_STALE" | "RECOVERY_REQUIRED" | "NODE_NOT_FOUND" | "HOME_PAGE_LOCKED" | "ROUTE_NOT_FOUND" | "CAPABILITY_REJECTED" | "CONSTRAINT_VIOLATED" | "INVALID_PARAMS" | "PLAN_FAILED" | "TRANSACTION_PREFLIGHT_FAILED" | "ROUTE_REBUILD_FAILED" | "HISTORY_COMMIT_FAILED" | "MATERIALIZATION_CONFLICT" | "MATERIALIZATION_REJECTED" | "MUTATION_ASSERTION_REQUIRED" | "MUTATION_ASSERTION_INVALID" | "AST_PARSE_ERROR" | "UNSUPPORTED_OPERATION" | "LOCATOR_FAILED" | "INVALID_TARGET" | "WRITE_IO_ERROR" | "CONCURRENT_MODIFIED" | "ROLLBACK_FAILED" | "RECOVERY_PERSIST_FAILED" | "MUTATION_SESSION_REQUIRED" | "LEASE_ASSERTION_INVALID" | "LEASE_ASSERTION_EXPIRED" | "LEASE_ASSERTION_SCOPE_MISMATCH" | "CROSS_PAGE_MOVE_UNSUPPORTED" | "INTERNAL_ERROR", unknown, never, Partial<{
|
|
367
|
+
requestId: string;
|
|
368
|
+
kind: "insert-child" | "update-text" | "update-array-item" | "remove-node" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
|
|
369
|
+
composition: {
|
|
370
|
+
routeId: string;
|
|
371
|
+
effectiveTemplateId?: string | undefined;
|
|
372
|
+
};
|
|
373
|
+
target: {
|
|
374
|
+
kind: "node";
|
|
375
|
+
key: string;
|
|
376
|
+
} | {
|
|
377
|
+
kind: "page-unit";
|
|
378
|
+
composition: {
|
|
379
|
+
routeId: string;
|
|
380
|
+
effectiveTemplateId?: string | undefined;
|
|
381
|
+
};
|
|
382
|
+
placementUnitKey: string;
|
|
383
|
+
} | {
|
|
384
|
+
kind: "route";
|
|
385
|
+
composition: {
|
|
386
|
+
routeId: string;
|
|
387
|
+
effectiveTemplateId?: string | undefined;
|
|
388
|
+
};
|
|
389
|
+
} | {
|
|
390
|
+
kind: "source-file";
|
|
391
|
+
path: string;
|
|
392
|
+
} | {
|
|
393
|
+
kind: "source-batch";
|
|
394
|
+
paths: string[];
|
|
395
|
+
} | {
|
|
396
|
+
kind: "project";
|
|
397
|
+
};
|
|
398
|
+
resultVersion: number;
|
|
399
|
+
affectedFiles?: string[] | undefined;
|
|
400
|
+
selectionRef?: {
|
|
401
|
+
key: string;
|
|
402
|
+
instanceIndex?: number | undefined;
|
|
403
|
+
instanceCount?: number | undefined;
|
|
404
|
+
} | undefined;
|
|
405
|
+
output?: {
|
|
406
|
+
kind: "insert-page-resource";
|
|
407
|
+
package_instance_id: string;
|
|
408
|
+
pages: {
|
|
409
|
+
template_page_id: string;
|
|
410
|
+
title: string;
|
|
411
|
+
final_route: string;
|
|
412
|
+
route_file_path: string;
|
|
413
|
+
}[];
|
|
414
|
+
} | {
|
|
415
|
+
kind: "delete-page-source";
|
|
416
|
+
deleted_files: string[];
|
|
417
|
+
updated_files: string[];
|
|
418
|
+
preserved_shared_files: string[];
|
|
419
|
+
warnings: string[];
|
|
420
|
+
} | undefined;
|
|
421
|
+
}>> | {
|
|
251
422
|
ok: false;
|
|
423
|
+
composition: {
|
|
424
|
+
routeId: string;
|
|
425
|
+
effectiveTemplateId?: string | undefined;
|
|
426
|
+
};
|
|
252
427
|
error: {
|
|
253
428
|
code: "VERSION_STALE" | "RECOVERY_REQUIRED" | "NODE_NOT_FOUND" | "HOME_PAGE_LOCKED" | "ROUTE_NOT_FOUND" | "CAPABILITY_REJECTED" | "CONSTRAINT_VIOLATED" | "INVALID_PARAMS" | "PLAN_FAILED" | "TRANSACTION_PREFLIGHT_FAILED" | "ROUTE_REBUILD_FAILED" | "HISTORY_COMMIT_FAILED" | "MATERIALIZATION_CONFLICT" | "MATERIALIZATION_REJECTED" | "MUTATION_ASSERTION_REQUIRED" | "MUTATION_ASSERTION_INVALID" | "AST_PARSE_ERROR" | "UNSUPPORTED_OPERATION" | "LOCATOR_FAILED" | "INVALID_TARGET" | "WRITE_IO_ERROR" | "CONCURRENT_MODIFIED" | "ROLLBACK_FAILED" | "RECOVERY_PERSIST_FAILED" | "MUTATION_SESSION_REQUIRED" | "LEASE_ASSERTION_INVALID" | "LEASE_ASSERTION_EXPIRED" | "LEASE_ASSERTION_SCOPE_MISMATCH" | "CROSS_PAGE_MOVE_UNSUPPORTED" | "INTERNAL_ERROR";
|
|
254
429
|
message: string;
|
|
255
430
|
};
|
|
256
431
|
data: {
|
|
432
|
+
affectedFiles?: string[] | undefined;
|
|
257
433
|
requestId: string;
|
|
258
434
|
kind: "insert-child" | "update-text" | "update-array-item" | "remove-node" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
|
|
435
|
+
composition: {
|
|
436
|
+
routeId: string;
|
|
437
|
+
effectiveTemplateId?: string | undefined;
|
|
438
|
+
};
|
|
259
439
|
target: {
|
|
260
440
|
kind: "node";
|
|
261
441
|
key: string;
|
|
262
442
|
} | {
|
|
263
443
|
kind: "page-unit";
|
|
264
|
-
|
|
444
|
+
composition: {
|
|
445
|
+
routeId: string;
|
|
446
|
+
templateId?: string | undefined;
|
|
447
|
+
};
|
|
265
448
|
placementUnitKey: string;
|
|
266
449
|
} | {
|
|
267
450
|
kind: "route";
|
|
451
|
+
composition: {
|
|
452
|
+
routeId: string;
|
|
453
|
+
templateId?: string | undefined;
|
|
454
|
+
};
|
|
455
|
+
} | {
|
|
456
|
+
kind: "source-file";
|
|
457
|
+
path: string;
|
|
458
|
+
} | {
|
|
459
|
+
kind: "source-batch";
|
|
460
|
+
paths: string[];
|
|
461
|
+
} | {
|
|
462
|
+
kind: "project";
|
|
463
|
+
};
|
|
464
|
+
resultVersion: number;
|
|
465
|
+
};
|
|
466
|
+
}>;
|
|
467
|
+
undo(_mutationContext?: SiteEditMutationContext): Promise<{
|
|
468
|
+
ok: false;
|
|
469
|
+
composition: {
|
|
470
|
+
routeId: string;
|
|
471
|
+
effectiveTemplateId?: string | undefined;
|
|
472
|
+
};
|
|
473
|
+
error: {
|
|
474
|
+
code: "VERSION_STALE" | "RECOVERY_REQUIRED" | "NODE_NOT_FOUND" | "HOME_PAGE_LOCKED" | "ROUTE_NOT_FOUND" | "CAPABILITY_REJECTED" | "CONSTRAINT_VIOLATED" | "INVALID_PARAMS" | "PLAN_FAILED" | "TRANSACTION_PREFLIGHT_FAILED" | "ROUTE_REBUILD_FAILED" | "HISTORY_COMMIT_FAILED" | "MATERIALIZATION_CONFLICT" | "MATERIALIZATION_REJECTED" | "MUTATION_ASSERTION_REQUIRED" | "MUTATION_ASSERTION_INVALID" | "AST_PARSE_ERROR" | "UNSUPPORTED_OPERATION" | "LOCATOR_FAILED" | "INVALID_TARGET" | "WRITE_IO_ERROR" | "CONCURRENT_MODIFIED" | "ROLLBACK_FAILED" | "RECOVERY_PERSIST_FAILED" | "MUTATION_SESSION_REQUIRED" | "LEASE_ASSERTION_INVALID" | "LEASE_ASSERTION_EXPIRED" | "LEASE_ASSERTION_SCOPE_MISMATCH" | "CROSS_PAGE_MOVE_UNSUPPORTED" | "INTERNAL_ERROR";
|
|
475
|
+
message: string;
|
|
476
|
+
};
|
|
477
|
+
data: {
|
|
478
|
+
requestId: string;
|
|
479
|
+
kind: "insert-child" | "update-text" | "update-array-item" | "remove-node" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
|
|
480
|
+
composition: {
|
|
268
481
|
routeId: string;
|
|
482
|
+
effectiveTemplateId?: string | undefined;
|
|
483
|
+
};
|
|
484
|
+
target: {
|
|
485
|
+
kind: "node";
|
|
486
|
+
key: string;
|
|
487
|
+
} | {
|
|
488
|
+
kind: "page-unit";
|
|
489
|
+
composition: {
|
|
490
|
+
routeId: string;
|
|
491
|
+
templateId?: string | undefined;
|
|
492
|
+
};
|
|
493
|
+
placementUnitKey: string;
|
|
494
|
+
} | {
|
|
495
|
+
kind: "route";
|
|
496
|
+
composition: {
|
|
497
|
+
routeId: string;
|
|
498
|
+
templateId?: string | undefined;
|
|
499
|
+
};
|
|
269
500
|
} | {
|
|
270
501
|
kind: "source-file";
|
|
271
502
|
path: string;
|
|
@@ -279,19 +510,33 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
279
510
|
};
|
|
280
511
|
} | {
|
|
281
512
|
ok: true;
|
|
513
|
+
composition: {
|
|
514
|
+
routeId: string;
|
|
515
|
+
effectiveTemplateId?: string | undefined;
|
|
516
|
+
};
|
|
282
517
|
data: {
|
|
283
518
|
requestId: string;
|
|
284
519
|
kind: "insert-child" | "update-text" | "update-array-item" | "remove-node" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
|
|
520
|
+
composition: {
|
|
521
|
+
routeId: string;
|
|
522
|
+
effectiveTemplateId?: string | undefined;
|
|
523
|
+
};
|
|
285
524
|
target: {
|
|
286
525
|
kind: "node";
|
|
287
526
|
key: string;
|
|
288
527
|
} | {
|
|
289
528
|
kind: "page-unit";
|
|
290
|
-
|
|
529
|
+
composition: {
|
|
530
|
+
routeId: string;
|
|
531
|
+
effectiveTemplateId?: string | undefined;
|
|
532
|
+
};
|
|
291
533
|
placementUnitKey: string;
|
|
292
534
|
} | {
|
|
293
535
|
kind: "route";
|
|
294
|
-
|
|
536
|
+
composition: {
|
|
537
|
+
routeId: string;
|
|
538
|
+
effectiveTemplateId?: string | undefined;
|
|
539
|
+
};
|
|
295
540
|
} | {
|
|
296
541
|
kind: "source-file";
|
|
297
542
|
path: string;
|
|
@@ -329,6 +574,10 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
329
574
|
}>;
|
|
330
575
|
redo(_mutationContext?: SiteEditMutationContext): Promise<{
|
|
331
576
|
ok: false;
|
|
577
|
+
composition: {
|
|
578
|
+
routeId: string;
|
|
579
|
+
effectiveTemplateId?: string | undefined;
|
|
580
|
+
};
|
|
332
581
|
error: {
|
|
333
582
|
code: "VERSION_STALE" | "RECOVERY_REQUIRED" | "NODE_NOT_FOUND" | "HOME_PAGE_LOCKED" | "ROUTE_NOT_FOUND" | "CAPABILITY_REJECTED" | "CONSTRAINT_VIOLATED" | "INVALID_PARAMS" | "PLAN_FAILED" | "TRANSACTION_PREFLIGHT_FAILED" | "ROUTE_REBUILD_FAILED" | "HISTORY_COMMIT_FAILED" | "MATERIALIZATION_CONFLICT" | "MATERIALIZATION_REJECTED" | "MUTATION_ASSERTION_REQUIRED" | "MUTATION_ASSERTION_INVALID" | "AST_PARSE_ERROR" | "UNSUPPORTED_OPERATION" | "LOCATOR_FAILED" | "INVALID_TARGET" | "WRITE_IO_ERROR" | "CONCURRENT_MODIFIED" | "ROLLBACK_FAILED" | "RECOVERY_PERSIST_FAILED" | "MUTATION_SESSION_REQUIRED" | "LEASE_ASSERTION_INVALID" | "LEASE_ASSERTION_EXPIRED" | "LEASE_ASSERTION_SCOPE_MISMATCH" | "CROSS_PAGE_MOVE_UNSUPPORTED" | "INTERNAL_ERROR";
|
|
334
583
|
message: string;
|
|
@@ -336,16 +585,26 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
336
585
|
data: {
|
|
337
586
|
requestId: string;
|
|
338
587
|
kind: "insert-child" | "update-text" | "update-array-item" | "remove-node" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
|
|
588
|
+
composition: {
|
|
589
|
+
routeId: string;
|
|
590
|
+
effectiveTemplateId?: string | undefined;
|
|
591
|
+
};
|
|
339
592
|
target: {
|
|
340
593
|
kind: "node";
|
|
341
594
|
key: string;
|
|
342
595
|
} | {
|
|
343
596
|
kind: "page-unit";
|
|
344
|
-
|
|
597
|
+
composition: {
|
|
598
|
+
routeId: string;
|
|
599
|
+
templateId?: string | undefined;
|
|
600
|
+
};
|
|
345
601
|
placementUnitKey: string;
|
|
346
602
|
} | {
|
|
347
603
|
kind: "route";
|
|
348
|
-
|
|
604
|
+
composition: {
|
|
605
|
+
routeId: string;
|
|
606
|
+
templateId?: string | undefined;
|
|
607
|
+
};
|
|
349
608
|
} | {
|
|
350
609
|
kind: "source-file";
|
|
351
610
|
path: string;
|
|
@@ -359,19 +618,33 @@ export declare class PreviewFileSystemSiteEditEngineRuntime implements PreviewSi
|
|
|
359
618
|
};
|
|
360
619
|
} | {
|
|
361
620
|
ok: true;
|
|
621
|
+
composition: {
|
|
622
|
+
routeId: string;
|
|
623
|
+
effectiveTemplateId?: string | undefined;
|
|
624
|
+
};
|
|
362
625
|
data: {
|
|
363
626
|
requestId: string;
|
|
364
627
|
kind: "insert-child" | "update-text" | "update-array-item" | "remove-node" | "move-node" | "set-class-name-source" | "set-props" | "apply-style-draft" | "source-edit" | "insert-page-resource" | "delete-page-source";
|
|
628
|
+
composition: {
|
|
629
|
+
routeId: string;
|
|
630
|
+
effectiveTemplateId?: string | undefined;
|
|
631
|
+
};
|
|
365
632
|
target: {
|
|
366
633
|
kind: "node";
|
|
367
634
|
key: string;
|
|
368
635
|
} | {
|
|
369
636
|
kind: "page-unit";
|
|
370
|
-
|
|
637
|
+
composition: {
|
|
638
|
+
routeId: string;
|
|
639
|
+
effectiveTemplateId?: string | undefined;
|
|
640
|
+
};
|
|
371
641
|
placementUnitKey: string;
|
|
372
642
|
} | {
|
|
373
643
|
kind: "route";
|
|
374
|
-
|
|
644
|
+
composition: {
|
|
645
|
+
routeId: string;
|
|
646
|
+
effectiveTemplateId?: string | undefined;
|
|
647
|
+
};
|
|
375
648
|
} | {
|
|
376
649
|
kind: "source-file";
|
|
377
650
|
path: string;
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SiteEditCompositionSelector } from "@vcp-dev/contracts";
|
|
1
2
|
import { type SiteEditResolveSourceLocationInput } from "@vcp-dev/contracts";
|
|
2
3
|
import type { SiteEditEngineRuntime, SiteEditEngineRuntimeOptions, SiteEditPlanOperationResult } from "./types.js";
|
|
3
4
|
export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRuntime {
|
|
@@ -6,11 +7,14 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
|
|
|
6
7
|
private readonly fileSystem;
|
|
7
8
|
constructor(options: SiteEditEngineRuntimeOptions);
|
|
8
9
|
get status(): SiteEditEngineRuntime["status"];
|
|
9
|
-
|
|
10
|
-
getDocument(
|
|
10
|
+
initializeComposition(composition: SiteEditCompositionSelector): Promise<void>;
|
|
11
|
+
getDocument(composition: SiteEditCompositionSelector): {
|
|
11
12
|
siteId: string;
|
|
12
13
|
snapshotId: string;
|
|
13
|
-
|
|
14
|
+
composition: {
|
|
15
|
+
routeId: string;
|
|
16
|
+
effectiveTemplateId?: string | undefined;
|
|
17
|
+
};
|
|
14
18
|
version: number;
|
|
15
19
|
entries: {
|
|
16
20
|
key: string;
|
|
@@ -48,7 +52,11 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
|
|
|
48
52
|
}[];
|
|
49
53
|
};
|
|
50
54
|
};
|
|
51
|
-
getStyleContext(
|
|
55
|
+
getStyleContext(composition: SiteEditCompositionSelector): {
|
|
56
|
+
composition: {
|
|
57
|
+
routeId: string;
|
|
58
|
+
effectiveTemplateId?: string | undefined;
|
|
59
|
+
};
|
|
52
60
|
revision: string;
|
|
53
61
|
entryCss: {
|
|
54
62
|
path: string;
|
|
@@ -61,7 +69,11 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
|
|
|
61
69
|
hash?: string | undefined;
|
|
62
70
|
}[];
|
|
63
71
|
} | null;
|
|
64
|
-
getObjectEditContext(key: string,
|
|
72
|
+
getObjectEditContext(key: string, composition: SiteEditCompositionSelector): {
|
|
73
|
+
composition: {
|
|
74
|
+
routeId: string;
|
|
75
|
+
effectiveTemplateId?: string | undefined;
|
|
76
|
+
};
|
|
65
77
|
key: string;
|
|
66
78
|
tag: string;
|
|
67
79
|
label: string;
|
|
@@ -74,6 +86,10 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
|
|
|
74
86
|
componentName: string;
|
|
75
87
|
sourceFile: string;
|
|
76
88
|
capabilities: {
|
|
89
|
+
composition: {
|
|
90
|
+
routeId: string;
|
|
91
|
+
effectiveTemplateId?: string | undefined;
|
|
92
|
+
};
|
|
77
93
|
key: string;
|
|
78
94
|
canUpdateText: boolean;
|
|
79
95
|
canInsertChild: boolean;
|
|
@@ -149,9 +165,12 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
|
|
|
149
165
|
}[];
|
|
150
166
|
} | undefined;
|
|
151
167
|
};
|
|
152
|
-
getClassNameSource(key: string,
|
|
168
|
+
getClassNameSource(key: string, composition: SiteEditCompositionSelector): {
|
|
153
169
|
key: string;
|
|
154
|
-
|
|
170
|
+
composition: {
|
|
171
|
+
routeId: string;
|
|
172
|
+
effectiveTemplateId?: string | undefined;
|
|
173
|
+
};
|
|
155
174
|
filePath: string;
|
|
156
175
|
componentName: string;
|
|
157
176
|
sourceKind: "expression" | "missing" | "stringLiteral";
|
|
@@ -175,7 +194,11 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
|
|
|
175
194
|
}[];
|
|
176
195
|
computedStyle?: Record<string, string> | undefined;
|
|
177
196
|
};
|
|
178
|
-
getSourceTree(): Promise<{
|
|
197
|
+
getSourceTree(composition: SiteEditCompositionSelector): Promise<{
|
|
198
|
+
composition: {
|
|
199
|
+
routeId: string;
|
|
200
|
+
effectiveTemplateId?: string | undefined;
|
|
201
|
+
};
|
|
179
202
|
nodes: import("@vcp-dev/contracts").SiteEditSourceTreeNode[];
|
|
180
203
|
totalFiles: number;
|
|
181
204
|
defaultPath?: string | undefined;
|
|
@@ -188,7 +211,12 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
|
|
|
188
211
|
}>;
|
|
189
212
|
getSourceFile(input: {
|
|
190
213
|
path: string;
|
|
214
|
+
composition: SiteEditCompositionSelector;
|
|
191
215
|
}): Promise<{
|
|
216
|
+
composition: {
|
|
217
|
+
routeId: string;
|
|
218
|
+
effectiveTemplateId?: string | undefined;
|
|
219
|
+
};
|
|
192
220
|
path: string;
|
|
193
221
|
sizeBytes: number;
|
|
194
222
|
kind: "text";
|
|
@@ -197,6 +225,10 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
|
|
|
197
225
|
content: string;
|
|
198
226
|
contentHash?: string | undefined;
|
|
199
227
|
} | {
|
|
228
|
+
composition: {
|
|
229
|
+
routeId: string;
|
|
230
|
+
effectiveTemplateId?: string | undefined;
|
|
231
|
+
};
|
|
200
232
|
path: string;
|
|
201
233
|
sizeBytes: number;
|
|
202
234
|
kind: "binary";
|
|
@@ -209,6 +241,10 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
|
|
|
209
241
|
}>;
|
|
210
242
|
resolveSourceLocation(input: SiteEditResolveSourceLocationInput): {
|
|
211
243
|
key: string;
|
|
244
|
+
composition: {
|
|
245
|
+
routeId: string;
|
|
246
|
+
effectiveTemplateId?: string | undefined;
|
|
247
|
+
};
|
|
212
248
|
sourceFile: string;
|
|
213
249
|
componentName: string;
|
|
214
250
|
openingElementRange: {
|
|
@@ -218,17 +254,10 @@ export declare class SnapshotSiteEditEngineRuntime implements SiteEditEngineRunt
|
|
|
218
254
|
endColumn: number;
|
|
219
255
|
};
|
|
220
256
|
structuralPath: string;
|
|
221
|
-
routeId?: string | undefined;
|
|
222
257
|
textPreview?: string | undefined;
|
|
223
258
|
};
|
|
224
259
|
planOperation(request: Parameters<SiteEditEngineRuntime["planOperation"]>[0]): Promise<SiteEditPlanOperationResult>;
|
|
225
260
|
dispose(): void;
|
|
226
|
-
private getPlanningRouteIds;
|
|
227
|
-
private getExplicitPlanningRouteId;
|
|
228
|
-
private getBuiltRouteIdsForKey;
|
|
229
|
-
private withInferredNodeRouteId;
|
|
230
|
-
private findRouteIdForNodeTarget;
|
|
231
261
|
private createEngine;
|
|
232
|
-
private getChangedRouteIds;
|
|
233
262
|
}
|
|
234
263
|
export declare function createSiteEditEngineRuntime(options: SiteEditEngineRuntimeOptions): SiteEditEngineRuntime;
|