repository-provider 35.0.4 → 35.2.0

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.
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Named Object registering itself in the owner.
3
+ */
4
+ export class OwnedObject extends NamedObject {
5
+ /**
6
+ * Method name to be called to register one instance in the owner.
7
+ * sample: Application => _addApplication
8
+ * @return {string}
9
+ */
10
+ static get addMethodName(): string;
11
+ /**
12
+ * Method name to be called to unregister one instance in the owner.
13
+ * sample: Application => _deleteApplication
14
+ * @return {string}
15
+ */
16
+ static get deleteMethodName(): string;
17
+ constructor(owner: any, name: any, options: any, additionalProperties: any);
18
+ owner: any;
19
+ /**
20
+ * Removes the receiver from the owner.
21
+ */
22
+ delete(): void;
23
+ /**
24
+ * Check for equality.
25
+ * @param {OwnedObject} other
26
+ * @return {boolean} true if receiver and owner are equal
27
+ */
28
+ equals(other: OwnedObject): boolean;
29
+ /**
30
+ * Url of home page.
31
+ * @see {@link Repository#homePageURL}
32
+ * @return {string} as provided from the owner
33
+ */
34
+ get homePageURL(): string;
35
+ /**
36
+ * Url of issue tracking system.
37
+ * @see {@link Repository#issuesURL}
38
+ * @return {string} as provided from the repository
39
+ */
40
+ get issuesURL(): string;
41
+ /**
42
+ * Forwarded from the owner.
43
+ * @return {boolean}
44
+ */
45
+ get isLocked(): boolean;
46
+ /**
47
+ * Forwarded from the owner.
48
+ * @return {boolean}
49
+ */
50
+ get isArchived(): boolean;
51
+ /**
52
+ * Forwarded from the owner.
53
+ * @return {boolean}
54
+ */
55
+ get isDisabled(): boolean;
56
+ /**
57
+ * API as given by the owner.
58
+ * @return {string} url
59
+ */
60
+ get api(): string;
61
+ /**
62
+ * API as given by the owner.
63
+ * @return {string} url
64
+ */
65
+ get slug(): string;
66
+ /**
67
+ * URL as given by the owner.
68
+ * @return {string} url
69
+ */
70
+ get url(): string;
71
+ /**
72
+ * The provider we live in.
73
+ * @return {BaseProvider}
74
+ */
75
+ get provider(): BaseProvider;
76
+ /**
77
+ * Forwarded to the owner.
78
+ * @param {...any} args
79
+ */
80
+ trace(...args: any[]): any;
81
+ /**
82
+ * Forwarded to the owner.
83
+ * @param {...any} args
84
+ */
85
+ info(...args: any[]): any;
86
+ /**
87
+ * Forwarded to the owner.
88
+ * @param {...any} args
89
+ */
90
+ warn(...args: any[]): any;
91
+ /**
92
+ * Forwarded to the owner.
93
+ * @param {...any} args
94
+ */
95
+ error(...args: any[]): any;
96
+ /**
97
+ * Forwarded to the owner.
98
+ * @param {...any} args
99
+ */
100
+ debug(...args: any[]): any;
101
+ /**
102
+ * By default we use the owners implementation.
103
+ * @return {Repository} as defined in the owner
104
+ */
105
+ get repositoryClass(): Repository;
106
+ /**
107
+ * By default we use the owners implementation.
108
+ * @return {PullRequest} as defined in the owner
109
+ */
110
+ get pullRequestClass(): PullRequest;
111
+ /**
112
+ * By default we use the owners implementation.
113
+ * @return {Branch} as defined in the owner
114
+ */
115
+ get branchClass(): Branch;
116
+ /**
117
+ * By default we use the owners implementation.
118
+ * @return {Tag} as defined in the owner
119
+ */
120
+ get tagClass(): Tag;
121
+ /**
122
+ * By default we use the owners implementation.
123
+ * @return {ContentEntry} as defined in the owner
124
+ */
125
+ get entryClass(): ContentEntry;
126
+ /**
127
+ * By default we use the owners implementation.
128
+ * @return {Hook} as defined in the owner
129
+ */
130
+ get hookClass(): Hook;
131
+ }
132
+ import { NamedObject } from "./named-object.mjs";
@@ -0,0 +1,6 @@
1
+ /**
2
+ *
3
+ */
4
+ export class Project extends OwnedObject {
5
+ }
6
+ import { OwnedObject } from "./owned-object.mjs";
@@ -0,0 +1,233 @@
1
+ /**
2
+ * Abstract pull request.
3
+ * {@link Repository#addPullRequest}
4
+ * @param {Branch} source merge source
5
+ * @param {Branch} owner merge target
6
+ * @param {string} name
7
+ * @param {Object} [options]
8
+ * @param {string} [options.title]
9
+ * @param {string} [options.state]
10
+ * @param {boolean} [options.merged]
11
+ * @param {boolean} [options.locked]
12
+
13
+ * @property {string} name
14
+ * @property {Branch} source
15
+ * @property {Branch} destination
16
+ * @property {string} [title]
17
+ * @property {string} [state]
18
+ * @property {boolean} [merged]
19
+ * @property {boolean} [locked]
20
+ * @property {string} url
21
+ */
22
+ export class PullRequest extends OwnedObject {
23
+ /**
24
+ * States to list pull request by default
25
+ * @return {Set<string>} states to list by default
26
+ */
27
+ static defaultListStates: Set<string>;
28
+ /**
29
+ * possible states
30
+ * @enum {string}
31
+ */
32
+ static states: Set<string>;
33
+ /**
34
+ * All valid merge methods
35
+ * @return {Set<string>} valid merge methods.
36
+ * @enum {string}
37
+ */
38
+ static validMergeMethods: Set<any>;
39
+ /**
40
+ * List all pull request for a given repo.
41
+ * Result will be filtered by source branch, destination branch and states
42
+ * @param {Repository} repository
43
+ * @param {Object} [filter]
44
+ * @param {Branch?} [filter.source]
45
+ * @param {Branch?} [filter.destination]
46
+ * @param {Set<string>} [filter.states]
47
+ * @return {AsyncIterable<PullRequest>}
48
+ */
49
+ static list(repository: Repository, filter?: {
50
+ source?: Branch | null;
51
+ destination?: Branch | null;
52
+ states?: Set<string>;
53
+ }): AsyncIterable<PullRequest>;
54
+ /**
55
+ * Open a pull request
56
+ *
57
+ * @param {Branch} source
58
+ * @param {Branch} destination
59
+ * @param {Object} [options]
60
+ */
61
+ static open(source: Branch, destination: Branch, options?: any): Promise<PullRequest>;
62
+ static get attributes(): {
63
+ body: {
64
+ writable: boolean;
65
+ type: string;
66
+ mandatory: boolean;
67
+ private: boolean;
68
+ isKey: boolean;
69
+ additionalAttributes: any[];
70
+ env: any[];
71
+ };
72
+ title: {
73
+ description: string;
74
+ writable: boolean;
75
+ type: string;
76
+ mandatory: boolean;
77
+ private: boolean;
78
+ isKey: boolean;
79
+ additionalAttributes: any[];
80
+ env: any[];
81
+ };
82
+ url: {
83
+ description: string;
84
+ type: string;
85
+ writable: boolean;
86
+ mandatory: boolean;
87
+ private: boolean;
88
+ isKey: boolean;
89
+ additionalAttributes: any[];
90
+ env: any[];
91
+ };
92
+ /**
93
+ * state of the pull request.
94
+ * - OPEN
95
+ * - MERGED
96
+ * - CLOSED
97
+ * @return {string}
98
+ */
99
+ state: {
100
+ default: string;
101
+ values: Set<string>;
102
+ writable: boolean;
103
+ type: string;
104
+ mandatory: boolean;
105
+ private: boolean;
106
+ isKey: boolean;
107
+ additionalAttributes: any[];
108
+ env: any[];
109
+ };
110
+ /**
111
+ * Locked state of the pull request.
112
+ * @return {boolean}
113
+ */
114
+ locked: {
115
+ writable: boolean;
116
+ default: boolean;
117
+ type: string;
118
+ mandatory: boolean;
119
+ private: boolean;
120
+ isKey: boolean;
121
+ additionalAttributes: any[];
122
+ env: any[];
123
+ };
124
+ /**
125
+ * Merged state of the pull request.
126
+ * @return {boolean}
127
+ */
128
+ merged: {
129
+ writable: boolean;
130
+ default: boolean;
131
+ type: string;
132
+ mandatory: boolean;
133
+ private: boolean;
134
+ isKey: boolean;
135
+ additionalAttributes: any[];
136
+ env: any[];
137
+ };
138
+ /**
139
+ * Draft state of the pull request.
140
+ * @return {boolean}
141
+ */
142
+ draft: {
143
+ writable: boolean;
144
+ default: boolean;
145
+ type: string;
146
+ mandatory: boolean;
147
+ private: boolean;
148
+ isKey: boolean;
149
+ additionalAttributes: any[];
150
+ env: any[];
151
+ };
152
+ dry: {
153
+ writable: boolean;
154
+ default: boolean;
155
+ type: string;
156
+ mandatory: boolean;
157
+ private: boolean;
158
+ isKey: boolean;
159
+ additionalAttributes: any[];
160
+ env: any[];
161
+ };
162
+ empty: {
163
+ type: string;
164
+ writable: boolean;
165
+ mandatory: boolean;
166
+ private: boolean;
167
+ isKey: boolean;
168
+ additionalAttributes: any[];
169
+ env: any[];
170
+ };
171
+ id: {
172
+ isKey: boolean;
173
+ description: string;
174
+ type: string;
175
+ writable: boolean;
176
+ mandatory: boolean;
177
+ private: boolean;
178
+ additionalAttributes: any[];
179
+ env: any[];
180
+ };
181
+ name: {
182
+ isKey: boolean;
183
+ type: string;
184
+ writable: boolean;
185
+ mandatory: boolean;
186
+ private: boolean;
187
+ additionalAttributes: any[];
188
+ env: any[];
189
+ };
190
+ description: {
191
+ description: string;
192
+ writable: boolean;
193
+ type: string;
194
+ mandatory: boolean;
195
+ private: boolean;
196
+ isKey: boolean;
197
+ additionalAttributes: any[];
198
+ env: any[];
199
+ };
200
+ };
201
+ source: any;
202
+ get destination(): any;
203
+ get number(): any;
204
+ get dry(): boolean;
205
+ /**
206
+ * @return {Repository} destination repository
207
+ */
208
+ get repository(): Repository;
209
+ /**
210
+ * Delete the pull request from the {@link Repository}.
211
+ * @see {@link Repository#deletePullRequest}
212
+ * @return {Promise}
213
+ */
214
+ delete(): Promise<any>;
215
+ /**
216
+ * Merge the pull request.
217
+ * @param {string} method
218
+ */
219
+ merge(method?: string): Promise<void>;
220
+ merged: boolean;
221
+ /**
222
+ * Decline the pull request.
223
+ */
224
+ decline(): Promise<void>;
225
+ /**
226
+ * @return {AsyncIterable<Review>}
227
+ */
228
+ reviews(): AsyncIterable<Review>;
229
+ }
230
+ import { OwnedObject } from "./owned-object.mjs";
231
+ import { Repository } from "./repository.mjs";
232
+ import { Review } from "./review.mjs";
233
+ import { Branch } from "./branch.mjs";
@@ -0,0 +1,113 @@
1
+ /**
2
+ * @typedef {Object} ContentEntry
3
+ * @property {string} name
4
+ *
5
+ */
6
+ /**
7
+ * Base for Branch and Tag
8
+ */
9
+ export class Ref extends OwnedObject {
10
+ /**
11
+ * options
12
+ */
13
+ static get attributes(): {
14
+ name: {
15
+ isKey: boolean;
16
+ type: string;
17
+ writable: boolean;
18
+ mandatory: boolean;
19
+ /**
20
+ * @typedef {Object} ContentEntry
21
+ * @property {string} name
22
+ *
23
+ */
24
+ /**
25
+ * Base for Branch and Tag
26
+ */
27
+ private: boolean;
28
+ additionalAttributes: any[];
29
+ env: any[];
30
+ };
31
+ /**
32
+ * Can the ref be modified.
33
+ * @return {boolean}
34
+ */
35
+ isProtected: {
36
+ writable: boolean;
37
+ default: boolean;
38
+ type: string;
39
+ mandatory: boolean;
40
+ /**
41
+ * @typedef {Object} ContentEntry
42
+ * @property {string} name
43
+ *
44
+ */
45
+ /**
46
+ * Base for Branch and Tag
47
+ */
48
+ private: boolean;
49
+ isKey: boolean;
50
+ additionalAttributes: any[];
51
+ env: any[];
52
+ };
53
+ };
54
+ static get attributeMapping(): {
55
+ protected: string;
56
+ };
57
+ get refType(): string;
58
+ /**
59
+ * Full ref path.
60
+ * @return {string} git ref of the Ref
61
+ */
62
+ get ref(): string;
63
+ /**
64
+ * Get sha of our ref.
65
+ * @return {Promise<string>} sha of the ref
66
+ */
67
+ get refId(): Promise<string>;
68
+ /**
69
+ * List entries of the branch.
70
+ * @param {string[]|string} [matchingPatterns]
71
+ * @return {AsyncGenerator<ContentEntry>} all matching entries in the branch
72
+ */
73
+ entries(matchingPatterns?: string[] | string): AsyncGenerator<ContentEntry>;
74
+ /**
75
+ * Get exactly one matching entry by name or undefine if no such entry is found.
76
+ * @param {string} name
77
+ * @return {Promise<ContentEntry|undefined>}
78
+ */
79
+ maybeEntry(name: string): Promise<ContentEntry | undefined>;
80
+ /**
81
+ * Get exactly one matching entry by name (throws if entry is not found).
82
+ * @param {string} name
83
+ * @return {Promise<ContentEntry>}
84
+ */
85
+ entry(name: string): Promise<ContentEntry>;
86
+ /**
87
+ * Ref owner.
88
+ * By default we provide the repository owner
89
+ * @see {@link Repository#owner}
90
+ * @return {Repository}
91
+ */
92
+ get repository(): Repository;
93
+ get identifier(): any;
94
+ /**
95
+ *
96
+ * @return false
97
+ */
98
+ get isProtected(): boolean;
99
+ /**
100
+ * Are we the default ref.
101
+ * @return {boolean} false
102
+ */
103
+ get isDefault(): boolean;
104
+ /**
105
+ * List all entries of the branch.
106
+ * @return {AsyncGenerator<ContentEntry>} all entries in the branch
107
+ */
108
+ [Symbol.asyncIterator](): AsyncGenerator<ContentEntry>;
109
+ }
110
+ export type ContentEntry = {
111
+ name: string;
112
+ };
113
+ import { OwnedObject } from "./owned-object.mjs";
@@ -0,0 +1,59 @@
1
+ declare const RepositoryGroup_base: {
2
+ new (): {
3
+ [x: string]: any;
4
+ "__#2@#repositories": Map<any, any>;
5
+ normalizeRepositoryName(name: string, forLookup: boolean): string;
6
+ repository(name?: string): Promise<import("./repository.mjs").Repository>;
7
+ repositories(patterns?: string | string[]): AsyncIterable<import("./repository.mjs").Repository>;
8
+ lookup(type: string, name?: string, split?: Function, defaultItem?: any): Promise<OwnedObject>;
9
+ list(type: string, patterns?: string | string[], split?: Function, defaultItem?: any): AsyncIterable<OwnedObject>;
10
+ createRepository(name: string, options?: any): Promise<import("./repository.mjs").Repository>;
11
+ addRepository(name: string, options?: any): Promise<import("./repository.mjs").Repository>;
12
+ _addRepository(repository: any): void;
13
+ deleteRepository(name: string): Promise<any>;
14
+ initializeRepositories(): void;
15
+ branch(name: string): Promise<import("./branch.mjs").Branch>;
16
+ branches(patterns?: string | string[]): AsyncIterable<import("./branch.mjs").Branch>;
17
+ tag(name: any): Promise<OwnedObject>;
18
+ tags(patterns: any): AsyncGenerator<OwnedObject, void, undefined>;
19
+ pullRequest(name: any): Promise<OwnedObject>;
20
+ pullRequests(patterns: any): AsyncGenerator<OwnedObject, void, undefined>;
21
+ project(name: any): Promise<OwnedObject>;
22
+ projects(patterns: any): AsyncGenerator<OwnedObject, void, undefined>;
23
+ application(name: any): Promise<OwnedObject>;
24
+ applications(patterns: any): AsyncGenerator<OwnedObject, void, undefined>;
25
+ milestone(name: any): Promise<OwnedObject>;
26
+ milestones(patterns: any): AsyncGenerator<OwnedObject, void, undefined>;
27
+ hook(name: any): Promise<OwnedObject>;
28
+ hooks(patterns: any): AsyncGenerator<OwnedObject, void, undefined>;
29
+ };
30
+ [x: string]: any;
31
+ };
32
+ /**
33
+ * Abstract repository collection.
34
+ * @param {BaseProvider} provider
35
+ * @param {string} name of the group
36
+ * @param {Object} [options]
37
+ * @param {string} [options.description] human readable description
38
+ * @param {string} [options.id] internal id
39
+ * @param {string} [options.url] home
40
+ *
41
+ * @property {BaseProvider} provider
42
+ * @property {string} name
43
+ */
44
+ export class RepositoryGroup extends RepositoryGroup_base {
45
+ static get addMethodName(): string;
46
+ static get deleteMethodName(): string;
47
+ static get type(): string;
48
+ static get collectionName(): string;
49
+ static get attributes(): any;
50
+ /**
51
+ * Map attributes between external and internal representation.
52
+ */
53
+ static get attributeMapping(): {};
54
+ get isAdmin(): boolean;
55
+ get areRepositoryNamesCaseSensitive(): any;
56
+ get areRepositoryGroupNamesCaseSensitive(): any;
57
+ }
58
+ import { OwnedObject } from "./owned-object.mjs";
59
+ export {};
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Mixin to define a class able to handle a collection of repositories.
3
+ * @param {Object} base to be extendet
4
+ */
5
+ export function RepositoryOwner(base: any): {
6
+ new (): {
7
+ [x: string]: any;
8
+ "__#2@#repositories": Map<any, any>;
9
+ /**
10
+ * Normalizes a repository name.
11
+ * Strips branch away.
12
+ * @param {string} name
13
+ * @param {boolean} forLookup
14
+ * @return {string} normalized name
15
+ */
16
+ normalizeRepositoryName(name: string, forLookup: boolean): string;
17
+ /**
18
+ * Lookup a repository.
19
+ * @param {string} [name] of the repository may contain a #branch
20
+ * @return {Promise<Repository|undefined>}
21
+ */
22
+ repository(name?: string): Promise<Repository | undefined>;
23
+ /**
24
+ * List repositories for the owner.
25
+ * @param {string[]|string} [patterns]
26
+ * @return {AsyncIterable<Repository>} all matching repositories of the owner
27
+ */
28
+ repositories(patterns?: string[] | string): AsyncIterable<Repository>;
29
+ /**
30
+ * Lookup entity of a given type and name.
31
+ * @param {string} type
32
+ * @param {string} [name]
33
+ * @param {function} [split]
34
+ * @param {Object} [defaultItem]
35
+ * @returns {Promise<OwnedObject|undefined>} from a repository
36
+ */
37
+ lookup(type: string, name?: string, split?: Function, defaultItem?: any): Promise<OwnedObject | undefined>;
38
+ /**
39
+ * List entities for a given type and pattern.
40
+ * @param {string} type
41
+ * @param {string[]|string} [patterns]
42
+ * @param {function} [split]
43
+ * @param {Object} [defaultItem]
44
+ * @return {AsyncIterable<OwnedObject>} matching type and pattern
45
+ */
46
+ list(type: string, patterns?: string[] | string, split?: Function, defaultItem?: any): AsyncIterable<OwnedObject>;
47
+ /**
48
+ * Create a new {@link Repository} in the provider.
49
+ * If there is already if repository for the given name it will be returned.
50
+ * @param {string} name
51
+ * @param {Object} [options]
52
+ * @return {Promise<Repository>} newly created repository (if not already present)
53
+ */
54
+ createRepository(name: string, options?: any): Promise<Repository>;
55
+ /**
56
+ * Add a {@link Repository} to the group.
57
+ * Only adds the repository to the in memory representation (does not execute any provider actions).
58
+ * @param {string} name
59
+ * @param {Object} [options]
60
+ * @return {Promise<Repository>} newly created repository
61
+ */
62
+ addRepository(name: string, options?: any): Promise<Repository>;
63
+ _addRepository(repository: any): void;
64
+ /**
65
+ * Delete a repository.
66
+ * @param {string} name
67
+ * @return {Promise<any>}
68
+ */
69
+ deleteRepository(name: string): Promise<any>;
70
+ initializeRepositories(): void;
71
+ /**
72
+ * Lookup a branch.
73
+ * First lookup repository then the branch.
74
+ * If no branch was specified then the default branch will be delivered.
75
+ * @see {@link Repository#defaultBranch}
76
+ * @param {string} name with optional branch name as '#myBranchName'
77
+ * @return {Promise<Branch|undefined>}
78
+ */
79
+ branch(name: string): Promise<Branch | undefined>;
80
+ /**
81
+ * List branches for the owner.
82
+ * @param {string[]|string} [patterns]
83
+ * @return {AsyncIterable<Branch>} all matching branches of the owner
84
+ */
85
+ branches(patterns?: string[] | string): AsyncIterable<Branch>;
86
+ tag(name: any): Promise<OwnedObject>;
87
+ tags(patterns: any): AsyncGenerator<OwnedObject, void, undefined>;
88
+ pullRequest(name: any): Promise<OwnedObject>;
89
+ pullRequests(patterns: any): AsyncGenerator<OwnedObject, void, undefined>;
90
+ project(name: any): Promise<OwnedObject>;
91
+ projects(patterns: any): AsyncGenerator<OwnedObject, void, undefined>;
92
+ application(name: any): Promise<OwnedObject>;
93
+ applications(patterns: any): AsyncGenerator<OwnedObject, void, undefined>;
94
+ milestone(name: any): Promise<OwnedObject>;
95
+ milestones(patterns: any): AsyncGenerator<OwnedObject, void, undefined>;
96
+ hook(name: any): Promise<OwnedObject>;
97
+ hooks(patterns: any): AsyncGenerator<OwnedObject, void, undefined>;
98
+ };
99
+ [x: string]: any;
100
+ };
101
+ import { Repository } from "./repository.mjs";
102
+ import { OwnedObject } from "./owned-object.mjs";
103
+ import { Branch } from "./branch.mjs";