@forge/manifest
Advanced tools
Comparing version 7.10.0-next.3 to 7.10.0-next.4
@@ -13,2 +13,3 @@ "use strict"; | ||
const data_classification_validator_1 = require("../validators/data-classification-validator"); | ||
const remote_regions_validator_1 = require("../validators/remote-regions-validator"); | ||
class FullValidationProcessor extends abstract_validation_processor_1.AbstractValidationProcessor { | ||
@@ -35,3 +36,4 @@ constructor() { | ||
new data_classification_validator_1.DataClassificationValidator(), | ||
new validators_1.TranslationsValidator() | ||
new validators_1.TranslationsValidator(), | ||
new remote_regions_validator_1.RemoteRegionsValidator() | ||
]); | ||
@@ -38,0 +40,0 @@ } |
@@ -8,2 +8,3 @@ "use strict"; | ||
const FULL_SCHEMA = tslib_1.__importStar(require("../schema/manifest-schema.json")); | ||
const remote_regions_validator_1 = require("../validators/remote-regions-validator"); | ||
class RemoteComputeValidationProcessor extends abstract_validation_processor_1.AbstractValidationProcessor { | ||
@@ -15,2 +16,3 @@ constructor() { | ||
new validators_1.SchemaValidator(FULL_SCHEMA), | ||
new remote_regions_validator_1.RemoteRegionsValidator(), | ||
new validators_1.ModulesValidator() | ||
@@ -17,0 +19,0 @@ ]); |
@@ -113,2 +113,3 @@ import { type ForgeSupportedLocaleCode } from '../schema/manifest'; | ||
missingModuleRemoteStorageInScopeEUD: (key: string) => string; | ||
allRegionsNotDeclared: (key: string) => string; | ||
}; | ||
@@ -138,2 +139,3 @@ rovo: { | ||
missingProfileFunction: (provider: string, functionKey: string) => string; | ||
hasRegionUrls: (provider: string, remote: string) => string; | ||
}; | ||
@@ -140,0 +142,0 @@ app: { |
@@ -124,3 +124,4 @@ "use strict"; | ||
remote: { | ||
missingModuleRemoteStorageInScopeEUD: (key) => `missing storage.inScopeEUD in ${key} module. storage.inScopeEUD is required if storage is present in operations.` | ||
missingModuleRemoteStorageInScopeEUD: (key) => `missing storage.inScopeEUD in ${key} module. storage.inScopeEUD is required if storage is present in operations.`, | ||
allRegionsNotDeclared: (key) => `All region specific URLs are not declared for ${key}` | ||
}, | ||
@@ -149,3 +150,4 @@ rovo: { | ||
missingEgress: (remote) => `missing egress permissions for remote '${remote}'. Please add the remote to permissions.fetch`, | ||
missingProfileFunction: (provider, functionKey) => `missing function '${functionKey}' is being referenced by '${provider}' in providers` | ||
missingProfileFunction: (provider, functionKey) => `missing function '${functionKey}' is being referenced by '${provider}' in providers`, | ||
hasRegionUrls: (provider, remote) => `External Authentication Provider does not support region specific URLs. The '${provider}' provider's remote '${remote}' contains region specific URLs.` | ||
}, | ||
@@ -152,0 +154,0 @@ app: { |
@@ -8,3 +8,4 @@ import { ManifestObject, ManifestValidationResult } from '../types'; | ||
private isValidProfileRetrieverFunction; | ||
private isValidAuthRemote; | ||
} | ||
//# sourceMappingURL=providers-validator.d.ts.map |
@@ -6,2 +6,3 @@ "use strict"; | ||
const text_1 = require("../text"); | ||
const remote_regions_validator_1 = require("./remote-regions-validator"); | ||
class ProvidersValidator { | ||
@@ -15,3 +16,3 @@ async validate(manifest) { | ||
} | ||
const validationErrors = []; | ||
let validationErrors = []; | ||
const auth = manifest.typedContent.providers.auth; | ||
@@ -65,2 +66,5 @@ const remotes = manifest.typedContent.remotes; | ||
}); | ||
auth?.forEach((provider) => { | ||
validationErrors = [...validationErrors, ...this.isValidAuthRemote(provider, manifest, remotes)]; | ||
}); | ||
return { | ||
@@ -96,3 +100,30 @@ success: validationErrors.length === 0, | ||
} | ||
isValidAuthRemote(provider, manifest, remotes) { | ||
const validationErrors = []; | ||
const referencedRemotes = [...(provider.remotes || [])]; | ||
if ('actions' in provider) { | ||
referencedRemotes.push(provider.actions.retrieveProfile.remote); | ||
referencedRemotes.push(provider.actions.exchange.remote); | ||
referencedRemotes.push(provider.actions.authorization.remote); | ||
provider.actions.revokeToken && referencedRemotes.push(provider.actions.revokeToken.remote); | ||
provider.actions.refreshToken && referencedRemotes.push(provider.actions.refreshToken.remote); | ||
} | ||
referencedRemotes?.forEach((providerRemoteKey) => { | ||
const remote = remotes?.find((remote) => remote.key === providerRemoteKey); | ||
if (!remote) { | ||
return; | ||
} | ||
const remoteRegions = (0, remote_regions_validator_1.getRegionsFromBaseUrl)(remote.baseUrl); | ||
if (remoteRegions.size != 1) { | ||
validationErrors.push({ | ||
message: text_1.errors.providers.hasRegionUrls(provider.key, remote.key), | ||
reference: text_1.References.Providers, | ||
level: 'error', | ||
...(0, utils_1.findPosition)(providerRemoteKey, manifest.yamlContentByLine) | ||
}); | ||
} | ||
}); | ||
return validationErrors; | ||
} | ||
} | ||
exports.ProvidersValidator = ProvidersValidator; |
{ | ||
"name": "@forge/manifest", | ||
"version": "7.10.0-next.3", | ||
"version": "7.10.0-next.4", | ||
"description": "Definitions and validations of the Forge manifest", | ||
@@ -5,0 +5,0 @@ "main": "out/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3347990
264
96024