cdp-material-sdk 0.1.0 → 0.1.1
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/dist/index.js
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import { C as e, a as t, b as n, c as i, D as o, E
|
|
2
|
-
import { D as
|
|
1
|
+
import { C as e, a as t, b as n, c as i, D as E, d as o, E as T, F as _, I as O, e as N, L as A, f as R, g as r, N as C, h as D, O as l, i as u, S as I, j as S, k as d, l as P, m as L, n as Y, o as m, p, q as M, r as g, u as c, s as G, v, t as K } from "./validateManifest-ZPFDq790.js";
|
|
2
|
+
import { D as f, a as x, b as V, P as h, r as y, s as b, u as k, c as z, d as H } from "./useFieldRegistry-CwjlA-ja.js";
|
|
3
3
|
export {
|
|
4
4
|
e as CATEGORY_LABELS,
|
|
5
5
|
t as COMPONENT_CATEGORY,
|
|
6
6
|
n as COMPONENT_STATE_KEY,
|
|
7
7
|
i as COMPONENT_TRAIT,
|
|
8
|
+
E as DATA_FIELD_ROLE,
|
|
8
9
|
o as DYNAMIC_ENUM_KEY,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
R as
|
|
18
|
-
r as
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
l as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
f as DataContainerRuntimeContext,
|
|
11
|
+
x as DataScope,
|
|
12
|
+
V as DataScopeContext,
|
|
13
|
+
T as ENGINE_EVENT_TYPE,
|
|
14
|
+
_ as FIELD_ROLE_KEY,
|
|
15
|
+
O as INJECT_PATH_ROOT,
|
|
16
|
+
N as INJECT_PATH_SLOT_PROPS,
|
|
17
|
+
A as LOADING_PROP_NAME,
|
|
18
|
+
R as LOADING_STRATEGY,
|
|
19
|
+
r as LOADING_WRAPPER_TYPE,
|
|
20
|
+
C as NOTIFY_ERROR_STRATEGY,
|
|
21
|
+
D as NOTIFY_TIMING,
|
|
22
|
+
l as OptionItemSchema,
|
|
23
|
+
u as OptionsSchema,
|
|
24
|
+
h as PageContext,
|
|
25
|
+
I as SLOT_KEY,
|
|
26
|
+
S as STANDARD_EVENT_KEYS,
|
|
26
27
|
d as diagnoseMissingActionImpls,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
P as diagnoseMissingStateKeys,
|
|
29
|
+
L as isCustomEventKey,
|
|
30
|
+
Y as isStandardEventKey,
|
|
31
|
+
m as normalizeAdapterEvents,
|
|
32
|
+
p as normalizeManifestEvents,
|
|
32
33
|
M as printSingleValidationResult,
|
|
33
34
|
g as printValidationResult,
|
|
34
35
|
y as resolveDataContainerRuntimeValue,
|
|
35
|
-
|
|
36
|
+
b as shouldUseDataContainerRuntimeFallback,
|
|
36
37
|
c as useConcurrentLoading,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
k as useDataContainer,
|
|
39
|
+
z as useDataContainerApi,
|
|
40
|
+
G as useDualLoading,
|
|
41
|
+
H as useFieldRegistry,
|
|
42
|
+
v as validateManifest,
|
|
43
|
+
K as validateManifests
|
|
43
44
|
};
|
package/dist/portable.js
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as E, a as e, b as T, c as _, D as i, d as n, E as t, F as O, I as N, e as A, L as R, f as I, g as o, N as S, h as L, O as Y, i as P, S as d, j as l, k as M, l as r, m as C, n as D, o as m, p as G, q as g, r as p, u, s as K, v, t as c } from "./validateManifest-ZPFDq790.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
O as
|
|
11
|
-
N as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
E as CATEGORY_LABELS,
|
|
4
|
+
e as COMPONENT_CATEGORY,
|
|
5
|
+
T as COMPONENT_STATE_KEY,
|
|
6
|
+
_ as COMPONENT_TRAIT,
|
|
7
|
+
i as DATA_FIELD_ROLE,
|
|
8
|
+
n as DYNAMIC_ENUM_KEY,
|
|
9
|
+
t as ENGINE_EVENT_TYPE,
|
|
10
|
+
O as FIELD_ROLE_KEY,
|
|
11
|
+
N as INJECT_PATH_ROOT,
|
|
12
|
+
A as INJECT_PATH_SLOT_PROPS,
|
|
13
|
+
R as LOADING_PROP_NAME,
|
|
14
|
+
I as LOADING_STRATEGY,
|
|
15
|
+
o as LOADING_WRAPPER_TYPE,
|
|
16
|
+
S as NOTIFY_ERROR_STRATEGY,
|
|
17
|
+
L as NOTIFY_TIMING,
|
|
18
|
+
Y as OptionItemSchema,
|
|
17
19
|
P as OptionsSchema,
|
|
18
|
-
Y as RemoteOptionConfigSchema,
|
|
19
20
|
d as SLOT_KEY,
|
|
20
21
|
l as STANDARD_EVENT_KEYS,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
M as diagnoseMissingActionImpls,
|
|
23
|
+
r as diagnoseMissingStateKeys,
|
|
24
|
+
C as isCustomEventKey,
|
|
25
|
+
D as isStandardEventKey,
|
|
26
|
+
m as normalizeAdapterEvents,
|
|
27
|
+
G as normalizeManifestEvents,
|
|
28
|
+
g as printSingleValidationResult,
|
|
29
|
+
p as printValidationResult,
|
|
29
30
|
u as useConcurrentLoading,
|
|
30
|
-
|
|
31
|
+
K as useDualLoading,
|
|
31
32
|
v as validateManifest,
|
|
32
|
-
|
|
33
|
+
c as validateManifests
|
|
33
34
|
};
|
|
@@ -37,36 +37,5 @@ export declare const OptionsSchema: {
|
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
export declare const RemoteOptionConfigSchema: {
|
|
41
|
-
readonly type: "object";
|
|
42
|
-
readonly title: "远程选项配置";
|
|
43
|
-
readonly properties: {
|
|
44
|
-
readonly panelCode: {
|
|
45
|
-
readonly type: "string";
|
|
46
|
-
readonly title: "面板代码";
|
|
47
|
-
};
|
|
48
|
-
readonly fieldName: {
|
|
49
|
-
readonly type: "string";
|
|
50
|
-
readonly title: "字段名称";
|
|
51
|
-
};
|
|
52
|
-
readonly extraFieldNames: {
|
|
53
|
-
readonly type: "array";
|
|
54
|
-
readonly title: "额外字段";
|
|
55
|
-
readonly description: "额外随每个选项返回的字段名(如 code、status 等),用于自定义显示格式或后续业务取用。";
|
|
56
|
-
readonly items: {
|
|
57
|
-
readonly type: "string";
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
readonly condition: {
|
|
61
|
-
readonly type: "object";
|
|
62
|
-
readonly title: "查询条件";
|
|
63
|
-
readonly description: "声明式查询条件,支持表达式绑定。";
|
|
64
|
-
readonly additionalProperties: {
|
|
65
|
-
readonly type: "string";
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
40
|
export type OptionItem = FromSchema<typeof OptionItemSchema>;
|
|
71
41
|
export type Options = FromSchema<typeof OptionsSchema>;
|
|
72
|
-
export type RemoteOptionConfig = FromSchema<typeof RemoteOptionConfigSchema>;
|
|
@@ -8,6 +8,14 @@ export declare const SLOT_KEY = "x-slot";
|
|
|
8
8
|
export declare const INJECT_PATH_ROOT = "$root";
|
|
9
9
|
/** useImperativeHandle 中用于暴露组件运行时状态的保留 key */
|
|
10
10
|
export declare const COMPONENT_STATE_KEY: "__state";
|
|
11
|
+
export declare const FIELD_ROLE_KEY = "x-fieldRole";
|
|
12
|
+
export declare const DATA_FIELD_ROLE: {
|
|
13
|
+
readonly ATTRIBUTE: "attribute";
|
|
14
|
+
readonly DIMENSION: "dimension";
|
|
15
|
+
readonly MEASURE: "measure";
|
|
16
|
+
};
|
|
17
|
+
export type DataFieldRole = typeof DATA_FIELD_ROLE[keyof typeof DATA_FIELD_ROLE];
|
|
18
|
+
export type DataSourceFieldRoleFilter = typeof DATA_FIELD_ROLE.DIMENSION | typeof DATA_FIELD_ROLE.MEASURE;
|
|
11
19
|
export interface DynamicEnumConfig {
|
|
12
20
|
source: string;
|
|
13
21
|
valueKey: string;
|
|
@@ -22,6 +30,7 @@ export interface ExtendedJSONSchema7 extends JSONSchema7 {
|
|
|
22
30
|
label: string;
|
|
23
31
|
}>;
|
|
24
32
|
placeholder?: string;
|
|
33
|
+
[FIELD_ROLE_KEY]?: DataSourceFieldRoleFilter;
|
|
25
34
|
}
|
|
26
35
|
export interface StandardEventDeclaration {
|
|
27
36
|
title?: string;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useState as m, useRef as
|
|
2
|
-
const
|
|
3
|
-
const [t, e] = m(0), [o, n] = m(void 0), c =
|
|
1
|
+
import { useState as m, useRef as g, useEffect as h, useCallback as E, useMemo as T } from "react";
|
|
2
|
+
const _ = () => {
|
|
3
|
+
const [t, e] = m(0), [o, n] = m(void 0), c = g(0);
|
|
4
4
|
h(() => {
|
|
5
5
|
c.current = t;
|
|
6
6
|
}, [t]);
|
|
7
|
-
const a =
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
}), a()), [a]), r =
|
|
7
|
+
const a = E(() => c.current > 0, []), s = E((l) => (e((u) => u + 1), l && n(l), a()), [a]), p = E(() => (e((l) => {
|
|
8
|
+
const u = Math.max(0, l - 1);
|
|
9
|
+
return u === 0 && n(void 0), u;
|
|
10
|
+
}), a()), [a]), r = E(() => {
|
|
11
11
|
e(0), n(void 0);
|
|
12
12
|
}, []);
|
|
13
|
-
return
|
|
13
|
+
return T(() => ({
|
|
14
14
|
isLoading: t > 0,
|
|
15
15
|
loadingText: o,
|
|
16
16
|
startLoading: s,
|
|
@@ -26,10 +26,10 @@ const O = () => {
|
|
|
26
26
|
stopLoading: n,
|
|
27
27
|
getLoading: c,
|
|
28
28
|
resetLoading: a
|
|
29
|
-
} =
|
|
29
|
+
} = _(), [s, p] = m(!1), r = T(() => t || s, [t, s]), l = g(!1);
|
|
30
30
|
return h(() => {
|
|
31
31
|
l.current = r;
|
|
32
|
-
}, [r]),
|
|
32
|
+
}, [r]), T(() => ({
|
|
33
33
|
actionLoading: t,
|
|
34
34
|
actionLoadingText: e,
|
|
35
35
|
startActionLoading: o,
|
|
@@ -51,7 +51,7 @@ const O = () => {
|
|
|
51
51
|
n
|
|
52
52
|
]);
|
|
53
53
|
};
|
|
54
|
-
function
|
|
54
|
+
function N(t) {
|
|
55
55
|
if (!t)
|
|
56
56
|
return [];
|
|
57
57
|
const e = [];
|
|
@@ -62,7 +62,7 @@ function S(t) {
|
|
|
62
62
|
});
|
|
63
63
|
return e;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function S(t) {
|
|
66
66
|
if (!t)
|
|
67
67
|
return [];
|
|
68
68
|
const e = [];
|
|
@@ -74,7 +74,7 @@ function _(t) {
|
|
|
74
74
|
return e;
|
|
75
75
|
}
|
|
76
76
|
function v(t) {
|
|
77
|
-
const e =
|
|
77
|
+
const e = N(t?.events), o = S(t?.customEvents);
|
|
78
78
|
return {
|
|
79
79
|
standard: e,
|
|
80
80
|
custom: o,
|
|
@@ -94,29 +94,10 @@ const $ = {
|
|
|
94
94
|
title: "选项列表",
|
|
95
95
|
items: $
|
|
96
96
|
}, J = {
|
|
97
|
-
type: "object",
|
|
98
|
-
title: "远程选项配置",
|
|
99
|
-
properties: {
|
|
100
|
-
panelCode: { type: "string", title: "面板代码" },
|
|
101
|
-
fieldName: { type: "string", title: "字段名称" },
|
|
102
|
-
extraFieldNames: {
|
|
103
|
-
type: "array",
|
|
104
|
-
title: "额外字段",
|
|
105
|
-
description: "额外随每个选项返回的字段名(如 code、status 等),用于自定义显示格式或后续业务取用。",
|
|
106
|
-
items: { type: "string" }
|
|
107
|
-
},
|
|
108
|
-
condition: {
|
|
109
|
-
type: "object",
|
|
110
|
-
title: "查询条件",
|
|
111
|
-
description: "声明式查询条件,支持表达式绑定。",
|
|
112
|
-
additionalProperties: { type: "string" }
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}, W = {
|
|
116
97
|
BEFORE: "before",
|
|
117
98
|
AFTER: "after",
|
|
118
99
|
BOTH: "both"
|
|
119
|
-
},
|
|
100
|
+
}, W = {
|
|
120
101
|
IGNORE: "ignore",
|
|
121
102
|
STOP: "stop"
|
|
122
103
|
}, C = {
|
|
@@ -132,15 +113,19 @@ const $ = {
|
|
|
132
113
|
ITEM_LONG_PRESS: "itemLongPress",
|
|
133
114
|
DATA_FETCH: "dataFetch",
|
|
134
115
|
OPTIONS_FETCH: "optionsFetch"
|
|
135
|
-
}, I = Object.values(C), L = new Set(I),
|
|
116
|
+
}, I = Object.values(C), L = new Set(I), R = /^[^:\s]+:[^:\s]+$/;
|
|
136
117
|
function f(t) {
|
|
137
118
|
return L.has(t);
|
|
138
119
|
}
|
|
139
|
-
function
|
|
140
|
-
return
|
|
120
|
+
function y(t) {
|
|
121
|
+
return R.test(t) && !L.has(t);
|
|
141
122
|
}
|
|
142
|
-
const
|
|
143
|
-
|
|
123
|
+
const q = "x-dynamic-enum", Q = "x-slot", D = "$root", X = "__state", Z = "x-fieldRole", tt = {
|
|
124
|
+
ATTRIBUTE: "attribute",
|
|
125
|
+
DIMENSION: "dimension",
|
|
126
|
+
MEASURE: "measure"
|
|
127
|
+
};
|
|
128
|
+
function P(t) {
|
|
144
129
|
if (!t)
|
|
145
130
|
return [];
|
|
146
131
|
const e = [];
|
|
@@ -163,7 +148,7 @@ function M(t) {
|
|
|
163
148
|
return e;
|
|
164
149
|
}
|
|
165
150
|
function w(t) {
|
|
166
|
-
const e =
|
|
151
|
+
const e = P(t?.events), o = M(t?.customEvents);
|
|
167
152
|
return {
|
|
168
153
|
standard: e,
|
|
169
154
|
custom: o,
|
|
@@ -171,15 +156,15 @@ function w(t) {
|
|
|
171
156
|
allKeys: [...e.map((n) => n.type), ...o.map((n) => n.type)]
|
|
172
157
|
};
|
|
173
158
|
}
|
|
174
|
-
const
|
|
159
|
+
const et = {
|
|
175
160
|
NATIVE: "native",
|
|
176
161
|
WRAPPER: "wrapper",
|
|
177
162
|
NONE: "none"
|
|
178
|
-
},
|
|
163
|
+
}, nt = {
|
|
179
164
|
SPIN: "spin",
|
|
180
165
|
SKELETON: "skeleton",
|
|
181
166
|
WAVE: "wave"
|
|
182
|
-
},
|
|
167
|
+
}, ot = "loading", A = {
|
|
183
168
|
DATA_FIELD: "Data.Field",
|
|
184
169
|
DATA_CONTAINER: "Data.Container",
|
|
185
170
|
LAYOUT_CONTAINER: "Layout.Container",
|
|
@@ -196,7 +181,7 @@ const tt = {
|
|
|
196
181
|
PAGE: "Page",
|
|
197
182
|
DEV: "Dev",
|
|
198
183
|
HTML_TEMPLATE: "HtmlTemplate"
|
|
199
|
-
},
|
|
184
|
+
}, at = {
|
|
200
185
|
[d.GENERAL]: "通用",
|
|
201
186
|
[d.FLOAT]: "悬浮",
|
|
202
187
|
[d.LAYOUT]: "布局",
|
|
@@ -208,17 +193,17 @@ const tt = {
|
|
|
208
193
|
[d.PAGE]: "页面",
|
|
209
194
|
[d.DEV]: "调试",
|
|
210
195
|
[d.HTML_TEMPLATE]: "HTML 模板"
|
|
211
|
-
}, b = "slotProps.root", Y = [
|
|
196
|
+
}, b = "slotProps.root", Y = [A.DATA_FIELD, A.DATA_CONTAINER], K = [D, b], O = ["string", "number", "boolean", "array", "object", "integer", "null"];
|
|
212
197
|
function i(t, e, o, n, c) {
|
|
213
198
|
t.push({ type: e, field: o, message: n, severity: c });
|
|
214
199
|
}
|
|
215
|
-
function
|
|
200
|
+
function F(t, e, o) {
|
|
216
201
|
const n = t.type;
|
|
217
202
|
if (!t.meta)
|
|
218
203
|
return i(e, n, "meta", "meta 字段是必填的", "error"), !1;
|
|
219
204
|
if (t.meta.title || i(e, n, "meta.title", "title 是必填的", "error"), t.meta.category ? Object.values(d).includes(t.meta.category) || i(e, n, "meta.category", `无效的 category: ${t.meta.category}`, "error") : i(e, n, "meta.category", "category 是必填的", "error"), t.meta.valueSchema) {
|
|
220
205
|
const a = t.meta.valueSchema.type;
|
|
221
|
-
a && typeof a == "string" && !
|
|
206
|
+
a && typeof a == "string" && !O.includes(a) && i(e, n, "meta.valueSchema.type", `无效的 valueSchema type: ${a}`, "error");
|
|
222
207
|
}
|
|
223
208
|
return t.traits?.some((a) => Y.includes(a)) && !t.meta.valueSchema && i(
|
|
224
209
|
o,
|
|
@@ -228,30 +213,30 @@ function K(t, e, o) {
|
|
|
228
213
|
"warning"
|
|
229
214
|
), !0;
|
|
230
215
|
}
|
|
231
|
-
function
|
|
216
|
+
function j(t, e, o) {
|
|
232
217
|
const n = t.type, c = w(t), a = new Set(c.standard.map((p) => p.type)), s = new Set(c.custom.map((p) => p.type));
|
|
233
218
|
if (c.all.length > 0 && (c.standard.forEach((p, r) => {
|
|
234
219
|
p.type || i(e, n, `events[${r}].type`, "事件类型不能为空", "error"), p.type && !f(p.type) && i(e, n, `events[${r}].type`, `标准事件类型必须属于 EngineEventProtocol: ${p.type}`, "error");
|
|
235
220
|
}), c.custom.forEach((p) => {
|
|
236
|
-
p.type || i(e, n, "customEvents.type", "自定义事件类型不能为空", "error"), p.type && !
|
|
221
|
+
p.type || i(e, n, "customEvents.type", "自定义事件类型不能为空", "error"), p.type && !y(p.type) && i(e, n, `customEvents.${p.type}`, `自定义事件类型必须是 namespaced 形态: ${p.type}`, "error"), p.payloadSchema || i(e, n, `customEvents.${p.type}.payloadSchema`, "自定义事件必须声明 payloadSchema", "error");
|
|
237
222
|
})), t.adapter) {
|
|
238
223
|
const p = v(t.adapter);
|
|
239
224
|
p.standard.forEach((r, l) => {
|
|
240
225
|
r.type || i(e, n, `adapter.events[${l}].type`, "Adapter 事件类型不能为空", "error"), r.type && !f(r.type) && i(e, n, `adapter.events[${l}].type`, `Adapter 标准事件类型必须属于 EngineEventProtocol: ${r.type}`, "error"), r.type && f(r.type) && !a.has(r.type) && i(e, n, `adapter.events[${l}].type`, `Adapter 标准事件必须先在 manifest.events 中声明: ${r.type}`, "error"), r.propName || i(e, n, `adapter.events[${l}].propName`, "Adapter propName 不能为空", "error");
|
|
241
226
|
}), p.custom.forEach((r) => {
|
|
242
|
-
r.type || i(e, n, "adapter.customEvents.type", "Adapter 自定义事件类型不能为空", "error"), r.type && !
|
|
227
|
+
r.type || i(e, n, "adapter.customEvents.type", "Adapter 自定义事件类型不能为空", "error"), r.type && !y(r.type) && i(e, n, `adapter.customEvents.${r.type}`, `Adapter 自定义事件类型必须是 namespaced 形态: ${r.type}`, "error"), r.type && y(r.type) && !s.has(r.type) && i(e, n, `adapter.customEvents.${r.type}`, `Adapter 自定义事件必须先在 manifest.customEvents 中声明: ${r.type}`, "error"), r.propName || i(e, n, `adapter.customEvents.${r.type}.propName`, "Adapter customEvents propName 不能为空", "error");
|
|
243
228
|
});
|
|
244
229
|
}
|
|
245
230
|
}
|
|
246
|
-
function
|
|
231
|
+
function G(t, e, o) {
|
|
247
232
|
const n = t.type, c = t.actions;
|
|
248
233
|
if (c)
|
|
249
234
|
for (const [a, s] of Object.entries(c))
|
|
250
235
|
s && (s.title || i(e, n, `actions.${a}.title`, `动作 "${a}" 缺少 title`, "error"), s.returns || i(o, n, `actions.${a}.returns`, `动作 "${a}" 未声明 returns schema,建议补充`, "warning"), s.params && s.params.type !== "object" && i(e, n, `actions.${a}.params.type`, '动作参数 schema 的 type 必须为 "object"', "error"));
|
|
251
236
|
}
|
|
252
|
-
function
|
|
237
|
+
function H(t, e, o) {
|
|
253
238
|
const n = t.type, c = t.engine?.render?.injection?.rootPath;
|
|
254
|
-
c ? typeof c == "string" && !
|
|
239
|
+
c ? typeof c == "string" && !K.includes(c) && i(
|
|
255
240
|
o,
|
|
256
241
|
n,
|
|
257
242
|
"engine.render.injection.rootPath",
|
|
@@ -281,17 +266,17 @@ function k(t, e, o) {
|
|
|
281
266
|
const n = t.type, c = t.state;
|
|
282
267
|
if (c)
|
|
283
268
|
for (const [a, s] of Object.entries(c))
|
|
284
|
-
s && (s.title || i(e, n, `state.${a}.title`, `状态 "${a}" 缺少 title`, "error"), s.schema ? s.schema.type && typeof s.schema.type == "string" && !
|
|
269
|
+
s && (s.title || i(e, n, `state.${a}.title`, `状态 "${a}" 缺少 title`, "error"), s.schema ? s.schema.type && typeof s.schema.type == "string" && !O.includes(s.schema.type) && i(e, n, `state.${a}.schema.type`, `状态 "${a}" 的 schema.type 无效: ${s.schema.type}`, "error") : i(e, n, `state.${a}.schema`, `状态 "${a}" 缺少 schema`, "error"));
|
|
285
270
|
}
|
|
286
271
|
function z(t) {
|
|
287
272
|
const e = [], o = [];
|
|
288
|
-
return t.type || i(e, t.type || "Unknown", "type", "type 字段是必填的", "error"),
|
|
273
|
+
return t.type || i(e, t.type || "Unknown", "type", "type 字段是必填的", "error"), F(t, e, o) ? (j(t, e), G(t, e, o), k(t, e), U(t, e, o), H(t, e, o), {
|
|
289
274
|
valid: e.length === 0,
|
|
290
275
|
errors: e,
|
|
291
276
|
warnings: o
|
|
292
277
|
}) : { valid: !1, errors: e, warnings: o };
|
|
293
278
|
}
|
|
294
|
-
function
|
|
279
|
+
function st(t) {
|
|
295
280
|
const e = [], o = [];
|
|
296
281
|
for (const n of t) {
|
|
297
282
|
const c = z(n);
|
|
@@ -303,13 +288,13 @@ function at(t) {
|
|
|
303
288
|
warnings: o
|
|
304
289
|
};
|
|
305
290
|
}
|
|
306
|
-
function
|
|
291
|
+
function rt(t, e) {
|
|
307
292
|
return !t || !e ? [] : t.filter((o) => typeof e[o] != "function");
|
|
308
293
|
}
|
|
309
|
-
function
|
|
294
|
+
function it(t, e) {
|
|
310
295
|
return !t?.state || !e ? [] : Object.keys(t.state).filter((o) => !(o in e));
|
|
311
296
|
}
|
|
312
|
-
function
|
|
297
|
+
function ct(t) {
|
|
313
298
|
t.valid ? console.log("✅ 所有 Manifest 验证通过") : console.error(`❌ 发现 ${t.errors.length} 个错误`), t.errors.length > 0 && (console.error(`
|
|
314
299
|
错误列表:`), t.errors.forEach((e) => {
|
|
315
300
|
console.error(` ❌ [${e.type}] ${e.field}: ${e.message}`);
|
|
@@ -318,7 +303,7 @@ function it(t) {
|
|
|
318
303
|
console.warn(` ⚠️ [${e.type}] ${e.field}: ${e.message}`);
|
|
319
304
|
}));
|
|
320
305
|
}
|
|
321
|
-
function
|
|
306
|
+
function pt(t, e = "[Registry]") {
|
|
322
307
|
if (!t.valid && t.errors.length > 0) {
|
|
323
308
|
const o = t.errors[0]?.type || "Unknown";
|
|
324
309
|
console.error(`${e} ❌ Manifest validation failed for '${o}':`), t.errors.forEach((n) => console.error(` - ${n.field}: ${n.message}`));
|
|
@@ -329,34 +314,35 @@ function ct(t, e = "[Registry]") {
|
|
|
329
314
|
}
|
|
330
315
|
}
|
|
331
316
|
export {
|
|
332
|
-
|
|
333
|
-
|
|
317
|
+
at as C,
|
|
318
|
+
tt as D,
|
|
334
319
|
C as E,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
320
|
+
Z as F,
|
|
321
|
+
D as I,
|
|
322
|
+
ot as L,
|
|
323
|
+
W as N,
|
|
338
324
|
$ as O,
|
|
339
|
-
|
|
340
|
-
X as S,
|
|
325
|
+
Q as S,
|
|
341
326
|
d as a,
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
327
|
+
X as b,
|
|
328
|
+
A as c,
|
|
329
|
+
q as d,
|
|
330
|
+
b as e,
|
|
346
331
|
et as f,
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
332
|
+
nt as g,
|
|
333
|
+
J as h,
|
|
334
|
+
V as i,
|
|
335
|
+
I as j,
|
|
351
336
|
rt as k,
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
337
|
+
it as l,
|
|
338
|
+
y as m,
|
|
339
|
+
f as n,
|
|
340
|
+
v as o,
|
|
341
|
+
w as p,
|
|
342
|
+
pt as q,
|
|
343
|
+
ct as r,
|
|
344
|
+
x as s,
|
|
345
|
+
st as t,
|
|
346
|
+
_ as u,
|
|
361
347
|
z as v
|
|
362
348
|
};
|