@vcp-dev/site-edit-engine 0.4.8 → 0.6.0
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/history/file-history-store.d.ts +130 -0
- package/dist/history/index.d.ts +2 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +10 -10
- package/dist/internal/protocol/boundary.d.ts +10 -0
- package/dist/internal/protocol/capability.d.ts +47 -0
- package/dist/internal/protocol/error.d.ts +69 -0
- package/dist/internal/protocol/event.d.ts +39 -0
- package/dist/internal/protocol/identity.d.ts +26 -0
- package/dist/internal/protocol/operation.d.ts +77 -0
- package/dist/internal/protocol/render.d.ts +203 -0
- package/dist/internal/protocol.d.ts +9 -0
- package/dist/materialization-style-policy.d.ts +16 -0
- package/dist/mutation-context-verifier.d.ts +30 -0
- package/dist/preview-runtime.d.ts +77 -128
- package/dist/public-file-system.d.ts +2 -0
- package/dist/runtime-sync.d.ts +3 -1
- package/dist/runtime.d.ts +46 -114
- package/dist/types.d.ts +24 -6
- package/package.json +3 -2
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export type Sha256Digest = `sha256:${string}`;
|
|
2
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
3
|
+
[key: string]: JsonValue;
|
|
4
|
+
};
|
|
5
|
+
export interface FileHistoryBlobInput {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly data: string | Uint8Array;
|
|
8
|
+
}
|
|
9
|
+
export interface FileHistoryAppendInput {
|
|
10
|
+
readonly kind: string;
|
|
11
|
+
readonly manifest: JsonValue;
|
|
12
|
+
readonly blobs?: ReadonlyArray<FileHistoryBlobInput>;
|
|
13
|
+
}
|
|
14
|
+
export interface FileHistoryBlobRef {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly digest: Sha256Digest;
|
|
17
|
+
readonly sizeBytes: number;
|
|
18
|
+
}
|
|
19
|
+
export interface FileHistoryEntryRecord {
|
|
20
|
+
readonly id: Sha256Digest;
|
|
21
|
+
readonly schemaVersion: 1;
|
|
22
|
+
readonly kind: string;
|
|
23
|
+
readonly manifest: JsonValue;
|
|
24
|
+
readonly blobs: ReadonlyArray<FileHistoryBlobRef>;
|
|
25
|
+
}
|
|
26
|
+
export interface FileHistoryIndexSnapshot {
|
|
27
|
+
readonly schemaVersion: 1;
|
|
28
|
+
readonly digest: Sha256Digest;
|
|
29
|
+
readonly entryIds: ReadonlyArray<Sha256Digest>;
|
|
30
|
+
readonly cursor: number;
|
|
31
|
+
readonly currentId: Sha256Digest | null;
|
|
32
|
+
readonly undoIds: ReadonlyArray<Sha256Digest>;
|
|
33
|
+
readonly redoIds: ReadonlyArray<Sha256Digest>;
|
|
34
|
+
readonly totalBytes: number;
|
|
35
|
+
}
|
|
36
|
+
export interface FileHistoryStageResult {
|
|
37
|
+
readonly stageId: string;
|
|
38
|
+
readonly entryId: Sha256Digest;
|
|
39
|
+
readonly blobIds: ReadonlyArray<Sha256Digest>;
|
|
40
|
+
}
|
|
41
|
+
export interface FileHistoryIndexTransition {
|
|
42
|
+
readonly expectedIndexDigest: Sha256Digest;
|
|
43
|
+
readonly publishedIndexDigest: Sha256Digest;
|
|
44
|
+
readonly publishedCursor: number;
|
|
45
|
+
readonly publishedCurrentId: Sha256Digest | null;
|
|
46
|
+
}
|
|
47
|
+
export interface FileHistoryStoreLimits {
|
|
48
|
+
readonly maxEntries: number;
|
|
49
|
+
readonly maxSessionBytes: number;
|
|
50
|
+
readonly maxEntryBytes: number;
|
|
51
|
+
}
|
|
52
|
+
export interface FileHistoryStoreOptions {
|
|
53
|
+
readonly limits?: Partial<FileHistoryStoreLimits>;
|
|
54
|
+
}
|
|
55
|
+
export interface FileHistoryStageOptions {
|
|
56
|
+
readonly durableManifest?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface FileHistoryStatus {
|
|
59
|
+
readonly canUndo: boolean;
|
|
60
|
+
readonly canRedo: boolean;
|
|
61
|
+
readonly undoDepth: number;
|
|
62
|
+
readonly redoDepth: number;
|
|
63
|
+
readonly cursor: number;
|
|
64
|
+
readonly recoveryRequired: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface FileHistoryUndoRedoResult {
|
|
67
|
+
readonly undoIds: ReadonlyArray<Sha256Digest>;
|
|
68
|
+
readonly redoIds: ReadonlyArray<Sha256Digest>;
|
|
69
|
+
readonly currentId: Sha256Digest | null;
|
|
70
|
+
}
|
|
71
|
+
export interface FileHistoryTransactionJournalFile {
|
|
72
|
+
readonly path: string;
|
|
73
|
+
readonly preDigest: Sha256Digest | null;
|
|
74
|
+
readonly postDigest: Sha256Digest | null;
|
|
75
|
+
}
|
|
76
|
+
export interface FileHistoryTransactionJournal {
|
|
77
|
+
readonly schemaVersion: 2;
|
|
78
|
+
readonly transactionId: string;
|
|
79
|
+
readonly operationId: string;
|
|
80
|
+
readonly phase: "prepared" | "files-written" | "history-published";
|
|
81
|
+
readonly historyTransition: FileHistoryIndexTransition;
|
|
82
|
+
readonly files: ReadonlyArray<FileHistoryTransactionJournalFile>;
|
|
83
|
+
}
|
|
84
|
+
export interface FileHistoryStore {
|
|
85
|
+
readonly rootDir: string;
|
|
86
|
+
readonly recoveryRequired: boolean;
|
|
87
|
+
stageAppend(input: FileHistoryAppendInput, options?: FileHistoryStageOptions): Promise<FileHistoryStageResult>;
|
|
88
|
+
discardStage(stageId: string): Promise<void>;
|
|
89
|
+
previewStagedAppend(entryId: Sha256Digest, expectedIndexDigest?: Sha256Digest): Promise<FileHistoryIndexTransition>;
|
|
90
|
+
previewCursor(cursor: number, expectedIndexDigest?: Sha256Digest): Promise<FileHistoryIndexTransition>;
|
|
91
|
+
publishStagedAppend(entryId: Sha256Digest): Promise<FileHistoryIndexSnapshot>;
|
|
92
|
+
publishStagedAppend(entryId: Sha256Digest, expectedIndexDigest?: Sha256Digest, stageId?: string): Promise<FileHistoryIndexSnapshot>;
|
|
93
|
+
append(input: FileHistoryAppendInput): Promise<FileHistoryIndexSnapshot>;
|
|
94
|
+
readEntry(entryId: Sha256Digest): Promise<FileHistoryEntryRecord>;
|
|
95
|
+
readBlob(blobId: Sha256Digest): Promise<Uint8Array>;
|
|
96
|
+
readIndex(): Promise<FileHistoryIndexSnapshot>;
|
|
97
|
+
readStatus(): Promise<FileHistoryStatus>;
|
|
98
|
+
readUndoRedoIds(): Promise<FileHistoryUndoRedoResult>;
|
|
99
|
+
setCursor(cursor: number, expectedIndexDigest?: Sha256Digest): Promise<FileHistoryIndexSnapshot>;
|
|
100
|
+
markRecoveryRequired(reason: string): Promise<void>;
|
|
101
|
+
clearRecoveryRequired(): Promise<void>;
|
|
102
|
+
readTransactionJournal(): Promise<FileHistoryTransactionJournal | null>;
|
|
103
|
+
writeTransactionJournal(journal: FileHistoryTransactionJournal): Promise<void>;
|
|
104
|
+
clearTransactionJournal(transactionId: string): Promise<void>;
|
|
105
|
+
cleanupTmp(): Promise<void>;
|
|
106
|
+
readDocumentVersion?(): Promise<number>;
|
|
107
|
+
writeDocumentVersion?(version: number): Promise<void>;
|
|
108
|
+
}
|
|
109
|
+
export declare const FILE_HISTORY_DEFAULT_LIMITS: FileHistoryStoreLimits;
|
|
110
|
+
declare const HISTORY_ERROR_CODES: {
|
|
111
|
+
readonly INVALID_ROOT: "INVALID_ROOT";
|
|
112
|
+
readonly INVALID_PATH: "INVALID_PATH";
|
|
113
|
+
readonly INVALID_SCHEMA: "INVALID_SCHEMA";
|
|
114
|
+
readonly INVALID_JSON: "INVALID_JSON";
|
|
115
|
+
readonly INDEX_CORRUPT: "INDEX_CORRUPT";
|
|
116
|
+
readonly ENTRY_CORRUPT: "ENTRY_CORRUPT";
|
|
117
|
+
readonly BLOB_CORRUPT: "BLOB_CORRUPT";
|
|
118
|
+
readonly RECOVERY_PENDING: "RECOVERY_PENDING";
|
|
119
|
+
readonly CAPACITY_EXCEEDED: "CAPACITY_EXCEEDED";
|
|
120
|
+
readonly NOT_FOUND: "NOT_FOUND";
|
|
121
|
+
};
|
|
122
|
+
export type FileHistoryStoreErrorCode = (typeof HISTORY_ERROR_CODES)[keyof typeof HISTORY_ERROR_CODES];
|
|
123
|
+
export declare class FileHistoryStoreError extends Error {
|
|
124
|
+
readonly code: FileHistoryStoreErrorCode;
|
|
125
|
+
constructor(code: FileHistoryStoreErrorCode, message: string, options?: {
|
|
126
|
+
cause?: unknown;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
export declare function openFileHistoryStore(rootDir: string, options?: FileHistoryStoreOptions): Promise<FileHistoryStore>;
|
|
130
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { FILE_HISTORY_DEFAULT_LIMITS, FileHistoryStoreError, openFileHistoryStore, } from "./file-history-store.js";
|
|
2
|
+
export type { FileHistoryAppendInput, FileHistoryBlobInput, FileHistoryBlobRef, FileHistoryEntryRecord, FileHistoryIndexSnapshot, FileHistoryIndexTransition, FileHistoryStageResult, FileHistoryStore, FileHistoryStoreErrorCode, FileHistoryStoreLimits, FileHistoryStoreOptions, FileHistoryTransactionJournal, FileHistoryTransactionJournalFile, FileHistoryUndoRedoResult, JsonValue, Sha256Digest, } from "./file-history-store.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export { createSiteEditEngineRuntime, SnapshotSiteEditEngineRuntime, } from "./runtime.js";
|
|
2
2
|
export { createPreviewSiteEditEngineRuntime, PreviewFileSystemSiteEditEngineRuntime, } from "./preview-runtime.js";
|
|
3
|
-
export
|
|
3
|
+
export { createEd25519MutationContextVerifier } from "./mutation-context-verifier.js";
|
|
4
|
+
export { scanSiteEditThemeStyleViolations, SITE_EDIT_RAW_COLOR_LITERAL_RE, } from "./materialization-style-policy.js";
|
|
5
|
+
export type { SiteEditColorMixPolicy, SiteEditThemeStyleScanOptions, SiteEditThemeStyleViolations, } from "./materialization-style-policy.js";
|
|
6
|
+
export type { Ed25519MutationContextVerifierOptions, SiteEditMutationAssertionExpected, SiteEditMutationContextVerifier, SiteEditMutationVerificationFailureCode, SiteEditMutationVerificationResult, } from "./mutation-context-verifier.js";
|
|
7
|
+
export type { PreviewSiteEditEngineRuntime, PreviewSiteEditEngineRuntimeOptions, SiteEditProjectFileSystem, SiteEditEngineRoute, SiteEditEngineHistoryStatus, SiteEditEngineRuntime, SiteEditEngineRuntimeOptions, SiteEditPlanOperationResult, SiteEditSnapshotFile, } from "./types.js";
|
|
8
|
+
export { FileHistoryStoreError, openFileHistoryStore, } from "./history/index.js";
|
|
9
|
+
export type { FileHistoryAppendInput, FileHistoryBlobInput, FileHistoryBlobRef, FileHistoryEntryRecord, FileHistoryIndexSnapshot, FileHistoryIndexTransition, FileHistoryStageResult, FileHistoryStore, FileHistoryStoreErrorCode, FileHistoryStoreLimits, FileHistoryStoreOptions, FileHistoryTransactionJournal, FileHistoryTransactionJournalFile, FileHistoryUndoRedoResult, JsonValue, Sha256Digest, } from "./history/index.js";
|