akanjs 2.4.1 → 2.4.2-rc.1
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/client/csrTypes.ts +7 -0
- package/client/frameConfig.ts +6 -1
- package/client/rscNavigation.ts +9 -0
- package/common/index.ts +5 -0
- package/common/websocketAuth.ts +24 -0
- package/constant/fieldInfo.ts +4 -3
- package/constant/index.ts +2 -0
- package/constant/textFieldPathSet.ts +8 -0
- package/constant/textFieldPaths.ts +59 -0
- package/constant/types.ts +0 -4
- package/constant/via.ts +13 -28
- package/dictionary/dictInfo.ts +4 -0
- package/document/documentQuery.ts +17 -1
- package/document/documentSchema.ts +1 -15
- package/document/filterMeta.ts +4 -2
- package/fetch/client/fetchClient.ts +1 -0
- package/fetch/client/wsClient.ts +28 -1
- package/index.ts +6 -0
- package/local/apps/serverLifecycle/serverLifecycle-local.db +0 -0
- package/local/apps/serverLifecycle/serverLifecycle-local.db-shm +0 -0
- package/local/apps/serverLifecycle/serverLifecycle-local.db-wal +0 -0
- package/package.json +1 -1
- package/server/akanServer.ts +5 -4
- package/server/devtools/types.ts +2 -2
- package/server/resolver/database.resolver.ts +5 -6
- package/server/resolver/signal.resolver.ts +23 -0
- package/server/routing/apiRouter.ts +11 -3
- package/server/routing/appWsData.ts +50 -0
- package/server/rscClient.tsx +9 -0
- package/service/predefinedAdaptor/database.adaptor.ts +212 -88
- package/service/predefinedAdaptor/index.ts +1 -0
- package/service/predefinedAdaptor/searchIndex.ts +517 -0
- package/service/predefinedAdaptor/sqlDescriptor.ts +25 -0
- package/signal/signalContext.ts +37 -12
- package/signal/types.ts +2 -1
- package/types/client/csrTypes.d.ts +7 -0
- package/types/client/rscNavigation.d.ts +8 -0
- package/types/common/index.d.ts +1 -0
- package/types/common/websocketAuth.d.ts +19 -0
- package/types/constant/fieldInfo.d.ts +4 -3
- package/types/constant/index.d.ts +2 -0
- package/types/constant/textFieldPathSet.d.ts +8 -0
- package/types/constant/textFieldPaths.d.ts +10 -0
- package/types/constant/types.d.ts +0 -3
- package/types/constant/via.d.ts +4 -24
- package/types/dictionary/base.dictionary.d.ts +1 -1
- package/types/dictionary/dictionary.d.ts +8 -8
- package/types/document/documentQuery.d.ts +13 -1
- package/types/document/documentSchema.d.ts +0 -3
- package/types/document/filterMeta.d.ts +2 -1
- package/types/fetch/client/wsClient.d.ts +6 -0
- package/types/index.d.ts +6 -0
- package/types/server/devtools/types.d.ts +2 -2
- package/types/server/resolver/signal.resolver.d.ts +6 -0
- package/types/server/routing/apiRouter.d.ts +3 -4
- package/types/server/routing/appWsData.d.ts +24 -0
- package/types/server/rscClient.d.ts +1 -0
- package/types/service/predefinedAdaptor/database.adaptor.d.ts +46 -13
- package/types/service/predefinedAdaptor/index.d.ts +1 -0
- package/types/service/predefinedAdaptor/searchIndex.d.ts +73 -0
- package/types/service/predefinedAdaptor/sqlDescriptor.d.ts +5 -0
- package/types/signal/signalContext.d.ts +7 -0
- package/types/signal/types.d.ts +5 -1
- package/types/ui/Constant/schemaDoc.d.ts +2 -2
- package/ui/Constant/schemaDoc.ts +8 -2
- package/ui/Model/EditModal.tsx +24 -6
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface WebsocketAuthRequest {
|
|
2
|
+
key: string;
|
|
3
|
+
data: [string | null];
|
|
4
|
+
}
|
|
5
|
+
export interface WebsocketAuthAckData {
|
|
6
|
+
type: "auth";
|
|
7
|
+
revokedRooms: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Framework-owned websocket auth contract shared by the client and the server dispatcher.
|
|
11
|
+
* The credential frame carries the raw bearer token; verifying it stays in userland middleware,
|
|
12
|
+
* so the server only swaps the credential snapshot held on the socket.
|
|
13
|
+
*/
|
|
14
|
+
export declare const websocketAuthContract: {
|
|
15
|
+
readonly key: "__auth";
|
|
16
|
+
readonly makeRequest: (jwt: string | null) => WebsocketAuthRequest;
|
|
17
|
+
readonly makeAck: (revokedRooms: string[]) => WebsocketAuthAckData;
|
|
18
|
+
readonly readJwt: (data: unknown) => string | null;
|
|
19
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Any, CLIENT_VALUE, type Cls, type Dayjs, type EnumInstance, type Float, Int, type PrimitiveScalar, SERVER_VALUE, type SingleValue, type UnCls } from "akanjs/base";
|
|
2
|
+
import type { TextFieldRole } from "./textFieldPaths.d.ts";
|
|
2
3
|
import type { BaseObject } from "./types.d.ts";
|
|
3
4
|
import type { ConstantModelRef } from "./via.d.ts";
|
|
4
5
|
export type ParamFieldType = (typeof PrimitiveScalar & {
|
|
@@ -43,7 +44,7 @@ export interface ConstantFieldProps<FieldType extends ConstantFieldKind = Consta
|
|
|
43
44
|
example?: FieldValue;
|
|
44
45
|
of?: MapValue;
|
|
45
46
|
validate?: (value: FieldValue, model: any) => boolean;
|
|
46
|
-
text?:
|
|
47
|
+
text?: TextFieldRole;
|
|
47
48
|
meta?: Metadata;
|
|
48
49
|
}
|
|
49
50
|
export declare const fieldPresets: readonly ["email", "password", "url"];
|
|
@@ -89,7 +90,7 @@ interface ConstantFieldBuildProps<FieldType extends ConstantFieldKind = any, Fie
|
|
|
89
90
|
example?: FieldValue;
|
|
90
91
|
of?: MapValue;
|
|
91
92
|
validate?: (value: FieldValue, model: any) => boolean;
|
|
92
|
-
text?:
|
|
93
|
+
text?: TextFieldRole;
|
|
93
94
|
modelRef: ConstantModelRef;
|
|
94
95
|
arrDepth: number;
|
|
95
96
|
optArrDepth: number;
|
|
@@ -132,7 +133,7 @@ export declare class ConstantField<FieldType extends ConstantFieldKind = Constan
|
|
|
132
133
|
readonly example?: FieldValue;
|
|
133
134
|
readonly of?: MapValue;
|
|
134
135
|
readonly validate?: (value: FieldValue, model: any) => boolean;
|
|
135
|
-
readonly text?:
|
|
136
|
+
readonly text?: TextFieldRole;
|
|
136
137
|
readonly modelRef: ConstantModelRef;
|
|
137
138
|
readonly arrDepth: number;
|
|
138
139
|
readonly optArrDepth: number;
|
|
@@ -6,5 +6,7 @@ export * from "./getDefault.d.ts";
|
|
|
6
6
|
export * from "./immerify.d.ts";
|
|
7
7
|
export * from "./purify.d.ts";
|
|
8
8
|
export * from "./serialize.d.ts";
|
|
9
|
+
export * from "./textFieldPathSet.d.ts";
|
|
10
|
+
export * from "./textFieldPaths.d.ts";
|
|
9
11
|
export * from "./types.d.ts";
|
|
10
12
|
export * from "./via.d.ts";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The `search_doc` columns a model feeds, each holding the document paths that write it. */
|
|
2
|
+
export declare class TextFieldPathSet {
|
|
3
|
+
readonly title: Set<string>;
|
|
4
|
+
readonly desc: Set<string>;
|
|
5
|
+
readonly tag: Set<string>;
|
|
6
|
+
readonly thumb: Set<string>;
|
|
7
|
+
readonly filter: Set<string>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FieldObject } from "./fieldInfo.d.ts";
|
|
2
|
+
import { TextFieldPathSet } from "./textFieldPathSet.d.ts";
|
|
3
|
+
/** Column a `text` field feeds in the `search_doc` mirror. */
|
|
4
|
+
export declare const textFieldRoles: readonly ["title", "desc", "tag", "thumb", "filter"];
|
|
5
|
+
export type TextFieldRole = (typeof textFieldRoles)[number];
|
|
6
|
+
export declare class TextFieldPaths extends TextFieldPathSet {
|
|
7
|
+
#private;
|
|
8
|
+
readonly children: TextFieldPathSet;
|
|
9
|
+
collect(fieldMap: FieldObject): this;
|
|
10
|
+
}
|
|
@@ -67,9 +67,6 @@ export interface ProtoPatch {
|
|
|
67
67
|
at: Dayjs;
|
|
68
68
|
}
|
|
69
69
|
export declare const DEFAULT_PAGE_SIZE = 20;
|
|
70
|
-
export interface TextDoc {
|
|
71
|
-
[key: string]: string | TextDoc;
|
|
72
|
-
}
|
|
73
70
|
export type NonFunctionalKeys<T> = {
|
|
74
71
|
[K in keyof T]: T[K] extends (...args: never[]) => unknown ? never : K;
|
|
75
72
|
}[keyof T];
|
package/types/constant/via.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CLIENT_VALUE, type Cls, DEFAULT_VALUE, type EnumInstance, FIELD_META, type ObjectAssign, type ObjectAssignKeyOfObjects, PURIFIED_VALUE, SERVER_VALUE } from "akanjs/base";
|
|
2
2
|
import { type ExtractFieldInfoObject, type FieldBuilder, type FieldInfoObject, type FieldInfoObjectToFieldObject, type FieldObject, type FieldResolver } from "./fieldInfo.d.ts";
|
|
3
3
|
import { type PurifiedModel, type PurifyFunc } from "./purify.d.ts";
|
|
4
|
+
import { TextFieldPaths } from "./textFieldPaths.d.ts";
|
|
4
5
|
import type { BaseInsight, BaseObject, ConstantType, DefaultOf, DefaultOfSchema, NonFunctionalKeys } from "./types.d.ts";
|
|
5
6
|
type BaseFields = "id" | "createdAt" | "updatedAt" | "removedAt";
|
|
6
7
|
type OmitBase<T> = Omit<T, BaseFields>;
|
|
@@ -32,14 +33,7 @@ export interface ConstantStatics<Schema = any, OwnSchema = Schema, OwnFieldObj e
|
|
|
32
33
|
children: Set<ConstantModelRef>;
|
|
33
34
|
relations: Set<ConstantModelRef>;
|
|
34
35
|
enums: Set<EnumInstance>;
|
|
35
|
-
text:
|
|
36
|
-
search: Set<string>;
|
|
37
|
-
filter: Set<string>;
|
|
38
|
-
children: {
|
|
39
|
-
search: Set<string>;
|
|
40
|
-
filter: Set<string>;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
36
|
+
text: TextFieldPaths;
|
|
43
37
|
_OptionalKey: OptionalKey;
|
|
44
38
|
_RelationKey: RelationKey;
|
|
45
39
|
_PrimitiveKey: PrimitiveKey;
|
|
@@ -65,14 +59,7 @@ export interface DatabaseConstantStatics<Schema = any, FieldObj extends FieldObj
|
|
|
65
59
|
children: Set<ConstantModelRef>;
|
|
66
60
|
relations: Set<ConstantModelRef>;
|
|
67
61
|
enums: Set<EnumInstance>;
|
|
68
|
-
text:
|
|
69
|
-
search: Set<string>;
|
|
70
|
-
filter: Set<string>;
|
|
71
|
-
children: {
|
|
72
|
-
search: Set<string>;
|
|
73
|
-
filter: Set<string>;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
62
|
+
text: TextFieldPaths;
|
|
76
63
|
_DatabaseSchema: {
|
|
77
64
|
[K in keyof Schema]: K extends keyof FieldObj ? FieldObj[K]["fieldType"] extends "hidden" ? NonNullable<Schema[K]> : Schema[K] : Schema[K];
|
|
78
65
|
};
|
|
@@ -83,14 +70,7 @@ export type ConstantModelRef<Schema = any, FieldObj extends FieldObject = FieldO
|
|
|
83
70
|
children: Set<ConstantModelRef>;
|
|
84
71
|
relations: Set<ConstantModelRef>;
|
|
85
72
|
enums: Set<EnumInstance>;
|
|
86
|
-
text:
|
|
87
|
-
search: Set<string>;
|
|
88
|
-
filter: Set<string>;
|
|
89
|
-
children: {
|
|
90
|
-
search: Set<string>;
|
|
91
|
-
filter: Set<string>;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
73
|
+
text: TextFieldPaths;
|
|
94
74
|
}>;
|
|
95
75
|
export type DocumentConstantModelRef<Schema = any, FieldObj extends FieldObject = FieldObject, ModelType extends ConstantType = ConstantType, DatabaseSchema = DatabaseSchemaOf<Schema, never>> = Cls<Schema, {
|
|
96
76
|
[FIELD_META]: FieldObj;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const baseDictionary: import("./dictInfo.d.ts").ServiceDictInfo<[string, string], "ping" | "pingBody" | "pingParam" | "pingQuery" | "wsPing" | "pubsubPing", never, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "
|
|
1
|
+
export declare const baseDictionary: import("./dictInfo.d.ts").ServiceDictInfo<[string, string], "ping" | "pingBody" | "pingParam" | "pingQuery" | "wsPing" | "pubsubPing", never, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "new" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { BaseEndpoint } from "akanjs/signal";
|
|
2
2
|
export declare const dictionary: {
|
|
3
|
-
base: import("./locale.d.ts").DictModule<import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "
|
|
3
|
+
base: import("./locale.d.ts").DictModule<import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "new" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, never>;
|
|
4
4
|
};
|
|
5
|
-
export declare const Err: import("./trans.d.ts").ErrConstructor<never>, translate: (lang: "en" | "ko" | "zhChs" | "zhCht" | "ja", key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "
|
|
6
|
-
info: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "
|
|
7
|
-
success: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "
|
|
8
|
-
error: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "
|
|
9
|
-
warning: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "
|
|
10
|
-
loading: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "
|
|
11
|
-
}, getDictionary: (lang: "en" | "ko" | "zhChs" | "zhCht" | "ja") => object, getAllDictionary: () => import("./trans.d.ts").RootDictionary, __Dict_Key__: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "
|
|
5
|
+
export declare const Err: import("./trans.d.ts").ErrConstructor<never>, translate: (lang: "en" | "ko" | "zhChs" | "zhCht" | "ja", key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "new" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, data?: import("./trans.d.ts").TranslationData) => string, msg: {
|
|
6
|
+
info: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "new" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
7
|
+
success: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "new" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
8
|
+
error: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "new" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
9
|
+
warning: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "new" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
10
|
+
loading: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "new" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, option?: import("./trans.d.ts").TransMessageOption) => void;
|
|
11
|
+
}, getDictionary: (lang: "en" | "ko" | "zhChs" | "zhCht" | "ja") => object, getAllDictionary: () => import("./trans.d.ts").RootDictionary, __Dict_Key__: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "error" | "save" | "password" | "remove" | "ok" | "connecting" | "new" | "failed" | "somethingWrong" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, __Error_Key__: never;
|
|
@@ -6,6 +6,13 @@ export declare const createDocumentId: (now?: number) => DocumentId;
|
|
|
6
6
|
export declare const isDocumentId: (value: unknown) => value is DocumentId;
|
|
7
7
|
export type DocumentPrimitive = string | number | boolean | null | Dayjs | Date;
|
|
8
8
|
export type DocumentPath<T = any> = Extract<keyof T, string> | (string & {});
|
|
9
|
+
export declare const searchColumns: readonly ["title", "desc", "tag", "filter"];
|
|
10
|
+
export type SearchColumn = (typeof searchColumns)[number];
|
|
11
|
+
export interface DocumentSearchOptions {
|
|
12
|
+
columns?: SearchColumn[];
|
|
13
|
+
prefix?: boolean;
|
|
14
|
+
weights?: number[];
|
|
15
|
+
}
|
|
9
16
|
export type DocumentQueryNode = {
|
|
10
17
|
kind: "all";
|
|
11
18
|
queries: DocumentQuery[];
|
|
@@ -23,7 +30,10 @@ export type DocumentQueryNode = {
|
|
|
23
30
|
kind: "raw";
|
|
24
31
|
sql: string;
|
|
25
32
|
params: unknown[];
|
|
26
|
-
}
|
|
33
|
+
} | ({
|
|
34
|
+
kind: "search";
|
|
35
|
+
text: string;
|
|
36
|
+
} & DocumentSearchOptions);
|
|
27
37
|
export type DocumentQueryOperator = "eq" | "ne" | "oneOf" | "notOneOf" | "gt" | "gte" | "lt" | "lte" | "between" | "exists" | "missing" | "empty" | "has" | "contains";
|
|
28
38
|
export type DocumentQueryValue = DocumentPrimitive | DocumentPrimitive[] | DocumentQueryNode | undefined | Record<string, unknown>;
|
|
29
39
|
export type DocumentUpdateOperator = "set" | "unset" | "inc" | "mul" | "min" | "max" | "push" | "pull" | "addToSet" | "setOnInsert";
|
|
@@ -100,6 +110,7 @@ export declare const createDocumentQueryHelper: () => {
|
|
|
100
110
|
has: (value: unknown) => DocumentQueryNode;
|
|
101
111
|
contains: (value: unknown) => DocumentQueryNode;
|
|
102
112
|
raw: (sql: string, params?: unknown[]) => DocumentQueryNode;
|
|
113
|
+
search: (text: string, options?: DocumentSearchOptions) => DocumentQueryNode;
|
|
103
114
|
when: (condition: unknown, query: DocumentQuery) => DocumentQuery;
|
|
104
115
|
};
|
|
105
116
|
export type DocumentQueryHelper = ReturnType<typeof createDocumentQueryHelper>;
|
|
@@ -128,6 +139,7 @@ export declare const documentQueryHelper: {
|
|
|
128
139
|
has: (value: unknown) => DocumentQueryNode;
|
|
129
140
|
contains: (value: unknown) => DocumentQueryNode;
|
|
130
141
|
raw: (sql: string, params?: unknown[]) => DocumentQueryNode;
|
|
142
|
+
search: (text: string, options?: DocumentSearchOptions) => DocumentQueryNode;
|
|
131
143
|
when: (condition: unknown, query: DocumentQuery) => DocumentQuery;
|
|
132
144
|
};
|
|
133
145
|
export declare const encodeDocumentValue: (value: unknown) => unknown;
|
|
@@ -6,12 +6,10 @@ export interface DocumentIndexDescriptor {
|
|
|
6
6
|
name?: string;
|
|
7
7
|
fields: Record<string, 1 | -1 | "text" | boolean>;
|
|
8
8
|
unique?: boolean;
|
|
9
|
-
text?: boolean;
|
|
10
9
|
where?: DocumentQuery;
|
|
11
10
|
}
|
|
12
11
|
export interface DocumentIndexBuilder<Schema> {
|
|
13
12
|
path(path: string, order?: 1 | -1): DocumentIndexBuilder<Schema>;
|
|
14
|
-
text(path: string): DocumentIndexBuilder<Schema>;
|
|
15
13
|
unique(): DocumentIndexBuilder<Schema>;
|
|
16
14
|
where(where: DocumentQuery | ((q: DocumentQueryHelper) => DocumentQuery)): DocumentIndexBuilder<Schema>;
|
|
17
15
|
done(): Schema;
|
|
@@ -25,7 +23,6 @@ export declare class DocumentSchema<Doc = unknown> {
|
|
|
25
23
|
post<HookDoc = Doc>(type: SaveEventType, hook: DocumentSaveHook<HookDoc>): this;
|
|
26
24
|
hook(type: DocumentHookName, hook: DocumentSaveHook<Doc>): this;
|
|
27
25
|
index(fields: DocumentIndexDescriptor["fields"], options?: Omit<DocumentIndexDescriptor, "fields">): this;
|
|
28
|
-
text(...fields: string[]): this;
|
|
29
26
|
createIndex(name: string): DocumentIndexBuilder<this>;
|
|
30
27
|
}
|
|
31
28
|
export type SchemaOf<Mdl = unknown, Doc = unknown> = DocumentSchema<Doc> & {
|
|
@@ -19,7 +19,7 @@ export declare const getFilterInfoByKey: <ArgNames extends string[] = [], Args e
|
|
|
19
19
|
export declare const setFilterInfoByKey: <ArgNames extends string[] = [], Args extends any[] = any[], Model = any>(modelRef: Cls<Model>, key: string, filterInfo: FilterInfo<ArgNames, Args, Model>) => void;
|
|
20
20
|
export declare const getFilterSortByKey: (modelRef: FilterCls, key: string) => unknown;
|
|
21
21
|
export declare const fillMissingFilterArgs: (filterInfo: FilterInfo, args: unknown[]) => any[];
|
|
22
|
-
export type BaseFilterSortKey = "latest" | "oldest";
|
|
22
|
+
export type BaseFilterSortKey = "latest" | "oldest" | "relevance";
|
|
23
23
|
export type BaseFilterQueryKey = "any";
|
|
24
24
|
export type BaseFilterKey = BaseFilterSortKey | BaseFilterQueryKey;
|
|
25
25
|
export type FilterInstance<Query extends {
|
|
@@ -59,6 +59,7 @@ interface BaseSort {
|
|
|
59
59
|
oldest: {
|
|
60
60
|
createdAt: 1;
|
|
61
61
|
};
|
|
62
|
+
relevance: Record<string, never>;
|
|
62
63
|
}
|
|
63
64
|
type LibFilterQuery<LibFilters extends FilterCls[]> = MergeAllDoubleKeyOfObjects<LibFilters, typeof FILTER_META, "query">;
|
|
64
65
|
type LibFilterSort<LibFilters extends FilterCls[]> = MergeAllKeyOfTypes<LibFilters, "sort">;
|
|
@@ -15,6 +15,12 @@ export declare class WsClient {
|
|
|
15
15
|
connected: boolean;
|
|
16
16
|
constructor(url: string, ErrorCls?: ErrorConstructor | undefined);
|
|
17
17
|
setErrorConstructor(ErrorCls?: ErrorConstructor): void;
|
|
18
|
+
/**
|
|
19
|
+
* The handshake only carries a same-origin cookie, so clients that hold the token in memory
|
|
20
|
+
* (native, cross-origin) authenticate with this frame instead. Signing out sends `null`, which
|
|
21
|
+
* drops the handshake cookie server-side and revokes the rooms it had authorized.
|
|
22
|
+
*/
|
|
23
|
+
setJwt(jwt: string | null): void;
|
|
18
24
|
connect(): void;
|
|
19
25
|
destroy(): void;
|
|
20
26
|
on<Data = unknown>(key: string, callback: (data: Data) => void): this;
|
package/types/index.d.ts
CHANGED
|
@@ -161,6 +161,12 @@ export interface AppConfigResult {
|
|
|
161
161
|
docker: DockerConfig;
|
|
162
162
|
defaultDatabaseMode: DatabaseMode;
|
|
163
163
|
routes?: AkanRouteConfig[];
|
|
164
|
+
/**
|
|
165
|
+
* Mounts `libs/<lib>/page` into this app under `page/(libs)/(<lib>)` on sync. `true` takes every lib
|
|
166
|
+
* dependency that ships a `page` folder, an array takes exactly the libs listed, `false` (the default)
|
|
167
|
+
* syncs nothing and removes what a previous sync created.
|
|
168
|
+
*/
|
|
169
|
+
syncPageLibs?: string[] | boolean;
|
|
164
170
|
externalLibs: string[];
|
|
165
171
|
barrelImports: string[];
|
|
166
172
|
optimizeImports: string[];
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* GET /_akan/dictionary -> DevtoolsEnvelope<"dictionary", DictionaryData>
|
|
8
8
|
* GET /_akan/deps -> DevtoolsEnvelope<"deps", DepsData>
|
|
9
9
|
*/
|
|
10
|
-
import type { ConstantType } from "akanjs/constant";
|
|
10
|
+
import type { ConstantType, TextFieldRole } from "akanjs/constant";
|
|
11
11
|
import type { RootDictionary } from "akanjs/dictionary";
|
|
12
12
|
import type { ArgType, SerializedArg, SerializedReturns } from "akanjs/signal";
|
|
13
13
|
export interface DevtoolsIndex {
|
|
@@ -82,7 +82,7 @@ export interface ConstantFieldNode {
|
|
|
82
82
|
maxlength?: number;
|
|
83
83
|
/** `ConstantFieldProps["type"]`: "email" | "password" | "url". */
|
|
84
84
|
preset?: string;
|
|
85
|
-
text?:
|
|
85
|
+
text?: TextFieldRole;
|
|
86
86
|
accumulate?: unknown;
|
|
87
87
|
example?: unknown;
|
|
88
88
|
meta?: Record<string, unknown>;
|
|
@@ -30,6 +30,12 @@ export declare class SignalResolver {
|
|
|
30
30
|
live: LiveRegistry;
|
|
31
31
|
middleware: Map<string, MiddlewareCls>;
|
|
32
32
|
}): SignalRoutes;
|
|
33
|
+
/**
|
|
34
|
+
* Re-checks the guards of every room this socket is subscribed to and drops the ones that no
|
|
35
|
+
* longer pass. Called when the socket's credential changes: a pubsub room is authorized once at
|
|
36
|
+
* subscribe time, so without this a signed-out socket would keep receiving its old rooms.
|
|
37
|
+
*/
|
|
38
|
+
static revalidateWsRooms(ws: Bun.ServerWebSocket<any>, registry: InjectRegistry): Promise<string[]>;
|
|
33
39
|
static handleWsOpen(ws: Bun.ServerWebSocket<any>, registry: InjectRegistry): Promise<void>;
|
|
34
40
|
static handleWsClose(ws: Bun.ServerWebSocket<any>, registry: InjectRegistry): Promise<void>;
|
|
35
41
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Logger } from "akanjs/common";
|
|
2
2
|
import type { InjectRegistry } from "akanjs/service";
|
|
3
3
|
import type { HmrWsHub } from "../hmr/wsHub.d.ts";
|
|
4
4
|
import { type WebProxyRunner } from "../proxy.d.ts";
|
|
5
5
|
import type { HttpRoutes, SignalRouteOptions, WebsocketRoutes } from "../types.d.ts";
|
|
6
|
+
import { AppWsData } from "./appWsData.d.ts";
|
|
6
7
|
/**
|
|
7
8
|
* Minimal render-state view the HMR WS hello message needs.
|
|
8
9
|
* `LazyHmrController` exposes this shape via `state.buildId` / `state.cssAssets`,
|
|
@@ -27,9 +28,7 @@ export interface ApiRouteInputs {
|
|
|
27
28
|
routeOptions?: Record<string, SignalRouteOptions>;
|
|
28
29
|
renderEnvRoutes: HttpRoutes;
|
|
29
30
|
/** Upgrades the incoming request into an app-signal WebSocket. */
|
|
30
|
-
upgradeAppWs: (req: Request, data:
|
|
31
|
-
createdAt: number;
|
|
32
|
-
}) => boolean;
|
|
31
|
+
upgradeAppWs: (req: Request, data: AppWsData) => boolean;
|
|
33
32
|
webProxyRunner?: WebProxyRunner | null;
|
|
34
33
|
}
|
|
35
34
|
export interface WebsocketHandlersInputs {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credential snapshot taken at the websocket handshake and carried on `ws.data` for the life of the
|
|
3
|
+
* socket, so auth middleware and guards can read the caller the same way they read an HTTP request.
|
|
4
|
+
* Only the credential headers are copied — retaining the whole `Request` would pin it for as long
|
|
5
|
+
* as the socket stays open.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AppWsData {
|
|
8
|
+
static fromRequest(req: Request): AppWsData;
|
|
9
|
+
static of(ws: Bun.ServerWebSocket<unknown>): AppWsData;
|
|
10
|
+
/**
|
|
11
|
+
* Swaps the credential the socket authenticates with. Callers must run this synchronously on the
|
|
12
|
+
* auth frame: frames arrive in order, so a subscribe sent right after the credential must not be
|
|
13
|
+
* able to observe the previous one.
|
|
14
|
+
*/
|
|
15
|
+
static applyCredential(data: AppWsData, jwt: string | null): void;
|
|
16
|
+
createdAt: number;
|
|
17
|
+
headers: Headers;
|
|
18
|
+
cookies: Bun.CookieMap;
|
|
19
|
+
account?: unknown;
|
|
20
|
+
/** The `authorization` value `account` was resolved from, so each frame need not re-verify it. */
|
|
21
|
+
resolvedAuthorization?: string;
|
|
22
|
+
socketId?: string;
|
|
23
|
+
constructor(headers: Headers);
|
|
24
|
+
}
|
|
@@ -13,6 +13,7 @@ declare global {
|
|
|
13
13
|
buildId?: number;
|
|
14
14
|
}) => Promise<void>) | undefined;
|
|
15
15
|
var __AKAN_RSC_CLEAR_CACHE__: (() => void) | undefined;
|
|
16
|
+
var __AKAN_RSC_IS_FROM_CACHE__: (() => boolean) | undefined;
|
|
16
17
|
var __AKAN_DEV_SYNC_NAVIGATION__: ((href: string, kind: "push" | "replace" | "back" | "pop") => void) | undefined;
|
|
17
18
|
var __AKAN_DEV_SYNC_NAVIGATION_APPLYING__: boolean | undefined;
|
|
18
19
|
var __AKAN_GET_SYNC_ROUTE_HREF__: ((href: string) => string) | undefined;
|
|
@@ -4,6 +4,7 @@ import { type BaseEnv, type PromiseOrObject } from "akanjs/base";
|
|
|
4
4
|
import { type ConstantModel } from "akanjs/constant";
|
|
5
5
|
import { type DatabaseModel, type DocumentQuery, type DocumentSchema, type DocumentUpdate, type DocumentUpdateInput, type DocumentUpdateOperator, type DocumentUpdateOptions, type SchemaOf } from "akanjs/document";
|
|
6
6
|
import type { Sql } from "postgres";
|
|
7
|
+
import { SearchIndex } from "./searchIndex.d.ts";
|
|
7
8
|
export interface SqliteDatabaseConfig {
|
|
8
9
|
filePath?: string;
|
|
9
10
|
journalMode?: "WAL" | "DELETE" | "TRUNCATE" | "PERSIST" | "MEMORY" | "OFF";
|
|
@@ -25,11 +26,16 @@ export interface PostgresDatabaseConfig {
|
|
|
25
26
|
user?: string;
|
|
26
27
|
password?: string;
|
|
27
28
|
}
|
|
29
|
+
export interface SearchConfig {
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
tokenizer?: string;
|
|
32
|
+
}
|
|
28
33
|
export interface DatabaseConfig {
|
|
29
34
|
driver?: "sqlite" | "libsql" | "postgres";
|
|
30
35
|
sqlite?: SqliteDatabaseConfig;
|
|
31
36
|
libsql?: LibsqlDatabaseConfig;
|
|
32
37
|
postgres?: PostgresDatabaseConfig;
|
|
38
|
+
search?: SearchConfig;
|
|
33
39
|
}
|
|
34
40
|
export interface DocumentStore {
|
|
35
41
|
ensure(): Promise<void>;
|
|
@@ -104,6 +110,7 @@ export interface DatabaseAdaptor {
|
|
|
104
110
|
getConnection(): AkanSqlClient;
|
|
105
111
|
getStore(constant: ConstantModel, database: DatabaseModel, schema: DocumentSchema): DocumentStore;
|
|
106
112
|
transaction<T>(fn: () => PromiseOrObject<T>): Promise<T>;
|
|
113
|
+
getSearchIndex(): SearchIndex | null;
|
|
107
114
|
}
|
|
108
115
|
interface SqliteEnv extends BaseEnv {
|
|
109
116
|
workspaceRoot?: string;
|
|
@@ -135,6 +142,7 @@ type WriteHookOptions = {
|
|
|
135
142
|
};
|
|
136
143
|
interface DocumentDatabaseOwner {
|
|
137
144
|
getConnection(): AkanSqlClient;
|
|
145
|
+
getSearchIndex(): SearchIndex | null;
|
|
138
146
|
getMeta(key: string): Promise<string | undefined> | string | undefined;
|
|
139
147
|
setMeta(key: string, value: string): Promise<void>;
|
|
140
148
|
afterCommit(fn: () => PromiseOrObject<void>): Promise<void>;
|
|
@@ -164,6 +172,20 @@ interface SqlFrag {
|
|
|
164
172
|
sql: string;
|
|
165
173
|
params: unknown[];
|
|
166
174
|
}
|
|
175
|
+
interface SearchJoinProps {
|
|
176
|
+
alias: string;
|
|
177
|
+
ref: string;
|
|
178
|
+
match: string;
|
|
179
|
+
weights: number[];
|
|
180
|
+
}
|
|
181
|
+
interface SearchJoin extends SqlFrag {
|
|
182
|
+
alias: string;
|
|
183
|
+
}
|
|
184
|
+
interface CompiledQuery {
|
|
185
|
+
where: string;
|
|
186
|
+
params: unknown[];
|
|
187
|
+
joins: SearchJoin[];
|
|
188
|
+
}
|
|
167
189
|
interface SqlDialect {
|
|
168
190
|
readonly name: "sqlite" | "postgres";
|
|
169
191
|
timestampType(): string;
|
|
@@ -182,6 +204,7 @@ interface SqlDialect {
|
|
|
182
204
|
empty(path: string): SqlFrag;
|
|
183
205
|
arrayHas(path: string, value: unknown): SqlFrag;
|
|
184
206
|
contains(path: string, value: unknown): SqlFrag;
|
|
207
|
+
searchJoin(props: SearchJoinProps): SqlFrag;
|
|
185
208
|
applyUpdate(acc: string, op: DocumentUpdateOperator, path: string, value: unknown): SqlFrag;
|
|
186
209
|
affectedRows(result: unknown): number;
|
|
187
210
|
}
|
|
@@ -204,6 +227,7 @@ export declare class SqliteDialect implements SqlDialect {
|
|
|
204
227
|
empty(path: string): SqlFrag;
|
|
205
228
|
arrayHas(path: string, value: unknown): SqlFrag;
|
|
206
229
|
contains(path: string, value: unknown): SqlFrag;
|
|
230
|
+
searchJoin({ alias, ref, match, weights }: SearchJoinProps): SqlFrag;
|
|
207
231
|
applyUpdate(acc: string, op: DocumentUpdateOperator, path: string, value: unknown): SqlFrag;
|
|
208
232
|
affectedRows(result: unknown): number;
|
|
209
233
|
}
|
|
@@ -226,6 +250,7 @@ export declare class PostgresDialect implements SqlDialect {
|
|
|
226
250
|
empty(path: string): SqlFrag;
|
|
227
251
|
arrayHas(path: string, value: unknown): SqlFrag;
|
|
228
252
|
contains(path: string, value: unknown): SqlFrag;
|
|
253
|
+
searchJoin({ ref }: SearchJoinProps): SqlFrag;
|
|
229
254
|
applyUpdate(acc: string, op: DocumentUpdateOperator, path: string, value: unknown): SqlFrag;
|
|
230
255
|
affectedRows(result: unknown): number;
|
|
231
256
|
}
|
|
@@ -233,11 +258,10 @@ declare class QueryCompiler {
|
|
|
233
258
|
#private;
|
|
234
259
|
private readonly fields;
|
|
235
260
|
private readonly dialect;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
};
|
|
261
|
+
private readonly ref;
|
|
262
|
+
private readonly searchEnabled;
|
|
263
|
+
constructor(fields: FieldMap, dialect: SqlDialect, ref: string, searchEnabled: () => boolean);
|
|
264
|
+
compile(query?: DocumentQuery): CompiledQuery;
|
|
241
265
|
orderBy(sort?: Record<string, 1 | -1>): string;
|
|
242
266
|
fieldExpr(path: string): string;
|
|
243
267
|
private compileNode;
|
|
@@ -321,15 +345,11 @@ export declare class SqlDocumentStore {
|
|
|
321
345
|
exists(query?: DocumentQuery): Promise<string | null>;
|
|
322
346
|
count(query?: DocumentQuery): Promise<number>;
|
|
323
347
|
insight(query?: DocumentQuery): Promise<DocumentRecord>;
|
|
324
|
-
search(searchText: string | undefined | null, options?: {
|
|
325
|
-
skip?: number | null;
|
|
326
|
-
limit?: number | null;
|
|
327
|
-
sort?: SortOption;
|
|
328
|
-
}): Promise<{
|
|
329
|
-
docs: any[];
|
|
330
|
-
count: number;
|
|
331
|
-
}>;
|
|
332
348
|
private safeQuery;
|
|
349
|
+
private writeQuery;
|
|
350
|
+
private joinSql;
|
|
351
|
+
private joinParams;
|
|
352
|
+
private orderBy;
|
|
333
353
|
private prepareDocument;
|
|
334
354
|
private extractInsertBase;
|
|
335
355
|
private applyInsertUpdate;
|
|
@@ -359,8 +379,13 @@ export declare class SqlDocumentStore {
|
|
|
359
379
|
private assertValidRefName;
|
|
360
380
|
}
|
|
361
381
|
declare const SqliteDatabase_base: import("..").AdaptorCls<{}, {
|
|
382
|
+
scheduler: import("..").InjectInfo<"plug", import("./schedule.adaptor").ScheduleAdaptor, never, never>;
|
|
362
383
|
config: import("..").InjectInfo<"env", {
|
|
363
384
|
filePath: string;
|
|
385
|
+
search: {
|
|
386
|
+
enabled: boolean;
|
|
387
|
+
tokenizer: string;
|
|
388
|
+
};
|
|
364
389
|
journalMode: "WAL" | "DELETE" | "TRUNCATE" | "PERSIST" | "MEMORY" | "OFF";
|
|
365
390
|
busyTimeoutMs: number;
|
|
366
391
|
synchronous: "OFF" | "NORMAL" | "FULL" | "EXTRA";
|
|
@@ -374,6 +399,7 @@ export declare class SqliteDatabase extends SqliteDatabase_base implements Datab
|
|
|
374
399
|
onInit(): Promise<void>;
|
|
375
400
|
onDestroy(): Promise<void>;
|
|
376
401
|
getConnection(): BunSqliteClient;
|
|
402
|
+
getSearchIndex(): SearchIndex;
|
|
377
403
|
getStore(constant: ConstantModel, database: DatabaseModel, schema: SchemaOf): SqlDocumentStore;
|
|
378
404
|
getMeta(key: string): string | undefined;
|
|
379
405
|
setMeta(key: string, value: string): Promise<void>;
|
|
@@ -383,9 +409,14 @@ export declare class SqliteDatabase extends SqliteDatabase_base implements Datab
|
|
|
383
409
|
vacuum(): void;
|
|
384
410
|
}
|
|
385
411
|
declare const LibsqlDatabase_base: import("..").AdaptorCls<{}, {
|
|
412
|
+
scheduler: import("..").InjectInfo<"plug", import("./schedule.adaptor").ScheduleAdaptor, never, never>;
|
|
386
413
|
config: import("..").InjectInfo<"env", {
|
|
387
414
|
url: string;
|
|
388
415
|
authToken: string | undefined;
|
|
416
|
+
search: {
|
|
417
|
+
enabled: boolean;
|
|
418
|
+
tokenizer: string;
|
|
419
|
+
};
|
|
389
420
|
}, SqliteEnv, never>;
|
|
390
421
|
}>;
|
|
391
422
|
export declare class LibsqlDatabase extends LibsqlDatabase_base implements DatabaseAdaptor {
|
|
@@ -393,6 +424,7 @@ export declare class LibsqlDatabase extends LibsqlDatabase_base implements Datab
|
|
|
393
424
|
onInit(): Promise<void>;
|
|
394
425
|
onDestroy(): Promise<void>;
|
|
395
426
|
getConnection(): LibsqlAkanClient;
|
|
427
|
+
getSearchIndex(): SearchIndex;
|
|
396
428
|
getStore(constant: ConstantModel, database: DatabaseModel, schema: SchemaOf): SqlDocumentStore;
|
|
397
429
|
getMeta(key: string): Promise<string | undefined>;
|
|
398
430
|
setMeta(key: string, value: string): Promise<void>;
|
|
@@ -414,6 +446,7 @@ export declare class PostgresDatabase extends PostgresDatabase_base implements D
|
|
|
414
446
|
onInit(): Promise<void>;
|
|
415
447
|
onDestroy(): Promise<void>;
|
|
416
448
|
getConnection(): PostgresAkanClient;
|
|
449
|
+
getSearchIndex(): null;
|
|
417
450
|
getStore(constant: ConstantModel, database: DatabaseModel, schema: SchemaOf): SqlDocumentStore;
|
|
418
451
|
getMeta(key: string): Promise<string | undefined>;
|
|
419
452
|
setMeta(key: string, value: string): Promise<void>;
|
|
@@ -5,6 +5,7 @@ export * from "./logging.adaptor";
|
|
|
5
5
|
export * from "./queue.adaptor";
|
|
6
6
|
export * from "./role.adaptor";
|
|
7
7
|
export * from "./schedule.adaptor";
|
|
8
|
+
export * from "./searchIndex.d.ts";
|
|
8
9
|
export * from "./solidCache.adaptor";
|
|
9
10
|
export * from "./solidPubsub.adaptor";
|
|
10
11
|
export * from "./solidQueue.adaptor";
|