@iotopen/react-lynx 1.0.0 → 1.0.2-rc.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.
Files changed (104) hide show
  1. package/README.md +1 -1
  2. package/dist/{cjs/Contexts → Contexts}/LynxClientProvider.d.ts +6 -5
  3. package/dist/Contexts/LynxProvider.d.ts +9 -0
  4. package/dist/{esm/Contexts → Contexts}/UserProvider.d.ts +3 -3
  5. package/dist/{esm/Contexts → Contexts}/index.d.ts +2 -2
  6. package/dist/{cjs/Hooks → Hooks}/index.d.ts +42 -26
  7. package/dist/Hooks/useCheckPermissions.d.ts +4 -0
  8. package/dist/{cjs/Hooks → Hooks}/useDevice.d.ts +4 -4
  9. package/dist/{esm/Hooks → Hooks}/useDevices.d.ts +1 -1
  10. package/dist/{esm/Hooks → Hooks}/useEdgeApp.d.ts +1 -1
  11. package/dist/{esm/Hooks → Hooks}/useFunction.d.ts +1 -1
  12. package/dist/{cjs/Hooks → Hooks}/useFunctions.d.ts +1 -1
  13. package/dist/{cjs/Hooks → Hooks}/useInstallation.d.ts +1 -1
  14. package/dist/Hooks/useLiveInstallation.d.ts +10 -0
  15. package/dist/Hooks/useMQTT.d.ts +1 -0
  16. package/dist/Hooks/useMultiLiveInstallation.d.ts +11 -0
  17. package/dist/{esm/Hooks → Hooks}/useNewDevice.d.ts +4 -4
  18. package/dist/{esm/Hooks → Hooks}/useNewFunction.d.ts +4 -4
  19. package/dist/{esm/Hooks → Hooks}/useNewInstallation.d.ts +4 -4
  20. package/dist/{esm/Hooks → Hooks}/useNewNotificationMessage.d.ts +4 -4
  21. package/dist/{cjs/Hooks → Hooks}/useNewNotificationOutput.d.ts +4 -4
  22. package/dist/{esm/Hooks → Hooks}/useNewOAuth2Client.d.ts +4 -4
  23. package/dist/{esm/Hooks → Hooks}/useNewOrganization.d.ts +4 -4
  24. package/dist/{cjs/Hooks → Hooks}/useNewUser.d.ts +7 -8
  25. package/dist/{cjs/Hooks → Hooks}/useNotificationMessage.d.ts +1 -1
  26. package/dist/{esm/Hooks → Hooks}/useNotificationOutput.d.ts +1 -1
  27. package/dist/{cjs/Hooks → Hooks}/useNotificationOutputExecutor.d.ts +1 -1
  28. package/dist/{cjs/Hooks → Hooks}/useOAuth2Client.d.ts +2 -2
  29. package/dist/Hooks/useOAuth2Consent.d.ts +5 -0
  30. package/dist/{cjs/Hooks → Hooks}/useOrganization.d.ts +2 -2
  31. package/dist/{cjs/Hooks → Hooks}/useOrganizations.d.ts +3 -3
  32. package/dist/{esm/Hooks → Hooks}/usePahoMQTTClient.d.ts +4 -4
  33. package/dist/Hooks/useSimpleMQTT.d.ts +18 -0
  34. package/dist/{cjs/Hooks → Hooks}/useTokens.d.ts +1 -1
  35. package/dist/{esm/Hooks → Hooks}/useUser.d.ts +2 -2
  36. package/dist/{esm/Hooks → Hooks}/useUsers.d.ts +1 -1
  37. package/dist/cjs/index.js +1 -16
  38. package/dist/cjs/index.js.map +1 -1
  39. package/dist/esm/index.js +1423 -16
  40. package/dist/esm/index.js.map +1 -1
  41. package/dist/index.d.ts +2 -439
  42. package/package.json +87 -49
  43. package/dist/cjs/Contexts/LynxProvider.d.ts +0 -8
  44. package/dist/cjs/Contexts/UserProvider.d.ts +0 -19
  45. package/dist/cjs/Contexts/index.d.ts +0 -3
  46. package/dist/cjs/Hooks/useDevices.d.ts +0 -10
  47. package/dist/cjs/Hooks/useEdgeApp.d.ts +0 -8
  48. package/dist/cjs/Hooks/useFunction.d.ts +0 -15
  49. package/dist/cjs/Hooks/useMeta.d.ts +0 -15
  50. package/dist/cjs/Hooks/useNewDevice.d.ts +0 -12
  51. package/dist/cjs/Hooks/useNewFunction.d.ts +0 -12
  52. package/dist/cjs/Hooks/useNewInstallation.d.ts +0 -12
  53. package/dist/cjs/Hooks/useNewNotificationMessage.d.ts +0 -11
  54. package/dist/cjs/Hooks/useNewOAuth2Client.d.ts +0 -22
  55. package/dist/cjs/Hooks/useNewOrganization.d.ts +0 -18
  56. package/dist/cjs/Hooks/useNotificationOutput.d.ts +0 -10
  57. package/dist/cjs/Hooks/useOAuth2Consent.d.ts +0 -5
  58. package/dist/cjs/Hooks/usePahoMQTTClient.d.ts +0 -16
  59. package/dist/cjs/Hooks/useSimpleMQTT.d.ts +0 -12
  60. package/dist/cjs/Hooks/useUser.d.ts +0 -10
  61. package/dist/cjs/Hooks/useUsers.d.ts +0 -8
  62. package/dist/cjs/index.d.ts +0 -2
  63. package/dist/esm/Contexts/LynxClientProvider.d.ts +0 -14
  64. package/dist/esm/Contexts/LynxProvider.d.ts +0 -8
  65. package/dist/esm/Hooks/index.d.ts +0 -38
  66. package/dist/esm/Hooks/useConfiguredEdgeApps.d.ts +0 -7
  67. package/dist/esm/Hooks/useDevice.d.ts +0 -15
  68. package/dist/esm/Hooks/useEdgeAppVersions.d.ts +0 -8
  69. package/dist/esm/Hooks/useEdgeApps.d.ts +0 -7
  70. package/dist/esm/Hooks/useFunctions.d.ts +0 -10
  71. package/dist/esm/Hooks/useIDTokenAlgorithms.d.ts +0 -7
  72. package/dist/esm/Hooks/useInstallation.d.ts +0 -9
  73. package/dist/esm/Hooks/useInstallationInfo.d.ts +0 -7
  74. package/dist/esm/Hooks/useInstallations.d.ts +0 -7
  75. package/dist/esm/Hooks/useNewNotificationOutput.d.ts +0 -15
  76. package/dist/esm/Hooks/useNewUser.d.ts +0 -27
  77. package/dist/esm/Hooks/useNotificationMessage.d.ts +0 -10
  78. package/dist/esm/Hooks/useNotificationMessages.d.ts +0 -7
  79. package/dist/esm/Hooks/useNotificationOutputExecutor.d.ts +0 -8
  80. package/dist/esm/Hooks/useNotificationOutputExecutors.d.ts +0 -7
  81. package/dist/esm/Hooks/useNotificationOutputs.d.ts +0 -7
  82. package/dist/esm/Hooks/useOAuth2Client.d.ts +0 -10
  83. package/dist/esm/Hooks/useOAuth2Clients.d.ts +0 -7
  84. package/dist/esm/Hooks/useOAuth2Consent.d.ts +0 -5
  85. package/dist/esm/Hooks/useOrganization.d.ts +0 -10
  86. package/dist/esm/Hooks/useOrganizations.d.ts +0 -9
  87. package/dist/esm/Hooks/useRoles.d.ts +0 -7
  88. package/dist/esm/Hooks/useSimpleMQTT.d.ts +0 -12
  89. package/dist/esm/Hooks/useTokens.d.ts +0 -9
  90. package/dist/esm/index.d.ts +0 -2
  91. package/dist/esm/types.d.ts +0 -1
  92. package/dist/{cjs/Hooks → Hooks}/useConfiguredEdgeApps.d.ts +0 -0
  93. package/dist/{cjs/Hooks → Hooks}/useEdgeAppVersions.d.ts +0 -0
  94. package/dist/{cjs/Hooks → Hooks}/useEdgeApps.d.ts +0 -0
  95. package/dist/{cjs/Hooks → Hooks}/useIDTokenAlgorithms.d.ts +0 -0
  96. package/dist/{cjs/Hooks → Hooks}/useInstallationInfo.d.ts +0 -0
  97. package/dist/{cjs/Hooks → Hooks}/useInstallations.d.ts +0 -0
  98. package/dist/{esm/Hooks → Hooks}/useMeta.d.ts +1 -1
  99. /package/dist/{cjs/Hooks → Hooks}/useNotificationMessages.d.ts +0 -0
  100. /package/dist/{cjs/Hooks → Hooks}/useNotificationOutputExecutors.d.ts +0 -0
  101. /package/dist/{cjs/Hooks → Hooks}/useNotificationOutputs.d.ts +0 -0
  102. /package/dist/{cjs/Hooks → Hooks}/useOAuth2Clients.d.ts +0 -0
  103. /package/dist/{cjs/Hooks → Hooks}/useRoles.d.ts +0 -0
  104. /package/dist/{cjs/types.d.ts → types.d.ts} +0 -0
package/README.md CHANGED
@@ -41,7 +41,7 @@ const MyComponent = () => {
41
41
  <div>
42
42
  {loading && <h2>Loading installations...</h2>}
43
43
  {!loading && <ul>
44
- {installations.map(i => <li>i.name</li>)}
44
+ {installations.map(i => <li>{i.name}</li>)}
45
45
  </ul>}
46
46
  </div>
47
47
  );
@@ -1,14 +1,15 @@
1
- import { ReactNode } from 'react';
2
1
  import { LynxClient } from '@iotopen/node-lynx';
2
+ import { ReactNode } from 'react';
3
3
  interface lynxClientContext {
4
4
  lynxClient: LynxClient;
5
- newLynxClient: (url: string, apiKey?: string) => void;
5
+ newLynxClient: (url: string, apiKey?: string, bearer?: boolean) => void;
6
6
  }
7
7
  interface LynxClientProviderProps {
8
8
  children?: ReactNode;
9
- url?: string;
10
- apiKey?: string;
9
+ url?: string | undefined;
10
+ apiKey?: string | undefined;
11
+ bearer?: boolean | undefined;
11
12
  }
12
- export declare const LynxClientProvider: ({ children, url, apiKey }: LynxClientProviderProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const LynxClientProvider: ({ children, url, apiKey, bearer }: LynxClientProviderProps) => import("react/jsx-runtime").JSX.Element;
13
14
  export declare const useGlobalLynxClient: () => lynxClientContext;
14
15
  export {};
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ interface LynxProviderProps {
3
+ apiURL?: string;
4
+ apiKey?: string;
5
+ bearer?: boolean;
6
+ children?: ReactNode;
7
+ }
8
+ export declare const LynxProvider: ({ children, apiURL, apiKey, bearer }: LynxProviderProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
1
  import { ErrorResponse, User } from '@iotopen/node-lynx';
2
+ import { ReactNode } from 'react';
3
3
  interface userContext {
4
4
  user: User | null;
5
5
  permissions: {
@@ -13,7 +13,7 @@ interface UserProviderProps {
13
13
  }
14
14
  export declare const UserProvider: ({ children }: UserProviderProps) => import("react/jsx-runtime").JSX.Element;
15
15
  export declare const useGlobalUser: () => userContext;
16
- export declare const useGlobalPermissions: () => ({
16
+ export declare const useGlobalPermissions: () => {
17
17
  [key: string]: boolean;
18
- } | null)[];
18
+ } | null;
19
19
  export {};
@@ -1,3 +1,3 @@
1
- export * from './LynxProvider';
2
- export { useGlobalUser, useGlobalPermissions } from './UserProvider';
3
1
  export { useGlobalLynxClient } from './LynxClientProvider';
2
+ export * from './LynxProvider';
3
+ export { useGlobalPermissions, useGlobalUser } from './UserProvider';
@@ -1,38 +1,54 @@
1
- export * from './useMeta';
2
- export * from './useInstallationInfo';
3
- export * from './usePahoMQTTClient';
4
- export * from './useSimpleMQTT';
5
- export * from './useTokens';
6
- export * from './useNewFunction';
7
- export * from './useFunctions';
1
+ export type { Permission } from './useCheckPermissions';
2
+ export * from './useCheckPermissions';
3
+ export * from './useConfiguredEdgeApps';
4
+ export * from './useDevice';
5
+ export * from './useDevices';
6
+ export * from './useEdgeApp';
7
+ export * from './useEdgeApps';
8
+ export * from './useEdgeAppVersions';
8
9
  export * from './useFunction';
10
+ export * from './useFunctions';
11
+ export * from './useIDTokenAlgorithms';
9
12
  export * from './useInstallation';
13
+ export * from './useInstallationInfo';
10
14
  export * from './useInstallations';
11
- export * from './useNewInstallation';
15
+ export type { LiveInstallation } from './useLiveInstallation';
16
+ export * from './useLiveInstallation';
17
+ export * from './useMeta';
18
+ export * from './useMQTT';
19
+ export type { MultiLiveInstallation } from './useMultiLiveInstallation';
20
+ export * from './useMultiLiveInstallation';
21
+ export type { DeviceTemplate } from './useNewDevice';
12
22
  export * from './useNewDevice';
13
- export * from './useDevices';
14
- export * from './useDevice';
15
- export * from './useConfiguredEdgeApps';
16
- export * from './useEdgeApps';
17
- export * from './useEdgeApp';
18
- export * from './useEdgeAppVersions';
23
+ export type { FunctionTemplate } from './useNewFunction';
24
+ export * from './useNewFunction';
25
+ export type { InstallationTemplate } from './useNewInstallation';
26
+ export * from './useNewInstallation';
27
+ export type { NotificationMessageTemplate } from './useNewNotificationMessage';
28
+ export * from './useNewNotificationMessage';
29
+ export type { NotificationOutputTemplate } from './useNewNotificationOutput';
30
+ export * from './useNewNotificationOutput';
31
+ export type { OAuth2ClientTemplate } from './useNewOAuth2Client';
19
32
  export * from './useNewOAuth2Client';
20
- export * from './useOAuth2Client';
21
- export * from './useOAuth2Clients';
22
- export * from './useOAuth2Consent';
23
- export * from './useIDTokenAlgorithms';
24
- export * from './useOrganization';
25
- export * from './useOrganizations';
33
+ export type { OrganizationTemplate } from './useNewOrganization';
26
34
  export * from './useNewOrganization';
35
+ export type { UserTemplate } from './useNewUser';
27
36
  export * from './useNewUser';
28
- export * from './useUsers';
29
- export * from './useUser';
30
- export * from './useRoles';
31
- export * from './useNewNotificationMessage';
32
37
  export * from './useNotificationMessage';
33
38
  export * from './useNotificationMessages';
34
- export * from './useNewNotificationOutput';
35
39
  export * from './useNotificationOutput';
36
- export * from './useNotificationOutputs';
37
40
  export * from './useNotificationOutputExecutor';
38
41
  export * from './useNotificationOutputExecutors';
42
+ export * from './useNotificationOutputs';
43
+ export * from './useOAuth2Client';
44
+ export * from './useOAuth2Clients';
45
+ export * from './useOAuth2Consent';
46
+ export * from './useOrganization';
47
+ export * from './useOrganizations';
48
+ export * from './usePahoMQTTClient';
49
+ export * from './useRoles';
50
+ export type { Binder, Binding, ExactBinder, ExactUnbinder, Publisher, SimpleMQTT, Unbinder } from './useSimpleMQTT';
51
+ export * from './useSimpleMQTT';
52
+ export * from './useTokens';
53
+ export * from './useUser';
54
+ export * from './useUsers';
@@ -0,0 +1,4 @@
1
+ import { Permissions } from '@iotopen/node-lynx';
2
+ export type Permission = Permissions | string;
3
+ export declare const usePermissionsCheckAll: (...permissions: Permission[]) => boolean;
4
+ export declare const usePermissionsCheckAny: (...permissions: Permission[]) => boolean;
@@ -3,13 +3,13 @@ export declare const useDevice: (installationId: number | string, deviceId: numb
3
3
  loading: boolean;
4
4
  error: ErrorResponse | undefined;
5
5
  Device: Devicex;
6
- setDevice: import("react").Dispatch<import("react").SetStateAction<Devicex>>;
6
+ setDevice: import('react').Dispatch<import('react').SetStateAction<Devicex>>;
7
7
  update: () => Promise<Devicex>;
8
8
  remove: () => Promise<OKResponse>;
9
9
  setType: (t: string) => void;
10
10
  };
11
11
  export declare const useDeviceMeta: (installationId: number | string, deviceId?: number | string) => {
12
- createMeta: (key: string, meta: MetaObject, devId?: number, silent?: boolean) => Promise<MetaObject>;
13
- updateMeta: (key: string, meta: MetaObject, createMissing?: boolean, devId?: number, silent?: boolean) => Promise<MetaObject>;
14
- removeMeta: (key: string, devId?: number, silent?: boolean) => Promise<MetaObject>;
12
+ createMeta: (key: string, meta: MetaObject, overrideDevId?: number, silent?: boolean) => Promise<MetaObject>;
13
+ updateMeta: (key: string, meta: MetaObject, createMissing?: boolean, overrideDevId?: number, silent?: boolean) => Promise<MetaObject>;
14
+ removeMeta: (key: string, overrideDevId?: number, silent?: boolean) => Promise<MetaObject>;
15
15
  };
@@ -4,7 +4,7 @@ export declare const useDevices: (installationId: number | string, filter?: Meta
4
4
  loading: boolean;
5
5
  error: ErrorResponse | undefined;
6
6
  create: <T extends EmptyDevicex | EmptyDevicex[]>(devs: T) => ObjectOrArray<Devicex, EmptyDevicex, T>;
7
- remove: <T_1 extends Devicex | Devicex[]>(devs: T_1) => ObjectOrArray<OKResponse, Devicex, T_1>;
7
+ remove: <T extends Devicex | Devicex[]>(devs: T) => ObjectOrArray<OKResponse, Devicex, T>;
8
8
  devices: Devicex[];
9
9
  refresh: () => void;
10
10
  };
@@ -3,6 +3,6 @@ export declare const useEdgeApp: (appId: number | string) => {
3
3
  loading: boolean;
4
4
  error: ErrorResponse | undefined;
5
5
  app: EdgeApp;
6
- setApp: import("react").Dispatch<import("react").SetStateAction<EdgeApp>>;
6
+ setApp: import('react').Dispatch<import('react').SetStateAction<EdgeApp>>;
7
7
  refresh: () => void;
8
8
  };
@@ -3,7 +3,7 @@ export declare const useFunction: (installationId: number | string, functionId:
3
3
  loading: boolean;
4
4
  error: ErrorResponse | undefined;
5
5
  Function: Functionx;
6
- setFunction: import("react").Dispatch<import("react").SetStateAction<Functionx>>;
6
+ setFunction: import('react').Dispatch<import('react').SetStateAction<Functionx>>;
7
7
  update: () => Promise<Functionx>;
8
8
  remove: () => Promise<OKResponse>;
9
9
  setType: (t: string) => void;
@@ -4,7 +4,7 @@ export declare const useFunctions: (installationId: number | string, filter?: Me
4
4
  loading: boolean;
5
5
  error: ErrorResponse | undefined;
6
6
  create: <T extends EmptyFunctionx | EmptyFunctionx[]>(fns: T) => ObjectOrArray<Functionx, EmptyFunctionx, T>;
7
- remove: <T_1 extends Functionx | Functionx[]>(fns: T_1) => ObjectOrArray<OKResponse, Functionx, T_1>;
7
+ remove: <T extends Functionx | Functionx[]>(fns: T) => ObjectOrArray<OKResponse, Functionx, T>;
8
8
  functions: Functionx[];
9
9
  refresh: () => void;
10
10
  };
@@ -1,7 +1,7 @@
1
1
  import { Installation } from '@iotopen/node-lynx';
2
2
  export declare const useInstallation: (installationId: number | string) => {
3
3
  installation: Installation;
4
- setInstallation: import("react").Dispatch<import("react").SetStateAction<Installation>>;
4
+ setInstallation: import('react').Dispatch<import('react').SetStateAction<Installation>>;
5
5
  update: () => Promise<Installation>;
6
6
  remove: () => Promise<Installation>;
7
7
  error: Error | undefined;
@@ -0,0 +1,10 @@
1
+ import { Devicex, Functionx, Installation } from '@iotopen/node-lynx';
2
+ import { SimpleMQTT } from './useSimpleMQTT';
3
+ export interface LiveInstallation {
4
+ installation: Installation;
5
+ functions: Functionx[];
6
+ devices: Devicex[];
7
+ mqtt: SimpleMQTT;
8
+ }
9
+ export declare const useLiveInstallation: (installation: Installation) => LiveInstallation;
10
+ export declare const useLiveInstallationId: (installationId: number | string) => LiveInstallation;
@@ -0,0 +1 @@
1
+ export declare const useMQTT: () => import('./useSimpleMQTT').SimpleMQTT;
@@ -0,0 +1,11 @@
1
+ import { Devicex, Functionx, Installation } from '@iotopen/node-lynx';
2
+ import { SimpleMQTT } from './useSimpleMQTT';
3
+ export interface MultiLiveInstallation {
4
+ installationMap: Map<number, Installation>;
5
+ functionMap: Map<number, Functionx[]>;
6
+ deviceMap: Map<number, Devicex[]>;
7
+ mqtt: SimpleMQTT;
8
+ toClientId: (iid: number) => number;
9
+ toInstallationId: (cid: number) => number;
10
+ }
11
+ export declare const useMultiLiveInstallation: (installations: Installation[]) => MultiLiveInstallation;
@@ -1,12 +1,12 @@
1
1
  import { EmptyDevicex, Metadata } from '@iotopen/node-lynx';
2
- export type DeviceTemplate = {
2
+ export interface DeviceTemplate {
3
3
  type?: string;
4
4
  meta?: Metadata;
5
5
  protected_meta?: Metadata;
6
- };
6
+ }
7
7
  export declare const useNewDevice: (installationId: number | string, template?: DeviceTemplate) => {
8
8
  newDevice: EmptyDevicex;
9
- setNewDevice: import("react").Dispatch<import("react").SetStateAction<EmptyDevicex>>;
10
- create: () => Promise<import("@iotopen/node-lynx").Devicex>;
9
+ setNewDevice: import('react').Dispatch<import('react').SetStateAction<EmptyDevicex>>;
10
+ create: () => Promise<import('@iotopen/node-lynx').Devicex>;
11
11
  setType: (t: string) => void;
12
12
  };
@@ -1,12 +1,12 @@
1
1
  import { EmptyFunctionx, Metadata } from '@iotopen/node-lynx';
2
- export type FunctionTemplate = {
2
+ export interface FunctionTemplate {
3
3
  type?: string;
4
4
  meta?: Metadata;
5
5
  protected_meta?: Metadata;
6
- };
6
+ }
7
7
  export declare const useNewFunction: (installationId: number | string, template?: FunctionTemplate) => {
8
8
  newFunction: EmptyFunctionx;
9
- setNewFunction: import("react").Dispatch<import("react").SetStateAction<EmptyFunctionx>>;
10
- create: () => Promise<import("@iotopen/node-lynx").Functionx>;
9
+ setNewFunction: import('react').Dispatch<import('react').SetStateAction<EmptyFunctionx>>;
10
+ create: () => Promise<import('@iotopen/node-lynx').Functionx>;
11
11
  setType: (t: string) => void;
12
12
  };
@@ -1,12 +1,12 @@
1
1
  import { EmptyInstallation, Metadata } from '@iotopen/node-lynx';
2
- export type InstallationTemplate = {
2
+ export interface InstallationTemplate {
3
3
  name?: string;
4
4
  notes?: string;
5
5
  meta?: Metadata;
6
6
  protected_meta?: Metadata;
7
- };
7
+ }
8
8
  export declare const useNewInstallation: (organizationId: number | string, template?: InstallationTemplate) => {
9
9
  newInstallation: EmptyInstallation;
10
- setNewInstallation: import("react").Dispatch<import("react").SetStateAction<EmptyInstallation>>;
11
- create: () => Promise<import("@iotopen/node-lynx").Installation>;
10
+ setNewInstallation: import('react').Dispatch<import('react').SetStateAction<EmptyInstallation>>;
11
+ create: () => Promise<import('@iotopen/node-lynx').Installation>;
12
12
  };
@@ -1,11 +1,11 @@
1
1
  import { EmptyNotificationMessage } from '@iotopen/node-lynx';
2
- export type NotificationMessageTemplate = {
2
+ export interface NotificationMessageTemplate {
3
3
  installation_id?: number;
4
4
  name?: string;
5
5
  text?: string;
6
- };
6
+ }
7
7
  export declare const useNewNotificationMessage: (installationId: number | string, template?: NotificationMessageTemplate) => {
8
8
  newNotificationMessage: EmptyNotificationMessage;
9
- setNewNotificationMessage: import("react").Dispatch<import("react").SetStateAction<EmptyNotificationMessage>>;
10
- create: () => Promise<import("@iotopen/node-lynx").NotificationMessage>;
9
+ setNewNotificationMessage: import('react').Dispatch<import('react').SetStateAction<EmptyNotificationMessage>>;
10
+ create: () => Promise<import('@iotopen/node-lynx').NotificationMessage>;
11
11
  };
@@ -1,5 +1,5 @@
1
1
  import { EmptyNotificationOutput } from '@iotopen/node-lynx';
2
- export type NotificationOutputTemplate = {
2
+ export interface NotificationOutputTemplate {
3
3
  installation_id?: number;
4
4
  name?: string;
5
5
  notification_message_id?: number;
@@ -7,9 +7,9 @@ export type NotificationOutputTemplate = {
7
7
  config?: {
8
8
  [key: string]: string;
9
9
  };
10
- };
10
+ }
11
11
  export declare const useNewNotificationOutput: (installationId: number | string, template?: NotificationOutputTemplate) => {
12
12
  newNotificationOutput: EmptyNotificationOutput;
13
- setNewNotificationOutput: import("react").Dispatch<import("react").SetStateAction<EmptyNotificationOutput>>;
14
- create: () => Promise<import("@iotopen/node-lynx").NotificationOutput>;
13
+ setNewNotificationOutput: import('react').Dispatch<import('react').SetStateAction<EmptyNotificationOutput>>;
14
+ create: () => Promise<import('@iotopen/node-lynx').NotificationOutput>;
15
15
  };
@@ -1,5 +1,5 @@
1
1
  import { EmptyOAuth2Client } from '@iotopen/node-lynx';
2
- export type OAuth2ClientTemplate = {
2
+ export interface OAuth2ClientTemplate {
3
3
  name?: string;
4
4
  trusted?: boolean;
5
5
  allowed_scopes?: string[];
@@ -8,15 +8,15 @@ export type OAuth2ClientTemplate = {
8
8
  policy_uri?: string;
9
9
  redirect_uris?: string[];
10
10
  id_token_alg?: string;
11
- };
11
+ }
12
12
  export declare const useNewOAuth2Client: (template?: OAuth2ClientTemplate) => {
13
13
  newClient: EmptyOAuth2Client;
14
- create: () => Promise<import("@iotopen/node-lynx").OAuth2Client>;
14
+ create: () => Promise<import('@iotopen/node-lynx').OAuth2Client>;
15
15
  setName: (name: string) => void;
16
16
  setScope: (scopes: string[]) => void;
17
17
  setIconURI: (uri: string) => void;
18
18
  setTosURI: (uri: string) => void;
19
19
  setPolicyURI: (uri: string) => void;
20
20
  setRedirectURIs: (uris: string[]) => void;
21
- setClient: import("react").Dispatch<import("react").SetStateAction<EmptyOAuth2Client>>;
21
+ setClient: import('react').Dispatch<import('react').SetStateAction<EmptyOAuth2Client>>;
22
22
  };
@@ -1,5 +1,5 @@
1
1
  import { Address, EmptyOrganization, Metadata, OrganizationChild } from '@iotopen/node-lynx';
2
- export type OrganizationTemplate = {
2
+ export interface OrganizationTemplate {
3
3
  address?: Address;
4
4
  children?: OrganizationChild[];
5
5
  email?: string;
@@ -10,9 +10,9 @@ export type OrganizationTemplate = {
10
10
  password_valid_days?: number;
11
11
  meta?: Metadata;
12
12
  protected_meta?: Metadata;
13
- };
13
+ }
14
14
  export declare const useNewOrganization: (parentId: number | string, template?: OrganizationTemplate) => {
15
15
  newOrganization: EmptyOrganization;
16
- setNewOrganization: import("react").Dispatch<import("react").SetStateAction<EmptyOrganization>>;
17
- create: () => Promise<import("@iotopen/node-lynx").Organization>;
16
+ setNewOrganization: import('react').Dispatch<import('react').SetStateAction<EmptyOrganization>>;
17
+ create: () => Promise<import('@iotopen/node-lynx').Organization>;
18
18
  };
@@ -1,6 +1,5 @@
1
- import { EmptyUser } from '@iotopen/node-lynx';
2
- import { Address } from '@iotopen/node-lynx/src/types';
3
- export type UserTemplate = {
1
+ import { Address, EmptyUser } from '@iotopen/node-lynx';
2
+ export interface UserTemplate {
4
3
  email?: string;
5
4
  password?: string;
6
5
  first_name?: string;
@@ -14,14 +13,14 @@ export type UserTemplate = {
14
13
  address?: Address;
15
14
  expire_at?: number;
16
15
  meta?: {
17
- [key: string]: any;
16
+ [key: string]: unknown;
18
17
  };
19
18
  protected_meta?: {
20
- [key: string]: any;
19
+ [key: string]: unknown;
21
20
  };
22
- };
21
+ }
23
22
  export declare const useNewUser: (template?: UserTemplate) => {
24
23
  newUser: EmptyUser;
25
- setNewUser: import("react").Dispatch<import("react").SetStateAction<EmptyUser>>;
26
- create: () => Promise<import("@iotopen/node-lynx").User>;
24
+ setNewUser: import('react').Dispatch<import('react').SetStateAction<EmptyUser>>;
25
+ create: () => Promise<import('@iotopen/node-lynx').User>;
27
26
  };
@@ -2,7 +2,7 @@ import { ErrorResponse, NotificationMessage } from '@iotopen/node-lynx';
2
2
  export declare const useNotificationMessage: (installationId: number | string, notificationId: number | string) => {
3
3
  refresh: () => void;
4
4
  message: NotificationMessage;
5
- setMessage: import("react").Dispatch<import("react").SetStateAction<NotificationMessage>>;
5
+ setMessage: import('react').Dispatch<import('react').SetStateAction<NotificationMessage>>;
6
6
  error: ErrorResponse | undefined;
7
7
  loading: boolean;
8
8
  remove: () => void;
@@ -2,7 +2,7 @@ import { ErrorResponse, NotificationOutput } from '@iotopen/node-lynx';
2
2
  export declare const useNotificationOutput: (installationId: number | string, notificationId: number | string) => {
3
3
  refresh: () => void;
4
4
  output: NotificationOutput;
5
- setOutput: import("react").Dispatch<import("react").SetStateAction<NotificationOutput>>;
5
+ setOutput: import('react').Dispatch<import('react').SetStateAction<NotificationOutput>>;
6
6
  error: ErrorResponse | undefined;
7
7
  loading: boolean;
8
8
  remove: () => void;
@@ -2,7 +2,7 @@ import { ErrorResponse, NotificationOutputExecutor } from '@iotopen/node-lynx';
2
2
  export declare const useNotificationOutputExecutor: (installationId: number | string, executorId: number | string) => {
3
3
  refresh: () => void;
4
4
  outputExecutor: NotificationOutputExecutor;
5
- setOutputExecutor: import("react").Dispatch<import("react").SetStateAction<NotificationOutputExecutor>>;
5
+ setOutputExecutor: import('react').Dispatch<import('react').SetStateAction<NotificationOutputExecutor>>;
6
6
  error: ErrorResponse | undefined;
7
7
  loading: boolean;
8
8
  };
@@ -2,9 +2,9 @@ import { ErrorResponse, OAuth2Client } from '@iotopen/node-lynx';
2
2
  export declare const useOAuth2Client: (id: string) => {
3
3
  refresh: () => void;
4
4
  client: OAuth2Client;
5
- setClient: import("react").Dispatch<import("react").SetStateAction<OAuth2Client>>;
5
+ setClient: import('react').Dispatch<import('react').SetStateAction<OAuth2Client>>;
6
6
  error: ErrorResponse | undefined;
7
7
  loading: boolean;
8
- remove: () => Promise<import("@iotopen/node-lynx").OKResponse>;
8
+ remove: () => Promise<import('@iotopen/node-lynx').OKResponse>;
9
9
  update: () => Promise<OAuth2Client>;
10
10
  };
@@ -0,0 +1,5 @@
1
+ export declare const useOAuth2Consent: () => {
2
+ consent: (scope: string[]) => Promise<import('@iotopen/node-lynx').ConsentAcceptResponse>;
3
+ client: import('@iotopen/node-lynx').OAuth2Client;
4
+ requestedScopes: string[];
5
+ };
@@ -2,9 +2,9 @@ import { Organization } from '@iotopen/node-lynx';
2
2
  export declare const useOrganization: (organizationId: number | string) => {
3
3
  loading: boolean;
4
4
  organization: Organization;
5
- setOrganization: import("react").Dispatch<import("react").SetStateAction<Organization>>;
5
+ setOrganization: import('react').Dispatch<import('react').SetStateAction<Organization>>;
6
6
  error: Error | undefined;
7
7
  update: () => Promise<Organization>;
8
- remove: () => Promise<import("@iotopen/node-lynx").OKResponse>;
8
+ remove: () => Promise<import('@iotopen/node-lynx').OKResponse>;
9
9
  refresh: () => void;
10
10
  };
@@ -1,9 +1,9 @@
1
1
  import { ErrorResponse, MinimalOrg, Organization } from '@iotopen/node-lynx';
2
- export declare const useOrganizations: <T extends boolean = false>(minimal?: T | undefined) => {
2
+ export declare const useOrganizations: <T extends boolean = false>(minimal?: T) => {
3
3
  loading: boolean;
4
4
  organizations: MinimalOrg<T>[];
5
- setOrganizations: import("react").Dispatch<import("react").SetStateAction<MinimalOrg<T>[]>>;
5
+ setOrganizations: import('react').Dispatch<import('react').SetStateAction<MinimalOrg<T>[]>>;
6
6
  error: ErrorResponse | undefined;
7
7
  create: (org: Organization) => Promise<Organization>;
8
- remove: (org: Organization) => Promise<import("@iotopen/node-lynx").OKResponse>;
8
+ remove: (org: Organization) => Promise<import('@iotopen/node-lynx').OKResponse>;
9
9
  };
@@ -1,4 +1,4 @@
1
- import Paho, { Qos, TypedArray } from 'paho-mqtt';
1
+ import { MQTTError, Qos, TypedArray, default as Paho } from 'paho-mqtt';
2
2
  interface MQTTHandlers {
3
3
  onMessage?: Paho.OnMessageHandler;
4
4
  onDelivery?: Paho.OnMessageHandler;
@@ -6,10 +6,10 @@ interface MQTTHandlers {
6
6
  onDisconnect?: Paho.OnConnectionLostHandler;
7
7
  }
8
8
  export declare const usePahoMQTTClient: (uri: string, handlers?: MQTTHandlers, connectionOptions?: Paho.ConnectionOptions, clientId?: string) => {
9
- client: import("react").MutableRefObject<Paho.Client>;
9
+ client: import('react').RefObject<Paho.Client>;
10
10
  connected: boolean;
11
- error: Paho.MQTTError | undefined;
12
- sub: (topic: string, qos?: Qos) => Promise<Paho.Qos>;
11
+ error: MQTTError | undefined;
12
+ sub: (topic: string, qos?: Qos) => Promise<Qos>;
13
13
  pub: (topic: string, payload: string | TypedArray, qos?: Qos, retained?: boolean) => void;
14
14
  unsub: (topic: string) => Promise<void>;
15
15
  };
@@ -0,0 +1,18 @@
1
+ import { Qos, TypedArray, default as Paho } from 'paho-mqtt';
2
+ export type Binding = (topic: string, payload: string, qos: Qos, retained: boolean) => void;
3
+ export type Binder = (topic: RegExp | string, binder: Binding) => void;
4
+ export type Unbinder = (binder: Binding) => void;
5
+ export type ExactBinder = (topic: string, binder: Binding) => void;
6
+ export type ExactUnbinder = (topic: string, binder: Binding) => void;
7
+ export type Publisher = (topic: string, payload: string | TypedArray, qos?: Qos, retained?: boolean) => void;
8
+ export interface SimpleMQTT {
9
+ setSubs: (subscriptions: string[]) => void;
10
+ error?: Paho.MQTTError;
11
+ connected: boolean;
12
+ bind: Binder;
13
+ unbind: Unbinder;
14
+ bindExact: ExactBinder;
15
+ unbindExact: ExactUnbinder;
16
+ pub: Publisher;
17
+ }
18
+ export declare const useSimpleMQTT: (uri?: string, username?: string, password?: string) => SimpleMQTT;
@@ -1,7 +1,7 @@
1
1
  import { EmptyToken, ErrorResponse, Token } from '@iotopen/node-lynx';
2
2
  export declare const useTokens: () => {
3
3
  tokens: Token[];
4
- remove: (token: Token) => Promise<import("@iotopen/node-lynx").OKResponse>;
4
+ remove: (token: Token) => Promise<import('@iotopen/node-lynx').OKResponse>;
5
5
  create: (token: EmptyToken) => Promise<Token>;
6
6
  refresh: () => void;
7
7
  loading: boolean;
@@ -3,8 +3,8 @@ export declare const useUser: (userId: number | string) => {
3
3
  loading: boolean;
4
4
  error: Error | undefined;
5
5
  user: User;
6
- setUser: import("react").Dispatch<import("react").SetStateAction<User>>;
6
+ setUser: import('react').Dispatch<import('react').SetStateAction<User>>;
7
7
  update: () => Promise<User>;
8
8
  refresh: () => void;
9
- remove: () => Promise<import("@iotopen/node-lynx").OKResponse>;
9
+ remove: () => Promise<import('@iotopen/node-lynx').OKResponse>;
10
10
  };
@@ -1,7 +1,7 @@
1
1
  import { Metadata, User } from '@iotopen/node-lynx';
2
2
  export declare const useUsers: (filter?: Metadata) => {
3
3
  users: User[];
4
- setUsers: import("react").Dispatch<import("react").SetStateAction<User[]>>;
4
+ setUsers: import('react').Dispatch<import('react').SetStateAction<User[]>>;
5
5
  refresh: () => void;
6
6
  loading: boolean;
7
7
  error: Error | undefined;