1
0
Fork 0

feat: add issue, label sync stubs, remote options to config, flatten resolver inputs

This commit is contained in:
ssube 2020-08-11 20:39:53 -05:00
parent 7af3f35baf
commit 0d341587e2
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
47 changed files with 895 additions and 15 deletions

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [FlagLabel](./cautious-journey.flaglabel.md)
## FlagLabel interface
Individual labels: the equivalent of a checkbox.
<b>Signature:</b>
```typescript
export interface FlagLabel extends BaseLabel, LabelSet
```
<b>Extends:</b> BaseLabel, LabelSet

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GithubRemote](./cautious-journey.githubremote.md) &gt; [createComment](./cautious-journey.githubremote.createcomment.md)
## GithubRemote.createComment() method
<b>Signature:</b>
```typescript
createComment(): Promise<void>;
```
<b>Returns:</b>
Promise&lt;void&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GithubRemote](./cautious-journey.githubremote.md) &gt; [createLabel](./cautious-journey.githubremote.createlabel.md)
## GithubRemote.createLabel() method
<b>Signature:</b>
```typescript
createLabel(): Promise<LabelUpdate>;
```
<b>Returns:</b>
Promise&lt;LabelUpdate&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GithubRemote](./cautious-journey.githubremote.md) &gt; [deleteLabel](./cautious-journey.githubremote.deletelabel.md)
## GithubRemote.deleteLabel() method
<b>Signature:</b>
```typescript
deleteLabel(): Promise<LabelUpdate>;
```
<b>Returns:</b>
Promise&lt;LabelUpdate&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GithubRemote](./cautious-journey.githubremote.md) &gt; [getIssue](./cautious-journey.githubremote.getissue.md)
## GithubRemote.getIssue() method
<b>Signature:</b>
```typescript
getIssue(): Promise<Array<IssueUpdate>>;
```
<b>Returns:</b>
Promise&lt;Array&lt;IssueUpdate&gt;&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GithubRemote](./cautious-journey.githubremote.md) &gt; [getLabel](./cautious-journey.githubremote.getlabel.md)
## GithubRemote.getLabel() method
<b>Signature:</b>
```typescript
getLabel(): Promise<Array<LabelUpdate>>;
```
<b>Returns:</b>
Promise&lt;Array&lt;LabelUpdate&gt;&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GithubRemote](./cautious-journey.githubremote.md) &gt; [listIssues](./cautious-journey.githubremote.listissues.md)
## GithubRemote.listIssues() method
<b>Signature:</b>
```typescript
listIssues(): Promise<Array<IssueUpdate>>;
```
<b>Returns:</b>
Promise&lt;Array&lt;IssueUpdate&gt;&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GithubRemote](./cautious-journey.githubremote.md) &gt; [listLabels](./cautious-journey.githubremote.listlabels.md)
## GithubRemote.listLabels() method
<b>Signature:</b>
```typescript
listLabels(): Promise<Array<LabelUpdate>>;
```
<b>Returns:</b>
Promise&lt;Array&lt;LabelUpdate&gt;&gt;

View File

@ -0,0 +1,29 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GithubRemote](./cautious-journey.githubremote.md)
## GithubRemote class
Github/Octokit API implementation of the `Remote` contract.
<b>Signature:</b>
```typescript
export declare class GithubRemote implements Remote
```
<b>Implements:</b> [Remote](./cautious-journey.remote.md)
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [createComment()](./cautious-journey.githubremote.createcomment.md) | | |
| [createLabel()](./cautious-journey.githubremote.createlabel.md) | | |
| [deleteLabel()](./cautious-journey.githubremote.deletelabel.md) | | |
| [getIssue()](./cautious-journey.githubremote.getissue.md) | | |
| [getLabel()](./cautious-journey.githubremote.getlabel.md) | | |
| [listIssues()](./cautious-journey.githubremote.listissues.md) | | |
| [listLabels()](./cautious-journey.githubremote.listlabels.md) | | |
| [updateIssue()](./cautious-journey.githubremote.updateissue.md) | | |
| [updateLabel()](./cautious-journey.githubremote.updatelabel.md) | | |

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GithubRemote](./cautious-journey.githubremote.md) &gt; [updateIssue](./cautious-journey.githubremote.updateissue.md)
## GithubRemote.updateIssue() method
<b>Signature:</b>
```typescript
updateIssue(): Promise<IssueUpdate>;
```
<b>Returns:</b>
Promise&lt;IssueUpdate&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GithubRemote](./cautious-journey.githubremote.md) &gt; [updateLabel](./cautious-journey.githubremote.updatelabel.md)
## GithubRemote.updateLabel() method
<b>Signature:</b>
```typescript
updateLabel(): Promise<LabelUpdate>;
```
<b>Returns:</b>
Promise&lt;LabelUpdate&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GitlabRemote](./cautious-journey.gitlabremote.md) &gt; [createComment](./cautious-journey.gitlabremote.createcomment.md)
## GitlabRemote.createComment() method
<b>Signature:</b>
```typescript
createComment(): Promise<void>;
```
<b>Returns:</b>
Promise&lt;void&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GitlabRemote](./cautious-journey.gitlabremote.md) &gt; [createLabel](./cautious-journey.gitlabremote.createlabel.md)
## GitlabRemote.createLabel() method
<b>Signature:</b>
```typescript
createLabel(): Promise<LabelUpdate>;
```
<b>Returns:</b>
Promise&lt;LabelUpdate&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GitlabRemote](./cautious-journey.gitlabremote.md) &gt; [deleteLabel](./cautious-journey.gitlabremote.deletelabel.md)
## GitlabRemote.deleteLabel() method
<b>Signature:</b>
```typescript
deleteLabel(): Promise<LabelUpdate>;
```
<b>Returns:</b>
Promise&lt;LabelUpdate&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GitlabRemote](./cautious-journey.gitlabremote.md) &gt; [getIssue](./cautious-journey.gitlabremote.getissue.md)
## GitlabRemote.getIssue() method
<b>Signature:</b>
```typescript
getIssue(): Promise<Array<IssueUpdate>>;
```
<b>Returns:</b>
Promise&lt;Array&lt;IssueUpdate&gt;&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GitlabRemote](./cautious-journey.gitlabremote.md) &gt; [getLabel](./cautious-journey.gitlabremote.getlabel.md)
## GitlabRemote.getLabel() method
<b>Signature:</b>
```typescript
getLabel(): Promise<Array<LabelUpdate>>;
```
<b>Returns:</b>
Promise&lt;Array&lt;LabelUpdate&gt;&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GitlabRemote](./cautious-journey.gitlabremote.md) &gt; [listIssues](./cautious-journey.gitlabremote.listissues.md)
## GitlabRemote.listIssues() method
<b>Signature:</b>
```typescript
listIssues(): Promise<Array<IssueUpdate>>;
```
<b>Returns:</b>
Promise&lt;Array&lt;IssueUpdate&gt;&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GitlabRemote](./cautious-journey.gitlabremote.md) &gt; [listLabels](./cautious-journey.gitlabremote.listlabels.md)
## GitlabRemote.listLabels() method
<b>Signature:</b>
```typescript
listLabels(): Promise<Array<LabelUpdate>>;
```
<b>Returns:</b>
Promise&lt;Array&lt;LabelUpdate&gt;&gt;

View File

@ -0,0 +1,29 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GitlabRemote](./cautious-journey.gitlabremote.md)
## GitlabRemote class
Gitlab API implementation of the `Remote` contract.
<b>Signature:</b>
```typescript
export declare class GitlabRemote implements Remote
```
<b>Implements:</b> [Remote](./cautious-journey.remote.md)
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [createComment()](./cautious-journey.gitlabremote.createcomment.md) | | |
| [createLabel()](./cautious-journey.gitlabremote.createlabel.md) | | |
| [deleteLabel()](./cautious-journey.gitlabremote.deletelabel.md) | | |
| [getIssue()](./cautious-journey.gitlabremote.getissue.md) | | |
| [getLabel()](./cautious-journey.gitlabremote.getlabel.md) | | |
| [listIssues()](./cautious-journey.gitlabremote.listissues.md) | | |
| [listLabels()](./cautious-journey.gitlabremote.listlabels.md) | | |
| [updateIssue()](./cautious-journey.gitlabremote.updateissue.md) | | |
| [updateLabel()](./cautious-journey.gitlabremote.updatelabel.md) | | |

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GitlabRemote](./cautious-journey.gitlabremote.md) &gt; [updateIssue](./cautious-journey.gitlabremote.updateissue.md)
## GitlabRemote.updateIssue() method
<b>Signature:</b>
```typescript
updateIssue(): Promise<IssueUpdate>;
```
<b>Returns:</b>
Promise&lt;IssueUpdate&gt;

View File

@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GitlabRemote](./cautious-journey.gitlabremote.md) &gt; [updateLabel](./cautious-journey.gitlabremote.updatelabel.md)
## GitlabRemote.updateLabel() method
<b>Signature:</b>
```typescript
updateLabel(): Promise<LabelUpdate>;
```
<b>Returns:</b>
Promise&lt;LabelUpdate&gt;

View File

@ -4,9 +4,27 @@
## cautious-journey package
## Classes
| Class | Description |
| --- | --- |
| [GithubRemote](./cautious-journey.githubremote.md) | Github/Octokit API implementation of the <code>Remote</code> contract. |
| [GitlabRemote](./cautious-journey.gitlabremote.md) | Gitlab API implementation of the <code>Remote</code> contract. |
## Functions
| Function | Description |
| --- | --- |
| [resolveLabels(options)](./cautious-journey.resolvelabels.md) | |
| [syncIssues(options)](./cautious-journey.syncissues.md) | |
| [syncLabels(options)](./cautious-journey.synclabels.md) | |
## Interfaces
| Interface | Description |
| --- | --- |
| [FlagLabel](./cautious-journey.flaglabel.md) | Individual labels: the equivalent of a checkbox. |
| [Remote](./cautious-journey.remote.md) | Basic functions which every remote API must provide. |
| [RemoteOptions](./cautious-journey.remoteoptions.md) | |
| [StateLabel](./cautious-journey.statelabel.md) | Grouped labels: the equivalent of a radio group. |

View File

@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [Remote](./cautious-journey.remote.md) &gt; [createComment](./cautious-journey.remote.createcomment.md)
## Remote.createComment() method
Add a comment to an issue (for attribution and auditing).
<b>Signature:</b>
```typescript
createComment(options: CommentUpdate): Promise<unknown>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | CommentUpdate | |
<b>Returns:</b>
Promise&lt;unknown&gt;

View File

@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [Remote](./cautious-journey.remote.md) &gt; [createLabel](./cautious-journey.remote.createlabel.md)
## Remote.createLabel() method
Create a new label.
<b>Signature:</b>
```typescript
createLabel(options: LabelQuery): Promise<LabelUpdate>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | LabelQuery | |
<b>Returns:</b>
Promise&lt;LabelUpdate&gt;

View File

@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [Remote](./cautious-journey.remote.md) &gt; [deleteLabel](./cautious-journey.remote.deletelabel.md)
## Remote.deleteLabel() method
Delete an existing label.
<b>Signature:</b>
```typescript
deleteLabel(options: LabelQuery): Promise<LabelUpdate>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | LabelQuery | |
<b>Returns:</b>
Promise&lt;LabelUpdate&gt;

View File

@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [Remote](./cautious-journey.remote.md) &gt; [getIssue](./cautious-journey.remote.getissue.md)
## Remote.getIssue() method
Get details of a single issue.
<b>Signature:</b>
```typescript
getIssue(options: IssueQuery): Promise<Array<IssueUpdate>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | IssueQuery | |
<b>Returns:</b>
Promise&lt;Array&lt;IssueUpdate&gt;&gt;

View File

@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [Remote](./cautious-journey.remote.md) &gt; [getLabel](./cautious-journey.remote.getlabel.md)
## Remote.getLabel() method
Get details of a single label.
<b>Signature:</b>
```typescript
getLabel(options: LabelQuery): Promise<Array<LabelUpdate>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | LabelQuery | |
<b>Returns:</b>
Promise&lt;Array&lt;LabelUpdate&gt;&gt;

View File

@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [Remote](./cautious-journey.remote.md) &gt; [listIssues](./cautious-journey.remote.listissues.md)
## Remote.listIssues() method
List all issues.
<b>Signature:</b>
```typescript
listIssues(): Promise<Array<IssueUpdate>>;
```
<b>Returns:</b>
Promise&lt;Array&lt;IssueUpdate&gt;&gt;

View File

@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [Remote](./cautious-journey.remote.md) &gt; [listLabels](./cautious-journey.remote.listlabels.md)
## Remote.listLabels() method
List all labels.
<b>Signature:</b>
```typescript
listLabels(): Promise<Array<LabelUpdate>>;
```
<b>Returns:</b>
Promise&lt;Array&lt;LabelUpdate&gt;&gt;

View File

@ -0,0 +1,28 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [Remote](./cautious-journey.remote.md)
## Remote interface
Basic functions which every remote API must provide.
<b>Signature:</b>
```typescript
export interface Remote
```
## Methods
| Method | Description |
| --- | --- |
| [createComment(options)](./cautious-journey.remote.createcomment.md) | Add a comment to an issue (for attribution and auditing). |
| [createLabel(options)](./cautious-journey.remote.createlabel.md) | Create a new label. |
| [deleteLabel(options)](./cautious-journey.remote.deletelabel.md) | Delete an existing label. |
| [getIssue(options)](./cautious-journey.remote.getissue.md) | Get details of a single issue. |
| [getLabel(options)](./cautious-journey.remote.getlabel.md) | Get details of a single label. |
| [listIssues()](./cautious-journey.remote.listissues.md) | List all issues. |
| [listLabels()](./cautious-journey.remote.listlabels.md) | List all labels. |
| [updateIssue(options)](./cautious-journey.remote.updateissue.md) | Update an issue.<!-- -->Only labels will be modified. |
| [updateLabel(options)](./cautious-journey.remote.updatelabel.md) | Update a label. |

View File

@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [Remote](./cautious-journey.remote.md) &gt; [updateIssue](./cautious-journey.remote.updateissue.md)
## Remote.updateIssue() method
Update an issue.
Only labels will be modified.
<b>Signature:</b>
```typescript
updateIssue(options: IssueUpdate): Promise<IssueUpdate>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | IssueUpdate | |
<b>Returns:</b>
Promise&lt;IssueUpdate&gt;

View File

@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [Remote](./cautious-journey.remote.md) &gt; [updateLabel](./cautious-journey.remote.updatelabel.md)
## Remote.updateLabel() method
Update a label.
<b>Signature:</b>
```typescript
updateLabel(options: LabelUpdate): Promise<LabelUpdate>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | LabelUpdate | |
<b>Returns:</b>
Promise&lt;LabelUpdate&gt;

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [RemoteOptions](./cautious-journey.remoteoptions.md) &gt; [data](./cautious-journey.remoteoptions.data.md)
## RemoteOptions.data property
<b>Signature:</b>
```typescript
data: Record<string, string>;
```

View File

@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [RemoteOptions](./cautious-journey.remoteoptions.md)
## RemoteOptions interface
<b>Signature:</b>
```typescript
export interface RemoteOptions
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [data](./cautious-journey.remoteoptions.data.md) | Record&lt;string, string&gt; | |
| [type](./cautious-journey.remoteoptions.type.md) | string | |

View File

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [RemoteOptions](./cautious-journey.remoteoptions.md) &gt; [type](./cautious-journey.remoteoptions.type.md)
## RemoteOptions.type property
<b>Signature:</b>
```typescript
type: string;
```

View File

@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [StateLabel](./cautious-journey.statelabel.md)
## StateLabel interface
Grouped labels: the equivalent of a radio group.
<b>Signature:</b>
```typescript
export interface StateLabel extends BaseLabel, LabelSet
```
<b>Extends:</b> BaseLabel, LabelSet
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [values](./cautious-journey.statelabel.values.md) | Array&lt;StateValue&gt; | Values for this state. |

View File

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [StateLabel](./cautious-journey.statelabel.md) &gt; [values](./cautious-journey.statelabel.values.md)
## StateLabel.values property
Values for this state.
<b>Signature:</b>
```typescript
values: Array<StateValue>;
```

View File

@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [syncIssues](./cautious-journey.syncissues.md)
## syncIssues() function
<b>Signature:</b>
```typescript
export declare function syncIssues(options: SyncOptions): Promise<unknown>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | SyncOptions | |
<b>Returns:</b>
Promise&lt;unknown&gt;

View File

@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [syncLabels](./cautious-journey.synclabels.md)
## syncLabels() function
<b>Signature:</b>
```typescript
export declare function syncLabels(options: SyncOptions): Promise<unknown>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | SyncOptions | |
<b>Returns:</b>
Promise&lt;unknown&gt;

View File

@ -43,6 +43,7 @@
"eslint-plugin-no-null": "1.0.2",
"eslint-plugin-sonarjs": "0.5.0",
"esm": "^3.2.25",
"husky": "^4.2.5",
"jsdom": "^16.3.0",
"jsdom-global": "^3.0.2",
"lodash": "^4.17.19",
@ -81,5 +82,10 @@
"tslint-sonarts": "1.9.0",
"typescript": "3.9.7",
"yargs-parser": "^18.1.3"
},
"husky": {
"hooks": {
"pre-commit": "make ci"
}
}
}

View File

@ -1,4 +1,5 @@
import { FlagLabel, StateLabel } from './labels';
import { RemoteOptions } from './remote';
/**
* Config data for the app, loaded from CLI or DOM.
@ -14,6 +15,11 @@ export interface ConfigData {
*/
flags: Array<FlagLabel>;
/**
* Remote APIs.
*/
remotes: Array<RemoteOptions>;
/**
* Grouped state labels.
*/
@ -29,6 +35,7 @@ export function initConfig(): ConfigData {
return {
colors: [],
flags: [],
remotes: [],
states: [],
};
}

View File

@ -1 +1,6 @@
export { FlagLabel, StateLabel } from './labels';
export { Remote, RemoteOptions } from './remote';
export { GithubRemote } from './remote/github';
export { GitlabRemote } from './remote/gitlab';
export { resolveLabels } from './resolve';
export { syncIssues, syncLabels } from './sync';

View File

@ -22,6 +22,11 @@ export interface LabelUpdate extends LabelQuery {
desc: string;
}
export interface RemoteOptions {
data: Record<string, string>;
type: string;
}
/**
* Basic functions which every remote API must provide.
*/
@ -62,9 +67,14 @@ export interface Remote {
listLabels(): Promise<Array<LabelUpdate>>;
/**
* Set labels on an issue.
* Update an issue.
*
* Only labels will be modified.
*/
updateIssue(options: IssueUpdate): Promise<IssueUpdate>;
/**
* Update a label.
*/
updateLabel(options: LabelUpdate): Promise<LabelUpdate>;
}

View File

@ -1,4 +1,4 @@
import { ConfigData } from './config';
import { FlagLabel, StateLabel } from './labels';
/**
* How a label changed.
@ -22,9 +22,9 @@ export interface ChangeRecord {
* Collected inputs for a resolver run.
*/
export interface ResolveInput {
config: ConfigData;
issue: string;
flags: Array<FlagLabel>;
labels: Array<string>;
states: Array<StateLabel>;
}
/**
@ -39,7 +39,7 @@ export interface ResolveResult {
export function resolveLabels(options: ResolveInput): ResolveResult {
const activeLabels = new Set(options.labels);
const sortedFlags = options.config.flags.sort((a, b) => a.priority - b.priority);
const sortedFlags = options.flags.sort((a, b) => a.priority - b.priority);
for (const flag of sortedFlags) {
const { name } = flag;
if (activeLabels.has(name)) {
@ -48,7 +48,7 @@ export function resolveLabels(options: ResolveInput): ResolveResult {
}
}
const sortedStates = options.config.states.sort((a, b) => a.priority - b.priority);
const sortedStates = options.states.sort((a, b) => a.priority - b.priority);
for (const state of sortedStates) {
for (const value of state.values) {
const name = `${state.name}/${value.name}`;

31
src/sync.ts Normal file
View File

@ -0,0 +1,31 @@
import { ConfigData } from './config';
import { Remote } from './remote';
// TODO: turn this back on/remove the disable pragma
/* eslint-disable no-console */
export interface SyncOptions {
config: ConfigData;
project: string;
remote: Remote;
}
export async function syncIssues(options: SyncOptions): Promise<unknown> {
const issues = await options.remote.listIssues();
for (const issue of issues) {
console.log('issue:', issue.name, issue.labels);
}
return undefined;
}
export async function syncLabels(options: SyncOptions): Promise<unknown> {
const labels = await options.remote.listLabels();
for (const label of labels) {
console.log('label:', label.name);
}
return undefined;
}

View File

@ -8,18 +8,36 @@ export interface ResolveTestCase {
export const TEST_CASES: Array<ResolveTestCase> = [{
input: {
config: {
colors: [],
flags: [],
states: [],
},
issue: '',
flags: [],
labels: [],
states: [],
},
name: 'test-1',
name: 'empty',
result: {
changes: [],
errors: [],
labels: [],
},
}, {
input: {
flags: [{
adds: [],
name: 'test',
priority: 1,
removes: [],
requires: [],
}],
labels: [
'test',
],
states: [],
},
name: 'basic flags',
result: {
changes: [],
errors: [],
labels: [
'test',
],
},
}];

View File

@ -438,6 +438,11 @@
resolved "https://artifacts.apextoaster.com/repository/group-npm/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"
integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==
"@types/parse-json@^4.0.0":
version "4.0.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==
"@types/prop-types@*":
version "15.7.3"
resolved "https://artifacts.apextoaster.com/repository/group-npm/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7"
@ -972,6 +977,11 @@ chokidar@3.3.1:
optionalDependencies:
fsevents "~2.1.2"
ci-info@^2.0.0:
version "2.0.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46"
integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==
clean-stack@^2.0.0:
version "2.2.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b"
@ -1069,6 +1079,11 @@ compare-func@^2.0.0:
array-ify "^1.0.0"
dot-prop "^5.1.0"
compare-versions@^3.6.0:
version "3.6.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/compare-versions/-/compare-versions-3.6.0.tgz#1a5689913685e5a87637b8d3ffca75514ec41d62"
integrity sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==
concat-map@0.0.1:
version "0.0.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
@ -1276,6 +1291,17 @@ core-util-is@1.0.2, core-util-is@~1.0.0:
resolved "https://artifacts.apextoaster.com/repository/group-npm/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
cosmiconfig@^6.0.0:
version "6.0.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982"
integrity sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==
dependencies:
"@types/parse-json" "^4.0.0"
import-fresh "^3.1.0"
parse-json "^5.0.0"
path-type "^4.0.0"
yaml "^1.7.2"
cross-spawn@^6.0.5:
version "6.0.5"
resolved "https://artifacts.apextoaster.com/repository/group-npm/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
@ -1945,6 +1971,13 @@ find-up@^3.0.0:
dependencies:
locate-path "^3.0.0"
find-versions@^3.2.0:
version "3.2.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/find-versions/-/find-versions-3.2.0.tgz#10297f98030a786829681690545ef659ed1d254e"
integrity sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==
dependencies:
semver-regex "^2.0.0"
flat-cache@^2.0.1:
version "2.0.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0"
@ -2292,6 +2325,22 @@ http-signature@~1.2.0:
jsprim "^1.2.2"
sshpk "^1.7.0"
husky@^4.2.5:
version "4.2.5"
resolved "https://artifacts.apextoaster.com/repository/group-npm/husky/-/husky-4.2.5.tgz#2b4f7622673a71579f901d9885ed448394b5fa36"
integrity sha512-SYZ95AjKcX7goYVZtVZF2i6XiZcHknw50iXvY7b0MiGoj5RwdgRQNEHdb+gPDPCXKlzwrybjFjkL6FOj8uRhZQ==
dependencies:
chalk "^4.0.0"
ci-info "^2.0.0"
compare-versions "^3.6.0"
cosmiconfig "^6.0.0"
find-versions "^3.2.0"
opencollective-postinstall "^2.0.2"
pkg-dir "^4.2.0"
please-upgrade-node "^3.2.0"
slash "^3.0.0"
which-pm-runs "^1.0.0"
iconv-lite@0.4.24, iconv-lite@^0.4.24:
version "0.4.24"
resolved "https://artifacts.apextoaster.com/repository/group-npm/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
@ -2309,7 +2358,7 @@ immutable@^3.8.2:
resolved "https://artifacts.apextoaster.com/repository/group-npm/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3"
integrity sha1-wkOZUUVbs5kT2vKBN28VMOEErfM=
import-fresh@^3.0.0:
import-fresh@^3.0.0, import-fresh@^3.1.0:
version "3.2.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66"
integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==
@ -3396,6 +3445,11 @@ open@^7.0.3:
is-docker "^2.0.0"
is-wsl "^2.1.1"
opencollective-postinstall@^2.0.2:
version "2.0.3"
resolved "https://artifacts.apextoaster.com/repository/group-npm/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259"
integrity sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==
opener@1:
version "1.5.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/opener/-/opener-1.5.1.tgz#6d2f0e77f1a0af0032aca716c2c1fbb8e7e8abed"
@ -3606,6 +3660,11 @@ path-type@^3.0.0:
dependencies:
pify "^3.0.0"
path-type@^4.0.0:
version "4.0.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==
pathval@^1.1.0:
version "1.1.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0"
@ -3650,13 +3709,20 @@ pkg-dir@^2.0.0:
dependencies:
find-up "^2.1.0"
pkg-dir@^4.1.0:
pkg-dir@^4.1.0, pkg-dir@^4.2.0:
version "4.2.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3"
integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==
dependencies:
find-up "^4.0.0"
please-upgrade-node@^3.2.0:
version "3.2.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942"
integrity sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==
dependencies:
semver-compare "^1.0.0"
prelude-ls@^1.2.1:
version "1.2.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
@ -4247,6 +4313,16 @@ scheduler@^0.19.1:
loose-envify "^1.1.0"
object-assign "^4.1.1"
semver-compare@^1.0.0:
version "1.0.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"
integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w=
semver-regex@^2.0.0:
version "2.0.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/semver-regex/-/semver-regex-2.0.0.tgz#a93c2c5844539a770233379107b38c7b4ac9d338"
integrity sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==
"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0:
version "5.7.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
@ -4342,6 +4418,11 @@ sinon@9.0.2:
nise "^4.0.1"
supports-color "^7.1.0"
slash@^3.0.0:
version "3.0.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
slice-ansi@^2.1.0:
version "2.1.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636"
@ -5067,6 +5148,11 @@ which-module@^2.0.0:
resolved "https://artifacts.apextoaster.com/repository/group-npm/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=
which-pm-runs@^1.0.0:
version "1.0.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/which-pm-runs/-/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb"
integrity sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=
which@2.0.2, which@^2.0.1:
version "2.0.2"
resolved "https://artifacts.apextoaster.com/repository/group-npm/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
@ -5168,6 +5254,11 @@ y18n@^4.0.0:
resolved "https://artifacts.apextoaster.com/repository/group-npm/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
yaml@^1.7.2:
version "1.10.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e"
integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==
yargs-parser@13.1.2, yargs-parser@^13.1.2:
version "13.1.2"
resolved "https://artifacts.apextoaster.com/repository/group-npm/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38"