@holochain/hc-spin 0.200.9 → 0.300.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 +8 -0
- package/dist/main/index.js +19 -10
- package/package.json +3 -3
- package/src/main/index.ts +1 -1
package/README.md
CHANGED
|
@@ -20,6 +20,14 @@ To install the latest version compatible with **holochain 0.2.x**:
|
|
|
20
20
|
npm install --save-dev @holochain/hc-spin@">=0.200.0 <0.300.0"
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
To install the latest version compatible with **holochain 0.3.x**:
|
|
24
|
+
|
|
25
|
+
⚠️ Requires `@holochain/client 0.17.0-dev.5` or newer ⚠️
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
npm install --save-dev @holochain/hc-spin@">=0.300.0 <0.400.0"
|
|
29
|
+
```
|
|
30
|
+
|
|
23
31
|
## Usage (holochain 0.2)
|
|
24
32
|
|
|
25
33
|
```
|
package/dist/main/index.js
CHANGED
|
@@ -6314,8 +6314,10 @@ const randomByteArray = async (length) => {
|
|
|
6314
6314
|
};
|
|
6315
6315
|
const getNonceExpiration = () => (Date.now() + 5 * 60 * 1e3) * 1e3;
|
|
6316
6316
|
const __HC_LAUNCHER_ENV__ = "__HC_LAUNCHER_ENV__";
|
|
6317
|
+
const __HC_ZOME_CALL_SIGNER__ = "__HC_ZOME_CALL_SIGNER__";
|
|
6317
6318
|
const isLauncher = () => globalThis.window && __HC_LAUNCHER_ENV__ in globalThis.window;
|
|
6318
6319
|
const getLauncherEnvironment = () => isLauncher() ? globalThis.window[__HC_LAUNCHER_ENV__] : void 0;
|
|
6320
|
+
const getHostZomeCallSigner = () => globalThis.window && globalThis.window[__HC_ZOME_CALL_SIGNER__];
|
|
6319
6321
|
const signZomeCallTauri = async (request) => {
|
|
6320
6322
|
const zomeCallUnsigned = {
|
|
6321
6323
|
provenance: Array.from(request.provenance),
|
|
@@ -10784,7 +10786,7 @@ const ERROR_TYPE = "error";
|
|
|
10784
10786
|
const DEFAULT_TIMEOUT = 6e4;
|
|
10785
10787
|
const requesterTransformer = (requester, tag, transform = identityTransformer) => async (req, timeout2) => {
|
|
10786
10788
|
const transformedInput = await transform.input(req);
|
|
10787
|
-
const input = { type: tag, data: transformedInput };
|
|
10789
|
+
const input = { type: { [tag]: null }, data: transformedInput };
|
|
10788
10790
|
const response = await requester(input, timeout2);
|
|
10789
10791
|
const output = transform.output(response.data);
|
|
10790
10792
|
return output;
|
|
@@ -10802,8 +10804,9 @@ class HolochainError extends Error {
|
|
|
10802
10804
|
}
|
|
10803
10805
|
}
|
|
10804
10806
|
const catchError = (res) => {
|
|
10805
|
-
if (res.type
|
|
10806
|
-
const
|
|
10807
|
+
if (ERROR_TYPE in res.type) {
|
|
10808
|
+
const errorName = Object.keys(res.data.type)[0];
|
|
10809
|
+
const error = new HolochainError(errorName, res.data.data);
|
|
10807
10810
|
return Promise.reject(error);
|
|
10808
10811
|
} else {
|
|
10809
10812
|
return Promise.resolve(res);
|
|
@@ -10903,13 +10906,19 @@ const callZomeTransform = {
|
|
|
10903
10906
|
if ("signature" in request) {
|
|
10904
10907
|
return request;
|
|
10905
10908
|
}
|
|
10906
|
-
const
|
|
10907
|
-
if (
|
|
10908
|
-
return signZomeCall(request);
|
|
10909
|
-
} else
|
|
10910
|
-
|
|
10909
|
+
const hostSigner = getHostZomeCallSigner();
|
|
10910
|
+
if (hostSigner) {
|
|
10911
|
+
return hostSigner.signZomeCall(request);
|
|
10912
|
+
} else {
|
|
10913
|
+
const env = getLauncherEnvironment();
|
|
10914
|
+
if (!env) {
|
|
10915
|
+
return signZomeCall(request);
|
|
10916
|
+
}
|
|
10917
|
+
if (env.FRAMEWORK === "electron") {
|
|
10918
|
+
return signZomeCallElectron(request);
|
|
10919
|
+
}
|
|
10920
|
+
return signZomeCallTauri(request);
|
|
10911
10921
|
}
|
|
10912
|
-
return signZomeCallTauri(request);
|
|
10913
10922
|
},
|
|
10914
10923
|
output: (response) => msgpack.decode(response)
|
|
10915
10924
|
};
|
|
@@ -11795,7 +11804,7 @@ const menu = electron.Menu.buildFromTemplate([
|
|
|
11795
11804
|
]);
|
|
11796
11805
|
const rustUtils = require("@holochain/hc-spin-rust-utils");
|
|
11797
11806
|
const cli = new commander.Command();
|
|
11798
|
-
cli.name("hc-spin").description("CLI to run Holochain aps during development.").version(`0.
|
|
11807
|
+
cli.name("hc-spin").description("CLI to run Holochain aps during development.").version(`0.300.1 (for holochain 0.3.x)`).argument(
|
|
11799
11808
|
"<path>",
|
|
11800
11809
|
"Path to .webhapp or .happ file to launch. If a .happ file is passed, either a UI path must be specified via --ui-path or a port pointing to a localhost server via --ui-port"
|
|
11801
11810
|
).option(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holochain/hc-spin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.300.1",
|
|
4
4
|
"description": "CLI to run Holochain aps during development.",
|
|
5
5
|
"author": "matthme",
|
|
6
6
|
"homepage": "https://developer.holochain.org",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@electron-toolkit/preload": "^3.0.0",
|
|
36
36
|
"@electron-toolkit/utils": "^3.0.0",
|
|
37
|
-
"@holochain/client": "^0.
|
|
38
|
-
"@holochain/hc-spin-rust-utils": "^0.
|
|
37
|
+
"@holochain/client": "^0.17.0-dev.5",
|
|
38
|
+
"@holochain/hc-spin-rust-utils": "^0.300.1",
|
|
39
39
|
"@msgpack/msgpack": "^2.8.0",
|
|
40
40
|
"commander": "11.1.0",
|
|
41
41
|
"electron": "^28.1.1",
|
package/src/main/index.ts
CHANGED
|
@@ -28,7 +28,7 @@ const cli = new Command();
|
|
|
28
28
|
cli
|
|
29
29
|
.name('hc-spin')
|
|
30
30
|
.description('CLI to run Holochain aps during development.')
|
|
31
|
-
.version(`0.
|
|
31
|
+
.version(`0.300.1 (for holochain 0.3.x)`)
|
|
32
32
|
.argument(
|
|
33
33
|
'<path>',
|
|
34
34
|
'Path to .webhapp or .happ file to launch. If a .happ file is passed, either a UI path must be specified via --ui-path or a port pointing to a localhost server via --ui-port',
|