@jsonforms/core 3.0.0-alpha.3 → 3.0.0-beta.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.
Files changed (193) hide show
  1. package/docs/globals.html +37 -37
  2. package/docs/interfaces/arraycontrolprops.html +21 -21
  3. package/docs/interfaces/arraylayoutprops.html +21 -21
  4. package/docs/interfaces/cellprops.html +12 -12
  5. package/docs/interfaces/combinatorrendererprops.html +13 -13
  6. package/docs/interfaces/controlprops.html +16 -16
  7. package/docs/interfaces/controlstate.html +2 -2
  8. package/docs/interfaces/controlwithdetailprops.html +17 -17
  9. package/docs/interfaces/dispatchcellprops.html +10 -10
  10. package/docs/interfaces/dispatchcellstateprops.html +10 -10
  11. package/docs/interfaces/dispatchpropsofarraycontrol.html +4 -4
  12. package/docs/interfaces/dispatchpropsofcontrol.html +1 -1
  13. package/docs/interfaces/dispatchpropsofmultienumcontrol.html +2 -2
  14. package/docs/interfaces/enumcellprops.html +13 -13
  15. package/docs/interfaces/enumoption.html +2 -2
  16. package/docs/interfaces/jsonformsprops.html +9 -9
  17. package/docs/interfaces/layoutprops.html +10 -10
  18. package/docs/interfaces/ownpropsofcell.html +9 -9
  19. package/docs/interfaces/ownpropsofcontrol.html +9 -9
  20. package/docs/interfaces/ownpropsofenum.html +1 -1
  21. package/docs/interfaces/ownpropsofenumcell.html +10 -10
  22. package/docs/interfaces/ownpropsofjsonformsrenderer.html +8 -8
  23. package/docs/interfaces/ownpropsoflayout.html +9 -9
  24. package/docs/interfaces/ownpropsofmasterlistitem.html +6 -6
  25. package/docs/interfaces/ownpropsofrenderer.html +8 -8
  26. package/docs/interfaces/rendererprops.html +9 -9
  27. package/docs/interfaces/statepropsofarraycontrol.html +17 -17
  28. package/docs/interfaces/statepropsofarraylayout.html +17 -17
  29. package/docs/interfaces/statepropsofcell.html +11 -11
  30. package/docs/interfaces/statepropsofcombinator.html +12 -12
  31. package/docs/interfaces/statepropsofcontrol.html +15 -15
  32. package/docs/interfaces/statepropsofcontrolwithdetail.html +16 -16
  33. package/docs/interfaces/statepropsofenumcell.html +12 -12
  34. package/docs/interfaces/statepropsofjsonformsrenderer.html +9 -9
  35. package/docs/interfaces/statepropsoflayout.html +10 -10
  36. package/docs/interfaces/statepropsofmasteritem.html +7 -7
  37. package/docs/interfaces/statepropsofrenderer.html +9 -9
  38. package/docs/interfaces/statepropsofscopedrenderer.html +12 -12
  39. package/docs/interfaces/withclassname.html +1 -1
  40. package/lib/Helpers.d.ts +5 -5
  41. package/lib/actions/actions.d.ts +181 -181
  42. package/lib/actions/index.d.ts +1 -1
  43. package/lib/configDefault.d.ts +6 -6
  44. package/lib/generators/Generate.d.ts +6 -6
  45. package/lib/generators/index.d.ts +3 -3
  46. package/lib/generators/schema.d.ts +8 -8
  47. package/lib/generators/uischema.d.ts +12 -12
  48. package/lib/i18n/i18nTypes.d.ts +15 -15
  49. package/lib/i18n/i18nUtil.d.ts +18 -18
  50. package/lib/i18n/index.d.ts +2 -2
  51. package/lib/index.d.ts +11 -11
  52. package/lib/jsonforms-core.cjs.js +2445 -0
  53. package/lib/jsonforms-core.cjs.js.map +1 -0
  54. package/lib/jsonforms-core.esm.js +2164 -0
  55. package/lib/jsonforms-core.esm.js.map +1 -0
  56. package/lib/models/draft4.d.ts +198 -198
  57. package/lib/models/index.d.ts +5 -5
  58. package/lib/models/jsonSchema.d.ts +3 -3
  59. package/lib/models/jsonSchema4.d.ts +110 -110
  60. package/lib/models/jsonSchema7.d.ts +119 -119
  61. package/lib/models/uischema.d.ts +201 -201
  62. package/lib/reducers/cells.d.ts +11 -11
  63. package/lib/reducers/config.d.ts +3 -3
  64. package/lib/reducers/core.d.ts +24 -24
  65. package/lib/reducers/default-data.d.ts +10 -10
  66. package/lib/reducers/i18n.d.ts +8 -8
  67. package/lib/reducers/index.d.ts +9 -9
  68. package/lib/reducers/reducers.d.ts +29 -29
  69. package/lib/reducers/renderers.d.ts +10 -10
  70. package/lib/reducers/selectors.d.ts +15 -15
  71. package/lib/reducers/uischemas.d.ts +10 -10
  72. package/lib/store.d.ts +53 -53
  73. package/lib/testers/index.d.ts +1 -1
  74. package/lib/testers/testers.d.ts +203 -203
  75. package/lib/util/Formatted.d.ts +19 -19
  76. package/lib/util/array.d.ts +3 -3
  77. package/lib/util/cell.d.ts +79 -79
  78. package/lib/util/combinators.d.ts +10 -10
  79. package/lib/util/ids.d.ts +3 -3
  80. package/lib/util/index.d.ts +15 -15
  81. package/lib/util/label.d.ts +9 -9
  82. package/lib/util/path.d.ts +25 -25
  83. package/lib/util/renderer.d.ts +398 -397
  84. package/lib/util/resolvers.d.ts +25 -25
  85. package/lib/util/runtime.d.ts +18 -18
  86. package/lib/util/schema.d.ts +1 -1
  87. package/lib/util/type.d.ts +174 -174
  88. package/lib/util/uischema.d.ts +5 -5
  89. package/lib/util/util.d.ts +31 -31
  90. package/lib/util/validator.d.ts +3 -3
  91. package/package.json +16 -13
  92. package/rollup.config.js +44 -0
  93. package/src/reducers/reducers.ts +2 -2
  94. package/src/util/cell.ts +4 -4
  95. package/src/util/renderer.ts +9 -8
  96. package/stats.html +3279 -0
  97. package/lib/Helpers.js +0 -33
  98. package/lib/Helpers.js.map +0 -1
  99. package/lib/actions/actions.js +0 -173
  100. package/lib/actions/actions.js.map +0 -1
  101. package/lib/actions/index.js +0 -29
  102. package/lib/actions/index.js.map +0 -1
  103. package/lib/configDefault.js +0 -48
  104. package/lib/configDefault.js.map +0 -1
  105. package/lib/generators/Generate.js +0 -35
  106. package/lib/generators/Generate.js.map +0 -1
  107. package/lib/generators/index.js +0 -31
  108. package/lib/generators/index.js.map +0 -1
  109. package/lib/generators/schema.js +0 -154
  110. package/lib/generators/schema.js.map +0 -1
  111. package/lib/generators/uischema.js +0 -169
  112. package/lib/generators/uischema.js.map +0 -1
  113. package/lib/i18n/i18nTypes.js +0 -3
  114. package/lib/i18n/i18nTypes.js.map +0 -1
  115. package/lib/i18n/i18nUtil.js +0 -71
  116. package/lib/i18n/i18nUtil.js.map +0 -1
  117. package/lib/i18n/index.js +0 -6
  118. package/lib/i18n/index.js.map +0 -1
  119. package/lib/index.js +0 -40
  120. package/lib/index.js.map +0 -1
  121. package/lib/jsonforms-core.js +0 -25
  122. package/lib/jsonforms-core.js.map +0 -1
  123. package/lib/models/draft4.js +0 -174
  124. package/lib/models/draft4.js.map +0 -1
  125. package/lib/models/index.js +0 -33
  126. package/lib/models/index.js.map +0 -1
  127. package/lib/models/jsonSchema.js +0 -27
  128. package/lib/models/jsonSchema.js.map +0 -1
  129. package/lib/models/jsonSchema4.js +0 -30
  130. package/lib/models/jsonSchema4.js.map +0 -1
  131. package/lib/models/jsonSchema7.js +0 -30
  132. package/lib/models/jsonSchema7.js.map +0 -1
  133. package/lib/models/uischema.js +0 -58
  134. package/lib/models/uischema.js.map +0 -1
  135. package/lib/reducers/cells.js +0 -42
  136. package/lib/reducers/cells.js.map +0 -1
  137. package/lib/reducers/config.js +0 -46
  138. package/lib/reducers/config.js.map +0 -1
  139. package/lib/reducers/core.js +0 -294
  140. package/lib/reducers/core.js.map +0 -1
  141. package/lib/reducers/default-data.js +0 -45
  142. package/lib/reducers/default-data.js.map +0 -1
  143. package/lib/reducers/i18n.js +0 -83
  144. package/lib/reducers/i18n.js.map +0 -1
  145. package/lib/reducers/index.js +0 -37
  146. package/lib/reducers/index.js.map +0 -1
  147. package/lib/reducers/reducers.js +0 -98
  148. package/lib/reducers/reducers.js.map +0 -1
  149. package/lib/reducers/renderers.js +0 -43
  150. package/lib/reducers/renderers.js.map +0 -1
  151. package/lib/reducers/selectors.js +0 -56
  152. package/lib/reducers/selectors.js.map +0 -1
  153. package/lib/reducers/uischemas.js +0 -60
  154. package/lib/reducers/uischemas.js.map +0 -1
  155. package/lib/store.js +0 -27
  156. package/lib/store.js.map +0 -1
  157. package/lib/testers/index.js +0 -29
  158. package/lib/testers/index.js.map +0 -1
  159. package/lib/testers/testers.js +0 -421
  160. package/lib/testers/testers.js.map +0 -1
  161. package/lib/util/Formatted.js +0 -27
  162. package/lib/util/Formatted.js.map +0 -1
  163. package/lib/util/array.js +0 -44
  164. package/lib/util/array.js.map +0 -1
  165. package/lib/util/cell.js +0 -148
  166. package/lib/util/cell.js.map +0 -1
  167. package/lib/util/combinators.js +0 -59
  168. package/lib/util/combinators.js.map +0 -1
  169. package/lib/util/ids.js +0 -54
  170. package/lib/util/ids.js.map +0 -1
  171. package/lib/util/index.js +0 -43
  172. package/lib/util/index.js.map +0 -1
  173. package/lib/util/label.js +0 -73
  174. package/lib/util/label.js.map +0 -1
  175. package/lib/util/path.js +0 -90
  176. package/lib/util/path.js.map +0 -1
  177. package/lib/util/renderer.js +0 -530
  178. package/lib/util/renderer.js.map +0 -1
  179. package/lib/util/resolvers.js +0 -169
  180. package/lib/util/resolvers.js.map +0 -1
  181. package/lib/util/runtime.js +0 -167
  182. package/lib/util/runtime.js.map +0 -1
  183. package/lib/util/schema.js +0 -42
  184. package/lib/util/schema.js.map +0 -1
  185. package/lib/util/type.js +0 -27
  186. package/lib/util/type.js.map +0 -1
  187. package/lib/util/uischema.js +0 -56
  188. package/lib/util/uischema.js.map +0 -1
  189. package/lib/util/util.js +0 -112
  190. package/lib/util/util.js.map +0 -1
  191. package/lib/util/validator.js +0 -37
  192. package/lib/util/validator.js.map +0 -1
  193. package/webpack.build.js +0 -13
@@ -1,169 +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.resolveSchema = exports.findAllRefs = exports.resolveData = void 0;
28
- var tslib_1 = require("tslib");
29
- var isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
30
- var get_1 = tslib_1.__importDefault(require("lodash/get"));
31
- var isObjectSchema = function (schema) {
32
- return schema.properties !== undefined;
33
- };
34
- var isArraySchema = function (schema) {
35
- return schema.type === 'array' && schema.items !== undefined;
36
- };
37
- var resolveData = function (instance, dataPath) {
38
- if (isEmpty_1.default(dataPath)) {
39
- return instance;
40
- }
41
- var dataPathSegments = dataPath.split('.');
42
- return dataPathSegments
43
- .map(function (segment) { return decodeURIComponent(segment); })
44
- .reduce(function (curInstance, decodedSegment) {
45
- if (!curInstance || !curInstance.hasOwnProperty(decodedSegment)) {
46
- return undefined;
47
- }
48
- return curInstance[decodedSegment];
49
- }, instance);
50
- };
51
- exports.resolveData = resolveData;
52
- /**
53
- * Finds all references inside the given schema.
54
- *
55
- * @param schema The {@link JsonSchema} to find the references in
56
- * @param result The initial result map, default: empty map (this parameter is used for recursion
57
- * inside the function)
58
- * @param resolveTuples Whether arrays of tuples should be considered; default: false
59
- */
60
- var findAllRefs = function (schema, result, resolveTuples) {
61
- if (result === void 0) { result = {}; }
62
- if (resolveTuples === void 0) { resolveTuples = false; }
63
- if (isObjectSchema(schema)) {
64
- Object.keys(schema.properties).forEach(function (key) {
65
- return exports.findAllRefs(schema.properties[key], result);
66
- });
67
- }
68
- if (isArraySchema(schema)) {
69
- if (Array.isArray(schema.items)) {
70
- if (resolveTuples) {
71
- var items = schema.items;
72
- items.forEach(function (child) { return exports.findAllRefs(child, result); });
73
- }
74
- }
75
- else {
76
- exports.findAllRefs(schema.items, result);
77
- }
78
- }
79
- if (Array.isArray(schema.anyOf)) {
80
- var anyOf = schema.anyOf;
81
- anyOf.forEach(function (child) { return exports.findAllRefs(child, result); });
82
- }
83
- if (schema.$ref !== undefined) {
84
- result[schema.$ref] = schema;
85
- }
86
- return result;
87
- };
88
- exports.findAllRefs = findAllRefs;
89
- var invalidSegment = function (pathSegment) {
90
- return pathSegment === '#' || pathSegment === undefined || pathSegment === '';
91
- };
92
- /**
93
- * Resolve the given schema path in order to obtain a subschema.
94
- * @param {JsonSchema} schema the root schema from which to start
95
- * @param {string} schemaPath the schema path to be resolved
96
- * @param {JsonSchema} rootSchema the actual root schema
97
- * @returns {JsonSchema} the resolved sub-schema
98
- */
99
- var resolveSchema = function (schema, schemaPath, rootSchema) {
100
- var _a, _b, _c;
101
- if (isEmpty_1.default(schema)) {
102
- return undefined;
103
- }
104
- var validPathSegments = schemaPath.split('/');
105
- var resultSchema = schema;
106
- for (var i = 0; i < validPathSegments.length; i++) {
107
- var pathSegment = validPathSegments[i];
108
- resultSchema =
109
- resultSchema === undefined || resultSchema.$ref === undefined
110
- ? resultSchema
111
- : exports.resolveSchema(schema, resultSchema.$ref);
112
- if (invalidSegment(pathSegment)) {
113
- // skip invalid segments
114
- continue;
115
- }
116
- var curSchema = get_1.default(resultSchema, pathSegment);
117
- if (!curSchema) {
118
- // resolving was not successful, check whether the scope omitted an oneOf, allOf or anyOf and resolve anyway
119
- var schemas = [].concat((_a = resultSchema === null || resultSchema === void 0 ? void 0 : resultSchema.oneOf) !== null && _a !== void 0 ? _a : [], (_b = resultSchema === null || resultSchema === void 0 ? void 0 : resultSchema.allOf) !== null && _b !== void 0 ? _b : [], (_c = resultSchema === null || resultSchema === void 0 ? void 0 : resultSchema.anyOf) !== null && _c !== void 0 ? _c : []);
120
- for (var _i = 0, schemas_1 = schemas; _i < schemas_1.length; _i++) {
121
- var item = schemas_1[_i];
122
- curSchema = exports.resolveSchema(item, validPathSegments.slice(i).join('/'));
123
- if (curSchema) {
124
- break;
125
- }
126
- }
127
- if (curSchema) {
128
- // already resolved rest of the path
129
- resultSchema = curSchema;
130
- break;
131
- }
132
- }
133
- resultSchema = curSchema;
134
- }
135
- // TODO: because schema is already scoped we might end up with refs pointing
136
- // outside of the current schema. It would be better if we'd always could deal
137
- // with absolute paths here, so that we don't need to keep two different
138
- // schemas around
139
- if (resultSchema !== undefined && resultSchema.$ref !== undefined) {
140
- try {
141
- return retrieveResolvableSchema(schema, resultSchema.$ref);
142
- }
143
- catch (e) {
144
- return retrieveResolvableSchema(rootSchema, resultSchema.$ref);
145
- }
146
- }
147
- return resultSchema;
148
- };
149
- exports.resolveSchema = resolveSchema;
150
- /**
151
- * Normalizes the schema and resolves the given ref.
152
- *
153
- * @param {JsonSchema} full the JSON schema to resolved the reference against
154
- * @param {string} reference the reference to be resolved
155
- * @returns {JsonSchema} the resolved sub-schema
156
- */
157
- // disable rule because resolve is mutually recursive
158
- // tslint:disable:only-arrow-functions
159
- function retrieveResolvableSchema(full, reference) {
160
- // tslint:enable:only-arrow-functions
161
- var child = exports.resolveSchema(full, reference);
162
- var allRefs = exports.findAllRefs(child);
163
- var innerSelfReference = allRefs[reference];
164
- if (innerSelfReference !== undefined) {
165
- innerSelfReference.$ref = '#';
166
- }
167
- return child;
168
- }
169
- //# sourceMappingURL=resolvers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolvers.js","sourceRoot":"","sources":["../../src/util/resolvers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;;AAEF,mEAAqC;AACrC,2DAA6B;AAU7B,IAAM,cAAc,GAAG,UAAC,MAAkB;IACxC,OAAO,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AC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;SAC5D;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,wBAAwB,CAAC,UAAU,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;SAChE;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAvDW,QAAA,aAAa,iBAuDxB;AAEF;;;;;;GAMG;AACH,qDAAqD;AACrD,sCAAsC;AACtC,SAAS,wBAAwB,CAC/B,IAAgB,EAChB,SAAiB;IAEjB,qCAAqC;IACrC,IAAM,KAAK,GAAG,qBAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC7C,IAAM,OAAO,GAAG,mBAAW,CAAC,KAAK,CAAC,CAAC;IACnC,IAAM,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9C,IAAI,kBAAkB,KAAK,SAAS,EAAE;QACpC,kBAAkB,CAAC,IAAI,GAAG,GAAG,CAAC;KAC/B;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,167 +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.isInherentlyEnabled = exports.isEnabled = exports.isVisible = exports.hasEnableRule = exports.hasShowRule = exports.evalEnablement = exports.evalVisibility = void 0;
28
- var tslib_1 = require("tslib");
29
- var has_1 = tslib_1.__importDefault(require("lodash/has"));
30
- var models_1 = require("../models");
31
- var resolvers_1 = require("./resolvers");
32
- var path_1 = require("./path");
33
- var reducers_1 = require("../reducers");
34
- var isOrCondition = function (condition) {
35
- return condition.type === 'OR';
36
- };
37
- var isAndCondition = function (condition) {
38
- return condition.type === 'AND';
39
- };
40
- var isLeafCondition = function (condition) {
41
- return condition.type === 'LEAF';
42
- };
43
- var isSchemaCondition = function (condition) { return has_1.default(condition, 'schema'); };
44
- var getConditionScope = function (condition, path) {
45
- return path_1.composeWithUi(condition, path);
46
- };
47
- var evaluateCondition = function (data, condition, path, ajv) {
48
- if (isAndCondition(condition)) {
49
- return condition.conditions.reduce(function (acc, cur) { return acc && evaluateCondition(data, cur, path, ajv); }, true);
50
- }
51
- else if (isOrCondition(condition)) {
52
- return condition.conditions.reduce(function (acc, cur) { return acc || evaluateCondition(data, cur, path, ajv); }, false);
53
- }
54
- else if (isLeafCondition(condition)) {
55
- var value = resolvers_1.resolveData(data, getConditionScope(condition, path));
56
- return value === condition.expectedValue;
57
- }
58
- else if (isSchemaCondition(condition)) {
59
- var value = resolvers_1.resolveData(data, getConditionScope(condition, path));
60
- return ajv.validate(condition.schema, value);
61
- }
62
- else {
63
- // unknown condition
64
- return true;
65
- }
66
- };
67
- var isRuleFulfilled = function (uischema, data, path, ajv) {
68
- var condition = uischema.rule.condition;
69
- return evaluateCondition(data, condition, path, ajv);
70
- };
71
- var evalVisibility = function (uischema, data, path, ajv) {
72
- if (path === void 0) { path = undefined; }
73
- var fulfilled = isRuleFulfilled(uischema, data, path, ajv);
74
- switch (uischema.rule.effect) {
75
- case models_1.RuleEffect.HIDE:
76
- return !fulfilled;
77
- case models_1.RuleEffect.SHOW:
78
- return fulfilled;
79
- // visible by default
80
- default:
81
- return true;
82
- }
83
- };
84
- exports.evalVisibility = evalVisibility;
85
- var evalEnablement = function (uischema, data, path, ajv) {
86
- if (path === void 0) { path = undefined; }
87
- var fulfilled = isRuleFulfilled(uischema, data, path, ajv);
88
- switch (uischema.rule.effect) {
89
- case models_1.RuleEffect.DISABLE:
90
- return !fulfilled;
91
- case models_1.RuleEffect.ENABLE:
92
- return fulfilled;
93
- // enabled by default
94
- default:
95
- return true;
96
- }
97
- };
98
- exports.evalEnablement = evalEnablement;
99
- var hasShowRule = function (uischema) {
100
- if (uischema.rule &&
101
- (uischema.rule.effect === models_1.RuleEffect.SHOW ||
102
- uischema.rule.effect === models_1.RuleEffect.HIDE)) {
103
- return true;
104
- }
105
- return false;
106
- };
107
- exports.hasShowRule = hasShowRule;
108
- var hasEnableRule = function (uischema) {
109
- if (uischema.rule &&
110
- (uischema.rule.effect === models_1.RuleEffect.ENABLE ||
111
- uischema.rule.effect === models_1.RuleEffect.DISABLE)) {
112
- return true;
113
- }
114
- return false;
115
- };
116
- exports.hasEnableRule = hasEnableRule;
117
- var isVisible = function (uischema, data, path, ajv) {
118
- if (path === void 0) { path = undefined; }
119
- if (uischema.rule) {
120
- return exports.evalVisibility(uischema, data, path, ajv);
121
- }
122
- return true;
123
- };
124
- exports.isVisible = isVisible;
125
- var isEnabled = function (uischema, data, path, ajv) {
126
- if (path === void 0) { path = undefined; }
127
- if (uischema.rule) {
128
- return exports.evalEnablement(uischema, data, path, ajv);
129
- }
130
- return true;
131
- };
132
- exports.isEnabled = isEnabled;
133
- /**
134
- * Indicates whether the given `uischema` element shall be enabled or disabled.
135
- * Checks the global readonly flag, uischema rule, uischema options (including the config),
136
- * the schema and the enablement indicator of the parent.
137
- */
138
- var isInherentlyEnabled = function (state, ownProps, uischema, schema, rootData, config) {
139
- var _a, _b, _c;
140
- if ((_a = state === null || state === void 0 ? void 0 : state.jsonforms) === null || _a === void 0 ? void 0 : _a.readonly) {
141
- return false;
142
- }
143
- if (uischema && exports.hasEnableRule(uischema)) {
144
- return exports.isEnabled(uischema, rootData, ownProps === null || ownProps === void 0 ? void 0 : ownProps.path, reducers_1.getAjv(state));
145
- }
146
- if (typeof ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.readonly) === 'boolean') {
147
- return !uischema.options.readonly;
148
- }
149
- if (typeof ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.readOnly) === 'boolean') {
150
- return !uischema.options.readOnly;
151
- }
152
- if (typeof (config === null || config === void 0 ? void 0 : config.readonly) === 'boolean') {
153
- return !config.readonly;
154
- }
155
- if (typeof (config === null || config === void 0 ? void 0 : config.readOnly) === 'boolean') {
156
- return !config.readOnly;
157
- }
158
- if ((schema === null || schema === void 0 ? void 0 : schema.readOnly) === true) {
159
- return false;
160
- }
161
- if (typeof (ownProps === null || ownProps === void 0 ? void 0 : ownProps.enabled) === 'boolean') {
162
- return ownProps.enabled;
163
- }
164
- return true;
165
- };
166
- exports.isInherentlyEnabled = isInherentlyEnabled;
167
- //# sourceMappingURL=runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/util/runtime.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;;AAEF,2DAA6B;AAC7B,oCASmB;AACnB,yCAA0C;AAC1C,+BAAuC;AAEvC,wCAAqC;AAIrC,IAAM,aAAa,GAAG,UAAC,SAAoB;IACzC,OAAA,SAAS,CAAC,IAAI,KAAK,IAAI;AAAvB,CAAuB,CAAC;AAE1B,IAAM,cAAc,GAAG,UAAC,SAAoB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AK,IAAI,EAAE;QAC7B,OAAO,KAAK,CAAC;KACd;IACD,IAAI,OAAO,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAA,KAAK,SAAS,EAAE;QAC1C,OAAO,QAAQ,CAAC,OAAO,CAAC;KACzB;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAjCW,QAAA,mBAAmB,uBAiC9B"}
@@ -1,42 +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.getFirstPrimitiveProp = void 0;
28
- var tslib_1 = require("tslib");
29
- var find_1 = tslib_1.__importDefault(require("lodash/find"));
30
- var getFirstPrimitiveProp = function (schema) {
31
- if (schema.properties) {
32
- return find_1.default(Object.keys(schema.properties), function (propName) {
33
- var prop = schema.properties[propName];
34
- return (prop.type === 'string' ||
35
- prop.type === 'number' ||
36
- prop.type === 'integer');
37
- });
38
- }
39
- return undefined;
40
- };
41
- exports.getFirstPrimitiveProp = getFirstPrimitiveProp;
42
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/util/schema.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;;AAEF,6DAA+B;AAExB,IAAM,qBAAqB,GAAG,UAAC,MAAW;IAC/C,IAAI,MAAM,CAAC,UAAU,EAAE;QACrB,OAAO,cAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,UAAA,QAAQ;YAClD,IAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YACzC,OAAO,CACL,IAAI,CAAC,IAAI,KAAK,QAAQ;gBACtB,IAAI,CAAC,IAAI,KAAK,QAAQ;gBACtB,IAAI,CAAC,IAAI,KAAK,SAAS,CACxB,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAZW,QAAA,qBAAqB,yBAYhC"}
package/lib/util/type.js DELETED
@@ -1,27 +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
- //# sourceMappingURL=type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/util/type.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE"}
@@ -1,56 +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.iterateSchema = exports.unsetReadonly = exports.setReadonly = void 0;
28
- var tslib_1 = require("tslib");
29
- var isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
30
- var models_1 = require("../models");
31
- var setReadonlyPropertyValue = function (value) { return function (child) {
32
- if (!child.options) {
33
- child.options = {};
34
- }
35
- child.options.readonly = value;
36
- }; };
37
- var setReadonly = function (uischema) {
38
- exports.iterateSchema(uischema, setReadonlyPropertyValue(true));
39
- };
40
- exports.setReadonly = setReadonly;
41
- var unsetReadonly = function (uischema) {
42
- exports.iterateSchema(uischema, setReadonlyPropertyValue(false));
43
- };
44
- exports.unsetReadonly = unsetReadonly;
45
- var iterateSchema = function (uischema, toApply) {
46
- if (isEmpty_1.default(uischema)) {
47
- return;
48
- }
49
- if (models_1.isLayout(uischema)) {
50
- uischema.elements.forEach(function (child) { return exports.iterateSchema(child, toApply); });
51
- return;
52
- }
53
- toApply(uischema);
54
- };
55
- exports.iterateSchema = iterateSchema;
56
- //# sourceMappingURL=uischema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uischema.js","sourceRoot":"","sources":["../../src/util/uischema.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;;AAEF,mEAAqC;AACrC,oCAAsD;AAItD,IAAM,wBAAwB,GAAG,UAAC,KAAc,IAAsB,OAAA,UACpE,KAAsB;IAEtB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;QAClB,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;KACpB;IACD,KAAK,CAAC,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;AACjC,CAAC,EAPqE,CAOrE,CAAC;AACK,IAAM,WAAW,GAAG,UAAC,QAAyB;IACnD,qBAAa,CAAC,QAAQ,EAAE,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1D,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AACK,IAAM,aAAa,GAAG,UAAC,QAAyB;IACrD,qBAAa,CAAC,QAAQ,EAAE,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3D,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB;AACK,IAAM,aAAa,GAAG,UAC3B,QAAyB,EACzB,OAAwB;IAExB,IAAI,iBAAO,CAAC,QAAQ,CAAC,EAAE;QACrB,OAAO;KACR;IACD,IAAI,iBAAQ,CAAC,QAAQ,CAAC,EAAE;QACtB,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,KAAK,IAAI,OAAA,qBAAa,CAAC,KAAK,EAAE,OAAO,CAAC,EAA7B,CAA6B,CAAC,CAAC;QAClE,OAAO;KACR;IACD,OAAO,CAAC,QAAQ,CAAC,CAAC;AACpB,CAAC,CAAC;AAZW,QAAA,aAAa,iBAYxB"}
package/lib/util/util.js DELETED
@@ -1,112 +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.Runtime = exports.Paths = exports.Resolve = exports.deriveTypes = exports.hasType = exports.formatErrorMessage = exports.convertToValidClassName = void 0;
28
- var tslib_1 = require("tslib");
29
- var isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
30
- var isArray_1 = tslib_1.__importDefault(require("lodash/isArray"));
31
- var includes_1 = tslib_1.__importDefault(require("lodash/includes"));
32
- var find_1 = tslib_1.__importDefault(require("lodash/find"));
33
- var resolvers_1 = require("./resolvers");
34
- var path_1 = require("./path");
35
- var runtime_1 = require("./runtime");
36
- /**
37
- * Escape the given string such that it can be used as a class name,
38
- * i.e. hashes and slashes will be replaced.
39
- *
40
- * @param {string} s the string that should be converted to a valid class name
41
- * @returns {string} the escaped string
42
- */
43
- var convertToValidClassName = function (s) {
44
- return s.replace('#', 'root').replace(new RegExp('/', 'g'), '_');
45
- };
46
- exports.convertToValidClassName = convertToValidClassName;
47
- var formatErrorMessage = function (errors) {
48
- if (errors === undefined || errors === null) {
49
- return '';
50
- }
51
- return errors.join('\n');
52
- };
53
- exports.formatErrorMessage = formatErrorMessage;
54
- var hasType = function (jsonSchema, expected) {
55
- return includes_1.default(exports.deriveTypes(jsonSchema), expected);
56
- };
57
- exports.hasType = hasType;
58
- /**
59
- * Derives the type of the jsonSchema element
60
- */
61
- var deriveTypes = function (jsonSchema) {
62
- if (isEmpty_1.default(jsonSchema)) {
63
- return [];
64
- }
65
- if (!isEmpty_1.default(jsonSchema.type) && typeof jsonSchema.type === 'string') {
66
- return [jsonSchema.type];
67
- }
68
- if (isArray_1.default(jsonSchema.type)) {
69
- return jsonSchema.type;
70
- }
71
- if (!isEmpty_1.default(jsonSchema.properties) ||
72
- !isEmpty_1.default(jsonSchema.additionalProperties)) {
73
- return ['object'];
74
- }
75
- if (!isEmpty_1.default(jsonSchema.items)) {
76
- return ['array'];
77
- }
78
- if (!isEmpty_1.default(jsonSchema.allOf)) {
79
- var allOfType = find_1.default(jsonSchema.allOf, function (schema) { return exports.deriveTypes(schema).length !== 0; });
80
- if (allOfType) {
81
- return exports.deriveTypes(allOfType);
82
- }
83
- }
84
- // ignore all remaining cases
85
- return [];
86
- };
87
- exports.deriveTypes = deriveTypes;
88
- /**
89
- * Convenience wrapper around resolveData and resolveSchema.
90
- */
91
- exports.Resolve = {
92
- schema: resolvers_1.resolveSchema,
93
- data: resolvers_1.resolveData
94
- };
95
- // Paths --
96
- var fromScopable = function (scopable) {
97
- return path_1.toDataPathSegments(scopable.scope).join('.');
98
- };
99
- exports.Paths = {
100
- compose: path_1.composePaths,
101
- fromScopable: fromScopable
102
- };
103
- // Runtime --
104
- exports.Runtime = {
105
- isEnabled: function (uischema, data, ajv) {
106
- return runtime_1.isEnabled(uischema, data, undefined, ajv);
107
- },
108
- isVisible: function (uischema, data, ajv) {
109
- return runtime_1.isVisible(uischema, data, undefined, ajv);
110
- }
111
- };
112
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util/util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;;AAEF,mEAAqC;AACrC,mEAAqC;AACrC,qEAAuC;AACvC,6DAA+B;AAE/B,yCAAyD;AACzD,+BAA0D;AAC1D,qCAAiD;AAGjD;;;;;;GAMG;AACI,IAAM,uBAAuB,GAAG,UAAC,CAAS;IACjD,OAAA,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC;AAAzD,CAAyD,CAAC;AAD7C,QAAA,uBAAuB,2BACsB;AAEnD,IAAM,kBAAkB,GAAG,UAAC,MA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AI,SAAS,EAAE;YACb,OAAO,mBAAW,CAAC,SAAS,CAAC,CAAC;SAC/B;KACF;IACD,6BAA6B;IAC7B,OAAO,EAAE,CAAC;AACX,CAAC,CAAC;AAhCW,QAAA,WAAW,eAgCtB;AAEF;;EAEE;AACW,QAAA,OAAO,GAOhB;IACH,MAAM,EAAE,yBAAa;IACrB,IAAI,EAAE,uBAAW;CACjB,CAAC;AAEF,WAAW;AACX,IAAM,YAAY,GAAG,UAAC,QAAkB;IACvC,OAAA,yBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAA5C,CAA4C,CAAC;AAEjC,QAAA,KAAK,GAAG;IACpB,OAAO,EAAE,mBAAY;IACrB,YAAY,cAAA;CACZ,CAAC;AAEF,aAAa;AACA,QAAA,OAAO,GAAG;IACtB,SAAS,EAAT,UAAU,QAAyB,EAAE,IAAS,EAAE,GAAQ;QACtD,OAAO,mBAAS,CAAC,QAAQ,EAAE,IAAI,EAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IACD,SAAS,EAAT,UAAU,QAAyB,EAAE,IAAS,EAAE,GAAQ;QACtD,OAAO,mBAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IACnD,CAAC;CACD,CAAC"}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAjv = void 0;
4
- var tslib_1 = require("tslib");
5
- /*
6
- The MIT License
7
-
8
- Copyright (c) 2017-2019 EclipseSource Munich
9
- https://github.com/eclipsesource/jsonforms
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions:
17
-
18
- The above copyright notice and this permission notice shall be included in
19
- all copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
- THE SOFTWARE.
28
- */
29
- var ajv_1 = tslib_1.__importDefault(require("ajv"));
30
- var ajv_formats_1 = tslib_1.__importDefault(require("ajv-formats"));
31
- var createAjv = function (options) {
32
- var ajv = new ajv_1.default(tslib_1.__assign({ allErrors: true, verbose: true, strict: false }, options));
33
- ajv_formats_1.default(ajv);
34
- return ajv;
35
- };
36
- exports.createAjv = createAjv;
37
- //# sourceMappingURL=validator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/util/validator.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,oDAAsB;AACtB,oEAAqC;AAG9B,IAAM,SAAS,GAAG,UAAC,OAAiB;IACzC,IAAM,GAAG,GAAG,IAAI,aAAG,oBACjB,SAAS,EAAE,IAAI,EACf,OAAO,EAAE,IAAI,EACb,MAAM,EAAE,KAAK,IACV,OAAO,EACV,CAAC;IACH,qBAAU,CAAC,GAAG,CAAC,CAAC;IAChB,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AATW,QAAA,SAAS,aASpB"}