@voidhash/mimic 0.0.1 → 0.0.3

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 (278) hide show
  1. package/.turbo/turbo-build.log +257 -42
  2. package/dist/Document.cjs +152 -0
  3. package/dist/Document.d.cts +67 -0
  4. package/dist/Document.d.cts.map +1 -0
  5. package/dist/Document.d.mts +68 -0
  6. package/dist/Document.d.mts.map +1 -0
  7. package/dist/Document.mjs +147 -0
  8. package/dist/Document.mjs.map +1 -0
  9. package/dist/EffectSchema.cjs +180 -0
  10. package/dist/EffectSchema.d.cts +84 -0
  11. package/dist/EffectSchema.d.cts.map +1 -0
  12. package/dist/EffectSchema.d.mts +84 -0
  13. package/dist/EffectSchema.d.mts.map +1 -0
  14. package/dist/EffectSchema.mjs +176 -0
  15. package/dist/EffectSchema.mjs.map +1 -0
  16. package/dist/FractionalIndex.cjs +365 -0
  17. package/dist/FractionalIndex.mjs +364 -0
  18. package/dist/FractionalIndex.mjs.map +1 -0
  19. package/dist/Operation.cjs +53 -0
  20. package/dist/Operation.d.cts +39 -0
  21. package/dist/Operation.d.cts.map +1 -0
  22. package/dist/Operation.d.mts +39 -0
  23. package/dist/Operation.d.mts.map +1 -0
  24. package/dist/Operation.mjs +46 -0
  25. package/dist/Operation.mjs.map +1 -0
  26. package/dist/OperationDefinition.cjs +13 -0
  27. package/dist/OperationDefinition.d.cts +12 -0
  28. package/dist/OperationDefinition.d.cts.map +1 -0
  29. package/dist/OperationDefinition.d.mts +12 -0
  30. package/dist/OperationDefinition.d.mts.map +1 -0
  31. package/dist/OperationDefinition.mjs +13 -0
  32. package/dist/OperationDefinition.mjs.map +1 -0
  33. package/dist/OperationPath.cjs +148 -0
  34. package/dist/OperationPath.d.cts +60 -0
  35. package/dist/OperationPath.d.cts.map +1 -0
  36. package/dist/OperationPath.d.mts +60 -0
  37. package/dist/OperationPath.d.mts.map +1 -0
  38. package/dist/OperationPath.mjs +138 -0
  39. package/dist/OperationPath.mjs.map +1 -0
  40. package/dist/{Presence-gWrmGBeu.cjs → Presence.cjs} +4 -39
  41. package/dist/{Presence-N8u7Eppr.d.mts → Presence.d.cts} +2 -2
  42. package/dist/Presence.d.cts.map +1 -0
  43. package/dist/{Presence-DKKP4v5X.d.cts → Presence.d.mts} +2 -2
  44. package/dist/Presence.d.mts.map +1 -0
  45. package/dist/{Presence-DdMVKcOv.mjs → Presence.mjs} +3 -28
  46. package/dist/Presence.mjs.map +1 -0
  47. package/dist/Primitive.cjs +52 -0
  48. package/dist/Primitive.d.cts +20 -0
  49. package/dist/Primitive.d.cts.map +1 -0
  50. package/dist/Primitive.d.mts +20 -0
  51. package/dist/Primitive.d.mts.map +1 -0
  52. package/dist/Primitive.mjs +48 -0
  53. package/dist/Primitive.mjs.map +1 -0
  54. package/dist/ProxyEnvironment.cjs +34 -0
  55. package/dist/ProxyEnvironment.d.cts +31 -0
  56. package/dist/ProxyEnvironment.d.cts.map +1 -0
  57. package/dist/ProxyEnvironment.d.mts +31 -0
  58. package/dist/ProxyEnvironment.d.mts.map +1 -0
  59. package/dist/ProxyEnvironment.mjs +29 -0
  60. package/dist/ProxyEnvironment.mjs.map +1 -0
  61. package/dist/Transaction.cjs +66 -0
  62. package/dist/Transaction.d.cts +56 -0
  63. package/dist/Transaction.d.cts.map +1 -0
  64. package/dist/Transaction.d.mts +56 -0
  65. package/dist/Transaction.d.mts.map +1 -0
  66. package/dist/Transaction.mjs +58 -0
  67. package/dist/Transaction.mjs.map +1 -0
  68. package/dist/Transform.cjs +11 -0
  69. package/dist/Transform.d.cts +21 -0
  70. package/dist/Transform.d.cts.map +1 -0
  71. package/dist/Transform.d.mts +21 -0
  72. package/dist/Transform.d.mts.map +1 -0
  73. package/dist/Transform.mjs +6 -0
  74. package/dist/Transform.mjs.map +1 -0
  75. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.cjs +14 -0
  76. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs +14 -0
  77. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.cjs +27 -0
  78. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs +27 -0
  79. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.cjs +16 -0
  80. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.mjs +16 -0
  81. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.cjs +11 -0
  82. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.mjs +11 -0
  83. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.cjs +18 -0
  84. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.mjs +12 -0
  85. package/dist/_virtual/rolldown_runtime.cjs +43 -0
  86. package/dist/{chunk-CLMFDpHK.mjs → _virtual/rolldown_runtime.mjs} +1 -1
  87. package/dist/client/ClientDocument.cjs +590 -0
  88. package/dist/client/ClientDocument.d.cts +161 -0
  89. package/dist/client/ClientDocument.d.cts.map +1 -0
  90. package/dist/client/ClientDocument.d.mts +162 -0
  91. package/dist/client/ClientDocument.d.mts.map +1 -0
  92. package/dist/client/ClientDocument.mjs +586 -0
  93. package/dist/client/ClientDocument.mjs.map +1 -0
  94. package/dist/client/Rebase.cjs +204 -0
  95. package/dist/client/Rebase.d.cts +87 -0
  96. package/dist/client/Rebase.d.cts.map +1 -0
  97. package/dist/client/Rebase.d.mts +88 -0
  98. package/dist/client/Rebase.d.mts.map +1 -0
  99. package/dist/client/Rebase.mjs +198 -0
  100. package/dist/client/Rebase.mjs.map +1 -0
  101. package/dist/client/StateMonitor.cjs +133 -0
  102. package/dist/client/StateMonitor.d.cts +122 -0
  103. package/dist/client/StateMonitor.d.cts.map +1 -0
  104. package/dist/client/StateMonitor.d.mts +122 -0
  105. package/dist/client/StateMonitor.d.mts.map +1 -0
  106. package/dist/client/StateMonitor.mjs +129 -0
  107. package/dist/client/StateMonitor.mjs.map +1 -0
  108. package/dist/client/Transport.cjs +11 -0
  109. package/dist/client/Transport.d.cts +237 -0
  110. package/dist/client/Transport.d.cts.map +1 -0
  111. package/dist/client/Transport.d.mts +237 -0
  112. package/dist/client/Transport.d.mts.map +1 -0
  113. package/dist/client/Transport.mjs +6 -0
  114. package/dist/client/Transport.mjs.map +1 -0
  115. package/dist/client/WebSocketTransport.cjs +396 -0
  116. package/dist/client/WebSocketTransport.d.cts +29 -0
  117. package/dist/client/WebSocketTransport.d.cts.map +1 -0
  118. package/dist/client/WebSocketTransport.d.mts +29 -0
  119. package/dist/client/WebSocketTransport.d.mts.map +1 -0
  120. package/dist/client/WebSocketTransport.mjs +392 -0
  121. package/dist/client/WebSocketTransport.mjs.map +1 -0
  122. package/dist/client/errors.cjs +135 -0
  123. package/dist/client/errors.d.cts +87 -0
  124. package/dist/client/errors.d.cts.map +1 -0
  125. package/dist/client/errors.d.mts +87 -0
  126. package/dist/client/errors.d.mts.map +1 -0
  127. package/dist/client/errors.mjs +127 -0
  128. package/dist/client/errors.mjs.map +1 -0
  129. package/dist/client/index.cjs +22 -1424
  130. package/dist/client/index.d.cts +8 -692
  131. package/dist/client/index.d.mts +8 -692
  132. package/dist/client/index.mjs +9 -1413
  133. package/dist/index.cjs +30 -2529
  134. package/dist/index.d.cts +12 -143
  135. package/dist/index.d.mts +12 -143
  136. package/dist/index.mjs +13 -2526
  137. package/dist/primitives/Array.cjs +302 -0
  138. package/dist/primitives/Array.d.cts +95 -0
  139. package/dist/primitives/Array.d.cts.map +1 -0
  140. package/dist/primitives/Array.d.mts +95 -0
  141. package/dist/primitives/Array.d.mts.map +1 -0
  142. package/dist/primitives/Array.mjs +301 -0
  143. package/dist/primitives/Array.mjs.map +1 -0
  144. package/dist/primitives/Boolean.cjs +95 -0
  145. package/dist/primitives/Boolean.d.cts +44 -0
  146. package/dist/primitives/Boolean.d.cts.map +1 -0
  147. package/dist/primitives/Boolean.d.mts +44 -0
  148. package/dist/primitives/Boolean.d.mts.map +1 -0
  149. package/dist/primitives/Boolean.mjs +94 -0
  150. package/dist/primitives/Boolean.mjs.map +1 -0
  151. package/dist/primitives/Either.cjs +200 -0
  152. package/dist/primitives/Either.d.cts +113 -0
  153. package/dist/primitives/Either.d.cts.map +1 -0
  154. package/dist/primitives/Either.d.mts +113 -0
  155. package/dist/primitives/Either.d.mts.map +1 -0
  156. package/dist/primitives/Either.mjs +199 -0
  157. package/dist/primitives/Either.mjs.map +1 -0
  158. package/dist/primitives/Lazy.cjs +46 -0
  159. package/dist/primitives/Lazy.d.cts +46 -0
  160. package/dist/primitives/Lazy.d.cts.map +1 -0
  161. package/dist/primitives/Lazy.d.mts +46 -0
  162. package/dist/primitives/Lazy.d.mts.map +1 -0
  163. package/dist/primitives/Lazy.mjs +46 -0
  164. package/dist/primitives/Lazy.mjs.map +1 -0
  165. package/dist/primitives/Literal.cjs +91 -0
  166. package/dist/primitives/Literal.d.cts +46 -0
  167. package/dist/primitives/Literal.d.cts.map +1 -0
  168. package/dist/primitives/Literal.d.mts +46 -0
  169. package/dist/primitives/Literal.d.mts.map +1 -0
  170. package/dist/primitives/Literal.mjs +90 -0
  171. package/dist/primitives/Literal.mjs.map +1 -0
  172. package/dist/primitives/Number.cjs +115 -0
  173. package/dist/primitives/Number.d.cts +54 -0
  174. package/dist/primitives/Number.d.cts.map +1 -0
  175. package/dist/primitives/Number.d.mts +54 -0
  176. package/dist/primitives/Number.d.mts.map +1 -0
  177. package/dist/primitives/Number.mjs +114 -0
  178. package/dist/primitives/Number.mjs.map +1 -0
  179. package/dist/primitives/String.cjs +127 -0
  180. package/dist/primitives/String.d.cts +56 -0
  181. package/dist/primitives/String.d.cts.map +1 -0
  182. package/dist/primitives/String.d.mts +56 -0
  183. package/dist/primitives/String.d.mts.map +1 -0
  184. package/dist/primitives/String.mjs +126 -0
  185. package/dist/primitives/String.mjs.map +1 -0
  186. package/dist/primitives/Struct.cjs +207 -0
  187. package/dist/primitives/Struct.d.cts +96 -0
  188. package/dist/primitives/Struct.d.cts.map +1 -0
  189. package/dist/primitives/Struct.d.mts +97 -0
  190. package/dist/primitives/Struct.d.mts.map +1 -0
  191. package/dist/primitives/Struct.mjs +206 -0
  192. package/dist/primitives/Struct.mjs.map +1 -0
  193. package/dist/primitives/Tree.cjs +575 -0
  194. package/dist/primitives/Tree.d.cts +185 -0
  195. package/dist/primitives/Tree.d.cts.map +1 -0
  196. package/dist/primitives/Tree.d.mts +185 -0
  197. package/dist/primitives/Tree.d.mts.map +1 -0
  198. package/dist/primitives/Tree.mjs +574 -0
  199. package/dist/primitives/Tree.mjs.map +1 -0
  200. package/dist/primitives/TreeNode.cjs +73 -0
  201. package/dist/primitives/TreeNode.d.cts +92 -0
  202. package/dist/primitives/TreeNode.d.cts.map +1 -0
  203. package/dist/primitives/TreeNode.d.mts +93 -0
  204. package/dist/primitives/TreeNode.d.mts.map +1 -0
  205. package/dist/primitives/TreeNode.mjs +72 -0
  206. package/dist/primitives/TreeNode.mjs.map +1 -0
  207. package/dist/primitives/Union.cjs +170 -0
  208. package/dist/primitives/Union.d.cts +81 -0
  209. package/dist/primitives/Union.d.cts.map +1 -0
  210. package/dist/primitives/Union.d.mts +81 -0
  211. package/dist/primitives/Union.d.mts.map +1 -0
  212. package/dist/primitives/Union.mjs +169 -0
  213. package/dist/primitives/Union.mjs.map +1 -0
  214. package/dist/primitives/shared.cjs +60 -0
  215. package/dist/primitives/shared.d.cts +147 -0
  216. package/dist/primitives/shared.d.cts.map +1 -0
  217. package/dist/primitives/shared.d.mts +147 -0
  218. package/dist/primitives/shared.d.mts.map +1 -0
  219. package/dist/primitives/shared.mjs +58 -0
  220. package/dist/primitives/shared.mjs.map +1 -0
  221. package/dist/server/ServerDocument.cjs +110 -0
  222. package/dist/server/ServerDocument.d.cts +98 -0
  223. package/dist/server/ServerDocument.d.cts.map +1 -0
  224. package/dist/server/ServerDocument.d.mts +99 -0
  225. package/dist/server/ServerDocument.d.mts.map +1 -0
  226. package/dist/server/ServerDocument.mjs +106 -0
  227. package/dist/server/ServerDocument.mjs.map +1 -0
  228. package/dist/server/errors.cjs +85 -0
  229. package/dist/server/errors.d.cts +53 -0
  230. package/dist/server/errors.d.cts.map +1 -0
  231. package/dist/server/errors.d.mts +53 -0
  232. package/dist/server/errors.d.mts.map +1 -0
  233. package/dist/server/errors.mjs +81 -0
  234. package/dist/server/errors.mjs.map +1 -0
  235. package/dist/server/index.cjs +9 -185
  236. package/dist/server/index.d.cts +3 -148
  237. package/dist/server/index.d.mts +3 -148
  238. package/dist/server/index.mjs +3 -181
  239. package/dist/types/index.cjs +16 -0
  240. package/dist/types/index.d.cts +16 -0
  241. package/dist/types/index.d.cts.map +1 -0
  242. package/dist/types/index.d.mts +16 -0
  243. package/dist/types/index.d.mts.map +1 -0
  244. package/dist/types/index.mjs +12 -0
  245. package/dist/types/index.mjs.map +1 -0
  246. package/dist/utils/tree-helpers.cjs +443 -0
  247. package/dist/utils/tree-helpers.d.cts +280 -0
  248. package/dist/utils/tree-helpers.d.cts.map +1 -0
  249. package/dist/utils/tree-helpers.d.mts +280 -0
  250. package/dist/utils/tree-helpers.d.mts.map +1 -0
  251. package/dist/utils/tree-helpers.mjs +439 -0
  252. package/dist/utils/tree-helpers.mjs.map +1 -0
  253. package/package.json +2 -2
  254. package/src/index.ts +2 -0
  255. package/src/primitives/shared.ts +7 -1
  256. package/src/types/index.ts +137 -0
  257. package/src/utils/index.ts +7 -0
  258. package/src/utils/tree-helpers.ts +648 -0
  259. package/tsdown.config.ts +1 -1
  260. package/dist/Document-ChuFrTk1.cjs +0 -571
  261. package/dist/Document-CwiAFTIq.mjs +0 -438
  262. package/dist/Document-CwiAFTIq.mjs.map +0 -1
  263. package/dist/Presence-DKKP4v5X.d.cts.map +0 -1
  264. package/dist/Presence-DdMVKcOv.mjs.map +0 -1
  265. package/dist/Presence-N8u7Eppr.d.mts.map +0 -1
  266. package/dist/Primitive-CvFVxR8_.d.cts +0 -1175
  267. package/dist/Primitive-CvFVxR8_.d.cts.map +0 -1
  268. package/dist/Primitive-lEhQyGVL.d.mts +0 -1175
  269. package/dist/Primitive-lEhQyGVL.d.mts.map +0 -1
  270. package/dist/client/index.d.cts.map +0 -1
  271. package/dist/client/index.d.mts.map +0 -1
  272. package/dist/client/index.mjs.map +0 -1
  273. package/dist/index.d.cts.map +0 -1
  274. package/dist/index.d.mts.map +0 -1
  275. package/dist/index.mjs.map +0 -1
  276. package/dist/server/index.d.cts.map +0 -1
  277. package/dist/server/index.d.mts.map +0 -1
  278. package/dist/server/index.mjs.map +0 -1
@@ -1,31 +1,6 @@
1
- import { t as __export } from "./chunk-CLMFDpHK.mjs";
2
- import { m as _defineProperty } from "./Document-CwiAFTIq.mjs";
1
+ import { __export } from "./_virtual/rolldown_runtime.mjs";
3
2
  import * as Schema from "effect/Schema";
4
3
 
5
- //#region \0@oxc-project+runtime@0.103.0/helpers/objectSpread2.js
6
- function ownKeys(e, r) {
7
- var t = Object.keys(e);
8
- if (Object.getOwnPropertySymbols) {
9
- var o = Object.getOwnPropertySymbols(e);
10
- r && (o = o.filter(function(r$1) {
11
- return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
12
- })), t.push.apply(t, o);
13
- }
14
- return t;
15
- }
16
- function _objectSpread2(e) {
17
- for (var r = 1; r < arguments.length; r++) {
18
- var t = null != arguments[r] ? arguments[r] : {};
19
- r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
20
- _defineProperty(e, r$1, t[r$1]);
21
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
22
- Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
23
- });
24
- }
25
- return e;
26
- }
27
-
28
- //#endregion
29
4
  //#region src/Presence.ts
30
5
  /**
31
6
  * @since 0.0.1
@@ -106,5 +81,5 @@ const isValid = (presence, data) => {
106
81
  };
107
82
 
108
83
  //#endregion
109
- export { validate as n, _objectSpread2 as r, Presence_exports as t };
110
- //# sourceMappingURL=Presence-DdMVKcOv.mjs.map
84
+ export { Presence_exports, validate };
85
+ //# sourceMappingURL=Presence.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Presence.mjs","names":[],"sources":["../src/Presence.ts"],"sourcesContent":["/**\n * @since 0.0.1\n * Presence module for ephemeral per-connection state.\n * Used by both client and server for schema validation.\n */\nimport * as Schema from \"effect/Schema\";\n\n// =============================================================================\n// Presence Types\n// =============================================================================\n\n/**\n * A Presence schema wrapper that holds an Effect Schema for validation.\n * This is used by both client and server to validate presence data.\n */\nexport interface Presence<TData> {\n readonly _tag: \"Presence\";\n /** The Effect Schema used for validation */\n readonly schema: Schema.Schema<TData>;\n /** Branded type marker for inference */\n readonly _Data: TData;\n}\n\n/**\n * Options for creating a Presence instance.\n */\nexport interface PresenceOptions<TData> {\n /** The Effect Schema defining the presence data structure */\n readonly schema: Schema.Schema<TData>;\n}\n\n/**\n * Infer the data type from a Presence instance.\n */\nexport type Infer<P extends Presence<any>> = P[\"_Data\"];\n\n/**\n * Any Presence type (for generic constraints).\n */\nexport type AnyPresence = Presence<any>;\n\n// =============================================================================\n// Presence Entry (for storage/transport)\n// =============================================================================\n\n/**\n * A presence entry as stored/transmitted.\n */\nexport interface PresenceEntry<TData = unknown> {\n /** The presence data */\n readonly data: TData;\n /** Optional user ID from authentication */\n readonly userId?: string;\n}\n\n// =============================================================================\n// Factory Function\n// =============================================================================\n\n/**\n * Creates a new Presence schema wrapper.\n *\n * @example\n * ```typescript\n * import { Presence } from \"@voidhash/mimic\";\n * import { Schema } from \"effect\";\n *\n * const CursorPresence = Presence.make({\n * schema: Schema.Struct({\n * name: Schema.String,\n * cursor: Schema.Struct({\n * x: Schema.Number,\n * y: Schema.Number,\n * }),\n * }),\n * });\n * ```\n */\nexport const make = <TData,>(options: PresenceOptions<TData>): Presence<TData> => ({\n _tag: \"Presence\",\n schema: options.schema,\n _Data: undefined as unknown as TData,\n});\n\n// =============================================================================\n// Validation Functions\n// =============================================================================\n\n/**\n * Validates unknown data against a Presence schema.\n * Throws a ParseError if validation fails.\n *\n * @param presence - The Presence instance with the schema\n * @param data - Unknown data to validate\n * @returns The validated and typed data\n * @throws ParseError if validation fails\n */\nexport const validate = <TData,>(\n presence: Presence<TData>,\n data: unknown\n): TData => {\n return Schema.decodeUnknownSync(presence.schema)(data);\n};\n\n/**\n * Safely validates unknown data against a Presence schema.\n * Returns undefined if validation fails instead of throwing.\n *\n * @param presence - The Presence instance with the schema\n * @param data - Unknown data to validate\n * @returns The validated data or undefined if invalid\n */\nexport const validateSafe = <TData,>(\n presence: Presence<TData>,\n data: unknown\n): TData | undefined => {\n try {\n return Schema.decodeUnknownSync(presence.schema)(data);\n } catch {\n return undefined;\n }\n};\n\n/**\n * Checks if unknown data is valid according to a Presence schema.\n *\n * @param presence - The Presence instance with the schema\n * @param data - Unknown data to check\n * @returns true if valid, false otherwise\n */\nexport const isValid = <TData,>(\n presence: Presence<TData>,\n data: unknown\n): data is TData => {\n try {\n Schema.decodeUnknownSync(presence.schema)(data);\n return true;\n } catch {\n return false;\n }\n};\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,MAAa,QAAgB,aAAsD;CACjF,MAAM;CACN,QAAQ,QAAQ;CAChB,OAAO;CACR;;;;;;;;;;AAeD,MAAa,YACX,UACA,SACU;AACV,QAAO,OAAO,kBAAkB,SAAS,OAAO,CAAC,KAAK;;;;;;;;;;AAWxD,MAAa,gBACX,UACA,SACsB;AACtB,KAAI;AACF,SAAO,OAAO,kBAAkB,SAAS,OAAO,CAAC,KAAK;mBAChD;AACN;;;;;;;;;;AAWJ,MAAa,WACX,UACA,SACkB;AAClB,KAAI;AACF,SAAO,kBAAkB,SAAS,OAAO,CAAC,KAAK;AAC/C,SAAO;oBACD;AACN,SAAO"}
@@ -0,0 +1,52 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ const require_shared = require('./primitives/shared.cjs');
3
+ const require_String = require('./primitives/String.cjs');
4
+ const require_Struct = require('./primitives/Struct.cjs');
5
+ const require_Boolean = require('./primitives/Boolean.cjs');
6
+ const require_Number = require('./primitives/Number.cjs');
7
+ const require_Literal = require('./primitives/Literal.cjs');
8
+ const require_Array = require('./primitives/Array.cjs');
9
+ const require_Lazy = require('./primitives/Lazy.cjs');
10
+ const require_Union = require('./primitives/Union.cjs');
11
+ const require_Either = require('./primitives/Either.cjs');
12
+ const require_TreeNode = require('./primitives/TreeNode.cjs');
13
+ const require_Tree = require('./primitives/Tree.cjs');
14
+
15
+ //#region src/Primitive.ts
16
+ var Primitive_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
17
+ Array: () => require_Array.Array,
18
+ ArrayPrimitive: () => require_Array.ArrayPrimitive,
19
+ Boolean: () => require_Boolean.Boolean,
20
+ BooleanPrimitive: () => require_Boolean.BooleanPrimitive,
21
+ Either: () => require_Either.Either,
22
+ EitherPrimitive: () => require_Either.EitherPrimitive,
23
+ Lazy: () => require_Lazy.Lazy,
24
+ LazyPrimitive: () => require_Lazy.LazyPrimitive,
25
+ Literal: () => require_Literal.Literal,
26
+ LiteralPrimitive: () => require_Literal.LiteralPrimitive,
27
+ Number: () => require_Number.Number,
28
+ NumberPrimitive: () => require_Number.NumberPrimitive,
29
+ String: () => require_String.String,
30
+ StringPrimitive: () => require_String.StringPrimitive,
31
+ Struct: () => require_Struct.Struct,
32
+ StructPrimitive: () => require_Struct.StructPrimitive,
33
+ Tree: () => require_Tree.Tree,
34
+ TreeNode: () => require_TreeNode.TreeNode,
35
+ TreeNodePrimitive: () => require_TreeNode.TreeNodePrimitive,
36
+ TreeNodeSelf: () => require_TreeNode.TreeNodeSelf,
37
+ TreePrimitive: () => require_Tree.TreePrimitive,
38
+ Union: () => require_Union.Union,
39
+ UnionPrimitive: () => require_Union.UnionPrimitive,
40
+ ValidationError: () => require_shared.ValidationError,
41
+ applyDefaults: () => require_shared.applyDefaults,
42
+ isCompatibleOperation: () => require_shared.isCompatibleOperation,
43
+ runValidators: () => require_shared.runValidators
44
+ });
45
+
46
+ //#endregion
47
+ Object.defineProperty(exports, 'Primitive_exports', {
48
+ enumerable: true,
49
+ get: function () {
50
+ return Primitive_exports;
51
+ }
52
+ });
@@ -0,0 +1,20 @@
1
+ import { AnyPrimitive, HasDefault, InferProxy, InferSetInput, InferSnapshot, InferState, InferUpdateInput, IsDefined, IsRequired, MaybeUndefined, NeedsValue, Optional, Primitive, PrimitiveInternal, ValidationError, Validator, applyDefaults, isCompatibleOperation, runValidators } from "./primitives/shared.cjs";
2
+ import { String, StringPrimitive, StringProxy } from "./primitives/String.cjs";
3
+ import { InferStructSnapshot, InferStructState, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue } from "./primitives/Struct.cjs";
4
+ import { Boolean, BooleanPrimitive, BooleanProxy } from "./primitives/Boolean.cjs";
5
+ import { Number, NumberPrimitive, NumberProxy } from "./primitives/Number.cjs";
6
+ import { Literal, LiteralPrimitive, LiteralProxy, LiteralValue } from "./primitives/Literal.cjs";
7
+ import { Array, ArrayElementSetInput, ArrayEntry, ArrayEntrySnapshot, ArrayPrimitive, ArrayProxy, ArraySetInput, ArraySnapshot, ArrayState, ArrayUpdateInput } from "./primitives/Array.cjs";
8
+ import { InferLazyProxy, InferLazySetInput, InferLazySnapshot, InferLazyState, InferLazyUpdateInput, Lazy, LazyPrimitive } from "./primitives/Lazy.cjs";
9
+ import { InferUnionSnapshot, InferUnionState, Union, UnionOptions, UnionPrimitive, UnionProxy, UnionSetInput, UnionVariants } from "./primitives/Union.cjs";
10
+ import { Either, EitherMatchHandlers, EitherPrimitive, EitherProxy, InferEitherSnapshot, InferEitherState, ScalarPrimitive } from "./primitives/Either.cjs";
11
+ import { AnyTreeNodePrimitive, InferTreeNodeChildren, InferTreeNodeDataState, InferTreeNodeType, TreeNode, TreeNodeChildrenInput, TreeNodeConfig, TreeNodePrimitive, TreeNodeSelf, TreeNodeSelfType } from "./primitives/TreeNode.cjs";
12
+ import { InferTreeSnapshot, Tree, TreeNodeDataSetInput, TreeNodeProxyBase, TreeNodeSnapshot, TreeNodeState, TreeNodeUpdateValue, TreeOptions, TreePrimitive, TreeProxy, TreeSetInput, TreeState, TreeUpdateInput, TypedNodeProxy, TypedTreeNodeState } from "./primitives/Tree.cjs";
13
+
14
+ //#region src/Primitive.d.ts
15
+ declare namespace Primitive_d_exports {
16
+ export { AnyPrimitive, AnyTreeNodePrimitive, Array, ArrayElementSetInput, ArrayEntry, ArrayEntrySnapshot, ArrayPrimitive, ArrayProxy, ArraySetInput, ArraySnapshot, ArrayState, ArrayUpdateInput, Boolean, BooleanPrimitive, BooleanProxy, Either, EitherMatchHandlers, EitherPrimitive, EitherProxy, HasDefault, InferEitherSnapshot, InferEitherState, InferLazyProxy, InferLazySetInput, InferLazySnapshot, InferLazyState, InferLazyUpdateInput, InferProxy, InferSetInput, InferSnapshot, InferState, InferStructSnapshot, InferStructState, InferTreeNodeChildren, InferTreeNodeDataState, InferTreeNodeType, InferTreeSnapshot, InferUnionSnapshot, InferUnionState, InferUpdateInput, IsDefined, IsRequired, Lazy, LazyPrimitive, Literal, LiteralPrimitive, LiteralProxy, LiteralValue, MaybeUndefined, NeedsValue, Number, NumberPrimitive, NumberProxy, Optional, Primitive, PrimitiveInternal, ScalarPrimitive, String, StringPrimitive, StringProxy, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue, Tree, TreeNode, TreeNodeChildrenInput, TreeNodeConfig, TreeNodeDataSetInput, TreeNodePrimitive, TreeNodeProxyBase, TreeNodeSelf, TreeNodeSelfType, TreeNodeSnapshot, TreeNodeState, TreeNodeUpdateValue, TreeOptions, TreePrimitive, TreeProxy, TreeSetInput, TreeState, TreeUpdateInput, TypedNodeProxy, TypedTreeNodeState, Union, UnionOptions, UnionPrimitive, UnionProxy, UnionSetInput, UnionVariants, ValidationError, Validator, applyDefaults, isCompatibleOperation, runValidators };
17
+ }
18
+ //#endregion
19
+ export { Primitive_d_exports };
20
+ //# sourceMappingURL=Primitive.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Primitive.d.cts","names":[],"sources":["../src/Primitive.ts"],"sourcesContent":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { AnyPrimitive, HasDefault, InferProxy, InferSetInput, InferSnapshot, InferState, InferUpdateInput, IsDefined, IsRequired, MaybeUndefined, NeedsValue, Optional, Primitive, PrimitiveInternal, ValidationError, Validator, applyDefaults, isCompatibleOperation, runValidators } from "./primitives/shared.mjs";
2
+ import { String, StringPrimitive, StringProxy } from "./primitives/String.mjs";
3
+ import { InferStructSnapshot, InferStructState, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue } from "./primitives/Struct.mjs";
4
+ import { Boolean, BooleanPrimitive, BooleanProxy } from "./primitives/Boolean.mjs";
5
+ import { Number, NumberPrimitive, NumberProxy } from "./primitives/Number.mjs";
6
+ import { Literal, LiteralPrimitive, LiteralProxy, LiteralValue } from "./primitives/Literal.mjs";
7
+ import { Array, ArrayElementSetInput, ArrayEntry, ArrayEntrySnapshot, ArrayPrimitive, ArrayProxy, ArraySetInput, ArraySnapshot, ArrayState, ArrayUpdateInput } from "./primitives/Array.mjs";
8
+ import { InferLazyProxy, InferLazySetInput, InferLazySnapshot, InferLazyState, InferLazyUpdateInput, Lazy, LazyPrimitive } from "./primitives/Lazy.mjs";
9
+ import { InferUnionSnapshot, InferUnionState, Union, UnionOptions, UnionPrimitive, UnionProxy, UnionSetInput, UnionVariants } from "./primitives/Union.mjs";
10
+ import { Either, EitherMatchHandlers, EitherPrimitive, EitherProxy, InferEitherSnapshot, InferEitherState, ScalarPrimitive } from "./primitives/Either.mjs";
11
+ import { AnyTreeNodePrimitive, InferTreeNodeChildren, InferTreeNodeDataState, InferTreeNodeType, TreeNode, TreeNodeChildrenInput, TreeNodeConfig, TreeNodePrimitive, TreeNodeSelf, TreeNodeSelfType } from "./primitives/TreeNode.mjs";
12
+ import { InferTreeSnapshot, Tree, TreeNodeDataSetInput, TreeNodeProxyBase, TreeNodeSnapshot, TreeNodeState, TreeNodeUpdateValue, TreeOptions, TreePrimitive, TreeProxy, TreeSetInput, TreeState, TreeUpdateInput, TypedNodeProxy, TypedTreeNodeState } from "./primitives/Tree.mjs";
13
+
14
+ //#region src/Primitive.d.ts
15
+ declare namespace Primitive_d_exports {
16
+ export { AnyPrimitive, AnyTreeNodePrimitive, Array, ArrayElementSetInput, ArrayEntry, ArrayEntrySnapshot, ArrayPrimitive, ArrayProxy, ArraySetInput, ArraySnapshot, ArrayState, ArrayUpdateInput, Boolean, BooleanPrimitive, BooleanProxy, Either, EitherMatchHandlers, EitherPrimitive, EitherProxy, HasDefault, InferEitherSnapshot, InferEitherState, InferLazyProxy, InferLazySetInput, InferLazySnapshot, InferLazyState, InferLazyUpdateInput, InferProxy, InferSetInput, InferSnapshot, InferState, InferStructSnapshot, InferStructState, InferTreeNodeChildren, InferTreeNodeDataState, InferTreeNodeType, InferTreeSnapshot, InferUnionSnapshot, InferUnionState, InferUpdateInput, IsDefined, IsRequired, Lazy, LazyPrimitive, Literal, LiteralPrimitive, LiteralProxy, LiteralValue, MaybeUndefined, NeedsValue, Number, NumberPrimitive, NumberProxy, Optional, Primitive, PrimitiveInternal, ScalarPrimitive, String, StringPrimitive, StringProxy, Struct, StructPrimitive, StructProxy, StructSetInput, StructUpdateValue, Tree, TreeNode, TreeNodeChildrenInput, TreeNodeConfig, TreeNodeDataSetInput, TreeNodePrimitive, TreeNodeProxyBase, TreeNodeSelf, TreeNodeSelfType, TreeNodeSnapshot, TreeNodeState, TreeNodeUpdateValue, TreeOptions, TreePrimitive, TreeProxy, TreeSetInput, TreeState, TreeUpdateInput, TypedNodeProxy, TypedTreeNodeState, Union, UnionOptions, UnionPrimitive, UnionProxy, UnionSetInput, UnionVariants, ValidationError, Validator, applyDefaults, isCompatibleOperation, runValidators };
17
+ }
18
+ //#endregion
19
+ export { Primitive_d_exports };
20
+ //# sourceMappingURL=Primitive.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Primitive.d.mts","names":[],"sources":["../src/Primitive.ts"],"sourcesContent":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ import { __export } from "./_virtual/rolldown_runtime.mjs";
2
+ import { ValidationError, applyDefaults, isCompatibleOperation, runValidators } from "./primitives/shared.mjs";
3
+ import { String, StringPrimitive } from "./primitives/String.mjs";
4
+ import { Struct, StructPrimitive } from "./primitives/Struct.mjs";
5
+ import { Boolean, BooleanPrimitive } from "./primitives/Boolean.mjs";
6
+ import { Number, NumberPrimitive } from "./primitives/Number.mjs";
7
+ import { Literal, LiteralPrimitive } from "./primitives/Literal.mjs";
8
+ import { Array, ArrayPrimitive } from "./primitives/Array.mjs";
9
+ import { Lazy, LazyPrimitive } from "./primitives/Lazy.mjs";
10
+ import { Union, UnionPrimitive } from "./primitives/Union.mjs";
11
+ import { Either, EitherPrimitive } from "./primitives/Either.mjs";
12
+ import { TreeNode, TreeNodePrimitive, TreeNodeSelf } from "./primitives/TreeNode.mjs";
13
+ import { Tree, TreePrimitive } from "./primitives/Tree.mjs";
14
+
15
+ //#region src/Primitive.ts
16
+ var Primitive_exports = /* @__PURE__ */ __export({
17
+ Array: () => Array,
18
+ ArrayPrimitive: () => ArrayPrimitive,
19
+ Boolean: () => Boolean,
20
+ BooleanPrimitive: () => BooleanPrimitive,
21
+ Either: () => Either,
22
+ EitherPrimitive: () => EitherPrimitive,
23
+ Lazy: () => Lazy,
24
+ LazyPrimitive: () => LazyPrimitive,
25
+ Literal: () => Literal,
26
+ LiteralPrimitive: () => LiteralPrimitive,
27
+ Number: () => Number,
28
+ NumberPrimitive: () => NumberPrimitive,
29
+ String: () => String,
30
+ StringPrimitive: () => StringPrimitive,
31
+ Struct: () => Struct,
32
+ StructPrimitive: () => StructPrimitive,
33
+ Tree: () => Tree,
34
+ TreeNode: () => TreeNode,
35
+ TreeNodePrimitive: () => TreeNodePrimitive,
36
+ TreeNodeSelf: () => TreeNodeSelf,
37
+ TreePrimitive: () => TreePrimitive,
38
+ Union: () => Union,
39
+ UnionPrimitive: () => UnionPrimitive,
40
+ ValidationError: () => ValidationError,
41
+ applyDefaults: () => applyDefaults,
42
+ isCompatibleOperation: () => isCompatibleOperation,
43
+ runValidators: () => runValidators
44
+ });
45
+
46
+ //#endregion
47
+ export { Primitive_exports };
48
+ //# sourceMappingURL=Primitive.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Primitive.mjs","names":[],"sources":["../src/Primitive.ts"],"sourcesContent":["\n// =============================================================================\n// Re-export all primitives from separate files\n// =============================================================================\n\nexport * from \"./primitives/shared\";\n\n// String Primitive\nexport * from \"./primitives/String\";\n// Struct Primitive\nexport * from \"./primitives/Struct\";\n\n// Boolean Primitive\nexport * from \"./primitives/Boolean\";\n\n// Number Primitive\nexport * from \"./primitives/Number\";\n// Literal Primitive\nexport * from \"./primitives/Literal\";\n\n// Array Primitive\nexport * from \"./primitives/Array\";\n// Lazy Primitive\nexport * from \"./primitives/Lazy\";\n\n// Union Primitive\nexport * from \"./primitives/Union\";\n\n// Either Primitive\nexport * from \"./primitives/Either\";\n\n// TreeNode Primitive\nexport * from \"./primitives/TreeNode\";\n// Tree Primitive\nexport * from \"./primitives/Tree\";"],"mappings":""}
@@ -0,0 +1,34 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+
3
+ //#region src/ProxyEnvironment.ts
4
+ var ProxyEnvironment_exports = /* @__PURE__ */ require_rolldown_runtime.__export({ make: () => make });
5
+ /** Default UUID generator using crypto.randomUUID */
6
+ const defaultGenerateId = () => {
7
+ return crypto.randomUUID();
8
+ };
9
+ /** Default state getter that always returns undefined */
10
+ const defaultGetState = (_path) => {};
11
+ /**
12
+ * Creates a ProxyEnvironment.
13
+ * @param optionsOrCallback - Either an options object or a simple callback for operations
14
+ */
15
+ const make = (optionsOrCallback) => {
16
+ var _options$getState, _options$generateId;
17
+ const options = typeof optionsOrCallback === "function" ? { onOperation: optionsOrCallback } : optionsOrCallback;
18
+ return {
19
+ addOperation: (operation) => {
20
+ options.onOperation(operation);
21
+ },
22
+ getState: (_options$getState = options.getState) !== null && _options$getState !== void 0 ? _options$getState : defaultGetState,
23
+ generateId: (_options$generateId = options.generateId) !== null && _options$generateId !== void 0 ? _options$generateId : defaultGenerateId
24
+ };
25
+ };
26
+
27
+ //#endregion
28
+ Object.defineProperty(exports, 'ProxyEnvironment_exports', {
29
+ enumerable: true,
30
+ get: function () {
31
+ return ProxyEnvironment_exports;
32
+ }
33
+ });
34
+ exports.make = make;
@@ -0,0 +1,31 @@
1
+ import { OperationPath } from "./OperationPath.cjs";
2
+ import { Operation } from "./Operation.cjs";
3
+
4
+ //#region src/ProxyEnvironment.d.ts
5
+ declare namespace ProxyEnvironment_d_exports {
6
+ export { ProxyEnvironment, ProxyEnvironmentOptions, make };
7
+ }
8
+ type ProxyEnvironment = {
9
+ /** Adds an operation to be collected/applied */
10
+ readonly addOperation: (operation: Operation<any, any, any>) => void;
11
+ /** Gets the current state at the given path */
12
+ readonly getState: (path: OperationPath) => unknown;
13
+ /** Generates a unique ID (UUID) for array elements */
14
+ readonly generateId: () => string;
15
+ };
16
+ interface ProxyEnvironmentOptions {
17
+ /** Callback when an operation is added */
18
+ readonly onOperation: (operation: Operation<any, any, any>) => void;
19
+ /** Function to retrieve current state at a path (defaults to returning undefined) */
20
+ readonly getState?: (path: OperationPath) => unknown;
21
+ /** Optional: Custom ID generator (defaults to crypto.randomUUID) */
22
+ readonly generateId?: () => string;
23
+ }
24
+ /**
25
+ * Creates a ProxyEnvironment.
26
+ * @param optionsOrCallback - Either an options object or a simple callback for operations
27
+ */
28
+ declare const make: (optionsOrCallback: ProxyEnvironmentOptions | ((operation: Operation<any, any, any>) => void)) => ProxyEnvironment;
29
+ //#endregion
30
+ export { ProxyEnvironment, ProxyEnvironment_d_exports };
31
+ //# sourceMappingURL=ProxyEnvironment.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProxyEnvironment.d.cts","names":[],"sources":["../src/ProxyEnvironment.ts"],"sourcesContent":[],"mappings":";;;;;;;KAGY,gBAAA;;qCAEyB;;4BAET;;;;AAJhB,UASK,uBAAA,CAPoB;EAOpB;EAuBJ,SAgBZ,WAAA,EAAA,CAAA,SAAA,EArCmC,SAqCnC,CAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAA;EAfoB;EAAuC,SAAA,QAAA,CAAA,EAAA,CAAA,IAAA,EApB/B,aAoB+B,EAAA,GAAA,OAAA;EACzD;EAcF,SAAA,UAAA,CAAA,EAAA,GAAA,GAAA,MAAA;;;;;;cAhBY,0BACQ,uCAAuC,uCACzD"}
@@ -0,0 +1,31 @@
1
+ import { OperationPath } from "./OperationPath.mjs";
2
+ import { Operation } from "./Operation.mjs";
3
+
4
+ //#region src/ProxyEnvironment.d.ts
5
+ declare namespace ProxyEnvironment_d_exports {
6
+ export { ProxyEnvironment, ProxyEnvironmentOptions, make };
7
+ }
8
+ type ProxyEnvironment = {
9
+ /** Adds an operation to be collected/applied */
10
+ readonly addOperation: (operation: Operation<any, any, any>) => void;
11
+ /** Gets the current state at the given path */
12
+ readonly getState: (path: OperationPath) => unknown;
13
+ /** Generates a unique ID (UUID) for array elements */
14
+ readonly generateId: () => string;
15
+ };
16
+ interface ProxyEnvironmentOptions {
17
+ /** Callback when an operation is added */
18
+ readonly onOperation: (operation: Operation<any, any, any>) => void;
19
+ /** Function to retrieve current state at a path (defaults to returning undefined) */
20
+ readonly getState?: (path: OperationPath) => unknown;
21
+ /** Optional: Custom ID generator (defaults to crypto.randomUUID) */
22
+ readonly generateId?: () => string;
23
+ }
24
+ /**
25
+ * Creates a ProxyEnvironment.
26
+ * @param optionsOrCallback - Either an options object or a simple callback for operations
27
+ */
28
+ declare const make: (optionsOrCallback: ProxyEnvironmentOptions | ((operation: Operation<any, any, any>) => void)) => ProxyEnvironment;
29
+ //#endregion
30
+ export { ProxyEnvironment, ProxyEnvironment_d_exports };
31
+ //# sourceMappingURL=ProxyEnvironment.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProxyEnvironment.d.mts","names":[],"sources":["../src/ProxyEnvironment.ts"],"sourcesContent":[],"mappings":";;;;;;;KAGY,gBAAA;;qCAEyB;;4BAET;;;;AAJhB,UASK,uBAAA,CAPoB;EAOpB;EAuBJ,SAgBZ,WAAA,EAAA,CAAA,SAAA,EArCmC,SAqCnC,CAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAA;EAfoB;EAAuC,SAAA,QAAA,CAAA,EAAA,CAAA,IAAA,EApB/B,aAoB+B,EAAA,GAAA,OAAA;EACzD;EAcF,SAAA,UAAA,CAAA,EAAA,GAAA,GAAA,MAAA;;;;;;cAhBY,0BACQ,uCAAuC,uCACzD"}
@@ -0,0 +1,29 @@
1
+ import { __export } from "./_virtual/rolldown_runtime.mjs";
2
+
3
+ //#region src/ProxyEnvironment.ts
4
+ var ProxyEnvironment_exports = /* @__PURE__ */ __export({ make: () => make });
5
+ /** Default UUID generator using crypto.randomUUID */
6
+ const defaultGenerateId = () => {
7
+ return crypto.randomUUID();
8
+ };
9
+ /** Default state getter that always returns undefined */
10
+ const defaultGetState = (_path) => {};
11
+ /**
12
+ * Creates a ProxyEnvironment.
13
+ * @param optionsOrCallback - Either an options object or a simple callback for operations
14
+ */
15
+ const make = (optionsOrCallback) => {
16
+ var _options$getState, _options$generateId;
17
+ const options = typeof optionsOrCallback === "function" ? { onOperation: optionsOrCallback } : optionsOrCallback;
18
+ return {
19
+ addOperation: (operation) => {
20
+ options.onOperation(operation);
21
+ },
22
+ getState: (_options$getState = options.getState) !== null && _options$getState !== void 0 ? _options$getState : defaultGetState,
23
+ generateId: (_options$generateId = options.generateId) !== null && _options$generateId !== void 0 ? _options$generateId : defaultGenerateId
24
+ };
25
+ };
26
+
27
+ //#endregion
28
+ export { ProxyEnvironment_exports, make };
29
+ //# sourceMappingURL=ProxyEnvironment.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProxyEnvironment.mjs","names":["options: ProxyEnvironmentOptions"],"sources":["../src/ProxyEnvironment.ts"],"sourcesContent":["import * as Operation from \"./Operation\";\nimport * as OperationPath from \"./OperationPath\";\n\nexport type ProxyEnvironment = {\n /** Adds an operation to be collected/applied */\n readonly addOperation: (operation: Operation.Operation<any, any, any>) => void;\n /** Gets the current state at the given path */\n readonly getState: (path: OperationPath.OperationPath) => unknown;\n /** Generates a unique ID (UUID) for array elements */\n readonly generateId: () => string;\n};\n\nexport interface ProxyEnvironmentOptions {\n /** Callback when an operation is added */\n readonly onOperation: (operation: Operation.Operation<any, any, any>) => void;\n /** Function to retrieve current state at a path (defaults to returning undefined) */\n readonly getState?: (path: OperationPath.OperationPath) => unknown;\n /** Optional: Custom ID generator (defaults to crypto.randomUUID) */\n readonly generateId?: () => string;\n}\n\n/** Default UUID generator using crypto.randomUUID */\nconst defaultGenerateId = (): string => {\n return crypto.randomUUID();\n};\n\n/** Default state getter that always returns undefined */\nconst defaultGetState = (_path: OperationPath.OperationPath): unknown => {\n return undefined;\n};\n\n/**\n * Creates a ProxyEnvironment.\n * @param optionsOrCallback - Either an options object or a simple callback for operations\n */\nexport const make = (\n optionsOrCallback: ProxyEnvironmentOptions | ((operation: Operation.Operation<any, any, any>) => void)\n): ProxyEnvironment => {\n // Support both old callback style and new options object\n const options: ProxyEnvironmentOptions =\n typeof optionsOrCallback === \"function\"\n ? { onOperation: optionsOrCallback }\n : optionsOrCallback;\n\n return {\n addOperation: (operation: Operation.Operation<any, any, any>) => {\n options.onOperation(operation);\n },\n getState: options.getState ?? defaultGetState,\n generateId: options.generateId ?? defaultGenerateId,\n };\n};\n"],"mappings":";;;;;AAsBA,MAAM,0BAAkC;AACtC,QAAO,OAAO,YAAY;;;AAI5B,MAAM,mBAAmB,UAAgD;;;;;AAQzE,MAAa,QACX,sBACqB;;CAErB,MAAMA,UACJ,OAAO,sBAAsB,aACzB,EAAE,aAAa,mBAAmB,GAClC;AAEN,QAAO;EACL,eAAe,cAAkD;AAC/D,WAAQ,YAAY,UAAU;;EAEhC,+BAAU,QAAQ,yEAAY;EAC9B,mCAAY,QAAQ,+EAAc;EACnC"}
@@ -0,0 +1,66 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ const require_Operation = require('./Operation.cjs');
3
+
4
+ //#region src/Transaction.ts
5
+ var Transaction_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
6
+ decode: () => decode,
7
+ empty: () => empty,
8
+ encode: () => encode,
9
+ isEmpty: () => isEmpty,
10
+ make: () => make,
11
+ merge: () => merge
12
+ });
13
+ /**
14
+ * Creates a new Transaction with the given operations.
15
+ */
16
+ const make = (ops) => ({
17
+ id: crypto.randomUUID(),
18
+ ops,
19
+ timestamp: Date.now()
20
+ });
21
+ /**
22
+ * Creates an empty Transaction.
23
+ */
24
+ const empty = () => make([]);
25
+ /**
26
+ * Checks if a transaction is empty (has no operations).
27
+ */
28
+ const isEmpty = (tx) => tx.ops.length === 0;
29
+ /**
30
+ * Merges multiple transactions into one.
31
+ */
32
+ const merge = (txs) => {
33
+ return make(txs.flatMap((tx) => tx.ops));
34
+ };
35
+ /**
36
+ * Encodes a Transaction to a JSON-serializable format for network transport.
37
+ * @param transaction - The transaction to encode.
38
+ * @returns The encoded representation.
39
+ */
40
+ const encode = (transaction) => ({
41
+ id: transaction.id,
42
+ ops: transaction.ops.map(require_Operation.encode),
43
+ timestamp: transaction.timestamp
44
+ });
45
+ /**
46
+ * Decodes an encoded transaction back to a Transaction.
47
+ * @param encoded - The encoded representation.
48
+ * @returns The decoded Transaction.
49
+ */
50
+ const decode = (encoded) => ({
51
+ id: encoded.id,
52
+ ops: encoded.ops.map(require_Operation.decode),
53
+ timestamp: encoded.timestamp
54
+ });
55
+
56
+ //#endregion
57
+ Object.defineProperty(exports, 'Transaction_exports', {
58
+ enumerable: true,
59
+ get: function () {
60
+ return Transaction_exports;
61
+ }
62
+ });
63
+ exports.decode = decode;
64
+ exports.encode = encode;
65
+ exports.isEmpty = isEmpty;
66
+ exports.make = make;
@@ -0,0 +1,56 @@
1
+ import { EncodedOperation, Operation } from "./Operation.cjs";
2
+
3
+ //#region src/Transaction.d.ts
4
+ declare namespace Transaction_d_exports {
5
+ export { EncodedTransaction, Transaction, decode, empty, encode, isEmpty, make, merge };
6
+ }
7
+ /**
8
+ * A Transaction represents a group of operations that were applied atomically.
9
+ */
10
+ interface Transaction {
11
+ /** Unique identifier for this transaction */
12
+ readonly id: string;
13
+ /** Operations contained in this transaction */
14
+ readonly ops: ReadonlyArray<Operation<any, any, any>>;
15
+ /** Timestamp when the transaction was created */
16
+ readonly timestamp: number;
17
+ }
18
+ /**
19
+ * Creates a new Transaction with the given operations.
20
+ */
21
+ declare const make: (ops: ReadonlyArray<Operation<any, any, any>>) => Transaction;
22
+ /**
23
+ * Creates an empty Transaction.
24
+ */
25
+ declare const empty: () => Transaction;
26
+ /**
27
+ * Checks if a transaction is empty (has no operations).
28
+ */
29
+ declare const isEmpty: (tx: Transaction) => boolean;
30
+ /**
31
+ * Merges multiple transactions into one.
32
+ */
33
+ declare const merge: (txs: ReadonlyArray<Transaction>) => Transaction;
34
+ /**
35
+ * Encoded representation of a Transaction for network transport.
36
+ */
37
+ interface EncodedTransaction {
38
+ readonly id: string;
39
+ readonly ops: ReadonlyArray<EncodedOperation>;
40
+ readonly timestamp: number;
41
+ }
42
+ /**
43
+ * Encodes a Transaction to a JSON-serializable format for network transport.
44
+ * @param transaction - The transaction to encode.
45
+ * @returns The encoded representation.
46
+ */
47
+ declare const encode: (transaction: Transaction) => EncodedTransaction;
48
+ /**
49
+ * Decodes an encoded transaction back to a Transaction.
50
+ * @param encoded - The encoded representation.
51
+ * @returns The decoded Transaction.
52
+ */
53
+ declare const decode: (encoded: EncodedTransaction) => Transaction;
54
+ //#endregion
55
+ export { EncodedTransaction, Transaction, Transaction_d_exports };
56
+ //# sourceMappingURL=Transaction.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transaction.d.cts","names":[],"sources":["../src/Transaction.ts"],"sourcesContent":[],"mappings":";;;;;;;;;UAKiB,WAAA;;;;gBAID,cAAc;;;;;;AAJ9B;AAYa,cAAA,IAIX,EAAA,CAAA,GAAA,EAJwB,aAIxB,CAJsC,SAItC,CAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA,CAAA,EAAA,GAJ4E,WAI5E;;;;AAAA,cAKW,KALX,EAAA,GAAA,GAKuB,WALvB;AAKF;AAKA;AAKA;AAAyC,cAL5B,OAK4B,EAAA,CAAA,EAAA,EALb,WAKa,EAAA,GAAA,OAAA;;;;AASxB,cATJ,KASsB,EAAA,CAAA,GAAA,EATR,aAWG,CAXW,WAWzB,CAAA,EAAA,GAXwC,WAW3B;AAS7B;AAWA;;UAtBiB,kBAAA;;gBAED,cAAc;;;;;;;;cASjB,sBAAuB,gBAAc;;;;;;cAWrC,kBAAmB,uBAAqB"}
@@ -0,0 +1,56 @@
1
+ import { EncodedOperation, Operation } from "./Operation.mjs";
2
+
3
+ //#region src/Transaction.d.ts
4
+ declare namespace Transaction_d_exports {
5
+ export { EncodedTransaction, Transaction, decode, empty, encode, isEmpty, make, merge };
6
+ }
7
+ /**
8
+ * A Transaction represents a group of operations that were applied atomically.
9
+ */
10
+ interface Transaction {
11
+ /** Unique identifier for this transaction */
12
+ readonly id: string;
13
+ /** Operations contained in this transaction */
14
+ readonly ops: ReadonlyArray<Operation<any, any, any>>;
15
+ /** Timestamp when the transaction was created */
16
+ readonly timestamp: number;
17
+ }
18
+ /**
19
+ * Creates a new Transaction with the given operations.
20
+ */
21
+ declare const make: (ops: ReadonlyArray<Operation<any, any, any>>) => Transaction;
22
+ /**
23
+ * Creates an empty Transaction.
24
+ */
25
+ declare const empty: () => Transaction;
26
+ /**
27
+ * Checks if a transaction is empty (has no operations).
28
+ */
29
+ declare const isEmpty: (tx: Transaction) => boolean;
30
+ /**
31
+ * Merges multiple transactions into one.
32
+ */
33
+ declare const merge: (txs: ReadonlyArray<Transaction>) => Transaction;
34
+ /**
35
+ * Encoded representation of a Transaction for network transport.
36
+ */
37
+ interface EncodedTransaction {
38
+ readonly id: string;
39
+ readonly ops: ReadonlyArray<EncodedOperation>;
40
+ readonly timestamp: number;
41
+ }
42
+ /**
43
+ * Encodes a Transaction to a JSON-serializable format for network transport.
44
+ * @param transaction - The transaction to encode.
45
+ * @returns The encoded representation.
46
+ */
47
+ declare const encode: (transaction: Transaction) => EncodedTransaction;
48
+ /**
49
+ * Decodes an encoded transaction back to a Transaction.
50
+ * @param encoded - The encoded representation.
51
+ * @returns The decoded Transaction.
52
+ */
53
+ declare const decode: (encoded: EncodedTransaction) => Transaction;
54
+ //#endregion
55
+ export { EncodedTransaction, Transaction, Transaction_d_exports };
56
+ //# sourceMappingURL=Transaction.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transaction.d.mts","names":[],"sources":["../src/Transaction.ts"],"sourcesContent":[],"mappings":";;;;;;;;;UAKiB,WAAA;;;;gBAID,cAAc;;;;;;AAJ9B;AAYa,cAAA,IAIX,EAAA,CAAA,GAAA,EAJwB,aAIxB,CAJsC,SAItC,CAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA,CAAA,EAAA,GAJ4E,WAI5E;;;;AAAA,cAKW,KALX,EAAA,GAAA,GAKuB,WALvB;AAKF;AAKA;AAKA;AAAyC,cAL5B,OAK4B,EAAA,CAAA,EAAA,EALb,WAKa,EAAA,GAAA,OAAA;;;;AASxB,cATJ,KASsB,EAAA,CAAA,GAAA,EATR,aAWG,CAXW,WAWzB,CAAA,EAAA,GAXwC,WAW3B;AAS7B;AAWA;;UAtBiB,kBAAA;;gBAED,cAAc;;;;;;;;cASjB,sBAAuB,gBAAc;;;;;;cAWrC,kBAAmB,uBAAqB"}
@@ -0,0 +1,58 @@
1
+ import { __export } from "./_virtual/rolldown_runtime.mjs";
2
+ import { decode as decode$1, encode as encode$1 } from "./Operation.mjs";
3
+
4
+ //#region src/Transaction.ts
5
+ var Transaction_exports = /* @__PURE__ */ __export({
6
+ decode: () => decode,
7
+ empty: () => empty,
8
+ encode: () => encode,
9
+ isEmpty: () => isEmpty,
10
+ make: () => make,
11
+ merge: () => merge
12
+ });
13
+ /**
14
+ * Creates a new Transaction with the given operations.
15
+ */
16
+ const make = (ops) => ({
17
+ id: crypto.randomUUID(),
18
+ ops,
19
+ timestamp: Date.now()
20
+ });
21
+ /**
22
+ * Creates an empty Transaction.
23
+ */
24
+ const empty = () => make([]);
25
+ /**
26
+ * Checks if a transaction is empty (has no operations).
27
+ */
28
+ const isEmpty = (tx) => tx.ops.length === 0;
29
+ /**
30
+ * Merges multiple transactions into one.
31
+ */
32
+ const merge = (txs) => {
33
+ return make(txs.flatMap((tx) => tx.ops));
34
+ };
35
+ /**
36
+ * Encodes a Transaction to a JSON-serializable format for network transport.
37
+ * @param transaction - The transaction to encode.
38
+ * @returns The encoded representation.
39
+ */
40
+ const encode = (transaction) => ({
41
+ id: transaction.id,
42
+ ops: transaction.ops.map(encode$1),
43
+ timestamp: transaction.timestamp
44
+ });
45
+ /**
46
+ * Decodes an encoded transaction back to a Transaction.
47
+ * @param encoded - The encoded representation.
48
+ * @returns The decoded Transaction.
49
+ */
50
+ const decode = (encoded) => ({
51
+ id: encoded.id,
52
+ ops: encoded.ops.map(decode$1),
53
+ timestamp: encoded.timestamp
54
+ });
55
+
56
+ //#endregion
57
+ export { Transaction_exports, decode, encode, isEmpty, make };
58
+ //# sourceMappingURL=Transaction.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transaction.mjs","names":["Operation.encode","Operation.decode"],"sources":["../src/Transaction.ts"],"sourcesContent":["import * as Operation from \"./Operation\";\n\n/**\n * A Transaction represents a group of operations that were applied atomically.\n */\nexport interface Transaction {\n /** Unique identifier for this transaction */\n readonly id: string;\n /** Operations contained in this transaction */\n readonly ops: ReadonlyArray<Operation.Operation<any, any, any>>;\n /** Timestamp when the transaction was created */\n readonly timestamp: number;\n}\n\n/**\n * Creates a new Transaction with the given operations.\n */\nexport const make = (ops: ReadonlyArray<Operation.Operation<any, any, any>>): Transaction => ({\n id: crypto.randomUUID(),\n ops,\n timestamp: Date.now(),\n});\n\n/**\n * Creates an empty Transaction.\n */\nexport const empty = (): Transaction => make([]);\n\n/**\n * Checks if a transaction is empty (has no operations).\n */\nexport const isEmpty = (tx: Transaction): boolean => tx.ops.length === 0;\n\n/**\n * Merges multiple transactions into one.\n */\nexport const merge = (txs: ReadonlyArray<Transaction>): Transaction => {\n const allOps = txs.flatMap(tx => tx.ops);\n return make(allOps);\n};\n\n\n/**\n * Encoded representation of a Transaction for network transport.\n */\nexport interface EncodedTransaction {\n readonly id: string;\n readonly ops: ReadonlyArray<Operation.EncodedOperation>;\n readonly timestamp: number;\n}\n\n/**\n * Encodes a Transaction to a JSON-serializable format for network transport.\n * @param transaction - The transaction to encode.\n * @returns The encoded representation.\n */\nexport const encode = (transaction: Transaction): EncodedTransaction => ({\n id: transaction.id,\n ops: transaction.ops.map(Operation.encode),\n timestamp: transaction.timestamp,\n});\n\n/**\n * Decodes an encoded transaction back to a Transaction.\n * @param encoded - The encoded representation.\n * @returns The decoded Transaction.\n */\nexport const decode = (encoded: EncodedTransaction): Transaction => ({\n id: encoded.id,\n ops: encoded.ops.map(Operation.decode),\n timestamp: encoded.timestamp,\n});\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAa,QAAQ,SAAyE;CAC5F,IAAI,OAAO,YAAY;CACvB;CACA,WAAW,KAAK,KAAK;CACtB;;;;AAKD,MAAa,cAA2B,KAAK,EAAE,CAAC;;;;AAKhD,MAAa,WAAW,OAA6B,GAAG,IAAI,WAAW;;;;AAKvE,MAAa,SAAS,QAAiD;AAErE,QAAO,KADQ,IAAI,SAAQ,OAAM,GAAG,IAAI,CACrB;;;;;;;AAkBrB,MAAa,UAAU,iBAAkD;CACvE,IAAI,YAAY;CAChB,KAAK,YAAY,IAAI,IAAIA,SAAiB;CAC1C,WAAW,YAAY;CACxB;;;;;;AAOD,MAAa,UAAU,aAA8C;CACnE,IAAI,QAAQ;CACZ,KAAK,QAAQ,IAAI,IAAIC,SAAiB;CACtC,WAAW,QAAQ;CACpB"}
@@ -0,0 +1,11 @@
1
+
2
+ //#region src/Transform.ts
3
+ var Transform_exports = {};
4
+
5
+ //#endregion
6
+ Object.defineProperty(exports, 'Transform_exports', {
7
+ enumerable: true,
8
+ get: function () {
9
+ return Transform_exports;
10
+ }
11
+ });