@akanjs/store 0.9.56 → 0.9.57

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/cjs/src/baseSt.js CHANGED
@@ -49,7 +49,8 @@ class RootStore extends (0, import_storeDecorators.store)("root", {
49
49
  messages: [],
50
50
  tryJwt: null,
51
51
  trySignalType: "graphql",
52
- tryRoles: [...import_signal.roleTypes],
52
+ tryRoles: [],
53
+ //[...roleTypes] as RoleType[],
53
54
  tryAccount: import_signal.defaultAccount,
54
55
  keyboardHeight: 0,
55
56
  pageState: import_client.defaultPageState,
@@ -783,10 +783,7 @@ const makeActions = (refName, slices) => {
783
783
  sortOfModel,
784
784
  options
785
785
  ),
786
- fetch[namesOfSlice.modelInsight](
787
- ...queryArgs,
788
- options
789
- )
786
+ fetch[namesOfSlice.modelInsight](...queryArgs, options)
790
787
  ]);
791
788
  const modelList = new import_base.DataList(modelDataList);
792
789
  this.set({
@@ -992,8 +989,6 @@ const makePicker = (set, get) => (...fields) => {
992
989
  throw new Error(`Field ${field} is not ready`);
993
990
  if (typeof val === "string" && val.length === 0)
994
991
  throw new Error(`Field is empty string (${field})`);
995
- else if (["self", "me"].includes(field) && !state[field].id?.length)
996
- throw new Error("Self or Me Id is not defined");
997
992
  ret[field] = val;
998
993
  }
999
994
  return ret;
package/esm/src/baseSt.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defaultPageState } from "@akanjs/client";
2
2
  import { Responsive, responsiveWidths } from "@akanjs/constant";
3
- import { defaultAccount, roleTypes } from "@akanjs/signal";
3
+ import { defaultAccount } from "@akanjs/signal";
4
4
  import { baseSt, store } from "./storeDecorators";
5
5
  import { storeInfo } from "./storeInfo";
6
6
  const defaultMessage = {
@@ -25,7 +25,8 @@ class RootStore extends store("root", {
25
25
  messages: [],
26
26
  tryJwt: null,
27
27
  trySignalType: "graphql",
28
- tryRoles: [...roleTypes],
28
+ tryRoles: [],
29
+ //[...roleTypes] as RoleType[],
29
30
  tryAccount: defaultAccount,
30
31
  keyboardHeight: 0,
31
32
  pageState: defaultPageState,
@@ -770,10 +770,7 @@ const makeActions = (refName, slices) => {
770
770
  sortOfModel,
771
771
  options
772
772
  ),
773
- fetch[namesOfSlice.modelInsight](
774
- ...queryArgs,
775
- options
776
- )
773
+ fetch[namesOfSlice.modelInsight](...queryArgs, options)
777
774
  ]);
778
775
  const modelList = new DataList(modelDataList);
779
776
  this.set({
@@ -979,8 +976,6 @@ const makePicker = (set, get) => (...fields) => {
979
976
  throw new Error(`Field ${field} is not ready`);
980
977
  if (typeof val === "string" && val.length === 0)
981
978
  throw new Error(`Field is empty string (${field})`);
982
- else if (["self", "me"].includes(field) && !state[field].id?.length)
983
- throw new Error("Self or Me Id is not defined");
984
979
  ret[field] = val;
985
980
  }
986
981
  return ret;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/store",
3
- "version": "0.9.56",
3
+ "version": "0.9.57",
4
4
  "sourceType": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/src/baseSt.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Responsive } from "@akanjs/constant";
2
- import { RoleType, SignalType } from "@akanjs/signal";
2
+ import { Account, SignalType } from "@akanjs/signal";
3
3
  import { StoreOf } from "./storeDecorators";
4
4
  declare const defaultMessage: {
5
5
  type: "info" | "success" | "error" | "warning" | "loading";
@@ -7,7 +7,7 @@ declare const defaultMessage: {
7
7
  duration: number;
8
8
  key: string;
9
9
  };
10
- declare const RootStore_base: import("@akanjs/base").Type<import("./storeDecorators").StoreInstance<{
10
+ declare const RootStore_base: new (...args: any[]) => import("./storeDecorators").StoreInstance<{
11
11
  csrLoaded: boolean;
12
12
  path: string;
13
13
  pathname: string;
@@ -21,19 +21,15 @@ declare const RootStore_base: import("@akanjs/base").Type<import("./storeDecorat
21
21
  prefix: string | undefined;
22
22
  innerWidth: number;
23
23
  innerHeight: number;
24
- responsive: Responsive;
24
+ responsive: Responsive["value"];
25
25
  uiOperation: "sleep" | "loading" | "idle";
26
26
  messages: (typeof defaultMessage)[];
27
27
  tryJwt: string | null;
28
28
  trySignalType: SignalType;
29
- tryRoles: RoleType[];
30
- tryAccount: {
31
- __InternalArg__: "Account";
32
- self?: import("@akanjs/signal").Self;
33
- me?: import("@akanjs/signal").Me;
34
- appName: string;
35
- environment: import("@akanjs/base").Environment;
36
- };
29
+ tryRoles: string[];
30
+ tryAccount: Account<{
31
+ [key: string]: string | undefined;
32
+ }>;
37
33
  keyboardHeight: number;
38
34
  pageState: import("@akanjs/client").PageState;
39
35
  devMode: boolean;
@@ -42,7 +38,7 @@ declare const RootStore_base: import("@akanjs/base").Type<import("./storeDecorat
42
38
  }) => Promise<void>;
43
39
  deviceToken: string;
44
40
  currentPath: string;
45
- }, {}, {}>>;
41
+ }, {}, {}>;
46
42
  export declare class RootStore extends RootStore_base {
47
43
  setDevMode(value: boolean): void;
48
44
  setWindowSize(): void;
@@ -1,7 +1,7 @@
1
- import { DataList, type GetActionObject, type GetStateObject, type MergeAllKeyOfTypes, type MergeAllTypes, type MergedValues, type Prettify, Type } from "@akanjs/base";
1
+ import { DataList, type GetStateObject, type MergeAllKeyOfTypes, type MergeAllTypes, type MergedValues, type Prettify, Type } from "@akanjs/base";
2
2
  import { type FetchPolicy } from "@akanjs/common";
3
3
  import { DefaultOf, DocumentModel, FieldState, ProtoFile, QueryOf } from "@akanjs/constant";
4
- import type { FilterType, SortOf } from "@akanjs/document";
4
+ import type { ExtractQuery, ExtractSort, FilterInstance } from "@akanjs/document";
5
5
  import { DbGraphQL, type DynamicSliceArgMap, FetchInitForm, SerializedSignal, SliceMeta } from "@akanjs/signal";
6
6
  import { RefObject } from "react";
7
7
  import { Mutate, StoreApi } from "zustand";
@@ -34,7 +34,7 @@ type BaseState<T extends string, Full, _Default = DefaultOf<Full>> = {
34
34
  };
35
35
  type SliceState<T extends string, Full, Light extends {
36
36
  id: string;
37
- }, QueryArgs, Insight, Filter extends FilterType, _CapitalizedT extends string = Capitalize<T>, _Default = DefaultOf<Full>, _Sort = SortOf<Filter>> = {
37
+ }, QueryArgs, Insight, Filter extends FilterInstance, _CapitalizedT extends string = Capitalize<T>, _Default = DefaultOf<Full>, _Sort = ExtractSort<Filter>> = {
38
38
  [K in `default${_CapitalizedT}`]: _Default;
39
39
  } & {
40
40
  [K in `${T}List`]: DataList<Light>;
@@ -61,7 +61,7 @@ type SliceState<T extends string, Full, Light extends {
61
61
  };
62
62
  type DefaultState<T extends string, Input, Full, Light extends {
63
63
  id: string;
64
- }, Insight, Filter extends FilterType, Signal, _CapitalizedT extends string = Capitalize<T>, _Default = DefaultOf<Full>, _DefaultInput = DefaultOf<Input>, _DefaultState = GetStateObject<Full>, _DefaultStateInput = GetStateObject<Input>, _Doc = DocumentModel<Full>, _DocInput = DocumentModel<Input>, _QueryOfDoc = QueryOf<DocumentModel<Full>>, _Query = GetActionObject<Filter>, _Sort = SortOf<Filter>, _DynamicSliceArgMap = DynamicSliceArgMap<T, Input, Full, Filter, Signal, _CapitalizedT, _DefaultInput, _Sort>, _DefaultSliceState = SliceState<T, Full, Light, [
64
+ }, Insight, Filter extends FilterInstance, Signal, _CapitalizedT extends string = Capitalize<T>, _Default = DefaultOf<Full>, _DefaultInput = DefaultOf<Input>, _DefaultState = GetStateObject<Full>, _DefaultStateInput = GetStateObject<Input>, _Doc = DocumentModel<Full>, _DocInput = DocumentModel<Input>, _QueryOfDoc = QueryOf<DocumentModel<Full>>, _Query = ExtractQuery<Filter>, _Sort = ExtractSort<Filter>, _DynamicSliceArgMap = DynamicSliceArgMap<T, Input, Full, Filter, Signal, _CapitalizedT, _DefaultInput, _Sort>, _DefaultSliceState = SliceState<T, Full, Light, [
65
65
  query: _QueryOfDoc
66
66
  ], Insight, Filter, _CapitalizedT, _Default, _Sort>, _DynamicSliceStateMap = {
67
67
  [Suffix in keyof _DynamicSliceArgMap as Suffix extends string ? Suffix : never]: Suffix extends string ? SliceState<T, Full, Light, _DynamicSliceArgMap[Suffix], Insight, Filter, _CapitalizedT, _Default, _Sort> : never;
@@ -142,7 +142,7 @@ type BaseAction<T extends string, Input, Full extends {
142
142
  };
143
143
  type SliceAction<T extends string, Input, Full extends {
144
144
  id: string;
145
- }, Light, QueryArgs extends any[], Filter extends FilterType, _CapitalizedT extends string = Capitalize<T>, _Sort = SortOf<Filter>, _FetchInitFormWithFetchPolicy = FetchInitForm<Input, Full, Filter> & FetchPolicy> = {
145
+ }, Light, QueryArgs extends any[], Filter extends FilterInstance, _CapitalizedT extends string = Capitalize<T>, _Sort = ExtractSort<Filter>, _FetchInitFormWithFetchPolicy = FetchInitForm<Input, Full, Filter> & FetchPolicy> = {
146
146
  [K in `init${_CapitalizedT}`]: (...args: [...args: QueryArgs, initForm?: _FetchInitFormWithFetchPolicy]) => Promise<void>;
147
147
  } & {
148
148
  [K in `refresh${_CapitalizedT}`]: (...args: [...args: QueryArgs, initForm?: _FetchInitFormWithFetchPolicy]) => Promise<void>;
@@ -164,7 +164,7 @@ type SliceAction<T extends string, Input, Full extends {
164
164
  };
165
165
  type DefaultActions<T extends string, Input, Full extends {
166
166
  id: string;
167
- }, Light, Filter extends FilterType, Fetch, Signal, _CapitalizedT extends string = Capitalize<T>, _Default = DefaultOf<Full>, _DefaultInput = DefaultOf<Input>, _DefaultState = GetStateObject<_Default>, _DefaultStateInput = GetStateObject<_DefaultInput>, _Doc = DocumentModel<Full>, _DocInput = DocumentModel<Input>, _QueryOfDoc = QueryOf<DocumentModel<Full>>, _Sort = SortOf<Filter>, _DynamicSliceArgMap = DynamicSliceArgMap<T, Input, Full, Filter, Signal, _CapitalizedT, _DefaultInput, _Sort>, _CreateOption = CreateOption<Full>, _FetchInitFormWithFetchPolicy = FetchInitForm<Input, Full, Filter> & FetchPolicy, _DefaultSliceAction = SliceAction<T, Input, Full, Light, [
167
+ }, Light, Filter extends FilterInstance, Fetch, Signal, _CapitalizedT extends string = Capitalize<T>, _Default = DefaultOf<Full>, _DefaultInput = DefaultOf<Input>, _DefaultState = GetStateObject<_Default>, _DefaultStateInput = GetStateObject<_DefaultInput>, _Doc = DocumentModel<Full>, _DocInput = DocumentModel<Input>, _QueryOfDoc = QueryOf<DocumentModel<Full>>, _Sort = ExtractSort<Filter>, _DynamicSliceArgMap = DynamicSliceArgMap<T, Input, Full, Filter, Signal, _CapitalizedT, _DefaultInput, _Sort>, _CreateOption = CreateOption<Full>, _FetchInitFormWithFetchPolicy = FetchInitForm<Input, Full, Filter> & FetchPolicy, _DefaultSliceAction = SliceAction<T, Input, Full, Light, [
168
168
  query: _QueryOfDoc
169
169
  ], Filter, _CapitalizedT, _Sort, _FetchInitFormWithFetchPolicy>, _DynamicSliceActionMap = {
170
170
  [Suffix in keyof _DynamicSliceArgMap as Suffix extends string ? Suffix : never]: Suffix extends string ? _DynamicSliceArgMap[Suffix] extends any[] ? SliceAction<T, Input, Full, Light, _DynamicSliceArgMap[Suffix], Filter, _CapitalizedT, _Sort, _FetchInitFormWithFetchPolicy> : never : never;
@@ -218,9 +218,9 @@ export type DatabaseStore<T extends string, Input, Full extends {
218
218
  id: string;
219
219
  }, Light extends {
220
220
  id: string;
221
- }, Insight, Filter extends FilterType, Fetch, Signal, State extends {
221
+ }, Insight, Filter extends FilterInstance, Fetch, Signal, State extends {
222
222
  [key: string]: any;
223
- }, _CapitalizedT extends string = Capitalize<T>, _Default = DefaultOf<Full>, _DefaultInput = DefaultOf<Input>, _DefaultState = GetStateObject<Full>, _DefaultStateInput = GetStateObject<Input>, _Doc = DocumentModel<Full>, _DocInput = DocumentModel<Input>, _QueryOfDoc = QueryOf<DocumentModel<Full>>, _Query = GetActionObject<Filter>, _Sort = SortOf<Filter>, _DynamicSliceArgMap = DynamicSliceArgMap<T, Input, Full, Filter, Signal, _CapitalizedT, _DefaultInput, _Sort>, _CreateOption = CreateOption<Full>, _FetchInitFormWithFetchPolicy = FetchInitForm<Input, Full, Filter> & FetchPolicy, _DefaultSliceState = SliceState<T, Full, Light, [
223
+ }, _CapitalizedT extends string = Capitalize<T>, _Default = DefaultOf<Full>, _DefaultInput = DefaultOf<Input>, _DefaultState = GetStateObject<Full>, _DefaultStateInput = GetStateObject<Input>, _Doc = DocumentModel<Full>, _DocInput = DocumentModel<Input>, _QueryOfDoc = QueryOf<DocumentModel<Full>>, _Query = ExtractQuery<Filter>, _Sort = ExtractSort<Filter>, _DynamicSliceArgMap = DynamicSliceArgMap<T, Input, Full, Filter, Signal, _CapitalizedT, _DefaultInput, _Sort>, _CreateOption = CreateOption<Full>, _FetchInitFormWithFetchPolicy = FetchInitForm<Input, Full, Filter> & FetchPolicy, _DefaultSliceState = SliceState<T, Full, Light, [
224
224
  query: _QueryOfDoc
225
225
  ], Insight, Filter, _CapitalizedT, _Default, _Sort>, _DynamicSliceStateMap = {
226
226
  [Suffix in keyof _DynamicSliceArgMap as Suffix extends string ? Suffix : never]: Suffix extends string ? SliceState<T, Full, Light, _DynamicSliceArgMap[Suffix], Insight, Filter, _CapitalizedT, _Default, _Sort> : never;
@@ -1,8 +1,8 @@
1
1
  import type { Type } from "@akanjs/base";
2
2
  import type { SerializedSignal } from "@akanjs/signal";
3
3
  export declare const storeInfo: {
4
- store: Map<string, Type>;
5
- storeRefNameMap: Map<Type, string>;
4
+ store: Map<string, new (...args: any[]) => any>;
5
+ storeRefNameMap: Map<new (...args: any[]) => any, string>;
6
6
  setRefNameTemp(refName: string, store: Type): void;
7
7
  getRefNameTemp(store: Type): string;
8
8
  setState(storeRef: Type, applyState: {