-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Hide repository creation if they are not custom + add upsert s…
…upport by default (#6127)
- Loading branch information
Showing
124 changed files
with
1,522 additions
and
2,565 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@medusajs/utils": patch | ||
"@medusajs/types": patch | ||
"@medusajs/product": patch | ||
"@medusajs/pricing": patch | ||
--- | ||
|
||
chore: Hide repository creation if they are not custom + add upsert support by default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
import { moduleDefinition } from "./module-definition" | ||
import { Modules } from "@medusajs/modules-sdk" | ||
import * as Models from "@models" | ||
import { ModulesSdkUtils } from "@medusajs/utils" | ||
|
||
export default moduleDefinition | ||
|
||
const migrationScriptOptions = { | ||
moduleName: Modules.AUTHENTICATION, | ||
models: Models, | ||
pathToMigrations: __dirname + "/migrations", | ||
} | ||
|
||
export const runMigrations = ModulesSdkUtils.buildMigrationScript( | ||
migrationScriptOptions | ||
) | ||
export const revertMigration = ModulesSdkUtils.buildRevertMigrationScript( | ||
migrationScriptOptions | ||
) | ||
|
||
export * from "./initialize" | ||
export * from "./loaders" | ||
export * from "./scripts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,10 @@ | ||
import * as defaultRepositories from "@repositories" | ||
import * as defaultServices from "@services" | ||
|
||
import { LoaderOptions } from "@medusajs/modules-sdk" | ||
import { ModulesSdkTypes } from "@medusajs/types" | ||
import { loadCustomRepositories } from "@medusajs/utils" | ||
import { asClass } from "awilix" | ||
|
||
export default async ({ | ||
container, | ||
options, | ||
}: LoaderOptions< | ||
| ModulesSdkTypes.ModuleServiceInitializeOptions | ||
| ModulesSdkTypes.ModuleServiceInitializeCustomDataLayerOptions | ||
>): Promise<void> => { | ||
const customRepositories = ( | ||
options as ModulesSdkTypes.ModuleServiceInitializeCustomDataLayerOptions | ||
)?.repositories | ||
|
||
container.register({ | ||
authUserService: asClass(defaultServices.AuthUserService).singleton(), | ||
authProviderService: asClass( | ||
defaultServices.AuthProviderService | ||
).singleton(), | ||
}) | ||
|
||
if (customRepositories) { | ||
loadCustomRepositories({ | ||
defaultRepositories, | ||
customRepositories, | ||
container, | ||
}) | ||
} else { | ||
loadDefaultRepositories({ container }) | ||
} | ||
} | ||
|
||
function loadDefaultRepositories({ container }) { | ||
container.register({ | ||
baseRepository: asClass(defaultRepositories.BaseRepository).singleton(), | ||
authUserRepository: asClass( | ||
defaultRepositories.AuthUserRepository | ||
).singleton(), | ||
authProviderRepository: asClass( | ||
defaultRepositories.AuthProviderRepository | ||
).singleton(), | ||
}) | ||
} | ||
import { ModulesSdkUtils } from "@medusajs/utils" | ||
import * as ModuleModels from "@models" | ||
import * as ModuleRepositories from "@repositories" | ||
import * as ModuleServices from "@services" | ||
|
||
export default ModulesSdkUtils.moduleContainerLoaderFactory({ | ||
moduleModels: ModuleModels, | ||
moduleRepositories: ModuleRepositories, | ||
moduleServices: ModuleServices, | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
export { MikroOrmBaseRepository as BaseRepository } from "@medusajs/utils" | ||
export { AuthProviderRepository } from "./auth-provider" | ||
export { AuthUserRepository } from "./auth-user" |
8 changes: 0 additions & 8 deletions
8
packages/authentication/src/scripts/bin/run-migration-down.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,28 @@ | ||
import { AuthProvider, AuthUser } from "@models" | ||
import { CreateAuthProviderDTO, UpdateAuthProviderDTO } from "./auth-provider" | ||
import { DAL } from "@medusajs/types" | ||
import { CreateAuthUserDTO, UpdateAuthUserDTO } from "./auth-user" | ||
|
||
export * from "./auth-user" | ||
export * from "./auth-provider" | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface IAuthProviderRepository< | ||
TEntity extends AuthProvider = AuthProvider | ||
> extends DAL.RepositoryService< | ||
TEntity, | ||
{ | ||
create: CreateAuthProviderDTO | ||
update: UpdateAuthProviderDTO | ||
} | ||
> {} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface IAuthUserRepository<TEntity extends AuthUser = AuthUser> | ||
extends DAL.RepositoryService< | ||
TEntity, | ||
{ | ||
create: CreateAuthUserDTO | ||
update: UpdateAuthUserDTO | ||
} | ||
> {} |
Oops, something went wrong.