@procedures/client 0.2.0 → 0.2.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 (236) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +4 -4
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/browser.d.ts +1 -1
  5. package/dist/browser.d.ts.map +1 -1
  6. package/dist/browser.js.map +1 -1
  7. package/dist/procedures/invoke.d.ts +6 -1
  8. package/dist/procedures/invoke.d.ts.map +1 -1
  9. package/dist/procedures/invoke.js +2 -2
  10. package/dist/procedures/invoke.js.map +1 -1
  11. package/dist/server/host-policy.d.ts +3 -3
  12. package/dist/server/host-policy.d.ts.map +1 -1
  13. package/dist/server/procedure-server.d.ts +2 -2
  14. package/dist/server/procedure-server.d.ts.map +1 -1
  15. package/dist/server/procedure-server.js.map +1 -1
  16. package/package.json +1 -1
  17. package/src/browser.ts +1 -0
  18. package/src/procedures/invoke.ts +10 -4
  19. package/src/server/host-policy.ts +3 -3
  20. package/src/server/procedure-server.ts +2 -2
  21. package/dist/client/middleware/batching.d.ts +0 -102
  22. package/dist/client/middleware/batching.d.ts.map +0 -1
  23. package/dist/client/middleware/batching.js +0 -245
  24. package/dist/client/middleware/batching.js.map +0 -1
  25. package/dist/collections/async/async-queue.d.ts +0 -144
  26. package/dist/collections/async/async-queue.d.ts.map +0 -1
  27. package/dist/collections/async/async-queue.js +0 -347
  28. package/dist/collections/async/async-queue.js.map +0 -1
  29. package/dist/collections/async/channels.d.ts +0 -188
  30. package/dist/collections/async/channels.d.ts.map +0 -1
  31. package/dist/collections/async/channels.js +0 -312
  32. package/dist/collections/async/channels.js.map +0 -1
  33. package/dist/collections/behaviors/bounded.d.ts +0 -79
  34. package/dist/collections/behaviors/bounded.d.ts.map +0 -1
  35. package/dist/collections/behaviors/bounded.js +0 -384
  36. package/dist/collections/behaviors/bounded.js.map +0 -1
  37. package/dist/collections/behaviors/evented.d.ts +0 -154
  38. package/dist/collections/behaviors/evented.d.ts.map +0 -1
  39. package/dist/collections/behaviors/evented.js +0 -299
  40. package/dist/collections/behaviors/evented.js.map +0 -1
  41. package/dist/collections/behaviors/lru.d.ts +0 -84
  42. package/dist/collections/behaviors/lru.d.ts.map +0 -1
  43. package/dist/collections/behaviors/lru.js +0 -330
  44. package/dist/collections/behaviors/lru.js.map +0 -1
  45. package/dist/collections/behaviors/readonly.d.ts +0 -73
  46. package/dist/collections/behaviors/readonly.d.ts.map +0 -1
  47. package/dist/collections/behaviors/readonly.js +0 -158
  48. package/dist/collections/behaviors/readonly.js.map +0 -1
  49. package/dist/collections/behaviors/safe.d.ts +0 -163
  50. package/dist/collections/behaviors/safe.d.ts.map +0 -1
  51. package/dist/collections/behaviors/safe.js +0 -172
  52. package/dist/collections/behaviors/safe.js.map +0 -1
  53. package/dist/collections/behaviors/synchronized.d.ts +0 -88
  54. package/dist/collections/behaviors/synchronized.d.ts.map +0 -1
  55. package/dist/collections/behaviors/synchronized.js +0 -294
  56. package/dist/collections/behaviors/synchronized.js.map +0 -1
  57. package/dist/collections/behaviors/ttl.d.ts +0 -118
  58. package/dist/collections/behaviors/ttl.d.ts.map +0 -1
  59. package/dist/collections/behaviors/ttl.js +0 -338
  60. package/dist/collections/behaviors/ttl.js.map +0 -1
  61. package/dist/collections/core/effects.d.ts +0 -176
  62. package/dist/collections/core/effects.d.ts.map +0 -1
  63. package/dist/collections/core/effects.js +0 -180
  64. package/dist/collections/core/effects.js.map +0 -1
  65. package/dist/collections/core/events.d.ts +0 -192
  66. package/dist/collections/core/events.d.ts.map +0 -1
  67. package/dist/collections/core/events.js +0 -291
  68. package/dist/collections/core/events.js.map +0 -1
  69. package/dist/collections/core/middleware.d.ts +0 -231
  70. package/dist/collections/core/middleware.d.ts.map +0 -1
  71. package/dist/collections/core/middleware.js +0 -161
  72. package/dist/collections/core/middleware.js.map +0 -1
  73. package/dist/collections/core/policies.d.ts +0 -220
  74. package/dist/collections/core/policies.d.ts.map +0 -1
  75. package/dist/collections/core/policies.js +0 -48
  76. package/dist/collections/core/policies.js.map +0 -1
  77. package/dist/collections/core/traits.d.ts +0 -142
  78. package/dist/collections/core/traits.d.ts.map +0 -1
  79. package/dist/collections/core/traits.js +0 -8
  80. package/dist/collections/core/traits.js.map +0 -1
  81. package/dist/collections/examples.d.ts +0 -13
  82. package/dist/collections/examples.d.ts.map +0 -1
  83. package/dist/collections/examples.js +0 -302
  84. package/dist/collections/examples.js.map +0 -1
  85. package/dist/collections/fx/collectors.d.ts +0 -190
  86. package/dist/collections/fx/collectors.d.ts.map +0 -1
  87. package/dist/collections/fx/collectors.js +0 -369
  88. package/dist/collections/fx/collectors.js.map +0 -1
  89. package/dist/collections/fx/iter.d.ts +0 -166
  90. package/dist/collections/fx/iter.d.ts.map +0 -1
  91. package/dist/collections/fx/iter.js +0 -421
  92. package/dist/collections/fx/iter.js.map +0 -1
  93. package/dist/collections/impl/array-deque.d.ts +0 -107
  94. package/dist/collections/impl/array-deque.d.ts.map +0 -1
  95. package/dist/collections/impl/array-deque.js +0 -381
  96. package/dist/collections/impl/array-deque.js.map +0 -1
  97. package/dist/collections/impl/array-list.d.ts +0 -101
  98. package/dist/collections/impl/array-list.d.ts.map +0 -1
  99. package/dist/collections/impl/array-list.js +0 -387
  100. package/dist/collections/impl/array-list.js.map +0 -1
  101. package/dist/collections/impl/hash-map.d.ts +0 -141
  102. package/dist/collections/impl/hash-map.d.ts.map +0 -1
  103. package/dist/collections/impl/hash-map.js +0 -450
  104. package/dist/collections/impl/hash-map.js.map +0 -1
  105. package/dist/collections/impl/hash-set.d.ts +0 -125
  106. package/dist/collections/impl/hash-set.d.ts.map +0 -1
  107. package/dist/collections/impl/hash-set.js +0 -264
  108. package/dist/collections/impl/hash-set.js.map +0 -1
  109. package/dist/collections/impl/linked-hash-map.d.ts +0 -141
  110. package/dist/collections/impl/linked-hash-map.d.ts.map +0 -1
  111. package/dist/collections/impl/linked-hash-map.js +0 -472
  112. package/dist/collections/impl/linked-hash-map.js.map +0 -1
  113. package/dist/collections/impl/linked-list.d.ts +0 -109
  114. package/dist/collections/impl/linked-list.d.ts.map +0 -1
  115. package/dist/collections/impl/linked-list.js +0 -491
  116. package/dist/collections/impl/linked-list.js.map +0 -1
  117. package/dist/collections/impl/priority-queue.d.ts +0 -134
  118. package/dist/collections/impl/priority-queue.d.ts.map +0 -1
  119. package/dist/collections/impl/priority-queue.js +0 -336
  120. package/dist/collections/impl/priority-queue.js.map +0 -1
  121. package/dist/collections/impl/tree-map.d.ts +0 -146
  122. package/dist/collections/impl/tree-map.d.ts.map +0 -1
  123. package/dist/collections/impl/tree-map.js +0 -781
  124. package/dist/collections/impl/tree-map.js.map +0 -1
  125. package/dist/collections/impl/tree-set.d.ts +0 -112
  126. package/dist/collections/impl/tree-set.d.ts.map +0 -1
  127. package/dist/collections/impl/tree-set.js +0 -374
  128. package/dist/collections/impl/tree-set.js.map +0 -1
  129. package/dist/collections/index.d.ts +0 -105
  130. package/dist/collections/index.d.ts.map +0 -1
  131. package/dist/collections/index.js +0 -135
  132. package/dist/collections/index.js.map +0 -1
  133. package/dist/collections/interfaces/collection.d.ts +0 -119
  134. package/dist/collections/interfaces/collection.d.ts.map +0 -1
  135. package/dist/collections/interfaces/collection.js +0 -8
  136. package/dist/collections/interfaces/collection.js.map +0 -1
  137. package/dist/collections/interfaces/list.d.ts +0 -247
  138. package/dist/collections/interfaces/list.d.ts.map +0 -1
  139. package/dist/collections/interfaces/list.js +0 -8
  140. package/dist/collections/interfaces/list.js.map +0 -1
  141. package/dist/collections/interfaces/map.d.ts +0 -344
  142. package/dist/collections/interfaces/map.d.ts.map +0 -1
  143. package/dist/collections/interfaces/map.js +0 -8
  144. package/dist/collections/interfaces/map.js.map +0 -1
  145. package/dist/collections/interfaces/queue.d.ts +0 -304
  146. package/dist/collections/interfaces/queue.d.ts.map +0 -1
  147. package/dist/collections/interfaces/queue.js +0 -8
  148. package/dist/collections/interfaces/queue.js.map +0 -1
  149. package/dist/collections/interfaces/set.d.ts +0 -137
  150. package/dist/collections/interfaces/set.d.ts.map +0 -1
  151. package/dist/collections/interfaces/set.js +0 -8
  152. package/dist/collections/interfaces/set.js.map +0 -1
  153. package/dist/collections/storage/api.d.ts +0 -109
  154. package/dist/collections/storage/api.d.ts.map +0 -1
  155. package/dist/collections/storage/api.js +0 -182
  156. package/dist/collections/storage/api.js.map +0 -1
  157. package/dist/collections/storage/hybrid.d.ts +0 -164
  158. package/dist/collections/storage/hybrid.d.ts.map +0 -1
  159. package/dist/collections/storage/hybrid.js +0 -416
  160. package/dist/collections/storage/hybrid.js.map +0 -1
  161. package/dist/collections/storage/index.d.ts +0 -16
  162. package/dist/collections/storage/index.d.ts.map +0 -1
  163. package/dist/collections/storage/index.js +0 -13
  164. package/dist/collections/storage/index.js.map +0 -1
  165. package/dist/collections/storage/interface.d.ts +0 -141
  166. package/dist/collections/storage/interface.d.ts.map +0 -1
  167. package/dist/collections/storage/interface.js +0 -23
  168. package/dist/collections/storage/interface.js.map +0 -1
  169. package/dist/collections/storage/memory.d.ts +0 -68
  170. package/dist/collections/storage/memory.d.ts.map +0 -1
  171. package/dist/collections/storage/memory.js +0 -154
  172. package/dist/collections/storage/memory.js.map +0 -1
  173. package/dist/collections/utils/defaults.d.ts +0 -135
  174. package/dist/collections/utils/defaults.d.ts.map +0 -1
  175. package/dist/collections/utils/defaults.js +0 -322
  176. package/dist/collections/utils/defaults.js.map +0 -1
  177. package/dist/collections/utils/factories.d.ts +0 -144
  178. package/dist/collections/utils/factories.d.ts.map +0 -1
  179. package/dist/collections/utils/factories.js +0 -293
  180. package/dist/collections/utils/factories.js.map +0 -1
  181. package/dist/collections/utils/helpers.d.ts +0 -137
  182. package/dist/collections/utils/helpers.d.ts.map +0 -1
  183. package/dist/collections/utils/helpers.js +0 -221
  184. package/dist/collections/utils/helpers.js.map +0 -1
  185. package/dist/collections.d.ts +0 -12
  186. package/dist/collections.d.ts.map +0 -1
  187. package/dist/collections.js +0 -10
  188. package/dist/collections.js.map +0 -1
  189. package/dist/components/define.d.ts +0 -134
  190. package/dist/components/define.d.ts.map +0 -1
  191. package/dist/components/define.js +0 -486
  192. package/dist/components/define.js.map +0 -1
  193. package/dist/components/index.d.ts +0 -39
  194. package/dist/components/index.d.ts.map +0 -1
  195. package/dist/components/index.js +0 -38
  196. package/dist/components/index.js.map +0 -1
  197. package/dist/components/types.d.ts +0 -264
  198. package/dist/components/types.d.ts.map +0 -1
  199. package/dist/components/types.js +0 -46
  200. package/dist/components/types.js.map +0 -1
  201. package/dist/procedures/storage/adapter.d.ts +0 -148
  202. package/dist/procedures/storage/adapter.d.ts.map +0 -1
  203. package/dist/procedures/storage/adapter.js +0 -214
  204. package/dist/procedures/storage/adapter.js.map +0 -1
  205. package/dist/procedures/storage/api.d.ts +0 -125
  206. package/dist/procedures/storage/api.d.ts.map +0 -1
  207. package/dist/procedures/storage/api.js +0 -220
  208. package/dist/procedures/storage/api.js.map +0 -1
  209. package/dist/procedures/storage/factory.d.ts +0 -134
  210. package/dist/procedures/storage/factory.d.ts.map +0 -1
  211. package/dist/procedures/storage/factory.js +0 -166
  212. package/dist/procedures/storage/factory.js.map +0 -1
  213. package/dist/procedures/storage/hybrid.d.ts +0 -193
  214. package/dist/procedures/storage/hybrid.d.ts.map +0 -1
  215. package/dist/procedures/storage/hybrid.js +0 -519
  216. package/dist/procedures/storage/hybrid.js.map +0 -1
  217. package/dist/procedures/storage/index.d.ts +0 -17
  218. package/dist/procedures/storage/index.d.ts.map +0 -1
  219. package/dist/procedures/storage/index.js +0 -17
  220. package/dist/procedures/storage/index.js.map +0 -1
  221. package/dist/procedures/storage/procedures.d.ts +0 -39
  222. package/dist/procedures/storage/procedures.d.ts.map +0 -1
  223. package/dist/procedures/storage/procedures.js +0 -261
  224. package/dist/procedures/storage/procedures.js.map +0 -1
  225. package/dist/procedures/storage/serialization.d.ts +0 -123
  226. package/dist/procedures/storage/serialization.d.ts.map +0 -1
  227. package/dist/procedures/storage/serialization.js +0 -216
  228. package/dist/procedures/storage/serialization.js.map +0 -1
  229. package/dist/procedures/storage/synced-registry.d.ts +0 -246
  230. package/dist/procedures/storage/synced-registry.d.ts.map +0 -1
  231. package/dist/procedures/storage/synced-registry.js +0 -575
  232. package/dist/procedures/storage/synced-registry.js.map +0 -1
  233. package/dist/procedures/storage/types.d.ts +0 -130
  234. package/dist/procedures/storage/types.d.ts.map +0 -1
  235. package/dist/procedures/storage/types.js +0 -8
  236. package/dist/procedures/storage/types.js.map +0 -1
@@ -1,264 +0,0 @@
1
- /**
2
- * Component Types
3
- *
4
- * Components are procedures that return serializable UI descriptors.
5
- * This enables SSR, caching, and transport over wire.
6
- *
7
- * Components integrate with splay's rendering model where a renderer
8
- * produces output based on data, size, and path context.
9
- */
10
- import type { ZodLike } from "../client/validation/types.js";
11
- import type { ProcedureMetadata, ProcedurePath } from "../procedures/types.js";
12
- import type { EventBus } from "../events/types.js";
13
- /**
14
- * Serializable component output descriptor.
15
- * Can be transported over wire, cached, and hydrated by any framework.
16
- *
17
- * @example
18
- * ```typescript
19
- * const descriptor: ComponentOutput = {
20
- * type: "user-card",
21
- * props: {
22
- * name: "John Doe",
23
- * avatar: "/images/john.png",
24
- * },
25
- * children: [
26
- * { type: "badge", props: { label: "Admin" } },
27
- * ],
28
- * };
29
- * ```
30
- */
31
- export interface ComponentOutput {
32
- /** Component type identifier (maps to registered component) */
33
- type: string;
34
- /** Serializable props for the component */
35
- props: Record<string, unknown>;
36
- /** Nested child descriptors (optional) */
37
- children?: ComponentOutput[];
38
- /** Component key for reconciliation (optional) */
39
- key?: string;
40
- }
41
- /**
42
- * Fragment output - multiple components without wrapper.
43
- */
44
- export interface FragmentOutput {
45
- type: "__fragment__";
46
- children: ComponentOutput[];
47
- }
48
- /**
49
- * Null output - render nothing.
50
- */
51
- export interface NullOutput {
52
- type: "__null__";
53
- }
54
- /**
55
- * Any valid component output.
56
- */
57
- export type AnyComponentOutput = ComponentOutput | FragmentOutput | NullOutput;
58
- /**
59
- * Size information for responsive rendering.
60
- */
61
- export interface Size {
62
- width: number;
63
- height: number;
64
- }
65
- /**
66
- * Context passed to component factories.
67
- * Compatible with splay's RenderContext.
68
- *
69
- * @example
70
- * ```typescript
71
- * factory: (ctx) => ({
72
- * type: "user-card",
73
- * props: {
74
- * user: ctx.data,
75
- * compact: ctx.size.width < 400,
76
- * },
77
- * children: ctx.data.posts?.map((post, i) =>
78
- * ctx.render(post, ctx.size, `${ctx.path}.posts[${i}]`)
79
- * ),
80
- * })
81
- * ```
82
- */
83
- export interface ComponentContext<TData = unknown> {
84
- /** Input data for the component */
85
- data: TData;
86
- /** Available rendering size */
87
- size: Size;
88
- /** Path in the render tree (for debugging and keys) */
89
- path: string;
90
- /** Current depth in the render tree */
91
- depth: number;
92
- /**
93
- * Render a child component.
94
- * Delegates to the renderer to produce a ComponentOutput.
95
- *
96
- * @param data - Data for the child component
97
- * @param size - Size available for the child
98
- * @param path - Path for the child (for keys and debugging)
99
- * @returns ComponentOutput from the child render
100
- */
101
- render: (data: unknown, size: Size, path: string) => ComponentOutput | Promise<ComponentOutput>;
102
- /**
103
- * Event bus for streaming coordination.
104
- * Available when executing in a procedure context.
105
- */
106
- bus?: EventBus;
107
- /**
108
- * Additional metadata from the procedure context.
109
- */
110
- metadata?: Record<string, unknown>;
111
- }
112
- /**
113
- * Component factory function (single output).
114
- * Returns a serializable component descriptor.
115
- */
116
- export type ComponentFactory<TData = unknown> = (ctx: ComponentContext<TData>) => ComponentOutput | Promise<ComponentOutput>;
117
- /**
118
- * Streaming component factory (multi-yield).
119
- * Yields descriptors over time for live updates.
120
- */
121
- export type StreamingComponentFactory<TData = unknown> = (ctx: ComponentContext<TData>) => AsyncGenerator<ComponentOutput, void, unknown>;
122
- /**
123
- * Any component factory (single or streaming).
124
- */
125
- export type AnyComponentFactory<TData = unknown> = ComponentFactory<TData> | StreamingComponentFactory<TData>;
126
- /**
127
- * Component metadata (extends ProcedureMetadata).
128
- */
129
- export interface ComponentMetadata extends ProcedureMetadata {
130
- /** Component category for organization */
131
- category?: string;
132
- /** Whether the component supports streaming updates */
133
- streaming?: boolean;
134
- /** Default size constraints */
135
- defaultSize?: Size;
136
- /** Minimum size constraints */
137
- minSize?: Size;
138
- /** Maximum size constraints */
139
- maxSize?: Size;
140
- }
141
- /**
142
- * Component definition.
143
- * Wraps a factory function with type information and metadata.
144
- *
145
- * @example
146
- * ```typescript
147
- * const userCard: ComponentDefinition<User> = {
148
- * type: "user-card",
149
- * namespace: "ui",
150
- * input: userSchema,
151
- * metadata: {
152
- * description: "Displays user information",
153
- * category: "profile",
154
- * },
155
- * factory: (ctx) => ({
156
- * type: "user-card",
157
- * props: { user: ctx.data },
158
- * }),
159
- * };
160
- * ```
161
- */
162
- export interface ComponentDefinition<TData = unknown> {
163
- /** Component type identifier */
164
- type: string;
165
- /**
166
- * Namespace for the component (optional).
167
- * Results in path: ["components", namespace, type]
168
- *
169
- * @example
170
- * namespace: "ui" → ["components", "ui", "user-card"]
171
- */
172
- namespace?: string;
173
- /**
174
- * Input schema for validating component data.
175
- * Optional - if not provided, accepts any data.
176
- */
177
- input?: ZodLike<TData>;
178
- /**
179
- * Component metadata for documentation and tooling.
180
- */
181
- metadata?: ComponentMetadata;
182
- /**
183
- * Whether this component streams updates.
184
- * When true, factory is expected to be a generator.
185
- */
186
- streaming?: boolean;
187
- /**
188
- * Component factory function.
189
- * Can be a regular function (single output) or generator (streaming).
190
- */
191
- factory: AnyComponentFactory<TData>;
192
- }
193
- /**
194
- * Any component definition (type-erased for storage).
195
- */
196
- export type AnyComponentDefinition = ComponentDefinition<unknown>;
197
- /**
198
- * Registered component with resolved path.
199
- */
200
- export interface RegisteredComponent<TData = unknown> {
201
- /** Full procedure path */
202
- path: ProcedurePath;
203
- /** Original component definition */
204
- definition: ComponentDefinition<TData>;
205
- }
206
- /**
207
- * Component bundle - collection of components with shared namespace.
208
- *
209
- * @example
210
- * ```typescript
211
- * const uiComponents: ComponentBundle = {
212
- * namespace: "ui",
213
- * components: [
214
- * buttonComponent,
215
- * cardComponent,
216
- * modalComponent,
217
- * ],
218
- * };
219
- * ```
220
- */
221
- export interface ComponentBundle {
222
- /** Shared namespace for all components in bundle */
223
- namespace: string;
224
- /** Component definitions */
225
- components: AnyComponentDefinition[];
226
- /** Bundle metadata */
227
- metadata?: {
228
- /** Bundle name */
229
- name?: string;
230
- /** Bundle description */
231
- description?: string;
232
- /** Bundle version */
233
- version?: string;
234
- };
235
- }
236
- /**
237
- * Infer input type from a component definition.
238
- */
239
- export type InferComponentInput<T> = T extends ComponentDefinition<infer TData> ? TData : unknown;
240
- /**
241
- * Infer whether a component is streaming.
242
- */
243
- export type IsStreamingComponent<T> = T extends ComponentDefinition<unknown> ? T["streaming"] extends true ? true : false : false;
244
- /**
245
- * Create a null output (render nothing).
246
- */
247
- export declare function nullOutput(): NullOutput;
248
- /**
249
- * Create a fragment output (multiple children without wrapper).
250
- */
251
- export declare function fragment(...children: ComponentOutput[]): FragmentOutput;
252
- /**
253
- * Check if output is a fragment.
254
- */
255
- export declare function isFragment(output: AnyComponentOutput): output is FragmentOutput;
256
- /**
257
- * Check if output is null.
258
- */
259
- export declare function isNullOutput(output: AnyComponentOutput): output is NullOutput;
260
- /**
261
- * Check if a factory is a streaming generator.
262
- */
263
- export declare function isStreamingFactory<TData>(factory: AnyComponentFactory<TData>): factory is StreamingComponentFactory<TData>;
264
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAMnD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,eAAe;IA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AC,KAAK,CAAC,GAClC,OAAO,IAAI,yBAAyB,CAAC,KAAK,CAAC,CAK7C"}
@@ -1,46 +0,0 @@
1
- /**
2
- * Component Types
3
- *
4
- * Components are procedures that return serializable UI descriptors.
5
- * This enables SSR, caching, and transport over wire.
6
- *
7
- * Components integrate with splay's rendering model where a renderer
8
- * produces output based on data, size, and path context.
9
- */
10
- // =============================================================================
11
- // Output Helpers
12
- // =============================================================================
13
- /**
14
- * Create a null output (render nothing).
15
- */
16
- export function nullOutput() {
17
- return { type: "__null__" };
18
- }
19
- /**
20
- * Create a fragment output (multiple children without wrapper).
21
- */
22
- export function fragment(...children) {
23
- return { type: "__fragment__", children };
24
- }
25
- /**
26
- * Check if output is a fragment.
27
- */
28
- export function isFragment(output) {
29
- return output.type === "__fragment__";
30
- }
31
- /**
32
- * Check if output is null.
33
- */
34
- export function isNullOutput(output) {
35
- return output.type === "__null__";
36
- }
37
- /**
38
- * Check if a factory is a streaming generator.
39
- */
40
- export function isStreamingFactory(factory) {
41
- // The tag of the prototype, not `constructor.name`: an own `constructor` property, or a
42
- // bundler that renames classes, does not change it. A plain function that returns a
43
- // generator is not detected here: the handler of a component streams its result anyway.
44
- return Object.prototype.toString.call(factory) === "[object AsyncGeneratorFunction]";
45
- }
46
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkTH,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAG,QAA2B;IACrD,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAA0B;IACnD,OAAO,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAA0B;IACrD,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAmC;IAEnC,wFAAwF;IACxF,oFAAoF;IACpF,wFAAwF;IACxF,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,iCAAiC,CAAC;AACvF,CAAC"}
@@ -1,148 +0,0 @@
1
- /**
2
- * Procedure Storage Adapter
3
- *
4
- * Wraps CollectionStorage<SerializedProcedure> to provide procedure-specific
5
- * storage operations with serialization/deserialization.
6
- */
7
- import type { CollectionStorage } from "@mark1russell7/client-collections";
8
- import type { AnyProcedure, ProcedurePath } from "../types.js";
9
- import type { SerializedProcedure, HandlerLoader } from "./types.js";
10
- import { type SerializeOptions } from "./serialization.js";
11
- /**
12
- * Options for ProcedureStorageAdapter.
13
- */
14
- export interface ProcedureStorageAdapterOptions {
15
- /** Handler loader for restoring handlers from references */
16
- handlerLoader?: HandlerLoader | undefined;
17
- /** Default serialization options */
18
- serializeOptions?: SerializeOptions | undefined;
19
- }
20
- /**
21
- * Adapter that wraps CollectionStorage for procedure-specific operations.
22
- *
23
- * Handles serialization/deserialization of procedures and provides
24
- * convenience methods for common operations.
25
- *
26
- * @example
27
- * ```typescript
28
- * const storage = new InMemoryStorage<SerializedProcedure>();
29
- * const adapter = new ProcedureStorageAdapter(storage, {
30
- * handlerLoader: createDynamicHandlerLoader(),
31
- * });
32
- *
33
- * // Store a procedure
34
- * await adapter.store(myProcedure);
35
- *
36
- * // Load a procedure
37
- * const proc = await adapter.load(['lib', 'scan']);
38
- * ```
39
- */
40
- export declare class ProcedureStorageAdapter {
41
- private readonly storage;
42
- private readonly handlerLoader;
43
- private readonly serializeOptions;
44
- constructor(storage: CollectionStorage<SerializedProcedure>, options?: ProcedureStorageAdapterOptions);
45
- /**
46
- * Store a procedure.
47
- *
48
- * @param procedure - Procedure to store
49
- * @param options - Override default serialization options
50
- * @returns The record that the storage got
51
- */
52
- store(procedure: AnyProcedure, options?: SerializeOptions): Promise<SerializedProcedure>;
53
- /**
54
- * Load a procedure by path.
55
- *
56
- * @param path - Procedure path
57
- * @returns Procedure or undefined if not found
58
- */
59
- load(path: ProcedurePath): Promise<AnyProcedure | undefined>;
60
- /**
61
- * Check if a procedure exists in storage.
62
- *
63
- * @param path - Procedure path
64
- * @returns True if procedure exists
65
- */
66
- has(path: ProcedurePath): Promise<boolean>;
67
- /**
68
- * Remove a procedure from storage.
69
- *
70
- * @param path - Procedure path
71
- * @returns True if procedure was removed
72
- */
73
- remove(path: ProcedurePath): Promise<boolean>;
74
- /**
75
- * Load all procedures from storage.
76
- *
77
- * @returns Array of all procedures
78
- */
79
- loadAll(): Promise<AnyProcedure[]>;
80
- /**
81
- * Load procedures matching a path prefix.
82
- *
83
- * @param prefix - Path prefix to match
84
- * @returns Array of matching procedures
85
- *
86
- * @example
87
- * ```typescript
88
- * // Load all lib.* procedures
89
- * const libProcedures = await adapter.loadByPrefix(['lib']);
90
- * ```
91
- */
92
- loadByPrefix(prefix: ProcedurePath): Promise<AnyProcedure[]>;
93
- /**
94
- * Store multiple procedures.
95
- *
96
- * @param procedures - Procedures to store
97
- * @param options - Override default serialization options, or a function that gives the
98
- * options of each procedure (for example, its handler reference)
99
- * @returns The records that the storage got
100
- */
101
- storeAll(procedures: AnyProcedure[], options?: SerializeOptions | ((procedure: AnyProcedure) => SerializeOptions | undefined)): Promise<SerializedProcedure[]>;
102
- /**
103
- * Remove multiple procedures.
104
- *
105
- * @param paths - Procedure paths to remove
106
- * @returns Number of procedures removed
107
- */
108
- removeAll(paths: ProcedurePath[]): Promise<number>;
109
- /**
110
- * Clear all procedures from storage.
111
- */
112
- clear(): Promise<void>;
113
- /**
114
- * Get the number of stored procedures.
115
- */
116
- size(): Promise<number>;
117
- /**
118
- * List all stored procedure paths.
119
- *
120
- * @returns Array of procedure paths
121
- */
122
- listPaths(): Promise<ProcedurePath[]>;
123
- /**
124
- * Get the raw serialized data for a procedure.
125
- * Useful for debugging or custom processing.
126
- *
127
- * @param path - Procedure path
128
- * @returns Serialized procedure data or undefined
129
- */
130
- getRaw(path: ProcedurePath): Promise<SerializedProcedure | undefined>;
131
- /**
132
- * Get all raw serialized data.
133
- * Useful for debugging or backup.
134
- *
135
- * @returns Array of serialized procedures
136
- */
137
- getAllRaw(): Promise<SerializedProcedure[]>;
138
- /**
139
- * Close the underlying storage.
140
- */
141
- close(): Promise<void>;
142
- /**
143
- * Get the underlying storage instance.
144
- * Use for advanced operations or testing.
145
- */
146
- getStorage(): CollectionStorage<SerializedProcedure>;
147
- }
148
- //# sourceMappingURL=adapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/procedures/storage/adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAM5B;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,4DAA4D;IAC5D,aAAa,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAE1C,oCAAoC;IACpC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyC;IACjE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,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,EAAE,aAAa,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAG1E;IAED;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAEhD;IAMD;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;IAED;;;OAGG;IACH,UAAU,IAAI,iBAAiB,CAAC,mBAAmB,CAAC,CAEnD;CACF"}
@@ -1,214 +0,0 @@
1
- /**
2
- * Procedure Storage Adapter
3
- *
4
- * Wraps CollectionStorage<SerializedProcedure> to provide procedure-specific
5
- * storage operations with serialization/deserialization.
6
- */
7
- import { pathToKey } from "../types.js";
8
- import { serializeProcedure, deserializeProcedure, getProcedureKey, } from "./serialization.js";
9
- /**
10
- * Adapter that wraps CollectionStorage for procedure-specific operations.
11
- *
12
- * Handles serialization/deserialization of procedures and provides
13
- * convenience methods for common operations.
14
- *
15
- * @example
16
- * ```typescript
17
- * const storage = new InMemoryStorage<SerializedProcedure>();
18
- * const adapter = new ProcedureStorageAdapter(storage, {
19
- * handlerLoader: createDynamicHandlerLoader(),
20
- * });
21
- *
22
- * // Store a procedure
23
- * await adapter.store(myProcedure);
24
- *
25
- * // Load a procedure
26
- * const proc = await adapter.load(['lib', 'scan']);
27
- * ```
28
- */
29
- export class ProcedureStorageAdapter {
30
- storage;
31
- handlerLoader;
32
- serializeOptions;
33
- constructor(storage, options = {}) {
34
- this.storage = storage;
35
- this.handlerLoader = options.handlerLoader;
36
- this.serializeOptions = options.serializeOptions ?? {};
37
- }
38
- // ===========================================================================
39
- // Single Item Operations
40
- // ===========================================================================
41
- /**
42
- * Store a procedure.
43
- *
44
- * @param procedure - Procedure to store
45
- * @param options - Override default serialization options
46
- * @returns The record that the storage got
47
- */
48
- async store(procedure, options) {
49
- const key = getProcedureKey(procedure);
50
- const serialized = serializeProcedure(procedure, {
51
- ...this.serializeOptions,
52
- ...options,
53
- });
54
- await this.storage.set(key, serialized);
55
- return serialized;
56
- }
57
- /**
58
- * Load a procedure by path.
59
- *
60
- * @param path - Procedure path
61
- * @returns Procedure or undefined if not found
62
- */
63
- async load(path) {
64
- const key = pathToKey(path);
65
- const data = await this.storage.get(key);
66
- if (!data)
67
- return undefined;
68
- return deserializeProcedure(data, {
69
- handlerLoader: this.handlerLoader,
70
- });
71
- }
72
- /**
73
- * Check if a procedure exists in storage.
74
- *
75
- * @param path - Procedure path
76
- * @returns True if procedure exists
77
- */
78
- async has(path) {
79
- const key = pathToKey(path);
80
- return this.storage.has(key);
81
- }
82
- /**
83
- * Remove a procedure from storage.
84
- *
85
- * @param path - Procedure path
86
- * @returns True if procedure was removed
87
- */
88
- async remove(path) {
89
- const key = pathToKey(path);
90
- return this.storage.delete(key);
91
- }
92
- // ===========================================================================
93
- // Bulk Operations
94
- // ===========================================================================
95
- /**
96
- * Load all procedures from storage.
97
- *
98
- * @returns Array of all procedures
99
- */
100
- async loadAll() {
101
- const items = await this.storage.getAll();
102
- return Promise.all(items.map((item) => deserializeProcedure(item, { handlerLoader: this.handlerLoader })));
103
- }
104
- /**
105
- * Load procedures matching a path prefix.
106
- *
107
- * @param prefix - Path prefix to match
108
- * @returns Array of matching procedures
109
- *
110
- * @example
111
- * ```typescript
112
- * // Load all lib.* procedures
113
- * const libProcedures = await adapter.loadByPrefix(['lib']);
114
- * ```
115
- */
116
- async loadByPrefix(prefix) {
117
- const prefixKey = pathToKey(prefix);
118
- const items = await this.storage.find((item) => {
119
- const itemKey = pathToKey(item.path);
120
- return itemKey === prefixKey || itemKey.startsWith(prefixKey + ".");
121
- });
122
- return Promise.all(items.map((item) => deserializeProcedure(item, { handlerLoader: this.handlerLoader })));
123
- }
124
- /**
125
- * Store multiple procedures.
126
- *
127
- * @param procedures - Procedures to store
128
- * @param options - Override default serialization options, or a function that gives the
129
- * options of each procedure (for example, its handler reference)
130
- * @returns The records that the storage got
131
- */
132
- async storeAll(procedures, options) {
133
- const items = procedures.map((proc) => [
134
- getProcedureKey(proc),
135
- serializeProcedure(proc, {
136
- ...this.serializeOptions,
137
- ...(typeof options === "function" ? options(proc) : options),
138
- }),
139
- ]);
140
- await this.storage.setBatch(items);
141
- return items.map(([, serialized]) => serialized);
142
- }
143
- /**
144
- * Remove multiple procedures.
145
- *
146
- * @param paths - Procedure paths to remove
147
- * @returns Number of procedures removed
148
- */
149
- async removeAll(paths) {
150
- const keys = paths.map(pathToKey);
151
- return this.storage.deleteBatch(keys);
152
- }
153
- /**
154
- * Clear all procedures from storage.
155
- */
156
- async clear() {
157
- await this.storage.clear();
158
- }
159
- // ===========================================================================
160
- // Info Operations
161
- // ===========================================================================
162
- /**
163
- * Get the number of stored procedures.
164
- */
165
- async size() {
166
- return this.storage.size();
167
- }
168
- /**
169
- * List all stored procedure paths.
170
- *
171
- * @returns Array of procedure paths
172
- */
173
- async listPaths() {
174
- const items = await this.storage.getAll();
175
- return items.map((item) => item.path);
176
- }
177
- /**
178
- * Get the raw serialized data for a procedure.
179
- * Useful for debugging or custom processing.
180
- *
181
- * @param path - Procedure path
182
- * @returns Serialized procedure data or undefined
183
- */
184
- async getRaw(path) {
185
- const key = pathToKey(path);
186
- return this.storage.get(key);
187
- }
188
- /**
189
- * Get all raw serialized data.
190
- * Useful for debugging or backup.
191
- *
192
- * @returns Array of serialized procedures
193
- */
194
- async getAllRaw() {
195
- return this.storage.getAll();
196
- }
197
- // ===========================================================================
198
- // Lifecycle
199
- // ===========================================================================
200
- /**
201
- * Close the underlying storage.
202
- */
203
- async close() {
204
- await this.storage.close();
205
- }
206
- /**
207
- * Get the underlying storage instance.
208
- * Use for advanced operations or testing.
209
- */
210
- getStorage() {
211
- return this.storage;
212
- }
213
- }
214
- //# sourceMappingURL=adapter.js.map