@vltpkg/registry-client 0.0.0-9 → 1.0.0-rc.1
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 +1 -1
- package/dist/esm/cache-entry.d.ts +32 -8
- package/dist/esm/cache-entry.d.ts.map +1 -1
- package/dist/esm/cache-entry.js +141 -62
- package/dist/esm/cache-entry.js.map +1 -1
- package/dist/esm/handle-304-response.js +1 -1
- package/dist/esm/handle-304-response.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +46 -24
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/otplease.d.ts.map +1 -1
- package/dist/esm/otplease.js +33 -25
- package/dist/esm/otplease.js.map +1 -1
- package/dist/esm/raw-header.d.ts +3 -3
- package/dist/esm/raw-header.d.ts.map +1 -1
- package/dist/esm/raw-header.js +12 -11
- package/dist/esm/raw-header.js.map +1 -1
- package/dist/esm/redirect.d.ts +1 -1
- package/dist/esm/redirect.d.ts.map +1 -1
- package/dist/esm/redirect.js +5 -1
- package/dist/esm/redirect.js.map +1 -1
- package/dist/esm/revalidate.d.ts +1 -1
- package/dist/esm/revalidate.d.ts.map +1 -1
- package/dist/esm/revalidate.js +11 -5
- package/dist/esm/revalidate.js.map +1 -1
- package/dist/esm/set-raw-header.d.ts +1 -1
- package/dist/esm/set-raw-header.d.ts.map +1 -1
- package/dist/esm/set-raw-header.js +6 -4
- package/dist/esm/set-raw-header.js.map +1 -1
- package/dist/esm/string-encoding.d.ts +9 -0
- package/dist/esm/string-encoding.d.ts.map +1 -0
- package/dist/esm/string-encoding.js +25 -0
- package/dist/esm/string-encoding.js.map +1 -0
- package/dist/esm/token-response.d.ts +1 -1
- package/dist/esm/token-response.d.ts.map +1 -1
- package/dist/esm/token-response.js +5 -2
- package/dist/esm/token-response.js.map +1 -1
- package/dist/esm/web-auth-challenge.d.ts +2 -2
- package/dist/esm/web-auth-challenge.d.ts.map +1 -1
- package/dist/esm/web-auth-challenge.js +13 -6
- package/dist/esm/web-auth-challenge.js.map +1 -1
- package/package.json +20 -19
package/dist/esm/revalidate.js
CHANGED
|
@@ -7,8 +7,9 @@ export const __CODE_SPLIT_SCRIPT_NAME = import.meta.filename;
|
|
|
7
7
|
const isMain = (path) => path === __CODE_SPLIT_SCRIPT_NAME ||
|
|
8
8
|
path === pathToFileURL(__CODE_SPLIT_SCRIPT_NAME).toString();
|
|
9
9
|
export const main = async (cache, input = process.stdin) => {
|
|
10
|
-
if (!cache)
|
|
11
|
-
|
|
10
|
+
if (!cache) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
12
13
|
const reqs = await new Promise(res => {
|
|
13
14
|
const chunks = [];
|
|
14
15
|
let chunkLen = 0;
|
|
@@ -27,8 +28,9 @@ export const main = async (cache, input = process.stdin) => {
|
|
|
27
28
|
res(reqs);
|
|
28
29
|
});
|
|
29
30
|
});
|
|
30
|
-
if (!reqs.length)
|
|
31
|
-
|
|
31
|
+
if (!reqs.length) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
32
34
|
const rc = new RegistryClient({ cache });
|
|
33
35
|
await Promise.all(reqs.map(async ([method, url]) => {
|
|
34
36
|
await rc.request(url, {
|
|
@@ -36,6 +38,7 @@ export const main = async (cache, input = process.stdin) => {
|
|
|
36
38
|
staleWhileRevalidate: false,
|
|
37
39
|
});
|
|
38
40
|
}));
|
|
41
|
+
return true;
|
|
39
42
|
};
|
|
40
43
|
const g = globalThis;
|
|
41
44
|
if (isMain(g.__VLT_INTERNAL_MAIN ?? process.argv[1])) {
|
|
@@ -44,6 +47,9 @@ if (isMain(g.__VLT_INTERNAL_MAIN ?? process.argv[1])) {
|
|
|
44
47
|
// so always use the last arg unless there are only two which means
|
|
45
48
|
// no path was supplied.
|
|
46
49
|
const cacheFolder = process.argv.length === 2 ? undefined : process.argv.at(-1);
|
|
47
|
-
|
|
50
|
+
const res = await main(cacheFolder, process.stdin);
|
|
51
|
+
if (!res) {
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
//# sourceMappingURL=revalidate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revalidate.js","sourceRoot":"","sources":["../../src/revalidate.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,4EAA4E;AAC5E,mEAAmE;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAA;AAE5D,MAAM,MAAM,GAAG,CAAC,IAAa,EAAE,EAAE,CAC/B,IAAI,KAAK,wBAAwB;IACjC,IAAI,KAAK,aAAa,CAAC,wBAAwB,CAAC,CAAC,QAAQ,EAAE,CAAA;AAE7D,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EAAE,KAAc,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,EAAE;IAClE,IAAI,CAAC,KAAK
|
|
1
|
+
{"version":3,"file":"revalidate.js","sourceRoot":"","sources":["../../src/revalidate.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,4EAA4E;AAC5E,mEAAmE;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAA;AAE5D,MAAM,MAAM,GAAG,CAAC,IAAa,EAAE,EAAE,CAC/B,IAAI,KAAK,wBAAwB;IACjC,IAAI,KAAK,aAAa,CAAC,wBAAwB,CAAC,CAAC,QAAQ,EAAE,CAAA;AAE7D,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EAAE,KAAc,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,EAAE;IAClE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,IAAI,OAAO,CAA0B,GAAG,CAAC,EAAE;QAC5D,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,IAAI,QAAQ,GAAG,CAAC,CAAA;QAChB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;YACvB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAClB,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAA;QAC1B,CAAC,CAAC,CAAA;QACF,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACnB,MAAM,IAAI,GAA4B,MAAM,CAAC,MAAM,CACjD,MAAM,EACN,QAAQ,CACT;iBACE,QAAQ,EAAE;iBACV,KAAK,CAAC,IAAI,CAAC;iBACX,MAAM,CACL,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAC5D;iBACA,GAAG,CAAC,CAAC,CAAC,EAAE,CACP,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;gBACpB,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC9C,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CACjD,CAAA;YAEH,GAAG,CAAC,IAAI,CAAC,CAAA;QACX,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,EAAE,GAAG,IAAI,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;IACxC,MAAM,OAAO,CAAC,GAAG,CACf,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE;QAC/B,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;YACpB,MAAM;YACN,oBAAoB,EAAE,KAAK;SAC5B,CAAC,CAAA;IACJ,CAAC,CAAC,CACH,CAAA;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,GAAG,UAET,CAAA;AAED,IAAI,MAAM,CAAC,CAAC,CAAC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACrD,OAAO,CAAC,KAAK,GAAG,sBAAsB,CAAA;IACtC,iEAAiE;IACjE,mEAAmE;IACnE,wBAAwB;IACxB,MAAM,WAAW,GACf,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IAC7D,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IAClD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC","sourcesContent":["// This needs to live in the same workspace as the RegistryClient, because\n// otherwise we have a cyclical dependency cycle of dependencies in a cycle,\n// which is even more cyclical than this description describing it.\nimport { pathToFileURL } from 'node:url'\nimport { RegistryClient } from './index.ts'\n\nexport const __CODE_SPLIT_SCRIPT_NAME = import.meta.filename\n\nconst isMain = (path?: string) =>\n path === __CODE_SPLIT_SCRIPT_NAME ||\n path === pathToFileURL(__CODE_SPLIT_SCRIPT_NAME).toString()\n\nexport const main = async (cache?: string, input = process.stdin) => {\n if (!cache) {\n return false\n }\n const reqs = await new Promise<['GET' | 'HEAD', URL][]>(res => {\n const chunks: Buffer[] = []\n let chunkLen = 0\n input.on('data', chunk => {\n chunks.push(chunk)\n chunkLen += chunk.length\n })\n input.on('end', () => {\n const reqs: ['GET' | 'HEAD', URL][] = Buffer.concat(\n chunks,\n chunkLen,\n )\n .toString()\n .split('\\0')\n .filter(\n i => !!i && (i.startsWith('GET ') || i.startsWith('HEAD ')),\n )\n .map(i =>\n i.startsWith('GET ') ?\n ['GET', new URL(i.substring('GET '.length))]\n : ['HEAD', new URL(i.substring('HEAD '.length))],\n )\n\n res(reqs)\n })\n })\n\n if (!reqs.length) {\n return false\n }\n\n const rc = new RegistryClient({ cache })\n await Promise.all(\n reqs.map(async ([method, url]) => {\n await rc.request(url, {\n method,\n staleWhileRevalidate: false,\n })\n }),\n )\n\n return true\n}\n\nconst g = globalThis as typeof globalThis & {\n __VLT_INTERNAL_MAIN?: string\n}\n\nif (isMain(g.__VLT_INTERNAL_MAIN ?? process.argv[1])) {\n process.title = 'vlt-cache-revalidate'\n // When compiled there can be other leading args supplied by Deno\n // so always use the last arg unless there are only two which means\n // no path was supplied.\n const cacheFolder =\n process.argv.length === 2 ? undefined : process.argv.at(-1)\n const res = await main(cacheFolder, process.stdin)\n if (!res) {\n process.exit(1)\n }\n}\n"]}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Given a rawHeaders array of [key, value, key2, value2, ...],
|
|
3
3
|
* overwrite the current value of a header, or if not found, append
|
|
4
4
|
*/
|
|
5
|
-
export declare const setRawHeader: (headers:
|
|
5
|
+
export declare const setRawHeader: (headers: Uint8Array[], key: string, value: Uint8Array | string) => Uint8Array[];
|
|
6
6
|
//# sourceMappingURL=set-raw-header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-raw-header.d.ts","sourceRoot":"","sources":["../../src/set-raw-header.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"set-raw-header.d.ts","sourceRoot":"","sources":["../../src/set-raw-header.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,YAAY,YACd,UAAU,EAAE,OAChB,MAAM,SACJ,UAAU,GAAG,MAAM,KACzB,UAAU,EAiBZ,CAAA"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
import { getDecodedValue, getEncondedValue, } from "./string-encoding.js";
|
|
1
2
|
/**
|
|
2
3
|
* Given a rawHeaders array of [key, value, key2, value2, ...],
|
|
3
4
|
* overwrite the current value of a header, or if not found, append
|
|
4
5
|
*/
|
|
5
6
|
export const setRawHeader = (headers, key, value) => {
|
|
6
7
|
key = key.toLowerCase();
|
|
7
|
-
const keyBuf =
|
|
8
|
-
const valBuf =
|
|
8
|
+
const keyBuf = getEncondedValue(key);
|
|
9
|
+
const valBuf = getEncondedValue(value);
|
|
9
10
|
for (let i = 0; i < headers.length; i += 2) {
|
|
10
11
|
const k = headers[i];
|
|
11
12
|
if (k &&
|
|
12
13
|
k.length === keyBuf.length &&
|
|
13
|
-
|
|
14
|
+
getDecodedValue(k).toLowerCase() === key) {
|
|
14
15
|
headers[i + 1] = valBuf;
|
|
15
|
-
return;
|
|
16
|
+
return headers;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
headers.push(keyBuf, valBuf);
|
|
20
|
+
return headers;
|
|
19
21
|
};
|
|
20
22
|
//# sourceMappingURL=set-raw-header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-raw-header.js","sourceRoot":"","sources":["../../src/set-raw-header.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,
|
|
1
|
+
{"version":3,"file":"set-raw-header.js","sourceRoot":"","sources":["../../src/set-raw-header.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,GACjB,MAAM,sBAAsB,CAAA;AAE7B;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,OAAqB,EACrB,GAAW,EACX,KAA0B,EACZ,EAAE;IAChB,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;IACvB,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;IACpC,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;QACpB,IACE,CAAC;YACD,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;YAC1B,eAAe,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,GAAG,EACxC,CAAC;YACD,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAA;YACvB,OAAO,OAAO,CAAA;QAChB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA","sourcesContent":["import {\n getDecodedValue,\n getEncondedValue,\n} from './string-encoding.ts'\n\n/**\n * Given a rawHeaders array of [key, value, key2, value2, ...],\n * overwrite the current value of a header, or if not found, append\n */\nexport const setRawHeader = (\n headers: Uint8Array[],\n key: string,\n value: Uint8Array | string,\n): Uint8Array[] => {\n key = key.toLowerCase()\n const keyBuf = getEncondedValue(key)\n const valBuf = getEncondedValue(value)\n for (let i = 0; i < headers.length; i += 2) {\n const k = headers[i]\n if (\n k &&\n k.length === keyBuf.length &&\n getDecodedValue(k).toLowerCase() === key\n ) {\n headers[i + 1] = valBuf\n return headers\n }\n }\n headers.push(keyBuf, valBuf)\n return headers\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decodes a string from a Uint8Array
|
|
3
|
+
*/
|
|
4
|
+
export declare const getDecodedValue: (value: string | Uint8Array | undefined) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Encodes a string to a Uint8Array
|
|
7
|
+
*/
|
|
8
|
+
export declare const getEncondedValue: (value: Uint8Array | string | undefined) => Uint8Array;
|
|
9
|
+
//# sourceMappingURL=string-encoding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-encoding.d.ts","sourceRoot":"","sources":["../../src/string-encoding.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,eAAe,UACnB,MAAM,GAAG,UAAU,GAAG,SAAS,KACrC,MAKF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,UACpB,UAAU,GAAG,MAAM,GAAG,SAAS,KACrC,UAOF,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const decoder = new TextDecoder();
|
|
2
|
+
/**
|
|
3
|
+
* Decodes a string from a Uint8Array
|
|
4
|
+
*/
|
|
5
|
+
export const getDecodedValue = (value) => {
|
|
6
|
+
if (value == undefined)
|
|
7
|
+
return '';
|
|
8
|
+
if (typeof value === 'string')
|
|
9
|
+
return value;
|
|
10
|
+
const res = decoder.decode(value);
|
|
11
|
+
return res;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Encodes a string to a Uint8Array
|
|
15
|
+
*/
|
|
16
|
+
export const getEncondedValue = (value) => {
|
|
17
|
+
if (value == undefined)
|
|
18
|
+
return new Uint8Array(0);
|
|
19
|
+
if (typeof value === 'string') {
|
|
20
|
+
const res = Buffer.from(value);
|
|
21
|
+
return res;
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=string-encoding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-encoding.js","sourceRoot":"","sources":["../../src/string-encoding.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AAEjC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAsC,EAC9B,EAAE;IACV,IAAI,KAAK,IAAI,SAAS;QAAE,OAAO,EAAE,CAAA;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3C,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACjC,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,KAAsC,EAC1B,EAAE;IACd,IAAI,KAAK,IAAI,SAAS;QAAE,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAA;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC9B,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["const decoder = new TextDecoder()\n\n/**\n * Decodes a string from a Uint8Array\n */\nexport const getDecodedValue = (\n value: string | Uint8Array | undefined,\n): string => {\n if (value == undefined) return ''\n if (typeof value === 'string') return value\n const res = decoder.decode(value)\n return res\n}\n\n/**\n * Encodes a string to a Uint8Array\n */\nexport const getEncondedValue = (\n value: Uint8Array | string | undefined,\n): Uint8Array => {\n if (value == undefined) return new Uint8Array(0)\n if (typeof value === 'string') {\n const res = Buffer.from(value)\n return res\n }\n return value\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-response.d.ts","sourceRoot":"","sources":["../../src/token-response.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"token-response.d.ts","sourceRoot":"","sources":["../../src/token-response.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,gBAAgB,MACxB,OAAO,KACT,aAAa,GAAG,SASN,CAAA"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const getTokenResponse = (b) => (!!b &&
|
|
2
2
|
typeof b === 'object' &&
|
|
3
|
+
'token' in b &&
|
|
3
4
|
typeof b.token === 'string' &&
|
|
4
|
-
|
|
5
|
+
b.token) ?
|
|
6
|
+
{ token: b.token }
|
|
7
|
+
: undefined;
|
|
5
8
|
//# sourceMappingURL=token-response.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-response.js","sourceRoot":"","sources":["../../src/token-response.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"token-response.js","sourceRoot":"","sources":["../../src/token-response.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,CAAU,EACiB,EAAE,CAC7B,CACE,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,OAAO,IAAI,CAAC;IACZ,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ;IAC3B,CAAC,CAAC,KAAK,CACR,CAAC,CAAC;IACD,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE;IACpB,CAAC,CAAC,SAAS,CAAA","sourcesContent":["export type TokenResponse = {\n token: string\n}\n\nexport const getTokenResponse = (\n b: unknown,\n): TokenResponse | undefined =>\n (\n !!b &&\n typeof b === 'object' &&\n 'token' in b &&\n typeof b.token === 'string' &&\n b.token\n ) ?\n { token: b.token }\n : undefined\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type WebAuthChallenge = {
|
|
2
2
|
doneUrl: string;
|
|
3
|
-
|
|
3
|
+
authUrl: string;
|
|
4
4
|
};
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const getWebAuthChallenge: (o: unknown) => WebAuthChallenge | undefined;
|
|
6
6
|
//# sourceMappingURL=web-auth-challenge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-auth-challenge.d.ts","sourceRoot":"","sources":["../../src/web-auth-challenge.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,
|
|
1
|
+
{"version":3,"file":"web-auth-challenge.d.ts","sourceRoot":"","sources":["../../src/web-auth-challenge.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,mBAAmB,MAC3B,OAAO,KACT,gBAAgB,GAAG,SAerB,CAAA"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
export const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export const getWebAuthChallenge = (o) => {
|
|
2
|
+
if (!!o &&
|
|
3
|
+
typeof o === 'object' &&
|
|
4
|
+
'doneUrl' in o &&
|
|
5
|
+
typeof o.doneUrl === 'string' &&
|
|
6
|
+
o.doneUrl) {
|
|
7
|
+
// Publishes use authUrl, but login uses loginUrl
|
|
8
|
+
const authUrl = 'authUrl' in o && typeof o.authUrl === 'string' ? o.authUrl
|
|
9
|
+
: 'loginUrl' in o && typeof o.loginUrl === 'string' ? o.loginUrl
|
|
10
|
+
: undefined;
|
|
11
|
+
return authUrl ? { doneUrl: o.doneUrl, authUrl } : undefined;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
7
14
|
//# sourceMappingURL=web-auth-challenge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-auth-challenge.js","sourceRoot":"","sources":["../../src/web-auth-challenge.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"web-auth-challenge.js","sourceRoot":"","sources":["../../src/web-auth-challenge.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,CAAU,EACoB,EAAE;IAChC,IACE,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,QAAQ;QACrB,SAAS,IAAI,CAAC;QACd,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ;QAC7B,CAAC,CAAC,OAAO,EACT,CAAC;QACD,iDAAiD;QACjD,MAAM,OAAO,GACX,SAAS,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO;YAC3D,CAAC,CAAC,UAAU,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ;gBAChE,CAAC,CAAC,SAAS,CAAA;QACb,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;IAC9D,CAAC;AACH,CAAC,CAAA","sourcesContent":["export type WebAuthChallenge = {\n doneUrl: string\n authUrl: string\n}\n\nexport const getWebAuthChallenge = (\n o: unknown,\n): WebAuthChallenge | undefined => {\n if (\n !!o &&\n typeof o === 'object' &&\n 'doneUrl' in o &&\n typeof o.doneUrl === 'string' &&\n o.doneUrl\n ) {\n // Publishes use authUrl, but login uses loginUrl\n const authUrl =\n 'authUrl' in o && typeof o.authUrl === 'string' ? o.authUrl\n : 'loginUrl' in o && typeof o.loginUrl === 'string' ? o.loginUrl\n : undefined\n return authUrl ? { doneUrl: o.doneUrl, authUrl } : undefined\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/registry-client",
|
|
3
3
|
"description": "Fetch package artifacts and metadata from registries",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "1.0.0-rc.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
8
8
|
"directory": "src/registry-client"
|
|
9
9
|
},
|
|
10
|
+
"author": "vlt technology inc. <support@vlt.sh> (http://vlt.sh)",
|
|
10
11
|
"tshy": {
|
|
11
12
|
"selfLink": false,
|
|
12
13
|
"liveDev": true,
|
|
@@ -20,29 +21,28 @@
|
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"cache-control-parser": "^2.0.
|
|
24
|
-
"package-json-from-dist": "^1.0.
|
|
25
|
-
"undici": "^7.
|
|
26
|
-
"@vltpkg/cache": "
|
|
27
|
-
"@vltpkg/
|
|
28
|
-
"@vltpkg/
|
|
29
|
-
"@vltpkg/
|
|
30
|
-
"@vltpkg/output": "
|
|
31
|
-
"@vltpkg/types": "
|
|
32
|
-
"@vltpkg/
|
|
33
|
-
"@vltpkg/xdg": "
|
|
24
|
+
"cache-control-parser": "^2.0.6",
|
|
25
|
+
"package-json-from-dist": "^1.0.1",
|
|
26
|
+
"undici": "^7.15.0",
|
|
27
|
+
"@vltpkg/cache": "1.0.0-rc.1",
|
|
28
|
+
"@vltpkg/cache-unzip": "1.0.0-rc.1",
|
|
29
|
+
"@vltpkg/keychain": "1.0.0-rc.1",
|
|
30
|
+
"@vltpkg/error-cause": "1.0.0-rc.1",
|
|
31
|
+
"@vltpkg/output": "1.0.0-rc.1",
|
|
32
|
+
"@vltpkg/types": "1.0.0-rc.1",
|
|
33
|
+
"@vltpkg/url-open": "1.0.0-rc.1",
|
|
34
|
+
"@vltpkg/xdg": "1.0.0-rc.1"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@eslint/js": "^9.
|
|
37
|
-
"@types/
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"prettier": "^3.4.2",
|
|
37
|
+
"@eslint/js": "^9.34.0",
|
|
38
|
+
"@types/node": "^22.17.2",
|
|
39
|
+
"eslint": "^9.34.0",
|
|
40
|
+
"prettier": "^3.6.2",
|
|
41
41
|
"tap": "^21.1.0",
|
|
42
42
|
"tshy": "^3.0.2",
|
|
43
|
-
"typedoc": "0.27.
|
|
43
|
+
"typedoc": "~0.27.9",
|
|
44
44
|
"typescript": "5.7.3",
|
|
45
|
-
"typescript-eslint": "^8.
|
|
45
|
+
"typescript-eslint": "^8.40.0"
|
|
46
46
|
},
|
|
47
47
|
"license": "BSD-2-Clause-Patent",
|
|
48
48
|
"engines": {
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"snap": "tap",
|
|
81
81
|
"test": "tap",
|
|
82
82
|
"posttest": "tsc --noEmit",
|
|
83
|
+
"tshy": "tshy",
|
|
83
84
|
"typecheck": "tsc --noEmit"
|
|
84
85
|
}
|
|
85
86
|
}
|