Skip to content

Commit 8f60474

Browse files
committed
Fix build
1 parent 507d35b commit 8f60474

File tree

2 files changed

+107
-2
lines changed

2 files changed

+107
-2
lines changed
Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,111 @@
11
---
22
title: Node.js module
3-
weight: 3
3+
weight: 1
44
---
55

66
# Node.js module
7+
8+
As a Node module dependency, the engine exposes a JavaScript API that can be called in your own code.
9+
10+
<!-- markdownlint-disable -->
11+
12+
#### Classes
13+
14+
* [Record](#Record)
15+
* [`new Record()`](#new_Record_new)
16+
17+
#### Constants
18+
19+
* [`router`](#router)
20+
21+
#### Functions
22+
23+
* [`extract(sourceDocument)`](#extract) ⇒ <code>Promise.&lt;string&gt;</code>
24+
* [`fetch(params)`](#fetch) ⇒ <code>Promise</code>
25+
* ~~[`normalizeConfig()`](#normalizeConfig)~~
26+
27+
---
28+
29+
<a name="Record"></a>
30+
31+
#### Record
32+
**Kind**: global class
33+
<a name="new_Record_new"></a>
34+
35+
##### `new Record()`
36+
Abstract Class Record.
37+
38+
<a name="router"></a>
39+
40+
#### `router`
41+
**Kind**: global constant
42+
**Swagger**: tags:
43+
name: Versions
44+
description: Versions API
45+
components:
46+
schemas:
47+
Version:
48+
type: object
49+
description: Version content and metadata
50+
properties:
51+
fetchDate:
52+
type: string
53+
format: date-time
54+
description: The ISO 8601 datetime string when the version was recorded.
55+
id:
56+
type: string
57+
description: The ID of the version.
58+
content:
59+
type: string
60+
description: The JSON-escaped Markdown content of the version.
61+
<a name="extract"></a>
62+
63+
#### `extract(sourceDocument)` ⇒ <code>Promise.&lt;string&gt;</code>
64+
Extract content from source document and convert it to Markdown
65+
66+
**Kind**: global function
67+
**Returns**: <code>Promise.&lt;string&gt;</code> - Promise which is fulfilled once the content is extracted and converted in Markdown. The promise will resolve into a string containing the extracted content in Markdown format
68+
69+
| Param | Type | Description |
70+
| --- | --- | --- |
71+
| sourceDocument | <code>string</code> | Source document from which to extract content, see [./src/archivist/services/sourceDocument.js](./src/archivist/services/sourceDocument.js) |
72+
73+
<a name="fetch"></a>
74+
75+
#### `fetch(params)` ⇒ <code>Promise</code>
76+
Fetch a resource from the network, returning a promise which is fulfilled once the response is available
77+
78+
**Kind**: global function
79+
**Returns**: <code>Promise</code> - @returns {Promise<Object>} Promise which will be resolved with an object containing the `mimeType` and the `content` of the URL as string or Buffer
80+
81+
| Param | Type | Description |
82+
| --- | --- | --- |
83+
| params | <code>Object</code> | Fetcher parameters |
84+
| params.url | <code>string</code> | URL of the resource you want to fetch |
85+
| [params.executeClientScripts] | <code>boolean</code> | Enable execution of client scripts. When set to `true`, this property loads the page in a headless browser to load all assets and execute client scripts before returning its content |
86+
| [params.cssSelectors] | <code>string</code> \| <code>Array</code> | List of CSS selectors to await when loading the resource in a headless browser. Can be a CSS selector or an array of CSS selectors. Only relevant when `executeClientScripts` is enabled |
87+
| [params.config] | <code>Object</code> | Fetcher configuration |
88+
| [params.config.navigationTimeout] | <code>number</code> | Maximum time (in milliseconds) to wait before considering the fetch failed |
89+
| [params.config.language] | <code>string</code> | Language (in [ISO 639-1 format](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)) to be passed in request headers |
90+
| [params.config.waitForElementsTimeout] | <code>number</code> | Maximum time (in milliseconds) to wait for selectors to exist on page before considering the fetch failed. Only relevant when `executeClientScripts` is enabled |
91+
92+
<a name="normalizeConfig"></a>
93+
94+
#### ~~`normalizeConfig()`~~
95+
***Deprecated***
96+
97+
Support for legacy config format where reporter configuration was nested under `githubIssues`
98+
Example:
99+
100+
```json
101+
{
102+
"githubIssues": {
103+
"repositories": {
104+
"declarations": "OpenTermsArchive/sandbox-declarations"
105+
}
106+
}
107+
}
108+
```
109+
110+
**Kind**: global function
111+
<!-- markdownlint-enable -->

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"lint:css": "stylelint \"themes/opentermsarchive/assets/css/*.css\"",
2222
"lint:js": "eslint themes/opentermsarchive/assets/js/",
2323
"start:dev": "npm run jsdoc && hugo serve --watch --logLevel debug --disableFastRender --ignoreCache",
24-
"jsdoc": "jsdoc2md --files './node_modules/@opentermsarchive/engine/src/**/*.js' --template scripts/jsdoc/template/node.hbs -g grouped --name-format -d 4 > content/api/node.md"
24+
"jsdoc": "jsdoc2md --files './node_modules/@opentermsarchive/engine/src/**/*.js' --template scripts/jsdoc/template/node.hbs -g grouped --name-format -d 4 > content/reference/programmatic-access/node-module.md"
2525
},
2626
"devDependencies": {
2727
"eslint": "^8.31.0",

0 commit comments

Comments
 (0)