@dxos/react-client 2.16.17 → 2.17.3

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.
Files changed (79) hide show
  1. package/.rush/temp/package-deps_build:test.json +11 -12
  2. package/.rush/temp/shrinkwrap-deps.json +3 -5
  3. package/dist/src/components/ErrorBoundary.js +1 -1
  4. package/dist/src/components/ErrorBoundary.js.map +1 -1
  5. package/dist/src/containers/ClientInitializer.js +4 -4
  6. package/dist/src/containers/ClientInitializer.js.map +1 -1
  7. package/dist/src/containers/ClientProvider.js +1 -1
  8. package/dist/src/containers/ClientProvider.js.map +1 -1
  9. package/dist/src/containers/ClientProvider.test.js +6 -6
  10. package/dist/src/containers/ClientProvider.test.js.map +1 -1
  11. package/dist/src/containers/ProfileInitializer.js +3 -3
  12. package/dist/src/containers/ProfileInitializer.js.map +1 -1
  13. package/dist/src/hooks/client/client.test.js +7 -7
  14. package/dist/src/hooks/client/client.test.js.map +1 -1
  15. package/dist/src/hooks/client/config.test.js +10 -10
  16. package/dist/src/hooks/client/config.test.js.map +1 -1
  17. package/dist/src/hooks/client/context.js +1 -1
  18. package/dist/src/hooks/client/context.js.map +1 -1
  19. package/dist/src/hooks/client/useClient.d.ts.map +1 -1
  20. package/dist/src/hooks/client/useClient.js +1 -2
  21. package/dist/src/hooks/client/useClient.js.map +1 -1
  22. package/dist/src/hooks/client/useConfig.js +1 -1
  23. package/dist/src/hooks/client/useConfig.js.map +1 -1
  24. package/dist/src/hooks/client/useProfile.js +3 -3
  25. package/dist/src/hooks/client/useProfile.js.map +1 -1
  26. package/dist/src/hooks/echo-queries/useContacts.js +3 -3
  27. package/dist/src/hooks/echo-queries/useContacts.js.map +1 -1
  28. package/dist/src/hooks/echo-queries/useMembers.js +2 -2
  29. package/dist/src/hooks/echo-queries/useMembers.js.map +1 -1
  30. package/dist/src/hooks/echo-queries/useParties.js +5 -5
  31. package/dist/src/hooks/echo-queries/useParties.js.map +1 -1
  32. package/dist/src/hooks/echo-selections/useSelection.js +2 -2
  33. package/dist/src/hooks/echo-selections/useSelection.js.map +1 -1
  34. package/dist/src/hooks/invitations/index.d.ts +0 -1
  35. package/dist/src/hooks/invitations/index.d.ts.map +1 -1
  36. package/dist/src/hooks/invitations/index.js +0 -1
  37. package/dist/src/hooks/invitations/index.js.map +1 -1
  38. package/dist/src/hooks/invitations/useSecretGenerator.js +2 -2
  39. package/dist/src/hooks/invitations/useSecretGenerator.js.map +1 -1
  40. package/dist/src/hooks/invitations/useSecretProvider.js +1 -1
  41. package/dist/src/hooks/invitations/useSecretProvider.js.map +1 -1
  42. package/dist/src/hooks/util/useResultSet.js +1 -1
  43. package/dist/src/hooks/util/useResultSet.js.map +1 -1
  44. package/dist/src/hooks/wns/registryBotFactories.js +4 -4
  45. package/dist/src/hooks/wns/registryBotFactories.js.map +1 -1
  46. package/dist/src/hooks/wns/registryBots.js +4 -4
  47. package/dist/src/hooks/wns/registryBots.js.map +1 -1
  48. package/dist/stories/client.stories.js +2 -2
  49. package/dist/stories/client.stories.js.map +1 -1
  50. package/dist/stories/halo-invitations.stories.js +12 -11
  51. package/dist/stories/halo-invitations.stories.js.map +1 -1
  52. package/dist/stories/helpers/Container.js +1 -1
  53. package/dist/stories/helpers/Container.js.map +1 -1
  54. package/dist/stories/helpers/PartyJoinPanel.js +3 -3
  55. package/dist/stories/helpers/PartyJoinPanel.js.map +1 -1
  56. package/dist/stories/helpers/ThemeProvider.js +1 -1
  57. package/dist/stories/helpers/ThemeProvider.js.map +1 -1
  58. package/dist/stories/party-invitations.stories.d.ts.map +1 -1
  59. package/dist/stories/party-invitations.stories.js +15 -14
  60. package/dist/stories/party-invitations.stories.js.map +1 -1
  61. package/dist/tests/config.test.js +3 -3
  62. package/dist/tests/config.test.js.map +1 -1
  63. package/dist/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +10 -11
  65. package/react-client.build.log +5 -5
  66. package/src/hooks/client/client.test.tsx +1 -1
  67. package/src/hooks/client/config.test.tsx +1 -1
  68. package/src/hooks/client/useClient.ts +1 -2
  69. package/src/hooks/client/useConfig.ts +1 -1
  70. package/src/hooks/invitations/index.ts +0 -1
  71. package/src/hooks/wns/registryBotFactories.ts +1 -1
  72. package/src/hooks/wns/registryBots.ts +1 -1
  73. package/stories/halo-invitations.stories.tsx +3 -3
  74. package/stories/party-invitations.stories.tsx +2 -3
  75. package/dist/src/hooks/invitations/utils.d.ts +0 -5
  76. package/dist/src/hooks/invitations/utils.d.ts.map +0 -1
  77. package/dist/src/hooks/invitations/utils.js +0 -27
  78. package/dist/src/hooks/invitations/utils.js.map +0 -1
  79. package/src/hooks/invitations/utils.ts +0 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-client",
3
- "version": "2.16.17",
3
+ "version": "2.17.3",
4
4
  "description": "React client API",
5
5
  "keywords": [],
6
6
  "license": "AGPL-3.0",
@@ -14,17 +14,16 @@
14
14
  "test": "toolchain test"
15
15
  },
16
16
  "dependencies": {
17
- "@dxos/async": "2.16.17",
18
- "@dxos/client": "2.16.17",
19
- "@dxos/config": "2.16.17",
20
- "@dxos/credentials": "2.16.17",
21
- "@dxos/crypto": "2.16.17",
22
- "@dxos/debug": "2.16.17",
23
- "@dxos/echo-db": "2.16.17",
24
- "@dxos/util": "2.16.17",
17
+ "@dxos/async": "2.17.3",
18
+ "@dxos/client": "2.17.3",
19
+ "@dxos/config": "2.17.3",
20
+ "@dxos/credentials": "2.17.3",
21
+ "@dxos/crypto": "2.17.3",
22
+ "@dxos/debug": "2.17.3",
23
+ "@dxos/echo-db": "2.17.3",
24
+ "@dxos/util": "2.17.3",
25
25
  "@types/debug": "^4.1.1",
26
26
  "assert": "^2.0.0",
27
- "base-x": "~3.0.9",
28
27
  "debug": "^4.1.1",
29
28
  "react-display-name": "^0.2.5",
30
29
  "use-subscription": "^1.4.1"
@@ -47,7 +46,7 @@
47
46
  "react-docgen-typescript-loader": "^3.7.2",
48
47
  "react-dom": "^17.0.2",
49
48
  "react-test-renderer": "^17.0.2",
50
- "typescript": "^4.3.5",
49
+ "typescript": "^4.5.2",
51
50
  "webpack": "4.44.2"
52
51
  },
53
52
  "peerDependencies": {
@@ -2,10 +2,10 @@ Invoking: toolchain build:test
2
2
 
3
3
 
4
4
  typescript
5
- OK in 5600 ms
5
+ OK in 5662 ms
6
6
 
7
7
  eslint
8
- OK in 5599 ms
8
+ OK in 5244 ms
9
9
 
10
10
  mocha
11
11
  This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
@@ -26,8 +26,8 @@ This browser doesn't support cancelAnimationFrame. Make sure that you load a pol
26
26
  ✓ should return custom client config when used properly in a context
27
27
 
28
28
 
29
- 7 passing (248ms)
29
+ 7 passing (203ms)
30
30
 
31
- OK in 6747 ms
31
+ OK in 7076 ms
32
32
 
33
- CHECK COMPLETE in 17950 ms
33
+ CHECK COMPLETE in 17987 ms
@@ -9,8 +9,8 @@ import React from 'react';
9
9
  import { Client } from '@dxos/client';
10
10
  import { defs } from '@dxos/config';
11
11
 
12
- import { useClient } from '.';
13
12
  import { ClientProvider } from '../../containers';
13
+ import { useClient } from './useClient';
14
14
 
15
15
  describe('Client hook', () => {
16
16
  const render = () => useClient();
@@ -9,8 +9,8 @@ import React from 'react';
9
9
  import { Client } from '@dxos/client';
10
10
  import { ConfigObject } from '@dxos/config';
11
11
 
12
- import { useConfig } from '.';
13
12
  import { ClientProvider } from '../../containers';
13
+ import { useConfig } from './useConfig';
14
14
 
15
15
  describe('Config hook', () => {
16
16
  const render = () => useConfig();
@@ -13,6 +13,5 @@ import { ClientContext } from './context';
13
13
  * To be used with `ClientProvider` or `ClientInitializer` component wrapper.
14
14
  */
15
15
  export const useClient = () => {
16
- const client = useContext(ClientContext) ?? raise(new Error('`useClient` hook is called outside of ClientContext. Wrap the component with `ClientProvider` or `ClientInitializer`'));
17
- return client;
16
+ return useContext(ClientContext) ?? raise(new Error('ClientContext no set.'));
18
17
  };
@@ -13,6 +13,6 @@ import { ClientContext } from './context';
13
13
  * To be used with `ClientProvider` or `ClientInitializer` component wrapper.
14
14
  */
15
15
  export const useConfig = () => {
16
- const { config } = useContext(ClientContext) ?? raise(new Error('`useConfig` hook is called outside of ClientContext. Wrap the component with `ClientProvider` or `ClientInitializer`'));
16
+ const { config } = useContext(ClientContext) ?? raise(new Error('ClientContext no set.'));
17
17
  return config;
18
18
  };
@@ -4,4 +4,3 @@
4
4
 
5
5
  export * from './useSecretGenerator';
6
6
  export * from './useSecretProvider';
7
- export * from './utils';
@@ -34,7 +34,7 @@ export const useRegistryBotFactories = () => {
34
34
  let factoriesResult: QueryRecord[];
35
35
  try {
36
36
  factoriesResult = await registry.queryRecords({ type: WRN_TYPE_BOT_FACTORY });
37
- } catch (e) {
37
+ } catch (e: any) {
38
38
  log('Querying bot factories unsuccessful.');
39
39
  log(e);
40
40
  return;
@@ -42,7 +42,7 @@ export const useRegistryBots = (props: UseRegistryBotsProps = {}) => {
42
42
  let botsResult: QueryRecord[];
43
43
  try {
44
44
  botsResult = await registry.queryRecords({ type: WRN_TYPE_BOT });
45
- } catch (e) {
45
+ } catch (e: any) {
46
46
  log('Querying bots unsuccessful.');
47
47
  log(e);
48
48
  return;
@@ -8,10 +8,10 @@ import {
8
8
  Box, Button, Divider, Paper, TextField, Toolbar
9
9
  } from '@mui/material';
10
10
 
11
+ import { encodeInvitation, decodeInvitation } from '@dxos/client';
12
+
11
13
  import {
12
14
  ClientInitializer,
13
- decodeInvitation,
14
- encodeInvitation,
15
15
  ProfileInitializer,
16
16
  useClient,
17
17
  useParties,
@@ -106,7 +106,7 @@ const HaloAuthenticationContainer = () => {
106
106
  await client.echo.halo.join(invitation, secretProvider);
107
107
  setStatus({ identity: invitation.identityKey.toString() });
108
108
  }
109
- } catch (err) {
109
+ } catch (err: any) {
110
110
  // TODO(burdon): Doesn't support retry. Provide hint (eg, should retry/cancel).
111
111
  setStatus({ error: err });
112
112
  }
@@ -8,13 +8,12 @@ import {
8
8
  Box, Button, Divider, Paper, TextField, Toolbar
9
9
  } from '@mui/material';
10
10
 
11
+ import { encodeInvitation, decodeInvitation } from '@dxos/client';
11
12
  import { PublicKey } from '@dxos/crypto';
12
13
  import { InvitationDescriptorType } from '@dxos/echo-db';
13
14
 
14
15
  import {
15
16
  ClientInitializer,
16
- decodeInvitation,
17
- encodeInvitation,
18
17
  ProfileInitializer,
19
18
  useClient,
20
19
  useContacts,
@@ -143,7 +142,7 @@ const PartyJoinContainer = () => {
143
142
  await party.open();
144
143
 
145
144
  setStatus({ party: party.key.toHex() });
146
- } catch (error) {
145
+ } catch (error: any) {
147
146
  setStatus({ error });
148
147
  }
149
148
  };
@@ -1,5 +0,0 @@
1
- import { InvitationDescriptor } from '@dxos/echo-db';
2
- export declare const encodeInvitation: (invitation: InvitationDescriptor) => string;
3
- export declare const decodeInvitation: (code: string) => InvitationDescriptor;
4
- export declare const noOp: () => null;
5
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/hooks/invitations/utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAKrD,eAAO,MAAM,gBAAgB,eAAgB,oBAAoB,WAGhE,CAAC;AAEF,eAAO,MAAM,gBAAgB,SAAU,MAAM,yBAG5C,CAAC;AAGF,eAAO,MAAM,IAAI,YAAa,CAAC"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- //
3
- // Copyright 2020 DXOS.org
4
- //
5
- var __importDefault = (this && this.__importDefault) || function (mod) {
6
- return (mod && mod.__esModule) ? mod : { "default": mod };
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.noOp = exports.decodeInvitation = exports.encodeInvitation = void 0;
10
- const base_x_1 = __importDefault(require("base-x"));
11
- const echo_db_1 = require("@dxos/echo-db");
12
- // Encode with only alpha-numberic characters.
13
- const base62 = base_x_1.default('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
14
- const encodeInvitation = (invitation) => {
15
- const buffer = Buffer.from(JSON.stringify(invitation.toQueryParameters()));
16
- return base62.encode(buffer);
17
- };
18
- exports.encodeInvitation = encodeInvitation;
19
- const decodeInvitation = (code) => {
20
- const json = base62.decode(code).toString();
21
- return echo_db_1.InvitationDescriptor.fromQueryParameters(JSON.parse(json));
22
- };
23
- exports.decodeInvitation = decodeInvitation;
24
- // TODO(burdon): Factor out.
25
- const noOp = () => null;
26
- exports.noOp = noOp;
27
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/hooks/invitations/utils.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,oDAA0B;AAE1B,2CAAqD;AAErD,8CAA8C;AAC9C,MAAM,MAAM,GAAG,gBAAI,CAAC,gEAAgE,CAAC,CAAC;AAE/E,MAAM,gBAAgB,GAAG,CAAC,UAAgC,EAAE,EAAE;IACnE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;IAC3E,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AAHW,QAAA,gBAAgB,oBAG3B;AAEK,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,EAAE;IAC/C,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC5C,OAAO,8BAAoB,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACpE,CAAC,CAAC;AAHW,QAAA,gBAAgB,oBAG3B;AAEF,4BAA4B;AACrB,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;AAAlB,QAAA,IAAI,QAAc"}
@@ -1,23 +0,0 @@
1
- //
2
- // Copyright 2020 DXOS.org
3
- //
4
-
5
- import base from 'base-x';
6
-
7
- import { InvitationDescriptor } from '@dxos/echo-db';
8
-
9
- // Encode with only alpha-numberic characters.
10
- const base62 = base('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
11
-
12
- export const encodeInvitation = (invitation: InvitationDescriptor) => {
13
- const buffer = Buffer.from(JSON.stringify(invitation.toQueryParameters()));
14
- return base62.encode(buffer);
15
- };
16
-
17
- export const decodeInvitation = (code: string) => {
18
- const json = base62.decode(code).toString();
19
- return InvitationDescriptor.fromQueryParameters(JSON.parse(json));
20
- };
21
-
22
- // TODO(burdon): Factor out.
23
- export const noOp = () => null;