Skip to content

Commit

Permalink
docs: update docs and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p committed Dec 6, 2022
1 parent 4d59aa3 commit 4fcc9be
Show file tree
Hide file tree
Showing 71 changed files with 10,561 additions and 982 deletions.
49 changes: 5 additions & 44 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ decorators approach to increase the DX and full typings support for easier devel
* [Omit](#omit)
* [Starters](#starters)
* [Internal modules (Optional)](#internal-modules-optional)
* [Monitoring](#monitoring)
* [Monitoring ](#monitoring-)
* [Multi-tenancy (one app multiple DB - Experimental)](#multi-tenancy-one-app-multiple-db---experimental)
* [Cli migrate command](#cli-migrate-command)
* [Resources](#resources)
Expand Down Expand Up @@ -122,7 +122,7 @@ Depending on your situation, pick the right getting started section.

In that case, you must already have scaffold a new medusa store project. If that's not the case you can [follow the tutorial here](https://docs.medusajs.com/quickstart/quick-start).

Run the following command in your terminal (The last version is 1.7.6)
Run the following command in your terminal (The last version is 1.7.7)

```bash
npm install medusa-extender
Expand Down Expand Up @@ -1076,50 +1076,11 @@ will be provided.
> internal module.

[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/cloudy.png)](#monitoring)
[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/cloudy.png)](#monitoring-)

## Monitoring
## Monitoring

If you want to monitor whats going on on your app, you must specify the config
in your `medusa-config` file.

Here are the expected config

```typescript
interface MonitoringOptions {
version?: string;
hostname?: string;
ip?: string;
timelineBucketDuration?: number;
swaggerSpec?: string | OpenAPI.Document;
uriPath: string;
durationBuckets?: number[];
requestSizeBuckets?: number[];
responseSizeBuckets?: number[];
apdexThreshold?: number;
onResponseFinish?: (req: Request, res: Response, next: NextFunction) => void | Promise<void>;
authentication?: boolean;
sessionMaxAge?: number;
elasticsearch?: string;
onAuthenticate?: (req: Request, username: string, password: string) => boolean | Promise<boolean>;
}
```

so your `medusa-config.js` will looks like

```typescript
const config = {
/* ... */
monitoring: {
uriPath: '/monitoring'
},
/* ... */
};
```

Now, run your app and go to `/monitoring` url to get access to your dashboard.

For more information about the configuration, you can have a look at the [documentation](https://swaggerstats.io/guide/conf.html#options)
> Deprecated in favor of (medusa-plugin-prometheus)[https://github.com/adrien2p/medusa-plugins/tree/main/packages/medusa-plugin-prometheus]
:point_right: __Here is a demo video__

Expand Down
16 changes: 7 additions & 9 deletions docs/classes/Medusa.Medusa-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

[Medusa](../modules/Medusa.md).Medusa

Load medusa and apply all components

## Table of contents

### Constructors
Expand All @@ -31,12 +29,12 @@ Load medusa and apply all components

| Name | Type | Description |
| :------ | :------ | :------ |
| `rootDir` | `string` | Directory where the `medusa-config` is located |
| `express` | `Express` | Express instance |
| `rootDir` | `string` | |
| `express` | `Express` | |

#### Defined in

[src/Medusa.ts:39](https://github.com/adrien2p/medusa-extender/blob/ba60811/src/Medusa.ts#L39)
[Medusa.ts:38](https://github.com/adrien2p/medusa-extender/blob/4d59aa3/src/Medusa.ts#L38)

## Properties

Expand All @@ -46,7 +44,7 @@ Load medusa and apply all components

#### Defined in

[src/Medusa.ts:32](https://github.com/adrien2p/medusa-extender/blob/ba60811/src/Medusa.ts#L32)
[Medusa.ts:31](https://github.com/adrien2p/medusa-extender/blob/4d59aa3/src/Medusa.ts#L31)

___

Expand All @@ -56,7 +54,7 @@ ___

#### Defined in

[src/Medusa.ts:33](https://github.com/adrien2p/medusa-extender/blob/ba60811/src/Medusa.ts#L33)
[Medusa.ts:32](https://github.com/adrien2p/medusa-extender/blob/4d59aa3/src/Medusa.ts#L32)

## Methods

Expand All @@ -68,12 +66,12 @@ ___

| Name | Type | Description |
| :------ | :------ | :------ |
| `modules` | [`Type`](../interfaces/core_types.Type.md)<`unknown`\>[] | The modules to load into medusa |
| `modules` | [`Type`](../interfaces/core_types.Type.md)<`unknown`\>[] | |

#### Returns

`Promise`<[`MedusaContainer`](../modules/core_types.md#medusacontainer)\>

#### Defined in

[src/Medusa.ts:47](https://github.com/adrien2p/medusa-extender/blob/ba60811/src/Medusa.ts#L47)
[Medusa.ts:46](https://github.com/adrien2p/medusa-extender/blob/4d59aa3/src/Medusa.ts#L46)
24 changes: 4 additions & 20 deletions docs/classes/core_componentMap.ComponentMap.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,13 @@
| :------ | :------ |
| `entries?` | readonly readonly [[`InjectableComponentTypes`](../modules/core_types.md#injectablecomponenttypes), [`GetInjectableOptions`](../modules/core_types.md#getinjectableoptions)<[`InjectableComponentTypes`](../modules/core_types.md#injectablecomponenttypes)\>][] |

#### Inherited from

Map<InjectableComponentTypes, GetInjectableOptions\>.constructor

#### Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:33

**new ComponentMap**(`iterable?`)

#### Parameters

| Name | Type |
| :------ | :------ |
| `iterable?` | `Iterable`<readonly [[`InjectableComponentTypes`](../modules/core_types.md#injectablecomponenttypes), [`GetInjectableOptions`](../modules/core_types.md#getinjectableoptions)<[`InjectableComponentTypes`](../modules/core_types.md#injectablecomponenttypes)\>]\> |

#### Inherited from
#### Overrides

Map<InjectableComponentTypes, GetInjectableOptions\>.constructor
Map&lt;InjectableComponentTypes, GetInjectableOptions\&gt;.constructor

#### Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:161
[core/componentMap.ts:4](https://github.com/adrien2p/medusa-extender/blob/4d59aa3/src/core/componentMap.ts#L4)

## Methods

Expand Down Expand Up @@ -84,4 +68,4 @@ Map.get

#### Defined in

[src/core/componentMap.ts:4](https://github.com/adrien2p/medusa-extender/blob/ba60811/src/core/componentMap.ts#L4)
[core/componentMap.ts:16](https://github.com/adrien2p/medusa-extender/blob/4d59aa3/src/core/componentMap.ts#L16)
32 changes: 11 additions & 21 deletions docs/classes/core_event_emmiter.Internals.CustomEventEmitter.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

[core/event-emmiter](../modules/core_event_emmiter.md).[Internals](../modules/core_event_emmiter.Internals.md).CustomEventEmitter

Extended event emitter to register methods that must be call when certain events are triggered and relay the handling to the API package

## Hierarchy

- `EventEmitter`
Expand Down Expand Up @@ -40,7 +38,7 @@ EventEmitter.constructor

#### Defined in

[src/core/event-emmiter.ts:24](https://github.com/adrien2p/medusa-extender/blob/ba60811/src/core/event-emmiter.ts#L24)
[core/event-emmiter.ts:24](https://github.com/adrien2p/medusa-extender/blob/4d59aa3/src/core/event-emmiter.ts#L24)

## Properties

Expand All @@ -50,16 +48,14 @@ EventEmitter.constructor

#### Defined in

[src/core/event-emmiter.ts:22](https://github.com/adrien2p/medusa-extender/blob/ba60811/src/core/event-emmiter.ts#L22)
[core/event-emmiter.ts:22](https://github.com/adrien2p/medusa-extender/blob/4d59aa3/src/core/event-emmiter.ts#L22)

## Methods

### emitAsync

**emitAsync**<`T`\>(`eventName`, `values`): `Promise`<`T`\>

Emit an asynchrone event entity based and wait for the result.

#### Type parameters

| Name |
Expand All @@ -70,25 +66,23 @@ Emit an asynchrone event entity based and wait for the result.

| Name | Type | Description |
| :------ | :------ | :------ |
| `eventName` | `string` \| `symbol` | The event that must be triggered |
| `values` | `Record`<`string`, `unknown`\> | The data that are passed to the event handler |
| `eventName` | `string` \| `symbol` | |
| `values` | `Record`<`string`, `unknown`\> | |

#### Returns

`Promise`<`T`\>

#### Defined in

[src/core/event-emmiter.ts:94](https://github.com/adrien2p/medusa-extender/blob/ba60811/src/core/event-emmiter.ts#L94)
[core/event-emmiter.ts:94](https://github.com/adrien2p/medusa-extender/blob/4d59aa3/src/core/event-emmiter.ts#L94)

___

### register

**register**<`T`\>(`eventName`, `propertyName`, `metatype`): `void`

Register a new event handler.

#### Type parameters

| Name |
Expand All @@ -99,38 +93,34 @@ Register a new event handler.

| Name | Type | Description |
| :------ | :------ | :------ |
| `eventName` | `string` \| `symbol` | The name of the event that has to be triggered |
| `propertyName` | `string` | The name of the class property that will handle the event |
| `metatype` | [`Type`](../interfaces/core_types.Type.md)<`T`\> | The object that contains the property above |
| `eventName` | `string` \| `symbol` | |
| `propertyName` | `string` | |
| `metatype` | [`Type`](../interfaces/core_types.Type.md)<`T`\> | |

#### Returns

`void`

#### Defined in

[src/core/event-emmiter.ts:34](https://github.com/adrien2p/medusa-extender/blob/ba60811/src/core/event-emmiter.ts#L34)
[core/event-emmiter.ts:34](https://github.com/adrien2p/medusa-extender/blob/4d59aa3/src/core/event-emmiter.ts#L34)

___

### registerListeners

**registerListeners**(`container`): `void`

Apply all event handlers hold by the `listenerDescriptors`.
Only unregister and register again non singleton based event listeners.
No duplicate listener can exist on one handler.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `container` | `AwilixContainer` | The IoC container that allow to resolve instance |
| `container` | `AwilixContainer`<`any`\> | |

#### Returns

`void`

#### Defined in

[src/core/event-emmiter.ts:47](https://github.com/adrien2p/medusa-extender/blob/ba60811/src/core/event-emmiter.ts#L47)
[core/event-emmiter.ts:47](https://github.com/adrien2p/medusa-extender/blob/4d59aa3/src/core/event-emmiter.ts#L47)
Loading

0 comments on commit 4fcc9be

Please sign in to comment.