@x-oasis/async-call-rpc-misc 0.1.38

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 (93) hide show
  1. package/README.md +13 -0
  2. package/dist/async-call-rpc-misc.cjs.development.js +221 -0
  3. package/dist/async-call-rpc-misc.cjs.development.js.map +1 -0
  4. package/dist/async-call-rpc-misc.cjs.production.min.js +2 -0
  5. package/dist/async-call-rpc-misc.cjs.production.min.js.map +1 -0
  6. package/dist/async-call-rpc-misc.esm.js +216 -0
  7. package/dist/async-call-rpc-misc.esm.js.map +1 -0
  8. package/dist/buffer/DataBuffer.d.ts +2 -0
  9. package/dist/buffer/ReadBuffer.d.ts +12 -0
  10. package/dist/buffer/WriteBuffer.d.ts +3 -0
  11. package/dist/buffer/index.d.ts +3 -0
  12. package/dist/channel-protocol/AbstractChannelProtocol.d.ts +51 -0
  13. package/dist/channel-protocol/Channel.d.ts +16 -0
  14. package/dist/channel-protocol/DeferredMessageChannelProtocol.d.ts +8 -0
  15. package/dist/channel-protocol/IPCMainChannelProtocol.d.ts +7 -0
  16. package/dist/channel-protocol/IPCMainGlobalChannelProtocol.d.ts +7 -0
  17. package/dist/channel-protocol/IPCRendererChannelProtocol.d.ts +8 -0
  18. package/dist/channel-protocol/IPCRendererMessageChannelProtocol.d.ts +8 -0
  19. package/dist/channel-protocol/MessageChannelProtocol.d.ts +7 -0
  20. package/dist/channel-protocol/ProcessChannelProtocol.d.ts +7 -0
  21. package/dist/channel-protocol/ProcessClientChannelProtocol.d.ts +7 -0
  22. package/dist/channel-protocol/middlewares/buffer.d.ts +18 -0
  23. package/dist/channel-protocol/middlewares/handleDisconnectedRequest.d.ts +7 -0
  24. package/dist/channel-protocol/middlewares/handlePortRequest.d.ts +3 -0
  25. package/dist/channel-protocol/middlewares/handleRequest.d.ts +3 -0
  26. package/dist/channel-protocol/middlewares/handleRequestUtils.d.ts +10 -0
  27. package/dist/channel-protocol/middlewares/handleResponse.d.ts +3 -0
  28. package/dist/channel-protocol/middlewares/index.d.ts +10 -0
  29. package/dist/channel-protocol/middlewares/logger.d.ts +4 -0
  30. package/dist/channel-protocol/middlewares/normalize.d.ts +12 -0
  31. package/dist/channel-protocol/middlewares/prepareRequestData.d.ts +28 -0
  32. package/dist/channel-protocol/middlewares/sendRequest.d.ts +6 -0
  33. package/dist/channel-protocol/middlewares/updateSeqInfo.d.ts +6 -0
  34. package/dist/channel-protocol/middlewares/utils.d.ts +3 -0
  35. package/dist/common.d.ts +4 -0
  36. package/dist/error.d.ts +12 -0
  37. package/dist/index.d.ts +5 -0
  38. package/dist/index.js +8 -0
  39. package/dist/rpc-service/ProxyRPCClient.d.ts +9 -0
  40. package/dist/rpc-service/RPCServiceHost.d.ts +11 -0
  41. package/dist/rpc-service/RPCServiceProvider.d.ts +9 -0
  42. package/dist/types/buffer.d.ts +4 -0
  43. package/dist/types/channel.d.ts +12 -0
  44. package/dist/types/index.d.ts +6 -0
  45. package/dist/types/messageChannel.d.ts +76 -0
  46. package/dist/types/middleware.d.ts +44 -0
  47. package/dist/types/proxyChannel.d.ts +3 -0
  48. package/dist/types/proxyService.d.ts +10 -0
  49. package/dist/types/rpc.d.ts +31 -0
  50. package/dist/types/rpcProtocol.d.ts +22 -0
  51. package/package.json +38 -0
  52. package/src/buffer/DataBuffer.ts +1 -0
  53. package/src/buffer/ReadBuffer.ts +41 -0
  54. package/src/buffer/WriteBuffer.ts +5 -0
  55. package/src/buffer/index.ts +3 -0
  56. package/src/channel-protocol/AbstractChannelProtocol.ts +204 -0
  57. package/src/channel-protocol/Channel.ts +37 -0
  58. package/src/channel-protocol/DeferredMessageChannelProtocol.ts +85 -0
  59. package/src/channel-protocol/IPCMainChannelProtocol.ts +65 -0
  60. package/src/channel-protocol/IPCMainGlobalChannelProtocol.ts +66 -0
  61. package/src/channel-protocol/IPCRendererChannelProtocol.ts +81 -0
  62. package/src/channel-protocol/IPCRendererMessageChannelProtocol.ts +79 -0
  63. package/src/channel-protocol/MessageChannelProtocol.ts +63 -0
  64. package/src/channel-protocol/ProcessChannelProtocol.ts +60 -0
  65. package/src/channel-protocol/ProcessClientChannelProtocol.ts +59 -0
  66. package/src/channel-protocol/middlewares/buffer.ts +33 -0
  67. package/src/channel-protocol/middlewares/handleDisconnectedRequest.ts +30 -0
  68. package/src/channel-protocol/middlewares/handlePortRequest.ts +118 -0
  69. package/src/channel-protocol/middlewares/handleRequest.ts +163 -0
  70. package/src/channel-protocol/middlewares/handleRequestUtils.ts +42 -0
  71. package/src/channel-protocol/middlewares/handleResponse.ts +38 -0
  72. package/src/channel-protocol/middlewares/index.ts +11 -0
  73. package/src/channel-protocol/middlewares/logger.ts +22 -0
  74. package/src/channel-protocol/middlewares/normalize.ts +28 -0
  75. package/src/channel-protocol/middlewares/prepareRequestData.ts +137 -0
  76. package/src/channel-protocol/middlewares/sendRequest.ts +15 -0
  77. package/src/channel-protocol/middlewares/updateSeqInfo.ts +27 -0
  78. package/src/channel-protocol/middlewares/utils.ts +67 -0
  79. package/src/common.ts +20 -0
  80. package/src/error.ts +32 -0
  81. package/src/index.ts +5 -0
  82. package/src/rpc-service/ProxyRPCClient.ts +82 -0
  83. package/src/rpc-service/RPCServiceHost.ts +35 -0
  84. package/src/rpc-service/RPCServiceProvider.ts +22 -0
  85. package/src/types/buffer.ts +5 -0
  86. package/src/types/channel.ts +24 -0
  87. package/src/types/index.ts +6 -0
  88. package/src/types/messageChannel.ts +134 -0
  89. package/src/types/middleware.ts +53 -0
  90. package/src/types/proxyChannel.ts +3 -0
  91. package/src/types/proxyService.ts +16 -0
  92. package/src/types/rpc.ts +61 -0
  93. package/src/types/rpcProtocol.ts +24 -0
@@ -0,0 +1,16 @@
1
+ import AbstractChannelProtocol from '../channel-protocol/AbstractChannelProtocol';
2
+
3
+ // export type IService = {
4
+ // [key: string]: Function
5
+ // }
6
+ export type IService = any;
7
+
8
+ export type ServiceHandlerPath = string;
9
+ export type ProxyRPCClientChannel =
10
+ | AbstractChannelProtocol
11
+ | { (): AbstractChannelProtocol };
12
+
13
+ export type ProxyRPCClientProps = {
14
+ requestPath: string;
15
+ channel: ProxyRPCClientChannel;
16
+ };
@@ -0,0 +1,61 @@
1
+ export enum RequestType {
2
+ /**
3
+ * for normal request, wait for return value
4
+ */
5
+ PromiseRequest = 'pr',
6
+ PromiseAbort = 'pa',
7
+
8
+ /**
9
+ * send a command
10
+ */
11
+ SignalRequest = 'sr',
12
+ SignalAbort = 'sa',
13
+ }
14
+
15
+ export type RequestRawSequenceId = number;
16
+
17
+ export type RequestSequenceId = string;
18
+ export type RequestServicePath = string;
19
+ export type RequestFnName = string;
20
+
21
+ export type RequestEntryHeader = [
22
+ RequestType,
23
+ RequestSequenceId,
24
+ RequestServicePath,
25
+ RequestFnName
26
+ ];
27
+ export type RequestEntryBody = any;
28
+ export type RequestEntry = [RequestEntryHeader, RequestEntryBody];
29
+
30
+ export enum ResponseType {
31
+ ReturnSuccess = 'rs',
32
+ ReturnFail = 'rf',
33
+
34
+ PortSuccess = 'ps',
35
+ PortFail = 'pf',
36
+ }
37
+ export type ResponseEntryHeader = [ResponseType, RequestSequenceId];
38
+ export type ResponseEntryBody = any;
39
+
40
+ export type HostName = string;
41
+
42
+ /**
43
+ * 0 RequestType: PromiseRequest, PromiseAbort, SignalRequest, SignalAbort
44
+ * 1 RequestSequenceId: string
45
+ */
46
+ export type HostRequestEntryHeader = [
47
+ RequestType,
48
+ RequestSequenceId,
49
+ RequestServicePath,
50
+ RequestFnName,
51
+ HostName
52
+ ];
53
+ export type HostRequestEntryBody = any;
54
+ export type HostRequestEntry = [HostRequestEntryHeader, HostRequestEntryBody];
55
+
56
+ export type SendingProps = {
57
+ requestPath?: string;
58
+ fnName?: string;
59
+ args?: any;
60
+ isOptionsRequest?: boolean;
61
+ };
@@ -0,0 +1,24 @@
1
+ export type IRPCProtocolServer = {
2
+ source: any;
3
+ encoder: null;
4
+ decoder: null;
5
+ onRequest: () => {};
6
+ handleRequest: () => {};
7
+ sendReply: () => {};
8
+ };
9
+
10
+ export type IRPCProtocolClient = {
11
+ source: any;
12
+ encode: () => {};
13
+ decode: () => {};
14
+ sendRequest: () => {};
15
+ onReply: () => {};
16
+ handleReply: () => {};
17
+ };
18
+
19
+ export type IRPCProtocol = {
20
+ encode: Function;
21
+ decode: Function;
22
+ onMessage: Function;
23
+ send: Function;
24
+ };