npm package diff
Package: @forge/manifest
Versions: 8.0.0-next.10 - 8.0.0-next.11
File: package/out/validators/modules-validators/dataResidency/validate-data-residency-migration.js
Index: package/out/validators/modules-validators/dataResidency/validate-data-residency-migration.js
===================================================================
--- package/out/validators/modules-validators/dataResidency/validate-data-residency-migration.js
+++ package/out/validators/modules-validators/dataResidency/validate-data-residency-migration.js
@@ -0,0 +1,33 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.validateDataResidencyMigration = void 0;
+const types_1 = require("../../../types");
+const text_1 = require("../../../text");
+const utils_1 = require("../../../utils");
+const validateDataResidencyMigration = (modules, remotes, yamlContentByLine) => {
+ const validationErrors = [];
+ const dataResidencyMigration = modules[types_1.AllModuleTypes.DataResidencyMigration];
+ if (!dataResidencyMigration) {
+ return validationErrors;
+ }
+ if (dataResidencyMigration.length > 1) {
+ validationErrors.push(getValidationError(text_1.errors.modules['migration:dataResidency'].moreThanOneRemote(), 'migration:dataResidency', yamlContentByLine));
+ return validationErrors;
+ }
+ const dataResidencyMigrationRemote = dataResidencyMigration[0].remote;
+ const remotesKeyArray = remotes?.map((item) => item.key) ?? [];
+ if (!remotesKeyArray.includes(dataResidencyMigrationRemote)) {
+ validationErrors.push(getValidationError(text_1.errors.modules['migration:dataResidency'].remoteNotFound(dataResidencyMigrationRemote), dataResidencyMigrationRemote, yamlContentByLine));
+ return validationErrors;
+ }
+ return validationErrors;
+};
+exports.validateDataResidencyMigration = validateDataResidencyMigration;
+function getValidationError(message, position, yamlContentByLine) {
+ return {
+ message,
+ reference: text_1.References.Modules,
+ level: 'error',
+ ...(0, utils_1.findPosition)(position, yamlContentByLine)
+ };
+}