document-model 2.11.0 → 2.13.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/browser/cjs/document-model.js +3 -2
- package/dist/browser/cjs/document-model.js.map +1 -1
- package/dist/browser/cjs/document.js +11 -10
- package/dist/browser/cjs/document.js.map +1 -1
- package/dist/browser/cjs/index.js +2 -2
- package/dist/browser/cjs/internal/{object-BdIbCX0K.js → creators-c2maywyy.js} +48 -213
- package/dist/browser/cjs/internal/creators-c2maywyy.js.map +1 -0
- package/dist/browser/cjs/internal/index-CTDPLYkV.js +47 -0
- package/dist/browser/cjs/internal/index-CTDPLYkV.js.map +1 -0
- package/dist/browser/cjs/internal/index-DDUYrJUg.js +19 -0
- package/dist/browser/cjs/internal/index-DDUYrJUg.js.map +1 -0
- package/dist/browser/cjs/internal/{index-hPntrUvN.js → index-DeM7OezK.js} +56 -55
- package/dist/{node/cjs/internal/index-Bsyn7lZ0.js.map → browser/cjs/internal/index-DeM7OezK.js.map} +1 -1
- package/dist/browser/cjs/internal/object-WukT1Feq.js +183 -0
- package/dist/browser/cjs/internal/object-WukT1Feq.js.map +1 -0
- package/dist/browser/cjs/utils.js +44 -0
- package/dist/browser/cjs/utils.js.map +1 -0
- package/dist/browser/es/document-model.js +3 -2
- package/dist/browser/es/document-model.js.map +1 -1
- package/dist/browser/es/document.js +12 -11
- package/dist/browser/es/document.js.map +1 -1
- package/dist/browser/es/index.js +2 -2
- package/dist/browser/es/internal/{object-oB7gkKNr.js → creators-CkhiX4CP.js} +83 -248
- package/dist/browser/es/internal/creators-CkhiX4CP.js.map +1 -0
- package/dist/browser/es/internal/{index-D_fwH6L3.js → index-BRVlDkPn.js} +4 -3
- package/dist/{node/es/internal/index-D4oqm7Ua.js.map → browser/es/internal/index-BRVlDkPn.js.map} +1 -1
- package/dist/browser/es/internal/index-CHpkSkeZ.js +48 -0
- package/dist/browser/es/internal/index-CHpkSkeZ.js.map +1 -0
- package/dist/browser/es/internal/index-uWY5kwkt.js +20 -0
- package/dist/browser/es/internal/index-uWY5kwkt.js.map +1 -0
- package/dist/browser/es/internal/object-CJHsId9H.js +184 -0
- package/dist/browser/es/internal/object-CJHsId9H.js.map +1 -0
- package/dist/browser/es/utils.js +44 -0
- package/dist/browser/es/utils.js.map +1 -0
- package/dist/browser/src/document/reducer.d.ts.map +1 -1
- package/dist/browser/src/document/utils/base.d.ts.map +1 -1
- package/dist/browser/src/document/utils/browser.d.ts +1 -0
- package/dist/browser/src/document/utils/browser.d.ts.map +1 -1
- package/dist/browser/src/document/utils/crypto.d.ts +1 -0
- package/dist/browser/src/document/utils/crypto.d.ts.map +1 -1
- package/dist/browser/src/document/utils/errors.d.ts +10 -0
- package/dist/browser/src/document/utils/errors.d.ts.map +1 -0
- package/dist/browser/src/document/utils/index.d.ts +1 -0
- package/dist/browser/src/document/utils/index.d.ts.map +1 -1
- package/dist/browser/src/document/utils/node.d.ts +2 -1
- package/dist/browser/src/document/utils/node.d.ts.map +1 -1
- package/dist/browser/utils.d.ts +2 -0
- package/dist/browser/vite.config.d.ts.map +1 -1
- package/dist/node/cjs/document-model.js +7 -6
- package/dist/node/cjs/document-model.js.map +1 -1
- package/dist/node/cjs/document.js +11 -10
- package/dist/node/cjs/document.js.map +1 -1
- package/dist/node/cjs/index.js +2 -2
- package/dist/node/cjs/internal/{object-DqFXYK4g.js → creators-B5g3rJKI.js} +66 -234
- package/dist/node/cjs/internal/creators-B5g3rJKI.js.map +1 -0
- package/dist/node/cjs/internal/{index-Bsyn7lZ0.js → index-CYhNqyfA.js} +60 -59
- package/dist/{browser/cjs/internal/index-hPntrUvN.js.map → node/cjs/internal/index-CYhNqyfA.js.map} +1 -1
- package/dist/node/cjs/internal/index-Cdxqd-qQ.js +47 -0
- package/dist/node/cjs/internal/index-Cdxqd-qQ.js.map +1 -0
- package/dist/node/cjs/internal/index-DHkzUhZg.js +19 -0
- package/dist/node/cjs/internal/index-DHkzUhZg.js.map +1 -0
- package/dist/node/cjs/internal/object-CpAsa3Oe.js +183 -0
- package/dist/node/cjs/internal/object-CpAsa3Oe.js.map +1 -0
- package/dist/node/cjs/utils.js +44 -0
- package/dist/node/cjs/utils.js.map +1 -0
- package/dist/node/es/document-model.js +7 -6
- package/dist/node/es/document-model.js.map +1 -1
- package/dist/node/es/document.js +12 -11
- package/dist/node/es/document.js.map +1 -1
- package/dist/node/es/index.js +2 -2
- package/dist/node/es/internal/{object-2XgKQb4s.js → creators-B6tCK8Ir.js} +84 -252
- package/dist/node/es/internal/creators-B6tCK8Ir.js.map +1 -0
- package/dist/node/es/internal/index-CJxdcyKO.js +48 -0
- package/dist/node/es/internal/index-CJxdcyKO.js.map +1 -0
- package/dist/node/es/internal/{index-D4oqm7Ua.js → index-dVqoH-Pd.js} +8 -7
- package/dist/{browser/es/internal/index-D_fwH6L3.js.map → node/es/internal/index-dVqoH-Pd.js.map} +1 -1
- package/dist/node/es/internal/index-mUxH6TbI.js +20 -0
- package/dist/node/es/internal/index-mUxH6TbI.js.map +1 -0
- package/dist/node/es/internal/object-Bj_Xyrvk.js +184 -0
- package/dist/node/es/internal/object-Bj_Xyrvk.js.map +1 -0
- package/dist/node/es/utils.js +44 -0
- package/dist/node/es/utils.js.map +1 -0
- package/dist/node/src/document/reducer.d.ts.map +1 -1
- package/dist/node/src/document/utils/base.d.ts.map +1 -1
- package/dist/node/src/document/utils/browser.d.ts +1 -0
- package/dist/node/src/document/utils/browser.d.ts.map +1 -1
- package/dist/node/src/document/utils/crypto.d.ts +1 -0
- package/dist/node/src/document/utils/crypto.d.ts.map +1 -1
- package/dist/node/src/document/utils/errors.d.ts +10 -0
- package/dist/node/src/document/utils/errors.d.ts.map +1 -0
- package/dist/node/src/document/utils/index.d.ts +1 -0
- package/dist/node/src/document/utils/index.d.ts.map +1 -1
- package/dist/node/src/document/utils/node.d.ts +2 -1
- package/dist/node/src/document/utils/node.d.ts.map +1 -1
- package/dist/node/utils.d.ts +2 -0
- package/dist/node/vite.config.d.ts.map +1 -1
- package/package.json +11 -2
- package/dist/browser/cjs/internal/index-B62DRxDu.js +0 -58
- package/dist/browser/cjs/internal/index-B62DRxDu.js.map +0 -1
- package/dist/browser/cjs/internal/object-BdIbCX0K.js.map +0 -1
- package/dist/browser/es/internal/index-CPWf201E.js +0 -59
- package/dist/browser/es/internal/index-CPWf201E.js.map +0 -1
- package/dist/browser/es/internal/object-oB7gkKNr.js.map +0 -1
- package/dist/node/cjs/internal/index-DozfRrse.js +0 -58
- package/dist/node/cjs/internal/index-DozfRrse.js.map +0 -1
- package/dist/node/cjs/internal/object-DqFXYK4g.js.map +0 -1
- package/dist/node/es/internal/index-Bf87b5UD.js +0 -59
- package/dist/node/es/internal/index-Bf87b5UD.js.map +0 -1
- package/dist/node/es/internal/object-2XgKQb4s.js.map +0 -1
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
const mutative = require("mutative");
|
|
6
|
-
const zod$1 = require("zod");
|
|
7
|
-
const crypto$1 = require("crypto");
|
|
8
|
-
const fs = require("fs");
|
|
9
|
-
const https = require("https");
|
|
10
|
-
const path = require("path");
|
|
11
5
|
const JSZip = require("jszip");
|
|
6
|
+
const zod$1 = require("zod");
|
|
7
|
+
const mutative = require("mutative");
|
|
8
|
+
const crypto = require("node:crypto");
|
|
9
|
+
const fs = require("node:fs");
|
|
10
|
+
const https = require("node:https");
|
|
11
|
+
const node_path = require("node:path");
|
|
12
12
|
const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
|
|
13
13
|
const definedNonNullAnySchema = zod$1.z.any().refine((v) => isDefinedNonNullAny(v));
|
|
14
14
|
const Load_StateSchema = zod$1.z.enum(["LOAD_STATE"]);
|
|
@@ -749,41 +749,12 @@ ${originalIndentation}`;
|
|
|
749
749
|
var safeStableStringifyExports = requireSafeStableStringify();
|
|
750
750
|
const cjsModule = /* @__PURE__ */ getDefaultExportFromCjs(safeStableStringifyExports);
|
|
751
751
|
cjsModule.configure;
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
function rng() {
|
|
755
|
-
if (!getRandomValues) {
|
|
756
|
-
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
757
|
-
if (!getRandomValues) {
|
|
758
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
return getRandomValues(rnds8);
|
|
762
|
-
}
|
|
763
|
-
const byteToHex = [];
|
|
764
|
-
for (let i = 0; i < 256; ++i) {
|
|
765
|
-
byteToHex.push((i + 256).toString(16).slice(1));
|
|
752
|
+
function generateUUID(options) {
|
|
753
|
+
return crypto.randomUUID(options);
|
|
766
754
|
}
|
|
767
|
-
function
|
|
768
|
-
|
|
769
|
-
}
|
|
770
|
-
const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
771
|
-
const native = {
|
|
772
|
-
randomUUID
|
|
773
|
-
};
|
|
774
|
-
function v4(options, buf, offset) {
|
|
775
|
-
if (native.randomUUID && !buf && !options) {
|
|
776
|
-
return native.randomUUID();
|
|
777
|
-
}
|
|
778
|
-
options = options || {};
|
|
779
|
-
const rnds = options.random || (options.rng || rng)();
|
|
780
|
-
rnds[6] = rnds[6] & 15 | 64;
|
|
781
|
-
rnds[8] = rnds[8] & 63 | 128;
|
|
782
|
-
return unsafeStringify(rnds);
|
|
783
|
-
}
|
|
784
|
-
function writeFile(path$1, name, data) {
|
|
785
|
-
const filePath = path.join(path$1, name);
|
|
786
|
-
fs.mkdirSync(path$1, { recursive: true });
|
|
755
|
+
function writeFile(path, name, data) {
|
|
756
|
+
const filePath = node_path.join(path, name);
|
|
757
|
+
fs.mkdirSync(path, { recursive: true });
|
|
787
758
|
return new Promise((resolve, reject) => {
|
|
788
759
|
try {
|
|
789
760
|
fs.writeFile(filePath, data, {}, (err) => {
|
|
@@ -798,8 +769,8 @@ function writeFile(path$1, name, data) {
|
|
|
798
769
|
}
|
|
799
770
|
});
|
|
800
771
|
}
|
|
801
|
-
function readFile(
|
|
802
|
-
return fs.readFileSync(
|
|
772
|
+
function readFile(path) {
|
|
773
|
+
return fs.readFileSync(path);
|
|
803
774
|
}
|
|
804
775
|
function fetchFile(url) {
|
|
805
776
|
return new Promise((resolve, reject) => {
|
|
@@ -821,8 +792,16 @@ const getFile = async (file) => {
|
|
|
821
792
|
return readFile(file);
|
|
822
793
|
};
|
|
823
794
|
const hash = (data, algorithm = "sha1") => {
|
|
824
|
-
return crypto
|
|
795
|
+
return crypto.createHash(algorithm).update(data).digest("base64");
|
|
825
796
|
};
|
|
797
|
+
function generateId(method) {
|
|
798
|
+
if (method && method.toString() !== "UUIDv4") {
|
|
799
|
+
throw new Error(
|
|
800
|
+
`Id generation method not supported: "${method.toString()}"`
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
return generateUUID();
|
|
804
|
+
}
|
|
826
805
|
function getUnixTimestamp(date) {
|
|
827
806
|
return (new Date(date).getTime() / 1e3).toFixed(0);
|
|
828
807
|
}
|
|
@@ -908,6 +887,23 @@ async function verifyOperationSignature(signature, signer, verifyHandler) {
|
|
|
908
887
|
const expectedMessage = buildOperationSignatureMessage(params);
|
|
909
888
|
return verifyHandler(publicKey, signatureBytes, expectedMessage);
|
|
910
889
|
}
|
|
890
|
+
class InvalidActionInputError extends Error {
|
|
891
|
+
constructor(data) {
|
|
892
|
+
super();
|
|
893
|
+
__publicField(this, "data");
|
|
894
|
+
this.name = "InvalidActionInputError";
|
|
895
|
+
this.data = data;
|
|
896
|
+
this.message = this.message || `Invalid action input: ${JSON.stringify(data, null, 2)}`;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
class InvalidActionInputZodError extends InvalidActionInputError {
|
|
900
|
+
constructor(issues) {
|
|
901
|
+
super(issues);
|
|
902
|
+
__publicField(this, "issues");
|
|
903
|
+
this.issues = issues;
|
|
904
|
+
this.name = "InvalidActionInputZodError";
|
|
905
|
+
}
|
|
906
|
+
}
|
|
911
907
|
const types = { "application/andrew-inset": ["ez"], "application/appinstaller": ["appinstaller"], "application/applixware": ["aw"], "application/appx": ["appx"], "application/appxbundle": ["appxbundle"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/automationml-aml+xml": ["aml"], "application/automationml-amlx+zip": ["amlx"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cpl+xml": ["cpl"], "application/cu-seeme": ["cu"], "application/cwl": ["cwl"], "application/dash+xml": ["mpd"], "application/dash-patch+xml": ["mpp"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdf": ["fdf"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["*js"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/media-policy-dataset+xml": ["mpf"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["*mp4", "*mpg4", "mp4s", "m4p"], "application/msix": ["msix"], "application/msixbundle": ["msixbundle"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-keys": ["asc"], "application/pgp-signature": ["sig", "*asc"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/sql": ["sql"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/watcherinfo+xml": ["wif"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xfdf": ["xfdf"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/aac": ["adts", "aac"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avci": ["avci"], "image/avcs": ["avcs"], "image/avif": ["avif"], "image/bmp": ["bmp", "dib"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/dpx": ["dpx"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm", "jpgm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/jt": ["jt"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/prc": ["prc"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/u3d": ["u3d"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/javascript": ["js", "mjs"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["md", "markdown"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/wgsl": ["wgsl"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "*jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
|
|
912
908
|
Object.freeze(types);
|
|
913
909
|
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
@@ -953,12 +949,12 @@ class Mime {
|
|
|
953
949
|
}
|
|
954
950
|
return this;
|
|
955
951
|
}
|
|
956
|
-
getType(
|
|
957
|
-
if (typeof
|
|
952
|
+
getType(path) {
|
|
953
|
+
if (typeof path !== "string")
|
|
958
954
|
return null;
|
|
959
|
-
const last =
|
|
955
|
+
const last = path.replace(/^.*[/\\]/, "").toLowerCase();
|
|
960
956
|
const ext = last.replace(/^.*\./, "").toLowerCase();
|
|
961
|
-
const hasPath = last.length <
|
|
957
|
+
const hasPath = last.length < path.length;
|
|
962
958
|
const hasDot = ext.length < last.length - 1;
|
|
963
959
|
if (!hasDot && hasPath)
|
|
964
960
|
return null;
|
|
@@ -1410,7 +1406,7 @@ const createZip = async (document) => {
|
|
|
1410
1406
|
}
|
|
1411
1407
|
return zip;
|
|
1412
1408
|
};
|
|
1413
|
-
const saveToFile = async (document,
|
|
1409
|
+
const saveToFile = async (document, path, extension, name) => {
|
|
1414
1410
|
const zip = await createZip(document);
|
|
1415
1411
|
const file = await zip.generateAsync({
|
|
1416
1412
|
type: "uint8array",
|
|
@@ -1419,7 +1415,7 @@ const saveToFile = async (document, path2, extension, name) => {
|
|
|
1419
1415
|
const fileName = name ?? document.name;
|
|
1420
1416
|
const fileExtension = `.${extension}.zip`;
|
|
1421
1417
|
return writeFile(
|
|
1422
|
-
|
|
1418
|
+
path,
|
|
1423
1419
|
fileName.endsWith(fileExtension) ? fileName : `${fileName}${fileExtension}`,
|
|
1424
1420
|
file
|
|
1425
1421
|
);
|
|
@@ -1431,8 +1427,8 @@ const saveToFileHandle = async (document, input) => {
|
|
|
1431
1427
|
await writable.write(blob);
|
|
1432
1428
|
await writable.close();
|
|
1433
1429
|
};
|
|
1434
|
-
const loadFromFile = async (
|
|
1435
|
-
const file = readFile(
|
|
1430
|
+
const loadFromFile = async (path, reducer, options) => {
|
|
1431
|
+
const file = readFile(path);
|
|
1436
1432
|
return loadFromInput(file, reducer, options);
|
|
1437
1433
|
};
|
|
1438
1434
|
const loadFromInput = async (input, reducer, options) => {
|
|
@@ -1498,10 +1494,10 @@ async function getRemoteFile(url) {
|
|
|
1498
1494
|
...attributes
|
|
1499
1495
|
};
|
|
1500
1496
|
}
|
|
1501
|
-
async function getLocalFile(
|
|
1502
|
-
const buffer = await getFile(
|
|
1503
|
-
const mimeType = mime.getType(
|
|
1504
|
-
const attributes = getFileAttributes(
|
|
1497
|
+
async function getLocalFile(path) {
|
|
1498
|
+
const buffer = await getFile(path);
|
|
1499
|
+
const mimeType = mime.getType(path) || "application/octet-stream";
|
|
1500
|
+
const attributes = getFileAttributes(path);
|
|
1505
1501
|
const data = buffer.toString("base64");
|
|
1506
1502
|
return { data, hash: hash(data), mimeType, ...attributes };
|
|
1507
1503
|
}
|
|
@@ -1675,7 +1671,7 @@ function updateOperations(document, action, skip = 0, reuseLastOperationIndex =
|
|
|
1675
1671
|
operationId = action.id;
|
|
1676
1672
|
timestamp = action.timestamp;
|
|
1677
1673
|
} else {
|
|
1678
|
-
operationId = "id" in action ? action.id :
|
|
1674
|
+
operationId = "id" in action ? action.id : generateId();
|
|
1679
1675
|
}
|
|
1680
1676
|
operations.push({
|
|
1681
1677
|
...action,
|
|
@@ -2006,7 +2002,11 @@ function createAction(type, input, attachments, validator, scope = "global") {
|
|
|
2006
2002
|
try {
|
|
2007
2003
|
validator == null ? void 0 : validator().parse(action.input);
|
|
2008
2004
|
} catch (error) {
|
|
2009
|
-
|
|
2005
|
+
if (error instanceof zod$1.ZodError) {
|
|
2006
|
+
throw new InvalidActionInputZodError(error.issues);
|
|
2007
|
+
} else {
|
|
2008
|
+
throw new InvalidActionInputError(error);
|
|
2009
|
+
}
|
|
2010
2010
|
}
|
|
2011
2011
|
return action;
|
|
2012
2012
|
}
|
|
@@ -2278,184 +2278,10 @@ const BaseActions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
2278
2278
|
setName,
|
|
2279
2279
|
undo
|
|
2280
2280
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2281
|
-
class BaseDocument {
|
|
2282
|
-
/**
|
|
2283
|
-
* Constructs a BaseDocument instance with an initial state.
|
|
2284
|
-
* @param reducer - The reducer function that updates the state.
|
|
2285
|
-
* @param document - The initial state of the document.
|
|
2286
|
-
*/
|
|
2287
|
-
constructor(reducer, document, signalDispatch) {
|
|
2288
|
-
__publicField(this, "_document");
|
|
2289
|
-
__publicField(this, "_reducer");
|
|
2290
|
-
__publicField(this, "_signalDispatch");
|
|
2291
|
-
this._reducer = reducer;
|
|
2292
|
-
this._document = document;
|
|
2293
|
-
this._signalDispatch = signalDispatch;
|
|
2294
|
-
}
|
|
2295
|
-
/**
|
|
2296
|
-
* Dispatches an action to update the state of the document.
|
|
2297
|
-
* @param action - The action to dispatch.
|
|
2298
|
-
* @returns The Document instance.
|
|
2299
|
-
*/
|
|
2300
|
-
dispatch(action, options) {
|
|
2301
|
-
this._document = this._reducer(
|
|
2302
|
-
this._document,
|
|
2303
|
-
action,
|
|
2304
|
-
this._signalDispatch,
|
|
2305
|
-
options
|
|
2306
|
-
);
|
|
2307
|
-
return this;
|
|
2308
|
-
}
|
|
2309
|
-
/**
|
|
2310
|
-
* Saves the state of the document to a file.
|
|
2311
|
-
* @param path - The file path where the state should be saved.
|
|
2312
|
-
* @param extension - The file extension to use when saving the state.
|
|
2313
|
-
* @returns The file path where the state was saved.
|
|
2314
|
-
*/
|
|
2315
|
-
saveToFile(path2, extension, name) {
|
|
2316
|
-
return saveToFile(this._document, path2, extension, name);
|
|
2317
|
-
}
|
|
2318
|
-
/**
|
|
2319
|
-
* Loads the state of the document from a file.
|
|
2320
|
-
* @param path - The file path where the state is stored.
|
|
2321
|
-
*/
|
|
2322
|
-
async loadFromFile(path2) {
|
|
2323
|
-
this._document = await loadFromFile(path2, this._reducer);
|
|
2324
|
-
}
|
|
2325
|
-
/**
|
|
2326
|
-
* Loads the state of the document from a file and returns it.
|
|
2327
|
-
* @param path - The file path where the state is stored.
|
|
2328
|
-
* @param reducer - The reducer function that updates the state.
|
|
2329
|
-
* @returns The state of the document.
|
|
2330
|
-
*/
|
|
2331
|
-
static async stateFromFile(path2, reducer) {
|
|
2332
|
-
const state = await loadFromFile(path2, reducer);
|
|
2333
|
-
return state;
|
|
2334
|
-
}
|
|
2335
|
-
/**
|
|
2336
|
-
* Gets the current state of the document.
|
|
2337
|
-
*/
|
|
2338
|
-
get state() {
|
|
2339
|
-
return readOnly(this._document.state);
|
|
2340
|
-
}
|
|
2341
|
-
/**
|
|
2342
|
-
* Gets the list of operations performed on the document.
|
|
2343
|
-
*/
|
|
2344
|
-
get operations() {
|
|
2345
|
-
return readOnly(this._document.operations);
|
|
2346
|
-
}
|
|
2347
|
-
/**
|
|
2348
|
-
* Gets the name of the document.
|
|
2349
|
-
*/
|
|
2350
|
-
get name() {
|
|
2351
|
-
return this._document.name;
|
|
2352
|
-
}
|
|
2353
|
-
/**
|
|
2354
|
-
* Gets the type of document.
|
|
2355
|
-
*/
|
|
2356
|
-
get documentType() {
|
|
2357
|
-
return this._document.documentType;
|
|
2358
|
-
}
|
|
2359
|
-
/**
|
|
2360
|
-
* Gets the timestamp of the date the document was created.
|
|
2361
|
-
*/
|
|
2362
|
-
get created() {
|
|
2363
|
-
return this._document.created;
|
|
2364
|
-
}
|
|
2365
|
-
/**
|
|
2366
|
-
* Gets the timestamp of the date the document was last modified.
|
|
2367
|
-
*/
|
|
2368
|
-
get lastModified() {
|
|
2369
|
-
return this._document.lastModified;
|
|
2370
|
-
}
|
|
2371
|
-
/**
|
|
2372
|
-
* Gets the global revision number of the document.
|
|
2373
|
-
*/
|
|
2374
|
-
get revision() {
|
|
2375
|
-
return this._document.revision.global;
|
|
2376
|
-
}
|
|
2377
|
-
getRevision(scope) {
|
|
2378
|
-
return this._document.revision[scope];
|
|
2379
|
-
}
|
|
2380
|
-
/**
|
|
2381
|
-
* Gets the initial state of the document.
|
|
2382
|
-
*/
|
|
2383
|
-
get initialState() {
|
|
2384
|
-
return readOnly(this._document.initialState);
|
|
2385
|
-
}
|
|
2386
|
-
/**
|
|
2387
|
-
* Returns the current document as an object
|
|
2388
|
-
*/
|
|
2389
|
-
toDocument() {
|
|
2390
|
-
return readOnly(this._document);
|
|
2391
|
-
}
|
|
2392
|
-
/**
|
|
2393
|
-
* Gets the attachment associated with the given key.
|
|
2394
|
-
* @param attachment - The key of the attachment to retrieve.
|
|
2395
|
-
*/
|
|
2396
|
-
getAttachment(attachment) {
|
|
2397
|
-
return this._document.attachments[attachment];
|
|
2398
|
-
}
|
|
2399
|
-
/**
|
|
2400
|
-
* Sets the name of the document.
|
|
2401
|
-
* @param name - The new name of the document.
|
|
2402
|
-
*/
|
|
2403
|
-
setName(name) {
|
|
2404
|
-
this.dispatch(setName(name));
|
|
2405
|
-
return this;
|
|
2406
|
-
}
|
|
2407
|
-
/**
|
|
2408
|
-
* Reverts a number of actions from the document.
|
|
2409
|
-
* @param count - The number of actions to revert.
|
|
2410
|
-
*/
|
|
2411
|
-
undo(count) {
|
|
2412
|
-
this.dispatch(undo(count));
|
|
2413
|
-
return this;
|
|
2414
|
-
}
|
|
2415
|
-
/**
|
|
2416
|
-
* Reapplies a number of actions to the document.
|
|
2417
|
-
* @param count - The number of actions to reapply.
|
|
2418
|
-
*/
|
|
2419
|
-
redo(count) {
|
|
2420
|
-
this.dispatch(redo(count));
|
|
2421
|
-
return this;
|
|
2422
|
-
}
|
|
2423
|
-
/**
|
|
2424
|
-
* Removes a range of operations from the document.
|
|
2425
|
-
* @param start - The starting index of the range to remove.
|
|
2426
|
-
* @param end - The ending index of the range to remove.
|
|
2427
|
-
*/
|
|
2428
|
-
prune(start, end) {
|
|
2429
|
-
this.dispatch(prune(start, end));
|
|
2430
|
-
return this;
|
|
2431
|
-
}
|
|
2432
|
-
/**
|
|
2433
|
-
* Loads a document state and a set of operations.
|
|
2434
|
-
* @param state - The state to load.
|
|
2435
|
-
* @param operations - The operations to apply to the document.
|
|
2436
|
-
*/
|
|
2437
|
-
loadState(state, operations) {
|
|
2438
|
-
this.dispatch(loadState(state, operations));
|
|
2439
|
-
return this;
|
|
2440
|
-
}
|
|
2441
|
-
}
|
|
2442
|
-
function applyMixins(derivedCtor, constructors) {
|
|
2443
|
-
constructors.forEach((baseCtor) => {
|
|
2444
|
-
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
|
|
2445
|
-
Object.defineProperty(
|
|
2446
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2447
|
-
derivedCtor.prototype,
|
|
2448
|
-
name,
|
|
2449
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
2450
|
-
Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || /* @__PURE__ */ Object.create(null)
|
|
2451
|
-
);
|
|
2452
|
-
});
|
|
2453
|
-
});
|
|
2454
|
-
}
|
|
2455
2281
|
exports.BaseActions = BaseActions;
|
|
2456
|
-
exports.
|
|
2282
|
+
exports.InvalidActionInputError = InvalidActionInputError;
|
|
2283
|
+
exports.InvalidActionInputZodError = InvalidActionInputZodError;
|
|
2457
2284
|
exports.ab2hex = ab2hex;
|
|
2458
|
-
exports.applyMixins = applyMixins;
|
|
2459
2285
|
exports.baseReducer = baseReducer;
|
|
2460
2286
|
exports.buildOperationSignature = buildOperationSignature;
|
|
2461
2287
|
exports.buildOperationSignatureMessage = buildOperationSignatureMessage;
|
|
@@ -2468,6 +2294,7 @@ exports.createReducer = createReducer;
|
|
|
2468
2294
|
exports.createUnsafeReducer = createUnsafeReducer;
|
|
2469
2295
|
exports.createZip = createZip;
|
|
2470
2296
|
exports.documentHelpers = documentHelpers;
|
|
2297
|
+
exports.generateId = generateId;
|
|
2471
2298
|
exports.getDocumentLastModified = getDocumentLastModified;
|
|
2472
2299
|
exports.getLocalFile = getLocalFile;
|
|
2473
2300
|
exports.getRemoteFile = getRemoteFile;
|
|
@@ -2482,20 +2309,25 @@ exports.isUndo = isUndo;
|
|
|
2482
2309
|
exports.isUndoRedo = isUndoRedo;
|
|
2483
2310
|
exports.loadFromFile = loadFromFile;
|
|
2484
2311
|
exports.loadFromInput = loadFromInput;
|
|
2312
|
+
exports.loadState = loadState;
|
|
2485
2313
|
exports.mapSkippedOperations = mapSkippedOperations;
|
|
2486
2314
|
exports.mutableBaseReducer = mutableBaseReducer;
|
|
2487
2315
|
exports.parseResultingState = parseResultingState;
|
|
2488
2316
|
exports.processUndoRedo = processUndoRedo;
|
|
2317
|
+
exports.prune = prune;
|
|
2489
2318
|
exports.readOnly = readOnly;
|
|
2319
|
+
exports.redo = redo;
|
|
2490
2320
|
exports.replayDocument = replayDocument;
|
|
2491
2321
|
exports.replayOperations = replayOperations;
|
|
2492
2322
|
exports.saveToFile = saveToFile;
|
|
2493
2323
|
exports.saveToFileHandle = saveToFileHandle;
|
|
2324
|
+
exports.setName = setName;
|
|
2494
2325
|
exports.sortMappedOperations = sortMappedOperations;
|
|
2495
2326
|
exports.sortOperations = sortOperations;
|
|
2327
|
+
exports.undo = undo;
|
|
2496
2328
|
exports.updateDocument = updateDocument;
|
|
2497
2329
|
exports.updateHeader = updateHeader;
|
|
2498
2330
|
exports.validateOperations = validateOperations;
|
|
2499
2331
|
exports.verifyOperationSignature = verifyOperationSignature;
|
|
2500
2332
|
exports.zod = zod;
|
|
2501
|
-
//# sourceMappingURL=
|
|
2333
|
+
//# sourceMappingURL=creators-B5g3rJKI.js.map
|