openyida 2026.7.18 → 2026.7.21

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.
Files changed (200) hide show
  1. package/README.md +37 -2
  2. package/bin/yida.js +113 -18
  3. package/docs/capabilities.md +202 -0
  4. package/lib/agent-center/agent-center.js +2 -3
  5. package/lib/app/app-list.js +3 -4
  6. package/lib/app/build-page.js +13 -6
  7. package/lib/app/check-page.js +16 -6
  8. package/lib/app/compile.js +17 -7
  9. package/lib/app/create-app.js +14 -2
  10. package/lib/app/create-form/api-path.js +25 -0
  11. package/lib/app/create-form/args.js +13 -0
  12. package/lib/app/create-form/commands.js +4 -0
  13. package/lib/app/create-form/definition-reader.js +23 -23
  14. package/lib/app/create-form/field-normalizers.js +26 -7
  15. package/lib/app/create-form/schema-patch.js +4 -1
  16. package/lib/app/create-form.js +155 -68
  17. package/lib/app/create-page.js +47 -10
  18. package/lib/app/generate-page.js +20 -1
  19. package/lib/app/get-form-config.js +2 -1
  20. package/lib/app/get-schema.js +67 -15
  21. package/lib/app/import-app.js +94 -42
  22. package/lib/app/list-forms.js +4 -8
  23. package/lib/app/page-ir.js +140 -0
  24. package/lib/app/publish.js +289 -556
  25. package/lib/app/schema-field-resolution.js +370 -0
  26. package/lib/app/services/app-reader.js +85 -0
  27. package/lib/app/services/app-service.js +235 -0
  28. package/lib/app/services/canvas-page-compiler.js +91 -0
  29. package/lib/app/services/canvas-page-schema-builder.js +149 -0
  30. package/lib/app/services/field-bindings.js +68 -0
  31. package/lib/app/services/form-compiler.js +1922 -0
  32. package/lib/app/services/form-mode-service.js +182 -0
  33. package/lib/app/services/form-schema-patcher.js +333 -0
  34. package/lib/app/services/form-schema-reader.js +59 -0
  35. package/lib/app/services/form-service.js +379 -0
  36. package/lib/app/services/form-validation.js +562 -0
  37. package/lib/app/services/native-page-compiler.js +92 -0
  38. package/lib/app/services/native-page-schema-builder.js +428 -0
  39. package/lib/app/services/page-resource-service.js +185 -0
  40. package/lib/app/update-app.js +22 -9
  41. package/lib/app/update-form-config.js +4 -2
  42. package/lib/asset/asset-cmd.js +19 -6
  43. package/lib/auth/oauth-loopback.js +376 -15
  44. package/lib/auth/token-auth.js +34 -3
  45. package/lib/auth/token-store.js +22 -4
  46. package/lib/basic-info/basic-info.js +2 -1
  47. package/lib/bridge/bridge.js +43 -18
  48. package/lib/core/agent-capabilities.js +5 -3
  49. package/lib/core/command-errors.js +38 -0
  50. package/lib/core/command-manifest.js +59 -1
  51. package/lib/core/copy.js +12 -0
  52. package/lib/core/doctor.js +15 -4
  53. package/lib/core/env-cmd.js +1 -1
  54. package/lib/core/env.js +7 -6
  55. package/lib/core/i18n.js +66 -8
  56. package/lib/core/legacy-schema-guard.js +408 -0
  57. package/lib/core/locales/en.js +38 -46
  58. package/lib/core/locales/zh.js +30 -46
  59. package/lib/core/sample.js +12 -2
  60. package/lib/core/utils.js +334 -66
  61. package/lib/core/yida-client.js +108 -5
  62. package/lib/corp-efficiency/corp-efficiency.js +2 -2
  63. package/lib/corp-manager/corp-manager.js +3 -3
  64. package/lib/formula/evaluate.js +11 -68
  65. package/lib/formula/field-refs.js +83 -0
  66. package/lib/i18n-management/i18n-management.js +2 -3
  67. package/lib/process/configure-process.js +44 -1992
  68. package/lib/process/create-process.js +54 -87
  69. package/lib/process/preview-process.js +20 -8
  70. package/lib/process/services/process-compiler.js +2056 -0
  71. package/lib/process/services/process-reader.js +232 -0
  72. package/lib/process/services/process-resource-service.js +571 -0
  73. package/lib/process/services/process-service.js +122 -0
  74. package/lib/process/services/process-stage-checkpoint.js +246 -0
  75. package/lib/report/append.js +7 -26
  76. package/lib/report/http.js +31 -5
  77. package/lib/report/index.js +10 -2
  78. package/lib/samples/yida-canvas-custom-page/business-list.canvas.jsx +63 -14
  79. package/lib/samples/yida-canvas-custom-page/dashboard-overview.canvas.jsx +176 -32
  80. package/lib/samples/yida-canvas-custom-page/dashboard-starter.canvas.jsx +5 -2
  81. package/lib/samples/yida-canvas-custom-page/data-management.canvas.jsx +228 -14
  82. package/lib/samples/yida-canvas-custom-page/portal-shell-home.canvas.jsx +2 -2
  83. package/lib/samples/yida-canvas-custom-page/split-pane-detail.canvas.jsx +206 -10
  84. package/lib/samples/yida-custom-page/data-management.oyd.jsx +14 -3
  85. package/lib/samples/yida-custom-page/design-tokens.js +2 -2
  86. package/lib/samples/yida-custom-page/detail-profile.oyd.jsx +1 -1
  87. package/lib/samples/yida-custom-page/portal-shell-home.oyd.jsx +7 -2
  88. package/lib/samples/yida-custom-page/split-pane-detail.oyd.jsx +2 -1
  89. package/lib/schema/adapters/app-adapter.js +210 -0
  90. package/lib/schema/adapters/form-adapter.js +1362 -0
  91. package/lib/schema/adapters/keys.js +19 -0
  92. package/lib/schema/adapters/page-adapter.js +566 -0
  93. package/lib/schema/adapters/process-adapter.js +519 -0
  94. package/lib/schema/applier.js +1878 -0
  95. package/lib/schema/apply-store.js +1083 -0
  96. package/lib/schema/command.js +645 -0
  97. package/lib/schema/dependency-graph.js +83 -0
  98. package/lib/schema/errors.js +481 -0
  99. package/lib/schema/hash.js +9 -0
  100. package/lib/schema/manifest-limits.js +177 -0
  101. package/lib/schema/manifest-loader.js +309 -0
  102. package/lib/schema/manifest-schema-v1.json +193 -0
  103. package/lib/schema/normalize-manifest.js +281 -0
  104. package/lib/schema/page-canvas-foundation.js +447 -0
  105. package/lib/schema/page-data-source-builder.js +561 -0
  106. package/lib/schema/page-foundation.js +556 -0
  107. package/lib/schema/page-source-loader.js +314 -0
  108. package/lib/schema/planner.js +691 -0
  109. package/lib/schema/remote-dispatch-boundary.js +39 -0
  110. package/lib/schema/remote-missing.js +21 -0
  111. package/lib/schema/remote-reader.js +189 -0
  112. package/lib/schema/resource-registry.js +157 -0
  113. package/lib/schema/server-revision.js +71 -0
  114. package/lib/schema/sort.js +28 -0
  115. package/lib/schema/state-store.js +589 -0
  116. package/package.json +10 -8
  117. package/scripts/check-release-risks.js +254 -0
  118. package/scripts/generate-command-docs.js +6 -1
  119. package/scripts/i18n-baseline.json +11 -11
  120. package/scripts/postinstall.js +8 -12
  121. package/scripts/validate-ci.sh +15 -11
  122. package/scripts/validate-i18n.js +30 -9
  123. package/scripts/validate-package-size.js +5 -2
  124. package/scripts/validate-skills.js +4 -0
  125. package/scripts/validate-structure.js +15 -0
  126. package/yida-skills/SKILL.md +117 -30
  127. package/yida-skills/references/schema-as-code-phase1.md +99 -0
  128. package/yida-skills/references/setup-and-env.md +59 -59
  129. package/yida-skills/references/task-retrospective.md +6 -6
  130. package/yida-skills/skills/yida-app/SKILL.md +78 -17
  131. package/yida-skills/skills/yida-canvas-custom-page/SKILL.md +18 -7
  132. package/yida-skills/skills/yida-canvas-custom-page/references/data-bridge-guide.md +3 -3
  133. package/yida-skills/skills/yida-canvas-custom-page/references/page-generation-guide.md +15 -0
  134. package/yida-skills/skills/yida-create-app/SKILL.md +21 -3
  135. package/yida-skills/skills/yida-create-form-page/SKILL.md +19 -1
  136. package/yida-skills/skills/yida-create-page/SKILL.md +16 -3
  137. package/yida-skills/skills/yida-create-process/SKILL.md +100 -4
  138. package/yida-skills/skills/yida-custom-page/SKILL.md +19 -4
  139. package/yida-skills/skills/yida-dashboard/SKILL.md +1 -1
  140. package/yida-skills/skills/yida-dashboard/references/pitfalls.md +1 -1
  141. package/yida-skills/skills/yida-get-schema/SKILL.md +49 -5
  142. package/yida-skills/skills/yida-i18n/SKILL.md +1 -1
  143. package/yida-skills/skills/yida-integration/SKILL.md +7 -1
  144. package/yida-skills/skills/yida-login/SKILL.md +50 -99
  145. package/yida-skills/skills/yida-page-config/SKILL.md +7 -1
  146. package/yida-skills/skills/yida-page-uiux/references/app/blueprint.md +0 -1
  147. package/yida-skills/skills/yida-page-uiux/references/app/navigation-patterns.md +0 -1
  148. package/yida-skills/skills/yida-page-uiux/references/app/role-journey.md +0 -1
  149. package/yida-skills/skills/yida-page-uiux/references/dashboard/app-blueprint.md +0 -1
  150. package/yida-skills/skills/yida-page-uiux/references/dashboard/chart-contracts.md +0 -1
  151. package/yida-skills/skills/yida-page-uiux/references/dashboard/component-contracts.md +0 -1
  152. package/yida-skills/skills/yida-page-uiux/references/dashboard/layout-patterns.md +0 -1
  153. package/yida-skills/skills/yida-page-uiux/references/dashboard/theme-recipes.md +0 -1
  154. package/yida-skills/skills/yida-page-uiux/references/detail/object-narrative.md +0 -1
  155. package/yida-skills/skills/yida-page-uiux/references/detail/section-patterns.md +0 -1
  156. package/yida-skills/skills/yida-page-uiux/references/detail/timeline-and-related.md +0 -1
  157. package/yida-skills/skills/yida-page-uiux/references/landing/assets-workflow.md +0 -1
  158. package/yida-skills/skills/yida-page-uiux/references/landing/industry-playbooks.md +0 -1
  159. package/yida-skills/skills/yida-page-uiux/references/landing/research-levels.md +0 -1
  160. package/yida-skills/skills/yida-page-uiux/references/landing/section-patterns.md +0 -1
  161. package/yida-skills/skills/yida-page-uiux/references/list/drawer-detail.md +0 -1
  162. package/yida-skills/skills/yida-page-uiux/references/list/empty-loading-error.md +0 -1
  163. package/yida-skills/skills/yida-page-uiux/references/list/filter-patterns.md +0 -1
  164. package/yida-skills/skills/yida-page-uiux/references/list/table-patterns.md +0 -1
  165. package/yida-skills/skills/yida-page-uiux/references/scenes/screen.md +0 -1
  166. package/yida-skills/skills/yida-page-uiux/references/workbench/entry-patterns.md +0 -1
  167. package/yida-skills/skills/yida-page-uiux/references/workbench/portal-layouts.md +0 -1
  168. package/yida-skills/skills/yida-page-uiux/references/workbench/task-feed.md +0 -1
  169. package/yida-skills/skills/yida-page-uiux/workflow/output-decision-block.md +1 -1
  170. package/yida-skills/skills/yida-process-rule/SKILL.md +35 -1
  171. package/yida-skills/skills/yida-publish-page/SKILL.md +46 -4
  172. package/yida-skills/skills/yida-report/SKILL.md +9 -235
  173. package/yida-skills/skills/yida-report/references/schema-builder-details.md +239 -0
  174. package/yida-skills/skills/yida-skill-evaluator/SKILL.md +170 -0
  175. package/yida-skills/skills-index.json +238 -54
  176. package/lib/core/locales/ar.js +0 -834
  177. package/lib/core/locales/de.js +0 -834
  178. package/lib/core/locales/es.js +0 -834
  179. package/lib/core/locales/fr.js +0 -834
  180. package/lib/core/locales/hi.js +0 -834
  181. package/lib/core/locales/ja.js +0 -1227
  182. package/lib/core/locales/ko.js +0 -836
  183. package/lib/core/locales/pt.js +0 -834
  184. package/lib/core/locales/vi.js +0 -834
  185. package/lib/core/locales/zh-HK.js +0 -1263
  186. package/project/pages/src/demo-birthday-game.oyd.jsx +0 -832
  187. package/project/pages/src/demo-chip-insight.oyd.jsx +0 -983
  188. package/project/pages/src/demo-compat-smoke.oyd.jsx +0 -58
  189. package/project/pages/src/demo-crm-batch-entry.oyd.jsx +0 -805
  190. package/project/pages/src/demo-crm-dashboard.oyd.jsx +0 -677
  191. package/project/pages/src/demo-future-vision-2026.oyd.jsx +0 -1102
  192. package/project/pages/src/demo-ppt.oyd.jsx +0 -1192
  193. package/project/pages/src/demo-salary-calculator.oyd.jsx +0 -904
  194. package/project/pages/src/openyida-knowledge-doc.oyd.jsx +0 -1714
  195. package/yida-skills/skills/large-file-write/SKILL.md +0 -93
  196. package/yida-skills/skills/large-file-write/references/write-patterns.md +0 -147
  197. package/yida-skills/skills/large-file-write/scripts/write.js +0 -157
  198. package/yida-skills/skills/sls-log-workbench/SKILL.md +0 -134
  199. package/yida-skills/skills/sls-log-workbench/references/workbench-reference.md +0 -130
  200. package/yida-skills/skills/sls-log-workbench/sls-query.js +0 -295
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+
3
+ const crypto = require('crypto');
4
+ const { compileCanvasLocal } = require('../canvas-compile');
5
+ const { schemaError } = require('../../schema/errors');
6
+ const { isLoadedPageSource } = require('../../schema/page-source-loader');
7
+
8
+ const CANVAS_PAGE_PROFILE = 'canvas/default';
9
+ const COMPILED_CANVAS_PAGES = new WeakSet();
10
+
11
+ function compileCanvasPageSource(loadedSource) {
12
+ if (!isLoadedPageSource(loadedSource)) {
13
+ compilerError('SCHEMA_PAGE_SOURCE_INVALID', 'Canvas page compiler requires a trusted page source.');
14
+ }
15
+ if (typeof loadedSource.source !== 'string' || loadedSource.source.trim() === '') {
16
+ compilerError('SCHEMA_PAGE_SOURCE_COMPILE_FAILED', 'Canvas page source did not pass local validation.', {
17
+ stage: 'canvas',
18
+ });
19
+ }
20
+
21
+ let canvasResult;
22
+ try {
23
+ canvasResult = compileCanvasLocal(loadedSource.source);
24
+ } catch (error) {
25
+ compilerError('SCHEMA_PAGE_SOURCE_COMPILE_FAILED', 'Canvas page source could not be compiled.', {
26
+ stage: 'canvas',
27
+ });
28
+ }
29
+
30
+ if (
31
+ !canvasResult ||
32
+ typeof canvasResult.runtimeCode !== 'string' ||
33
+ !canvasResult.runtimeCode ||
34
+ !/\bYidaComp\b/.test(canvasResult.runtimeCode) ||
35
+ typeof canvasResult.importedModules !== 'string' ||
36
+ !isJsonArrayString(canvasResult.importedModules)
37
+ ) {
38
+ compilerError('SCHEMA_PAGE_SOURCE_COMPILE_FAILED', 'Canvas page output did not match the runtime contract.', {
39
+ stage: 'canvas',
40
+ });
41
+ }
42
+
43
+ const result = Object.freeze({
44
+ compiledHash: createCanvasCompiledHash(
45
+ canvasResult.runtimeCode,
46
+ canvasResult.importedModules
47
+ ),
48
+ importedModules: canvasResult.importedModules,
49
+ inputHash: loadedSource.sourceHash,
50
+ profile: CANVAS_PAGE_PROFILE,
51
+ runtimeCode: canvasResult.runtimeCode,
52
+ source: loadedSource.source,
53
+ sourceHash: createSha256(loadedSource.source),
54
+ });
55
+ COMPILED_CANVAS_PAGES.add(result);
56
+ return result;
57
+ }
58
+
59
+ function isCompiledCanvasPage(value) {
60
+ return !!(value && typeof value === 'object' && COMPILED_CANVAS_PAGES.has(value));
61
+ }
62
+
63
+ function createCanvasCompiledHash(runtimeCode, importedModules) {
64
+ return createSha256(JSON.stringify({
65
+ importedModules: String(importedModules || ''),
66
+ runtimeCode: String(runtimeCode || ''),
67
+ }));
68
+ }
69
+
70
+ function isJsonArrayString(value) {
71
+ try {
72
+ return Array.isArray(JSON.parse(value));
73
+ } catch {
74
+ return false;
75
+ }
76
+ }
77
+
78
+ function createSha256(value) {
79
+ return 'sha256:' + crypto.createHash('sha256').update(value).digest('hex');
80
+ }
81
+
82
+ function compilerError(code, message, details) {
83
+ throw schemaError(code, message, details ? { details } : undefined);
84
+ }
85
+
86
+ module.exports = {
87
+ CANVAS_PAGE_PROFILE,
88
+ compileCanvasPageSource,
89
+ createCanvasCompiledHash,
90
+ isCompiledCanvasPage,
91
+ };
@@ -0,0 +1,149 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ createNodeIdGenerator,
5
+ generateSuffix,
6
+ getGlobalDataSourceFitConfig,
7
+ } = require('./native-page-schema-builder');
8
+
9
+ const CANVAS_ACTIONS_SOURCE = 'export function didMount() {}';
10
+ const CANVAS_ACTIONS_COMPILED = '"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.didMount=didMount;function didMount(){}';
11
+
12
+ function buildCanvasPageSchemaContent(sourceCode, runtimeCode, importedModules, formUuid, options = {}) {
13
+ return JSON.stringify(buildCanvasPageSchemaObject(
14
+ sourceCode,
15
+ runtimeCode,
16
+ importedModules,
17
+ formUuid,
18
+ options
19
+ ));
20
+ }
21
+
22
+ function buildCanvasPageSchemaObject(sourceCode, runtimeCode, importedModules, formUuid, options = {}) {
23
+ const nextNodeId = resolveSchemaBuilderDependency(
24
+ options.nextNodeId,
25
+ createNodeIdGenerator,
26
+ 'nextNodeId'
27
+ );
28
+ const nextSuffix = resolveSchemaBuilderDependency(
29
+ options.nextSuffix,
30
+ () => generateSuffix,
31
+ 'nextSuffix'
32
+ );
33
+ const constructorCode = "function constructor() {\nvar module = { exports: {} };\nvar _this = this;\nthis.__initMethods__(module.exports, module);\nObject.keys(module.exports).forEach(function(item) {\n if(typeof module.exports[item] === 'function'){\n _this[item] = module.exports[item];\n }\n});\n\n}";
34
+
35
+ return {
36
+ schemaType: 'superform',
37
+ schemaVersion: '5.0',
38
+ pages: [
39
+ {
40
+ utils: [
41
+ {
42
+ name: 'legaoBuiltin',
43
+ type: 'npm',
44
+ content: { package: '@ali/vu-legao-builtin', version: '3.0.0', exportName: 'legaoBuiltin' },
45
+ },
46
+ {
47
+ name: 'yidaPlugin',
48
+ type: 'npm',
49
+ content: { package: '@ali/vu-yida-plugin', version: '1.1.0', exportName: 'yidaPlugin' },
50
+ },
51
+ ],
52
+ componentsMap: [
53
+ { package: '@ali/vc-deep-yida', version: '1.5.169', componentName: 'YidaCodeCanvas' },
54
+ { package: '@ali/vc-deep-yida', version: '1.5.169', componentName: 'RootHeader' },
55
+ { package: '@ali/vc-deep-yida', version: '1.5.169', componentName: 'RootContent' },
56
+ { package: '@ali/vc-deep-yida', version: '1.5.169', componentName: 'RootFooter' },
57
+ { package: '@ali/vc-deep-yida', version: '1.5.169', componentName: 'Page' },
58
+ ],
59
+ componentsTree: [
60
+ {
61
+ componentName: 'Page',
62
+ id: nextNodeId(),
63
+ props: {
64
+ contentBgColor: 'white',
65
+ pageStyle: { backgroundColor: '#f2f3f5' },
66
+ contentMargin: '0',
67
+ contentPadding: '0',
68
+ showTitle: false,
69
+ contentPaddingMobile: '0',
70
+ templateVersion: '1.0.0',
71
+ contentMarginMobile: '0',
72
+ className: 'page_' + nextSuffix(),
73
+ contentBgColorMobile: 'white',
74
+ },
75
+ condition: true,
76
+ css: 'body{background-color:#f2f3f5}.vc-page-yida-page{--yida-form-content-padding:0;--yida-form-content-margin:0;--yida-layout-padding:0}.vc-deep-container-entry.vc-rootcontent{padding:0!important;margin-top:0!important;margin-right:0!important;margin-bottom:0!important;margin-left:0!important}',
77
+ methods: {
78
+ __initMethods__: {
79
+ type: 'js',
80
+ source: 'function (exports, module) { /*set actions code here*/ }',
81
+ compiled: 'function (exports, module) { /*set actions code here*/ }',
82
+ },
83
+ },
84
+ dataSource: {
85
+ offline: [],
86
+ globalConfig: getGlobalDataSourceFitConfig(),
87
+ online: [],
88
+ list: [],
89
+ sync: true,
90
+ },
91
+ lifeCycles: {
92
+ constructor: { type: 'js', compiled: constructorCode, source: constructorCode },
93
+ componentWillUnmount: '',
94
+ componentDidMount: { name: 'didMount', id: 'didMount', params: {}, type: 'actionRef' },
95
+ },
96
+ hidden: false,
97
+ title: '',
98
+ isLocked: false,
99
+ conditionGroup: '',
100
+ children: [
101
+ {
102
+ componentName: 'YidaCodeCanvas',
103
+ id: nextNodeId(),
104
+ props: {
105
+ code: sourceCode,
106
+ runtimeCode,
107
+ pageType: 'application',
108
+ isWebCCompiled: true,
109
+ componentProps: {},
110
+ importedModules: importedModules || '',
111
+ },
112
+ condition: true,
113
+ hidden: false,
114
+ title: '',
115
+ isLocked: false,
116
+ conditionGroup: '',
117
+ },
118
+ ],
119
+ },
120
+ ],
121
+ id: formUuid,
122
+ connectComponent: [],
123
+ },
124
+ ],
125
+ actions: {
126
+ module: { compiled: CANVAS_ACTIONS_COMPILED, source: CANVAS_ACTIONS_SOURCE },
127
+ type: 'FUNCTION',
128
+ list: [{ id: 'didMount', title: 'didMount' }],
129
+ },
130
+ config: { connectComponent: [] },
131
+ };
132
+ }
133
+
134
+ function resolveSchemaBuilderDependency(value, createDefault, property) {
135
+ if (value === undefined) {
136
+ return createDefault();
137
+ }
138
+ if (typeof value !== 'function') {
139
+ throw new TypeError(`buildCanvasPageSchemaContent ${property} must be a function`);
140
+ }
141
+ return value;
142
+ }
143
+
144
+ module.exports = Object.freeze({
145
+ CANVAS_ACTIONS_COMPILED,
146
+ CANVAS_ACTIONS_SOURCE,
147
+ buildCanvasPageSchemaContent,
148
+ buildCanvasPageSchemaObject,
149
+ });
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+
3
+ const { normalizeSchemaFields } = require('../schema-field-resolution');
4
+
5
+ function normalizeSchemaResult(schemaResult) {
6
+ if (schemaResult && schemaResult.content) {
7
+ return schemaResult;
8
+ }
9
+ return { content: schemaResult || {} };
10
+ }
11
+
12
+ function normalizeExpectedBinding(value) {
13
+ if (typeof value === 'string') {
14
+ return { fieldId: value };
15
+ }
16
+ if (value && typeof value === 'object') {
17
+ const fieldId = value.fieldId || value.id || value.value || '';
18
+ return Object.assign({}, value, { fieldId: String(fieldId || '') });
19
+ }
20
+ return { fieldId: '' };
21
+ }
22
+
23
+ function verifyFieldBindings(schemaResult, expectedBindings, options) {
24
+ const expectedComponentTypes = options && options.expectedComponentTypes || {};
25
+ const fields = normalizeSchemaFields(normalizeSchemaResult(schemaResult));
26
+ const fieldsById = new Map();
27
+ fields.forEach(function (field) {
28
+ if (field.fieldId) {
29
+ fieldsById.set(field.fieldId, field);
30
+ }
31
+ });
32
+
33
+ const verification = {
34
+ verified: [],
35
+ missing: [],
36
+ mismatched: [],
37
+ };
38
+
39
+ Object.keys(expectedBindings || {}).forEach(function (semanticPath) {
40
+ const expected = normalizeExpectedBinding(expectedBindings[semanticPath]);
41
+ const fieldId = expected.fieldId;
42
+ const expectedComponentType = expected.componentType || expected.componentName || expectedComponentTypes[semanticPath] || '';
43
+
44
+ if (!fieldId || !fieldsById.has(fieldId)) {
45
+ verification.missing.push({ semanticPath, fieldId });
46
+ return;
47
+ }
48
+
49
+ const actual = fieldsById.get(fieldId);
50
+ if (expectedComponentType && actual.componentType !== expectedComponentType) {
51
+ verification.mismatched.push({
52
+ semanticPath,
53
+ fieldId,
54
+ expectedComponentType,
55
+ actualComponentType: actual.componentType,
56
+ });
57
+ return;
58
+ }
59
+
60
+ verification.verified.push(semanticPath);
61
+ });
62
+
63
+ return verification;
64
+ }
65
+
66
+ module.exports = {
67
+ verifyFieldBindings,
68
+ };