adding doc generation

This commit is contained in:
koudo
2022-01-08 00:46:01 +01:00
parent adbd632db0
commit e157d5848d
21 changed files with 644 additions and 54 deletions
+1
View File
@@ -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.
+5
View File
@@ -0,0 +1,5 @@
phantom-exo / [Modules](modules.md)
# Marmiton Search
this phantom aim to search in the [marmiton](https://www.marmiton.org) website
+14
View File
@@ -0,0 +1,14 @@
[phantom-exo](README.md) / Modules
# phantom-exo
## Table of contents
### Modules
- [marmiton/parsing](modules/marmiton_parsing.md)
- [marmiton/phantom](modules/marmiton_phantom.md)
- [marmiton/search](modules/marmiton_search.md)
- [marmiton/types](modules/marmiton_types.md)
- [marmiton/validate](modules/marmiton_validate.md)
- [utils/browser](modules/utils_browser.md)
+34
View File
@@ -0,0 +1,34 @@
[phantom-exo](../README.md) / [Modules](../modules.md) / marmiton/parsing
# Module: marmiton/parsing
## Table of contents
### Functions
- [scrapResultFromLink](marmiton_parsing.md#scrapresultfromlink)
## Functions
### scrapResultFromLink
`Const` **scrapResultFromLink**(`links`, `urlStart`): { `commentCount`: `number` ; `name`: `string` ; `score`: `number` ; `url`: `string` }[]
function that extract content from DOM links into the marmiton search page
#### Parameters
| Name | Type | Description |
| :--------- | :---------- | :--------------------------------------------------------- |
| `links` | `Element`[] | scrapped <a> dom elements representing recipes in marmiton |
| `urlStart` | `string` | url to prefix recipes links |
#### Returns
{ `commentCount`: `number` ; `name`: `string` ; `score`: `number` ; `url`: `string` }[]
name, link, comments and score of recipes
#### Defined in
marmiton/parsing.ts:7
+25
View File
@@ -0,0 +1,25 @@
[phantom-exo](../README.md) / [Modules](../modules.md) / marmiton/phantom
# Module: marmiton/phantom
## Table of contents
### Functions
- [marmitonPhantom](marmiton_phantom.md#marmitonphantom)
## Functions
### marmitonPhantom
`Const` **marmitonPhantom**(): `Promise`<`never`\>
main function to launch from phantom
#### Returns
`Promise`<`never`\>
#### Defined in
marmiton/phantom.ts:8
+34
View File
@@ -0,0 +1,34 @@
[phantom-exo](../README.md) / [Modules](../modules.md) / marmiton/search
# Module: marmiton/search
## Table of contents
### Functions
- [search](marmiton_search.md#search)
## Functions
### search
`Const` **search**(`search`, `opts?`): `Promise`<{ `commentCount`: `number` ; `name`: `string` ; `score`: `number` ; `url`: `string` }[]\>
function to scrap in the search response on marmiton website
#### Parameters
| Name | Type | Description |
| :------- | :------------------------------------------------- | :----------------------------------- |
| `search` | `string` | words to search into marmiton search |
| `opts?` | [`SearchOptions`](marmiton_types.md#searchoptions) | option to filter results |
#### Returns
`Promise`<{ `commentCount`: `number` ; `name`: `string` ; `score`: `number` ; `url`: `string` }[]\>
marmiton search result
#### Defined in
marmiton/search.ts:32
+83
View File
@@ -0,0 +1,83 @@
[phantom-exo](../README.md) / [Modules](../modules.md) / marmiton/types
# Module: marmiton/types
## Table of contents
### Type aliases
- [MarmitonSearchInput](marmiton_types.md#marmitonsearchinput)
- [MarmitonSearchOutput](marmiton_types.md#marmitonsearchoutput)
- [MarmitonSearchResult](marmiton_types.md#marmitonsearchresult)
- [SearchDishType](marmiton_types.md#searchdishtype)
- [SearchOptions](marmiton_types.md#searchoptions)
- [SearchRecipeType](marmiton_types.md#searchrecipetype)
## Type aliases
### MarmitonSearchInput
Ƭ **MarmitonSearchInput**: `Object`
#### Type declaration
| Name | Type |
| :------ | :--------------------------------------------------------------------------------------------------------------------- |
| `dt?` | [`SearchDishType`](marmiton_types.md#searchdishtype) \| [`SearchDishType`](marmiton_types.md#searchdishtype)[] |
| `page?` | `number` |
| `query` | `string` |
| `type?` | [`SearchRecipeType`](marmiton_types.md#searchrecipetype) \| [`SearchRecipeType`](marmiton_types.md#searchrecipetype)[] |
#### Defined in
marmiton/types.d.ts:23
---
### MarmitonSearchOutput
Ƭ **MarmitonSearchOutput**: { `commentCount`: `number` ; `name`: `string` ; `score`: `number` ; `url`: `string` }[]
#### Defined in
marmiton/types.d.ts:1
---
### MarmitonSearchResult
Ƭ **MarmitonSearchResult**: [`MarmitonSearchOutput`](marmiton_types.md#marmitonsearchoutput)[`number`]
#### Defined in
marmiton/types.d.ts:8
---
### SearchDishType
Ƭ **SearchDishType**: `"entree"` \| `"platprincipal"` \| `"dessert"` \| `"amusegueule"` \| `"accompagnement"` \| `"sauce"` \| `"boisson"` \| `"confiserie"` \| `"conseil"`
#### Defined in
marmiton/types.d.ts:12
---
### SearchOptions
Ƭ **SearchOptions**: `Omit`<[`MarmitonSearchInput`](marmiton_types.md#marmitonsearchinput), `"query"`\>
#### Defined in
marmiton/types.d.ts:30
---
### SearchRecipeType
Ƭ **SearchRecipeType**: `"season"` \| `"recipe"`
#### Defined in
marmiton/types.d.ts:10
+47
View File
@@ -0,0 +1,47 @@
[phantom-exo](../README.md) / [Modules](../modules.md) / marmiton/validate
# Module: marmiton/validate
## Table of contents
### Variables
- [jsonSchema](marmiton_validate.md#jsonschema)
### Functions
- [validateMarmitonSearchInput](marmiton_validate.md#validatemarmitonsearchinput)
## Variables
### jsonSchema
**jsonSchema**: `any`
#### Defined in
marmiton/validate.ts:3
## Functions
### validateMarmitonSearchInput
**validateMarmitonSearchInput**(`value`): value is MarmitonSearchInput
validate value against json schema defined into input.json file
#### Parameters
| Name | Type | Description |
| :------ | :-------- | :------------- |
| `value` | `unknown` | value to check |
#### Returns
value is MarmitonSearchInput
true if value is valid false otherwise
#### Defined in
marmiton/validate.ts:12
+100
View File
@@ -0,0 +1,100 @@
[phantom-exo](../README.md) / [Modules](../modules.md) / utils/browser
# Module: utils/browser
## Table of contents
### Functions
- [optionsToUrlParams](utils_browser.md#optionstourlparams)
- [withBrowserOpened](utils_browser.md#withbrowseropened)
- [withPageOpened](utils_browser.md#withpageopened)
## Functions
### optionsToUrlParams
`Const` **optionsToUrlParams**<`T`, `V`\>(`opts`, `whitelist`): `string`
transform object to url parameters
array will write multiple time the same argument name
#### Type parameters
| Name | Type |
| :--- | :--------------------------------------- |
| `T` | `T` |
| `V` | extends `string` \| `number` \| `symbol` |
#### Parameters
| Name | Type | Description |
| :---------- | :---- | :----------------------- |
| `opts` | `T` | object to transform |
| `whitelist` | `V`[] | key to write from object |
#### Returns
`string`
#### Defined in
utils/browser.ts:50
---
### withBrowserOpened
`Const` **withBrowserOpened**<`T`\>(`func`): `Promise`<`T`\>
open a browser with puppeteer and call the parameter function within it
the browser will be closed after func execution
#### Type parameters
| Name |
| :--- |
| `T` |
#### Parameters
| Name | Type | Description |
| :----- | :---------------------------------------- | :------------------------------------------------------------------ |
| `func` | (`browser`: `Browser`) => `Promise`<`T`\> | function to execute after opening the browser and before closing it |
#### Returns
`Promise`<`T`\>
#### Defined in
utils/browser.ts:9
---
### withPageOpened
`Const` **withPageOpened**<`T`\>(`func`): `Promise`<`T`\>
open a page with puppeteer and call the parameter function within it
the page will be closed after func execution
#### Type parameters
| Name |
| :--- |
| `T` |
#### Parameters
| Name | Type | Description |
| :----- | :---------------------------------- | :------------------------------------------------------------- |
| `func` | (`page`: `Page`) => `Promise`<`T`\> | function to execute after opening a page and before closing it |
#### Returns
`Promise`<`T`\>
#### Defined in
utils/browser.ts:29