From 7d5184048ca2892aeaed564ab4163c5776c9c050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Belli?= Date: Wed, 22 Nov 2023 13:05:20 +0100 Subject: [PATCH] feat: use type imports so we will be able to drop unnecessary runtime deps --- .eslintrc.js | 8 +++++ .../accounts-microservice/src/app-server.ts | 2 +- .../src/entities/email.ts | 6 ++-- .../src/entities/user.ts | 10 +++--- .../src/connect.ts | 3 +- .../src/index.ts | 2 +- modules/module-core/src/index.ts | 6 ++-- modules/module-core/src/resolvers/mutation.ts | 2 +- modules/module-core/src/resolvers/query.ts | 2 +- .../src/utils/authenticated-directive.ts | 2 +- .../module-core/src/utils/context-builder.ts | 12 +++---- .../module-core/src/utils/schema-builder.ts | 6 ++-- modules/module-magic-link/src/index.ts | 2 +- .../src/resolvers/mutation.ts | 2 +- modules/module-mikro-orm/src/index.ts | 19 +++++++---- .../module-mikro-orm/src/types/IContext.ts | 6 ++-- .../src/utils/context-builder.ts | 6 ++-- modules/module-mongo/src/index.ts | 4 +-- .../__tests__/resolvers/mutation.ts | 4 +-- modules/module-password/src/index.ts | 2 +- .../module-password/src/resolvers/mutation.ts | 4 +-- .../module-password/src/resolvers/query.ts | 2 +- modules/module-typeorm/src/index.ts | 6 ++-- package.json | 1 + packages/apollo-link-accounts/src/index.ts | 4 +-- .../src/client-magic-link.ts | 4 +-- .../__tests__/client-password.ts | 2 +- .../client-password/src/client-password.ts | 12 +++---- packages/client/src/accounts-client.ts | 11 ++++-- packages/client/src/token-storage-local.ts | 2 +- packages/client/src/transport-interface.ts | 14 ++++---- packages/client/src/types/options.ts | 2 +- .../database-mikro-orm/src/entity/Email.ts | 4 +-- .../database-mikro-orm/src/entity/Service.ts | 4 +-- .../database-mikro-orm/src/entity/Session.ts | 4 +-- .../database-mikro-orm/src/entity/User.ts | 6 ++-- packages/database-mikro-orm/src/mikro-orm.ts | 18 ++++++---- .../src/types/Email.symbol.ts | 2 +- .../src/types/Service.symbol.ts | 2 +- .../src/types/Session.symbol.ts | 2 +- .../src/types/User.symbol.ts | 2 +- .../__tests__/mongo-magic-link.ts | 2 +- .../src/mongo-magic-link.ts | 4 +-- .../__tests__/mongo-password.ts | 2 +- .../src/mongo-password.ts | 8 +++-- .../__tests__/mongo-sessions.ts | 2 +- .../src/mongo-sessions.ts | 8 +++-- packages/database-mongo/src/mongo.ts | 14 ++++---- .../src/types/AccountsMongoConfig.symbol.ts | 2 +- .../src/types/MongoConnection.symbol.ts | 2 +- packages/database-redis/src/redis.ts | 8 +++-- .../__tests__/typeorm-magic-link.ts | 2 +- .../__tests__/typeorm-password.ts | 2 +- .../__tests__/typeorm-sessions.ts | 2 +- packages/database-typeorm/src/typeorm.ts | 12 ++++--- .../src/types/AccountsTypeORMConfig.symbol.ts | 2 +- .../database-typeorm/src/types/User.symbol.ts | 2 +- .../src/types/UserEmail.symbol.ts | 2 +- .../src/types/UserService.symbol.ts | 2 +- .../src/types/UserSession.symbol.ts | 2 +- packages/e2e/__tests__/databases/index.ts | 4 +-- packages/e2e/__tests__/databases/mongo.ts | 4 +-- packages/e2e/__tests__/databases/typeorm.ts | 8 ++--- packages/e2e/__tests__/servers/index.ts | 6 ++-- .../e2e/__tests__/servers/server-graphql.ts | 8 ++--- packages/e2e/__tests__/servers/server-rest.ts | 8 ++--- packages/express-session/src/index.ts | 6 ++-- .../src/utils/get-user-agent.ts | 2 +- .../graphql-client/src/GraphQLErrorList.ts | 2 +- packages/graphql-client/src/graphql-client.ts | 16 ++++----- .../src/utils/replace-user-fragment.ts | 2 +- .../magic-link/src/accounts-magic-link.ts | 16 ++++----- packages/magic-link/src/errors.ts | 2 +- .../types/AccountsMagicLinkConfig.symbol.ts | 2 +- packages/magic-link/src/utils/user.ts | 2 +- .../src/accounts-oauth-instagram.ts | 4 +-- .../src/types/configuration.ts | 2 +- .../src/accounts-oauth-twitter.ts | 4 +-- .../oauth-twitter/src/types/configuration.ts | 2 +- packages/oauth/src/accounts-oauth.ts | 14 ++++---- .../oauth/src/types/OAuthProviders.symbol.ts | 2 +- packages/oauth/src/types/oauth-provider.ts | 2 +- packages/oauth/src/types/oauth-providers.ts | 2 +- packages/password/src/accounts-password.ts | 34 +++++++++++-------- packages/password/src/errors.ts | 2 +- .../types/AccountsPasswordConfig.symbol.ts | 2 +- packages/password/src/utils/user.ts | 2 +- packages/rest-client/src/auth-fetch.ts | 2 +- packages/rest-client/src/rest-client.ts | 14 ++++---- .../__tests__/endpoints/password/register.ts | 2 +- .../rest-express/src/endpoints/get-user.ts | 2 +- .../rest-express/src/endpoints/impersonate.ts | 4 +-- packages/rest-express/src/endpoints/logout.ts | 2 +- .../magic-link/request-magic-link-email.ts | 2 +- .../src/endpoints/oauth/provider-callback.ts | 4 +-- .../src/endpoints/password/add-email.ts | 2 +- .../src/endpoints/password/change-password.ts | 2 +- .../src/endpoints/password/register.ts | 4 +-- .../src/endpoints/password/reset.ts | 2 +- .../src/endpoints/password/two-factor.ts | 2 +- .../src/endpoints/password/verify-email.ts | 2 +- .../src/endpoints/refresh-access-token.ts | 2 +- .../src/endpoints/service-authenticate.ts | 2 +- .../src/endpoints/verify-authentication.ts | 2 +- .../rest-express/src/express-middleware.ts | 2 +- packages/rest-express/src/types.ts | 4 +-- packages/rest-express/src/user-loader.ts | 2 +- .../rest-express/src/utils/get-user-agent.ts | 2 +- packages/server/__tests__/account-server.ts | 2 +- packages/server/src/accounts-server.ts | 34 +++++++++---------- .../src/types/AccountsCoreConfig.symbol.ts | 2 +- .../types/AuthenticationServices.symbol.ts | 2 +- .../types/DatabaseInterfaceSessions.symbol.ts | 2 +- .../src/types/DatabaseInterfaceUser.symbol.ts | 2 +- .../src/types/accounts-server-options.ts | 14 ++++---- .../src/types/authentication-services.ts | 2 +- .../server/src/types/email-template-type.ts | 2 +- .../server/src/types/email-templates-type.ts | 2 +- packages/server/src/types/email-type.ts | 2 +- packages/server/src/types/jwt-payload.ts | 2 +- .../server/src/types/prepare-mail-function.ts | 4 +-- packages/server/src/types/token-creator.ts | 2 +- packages/server/src/utils/email.ts | 4 +-- .../server/src/utils/get-first-user-email.ts | 2 +- packages/two-factor/src/errors.ts | 2 +- packages/two-factor/src/two-factor.ts | 6 ++-- packages/two-factor/src/types/options.ts | 2 +- .../src/types/two-factor-service.ts | 2 +- packages/two-factor/src/utils/user.ts | 4 +-- .../types/src/types/authentication-service.ts | 6 ++-- packages/types/src/types/context.ts | 4 +-- .../types/src/types/create-user-result.ts | 2 +- .../types/src/types/database-interface.ts | 6 ++-- .../types/src/types/impersonation-result.ts | 4 +-- packages/types/src/types/login-result.ts | 4 +-- .../services/magic-link/database-interface.ts | 2 +- .../types/services/password/create-user.ts | 2 +- .../services/password/database-interface.ts | 4 +-- .../src/types/services/password/login-user.ts | 2 +- .../src/types/session/database-interface.ts | 4 +-- packages/types/src/types/user.ts | 2 +- .../src/types/user/database-interface.ts | 6 ++-- 142 files changed, 352 insertions(+), 308 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9d62bcd22..f566f63e6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,5 +18,13 @@ module.exports = { '@typescript-eslint/no-explicit-any': 0, '@typescript-eslint/no-non-null-assertion': 0, '@typescript-eslint/no-unused-vars': 'error', + '@typescript-eslint/consistent-type-imports': [ + 'error', + { + prefer: 'type-imports', + disallowTypeAnnotations: true, + fixStyle: 'inline-type-imports', + }, + ], }, }; diff --git a/examples/accounts-microservice/src/app-server.ts b/examples/accounts-microservice/src/app-server.ts index 8ecb72ed4..a6e180f33 100644 --- a/examples/accounts-microservice/src/app-server.ts +++ b/examples/accounts-microservice/src/app-server.ts @@ -3,7 +3,7 @@ import fetch from 'node-fetch'; import { mergeTypeDefs } from '@graphql-tools/merge'; import { schemaFromExecutor } from '@graphql-tools/wrap'; import { stitchSchemas } from '@graphql-tools/stitch'; -import { AsyncExecutor } from '@graphql-tools/utils'; +import { type AsyncExecutor } from '@graphql-tools/utils'; import { OperationTypeNode, print } from 'graphql'; import { authDirective, diff --git a/examples/graphql-server-mikro-orm-postgres/src/entities/email.ts b/examples/graphql-server-mikro-orm-postgres/src/entities/email.ts index bd4ec5959..571ed2ed6 100644 --- a/examples/graphql-server-mikro-orm-postgres/src/entities/email.ts +++ b/examples/graphql-server-mikro-orm-postgres/src/entities/email.ts @@ -1,11 +1,11 @@ import 'reflect-metadata'; import { - EmailCtor, - EmailCtorArgs as AccountsEmailCtorArgs, + type EmailCtor, + type EmailCtorArgs as AccountsEmailCtorArgs, getEmailCtor, } from '@accounts/mikro-orm'; import { Entity, Property } from '@mikro-orm/core'; -import { User } from './user'; +import { type User } from './user'; export type EmailCtorArgs = AccountsEmailCtorArgs & { fullName: string; diff --git a/examples/graphql-server-mikro-orm-postgres/src/entities/user.ts b/examples/graphql-server-mikro-orm-postgres/src/entities/user.ts index 9e6ab2e38..92d450cec 100644 --- a/examples/graphql-server-mikro-orm-postgres/src/entities/user.ts +++ b/examples/graphql-server-mikro-orm-postgres/src/entities/user.ts @@ -1,13 +1,13 @@ import 'reflect-metadata'; import { - UserCtorArgs as AccountsUserCtorArgs, - Session, - Service, - UserCtor, + type UserCtorArgs as AccountsUserCtorArgs, + type Session, + type Service, + type UserCtor, getUserCtor, } from '@accounts/mikro-orm'; import { Entity, Property } from '@mikro-orm/core'; -import { Email, EmailCtorArgs } from './email'; +import { Email, type EmailCtorArgs } from './email'; type UserCtorArgs = AccountsUserCtorArgs & { firstName: string; diff --git a/examples/graphql-server-typeorm-postgres/src/connect.ts b/examples/graphql-server-typeorm-postgres/src/connect.ts index 2e2f6d5f2..f32ca525b 100755 --- a/examples/graphql-server-typeorm-postgres/src/connect.ts +++ b/examples/graphql-server-typeorm-postgres/src/connect.ts @@ -1,10 +1,11 @@ import { createConnection } from 'typeorm'; +import { entities } from '@accounts/typeorm'; export const connect = (url = process.env.DATABASE_URL) => { return createConnection({ type: 'postgres', url, - entities: [...require('@accounts/typeorm').entities], + entities, synchronize: true, }).then((connection) => { return connection; diff --git a/examples/graphql-server-typescript-basic/src/index.ts b/examples/graphql-server-typescript-basic/src/index.ts index 072bbef41..82a9253d4 100644 --- a/examples/graphql-server-typescript-basic/src/index.ts +++ b/examples/graphql-server-typescript-basic/src/index.ts @@ -14,7 +14,7 @@ import { createApplication } from 'graphql-modules'; import { createAccountsMongoModule } from '@accounts/module-mongo'; import { createHandler } from 'graphql-http/lib/use/http'; import http from 'http'; -import { IContext } from '@accounts/types'; +import { type IContext } from '@accounts/types'; void (async () => { // Create database connection diff --git a/modules/module-core/src/index.ts b/modules/module-core/src/index.ts index ead9babef..877d60298 100644 --- a/modules/module-core/src/index.ts +++ b/modules/module-core/src/index.ts @@ -1,9 +1,9 @@ -import { createModule, gql, Provider } from 'graphql-modules'; +import { createModule, gql, type Provider } from 'graphql-modules'; import { mergeTypeDefs } from '@graphql-tools/merge'; -import { User, IContext } from '@accounts/types'; +import { type User, type IContext } from '@accounts/types'; import { AccountsServer, - AccountsServerOptions, + type AccountsServerOptions, AccountsCoreConfigToken, DatabaseInterfaceUserToken, DatabaseInterfaceSessionsToken, diff --git a/modules/module-core/src/resolvers/mutation.ts b/modules/module-core/src/resolvers/mutation.ts index 5565c2ca4..89a38ffe9 100644 --- a/modules/module-core/src/resolvers/mutation.ts +++ b/modules/module-core/src/resolvers/mutation.ts @@ -1,5 +1,5 @@ import { AccountsServer } from '@accounts/server'; -import { MutationResolvers } from '../models'; +import { type MutationResolvers } from '../models'; export const Mutation: MutationResolvers = { authenticate: async (_, args, ctx) => { diff --git a/modules/module-core/src/resolvers/query.ts b/modules/module-core/src/resolvers/query.ts index 8b6c35bc3..bc805e978 100644 --- a/modules/module-core/src/resolvers/query.ts +++ b/modules/module-core/src/resolvers/query.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from '../models'; +import { type QueryResolvers } from '../models'; export const Query: QueryResolvers = { getUser: (_, __, context) => context.user || null, diff --git a/modules/module-core/src/utils/authenticated-directive.ts b/modules/module-core/src/utils/authenticated-directive.ts index 4c90f403e..48257e975 100644 --- a/modules/module-core/src/utils/authenticated-directive.ts +++ b/modules/module-core/src/utils/authenticated-directive.ts @@ -1,6 +1,6 @@ import { authenticated } from './authenticated-resolver'; import { getDirective, MapperKind, mapSchema } from '@graphql-tools/utils'; -import { defaultFieldResolver, GraphQLSchema } from 'graphql'; +import { defaultFieldResolver, type GraphQLSchema } from 'graphql'; export function authDirective(directiveName = 'auth') { const typeDirectiveArgumentMaps: Record = {}; diff --git a/modules/module-core/src/utils/context-builder.ts b/modules/module-core/src/utils/context-builder.ts index 50f20448c..d116719d0 100644 --- a/modules/module-core/src/utils/context-builder.ts +++ b/modules/module-core/src/utils/context-builder.ts @@ -1,11 +1,11 @@ import AccountsServer from '@accounts/server'; -import { IncomingHttpHeaders, IncomingMessage } from 'http'; +import { type IncomingHttpHeaders, type IncomingMessage } from 'http'; import { getClientIp } from 'request-ip'; -import { IContext, User } from '@accounts/types'; -import { Application } from 'graphql-modules'; -import { Request as RequestGraphqlHttp, RequestHeaders } from 'graphql-http'; -import { RequestContext } from 'graphql-http/lib/use/http'; -import http from 'http'; +import { type IContext, type User } from '@accounts/types'; +import { type Application } from 'graphql-modules'; +import { type Request as RequestGraphqlHttp, type RequestHeaders } from 'graphql-http'; +import { type RequestContext } from 'graphql-http/lib/use/http'; +import type http from 'http'; export type AccountsContextOptions = { createOperationController: Application['createOperationController']; diff --git a/modules/module-core/src/utils/schema-builder.ts b/modules/module-core/src/utils/schema-builder.ts index 9343bad96..98ad07357 100644 --- a/modules/module-core/src/utils/schema-builder.ts +++ b/modules/module-core/src/utils/schema-builder.ts @@ -1,9 +1,9 @@ -import { GraphQLSchema } from 'graphql'; -import { ApplicationConfig } from 'graphql-modules'; +import { type GraphQLSchema } from 'graphql'; +import { type ApplicationConfig } from 'graphql-modules'; import { authDirective } from './authenticated-directive'; import { makeExecutableSchema } from '@graphql-tools/schema'; import { mergeResolvers, mergeTypeDefs } from '@graphql-tools/merge'; -import { IResolvers, Maybe, TypeSource } from '@graphql-tools/utils'; +import { type IResolvers, type Maybe, type TypeSource } from '@graphql-tools/utils'; export const buildSchema = ({ diff --git a/modules/module-magic-link/src/index.ts b/modules/module-magic-link/src/index.ts index fd0682555..a7a6f130d 100644 --- a/modules/module-magic-link/src/index.ts +++ b/modules/module-magic-link/src/index.ts @@ -1,6 +1,6 @@ import { AccountsMagicLink, - AccountsMagicLinkOptions, + type AccountsMagicLinkOptions, AccountsMagicLinkConfigToken, } from '@accounts/magic-link'; import { createModule } from 'graphql-modules'; diff --git a/modules/module-magic-link/src/resolvers/mutation.ts b/modules/module-magic-link/src/resolvers/mutation.ts index 61f9da0b1..e4865362a 100644 --- a/modules/module-magic-link/src/resolvers/mutation.ts +++ b/modules/module-magic-link/src/resolvers/mutation.ts @@ -1,6 +1,6 @@ import { AccountsMagicLink, RequestMagicLinkEmailErrors } from '@accounts/magic-link'; import { AccountsServer, AccountsJsError } from '@accounts/server'; -import { MutationResolvers } from '../models'; +import { type MutationResolvers } from '../models'; export const Mutation: MutationResolvers = { requestMagicLinkEmail: async (_, { email }, ctx) => { diff --git a/modules/module-mikro-orm/src/index.ts b/modules/module-mikro-orm/src/index.ts index a92987ceb..60dac3d89 100644 --- a/modules/module-mikro-orm/src/index.ts +++ b/modules/module-mikro-orm/src/index.ts @@ -1,18 +1,23 @@ -import { createModule, gql, Provider, Scope } from 'graphql-modules'; +import { createModule, gql, type Provider, Scope } from 'graphql-modules'; import { DatabaseInterfaceSessionsToken, DatabaseInterfaceUserToken } from '@accounts/server'; import { AccountsMikroOrm, - Email, - Session, - Service, + type Email, + type Session, + type Service, EmailToken, - IUser, + type IUser, SessionToken, ServiceToken, UserToken, } from '@accounts/mikro-orm'; -import { Connection, Constructor, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; -import { DatabaseType } from '@accounts/types'; +import { + type Connection, + type Constructor, + EntityManager, + type IDatabaseDriver, +} from '@mikro-orm/core'; +import { type DatabaseType } from '@accounts/types'; export * from './types'; export * from './utils'; diff --git a/modules/module-mikro-orm/src/types/IContext.ts b/modules/module-mikro-orm/src/types/IContext.ts index 11e266ebb..48d92f11c 100644 --- a/modules/module-mikro-orm/src/types/IContext.ts +++ b/modules/module-mikro-orm/src/types/IContext.ts @@ -1,6 +1,6 @@ -import { IContext as AccountsContext } from '@accounts/types'; -import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; -import { IUser } from '@accounts/mikro-orm'; +import { type IContext as AccountsContext } from '@accounts/types'; +import { type Connection, type EntityManager, type IDatabaseDriver } from '@mikro-orm/core'; +import { type IUser } from '@accounts/mikro-orm'; export interface IContext = IUser> extends Omit { diff --git a/modules/module-mikro-orm/src/utils/context-builder.ts b/modules/module-mikro-orm/src/utils/context-builder.ts index 6f3501964..a7908aae0 100644 --- a/modules/module-mikro-orm/src/utils/context-builder.ts +++ b/modules/module-mikro-orm/src/utils/context-builder.ts @@ -1,7 +1,7 @@ -import { IUser } from '@accounts/mikro-orm'; +import { type IUser } from '@accounts/mikro-orm'; import { context as contextBase } from '@accounts/module-core'; -import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; -import { IContext } from '../types'; +import { type Connection, type EntityManager, type IDatabaseDriver } from '@mikro-orm/core'; +import { type IContext } from '../types'; export const context = async < User extends IUser = IUser, diff --git a/modules/module-mongo/src/index.ts b/modules/module-mongo/src/index.ts index 4a1ca984e..8bed94f06 100644 --- a/modules/module-mongo/src/index.ts +++ b/modules/module-mongo/src/index.ts @@ -1,9 +1,9 @@ -import { createModule, gql, Module, Provider } from 'graphql-modules'; +import { createModule, gql, type Module, type Provider } from 'graphql-modules'; import { DatabaseInterfaceSessionsToken, DatabaseInterfaceUserToken } from '@accounts/server'; import { DatabaseType } from '@accounts/types'; import { AccountsMongoConfigToken, - AccountsMongoOptions, + type AccountsMongoOptions, Mongo, MongoConnectionToken, } from '@accounts/mongo'; diff --git a/modules/module-password/__tests__/resolvers/mutation.ts b/modules/module-password/__tests__/resolvers/mutation.ts index 5c25f0db4..c2f74d3e5 100644 --- a/modules/module-password/__tests__/resolvers/mutation.ts +++ b/modules/module-password/__tests__/resolvers/mutation.ts @@ -5,9 +5,9 @@ import { SendResetPasswordEmailErrors, SendVerificationEmailErrors, } from '@accounts/password'; -import { LoginResult } from '@accounts/types'; +import { type LoginResult } from '@accounts/types'; import { Mutation } from '../../src/resolvers/mutation'; -import { CreateUserInput } from '../../src'; +import { type CreateUserInput } from '../../src'; describe('accounts-password resolvers mutation', () => { const accountsServerMock = { diff --git a/modules/module-password/src/index.ts b/modules/module-password/src/index.ts index 91226998d..1d079231c 100644 --- a/modules/module-password/src/index.ts +++ b/modules/module-password/src/index.ts @@ -6,7 +6,7 @@ import { Query } from './resolvers/query'; import { Mutation } from './resolvers/mutation'; import AccountsPassword, { AccountsPasswordConfigToken, - AccountsPasswordOptions, + type AccountsPasswordOptions, } from '@accounts/password'; export * from './models'; diff --git a/modules/module-password/src/resolvers/mutation.ts b/modules/module-password/src/resolvers/mutation.ts index 51a81d920..a87f22e1e 100644 --- a/modules/module-password/src/resolvers/mutation.ts +++ b/modules/module-password/src/resolvers/mutation.ts @@ -1,4 +1,4 @@ -import { CreateUserServicePassword } from '@accounts/types'; +import { type CreateUserServicePassword } from '@accounts/types'; import { AccountsPassword, CreateUserErrors, @@ -6,7 +6,7 @@ import { SendVerificationEmailErrors, } from '@accounts/password'; import { AccountsServer, AccountsJsError } from '@accounts/server'; -import { MutationResolvers } from '../models'; +import { type MutationResolvers } from '../models'; import { GraphQLError } from 'graphql'; export const Mutation: MutationResolvers = { diff --git a/modules/module-password/src/resolvers/query.ts b/modules/module-password/src/resolvers/query.ts index 07b0298c2..620ed2c48 100644 --- a/modules/module-password/src/resolvers/query.ts +++ b/modules/module-password/src/resolvers/query.ts @@ -1,5 +1,5 @@ import { GraphQLError } from 'graphql'; -import { QueryResolvers } from '../models'; +import { type QueryResolvers } from '../models'; import { AccountsPassword } from '@accounts/password'; export const Query: QueryResolvers = { diff --git a/modules/module-typeorm/src/index.ts b/modules/module-typeorm/src/index.ts index e59650eff..5fd59ea6a 100644 --- a/modules/module-typeorm/src/index.ts +++ b/modules/module-typeorm/src/index.ts @@ -1,4 +1,4 @@ -import { createModule, gql, Provider } from 'graphql-modules'; +import { createModule, gql, type Provider } from 'graphql-modules'; import { DatabaseInterfaceSessionsToken, DatabaseInterfaceUserToken } from '@accounts/server'; import { AccountsTypeorm, @@ -10,10 +10,10 @@ import { UserEmail, UserSession, UserService, - AccountsTypeormOptions, + type AccountsTypeormOptions, AccountsTypeORMConfigToken, } from '@accounts/typeorm'; -import { DatabaseType } from '@accounts/types'; +import { type DatabaseType } from '@accounts/types'; import { Connection } from 'typeorm'; export interface AccountsTypeORMModuleConfig extends AccountsTypeormOptions { diff --git a/package.json b/package.json index 3ea795d35..edfb037c5 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "publish:canary": "yarn run publish -- --canary", "test": "yarn run test:lint && yarn run compile && yarn run coverage", "testonly": "lerna run testonly", + "fix": "eslint --fix '{packages,modules,examples}/*/{src,__tests__}/**/*.ts'", "prettier": "prettier --write '**/*.{json,md,js,ts,jsx,tsx,yml}'", "test:lint": "eslint 'packages/*/{src,__tests__}/**/*.ts'", "test:examples": "lerna run test --scope=\"@examples/*\"", diff --git a/packages/apollo-link-accounts/src/index.ts b/packages/apollo-link-accounts/src/index.ts index 0ddbaecca..244253e15 100644 --- a/packages/apollo-link-accounts/src/index.ts +++ b/packages/apollo-link-accounts/src/index.ts @@ -1,6 +1,6 @@ -import { ApolloLink } from '@apollo/client/core'; +import { type ApolloLink } from '@apollo/client/core'; import { setContext } from '@apollo/client/link/context'; -import { AccountsClient } from '@accounts/client'; +import { type AccountsClient } from '@accounts/client'; type AccountsClientFactory = () => AccountsClient | Promise; diff --git a/packages/client-magic-link/src/client-magic-link.ts b/packages/client-magic-link/src/client-magic-link.ts index 0ed35901a..0bdc375f2 100644 --- a/packages/client-magic-link/src/client-magic-link.ts +++ b/packages/client-magic-link/src/client-magic-link.ts @@ -1,5 +1,5 @@ -import { AccountsClient } from '@accounts/client'; -import { LoginResult, LoginUserMagicLinkService } from '@accounts/types'; +import { type AccountsClient } from '@accounts/client'; +import { type LoginResult, type LoginUserMagicLinkService } from '@accounts/types'; export class AccountsClientMagicLink { private client: AccountsClient; diff --git a/packages/client-password/__tests__/client-password.ts b/packages/client-password/__tests__/client-password.ts index dfac93c09..d961c1860 100644 --- a/packages/client-password/__tests__/client-password.ts +++ b/packages/client-password/__tests__/client-password.ts @@ -1,5 +1,5 @@ import { AccountsClientPassword } from '../src/client-password'; -import { LoginResult, CreateUserResult } from '@accounts/types'; +import { type LoginResult, type CreateUserResult } from '@accounts/types'; const mockCreateUserResult: CreateUserResult = { userId: '123', diff --git a/packages/client-password/src/client-password.ts b/packages/client-password/src/client-password.ts index 65a5d1232..0fb3bf202 100644 --- a/packages/client-password/src/client-password.ts +++ b/packages/client-password/src/client-password.ts @@ -1,11 +1,11 @@ -import { AccountsClient } from '@accounts/client'; +import { type AccountsClient } from '@accounts/client'; import { - LoginResult, - CreateUserServicePassword, - CreateUserResult, - LoginUserPasswordService, + type LoginResult, + type CreateUserServicePassword, + type CreateUserResult, + type LoginUserPasswordService, } from '@accounts/types'; -import { AccountsClientPasswordOptions } from './types'; +import { type AccountsClientPasswordOptions } from './types'; export class AccountsClientPassword { private client: AccountsClient; diff --git a/packages/client/src/accounts-client.ts b/packages/client/src/accounts-client.ts index ab45de0ea..1e9c3f4a1 100644 --- a/packages/client/src/accounts-client.ts +++ b/packages/client/src/accounts-client.ts @@ -1,6 +1,11 @@ -import { LoginResult, Tokens, ImpersonationResult, User } from '@accounts/types'; -import { TransportInterface } from './transport-interface'; -import { TokenStorage, AccountsClientOptions } from './types'; +import { + type LoginResult, + type Tokens, + type ImpersonationResult, + type User, +} from '@accounts/types'; +import { type TransportInterface } from './transport-interface'; +import { type TokenStorage, type AccountsClientOptions } from './types'; import { tokenStorageLocal } from './token-storage-local'; import { isTokenExpired } from './utils'; diff --git a/packages/client/src/token-storage-local.ts b/packages/client/src/token-storage-local.ts index 7fd25dafe..ef7b68357 100644 --- a/packages/client/src/token-storage-local.ts +++ b/packages/client/src/token-storage-local.ts @@ -1,4 +1,4 @@ -import { TokenStorage } from './types'; +import { type TokenStorage } from './types'; export const tokenStorageLocal: TokenStorage = { setItem(key: string, value: string): void { diff --git a/packages/client/src/transport-interface.ts b/packages/client/src/transport-interface.ts index 99fcfe90d..eea8a12f3 100644 --- a/packages/client/src/transport-interface.ts +++ b/packages/client/src/transport-interface.ts @@ -1,12 +1,12 @@ import { - LoginResult, - ImpersonationUserIdentity, - ImpersonationResult, - CreateUser, - User, - CreateUserResult, + type LoginResult, + type ImpersonationUserIdentity, + type ImpersonationResult, + type CreateUser, + type User, + type CreateUserResult, } from '@accounts/types'; -import { AccountsClient } from './accounts-client'; +import { type AccountsClient } from './accounts-client'; export interface TransportInterface { client: AccountsClient; diff --git a/packages/client/src/types/options.ts b/packages/client/src/types/options.ts index ea9a2a6b4..77c63fa28 100644 --- a/packages/client/src/types/options.ts +++ b/packages/client/src/types/options.ts @@ -1,4 +1,4 @@ -import { TokenStorage } from '.'; +import { type TokenStorage } from '.'; export interface AccountsClientOptions { /** diff --git a/packages/database-mikro-orm/src/entity/Email.ts b/packages/database-mikro-orm/src/entity/Email.ts index 6dafa421f..41dd0c09a 100644 --- a/packages/database-mikro-orm/src/entity/Email.ts +++ b/packages/database-mikro-orm/src/entity/Email.ts @@ -1,5 +1,5 @@ -import { Reference, EntitySchema, ref } from '@mikro-orm/core'; -import { IUser, UserCtor } from './User'; +import { type Reference, EntitySchema, ref } from '@mikro-orm/core'; +import { type IUser, type UserCtor } from './User'; export class Email> { id!: number; diff --git a/packages/database-mikro-orm/src/entity/Service.ts b/packages/database-mikro-orm/src/entity/Service.ts index f1712d9dc..f61ecf1b1 100644 --- a/packages/database-mikro-orm/src/entity/Service.ts +++ b/packages/database-mikro-orm/src/entity/Service.ts @@ -1,5 +1,5 @@ -import { Reference, EntitySchema, ref } from '@mikro-orm/core'; -import { IUser, UserCtor } from './User'; +import { type Reference, EntitySchema, ref } from '@mikro-orm/core'; +import { type IUser, type UserCtor } from './User'; export class Service> { id!: number; diff --git a/packages/database-mikro-orm/src/entity/Session.ts b/packages/database-mikro-orm/src/entity/Session.ts index 74a1b2a62..7eca21d7b 100644 --- a/packages/database-mikro-orm/src/entity/Session.ts +++ b/packages/database-mikro-orm/src/entity/Session.ts @@ -1,5 +1,5 @@ -import { Reference, EntitySchema, ref } from '@mikro-orm/core'; -import { IUser, UserCtor } from './User'; +import { type Reference, EntitySchema, ref } from '@mikro-orm/core'; +import { type IUser, type UserCtor } from './User'; export class Session> { id!: number; diff --git a/packages/database-mikro-orm/src/entity/User.ts b/packages/database-mikro-orm/src/entity/User.ts index 398d8ac81..a37f6b560 100644 --- a/packages/database-mikro-orm/src/entity/User.ts +++ b/packages/database-mikro-orm/src/entity/User.ts @@ -1,7 +1,7 @@ import { Collection, EntitySchema } from '@mikro-orm/core'; -import { Service, ServiceCtor, ServiceCtorArgs } from './Service'; -import { Email, EmailCtor, EmailCtorArgs } from './Email'; -import { Session, SessionCtor } from './Session'; +import { Service, type ServiceCtor, type ServiceCtorArgs } from './Service'; +import { Email, type EmailCtor, type EmailCtorArgs } from './Email'; +import { Session, type SessionCtor } from './Session'; export interface IUser< CustomEmail extends Email, diff --git a/packages/database-mikro-orm/src/mikro-orm.ts b/packages/database-mikro-orm/src/mikro-orm.ts index 78b537b58..03e3ea53a 100644 --- a/packages/database-mikro-orm/src/mikro-orm.ts +++ b/packages/database-mikro-orm/src/mikro-orm.ts @@ -1,18 +1,22 @@ -import { ConnectionInformations, CreateUser, DatabaseInterface } from '@accounts/types'; -import { IUser, getUserCtor } from './entity/User'; +import { + type ConnectionInformations, + type CreateUser, + type DatabaseInterface, +} from '@accounts/types'; +import { type IUser, getUserCtor } from './entity/User'; import { Email } from './entity/Email'; import { Service } from './entity/Service'; import { Session } from './entity/Session'; import { EmailToken, ServiceToken, SessionToken, UserToken } from './types'; import { - Connection, - Constructor, + type Connection, + type Constructor, EntityManager, - IDatabaseDriver, + type IDatabaseDriver, RequestContext, } from '@mikro-orm/core'; -import { User as AccountsUser } from '@accounts/types/lib/types/user'; -import { Session as ISession } from '@accounts/types/lib/types/session/session'; +import { type User as AccountsUser } from '@accounts/types/lib/types/user'; +import { type Session as ISession } from '@accounts/types/lib/types/session/session'; import { ExecutionContext, Inject, Injectable } from 'graphql-modules'; import { get, set } from 'lodash'; diff --git a/packages/database-mikro-orm/src/types/Email.symbol.ts b/packages/database-mikro-orm/src/types/Email.symbol.ts index ce7a2ec60..820815116 100644 --- a/packages/database-mikro-orm/src/types/Email.symbol.ts +++ b/packages/database-mikro-orm/src/types/Email.symbol.ts @@ -1,4 +1,4 @@ import { InjectionToken } from 'graphql-modules'; -import { Email } from '../entity/Email'; +import { type Email } from '../entity/Email'; export const EmailToken = new InjectionToken>('EmailToken'); diff --git a/packages/database-mikro-orm/src/types/Service.symbol.ts b/packages/database-mikro-orm/src/types/Service.symbol.ts index ca61d716d..275c2eb5d 100644 --- a/packages/database-mikro-orm/src/types/Service.symbol.ts +++ b/packages/database-mikro-orm/src/types/Service.symbol.ts @@ -1,4 +1,4 @@ import { InjectionToken } from 'graphql-modules'; -import { Service } from '../entity/Service'; +import { type Service } from '../entity/Service'; export const ServiceToken = new InjectionToken>('ServiceToken'); diff --git a/packages/database-mikro-orm/src/types/Session.symbol.ts b/packages/database-mikro-orm/src/types/Session.symbol.ts index b02a8a6a6..66b44f7fc 100644 --- a/packages/database-mikro-orm/src/types/Session.symbol.ts +++ b/packages/database-mikro-orm/src/types/Session.symbol.ts @@ -1,4 +1,4 @@ import { InjectionToken } from 'graphql-modules'; -import { Session } from '../entity/Session'; +import { type Session } from '../entity/Session'; export const SessionToken = new InjectionToken>('SessionToken'); diff --git a/packages/database-mikro-orm/src/types/User.symbol.ts b/packages/database-mikro-orm/src/types/User.symbol.ts index 27e211290..05c549175 100644 --- a/packages/database-mikro-orm/src/types/User.symbol.ts +++ b/packages/database-mikro-orm/src/types/User.symbol.ts @@ -1,4 +1,4 @@ import { InjectionToken } from 'graphql-modules'; -import { IUser } from '../entity/User'; +import { type IUser } from '../entity/User'; export const UserToken = new InjectionToken>('UserToken'); diff --git a/packages/database-mongo-magic-link/__tests__/mongo-magic-link.ts b/packages/database-mongo-magic-link/__tests__/mongo-magic-link.ts index 997c0d427..0afb83557 100644 --- a/packages/database-mongo-magic-link/__tests__/mongo-magic-link.ts +++ b/packages/database-mongo-magic-link/__tests__/mongo-magic-link.ts @@ -1,4 +1,4 @@ -import { MongoClient, Db, ObjectId } from 'mongodb'; +import { MongoClient, type Db, ObjectId } from 'mongodb'; import { MongoServiceMagicLink } from '../src/'; import { MongoServicePassword } from '@accounts/mongo-password'; diff --git a/packages/database-mongo-magic-link/src/mongo-magic-link.ts b/packages/database-mongo-magic-link/src/mongo-magic-link.ts index 4efccdf78..cde9fc16b 100644 --- a/packages/database-mongo-magic-link/src/mongo-magic-link.ts +++ b/packages/database-mongo-magic-link/src/mongo-magic-link.ts @@ -1,5 +1,5 @@ -import { Collection, Db, CreateIndexesOptions } from 'mongodb'; -import { DatabaseInterfaceServiceMagicLink, User } from '@accounts/types'; +import { type Collection, type Db, type CreateIndexesOptions } from 'mongodb'; +import { type DatabaseInterfaceServiceMagicLink, type User } from '@accounts/types'; import { toMongoID } from './utils'; type PartialBy = Omit & Partial>; diff --git a/packages/database-mongo-password/__tests__/mongo-password.ts b/packages/database-mongo-password/__tests__/mongo-password.ts index ad107298e..2d6c63f12 100644 --- a/packages/database-mongo-password/__tests__/mongo-password.ts +++ b/packages/database-mongo-password/__tests__/mongo-password.ts @@ -1,4 +1,4 @@ -import { MongoClient, Db, ObjectId } from 'mongodb'; +import { MongoClient, type Db, ObjectId } from 'mongodb'; import { MongoServicePassword } from '../src/mongo-password'; const delay = (time: number) => new Promise((resolve) => setTimeout(resolve, time)); diff --git a/packages/database-mongo-password/src/mongo-password.ts b/packages/database-mongo-password/src/mongo-password.ts index c85f9879d..ee98fa812 100644 --- a/packages/database-mongo-password/src/mongo-password.ts +++ b/packages/database-mongo-password/src/mongo-password.ts @@ -1,5 +1,9 @@ -import { Collection, Db, ObjectId, CreateIndexesOptions } from 'mongodb'; -import { CreateUserServicePassword, DatabaseInterfaceServicePassword, User } from '@accounts/types'; +import { type Collection, type Db, type ObjectId, type CreateIndexesOptions } from 'mongodb'; +import { + type CreateUserServicePassword, + type DatabaseInterfaceServicePassword, + type User, +} from '@accounts/types'; import { toMongoID } from './utils'; type PartialBy = Omit & Partial>; diff --git a/packages/database-mongo-sessions/__tests__/mongo-sessions.ts b/packages/database-mongo-sessions/__tests__/mongo-sessions.ts index eb17bca55..a0dae3e67 100644 --- a/packages/database-mongo-sessions/__tests__/mongo-sessions.ts +++ b/packages/database-mongo-sessions/__tests__/mongo-sessions.ts @@ -1,5 +1,5 @@ import { randomBytes } from 'crypto'; -import { MongoClient, Db, ObjectId } from 'mongodb'; +import { MongoClient, type Db, ObjectId } from 'mongodb'; import { MongoSessions } from '../src/mongo-sessions'; const delay = (time: number) => new Promise((resolve) => setTimeout(resolve, time)); diff --git a/packages/database-mongo-sessions/src/mongo-sessions.ts b/packages/database-mongo-sessions/src/mongo-sessions.ts index 15410393c..7f8197f06 100644 --- a/packages/database-mongo-sessions/src/mongo-sessions.ts +++ b/packages/database-mongo-sessions/src/mongo-sessions.ts @@ -1,5 +1,9 @@ -import { Collection, Db, ObjectId, CreateIndexesOptions } from 'mongodb'; -import { ConnectionInformations, DatabaseInterfaceSessions, Session } from '@accounts/types'; +import { type Collection, type Db, type ObjectId, type CreateIndexesOptions } from 'mongodb'; +import { + type ConnectionInformations, + type DatabaseInterfaceSessions, + type Session, +} from '@accounts/types'; import { toMongoID } from './utils'; type PartialBy = Omit & Partial>; diff --git a/packages/database-mongo/src/mongo.ts b/packages/database-mongo/src/mongo.ts index 581bf467a..5c5768e13 100644 --- a/packages/database-mongo/src/mongo.ts +++ b/packages/database-mongo/src/mongo.ts @@ -1,15 +1,15 @@ -import { Collection, Db, ObjectId, CreateIndexesOptions } from 'mongodb'; +import { type Collection, type Db, ObjectId, type CreateIndexesOptions } from 'mongodb'; import { - ConnectionInformations, - CreateUserServicePassword, - DatabaseInterface, - User, - Session, + type ConnectionInformations, + type CreateUserServicePassword, + type DatabaseInterface, + type User, + type Session, } from '@accounts/types'; import { MongoSessions } from '@accounts/mongo-sessions'; import { MongoServicePassword } from '@accounts/mongo-password'; import { MongoServiceMagicLink } from '@accounts/mongo-magic-link'; -import { AccountsMongoConfigToken, AccountsMongoOptions } from './types'; +import { AccountsMongoConfigToken, type AccountsMongoOptions } from './types'; import { MongoConnectionToken } from './types/MongoConnection.symbol'; import { Inject, Injectable } from 'graphql-modules'; diff --git a/packages/database-mongo/src/types/AccountsMongoConfig.symbol.ts b/packages/database-mongo/src/types/AccountsMongoConfig.symbol.ts index 288d72b8f..f666ba0c2 100644 --- a/packages/database-mongo/src/types/AccountsMongoConfig.symbol.ts +++ b/packages/database-mongo/src/types/AccountsMongoConfig.symbol.ts @@ -1,5 +1,5 @@ import { InjectionToken } from 'graphql-modules'; -import { AccountsMongoOptions } from './accounts-mongo-options'; +import { type AccountsMongoOptions } from './accounts-mongo-options'; export const AccountsMongoConfigToken = new InjectionToken( 'AccountsMongoConfig' diff --git a/packages/database-mongo/src/types/MongoConnection.symbol.ts b/packages/database-mongo/src/types/MongoConnection.symbol.ts index fb4611a88..f7acdee49 100644 --- a/packages/database-mongo/src/types/MongoConnection.symbol.ts +++ b/packages/database-mongo/src/types/MongoConnection.symbol.ts @@ -1,4 +1,4 @@ import { InjectionToken } from 'graphql-modules'; -import { Db } from 'mongodb'; +import { type Db } from 'mongodb'; export const MongoConnectionToken = new InjectionToken('MongoConnection'); diff --git a/packages/database-redis/src/redis.ts b/packages/database-redis/src/redis.ts index d6c07b696..8ed4b3c6b 100644 --- a/packages/database-redis/src/redis.ts +++ b/packages/database-redis/src/redis.ts @@ -1,7 +1,11 @@ import { type Redis } from 'ioredis'; import * as shortid from 'shortid'; -import { Session, DatabaseInterfaceSessions, ConnectionInformations } from '@accounts/types'; -import { AccountsRedisOptions } from './types'; +import { + type Session, + type DatabaseInterfaceSessions, + type ConnectionInformations, +} from '@accounts/types'; +import { type AccountsRedisOptions } from './types'; const defaultOptions = { userCollectionName: 'users', diff --git a/packages/database-typeorm/__tests__/typeorm-magic-link.ts b/packages/database-typeorm/__tests__/typeorm-magic-link.ts index 6a7b1e6a8..9e95fbce7 100644 --- a/packages/database-typeorm/__tests__/typeorm-magic-link.ts +++ b/packages/database-typeorm/__tests__/typeorm-magic-link.ts @@ -1,4 +1,4 @@ -import { Connection, createConnection } from 'typeorm'; +import { type Connection, createConnection } from 'typeorm'; import { AccountsTypeorm, entities } from '../src'; const user = { diff --git a/packages/database-typeorm/__tests__/typeorm-password.ts b/packages/database-typeorm/__tests__/typeorm-password.ts index 7fe5a9f5c..292b3e567 100644 --- a/packages/database-typeorm/__tests__/typeorm-password.ts +++ b/packages/database-typeorm/__tests__/typeorm-password.ts @@ -1,4 +1,4 @@ -import { Connection, createConnection } from 'typeorm'; +import { type Connection, createConnection } from 'typeorm'; import { AccountsTypeorm, entities } from '../src'; const user = { diff --git a/packages/database-typeorm/__tests__/typeorm-sessions.ts b/packages/database-typeorm/__tests__/typeorm-sessions.ts index 6eec9ad1d..867103031 100644 --- a/packages/database-typeorm/__tests__/typeorm-sessions.ts +++ b/packages/database-typeorm/__tests__/typeorm-sessions.ts @@ -1,5 +1,5 @@ import { randomBytes } from 'crypto'; -import { Connection, createConnection } from 'typeorm'; +import { type Connection, createConnection } from 'typeorm'; import { AccountsTypeorm, entities } from '../src'; const generateRandomToken = (length = 43): string => randomBytes(length).toString('hex'); diff --git a/packages/database-typeorm/src/typeorm.ts b/packages/database-typeorm/src/typeorm.ts index 3b857f8f1..40852388d 100644 --- a/packages/database-typeorm/src/typeorm.ts +++ b/packages/database-typeorm/src/typeorm.ts @@ -1,11 +1,15 @@ -import { ConnectionInformations, CreateUser, DatabaseInterface } from '@accounts/types'; -import { Repository, getRepository, Not, In, FindOperator, Connection } from 'typeorm'; +import { + type ConnectionInformations, + type CreateUser, + type DatabaseInterface, +} from '@accounts/types'; +import { type Repository, getRepository, Not, In, type FindOperator, Connection } from 'typeorm'; import { User } from './entity/User'; import { UserEmail } from './entity/UserEmail'; import { UserService } from './entity/UserService'; import { UserSession } from './entity/UserSession'; import { - AccountsTypeormOptions, + type AccountsTypeormOptions, AccountsTypeORMConfigToken, UserToken, UserEmailToken, @@ -25,7 +29,7 @@ export class AccountsTypeorm implements DatabaseInterface { constructor( @Inject(AccountsTypeORMConfigToken) private options: AccountsTypeormOptions, - private connection?: Connection, + @Inject(Connection) private connection?: Connection, @Inject(UserToken) private UserEntity: typeof User = User, @Inject(UserEmailToken) private UserEmailEntity: typeof UserEmail = UserEmail, @Inject(UserServiceToken) private UserServiceEntity: typeof UserService = UserService, diff --git a/packages/database-typeorm/src/types/AccountsTypeORMConfig.symbol.ts b/packages/database-typeorm/src/types/AccountsTypeORMConfig.symbol.ts index 7eab60842..3fa841fb5 100644 --- a/packages/database-typeorm/src/types/AccountsTypeORMConfig.symbol.ts +++ b/packages/database-typeorm/src/types/AccountsTypeORMConfig.symbol.ts @@ -1,5 +1,5 @@ import { InjectionToken } from 'graphql-modules'; -import { AccountsTypeormOptions } from '.'; +import { type AccountsTypeormOptions } from '.'; export const AccountsTypeORMConfigToken = new InjectionToken( 'AccountsTypeORMConfigToken' diff --git a/packages/database-typeorm/src/types/User.symbol.ts b/packages/database-typeorm/src/types/User.symbol.ts index 78e8ccf94..9fd10d73a 100644 --- a/packages/database-typeorm/src/types/User.symbol.ts +++ b/packages/database-typeorm/src/types/User.symbol.ts @@ -1,4 +1,4 @@ import { InjectionToken } from 'graphql-modules'; -import { User } from '../entity/User'; +import { type User } from '../entity/User'; export const UserToken = new InjectionToken('UserToken'); diff --git a/packages/database-typeorm/src/types/UserEmail.symbol.ts b/packages/database-typeorm/src/types/UserEmail.symbol.ts index 476680b80..220e15397 100644 --- a/packages/database-typeorm/src/types/UserEmail.symbol.ts +++ b/packages/database-typeorm/src/types/UserEmail.symbol.ts @@ -1,4 +1,4 @@ import { InjectionToken } from 'graphql-modules'; -import { UserEmail } from '../entity/UserEmail'; +import { type UserEmail } from '../entity/UserEmail'; export const UserEmailToken = new InjectionToken('UserEmailToken'); diff --git a/packages/database-typeorm/src/types/UserService.symbol.ts b/packages/database-typeorm/src/types/UserService.symbol.ts index 403a970a8..7247799cc 100644 --- a/packages/database-typeorm/src/types/UserService.symbol.ts +++ b/packages/database-typeorm/src/types/UserService.symbol.ts @@ -1,4 +1,4 @@ import { InjectionToken } from 'graphql-modules'; -import { UserService } from '../entity/UserService'; +import { type UserService } from '../entity/UserService'; export const UserServiceToken = new InjectionToken('UserServiceToken'); diff --git a/packages/database-typeorm/src/types/UserSession.symbol.ts b/packages/database-typeorm/src/types/UserSession.symbol.ts index 3abbfb665..2fa5ced25 100644 --- a/packages/database-typeorm/src/types/UserSession.symbol.ts +++ b/packages/database-typeorm/src/types/UserSession.symbol.ts @@ -1,4 +1,4 @@ import { InjectionToken } from 'graphql-modules'; -import { UserSession } from '../entity/UserSession'; +import { type UserSession } from '../entity/UserSession'; export const UserSessionToken = new InjectionToken('UserSessionToken'); diff --git a/packages/e2e/__tests__/databases/index.ts b/packages/e2e/__tests__/databases/index.ts index 5e2bee6be..ae642ad45 100644 --- a/packages/e2e/__tests__/databases/index.ts +++ b/packages/e2e/__tests__/databases/index.ts @@ -1,5 +1,5 @@ -import { DatabaseInterface } from '@accounts/types'; -import { Module } from 'graphql-modules'; +import { type DatabaseInterface } from '@accounts/types'; +import { type Module } from 'graphql-modules'; export interface DatabaseTestInterface { databaseModule: Module; diff --git a/packages/e2e/__tests__/databases/mongo.ts b/packages/e2e/__tests__/databases/mongo.ts index be6853a6b..0c0f94401 100644 --- a/packages/e2e/__tests__/databases/mongo.ts +++ b/packages/e2e/__tests__/databases/mongo.ts @@ -1,8 +1,8 @@ import mongoose from 'mongoose'; -import { DatabaseInterface } from '@accounts/types'; +import { type DatabaseInterface } from '@accounts/types'; // TODO rename to AccountsMongo ? import { Mongo } from '@accounts/mongo'; -import { DatabaseTestInterface } from './index'; +import { type DatabaseTestInterface } from './index'; import { createAccountsMongoModule } from '@accounts/module-mongo'; const connectionString = 'mongodb://localhost/accounts-js-tests-e2e'; diff --git a/packages/e2e/__tests__/databases/typeorm.ts b/packages/e2e/__tests__/databases/typeorm.ts index 4ef0bc266..7ae294dc2 100644 --- a/packages/e2e/__tests__/databases/typeorm.ts +++ b/packages/e2e/__tests__/databases/typeorm.ts @@ -1,10 +1,10 @@ import { AccountsTypeorm, entities } from '@accounts/typeorm'; -import { DatabaseInterface } from '@accounts/types'; -import { Connection, ConnectionManager, ConnectionOptions } from 'typeorm'; +import { type DatabaseInterface } from '@accounts/types'; +import { type Connection, ConnectionManager, type ConnectionOptions } from 'typeorm'; import { createAccountsTypeORMModule } from '@accounts/module-typeorm'; -import { DatabaseTestInterface } from '.'; -import { Module } from 'graphql-modules'; +import { type DatabaseTestInterface } from '.'; +import { type Module } from 'graphql-modules'; const connectionName = 'typeorm-accounts-js-test'; const connectionConfig: ConnectionOptions = { diff --git a/packages/e2e/__tests__/servers/index.ts b/packages/e2e/__tests__/servers/index.ts index 62dd5bb53..b6ba2ef56 100644 --- a/packages/e2e/__tests__/servers/index.ts +++ b/packages/e2e/__tests__/servers/index.ts @@ -1,6 +1,6 @@ -import { DatabaseInterface } from '@accounts/types'; -import { AccountsClient } from '@accounts/client'; -import { AccountsClientPassword } from '@accounts/client-password'; +import { type DatabaseInterface } from '@accounts/types'; +import { type AccountsClient } from '@accounts/client'; +import { type AccountsClientPassword } from '@accounts/client-password'; import { ServerGraphqlTest } from './server-graphql'; import { ServerRestTest } from './server-rest'; diff --git a/packages/e2e/__tests__/servers/server-graphql.ts b/packages/e2e/__tests__/servers/server-graphql.ts index 9d68401dd..43a5e6122 100644 --- a/packages/e2e/__tests__/servers/server-graphql.ts +++ b/packages/e2e/__tests__/servers/server-graphql.ts @@ -2,18 +2,18 @@ import { AccountsClient } from '@accounts/client'; import { AccountsClientPassword } from '@accounts/client-password'; import { context, createAccountsCoreModule } from '@accounts/module-core'; import { createAccountsPasswordModule } from '@accounts/module-password'; -import { Application, Module, createApplication } from 'graphql-modules'; +import { type Application, type Module, createApplication } from 'graphql-modules'; import { AccountsGraphQLClient } from '@accounts/graphql-client'; import { AccountsPassword } from '@accounts/password'; import { AuthenticationServicesToken, DatabaseInterfaceUserToken } from '@accounts/server'; -import { DatabaseInterface, User } from '@accounts/types'; +import { type DatabaseInterface, type User } from '@accounts/types'; import { ApolloClient, InMemoryCache } from '@apollo/client/core'; import { ApolloServer } from '@apollo/server'; import { startStandaloneServer } from '@apollo/server/standalone'; import fetch from 'node-fetch'; -import { ServerTestInterface } from '.'; -import { DatabaseTestInterface } from '../databases'; +import { type ServerTestInterface } from '.'; +import { type DatabaseTestInterface } from '../databases'; import { DatabaseTest } from '../databases/mongo'; // Server diff --git a/packages/e2e/__tests__/servers/server-rest.ts b/packages/e2e/__tests__/servers/server-rest.ts index 4274c034b..3ecd3124b 100644 --- a/packages/e2e/__tests__/servers/server-rest.ts +++ b/packages/e2e/__tests__/servers/server-rest.ts @@ -1,22 +1,22 @@ import express from 'express'; import bodyParser from 'body-parser'; -import http from 'http'; +import type http from 'http'; import fetch from 'node-fetch'; // Server import { AccountsServer } from '@accounts/server'; import { AccountsPassword } from '@accounts/password'; import accountsExpress from '@accounts/rest-express'; -import { User, DatabaseInterface } from '@accounts/types'; +import { type User, type DatabaseInterface } from '@accounts/types'; // Client import { AccountsClient } from '@accounts/client'; import { AccountsClientPassword } from '@accounts/client-password'; import { RestClient } from '@accounts/rest-client'; -import { DatabaseTestInterface } from '../databases'; +import { type DatabaseTestInterface } from '../databases'; import { DatabaseTest } from '../databases/mongo'; -import { ServerTestInterface } from './index'; +import { type ServerTestInterface } from './index'; (global as any).fetch = fetch; diff --git a/packages/express-session/src/index.ts b/packages/express-session/src/index.ts index f28aa32f8..6bb4bd620 100644 --- a/packages/express-session/src/index.ts +++ b/packages/express-session/src/index.ts @@ -1,6 +1,6 @@ -import { AccountsServer } from '@accounts/server'; -import { Tokens, User, LoginResult } from '@accounts/types'; -import { Request, Response, NextFunction } from 'express'; +import { type AccountsServer } from '@accounts/server'; +import { type Tokens, type User, type LoginResult } from '@accounts/types'; +import { type Request, type Response, type NextFunction } from 'express'; import * as requestIp from 'request-ip'; import { merge } from 'lodash'; import 'express-session'; diff --git a/packages/express-session/src/utils/get-user-agent.ts b/packages/express-session/src/utils/get-user-agent.ts index bb59566e9..3399bfc83 100644 --- a/packages/express-session/src/utils/get-user-agent.ts +++ b/packages/express-session/src/utils/get-user-agent.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; export const getUserAgent = (req: express.Request) => { let userAgent: string = (req.headers['user-agent'] as string) || ''; diff --git a/packages/graphql-client/src/GraphQLErrorList.ts b/packages/graphql-client/src/GraphQLErrorList.ts index eafd14f71..af01d2ed5 100644 --- a/packages/graphql-client/src/GraphQLErrorList.ts +++ b/packages/graphql-client/src/GraphQLErrorList.ts @@ -1,4 +1,4 @@ -import { GraphQLError } from 'graphql/error/GraphQLError'; +import { type GraphQLError } from 'graphql/error/GraphQLError'; export class GraphQLErrorList extends Error { public errors: readonly GraphQLError[]; diff --git a/packages/graphql-client/src/graphql-client.ts b/packages/graphql-client/src/graphql-client.ts index 45bbd9ff6..1d3832a87 100644 --- a/packages/graphql-client/src/graphql-client.ts +++ b/packages/graphql-client/src/graphql-client.ts @@ -1,13 +1,13 @@ -import { AccountsClient, TransportInterface } from '@accounts/client'; +import { type AccountsClient, type TransportInterface } from '@accounts/client'; import { - CreateUser, - ImpersonationResult, - LoginResult, - User, - CreateUserResult, + type CreateUser, + type ImpersonationResult, + type LoginResult, + type User, + type CreateUserResult, } from '@accounts/types'; -import { print, DocumentNode } from 'graphql/language'; -import { TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { print, type DocumentNode } from 'graphql/language'; +import { type TypedDocumentNode } from '@graphql-typed-document-node/core'; import { CreateUserDocument, AddEmailDocument, diff --git a/packages/graphql-client/src/utils/replace-user-fragment.ts b/packages/graphql-client/src/utils/replace-user-fragment.ts index be7d06d5b..d354282f5 100644 --- a/packages/graphql-client/src/utils/replace-user-fragment.ts +++ b/packages/graphql-client/src/utils/replace-user-fragment.ts @@ -1,4 +1,4 @@ -import { DocumentNode } from 'graphql'; +import { type DocumentNode } from 'graphql'; /** * Utility function used to modify the current query Document. diff --git a/packages/magic-link/src/accounts-magic-link.ts b/packages/magic-link/src/accounts-magic-link.ts index ea2f92881..65b9cc6d2 100644 --- a/packages/magic-link/src/accounts-magic-link.ts +++ b/packages/magic-link/src/accounts-magic-link.ts @@ -1,10 +1,10 @@ import { - User, - DatabaseInterface, - AuthenticationService, - LoginUserMagicLinkService, - TokenRecord, - DatabaseInterfaceUser, + type User, + type DatabaseInterface, + type AuthenticationService, + type LoginUserMagicLinkService, + type TokenRecord, + type DatabaseInterfaceUser, } from '@accounts/types'; import { AccountsServer, @@ -12,7 +12,7 @@ import { generateRandomToken, DatabaseInterfaceUserToken, } from '@accounts/server'; -import { AccountsMagicLinkConfigToken, ErrorMessages } from './types'; +import { AccountsMagicLinkConfigToken, type ErrorMessages } from './types'; import { errors, AuthenticateErrors, MagicLinkAuthenticatorErrors } from './errors'; import { isString } from './utils/validation'; import { RequestMagicLinkEmailErrors } from './errors'; @@ -50,7 +50,7 @@ export default class AccountsMagicLink constructor( @Inject(AccountsMagicLinkConfigToken) options: AccountsMagicLinkOptions = {}, - server?: AccountsServer, + @Inject(AccountsServer) server?: AccountsServer, @Inject(DatabaseInterfaceUserToken) db?: DatabaseInterface | DatabaseInterfaceUser ) { diff --git a/packages/magic-link/src/errors.ts b/packages/magic-link/src/errors.ts index 39d80b9c9..d3106f7c1 100644 --- a/packages/magic-link/src/errors.ts +++ b/packages/magic-link/src/errors.ts @@ -1,4 +1,4 @@ -import { ErrorMessages } from './types'; +import { type ErrorMessages } from './types'; export const errors: ErrorMessages = { userNotFound: 'User not found', diff --git a/packages/magic-link/src/types/AccountsMagicLinkConfig.symbol.ts b/packages/magic-link/src/types/AccountsMagicLinkConfig.symbol.ts index 81c6ec881..2daf5593a 100644 --- a/packages/magic-link/src/types/AccountsMagicLinkConfig.symbol.ts +++ b/packages/magic-link/src/types/AccountsMagicLinkConfig.symbol.ts @@ -1,5 +1,5 @@ import { InjectionToken } from 'graphql-modules'; -import { AccountsMagicLinkOptions } from '../accounts-magic-link'; +import { type AccountsMagicLinkOptions } from '../accounts-magic-link'; export const AccountsMagicLinkConfigToken = new InjectionToken( 'AccountsMagicLinkConfig' diff --git a/packages/magic-link/src/utils/user.ts b/packages/magic-link/src/utils/user.ts index b5551aa04..c96586711 100644 --- a/packages/magic-link/src/utils/user.ts +++ b/packages/magic-link/src/utils/user.ts @@ -1,4 +1,4 @@ -import { User, TokenRecord } from '@accounts/types'; +import { type User, type TokenRecord } from '@accounts/types'; export const getUserLoginTokens = (user: User): TokenRecord[] => { return user.services?.magicLink?.loginTokens ?? []; diff --git a/packages/oauth-instagram/src/accounts-oauth-instagram.ts b/packages/oauth-instagram/src/accounts-oauth-instagram.ts index f3c9a70be..f1c118269 100644 --- a/packages/oauth-instagram/src/accounts-oauth-instagram.ts +++ b/packages/oauth-instagram/src/accounts-oauth-instagram.ts @@ -1,6 +1,6 @@ import rp from 'request-promise'; -import { OAuthProvider, OAuthUser } from '@accounts/oauth'; -import { Configuration } from './types/configuration'; +import { type OAuthProvider, type OAuthUser } from '@accounts/oauth'; +import { type Configuration } from './types/configuration'; export class AccountsOAuthInstagram implements OAuthProvider { public getRegistrationPayload?: (oauthUser: OAuthUser) => Promise; diff --git a/packages/oauth-instagram/src/types/configuration.ts b/packages/oauth-instagram/src/types/configuration.ts index f713d6fb0..9af1b25eb 100644 --- a/packages/oauth-instagram/src/types/configuration.ts +++ b/packages/oauth-instagram/src/types/configuration.ts @@ -1,4 +1,4 @@ -import { OAuthUser } from '@accounts/oauth'; +import { type OAuthUser } from '@accounts/oauth'; export interface Configuration { getRegistrationPayload?: (oauthUser: OAuthUser) => Promise; diff --git a/packages/oauth-twitter/src/accounts-oauth-twitter.ts b/packages/oauth-twitter/src/accounts-oauth-twitter.ts index 039e3eaa1..8a5592730 100644 --- a/packages/oauth-twitter/src/accounts-oauth-twitter.ts +++ b/packages/oauth-twitter/src/accounts-oauth-twitter.ts @@ -1,7 +1,7 @@ import * as oauth from 'oauth'; -import { Configuration } from './types/configuration'; -import { OAuthProvider, OAuthUser } from '@accounts/oauth'; +import { type Configuration } from './types/configuration'; +import { type OAuthProvider, type OAuthUser } from '@accounts/oauth'; export class AccountsOAuthTwitter implements OAuthProvider { private config: Configuration; diff --git a/packages/oauth-twitter/src/types/configuration.ts b/packages/oauth-twitter/src/types/configuration.ts index 5ba36480c..a6159cb89 100644 --- a/packages/oauth-twitter/src/types/configuration.ts +++ b/packages/oauth-twitter/src/types/configuration.ts @@ -1,4 +1,4 @@ -import { OAuthUser } from '@accounts/oauth'; +import { type OAuthUser } from '@accounts/oauth'; export interface Configuration { key: string; diff --git a/packages/oauth/src/accounts-oauth.ts b/packages/oauth/src/accounts-oauth.ts index 0f5afb62c..462580299 100644 --- a/packages/oauth/src/accounts-oauth.ts +++ b/packages/oauth/src/accounts-oauth.ts @@ -1,16 +1,16 @@ import { - User, - DatabaseInterface, - AuthenticationService, - DatabaseInterfaceUser, + type User, + type DatabaseInterface, + type AuthenticationService, + type DatabaseInterfaceUser, } from '@accounts/types'; import { AccountsServer, /*DatabaseInterfaceSessionsToken,*/ DatabaseInterfaceUserToken, ServerHooks, } from '@accounts/server'; -import { OAuthProviders } from './types/oauth-providers'; -import { OAuthUser } from './types/oauth-user'; +import { type OAuthProviders } from './types/oauth-providers'; +import { type OAuthUser } from './types/oauth-user'; import { ExecutionContext, Inject, Injectable } from 'graphql-modules'; import { OAuthProvidersToken } from './types/OAuthProviders.symbol'; @@ -37,7 +37,7 @@ export class AccountsOauth @Inject(DatabaseInterfaceUserToken) db?: DatabaseInterface | DatabaseInterfaceUser, // @Inject(DatabaseInterfaceSessionsToken) dbSessions?: DatabaseInterfaceSessions, - server?: AccountsServer + @Inject(AccountsServer) server?: AccountsServer ) { if (db) { this.db = db; diff --git a/packages/oauth/src/types/OAuthProviders.symbol.ts b/packages/oauth/src/types/OAuthProviders.symbol.ts index 25370962d..a9c0bc7f8 100644 --- a/packages/oauth/src/types/OAuthProviders.symbol.ts +++ b/packages/oauth/src/types/OAuthProviders.symbol.ts @@ -1,4 +1,4 @@ import { InjectionToken } from 'graphql-modules'; -import { OAuthProviders } from './oauth-providers'; +import { type OAuthProviders } from './oauth-providers'; export const OAuthProvidersToken = new InjectionToken('OauthProviders'); diff --git a/packages/oauth/src/types/oauth-provider.ts b/packages/oauth/src/types/oauth-provider.ts index cf4d9b333..0f01a7b87 100644 --- a/packages/oauth/src/types/oauth-provider.ts +++ b/packages/oauth/src/types/oauth-provider.ts @@ -1,4 +1,4 @@ -import { OAuthUser } from './oauth-user'; +import { type OAuthUser } from './oauth-user'; /** * Interface to use for all custom implementations of OAuth providers diff --git a/packages/oauth/src/types/oauth-providers.ts b/packages/oauth/src/types/oauth-providers.ts index d3142c54a..5938141bb 100644 --- a/packages/oauth/src/types/oauth-providers.ts +++ b/packages/oauth/src/types/oauth-providers.ts @@ -1,4 +1,4 @@ -import { OAuthProvider } from './oauth-provider'; +import { type OAuthProvider } from './oauth-provider'; export interface OAuthProviders { [key: string]: (new (args: any) => OAuthProvider) | OAuthProvider | undefined; diff --git a/packages/password/src/accounts-password.ts b/packages/password/src/accounts-password.ts index be4746351..4de906b96 100644 --- a/packages/password/src/accounts-password.ts +++ b/packages/password/src/accounts-password.ts @@ -1,18 +1,22 @@ import { - User, - LoginUserIdentity, - EmailRecord, - TokenRecord, - DatabaseInterface, - AuthenticationService, - ConnectionInformations, - LoginResult, - CreateUserServicePassword, - LoginUserPasswordService, - DatabaseInterfaceSessions, - DatabaseInterfaceUser, + type User, + type LoginUserIdentity, + type EmailRecord, + type TokenRecord, + type DatabaseInterface, + type AuthenticationService, + type ConnectionInformations, + type LoginResult, + type CreateUserServicePassword, + type LoginUserPasswordService, + type DatabaseInterfaceSessions, + type DatabaseInterfaceUser, } from '@accounts/types'; -import { TwoFactor, AccountsTwoFactorOptions, getUserTwoFactorService } from '@accounts/two-factor'; +import { + TwoFactor, + type AccountsTwoFactorOptions, + getUserTwoFactorService, +} from '@accounts/two-factor'; import { AccountsServer, ServerHooks, @@ -28,7 +32,7 @@ import { verifyPassword, isEmail, } from './utils'; -import { AccountsPasswordConfigToken, ErrorMessages } from './types'; +import { AccountsPasswordConfigToken, type ErrorMessages } from './types'; import { errors, AddEmailErrors, @@ -202,7 +206,7 @@ export default class AccountsPassword @Inject(DatabaseInterfaceUserToken) db?: DatabaseInterface | DatabaseInterfaceUser, @Inject(DatabaseInterfaceSessionsToken) dbSessions?: DatabaseInterfaceSessions, - server?: AccountsServer + @Inject(AccountsServer) server?: AccountsServer ) { this.options = { ...defaultOptions, ...options } as typeof options & typeof defaultOptions; if (this.options.requireEmailVerification) { diff --git a/packages/password/src/errors.ts b/packages/password/src/errors.ts index c7094d456..3481cbe62 100644 --- a/packages/password/src/errors.ts +++ b/packages/password/src/errors.ts @@ -1,4 +1,4 @@ -import { ErrorMessages } from './types'; +import { type ErrorMessages } from './types'; export const errors: ErrorMessages = { userNotFound: 'User not found', diff --git a/packages/password/src/types/AccountsPasswordConfig.symbol.ts b/packages/password/src/types/AccountsPasswordConfig.symbol.ts index 88a4e1e06..8524551ed 100644 --- a/packages/password/src/types/AccountsPasswordConfig.symbol.ts +++ b/packages/password/src/types/AccountsPasswordConfig.symbol.ts @@ -1,5 +1,5 @@ import { InjectionToken } from 'graphql-modules'; -import { AccountsPasswordOptions } from '../accounts-password'; +import { type AccountsPasswordOptions } from '../accounts-password'; export const AccountsPasswordConfigToken = new InjectionToken( 'AccountsPasswordConfig' diff --git a/packages/password/src/utils/user.ts b/packages/password/src/utils/user.ts index 549583a78..37f3d744c 100644 --- a/packages/password/src/utils/user.ts +++ b/packages/password/src/utils/user.ts @@ -1,4 +1,4 @@ -import { User, TokenRecord } from '@accounts/types'; +import { type User, type TokenRecord } from '@accounts/types'; export const getUserResetTokens = (user: User): TokenRecord[] => { return user.services?.password?.reset ?? []; diff --git a/packages/rest-client/src/auth-fetch.ts b/packages/rest-client/src/auth-fetch.ts index 3c3ceaad4..80b54b4e3 100644 --- a/packages/rest-client/src/auth-fetch.ts +++ b/packages/rest-client/src/auth-fetch.ts @@ -1,4 +1,4 @@ -import { AccountsClient } from '@accounts/client'; +import { type AccountsClient } from '@accounts/client'; const headers: { [key: string]: string } = { 'Content-Type': 'application/json', diff --git a/packages/rest-client/src/rest-client.ts b/packages/rest-client/src/rest-client.ts index ad25dc524..f1544ae0e 100644 --- a/packages/rest-client/src/rest-client.ts +++ b/packages/rest-client/src/rest-client.ts @@ -1,11 +1,11 @@ -import { TransportInterface, AccountsClient } from '@accounts/client'; +import { type TransportInterface, type AccountsClient } from '@accounts/client'; import { - User, - LoginResult, - CreateUser, - ImpersonationUserIdentity, - ImpersonationResult, - CreateUserResult, + type User, + type LoginResult, + type CreateUser, + type ImpersonationUserIdentity, + type ImpersonationResult, + type CreateUserResult, } from '@accounts/types'; import { AccountsJsError } from './accounts-error'; diff --git a/packages/rest-express/__tests__/endpoints/password/register.ts b/packages/rest-express/__tests__/endpoints/password/register.ts index 7cfc6f8c5..ffb2ec13d 100644 --- a/packages/rest-express/__tests__/endpoints/password/register.ts +++ b/packages/rest-express/__tests__/endpoints/password/register.ts @@ -1,5 +1,5 @@ import 'reflect-metadata'; -import { LoginResult } from '@accounts/types'; +import { type LoginResult } from '@accounts/types'; import { AccountsJsError } from '@accounts/server'; import request from 'supertest'; import accountsExpress from '../../../src/express-middleware'; diff --git a/packages/rest-express/src/endpoints/get-user.ts b/packages/rest-express/src/endpoints/get-user.ts index c5e62ff9e..7e9e7fee5 100644 --- a/packages/rest-express/src/endpoints/get-user.ts +++ b/packages/rest-express/src/endpoints/get-user.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; export const getUser = () => async (req: express.Request, res: express.Response) => { res.json((req as any).user || null); diff --git a/packages/rest-express/src/endpoints/impersonate.ts b/packages/rest-express/src/endpoints/impersonate.ts index 335487b0d..3098ec0ef 100644 --- a/packages/rest-express/src/endpoints/impersonate.ts +++ b/packages/rest-express/src/endpoints/impersonate.ts @@ -1,6 +1,6 @@ -import * as express from 'express'; +import type * as express from 'express'; import { type AccountsServer } from '@accounts/server'; -import { ImpersonationUserIdentity } from '@accounts/types'; +import { type ImpersonationUserIdentity } from '@accounts/types'; import { sendError } from '../utils/send-error'; import { body } from 'express-validator'; import { matchOrThrow } from '../utils/matchOrTrow'; diff --git a/packages/rest-express/src/endpoints/logout.ts b/packages/rest-express/src/endpoints/logout.ts index e1f42b4ed..b7476949e 100644 --- a/packages/rest-express/src/endpoints/logout.ts +++ b/packages/rest-express/src/endpoints/logout.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; import { type AccountsServer } from '@accounts/server'; import { sendError } from '../utils/send-error'; diff --git a/packages/rest-express/src/endpoints/magic-link/request-magic-link-email.ts b/packages/rest-express/src/endpoints/magic-link/request-magic-link-email.ts index f4f505846..ba5dbc337 100644 --- a/packages/rest-express/src/endpoints/magic-link/request-magic-link-email.ts +++ b/packages/rest-express/src/endpoints/magic-link/request-magic-link-email.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; import { AccountsJsError, type AccountsServer } from '@accounts/server'; import { type AccountsMagicLink, RequestMagicLinkEmailErrors } from '@accounts/magic-link'; import { sendError } from '../../utils/send-error'; diff --git a/packages/rest-express/src/endpoints/oauth/provider-callback.ts b/packages/rest-express/src/endpoints/oauth/provider-callback.ts index 585c260cc..557598195 100644 --- a/packages/rest-express/src/endpoints/oauth/provider-callback.ts +++ b/packages/rest-express/src/endpoints/oauth/provider-callback.ts @@ -1,7 +1,7 @@ -import * as express from 'express'; +import type * as express from 'express'; import { type AccountsServer } from '@accounts/server'; import { sendError } from '../../utils/send-error'; -import { AccountsExpressOptions } from '../../types'; +import { type AccountsExpressOptions } from '../../types'; interface RequestWithSession extends express.Request { session: any; diff --git a/packages/rest-express/src/endpoints/password/add-email.ts b/packages/rest-express/src/endpoints/password/add-email.ts index 7f35c5cde..b4fb7eef3 100644 --- a/packages/rest-express/src/endpoints/password/add-email.ts +++ b/packages/rest-express/src/endpoints/password/add-email.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; import { type AccountsServer } from '@accounts/server'; import { type AccountsPassword } from '@accounts/password'; import { sendError } from '../../utils/send-error'; diff --git a/packages/rest-express/src/endpoints/password/change-password.ts b/packages/rest-express/src/endpoints/password/change-password.ts index 84180521c..f3fbc31aa 100644 --- a/packages/rest-express/src/endpoints/password/change-password.ts +++ b/packages/rest-express/src/endpoints/password/change-password.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; import { type AccountsServer } from '@accounts/server'; import { type AccountsPassword } from '@accounts/password'; import { sendError } from '../../utils/send-error'; diff --git a/packages/rest-express/src/endpoints/password/register.ts b/packages/rest-express/src/endpoints/password/register.ts index 58c3bb0f7..f13d80c7d 100644 --- a/packages/rest-express/src/endpoints/password/register.ts +++ b/packages/rest-express/src/endpoints/password/register.ts @@ -1,7 +1,7 @@ -import * as express from 'express'; +import type * as express from 'express'; import { type AccountsServer, AccountsJsError } from '@accounts/server'; import { type AccountsPassword, CreateUserErrors } from '@accounts/password'; -import { CreateUserResult, CreateUserServicePassword } from '@accounts/types'; +import { type CreateUserResult, type CreateUserServicePassword } from '@accounts/types'; import { sendError } from '../../utils/send-error'; import { body } from 'express-validator'; import { matchOrThrow } from '../../utils/matchOrTrow'; diff --git a/packages/rest-express/src/endpoints/password/reset.ts b/packages/rest-express/src/endpoints/password/reset.ts index c7583f34c..dea6091f0 100644 --- a/packages/rest-express/src/endpoints/password/reset.ts +++ b/packages/rest-express/src/endpoints/password/reset.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; import { AccountsJsError, type AccountsServer } from '@accounts/server'; import { type AccountsPassword, SendResetPasswordEmailErrors } from '@accounts/password'; import { sendError } from '../../utils/send-error'; diff --git a/packages/rest-express/src/endpoints/password/two-factor.ts b/packages/rest-express/src/endpoints/password/two-factor.ts index 272c68fef..6a7e067e5 100644 --- a/packages/rest-express/src/endpoints/password/two-factor.ts +++ b/packages/rest-express/src/endpoints/password/two-factor.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; import { type AccountsServer } from '@accounts/server'; import { type AccountsPassword } from '@accounts/password'; import { sendError } from '../../utils/send-error'; diff --git a/packages/rest-express/src/endpoints/password/verify-email.ts b/packages/rest-express/src/endpoints/password/verify-email.ts index bec0af08f..0bbf6b9fc 100644 --- a/packages/rest-express/src/endpoints/password/verify-email.ts +++ b/packages/rest-express/src/endpoints/password/verify-email.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; import { AccountsJsError, type AccountsServer } from '@accounts/server'; import { type AccountsPassword, SendVerificationEmailErrors } from '@accounts/password'; import { sendError } from '../../utils/send-error'; diff --git a/packages/rest-express/src/endpoints/refresh-access-token.ts b/packages/rest-express/src/endpoints/refresh-access-token.ts index 5348dcecf..6f4d7d7e9 100644 --- a/packages/rest-express/src/endpoints/refresh-access-token.ts +++ b/packages/rest-express/src/endpoints/refresh-access-token.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; import { type AccountsServer } from '@accounts/server'; import { sendError } from '../utils/send-error'; import { body } from 'express-validator'; diff --git a/packages/rest-express/src/endpoints/service-authenticate.ts b/packages/rest-express/src/endpoints/service-authenticate.ts index 222d0f122..bbba22965 100644 --- a/packages/rest-express/src/endpoints/service-authenticate.ts +++ b/packages/rest-express/src/endpoints/service-authenticate.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; import { type AccountsServer } from '@accounts/server'; import { sendError } from '../utils/send-error'; import { param } from 'express-validator'; diff --git a/packages/rest-express/src/endpoints/verify-authentication.ts b/packages/rest-express/src/endpoints/verify-authentication.ts index 9261fecd0..e16057b51 100644 --- a/packages/rest-express/src/endpoints/verify-authentication.ts +++ b/packages/rest-express/src/endpoints/verify-authentication.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; import { type AccountsServer } from '@accounts/server'; import { sendError } from '../utils/send-error'; import { param } from 'express-validator'; diff --git a/packages/rest-express/src/express-middleware.ts b/packages/rest-express/src/express-middleware.ts index f4666813b..e70182360 100644 --- a/packages/rest-express/src/express-middleware.ts +++ b/packages/rest-express/src/express-middleware.ts @@ -15,7 +15,7 @@ import { twoFactorSecret, twoFactorSet, twoFactorUnset } from './endpoints/passw import { changePassword } from './endpoints/password/change-password'; import { addEmail } from './endpoints/password/add-email'; import { userLoader } from './user-loader'; -import { AccountsExpressOptions } from './types'; +import { type AccountsExpressOptions } from './types'; import { getUserAgent } from './utils/get-user-agent'; import { requestMagicLinkEmail } from './endpoints/magic-link/request-magic-link-email'; diff --git a/packages/rest-express/src/types.ts b/packages/rest-express/src/types.ts index 18fdbdfee..ec85be27c 100644 --- a/packages/rest-express/src/types.ts +++ b/packages/rest-express/src/types.ts @@ -1,5 +1,5 @@ -import * as express from 'express'; -import { LoginResult } from '@accounts/types'; +import type * as express from 'express'; +import { type LoginResult } from '@accounts/types'; export type OAuthSuccessCallback = ( req: express.Request, diff --git a/packages/rest-express/src/user-loader.ts b/packages/rest-express/src/user-loader.ts index dc875757e..b1b05b32c 100644 --- a/packages/rest-express/src/user-loader.ts +++ b/packages/rest-express/src/user-loader.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; import { type AccountsServer } from '@accounts/server'; import { body } from 'express-validator'; import { matchOrThrow } from './utils/matchOrTrow'; diff --git a/packages/rest-express/src/utils/get-user-agent.ts b/packages/rest-express/src/utils/get-user-agent.ts index bb59566e9..3399bfc83 100644 --- a/packages/rest-express/src/utils/get-user-agent.ts +++ b/packages/rest-express/src/utils/get-user-agent.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import type * as express from 'express'; export const getUserAgent = (req: express.Request) => { let userAgent: string = (req.headers['user-agent'] as string) || ''; diff --git a/packages/server/__tests__/account-server.ts b/packages/server/__tests__/account-server.ts index a3a41b238..424ca3572 100644 --- a/packages/server/__tests__/account-server.ts +++ b/packages/server/__tests__/account-server.ts @@ -1,7 +1,7 @@ import 'reflect-metadata'; import jwtDecode from 'jwt-decode'; import { AccountsServer } from '../src/accounts-server'; -import { JwtData } from '../src/types/jwt-data'; +import { type JwtData } from '../src/types/jwt-data'; import { ServerHooks } from '../src/utils/server-hooks'; const delay = (timeout: number) => new Promise((resolve) => setTimeout(resolve, timeout)); diff --git a/packages/server/src/accounts-server.ts b/packages/server/src/accounts-server.ts index 9d415a452..b92b127bb 100644 --- a/packages/server/src/accounts-server.ts +++ b/packages/server/src/accounts-server.ts @@ -2,18 +2,18 @@ import merge from 'lodash.merge'; import * as jwt from 'jsonwebtoken'; import Emittery from 'emittery'; import { - User, - LoginResult, - Tokens, - Session, - ImpersonationUserIdentity, - ImpersonationResult, - HookListener, - DatabaseInterface, - ConnectionInformations, - DatabaseInterfaceUser, - DatabaseInterfaceSessions, - AuthenticationService, + type User, + type LoginResult, + type Tokens, + type Session, + type ImpersonationUserIdentity, + type ImpersonationResult, + type HookListener, + type DatabaseInterface, + type ConnectionInformations, + type DatabaseInterfaceUser, + type DatabaseInterfaceSessions, + type AuthenticationService, } from '@accounts/types'; import { generateAccessToken, generateRefreshToken, generateRandomToken } from './utils/tokens'; @@ -21,10 +21,10 @@ import { generateAccessToken, generateRefreshToken, generateRandomToken } from ' import { emailTemplates, sendMail } from './utils/email'; import { ServerHooks } from './utils/server-hooks'; -import { AccountsServerOptions } from './types/accounts-server-options'; -import { JwtData } from './types/jwt-data'; -import { EmailTemplateType } from './types/email-template-type'; -import { JwtPayload } from './types/jwt-payload'; +import { type AccountsServerOptions } from './types/accounts-server-options'; +import { type JwtData } from './types/jwt-data'; +import { type EmailTemplateType } from './types/email-template-type'; +import { type JwtPayload } from './types/jwt-payload'; import { AccountsJsError } from './utils/accounts-error'; import { AuthenticateWithServiceErrors, @@ -39,7 +39,7 @@ import { isString } from './utils/validation'; import { ExecutionContext, Inject, Injectable } from 'graphql-modules'; import { AccountsCoreConfigToken } from './types/AccountsCoreConfig.symbol'; import { AuthenticationServicesToken } from './types/AuthenticationServices.symbol'; -import { AuthenticationServices } from './types/authentication-services'; +import { type AuthenticationServices } from './types/authentication-services'; import { DatabaseInterfaceUserToken } from './types/DatabaseInterfaceUser.symbol'; import { DatabaseInterfaceSessionsToken } from './types/DatabaseInterfaceSessions.symbol'; diff --git a/packages/server/src/types/AccountsCoreConfig.symbol.ts b/packages/server/src/types/AccountsCoreConfig.symbol.ts index 01a2fb373..cf717dd9a 100644 --- a/packages/server/src/types/AccountsCoreConfig.symbol.ts +++ b/packages/server/src/types/AccountsCoreConfig.symbol.ts @@ -1,5 +1,5 @@ import { InjectionToken } from 'graphql-modules'; -import { AccountsServerOptions } from './accounts-server-options'; +import { type AccountsServerOptions } from './accounts-server-options'; export const AccountsCoreConfigToken = new InjectionToken( 'AccountsCoreConfig' diff --git a/packages/server/src/types/AuthenticationServices.symbol.ts b/packages/server/src/types/AuthenticationServices.symbol.ts index 234786454..817419598 100644 --- a/packages/server/src/types/AuthenticationServices.symbol.ts +++ b/packages/server/src/types/AuthenticationServices.symbol.ts @@ -1,5 +1,5 @@ import { InjectionToken } from 'graphql-modules'; -import { AuthenticationServices } from './authentication-services'; +import { type AuthenticationServices } from './authentication-services'; export const AuthenticationServicesToken = new InjectionToken( 'AuthenticationServices' diff --git a/packages/server/src/types/DatabaseInterfaceSessions.symbol.ts b/packages/server/src/types/DatabaseInterfaceSessions.symbol.ts index e9034291a..cb57455c8 100644 --- a/packages/server/src/types/DatabaseInterfaceSessions.symbol.ts +++ b/packages/server/src/types/DatabaseInterfaceSessions.symbol.ts @@ -1,4 +1,4 @@ -import { DatabaseInterfaceSessions } from '@accounts/types'; +import { type DatabaseInterfaceSessions } from '@accounts/types'; import { InjectionToken } from 'graphql-modules'; export const DatabaseInterfaceSessionsToken = new InjectionToken( diff --git a/packages/server/src/types/DatabaseInterfaceUser.symbol.ts b/packages/server/src/types/DatabaseInterfaceUser.symbol.ts index cbe8970e5..0f3742094 100644 --- a/packages/server/src/types/DatabaseInterfaceUser.symbol.ts +++ b/packages/server/src/types/DatabaseInterfaceUser.symbol.ts @@ -1,4 +1,4 @@ -import { DatabaseInterfaceUser } from '@accounts/types'; +import { type DatabaseInterfaceUser } from '@accounts/types'; import { InjectionToken } from 'graphql-modules'; export const DatabaseInterfaceUserToken = new InjectionToken( diff --git a/packages/server/src/types/accounts-server-options.ts b/packages/server/src/types/accounts-server-options.ts index 14f307c98..bf6438c7f 100644 --- a/packages/server/src/types/accounts-server-options.ts +++ b/packages/server/src/types/accounts-server-options.ts @@ -1,10 +1,10 @@ -import * as jwt from 'jsonwebtoken'; -import { User, Session } from '@accounts/types'; -import { EmailTemplatesType } from './email-templates-type'; -import { PrepareMailFunction } from './prepare-mail-function'; -import { SendMailType } from './send-mail-type'; -import { TokenCreator } from './token-creator'; -import { JwtData } from './jwt-data'; +import type * as jwt from 'jsonwebtoken'; +import { type User, type Session } from '@accounts/types'; +import { type EmailTemplatesType } from './email-templates-type'; +import { type PrepareMailFunction } from './prepare-mail-function'; +import { type SendMailType } from './send-mail-type'; +import { type TokenCreator } from './token-creator'; +import { type JwtData } from './jwt-data'; export interface AccountsServerOptions { micro?: boolean; diff --git a/packages/server/src/types/authentication-services.ts b/packages/server/src/types/authentication-services.ts index fdca19c38..9e35818fc 100644 --- a/packages/server/src/types/authentication-services.ts +++ b/packages/server/src/types/authentication-services.ts @@ -1,4 +1,4 @@ -import { AuthenticationService, User } from '@accounts/types'; +import { type AuthenticationService, type User } from '@accounts/types'; export interface AuthenticationServices { [key: string]: diff --git a/packages/server/src/types/email-template-type.ts b/packages/server/src/types/email-template-type.ts index caa4f22a0..52ac3f6d4 100644 --- a/packages/server/src/types/email-template-type.ts +++ b/packages/server/src/types/email-template-type.ts @@ -1,4 +1,4 @@ -import { User } from '@accounts/types'; +import { type User } from '@accounts/types'; export interface EmailTemplateType { from?: string; diff --git a/packages/server/src/types/email-templates-type.ts b/packages/server/src/types/email-templates-type.ts index 7a09c1efe..119430860 100644 --- a/packages/server/src/types/email-templates-type.ts +++ b/packages/server/src/types/email-templates-type.ts @@ -1,4 +1,4 @@ -import { EmailTemplateType } from './email-template-type'; +import { type EmailTemplateType } from './email-template-type'; export interface EmailTemplatesType { from: string; diff --git a/packages/server/src/types/email-type.ts b/packages/server/src/types/email-type.ts index b561ea33f..8970b14ec 100644 --- a/packages/server/src/types/email-type.ts +++ b/packages/server/src/types/email-type.ts @@ -1,3 +1,3 @@ -import { EmailTemplateType } from './email-template-type'; +import { type EmailTemplateType } from './email-template-type'; export type EmailType = EmailTemplateType & { to: string }; diff --git a/packages/server/src/types/jwt-payload.ts b/packages/server/src/types/jwt-payload.ts index 586b93e53..3724998c2 100644 --- a/packages/server/src/types/jwt-payload.ts +++ b/packages/server/src/types/jwt-payload.ts @@ -1,4 +1,4 @@ -import { JwtData } from './jwt-data'; +import { type JwtData } from './jwt-data'; export interface JwtPayload { data: JwtData; diff --git a/packages/server/src/types/prepare-mail-function.ts b/packages/server/src/types/prepare-mail-function.ts index 6533087eb..7e64d4f49 100644 --- a/packages/server/src/types/prepare-mail-function.ts +++ b/packages/server/src/types/prepare-mail-function.ts @@ -1,5 +1,5 @@ -import { User } from '@accounts/types'; -import { EmailTemplateType } from './email-template-type'; +import { type User } from '@accounts/types'; +import { type EmailTemplateType } from './email-template-type'; export type PrepareMailFunction = ( to: string, diff --git a/packages/server/src/types/token-creator.ts b/packages/server/src/types/token-creator.ts index b375f6fdc..f600f3309 100644 --- a/packages/server/src/types/token-creator.ts +++ b/packages/server/src/types/token-creator.ts @@ -1,4 +1,4 @@ -import { User } from '@accounts/types'; +import { type User } from '@accounts/types'; export interface TokenCreator { createToken(user: User): Promise; diff --git a/packages/server/src/utils/email.ts b/packages/server/src/utils/email.ts index d3f0d5e47..19cefe3c9 100644 --- a/packages/server/src/utils/email.ts +++ b/packages/server/src/utils/email.ts @@ -1,5 +1,5 @@ -import { User } from '@accounts/types'; -import { EmailTemplatesType } from '../types/email-templates-type'; +import { type User } from '@accounts/types'; +import { type EmailTemplatesType } from '../types/email-templates-type'; export const emailTemplates: EmailTemplatesType = { from: 'accounts-js ', diff --git a/packages/server/src/utils/get-first-user-email.ts b/packages/server/src/utils/get-first-user-email.ts index 79b167d6a..221752eda 100644 --- a/packages/server/src/utils/get-first-user-email.ts +++ b/packages/server/src/utils/get-first-user-email.ts @@ -1,4 +1,4 @@ -import { User } from '@accounts/types'; +import { type User } from '@accounts/types'; export function getFirstUserEmail(user: User, address: string): string { // Pick the first email if we weren't passed an email diff --git a/packages/two-factor/src/errors.ts b/packages/two-factor/src/errors.ts index fea174a03..d0d436697 100644 --- a/packages/two-factor/src/errors.ts +++ b/packages/two-factor/src/errors.ts @@ -1,4 +1,4 @@ -import { ErrorMessages } from './types'; +import { type ErrorMessages } from './types'; export const errors: ErrorMessages = { userNotFound: 'User not found', diff --git a/packages/two-factor/src/two-factor.ts b/packages/two-factor/src/two-factor.ts index aaf81b29e..cb0dfc25a 100644 --- a/packages/two-factor/src/two-factor.ts +++ b/packages/two-factor/src/two-factor.ts @@ -1,7 +1,7 @@ -import { GeneratedSecret, generateSecret, totp } from '@levminer/speakeasy'; -import { User, DatabaseInterfaceUser } from '@accounts/types'; +import { type GeneratedSecret, generateSecret, totp } from '@levminer/speakeasy'; +import { type User, type DatabaseInterfaceUser } from '@accounts/types'; import { errors } from './errors'; -import { AccountsTwoFactorOptions } from './types'; +import { type AccountsTwoFactorOptions } from './types'; import { getUserTwoFactorService } from './utils'; const defaultOptions = { diff --git a/packages/two-factor/src/types/options.ts b/packages/two-factor/src/types/options.ts index 1cfdd2eb2..ad11ad52c 100644 --- a/packages/two-factor/src/types/options.ts +++ b/packages/two-factor/src/types/options.ts @@ -1,4 +1,4 @@ -import { ErrorMessages } from './error-messages'; +import { type ErrorMessages } from './error-messages'; export interface AccountsTwoFactorOptions { /** diff --git a/packages/two-factor/src/types/two-factor-service.ts b/packages/two-factor/src/types/two-factor-service.ts index 1b30aabd2..dc8358a5b 100644 --- a/packages/two-factor/src/types/two-factor-service.ts +++ b/packages/two-factor/src/types/two-factor-service.ts @@ -1,4 +1,4 @@ -import { GeneratedSecret } from '@levminer/speakeasy'; +import { type GeneratedSecret } from '@levminer/speakeasy'; export interface TwoFactorService { secret: GeneratedSecret; diff --git a/packages/two-factor/src/utils/user.ts b/packages/two-factor/src/utils/user.ts index 8c1ef043d..18317c762 100644 --- a/packages/two-factor/src/utils/user.ts +++ b/packages/two-factor/src/utils/user.ts @@ -1,5 +1,5 @@ -import { User } from '@accounts/types'; -import { TwoFactorService } from '../types'; +import { type User } from '@accounts/types'; +import { type TwoFactorService } from '../types'; /** * Return the user two factor service object diff --git a/packages/types/src/types/authentication-service.ts b/packages/types/src/types/authentication-service.ts index c2406f32b..b7b521abe 100644 --- a/packages/types/src/types/authentication-service.ts +++ b/packages/types/src/types/authentication-service.ts @@ -1,6 +1,6 @@ -import { User } from './user'; -import { DatabaseInterfaceUser } from './user/database-interface'; -import { DatabaseInterfaceSessions } from './session/database-interface'; +import { type User } from './user'; +import { type DatabaseInterfaceUser } from './user/database-interface'; +import { type DatabaseInterfaceSessions } from './session/database-interface'; // TODO : Fix circular dependency for better type checking // import AccountsServer from '@accounts/server'; diff --git a/packages/types/src/types/context.ts b/packages/types/src/types/context.ts index 30cc961bb..a8a0308a1 100644 --- a/packages/types/src/types/context.ts +++ b/packages/types/src/types/context.ts @@ -1,5 +1,5 @@ -import { ConnectionInformations } from './connection-informations'; -import { User } from './user'; +import { type ConnectionInformations } from './connection-informations'; +import { type User } from './user'; export interface IContext { authToken?: string; diff --git a/packages/types/src/types/create-user-result.ts b/packages/types/src/types/create-user-result.ts index 0548c21c0..157ef723e 100644 --- a/packages/types/src/types/create-user-result.ts +++ b/packages/types/src/types/create-user-result.ts @@ -1,4 +1,4 @@ -import { LoginResult } from './login-result'; +import { type LoginResult } from './login-result'; export interface CreateUserResult { /** diff --git a/packages/types/src/types/database-interface.ts b/packages/types/src/types/database-interface.ts index 1d17099d2..46d28a421 100644 --- a/packages/types/src/types/database-interface.ts +++ b/packages/types/src/types/database-interface.ts @@ -1,6 +1,6 @@ -import { User } from './user'; -import { DatabaseInterfaceSessions } from './session/database-interface'; -import { DatabaseInterfaceUser } from './user/database-interface'; +import { type User } from './user'; +import { type DatabaseInterfaceSessions } from './session/database-interface'; +import { type DatabaseInterfaceUser } from './user/database-interface'; export interface DatabaseInterface extends DatabaseInterfaceSessions, diff --git a/packages/types/src/types/impersonation-result.ts b/packages/types/src/types/impersonation-result.ts index 29d857870..f0434e3f1 100644 --- a/packages/types/src/types/impersonation-result.ts +++ b/packages/types/src/types/impersonation-result.ts @@ -1,5 +1,5 @@ -import { Tokens } from './tokens'; -import { User } from './user'; +import { type Tokens } from './tokens'; +import { type User } from './user'; export interface ImpersonationUserIdentity { userId?: string; diff --git a/packages/types/src/types/login-result.ts b/packages/types/src/types/login-result.ts index 640f53498..e40ce31b8 100644 --- a/packages/types/src/types/login-result.ts +++ b/packages/types/src/types/login-result.ts @@ -1,5 +1,5 @@ -import { Tokens } from './tokens'; -import { User } from './user'; +import { type Tokens } from './tokens'; +import { type User } from './user'; export interface LoginResult { sessionId: string; diff --git a/packages/types/src/types/services/magic-link/database-interface.ts b/packages/types/src/types/services/magic-link/database-interface.ts index 38cc1ae52..a2220afb2 100644 --- a/packages/types/src/types/services/magic-link/database-interface.ts +++ b/packages/types/src/types/services/magic-link/database-interface.ts @@ -1,4 +1,4 @@ -import { User } from '../../user'; +import { type User } from '../../user'; export interface DatabaseInterfaceServiceMagicLink { findUserByLoginToken(token: string): Promise; diff --git a/packages/types/src/types/services/password/create-user.ts b/packages/types/src/types/services/password/create-user.ts index 3b4628316..a9f953883 100644 --- a/packages/types/src/types/services/password/create-user.ts +++ b/packages/types/src/types/services/password/create-user.ts @@ -1,4 +1,4 @@ -import { CreateUser } from '../../create-user'; +import { type CreateUser } from '../../create-user'; export interface CreateUserServicePassword extends CreateUser { username?: string; diff --git a/packages/types/src/types/services/password/database-interface.ts b/packages/types/src/types/services/password/database-interface.ts index f7824b038..3f134d1c4 100644 --- a/packages/types/src/types/services/password/database-interface.ts +++ b/packages/types/src/types/services/password/database-interface.ts @@ -1,5 +1,5 @@ -import { User } from '../../user'; -import { CreateUserServicePassword } from './create-user'; +import { type User } from '../../user'; +import { type CreateUserServicePassword } from './create-user'; export interface DatabaseInterfaceServicePassword { createUser(user: CreateUserServicePassword): Promise; diff --git a/packages/types/src/types/services/password/login-user.ts b/packages/types/src/types/services/password/login-user.ts index 0c88edf07..3436cd5b3 100644 --- a/packages/types/src/types/services/password/login-user.ts +++ b/packages/types/src/types/services/password/login-user.ts @@ -1,4 +1,4 @@ -import { LoginUserIdentity } from '../../login-user-identity'; +import { type LoginUserIdentity } from '../../login-user-identity'; export interface LoginUserPasswordService { user: string | LoginUserIdentity; diff --git a/packages/types/src/types/session/database-interface.ts b/packages/types/src/types/session/database-interface.ts index f9ffa4306..9164bfcb5 100644 --- a/packages/types/src/types/session/database-interface.ts +++ b/packages/types/src/types/session/database-interface.ts @@ -1,5 +1,5 @@ -import { Session } from './session'; -import { ConnectionInformations } from '../connection-informations'; +import { type Session } from './session'; +import { type ConnectionInformations } from '../connection-informations'; export interface DatabaseInterfaceSessions { findSessionById(sessionId: string): Promise; diff --git a/packages/types/src/types/user.ts b/packages/types/src/types/user.ts index 106d2098d..3594120b7 100644 --- a/packages/types/src/types/user.ts +++ b/packages/types/src/types/user.ts @@ -1,4 +1,4 @@ -import { EmailRecord } from './email-record'; +import { type EmailRecord } from './email-record'; export interface User { username?: string; diff --git a/packages/types/src/types/user/database-interface.ts b/packages/types/src/types/user/database-interface.ts index 8075f7d8a..1c297115b 100644 --- a/packages/types/src/types/user/database-interface.ts +++ b/packages/types/src/types/user/database-interface.ts @@ -1,6 +1,6 @@ -import { User } from '../user'; -import { DatabaseInterfaceServicePassword } from '../services/password/database-interface'; -import { DatabaseInterfaceServiceMagicLink } from '../services/magic-link/database-interface'; +import { type User } from '../user'; +import { type DatabaseInterfaceServicePassword } from '../services/password/database-interface'; +import { type DatabaseInterfaceServiceMagicLink } from '../services/magic-link/database-interface'; export interface DatabaseInterfaceUser extends DatabaseInterfaceServicePassword,