@djvlc/contracts-schemas 1.2.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @djvlc/contracts-schemas - DJV 低代码平台 JSON Schema 定义包\n *\n * 提供所有协议的 JSON Schema 定义,用于:\n * - Editor: 配置表单校验\n * - Platform: 发布时校验\n * - Runtime: 运行时校验/降级\n *\n * @packageDocumentation\n */\n\n\n// 直接导出 Schema 对象(避免 JSON 导入问题)\nexport const pageSchema = {\n $schema: 'http://json-schema.org/draft-07/schema#',\n $id: 'https://djvlc.com/schemas/page-schema.json',\n title: 'PageSchema',\n description: 'DJV 低代码平台页面 Schema 定义',\n type: 'object',\n required: ['schemaVersion', 'page', 'components'],\n properties: {\n schemaVersion: {\n type: 'string',\n description: 'Schema 版本号',\n pattern: '^\\\\d+\\\\.\\\\d+\\\\.\\\\d+$',\n },\n page: { $ref: '#/definitions/PageConfig' },\n components: {\n type: 'array',\n description: '组件实例列表',\n items: { $ref: '#/definitions/ComponentInstance' },\n },\n actionDefVersionIds: {\n type: 'array',\n description: '绑定的 ActionDefinition 版本 ID',\n items: { type: 'string' },\n },\n dataQueryVersionIds: {\n type: 'array',\n description: '绑定的 DataQuery 版本 ID',\n items: { type: 'string' },\n },\n },\n definitions: {\n PageConfig: {\n type: 'object',\n required: ['id', 'title', 'canvas'],\n properties: {\n id: { type: 'string', description: '页面 ID' },\n title: { type: 'string', description: '页面标题' },\n description: { type: 'string', description: '页面描述' },\n canvas: { $ref: '#/definitions/CanvasConfig' },\n meta: { $ref: '#/definitions/PageMeta' },\n variables: { type: 'object', description: '页面变量' },\n apis: { type: 'array', items: { $ref: '#/definitions/ApiConfig' } },\n },\n },\n CanvasConfig: {\n type: 'object',\n required: ['type', 'width'],\n properties: {\n type: { type: 'string', enum: ['h5', 'tablet', 'pc'], description: '画布类型' },\n width: { type: 'number', description: '画布宽度' },\n height: { type: 'number', description: '画布高度' },\n background: { type: 'string', description: '背景色' },\n gridSize: { type: 'number', description: '网格大小' },\n showGrid: { type: 'boolean', description: '是否显示网格' },\n showRuler: { type: 'boolean', description: '是否显示标尺' },\n },\n },\n PageMeta: {\n type: 'object',\n properties: {\n createTime: { type: 'string', format: 'date-time' },\n updateTime: { type: 'string', format: 'date-time' },\n author: { type: 'string' },\n version: { type: 'string' },\n tags: { type: 'array', items: { type: 'string' } },\n status: { type: 'string', enum: ['draft', 'published'] },\n },\n },\n ApiConfig: {\n type: 'object',\n required: ['id', 'name', 'url', 'method'],\n properties: {\n id: { type: 'string' },\n name: { type: 'string' },\n url: { type: 'string' },\n method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'] },\n headers: { type: 'object' },\n params: { type: 'object' },\n body: { type: 'object' },\n timeout: { type: 'number' },\n autoRun: { type: 'boolean' },\n dependencies: { type: 'array', items: { type: 'string' } },\n },\n },\n ComponentInstance: {\n type: 'object',\n required: ['id', 'type', 'props', 'style'],\n properties: {\n id: { type: 'string', description: '组件实例 ID' },\n type: { type: 'string', description: '组件类型' },\n name: { type: 'string', description: '组件名称' },\n props: { type: 'object', description: '组件属性' },\n style: { type: 'object', description: '组件样式' },\n layout: { $ref: '#/definitions/ComponentLayout' },\n events: { type: 'array', items: { $ref: '#/definitions/ComponentEvent' } },\n visible: { type: 'boolean' },\n locked: { type: 'boolean' },\n children: { type: 'array', items: { $ref: '#/definitions/ComponentInstance' } },\n },\n },\n ComponentLayout: {\n type: 'object',\n properties: {\n x: { type: 'number' },\n y: { type: 'number' },\n width: { type: 'number' },\n height: { type: 'number' },\n rotation: { type: 'number' },\n },\n },\n ComponentEvent: {\n type: 'object',\n required: ['id', 'trigger', 'actions'],\n properties: {\n id: { type: 'string' },\n trigger: { type: 'string' },\n actions: { type: 'array', items: { $ref: '#/definitions/EventAction' } },\n enabled: { type: 'boolean' },\n condition: { type: 'string' },\n debounce: { type: 'number' },\n throttle: { type: 'number' },\n },\n },\n EventAction: {\n type: 'object',\n required: ['id', 'type', 'params'],\n properties: {\n id: { type: 'string' },\n type: { type: 'string' },\n params: { type: 'object' },\n enabled: { type: 'boolean' },\n delay: { type: 'number' },\n },\n },\n },\n} as const;\n\nexport const componentMetaSchema = {\n $schema: 'http://json-schema.org/draft-07/schema#',\n $id: 'https://djvlc.com/schemas/component-meta.json',\n title: 'ComponentMeta',\n description: 'DJV 低代码平台组件元数据 Schema 定义',\n type: 'object',\n required: ['name', 'version', 'label', 'category', 'props', 'events', 'capabilities', 'compat', 'integrity', 'status', 'entry'],\n properties: {\n name: { type: 'string', description: '组件名称', pattern: '^[a-z][a-z0-9-]*$' },\n version: { type: 'string', description: '版本号 (semver)', pattern: '^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(-[a-zA-Z0-9.]+)?$' },\n label: { type: 'string', description: '显示名称' },\n description: { type: 'string', description: '组件描述' },\n icon: { type: 'string', description: '组件图标' },\n category: {\n type: 'string',\n enum: ['basic', 'form', 'layout', 'navigation', 'feedback', 'display', 'data', 'business', 'chart', 'other'],\n description: '组件分类',\n },\n tags: { type: 'array', items: { type: 'string' }, description: '组件标签' },\n author: { type: 'string', description: '组件作者' },\n props: { type: 'object', description: '属性定义' },\n events: { type: 'object', description: '事件定义' },\n capabilities: { type: 'object', description: '能力声明' },\n compat: { type: 'object', description: '兼容性' },\n integrity: { type: 'object', description: '完整性校验' },\n status: {\n type: 'string',\n enum: ['draft', 'canary', 'stable', 'deprecated', 'blocked'],\n description: '组件状态',\n },\n preview: { type: 'string', description: '预览图 URL' },\n entry: { type: 'string', description: '入口文件路径' },\n styles: { type: 'array', items: { type: 'string' }, description: '样式文件路径' },\n },\n} as const;\n\nexport const actionSpecSchema = {\n $schema: 'http://json-schema.org/draft-07/schema#',\n $id: 'https://djvlc.com/schemas/action-spec.json',\n title: 'ActionDefinition',\n description: 'DJV 低代码平台 Action 定义 Schema',\n type: 'object',\n required: ['id', 'name', 'actionType', 'paramsSchema', 'requiresAuth', 'version', 'status'],\n properties: {\n id: { type: 'string', description: '动作 ID' },\n name: { type: 'string', description: '动作名称' },\n actionType: { type: 'string', description: '动作类型' },\n description: { type: 'string', description: '动作描述' },\n paramsSchema: { type: 'object', description: '参数 Schema' },\n responseSchema: { type: 'object', description: '响应 Schema' },\n requiresAuth: { type: 'boolean', description: '是否需要认证' },\n idempotencyRule: { type: 'object', description: '幂等规则' },\n rateLimitRule: { type: 'object', description: '频控规则' },\n version: { type: 'string', description: '版本号', pattern: '^\\\\d+\\\\.\\\\d+\\\\.\\\\d+$' },\n status: { type: 'string', enum: ['active', 'deprecated', 'disabled'], description: '状态' },\n },\n} as const;\n\nexport const dataQuerySpecSchema = {\n $schema: 'http://json-schema.org/draft-07/schema#',\n $id: 'https://djvlc.com/schemas/data-query-spec.json',\n title: 'DataQueryDefinition',\n description: 'DJV 低代码平台 Data Query 定义 Schema',\n type: 'object',\n required: ['id', 'name', 'sourceType', 'sourceConfig', 'paramsSchema', 'responseSchema', 'version', 'status'],\n properties: {\n id: { type: 'string', description: '查询 ID' },\n name: { type: 'string', description: '查询名称' },\n description: { type: 'string', description: '查询描述' },\n sourceType: { type: 'string', enum: ['api', 'database', 'cache', 'custom'], description: '数据源类型' },\n sourceConfig: { type: 'object', description: '数据源配置' },\n paramsSchema: { type: 'object', description: '参数 Schema' },\n responseSchema: { type: 'object', description: '响应 Schema' },\n allowedFields: { type: 'array', items: { type: 'string' }, description: '字段白名单' },\n maskRules: { type: 'array', description: '脱敏规则' },\n cacheConfig: { type: 'object', description: '缓存配置' },\n version: { type: 'string', description: '版本号', pattern: '^\\\\d+\\\\.\\\\d+\\\\.\\\\d+$' },\n status: { type: 'string', enum: ['active', 'deprecated', 'disabled'], description: '状态' },\n },\n} as const;\n\n// Schema 版本\nexport const SCHEMA_VERSIONS = {\n pageSchema: '1.0.0',\n componentMeta: '1.0.0',\n actionSpec: '1.0.0',\n dataQuerySpec: '1.0.0',\n} as const;\n\n// Schema 元数据\nexport interface SchemaMetadata {\n name: string;\n version: string;\n description: string;\n schema: object;\n}\n\n/**\n * 获取所有 Schema 的元数据\n */\nexport function getAllSchemas(): SchemaMetadata[] {\n return [\n {\n name: 'page-schema',\n version: SCHEMA_VERSIONS.pageSchema,\n description: '页面 Schema 定义',\n schema: pageSchema,\n },\n {\n name: 'component-meta',\n version: SCHEMA_VERSIONS.componentMeta,\n description: '组件元数据 Schema 定义',\n schema: componentMetaSchema,\n },\n {\n name: 'action-spec',\n version: SCHEMA_VERSIONS.actionSpec,\n description: 'Action 规范 Schema 定义',\n schema: actionSpecSchema,\n },\n {\n name: 'data-query-spec',\n version: SCHEMA_VERSIONS.dataQuerySpec,\n description: 'Data Query 规范 Schema 定义',\n schema: dataQuerySpecSchema,\n },\n ];\n}\n\n/**\n * 根据名称获取 Schema\n */\nexport function getSchemaByName(\n name: 'page-schema' | 'component-meta' | 'action-spec' | 'data-query-spec'\n): object {\n const schemas: Record<string, object> = {\n 'page-schema': pageSchema,\n 'component-meta': componentMetaSchema,\n 'action-spec': actionSpecSchema,\n 'data-query-spec': dataQuerySpecSchema,\n };\n return schemas[name];\n}\n"],"mappings":";AAaO,IAAM,aAAa;AAAA,EACxB,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,UAAU,CAAC,iBAAiB,QAAQ,YAAY;AAAA,EAChD,YAAY;AAAA,IACV,eAAe;AAAA,MACb,MAAM;AAAA,MACN,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA,MAAM,EAAE,MAAM,2BAA2B;AAAA,IACzC,YAAY;AAAA,MACV,MAAM;AAAA,MACN,aAAa;AAAA,MACb,OAAO,EAAE,MAAM,kCAAkC;AAAA,IACnD;AAAA,IACA,qBAAqB;AAAA,MACnB,MAAM;AAAA,MACN,aAAa;AAAA,MACb,OAAO,EAAE,MAAM,SAAS;AAAA,IAC1B;AAAA,IACA,qBAAqB;AAAA,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;AAAA,IACf,mBAAmB;AAAA,EACrB;AACA,SAAO,QAAQ,IAAI;AACrB;","names":[]}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@djvlc/contracts-schemas",
3
+ "version": "1.2.0",
4
+ "description": "DJV Low-code Platform - JSON Schema 定义包",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "schemas"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsup",
21
+ "dev": "tsup --watch",
22
+ "lint": "eslint src/ --ext .ts",
23
+ "typecheck": "tsc --noEmit",
24
+ "clean": "rimraf dist"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^20.0.0",
28
+ "@typescript-eslint/eslint-plugin": "^7.0.0",
29
+ "@typescript-eslint/parser": "^7.0.0",
30
+ "eslint": "^8.56.0",
31
+ "rimraf": "^5.0.0",
32
+ "tsup": "^8.0.0",
33
+ "typescript": "^5.3.0"
34
+ },
35
+ "keywords": [
36
+ "lowcode",
37
+ "contracts",
38
+ "json-schema",
39
+ "schema",
40
+ "djvlc"
41
+ ],
42
+ "author": "DJV Team",
43
+ "license": "MIT",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/djvlc/contracts.git",
47
+ "directory": "packages/contracts-schemas"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public",
51
+ "registry": "https://registry.npmjs.org/"
52
+ },
53
+ "engines": {
54
+ "node": ">=18.0.0"
55
+ }
56
+ }
@@ -0,0 +1,163 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://djvlc.com/schemas/action-spec.json",
4
+ "title": "ActionDefinition",
5
+ "description": "DJV 低代码平台 Action 定义 Schema",
6
+ "type": "object",
7
+ "required": ["id", "name", "actionType", "paramsSchema", "requiresAuth", "version", "status"],
8
+ "properties": {
9
+ "id": {
10
+ "type": "string",
11
+ "description": "动作 ID"
12
+ },
13
+ "name": {
14
+ "type": "string",
15
+ "description": "动作名称"
16
+ },
17
+ "actionType": {
18
+ "type": "string",
19
+ "description": "动作类型"
20
+ },
21
+ "description": {
22
+ "type": "string",
23
+ "description": "动作描述"
24
+ },
25
+ "paramsSchema": {
26
+ "type": "object",
27
+ "description": "参数 Schema"
28
+ },
29
+ "responseSchema": {
30
+ "type": "object",
31
+ "description": "响应 Schema"
32
+ },
33
+ "requiresAuth": {
34
+ "type": "boolean",
35
+ "description": "是否需要认证"
36
+ },
37
+ "idempotencyRule": {
38
+ "$ref": "#/definitions/IdempotencyRule"
39
+ },
40
+ "rateLimitRule": {
41
+ "$ref": "#/definitions/RateLimitRule"
42
+ },
43
+ "version": {
44
+ "type": "string",
45
+ "description": "版本号",
46
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
47
+ },
48
+ "status": {
49
+ "type": "string",
50
+ "enum": ["active", "deprecated", "disabled"],
51
+ "description": "状态"
52
+ }
53
+ },
54
+ "definitions": {
55
+ "IdempotencyRule": {
56
+ "type": "object",
57
+ "required": ["enabled", "keyFields", "ttl"],
58
+ "properties": {
59
+ "enabled": {
60
+ "type": "boolean",
61
+ "description": "是否启用幂等"
62
+ },
63
+ "keyFields": {
64
+ "type": "array",
65
+ "items": {
66
+ "type": "string"
67
+ },
68
+ "description": "幂等键字段"
69
+ },
70
+ "ttl": {
71
+ "type": "number",
72
+ "description": "幂等有效期(秒)"
73
+ }
74
+ }
75
+ },
76
+ "RateLimitRule": {
77
+ "type": "object",
78
+ "required": ["enabled", "window", "limit", "dimension"],
79
+ "properties": {
80
+ "enabled": {
81
+ "type": "boolean",
82
+ "description": "是否启用频控"
83
+ },
84
+ "window": {
85
+ "type": "number",
86
+ "description": "时间窗口(秒)"
87
+ },
88
+ "limit": {
89
+ "type": "number",
90
+ "description": "最大次数"
91
+ },
92
+ "dimension": {
93
+ "type": "string",
94
+ "enum": ["user", "ip", "device", "global"],
95
+ "description": "频控维度"
96
+ }
97
+ }
98
+ },
99
+ "ActionExecuteRequest": {
100
+ "type": "object",
101
+ "required": ["actionType", "params", "context"],
102
+ "properties": {
103
+ "actionType": {
104
+ "type": "string"
105
+ },
106
+ "params": {
107
+ "type": "object"
108
+ },
109
+ "context": {
110
+ "$ref": "#/definitions/ActionContext"
111
+ },
112
+ "idempotencyKey": {
113
+ "type": "string"
114
+ }
115
+ }
116
+ },
117
+ "ActionContext": {
118
+ "type": "object",
119
+ "properties": {
120
+ "pageVersionId": {
121
+ "type": "string"
122
+ },
123
+ "componentVersion": {
124
+ "type": "string"
125
+ },
126
+ "uid": {
127
+ "type": "string"
128
+ },
129
+ "deviceId": {
130
+ "type": "string"
131
+ },
132
+ "channel": {
133
+ "type": "string"
134
+ },
135
+ "traceId": {
136
+ "type": "string"
137
+ },
138
+ "extra": {
139
+ "type": "object"
140
+ }
141
+ }
142
+ },
143
+ "ActionExecuteResponse": {
144
+ "type": "object",
145
+ "required": ["success"],
146
+ "properties": {
147
+ "success": {
148
+ "type": "boolean"
149
+ },
150
+ "data": {},
151
+ "code": {
152
+ "type": "number"
153
+ },
154
+ "message": {
155
+ "type": "string"
156
+ },
157
+ "traceId": {
158
+ "type": "string"
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
@@ -0,0 +1,283 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://djvlc.com/schemas/component-meta.json",
4
+ "title": "ComponentMeta",
5
+ "description": "DJV 低代码平台组件元数据 Schema 定义",
6
+ "type": "object",
7
+ "required": ["name", "version", "label", "category", "props", "events", "capabilities", "compat", "integrity", "status", "entry"],
8
+ "properties": {
9
+ "name": {
10
+ "type": "string",
11
+ "description": "组件名称",
12
+ "pattern": "^[a-z][a-z0-9-]*$"
13
+ },
14
+ "version": {
15
+ "type": "string",
16
+ "description": "版本号 (semver)",
17
+ "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$"
18
+ },
19
+ "label": {
20
+ "type": "string",
21
+ "description": "显示名称"
22
+ },
23
+ "description": {
24
+ "type": "string",
25
+ "description": "组件描述"
26
+ },
27
+ "icon": {
28
+ "type": "string",
29
+ "description": "组件图标"
30
+ },
31
+ "category": {
32
+ "type": "string",
33
+ "enum": ["basic", "form", "layout", "navigation", "feedback", "display", "data", "business", "chart", "other"],
34
+ "description": "组件分类"
35
+ },
36
+ "tags": {
37
+ "type": "array",
38
+ "items": {
39
+ "type": "string"
40
+ },
41
+ "description": "组件标签"
42
+ },
43
+ "author": {
44
+ "type": "string",
45
+ "description": "组件作者"
46
+ },
47
+ "props": {
48
+ "$ref": "#/definitions/PropsSchema"
49
+ },
50
+ "events": {
51
+ "$ref": "#/definitions/EventsDefinition"
52
+ },
53
+ "capabilities": {
54
+ "$ref": "#/definitions/CapabilitiesDefinition"
55
+ },
56
+ "compat": {
57
+ "$ref": "#/definitions/CompatDefinition"
58
+ },
59
+ "integrity": {
60
+ "$ref": "#/definitions/IntegrityDefinition"
61
+ },
62
+ "status": {
63
+ "type": "string",
64
+ "enum": ["draft", "canary", "stable", "deprecated", "blocked"],
65
+ "description": "组件状态"
66
+ },
67
+ "preview": {
68
+ "type": "string",
69
+ "description": "预览图 URL"
70
+ },
71
+ "entry": {
72
+ "type": "string",
73
+ "description": "入口文件路径"
74
+ },
75
+ "styles": {
76
+ "type": "array",
77
+ "items": {
78
+ "type": "string"
79
+ },
80
+ "description": "样式文件路径"
81
+ }
82
+ },
83
+ "definitions": {
84
+ "PropsSchema": {
85
+ "type": "object",
86
+ "required": ["type", "title", "properties"],
87
+ "properties": {
88
+ "$schema": {
89
+ "type": "string"
90
+ },
91
+ "type": {
92
+ "const": "object"
93
+ },
94
+ "title": {
95
+ "type": "string"
96
+ },
97
+ "description": {
98
+ "type": "string"
99
+ },
100
+ "properties": {
101
+ "type": "object",
102
+ "additionalProperties": {
103
+ "$ref": "#/definitions/PropDefinition"
104
+ }
105
+ },
106
+ "required": {
107
+ "type": "array",
108
+ "items": {
109
+ "type": "string"
110
+ }
111
+ }
112
+ }
113
+ },
114
+ "PropDefinition": {
115
+ "type": "object",
116
+ "required": ["type"],
117
+ "properties": {
118
+ "type": {
119
+ "type": "string",
120
+ "enum": ["string", "number", "boolean", "object", "array", "null"]
121
+ },
122
+ "title": {
123
+ "type": "string"
124
+ },
125
+ "description": {
126
+ "type": "string"
127
+ },
128
+ "default": {},
129
+ "enum": {
130
+ "type": "array"
131
+ },
132
+ "group": {
133
+ "type": "string"
134
+ },
135
+ "x-editor-widget": {
136
+ "type": "string"
137
+ },
138
+ "x-expression-enabled": {
139
+ "type": "boolean"
140
+ }
141
+ }
142
+ },
143
+ "EventsDefinition": {
144
+ "type": "object",
145
+ "required": ["version", "events"],
146
+ "properties": {
147
+ "version": {
148
+ "type": "string"
149
+ },
150
+ "events": {
151
+ "type": "array",
152
+ "items": {
153
+ "$ref": "#/definitions/EventDefinition"
154
+ }
155
+ }
156
+ }
157
+ },
158
+ "EventDefinition": {
159
+ "type": "object",
160
+ "required": ["name", "label"],
161
+ "properties": {
162
+ "name": {
163
+ "type": "string"
164
+ },
165
+ "label": {
166
+ "type": "string"
167
+ },
168
+ "description": {
169
+ "type": "string"
170
+ },
171
+ "payload": {
172
+ "type": "object"
173
+ }
174
+ }
175
+ },
176
+ "CapabilitiesDefinition": {
177
+ "type": "object",
178
+ "required": ["version"],
179
+ "properties": {
180
+ "version": {
181
+ "type": "string"
182
+ },
183
+ "requiresAuth": {
184
+ "type": "boolean"
185
+ },
186
+ "requiresAction": {
187
+ "type": "boolean"
188
+ },
189
+ "actionTypes": {
190
+ "type": "array",
191
+ "items": {
192
+ "type": "string"
193
+ }
194
+ },
195
+ "requiresDataQuery": {
196
+ "type": "boolean"
197
+ },
198
+ "queryTypes": {
199
+ "type": "array",
200
+ "items": {
201
+ "type": "string"
202
+ }
203
+ },
204
+ "requiresNavigation": {
205
+ "type": "boolean"
206
+ },
207
+ "requiresTrack": {
208
+ "type": "boolean"
209
+ },
210
+ "requiresDialog": {
211
+ "type": "boolean"
212
+ },
213
+ "requiresClipboard": {
214
+ "type": "boolean"
215
+ },
216
+ "custom": {
217
+ "type": "array",
218
+ "items": {
219
+ "type": "string"
220
+ }
221
+ }
222
+ }
223
+ },
224
+ "CompatDefinition": {
225
+ "type": "object",
226
+ "required": ["version", "minRuntime"],
227
+ "properties": {
228
+ "version": {
229
+ "type": "string"
230
+ },
231
+ "minRuntime": {
232
+ "type": "string"
233
+ },
234
+ "maxRuntime": {
235
+ "type": "string"
236
+ },
237
+ "breaking": {
238
+ "type": "boolean"
239
+ },
240
+ "breakingChanges": {
241
+ "type": "array",
242
+ "items": {
243
+ "type": "string"
244
+ }
245
+ },
246
+ "upgradeFrom": {
247
+ "type": "array",
248
+ "items": {
249
+ "type": "string"
250
+ }
251
+ }
252
+ }
253
+ },
254
+ "IntegrityDefinition": {
255
+ "type": "object",
256
+ "required": ["version", "main", "files", "generatedAt", "algorithm"],
257
+ "properties": {
258
+ "version": {
259
+ "type": "string"
260
+ },
261
+ "main": {
262
+ "type": "string",
263
+ "description": "主入口文件 SRI 哈希"
264
+ },
265
+ "files": {
266
+ "type": "object",
267
+ "additionalProperties": {
268
+ "type": "string"
269
+ },
270
+ "description": "所有文件的 SRI 哈希"
271
+ },
272
+ "generatedAt": {
273
+ "type": "string",
274
+ "format": "date-time"
275
+ },
276
+ "algorithm": {
277
+ "type": "string",
278
+ "enum": ["sha256", "sha384", "sha512"]
279
+ }
280
+ }
281
+ }
282
+ }
283
+ }