forked from medusajs/medusa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add Services reference (medusajs#1548)
- Loading branch information
1 parent
6c1a722
commit c87ddd7
Showing
52 changed files
with
14,489 additions
and
16 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,43 @@ | ||
name: Generate References | ||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
paths: | ||
- packages/medusa/src/services/** | ||
jobs: | ||
services: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/cancel-workflow-action@0.9.1 | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2.3.5 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v2.4.1 | ||
with: | ||
node-version: "14" | ||
cache: "yarn" | ||
|
||
- name: Bootstrap packages | ||
uses: ./.github/actions/cache-bootstrap | ||
with: | ||
extension: unit-tests | ||
|
||
- name: Build Packages | ||
run: yarn build | ||
|
||
- name: Generate Services Reference | ||
run: yarn generate:services | ||
|
||
- uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Automatically Generated Services Reference | ||
file_pattern: docs/content/* | ||
skip_dirty_check: false |
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,5 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
yarn-path ".yarn/releases/yarn-1.19.0.cjs" |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. |
136 changes: 136 additions & 0 deletions
136
docs/content/references/services/classes/AuthService.md
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,136 @@ | ||
# Class: AuthService | ||
|
||
Can authenticate a user based on email password combination | ||
|
||
## Hierarchy | ||
|
||
- `"medusa-interfaces"` | ||
|
||
↳ **`AuthService`** | ||
|
||
## Constructors | ||
|
||
### constructor | ||
|
||
• **new AuthService**(`__namedParameters`) | ||
|
||
#### Parameters | ||
|
||
| Name | Type | | ||
| :------ | :------ | | ||
| `__namedParameters` | `Object` | | ||
|
||
#### Overrides | ||
|
||
BaseService.constructor | ||
|
||
#### Defined in | ||
|
||
[services/auth.ts:12](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/auth.ts#L12) | ||
|
||
## Methods | ||
|
||
### authenticate | ||
|
||
▸ **authenticate**(`email`, `password`): `Promise`<`AuthenticateResult`\> | ||
|
||
Authenticates a given user based on an email, password combination. Uses | ||
scrypt to match password with hashed value. | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| :------ | :------ | :------ | | ||
| `email` | `string` | the email of the user | | ||
| `password` | `string` | the password of the user | | ||
|
||
#### Returns | ||
|
||
`Promise`<`AuthenticateResult`\> | ||
|
||
success: whether authentication succeeded | ||
user: the user document if authentication succeded | ||
error: a string with the error message | ||
|
||
#### Defined in | ||
|
||
[services/auth.ts:78](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/auth.ts#L78) | ||
|
||
___ | ||
|
||
### authenticateAPIToken | ||
|
||
▸ **authenticateAPIToken**(`token`): `Promise`<`AuthenticateResult`\> | ||
|
||
Authenticates a given user with an API token | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| :------ | :------ | :------ | | ||
| `token` | `string` | the api_token of the user to authenticate | | ||
|
||
#### Returns | ||
|
||
`Promise`<`AuthenticateResult`\> | ||
|
||
success: whether authentication succeeded | ||
user: the user document if authentication succeded | ||
error: a string with the error message | ||
|
||
#### Defined in | ||
|
||
[services/auth.ts:41](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/auth.ts#L41) | ||
|
||
___ | ||
|
||
### authenticateCustomer | ||
|
||
▸ **authenticateCustomer**(`email`, `password`): `Promise`<`AuthenticateResult`\> | ||
|
||
Authenticates a customer based on an email, password combination. Uses | ||
scrypt to match password with hashed value. | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| :------ | :------ | :------ | | ||
| `email` | `string` | the email of the user | | ||
| `password` | `string` | the password of the user | | ||
|
||
#### Returns | ||
|
||
`Promise`<`AuthenticateResult`\> | ||
|
||
success: whether authentication succeeded | ||
user: the user document if authentication succeded | ||
error: a string with the error message | ||
|
||
#### Defined in | ||
|
||
[services/auth.ts:123](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/auth.ts#L123) | ||
|
||
___ | ||
|
||
### comparePassword\_ | ||
|
||
▸ **comparePassword_**(`password`, `hash`): `Promise`<`boolean`\> | ||
|
||
Verifies if a password is valid given the provided password hash | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Description | | ||
| :------ | :------ | :------ | | ||
| `password` | `string` | the raw password to check | | ||
| `hash` | `string` | the hash to compare against | | ||
|
||
#### Returns | ||
|
||
`Promise`<`boolean`\> | ||
|
||
the result of the comparison | ||
|
||
#### Defined in | ||
|
||
[services/auth.ts:28](https://github.com/medusajs/medusa/blob/2d3e404f/packages/medusa/src/services/auth.ts#L28) |
Oops, something went wrong.