@extrahorizon/exh-cli 1.13.0-dev-175-2fcbbbb → 1.13.0-dev-176-855baa8

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.
@@ -1,67 +1,38 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "if": {
4
- "description": "Try to determine if we have V1 schema",
5
- "anyOf": [
6
- {
7
- "type": "object",
8
- "required": ["version"],
9
- "properties": { "version": { "const": 1 } }
10
- },
11
- {
12
- "type": "object",
13
- "required": ["schema"],
14
- "properties": {
15
- "version": { "const": 1 },
16
- "schema": true
17
- }
18
- },
19
- {
20
- "type": "object",
21
- "required": ["fields"],
22
- "properties": {
23
- "version": { "const": 1 },
24
- "fields": true
25
- }
26
- }
27
- ]
28
- },
29
- "then": { "$ref": "#/definitions/TemplateV1" },
30
- "else": { "$ref": "#/definitions/TemplateV2" },
31
- "definitions": {
32
- "TemplateV2": {
3
+ "type": "object",
4
+ "additionalProperties": false,
5
+ "properties": {
6
+ "$schema": { "type": "string" },
7
+ "description": {
8
+ "type": "string",
9
+ "minLength": 1
10
+ },
11
+ "extendsTemplate": { "type": "string" },
12
+ "inputs": {
33
13
  "type": "object",
34
- "additionalProperties": false,
35
- "properties": {
36
- "version": { "const": 2 },
37
- "$schema": { "type": "string" },
38
- "description": {
39
- "type": "string",
40
- "minLength": 1
41
- },
42
- "extendsTemplate": { "type": "string" },
43
- "inputs": {
44
- "type": "object",
45
- "additionalProperties": { "$ref": "#/definitions/TypeConfigurationV2" }
46
- },
47
- "outputs": {
48
- "type": "object",
49
- "additionalProperties": {
50
- "type": "string",
51
- "minLength": 1
52
- }
53
- },
54
- "variables": {
55
- "type": "object",
56
- "additionalProperties": { "type": "string" }
57
- }
14
+ "additionalProperties": { "$ref": "#/definitions/TypeConfigurationV2" }
15
+ },
16
+ "outputs": {
17
+ "type": "object",
18
+ "additionalProperties": {
19
+ "type": "string",
20
+ "minLength": 1
58
21
  }
59
22
  },
23
+ "variables": {
24
+ "type": "object",
25
+ "additionalProperties": { "type": "string" }
26
+ }
27
+ },
28
+ "definitions": {
60
29
  "TypeConfigurationV2": {
61
30
  "type": "object",
62
31
  "required": ["type"],
63
32
  "properties": {
64
- "type": { "enum": ["object", "array", "string", "number", "boolean"] }
33
+ "type": {
34
+ "enum": ["object", "array", "string", "number", "boolean"]
35
+ }
65
36
  },
66
37
  "allOf": [
67
38
  {
@@ -155,149 +126,6 @@
155
126
  "properties": {
156
127
  "type": { "const": "boolean" }
157
128
  }
158
- },
159
- "TemplateV1": {
160
- "type": "object",
161
- "required": ["description", "schema", "fields"],
162
- "properties": {
163
- "version": { "const": 1 },
164
- "$schema": { "type": "string" },
165
- "extends_template": { "type": "string" },
166
- "description": { "type": "string" },
167
- "schema": { "$ref": "#/definitions/ObjectConfiguration" },
168
- "fields": {
169
- "type": "object",
170
- "additionalProperties": { "type": "string" }
171
- }
172
- }
173
- },
174
- "TypeConfiguration": {
175
- "type": "object",
176
- "required": ["type"],
177
- "properties": {
178
- "type": { "enum": ["object", "array", "string", "number", "boolean", "object_id", "date"] }
179
- },
180
- "allOf": [
181
- {
182
- "if": {
183
- "type": "object",
184
- "properties": {
185
- "type": { "const": "object" }
186
- }
187
- },
188
- "then": { "$ref": "#/definitions/ObjectConfiguration" }
189
- },
190
- {
191
- "if": {
192
- "type": "object",
193
- "properties": {
194
- "type": { "const": "array" }
195
- }
196
- },
197
- "then": { "$ref": "#/definitions/ArrayConfiguration" }
198
- },
199
- {
200
- "if": {
201
- "type": "object",
202
- "properties": {
203
- "type": { "const": "string" }
204
- }
205
- },
206
- "then": { "$ref": "#/definitions/StringConfiguration" }
207
- },
208
- {
209
- "if": {
210
- "type": "object",
211
- "properties": {
212
- "type": { "const": "number" }
213
- }
214
- },
215
- "then": { "$ref": "#/definitions/NumberConfiguration" }
216
- },
217
- {
218
- "if": {
219
- "type": "object",
220
- "properties": {
221
- "type": { "const": "boolean" }
222
- }
223
- },
224
- "then": { "$ref": "#/definitions/BooleanConfiguration" }
225
- },
226
- {
227
- "if": {
228
- "type": "object",
229
- "properties": {
230
- "type": { "const": "object_id" }
231
- }
232
- },
233
- "then": { "$ref": "#/definitions/ObjectIdConfiguration" }
234
- },
235
- {
236
- "if": {
237
- "type": "object",
238
- "properties": {
239
- "type": { "const": "date" }
240
- }
241
- },
242
- "then": { "$ref": "#/definitions/DateConfiguration" }
243
- }
244
- ]
245
- },
246
- "ObjectConfiguration": {
247
- "type": "object",
248
- "required": ["type"],
249
- "properties": {
250
- "type": { "const": "object" },
251
- "fields": {
252
- "type": "object",
253
- "additionalProperties": {
254
- "$ref": "#/definitions/TypeConfiguration"
255
- }
256
- }
257
- }
258
- },
259
- "ArrayConfiguration": {
260
- "type": "object",
261
- "required": ["type", "type_configuration"],
262
- "properties": {
263
- "type": { "const": "array" },
264
- "type_configuration": { "$ref": "#/definitions/TypeConfiguration" }
265
- }
266
- },
267
- "StringConfiguration": {
268
- "type": "object",
269
- "required": ["type"],
270
- "properties": {
271
- "type": { "const": "string" }
272
- }
273
- },
274
- "NumberConfiguration": {
275
- "type": "object",
276
- "required": ["type"],
277
- "properties": {
278
- "type": { "const": "number" }
279
- }
280
- },
281
- "BooleanConfiguration": {
282
- "type": "object",
283
- "required": ["type"],
284
- "properties": {
285
- "type": { "const": "boolean" }
286
- }
287
- },
288
- "ObjectIdConfiguration": {
289
- "type": "object",
290
- "required": ["type"],
291
- "properties": {
292
- "type": { "const": "object_id" }
293
- }
294
- },
295
- "DateConfiguration": {
296
- "type": "object",
297
- "required": ["type"],
298
- "properties": {
299
- "type": { "const": "date" }
300
- }
301
129
  }
302
130
  }
303
131
  }
@@ -25,7 +25,9 @@ exports.readTemplateFiles = readTemplateFiles;
25
25
  async function readAndValidateTemplateJson(fileName) {
26
26
  try {
27
27
  const content = await (0, utils_1.readJsonFile)(fileName);
28
- (0, util_1.ajvValidate)(templateConfigSchema, content);
28
+ if (!(0, utils_1.isV1Template)(content)) {
29
+ (0, util_1.ajvValidate)(templateConfigSchema, content);
30
+ }
29
31
  return content;
30
32
  }
31
33
  catch (error) {
@@ -21,8 +21,7 @@ function removeFileNameExtension(fileName) {
21
21
  }
22
22
  exports.removeFileNameExtension = removeFileNameExtension;
23
23
  function isV1Template(template) {
24
- return (template.version === 1 ||
25
- !!template.schema ||
24
+ return (!!template.schema ||
26
25
  !!template.fields);
27
26
  }
28
27
  exports.isV1Template = isV1Template;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extrahorizon/exh-cli",
3
- "version": "1.13.0-dev-175-2fcbbbb",
3
+ "version": "1.13.0-dev-176-855baa8",
4
4
  "main": "build/index.js",
5
5
  "exports": "./build/index.js",
6
6
  "license": "MIT",