Skip to content
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adobe/aio-cli-plugin-api-mesh",
"version": "5.6.1",
"version": "5.6.2",
"description": "Adobe I/O CLI plugin to develop and manage API mesh sources",
"keywords": [
"oclif-plugin"
Expand Down Expand Up @@ -38,7 +38,7 @@
"version": "oclif-dev readme && git add README.md"
},
"dependencies": {
"@adobe-apimesh/mesh-builder": "2.3.1",
"@adobe-apimesh/mesh-builder": "^2.4.0",
"@adobe/aio-cli-lib-console": "^5.0.0",
"@adobe/aio-lib-core-config": "^5.0.0",
"@adobe/aio-lib-core-logging": "^3.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/commands/api-mesh/__tests__/run.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jest.mock('@adobe-apimesh/mesh-builder', () => {
validateMesh: jest.fn().mockResolvedValue({}),
buildMesh: jest.fn().mockResolvedValue({}),
compileMesh: jest.fn().mockResolvedValue({}),
normalizeMeshConfig: jest.fn().mockResolvedValue({}),
},
};
});
Expand Down
7 changes: 4 additions & 3 deletions src/commands/api-mesh/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const {
} = require('../../project');
const { resolveRelativeSources } = require('../../meshArtifact');

const { validateMesh, buildMesh, compileMesh } = meshBuilder.default;
const { validateMesh, buildMesh, compileMesh, normalizeMeshConfig } = meshBuilder.default;

class RunCommand extends Command {
static summary = 'Run local development server';
Expand Down Expand Up @@ -188,8 +188,9 @@ class RunCommand extends Command {

//Generating unique mesh id
const meshId = 'testMesh';
await validateMesh(data.meshConfig);
await buildMesh(meshId, data.meshConfig);
const normalizedMeshConfig = await normalizeMeshConfig(data.meshConfig);
await validateMesh(normalizedMeshConfig);
await buildMesh(meshId, normalizedMeshConfig);
await compileMesh(meshId);

// Resolve relative sources in built mesh for local development
Expand Down
17 changes: 16 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,21 @@ function getFilesInMeshConfig(data, meshConfigName) {
}
});

// Additional Type Defs
const additionalTypeDefs =
typeof data.meshConfig.additionalTypeDefs === 'string'
? [data.meshConfig.additionalTypeDefs]
: data.meshConfig.additionalTypeDefs;
additionalTypeDefs?.forEach(additionalTypeDef => {
if (
typeof additionalTypeDef === 'string' &&
!fileURLRegex.test(additionalTypeDef) &&
(additionalTypeDef.endsWith('.graphql') || additionalTypeDef.endsWith('.gql'))
) {
filesList.push(additionalTypeDef);
}
});

// ReplaceField Transform - source level
data.meshConfig.sources.transforms?.forEach(transform => {
transform.replaceField?.replacements.forEach(replacement => {
Expand Down Expand Up @@ -398,7 +413,7 @@ function validateFileType(filesList) {

filesList.forEach(file => {
const extension = path.extname(file);
const isValidFileType = ['.js', '.json', '.graphql'].includes(extension);
const isValidFileType = ['.js', '.json', '.graphql', '.gql'].includes(extension);

if (!isValidFileType) {
filesWithInvalidTypes.push(path.basename(file));
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf"
integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==

"@adobe-apimesh/mesh-builder@2.3.1":
version "2.3.1"
resolved "https://registry.yarnpkg.com/@adobe-apimesh/mesh-builder/-/mesh-builder-2.3.1.tgz#72e0cc90bf145078eeae7597aa8d4551592805b2"
integrity sha512-r0FR2AFYk5ZmIMWivfTmA3D/k3wRJZAFb5ur3mR3+t3LK6z091PfHcm9jBJV2pkNLmJV8C7xy35YMZHJD2O2Jg==
"@adobe-apimesh/mesh-builder@^2.4.0":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@adobe-apimesh/mesh-builder/-/mesh-builder-2.4.0.tgz#35fc8ae0ecd5617cfdb585cb923bf0112ad4d56f"
integrity sha512-MnvojKskFRY/wVy1Sh5xVOTgA4c3pi8jU9CtihljjrVNqp0DxkKhcCGvD5UJf5gnqOCnyFcEhDQ6CObZP8tEAw==
dependencies:
"@fastify/request-context" "^4.1.0"
eslint "^8.39.0"
Expand Down
Loading