@trayio/tray-schema 3.8.1-beta → 3.9.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.
@@ -2,51 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LegacyTraySchemaConverter = void 0;
4
4
  class LegacyTraySchemaConverter {
5
- constructor() {
6
- this.transformLookup = (object) => {
7
- if (typeof object !== 'object' || object === null)
8
- return object;
9
- if (object.lookup &&
10
- object.lookup.operation &&
11
- object.lookup.input) {
12
- const lookup = object.lookup;
13
- object.lookup = {
14
- url: '{{{step.ephemeral_url}}}',
15
- body: Object.assign({ step_settings: this.transformLookupInput(lookup.input), message: lookup.operation }, (lookup.authRequired && { auth_id: '{{{step.auth_id}}}' })),
16
- };
17
- }
18
- return object;
19
- };
20
- this.transformLookupInput = (input) => {
21
- if (typeof input !== 'object' || input === null)
22
- return input;
23
- const result = {};
24
- Object.keys(input).forEach((key) => {
25
- result[key] = {
26
- value: typeof input[key] === 'object'
27
- ? this.transformLookupInput(input[key])
28
- : input[key],
29
- type: typeof input[key],
30
- };
31
- });
32
- return result;
33
- };
34
- this.transformEnums = (object) => {
35
- if (typeof object !== 'object' || object === null)
36
- return object;
37
- if (object.enum &&
38
- object.enumLabels &&
39
- Array.isArray(object.enum) &&
40
- Array.isArray(object.enumLabels)) {
41
- object.enum = object.enum.map((enumItem, index) => ({
42
- value: enumItem,
43
- text: object.enumLabels[index],
44
- }));
45
- delete object.enumLabels;
46
- }
47
- return object;
48
- };
49
- }
50
5
  convertToLegacySchema(schema) {
51
6
  for (const [key, value] of Object.entries(schema)) {
52
7
  if (typeof value === 'object' && value !== null) {
@@ -57,5 +12,52 @@ class LegacyTraySchemaConverter {
57
12
  }
58
13
  return schema;
59
14
  }
15
+ transformLookup = (object) => {
16
+ if (typeof object !== 'object' || object === null)
17
+ return object;
18
+ if (object.lookup &&
19
+ object.lookup.operation &&
20
+ object.lookup.input) {
21
+ const lookup = object.lookup;
22
+ object.lookup = {
23
+ url: '{{{step.ephemeral_url}}}',
24
+ body: {
25
+ step_settings: this.transformLookupInput(lookup.input),
26
+ message: lookup.operation,
27
+ ...(lookup.authRequired && { auth_id: '{{{step.auth_id}}}' }),
28
+ },
29
+ };
30
+ }
31
+ return object;
32
+ };
33
+ transformLookupInput = (input) => {
34
+ if (typeof input !== 'object' || input === null)
35
+ return input;
36
+ const result = {};
37
+ Object.keys(input).forEach((key) => {
38
+ result[key] = {
39
+ value: typeof input[key] === 'object'
40
+ ? this.transformLookupInput(input[key])
41
+ : input[key],
42
+ type: typeof input[key],
43
+ };
44
+ });
45
+ return result;
46
+ };
47
+ transformEnums = (object) => {
48
+ if (typeof object !== 'object' || object === null)
49
+ return object;
50
+ if (object.enum &&
51
+ object.enumLabels &&
52
+ Array.isArray(object.enum) &&
53
+ Array.isArray(object.enumLabels)) {
54
+ object.enum = object.enum.map((enumItem, index) => ({
55
+ value: enumItem,
56
+ text: object.enumLabels[index],
57
+ }));
58
+ delete object.enumLabels;
59
+ }
60
+ return object;
61
+ };
60
62
  }
61
63
  exports.LegacyTraySchemaConverter = LegacyTraySchemaConverter;
@@ -136,7 +136,10 @@ class TJSTraySchemaGenerator {
136
136
  }
137
137
  }
138
138
  else if (typeof value === 'object' && value !== null) {
139
- object[key] = Object.assign(Object.assign({}, object[key]), value);
139
+ object[key] = {
140
+ ...object[key],
141
+ ...value,
142
+ };
140
143
  }
141
144
  else {
142
145
  object[key] = value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/tray-schema",
3
- "version": "3.8.1-beta",
3
+ "version": "3.9.1",
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": "3.8.1-beta",
14
+ "@trayio/commons": "3.9.1",
15
15
  "@types/node": "18.11.9",
16
16
  "lodash": "4.17.21",
17
17
  "typescript-json-schema": "0.62.0"