Skip to content

Commit

Permalink
feat(fstab): mount points can now be objects and contain a fallback p…
Browse files Browse the repository at this point in the history
…arameter

fixes #305
  • Loading branch information
trieloff committed Jun 3, 2020
1 parent 98ae9b2 commit a187b24
Show file tree
Hide file tree
Showing 20 changed files with 317 additions and 27 deletions.
66 changes: 66 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ match zero, one or many dom nodes in the given node to test.</p>
<dl>
<dt><a href="#ResolveFn">ResolveFn(left, right)</a></dt>
<dd></dd>
<dt><a href="#cleanURL">cleanURL(m, ...specialparams)</a> ⇒ <code>object</code></dt>
<dd><p>Cleans up the URL by removing parameters that are deemed special. These
special parameters will be returned in the return object instead.</p>
</dd>
<dt><a href="#nextTick">nextTick()</a> ⇒ <code>promise</code></dt>
<dd><p>Await the next tick;</p>
<p>NOTE: Internally this uses setImmediate, not process.nextTick.
Expand Down Expand Up @@ -223,6 +227,10 @@ whitespace prefix length (number of space 0x20 characters
at the start of the line). This prefix is simply removed
from each line...</p>
</dd>
<dt><a href="#lookupBackendResponses">lookupBackendResponses(status)</a> ⇒ <code>Object</code></dt>
<dd><p>A glorified lookup table that translates backend errors into the appropriate
HTTP status codes and log levels for your service.</p>
</dd>
</dl>

<a name="BaseConfig"></a>
Expand All @@ -232,6 +240,8 @@ from each line...</p>

* [BaseConfig](#BaseConfig)
* [new BaseConfig(name)](#new_BaseConfig_new)
* [.withCache(options)](#BaseConfig+withCache)
* [.withRepo(owner, repo, ref, options)](#BaseConfig+withRepo)
* [.saveConfig()](#BaseConfig+saveConfig) ⇒ <code>Promise.&lt;void&gt;</code>

<a name="new_BaseConfig_new"></a>
Expand All @@ -242,6 +252,34 @@ from each line...</p>
| --- | --- | --- |
| name | <code>string</code> | name of the config file, e.g. `helix-config.yaml` |

<a name="BaseConfig+withCache"></a>

### baseConfig.withCache(options)
Reset the cache with a new cache size

**Kind**: instance method of [<code>BaseConfig</code>](#BaseConfig)

| Param | Type | Description |
| --- | --- | --- |
| options | <code>object</code> | cache options |
| options.maxSize | <code>integer</code> | |

<a name="BaseConfig+withRepo"></a>

### baseConfig.withRepo(owner, repo, ref, options)
Set the base repository to fetch a config from

**Kind**: instance method of [<code>BaseConfig</code>](#BaseConfig)

| Param | Type | Description |
| --- | --- | --- |
| owner | <code>string</code> | username or org |
| repo | <code>string</code> | repository |
| ref | <code>string</code> | ref name |
| options | <code>object</code> | options |
| options.headers | <code>object</code> | headers to be used for HTTP request |
| options.headers.authorization | <code>string</code> | authorization token to include |

<a name="BaseConfig+saveConfig"></a>

### baseConfig.saveConfig() ⇒ <code>Promise.&lt;void&gt;</code>
Expand Down Expand Up @@ -771,6 +809,21 @@ match zero, one or many dom nodes in the given node to test.
| left | [<code>Strain</code>](#Strain) | the current candidate strain (can be undefined) |
| right | [<code>Strain</code>](#Strain) | the alternative candidate strain (can be undefined) |

<a name="cleanURL"></a>

## cleanURL(m, ...specialparams) ⇒ <code>object</code>
Cleans up the URL by removing parameters that are deemed special. These
special parameters will be returned in the return object instead.

**Kind**: global function
**Returns**: <code>object</code> - an object with a clean URL and extracted parameters

| Param | Type | Description |
| --- | --- | --- |
| m | <code>object</code> | the mount point |
| m.url | <code>string</code> | mount point URL |
| ...specialparams | <code>string</code> | list of special parameters that should be removed from the URL and returned in the object |

<a name="nextTick"></a>

## nextTick() ⇒ <code>promise</code>
Expand Down Expand Up @@ -992,3 +1045,16 @@ at the start of the line). This prefix is simply removed
from each line...

**Kind**: global function
<a name="lookupBackendResponses"></a>

## lookupBackendResponses(status) ⇒ <code>Object</code>
A glorified lookup table that translates backend errors into the appropriate
HTTP status codes and log levels for your service.

**Kind**: global function
**Returns**: <code>Object</code> - a pair of status code to return and log level to use in your code

| Param | Type | Description |
| --- | --- | --- |
| status | <code>int</code> | the HTTP status code you've been getting from the backend |

4 changes: 3 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@
- [Runtime Strain](./strains-definitions-anystrain-oneof-runtime-strain.md "A runtime strain is a combination of code and content that enables the creation of a digital experience")`https://ns.adobe.com/helix/shared/runtimestrain#/definitions/anystrain/oneOf/1`
- [Single-Value Property](./property-oneof-single-value-property.md "The property in an index")`https://ns.adobe.com/helix/shared/property#/oneOf/0`
- [Single-Value Property](./property-oneof-single-value-property.md "The property in an index")`https://ns.adobe.com/helix/shared/property#/oneOf/0`
- [Untitled object in Configuration](./config-properties-definitions.md "A container for referencable objects that can be re-used elsewhere in the configuration")`https://ns.adobe.com/helix/shared/config#/properties/definitions`
- [Untitled object in Configuration](./markupconfig-properties-definitions.md "A container for referencable objects that can be re-used elsewhere in the configuration")`https://ns.adobe.com/helix/shared/markupconfig#/properties/definitions`
- [Untitled object in Configuration](./config-properties-definitions.md "A container for referencable objects that can be re-used elsewhere in the configuration")`https://ns.adobe.com/helix/shared/config#/properties/definitions`
- [Untitled object in FSTab (Mount Points)](./fstab-properties-mountpoints.md)`https://ns.adobe.com/helix/shared/fstab#/properties/mountpoints`
- [Untitled object in Index Configuration](./indexconfig-properties-indices.md)`https://ns.adobe.com/helix/shared/indexconfig#/properties/indices`
- [Untitled object in Markup Mapping](./markupmapping-properties-attribute.md "create new attributes for each key value pair below this property")`https://ns.adobe.com/helix/shared/markupmapping#/properties/attribute`
- [Untitled object in Markup Mapping](./markupmapping-properties-attribute.md "create new attributes for each key value pair below this property")`https://ns.adobe.com/helix/shared/markupmapping#/properties/attribute`
- [Untitled object in Mount Point](./mountpoint-oneof-1.md)`https://ns.adobe.com/helix/shared/mountpoint#/oneOf/1`
- [Untitled object in Mount Point](./mountpoint-oneof-1.md)`https://ns.adobe.com/helix/shared/mountpoint#/oneOf/1`
- [Vanity URL extractor](./redirects-properties-vanity-url-extractor.md "Configure one or multiple vanity URL extractors, each extractor is a property of this object")`https://ns.adobe.com/helix/shared/redirects#/properties/vanity`
- [Vanity URL mapping](./redirects-properties-vanity-url-extractor-vanity-url-mapping.md)`https://ns.adobe.com/helix/shared/vanity#/properties/vanity/additionalProperties`

Expand Down
16 changes: 16 additions & 0 deletions docs/fstab-properties-mountpoints-default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Untitled undefined type in FSTab (Mount Points) Schema

```txt
https://ns.adobe.com/helix/shared/fstab#/properties/mountpoints/default
```




| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
| :------------------ | ---------- | -------------- | ----------------------- | :---------------- | --------------------- | ------------------- | --------------------------------------------------------------- |
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [fstab.schema.json\*](fstab.schema.json "open original schema") |

## default Type

unknown
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ Defines the target URL where content should be retrieved from.

## ]$ Type

`string` ([Mount Point](fstab-properties-mountpoints-patternproperties-mount-point.md))
merged type ([Mount Point](fstab-properties-mountpoints-patternproperties-mount-point.md))

## ]$ Constraints
one (and only one) of

**URI**: the string must be a URI, according to [RFC 3986](https://tools.ietf.org/html/rfc4291 "check the specification")
- [Untitled string in Mount Point](mountpoint-oneof-0.md "check type definition")
- [Untitled object in Mount Point](mountpoint-oneof-1.md "check type definition")
23 changes: 16 additions & 7 deletions docs/fstab-properties-mountpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,19 @@ https://ns.adobe.com/helix/shared/fstab#/properties/mountpoints

`object` ([Details](fstab-properties-mountpoints.md))

## mountpoints Default Value

The default value is:

```json
{}
```

# undefined Properties

| Property | Type | Required | Nullable | Defined by |
| :---------- | -------- | -------- | -------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `^/.*[^/]$` | `string` | Optional | cannot be null | [FSTab (Mount Points)](fstab-properties-mountpoints-patternproperties-mount-point.md "https&#x3A;//ns.adobe.com/helix/shared/mountpoint#/properties/mountpoints/patternProperties/^/.\*\[^/]$") |
| Property | Type | Required | Nullable | Defined by |
| :---------- | ------ | -------- | -------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `^/.*[^/]$` | Merged | Optional | cannot be null | [FSTab (Mount Points)](fstab-properties-mountpoints-patternproperties-mount-point.md "https&#x3A;//ns.adobe.com/helix/shared/mountpoint#/properties/mountpoints/patternProperties/^/.\*\[^/]$") |

## Pattern: `^/.*[^/]$`

Expand All @@ -29,14 +37,15 @@ Defines the target URL where content should be retrieved from.
`^/.*[^/]$`

- is optional
- Type: `string` ([Mount Point](fstab-properties-mountpoints-patternproperties-mount-point.md))
- Type: merged type ([Mount Point](fstab-properties-mountpoints-patternproperties-mount-point.md))
- cannot be null
- defined in: [FSTab (Mount Points)](fstab-properties-mountpoints-patternproperties-mount-point.md "https&#x3A;//ns.adobe.com/helix/shared/mountpoint#/properties/mountpoints/patternProperties/^/.\*\[^/]$")

### ]$ Type

`string` ([Mount Point](fstab-properties-mountpoints-patternproperties-mount-point.md))
merged type ([Mount Point](fstab-properties-mountpoints-patternproperties-mount-point.md))

### ]$ Constraints
one (and only one) of

**URI**: the string must be a URI, according to [RFC 3986](https://tools.ietf.org/html/rfc4291 "check the specification")
- [Untitled string in Mount Point](mountpoint-oneof-0.md "check type definition")
- [Untitled object in Mount Point](mountpoint-oneof-1.md "check type definition")
8 changes: 8 additions & 0 deletions docs/fstab.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,11 @@ mountpoints:
### mountpoints Type

`object` ([Details](fstab-properties-mountpoints.md))

### mountpoints Default Value

The default value is:

```json
{}
```
2 changes: 1 addition & 1 deletion docs/fstab.schema.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"meta:license":["Copyright 2019 Adobe. All rights reserved.","This file is licensed to you under the Apache License, Version 2.0 (the \"License\");","you may not use this file except in compliance with the License. You may obtain a copy","of the License at http://www.apache.org/licenses/LICENSE-2.0","","Unless required by applicable law or agreed to in writing, software distributed under","the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS","OF ANY KIND, either express or implied. See the License for the specific language","governing permissions and limitations under the License."],"$id":"https://ns.adobe.com/helix/shared/fstab","$schema":"http://json-schema.org/draft-07/schema#","type":"object","title":"FSTab (Mount Points)","description":"Defines a mapping between mount points and source URLs. Mount points **must** start with a slash (`/`) but may not end with one.\n\nThis configuration can typically be found in the `helix-fstab.yaml` file.\n\nThe name and format are inspired by the [UNIX file system table](https://en.wikipedia.org/wiki/Fstab).","properties":{"mountpoints":{"type":"object","patternProperties":{"^/.*[^/]$":{"$ref":"https://ns.adobe.com/helix/shared/mountpoint"}}}},"additionalProperties":false,"required":["mountpoints"],"examples":[{"mountpoints":{"/ms/docs":"https://adobe.sharepoint.com/sites/docs","/ms":"https://adobe.sharepoint.com/sites/TheBlog/Shared%20Documents/theblog","/gd":"https://drive.google.com/drive/u/0/folders/123456789","/foo":"https://localhost:4502"}}]}
{"meta:license":["Copyright 2019 Adobe. All rights reserved.","This file is licensed to you under the Apache License, Version 2.0 (the \"License\");","you may not use this file except in compliance with the License. You may obtain a copy","of the License at http://www.apache.org/licenses/LICENSE-2.0","","Unless required by applicable law or agreed to in writing, software distributed under","the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS","OF ANY KIND, either express or implied. See the License for the specific language","governing permissions and limitations under the License."],"$id":"https://ns.adobe.com/helix/shared/fstab","$schema":"http://json-schema.org/draft-07/schema#","type":"object","title":"FSTab (Mount Points)","description":"Defines a mapping between mount points and source URLs. Mount points **must** start with a slash (`/`) but may not end with one.\n\nThis configuration can typically be found in the `helix-fstab.yaml` file.\n\nThe name and format are inspired by the [UNIX file system table](https://en.wikipedia.org/wiki/Fstab).","properties":{"mountpoints":{"type":"object","default":{},"patternProperties":{"^/.*[^/]$":{"$ref":"https://ns.adobe.com/helix/shared/mountpoint"}}}},"additionalProperties":false,"required":["mountpoints"],"examples":[{"mountpoints":{"/ms/docs":"https://adobe.sharepoint.com/sites/docs","/ms":"https://adobe.sharepoint.com/sites/TheBlog/Shared%20Documents/theblog","/gd":"https://drive.google.com/drive/u/0/folders/123456789","/foo":"https://localhost:4502"}}]}
20 changes: 20 additions & 0 deletions docs/mountpoint-oneof-0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Untitled string in Mount Point Schema

```txt
https://ns.adobe.com/helix/shared/mountpoint#/oneOf/0
```




| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
| :------------------ | ---------- | -------------- | ----------------------- | :---------------- | --------------------- | ------------------- | ------------------------------------------------------------------------- |
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [mountpoint.schema.json\*](mountpoint.schema.json "open original schema") |

## 0 Type

`string`

## 0 Constraints

**URI**: the string must be a URI, according to [RFC 3986](https://tools.ietf.org/html/rfc4291 "check the specification")
16 changes: 16 additions & 0 deletions docs/mountpoint-oneof-1-properties-fallback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Untitled string in Mount Point Schema

```txt
https://ns.adobe.com/helix/shared/mountpoint#/oneOf/1/properties/fallback
```

Specifies the fallback path if the requested item cannot be found


| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
| :------------------ | ---------- | -------------- | ----------------------- | :---------------- | --------------------- | ------------------- | ------------------------------------------------------------------------- |
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [mountpoint.schema.json\*](mountpoint.schema.json "open original schema") |

## fallback Type

`string`
20 changes: 20 additions & 0 deletions docs/mountpoint-oneof-1-properties-url.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Untitled string in Mount Point Schema

```txt
https://ns.adobe.com/helix/shared/mountpoint#/oneOf/1/properties/url
```




| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
| :------------------ | ---------- | -------------- | ----------------------- | :---------------- | --------------------- | ------------------- | ------------------------------------------------------------------------- |
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [mountpoint.schema.json\*](mountpoint.schema.json "open original schema") |

## url Type

`string`

## url Constraints

**URI**: the string must be a URI, according to [RFC 3986](https://tools.ietf.org/html/rfc4291 "check the specification")
16 changes: 16 additions & 0 deletions docs/mountpoint-oneof-1-properties.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Untitled undefined type in Mount Point Schema

```txt
https://ns.adobe.com/helix/shared/mountpoint#/oneOf/1/properties
```




| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
| :------------------ | ---------- | -------------- | ----------------------- | :---------------- | --------------------- | ------------------- | ------------------------------------------------------------------------- |
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [mountpoint.schema.json\*](mountpoint.schema.json "open original schema") |

## properties Type

unknown
Loading

0 comments on commit a187b24

Please sign in to comment.