@holochain/hc-spin 0.500.0-dev.1 → 0.500.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/.github/workflows/test.yaml +25 -0
- package/CHANGELOG.md +5 -0
- package/dist/main/index.js +196 -184
- package/package.json +5 -5
- package/src/main/index.ts +9 -10
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: 'test'
|
|
2
|
+
on:
|
|
3
|
+
pull_request: {}
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
10
|
+
# Checks out a copy of your repository on the ubuntu-latest machine
|
|
11
|
+
- uses: actions/checkout@v3
|
|
12
|
+
|
|
13
|
+
- name: Install dependencies and build
|
|
14
|
+
run: yarn && yarn build
|
|
15
|
+
|
|
16
|
+
ci_pass:
|
|
17
|
+
if: ${{ always() }}
|
|
18
|
+
runs-on: 'ubuntu-latest'
|
|
19
|
+
needs:
|
|
20
|
+
- test
|
|
21
|
+
steps:
|
|
22
|
+
- name: check status
|
|
23
|
+
uses: re-actors/alls-green@release/v1
|
|
24
|
+
with:
|
|
25
|
+
jobs: ${{ toJSON(needs) }}
|
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
9
9
|
### Changed
|
|
10
10
|
### Removed
|
|
11
11
|
|
|
12
|
+
## 2025-04-10: v0.500.0-rc.0
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- Updated to be compatible with holochain 0.5.0-rc.0
|
|
16
|
+
|
|
12
17
|
## 2025-03-05: v0.500.0-dev.1
|
|
13
18
|
|
|
14
19
|
### Changed
|
package/dist/main/index.js
CHANGED
|
@@ -4537,6 +4537,162 @@ const getBaseRoleNameFromCloneId = (roleName) => {
|
|
|
4537
4537
|
}
|
|
4538
4538
|
return roleName.split(CLONE_ID_DELIMITER)[0];
|
|
4539
4539
|
};
|
|
4540
|
+
const version = "3.7.7";
|
|
4541
|
+
const VERSION = version;
|
|
4542
|
+
const _hasBuffer = typeof Buffer === "function";
|
|
4543
|
+
const _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
|
|
4544
|
+
const _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
|
4545
|
+
const b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
4546
|
+
const b64chs = Array.prototype.slice.call(b64ch);
|
|
4547
|
+
const b64tab = ((a) => {
|
|
4548
|
+
let tab = {};
|
|
4549
|
+
a.forEach((c, i) => tab[c] = i);
|
|
4550
|
+
return tab;
|
|
4551
|
+
})(b64chs);
|
|
4552
|
+
const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
|
4553
|
+
const _fromCC = String.fromCharCode.bind(String);
|
|
4554
|
+
const _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it) => new Uint8Array(Array.prototype.slice.call(it, 0));
|
|
4555
|
+
const _mkUriSafe = (src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_");
|
|
4556
|
+
const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, "");
|
|
4557
|
+
const btoaPolyfill = (bin) => {
|
|
4558
|
+
let u32, c0, c1, c2, asc = "";
|
|
4559
|
+
const pad = bin.length % 3;
|
|
4560
|
+
for (let i = 0; i < bin.length; ) {
|
|
4561
|
+
if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255)
|
|
4562
|
+
throw new TypeError("invalid character found");
|
|
4563
|
+
u32 = c0 << 16 | c1 << 8 | c2;
|
|
4564
|
+
asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63];
|
|
4565
|
+
}
|
|
4566
|
+
return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
|
|
4567
|
+
};
|
|
4568
|
+
const _btoa = typeof btoa === "function" ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
|
|
4569
|
+
const _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
|
|
4570
|
+
const maxargs = 4096;
|
|
4571
|
+
let strs = [];
|
|
4572
|
+
for (let i = 0, l = u8a.length; i < l; i += maxargs) {
|
|
4573
|
+
strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
|
|
4574
|
+
}
|
|
4575
|
+
return _btoa(strs.join(""));
|
|
4576
|
+
};
|
|
4577
|
+
const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a);
|
|
4578
|
+
const cb_utob = (c) => {
|
|
4579
|
+
if (c.length < 2) {
|
|
4580
|
+
var cc = c.charCodeAt(0);
|
|
4581
|
+
return cc < 128 ? c : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
|
|
4582
|
+
} else {
|
|
4583
|
+
var cc = 65536 + (c.charCodeAt(0) - 55296) * 1024 + (c.charCodeAt(1) - 56320);
|
|
4584
|
+
return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
|
|
4585
|
+
}
|
|
4586
|
+
};
|
|
4587
|
+
const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
|
4588
|
+
const utob = (u) => u.replace(re_utob, cb_utob);
|
|
4589
|
+
const _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
|
|
4590
|
+
const encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
|
|
4591
|
+
const encodeURI = (src) => encode(src, true);
|
|
4592
|
+
const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
|
4593
|
+
const cb_btou = (cccc) => {
|
|
4594
|
+
switch (cccc.length) {
|
|
4595
|
+
case 4:
|
|
4596
|
+
var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
|
|
4597
|
+
return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320);
|
|
4598
|
+
case 3:
|
|
4599
|
+
return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2));
|
|
4600
|
+
default:
|
|
4601
|
+
return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
|
|
4602
|
+
}
|
|
4603
|
+
};
|
|
4604
|
+
const btou = (b) => b.replace(re_btou, cb_btou);
|
|
4605
|
+
const atobPolyfill = (asc) => {
|
|
4606
|
+
asc = asc.replace(/\s+/g, "");
|
|
4607
|
+
if (!b64re.test(asc))
|
|
4608
|
+
throw new TypeError("malformed base64.");
|
|
4609
|
+
asc += "==".slice(2 - (asc.length & 3));
|
|
4610
|
+
let u24, bin = "", r1, r2;
|
|
4611
|
+
for (let i = 0; i < asc.length; ) {
|
|
4612
|
+
u24 = b64tab[asc.charAt(i++)] << 18 | b64tab[asc.charAt(i++)] << 12 | (r1 = b64tab[asc.charAt(i++)]) << 6 | (r2 = b64tab[asc.charAt(i++)]);
|
|
4613
|
+
bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
|
|
4614
|
+
}
|
|
4615
|
+
return bin;
|
|
4616
|
+
};
|
|
4617
|
+
const _atob = typeof atob === "function" ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
|
|
4618
|
+
const _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a).split("").map((c) => c.charCodeAt(0)));
|
|
4619
|
+
const toUint8Array$1 = (a) => _toUint8Array(_unURI(a));
|
|
4620
|
+
const _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
|
|
4621
|
+
const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/"));
|
|
4622
|
+
const decode = (src) => _decode(_unURI(src));
|
|
4623
|
+
const isValid = (src) => {
|
|
4624
|
+
if (typeof src !== "string")
|
|
4625
|
+
return false;
|
|
4626
|
+
const s = src.replace(/\s+/g, "").replace(/={0,2}$/, "");
|
|
4627
|
+
return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s);
|
|
4628
|
+
};
|
|
4629
|
+
const _noEnum = (v2) => {
|
|
4630
|
+
return {
|
|
4631
|
+
value: v2,
|
|
4632
|
+
enumerable: false,
|
|
4633
|
+
writable: true,
|
|
4634
|
+
configurable: true
|
|
4635
|
+
};
|
|
4636
|
+
};
|
|
4637
|
+
const extendString = function() {
|
|
4638
|
+
const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body));
|
|
4639
|
+
_add("fromBase64", function() {
|
|
4640
|
+
return decode(this);
|
|
4641
|
+
});
|
|
4642
|
+
_add("toBase64", function(urlsafe) {
|
|
4643
|
+
return encode(this, urlsafe);
|
|
4644
|
+
});
|
|
4645
|
+
_add("toBase64URI", function() {
|
|
4646
|
+
return encode(this, true);
|
|
4647
|
+
});
|
|
4648
|
+
_add("toBase64URL", function() {
|
|
4649
|
+
return encode(this, true);
|
|
4650
|
+
});
|
|
4651
|
+
_add("toUint8Array", function() {
|
|
4652
|
+
return toUint8Array$1(this);
|
|
4653
|
+
});
|
|
4654
|
+
};
|
|
4655
|
+
const extendUint8Array = function() {
|
|
4656
|
+
const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body));
|
|
4657
|
+
_add("toBase64", function(urlsafe) {
|
|
4658
|
+
return fromUint8Array(this, urlsafe);
|
|
4659
|
+
});
|
|
4660
|
+
_add("toBase64URI", function() {
|
|
4661
|
+
return fromUint8Array(this, true);
|
|
4662
|
+
});
|
|
4663
|
+
_add("toBase64URL", function() {
|
|
4664
|
+
return fromUint8Array(this, true);
|
|
4665
|
+
});
|
|
4666
|
+
};
|
|
4667
|
+
const extendBuiltins = () => {
|
|
4668
|
+
extendString();
|
|
4669
|
+
extendUint8Array();
|
|
4670
|
+
};
|
|
4671
|
+
const gBase64 = {
|
|
4672
|
+
version,
|
|
4673
|
+
VERSION,
|
|
4674
|
+
atob: _atob,
|
|
4675
|
+
atobPolyfill,
|
|
4676
|
+
btoa: _btoa,
|
|
4677
|
+
btoaPolyfill,
|
|
4678
|
+
fromBase64: decode,
|
|
4679
|
+
toBase64: encode,
|
|
4680
|
+
encode,
|
|
4681
|
+
encodeURI,
|
|
4682
|
+
encodeURL: encodeURI,
|
|
4683
|
+
utob,
|
|
4684
|
+
btou,
|
|
4685
|
+
decode,
|
|
4686
|
+
isValid,
|
|
4687
|
+
fromUint8Array,
|
|
4688
|
+
toUint8Array: toUint8Array$1,
|
|
4689
|
+
extendString,
|
|
4690
|
+
extendUint8Array,
|
|
4691
|
+
extendBuiltins
|
|
4692
|
+
};
|
|
4693
|
+
function encodeHashToBase64(hash) {
|
|
4694
|
+
return `u${gBase64.fromUint8Array(hash, true)}`;
|
|
4695
|
+
}
|
|
4540
4696
|
class WsClient extends Emittery {
|
|
4541
4697
|
socket;
|
|
4542
4698
|
url;
|
|
@@ -4744,7 +4900,17 @@ class WsClient extends Emittery {
|
|
|
4744
4900
|
if (msg.data === null || msg.data === void 0) {
|
|
4745
4901
|
this.pendingRequests[id].reject(new Error("Response canceled by responder"));
|
|
4746
4902
|
} else {
|
|
4747
|
-
this.pendingRequests[id].resolve(msgpack.decode(msg.data
|
|
4903
|
+
this.pendingRequests[id].resolve(msgpack.decode(msg.data, {
|
|
4904
|
+
mapKeyConverter: (key) => {
|
|
4905
|
+
if (typeof key === "string" || typeof key === "number") {
|
|
4906
|
+
return key;
|
|
4907
|
+
}
|
|
4908
|
+
if (key && typeof key === "object" && key instanceof Uint8Array) {
|
|
4909
|
+
return encodeHashToBase64(key);
|
|
4910
|
+
}
|
|
4911
|
+
throw new HolochainError("DeserializationError", "Encountered map with key of type 'object', but not HoloHash " + key);
|
|
4912
|
+
}
|
|
4913
|
+
}));
|
|
4748
4914
|
}
|
|
4749
4915
|
delete this.pendingRequests[id];
|
|
4750
4916
|
} else {
|
|
@@ -9972,162 +10138,6 @@ function requireLibsodium() {
|
|
|
9972
10138
|
}(commonjsGlobal);
|
|
9973
10139
|
})(libsodiumWrappers);
|
|
9974
10140
|
const _sodium = /* @__PURE__ */ getDefaultExportFromCjs(libsodiumWrappers);
|
|
9975
|
-
const version = "3.7.7";
|
|
9976
|
-
const VERSION = version;
|
|
9977
|
-
const _hasBuffer = typeof Buffer === "function";
|
|
9978
|
-
const _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
|
|
9979
|
-
const _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
|
9980
|
-
const b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
9981
|
-
const b64chs = Array.prototype.slice.call(b64ch);
|
|
9982
|
-
const b64tab = ((a) => {
|
|
9983
|
-
let tab = {};
|
|
9984
|
-
a.forEach((c, i) => tab[c] = i);
|
|
9985
|
-
return tab;
|
|
9986
|
-
})(b64chs);
|
|
9987
|
-
const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
|
9988
|
-
const _fromCC = String.fromCharCode.bind(String);
|
|
9989
|
-
const _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it) => new Uint8Array(Array.prototype.slice.call(it, 0));
|
|
9990
|
-
const _mkUriSafe = (src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_");
|
|
9991
|
-
const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, "");
|
|
9992
|
-
const btoaPolyfill = (bin) => {
|
|
9993
|
-
let u32, c0, c1, c2, asc = "";
|
|
9994
|
-
const pad = bin.length % 3;
|
|
9995
|
-
for (let i = 0; i < bin.length; ) {
|
|
9996
|
-
if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255)
|
|
9997
|
-
throw new TypeError("invalid character found");
|
|
9998
|
-
u32 = c0 << 16 | c1 << 8 | c2;
|
|
9999
|
-
asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63];
|
|
10000
|
-
}
|
|
10001
|
-
return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
|
|
10002
|
-
};
|
|
10003
|
-
const _btoa = typeof btoa === "function" ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
|
|
10004
|
-
const _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
|
|
10005
|
-
const maxargs = 4096;
|
|
10006
|
-
let strs = [];
|
|
10007
|
-
for (let i = 0, l = u8a.length; i < l; i += maxargs) {
|
|
10008
|
-
strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
|
|
10009
|
-
}
|
|
10010
|
-
return _btoa(strs.join(""));
|
|
10011
|
-
};
|
|
10012
|
-
const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a);
|
|
10013
|
-
const cb_utob = (c) => {
|
|
10014
|
-
if (c.length < 2) {
|
|
10015
|
-
var cc = c.charCodeAt(0);
|
|
10016
|
-
return cc < 128 ? c : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
|
|
10017
|
-
} else {
|
|
10018
|
-
var cc = 65536 + (c.charCodeAt(0) - 55296) * 1024 + (c.charCodeAt(1) - 56320);
|
|
10019
|
-
return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
|
|
10020
|
-
}
|
|
10021
|
-
};
|
|
10022
|
-
const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
|
10023
|
-
const utob = (u) => u.replace(re_utob, cb_utob);
|
|
10024
|
-
const _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
|
|
10025
|
-
const encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
|
|
10026
|
-
const encodeURI = (src) => encode(src, true);
|
|
10027
|
-
const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
|
10028
|
-
const cb_btou = (cccc) => {
|
|
10029
|
-
switch (cccc.length) {
|
|
10030
|
-
case 4:
|
|
10031
|
-
var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
|
|
10032
|
-
return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320);
|
|
10033
|
-
case 3:
|
|
10034
|
-
return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2));
|
|
10035
|
-
default:
|
|
10036
|
-
return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
|
|
10037
|
-
}
|
|
10038
|
-
};
|
|
10039
|
-
const btou = (b) => b.replace(re_btou, cb_btou);
|
|
10040
|
-
const atobPolyfill = (asc) => {
|
|
10041
|
-
asc = asc.replace(/\s+/g, "");
|
|
10042
|
-
if (!b64re.test(asc))
|
|
10043
|
-
throw new TypeError("malformed base64.");
|
|
10044
|
-
asc += "==".slice(2 - (asc.length & 3));
|
|
10045
|
-
let u24, bin = "", r1, r2;
|
|
10046
|
-
for (let i = 0; i < asc.length; ) {
|
|
10047
|
-
u24 = b64tab[asc.charAt(i++)] << 18 | b64tab[asc.charAt(i++)] << 12 | (r1 = b64tab[asc.charAt(i++)]) << 6 | (r2 = b64tab[asc.charAt(i++)]);
|
|
10048
|
-
bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
|
|
10049
|
-
}
|
|
10050
|
-
return bin;
|
|
10051
|
-
};
|
|
10052
|
-
const _atob = typeof atob === "function" ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
|
|
10053
|
-
const _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a).split("").map((c) => c.charCodeAt(0)));
|
|
10054
|
-
const toUint8Array$1 = (a) => _toUint8Array(_unURI(a));
|
|
10055
|
-
const _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
|
|
10056
|
-
const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/"));
|
|
10057
|
-
const decode = (src) => _decode(_unURI(src));
|
|
10058
|
-
const isValid = (src) => {
|
|
10059
|
-
if (typeof src !== "string")
|
|
10060
|
-
return false;
|
|
10061
|
-
const s = src.replace(/\s+/g, "").replace(/={0,2}$/, "");
|
|
10062
|
-
return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s);
|
|
10063
|
-
};
|
|
10064
|
-
const _noEnum = (v2) => {
|
|
10065
|
-
return {
|
|
10066
|
-
value: v2,
|
|
10067
|
-
enumerable: false,
|
|
10068
|
-
writable: true,
|
|
10069
|
-
configurable: true
|
|
10070
|
-
};
|
|
10071
|
-
};
|
|
10072
|
-
const extendString = function() {
|
|
10073
|
-
const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body));
|
|
10074
|
-
_add("fromBase64", function() {
|
|
10075
|
-
return decode(this);
|
|
10076
|
-
});
|
|
10077
|
-
_add("toBase64", function(urlsafe) {
|
|
10078
|
-
return encode(this, urlsafe);
|
|
10079
|
-
});
|
|
10080
|
-
_add("toBase64URI", function() {
|
|
10081
|
-
return encode(this, true);
|
|
10082
|
-
});
|
|
10083
|
-
_add("toBase64URL", function() {
|
|
10084
|
-
return encode(this, true);
|
|
10085
|
-
});
|
|
10086
|
-
_add("toUint8Array", function() {
|
|
10087
|
-
return toUint8Array$1(this);
|
|
10088
|
-
});
|
|
10089
|
-
};
|
|
10090
|
-
const extendUint8Array = function() {
|
|
10091
|
-
const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body));
|
|
10092
|
-
_add("toBase64", function(urlsafe) {
|
|
10093
|
-
return fromUint8Array(this, urlsafe);
|
|
10094
|
-
});
|
|
10095
|
-
_add("toBase64URI", function() {
|
|
10096
|
-
return fromUint8Array(this, true);
|
|
10097
|
-
});
|
|
10098
|
-
_add("toBase64URL", function() {
|
|
10099
|
-
return fromUint8Array(this, true);
|
|
10100
|
-
});
|
|
10101
|
-
};
|
|
10102
|
-
const extendBuiltins = () => {
|
|
10103
|
-
extendString();
|
|
10104
|
-
extendUint8Array();
|
|
10105
|
-
};
|
|
10106
|
-
const gBase64 = {
|
|
10107
|
-
version,
|
|
10108
|
-
VERSION,
|
|
10109
|
-
atob: _atob,
|
|
10110
|
-
atobPolyfill,
|
|
10111
|
-
btoa: _btoa,
|
|
10112
|
-
btoaPolyfill,
|
|
10113
|
-
fromBase64: decode,
|
|
10114
|
-
toBase64: encode,
|
|
10115
|
-
encode,
|
|
10116
|
-
encodeURI,
|
|
10117
|
-
encodeURL: encodeURI,
|
|
10118
|
-
utob,
|
|
10119
|
-
btou,
|
|
10120
|
-
decode,
|
|
10121
|
-
isValid,
|
|
10122
|
-
fromUint8Array,
|
|
10123
|
-
toUint8Array: toUint8Array$1,
|
|
10124
|
-
extendString,
|
|
10125
|
-
extendUint8Array,
|
|
10126
|
-
extendBuiltins
|
|
10127
|
-
};
|
|
10128
|
-
function encodeHashToBase64(hash) {
|
|
10129
|
-
return `u${gBase64.fromUint8Array(hash, true)}`;
|
|
10130
|
-
}
|
|
10131
10141
|
const signingCredentials = /* @__PURE__ */ new Map();
|
|
10132
10142
|
const getSigningCredentials = (cellId) => {
|
|
10133
10143
|
const cellIdB64 = encodeHashToBase64(cellId[0]).concat(encodeHashToBase64(cellId[1]));
|
|
@@ -10228,9 +10238,6 @@ class AdminWebsocket {
|
|
|
10228
10238
|
* Get the DNA definition for the specified DNA hash.
|
|
10229
10239
|
*/
|
|
10230
10240
|
getDnaDefinition = this._requester("get_dna_definition");
|
|
10231
|
-
/// Find installed cells which use a DNA that's forward-compatible with the given DNA hash.
|
|
10232
|
-
/// Namely, this finds cells with DNAs whose manifest lists the given DNA hash in its `lineage` field.
|
|
10233
|
-
getCompatibleCells = this._requester("get_compatible_cells");
|
|
10234
10241
|
/**
|
|
10235
10242
|
* Uninstall the specified app from Holochain.
|
|
10236
10243
|
*/
|
|
@@ -10279,6 +10286,7 @@ class AdminWebsocket {
|
|
|
10279
10286
|
storageInfo = this._requester("storage_info");
|
|
10280
10287
|
issueAppAuthenticationToken = this._requester("issue_app_authentication_token");
|
|
10281
10288
|
dumpNetworkStats = this._requester("dump_network_stats");
|
|
10289
|
+
dumpNetworkMetrics = this._requester("dump_network_metrics");
|
|
10282
10290
|
// zome call signing related methods
|
|
10283
10291
|
/**
|
|
10284
10292
|
* Grant a capability for signing zome calls.
|
|
@@ -12015,7 +12023,8 @@ class AppWebsocket {
|
|
|
12015
12023
|
createCloneCellRequester;
|
|
12016
12024
|
enableCloneCellRequester;
|
|
12017
12025
|
disableCloneCellRequester;
|
|
12018
|
-
|
|
12026
|
+
dumpNetworkStatsRequester;
|
|
12027
|
+
dumpNetworkMetricsRequester;
|
|
12019
12028
|
getCountersigningSessionStateRequester;
|
|
12020
12029
|
abandonCountersigningSessionRequester;
|
|
12021
12030
|
publishCountersigningSessionRequester;
|
|
@@ -12034,7 +12043,8 @@ class AppWebsocket {
|
|
|
12034
12043
|
this.createCloneCellRequester = AppWebsocket.requester(this.client, "create_clone_cell", this.defaultTimeout);
|
|
12035
12044
|
this.enableCloneCellRequester = AppWebsocket.requester(this.client, "enable_clone_cell", this.defaultTimeout);
|
|
12036
12045
|
this.disableCloneCellRequester = AppWebsocket.requester(this.client, "disable_clone_cell", this.defaultTimeout);
|
|
12037
|
-
this.
|
|
12046
|
+
this.dumpNetworkStatsRequester = AppWebsocket.requester(this.client, "dump_network_stats", this.defaultTimeout);
|
|
12047
|
+
this.dumpNetworkMetricsRequester = AppWebsocket.requester(this.client, "dump_network_metrics", this.defaultTimeout);
|
|
12038
12048
|
this.getCountersigningSessionStateRequester = AppWebsocket.requester(this.client, "get_countersigning_session_state", this.defaultTimeout);
|
|
12039
12049
|
this.abandonCountersigningSessionRequester = AppWebsocket.requester(this.client, "abandon_countersigning_session", this.defaultTimeout);
|
|
12040
12050
|
this.publishCountersigningSessionRequester = AppWebsocket.requester(this.client, "publish_countersigning_session", this.defaultTimeout);
|
|
@@ -12088,6 +12098,22 @@ class AppWebsocket {
|
|
|
12088
12098
|
this.cachedAppInfo = appInfo;
|
|
12089
12099
|
return appInfo;
|
|
12090
12100
|
}
|
|
12101
|
+
/**
|
|
12102
|
+
* Request network stats.
|
|
12103
|
+
*
|
|
12104
|
+
* @returns The conductor's {@link TransportStats}.
|
|
12105
|
+
*/
|
|
12106
|
+
async dumpNetworkStats(timeout2) {
|
|
12107
|
+
return await this.dumpNetworkStatsRequester(void 0, timeout2);
|
|
12108
|
+
}
|
|
12109
|
+
/**
|
|
12110
|
+
* Request network metrics.
|
|
12111
|
+
*
|
|
12112
|
+
* @returns The {@link NetworkMetrics}.
|
|
12113
|
+
*/
|
|
12114
|
+
async dumpNetworkMetrics(req, timeout2) {
|
|
12115
|
+
return await this.dumpNetworkMetricsRequester(req, timeout2);
|
|
12116
|
+
}
|
|
12091
12117
|
/**
|
|
12092
12118
|
* Provide membrane proofs for the app.
|
|
12093
12119
|
*
|
|
@@ -12097,7 +12123,7 @@ class AppWebsocket {
|
|
|
12097
12123
|
await this.provideMemproofRequester(memproofs);
|
|
12098
12124
|
}
|
|
12099
12125
|
/**
|
|
12100
|
-
*
|
|
12126
|
+
* Enable an app only if the app is in the `AppStatus::Disabled(DisabledAppReason::NotStartedAfterProvidingMemproofs)`
|
|
12101
12127
|
* state. Attempting to enable the app from other states (other than Running) will fail.
|
|
12102
12128
|
*/
|
|
12103
12129
|
async enableApp() {
|
|
@@ -12192,17 +12218,6 @@ class AppWebsocket {
|
|
|
12192
12218
|
...args
|
|
12193
12219
|
});
|
|
12194
12220
|
}
|
|
12195
|
-
/**
|
|
12196
|
-
* Request network info about gossip status.
|
|
12197
|
-
* @param args - Specify the DNAs for which you want network info
|
|
12198
|
-
* @returns Network info for the specified DNAs
|
|
12199
|
-
*/
|
|
12200
|
-
async networkInfo(args) {
|
|
12201
|
-
return this.networkInfoRequester({
|
|
12202
|
-
...args,
|
|
12203
|
-
agent_pub_key: this.myPubKey
|
|
12204
|
-
});
|
|
12205
|
-
}
|
|
12206
12221
|
/**
|
|
12207
12222
|
* Get the state of a countersigning session.
|
|
12208
12223
|
*/
|
|
@@ -12603,24 +12618,21 @@ const handleSignZomeCall = async (e, request) => {
|
|
|
12603
12618
|
return signedZomeCall;
|
|
12604
12619
|
};
|
|
12605
12620
|
async function startLocalServices() {
|
|
12606
|
-
const localServicesHandle = childProcess__namespace.spawn("
|
|
12621
|
+
const localServicesHandle = childProcess__namespace.spawn("kitsune2-bootstrap-srv");
|
|
12607
12622
|
return new Promise((resolve) => {
|
|
12608
12623
|
let bootStrapUrl;
|
|
12609
12624
|
let signalUrl;
|
|
12610
12625
|
let bootstrapRunning = false;
|
|
12611
12626
|
let signalRunnig = false;
|
|
12612
12627
|
localServicesHandle.stdout.pipe(split()).on("data", async (line) => {
|
|
12613
|
-
console.log(`[hc-spin] | [
|
|
12614
|
-
if (line.includes("
|
|
12615
|
-
|
|
12628
|
+
console.log(`[hc-spin] | [kitsune2-bootstrap-srv]: ${line}`);
|
|
12629
|
+
if (line.includes("#kitsune2_bootstrap_srv#listening#")) {
|
|
12630
|
+
const hostAndPort = line.split("#kitsune2_bootstrap_srv#listening#")[1].split("#")[0];
|
|
12631
|
+
bootStrapUrl = `http://${hostAndPort}`;
|
|
12632
|
+
signalUrl = `ws://${hostAndPort}`;
|
|
12616
12633
|
}
|
|
12617
|
-
if (line.includes("
|
|
12618
|
-
signalUrl = line.split("# HC SIGNAL - ADDR:")[1].trim();
|
|
12619
|
-
}
|
|
12620
|
-
if (line.includes("HC BOOTSTRAP - RUNNING")) {
|
|
12634
|
+
if (line.includes("#kitsune2_bootstrap_srv#running#")) {
|
|
12621
12635
|
bootstrapRunning = true;
|
|
12622
|
-
}
|
|
12623
|
-
if (line.includes("HC SIGNAL - RUNNING")) {
|
|
12624
12636
|
signalRunnig = true;
|
|
12625
12637
|
}
|
|
12626
12638
|
if (bootstrapRunning && signalRunnig) resolve([bootStrapUrl, signalUrl]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holochain/hc-spin",
|
|
3
|
-
"version": "0.500.0-
|
|
4
|
-
"holochainVersion": "0.5.0-
|
|
3
|
+
"version": "0.500.0-rc.1",
|
|
4
|
+
"holochainVersion": "0.5.0-rc.3",
|
|
5
5
|
"description": "CLI to run Holochain aps during development.",
|
|
6
6
|
"author": "matthme",
|
|
7
7
|
"homepage": "https://developer.holochain.org",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@electron-toolkit/preload": "^3.0.0",
|
|
37
37
|
"@electron-toolkit/utils": "^3.0.0",
|
|
38
|
-
"@holochain/client": "0.19.0-
|
|
39
|
-
"@holochain/hc-spin-rust-utils": "0.500.0-
|
|
38
|
+
"@holochain/client": "0.19.0-rc.0",
|
|
39
|
+
"@holochain/hc-spin-rust-utils": "0.500.0-rc.1",
|
|
40
40
|
"@msgpack/msgpack": "^2.8.0",
|
|
41
41
|
"bufferutil": "4.0.8",
|
|
42
42
|
"commander": "11.1.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@electron-toolkit/tsconfig": "^1.0.1",
|
|
54
54
|
"@types/node": "^18.19.5",
|
|
55
55
|
"electron-builder": "^24.9.1",
|
|
56
|
-
"electron-vite": "
|
|
56
|
+
"electron-vite": "2.3.0",
|
|
57
57
|
"eslint": "^8.56.0",
|
|
58
58
|
"prettier": "^3.1.1",
|
|
59
59
|
"rimraf": "5.0.5",
|
package/src/main/index.ts
CHANGED
|
@@ -168,24 +168,23 @@ const handleSignZomeCall = async (
|
|
|
168
168
|
};
|
|
169
169
|
|
|
170
170
|
async function startLocalServices(): Promise<[string, string]> {
|
|
171
|
-
const localServicesHandle = childProcess.spawn('
|
|
171
|
+
const localServicesHandle = childProcess.spawn('kitsune2-bootstrap-srv');
|
|
172
172
|
return new Promise((resolve) => {
|
|
173
173
|
let bootStrapUrl;
|
|
174
174
|
let signalUrl;
|
|
175
175
|
let bootstrapRunning = false;
|
|
176
176
|
let signalRunnig = false;
|
|
177
177
|
localServicesHandle.stdout.pipe(split()).on('data', async (line: string) => {
|
|
178
|
-
console.log(`[hc-spin] | [
|
|
179
|
-
if (line.includes('
|
|
180
|
-
|
|
178
|
+
console.log(`[hc-spin] | [kitsune2-bootstrap-srv]: ${line}`);
|
|
179
|
+
if (line.includes('#kitsune2_bootstrap_srv#listening#')) {
|
|
180
|
+
const hostAndPort = line
|
|
181
|
+
.split('#kitsune2_bootstrap_srv#listening#')[1]
|
|
182
|
+
.split("#")[0]
|
|
183
|
+
bootStrapUrl = `http://${hostAndPort}`;
|
|
184
|
+
signalUrl = `ws://${hostAndPort}`;
|
|
181
185
|
}
|
|
182
|
-
if (line.includes('
|
|
183
|
-
signalUrl = line.split('# HC SIGNAL - ADDR:')[1].trim();
|
|
184
|
-
}
|
|
185
|
-
if (line.includes('HC BOOTSTRAP - RUNNING')) {
|
|
186
|
+
if (line.includes('#kitsune2_bootstrap_srv#running#')) {
|
|
186
187
|
bootstrapRunning = true;
|
|
187
|
-
}
|
|
188
|
-
if (line.includes('HC SIGNAL - RUNNING')) {
|
|
189
188
|
signalRunnig = true;
|
|
190
189
|
}
|
|
191
190
|
if (bootstrapRunning && signalRunnig) resolve([bootStrapUrl, signalUrl]);
|