@trayio/tray-schema 5.35.0-unstable.fd7158a → 6.0.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.
@@ -1,8 +1,8 @@
1
- import { Either } from 'effect';
1
+ import { Either } from 'fp-ts/Either';
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.Either<DynamicObject, Error>;
5
+ generateFromType(type: string, path: string): Either<Error, DynamicObject>;
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":"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"}
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"}
@@ -15,28 +15,18 @@ 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 () {
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
- })();
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
+ };
35
25
  Object.defineProperty(exports, "__esModule", { value: true });
36
26
  exports.TJSTraySchemaGenerator = void 0;
37
- const effect_1 = require("effect");
38
27
  const path_1 = require("path");
39
28
  const TJS = __importStar(require("typescript-json-schema"));
29
+ const Either_1 = require("fp-ts/Either");
40
30
  const lodash_1 = require("lodash");
41
31
  const Try_1 = require("@trayio/commons/try/Try");
42
32
  class TJSTraySchemaGenerator {
@@ -75,7 +65,7 @@ class TJSTraySchemaGenerator {
75
65
  if (schema !== null) {
76
66
  return (0, Try_1.tryToEither)(() => this.jsonSchemaToTraySchema(schema));
77
67
  }
78
- return effect_1.Either.left(new Error('Failed to generate JSON schema from type'));
68
+ return (0, Either_1.left)(new Error('Failed to generate JSON schema from type'));
79
69
  }
80
70
  jsonSchemaToTraySchema(schema) {
81
71
  const transformLookup = (object) => {
@@ -1,6 +1,29 @@
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
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const effect_1 = require("effect");
26
+ const E = __importStar(require("fp-ts/Either"));
4
27
  const path_1 = require("path");
5
28
  const TJSTraySchemaGenerator_1 = require("./TJSTraySchemaGenerator");
6
29
  describe('TJSTraySchemaGenerator', () => {
@@ -9,7 +32,7 @@ describe('TJSTraySchemaGenerator', () => {
9
32
  const dirPath = __dirname;
10
33
  const path = (0, path_1.join)(dirPath, 'dataTypes.test.data.ts');
11
34
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
12
- const actual = effect_1.Either.getOrElse((error) => {
35
+ const actual = E.getOrElse((error) => {
13
36
  console.warn(error);
14
37
  throw new Error(`Failed to generate JSON schema from type`);
15
38
  })(result);
@@ -48,7 +71,7 @@ describe('TJSTraySchemaGenerator', () => {
48
71
  const dirPath = __dirname;
49
72
  const path = (0, path_1.join)(dirPath, 'importsReusable.test.data.ts');
50
73
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
51
- const actual = effect_1.Either.getOrElse((error) => {
74
+ const actual = E.getOrElse((error) => {
52
75
  console.warn(error);
53
76
  throw new Error(`Failed to generate JSON schema from type`);
54
77
  })(result);
@@ -86,7 +109,7 @@ describe('TJSTraySchemaGenerator', () => {
86
109
  const dirPath = __dirname;
87
110
  const path = (0, path_1.join)(dirPath, 'oneOf.test.data.ts');
88
111
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
89
- const actual = effect_1.Either.getOrElse((error) => {
112
+ const actual = E.getOrElse((error) => {
90
113
  console.warn(error);
91
114
  throw new Error(`Failed to generate JSON schema from type`);
92
115
  })(result);
@@ -157,7 +180,7 @@ describe('TJSTraySchemaGenerator', () => {
157
180
  const dirPath = __dirname;
158
181
  const path = (0, path_1.join)(dirPath, 'enum.test.data.ts');
159
182
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
160
- const actual = effect_1.Either.getOrElse((error) => {
183
+ const actual = E.getOrElse((error) => {
161
184
  console.warn(error);
162
185
  throw new Error(`Failed to generate JSON schema from type`);
163
186
  })(result);
@@ -205,7 +228,7 @@ describe('TJSTraySchemaGenerator', () => {
205
228
  const dirPath = __dirname;
206
229
  const path = (0, path_1.join)(dirPath, 'enumLabels.test.data.ts');
207
230
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
208
- const actual = effect_1.Either.getOrElse((error) => {
231
+ const actual = E.getOrElse((error) => {
209
232
  console.warn(error);
210
233
  throw new Error(`Failed to generate JSON schema from type`);
211
234
  })(result);
@@ -243,7 +266,7 @@ describe('TJSTraySchemaGenerator', () => {
243
266
  const dirPath = __dirname;
244
267
  const path = (0, path_1.join)(dirPath, 'ddl.test.data.ts');
245
268
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
246
- const actual = effect_1.Either.getOrElse((error) => {
269
+ const actual = E.getOrElse((error) => {
247
270
  console.warn(error);
248
271
  throw new Error(`Failed to generate JSON schema from type`);
249
272
  })(result);
@@ -273,7 +296,7 @@ describe('TJSTraySchemaGenerator', () => {
273
296
  const dirPath = __dirname;
274
297
  const path = (0, path_1.join)(dirPath, 'ddlAuth.test.data.ts');
275
298
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
276
- const actual = effect_1.Either.getOrElse((error) => {
299
+ const actual = E.getOrElse((error) => {
277
300
  console.warn(error);
278
301
  throw new Error(`Failed to generate JSON schema from type`);
279
302
  })(result);
@@ -304,7 +327,7 @@ describe('TJSTraySchemaGenerator', () => {
304
327
  const dirPath = __dirname;
305
328
  const path = (0, path_1.join)(dirPath, 'required.test.data.ts');
306
329
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
307
- const actual = effect_1.Either.getOrElse((error) => {
330
+ const actual = E.getOrElse((error) => {
308
331
  console.warn(error);
309
332
  throw new Error(`Failed to generate JSON schema from type`);
310
333
  })(result);
@@ -326,7 +349,7 @@ describe('TJSTraySchemaGenerator', () => {
326
349
  const dirPath = __dirname;
327
350
  const path = (0, path_1.join)(dirPath, 'default.test.data.ts');
328
351
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
329
- const actual = effect_1.Either.getOrElse((error) => {
352
+ const actual = E.getOrElse((error) => {
330
353
  console.warn(error);
331
354
  throw new Error(`Failed to generate JSON schema from type`);
332
355
  })(result);
@@ -367,7 +390,7 @@ describe('TJSTraySchemaGenerator', () => {
367
390
  const dirPath = __dirname;
368
391
  const path = (0, path_1.join)(dirPath, 'default_jsonpath.test.data.ts');
369
392
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
370
- const actual = effect_1.Either.getOrElse((error) => {
393
+ const actual = E.getOrElse((error) => {
371
394
  console.warn(error);
372
395
  throw new Error(`Failed to generate JSON schema from type`);
373
396
  })(result);
@@ -388,7 +411,7 @@ describe('TJSTraySchemaGenerator', () => {
388
411
  const dirPath = __dirname;
389
412
  const path = (0, path_1.join)(dirPath, 'advanced.test.data.ts');
390
413
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
391
- const actual = effect_1.Either.getOrElse((error) => {
414
+ const actual = E.getOrElse((error) => {
392
415
  console.warn(error);
393
416
  throw new Error(`Failed to generate JSON schema from type`);
394
417
  })(result);
@@ -417,7 +440,7 @@ describe('TJSTraySchemaGenerator', () => {
417
440
  const dirPath = __dirname;
418
441
  const path = (0, path_1.join)(dirPath, 'additionalProperties.test.data.ts');
419
442
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
420
- const actual = effect_1.Either.getOrElse((error) => {
443
+ const actual = E.getOrElse((error) => {
421
444
  console.warn(error);
422
445
  throw new Error(`Failed to generate JSON schema from type`);
423
446
  })(result);
@@ -443,7 +466,7 @@ describe('TJSTraySchemaGenerator', () => {
443
466
  const dirPath = __dirname;
444
467
  const path = (0, path_1.join)(dirPath, 'dropdown.test.data.ts');
445
468
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
446
- const actual = effect_1.Either.getOrElse((error) => {
469
+ const actual = E.getOrElse((error) => {
447
470
  console.warn(error);
448
471
  throw new Error(`Failed to generate JSON schema from type`);
449
472
  })(result);
@@ -477,7 +500,7 @@ describe('TJSTraySchemaGenerator', () => {
477
500
  const dirPath = __dirname;
478
501
  const path = (0, path_1.join)(dirPath, 'tag.test.data.ts');
479
502
  const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
480
- const actual = effect_1.Either.getOrElse((error) => {
503
+ const actual = E.getOrElse((error) => {
481
504
  console.warn(error);
482
505
  throw new Error(`Failed to generate JSON schema from type`);
483
506
  })(result);
@@ -1,6 +1,6 @@
1
- import { Either } from 'effect';
1
+ import { Either } from 'fp-ts/lib/Either';
2
2
  import { DynamicObject } from '@trayio/commons/dynamictype/DynamicType';
3
3
  export interface TraySchemaGenerator {
4
- generateFromType(type: string, path: string): Either.Either<DynamicObject, Error>;
4
+ generateFromType(type: string, path: string): Either<Error, DynamicObject>;
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,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"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/tray-schema",
3
- "version": "5.35.0-unstable.fd7158a",
3
+ "version": "6.0.0",
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.35.0-unstable.fd7158a",
15
- "@types/node": "18.19.130",
16
- "effect": "3.22.2",
14
+ "@trayio/commons": "6.0.0",
15
+ "@types/node": "18.11.9",
16
+ "fp-ts": "2.12.3",
17
17
  "lodash": "4.18.1",
18
18
  "typescript-json-schema": "0.62.0"
19
19
  },