akanjs 2.4.2-rc.0 → 2.4.2-rc.2
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/common/index.ts +1 -1
- package/common/subRoute.ts +61 -0
- package/constant/cascadePaths.ts +32 -0
- package/constant/fieldInfo.ts +11 -3
- package/constant/index.ts +3 -0
- package/constant/textFieldPathSet.ts +8 -0
- package/constant/textFieldPaths.ts +59 -0
- package/constant/types.ts +0 -4
- package/constant/via.ts +19 -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/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/devtools/types.ts +2 -2
- package/server/di/diLifecycle.ts +7 -1
- package/server/proxy/hostBasePathWebProxy.ts +16 -5
- package/server/resolver/database.resolver.ts +5 -6
- package/server/resolver/service.resolver.ts +27 -5
- package/server/webRouter.ts +27 -11
- 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/types/common/index.d.ts +1 -1
- package/types/common/subRoute.d.ts +19 -0
- package/types/constant/cascadePaths.d.ts +11 -0
- package/types/constant/fieldInfo.d.ts +8 -3
- package/types/constant/index.d.ts +3 -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 +8 -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/server/devtools/types.d.ts +2 -2
- package/types/server/resolver/service.resolver.d.ts +3 -3
- 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/ui/Constant/schemaDoc.d.ts +2 -2
- package/ui/Constant/schemaDoc.ts +8 -2
package/types/constant/via.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
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
|
+
import { CascadePaths } from "./cascadePaths.d.ts";
|
|
2
3
|
import { type ExtractFieldInfoObject, type FieldBuilder, type FieldInfoObject, type FieldInfoObjectToFieldObject, type FieldObject, type FieldResolver } from "./fieldInfo.d.ts";
|
|
3
4
|
import { type PurifiedModel, type PurifyFunc } from "./purify.d.ts";
|
|
5
|
+
import { TextFieldPaths } from "./textFieldPaths.d.ts";
|
|
4
6
|
import type { BaseInsight, BaseObject, ConstantType, DefaultOf, DefaultOfSchema, NonFunctionalKeys } from "./types.d.ts";
|
|
5
7
|
type BaseFields = "id" | "createdAt" | "updatedAt" | "removedAt";
|
|
6
8
|
type OmitBase<T> = Omit<T, BaseFields>;
|
|
@@ -32,14 +34,8 @@ export interface ConstantStatics<Schema = any, OwnSchema = Schema, OwnFieldObj e
|
|
|
32
34
|
children: Set<ConstantModelRef>;
|
|
33
35
|
relations: Set<ConstantModelRef>;
|
|
34
36
|
enums: Set<EnumInstance>;
|
|
35
|
-
text:
|
|
36
|
-
|
|
37
|
-
filter: Set<string>;
|
|
38
|
-
children: {
|
|
39
|
-
search: Set<string>;
|
|
40
|
-
filter: Set<string>;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
37
|
+
text: TextFieldPaths;
|
|
38
|
+
cascade: CascadePaths;
|
|
43
39
|
_OptionalKey: OptionalKey;
|
|
44
40
|
_RelationKey: RelationKey;
|
|
45
41
|
_PrimitiveKey: PrimitiveKey;
|
|
@@ -65,14 +61,8 @@ export interface DatabaseConstantStatics<Schema = any, FieldObj extends FieldObj
|
|
|
65
61
|
children: Set<ConstantModelRef>;
|
|
66
62
|
relations: Set<ConstantModelRef>;
|
|
67
63
|
enums: Set<EnumInstance>;
|
|
68
|
-
text:
|
|
69
|
-
|
|
70
|
-
filter: Set<string>;
|
|
71
|
-
children: {
|
|
72
|
-
search: Set<string>;
|
|
73
|
-
filter: Set<string>;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
64
|
+
text: TextFieldPaths;
|
|
65
|
+
cascade: CascadePaths;
|
|
76
66
|
_DatabaseSchema: {
|
|
77
67
|
[K in keyof Schema]: K extends keyof FieldObj ? FieldObj[K]["fieldType"] extends "hidden" ? NonNullable<Schema[K]> : Schema[K] : Schema[K];
|
|
78
68
|
};
|
|
@@ -83,14 +73,8 @@ export type ConstantModelRef<Schema = any, FieldObj extends FieldObject = FieldO
|
|
|
83
73
|
children: Set<ConstantModelRef>;
|
|
84
74
|
relations: Set<ConstantModelRef>;
|
|
85
75
|
enums: Set<EnumInstance>;
|
|
86
|
-
text:
|
|
87
|
-
|
|
88
|
-
filter: Set<string>;
|
|
89
|
-
children: {
|
|
90
|
-
search: Set<string>;
|
|
91
|
-
filter: Set<string>;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
76
|
+
text: TextFieldPaths;
|
|
77
|
+
cascade: CascadePaths;
|
|
94
78
|
}>;
|
|
95
79
|
export type DocumentConstantModelRef<Schema = any, FieldObj extends FieldObject = FieldObject, ModelType extends ConstantType = ConstantType, DatabaseSchema = DatabaseSchemaOf<Schema, never>> = Cls<Schema, {
|
|
96
80
|
[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">;
|
|
@@ -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>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ConstantModel } from "akanjs/constant";
|
|
2
2
|
import { type DatabaseModel } from "akanjs/document";
|
|
3
|
-
import type { ServiceCls } from "akanjs/service";
|
|
3
|
+
import type { DatabaseService, ServiceCls } from "akanjs/service";
|
|
4
4
|
export declare class ServiceResolver {
|
|
5
5
|
#private;
|
|
6
|
-
static resolveDatabaseService(constant: ConstantModel, database: DatabaseModel, srvRef: ServiceCls): ServiceCls;
|
|
6
|
+
static resolveDatabaseService(constant: ConstantModel, database: DatabaseModel, srvRef: ServiceCls, getService: (refName: string) => DatabaseService): ServiceCls;
|
|
7
7
|
}
|
|
@@ -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";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type ConstantModel, textFieldRoles } from "akanjs/constant";
|
|
2
|
+
import { type DatabaseModel, type SearchColumn } from "akanjs/document";
|
|
3
|
+
import type { AkanSqlClient } from "./database.adaptor";
|
|
4
|
+
export declare const DOC_TABLE = "search_doc";
|
|
5
|
+
export declare const FTS_TABLE = "search_fts";
|
|
6
|
+
export declare const DEFAULT_TOKENIZER = "unicode61 remove_diacritics 2";
|
|
7
|
+
export declare const OPTIMIZE_CRON_KEY = "searchIndexOptimize";
|
|
8
|
+
export declare const OPTIMIZE_CRON = "17 4 * * *";
|
|
9
|
+
export declare const RETRY_INTERVAL_KEY = "searchIndexRetry";
|
|
10
|
+
export declare const RETRY_INTERVAL_MS = 60000;
|
|
11
|
+
export declare const DEFAULT_SEARCH_WEIGHTS: number[];
|
|
12
|
+
export interface SearchIndexOwner {
|
|
13
|
+
getConnection(): AkanSqlClient;
|
|
14
|
+
getMeta(key: string): Promise<string | undefined> | string | undefined;
|
|
15
|
+
setMeta(key: string, value: string): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export interface SearchIndexOptions {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
tokenizer: string;
|
|
20
|
+
}
|
|
21
|
+
type SearchColumns = Record<(typeof textFieldRoles)[number], string>;
|
|
22
|
+
/**
|
|
23
|
+
* Reads `AKAN_SEARCH_ENABLED`. Unset means enabled; an unrecognised value fails the boot rather than
|
|
24
|
+
* silently falling back, because a typo like `ture` would otherwise look identical to the default.
|
|
25
|
+
*/
|
|
26
|
+
export declare const parseSearchEnabled: (value: string | undefined) => boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Turns raw user input into an fts5 MATCH expression.
|
|
29
|
+
*
|
|
30
|
+
* Raw text cannot be passed through: `-`, `:`, `*`, `"` and a trailing `AND` are all fts5 syntax and each
|
|
31
|
+
* raises `SQLiteError` instead of returning no rows. Quoting every term makes the whole input literal.
|
|
32
|
+
*/
|
|
33
|
+
export declare const toMatchExpression: (text: string, { prefix, columns }?: {
|
|
34
|
+
prefix?: boolean;
|
|
35
|
+
columns?: readonly SearchColumn[];
|
|
36
|
+
}) => string | null;
|
|
37
|
+
/**
|
|
38
|
+
* Owns the `search_doc` mirror and its fts5 index.
|
|
39
|
+
*
|
|
40
|
+
* The mirror is maintained by SQL triggers rather than document hooks because `updateOneByQuery` and friends
|
|
41
|
+
* deliberately fire no hooks — most searchable-field mutations go through exactly that path, so an app-level
|
|
42
|
+
* hook would miss them silently.
|
|
43
|
+
*/
|
|
44
|
+
export declare class SearchIndex {
|
|
45
|
+
#private;
|
|
46
|
+
constructor(owner: SearchIndexOwner, { enabled, tokenizer }: SearchIndexOptions);
|
|
47
|
+
get enabled(): boolean;
|
|
48
|
+
ensureSchema(): Promise<void>;
|
|
49
|
+
/** Returns whether this ref's mirror is now current. `false` means another process is rebuilding it. */
|
|
50
|
+
ensureRef(constant: ConstantModel, database: DatabaseModel): Promise<boolean>;
|
|
51
|
+
/** Re-runs the refs another process was holding. Returns how many are still outstanding. */
|
|
52
|
+
retryPending(): Promise<number>;
|
|
53
|
+
/**
|
|
54
|
+
* Rebuilds one ref's mirror rows in id-ordered chunks so a large table does not block the boot. `onChunk` runs
|
|
55
|
+
* between chunks and reports whether this process still holds the claim: a backfill that outlives the lock TTL
|
|
56
|
+
* would otherwise keep writing rows underneath the `DELETE` of the process that took over. Returns whether the
|
|
57
|
+
* whole table was covered.
|
|
58
|
+
*/
|
|
59
|
+
reconcileRef(ref: string, columns: SearchColumns, onChunk?: () => Promise<boolean>): Promise<boolean>;
|
|
60
|
+
/** Merges accumulated fts5 segments. Returns whether this process was the one that did the work. */
|
|
61
|
+
optimize(): Promise<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* Drops a ref's triggers so a bulk import skips the per-row mirror write. Pair with `resume`.
|
|
64
|
+
*
|
|
65
|
+
* The hash is cleared here rather than in `resume` alone: a process that dies mid-import never reaches `resume`,
|
|
66
|
+
* and a boot that finds the hash intact recreates the triggers and skips the backfill, leaving everything
|
|
67
|
+
* written in between missing from the mirror for good.
|
|
68
|
+
*/
|
|
69
|
+
suspend(database: DatabaseModel): Promise<void>;
|
|
70
|
+
/** Returns whether the mirror is current again; `false` means another process holds the rebuild. */
|
|
71
|
+
resume(constant: ConstantModel, database: DatabaseModel): Promise<boolean>;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const quoteIdent: (identifier: string) => string;
|
|
2
|
+
export declare const jsonPath: (path: string) => string;
|
|
3
|
+
export declare const stableJson: (value: unknown) => string;
|
|
4
|
+
/** Stable hash of a schema descriptor, stored in `_akan_meta` so a changed definition is detected without migrations. */
|
|
5
|
+
export declare const descriptorHash: (value: unknown) => Promise<string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type EnumInstance } from "akanjs/base";
|
|
2
|
-
import { type ConstantCls, type ConstantField } from "akanjs/constant";
|
|
2
|
+
import { type ConstantCls, type ConstantField, type TextFieldRole } from "akanjs/constant";
|
|
3
3
|
export declare const databaseModelVariants: readonly ["input", "object", "full", "light", "insight"];
|
|
4
4
|
export type DatabaseModelVariant = (typeof databaseModelVariants)[number];
|
|
5
5
|
export interface ConstantSchemaOptions {
|
|
@@ -75,7 +75,7 @@ export interface FieldSchema {
|
|
|
75
75
|
defaultLabel?: string;
|
|
76
76
|
exampleLabel?: string;
|
|
77
77
|
constraints: string[];
|
|
78
|
-
text?:
|
|
78
|
+
text?: TextFieldRole;
|
|
79
79
|
meta: Record<string, unknown>;
|
|
80
80
|
raw: ConstantField;
|
|
81
81
|
}
|
package/ui/Constant/schemaDoc.ts
CHANGED
|
@@ -7,7 +7,13 @@ import {
|
|
|
7
7
|
type PrimitiveScalar,
|
|
8
8
|
} from "akanjs/base";
|
|
9
9
|
import { capitalize } from "akanjs/common";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
type ConstantCls,
|
|
12
|
+
type ConstantField,
|
|
13
|
+
type ConstantModel,
|
|
14
|
+
ConstantRegistry,
|
|
15
|
+
type TextFieldRole,
|
|
16
|
+
} from "akanjs/constant";
|
|
11
17
|
|
|
12
18
|
export const databaseModelVariants = ["input", "object", "full", "light", "insight"] as const;
|
|
13
19
|
export type DatabaseModelVariant = (typeof databaseModelVariants)[number];
|
|
@@ -93,7 +99,7 @@ export interface FieldSchema {
|
|
|
93
99
|
defaultLabel?: string;
|
|
94
100
|
exampleLabel?: string;
|
|
95
101
|
constraints: string[];
|
|
96
|
-
text?:
|
|
102
|
+
text?: TextFieldRole;
|
|
97
103
|
meta: Record<string, unknown>;
|
|
98
104
|
raw: ConstantField;
|
|
99
105
|
}
|