@holochain/hc-spin 0.200.8 → 0.300.0

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/cli/cli.js CHANGED
@@ -28,6 +28,8 @@ const child = spawn(
28
28
  },
29
29
  );
30
30
 
31
+ child.on('error', (err) => console.error('[electron]: ERROR: ', err));
32
+
31
33
  // Handle child process exit
32
34
  child.on('exit', (code, _signal) => {
33
35
  process.exit(code);
package/dist/cli.js CHANGED
@@ -28,6 +28,8 @@ const child = spawn(
28
28
  },
29
29
  );
30
30
 
31
+ child.on('error', (err) => console.error('[electron]: ERROR: ', err));
32
+
31
33
  // Handle child process exit
32
34
  child.on('exit', (code, _signal) => {
33
35
  process.exit(code);
@@ -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 === ERROR_TYPE) {
10806
- const error = new HolochainError(res.data.type, res.data.data);
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 env = getLauncherEnvironment();
10907
- if (!env) {
10908
- return signZomeCall(request);
10909
- } else if (env.FRAMEWORK === "electron") {
10910
- return signZomeCallElectron(request);
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.200.8 (for holochain 0.2.x)`).argument(
11807
+ cli.name("hc-spin").description("CLI to run Holochain aps during development.").version(`0.300.0 (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(
@@ -12026,11 +12035,6 @@ electron.app.whenReady().then(async () => {
12026
12035
  };
12027
12036
  }
12028
12037
  });
12029
- electron.app.on("window-all-closed", () => {
12030
- if (process.platform !== "darwin") {
12031
- electron.app.quit();
12032
- }
12033
- });
12034
12038
  electron.app.on("quit", () => {
12035
12039
  fs.writeFileSync(
12036
12040
  path.join(DATA_ROOT_DIR, ".abandoned"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holochain/hc-spin",
3
- "version": "0.200.8",
3
+ "version": "0.300.0",
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.16.3",
38
- "@holochain/hc-spin-rust-utils": "^0.200.3",
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.200.8 (for holochain 0.2.x)`)
31
+ .version(`0.300.0 (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',
@@ -351,15 +351,6 @@ app.whenReady().then(async () => {
351
351
  // });
352
352
  });
353
353
 
354
- // Quit when all windows are closed, except on macOS. There, it's common
355
- // for applications and their menu bar to stay active until the user quits
356
- // explicitly with Cmd + Q.
357
- app.on('window-all-closed', () => {
358
- if (process.platform !== 'darwin') {
359
- app.quit();
360
- }
361
- });
362
-
363
354
  app.on('quit', () => {
364
355
  fs.writeFileSync(
365
356
  path.join(DATA_ROOT_DIR, '.abandoned'),