@wener/common 2.0.2 → 2.0.5
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 +2 -0
- package/lib/ai/qwen3vl/index.js.map +1 -0
- package/lib/ai/qwen3vl/utils.js +31 -0
- package/lib/ai/qwen3vl/utils.js.map +1 -0
- package/lib/ai/vision/DocLayoutElementTypeSchema.js +28 -0
- package/lib/ai/vision/DocLayoutElementTypeSchema.js.map +1 -0
- package/lib/ai/vision/ImageAnnotationSchema.js +50 -0
- package/lib/ai/vision/ImageAnnotationSchema.js.map +1 -0
- package/lib/ai/vision/index.js +3 -0
- package/lib/ai/vision/index.js.map +1 -0
- package/lib/ai/vision/resolveImageAnnotation.js +105 -0
- package/lib/ai/vision/resolveImageAnnotation.js.map +1 -0
- package/lib/cn/ChineseResidentIdNo.js +22 -15
- package/lib/cn/ChineseResidentIdNo.js.map +1 -0
- package/lib/cn/ChineseResidentIdNo.test.js +1 -1
- package/lib/cn/DivisionCode.js +30 -25
- package/lib/cn/DivisionCode.js.map +1 -0
- package/lib/cn/DivisionCode.test.js +1 -1
- package/lib/cn/Mod11.js +38 -81
- package/lib/cn/Mod11.js.map +1 -0
- package/lib/cn/Mod31.js +41 -90
- package/lib/cn/Mod31.js.map +1 -0
- package/lib/cn/UnifiedSocialCreditCode.js +43 -34
- package/lib/cn/UnifiedSocialCreditCode.js.map +1 -0
- package/lib/cn/UnifiedSocialCreditCode.test.js +1 -1
- package/lib/cn/formatChineseAmount.js +77 -0
- package/lib/cn/formatChineseAmount.js.map +1 -0
- package/lib/cn/index.js +7 -1
- package/lib/cn/index.js.map +1 -0
- package/lib/cn/parseChineseNumber.js +94 -0
- package/lib/cn/parseChineseNumber.js.map +1 -0
- package/lib/cn/parseChineseNumber.test.js +278 -0
- package/lib/cn/pinyin/cartesianProduct.js +22 -0
- package/lib/cn/pinyin/cartesianProduct.js.map +1 -0
- package/lib/cn/pinyin/cartesianProduct.test.js +179 -0
- package/lib/cn/pinyin/data.json +23573 -0
- package/lib/cn/pinyin/loader.js +14 -0
- package/lib/cn/pinyin/loader.js.map +1 -0
- package/lib/cn/pinyin/preload.js +3 -0
- package/lib/cn/pinyin/preload.js.map +1 -0
- package/lib/cn/pinyin/toPinyin.test.js +167 -0
- package/lib/cn/pinyin/toPinyinPure.js +33 -0
- package/lib/cn/pinyin/toPinyinPure.js.map +1 -0
- package/lib/cn/pinyin/transform.js +14 -0
- package/lib/cn/pinyin/transform.js.map +1 -0
- package/lib/cn/types.d.js +2 -0
- package/lib/cn/types.d.js.map +1 -0
- package/lib/consola/createStandardConsolaReporter.js +6 -6
- package/lib/consola/createStandardConsolaReporter.js.map +1 -0
- package/lib/consola/formatLogObject.js +66 -146
- package/lib/consola/formatLogObject.js.map +1 -0
- package/lib/consola/formatLogObject.test.js +184 -0
- package/lib/consola/index.js +1 -0
- package/lib/consola/index.js.map +1 -0
- package/lib/data/formatSort.js +6 -5
- package/lib/data/formatSort.js.map +1 -0
- package/lib/data/index.js +1 -0
- package/lib/data/index.js.map +1 -0
- package/lib/data/maybeNumber.js +6 -8
- package/lib/data/maybeNumber.js.map +1 -0
- package/lib/data/parseSort.js +22 -28
- package/lib/data/parseSort.js.map +1 -0
- package/lib/data/resolvePagination.js +13 -17
- package/lib/data/resolvePagination.js.map +1 -0
- package/lib/data/types.d.js +2 -0
- package/lib/data/types.d.js.map +1 -0
- package/lib/dayjs/dayjs.js +21 -19
- package/lib/dayjs/dayjs.js.map +1 -0
- package/lib/dayjs/formatDuration.js +15 -14
- package/lib/dayjs/formatDuration.js.map +1 -0
- package/lib/dayjs/index.js +2 -0
- package/lib/dayjs/index.js.map +1 -0
- package/lib/dayjs/parseDuration.js +5 -8
- package/lib/dayjs/parseDuration.js.map +1 -0
- package/lib/dayjs/parseRelativeTime.js +90 -0
- package/lib/dayjs/parseRelativeTime.js.map +1 -0
- package/lib/dayjs/parseRelativeTime.test.js +247 -0
- package/lib/dayjs/resolveRelativeTime.js +87 -0
- package/lib/dayjs/resolveRelativeTime.js.map +1 -0
- package/lib/dayjs/resolveRelativeTime.test.js +310 -0
- package/lib/decimal/index.js +1 -0
- package/lib/decimal/index.js.map +1 -0
- package/lib/decimal/parseDecimal.js +3 -1
- package/lib/decimal/parseDecimal.js.map +1 -0
- package/lib/drain3/Drain.js +356 -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 +204 -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 +10 -0
- package/lib/emittery/emitter.js.map +1 -0
- package/lib/emittery/index.js +2 -0
- package/lib/emittery/index.js.map +1 -0
- package/lib/foundation/schema/SexType.js +5 -3
- package/lib/foundation/schema/SexType.js.map +1 -0
- package/lib/foundation/schema/index.js +1 -0
- package/lib/foundation/schema/index.js.map +1 -0
- package/lib/foundation/schema/parseSexType.js +1 -0
- package/lib/foundation/schema/parseSexType.js.map +1 -0
- package/lib/foundation/schema/types.js +4 -2
- package/lib/foundation/schema/types.js.map +1 -0
- package/lib/fs/FileSystemError.js +23 -0
- package/lib/fs/FileSystemError.js.map +1 -0
- package/lib/fs/IFileSystem.d.js +3 -0
- package/lib/fs/IFileSystem.d.js.map +1 -0
- package/lib/fs/MemoryFileSystem.test.js +188 -0
- package/lib/fs/createBrowserFileSystem.js +250 -0
- package/lib/fs/createBrowserFileSystem.js.map +1 -0
- package/lib/fs/createMemoryFileSystem.js +517 -0
- package/lib/fs/createMemoryFileSystem.js.map +1 -0
- package/lib/fs/createSandboxFileSystem.js +108 -0
- package/lib/fs/createSandboxFileSystem.js.map +1 -0
- package/lib/fs/createWebDavFileSystem.js +154 -0
- package/lib/fs/createWebDavFileSystem.js.map +1 -0
- package/lib/fs/createWebFileSystem.js +225 -0
- package/lib/fs/createWebFileSystem.js.map +1 -0
- package/lib/fs/findMimeType.js +17 -0
- package/lib/fs/findMimeType.js.map +1 -0
- package/lib/fs/index.js +8 -0
- package/lib/fs/index.js.map +1 -0
- package/lib/fs/minio/createMinioFileSystem.js +974 -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 +93 -0
- package/lib/fs/orpc/FileSystemContract.js.map +1 -0
- package/lib/fs/orpc/createContractClientFileSystem.js +93 -0
- package/lib/fs/orpc/createContractClientFileSystem.js.map +1 -0
- package/lib/fs/orpc/index.js +3 -0
- package/lib/fs/orpc/index.js.map +1 -0
- package/lib/fs/orpc/server/createFileSystemContractImpl.js +63 -0
- package/lib/fs/orpc/server/createFileSystemContractImpl.js.map +1 -0
- package/lib/fs/orpc/server/index.js +2 -0
- package/lib/fs/orpc/server/index.js.map +1 -0
- package/lib/fs/s3/createS3MiniFileSystem.js +753 -0
- package/lib/fs/s3/createS3MiniFileSystem.js.map +1 -0
- package/lib/fs/s3/index.js +2 -0
- package/lib/fs/s3/index.js.map +1 -0
- package/lib/fs/s3/s3mini.test.js +584 -0
- package/lib/fs/scandir.js +59 -0
- package/lib/fs/scandir.js.map +1 -0
- package/lib/fs/server/createDatabaseFileSystem.js +750 -0
- package/lib/fs/server/createDatabaseFileSystem.js.map +1 -0
- package/lib/fs/server/createNodeFileSystem.js +426 -0
- package/lib/fs/server/createNodeFileSystem.js.map +1 -0
- package/lib/fs/server/dbfs.test.js +221 -0
- package/lib/fs/server/index.js +2 -0
- package/lib/fs/server/index.js.map +1 -0
- package/lib/fs/server/loadTestDatabase.js +127 -0
- package/lib/fs/server/loadTestDatabase.js.map +1 -0
- package/lib/fs/tests/runFileSystemTest.js +319 -0
- package/lib/fs/tests/runFileSystemTest.js.map +1 -0
- package/lib/fs/types.js +27 -0
- package/lib/fs/types.js.map +1 -0
- package/lib/fs/utils/getFileUrl.js +35 -0
- package/lib/fs/utils/getFileUrl.js.map +1 -0
- package/lib/fs/utils.js +22 -0
- package/lib/fs/utils.js.map +1 -0
- package/lib/fs/webdav/index.js +2 -0
- package/lib/fs/webdav/index.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/jsonschema/JsonSchema.js +146 -172
- package/lib/jsonschema/JsonSchema.js.map +1 -0
- package/lib/jsonschema/forEachJsonSchema.js +44 -0
- package/lib/jsonschema/forEachJsonSchema.js.map +1 -0
- package/lib/jsonschema/index.js +2 -0
- package/lib/jsonschema/index.js.map +1 -0
- package/lib/jsonschema/types.d.js +2 -0
- package/lib/jsonschema/types.d.js.map +1 -0
- package/lib/meta/defineFileType.js +20 -103
- package/lib/meta/defineFileType.js.map +1 -0
- package/lib/meta/defineInit.js +31 -250
- package/lib/meta/defineInit.js.map +1 -0
- package/lib/meta/defineMetadata.js +24 -140
- package/lib/meta/defineMetadata.js.map +1 -0
- package/lib/meta/index.js +1 -0
- package/lib/meta/index.js.map +1 -0
- package/lib/orpc/createOpenApiContractClient.js +27 -0
- package/lib/orpc/createOpenApiContractClient.js.map +1 -0
- package/lib/orpc/createRpcContractClient.js +34 -0
- package/lib/orpc/createRpcContractClient.js.map +1 -0
- package/lib/orpc/index.js +3 -0
- package/lib/orpc/index.js.map +1 -0
- package/lib/orpc/resolveLinkPlugins.js +28 -0
- package/lib/orpc/resolveLinkPlugins.js.map +1 -0
- package/lib/password/PHC.js +63 -87
- package/lib/password/PHC.js.map +1 -0
- package/lib/password/PHC.test.js +11 -3
- package/lib/password/Password.js +29 -294
- package/lib/password/Password.js.map +1 -0
- package/lib/password/Password.test.js +35 -22
- package/lib/password/createArgon2PasswordAlgorithm.js +35 -191
- package/lib/password/createArgon2PasswordAlgorithm.js.map +1 -0
- package/lib/password/createBase64PasswordAlgorithm.js +8 -141
- package/lib/password/createBase64PasswordAlgorithm.js.map +1 -0
- package/lib/password/createBcryptPasswordAlgorithm.js +13 -168
- package/lib/password/createBcryptPasswordAlgorithm.js.map +1 -0
- package/lib/password/createPBKDF2PasswordAlgorithm.js +46 -228
- package/lib/password/createPBKDF2PasswordAlgorithm.js.map +1 -0
- package/lib/password/createScryptPasswordAlgorithm.js +55 -211
- package/lib/password/createScryptPasswordAlgorithm.js.map +1 -0
- package/lib/password/index.js +1 -0
- package/lib/password/index.js.map +1 -0
- package/lib/password/server/index.js +1 -0
- package/lib/password/server/index.js.map +1 -0
- package/lib/resource/Identifiable.js +2 -0
- package/lib/resource/Identifiable.js.map +1 -0
- package/lib/resource/ListQuery.js +21 -93
- package/lib/resource/ListQuery.js.map +1 -0
- package/lib/resource/getTitleOfResource.js +3 -5
- package/lib/resource/getTitleOfResource.js.map +1 -0
- package/lib/resource/index.js +1 -0
- package/lib/resource/index.js.map +1 -0
- package/lib/resource/schema/AnyResourceSchema.js +2 -1
- package/lib/resource/schema/AnyResourceSchema.js.map +1 -0
- package/lib/resource/schema/BaseResourceSchema.js +2 -1
- package/lib/resource/schema/BaseResourceSchema.js.map +1 -0
- package/lib/resource/schema/ResourceActionType.js +6 -4
- package/lib/resource/schema/ResourceActionType.js.map +1 -0
- package/lib/resource/schema/ResourceStatus.js +5 -3
- package/lib/resource/schema/ResourceStatus.js.map +1 -0
- package/lib/resource/schema/ResourceType.js +5 -3
- package/lib/resource/schema/ResourceType.js.map +1 -0
- package/lib/resource/schema/index.js +1 -0
- package/lib/resource/schema/index.js.map +1 -0
- package/lib/resource/schema/types.js +16 -20
- package/lib/resource/schema/types.js.map +1 -0
- package/lib/s3/formatS3Url.js +65 -0
- package/lib/s3/formatS3Url.js.map +1 -0
- package/lib/s3/formatS3Url.test.js +262 -0
- package/lib/s3/index.js +3 -0
- package/lib/s3/index.js.map +1 -0
- package/lib/s3/parseS3Url.js +65 -0
- package/lib/s3/parseS3Url.js.map +1 -0
- package/lib/s3/parseS3Url.test.js +270 -0
- package/lib/schema/SchemaRegistry.js +38 -38
- package/lib/schema/SchemaRegistry.js.map +1 -0
- package/lib/schema/TypeSchema.d.js +2 -0
- package/lib/schema/TypeSchema.d.js.map +1 -0
- package/lib/schema/createSchemaData.js +26 -125
- package/lib/schema/createSchemaData.js.map +1 -0
- package/lib/schema/findJsonSchemaByPath.js +13 -36
- package/lib/schema/findJsonSchemaByPath.js.map +1 -0
- package/lib/schema/formatZodError.js +138 -0
- package/lib/schema/formatZodError.js.map +1 -0
- package/lib/schema/formatZodError.test.js +196 -0
- package/lib/schema/getSchemaCache.js +5 -5
- package/lib/schema/getSchemaCache.js.map +1 -0
- package/lib/schema/getSchemaOptions.js +8 -11
- package/lib/schema/getSchemaOptions.js.map +1 -0
- package/lib/schema/index.js +2 -1
- package/lib/schema/index.js.map +1 -0
- package/lib/schema/toJsonSchema.js +50 -293
- package/lib/schema/toJsonSchema.js.map +1 -0
- package/lib/schema/validate.js +34 -46
- package/lib/schema/validate.js.map +1 -0
- package/lib/tools/generateSchema.js +39 -197
- package/lib/tools/generateSchema.js.map +1 -0
- package/lib/tools/renderJsonSchemaToMarkdownDoc.js +55 -143
- package/lib/tools/renderJsonSchemaToMarkdownDoc.js.map +1 -0
- package/lib/utils/buildBaseUrl.js +13 -0
- package/lib/utils/buildBaseUrl.js.map +1 -0
- package/lib/utils/buildRedactorFormSchema.js +59 -0
- package/lib/utils/buildRedactorFormSchema.js.map +1 -0
- package/lib/utils/getEstimateProcessTime.js +12 -11
- package/lib/utils/getEstimateProcessTime.js.map +1 -0
- package/lib/utils/index.js +3 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/resolveFeatureOptions.js +12 -0
- package/lib/utils/resolveFeatureOptions.js.map +1 -0
- package/package.json +80 -13
- package/src/ai/qwen3vl/index.ts +1 -0
- package/src/ai/qwen3vl/utils.ts +36 -0
- package/src/ai/vision/DocLayoutElementTypeSchema.ts +30 -0
- package/src/ai/vision/ImageAnnotationSchema.ts +60 -0
- package/src/ai/vision/index.ts +2 -0
- package/src/ai/vision/resolveImageAnnotation.ts +135 -0
- package/src/cn/ChineseResidentIdNo.test.ts +1 -1
- package/src/cn/ChineseResidentIdNo.ts +9 -1
- package/src/cn/DivisionCode.test.ts +1 -1
- package/src/cn/DivisionCode.ts +8 -0
- package/src/cn/Mod11.ts +1 -1
- package/src/cn/UnifiedSocialCreditCode.test.ts +1 -1
- package/src/cn/UnifiedSocialCreditCode.ts +15 -0
- package/src/cn/__snapshots__/ChineseResidentIdNo.test.ts.snap +1 -1
- package/src/cn/formatChineseAmount.ts +61 -0
- package/src/cn/index.ts +7 -1
- package/src/cn/parseChineseNumber.test.ts +159 -0
- package/src/cn/parseChineseNumber.ts +97 -0
- package/src/cn/pinyin/cartesianProduct.test.ts +64 -0
- package/src/cn/pinyin/cartesianProduct.ts +24 -0
- package/src/cn/pinyin/data.json +23573 -0
- package/src/cn/pinyin/loader.ts +12 -0
- package/src/cn/pinyin/preload.ts +3 -0
- package/src/cn/pinyin/toPinyin.test.ts +12 -0
- package/src/cn/pinyin/toPinyinPure.ts +43 -0
- package/src/cn/pinyin/transform.ts +12 -0
- package/src/consola/formatLogObject.test.ts +27 -0
- package/src/consola/formatLogObject.ts +40 -12
- package/src/data/maybeNumber.ts +1 -1
- package/src/data/parseSort.test.ts +0 -1
- package/src/data/types.d.ts +2 -2
- package/src/dayjs/dayjs.ts +18 -18
- package/src/dayjs/formatDuration.ts +2 -2
- package/src/dayjs/index.ts +3 -1
- package/src/dayjs/parseRelativeTime.test.ts +185 -0
- package/src/dayjs/parseRelativeTime.ts +115 -0
- package/src/dayjs/resolveRelativeTime.test.ts +357 -0
- package/src/dayjs/resolveRelativeTime.ts +164 -0
- 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 +36 -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/emittery/emitter.ts +9 -0
- package/src/emittery/index.ts +1 -0
- package/src/fs/FileSystemError.ts +26 -0
- package/src/fs/IFileSystem.d.ts +101 -0
- package/src/fs/MemoryFileSystem.test.ts +37 -0
- package/src/fs/createBrowserFileSystem.ts +293 -0
- package/src/fs/createMemoryFileSystem.ts +600 -0
- package/src/fs/createSandboxFileSystem.ts +136 -0
- package/src/fs/createWebDavFileSystem.ts +190 -0
- package/src/fs/createWebFileSystem.ts +242 -0
- package/src/fs/findMimeType.ts +20 -0
- package/src/fs/index.ts +8 -0
- package/src/fs/minio/createMinioFileSystem.ts +1148 -0
- package/src/fs/minio/index.ts +1 -0
- package/src/fs/orpc/FileSystemContract.ts +92 -0
- package/src/fs/orpc/createContractClientFileSystem.ts +115 -0
- package/src/fs/orpc/index.ts +2 -0
- package/src/fs/orpc/server/createFileSystemContractImpl.ts +64 -0
- package/src/fs/orpc/server/index.ts +1 -0
- package/src/fs/s3/createS3MiniFileSystem.ts +871 -0
- package/src/fs/s3/index.ts +1 -0
- package/src/fs/s3/s3fs.test.ts +441 -0
- package/src/fs/s3/s3mini.test.ts +264 -0
- package/src/fs/scandir.ts +75 -0
- package/src/fs/server/createDatabaseFileSystem.ts +668 -0
- package/src/fs/server/createNodeFileSystem.ts +518 -0
- package/src/fs/server/dbfs.test.ts +48 -0
- package/src/fs/server/index.ts +1 -0
- package/src/fs/server/loadTestDatabase.ts +131 -0
- package/src/fs/tests/runFileSystemTest.ts +289 -0
- package/src/fs/types.ts +29 -0
- package/src/fs/utils/getFileUrl.ts +44 -0
- package/src/fs/utils.ts +23 -0
- package/src/fs/webdav/index.ts +1 -0
- package/src/jsonschema/JsonSchema.ts +118 -110
- package/src/jsonschema/forEachJsonSchema.ts +50 -0
- package/src/jsonschema/index.ts +1 -0
- package/src/jsonschema/types.d.ts +1 -1
- package/src/meta/defineMetadata.ts +1 -1
- package/src/orpc/createOpenApiContractClient.ts +52 -0
- package/src/orpc/createRpcContractClient.ts +50 -0
- package/src/orpc/index.ts +2 -0
- package/src/orpc/resolveLinkPlugins.ts +29 -0
- package/src/password/PHC.ts +6 -6
- package/src/password/Password.test.ts +1 -1
- package/src/password/createArgon2PasswordAlgorithm.ts +1 -1
- package/src/password/createBase64PasswordAlgorithm.ts +2 -2
- package/src/password/createBcryptPasswordAlgorithm.ts +4 -2
- package/src/password/createPBKDF2PasswordAlgorithm.ts +4 -4
- package/src/password/createScryptPasswordAlgorithm.ts +4 -4
- package/src/resource/ListQuery.ts +4 -1
- package/src/resource/index.ts +2 -2
- package/src/resource/schema/AnyResourceSchema.ts +16 -2
- package/src/s3/formatS3Url.test.ts +254 -0
- package/src/s3/formatS3Url.ts +84 -0
- package/src/s3/index.ts +2 -0
- package/src/s3/parseS3Url.test.ts +258 -0
- package/src/s3/parseS3Url.ts +88 -0
- package/src/schema/SchemaRegistry.ts +35 -33
- package/src/schema/TypeSchema.d.ts +6 -6
- package/src/schema/createSchemaData.ts +4 -4
- package/src/schema/findJsonSchemaByPath.ts +4 -4
- package/src/schema/formatZodError.test.ts +197 -0
- package/src/schema/formatZodError.ts +139 -0
- package/src/schema/getSchemaOptions.ts +2 -2
- package/src/schema/index.ts +1 -1
- package/src/schema/toJsonSchema.ts +6 -6
- package/src/schema/validate.ts +1 -1
- package/src/utils/buildBaseUrl.ts +12 -0
- package/src/utils/buildRedactorFormSchema.ts +85 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/resolveFeatureOptions.ts +14 -0
- package/src/cn/ChineseResidentIdNo.mod.ts +0 -7
- package/src/cn/DivisionCode.mod.ts +0 -7
- package/src/cn/UnifiedSocialCreditCode.mod.ts +0 -7
- package/src/cn/mod.ts +0 -3
- package/src/schema/SchemaRegistry.mod.ts +0 -1
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
function _type_of(obj) {
|
|
2
|
-
"@swc/helpers - typeof";
|
|
3
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
4
|
-
}
|
|
5
1
|
import { getGlobalStates } from "@wener/utils";
|
|
6
2
|
import { toJsonSchema } from "./index.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return found;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
if (needle && typeof needle !== "string") {
|
|
18
|
-
return toJsonSchema(needle);
|
|
3
|
+
(function (SchemaRegistry) {
|
|
4
|
+
const types = getGlobalStates("@wener/common/resource/schema/SchemaRegistry", () => new Map());
|
|
5
|
+
function get(needle) {
|
|
6
|
+
let key = getKey(needle);
|
|
7
|
+
let found = types.get(key);
|
|
8
|
+
if (found) {
|
|
9
|
+
return found;
|
|
19
10
|
}
|
|
11
|
+
else {
|
|
12
|
+
if (needle && typeof needle !== "string") {
|
|
13
|
+
return toJsonSchema(needle);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
throw new Error(`Schema not found: ${key}`);
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
SchemaRegistry.get = get;
|
|
19
|
+
function getKey(s) {
|
|
20
|
+
let key;
|
|
21
|
+
if (typeof s === "string") {
|
|
22
|
+
key = s;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
let js = toJsonSchema(s);
|
|
26
|
+
key = js.$id || js.title;
|
|
27
|
+
}
|
|
28
|
+
if (!key) {
|
|
29
|
+
throw new Error(`Schema must have $id or title`);
|
|
30
|
+
}
|
|
31
|
+
return key;
|
|
34
32
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
throw new Error("Invalid schema definition for: ".concat(getKey(key)));
|
|
33
|
+
function set(key, def) {
|
|
34
|
+
if (!def) {
|
|
35
|
+
def = key;
|
|
36
|
+
if (!def || typeof def !== "object") {
|
|
37
|
+
throw new Error(`Invalid schema definition for: ${getKey(key)}`);
|
|
38
|
+
}
|
|
42
39
|
}
|
|
40
|
+
types.set(getKey(key), toJsonSchema(def));
|
|
43
41
|
}
|
|
44
|
-
|
|
45
|
-
}
|
|
42
|
+
SchemaRegistry.set = set;
|
|
43
|
+
})(SchemaRegistry || (SchemaRegistry = {}));
|
|
44
|
+
export var SchemaRegistry;
|
|
45
|
+
//# sourceMappingURL=SchemaRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/SchemaRegistry.ts"],"sourcesContent":["import { getGlobalStates } from '@wener/utils';\nimport type { JsonSchemaDef } from '../jsonschema';\nimport { toJsonSchema, type SchemaOutput, type TypeSchema } from './index';\n\nexport namespace SchemaRegistry {\n\tconst types = getGlobalStates('@wener/common/resource/schema/SchemaRegistry', () => new Map<string, JsonSchemaDef>());\n\n\texport function get(name: string): JsonSchemaDef;\n\texport function get<S extends TypeSchema>(schema: S): JsonSchemaDef<SchemaOutput<S>>;\n\texport function get(needle: TypeSchema | string) {\n\t\tlet key = getKey(needle);\n\t\tlet found = types.get(key);\n\t\tif (found) {\n\t\t\treturn found;\n\t\t} else {\n\t\t\tif (needle && typeof needle !== 'string') {\n\t\t\t\treturn toJsonSchema(needle);\n\t\t\t}\n\t\t}\n\t\tthrow new Error(`Schema not found: ${key}`);\n\t}\n\n\tfunction getKey(s: TypeSchema | string) {\n\t\tlet key: string | undefined;\n\t\tif (typeof s === 'string') {\n\t\t\tkey = s;\n\t\t} else {\n\t\t\tlet js = toJsonSchema(s);\n\t\t\tkey = js.$id || js.title;\n\t\t}\n\t\tif (!key) {\n\t\t\tthrow new Error(`Schema must have $id or title`);\n\t\t}\n\t\treturn key;\n\t}\n\n\texport function set(key: TypeSchema | string, def: TypeSchema): void;\n\texport function set(key: TypeSchema, def?: TypeSchema): void;\n\texport function set(key: TypeSchema | string, def?: TypeSchema) {\n\t\tif (!def) {\n\t\t\tdef = key as TypeSchema;\n\t\t\tif (!def || typeof def !== 'object') {\n\t\t\t\tthrow new Error(`Invalid schema definition for: ${getKey(key)}`);\n\t\t\t}\n\t\t}\n\t\ttypes.set(getKey(key), toJsonSchema(def));\n\t}\n}\n"],"names":["getGlobalStates","toJsonSchema","SchemaRegistry","types","Map","get","needle","key","getKey","found","Error","s","js","$id","title","set","def"],"mappings":"AAAA,SAASA,eAAe,QAAQ,eAAe;AAE/C,SAASC,YAAY,QAA4C,UAAU;UAE1DC;IAChB,MAAMC,QAAQH,gBAAgB,gDAAgD,IAAM,IAAII;IAIjF,SAASC,IAAIC,MAA2B;QAC9C,IAAIC,MAAMC,OAAOF;QACjB,IAAIG,QAAQN,MAAME,GAAG,CAACE;QACtB,IAAIE,OAAO;YACV,OAAOA;QACR,OAAO;YACN,IAAIH,UAAU,OAAOA,WAAW,UAAU;gBACzC,OAAOL,aAAaK;YACrB;QACD;QACA,MAAM,IAAII,MAAM,CAAC,kBAAkB,EAAEH,KAAK;IAC3C;mBAXgBF,MAAAA;IAahB,SAASG,OAAOG,CAAsB;QACrC,IAAIJ;QACJ,IAAI,OAAOI,MAAM,UAAU;YAC1BJ,MAAMI;QACP,OAAO;YACN,IAAIC,KAAKX,aAAaU;YACtBJ,MAAMK,GAAGC,GAAG,IAAID,GAAGE,KAAK;QACzB;QACA,IAAI,CAACP,KAAK;YACT,MAAM,IAAIG,MAAM,CAAC,6BAA6B,CAAC;QAChD;QACA,OAAOH;IACR;IAIO,SAASQ,IAAIR,GAAwB,EAAES,GAAgB;QAC7D,IAAI,CAACA,KAAK;YACTA,MAAMT;YACN,IAAI,CAACS,OAAO,OAAOA,QAAQ,UAAU;gBACpC,MAAM,IAAIN,MAAM,CAAC,+BAA+B,EAAEF,OAAOD,MAAM;YAChE;QACD;QACAJ,MAAMY,GAAG,CAACP,OAAOD,MAAMN,aAAae;IACrC;mBARgBD,MAAAA;AASjB,GA3CiBb,mBAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/TypeSchema.d.ts"],"sourcesContent":["import type {\n\tTSchema,\n\tStaticDecode as TypeBoxStaticDecode,\n\tStaticEncode as TypeBoxStaticEncode,\n} from '@sinclair/typebox';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { z } from 'zod/v4';\nimport type { JsonSchemaDef } from '../jsonschema';\n\nexport type TypeSchema<I = unknown, O = I> = TSchema | z.ZodSchema<O, I> | JsonSchemaDef | StandardSchemaV1<I, O>;\n\nexport type SchemaOutput<S extends TypeSchema> =\n\tS extends StandardSchemaV1<infer _I, infer O>\n\t\t? O\n\t\t: S extends z.ZodSchema<infer O, infer _I>\n\t\t\t? O\n\t\t\t: S extends TSchema\n\t\t\t\t? TypeBoxStaticEncode<S>\n\t\t\t\t: S extends JsonSchemaDef<infer _I, infer O>\n\t\t\t\t\t? O\n\t\t\t\t\t: never;\n\nexport type SchemaInput<S extends TypeSchema> =\n\tS extends StandardSchemaV1<infer I, infer _O>\n\t\t? I\n\t\t: S extends z.ZodSchema<infer _O, infer I>\n\t\t\t? I\n\t\t\t: S extends TSchema\n\t\t\t\t? TypeBoxStaticDecode<S>\n\t\t\t\t: S extends JsonSchemaDef<infer I, infer _O>\n\t\t\t\t\t? I\n\t\t\t\t\t: never;\n"],"names":[],"mappings":"AAsBA,WASa"}
|
|
@@ -1,91 +1,25 @@
|
|
|
1
|
-
function _array_like_to_array(arr, len) {
|
|
2
|
-
if (len == null || len > arr.length)
|
|
3
|
-
len = arr.length;
|
|
4
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
5
|
-
arr2[i] = arr[i];
|
|
6
|
-
return arr2;
|
|
7
|
-
}
|
|
8
|
-
function _array_with_holes(arr) {
|
|
9
|
-
if (Array.isArray(arr))
|
|
10
|
-
return arr;
|
|
11
|
-
}
|
|
12
|
-
function _iterable_to_array_limit(arr, i) {
|
|
13
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
14
|
-
if (_i == null)
|
|
15
|
-
return;
|
|
16
|
-
var _arr = [];
|
|
17
|
-
var _n = true;
|
|
18
|
-
var _d = false;
|
|
19
|
-
var _s, _e;
|
|
20
|
-
try {
|
|
21
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
22
|
-
_arr.push(_s.value);
|
|
23
|
-
if (i && _arr.length === i)
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
_d = true;
|
|
29
|
-
_e = err;
|
|
30
|
-
}
|
|
31
|
-
finally {
|
|
32
|
-
try {
|
|
33
|
-
if (!_n && _i["return"] != null)
|
|
34
|
-
_i["return"]();
|
|
35
|
-
}
|
|
36
|
-
finally {
|
|
37
|
-
if (_d)
|
|
38
|
-
throw _e;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return _arr;
|
|
42
|
-
}
|
|
43
|
-
function _non_iterable_rest() {
|
|
44
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
45
|
-
}
|
|
46
|
-
function _sliced_to_array(arr, i) {
|
|
47
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
48
|
-
}
|
|
49
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
50
|
-
if (!o)
|
|
51
|
-
return;
|
|
52
|
-
if (typeof o === "string")
|
|
53
|
-
return _array_like_to_array(o, minLen);
|
|
54
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
55
|
-
if (n === "Object" && o.constructor)
|
|
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);
|
|
61
|
-
}
|
|
62
1
|
import { match, P } from "ts-pattern";
|
|
63
2
|
import { toJsonSchema } from "./toJsonSchema.js";
|
|
64
|
-
export function createSchemaData(ts) {
|
|
65
|
-
|
|
66
|
-
var schema = toJsonSchema(ts);
|
|
3
|
+
export function createSchemaData(ts, options = {}) {
|
|
4
|
+
const schema = toJsonSchema(ts);
|
|
67
5
|
return createJsonSchemaData(schema, options);
|
|
68
6
|
}
|
|
69
7
|
function createJsonSchemaData(schema, options) {
|
|
70
|
-
|
|
71
|
-
return Boolean(!ctx.required && s.nullable);
|
|
72
|
-
};
|
|
8
|
+
let skip = (s, ctx) => Boolean(!ctx.required && s.nullable);
|
|
73
9
|
if (options.all) {
|
|
74
|
-
skip =
|
|
75
|
-
return false;
|
|
76
|
-
};
|
|
10
|
+
skip = () => false;
|
|
77
11
|
}
|
|
78
12
|
if (options.skip) {
|
|
79
13
|
skip = options.skip;
|
|
80
14
|
}
|
|
81
15
|
return _create(schema, {
|
|
82
|
-
skip
|
|
16
|
+
skip
|
|
83
17
|
}, {
|
|
84
18
|
required: false
|
|
85
19
|
});
|
|
86
20
|
}
|
|
87
21
|
function _create(schema, options, ctx) {
|
|
88
|
-
|
|
22
|
+
const { skip } = options;
|
|
89
23
|
if (skip(schema, ctx)) {
|
|
90
24
|
return schema.default;
|
|
91
25
|
}
|
|
@@ -94,80 +28,47 @@ function _create(schema, options, ctx) {
|
|
|
94
28
|
}
|
|
95
29
|
return match(schema).returnType().with({
|
|
96
30
|
default: P.select()
|
|
97
|
-
},
|
|
98
|
-
return v;
|
|
99
|
-
}).with({
|
|
31
|
+
}, (v) => v).with({
|
|
100
32
|
const: P.nonNullable
|
|
101
|
-
},
|
|
102
|
-
return v.const;
|
|
103
|
-
}).with({
|
|
33
|
+
}, (v) => v.const).with({
|
|
104
34
|
anyOf: P.nonNullable
|
|
105
|
-
},
|
|
35
|
+
}, (schema) => {
|
|
106
36
|
return _create(schema.anyOf[0], options, {
|
|
107
37
|
required: false
|
|
108
38
|
});
|
|
109
39
|
}).with({
|
|
110
40
|
oneOf: P.nonNullable
|
|
111
|
-
},
|
|
41
|
+
}, (schema) => {
|
|
112
42
|
return _create(schema.oneOf[0], options, {
|
|
113
43
|
required: false
|
|
114
44
|
});
|
|
115
45
|
}).with({
|
|
116
46
|
type: "string"
|
|
117
|
-
},
|
|
118
|
-
return "";
|
|
119
|
-
}).with({
|
|
47
|
+
}, (_schema) => "").with({
|
|
120
48
|
type: P.union("number", "integer")
|
|
121
|
-
},
|
|
122
|
-
return 0;
|
|
123
|
-
}).with({
|
|
49
|
+
}, (_schema) => 0).with({
|
|
124
50
|
type: "object"
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
135
|
-
if (value === undefined) {
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
out[k] = value;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
catch (err) {
|
|
142
|
-
_didIteratorError = true;
|
|
143
|
-
_iteratorError = err;
|
|
144
|
-
}
|
|
145
|
-
finally {
|
|
146
|
-
try {
|
|
147
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
148
|
-
_iterator.return();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
finally {
|
|
152
|
-
if (_didIteratorError) {
|
|
153
|
-
throw _iteratorError;
|
|
154
|
-
}
|
|
51
|
+
}, () => {
|
|
52
|
+
const out = {};
|
|
53
|
+
let required = Array.isArray(schema.required) ? schema.required : [];
|
|
54
|
+
for (const [k, v] of Object.entries(schema.properties || {})) {
|
|
55
|
+
const value = _create(v, options, {
|
|
56
|
+
required: required.includes(k)
|
|
57
|
+
});
|
|
58
|
+
if (value === undefined) {
|
|
59
|
+
continue;
|
|
155
60
|
}
|
|
61
|
+
out[k] = value;
|
|
156
62
|
}
|
|
157
63
|
return out;
|
|
158
64
|
}).with({
|
|
159
65
|
type: "null"
|
|
160
|
-
},
|
|
161
|
-
return null;
|
|
162
|
-
}).with({
|
|
66
|
+
}, () => null).with({
|
|
163
67
|
type: "boolean"
|
|
164
|
-
},
|
|
165
|
-
return false;
|
|
166
|
-
}).with({
|
|
68
|
+
}, (_schema) => false).with({
|
|
167
69
|
type: "array"
|
|
168
|
-
},
|
|
169
|
-
return [];
|
|
170
|
-
}).otherwise(function () {
|
|
70
|
+
}, (_schema) => []).otherwise(() => {
|
|
171
71
|
return undefined;
|
|
172
72
|
});
|
|
173
73
|
}
|
|
74
|
+
//# sourceMappingURL=createSchemaData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/createSchemaData.ts"],"sourcesContent":["import { match, P } from 'ts-pattern';\nimport type { JsonSchemaDef } from '../jsonschema';\nimport { toJsonSchema } from './toJsonSchema';\nimport type { SchemaOutput, TypeSchema } from './TypeSchema';\n\nexport function createSchemaData<S extends TypeSchema>(\n\tts: S,\n\toptions: CreateSchemaDataOptions = {},\n): Partial<SchemaOutput<S>> {\n\tconst schema = toJsonSchema(ts);\n\treturn createJsonSchemaData(schema, options);\n}\n\ntype CreateSchemaDataOptions = Partial<CreateOptions> & {\n\tall?: boolean;\n};\n\nfunction createJsonSchemaData(schema: JsonSchemaDef, options: CreateSchemaDataOptions): any {\n\tlet skip: CreateOptions['skip'] = (s, ctx) => Boolean(!ctx.required && s.nullable);\n\tif (options.all) {\n\t\tskip = () => false;\n\t}\n\tif (options.skip) {\n\t\tskip = options.skip;\n\t}\n\treturn _create(\n\t\tschema,\n\t\t{\n\t\t\tskip,\n\t\t},\n\t\t{ required: false },\n\t);\n}\n\ntype CreateOptions = {\n\tskip: (schema: JsonSchemaDef, ctx: { required: boolean }) => boolean;\n};\n\nfunction _create(schema: JsonSchemaDef, options: CreateOptions, ctx: { required: boolean }): any {\n\tconst { skip } = options;\n\tif (skip(schema, ctx)) {\n\t\treturn schema.default;\n\t}\n\tif (schema.default !== undefined) {\n\t\treturn schema.default;\n\t}\n\treturn match(schema as JsonSchemaDef)\n\t\t.returnType<any>()\n\t\t.with({ default: P.select() }, (v) => v)\n\t\t.with({ const: P.nonNullable }, (v) => v.const)\n\t\t.with({ anyOf: P.nonNullable }, (schema) => {\n\t\t\treturn _create(schema.anyOf[0], options, { required: false });\n\t\t})\n\t\t.with({ oneOf: P.nonNullable }, (schema) => {\n\t\t\treturn _create(schema.oneOf[0], options, { required: false });\n\t\t})\n\t\t.with({ type: 'string' }, (_schema) => '')\n\t\t.with({ type: P.union('number', 'integer') }, (_schema) => 0)\n\t\t.with({ type: 'object' }, () => {\n\t\t\tconst out: Record<string, any> = {};\n\n\t\t\tlet required = Array.isArray(schema.required) ? schema.required : [];\n\t\t\tfor (const [k, v] of Object.entries(schema.properties || {}) as [string, JsonSchemaDef][]) {\n\t\t\t\tconst value = _create(v, options, {\n\t\t\t\t\trequired: required.includes(k),\n\t\t\t\t});\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tout[k] = value;\n\t\t\t}\n\n\t\t\treturn out;\n\t\t})\n\t\t.with({ type: 'null' }, () => null)\n\t\t.with({ type: 'boolean' }, (_schema) => false)\n\t\t.with({ type: 'array' }, (_schema) => [])\n\t\t.otherwise(() => {\n\t\t\treturn undefined;\n\t\t});\n}\n"],"names":["match","P","toJsonSchema","createSchemaData","ts","options","schema","createJsonSchemaData","skip","s","ctx","Boolean","required","nullable","all","_create","default","undefined","returnType","with","select","v","const","nonNullable","anyOf","oneOf","type","_schema","union","out","Array","isArray","k","Object","entries","properties","value","includes","otherwise"],"mappings":"AAAA,SAASA,KAAK,EAAEC,CAAC,QAAQ,aAAa;AAEtC,SAASC,YAAY,QAAQ,iBAAiB;AAG9C,OAAO,SAASC,iBACfC,EAAK,EACLC,UAAmC,CAAC,CAAC;IAErC,MAAMC,SAASJ,aAAaE;IAC5B,OAAOG,qBAAqBD,QAAQD;AACrC;AAMA,SAASE,qBAAqBD,MAAqB,EAAED,OAAgC;IACpF,IAAIG,OAA8B,CAACC,GAAGC,MAAQC,QAAQ,CAACD,IAAIE,QAAQ,IAAIH,EAAEI,QAAQ;IACjF,IAAIR,QAAQS,GAAG,EAAE;QAChBN,OAAO,IAAM;IACd;IACA,IAAIH,QAAQG,IAAI,EAAE;QACjBA,OAAOH,QAAQG,IAAI;IACpB;IACA,OAAOO,QACNT,QACA;QACCE;IACD,GACA;QAAEI,UAAU;IAAM;AAEpB;AAMA,SAASG,QAAQT,MAAqB,EAAED,OAAsB,EAAEK,GAA0B;IACzF,MAAM,EAAEF,IAAI,EAAE,GAAGH;IACjB,IAAIG,KAAKF,QAAQI,MAAM;QACtB,OAAOJ,OAAOU,OAAO;IACtB;IACA,IAAIV,OAAOU,OAAO,KAAKC,WAAW;QACjC,OAAOX,OAAOU,OAAO;IACtB;IACA,OAAOhB,MAAMM,QACXY,UAAU,GACVC,IAAI,CAAC;QAAEH,SAASf,EAAEmB,MAAM;IAAG,GAAG,CAACC,IAAMA,GACrCF,IAAI,CAAC;QAAEG,OAAOrB,EAAEsB,WAAW;IAAC,GAAG,CAACF,IAAMA,EAAEC,KAAK,EAC7CH,IAAI,CAAC;QAAEK,OAAOvB,EAAEsB,WAAW;IAAC,GAAG,CAACjB;QAChC,OAAOS,QAAQT,OAAOkB,KAAK,CAAC,EAAE,EAAEnB,SAAS;YAAEO,UAAU;QAAM;IAC5D,GACCO,IAAI,CAAC;QAAEM,OAAOxB,EAAEsB,WAAW;IAAC,GAAG,CAACjB;QAChC,OAAOS,QAAQT,OAAOmB,KAAK,CAAC,EAAE,EAAEpB,SAAS;YAAEO,UAAU;QAAM;IAC5D,GACCO,IAAI,CAAC;QAAEO,MAAM;IAAS,GAAG,CAACC,UAAY,IACtCR,IAAI,CAAC;QAAEO,MAAMzB,EAAE2B,KAAK,CAAC,UAAU;IAAW,GAAG,CAACD,UAAY,GAC1DR,IAAI,CAAC;QAAEO,MAAM;IAAS,GAAG;QACzB,MAAMG,MAA2B,CAAC;QAElC,IAAIjB,WAAWkB,MAAMC,OAAO,CAACzB,OAAOM,QAAQ,IAAIN,OAAOM,QAAQ,GAAG,EAAE;QACpE,KAAK,MAAM,CAACoB,GAAGX,EAAE,IAAIY,OAAOC,OAAO,CAAC5B,OAAO6B,UAAU,IAAI,CAAC,GAAiC;YAC1F,MAAMC,QAAQrB,QAAQM,GAAGhB,SAAS;gBACjCO,UAAUA,SAASyB,QAAQ,CAACL;YAC7B;YACA,IAAII,UAAUnB,WAAW;gBACxB;YACD;YACAY,GAAG,CAACG,EAAE,GAAGI;QACV;QAEA,OAAOP;IACR,GACCV,IAAI,CAAC;QAAEO,MAAM;IAAO,GAAG,IAAM,MAC7BP,IAAI,CAAC;QAAEO,MAAM;IAAU,GAAG,CAACC,UAAY,OACvCR,IAAI,CAAC;QAAEO,MAAM;IAAQ,GAAG,CAACC,UAAY,EAAE,EACvCW,SAAS,CAAC;QACV,OAAOrB;IACR;AACF"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
function _type_of(obj) {
|
|
2
|
-
"@swc/helpers - typeof";
|
|
3
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
4
|
-
}
|
|
5
1
|
import { firstOfMaybeArray } from "@wener/utils";
|
|
6
2
|
import { toJsonSchema } from "./toJsonSchema.js";
|
|
7
3
|
export function findJsonSchemaByPath(schema, objectPath) {
|
|
@@ -9,41 +5,22 @@ export function findJsonSchemaByPath(schema, objectPath) {
|
|
|
9
5
|
if (!objectPath || !schema) {
|
|
10
6
|
return undefined;
|
|
11
7
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (currentSchema && (typeof currentSchema === "undefined" ? "undefined" : _type_of(currentSchema)) === "object" && currentSchema.properties && currentSchema.properties[segment]) {
|
|
20
|
-
currentSchema = currentSchema.properties[segment];
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if (/^\d$/.test(segment) || segment === "[]") {
|
|
24
|
-
if (currentSchema.items) {
|
|
25
|
-
currentSchema = firstOfMaybeArray(currentSchema.items);
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
_didIteratorError = true;
|
|
34
|
-
_iteratorError = err;
|
|
35
|
-
}
|
|
36
|
-
finally {
|
|
37
|
-
try {
|
|
38
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
39
|
-
_iterator.return();
|
|
40
|
-
}
|
|
8
|
+
const segments = objectPath.split(".");
|
|
9
|
+
let currentSchema = schema;
|
|
10
|
+
for (const segment of segments) {
|
|
11
|
+
// 检查当前 schema 是否是对象类型且有 properties
|
|
12
|
+
if (currentSchema && typeof currentSchema === "object" && currentSchema.properties && currentSchema.properties[segment]) {
|
|
13
|
+
currentSchema = currentSchema.properties[segment];
|
|
14
|
+
continue;
|
|
41
15
|
}
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
|
|
16
|
+
if (/^\d$/.test(segment) || segment === "[]") {
|
|
17
|
+
if (currentSchema.items) {
|
|
18
|
+
currentSchema = firstOfMaybeArray(currentSchema.items);
|
|
19
|
+
continue;
|
|
45
20
|
}
|
|
46
21
|
}
|
|
22
|
+
return undefined;
|
|
47
23
|
}
|
|
48
24
|
return currentSchema;
|
|
49
25
|
}
|
|
26
|
+
//# sourceMappingURL=findJsonSchemaByPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/findJsonSchemaByPath.ts"],"sourcesContent":["import { firstOfMaybeArray } from '@wener/utils';\nimport { toJsonSchema } from './toJsonSchema';\nimport type { TypeSchema } from './TypeSchema';\n\nexport function findJsonSchemaByPath(schema: TypeSchema, objectPath: string) {\n\tschema = toJsonSchema(schema);\n\tif (!objectPath || !schema) {\n\t\treturn undefined;\n\t}\n\n\tconst segments = objectPath.split('.');\n\tlet currentSchema = schema;\n\n\tfor (const segment of segments) {\n\t\t// 检查当前 schema 是否是对象类型且有 properties\n\t\tif (\n\t\t\tcurrentSchema &&\n\t\t\ttypeof currentSchema === 'object' &&\n\t\t\tcurrentSchema.properties &&\n\t\t\tcurrentSchema.properties[segment]\n\t\t) {\n\t\t\tcurrentSchema = currentSchema.properties[segment];\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (/^\\d$/.test(segment) || segment === '[]') {\n\t\t\tif (currentSchema.items) {\n\t\t\t\tcurrentSchema = firstOfMaybeArray(currentSchema.items);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\treturn currentSchema;\n}\n"],"names":["firstOfMaybeArray","toJsonSchema","findJsonSchemaByPath","schema","objectPath","undefined","segments","split","currentSchema","segment","properties","test","items"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,eAAe;AACjD,SAASC,YAAY,QAAQ,iBAAiB;AAG9C,OAAO,SAASC,qBAAqBC,MAAkB,EAAEC,UAAkB;IAC1ED,SAASF,aAAaE;IACtB,IAAI,CAACC,cAAc,CAACD,QAAQ;QAC3B,OAAOE;IACR;IAEA,MAAMC,WAAWF,WAAWG,KAAK,CAAC;IAClC,IAAIC,gBAAgBL;IAEpB,KAAK,MAAMM,WAAWH,SAAU;QAC/B,mCAAmC;QACnC,IACCE,iBACA,OAAOA,kBAAkB,YACzBA,cAAcE,UAAU,IACxBF,cAAcE,UAAU,CAACD,QAAQ,EAChC;YACDD,gBAAgBA,cAAcE,UAAU,CAACD,QAAQ;YACjD;QACD;QAEA,IAAI,OAAOE,IAAI,CAACF,YAAYA,YAAY,MAAM;YAC7C,IAAID,cAAcI,KAAK,EAAE;gBACxBJ,gBAAgBR,kBAAkBQ,cAAcI,KAAK;gBACrD;YACD;QACD;QAEA,OAAOP;IACR;IAEA,OAAOG;AACR"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { findJsonSchemaByPath } from "./findJsonSchemaByPath.js";
|
|
2
|
+
export function formatZodError(error, schema) {
|
|
3
|
+
if (!error.issues || error.issues.length === 0) {
|
|
4
|
+
return error.message || "\u9A8C\u8BC1\u5931\u8D25";
|
|
5
|
+
}
|
|
6
|
+
const messages = [];
|
|
7
|
+
// Iterate through issues and format each one
|
|
8
|
+
// We use manual iteration instead of error.format() to have better control
|
|
9
|
+
// over field name formatting with schema descriptions
|
|
10
|
+
for (const issue of error.issues) {
|
|
11
|
+
const formatted = formatIssueMessage(issue, schema);
|
|
12
|
+
if (formatted) {
|
|
13
|
+
const path = issue.path.map((p) => typeof p === "symbol" ? String(p) : p);
|
|
14
|
+
let fieldName = formatPath(path);
|
|
15
|
+
// Try to get field description from schema
|
|
16
|
+
if (schema && path.length > 0) {
|
|
17
|
+
const fieldPath = path.map(String).join(".");
|
|
18
|
+
const fieldSchema = findJsonSchemaByPath(schema, fieldPath);
|
|
19
|
+
if (fieldSchema?.description) {
|
|
20
|
+
fieldName = fieldSchema.description;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
messages.push(`${fieldName}: ${formatted}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return messages.join("\uFF1B");
|
|
27
|
+
}
|
|
28
|
+
function formatIssueMessage(issue, _schema) {
|
|
29
|
+
let message = issue.message;
|
|
30
|
+
// 处理常见的错误类型,生成更友好的消息
|
|
31
|
+
switch (issue.code) {
|
|
32
|
+
case "invalid_type":
|
|
33
|
+
{
|
|
34
|
+
const i = issue;
|
|
35
|
+
// Zod v4 doesn't have 'received' field directly, extract from message
|
|
36
|
+
const match = issue.message.match(/received (\w+)/);
|
|
37
|
+
const received = match?.[1];
|
|
38
|
+
if (received === "undefined") {
|
|
39
|
+
message = "\u5FC5\u586B";
|
|
40
|
+
}
|
|
41
|
+
else if (received === "null") {
|
|
42
|
+
message = "\u4E0D\u80FD\u4E3A\u7A7A";
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
message = issue.message || `期望类型 ${i.expected},但收到 ${received}`;
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case "invalid_format":
|
|
50
|
+
{
|
|
51
|
+
const i = issue;
|
|
52
|
+
if (i.format === "email") {
|
|
53
|
+
message = "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1\u5730\u5740";
|
|
54
|
+
}
|
|
55
|
+
else if (i.format === "url") {
|
|
56
|
+
message = "\u8BF7\u8F93\u5165\u6709\u6548\u7684 URL";
|
|
57
|
+
}
|
|
58
|
+
else if (i.format === "uuid") {
|
|
59
|
+
message = "\u8BF7\u8F93\u5165\u6709\u6548\u7684 UUID";
|
|
60
|
+
}
|
|
61
|
+
else if (i.format === "date") {
|
|
62
|
+
message = "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u65E5\u671F";
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case "too_small":
|
|
67
|
+
{
|
|
68
|
+
const i = issue;
|
|
69
|
+
if (i.origin === "string" && i.minimum === 1) {
|
|
70
|
+
message = "\u4E0D\u80FD\u4E3A\u7A7A";
|
|
71
|
+
}
|
|
72
|
+
else if (i.origin === "string") {
|
|
73
|
+
message = `至少需要 ${i.minimum} 个字符`;
|
|
74
|
+
}
|
|
75
|
+
else if (i.origin === "number" || i.origin === "int") {
|
|
76
|
+
message = `至少需要 ${i.minimum}`;
|
|
77
|
+
}
|
|
78
|
+
else if (i.origin === "array") {
|
|
79
|
+
message = `至少需要 ${i.minimum} 项`;
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case "too_big":
|
|
84
|
+
{
|
|
85
|
+
const i = issue;
|
|
86
|
+
if (i.origin === "string") {
|
|
87
|
+
message = `最多 ${i.maximum} 个字符`;
|
|
88
|
+
}
|
|
89
|
+
else if (i.origin === "number" || i.origin === "int") {
|
|
90
|
+
message = `最多 ${i.maximum}`;
|
|
91
|
+
}
|
|
92
|
+
else if (i.origin === "array") {
|
|
93
|
+
message = `最多 ${i.maximum} 项`;
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case "invalid_value":
|
|
98
|
+
{
|
|
99
|
+
const i = issue;
|
|
100
|
+
if (i.values.length === 1) {
|
|
101
|
+
// Single value means it's a literal check
|
|
102
|
+
message = `必须是 ${String(i.values[0])}`;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
message = `必须是以下值之一: ${i.values.map(String).join(", ")}`;
|
|
106
|
+
}
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
case "unrecognized_keys":
|
|
110
|
+
{
|
|
111
|
+
const i = issue;
|
|
112
|
+
message = `不支持的字段: ${i.keys.join(", ")}`;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
case "invalid_union":
|
|
116
|
+
{
|
|
117
|
+
message = "\u4E0D\u7B26\u5408\u4EFB\u4F55\u5141\u8BB8\u7684\u7C7B\u578B";
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
case "custom":
|
|
121
|
+
{
|
|
122
|
+
// 保留自定义错误消息
|
|
123
|
+
message = issue.message;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
default:
|
|
127
|
+
// 保留原始消息
|
|
128
|
+
message = issue.message;
|
|
129
|
+
}
|
|
130
|
+
return message;
|
|
131
|
+
}
|
|
132
|
+
function formatPath(path) {
|
|
133
|
+
if (path.length === 0) {
|
|
134
|
+
return "\u8868\u5355";
|
|
135
|
+
}
|
|
136
|
+
return path.map(String).join(".");
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=formatZodError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/formatZodError.ts"],"sourcesContent":["import type { core, ZodError } from 'zod/v4';\nimport { findJsonSchemaByPath } from './findJsonSchemaByPath';\nimport type { TypeSchema } from './TypeSchema';\n\n// Zod 4 issue types with proper typing\ntype ZodIssue = core.$ZodIssue;\ntype ZodIssueInvalidType = core.$ZodIssueInvalidType;\ntype ZodIssueTooSmall = core.$ZodIssueTooSmall;\ntype ZodIssueTooBig = core.$ZodIssueTooBig;\ntype ZodIssueInvalidStringFormat = core.$ZodIssueInvalidStringFormat;\ntype ZodIssueInvalidValue = core.$ZodIssueInvalidValue;\ntype ZodIssueUnrecognizedKeys = core.$ZodIssueUnrecognizedKeys;\n\nexport function formatZodError(error: ZodError, schema?: TypeSchema): string {\n\tif (!error.issues || error.issues.length === 0) {\n\t\treturn error.message || '验证失败';\n\t}\n\n\tconst messages: string[] = [];\n\n\t// Iterate through issues and format each one\n\t// We use manual iteration instead of error.format() to have better control\n\t// over field name formatting with schema descriptions\n\tfor (const issue of error.issues) {\n\t\tconst formatted = formatIssueMessage(issue, schema);\n\t\tif (formatted) {\n\t\t\tconst path = issue.path.map((p) => (typeof p === 'symbol' ? String(p) : p)) as (string | number)[];\n\t\t\tlet fieldName = formatPath(path);\n\n\t\t\t// Try to get field description from schema\n\t\t\tif (schema && path.length > 0) {\n\t\t\t\tconst fieldPath = path.map(String).join('.');\n\t\t\t\tconst fieldSchema = findJsonSchemaByPath(schema, fieldPath);\n\t\t\t\tif (fieldSchema?.description) {\n\t\t\t\t\tfieldName = fieldSchema.description;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tmessages.push(`${fieldName}: ${formatted}`);\n\t\t}\n\t}\n\n\treturn messages.join(';');\n}\n\nfunction formatIssueMessage(issue: ZodIssue, _schema?: TypeSchema): string {\n\tlet message = issue.message;\n\n\t// 处理常见的错误类型,生成更友好的消息\n\tswitch (issue.code) {\n\t\tcase 'invalid_type': {\n\t\t\tconst i = issue as ZodIssueInvalidType;\n\t\t\t// Zod v4 doesn't have 'received' field directly, extract from message\n\t\t\tconst match = issue.message.match(/received (\\w+)/);\n\t\t\tconst received = match?.[1];\n\t\t\tif (received === 'undefined') {\n\t\t\t\tmessage = '必填';\n\t\t\t} else if (received === 'null') {\n\t\t\t\tmessage = '不能为空';\n\t\t\t} else {\n\t\t\t\tmessage = issue.message || `期望类型 ${i.expected},但收到 ${received}`;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'invalid_format': {\n\t\t\tconst i = issue as ZodIssueInvalidStringFormat;\n\t\t\tif (i.format === 'email') {\n\t\t\t\tmessage = '请输入有效的邮箱地址';\n\t\t\t} else if (i.format === 'url') {\n\t\t\t\tmessage = '请输入有效的 URL';\n\t\t\t} else if (i.format === 'uuid') {\n\t\t\t\tmessage = '请输入有效的 UUID';\n\t\t\t} else if (i.format === 'date') {\n\t\t\t\tmessage = '请输入有效的日期';\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'too_small': {\n\t\t\tconst i = issue as ZodIssueTooSmall;\n\t\t\tif (i.origin === 'string' && i.minimum === 1) {\n\t\t\t\tmessage = '不能为空';\n\t\t\t} else if (i.origin === 'string') {\n\t\t\t\tmessage = `至少需要 ${i.minimum} 个字符`;\n\t\t\t} else if (i.origin === 'number' || i.origin === 'int') {\n\t\t\t\tmessage = `至少需要 ${i.minimum}`;\n\t\t\t} else if (i.origin === 'array') {\n\t\t\t\tmessage = `至少需要 ${i.minimum} 项`;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'too_big': {\n\t\t\tconst i = issue as ZodIssueTooBig;\n\t\t\tif (i.origin === 'string') {\n\t\t\t\tmessage = `最多 ${i.maximum} 个字符`;\n\t\t\t} else if (i.origin === 'number' || i.origin === 'int') {\n\t\t\t\tmessage = `最多 ${i.maximum}`;\n\t\t\t} else if (i.origin === 'array') {\n\t\t\t\tmessage = `最多 ${i.maximum} 项`;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'invalid_value': {\n\t\t\tconst i = issue as ZodIssueInvalidValue;\n\t\t\tif (i.values.length === 1) {\n\t\t\t\t// Single value means it's a literal check\n\t\t\t\tmessage = `必须是 ${String(i.values[0])}`;\n\t\t\t} else {\n\t\t\t\tmessage = `必须是以下值之一: ${i.values.map(String).join(', ')}`;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'unrecognized_keys': {\n\t\t\tconst i = issue as ZodIssueUnrecognizedKeys;\n\t\t\tmessage = `不支持的字段: ${i.keys.join(', ')}`;\n\t\t\tbreak;\n\t\t}\n\t\tcase 'invalid_union': {\n\t\t\tmessage = '不符合任何允许的类型';\n\t\t\tbreak;\n\t\t}\n\t\tcase 'custom': {\n\t\t\t// 保留自定义错误消息\n\t\t\tmessage = issue.message;\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\t// 保留原始消息\n\t\t\tmessage = issue.message;\n\t}\n\n\treturn message;\n}\n\nfunction formatPath(path: (string | number)[]): string {\n\tif (path.length === 0) {\n\t\treturn '表单';\n\t}\n\treturn path.map(String).join('.');\n}\n"],"names":["findJsonSchemaByPath","formatZodError","error","schema","issues","length","message","messages","issue","formatted","formatIssueMessage","path","map","p","String","fieldName","formatPath","fieldPath","join","fieldSchema","description","push","_schema","code","i","match","received","expected","format","origin","minimum","maximum","values","keys"],"mappings":"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"}
|