@kcuf/helper-data 0.2.1 → 0.2.3
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/CHANGELOG.md +4 -0
- package/dist/cjs/helper/index.js +8 -1
- package/dist/cjs/helper/is-empty-paged-list.js +9 -0
- package/dist/esm/helper/index.js +1 -0
- package/dist/esm/helper/index.js.map +1 -1
- package/dist/esm/helper/is-empty-paged-list.js +4 -0
- package/dist/esm/helper/is-empty-paged-list.js.map +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/base-params.js.map +1 -1
- package/dist/esm/types/generic.js.map +1 -1
- package/dist/types/helper/index.d.ts +1 -0
- package/dist/types/helper/is-empty-paged-list.d.ts +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/base-params.d.ts +13 -0
- package/dist/types/types/generic.d.ts +7 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
package/dist/cjs/helper/index.js
CHANGED
|
@@ -4,6 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
Object.defineProperty(exports, "isEmptyPagedList", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _isEmptyPagedList.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
7
13
|
Object.defineProperty(exports, "normalizeBoolean", {
|
|
8
14
|
enumerable: true,
|
|
9
15
|
get: function get() {
|
|
@@ -52,4 +58,5 @@ var _normalizeNumber = _interopRequireDefault(require("./normalize-number"));
|
|
|
52
58
|
var _normalizeEnum = _interopRequireDefault(require("./normalize-enum"));
|
|
53
59
|
var _normalizeTime = _interopRequireDefault(require("./normalize-time"));
|
|
54
60
|
var _normalizePagedList = _interopRequireDefault(require("./normalize-paged-list"));
|
|
55
|
-
var _normalizePagedListUncertain = _interopRequireDefault(require("./normalize-paged-list-uncertain"));
|
|
61
|
+
var _normalizePagedListUncertain = _interopRequireDefault(require("./normalize-paged-list-uncertain"));
|
|
62
|
+
var _isEmptyPagedList = _interopRequireDefault(require("./is-empty-paged-list"));
|
package/dist/esm/helper/index.js
CHANGED
|
@@ -5,4 +5,5 @@ export { default as normalizeEnum } from './normalize-enum';
|
|
|
5
5
|
export { default as normalizeTime } from './normalize-time';
|
|
6
6
|
export { default as normalizePagedList } from './normalize-paged-list';
|
|
7
7
|
export { default as normalizePagedListUncertain } from './normalize-paged-list-uncertain';
|
|
8
|
+
export { default as isEmptyPagedList } from './is-empty-paged-list';
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","normalizeId","normalizeBoolean","normalizeNumber","normalizeEnum","normalizeTime","normalizePagedList","normalizePagedListUncertain"],"sources":["../../../src/helper/index.ts"],"sourcesContent":["export { default as normalizeId } from './normalize-id';\nexport { default as normalizeBoolean } from './normalize-boolean';\nexport { default as normalizeNumber } from './normalize-number';\nexport { default as normalizeEnum } from './normalize-enum';\nexport { default as normalizeTime } from './normalize-time';\nexport { default as normalizePagedList } from './normalize-paged-list';\nexport { default as normalizePagedListUncertain } from './normalize-paged-list-uncertain';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,WAAW,QAAQ,gBAAgB;AACvD,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,qBAAqB;AACjE,SAASF,OAAO,IAAIG,eAAe,QAAQ,oBAAoB;AAC/D,SAASH,OAAO,IAAII,aAAa,QAAQ,kBAAkB;AAC3D,SAASJ,OAAO,IAAIK,aAAa,QAAQ,kBAAkB;AAC3D,SAASL,OAAO,IAAIM,kBAAkB,QAAQ,wBAAwB;AACtE,SAASN,OAAO,IAAIO,2BAA2B,QAAQ,kCAAkC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","normalizeId","normalizeBoolean","normalizeNumber","normalizeEnum","normalizeTime","normalizePagedList","normalizePagedListUncertain","isEmptyPagedList"],"sources":["../../../src/helper/index.ts"],"sourcesContent":["export { default as normalizeId } from './normalize-id';\nexport { default as normalizeBoolean } from './normalize-boolean';\nexport { default as normalizeNumber } from './normalize-number';\nexport { default as normalizeEnum } from './normalize-enum';\nexport { default as normalizeTime } from './normalize-time';\nexport { default as normalizePagedList } from './normalize-paged-list';\nexport { default as normalizePagedListUncertain } from './normalize-paged-list-uncertain';\n\nexport { default as isEmptyPagedList } from './is-empty-paged-list';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,WAAW,QAAQ,gBAAgB;AACvD,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,qBAAqB;AACjE,SAASF,OAAO,IAAIG,eAAe,QAAQ,oBAAoB;AAC/D,SAASH,OAAO,IAAII,aAAa,QAAQ,kBAAkB;AAC3D,SAASJ,OAAO,IAAIK,aAAa,QAAQ,kBAAkB;AAC3D,SAASL,OAAO,IAAIM,kBAAkB,QAAQ,wBAAwB;AACtE,SAASN,OAAO,IAAIO,2BAA2B,QAAQ,kCAAkC;AAEzF,SAASP,OAAO,IAAIQ,gBAAgB,QAAQ,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-empty-paged-list.js","names":["isEmptyPagedList","paged","list","length"],"sources":["../../../src/helper/is-empty-paged-list.ts"],"sourcesContent":["import {\n IPagedList\n} from '../types';\n\nexport default function isEmptyPagedList(paged: IPagedList<unknown>): boolean {\n return !paged.list.length;\n}\n"],"mappings":"AAIA,eAAe,SAASA,gBAAgBA,CAACC,KAA0B,EAAW;EAC5E,OAAO,CAACA,KAAK,CAACC,IAAI,CAACC,MAAM;AAC3B","ignoreList":[]}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from './helper';\n\nexport type {\n IBaseParamsPage as BaseParamsPage,\n IBaseParamsPageWithQ as BaseParamsPageWithQ,\n \n IBaseDataId as BaseDataId,\n IBaseDataName as BaseDataName,\n IBaseDataIdName as BaseDataIdName,\n IBaseDataTitle as BaseDataTitle,\n IBaseDataDescription as BaseDataDescription,\n IBaseDataContent as BaseDataContent,\n IBaseDataTimeCreated as BaseDataTimeCreated,\n IBaseDataTimeUpdated as BaseDataTimeModified,\n IBaseDataTimes as BaseDataTimes,\n IBaseDataCreator as BaseDataCreator,\n IBaseDataUpdater as BaseDataUpdater,\n \n IPagedList as PagedList,\n IPagedListUncertain as PagedListUncertain\n} from './types';\n"],"mappings":"AAAA,cAAc,UAAU;AAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from './helper';\n\nexport type {\n // 参数标准化\n IBaseParamsPage as BaseParamsPage,\n IBaseParamsPageWithQ as BaseParamsPageWithQ,\n IBaseParamsCursorPage as BaseParamsCursorPage,\n IBaseParamsCursorPageWithQ as BaseParamsCursorPageWithQ,\n \n // 数据标准化\n IBaseDataId as BaseDataId,\n IBaseDataName as BaseDataName,\n IBaseDataIdName as BaseDataIdName,\n IBaseDataTitle as BaseDataTitle,\n IBaseDataDescription as BaseDataDescription,\n IBaseDataContent as BaseDataContent,\n IBaseDataTimeCreated as BaseDataTimeCreated,\n IBaseDataTimeUpdated as BaseDataTimeModified,\n IBaseDataTimes as BaseDataTimes,\n IBaseDataCreator as BaseDataCreator,\n IBaseDataUpdater as BaseDataUpdater,\n \n // 数据标准化(泛型)\n IPagedList as PagedList,\n IPagedCursorList as PagedCursorList,\n IPagedListUncertain as PagedListUncertain\n} from './types';\n"],"mappings":"AAAA,cAAc,UAAU;AAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-params.js","names":[],"sources":["../../../src/types/base-params.ts"],"sourcesContent":["/**\n * 分页参数标准化\n */\nexport interface IBaseParamsPage {\n page?: number;\n pageSize?: number;\n}\n\n/**\n * 带关键词的分页参数标准化\n */\nexport interface IBaseParamsPageWithQ extends IBaseParamsPage {\n q?: string; // 前端「搜素关键字」参数统一为 q\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"base-params.js","names":[],"sources":["../../../src/types/base-params.ts"],"sourcesContent":["/**\n * 分页参数标准化\n */\nexport interface IBaseParamsPage {\n page?: number;\n pageSize?: number;\n}\n\n/**\n * 带关键词的分页参数标准化\n */\nexport interface IBaseParamsPageWithQ extends IBaseParamsPage {\n q?: string; // 前端「搜素关键字」参数统一为 q\n}\n\n/**\n * 游标分页参数标准化\n */\nexport interface IBaseParamsCursorPage {\n cursor?: string;\n pageSize?: number;\n}\n\n/**\n * 带关键词的游标分页参数标准化\n */\nexport interface IBaseParamsCursorPageWithQ extends IBaseParamsCursorPage {\n q?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.js","names":[],"sources":["../../../src/types/generic.ts"],"sourcesContent":["/**\n * 分页数据标准化\n */\nexport interface IPagedList<T> {\n total: number;\n page: number;\n pageSize: number;\n list: T[];\n}\n\n/**\n * 某些分页接口,后端给的数据只有列表,前端需根据返回转成非确定分页列表数据\n */\nexport interface IPagedListUncertain<T> extends Omit<IPagedList<T>, 'total'> {\n hasMore: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"generic.js","names":[],"sources":["../../../src/types/generic.ts"],"sourcesContent":["/**\n * 分页数据标准化\n */\nexport interface IPagedList<T> {\n total: number;\n page: number;\n pageSize: number;\n list: T[];\n}\n\n/**\n * 游标分页数据标准化\n */\nexport interface IPagedCursorList<T> {\n nextCursor: string;\n list: T[];\n}\n\n/**\n * 某些分页接口,后端给的数据只有列表,前端需根据返回转成非确定分页列表数据\n */\nexport interface IPagedListUncertain<T> extends Omit<IPagedList<T>, 'total'> {\n hasMore: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -5,3 +5,4 @@ export { default as normalizeEnum } from './normalize-enum';
|
|
|
5
5
|
export { default as normalizeTime } from './normalize-time';
|
|
6
6
|
export { default as normalizePagedList } from './normalize-paged-list';
|
|
7
7
|
export { default as normalizePagedListUncertain } from './normalize-paged-list-uncertain';
|
|
8
|
+
export { default as isEmptyPagedList } from './is-empty-paged-list';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './helper';
|
|
2
|
-
export type { IBaseParamsPage as BaseParamsPage, IBaseParamsPageWithQ as BaseParamsPageWithQ, IBaseDataId as BaseDataId, IBaseDataName as BaseDataName, IBaseDataIdName as BaseDataIdName, IBaseDataTitle as BaseDataTitle, IBaseDataDescription as BaseDataDescription, IBaseDataContent as BaseDataContent, IBaseDataTimeCreated as BaseDataTimeCreated, IBaseDataTimeUpdated as BaseDataTimeModified, IBaseDataTimes as BaseDataTimes, IBaseDataCreator as BaseDataCreator, IBaseDataUpdater as BaseDataUpdater, IPagedList as PagedList, IPagedListUncertain as PagedListUncertain } from './types';
|
|
2
|
+
export type { IBaseParamsPage as BaseParamsPage, IBaseParamsPageWithQ as BaseParamsPageWithQ, IBaseParamsCursorPage as BaseParamsCursorPage, IBaseParamsCursorPageWithQ as BaseParamsCursorPageWithQ, IBaseDataId as BaseDataId, IBaseDataName as BaseDataName, IBaseDataIdName as BaseDataIdName, IBaseDataTitle as BaseDataTitle, IBaseDataDescription as BaseDataDescription, IBaseDataContent as BaseDataContent, IBaseDataTimeCreated as BaseDataTimeCreated, IBaseDataTimeUpdated as BaseDataTimeModified, IBaseDataTimes as BaseDataTimes, IBaseDataCreator as BaseDataCreator, IBaseDataUpdater as BaseDataUpdater, IPagedList as PagedList, IPagedCursorList as PagedCursorList, IPagedListUncertain as PagedListUncertain } from './types';
|
|
@@ -11,3 +11,16 @@ export interface IBaseParamsPage {
|
|
|
11
11
|
export interface IBaseParamsPageWithQ extends IBaseParamsPage {
|
|
12
12
|
q?: string;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* 游标分页参数标准化
|
|
16
|
+
*/
|
|
17
|
+
export interface IBaseParamsCursorPage {
|
|
18
|
+
cursor?: string;
|
|
19
|
+
pageSize?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 带关键词的游标分页参数标准化
|
|
23
|
+
*/
|
|
24
|
+
export interface IBaseParamsCursorPageWithQ extends IBaseParamsCursorPage {
|
|
25
|
+
q?: string;
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kcuf/helper-data",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Data normalizer helpers and loading stuff to make all frontend data processing sane.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@babel/cli": "^7.28.3",
|
|
26
|
-
"@babel/core": "^7.28.
|
|
27
|
-
"@babel/plugin-transform-runtime": "^7.28.
|
|
28
|
-
"@babel/preset-env": "^7.28.
|
|
29
|
-
"@babel/preset-typescript": "^7.
|
|
26
|
+
"@babel/core": "^7.28.5",
|
|
27
|
+
"@babel/plugin-transform-runtime": "^7.28.5",
|
|
28
|
+
"@babel/preset-env": "^7.28.5",
|
|
29
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
30
30
|
"rimraf": "^6.0.1",
|
|
31
|
-
"typescript": "^5.9.
|
|
31
|
+
"typescript": "^5.9.3",
|
|
32
32
|
"@kcuf/ts-config": "^0.0.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|