@orieljs/live 0.1.0-alpha.3 → 0.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +9 -0
- package/dist/index.d.ts +33 -5
- package/dist/index.js +127 -22
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Oriel
|
|
2
|
+
Copyright 2026 meeeet-dev and Oriel contributors
|
|
3
|
+
|
|
4
|
+
This product includes software developed by the Oriel project
|
|
5
|
+
(https://orieljs.vercel.app, https://github.com/orieljs).
|
|
6
|
+
|
|
7
|
+
Oriel is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
8
|
+
The Oriel name and logo are not covered by that license; see TRADEMARKS.md
|
|
9
|
+
(https://github.com/orieljs/framework/blob/main/TRADEMARKS.md).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _orieljs_contracts from '@orieljs/contracts';
|
|
2
|
+
import { Class, Rules, MessageBag, LiveEffects, Htmlable, LiveSnapshot, LiveManager, Application, HttpRequest, LiveUpdateRequest, LiveUpdateResponse, OrielError, ErrorKind, MiddlewareClass, Router } from '@orieljs/contracts';
|
|
2
3
|
import { ServiceProvider } from '@orieljs/support';
|
|
3
4
|
|
|
4
5
|
/** Marks Live component classes (Symbol.for, so two copies of the package agree). */
|
|
@@ -84,13 +85,22 @@ declare function Locked(_target: unknown, context: ClassFieldDecoratorContext |
|
|
|
84
85
|
/** @Computed: a getter cached for the rest of the request, never part of the component's state. */
|
|
85
86
|
declare function Computed<T>(getter: (this: object) => T, context: ClassGetterDecoratorContext): (this: object) => T;
|
|
86
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Runs Live.test()'s mount and each update. The testing package binds one for every test, so they run in a request
|
|
90
|
+
* scope like the test's HTTP requests (a request, the carried session, actingAs users) and what they change carries
|
|
91
|
+
* on to the next request. Without one they run in the current scope.
|
|
92
|
+
*/
|
|
93
|
+
type TestRequestScope = <T>(run: () => Promise<T>) => Promise<T>;
|
|
94
|
+
declare const TestRequestScope: _orieljs_contracts.Token<TestRequestScope>;
|
|
87
95
|
/**
|
|
88
96
|
* Livewire's Livewire::test(): drives one component through the real mount → snapshot → checksum → update pipeline
|
|
89
|
-
* (no HTTP). Actions are async (`await counter.call('increment')`); assertions are
|
|
97
|
+
* (no HTTP), inside the test's request scope. Actions are async (`await counter.call('increment')`); assertions are
|
|
98
|
+
* sync and return `this`.
|
|
90
99
|
*/
|
|
91
100
|
declare class Testable<C extends Component = Component> {
|
|
92
101
|
#private;
|
|
93
102
|
private readonly manager;
|
|
103
|
+
private readonly scope;
|
|
94
104
|
private constructor();
|
|
95
105
|
/** Mounts `component` with `params`, as `<Live component={…} {...params} />` would. */
|
|
96
106
|
static create<C extends Component>(component: Class<C> | string, params?: Record<string, unknown>): Promise<Testable<C>>;
|
|
@@ -178,8 +188,12 @@ declare class LiveComponentManager implements LiveManager {
|
|
|
178
188
|
/** Applies each component's updates and calls, re-renders it and returns its new snapshot and effects. */
|
|
179
189
|
update(request: LiveUpdateRequest): Promise<LiveUpdateResponse>;
|
|
180
190
|
updateComponent(snapshotJson: string, updates: Record<string, unknown>, calls: Call[]): Promise<ComponentResult>;
|
|
181
|
-
/**
|
|
182
|
-
|
|
191
|
+
/**
|
|
192
|
+
* The route action of POST /oriel/live/update. Each component's update runs behind the auth middleware of the route
|
|
193
|
+
* that rendered its page (Livewire's persistent middleware): a signed-out tab gets a 401, never the action. When a
|
|
194
|
+
* middleware answers instead (a redirect), that is the response.
|
|
195
|
+
*/
|
|
196
|
+
handle(request: HttpRequest): Promise<LiveUpdateResponse | Response>;
|
|
183
197
|
/** A full-page component (Route.get('/counter', Counter)): mounted with the route parameters, inside the layout. */
|
|
184
198
|
page(component: Component): Promise<unknown>;
|
|
185
199
|
/** Parses and checks a snapshot: a bad checksum throws before anything is hydrated. */
|
|
@@ -255,4 +269,18 @@ declare class InvalidLiveRequestError extends LiveError {
|
|
|
255
269
|
readonly status: number;
|
|
256
270
|
}
|
|
257
271
|
|
|
258
|
-
|
|
272
|
+
/** The route middleware an update re-applies by default (config live.persistent_middleware), by alias. */
|
|
273
|
+
declare const PERSISTENT_MIDDLEWARE: string[];
|
|
274
|
+
/** A route middleware after alias and group expansion: 'auth:web' → { cls: Authenticate, parameters: ['web'] }. */
|
|
275
|
+
interface PersistentMiddleware {
|
|
276
|
+
readonly cls: MiddlewareClass;
|
|
277
|
+
readonly parameters: readonly string[];
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Livewire's persistent middleware: the route that rendered the page (the component's memo path and method) is
|
|
281
|
+
* matched again, and the middleware among `persistent` (aliases) that it ran are returned, to run before an update.
|
|
282
|
+
* A path no route matches has none.
|
|
283
|
+
*/
|
|
284
|
+
declare function persistentMiddleware(router: Router, persistent: readonly string[], method: string, path: string): PersistentMiddleware[];
|
|
285
|
+
|
|
286
|
+
export { Component, type ComponentResult, Computed, CorruptComponentPayloadError, ErrorBag, InvalidLiveRequestError, Live, LiveComponentManager, LiveComponentNotFoundError, LiveError, type LiveProps, LiveServiceProvider, Locked, MethodNotCallableError, On, PERSISTENT_MIDDLEWARE, PendingEvent, type PersistentMiddleware, PropertyNotUpdatableError, TestRequestScope, Testable, UPDATE_URI, componentName, live, persistentMiddleware };
|
package/dist/index.js
CHANGED
|
@@ -219,8 +219,8 @@ import { inject as inject3 } from "@orieljs/container";
|
|
|
219
219
|
// Testable.ts
|
|
220
220
|
import { AssertionError } from "assert";
|
|
221
221
|
import { isDeepStrictEqual } from "util";
|
|
222
|
-
import { LiveManager as LiveManager2 } from "@orieljs/contracts";
|
|
223
|
-
import { inject as inject2 } from "@orieljs/container";
|
|
222
|
+
import { LiveManager as LiveManager2, token } from "@orieljs/contracts";
|
|
223
|
+
import { Container, currentContainer, inject as inject2 } from "@orieljs/container";
|
|
224
224
|
|
|
225
225
|
// errors.ts
|
|
226
226
|
var LiveError = class extends Error {
|
|
@@ -284,14 +284,14 @@ function rootTag(html, component) {
|
|
|
284
284
|
let rootEnd = -1;
|
|
285
285
|
TOKEN.lastIndex = 0;
|
|
286
286
|
for (let match = TOKEN.exec(source); match !== null; match = TOKEN.exec(source)) {
|
|
287
|
-
const [
|
|
287
|
+
const [token2, closing, opening, selfClosing] = match;
|
|
288
288
|
if (root === void 0 && match.index !== 0) fail2();
|
|
289
289
|
if (depth === 0 && root !== void 0) fail2();
|
|
290
290
|
if (opening !== void 0) {
|
|
291
291
|
const tag = opening.toLowerCase();
|
|
292
292
|
root ??= tag;
|
|
293
293
|
if (selfClosing === "/" || VOID.has(tag)) {
|
|
294
|
-
if (depth === 0) rootEnd = match.index +
|
|
294
|
+
if (depth === 0) rootEnd = match.index + token2.length;
|
|
295
295
|
continue;
|
|
296
296
|
}
|
|
297
297
|
if (RAW_TEXT.has(tag)) {
|
|
@@ -303,7 +303,7 @@ function rootTag(html, component) {
|
|
|
303
303
|
depth++;
|
|
304
304
|
} else if (closing !== void 0) {
|
|
305
305
|
if (--depth < 0) fail2();
|
|
306
|
-
if (depth === 0) rootEnd = match.index +
|
|
306
|
+
if (depth === 0) rootEnd = match.index + token2.length;
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
if (root === void 0 || depth !== 0 || source.slice(rootEnd).trim() !== "") fail2();
|
|
@@ -322,23 +322,31 @@ var fail = (message, actual, expected) => {
|
|
|
322
322
|
throw new AssertionError({ message, actual, expected, operator: "live" });
|
|
323
323
|
};
|
|
324
324
|
var getPath = (target, path) => path.split(".").reduce((node, segment) => typeof node === "object" && node !== null ? node[segment] : void 0, target);
|
|
325
|
+
var TestRequestScope = token("Testing.RequestScope");
|
|
326
|
+
function requestScope() {
|
|
327
|
+
const container = currentContainer() ?? Container.getInstance();
|
|
328
|
+
return container?.bound(TestRequestScope) === true ? container.make(TestRequestScope) : (run) => run();
|
|
329
|
+
}
|
|
325
330
|
var Testable = class _Testable {
|
|
326
|
-
constructor(manager, result) {
|
|
331
|
+
constructor(manager, scope, result) {
|
|
327
332
|
this.manager = manager;
|
|
333
|
+
this.scope = scope;
|
|
328
334
|
this.#snapshot = JSON.stringify(result.snapshot);
|
|
329
335
|
this.#html = result.html ?? "";
|
|
330
336
|
this.#effects = result.effects;
|
|
331
337
|
this.#instance = result.instance;
|
|
332
338
|
}
|
|
333
339
|
manager;
|
|
340
|
+
scope;
|
|
334
341
|
#snapshot;
|
|
335
342
|
#html;
|
|
336
343
|
#effects;
|
|
337
344
|
#instance;
|
|
338
345
|
/** Mounts `component` with `params`, as `<Live component={…} {...params} />` would. */
|
|
339
346
|
static async create(component, params = {}) {
|
|
347
|
+
const scope = requestScope();
|
|
340
348
|
const manager = inject2(LiveManager2);
|
|
341
|
-
return new _Testable(manager, await manager.mountComponent(component, params));
|
|
349
|
+
return new _Testable(manager, scope, await scope(() => manager.mountComponent(component, params)));
|
|
342
350
|
}
|
|
343
351
|
/** The component instance after the last request. */
|
|
344
352
|
instance() {
|
|
@@ -373,7 +381,7 @@ var Testable = class _Testable {
|
|
|
373
381
|
return this.#update({}, [{ method: "$refresh", params: [] }]);
|
|
374
382
|
}
|
|
375
383
|
async #update(updates, calls) {
|
|
376
|
-
const result = await this.manager.updateComponent(this.#snapshot, updates, calls);
|
|
384
|
+
const result = await this.scope(() => this.manager.updateComponent(this.#snapshot, updates, calls));
|
|
377
385
|
this.#snapshot = JSON.stringify(result.snapshot);
|
|
378
386
|
if (result.html !== void 0) this.#html = result.html;
|
|
379
387
|
this.#effects = result.effects;
|
|
@@ -478,9 +486,10 @@ import {
|
|
|
478
486
|
Encrypter,
|
|
479
487
|
HttpRequest,
|
|
480
488
|
Redirector,
|
|
489
|
+
Router,
|
|
481
490
|
ViewFactory
|
|
482
491
|
} from "@orieljs/contracts";
|
|
483
|
-
import { currentContainer } from "@orieljs/container";
|
|
492
|
+
import { currentContainer as currentContainer2 } from "@orieljs/container";
|
|
484
493
|
import { Str as Str2 } from "@orieljs/support";
|
|
485
494
|
|
|
486
495
|
// checksum.ts
|
|
@@ -531,6 +540,79 @@ async function discover(directory) {
|
|
|
531
540
|
return found;
|
|
532
541
|
}
|
|
533
542
|
|
|
543
|
+
// persistent.ts
|
|
544
|
+
var PERSISTENT_MIDDLEWARE = ["auth", "verified", "guest"];
|
|
545
|
+
function canMatch(router) {
|
|
546
|
+
const methods = router;
|
|
547
|
+
return ["getRoutesByMatchOrder", "getPatterns", "getPatternVersion", "getMiddleware", "getMiddlewareGroups"].every((name) => typeof methods[name] === "function");
|
|
548
|
+
}
|
|
549
|
+
function isMatchingRoute(route) {
|
|
550
|
+
const candidate = route;
|
|
551
|
+
return typeof candidate === "object" && candidate !== null && Array.isArray(candidate.methods) && ["match", "gatherMiddleware", "excludedMiddleware"].every((name) => typeof candidate[name] === "function");
|
|
552
|
+
}
|
|
553
|
+
function routePath(path) {
|
|
554
|
+
const trimmed = path.replace(/^\/+|\/+$/g, "").replace(/\/{2,}/g, "/");
|
|
555
|
+
return trimmed === "" ? "" : `/${trimmed}`;
|
|
556
|
+
}
|
|
557
|
+
function expand(references, aliases, groups, out = [], visiting = /* @__PURE__ */ new Set()) {
|
|
558
|
+
for (const reference of references) {
|
|
559
|
+
if (typeof reference === "function") {
|
|
560
|
+
out.push({ cls: reference, parameters: [] });
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
const index = reference.indexOf(":");
|
|
564
|
+
const name = index === -1 ? reference : reference.slice(0, index);
|
|
565
|
+
if (index === -1 && Object.hasOwn(groups, name)) {
|
|
566
|
+
if (visiting.has(name)) continue;
|
|
567
|
+
visiting.add(name);
|
|
568
|
+
expand(groups[name], aliases, groups, out, visiting);
|
|
569
|
+
visiting.delete(name);
|
|
570
|
+
} else if (Object.hasOwn(aliases, name)) {
|
|
571
|
+
out.push({ cls: aliases[name], parameters: index === -1 ? [] : reference.slice(index + 1).split(",") });
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return out;
|
|
575
|
+
}
|
|
576
|
+
function persistentMiddleware(router, persistent, method, path) {
|
|
577
|
+
if (!canMatch(router)) throw new LiveError("Live re-applies the page route's middleware to updates, which needs Oriel's router.");
|
|
578
|
+
const routes = router.getRoutesByMatchOrder();
|
|
579
|
+
if (!Array.isArray(routes) || !routes.every(isMatchingRoute)) throw new LiveError("Live re-applies the page route's middleware to updates, which needs Oriel's routes.");
|
|
580
|
+
const verb = method.toUpperCase();
|
|
581
|
+
const target = routePath(path);
|
|
582
|
+
const patterns = router.getPatterns();
|
|
583
|
+
const version = router.getPatternVersion();
|
|
584
|
+
const route = routes.find((candidate) => candidate.methods.includes(verb) && candidate.match(target, patterns, version) !== void 0);
|
|
585
|
+
if (route === void 0) return [];
|
|
586
|
+
const aliases = router.getMiddleware();
|
|
587
|
+
const groups = router.getMiddlewareGroups();
|
|
588
|
+
const wanted = new Set(persistent.flatMap((name) => Object.hasOwn(aliases, name) ? [aliases[name]] : []));
|
|
589
|
+
const excluded = new Set(expand(route.excludedMiddleware(), aliases, groups).map((entry) => entry.cls));
|
|
590
|
+
const ids = /* @__PURE__ */ new Map();
|
|
591
|
+
const seen = /* @__PURE__ */ new Set();
|
|
592
|
+
return expand(route.gatherMiddleware(), aliases, groups).filter((entry) => {
|
|
593
|
+
if (!ids.has(entry.cls)) ids.set(entry.cls, ids.size);
|
|
594
|
+
const key = `${ids.get(entry.cls)}:${entry.parameters.join(",")}`;
|
|
595
|
+
if (!wanted.has(entry.cls) || excluded.has(entry.cls) || seen.has(key)) return false;
|
|
596
|
+
seen.add(key);
|
|
597
|
+
return true;
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
async function throughMiddleware(container, request, middleware, destination) {
|
|
601
|
+
let ran;
|
|
602
|
+
const run = async (index) => {
|
|
603
|
+
if (index === middleware.length) {
|
|
604
|
+
ran = { result: await destination() };
|
|
605
|
+
return new Response(null, { status: 204 });
|
|
606
|
+
}
|
|
607
|
+
const { cls, parameters } = middleware[index];
|
|
608
|
+
const instance = container.make(cls);
|
|
609
|
+
const next = () => run(index + 1);
|
|
610
|
+
return instance.handle(request, next, ...parameters);
|
|
611
|
+
};
|
|
612
|
+
const response = await run(0);
|
|
613
|
+
return ran ? ran.result : response;
|
|
614
|
+
}
|
|
615
|
+
|
|
534
616
|
// security.ts
|
|
535
617
|
import { Collection as Collection2 } from "@orieljs/collections";
|
|
536
618
|
|
|
@@ -679,10 +761,11 @@ function isUpdatable(instance, path) {
|
|
|
679
761
|
|
|
680
762
|
// LiveComponentManager.ts
|
|
681
763
|
var renderContext = new AsyncLocalStorage();
|
|
682
|
-
|
|
683
|
-
|
|
764
|
+
var pageRequest = new AsyncLocalStorage();
|
|
765
|
+
function optional(container, token2) {
|
|
766
|
+
if (!container.bound(token2)) return void 0;
|
|
684
767
|
try {
|
|
685
|
-
return container.make(
|
|
768
|
+
return container.make(token2);
|
|
686
769
|
} catch {
|
|
687
770
|
return void 0;
|
|
688
771
|
}
|
|
@@ -702,7 +785,7 @@ var LiveComponentManager = class {
|
|
|
702
785
|
app;
|
|
703
786
|
/** The request scope when there is one (sessions, the current route), else the application. */
|
|
704
787
|
container() {
|
|
705
|
-
return
|
|
788
|
+
return currentContainer2() ?? this.app;
|
|
706
789
|
}
|
|
707
790
|
registry() {
|
|
708
791
|
return this.container().make(ClassRegistry);
|
|
@@ -761,7 +844,8 @@ var LiveComponentManager = class {
|
|
|
761
844
|
this.prepareComputed(instance);
|
|
762
845
|
await hook(instance, "mount", params);
|
|
763
846
|
const request = optional(this.container(), HttpRequest);
|
|
764
|
-
const
|
|
847
|
+
const page = pageRequest.getStore() ?? { path: request?.path() ?? "", method: request?.method() ?? "GET" };
|
|
848
|
+
const memo = { id: state.id, name, path: page.path, method: page.method, children: {}, errors: {} };
|
|
765
849
|
const { html, tag } = await this.render(instance, memo, {});
|
|
766
850
|
const effects = this.effects(instance);
|
|
767
851
|
const listeners = Object.keys(listenersOf(cls));
|
|
@@ -774,7 +858,8 @@ var LiveComponentManager = class {
|
|
|
774
858
|
async update(request) {
|
|
775
859
|
const components = [];
|
|
776
860
|
for (const component of request.components) {
|
|
777
|
-
const
|
|
861
|
+
const { memo } = this.verify(component.snapshot);
|
|
862
|
+
const result = await pageRequest.run({ path: memo.path, method: memo.method }, () => this.updateComponent(component.snapshot, component.updates, component.calls));
|
|
778
863
|
components.push({ snapshot: JSON.stringify(result.snapshot), effects: result.effects });
|
|
779
864
|
}
|
|
780
865
|
return { components };
|
|
@@ -816,10 +901,27 @@ var LiveComponentManager = class {
|
|
|
816
901
|
if (calls.length > 0) effects.returns = returns;
|
|
817
902
|
return { instance, snapshot: await this.snapshot(instance, memo), effects, html, tag };
|
|
818
903
|
}
|
|
819
|
-
/**
|
|
904
|
+
/**
|
|
905
|
+
* The route action of POST /oriel/live/update. Each component's update runs behind the auth middleware of the route
|
|
906
|
+
* that rendered its page (Livewire's persistent middleware): a signed-out tab gets a 401, never the action. When a
|
|
907
|
+
* middleware answers instead (a redirect), that is the response.
|
|
908
|
+
*/
|
|
820
909
|
async handle(request) {
|
|
821
910
|
if (!this.isLiveRequest(request)) throw new InvalidLiveRequestError("Live update requests need the X-Oriel-Live header.");
|
|
822
|
-
|
|
911
|
+
const container = this.container();
|
|
912
|
+
const persistent = optional(container, ConfigRepository)?.get("live.persistent_middleware", PERSISTENT_MIDDLEWARE) ?? PERSISTENT_MIDDLEWARE;
|
|
913
|
+
const components = [];
|
|
914
|
+
for (const component of this.payload(request).components) {
|
|
915
|
+
const { memo } = this.verify(component.snapshot);
|
|
916
|
+
const middleware = persistentMiddleware(container.make(Router), persistent, memo.method, memo.path);
|
|
917
|
+
const result = await pageRequest.run(
|
|
918
|
+
{ path: memo.path, method: memo.method },
|
|
919
|
+
() => throughMiddleware(container, request, middleware, () => this.updateComponent(component.snapshot, component.updates, component.calls))
|
|
920
|
+
);
|
|
921
|
+
if (result instanceof Response) return result;
|
|
922
|
+
components.push({ snapshot: JSON.stringify(result.snapshot), effects: result.effects });
|
|
923
|
+
}
|
|
924
|
+
return { components };
|
|
823
925
|
}
|
|
824
926
|
/** A full-page component (Route.get('/counter', Counter)): mounted with the route parameters, inside the layout. */
|
|
825
927
|
async page(component) {
|
|
@@ -981,7 +1083,7 @@ var LiveComponentManager = class {
|
|
|
981
1083
|
};
|
|
982
1084
|
|
|
983
1085
|
// LiveServiceProvider.ts
|
|
984
|
-
import { ConfigRepository as ConfigRepository3, ConsoleKernel, HttpRequest as HttpRequest2, LiveManager as LiveManager4, Router } from "@orieljs/contracts";
|
|
1086
|
+
import { ConfigRepository as ConfigRepository3, ConsoleKernel, HttpRequest as HttpRequest2, LiveManager as LiveManager4, Router as Router2 } from "@orieljs/contracts";
|
|
985
1087
|
import { inject as inject4 } from "@orieljs/container";
|
|
986
1088
|
import { ServiceProvider } from "@orieljs/support";
|
|
987
1089
|
|
|
@@ -1055,14 +1157,14 @@ function registerLiveCommands(kernel, app) {
|
|
|
1055
1157
|
var UPDATE_URI = "/oriel/live/update";
|
|
1056
1158
|
var LiveServiceProvider = class extends ServiceProvider {
|
|
1057
1159
|
register() {
|
|
1058
|
-
this.mergeConfigFrom({ class_path: this.app.appPath("Live"), layout: "components.layouts.app" }, "live");
|
|
1160
|
+
this.mergeConfigFrom({ class_path: this.app.appPath("Live"), layout: "components.layouts.app", persistent_middleware: [...PERSISTENT_MIDDLEWARE] }, "live");
|
|
1059
1161
|
this.app.singleton(LiveComponentManager, () => new LiveComponentManager(this.app));
|
|
1060
1162
|
this.app.singleton(LiveManager4, (container) => container.make(LiveComponentManager));
|
|
1061
1163
|
}
|
|
1062
1164
|
async boot() {
|
|
1063
1165
|
const manager = this.app.make(LiveComponentManager);
|
|
1064
|
-
if (this.app.bound(
|
|
1065
|
-
this.app.make(
|
|
1166
|
+
if (this.app.bound(Router2)) {
|
|
1167
|
+
this.app.make(Router2).post(UPDATE_URI, () => manager.handle(inject4(HttpRequest2))).middleware("web").name("live.update");
|
|
1066
1168
|
}
|
|
1067
1169
|
if (this.app.bound(ConsoleKernel)) registerLiveCommands(this.app.make(ConsoleKernel), this.app);
|
|
1068
1170
|
const directory = this.app.make(ConfigRepository3).get("live.class_path", this.app.appPath("Live"));
|
|
@@ -1085,11 +1187,14 @@ export {
|
|
|
1085
1187
|
Locked,
|
|
1086
1188
|
MethodNotCallableError,
|
|
1087
1189
|
On,
|
|
1190
|
+
PERSISTENT_MIDDLEWARE,
|
|
1088
1191
|
PendingEvent,
|
|
1089
1192
|
PropertyNotUpdatableError,
|
|
1193
|
+
TestRequestScope,
|
|
1090
1194
|
Testable,
|
|
1091
1195
|
UPDATE_URI,
|
|
1092
1196
|
componentName,
|
|
1093
|
-
live
|
|
1197
|
+
live,
|
|
1198
|
+
persistentMiddleware
|
|
1094
1199
|
};
|
|
1095
1200
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../Component.ts","../metadata.ts","../embed.ts","../Testable.ts","../errors.ts","../html.ts","../LiveComponentManager.ts","../checksum.ts","../naming.ts","../security.ts","../synthesizers.ts","../LiveServiceProvider.ts","../commands.ts"],"sourcesContent":["import { LiveManager, UrlGenerator, ValidationFactory, type Class, type MessageBag, type Rules } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { forgetComputed } from './metadata'\n\n/** Marks Live component classes (Symbol.for, so two copies of the package agree). */\nexport const COMPONENT: unique symbol = Symbol.for('oriel:live.component') as never\n\n/** A browser event queued by dispatch(). `to` is resolved to a component name when the effects are built. */\nexport interface QueuedDispatch {\n name: string\n params: Record<string, unknown>\n self?: true\n to?: string | Class<Component>\n}\n\n/** Per-request bookkeeping of one component instance. Kept outside the instance so it never becomes state. */\nexport interface ComponentState {\n id: string\n name: string\n errors: Record<string, string[]>\n dispatches: QueuedDispatch[]\n redirect?: string\n redirectUsingNavigate?: true\n skipRender: boolean\n}\n\nconst states = new WeakMap<object, ComponentState>()\n\n/** The bookkeeping of an instance, created on first use (an instance built by the router has none yet). */\nexport function stateOf(component: object): ComponentState {\n let state = states.get(component)\n if (state === undefined) states.set(component, (state = { id: '', name: '', errors: {}, dispatches: [], skipRender: false }))\n return state\n}\n\n/** Whether `value` is a class extending Component. */\nexport function isComponentClass(value: unknown): value is Class<Component> {\n return typeof value === 'function' && (value as unknown as Record<symbol, unknown>)[COMPONENT] === true\n}\n\n/** The validation errors of a component (Laravel's MessageBag), for render(): `this.errors.first('title')`. */\nexport class ErrorBag implements MessageBag {\n constructor(private readonly messages: Record<string, string[]>) {}\n\n has(key: string): boolean {\n return (this.messages[key]?.length ?? 0) > 0\n }\n\n first(key?: string): string | undefined {\n return key === undefined ? this.all()[0] : this.messages[key]?.[0]\n }\n\n get(key: string): string[] {\n return [...(this.messages[key] ?? [])]\n }\n\n all(): string[] {\n return Object.values(this.messages).flat()\n }\n\n any(): boolean {\n return !this.isEmpty()\n }\n\n isEmpty(): boolean {\n return this.count() === 0\n }\n\n count(): number {\n return this.all().length\n }\n\n toObject(): Record<string, string[]> {\n return Object.fromEntries(Object.entries(this.messages).map(([key, messages]) => [key, [...messages]]))\n }\n}\n\n/** What dispatch() returns: `this.dispatch('saved').self()` or `.to(Sidebar)`. */\nexport class PendingEvent {\n constructor(private readonly event: QueuedDispatch) {}\n\n /** Only this component's own listeners receive the event. */\n self(): this {\n this.event.self = true\n delete this.event.to\n return this\n }\n\n /** Only components of this class (or registered name) receive the event. */\n to(component: string | Class<Component>): this {\n this.event.to = component\n delete this.event.self\n return this\n }\n}\n\n/**\n * A Live component (Livewire 3): public fields are its state, public methods are actions the browser can call, and\n * render() returns its TSX. Lifecycle hooks, all optional: `boot()`, `mount(params)`, `hydrate()`, `dehydrate()`,\n * `updating(name, value)`/`updated(name, value)` and per property `updatingTitle(value)`/`updatedTitle(value)`,\n * `rendering()`/`rendered(html)`. Fields that must not be state use `#private` syntax.\n */\nexport abstract class Component {\n static readonly [COMPONENT] = true\n\n /** The view that wraps a full-page component (default: config `live.layout`). */\n static layout?: string\n /** The page title passed to the layout as `title`. */\n static title?: string\n /** Static fallbacks for runtimes without decorators: { event: 'method' }, locked names, computed getter names. */\n static listeners?: Record<string, string>\n static locked?: string[]\n static computed?: string[]\n\n abstract render(): unknown\n\n getId(): string {\n return stateOf(this).id\n }\n\n getName(): string {\n return stateOf(this).name\n }\n\n /** Dispatches a browser event; every component listening for it (@On) runs its handler. */\n dispatch(name: string, params: Record<string, unknown> = {}): PendingEvent {\n const event: QueuedDispatch = { name, params }\n stateOf(this).dispatches.push(event)\n return new PendingEvent(event)\n }\n\n /** Sends the browser to `url` after this request; `navigate` uses o:navigate instead of a full page load. */\n redirect(url: string, options: { navigate?: boolean } = {}): void {\n const state = stateOf(this)\n state.redirect = url\n if (options.navigate === true) state.redirectUsingNavigate = true\n else delete state.redirectUsingNavigate\n }\n\n redirectRoute(name: string, parameters?: unknown, options: { navigate?: boolean } = {}): void {\n this.redirect(inject(UrlGenerator).route(name, parameters), options)\n }\n\n /**\n * Validates the public state. On success clears the error bag and returns the validated data; on failure fills the\n * error bag and throws (the rest of the action is skipped and the component re-renders with `errors`).\n */\n async validate<T = Record<string, unknown>>(rules: Rules, messages?: Record<string, string>, attributes?: Record<string, string>): Promise<T> {\n const validator = inject(ValidationFactory).make(Object.fromEntries(Object.entries(this)), rules, messages, attributes)\n try {\n const data = await validator.validated<T>()\n stateOf(this).errors = {}\n return data\n } catch (error) {\n const errors = (error as { kind?: unknown; errors?: Record<string, string[]> }).errors\n if ((error as { kind?: unknown }).kind === 'Validation' && errors !== undefined) stateOf(this).errors = { ...errors }\n throw error\n }\n }\n\n addError(key: string, message: string): void {\n ;(stateOf(this).errors[key] ??= []).push(message)\n }\n\n /** Clears every error, or only those of `keys`. */\n resetErrorBag(...keys: string[]): void {\n const state = stateOf(this)\n if (keys.length === 0) state.errors = {}\n else for (const key of keys) delete state.errors[key]\n }\n\n get errors(): ErrorBag {\n return new ErrorBag(stateOf(this).errors)\n }\n\n /** Puts public properties (all of them when none are named) back to their initial values. */\n reset(...properties: string[]): void {\n const fresh = new (this.constructor as new () => Record<string, unknown>)()\n const names = properties.length > 0 ? properties : Object.keys(this)\n for (const name of names) if (Object.hasOwn(fresh, name)) (this as unknown as Record<string, unknown>)[name] = fresh[name]\n forgetComputed(this)\n }\n\n /** Keeps the current HTML: the response carries the new state but no `html` effect. */\n skipRender(): void {\n stateOf(this).skipRender = true\n }\n\n /** A full-page component as a route action: Route.get('/counter', Counter). Route parameters go to mount(). */\n async __invoke(): Promise<unknown> {\n return inject(LiveManager).page(this)\n }\n}\n","/**\n * TC39 decorators for Live components (@On, @Locked, @Computed) and the readers that merge them with the static\n * fallbacks (`static listeners`, `static locked`, `static computed`).\n *\n * Neither Node 24 nor Bun defines Symbol.metadata, and compilers only attach decorator metadata when it exists, so it\n * is installed (as the registered symbol, which TypeScript, esbuild and Bun agree on) before any component loads.\n */\n;(Symbol as { metadata?: symbol }).metadata ??= Symbol.for('Symbol.metadata')\n\nconst LISTENERS = Symbol.for('oriel:live.listeners')\nconst LOCKED = Symbol.for('oriel:live.locked')\nconst COMPUTED = Symbol.for('oriel:live.computed')\n\ntype Metadata = Record<PropertyKey, unknown>\n\n/**\n * The subclass's metadata object inherits from its parent's through the prototype chain, so a list read from it may\n * be the parent's: copy it onto the subclass before adding to it.\n */\nfunction own<T>(metadata: Metadata, key: symbol, empty: () => T, copy: (inherited: T) => T): T {\n if (!Object.hasOwn(metadata, key)) metadata[key] = metadata[key] === undefined ? empty() : copy(metadata[key] as T)\n return metadata[key] as T\n}\n\n/** @On('post-created'): calls the method when the event is dispatched (by this or any component, or the browser). */\nexport function On(event: string) {\n return function (_method: unknown, context: ClassMethodDecoratorContext): void {\n const listeners = own<Record<string, string[]>>(context.metadata as Metadata, LISTENERS, () => ({}), (inherited) =>\n Object.fromEntries(Object.entries(inherited).map(([name, methods]) => [name, [...methods]])),\n )\n // An override decorated like the method it replaces is still one listener.\n const methods = (listeners[event] ??= [])\n if (!methods.includes(String(context.name))) methods.push(String(context.name))\n }\n}\n\n/** @Locked: a property the browser can't change, or a method the browser can't call. */\nexport function Locked(_target: unknown, context: ClassFieldDecoratorContext | ClassMethodDecoratorContext): void {\n own<string[]>(context.metadata as Metadata, LOCKED, () => [], (inherited) => [...inherited]).push(String(context.name))\n}\n\n/** Per-instance caches of @Computed getters. A component instance lives for one request, so this is per request. */\nconst computedCache = new WeakMap<object, Map<string, unknown>>()\n\n/** Runs the getter once per instance (one request) and returns the cached value afterwards. */\nexport function cachedGetter<T>(name: string, getter: (this: object) => T): (this: object) => T {\n return function (this: object): T {\n let cache = computedCache.get(this)\n if (cache === undefined) computedCache.set(this, (cache = new Map()))\n if (!cache.has(name)) cache.set(name, getter.call(this))\n return cache.get(name) as T\n }\n}\n\n/** @Computed: a getter cached for the rest of the request, never part of the component's state. */\nexport function Computed<T>(getter: (this: object) => T, context: ClassGetterDecoratorContext): (this: object) => T {\n own<string[]>(context.metadata as Metadata, COMPUTED, () => [], (inherited) => [...inherited]).push(String(context.name))\n return cachedGetter(String(context.name), getter)\n}\n\n/** Drops the cached @Computed values of one instance (after `reset()`, for example). */\nexport function forgetComputed(instance: object): void {\n computedCache.delete(instance)\n}\n\ninterface Statics {\n listeners?: Record<string, string>\n locked?: string[]\n computed?: string[]\n [key: symbol]: unknown\n}\n\nfunction metadataOf(cls: Statics): Metadata {\n return (cls[(Symbol as unknown as { metadata: symbol }).metadata] as Metadata | undefined) ?? {}\n}\n\n/**\n * The classes from the root of the chain down to `cls`. Static properties shadow along the chain instead of merging, so\n * each level's own statics are read separately and added to its parent's.\n */\nfunction chainOf(cls: object): Statics[] {\n const chain: Statics[] = []\n for (let c: object | null = cls; c !== null && c !== Function.prototype; c = Object.getPrototypeOf(c) as object | null) {\n chain.unshift(c as Statics)\n }\n return chain\n}\n\n/** The values of the own static `key` of every class in the chain, parents first. */\nfunction staticsOf<K extends 'listeners' | 'locked' | 'computed'>(cls: object, key: K): NonNullable<Statics[K]>[] {\n return chainOf(cls).flatMap((c) => (Object.hasOwn(c, key) && c[key] !== undefined ? [c[key] as NonNullable<Statics[K]>] : []))\n}\n\n/** Event name → method names, from @On and `static listeners` (of the class and its parents). */\nexport function listenersOf(cls: object): Record<string, string[]> {\n const result: Record<string, string[]> = {}\n for (const [event, methods] of Object.entries((metadataOf(cls as Statics)[LISTENERS] as Record<string, string[]> | undefined) ?? {})) {\n result[event] = [...methods]\n }\n for (const listeners of staticsOf(cls, 'listeners')) {\n for (const [event, method] of Object.entries(listeners)) {\n const methods = (result[event] ??= [])\n if (!methods.includes(method)) methods.push(method)\n }\n }\n return result\n}\n\n/** Locked property and method names, from @Locked and `static locked` (of the class and its parents). */\nexport function lockedOf(cls: object): Set<string> {\n return new Set([...((metadataOf(cls as Statics)[LOCKED] as string[] | undefined) ?? []), ...staticsOf(cls, 'locked').flat()])\n}\n\n/** Computed getter names, from @Computed and `static computed` (of the class and its parents). */\nexport function computedOf(cls: object): Set<string> {\n return new Set([...((metadataOf(cls as Statics)[COMPUTED] as string[] | undefined) ?? []), ...staticsOf(cls, 'computed').flat()])\n}\n","import { LiveManager, type Class, type Htmlable } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport type { Component } from './Component'\nimport { Testable } from './Testable'\n\n/** Props of `<Live component={Counter} count={3} o:key=\"c1\" />`: the rest become mount params. */\nexport interface LiveProps {\n component: Class<Component> | string\n /** Identifies a child inside its parent across re-renders (Livewire's :key / wire:key). */\n 'o:key'?: string | number\n [param: string]: unknown\n}\n\n/** Blade's @livewire('counter', ['count' => 3], key('c1')): the component's first render, as trusted HTML. */\nexport async function live(component: Class<Component> | string, params: Record<string, unknown> = {}, key?: string | number): Promise<Htmlable> {\n const html = await inject(LiveManager).mount(component, params, key === undefined ? undefined : String(key))\n return { toHtml: () => html }\n}\n\n/** `<Live component={Counter} />` in any view or component. */\nfunction LiveComponent({ component, 'o:key': key, children: _children, ...params }: LiveProps): Promise<Htmlable> {\n return live(component, params, key)\n}\n\n/** The `<Live />` element, and the Live facade: Live.component(name, Class), Live.test(Component). */\nexport const Live = Object.assign(LiveComponent, {\n /** Registers a component under a name (components in app/Live are registered at boot). */\n component(name: string, component: Class<Component>): void {\n inject(LiveManager).register(component, name)\n },\n /** Livewire::test(): mounts `component` for assertions. */\n test<C extends Component>(component: Class<C> | string, params: Record<string, unknown> = {}): Promise<Testable<C>> {\n return Testable.create(component, params)\n },\n})\n","import { AssertionError } from 'node:assert'\nimport { isDeepStrictEqual } from 'node:util'\nimport { LiveManager, type Class, type LiveEffects } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { stateOf, type Component } from './Component'\nimport { escapeAttribute } from './html'\nimport type { ComponentResult, LiveComponentManager } from './LiveComponentManager'\n\nconst fail = (message: string, actual?: unknown, expected?: unknown): never => {\n throw new AssertionError({ message, actual, expected, operator: 'live' })\n}\n\nconst getPath = (target: unknown, path: string): unknown =>\n path.split('.').reduce<unknown>((node, segment) => (typeof node === 'object' && node !== null ? (node as Record<string, unknown>)[segment] : undefined), target)\n\n/**\n * Livewire's Livewire::test(): drives one component through the real mount → snapshot → checksum → update pipeline\n * (no HTTP). Actions are async (`await counter.call('increment')`); assertions are sync and return `this`.\n */\nexport class Testable<C extends Component = Component> {\n #snapshot: string\n #html: string\n #effects: LiveEffects\n #instance: C\n\n private constructor(\n private readonly manager: LiveComponentManager,\n result: ComponentResult,\n ) {\n this.#snapshot = JSON.stringify(result.snapshot)\n this.#html = result.html ?? ''\n this.#effects = result.effects\n this.#instance = result.instance as C\n }\n\n /** Mounts `component` with `params`, as `<Live component={…} {...params} />` would. */\n static async create<C extends Component>(component: Class<C> | string, params: Record<string, unknown> = {}): Promise<Testable<C>> {\n const manager = inject(LiveManager) as unknown as LiveComponentManager\n return new Testable<C>(manager, await manager.mountComponent(component, params))\n }\n\n /** The component instance after the last request. */\n instance(): C {\n return this.#instance\n }\n\n /** A public property (dotted paths reach into arrays and objects). */\n get<T = unknown>(path: string): T {\n return getPath(this.#instance, path) as T\n }\n\n /** The last rendered HTML, without the o:id, o:snapshot and o:effects attributes (Livewire strips them too). */\n html(): string {\n return this.#html.replace(/ o:(id|snapshot|effects)=\"[^\"]*\"/g, '')\n }\n\n /** The effects of the last request. */\n effects(): LiveEffects {\n return this.#effects\n }\n\n async set(path: string | Record<string, unknown>, value?: unknown): Promise<this> {\n return this.#update(typeof path === 'string' ? { [path]: value } : path, [])\n }\n\n async call(method: string, ...params: unknown[]): Promise<this> {\n return this.#update({}, [{ method, params }])\n }\n\n async toggle(path: string): Promise<this> {\n return this.#update({}, [{ method: '$toggle', params: [path] }])\n }\n\n /** Dispatches an event to this component, as the browser does for its listeners. */\n async dispatch(event: string, params: Record<string, unknown> = {}): Promise<this> {\n return this.#update({}, [{ method: '__dispatch', params: [event, params] }])\n }\n\n async refresh(): Promise<this> {\n return this.#update({}, [{ method: '$refresh', params: [] }])\n }\n\n async #update(updates: Record<string, unknown>, calls: Array<{ method: string; params: unknown[] }>): Promise<this> {\n const result = await this.manager.updateComponent(this.#snapshot, updates, calls)\n this.#snapshot = JSON.stringify(result.snapshot)\n if (result.html !== undefined) this.#html = result.html\n this.#effects = result.effects\n this.#instance = result.instance as C\n return this\n }\n\n assertSet(path: string, value: unknown): this {\n const actual = this.get(path)\n if (!isDeepStrictEqual(actual, value)) fail(`Failed asserting that property [${path}] is set to the expected value.`, actual, value)\n return this\n }\n\n assertNotSet(path: string, value: unknown): this {\n if (isDeepStrictEqual(this.get(path), value)) fail(`Failed asserting that property [${path}] is not set to the given value.`, this.get(path), value)\n return this\n }\n\n /** Each value, HTML-escaped, appears in the rendered HTML. */\n assertSee(...values: string[]): this {\n for (const value of values) if (!this.html().includes(escapeAttribute(value))) fail(`Failed asserting that [${value}] is in the rendered HTML.`, this.html(), value)\n return this\n }\n\n assertDontSee(...values: string[]): this {\n for (const value of values) if (this.html().includes(escapeAttribute(value))) fail(`Failed asserting that [${value}] is not in the rendered HTML.`, this.html(), value)\n return this\n }\n\n /** Each value appears in the rendered HTML as written (not escaped). */\n assertSeeHtml(...values: string[]): this {\n for (const value of values) if (!this.html().includes(value)) fail(`Failed asserting that [${value}] is in the rendered HTML.`, this.html(), value)\n return this\n }\n\n assertDispatched(name: string, params?: Record<string, unknown>): this {\n const dispatched = (this.#effects.dispatches ?? []).filter((event) => event.name === name)\n if (dispatched.length === 0) fail(`Failed asserting that an event [${name}] was dispatched.`, this.#effects.dispatches ?? [], name)\n if (params !== undefined && !dispatched.some((event) => isDeepStrictEqual(event.params, params))) {\n fail(`Failed asserting that event [${name}] was dispatched with the expected params.`, dispatched.map((event) => event.params), params)\n }\n return this\n }\n\n assertNotDispatched(name: string): this {\n if ((this.#effects.dispatches ?? []).some((event) => event.name === name)) fail(`Failed asserting that an event [${name}] was not dispatched.`)\n return this\n }\n\n /** The error bag has errors for every key given (or any error at all with no keys). */\n assertHasErrors(keys: string | string[] = []): this {\n const errors = stateOf(this.#instance).errors\n const wanted = [keys].flat()\n if (wanted.length === 0 && Object.keys(errors).length === 0) fail('Component has no errors.', errors)\n for (const key of wanted) if ((errors[key]?.length ?? 0) === 0) fail(`Component missing error: ${key}`, errors, key)\n return this\n }\n\n /** No errors for the keys given (or none at all with no keys). */\n assertHasNoErrors(keys: string | string[] = []): this {\n const errors = stateOf(this.#instance).errors\n const wanted = [keys].flat()\n const found = wanted.length === 0 ? Object.keys(errors).filter((key) => (errors[key]?.length ?? 0) > 0) : wanted.filter((key) => (errors[key]?.length ?? 0) > 0)\n if (found.length > 0) fail(`Component has errors: \"${found.join('\", \"')}\"`, errors)\n return this\n }\n\n assertRedirect(url?: string): this {\n const redirect = this.#effects.redirect\n if (redirect === undefined) fail('Component did not perform a redirect.')\n if (url !== undefined && redirect !== url) fail('Component redirected to an unexpected URL.', redirect, url)\n return this\n }\n\n assertNoRedirect(): this {\n if (this.#effects.redirect !== undefined) fail('Component performed a redirect.', this.#effects.redirect)\n return this\n }\n\n /** The last call returned `value`. */\n assertReturned(value: unknown): this {\n const returned = this.#effects.returns?.at(-1)\n if (!isDeepStrictEqual(returned, value)) fail('Failed asserting that the method returned the expected value.', returned, value)\n return this\n }\n}\n","import type { ErrorKind, OrielError } from '@orieljs/contracts'\n\n/** A Live programming error (unsupported state, a missing root element, an unknown component): a 500. */\nexport class LiveError extends Error implements OrielError {\n override readonly name: string = 'LiveError'\n readonly kind: ErrorKind = 'Server'\n readonly status: number = 500\n}\n\n/** A snapshot whose checksum doesn't match (tampered with, or signed with another APP_KEY). Nothing is hydrated. */\nexport class CorruptComponentPayloadError extends LiveError {\n override readonly name: string = 'CorruptComponentPayloadError'\n override readonly kind: ErrorKind = 'Authorization'\n override readonly status: number = 403\n\n constructor(component = 'unknown') {\n super(`Live encountered corrupt data when trying to hydrate the [${component}] component.`)\n }\n}\n\n/** The browser asked for a method that isn't a public action of the component. */\nexport class MethodNotCallableError extends LiveError {\n override readonly name: string = 'MethodNotCallableError'\n override readonly kind: ErrorKind = 'Authorization'\n override readonly status: number = 403\n\n constructor(method: string, component: string) {\n super(`Unable to call component method. Public method [${method}] not found on component [${component}].`)\n }\n}\n\n/** The browser tried to set a property that is locked, computed, private (`_x`) or not declared. */\nexport class PropertyNotUpdatableError extends LiveError {\n override readonly name: string = 'PropertyNotUpdatableError'\n override readonly kind: ErrorKind = 'Authorization'\n override readonly status: number = 403\n\n constructor(path: string, component: string) {\n super(`Cannot update property [${path}] on component [${component}]: it is not a public, unlocked property.`)\n }\n}\n\n/** A snapshot names a component that isn't registered. */\nexport class LiveComponentNotFoundError extends LiveError {\n override readonly name: string = 'LiveComponentNotFoundError'\n override readonly kind: ErrorKind = 'Http'\n override readonly status: number = 404\n\n constructor(component: string) {\n super(`Unable to find component: [${component}].`)\n }\n}\n\n/** An update request without the X-Oriel-Live header or with a malformed body. */\nexport class InvalidLiveRequestError extends LiveError {\n override readonly name: string = 'InvalidLiveRequestError'\n override readonly kind: ErrorKind = 'Http'\n override readonly status: number = 400\n}\n","import { LiveError } from './errors'\n\nconst ESCAPES: Record<string, string> = { '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' }\n\n/** Laravel's e(): for attribute values (the snapshot JSON goes into an attribute). */\nexport function escapeAttribute(value: string): string {\n return value.replace(/[&<>\"']/g, (char) => ESCAPES[char]!)\n}\n\nconst VOID = new Set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'source', 'track', 'wbr'])\nconst RAW_TEXT = new Set(['script', 'style', 'textarea', 'title'])\n/** A closing tag, or an opening tag with its (quoted) attributes. */\nconst TOKEN = /<\\/([A-Za-z][\\w:-]*)\\s*>|<([A-Za-z][\\w:-]*)(?:\\s+[^\\s\"'<>/=]+(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s\"'=<>`]+))?)*\\s*(\\/?)>/g\n\n/** The name of the single root element of `html`; throws when there is none or there are several (Livewire's rule). */\nexport function rootTag(html: string, component: string): string {\n const fail = (): never => {\n throw new LiveError(`Live only supports one HTML element per component. Multiple root elements were detected for component [${component}].`)\n }\n const source = html.replace(/<!--[\\s\\S]*?-->/g, '').trim()\n let depth = 0\n let root: string | undefined\n let rootEnd = -1\n TOKEN.lastIndex = 0\n for (let match = TOKEN.exec(source); match !== null; match = TOKEN.exec(source)) {\n const [token, closing, opening, selfClosing] = match\n if (root === undefined && match.index !== 0) fail()\n if (depth === 0 && root !== undefined) fail()\n if (opening !== undefined) {\n const tag = opening.toLowerCase()\n root ??= tag\n if (selfClosing === '/' || VOID.has(tag)) {\n if (depth === 0) rootEnd = match.index + token.length\n continue\n }\n if (RAW_TEXT.has(tag)) {\n // Search the original string: lowercasing it can change its length (U+0130), which would shift the index.\n const closer = new RegExp(`</${tag}`, 'gi')\n closer.lastIndex = TOKEN.lastIndex\n const end = closer.exec(source)\n if (end !== null) TOKEN.lastIndex = end.index\n }\n depth++\n } else if (closing !== undefined) {\n if (--depth < 0) fail()\n if (depth === 0) rootEnd = match.index + token.length\n }\n }\n if (root === undefined || depth !== 0 || source.slice(rootEnd).trim() !== '') fail()\n return root!\n}\n\n/** Adds ` name=\"value\"` pairs (values escaped) right after the root tag's name. */\nexport function insertAttributesIntoRoot(html: string, attributes: Record<string, string>): string {\n const source = html.trim()\n const match = /^((?:<!--[\\s\\S]*?-->\\s*)*<[A-Za-z][\\w:-]*)/.exec(source)\n if (match === null) throw new LiveError('Live could not find the root element of the component.')\n const rendered = Object.entries(attributes)\n .map(([name, value]) => ` ${name}=\"${escapeAttribute(value)}\"`)\n .join('')\n return match[1] + rendered + source.slice(match[1]!.length)\n}\n","import { AsyncLocalStorage } from 'node:async_hooks'\nimport { randomBytes } from 'node:crypto'\nimport {\n ClassRegistry,\n ConfigRepository,\n CurrentRoute,\n Encrypter,\n HttpRequest,\n Redirector,\n ViewFactory,\n type Application,\n type Class,\n type Container,\n type LiveEffects,\n type LiveManager,\n type LiveSnapshot,\n type LiveUpdateRequest,\n type LiveUpdateResponse,\n type Token,\n} from '@orieljs/contracts'\nimport { currentContainer } from '@orieljs/container'\nimport { Str } from '@orieljs/support'\nimport { checksum, verifyChecksum } from './checksum'\nimport { isComponentClass, stateOf, type Component } from './Component'\nimport { LiveComponentNotFoundError, CorruptComponentPayloadError, InvalidLiveRequestError, LiveError, MethodNotCallableError, PropertyNotUpdatableError } from './errors'\nimport { escapeAttribute, insertAttributesIntoRoot, rootTag } from './html'\nimport { cachedGetter, computedOf, listenersOf } from './metadata'\nimport { defaultName } from './naming'\nimport { isArraySlot, isCallable, isUpdatable } from './security'\nimport { dehydrate, hydrate } from './synthesizers'\n\ntype Memo = LiveSnapshot['memo']\ntype Children = Memo['children']\ntype Call = { method: string; params: unknown[] }\n\n/** The children rendered so far by the component being rendered, and those it had before (for placeholders). */\ninterface RenderContext {\n previous: Children\n children: Children\n index: number\n}\n\n/** One component after a mount or an update: the live instance (for Live.test), its snapshot, effects and HTML. */\nexport interface ComponentResult {\n instance: Component\n snapshot: LiveSnapshot\n effects: LiveEffects\n /** The rendered HTML with o:id (and, after a mount, o:snapshot/o:effects); undefined after skipRender(). */\n html?: string\n tag?: string\n}\n\nconst renderContext = new AsyncLocalStorage<RenderContext>()\n\n/** A binding of the current container, or undefined (scoped bindings throw on the application outside a request). */\nfunction optional<T>(container: Container, token: Token<T>): T | undefined {\n if (!container.bound(token)) return undefined\n try {\n return container.make(token)\n } catch {\n return undefined\n }\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null && !Array.isArray(value)\n\n/** Sets an own enumerable property, even for a key like '__proto__' (an assignment would change the prototype). */\nfunction setOwn<T>(object: Record<string, T>, key: string, value: T): void {\n Object.defineProperty(object, key, { value, enumerable: true, writable: true, configurable: true })\n}\n\nasync function hook(instance: Component, name: string, ...args: unknown[]): Promise<void> {\n const method = (instance as unknown as Record<string, unknown>)[name]\n if (typeof method === 'function') await (method as (...values: unknown[]) => unknown).apply(instance, args)\n}\n\n/** Livewire's update request handling and first render, on Oriel's contracts. */\nexport class LiveComponentManager implements LiveManager {\n constructor(private readonly app: Application) {}\n\n /** The request scope when there is one (sessions, the current route), else the application. */\n private container(): Container {\n return currentContainer() ?? this.app\n }\n\n private registry(): ClassRegistry {\n return this.container().make(ClassRegistry)\n }\n\n /** Live.component('counter', Counter): registers a component under a name the snapshots use. */\n register(component: Class<unknown>, name?: string): void {\n if (!isComponentClass(component)) throw new LiveError(`[${component.name}] is not a Live component: it must extend Component.`)\n const resolved = name ?? defaultName(component)\n if (resolved === undefined) throw new LiveError('Anonymous component classes need a name: Live.component(name, Class).')\n this.registry().register(component, resolved)\n }\n\n /** The registered name of a component class, registering it under its kebab-case class name the first time. */\n nameOf(component: Class<Component>): string {\n const registry = this.registry()\n const existing = registry.nameOf(component)\n if (existing !== undefined) return existing\n this.register(component)\n return registry.nameOf(component)!\n }\n\n resolve(name: string): Class<Component> {\n const registry = this.registry()\n if (!registry.has(name)) throw new LiveComponentNotFoundError(name)\n const cls = registry.resolve(name)\n if (!isComponentClass(cls)) throw new LiveComponentNotFoundError(name)\n return cls\n }\n\n isLiveRequest(request: HttpRequest): boolean {\n return request.header('X-Oriel-Live') === 'true'\n }\n\n /** The first render: HTML with o:id, o:snapshot and o:effects on the root element. */\n async mount(component: string | Class<unknown>, params: Record<string, unknown> = {}, key?: string): Promise<string> {\n const context = renderContext.getStore()\n if (context === undefined) return (await this.mountComponent(component, params)).html!\n const childKey = key ?? `lw-${context.index++}`\n // Own keys only: a key taken from data ('constructor', '__proto__') must not find or change Object.prototype.\n const existing = Object.hasOwn(context.previous, childKey) ? context.previous[childKey] : undefined\n if (existing !== undefined) {\n // The child already lives in the browser: a placeholder the client keeps as it is (Livewire's behaviour).\n setOwn(context.children, childKey, existing)\n return `<${existing[0]} o:id=\"${escapeAttribute(existing[1])}\"></${existing[0]}>`\n }\n const result = await this.mountComponent(component, params)\n setOwn(context.children, childKey, [result.tag!, result.snapshot.memo.id])\n return result.html!\n }\n\n async mountComponent(component: string | Class<unknown>, params: Record<string, unknown> = {}, existing?: Component): Promise<ComponentResult> {\n const cls = typeof component === 'string' ? this.resolve(component) : (component as Class<Component>)\n if (!isComponentClass(cls)) throw new LiveError(`[${(cls as { name?: string }).name}] is not a Live component: it must extend Component.`)\n const name = this.nameOf(cls)\n const instance = existing ?? this.container().make(cls)\n const state = stateOf(instance)\n state.id = randomBytes(15).toString('base64url')\n state.name = name\n await hook(instance, 'boot')\n for (const [property, value] of Object.entries(params)) {\n if (Object.hasOwn(instance, property)) (instance as unknown as Record<string, unknown>)[property] = value\n }\n this.prepareComputed(instance)\n await hook(instance, 'mount', params)\n const request = optional(this.container(), HttpRequest)\n const memo: Memo = { id: state.id, name, path: request?.path() ?? '', method: request?.method() ?? 'GET', children: {}, errors: {} }\n const { html, tag } = await this.render(instance, memo, {})\n const effects = this.effects(instance)\n const listeners = Object.keys(listenersOf(cls))\n if (listeners.length > 0) effects.listeners = listeners\n const snapshot = await this.snapshot(instance, memo)\n const attributes: Record<string, string> = { 'o:snapshot': JSON.stringify(snapshot), 'o:effects': JSON.stringify(effects), 'o:id': state.id }\n return { instance, snapshot, effects, html: insertAttributesIntoRoot(html, attributes), tag }\n }\n\n /** Applies each component's updates and calls, re-renders it and returns its new snapshot and effects. */\n async update(request: LiveUpdateRequest): Promise<LiveUpdateResponse> {\n const components: LiveUpdateResponse['components'] = []\n for (const component of request.components) {\n const result = await this.updateComponent(component.snapshot, component.updates, component.calls)\n components.push({ snapshot: JSON.stringify(result.snapshot), effects: result.effects })\n }\n return { components }\n }\n\n async updateComponent(snapshotJson: string, updates: Record<string, unknown>, calls: Call[]): Promise<ComponentResult> {\n const snapshot = this.verify(snapshotJson)\n const cls = this.resolve(snapshot.memo.name)\n const instance = this.container().make(cls)\n const state = stateOf(instance)\n state.id = snapshot.memo.id\n state.name = snapshot.memo.name\n state.errors = { ...snapshot.memo.errors }\n await hook(instance, 'boot')\n const registry = this.registry()\n for (const [property, value] of Object.entries(snapshot.data)) {\n Object.defineProperty(instance, property, { value: await hydrate(value, registry), enumerable: true, writable: true, configurable: true })\n }\n this.prepareComputed(instance)\n await hook(instance, 'hydrate')\n\n const returns: unknown[] = []\n try {\n for (const [path, value] of Object.entries(updates)) await this.applyUpdate(instance, path, value)\n for (const call of calls) returns.push(await this.call(instance, call.method, call.params))\n } catch (error) {\n // A failed validate() (or any validation error) stops the remaining calls; the component re-renders with errors.\n const errors = (error as { kind?: unknown; errors?: unknown }).errors\n if ((error as { kind?: unknown }).kind !== 'Validation' || !isRecord(errors)) throw error\n state.errors = { ...(errors as Record<string, string[]>) }\n }\n\n const memo: Memo = { ...snapshot.memo, children: { ...snapshot.memo.children } }\n const effects = this.effects(instance)\n let html: string | undefined\n let tag: string | undefined\n if (!state.skipRender) {\n ;({ html, tag } = await this.render(instance, memo, snapshot.memo.children))\n html = insertAttributesIntoRoot(html, { 'o:id': state.id })\n effects.html = html\n }\n if (calls.length > 0) effects.returns = returns\n return { instance, snapshot: await this.snapshot(instance, memo), effects, html, tag }\n }\n\n /** The route action of POST /oriel/live/update. */\n async handle(request: HttpRequest): Promise<LiveUpdateResponse> {\n if (!this.isLiveRequest(request)) throw new InvalidLiveRequestError('Live update requests need the X-Oriel-Live header.')\n return this.update(this.payload(request))\n }\n\n /** A full-page component (Route.get('/counter', Counter)): mounted with the route parameters, inside the layout. */\n async page(component: Component): Promise<unknown> {\n const container = this.container()\n const params = { ...(optional(container, CurrentRoute)?.parameters ?? {}) }\n const cls = component.constructor as Class<Component> & { layout?: string; title?: string }\n const result = await this.mountComponent(cls, params, component)\n const redirect = result.effects.redirect\n if (redirect !== undefined) {\n return optional(container, Redirector)?.to(redirect) ?? new Response(null, { status: 302, headers: { Location: redirect } })\n }\n const layout = cls.layout ?? optional(container, ConfigRepository)?.get<string>('live.layout') ?? 'components.layouts.app'\n const html = result.html!\n const data: Record<string, unknown> = { children: { toHtml: () => html } }\n if (cls.title !== undefined) data.title = cls.title\n return container.make(ViewFactory).make(layout, data)\n }\n\n /** Parses and checks a snapshot: a bad checksum throws before anything is hydrated. */\n private verify(snapshotJson: unknown): LiveSnapshot {\n let snapshot: unknown\n try {\n snapshot = typeof snapshotJson === 'string' ? JSON.parse(snapshotJson) : undefined\n } catch {\n throw new CorruptComponentPayloadError()\n }\n if (!isRecord(snapshot) || !isRecord(snapshot.data) || !isRecord(snapshot.memo)) throw new CorruptComponentPayloadError()\n const memo = snapshot.memo as Partial<Memo>\n const name = typeof memo.name === 'string' ? memo.name : 'unknown'\n const key = this.key()\n let valid: boolean\n try {\n valid = verifyChecksum(key, { data: snapshot.data, memo: snapshot.memo }, snapshot.checksum)\n } catch {\n // A payload the checksum can't be computed over (nested too deep to walk) was never signed by this server.\n valid = false\n }\n if (!valid) throw new CorruptComponentPayloadError(name)\n return snapshot as unknown as LiveSnapshot\n }\n\n private key(): Uint8Array {\n return this.container().make(Encrypter).getKey()\n }\n\n /** The request body, read from the raw JSON when the request has it, so TrimStrings can't alter typed values. */\n private payload(request: HttpRequest): LiveUpdateRequest {\n let body: unknown\n try {\n const content = (request as { content?: () => string }).content\n body = typeof content === 'function' ? JSON.parse(content.call(request)) : request.all()\n } catch {\n throw new InvalidLiveRequestError('The Live update request body is not valid JSON.')\n }\n const components = isRecord(body) ? body.components : undefined\n const valid =\n Array.isArray(components) &&\n components.every(\n (component) =>\n isRecord(component) &&\n typeof component.snapshot === 'string' &&\n isRecord(component.updates) &&\n Array.isArray(component.calls) &&\n component.calls.every((call) => isRecord(call) && typeof call.method === 'string' && Array.isArray(call.params)),\n )\n if (!valid) throw new InvalidLiveRequestError('The Live update request body is malformed.')\n return body as unknown as LiveUpdateRequest\n }\n\n /** Makes every computed getter (static `computed` too) cache its value for the rest of the request. */\n private prepareComputed(instance: Component): void {\n for (const name of computedOf(instance.constructor)) {\n for (let proto = Object.getPrototypeOf(instance) as object | null; proto !== null; proto = Object.getPrototypeOf(proto) as object | null) {\n const getter = Object.getOwnPropertyDescriptor(proto, name)?.get\n if (getter === undefined) continue\n Object.defineProperty(instance, name, { get: cachedGetter(name, getter as (this: object) => unknown), enumerable: false, configurable: true })\n break\n }\n }\n }\n\n private async applyUpdate(instance: Component, path: string, value: unknown): Promise<void> {\n if (!isUpdatable(instance, path)) throw new PropertyNotUpdatableError(path, stateOf(instance).name)\n const [root, ...rest] = path.split('.') as [string, ...string[]]\n const key = rest.length > 0 ? rest.join('.') : undefined\n const studly = Str.studly(root)\n await hook(instance, 'updating', path, value)\n await hook(instance, `updating${studly}`, value, key)\n const target = instance as unknown as Record<string, unknown>\n if (rest.length === 0) target[root] = value\n else {\n // Arrays are checked again while writing: an updating hook may have changed one since isUpdatable(), and no write\n // (nor a container created on the way) may leave holes.\n const assertSlot = (node: object, segment: string): void => {\n if (Array.isArray(node) && !isArraySlot(node, segment)) throw new PropertyNotUpdatableError(path, stateOf(instance).name)\n }\n let node = target[root] as Record<string, unknown>\n if (!isRecord(node) && !Array.isArray(node)) target[root] = node = {}\n for (const segment of rest.slice(0, -1)) {\n assertSlot(node, segment)\n const next = node[segment]\n node = isRecord(next) || Array.isArray(next) ? (next as Record<string, unknown>) : (node[segment] = {} as Record<string, unknown>)\n }\n const last = rest.at(-1)!\n assertSlot(node, last)\n Object.defineProperty(node, last, { value, enumerable: true, writable: true, configurable: true })\n }\n await hook(instance, 'updated', path, value)\n await hook(instance, `updated${studly}`, value, key)\n }\n\n /** Runs one call from the browser: a magic action, an event, or a public method. Returns its return value. */\n private async call(instance: Component, method: string, params: unknown[]): Promise<unknown> {\n const name = stateOf(instance).name\n switch (method) {\n case '$refresh':\n return undefined\n case '$set':\n return this.applyUpdate(instance, String(params[0]), params[1])\n case '$toggle': {\n const path = String(params[0])\n const current = path.split('.').reduce<unknown>((node, segment) => (isRecord(node) || Array.isArray(node) ? (node as Record<string, unknown>)[segment] : undefined), instance)\n return this.applyUpdate(instance, path, !current)\n }\n case '__dispatch': {\n const [event, detail] = params\n // Own keys only: an event named 'constructor' or '__proto__' must not reach Object.prototype.\n const listeners = listenersOf(instance.constructor)\n for (const listener of Object.hasOwn(listeners, String(event)) ? listeners[String(event)]! : []) {\n if (!isCallable(instance, listener)) throw new MethodNotCallableError(listener, name)\n await (instance as unknown as Record<string, (params: unknown) => unknown>)[listener]!(isRecord(detail) ? detail : {})\n }\n return undefined\n }\n }\n if (!isCallable(instance, method)) throw new MethodNotCallableError(method, name)\n return (instance as unknown as Record<string, (...args: unknown[]) => unknown>)[method]!(...params)\n }\n\n /** Renders the component (rendering/rendered hooks, nested children tracked) and checks for a single root. */\n private async render(instance: Component, memo: Memo, previous: Children): Promise<{ html: string; tag: string }> {\n await hook(instance, 'rendering')\n const context: RenderContext = { previous, children: {}, index: 0 }\n const html = await renderContext.run(context, async () => {\n const output = await instance.render()\n return typeof output === 'string' ? output : this.container().make(ViewFactory).renderToString(output)\n })\n await hook(instance, 'rendered', html)\n memo.children = context.children\n return { html: html.trim(), tag: rootTag(html, memo.name) }\n }\n\n /** Dispatches, redirects: the effects every response carries. */\n private effects(instance: Component): LiveEffects {\n const state = stateOf(instance)\n const effects: LiveEffects = {}\n if (state.dispatches.length > 0) {\n effects.dispatches = state.dispatches.map(({ name, params, self, to }) => ({\n name,\n params,\n ...(self ? { self } : {}),\n ...(to === undefined ? {} : { to: typeof to === 'string' ? to : this.nameOf(to) }),\n }))\n }\n if (state.redirect !== undefined) effects.redirect = state.redirect\n if (state.redirectUsingNavigate) effects.redirectUsingNavigate = true\n return effects\n }\n\n /** dehydrate() hook, then the state as snapshot data, the error bag, and the checksum over both. */\n private async snapshot(instance: Component, memo: Memo): Promise<LiveSnapshot> {\n await hook(instance, 'dehydrate')\n const registry = this.registry()\n const data: Record<string, unknown> = {}\n for (const [property, value] of Object.entries(instance)) data[property] = dehydrate(value, registry, `${memo.name}.${property}`)\n const signed = { data, memo: { ...memo, errors: { ...stateOf(instance).errors } } }\n return { ...signed, checksum: checksum(this.key(), signed) }\n }\n}\n","import { createHmac, timingSafeEqual } from 'node:crypto'\n\n/** JSON with object keys sorted at every level, so the browser's key order can't change the checksum. */\nexport function canonicalJson(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map((item) => canonicalJson(item === undefined ? null : item)).join(',')}]`\n if (typeof value === 'object' && value !== null) {\n const entries = Object.keys(value)\n .sort()\n .filter((key) => (value as Record<string, unknown>)[key] !== undefined)\n .map((key) => `${JSON.stringify(key)}:${canonicalJson((value as Record<string, unknown>)[key])}`)\n return `{${entries.join(',')}}`\n }\n return JSON.stringify(value)\n}\n\n/** HMAC-SHA256 (hex) of the snapshot's data and memo, keyed by APP_KEY. */\nexport function checksum(key: Uint8Array, payload: { data: unknown; memo: unknown }): string {\n return createHmac('sha256', key).update(canonicalJson({ data: payload.data, memo: payload.memo })).digest('hex')\n}\n\n/** Constant-time comparison of a snapshot's checksum with the expected one. */\nexport function verifyChecksum(key: Uint8Array, payload: { data: unknown; memo: unknown }, given: unknown): boolean {\n if (typeof given !== 'string') return false\n const expected = Buffer.from(checksum(key, payload), 'utf8')\n const actual = Buffer.from(given, 'utf8')\n return expected.length === actual.length && timingSafeEqual(expected, actual)\n}\n","import { existsSync, readdirSync } from 'node:fs'\nimport { join, relative, sep } from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { Str } from '@orieljs/support'\n\n/** A component's Livewire name from its path under app/Live: Posts/CreatePost.tsx → posts.create-post. */\nexport function componentName(file: string): string {\n return file\n .replace(/\\.(tsx|ts|jsx|js|mts|mjs)$/, '')\n .split(/[\\\\/]/)\n .map((segment) => Str.kebab(segment))\n .join('.')\n}\n\n/** A class's default name when it is mounted without being registered: CreatePost → create-post. */\nexport function defaultName(cls: object): string | undefined {\n const name = (cls as { name?: unknown }).name\n return typeof name === 'string' && name !== '' ? Str.kebab(name) : undefined\n}\n\n/** Component files under `directory` (recursive), relative paths with `/`. Test and declaration files are skipped. */\nexport function componentFiles(directory: string): string[] {\n if (!existsSync(directory)) return []\n return readdirSync(directory, { recursive: true, encoding: 'utf8' })\n .filter((file) => /\\.(tsx|ts|jsx|js|mts|mjs)$/.test(file) && !/\\.(test|spec|d)\\.[^.]+$/.test(file))\n .map((file) => file.split(sep).join('/'))\n .sort()\n}\n\n/** Imports every component file under `directory` and returns [name, default export] pairs. */\nexport async function discover(directory: string): Promise<Array<[name: string, exported: unknown]>> {\n const found: Array<[string, unknown]> = []\n for (const file of componentFiles(directory)) {\n const module = (await import(/* @vite-ignore */ pathToFileURL(join(directory, file)).href)) as { default?: unknown }\n found.push([componentName(relative(directory, join(directory, file))), module.default])\n }\n return found\n}\n","import { Collection } from '@orieljs/collections'\nimport { Component } from './Component'\nimport { computedOf, lockedOf } from './metadata'\nimport { isModel } from './synthesizers'\n\n/** Lifecycle hooks and the render method: never actions (Livewire's protected method list). */\nconst HOOKS = new Set(['constructor', 'render', 'mount', 'boot', 'booted', 'hydrate', 'dehydrate', 'updating', 'updated', 'rendering', 'rendered', 'exception'])\nconst HOOK_PREFIX = /^(updating|updated|hydrate|dehydrate)[A-Z_]/\n/** Path segments that could reach a prototype. */\nconst UNSAFE_SEGMENTS = new Set(['__proto__', 'prototype', 'constructor'])\n\n/** Component's own API (dispatch, validate, reset, __invoke, …): computed once from its prototype. */\nconst BASE_API = new Set(Object.getOwnPropertyNames(Component.prototype))\n/** A canonical array index: '0', '12'; not '01', '-1', '1.5' or 'length'. */\nconst INDEX = /^(?:0|[1-9]\\d*)$/\n\n/**\n * Whether the browser may address `segment` of `array`: an existing item or the next one (an append). Anything else\n * would add a named property to the array or leave holes in it (a huge index makes it billions of items long).\n */\nexport function isArraySlot(array: readonly unknown[], segment: string): boolean {\n return INDEX.test(segment) && Number(segment) <= array.length\n}\n\n/**\n * Whether the browser may call `method`: a public method declared on the user's classes below Component, not a hook,\n * not `_private`, not `$magic` (those are handled separately), not a getter and not @Locked.\n */\nexport function isCallable(instance: Component, method: string): boolean {\n if (method === '' || method.startsWith('_') || method.startsWith('$') || method.startsWith('#')) return false\n if (HOOKS.has(method) || HOOK_PREFIX.test(method) || BASE_API.has(method)) return false\n if (lockedOf(instance.constructor).has(method)) return false\n // Stops at Component.prototype, or at Object.prototype for a component built on another copy of Component.\n const isBase = (proto: object) => proto === Component.prototype || proto === Object.prototype\n for (let proto = Object.getPrototypeOf(instance) as object | null; proto !== null && !isBase(proto); proto = Object.getPrototypeOf(proto) as object | null) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, method)\n if (descriptor !== undefined) return typeof descriptor.value === 'function'\n }\n return false\n}\n\n/**\n * Whether the browser may set `path` ('title', 'items.0.name'): the root must be an existing public field that is not\n * `_private`, @Locked or computed; models and collections can't be changed, wherever they sit in the path (nor their\n * attributes); an array is only reached by the index of an existing item or the next one; no prototype keys.\n */\nexport function isUpdatable(instance: Component, path: string): boolean {\n const segments = path.split('.')\n const root = segments[0]!\n if (root === '' || root.startsWith('_') || segments.some((segment) => segment === '' || UNSAFE_SEGMENTS.has(segment))) return false\n if (!Object.hasOwn(instance, root)) return false\n const descriptor = Object.getOwnPropertyDescriptor(instance, root)!\n if (!descriptor.enumerable || descriptor.get !== undefined) return false\n const cls = instance.constructor\n if (lockedOf(cls).has(root) || computedOf(cls).has(root)) return false\n // Walk the existing value along the path: a model or collection anywhere on the way (the root, an array item, an\n // object member, the final value) is read-only, so its attributes can't be set through a dotted path either.\n let node = descriptor.value as unknown\n for (const segment of segments.slice(1)) {\n if (isModel(node) || node instanceof Collection) return false\n if (Array.isArray(node) && !isArraySlot(node, segment)) return false\n if (typeof node !== 'object' || node === null || !Object.hasOwn(node, segment)) return true\n node = (node as Record<string, unknown>)[segment]\n }\n return !isModel(node) && !(node instanceof Collection)\n}\n","import type { Class, ClassRegistry, ModelInstance, ModelStatic } from '@orieljs/contracts'\nimport { Collection } from '@orieljs/collections'\nimport { LiveError } from './errors'\n\n/** A JSON value as it travels in a snapshot. Non-scalars are Livewire-style tuples: [value, { s: '<synth>', … }]. */\nexport type Dehydrated = null | boolean | number | string | [unknown, SynthMeta]\nexport interface SynthMeta {\n s: 'u' | 'arr' | 'obj' | 'dt' | 'mdl' | 'elcln' | 'clctn'\n class?: string\n key?: unknown\n keys?: unknown[]\n}\n\n/** The same structural model check as Queue's serialization: what the ModelInstance contract guarantees. */\nexport function isModel(value: unknown): value is ModelInstance {\n if (typeof value !== 'object' || value === null) return false\n const candidate = value as Record<string, unknown>\n return (\n typeof candidate.getKey === 'function' &&\n typeof candidate.getKeyName === 'function' &&\n typeof candidate.getTable === 'function' &&\n typeof candidate.exists === 'boolean'\n )\n}\n\nconst isPlainObject = (value: object): boolean => {\n const proto: unknown = Object.getPrototypeOf(value)\n return proto === Object.prototype || proto === null\n}\n\nconst isTuple = (value: unknown): value is [unknown, SynthMeta] =>\n Array.isArray(value) &&\n value.length === 2 &&\n typeof value[1] === 'object' &&\n value[1] !== null &&\n !Array.isArray(value[1]) &&\n typeof (value[1] as Partial<SynthMeta>).s === 'string'\n\n/** The registry name of a model class, registering it under its class name the first time (as Queue does). */\nfunction classNameOf(registry: ClassRegistry, cls: Class<unknown>): string {\n return registry.nameOf(cls) ?? registry.register(cls)\n}\n\n/**\n * Encodes one public property value for the snapshot. Only primitives, arrays, plain objects, Dates, saved models and\n * collections are allowed (spec §5.2): anything else throws a LiveError naming the property.\n */\nexport function dehydrate(value: unknown, registry: ClassRegistry, path: string, seen: Set<object> = new Set()): Dehydrated {\n switch (typeof value) {\n case 'undefined':\n return [null, { s: 'u' }]\n case 'string':\n case 'boolean':\n return value\n case 'number':\n if (!Number.isFinite(value)) throw new LiveError(`Property [${path}] is ${value}: Live state must be JSON (finite numbers only).`)\n return value\n case 'bigint':\n case 'symbol':\n case 'function':\n throw new LiveError(`Property [${path}] holds a ${typeof value}: Live state may only hold primitives, arrays, plain objects, Dates, models and collections.`)\n }\n if (value === null) return null\n const object = value as object\n if (seen.has(object)) throw new LiveError(`Property [${path}] contains a circular reference.`)\n seen.add(object)\n try {\n if (object instanceof Date) return [object.toISOString(), { s: 'dt' }]\n if (Array.isArray(object)) return [object.map((item, i) => dehydrate(item, registry, `${path}.${i}`, seen)), { s: 'arr' }]\n if (isModel(object)) {\n const name = classNameOf(registry, object.constructor as Class<unknown>)\n if (!object.exists) throw new LiveError(`Property [${path}] holds an unsaved [${name}] model: only saved models can be kept between requests.`)\n return [null, { s: 'mdl', class: name, key: object.getKey() }]\n }\n if (object instanceof Collection) {\n const items = object.all() as unknown[]\n const first = items[0]\n if (items.length > 0 && isModel(first) && items.every((item) => isModel(item) && item.constructor === first.constructor)) {\n for (const [i, item] of items.entries()) {\n if (!(item as ModelInstance).exists) throw new LiveError(`Property [${path}.${i}] holds an unsaved model.`)\n }\n const name = classNameOf(registry, first.constructor as Class<unknown>)\n return [null, { s: 'elcln', class: name, keys: items.map((item) => (item as ModelInstance).getKey()) }]\n }\n return [items.map((item, i) => dehydrate(item, registry, `${path}.${i}`, seen)), { s: 'clctn' }]\n }\n if (isPlainObject(object)) {\n const out: Record<string, Dehydrated> = {}\n for (const [key, item] of Object.entries(object)) out[key] = dehydrate(item, registry, `${path}.${key}`, seen)\n return [out, { s: 'obj' }]\n }\n const type = (object.constructor as { name?: string } | undefined)?.name || 'object'\n throw new LiveError(\n `Property [${path}] holds a [${type}] instance: Live state may only hold primitives, arrays, plain objects, Dates, models and collections.`,\n )\n } finally {\n seen.delete(object)\n }\n}\n\nfunction modelClass(registry: ClassRegistry, name: unknown): ModelStatic {\n if (typeof name !== 'string' || !registry.has(name)) throw new LiveError(`Unable to hydrate the [${String(name)}] model: it is not registered.`)\n return registry.resolve(name) as unknown as ModelStatic\n}\n\n/** Decodes one snapshot value. Models are re-fetched (a missing row throws the database's ModelNotFound error). */\nexport async function hydrate(value: unknown, registry: ClassRegistry): Promise<unknown> {\n if (!isTuple(value)) return value\n const [inner, meta] = value\n switch (meta.s) {\n case 'u':\n return undefined\n case 'dt':\n return new Date(String(inner))\n case 'arr':\n return Promise.all((inner as unknown[]).map((item) => hydrate(item, registry)))\n case 'clctn':\n return new Collection(await Promise.all((inner as unknown[]).map((item) => hydrate(item, registry))))\n case 'obj': {\n const out: Record<string, unknown> = {}\n for (const [key, item] of Object.entries(inner as Record<string, unknown>)) {\n // JSON.parse makes `__proto__` an own key: define it as data so it can't swap the prototype.\n Object.defineProperty(out, key, { value: await hydrate(item, registry), enumerable: true, writable: true, configurable: true })\n }\n return out\n }\n case 'mdl':\n return modelClass(registry, meta.class).findOrFail(meta.key)\n case 'elcln': {\n const cls = modelClass(registry, meta.class)\n const keys = meta.keys ?? []\n const keyName = new cls().getKeyName()\n const found = [...((await cls.query().whereIn(keyName, keys).get()) as Iterable<ModelInstance>)]\n const byKey = new Map(found.map((model) => [String(model.getKey()), model]))\n return new Collection(keys.map((key) => byKey.get(String(key))).filter((model) => model !== undefined))\n }\n }\n throw new LiveError(`Unknown snapshot value type [${String(meta.s)}].`)\n}\n","import { ConfigRepository, ConsoleKernel, HttpRequest, LiveManager, Router } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { ServiceProvider } from '@orieljs/support'\nimport { registerLiveCommands } from './commands'\nimport { isComponentClass } from './Component'\nimport { LiveComponentManager } from './LiveComponentManager'\nimport { discover } from './naming'\n\n/** The URI the client runtime posts updates to. */\nexport const UPDATE_URI = '/oriel/live/update'\n\n/**\n * Binds the LiveManager, merges the `live` config, registers POST /oriel/live/update (named `live.update`, in the `web`\n * group: sessions and CSRF apply), the make:live command, and the components under app/Live.\n */\nexport class LiveServiceProvider extends ServiceProvider {\n override register(): void {\n this.mergeConfigFrom({ class_path: this.app.appPath('Live'), layout: 'components.layouts.app' }, 'live')\n this.app.singleton(LiveComponentManager, () => new LiveComponentManager(this.app))\n this.app.singleton(LiveManager, (container) => container.make(LiveComponentManager))\n }\n\n override async boot(): Promise<void> {\n const manager = this.app.make(LiveComponentManager)\n if (this.app.bound(Router)) {\n this.app\n .make(Router)\n .post(UPDATE_URI, () => manager.handle(inject(HttpRequest)))\n .middleware('web')\n .name('live.update')\n }\n if (this.app.bound(ConsoleKernel)) registerLiveCommands(this.app.make(ConsoleKernel), this.app)\n const directory = this.app.make(ConfigRepository).get<string>('live.class_path', this.app.appPath('Live'))\n for (const [name, exported] of await this.app.run(() => discover(directory))) {\n if (isComponentClass(exported)) manager.register(exported, name)\n }\n }\n}\n","import { existsSync } from 'node:fs'\nimport { mkdir, writeFile } from 'node:fs/promises'\nimport { dirname, join, relative, sep } from 'node:path'\nimport { ConfigRepository, type Application, type CommandContext, type ConsoleKernel } from '@orieljs/contracts'\nimport { Str } from '@orieljs/support'\n\n/** app/Live/<Path>.tsx, written by make:live. */\nexport const COMPONENT_STUB = `import { Component } from '@orieljs/framework'\n\nexport default class {{ class }} extends Component {\n render() {\n return <div></div>\n }\n}\n`\n\n/** tests/Feature/Live/<Path>.test.ts, written by make:live --test. */\nexport const TEST_STUB = `import { Live } from '@orieljs/framework'\nimport { expect, test } from 'vitest'\nimport {{ class }} from '{{ component }}'\nimport { TestCase } from '{{ testCase }}'\n\nTestCase.boot()\n\ntest('{{ name }} renders', async () => {\n const component = await Live.test({{ class }})\n expect(component.html()).toContain('<div')\n})\n`\n\nconst CLASS_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/\n\n/** An import specifier from `from` (a file) to `to` (a file, extension dropped), always relative (./ or ../). */\nfunction importPath(from: string, to: string): string {\n const path = relative(dirname(from), to).split(sep).join('/').replace(/\\.tsx?$/, '')\n return path.startsWith('.') ? path : `./${path}`\n}\n\n/** make:live Posts/CreatePost [--test] [--force] (Livewire's make:livewire). */\nexport function registerLiveCommands(kernel: ConsoleKernel, app: Application): void {\n kernel\n .command('make:live {name : The component name, e.g. Posts/CreatePost} {--test : Also create a test} {--force : Overwrite existing files}', async function (this: CommandContext) {\n const segments = String(this.argument('name') ?? '')\n .split(/[/\\\\.]+/)\n .filter((segment) => segment !== '')\n .map((segment) => Str.studly(segment))\n if (segments.length === 0 || !segments.every((segment) => CLASS_NAME.test(segment))) {\n this.error(`Component name [${String(this.argument('name'))}] is not valid: use names like Posts/CreatePost.`)\n return 1\n }\n const className = segments.at(-1)!\n const config = app.bound(ConfigRepository) ? app.make(ConfigRepository) : undefined\n const directory = config?.get<string>('live.class_path') ?? app.appPath('Live')\n const file = join(directory, ...segments.slice(0, -1), `${className}.tsx`)\n const force = this.option('force') === true\n if (existsSync(file) && !force) {\n this.error(`Component [${relative(app.basePath(), file)}] already exists.`)\n return 1\n }\n await mkdir(dirname(file), { recursive: true })\n await writeFile(file, COMPONENT_STUB.replace('{{ class }}', () => className))\n this.info(`Component [${relative(app.basePath(), file)}] created successfully.`)\n\n if (this.option('test') === true) {\n const testFile = app.basePath(join('tests', 'Feature', 'Live', ...segments.slice(0, -1), `${className}.test.ts`))\n if (existsSync(testFile) && !force) {\n this.error(`Test [${relative(app.basePath(), testFile)}] already exists.`)\n return 1\n }\n const name = segments.map((segment) => Str.kebab(segment)).join('.')\n const test = TEST_STUB.replaceAll('{{ class }}', () => className)\n .replace('{{ component }}', () => importPath(testFile, file))\n .replace('{{ testCase }}', () => importPath(testFile, app.basePath(join('tests', 'TestCase.ts'))))\n .replace('{{ name }}', () => name)\n await mkdir(dirname(testFile), { recursive: true })\n await writeFile(testFile, test)\n this.info(`Test [${relative(app.basePath(), testFile)}] created successfully.`)\n }\n return 0\n })\n .purpose('Create a new Live component')\n}\n"],"mappings":";AAAA,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,SAAQ,SAAS,UAAU,IAAI;AAAA,IACjE;AAAA,EACF;AACF;","names":["methods","LiveManager","inject","LiveManager","inject","fail","inject","LiveManager","inject","LiveManager","Str","Collection","Collection","Str","node","ConfigRepository","HttpRequest","LiveManager","inject","existsSync","join","relative","sep","ConfigRepository","Str","LiveManager","inject","HttpRequest","ConfigRepository"]}
|
|
1
|
+
{"version":3,"sources":["../Component.ts","../metadata.ts","../embed.ts","../Testable.ts","../errors.ts","../html.ts","../LiveComponentManager.ts","../checksum.ts","../naming.ts","../persistent.ts","../security.ts","../synthesizers.ts","../LiveServiceProvider.ts","../commands.ts"],"sourcesContent":["import { LiveManager, UrlGenerator, ValidationFactory, type Class, type MessageBag, type Rules } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { forgetComputed } from './metadata'\n\n/** Marks Live component classes (Symbol.for, so two copies of the package agree). */\nexport const COMPONENT: unique symbol = Symbol.for('oriel:live.component') as never\n\n/** A browser event queued by dispatch(). `to` is resolved to a component name when the effects are built. */\nexport interface QueuedDispatch {\n name: string\n params: Record<string, unknown>\n self?: true\n to?: string | Class<Component>\n}\n\n/** Per-request bookkeeping of one component instance. Kept outside the instance so it never becomes state. */\nexport interface ComponentState {\n id: string\n name: string\n errors: Record<string, string[]>\n dispatches: QueuedDispatch[]\n redirect?: string\n redirectUsingNavigate?: true\n skipRender: boolean\n}\n\nconst states = new WeakMap<object, ComponentState>()\n\n/** The bookkeeping of an instance, created on first use (an instance built by the router has none yet). */\nexport function stateOf(component: object): ComponentState {\n let state = states.get(component)\n if (state === undefined) states.set(component, (state = { id: '', name: '', errors: {}, dispatches: [], skipRender: false }))\n return state\n}\n\n/** Whether `value` is a class extending Component. */\nexport function isComponentClass(value: unknown): value is Class<Component> {\n return typeof value === 'function' && (value as unknown as Record<symbol, unknown>)[COMPONENT] === true\n}\n\n/** The validation errors of a component (Laravel's MessageBag), for render(): `this.errors.first('title')`. */\nexport class ErrorBag implements MessageBag {\n constructor(private readonly messages: Record<string, string[]>) {}\n\n has(key: string): boolean {\n return (this.messages[key]?.length ?? 0) > 0\n }\n\n first(key?: string): string | undefined {\n return key === undefined ? this.all()[0] : this.messages[key]?.[0]\n }\n\n get(key: string): string[] {\n return [...(this.messages[key] ?? [])]\n }\n\n all(): string[] {\n return Object.values(this.messages).flat()\n }\n\n any(): boolean {\n return !this.isEmpty()\n }\n\n isEmpty(): boolean {\n return this.count() === 0\n }\n\n count(): number {\n return this.all().length\n }\n\n toObject(): Record<string, string[]> {\n return Object.fromEntries(Object.entries(this.messages).map(([key, messages]) => [key, [...messages]]))\n }\n}\n\n/** What dispatch() returns: `this.dispatch('saved').self()` or `.to(Sidebar)`. */\nexport class PendingEvent {\n constructor(private readonly event: QueuedDispatch) {}\n\n /** Only this component's own listeners receive the event. */\n self(): this {\n this.event.self = true\n delete this.event.to\n return this\n }\n\n /** Only components of this class (or registered name) receive the event. */\n to(component: string | Class<Component>): this {\n this.event.to = component\n delete this.event.self\n return this\n }\n}\n\n/**\n * A Live component (Livewire 3): public fields are its state, public methods are actions the browser can call, and\n * render() returns its TSX. Lifecycle hooks, all optional: `boot()`, `mount(params)`, `hydrate()`, `dehydrate()`,\n * `updating(name, value)`/`updated(name, value)` and per property `updatingTitle(value)`/`updatedTitle(value)`,\n * `rendering()`/`rendered(html)`. Fields that must not be state use `#private` syntax.\n */\nexport abstract class Component {\n static readonly [COMPONENT] = true\n\n /** The view that wraps a full-page component (default: config `live.layout`). */\n static layout?: string\n /** The page title passed to the layout as `title`. */\n static title?: string\n /** Static fallbacks for runtimes without decorators: { event: 'method' }, locked names, computed getter names. */\n static listeners?: Record<string, string>\n static locked?: string[]\n static computed?: string[]\n\n abstract render(): unknown\n\n getId(): string {\n return stateOf(this).id\n }\n\n getName(): string {\n return stateOf(this).name\n }\n\n /** Dispatches a browser event; every component listening for it (@On) runs its handler. */\n dispatch(name: string, params: Record<string, unknown> = {}): PendingEvent {\n const event: QueuedDispatch = { name, params }\n stateOf(this).dispatches.push(event)\n return new PendingEvent(event)\n }\n\n /** Sends the browser to `url` after this request; `navigate` uses o:navigate instead of a full page load. */\n redirect(url: string, options: { navigate?: boolean } = {}): void {\n const state = stateOf(this)\n state.redirect = url\n if (options.navigate === true) state.redirectUsingNavigate = true\n else delete state.redirectUsingNavigate\n }\n\n redirectRoute(name: string, parameters?: unknown, options: { navigate?: boolean } = {}): void {\n this.redirect(inject(UrlGenerator).route(name, parameters), options)\n }\n\n /**\n * Validates the public state. On success clears the error bag and returns the validated data; on failure fills the\n * error bag and throws (the rest of the action is skipped and the component re-renders with `errors`).\n */\n async validate<T = Record<string, unknown>>(rules: Rules, messages?: Record<string, string>, attributes?: Record<string, string>): Promise<T> {\n const validator = inject(ValidationFactory).make(Object.fromEntries(Object.entries(this)), rules, messages, attributes)\n try {\n const data = await validator.validated<T>()\n stateOf(this).errors = {}\n return data\n } catch (error) {\n const errors = (error as { kind?: unknown; errors?: Record<string, string[]> }).errors\n if ((error as { kind?: unknown }).kind === 'Validation' && errors !== undefined) stateOf(this).errors = { ...errors }\n throw error\n }\n }\n\n addError(key: string, message: string): void {\n ;(stateOf(this).errors[key] ??= []).push(message)\n }\n\n /** Clears every error, or only those of `keys`. */\n resetErrorBag(...keys: string[]): void {\n const state = stateOf(this)\n if (keys.length === 0) state.errors = {}\n else for (const key of keys) delete state.errors[key]\n }\n\n get errors(): ErrorBag {\n return new ErrorBag(stateOf(this).errors)\n }\n\n /** Puts public properties (all of them when none are named) back to their initial values. */\n reset(...properties: string[]): void {\n const fresh = new (this.constructor as new () => Record<string, unknown>)()\n const names = properties.length > 0 ? properties : Object.keys(this)\n for (const name of names) if (Object.hasOwn(fresh, name)) (this as unknown as Record<string, unknown>)[name] = fresh[name]\n forgetComputed(this)\n }\n\n /** Keeps the current HTML: the response carries the new state but no `html` effect. */\n skipRender(): void {\n stateOf(this).skipRender = true\n }\n\n /** A full-page component as a route action: Route.get('/counter', Counter). Route parameters go to mount(). */\n async __invoke(): Promise<unknown> {\n return inject(LiveManager).page(this)\n }\n}\n","/**\n * TC39 decorators for Live components (@On, @Locked, @Computed) and the readers that merge them with the static\n * fallbacks (`static listeners`, `static locked`, `static computed`).\n *\n * Neither Node 24 nor Bun defines Symbol.metadata, and compilers only attach decorator metadata when it exists, so it\n * is installed (as the registered symbol, which TypeScript, esbuild and Bun agree on) before any component loads.\n */\n;(Symbol as { metadata?: symbol }).metadata ??= Symbol.for('Symbol.metadata')\n\nconst LISTENERS = Symbol.for('oriel:live.listeners')\nconst LOCKED = Symbol.for('oriel:live.locked')\nconst COMPUTED = Symbol.for('oriel:live.computed')\n\ntype Metadata = Record<PropertyKey, unknown>\n\n/**\n * The subclass's metadata object inherits from its parent's through the prototype chain, so a list read from it may\n * be the parent's: copy it onto the subclass before adding to it.\n */\nfunction own<T>(metadata: Metadata, key: symbol, empty: () => T, copy: (inherited: T) => T): T {\n if (!Object.hasOwn(metadata, key)) metadata[key] = metadata[key] === undefined ? empty() : copy(metadata[key] as T)\n return metadata[key] as T\n}\n\n/** @On('post-created'): calls the method when the event is dispatched (by this or any component, or the browser). */\nexport function On(event: string) {\n return function (_method: unknown, context: ClassMethodDecoratorContext): void {\n const listeners = own<Record<string, string[]>>(context.metadata as Metadata, LISTENERS, () => ({}), (inherited) =>\n Object.fromEntries(Object.entries(inherited).map(([name, methods]) => [name, [...methods]])),\n )\n // An override decorated like the method it replaces is still one listener.\n const methods = (listeners[event] ??= [])\n if (!methods.includes(String(context.name))) methods.push(String(context.name))\n }\n}\n\n/** @Locked: a property the browser can't change, or a method the browser can't call. */\nexport function Locked(_target: unknown, context: ClassFieldDecoratorContext | ClassMethodDecoratorContext): void {\n own<string[]>(context.metadata as Metadata, LOCKED, () => [], (inherited) => [...inherited]).push(String(context.name))\n}\n\n/** Per-instance caches of @Computed getters. A component instance lives for one request, so this is per request. */\nconst computedCache = new WeakMap<object, Map<string, unknown>>()\n\n/** Runs the getter once per instance (one request) and returns the cached value afterwards. */\nexport function cachedGetter<T>(name: string, getter: (this: object) => T): (this: object) => T {\n return function (this: object): T {\n let cache = computedCache.get(this)\n if (cache === undefined) computedCache.set(this, (cache = new Map()))\n if (!cache.has(name)) cache.set(name, getter.call(this))\n return cache.get(name) as T\n }\n}\n\n/** @Computed: a getter cached for the rest of the request, never part of the component's state. */\nexport function Computed<T>(getter: (this: object) => T, context: ClassGetterDecoratorContext): (this: object) => T {\n own<string[]>(context.metadata as Metadata, COMPUTED, () => [], (inherited) => [...inherited]).push(String(context.name))\n return cachedGetter(String(context.name), getter)\n}\n\n/** Drops the cached @Computed values of one instance (after `reset()`, for example). */\nexport function forgetComputed(instance: object): void {\n computedCache.delete(instance)\n}\n\ninterface Statics {\n listeners?: Record<string, string>\n locked?: string[]\n computed?: string[]\n [key: symbol]: unknown\n}\n\nfunction metadataOf(cls: Statics): Metadata {\n return (cls[(Symbol as unknown as { metadata: symbol }).metadata] as Metadata | undefined) ?? {}\n}\n\n/**\n * The classes from the root of the chain down to `cls`. Static properties shadow along the chain instead of merging, so\n * each level's own statics are read separately and added to its parent's.\n */\nfunction chainOf(cls: object): Statics[] {\n const chain: Statics[] = []\n for (let c: object | null = cls; c !== null && c !== Function.prototype; c = Object.getPrototypeOf(c) as object | null) {\n chain.unshift(c as Statics)\n }\n return chain\n}\n\n/** The values of the own static `key` of every class in the chain, parents first. */\nfunction staticsOf<K extends 'listeners' | 'locked' | 'computed'>(cls: object, key: K): NonNullable<Statics[K]>[] {\n return chainOf(cls).flatMap((c) => (Object.hasOwn(c, key) && c[key] !== undefined ? [c[key] as NonNullable<Statics[K]>] : []))\n}\n\n/** Event name → method names, from @On and `static listeners` (of the class and its parents). */\nexport function listenersOf(cls: object): Record<string, string[]> {\n const result: Record<string, string[]> = {}\n for (const [event, methods] of Object.entries((metadataOf(cls as Statics)[LISTENERS] as Record<string, string[]> | undefined) ?? {})) {\n result[event] = [...methods]\n }\n for (const listeners of staticsOf(cls, 'listeners')) {\n for (const [event, method] of Object.entries(listeners)) {\n const methods = (result[event] ??= [])\n if (!methods.includes(method)) methods.push(method)\n }\n }\n return result\n}\n\n/** Locked property and method names, from @Locked and `static locked` (of the class and its parents). */\nexport function lockedOf(cls: object): Set<string> {\n return new Set([...((metadataOf(cls as Statics)[LOCKED] as string[] | undefined) ?? []), ...staticsOf(cls, 'locked').flat()])\n}\n\n/** Computed getter names, from @Computed and `static computed` (of the class and its parents). */\nexport function computedOf(cls: object): Set<string> {\n return new Set([...((metadataOf(cls as Statics)[COMPUTED] as string[] | undefined) ?? []), ...staticsOf(cls, 'computed').flat()])\n}\n","import { LiveManager, type Class, type Htmlable } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport type { Component } from './Component'\nimport { Testable } from './Testable'\n\n/** Props of `<Live component={Counter} count={3} o:key=\"c1\" />`: the rest become mount params. */\nexport interface LiveProps {\n component: Class<Component> | string\n /** Identifies a child inside its parent across re-renders (Livewire's :key / wire:key). */\n 'o:key'?: string | number\n [param: string]: unknown\n}\n\n/** Blade's @livewire('counter', ['count' => 3], key('c1')): the component's first render, as trusted HTML. */\nexport async function live(component: Class<Component> | string, params: Record<string, unknown> = {}, key?: string | number): Promise<Htmlable> {\n const html = await inject(LiveManager).mount(component, params, key === undefined ? undefined : String(key))\n return { toHtml: () => html }\n}\n\n/** `<Live component={Counter} />` in any view or component. */\nfunction LiveComponent({ component, 'o:key': key, children: _children, ...params }: LiveProps): Promise<Htmlable> {\n return live(component, params, key)\n}\n\n/** The `<Live />` element, and the Live facade: Live.component(name, Class), Live.test(Component). */\nexport const Live = Object.assign(LiveComponent, {\n /** Registers a component under a name (components in app/Live are registered at boot). */\n component(name: string, component: Class<Component>): void {\n inject(LiveManager).register(component, name)\n },\n /** Livewire::test(): mounts `component` for assertions. */\n test<C extends Component>(component: Class<C> | string, params: Record<string, unknown> = {}): Promise<Testable<C>> {\n return Testable.create(component, params)\n },\n})\n","import { AssertionError } from 'node:assert'\nimport { isDeepStrictEqual } from 'node:util'\nimport { LiveManager, token, type Class, type LiveEffects } from '@orieljs/contracts'\nimport { Container, currentContainer, inject } from '@orieljs/container'\nimport { stateOf, type Component } from './Component'\nimport { escapeAttribute } from './html'\nimport type { ComponentResult, LiveComponentManager } from './LiveComponentManager'\n\nconst fail = (message: string, actual?: unknown, expected?: unknown): never => {\n throw new AssertionError({ message, actual, expected, operator: 'live' })\n}\n\nconst getPath = (target: unknown, path: string): unknown =>\n path.split('.').reduce<unknown>((node, segment) => (typeof node === 'object' && node !== null ? (node as Record<string, unknown>)[segment] : undefined), target)\n\n/**\n * Runs Live.test()'s mount and each update. The testing package binds one for every test, so they run in a request\n * scope like the test's HTTP requests (a request, the carried session, actingAs users) and what they change carries\n * on to the next request. Without one they run in the current scope.\n */\nexport type TestRequestScope = <T>(run: () => Promise<T>) => Promise<T>\nexport const TestRequestScope = token<TestRequestScope>('Testing.RequestScope')\n\nfunction requestScope(): TestRequestScope {\n const container = currentContainer() ?? Container.getInstance()\n return container?.bound(TestRequestScope) === true ? container.make(TestRequestScope) : (run) => run()\n}\n\n/**\n * Livewire's Livewire::test(): drives one component through the real mount → snapshot → checksum → update pipeline\n * (no HTTP), inside the test's request scope. Actions are async (`await counter.call('increment')`); assertions are\n * sync and return `this`.\n */\nexport class Testable<C extends Component = Component> {\n #snapshot: string\n #html: string\n #effects: LiveEffects\n #instance: C\n\n private constructor(\n private readonly manager: LiveComponentManager,\n private readonly scope: TestRequestScope,\n result: ComponentResult,\n ) {\n this.#snapshot = JSON.stringify(result.snapshot)\n this.#html = result.html ?? ''\n this.#effects = result.effects\n this.#instance = result.instance as C\n }\n\n /** Mounts `component` with `params`, as `<Live component={…} {...params} />` would. */\n static async create<C extends Component>(component: Class<C> | string, params: Record<string, unknown> = {}): Promise<Testable<C>> {\n const scope = requestScope()\n const manager = inject(LiveManager) as unknown as LiveComponentManager\n return new Testable<C>(manager, scope, await scope(() => manager.mountComponent(component, params)))\n }\n\n /** The component instance after the last request. */\n instance(): C {\n return this.#instance\n }\n\n /** A public property (dotted paths reach into arrays and objects). */\n get<T = unknown>(path: string): T {\n return getPath(this.#instance, path) as T\n }\n\n /** The last rendered HTML, without the o:id, o:snapshot and o:effects attributes (Livewire strips them too). */\n html(): string {\n return this.#html.replace(/ o:(id|snapshot|effects)=\"[^\"]*\"/g, '')\n }\n\n /** The effects of the last request. */\n effects(): LiveEffects {\n return this.#effects\n }\n\n async set(path: string | Record<string, unknown>, value?: unknown): Promise<this> {\n return this.#update(typeof path === 'string' ? { [path]: value } : path, [])\n }\n\n async call(method: string, ...params: unknown[]): Promise<this> {\n return this.#update({}, [{ method, params }])\n }\n\n async toggle(path: string): Promise<this> {\n return this.#update({}, [{ method: '$toggle', params: [path] }])\n }\n\n /** Dispatches an event to this component, as the browser does for its listeners. */\n async dispatch(event: string, params: Record<string, unknown> = {}): Promise<this> {\n return this.#update({}, [{ method: '__dispatch', params: [event, params] }])\n }\n\n async refresh(): Promise<this> {\n return this.#update({}, [{ method: '$refresh', params: [] }])\n }\n\n async #update(updates: Record<string, unknown>, calls: Array<{ method: string; params: unknown[] }>): Promise<this> {\n const result = await this.scope(() => this.manager.updateComponent(this.#snapshot, updates, calls))\n this.#snapshot = JSON.stringify(result.snapshot)\n if (result.html !== undefined) this.#html = result.html\n this.#effects = result.effects\n this.#instance = result.instance as C\n return this\n }\n\n assertSet(path: string, value: unknown): this {\n const actual = this.get(path)\n if (!isDeepStrictEqual(actual, value)) fail(`Failed asserting that property [${path}] is set to the expected value.`, actual, value)\n return this\n }\n\n assertNotSet(path: string, value: unknown): this {\n if (isDeepStrictEqual(this.get(path), value)) fail(`Failed asserting that property [${path}] is not set to the given value.`, this.get(path), value)\n return this\n }\n\n /** Each value, HTML-escaped, appears in the rendered HTML. */\n assertSee(...values: string[]): this {\n for (const value of values) if (!this.html().includes(escapeAttribute(value))) fail(`Failed asserting that [${value}] is in the rendered HTML.`, this.html(), value)\n return this\n }\n\n assertDontSee(...values: string[]): this {\n for (const value of values) if (this.html().includes(escapeAttribute(value))) fail(`Failed asserting that [${value}] is not in the rendered HTML.`, this.html(), value)\n return this\n }\n\n /** Each value appears in the rendered HTML as written (not escaped). */\n assertSeeHtml(...values: string[]): this {\n for (const value of values) if (!this.html().includes(value)) fail(`Failed asserting that [${value}] is in the rendered HTML.`, this.html(), value)\n return this\n }\n\n assertDispatched(name: string, params?: Record<string, unknown>): this {\n const dispatched = (this.#effects.dispatches ?? []).filter((event) => event.name === name)\n if (dispatched.length === 0) fail(`Failed asserting that an event [${name}] was dispatched.`, this.#effects.dispatches ?? [], name)\n if (params !== undefined && !dispatched.some((event) => isDeepStrictEqual(event.params, params))) {\n fail(`Failed asserting that event [${name}] was dispatched with the expected params.`, dispatched.map((event) => event.params), params)\n }\n return this\n }\n\n assertNotDispatched(name: string): this {\n if ((this.#effects.dispatches ?? []).some((event) => event.name === name)) fail(`Failed asserting that an event [${name}] was not dispatched.`)\n return this\n }\n\n /** The error bag has errors for every key given (or any error at all with no keys). */\n assertHasErrors(keys: string | string[] = []): this {\n const errors = stateOf(this.#instance).errors\n const wanted = [keys].flat()\n if (wanted.length === 0 && Object.keys(errors).length === 0) fail('Component has no errors.', errors)\n for (const key of wanted) if ((errors[key]?.length ?? 0) === 0) fail(`Component missing error: ${key}`, errors, key)\n return this\n }\n\n /** No errors for the keys given (or none at all with no keys). */\n assertHasNoErrors(keys: string | string[] = []): this {\n const errors = stateOf(this.#instance).errors\n const wanted = [keys].flat()\n const found = wanted.length === 0 ? Object.keys(errors).filter((key) => (errors[key]?.length ?? 0) > 0) : wanted.filter((key) => (errors[key]?.length ?? 0) > 0)\n if (found.length > 0) fail(`Component has errors: \"${found.join('\", \"')}\"`, errors)\n return this\n }\n\n assertRedirect(url?: string): this {\n const redirect = this.#effects.redirect\n if (redirect === undefined) fail('Component did not perform a redirect.')\n if (url !== undefined && redirect !== url) fail('Component redirected to an unexpected URL.', redirect, url)\n return this\n }\n\n assertNoRedirect(): this {\n if (this.#effects.redirect !== undefined) fail('Component performed a redirect.', this.#effects.redirect)\n return this\n }\n\n /** The last call returned `value`. */\n assertReturned(value: unknown): this {\n const returned = this.#effects.returns?.at(-1)\n if (!isDeepStrictEqual(returned, value)) fail('Failed asserting that the method returned the expected value.', returned, value)\n return this\n }\n}\n","import type { ErrorKind, OrielError } from '@orieljs/contracts'\n\n/** A Live programming error (unsupported state, a missing root element, an unknown component): a 500. */\nexport class LiveError extends Error implements OrielError {\n override readonly name: string = 'LiveError'\n readonly kind: ErrorKind = 'Server'\n readonly status: number = 500\n}\n\n/** A snapshot whose checksum doesn't match (tampered with, or signed with another APP_KEY). Nothing is hydrated. */\nexport class CorruptComponentPayloadError extends LiveError {\n override readonly name: string = 'CorruptComponentPayloadError'\n override readonly kind: ErrorKind = 'Authorization'\n override readonly status: number = 403\n\n constructor(component = 'unknown') {\n super(`Live encountered corrupt data when trying to hydrate the [${component}] component.`)\n }\n}\n\n/** The browser asked for a method that isn't a public action of the component. */\nexport class MethodNotCallableError extends LiveError {\n override readonly name: string = 'MethodNotCallableError'\n override readonly kind: ErrorKind = 'Authorization'\n override readonly status: number = 403\n\n constructor(method: string, component: string) {\n super(`Unable to call component method. Public method [${method}] not found on component [${component}].`)\n }\n}\n\n/** The browser tried to set a property that is locked, computed, private (`_x`) or not declared. */\nexport class PropertyNotUpdatableError extends LiveError {\n override readonly name: string = 'PropertyNotUpdatableError'\n override readonly kind: ErrorKind = 'Authorization'\n override readonly status: number = 403\n\n constructor(path: string, component: string) {\n super(`Cannot update property [${path}] on component [${component}]: it is not a public, unlocked property.`)\n }\n}\n\n/** A snapshot names a component that isn't registered. */\nexport class LiveComponentNotFoundError extends LiveError {\n override readonly name: string = 'LiveComponentNotFoundError'\n override readonly kind: ErrorKind = 'Http'\n override readonly status: number = 404\n\n constructor(component: string) {\n super(`Unable to find component: [${component}].`)\n }\n}\n\n/** An update request without the X-Oriel-Live header or with a malformed body. */\nexport class InvalidLiveRequestError extends LiveError {\n override readonly name: string = 'InvalidLiveRequestError'\n override readonly kind: ErrorKind = 'Http'\n override readonly status: number = 400\n}\n","import { LiveError } from './errors'\n\nconst ESCAPES: Record<string, string> = { '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' }\n\n/** Laravel's e(): for attribute values (the snapshot JSON goes into an attribute). */\nexport function escapeAttribute(value: string): string {\n return value.replace(/[&<>\"']/g, (char) => ESCAPES[char]!)\n}\n\nconst VOID = new Set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'source', 'track', 'wbr'])\nconst RAW_TEXT = new Set(['script', 'style', 'textarea', 'title'])\n/** A closing tag, or an opening tag with its (quoted) attributes. */\nconst TOKEN = /<\\/([A-Za-z][\\w:-]*)\\s*>|<([A-Za-z][\\w:-]*)(?:\\s+[^\\s\"'<>/=]+(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s\"'=<>`]+))?)*\\s*(\\/?)>/g\n\n/** The name of the single root element of `html`; throws when there is none or there are several (Livewire's rule). */\nexport function rootTag(html: string, component: string): string {\n const fail = (): never => {\n throw new LiveError(`Live only supports one HTML element per component. Multiple root elements were detected for component [${component}].`)\n }\n const source = html.replace(/<!--[\\s\\S]*?-->/g, '').trim()\n let depth = 0\n let root: string | undefined\n let rootEnd = -1\n TOKEN.lastIndex = 0\n for (let match = TOKEN.exec(source); match !== null; match = TOKEN.exec(source)) {\n const [token, closing, opening, selfClosing] = match\n if (root === undefined && match.index !== 0) fail()\n if (depth === 0 && root !== undefined) fail()\n if (opening !== undefined) {\n const tag = opening.toLowerCase()\n root ??= tag\n if (selfClosing === '/' || VOID.has(tag)) {\n if (depth === 0) rootEnd = match.index + token.length\n continue\n }\n if (RAW_TEXT.has(tag)) {\n // Search the original string: lowercasing it can change its length (U+0130), which would shift the index.\n const closer = new RegExp(`</${tag}`, 'gi')\n closer.lastIndex = TOKEN.lastIndex\n const end = closer.exec(source)\n if (end !== null) TOKEN.lastIndex = end.index\n }\n depth++\n } else if (closing !== undefined) {\n if (--depth < 0) fail()\n if (depth === 0) rootEnd = match.index + token.length\n }\n }\n if (root === undefined || depth !== 0 || source.slice(rootEnd).trim() !== '') fail()\n return root!\n}\n\n/** Adds ` name=\"value\"` pairs (values escaped) right after the root tag's name. */\nexport function insertAttributesIntoRoot(html: string, attributes: Record<string, string>): string {\n const source = html.trim()\n const match = /^((?:<!--[\\s\\S]*?-->\\s*)*<[A-Za-z][\\w:-]*)/.exec(source)\n if (match === null) throw new LiveError('Live could not find the root element of the component.')\n const rendered = Object.entries(attributes)\n .map(([name, value]) => ` ${name}=\"${escapeAttribute(value)}\"`)\n .join('')\n return match[1] + rendered + source.slice(match[1]!.length)\n}\n","import { AsyncLocalStorage } from 'node:async_hooks'\nimport { randomBytes } from 'node:crypto'\nimport {\n ClassRegistry,\n ConfigRepository,\n CurrentRoute,\n Encrypter,\n HttpRequest,\n Redirector,\n Router,\n ViewFactory,\n type Application,\n type Class,\n type Container,\n type LiveEffects,\n type LiveManager,\n type LiveSnapshot,\n type LiveUpdateRequest,\n type LiveUpdateResponse,\n type Token,\n} from '@orieljs/contracts'\nimport { currentContainer } from '@orieljs/container'\nimport { Str } from '@orieljs/support'\nimport { checksum, verifyChecksum } from './checksum'\nimport { isComponentClass, stateOf, type Component } from './Component'\nimport { LiveComponentNotFoundError, CorruptComponentPayloadError, InvalidLiveRequestError, LiveError, MethodNotCallableError, PropertyNotUpdatableError } from './errors'\nimport { escapeAttribute, insertAttributesIntoRoot, rootTag } from './html'\nimport { cachedGetter, computedOf, listenersOf } from './metadata'\nimport { defaultName } from './naming'\nimport { PERSISTENT_MIDDLEWARE, persistentMiddleware, throughMiddleware } from './persistent'\nimport { isArraySlot, isCallable, isUpdatable } from './security'\nimport { dehydrate, hydrate } from './synthesizers'\n\ntype Memo = LiveSnapshot['memo']\ntype Children = Memo['children']\ntype Call = { method: string; params: unknown[] }\n\n/** The children rendered so far by the component being rendered, and those it had before (for placeholders). */\ninterface RenderContext {\n previous: Children\n children: Children\n index: number\n}\n\n/** One component after a mount or an update: the live instance (for Live.test), its snapshot, effects and HTML. */\nexport interface ComponentResult {\n instance: Component\n snapshot: LiveSnapshot\n effects: LiveEffects\n /** The rendered HTML with o:id (and, after a mount, o:snapshot/o:effects); undefined after skipRender(). */\n html?: string\n tag?: string\n}\n\nconst renderContext = new AsyncLocalStorage<RenderContext>()\n\n/** The page an update belongs to (its memo path and method): components mounted during the update keep it. */\nconst pageRequest = new AsyncLocalStorage<{ path: string; method: string }>()\n\n/** A binding of the current container, or undefined (scoped bindings throw on the application outside a request). */\nfunction optional<T>(container: Container, token: Token<T>): T | undefined {\n if (!container.bound(token)) return undefined\n try {\n return container.make(token)\n } catch {\n return undefined\n }\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null && !Array.isArray(value)\n\n/** Sets an own enumerable property, even for a key like '__proto__' (an assignment would change the prototype). */\nfunction setOwn<T>(object: Record<string, T>, key: string, value: T): void {\n Object.defineProperty(object, key, { value, enumerable: true, writable: true, configurable: true })\n}\n\nasync function hook(instance: Component, name: string, ...args: unknown[]): Promise<void> {\n const method = (instance as unknown as Record<string, unknown>)[name]\n if (typeof method === 'function') await (method as (...values: unknown[]) => unknown).apply(instance, args)\n}\n\n/** Livewire's update request handling and first render, on Oriel's contracts. */\nexport class LiveComponentManager implements LiveManager {\n constructor(private readonly app: Application) {}\n\n /** The request scope when there is one (sessions, the current route), else the application. */\n private container(): Container {\n return currentContainer() ?? this.app\n }\n\n private registry(): ClassRegistry {\n return this.container().make(ClassRegistry)\n }\n\n /** Live.component('counter', Counter): registers a component under a name the snapshots use. */\n register(component: Class<unknown>, name?: string): void {\n if (!isComponentClass(component)) throw new LiveError(`[${component.name}] is not a Live component: it must extend Component.`)\n const resolved = name ?? defaultName(component)\n if (resolved === undefined) throw new LiveError('Anonymous component classes need a name: Live.component(name, Class).')\n this.registry().register(component, resolved)\n }\n\n /** The registered name of a component class, registering it under its kebab-case class name the first time. */\n nameOf(component: Class<Component>): string {\n const registry = this.registry()\n const existing = registry.nameOf(component)\n if (existing !== undefined) return existing\n this.register(component)\n return registry.nameOf(component)!\n }\n\n resolve(name: string): Class<Component> {\n const registry = this.registry()\n if (!registry.has(name)) throw new LiveComponentNotFoundError(name)\n const cls = registry.resolve(name)\n if (!isComponentClass(cls)) throw new LiveComponentNotFoundError(name)\n return cls\n }\n\n isLiveRequest(request: HttpRequest): boolean {\n return request.header('X-Oriel-Live') === 'true'\n }\n\n /** The first render: HTML with o:id, o:snapshot and o:effects on the root element. */\n async mount(component: string | Class<unknown>, params: Record<string, unknown> = {}, key?: string): Promise<string> {\n const context = renderContext.getStore()\n if (context === undefined) return (await this.mountComponent(component, params)).html!\n const childKey = key ?? `lw-${context.index++}`\n // Own keys only: a key taken from data ('constructor', '__proto__') must not find or change Object.prototype.\n const existing = Object.hasOwn(context.previous, childKey) ? context.previous[childKey] : undefined\n if (existing !== undefined) {\n // The child already lives in the browser: a placeholder the client keeps as it is (Livewire's behaviour).\n setOwn(context.children, childKey, existing)\n return `<${existing[0]} o:id=\"${escapeAttribute(existing[1])}\"></${existing[0]}>`\n }\n const result = await this.mountComponent(component, params)\n setOwn(context.children, childKey, [result.tag!, result.snapshot.memo.id])\n return result.html!\n }\n\n async mountComponent(component: string | Class<unknown>, params: Record<string, unknown> = {}, existing?: Component): Promise<ComponentResult> {\n const cls = typeof component === 'string' ? this.resolve(component) : (component as Class<Component>)\n if (!isComponentClass(cls)) throw new LiveError(`[${(cls as { name?: string }).name}] is not a Live component: it must extend Component.`)\n const name = this.nameOf(cls)\n const instance = existing ?? this.container().make(cls)\n const state = stateOf(instance)\n state.id = randomBytes(15).toString('base64url')\n state.name = name\n await hook(instance, 'boot')\n for (const [property, value] of Object.entries(params)) {\n if (Object.hasOwn(instance, property)) (instance as unknown as Record<string, unknown>)[property] = value\n }\n this.prepareComputed(instance)\n await hook(instance, 'mount', params)\n const request = optional(this.container(), HttpRequest)\n const page = pageRequest.getStore() ?? { path: request?.path() ?? '', method: request?.method() ?? 'GET' }\n const memo: Memo = { id: state.id, name, path: page.path, method: page.method, children: {}, errors: {} }\n const { html, tag } = await this.render(instance, memo, {})\n const effects = this.effects(instance)\n const listeners = Object.keys(listenersOf(cls))\n if (listeners.length > 0) effects.listeners = listeners\n const snapshot = await this.snapshot(instance, memo)\n const attributes: Record<string, string> = { 'o:snapshot': JSON.stringify(snapshot), 'o:effects': JSON.stringify(effects), 'o:id': state.id }\n return { instance, snapshot, effects, html: insertAttributesIntoRoot(html, attributes), tag }\n }\n\n /** Applies each component's updates and calls, re-renders it and returns its new snapshot and effects. */\n async update(request: LiveUpdateRequest): Promise<LiveUpdateResponse> {\n const components: LiveUpdateResponse['components'] = []\n for (const component of request.components) {\n const { memo } = this.verify(component.snapshot)\n const result = await pageRequest.run({ path: memo.path, method: memo.method }, () => this.updateComponent(component.snapshot, component.updates, component.calls))\n components.push({ snapshot: JSON.stringify(result.snapshot), effects: result.effects })\n }\n return { components }\n }\n\n async updateComponent(snapshotJson: string, updates: Record<string, unknown>, calls: Call[]): Promise<ComponentResult> {\n const snapshot = this.verify(snapshotJson)\n const cls = this.resolve(snapshot.memo.name)\n const instance = this.container().make(cls)\n const state = stateOf(instance)\n state.id = snapshot.memo.id\n state.name = snapshot.memo.name\n state.errors = { ...snapshot.memo.errors }\n await hook(instance, 'boot')\n const registry = this.registry()\n for (const [property, value] of Object.entries(snapshot.data)) {\n Object.defineProperty(instance, property, { value: await hydrate(value, registry), enumerable: true, writable: true, configurable: true })\n }\n this.prepareComputed(instance)\n await hook(instance, 'hydrate')\n\n const returns: unknown[] = []\n try {\n for (const [path, value] of Object.entries(updates)) await this.applyUpdate(instance, path, value)\n for (const call of calls) returns.push(await this.call(instance, call.method, call.params))\n } catch (error) {\n // A failed validate() (or any validation error) stops the remaining calls; the component re-renders with errors.\n const errors = (error as { kind?: unknown; errors?: unknown }).errors\n if ((error as { kind?: unknown }).kind !== 'Validation' || !isRecord(errors)) throw error\n state.errors = { ...(errors as Record<string, string[]>) }\n }\n\n const memo: Memo = { ...snapshot.memo, children: { ...snapshot.memo.children } }\n const effects = this.effects(instance)\n let html: string | undefined\n let tag: string | undefined\n if (!state.skipRender) {\n ;({ html, tag } = await this.render(instance, memo, snapshot.memo.children))\n html = insertAttributesIntoRoot(html, { 'o:id': state.id })\n effects.html = html\n }\n if (calls.length > 0) effects.returns = returns\n return { instance, snapshot: await this.snapshot(instance, memo), effects, html, tag }\n }\n\n /**\n * The route action of POST /oriel/live/update. Each component's update runs behind the auth middleware of the route\n * that rendered its page (Livewire's persistent middleware): a signed-out tab gets a 401, never the action. When a\n * middleware answers instead (a redirect), that is the response.\n */\n async handle(request: HttpRequest): Promise<LiveUpdateResponse | Response> {\n if (!this.isLiveRequest(request)) throw new InvalidLiveRequestError('Live update requests need the X-Oriel-Live header.')\n const container = this.container()\n const persistent = optional(container, ConfigRepository)?.get<string[]>('live.persistent_middleware', PERSISTENT_MIDDLEWARE) ?? PERSISTENT_MIDDLEWARE\n const components: LiveUpdateResponse['components'] = []\n for (const component of this.payload(request).components) {\n // The memo is trusted only after its checksum holds.\n const { memo } = this.verify(component.snapshot)\n const middleware = persistentMiddleware(container.make(Router), persistent, memo.method, memo.path)\n const result = await pageRequest.run({ path: memo.path, method: memo.method }, () =>\n throughMiddleware(container, request, middleware, () => this.updateComponent(component.snapshot, component.updates, component.calls)),\n )\n if (result instanceof Response) return result\n components.push({ snapshot: JSON.stringify(result.snapshot), effects: result.effects })\n }\n return { components }\n }\n\n /** A full-page component (Route.get('/counter', Counter)): mounted with the route parameters, inside the layout. */\n async page(component: Component): Promise<unknown> {\n const container = this.container()\n const params = { ...(optional(container, CurrentRoute)?.parameters ?? {}) }\n const cls = component.constructor as Class<Component> & { layout?: string; title?: string }\n const result = await this.mountComponent(cls, params, component)\n const redirect = result.effects.redirect\n if (redirect !== undefined) {\n return optional(container, Redirector)?.to(redirect) ?? new Response(null, { status: 302, headers: { Location: redirect } })\n }\n const layout = cls.layout ?? optional(container, ConfigRepository)?.get<string>('live.layout') ?? 'components.layouts.app'\n const html = result.html!\n const data: Record<string, unknown> = { children: { toHtml: () => html } }\n if (cls.title !== undefined) data.title = cls.title\n return container.make(ViewFactory).make(layout, data)\n }\n\n /** Parses and checks a snapshot: a bad checksum throws before anything is hydrated. */\n private verify(snapshotJson: unknown): LiveSnapshot {\n let snapshot: unknown\n try {\n snapshot = typeof snapshotJson === 'string' ? JSON.parse(snapshotJson) : undefined\n } catch {\n throw new CorruptComponentPayloadError()\n }\n if (!isRecord(snapshot) || !isRecord(snapshot.data) || !isRecord(snapshot.memo)) throw new CorruptComponentPayloadError()\n const memo = snapshot.memo as Partial<Memo>\n const name = typeof memo.name === 'string' ? memo.name : 'unknown'\n const key = this.key()\n let valid: boolean\n try {\n valid = verifyChecksum(key, { data: snapshot.data, memo: snapshot.memo }, snapshot.checksum)\n } catch {\n // A payload the checksum can't be computed over (nested too deep to walk) was never signed by this server.\n valid = false\n }\n if (!valid) throw new CorruptComponentPayloadError(name)\n return snapshot as unknown as LiveSnapshot\n }\n\n private key(): Uint8Array {\n return this.container().make(Encrypter).getKey()\n }\n\n /** The request body, read from the raw JSON when the request has it, so TrimStrings can't alter typed values. */\n private payload(request: HttpRequest): LiveUpdateRequest {\n let body: unknown\n try {\n const content = (request as { content?: () => string }).content\n body = typeof content === 'function' ? JSON.parse(content.call(request)) : request.all()\n } catch {\n throw new InvalidLiveRequestError('The Live update request body is not valid JSON.')\n }\n const components = isRecord(body) ? body.components : undefined\n const valid =\n Array.isArray(components) &&\n components.every(\n (component) =>\n isRecord(component) &&\n typeof component.snapshot === 'string' &&\n isRecord(component.updates) &&\n Array.isArray(component.calls) &&\n component.calls.every((call) => isRecord(call) && typeof call.method === 'string' && Array.isArray(call.params)),\n )\n if (!valid) throw new InvalidLiveRequestError('The Live update request body is malformed.')\n return body as unknown as LiveUpdateRequest\n }\n\n /** Makes every computed getter (static `computed` too) cache its value for the rest of the request. */\n private prepareComputed(instance: Component): void {\n for (const name of computedOf(instance.constructor)) {\n for (let proto = Object.getPrototypeOf(instance) as object | null; proto !== null; proto = Object.getPrototypeOf(proto) as object | null) {\n const getter = Object.getOwnPropertyDescriptor(proto, name)?.get\n if (getter === undefined) continue\n Object.defineProperty(instance, name, { get: cachedGetter(name, getter as (this: object) => unknown), enumerable: false, configurable: true })\n break\n }\n }\n }\n\n private async applyUpdate(instance: Component, path: string, value: unknown): Promise<void> {\n if (!isUpdatable(instance, path)) throw new PropertyNotUpdatableError(path, stateOf(instance).name)\n const [root, ...rest] = path.split('.') as [string, ...string[]]\n const key = rest.length > 0 ? rest.join('.') : undefined\n const studly = Str.studly(root)\n await hook(instance, 'updating', path, value)\n await hook(instance, `updating${studly}`, value, key)\n const target = instance as unknown as Record<string, unknown>\n if (rest.length === 0) target[root] = value\n else {\n // Arrays are checked again while writing: an updating hook may have changed one since isUpdatable(), and no write\n // (nor a container created on the way) may leave holes.\n const assertSlot = (node: object, segment: string): void => {\n if (Array.isArray(node) && !isArraySlot(node, segment)) throw new PropertyNotUpdatableError(path, stateOf(instance).name)\n }\n let node = target[root] as Record<string, unknown>\n if (!isRecord(node) && !Array.isArray(node)) target[root] = node = {}\n for (const segment of rest.slice(0, -1)) {\n assertSlot(node, segment)\n const next = node[segment]\n node = isRecord(next) || Array.isArray(next) ? (next as Record<string, unknown>) : (node[segment] = {} as Record<string, unknown>)\n }\n const last = rest.at(-1)!\n assertSlot(node, last)\n Object.defineProperty(node, last, { value, enumerable: true, writable: true, configurable: true })\n }\n await hook(instance, 'updated', path, value)\n await hook(instance, `updated${studly}`, value, key)\n }\n\n /** Runs one call from the browser: a magic action, an event, or a public method. Returns its return value. */\n private async call(instance: Component, method: string, params: unknown[]): Promise<unknown> {\n const name = stateOf(instance).name\n switch (method) {\n case '$refresh':\n return undefined\n case '$set':\n return this.applyUpdate(instance, String(params[0]), params[1])\n case '$toggle': {\n const path = String(params[0])\n const current = path.split('.').reduce<unknown>((node, segment) => (isRecord(node) || Array.isArray(node) ? (node as Record<string, unknown>)[segment] : undefined), instance)\n return this.applyUpdate(instance, path, !current)\n }\n case '__dispatch': {\n const [event, detail] = params\n // Own keys only: an event named 'constructor' or '__proto__' must not reach Object.prototype.\n const listeners = listenersOf(instance.constructor)\n for (const listener of Object.hasOwn(listeners, String(event)) ? listeners[String(event)]! : []) {\n if (!isCallable(instance, listener)) throw new MethodNotCallableError(listener, name)\n await (instance as unknown as Record<string, (params: unknown) => unknown>)[listener]!(isRecord(detail) ? detail : {})\n }\n return undefined\n }\n }\n if (!isCallable(instance, method)) throw new MethodNotCallableError(method, name)\n return (instance as unknown as Record<string, (...args: unknown[]) => unknown>)[method]!(...params)\n }\n\n /** Renders the component (rendering/rendered hooks, nested children tracked) and checks for a single root. */\n private async render(instance: Component, memo: Memo, previous: Children): Promise<{ html: string; tag: string }> {\n await hook(instance, 'rendering')\n const context: RenderContext = { previous, children: {}, index: 0 }\n const html = await renderContext.run(context, async () => {\n const output = await instance.render()\n return typeof output === 'string' ? output : this.container().make(ViewFactory).renderToString(output)\n })\n await hook(instance, 'rendered', html)\n memo.children = context.children\n return { html: html.trim(), tag: rootTag(html, memo.name) }\n }\n\n /** Dispatches, redirects: the effects every response carries. */\n private effects(instance: Component): LiveEffects {\n const state = stateOf(instance)\n const effects: LiveEffects = {}\n if (state.dispatches.length > 0) {\n effects.dispatches = state.dispatches.map(({ name, params, self, to }) => ({\n name,\n params,\n ...(self ? { self } : {}),\n ...(to === undefined ? {} : { to: typeof to === 'string' ? to : this.nameOf(to) }),\n }))\n }\n if (state.redirect !== undefined) effects.redirect = state.redirect\n if (state.redirectUsingNavigate) effects.redirectUsingNavigate = true\n return effects\n }\n\n /** dehydrate() hook, then the state as snapshot data, the error bag, and the checksum over both. */\n private async snapshot(instance: Component, memo: Memo): Promise<LiveSnapshot> {\n await hook(instance, 'dehydrate')\n const registry = this.registry()\n const data: Record<string, unknown> = {}\n for (const [property, value] of Object.entries(instance)) data[property] = dehydrate(value, registry, `${memo.name}.${property}`)\n const signed = { data, memo: { ...memo, errors: { ...stateOf(instance).errors } } }\n return { ...signed, checksum: checksum(this.key(), signed) }\n }\n}\n","import { createHmac, timingSafeEqual } from 'node:crypto'\n\n/** JSON with object keys sorted at every level, so the browser's key order can't change the checksum. */\nexport function canonicalJson(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map((item) => canonicalJson(item === undefined ? null : item)).join(',')}]`\n if (typeof value === 'object' && value !== null) {\n const entries = Object.keys(value)\n .sort()\n .filter((key) => (value as Record<string, unknown>)[key] !== undefined)\n .map((key) => `${JSON.stringify(key)}:${canonicalJson((value as Record<string, unknown>)[key])}`)\n return `{${entries.join(',')}}`\n }\n return JSON.stringify(value)\n}\n\n/** HMAC-SHA256 (hex) of the snapshot's data and memo, keyed by APP_KEY. */\nexport function checksum(key: Uint8Array, payload: { data: unknown; memo: unknown }): string {\n return createHmac('sha256', key).update(canonicalJson({ data: payload.data, memo: payload.memo })).digest('hex')\n}\n\n/** Constant-time comparison of a snapshot's checksum with the expected one. */\nexport function verifyChecksum(key: Uint8Array, payload: { data: unknown; memo: unknown }, given: unknown): boolean {\n if (typeof given !== 'string') return false\n const expected = Buffer.from(checksum(key, payload), 'utf8')\n const actual = Buffer.from(given, 'utf8')\n return expected.length === actual.length && timingSafeEqual(expected, actual)\n}\n","import { existsSync, readdirSync } from 'node:fs'\nimport { join, relative, sep } from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { Str } from '@orieljs/support'\n\n/** A component's Livewire name from its path under app/Live: Posts/CreatePost.tsx → posts.create-post. */\nexport function componentName(file: string): string {\n return file\n .replace(/\\.(tsx|ts|jsx|js|mts|mjs)$/, '')\n .split(/[\\\\/]/)\n .map((segment) => Str.kebab(segment))\n .join('.')\n}\n\n/** A class's default name when it is mounted without being registered: CreatePost → create-post. */\nexport function defaultName(cls: object): string | undefined {\n const name = (cls as { name?: unknown }).name\n return typeof name === 'string' && name !== '' ? Str.kebab(name) : undefined\n}\n\n/** Component files under `directory` (recursive), relative paths with `/`. Test and declaration files are skipped. */\nexport function componentFiles(directory: string): string[] {\n if (!existsSync(directory)) return []\n return readdirSync(directory, { recursive: true, encoding: 'utf8' })\n .filter((file) => /\\.(tsx|ts|jsx|js|mts|mjs)$/.test(file) && !/\\.(test|spec|d)\\.[^.]+$/.test(file))\n .map((file) => file.split(sep).join('/'))\n .sort()\n}\n\n/** Imports every component file under `directory` and returns [name, default export] pairs. */\nexport async function discover(directory: string): Promise<Array<[name: string, exported: unknown]>> {\n const found: Array<[string, unknown]> = []\n for (const file of componentFiles(directory)) {\n const module = (await import(/* @vite-ignore */ pathToFileURL(join(directory, file)).href)) as { default?: unknown }\n found.push([componentName(relative(directory, join(directory, file))), module.default])\n }\n return found\n}\n","import type { Container, HttpRequest, Middleware, MiddlewareClass, MiddlewareReference, Next, Route, Router } from '@orieljs/contracts'\nimport { LiveError } from './errors'\n\n/** The route middleware an update re-applies by default (config live.persistent_middleware), by alias. */\nexport const PERSISTENT_MIDDLEWARE = ['auth', 'verified', 'guest']\n\n/** A route middleware after alias and group expansion: 'auth:web' → { cls: Authenticate, parameters: ['web'] }. */\nexport interface PersistentMiddleware {\n readonly cls: MiddlewareClass\n readonly parameters: readonly string[]\n}\n\n/**\n * What persistent middleware reads from Oriel's router beyond the Router contract: the public matching and middleware\n * methods of @orieljs/routing's BaseRouter and RouteDefinition.\n */\ninterface MatchingRoute extends Route {\n readonly isFallback?: boolean\n match(path: string, patterns: Readonly<Record<string, string>>, version: number): Record<string, string | undefined> | undefined\n gatherMiddleware(): MiddlewareReference[]\n excludedMiddleware(): MiddlewareReference[]\n}\n\ninterface MatchingRouter extends Router {\n getRoutesByMatchOrder(): readonly MatchingRoute[]\n getPatterns(): Readonly<Record<string, string>>\n getPatternVersion(): number\n getMiddleware(): Readonly<Record<string, MiddlewareClass>>\n getMiddlewareGroups(): Record<string, MiddlewareReference[]>\n}\n\nfunction canMatch(router: Router): router is MatchingRouter {\n const methods = router as unknown as Record<string, unknown>\n return ['getRoutesByMatchOrder', 'getPatterns', 'getPatternVersion', 'getMiddleware', 'getMiddlewareGroups'].every((name) => typeof methods[name] === 'function')\n}\n\nfunction isMatchingRoute(route: unknown): route is MatchingRoute {\n const candidate = route as Record<string, unknown> | null\n return (\n typeof candidate === 'object' &&\n candidate !== null &&\n Array.isArray(candidate.methods) &&\n ['match', 'gatherMiddleware', 'excludedMiddleware'].every((name) => typeof candidate[name] === 'function')\n )\n}\n\n/** request.path() ('posts/1', '/') in the form routes match against ('/posts/1', ''). */\nfunction routePath(path: string): string {\n const trimmed = path.replace(/^\\/+|\\/+$/g, '').replace(/\\/{2,}/g, '/')\n return trimmed === '' ? '' : `/${trimmed}`\n}\n\n/** Expands aliases and groups like the router does; unknown names are skipped (the page request would have failed). */\nfunction expand(\n references: readonly MiddlewareReference[],\n aliases: Readonly<Record<string, MiddlewareClass>>,\n groups: Readonly<Record<string, readonly MiddlewareReference[]>>,\n out: PersistentMiddleware[] = [],\n visiting = new Set<string>(),\n): PersistentMiddleware[] {\n for (const reference of references) {\n if (typeof reference === 'function') {\n out.push({ cls: reference, parameters: [] })\n continue\n }\n const index = reference.indexOf(':')\n const name = index === -1 ? reference : reference.slice(0, index)\n if (index === -1 && Object.hasOwn(groups, name)) {\n if (visiting.has(name)) continue\n visiting.add(name)\n expand(groups[name]!, aliases, groups, out, visiting)\n visiting.delete(name)\n } else if (Object.hasOwn(aliases, name)) {\n out.push({ cls: aliases[name]!, parameters: index === -1 ? [] : reference.slice(index + 1).split(',') })\n }\n }\n return out\n}\n\n/**\n * Livewire's persistent middleware: the route that rendered the page (the component's memo path and method) is\n * matched again, and the middleware among `persistent` (aliases) that it ran are returned, to run before an update.\n * A path no route matches has none.\n */\nexport function persistentMiddleware(router: Router, persistent: readonly string[], method: string, path: string): PersistentMiddleware[] {\n if (!canMatch(router)) throw new LiveError(\"Live re-applies the page route's middleware to updates, which needs Oriel's router.\")\n const routes = router.getRoutesByMatchOrder()\n if (!Array.isArray(routes) || !routes.every(isMatchingRoute)) throw new LiveError(\"Live re-applies the page route's middleware to updates, which needs Oriel's routes.\")\n const verb = method.toUpperCase()\n const target = routePath(path)\n const patterns = router.getPatterns()\n const version = router.getPatternVersion()\n const route = routes.find((candidate) => candidate.methods.includes(verb) && candidate.match(target, patterns, version) !== undefined)\n if (route === undefined) return []\n const aliases = router.getMiddleware()\n const groups = router.getMiddlewareGroups()\n const wanted = new Set(persistent.flatMap((name) => (Object.hasOwn(aliases, name) ? [aliases[name]!] : [])))\n const excluded = new Set(expand(route.excludedMiddleware(), aliases, groups).map((entry) => entry.cls))\n const ids = new Map<MiddlewareClass, number>()\n const seen = new Set<string>()\n return expand(route.gatherMiddleware(), aliases, groups).filter((entry) => {\n if (!ids.has(entry.cls)) ids.set(entry.cls, ids.size)\n const key = `${ids.get(entry.cls)}:${entry.parameters.join(',')}`\n if (!wanted.has(entry.cls) || excluded.has(entry.cls) || seen.has(key)) return false\n seen.add(key)\n return true\n })\n}\n\n/**\n * Runs `destination` behind the middleware, built from `container` (the request scope). A middleware may answer\n * instead (a redirect) or throw (AuthenticationError): then the update never runs. Like Livewire's pipeline, the\n * `next` the middleware sees resolves to an empty Response; the update's own result is kept aside.\n */\nexport async function throughMiddleware<T>(container: Container, request: HttpRequest, middleware: readonly PersistentMiddleware[], destination: () => Promise<T>): Promise<T | Response> {\n let ran: { result: T } | undefined\n const run = async (index: number): Promise<Response> => {\n if (index === middleware.length) {\n ran = { result: await destination() }\n return new Response(null, { status: 204 })\n }\n const { cls, parameters } = middleware[index]!\n const instance: Middleware = container.make(cls)\n const next: Next = () => run(index + 1)\n return instance.handle(request, next, ...parameters)\n }\n const response = await run(0)\n return ran ? ran.result : response\n}\n","import { Collection } from '@orieljs/collections'\nimport { Component } from './Component'\nimport { computedOf, lockedOf } from './metadata'\nimport { isModel } from './synthesizers'\n\n/** Lifecycle hooks and the render method: never actions (Livewire's protected method list). */\nconst HOOKS = new Set(['constructor', 'render', 'mount', 'boot', 'booted', 'hydrate', 'dehydrate', 'updating', 'updated', 'rendering', 'rendered', 'exception'])\nconst HOOK_PREFIX = /^(updating|updated|hydrate|dehydrate)[A-Z_]/\n/** Path segments that could reach a prototype. */\nconst UNSAFE_SEGMENTS = new Set(['__proto__', 'prototype', 'constructor'])\n\n/** Component's own API (dispatch, validate, reset, __invoke, …): computed once from its prototype. */\nconst BASE_API = new Set(Object.getOwnPropertyNames(Component.prototype))\n/** A canonical array index: '0', '12'; not '01', '-1', '1.5' or 'length'. */\nconst INDEX = /^(?:0|[1-9]\\d*)$/\n\n/**\n * Whether the browser may address `segment` of `array`: an existing item or the next one (an append). Anything else\n * would add a named property to the array or leave holes in it (a huge index makes it billions of items long).\n */\nexport function isArraySlot(array: readonly unknown[], segment: string): boolean {\n return INDEX.test(segment) && Number(segment) <= array.length\n}\n\n/**\n * Whether the browser may call `method`: a public method declared on the user's classes below Component, not a hook,\n * not `_private`, not `$magic` (those are handled separately), not a getter and not @Locked.\n */\nexport function isCallable(instance: Component, method: string): boolean {\n if (method === '' || method.startsWith('_') || method.startsWith('$') || method.startsWith('#')) return false\n if (HOOKS.has(method) || HOOK_PREFIX.test(method) || BASE_API.has(method)) return false\n if (lockedOf(instance.constructor).has(method)) return false\n // Stops at Component.prototype, or at Object.prototype for a component built on another copy of Component.\n const isBase = (proto: object) => proto === Component.prototype || proto === Object.prototype\n for (let proto = Object.getPrototypeOf(instance) as object | null; proto !== null && !isBase(proto); proto = Object.getPrototypeOf(proto) as object | null) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, method)\n if (descriptor !== undefined) return typeof descriptor.value === 'function'\n }\n return false\n}\n\n/**\n * Whether the browser may set `path` ('title', 'items.0.name'): the root must be an existing public field that is not\n * `_private`, @Locked or computed; models and collections can't be changed, wherever they sit in the path (nor their\n * attributes); an array is only reached by the index of an existing item or the next one; no prototype keys.\n */\nexport function isUpdatable(instance: Component, path: string): boolean {\n const segments = path.split('.')\n const root = segments[0]!\n if (root === '' || root.startsWith('_') || segments.some((segment) => segment === '' || UNSAFE_SEGMENTS.has(segment))) return false\n if (!Object.hasOwn(instance, root)) return false\n const descriptor = Object.getOwnPropertyDescriptor(instance, root)!\n if (!descriptor.enumerable || descriptor.get !== undefined) return false\n const cls = instance.constructor\n if (lockedOf(cls).has(root) || computedOf(cls).has(root)) return false\n // Walk the existing value along the path: a model or collection anywhere on the way (the root, an array item, an\n // object member, the final value) is read-only, so its attributes can't be set through a dotted path either.\n let node = descriptor.value as unknown\n for (const segment of segments.slice(1)) {\n if (isModel(node) || node instanceof Collection) return false\n if (Array.isArray(node) && !isArraySlot(node, segment)) return false\n if (typeof node !== 'object' || node === null || !Object.hasOwn(node, segment)) return true\n node = (node as Record<string, unknown>)[segment]\n }\n return !isModel(node) && !(node instanceof Collection)\n}\n","import type { Class, ClassRegistry, ModelInstance, ModelStatic } from '@orieljs/contracts'\nimport { Collection } from '@orieljs/collections'\nimport { LiveError } from './errors'\n\n/** A JSON value as it travels in a snapshot. Non-scalars are Livewire-style tuples: [value, { s: '<synth>', … }]. */\nexport type Dehydrated = null | boolean | number | string | [unknown, SynthMeta]\nexport interface SynthMeta {\n s: 'u' | 'arr' | 'obj' | 'dt' | 'mdl' | 'elcln' | 'clctn'\n class?: string\n key?: unknown\n keys?: unknown[]\n}\n\n/** The same structural model check as Queue's serialization: what the ModelInstance contract guarantees. */\nexport function isModel(value: unknown): value is ModelInstance {\n if (typeof value !== 'object' || value === null) return false\n const candidate = value as Record<string, unknown>\n return (\n typeof candidate.getKey === 'function' &&\n typeof candidate.getKeyName === 'function' &&\n typeof candidate.getTable === 'function' &&\n typeof candidate.exists === 'boolean'\n )\n}\n\nconst isPlainObject = (value: object): boolean => {\n const proto: unknown = Object.getPrototypeOf(value)\n return proto === Object.prototype || proto === null\n}\n\nconst isTuple = (value: unknown): value is [unknown, SynthMeta] =>\n Array.isArray(value) &&\n value.length === 2 &&\n typeof value[1] === 'object' &&\n value[1] !== null &&\n !Array.isArray(value[1]) &&\n typeof (value[1] as Partial<SynthMeta>).s === 'string'\n\n/** The registry name of a model class, registering it under its class name the first time (as Queue does). */\nfunction classNameOf(registry: ClassRegistry, cls: Class<unknown>): string {\n return registry.nameOf(cls) ?? registry.register(cls)\n}\n\n/**\n * Encodes one public property value for the snapshot. Only primitives, arrays, plain objects, Dates, saved models and\n * collections are allowed (spec §5.2): anything else throws a LiveError naming the property.\n */\nexport function dehydrate(value: unknown, registry: ClassRegistry, path: string, seen: Set<object> = new Set()): Dehydrated {\n switch (typeof value) {\n case 'undefined':\n return [null, { s: 'u' }]\n case 'string':\n case 'boolean':\n return value\n case 'number':\n if (!Number.isFinite(value)) throw new LiveError(`Property [${path}] is ${value}: Live state must be JSON (finite numbers only).`)\n return value\n case 'bigint':\n case 'symbol':\n case 'function':\n throw new LiveError(`Property [${path}] holds a ${typeof value}: Live state may only hold primitives, arrays, plain objects, Dates, models and collections.`)\n }\n if (value === null) return null\n const object = value as object\n if (seen.has(object)) throw new LiveError(`Property [${path}] contains a circular reference.`)\n seen.add(object)\n try {\n if (object instanceof Date) return [object.toISOString(), { s: 'dt' }]\n if (Array.isArray(object)) return [object.map((item, i) => dehydrate(item, registry, `${path}.${i}`, seen)), { s: 'arr' }]\n if (isModel(object)) {\n const name = classNameOf(registry, object.constructor as Class<unknown>)\n if (!object.exists) throw new LiveError(`Property [${path}] holds an unsaved [${name}] model: only saved models can be kept between requests.`)\n return [null, { s: 'mdl', class: name, key: object.getKey() }]\n }\n if (object instanceof Collection) {\n const items = object.all() as unknown[]\n const first = items[0]\n if (items.length > 0 && isModel(first) && items.every((item) => isModel(item) && item.constructor === first.constructor)) {\n for (const [i, item] of items.entries()) {\n if (!(item as ModelInstance).exists) throw new LiveError(`Property [${path}.${i}] holds an unsaved model.`)\n }\n const name = classNameOf(registry, first.constructor as Class<unknown>)\n return [null, { s: 'elcln', class: name, keys: items.map((item) => (item as ModelInstance).getKey()) }]\n }\n return [items.map((item, i) => dehydrate(item, registry, `${path}.${i}`, seen)), { s: 'clctn' }]\n }\n if (isPlainObject(object)) {\n const out: Record<string, Dehydrated> = {}\n for (const [key, item] of Object.entries(object)) out[key] = dehydrate(item, registry, `${path}.${key}`, seen)\n return [out, { s: 'obj' }]\n }\n const type = (object.constructor as { name?: string } | undefined)?.name || 'object'\n throw new LiveError(\n `Property [${path}] holds a [${type}] instance: Live state may only hold primitives, arrays, plain objects, Dates, models and collections.`,\n )\n } finally {\n seen.delete(object)\n }\n}\n\nfunction modelClass(registry: ClassRegistry, name: unknown): ModelStatic {\n if (typeof name !== 'string' || !registry.has(name)) throw new LiveError(`Unable to hydrate the [${String(name)}] model: it is not registered.`)\n return registry.resolve(name) as unknown as ModelStatic\n}\n\n/** Decodes one snapshot value. Models are re-fetched (a missing row throws the database's ModelNotFound error). */\nexport async function hydrate(value: unknown, registry: ClassRegistry): Promise<unknown> {\n if (!isTuple(value)) return value\n const [inner, meta] = value\n switch (meta.s) {\n case 'u':\n return undefined\n case 'dt':\n return new Date(String(inner))\n case 'arr':\n return Promise.all((inner as unknown[]).map((item) => hydrate(item, registry)))\n case 'clctn':\n return new Collection(await Promise.all((inner as unknown[]).map((item) => hydrate(item, registry))))\n case 'obj': {\n const out: Record<string, unknown> = {}\n for (const [key, item] of Object.entries(inner as Record<string, unknown>)) {\n // JSON.parse makes `__proto__` an own key: define it as data so it can't swap the prototype.\n Object.defineProperty(out, key, { value: await hydrate(item, registry), enumerable: true, writable: true, configurable: true })\n }\n return out\n }\n case 'mdl':\n return modelClass(registry, meta.class).findOrFail(meta.key)\n case 'elcln': {\n const cls = modelClass(registry, meta.class)\n const keys = meta.keys ?? []\n const keyName = new cls().getKeyName()\n const found = [...((await cls.query().whereIn(keyName, keys).get()) as Iterable<ModelInstance>)]\n const byKey = new Map(found.map((model) => [String(model.getKey()), model]))\n return new Collection(keys.map((key) => byKey.get(String(key))).filter((model) => model !== undefined))\n }\n }\n throw new LiveError(`Unknown snapshot value type [${String(meta.s)}].`)\n}\n","import { ConfigRepository, ConsoleKernel, HttpRequest, LiveManager, Router } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { ServiceProvider } from '@orieljs/support'\nimport { registerLiveCommands } from './commands'\nimport { isComponentClass } from './Component'\nimport { LiveComponentManager } from './LiveComponentManager'\nimport { discover } from './naming'\nimport { PERSISTENT_MIDDLEWARE } from './persistent'\n\n/** The URI the client runtime posts updates to. */\nexport const UPDATE_URI = '/oriel/live/update'\n\n/**\n * Binds the LiveManager, merges the `live` config, registers POST /oriel/live/update (named `live.update`, in the `web`\n * group: sessions and CSRF apply), the make:live command, and the components under app/Live.\n */\nexport class LiveServiceProvider extends ServiceProvider {\n override register(): void {\n // persistent_middleware: the page route's middleware (aliases) every update re-applies, Livewire's persistent middleware.\n this.mergeConfigFrom({ class_path: this.app.appPath('Live'), layout: 'components.layouts.app', persistent_middleware: [...PERSISTENT_MIDDLEWARE] }, 'live')\n this.app.singleton(LiveComponentManager, () => new LiveComponentManager(this.app))\n this.app.singleton(LiveManager, (container) => container.make(LiveComponentManager))\n }\n\n override async boot(): Promise<void> {\n const manager = this.app.make(LiveComponentManager)\n if (this.app.bound(Router)) {\n this.app\n .make(Router)\n .post(UPDATE_URI, () => manager.handle(inject(HttpRequest)))\n .middleware('web')\n .name('live.update')\n }\n if (this.app.bound(ConsoleKernel)) registerLiveCommands(this.app.make(ConsoleKernel), this.app)\n const directory = this.app.make(ConfigRepository).get<string>('live.class_path', this.app.appPath('Live'))\n for (const [name, exported] of await this.app.run(() => discover(directory))) {\n if (isComponentClass(exported)) manager.register(exported, name)\n }\n }\n}\n","import { existsSync } from 'node:fs'\nimport { mkdir, writeFile } from 'node:fs/promises'\nimport { dirname, join, relative, sep } from 'node:path'\nimport { ConfigRepository, type Application, type CommandContext, type ConsoleKernel } from '@orieljs/contracts'\nimport { Str } from '@orieljs/support'\n\n/** app/Live/<Path>.tsx, written by make:live. */\nexport const COMPONENT_STUB = `import { Component } from '@orieljs/framework'\n\nexport default class {{ class }} extends Component {\n render() {\n return <div></div>\n }\n}\n`\n\n/** tests/Feature/Live/<Path>.test.ts, written by make:live --test. */\nexport const TEST_STUB = `import { Live } from '@orieljs/framework'\nimport { expect, test } from 'vitest'\nimport {{ class }} from '{{ component }}'\nimport { TestCase } from '{{ testCase }}'\n\nTestCase.boot()\n\ntest('{{ name }} renders', async () => {\n const component = await Live.test({{ class }})\n expect(component.html()).toContain('<div')\n})\n`\n\nconst CLASS_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/\n\n/** An import specifier from `from` (a file) to `to` (a file, extension dropped), always relative (./ or ../). */\nfunction importPath(from: string, to: string): string {\n const path = relative(dirname(from), to).split(sep).join('/').replace(/\\.tsx?$/, '')\n return path.startsWith('.') ? path : `./${path}`\n}\n\n/** make:live Posts/CreatePost [--test] [--force] (Livewire's make:livewire). */\nexport function registerLiveCommands(kernel: ConsoleKernel, app: Application): void {\n kernel\n .command('make:live {name : The component name, e.g. Posts/CreatePost} {--test : Also create a test} {--force : Overwrite existing files}', async function (this: CommandContext) {\n const segments = String(this.argument('name') ?? '')\n .split(/[/\\\\.]+/)\n .filter((segment) => segment !== '')\n .map((segment) => Str.studly(segment))\n if (segments.length === 0 || !segments.every((segment) => CLASS_NAME.test(segment))) {\n this.error(`Component name [${String(this.argument('name'))}] is not valid: use names like Posts/CreatePost.`)\n return 1\n }\n const className = segments.at(-1)!\n const config = app.bound(ConfigRepository) ? app.make(ConfigRepository) : undefined\n const directory = config?.get<string>('live.class_path') ?? app.appPath('Live')\n const file = join(directory, ...segments.slice(0, -1), `${className}.tsx`)\n const force = this.option('force') === true\n if (existsSync(file) && !force) {\n this.error(`Component [${relative(app.basePath(), file)}] already exists.`)\n return 1\n }\n await mkdir(dirname(file), { recursive: true })\n await writeFile(file, COMPONENT_STUB.replace('{{ class }}', () => className))\n this.info(`Component [${relative(app.basePath(), file)}] created successfully.`)\n\n if (this.option('test') === true) {\n const testFile = app.basePath(join('tests', 'Feature', 'Live', ...segments.slice(0, -1), `${className}.test.ts`))\n if (existsSync(testFile) && !force) {\n this.error(`Test [${relative(app.basePath(), testFile)}] already exists.`)\n return 1\n }\n const name = segments.map((segment) => Str.kebab(segment)).join('.')\n const test = TEST_STUB.replaceAll('{{ class }}', () => className)\n .replace('{{ component }}', () => importPath(testFile, file))\n .replace('{{ testCase }}', () => importPath(testFile, app.basePath(join('tests', 'TestCase.ts'))))\n .replace('{{ name }}', () => name)\n await mkdir(dirname(testFile), { recursive: true })\n await writeFile(testFile, test)\n this.info(`Test [${relative(app.basePath(), testFile)}] created successfully.`)\n }\n return 0\n })\n .purpose('Create a new Live component')\n}\n"],"mappings":";AAAA,SAAS,aAAa,cAAc,yBAAkE;AACtG,SAAS,cAAc;;;ACMrB,OAAiC,aAAa,uBAAO,IAAI,iBAAiB;AAE5E,IAAM,YAAY,uBAAO,IAAI,sBAAsB;AACnD,IAAM,SAAS,uBAAO,IAAI,mBAAmB;AAC7C,IAAM,WAAW,uBAAO,IAAI,qBAAqB;AAQjD,SAAS,IAAO,UAAoB,KAAa,OAAgB,MAA8B;AAC7F,MAAI,CAAC,OAAO,OAAO,UAAU,GAAG,EAAG,UAAS,GAAG,IAAI,SAAS,GAAG,MAAM,SAAY,MAAM,IAAI,KAAK,SAAS,GAAG,CAAM;AAClH,SAAO,SAAS,GAAG;AACrB;AAGO,SAAS,GAAG,OAAe;AAChC,SAAO,SAAU,SAAkB,SAA4C;AAC7E,UAAM,YAAY;AAAA,MAA8B,QAAQ;AAAA,MAAsB;AAAA,MAAW,OAAO,CAAC;AAAA,MAAI,CAAC,cACpG,OAAO,YAAY,OAAO,QAAQ,SAAS,EAAE,IAAI,CAAC,CAAC,MAAMA,QAAO,MAAM,CAAC,MAAM,CAAC,GAAGA,QAAO,CAAC,CAAC,CAAC;AAAA,IAC7F;AAEA,UAAM,UAAW,UAAU,KAAK,MAAM,CAAC;AACvC,QAAI,CAAC,QAAQ,SAAS,OAAO,QAAQ,IAAI,CAAC,EAAG,SAAQ,KAAK,OAAO,QAAQ,IAAI,CAAC;AAAA,EAChF;AACF;AAGO,SAAS,OAAO,SAAkB,SAAyE;AAChH,MAAc,QAAQ,UAAsB,QAAQ,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AACA,WAAO;AAAA,EACT,CAAC,EACA,QAAQ,6BAA6B;AAC1C;;;ADvEO,IAAM,aAAa;AAMnB,IAAM,sBAAN,cAAkC,gBAAgB;AAAA,EAC9C,WAAiB;AAExB,SAAK,gBAAgB,EAAE,YAAY,KAAK,IAAI,QAAQ,MAAM,GAAG,QAAQ,0BAA0B,uBAAuB,CAAC,GAAG,qBAAqB,EAAE,GAAG,MAAM;AAC1J,SAAK,IAAI,UAAU,sBAAsB,MAAM,IAAI,qBAAqB,KAAK,GAAG,CAAC;AACjF,SAAK,IAAI,UAAUI,cAAa,CAAC,cAAc,UAAU,KAAK,oBAAoB,CAAC;AAAA,EACrF;AAAA,EAEA,MAAe,OAAsB;AACnC,UAAM,UAAU,KAAK,IAAI,KAAK,oBAAoB;AAClD,QAAI,KAAK,IAAI,MAAMC,OAAM,GAAG;AAC1B,WAAK,IACF,KAAKA,OAAM,EACX,KAAK,YAAY,MAAM,QAAQ,OAAOC,QAAOC,YAAW,CAAC,CAAC,EAC1D,WAAW,KAAK,EAChB,KAAK,aAAa;AAAA,IACvB;AACA,QAAI,KAAK,IAAI,MAAM,aAAa,EAAG,sBAAqB,KAAK,IAAI,KAAK,aAAa,GAAG,KAAK,GAAG;AAC9F,UAAM,YAAY,KAAK,IAAI,KAAKC,iBAAgB,EAAE,IAAY,mBAAmB,KAAK,IAAI,QAAQ,MAAM,CAAC;AACzG,eAAW,CAAC,MAAM,QAAQ,KAAK,MAAM,KAAK,IAAI,IAAI,MAAM,SAAS,SAAS,CAAC,GAAG;AAC5E,UAAI,iBAAiB,QAAQ,EAAG,SAAQ,SAAS,UAAU,IAAI;AAAA,IACjE;AAAA,EACF;AACF;","names":["methods","LiveManager","inject","LiveManager","inject","fail","token","inject","LiveManager","inject","LiveManager","currentContainer","Str","Collection","Collection","token","currentContainer","Str","node","ConfigRepository","HttpRequest","LiveManager","Router","inject","existsSync","join","relative","sep","ConfigRepository","Str","LiveManager","Router","inject","HttpRequest","ConfigRepository"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orieljs/live",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.4",
|
|
4
4
|
"description": "Livewire-style server components for Oriel: TSX rendering, signed snapshots, actions, events and Live.test().",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"NOTICE"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@orieljs/contracts": "0.1.0-alpha.
|
|
34
|
-
"@orieljs/container": "0.1.0-alpha.
|
|
35
|
-
"@orieljs/
|
|
36
|
-
"@orieljs/
|
|
33
|
+
"@orieljs/contracts": "0.1.0-alpha.4",
|
|
34
|
+
"@orieljs/container": "0.1.0-alpha.4",
|
|
35
|
+
"@orieljs/collections": "0.1.0-alpha.4",
|
|
36
|
+
"@orieljs/support": "0.1.0-alpha.4"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsup && node ../../../scripts/copy-license.mjs"
|