@trayio/cdk-build 4.18.0 → 4.18.2

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.
@@ -3,7 +3,7 @@ export declare class ConnectorBuilder {
3
3
  private operationSchemaGenerator;
4
4
  buildConnector(cdkProjectPath: string): TE.TaskEither<Error, undefined>;
5
5
  generateSchemas(cdkProjectPath: string): TE.TaskEither<Error, undefined>;
6
- getOperations(cdkProjectPath: string): Array<string>;
6
+ getOperations(cdkProjectPath: string): TE.TaskEither<Error, string[]>;
7
7
  private generatePackage;
8
8
  private injectRawHttpOperation;
9
9
  private injectGlobalConfigToCdkProjectPath;
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectorBuilder.d.ts","sourceRoot":"","sources":["../../src/connector/ConnectorBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAYvC,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,wBAAwB,CAA2C;IAE3E,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC;IAOvE,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC;IAcxE,aAAa,CAAC,cAAc,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAYpD,OAAO,CAAC,eAAe;IA6EvB,OAAO,CAAC,sBAAsB;IAuC9B,OAAO,CAAC,kCAAkC;IAkB1C,OAAO,CAAC,gBAAgB;CAcxB"}
1
+ {"version":3,"file":"ConnectorBuilder.d.ts","sourceRoot":"","sources":["../../src/connector/ConnectorBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAavC,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,wBAAwB,CAA2C;IAE3E,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC;IAOvE,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC;IAgBxE,aAAa,CAAC,cAAc,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAwBrE,OAAO,CAAC,eAAe;IA6EvB,OAAO,CAAC,sBAAsB;IAuC9B,OAAO,CAAC,kCAAkC;IAkB1C,OAAO,CAAC,gBAAgB;CAcxB"}
@@ -36,6 +36,7 @@ const E = __importStar(require("fp-ts/Either"));
36
36
  const adm_zip_1 = __importDefault(require("adm-zip"));
37
37
  const lodash_1 = require("lodash");
38
38
  const ZodSchemaParser_1 = require("@trayio/commons/zod/ZodSchemaParser");
39
+ const NodeFsFileStorage_1 = require("@trayio/commons/file/NodeFsFileStorage");
39
40
  const ConnectorOperationSchemaGenerator_1 = require("./operation/ConnectorOperationSchemaGenerator");
40
41
  const ConnectorJson_1 = require("./schemas/ConnectorJson");
41
42
  class ConnectorBuilder {
@@ -44,19 +45,17 @@ class ConnectorBuilder {
44
45
  return (0, function_1.pipe)(this.generateSchemas(cdkProjectPath), TE.chain(() => this.generatePackage(cdkProjectPath)));
45
46
  }
46
47
  generateSchemas(cdkProjectPath) {
47
- const operations = this.getOperations(cdkProjectPath);
48
- return (0, function_1.pipe)((0, Array_1.traverse)(TE.ApplicativeSeq)((operation) => {
48
+ return (0, function_1.pipe)(this.getOperations(cdkProjectPath), TE.chain((operations) => (0, Array_1.traverse)(TE.ApplicativeSeq)((operation) => {
49
49
  const operationPath = pathLib.join(cdkProjectPath, 'src', operation);
50
50
  return this.operationSchemaGenerator.generateSchemasForOperation(operationPath, operation);
51
- })(operations), TE.map(() => undefined));
51
+ })(operations)), TE.map(() => undefined));
52
52
  }
53
53
  getOperations(cdkProjectPath) {
54
- const srcPath = pathLib.join(cdkProjectPath, 'src');
55
- const srcEntries = fse.readdirSync(srcPath, { withFileTypes: true });
56
- return srcEntries
57
- .filter((srcEntry) => srcEntry.isDirectory())
58
- .filter((srcEntry) => fse.existsSync(pathLib.join(srcPath, srcEntry.name, 'operation.json')))
59
- .map((srcEntry) => srcEntry.name);
54
+ const fileStorage = new NodeFsFileStorage_1.NodeFsFileStorage(cdkProjectPath);
55
+ return (0, function_1.pipe)(fileStorage.readDirectory('src'), TE.map((filePaths) => filePaths
56
+ .filter((filePath) => filePath.isDirectory() &&
57
+ fse.existsSync(pathLib.join(`${cdkProjectPath}/src`, filePath.name, 'operation.json')))
58
+ .map((srcEntry) => srcEntry.name)));
60
59
  }
61
60
  // TODO: better error handling
62
61
  generatePackage(cdkProjectPath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/cdk-build",
3
- "version": "4.18.0",
3
+ "version": "4.18.2",
4
4
  "description": "Build utilities for CDK projects",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"
@@ -14,8 +14,8 @@
14
14
  "access": "public"
15
15
  },
16
16
  "dependencies": {
17
- "@trayio/commons": "4.18.0",
18
- "@trayio/tray-schema": "4.18.0",
17
+ "@trayio/commons": "4.18.2",
18
+ "@trayio/tray-schema": "4.18.2",
19
19
  "adm-zip": "0.5.10",
20
20
  "zod": "3.23.5"
21
21
  },