akanjs 3.2.0-rc.2 → 3.2.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -32,6 +32,17 @@
32
32
  - **`pkgs/akanjs/ARCHITECTURE.md`** pairs a hand-kept walk through the processes and a request with a generated part between markers. `akan sync-architecture` regenerates that part, and a devkit test fails when it is stale, when a channel is gone, when two facets load values from each other, when a message lacks a recognised sender or handler outside a short list whose other end lies beyond the framework source, or when the hand-kept part names a class the source no longer has.
33
33
  - **`AkanIpcMessage` no longer lists `backend-ready`.** The gateway sends it to the dev host, which reads it as a `BuilderMessage`, where it stays; no gateway or child ever handled it.
34
34
 
35
+ - 4d61170: The Akan Graph follows an app's adaptor wiring further. `applyAdaptor(LlmAdaptorRole, ChatCompletionsLlm)` in an app's or lib's `option.ts` draws a `binds` edge from the role, `adaptor::LlmAdaptorRole`, to the implementation it binds, labelled with the app or lib and located at the call, so a method that calls a plugged role reaches the class that answers it. `get_graph` scoped to an app keeps that app's own bindings, and a lib's binding of a role the app does not bind itself; scoped to a lib or a module it keeps every binding of a role it reaches. A Change Map carries every binding of a role it shows, changed or not, so the binding an app runs stays in view; a binding the app removed no longer hides the lib binding it now runs; and Studio's Change Map for one app keeps only the bindings that app runs. An app service holds the fields its module's lib services plug (`...user.services`), so `this.notifier.getMemo()` in an app method links to the `Notifier` a lib's `MemoService` plugs, where it linked to the `memo` model; a service whose own builder declares the field (`notifier: use<…>()`) inherits nothing. A plug imported from a package outside the workspace, `plug(Stripe)` from `stripe-sdk`, or through a lib's re-export of it (`export { Stripe }`, `export { default as Stripe }`, or `export * from "stripe-sdk"` where the lib declares no `Stripe` itself), is `adaptor:stripe-sdk:Stripe` with the package in `detail`, where it linked to a same-name adaptor the app declares or to an unlocated `adaptor:libs/util:Stripe`. Two adaptors with the same class name in one app or lib are two nodes, each with its own location, digest and `plugs`, and a plug reaches the one its import names. A job's `detail` lists only the options its kind honours: `once` on an `initialize` job, `unlocked` on an `interval` job (`Bun.cron` never overlaps a cron job, so `lock: false` changes nothing there); `cron("0 * * * *" as const)` reads `0 * * * *`.
36
+
37
+ Ids and details that change for a saved graph or a Change Map base:
38
+
39
+ - While two adaptors of one owner share a class name, each is keyed by its file, `adaptor:apps/demo:srvkit/clockB.ts#Clock`; an adaptor whose name no other adaptor of its owner shares keeps `adaptor:<owner>:<Name>`. The Change Map treats the two forms of one declaration as one node, so a second same-name adaptor shows as one added node, not a removal of the first.
40
+ - A plug from a non-workspace package is `adaptor:<package>:<Name>` with the package as `detail`, where it was `adaptor::<Name>` or a workspace adaptor of that name.
41
+ - A job's `detail` drops `once` and `unlocked` where the runtime ignores them, and `as const` from a cron expression.
42
+
43
+ - **`binds`** joins `AkanGraphEdgeKind` in `akanjs/common`.
44
+ - **`FileFacts.adaptorBindings`** in `@akanjs/language`: each `applyAdaptor(role, adaptor)` call a file makes; `AkanIndex.setFile` also reads non-test files whose text mentions `applyAdaptor`. **`ServiceClassFact.fields`**: the names a service's builder declares.
45
+
35
46
  - c723713: The Akan Graph keys a guard function by the file that declares it, locates more of a workspace's guards, and stops counting things that are not guards.
36
47
 
37
48
  A guard function a route or layout imports is keyed by its file, as one the page declares already was: `guard:libs/shared:webkit/signedIn.ts#signedIn`. A `canEdit` in `webkit/` and one in `common/` are two nodes, each at its own declaration, and an edit to either marks only that one changed in the Change Map. A guard called through a namespace import (`auth.signedIn()`), or imported under a name a file re-exports (`export { signedIn as hasSession } from "./auth"`), reaches its declaration. A function the guard declares, or a parameter it binds, shadows an import of the same name only inside its own scope, so `[1].forEach((signedIn) => …)` no longer hides a real `signedIn()` beside it. A guard declared after another declarator (`export const ready = true, signedIn = …`) is found, and an overloaded guard's digest covers every signature. Only a file whose text declares or re-exports the name is parsed, so a guard that calls `usePage()` from the generated client no longer parses every page that names it.
@@ -429,6 +440,7 @@
429
440
  - **`ssr: "block"` writes every boundary in place,** so a blocking page never shows its `.loading()` fallback.
430
441
  - **Fragments land on their target.** A document opened at a fragment scrolls to the target when React reveals it, if the target was not on the page yet and the visitor has not scrolled; a reload or a back/forward visit keeps the offset the browser restored. A client navigation to another page's fragment lands on the target instead of the top.
431
442
 
443
+ - 76705dd: `StoreRegistry.build` now reads a root store's state, actions and slices from the merged type rather than inferring them back out of it. That inference grew quadratically with the number of stores. In an app merging about 70 stores, `build` took most of the typecheck, and adding a few more stores failed it with TS2589 ("Type instantiation is excessively deep"). With this change the typecheck cost grows linearly with the store count, and the `st` type is unchanged.
432
444
  - 206bb69: A store write now costs about one copy of the state, whatever else the root holds. Before, every `set` copied the state twice, compared every key, re-read every `search()` value, and walked every persisted key and every model form. That came to 173 µs at 1,740 keys and 364 µs at 3,480. Now `set` works out the changed keys from the patch and copies the state once. It then recomputes only the `search()` values (when `searchParams` changed) and the `computed()` values whose dependencies changed, and syncs only the persisted keys and form drafts the write touched. That is 38 µs at 1,740 keys and 78 µs at 3,480, the cost of the copy itself.
433
445
 
434
446
  - **One `set` per model write.** `update<Model>`, `update<Model>InForm`, `merge<Model>`, `set<Model>`, `remove<Model>`, `create<Model>` and `create<Model>InForm` now write the model, every slice list that holds the row, and the stale stamps in one `set`. Before, they called `set` once per slice, plus once more. An update at 1,640 keys went from 488 µs to 47 µs.
@@ -436,6 +448,12 @@
436
448
  - **A write leaves untouched `search()` values as they were.** An array `search()` value used to be parsed again on every write, as a new array, so a component reading it rendered again on writes it did not read.
437
449
  - **`set` with a `search()` or `computed()` key** now throws before it writes anything. Before, the state was already replaced when it threw.
438
450
 
451
+ - e4c7e5c: Akan Studio lands on the Runtime view in two more cases where no dev builder can draw the others, and says the right thing when web is off.
452
+
453
+ - **An empty or unknown `view`** (`/_akan/studio?view=`, `?view=bogus`) lands on Runtime when the server has no dev builder, as a bare `/_akan/studio` already did. It used to answer the ERD's 503.
454
+ - **A builder that never answers.** When the builder RPC times out, a bare `/_akan/studio` lands on Runtime instead of answering 503. A view asked for by name still answers 503 inside Studio's nav with the timeout, and a failed build still shows its error without landing.
455
+ - **Web off.** On a server that serves the API only (`AKAN_SSR=false` or `setWeb(false)`), a builder view says the builder is reached only with the web surface on, instead of telling you to open it under `akan start`, which does not change that.
456
+
439
457
  - 6291fec: Akan Studio opens without a dev builder, and names every job in full.
440
458
 
441
459
  - **`/_akan/studio` with no dev builder** lands on the Runtime view, which reads the running server, instead of answering 503 with nothing to click. A view that needs the builder (ERD, Signals, Changes, Framework) still answers 503, now inside Studio's header and nav, saying to open it under `akan start` and that Runtime needs no builder. A failed build shows its error the same way.
@@ -14,7 +14,7 @@ export type AkanGraphNodeKind =
14
14
  | "internal"
15
15
  | "adaptor";
16
16
 
17
- export type AkanGraphEdgeKind = "field" | "guard" | "calls" | "fetches" | "uses" | "wraps" | "plugs";
17
+ export type AkanGraphEdgeKind = "field" | "guard" | "calls" | "fetches" | "uses" | "wraps" | "plugs" | "binds";
18
18
 
19
19
  export type AkanGraphChange = "added" | "removed" | "changed";
20
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akanjs",
3
- "version": "3.2.0-rc.2",
3
+ "version": "3.2.0-rc.3",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -787,7 +787,7 @@ export class AkanServer {
787
787
  websocketPrefix: this.websocketPrefix,
788
788
  openapi: this.openapi,
789
789
  getStatus: () => this.status,
790
- ...(webRouter ? DevtoolsRouter.buildsFrom(() => webRouter.builderRpc) : {}),
790
+ ...DevtoolsRouter.buildsFrom(webRouter),
791
791
  }).createRoutes();
792
792
  return { ...openapiRoutes, ...mcpRoutes, ...devtoolsRoutes, ...soloRoutes };
793
793
  }
@@ -27,6 +27,10 @@ export interface BuilderRpcEventHandlers {
27
27
  onBuildStatus?: (status: DevBuildStatus) => void;
28
28
  }
29
29
 
30
+ export interface BuilderRpcTimeout extends Error {
31
+ timeoutMs: number;
32
+ }
33
+
30
34
  /** One per backend process: subscribes to the IPC channel on construction and unsubscribes on `dispose()`. */
31
35
  export class BuilderRpc {
32
36
  readonly #logger = new Logger("BuilderRpc");
@@ -131,6 +135,10 @@ export class BuilderRpc {
131
135
  );
132
136
  }
133
137
 
138
+ static isTimeout(error: unknown): error is BuilderRpcTimeout {
139
+ return error instanceof Error && "timeoutMs" in error;
140
+ }
141
+
134
142
  static #timeoutMs(): number {
135
143
  const configured = Number(process.env.AKAN_BUILDER_RPC_TIMEOUT_MS);
136
144
  if (Number.isFinite(configured) && configured > 0) return configured;
@@ -144,11 +152,8 @@ export class BuilderRpc {
144
152
  return await new Promise<T>((resolve, reject) => {
145
153
  const timer = setTimeout(() => {
146
154
  this.#pending.delete(id);
147
- reject(
148
- new Error(
149
- `[builder] ${label} got no answer in ${timeoutMs}ms; the builder was likely recycled or restarted mid-request — reload to retry`,
150
- ),
151
- );
155
+ const message = `[builder] ${label} got no answer in ${timeoutMs}ms; the builder was likely recycled or restarted mid-request — reload to retry`;
156
+ reject(Object.assign(new Error(message), { timeoutMs }));
152
157
  }, timeoutMs);
153
158
 
154
159
  timer.unref?.();
@@ -676,9 +676,9 @@ for it to be added.
676
676
  `/_akan/studio?view=runtime` draws `/_akan/deps` and `/_akan/signal` as one picture, next to Studio's
677
677
  source-built views (ERD, Signals, Changes, Framework). It calls the same serializers in process, so it reads the
678
678
  container of the process that answered and needs that server running; the header says which (`pid`,
679
- `serverMode`, `replicaIdx`). It needs no dev builder, so `/_akan/studio` with no `view` lands on it when no
680
- builder answers; a source-built view asked for then answers 503 inside Studio's nav, saying to open it under
681
- `akan start`.
679
+ `serverMode`, `replicaIdx`). It needs no dev builder, so `/_akan/studio` without a known `view` lands on it when
680
+ the server has no builder or the builder RPC times out (`AKAN_BUILDER_RPC_TIMEOUT_MS`, 120 s by default); a
681
+ source-built view asked for then, like a failed build, answers 503 inside Studio's nav with the reason.
682
682
 
683
683
  - **Columns.** Jobs, then services by boot stage, then adaptors by boot stage. An injection always targets
684
684
  an earlier stage, so the latest stage stands leftmost and every arrow points from what injects to what it
@@ -19,6 +19,7 @@ export interface DevtoolsRouterContext {
19
19
  prefix: string;
20
20
  websocketPrefix: string;
21
21
  openapi: boolean;
22
+ web?: boolean;
22
23
  getStatus: () => string;
23
24
  buildGraph?: () => Promise<BuildGraphPayload | null>;
24
25
  buildChanges?: (since: string | null) => Promise<BuildChangesPayload | null>;
@@ -39,12 +40,14 @@ export class DevtoolsRouter {
39
40
  }
40
41
 
41
42
  static buildsFrom(
42
- builderRpc: () => BuilderRpc | null,
43
- ): Pick<DevtoolsRouterContext, "buildGraph" | "buildChanges" | "buildFramework"> {
43
+ webRouter: { readonly builderRpc: BuilderRpc | null } | null,
44
+ ): Pick<DevtoolsRouterContext, "web" | "buildGraph" | "buildChanges" | "buildFramework"> {
45
+ if (!webRouter) return { web: false };
44
46
  return {
45
- buildGraph: async () => (await builderRpc()?.buildGraph()) ?? null,
46
- buildChanges: async (since) => (await builderRpc()?.buildChanges(since)) ?? null,
47
- buildFramework: async () => (await builderRpc()?.buildFramework()) ?? null,
47
+ web: true,
48
+ buildGraph: async () => (await webRouter.builderRpc?.buildGraph()) ?? null,
49
+ buildChanges: async (since) => (await webRouter.builderRpc?.buildChanges(since)) ?? null,
50
+ buildFramework: async () => (await webRouter.builderRpc?.buildFramework()) ?? null,
48
51
  };
49
52
  }
50
53
 
@@ -59,6 +62,7 @@ export class DevtoolsRouter {
59
62
  const studio = new StudioRoute({
60
63
  basePath: `${DevtoolsRouter.basePath}/studio`,
61
64
  appName: this.#context.env.appName,
65
+ web: this.#context.web ?? true,
62
66
  buildGraph: this.#context.buildGraph ?? null,
63
67
  buildChanges: this.#context.buildChanges ?? null,
64
68
  buildFramework: this.#context.buildFramework ?? null,
@@ -1,6 +1,11 @@
1
1
  import { Logger } from "akanjs/common";
2
2
  import type { ReactNode } from "react";
3
- import type { BuildChangesPayload, BuildFrameworkPayload, BuildGraphPayload } from "../../artifact";
3
+ import {
4
+ type BuildChangesPayload,
5
+ BuilderRpc,
6
+ type BuildFrameworkPayload,
7
+ type BuildGraphPayload,
8
+ } from "../../artifact";
4
9
  import { createSystemPageHeaders } from "../../systemPages";
5
10
  import { StudioDocument, type StudioEditor, type StudioPayload, type StudioQuery } from "./studioDocument";
6
11
  import type { StudioView } from "./studioLayout";
@@ -9,6 +14,7 @@ import type { StudioRuntimePayload } from "./studioRuntimeGraph";
9
14
  export interface StudioRouteContext {
10
15
  basePath: string;
11
16
  appName: string;
17
+ web: boolean;
12
18
  buildGraph: (() => Promise<BuildGraphPayload | null>) | null;
13
19
  buildChanges: ((since: string | null) => Promise<BuildChangesPayload | null>) | null;
14
20
  buildFramework: (() => Promise<BuildFrameworkPayload | null>) | null;
@@ -42,7 +48,7 @@ export class StudioRoute {
42
48
  const url = new URL(req.url);
43
49
  const asked = StudioRoute.queryOf(url);
44
50
  const loaded = await this.#load(asked);
45
- const landed = "error" in loaded && loaded.builderless && !url.searchParams.has("view");
51
+ const landed = "error" in loaded && loaded.unanswered && !views.has(url.searchParams.get("view") as StudioView);
46
52
  const query: StudioQuery = landed ? { ...asked, view: "runtime" } : asked;
47
53
  const shown = landed ? await this.#load(query) : loaded;
48
54
  if ("error" in shown)
@@ -67,24 +73,25 @@ export class StudioRoute {
67
73
  return buildGraph ? await buildGraph() : null;
68
74
  }
69
75
 
70
- async #load(query: StudioQuery): Promise<{ payload: StudioPayload } | { error: string; builderless: boolean }> {
76
+ async #load(query: StudioQuery): Promise<{ payload: StudioPayload } | { error: string; unanswered: boolean }> {
71
77
  if (query.view === "runtime") return { payload: this.#context.runtime() };
72
78
  try {
73
79
  const payload = await this.#payloadOf(query);
74
- return payload
75
- ? { payload }
76
- : {
77
- error:
78
- "Akan Studio reads this view from the dev builder; open it under `akan start`. Runtime (live) reads this running server and needs no builder.",
79
- builderless: true,
80
- };
80
+ return payload ? { payload } : { error: this.#builderless(), unanswered: true };
81
81
  } catch (error) {
82
82
  const message = error instanceof Error ? error.message : String(error);
83
83
  StudioRoute.logger.warn(`Failed to build the Akan Graph: ${message}`);
84
- return { error: message, builderless: false };
84
+ return { error: message, unanswered: BuilderRpc.isTimeout(error) };
85
85
  }
86
86
  }
87
87
 
88
+ #builderless(): string {
89
+ const reach = this.#context.web
90
+ ? "Akan Studio reads this view from the dev builder; open it under `akan start`."
91
+ : "Akan Studio reads this view from the dev builder, which a server reaches only with its web surface on, and this one serves the API only (`AKAN_SSR=false` or `setWeb(false)`).";
92
+ return `${reach} Runtime (live) reads this running server and needs no builder.`;
93
+ }
94
+
88
95
  static #headers(): Headers {
89
96
  const headers = createSystemPageHeaders();
90
97
  headers.delete("X-Frame-Options");
@@ -24,5 +24,7 @@ export type RootStoreCls<
24
24
  [ACTION_OWNER_META]: { [key: string]: ActionOwner };
25
25
  slice: { [key: string]: { [key: string]: SerializedSlice } };
26
26
  _slice: SliceInfoObj;
27
+
28
+ _root: { writable: WritableState; action: Action; slice: InternalSliceObj; state: State };
27
29
  }
28
30
  >;
@@ -7,10 +7,12 @@ import type { SliceStateAction, StoreUseOptions, VoidActions } from "./types";
7
7
 
8
8
  type SetKey<Key extends string> = `set${Capitalize<Key>}`;
9
9
 
10
- export type WithSelectors<RtStoreCls extends RootStoreCls> =
11
- RtStoreCls extends RootStoreCls<any, infer WritableState, infer Action, infer InternalSliceObj, any, any, infer State>
12
- ? WithSelectorsOf<State, WritableState, Action, InternalSliceObj>
13
- : never;
10
+ export type WithSelectors<RtStoreCls extends RootStoreCls> = WithSelectorsOf<
11
+ RtStoreCls["_root"]["state"],
12
+ RtStoreCls["_root"]["writable"],
13
+ RtStoreCls["_root"]["action"],
14
+ RtStoreCls["_root"]["slice"]
15
+ >;
14
16
 
15
17
  type WithSelectorsOf<State, WritableState, Action, InternalSliceObj> = StAgentic & {
16
18
  sub: {
@@ -1,5 +1,5 @@
1
1
  export type AkanGraphNodeKind = "model" | "scalar" | "enum" | "query" | "slice" | "endpoint" | "guard" | "method" | "action" | "component" | "route" | "layout" | "internal" | "adaptor";
2
- export type AkanGraphEdgeKind = "field" | "guard" | "calls" | "fetches" | "uses" | "wraps" | "plugs";
2
+ export type AkanGraphEdgeKind = "field" | "guard" | "calls" | "fetches" | "uses" | "wraps" | "plugs" | "binds";
3
3
  export type AkanGraphChange = "added" | "removed" | "changed";
4
4
  export interface AkanGraphLocation {
5
5
  file: string;
@@ -13,6 +13,9 @@ export interface BuilderRpcEventHandlers {
13
13
  onSsrUpdated?: (update: SsrUpdatedPayload) => void;
14
14
  onBuildStatus?: (status: DevBuildStatus) => void;
15
15
  }
16
+ export interface BuilderRpcTimeout extends Error {
17
+ timeoutMs: number;
18
+ }
16
19
  /** One per backend process: subscribes to the IPC channel on construction and unsubscribes on `dispose()`. */
17
20
  export declare class BuilderRpc {
18
21
  #private;
@@ -33,5 +36,6 @@ export declare class BuilderRpc {
33
36
  buildGraph(): Promise<BuildGraphPayload>;
34
37
  buildChanges(since: string | null): Promise<BuildChangesPayload>;
35
38
  buildFramework(): Promise<BuildFrameworkPayload>;
39
+ static isTimeout(error: unknown): error is BuilderRpcTimeout;
36
40
  dispose(): void;
37
41
  }
@@ -11,6 +11,7 @@ export interface DevtoolsRouterContext {
11
11
  prefix: string;
12
12
  websocketPrefix: string;
13
13
  openapi: boolean;
14
+ web?: boolean;
14
15
  getStatus: () => string;
15
16
  buildGraph?: () => Promise<BuildGraphPayload | null>;
16
17
  buildChanges?: (since: string | null) => Promise<BuildChangesPayload | null>;
@@ -23,7 +24,9 @@ export declare class DevtoolsRouter {
23
24
  static readonly logger: Logger;
24
25
  /** A local dev runtime only, unless `AKAN_DEVTOOLS` ("true"/"1", "false"/"0") overrides it, e.g. to debug a deployed env. */
25
26
  static isEnabled(env: BaseEnv): boolean;
26
- static buildsFrom(builderRpc: () => BuilderRpc | null): Pick<DevtoolsRouterContext, "buildGraph" | "buildChanges" | "buildFramework">;
27
+ static buildsFrom(webRouter: {
28
+ readonly builderRpc: BuilderRpc | null;
29
+ } | null): Pick<DevtoolsRouterContext, "web" | "buildGraph" | "buildChanges" | "buildFramework">;
27
30
  constructor(context: DevtoolsRouterContext);
28
31
  createRoutes(): HttpRoutes;
29
32
  }
@@ -1,10 +1,11 @@
1
1
  import { Logger } from "akanjs/common";
2
- import type { BuildChangesPayload, BuildFrameworkPayload, BuildGraphPayload } from "../../artifact.d.ts";
2
+ import { type BuildChangesPayload, type BuildFrameworkPayload, type BuildGraphPayload } from "../../artifact.d.ts";
3
3
  import { type StudioQuery } from "./studioDocument.d.ts";
4
4
  import type { StudioRuntimePayload } from "./studioRuntimeGraph.d.ts";
5
5
  export interface StudioRouteContext {
6
6
  basePath: string;
7
7
  appName: string;
8
+ web: boolean;
8
9
  buildGraph: (() => Promise<BuildGraphPayload | null>) | null;
9
10
  buildChanges: ((since: string | null) => Promise<BuildChangesPayload | null>) | null;
10
11
  buildFramework: (() => Promise<BuildFrameworkPayload | null>) | null;
@@ -126,299 +126,5 @@ declare const RootStore_base: import("./rootStore.d.ts").RootStoreCls<"root", im
126
126
  }, any>;
127
127
  export declare class RootStore extends RootStore_base {
128
128
  }
129
- export declare const st: import("./agentic.d.ts").StAgentic & {
130
- sub: {
131
- (listener: (state: import("./stateBuilder.d.ts").WritableStateOf<{
132
- csrLoaded: boolean;
133
- path: string;
134
- pathname: string;
135
- params: {
136
- [key: string]: string;
137
- };
138
- searchParams: BaseSearchParamsState;
139
- theme: string;
140
- innerWidth: number;
141
- innerHeight: number;
142
- responsive: Responsive["value"];
143
- uiOperation: "sleep" | "loading" | "idle";
144
- messages: (typeof defaultMessage)[];
145
- tryJwt: string | null;
146
- trySignalType: SignalType;
147
- tryGuards: string[];
148
- tryAccount: Account<{
149
- [key: string]: string | undefined;
150
- }>;
151
- keyboardHeight: number;
152
- pageState: PageState;
153
- devMode: boolean;
154
- currentPath: string;
155
- }>, prev: import("./stateBuilder.d.ts").WritableStateOf<{
156
- csrLoaded: boolean;
157
- path: string;
158
- pathname: string;
159
- params: {
160
- [key: string]: string;
161
- };
162
- searchParams: BaseSearchParamsState;
163
- theme: string;
164
- innerWidth: number;
165
- innerHeight: number;
166
- responsive: Responsive["value"];
167
- uiOperation: "sleep" | "loading" | "idle";
168
- messages: (typeof defaultMessage)[];
169
- tryJwt: string | null;
170
- trySignalType: SignalType;
171
- tryGuards: string[];
172
- tryAccount: Account<{
173
- [key: string]: string | undefined;
174
- }>;
175
- keyboardHeight: number;
176
- pageState: PageState;
177
- devMode: boolean;
178
- currentPath: string;
179
- }>) => void): () => void;
180
- <U>(selector: (state: import("./stateBuilder.d.ts").WritableStateOf<{
181
- csrLoaded: boolean;
182
- path: string;
183
- pathname: string;
184
- params: {
185
- [key: string]: string;
186
- };
187
- searchParams: BaseSearchParamsState;
188
- theme: string;
189
- innerWidth: number;
190
- innerHeight: number;
191
- responsive: Responsive["value"];
192
- uiOperation: "sleep" | "loading" | "idle";
193
- messages: (typeof defaultMessage)[];
194
- tryJwt: string | null;
195
- trySignalType: SignalType;
196
- tryGuards: string[];
197
- tryAccount: Account<{
198
- [key: string]: string | undefined;
199
- }>;
200
- keyboardHeight: number;
201
- pageState: PageState;
202
- devMode: boolean;
203
- currentPath: string;
204
- }>) => U, listener: (state: U, prev: U) => void, options?: {
205
- equalityFn?: ((a: U, b: U) => boolean) | undefined;
206
- fireImmediately?: boolean;
207
- } | undefined): () => void;
208
- };
209
- ref: <U>(selector: (state: import("./stateBuilder.d.ts").WritableStateOf<{
210
- csrLoaded: boolean;
211
- path: string;
212
- pathname: string;
213
- params: {
214
- [key: string]: string;
215
- };
216
- searchParams: BaseSearchParamsState;
217
- theme: string;
218
- innerWidth: number;
219
- innerHeight: number;
220
- responsive: Responsive["value"];
221
- uiOperation: "sleep" | "loading" | "idle";
222
- messages: (typeof defaultMessage)[];
223
- tryJwt: string | null;
224
- trySignalType: SignalType;
225
- tryGuards: string[];
226
- tryAccount: Account<{
227
- [key: string]: string | undefined;
228
- }>;
229
- keyboardHeight: number;
230
- pageState: PageState;
231
- devMode: boolean;
232
- currentPath: string;
233
- }>) => U) => import("react").RefObject<U>;
234
- sel: <U>(selector: (state: import("./stateBuilder.d.ts").WritableStateOf<{
235
- csrLoaded: boolean;
236
- path: string;
237
- pathname: string;
238
- params: {
239
- [key: string]: string;
240
- };
241
- searchParams: BaseSearchParamsState;
242
- theme: string;
243
- innerWidth: number;
244
- innerHeight: number;
245
- responsive: Responsive["value"];
246
- uiOperation: "sleep" | "loading" | "idle";
247
- messages: (typeof defaultMessage)[];
248
- tryJwt: string | null;
249
- trySignalType: SignalType;
250
- tryGuards: string[];
251
- tryAccount: Account<{
252
- [key: string]: string | undefined;
253
- }>;
254
- keyboardHeight: number;
255
- pageState: PageState;
256
- devMode: boolean;
257
- currentPath: string;
258
- }>) => U, equals?: ((a: U, b: U) => boolean) | undefined) => U;
259
- use: {
260
- csrLoaded: (options?: import("./types.d.ts").StoreUseOptions) => boolean;
261
- path: (options?: import("./types.d.ts").StoreUseOptions) => string;
262
- pathname: (options?: import("./types.d.ts").StoreUseOptions) => string;
263
- params: (options?: import("./types.d.ts").StoreUseOptions) => {
264
- [key: string]: string;
265
- };
266
- searchParams: (options?: import("./types.d.ts").StoreUseOptions) => BaseSearchParamsState;
267
- theme: (options?: import("./types.d.ts").StoreUseOptions) => string;
268
- innerWidth: (options?: import("./types.d.ts").StoreUseOptions) => number;
269
- innerHeight: (options?: import("./types.d.ts").StoreUseOptions) => number;
270
- responsive: (options?: import("./types.d.ts").StoreUseOptions) => "xl" | "lg" | "md" | "sm" | "xs";
271
- uiOperation: (options?: import("./types.d.ts").StoreUseOptions) => "idle" | "loading" | "sleep";
272
- messages: (options?: import("./types.d.ts").StoreUseOptions) => {
273
- type: "info" | "success" | "error" | "warning" | "loading";
274
- content: string;
275
- duration: number;
276
- key: string;
277
- }[];
278
- tryJwt: (options?: import("./types.d.ts").StoreUseOptions) => string | null;
279
- trySignalType: (options?: import("./types.d.ts").StoreUseOptions) => SignalType;
280
- tryGuards: (options?: import("./types.d.ts").StoreUseOptions) => string[];
281
- tryAccount: (options?: import("./types.d.ts").StoreUseOptions) => Account<{
282
- [key: string]: string | undefined;
283
- }>;
284
- keyboardHeight: (options?: import("./types.d.ts").StoreUseOptions) => number;
285
- pageState: (options?: import("./types.d.ts").StoreUseOptions) => PageState;
286
- devMode: (options?: import("./types.d.ts").StoreUseOptions) => boolean;
287
- currentPath: (options?: import("./types.d.ts").StoreUseOptions) => string;
288
- };
289
- do: import("./types.d.ts").VoidActions<RootStore> & {
290
- setCsrLoaded: (value: boolean) => void;
291
- setPath: (value: string) => void;
292
- setPathname: (value: string) => void;
293
- setParams: (value: {
294
- [key: string]: string;
295
- }) => void;
296
- setSearchParams: (value: BaseSearchParamsState) => void;
297
- setTheme: (value: string) => void;
298
- setInnerWidth: (value: number) => void;
299
- setInnerHeight: (value: number) => void;
300
- setResponsive: (value: "xl" | "lg" | "md" | "sm" | "xs") => void;
301
- setUiOperation: (value: "idle" | "loading" | "sleep") => void;
302
- setMessages: (value: {
303
- type: "info" | "success" | "error" | "warning" | "loading";
304
- content: string;
305
- duration: number;
306
- key: string;
307
- }[]) => void;
308
- setTryJwt: (value: string | null) => void;
309
- setTrySignalType: (value: SignalType) => void;
310
- setTryGuards: (value: string[]) => void;
311
- setTryAccount: (value: Account<{
312
- [key: string]: string | undefined;
313
- }>) => void;
314
- setKeyboardHeight: (value: number) => void;
315
- setPageState: (value: PageState) => void;
316
- setDevMode: (value: boolean) => void;
317
- setCurrentPath: (value: string) => void;
318
- };
319
- get: () => import("./stateBuilder.d.ts").WritableStateOf<{
320
- csrLoaded: boolean;
321
- path: string;
322
- pathname: string;
323
- params: {
324
- [key: string]: string;
325
- };
326
- searchParams: BaseSearchParamsState;
327
- theme: string;
328
- innerWidth: number;
329
- innerHeight: number;
330
- responsive: Responsive["value"];
331
- uiOperation: "sleep" | "loading" | "idle";
332
- messages: (typeof defaultMessage)[];
333
- tryJwt: string | null;
334
- trySignalType: SignalType;
335
- tryGuards: string[];
336
- tryAccount: Account<{
337
- [key: string]: string | undefined;
338
- }>;
339
- keyboardHeight: number;
340
- pageState: PageState;
341
- devMode: boolean;
342
- currentPath: string;
343
- }>;
344
- set: (state: Partial<import("./stateBuilder.d.ts").WritableStateOf<{
345
- csrLoaded: boolean;
346
- path: string;
347
- pathname: string;
348
- params: {
349
- [key: string]: string;
350
- };
351
- searchParams: BaseSearchParamsState;
352
- theme: string;
353
- innerWidth: number;
354
- innerHeight: number;
355
- responsive: Responsive["value"];
356
- uiOperation: "sleep" | "loading" | "idle";
357
- messages: (typeof defaultMessage)[];
358
- tryJwt: string | null;
359
- trySignalType: SignalType;
360
- tryGuards: string[];
361
- tryAccount: Account<{
362
- [key: string]: string | undefined;
363
- }>;
364
- keyboardHeight: number;
365
- pageState: PageState;
366
- devMode: boolean;
367
- currentPath: string;
368
- }>> | ((state: import("./stateBuilder.d.ts").WritableStateOf<{
369
- csrLoaded: boolean;
370
- path: string;
371
- pathname: string;
372
- params: {
373
- [key: string]: string;
374
- };
375
- searchParams: BaseSearchParamsState;
376
- theme: string;
377
- innerWidth: number;
378
- innerHeight: number;
379
- responsive: Responsive["value"];
380
- uiOperation: "sleep" | "loading" | "idle";
381
- messages: (typeof defaultMessage)[];
382
- tryJwt: string | null;
383
- trySignalType: SignalType;
384
- tryGuards: string[];
385
- tryAccount: Account<{
386
- [key: string]: string | undefined;
387
- }>;
388
- keyboardHeight: number;
389
- pageState: PageState;
390
- devMode: boolean;
391
- currentPath: string;
392
- }>) => any)) => void;
393
- slice: {
394
- [x: `base${Capitalize<string>}`]: import("./withSelector.d.ts").SliceSelectors<"base", import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any, any, "", any, any>, {
395
- [x: `init${any}`]: (...args: any[]) => Promise<void>;
396
- } & {
397
- [x: `refresh${any}`]: (initForm?: (import("akanjs/fetch").FetchInitForm<any, any> & import("akanjs/common").FetchPolicy<unknown> & {
398
- queryArgs?: any[] | undefined;
399
- }) | undefined) => Promise<void>;
400
- } & {
401
- [x: `select${any}`]: (model: any, options?: {
402
- refresh?: boolean;
403
- remove?: boolean;
404
- }) => void;
405
- } & {
406
- [x: `setPageOf${any}`]: (page: number, options?: import("akanjs/common").FetchPolicy) => Promise<void>;
407
- } & {
408
- [x: `loadMoreOf${any}`]: (options?: import("akanjs/common").FetchPolicy) => Promise<void>;
409
- } & {
410
- [x: `setLimitOf${any}`]: (limit: number, options?: import("akanjs/common").FetchPolicy) => Promise<void>;
411
- } & {
412
- [x: `setQueryArgsOf${any}`]: (...args: any[] | [setQueryArgs: (...prevQueryArgs: any[]) => any[], options?: import("akanjs/common").FetchPolicy<unknown> | undefined]) => Promise<void>;
413
- } & {
414
- [x: `setSortOf${any}`]: (sort: any, options?: import("akanjs/common").FetchPolicy) => Promise<void>;
415
- } & {
416
- refName: "base";
417
- suffix: string;
418
- sliceName: `base${Capitalize<string>}`;
419
- get: () => import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any, any, "", any, any>;
420
- set: (setState: Partial<import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any, any, "", any, any>> | ((state: import("./state.d.ts").SliceState<"base", "", any, any, any[], any, any, any, "", any, any>) => void)) => void;
421
- }>;
422
- };
423
- };
129
+ export declare const st: import("./withSelector.d.ts").WithSelectors<typeof RootStore>;
424
130
  export {};
@@ -23,4 +23,10 @@ export type RootStoreCls<RefName extends string = any, WritableState = any, Acti
23
23
  };
24
24
  };
25
25
  _slice: SliceInfoObj;
26
+ _root: {
27
+ writable: WritableState;
28
+ action: Action;
29
+ slice: InternalSliceObj;
30
+ state: State;
31
+ };
26
32
  }>;
@@ -5,7 +5,7 @@ import type { StAgentic } from "./agentic.d.ts";
5
5
  import type { RootStoreCls } from "./rootStore.d.ts";
6
6
  import type { SliceStateAction, StoreUseOptions, VoidActions } from "./types.d.ts";
7
7
  type SetKey<Key extends string> = `set${Capitalize<Key>}`;
8
- export type WithSelectors<RtStoreCls extends RootStoreCls> = RtStoreCls extends RootStoreCls<any, infer WritableState, infer Action, infer InternalSliceObj, any, any, infer State> ? WithSelectorsOf<State, WritableState, Action, InternalSliceObj> : never;
8
+ export type WithSelectors<RtStoreCls extends RootStoreCls> = WithSelectorsOf<RtStoreCls["_root"]["state"], RtStoreCls["_root"]["writable"], RtStoreCls["_root"]["action"], RtStoreCls["_root"]["slice"]>;
9
9
  type WithSelectorsOf<State, WritableState, Action, InternalSliceObj> = StAgentic & {
10
10
  sub: {
11
11
  (listener: (state: State, prev: State) => void): () => void;