@wener/common 2.0.3 → 2.0.6
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/lib/ai/qwen3vl/index.js +1 -1
- package/lib/ai/qwen3vl/utils.js +15 -15
- package/lib/ai/qwen3vl/utils.js.map +1 -1
- package/lib/ai/vision/DocLayoutElementTypeSchema.js +22 -22
- package/lib/ai/vision/ImageAnnotationSchema.js +63 -47
- package/lib/ai/vision/index.js +2 -2
- package/lib/ai/vision/resolveImageAnnotation.js +81 -95
- package/lib/cn/ChineseResidentIdNo.js +55 -41
- package/lib/cn/ChineseResidentIdNo.js.map +1 -1
- package/lib/cn/ChineseResidentIdNo.mod.js +6 -1
- package/lib/cn/ChineseResidentIdNo.test.js +22 -21
- package/lib/cn/DivisionCode.js +220 -235
- package/lib/cn/DivisionCode.mod.js +6 -1
- package/lib/cn/DivisionCode.test.js +92 -121
- package/lib/cn/Mod11.js +18 -37
- package/lib/cn/Mod11.js.map +1 -1
- package/lib/cn/Mod31.js +23 -41
- package/lib/cn/UnifiedSocialCreditCode.js +143 -137
- package/lib/cn/UnifiedSocialCreditCode.mod.js +6 -1
- package/lib/cn/UnifiedSocialCreditCode.test.js +21 -15
- package/lib/cn/formatChineseAmount.js +46 -71
- package/lib/cn/index.js +6 -6
- package/lib/cn/mod.js +5 -3
- package/lib/cn/parseChineseNumber.js +81 -85
- package/lib/cn/parseChineseNumber.test.js +183 -261
- package/lib/cn/pinyin/cartesianProduct.js +19 -19
- package/lib/cn/pinyin/cartesianProduct.test.js +78 -178
- package/lib/cn/pinyin/loader.js +13 -11
- package/lib/cn/pinyin/preload.js +2 -1
- package/lib/cn/pinyin/toPinyin.test.js +149 -161
- package/lib/cn/pinyin/toPinyinPure.js +28 -23
- package/lib/cn/pinyin/transform.js +11 -11
- package/lib/cn/types.d.js +2 -2
- package/lib/consola/createStandardConsolaReporter.js +14 -15
- package/lib/consola/formatLogObject.js +149 -133
- package/lib/consola/formatLogObject.js.map +1 -1
- package/lib/consola/formatLogObject.test.js +167 -178
- package/lib/consola/index.js +2 -2
- package/lib/data/formatSort.js +14 -12
- package/lib/data/formatSort.test.js +33 -33
- package/lib/data/index.js +3 -3
- package/lib/data/maybeNumber.js +23 -23
- package/lib/data/maybeNumber.js.map +1 -1
- package/lib/data/parseSort.js +75 -68
- package/lib/data/parseSort.test.js +196 -187
- package/lib/data/resolvePagination.js +38 -39
- package/lib/data/resolvePagination.test.js +228 -218
- package/lib/data/types.d.js +2 -2
- package/lib/data/types.d.js.map +1 -1
- package/lib/dayjs/dayjs.js +20 -20
- package/lib/dayjs/formatDuration.js +56 -56
- package/lib/dayjs/formatDuration.js.map +1 -1
- package/lib/dayjs/formatDuration.test.js +63 -77
- package/lib/dayjs/index.js +4 -4
- package/lib/dayjs/parseDuration.js +21 -26
- package/lib/dayjs/parseRelativeTime.js +65 -66
- package/lib/dayjs/parseRelativeTime.test.js +227 -243
- package/lib/dayjs/resolveRelativeTime.js +74 -144
- package/lib/dayjs/resolveRelativeTime.js.map +1 -1
- package/lib/dayjs/resolveRelativeTime.test.js +296 -307
- package/lib/decimal/index.js +1 -1
- package/lib/decimal/parseDecimal.js +12 -12
- package/lib/drain3/Drain.js +321 -0
- package/lib/drain3/Drain.js.map +1 -0
- package/lib/drain3/LogCluster.js +38 -0
- package/lib/drain3/LogCluster.js.map +1 -0
- package/lib/drain3/Node.js +39 -0
- package/lib/drain3/Node.js.map +1 -0
- package/lib/drain3/TemplateMiner.js +205 -0
- package/lib/drain3/TemplateMiner.js.map +1 -0
- package/lib/drain3/index.js +31 -0
- package/lib/drain3/index.js.map +1 -0
- package/lib/drain3/persistence/FilePersistence.js +24 -0
- package/lib/drain3/persistence/FilePersistence.js.map +1 -0
- package/lib/drain3/persistence/MemoryPersistence.js +18 -0
- package/lib/drain3/persistence/MemoryPersistence.js.map +1 -0
- package/lib/drain3/persistence/PersistenceHandler.js +5 -0
- package/lib/drain3/persistence/PersistenceHandler.js.map +1 -0
- package/lib/drain3/types.js +7 -0
- package/lib/drain3/types.js.map +1 -0
- package/lib/emittery/emitter.js +7 -7
- package/lib/emittery/index.js +1 -1
- package/lib/foundation/schema/SexType.js +15 -12
- package/lib/foundation/schema/index.js +1 -1
- package/lib/foundation/schema/parseSexType.js +15 -16
- package/lib/foundation/schema/types.js +8 -6
- package/lib/fs/FileSystemError.js +18 -18
- package/lib/fs/IFileSystem.d.js +2 -2
- package/lib/fs/IFileSystem.d.js.map +1 -1
- package/lib/fs/MemoryFileSystem.test.js +172 -181
- package/lib/fs/createBrowserFileSystem.js +222 -233
- package/lib/fs/createBrowserFileSystem.js.map +1 -1
- package/lib/fs/createMemoryFileSystem.js +473 -510
- package/lib/fs/createMemoryFileSystem.js.map +1 -1
- package/lib/fs/createSandboxFileSystem.js +102 -101
- package/lib/fs/createSandboxFileSystem.js.map +1 -1
- package/lib/fs/createWebDavFileSystem.js +162 -132
- package/lib/fs/createWebDavFileSystem.js.map +1 -1
- package/lib/fs/createWebFileSystem.js +202 -0
- package/lib/fs/createWebFileSystem.js.map +1 -0
- package/lib/fs/findMimeType.js +14 -14
- package/lib/fs/findMimeType.js.map +1 -1
- package/lib/fs/index.js +7 -7
- package/lib/fs/index.js.map +1 -1
- package/lib/fs/minio/createMinioFileSystem.js +977 -0
- package/lib/fs/minio/createMinioFileSystem.js.map +1 -0
- package/lib/fs/minio/index.js +2 -0
- package/lib/fs/minio/index.js.map +1 -0
- package/lib/fs/orpc/FileSystemContract.js +57 -57
- package/lib/fs/orpc/createContractClientFileSystem.js +88 -88
- package/lib/fs/orpc/createContractClientFileSystem.js.map +1 -1
- package/lib/fs/orpc/index.js +2 -2
- package/lib/fs/orpc/server/createFileSystemContractImpl.js +62 -60
- package/lib/fs/orpc/server/createFileSystemContractImpl.js.map +1 -1
- package/lib/fs/orpc/server/index.js +1 -1
- package/lib/fs/s3/createS3MiniFileSystem.js +756 -689
- package/lib/fs/s3/createS3MiniFileSystem.js.map +1 -1
- package/lib/fs/s3/index.js +1 -1
- package/lib/fs/s3/s3mini.test.js +524 -553
- package/lib/fs/scandir.js +56 -56
- package/lib/fs/server/createDatabaseFileSystem.js +834 -741
- package/lib/fs/server/createDatabaseFileSystem.js.map +1 -1
- package/lib/fs/server/createNodeFileSystem.js +407 -380
- package/lib/fs/server/createNodeFileSystem.js.map +1 -1
- package/lib/fs/server/dbfs.test.js +201 -214
- package/lib/fs/server/index.js +1 -1
- package/lib/fs/server/loadTestDatabase.js +40 -43
- package/lib/fs/tests/runFileSystemTest.js +352 -315
- package/lib/fs/tests/runFileSystemTest.js.map +1 -1
- package/lib/fs/types.js +17 -20
- package/lib/fs/utils/getFileUrl.js +24 -30
- package/lib/fs/utils.js +17 -17
- package/lib/fs/utils.js.map +1 -1
- package/lib/fs/webdav/index.js +2 -0
- package/lib/fs/webdav/index.js.map +1 -0
- package/lib/index.js +2 -2
- package/lib/jsonschema/JsonSchema.js +216 -155
- package/lib/jsonschema/JsonSchema.js.map +1 -1
- package/lib/jsonschema/JsonSchema.test.js +123 -124
- package/lib/jsonschema/forEachJsonSchema.js +41 -41
- package/lib/jsonschema/forEachJsonSchema.js.map +1 -1
- package/lib/jsonschema/index.js +2 -2
- package/lib/jsonschema/types.d.js +2 -2
- package/lib/jsonschema/types.d.js.map +1 -1
- package/lib/meta/defineFileType.js +32 -38
- package/lib/meta/defineInit.js +39 -35
- package/lib/meta/defineMetadata.js +37 -34
- package/lib/meta/defineMetadata.js.map +1 -1
- package/lib/meta/defineMetadata.test.js +13 -12
- package/lib/meta/index.js +3 -3
- package/lib/orpc/createOpenApiContractClient.js +26 -24
- package/lib/orpc/createOpenApiContractClient.js.map +1 -1
- package/lib/orpc/createRpcContractClient.js +37 -31
- package/lib/orpc/index.js +2 -2
- package/lib/orpc/resolveLinkPlugins.js +25 -25
- package/lib/password/PHC.js +187 -189
- package/lib/password/PHC.js.map +1 -1
- package/lib/password/PHC.test.js +517 -535
- package/lib/password/Password.js +85 -80
- package/lib/password/Password.test.js +330 -364
- package/lib/password/createArgon2PasswordAlgorithm.js +50 -51
- package/lib/password/createArgon2PasswordAlgorithm.js.map +1 -1
- package/lib/password/createBase64PasswordAlgorithm.js +11 -11
- package/lib/password/createBase64PasswordAlgorithm.js.map +1 -1
- package/lib/password/createBcryptPasswordAlgorithm.js +20 -18
- package/lib/password/createBcryptPasswordAlgorithm.js.map +1 -1
- package/lib/password/createPBKDF2PasswordAlgorithm.js +65 -52
- package/lib/password/createPBKDF2PasswordAlgorithm.js.map +1 -1
- package/lib/password/createScryptPasswordAlgorithm.js +74 -63
- package/lib/password/createScryptPasswordAlgorithm.js.map +1 -1
- package/lib/password/index.js +5 -5
- package/lib/password/server/index.js +1 -1
- package/lib/resource/Identifiable.js +2 -2
- package/lib/resource/ListQuery.js +42 -42
- package/lib/resource/ListQuery.js.map +1 -1
- package/lib/resource/getTitleOfResource.js +5 -5
- package/lib/resource/index.js +2 -2
- package/lib/resource/index.js.map +1 -1
- package/lib/resource/schema/AnyResourceSchema.js +91 -89
- package/lib/resource/schema/BaseResourceSchema.js +26 -26
- package/lib/resource/schema/ResourceActionType.js +117 -115
- package/lib/resource/schema/ResourceStatus.js +94 -92
- package/lib/resource/schema/ResourceType.js +25 -23
- package/lib/resource/schema/index.js +5 -5
- package/lib/resource/schema/types.js +86 -55
- package/lib/resource/schema/types.test.js +16 -13
- package/lib/s3/formatS3Url.js +60 -60
- package/lib/s3/formatS3Url.js.map +1 -1
- package/lib/s3/formatS3Url.test.js +238 -261
- package/lib/s3/index.js +2 -2
- package/lib/s3/parseS3Url.js +61 -60
- package/lib/s3/parseS3Url.js.map +1 -1
- package/lib/s3/parseS3Url.test.js +270 -269
- package/lib/schema/SchemaRegistry.js +41 -42
- package/lib/schema/SchemaRegistry.js.map +1 -1
- package/lib/schema/SchemaRegistry.mod.js +1 -1
- package/lib/schema/TypeSchema.d.js +2 -2
- package/lib/schema/TypeSchema.d.js.map +1 -1
- package/lib/schema/createSchemaData.js +113 -67
- package/lib/schema/createSchemaData.js.map +1 -1
- package/lib/schema/findJsonSchemaByPath.js +28 -23
- package/lib/schema/findJsonSchemaByPath.js.map +1 -1
- package/lib/schema/formatZodError.js +113 -134
- package/lib/schema/formatZodError.js.map +1 -1
- package/lib/schema/formatZodError.test.js +192 -195
- package/lib/schema/getSchemaCache.js +7 -7
- package/lib/schema/getSchemaOptions.js +17 -16
- package/lib/schema/index.js +6 -6
- package/lib/schema/toJsonSchema.js +196 -190
- package/lib/schema/toJsonSchema.js.map +1 -1
- package/lib/schema/toJsonSchema.test.js +34 -26
- package/lib/schema/validate.js +106 -97
- package/lib/schema/validate.js.map +1 -1
- package/lib/tools/generateSchema.js +40 -40
- package/lib/tools/renderJsonSchemaToMarkdownDoc.js +74 -74
- package/lib/utils/buildBaseUrl.js +8 -8
- package/lib/utils/buildRedactorFormSchema.js +55 -54
- package/lib/utils/buildRedactorFormSchema.js.map +1 -1
- package/lib/utils/getEstimateProcessTime.js +24 -19
- package/lib/utils/index.js +3 -3
- package/lib/utils/resolveFeatureOptions.js +9 -9
- package/package.json +37 -18
- package/src/ai/qwen3vl/utils.ts +1 -1
- package/src/ai/vision/index.ts +2 -2
- package/src/cn/ChineseResidentIdNo.ts +1 -1
- package/src/cn/Mod11.ts +1 -1
- package/src/cn/__snapshots__/ChineseResidentIdNo.test.ts.snap +1 -1
- package/src/cn/__snapshots__/UnifiedSocialCreditCode.test.ts.snap +0 -23
- package/src/cn/index.ts +1 -2
- package/src/cn/parseChineseNumber.test.ts +4 -4
- package/src/consola/formatLogObject.ts +6 -6
- package/src/consola/index.ts +1 -1
- package/src/data/index.ts +3 -4
- package/src/data/maybeNumber.ts +1 -1
- package/src/data/parseSort.test.ts +0 -1
- package/src/data/resolvePagination.ts +2 -2
- package/src/data/types.d.ts +2 -2
- package/src/dayjs/formatDuration.ts +10 -11
- package/src/dayjs/index.ts +1 -1
- package/src/dayjs/parseRelativeTime.ts +1 -1
- package/src/dayjs/resolveRelativeTime.ts +11 -14
- package/src/drain3/Drain.test.ts +378 -0
- package/src/drain3/Drain.ts +394 -0
- package/src/drain3/LogCluster.ts +46 -0
- package/src/drain3/Node.ts +53 -0
- package/src/drain3/TemplateMiner.ts +246 -0
- package/src/drain3/index.ts +34 -0
- package/src/drain3/persistence/FilePersistence.ts +24 -0
- package/src/drain3/persistence/MemoryPersistence.ts +23 -0
- package/src/drain3/persistence/PersistenceHandler.ts +19 -0
- package/src/drain3/types.ts +75 -0
- package/src/fs/IFileSystem.d.ts +1 -2
- package/src/fs/createBrowserFileSystem.ts +7 -5
- package/src/fs/createMemoryFileSystem.ts +9 -13
- package/src/fs/createSandboxFileSystem.ts +1 -1
- package/src/fs/createWebDavFileSystem.ts +30 -17
- package/src/fs/createWebFileSystem.ts +242 -0
- package/src/fs/findMimeType.ts +1 -4
- package/src/fs/index.ts +5 -5
- package/src/fs/minio/createMinioFileSystem.ts +1148 -0
- package/src/fs/minio/index.ts +1 -0
- package/src/fs/orpc/createContractClientFileSystem.ts +5 -5
- package/src/fs/orpc/server/createFileSystemContractImpl.ts +1 -1
- package/src/fs/s3/createS3MiniFileSystem.ts +120 -79
- package/src/fs/s3/s3fs.test.ts +441 -0
- package/src/fs/s3/s3mini.test.ts +2 -2
- package/src/fs/server/createDatabaseFileSystem.ts +78 -114
- package/src/fs/server/createNodeFileSystem.ts +32 -13
- package/src/fs/server/dbfs.test.ts +13 -8
- package/src/fs/server/index.ts +1 -0
- package/src/fs/server/loadTestDatabase.ts +8 -119
- package/src/fs/tests/runFileSystemTest.ts +29 -28
- package/src/fs/utils.ts +1 -1
- package/src/fs/webdav/index.ts +1 -0
- package/src/jsonschema/JsonSchema.ts +5 -5
- package/src/jsonschema/forEachJsonSchema.ts +1 -1
- package/src/jsonschema/index.ts +1 -1
- package/src/jsonschema/types.d.ts +1 -1
- package/src/meta/defineMetadata.ts +1 -1
- package/src/meta/index.ts +2 -3
- package/src/orm/createSqliteDialect.ts +17 -0
- package/src/orm/index.ts +1 -0
- package/src/orpc/createOpenApiContractClient.ts +3 -3
- package/src/orpc/index.ts +1 -1
- package/src/password/PHC.ts +3 -3
- package/src/password/createArgon2PasswordAlgorithm.ts +2 -2
- package/src/password/createBase64PasswordAlgorithm.ts +2 -2
- package/src/password/createBcryptPasswordAlgorithm.ts +4 -2
- package/src/password/createPBKDF2PasswordAlgorithm.ts +2 -2
- package/src/password/createScryptPasswordAlgorithm.ts +4 -4
- package/src/password/index.ts +2 -2
- package/src/resource/ListQuery.ts +4 -1
- package/src/resource/index.ts +3 -3
- package/src/resource/schema/index.ts +4 -4
- package/src/s3/formatS3Url.test.ts +1 -1
- package/src/s3/formatS3Url.ts +2 -2
- package/src/s3/index.ts +1 -1
- package/src/s3/parseS3Url.ts +1 -1
- package/src/schema/SchemaRegistry.ts +2 -2
- package/src/schema/TypeSchema.d.ts +6 -6
- package/src/schema/createSchemaData.ts +5 -5
- package/src/schema/findJsonSchemaByPath.ts +5 -5
- package/src/schema/formatZodError.test.ts +2 -1
- package/src/schema/formatZodError.ts +50 -62
- package/src/schema/index.ts +5 -5
- package/src/schema/toJsonSchema.ts +6 -6
- package/src/schema/validate.ts +2 -2
- package/src/utils/buildRedactorFormSchema.ts +4 -4
- package/src/utils/formatNumber.ts +18 -0
- package/src/utils/formatPercent.ts +17 -0
- package/src/utils/index.ts +3 -3
- package/src/utils/resolveFeatureOptions.ts +1 -1
|
@@ -1,232 +1,242 @@
|
|
|
1
1
|
function _array_like_to_array(arr, len) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
arr2[i] = arr[i];
|
|
6
|
-
return arr2;
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
7
5
|
}
|
|
8
6
|
function _array_with_holes(arr) {
|
|
9
|
-
|
|
10
|
-
return arr;
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
11
8
|
}
|
|
12
9
|
function _iterable_to_array_limit(arr, i) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
finally {
|
|
37
|
-
if (_d)
|
|
38
|
-
throw _e;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return _arr;
|
|
10
|
+
var _i = arr == null ? null : (typeof Symbol !== 'undefined' && arr[Symbol.iterator]) || arr['@@iterator'];
|
|
11
|
+
if (_i == null) return;
|
|
12
|
+
var _arr = [];
|
|
13
|
+
var _n = true;
|
|
14
|
+
var _d = false;
|
|
15
|
+
var _s, _e;
|
|
16
|
+
try {
|
|
17
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
18
|
+
_arr.push(_s.value);
|
|
19
|
+
if (i && _arr.length === i) break;
|
|
20
|
+
}
|
|
21
|
+
} catch (err) {
|
|
22
|
+
_d = true;
|
|
23
|
+
_e = err;
|
|
24
|
+
} finally {
|
|
25
|
+
try {
|
|
26
|
+
if (!_n && _i['return'] != null) _i['return']();
|
|
27
|
+
} finally {
|
|
28
|
+
if (_d) throw _e;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return _arr;
|
|
42
32
|
}
|
|
43
33
|
function _non_iterable_rest() {
|
|
44
|
-
|
|
34
|
+
throw new TypeError(
|
|
35
|
+
'Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.',
|
|
36
|
+
);
|
|
45
37
|
}
|
|
46
38
|
function _sliced_to_array(arr, i) {
|
|
47
|
-
|
|
39
|
+
return (
|
|
40
|
+
_array_with_holes(arr) ||
|
|
41
|
+
_iterable_to_array_limit(arr, i) ||
|
|
42
|
+
_unsupported_iterable_to_array(arr, i) ||
|
|
43
|
+
_non_iterable_rest()
|
|
44
|
+
);
|
|
48
45
|
}
|
|
49
46
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
n = o.constructor.name;
|
|
57
|
-
if (n === "Map" || n === "Set")
|
|
58
|
-
return Array.from(n);
|
|
59
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
60
|
-
return _array_like_to_array(o, minLen);
|
|
47
|
+
if (!o) return;
|
|
48
|
+
if (typeof o === 'string') return _array_like_to_array(o, minLen);
|
|
49
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
50
|
+
if (n === 'Object' && o.constructor) n = o.constructor.name;
|
|
51
|
+
if (n === 'Map' || n === 'Set') return Array.from(n);
|
|
52
|
+
if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
61
53
|
}
|
|
62
|
-
|
|
63
|
-
import {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
54
|
+
|
|
55
|
+
import { expect, test } from 'vitest';
|
|
56
|
+
import { resolvePagination } from './resolvePagination.js';
|
|
57
|
+
|
|
58
|
+
test(resolvePagination.name, () => {
|
|
59
|
+
var testCases = [
|
|
60
|
+
[
|
|
61
|
+
'pageSize with null pageIndex',
|
|
62
|
+
{
|
|
63
|
+
pageSize: '10',
|
|
64
|
+
pageIndex: null,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
limit: 10,
|
|
68
|
+
offset: 0,
|
|
69
|
+
pageSize: 10,
|
|
70
|
+
pageNumber: 1,
|
|
71
|
+
pageIndex: 0,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
[
|
|
75
|
+
'pageSize with pageIndex',
|
|
76
|
+
{
|
|
77
|
+
pageSize: '10',
|
|
78
|
+
pageIndex: 1,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
limit: 10,
|
|
82
|
+
offset: 10,
|
|
83
|
+
pageSize: 10,
|
|
84
|
+
pageNumber: 2,
|
|
85
|
+
pageIndex: 1,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
[
|
|
89
|
+
'pageSize with pageIndex 2',
|
|
90
|
+
{
|
|
91
|
+
pageSize: '10',
|
|
92
|
+
pageIndex: 2,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
limit: 10,
|
|
96
|
+
offset: 20,
|
|
97
|
+
pageSize: 10,
|
|
98
|
+
pageNumber: 3,
|
|
99
|
+
pageIndex: 2,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
[
|
|
103
|
+
'limit with null offset',
|
|
104
|
+
{
|
|
105
|
+
limit: '10',
|
|
106
|
+
offset: null,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
limit: 10,
|
|
110
|
+
offset: 0,
|
|
111
|
+
pageSize: 10,
|
|
112
|
+
pageNumber: 1,
|
|
113
|
+
pageIndex: 0,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
'limit with offset',
|
|
118
|
+
{
|
|
119
|
+
limit: '10',
|
|
120
|
+
offset: '20',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
limit: 10,
|
|
124
|
+
offset: 20,
|
|
125
|
+
pageSize: 10,
|
|
126
|
+
pageNumber: 3,
|
|
127
|
+
pageIndex: 2,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
'null limit with offset',
|
|
132
|
+
{
|
|
133
|
+
limit: null,
|
|
134
|
+
offset: '20',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
limit: 20,
|
|
138
|
+
offset: 20,
|
|
139
|
+
pageSize: 20,
|
|
140
|
+
pageNumber: 2,
|
|
141
|
+
pageIndex: 1,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
[
|
|
145
|
+
'empty input',
|
|
146
|
+
{},
|
|
147
|
+
{
|
|
148
|
+
limit: 20,
|
|
149
|
+
offset: 0,
|
|
150
|
+
pageSize: 20,
|
|
151
|
+
pageNumber: 1,
|
|
152
|
+
pageIndex: 0,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
[
|
|
156
|
+
'negative values',
|
|
157
|
+
{
|
|
158
|
+
pageSize: '-5',
|
|
159
|
+
pageIndex: '-1',
|
|
160
|
+
limit: '-10',
|
|
161
|
+
offset: '-20',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
limit: 1,
|
|
165
|
+
offset: 0,
|
|
166
|
+
pageSize: 1,
|
|
167
|
+
pageNumber: 1,
|
|
168
|
+
pageIndex: 0,
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
[
|
|
172
|
+
'custom pageNumber',
|
|
173
|
+
{
|
|
174
|
+
pageNumber: 3,
|
|
175
|
+
pageSize: 15,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
limit: 15,
|
|
179
|
+
offset: 30,
|
|
180
|
+
pageSize: 15,
|
|
181
|
+
pageNumber: 3,
|
|
182
|
+
pageIndex: 2,
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
];
|
|
186
|
+
var _iteratorNormalCompletion = true,
|
|
187
|
+
_didIteratorError = false,
|
|
188
|
+
_iteratorError;
|
|
189
|
+
try {
|
|
190
|
+
for (
|
|
191
|
+
var _iterator = testCases[Symbol.iterator](), _step;
|
|
192
|
+
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
|
|
193
|
+
_iteratorNormalCompletion = true
|
|
194
|
+
) {
|
|
195
|
+
var _step_value = _sliced_to_array(_step.value, 3),
|
|
196
|
+
description = _step_value[0],
|
|
197
|
+
input = _step_value[1],
|
|
198
|
+
expected = _step_value[2];
|
|
199
|
+
var result = resolvePagination(input);
|
|
200
|
+
expect(result, description).toMatchObject(expected);
|
|
201
|
+
}
|
|
202
|
+
} catch (err) {
|
|
203
|
+
_didIteratorError = true;
|
|
204
|
+
_iteratorError = err;
|
|
205
|
+
} finally {
|
|
206
|
+
try {
|
|
207
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
208
|
+
_iterator.return();
|
|
209
|
+
}
|
|
210
|
+
} finally {
|
|
211
|
+
if (_didIteratorError) {
|
|
212
|
+
throw _iteratorError;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
216
|
});
|
|
217
|
-
test(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
217
|
+
test(''.concat(resolvePagination.name, ' with options'), () => {
|
|
218
|
+
expect(
|
|
219
|
+
resolvePagination(
|
|
220
|
+
{
|
|
221
|
+
pageSize: '200',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
maxLimit: 50,
|
|
225
|
+
},
|
|
226
|
+
),
|
|
227
|
+
).toMatchObject({
|
|
228
|
+
pageSize: 50,
|
|
229
|
+
limit: 50,
|
|
230
|
+
});
|
|
231
|
+
expect(
|
|
232
|
+
resolvePagination(
|
|
233
|
+
{},
|
|
234
|
+
{
|
|
235
|
+
pageSize: 30,
|
|
236
|
+
},
|
|
237
|
+
),
|
|
238
|
+
).toMatchObject({
|
|
239
|
+
pageSize: 30,
|
|
240
|
+
limit: 30,
|
|
241
|
+
});
|
|
232
242
|
});
|
package/lib/data/types.d.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
2
2
|
|
|
3
|
-
//# sourceMappingURL=types.d.js.map
|
|
3
|
+
//# sourceMappingURL=types.d.js.map
|
package/lib/data/types.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data/types.d.ts"],"sourcesContent":["export type ListQueryInput = {\n\t/** Filter string */\n\tfilter?: string;\n\t/** Filter array */\n\tfilters?: string[];\n\t/** Filter by IDs */\n\tids?: string[];\n\t/** Search query */\n\tsearch?: string;\n\t/** Items per page */\n\tlimit?: number;\n\t/** Offset for pagination */\n\toffset?: number;\n\t/** Ordering criteria */\n\torder?: string[];\n\t/** Page index (0-based) */\n\tpageIndex?: number;\n\t/** Page number (1-based) */\n\tpageNumber?: number;\n\t/** Items per page */\n\tpageSize?: number;\n\t/** Cursor for pagination */\n\tcursor?: string;\n\t/** Whether to include deleted items */\n\tdeleted?: boolean;\n};\n\ntype
|
|
1
|
+
{"version":3,"sources":["../../src/data/types.d.ts"],"sourcesContent":["export type ListQueryInput = {\n\t/** Filter string */\n\tfilter?: string;\n\t/** Filter array */\n\tfilters?: string[];\n\t/** Filter by IDs */\n\tids?: string[];\n\t/** Search query */\n\tsearch?: string;\n\t/** Items per page */\n\tlimit?: number;\n\t/** Offset for pagination */\n\toffset?: number;\n\t/** Ordering criteria */\n\torder?: string[];\n\t/** Page index (0-based) */\n\tpageIndex?: number;\n\t/** Page number (1-based) */\n\tpageNumber?: number;\n\t/** Items per page */\n\tpageSize?: number;\n\t/** Cursor for pagination */\n\tcursor?: string;\n\t/** Whether to include deleted items */\n\tdeleted?: boolean;\n};\n\ntype _ListResult<T = any> = {\n\t/** List of items */\n\tdata: T[];\n\t/** Total number of items */\n\ttotal: number;\n};\n\ntype _PageInfo = {\n\t/** Whether there are more items */\n\thasNextPage: boolean;\n\t/** Whether there are previous items */\n\thasPreviousPage: boolean;\n\n\t// /** Start cursor */\n\t// startCursor?: string;\n\t// /** End cursor */\n\t// endCursor?: string;\n};\n"],"names":[],"mappings":"AAAA,WAyBE"}
|
package/lib/dayjs/dayjs.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import dayjs from
|
|
2
|
-
import advancedFormat from
|
|
3
|
-
import dayOfYear from
|
|
4
|
-
import duration from
|
|
5
|
-
import isBetween from
|
|
6
|
-
import isSameOrAfter from
|
|
7
|
-
import isSameOrBefore from
|
|
8
|
-
import isToday from
|
|
9
|
-
import isTomorrow from
|
|
10
|
-
import isYesterday from
|
|
11
|
-
import localeData from
|
|
12
|
-
import objectSupport from
|
|
13
|
-
import quarterOfYear from
|
|
14
|
-
import relativeTime from
|
|
15
|
-
import timezone from
|
|
16
|
-
import toObject from
|
|
17
|
-
import utc from
|
|
18
|
-
import
|
|
19
|
-
import
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import advancedFormat from 'dayjs/plugin/advancedFormat.js';
|
|
3
|
+
import dayOfYear from 'dayjs/plugin/dayOfYear.js';
|
|
4
|
+
import duration from 'dayjs/plugin/duration.js';
|
|
5
|
+
import isBetween from 'dayjs/plugin/isBetween.js';
|
|
6
|
+
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter.js';
|
|
7
|
+
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore.js';
|
|
8
|
+
import isToday from 'dayjs/plugin/isToday.js';
|
|
9
|
+
import isTomorrow from 'dayjs/plugin/isTomorrow.js';
|
|
10
|
+
import isYesterday from 'dayjs/plugin/isYesterday.js';
|
|
11
|
+
import localeData from 'dayjs/plugin/localeData.js';
|
|
12
|
+
import objectSupport from 'dayjs/plugin/objectSupport.js';
|
|
13
|
+
import quarterOfYear from 'dayjs/plugin/quarterOfYear.js';
|
|
14
|
+
import relativeTime from 'dayjs/plugin/relativeTime.js';
|
|
15
|
+
import timezone from 'dayjs/plugin/timezone.js';
|
|
16
|
+
import toObject from 'dayjs/plugin/toObject.js';
|
|
17
|
+
import utc from 'dayjs/plugin/utc.js';
|
|
18
|
+
import 'dayjs/locale/zh-cn.js';
|
|
19
|
+
import 'dayjs/locale/zh.js';
|
|
20
20
|
dayjs.extend(advancedFormat);
|
|
21
21
|
dayjs.extend(dayOfYear);
|
|
22
22
|
dayjs.extend(duration);
|
|
@@ -37,4 +37,4 @@ dayjs.locale('zh-cn');
|
|
|
37
37
|
dayjs.tz.setDefault('Asia/Shanghai');
|
|
38
38
|
export { dayjs };
|
|
39
39
|
|
|
40
|
-
//# sourceMappingURL=dayjs.js.map
|
|
40
|
+
//# sourceMappingURL=dayjs.js.map
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { parseDuration } from
|
|
1
|
+
import { parseDuration } from './parseDuration.js';
|
|
2
2
|
export function formatDuration(value, o) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
3
|
+
const v = parseDuration(value);
|
|
4
|
+
if (v === undefined || v === null) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
let { format, humanize, iso } = o || {};
|
|
8
|
+
// Use local variables instead of modifying o directly
|
|
9
|
+
switch (format) {
|
|
10
|
+
case 'human':
|
|
11
|
+
case 'humanize':
|
|
12
|
+
humanize = true;
|
|
13
|
+
format = undefined;
|
|
14
|
+
break;
|
|
15
|
+
case 'iso':
|
|
16
|
+
iso = true;
|
|
17
|
+
format = undefined;
|
|
18
|
+
break;
|
|
19
|
+
case 'auto':
|
|
20
|
+
format = undefined;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
if (humanize) {
|
|
24
|
+
return v.humanize();
|
|
25
|
+
}
|
|
26
|
+
if (iso) {
|
|
27
|
+
return v.toISOString();
|
|
28
|
+
}
|
|
29
|
+
if (format) {
|
|
30
|
+
return v.format(format);
|
|
31
|
+
}
|
|
32
|
+
// auto format
|
|
33
|
+
// 1h2m3s
|
|
34
|
+
if (v.asDays() > 1) {
|
|
35
|
+
let s = v.toISOString();
|
|
36
|
+
return s.replace('P', '').replace('T', '').toLowerCase();
|
|
37
|
+
}
|
|
38
|
+
{
|
|
39
|
+
let parts = [];
|
|
40
|
+
let h = v.hours();
|
|
41
|
+
let m = v.minutes();
|
|
42
|
+
let s = v.seconds();
|
|
43
|
+
let ms = v.milliseconds();
|
|
44
|
+
if (h > 0) {
|
|
45
|
+
parts.push(`${h}h`);
|
|
46
|
+
}
|
|
47
|
+
if (m > 0) {
|
|
48
|
+
parts.push(`${m}m`);
|
|
49
|
+
}
|
|
50
|
+
if (s > 0) {
|
|
51
|
+
parts.push(`${s}s`);
|
|
52
|
+
}
|
|
53
|
+
if (ms > 0 || (h === 0 && m === 0 && s === 0)) {
|
|
54
|
+
parts.push(`${ms}ms`);
|
|
55
|
+
}
|
|
56
|
+
return parts.join('');
|
|
57
|
+
}
|
|
58
58
|
}
|
|
59
59
|
//# sourceMappingURL=formatDuration.js.map
|