@holochain/client 0.16.4 → 0.16.5

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.
@@ -19,9 +19,7 @@ export type RequesterUnit<Res> = () => Promise<Res>;
19
19
  * @public
20
20
  */
21
21
  export type Tagged<T> = {
22
- type: {
23
- [tag: string]: null;
24
- };
22
+ type: string;
25
23
  data: T;
26
24
  };
27
25
  /**
package/lib/api/common.js CHANGED
@@ -9,7 +9,7 @@ export const DEFAULT_TIMEOUT = 60000;
9
9
  */
10
10
  export const requesterTransformer = (requester, tag, transform = identityTransformer) => async (req, timeout) => {
11
11
  const transformedInput = await transform.input(req);
12
- const input = { type: { [tag]: null }, data: transformedInput };
12
+ const input = { type: tag, data: transformedInput };
13
13
  const response = await requester(input, timeout);
14
14
  const output = transform.output(response.data);
15
15
  return output;
@@ -33,9 +33,8 @@ export class HolochainError extends Error {
33
33
  }
34
34
  // this determines the error format of all error responses
35
35
  export const catchError = (res) => {
36
- if (ERROR_TYPE in res.type) {
37
- const errorName = Object.keys(res.data.type)[0];
38
- const error = new HolochainError(errorName, res.data.data);
36
+ if (res.type === ERROR_TYPE) {
37
+ const error = new HolochainError(res.data.type, res.data.data);
39
38
  return Promise.reject(error);
40
39
  }
41
40
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holochain/client",
3
- "version": "0.16.4",
3
+ "version": "0.16.5",
4
4
  "description": "A JavaScript client for the Holochain Conductor API",
5
5
  "author": "Holochain Foundation <info@holochain.org> (http://holochain.org)",
6
6
  "license": "CAL-1.0",