@trayio/tray-schema 4.30.0 → 4.31.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.
- package/dist/schema/TJSTraySchemaGenerator.d.ts.map +1 -1
- package/dist/schema/TJSTraySchemaGenerator.js +24 -14
- package/dist/schema/TJSTraySchemaGenerator.unit.test.js +9 -11
- package/dist/schema/dropdown.test.data.d.ts +4 -0
- package/dist/schema/dropdown.test.data.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TJSTraySchemaGenerator.d.ts","sourceRoot":"","sources":["../../src/schema/TJSTraySchemaGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"TJSTraySchemaGenerator.d.ts","sourceRoot":"","sources":["../../src/schema/TJSTraySchemaGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAQ,MAAM,cAAc,CAAC;AAE5C,OAAO,EACN,aAAa,EAEb,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,qBAAa,sBAAuB,YAAW,mBAAmB;IACjE,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC;IA2C1E,sBAAsB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa;CAiM5D"}
|
|
@@ -82,20 +82,30 @@ class TJSTraySchemaGenerator {
|
|
|
82
82
|
const transformDropDown = (object) => {
|
|
83
83
|
if (object.dropdown === false) {
|
|
84
84
|
const unionTypes = [];
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
unionTypes.push(item);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
85
|
+
let extras = {};
|
|
86
|
+
if (object.oneOf) {
|
|
87
|
+
object.oneOf.forEach((item) => {
|
|
88
|
+
unionTypes.push(item.type);
|
|
89
|
+
if (item.type === 'object') {
|
|
90
|
+
extras = {
|
|
91
|
+
...extras,
|
|
92
|
+
additionalProperties: true,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (item.type === 'array') {
|
|
96
|
+
extras = {
|
|
97
|
+
...extras,
|
|
98
|
+
items: {
|
|
99
|
+
type: item.items.type,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
object.type = [...new Set(unionTypes)];
|
|
105
|
+
Object.assign(object, extras);
|
|
106
|
+
delete object.oneOf;
|
|
107
|
+
delete object.dropdown;
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
110
|
};
|
|
101
111
|
const transformEnumLabels = (object) => {
|
|
@@ -453,22 +453,20 @@ describe('TJSTraySchemaGenerator', () => {
|
|
|
453
453
|
type: 'object',
|
|
454
454
|
properties: {
|
|
455
455
|
emails: {
|
|
456
|
-
type: [
|
|
457
|
-
|
|
458
|
-
type: 'object',
|
|
459
|
-
properties: {},
|
|
460
|
-
additionalProperties: true,
|
|
461
|
-
advanced: [],
|
|
462
|
-
},
|
|
463
|
-
'string',
|
|
464
|
-
],
|
|
456
|
+
type: ['object', 'string'],
|
|
457
|
+
additionalProperties: true,
|
|
465
458
|
},
|
|
466
459
|
workspaces: {
|
|
467
|
-
type: [
|
|
460
|
+
type: ['array', 'string'],
|
|
461
|
+
items: { type: 'string' },
|
|
462
|
+
},
|
|
463
|
+
projects: {
|
|
464
|
+
type: ['array', 'string'],
|
|
465
|
+
items: { type: 'number' },
|
|
468
466
|
},
|
|
469
467
|
},
|
|
470
468
|
advanced: [],
|
|
471
|
-
required: ['emails', 'workspaces'],
|
|
469
|
+
required: ['emails', 'projects', 'workspaces'],
|
|
472
470
|
additionalProperties: false,
|
|
473
471
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
474
472
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.test.data.d.ts","sourceRoot":"","sources":["../../src/schema/dropdown.test.data.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IACnB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAExB;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"dropdown.test.data.d.ts","sourceRoot":"","sources":["../../src/schema/dropdown.test.data.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IACnB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAExB;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE9B;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trayio/tray-schema",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.31.0",
|
|
4
4
|
"description": "Schema for Tray connectors and authentications",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": "./dist/*.js"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@trayio/commons": "4.
|
|
14
|
+
"@trayio/commons": "4.31.0",
|
|
15
15
|
"@types/node": "18.11.9",
|
|
16
16
|
"lodash": "4.17.21",
|
|
17
17
|
"typescript-json-schema": "0.62.0"
|