terminalhire 0.40.2 → 0.40.3
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.
|
@@ -21,8 +21,7 @@ function gate(openIds, seenIds) {
|
|
|
21
21
|
function computeFounderPaid(index, previous) {
|
|
22
22
|
const open = openPaidIds(index);
|
|
23
23
|
const prior = previous && previous.acknowledged;
|
|
24
|
-
|
|
25
|
-
return gate(open, prior);
|
|
24
|
+
return gate(open, Array.isArray(prior) ? prior : []);
|
|
26
25
|
}
|
|
27
26
|
function acknowledgeFounderPaid({ shown = [], open = [], previous } = {}) {
|
|
28
27
|
const prior = previous && Array.isArray(previous.acknowledged) ? previous.acknowledged : [];
|
package/dist/bin/jpi-bounties.js
CHANGED
|
@@ -11387,8 +11387,7 @@ function gate(openIds, seenIds) {
|
|
|
11387
11387
|
function computeFounderPaid(index, previous) {
|
|
11388
11388
|
const open = openPaidIds(index);
|
|
11389
11389
|
const prior = previous && previous.acknowledged;
|
|
11390
|
-
|
|
11391
|
-
return gate(open, prior);
|
|
11390
|
+
return gate(open, Array.isArray(prior) ? prior : []);
|
|
11392
11391
|
}
|
|
11393
11392
|
function acknowledgeFounderPaid({ shown = [], open = [], previous } = {}) {
|
|
11394
11393
|
const prior = previous && Array.isArray(previous.acknowledged) ? previous.acknowledged : [];
|
|
@@ -11465,7 +11464,7 @@ function readIndexCache() {
|
|
|
11465
11464
|
}
|
|
11466
11465
|
}
|
|
11467
11466
|
function writeIndexCache(index) {
|
|
11468
|
-
updateIndexCache({ index });
|
|
11467
|
+
updateIndexCache({ index, indexETag: "" });
|
|
11469
11468
|
}
|
|
11470
11469
|
async function fetchIndex() {
|
|
11471
11470
|
const cached = readIndexCache();
|
|
@@ -4095,7 +4095,7 @@ function readIndexCache() {
|
|
|
4095
4095
|
}
|
|
4096
4096
|
}
|
|
4097
4097
|
function writeIndexCache(index) {
|
|
4098
|
-
updateIndexCache({ index });
|
|
4098
|
+
updateIndexCache({ index, indexETag: "" });
|
|
4099
4099
|
}
|
|
4100
4100
|
async function fetchIndex(fetchImpl, useCache = true) {
|
|
4101
4101
|
if (useCache) {
|
package/dist/bin/jpi-dispatch.js
CHANGED
|
@@ -13710,7 +13710,7 @@ function readIndexCache() {
|
|
|
13710
13710
|
}
|
|
13711
13711
|
}
|
|
13712
13712
|
function writeIndexCache(index) {
|
|
13713
|
-
updateIndexCache({ index });
|
|
13713
|
+
updateIndexCache({ index, indexETag: "" });
|
|
13714
13714
|
}
|
|
13715
13715
|
async function fetchIndex() {
|
|
13716
13716
|
const cached2 = readIndexCache();
|
|
@@ -15124,8 +15124,7 @@ function gate(openIds, seenIds) {
|
|
|
15124
15124
|
function computeFounderPaid(index, previous) {
|
|
15125
15125
|
const open3 = openPaidIds(index);
|
|
15126
15126
|
const prior = previous && previous.acknowledged;
|
|
15127
|
-
|
|
15128
|
-
return gate(open3, prior);
|
|
15127
|
+
return gate(open3, Array.isArray(prior) ? prior : []);
|
|
15129
15128
|
}
|
|
15130
15129
|
function acknowledgeFounderPaid({ shown = [], open: open3 = [], previous } = {}) {
|
|
15131
15130
|
const prior = previous && Array.isArray(previous.acknowledged) ? previous.acknowledged : [];
|
|
@@ -15165,7 +15164,7 @@ function readIndexCache2() {
|
|
|
15165
15164
|
}
|
|
15166
15165
|
}
|
|
15167
15166
|
function writeIndexCache2(index) {
|
|
15168
|
-
updateIndexCache({ index });
|
|
15167
|
+
updateIndexCache({ index, indexETag: "" });
|
|
15169
15168
|
}
|
|
15170
15169
|
async function fetchIndex2() {
|
|
15171
15170
|
const cached2 = readIndexCache2();
|
|
@@ -15659,7 +15658,7 @@ function readIndexCache3() {
|
|
|
15659
15658
|
}
|
|
15660
15659
|
}
|
|
15661
15660
|
function writeIndexCache3(index) {
|
|
15662
|
-
updateIndexCache({ index });
|
|
15661
|
+
updateIndexCache({ index, indexETag: "" });
|
|
15663
15662
|
}
|
|
15664
15663
|
async function fetchIndex3(fetchImpl, useCache = true) {
|
|
15665
15664
|
if (useCache) {
|
|
@@ -63850,18 +63849,41 @@ import { hostname, homedir as osHomedir } from "os";
|
|
|
63850
63849
|
async function run26() {
|
|
63851
63850
|
try {
|
|
63852
63851
|
let index;
|
|
63852
|
+
let indexETag;
|
|
63853
|
+
const cachedForRevalidation = readCacheEntry() ?? {};
|
|
63854
|
+
let sendValidator = typeof cachedForRevalidation.indexETag === "string" && cachedForRevalidation.indexETag !== "";
|
|
63853
63855
|
for (let attempt2 = 1; ; attempt2++) {
|
|
63854
63856
|
try {
|
|
63855
63857
|
const res = await fetch(`${API_URL8}/api/index`, {
|
|
63856
63858
|
signal: AbortSignal.timeout(15e3),
|
|
63857
|
-
headers: { Accept: "application/json" }
|
|
63859
|
+
headers: sendValidator ? { Accept: "application/json", "If-None-Match": cachedForRevalidation.indexETag } : { Accept: "application/json" }
|
|
63858
63860
|
});
|
|
63861
|
+
if (res.status === 304) {
|
|
63862
|
+
const cached2 = cachedForRevalidation.index;
|
|
63863
|
+
if (cached2 && Array.isArray(cached2.jobs)) {
|
|
63864
|
+
index = cached2;
|
|
63865
|
+
indexETag = cachedForRevalidation.indexETag;
|
|
63866
|
+
break;
|
|
63867
|
+
}
|
|
63868
|
+
sendValidator = false;
|
|
63869
|
+
if (attempt2 >= 2) {
|
|
63870
|
+
process.stderr.write(
|
|
63871
|
+
"terminalhire refresh: 304 with no usable cached index \u2014 giving up this tick\n"
|
|
63872
|
+
);
|
|
63873
|
+
process.exit(1);
|
|
63874
|
+
}
|
|
63875
|
+
process.stderr.write(
|
|
63876
|
+
"terminalhire refresh: 304 but the cached index is unusable (re-fetching in full)\n"
|
|
63877
|
+
);
|
|
63878
|
+
continue;
|
|
63879
|
+
}
|
|
63859
63880
|
if (!res.ok) {
|
|
63860
63881
|
process.stderr.write(`terminalhire refresh: index fetch failed (HTTP ${res.status})
|
|
63861
63882
|
`);
|
|
63862
63883
|
process.exit(1);
|
|
63863
63884
|
}
|
|
63864
63885
|
index = await res.json();
|
|
63886
|
+
indexETag = res.headers.get("etag") ?? "";
|
|
63865
63887
|
break;
|
|
63866
63888
|
} catch (err) {
|
|
63867
63889
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -64139,6 +64161,7 @@ async function run26() {
|
|
|
64139
64161
|
};
|
|
64140
64162
|
if (founderPaid) cacheEntry.founderPaid = founderPaid;
|
|
64141
64163
|
if (approvedClaims) cacheEntry.approvedClaims = approvedClaims;
|
|
64164
|
+
cacheEntry.indexETag = indexETag ?? "";
|
|
64142
64165
|
updateIndexCache(cacheEntry);
|
|
64143
64166
|
try {
|
|
64144
64167
|
const { readSpinnerConfig: readSpinnerConfig2, renderRefreshSurface: renderRefreshSurface2 } = await Promise.resolve().then(() => (init_spinner(), spinner_exports));
|
package/dist/bin/jpi-hub.js
CHANGED
|
@@ -12541,7 +12541,7 @@ function readIndexCache() {
|
|
|
12541
12541
|
}
|
|
12542
12542
|
}
|
|
12543
12543
|
function writeIndexCache(index) {
|
|
12544
|
-
updateIndexCache({ index });
|
|
12544
|
+
updateIndexCache({ index, indexETag: "" });
|
|
12545
12545
|
}
|
|
12546
12546
|
async function fetchIndex() {
|
|
12547
12547
|
const cached = readIndexCache();
|
|
@@ -12626,7 +12626,7 @@ function readIndexCache2() {
|
|
|
12626
12626
|
}
|
|
12627
12627
|
}
|
|
12628
12628
|
function writeIndexCache2(index) {
|
|
12629
|
-
updateIndexCache({ index });
|
|
12629
|
+
updateIndexCache({ index, indexETag: "" });
|
|
12630
12630
|
}
|
|
12631
12631
|
async function fetchIndex2() {
|
|
12632
12632
|
const cached = readIndexCache2();
|
package/dist/bin/jpi-jobs.js
CHANGED
|
@@ -12141,7 +12141,7 @@ function readIndexCache() {
|
|
|
12141
12141
|
}
|
|
12142
12142
|
}
|
|
12143
12143
|
function writeIndexCache(index) {
|
|
12144
|
-
updateIndexCache({ index });
|
|
12144
|
+
updateIndexCache({ index, indexETag: "" });
|
|
12145
12145
|
}
|
|
12146
12146
|
async function fetchIndex() {
|
|
12147
12147
|
const cached = readIndexCache();
|
package/dist/bin/jpi-refresh.js
CHANGED
|
@@ -12739,8 +12739,7 @@ function gate(openIds, seenIds) {
|
|
|
12739
12739
|
function computeFounderPaid(index, previous) {
|
|
12740
12740
|
const open = openPaidIds(index);
|
|
12741
12741
|
const prior = previous && previous.acknowledged;
|
|
12742
|
-
|
|
12743
|
-
return gate(open, prior);
|
|
12742
|
+
return gate(open, Array.isArray(prior) ? prior : []);
|
|
12744
12743
|
}
|
|
12745
12744
|
function acknowledgeFounderPaid({ shown = [], open = [], previous } = {}) {
|
|
12746
12745
|
const prior = previous && Array.isArray(previous.acknowledged) ? previous.acknowledged : [];
|
|
@@ -13310,18 +13309,41 @@ var MMR_K = 8;
|
|
|
13310
13309
|
async function run() {
|
|
13311
13310
|
try {
|
|
13312
13311
|
let index;
|
|
13312
|
+
let indexETag;
|
|
13313
|
+
const cachedForRevalidation = readCacheEntry() ?? {};
|
|
13314
|
+
let sendValidator = typeof cachedForRevalidation.indexETag === "string" && cachedForRevalidation.indexETag !== "";
|
|
13313
13315
|
for (let attempt = 1; ; attempt++) {
|
|
13314
13316
|
try {
|
|
13315
13317
|
const res = await fetch(`${API_URL2}/api/index`, {
|
|
13316
13318
|
signal: AbortSignal.timeout(15e3),
|
|
13317
|
-
headers: { Accept: "application/json" }
|
|
13319
|
+
headers: sendValidator ? { Accept: "application/json", "If-None-Match": cachedForRevalidation.indexETag } : { Accept: "application/json" }
|
|
13318
13320
|
});
|
|
13321
|
+
if (res.status === 304) {
|
|
13322
|
+
const cached = cachedForRevalidation.index;
|
|
13323
|
+
if (cached && Array.isArray(cached.jobs)) {
|
|
13324
|
+
index = cached;
|
|
13325
|
+
indexETag = cachedForRevalidation.indexETag;
|
|
13326
|
+
break;
|
|
13327
|
+
}
|
|
13328
|
+
sendValidator = false;
|
|
13329
|
+
if (attempt >= 2) {
|
|
13330
|
+
process.stderr.write(
|
|
13331
|
+
"terminalhire refresh: 304 with no usable cached index \u2014 giving up this tick\n"
|
|
13332
|
+
);
|
|
13333
|
+
process.exit(1);
|
|
13334
|
+
}
|
|
13335
|
+
process.stderr.write(
|
|
13336
|
+
"terminalhire refresh: 304 but the cached index is unusable (re-fetching in full)\n"
|
|
13337
|
+
);
|
|
13338
|
+
continue;
|
|
13339
|
+
}
|
|
13319
13340
|
if (!res.ok) {
|
|
13320
13341
|
process.stderr.write(`terminalhire refresh: index fetch failed (HTTP ${res.status})
|
|
13321
13342
|
`);
|
|
13322
13343
|
process.exit(1);
|
|
13323
13344
|
}
|
|
13324
13345
|
index = await res.json();
|
|
13346
|
+
indexETag = res.headers.get("etag") ?? "";
|
|
13325
13347
|
break;
|
|
13326
13348
|
} catch (err) {
|
|
13327
13349
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -13599,6 +13621,7 @@ async function run() {
|
|
|
13599
13621
|
};
|
|
13600
13622
|
if (founderPaid) cacheEntry.founderPaid = founderPaid;
|
|
13601
13623
|
if (approvedClaims) cacheEntry.approvedClaims = approvedClaims;
|
|
13624
|
+
cacheEntry.indexETag = indexETag ?? "";
|
|
13602
13625
|
updateIndexCache(cacheEntry);
|
|
13603
13626
|
try {
|
|
13604
13627
|
const { readSpinnerConfig: readSpinnerConfig2, renderRefreshSurface: renderRefreshSurface2 } = await Promise.resolve().then(() => (init_spinner(), spinner_exports));
|
package/package.json
CHANGED