Skip to content

Commit

Permalink
chore: generated tsdocs (medusajs#6352)
Browse files Browse the repository at this point in the history
Generated TSDocs for the past release.

Note: I haven't updated examples as the examples are for modules without a public reference yet, so the examples can wait.
  • Loading branch information
shahednasser authored Feb 23, 2024
1 parent 788c4a1 commit c86e27b
Show file tree
Hide file tree
Showing 27 changed files with 3,768 additions and 47 deletions.
94 changes: 94 additions & 0 deletions packages/types/src/auth/common/auth-user.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,128 @@
import { BaseFilterable } from "../../dal"

/**
* @interface
*
* The auth user details.
*/
export type AuthUserDTO = {
/**
* The ID of the auth user.
*/
id: string

/**
* The provider of the auth user.
*/
provider: string

/**
* The associated providers entity's ID.
*/
entity_id: string

/**
* The scope of the auth user.
*/
scope: string

/**
* The provider metadata of the auth user.
*/
provider_metadata?: Record<string, unknown>

/**
* The user metadata of the auth user.
*/
user_metadata: Record<string, unknown>

/**
* The app metadata of the auth user.
*/
app_metadata: Record<string, unknown>
}

/**
* @interface
*
* The auth user to be created.
*/
export type CreateAuthUserDTO = {
/**
* The ID of the auth user.
*/
id?: string

/**
* The provider of the auth user.
*/
provider: string

/**
* The associated entity's ID.
*/
entity_id: string

/**
* The scope of the auth user.
*/
scope: string

/**
* The provider metadata of the auth user.
*/
provider_metadata?: Record<string, unknown>

/**
* The user metadata of the auth user.
*/
user_metadata?: Record<string, unknown>

/**
* The app metadata of the auth user.
*/
app_metadata?: Record<string, unknown>
}

/**
* @interface
*
* The attributes to update in the auth user.
*/
export type UpdateAuthUserDTO = {
/**
* The ID of the auth user.
*/
id: string

/**
* The provider metadata of the auth user.
*/
provider_metadata?: Record<string, unknown>

/**
* The user metadata of the auth user.
*/
user_metadata?: Record<string, unknown>

/**
* The app metadata of the auth user.
*/
app_metadata?: Record<string, unknown>
}

/**
* The filters to apply on the retrieved auth user.
*/
export interface FilterableAuthUserProps
extends BaseFilterable<FilterableAuthUserProps> {
/**
* The IDs to filter the auth user by.
*/
id?: string[]

/**
* Filter the auth auth user by the associated provider(s).
*/
provider?: string[] | string
}
66 changes: 66 additions & 0 deletions packages/types/src/auth/common/provider.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,88 @@
/**
* @interface
*
* The details of the authentication response.
*/
export type AuthenticationResponse = {
/**
* Whether the authentication was successful.
*/
success: boolean

/**
* The authenticated user's details. The details shape
* depends on the used provider ID.
*/
authUser?: any

/**
* The error message, if an error occurs.
*/
error?: string

/**
* Redirect location. Location takes precedence over success.
*/
location?: string
}

/**
* @interface
*
* Provider configuration for the Medusa auth module.
*/
export type AuthModuleProviderConfig = {
/**
* Provider name
*/
name: string

/**
* Scope configurations for the provider
*/
scopes: Record<string, AuthProviderScope>
}

/**
* @interface
*
* Configuration of a single provider scope
*/
export type AuthProviderScope = Record<string, unknown>

/**
* @interface
*
* Input for authentication and callback validation methods.
*/
export type AuthenticationInput = {
/**
* url of incoming authentication request.
*/
url: string

/**
* Headers of incoming authentication request.
*/
headers: Record<string, string>

/**
* Query params of incoming authentication request.
*/
query: Record<string, string>

/**
* Body of incoming authentication request.
*/
body: Record<string, string>

/**
* Scope for authentication request.
*/
authScope: string

/**
* Protocol of incoming authentication request (For example, `https`).
*/
protocol: string
}
Loading

0 comments on commit c86e27b

Please sign in to comment.