repository-provider 28.4.1 → 28.4.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/repository.mjs +31 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "28.4.1",
3
+ "version": "28.4.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -66,15 +66,15 @@ export class Repository extends OwnedObject {
66
66
  };
67
67
  }
68
68
 
69
+ #branches = new Map();
70
+ #tags = new Map();
71
+ #projects = new Map();
72
+ #milestones = new Map();
73
+ #pullRequests = new Map();
74
+ #hooks = [];
75
+
69
76
  constructor(owner, name, options) {
70
- super(owner, owner.normalizeRepositoryName(name, false), options, {
71
- _branches: { value: new Map() },
72
- _tags: { value: new Map() },
73
- _pullRequests: { value: new Map() },
74
- _milestones: { value: new Map() },
75
- _projects: { value: new Map() },
76
- _hooks: { value: [] }
77
- });
77
+ super(owner, owner.normalizeRepositoryName(name, false), options);
78
78
  }
79
79
 
80
80
  /**
@@ -242,11 +242,11 @@ export class Repository extends OwnedObject {
242
242
  */
243
243
  async branch(name) {
244
244
  if(name === this.defaultBranchName) {
245
- return this._branches.get(name) || this.addBranch(name);
245
+ return this.#branches.get(name) || this.addBranch(name);
246
246
  }
247
247
 
248
248
  await this.initializeBranches();
249
- return this._branches.get(name);
249
+ return this.#branches.get(name);
250
250
  }
251
251
 
252
252
  /**
@@ -254,7 +254,7 @@ export class Repository extends OwnedObject {
254
254
  */
255
255
  async *branches(patterns) {
256
256
  await this.initializeBranches();
257
- yield* matcher(this._branches.values(), patterns, {
257
+ yield* matcher(this.#branches.values(), patterns, {
258
258
  name: "name"
259
259
  });
260
260
  }
@@ -279,11 +279,11 @@ export class Repository extends OwnedObject {
279
279
  * @return {Branch} newly created branch
280
280
  */
281
281
  addBranch(name, options) {
282
- return this._branches.get(name) || new this.branchClass(this, name, options);
282
+ return this.#branches.get(name) || new this.branchClass(this, name, options);
283
283
  }
284
284
 
285
285
  _addBranch(branch) {
286
- this._branches.set(branch.name, branch);
286
+ this.#branches.set(branch.name, branch);
287
287
  }
288
288
 
289
289
  /**
@@ -292,7 +292,7 @@ export class Repository extends OwnedObject {
292
292
  * @return {Promise<any>}
293
293
  */
294
294
  async deleteBranch(name) {
295
- this._branches.delete(name);
295
+ this.#branches.delete(name);
296
296
  }
297
297
 
298
298
  /**
@@ -302,7 +302,7 @@ export class Repository extends OwnedObject {
302
302
  */
303
303
  async tag(name) {
304
304
  await this.initializeTags();
305
- return this._tags.get(name);
305
+ return this.#tags.get(name);
306
306
  }
307
307
 
308
308
  /**
@@ -312,7 +312,7 @@ export class Repository extends OwnedObject {
312
312
  async *tags(patterns) {
313
313
  await this.initializeTags();
314
314
 
315
- yield* matcher(this._tags.values(), patterns, {
315
+ yield* matcher(this.#tags.values(), patterns, {
316
316
  name: "name"
317
317
  });
318
318
  }
@@ -325,11 +325,11 @@ export class Repository extends OwnedObject {
325
325
  * @return {Tag} newly created tag
326
326
  */
327
327
  addTag(name, options) {
328
- return this._tags.get(name) || new this.tagClass(this, name, options);
328
+ return this.#tags.get(name) || new this.tagClass(this, name, options);
329
329
  }
330
330
 
331
331
  _addTag(tag) {
332
- this._tags.set(tag.name, tag);
332
+ this.#tags.set(tag.name, tag);
333
333
  }
334
334
 
335
335
  /**
@@ -355,13 +355,13 @@ export class Repository extends OwnedObject {
355
355
  let pr = this._pullRequests.get(name);
356
356
  if (pr === undefined) {
357
357
  pr = new this.pullRequestClass(name, source, this, options);
358
- this._pullRequests.set(pr.name, pr);
358
+ this.#pullRequests.set(pr.name, pr);
359
359
  }
360
360
  return pr;
361
361
  }
362
362
 
363
363
  _addPullRequest(pr) {
364
- this._pullRequests.set(pr.name, pr);
364
+ this.#pullRequests.set(pr.name, pr);
365
365
  }
366
366
 
367
367
  /**
@@ -371,7 +371,7 @@ export class Repository extends OwnedObject {
371
371
  async *pullRequests() {
372
372
  await this.initializePullRequests();
373
373
 
374
- for (const pr of this._pullRequests.values()) {
374
+ for (const pr of this.#pullRequests.values()) {
375
375
  yield pr;
376
376
  }
377
377
  }
@@ -383,7 +383,7 @@ export class Repository extends OwnedObject {
383
383
  */
384
384
  async pullRequest(name) {
385
385
  await this.initializePullRequests();
386
- return this._pullRequests.get(name);
386
+ return this.#pullRequests.get(name);
387
387
  }
388
388
 
389
389
  /**
@@ -392,7 +392,7 @@ export class Repository extends OwnedObject {
392
392
  * @return {Promise<any>}
393
393
  */
394
394
  async deletePullRequest(name) {
395
- this._pullRequests.delete(name);
395
+ this.#pullRequests.delete(name);
396
396
  }
397
397
 
398
398
  /**
@@ -400,11 +400,11 @@ export class Repository extends OwnedObject {
400
400
  * @param {Hook} hook
401
401
  */
402
402
  addHook(hook) {
403
- this._hooks.push(hook);
403
+ this.#hooks.push(hook);
404
404
  }
405
405
 
406
406
  _addHook(hook) {
407
- this._hooks.push(hook);
407
+ this.#hooks.push(hook);
408
408
  }
409
409
 
410
410
  /**
@@ -421,7 +421,7 @@ export class Repository extends OwnedObject {
421
421
  */
422
422
  async *hooks() {
423
423
  await this.initializeHooks();
424
- for (const hook of this._hooks) {
424
+ for (const hook of this.#hooks) {
425
425
  yield hook;
426
426
  }
427
427
  }
@@ -441,19 +441,19 @@ export class Repository extends OwnedObject {
441
441
  }
442
442
 
443
443
  _addMilestone(milestone) {
444
- this._milestones.set(milestone.name, milestone);
444
+ this.#milestones.set(milestone.name, milestone);
445
445
  }
446
446
 
447
447
  async milestone(name) {
448
- return this._milestones.get(name);
448
+ return this.#milestones.get(name);
449
449
  }
450
450
 
451
451
  _addProject(project) {
452
- this._projects.set(project.name, project);
452
+ this.#projects.set(project.name, project);
453
453
  }
454
454
 
455
455
  async project(name) {
456
- return this._projects.get(name);
456
+ return this.#projects.get(name);
457
457
  }
458
458
 
459
459
  /**
@@ -507,7 +507,7 @@ export class Repository extends OwnedObject {
507
507
 
508
508
  async initializePullRequests() {
509
509
  for await (const pr of this.pullRequestClass.list(this)) {
510
- this._pullRequests.set(pr.name, pr);
510
+ this.#pullRequests.set(pr.name, pr);
511
511
  }
512
512
  }
513
513
  }