@trayio/tray-schema 5.34.0 → 5.35.0-unstable.fd7158a

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,8 +1,8 @@
1
- import { Either } from 'fp-ts/Either';
1
+ import { Either } from 'effect';
2
2
  import { DynamicObject } from '@trayio/commons/dynamictype/DynamicType';
3
3
  import { TraySchemaGenerator } from './TraySchemaGenerator';
4
4
  export declare class TJSTraySchemaGenerator implements TraySchemaGenerator {
5
- generateFromType(type: string, path: string): Either<Error, DynamicObject>;
5
+ generateFromType(type: string, path: string): Either.Either<DynamicObject, Error>;
6
6
  jsonSchemaToTraySchema(schema: DynamicObject): DynamicObject;
7
7
  }
8
8
  //# sourceMappingURL=TJSTraySchemaGenerator.d.ts.map
@@ -1 +1 @@
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;IA4C1E,sBAAsB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa;CA8L5D"}
1
+ {"version":3,"file":"TJSTraySchemaGenerator.d.ts","sourceRoot":"","sources":["../../src/schema/TJSTraySchemaGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EACN,aAAa,EAEb,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,qBAAa,sBAAuB,YAAW,mBAAmB;IACjE,gBAAgB,CACf,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACV,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,CAAC;IA4CtC,sBAAsB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa;CA8L5D"}
@@ -15,18 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.TJSTraySchemaGenerator = void 0;
37
+ const effect_1 = require("effect");
27
38
  const path_1 = require("path");
28
39
  const TJS = __importStar(require("typescript-json-schema"));
29
- const Either_1 = require("fp-ts/Either");
30
40
  const lodash_1 = require("lodash");
31
41
  const Try_1 = require("@trayio/commons/try/Try");
32
42
  class TJSTraySchemaGenerator {
@@ -65,7 +75,7 @@ class TJSTraySchemaGenerator {
65
75
  if (schema !== null) {
66
76
  return (0, Try_1.tryToEither)(() => this.jsonSchemaToTraySchema(schema));
67
77
  }
68
- return (0, Either_1.left)(new Error('Failed to generate JSON schema from type'));
78
+ return effect_1.Either.left(new Error('Failed to generate JSON schema from type'));
69
79
  }
70
80
  jsonSchemaToTraySchema(schema) {
71
81
  const transformLookup = (object) => {
@@ -1,29 +1,6 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
- const E = __importStar(require("fp-ts/Either"));
3
+ const effect_1 = require("effect");
27
4
  const path_1 = require("path");
28
5
  const TJSTraySchemaGenerator_1 = require("./TJSTraySchemaGenerator");
29
6
  describe('TJSTraySchemaGenerator', () => {
@@ -32,7 +9,7 @@ describe('TJSTraySchemaGenerator', () => {
32
9
  const dirPath = __dirname;
33
10
  const path = (0, path_1.join)(dirPath, 'dataTypes.test.data.ts');
34
11
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
35
- const actual = E.getOrElse((error) => {
12
+ const actual = effect_1.Either.getOrElse((error) => {
36
13
  console.warn(error);
37
14
  throw new Error(`Failed to generate JSON schema from type`);
38
15
  })(result);
@@ -71,7 +48,7 @@ describe('TJSTraySchemaGenerator', () => {
71
48
  const dirPath = __dirname;
72
49
  const path = (0, path_1.join)(dirPath, 'importsReusable.test.data.ts');
73
50
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
74
- const actual = E.getOrElse((error) => {
51
+ const actual = effect_1.Either.getOrElse((error) => {
75
52
  console.warn(error);
76
53
  throw new Error(`Failed to generate JSON schema from type`);
77
54
  })(result);
@@ -109,7 +86,7 @@ describe('TJSTraySchemaGenerator', () => {
109
86
  const dirPath = __dirname;
110
87
  const path = (0, path_1.join)(dirPath, 'oneOf.test.data.ts');
111
88
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
112
- const actual = E.getOrElse((error) => {
89
+ const actual = effect_1.Either.getOrElse((error) => {
113
90
  console.warn(error);
114
91
  throw new Error(`Failed to generate JSON schema from type`);
115
92
  })(result);
@@ -180,7 +157,7 @@ describe('TJSTraySchemaGenerator', () => {
180
157
  const dirPath = __dirname;
181
158
  const path = (0, path_1.join)(dirPath, 'enum.test.data.ts');
182
159
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
183
- const actual = E.getOrElse((error) => {
160
+ const actual = effect_1.Either.getOrElse((error) => {
184
161
  console.warn(error);
185
162
  throw new Error(`Failed to generate JSON schema from type`);
186
163
  })(result);
@@ -228,7 +205,7 @@ describe('TJSTraySchemaGenerator', () => {
228
205
  const dirPath = __dirname;
229
206
  const path = (0, path_1.join)(dirPath, 'enumLabels.test.data.ts');
230
207
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
231
- const actual = E.getOrElse((error) => {
208
+ const actual = effect_1.Either.getOrElse((error) => {
232
209
  console.warn(error);
233
210
  throw new Error(`Failed to generate JSON schema from type`);
234
211
  })(result);
@@ -266,7 +243,7 @@ describe('TJSTraySchemaGenerator', () => {
266
243
  const dirPath = __dirname;
267
244
  const path = (0, path_1.join)(dirPath, 'ddl.test.data.ts');
268
245
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
269
- const actual = E.getOrElse((error) => {
246
+ const actual = effect_1.Either.getOrElse((error) => {
270
247
  console.warn(error);
271
248
  throw new Error(`Failed to generate JSON schema from type`);
272
249
  })(result);
@@ -296,7 +273,7 @@ describe('TJSTraySchemaGenerator', () => {
296
273
  const dirPath = __dirname;
297
274
  const path = (0, path_1.join)(dirPath, 'ddlAuth.test.data.ts');
298
275
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
299
- const actual = E.getOrElse((error) => {
276
+ const actual = effect_1.Either.getOrElse((error) => {
300
277
  console.warn(error);
301
278
  throw new Error(`Failed to generate JSON schema from type`);
302
279
  })(result);
@@ -327,7 +304,7 @@ describe('TJSTraySchemaGenerator', () => {
327
304
  const dirPath = __dirname;
328
305
  const path = (0, path_1.join)(dirPath, 'required.test.data.ts');
329
306
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
330
- const actual = E.getOrElse((error) => {
307
+ const actual = effect_1.Either.getOrElse((error) => {
331
308
  console.warn(error);
332
309
  throw new Error(`Failed to generate JSON schema from type`);
333
310
  })(result);
@@ -349,7 +326,7 @@ describe('TJSTraySchemaGenerator', () => {
349
326
  const dirPath = __dirname;
350
327
  const path = (0, path_1.join)(dirPath, 'default.test.data.ts');
351
328
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
352
- const actual = E.getOrElse((error) => {
329
+ const actual = effect_1.Either.getOrElse((error) => {
353
330
  console.warn(error);
354
331
  throw new Error(`Failed to generate JSON schema from type`);
355
332
  })(result);
@@ -390,7 +367,7 @@ describe('TJSTraySchemaGenerator', () => {
390
367
  const dirPath = __dirname;
391
368
  const path = (0, path_1.join)(dirPath, 'default_jsonpath.test.data.ts');
392
369
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
393
- const actual = E.getOrElse((error) => {
370
+ const actual = effect_1.Either.getOrElse((error) => {
394
371
  console.warn(error);
395
372
  throw new Error(`Failed to generate JSON schema from type`);
396
373
  })(result);
@@ -411,7 +388,7 @@ describe('TJSTraySchemaGenerator', () => {
411
388
  const dirPath = __dirname;
412
389
  const path = (0, path_1.join)(dirPath, 'advanced.test.data.ts');
413
390
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
414
- const actual = E.getOrElse((error) => {
391
+ const actual = effect_1.Either.getOrElse((error) => {
415
392
  console.warn(error);
416
393
  throw new Error(`Failed to generate JSON schema from type`);
417
394
  })(result);
@@ -440,7 +417,7 @@ describe('TJSTraySchemaGenerator', () => {
440
417
  const dirPath = __dirname;
441
418
  const path = (0, path_1.join)(dirPath, 'additionalProperties.test.data.ts');
442
419
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
443
- const actual = E.getOrElse((error) => {
420
+ const actual = effect_1.Either.getOrElse((error) => {
444
421
  console.warn(error);
445
422
  throw new Error(`Failed to generate JSON schema from type`);
446
423
  })(result);
@@ -466,7 +443,7 @@ describe('TJSTraySchemaGenerator', () => {
466
443
  const dirPath = __dirname;
467
444
  const path = (0, path_1.join)(dirPath, 'dropdown.test.data.ts');
468
445
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
469
- const actual = E.getOrElse((error) => {
446
+ const actual = effect_1.Either.getOrElse((error) => {
470
447
  console.warn(error);
471
448
  throw new Error(`Failed to generate JSON schema from type`);
472
449
  })(result);
@@ -500,7 +477,7 @@ describe('TJSTraySchemaGenerator', () => {
500
477
  const dirPath = __dirname;
501
478
  const path = (0, path_1.join)(dirPath, 'tag.test.data.ts');
502
479
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
503
- const actual = E.getOrElse((error) => {
480
+ const actual = effect_1.Either.getOrElse((error) => {
504
481
  console.warn(error);
505
482
  throw new Error(`Failed to generate JSON schema from type`);
506
483
  })(result);
@@ -1,6 +1,6 @@
1
- import { Either } from 'fp-ts/lib/Either';
1
+ import { Either } from 'effect';
2
2
  import { DynamicObject } from '@trayio/commons/dynamictype/DynamicType';
3
3
  export interface TraySchemaGenerator {
4
- generateFromType(type: string, path: string): Either<Error, DynamicObject>;
4
+ generateFromType(type: string, path: string): Either.Either<DynamicObject, Error>;
5
5
  }
6
6
  //# sourceMappingURL=TraySchemaGenerator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TraySchemaGenerator.d.ts","sourceRoot":"","sources":["../../src/schema/TraySchemaGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,MAAM,WAAW,mBAAmB;IACnC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;CAC3E"}
1
+ {"version":3,"file":"TraySchemaGenerator.d.ts","sourceRoot":"","sources":["../../src/schema/TraySchemaGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,MAAM,WAAW,mBAAmB;IACnC,gBAAgB,CACf,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACV,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;CACvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/tray-schema",
3
- "version": "5.34.0",
3
+ "version": "5.35.0-unstable.fd7158a",
4
4
  "description": "Schema for Tray connectors and authentications",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"
@@ -11,9 +11,9 @@
11
11
  "access": "public"
12
12
  },
13
13
  "dependencies": {
14
- "@trayio/commons": "5.34.0",
15
- "@types/node": "18.11.9",
16
- "fp-ts": "2.12.3",
14
+ "@trayio/commons": "5.35.0-unstable.fd7158a",
15
+ "@types/node": "18.19.130",
16
+ "effect": "3.22.2",
17
17
  "lodash": "4.18.1",
18
18
  "typescript-json-schema": "0.62.0"
19
19
  },