@wener/common 2.0.5 → 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/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.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/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.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/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/dayjs/dayjs.js +20 -20
- package/lib/dayjs/formatDuration.js +56 -56
- 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 +73 -72
- 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 +303 -338
- package/lib/drain3/LogCluster.js +25 -25
- package/lib/drain3/Node.js +24 -24
- package/lib/drain3/TemplateMiner.js +197 -196
- package/lib/drain3/index.js +5 -5
- package/lib/drain3/persistence/FilePersistence.js +19 -19
- package/lib/drain3/persistence/MemoryPersistence.js +8 -8
- package/lib/drain3/persistence/PersistenceHandler.js +2 -2
- package/lib/drain3/types.js +2 -2
- 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/MemoryFileSystem.test.js +172 -181
- package/lib/fs/createBrowserFileSystem.js +222 -235
- package/lib/fs/createMemoryFileSystem.js +472 -510
- package/lib/fs/createSandboxFileSystem.js +102 -101
- package/lib/fs/createWebDavFileSystem.js +162 -149
- package/lib/fs/createWebFileSystem.js +197 -220
- package/lib/fs/findMimeType.js +14 -14
- package/lib/fs/index.js +7 -7
- package/lib/fs/minio/createMinioFileSystem.js +959 -956
- package/lib/fs/minio/index.js +1 -1
- package/lib/fs/orpc/FileSystemContract.js +57 -57
- package/lib/fs/orpc/createContractClientFileSystem.js +88 -88
- package/lib/fs/orpc/index.js +2 -2
- package/lib/fs/orpc/server/createFileSystemContractImpl.js +62 -60
- package/lib/fs/orpc/server/index.js +1 -1
- package/lib/fs/s3/createS3MiniFileSystem.js +756 -737
- 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/createNodeFileSystem.js +407 -405
- 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 -316
- 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/webdav/index.js +1 -1
- package/lib/index.js +2 -2
- package/lib/jsonschema/JsonSchema.js +216 -155
- package/lib/jsonschema/JsonSchema.test.js +123 -124
- package/lib/jsonschema/forEachJsonSchema.js +41 -41
- package/lib/jsonschema/index.js +2 -2
- package/lib/jsonschema/types.d.js +2 -2
- 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.test.js +13 -12
- package/lib/meta/index.js +3 -3
- package/lib/orpc/createOpenApiContractClient.js +26 -24
- 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.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/createBase64PasswordAlgorithm.js +11 -11
- package/lib/password/createBcryptPasswordAlgorithm.js +20 -18
- package/lib/password/createPBKDF2PasswordAlgorithm.js +65 -52
- package/lib/password/createScryptPasswordAlgorithm.js +74 -63
- 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/getTitleOfResource.js +5 -5
- package/lib/resource/index.js +2 -2
- 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.test.js +238 -261
- package/lib/s3/index.js +2 -2
- package/lib/s3/parseS3Url.js +61 -60
- package/lib/s3/parseS3Url.test.js +270 -269
- package/lib/schema/SchemaRegistry.js +41 -42
- package/lib/schema/SchemaRegistry.mod.js +1 -1
- package/lib/schema/TypeSchema.d.js +2 -2
- package/lib/schema/createSchemaData.js +113 -67
- package/lib/schema/findJsonSchemaByPath.js +28 -23
- package/lib/schema/formatZodError.js +112 -131
- 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 +195 -189
- package/lib/schema/toJsonSchema.test.js +34 -26
- package/lib/schema/validate.js +105 -96
- 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 +54 -53
- package/lib/utils/getEstimateProcessTime.js +24 -19
- package/lib/utils/index.js +3 -3
- package/lib/utils/resolveFeatureOptions.js +9 -9
- package/package.json +14 -14
- package/src/ai/vision/index.ts +2 -2
- package/src/cn/index.ts +1 -2
- package/src/consola/index.ts +1 -1
- package/src/data/index.ts +3 -4
- package/src/data/resolvePagination.ts +2 -2
- package/src/dayjs/formatDuration.ts +8 -9
- package/src/dayjs/index.ts +1 -1
- package/src/dayjs/parseRelativeTime.ts +1 -1
- package/src/dayjs/resolveRelativeTime.ts +1 -1
- package/src/drain3/Drain.test.ts +2 -2
- package/src/drain3/index.ts +2 -4
- package/src/fs/createWebDavFileSystem.ts +2 -7
- package/src/fs/createWebFileSystem.ts +1 -1
- package/src/fs/index.ts +4 -4
- package/src/fs/minio/createMinioFileSystem.ts +2 -2
- package/src/fs/minio/index.ts +1 -1
- package/src/fs/s3/createS3MiniFileSystem.ts +1 -1
- package/src/fs/server/createDatabaseFileSystem.ts +84 -120
- package/src/fs/server/dbfs.test.ts +14 -10
- package/src/fs/server/index.ts +1 -0
- package/src/fs/server/loadTestDatabase.ts +8 -119
- package/src/jsonschema/index.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 +1 -1
- package/src/orpc/index.ts +1 -1
- package/src/password/createArgon2PasswordAlgorithm.ts +1 -1
- package/src/password/index.ts +2 -2
- package/src/resource/index.ts +3 -3
- package/src/resource/schema/index.ts +4 -4
- package/src/s3/index.ts +1 -1
- package/src/schema/SchemaRegistry.ts +1 -1
- package/src/schema/createSchemaData.ts +1 -1
- package/src/schema/findJsonSchemaByPath.ts +1 -1
- package/src/schema/index.ts +5 -5
- package/src/schema/validate.ts +1 -1
- package/src/utils/buildRedactorFormSchema.ts +1 -1
- 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,12 +1,12 @@
|
|
|
1
|
-
import { maybeFunction } from
|
|
1
|
+
import { maybeFunction } from '@wener/utils';
|
|
2
2
|
export function resolveFeatureOptions(value, defaultValue) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
if (value === false) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
if (value === true || value === undefined || value === null) {
|
|
7
|
+
return maybeFunction(defaultValue);
|
|
8
|
+
}
|
|
9
|
+
return value;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
//# sourceMappingURL=resolveFeatureOptions.js.map
|
|
12
|
+
//# sourceMappingURL=resolveFeatureOptions.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wener/common",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Common utils for console & server",
|
|
6
6
|
"repository": {
|
|
@@ -121,23 +121,22 @@
|
|
|
121
121
|
"@standard-schema/spec": "^1.1.0",
|
|
122
122
|
"@wener/utils": "^1.1.58",
|
|
123
123
|
"date-fns": "^4.1.0",
|
|
124
|
-
"es-toolkit": "^1.
|
|
124
|
+
"es-toolkit": "^1.45.1",
|
|
125
125
|
"std-env": "^3.10.0",
|
|
126
126
|
"ts-pattern": "^5.9.0"
|
|
127
127
|
},
|
|
128
128
|
"devDependencies": {
|
|
129
|
-
"@mikro-orm/
|
|
130
|
-
"@mikro-orm/
|
|
131
|
-
"@mikro-orm/
|
|
132
|
-
"@orpc/client": "^1.13.
|
|
133
|
-
"@orpc/contract": "^1.13.
|
|
134
|
-
"@orpc/openapi-client": "^1.13.
|
|
135
|
-
"@orpc/server": "^1.13.
|
|
129
|
+
"@mikro-orm/core": "^7.0.2",
|
|
130
|
+
"@mikro-orm/decorators": "^7.0.2",
|
|
131
|
+
"@mikro-orm/sql": "^7.0.2",
|
|
132
|
+
"@orpc/client": "^1.13.7",
|
|
133
|
+
"@orpc/contract": "^1.13.7",
|
|
134
|
+
"@orpc/openapi-client": "^1.13.7",
|
|
135
|
+
"@orpc/server": "^1.13.7",
|
|
136
136
|
"@sinclair/typebox": "^0.34.48",
|
|
137
137
|
"@sinclair/typebox-codegen": "^0.11.1",
|
|
138
138
|
"@types/argon2-browser": "^1.18.4",
|
|
139
139
|
"@types/bcrypt": "^6.0.0",
|
|
140
|
-
"@types/better-sqlite3": "^7.6.13",
|
|
141
140
|
"@types/micromatch": "^4.0.10",
|
|
142
141
|
"@types/mime-types": "^3.0.1",
|
|
143
142
|
"ajv-formats": "^3.0.1",
|
|
@@ -149,15 +148,16 @@
|
|
|
149
148
|
"bcryptjs": "^3.0.3",
|
|
150
149
|
"chalk": "^5.6.2",
|
|
151
150
|
"consola": "^3.4.2",
|
|
152
|
-
"dayjs": "^1.11.
|
|
151
|
+
"dayjs": "^1.11.20",
|
|
153
152
|
"decimal.js": "^10.6.0",
|
|
154
|
-
"emittery": "^1.2.
|
|
153
|
+
"emittery": "^1.2.1",
|
|
154
|
+
"kysely": "^0.28.11",
|
|
155
155
|
"micromatch": "^4.0.8",
|
|
156
156
|
"mime-types": "^3.0.2",
|
|
157
|
-
"minio": "^8.0.
|
|
157
|
+
"minio": "^8.0.7",
|
|
158
158
|
"pathe": "^2.0.3",
|
|
159
159
|
"s3mini": "^0.9.1",
|
|
160
|
-
"webdav": "^5.
|
|
160
|
+
"webdav": "^5.9.0",
|
|
161
161
|
"zod": "^4.3.6"
|
|
162
162
|
},
|
|
163
163
|
"scripts": {
|
package/src/ai/vision/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { type ImageAnnotation, ImageAnnotationSchema } from './ImageAnnotationSchema';
|
|
2
|
+
export { type ResolvedImageAnnotation, resolveImageAnnotation } from './resolveImageAnnotation';
|
package/src/cn/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { ChineseResidentIdNo } from './ChineseResidentIdNo';
|
|
2
|
-
export { UnifiedSocialCreditCode } from './UnifiedSocialCreditCode';
|
|
3
2
|
export { DivisionCode } from './DivisionCode';
|
|
4
|
-
|
|
5
3
|
export * from './formatChineseAmount';
|
|
6
4
|
export * from './parseChineseNumber';
|
|
7
5
|
export * from './pinyin/toPinyinPure';
|
|
6
|
+
export { UnifiedSocialCreditCode } from './UnifiedSocialCreditCode';
|
package/src/consola/index.ts
CHANGED
package/src/data/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export type * from './types';
|
|
2
|
-
|
|
3
|
-
export { resolvePagination, type PaginationInput, type ResolvedPagination } from './resolvePagination';
|
|
4
|
-
export { parseSort, type SortRule } from './parseSort';
|
|
5
1
|
export { formatSort } from './formatSort';
|
|
2
|
+
export { parseSort, type SortRule } from './parseSort';
|
|
3
|
+
export { type PaginationInput, type ResolvedPagination, resolvePagination } from './resolvePagination';
|
|
4
|
+
export type * from './types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type MaybeFunction, maybeFunction } from '@wener/utils';
|
|
2
2
|
import { mapValues, omitBy, pick } from 'es-toolkit';
|
|
3
|
-
import {
|
|
3
|
+
import { type MaybeNumber, maybeNumber } from './maybeNumber';
|
|
4
4
|
|
|
5
5
|
export type PaginationInput = {
|
|
6
6
|
limit?: MaybeNumber;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { OpUnitType, UnitTypeLongPlural } from 'dayjs';
|
|
2
2
|
import type { Duration } from 'dayjs/plugin/duration';
|
|
3
|
+
import { formatNumber } from '../utils/formatNumber';
|
|
3
4
|
import { parseDuration } from './parseDuration';
|
|
4
5
|
|
|
5
6
|
type FormatDurationOptions = {
|
|
@@ -29,7 +30,6 @@ export function formatDuration(value: MaybeDuration, o?: FormatDurationOptions):
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
let { format, humanize, iso } = o || {};
|
|
32
|
-
// Use local variables instead of modifying o directly
|
|
33
33
|
switch (format) {
|
|
34
34
|
case 'human':
|
|
35
35
|
case 'humanize':
|
|
@@ -56,18 +56,17 @@ export function formatDuration(value: MaybeDuration, o?: FormatDurationOptions):
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// auto format
|
|
59
|
-
// 1h2m3s
|
|
60
59
|
if (v.asDays() > 1) {
|
|
61
60
|
let s = v.toISOString();
|
|
62
61
|
return s.replace('P', '').replace('T', '').toLowerCase();
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
const parts: string[] = [];
|
|
66
|
+
const h = v.hours();
|
|
67
|
+
const m = v.minutes();
|
|
68
|
+
const s = v.seconds();
|
|
69
|
+
const ms = v.milliseconds();
|
|
71
70
|
|
|
72
71
|
if (h > 0) {
|
|
73
72
|
parts.push(`${h}h`);
|
|
@@ -78,8 +77,8 @@ export function formatDuration(value: MaybeDuration, o?: FormatDurationOptions):
|
|
|
78
77
|
if (s > 0) {
|
|
79
78
|
parts.push(`${s}s`);
|
|
80
79
|
}
|
|
81
|
-
if (ms > 0 ||
|
|
82
|
-
parts.push(`${ms}ms`);
|
|
80
|
+
if (ms > 0 || parts.length === 0) {
|
|
81
|
+
parts.push(`${formatNumber(ms, 2)}ms`);
|
|
83
82
|
}
|
|
84
83
|
return parts.join('');
|
|
85
84
|
}
|
package/src/dayjs/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { dayjs } from './dayjs';
|
|
2
|
-
export { parseDuration, type MaybeDuration } from './parseDuration';
|
|
3
2
|
export { formatDuration } from './formatDuration';
|
|
3
|
+
export { type MaybeDuration, parseDuration } from './parseDuration';
|
|
4
4
|
|
|
5
5
|
export { resolveRelativeTime } from './resolveRelativeTime';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
2
|
import type { Duration } from 'dayjs/plugin/duration';
|
|
3
|
-
import { checkDurationUnit,
|
|
3
|
+
import { checkDurationUnit, type RelativeDurationUnit, RelativeDurationUnits } from './resolveRelativeTime';
|
|
4
4
|
|
|
5
5
|
export type TimeOperation =
|
|
6
6
|
| {
|
package/src/drain3/Drain.test.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { readFile, unlink } from 'node:fs/promises';
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import {
|
|
4
|
+
import { beforeEach, describe, expect, it } from 'vitest';
|
|
5
5
|
import { Drain } from './Drain';
|
|
6
|
-
import { TemplateMiner } from './TemplateMiner';
|
|
7
6
|
import { FilePersistence } from './persistence/FilePersistence';
|
|
8
7
|
import { MemoryPersistence } from './persistence/MemoryPersistence';
|
|
8
|
+
import { TemplateMiner } from './TemplateMiner';
|
|
9
9
|
|
|
10
10
|
describe('Drain', () => {
|
|
11
11
|
describe('basic functionality', () => {
|
package/src/drain3/index.ts
CHANGED
|
@@ -28,9 +28,7 @@
|
|
|
28
28
|
export { Drain } from './Drain';
|
|
29
29
|
export { LogCluster } from './LogCluster';
|
|
30
30
|
export { Node } from './Node';
|
|
31
|
+
export { MemoryPersistence } from './persistence/MemoryPersistence';
|
|
32
|
+
export type { PersistenceHandler } from './persistence/PersistenceHandler';
|
|
31
33
|
export { TemplateMiner } from './TemplateMiner';
|
|
32
|
-
|
|
33
34
|
export type { ClusterUpdateType, DrainOptions, ExtractedParameter, SearchStrategy } from './types';
|
|
34
|
-
|
|
35
|
-
export type { PersistenceHandler } from './persistence/PersistenceHandler';
|
|
36
|
-
export { MemoryPersistence } from './persistence/MemoryPersistence';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Readable, Writable } from 'node:stream';
|
|
2
|
-
import {
|
|
3
|
-
import type { FileStat,
|
|
2
|
+
import { type MaybeFunction, maybeFunction } from '@wener/utils';
|
|
3
|
+
import type { FileStat, ResponseDataDetailed, WebDAVClient } from 'webdav';
|
|
4
4
|
import type {
|
|
5
5
|
IFileStat,
|
|
6
6
|
IFileSystem,
|
|
@@ -77,11 +77,6 @@ class WebdavFS implements IFileSystem {
|
|
|
77
77
|
path: string,
|
|
78
78
|
{ glob, recursive, depth, kind, hidden, signal }: ReaddirOptions = {},
|
|
79
79
|
): Promise<IFileStat[]> {
|
|
80
|
-
// webdav depth 只支持 0,1
|
|
81
|
-
let o: GetDirectoryContentsOptions = {};
|
|
82
|
-
if (recursive) {
|
|
83
|
-
o.deep = true;
|
|
84
|
-
}
|
|
85
80
|
let res = await this.client.getDirectoryContents(path, {
|
|
86
81
|
deep: recursive,
|
|
87
82
|
signal,
|
package/src/fs/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type * from './IFileSystem';
|
|
2
|
-
export { createSandboxFileSystem } from './createSandboxFileSystem';
|
|
3
|
-
export { createMemoryFileSystem } from './createMemoryFileSystem';
|
|
4
1
|
export { createBrowserFileSystem } from './createBrowserFileSystem';
|
|
2
|
+
export { createMemoryFileSystem } from './createMemoryFileSystem';
|
|
3
|
+
export { createSandboxFileSystem } from './createSandboxFileSystem';
|
|
5
4
|
export { createWebFileSystem } from './createWebFileSystem';
|
|
5
|
+
export { FileSystemError, FileSystemErrorCode } from './FileSystemError';
|
|
6
6
|
export { findMimeType } from './findMimeType';
|
|
7
|
+
export type * from './IFileSystem';
|
|
7
8
|
export { type FileUrlOptions, FileUrlOptionsSchema } from './types';
|
|
8
|
-
export { FileSystemError, FileSystemErrorCode } from './FileSystemError';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { basename, dirname, normalize } from 'pathe';
|
|
2
1
|
import { PassThrough, Readable, type Writable } from 'node:stream';
|
|
3
|
-
import {
|
|
2
|
+
import { type ParseS3UrlOptions, parseS3Url } from '@wener/common/s3';
|
|
4
3
|
import { Client } from 'minio';
|
|
4
|
+
import { basename, dirname, normalize } from 'pathe';
|
|
5
5
|
import type {
|
|
6
6
|
CopyOptions,
|
|
7
7
|
CreateReadStreamOptions,
|
package/src/fs/minio/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { type CreateMinioFileSystemOptions, createMinioFileSystem } from './createMinioFileSystem';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { basename, dirname, normalize } from 'node:path';
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
|
-
import { formatS3Url,
|
|
3
|
+
import { formatS3Url, type ParseS3UrlOptions, parseS3Url } from '@wener/common/s3';
|
|
4
4
|
import { S3mini, sanitizeETag } from 's3mini';
|
|
5
5
|
import type {
|
|
6
6
|
CopyOptions,
|