@atolis-hq/wake 0.1.19 → 0.1.20
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.
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
import { Octokit } from '@octokit/rest';
|
|
2
2
|
import { createEtagCache, fetchPaginatedWithEtag, fetchSingleWithEtag, } from './github-etag-cache.js';
|
|
3
|
+
// Octokit's built-in request-log plugin routes every non-2xx response
|
|
4
|
+
// through `log.error` (console.error by default) before the error reaches
|
|
5
|
+
// our code, including the 304s that ETag-based conditional requests are
|
|
6
|
+
// *expected* to produce (see github-etag-cache.ts). Without this override,
|
|
7
|
+
// normal cache-hit traffic prints as spurious stderr errors. The plugin only
|
|
8
|
+
// hands `log.error` a pre-formatted string (`METHOD path - STATUS with id
|
|
9
|
+
// ID in Nms`), not the response object, so we extract the actual status
|
|
10
|
+
// code from that fixed format rather than substring-matching "304"
|
|
11
|
+
// anywhere in the message.
|
|
12
|
+
function requestLogStatus(message) {
|
|
13
|
+
const match = / - (\d{3}) with id /.exec(message);
|
|
14
|
+
return match === null ? undefined : Number(match[1]);
|
|
15
|
+
}
|
|
3
16
|
export function createGitHubClient(token) {
|
|
4
|
-
const octokit = new Octokit({
|
|
17
|
+
const octokit = new Octokit({
|
|
18
|
+
auth: token,
|
|
19
|
+
log: {
|
|
20
|
+
debug: () => { },
|
|
21
|
+
info: () => { },
|
|
22
|
+
warn: console.warn.bind(console),
|
|
23
|
+
error: (message) => {
|
|
24
|
+
if (requestLogStatus(message) !== 304) {
|
|
25
|
+
console.error(message);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
5
30
|
const etagCache = createEtagCache();
|
|
6
31
|
return {
|
|
7
32
|
async getAuthenticatedLogin() {
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const wakeVersion = "0.1.
|
|
1
|
+
export const wakeVersion = "0.1.20+g944b4a0";
|