schema-dsl 1.2.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -210
- package/README.md +391 -2249
- package/dist/DslBuilder-DQDN0ZxZ.d.cts +341 -0
- package/dist/DslBuilder-DkLaOo9Q.d.ts +341 -0
- package/dist/Validator-C7GsVQOH.d.cts +192 -0
- package/dist/Validator-hFWKGxir.d.ts +192 -0
- package/dist/index.cjs +6594 -0
- package/dist/index.d.cts +1145 -0
- package/dist/index.d.ts +1145 -0
- package/dist/index.js +6528 -0
- package/dist/plugin-CIKtTMtS.d.cts +246 -0
- package/dist/plugin-CIKtTMtS.d.ts +246 -0
- package/dist/plugins/custom-format.cjs +3802 -0
- package/dist/plugins/custom-format.d.cts +12 -0
- package/dist/plugins/custom-format.d.ts +12 -0
- package/dist/plugins/custom-format.js +3772 -0
- package/dist/plugins/custom-type-example.cjs +3795 -0
- package/dist/plugins/custom-type-example.d.cts +8 -0
- package/dist/plugins/custom-type-example.d.ts +8 -0
- package/dist/plugins/custom-type-example.js +3765 -0
- package/dist/plugins/custom-validator.cjs +146 -0
- package/dist/plugins/custom-validator.d.cts +10 -0
- package/dist/plugins/custom-validator.d.ts +10 -0
- package/dist/plugins/custom-validator.js +121 -0
- package/docs/FEATURE-INDEX.md +102 -68
- package/docs/add-custom-locale.md +48 -35
- package/docs/add-keyword.md +24 -0
- package/docs/api-reference.md +396 -154
- package/docs/api.md +13 -0
- package/docs/best-practices-project-structure.md +19 -10
- package/docs/best-practices.md +93 -53
- package/docs/cache-manager.md +23 -15
- package/docs/compile.md +45 -0
- package/docs/conditional-api.md +40 -11
- package/docs/custom-extensions-guide.md +80 -152
- package/docs/design-philosophy.md +76 -71
- package/docs/doc-index.md +324 -0
- package/docs/dsl-syntax.md +69 -19
- package/docs/dynamic-locale.md +24 -14
- package/docs/enum.md +12 -5
- package/docs/error-handling.md +53 -44
- package/docs/export-guide.md +47 -8
- package/docs/export-limitations.md +27 -11
- package/docs/faq.md +86 -67
- package/docs/frontend-i18n-guide.md +26 -12
- package/docs/i18n-user-guide.md +60 -47
- package/docs/i18n.md +51 -32
- package/docs/index.md +48 -0
- package/docs/json-schema-basics.md +40 -0
- package/docs/label-vs-description.md +12 -3
- package/docs/markdown-exporter.md +15 -6
- package/docs/mongodb-exporter.md +11 -4
- package/docs/multi-language.md +26 -0
- package/docs/multi-type-support.md +26 -33
- package/docs/mysql-exporter.md +9 -2
- package/docs/number-operators.md +12 -5
- package/docs/optional-marker-guide.md +28 -23
- package/docs/performance-guide.md +49 -0
- package/docs/plugin-system.md +205 -366
- package/docs/plugin-type-registration.md +34 -0
- package/docs/postgresql-exporter.md +9 -2
- package/docs/public/favicon.svg +5 -0
- package/docs/quick-start.md +37 -363
- package/docs/runtime-locale-support.md +20 -9
- package/docs/schema-helper.md +10 -5
- package/docs/schema-utils-advanced-issues.md +23 -0
- package/docs/schema-utils-best-practices.md +20 -0
- package/docs/schema-utils-chaining.md +7 -0
- package/docs/schema-utils.md +76 -42
- package/docs/security-checklist.md +20 -0
- package/docs/string-extensions.md +17 -9
- package/docs/troubleshooting.md +36 -21
- package/docs/type-converter.md +41 -50
- package/docs/type-reference.md +38 -15
- package/docs/typescript-guide.md +53 -42
- package/docs/union-type-guide.md +11 -1
- package/docs/union-types.md +10 -3
- package/docs/validate-async.md +36 -25
- package/docs/validate-batch.md +49 -0
- package/docs/validate-dsl-object-support.md +33 -28
- package/docs/validate.md +36 -16
- package/docs/validation-guide.md +25 -7
- package/docs/validator.md +39 -0
- package/package.json +85 -27
- package/plugins/custom-format.cjs +8 -0
- package/plugins/custom-type-example.cjs +8 -0
- package/plugins/custom-validator.cjs +8 -0
- package/src/adapters/DslAdapter.ts +111 -0
- package/src/adapters/index.ts +1 -0
- package/src/config/constants.ts +83 -0
- package/src/config/index.ts +2 -0
- package/src/config/patterns.ts +77 -0
- package/src/core/CacheManager.ts +159 -0
- package/src/core/ConditionalBuilder.ts +382 -0
- package/src/core/ConditionalRuntime.ts +28 -0
- package/src/core/ConditionalValidator.ts +255 -0
- package/src/core/DslBuilder.ts +677 -0
- package/src/core/ErrorCodes.ts +38 -0
- package/src/core/ErrorFormatter.ts +271 -0
- package/src/core/JSONSchemaCore.ts +65 -0
- package/src/core/Locale.ts +187 -0
- package/src/core/MessageTemplate.ts +42 -0
- package/src/core/ObjectDslBuilder.ts +64 -0
- package/src/core/PluginManager.ts +326 -0
- package/src/core/StringExtensions.ts +140 -0
- package/src/core/TemplateEngine.ts +44 -0
- package/src/core/Validator.ts +448 -0
- package/src/errors/I18nError.ts +159 -0
- package/src/errors/ValidationError.ts +105 -0
- package/src/exporters/BaseExporter.ts +60 -0
- package/src/exporters/MarkdownExporter.ts +305 -0
- package/src/exporters/MongoDBExporter.ts +126 -0
- package/src/exporters/MySQLExporter.ts +155 -0
- package/src/exporters/PostgreSQLExporter.ts +222 -0
- package/src/exporters/index.ts +18 -0
- package/src/index.ts +633 -0
- package/{lib/locales/en-US.js → src/locales/en-US.ts} +21 -37
- package/{lib/locales/es-ES.js → src/locales/es-ES.ts} +63 -16
- package/{lib/locales/fr-FR.js → src/locales/fr-FR.ts} +74 -27
- package/src/locales/index.ts +103 -0
- package/{lib/locales/ja-JP.js → src/locales/ja-JP.ts} +59 -17
- package/src/locales/types.ts +156 -0
- package/{lib/locales/zh-CN.js → src/locales/zh-CN.ts} +21 -38
- package/src/parser/ConstraintParser.ts +101 -0
- package/src/parser/DslParser.ts +470 -0
- package/src/parser/SchemaCompiler.ts +66 -0
- package/src/parser/TypeRegistry.ts +250 -0
- package/src/parser/index.ts +6 -0
- package/src/plugins/custom-format.ts +126 -0
- package/src/plugins/custom-type-example.ts +108 -0
- package/src/plugins/custom-validator.ts +140 -0
- package/src/types/conditional.ts +28 -0
- package/src/types/config.ts +59 -0
- package/src/types/dsl.ts +131 -0
- package/src/types/error.ts +60 -0
- package/src/types/index.ts +17 -0
- package/src/types/infer.ts +128 -0
- package/src/types/plugin.ts +58 -0
- package/src/types/safe-regex.d.ts +9 -0
- package/src/types/schema.ts +66 -0
- package/src/types/validate.ts +71 -0
- package/src/utils/SchemaHelper.ts +196 -0
- package/src/utils/SchemaUtils.ts +346 -0
- package/src/utils/TypeConverter.ts +215 -0
- package/src/utils/index.ts +10 -0
- package/src/validators/CustomKeywords.ts +477 -0
- package/.eslintignore +0 -11
- package/.eslintrc.json +0 -27
- package/CONTRIBUTING.md +0 -368
- package/STATUS.md +0 -491
- package/changelogs/v1.0.0.md +0 -328
- package/changelogs/v1.0.9.md +0 -367
- package/changelogs/v1.1.0.md +0 -389
- package/changelogs/v1.1.1.md +0 -308
- package/changelogs/v1.1.2.md +0 -183
- package/changelogs/v1.1.3.md +0 -161
- package/changelogs/v1.1.4.md +0 -432
- package/changelogs/v1.1.5.md +0 -493
- package/changelogs/v1.1.6.md +0 -211
- package/changelogs/v1.1.8.md +0 -376
- package/changelogs/v1.2.3.md +0 -124
- package/docs/INDEX.md +0 -252
- package/docs/issues-resolved-summary.md +0 -196
- package/docs/performance-benchmark-report.md +0 -179
- package/docs/performance-quick-reference.md +0 -123
- package/docs/user-questions-answered.md +0 -353
- package/docs/validation-rules-v1.0.2.md +0 -1608
- package/examples/README.md +0 -81
- package/examples/array-dsl-example.js +0 -227
- package/examples/conditional-example.js +0 -288
- package/examples/conditional-non-object.js +0 -129
- package/examples/conditional-validate-example.js +0 -321
- package/examples/custom-extension.js +0 -85
- package/examples/dsl-match-example.js +0 -74
- package/examples/dsl-style.js +0 -118
- package/examples/dynamic-locale-configuration.js +0 -348
- package/examples/dynamic-locale-example.js +0 -287
- package/examples/enum.examples.js +0 -324
- package/examples/export-demo.js +0 -130
- package/examples/express-integration.js +0 -376
- package/examples/i18n-error-handling-complete.js +0 -381
- package/examples/i18n-error-handling-quickstart.md +0 -0
- package/examples/i18n-error.examples.js +0 -181
- package/examples/i18n-full-demo.js +0 -301
- package/examples/i18n-memory-safety.examples.js +0 -268
- package/examples/markdown-export.js +0 -71
- package/examples/middleware-usage.js +0 -93
- package/examples/new-features-comparison.js +0 -315
- package/examples/password-reset/README.md +0 -153
- package/examples/password-reset/schema.js +0 -26
- package/examples/password-reset/test.js +0 -101
- package/examples/plugin-system.examples.js +0 -205
- package/examples/schema-utils-chaining.examples.js +0 -250
- package/examples/simple-example.js +0 -122
- package/examples/slug.examples.js +0 -179
- package/examples/string-extensions.js +0 -297
- package/examples/union-type-example.js +0 -127
- package/examples/union-types-example.js +0 -77
- package/examples/user-registration/README.md +0 -156
- package/examples/user-registration/routes.js +0 -92
- package/examples/user-registration/schema.js +0 -150
- package/examples/user-registration/server.js +0 -74
- package/index.d.ts +0 -3540
- package/index.js +0 -457
- package/index.mjs +0 -60
- package/lib/adapters/DslAdapter.js +0 -871
- package/lib/adapters/index.js +0 -20
- package/lib/config/constants.js +0 -286
- package/lib/config/patterns/common.js +0 -47
- package/lib/config/patterns/creditCard.js +0 -9
- package/lib/config/patterns/idCard.js +0 -9
- package/lib/config/patterns/index.js +0 -9
- package/lib/config/patterns/licensePlate.js +0 -4
- package/lib/config/patterns/passport.js +0 -4
- package/lib/config/patterns/phone.js +0 -9
- package/lib/config/patterns/postalCode.js +0 -5
- package/lib/core/CacheManager.js +0 -376
- package/lib/core/ConditionalBuilder.js +0 -503
- package/lib/core/DslBuilder.js +0 -1400
- package/lib/core/ErrorCodes.js +0 -233
- package/lib/core/ErrorFormatter.js +0 -445
- package/lib/core/JSONSchemaCore.js +0 -347
- package/lib/core/Locale.js +0 -130
- package/lib/core/MessageTemplate.js +0 -98
- package/lib/core/PluginManager.js +0 -448
- package/lib/core/StringExtensions.js +0 -240
- package/lib/core/Validator.js +0 -654
- package/lib/errors/I18nError.js +0 -328
- package/lib/errors/ValidationError.js +0 -191
- package/lib/exporters/MarkdownExporter.js +0 -420
- package/lib/exporters/MongoDBExporter.js +0 -162
- package/lib/exporters/MySQLExporter.js +0 -212
- package/lib/exporters/PostgreSQLExporter.js +0 -289
- package/lib/exporters/index.js +0 -24
- package/lib/locales/index.js +0 -8
- package/lib/utils/LRUCache.js +0 -174
- package/lib/utils/SchemaHelper.js +0 -240
- package/lib/utils/SchemaUtils.js +0 -445
- package/lib/utils/TypeConverter.js +0 -245
- package/lib/utils/index.js +0 -13
- package/lib/validators/CustomKeywords.js +0 -616
- package/lib/validators/index.js +0 -11
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/plugins/custom-validator.ts
|
|
21
|
+
var custom_validator_exports = {};
|
|
22
|
+
__export(custom_validator_exports, {
|
|
23
|
+
customValidatorPlugin: () => customValidatorPlugin,
|
|
24
|
+
default: () => custom_validator_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(custom_validator_exports);
|
|
27
|
+
function getValidator(core) {
|
|
28
|
+
const coreRecord = core;
|
|
29
|
+
const validator = coreRecord.getDefaultValidator?.();
|
|
30
|
+
if (!validator) {
|
|
31
|
+
throw new Error("getDefaultValidator() is not available. Please provide schema-dsl core object.");
|
|
32
|
+
}
|
|
33
|
+
return validator;
|
|
34
|
+
}
|
|
35
|
+
function getPluginBucket() {
|
|
36
|
+
const globalRecord = globalThis;
|
|
37
|
+
if (!globalRecord.__schemaDsl_plugins) {
|
|
38
|
+
globalRecord.__schemaDsl_plugins = {};
|
|
39
|
+
}
|
|
40
|
+
return globalRecord.__schemaDsl_plugins;
|
|
41
|
+
}
|
|
42
|
+
var customValidatorPlugin = {
|
|
43
|
+
name: "custom-validator",
|
|
44
|
+
version: "1.0.0",
|
|
45
|
+
description: "Custom validator plugin \u2014 adds business-specific validation rules",
|
|
46
|
+
install(core, _options = {}, _context) {
|
|
47
|
+
const validator = getValidator(core);
|
|
48
|
+
this.addCustomKeywords(validator);
|
|
49
|
+
getPluginBucket()["custom-validator"] = this;
|
|
50
|
+
console.log("[Plugin] custom-validator installed");
|
|
51
|
+
},
|
|
52
|
+
uninstall() {
|
|
53
|
+
delete getPluginBucket()["custom-validator"];
|
|
54
|
+
console.log("[Plugin] custom-validator uninstalled");
|
|
55
|
+
},
|
|
56
|
+
addCustomKeywords(validator) {
|
|
57
|
+
const ajv = validator.getAjv();
|
|
58
|
+
if (!ajv.getKeyword?.("unique")) {
|
|
59
|
+
validator.addKeyword("unique", {
|
|
60
|
+
async: true,
|
|
61
|
+
type: "string",
|
|
62
|
+
validate: async function validateUnique(schema) {
|
|
63
|
+
if (!schema) return true;
|
|
64
|
+
const { table, field } = schema;
|
|
65
|
+
const exists = false;
|
|
66
|
+
if (exists) {
|
|
67
|
+
;
|
|
68
|
+
validateUnique.errors = [{
|
|
69
|
+
keyword: "unique",
|
|
70
|
+
message: `${field} already exists in ${table}`,
|
|
71
|
+
params: { table, field }
|
|
72
|
+
}];
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (!ajv.getKeyword?.("passwordStrength")) {
|
|
80
|
+
validator.addKeyword("passwordStrength", {
|
|
81
|
+
type: "string",
|
|
82
|
+
validate: function validatePasswordStrength(schema, data) {
|
|
83
|
+
if (!schema) return true;
|
|
84
|
+
const strength = String(schema);
|
|
85
|
+
const value = String(data ?? "");
|
|
86
|
+
const rules = {
|
|
87
|
+
weak: /^.{6,}$/,
|
|
88
|
+
medium: /^(?=.*[a-z])(?=.*[A-Z]).{8,}$/,
|
|
89
|
+
strong: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{10,}$/
|
|
90
|
+
};
|
|
91
|
+
const pattern = rules[strength];
|
|
92
|
+
if (!pattern) return true;
|
|
93
|
+
if (!pattern.test(value)) {
|
|
94
|
+
;
|
|
95
|
+
validatePasswordStrength.errors = [{
|
|
96
|
+
keyword: "passwordStrength",
|
|
97
|
+
message: `Password does not meet ${strength} strength requirements`,
|
|
98
|
+
params: { strength }
|
|
99
|
+
}];
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (!ajv.getKeyword?.("idCard")) {
|
|
107
|
+
validator.addKeyword("idCard", {
|
|
108
|
+
type: "string",
|
|
109
|
+
validate: (schema, data) => {
|
|
110
|
+
if (!schema) return true;
|
|
111
|
+
const value = String(data ?? "");
|
|
112
|
+
const pattern = /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/;
|
|
113
|
+
if (!pattern.test(value)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return customValidatorPlugin._validateIdCardChecksum(value);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
_validateIdCardChecksum(idCard) {
|
|
122
|
+
const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
|
|
123
|
+
const checksums = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
|
|
124
|
+
let sum = 0;
|
|
125
|
+
for (let i = 0; i < 17; i += 1) {
|
|
126
|
+
sum += Number.parseInt(idCard[i], 10) * weights[i];
|
|
127
|
+
}
|
|
128
|
+
const checksum = checksums[sum % 11];
|
|
129
|
+
return idCard[17].toUpperCase() === checksum;
|
|
130
|
+
},
|
|
131
|
+
hooks: {
|
|
132
|
+
onBeforeValidate() {
|
|
133
|
+
},
|
|
134
|
+
onAfterValidate() {
|
|
135
|
+
},
|
|
136
|
+
onError(error) {
|
|
137
|
+
console.error("[custom-validator] Error:", error.message);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
var custom_validator_default = customValidatorPlugin;
|
|
142
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
143
|
+
0 && (module.exports = {
|
|
144
|
+
customValidatorPlugin
|
|
145
|
+
});
|
|
146
|
+
//# sourceMappingURL=custom-validator.cjs.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { P as Plugin } from '../plugin-CIKtTMtS.cjs';
|
|
2
|
+
import { V as Validator } from '../Validator-C7GsVQOH.cjs';
|
|
3
|
+
import 'ajv';
|
|
4
|
+
|
|
5
|
+
declare const customValidatorPlugin: Plugin & {
|
|
6
|
+
addCustomKeywords: (validator: Validator) => void;
|
|
7
|
+
_validateIdCardChecksum: (idCard: string) => boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { customValidatorPlugin, customValidatorPlugin as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { P as Plugin } from '../plugin-CIKtTMtS.js';
|
|
2
|
+
import { V as Validator } from '../Validator-hFWKGxir.js';
|
|
3
|
+
import 'ajv';
|
|
4
|
+
|
|
5
|
+
declare const customValidatorPlugin: Plugin & {
|
|
6
|
+
addCustomKeywords: (validator: Validator) => void;
|
|
7
|
+
_validateIdCardChecksum: (idCard: string) => boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { customValidatorPlugin, customValidatorPlugin as default };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// src/plugins/custom-validator.ts
|
|
2
|
+
function getValidator(core) {
|
|
3
|
+
const coreRecord = core;
|
|
4
|
+
const validator = coreRecord.getDefaultValidator?.();
|
|
5
|
+
if (!validator) {
|
|
6
|
+
throw new Error("getDefaultValidator() is not available. Please provide schema-dsl core object.");
|
|
7
|
+
}
|
|
8
|
+
return validator;
|
|
9
|
+
}
|
|
10
|
+
function getPluginBucket() {
|
|
11
|
+
const globalRecord = globalThis;
|
|
12
|
+
if (!globalRecord.__schemaDsl_plugins) {
|
|
13
|
+
globalRecord.__schemaDsl_plugins = {};
|
|
14
|
+
}
|
|
15
|
+
return globalRecord.__schemaDsl_plugins;
|
|
16
|
+
}
|
|
17
|
+
var customValidatorPlugin = {
|
|
18
|
+
name: "custom-validator",
|
|
19
|
+
version: "1.0.0",
|
|
20
|
+
description: "Custom validator plugin \u2014 adds business-specific validation rules",
|
|
21
|
+
install(core, _options = {}, _context) {
|
|
22
|
+
const validator = getValidator(core);
|
|
23
|
+
this.addCustomKeywords(validator);
|
|
24
|
+
getPluginBucket()["custom-validator"] = this;
|
|
25
|
+
console.log("[Plugin] custom-validator installed");
|
|
26
|
+
},
|
|
27
|
+
uninstall() {
|
|
28
|
+
delete getPluginBucket()["custom-validator"];
|
|
29
|
+
console.log("[Plugin] custom-validator uninstalled");
|
|
30
|
+
},
|
|
31
|
+
addCustomKeywords(validator) {
|
|
32
|
+
const ajv = validator.getAjv();
|
|
33
|
+
if (!ajv.getKeyword?.("unique")) {
|
|
34
|
+
validator.addKeyword("unique", {
|
|
35
|
+
async: true,
|
|
36
|
+
type: "string",
|
|
37
|
+
validate: async function validateUnique(schema) {
|
|
38
|
+
if (!schema) return true;
|
|
39
|
+
const { table, field } = schema;
|
|
40
|
+
const exists = false;
|
|
41
|
+
if (exists) {
|
|
42
|
+
;
|
|
43
|
+
validateUnique.errors = [{
|
|
44
|
+
keyword: "unique",
|
|
45
|
+
message: `${field} already exists in ${table}`,
|
|
46
|
+
params: { table, field }
|
|
47
|
+
}];
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (!ajv.getKeyword?.("passwordStrength")) {
|
|
55
|
+
validator.addKeyword("passwordStrength", {
|
|
56
|
+
type: "string",
|
|
57
|
+
validate: function validatePasswordStrength(schema, data) {
|
|
58
|
+
if (!schema) return true;
|
|
59
|
+
const strength = String(schema);
|
|
60
|
+
const value = String(data ?? "");
|
|
61
|
+
const rules = {
|
|
62
|
+
weak: /^.{6,}$/,
|
|
63
|
+
medium: /^(?=.*[a-z])(?=.*[A-Z]).{8,}$/,
|
|
64
|
+
strong: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{10,}$/
|
|
65
|
+
};
|
|
66
|
+
const pattern = rules[strength];
|
|
67
|
+
if (!pattern) return true;
|
|
68
|
+
if (!pattern.test(value)) {
|
|
69
|
+
;
|
|
70
|
+
validatePasswordStrength.errors = [{
|
|
71
|
+
keyword: "passwordStrength",
|
|
72
|
+
message: `Password does not meet ${strength} strength requirements`,
|
|
73
|
+
params: { strength }
|
|
74
|
+
}];
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (!ajv.getKeyword?.("idCard")) {
|
|
82
|
+
validator.addKeyword("idCard", {
|
|
83
|
+
type: "string",
|
|
84
|
+
validate: (schema, data) => {
|
|
85
|
+
if (!schema) return true;
|
|
86
|
+
const value = String(data ?? "");
|
|
87
|
+
const pattern = /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/;
|
|
88
|
+
if (!pattern.test(value)) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
return customValidatorPlugin._validateIdCardChecksum(value);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
_validateIdCardChecksum(idCard) {
|
|
97
|
+
const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
|
|
98
|
+
const checksums = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
|
|
99
|
+
let sum = 0;
|
|
100
|
+
for (let i = 0; i < 17; i += 1) {
|
|
101
|
+
sum += Number.parseInt(idCard[i], 10) * weights[i];
|
|
102
|
+
}
|
|
103
|
+
const checksum = checksums[sum % 11];
|
|
104
|
+
return idCard[17].toUpperCase() === checksum;
|
|
105
|
+
},
|
|
106
|
+
hooks: {
|
|
107
|
+
onBeforeValidate() {
|
|
108
|
+
},
|
|
109
|
+
onAfterValidate() {
|
|
110
|
+
},
|
|
111
|
+
onError(error) {
|
|
112
|
+
console.error("[custom-validator] Error:", error.message);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var custom_validator_default = customValidatorPlugin;
|
|
117
|
+
export {
|
|
118
|
+
customValidatorPlugin,
|
|
119
|
+
custom_validator_default as default
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=custom-validator.js.map
|
package/docs/FEATURE-INDEX.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# schema-dsl 功能索引
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
> **更新时间**:
|
|
4
|
+
> **更新时间**: 2026-04-30
|
|
5
5
|
> **用途**: 快速查找所有功能及其文档位置
|
|
6
6
|
|
|
7
7
|
---
|
|
@@ -43,7 +43,7 @@ const schema = dsl({
|
|
|
43
43
|
- 📖 [快速开始](./quick-start.md)
|
|
44
44
|
- 📖 [DSL语法指南](./dsl-syntax.md)
|
|
45
45
|
|
|
46
|
-
**代码位置**: `
|
|
46
|
+
**代码位置**: `src/index.ts` / `src/adapters/DslAdapter.ts`
|
|
47
47
|
|
|
48
48
|
---
|
|
49
49
|
|
|
@@ -59,7 +59,8 @@ const schema = dsl({
|
|
|
59
59
|
- ✅ `custom(fn)` - 自定义验证器
|
|
60
60
|
- ✅ `when(field, opts)` - 条件验证
|
|
61
61
|
- ✅ `default(value)` - 默认值
|
|
62
|
-
- ✅ `toSchema()` - 转为JSON Schema
|
|
62
|
+
- ✅ `toSchema()` - 转为JSON Schema(含内部标记字段)
|
|
63
|
+
- ✅ `toJsonSchema()` - 转为纯净 JSON Schema(自动清理 `_required`/`_customMessages` 等内部标记,适用于 OpenAPI / 外部系统)🆕 v1.2.5
|
|
63
64
|
- ✅ `validate(data)` - 验证数据
|
|
64
65
|
- ✅ `validateNestingDepth(schema, maxDepth)` - 检测嵌套深度(静态方法)
|
|
65
66
|
|
|
@@ -88,7 +89,7 @@ const userSchema = dsl({
|
|
|
88
89
|
- 📖 [API参考 - DslBuilder类](./api-reference.md#dslbuilder-类)
|
|
89
90
|
- 📖 [String扩展文档](./string-extensions.md)
|
|
90
91
|
|
|
91
|
-
**代码位置**: `
|
|
92
|
+
**代码位置**: `src/core/DslBuilder.ts`
|
|
92
93
|
|
|
93
94
|
---
|
|
94
95
|
|
|
@@ -108,10 +109,10 @@ const schema = dsl({
|
|
|
108
109
|
|
|
109
110
|
**文档位置**:
|
|
110
111
|
- 📖 [String扩展完整文档](./string-extensions.md)
|
|
111
|
-
- 📖 [README](
|
|
112
|
+
- 📖 [README](https://github.com/vextjs/schema-dsl/blob/main/README.md)
|
|
112
113
|
|
|
113
114
|
|
|
114
|
-
**代码位置**: `
|
|
115
|
+
**代码位置**: `src/core/StringExtensions.ts`
|
|
115
116
|
|
|
116
117
|
---
|
|
117
118
|
|
|
@@ -124,7 +125,7 @@ const schema = dsl({
|
|
|
124
125
|
**可用方法**:
|
|
125
126
|
- ✅ `validate(schema, data, options)` - 验证数据
|
|
126
127
|
- ✅ `compile(schema, cacheKey)` - 编译Schema
|
|
127
|
-
- ✅ `validateBatch(schema, dataArray
|
|
128
|
+
- ✅ `validateBatch(schema, dataArray)` - 批量验证
|
|
128
129
|
- ✅ `addKeyword(name, definition)` - 添加自定义关键字
|
|
129
130
|
- ✅ `addFormat(name, validator)` - 添加自定义格式
|
|
130
131
|
- ✅ `clearCache()` - 清空缓存
|
|
@@ -147,7 +148,7 @@ console.log(result.errors); // 错误列表
|
|
|
147
148
|
- 📖 [validate方法详解](./validate.md)
|
|
148
149
|
- 📖 [快速开始](./quick-start.md)
|
|
149
150
|
|
|
150
|
-
**代码位置**: `
|
|
151
|
+
**代码位置**: `src/core/Validator.ts`
|
|
151
152
|
|
|
152
153
|
---
|
|
153
154
|
|
|
@@ -167,7 +168,7 @@ const result = validate(schema, { email: 'test@example.com' });
|
|
|
167
168
|
- 📖 [API参考 - validate()函数](./api-reference.md)
|
|
168
169
|
- 📖 [快速开始](./quick-start.md#1-hello-world30秒)
|
|
169
170
|
|
|
170
|
-
**代码位置**: `index.
|
|
171
|
+
**代码位置**: `src/index.ts`(默认单例导出)
|
|
171
172
|
|
|
172
173
|
---
|
|
173
174
|
|
|
@@ -196,10 +197,10 @@ console.log(command);
|
|
|
196
197
|
```
|
|
197
198
|
|
|
198
199
|
**文档位置**:
|
|
199
|
-
- 📖 [
|
|
200
|
-
- 📖 [示例代码](
|
|
200
|
+
- 📖 [数据库导出指南](./export-guide.md)
|
|
201
|
+
- 📖 [示例代码](https://github.com/vextjs/schema-dsl/blob/main/examples/docs/feature-index.ts)
|
|
201
202
|
|
|
202
|
-
**代码位置**: `
|
|
203
|
+
**代码位置**: `src/exporters/MongoDBExporter.ts`
|
|
203
204
|
|
|
204
205
|
---
|
|
205
206
|
|
|
@@ -226,10 +227,10 @@ console.log(ddl);
|
|
|
226
227
|
```
|
|
227
228
|
|
|
228
229
|
**文档位置**:
|
|
229
|
-
- 📖 [
|
|
230
|
-
- 📖 [示例代码](
|
|
230
|
+
- 📖 [数据库导出指南](./export-guide.md)
|
|
231
|
+
- 📖 [示例代码](https://github.com/vextjs/schema-dsl/blob/main/examples/docs/feature-index.ts)
|
|
231
232
|
|
|
232
|
-
**代码位置**: `
|
|
233
|
+
**代码位置**: `src/exporters/MySQLExporter.ts`
|
|
233
234
|
|
|
234
235
|
---
|
|
235
236
|
|
|
@@ -256,10 +257,10 @@ console.log(ddl);
|
|
|
256
257
|
```
|
|
257
258
|
|
|
258
259
|
**文档位置**:
|
|
259
|
-
- 📖 [
|
|
260
|
-
- 📖 [示例代码](
|
|
260
|
+
- 📖 [数据库导出指南](./export-guide.md)
|
|
261
|
+
- 📖 [示例代码](https://github.com/vextjs/schema-dsl/blob/main/examples/docs/feature-index.ts)
|
|
261
262
|
|
|
262
|
-
**代码位置**: `
|
|
263
|
+
**代码位置**: `src/exporters/PostgreSQLExporter.ts`
|
|
263
264
|
|
|
264
265
|
---
|
|
265
266
|
|
|
@@ -272,10 +273,12 @@ console.log(ddl);
|
|
|
272
273
|
**可用方法**:
|
|
273
274
|
- ✅ `reusable(factory)` - 创建可复用片段
|
|
274
275
|
- ✅ `createLibrary(fragments)` - 创建片段库
|
|
275
|
-
- ✅ `merge(...schemas)` - 合并多个Schema
|
|
276
276
|
- ✅ `extend(baseSchema, extensions)` - 扩展Schema
|
|
277
277
|
- ✅ `pick(schema, fields)` - 筛选字段
|
|
278
278
|
- ✅ `omit(schema, fields)` - 排除字段
|
|
279
|
+
- ✅ `partial(schema, fields?)` - 将字段改为可选
|
|
280
|
+
- ✅ `validateBatch(schema, dataArray, ajvInstance)` - 带汇总统计的批量验证
|
|
281
|
+
- ✅ `withPerformance(validator)` - 为 Validator 包装性能信息
|
|
279
282
|
- ✅ `toMarkdown(schema)` - 导出为Markdown
|
|
280
283
|
- ✅ `toHTML(schema)` - 导出为HTML
|
|
281
284
|
- ✅ `clone(schema)` - 深度克隆
|
|
@@ -297,7 +300,7 @@ const extended = SchemaUtils.extend(schema1, { age: 'number' });
|
|
|
297
300
|
**文档位置**:
|
|
298
301
|
- 📖 [API参考 - SchemaUtils](./api-reference.md#工具函数)
|
|
299
302
|
|
|
300
|
-
**代码位置**: `
|
|
303
|
+
**代码位置**: `src/utils/SchemaUtils.ts`
|
|
301
304
|
|
|
302
305
|
---
|
|
303
306
|
|
|
@@ -306,15 +309,17 @@ const extended = SchemaUtils.extend(schema1, { age: 'number' });
|
|
|
306
309
|
**功能**: 类型转换工具(JSON Schema ↔ 数据库类型)
|
|
307
310
|
|
|
308
311
|
**可用方法**:
|
|
309
|
-
- ✅ `
|
|
310
|
-
- ✅ `
|
|
311
|
-
- ✅ `
|
|
312
|
+
- ✅ `toJSONSchemaType(nativeType)` - 转为 JSON Schema `type` 字符串
|
|
313
|
+
- ✅ `toMongoDBType(jsonSchemaType)` - 转为 MongoDB BSON 类型
|
|
314
|
+
- ✅ `toMySQLType(jsonSchemaType, schema?)` - 转为 MySQL 数据类型
|
|
315
|
+
- ✅ `toPostgreSQLType(jsonSchemaType, schema?)` - 转为 PostgreSQL 数据类型
|
|
316
|
+
- ✅ `normalizePropertyName(name)` - 规范化属性名
|
|
312
317
|
- ✅ `formatToRegex(format)` - 格式验证转正则
|
|
313
318
|
|
|
314
319
|
**文档位置**:
|
|
315
|
-
- 📖 [
|
|
320
|
+
- 📖 [TypeConverter 文档](./type-converter.md)
|
|
316
321
|
|
|
317
|
-
**代码位置**: `
|
|
322
|
+
**代码位置**: `src/utils/TypeConverter.ts`
|
|
318
323
|
|
|
319
324
|
---
|
|
320
325
|
|
|
@@ -323,16 +328,22 @@ const extended = SchemaUtils.extend(schema1, { age: 'number' });
|
|
|
323
328
|
**功能**: Schema分析和辅助工具
|
|
324
329
|
|
|
325
330
|
**可用方法**:
|
|
326
|
-
- ✅ `
|
|
331
|
+
- ✅ `isValidSchema(schema)` - 验证 Schema 有效性
|
|
332
|
+
- ✅ `generateSchemaId(schema)` - 生成基于内容的 Schema ID
|
|
327
333
|
- ✅ `getFieldPaths(schema)` - 提取字段路径
|
|
328
|
-
- ✅ `
|
|
329
|
-
- ✅ `
|
|
330
|
-
- ✅ `
|
|
334
|
+
- ✅ `flattenSchema(schema)` - 扁平化 Schema
|
|
335
|
+
- ✅ `cloneSchema(schema)` - 克隆 Schema
|
|
336
|
+
- ✅ `extractRequiredFields(schema)` - 提取 required 字段
|
|
337
|
+
- ✅ `compareSchemas(schema1, schema2)` - 比较 Schema
|
|
338
|
+
- ✅ `simplifySchema(schema)` - 精简 Schema
|
|
339
|
+
- ✅ `isValidPropertyName(name)` - 校验属性名
|
|
340
|
+
- ✅ `getSchemaComplexity(schema)` - 评估复杂度
|
|
341
|
+
- ✅ `summarizeSchema(schema)` - 生成摘要
|
|
331
342
|
|
|
332
343
|
**文档位置**:
|
|
333
|
-
- 📖 [
|
|
344
|
+
- 📖 [SchemaHelper 文档](./schema-helper.md)
|
|
334
345
|
|
|
335
|
-
**代码位置**: `
|
|
346
|
+
**代码位置**: `src/utils/SchemaHelper.ts`
|
|
336
347
|
|
|
337
348
|
---
|
|
338
349
|
|
|
@@ -343,16 +354,15 @@ const extended = SchemaUtils.extend(schema1, { age: 'number' });
|
|
|
343
354
|
**功能**: 格式化验证错误信息
|
|
344
355
|
|
|
345
356
|
**可用方法**:
|
|
346
|
-
- ✅ `
|
|
347
|
-
- ✅ `
|
|
348
|
-
- ✅ `
|
|
349
|
-
- ✅ `toText(errors)` - 转为文本格式
|
|
357
|
+
- ✅ `new ErrorFormatter(locale?, messages?)` - 创建格式化器
|
|
358
|
+
- ✅ `format(error, locale?)` - 格式化单个错误为消息字符串
|
|
359
|
+
- ✅ `formatDetailed(errors, locale?, customMessages?, alreadyMerged?)` - 格式化错误数组为标准错误项
|
|
350
360
|
|
|
351
361
|
**文档位置**:
|
|
352
|
-
- 📖 [API参考 - ErrorFormatter](./api-reference.md)
|
|
362
|
+
- 📖 [API参考 - ErrorFormatter / MessageTemplate / 底层解析工具](./api-reference.md)
|
|
353
363
|
- 📖 [错误处理文档](./error-handling.md)
|
|
354
364
|
|
|
355
|
-
**代码位置**: `
|
|
365
|
+
**代码位置**: `src/core/ErrorFormatter.ts`
|
|
356
366
|
|
|
357
367
|
---
|
|
358
368
|
|
|
@@ -360,7 +370,7 @@ const extended = SchemaUtils.extend(schema1, { age: 'number' });
|
|
|
360
370
|
|
|
361
371
|
**功能**: 错误码定义
|
|
362
372
|
|
|
363
|
-
**代码位置**: `
|
|
373
|
+
**代码位置**: `src/core/ErrorCodes.ts`
|
|
364
374
|
|
|
365
375
|
---
|
|
366
376
|
|
|
@@ -374,9 +384,25 @@ const extended = SchemaUtils.extend(schema1, { age: 'number' });
|
|
|
374
384
|
- ✅ `MessageTemplate.renderBatch(templates, vars)` - 批量渲染(静态方法)
|
|
375
385
|
|
|
376
386
|
**文档位置**:
|
|
377
|
-
- 📖 [API参考 - MessageTemplate](./api-reference.md)
|
|
387
|
+
- 📖 [API参考 - MessageTemplate](./api-reference.md#messagetemplate)
|
|
378
388
|
|
|
379
|
-
**代码位置**: `
|
|
389
|
+
**代码位置**: `src/core/MessageTemplate.ts`
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
### 类型注册与模板工具
|
|
394
|
+
|
|
395
|
+
**功能**: 面向进阶集成的模板渲染、JSON Schema 外观与自定义类型注册能力
|
|
396
|
+
|
|
397
|
+
**可用导出**:
|
|
398
|
+
- ✅ `renderTemplate(template, params)`
|
|
399
|
+
- ✅ `JSONSchemaCore`
|
|
400
|
+
- ✅ `TypeRegistry`
|
|
401
|
+
|
|
402
|
+
**文档位置**:
|
|
403
|
+
- 📖 [API参考 - renderTemplate / JSONSchemaCore / 类型注册与内部解析边界](./api-reference.md)
|
|
404
|
+
|
|
405
|
+
**代码位置**: `src/core/TemplateEngine.ts` / `src/core/JSONSchemaCore.ts` / `src/parser/TypeRegistry.ts`
|
|
380
406
|
|
|
381
407
|
---
|
|
382
408
|
|
|
@@ -396,11 +422,14 @@ const extended = SchemaUtils.extend(schema1, { age: 'number' });
|
|
|
396
422
|
**支持语言**:
|
|
397
423
|
- ✅ en-US(英语)
|
|
398
424
|
- ✅ zh-CN(中文)
|
|
425
|
+
- ✅ ja-JP(日语)
|
|
426
|
+
- ✅ es-ES(西班牙语)
|
|
427
|
+
- ✅ fr-FR(法语)
|
|
399
428
|
|
|
400
429
|
**文档位置**:
|
|
401
430
|
- 📖 [API参考 - Locale](./api-reference.md)
|
|
402
431
|
|
|
403
|
-
**代码位置**: `
|
|
432
|
+
**代码位置**: `src/core/Locale.ts`
|
|
404
433
|
|
|
405
434
|
---
|
|
406
435
|
|
|
@@ -419,9 +448,9 @@ const extended = SchemaUtils.extend(schema1, { age: 'number' });
|
|
|
419
448
|
- ✅ `size()` - 缓存大小
|
|
420
449
|
|
|
421
450
|
**文档位置**:
|
|
422
|
-
- 📖 [
|
|
451
|
+
- 📖 [CacheManager 文档](./cache-manager.md)
|
|
423
452
|
|
|
424
|
-
**代码位置**: `
|
|
453
|
+
**代码位置**: `src/core/CacheManager.ts`
|
|
425
454
|
|
|
426
455
|
---
|
|
427
456
|
|
|
@@ -431,8 +460,7 @@ const extended = SchemaUtils.extend(schema1, { age: 'number' });
|
|
|
431
460
|
|
|
432
461
|
**可用关键字**:
|
|
433
462
|
- ✅ `regex` - 正则验证
|
|
434
|
-
- ✅ `validate` -
|
|
435
|
-
- ✅ `range` - 数值范围
|
|
463
|
+
- ✅ `validate` - 自定义函数验证
|
|
436
464
|
|
|
437
465
|
**使用示例**:
|
|
438
466
|
```javascript
|
|
@@ -448,9 +476,9 @@ const schema = {
|
|
|
448
476
|
```
|
|
449
477
|
|
|
450
478
|
**文档位置**:
|
|
451
|
-
- 📖 [
|
|
479
|
+
- 📖 [错误处理文档](./error-handling.md)
|
|
452
480
|
|
|
453
|
-
**代码位置**: `
|
|
481
|
+
**代码位置**: `src/validators/CustomKeywords.ts`
|
|
454
482
|
|
|
455
483
|
---
|
|
456
484
|
|
|
@@ -459,15 +487,15 @@ const schema = {
|
|
|
459
487
|
### 完整示例目录
|
|
460
488
|
|
|
461
489
|
**基础示例**:
|
|
462
|
-
- 📄 [dsl-
|
|
463
|
-
- 📄 [string-extensions.
|
|
490
|
+
- 📄 [dsl-syntax.ts](https://github.com/vextjs/schema-dsl/blob/main/examples/docs/dsl-syntax.ts) - DSL基础用法
|
|
491
|
+
- 📄 [string-extensions.ts](https://github.com/vextjs/schema-dsl/blob/main/examples/docs/string-extensions.ts) - String扩展示例
|
|
464
492
|
|
|
465
493
|
**场景示例**:
|
|
466
|
-
-
|
|
467
|
-
-
|
|
494
|
+
- 📄 [quick-start.ts](https://github.com/vextjs/schema-dsl/blob/main/examples/docs/quick-start.ts) - 用户注册式的基础表单验证起点
|
|
495
|
+
- 📄 [validation-guide.ts](https://github.com/vextjs/schema-dsl/blob/main/examples/docs/validation-guide.ts) - 失败路径、错误处理与规则组合示例
|
|
468
496
|
|
|
469
497
|
**导出示例**:
|
|
470
|
-
- 📄 [
|
|
498
|
+
- 📄 [feature-index.ts](https://github.com/vextjs/schema-dsl/blob/main/examples/docs/feature-index.ts) - 功能索引代表性示例
|
|
471
499
|
|
|
472
500
|
---
|
|
473
501
|
|
|
@@ -480,40 +508,46 @@ const schema = {
|
|
|
480
508
|
3. ✅ Validator类 - `docs/validate.md`
|
|
481
509
|
4. ✅ API参考 - `docs/api-reference.md`
|
|
482
510
|
5. ✅ 快速开始 - `docs/quick-start.md`
|
|
483
|
-
6. ✅ 数据库导出 - `README.md` + `
|
|
511
|
+
6. ✅ 数据库导出 - `README.md` + `docs/export-guide.md`
|
|
484
512
|
7. ✅ 自定义验证 - `README.md`
|
|
485
|
-
8. ✅ Schema工具 - `
|
|
513
|
+
8. ✅ Schema工具 - `docs/schema-utils.md` + `docs/schema-helper.md`
|
|
486
514
|
|
|
487
515
|
### ⚠️ 文档需要补充
|
|
488
516
|
|
|
489
|
-
1. ⚠️ ErrorFormatter -
|
|
490
|
-
2. ⚠️
|
|
491
|
-
3. ⚠️
|
|
492
|
-
4. ⚠️
|
|
493
|
-
5. ⚠️ 错误处理 -
|
|
517
|
+
1. ⚠️ ErrorFormatter - 当前已在 API 参考与错误处理文档中覆盖;如需更聚焦入口,可后续增补专项文档
|
|
518
|
+
2. ⚠️ PluginManager - 可补一份更聚焦的 API/Hook 速查
|
|
519
|
+
3. ⚠️ 性能与基准测试 - 可继续补充独立诊断手册
|
|
520
|
+
4. ⚠️ 示例运行方式 - 可补充统一的 TypeScript 示例编译说明
|
|
521
|
+
5. ⚠️ 错误处理 - 可继续补充更完整的框架集成案例
|
|
494
522
|
|
|
495
523
|
### 📝 计划补充
|
|
496
524
|
|
|
497
|
-
- [ ]
|
|
498
|
-
- [ ]
|
|
499
|
-
- [ ]
|
|
500
|
-
- [ ]
|
|
525
|
+
- [ ] 增补 `ErrorFormatter` 专项文档
|
|
526
|
+
- [ ] 增补 Plugin Hook 速查文档
|
|
527
|
+
- [ ] 增补 TypeScript 示例统一运行说明
|
|
528
|
+
- [ ] 增补性能调优/基准解读手册
|
|
501
529
|
|
|
502
530
|
---
|
|
503
531
|
|
|
504
532
|
## 相关文档
|
|
505
533
|
|
|
506
|
-
- 📖 [README.md](
|
|
534
|
+
- 📖 [README.md](https://github.com/vextjs/schema-dsl/blob/main/README.md) - 项目介绍
|
|
507
535
|
- 📖 [快速开始](./quick-start.md) - 5分钟入门
|
|
508
536
|
- 📖 [DSL语法指南](./dsl-syntax.md) - 完整语法
|
|
509
537
|
- 📖 [String扩展](./string-extensions.md) - String扩展特性
|
|
510
538
|
- 📖 [API参考](./api-reference.md) - 完整API
|
|
511
|
-
- 📖 [CHANGELOG](
|
|
512
|
-
|
|
539
|
+
- 📖 [CHANGELOG](https://github.com/vextjs/schema-dsl/blob/main/CHANGELOG.md) - 更新日志
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
543
|
+
## 对应示例文件
|
|
544
|
+
|
|
545
|
+
**示例入口**: [feature-index.ts](https://github.com/vextjs/schema-dsl/blob/main/examples/docs/feature-index.ts)
|
|
546
|
+
**说明**: 以单文件串联 DSL、String 扩展和导出器三个代表性能力,作为功能索引页的快速落地入口。
|
|
513
547
|
|
|
514
548
|
---
|
|
515
549
|
|
|
516
|
-
**最后更新**:
|
|
517
|
-
**维护者**:
|
|
550
|
+
**最后更新**: 2026-05-08
|
|
551
|
+
**维护者**: schema-dsl Team
|
|
518
552
|
|
|
519
553
|
|