@abtnode/util 1.16.6-beta-4562aa60 → 1.16.6-beta-eaa4d39d

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/lib/base32.js CHANGED
@@ -1,4 +1,4 @@
1
- const { toBuffer } = require('@ocap/util');
1
+ const { toBuffer, toAddress } = require('@ocap/util');
2
2
  const { base32 } = require('multiformats/bases/base32');
3
3
 
4
4
  const encode = (did) => {
@@ -6,7 +6,7 @@ const encode = (did) => {
6
6
  return did;
7
7
  }
8
8
 
9
- const buffer = toBuffer(did);
9
+ const buffer = toBuffer(toAddress(did));
10
10
 
11
11
  return base32.encode(buffer);
12
12
  };
@@ -1,5 +1,5 @@
1
1
  const stringify = require('json-stable-stringify');
2
- const { toBase64, toBase58 } = require('@ocap/util');
2
+ const { toBase64, toBase58, toDid } = require('@ocap/util');
3
3
  const joinUrl = require('url-join');
4
4
  const pRetry = require('p-retry');
5
5
  const debug = require('debug')('@abtnode/util:did-document');
@@ -18,7 +18,7 @@ const getDID = (address) => {
18
18
  return `did:abt:${address}`;
19
19
  };
20
20
 
21
- const update = async ({ services, didRegistryUrl, wallet, alsoKnownAs = [] }) => {
21
+ const update = async ({ id, services, didRegistryUrl, wallet, alsoKnownAs = [] }) => {
22
22
  debug('update did document', { didRegistryUrl });
23
23
 
24
24
  const did = getDID(wallet.address);
@@ -26,7 +26,7 @@ const update = async ({ services, didRegistryUrl, wallet, alsoKnownAs = [] }) =>
26
26
 
27
27
  const document = {
28
28
  '@context': 'https://www.w3.org/ns/did/v1',
29
- id: did,
29
+ id: toDid(id),
30
30
  controller: did,
31
31
  service: services,
32
32
  alsoKnownAs,
@@ -101,7 +101,7 @@ const updateServerDocument = async ({ ips, wallet, didRegistryUrl, domain }) =>
101
101
 
102
102
  const services = getServerServices({ ips: filteredIps, domain, wallet });
103
103
 
104
- return updateWithRetry({ services, didRegistryUrl, wallet });
104
+ return updateWithRetry({ id: getDID(wallet.address), services, didRegistryUrl, wallet });
105
105
  };
106
106
 
107
107
  const updateBlockletDocument = async ({
@@ -113,15 +113,16 @@ const updateBlockletDocument = async ({
113
113
  alsoKnownAs = [],
114
114
  }) => {
115
115
  const services = getBlockletServices({ appPid, daemonDidDomain, domain });
116
- return updateWithRetry({ services, didRegistryUrl, alsoKnownAs, wallet });
116
+ return updateWithRetry({ id: appPid, services, didRegistryUrl, alsoKnownAs, wallet });
117
117
  };
118
118
 
119
- const disableDNS = async ({ wallet, didRegistryUrl }) => updateWithRetry({ services: [], didRegistryUrl, wallet });
119
+ const disableBlockletDNS = async ({ appPid, wallet, didRegistryUrl }) =>
120
+ updateWithRetry({ id: appPid, services: [], didRegistryUrl, wallet });
120
121
 
121
122
  module.exports = {
122
123
  updateServerDocument,
123
124
  updateBlockletDocument,
124
- disableDNS,
125
+ disableBlockletDNS,
125
126
  getDID,
126
127
  getServerServices,
127
128
  getBlockletServices,
@@ -1,5 +1,6 @@
1
1
  const semverClean = require('to-semver');
2
2
  const semverSort = require('semver-sort');
3
+ const sortBy = require('lodash/sortBy');
3
4
  const axios = require('./axios');
4
5
 
5
6
  module.exports = async (name, { includePrereleases = false, limit = 10 } = {}) => {
@@ -16,5 +17,5 @@ module.exports = async (name, { includePrereleases = false, limit = 10 } = {}) =
16
17
  .map((version) => ({ version, publishedAt: time[version] }))
17
18
  .slice(0, limit);
18
19
 
19
- return result;
20
+ return sortBy(result, 'publishedAt').reverse();
20
21
  };
package/lib/run-script.js CHANGED
@@ -86,6 +86,7 @@ const runScript = (script, label, options = {}) => {
86
86
 
87
87
  child = spawn(command, args, {
88
88
  timeout: 2 * 60 * 1000,
89
+ windowsHide: true, // required for Windows
89
90
  detached: false,
90
91
  shell: false,
91
92
  stdio: ['ignore', 'pipe', 'pipe'],
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.6-beta-4562aa60",
6
+ "version": "1.16.6-beta-eaa4d39d",
7
7
  "description": "ArcBlock's JavaScript utility",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -18,14 +18,14 @@
18
18
  "author": "polunzh <polunzh@gmail.com> (http://github.com/polunzh)",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@abtnode/constant": "1.16.6-beta-4562aa60",
22
- "@abtnode/logger": "1.16.6-beta-4562aa60",
23
- "@arcblock/jwt": "1.18.72",
24
- "@blocklet/constant": "1.16.6-beta-4562aa60",
25
- "@ocap/client": "1.18.72",
26
- "@ocap/mcrypto": "1.18.72",
27
- "@ocap/util": "1.18.72",
28
- "@ocap/wallet": "1.18.72",
21
+ "@abtnode/constant": "1.16.6-beta-eaa4d39d",
22
+ "@abtnode/logger": "1.16.6-beta-eaa4d39d",
23
+ "@arcblock/jwt": "1.18.73",
24
+ "@blocklet/constant": "1.16.6-beta-eaa4d39d",
25
+ "@ocap/client": "1.18.73",
26
+ "@ocap/mcrypto": "1.18.73",
27
+ "@ocap/util": "1.18.73",
28
+ "@ocap/wallet": "1.18.73",
29
29
  "archiver": "^5.3.1",
30
30
  "axios": "^0.27.2",
31
31
  "axios-mock-adapter": "^1.21.2",
@@ -73,5 +73,5 @@
73
73
  "jest": "^27.5.1",
74
74
  "unzipper": "^0.10.11"
75
75
  },
76
- "gitHead": "e49856099ffc3c16eda77480a7ad93b2e9760764"
76
+ "gitHead": "0d2ab99f67109e989f8182fc70bc3ee9fa430585"
77
77
  }