@velocitycareerlabs/common-fetchers 1.23.0-dev-build.1c54c61c6 → 1.23.0-dev-build.10cf1b0cd
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
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@velocitycareerlabs/common-fetchers",
|
3
|
-
"version": "1.23.0-dev-build.
|
3
|
+
"version": "1.23.0-dev-build.10cf1b0cd",
|
4
4
|
"description": "Set of fetchers used by Velocity Network servers",
|
5
5
|
"repository": "https://github.com/velocitycareerlabs/packages",
|
6
6
|
"main": "src/index.js",
|
@@ -30,5 +30,5 @@
|
|
30
30
|
"jest": "29.7.0",
|
31
31
|
"prettier": "2.8.8"
|
32
32
|
},
|
33
|
-
"gitHead": "
|
33
|
+
"gitHead": "9c0d4ad0a489731776f1fcfe81b428c94926a947"
|
34
34
|
}
|
@@ -18,18 +18,22 @@ const getCredentialTypeDescriptor = async (
|
|
18
18
|
{ type, locale, includeDisplay },
|
19
19
|
{ registrarFetch, cache }
|
20
20
|
) => {
|
21
|
+
const path = `api/v0.6/credential-type-descriptors/${type}`;
|
22
|
+
const searchParams = new URLSearchParams();
|
23
|
+
searchParams.set('includeDisplay', includeDisplay);
|
24
|
+
if (locale) {
|
25
|
+
searchParams.set('locale', locale);
|
26
|
+
}
|
27
|
+
const options = {
|
28
|
+
searchParams,
|
29
|
+
cache,
|
30
|
+
};
|
21
31
|
try {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
searchParams.set('locale', locale);
|
32
|
+
if (registrarFetch.responseType === 'promise') {
|
33
|
+
const response = await registrarFetch.get(path, options);
|
34
|
+
return response.json();
|
26
35
|
}
|
27
|
-
return await registrarFetch
|
28
|
-
.get(`api/v0.6/credential-type-descriptors/${type}`, {
|
29
|
-
searchParams,
|
30
|
-
cache,
|
31
|
-
})
|
32
|
-
.json();
|
36
|
+
return await registrarFetch.get(path, options).json();
|
33
37
|
} catch (e) {
|
34
38
|
// ignore the 404s for particular types and return a basic version.
|
35
39
|
if (e.response?.statusCode === 404) {
|
@@ -16,20 +16,25 @@
|
|
16
16
|
|
17
17
|
const { flow, uniq, map } = require('lodash/fp');
|
18
18
|
|
19
|
-
const getCredentialTypeMetadata = (
|
19
|
+
const getCredentialTypeMetadata = async (
|
20
20
|
credentialTypes,
|
21
21
|
{ registrarFetch, cache }
|
22
|
-
) =>
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
22
|
+
) => {
|
23
|
+
const path = 'api/v0.6/credential-types';
|
24
|
+
const options = {
|
25
|
+
searchParams: new URLSearchParams(
|
26
|
+
flow(
|
27
|
+
uniq,
|
28
|
+
map((type) => ['credentialType', type])
|
29
|
+
)(credentialTypes)
|
30
|
+
),
|
31
|
+
cache,
|
32
|
+
};
|
33
|
+
if (registrarFetch.responseType === 'promise') {
|
34
|
+
const response = await registrarFetch.get(path, options);
|
35
|
+
return response.json();
|
36
|
+
}
|
37
|
+
return registrarFetch.get(path, options).json();
|
38
|
+
};
|
34
39
|
|
35
40
|
module.exports = { getCredentialTypeMetadata };
|
@@ -14,12 +14,18 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
const getOrganizationVerifiedProfile = (
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
const getOrganizationVerifiedProfile = async (
|
18
|
+
orgDid,
|
19
|
+
{ registrarFetch, cache }
|
20
|
+
) => {
|
21
|
+
const path = `api/v0.6/organizations/${orgDid}/verified-profile`;
|
22
|
+
const options = { cache };
|
23
|
+
if (registrarFetch.responseType === 'promise') {
|
24
|
+
const response = await registrarFetch.get(path, options);
|
25
|
+
return response.json();
|
26
|
+
}
|
27
|
+
return registrarFetch.get(path, options).json();
|
28
|
+
};
|
23
29
|
|
24
30
|
module.exports = {
|
25
31
|
getOrganizationVerifiedProfile,
|
@@ -14,8 +14,14 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
const resolveDid = (orgDid, { registrarFetch }) =>
|
18
|
-
|
17
|
+
const resolveDid = async (orgDid, { registrarFetch }) => {
|
18
|
+
const path = `api/v0.6/resolve-did/${orgDid}`;
|
19
|
+
if (registrarFetch.responseType === 'promise') {
|
20
|
+
const response = await registrarFetch.get(path);
|
21
|
+
return response.json();
|
22
|
+
}
|
23
|
+
return registrarFetch.get(path).json();
|
24
|
+
};
|
19
25
|
|
20
26
|
module.exports = {
|
21
27
|
resolveDid,
|