UNPKG

apiconnect-project

Version:

Configuration module IBM API Connect Developer Toolkit

86 lines (64 loc) 2.85 kB
## Functions <dl> <dt><a href="#inspectPath">inspectPath([options])</a><code>PathInfo</code></dt> <dd><p>Returns information about the file or directory being loaded.</p> <p>Sync function</p> </dd> <dt><a href="#loadProject">loadProject(basePath, [options])</a></dt> <dd><p>Given a file or directory path, return all {Artifact} found in that path. If the path is a known project, uses project local <code>artifacts</code> configuration to try to resolve product/swagger information.</p> </dd> </dl> ## Typedefs <dl> <dt><a href="#Artifact">Artifact</a> : <code>object</code></dt> <dd></dd> <dt><a href="#Artifacts">Artifacts</a> : <code><a href="#Artifact">Array.&lt;Artifact&gt;</a></code></dt> <dd></dd> </dl> <a name="inspectPath"></a> ## inspectPath([options]) ⇒ <code>PathInfo</code> Returns information about the file or directory being loaded. Sync function **Kind**: global function **Returns**: <code>PathInfo</code> - file/project information. **Throws**: - Will throw an error if path is not a file or directory. | Param | Type | Description | | --- | --- | --- | | searchPath. | <code>string</code> | | | [options] | <code>object</code> | options. | | [options.incNodeProjects] | <code>boolean</code> | allow non-loopback node projects. | <a name="loadProject"></a> ## loadProject(basePath, [options]) ⇒ Given a file or directory path, return all {Artifact} found in that path. If the path is a known project, uses project local `artifacts` configuration to try to resolve product/swagger information. **Kind**: global function **Returns**: Promise.<Artifacts> **Throws**: - Will throw an error if path is not a file or directory. | Param | Type | Description | | --- | --- | --- | | basePath | <code>string</code> | Path to file or directory. | | [options] | <code>Object</code> | options | | [options.resovleExternalApiRefs] | <code>boolean</code> | If true $refs will be expanded. If $ref is invalid an error will be set into returned <Artifact>.err. | <a name="Artifact"></a> ## Artifact : <code>object</code> **Kind**: global typedef **Properties** | Name | Type | Description | | --- | --- | --- | | type | <code>string</code> | `product` or `swagger`. | | filePath | <code>string</code> | Resolved path to product or swagger file. | | name | <code>string</code> | | | version | <code>string</code> | | | mtime | <code>Date</code> | Time when filePath was last modified. | | raw | <code>string</code> | contents of filePath | | refs | <code>[Artifacts](#Artifacts)</code> | if( type===product ) and referenced product.apis[$ref] exist. Those will also be loaded | | err | <code>Error</code> | optional Error | | data | <code>object</code> | js-yaml parsed raw content | <a name="Artifacts"></a> ## Artifacts : <code>[Array.&lt;Artifact&gt;](#Artifact)</code> **Kind**: global typedef