@orieljs/inertia 0.1.0-alpha.10

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../headers.ts","../props/Prop.ts","../props/props.ts","../PropsResolver.ts","../context.ts","../errors.ts","../Response.ts","../ResponseFactory.ts","../helpers.ts","../html.ts","../Middleware.ts","../ssr/requests.ts","../EncryptHistory.ts","../HandlePrecognitiveRequests.ts","../InertiaServiceProvider.ts","../commands.ts","../routes.ts","../ssr/HttpGateway.ts"],"sourcesContent":["/** The Inertia protocol headers (inertia-laravel's Support\\Header). */\nexport const Header = {\n INERTIA: 'X-Inertia',\n ERROR_BAG: 'X-Inertia-Error-Bag',\n LOCATION: 'X-Inertia-Location',\n REDIRECT: 'X-Inertia-Redirect',\n VERSION: 'X-Inertia-Version',\n PARTIAL_COMPONENT: 'X-Inertia-Partial-Component',\n PARTIAL_ONLY: 'X-Inertia-Partial-Data',\n PARTIAL_EXCEPT: 'X-Inertia-Partial-Except',\n RESET: 'X-Inertia-Reset',\n INFINITE_SCROLL_MERGE_INTENT: 'X-Inertia-Infinite-Scroll-Merge-Intent',\n EXCEPT_ONCE_PROPS: 'X-Inertia-Except-Once-Props',\n} as const\n\n/** 'a,b,,c' → ['a', 'b', 'c']; empty or missing → undefined (\"not given\"), like PropsResolver::parseHeader. */\nexport function parseList(value: string | undefined): string[] | undefined {\n const items = (value ?? '').split(',').filter((item) => item !== '')\n return items.length === 0 ? undefined : items\n}\n","import type { PropCallback } from '@orieljs/contracts'\n\n/** A value or a (possibly async) callback that produces it. */\nexport type PropValue<T> = T | PropCallback<T>\n\n/** Where a mergeable prop is merged on the client (Laravel's MergesProps). */\ninterface MergeState {\n merge: boolean\n deep: boolean\n append: boolean\n appendPaths: string[]\n prependPaths: string[]\n matchOn: string[]\n}\n\n/** Once-prop settings (Laravel's ResolvesOnce). */\ninterface OnceState {\n once: boolean\n fresh: boolean\n key: string | undefined\n ttlSeconds: number | undefined\n}\n\n/**\n * The base of every Inertia prop type. `resolve()` produces the value; the flags say how the PropsResolver treats\n * it. Subclasses switch the behaviours on, which is how Laravel's traits and marker interfaces work.\n */\nexport abstract class Prop<T = unknown> {\n /** A phantom field that carries the value type for the generated page props. Never set at runtime. */\n declare readonly __value?: T\n /** Which prop type this is: the generated page props make deferred and optional props optional keys. */\n abstract readonly kind: 'always' | 'optional' | 'defer' | 'merge' | 'once' | 'scroll'\n\n protected readonly mergeState: MergeState = { merge: false, deep: false, append: true, appendPaths: [], prependPaths: [], matchOn: [] }\n protected readonly onceState: OnceState = { once: false, fresh: false, key: undefined, ttlSeconds: undefined }\n protected deferred = false\n protected deferGroup: string | undefined\n\n constructor(protected readonly value: PropValue<T>) {}\n\n /** Calls the callback, if the value is one. */\n async resolve(): Promise<unknown> {\n return typeof this.value === 'function' ? await (this.value as PropCallback<T>)() : this.value\n }\n\n /** Never sent on the first load (OptionalProp, DeferProp). */\n ignoresFirstLoad(): boolean {\n return false\n }\n\n /** Sent even when a partial reload didn't ask for it (AlwaysProp). */\n isAlways(): boolean {\n return false\n }\n\n /** Errors are reported and the prop is left out, instead of failing the page (defer(..., { rescue: true })). */\n shouldRescue(): boolean {\n return false\n }\n\n // Once (honoured by OptionalProp, DeferProp, MergeProp and OnceProp) ------------------------------------\n\n /** once(), once(false), once(true, { as: 'key', until: 3600 }). */\n once(value = true, options: { as?: string; until?: Date | number } = {}): this {\n this.onceState.once = value\n if (options.as !== undefined) this.onceState.key = options.as\n if (options.until !== undefined) this.onceState.ttlSeconds = secondsUntil(options.until)\n return this\n }\n\n /** A custom once key, so pages can share the prop under different names. */\n as(key: string): this {\n this.onceState.key = key\n return this\n }\n\n /** Send the prop again even though the client already has it. */\n fresh(value = true): this {\n this.onceState.fresh = value\n return this\n }\n\n /** Expire after a number of seconds, or at a Date. */\n until(delay: Date | number): this {\n this.onceState.ttlSeconds = secondsUntil(delay)\n return this\n }\n\n // Merging -------------------------------------------------------------------------------------------------\n\n isMergeable(): boolean {\n return false\n }\n\n shouldMerge(): boolean {\n return this.isMergeable() && this.mergeState.merge\n }\n\n shouldDeepMerge(): boolean {\n return this.mergeState.deep\n }\n\n matchesOn(): string[] {\n return [...this.mergeState.matchOn]\n }\n\n appendsAtRoot(): boolean {\n return this.mergeState.append && this.mergesAtRoot()\n }\n\n prependsAtRoot(): boolean {\n return !this.mergeState.append && this.mergesAtRoot()\n }\n\n appendsAtPaths(): string[] {\n return [...this.mergeState.appendPaths]\n }\n\n prependsAtPaths(): string[] {\n return [...this.mergeState.prependPaths]\n }\n\n protected mergesAtRoot(): boolean {\n return this.mergeState.appendPaths.length === 0 && this.mergeState.prependPaths.length === 0\n }\n\n // Deferring -----------------------------------------------------------------------------------------------\n\n isDeferrable(): boolean {\n return false\n }\n\n shouldDefer(): boolean {\n return this.isDeferrable() && this.deferred\n }\n\n group(): string {\n return this.deferGroup ?? 'default'\n }\n\n // Once ----------------------------------------------------------------------------------------------------\n\n isOnceable(): boolean {\n return false\n }\n\n shouldResolveOnce(): boolean {\n return this.isOnceable() && this.onceState.once\n }\n\n shouldBeRefreshed(): boolean {\n return this.onceState.fresh\n }\n\n getKey(): string | undefined {\n return this.onceState.key\n }\n\n /** Epoch milliseconds, or null when the prop never expires. */\n expiresAt(): number | null {\n return this.onceState.ttlSeconds === undefined ? null : (Math.floor(Date.now() / 1000) + this.onceState.ttlSeconds) * 1000\n }\n}\n\n/** The fluent merge API shared by MergeProp, DeferProp and ScrollProp. */\nexport abstract class MergeableProp<T = unknown> extends Prop<T> {\n override isMergeable(): boolean {\n return true\n }\n\n merge(): this {\n this.mergeState.merge = true\n return this\n }\n\n deepMerge(): this {\n this.mergeState.deep = true\n return this.merge()\n }\n\n /** Match array items on these keys instead of appending duplicates: matchOn('id'). */\n matchOn(keys: string | string[]): this {\n this.mergeState.matchOn = [keys].flat()\n return this\n }\n\n /** append() at the root, append('data') at a path, append('data', 'id') with a match key, or a map of both. */\n append(path: boolean | string | string[] | Record<string, string> = true, matchOn?: string): this {\n return this.#place('append', path, matchOn)\n }\n\n prepend(path: boolean | string | string[] | Record<string, string> = true, matchOn?: string): this {\n return this.#place('prepend', path, matchOn)\n }\n\n #place(side: 'append' | 'prepend', path: boolean | string | string[] | Record<string, string>, matchOn?: string): this {\n if (typeof path === 'boolean') {\n this.mergeState.append = side === 'append' ? path : !path\n return this\n }\n if (Array.isArray(path)) {\n for (const entry of path) this.#place(side, entry)\n return this\n }\n if (typeof path === 'object') {\n for (const [entry, key] of Object.entries(path)) this.#place(side, entry, key)\n return this\n }\n ;(side === 'append' ? this.mergeState.appendPaths : this.mergeState.prependPaths).push(path)\n if (matchOn !== undefined && matchOn !== '') this.mergeState.matchOn = [...this.mergeState.matchOn, `${path}.${matchOn}`]\n return this\n }\n}\n\n/** Seconds from now until `delay` (a Date, or a number of seconds). */\nexport function secondsUntil(delay: Date | number): number {\n return delay instanceof Date ? Math.max(0, Math.round((delay.getTime() - Date.now()) / 1000)) : delay\n}\n","import type { PropCallback } from '@orieljs/contracts'\nimport { MergeableProp, Prop, type PropValue } from './Prop'\n\n/** Sent on every response, even partial reloads that didn't ask for it (Inertia::always). */\nexport class AlwaysProp<T = unknown> extends Prop<T> {\n readonly kind = 'always' as const\n override isAlways(): boolean {\n return true\n }\n}\n\n/** Only evaluated on partial reloads that ask for it (Inertia::optional). */\nexport class OptionalProp<T = unknown> extends Prop<T> {\n readonly kind = 'optional' as const\n constructor(callback: PropCallback<T>) {\n super(callback)\n }\n\n override ignoresFirstLoad(): boolean {\n return true\n }\n\n override isOnceable(): boolean {\n return true\n }\n}\n\n/** Loaded by the client in a follow-up request, grouped (Inertia::defer). */\nexport class DeferProp<T = unknown> extends MergeableProp<T> {\n readonly kind = 'defer' as const\n readonly #rescue: boolean\n\n constructor(callback: PropCallback<T>, group?: string, options: { rescue?: boolean } = {}) {\n super(callback)\n this.deferred = true\n this.deferGroup = group\n this.#rescue = options.rescue ?? false\n }\n\n override ignoresFirstLoad(): boolean {\n return true\n }\n\n override isDeferrable(): boolean {\n return true\n }\n\n override isOnceable(): boolean {\n return true\n }\n\n override shouldRescue(): boolean {\n return this.#rescue\n }\n}\n\n/** Merged with the client's current value on partial reloads (Inertia::merge / Inertia::deepMerge). */\nexport class MergeProp<T = unknown> extends MergeableProp<T> {\n readonly kind = 'merge' as const\n constructor(value: PropValue<T>) {\n super(value)\n this.mergeState.merge = true\n }\n\n override isOnceable(): boolean {\n return true\n }\n}\n\n/** Resolved once, then kept by the client until it expires (Inertia::once). */\nexport class OnceProp<T = unknown> extends Prop<T> {\n readonly kind = 'once' as const\n constructor(callback: PropCallback<T>) {\n super(callback)\n this.onceState.once = true\n }\n\n override isOnceable(): boolean {\n return true\n }\n}\n\n/** Page metadata for infinite scroll (Laravel's ProvidesScrollMetadata). */\nexport interface ScrollMetadata {\n pageName: string\n previousPage: string | number | null\n nextPage: string | number | null\n currentPage: string | number | null\n}\n\ntype MetadataResolver = (value: unknown) => ScrollMetadata\n\ninterface PagedPaginator {\n getPageName(): string\n currentPage(): number\n hasMorePages(): boolean\n}\n\ninterface CursorPaged {\n getCursorName(): string\n cursor(): { encode(): string } | undefined\n previousCursor(): { encode(): string } | undefined\n nextCursor(): { encode(): string } | undefined\n}\n\nconst isCursorPaginator = (value: unknown): value is CursorPaged =>\n typeof value === 'object' && value !== null && typeof (value as CursorPaged).getCursorName === 'function'\n\nconst isPagedPaginator = (value: unknown): value is PagedPaginator =>\n typeof value === 'object' &&\n value !== null &&\n typeof (value as PagedPaginator).getPageName === 'function' &&\n typeof (value as PagedPaginator).currentPage === 'function' &&\n typeof (value as PagedPaginator).hasMorePages === 'function'\n\n/** Laravel's ScrollMetadata::fromPaginator for the Database paginators (matched by shape). */\nexport function scrollMetadataFrom(value: unknown): ScrollMetadata {\n if (isCursorPaginator(value)) {\n const current = value.cursor()\n return {\n pageName: value.getCursorName(),\n previousPage: value.previousCursor()?.encode() ?? null,\n nextPage: value.nextCursor()?.encode() ?? null,\n currentPage: current === undefined ? 1 : current.encode(),\n }\n }\n if (isPagedPaginator(value)) {\n const current = value.currentPage()\n return {\n pageName: value.getPageName(),\n previousPage: current > 1 ? current - 1 : null,\n nextPage: value.hasMorePages() ? current + 1 : null,\n currentPage: current,\n }\n }\n throw new TypeError('The given value is not a paginator. Pass a metadata callback to Inertia.scroll().')\n}\n\n/** A paginated prop the client merges page by page (Inertia::scroll). */\nexport class ScrollProp<T = unknown> extends MergeableProp<T> {\n readonly kind = 'scroll' as const\n #resolved: { value: unknown } | undefined\n\n constructor(\n value: PropValue<T>,\n readonly wrapper = 'data',\n private readonly metadataResolver?: MetadataResolver,\n ) {\n super(value)\n this.mergeState.merge = true\n }\n\n override isDeferrable(): boolean {\n return true\n }\n\n /** Load the prop after the first render, like a deferred prop. */\n defer(group?: string): this {\n this.deferred = true\n this.deferGroup = group\n return this\n }\n\n /** 'prepend' from the X-Inertia-Infinite-Scroll-Merge-Intent header prepends the wrapper; anything else appends. */\n configureMergeIntent(intent: string | undefined): this {\n return intent === 'prepend' ? this.prepend(this.wrapper) : this.append(this.wrapper)\n }\n\n /** Resolves once and caches, because both the value and its metadata need it. */\n override async resolve(): Promise<unknown> {\n this.#resolved ??= { value: await super.resolve() }\n return this.#resolved.value\n }\n\n async metadata(): Promise<ScrollMetadata> {\n const value = await this.resolve()\n return this.metadataResolver === undefined ? scrollMetadataFrom(value) : this.metadataResolver(value)\n }\n}\n\nexport const isProp = (value: unknown): value is Prop => value instanceof Prop\n","import type { HttpRequest, InertiaOnceProp, InertiaScrollProp } from '@orieljs/contracts'\nimport { Arr } from '@orieljs/support'\nimport { Header, parseList } from './headers'\nimport { isProp, ScrollProp } from './props/props'\nimport type { Prop } from './props/Prop'\n\ntype Obj = Record<string, unknown>\n\n/** The page fields the resolver produces next to the props. Empty fields are left out. */\nexport interface PropsMetadata {\n sharedProps?: string[]\n mergeProps?: string[]\n prependProps?: string[]\n deepMergeProps?: string[]\n matchPropsOn?: string[]\n deferredProps?: Record<string, string[]>\n rescuedProps?: string[]\n scrollProps?: Record<string, InertiaScrollProp>\n onceProps?: Record<string, InertiaOnceProp>\n}\n\nexport interface PropsResolverOptions {\n /** config('inertia.expose_shared_prop_keys'), default true. */\n exposeSharedPropKeys?: boolean\n /** Reports a rescued deferred prop's error (the exception handler). */\n report?: (error: unknown) => void | Promise<void>\n}\n\n/** A plain object or an array: the values PHP calls arrays, which the resolver walks into. */\nconst isContainer = (value: unknown): value is Obj | unknown[] => {\n if (Array.isArray(value)) return true\n if (typeof value !== 'object' || value === null) return false\n const prototype = Object.getPrototypeOf(value) as unknown\n return prototype === Object.prototype || prototype === null\n}\n\nconst entriesOf = (value: Obj | unknown[]): Array<[string, unknown]> =>\n Array.isArray(value) ? value.map((item, index) => [String(index), item]) : Object.entries(value)\n\n/**\n * inertia-laravel's PropsResolver: walks the shared and page props, filters them for partial reloads, skips what\n * the first load must not send (optional, deferred, already-loaded once props), resolves callbacks and toJSON()\n * values, and collects the page metadata (merge, deferred, once, scroll, rescued, shared keys).\n */\nexport class PropsResolver {\n readonly #isPartial: boolean\n readonly #isInertia: boolean\n readonly #only: string[] | undefined\n readonly #except: string[] | undefined\n readonly #reset: string[]\n readonly #loadedOnce: string[]\n readonly #mergeIntent: string | undefined\n readonly #deferred: Record<string, string[]> = {}\n readonly #rescued: string[] = []\n readonly #merge: string[] = []\n readonly #prepend: string[] = []\n readonly #deepMerge: string[] = []\n readonly #matchOn: string[] = []\n readonly #scroll: Record<string, InertiaScrollProp> = {}\n readonly #once: Record<string, InertiaOnceProp> = {}\n readonly #observed = new WeakSet<object>()\n #sharedKeys: string[] = []\n\n constructor(\n request: HttpRequest,\n component: string,\n private readonly options: PropsResolverOptions = {},\n ) {\n this.#isPartial = request.header(Header.PARTIAL_COMPONENT) === component\n const inertia = request.header(Header.INERTIA)\n this.#isInertia = inertia !== undefined && inertia !== '' && inertia !== 'false'\n this.#only = parseList(request.header(Header.PARTIAL_ONLY))\n this.#except = parseList(request.header(Header.PARTIAL_EXCEPT))\n this.#reset = parseList(request.header(Header.RESET)) ?? []\n this.#loadedOnce = parseList(request.header(Header.EXCEPT_ONCE_PROPS)) ?? []\n this.#mergeIntent = request.header(Header.INFINITE_SCROLL_MERGE_INTENT)\n }\n\n async resolve(shared: Obj, props: Obj): Promise<{ props: Obj; metadata: PropsMetadata }> {\n if (this.options.exposeSharedPropKeys ?? true) {\n this.#sharedKeys = [...new Set(Object.keys(shared).map((key) => key.split('.')[0]!))]\n }\n this.#observePromises(shared)\n this.#observePromises(props)\n const merged = await this.#unpackDotProps({ ...shared, ...props })\n const resolved = (await this.#resolveProps(merged, '', false)) as Obj\n return { props: resolved, metadata: this.#metadata() }\n }\n\n #metadata(): PropsMetadata {\n const metadata: PropsMetadata = {}\n if (this.#sharedKeys.length > 0) metadata.sharedProps = this.#sharedKeys\n if (this.#merge.length > 0) metadata.mergeProps = this.#merge\n if (this.#prepend.length > 0) metadata.prependProps = this.#prepend\n if (this.#deepMerge.length > 0) metadata.deepMergeProps = this.#deepMerge\n if (this.#matchOn.length > 0) metadata.matchPropsOn = this.#matchOn\n if (Object.keys(this.#deferred).length > 0) metadata.deferredProps = this.#deferred\n if (this.#rescued.length > 0) metadata.rescuedProps = this.#rescued\n if (Object.keys(this.#scroll).length > 0) metadata.scrollProps = this.#scroll\n if (Object.keys(this.#once).length > 0) metadata.onceProps = this.#once\n return metadata\n }\n\n /**\n * Marks every raw Promise in a container tree as handled. A promise the walk never awaits (filtered out by a\n * partial reload, or after a prop that threw) would otherwise reject unobserved and could end the process.\n * Awaiting the original promise still throws its error where it is used.\n */\n #observePromises(value: unknown): void {\n if (value instanceof Promise) {\n value.catch(() => undefined)\n return\n }\n if (!isContainer(value) || this.#observed.has(value)) return\n this.#observed.add(value)\n for (const [, child] of entriesOf(value)) this.#observePromises(child)\n }\n\n async #resolveProps(props: Obj | unknown[], prefix: string, parentWasResolved: boolean): Promise<Obj | unknown[]> {\n // Containers returned by callbacks are new: observe their promises before walking them.\n this.#observePromises(props)\n const result: Obj | unknown[] = Array.isArray(props) ? [] : {}\n for (const [key, original] of entriesOf(props)) {\n const path = prefix === '' ? key : `${prefix}.${key}`\n let prop: unknown = original\n\n // Partial reloads keep only the requested paths; AlwaysProps and children of resolved values bypass this.\n if (!this.#shouldIncludeInPartialResponse(prop, path, parentWasResolved)) continue\n // The first load never runs optional/deferred callbacks, nor once props the client already has.\n if (!this.#isPartial && this.#excludeFromInitialResponse(prop, path)) continue\n\n let value = await this.#resolveValue(prop, path)\n if (this.#rescued.includes(path)) continue\n\n // A callback may return a prop type: unwrap it one more level so it takes part in filtering and metadata.\n if (value !== prop && isProp(value)) {\n prop = value\n if (!this.#isPartial && this.#excludeFromInitialResponse(prop, path)) continue\n value = await this.#resolveValue(prop, path)\n if (this.#rescued.includes(path)) continue\n }\n\n await this.#collectMetadata(prop, path)\n\n // Containers are walked; the children of a value that wasn't a literal container skip partial filtering.\n const child = isContainer(value) ? await this.#resolveProps(value, path, parentWasResolved || !isContainer(prop)) : value\n if (Array.isArray(result)) result.push(child)\n else result[key] = child\n }\n return result\n }\n\n #shouldIncludeInPartialResponse(prop: unknown, path: string, parentWasResolved: boolean): boolean {\n if (!this.#isPartial || parentWasResolved || (isProp(prop) && prop.isAlways())) return true\n if (this.#only !== undefined && !this.#matchesOnly(path) && !this.#leadsToOnly(path)) return false\n if (this.#except !== undefined && this.#matchesExcept(path)) return false\n return true\n }\n\n #excludeFromInitialResponse(prop: unknown, path: string): boolean {\n if (!isProp(prop)) return false\n if (prop.ignoresFirstLoad()) {\n if (prop.shouldDefer() && !this.#wasAlreadyLoadedByClient(prop, path)) this.#collectDeferred(path, prop)\n if (prop.shouldMerge()) this.#collectMerge(path, prop)\n if (prop.shouldResolveOnce()) this.#collectOnce(path, prop)\n return true\n }\n if (prop.shouldDefer()) {\n this.#collectDeferred(path, prop)\n if (prop.shouldMerge()) this.#collectMerge(path, prop)\n return true\n }\n if (this.#isInertia && this.#wasAlreadyLoadedByClient(prop, path)) {\n this.#collectOnce(path, prop)\n return true\n }\n return false\n }\n\n #wasAlreadyLoadedByClient(prop: Prop, path: string): boolean {\n return prop.shouldResolveOnce() && !prop.shouldBeRefreshed() && this.#loadedOnce.includes(prop.getKey() ?? path)\n }\n\n /** Callbacks and prop types run; objects with toJSON() (models, collections, paginators, dates) serialize. */\n async #resolveValue(value: unknown, path: string): Promise<unknown> {\n if (value instanceof ScrollProp) value.configureMergeIntent(this.#mergeIntent)\n const rescue = isProp(value) && value.shouldRescue()\n try {\n let resolved: unknown = value\n if (isProp(resolved)) resolved = await resolved.resolve()\n else if (typeof resolved === 'function') resolved = await (resolved as () => unknown)()\n else if (resolved instanceof Promise) resolved = await resolved\n // Like JSON.stringify: anything with a toJSON() method (models, collections, paginators, dates) serializes.\n if (!isProp(resolved) && typeof resolved === 'object' && resolved !== null && !Array.isArray(resolved)) {\n const serializable = resolved as { toJSON?: () => unknown }\n if (typeof serializable.toJSON === 'function') resolved = serializable.toJSON()\n }\n return resolved\n } catch (error) {\n if (!rescue) throw error\n await this.options.report?.(error)\n this.#rescued.push(path)\n return null\n }\n }\n\n async #collectMetadata(prop: unknown, path: string): Promise<void> {\n if (!isProp(prop)) return\n if (prop.shouldMerge()) this.#collectMerge(path, prop)\n if (prop instanceof ScrollProp) this.#scroll[path] = { ...(await prop.metadata()), reset: this.#reset.includes(path) }\n if (prop.shouldResolveOnce()) this.#collectOnce(path, prop)\n }\n\n #collectDeferred(path: string, prop: Prop): void {\n ;(this.#deferred[prop.group()] ??= []).push(path)\n }\n\n #collectMerge(path: string, prop: Prop): void {\n if (this.#reset.includes(path)) return\n if (this.#isPartial && !this.#isIncludedInPartialMetadata(path)) return\n if (prop.shouldDeepMerge()) this.#deepMerge.push(path)\n else if (prop.appendsAtRoot()) this.#merge.push(path)\n else if (prop.prependsAtRoot()) this.#prepend.push(path)\n else {\n for (const append of prop.appendsAtPaths()) this.#merge.push(`${path}.${append}`)\n for (const prepend of prop.prependsAtPaths()) this.#prepend.push(`${path}.${prepend}`)\n }\n for (const strategy of prop.matchesOn()) this.#matchOn.push(`${path}.${strategy}`)\n }\n\n #collectOnce(path: string, prop: Prop): void {\n if (!prop.shouldResolveOnce()) return\n if (this.#isPartial && !this.#isIncludedInPartialMetadata(path)) return\n this.#once[prop.getKey() ?? path] = { prop: path, expiresAt: prop.expiresAt() }\n }\n\n #isIncludedInPartialMetadata(path: string): boolean {\n if (this.#only !== undefined && !this.#matchesOnly(path)) return false\n if (this.#except !== undefined && this.#matchesExcept(path)) return false\n return true\n }\n\n #matchesOnly(path: string): boolean {\n return this.#only!.some((only) => path === only || path.startsWith(`${only}.`))\n }\n\n #leadsToOnly(path: string): boolean {\n return this.#only!.some((only) => only.startsWith(`${path}.`))\n }\n\n #matchesExcept(path: string): boolean {\n return this.#except!.some((except) => path === except || path.startsWith(`${except}.`))\n }\n\n /** 'auth.user' => value becomes { auth: { user: value } }; callbacks along the path are resolved first. */\n async #unpackDotProps(props: Obj): Promise<Obj> {\n const result: Obj = { ...props }\n for (const [key, original] of Object.entries(props)) {\n if (!key.includes('.')) continue\n let value = original\n if (typeof value === 'function') value = await (value as () => unknown)()\n await this.#ensurePathIsTraversable(result, key)\n delete result[key]\n Arr.set(result, key, value)\n }\n return result\n }\n\n async #ensurePathIsTraversable(props: Obj, dotKey: string): Promise<void> {\n let current: Obj = props\n for (const segment of dotKey.split('.').slice(0, -1)) {\n if (current[segment] === undefined || current[segment] === null) return\n if (typeof current[segment] === 'function') current[segment] = await (current[segment] as () => unknown)()\n const value = current[segment]\n if (typeof value === 'object' && value !== null && !isContainer(value) && typeof (value as { toJSON?: unknown }).toJSON === 'function') {\n current[segment] = (value as { toJSON(): unknown }).toJSON()\n }\n const walked = current[segment]\n if (typeof walked !== 'object' || walked === null) return\n // Copy every object on the path (keeping its prototype) so setting the dotted key never writes into one the caller owns.\n current[segment] = Array.isArray(walked) ? [...walked] : Object.assign(Object.create(Object.getPrototypeOf(walked) as object | null) as Obj, walked)\n current = current[segment] as Obj\n }\n }\n}\n","import { HttpRequest, Session, type Container } from '@orieljs/contracts'\nimport { currentContainer } from '@orieljs/container'\n\n/** The current container when it is a request scope (Http binds HttpRequest only there). */\nexport function requestScope(): Container | undefined {\n const container = currentContainer()\n return container !== undefined && container.bound(HttpRequest) ? container : undefined\n}\n\nexport function currentRequest(): HttpRequest | undefined {\n return requestScope()?.make(HttpRequest)\n}\n\n/** The request's session, or undefined outside a request or when no Session provider is registered. */\nexport function optionalSession(): Session | undefined {\n const scope = requestScope()\n return scope?.bound(Session) ? scope.make(Session) : undefined\n}\n\n/** Is this an Inertia visit (X-Inertia header)? */\nexport function isInertiaRequest(request: HttpRequest): boolean {\n const value = request.header('X-Inertia')\n return value !== undefined && value !== '' && value !== 'false'\n}\n\n/** Laravel's Request::prefetch(): Purpose, Sec-Purpose or X-Moz is 'prefetch'. */\nexport function isPrefetch(request: HttpRequest): boolean {\n return ['Purpose', 'Sec-Purpose', 'X-Moz'].some((name) => request.header(name)?.toLowerCase() === 'prefetch')\n}\n\n/**\n * A copy of `response` with another status and/or extra headers. Web Responses have a read-only status and may\n * have immutable headers (Response.redirect()), so this always builds a new one around the same body.\n */\nexport function rebuild(response: Response, changes: { status?: number; headers?: Record<string, string> }): Response {\n const headers = new Headers(response.headers)\n for (const [name, value] of Object.entries(changes.headers ?? {})) headers.set(name, value)\n const status = changes.status ?? response.status\n return new Response(response.body, {\n status,\n statusText: status === response.status ? response.statusText : '',\n headers,\n })\n}\n\nexport function isRedirect(response: Response): boolean {\n return [201, 301, 302, 303, 307, 308].includes(response.status) && response.headers.has('Location')\n}\n","import type { OrielError } from '@orieljs/contracts'\n\n/** A page component that doesn't exist on disk (inertia.pages.ensure_pages_exist). */\nexport class ComponentNotFoundError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n\n constructor(readonly component: string) {\n super(`Inertia page component [${component}] not found.`)\n this.name = 'ComponentNotFoundError'\n }\n}\n\n/** An Inertia response outside a request, or a misconfiguration. */\nexport class InertiaError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n\n constructor(message: string) {\n super(message)\n this.name = 'InertiaError'\n }\n}\n\n/** An SSR render that failed while inertia.ssr.throw_on_error is on. */\nexport class SsrError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options)\n this.name = 'SsrError'\n }\n}\n","import { existsSync, readdirSync } from 'node:fs'\nimport { join, relative, sep } from 'node:path'\nimport {\n ConfigRepository,\n ExceptionHandler,\n ViewFactory,\n type Container,\n type HttpRequest,\n type InertiaPage,\n type InertiaResponse,\n} from '@orieljs/contracts'\nimport { isInertiaRequest, optionalSession, requestScope } from './context'\nimport { ComponentNotFoundError, InertiaError } from './errors'\nimport { PropsResolver } from './PropsResolver'\n\ntype Obj = Record<string, unknown>\n\n/** Session keys inertia-laravel uses (Support\\SessionKey). */\nexport const SessionKey = {\n CLEAR_HISTORY: 'inertia.clear_history',\n PRESERVE_FRAGMENT: 'inertia.preserve_fragment',\n FLASH_DATA: 'inertia.flash_data',\n} as const\n\nexport type UrlResolver = (request: HttpRequest) => string\n\n/** What the factory hands a response: everything decided before the controller returned. */\nexport interface ResponseSettings {\n shared: Obj\n rootView: string\n version: () => Promise<string>\n encryptHistory: boolean\n urlResolver?: UrlResolver\n flash: (key: string | Obj, value?: unknown) => void\n}\n\n/** Path and query of the request, keeping a trailing slash (inertia-laravel's default URL resolver). */\nexport function defaultUrl(request: HttpRequest): string {\n const url = new URL(request.raw.url)\n return `${url.pathname}${url.search}`\n}\n\n/**\n * An Inertia page response (inertia-laravel's Response). `C` and `P` carry the component name and props type,\n * which the generated page-prop types read back.\n */\nexport class Response<C extends string = string, P extends Obj = Obj> implements InertiaResponse {\n declare readonly __component?: C\n declare readonly __props?: P\n #props: Obj\n #viewData: Obj = {}\n #rootView: string\n\n constructor(\n readonly component: C,\n props: P,\n private readonly settings: ResponseSettings,\n ) {\n this.#props = { ...props }\n this.#rootView = settings.rootView\n }\n\n with(key: string | Obj, value?: unknown): this {\n if (typeof key === 'string') this.#props[key] = value\n else Object.assign(this.#props, key)\n return this\n }\n\n withViewData(key: string | Obj, value?: unknown): this {\n if (typeof key === 'string') this.#viewData[key] = value\n else Object.assign(this.#viewData, key)\n return this\n }\n\n rootView(view: string): this {\n this.#rootView = view\n return this\n }\n\n flash(key: string | Obj, value?: unknown): this {\n this.settings.flash(key, value)\n return this\n }\n\n /** The page object for this request. */\n async toPage(request: HttpRequest): Promise<InertiaPage> {\n const scope = requestScope()\n this.#ensurePageExists(scope)\n const resolver = new PropsResolver(request, this.component, {\n exposeSharedPropKeys: this.#config(scope, 'inertia.expose_shared_prop_keys', true),\n report: async (error) => {\n if (scope?.bound(ExceptionHandler)) await scope.make(ExceptionHandler).report(error)\n },\n })\n const { props, metadata } = await resolver.resolve(this.settings.shared, this.#props)\n const session = optionalSession()\n const clearHistory = session?.pull<boolean>(SessionKey.CLEAR_HISTORY, false) === true\n const preserveFragment = session?.pull<boolean>(SessionKey.PRESERVE_FRAGMENT, false) === true\n const flash = session?.pull<Obj | undefined>(SessionKey.FLASH_DATA, undefined)\n\n const page: InertiaPage = {\n component: this.component,\n props,\n url: (this.settings.urlResolver ?? defaultUrl)(request),\n version: await this.settings.version(),\n ...metadata,\n }\n if (clearHistory) page.clearHistory = true\n if (this.settings.encryptHistory) page.encryptHistory = true\n if (flash !== undefined && flash !== null && Object.keys(flash).length > 0) page.flash = flash\n if (preserveFragment) page.preserveFragment = true\n return page\n }\n\n async toResponse(request: unknown): Promise<globalThis.Response> {\n const http = request as HttpRequest\n if (typeof http?.header !== 'function') throw new InertiaError('An Inertia response needs the HttpRequest.')\n const page = await this.toPage(http)\n if (isInertiaRequest(http)) {\n return new globalThis.Response(JSON.stringify(page), {\n status: 200,\n headers: { 'content-type': 'application/json', 'X-Inertia': 'true' },\n })\n }\n const scope = requestScope()\n if (scope === undefined || !scope.bound(ViewFactory)) {\n throw new InertiaError(`Cannot render the Inertia root view [${this.#rootView}]: no ViewFactory is bound.`)\n }\n const html = await scope.make(ViewFactory).make(this.#rootView, { ...this.#viewData, page }).render()\n return new globalThis.Response(html, { status: 200, headers: { 'content-type': 'text/html; charset=utf-8' } })\n }\n\n /** inertia.pages.ensure_pages_exist: the component must exist under one of the page paths. */\n #ensurePageExists(scope: Container | undefined): void {\n if (!this.#config(scope, 'inertia.pages.ensure_pages_exist', false)) return\n const paths = this.#config<string[]>(scope, 'inertia.pages.paths', [])\n const extensions = this.#config<string[]>(scope, 'inertia.pages.extensions', [])\n if (!pageExists(this.component, paths, extensions)) throw new ComponentNotFoundError(this.component)\n }\n\n #config<T>(scope: Container | undefined, key: string, fallback: T): T {\n return scope?.bound(ConfigRepository) ? scope.make(ConfigRepository).get<T>(key, fallback) : fallback\n }\n}\n\n/**\n * The pages under the page paths, named as inertia() takes them ('Posts/Show'), sorted by name; a page in two paths is\n * listed once, from the first. A file takes its longest matching extension, so `Show.component.ts` is 'Show'.\n */\nexport function pageNames(paths: string[], extensions: string[]): Array<{ name: string; file: string }> {\n const byLength = [...extensions].sort((a, b) => b.length - a.length)\n const pages = new Map<string, string>()\n for (const path of paths) {\n if (!existsSync(path)) continue\n for (const entry of readdirSync(path, { recursive: true, withFileTypes: true })) {\n if (!entry.isFile()) continue\n const file = join(entry.parentPath, entry.name)\n const extension = byLength.find((candidate) => entry.name.endsWith(`.${candidate}`))\n if (extension === undefined) continue\n const name = relative(path, file).slice(0, -(extension.length + 1)).split(sep).join('/')\n if (!pages.has(name)) pages.set(name, file)\n }\n }\n return [...pages].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)).map(([name, file]) => ({ name, file }))\n}\n\n/** Is there a file for `component` ('Posts/Index') under a page path, with one of the extensions? */\nexport function pageExists(component: string, paths: string[], extensions: string[]): boolean {\n return paths.some((path) => extensions.some((extension) => existsSync(join(path, `${component}.${extension}`))))\n}\n","import {\n ConfigRepository,\n Redirector,\n type Application,\n type InertiaFactory,\n type PropCallback,\n type RedirectResponse,\n} from '@orieljs/contracts'\nimport { Arr } from '@orieljs/support'\nimport { currentRequest, isInertiaRequest, optionalSession, requestScope } from './context'\nimport { Header } from './headers'\nimport { AlwaysProp, DeferProp, MergeProp, OnceProp, OptionalProp, ScrollProp, type ScrollMetadata } from './props/props'\nimport type { PropValue } from './props/Prop'\nimport { Response, SessionKey, type UrlResolver } from './Response'\n\ntype Obj = Record<string, unknown>\ntype VersionResolver = string | null | (() => string | null | Promise<string | null>)\n\n/**\n * inertia-laravel's ResponseFactory. The application holds one (the root): props shared from a service provider\n * and the app-wide settings live there. Each request gets a child (scoped): what the HandleInertiaRequests\n * middleware or a controller shares stays in that request. A child reads through to its root.\n */\nexport class ResponseFactory implements InertiaFactory {\n #shared: Obj = {}\n #rootView: string | undefined\n #version: VersionResolver | undefined\n #encryptHistory: boolean | undefined\n #urlResolver: UrlResolver | undefined\n\n constructor(\n protected readonly app: Application,\n private readonly parent?: ResponseFactory,\n ) {}\n\n /** A per-request child of this (root) factory. */\n forRequest(): ResponseFactory {\n return new ResponseFactory(this.app, this)\n }\n\n setRootView(view: string): void {\n this.#rootView = view\n }\n\n getRootView(): string {\n return this.#rootView ?? this.parent?.getRootView() ?? 'app'\n }\n\n share(key: string | Obj, value?: unknown): void {\n if (typeof key === 'string') Arr.set(this.#shared, key, value)\n else Object.assign(this.#shared, key)\n }\n\n shareOnce(key: string, callback: PropCallback): OnceProp {\n const prop = new OnceProp(callback)\n this.share(key, prop)\n return prop\n }\n\n getShared(key?: string, defaultValue?: unknown): unknown {\n const shared = { ...(this.parent?.getShared() as Obj | undefined), ...this.#shared }\n return key === undefined ? shared : Arr.get(shared, key, defaultValue)\n }\n\n flushShared(): void {\n this.#shared = {}\n }\n\n version(version: VersionResolver): void {\n this.#version = version\n }\n\n /** The asset version as a string ('' when there is none), like Laravel's `(string) $version`. */\n async getVersion(): Promise<string> {\n const version = this.#versionResolver()\n const resolved = typeof version === 'function' ? await version() : version\n return resolved === null || resolved === undefined ? '' : String(resolved)\n }\n\n #versionResolver(): VersionResolver | undefined {\n return this.#version ?? (this.parent === undefined ? undefined : this.parent.#versionResolver())\n }\n\n #encrypts(): boolean | undefined {\n return this.#encryptHistory ?? (this.parent === undefined ? undefined : this.parent.#encrypts())\n }\n\n #resolvesUrl(): UrlResolver | undefined {\n return this.#urlResolver ?? (this.parent === undefined ? undefined : this.parent.#resolvesUrl())\n }\n\n resolveUrlUsing(resolver: UrlResolver | undefined): void {\n this.#urlResolver = resolver\n }\n\n encryptHistory(encrypt = true): void {\n this.#encryptHistory = encrypt\n }\n\n clearHistory(): void {\n optionalSession()?.put(SessionKey.CLEAR_HISTORY, true)\n }\n\n preserveFragment(): void {\n optionalSession()?.put(SessionKey.PRESERVE_FRAGMENT, true)\n }\n\n optional<T>(callback: PropCallback<T>): OptionalProp<T> {\n return new OptionalProp(callback)\n }\n\n defer<T>(callback: PropCallback<T>, group = 'default', options: { rescue?: boolean } = {}): DeferProp<T> {\n return new DeferProp(callback, group, options)\n }\n\n always<T>(value: PropValue<T>): AlwaysProp<T> {\n return new AlwaysProp(value)\n }\n\n merge<T>(value: PropValue<T>): MergeProp<T> {\n return new MergeProp(value)\n }\n\n deepMerge<T>(value: PropValue<T>): MergeProp<T> {\n return new MergeProp(value).deepMerge()\n }\n\n once<T>(callback: PropCallback<T>): OnceProp<T> {\n return new OnceProp(callback)\n }\n\n scroll<T>(value: PropValue<T>, wrapper = 'data', metadata?: (value: T) => ScrollMetadata): ScrollProp<T> {\n return new ScrollProp(value, wrapper, metadata as ((value: unknown) => ScrollMetadata) | undefined)\n }\n\n /** Flashes page.flash data for the next Inertia response (stored in the session immediately). */\n flash(key: string | Obj, value?: unknown): this {\n const session = optionalSession()\n if (session === undefined) return this\n const flash = typeof key === 'string' ? { [key]: value } : key\n session.flash(SessionKey.FLASH_DATA, { ...session.get<Obj>(SessionKey.FLASH_DATA, {}), ...flash })\n return this\n }\n\n back(fallback?: string, status = 302): RedirectResponse {\n const scope = requestScope() ?? this.app\n return scope.make(Redirector).back(fallback, status)\n }\n\n /** 409 + X-Inertia-Location for Inertia requests (the client does a full visit), a plain 302 otherwise. */\n location(url: string): globalThis.Response {\n const request = currentRequest()\n if (request !== undefined && isInertiaRequest(request)) {\n return new globalThis.Response(null, { status: 409, headers: { [Header.LOCATION]: url } })\n }\n return new globalThis.Response(null, { status: 302, headers: { Location: url } })\n }\n\n render<C extends string, P extends Obj = Record<never, never>>(component: C, props: P = {} as P): Response<C, P> {\n const config = this.app.bound(ConfigRepository) ? this.app.make(ConfigRepository) : undefined\n return new Response(component, props, {\n shared: this.getShared() as Obj,\n rootView: this.getRootView(),\n version: () => this.getVersion(),\n encryptHistory: this.#encrypts() ?? config?.get<boolean>('inertia.history.encrypt', false) ?? false,\n urlResolver: this.#resolvesUrl(),\n flash: (key, value) => void this.flash(key, value),\n })\n }\n}\n","import { Application, HttpRequest, InertiaFactory } from '@orieljs/contracts'\nimport { ContainerNotAvailableError, currentContainer } from '@orieljs/container'\nimport type { Response } from './Response'\nimport { ResponseFactory } from './ResponseFactory'\n\ntype Obj = Record<string, unknown>\n\n/**\n * The factory for the current context: the request's own (scoped) factory inside a request, else the\n * application's root factory (a service provider sharing props for every request).\n */\nexport function inertiaFactory(): ResponseFactory {\n const container = currentContainer()\n if (container === undefined) throw new ContainerNotAvailableError('Inertia')\n if (container.bound(HttpRequest)) return container.make(InertiaFactory) as ResponseFactory\n return container.make(Application).make(ResponseFactory)\n}\n\n/** inertia('Posts/Index', { posts }) → an Inertia response; inertia() → the factory. */\nexport function inertia(): ResponseFactory\nexport function inertia<C extends string, P extends Obj = Record<never, never>>(component: C, props?: P): Response<C, P>\nexport function inertia(component?: string, props: Obj = {}): ResponseFactory | Response {\n const factory = inertiaFactory()\n return component === undefined ? factory : factory.render(component, props)\n}\n\n/**\n * The Inertia facade: Inertia.render(), Inertia.share(), Inertia.defer(), Inertia.flash(...).back(), …\n * Resolved on every access, so it always talks to the current request's factory.\n */\nexport const Inertia: ResponseFactory = new Proxy({} as ResponseFactory, {\n get(_target, property) {\n if (typeof property === 'symbol' || property === 'then') return undefined\n const factory = inertiaFactory()\n const value = Reflect.get(factory, property, factory) as unknown\n return typeof value === 'function' ? (value as (...args: unknown[]) => unknown).bind(factory) : value\n },\n})\n","import { InertiaSsrGateway, type Htmlable, type InertiaPage, type InertiaSsrResponse } from '@orieljs/contracts'\nimport { currentContainer } from '@orieljs/container'\n\n/** Markup the view renderer emits as-is (Htmlable, like View's HtmlString; Inertia can't import View). */\nexport class InertiaHtml implements Htmlable {\n constructor(private readonly html: string) {}\n\n toHtml(): string {\n return this.html\n }\n\n toString(): string {\n return this.html\n }\n}\n\n/**\n * The page as JSON for a <script type=\"application/json\"> element: `/` is escaped (the protocol requires it) and\n * `<`, `>` are \\u-escaped so the JSON can never close the script element. No HTML entities.\n */\nexport function pageJson(page: InertiaPage): string {\n return JSON.stringify(page).replace(/\\//g, '\\\\/').replace(/</g, '\\\\u003c').replace(/>/g, '\\\\u003e')\n}\n\n/** The client-side-rendered mount point: the page script, then the empty root element (Laravel's @inertia). */\nexport function pageMarkup(page: InertiaPage, id = 'app'): string {\n const safeId = id.replace(/[^A-Za-z0-9_-]/g, '')\n return `<script data-page=\"${safeId}\" type=\"application/json\">${pageJson(page)}</script><div id=\"${safeId}\"></div>`\n}\n\n/** One SSR dispatch per page object, shared by inertiaHead() and inertiaBody() (Laravel's $__inertiaSsrResponse). */\nconst dispatched = new WeakMap<InertiaPage, Promise<InertiaSsrResponse | undefined>>()\n\nfunction ssr(page: InertiaPage): Promise<InertiaSsrResponse | undefined> {\n let pending = dispatched.get(page)\n if (pending === undefined) {\n const container = currentContainer()\n pending = container?.bound(InertiaSsrGateway) ? container.make(InertiaSsrGateway).dispatch(page) : Promise.resolve(undefined)\n dispatched.set(page, pending)\n }\n return pending\n}\n\n/**\n * The view creates both the head and the body promise before it awaits either. When rendering stops at the head\n * (an SSR error with throw_on_error), the body's rejection must not also surface as an unhandled one.\n */\nfunction handled<T>(promise: Promise<T>): Promise<T> {\n promise.catch(() => undefined)\n return promise\n}\n\n/** Laravel's @inertiaHead: the SSR head tags, or nothing when the page is rendered in the browser. */\nexport function inertiaHead(page: InertiaPage): Promise<InertiaHtml> {\n return handled(ssr(page).then((rendered) => new InertiaHtml(rendered?.head ?? '')))\n}\n\n/** Laravel's @inertia: the SSR body, else the page script and the empty mount element. */\nexport function inertiaBody(page: InertiaPage, id = 'app'): Promise<InertiaHtml> {\n return handled(ssr(page).then((rendered) => new InertiaHtml(rendered?.body ?? pageMarkup(page, id))))\n}\n","import { createHash } from 'node:crypto'\nimport { existsSync, readFileSync } from 'node:fs'\nimport {\n Application,\n ConfigRepository,\n Container,\n InertiaFactory,\n Redirector,\n type HttpRequest,\n type Middleware,\n type Next,\n type PropCallback,\n type Session,\n} from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { isInertiaRequest, isPrefetch, isRedirect, optionalSession, rebuild } from './context'\nimport { Header } from './headers'\nimport { AlwaysProp, OnceProp } from './props/props'\nimport { SessionKey, type UrlResolver } from './Response'\nimport type { ResponseFactory } from './ResponseFactory'\nimport { withoutSsr } from './ssr/requests'\n\n/** Flat field → first message (or every message with withAllErrors), or bag → fields when named bags are used. */\nexport type ValidationErrors = Record<string, string | string[]> | Record<string, Record<string, string | string[]>>\n\n/**\n * inertia-laravel's Middleware, the base of the app's HandleInertiaRequests (add it to the `web` group). It shares\n * the validation errors and your share() props, sets the asset version and root view, and turns responses into\n * what the Inertia client expects: Vary, 409 on a version change, 303 after PUT/PATCH/DELETE, back() for empty\n * responses and 409 + X-Inertia-Redirect for redirects with a #fragment.\n */\nexport class InertiaMiddleware implements Middleware {\n /** The root view rendered on the first visit: resources/views/app.tsx. */\n protected rootViewName = 'app'\n /** Send every message per field instead of the first one. */\n protected withAllErrors = false\n /** Paths (wildcards allowed) rendered without SSR. */\n protected withoutSsr: string[] = []\n\n protected readonly container = inject(Container)\n\n /** The asset version: a hash of app.asset_url, else of public/build/manifest.json, else none. */\n async version(_request: HttpRequest): Promise<string | null> {\n const config = this.container.bound(ConfigRepository) ? this.container.make(ConfigRepository) : undefined\n const assetUrl = config?.get<string | null>('app.asset_url', null)\n if (typeof assetUrl === 'string' && assetUrl !== '') return md5(assetUrl)\n const app = this.container.make(Application)\n const manifest = app.publicPath('build/manifest.json')\n return existsSync(manifest) ? md5(readFileSync(manifest)) : null\n }\n\n /** Props shared with every page. Override and spread `await super.share(request)` into your own. */\n async share(request: HttpRequest): Promise<{ errors: AlwaysProp<ValidationErrors> }> {\n return { errors: new AlwaysProp(this.resolveValidationErrors(request)) }\n }\n\n /** Shared once props: sent on the first visit, then kept by the client. */\n async shareOnce(_request: HttpRequest): Promise<Record<string, OnceProp | PropCallback>> {\n return {}\n }\n\n rootView(_request: HttpRequest): string {\n return this.rootViewName\n }\n\n /** How page.url is built; undefined keeps the default (path + query). */\n urlResolver(): UrlResolver | undefined {\n return undefined\n }\n\n async handle(request: HttpRequest, next: Next): Promise<Response> {\n const inertia = this.container.make(InertiaFactory) as ResponseFactory\n inertia.version(() => this.version(request))\n inertia.share(await this.share(request))\n for (const [key, value] of Object.entries(await this.shareOnce(request))) {\n if (value instanceof OnceProp) inertia.share(key, value)\n else inertia.shareOnce(key, value)\n }\n inertia.setRootView(this.rootView(request))\n const resolver = this.urlResolver()\n if (resolver !== undefined) inertia.resolveUrlUsing(resolver)\n if (this.withoutSsr.length > 0) withoutSsr(request, this.withoutSsr)\n\n let response = await next(request)\n // Added to what Vary lists already (the precognitive middleware's Precognition), not in its place.\n const vary = (response.headers.get('Vary') ?? '').split(',').map((value) => value.trim()).filter((value) => value !== '' && value !== 'X-Inertia')\n response = rebuild(response, { headers: { Vary: [...vary, 'X-Inertia'].join(', ') } })\n const redirect = isRedirect(response)\n const session = optionalSession()\n if (redirect && session !== undefined) this.reflash(session)\n if (!isInertiaRequest(request)) return response\n\n if (session !== undefined && this.shouldStoreCurrentUrl(request, response)) session.setPreviousUrl(request.fullUrl())\n if (request.method() === 'GET' && request.header(Header.VERSION, '') !== (await inertia.getVersion())) {\n response = await this.onVersionChange(request, response)\n }\n if (isEmpty(response)) response = await this.onEmptyResponse(request, response)\n if (response.status === 302 && ['PUT', 'PATCH', 'DELETE'].includes(request.method())) response = rebuild(response, { status: 303 })\n if (redirect && (response.headers.get('Location') ?? '').includes('#') && !isPrefetch(request)) {\n response = await this.onRedirectWithFragment(request, response)\n }\n return response\n }\n\n /** The session's flashed errors ({ [bag]: { field: string[] } }), shaped for the client. */\n resolveValidationErrors(request: HttpRequest): ValidationErrors {\n const flashed = optionalSession()?.get<Record<string, Record<string, string[]>> | undefined>('errors', undefined)\n if (flashed === undefined || flashed === null || typeof flashed !== 'object') return {}\n const bags = Object.fromEntries(\n Object.entries(flashed).map(([bag, fields]) => [\n bag,\n Object.fromEntries(\n Object.entries(fields ?? {}).map(([field, messages]) => {\n const list = Array.isArray(messages) ? messages.map(String) : [String(messages)]\n return [field, this.withAllErrors ? list : list[0] ?? '']\n }),\n ),\n ]),\n ) as Record<string, Record<string, string | string[]>>\n const errorBag = request.header(Header.ERROR_BAG)\n if (bags.default !== undefined && errorBag !== undefined && errorBag !== '') return { [errorBag]: bags.default }\n if (bags.default !== undefined) return bags.default\n return bags\n }\n\n /** inertia.store_previous_url: Inertia GET visits (not prefetches or same-page partial reloads) become previous(). */\n shouldStoreCurrentUrl(request: HttpRequest, _response: Response): boolean {\n const config = this.container.bound(ConfigRepository) ? this.container.make(ConfigRepository) : undefined\n if (config?.get<boolean>('inertia.store_previous_url', false) !== true) return false\n if (request.method() !== 'GET' || !request.ajax() || isPrefetch(request)) return false\n const partial = request.header(Header.PARTIAL_COMPONENT)\n return partial === undefined || partial === ''\n }\n\n async onEmptyResponse(request: HttpRequest, _response: Response): Promise<Response> {\n return this.container.make(Redirector).back().toResponse(request)\n }\n\n async onRedirectWithFragment(_request: HttpRequest, response: Response): Promise<Response> {\n return new Response(null, { status: 409, headers: { [Header.REDIRECT]: response.headers.get('Location') ?? '' } })\n }\n\n async onVersionChange(request: HttpRequest, _response: Response): Promise<Response> {\n optionalSession()?.reflash()\n const inertia = this.container.make(InertiaFactory)\n const response = inertia.location(request.fullUrl())\n return rebuild(response, { headers: { [Header.VERSION]: await inertia.getVersion() } })\n }\n\n /** Keeps Inertia flash data for the page the redirect leads to. */\n protected reflash(session: Session): void {\n const flashed = session.get<Record<string, unknown> | undefined>(SessionKey.FLASH_DATA, undefined)\n if (flashed !== undefined && flashed !== null && Object.keys(flashed).length > 0) session.flash(SessionKey.FLASH_DATA, flashed)\n }\n}\n\n/** An empty 200 (Laravel), or a 204 (what Oriel's router returns when an action returns nothing). */\nfunction isEmpty(response: Response): boolean {\n if (response.status === 204) return true\n return response.status === 200 && (response.body === null || response.headers.get('content-length') === '0')\n}\n\nfunction md5(value: string | Buffer): string {\n return createHash('md5').update(value).digest('hex')\n}\n","import type { HttpRequest } from '@orieljs/contracts'\nimport { Str } from '@orieljs/support'\n\n/** Requests the middleware's `withoutSsr` paths matched: rendered in the browser only. */\nconst excluded = new WeakSet<HttpRequest>()\n\n/** Marks `request` as client-rendered when it matches one of `paths` (wildcards allowed). */\nexport function withoutSsr(request: HttpRequest, paths: string[]): void {\n const matches = paths.some((pattern) => {\n const trimmed = pattern === '/' ? pattern : pattern.replace(/^\\/+|\\/+$/g, '')\n return Str.is(trimmed, request.fullUrl()) || request.is(trimmed)\n })\n if (matches) excluded.add(request)\n}\n\nexport function isExcludedFromSsr(request: HttpRequest): boolean {\n return excluded.has(request)\n}\n","import { Container, InertiaFactory, type HttpRequest, type Middleware, type Next } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\n\n/** Encrypts the browser history state of the pages behind it (route middleware alias `inertia.encrypt`). */\nexport class EncryptHistory implements Middleware {\n readonly #container = inject(Container)\n\n async handle(request: HttpRequest, next: Next): Promise<Response> {\n this.#container.make(InertiaFactory).encryptHistory()\n return next(request)\n }\n}\n","import { ExceptionHandler, ValidationFactory, type Container, type HttpRequest, type Middleware, type Next, type OrielError, type RuleCallback, type Rules, type Validator } from '@orieljs/contracts'\nimport { currentContainer } from '@orieljs/container'\nimport { rebuild } from './context'\nimport { InertiaError } from './errors'\n\n/** The requests a HandlePrecognitiveRequests middleware is answering precognitively. */\nconst precognitive = new WeakSet<HttpRequest>()\n\n/** Laravel's $request->isPrecognitive(): this request only asks whether its data would pass (a `precognitive` route). */\nexport function isPrecognitive(request: HttpRequest): boolean {\n return precognitive.has(request)\n}\n\n/** What passing validation throws in a precognitive request: Laravel's abort(204, ['Precognition-Success' => 'true']). */\nclass PrecognitionPassed extends Error implements OrielError {\n readonly kind = 'Http' as const\n readonly status = 204\n override readonly name = 'PrecognitionPassed'\n\n constructor() {\n super('The precognitive request passed validation.')\n }\n\n toResponse(): Response {\n return new Response(null, { status: 204, headers: { 'Precognition-Success': 'true' } })\n }\n}\n\n/** A validator whose passing stops the action: the precognitive request has its answer. */\nclass PrecognitiveValidator implements Validator {\n constructor(\n private readonly validator: Validator,\n private readonly reached: () => void,\n ) {}\n\n async passes(): Promise<boolean> {\n this.reached()\n if (await this.validator.passes()) throw new PrecognitionPassed()\n return false\n }\n\n async fails(): Promise<boolean> {\n return !(await this.passes())\n }\n\n async validated<T = Record<string, unknown>>(): Promise<T> {\n this.reached()\n await this.validator.validated<T>()\n throw new PrecognitionPassed()\n }\n\n errors() {\n return this.validator.errors()\n }\n\n fail(field: string, message: string): void {\n this.validator.fail(field, message)\n }\n\n after(callback: (validator: Validator) => void | Promise<void>): this {\n this.validator.after(callback)\n return this\n }\n}\n\n/** The ValidationFactory of a precognitive request: Precognition-Validate-Only's fields only, and validators that stop. */\nclass PrecognitiveValidationFactory implements ValidationFactory {\n reached = false\n\n constructor(\n private readonly factory: ValidationFactory,\n private readonly only: readonly string[] | undefined,\n ) {}\n\n make(data: Record<string, unknown>, rules: Rules, messages?: Record<string, string>, attributes?: Record<string, string>): Validator {\n // Laravel 12's filterPrecognitiveRules(): the rules of the named attributes, as written.\n const only = this.only\n const filtered = only === undefined ? rules : Object.fromEntries(Object.entries(rules).filter(([attribute]) => only.includes(attribute)))\n return new PrecognitiveValidator(this.factory.make(data, filtered, messages, attributes), () => {\n this.reached = true\n })\n }\n\n extend(name: string, callback: RuleCallback, message?: string): void {\n this.factory.extend(name, callback, message)\n }\n}\n\n/** `Vary` with `name` added to what it already lists. */\nfunction vary(response: Response, name: string): Response {\n const current = (response.headers.get('Vary') ?? '').split(',').map((value) => value.trim()).filter((value) => value !== '')\n return current.includes(name) ? response : rebuild(response, { headers: { Vary: [...current, name].join(', ') } })\n}\n\n/**\n * A thrown error as the response the request scope's ExceptionHandler renders, reported first: Laravel's\n * Routing\\Pipeline::handleException, which renders it before the middleware adds its headers. Without a handler it is\n * rethrown.\n */\nasync function render(scope: Container | undefined, request: HttpRequest, error: unknown): Promise<Response> {\n if (scope === undefined || !scope.bound(ExceptionHandler)) throw error\n const handler = scope.make(ExceptionHandler)\n await handler.report(error)\n return handler.render(request, error)\n}\n\n/**\n * Laravel's HandlePrecognitiveRequests (the `precognitive` alias): a request with `Precognition: true` (Inertia's\n * `useForm().validate()`, `<Form validate>`, laravel-precognition) runs the route's action only up to its validation.\n * Passing answers 204 with `Precognition-Success: true`; failing, the usual 422 with the errors; and nothing after the\n * validation runs. `Precognition-Validate-Only: name,email` checks those fields only. Every response varies on\n * `Precognition`, an error's too: the middleware renders what is thrown through it before adding its headers.\n *\n * Oriel validates inside the action (`await StoreUserRequest.validate()`, `request().validate({…})`), where Laravel\n * resolves the FormRequest before calling it, so a precognitive route must validate before it changes anything: what\n * comes before the validation runs. An action that answers a success without validating is an error (a 500) on any\n * method but GET and HEAD, which answer 204 as Laravel does; a redirect or an error goes through as it is.\n */\nexport class HandlePrecognitiveRequests implements Middleware {\n async handle(request: HttpRequest, next: Next): Promise<Response> {\n const scope = currentContainer()\n if (request.header('Precognition') !== 'true') {\n return vary(await next(request).catch((error: unknown) => render(scope, request, error)), 'Precognition')\n }\n if (scope === undefined) throw new InertiaError('A precognitive request needs its request scope.')\n const header = request.header('Precognition-Validate-Only')\n const only = header === undefined ? undefined : header.split(',').map((field) => field.trim()).filter((field) => field !== '')\n const factory = new PrecognitiveValidationFactory(scope.make(ValidationFactory), only)\n scope.instance(ValidationFactory, factory)\n precognitive.add(request)\n let response: Response\n try {\n response = await next(request)\n // A redirect (a middleware's, as `guest` sends) or an error goes through: only a success must have validated.\n if (!factory.reached && response.status < 300) {\n if (!['GET', 'HEAD'].includes(request.method())) {\n throw new InertiaError(\n `The precognitive ${request.method()} /${request.path().replace(/^\\/+/, '')} request reached the end of its action without validating: a precognitive route must validate (a FormRequest or request().validate()) before it changes anything.`,\n )\n }\n response = new PrecognitionPassed().toResponse()\n }\n } catch (error) {\n response = await render(scope, request, error)\n }\n return vary(rebuild(response, { headers: { Precognition: 'true' } }), 'Precognition')\n }\n}\n","import { ConsoleKernel, InertiaFactory, InertiaSsrGateway, Router } from '@orieljs/contracts'\nimport { ServiceProvider } from '@orieljs/support'\nimport { DEFAULT_EXCEPT_ROUTES, registerInertiaCommands } from './commands'\nimport { EncryptHistory } from './EncryptHistory'\nimport { HandlePrecognitiveRequests } from './HandlePrecognitiveRequests'\nimport { ResponseFactory } from './ResponseFactory'\nimport { HttpGateway } from './ssr/HttpGateway'\n\n/**\n * Binds the Inertia factory (one root factory, plus a scoped child per request), the SSR gateway and the\n * `inertia.encrypt` and `precognitive` middleware aliases, merges config/inertia defaults and registers the inertia:*\n * commands.\n */\nexport class InertiaServiceProvider extends ServiceProvider {\n override register(): void {\n // inertia-laravel's config/inertia.php (env() lives in the app's config file, not here).\n this.mergeConfigFrom(\n {\n ssr: {\n enabled: true,\n runtime: 'node',\n url: 'http://127.0.0.1:13714',\n hot_url: null,\n timeout: null,\n ensure_bundle_exists: true,\n bundle: null,\n throw_on_error: false,\n },\n pages: {\n ensure_pages_exist: false,\n paths: [this.app.resourcePath('js/pages')],\n extensions: ['js', 'jsx', 'svelte', 'ts', 'tsx', 'vue', 'component.ts'],\n },\n testing: { ensure_pages_exist: true },\n expose_shared_prop_keys: true,\n store_previous_url: false,\n history: { encrypt: false },\n // live.* (Live's update endpoint) stays out of the browser's route table; the server's route names keep it.\n types: { pages: 'resources/js/oriel/pages.d.ts', routes: 'resources/js/oriel/routes.ts', server_routes: 'types/routes.d.ts', except_routes: [...DEFAULT_EXCEPT_ROUTES] },\n },\n 'inertia',\n )\n this.app.singleton(ResponseFactory, () => new ResponseFactory(this.app))\n this.app.scoped(InertiaFactory, (container) => container.make(ResponseFactory).forRequest())\n this.app.singleton(HttpGateway, () => new HttpGateway(this.app))\n this.app.singleton(InertiaSsrGateway, (container) => container.make(HttpGateway))\n }\n\n override boot(): void {\n if (this.app.bound(Router)) this.app.make(Router).aliasMiddleware('inertia.encrypt', EncryptHistory).aliasMiddleware('precognitive', HandlePrecognitiveRequests)\n if (this.app.bound(ConsoleKernel)) registerInertiaCommands(this.app.make(ConsoleKernel), this.app, this.app.make(HttpGateway))\n }\n}\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\nimport { mkdir, writeFile } from 'node:fs/promises'\nimport { dirname, isAbsolute, join, relative } from 'node:path'\nimport { ConfigRepository, Router, type Application, type CommandContext, type ConsoleKernel } from '@orieljs/contracts'\nimport { renderRoutesModule, renderServerRouteTypes, routeTable } from './routes'\nimport type { HttpGateway } from './ssr/HttpGateway'\n\n/** app/Http/Middleware/HandleInertiaRequests.ts, written by inertia:middleware. */\nexport const MIDDLEWARE_STUB = `import { InertiaMiddleware } from '@orieljs/framework'\nimport type { HttpRequest } from '@orieljs/framework/contracts'\n\nexport class {{ class }} extends InertiaMiddleware {\n /** The root view loaded on the first page visit: resources/views/app.tsx. */\n protected override rootViewName = 'app'\n\n /** Props shared with every page (typed for the pages by \\`oriel inertia:types\\`). */\n override async share(request: HttpRequest) {\n return {\n ...(await super.share(request)),\n }\n }\n}\n`\n\n/** Route names left out of the browser's route table unless config/inertia sets types.except_routes. */\nexport const DEFAULT_EXCEPT_ROUTES = ['live.*']\n\n/** The page-type generator lives in @orieljs/vite (it needs the TypeScript compiler, a dev dependency). */\nexport interface PageTypesModule {\n generatePageTypes(options: { root: string; output: string; tsconfig?: string }): Promise<{ output: string; pages: number; warnings: string[] }>\n}\n\n/** Loaded at run time so the framework doesn't depend on @orieljs/vite; the specifier is a variable on purpose. */\nasync function loadPageTypes(): Promise<PageTypesModule | undefined> {\n const specifier = '@orieljs/vite/types'\n try {\n return (await import(/* @vite-ignore */ specifier)) as PageTypesModule\n } catch {\n return undefined\n }\n}\n\nexport interface InertiaCommandOptions {\n /** Replaces the dynamic import of @orieljs/vite/types (tests). */\n pageTypes?: () => Promise<PageTypesModule | undefined>\n /** Replaces child_process.spawn for inertia:start-ssr (tests). */\n spawn?: typeof spawn\n}\n\n/** route:types, inertia:types, inertia:middleware, inertia:start-ssr, inertia:stop-ssr and inertia:check-ssr. */\nexport function registerInertiaCommands(kernel: ConsoleKernel, app: Application, gateway: HttpGateway, options: InertiaCommandOptions = {}): void {\n const config = <T>(key: string, fallback: T): T => (app.bound(ConfigRepository) ? app.make(ConfigRepository).get<T>(key, fallback) : fallback)\n const absolute = (path: string) => (isAbsolute(path) ? path : app.basePath(path))\n\n kernel\n .command(\n 'route:types {--output= : Where to write the route module} {--server= : Where to write the server route name types}',\n async function (this: CommandContext) {\n if (!app.bound(Router)) {\n this.error('The router is not available. Is the Routing service provider registered?')\n return 1\n }\n const output = absolute(optionText(this.option('output')) ?? config('inertia.types.routes', 'resources/js/oriel/routes.ts'))\n const server = absolute(optionText(this.option('server')) ?? config('inertia.types.server_routes', 'types/routes.d.ts'))\n const table = routeTable(app.make(Router).getRoutes(), config<string[]>('inertia.types.except_routes', DEFAULT_EXCEPT_ROUTES))\n await mkdir(dirname(output), { recursive: true })\n await writeFile(output, renderRoutesModule(table))\n await mkdir(dirname(server), { recursive: true })\n await writeFile(server, renderServerRouteTypes(routeTable(app.make(Router).getRoutes())))\n this.info(`Route types for ${Object.keys(table).length} named routes written to ${relative(app.basePath(), output)}.`)\n return 0\n },\n )\n .purpose('Generate the route table and route name types for the frontend')\n\n kernel\n .command('inertia:types {--output= : Where to write the page types}', async function (this: CommandContext) {\n const module = await (options.pageTypes ?? loadPageTypes)()\n if (module === undefined) {\n this.error('Generating page types needs @orieljs/vite: install it as a dev dependency.')\n return 1\n }\n const output = absolute(optionText(this.option('output')) ?? config('inertia.types.pages', 'resources/js/oriel/pages.d.ts'))\n const result = await module.generatePageTypes({ root: app.basePath(), output })\n for (const warning of result.warnings) this.warn(warning)\n this.info(`Page types for ${result.pages} pages written to ${relative(app.basePath(), result.output)}.`)\n return 0\n })\n .purpose('Generate TypeScript types for the Inertia page props')\n\n kernel\n .command('inertia:middleware {name=HandleInertiaRequests : The middleware class name} {--force : Overwrite an existing file}', async function (this: CommandContext) {\n const name = String(this.argument('name') ?? 'HandleInertiaRequests')\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {\n this.error(`Middleware name [${name}] is not a valid class name.`)\n return 1\n }\n const file = app.appPath(join('Http', 'Middleware', `${name}.ts`))\n if (existsSync(file) && this.option('force') !== true) {\n this.error(`Middleware [${relative(app.basePath(), file)}] already exists.`)\n return 1\n }\n await mkdir(dirname(file), { recursive: true })\n await writeFile(file, MIDDLEWARE_STUB.replace('{{ class }}', () => name))\n this.info(`Middleware [${relative(app.basePath(), file)}] created successfully.`)\n return 0\n })\n .purpose('Create a new Inertia middleware')\n\n kernel\n .command('inertia:start-ssr {--runtime= : The runtime that runs the SSR bundle (node or bun)}', async function (this: CommandContext) {\n if (!config('inertia.ssr.enabled', true)) {\n this.error('Inertia SSR is not enabled. Enable it via the `inertia.ssr.enabled` config option.')\n return 1\n }\n const bundle = gateway.bundle()\n if (bundle === undefined) {\n this.error('Inertia SSR bundle not found. Build it with `vite build --ssr`, or set `inertia.ssr.bundle`.')\n return 1\n }\n const port = urlPort(gateway.productionUrl())\n if (port === undefined) {\n this.error(`inertia.ssr.url [${gateway.productionUrl()}] is not a URL.`)\n return 1\n }\n const runtime = optionText(this.option('runtime')) ?? config('inertia.ssr.runtime', 'node')\n // The bundle's server listens on INERTIA_SSR_PORT (the SSR entry @orieljs/vite generates reads it).\n const child = (options.spawn ?? spawn)(runtime, [bundle], { stdio: 'inherit', env: { ...process.env, INERTIA_SSR_PORT: port } })\n return await new Promise<number>((resolve) => {\n child.on('exit', (code) => resolve(code ?? 0))\n child.on('error', (error) => {\n this.error(`Could not start the SSR server: ${error.message}`)\n resolve(1)\n })\n })\n })\n .purpose('Start the Inertia SSR server')\n\n kernel\n .command('inertia:stop-ssr', async function (this: CommandContext) {\n try {\n await fetch(`${gateway.productionUrl()}/shutdown`)\n } catch {\n // The server exits before it answers: a failed request is the expected outcome.\n }\n this.info('Inertia SSR server stopped.')\n return 0\n })\n .purpose('Stop the Inertia SSR server')\n\n kernel\n .command('inertia:check-ssr', async function (this: CommandContext) {\n if (await gateway.isHealthy()) {\n this.info('Inertia SSR server is running.')\n return 0\n }\n this.error('Inertia SSR server is not running.')\n return 1\n })\n .purpose('Check the Inertia SSR server health status')\n}\n\n/** The port a URL points at (its scheme's default when it has none), or undefined when it isn't an http(s) URL. */\nfunction urlPort(url: string): string | undefined {\n try {\n const parsed = new URL(url)\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return undefined\n return parsed.port !== '' ? parsed.port : parsed.protocol === 'https:' ? '443' : '80'\n } catch {\n return undefined\n }\n}\n\n/** An option value as text, or undefined when absent/empty/false. */\nfunction optionText(value: unknown): string | undefined {\n return value === undefined || value === null || value === false || value === '' ? undefined : String(value)\n}\n","import type { Route } from '@orieljs/contracts'\nimport { Str } from '@orieljs/support'\n\n/** One named route as the client's route() needs it. */\nexport interface RouteTableEntry {\n uri: string\n methods: string[]\n}\n\nexport interface RouteParameterInfo {\n name: string\n optional: boolean\n /** The binding column from '{post:slug}'. */\n field: string | undefined\n}\n\nconst PARAMETER = /\\{([A-Za-z_][A-Za-z0-9_]*)(?::([A-Za-z_][A-Za-z0-9_]*))?(\\?)?\\}/g\n\n/** '{post}', '{post?}', '{post:slug}' in URI order. */\nexport function routeParameters(uri: string): RouteParameterInfo[] {\n return [...uri.matchAll(PARAMETER)].map((match) => ({ name: match[1]!, optional: match[3] === '?', field: match[2] }))\n}\n\n/** Every named route, sorted by name, minus the names matching `except` (wildcards allowed: 'admin.*'). */\nexport function routeTable(routes: readonly Route[], except: string[] = []): Record<string, RouteTableEntry> {\n const table: Record<string, RouteTableEntry> = {}\n const named = routes\n .map((route) => ({ route, name: route.getName() }))\n .filter((entry): entry is { route: Route; name: string } => entry.name !== undefined && entry.name !== '')\n .filter(({ name }) => !except.some((pattern) => Str.is(pattern, name)))\n .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0))\n for (const { route, name } of named) table[name] = { uri: route.uri, methods: [...route.methods] }\n return table\n}\n\n/** Backslashes, quotes and line terminators, which would end or break a single-quoted literal (\\u0027 is the quote: a bare one in the pattern trips import scanners). */\nconst ESCAPES: Record<string, string> = { '\\\\': '\\\\\\\\', \"'\": \"\\\\'\", '\\n': '\\\\n', '\\r': '\\\\r', '\\u2028': '\\\\u2028', '\\u2029': '\\\\u2029' }\nconst quote = (value: string): string => `'${value.replace(/[\\\\\\u0027\\n\\r\\u2028\\u2029]/g, (char) => ESCAPES[char]!)}'`\n\n/** The parameter object type of one route: `{ post: RouteParameter; comment?: RouteParameter }`. */\nfunction parameterType(uri: string): string {\n const parameters = routeParameters(uri)\n if (parameters.length === 0) return 'Record<never, never>'\n return `{ ${parameters.map(({ name, optional }) => `${name}${optional ? '?' : ''}: RouteParameter`).join('; ')} }`\n}\n\n/**\n * resources/js/oriel/routes.ts: the route table the browser's route() reads, and the RouteList augmentation that\n * types route names and parameters.\n */\nexport function renderRoutesModule(table: Record<string, RouteTableEntry>, clientModule = '@orieljs/inertia-client'): string {\n const names = Object.keys(table)\n const entries = names.map((name) => {\n const { uri, methods } = table[name]!\n return ` ${quote(name)}: { uri: ${quote(uri)}, methods: [${methods.map(quote).join(', ')}] },`\n })\n const types = names.map((name) => ` ${quote(name)}: ${parameterType(table[name]!.uri)}`)\n return [\n '// Generated by `oriel route:types`. Do not edit: run `oriel route:types` again.',\n // Built by concatenation so tools that scan source for imports don't mistake this template for one.\n 'import { defineRoutes, type RouteParameter } from ' + `${quote(clientModule)}`,\n '',\n `export const routes = defineRoutes({${entries.length === 0 ? '' : `\\n${entries.join('\\n')}\\n`}})`,\n '',\n 'declare module ' + `${quote(clientModule)} {`,\n ' interface RouteList {',\n ...types,\n ' }',\n '}',\n '',\n ].join('\\n')\n}\n\n/**\n * types/routes.d.ts: the route names for the server's route(), redirect().route() and UrlGenerator. The bundled\n * @orieljs/framework declares RouteList in both entry points, so both are augmented.\n */\nexport function renderServerRouteTypes(table: Record<string, RouteTableEntry>): string {\n const members = Object.keys(table).map((name) => ` ${quote(name)}: ${parameterType(table[name]!.uri).replace(/RouteParameter/g, 'unknown')}`)\n const block = (module: string) => ['declare module ' + `${quote(module)} {`, ' interface RouteList {', ...members, ' }', '}']\n return [\n '// Generated by `oriel route:types`. Do not edit: run `oriel route:types` again.',\n '',\n ...block('@orieljs/framework'),\n '',\n ...block('@orieljs/framework/contracts'),\n '',\n 'export {}',\n '',\n ].join('\\n')\n}\n","import { existsSync, readFileSync } from 'node:fs'\nimport {\n ConfigRepository,\n EventDispatcher,\n type Application,\n type HttpRequest,\n type InertiaPage,\n type InertiaSsrGateway,\n type InertiaSsrResponse,\n} from '@orieljs/contracts'\nimport { Str } from '@orieljs/support'\nimport { currentRequest, requestScope } from '../context'\nimport { SsrError } from '../errors'\nimport { isExcludedFromSsr } from './requests'\n\n/** Why an SSR render failed (inertia-laravel's SsrRenderFailed event payload). */\nexport interface SsrFailure {\n page: InertiaPage\n error: string\n type: string\n hint?: string\n browserApi?: string\n stack?: string\n sourceLocation?: string\n}\n\n/** The event name dispatched through the EventDispatcher when an SSR render fails. */\nexport const SSR_RENDER_FAILED = 'inertia.ssr.failed'\n\n/**\n * inertia-laravel's HttpGateway. Production: POST the page to {inertia.ssr.url}/render. While Vite runs hot\n * (public/hot exists): POST to {hot url}/__inertia_ssr, which @inertiajs/vite serves. Any failure falls back to\n * client-side rendering (undefined), unless inertia.ssr.throw_on_error is on.\n */\nexport class HttpGateway implements InertiaSsrGateway {\n #disabled: boolean | (() => boolean) | undefined\n readonly #except: string[] = []\n\n constructor(protected readonly app: Application) {}\n\n disable(condition: boolean | (() => boolean) = true): void {\n this.#disabled = condition\n }\n\n /** Paths (wildcards allowed) never rendered on the server. */\n except(paths: string | string[]): void {\n this.#except.push(...[paths].flat())\n }\n\n async dispatch(page: InertiaPage): Promise<InertiaSsrResponse | undefined> {\n if (!this.enabled(currentRequest())) return undefined\n const hot = this.hotUrl()\n if (hot === undefined && this.#config('inertia.ssr.ensure_bundle_exists', true) && this.bundle() === undefined) return undefined\n const url = hot === undefined ? `${this.productionUrl()}/render` : `${hot}/__inertia_ssr`\n try {\n const response = await fetch(url, {\n method: 'POST',\n headers: { 'content-type': 'application/json', accept: 'application/json' },\n body: JSON.stringify(page),\n signal: this.#signal(),\n })\n const data = (await response.json().catch(() => null)) as Partial<{ head: string[]; body: string }> & Record<string, unknown> | null\n if (!response.ok) {\n await this.#failed({ page, error: String(data?.error ?? `SSR server responded with ${response.status}`), type: String(data?.type ?? 'render'), ...details(data) })\n return undefined\n }\n if (data === null) return undefined\n return { head: (data.head ?? []).join('\\n'), body: data.body ?? '' }\n } catch (error) {\n if (error instanceof SsrError) throw error\n await this.#failed({ page, error: error instanceof Error ? error.message : String(error), type: 'connection' })\n return undefined\n }\n }\n\n /** GET {inertia.ssr.url}/health: any 2xx is healthy. */\n async isHealthy(): Promise<boolean> {\n try {\n return (await fetch(`${this.productionUrl()}/health`, { signal: this.#signal() })).ok\n } catch {\n return false\n }\n }\n\n productionUrl(): string {\n return this.#config('inertia.ssr.url', 'http://127.0.0.1:13714').replace(/\\/+$/, '')\n }\n\n /** inertia.ssr.hot_url, else the Vite dev server URL in public/hot; undefined when Vite isn't running. */\n hotUrl(): string | undefined {\n const hotFile = this.app.publicPath('hot')\n if (!existsSync(hotFile)) return undefined\n const configured = this.#config<string | null>('inertia.ssr.hot_url', null)\n const url = configured !== null && configured !== '' ? configured : readFileSync(hotFile, 'utf8')\n return url.trim().replace(/\\/+$/, '')\n }\n\n /** inertia.ssr.bundle, else bootstrap/ssr/{ssr,app}.{js,mjs}, else public/js/{ssr,app}.js (BundleDetector). */\n bundle(): string | undefined {\n const configured = this.#config<string | null>('inertia.ssr.bundle', null)\n const candidates = [\n configured,\n this.app.basePath('bootstrap/ssr/ssr.js'),\n this.app.basePath('bootstrap/ssr/app.js'),\n this.app.basePath('bootstrap/ssr/ssr.mjs'),\n this.app.basePath('bootstrap/ssr/app.mjs'),\n this.app.publicPath('js/ssr.js'),\n this.app.publicPath('js/app.js'),\n ]\n return candidates.find((path): path is string => typeof path === 'string' && path !== '' && existsSync(path))\n }\n\n enabled(request: HttpRequest | undefined): boolean {\n const disabled = this.#disabled\n const enabled = disabled !== undefined ? !(typeof disabled === 'function' ? disabled() : disabled) : this.#config('inertia.ssr.enabled', true)\n if (!enabled) return false\n if (request === undefined) return true\n if (isExcludedFromSsr(request)) return false\n return !this.#except.some((pattern) => {\n const trimmed = pattern === '/' ? pattern : pattern.replace(/^\\/+|\\/+$/g, '')\n return Str.is(trimmed, request.fullUrl()) || request.is(trimmed)\n })\n }\n\n async #failed(failure: SsrFailure): Promise<void> {\n const scope = requestScope() ?? this.app\n if (scope.bound(EventDispatcher)) await scope.make(EventDispatcher).dispatch(SSR_RENDER_FAILED, [failure])\n if (this.#config('inertia.ssr.throw_on_error', false)) throw new SsrError(`SSR render failed: ${failure.error}`)\n }\n\n #signal(): AbortSignal | undefined {\n const seconds = this.#config<number | null>('inertia.ssr.timeout', null)\n return typeof seconds === 'number' && seconds > 0 ? AbortSignal.timeout(seconds * 1000) : undefined\n }\n\n #config<T>(key: string, fallback: T): T {\n return this.app.bound(ConfigRepository) ? this.app.make(ConfigRepository).get<T>(key, fallback) : fallback\n }\n}\n\nfunction details(data: Record<string, unknown> | null): Partial<SsrFailure> {\n const text = (key: string) => (typeof data?.[key] === 'string' ? (data[key] as string) : undefined)\n return { hint: text('hint'), browserApi: text('browserApi'), stack: text('stack'), sourceLocation: text('sourceLocation') }\n}\n"],"mappings":";AACO,IAAM,SAAS;AAAA,EACpB,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,8BAA8B;AAAA,EAC9B,mBAAmB;AACrB;AAGO,SAAS,UAAU,OAAiD;AACzE,QAAM,SAAS,SAAS,IAAI,MAAM,GAAG,EAAE,OAAO,CAAC,SAAS,SAAS,EAAE;AACnE,SAAO,MAAM,WAAW,IAAI,SAAY;AAC1C;;;ACQO,IAAe,OAAf,MAAiC;AAAA,EAWtC,YAA+B,OAAqB;AAArB;AAAA,EAAsB;AAAA,EAAtB;AAAA,EALZ,aAAyB,EAAE,OAAO,OAAO,MAAM,OAAO,QAAQ,MAAM,aAAa,CAAC,GAAG,cAAc,CAAC,GAAG,SAAS,CAAC,EAAE;AAAA,EACnH,YAAuB,EAAE,MAAM,OAAO,OAAO,OAAO,KAAK,QAAW,YAAY,OAAU;AAAA,EACnG,WAAW;AAAA,EACX;AAAA;AAAA,EAKV,MAAM,UAA4B;AAChC,WAAO,OAAO,KAAK,UAAU,aAAa,MAAO,KAAK,MAA0B,IAAI,KAAK;AAAA,EAC3F;AAAA;AAAA,EAGA,mBAA4B;AAC1B,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,WAAoB;AAClB,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,eAAwB;AACtB,WAAO;AAAA,EACT;AAAA;AAAA;AAAA,EAKA,KAAK,QAAQ,MAAM,UAAkD,CAAC,GAAS;AAC7E,SAAK,UAAU,OAAO;AACtB,QAAI,QAAQ,OAAO,OAAW,MAAK,UAAU,MAAM,QAAQ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c,UAAU,KAAK,eAAe,EAAE,WAAW,CAAC;AAC3F,SAAK,IAAI,UAAU,aAAa,MAAM,IAAI,YAAY,KAAK,GAAG,CAAC;AAC/D,SAAK,IAAI,UAAUC,oBAAmB,CAAC,cAAc,UAAU,KAAK,WAAW,CAAC;AAAA,EAClF;AAAA,EAES,OAAa;AACpB,QAAI,KAAK,IAAI,MAAMC,OAAM,EAAG,MAAK,IAAI,KAAKA,OAAM,EAAE,gBAAgB,mBAAmB,cAAc,EAAE,gBAAgB,gBAAgB,0BAA0B;AAC/J,QAAI,KAAK,IAAI,MAAM,aAAa,EAAG,yBAAwB,KAAK,IAAI,KAAK,aAAa,GAAG,KAAK,KAAK,KAAK,IAAI,KAAK,WAAW,CAAC;AAAA,EAC/H;AACF;","names":["inertia","Response","ConfigRepository","Arr","Arr","ConfigRepository","Response","HttpRequest","currentContainer","currentContainer","HttpRequest","currentContainer","existsSync","Application","ConfigRepository","InertiaFactory","Redirector","ConfigRepository","Application","existsSync","inertia","InertiaFactory","vary","Redirector","Container","InertiaFactory","inject","ExceptionHandler","currentContainer","ExceptionHandler","currentContainer","InertiaFactory","InertiaSsrGateway","Router","existsSync","join","relative","ConfigRepository","Str","ConfigRepository","relative","join","existsSync","existsSync","readFileSync","ConfigRepository","Str","existsSync","readFileSync","Str","ConfigRepository","InertiaFactory","InertiaSsrGateway","Router"]}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@orieljs/inertia",
3
+ "version": "0.1.0-alpha.10",
4
+ "description": "The Oriel Inertia component.",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "homepage": "https://orieljs.vercel.app",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/orieljs/framework.git",
12
+ "directory": "src/Oriel/Inertia"
13
+ },
14
+ "engines": {
15
+ "node": ">=22"
16
+ },
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ }
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "LICENSE",
30
+ "NOTICE",
31
+ "TRADEMARKS.md"
32
+ ],
33
+ "dependencies": {
34
+ "@orieljs/contracts": "0.1.0-alpha.10",
35
+ "@orieljs/container": "0.1.0-alpha.10",
36
+ "@orieljs/support": "0.1.0-alpha.10"
37
+ },
38
+ "scripts": {
39
+ "build": "tsup && node ../../../scripts/copy-license.mjs"
40
+ }
41
+ }