document-model 6.0.0-dev.11 → 6.0.0-dev.110
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/index.d.ts +81 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +216 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.mts +62 -0
- package/dist/node.d.mts.map +1 -0
- package/dist/node.mjs +151 -0
- package/dist/node.mjs.map +1 -0
- package/package.json +15 -24
- package/dist/src/core/actions.d.ts +0 -87
- package/dist/src/core/actions.d.ts.map +0 -1
- package/dist/src/core/actions.js +0 -187
- package/dist/src/core/actions.js.map +0 -1
- package/dist/src/core/crypto.d.ts +0 -8
- package/dist/src/core/crypto.d.ts.map +0 -1
- package/dist/src/core/crypto.js +0 -68
- package/dist/src/core/crypto.js.map +0 -1
- package/dist/src/core/documents.d.ts +0 -146
- package/dist/src/core/documents.d.ts.map +0 -1
- package/dist/src/core/documents.js +0 -814
- package/dist/src/core/documents.js.map +0 -1
- package/dist/src/core/errors.d.ts +0 -21
- package/dist/src/core/errors.d.ts.map +0 -1
- package/dist/src/core/errors.js +0 -46
- package/dist/src/core/errors.js.map +0 -1
- package/dist/src/core/files.d.ts +0 -14
- package/dist/src/core/files.d.ts.map +0 -1
- package/dist/src/core/files.js +0 -65
- package/dist/src/core/files.js.map +0 -1
- package/dist/src/core/header.d.ts +0 -63
- package/dist/src/core/header.d.ts.map +0 -1
- package/dist/src/core/header.js +0 -178
- package/dist/src/core/header.js.map +0 -1
- package/dist/src/core/index.d.ts +0 -13
- package/dist/src/core/index.d.ts.map +0 -1
- package/dist/src/core/index.js +0 -13
- package/dist/src/core/index.js.map +0 -1
- package/dist/src/core/node.d.ts +0 -53
- package/dist/src/core/node.d.ts.map +0 -1
- package/dist/src/core/node.js +0 -139
- package/dist/src/core/node.js.map +0 -1
- package/dist/src/core/operations.d.ts +0 -48
- package/dist/src/core/operations.d.ts.map +0 -1
- package/dist/src/core/operations.js +0 -122
- package/dist/src/core/operations.js.map +0 -1
- package/dist/src/core/ph-types.d.ts +0 -315
- package/dist/src/core/ph-types.d.ts.map +0 -1
- package/dist/src/core/ph-types.js +0 -15
- package/dist/src/core/ph-types.js.map +0 -1
- package/dist/src/core/reducer.d.ts +0 -63
- package/dist/src/core/reducer.d.ts.map +0 -1
- package/dist/src/core/reducer.js +0 -455
- package/dist/src/core/reducer.js.map +0 -1
- package/dist/src/core/schemas.d.ts +0 -69
- package/dist/src/core/schemas.d.ts.map +0 -1
- package/dist/src/core/schemas.js +0 -110
- package/dist/src/core/schemas.js.map +0 -1
- package/dist/src/core/state.d.ts +0 -26
- package/dist/src/core/state.d.ts.map +0 -1
- package/dist/src/core/state.js +0 -56
- package/dist/src/core/state.js.map +0 -1
- package/dist/src/core/types.d.ts +0 -536
- package/dist/src/core/types.d.ts.map +0 -1
- package/dist/src/core/types.js +0 -2
- package/dist/src/core/types.js.map +0 -1
- package/dist/src/core/utils.d.ts +0 -6
- package/dist/src/core/utils.d.ts.map +0 -1
- package/dist/src/core/utils.js +0 -15
- package/dist/src/core/utils.js.map +0 -1
- package/dist/src/core/validation.d.ts +0 -4
- package/dist/src/core/validation.d.ts.map +0 -1
- package/dist/src/core/validation.js +0 -27
- package/dist/src/core/validation.js.map +0 -1
- package/dist/src/document-model/actions.d.ts +0 -158
- package/dist/src/document-model/actions.d.ts.map +0 -1
- package/dist/src/document-model/actions.js +0 -111
- package/dist/src/document-model/actions.js.map +0 -1
- package/dist/src/document-model/constants.d.ts +0 -6
- package/dist/src/document-model/constants.d.ts.map +0 -1
- package/dist/src/document-model/constants.js +0 -573
- package/dist/src/document-model/constants.js.map +0 -1
- package/dist/src/document-model/document-schema.d.ts +0 -69
- package/dist/src/document-model/document-schema.d.ts.map +0 -1
- package/dist/src/document-model/document-schema.js +0 -43
- package/dist/src/document-model/document-schema.js.map +0 -1
- package/dist/src/document-model/document-type.d.ts +0 -2
- package/dist/src/document-model/document-type.d.ts.map +0 -1
- package/dist/src/document-model/document-type.js +0 -2
- package/dist/src/document-model/document-type.js.map +0 -1
- package/dist/src/document-model/files.d.ts +0 -5
- package/dist/src/document-model/files.d.ts.map +0 -1
- package/dist/src/document-model/files.js +0 -9
- package/dist/src/document-model/files.js.map +0 -1
- package/dist/src/document-model/index.d.ts +0 -11
- package/dist/src/document-model/index.d.ts.map +0 -1
- package/dist/src/document-model/index.js +0 -11
- package/dist/src/document-model/index.js.map +0 -1
- package/dist/src/document-model/module.d.ts +0 -3
- package/dist/src/document-model/module.d.ts.map +0 -1
- package/dist/src/document-model/module.js +0 -24
- package/dist/src/document-model/module.js.map +0 -1
- package/dist/src/document-model/reducers.d.ts +0 -11
- package/dist/src/document-model/reducers.d.ts.map +0 -1
- package/dist/src/document-model/reducers.js +0 -618
- package/dist/src/document-model/reducers.js.map +0 -1
- package/dist/src/document-model/schemas.d.ts +0 -189
- package/dist/src/document-model/schemas.d.ts.map +0 -1
- package/dist/src/document-model/schemas.js +0 -388
- package/dist/src/document-model/schemas.js.map +0 -1
- package/dist/src/document-model/state.d.ts +0 -15
- package/dist/src/document-model/state.d.ts.map +0 -1
- package/dist/src/document-model/state.js +0 -75
- package/dist/src/document-model/state.js.map +0 -1
- package/dist/src/document-model/types.d.ts +0 -679
- package/dist/src/document-model/types.d.ts.map +0 -1
- package/dist/src/document-model/types.js +0 -2
- package/dist/src/document-model/types.js.map +0 -1
- package/dist/src/document-model/validation.d.ts +0 -32
- package/dist/src/document-model/validation.d.ts.map +0 -1
- package/dist/src/document-model/validation.js +0 -166
- package/dist/src/document-model/validation.js.map +0 -1
- package/dist/src/index.d.ts +0 -6
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +0 -1
- package/dist/test/document/crypto.test.d.ts +0 -2
- package/dist/test/document/crypto.test.d.ts.map +0 -1
- package/dist/test/document/crypto.test.js +0 -195
- package/dist/test/document/crypto.test.js.map +0 -1
- package/dist/test/document/event-vs-command.test.d.ts +0 -2
- package/dist/test/document/event-vs-command.test.d.ts.map +0 -1
- package/dist/test/document/event-vs-command.test.js +0 -202
- package/dist/test/document/event-vs-command.test.js.map +0 -1
- package/dist/test/document/local.test.d.ts +0 -2
- package/dist/test/document/local.test.d.ts.map +0 -1
- package/dist/test/document/local.test.js +0 -229
- package/dist/test/document/local.test.js.map +0 -1
- package/dist/test/document/operation-id.test.d.ts +0 -2
- package/dist/test/document/operation-id.test.d.ts.map +0 -1
- package/dist/test/document/operation-id.test.js +0 -118
- package/dist/test/document/operation-id.test.js.map +0 -1
- package/dist/test/document/prune.test.d.ts +0 -2
- package/dist/test/document/prune.test.d.ts.map +0 -1
- package/dist/test/document/prune.test.js +0 -159
- package/dist/test/document/prune.test.js.map +0 -1
- package/dist/test/document/reducer.test.d.ts +0 -2
- package/dist/test/document/reducer.test.d.ts.map +0 -1
- package/dist/test/document/reducer.test.js +0 -284
- package/dist/test/document/reducer.test.js.map +0 -1
- package/dist/test/document/skip-operations.test.d.ts +0 -2
- package/dist/test/document/skip-operations.test.d.ts.map +0 -1
- package/dist/test/document/skip-operations.test.js +0 -412
- package/dist/test/document/skip-operations.test.js.map +0 -1
- package/dist/test/document/undo-redo-v2.test.d.ts +0 -2
- package/dist/test/document/undo-redo-v2.test.d.ts.map +0 -1
- package/dist/test/document/undo-redo-v2.test.js +0 -207
- package/dist/test/document/undo-redo-v2.test.js.map +0 -1
- package/dist/test/document/undo-redo.test.d.ts +0 -2
- package/dist/test/document/undo-redo.test.d.ts.map +0 -1
- package/dist/test/document/undo-redo.test.js +0 -413
- package/dist/test/document/undo-redo.test.js.map +0 -1
- package/dist/test/document/utils.test.d.ts +0 -2
- package/dist/test/document/utils.test.d.ts.map +0 -1
- package/dist/test/document/utils.test.js +0 -172
- package/dist/test/document/utils.test.js.map +0 -1
- package/dist/test/document-helpers/addUndo.test.d.ts +0 -2
- package/dist/test/document-helpers/addUndo.test.d.ts.map +0 -1
- package/dist/test/document-helpers/addUndo.test.js +0 -120
- package/dist/test/document-helpers/addUndo.test.js.map +0 -1
- package/dist/test/document-helpers/attachBranch.test.d.ts +0 -2
- package/dist/test/document-helpers/attachBranch.test.d.ts.map +0 -1
- package/dist/test/document-helpers/attachBranch.test.js +0 -364
- package/dist/test/document-helpers/attachBranch.test.js.map +0 -1
- package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.d.ts +0 -2
- package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.d.ts.map +0 -1
- package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.js +0 -252
- package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.js.map +0 -1
- package/dist/test/document-helpers/conflictResolution.test.d.ts +0 -2
- package/dist/test/document-helpers/conflictResolution.test.d.ts.map +0 -1
- package/dist/test/document-helpers/conflictResolution.test.js +0 -109
- package/dist/test/document-helpers/conflictResolution.test.js.map +0 -1
- package/dist/test/document-helpers/filterDuplicatedOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/filterDuplicatedOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/filterDuplicatedOperations.test.js +0 -126
- package/dist/test/document-helpers/filterDuplicatedOperations.test.js.map +0 -1
- package/dist/test/document-helpers/garbageCollect.test.d.ts +0 -2
- package/dist/test/document-helpers/garbageCollect.test.d.ts.map +0 -1
- package/dist/test/document-helpers/garbageCollect.test.js +0 -136
- package/dist/test/document-helpers/garbageCollect.test.js.map +0 -1
- package/dist/test/document-helpers/groupOperationsByScope.test.d.ts +0 -2
- package/dist/test/document-helpers/groupOperationsByScope.test.d.ts.map +0 -1
- package/dist/test/document-helpers/groupOperationsByScope.test.js +0 -102
- package/dist/test/document-helpers/groupOperationsByScope.test.js.map +0 -1
- package/dist/test/document-helpers/merge.test.d.ts +0 -2
- package/dist/test/document-helpers/merge.test.d.ts.map +0 -1
- package/dist/test/document-helpers/merge.test.js +0 -906
- package/dist/test/document-helpers/merge.test.js.map +0 -1
- package/dist/test/document-helpers/nextSkipNumber.test.d.ts +0 -2
- package/dist/test/document-helpers/nextSkipNumber.test.d.ts.map +0 -1
- package/dist/test/document-helpers/nextSkipNumber.test.js +0 -135
- package/dist/test/document-helpers/nextSkipNumber.test.js.map +0 -1
- package/dist/test/document-helpers/prepareOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/prepareOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/prepareOperations.test.js +0 -304
- package/dist/test/document-helpers/prepareOperations.test.js.map +0 -1
- package/dist/test/document-helpers/removeExistingOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/removeExistingOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/removeExistingOperations.test.js +0 -177
- package/dist/test/document-helpers/removeExistingOperations.test.js.map +0 -1
- package/dist/test/document-helpers/reshuffleByTimestamp.test.d.ts +0 -2
- package/dist/test/document-helpers/reshuffleByTimestamp.test.d.ts.map +0 -1
- package/dist/test/document-helpers/reshuffleByTimestamp.test.js +0 -148
- package/dist/test/document-helpers/reshuffleByTimestamp.test.js.map +0 -1
- package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.d.ts +0 -2
- package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.d.ts.map +0 -1
- package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.js +0 -200
- package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.js.map +0 -1
- package/dist/test/document-helpers/skipHeaderOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/skipHeaderOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/skipHeaderOperations.test.js +0 -72
- package/dist/test/document-helpers/skipHeaderOperations.test.js.map +0 -1
- package/dist/test/document-helpers/sortOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/sortOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/sortOperations.test.js +0 -101
- package/dist/test/document-helpers/sortOperations.test.js.map +0 -1
- package/dist/test/document-helpers/split.test.d.ts +0 -2
- package/dist/test/document-helpers/split.test.d.ts.map +0 -1
- package/dist/test/document-helpers/split.test.js +0 -121
- package/dist/test/document-helpers/split.test.js.map +0 -1
- package/dist/test/document-helpers/utils.d.ts +0 -15
- package/dist/test/document-helpers/utils.d.ts.map +0 -1
- package/dist/test/document-helpers/utils.js +0 -61
- package/dist/test/document-helpers/utils.js.map +0 -1
- package/dist/test/document-model/replay.test.d.ts +0 -2
- package/dist/test/document-model/replay.test.d.ts.map +0 -1
- package/dist/test/document-model/replay.test.js +0 -139
- package/dist/test/document-model/replay.test.js.map +0 -1
- package/dist/test/document-model/skip-operations.test.d.ts +0 -2
- package/dist/test/document-model/skip-operations.test.d.ts.map +0 -1
- package/dist/test/document-model/skip-operations.test.js +0 -214
- package/dist/test/document-model/skip-operations.test.js.map +0 -1
- package/dist/test/document-model/validation.test.d.ts +0 -2
- package/dist/test/document-model/validation.test.d.ts.map +0 -1
- package/dist/test/document-model/validation.test.js +0 -451
- package/dist/test/document-model/validation.test.js.map +0 -1
- package/dist/test/document-model/versioning.test.d.ts +0 -2
- package/dist/test/document-model/versioning.test.d.ts.map +0 -1
- package/dist/test/document-model/versioning.test.js +0 -93
- package/dist/test/document-model/versioning.test.js.map +0 -1
- package/dist/test/document-model/zip.test.d.ts +0 -2
- package/dist/test/document-model/zip.test.d.ts.map +0 -1
- package/dist/test/document-model/zip.test.js +0 -79
- package/dist/test/document-model/zip.test.js.map +0 -1
- package/dist/test/helpers.d.ts +0 -77
- package/dist/test/helpers.d.ts.map +0 -1
- package/dist/test/helpers.js +0 -118
- package/dist/test/helpers.js.map +0 -1
- package/dist/test/index.d.ts +0 -4
- package/dist/test/index.d.ts.map +0 -1
- package/dist/test/index.js +0 -3
- package/dist/test/index.js.map +0 -1
- package/dist/test/types.d.ts +0 -6
- package/dist/test/types.d.ts.map +0 -1
- package/dist/test/types.js +0 -2
- package/dist/test/types.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/vitest.config.d.ts +0 -3
- package/dist/vitest.config.d.ts.map +0 -1
- package/dist/vitest.config.js +0 -7
- package/dist/vitest.config.js.map +0 -1
package/dist/src/core/node.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import mime from "mime/lite";
|
|
2
|
-
import { createHash } from "node:crypto";
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import https from "node:https";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
import { baseLoadFromInput, createZip } from "./files.js";
|
|
7
|
-
function getFileAttributes(file) {
|
|
8
|
-
const extension = file.replace(/^.*\./, "") || undefined;
|
|
9
|
-
const fileName = file.replace(/^.*[/\\]/, "") || undefined;
|
|
10
|
-
return { extension, fileName };
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Reads an attachment from a file and returns its base64-encoded data and MIME type.
|
|
14
|
-
* @param path - The path of the attachment file to read.
|
|
15
|
-
* @returns A Promise that resolves to an object containing the base64-encoded data and MIME type of the attachment.
|
|
16
|
-
*/
|
|
17
|
-
export async function getLocalFile(path) {
|
|
18
|
-
const buffer = await getFileNode(path);
|
|
19
|
-
const mimeType = mime.getType(path) || "application/octet-stream";
|
|
20
|
-
const attributes = getFileAttributes(path);
|
|
21
|
-
const data = buffer.toString("base64");
|
|
22
|
-
return { data, hash: hashNode(data), mimeType, ...attributes };
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Fetches an attachment from a URL and returns its base64-encoded data and MIME type.
|
|
26
|
-
* @param url - The URL of the attachment to fetch.
|
|
27
|
-
* @returns A Promise that resolves to an object containing the base64-encoded data and MIME type of the attachment.
|
|
28
|
-
*/
|
|
29
|
-
export async function getRemoteFile(url) {
|
|
30
|
-
const { buffer, mimeType = "application/octet-stream" } = await fetchFileNode(url);
|
|
31
|
-
const attributes = getFileAttributes(url);
|
|
32
|
-
const data = buffer.toString("base64");
|
|
33
|
-
return {
|
|
34
|
-
data,
|
|
35
|
-
hash: hashNode(data),
|
|
36
|
-
mimeType,
|
|
37
|
-
...attributes,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Loads a document from a ZIP file.
|
|
42
|
-
*
|
|
43
|
-
* @remarks
|
|
44
|
-
* This function reads a ZIP file and returns the document state after
|
|
45
|
-
* applying all the operations. The reducer is used to apply the operations.
|
|
46
|
-
*
|
|
47
|
-
* @typeParam S - The type of the state object.
|
|
48
|
-
* @typeParam A - The type of the actions that can be applied to the state object.
|
|
49
|
-
*
|
|
50
|
-
* @param path - The path to the ZIP file.
|
|
51
|
-
* @param reducer - The reducer to apply the operations to the state object.
|
|
52
|
-
* @returns A promise that resolves to the document state after applying all the operations.
|
|
53
|
-
* @throws An error if the initial state or the operations history is not found in the ZIP file.
|
|
54
|
-
*/
|
|
55
|
-
export async function baseLoadFromFile(path, reducer, options) {
|
|
56
|
-
const file = readFileNode(path);
|
|
57
|
-
return baseLoadFromInput(file, reducer, options);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Saves a document to a ZIP file.
|
|
61
|
-
*
|
|
62
|
-
* @remarks
|
|
63
|
-
* This function creates a ZIP file containing the document's state, operations,
|
|
64
|
-
* and file attachments. The file is saved to the specified path.
|
|
65
|
-
*
|
|
66
|
-
* @param document - The document to save to the file.
|
|
67
|
-
* @param path - The path to save the file to.
|
|
68
|
-
* @param extension - The extension to use for the file.
|
|
69
|
-
* @returns A promise that resolves to the path of the saved file.
|
|
70
|
-
*/
|
|
71
|
-
export async function baseSaveToFile(document, path, extension, name) {
|
|
72
|
-
// create zip file
|
|
73
|
-
const zip = createZip(document);
|
|
74
|
-
const file = await zip.generateAsync({
|
|
75
|
-
type: "uint8array",
|
|
76
|
-
streamFiles: true,
|
|
77
|
-
});
|
|
78
|
-
const fileName = name ?? document.header.name;
|
|
79
|
-
const fileExtension = extension ? `.${extension}.phd` : ".phd";
|
|
80
|
-
return writeFileNode(path, fileName.endsWith(fileExtension) ? fileName : `${fileName}${fileExtension}`, file);
|
|
81
|
-
}
|
|
82
|
-
export function writeFileNode(path, name, data) {
|
|
83
|
-
const filePath = join(path, name);
|
|
84
|
-
fs.mkdirSync(path, { recursive: true });
|
|
85
|
-
return new Promise((resolve, reject) => {
|
|
86
|
-
try {
|
|
87
|
-
fs.writeFile(filePath, data, {}, (err) => {
|
|
88
|
-
if (err) {
|
|
89
|
-
reject(err);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
resolve(filePath);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
if (error instanceof Error) {
|
|
98
|
-
reject(error);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
reject(new Error(String(error)));
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
export function readFileNode(path) {
|
|
107
|
-
return fs.readFileSync(path);
|
|
108
|
-
}
|
|
109
|
-
export function fetchFileNode(url) {
|
|
110
|
-
return new Promise((resolve, reject) => {
|
|
111
|
-
https
|
|
112
|
-
.get(url, (resp) => {
|
|
113
|
-
const data = [];
|
|
114
|
-
const mimeType = resp.headers["content-type"];
|
|
115
|
-
resp.on("data", (chunk) => {
|
|
116
|
-
data.push(chunk);
|
|
117
|
-
});
|
|
118
|
-
resp.on("end", () => {
|
|
119
|
-
resolve({ buffer: Buffer.concat(data), mimeType });
|
|
120
|
-
});
|
|
121
|
-
})
|
|
122
|
-
.on("error", (err) => {
|
|
123
|
-
reject(err);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
export const getFileNode = async (file) => {
|
|
128
|
-
return readFileNode(file);
|
|
129
|
-
};
|
|
130
|
-
export const hashNode = (data, algorithm = "sha1", encoding = "base64", _params) => {
|
|
131
|
-
if (!["sha1", "sha256", "sha512"].includes(algorithm)) {
|
|
132
|
-
throw new Error(`Hashing algorithm not supported: "${algorithm}". Available: sha1, sha256, sha512`);
|
|
133
|
-
}
|
|
134
|
-
if (!["base64", "hex"].includes(encoding)) {
|
|
135
|
-
throw new Error(`Hash encoding not supported: "${encoding}". Available: base64, hex`);
|
|
136
|
-
}
|
|
137
|
-
return createHash(algorithm).update(data).digest(encoding);
|
|
138
|
-
};
|
|
139
|
-
//# sourceMappingURL=node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/core/node.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAS1D,SAAS,iBAAiB,CACxB,IAAY;IAEZ,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC;IACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC;IAC3D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AACjC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAY;IAC7C,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,0BAA0B,CAAC;IAClE,MAAM,UAAU,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,CAAC;AACjE,CAAC;AAED;;;;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AC7D,CAAC,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Action, PHBaseState, PHDocument } from "./ph-types.js";
|
|
2
|
-
import type { LoadStateActionInput } from "./types.js";
|
|
3
|
-
export declare function setNameOperation<TDocument extends PHDocument>(document: TDocument, name: string): TDocument & {
|
|
4
|
-
header: {
|
|
5
|
-
name: string;
|
|
6
|
-
id: string;
|
|
7
|
-
sig: import("./ph-types.js").PHDocumentSignatureInfo;
|
|
8
|
-
documentType: string;
|
|
9
|
-
createdAtUtcIso: string;
|
|
10
|
-
slug: string;
|
|
11
|
-
branch: string;
|
|
12
|
-
revision: {
|
|
13
|
-
[scope: string]: number;
|
|
14
|
-
};
|
|
15
|
-
lastModifiedAtUtcIso: string;
|
|
16
|
-
protocolVersions?: {
|
|
17
|
-
[key: string]: number;
|
|
18
|
-
};
|
|
19
|
-
meta?: import("./ph-types.js").PHDocumentMeta;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export declare function undoOperation<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
|
|
23
|
-
document: TDocument;
|
|
24
|
-
action: Action;
|
|
25
|
-
skip: number;
|
|
26
|
-
reuseLastOperationIndex: boolean;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* V2 of undoOperation for protocol version 2+.
|
|
30
|
-
* Key differences from undoOperation:
|
|
31
|
-
* - Never reuses operation index (always increments)
|
|
32
|
-
* - Always sets skip=1 (consecutive NOOPs are handled during rebuild/GC)
|
|
33
|
-
* - No complex skip calculation - simpler model where each UNDO is independent
|
|
34
|
-
*/
|
|
35
|
-
export declare function undoOperationV2<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
|
|
36
|
-
document: TDocument;
|
|
37
|
-
action: Action;
|
|
38
|
-
skip: number;
|
|
39
|
-
reuseLastOperationIndex: false;
|
|
40
|
-
};
|
|
41
|
-
export declare function redoOperation<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
|
|
42
|
-
document: TDocument;
|
|
43
|
-
action: Action;
|
|
44
|
-
skip: number;
|
|
45
|
-
reuseLastOperationIndex: boolean;
|
|
46
|
-
};
|
|
47
|
-
export declare function loadStateOperation<TState extends PHBaseState>(document: PHDocument<TState>, action: LoadStateActionInput): PHDocument<TState>;
|
|
48
|
-
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/core/operations.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD,wBAAgB,gBAAgB,CAAC,SAAS,SAAS,UAAU,EAC3D,QAAQ,EAAE,SAAS,EACnB,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;;;;EAGb;AAED,wBAAgB,aAAa,CAAC,SAAS,SAAS,UAAU,EACxD,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB,EAAE,OAAO,CAAC;CAClC,CA8CA;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,SAAS,SAAS,UAAU,EAC1D,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB,EAAE,KAAK,CAAC;CAChC,CAuCA;AAED,wBAAgB,aAAa,CAAC,SAAS,SAAS,UAAU,EACxD,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB,EAAE,OAAO,CAAC;CAClC,CA8CA;AAED,wBAAgB,kBAAkB,CAAC,MAAM,SAAS,WAAW,EAC3D,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,EAC5B,MAAM,EAAE,oBAAoB,GAC3B,UAAU,CAAC,MAAM,CAAC,CAMpB"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { castDraft, create } from "mutative";
|
|
2
|
-
import { noop } from "./actions.js";
|
|
3
|
-
import { nextSkipNumber, sortOperations } from "./documents.js";
|
|
4
|
-
// updates the name of the document
|
|
5
|
-
export function setNameOperation(document, name) {
|
|
6
|
-
return { ...document, header: { ...document.header, name } };
|
|
7
|
-
}
|
|
8
|
-
export function undoOperation(document, action, skip) {
|
|
9
|
-
// const scope = action.scope;
|
|
10
|
-
const { scope } = action;
|
|
11
|
-
const defaultResult = {
|
|
12
|
-
document,
|
|
13
|
-
action,
|
|
14
|
-
skip,
|
|
15
|
-
reuseLastOperationIndex: false,
|
|
16
|
-
};
|
|
17
|
-
return create(defaultResult, (draft) => {
|
|
18
|
-
const operations = [...document.operations[scope]];
|
|
19
|
-
const sortedOperations = sortOperations(operations);
|
|
20
|
-
draft.action = noop(scope);
|
|
21
|
-
const lastOperation = sortedOperations.at(-1);
|
|
22
|
-
let nextIndex = lastOperation?.index ?? -1;
|
|
23
|
-
const isNewNoop = lastOperation?.action.type !== "NOOP";
|
|
24
|
-
if (isNewNoop) {
|
|
25
|
-
nextIndex = nextIndex + 1;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
draft.reuseLastOperationIndex = true;
|
|
29
|
-
}
|
|
30
|
-
const nextOperationHistory = isNewNoop
|
|
31
|
-
? [...sortedOperations, { index: nextIndex, skip: 0 }]
|
|
32
|
-
: sortedOperations;
|
|
33
|
-
draft.skip = nextSkipNumber(nextOperationHistory);
|
|
34
|
-
if (lastOperation && draft.skip > lastOperation.skip + 1) {
|
|
35
|
-
// there's an overlap with a previous skip operation
|
|
36
|
-
// (add 1 to the skip value because we are adding a new operation to the history)
|
|
37
|
-
draft.skip = draft.skip + 1;
|
|
38
|
-
}
|
|
39
|
-
if (draft.skip < 0) {
|
|
40
|
-
throw new Error(`Cannot undo: you can't undo more operations than the ones in the scope history`);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* V2 of undoOperation for protocol version 2+.
|
|
46
|
-
* Key differences from undoOperation:
|
|
47
|
-
* - Never reuses operation index (always increments)
|
|
48
|
-
* - Always sets skip=1 (consecutive NOOPs are handled during rebuild/GC)
|
|
49
|
-
* - No complex skip calculation - simpler model where each UNDO is independent
|
|
50
|
-
*/
|
|
51
|
-
export function undoOperationV2(document, action, skip) {
|
|
52
|
-
const { scope } = action;
|
|
53
|
-
const defaultResult = {
|
|
54
|
-
document,
|
|
55
|
-
action,
|
|
56
|
-
skip,
|
|
57
|
-
reuseLastOperationIndex: false,
|
|
58
|
-
};
|
|
59
|
-
return create(defaultResult, (draft) => {
|
|
60
|
-
const operations = document.operations[scope] || [];
|
|
61
|
-
const sortedOperations = sortOperations([...operations]);
|
|
62
|
-
// Count non-NOOP operations to determine if there's anything to undo
|
|
63
|
-
const nonNoopOps = sortedOperations.filter((op) => op.action.type !== "NOOP");
|
|
64
|
-
// Count consecutive NOOPs at the end (these represent pending undos)
|
|
65
|
-
let noopChainLength = 0;
|
|
66
|
-
for (let i = sortedOperations.length - 1; i >= 0; i--) {
|
|
67
|
-
if (sortedOperations[i].action.type === "NOOP") {
|
|
68
|
-
noopChainLength++;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
// Check if we can undo: need more non-NOOP ops than the current NOOP chain
|
|
75
|
-
if (nonNoopOps.length <= noopChainLength) {
|
|
76
|
-
throw new Error(`Cannot undo: no more operations to undo in scope history`);
|
|
77
|
-
}
|
|
78
|
-
draft.action = noop(scope);
|
|
79
|
-
draft.skip = 1;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
export function redoOperation(document, action, skip) {
|
|
83
|
-
const { scope, input } = action;
|
|
84
|
-
const defaultResult = {
|
|
85
|
-
document,
|
|
86
|
-
action,
|
|
87
|
-
skip,
|
|
88
|
-
reuseLastOperationIndex: false,
|
|
89
|
-
};
|
|
90
|
-
return create(defaultResult, (draft) => {
|
|
91
|
-
if (draft.skip > 0) {
|
|
92
|
-
throw new Error(`Cannot redo: skip value from reducer cannot be used with REDO action`);
|
|
93
|
-
}
|
|
94
|
-
if (typeof input !== "number" || input > 1) {
|
|
95
|
-
throw new Error(`Cannot redo: you can only redo one operation at a time`);
|
|
96
|
-
}
|
|
97
|
-
if (typeof input !== "number" || input < 1) {
|
|
98
|
-
throw new Error(`Invalid REDO action: invalid redo input value`);
|
|
99
|
-
}
|
|
100
|
-
if (draft.document.clipboard.length < 1) {
|
|
101
|
-
throw new Error(`Cannot redo: no operations in the clipboard`);
|
|
102
|
-
}
|
|
103
|
-
const operationIndex = draft.document.clipboard.findLastIndex((op) => op.action.scope === scope);
|
|
104
|
-
if (operationIndex < 0) {
|
|
105
|
-
throw new Error(`Cannot redo: no operations in clipboard for scope "${scope}"`);
|
|
106
|
-
}
|
|
107
|
-
const operation = draft.document.clipboard.splice(operationIndex, 1)[0];
|
|
108
|
-
draft.action = castDraft({
|
|
109
|
-
type: operation.action.type,
|
|
110
|
-
scope: operation.action.scope,
|
|
111
|
-
input: operation.action.input,
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
export function loadStateOperation(document, action) {
|
|
116
|
-
return {
|
|
117
|
-
...document,
|
|
118
|
-
header: { ...document.header, name: action.state.name },
|
|
119
|
-
state: action.state.data,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=operations.js.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|
5
|
-
export type PHDocumentSignatureInfo = {
|
|
6
|
-
/**
|
|
7
|
-
* The public key of the document creator.
|
|
8
|
-
**/
|
|
9
|
-
publicKey: JsonWebKey;
|
|
10
|
-
/** The nonce that was appended to the message to create the signature. */
|
|
11
|
-
nonce: string;
|
|
12
|
-
};
|
|
13
|
-
/** Meta information about the document. */
|
|
14
|
-
export type PHDocumentMeta = {
|
|
15
|
-
/** The preferred editor for the document. */
|
|
16
|
-
preferredEditor?: string;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* The header of a document.
|
|
20
|
-
*/
|
|
21
|
-
export type PHDocumentHeader = {
|
|
22
|
-
/**
|
|
23
|
-
* The id of the document.
|
|
24
|
-
*
|
|
25
|
-
* This is a Ed25519 signature and is immutable.
|
|
26
|
-
**/
|
|
27
|
-
id: string;
|
|
28
|
-
/**
|
|
29
|
-
* Information to verify the document creator.
|
|
30
|
-
*
|
|
31
|
-
* This is immutable.
|
|
32
|
-
**/
|
|
33
|
-
sig: PHDocumentSignatureInfo;
|
|
34
|
-
/**
|
|
35
|
-
* The type of the document.
|
|
36
|
-
*
|
|
37
|
-
* This is used as part of the signature payload and thus, cannot be changed
|
|
38
|
-
* after the document header has been created.
|
|
39
|
-
**/
|
|
40
|
-
documentType: string;
|
|
41
|
-
/**
|
|
42
|
-
* The timestamp of the creation date of the document, in UTC ISO format.
|
|
43
|
-
*
|
|
44
|
-
* This is used as part of the signature payload and thus, cannot be changed
|
|
45
|
-
* after the document header has been created.
|
|
46
|
-
**/
|
|
47
|
-
createdAtUtcIso: string;
|
|
48
|
-
/** The slug of the document. */
|
|
49
|
-
slug: string;
|
|
50
|
-
/** The name of the document. */
|
|
51
|
-
name: string;
|
|
52
|
-
/** The branch of this document. */
|
|
53
|
-
branch: string;
|
|
54
|
-
/**
|
|
55
|
-
* The revision of each scope of the document. This object is updated every
|
|
56
|
-
* time any _other_ scope is updated.
|
|
57
|
-
*/
|
|
58
|
-
revision: {
|
|
59
|
-
[scope: string]: number;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* The timestamp of the last change in the document, in UTC ISO format.
|
|
63
|
-
**/
|
|
64
|
-
lastModifiedAtUtcIso: string;
|
|
65
|
-
/**
|
|
66
|
-
* This is a map from protocol name to version. A protocol can be any set of
|
|
67
|
-
* rules that are applied to the document.
|
|
68
|
-
*
|
|
69
|
-
* Examples of protocols include:
|
|
70
|
-
*
|
|
71
|
-
* - "base-reducer"
|
|
72
|
-
*/
|
|
73
|
-
protocolVersions?: {
|
|
74
|
-
[key: string]: number;
|
|
75
|
-
};
|
|
76
|
-
/** Meta information about the document. */
|
|
77
|
-
meta?: PHDocumentMeta;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* The authentication state of the document.
|
|
81
|
-
*
|
|
82
|
-
* This has yet to be implemented.
|
|
83
|
-
*/
|
|
84
|
-
export type PHAuthState = {};
|
|
85
|
-
export declare const HASH_ALGORITHM_SHA1 = "sha1";
|
|
86
|
-
export declare const HASH_ALGORITHM_SHA256 = "sha256";
|
|
87
|
-
export declare const HASH_ALGORITHM_SHA512 = "sha512";
|
|
88
|
-
export declare const HASH_ENCODING_BASE64 = "base64";
|
|
89
|
-
export declare const HASH_ENCODING_HEX = "hex";
|
|
90
|
-
/**
|
|
91
|
-
* Configuration for hashing document state in operations.
|
|
92
|
-
*/
|
|
93
|
-
export type HashConfig = {
|
|
94
|
-
/** The hashing algorithm to use (e.g., "sha1", "sha256") */
|
|
95
|
-
algorithm: string;
|
|
96
|
-
/** The encoding format for the hash output (e.g., "base64", "hex") */
|
|
97
|
-
encoding: string;
|
|
98
|
-
/** Optional algorithm-specific parameters */
|
|
99
|
-
params?: Record<string, unknown>;
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* The document state of the document.
|
|
103
|
-
*/
|
|
104
|
-
export type PHDocumentState = {
|
|
105
|
-
/**
|
|
106
|
-
* The current document model schema version of the document. This is used
|
|
107
|
-
* with the UPGRADE_DOCUMENT operation to specify the DocumentModelModule
|
|
108
|
-
* version to use for reducer execution.
|
|
109
|
-
*/
|
|
110
|
-
version: number;
|
|
111
|
-
/** Hash configuration for operation state verification */
|
|
112
|
-
hash: HashConfig;
|
|
113
|
-
/** True if and only if the document has been deleted */
|
|
114
|
-
isDeleted?: boolean;
|
|
115
|
-
/** The timestamp when the document was deleted, in UTC ISO format */
|
|
116
|
-
deletedAtUtcIso?: string;
|
|
117
|
-
/** Optional: who deleted the document */
|
|
118
|
-
deletedBy?: string;
|
|
119
|
-
/** Optional: reason for deletion */
|
|
120
|
-
deletionReason?: string;
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* The base state of the document.
|
|
124
|
-
*/
|
|
125
|
-
export type PHBaseState = {
|
|
126
|
-
/** Carries authentication information. */
|
|
127
|
-
auth: PHAuthState;
|
|
128
|
-
/** Carries information about the document. */
|
|
129
|
-
document: PHDocumentState;
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* A signature of an action.
|
|
133
|
-
*
|
|
134
|
-
* This will be refactored in a future release.
|
|
135
|
-
*/
|
|
136
|
-
export type Signature = [string, string, string, string, string];
|
|
137
|
-
/**
|
|
138
|
-
* A user action signer.
|
|
139
|
-
*/
|
|
140
|
-
export type UserActionSigner = {
|
|
141
|
-
address: string;
|
|
142
|
-
networkId: string;
|
|
143
|
-
chainId: number;
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* An app action signer.
|
|
147
|
-
*/
|
|
148
|
-
export type AppActionSigner = {
|
|
149
|
-
name: string;
|
|
150
|
-
key: string;
|
|
151
|
-
};
|
|
152
|
-
/**
|
|
153
|
-
* An action signer.
|
|
154
|
-
*/
|
|
155
|
-
export type ActionSigner = {
|
|
156
|
-
user: UserActionSigner;
|
|
157
|
-
app: AppActionSigner;
|
|
158
|
-
signatures: Signature[];
|
|
159
|
-
};
|
|
160
|
-
/**
|
|
161
|
-
* The context of an action.
|
|
162
|
-
*/
|
|
163
|
-
export type ActionContext = {
|
|
164
|
-
/** The index of the previous operation, showing intended ordering. */
|
|
165
|
-
prevOpIndex?: number;
|
|
166
|
-
/** The hash of the previous operation, showing intended state. */
|
|
167
|
-
prevOpHash?: string;
|
|
168
|
-
/** A nonce, to cover specific signing attacks and to prevent replay attacks from no-ops. */
|
|
169
|
-
nonce?: string;
|
|
170
|
-
/** The signer of the action. */
|
|
171
|
-
signer?: ActionSigner;
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* String type representing an attachment in a Document.
|
|
175
|
-
*
|
|
176
|
-
* @remarks
|
|
177
|
-
* Attachment string is formatted as `attachment://<filename>`.
|
|
178
|
-
*/
|
|
179
|
-
export type AttachmentRef = string;
|
|
180
|
-
/**
|
|
181
|
-
* Defines the basic structure of an action.
|
|
182
|
-
*/
|
|
183
|
-
export type Action = {
|
|
184
|
-
/** The id of the action. This is distinct from the operation id. */
|
|
185
|
-
id: string;
|
|
186
|
-
/** The name of the action. */
|
|
187
|
-
type: string;
|
|
188
|
-
/** The timestamp of the action. */
|
|
189
|
-
timestampUtcMs: string;
|
|
190
|
-
/** The payload of the action. */
|
|
191
|
-
input: unknown;
|
|
192
|
-
/** The scope of the action */
|
|
193
|
-
scope: string;
|
|
194
|
-
/**
|
|
195
|
-
* The attachments included in the action.
|
|
196
|
-
*
|
|
197
|
-
* This will be refactored in a future release.
|
|
198
|
-
*/
|
|
199
|
-
attachments?: AttachmentInput[];
|
|
200
|
-
/** The context of the action. */
|
|
201
|
-
context?: ActionContext;
|
|
202
|
-
};
|
|
203
|
-
/**
|
|
204
|
-
* An operation that was applied to a {@link BaseDocument}.
|
|
205
|
-
*
|
|
206
|
-
* @remarks
|
|
207
|
-
* Wraps an action with an index, to be added to the operations history of a Document.
|
|
208
|
-
* The `index` field is used to keep all operations in order and enable replaying the
|
|
209
|
-
* document's history from the beginning. Note that indices and skips are relative to
|
|
210
|
-
* a specific reactor. Example below:
|
|
211
|
-
*
|
|
212
|
-
* For (index, skip, ts, action)
|
|
213
|
-
* A - [(0, 0, 1, "A0"), (1, 0, 2, "A1")]
|
|
214
|
-
* B - [(0, 0, 0, "B0"), (1, 0, 3, "B1")]
|
|
215
|
-
* ...
|
|
216
|
-
* B gets A's Operations Scenario:
|
|
217
|
-
* B' - [(0, 0, 0, "B0"), (1, 0, 3, "B1"), (2, 1, 1, "A0"), (3, 0, 2, "A1"), (4, 0, 3, "B1")]
|
|
218
|
-
* Then A needs to end up with:
|
|
219
|
-
* A' - [(0, 0, 1, "A0"), (1, 0, 2, "A1"), (2, 2, 0, "B0"), (3, 0, 1, "A0"), (4, 0, 2, "A1"), (5, 0, 3, "B1")]
|
|
220
|
-
* So that both A and B end up with the stream of actions (action):
|
|
221
|
-
* [("B0"), ("A0"), ("A1"), ("B1")]
|
|
222
|
-
*
|
|
223
|
-
* @typeParam A - The type of the action.
|
|
224
|
-
*/
|
|
225
|
-
export type Operation = {
|
|
226
|
-
/**
|
|
227
|
-
* This is a stable id, derived from various document and action properties
|
|
228
|
-
* in deriveOperationId().
|
|
229
|
-
*
|
|
230
|
-
* It _cannot_ be an arbitrary string.
|
|
231
|
-
*
|
|
232
|
-
* It it also not unique per operation, as reshuffled operations will keep'
|
|
233
|
-
* the same id they had before they were reshuffled. This means that the
|
|
234
|
-
* IOperationStore may have multiple operations with the same operation id.
|
|
235
|
-
**/
|
|
236
|
-
id: string;
|
|
237
|
-
/** Position of the operation in the history. This is relative to a specific reactor -- they may not all agree on this value. */
|
|
238
|
-
index: number;
|
|
239
|
-
/** The number of operations skipped with this Operation. This is relative to a specific reactor -- they may not all agree on this value. */
|
|
240
|
-
skip: number;
|
|
241
|
-
/** Timestamp of when the operation was added */
|
|
242
|
-
timestampUtcMs: string;
|
|
243
|
-
/** Hash of the resulting document data after the operation */
|
|
244
|
-
hash: string;
|
|
245
|
-
/** Error message for a failed action */
|
|
246
|
-
error?: string;
|
|
247
|
-
/** The resulting state after the operation */
|
|
248
|
-
resultingState?: string;
|
|
249
|
-
/**
|
|
250
|
-
* The action that was applied to the document to produce this operation.
|
|
251
|
-
*/
|
|
252
|
-
action: Action;
|
|
253
|
-
};
|
|
254
|
-
/**
|
|
255
|
-
* The operations history of the document by scope.
|
|
256
|
-
*
|
|
257
|
-
* This will be removed in a future release.
|
|
258
|
-
*
|
|
259
|
-
* TODO: Type should be Partial<Record<string, Operation[]>>,
|
|
260
|
-
* but that is a breaking change for codegen + external doc models.
|
|
261
|
-
*/
|
|
262
|
-
export type DocumentOperations = Record<string, Operation[]>;
|
|
263
|
-
/**
|
|
264
|
-
* The base type of a document model.
|
|
265
|
-
*
|
|
266
|
-
* @remarks
|
|
267
|
-
* This type is extended by all Document models.
|
|
268
|
-
*
|
|
269
|
-
* @typeParam TState - The type of the document state.
|
|
270
|
-
*/
|
|
271
|
-
export type PHDocument<TState extends PHBaseState = PHBaseState> = {
|
|
272
|
-
/** The header of the document. */
|
|
273
|
-
header: PHDocumentHeader;
|
|
274
|
-
/** The document model specific state. */
|
|
275
|
-
state: TState;
|
|
276
|
-
/**
|
|
277
|
-
* The initial state of the document, enabling replaying operations.
|
|
278
|
-
*
|
|
279
|
-
* This will be removed in a future release.
|
|
280
|
-
*/
|
|
281
|
-
initialState: TState;
|
|
282
|
-
/**
|
|
283
|
-
* The operations history of the document.
|
|
284
|
-
*
|
|
285
|
-
* This will be removed in a future release.
|
|
286
|
-
*/
|
|
287
|
-
operations: DocumentOperations;
|
|
288
|
-
/**
|
|
289
|
-
* A list of undone operations
|
|
290
|
-
*
|
|
291
|
-
* This will be removed in a future release.
|
|
292
|
-
*/
|
|
293
|
-
clipboard: Operation[];
|
|
294
|
-
};
|
|
295
|
-
/** Upgrade reducer transforms a document from one version to another */
|
|
296
|
-
export type UpgradeReducer<TFrom extends PHBaseState, TTo extends PHBaseState> = (document: PHDocument<TFrom>, action: Action) => PHDocument<TTo>;
|
|
297
|
-
type ModelVersion = number;
|
|
298
|
-
/** Metadata about a version transition */
|
|
299
|
-
export type UpgradeTransition = {
|
|
300
|
-
toVersion: ModelVersion;
|
|
301
|
-
upgradeReducer: UpgradeReducer<any, any>;
|
|
302
|
-
description?: string;
|
|
303
|
-
};
|
|
304
|
-
type TupleMember<T extends readonly unknown[]> = T[number];
|
|
305
|
-
/** Manifest declaring all supported versions and upgrade paths */
|
|
306
|
-
export type UpgradeManifest<TVersions extends readonly number[]> = {
|
|
307
|
-
documentType: string;
|
|
308
|
-
latestVersion: TupleMember<TVersions>;
|
|
309
|
-
supportedVersions: TVersions;
|
|
310
|
-
upgrades: {
|
|
311
|
-
[V in Exclude<TupleMember<TVersions>, 1> as `v${V}`]: UpgradeTransition;
|
|
312
|
-
};
|
|
313
|
-
};
|
|
314
|
-
export {};
|
|
315
|
-
//# sourceMappingURL=ph-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ph-types.d.ts","sourceRoot":"","sources":["../../../src/core/ph-types.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;QAEI;IACJ,SAAS,EAAE,UAAU,CAAC;IAEtB,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,2CAA2C;AAC3C,MAAM,MAAM,cAAc,GAAG;IAC3B,6CAA6C;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;QAII;IACJ,EAAE,EAAE,MAAM,CAAC;IAEX;;;;QAII;IACJ,GAAG,EAAE,uBAAuB,CAAC;IAE7B;;;;;QAKI;IACJ,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;QAKI;IACJ,eAAe,EAAE,MAAM,CAAC;IAExB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IAEb,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IAEb,mCAAmC;IACnC,MAA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C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,YAAY,CAAC;IACxB,cAAc,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,WAAW,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,kEAAkE;AAElE,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,SAAS,MAAM,EAAE,IAAI;IACjE,YAAY,EAAE,MAAM,CAAC;IAErB,aAAa,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IAEtC,iBAAiB,EAAE,SAAS,CAAC;IAE7B,QAAQ,EAAE;SAEP,CAAC,IAAI,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,EAAE,GAAG,iBAAiB;KACxE,CAAC;CACH,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// These are "Reactor V2" types, that have passed through the on-going reactor
|
|
3
|
-
// refactor.
|
|
4
|
-
//
|
|
5
|
-
// Please do not add types to this file that have not been spec'd out in the
|
|
6
|
-
// docs/planning folder in the reactor/ package.
|
|
7
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
8
|
-
// Known hash algorithms (can be extended without breaking changes)
|
|
9
|
-
export const HASH_ALGORITHM_SHA1 = "sha1";
|
|
10
|
-
export const HASH_ALGORITHM_SHA256 = "sha256";
|
|
11
|
-
export const HASH_ALGORITHM_SHA512 = "sha512";
|
|
12
|
-
// Known encodings (can be extended without breaking changes)
|
|
13
|
-
export const HASH_ENCODING_BASE64 = "base64";
|
|
14
|
-
export const HASH_ENCODING_HEX = "hex";
|
|
15
|
-
//# sourceMappingURL=ph-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ph-types.js","sourceRoot":"","sources":["../../../src/core/ph-types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,YAAY;AACZ,EAAE;AACF,4EAA4E;AAC5E,gDAAgD;AAChD,+EAA+E;AAoG/E,mEAAmE;AACnE,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAC1C,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAC;AAC9C,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAC;AAE9C,6DAA6D;AAC7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAC7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC"}
|