github-repository-provider 9.0.21 → 9.1.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.
package/LICENSE CHANGED
@@ -1,23 +1,12 @@
1
- Copyright (c) 2017-2024 by arlac77
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without
5
- modification, are permitted provided that the following conditions are met:
6
-
7
- * Redistributions of source code must retain the above copyright notice, this
8
- list of conditions and the following disclaimer.
9
-
10
- * Redistributions in binary form must reproduce the above copyright notice,
11
- this list of conditions and the following disclaimer in the documentation
12
- and/or other materials provided with the distribution.
13
-
14
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ Copyright (C) 2017-2025 by arlac77
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted.
5
+
6
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
8
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
9
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
10
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
11
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
12
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![npm](https://img.shields.io/npm/v/github-repository-provider.svg)](https://www.npmjs.com/package/github-repository-provider)
2
- [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
2
+ [![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html)
3
3
  [![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript\&label\&labelColor=blue\&color=555555)](https://typescriptlang.org)
4
4
  [![bundlejs](https://deno.bundlejs.com/?q=github-repository-provider\&badge=detailed)](https://bundlejs.com/?q=github-repository-provider)
5
5
  [![downloads](http://img.shields.io/npm/dm/github-repository-provider.svg?style=flat-square)](https://npmjs.org/package/github-repository-provider)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-repository-provider",
3
- "version": "9.0.21",
3
+ "version": "9.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -22,40 +22,40 @@
22
22
  "email": "markus.felten@gmx.de"
23
23
  }
24
24
  ],
25
- "license": "BSD-2-Clause",
25
+ "license": "0BSD",
26
26
  "scripts": {
27
- "prepare": "npm run prepare:typescript",
28
- "prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
29
- "test": "npm run test:ava",
27
+ "prepare": "node --run prepare:typescript",
28
+ "prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule --target esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
29
+ "test": "node --run test:ava",
30
30
  "test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
31
31
  "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",
32
- "docs": "documentation readme --section=API ./src/**/*.mjs",
33
- "lint": "npm run lint:docs && npm run lint:typescript",
34
- "lint:docs": "documentation lint ./src/**/*.mjs",
35
- "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
32
+ "docs": "documentation readme --section=API ./src**/*.mjs",
33
+ "lint": "node --run lint:docs && node --run lint:typescript",
34
+ "lint:docs": "documentation lint ./src**/*.mjs",
35
+ "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
36
36
  },
37
37
  "dependencies": {
38
- "content-entry": "^11.0.1",
38
+ "content-entry": "^13.0.4",
39
39
  "fetch-link-util": "^1.1.1",
40
- "fetch-rate-limit-util": "^4.4.0",
40
+ "fetch-rate-limit-util": "^4.4.1",
41
41
  "matching-iterator": "^2.1.3",
42
42
  "one-time-execution-method": "^3.1.1",
43
- "repository-provider": "^35.2.23"
43
+ "repository-provider": "^35.3.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@types/node": "^22.1.0",
47
- "ava": "^6.1.3",
48
- "c8": "^10.1.2",
46
+ "@types/node": "^22.15.3",
47
+ "ava": "^6.3.0",
48
+ "c8": "^10.1.3",
49
49
  "documentation": "^14.0.3",
50
- "etag-cache-leveldb": "^2.1.4",
50
+ "etag-cache-leveldb": "^2.1.8",
51
51
  "leveldown": "^6.1.1",
52
52
  "levelup": "^5.1.1",
53
- "repository-provider-test-support": "^3.1.7",
54
- "semantic-release": "^24.0.0",
55
- "typescript": "^5.5.4"
53
+ "repository-provider-test-support": "^3.1.11",
54
+ "semantic-release": "^24.2.3",
55
+ "typescript": "^5.8.3"
56
56
  },
57
57
  "engines": {
58
- "node": ">=20.12.2"
58
+ "node": ">=22.15.0"
59
59
  },
60
60
  "repository": {
61
61
  "type": "git",
@@ -2,7 +2,7 @@ import { matcher } from "matching-iterator";
2
2
  import { Branch } from "repository-provider";
3
3
  import {
4
4
  CollectionEntry,
5
- BufferContentEntryMixin,
5
+ BufferContentEntry,
6
6
  ContentEntry
7
7
  } from "content-entry";
8
8
 
@@ -103,7 +103,7 @@ export class GithubBranch extends Branch {
103
103
  }
104
104
 
105
105
  /**
106
- *
106
+ *
107
107
  * @param {string[]|string} patterns
108
108
  * @return {AsyncGenerator<ContentEntry>} all matching entries in the branch
109
109
  */
@@ -158,7 +158,7 @@ export class GithubBranch extends Branch {
158
158
  }
159
159
  }
160
160
 
161
- class LazyBufferContentEntry extends BufferContentEntryMixin(ContentEntry) {
161
+ class LazyBufferContentEntry extends BufferContentEntry {
162
162
  constructor(name, mode, branch) {
163
163
  super(name);
164
164
  Object.defineProperty(this, "mode", { value: mode });
@@ -169,11 +169,13 @@ class LazyBufferContentEntry extends BufferContentEntryMixin(ContentEntry) {
169
169
  return this.getBuffer();
170
170
  }
171
171
 
172
- #buffer;
172
+ set buffer(value) {
173
+ this._buffer = value;
174
+ }
173
175
 
174
176
  async getBuffer() {
175
- if (this.#buffer) {
176
- return this.#buffer;
177
+ if (this._buffer) {
178
+ return this._buffer;
177
179
  }
178
180
 
179
181
  const branch = this.branch;
@@ -183,11 +185,11 @@ class LazyBufferContentEntry extends BufferContentEntryMixin(ContentEntry) {
183
185
  `${branch.api}/contents/${this.name}?ref=${branch.ref}`
184
186
  );
185
187
 
186
- this.#buffer = Buffer.from(json.content, "base64");
187
- return this.#buffer;
188
+ this._buffer = Buffer.from(json.content, "base64");
189
+ return this._buffer;
188
190
  };
189
191
 
190
- this.#buffer = f();
191
- return this.#buffer;
192
+ this._buffer = f();
193
+ return this._buffer;
192
194
  }
193
195
  }
@@ -80,14 +80,11 @@ export class GithubRepository extends Repository {
80
80
  const { response, json } = await this.provider.fetchJSON(next);
81
81
 
82
82
  for (const c of json) {
83
- this.#commits.set(c.sha, json);
84
-
85
- yield {
86
- sha: c.sha,
87
- message: c.message,
88
- author: c.author,
89
- committer: c.committer
90
- };
83
+ const commit = new Commit(this, c);
84
+
85
+ this.#commits.set(commit.sha, commit);
86
+
87
+ yield commit;
91
88
  }
92
89
  next = getHeaderLink(response.headers);
93
90
  } while (next);
@@ -113,7 +110,7 @@ export class GithubRepository extends Repository {
113
110
  * @return {Promise<Object>} response
114
111
  */
115
112
  async commitForSha(sha) {
116
- const commit = this.#commits.get(sha);
113
+ let commit = this.#commits.get(sha);
117
114
  if (commit) {
118
115
  return commit;
119
116
  }
@@ -122,9 +119,11 @@ export class GithubRepository extends Repository {
122
119
  `${this.api}/git/commits/${sha}`
123
120
  );
124
121
 
125
- this.#commits.set(sha, json);
122
+ commit = new Commit(this, json);
126
123
 
127
- return json;
124
+ this.#commits.set(commit.sha, commit);
125
+
126
+ return commit;
128
127
  }
129
128
 
130
129
  /**
@@ -39,11 +39,7 @@ export class GithubRepository extends Repository {
39
39
  isDisabled: import("pacc").AttributeDefinition;
40
40
  isTemplate: import("pacc").AttributeDefinition;
41
41
  isFork: import("pacc").AttributeDefinition;
42
- id: import(
43
- /**
44
- * @return {string} "main"
45
- */
46
- "pacc").AttributeDefinition;
42
+ id: import("pacc").AttributeDefinition;
47
43
  name: import("pacc").AttributeDefinition;
48
44
  description: import("pacc").AttributeDefinition;
49
45
  };