@trayio/cdk-build 5.13.0 → 5.14.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.
|
@@ -8,5 +8,10 @@ export declare class ConnectorBuilder {
|
|
|
8
8
|
private injectRawHttpOperation;
|
|
9
9
|
private injectGlobalConfigToCdkProjectPath;
|
|
10
10
|
private addRawHttpConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Validates that operations with dynamic_output: true have corresponding _output_schema operations
|
|
13
|
+
* Users must create these using: tray-cdk connector add-dynamic-output-schema <operation-name>
|
|
14
|
+
*/
|
|
15
|
+
private validateDynamicOutputOperations;
|
|
11
16
|
}
|
|
12
17
|
//# sourceMappingURL=ConnectorBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectorBuilder.d.ts","sourceRoot":"","sources":["../../src/connector/ConnectorBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConnectorBuilder.d.ts","sourceRoot":"","sources":["../../src/connector/ConnectorBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAcvC,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,wBAAwB,CAA2C;IAE3E,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC;IAQvE,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;IAqFvB,OAAO,CAAC,sBAAsB;IAuC9B,OAAO,CAAC,kCAAkC;IAkB1C,OAAO,CAAC,gBAAgB;IAexB;;;OAGG;IACH,OAAO,CAAC,+BAA+B;CAqDvC"}
|
|
@@ -42,7 +42,7 @@ const ConnectorJson_1 = require("./schemas/ConnectorJson");
|
|
|
42
42
|
class ConnectorBuilder {
|
|
43
43
|
operationSchemaGenerator = new ConnectorOperationSchemaGenerator_1.ConnectorOperationSchemaGenerator();
|
|
44
44
|
buildConnector(cdkProjectPath) {
|
|
45
|
-
return (0, function_1.pipe)(this.generateSchemas(cdkProjectPath), TE.chain(() => this.generatePackage(cdkProjectPath)));
|
|
45
|
+
return (0, function_1.pipe)(this.validateDynamicOutputOperations(cdkProjectPath), TE.chain(() => this.generateSchemas(cdkProjectPath)), TE.chain(() => this.generatePackage(cdkProjectPath)));
|
|
46
46
|
}
|
|
47
47
|
generateSchemas(cdkProjectPath) {
|
|
48
48
|
return (0, function_1.pipe)(this.getOperations(cdkProjectPath), TE.chain((operations) => (0, Array_1.traverse)(TE.ApplicativeSeq)((operation) => {
|
|
@@ -120,5 +120,34 @@ class ConnectorBuilder {
|
|
|
120
120
|
}
|
|
121
121
|
return connectorJson;
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Validates that operations with dynamic_output: true have corresponding _output_schema operations
|
|
125
|
+
* Users must create these using: tray-cdk connector add-dynamic-output-schema <operation-name>
|
|
126
|
+
*/
|
|
127
|
+
validateDynamicOutputOperations(cdkProjectPath) {
|
|
128
|
+
return (0, function_1.pipe)(this.getOperations(cdkProjectPath), TE.chain((operations) => (0, Array_1.traverse)(TE.ApplicativeSeq)((operation) => {
|
|
129
|
+
// Skip _output_schema operations themselves
|
|
130
|
+
if (operation.endsWith('_output_schema')) {
|
|
131
|
+
return TE.right(undefined);
|
|
132
|
+
}
|
|
133
|
+
const operationPath = pathLib.join(cdkProjectPath, 'src', operation);
|
|
134
|
+
const operationJsonPath = pathLib.join(operationPath, 'operation.json');
|
|
135
|
+
return TE.tryCatch(async () => {
|
|
136
|
+
// Read operation.json to check for dynamic_output flag
|
|
137
|
+
const operationJson = await fse.readJson(operationJsonPath);
|
|
138
|
+
if (operationJson.dynamic_output === true) {
|
|
139
|
+
// Validate that _output_schema operation exists
|
|
140
|
+
const outputSchemaOpName = `${operation}_output_schema`;
|
|
141
|
+
const outputSchemaOpPath = pathLib.join(cdkProjectPath, 'src', outputSchemaOpName);
|
|
142
|
+
if (!fse.existsSync(outputSchemaOpPath)) {
|
|
143
|
+
throw new Error(`Operation '${operation}' has dynamic_output: true but missing '${outputSchemaOpName}' operation.\n` +
|
|
144
|
+
`Run: tray-cdk connector add-dynamic-output-schema ${operation}`);
|
|
145
|
+
}
|
|
146
|
+
console.log(`✓ Dynamic output schema operation found for: ${operation}`);
|
|
147
|
+
}
|
|
148
|
+
return undefined;
|
|
149
|
+
}, (reason) => new Error(String(reason)));
|
|
150
|
+
})(operations)), TE.map(() => undefined));
|
|
151
|
+
}
|
|
123
152
|
}
|
|
124
153
|
exports.ConnectorBuilder = ConnectorBuilder;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trayio/cdk-build",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.14.0",
|
|
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": "5.
|
|
18
|
-
"@trayio/tray-schema": "5.
|
|
17
|
+
"@trayio/commons": "5.14.0",
|
|
18
|
+
"@trayio/tray-schema": "5.14.0",
|
|
19
19
|
"adm-zip": "0.5.10",
|
|
20
20
|
"zod": "3.23.5"
|
|
21
21
|
},
|