@vibesdotdev/storage 0.0.1

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 (423) hide show
  1. package/README.md +75 -0
  2. package/SPEC.md +60 -0
  3. package/dist/adapters/index.d.ts +14 -0
  4. package/dist/adapters/index.d.ts.map +1 -0
  5. package/dist/adapters/index.js +15 -0
  6. package/dist/adapters/index.js.map +1 -0
  7. package/dist/bridge/index.d.ts +3 -0
  8. package/dist/bridge/index.d.ts.map +1 -0
  9. package/dist/bridge/index.js +2 -0
  10. package/dist/bridge/index.js.map +1 -0
  11. package/dist/bridge/storage-kind-bridge.d.ts +27 -0
  12. package/dist/bridge/storage-kind-bridge.d.ts.map +1 -0
  13. package/dist/bridge/storage-kind-bridge.js +110 -0
  14. package/dist/bridge/storage-kind-bridge.js.map +1 -0
  15. package/dist/bridge/types.d.ts +45 -0
  16. package/dist/bridge/types.d.ts.map +1 -0
  17. package/dist/bridge/types.js +8 -0
  18. package/dist/bridge/types.js.map +1 -0
  19. package/dist/cli/commands/list/storage.list.cli-command.descriptor.d.ts +4 -0
  20. package/dist/cli/commands/list/storage.list.cli-command.descriptor.d.ts.map +1 -0
  21. package/dist/cli/commands/list/storage.list.cli-command.descriptor.js +18 -0
  22. package/dist/cli/commands/list/storage.list.cli-command.descriptor.js.map +1 -0
  23. package/dist/cli/commands/list/storage.list.cli-command.impl.d.ts +11 -0
  24. package/dist/cli/commands/list/storage.list.cli-command.impl.d.ts.map +1 -0
  25. package/dist/cli/commands/list/storage.list.cli-command.impl.js +48 -0
  26. package/dist/cli/commands/list/storage.list.cli-command.impl.js.map +1 -0
  27. package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.d.ts +4 -0
  28. package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.d.ts.map +1 -0
  29. package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.js +26 -0
  30. package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.js.map +1 -0
  31. package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.d.ts +13 -0
  32. package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.d.ts.map +1 -0
  33. package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.js +136 -0
  34. package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.js.map +1 -0
  35. package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.d.ts +4 -0
  36. package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.d.ts.map +1 -0
  37. package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.js +26 -0
  38. package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.js.map +1 -0
  39. package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.d.ts +13 -0
  40. package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.d.ts.map +1 -0
  41. package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.js +165 -0
  42. package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.js.map +1 -0
  43. package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.d.ts +4 -0
  44. package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.d.ts.map +1 -0
  45. package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.js +20 -0
  46. package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.js.map +1 -0
  47. package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.d.ts +12 -0
  48. package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.d.ts.map +1 -0
  49. package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.js +95 -0
  50. package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.js.map +1 -0
  51. package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.d.ts +4 -0
  52. package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.d.ts.map +1 -0
  53. package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.js +15 -0
  54. package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.js.map +1 -0
  55. package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.d.ts +13 -0
  56. package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.d.ts.map +1 -0
  57. package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.js +150 -0
  58. package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.js.map +1 -0
  59. package/dist/cli/context.consumer.d.ts +26 -0
  60. package/dist/cli/context.consumer.d.ts.map +1 -0
  61. package/dist/cli/context.consumer.js +164 -0
  62. package/dist/cli/context.consumer.js.map +1 -0
  63. package/dist/cli/storage.cli-group.descriptor.d.ts +4 -0
  64. package/dist/cli/storage.cli-group.descriptor.d.ts.map +1 -0
  65. package/dist/cli/storage.cli-group.descriptor.js +11 -0
  66. package/dist/cli/storage.cli-group.descriptor.js.map +1 -0
  67. package/dist/cli/storage.sync.cli-group.descriptor.d.ts +4 -0
  68. package/dist/cli/storage.sync.cli-group.descriptor.d.ts.map +1 -0
  69. package/dist/cli/storage.sync.cli-group.descriptor.js +12 -0
  70. package/dist/cli/storage.sync.cli-group.descriptor.js.map +1 -0
  71. package/dist/cli/types.d.ts +26 -0
  72. package/dist/cli/types.d.ts.map +1 -0
  73. package/dist/cli/types.js +11 -0
  74. package/dist/cli/types.js.map +1 -0
  75. package/dist/client/index.d.ts +10 -0
  76. package/dist/client/index.d.ts.map +1 -0
  77. package/dist/client/index.js +10 -0
  78. package/dist/client/index.js.map +1 -0
  79. package/dist/client/list-browsable-adapters.d.ts +31 -0
  80. package/dist/client/list-browsable-adapters.d.ts.map +1 -0
  81. package/dist/client/list-browsable-adapters.js +40 -0
  82. package/dist/client/list-browsable-adapters.js.map +1 -0
  83. package/dist/daemon/commands/sync.d.ts +23 -0
  84. package/dist/daemon/commands/sync.d.ts.map +1 -0
  85. package/dist/daemon/commands/sync.js +169 -0
  86. package/dist/daemon/commands/sync.js.map +1 -0
  87. package/dist/docs/adapters.docs.descriptor.d.ts +4 -0
  88. package/dist/docs/adapters.docs.descriptor.d.ts.map +1 -0
  89. package/dist/docs/adapters.docs.descriptor.js +223 -0
  90. package/dist/docs/adapters.docs.descriptor.js.map +1 -0
  91. package/dist/docs/manifests.docs.descriptor.d.ts +4 -0
  92. package/dist/docs/manifests.docs.descriptor.d.ts.map +1 -0
  93. package/dist/docs/manifests.docs.descriptor.js +316 -0
  94. package/dist/docs/manifests.docs.descriptor.js.map +1 -0
  95. package/dist/docs/records.docs.descriptor.d.ts +4 -0
  96. package/dist/docs/records.docs.descriptor.d.ts.map +1 -0
  97. package/dist/docs/records.docs.descriptor.js +269 -0
  98. package/dist/docs/records.docs.descriptor.js.map +1 -0
  99. package/dist/docs/sync.docs.descriptor.d.ts +4 -0
  100. package/dist/docs/sync.docs.descriptor.d.ts.map +1 -0
  101. package/dist/docs/sync.docs.descriptor.js +279 -0
  102. package/dist/docs/sync.docs.descriptor.js.map +1 -0
  103. package/dist/index.d.ts +27 -0
  104. package/dist/index.d.ts.map +1 -0
  105. package/dist/index.js +29 -0
  106. package/dist/index.js.map +1 -0
  107. package/dist/interfaces/adapter.d.ts +382 -0
  108. package/dist/interfaces/adapter.d.ts.map +1 -0
  109. package/dist/interfaces/adapter.js +11 -0
  110. package/dist/interfaces/adapter.js.map +1 -0
  111. package/dist/interfaces/document-store.d.ts +62 -0
  112. package/dist/interfaces/document-store.d.ts.map +1 -0
  113. package/dist/interfaces/document-store.js +8 -0
  114. package/dist/interfaces/document-store.js.map +1 -0
  115. package/dist/interfaces/index.d.ts +17 -0
  116. package/dist/interfaces/index.d.ts.map +1 -0
  117. package/dist/interfaces/index.js +24 -0
  118. package/dist/interfaces/index.js.map +1 -0
  119. package/dist/interfaces/key-value.d.ts +95 -0
  120. package/dist/interfaces/key-value.d.ts.map +1 -0
  121. package/dist/interfaces/key-value.js +8 -0
  122. package/dist/interfaces/key-value.js.map +1 -0
  123. package/dist/interfaces/query-builder.d.ts +31 -0
  124. package/dist/interfaces/query-builder.d.ts.map +1 -0
  125. package/dist/interfaces/query-builder.js +11 -0
  126. package/dist/interfaces/query-builder.js.map +1 -0
  127. package/dist/interfaces/record/index.d.ts +7 -0
  128. package/dist/interfaces/record/index.d.ts.map +1 -0
  129. package/dist/interfaces/record/index.js +7 -0
  130. package/dist/interfaces/record/index.js.map +1 -0
  131. package/dist/interfaces/record/interface.d.ts +593 -0
  132. package/dist/interfaces/record/interface.d.ts.map +1 -0
  133. package/dist/interfaces/record/interface.js +49 -0
  134. package/dist/interfaces/record/interface.js.map +1 -0
  135. package/dist/interfaces/repository.d.ts +262 -0
  136. package/dist/interfaces/repository.d.ts.map +1 -0
  137. package/dist/interfaces/repository.js +8 -0
  138. package/dist/interfaces/repository.js.map +1 -0
  139. package/dist/interfaces/schema/index.d.ts +8 -0
  140. package/dist/interfaces/schema/index.d.ts.map +1 -0
  141. package/dist/interfaces/schema/index.js +10 -0
  142. package/dist/interfaces/schema/index.js.map +1 -0
  143. package/dist/interfaces/schema/schema-interface.d.ts +516 -0
  144. package/dist/interfaces/schema/schema-interface.d.ts.map +1 -0
  145. package/dist/interfaces/schema/schema-interface.js +31 -0
  146. package/dist/interfaces/schema/schema-interface.js.map +1 -0
  147. package/dist/interfaces/schema/table-interface.d.ts +250 -0
  148. package/dist/interfaces/schema/table-interface.d.ts.map +1 -0
  149. package/dist/interfaces/schema/table-interface.js +31 -0
  150. package/dist/interfaces/schema/table-interface.js.map +1 -0
  151. package/dist/interfaces/storage-consumer-fs.d.ts +40 -0
  152. package/dist/interfaces/storage-consumer-fs.d.ts.map +1 -0
  153. package/dist/interfaces/storage-consumer-fs.js +42 -0
  154. package/dist/interfaces/storage-consumer-fs.js.map +1 -0
  155. package/dist/manifest/base.d.ts +187 -0
  156. package/dist/manifest/base.d.ts.map +1 -0
  157. package/dist/manifest/base.js +516 -0
  158. package/dist/manifest/base.js.map +1 -0
  159. package/dist/manifest/cloud-sync.consumer.d.ts +7 -0
  160. package/dist/manifest/cloud-sync.consumer.d.ts.map +1 -0
  161. package/dist/manifest/cloud-sync.consumer.js +82 -0
  162. package/dist/manifest/cloud-sync.consumer.js.map +1 -0
  163. package/dist/manifest/index.d.ts +7 -0
  164. package/dist/manifest/index.d.ts.map +1 -0
  165. package/dist/manifest/index.js +7 -0
  166. package/dist/manifest/index.js.map +1 -0
  167. package/dist/manifest/source-policy.d.ts +8 -0
  168. package/dist/manifest/source-policy.d.ts.map +1 -0
  169. package/dist/manifest/source-policy.js +62 -0
  170. package/dist/manifest/source-policy.js.map +1 -0
  171. package/dist/paths.d.ts +6 -0
  172. package/dist/paths.d.ts.map +1 -0
  173. package/dist/paths.js +152 -0
  174. package/dist/paths.js.map +1 -0
  175. package/dist/policy/context.d.ts +9 -0
  176. package/dist/policy/context.d.ts.map +1 -0
  177. package/dist/policy/context.js +29 -0
  178. package/dist/policy/context.js.map +1 -0
  179. package/dist/policy/index.d.ts +4 -0
  180. package/dist/policy/index.d.ts.map +1 -0
  181. package/dist/policy/index.js +4 -0
  182. package/dist/policy/index.js.map +1 -0
  183. package/dist/policy/overrides.d.ts +40 -0
  184. package/dist/policy/overrides.d.ts.map +1 -0
  185. package/dist/policy/overrides.js +37 -0
  186. package/dist/policy/overrides.js.map +1 -0
  187. package/dist/policy/persistence.d.ts +38 -0
  188. package/dist/policy/persistence.d.ts.map +1 -0
  189. package/dist/policy/persistence.js +65 -0
  190. package/dist/policy/persistence.js.map +1 -0
  191. package/dist/policy/types.d.ts +21 -0
  192. package/dist/policy/types.d.ts.map +1 -0
  193. package/dist/policy/types.js +7 -0
  194. package/dist/policy/types.js.map +1 -0
  195. package/dist/record/base.d.ts +186 -0
  196. package/dist/record/base.d.ts.map +1 -0
  197. package/dist/record/base.js +1437 -0
  198. package/dist/record/base.js.map +1 -0
  199. package/dist/record/events.d.ts +71 -0
  200. package/dist/record/events.d.ts.map +1 -0
  201. package/dist/record/events.js +52 -0
  202. package/dist/record/events.js.map +1 -0
  203. package/dist/record/extensions.d.ts +51 -0
  204. package/dist/record/extensions.d.ts.map +1 -0
  205. package/dist/record/extensions.js +222 -0
  206. package/dist/record/extensions.js.map +1 -0
  207. package/dist/record/index.d.ts +7 -0
  208. package/dist/record/index.d.ts.map +1 -0
  209. package/dist/record/index.js +7 -0
  210. package/dist/record/index.js.map +1 -0
  211. package/dist/resolver/storage-backed-resolver.d.ts +23 -0
  212. package/dist/resolver/storage-backed-resolver.d.ts.map +1 -0
  213. package/dist/resolver/storage-backed-resolver.js +187 -0
  214. package/dist/resolver/storage-backed-resolver.js.map +1 -0
  215. package/dist/schemas/adapter-descriptor.d.ts +108 -0
  216. package/dist/schemas/adapter-descriptor.d.ts.map +1 -0
  217. package/dist/schemas/adapter-descriptor.js +101 -0
  218. package/dist/schemas/adapter-descriptor.js.map +1 -0
  219. package/dist/schemas/index.d.ts +14 -0
  220. package/dist/schemas/index.d.ts.map +1 -0
  221. package/dist/schemas/index.js +12 -0
  222. package/dist/schemas/index.js.map +1 -0
  223. package/dist/schemas/manifest-descriptor.d.ts +110 -0
  224. package/dist/schemas/manifest-descriptor.d.ts.map +1 -0
  225. package/dist/schemas/manifest-descriptor.js +114 -0
  226. package/dist/schemas/manifest-descriptor.js.map +1 -0
  227. package/dist/schemas/record/descriptor.d.ts +570 -0
  228. package/dist/schemas/record/descriptor.d.ts.map +1 -0
  229. package/dist/schemas/record/descriptor.js +389 -0
  230. package/dist/schemas/record/descriptor.js.map +1 -0
  231. package/dist/schemas/record/index.d.ts +8 -0
  232. package/dist/schemas/record/index.d.ts.map +1 -0
  233. package/dist/schemas/record/index.js +7 -0
  234. package/dist/schemas/record/index.js.map +1 -0
  235. package/dist/schemas/record/relation.d.ts +36 -0
  236. package/dist/schemas/record/relation.d.ts.map +1 -0
  237. package/dist/schemas/record/relation.js +37 -0
  238. package/dist/schemas/record/relation.js.map +1 -0
  239. package/dist/schemas/schema/descriptor.d.ts +231 -0
  240. package/dist/schemas/schema/descriptor.d.ts.map +1 -0
  241. package/dist/schemas/schema/descriptor.js +205 -0
  242. package/dist/schemas/schema/descriptor.js.map +1 -0
  243. package/dist/schemas/schema/index.d.ts +7 -0
  244. package/dist/schemas/schema/index.d.ts.map +1 -0
  245. package/dist/schemas/schema/index.js +7 -0
  246. package/dist/schemas/schema/index.js.map +1 -0
  247. package/dist/schemas/sync-bridge-descriptor.d.ts +124 -0
  248. package/dist/schemas/sync-bridge-descriptor.d.ts.map +1 -0
  249. package/dist/schemas/sync-bridge-descriptor.js +67 -0
  250. package/dist/schemas/sync-bridge-descriptor.js.map +1 -0
  251. package/dist/server/manifest-route.d.ts +92 -0
  252. package/dist/server/manifest-route.d.ts.map +1 -0
  253. package/dist/server/manifest-route.js +226 -0
  254. package/dist/server/manifest-route.js.map +1 -0
  255. package/dist/storage-policy.context.descriptor.d.ts +16 -0
  256. package/dist/storage-policy.context.descriptor.d.ts.map +1 -0
  257. package/dist/storage-policy.context.descriptor.js +16 -0
  258. package/dist/storage-policy.context.descriptor.js.map +1 -0
  259. package/dist/storage-policy.context.server.d.ts +14 -0
  260. package/dist/storage-policy.context.server.d.ts.map +1 -0
  261. package/dist/storage-policy.context.server.js +27 -0
  262. package/dist/storage-policy.context.server.js.map +1 -0
  263. package/dist/storage.plugin.d.ts +38 -0
  264. package/dist/storage.plugin.d.ts.map +1 -0
  265. package/dist/storage.plugin.js +204 -0
  266. package/dist/storage.plugin.js.map +1 -0
  267. package/dist/sync/cloud-pull.d.ts +15 -0
  268. package/dist/sync/cloud-pull.d.ts.map +1 -0
  269. package/dist/sync/cloud-pull.js +130 -0
  270. package/dist/sync/cloud-pull.js.map +1 -0
  271. package/dist/sync/cloud-record-crud-config.d.ts +19 -0
  272. package/dist/sync/cloud-record-crud-config.d.ts.map +1 -0
  273. package/dist/sync/cloud-record-crud-config.js +22 -0
  274. package/dist/sync/cloud-record-crud-config.js.map +1 -0
  275. package/dist/sync/record-sync-bridge.d.ts +5 -0
  276. package/dist/sync/record-sync-bridge.d.ts.map +1 -0
  277. package/dist/sync/record-sync-bridge.js +121 -0
  278. package/dist/sync/record-sync-bridge.js.map +1 -0
  279. package/dist/sync/resolve-sync-target.d.ts +23 -0
  280. package/dist/sync/resolve-sync-target.d.ts.map +1 -0
  281. package/dist/sync/resolve-sync-target.js +45 -0
  282. package/dist/sync/resolve-sync-target.js.map +1 -0
  283. package/dist/sync/schemas/cloud-pull.d.ts +25 -0
  284. package/dist/sync/schemas/cloud-pull.d.ts.map +1 -0
  285. package/dist/sync/schemas/cloud-pull.js +7 -0
  286. package/dist/sync/schemas/cloud-pull.js.map +1 -0
  287. package/dist/sync/schemas/index.d.ts +9 -0
  288. package/dist/sync/schemas/index.d.ts.map +1 -0
  289. package/dist/sync/schemas/index.js +9 -0
  290. package/dist/sync/schemas/index.js.map +1 -0
  291. package/dist/sync/schemas/sync-helpers.d.ts +17 -0
  292. package/dist/sync/schemas/sync-helpers.d.ts.map +1 -0
  293. package/dist/sync/schemas/sync-helpers.js +7 -0
  294. package/dist/sync/schemas/sync-helpers.js.map +1 -0
  295. package/dist/sync/schemas/sync-state.d.ts +65 -0
  296. package/dist/sync/schemas/sync-state.d.ts.map +1 -0
  297. package/dist/sync/schemas/sync-state.js +32 -0
  298. package/dist/sync/schemas/sync-state.js.map +1 -0
  299. package/dist/sync/sync-bridge.d.ts +80 -0
  300. package/dist/sync/sync-bridge.d.ts.map +1 -0
  301. package/dist/sync/sync-bridge.js +617 -0
  302. package/dist/sync/sync-bridge.js.map +1 -0
  303. package/dist/sync/sync-manifest.d.ts +20 -0
  304. package/dist/sync/sync-manifest.d.ts.map +1 -0
  305. package/dist/sync/sync-manifest.js +140 -0
  306. package/dist/sync/sync-manifest.js.map +1 -0
  307. package/dist/sync/sync-state.consumer.d.ts +23 -0
  308. package/dist/sync/sync-state.consumer.d.ts.map +1 -0
  309. package/dist/sync/sync-state.consumer.js +111 -0
  310. package/dist/sync/sync-state.consumer.js.map +1 -0
  311. package/dist/transform/index.d.ts +75 -0
  312. package/dist/transform/index.d.ts.map +1 -0
  313. package/dist/transform/index.js +81 -0
  314. package/dist/transform/index.js.map +1 -0
  315. package/dist/transform/transform-descriptor.d.ts +51 -0
  316. package/dist/transform/transform-descriptor.d.ts.map +1 -0
  317. package/dist/transform/transform-descriptor.js +30 -0
  318. package/dist/transform/transform-descriptor.js.map +1 -0
  319. package/dist/tui/storage-explorer.descriptor.d.ts +14 -0
  320. package/dist/tui/storage-explorer.descriptor.d.ts.map +1 -0
  321. package/dist/tui/storage-explorer.descriptor.js +29 -0
  322. package/dist/tui/storage-explorer.descriptor.js.map +1 -0
  323. package/dist/tui/storage-explorer.impl.consumer.d.ts +11 -0
  324. package/dist/tui/storage-explorer.impl.consumer.d.ts.map +1 -0
  325. package/dist/tui/storage-explorer.impl.consumer.js +13 -0
  326. package/dist/tui/storage-explorer.impl.consumer.js.map +1 -0
  327. package/dist/tui/storage-open.descriptor.d.ts +14 -0
  328. package/dist/tui/storage-open.descriptor.d.ts.map +1 -0
  329. package/dist/tui/storage-open.descriptor.js +28 -0
  330. package/dist/tui/storage-open.descriptor.js.map +1 -0
  331. package/dist/tui/storage-open.impl.consumer.d.ts +11 -0
  332. package/dist/tui/storage-open.impl.consumer.d.ts.map +1 -0
  333. package/dist/tui/storage-open.impl.consumer.js +13 -0
  334. package/dist/tui/storage-open.impl.consumer.js.map +1 -0
  335. package/dist/utils/error-context.d.ts +2 -0
  336. package/dist/utils/error-context.d.ts.map +1 -0
  337. package/dist/utils/error-context.js +17 -0
  338. package/dist/utils/error-context.js.map +1 -0
  339. package/package.json +241 -0
  340. package/src/adapters/index.ts +13 -0
  341. package/src/bridge/index.ts +2 -0
  342. package/src/bridge/storage-kind-bridge.ts +131 -0
  343. package/src/bridge/types.ts +46 -0
  344. package/src/cli/commands/list/storage.list.cli-command.descriptor.ts +20 -0
  345. package/src/cli/commands/list/storage.list.cli-command.impl.ts +72 -0
  346. package/src/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.ts +28 -0
  347. package/src/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.ts +171 -0
  348. package/src/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.ts +28 -0
  349. package/src/cli/commands/sync/push/storage.sync.push.cli-command.impl.ts +213 -0
  350. package/src/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.ts +22 -0
  351. package/src/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.ts +129 -0
  352. package/src/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.ts +17 -0
  353. package/src/cli/commands/sync/status/storage.sync.status.cli-command.impl.ts +192 -0
  354. package/src/cli/context.consumer.ts +195 -0
  355. package/src/cli/storage.cli-group.descriptor.ts +13 -0
  356. package/src/cli/storage.sync.cli-group.descriptor.ts +14 -0
  357. package/src/cli/types.ts +25 -0
  358. package/src/client/index.ts +10 -0
  359. package/src/client/list-browsable-adapters.ts +42 -0
  360. package/src/daemon/commands/sync.ts +225 -0
  361. package/src/docs/adapters.docs.descriptor.ts +225 -0
  362. package/src/docs/manifests.docs.descriptor.ts +318 -0
  363. package/src/docs/records.docs.descriptor.ts +271 -0
  364. package/src/docs/sync.docs.descriptor.ts +281 -0
  365. package/src/index.ts +109 -0
  366. package/src/interfaces/adapter.ts +451 -0
  367. package/src/interfaces/document-store.ts +74 -0
  368. package/src/interfaces/index.ts +117 -0
  369. package/src/interfaces/key-value.ts +112 -0
  370. package/src/interfaces/query-builder.ts +31 -0
  371. package/src/interfaces/record/index.ts +58 -0
  372. package/src/interfaces/record/interface.ts +723 -0
  373. package/src/interfaces/repository.ts +300 -0
  374. package/src/interfaces/schema/index.ts +37 -0
  375. package/src/interfaces/schema/schema-interface.ts +586 -0
  376. package/src/interfaces/schema/table-interface.ts +314 -0
  377. package/src/interfaces/storage-consumer-fs.ts +66 -0
  378. package/src/manifest/base.ts +594 -0
  379. package/src/manifest/cloud-sync.consumer.ts +120 -0
  380. package/src/manifest/index.ts +7 -0
  381. package/src/manifest/source-policy.ts +74 -0
  382. package/src/paths.ts +171 -0
  383. package/src/policy/context.ts +30 -0
  384. package/src/policy/index.ts +20 -0
  385. package/src/policy/overrides.ts +46 -0
  386. package/src/policy/persistence.ts +117 -0
  387. package/src/policy/types.ts +28 -0
  388. package/src/record/base.ts +1872 -0
  389. package/src/record/events.ts +56 -0
  390. package/src/record/extensions.ts +308 -0
  391. package/src/record/index.ts +7 -0
  392. package/src/resolver/storage-backed-resolver.ts +255 -0
  393. package/src/schemas/adapter-descriptor.ts +128 -0
  394. package/src/schemas/index.ts +104 -0
  395. package/src/schemas/manifest-descriptor.ts +143 -0
  396. package/src/schemas/record/descriptor.ts +621 -0
  397. package/src/schemas/record/index.ts +60 -0
  398. package/src/schemas/record/relation.ts +49 -0
  399. package/src/schemas/schema/descriptor.ts +278 -0
  400. package/src/schemas/schema/index.ts +14 -0
  401. package/src/schemas/sync-bridge-descriptor.ts +143 -0
  402. package/src/server/manifest-route.ts +319 -0
  403. package/src/storage-policy.context.descriptor.ts +17 -0
  404. package/src/storage-policy.context.server.ts +34 -0
  405. package/src/storage.plugin.ts +264 -0
  406. package/src/sync/cloud-pull.ts +202 -0
  407. package/src/sync/cloud-record-crud-config.ts +41 -0
  408. package/src/sync/record-sync-bridge.ts +183 -0
  409. package/src/sync/resolve-sync-target.ts +57 -0
  410. package/src/sync/schemas/cloud-pull.ts +26 -0
  411. package/src/sync/schemas/index.ts +18 -0
  412. package/src/sync/schemas/sync-helpers.ts +18 -0
  413. package/src/sync/schemas/sync-state.ts +41 -0
  414. package/src/sync/sync-bridge.ts +763 -0
  415. package/src/sync/sync-manifest.ts +212 -0
  416. package/src/sync/sync-state.consumer.ts +144 -0
  417. package/src/transform/index.ts +130 -0
  418. package/src/transform/transform-descriptor.ts +53 -0
  419. package/src/tui/storage-explorer.descriptor.ts +32 -0
  420. package/src/tui/storage-explorer.impl.consumer.ts +14 -0
  421. package/src/tui/storage-open.descriptor.ts +31 -0
  422. package/src/tui/storage-open.impl.consumer.ts +14 -0
  423. package/src/utils/error-context.ts +19 -0
@@ -0,0 +1,621 @@
1
+ /**
2
+ * Storage Record Descriptor Schema
3
+ *
4
+ * Defines a record type that provides CRUD operations on a single table.
5
+ * Used for modules that need structured storage with relations and queries.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const todoDescriptor: StorageRecordDescriptor = {
10
+ * kind: 'storage/record',
11
+ * id: 'session.todos',
12
+ * name: 'Session Todos',
13
+ * description: 'Todo items within sessions',
14
+ * schema: TodoSchema,
15
+ * tableName: 'todos',
16
+ * primaryKey: 'id',
17
+ * relations: {
18
+ * session: {
19
+ * type: 'belongs_to',
20
+ * target: 'session.sessions',
21
+ * foreignKey: 'sessionId'
22
+ * }
23
+ * },
24
+ * fts: {
25
+ * fields: ['content', 'activeForm']
26
+ * },
27
+ * hierarchy: {
28
+ * parentField: 'parentId'
29
+ * },
30
+ * allowedAdapters: ['storage.localdb'],
31
+ * defaultAdapter: 'storage.localdb'
32
+ * };
33
+ * ```
34
+ */
35
+
36
+ import * as z from 'zod/v4';
37
+ import { RuntimeDescriptorSchema } from '@vibesdotdev/runtime/schemas/descriptor';
38
+ import { StorageScopeSchema } from '../manifest-descriptor';
39
+ import { ConflictStrategySchema } from '../sync-bridge-descriptor';
40
+ import type { VibesRuntime } from '@vibesdotdev/runtime';
41
+ import type { StorageRecordInterface } from '../../interfaces/record/interface';
42
+
43
+ // RELATION TYPES
44
+
45
+ export { StorageRelationSchema, StorageRelationTypeSchema } from './relation';
46
+ export type { StorageRelation, StorageRelationType } from './relation';
47
+ import { StorageRelationSchema } from './relation';
48
+
49
+ // INDEX TYPES
50
+
51
+ /**
52
+ * Index definition for a storage record
53
+ */
54
+ export const StorageIndexSchema = z.object({
55
+ /** Index name (auto-generated if not provided) */
56
+ name: z.string().optional(),
57
+
58
+ /** Fields to index */
59
+ fields: z.array(z.string()).min(1),
60
+
61
+ /** Whether this is a unique index */
62
+ unique: z.boolean().default(false),
63
+
64
+ /** Custom index type (e.g., 'btree', 'hash') */
65
+ type: z.string().optional(),
66
+
67
+ /** Index condition (partial index) */
68
+ where: z.string().optional()
69
+ });
70
+
71
+ // MIGRATION TYPES
72
+
73
+ /**
74
+ * Migration definition for storage records
75
+ */
76
+ export const StorageMigrationSchema = z.object({
77
+ /** Migration version number */
78
+ version: z.number().int().positive(),
79
+
80
+ /** Migration name/description */
81
+ name: z.string().optional(),
82
+
83
+ /** Up migration SQL or function */
84
+ up: z.union([z.string(), z.unknown()]),
85
+
86
+ /** Down migration SQL or function */
87
+ down: z.union([z.string(), z.unknown()]).optional()
88
+ });
89
+
90
+ // FIELD CONFIG TYPES
91
+
92
+ /**
93
+ * Field configuration for auto-managed fields
94
+ */
95
+ export const StorageFieldConfigSchema = z.object({
96
+ /** Enable auto-increment */
97
+ autoIncrement: z.boolean().optional(),
98
+
99
+ /** Custom ID generator function */
100
+ generator: z.optional(z.unknown()),
101
+
102
+ /** Field type override */
103
+ type: z.string().optional(),
104
+
105
+ /** Default value */
106
+ default: z.unknown().optional()
107
+ });
108
+
109
+ // FTS (FULL-TEXT SEARCH) TYPES
110
+
111
+ /**
112
+ * FTS configuration for storage records
113
+ */
114
+ export const StorageFtsConfigSchema = z.object({
115
+ /** Fields to index for search */
116
+ fields: z.array(z.string()).min(1),
117
+
118
+ /** FTS tokenizer (SQLite: 'unicode61', 'porter', etc.) */
119
+ tokenizer: z.string().optional(),
120
+
121
+ /** Custom FTS table name (default: {tableName}_fts) */
122
+ tableName: z.string().optional(),
123
+
124
+ /** Additional FTS options */
125
+ options: z.record(z.string(), z.unknown()).optional()
126
+ });
127
+
128
+ // COMPUTED FIELD TYPES
129
+
130
+ /**
131
+ * Computed field definition
132
+ */
133
+ export const StorageComputedFieldSchema = z.object({
134
+ /** Aggregation type */
135
+ type: z.enum(['count', 'sum', 'avg', 'min', 'max', 'exists']),
136
+
137
+ /** Relation to aggregate over */
138
+ relation: z.string(),
139
+
140
+ /** Field on related table to aggregate (for sum/avg/min/max) */
141
+ field: z.string().optional(),
142
+
143
+ /** Filter conditions on related records */
144
+ where: z.record(z.string(), z.unknown()).optional(),
145
+
146
+ /** Custom SQL expression (overrides type/relation) */
147
+ expression: z.string().optional(),
148
+
149
+ /** Cache the computed value in database */
150
+ cached: z.boolean().default(false),
151
+
152
+ /** Cache invalidation strategy */
153
+ cacheStrategy: z.enum(['on_write', 'manual', 'ttl']).optional(),
154
+
155
+ /** Cache TTL in seconds (for ttl strategy) */
156
+ cacheTtl: z.number().int().positive().optional()
157
+ });
158
+
159
+ // HIERARCHY TYPES
160
+
161
+ /**
162
+ * Hierarchy configuration for recursive data
163
+ */
164
+ export const StorageHierarchyConfigSchema = z.object({
165
+ /** Field that references parent (e.g., 'parentId') */
166
+ parentField: z.string(),
167
+
168
+ /** Relation name for children (default: derived from tableName) */
169
+ childrenRelation: z.string().optional(),
170
+
171
+ /** Include depth in recursive query results */
172
+ includeDepth: z.boolean().default(true),
173
+
174
+ /** Include path from root in results */
175
+ includePath: z.boolean().default(false),
176
+
177
+ /** Maximum recursion depth (default: unlimited) */
178
+ maxDepth: z.number().int().positive().optional()
179
+ });
180
+
181
+ // REMOTE ADAPTER CONFIGURATION
182
+
183
+ /**
184
+ * Remote CRUD configuration for cloud sync
185
+ */
186
+ export const StorageRemoteCrudSchema = z.object({
187
+ /** Base API path for list operations */
188
+ apiPath: z.string(),
189
+
190
+ /** API path for single entity operations (:id placeholder) */
191
+ entityPath: z.string().optional(),
192
+
193
+ /** Remote list response field (defaults to items) */
194
+ listField: z.string().optional(),
195
+
196
+ /** Remote total response field */
197
+ totalField: z.string().optional(),
198
+
199
+ /** HTTP method for updates (PUT, PATCH, etc.) */
200
+ updateMethod: z.enum(['PUT', 'PATCH']).default('PUT'),
201
+
202
+ /** HTTP method for creates (POST, PUT) */
203
+ createMethod: z.enum(['POST', 'PUT']).default('POST'),
204
+
205
+ /** HTTP method for deletes (DELETE) */
206
+ deleteMethod: z.literal('DELETE').default('DELETE')
207
+ });
208
+
209
+ /**
210
+ * Remote adapter configuration
211
+ */
212
+ export const StorageRemoteConfigSchema = z.object({
213
+ /** Remote adapter ID (typically 'storage.cloud-api') */
214
+ adapter: z.string().default('storage.cloud-api'),
215
+
216
+ /** CRUD endpoint configuration */
217
+ crud: StorageRemoteCrudSchema.optional()
218
+ });
219
+
220
+ // PERSISTENCE POLICY
221
+
222
+ /**
223
+ * Persistence mode for data storage
224
+ */
225
+ export const StoragePersistenceModeSchema = z.enum([
226
+ 'local-only', // Store only locally
227
+ 'remote-only', // Store only in cloud
228
+ 'local-first', // Local primary, sync to cloud
229
+ 'remote-first', // Cloud primary, cache locally
230
+ 'auto' // Auto-detect based on connectivity
231
+ ]);
232
+
233
+ /**
234
+ * Persistence policy configuration
235
+ */
236
+ export const StoragePersistencePolicySchema = z.object({
237
+ /** Persistence mode */
238
+ mode: StoragePersistenceModeSchema,
239
+
240
+ /** Adapters for local storage */
241
+ localAdapters: z.array(z.string()).optional(),
242
+
243
+ /** Adapters for remote storage */
244
+ remoteAdapters: z.array(z.string()).optional()
245
+ });
246
+
247
+ // SYNC CONFIGURATION
248
+
249
+ /**
250
+ * Ownership filter for sync operations
251
+ */
252
+ export const StorageOwnershipFilterSchema = z.enum([
253
+ 'all', // Sync all records
254
+ 'user-only', // Only user-created records
255
+ 'system-only' // Only system records
256
+ ]);
257
+
258
+ /**
259
+ * Sync configuration for storage records
260
+ */
261
+ export const StorageSyncConfigSchema = z.object({
262
+ /** Ownership filter */
263
+ ownershipFilter: StorageOwnershipFilterSchema.default('all'),
264
+
265
+ /** Optional field used as canonical ID for sync matching */
266
+ idField: z.string().optional(),
267
+
268
+ /** Strategy used when both local and remote diverge */
269
+ conflictStrategy: ConflictStrategySchema.default('local-wins'),
270
+
271
+ /** Fields to strip before pushing to remote */
272
+ sensitiveFields: z.array(z.string()).default([]),
273
+
274
+ /** Function to collect local items for sync */
275
+ collect: z.optional(z.unknown()),
276
+
277
+ /** Function to transform local record before sync */
278
+ toRemote: z.optional(z.unknown()),
279
+
280
+ /** Function to transform remote record into local shape */
281
+ fromRemote: z.optional(z.unknown()),
282
+
283
+ /** Hook called before pushing to remote */
284
+ beforePush: z.optional(z.unknown()),
285
+
286
+ /** Hook called to delete remote row */
287
+ deleteRemote: z.optional(z.unknown()),
288
+
289
+ /** Hook for writing pulled remote rows locally */
290
+ writePulled: z.optional(z.unknown())
291
+ });
292
+
293
+ export type StorageSyncContext = {
294
+ runtime: VibesRuntime;
295
+ record?: StorageRecordInterface<unknown>;
296
+ apiEndpoint: string;
297
+ apiToken?: string;
298
+ fetch: (input: string, init?: RequestInit) => Promise<Response>;
299
+ };
300
+
301
+ export type StorageRecordLocalSyncContext = {
302
+ runtime: VibesRuntime;
303
+ record: StorageRecordInterface<Record<string, unknown>>;
304
+ apiEndpoint?: never;
305
+ apiToken?: never;
306
+ fetch?: never;
307
+ };
308
+
309
+ export type StorageRecordRemoteSyncContext = {
310
+ runtime: VibesRuntime;
311
+ record?: never;
312
+ apiEndpoint: string;
313
+ apiToken?: string;
314
+ fetch: (input: string, init?: RequestInit) => Promise<Response>;
315
+ };
316
+
317
+ export type StorageRecordSyncHooks = {
318
+ collect?: (context: StorageRecordLocalSyncContext) => Promise<Record<string, unknown>[]>;
319
+ toRemote?: (
320
+ item: Record<string, unknown>,
321
+ context?: StorageRecordLocalSyncContext
322
+ ) => Record<string, unknown>;
323
+ fromRemote?: (item: Record<string, unknown>) => Record<string, unknown>;
324
+ beforePush?: (
325
+ item: Record<string, unknown>,
326
+ context: StorageRecordRemoteSyncContext
327
+ ) => Promise<void>;
328
+ deleteRemote?: (
329
+ item: Record<string, unknown>,
330
+ context: StorageRecordRemoteSyncContext
331
+ ) => Promise<void>;
332
+ writePulled?: (
333
+ items: Record<string, unknown>[],
334
+ context: StorageRecordLocalSyncContext
335
+ ) => Promise<void>;
336
+ };
337
+
338
+ /**
339
+ * Side effect operation types
340
+ */
341
+ export const StorageSideEffectOperationSchema = z.enum([
342
+ 'update', // Update field(s) on target
343
+ 'touch', // Update timestamp field on target
344
+ 'increment', // Increment numeric field
345
+ 'decrement', // Decrement numeric field
346
+ 'refresh' // Refresh computed field
347
+ ]);
348
+
349
+ /**
350
+ * Side effect definition
351
+ */
352
+ export const StorageSideEffectSchema = z.object({
353
+ /** Target storage record ID */
354
+ target: z.string(),
355
+
356
+ /** Operation to perform */
357
+ operation: StorageSideEffectOperationSchema,
358
+
359
+ /** Field to update on target (for update/touch) */
360
+ field: z.string().optional(),
361
+
362
+ /** Value to set (for update) or expression */
363
+ value: z.unknown().optional(),
364
+
365
+ /** Value generator function (receives source record) */
366
+ valueFn: z.optional(z.unknown()),
367
+
368
+ /** Foreign key field to find target record */
369
+ foreignKey: z.string().optional(),
370
+
371
+ /** Whether to execute in same transaction */
372
+ sameTransaction: z.boolean().default(true),
373
+
374
+ /** Whether to continue if target not found */
375
+ ignoreMissing: z.boolean().default(true)
376
+ });
377
+
378
+ /**
379
+ * Side effects configuration by operation
380
+ */
381
+ export const StorageSideEffectsConfigSchema = z.object({
382
+ /** Side effects on create */
383
+ onCreate: z.array(StorageSideEffectSchema).optional(),
384
+
385
+ /** Side effects on update */
386
+ onUpdate: z.array(StorageSideEffectSchema).optional(),
387
+
388
+ /** Side effects on delete */
389
+ onDelete: z.array(StorageSideEffectSchema).optional()
390
+ });
391
+
392
+ // STORAGE RECORD DESCRIPTOR
393
+
394
+ /**
395
+ * Storage record descriptor schema
396
+ */
397
+ export const StorageRecordDescriptorSchema = RuntimeDescriptorSchema.extend({
398
+ kind: z.literal('storage/record'),
399
+
400
+ // DATA DEFINITION
401
+
402
+ /** Human-readable name */
403
+ name: z.string().min(1),
404
+
405
+ /** Human-readable description */
406
+ description: z.string().optional(),
407
+
408
+ /** Zod schema for the record data (stored as unknown, validated at runtime) */
409
+ schema: z.unknown(),
410
+
411
+ /** Table name in the database */
412
+ tableName: z.string().min(1),
413
+
414
+ /** Primary key field name (default: 'id') */
415
+ primaryKey: z.string().default('id'),
416
+
417
+ // RELATIONS
418
+
419
+ /** Relations to other storage records */
420
+ relations: z.record(z.string(), StorageRelationSchema).optional(),
421
+
422
+ // INDEXES
423
+
424
+ /** Database indexes for this table */
425
+ indexes: z.array(StorageIndexSchema).default([]),
426
+
427
+ // FULL-TEXT SEARCH
428
+
429
+ /** Full-text search configuration */
430
+ fts: StorageFtsConfigSchema.optional(),
431
+
432
+ // COMPUTED FIELDS
433
+
434
+ /** Computed fields from aggregations or relations */
435
+ computedFields: z.record(z.string(), StorageComputedFieldSchema).optional(),
436
+
437
+ // HIERARCHY (RECURSIVE)
438
+
439
+ /** Hierarchical/recursive configuration */
440
+ hierarchy: StorageHierarchyConfigSchema.optional(),
441
+
442
+ // SIDE EFFECTS
443
+
444
+ /** Side effects triggered by operations on this record */
445
+ sideEffects: StorageSideEffectsConfigSchema.optional(),
446
+
447
+ // MIGRATIONS
448
+
449
+ /** Inline migration definitions */
450
+ migrations: z.array(StorageMigrationSchema).optional(),
451
+
452
+ /** Migration key for external migrations (e.g., 'session.todos') */
453
+ migrationKey: z.string().optional(),
454
+
455
+ /** Current schema version (default: 1) */
456
+ version: z.number().int().positive().default(1),
457
+
458
+ // AUTO-MANAGED FIELDS
459
+
460
+ /** Auto-manage timestamps (createdAt, updatedAt) */
461
+ timestamps: z
462
+ .union([
463
+ z.boolean(),
464
+ z.object({
465
+ createdAt: z.union([z.boolean(), z.string()]).optional(),
466
+ updatedAt: z.union([z.boolean(), z.string()]).optional()
467
+ })
468
+ ])
469
+ .default(true),
470
+
471
+ /** Auto-generate IDs */
472
+ autoId: z
473
+ .union([
474
+ z.boolean(),
475
+ z.object({
476
+ field: z.string().optional(),
477
+ strategy: z.enum(['uuid', 'nanoid', 'custom']).optional(),
478
+ generator: z.optional(z.unknown())
479
+ })
480
+ ])
481
+ .default(true),
482
+
483
+ /** Soft delete field (e.g., 'deletedAt') */
484
+ softDelete: z.union([z.boolean(), z.string()]).optional(),
485
+
486
+ /** Field-specific configurations */
487
+ fieldConfig: z.record(z.string(), StorageFieldConfigSchema).optional(),
488
+
489
+ // ADAPTER SELECTION
490
+
491
+ /** Allowed adapter IDs (e.g., ['storage.localdb', 'storage.drizzle']) */
492
+ allowedAdapters: z.array(z.string()).min(1),
493
+
494
+ /** Default adapter to use when not specified */
495
+ defaultAdapter: z.string().optional(),
496
+
497
+ /** Adapter-specific configuration */
498
+ adapterConfig: z.record(z.string(), z.unknown()).optional(),
499
+
500
+ // SCOPE & STORAGE
501
+
502
+ /** Storage scope for path resolution */
503
+ scope: StorageScopeSchema.default('project'),
504
+
505
+ /** Custom database name (overrides default) */
506
+ dbName: z.string().optional(),
507
+
508
+ /** Database schema name (for Postgres) */
509
+ dbSchema: z.string().optional(),
510
+
511
+ // FEATURES
512
+
513
+ /** Enable record versioning for optimistic locking */
514
+ versioning: z.boolean().default(false),
515
+
516
+ /** Enable audit trail (createdBy, updatedBy) */
517
+ audit: z.boolean().default(false),
518
+
519
+ /** Enable change tracking for sync */
520
+ changeTracking: z.boolean().default(false),
521
+
522
+ // VALIDATION
523
+
524
+ /** Custom validation function */
525
+ validate: z.optional(z.unknown()),
526
+
527
+ /** Enable schema validation on write */
528
+ validateOnWrite: z.boolean().default(true),
529
+
530
+ /** Enable schema validation on read */
531
+ validateOnRead: z.boolean().default(false),
532
+
533
+ // HOOKS
534
+
535
+ /** Before create hook */
536
+ beforeCreate: z.optional(z.unknown()),
537
+
538
+ /** After create hook */
539
+ afterCreate: z.optional(z.unknown()),
540
+
541
+ /** Before update hook */
542
+ beforeUpdate: z.optional(z.unknown()),
543
+
544
+ /** After update hook */
545
+ afterUpdate: z.optional(z.unknown()),
546
+
547
+ /** Before delete hook */
548
+ beforeDelete: z.optional(z.unknown()),
549
+
550
+ /** After delete hook */
551
+ afterDelete: z.optional(z.unknown()),
552
+
553
+ // METADATA
554
+
555
+ /** Whether this record is internal (not user-editable) */
556
+ internal: z.boolean().default(false),
557
+
558
+ /** Record namespace (e.g., 'session.todos') */
559
+ namespace: z.string().optional(),
560
+
561
+ /** Tags for categorization */
562
+ tags: z.array(z.string()).default([]),
563
+
564
+ // REMOTE & SYNC CONFIGURATION
565
+
566
+ /** Remote adapter configuration for cloud sync */
567
+ remote: StorageRemoteConfigSchema.optional(),
568
+
569
+ /** Persistence policy for local/remote storage */
570
+ persistence: StoragePersistencePolicySchema.optional(),
571
+
572
+ /** Sync configuration for bidirectional sync */
573
+ sync: StorageSyncConfigSchema.optional()
574
+ });
575
+
576
+ // TYPE EXPORTS
577
+ //
578
+ // Two named roles per the schemas-first vision:
579
+ // * `*Descriptor` — output of `.parse()`. Defaults applied. What the
580
+ // runtime hands to consumers (StorageRecord, sync
581
+ // bridges, registration code).
582
+ // * `*DescriptorInput` — `z.input` of the same schema. What descriptor
583
+ // AUTHORS write as a literal: defaults are optional,
584
+ // coercions accept their input form. Use this when
585
+ // declaring `const x: StorageRecordDescriptorInput =
586
+ // { ... }` in record-descriptor source files.
587
+ //
588
+ // The runtime parses input → output at registration time; downstream code
589
+ // always sees the output type. Mixing these breaks descriptor authoring (you
590
+ // have to spell every default explicitly to satisfy the output shape) and
591
+ // breaks consumers (you lose default-applied invariants if you try to read
592
+ // the input shape).
593
+
594
+ // StorageRelation/StorageRelationType are re-exported above from './relation'.
595
+ export type StorageIndex = z.infer<typeof StorageIndexSchema>;
596
+ export type StorageIndexInput = z.input<typeof StorageIndexSchema>;
597
+ export type StorageMigration = z.infer<typeof StorageMigrationSchema>;
598
+ export type StorageMigrationInput = z.input<typeof StorageMigrationSchema>;
599
+ export type StorageFieldConfig = z.infer<typeof StorageFieldConfigSchema>;
600
+ export type StorageFieldConfigInput = z.input<typeof StorageFieldConfigSchema>;
601
+ export type StorageFtsConfig = z.infer<typeof StorageFtsConfigSchema>;
602
+ export type StorageFtsConfigInput = z.input<typeof StorageFtsConfigSchema>;
603
+ export type StorageComputedField = z.infer<typeof StorageComputedFieldSchema>;
604
+ export type StorageComputedFieldInput = z.input<typeof StorageComputedFieldSchema>;
605
+ export type StorageHierarchyConfig = z.infer<typeof StorageHierarchyConfigSchema>;
606
+ export type StorageHierarchyConfigInput = z.input<typeof StorageHierarchyConfigSchema>;
607
+ export type StorageSideEffectOperation = z.infer<typeof StorageSideEffectOperationSchema>;
608
+ export type StorageSideEffect = z.infer<typeof StorageSideEffectSchema>;
609
+ export type StorageSideEffectInput = z.input<typeof StorageSideEffectSchema>;
610
+ export type StorageSideEffectsConfig = z.infer<typeof StorageSideEffectsConfigSchema>;
611
+ export type StorageSideEffectsConfigInput = z.input<typeof StorageSideEffectsConfigSchema>;
612
+ export type StorageRecordDescriptor = z.infer<typeof StorageRecordDescriptorSchema>;
613
+ export type StorageRecordDescriptorInput = z.input<typeof StorageRecordDescriptorSchema>;
614
+
615
+ // Remote & Sync types
616
+ export type StorageRemoteCrud = z.infer<typeof StorageRemoteCrudSchema>;
617
+ export type StorageRemoteConfig = z.infer<typeof StorageRemoteConfigSchema>;
618
+ export type StoragePersistenceMode = z.infer<typeof StoragePersistenceModeSchema>;
619
+ export type StoragePersistencePolicy = z.infer<typeof StoragePersistencePolicySchema>;
620
+ export type StorageOwnershipFilter = z.infer<typeof StorageOwnershipFilterSchema>;
621
+ export type StorageSyncConfig = z.infer<typeof StorageSyncConfigSchema>;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Storage Record Schema Exports
3
+ *
4
+ * Exports all types and schemas for storage/record descriptors.
5
+ */
6
+
7
+ export {
8
+ StorageRecordDescriptorSchema,
9
+ StorageRelationTypeSchema,
10
+ StorageRelationSchema,
11
+ StorageSyncConfigSchema,
12
+ StorageIndexSchema,
13
+ StorageMigrationSchema,
14
+ StorageRemoteCrudSchema,
15
+ StorageRemoteConfigSchema,
16
+ StoragePersistenceModeSchema,
17
+ StoragePersistencePolicySchema,
18
+ StorageOwnershipFilterSchema,
19
+ StorageFieldConfigSchema,
20
+ StorageFtsConfigSchema,
21
+ StorageComputedFieldSchema,
22
+ StorageHierarchyConfigSchema,
23
+ StorageSideEffectOperationSchema,
24
+ StorageSideEffectSchema,
25
+ StorageSideEffectsConfigSchema
26
+ } from './descriptor';
27
+
28
+ export type {
29
+ StorageRecordDescriptor,
30
+ StorageRecordDescriptorInput,
31
+ StorageSyncConfig,
32
+ StorageRemoteCrud,
33
+ StorageRemoteConfig,
34
+ StoragePersistenceMode,
35
+ StoragePersistencePolicy,
36
+ StorageOwnershipFilter,
37
+ StorageRelationType,
38
+ StorageRelation,
39
+ StorageIndex,
40
+ StorageIndexInput,
41
+ StorageMigration,
42
+ StorageMigrationInput,
43
+ StorageSyncContext,
44
+ StorageRecordLocalSyncContext,
45
+ StorageRecordRemoteSyncContext,
46
+ StorageRecordSyncHooks,
47
+ StorageFieldConfig,
48
+ StorageFieldConfigInput,
49
+ StorageFtsConfig,
50
+ StorageFtsConfigInput,
51
+ StorageComputedField,
52
+ StorageComputedFieldInput,
53
+ StorageHierarchyConfig,
54
+ StorageHierarchyConfigInput,
55
+ StorageSideEffectOperation,
56
+ StorageSideEffect,
57
+ StorageSideEffectInput,
58
+ StorageSideEffectsConfig,
59
+ StorageSideEffectsConfigInput
60
+ } from './descriptor';