@toa.io/pointer 0.20.0-dev.36 → 0.20.0-dev.38
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/package.json +5 -5
- package/readme.md +1 -1
- package/source/resolve.ts +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/pointer",
|
|
3
|
-
"version": "0.20.0-dev.
|
|
3
|
+
"version": "0.20.0-dev.38",
|
|
4
4
|
"description": "Toa Pointer",
|
|
5
5
|
"homepage": "https://toa.io",
|
|
6
6
|
"author": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"main": "transpiled/index.js",
|
|
25
25
|
"types": "transpiled/index.d.ts",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@toa.io/dns": "0.7.1-dev.
|
|
28
|
-
"@toa.io/generic": "0.20.0-dev.
|
|
29
|
-
"@toa.io/schemas": "0.20.0-dev.
|
|
27
|
+
"@toa.io/dns": "0.7.1-dev.4",
|
|
28
|
+
"@toa.io/generic": "0.20.0-dev.38",
|
|
29
|
+
"@toa.io/schemas": "0.20.0-dev.38"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"prepublishOnly": "npm run transpile",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"preset": "ts-jest",
|
|
37
37
|
"testEnvironment": "node"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "12649c116b49db942e7caf1286c51625af3ad625"
|
|
40
40
|
}
|
package/readme.md
CHANGED
package/source/resolve.ts
CHANGED
|
@@ -8,10 +8,14 @@ export async function resolve (id: string, selector: string): Promise<string[]>
|
|
|
8
8
|
|
|
9
9
|
if (value === undefined) throw new Error(`${variable} is not set.`)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
const unique = await dedupe(urls)
|
|
11
|
+
let urls = value.split(' ')
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
const protocol = getProtocol(urls)
|
|
14
|
+
|
|
15
|
+
if (protocol !== 'http:')
|
|
16
|
+
urls = await dedupe(urls)
|
|
17
|
+
|
|
18
|
+
return withCredentials(variable, urls)
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
export function resolveRecord (uris: URIMap, selector: string): AnnotationRecord {
|
|
@@ -45,6 +49,12 @@ function addCredentials (ref: string, username: string, password: string): strin
|
|
|
45
49
|
return url.href
|
|
46
50
|
}
|
|
47
51
|
|
|
52
|
+
function getProtocol (urls: string[]): string {
|
|
53
|
+
const url = new URL(urls[0])
|
|
54
|
+
|
|
55
|
+
return url.protocol
|
|
56
|
+
}
|
|
57
|
+
|
|
48
58
|
function getRecord (uris: URIMap, key: string): AnnotationRecord {
|
|
49
59
|
return {
|
|
50
60
|
key,
|