UNPKG

@aws-amplify/amplify-category-auth

Version:

amplify-cli authentication plugin

31 lines 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.prePushHandler = void 0; const amplify_cli_core_1 = require("@aws-amplify/amplify-cli-core"); const auth_input_state_1 = require("../provider-utils/awscloudformation/auth-inputs-manager/auth-input-state"); const getAuthResourceName_1 = require("../utils/getAuthResourceName"); const project_has_auth_1 = require("../provider-utils/awscloudformation/utils/project-has-auth"); const legacyAuthConfigHasTriggers_1 = require("../utils/legacyAuthConfigHasTriggers"); const prePushHandler = async (context) => { if (!(0, project_has_auth_1.projectHasAuth)()) { return; } const { imported } = context.amplify.getImportedAuthProperties(context); if (imported) { return; } const authResourceName = await (0, getAuthResourceName_1.getAuthResourceName)(context); const inputState = new auth_input_state_1.AuthInputState(context, authResourceName); if (inputState.cliInputFileExists()) { return; } if (!(0, legacyAuthConfigHasTriggers_1.legacyAuthConfigHasTriggers)(authResourceName)) { return; } throw new amplify_cli_core_1.AmplifyError('InvalidMigrationError', { message: 'Auth triggers have been configured using an older version of the CLI and must be migrated before they can be deployed.', resolution: 'Run "amplify update auth" and select "yes" to the migration prompt. Then retry the deployment using "amplify push".', }); }; exports.prePushHandler = prePushHandler; //# sourceMappingURL=prePushHandler.js.map