@wzyjs/types 0.2.0 → 0.2.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/dist/cjs/api.d.ts +33 -0
- package/dist/cjs/api.js +40 -0
- package/{base.ts → dist/cjs/base.d.ts} +2 -5
- package/dist/cjs/base.js +17 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +27 -0
- package/dist/cjs/other.d.ts +6 -0
- package/dist/cjs/other.js +17 -0
- package/dist/esm/api.d.ts +33 -0
- package/dist/esm/api.js +23 -0
- package/dist/esm/base.d.ts +2 -0
- package/dist/esm/base.js +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/other.d.ts +6 -0
- package/dist/esm/other.js +1 -0
- package/package.json +17 -3
- package/api.ts +0 -43
- package/dist/cjs/common/index.d.ts +0 -6
- package/dist/cjs/common/tools/index.d.ts +0 -4
- package/dist/cjs/common/tools/number.d.ts +0 -3
- package/dist/cjs/common/tools/number.js +0 -34
- package/dist/cjs/common/tools/object.d.ts +0 -10
- package/dist/cjs/common/tools/object.js +0 -43
- package/dist/cjs/common/tools/other.d.ts +0 -26
- package/dist/cjs/common/tools/other.js +0 -112
- package/dist/cjs/common/tools/string.d.ts +0 -16
- package/dist/cjs/common/tools/string.js +0 -137
- package/dist/cjs/common/types/index.d.ts +0 -20
- package/dist/cjs/fe/dayjs.d.ts +0 -4
- package/dist/cjs/fe/element.d.ts +0 -9
- package/dist/cjs/fe/index.d.ts +0 -20
- package/dist/cjs/fe/middlewares/error.d.ts +0 -3
- package/dist/cjs/fe/middlewares/index.d.ts +0 -1
- package/dist/cjs/fe/other.d.ts +0 -1
- package/dist/cjs/fe/style.d.ts +0 -10
- package/dist/cjs/index_all.d.ts +0 -3
- package/dist/cjs/index_fe.d.ts +0 -2
- package/dist/cjs/index_rd.d.ts +0 -2
- package/dist/cjs/index_rd.js +0 -141
- package/dist/cjs/rd/database/Collection.d.ts +0 -22
- package/dist/cjs/rd/database/Collection.js +0 -202
- package/dist/cjs/rd/database/Database.d.ts +0 -10
- package/dist/cjs/rd/database/Database.js +0 -25
- package/dist/cjs/rd/database/index.d.ts +0 -2
- package/dist/cjs/rd/database/types.d.ts +0 -151
- package/dist/cjs/rd/database/types.js +0 -25
- package/dist/cjs/rd/database/utils.d.ts +0 -3
- package/dist/cjs/rd/database/utils.js +0 -30
- package/dist/cjs/rd/index.d.ts +0 -3
- package/dist/cjs/rd/jsonFile/index.d.ts +0 -6
- package/dist/cjs/rd/jsonFile/index.js +0 -29
- package/dist/cjs/rd/mail/index.d.ts +0 -1
- package/dist/cjs/rd/mail/index.js +0 -31
- package/dist/cjs/rd/middlewares/index.d.ts +0 -1
- package/dist/cjs/rd/middlewares/logger.d.ts +0 -1
- package/dist/esm/common/index.d.ts +0 -6
- package/dist/esm/common/tools/index.d.ts +0 -4
- package/dist/esm/common/tools/number.d.ts +0 -3
- package/dist/esm/common/tools/number.js +0 -30
- package/dist/esm/common/tools/object.d.ts +0 -10
- package/dist/esm/common/tools/object.js +0 -39
- package/dist/esm/common/tools/other.d.ts +0 -26
- package/dist/esm/common/tools/other.js +0 -106
- package/dist/esm/common/tools/string.d.ts +0 -16
- package/dist/esm/common/tools/string.js +0 -120
- package/dist/esm/common/types/index.d.ts +0 -20
- package/dist/esm/fe/dayjs.d.ts +0 -4
- package/dist/esm/fe/dayjs.js +0 -18
- package/dist/esm/fe/element.d.ts +0 -9
- package/dist/esm/fe/element.js +0 -36
- package/dist/esm/fe/index.d.ts +0 -20
- package/dist/esm/fe/index.js +0 -16
- package/dist/esm/fe/middlewares/error.d.ts +0 -3
- package/dist/esm/fe/middlewares/error.js +0 -22
- package/dist/esm/fe/middlewares/index.d.ts +0 -1
- package/dist/esm/fe/other.d.ts +0 -1
- package/dist/esm/fe/other.js +0 -10
- package/dist/esm/fe/style.d.ts +0 -10
- package/dist/esm/fe/style.js +0 -45
- package/dist/esm/index_all.d.ts +0 -3
- package/dist/esm/index_fe.d.ts +0 -2
- package/dist/esm/index_fe.js +0 -19
- package/dist/esm/index_rd.d.ts +0 -2
- package/dist/esm/rd/database/Collection.d.ts +0 -22
- package/dist/esm/rd/database/Database.d.ts +0 -10
- package/dist/esm/rd/database/index.d.ts +0 -2
- package/dist/esm/rd/database/types.d.ts +0 -151
- package/dist/esm/rd/database/utils.d.ts +0 -3
- package/dist/esm/rd/index.d.ts +0 -3
- package/dist/esm/rd/jsonFile/index.d.ts +0 -6
- package/dist/esm/rd/mail/index.d.ts +0 -1
- package/index.ts +0 -3
- package/other.ts +0 -9
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface RequestRes<D = any> {
|
|
2
|
-
success?: boolean;
|
|
3
|
-
message?: string;
|
|
4
|
-
data?: D;
|
|
5
|
-
}
|
|
6
|
-
export type KeyValue<D extends object | string = string, V = any> = Partial<Record<D extends string ? string : keyof D, V>>;
|
|
7
|
-
export interface Pagination {
|
|
8
|
-
current?: number;
|
|
9
|
-
pageSize?: number;
|
|
10
|
-
}
|
|
11
|
-
export type SortParams<D extends object | string = string> = Record<D extends string ? string : keyof D, 'ascend' | 'descend'>;
|
|
12
|
-
export type OrderParams<D extends object | string = string> = {
|
|
13
|
-
field: D extends string ? string : keyof D;
|
|
14
|
-
type: 'asc' | 'desc';
|
|
15
|
-
};
|
|
16
|
-
export interface Option<V extends string | number = string> {
|
|
17
|
-
label: string;
|
|
18
|
-
value: V;
|
|
19
|
-
children?: Option<V>[];
|
|
20
|
-
}
|
package/dist/esm/fe/dayjs.d.ts
DELETED
package/dist/esm/fe/dayjs.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
export { Dayjs, default } from 'dayjs';
|
|
3
|
-
import isBetween from 'dayjs/plugin/isBetween';
|
|
4
|
-
import weekday from 'dayjs/plugin/weekday';
|
|
5
|
-
import localeData from 'dayjs/plugin/localeData';
|
|
6
|
-
import isoWeek from 'dayjs/plugin/isoWeek';
|
|
7
|
-
import updateLocale from 'dayjs/plugin/updateLocale';
|
|
8
|
-
import 'dayjs/locale/zh-cn';
|
|
9
|
-
|
|
10
|
-
dayjs.extend(isBetween);
|
|
11
|
-
dayjs.extend(weekday);
|
|
12
|
-
dayjs.extend(localeData);
|
|
13
|
-
dayjs.extend(isoWeek);
|
|
14
|
-
dayjs.extend(updateLocale);
|
|
15
|
-
dayjs.locale('zh-cn');
|
|
16
|
-
dayjs.updateLocale('zh-cn', {
|
|
17
|
-
weekStart: 1,
|
|
18
|
-
});
|
package/dist/esm/fe/element.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const scrollIntoView: (el: Element, option?: ScrollIntoViewOptions) => void;
|
|
2
|
-
export declare const getElement: (el: string | Element) => {
|
|
3
|
-
element: null;
|
|
4
|
-
originalStyle: {};
|
|
5
|
-
} | {
|
|
6
|
-
element: Element;
|
|
7
|
-
originalStyle: CSSStyleDeclaration;
|
|
8
|
-
};
|
|
9
|
-
export declare const isElementInViewport: (el: string | Element) => boolean | undefined;
|
package/dist/esm/fe/element.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// 滚动到让指定元素显示出来的位置
|
|
2
|
-
const scrollIntoView = (el, option) => {
|
|
3
|
-
if (!el) {
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
el.scrollIntoView({ behavior: 'smooth', block: 'start', ...option });
|
|
7
|
-
};
|
|
8
|
-
// 获取指定元素 已经元素原始的样式
|
|
9
|
-
const getElement = (el) => {
|
|
10
|
-
const element = typeof el === 'string' ? document.querySelector(el) : el;
|
|
11
|
-
if (!element) {
|
|
12
|
-
return {
|
|
13
|
-
element: null,
|
|
14
|
-
originalStyle: {},
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
// 获取元素原始的样式
|
|
18
|
-
return {
|
|
19
|
-
element,
|
|
20
|
-
originalStyle: window.getComputedStyle(element),
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
// 判断元素是否在可见范围内
|
|
24
|
-
const isElementInViewport = (el) => {
|
|
25
|
-
const { element } = getElement(el);
|
|
26
|
-
if (!element) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const rect = element.getBoundingClientRect();
|
|
30
|
-
return (rect.top >= 0 &&
|
|
31
|
-
rect.left >= 0 &&
|
|
32
|
-
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
|
|
33
|
-
rect.right <= (window.innerWidth || document.documentElement.clientWidth));
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export { getElement, isElementInViewport, scrollIntoView };
|
package/dist/esm/fe/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import md5 from 'md5';
|
|
2
|
-
import classnames from 'classnames';
|
|
3
|
-
import copy from 'copy-to-clipboard';
|
|
4
|
-
import anime from 'animejs';
|
|
5
|
-
export { copy, classnames, md5, anime };
|
|
6
|
-
export declare const localforage: {
|
|
7
|
-
config: {
|
|
8
|
-
(options: LocalForageOptions): boolean;
|
|
9
|
-
(options: string): any;
|
|
10
|
-
(): LocalForageOptions;
|
|
11
|
-
};
|
|
12
|
-
setItem: <T>(key: string, value: T, callback?: ((err: any, value: T) => void) | undefined) => Promise<T>;
|
|
13
|
-
getItem: <T_1>(key: string, callback?: ((err: any, value: T_1 | null) => void) | undefined) => Promise<T_1 | null>;
|
|
14
|
-
removeItem: (key: string, callback?: ((err: any) => void) | undefined) => Promise<void>;
|
|
15
|
-
};
|
|
16
|
-
export { default as dayjs, Dayjs } from './dayjs';
|
|
17
|
-
export * from './style';
|
|
18
|
-
export * from './element';
|
|
19
|
-
export * from './other';
|
|
20
|
-
export * from './middlewares';
|
package/dist/esm/fe/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { default as md5 } from 'md5';
|
|
2
|
-
export { default as classnames } from 'classnames';
|
|
3
|
-
export { default as copy } from 'copy-to-clipboard';
|
|
4
|
-
import { config, setItem, getItem, removeItem } from 'localforage';
|
|
5
|
-
export { default as anime } from 'animejs';
|
|
6
|
-
import './dayjs.js';
|
|
7
|
-
export { setupHttpClient } from '@midwayjs/rpc';
|
|
8
|
-
|
|
9
|
-
const localforage = {
|
|
10
|
-
config,
|
|
11
|
-
setItem,
|
|
12
|
-
getItem,
|
|
13
|
-
removeItem,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { localforage };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export { setupHttpClient } from '@midwayjs/rpc';
|
|
2
|
-
|
|
3
|
-
const ErrorMiddleware = async (ctx, next) => {
|
|
4
|
-
try {
|
|
5
|
-
await next();
|
|
6
|
-
}
|
|
7
|
-
catch (err) {
|
|
8
|
-
switch (err?.status) {
|
|
9
|
-
case 401:
|
|
10
|
-
location.href = '/login';
|
|
11
|
-
break;
|
|
12
|
-
case 500:
|
|
13
|
-
alert('Internal Server Error');
|
|
14
|
-
break;
|
|
15
|
-
default:
|
|
16
|
-
alert(`Unknown Error, status: ${err?.status}`);
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export { ErrorMiddleware };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './error';
|
package/dist/esm/fe/other.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const readClipboard: () => Promise<string>;
|
package/dist/esm/fe/other.js
DELETED
package/dist/esm/fe/style.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const hexToRgba: (hexColor: string, a?: number) => {
|
|
2
|
-
nums: {
|
|
3
|
-
red: number;
|
|
4
|
-
green: number;
|
|
5
|
-
blue: number;
|
|
6
|
-
};
|
|
7
|
-
text: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const flashBackground: (el: string | Element, color: string, a?: number) => void;
|
|
10
|
-
export declare const flashBorder: (el: string | Element, color: string, a?: number) => void;
|
package/dist/esm/fe/style.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import anime from 'animejs';
|
|
2
|
-
import { getElement } from './element.js';
|
|
3
|
-
|
|
4
|
-
// 颜色值转换
|
|
5
|
-
const hexToRgba = (hexColor, a = 1) => {
|
|
6
|
-
let red = parseInt(hexColor.substr(1, 2), 16);
|
|
7
|
-
let green = parseInt(hexColor.substr(3, 2), 16);
|
|
8
|
-
let blue = parseInt(hexColor.substr(5, 2), 16);
|
|
9
|
-
return {
|
|
10
|
-
nums: { red, green, blue },
|
|
11
|
-
text: `rgba(${red}, ${green}, ${blue}, ${a})`,
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
// 背景颜色闪动
|
|
15
|
-
const flashBackground = (el, color, a = 1) => {
|
|
16
|
-
const { element, originalStyle } = getElement(el);
|
|
17
|
-
if (!element) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
anime({
|
|
21
|
-
targets: element,
|
|
22
|
-
backgroundColor: [hexToRgba(color, a).text, originalStyle.backgroundColor],
|
|
23
|
-
duration: 1500,
|
|
24
|
-
easing: 'easeInOutSine',
|
|
25
|
-
direction: 'alternate',
|
|
26
|
-
loop: false,
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
// 边框闪动
|
|
30
|
-
const flashBorder = (el, color, a = 1) => {
|
|
31
|
-
const { element } = getElement(el);
|
|
32
|
-
if (!element) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
anime({
|
|
36
|
-
targets: element,
|
|
37
|
-
border: [`1px solid ${hexToRgba(color, a).text}`, 'none'],
|
|
38
|
-
duration: 1500,
|
|
39
|
-
easing: 'easeInOutSine',
|
|
40
|
-
direction: 'alternate',
|
|
41
|
-
loop: false,
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export { flashBackground, flashBorder, hexToRgba };
|
package/dist/esm/index_all.d.ts
DELETED
package/dist/esm/index_fe.d.ts
DELETED
package/dist/esm/index_fe.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export { default as _, cloneDeep, debounce, find, groupBy, isBoolean, isEmpty, isEqual, isError, isFunction, isNumber, isObject, isString, merge, noop, omit, pick, uniq, uniqBy, uniqWith } from 'lodash';
|
|
2
|
-
import * as consola from 'consola';
|
|
3
|
-
export { consola };
|
|
4
|
-
export { amount, getChinese, getChineseByStr, getCookie, getLength, getProxyUrl, getRandomColor, getRandomString, getSliceStr, getStrLength, getType, isJson, jsonParse, replaceAll, replaceByRules, toString } from './common/tools/string.js';
|
|
5
|
-
export { filterParams, findItem, watch } from './common/tools/object.js';
|
|
6
|
-
export { delay, executePromise, handleParams, handleRes2List, locationFn } from './common/tools/other.js';
|
|
7
|
-
export { getFileSize, getRandomNum, limitDecimals } from './common/tools/number.js';
|
|
8
|
-
export { localforage } from './fe/index.js';
|
|
9
|
-
import './fe/dayjs.js';
|
|
10
|
-
export { Dayjs, default as dayjs } from 'dayjs';
|
|
11
|
-
export { flashBackground, flashBorder, hexToRgba } from './fe/style.js';
|
|
12
|
-
export { getElement, isElementInViewport, scrollIntoView } from './fe/element.js';
|
|
13
|
-
export { readClipboard } from './fe/other.js';
|
|
14
|
-
export { setupHttpClient } from '@midwayjs/rpc';
|
|
15
|
-
export { ErrorMiddleware } from './fe/middlewares/error.js';
|
|
16
|
-
export { default as copy } from 'copy-to-clipboard';
|
|
17
|
-
export { default as classnames } from 'classnames';
|
|
18
|
-
export { default as md5 } from 'md5';
|
|
19
|
-
export { default as anime } from 'animejs';
|
package/dist/esm/index_rd.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Database, IKeyValue } from '@cloudbase/node-sdk';
|
|
2
|
-
import { Add, Conditions, Count, Delete, Find, FindList, IdConditions, MethodParams, Update, WhereConditions } from './types';
|
|
3
|
-
export declare class Collection<D extends IKeyValue> {
|
|
4
|
-
private readonly db;
|
|
5
|
-
private readonly collection;
|
|
6
|
-
constructor(db: Database.Db, name: string);
|
|
7
|
-
private joinConditions;
|
|
8
|
-
private request;
|
|
9
|
-
private handleRes;
|
|
10
|
-
private handleData;
|
|
11
|
-
handleConditions(params: MethodParams<D>): MethodParams<D>;
|
|
12
|
-
private exec;
|
|
13
|
-
add(data: Add.Params<D>['data']): Promise<Add.Res>;
|
|
14
|
-
add(data: Add.Params<D>['data'], isReturn: true, conditions?: Pick<IdConditions, 'field'>): Promise<Find.Res<D>>;
|
|
15
|
-
delete(conditions: Conditions): Promise<Delete.Res>;
|
|
16
|
-
update(conditions: Conditions, data: Update.Params<D>['data'], isSet?: true): Promise<Update.Res<D>>;
|
|
17
|
-
update(conditions: IdConditions, data: Update.Params<D>['data'], isSet?: true): Promise<Update.Res<D>>;
|
|
18
|
-
update(conditions: IdConditions, data: Update.Params<D>['data'], isReturn: true, isSet?: true): Promise<Find.Res<D>>;
|
|
19
|
-
find(conditions?: Conditions): Promise<Find.Res<D>>;
|
|
20
|
-
findList(conditions?: WhereConditions): Promise<FindList.Res<D>>;
|
|
21
|
-
count(conditions: Conditions): Promise<Count.Res>;
|
|
22
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import tcb, { IKeyValue } from '@cloudbase/node-sdk';
|
|
2
|
-
import { Config } from './types';
|
|
3
|
-
import { Collection } from './Collection';
|
|
4
|
-
export declare class Database {
|
|
5
|
-
private readonly db;
|
|
6
|
-
private readonly instance;
|
|
7
|
-
constructor(config: Config);
|
|
8
|
-
collection<D extends IKeyValue>(name: string): Collection<D>;
|
|
9
|
-
createCollection(name: string): tcb.IBaseRes;
|
|
10
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { Database, ICountRes } from '@cloudbase/node-sdk';
|
|
2
|
-
export interface Config {
|
|
3
|
-
env: string;
|
|
4
|
-
secretId: string;
|
|
5
|
-
secretKey: string;
|
|
6
|
-
}
|
|
7
|
-
export type IdConditions = {
|
|
8
|
-
_id: string;
|
|
9
|
-
field?: string[] | {
|
|
10
|
-
[key: string]: false;
|
|
11
|
-
};
|
|
12
|
-
options?: {
|
|
13
|
-
timeout: number;
|
|
14
|
-
multiple?: false;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export declare enum Command {
|
|
18
|
-
Eq = "eq",
|
|
19
|
-
Neq = "neq",
|
|
20
|
-
Lt = "lt",
|
|
21
|
-
Lte = "lte",
|
|
22
|
-
Gt = "gt",
|
|
23
|
-
Gte = "gte",
|
|
24
|
-
In = "in",
|
|
25
|
-
Nin = "nin",
|
|
26
|
-
Gtlt = "gtlt"
|
|
27
|
-
}
|
|
28
|
-
export type CommandWhere = {
|
|
29
|
-
type: Command.Eq;
|
|
30
|
-
value: any;
|
|
31
|
-
} | {
|
|
32
|
-
type: Command.Neq;
|
|
33
|
-
value: any;
|
|
34
|
-
} | {
|
|
35
|
-
type: Command.Gt;
|
|
36
|
-
value: number;
|
|
37
|
-
} | {
|
|
38
|
-
type: Command.Gte;
|
|
39
|
-
value: number;
|
|
40
|
-
} | {
|
|
41
|
-
type: Command.Lt;
|
|
42
|
-
value: number;
|
|
43
|
-
} | {
|
|
44
|
-
type: Command.Lte;
|
|
45
|
-
value: number;
|
|
46
|
-
} | {
|
|
47
|
-
type: Command.Gtlt;
|
|
48
|
-
value: number[];
|
|
49
|
-
} | {
|
|
50
|
-
type: Command.In;
|
|
51
|
-
value: any[];
|
|
52
|
-
} | {
|
|
53
|
-
type: Command.Nin;
|
|
54
|
-
value: any[];
|
|
55
|
-
};
|
|
56
|
-
export type WhereConditions = {
|
|
57
|
-
where?: {
|
|
58
|
-
[key: string]: any | CommandWhere;
|
|
59
|
-
};
|
|
60
|
-
field?: string[] | {
|
|
61
|
-
[key: string]: false;
|
|
62
|
-
};
|
|
63
|
-
page?: {
|
|
64
|
-
size?: number;
|
|
65
|
-
current?: number;
|
|
66
|
-
};
|
|
67
|
-
order?: {
|
|
68
|
-
field: string;
|
|
69
|
-
type?: 'asc' | 'desc';
|
|
70
|
-
};
|
|
71
|
-
options?: {
|
|
72
|
-
timeout?: number;
|
|
73
|
-
multiple?: boolean;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
export type Conditions = IdConditions | WhereConditions;
|
|
77
|
-
export declare enum Method {
|
|
78
|
-
Add = "add",
|
|
79
|
-
Find = "find",
|
|
80
|
-
FindList = "findList",
|
|
81
|
-
Delete = "delete",
|
|
82
|
-
Update = "update",
|
|
83
|
-
Count = "count"
|
|
84
|
-
}
|
|
85
|
-
export declare namespace Add {
|
|
86
|
-
type Params<D> = {
|
|
87
|
-
method: Method.Add;
|
|
88
|
-
data: D;
|
|
89
|
-
conditions?: Pick<IdConditions, 'field'>;
|
|
90
|
-
isReturn?: true;
|
|
91
|
-
};
|
|
92
|
-
type Res = {
|
|
93
|
-
id: string;
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
export declare namespace Find {
|
|
97
|
-
type Params = {
|
|
98
|
-
method: Method.Find;
|
|
99
|
-
conditions?: Conditions;
|
|
100
|
-
};
|
|
101
|
-
type Res<D> = Record<D> | undefined;
|
|
102
|
-
}
|
|
103
|
-
export declare namespace FindList {
|
|
104
|
-
type Params = {
|
|
105
|
-
method: Method.FindList;
|
|
106
|
-
conditions?: WhereConditions;
|
|
107
|
-
};
|
|
108
|
-
type Res<D> = {
|
|
109
|
-
list?: Record<D>[];
|
|
110
|
-
total?: number;
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
export declare namespace Delete {
|
|
114
|
-
type Params = {
|
|
115
|
-
method: Method.Delete;
|
|
116
|
-
conditions: Conditions;
|
|
117
|
-
};
|
|
118
|
-
type Res = {
|
|
119
|
-
deleted: number | string;
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
export declare namespace Update {
|
|
123
|
-
type Params<D> = {
|
|
124
|
-
method: Method.Update;
|
|
125
|
-
conditions: Conditions;
|
|
126
|
-
data: Partial<Record<D>>;
|
|
127
|
-
isReturn?: true;
|
|
128
|
-
isSet?: true;
|
|
129
|
-
};
|
|
130
|
-
type Res<D> = {
|
|
131
|
-
updated?: number;
|
|
132
|
-
doc?: D;
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
export declare namespace Count {
|
|
136
|
-
type Params = {
|
|
137
|
-
method: Method.Count;
|
|
138
|
-
conditions?: WhereConditions;
|
|
139
|
-
};
|
|
140
|
-
type Res = {
|
|
141
|
-
total?: number;
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
export type MethodParams<D> = Add.Params<D> | Find.Params | FindList.Params | Delete.Params | Update.Params<D> | Count.Params;
|
|
145
|
-
export type MethodRes<D> = Add.Res | Find.Res<D> | FindList.Res<D> | Delete.Res | Update.Res<D> | Count.Res;
|
|
146
|
-
export type IRes = Database.IAddRes | Database.IGetRes | Database.IDeleteResult | Database.IUpdateResult | ICountRes;
|
|
147
|
-
export type Record<D> = D & {
|
|
148
|
-
_id: string;
|
|
149
|
-
createAt: number;
|
|
150
|
-
updateAt: number;
|
|
151
|
-
};
|
package/dist/esm/rd/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const sendMail: (toEmail: string, title: string, content?: string) => Promise<string>;
|
package/index.ts
DELETED
package/other.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// 键值对
|
|
2
|
-
export type KeyValue<D extends object | string = string, V = any> = Partial<Record<D extends string ? string : keyof D, V>>
|
|
3
|
-
|
|
4
|
-
// 选项
|
|
5
|
-
export interface Option<V extends string | number = string> {
|
|
6
|
-
label: string,
|
|
7
|
-
value: V,
|
|
8
|
-
children?: Option<V>[],
|
|
9
|
-
}
|