github-repository-provider 9.0.6 → 9.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -383,7 +383,7 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
383
383
  * `sha` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
384
384
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
385
385
 
386
- Returns **any** 
386
+ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**&#x20;
387
387
 
388
388
  ### deletePullRequest
389
389
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-repository-provider",
3
- "version": "9.0.6",
3
+ "version": "9.0.7",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -24,6 +24,7 @@
24
24
  ],
25
25
  "license": "BSD-2-Clause",
26
26
  "scripts": {
27
+ "prepare": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types -t esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
27
28
  "test": "npm run test:ava",
28
29
  "test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
29
30
  "cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
@@ -33,22 +34,22 @@
33
34
  "lint:tsc": "tsc --allowJs --checkJs --noEmit -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
34
35
  },
35
36
  "dependencies": {
36
- "content-entry": "^9.0.0",
37
+ "content-entry": "^9.0.1",
37
38
  "fetch-link-util": "^1.1.1",
38
- "fetch-rate-limit-util": "^4.2.1",
39
+ "fetch-rate-limit-util": "^4.2.2",
39
40
  "matching-iterator": "^2.1.3",
40
41
  "one-time-execution-method": "^3.1.1",
41
- "repository-provider": "^35.2.14"
42
+ "repository-provider": "^35.2.15"
42
43
  },
43
44
  "devDependencies": {
44
- "@types/node": "^20.11.20",
45
- "ava": "^6.1.1",
45
+ "@types/node": "^20.11.24",
46
+ "ava": "^6.1.2",
46
47
  "c8": "^9.1.0",
47
48
  "documentation": "^14.0.3",
48
49
  "etag-cache-leveldb": "^2.1.1",
49
50
  "leveldown": "^6.1.1",
50
51
  "levelup": "^5.1.1",
51
- "repository-provider-test-support": "^3.1.3",
52
+ "repository-provider-test-support": "^3.1.4",
52
53
  "semantic-release": "^23.0.2",
53
54
  "typescript": "^5.3.3"
54
55
  },
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Branch on GitHub.
3
+ */
4
+ export class GithubBranch extends Branch {
5
+ constructor(owner: any, name: any, options: any);
6
+ /**
7
+ * Writes content into the branch
8
+ * {@link https://developer.github.com/v3/git/blobs/#get-a-blob}
9
+ * @param {ContentEntry} entry
10
+ * @return {Promise<ContentEntry>} written content with sha values set
11
+ */
12
+ writeEntry(entry: ContentEntry): Promise<ContentEntry>;
13
+ /**
14
+ * {@link https://developer.github.com/v3/git/trees/#create-a-tree}
15
+ * {@link https://developer.github.com/v3/git/commits/#create-a-commit}
16
+ * {@link https://developer.github.com/v3/git/refs/#update-a-reference}
17
+ * @param {string} message
18
+ * @param {ContentEntry[]} entries
19
+ * @param {Object} [options]
20
+ */
21
+ commit(message: string, entries: ContentEntry[], options?: any): Promise<any>;
22
+ /**
23
+ * {@link https://developer.github.com/v3/repos/contents/#get-repository-content}
24
+ * @param {string} name
25
+ */
26
+ entry(name: string): Promise<any>;
27
+ entries(patterns: any): AsyncGenerator<{
28
+ [x: string]: any;
29
+ readonly isCollection: boolean;
30
+ readonly types: string[];
31
+ readonly mode: number;
32
+ } | LazyBufferContentEntry, void, unknown>;
33
+ /**
34
+ * https://developer.github.com/v3/repos/contents/
35
+ * @param {AsyncIterator<ContentEntry>} entries
36
+ */
37
+ removeEntries(entries: AsyncIterator<ContentEntry>): Promise<void>;
38
+ #private;
39
+ }
40
+ import { Branch } from "repository-provider";
41
+ import { ContentEntry } from "content-entry";
42
+ declare const LazyBufferContentEntry_base: {
43
+ new (): {
44
+ [x: string]: any;
45
+ readonly string: string;
46
+ readonly readStream: ReadableStream<any>;
47
+ readonly isEmpty: boolean;
48
+ readonly size: number;
49
+ getReadStream(): Promise<ReadableStream<any>>;
50
+ };
51
+ [x: string]: any;
52
+ };
53
+ declare class LazyBufferContentEntry extends LazyBufferContentEntry_base {
54
+ constructor(name: any, mode: any, branch: any);
55
+ branch: any;
56
+ get buffer(): Promise<any>;
57
+ getBuffer(): Promise<any>;
58
+ #private;
59
+ }
60
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Represents github repo owner either
3
+ * - users
4
+ * - organization
5
+ */
6
+ export class GithubOwner extends RepositoryGroup {
7
+ /**
8
+ * Map attributes between external and internal representation.
9
+ */
10
+ static get attributeMapping(): {
11
+ site_admin: string;
12
+ };
13
+ get api(): string;
14
+ }
15
+ import { RepositoryGroup } from "repository-provider";
@@ -0,0 +1,174 @@
1
+ /**
2
+ * <!-- skip-example -->
3
+ * GitHub provider.
4
+ * Lookup a repository.
5
+ * known environment variables
6
+ * - GITHUB_TOKEN or GH_TOKEN api token
7
+ * @example
8
+ * import GithubProvider from 'github-repository-provider';
9
+ *
10
+ * const ghp = new GithubProvider();
11
+ * const r1 = ghp.repository('git@github.com:arlac77/github-repository-provider.git');
12
+ * const r2 = ghp.repository('git://github.com/arlac77/github-repository-provider.git');
13
+ * const r3 = ghp.repository('git+ssh://github.com/arlac77/github-repository-provider.git');
14
+ * const r4 = ghp.repository('https://github.com/arlac77/github-repository-provider.git#master');
15
+ * const r5 = ghp.repository('git+https://github.com/arlac77/github-repository-provider.git#master');
16
+ * const r6 = ghp.repository('arlac77/github-repository-provider');
17
+ * // different ways to address the same repository
18
+ */
19
+ export class GithubProvider extends MultiGroupProvider {
20
+ static get attributes(): {
21
+ host: {
22
+ env: string[];
23
+ default: string;
24
+ type: string;
25
+ isKey: boolean;
26
+ writable: boolean;
27
+ mandatory: boolean;
28
+ private?: boolean;
29
+ depends?: string;
30
+ additionalAttributes: string[];
31
+ description?: string;
32
+ set?: Function;
33
+ get?: Function; /**
34
+ * We are called github.
35
+ * @return {string} github
36
+ */
37
+ };
38
+ ssh: {
39
+ default: string;
40
+ type: string;
41
+ isKey: boolean;
42
+ writable: boolean;
43
+ mandatory: boolean;
44
+ private?: boolean;
45
+ depends?: string;
46
+ additionalAttributes: string[];
47
+ description?: string;
48
+ set?: Function;
49
+ get?: Function; /**
50
+ * We are called github.
51
+ * @return {string} github
52
+ */
53
+ env?: string | string[];
54
+ };
55
+ url: {
56
+ env: string;
57
+ set: (value: any) => any;
58
+ default: string;
59
+ depends: string;
60
+ type: string;
61
+ isKey: boolean;
62
+ writable: boolean;
63
+ mandatory: boolean;
64
+ private?: boolean;
65
+ additionalAttributes: string[];
66
+ description?: string;
67
+ get?: Function; /**
68
+ * We are called github.
69
+ * @return {string} github
70
+ */
71
+ };
72
+ api: {
73
+ env: string;
74
+ set: (value: any) => any;
75
+ depends: string;
76
+ default: string;
77
+ type: string;
78
+ isKey: boolean;
79
+ writable: boolean;
80
+ mandatory: boolean;
81
+ private?: boolean;
82
+ additionalAttributes: string[];
83
+ description?: string;
84
+ get?: Function; /**
85
+ * We are called github.
86
+ * @return {string} github
87
+ */
88
+ };
89
+ "authentication.token": {
90
+ env: string[];
91
+ additionalAttributes: {
92
+ "authentication.type": string;
93
+ };
94
+ private: boolean;
95
+ mandatory: boolean;
96
+ type: string;
97
+ isKey: boolean;
98
+ writable: boolean;
99
+ depends?: string;
100
+ description?: string;
101
+ default?: any;
102
+ set?: Function;
103
+ get?: Function; /**
104
+ * We are called github.
105
+ * @return {string} github
106
+ */
107
+ };
108
+ priority: {
109
+ default: number;
110
+ type: string;
111
+ isKey: boolean;
112
+ writable: boolean;
113
+ mandatory: boolean;
114
+ private?: boolean;
115
+ depends?: string;
116
+ additionalAttributes: string[];
117
+ description?: string;
118
+ set?: Function;
119
+ get?: Function; /**
120
+ * We are called github.
121
+ * @return {string} github
122
+ */
123
+ env?: string | string[];
124
+ };
125
+ name: {
126
+ env: string;
127
+ type: string;
128
+ isKey: boolean;
129
+ writable: boolean;
130
+ mandatory: boolean;
131
+ private?: boolean;
132
+ depends?: string;
133
+ additionalAttributes: string[];
134
+ description?: string;
135
+ default?: any;
136
+ set?: Function;
137
+ get?: Function;
138
+ };
139
+ description: import("pacc").AttributeDefinition;
140
+ messageDestination: {
141
+ type: string;
142
+ default: Console;
143
+ writable: boolean;
144
+ private: boolean;
145
+ isKey: boolean;
146
+ mandatory: boolean;
147
+ depends?: string;
148
+ additionalAttributes: string[];
149
+ description?: string;
150
+ set?: Function;
151
+ get?: Function;
152
+ env?: string | string[];
153
+ };
154
+ };
155
+ fetch(url: any, options?: {}): any;
156
+ fetchJSON(url: any, options?: {}): any;
157
+ /**
158
+ * {@link https://developer.github.com/v3/repos/#list-repositories-for-the-authenticated-user}
159
+ */
160
+ initializeRepositories(): Promise<void>;
161
+ get pullRequestClass(): typeof GithubPullRequest;
162
+ get repositoryClass(): typeof GithubRepository;
163
+ get branchClass(): typeof GithubBranch;
164
+ get repositoryGroupClass(): typeof GithubOwner;
165
+ get entryClass(): typeof BufferContentEntry;
166
+ }
167
+ export default GithubProvider;
168
+ import { GithubRepository } from "./github-repository.mjs";
169
+ import { GithubBranch } from "./github-branch.mjs";
170
+ import { GithubOwner } from "./github-owner.mjs";
171
+ import { GithubPullRequest } from "./github-pull-request.mjs";
172
+ import { MultiGroupProvider } from "repository-provider";
173
+ import { BufferContentEntry } from "content-entry";
174
+ export { GithubRepository, GithubBranch, GithubOwner, GithubPullRequest };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Github pull request.
3
+ */
4
+ export class GithubPullRequest extends PullRequest {
5
+ /**
6
+ * All valid merge methods.
7
+ * @return {Set<string>} valid merge methods
8
+ */
9
+ static validMergeMethods: Set<string>;
10
+ static get attributes(): {
11
+ maintainer_can_modify: import("pacc").AttributeDefinition;
12
+ body: import("pacc").AttributeDefinition;
13
+ title: import("pacc").AttributeDefinition;
14
+ url: import("pacc").AttributeDefinition;
15
+ state: {
16
+ default: string;
17
+ values: Set<string>;
18
+ type: string;
19
+ isKey: boolean;
20
+ writable: boolean;
21
+ mandatory: boolean;
22
+ private?: boolean;
23
+ depends?: string;
24
+ additionalAttributes: string[];
25
+ description?: string;
26
+ set?: Function;
27
+ get?: Function;
28
+ env?: string | string[];
29
+ };
30
+ locked: import("pacc").AttributeDefinition;
31
+ merged: import("pacc").AttributeDefinition;
32
+ draft: import("pacc").AttributeDefinition;
33
+ dry: import("pacc").AttributeDefinition;
34
+ empty: import("pacc").AttributeDefinition;
35
+ id: import("pacc").AttributeDefinition;
36
+ name: import("pacc").AttributeDefinition;
37
+ description: import("pacc").AttributeDefinition;
38
+ };
39
+ /**
40
+ * {@link https://developer.github.com/v3/pulls/#list-pull-requests}
41
+ * @param {Repository} repository
42
+ * @param {Object} filter
43
+ */
44
+ static list(repository: Repository, filter?: any): AsyncGenerator<GithubPullRequest, void, unknown>;
45
+ /**
46
+ * {@link https://developer.github.com/v3/pulls/#create-a-pull-request}
47
+ * @param {Branch} source
48
+ * @param {Branch} destination
49
+ * @param {Object} [options]
50
+ */
51
+ static open(source: Branch, destination: Branch, options?: any): Promise<GithubPullRequest>;
52
+ /**
53
+ * {@link https://developer.github.com/v3/pulls/#merge-a-pull-request}
54
+ */
55
+ _merge(method?: string): Promise<void>;
56
+ }
57
+ import { PullRequest } from "repository-provider";
58
+ import { Repository } from "repository-provider";
59
+ import { Branch } from "repository-provider";
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Repository on GitHub.
3
+ */
4
+ export class GithubRepository extends Repository {
5
+ static get attributes(): {
6
+ auto_init: import("pacc").AttributeDefinition;
7
+ size: import("pacc").AttributeDefinition;
8
+ language: import("pacc").AttributeDefinition;
9
+ gitignore_template: import("pacc").AttributeDefinition;
10
+ license_template: import("pacc").AttributeDefinition;
11
+ allow_squash_merge: import("pacc").AttributeDefinition;
12
+ allow_merge_commit: import("pacc").AttributeDefinition;
13
+ allow_rebase_merge: import("pacc").AttributeDefinition;
14
+ allow_auto_merge: import("pacc").AttributeDefinition;
15
+ delete_branch_on_merge: import("pacc").AttributeDefinition;
16
+ issuesURL: import("pacc").AttributeDefinition;
17
+ squash_merge_commit_title: import("pacc").AttributeDefinition;
18
+ squash_merge_commit_message: import("pacc").AttributeDefinition;
19
+ merge_commit_title: import("pacc").AttributeDefinition;
20
+ merge_commit_message: import("pacc").AttributeDefinition;
21
+ url: import("pacc").AttributeDefinition;
22
+ defaultBranchName: {
23
+ default: string;
24
+ type: string;
25
+ isKey: boolean;
26
+ writable: boolean;
27
+ mandatory: boolean;
28
+ private?: boolean;
29
+ depends?: string;
30
+ additionalAttributes: string[];
31
+ description?: string;
32
+ set?: Function;
33
+ get?: Function;
34
+ env?: string | string[];
35
+ };
36
+ cloneURL: import("pacc").AttributeDefinition;
37
+ isArchived: import("pacc").AttributeDefinition;
38
+ isLocked: import("pacc").AttributeDefinition;
39
+ isDisabled: import("pacc").AttributeDefinition;
40
+ isTemplate: import("pacc").AttributeDefinition;
41
+ isFork: import("pacc").AttributeDefinition;
42
+ id: import("pacc").AttributeDefinition;
43
+ name: import("pacc").AttributeDefinition;
44
+ description: import("pacc").AttributeDefinition;
45
+ };
46
+ /**
47
+ * {@link https://docs.github.com/en/rest/reference/commits#list-commits}
48
+ * @param {Object} options
49
+ * @returns {AsyncIterable<Commit>}
50
+ */
51
+ commits(options: any): AsyncIterable<Commit>;
52
+ addCommit(tree: any, parents: any, message: any): Promise<any>;
53
+ /**
54
+ * {@link https://developer.github.com/v3/git/commits/#get-a-commit}
55
+ * @param {string} sha
56
+ * @return {Promise<Object>} response
57
+ */
58
+ commitForSha(sha: string): Promise<any>;
59
+ /**
60
+ * @see https://developer.github.com/v3/git/trees/
61
+ * @param {string} sha
62
+ * @return {Promise<Object[]>}
63
+ */
64
+ tree(sha: string): Promise<any[]>;
65
+ /**
66
+ * @see https://developer.github.com/v3/git/trees/
67
+ * @param {Object[]} updates
68
+ * @param {string} base base tree sha
69
+ * @returns {Promise<Object>} newly created tree
70
+ */
71
+ addTree(updates: any[], base: string): Promise<any>;
72
+ /**
73
+ * {@link https://developer.github.com/v3/repos/branches/#list-branches}
74
+ */
75
+ initializeBranches(): Promise<void>;
76
+ /**
77
+ * {@link https://docs.github.com/en/rest/reference/repos#list-repository-tags}
78
+ */
79
+ initializeTags(): Promise<void>;
80
+ /**
81
+ * {@link https://docs.github.com/de/rest/repos/repos?apiVersion=2022-11-28#update-a-repository}
82
+ */
83
+ update(): Promise<any>;
84
+ /**
85
+ * @param {string} ref
86
+ * @param {string} sha
87
+ */
88
+ _setRefId(ref: string, sha: string): void;
89
+ /**
90
+ * {@link https://docs.github.com/en/github-ae@latest/rest/git/refs#update-a-reference}
91
+ * @param {string} ref
92
+ * @param {string} sha
93
+ * @param {Object} options
94
+ * @returns {Promise<Object>}
95
+ *
96
+ */
97
+ setRefId(ref: string, sha: string, options: any): Promise<any>;
98
+ createBranch(name: any, from: any, options: any): Promise<import("repository-provider").Branch>;
99
+ deleteBranch(name: any): Promise<any>;
100
+ /**
101
+ * {@link https://developer.github.com/v3/pulls/#update-a-pull-request}
102
+ *
103
+ * @param {string} name
104
+ */
105
+ deletePullRequest(name: string): Promise<void>;
106
+ /**
107
+ * {@link https://developer.github.com/v3/repos/hooks/}
108
+ */
109
+ initializeHooks(): Promise<void>;
110
+ #private;
111
+ }
112
+ import { Repository } from "repository-provider";
113
+ import { Commit } from "repository-provider";