@askrjs/askr 0.0.87 → 0.0.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/actions/index.d.ts +1 -1
  2. package/dist/actions/index.js +1 -1
  3. package/dist/{activity-DNYL__cW.d.ts → activity-CF2_JvJs.d.ts} +1 -1
  4. package/dist/{activity-BnkhdIXm.js → activity-CQKEAORw.js} +5 -3
  5. package/dist/benchmark.d.ts +1 -1
  6. package/dist/benchmark.js +6 -6
  7. package/dist/boot/index.d.ts +6 -4
  8. package/dist/boot/index.js +1 -1
  9. package/dist/{boot-Bd-j_BL5.js → boot-CrbszDjZ.js} +26 -15
  10. package/dist/{component-internal-uVCJAre6.js → component-internal-C4uwwUaK.js} +31 -2
  11. package/dist/components/index.d.ts +2 -2
  12. package/dist/control/index.d.ts +1 -1
  13. package/dist/control/index.js +1 -1
  14. package/dist/{control-BF3geQKh.js → control-CON10J1p.js} +1 -1
  15. package/dist/{control-BjYBlytA.d.ts → control-CsGs2bLS.d.ts} +1 -1
  16. package/dist/{control-DhUZU4_V.d.ts → control-D-FIa-n-.d.ts} +3 -1
  17. package/dist/{csp-nonce-CUscoNF1.js → csp-nonce-DH0TrDij.js} +1 -1
  18. package/dist/data/index.d.ts +3 -2
  19. package/dist/data/index.js +3 -3
  20. package/dist/{data-CXZ-FOa7.js → data-BmZC1kDn.js} +27 -9
  21. package/dist/{data-runtime-CnVeSvJz.js → data-runtime-SC6zzAwh.js} +10 -5
  22. package/dist/{deferred-_DaSfpsr.js → deferred-Bh-nZhZF.js} +5 -4
  23. package/dist/{for-internal-Dxf3iZ9E.js → for-internal-Bsm0B8GZ.js} +9 -5
  24. package/dist/foundations/icon/index.d.ts +2 -2
  25. package/dist/foundations/icon/index.js +3 -2
  26. package/dist/foundations/index.d.ts +2 -2
  27. package/dist/foundations/index.js +1 -1
  28. package/dist/foundations/interactions/index.js +1 -1
  29. package/dist/foundations/state/index.d.ts +1 -1
  30. package/dist/foundations/structures/index.d.ts +2 -2
  31. package/dist/foundations/structures/index.js +1 -1
  32. package/dist/{index-r-nt13FE.d.ts → index-BU17hud9.d.ts} +2 -2
  33. package/dist/index-CPlPDbEY.d.ts +64 -0
  34. package/dist/{index-DflhL1h8.d.ts → index-Cf2ANwPL.d.ts} +3 -3
  35. package/dist/{index-BvNkcegT.d.ts → index-Izwp_ESC.d.ts} +20 -5
  36. package/dist/index.d.ts +8 -7
  37. package/dist/index.js +8 -8
  38. package/dist/{interactions-DgGQyUQv.js → interactions-CWkNEq_C.js} +2 -1
  39. package/dist/{jsx-Dvr2SGRG.d.ts → jsx-BYXe_Nnk.d.ts} +18 -0
  40. package/dist/jsx-dev-runtime.d.ts +3 -3
  41. package/dist/jsx-runtime-BqhMEuT4.d.ts +2 -0
  42. package/dist/{jsx-runtime-Cr1jspx9.d.ts → jsx-runtime-LHh5tcTe.d.ts} +3 -3
  43. package/dist/jsx-runtime.d.ts +2 -2
  44. package/dist/{lifecycle-operations-DTO93Hrl.js → lifecycle-operations-CMK1AN2C.js} +1 -1
  45. package/dist/{navigate-B_fcLDAG.d.ts → navigate-BO7M2iUG.d.ts} +1 -1
  46. package/dist/{navigate-DSATWfHh.js → navigate-DIOaNAcS.js} +5 -4
  47. package/dist/{query-registry-p_0kkieE.js → query-registry-IACQeDqi.js} +1 -1
  48. package/dist/{renderer-BGMaUrVj.js → renderer-y2DL627q.js} +47 -9
  49. package/dist/{resolution-BRmiFYvw.js → resolution-D3UO6aKA.js} +40 -4
  50. package/dist/{resource-operation-B94oj6xT.js → resource-operation-CYDU3XzS.js} +1 -1
  51. package/dist/resources/index.d.ts +2 -2
  52. package/dist/resources/index.js +4 -4
  53. package/dist/router/index.d.ts +28 -7
  54. package/dist/router/index.js +18 -17
  55. package/dist/{selector-Ck_Pp9av.js → selector-BLNkRZ2i.js} +2 -1
  56. package/dist/ssg/index.d.ts +2 -2
  57. package/dist/ssg/index.js +4 -4
  58. package/dist/ssr/index.d.ts +5 -4
  59. package/dist/ssr/index.js +1 -1
  60. package/dist/{ssr-q250YlKo.js → ssr-DXGtDJd7.js} +11 -9
  61. package/dist/{structures-DsOm-clq.js → structures--NKfTh3j.js} +2 -1
  62. package/dist/testing/index.d.ts +35 -4
  63. package/dist/testing/index.js +150 -3
  64. package/dist/{types-C9YcqVpk.d.ts → types-CsPtBGWb.d.ts} +1 -1
  65. package/dist/{index-SGxMZLAc.d.ts → types-iAmDSV6o.d.ts} +6 -63
  66. package/dist/{verify-hydration-DkISyZCo.js → verify-hydration-AdrYLDxd.js} +1 -1
  67. package/package.json +11 -10
  68. package/dist/jsx-runtime-C-oIHX9X.d.ts +0 -2
@@ -1,13 +1,13 @@
1
1
  import { n as createRouteRegistry } from "../manifest-D1P9uTlz.js";
2
- import { a as isSafeHref } from "../csp-nonce-CUscoNF1.js";
2
+ import { a as isSafeHref } from "../csp-nonce-DH0TrDij.js";
3
3
  import { jsx } from "../jsx-runtime.js";
4
4
  import { o as addRouteBasePath, y as getActiveRouteBasePath } from "../route-matching-DqULzZtC.js";
5
- import { a as group, c as route, i as fallback, n as resolveDeferredValues, o as index, r as routeData, s as page, t as Resolve } from "../deferred-_DaSfpsr.js";
6
- import { a as resolveRouteRequest, b as lazy, f as defer, g as Outlet, h as currentAuth, p as isDeferred } from "../resolution-BRmiFYvw.js";
7
- import { n as onRouteChange, t as currentRoute } from "../activity-BnkhdIXm.js";
8
- import { a as serializeRouteMeta, c as getCurrentHref, d as parseTargetUrl, h as syncRegisteredRouteSnapshot, i as resolveRouteMeta, l as getRegisteredAppsSnapshot, m as syncAppRegistrationLocation, n as navigate, p as setCurrentRouteLocation, r as reconcileRouteMeta, s as saveScrollPosition, u as getWindowHref } from "../navigate-DSATWfHh.js";
5
+ import { a as group, c as route, i as fallback, n as resolveDeferredValues, o as index, r as routeData, s as page, t as Resolve } from "../deferred-Bh-nZhZF.js";
6
+ import { S as RouteDataLoadError, a as resolveRouteRequest, b as lazy, f as defer, g as Outlet, h as currentAuth, p as isDeferred, x as lazyRouteData } from "../resolution-D3UO6aKA.js";
7
+ import { n as onRouteChange, t as currentRoute } from "../activity-CQKEAORw.js";
8
+ import { a as serializeRouteMeta, c as getCurrentHref, d as parseTargetUrl, h as syncRegisteredRouteSnapshot, i as resolveRouteMeta, l as getRegisteredAppsSnapshot, m as syncAppRegistrationLocation, n as navigate, p as setCurrentRouteLocation, r as reconcileRouteMeta, s as saveScrollPosition, u as getWindowHref } from "../navigate-DIOaNAcS.js";
9
9
  import { o as mergeProps } from "../compose-ref-Cc_YkUpM.js";
10
- import { t as applyInteractionPolicy } from "../interactions-DgGQyUQv.js";
10
+ import { t as applyInteractionPolicy } from "../interactions-CWkNEq_C.js";
11
11
  //#region src/router/route-query.ts
12
12
  function getRouteQueryHistoryMode(options) {
13
13
  if (options.history) return options.history;
@@ -192,19 +192,20 @@ function Link({ href: suppliedHref, to, class: className, children, rel, target,
192
192
  onPress?.(e);
193
193
  onClick?.(e);
194
194
  };
195
+ const props = mergeProps(interaction, {
196
+ ...rest,
197
+ onClick: consumerActivation,
198
+ href,
199
+ class: className,
200
+ rel,
201
+ target,
202
+ "aria-current": ariaCurrent,
203
+ "aria-label": ariaLabel
204
+ });
195
205
  return /* @__PURE__ */ jsx("a", {
196
- ...mergeProps(interaction, {
197
- ...rest,
198
- onClick: consumerActivation,
199
- href,
200
- class: className,
201
- rel,
202
- target,
203
- "aria-current": ariaCurrent,
204
- "aria-label": ariaLabel
205
- }),
206
+ ...props,
206
207
  children
207
208
  });
208
209
  }
209
210
  //#endregion
210
- export { Link, Outlet, Resolve, allow, createRouteRegistry, currentAuth, currentRoute, defer, deny, fallback, forbidden, group, index, isDeferred, lazy, navigate, notFound, onRouteChange, page, reconcileRouteMeta, redirect, resolveDeferredValues, resolveRouteMeta, resolveRouteRequest, route, routeData, serializeRouteMeta, to, unauthorized, updateRouteQuery };
211
+ export { Link, Outlet, Resolve, RouteDataLoadError, allow, createRouteRegistry, currentAuth, currentRoute, defer, deny, fallback, forbidden, group, index, isDeferred, lazy, lazyRouteData, navigate, notFound, onRouteChange, page, reconcileRouteMeta, redirect, resolveDeferredValues, resolveRouteMeta, resolveRouteRequest, route, routeData, serializeRouteMeta, to, unauthorized, updateRouteQuery };
@@ -226,7 +226,8 @@ function createSelectorHook(instance, generation, store, hookIndex, source, equa
226
226
  const record = selectorHook._record ?? ensureSelectorHookBinding(selectorHook);
227
227
  const lane = selectorHook._lane;
228
228
  if (!lane) throw new Error("selector() binding could not be established.");
229
- recordReadableRead(getCandidateSource(lane, candidate));
229
+ const sourceRef = getCandidateSource(lane, candidate);
230
+ recordReadableRead(sourceRef);
230
231
  const current = record._dirty || !record._hasValue ? recomputeSelectorSourceRecord(record, record._scheduled) : record._value;
231
232
  return lane._equals(current, candidate);
232
233
  };
@@ -1,5 +1,5 @@
1
- import { _ as SSRStyleRegistrationValidation, f as DocumentRenderArgs, m as DocumentRenderer, p as DocumentRenderContext } from "../control-DhUZU4_V.js";
2
- import { A as RouteHandler, I as RouteOptions, R as RoutePathParams, W as RouteRegistry, z as RoutePolicy } from "../index-BvNkcegT.js";
1
+ import { _ as SSRStyleRegistrationValidation, f as DocumentRenderArgs, m as DocumentRenderer, p as DocumentRenderContext } from "../control-D-FIa-n-.js";
2
+ import { A as RouteHandler, I as RouteOptions, R as RoutePathParams, W as RouteRegistry, z as RoutePolicy } from "../index-Izwp_ESC.js";
3
3
  import { AuthRequirement } from "@askrjs/auth";
4
4
  import "node:fs/promises";
5
5
  //#region src/ssg/types.d.ts
package/dist/ssg/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import "../access-Dpfoi4cA.js";
2
2
  import { n as createRouteRegistry } from "../manifest-D1P9uTlz.js";
3
3
  import { o as addRouteBasePath } from "../route-matching-DqULzZtC.js";
4
- import { c as route, n as resolveDeferredValues } from "../deferred-_DaSfpsr.js";
5
- import { c as prepareRouteHydrationData, t as bindResolvedRouteData, v as getRenderHandler, y as _preloadRouteHandler } from "../resolution-BRmiFYvw.js";
4
+ import { c as route, n as resolveDeferredValues } from "../deferred-Bh-nZhZF.js";
5
+ import { S as RouteDataLoadError, c as prepareRouteHydrationData, t as bindResolvedRouteData, v as getRenderHandler, y as _preloadRouteHandler } from "../resolution-D3UO6aKA.js";
6
6
  import { n as renderDocument } from "../ssr-DSHd_Q9K.js";
7
- import { n as renderToString } from "../ssr-q250YlKo.js";
7
+ import { n as renderToString } from "../ssr-DXGtDJd7.js";
8
8
  import * as fs from "node:fs/promises";
9
9
  import * as pathModule from "node:path";
10
10
  import * as os from "node:os";
@@ -255,7 +255,7 @@ async function batchRenderRoutes(routes, options = {}) {
255
255
  reason: "full",
256
256
  written: false,
257
257
  error: error instanceof Error ? error.message : String(error),
258
- errorCause: error,
258
+ errorCause: phase === "load" && error instanceof RouteDataLoadError ? error.cause : error,
259
259
  errorContext: {
260
260
  route: url,
261
261
  phase
@@ -1,7 +1,8 @@
1
- import { _ as SSRStyleRegistrationValidation, f as DocumentRenderArgs, g as SSRStyleRegistration, h as SSRData, m as DocumentRenderer, p as DocumentRenderContext } from "../control-DhUZU4_V.js";
2
- import { r as JSXElement, s as Props } from "../jsx-Dvr2SGRG.js";
3
- import { A as RouteHandler, C as Route, J as RouteRequestResult, V as RouteRecord, W as RouteRegistry, g as AccessRedirectDecision, l as DeferredBoundaryRegistration, m as AccessDenyDecision, u as SSRPortalState, w as RouteAuthOptions } from "../index-BvNkcegT.js";
4
- import { D as QueryPrefetchContext, _ as CoreTelemetry, n as ServerQueryRegistry, v as DataRuntime } from "../index-SGxMZLAc.js";
1
+ import { _ as SSRStyleRegistrationValidation, f as DocumentRenderArgs, g as SSRStyleRegistration, h as SSRData, m as DocumentRenderer, p as DocumentRenderContext } from "../control-D-FIa-n-.js";
2
+ import { r as JSXElement, s as Props } from "../jsx-BYXe_Nnk.js";
3
+ import { f as QueryPrefetchContext, t as DataRuntime } from "../types-iAmDSV6o.js";
4
+ import { A as RouteHandler, C as Route, J as RouteRequestResult, V as RouteRecord, W as RouteRegistry, g as AccessRedirectDecision, l as DeferredBoundaryRegistration, m as AccessDenyDecision, u as SSRPortalState, w as RouteAuthOptions } from "../index-Izwp_ESC.js";
5
+ import { _ as CoreTelemetry, n as ServerQueryRegistry } from "../index-CPlPDbEY.js";
5
6
  import { AuthContext } from "@askrjs/auth";
6
7
  //#region src/common/page-render-envelope.d.ts
7
8
  declare const PAGE_RENDER_ENVELOPE_VERSION: 1;
package/dist/ssr/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { x as SSRDataMissingError } from "../render-context-D0Hoj9dW.js";
2
- import { a as renderResolvedToStringSync, c as createRenderContext, d as withRenderContextAsync, i as renderRouteRequestToString, l as getRenderContext, n as renderToString, o as renderToStringSync, r as renderRouteRequest, s as resolveRequest, t as renderToStream, u as withRenderContext } from "../ssr-q250YlKo.js";
2
+ import { a as renderResolvedToStringSync, c as createRenderContext, d as withRenderContextAsync, i as renderRouteRequestToString, l as getRenderContext, n as renderToString, o as renderToStringSync, r as renderRouteRequest, s as resolveRequest, t as renderToStream, u as withRenderContext } from "../ssr-DXGtDJd7.js";
3
3
  export { SSRDataMissingError, createRenderContext, getRenderContext, renderResolvedToStringSync, renderRouteRequest, renderRouteRequestToString, renderToStream, renderToString, renderToStringSync, resolveRequest, withRenderContext, withRenderContextAsync };
@@ -3,18 +3,18 @@ import { t as __ERROR_BOUNDARY__ } from "./vnode-D24p6IW2.js";
3
3
  import { v as logger } from "./access-Dpfoi4cA.js";
4
4
  import { f as getCurrentComponentInstance, w as setCurrentComponentInstance } from "./component-scope-DzJEbYGE.js";
5
5
  import { i as isFragmentType, n as Fragment, t as ELEMENT_TYPE } from "./jsx-C3IECePB.js";
6
- import { f as getExecutionContextFrame, h as markVNodeTreeWithContextFrame, l as callWithContext, n as createComponentInstance, p as getVNodeContextFrame } from "./component-internal-uVCJAre6.js";
6
+ import { g as markVNodeTreeWithContextFrame, m as getVNodeContextFrame, n as createComponentInstance, p as getExecutionContextFrame, u as callWithContext } from "./component-internal-C4uwwUaK.js";
7
7
  import { t as cleanupComponent } from "./component-cleanup-BUfUleGZ.js";
8
8
  import { p as isPromiseLike } from "./lifecycle-batch-Dfpid9-A.js";
9
- import { _ as setControlBoundaryContextFrame, g as evaluateShowState, h as evaluateCaseState, i as evaluateForState, o as rollbackForStateTransaction, r as commitForStateTransaction } from "./for-internal-Dxf3iZ9E.js";
9
+ import { _ as setControlBoundaryContextFrame, g as evaluateShowState, h as evaluateCaseState, i as evaluateForState, o as rollbackForStateTransaction, r as commitForStateTransaction } from "./for-internal-Bsm0B8GZ.js";
10
10
  import { _ as isPageRenderEnvelope, f as stopRenderPhase$1, g as isEmptyPageRenderEnvelope, h as createPageRenderEnvelope, t as configureRenderContextProvider, u as startRenderPhase$1, x as SSRDataMissingError } from "./render-context-D0Hoj9dW.js";
11
11
  import { n as getPublicAttributeName, t as sanitizeCssValue } from "./css-BuPaTOfe.js";
12
- import { o as isUnsafeUrlAttribute, r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-CUscoNF1.js";
12
+ import { o as isUnsafeUrlAttribute, r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-DH0TrDij.js";
13
13
  import { n as SSR_PORTAL_HOST, t as SSR_PORTAL_ANCHOR } from "./portal-w3oQ6oQU.js";
14
- import { t as createDataRuntime } from "./data-runtime-CnVeSvJz.js";
15
- import { c as withTelemetry, i as dehydrateDataRuntime, t as createQueryPrefetchContext } from "./query-registry-p_0kkieE.js";
14
+ import { t as createDataRuntime } from "./data-runtime-SC6zzAwh.js";
15
+ import { c as withTelemetry, i as dehydrateDataRuntime, t as createQueryPrefetchContext } from "./query-registry-IACQeDqi.js";
16
16
  import { a as resolveRouteFromRoutes, c as removeRouteBasePath, s as normalizeRouteBasePath, t as _resolveRouteMatchFromRoutes } from "./route-matching-DqULzZtC.js";
17
- import { a as resolveRouteRequest, d as DEFERRED_BOUNDARY, l as validateRouteHydrationData, o as getRouteHydrationMetadata, p as isDeferred } from "./resolution-BRmiFYvw.js";
17
+ import { a as resolveRouteRequest, d as DEFERRED_BOUNDARY, l as validateRouteHydrationData, o as getRouteHydrationMetadata, p as isDeferred } from "./resolution-D3UO6aKA.js";
18
18
  import { n as disposeRegisteredDefaultPortalScope, r as getDefaultPortalHost } from "./default-portal-runtime-DvMvWJVp.js";
19
19
  import { n as renderDocument, t as SSR_RENDER_DATA_ATTR } from "./ssr-DSHd_Q9K.js";
20
20
  //#region src/ssr/escape.ts
@@ -309,7 +309,8 @@ function resolvePolicyAwareSSRRoute(opts, routeTable) {
309
309
  for (let redirects = 0; redirects <= MAX_SSR_REDIRECTS; redirects += 1) {
310
310
  const logicalHref = removeRouteBasePath(href, normalizeRouteBasePath(manifest.basePath));
311
311
  if (logicalHref === void 0) throw new Error(`SSR: no route found for url: ${href}`);
312
- const matched = _resolveRouteMatchFromRoutes(new URL(logicalHref, "http://localhost").pathname, routeTable);
312
+ const logicalUrl = new URL(logicalHref, "http://localhost");
313
+ const matched = _resolveRouteMatchFromRoutes(logicalUrl.pathname, routeTable);
313
314
  if (!matched) throw new Error(`SSR: no route found for url: ${href}`);
314
315
  const resolved = getRouteRequestResultSync(resolveRouteRequest(href, {
315
316
  registry: opts.registry,
@@ -350,7 +351,7 @@ var StringSink = class StringSink {
350
351
  this.bufferLen = 0;
351
352
  }
352
353
  static {
353
- this.FLUSH_THRESHOLD = 32 * 1024;
354
+ this.FLUSH_THRESHOLD = 32768;
354
355
  }
355
356
  write(html) {
356
357
  if (!html) return;
@@ -564,7 +565,8 @@ function executeComponentSync(component, props, ctx, ownerFrame = null) {
564
565
  });
565
566
  setCurrentComponentInstance(temp);
566
567
  try {
567
- const result = callWithContext(getExecutionContextFrame(ownerFrame), component, props || {}, { ssr: ctx });
568
+ const executionFrame = getExecutionContextFrame(ownerFrame);
569
+ const result = callWithContext(executionFrame, component, props || {}, { ssr: ctx });
568
570
  if (isPromiseLike(result)) throwSSRDataMissing();
569
571
  if (typeof result === "string" || typeof result === "number" || typeof result === "boolean" || result === null || result === void 0) {
570
572
  const inner = result === null || result === void 0 || result === false ? "" : String(result);
@@ -145,10 +145,11 @@ function writeSSRPortal(key, children) {
145
145
  function createSSRPortalAnchor() {
146
146
  const context = getActiveRenderContext();
147
147
  if (context?.mode !== "ssr") return null;
148
+ const token = createSSRPortalAnchorToken(context.ssrPortals.nextHostId++);
148
149
  return {
149
150
  $$typeof: ELEMENT_TYPE,
150
151
  type: SSR_PORTAL_ANCHOR,
151
- props: { token: createSSRPortalAnchorToken(context.ssrPortals.nextHostId++) }
152
+ props: { token }
152
153
  };
153
154
  }
154
155
  function createPortalSlot() {
@@ -1,6 +1,6 @@
1
- import { l as ComponentFunction } from "../control-DhUZU4_V.js";
2
- import { M as RouteMatch, W as RouteRegistry, w as RouteAuthOptions } from "../index-BvNkcegT.js";
3
- import { C as Query, k as QueryStaleReason, v as DataRuntime } from "../index-SGxMZLAc.js";
1
+ import { l as ComponentFunction } from "../control-D-FIa-n-.js";
2
+ import { a as Mutation, m as QueryStaleReason, s as Query, t as DataRuntime } from "../types-iAmDSV6o.js";
3
+ import { M as RouteMatch, W as RouteRegistry, w as RouteAuthOptions } from "../index-Izwp_ESC.js";
4
4
  //#region src/testing/render.d.ts
5
5
  interface RenderOptions {
6
6
  /**
@@ -16,6 +16,7 @@ interface RouteRenderOptions extends RenderOptions {
16
16
  /** Initial path, query, and hash for the routed render. */
17
17
  url?: string;
18
18
  auth?: RouteAuthOptions;
19
+ dataRuntime?: DataRuntime;
19
20
  }
20
21
  type DispatchEventInit = EventInit | UIEventInit | FocusEventInit | MouseEventInit | WheelEventInit | KeyboardEventInit | InputEventInit | CompositionEventInit | PointerEventInit | TouchEventInit | DragEventInit;
21
22
  interface RenderResult {
@@ -48,6 +49,36 @@ interface QueryTestRegistry {
48
49
  }
49
50
  /** Create a keyed query fixture registry for a test render runtime. */
50
51
  declare function createQueryTestRegistry(): QueryTestRegistry;
52
+ interface MutationTestRegistry {
53
+ readonly runtime: DataRuntime;
54
+ set<TInput, TResult>(key: string, mutation: Mutation<TInput, TResult>): void;
55
+ delete(key: string): void;
56
+ clear(): void;
57
+ }
58
+ /** Create a keyed mutation fixture registry for a test render runtime. */
59
+ declare function createMutationTestRegistry(): MutationTestRegistry;
60
+ type MutationFixtureInitial<TResult> = {
61
+ pending?: boolean;
62
+ error?: {} | null;
63
+ result?: TResult;
64
+ };
65
+ type MutationFixture<TInput, TResult> = Mutation<TInput, TResult> & {
66
+ /** Inputs received by the fixture's execute method. */
67
+ readonly inputs: readonly TInput[];
68
+ /** Move the fixture to pending without starting application work. */
69
+ setPending(): void;
70
+ /** Resolve the current fixture execution and expose its result. */
71
+ succeed(result: TResult): void;
72
+ /** Reject the current fixture execution and expose its error. */
73
+ fail(error: {}): void;
74
+ };
75
+ declare function createMutationFixture<TInput = unknown, TResult = unknown>(initial?: MutationFixtureInitial<TResult>): MutationFixture<TInput, TResult>;
76
+ declare const mutationState: typeof createMutationFixture & {
77
+ idle<TInput = unknown, TResult = unknown>(): MutationFixture<TInput, TResult>;
78
+ pending<TInput = unknown, TResult = unknown>(): MutationFixture<TInput, TResult>;
79
+ success<TInput = unknown, TResult = unknown>(result: TResult): MutationFixture<TInput, TResult>;
80
+ error<TInput = unknown, TResult = unknown>(error: {}): MutationFixture<TInput, TResult>;
81
+ };
51
82
  type MockRefresh = () => void | Promise<void>;
52
83
  interface MockQueryOptions {
53
84
  refresh?: MockRefresh;
@@ -94,4 +125,4 @@ declare function createInvalidationRecorder(): InvalidationRecorder;
94
125
  declare function matchRoute(path: string, options: MatchRouteOptions): RouteMatch | null;
95
126
  declare function getRouteWarnings(options: MatchRouteOptions): RoutePatternWarning[];
96
127
  //#endregion
97
- export { InvalidationRecord, InvalidationRecorder, MockQueryOptions, MockRefresh, QueryTestRegistry, type RenderOptions, type RenderResult, RoutePatternWarning, type RouteRenderOptions, cleanup, click, createInvalidationRecorder, createQueryTestRegistry, dispatch, flush, getRouteWarnings, matchRoute, mockQuery, mount, queryState, render, renderRoute, submit, type };
128
+ export { InvalidationRecord, InvalidationRecorder, MockQueryOptions, MockRefresh, MutationFixture, MutationFixtureInitial, MutationTestRegistry, QueryTestRegistry, type RenderOptions, type RenderResult, RoutePatternWarning, type RouteRenderOptions, cleanup, click, createInvalidationRecorder, createMutationTestRegistry, createQueryTestRegistry, dispatch, flush, getRouteWarnings, matchRoute, mockQuery, mount, mutationState, queryState, render, renderRoute, submit, type };
@@ -1,7 +1,9 @@
1
1
  import { r as flushRuntimeScheduler } from "../access-Dpfoi4cA.js";
2
- import { l as addInvalidationListener, t as createDataRuntime } from "../data-runtime-CnVeSvJz.js";
2
+ import { u as recordReadableRead } from "../readable-B5NtV7V0.js";
3
+ import { l as addInvalidationListener, t as createDataRuntime } from "../data-runtime-SC6zzAwh.js";
4
+ import { a as notifySource, i as normalizeAsyncDataError, r as createReadableSource } from "../data-BmZC1kDn.js";
3
5
  import { r as computeRouteActivityMatches } from "../route-matching-DqULzZtC.js";
4
- import { a as cleanupApp, r as createSPA, t as createIsland } from "../boot-Bd-j_BL5.js";
6
+ import { a as cleanupApp, r as createSPA, t as createIsland } from "../boot-CrbszDjZ.js";
5
7
  //#region src/testing/render.ts
6
8
  const renderStates = /* @__PURE__ */ new WeakMap();
7
9
  const eventConstructorNames = {
@@ -169,6 +171,7 @@ async function renderRoute(options) {
169
171
  root: container,
170
172
  registry: options.registry,
171
173
  auth: options.auth,
174
+ dataRuntime: options.dataRuntime,
172
175
  cleanupStrict: options.cleanupStrict
173
176
  });
174
177
  flush();
@@ -218,6 +221,150 @@ function createQueryTestRegistry() {
218
221
  }
219
222
  };
220
223
  }
224
+ /** Create a keyed mutation fixture registry for a test render runtime. */
225
+ function createMutationTestRegistry() {
226
+ const runtime = createDataRuntime();
227
+ return {
228
+ runtime,
229
+ set(key, mutation) {
230
+ if (typeof key !== "string" || key.length === 0) throw new TypeError("@askrjs/askr/testing mutation registry keys must be non-empty strings.");
231
+ const previous = runtime.mutationTestOverrides.get(key);
232
+ if (previous && previous !== mutation) previous.reset();
233
+ runtime.mutationTestOverrides.set(key, mutation);
234
+ },
235
+ delete(key) {
236
+ runtime.mutationTestOverrides.get(key)?.reset();
237
+ runtime.mutationTestOverrides.delete(key);
238
+ },
239
+ clear() {
240
+ for (const mutation of runtime.mutationTestOverrides.values()) mutation.reset();
241
+ runtime.mutationTestOverrides.clear();
242
+ }
243
+ };
244
+ }
245
+ var MutableMutationFixture = class {
246
+ constructor(initial = {}) {
247
+ this.source = createReadableSource();
248
+ this.receivedInputs = [];
249
+ this.active = null;
250
+ const hasResult = Object.prototype.hasOwnProperty.call(initial, "result");
251
+ if (initial.pending && (initial.error != null || hasResult)) throw new TypeError("@askrjs/askr/testing mutation fixtures cannot be pending and settled.");
252
+ if (initial.error != null && hasResult) throw new TypeError("@askrjs/askr/testing mutation fixtures cannot have both error and result.");
253
+ this.state = initial.pending ? {
254
+ status: "pending",
255
+ error: null,
256
+ result: null
257
+ } : initial.error != null ? {
258
+ status: "error",
259
+ error: initial.error,
260
+ result: null
261
+ } : hasResult ? {
262
+ status: "success",
263
+ error: null,
264
+ result: initial.result
265
+ } : {
266
+ status: "idle",
267
+ error: null,
268
+ result: null
269
+ };
270
+ }
271
+ get status() {
272
+ recordReadableRead(this.source);
273
+ return this.state.status;
274
+ }
275
+ get pending() {
276
+ recordReadableRead(this.source);
277
+ return this.state.status === "pending";
278
+ }
279
+ get error() {
280
+ recordReadableRead(this.source);
281
+ return this.state.error;
282
+ }
283
+ get result() {
284
+ recordReadableRead(this.source);
285
+ return this.state.result;
286
+ }
287
+ get inputs() {
288
+ return this.receivedInputs;
289
+ }
290
+ execute(input) {
291
+ this.abort();
292
+ this.receivedInputs.push(input);
293
+ this.setPending();
294
+ return new Promise((resolve, reject) => {
295
+ this.active = {
296
+ resolve,
297
+ reject
298
+ };
299
+ });
300
+ }
301
+ setPending() {
302
+ this.setState({
303
+ status: "pending",
304
+ error: null,
305
+ result: null
306
+ });
307
+ }
308
+ succeed(result) {
309
+ const active = this.active;
310
+ this.active = null;
311
+ this.setState({
312
+ status: "success",
313
+ error: null,
314
+ result
315
+ });
316
+ active?.resolve(result);
317
+ }
318
+ fail(error) {
319
+ const normalized = normalizeAsyncDataError(error, "Unknown mutation fixture error");
320
+ const active = this.active;
321
+ this.active = null;
322
+ this.setState({
323
+ status: "error",
324
+ error: normalized,
325
+ result: null
326
+ });
327
+ active?.reject(normalized);
328
+ }
329
+ abort() {
330
+ const active = this.active;
331
+ this.active = null;
332
+ this.setState({
333
+ status: "idle",
334
+ error: null,
335
+ result: null
336
+ });
337
+ if (active) {
338
+ const error = /* @__PURE__ */ new Error("Mutation fixture aborted.");
339
+ error.name = "AbortError";
340
+ active.reject(error);
341
+ }
342
+ }
343
+ reset() {
344
+ this.abort();
345
+ }
346
+ setState(state) {
347
+ this.state = state;
348
+ notifySource(this.source);
349
+ }
350
+ };
351
+ function createMutationFixture(initial = {}) {
352
+ return new MutableMutationFixture(initial);
353
+ }
354
+ const mutationState = Object.assign(createMutationFixture, {
355
+ idle() {
356
+ return createMutationFixture();
357
+ },
358
+ pending() {
359
+ return createMutationFixture({ pending: true });
360
+ },
361
+ success(result) {
362
+ return createMutationFixture({ result });
363
+ },
364
+ error(error) {
365
+ return createMutationFixture({ error });
366
+ }
367
+ });
221
368
  function normalizeRefresh(options) {
222
369
  return async () => {
223
370
  await options?.refresh?.();
@@ -380,4 +527,4 @@ function getRouteWarnings(options) {
380
527
  });
381
528
  }
382
529
  //#endregion
383
- export { cleanup, click, createInvalidationRecorder, createQueryTestRegistry, dispatch, flush, getRouteWarnings, matchRoute, mockQuery, mount, queryState, render, renderRoute, submit, type };
530
+ export { cleanup, click, createInvalidationRecorder, createMutationTestRegistry, createQueryTestRegistry, dispatch, flush, getRouteWarnings, matchRoute, mockQuery, mount, mutationState, queryState, render, renderRoute, submit, type };
@@ -1,4 +1,4 @@
1
- import { o as KnownIntrinsicElementProps, r as JSXElement, s as Props } from "./jsx-Dvr2SGRG.js";
1
+ import { o as KnownIntrinsicElementProps, r as JSXElement, s as Props } from "./jsx-BYXe_Nnk.js";
2
2
  //#region src/jsx/types.d.ts
3
3
  declare global {
4
4
  namespace JSX {
@@ -6,11 +6,14 @@ interface DataRuntime {
6
6
  readonly queryData: Map<string, unknown>;
7
7
  /** Test-only query overrides keyed by the canonical query key. */
8
8
  readonly queryTestOverrides: Map<string, unknown>;
9
+ /** Test-only mutation overrides keyed by the canonical mutation key. */
10
+ readonly mutationTestOverrides: Map<string, unknown>;
9
11
  }
10
12
  interface DataRuntimeOptions {
11
13
  queryCache?: Map<string, unknown>;
12
14
  queryData?: Map<string, unknown>;
13
15
  queryTestOverrides?: Map<string, unknown>;
16
+ mutationTestOverrides?: Map<string, unknown>;
14
17
  }
15
18
  interface QueryDefinition<TInput, TResult extends {}> {
16
19
  readonly key: (input: TInput) => string;
@@ -163,6 +166,8 @@ type QueryOptions<T> = {
163
166
  skipInitialFetch?: boolean;
164
167
  };
165
168
  type MutationOptions<TInput, TResult> = {
169
+ /** Stable identity used by runtime-scoped mutation test overrides. */
170
+ key?: string;
166
171
  action: (input: TInput, ctx: {
167
172
  signal: AbortSignal;
168
173
  }) => Promise<TResult>;
@@ -171,66 +176,4 @@ type MutationOptions<TInput, TResult> = {
171
176
  runtime?: DataRuntime;
172
177
  };
173
178
  //#endregion
174
- //#region src/common/telemetry.d.ts
175
- interface TelemetryFields {
176
- requestId?: string;
177
- traceId?: string;
178
- route?: string;
179
- action?: string;
180
- operation?: string;
181
- status?: number;
182
- durationMs?: number;
183
- }
184
- type TelemetrySpan = <T>(fields: TelemetryFields, work: () => T) => T;
185
- /**
186
- * Structural subset implemented by `createTelemetry()` from `@askrjs/otel`.
187
- * Core does not install an OpenTelemetry SDK, backend, or exporter.
188
- */
189
- interface CoreTelemetry {
190
- routeMatch?: TelemetrySpan;
191
- loader?: TelemetrySpan;
192
- queryPrefetch?: TelemetrySpan;
193
- ssrRender?: TelemetrySpan;
194
- }
195
- //#endregion
196
- //#region src/data/mutation-cell.d.ts
197
- declare function createMutation<TInput, TResult>(options: MutationOptions<TInput, TResult>): Mutation<TInput, TResult>;
198
- //#endregion
199
- //#region src/data/query-cell.d.ts
200
- declare function createQuery<T extends {}>(options: QueryOptions<T>): Query<T>;
201
- declare function createQuery<TInput, TResult extends {}>(definition: QueryDefinition<TInput, TResult>, input: TInput, options?: Omit<QueryOptions<TResult>, 'key' | 'fetch'>): Query<TResult>;
202
- //#endregion
203
- //#region src/data/data-runtime.d.ts
204
- declare function createDataRuntime(options?: DataRuntimeOptions): DataRuntime;
205
- declare function getDefaultDataRuntime(): DataRuntime;
206
- //#endregion
207
- //#region src/data/invalidation.d.ts
208
- declare function invalidate(prefix: string, options?: InvalidateOptions): void;
209
- declare function queryScope(namespace: string): QueryScope;
210
- declare function invalidateOnInterval(prefix: string, options: InvalidateOnIntervalOptions): void;
211
- //#endregion
212
- //#region src/data/query-registry.d.ts
213
- interface ServerQueryRegistry {
214
- readonly entries: readonly ServerQueryEntry<unknown, {}>[];
215
- get<TInput, TResult extends {}>(query: QueryDefinition<TInput, TResult>): ServerQueryHandler<TInput, TResult> | undefined;
216
- }
217
- interface ServerQueryEntry<TInput, TResult extends {}> {
218
- readonly query: QueryDefinition<TInput, TResult>;
219
- readonly handler: ServerQueryHandler<TInput, TResult>;
220
- }
221
- declare function serveQuery<TInput, TResult extends {}>(query: QueryDefinition<TInput, TResult>, handler: ServerQueryHandler<TInput, TResult>): ServerQueryEntry<TInput, TResult>;
222
- declare function defineServerQueries(...entries: readonly ServerQueryEntry<any, any>[]): ServerQueryRegistry;
223
- declare function defineQuery<TInput, TResult extends {}>(definition: QueryDefinition<TInput, TResult>): QueryDefinition<TInput, TResult>;
224
- declare function createQueryPrefetchContext(options?: {
225
- runtime?: DataRuntime;
226
- registry?: ServerQueryRegistry;
227
- request?: Request;
228
- signal?: AbortSignal;
229
- mode?: 'ssr' | 'spa';
230
- telemetry?: CoreTelemetry;
231
- }): QueryPrefetchContext;
232
- declare function prefetchQuery<TInput, TResult extends {}>(context: QueryPrefetchContext, query: QueryDefinition<TInput, TResult>, input: TInput): Promise<boolean>;
233
- declare function dehydrateDataRuntime(runtime: DataRuntime): Record<string, unknown>;
234
- declare function hydrateDataRuntime(runtime: DataRuntime, data: unknown): void;
235
- //#endregion
236
- export { ServerQueryHandler as A, Query as C, QueryPrefetchContext as D, QueryKeyPart as E, QueryScope as O, Mutation as S, QueryDefinition as T, CoreTelemetry as _, defineServerQueries as a, InvalidateOnIntervalOptions as b, prefetchQuery as c, invalidateOnInterval as d, queryScope as f, createMutation as g, createQuery as h, defineQuery as i, QueryStaleReason as k, serveQuery as l, getDefaultDataRuntime as m, ServerQueryRegistry as n, dehydrateDataRuntime as o, createDataRuntime as p, createQueryPrefetchContext as r, hydrateDataRuntime as s, ServerQueryEntry as t, invalidate as u, DataRuntime as v, QueryConsistency as w, InvalidateOptions as x, DataRuntimeOptions as y };
179
+ export { Mutation as a, QueryConsistency as c, QueryOptions as d, QueryPrefetchContext as f, ServerQueryHandler as h, InvalidateOptions as i, QueryDefinition as l, QueryStaleReason as m, DataRuntimeOptions as n, MutationOptions as o, QueryScope as p, InvalidateOnIntervalOptions as r, Query as s, DataRuntime as t, QueryKeyPart as u };
@@ -1,6 +1,6 @@
1
1
  import { m as withHydrationVerificationRender } from "./render-context-D0Hoj9dW.js";
2
2
  import { t as SSR_RENDER_DATA_ATTR } from "./ssr-DSHd_Q9K.js";
3
- import { a as renderResolvedToStringSync } from "./ssr-q250YlKo.js";
3
+ import { a as renderResolvedToStringSync } from "./ssr-DXGtDJd7.js";
4
4
  //#region src/ssr/verify-hydration.ts
5
5
  function normalizeHydrationHtml(html) {
6
6
  const template = document.createElement("template");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askrjs/askr",
3
- "version": "0.0.87",
3
+ "version": "0.0.89",
4
4
  "description": "Actor-backed deterministic UI framework",
5
5
  "keywords": [
6
6
  "askr",
@@ -148,20 +148,21 @@
148
148
  "prepublishOnly": "npm run check"
149
149
  },
150
150
  "dependencies": {
151
- "@askrjs/auth": ">=0.0.1 <0.1.0",
152
- "@askrjs/schema": ">=0.0.1 <0.1.0"
151
+ "@askrjs/auth": ">=0.0.8 <0.1.0",
152
+ "@askrjs/schema": ">=0.0.5 <0.1.0"
153
153
  },
154
154
  "devDependencies": {
155
- "@types/node": "^26.1.1",
155
+ "@types/node": "^26.2.0",
156
+ "@typescript/native": "npm:typescript@^7.0.2",
156
157
  "@vitest/browser-playwright": "4.1.10",
157
158
  "cross-env": "^10.1.0",
158
- "jsdom": "^30.0.0",
159
- "playwright": "^1.61.1",
160
- "publint": "^0.3.21",
159
+ "jsdom": "^30.0.1",
160
+ "playwright": "^1.62.1",
161
+ "publint": "^0.3.23",
161
162
  "tsd": "^0.33.0",
162
- "typescript": "6.0.3",
163
- "vite": "^8.1.4",
164
- "vite-plus": "^0.2.4"
163
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
164
+ "vite": "^8.2.1",
165
+ "vite-plus": "^0.2.8"
165
166
  },
166
167
  "tsd": {
167
168
  "compilerOptions": {
@@ -1,2 +0,0 @@
1
- import "./types-C9YcqVpk.js";
2
- import "./jsx-runtime-Cr1jspx9.js";