repository-provider 35.2.12 → 35.2.14
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 +5 -3
- package/package.json +1 -1
- package/src/base-provider.mjs +29 -13
- package/types/base-provider.d.mts +27 -19
package/README.md
CHANGED
|
@@ -639,7 +639,7 @@ Takes values from options.
|
|
|
639
639
|
|
|
640
640
|
#### Parameters
|
|
641
641
|
|
|
642
|
-
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
642
|
+
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
643
643
|
* `additionalProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
644
644
|
|
|
645
645
|
### update
|
|
@@ -930,9 +930,10 @@ Creates a new provider for a given set of options.
|
|
|
930
930
|
|
|
931
931
|
#### Parameters
|
|
932
932
|
|
|
933
|
-
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** additional options
|
|
933
|
+
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** additional options
|
|
934
934
|
|
|
935
935
|
* `options.instanceIdentifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** name of the provider instance
|
|
936
|
+
* `options.description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
|
|
936
937
|
* `env` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** taken from process.env
|
|
937
938
|
|
|
938
939
|
Returns **([BaseProvider](#baseprovider) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** newly created provider or undefined if options are not sufficient to construct a provider
|
|
@@ -1178,9 +1179,10 @@ Creates a new provider for a given set of options.
|
|
|
1178
1179
|
|
|
1179
1180
|
#### Parameters
|
|
1180
1181
|
|
|
1181
|
-
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** additional options
|
|
1182
|
+
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** additional options
|
|
1182
1183
|
|
|
1183
1184
|
* `options.instanceIdentifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** name of the provider instance
|
|
1185
|
+
* `options.description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
|
|
1184
1186
|
* `env` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** taken from process.env
|
|
1185
1187
|
|
|
1186
1188
|
Returns **([BaseProvider](#baseprovider) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** newly created provider or undefined if options are not sufficient to construct a provider
|
package/package.json
CHANGED
package/src/base-provider.mjs
CHANGED
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
default_attribute
|
|
16
16
|
} from "./attributes.mjs";
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* @typedef {import('./project.mjs').Project} Project
|
|
20
|
-
* @typedef {import('./milestone.mjs').Milestone} Milestone
|
|
21
|
-
*/
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {import('./project.mjs').Project} Project
|
|
20
|
+
* @typedef {import('./milestone.mjs').Milestone} Milestone
|
|
21
|
+
*/
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* @typedef {Object} MessageDestination
|
|
@@ -143,6 +143,11 @@ export class BaseProvider extends BaseObject {
|
|
|
143
143
|
return 0;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
/**
|
|
147
|
+
* @typedef {Object} parsedName
|
|
148
|
+
*
|
|
149
|
+
*/
|
|
150
|
+
|
|
146
151
|
/**
|
|
147
152
|
* Creates a new provider for a given set of options.
|
|
148
153
|
* @param {Object} options additional options
|
|
@@ -163,7 +168,7 @@ export class BaseProvider extends BaseObject {
|
|
|
163
168
|
}
|
|
164
169
|
|
|
165
170
|
/**
|
|
166
|
-
* @param {any} other
|
|
171
|
+
* @param {any} other
|
|
167
172
|
* @return {boolean} true if other provider is the same as the receiver
|
|
168
173
|
*/
|
|
169
174
|
equals(other) {
|
|
@@ -199,11 +204,11 @@ export class BaseProvider extends BaseObject {
|
|
|
199
204
|
* Like .git suffix or #branch names.
|
|
200
205
|
* @param {string} name
|
|
201
206
|
* @param {boolean} forLookup
|
|
202
|
-
* @return {string} normalized name
|
|
207
|
+
* @return {string|undefined} normalized name
|
|
203
208
|
*/
|
|
204
209
|
normalizeRepositoryName(name, forLookup) {
|
|
205
210
|
const { repository } = this.parseName(name);
|
|
206
|
-
return forLookup && !this.areRepositoryNamesCaseSensitive
|
|
211
|
+
return repository && forLookup && !this.areRepositoryNamesCaseSensitive
|
|
207
212
|
? repository.toLowerCase()
|
|
208
213
|
: repository;
|
|
209
214
|
}
|
|
@@ -213,7 +218,7 @@ export class BaseProvider extends BaseObject {
|
|
|
213
218
|
* Like .git suffix or #branch names.
|
|
214
219
|
* @param {string} name
|
|
215
220
|
* @param {boolean} forLookup
|
|
216
|
-
* @return {string} normalized name
|
|
221
|
+
* @return {string|undefined} normalized name
|
|
217
222
|
*/
|
|
218
223
|
normalizeGroupName(name, forLookup) {
|
|
219
224
|
const { group } = this.parseName(name, "group");
|
|
@@ -245,12 +250,13 @@ export class BaseProvider extends BaseObject {
|
|
|
245
250
|
* base, group, repository and branch.
|
|
246
251
|
* @param {string} [name]
|
|
247
252
|
* @param {string} focus where lies the focus if only one path component is given
|
|
248
|
-
* @return {
|
|
253
|
+
* @return {{base: string|undefined, group: string|undefined, repository: string|undefined, branch: string|undefined}} with separated attributes
|
|
249
254
|
*/
|
|
250
255
|
parseName(name, focus = "repository") {
|
|
251
256
|
const result = {};
|
|
252
257
|
|
|
253
258
|
if (name === undefined) {
|
|
259
|
+
// @ts-ignore
|
|
254
260
|
return result;
|
|
255
261
|
}
|
|
256
262
|
|
|
@@ -295,6 +301,7 @@ export class BaseProvider extends BaseObject {
|
|
|
295
301
|
}
|
|
296
302
|
}
|
|
297
303
|
|
|
304
|
+
// @ts-ignore
|
|
298
305
|
return result;
|
|
299
306
|
}
|
|
300
307
|
|
|
@@ -310,12 +317,13 @@ export class BaseProvider extends BaseObject {
|
|
|
310
317
|
const rg = await this.repositoryGroup(group);
|
|
311
318
|
return rg.createRepository(repository, options);
|
|
312
319
|
}
|
|
313
|
-
|
|
320
|
+
|
|
314
321
|
/**
|
|
315
322
|
* List provider objects of a given type.
|
|
316
323
|
*
|
|
317
324
|
* @param {string} type name of the method to deliver typed iterator projects,milestones,hooks,repositories,branches,tags
|
|
318
325
|
* @param {string[]|string|undefined} patterns group / repository filter
|
|
326
|
+
* @return {AsyncIterable<Repository|PullRequest|Branch|Tag|Project|Milestone|Hook>} all matching repositories of the providers
|
|
319
327
|
*/
|
|
320
328
|
async *list(type, patterns) {
|
|
321
329
|
if (patterns === undefined) {
|
|
@@ -325,6 +333,7 @@ export class BaseProvider extends BaseObject {
|
|
|
325
333
|
}
|
|
326
334
|
} else {
|
|
327
335
|
for (const pattern of asArray(patterns)) {
|
|
336
|
+
// @ts-ignore
|
|
328
337
|
const [groupPattern, repoPattern] = stripBaseName(
|
|
329
338
|
pattern,
|
|
330
339
|
this.repositoryBases
|
|
@@ -341,18 +350,20 @@ export class BaseProvider extends BaseObject {
|
|
|
341
350
|
/**
|
|
342
351
|
* List projects.
|
|
343
352
|
* @param {string[]|string} [patterns]
|
|
344
|
-
* @return {
|
|
353
|
+
* @return {AsyncIterable<Project>} all matching projects of the provider
|
|
345
354
|
*/
|
|
346
355
|
async *projects(patterns) {
|
|
356
|
+
// @ts-ignore
|
|
347
357
|
yield* this.list("projects", patterns);
|
|
348
358
|
}
|
|
349
359
|
|
|
350
360
|
/**
|
|
351
361
|
* List milestones.
|
|
352
362
|
* @param {string[]|string} [patterns]
|
|
353
|
-
* @return {
|
|
363
|
+
* @return {AsyncIterable<Milestone>} all matching milestones of the provider
|
|
354
364
|
*/
|
|
355
365
|
async *milestones(patterns) {
|
|
366
|
+
// @ts-ignore
|
|
356
367
|
yield* this.list("milestones", patterns);
|
|
357
368
|
}
|
|
358
369
|
|
|
@@ -362,6 +373,7 @@ export class BaseProvider extends BaseObject {
|
|
|
362
373
|
* @return {AsyncIterable<Repository>} all matching repos of the provider
|
|
363
374
|
*/
|
|
364
375
|
async *repositories(patterns) {
|
|
376
|
+
// @ts-ignore
|
|
365
377
|
yield* this.list("repositories", patterns);
|
|
366
378
|
}
|
|
367
379
|
|
|
@@ -371,6 +383,7 @@ export class BaseProvider extends BaseObject {
|
|
|
371
383
|
* @return {AsyncIterable<Branch>} all matching branches of the provider
|
|
372
384
|
*/
|
|
373
385
|
async *branches(patterns) {
|
|
386
|
+
// @ts-ignore
|
|
374
387
|
yield* this.list("branches", patterns);
|
|
375
388
|
}
|
|
376
389
|
|
|
@@ -380,6 +393,7 @@ export class BaseProvider extends BaseObject {
|
|
|
380
393
|
* @return {AsyncIterable<Tag>} all matching tags of the provider
|
|
381
394
|
*/
|
|
382
395
|
async *tags(patterns) {
|
|
396
|
+
// @ts-ignore
|
|
383
397
|
yield* this.list("tags", patterns);
|
|
384
398
|
}
|
|
385
399
|
|
|
@@ -389,6 +403,7 @@ export class BaseProvider extends BaseObject {
|
|
|
389
403
|
* @return {AsyncIterable<Hook>} all matching hooks of the provider
|
|
390
404
|
*/
|
|
391
405
|
async *hooks(patterns) {
|
|
406
|
+
// @ts-ignore
|
|
392
407
|
yield* this.list("hooks", patterns);
|
|
393
408
|
}
|
|
394
409
|
|
|
@@ -398,6 +413,7 @@ export class BaseProvider extends BaseObject {
|
|
|
398
413
|
* @return {AsyncIterable<PullRequest>} all matching pullRequests of the provider
|
|
399
414
|
*/
|
|
400
415
|
async *pullRequests(patterns) {
|
|
416
|
+
// @ts-ignore
|
|
401
417
|
yield* this.list("pullRequests", patterns);
|
|
402
418
|
}
|
|
403
419
|
|
|
@@ -419,7 +435,7 @@ export class BaseProvider extends BaseObject {
|
|
|
419
435
|
|
|
420
436
|
/**
|
|
421
437
|
* List all defined entries from attributes.
|
|
422
|
-
* return {object}
|
|
438
|
+
* @return {object}
|
|
423
439
|
*/
|
|
424
440
|
toJSON() {
|
|
425
441
|
const json = { name: this.name };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {import('./project.mjs').Project} Project
|
|
3
|
-
* @typedef {import('./milestone.mjs').Milestone} Milestone
|
|
4
|
-
*/
|
|
2
|
+
* @typedef {import('./project.mjs').Project} Project
|
|
3
|
+
* @typedef {import('./milestone.mjs').Milestone} Milestone
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {Object} MessageDestination
|
|
7
7
|
* Endpoint to deliver log messages to.
|
|
@@ -79,6 +79,10 @@ export class BaseProvider extends BaseObject {
|
|
|
79
79
|
env?: string | string[];
|
|
80
80
|
};
|
|
81
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* @typedef {Object} parsedName
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
82
86
|
/**
|
|
83
87
|
* Creates a new provider for a given set of options.
|
|
84
88
|
* @param {Object} options additional options
|
|
@@ -120,17 +124,17 @@ export class BaseProvider extends BaseObject {
|
|
|
120
124
|
* Like .git suffix or #branch names.
|
|
121
125
|
* @param {string} name
|
|
122
126
|
* @param {boolean} forLookup
|
|
123
|
-
* @return {string} normalized name
|
|
127
|
+
* @return {string|undefined} normalized name
|
|
124
128
|
*/
|
|
125
|
-
normalizeRepositoryName(name: string, forLookup: boolean): string;
|
|
129
|
+
normalizeRepositoryName(name: string, forLookup: boolean): string | undefined;
|
|
126
130
|
/**
|
|
127
131
|
* Bring a group name into its normal form by removing any clutter.
|
|
128
132
|
* Like .git suffix or #branch names.
|
|
129
133
|
* @param {string} name
|
|
130
134
|
* @param {boolean} forLookup
|
|
131
|
-
* @return {string} normalized name
|
|
135
|
+
* @return {string|undefined} normalized name
|
|
132
136
|
*/
|
|
133
|
-
normalizeGroupName(name: string, forLookup: boolean): string;
|
|
137
|
+
normalizeGroupName(name: string, forLookup: boolean): string | undefined;
|
|
134
138
|
/**
|
|
135
139
|
* Are repository names case sensitive.
|
|
136
140
|
* Overwrite and return false if you want to have case insensitive repository lookup.
|
|
@@ -148,9 +152,14 @@ export class BaseProvider extends BaseObject {
|
|
|
148
152
|
* base, group, repository and branch.
|
|
149
153
|
* @param {string} [name]
|
|
150
154
|
* @param {string} focus where lies the focus if only one path component is given
|
|
151
|
-
* @return {
|
|
155
|
+
* @return {{base: string|undefined, group: string|undefined, repository: string|undefined, branch: string|undefined}} with separated attributes
|
|
152
156
|
*/
|
|
153
|
-
parseName(name?: string, focus?: string):
|
|
157
|
+
parseName(name?: string, focus?: string): {
|
|
158
|
+
base: string | undefined;
|
|
159
|
+
group: string | undefined;
|
|
160
|
+
repository: string | undefined;
|
|
161
|
+
branch: string | undefined;
|
|
162
|
+
};
|
|
154
163
|
/**
|
|
155
164
|
* Create a repository.
|
|
156
165
|
* @param {string} name of group and repository
|
|
@@ -163,20 +172,21 @@ export class BaseProvider extends BaseObject {
|
|
|
163
172
|
*
|
|
164
173
|
* @param {string} type name of the method to deliver typed iterator projects,milestones,hooks,repositories,branches,tags
|
|
165
174
|
* @param {string[]|string|undefined} patterns group / repository filter
|
|
175
|
+
* @return {AsyncIterable<Repository|PullRequest|Branch|Tag|Project|Milestone|Hook>} all matching repositories of the providers
|
|
166
176
|
*/
|
|
167
|
-
list(type: string, patterns: string[] | string | undefined):
|
|
177
|
+
list(type: string, patterns: string[] | string | undefined): AsyncIterable<Repository | PullRequest | Branch | Tag | Project | Milestone | Hook>;
|
|
168
178
|
/**
|
|
169
179
|
* List projects.
|
|
170
180
|
* @param {string[]|string} [patterns]
|
|
171
|
-
* @return {
|
|
181
|
+
* @return {AsyncIterable<Project>} all matching projects of the provider
|
|
172
182
|
*/
|
|
173
|
-
projects(patterns?: string[] | string):
|
|
183
|
+
projects(patterns?: string[] | string): AsyncIterable<Project>;
|
|
174
184
|
/**
|
|
175
185
|
* List milestones.
|
|
176
186
|
* @param {string[]|string} [patterns]
|
|
177
|
-
* @return {
|
|
187
|
+
* @return {AsyncIterable<Milestone>} all matching milestones of the provider
|
|
178
188
|
*/
|
|
179
|
-
milestones(patterns?: string[] | string):
|
|
189
|
+
milestones(patterns?: string[] | string): AsyncIterable<Milestone>;
|
|
180
190
|
/**
|
|
181
191
|
* List repositories.
|
|
182
192
|
* @param {string[]|string} [patterns]
|
|
@@ -219,11 +229,9 @@ export class BaseProvider extends BaseObject {
|
|
|
219
229
|
get provider(): BaseProvider;
|
|
220
230
|
/**
|
|
221
231
|
* List all defined entries from attributes.
|
|
222
|
-
* return {object}
|
|
232
|
+
* @return {object}
|
|
223
233
|
*/
|
|
224
|
-
toJSON():
|
|
225
|
-
name: string;
|
|
226
|
-
};
|
|
234
|
+
toJSON(): object;
|
|
227
235
|
initializeRepositories(): void;
|
|
228
236
|
trace(...args: any[]): any;
|
|
229
237
|
debug(...args: any[]): any;
|
|
@@ -252,9 +260,9 @@ export type MessageDestination = {
|
|
|
252
260
|
};
|
|
253
261
|
import { BaseObject } from "./base-object.mjs";
|
|
254
262
|
import { Repository } from "./repository.mjs";
|
|
263
|
+
import { PullRequest } from "./pull-request.mjs";
|
|
255
264
|
import { Branch } from "./branch.mjs";
|
|
256
265
|
import { Tag } from "./tag.mjs";
|
|
257
266
|
import { Hook } from "./hook.mjs";
|
|
258
|
-
import { PullRequest } from "./pull-request.mjs";
|
|
259
267
|
import { RepositoryGroup } from "./repository-group.mjs";
|
|
260
268
|
import { ContentEntry } from "content-entry";
|