document-model 2.14.0 → 2.16.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.
Files changed (73) hide show
  1. package/dist/browser/cjs/document-model.js +2 -2
  2. package/dist/browser/cjs/document.js +3 -3
  3. package/dist/browser/cjs/index.js +2 -2
  4. package/dist/browser/cjs/internal/{creators-c2maywyy.js → creators-DJg3Kd1P.js} +353 -2
  5. package/dist/browser/cjs/internal/creators-DJg3Kd1P.js.map +1 -0
  6. package/dist/browser/cjs/internal/{index-DeM7OezK.js → index-CGExio27.js} +3 -3
  7. package/dist/browser/cjs/internal/{index-DeM7OezK.js.map → index-CGExio27.js.map} +1 -1
  8. package/dist/browser/cjs/internal/{index-DDUYrJUg.js → index-CQg4iLBq.js} +4 -4
  9. package/dist/browser/cjs/internal/index-CQg4iLBq.js.map +1 -0
  10. package/dist/{node/cjs/internal/index-Cdxqd-qQ.js → browser/cjs/internal/index-DcdJY5J3.js} +2 -2
  11. package/dist/browser/cjs/internal/index-DcdJY5J3.js.map +1 -0
  12. package/dist/browser/cjs/internal/{object-WukT1Feq.js → object-C3OfcOUa.js} +2 -2
  13. package/dist/browser/cjs/internal/{object-WukT1Feq.js.map → object-C3OfcOUa.js.map} +1 -1
  14. package/dist/browser/cjs/utils.js +1 -1
  15. package/dist/browser/es/document-model.js +2 -2
  16. package/dist/browser/es/document.js +3 -3
  17. package/dist/browser/es/index.js +2 -2
  18. package/dist/browser/es/internal/{creators-CkhiX4CP.js → creators-Dir4K_-h.js} +353 -2
  19. package/dist/browser/es/internal/creators-Dir4K_-h.js.map +1 -0
  20. package/dist/browser/es/internal/{index-CHpkSkeZ.js → index-BxCiP58y.js} +2 -2
  21. package/dist/browser/es/internal/index-BxCiP58y.js.map +1 -0
  22. package/dist/browser/es/internal/{index-BRVlDkPn.js → index-HlkIVQZ6.js} +3 -3
  23. package/dist/browser/es/internal/{index-BRVlDkPn.js.map → index-HlkIVQZ6.js.map} +1 -1
  24. package/dist/browser/es/internal/{index-uWY5kwkt.js → index-qYp7hG3r.js} +4 -4
  25. package/dist/browser/es/internal/index-qYp7hG3r.js.map +1 -0
  26. package/dist/browser/es/internal/{object-CJHsId9H.js → object-CzFSgK3q.js} +2 -2
  27. package/dist/browser/es/internal/{object-CJHsId9H.js.map → object-CzFSgK3q.js.map} +1 -1
  28. package/dist/browser/es/utils.js +1 -1
  29. package/dist/browser/src/document/schema/zod.d.ts +9 -27
  30. package/dist/browser/src/document/schema/zod.d.ts.map +1 -1
  31. package/dist/node/cjs/document-model.js +2 -2
  32. package/dist/node/cjs/document.js +3 -3
  33. package/dist/node/cjs/index.js +2 -2
  34. package/dist/node/cjs/internal/{creators-B5g3rJKI.js → creators-ZpkFlacS.js} +353 -2
  35. package/dist/node/cjs/internal/creators-ZpkFlacS.js.map +1 -0
  36. package/dist/{browser/cjs/internal/index-CTDPLYkV.js → node/cjs/internal/index-B9N2GsMZ.js} +2 -2
  37. package/dist/node/cjs/internal/index-B9N2GsMZ.js.map +1 -0
  38. package/dist/node/cjs/internal/{index-DHkzUhZg.js → index-ClITlWIV.js} +4 -4
  39. package/dist/node/cjs/internal/index-ClITlWIV.js.map +1 -0
  40. package/dist/node/cjs/internal/{index-CYhNqyfA.js → index-DVgdtYs7.js} +3 -3
  41. package/dist/node/cjs/internal/{index-CYhNqyfA.js.map → index-DVgdtYs7.js.map} +1 -1
  42. package/dist/node/cjs/internal/{object-CpAsa3Oe.js → object-DVKEoARn.js} +2 -2
  43. package/dist/node/cjs/internal/{object-CpAsa3Oe.js.map → object-DVKEoARn.js.map} +1 -1
  44. package/dist/node/cjs/utils.js +1 -1
  45. package/dist/node/es/document-model.js +2 -2
  46. package/dist/node/es/document.js +3 -3
  47. package/dist/node/es/index.js +2 -2
  48. package/dist/node/es/internal/{creators-B6tCK8Ir.js → creators-0lHfLHX0.js} +353 -2
  49. package/dist/node/es/internal/creators-0lHfLHX0.js.map +1 -0
  50. package/dist/node/es/internal/{index-CJxdcyKO.js → index-BOhJLvSm.js} +2 -2
  51. package/dist/node/es/internal/index-BOhJLvSm.js.map +1 -0
  52. package/dist/node/es/internal/{index-dVqoH-Pd.js → index-CxWihLAA.js} +3 -3
  53. package/dist/node/es/internal/{index-dVqoH-Pd.js.map → index-CxWihLAA.js.map} +1 -1
  54. package/dist/node/es/internal/{index-mUxH6TbI.js → index-bxdb71Hw.js} +4 -4
  55. package/dist/node/es/internal/index-bxdb71Hw.js.map +1 -0
  56. package/dist/node/es/internal/{object-Bj_Xyrvk.js → object-Bl-LmXHF.js} +2 -2
  57. package/dist/node/es/internal/{object-Bj_Xyrvk.js.map → object-Bl-LmXHF.js.map} +1 -1
  58. package/dist/node/es/utils.js +1 -1
  59. package/dist/node/src/document/schema/zod.d.ts +9 -27
  60. package/dist/node/src/document/schema/zod.d.ts.map +1 -1
  61. package/package.json +1 -1
  62. package/dist/browser/cjs/internal/creators-c2maywyy.js.map +0 -1
  63. package/dist/browser/cjs/internal/index-CTDPLYkV.js.map +0 -1
  64. package/dist/browser/cjs/internal/index-DDUYrJUg.js.map +0 -1
  65. package/dist/browser/es/internal/creators-CkhiX4CP.js.map +0 -1
  66. package/dist/browser/es/internal/index-CHpkSkeZ.js.map +0 -1
  67. package/dist/browser/es/internal/index-uWY5kwkt.js.map +0 -1
  68. package/dist/node/cjs/internal/creators-B5g3rJKI.js.map +0 -1
  69. package/dist/node/cjs/internal/index-Cdxqd-qQ.js.map +0 -1
  70. package/dist/node/cjs/internal/index-DHkzUhZg.js.map +0 -1
  71. package/dist/node/es/internal/creators-B6tCK8Ir.js.map +0 -1
  72. package/dist/node/es/internal/index-CJxdcyKO.js.map +0 -1
  73. package/dist/node/es/internal/index-mUxH6TbI.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { B as BaseActions, g as baseReducer, m as mutableBaseReducer, p as processUndoRedo, u as updateDocument, h as updateHeader, z as zod } from "./creators-B6tCK8Ir.js";
2
- import { B as BaseDocument, a as applyMixins } from "./object-Bj_Xyrvk.js";
3
- import { i as index } from "./index-CJxdcyKO.js";
1
+ import { B as BaseActions, g as baseReducer, m as mutableBaseReducer, p as processUndoRedo, u as updateDocument, h as updateHeader, z as zod } from "./creators-0lHfLHX0.js";
2
+ import { B as BaseDocument, a as applyMixins } from "./object-Bl-LmXHF.js";
3
+ import { i as index } from "./index-BOhJLvSm.js";
4
4
  const Document = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5
5
  __proto__: null,
6
6
  BaseDocument,
@@ -17,4 +17,4 @@ const Document = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
17
17
  export {
18
18
  Document as D
19
19
  };
20
- //# sourceMappingURL=index-mUxH6TbI.js.map
20
+ //# sourceMappingURL=index-bxdb71Hw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-bxdb71Hw.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import "mutative";
5
- import { s as saveToFile, l as loadFromFile, r as readOnly, j as setName, k as undo, n as redo, o as prune, q as loadState } from "./creators-B6tCK8Ir.js";
5
+ import { s as saveToFile, l as loadFromFile, r as readOnly, j as setName, k as undo, n as redo, o as prune, q as loadState } from "./creators-0lHfLHX0.js";
6
6
  class BaseDocument {
7
7
  /**
8
8
  * Constructs a BaseDocument instance with an initial state.
@@ -181,4 +181,4 @@ export {
181
181
  BaseDocument as B,
182
182
  applyMixins as a
183
183
  };
184
- //# sourceMappingURL=object-Bj_Xyrvk.js.map
184
+ //# sourceMappingURL=object-Bl-LmXHF.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"object-Bj_Xyrvk.js","sources":["../../../../src/document/object.ts"],"sourcesContent":["import { loadState, prune, redo, setName, undo } from \"./actions\";\nimport type { BaseAction } from \"./actions/types\";\nimport type { SignalDispatch } from \"./signal\";\nimport type {\n Action,\n AttachmentRef,\n Document,\n ExtendedState,\n OperationScope,\n Reducer,\n ReducerOptions,\n} from \"./types\";\nimport { loadFromFile, readOnly, saveToFile } from \"./utils\";\n\n/**\n * This is an abstract class representing a document and provides methods\n * for creating and manipulating documents.\n * @typeparam T - The type of data stored in the document.\n * @typeparam A - The type of action the document can take.\n */\nexport abstract class BaseDocument<T, A extends Action, L = unknown> {\n protected _document: Document<T, A, L>;\n private _reducer: Reducer<T, A, L>;\n private _signalDispatch?: SignalDispatch;\n\n /**\n * Constructs a BaseDocument instance with an initial state.\n * @param reducer - The reducer function that updates the state.\n * @param document - The initial state of the document.\n */\n constructor(\n reducer: Reducer<T, A, L>,\n document: Document<T, A, L>,\n signalDispatch?: SignalDispatch,\n ) {\n this._reducer = reducer;\n this._document = document;\n this._signalDispatch = signalDispatch;\n }\n\n /**\n * Dispatches an action to update the state of the document.\n * @param action - The action to dispatch.\n * @returns The Document instance.\n */\n protected dispatch(action: A | BaseAction, options?: ReducerOptions) {\n this._document = this._reducer(\n this._document,\n action,\n this._signalDispatch,\n options,\n );\n return this;\n }\n\n /**\n * Saves the state of the document to a file.\n * @param path - The file path where the state should be saved.\n * @param extension - The file extension to use when saving the state.\n * @returns The file path where the state was saved.\n */\n protected saveToFile(path: string, extension: string, name?: string) {\n return saveToFile(this._document, path, extension, name);\n }\n\n /**\n * Loads the state of the document from a file.\n * @param path - The file path where the state is stored.\n */\n async loadFromFile(path: string) {\n this._document = await loadFromFile<T, A, L>(path, this._reducer);\n }\n\n /**\n * Loads the state of the document from a file and returns it.\n * @param path - The file path where the state is stored.\n * @param reducer - The reducer function that updates the state.\n * @returns The state of the document.\n */\n protected static async stateFromFile<T, A extends Action, L>(\n path: string,\n reducer: Reducer<T, A, L>,\n ) {\n const state = await loadFromFile<T, A, L>(path, reducer);\n return state;\n }\n\n /**\n * Gets the current state of the document.\n */\n get state() {\n return readOnly(this._document.state);\n }\n\n /**\n * Gets the list of operations performed on the document.\n */\n get operations() {\n return readOnly(this._document.operations);\n }\n\n /**\n * Gets the name of the document.\n */\n get name() {\n return this._document.name;\n }\n\n /**\n * Gets the type of document.\n */\n get documentType() {\n return this._document.documentType;\n }\n\n /**\n * Gets the timestamp of the date the document was created.\n */\n get created() {\n return this._document.created;\n }\n\n /**\n * Gets the timestamp of the date the document was last modified.\n */\n get lastModified() {\n return this._document.lastModified;\n }\n\n /**\n * Gets the global revision number of the document.\n */\n get revision() {\n return this._document.revision.global;\n }\n\n getRevision(scope: OperationScope) {\n return this._document.revision[scope];\n }\n\n /**\n * Gets the initial state of the document.\n */\n get initialState() {\n return readOnly(this._document.initialState);\n }\n\n /**\n * Returns the current document as an object\n */\n public toDocument() {\n return readOnly(this._document);\n }\n\n /**\n * Gets the attachment associated with the given key.\n * @param attachment - The key of the attachment to retrieve.\n */\n public getAttachment(attachment: AttachmentRef) {\n return this._document.attachments[attachment];\n }\n\n /**\n * Sets the name of the document.\n * @param name - The new name of the document.\n */\n public setName(name: string) {\n this.dispatch(setName(name));\n return this;\n }\n\n /**\n * Reverts a number of actions from the document.\n * @param count - The number of actions to revert.\n */\n public undo(count: number) {\n this.dispatch(undo(count));\n return this;\n }\n\n /**\n * Reapplies a number of actions to the document.\n * @param count - The number of actions to reapply.\n */\n public redo(count: number) {\n this.dispatch(redo(count));\n return this;\n }\n /**\n * Removes a range of operations from the document.\n * @param start - The starting index of the range to remove.\n * @param end - The ending index of the range to remove.\n */\n public prune(start?: number | undefined, end?: number | undefined) {\n this.dispatch(prune(start, end));\n return this;\n }\n\n /**\n * Loads a document state and a set of operations.\n * @param state - The state to load.\n * @param operations - The operations to apply to the document.\n */\n public loadState(\n state: Pick<ExtendedState<T, L>, \"state\" | \"name\">,\n operations: number,\n ) {\n this.dispatch(loadState(state, operations));\n return this;\n }\n}\n/**\n * Applies multiple mixins to a base class.\n * Used to have separate mixins to group methods by actions.\n *\n * @remarks\n * {@link https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern}\n *\n * @param derivedCtor - The class to apply the mixins to.\n * @param constructors - The constructors of the mixins.\n */\n\nexport function applyMixins(derivedCtor: any, constructors: any[]) {\n constructors.forEach((baseCtor) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {\n Object.defineProperty(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n derivedCtor.prototype,\n name,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||\n Object.create(null),\n );\n });\n });\n}\n"],"names":[],"mappings":";;;;;AAoBO,MAAe,aAA+C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUnE,YACE,SACA,UACA,gBACA;AAbQ;AACF;AACA;AAYN,SAAK,WAAW;AAChB,SAAK,YAAY;AACjB,SAAK,kBAAkB;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQf,SAAS,QAAwB,SAA0B;AACnE,SAAK,YAAY,KAAK;AAAA,MACpB,KAAK;AAAA,MACL;AAAA,MACA,KAAK;AAAA,MACL;AAAA,IACF;AACO,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASC,WAAW,MAAc,WAAmB,MAAe;AACnE,WAAO,WAAW,KAAK,WAAW,MAAM,WAAW,IAAI;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOzD,MAAM,aAAa,MAAc;AAC/B,SAAK,YAAY,MAAM,aAAsB,MAAM,KAAK,QAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlE,aAAuB,cACrB,MACA,SACA;AACA,UAAM,QAAQ,MAAM,aAAsB,MAAM,OAAO;AAChD,WAAA;AAAA,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C;AAClB,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOF,MAAM,OAA4B,KAA0B;AACjE,SAAK,SAAS,MAAM,OAAO,GAAG,CAAC;AACxB,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQF,UACL,OACA,YACA;AACA,SAAK,SAAS,UAAU,OAAO,UAAU,CAAC;AACnC,WAAA;AAAA,EAAA;AAEX;AAYgB,SAAA,YAAY,aAAkB,cAAqB;AACpD,eAAA,QAAQ,CAAC,aAAa;AAEjC,WAAO,oBAAoB,SAAS,SAAS,EAAE,QAAQ,CAAC,SAAS;AACxD,aAAA;AAAA;AAAA,QAEL,YAAY;AAAA,QACZ;AAAA;AAAA,QAEA,OAAO,yBAAyB,SAAS,WAAW,IAAI,KACtD,uBAAO,OAAO,IAAI;AAAA,MACtB;AAAA,IAAA,CACD;AAAA,EAAA,CACF;AACH;"}
1
+ {"version":3,"file":"object-Bl-LmXHF.js","sources":["../../../../src/document/object.ts"],"sourcesContent":["import { loadState, prune, redo, setName, undo } from \"./actions\";\nimport type { BaseAction } from \"./actions/types\";\nimport type { SignalDispatch } from \"./signal\";\nimport type {\n Action,\n AttachmentRef,\n Document,\n ExtendedState,\n OperationScope,\n Reducer,\n ReducerOptions,\n} from \"./types\";\nimport { loadFromFile, readOnly, saveToFile } from \"./utils\";\n\n/**\n * This is an abstract class representing a document and provides methods\n * for creating and manipulating documents.\n * @typeparam T - The type of data stored in the document.\n * @typeparam A - The type of action the document can take.\n */\nexport abstract class BaseDocument<T, A extends Action, L = unknown> {\n protected _document: Document<T, A, L>;\n private _reducer: Reducer<T, A, L>;\n private _signalDispatch?: SignalDispatch;\n\n /**\n * Constructs a BaseDocument instance with an initial state.\n * @param reducer - The reducer function that updates the state.\n * @param document - The initial state of the document.\n */\n constructor(\n reducer: Reducer<T, A, L>,\n document: Document<T, A, L>,\n signalDispatch?: SignalDispatch,\n ) {\n this._reducer = reducer;\n this._document = document;\n this._signalDispatch = signalDispatch;\n }\n\n /**\n * Dispatches an action to update the state of the document.\n * @param action - The action to dispatch.\n * @returns The Document instance.\n */\n protected dispatch(action: A | BaseAction, options?: ReducerOptions) {\n this._document = this._reducer(\n this._document,\n action,\n this._signalDispatch,\n options,\n );\n return this;\n }\n\n /**\n * Saves the state of the document to a file.\n * @param path - The file path where the state should be saved.\n * @param extension - The file extension to use when saving the state.\n * @returns The file path where the state was saved.\n */\n protected saveToFile(path: string, extension: string, name?: string) {\n return saveToFile(this._document, path, extension, name);\n }\n\n /**\n * Loads the state of the document from a file.\n * @param path - The file path where the state is stored.\n */\n async loadFromFile(path: string) {\n this._document = await loadFromFile<T, A, L>(path, this._reducer);\n }\n\n /**\n * Loads the state of the document from a file and returns it.\n * @param path - The file path where the state is stored.\n * @param reducer - The reducer function that updates the state.\n * @returns The state of the document.\n */\n protected static async stateFromFile<T, A extends Action, L>(\n path: string,\n reducer: Reducer<T, A, L>,\n ) {\n const state = await loadFromFile<T, A, L>(path, reducer);\n return state;\n }\n\n /**\n * Gets the current state of the document.\n */\n get state() {\n return readOnly(this._document.state);\n }\n\n /**\n * Gets the list of operations performed on the document.\n */\n get operations() {\n return readOnly(this._document.operations);\n }\n\n /**\n * Gets the name of the document.\n */\n get name() {\n return this._document.name;\n }\n\n /**\n * Gets the type of document.\n */\n get documentType() {\n return this._document.documentType;\n }\n\n /**\n * Gets the timestamp of the date the document was created.\n */\n get created() {\n return this._document.created;\n }\n\n /**\n * Gets the timestamp of the date the document was last modified.\n */\n get lastModified() {\n return this._document.lastModified;\n }\n\n /**\n * Gets the global revision number of the document.\n */\n get revision() {\n return this._document.revision.global;\n }\n\n getRevision(scope: OperationScope) {\n return this._document.revision[scope];\n }\n\n /**\n * Gets the initial state of the document.\n */\n get initialState() {\n return readOnly(this._document.initialState);\n }\n\n /**\n * Returns the current document as an object\n */\n public toDocument() {\n return readOnly(this._document);\n }\n\n /**\n * Gets the attachment associated with the given key.\n * @param attachment - The key of the attachment to retrieve.\n */\n public getAttachment(attachment: AttachmentRef) {\n return this._document.attachments[attachment];\n }\n\n /**\n * Sets the name of the document.\n * @param name - The new name of the document.\n */\n public setName(name: string) {\n this.dispatch(setName(name));\n return this;\n }\n\n /**\n * Reverts a number of actions from the document.\n * @param count - The number of actions to revert.\n */\n public undo(count: number) {\n this.dispatch(undo(count));\n return this;\n }\n\n /**\n * Reapplies a number of actions to the document.\n * @param count - The number of actions to reapply.\n */\n public redo(count: number) {\n this.dispatch(redo(count));\n return this;\n }\n /**\n * Removes a range of operations from the document.\n * @param start - The starting index of the range to remove.\n * @param end - The ending index of the range to remove.\n */\n public prune(start?: number | undefined, end?: number | undefined) {\n this.dispatch(prune(start, end));\n return this;\n }\n\n /**\n * Loads a document state and a set of operations.\n * @param state - The state to load.\n * @param operations - The operations to apply to the document.\n */\n public loadState(\n state: Pick<ExtendedState<T, L>, \"state\" | \"name\">,\n operations: number,\n ) {\n this.dispatch(loadState(state, operations));\n return this;\n }\n}\n/**\n * Applies multiple mixins to a base class.\n * Used to have separate mixins to group methods by actions.\n *\n * @remarks\n * {@link https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern}\n *\n * @param derivedCtor - The class to apply the mixins to.\n * @param constructors - The constructors of the mixins.\n */\n\nexport function applyMixins(derivedCtor: any, constructors: any[]) {\n constructors.forEach((baseCtor) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {\n Object.defineProperty(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n derivedCtor.prototype,\n name,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||\n Object.create(null),\n );\n });\n });\n}\n"],"names":[],"mappings":";;;;;AAoBO,MAAe,aAA+C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUnE,YACE,SACA,UACA,gBACA;AAbQ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,4 +1,4 @@
1
- import { I, t, v, w, x, y, A, f, b, a, c, C, D, E, F, G, H, J, K, L, M, N, i, O, P, Q, R, l, e, S, T, r, U, V, s, d, W, X, Y, Z } from "./internal/creators-B6tCK8Ir.js";
1
+ import { I, t, v, w, x, y, A, f, b, a, c, C, D, E, F, G, H, J, K, L, M, N, i, O, P, Q, R, l, e, S, T, r, U, V, s, d, W, X, Y, Z } from "./internal/creators-0lHfLHX0.js";
2
2
  export {
3
3
  I as InvalidActionInputError,
4
4
  t as InvalidActionInputZodError,
@@ -82,36 +82,18 @@ export declare function LoadStateActionStateInputSchema(): z.ZodObject<Propertie
82
82
  export declare function OperationSchema(): z.ZodObject<Properties<Operation>>;
83
83
  export declare function PruneActionSchema(): z.ZodObject<Properties<PruneAction>>;
84
84
  export declare function PruneActionInputSchema(): z.ZodObject<Properties<PruneActionInput>>;
85
- export declare const RedoActionInputSchema: (params?: ({
86
- errorMap?: z.ZodErrorMap | undefined;
87
- invalid_type_error?: string | undefined;
88
- required_error?: string | undefined;
89
- message?: string | undefined;
90
- description?: string | undefined;
91
- } & {
92
- coerce?: boolean | undefined;
93
- }) | undefined) => z.ZodNumber;
85
+ export declare const RedoActionInputSchema: (params?: z.RawCreateParams & {
86
+ coerce?: boolean;
87
+ }) => z.ZodNumber;
94
88
  export declare function RedoActionSchema(): z.ZodObject<Properties<RedoAction>>;
95
- export declare const SetNameActionInputSchema: (params?: ({
96
- errorMap?: z.ZodErrorMap | undefined;
97
- invalid_type_error?: string | undefined;
98
- required_error?: string | undefined;
99
- message?: string | undefined;
100
- description?: string | undefined;
101
- } & {
102
- coerce?: true | undefined;
103
- }) | undefined) => z.ZodString;
89
+ export declare const SetNameActionInputSchema: (params?: z.RawCreateParams & {
90
+ coerce?: true;
91
+ }) => z.ZodString;
104
92
  export declare function SetNameActionSchema(): z.ZodObject<Properties<SetNameAction>>;
105
93
  export declare function SetNameOperationSchema(): z.ZodObject<Properties<SetNameOperation>>;
106
- export declare const UndoActionInputSchema: (params?: ({
107
- errorMap?: z.ZodErrorMap | undefined;
108
- invalid_type_error?: string | undefined;
109
- required_error?: string | undefined;
110
- message?: string | undefined;
111
- description?: string | undefined;
112
- } & {
113
- coerce?: boolean | undefined;
114
- }) | undefined) => z.ZodNumber;
94
+ export declare const UndoActionInputSchema: (params?: z.RawCreateParams & {
95
+ coerce?: boolean;
96
+ }) => z.ZodNumber;
115
97
  export declare function UndoActionSchema(): z.ZodObject<Properties<UndoAction>>;
116
98
  export {};
117
99
  //# sourceMappingURL=zod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../src/document/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,yBAAyB,EACzB,SAAS,EACT,KAAK,EACL,WAAW,EACX,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACX,MAAM,GAAG,CAAC;AACX,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAE5B,eAAO,MAAM,mBAAmB,MAAO,GAAG,KAAG,CAAC,IAAI,iBACnB,CAAC;AAEhC,eAAO,MAAM,uBAAuB,gDAEI,CAAC;AAEzC,eAAO,MAAM,gBAAgB,2BAAyB,CAAC;AAEvD,eAAO,MAAM,WAAW,sBAAoB,CAAC;AAE7C,eAAO,MAAM,UAAU,qBAAmB,C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S,CACnD,UAAU,CAAC,gBAAgB,CAAC,CAC7B,CAKA;AAED,eAAO,MAAM,qBAAqB;UA0Cqw0C,CAAC;iBA1C3v0C,CAAC;AAE9C,wBAAgB,gBAAgB,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAMtE;AAED,eAAO,MAAM,wBAAwB;UAgCsq0C,CAAC;iBAhC5p0C,CAAC;AAEjD,wBAAgB,mBAAmB,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAM5E;AAED,wBAAgB,sBAAsB,IAAI,CAAC,CAAC,SAAS,CACnD,UAAU,CAAC,gBAAgB,CAAC,CAC7B,CASA;AAED,eAAO,MAAM,qBAAqB;UASqw0C,CAAC;iBAT3v0C,CAAC;AAE9C,wBAAgB,gBAAgB,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAMtE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-model",
3
- "version": "2.14.0",
3
+ "version": "2.16.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": false,
6
6
  "files": [