akanjs 3.2.0-rc.11 → 3.2.0-rc.13
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/ARCHITECTURE.md +17 -17
- package/CHANGELOG.md +24 -0
- package/base/base.ts +2 -1
- package/client/clientRuntime.ts +1 -0
- package/client/cn.ts +2 -2
- package/client/csrTypes.ts +2 -0
- package/client/frameConfig.ts +1 -0
- package/client/index.ts +249 -26
- package/client/locale.ts +1 -0
- package/client/route/RouteDefinition.ts +24 -7
- package/client/route/routeArgs.ts +7 -0
- package/client/router.ts +12 -2
- package/client/rscNavigation.ts +1 -0
- package/common/CodeTranscript.ts +1 -1
- package/constant/constantRegistry.ts +4 -8
- package/constant/crystalize.ts +1 -2
- package/constant/getDefault.ts +1 -1
- package/constant/immerify.ts +1 -1
- package/constant/index.ts +78 -21
- package/constant/purify.ts +4 -9
- package/constant/serialize.ts +4 -2
- package/constant/types.ts +1 -0
- package/constant/via.ts +1 -2
- package/dictionary/locale.ts +1 -1
- package/document/databaseRegistry.ts +2 -1
- package/document/documentSchema.ts +1 -0
- package/document/filterMeta.ts +4 -1
- package/document/into.ts +2 -1
- package/document/loaderInfo.ts +2 -1
- package/document/types.ts +1 -1
- package/fetch/client/fetchClient.ts +3 -3
- package/fetch/client/httpClient.ts +2 -0
- package/fetch/client/wsClient.ts +1 -0
- package/package.json +1 -1
- package/server/akanApp.ts +103 -1270
- package/server/akanServer.ts +1 -1
- package/server/console.ts +3 -2
- package/server/gateway/childSupervisor.ts +325 -0
- package/server/gateway/devHostChannel.ts +40 -0
- package/server/gateway/gatewayChildren.ts +135 -0
- package/server/gateway/gatewayConfig.ts +182 -0
- package/server/gateway/gatewayHttpProxy.ts +231 -0
- package/server/gateway/gatewayLogging.ts +111 -0
- package/server/gateway/gatewayRooms.ts +134 -0
- package/server/gateway/gatewayStatus.ts +116 -0
- package/server/gateway/gatewayStatusPage.ts +54 -0
- package/server/gateway/gatewayWebSocketRelay.ts +149 -0
- package/server/index.ts +257 -17
- package/server/logging/logControlSocket.ts +42 -3
- package/server/mcp/McpDispatcher.ts +6 -24
- package/server/rscClient.tsx +14 -8
- package/server/sitemap.ts +1 -0
- package/service/injectInfo.ts +2 -1
- package/service/predefinedAdaptor/sql/driver/bunSqlite.ts +3 -3
- package/service/predefinedAdaptor/sql/driver/postgres.ts +1 -1
- package/service/serviceRegistry.ts +1 -0
- package/signal/SignalFailure.ts +21 -0
- package/signal/agentTurnStream.ts +5 -2
- package/signal/index.ts +298 -30
- package/signal/resolveFieldContext.ts +34 -0
- package/signal/serializer/fetch.serializer.ts +7 -10
- package/signal/signalContext.ts +4 -31
- package/signal/trace.ts +3 -0
- package/store/baseSt.ts +1 -0
- package/store/index.ts +125 -18
- package/store/stateBuilder.ts +2 -0
- package/types/base/base.d.ts +2 -1
- package/types/client/clientRuntime.d.ts +1 -0
- package/types/client/cn.d.ts +2 -2
- package/types/client/csrTypes.d.ts +2 -0
- package/types/client/frameConfig.d.ts +1 -0
- package/types/client/index.d.ts +25 -26
- package/types/client/locale.d.ts +1 -0
- package/types/client/route/RouteDefinition.d.ts +2 -2
- package/types/client/route/routeArgs.d.ts +6 -0
- package/types/client/router.d.ts +2 -1
- package/types/client/rscNavigation.d.ts +1 -0
- package/types/common/CodeTranscript.d.ts +1 -1
- package/types/constant/constantRegistry.d.ts +3 -1
- package/types/constant/crystalize.d.ts +1 -1
- package/types/constant/getDefault.d.ts +1 -1
- package/types/constant/immerify.d.ts +1 -1
- package/types/constant/index.d.ts +21 -21
- package/types/constant/purify.d.ts +2 -1
- package/types/constant/serialize.d.ts +1 -1
- package/types/constant/types.d.ts +1 -0
- package/types/dictionary/base.dictionary.d.ts +1 -1
- package/types/dictionary/dictionary.d.ts +8 -8
- package/types/dictionary/locale.d.ts +1 -1
- package/types/document/databaseRegistry.d.ts +2 -1
- package/types/document/documentSchema.d.ts +1 -0
- package/types/document/filterMeta.d.ts +4 -1
- package/types/document/into.d.ts +1 -1
- package/types/document/loaderInfo.d.ts +2 -1
- package/types/document/types.d.ts +1 -1
- package/types/fetch/client/fetchClient.d.ts +2 -1
- package/types/fetch/client/httpClient.d.ts +2 -0
- package/types/fetch/client/wsClient.d.ts +1 -0
- package/types/server/akanApp.d.ts +2 -20
- package/types/server/console.d.ts +3 -2
- package/types/server/gateway/childSupervisor.d.ts +33 -0
- package/types/server/gateway/devHostChannel.d.ts +13 -0
- package/types/server/gateway/gatewayChildren.d.ts +47 -0
- package/types/server/gateway/gatewayConfig.d.ts +82 -0
- package/types/server/gateway/gatewayHttpProxy.d.ts +22 -0
- package/types/server/gateway/gatewayLogging.d.ts +16 -0
- package/types/server/gateway/gatewayRooms.d.ts +22 -0
- package/types/server/gateway/gatewayStatus.d.ts +62 -0
- package/types/server/gateway/gatewayStatusPage.d.ts +9 -0
- package/types/server/gateway/gatewayWebSocketRelay.d.ts +17 -0
- package/types/server/index.d.ts +17 -17
- package/types/server/logging/rotatingLogWriter.d.ts +1 -1
- package/types/server/sitemap.d.ts +1 -0
- package/types/service/injectInfo.d.ts +2 -1
- package/types/service/predefinedAdaptor/sql/driver/bunSqlite.d.ts +1 -14
- package/types/service/predefinedAdaptor/sql/driver/postgres.d.ts +0 -8
- package/types/service/serviceRegistry.d.ts +1 -0
- package/types/signal/SignalFailure.d.ts +1 -0
- package/types/signal/agentTurnStream.d.ts +1 -0
- package/types/signal/index.d.ts +31 -30
- package/types/signal/resolveFieldContext.d.ts +15 -0
- package/types/signal/serializer/fetch.serializer.d.ts +3 -1
- package/types/signal/signalContext.d.ts +1 -13
- package/types/signal/trace.d.ts +3 -0
- package/types/store/baseSt.d.ts +1 -0
- package/types/store/index.d.ts +17 -17
- package/types/store/stateBuilder.d.ts +2 -0
- package/types/ui/Agent/Chat.d.ts +5 -2
- package/types/ui/Agent/ChatHeader.d.ts +13 -0
- package/types/ui/Agent/ChatPendingCards.d.ts +23 -0
- package/types/ui/Reference/origin.d.ts +1 -0
- package/types/ui/overlayLayer.d.ts +6 -1
- package/types/vendor/@akanjs/native/packages/cli/src/lib/project.d.ts +4 -0
- package/types/vendor/@akanjs/native/packages/desktop/src/relaunch.d.ts +1 -0
- package/types/vendor/@akanjs/native/plugins/external-view/src/index.d.ts +14 -10
- package/types/vendor/use-agentic/failureCode.d.ts +4 -0
- package/types/vendor/use-agentic/types.d.ts +6 -0
- package/types/webkit/CsrGuards.d.ts +2 -0
- package/ui/Agent/Chat.tsx +96 -116
- package/ui/Agent/ChatHeader.tsx +59 -0
- package/ui/Agent/ChatPendingCards.tsx +49 -0
- package/ui/Agent/fetchRunner.ts +8 -1
- package/ui/BottomSheet.tsx +1 -1
- package/ui/Dialog/LegacyModal.tsx +1 -1
- package/ui/Dialog/Modal.tsx +1 -1
- package/ui/Popconfirm.tsx +1 -1
- package/ui/Reference/origin.ts +1 -0
- package/ui/overlayLayer.ts +22 -1
- package/vendor/@akanjs/native/CHANGELOG.md +6 -1
- package/vendor/@akanjs/native/native/desktop/src/external.rs +213 -111
- package/vendor/@akanjs/native/native/desktop/src/lib.rs +12 -4
- package/vendor/@akanjs/native/native/desktop/src/linux/external.rs +275 -0
- package/vendor/@akanjs/native/native/desktop/src/linux/mod.rs +1 -0
- package/vendor/@akanjs/native/packages/cli/src/lib/native-plugins.ts +5 -3
- package/vendor/@akanjs/native/packages/cli/src/lib/project.ts +25 -1
- package/vendor/@akanjs/native/packages/desktop/src/deeplinks.ts +2 -2
- package/vendor/@akanjs/native/packages/desktop/src/host.ts +2 -2
- package/vendor/@akanjs/native/packages/desktop/src/relaunch.ts +8 -3
- package/vendor/@akanjs/native/plugins/app/src/desktop.ts +2 -2
- package/vendor/@akanjs/native/plugins/autostart/src/desktop.ts +2 -1
- package/vendor/@akanjs/native/plugins/external-view/native-plugin.json +4 -1
- package/vendor/@akanjs/native/plugins/external-view/src/index.ts +14 -10
- package/vendor/use-agentic/AgentSession.ts +11 -11
- package/vendor/use-agentic/CHANGELOG.md +6 -0
- package/vendor/use-agentic/Compaction.ts +2 -1
- package/vendor/use-agentic/ToolRunner.ts +3 -15
- package/vendor/use-agentic/Transcript.ts +6 -3
- package/vendor/use-agentic/WIRE.md +12 -1
- package/vendor/use-agentic/failureCode.ts +44 -0
- package/vendor/use-agentic/httpRunner.ts +14 -3
- package/vendor/use-agentic/types.ts +6 -0
- package/webkit/CsrGuards.ts +7 -2
- package/webkit/useLocation.ts +3 -2
|
@@ -8,16 +8,12 @@ import {
|
|
|
8
8
|
type PrimitiveValue,
|
|
9
9
|
} from "akanjs/base";
|
|
10
10
|
import { capitalize, lowerlize } from "akanjs/common";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
type ConstantModelRef,
|
|
14
|
-
deserialize,
|
|
15
|
-
type FieldObject,
|
|
16
|
-
type PurifiedModel,
|
|
17
|
-
serialize,
|
|
18
|
-
} from ".";
|
|
11
|
+
import type { FieldObject } from "./fieldInfo";
|
|
12
|
+
import type { PurifiedModel } from "./purify";
|
|
19
13
|
import { RefNameClaims, type RefNameOwner } from "./refNameClaims";
|
|
14
|
+
import { deserialize, serialize } from "./serialize";
|
|
20
15
|
import type { ConstantType, DefaultOf, DocumentModel, QueryOf } from "./types";
|
|
16
|
+
import type { ConstantCls, ConstantModelRef } from "./via";
|
|
21
17
|
|
|
22
18
|
export class ConstantRegistry {
|
|
23
19
|
static database = new Map<string, ConstantModel>();
|
package/constant/crystalize.ts
CHANGED
|
@@ -6,9 +6,8 @@ import {
|
|
|
6
6
|
PrimitiveRegistry,
|
|
7
7
|
type PrimitiveScalar,
|
|
8
8
|
} from "akanjs/base";
|
|
9
|
-
|
|
10
|
-
import type { FieldProps } from ".";
|
|
11
9
|
import { ConstantRegistry } from "./constantRegistry";
|
|
10
|
+
import type { FieldProps } from "./fieldInfo";
|
|
12
11
|
|
|
13
12
|
export type CrystalizeFunc<Model> = (self: GetStateObject<Model>, isChild?: boolean) => Model;
|
|
14
13
|
export type Converter = (value: unknown) => unknown;
|
package/constant/getDefault.ts
CHANGED
package/constant/immerify.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FIELD_META } from "akanjs/base";
|
|
2
2
|
import { plainFieldsOf } from "akanjs/common";
|
|
3
3
|
import { immerable } from "immer";
|
|
4
|
-
import type { ConstantModelRef } from "
|
|
4
|
+
import type { ConstantModelRef } from "./via";
|
|
5
5
|
|
|
6
6
|
export const immerify = <T extends object>(modelRef: ConstantModelRef, objOrArr: T): T => {
|
|
7
7
|
if (Array.isArray(objOrArr)) return objOrArr.map((val) => immerify(modelRef, val as object)) as T;
|
package/constant/index.ts
CHANGED
|
@@ -1,21 +1,78 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
export { type CascadeAction, CascadePaths, type CascadeWithPath, cascadeActions } from "./cascadePaths";
|
|
2
|
+
export {
|
|
3
|
+
type ConstantModel,
|
|
4
|
+
type ConstantOriginKind,
|
|
5
|
+
ConstantRegistry,
|
|
6
|
+
type ScalarConstantModel,
|
|
7
|
+
} from "./constantRegistry";
|
|
8
|
+
export { type Converter, type CrystalizeFunc, converterOf, crystalize, withSharedInstances } from "./crystalize";
|
|
9
|
+
export { dateAccessorOf, dateSlotOf, isDateSlotField, toDateValue } from "./dateSlot";
|
|
10
|
+
export {
|
|
11
|
+
ConstantField,
|
|
12
|
+
type ConstantFieldKind,
|
|
13
|
+
type ConstantFieldProps,
|
|
14
|
+
type ConstantFieldType,
|
|
15
|
+
type ConstantFieldTypeInput,
|
|
16
|
+
type ExtractFieldInfoObject,
|
|
17
|
+
type FieldBuilder,
|
|
18
|
+
type FieldInfoObject,
|
|
19
|
+
type FieldInfoObjectToFieldObject,
|
|
20
|
+
type FieldObject,
|
|
21
|
+
type FieldPreset,
|
|
22
|
+
type FieldProps,
|
|
23
|
+
type FieldResolver,
|
|
24
|
+
type FieldToValue,
|
|
25
|
+
field,
|
|
26
|
+
fieldPresets,
|
|
27
|
+
type ParamFieldType,
|
|
28
|
+
type PlainTypeToFieldType,
|
|
29
|
+
resolve,
|
|
30
|
+
} from "./fieldInfo";
|
|
31
|
+
export { FieldPlan, type FieldPlanEntry, type FieldPlanKind } from "./fieldPlan";
|
|
32
|
+
export { type FieldQueryMeta, fieldQueryMetaOf } from "./fieldQueryMeta";
|
|
33
|
+
export { type DefaultPlan, defaultPlanOf, freshPrimitiveValue, getDefault } from "./getDefault";
|
|
34
|
+
export { HydrationPlan } from "./hydrationPlan";
|
|
35
|
+
export { immerify } from "./immerify";
|
|
36
|
+
export { InputParser } from "./inputParser";
|
|
37
|
+
export { InvalidInputError } from "./invalidInputError";
|
|
38
|
+
export { labelOf } from "./labelOf";
|
|
39
|
+
export { agentRead, leakingFieldsOf, type MaskModel, mask, maskFieldsOf, stripSecrets } from "./mask";
|
|
40
|
+
export { makePurify, type PurifiedModel, type PurifyFunc, type PurifyFuncV2, type UploadableClientArg } from "./purify";
|
|
41
|
+
export { RequestValue } from "./requestValue";
|
|
42
|
+
export { deserialize, type Serialized, serialize } from "./serialize";
|
|
43
|
+
export { TextFieldPathSet } from "./textFieldPathSet";
|
|
44
|
+
export { TextFieldPaths, type TextFieldRole, textFieldRoles } from "./textFieldPaths";
|
|
45
|
+
export {
|
|
46
|
+
BaseInsight,
|
|
47
|
+
BaseObject,
|
|
48
|
+
type ConstantType,
|
|
49
|
+
DEFAULT_PAGE_SIZE,
|
|
50
|
+
type DefaultOf,
|
|
51
|
+
type DefaultOfSchema,
|
|
52
|
+
type DocumentModel,
|
|
53
|
+
type FieldState,
|
|
54
|
+
type GetPlainObject,
|
|
55
|
+
MAX_INT,
|
|
56
|
+
MAX_PAGE_SIZE,
|
|
57
|
+
type NonFunctionalKeys,
|
|
58
|
+
type ProtoAppInfo,
|
|
59
|
+
type ProtoFile,
|
|
60
|
+
type ProtoLightFile,
|
|
61
|
+
type ProtoPatch,
|
|
62
|
+
type QueryOf,
|
|
63
|
+
Responsive,
|
|
64
|
+
resolvePageLimit,
|
|
65
|
+
resolvePageSkip,
|
|
66
|
+
responsiveWidths,
|
|
67
|
+
type ServerArgModel,
|
|
68
|
+
unsetDate,
|
|
69
|
+
} from "./types";
|
|
70
|
+
export {
|
|
71
|
+
type ConstantCls,
|
|
72
|
+
type ConstantMethods,
|
|
73
|
+
type ConstantModelRef,
|
|
74
|
+
type ConstantStatics,
|
|
75
|
+
type DatabaseConstantStatics,
|
|
76
|
+
type DocumentConstantModelRef,
|
|
77
|
+
via,
|
|
78
|
+
} from "./via";
|
package/constant/purify.ts
CHANGED
|
@@ -12,15 +12,10 @@ import {
|
|
|
12
12
|
type PrimitiveScalar,
|
|
13
13
|
} from "akanjs/base";
|
|
14
14
|
import { Logger } from "akanjs/common";
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
ConstantRegistry,
|
|
20
|
-
type DefaultOf,
|
|
21
|
-
type DefaultOfSchema,
|
|
22
|
-
type FieldProps,
|
|
23
|
-
} from ".";
|
|
15
|
+
import { ConstantRegistry } from "./constantRegistry";
|
|
16
|
+
import type { FieldProps } from "./fieldInfo";
|
|
17
|
+
import type { BaseObject, DefaultOf, DefaultOfSchema } from "./types";
|
|
18
|
+
import type { ConstantModelRef } from "./via";
|
|
24
19
|
|
|
25
20
|
type Purified<O> = O extends BaseObject
|
|
26
21
|
? string
|
package/constant/serialize.ts
CHANGED
|
@@ -10,9 +10,11 @@ import {
|
|
|
10
10
|
PrimitiveRegistry,
|
|
11
11
|
type PrimitiveScalar,
|
|
12
12
|
} from "akanjs/base";
|
|
13
|
-
|
|
14
|
-
import {
|
|
13
|
+
import { ConstantRegistry } from "./constantRegistry";
|
|
14
|
+
import { withSharedInstances } from "./crystalize";
|
|
15
|
+
import type { FieldProps } from "./fieldInfo";
|
|
15
16
|
import { FieldPlan } from "./fieldPlan";
|
|
17
|
+
import type { ConstantCls, ConstantModelRef } from "./via";
|
|
16
18
|
|
|
17
19
|
export type Serialized<O> = O extends (infer V)[]
|
|
18
20
|
? Serialized<V>[]
|
package/constant/types.ts
CHANGED
|
@@ -139,6 +139,7 @@ export type NonFunctionalKeys<T> = {
|
|
|
139
139
|
}[keyof T];
|
|
140
140
|
|
|
141
141
|
export const unsetDate = dayjs(new Date("0000"));
|
|
142
|
+
/** @deprecated Unused by akanjs; write the int32 bound `2 ** 31 - 1` where it is meant. */
|
|
142
143
|
export const MAX_INT = 2147483647;
|
|
143
144
|
|
|
144
145
|
export class Responsive extends enumOf("responsive", ["xl", "lg", "md", "sm", "xs"] as const) {}
|
package/constant/via.ts
CHANGED
|
@@ -13,8 +13,6 @@ import {
|
|
|
13
13
|
} from "akanjs/base";
|
|
14
14
|
import { applyMixins, plainFieldsOf } from "akanjs/common";
|
|
15
15
|
import { immerable } from "immer";
|
|
16
|
-
|
|
17
|
-
import { getDefault } from ".";
|
|
18
16
|
import { CascadePaths } from "./cascadePaths";
|
|
19
17
|
import { ConstantRegistry } from "./constantRegistry";
|
|
20
18
|
import { dateAccessorOf, isDateSlotField } from "./dateSlot";
|
|
@@ -30,6 +28,7 @@ import {
|
|
|
30
28
|
resolve,
|
|
31
29
|
} from "./fieldInfo";
|
|
32
30
|
import { FieldPlan } from "./fieldPlan";
|
|
31
|
+
import { getDefault } from "./getDefault";
|
|
33
32
|
import { HydrationPlan } from "./hydrationPlan";
|
|
34
33
|
import { makePurify, type PurifiedModel, type PurifyFunc } from "./purify";
|
|
35
34
|
import { TextFieldPaths } from "./textFieldPaths";
|
package/dictionary/locale.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { GetStateObject, MergedValues } from "akanjs/base";
|
|
2
2
|
import type { BaseInsight, BaseObject } from "akanjs/constant";
|
|
3
3
|
import type { SliceInfo, SliceInfoArgNames, SliceInfoRefName } from "akanjs/signal";
|
|
4
|
-
import type { ModelDictInfo, ScalarDictInfo, ServiceDictInfo } from "
|
|
4
|
+
import type { ModelDictInfo, ScalarDictInfo, ServiceDictInfo } from "./dictInfo";
|
|
5
5
|
import type { DictArgNames, DictEndpointShape, DictFilterQuery, DictFilterSort, DictSliceShape } from "./dictShape";
|
|
6
6
|
|
|
7
7
|
interface Trans {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ConstantCls } from "akanjs/constant";
|
|
2
|
-
import type { DatabaseCls
|
|
2
|
+
import type { DatabaseCls } from "./by";
|
|
3
|
+
import type { ExtractQuery, ExtractSort, FilterCls, FilterInstance } from "./filterMeta";
|
|
3
4
|
import type { ModelCls } from "./loaderInfo";
|
|
4
5
|
|
|
5
6
|
export interface DatabaseModel<
|
|
@@ -105,4 +105,5 @@ export class DocumentSchema<Doc = unknown> {
|
|
|
105
105
|
|
|
106
106
|
export type SchemaOf<Mdl = unknown, Doc = unknown> = DocumentSchema<Doc> & { readonly __model?: Mdl };
|
|
107
107
|
|
|
108
|
+
/** @deprecated Construct `new DocumentSchema()`. */
|
|
108
109
|
export const getDefaultSchemaOptions = <_TSchema, TDocument>() => new DocumentSchema<TDocument>();
|
package/document/filterMeta.ts
CHANGED
|
@@ -26,6 +26,7 @@ import type { ConstantFilterMeta } from "./types";
|
|
|
26
26
|
const isObjectRecord = (value: unknown): value is Record<string, unknown> =>
|
|
27
27
|
typeof value === "object" && value !== null;
|
|
28
28
|
|
|
29
|
+
/** @deprecated Unused by akanjs; `getFilterMeta(ref, { allowEmpty: true }) !== undefined` answers the same. */
|
|
29
30
|
export const isFilterModel = (filterRef: Cls<unknown, { [FILTER_META]?: ConstantFilterMeta }>): boolean =>
|
|
30
31
|
filterRef[FILTER_META] !== undefined;
|
|
31
32
|
export const getFilterMeta = <AllowEmpty extends boolean = false>(
|
|
@@ -36,6 +37,7 @@ export const getFilterMeta = <AllowEmpty extends boolean = false>(
|
|
|
36
37
|
if (!filterMeta && !allowEmpty) throw new Error("filterMeta is not defined");
|
|
37
38
|
return filterMeta as AllowEmpty extends true ? ConstantFilterMeta | undefined : ConstantFilterMeta;
|
|
38
39
|
};
|
|
40
|
+
/** @internal */
|
|
39
41
|
export const setFilterMeta = (
|
|
40
42
|
filterRef: Cls<unknown, { [FILTER_META]?: ConstantFilterMeta; sortField: Set<string> }>,
|
|
41
43
|
filterMeta: ConstantFilterMeta,
|
|
@@ -79,6 +81,7 @@ export const getFilterInfoByKey = <ArgNames extends string[] = [], Args extends
|
|
|
79
81
|
if (!queryMeta) throw new Error(`queryMeta is not defined for key: ${key}`);
|
|
80
82
|
return queryMeta;
|
|
81
83
|
};
|
|
84
|
+
/** @deprecated Unused by akanjs; declare the query in the filter class built with `from(model, (filter) => …)`. */
|
|
82
85
|
export const setFilterInfoByKey = <ArgNames extends string[] = [], Args extends any[] = any[], Model = any>(
|
|
83
86
|
modelRef: Cls<Model>,
|
|
84
87
|
key: string,
|
|
@@ -126,7 +129,7 @@ export interface FilterArgInfo {
|
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
export const DEFAULT_FILTER_ARG_MAX_ITEMS = 1000;
|
|
129
|
-
/** Unwraps a filter arg's declaration the way `EndpointInfo.getArgInfo` unwraps an endpoint's. */
|
|
132
|
+
/** @internal Unwraps a filter arg's declaration the way `EndpointInfo.getArgInfo` unwraps an endpoint's. */
|
|
130
133
|
export const getFilterArgInfo = (arg: FilterInfo["args"][number]): FilterArgInfo => {
|
|
131
134
|
const [singleArg, arrDepth] = getNonArrayModel(arg.argRef as Cls);
|
|
132
135
|
const argIsEnum = isEnum(singleArg);
|
package/document/into.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type Cls, LOADER_META, type PromiseOrObject } from "akanjs/base";
|
|
2
2
|
import { applyMixins } from "akanjs/common";
|
|
3
3
|
import type { DocumentModel, QueryOf } from "akanjs/constant";
|
|
4
|
-
import type { FilterCls, FilterQueryOf, FilterSortOf, SchemaOf } from ".";
|
|
5
4
|
import type { CacheDatabase, QueryMethodPart } from "./database";
|
|
6
5
|
import type { DataLoader } from "./dataLoader";
|
|
7
6
|
import type {
|
|
@@ -11,6 +10,8 @@ import type {
|
|
|
11
10
|
DocumentUpdateInput,
|
|
12
11
|
DocumentUpdateOptions,
|
|
13
12
|
} from "./documentQuery";
|
|
13
|
+
import type { SchemaOf } from "./documentSchema";
|
|
14
|
+
import type { FilterCls, FilterQueryOf, FilterSortOf } from "./filterMeta";
|
|
14
15
|
import { type LoaderBuilder, type ModelCls, makeLoaderBuilder } from "./loaderInfo";
|
|
15
16
|
import type { DocumentProjection } from "./types";
|
|
16
17
|
|
package/document/loaderInfo.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Cls, LOADER_META } from "akanjs/base";
|
|
2
2
|
import type { QueryOf } from "akanjs/constant";
|
|
3
|
-
import type { Loader
|
|
3
|
+
import type { Loader } from "./dataLoader";
|
|
4
|
+
import type { SchemaOf } from "./documentSchema";
|
|
4
5
|
|
|
5
6
|
type LoaderType = "field" | "arrayField" | "query";
|
|
6
7
|
|
package/document/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EnumInstance, GetStateObject } from "akanjs/base";
|
|
2
|
-
import type { FilterInfo } from "
|
|
2
|
+
import type { FilterInfo } from "./filterMeta";
|
|
3
3
|
|
|
4
4
|
export type DataInputOf<Input = any, Obj = any> = {
|
|
5
5
|
[K in keyof Input as Input[K] extends (...args: any[]) => any ? never : K]: Input[K] extends any[]
|
|
@@ -264,11 +264,11 @@ export class FetchClient {
|
|
|
264
264
|
setTimeout(timeout?: number | false) {
|
|
265
265
|
this.http.setTimeout(timeout);
|
|
266
266
|
}
|
|
267
|
+
/** @deprecated Every `Err` is `akanjs/common`'s, which a restored error already is; drop the call. */
|
|
267
268
|
setErrorConstructor(ErrorCls?: ErrorConstructor) {
|
|
268
269
|
this.ErrorCls = ErrorCls;
|
|
269
270
|
this.http.setErrorConstructor(ErrorCls);
|
|
270
|
-
this.ws.setErrorConstructor(ErrorCls);
|
|
271
|
-
for (const ws of this.#originWs.values()) ws.setErrorConstructor(ErrorCls);
|
|
271
|
+
for (const ws of [this.ws, ...this.#originWs.values()]) ws.setErrorConstructor(ErrorCls);
|
|
272
272
|
}
|
|
273
273
|
applySignal(serializedSignal: { [key: string]: SerializedSignal }, { share = true }: { share?: boolean } = {}) {
|
|
274
274
|
if (share && Object.keys(serializedSignal).length > 0) {
|
|
@@ -1104,7 +1104,7 @@ export class FetchClient {
|
|
|
1104
1104
|
origin?: string;
|
|
1105
1105
|
connect?: boolean;
|
|
1106
1106
|
base?: FetchProxy;
|
|
1107
|
-
Err?: ErrorConstructor;
|
|
1107
|
+
/** @deprecated Every `Err` is `akanjs/common`'s, which a restored error already is. */ Err?: ErrorConstructor;
|
|
1108
1108
|
/** This app's own default request budget, for calls no endpoint and no caller gave one. */
|
|
1109
1109
|
timeout?: number | false;
|
|
1110
1110
|
} = {},
|
|
@@ -11,6 +11,7 @@ export interface HttpClientOptions {
|
|
|
11
11
|
headers?: Record<string, string>;
|
|
12
12
|
/** Milliseconds before the request is abandoned; `false` waits as long as the browser will. */
|
|
13
13
|
timeout?: number | false;
|
|
14
|
+
/** @deprecated Every `Err` is `akanjs/common`'s, which a restored error already is. */
|
|
14
15
|
ErrorCls?: ErrorConstructor;
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -62,6 +63,7 @@ export class HttpClient {
|
|
|
62
63
|
this.ErrorCls = options.ErrorCls;
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
/** @deprecated Every `Err` is `akanjs/common`'s, which a restored error already is; drop the call. */
|
|
65
67
|
setErrorConstructor(ErrorCls?: ErrorConstructor) {
|
|
66
68
|
this.ErrorCls = ErrorCls;
|
|
67
69
|
}
|
package/fetch/client/wsClient.ts
CHANGED