@_tc/template-core 0.1.13 → 0.1.15
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/.skills/tc-component-usage-skills/SKILL.md +31 -9
- package/.skills/tc-component-usage-skills/reference/component-api.md +63 -42
- package/.skills/tc-component-usage-skills/reference/examples.md +34 -24
- package/.skills/tc-component-usage-skills/reference/patterns.md +52 -17
- package/.skills/tc-component-usage-skills/reference/template-core-frontend.md +104 -0
- package/.skills/tc-generator/SKILL.md +11 -3
- package/.skills/tc-generator/reference/example.md +1 -1
- package/.skills/tc-generator/reference/model-schema.md +4 -2
- package/.skills/tc-generator/reference/project-template/config/config.default.js +4 -0
- package/.skills/tc-generator/reference/project-template/index.js +1 -1
- package/.skills/tc-generator/reference/project-template/model/product/project/default.js +1 -0
- package/.skills/tc-generator/reference/project-template/package.json +16 -1
- package/.skills/tc-generator/reference/runtime-extensions.md +190 -0
- package/README.md +217 -2
- package/cjs/app/extend/db.js +20 -1
- package/cjs/bundler/utils.js +1 -1
- package/esm/app/extend/db.js +138 -3
- package/esm/bundler/utils.js +2 -1
- package/fe/frontend/apps/dash/Dashboard.js +3 -1
- package/fe/frontend/apps/dash/types.d.ts +8 -0
- package/fe/frontend/src/components/LanguageSwitch/LanguageSwitch.d.ts +14 -0
- package/fe/frontend/src/components/LanguageSwitch/LanguageSwitch.js +32 -0
- package/fe/frontend/src/components/LanguageSwitch/index.d.ts +4 -0
- package/fe/frontend/src/components/LanguageSwitch/index.js +3 -0
- package/fe/frontend/src/components/ThemeSwitch/ThemeSwitch.d.ts +15 -0
- package/fe/frontend/src/components/ThemeSwitch/ThemeSwitch.js +59 -0
- package/fe/frontend/src/components/ThemeSwitch/index.d.ts +4 -0
- package/fe/frontend/src/components/ThemeSwitch/index.js +3 -0
- package/fe/frontend/src/components/index.d.ts +11 -0
- package/fe/frontend/src/components/index.js +10 -0
- package/fe/frontend/src/index.d.ts +1 -0
- package/fe/frontend/src/index.js +1 -0
- package/fe/frontend/src/language/en-US.d.ts +13 -0
- package/fe/frontend/src/language/en-US.js +13 -0
- package/fe/frontend/src/language/index.d.ts +7 -0
- package/fe/frontend/src/language/index.js +7 -0
- package/fe/frontend/src/language/zh-CN.d.ts +13 -0
- package/fe/frontend/src/language/zh-CN.js +13 -0
- package/fe/packages/ui/react/components/Button/{SumbitButton.d.ts → SubmitButton.d.ts} +5 -5
- package/fe/packages/ui/react/components/Button/{SumbitButton.js → SubmitButton.js} +3 -3
- package/fe/packages/ui/react/components/Button/index.d.ts +1 -1
- package/fe/packages/ui/react/components/Button/index.js +1 -1
- package/fe/packages/ui/react/components/Modal/ModalManager.d.ts +3 -3
- package/fe/packages/ui/react/components/TableSearch/index.d.ts +1 -0
- package/package.json +1 -1
- package/types/app/extend/db.d.ts +54 -1
- package/types/config/config.default.d.ts +30 -0
- package/types/index.d.ts +1 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getText } from '../../common/language';
|
|
3
|
+
import { frontendLangKeys } from '../../language';
|
|
4
|
+
import { cn, Switch, Tooltip } from '../../../../packages/ui/react';
|
|
5
|
+
import { useI18nStore } from '../../../../packages/ui/react/i18n';
|
|
6
|
+
import { Moon, Sun } from 'lucide-react';
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
|
+
export const themeSwitchStorageKey = 'tc_theme';
|
|
9
|
+
const canUseDocument = () => typeof document !== 'undefined';
|
|
10
|
+
const canUseLocalStorage = () => typeof localStorage !== 'undefined';
|
|
11
|
+
const getStoredThemeMode = (storageKey) => {
|
|
12
|
+
if (!canUseLocalStorage())
|
|
13
|
+
return null;
|
|
14
|
+
const value = localStorage.getItem(storageKey);
|
|
15
|
+
return value === 'light' || value === 'dark' ? value : null;
|
|
16
|
+
};
|
|
17
|
+
const getCurrentThemeMode = (defaultValue, storageKey = themeSwitchStorageKey) => {
|
|
18
|
+
const storedMode = getStoredThemeMode(storageKey);
|
|
19
|
+
if (storedMode)
|
|
20
|
+
return storedMode;
|
|
21
|
+
if (defaultValue)
|
|
22
|
+
return defaultValue;
|
|
23
|
+
if (!canUseDocument())
|
|
24
|
+
return 'light';
|
|
25
|
+
return document.documentElement.classList.contains('dark') ? 'dark' : 'light';
|
|
26
|
+
};
|
|
27
|
+
const applyThemeMode = (mode, persist, storageKey) => {
|
|
28
|
+
if (!canUseDocument())
|
|
29
|
+
return;
|
|
30
|
+
const root = document.documentElement;
|
|
31
|
+
root.classList.toggle('dark', mode === 'dark');
|
|
32
|
+
root.style.colorScheme = mode;
|
|
33
|
+
if (persist && canUseLocalStorage()) {
|
|
34
|
+
localStorage.setItem(storageKey, mode);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const ThemeSwitch = ({ value, defaultValue, onChange, disabled, className, showLabel = false, persist = true, storageKey = themeSwitchStorageKey, }) => {
|
|
38
|
+
useI18nStore((state) => state.language);
|
|
39
|
+
const [internalMode, setInternalMode] = useState(() => getCurrentThemeMode(defaultValue, storageKey));
|
|
40
|
+
const isControlled = value !== undefined;
|
|
41
|
+
const mode = isControlled ? value : internalMode;
|
|
42
|
+
const checked = mode === 'dark';
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
applyThemeMode(mode, persist, storageKey);
|
|
45
|
+
}, [mode, persist, storageKey]);
|
|
46
|
+
const handleChange = (nextChecked) => {
|
|
47
|
+
const nextMode = nextChecked ? 'dark' : 'light';
|
|
48
|
+
if (!isControlled) {
|
|
49
|
+
setInternalMode(nextMode);
|
|
50
|
+
}
|
|
51
|
+
onChange?.(nextMode);
|
|
52
|
+
};
|
|
53
|
+
const label = mode === 'dark' ? getText(frontendLangKeys.themeSwitchDark) : getText(frontendLangKeys.themeSwitchLight);
|
|
54
|
+
const tooltip = checked
|
|
55
|
+
? getText(frontendLangKeys.themeSwitchToLight)
|
|
56
|
+
: getText(frontendLangKeys.themeSwitchToDark);
|
|
57
|
+
return (_jsxs("div", { className: cn('inline-flex shrink-0 items-center gap-2 text-foreground', className), children: [_jsx(Sun, { className: cn('h-4 w-4', checked ? 'text-muted-foreground' : 'text-foreground'), "aria-hidden": "true" }), _jsx(Tooltip, { content: tooltip, placement: "bottom", children: _jsx(Switch, { checked: checked, disabled: disabled, onChange: handleChange }) }), _jsx(Moon, { className: cn('h-4 w-4', checked ? 'text-foreground' : 'text-muted-foreground'), "aria-hidden": "true" }), showLabel && _jsx("span", { className: "min-w-8 text-xs text-muted-foreground", children: label })] }));
|
|
58
|
+
};
|
|
59
|
+
export default ThemeSwitch;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as AsyncSelect } from './AsyncSelect';
|
|
2
|
+
export * from './AsyncSelect';
|
|
3
|
+
export { default as HeaderView } from './BasePage/HeaderView';
|
|
4
|
+
export * from './BasePage/HeaderView';
|
|
5
|
+
export { default as LanguageSwitch } from './LanguageSwitch';
|
|
6
|
+
export * from './LanguageSwitch';
|
|
7
|
+
export * from './Router';
|
|
8
|
+
export * from './Router/type';
|
|
9
|
+
export { default as ThemeSwitch } from './ThemeSwitch';
|
|
10
|
+
export * from './ThemeSwitch';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as AsyncSelect } from './AsyncSelect';
|
|
2
|
+
export * from './AsyncSelect';
|
|
3
|
+
export { default as HeaderView } from './BasePage/HeaderView';
|
|
4
|
+
export * from './BasePage/HeaderView';
|
|
5
|
+
export { default as LanguageSwitch } from './LanguageSwitch';
|
|
6
|
+
export * from './LanguageSwitch';
|
|
7
|
+
export * from './Router';
|
|
8
|
+
export * from './Router/type';
|
|
9
|
+
export { default as ThemeSwitch } from './ThemeSwitch';
|
|
10
|
+
export * from './ThemeSwitch';
|
|
@@ -3,6 +3,7 @@ export type * from '../apps/dash/types';
|
|
|
3
3
|
export * from './main';
|
|
4
4
|
export type { CallComComponentsMap, CallComRenderer } from './defaultPages/SchemaPage/schemaType';
|
|
5
5
|
export type { FormFieldSchema, SchemaFormComponentsMap, SchemaFormNamespace, SelectProps } from '../../packages/ui/react';
|
|
6
|
+
export * from './components';
|
|
6
7
|
export { del, get, patch, post, put, request } from './common/request';
|
|
7
8
|
/**
|
|
8
9
|
* callCom 事件通信 权限
|
package/fe/frontend/src/index.js
CHANGED
|
@@ -5,6 +5,19 @@ export declare const frontendEnUSResources: {
|
|
|
5
5
|
readonly uiComponentsTitle: "UI Components";
|
|
6
6
|
readonly uiComponentsButton: "Click me";
|
|
7
7
|
};
|
|
8
|
+
readonly components: {
|
|
9
|
+
readonly languageSwitch: {
|
|
10
|
+
readonly placeholder: "Select language";
|
|
11
|
+
readonly zhCN: "简体中文";
|
|
12
|
+
readonly enUS: "English";
|
|
13
|
+
};
|
|
14
|
+
readonly themeSwitch: {
|
|
15
|
+
readonly light: "Light";
|
|
16
|
+
readonly dark: "Dark";
|
|
17
|
+
readonly toLight: "Switch to light theme";
|
|
18
|
+
readonly toDark: "Switch to dark theme";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
8
21
|
readonly common: {
|
|
9
22
|
readonly yes: "Yes";
|
|
10
23
|
readonly no: "No";
|
|
@@ -5,6 +5,19 @@ export const frontendEnUSResources = {
|
|
|
5
5
|
uiComponentsTitle: 'UI Components',
|
|
6
6
|
uiComponentsButton: 'Click me',
|
|
7
7
|
},
|
|
8
|
+
components: {
|
|
9
|
+
languageSwitch: {
|
|
10
|
+
placeholder: 'Select language',
|
|
11
|
+
zhCN: '简体中文',
|
|
12
|
+
enUS: 'English',
|
|
13
|
+
},
|
|
14
|
+
themeSwitch: {
|
|
15
|
+
light: 'Light',
|
|
16
|
+
dark: 'Dark',
|
|
17
|
+
toLight: 'Switch to light theme',
|
|
18
|
+
toDark: 'Switch to dark theme',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
8
21
|
common: {
|
|
9
22
|
yes: 'Yes',
|
|
10
23
|
no: 'No',
|
|
@@ -6,6 +6,13 @@ export declare const frontendLangKeys: {
|
|
|
6
6
|
readonly appTitle: string;
|
|
7
7
|
readonly uiComponentsTitle: string;
|
|
8
8
|
readonly uiComponentsButton: string;
|
|
9
|
+
readonly languageSwitchPlaceholder: string;
|
|
10
|
+
readonly languageSwitchZhCN: string;
|
|
11
|
+
readonly languageSwitchEnUS: string;
|
|
12
|
+
readonly themeSwitchLight: string;
|
|
13
|
+
readonly themeSwitchDark: string;
|
|
14
|
+
readonly themeSwitchToLight: string;
|
|
15
|
+
readonly themeSwitchToDark: string;
|
|
9
16
|
readonly yes: string;
|
|
10
17
|
readonly no: string;
|
|
11
18
|
readonly noData: string;
|
|
@@ -10,6 +10,13 @@ export const frontendLangKeys = {
|
|
|
10
10
|
appTitle: withI18nKey('frontend.app.title'),
|
|
11
11
|
uiComponentsTitle: withI18nKey('frontend.app.uiComponentsTitle'),
|
|
12
12
|
uiComponentsButton: withI18nKey('frontend.app.uiComponentsButton'),
|
|
13
|
+
languageSwitchPlaceholder: withI18nKey('frontend.components.languageSwitch.placeholder'),
|
|
14
|
+
languageSwitchZhCN: withI18nKey('frontend.components.languageSwitch.zhCN'),
|
|
15
|
+
languageSwitchEnUS: withI18nKey('frontend.components.languageSwitch.enUS'),
|
|
16
|
+
themeSwitchLight: withI18nKey('frontend.components.themeSwitch.light'),
|
|
17
|
+
themeSwitchDark: withI18nKey('frontend.components.themeSwitch.dark'),
|
|
18
|
+
themeSwitchToLight: withI18nKey('frontend.components.themeSwitch.toLight'),
|
|
19
|
+
themeSwitchToDark: withI18nKey('frontend.components.themeSwitch.toDark'),
|
|
13
20
|
yes: withI18nKey('frontend.common.yes'),
|
|
14
21
|
no: withI18nKey('frontend.common.no'),
|
|
15
22
|
noData: withI18nKey('frontend.common.noData'),
|
|
@@ -5,6 +5,19 @@ export declare const frontendZhCNResources: {
|
|
|
5
5
|
readonly uiComponentsTitle: "UI 组件";
|
|
6
6
|
readonly uiComponentsButton: "点击我";
|
|
7
7
|
};
|
|
8
|
+
readonly components: {
|
|
9
|
+
readonly languageSwitch: {
|
|
10
|
+
readonly placeholder: "选择语言";
|
|
11
|
+
readonly zhCN: "简体中文";
|
|
12
|
+
readonly enUS: "English";
|
|
13
|
+
};
|
|
14
|
+
readonly themeSwitch: {
|
|
15
|
+
readonly light: "浅色";
|
|
16
|
+
readonly dark: "深色";
|
|
17
|
+
readonly toLight: "切换为浅色主题";
|
|
18
|
+
readonly toDark: "切换为深色主题";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
8
21
|
readonly common: {
|
|
9
22
|
readonly yes: "是";
|
|
10
23
|
readonly no: "否";
|
|
@@ -5,6 +5,19 @@ export const frontendZhCNResources = {
|
|
|
5
5
|
uiComponentsTitle: 'UI 组件',
|
|
6
6
|
uiComponentsButton: '点击我',
|
|
7
7
|
},
|
|
8
|
+
components: {
|
|
9
|
+
languageSwitch: {
|
|
10
|
+
placeholder: '选择语言',
|
|
11
|
+
zhCN: '简体中文',
|
|
12
|
+
enUS: 'English',
|
|
13
|
+
},
|
|
14
|
+
themeSwitch: {
|
|
15
|
+
light: '浅色',
|
|
16
|
+
dark: '深色',
|
|
17
|
+
toLight: '切换为浅色主题',
|
|
18
|
+
toDark: '切换为深色主题',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
8
21
|
common: {
|
|
9
22
|
yes: '是',
|
|
10
23
|
no: '否',
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { MOmit } from '../../types';
|
|
2
2
|
import { type ButtonElementProps } from './Button';
|
|
3
|
-
export type
|
|
3
|
+
export type SubmitButtonProps = MOmit<ButtonElementProps, 'onClick'> & {
|
|
4
4
|
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => Promise<void | boolean> | void;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
8
|
* 会自动添加loading 其余同button一致
|
|
9
9
|
*/
|
|
10
|
-
declare const
|
|
11
|
-
declare const AsynchronousButton: (props:
|
|
12
|
-
export { AsynchronousButton,
|
|
13
|
-
//# sourceMappingURL=
|
|
10
|
+
declare const SubmitButton: (props: SubmitButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const AsynchronousButton: (props: SubmitButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { AsynchronousButton, SubmitButton };
|
|
13
|
+
//# sourceMappingURL=SubmitButton.d.ts.map
|
|
@@ -6,7 +6,7 @@ import { Button } from './Button';
|
|
|
6
6
|
*
|
|
7
7
|
* 会自动添加loading 其余同button一致
|
|
8
8
|
*/
|
|
9
|
-
const
|
|
9
|
+
const SubmitButton = (props) => {
|
|
10
10
|
const { onClick, className, loading: loadingProp, ...bprops } = props;
|
|
11
11
|
const [loading, uLoading] = useState(false);
|
|
12
12
|
return (_jsx(Button, { className: cn('tc-ui-submit-button', className), loading: loading || loadingProp, onClick: async (e) => {
|
|
@@ -21,5 +21,5 @@ const SumbitButton = (props) => {
|
|
|
21
21
|
}
|
|
22
22
|
}, ...bprops }));
|
|
23
23
|
};
|
|
24
|
-
const AsynchronousButton =
|
|
25
|
-
export { AsynchronousButton,
|
|
24
|
+
const AsynchronousButton = SubmitButton;
|
|
25
|
+
export { AsynchronousButton, SubmitButton };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Button } from './Button';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './SubmitButton';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type SubmitButtonProps } from '../Button';
|
|
3
3
|
import { type ModalProps } from './Modal';
|
|
4
4
|
type ModalConfig = Omit<ModalProps, 'open' | 'onClose' | 'children'> & {
|
|
5
5
|
id: string;
|
|
@@ -31,7 +31,7 @@ export declare const openConfirmModal: (pConfig: Pick<OpenModalConfig, "content"
|
|
|
31
31
|
/** 取消按钮文本 */
|
|
32
32
|
cancelText?: string;
|
|
33
33
|
/** 确认回调 */
|
|
34
|
-
onOk?:
|
|
34
|
+
onOk?: SubmitButtonProps["onClick"];
|
|
35
35
|
/** 取消回调 */
|
|
36
36
|
onCancel?: () => void;
|
|
37
37
|
}) => string;
|
|
@@ -48,7 +48,7 @@ export declare const modal: {
|
|
|
48
48
|
/** 取消按钮文本 */
|
|
49
49
|
cancelText?: string;
|
|
50
50
|
/** 确认回调 */
|
|
51
|
-
onOk?:
|
|
51
|
+
onOk?: SubmitButtonProps["onClick"];
|
|
52
52
|
/** 取消回调 */
|
|
53
53
|
onCancel?: () => void;
|
|
54
54
|
}) => string;
|
package/package.json
CHANGED
package/types/app/extend/db.d.ts
CHANGED
|
@@ -1,2 +1,55 @@
|
|
|
1
1
|
import type { KoaApp } from "../type";
|
|
2
|
-
export
|
|
2
|
+
export type DBValue = unknown;
|
|
3
|
+
export type SQLiteValue = string | number | bigint | null | Uint8Array;
|
|
4
|
+
export type SQLiteParams = SQLiteValue[] | Record<string, SQLiteValue>;
|
|
5
|
+
export interface DBDataOptions {
|
|
6
|
+
namespace?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ListDBDataOptions extends DBDataOptions {
|
|
9
|
+
limit?: number;
|
|
10
|
+
offset?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface DBDataRecord<T = DBValue> {
|
|
13
|
+
key: string;
|
|
14
|
+
value: T;
|
|
15
|
+
namespace: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
}
|
|
19
|
+
export interface DBRunResult {
|
|
20
|
+
changes: number;
|
|
21
|
+
lastInsertRowid: number | bigint;
|
|
22
|
+
}
|
|
23
|
+
export interface FrameworkDB {
|
|
24
|
+
dbPath: string;
|
|
25
|
+
getDBConnection: () => unknown;
|
|
26
|
+
/**
|
|
27
|
+
* 仅用于固定 SQL,例如建表或迁移。不要拼接用户输入。
|
|
28
|
+
*/
|
|
29
|
+
execDB: (sql: string) => void;
|
|
30
|
+
/**
|
|
31
|
+
* 执行写入 SQL。用户输入必须通过 params 参数绑定,不要拼接到 sql 字符串中。
|
|
32
|
+
*/
|
|
33
|
+
runDB: (sql: string, params?: SQLiteParams) => DBRunResult;
|
|
34
|
+
/**
|
|
35
|
+
* 查询多行数据。用户输入必须通过 params 参数绑定,不要拼接到 sql 字符串中。
|
|
36
|
+
*/
|
|
37
|
+
queryDB: <T extends object = Record<string, unknown>>(sql: string, params?: SQLiteParams) => T[];
|
|
38
|
+
/**
|
|
39
|
+
* 查询单行数据。用户输入必须通过 params 参数绑定,不要拼接到 sql 字符串中。
|
|
40
|
+
*/
|
|
41
|
+
getDBFirst: <T extends object = Record<string, unknown>>(sql: string, params?: SQLiteParams) => T | undefined;
|
|
42
|
+
transactionDB: <T>(handler: (db: FrameworkDB) => T) => T;
|
|
43
|
+
getDBData: <T = DBValue>(key: string, options?: DBDataOptions) => T | undefined;
|
|
44
|
+
getDBDataRecord: <T = DBValue>(key: string, options?: DBDataOptions) => DBDataRecord<T> | undefined;
|
|
45
|
+
setDBData: <T = DBValue>(key: string, value: T, options?: DBDataOptions) => DBRunResult;
|
|
46
|
+
hasDBData: (key: string, options?: DBDataOptions) => boolean;
|
|
47
|
+
deleteDBData: (key: string, options?: DBDataOptions) => boolean;
|
|
48
|
+
listDBData: <T = DBValue>(options?: ListDBDataOptions) => DBDataRecord<T>[];
|
|
49
|
+
countDBData: (options?: DBDataOptions) => number;
|
|
50
|
+
clearDBData: (options?: DBDataOptions) => number;
|
|
51
|
+
closeDB: () => void;
|
|
52
|
+
}
|
|
53
|
+
export type DB = FrameworkDB;
|
|
54
|
+
export type DBFactory = (app: KoaApp) => DB | Promise<DB>;
|
|
55
|
+
export default function getDB(app: KoaApp): FrameworkDB;
|
|
@@ -1,8 +1,38 @@
|
|
|
1
|
+
export interface DefaultSQLiteConfig {
|
|
2
|
+
path?: string;
|
|
3
|
+
filename?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface DefaultDBConfig {
|
|
6
|
+
/**
|
|
7
|
+
* SQLite 数据库文件路径。相对路径会基于业务项目 baseDir 解析。
|
|
8
|
+
*/
|
|
9
|
+
path?: string;
|
|
10
|
+
/**
|
|
11
|
+
* SQLite 数据库文件路径,作用同 path。
|
|
12
|
+
*/
|
|
13
|
+
filename?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 兼容旧式或直观命名,作用同 path。
|
|
16
|
+
*/
|
|
17
|
+
sqlitePath?: string;
|
|
18
|
+
/**
|
|
19
|
+
* SQLite 子配置。传字符串时表示数据库文件路径。
|
|
20
|
+
*/
|
|
21
|
+
sqlite?: string | DefaultSQLiteConfig;
|
|
22
|
+
}
|
|
1
23
|
export interface DefaultAppConfig {
|
|
2
24
|
frameName: string;
|
|
3
25
|
port?: number;
|
|
4
26
|
host?: string;
|
|
5
27
|
env?: string;
|
|
28
|
+
/**
|
|
29
|
+
* 框架默认数据库配置。默认使用 SQLite。
|
|
30
|
+
*/
|
|
31
|
+
db?: string | DefaultDBConfig;
|
|
32
|
+
/**
|
|
33
|
+
* SQLite 数据库路径或配置。等价于 db.sqlite。
|
|
34
|
+
*/
|
|
35
|
+
sqlite?: string | DefaultSQLiteConfig;
|
|
6
36
|
signKey: string;
|
|
7
37
|
apiSignVerify?: {
|
|
8
38
|
whiteList?: string[];
|
package/types/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import "./app/typings";
|
|
|
4
4
|
import { MOmit } from "./typings/type";
|
|
5
5
|
export type { FrameworkAugment, KoaApp } from "./packages/core/index";
|
|
6
6
|
export type { ControllerFN, Ctx, ServiceFN } from "./app/type";
|
|
7
|
+
export type { DB, DBDataOptions, DBDataRecord, DBFactory, DBRunResult, FrameworkDB, ListDBDataOptions, SQLiteParams, SQLiteValue, } from "./app/extend/db";
|
|
7
8
|
export type { Router };
|
|
8
9
|
export declare const serverStart: (options?: MOmit<StartOptions, "frameBaseDir">) => Promise<import("./packages/core/index").KoaApp>;
|
|
9
10
|
export declare const baseFn: {
|