Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/auth version bump #137

Merged
merged 4 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugins/auth-basic/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/auth-basic/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@amplication/plugin-auth-basic",
"version": "1.4.0",
"version": "1.4.1",
"description": "set basic auth for Amplication build",
"main": "dist/index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions plugins/auth-basic/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ export const ExampleConst = "example";
export const staticsPath = join(__dirname, "static");
export const templatesPath = join(__dirname, "templates");
export const AUTH_ENTITY_ERROR = "Authentication entity does not exist";
export const AUTH_ENTITY_LOG_ERROR =
"Authentication entity does not exist. Have you configured the authentication entity in the Resource Settings?";
8 changes: 6 additions & 2 deletions plugins/auth-basic/src/core/create-auth-module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Module, DsgContext } from "@amplication/code-gen-types";
import { join } from "path";
import { AUTH_ENTITY_ERROR, templatesPath } from "../constants";
import {
AUTH_ENTITY_ERROR,
AUTH_ENTITY_LOG_ERROR,
templatesPath,
} from "../constants";
import { readFile } from "@amplication/code-gen-utils";
import {
addImports,
Expand Down Expand Up @@ -34,7 +38,7 @@ async function mapAuthModuleTemplate(
(x) => x.name === resourceInfo?.settings.authEntityName
);
if (!authEntity) {
context.logger.error(AUTH_ENTITY_ERROR);
context.logger.error(AUTH_ENTITY_LOG_ERROR);
throw new Error(AUTH_ENTITY_ERROR);
}

Expand Down
8 changes: 6 additions & 2 deletions plugins/auth-basic/src/core/create-basic-strategy-base.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Module, DsgContext } from "@amplication/code-gen-types";
import { join } from "path";
import { AUTH_ENTITY_ERROR, templatesPath } from "../constants";
import {
AUTH_ENTITY_ERROR,
AUTH_ENTITY_LOG_ERROR,
templatesPath,
} from "../constants";
import { readFile } from "@amplication/code-gen-utils";
import {
addImports,
Expand Down Expand Up @@ -37,7 +41,7 @@ async function mapBasicStrategyTemplate(
(x) => x.name === resourceInfo?.settings.authEntityName
);
if (!authEntity) {
context.logger.error(AUTH_ENTITY_ERROR);
context.logger.error(AUTH_ENTITY_LOG_ERROR);
throw new Error(AUTH_ENTITY_ERROR);
}
const entityInfoName = `${authEntity?.name}Info`;
Expand Down
4 changes: 2 additions & 2 deletions plugins/auth-core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/auth-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@amplication/plugin-auth-core",
"version": "1.1.2-beta.36",
"version": "1.1.2",
"description": "set auth for Amplication build",
"main": "dist/index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions plugins/auth-core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ export const envVariables: VariableDictionary = [

export const templatesPath = resolve(__dirname, "./templates");
export const AUTH_ENTITY_ERROR = "Authentication entity does not exist";
export const AUTH_ENTITY_LOG_ERROR =
"Authentication entity does not exist. Have you configured the authentication entity in the Resource Settings?";
8 changes: 6 additions & 2 deletions plugins/auth-core/src/core/create-auth-service-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Module, DsgContext } from "@amplication/code-gen-types";
import { join } from "path";
import { AUTH_ENTITY_ERROR, templatesPath } from "../constants";
import {
AUTH_ENTITY_ERROR,
AUTH_ENTITY_LOG_ERROR,
templatesPath,
} from "../constants";
import { readFile, print } from "@amplication/code-gen-utils";
import {
addImports,
Expand All @@ -23,7 +27,7 @@ export async function createAuthServiceSpec(
(x) => x.name === resourceInfo?.settings.authEntityName
);
if (!authEntity) {
dsgContext.logger.error(AUTH_ENTITY_ERROR);
dsgContext.logger.error(AUTH_ENTITY_LOG_ERROR);
throw new Error(AUTH_ENTITY_ERROR);
}

Expand Down
8 changes: 6 additions & 2 deletions plugins/auth-core/src/core/create-auth-service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Module, DsgContext } from "@amplication/code-gen-types";
import { join } from "path";
import { AUTH_ENTITY_ERROR, templatesPath } from "../constants";
import {
AUTH_ENTITY_ERROR,
AUTH_ENTITY_LOG_ERROR,
templatesPath,
} from "../constants";
import { readFile } from "@amplication/code-gen-utils";
import {
addImports,
Expand Down Expand Up @@ -35,7 +39,7 @@ async function mapAuthServiceTemplate(
(x) => x.name === resourceInfo?.settings.authEntityName
);
if (!authEntity) {
context.logger.error(AUTH_ENTITY_ERROR);
context.logger.error(AUTH_ENTITY_LOG_ERROR);
throw new Error(AUTH_ENTITY_ERROR);
}

Expand Down
8 changes: 6 additions & 2 deletions plugins/auth-core/src/core/create-user-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import { builders, namedTypes } from "ast-types";
import { print } from "@amplication/code-gen-utils";
import { getUserIdType } from "../util/get-user-id-type";
import { join } from "path";
import { AUTH_ENTITY_ERROR, templatesPath } from "../constants";
import {
AUTH_ENTITY_ERROR,
AUTH_ENTITY_LOG_ERROR,
templatesPath,
} from "../constants";

const userInfoPath = join(templatesPath, "user-info.template.ts");

Expand All @@ -21,7 +25,7 @@ export async function createUserInfo(dsgContext: DsgContext): Promise<Module> {
(x) => x.name === resourceInfo?.settings.authEntityName
);
if (!authEntity) {
dsgContext.logger.error(AUTH_ENTITY_ERROR);
dsgContext.logger.error(AUTH_ENTITY_LOG_ERROR);
throw new Error(AUTH_ENTITY_ERROR);
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/auth-core/src/util/createAuthTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "../util/ast";
import { builders, namedTypes } from "ast-types";
import { print } from "@amplication/code-gen-utils";
import { AUTH_ENTITY_ERROR } from "../constants";
import { AUTH_ENTITY_ERROR, AUTH_ENTITY_LOG_ERROR } from "../constants";

export async function mapAuthTemplate(
context: DsgContext,
Expand All @@ -21,7 +21,7 @@ export async function mapAuthTemplate(
(x) => x.name === resourceInfo?.settings.authEntityName
);
if (!authEntity) {
context.logger.error(AUTH_ENTITY_ERROR);
context.logger.error(AUTH_ENTITY_LOG_ERROR);
throw new Error(AUTH_ENTITY_ERROR);
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/auth-core/src/util/get-user-id-type.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DsgContext, EntityField, types } from "@amplication/code-gen-types";
import { AUTH_ENTITY_ERROR } from "../constants";
import { AUTH_ENTITY_ERROR, AUTH_ENTITY_LOG_ERROR } from "../constants";

export const getUserIdType = (dsgContext: DsgContext) => {
const { entities, resourceInfo } = dsgContext;
Expand All @@ -8,7 +8,7 @@ export const getUserIdType = (dsgContext: DsgContext) => {
);

if (!authEntity) {
dsgContext.logger.error(AUTH_ENTITY_ERROR);
dsgContext.logger.error(AUTH_ENTITY_LOG_ERROR);
throw new Error(AUTH_ENTITY_ERROR);
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/auth-jwt/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/auth-jwt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@amplication/plugin-auth-jwt",
"version": "1.4.1-beta.4",
"version": "1.4.1",
"description": "set jwt as provider for Amplication build",
"main": "dist/index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions plugins/auth-jwt/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export const staticsPath = join(__dirname, "static");
export const templatesPath = join(__dirname, "templates");

export const AUTH_ENTITY_ERROR = "Authentication entity does not exist";
export const AUTH_ENTITY_LOG_ERROR =
"Authentication entity does not exist. Have you configured the authentication entity in the Resource Settings?";
8 changes: 6 additions & 2 deletions plugins/auth-jwt/src/core/create-auth-module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Module, DsgContext } from "@amplication/code-gen-types";
import { join } from "path";
import { AUTH_ENTITY_ERROR, templatesPath } from "../constants";
import {
AUTH_ENTITY_ERROR,
AUTH_ENTITY_LOG_ERROR,
templatesPath,
} from "../constants";
import { readFile } from "@amplication/code-gen-utils";
import {
addImports,
Expand Down Expand Up @@ -33,7 +37,7 @@ async function mapAuthModuleTemplate(
(x) => x.name === resourceInfo?.settings.authEntityName
);
if (!authEntity) {
context.logger.error(AUTH_ENTITY_ERROR);
context.logger.error(AUTH_ENTITY_LOG_ERROR);
throw new Error(AUTH_ENTITY_ERROR);
}
try {
Expand Down
8 changes: 6 additions & 2 deletions plugins/auth-jwt/src/core/create-jwt-strategy-base.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Module, DsgContext } from "@amplication/code-gen-types";
import { join } from "path";
import { AUTH_ENTITY_ERROR, templatesPath } from "../constants";
import {
AUTH_ENTITY_ERROR,
AUTH_ENTITY_LOG_ERROR,
templatesPath,
} from "../constants";
import { readFile } from "@amplication/code-gen-utils";
import {
addImports,
Expand Down Expand Up @@ -38,7 +42,7 @@ async function mapJwtStrategyTemplate(
(x) => x.name === resourceInfo?.settings.authEntityName
);
if (!authEntity) {
context.logger.error(AUTH_ENTITY_ERROR);
context.logger.error(AUTH_ENTITY_LOG_ERROR);
throw new Error(AUTH_ENTITY_ERROR);
}

Expand Down
8 changes: 6 additions & 2 deletions plugins/auth-jwt/src/core/create-jwt-strategy-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Module, DsgContext } from "@amplication/code-gen-types";
import { join } from "path";
import { AUTH_ENTITY_ERROR, templatesPath } from "../constants";
import {
AUTH_ENTITY_ERROR,
AUTH_ENTITY_LOG_ERROR,
templatesPath,
} from "../constants";
import { readFile } from "@amplication/code-gen-utils";
import {
addImports,
Expand Down Expand Up @@ -36,7 +40,7 @@ async function mapJwtStrategySpecTemplate(
(x) => x.name === resourceInfo?.settings.authEntityName
);
if (!authEntity) {
context.logger.error(AUTH_ENTITY_ERROR);
context.logger.error(AUTH_ENTITY_LOG_ERROR);
throw new Error(AUTH_ENTITY_ERROR);
}

Expand Down
8 changes: 6 additions & 2 deletions plugins/auth-jwt/src/core/create-jwt-strategy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Module, DsgContext } from "@amplication/code-gen-types";
import { join } from "path";
import { AUTH_ENTITY_ERROR, templatesPath } from "../constants";
import {
AUTH_ENTITY_ERROR,
AUTH_ENTITY_LOG_ERROR,
templatesPath,
} from "../constants";
import { readFile } from "@amplication/code-gen-utils";
import {
addImports,
Expand Down Expand Up @@ -35,7 +39,7 @@ async function mapJwtStrategyTemplate(
(x) => x.name === resourceInfo?.settings.authEntityName
);
if (!authEntity) {
context.logger.error(AUTH_ENTITY_ERROR);
context.logger.error(AUTH_ENTITY_LOG_ERROR);
throw new Error(AUTH_ENTITY_ERROR);
}

Expand Down
Loading