@jsonforms/core 3.0.0-alpha.1 → 3.0.0-beta.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.
Files changed (228) hide show
  1. package/docs/assets/js/search.json +1 -1
  2. package/docs/globals.html +822 -405
  3. package/docs/index.html +69 -36
  4. package/docs/interfaces/addcellrendereraction.html +3 -3
  5. package/docs/interfaces/addrendereraction.html +3 -3
  6. package/docs/interfaces/adduischemaaction.html +3 -3
  7. package/docs/interfaces/arraycontrolprops.html +21 -21
  8. package/docs/interfaces/arraylayoutprops.html +21 -21
  9. package/docs/interfaces/cellprops.html +14 -14
  10. package/docs/interfaces/combinatorrendererprops.html +13 -13
  11. package/docs/interfaces/controlprops.html +16 -16
  12. package/docs/interfaces/controlstate.html +2 -2
  13. package/docs/interfaces/controlwithdetailprops.html +17 -17
  14. package/docs/interfaces/dispatchcellprops.html +13 -13
  15. package/docs/interfaces/dispatchcellstateprops.html +13 -13
  16. package/docs/interfaces/dispatchpropsofarraycontrol.html +4 -4
  17. package/docs/interfaces/dispatchpropsofcontrol.html +1 -1
  18. package/docs/interfaces/dispatchpropsofmultienumcontrol.html +2 -2
  19. package/docs/interfaces/enumcellprops.html +15 -15
  20. package/docs/interfaces/enumoption.html +2 -2
  21. package/docs/interfaces/initaction.html +6 -6
  22. package/docs/interfaces/initactionoptions.html +3 -3
  23. package/docs/interfaces/jsonformscore.html +7 -7
  24. package/docs/interfaces/{jsonformslocalestate.html → jsonformsi18nstate.html} +20 -20
  25. package/docs/interfaces/jsonformsprops.html +9 -9
  26. package/docs/interfaces/jsonformssubstates.html +11 -1
  27. package/docs/interfaces/layoutprops.html +10 -10
  28. package/docs/interfaces/ownpropsofcell.html +10 -10
  29. package/docs/interfaces/ownpropsofcontrol.html +9 -9
  30. package/docs/interfaces/ownpropsofenum.html +1 -1
  31. package/docs/interfaces/ownpropsofenumcell.html +11 -11
  32. package/docs/interfaces/ownpropsofjsonformsrenderer.html +8 -8
  33. package/docs/interfaces/ownpropsoflayout.html +9 -9
  34. package/docs/interfaces/ownpropsofmasterlistitem.html +6 -6
  35. package/docs/interfaces/ownpropsofrenderer.html +8 -8
  36. package/docs/interfaces/registerdefaultdataaction.html +3 -3
  37. package/docs/interfaces/removecellrendereraction.html +3 -3
  38. package/docs/interfaces/removerendereraction.html +3 -3
  39. package/docs/interfaces/removeuischemaaction.html +2 -2
  40. package/docs/interfaces/rendererprops.html +9 -9
  41. package/docs/interfaces/setajvaction.html +3 -3
  42. package/docs/interfaces/setconfigaction.html +2 -2
  43. package/docs/interfaces/setlocaleaction.html +3 -3
  44. package/docs/interfaces/setschemaaction.html +2 -2
  45. package/docs/interfaces/{setlocalizedschemasaction.html → settranslatoraction.html} +29 -15
  46. package/docs/interfaces/setuischemaaction.html +2 -2
  47. package/docs/interfaces/setvalidationmodeaction.html +2 -2
  48. package/docs/interfaces/statepropsofarraycontrol.html +17 -17
  49. package/docs/interfaces/statepropsofarraylayout.html +17 -17
  50. package/docs/interfaces/statepropsofcell.html +13 -13
  51. package/docs/interfaces/statepropsofcombinator.html +12 -12
  52. package/docs/interfaces/statepropsofcontrol.html +15 -15
  53. package/docs/interfaces/statepropsofcontrolwithdetail.html +16 -16
  54. package/docs/interfaces/statepropsofenumcell.html +14 -14
  55. package/docs/interfaces/statepropsofjsonformsrenderer.html +9 -9
  56. package/docs/interfaces/statepropsoflayout.html +10 -10
  57. package/docs/interfaces/statepropsofmasteritem.html +7 -7
  58. package/docs/interfaces/statepropsofrenderer.html +9 -9
  59. package/docs/interfaces/statepropsofscopedrenderer.html +12 -12
  60. package/docs/interfaces/unregisterdefaultdataaction.html +2 -2
  61. package/docs/interfaces/updateaction.html +3 -3
  62. package/docs/interfaces/updatecoreaction.html +6 -6
  63. package/docs/interfaces/updateerrorsaction.html +2 -2
  64. package/docs/interfaces/{setlocalizeduischemasaction.html → updatei18naction.html} +43 -15
  65. package/docs/interfaces/withclassname.html +1 -1
  66. package/lib/Helpers.d.ts +5 -5
  67. package/lib/actions/actions.d.ts +181 -177
  68. package/lib/actions/index.d.ts +1 -1
  69. package/lib/configDefault.d.ts +6 -6
  70. package/lib/generators/Generate.d.ts +6 -6
  71. package/lib/generators/index.d.ts +3 -3
  72. package/lib/generators/schema.d.ts +8 -8
  73. package/lib/generators/uischema.d.ts +12 -12
  74. package/lib/i18n/i18nTypes.d.ts +15 -0
  75. package/lib/i18n/i18nUtil.d.ts +18 -0
  76. package/lib/i18n/index.d.ts +2 -0
  77. package/lib/index.d.ts +11 -10
  78. package/lib/jsonforms-core.cjs.js +2445 -0
  79. package/lib/jsonforms-core.cjs.js.map +1 -0
  80. package/lib/jsonforms-core.esm.js +2164 -0
  81. package/lib/jsonforms-core.esm.js.map +1 -0
  82. package/lib/models/draft4.d.ts +198 -198
  83. package/lib/models/index.d.ts +5 -5
  84. package/lib/models/jsonSchema.d.ts +3 -3
  85. package/lib/models/jsonSchema4.d.ts +110 -110
  86. package/lib/models/jsonSchema7.d.ts +119 -119
  87. package/lib/models/uischema.d.ts +201 -201
  88. package/lib/reducers/cells.d.ts +11 -11
  89. package/lib/reducers/config.d.ts +3 -3
  90. package/lib/reducers/core.d.ts +24 -23
  91. package/lib/reducers/default-data.d.ts +10 -10
  92. package/lib/reducers/i18n.d.ts +8 -11
  93. package/lib/reducers/index.d.ts +9 -9
  94. package/lib/reducers/reducers.d.ts +29 -36
  95. package/lib/reducers/renderers.d.ts +10 -10
  96. package/lib/reducers/selectors.d.ts +15 -15
  97. package/lib/reducers/uischemas.d.ts +10 -10
  98. package/lib/store.d.ts +53 -52
  99. package/lib/testers/index.d.ts +1 -1
  100. package/lib/testers/testers.d.ts +203 -203
  101. package/lib/util/Formatted.d.ts +19 -19
  102. package/lib/util/array.d.ts +3 -3
  103. package/lib/util/cell.d.ts +79 -79
  104. package/lib/util/combinators.d.ts +10 -10
  105. package/lib/util/ids.d.ts +3 -3
  106. package/lib/util/index.d.ts +15 -15
  107. package/lib/util/label.d.ts +9 -9
  108. package/lib/util/path.d.ts +25 -25
  109. package/lib/util/renderer.d.ts +398 -387
  110. package/lib/util/resolvers.d.ts +25 -25
  111. package/lib/util/runtime.d.ts +18 -19
  112. package/lib/util/schema.d.ts +1 -1
  113. package/lib/util/type.d.ts +174 -174
  114. package/lib/util/uischema.d.ts +5 -5
  115. package/lib/util/util.d.ts +31 -31
  116. package/lib/util/validator.d.ts +3 -2
  117. package/package.json +18 -14
  118. package/rollup.config.js +44 -0
  119. package/src/actions/actions.ts +46 -36
  120. package/src/i18n/i18nTypes.ts +17 -0
  121. package/src/i18n/i18nUtil.ts +105 -0
  122. package/src/i18n/index.ts +2 -0
  123. package/src/index.ts +1 -0
  124. package/src/reducers/core.ts +70 -48
  125. package/src/reducers/i18n.ts +41 -35
  126. package/src/reducers/reducers.ts +10 -29
  127. package/src/reducers/selectors.ts +1 -1
  128. package/src/store.ts +4 -4
  129. package/src/util/cell.ts +26 -6
  130. package/src/util/renderer.ts +127 -38
  131. package/src/util/runtime.ts +1 -1
  132. package/src/util/util.ts +1 -1
  133. package/src/util/validator.ts +5 -9
  134. package/stats.html +3279 -0
  135. package/{lib/reducers/cells.js → test/i18n/i18nUtil.test.ts} +25 -17
  136. package/test/reducers/core.test.ts +31 -44
  137. package/test/util/cell.test.ts +2 -2
  138. package/test/util/renderer.test.ts +488 -35
  139. package/lib/Helpers.js +0 -32
  140. package/lib/Helpers.js.map +0 -1
  141. package/lib/actions/actions.js +0 -149
  142. package/lib/actions/actions.js.map +0 -1
  143. package/lib/actions/index.js +0 -29
  144. package/lib/actions/index.js.map +0 -1
  145. package/lib/configDefault.js +0 -47
  146. package/lib/configDefault.js.map +0 -1
  147. package/lib/generators/Generate.js +0 -34
  148. package/lib/generators/Generate.js.map +0 -1
  149. package/lib/generators/index.js +0 -31
  150. package/lib/generators/index.js.map +0 -1
  151. package/lib/generators/schema.js +0 -152
  152. package/lib/generators/schema.js.map +0 -1
  153. package/lib/generators/uischema.js +0 -166
  154. package/lib/generators/uischema.js.map +0 -1
  155. package/lib/index.js +0 -37
  156. package/lib/index.js.map +0 -1
  157. package/lib/jsonforms-core.js +0 -19
  158. package/lib/jsonforms-core.js.map +0 -1
  159. package/lib/models/draft4.js +0 -173
  160. package/lib/models/draft4.js.map +0 -1
  161. package/lib/models/index.js +0 -30
  162. package/lib/models/index.js.map +0 -1
  163. package/lib/models/jsonSchema.js +0 -27
  164. package/lib/models/jsonSchema.js.map +0 -1
  165. package/lib/models/jsonSchema4.js +0 -30
  166. package/lib/models/jsonSchema4.js.map +0 -1
  167. package/lib/models/jsonSchema7.js +0 -30
  168. package/lib/models/jsonSchema7.js.map +0 -1
  169. package/lib/models/uischema.js +0 -55
  170. package/lib/models/uischema.js.map +0 -1
  171. package/lib/reducers/cells.js.map +0 -1
  172. package/lib/reducers/config.js +0 -44
  173. package/lib/reducers/config.js.map +0 -1
  174. package/lib/reducers/core.js +0 -259
  175. package/lib/reducers/core.js.map +0 -1
  176. package/lib/reducers/default-data.js +0 -42
  177. package/lib/reducers/default-data.js.map +0 -1
  178. package/lib/reducers/i18n.js +0 -65
  179. package/lib/reducers/i18n.js.map +0 -1
  180. package/lib/reducers/index.js +0 -37
  181. package/lib/reducers/index.js.map +0 -1
  182. package/lib/reducers/reducers.js +0 -99
  183. package/lib/reducers/reducers.js.map +0 -1
  184. package/lib/reducers/renderers.js +0 -41
  185. package/lib/reducers/renderers.js.map +0 -1
  186. package/lib/reducers/selectors.js +0 -47
  187. package/lib/reducers/selectors.js.map +0 -1
  188. package/lib/reducers/uischemas.js +0 -57
  189. package/lib/reducers/uischemas.js.map +0 -1
  190. package/lib/store.js +0 -27
  191. package/lib/store.js.map +0 -1
  192. package/lib/testers/index.js +0 -29
  193. package/lib/testers/index.js.map +0 -1
  194. package/lib/testers/testers.js +0 -401
  195. package/lib/testers/testers.js.map +0 -1
  196. package/lib/util/Formatted.js +0 -27
  197. package/lib/util/Formatted.js.map +0 -1
  198. package/lib/util/array.js +0 -43
  199. package/lib/util/array.js.map +0 -1
  200. package/lib/util/cell.js +0 -133
  201. package/lib/util/cell.js.map +0 -1
  202. package/lib/util/combinators.js +0 -56
  203. package/lib/util/combinators.js.map +0 -1
  204. package/lib/util/ids.js +0 -50
  205. package/lib/util/ids.js.map +0 -1
  206. package/lib/util/index.js +0 -41
  207. package/lib/util/index.js.map +0 -1
  208. package/lib/util/label.js +0 -70
  209. package/lib/util/label.js.map +0 -1
  210. package/lib/util/path.js +0 -85
  211. package/lib/util/path.js.map +0 -1
  212. package/lib/util/renderer.js +0 -451
  213. package/lib/util/renderer.js.map +0 -1
  214. package/lib/util/resolvers.js +0 -165
  215. package/lib/util/resolvers.js.map +0 -1
  216. package/lib/util/runtime.js +0 -159
  217. package/lib/util/runtime.js.map +0 -1
  218. package/lib/util/schema.js +0 -40
  219. package/lib/util/schema.js.map +0 -1
  220. package/lib/util/type.js +0 -27
  221. package/lib/util/type.js.map +0 -1
  222. package/lib/util/uischema.js +0 -52
  223. package/lib/util/uischema.js.map +0 -1
  224. package/lib/util/util.js +0 -107
  225. package/lib/util/util.js.map +0 -1
  226. package/lib/util/validator.js +0 -36
  227. package/lib/util/validator.js.map +0 -1
  228. package/webpack.build.js +0 -13
@@ -1,149 +0,0 @@
1
- "use strict";
2
- /*
3
- The MIT License
4
-
5
- Copyright (c) 2017-2019 EclipseSource Munich
6
- https://github.com/eclipsesource/jsonforms
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in
16
- all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- THE SOFTWARE.
25
- */
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- var generators_1 = require("../generators");
28
- exports.INIT = 'jsonforms/INIT';
29
- exports.UPDATE_CORE = "jsonforms/UPDATE_CORE";
30
- exports.SET_AJV = 'jsonforms/SET_AJV';
31
- exports.UPDATE_DATA = 'jsonforms/UPDATE';
32
- exports.UPDATE_ERRORS = 'jsonforms/UPDATE_ERRORS';
33
- exports.VALIDATE = 'jsonforms/VALIDATE';
34
- exports.ADD_RENDERER = 'jsonforms/ADD_RENDERER';
35
- exports.REMOVE_RENDERER = 'jsonforms/REMOVE_RENDERER';
36
- exports.ADD_CELL = 'jsonforms/ADD_CELL';
37
- exports.REMOVE_CELL = 'jsonforms/REMOVE_CELL';
38
- exports.SET_CONFIG = 'jsonforms/SET_CONFIG';
39
- exports.ADD_UI_SCHEMA = "jsonforms/ADD_UI_SCHEMA";
40
- exports.REMOVE_UI_SCHEMA = "jsonforms/REMOVE_UI_SCHEMA";
41
- exports.SET_SCHEMA = "jsonforms/SET_SCHEMA";
42
- exports.SET_UISCHEMA = "jsonforms/SET_UISCHEMA";
43
- exports.SET_VALIDATION_MODE = 'jsonforms/SET_VALIDATION_MODE';
44
- exports.SET_LOCALE = "jsonforms/SET_LOCALE";
45
- exports.SET_LOCALIZED_SCHEMAS = 'jsonforms/SET_LOCALIZED_SCHEMAS';
46
- exports.SET_LOCALIZED_UISCHEMAS = 'jsonforms/SET_LOCALIZED_UISCHEMAS';
47
- exports.ADD_DEFAULT_DATA = "jsonforms/ADD_DEFAULT_DATA";
48
- exports.REMOVE_DEFAULT_DATA = "jsonforms/REMOVE_DEFAULT_DATA";
49
- exports.init = function (data, schema, uischema, options) {
50
- if (schema === void 0) { schema = generators_1.generateJsonSchema(data); }
51
- return ({
52
- type: exports.INIT,
53
- data: data,
54
- schema: schema,
55
- uischema: typeof uischema === 'object' ? uischema : generators_1.generateDefaultUISchema(schema),
56
- options: options
57
- });
58
- };
59
- exports.updateCore = function (data, schema, uischema, options) { return ({
60
- type: exports.UPDATE_CORE,
61
- data: data,
62
- schema: schema,
63
- uischema: uischema,
64
- options: options
65
- }); };
66
- exports.registerDefaultData = function (schemaPath, data) { return ({
67
- type: exports.ADD_DEFAULT_DATA,
68
- schemaPath: schemaPath,
69
- data: data
70
- }); };
71
- exports.unregisterDefaultData = function (schemaPath) { return ({
72
- type: exports.REMOVE_DEFAULT_DATA,
73
- schemaPath: schemaPath
74
- }); };
75
- exports.setAjv = function (ajv) { return ({
76
- type: exports.SET_AJV,
77
- ajv: ajv
78
- }); };
79
- exports.update = function (path, updater) { return ({
80
- type: exports.UPDATE_DATA,
81
- path: path,
82
- updater: updater
83
- }); };
84
- exports.updateErrors = function (errors) { return ({
85
- type: exports.UPDATE_ERRORS,
86
- errors: errors
87
- }); };
88
- exports.registerRenderer = function (tester, renderer) { return ({
89
- type: exports.ADD_RENDERER,
90
- tester: tester,
91
- renderer: renderer
92
- }); };
93
- exports.registerCell = function (tester, cell) { return ({
94
- type: exports.ADD_CELL,
95
- tester: tester,
96
- cell: cell
97
- }); };
98
- exports.unregisterCell = function (tester, cell) { return ({
99
- type: exports.REMOVE_CELL,
100
- tester: tester,
101
- cell: cell
102
- }); };
103
- exports.unregisterRenderer = function (tester, renderer) { return ({
104
- type: exports.REMOVE_RENDERER,
105
- tester: tester,
106
- renderer: renderer
107
- }); };
108
- exports.setConfig = function (config) { return ({
109
- type: exports.SET_CONFIG,
110
- config: config
111
- }); };
112
- exports.setValidationMode = function (validationMode) { return ({
113
- type: exports.SET_VALIDATION_MODE,
114
- validationMode: validationMode
115
- }); };
116
- exports.registerUISchema = function (tester, uischema) {
117
- return {
118
- type: exports.ADD_UI_SCHEMA,
119
- tester: tester,
120
- uischema: uischema
121
- };
122
- };
123
- exports.unregisterUISchema = function (tester) {
124
- return {
125
- type: exports.REMOVE_UI_SCHEMA,
126
- tester: tester
127
- };
128
- };
129
- exports.setLocale = function (locale) { return ({
130
- type: exports.SET_LOCALE,
131
- locale: locale
132
- }); };
133
- exports.setLocalizedSchemas = function (localizedSchemas) { return ({
134
- type: exports.SET_LOCALIZED_SCHEMAS,
135
- localizedSchemas: localizedSchemas
136
- }); };
137
- exports.setSchema = function (schema) { return ({
138
- type: exports.SET_SCHEMA,
139
- schema: schema
140
- }); };
141
- exports.setLocalizedUISchemas = function (localizedUISchemas) { return ({
142
- type: exports.SET_LOCALIZED_UISCHEMAS,
143
- localizedUISchemas: localizedUISchemas
144
- }); };
145
- exports.setUISchema = function (uischema) { return ({
146
- type: exports.SET_UISCHEMA,
147
- uischema: uischema
148
- }); };
149
- //# sourceMappingURL=actions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/actions/actions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;AAIF,4CAA4E;AAK/D,QAAA,IAAI,GAAqB,gBAAgB,CAAC;AAC1C,QAAA,WAAW,GAA4B,uBAAuB,CAAC;AAC/D,QAAA,OAAO,GAAwB,mBAAmB,CAAC;AACnD,QAAA,WAAW,GAAuB,kBAAkB,CAAC;AACrD,QAAA,aAAa,GACxB,yBAAyB,CAAC;AACf,QAAA,QAAQ,GAAyB,oBAAoB,CAAC;AACtD,QAAA,YAAY,GAA6B,wBAAwB,CAAC;AAClE,QAAA,eAAe,GAC1B,2BAA2B,CAAC;AACjB,QAAA,QAAQ,GAAyB,oBAAoB,CAAC;AACtD,QAAA,WAAW,GAA4B,uBAAuB,CAAC;AAC/D,QAAA,UAAU,GAA2B,sBAAsB,CAAC;AAC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ipsesource/jsonforms
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in
16
- all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- THE SOFTWARE.
25
- */
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- var tslib_1 = require("tslib");
28
- tslib_1.__exportStar(require("./actions"), exports);
29
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;AAEF,oDAA0B"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- /*
3
- The MIT License
4
-
5
- Copyright (c) 2017-2019 EclipseSource Munich
6
- https://github.com/eclipsesource/jsonforms
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in
16
- all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- THE SOFTWARE.
25
- */
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.configDefault = {
28
- /*
29
- * [text] whether to restrict the number of characters to maxLength,
30
- * if specified in the JSON schema
31
- */
32
- restrict: false,
33
- /*
34
- * [text] whether to resize the input's width to maxLength,
35
- * if specified in the JSON schema
36
- */
37
- trim: false,
38
- /*
39
- * [text] if input descriptions should hide when not focused
40
- */
41
- showUnfocusedDescription: false,
42
- /*
43
- * [text] if asterisks in labels for required fields should be hidden
44
- */
45
- hideRequiredAsterisk: false
46
- };
47
- //# sourceMappingURL=configDefault.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configDefault.js","sourceRoot":"","sources":["../src/configDefault.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;AAEW,QAAA,aAAa,GAAG;IAC3B;;;OAGG;IACH,QAAQ,EAAE,KAAK;IAEf;;;OAGG;IACH,IAAI,EAAE,KAAK;IAEX;;OAEG;IACH,wBAAwB,EAAE,KAAK;IAE/B;;OAEG;IACH,oBAAoB,EAAE,KAAK;CAC5B,CAAC"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- /*
3
- The MIT License
4
-
5
- Copyright (c) 2017-2019 EclipseSource Munich
6
- https://github.com/eclipsesource/jsonforms
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in
16
- all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- THE SOFTWARE.
25
- */
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- var schema_1 = require("./schema");
28
- var uischema_1 = require("./uischema");
29
- exports.Generate = {
30
- jsonSchema: schema_1.generateJsonSchema,
31
- uiSchema: uischema_1.generateDefaultUISchema,
32
- controlElement: uischema_1.createControlElement
33
- };
34
- //# sourceMappingURL=Generate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Generate.js","sourceRoot":"","sources":["../../src/generators/Generate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;AAEF,mCAA8C;AAC9C,uCAA2E;AAG9D,QAAA,QAAQ,GASjB;IACF,UAAU,EAAE,2BAAkB;IAC9B,QAAQ,EAAE,kCAAuB;IACjC,cAAc,EAAE,+BAAoB;CACrC,CAAC"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- /*
3
- The MIT License
4
-
5
- Copyright (c) 2017-2019 EclipseSource Munich
6
- https://github.com/eclipsesource/jsonforms
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in
16
- all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- THE SOFTWARE.
25
- */
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- var tslib_1 = require("tslib");
28
- tslib_1.__exportStar(require("./Generate"), exports);
29
- tslib_1.__exportStar(require("./schema"), exports);
30
- tslib_1.__exportStar(require("./uischema"), exports);
31
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;AAEF,qDAA2B;AAC3B,mDAAyB;AACzB,qDAA2B"}
@@ -1,152 +0,0 @@
1
- "use strict";
2
- /*
3
- The MIT License
4
-
5
- Copyright (c) 2017-2019 EclipseSource Munich
6
- https://github.com/eclipsesource/jsonforms
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in
16
- all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- THE SOFTWARE.
25
- */
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- var ADDITIONAL_PROPERTIES = 'additionalProperties';
28
- var REQUIRED_PROPERTIES = 'required';
29
- var distinct = function (properties, discriminator) {
30
- var known = {};
31
- return properties.filter(function (item) {
32
- var discriminatorValue = discriminator(item);
33
- if (known.hasOwnProperty(discriminatorValue)) {
34
- return false;
35
- }
36
- else {
37
- known[discriminatorValue] = true;
38
- return true;
39
- }
40
- });
41
- };
42
- var Gen = /** @class */ (function () {
43
- function Gen(findOption) {
44
- var _this = this;
45
- this.findOption = findOption;
46
- this.schemaObject = function (data) {
47
- var props = _this.properties(data);
48
- var schema = {
49
- type: 'object',
50
- properties: props,
51
- additionalProperties: _this.findOption(props)(ADDITIONAL_PROPERTIES)
52
- };
53
- var required = _this.findOption(props)(REQUIRED_PROPERTIES);
54
- if (required.length > 0) {
55
- schema.required = required;
56
- }
57
- return schema;
58
- };
59
- this.properties = function (data) {
60
- var emptyProps = {};
61
- return Object.keys(data).reduce(function (acc, propName) {
62
- acc[propName] = _this.property(data[propName]);
63
- return acc;
64
- }, emptyProps);
65
- };
66
- this.property = function (data) {
67
- switch (typeof data) {
68
- case 'string':
69
- return { type: 'string' };
70
- case 'boolean':
71
- return { type: 'boolean' };
72
- case 'number':
73
- if (Number.isInteger(data)) {
74
- return { type: 'integer' };
75
- }
76
- return { type: 'number' };
77
- case 'object':
78
- if (data == null) {
79
- return { type: 'null' };
80
- }
81
- return _this.schemaObjectOrArray(data);
82
- default:
83
- return {};
84
- }
85
- };
86
- this.schemaObjectOrArray = function (data) {
87
- if (data instanceof Array) {
88
- return _this.schemaArray(data);
89
- }
90
- else {
91
- return _this.schemaObject(data);
92
- }
93
- };
94
- this.schemaArray = function (data) {
95
- if (data.length > 0) {
96
- var allProperties = data.map(_this.property);
97
- var uniqueProperties = distinct(allProperties, function (prop) {
98
- return JSON.stringify(prop);
99
- });
100
- if (uniqueProperties.length === 1) {
101
- return {
102
- type: 'array',
103
- items: uniqueProperties[0]
104
- };
105
- }
106
- else {
107
- return {
108
- type: 'array',
109
- items: {
110
- oneOf: uniqueProperties
111
- }
112
- };
113
- }
114
- }
115
- else {
116
- return {
117
- type: 'array',
118
- items: {}
119
- };
120
- }
121
- };
122
- }
123
- return Gen;
124
- }());
125
- /**
126
- * Generate a JSON schema based on the given data and any additional options.
127
- * @param {Object} instance the data to create a JSON schema for
128
- * @param {any} options any additional options that may alter the generated JSON schema
129
- * @returns {JsonSchema} the generated schema
130
- */
131
- exports.generateJsonSchema = function (instance, options) {
132
- if (options === void 0) { options = {}; }
133
- var findOption = function (props) { return function (optionName) {
134
- switch (optionName) {
135
- case ADDITIONAL_PROPERTIES:
136
- if (options.hasOwnProperty(ADDITIONAL_PROPERTIES)) {
137
- return options[ADDITIONAL_PROPERTIES];
138
- }
139
- return true;
140
- case REQUIRED_PROPERTIES:
141
- if (options.hasOwnProperty(REQUIRED_PROPERTIES)) {
142
- return options[REQUIRED_PROPERTIES](props);
143
- }
144
- return Object.keys(props);
145
- default:
146
- return;
147
- }
148
- }; };
149
- var gen = new Gen(findOption);
150
- return gen.schemaObject(instance);
151
- };
152
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/generators/schema.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;AAIF,IAAM,qBAAqB,GAAG,sBAAsB,CAAC;AACrD,IAAM,mBAAmB,GAAG,UAAU,CAAC;AAIvC,IAAM,QAAQ,GAAG,UACf,UAAiB,EACjB,aAAoC;IAEpC,IAAM,KAAK,GAAoC,EAAE,CAAC;IAElD,OAAO,UAAU,CAAC,MAAM,CAAC,UAAA,IAAI;QAC3B,IAAM,kBAAkB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE;YAC5C,OAAO,KAAK,CAAC;SACd;aAAM;YACL,KAAK,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;YACjC,OAAO,IAAI,CAAC;SACb;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;IACE,aACU,UAA8D;QADxE,iBAEI;QADM,eAAU,GAAV,UAAU,CAAoD;QAGxE,iBAAY,GAAG,UAAC,IAAY;YAC1B,IAAM,KAAK,GAAe,KAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAChD,IAAM,MAAM,GAAgB;gBAC1B,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,KAAK;gBACjB,oBAAoB,EAAE,KAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,qBAAqB,CAAC;aACpE,CAAC;YACF,IAAM,QAAQ,GAAG,KAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,mBAAmB,CAAC,CAAC;YAC7D,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;gBACvB,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;aAC5B;YAED,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;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CAAC,EAnByC,CAmBzC,CAAC;IAEF,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAEhC,OAAO,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;AACpC,CAAC,CAAC"}
@@ -1,166 +0,0 @@
1
- "use strict";
2
- /*
3
- The MIT License
4
-
5
- Copyright (c) 2017-2019 EclipseSource Munich
6
- https://github.com/eclipsesource/jsonforms
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in
16
- all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- THE SOFTWARE.
25
- */
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- var tslib_1 = require("tslib");
28
- var isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
29
- var startCase_1 = tslib_1.__importDefault(require("lodash/startCase"));
30
- var keys_1 = tslib_1.__importDefault(require("lodash/keys"));
31
- var models_1 = require("../models");
32
- var util_1 = require("../util");
33
- /**
34
- * Creates a new ILayout.
35
- * @param layoutType The type of the laoyut
36
- * @returns the new ILayout
37
- */
38
- var createLayout = function (layoutType) { return ({
39
- type: layoutType,
40
- elements: []
41
- }); };
42
- /**
43
- * Creates a IControlObject with the given label referencing the given ref
44
- */
45
- exports.createControlElement = function (ref) { return ({
46
- type: 'Control',
47
- scope: ref
48
- }); };
49
- /**
50
- * Wraps the given {@code uiSchema} in a Layout if there is none already.
51
- * @param uischema The ui schema to wrap in a layout.
52
- * @param layoutType The type of the layout to create.
53
- * @returns the wrapped uiSchema.
54
- */
55
- var wrapInLayoutIfNecessary = function (uischema, layoutType) {
56
- if (!isEmpty_1.default(uischema) && !models_1.isLayout(uischema)) {
57
- var verticalLayout = createLayout(layoutType);
58
- verticalLayout.elements.push(uischema);
59
- return verticalLayout;
60
- }
61
- return uischema;
62
- };
63
- /**
64
- * Adds the given {@code labelName} to the {@code layout} if it exists
65
- * @param layout
66
- * The layout which is to receive the label
67
- * @param labelName
68
- * The name of the schema
69
- */
70
- var addLabel = function (layout, labelName) {
71
- if (!isEmpty_1.default(labelName)) {
72
- var fixedLabel = startCase_1.default(labelName);
73
- if (models_1.isGroup(layout)) {
74
- layout.label = fixedLabel;
75
- }
76
- else {
77
- // add label with name
78
- var label = {
79
- type: 'Label',
80
- text: fixedLabel
81
- };
82
- layout.elements.push(label);
83
- }
84
- }
85
- };
86
- /**
87
- * Returns whether the given {@code jsonSchema} is a combinator ({@code oneOf}, {@code anyOf}, {@code allOf}) at the root level
88
- * @param jsonSchema
89
- * the schema to check
90
- */
91
- var isCombinator = function (jsonSchema) {
92
- return (!isEmpty_1.default(jsonSchema) &&
93
- (!isEmpty_1.default(jsonSchema.oneOf) ||
94
- !isEmpty_1.default(jsonSchema.anyOf) ||
95
- !isEmpty_1.default(jsonSchema.allOf)));
96
- };
97
- var generateUISchema = function (jsonSchema, schemaElements, currentRef, schemaName, layoutType, rootSchema) {
98
- if (!isEmpty_1.default(jsonSchema) && jsonSchema.$ref !== undefined) {
99
- return generateUISchema(util_1.resolveSchema(rootSchema, jsonSchema.$ref), schemaElements, currentRef, schemaName, layoutType, rootSchema);
100
- }
101
- if (isCombinator(jsonSchema)) {
102
- var controlObject = exports.createControlElement(currentRef);
103
- schemaElements.push(controlObject);
104
- return controlObject;
105
- }
106
- var types = util_1.deriveTypes(jsonSchema);
107
- if (types.length === 0) {
108
- return null;
109
- }
110
- if (types.length > 1) {
111
- var controlObject = exports.createControlElement(currentRef);
112
- schemaElements.push(controlObject);
113
- return controlObject;
114
- }
115
- if (currentRef === '#' && types[0] === 'object') {
116
- var layout_1 = createLayout(layoutType);
117
- schemaElements.push(layout_1);
118
- if (jsonSchema.properties && keys_1.default(jsonSchema.properties).length > 1) {
119
- addLabel(layout_1, schemaName);
120
- }
121
- if (!isEmpty_1.default(jsonSchema.properties)) {
122
- // traverse properties
123
- var nextRef_1 = currentRef + '/properties';
124
- Object.keys(jsonSchema.properties).map(function (propName) {
125
- var value = jsonSchema.properties[propName];
126
- var ref = nextRef_1 + "/" + propName;
127
- if (value.$ref !== undefined) {
128
- value = util_1.resolveSchema(rootSchema, value.$ref);
129
- }
130
- generateUISchema(value, layout_1.elements, ref, propName, layoutType, rootSchema);
131
- });
132
- }
133
- return layout_1;
134
- }
135
- switch (types[0]) {
136
- case 'object': // object items will be handled by the object control itself
137
- /* falls through */
138
- case 'array': // array items will be handled by the array control itself
139
- /* falls through */
140
- case 'string':
141
- /* falls through */
142
- case 'number':
143
- /* falls through */
144
- case 'integer':
145
- /* falls through */
146
- case 'boolean':
147
- var controlObject = exports.createControlElement(currentRef);
148
- schemaElements.push(controlObject);
149
- return controlObject;
150
- default:
151
- throw new Error('Unknown type: ' + JSON.stringify(jsonSchema));
152
- }
153
- };
154
- /**
155
- * Generate a default UI schema.
156
- * @param {JsonSchema} jsonSchema the JSON schema to generated a UI schema for
157
- * @param {string} layoutType the desired layout type for the root layout
158
- * of the generated UI schema
159
- */
160
- exports.generateDefaultUISchema = function (jsonSchema, layoutType, prefix, rootSchema) {
161
- if (layoutType === void 0) { layoutType = 'VerticalLayout'; }
162
- if (prefix === void 0) { prefix = '#'; }
163
- if (rootSchema === void 0) { rootSchema = jsonSchema; }
164
- return wrapInLayoutIfNecessary(generateUISchema(jsonSchema, [], prefix, '', layoutType, rootSchema), layoutType);
165
- };
166
- //# sourceMappingURL=uischema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uischema.js","sourceRoot":"","sources":["../../src/generators/uischema.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;AAEF,mEAAqC;AACrC,uEAAyC;AACzC,6DAA+B;AAC/B,oCAQmB;AACnB,gCAAqD;AAErD;;;;GAIG;AACH,IAAM,YAAY,GAAG,UAAC,UAAkB,IAAa,OAAA,CAAC;IACpD,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,EAAE;CACb,CAAC,EAHmD,CAGnD,CAAC;AAEH;;GAEG;AACU,QAAA,oBAAoB,GAAG,UAAC,GAAW,IAAqB,OAAA,CAAC;IACpE,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,GAAG;CACX,CAAC,EAHmE,CAGnE,CAAC;AAEH;;;;;GAKG;AACH,IAAM,uBAAuB,GAAG,UAC9B,QAAyB,EACzB,UAAkB;IAElB,IAAI,CAAC,iBAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAQ,CAAC,QAAQ,CAAC,EAAE;QAC7C,IAAM,cAAc,GAAW,YAAY,CAAC,UAAU,CAAC,CAAC;QACxD,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEvC,OAAO,cAAc,CAAC;KACvB;IAED,OAAO,QAAkB,CAAC;AAC5B,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,IAAM,QAAQ,GAAG,UAAC,MAAc,EAAE,SAAiB;IACjD,IAAI,CAAC,iBAAO,CAAC,SAAS,CAAC,EAAE;QACvB,IAAM,UAAU,GAAG,mBAAS,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,gBAAO,CAAC,MAAM,CAAC,EAAE;YACnB,MAAM,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