@azure/web-pubsub-client-protobuf 1.0.0-beta.2 → 1.0.0-beta.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 (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -9
  3. package/{types/web-pubsub-client-protobuf.d.ts → dist/browser/index.d.ts} +10 -13
  4. package/dist/browser/index.d.ts.map +1 -0
  5. package/{dist-esm/src → dist/browser}/index.js +3 -3
  6. package/dist/browser/index.js.map +1 -0
  7. package/dist/browser/logger.d.ts +5 -0
  8. package/dist/browser/logger.d.ts.map +1 -0
  9. package/{dist-esm/src → dist/browser}/logger.js +1 -1
  10. package/{dist-esm/src → dist/browser}/logger.js.map +1 -1
  11. package/dist/browser/package.json +3 -0
  12. package/dist/browser/webPubSubProtobufProtocol.d.ts +25 -0
  13. package/dist/browser/webPubSubProtobufProtocol.d.ts.map +1 -0
  14. package/{dist-esm/src → dist/browser}/webPubSubProtobufProtocol.js +10 -12
  15. package/dist/browser/webPubSubProtobufProtocol.js.map +1 -0
  16. package/dist/browser/webPubSubProtobufProtocolBase.d.ts +20 -0
  17. package/dist/browser/webPubSubProtobufProtocolBase.d.ts.map +1 -0
  18. package/{dist-esm/src → dist/browser}/webPubSubProtobufProtocolBase.js +2 -2
  19. package/dist/browser/webPubSubProtobufProtocolBase.js.map +1 -0
  20. package/dist/browser/webPubSubProtobufReliableProtocol.d.ts +25 -0
  21. package/dist/browser/webPubSubProtobufReliableProtocol.d.ts.map +1 -0
  22. package/{dist-esm/src → dist/browser}/webPubSubProtobufReliableProtocol.js +10 -12
  23. package/dist/browser/webPubSubProtobufReliableProtocol.js.map +1 -0
  24. package/dist/{index.js → commonjs/generated/clientProto.js} +192 -3095
  25. package/dist/commonjs/index.d.ts +10 -0
  26. package/dist/commonjs/index.d.ts.map +1 -0
  27. package/dist/commonjs/index.js +22 -0
  28. package/dist/commonjs/index.js.map +1 -0
  29. package/dist/commonjs/logger.d.ts +5 -0
  30. package/dist/commonjs/logger.d.ts.map +1 -0
  31. package/dist/commonjs/logger.js +11 -0
  32. package/dist/commonjs/logger.js.map +1 -0
  33. package/dist/commonjs/package.json +3 -0
  34. package/dist/commonjs/tsdoc-metadata.json +11 -0
  35. package/dist/commonjs/webPubSubProtobufProtocol.d.ts +25 -0
  36. package/dist/commonjs/webPubSubProtobufProtocol.d.ts.map +1 -0
  37. package/dist/commonjs/webPubSubProtobufProtocol.js +35 -0
  38. package/dist/commonjs/webPubSubProtobufProtocol.js.map +1 -0
  39. package/dist/commonjs/webPubSubProtobufProtocolBase.d.ts +20 -0
  40. package/dist/commonjs/webPubSubProtobufProtocolBase.d.ts.map +1 -0
  41. package/dist/commonjs/webPubSubProtobufProtocolBase.js +191 -0
  42. package/dist/commonjs/webPubSubProtobufProtocolBase.js.map +1 -0
  43. package/dist/commonjs/webPubSubProtobufReliableProtocol.d.ts +25 -0
  44. package/dist/commonjs/webPubSubProtobufReliableProtocol.d.ts.map +1 -0
  45. package/dist/commonjs/webPubSubProtobufReliableProtocol.js +35 -0
  46. package/dist/commonjs/webPubSubProtobufReliableProtocol.js.map +1 -0
  47. package/dist/esm/generated/clientProto.d.ts +1668 -0
  48. package/{dist-esm/src → dist/esm}/generated/clientProto.js +45 -15
  49. package/dist/esm/index.d.ts +10 -0
  50. package/dist/esm/index.d.ts.map +1 -0
  51. package/dist/esm/index.js +17 -0
  52. package/dist/esm/index.js.map +1 -0
  53. package/dist/esm/logger.d.ts +5 -0
  54. package/dist/esm/logger.d.ts.map +1 -0
  55. package/dist/esm/logger.js +8 -0
  56. package/dist/esm/logger.js.map +1 -0
  57. package/dist/esm/package.json +3 -0
  58. package/dist/esm/webPubSubProtobufProtocol.d.ts +25 -0
  59. package/dist/esm/webPubSubProtobufProtocol.d.ts.map +1 -0
  60. package/dist/esm/webPubSubProtobufProtocol.js +31 -0
  61. package/dist/esm/webPubSubProtobufProtocol.js.map +1 -0
  62. package/dist/esm/webPubSubProtobufProtocolBase.d.ts +20 -0
  63. package/dist/esm/webPubSubProtobufProtocolBase.d.ts.map +1 -0
  64. package/dist/esm/webPubSubProtobufProtocolBase.js +187 -0
  65. package/dist/esm/webPubSubProtobufProtocolBase.js.map +1 -0
  66. package/dist/esm/webPubSubProtobufReliableProtocol.d.ts +25 -0
  67. package/dist/esm/webPubSubProtobufReliableProtocol.d.ts.map +1 -0
  68. package/dist/esm/webPubSubProtobufReliableProtocol.js +31 -0
  69. package/dist/esm/webPubSubProtobufReliableProtocol.js.map +1 -0
  70. package/dist/react-native/index.d.ts +10 -0
  71. package/dist/react-native/index.d.ts.map +1 -0
  72. package/dist/react-native/index.js +17 -0
  73. package/dist/react-native/index.js.map +1 -0
  74. package/dist/react-native/logger.d.ts +5 -0
  75. package/dist/react-native/logger.d.ts.map +1 -0
  76. package/dist/react-native/logger.js +8 -0
  77. package/dist/react-native/logger.js.map +1 -0
  78. package/dist/react-native/package.json +3 -0
  79. package/dist/react-native/webPubSubProtobufProtocol.d.ts +25 -0
  80. package/dist/react-native/webPubSubProtobufProtocol.d.ts.map +1 -0
  81. package/dist/react-native/webPubSubProtobufProtocol.js +31 -0
  82. package/dist/react-native/webPubSubProtobufProtocol.js.map +1 -0
  83. package/dist/react-native/webPubSubProtobufProtocolBase.d.ts +20 -0
  84. package/dist/react-native/webPubSubProtobufProtocolBase.d.ts.map +1 -0
  85. package/dist/react-native/webPubSubProtobufProtocolBase.js +187 -0
  86. package/dist/react-native/webPubSubProtobufProtocolBase.js.map +1 -0
  87. package/dist/react-native/webPubSubProtobufReliableProtocol.d.ts +25 -0
  88. package/dist/react-native/webPubSubProtobufReliableProtocol.d.ts.map +1 -0
  89. package/dist/react-native/webPubSubProtobufReliableProtocol.js +31 -0
  90. package/dist/react-native/webPubSubProtobufReliableProtocol.js.map +1 -0
  91. package/package.json +88 -90
  92. package/dist/index.js.map +0 -1
  93. package/dist-esm/samples-dev/basicusage.js +0 -63
  94. package/dist-esm/samples-dev/basicusage.js.map +0 -1
  95. package/dist-esm/src/index.js.map +0 -1
  96. package/dist-esm/src/webPubSubProtobufProtocol.js.map +0 -1
  97. package/dist-esm/src/webPubSubProtobufProtocolBase.js.map +0 -1
  98. package/dist-esm/src/webPubSubProtobufReliableProtocol.js.map +0 -1
  99. package/dist-esm/test/client.spec.js +0 -294
  100. package/dist-esm/test/client.spec.js.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Microsoft
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,15 +1,14 @@
1
1
  # Web PubSub client protobuf protocol library for JavaScript
2
2
 
3
- [Azure Web PubSub](https://aka.ms/awps/doc) is a cloud service that helps developers easily build real-time features in web applications with publish-subscribe patterns at scale.
3
+ [Azure Web PubSub](https://aka.ms/awps/doc) is a cloud service that helps developers easily build real-time features in web applications with publish-subscribe patterns at scale.
4
4
 
5
5
  You can use this library to add protobuf subprotocols including `protobuf.reliable.webpubsub.azure.v1` and `protobuf.webpubsub.azure.v1` support to `@azure/web-pubsub-client` library.
6
6
 
7
-
8
7
  ## Getting started
9
8
 
10
9
  ### Currently supported environments
11
10
 
12
- - [LTS versions of Node.js](https://nodejs.org/about/releases/)
11
+ - [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
13
12
 
14
13
  ### Prerequisites
15
14
 
@@ -24,39 +23,55 @@ npm install @azure/web-pubsub-client-protobuf
24
23
 
25
24
  ### 2. Use Protobuf protocols
26
25
 
27
- ```javascript
28
- let client = new WebPubSubClient("client-access-url", { protocol: WebPubSubProtobufReliableProtocol() });
26
+ ```ts snippet:ReadmeSampleCreateClient
27
+ import { WebPubSubClient } from "@azure/web-pubsub-client";
28
+ import { WebPubSubProtobufReliableProtocol } from "@azure/web-pubsub-client-protobuf";
29
+
30
+ const client = new WebPubSubClient("client-access-url", {
31
+ protocol: WebPubSubProtobufReliableProtocol(),
32
+ });
29
33
  ```
30
34
 
31
35
  ## Troubleshooting
32
36
 
33
- - ### Enable logs
37
+ ### Enable logs
34
38
 
35
- You can set the following environment variable to get the debug logs when using this library.
39
+ Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`.
36
40
 
37
41
  ```bash
38
42
  export AZURE_LOG_LEVEL=verbose
39
43
  ```
40
44
 
45
+ Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
46
+
47
+ ```ts snippet:SetLogLevel
48
+ import { setLogLevel } from "@azure/logger";
49
+
50
+ setLogLevel("info");
51
+ ```
52
+
41
53
  For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
42
54
 
43
55
  - ### Live Trace
44
56
 
45
57
  Use [Live Trace tool][live_trace] from Web PubSub portal to view the live traffic.
58
+
46
59
  ---
60
+
47
61
  ## Additional resources
62
+
48
63
  - Learn more about client permission, see [permissions](https://learn.microsoft.com/azure/azure-web-pubsub/reference-json-reliable-webpubsub-subprotocol#permissions)
49
64
 
50
- - [Server SDK - JavaScript documentation](https://aka.ms/awps/sdk/js)
65
+ - [Server SDK - JavaScript documentation](https://aka.ms/awps/sdk/js)
51
66
  - [Product documentation](https://aka.ms/awps/doc)
52
67
  - [Samples][samples_ref]
53
68
 
54
69
  ---
70
+
55
71
  ## Contributing
56
72
 
57
73
  If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
58
74
 
59
-
60
75
  [azure_sub]: https://azure.microsoft.com/free/
61
76
  [samples_ref]: https://github.com/Azure/azure-webpubsub/tree/main/samples/javascript/
62
77
  [create_instance]: https://learn.microsoft.com/azure/azure-web-pubsub/howto-develop-create-instance
@@ -1,13 +1,10 @@
1
- import { WebPubSubClientProtocol } from '@azure/web-pubsub-client';
2
-
3
- /**
4
- * Return the "protobuf.webpubsub.azure.v1" protocol
5
- */
6
- export declare const WebPubSubProtobufProtocol: () => WebPubSubClientProtocol;
7
-
8
- /**
9
- * Return the "protobuf.reliable.webpubsub.azure.v1" protocol
10
- */
11
- export declare const WebPubSubProtobufReliableProtocol: () => WebPubSubClientProtocol;
12
-
13
- export { }
1
+ import type { WebPubSubClientProtocol } from "@azure/web-pubsub-client";
2
+ /**
3
+ * Return the "protobuf.webpubsub.azure.v1" protocol
4
+ */
5
+ export declare const WebPubSubProtobufProtocol: () => WebPubSubClientProtocol;
6
+ /**
7
+ * Return the "protobuf.reliable.webpubsub.azure.v1" protocol
8
+ */
9
+ export declare const WebPubSubProtobufReliableProtocol: () => WebPubSubClientProtocol;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAIxE;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,uBAE5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iCAAiC,QAAO,uBAEpD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { WebPubSubProtobufProtocolImpl } from "./webPubSubProtobufProtocol";
4
- import { WebPubSubProtobufReliableProtocolImpl } from "./webPubSubProtobufReliableProtocol";
2
+ // Licensed under the MIT License.
3
+ import { WebPubSubProtobufProtocolImpl } from "./webPubSubProtobufProtocol.js";
4
+ import { WebPubSubProtobufReliableProtocolImpl } from "./webPubSubProtobufReliableProtocol.js";
5
5
  /**
6
6
  * Return the "protobuf.webpubsub.azure.v1" protocol
7
7
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,qCAAqC,EAAE,MAAM,wCAAwC,CAAC;AAE/F;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAA4B,EAAE;IACrE,OAAO,IAAI,6BAA6B,EAAE,CAAC;AAC7C,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAA4B,EAAE;IAC7E,OAAO,IAAI,qCAAqC,EAAE,CAAC;AACrD,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { WebPubSubClientProtocol } from \"@azure/web-pubsub-client\";\nimport { WebPubSubProtobufProtocolImpl } from \"./webPubSubProtobufProtocol.js\";\nimport { WebPubSubProtobufReliableProtocolImpl } from \"./webPubSubProtobufReliableProtocol.js\";\n\n/**\n * Return the \"protobuf.webpubsub.azure.v1\" protocol\n */\nexport const WebPubSubProtobufProtocol = (): WebPubSubClientProtocol => {\n return new WebPubSubProtobufProtocolImpl();\n};\n\n/**\n * Return the \"protobuf.reliable.webpubsub.azure.v1\" protocol\n */\nexport const WebPubSubProtobufReliableProtocol = (): WebPubSubClientProtocol => {\n return new WebPubSubProtobufReliableProtocolImpl();\n};\n"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The \@azure\/logger configuration for this package.
3
+ */
4
+ export declare const logger: import("@azure/logger").AzureLogger;
5
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,MAAM,qCAAmD,CAAC"}
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
2
+ // Licensed under the MIT License.
3
3
  import { createClientLogger } from "@azure/logger";
4
4
  /**
5
5
  * The \@azure\/logger configuration for this package.
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\n\n/**\n * The \\@azure\\/logger configuration for this package.\n */\nexport const logger = createClientLogger(\"web-pubsub-client-protobuf\");\n"]}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\n\n/**\n * The \\@azure\\/logger configuration for this package.\n */\nexport const logger = createClientLogger(\"web-pubsub-client-protobuf\");\n"]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,25 @@
1
+ import type { WebPubSubMessage, WebPubSubClientProtocol } from "@azure/web-pubsub-client";
2
+ /**
3
+ * The "protobuf.reliable.webpubsub.azure.v1" protocol
4
+ */
5
+ export declare class WebPubSubProtobufProtocolImpl implements WebPubSubClientProtocol {
6
+ /**
7
+ * True if the protocol supports reliable features
8
+ */
9
+ readonly isReliableSubProtocol = false;
10
+ /**
11
+ * The name of subprotocol. Name will be used in websocket subprotocol
12
+ */
13
+ readonly name = "protobuf.webpubsub.azure.v1";
14
+ /**
15
+ * Creates WebPubSubMessage objects from the specified serialized representation.
16
+ * @param input - The serialized representation
17
+ */
18
+ parseMessages(input: ArrayBuffer): WebPubSubMessage | null;
19
+ /**
20
+ * Write WebPubSubMessage to string
21
+ * @param message - The message to be written
22
+ */
23
+ writeMessage(message: WebPubSubMessage): ArrayBuffer;
24
+ }
25
+ //# sourceMappingURL=webPubSubProtobufProtocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webPubSubProtobufProtocol.d.ts","sourceRoot":"","sources":["../../src/webPubSubProtobufProtocol.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAG1F;;GAEG;AACH,qBAAa,6BAA8B,YAAW,uBAAuB;IAC3E;;OAEG;IACH,SAAgB,qBAAqB,SAAS;IAE9C;;OAEG;IACH,SAAgB,IAAI,iCAAiC;IAErD;;;OAGG;IACI,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,gBAAgB,GAAG,IAAI;IAIjE;;;OAGG;IACI,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,WAAW;CAG5D"}
@@ -1,20 +1,18 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { WebPubSubProtobufProtocolBase } from "./webPubSubProtobufProtocolBase";
2
+ // Licensed under the MIT License.
3
+ import { WebPubSubProtobufProtocolBase } from "./webPubSubProtobufProtocolBase.js";
4
4
  /**
5
5
  * The "protobuf.reliable.webpubsub.azure.v1" protocol
6
6
  */
7
7
  export class WebPubSubProtobufProtocolImpl {
8
- constructor() {
9
- /**
10
- * True if the protocol supports reliable features
11
- */
12
- this.isReliableSubProtocol = false;
13
- /**
14
- * The name of subprotocol. Name will be used in websocket subprotocol
15
- */
16
- this.name = "protobuf.webpubsub.azure.v1";
17
- }
8
+ /**
9
+ * True if the protocol supports reliable features
10
+ */
11
+ isReliableSubProtocol = false;
12
+ /**
13
+ * The name of subprotocol. Name will be used in websocket subprotocol
14
+ */
15
+ name = "protobuf.webpubsub.azure.v1";
18
16
  /**
19
17
  * Creates WebPubSubMessage objects from the specified serialized representation.
20
18
  * @param input - The serialized representation
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webPubSubProtobufProtocol.js","sourceRoot":"","sources":["../../src/webPubSubProtobufProtocol.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF;;GAEG;AACH,MAAM,OAAO,6BAA6B;IACxC;;OAEG;IACa,qBAAqB,GAAG,KAAK,CAAC;IAE9C;;OAEG;IACa,IAAI,GAAG,6BAA6B,CAAC;IAErD;;;OAGG;IACI,aAAa,CAAC,KAAkB;QACrC,OAAO,6BAA6B,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,OAAyB;QAC3C,OAAO,6BAA6B,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC7D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { WebPubSubMessage, WebPubSubClientProtocol } from \"@azure/web-pubsub-client\";\nimport { WebPubSubProtobufProtocolBase } from \"./webPubSubProtobufProtocolBase.js\";\n\n/**\n * The \"protobuf.reliable.webpubsub.azure.v1\" protocol\n */\nexport class WebPubSubProtobufProtocolImpl implements WebPubSubClientProtocol {\n /**\n * True if the protocol supports reliable features\n */\n public readonly isReliableSubProtocol = false;\n\n /**\n * The name of subprotocol. Name will be used in websocket subprotocol\n */\n public readonly name = \"protobuf.webpubsub.azure.v1\";\n\n /**\n * Creates WebPubSubMessage objects from the specified serialized representation.\n * @param input - The serialized representation\n */\n public parseMessages(input: ArrayBuffer): WebPubSubMessage | null {\n return WebPubSubProtobufProtocolBase.parseMessages(input);\n }\n\n /**\n * Write WebPubSubMessage to string\n * @param message - The message to be written\n */\n public writeMessage(message: WebPubSubMessage): ArrayBuffer {\n return WebPubSubProtobufProtocolBase.writeMessage(message);\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import type { WebPubSubMessage } from "@azure/web-pubsub-client";
2
+ /**
3
+ * The "protobuf.reliable.webpubsub.azure.v1" protocol
4
+ */
5
+ export declare class WebPubSubProtobufProtocolBase {
6
+ /**
7
+ * Creates WebPubSubMessage objects from the specified serialized representation.
8
+ * @param input - The serialized representation
9
+ */
10
+ static parseMessages(input: ArrayBuffer): WebPubSubMessage | null;
11
+ /**
12
+ * Write WebPubSubMessage to string
13
+ * @param message - The message to be written
14
+ */
15
+ static writeMessage(message: WebPubSubMessage): ArrayBuffer;
16
+ private static _getIMessageData;
17
+ private static _getNumber;
18
+ private static _isIAny;
19
+ }
20
+ //# sourceMappingURL=webPubSubProtobufProtocolBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webPubSubProtobufProtocolBase.d.ts","sourceRoot":"","sources":["../../src/webPubSubProtobufProtocolBase.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAQV,gBAAgB,EAEjB,MAAM,0BAA0B,CAAC;AAUlC;;GAEG;AACH,qBAAa,6BAA6B;IACxC;;;OAGG;WACW,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,gBAAgB,GAAG,IAAI;IA6ExE;;;OAGG;WACW,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,WAAW;IAoDlE,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAgC/B,OAAO,CAAC,MAAM,CAAC,UAAU;IAOzB,OAAO,CAAC,MAAM,CAAC,OAAO;CAGvB"}
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { DownstreamMessage, MessageData, UpstreamMessage, google, } from "./generated/clientProto";
2
+ // Licensed under the MIT License.
3
+ import { DownstreamMessage, MessageData, UpstreamMessage, google, } from "./generated/clientProto.js";
4
4
  /**
5
5
  * The "protobuf.reliable.webpubsub.azure.v1" protocol
6
6
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webPubSubProtobufProtocolBase.js","sourceRoot":"","sources":["../../src/webPubSubProtobufProtocolBase.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAclC,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,MAAM,GACP,MAAM,4BAA4B,CAAC;AAGpC;;GAEG;AACH,MAAM,OAAO,6BAA6B;IACxC;;;OAGG;IACI,MAAM,CAAC,aAAa,CAAC,KAAkB;QAC5C,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QACnE,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;YAC1B,MAAM,GAAG,GAAG;gBACV,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC;gBACnD,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO;aACzB,CAAC;YAChB,IAAI,UAAU,CAAC,UAAU,CAAC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AM,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;4BACvC,QAAQ,EAAE,IAAI,CAAC,QAAS;4BACxB,KAAK,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,KAAM,CAAC;yBACX,CAAC;qBACX,CAAC,CAAC;gBACrB,CAAC;gBACD,MAAM,IAAI,SAAS,CAAC,wCAAwC,CAAC,CAAC;YAChE,KAAK,MAAM;gBACT,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC7B,MAAM,IAAI,SAAS,CAAC,2BAA2B,CAAC,CAAC;gBACnD,CAAC;gBACD,OAAO,WAAW,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAkB,CAAC,CAAC;YAChE,KAAK,MAAM;gBACT,OAAO,WAAW,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAkB,CAAC,CAAC;YAChF;gBACE,MAAM,IAAI,SAAS,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,UAAU,CAAC,KAAuC;QAC/D,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACvE,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAEO,MAAM,CAAC,OAAO,CAAC,GAAQ;QAC7B,OAAO,UAAU,IAAI,GAAG,IAAI,OAAO,IAAI,GAAG,CAAC;IAC7C,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AckMessage,\n AckMessageError,\n ConnectedMessage,\n DisconnectedMessage,\n GroupDataMessage,\n ServerDataMessage,\n WebPubSubDataType,\n WebPubSubMessage,\n JSONTypes,\n} from \"@azure/web-pubsub-client\";\nimport type { IMessageData, IUpstreamMessage } from \"./generated/clientProto.js\";\nimport {\n DownstreamMessage,\n MessageData,\n UpstreamMessage,\n google,\n} from \"./generated/clientProto.js\";\nimport type Long from \"long\";\n\n/**\n * The \"protobuf.reliable.webpubsub.azure.v1\" protocol\n */\nexport class WebPubSubProtobufProtocolBase {\n /**\n * Creates WebPubSubMessage objects from the specified serialized representation.\n * @param input - The serialized representation\n */\n public static parseMessages(input: ArrayBuffer): WebPubSubMessage | null {\n const downstream = DownstreamMessage.decode(new Uint8Array(input));\n if (downstream.ackMessage) {\n const ack = {\n kind: \"ack\",\n ackId: this._getNumber(downstream.ackMessage.ackId),\n success: downstream.ackMessage.success,\n } as AckMessage;\n if (downstream.ackMessage.error) {\n ack.error = {\n name: downstream.ackMessage.error.name,\n message: downstream.ackMessage.error.message,\n } as AckMessageError;\n }\n return ack;\n } else if (downstream.systemMessage) {\n if (downstream.systemMessage.connectedMessage) {\n const msg = downstream.systemMessage.connectedMessage;\n return {\n kind: \"connected\",\n connectionId: msg.connectionId,\n userId: msg.userId,\n reconnectionToken: msg.reconnectionToken,\n } as ConnectedMessage;\n } else if (downstream.systemMessage.disconnectedMessage) {\n const msg = downstream.systemMessage.disconnectedMessage;\n return { kind: \"disconnected\", message: msg.reason } as DisconnectedMessage;\n } else {\n return null;\n }\n } else if (downstream.dataMessage) {\n const sequenceId = this._getNumber(downstream.dataMessage.sequenceId);\n const messageData = downstream.dataMessage.data!;\n let dataType: WebPubSubDataType;\n let data: string | ArrayBuffer | object;\n if (messageData.textData) {\n dataType = \"text\";\n data = messageData.textData;\n } else if (messageData.jsonData) {\n dataType = \"json\";\n data = JSON.parse(messageData.jsonData);\n } else if (messageData.binaryData) {\n dataType = \"binary\";\n data = messageData.binaryData.buffer.slice(\n messageData.binaryData.byteOffset,\n messageData.binaryData.byteLength + messageData.binaryData.byteOffset,\n );\n } else if (messageData.protobufData) {\n dataType = \"protobuf\";\n data = messageData.protobufData;\n } else {\n return null;\n }\n\n if (downstream.dataMessage.from === \"group\") {\n return {\n kind: \"groupData\",\n dataType: dataType,\n data: data,\n sequenceId: sequenceId,\n group: downstream.dataMessage.group,\n } as GroupDataMessage;\n } else if (downstream.dataMessage.from === \"server\") {\n return {\n kind: \"serverData\",\n dataType: dataType,\n data: data,\n sequenceId: sequenceId,\n } as ServerDataMessage;\n } else {\n return null;\n }\n } else {\n return null;\n }\n }\n\n /**\n * Write WebPubSubMessage to string\n * @param message - The message to be written\n */\n public static writeMessage(message: WebPubSubMessage): ArrayBuffer {\n let upstream: UpstreamMessage;\n switch (message.kind) {\n case \"joinGroup\": {\n const joinGroup = UpstreamMessage.JoinGroupMessage.create({\n group: message.group,\n ackId: message.ackId,\n } as UpstreamMessage.IJoinGroupMessage);\n upstream = UpstreamMessage.create({ joinGroupMessage: joinGroup } as IUpstreamMessage);\n break;\n }\n case \"leaveGroup\": {\n const leaveGroup = UpstreamMessage.LeaveGroupMessage.create({\n group: message.group,\n ackId: message.ackId,\n } as UpstreamMessage.ILeaveGroupMessage);\n upstream = UpstreamMessage.create({ leaveGroupMessage: leaveGroup } as IUpstreamMessage);\n break;\n }\n case \"sendToGroup\": {\n const sendToGroup = UpstreamMessage.SendToGroupMessage.create({\n group: message.group,\n ackId: message.ackId,\n data: this._getIMessageData(message.data, message.dataType),\n noEcho: message.noEcho,\n } as UpstreamMessage.ISendToGroupMessage);\n upstream = UpstreamMessage.create({ sendToGroupMessage: sendToGroup } as IUpstreamMessage);\n break;\n }\n case \"sendEvent\": {\n const sendEvent = UpstreamMessage.EventMessage.create({\n event: message.event,\n ackId: message.ackId,\n data: this._getIMessageData(message.data, message.dataType),\n } as UpstreamMessage.IEventMessage);\n upstream = UpstreamMessage.create({ eventMessage: sendEvent } as IUpstreamMessage);\n break;\n }\n case \"sequenceAck\": {\n const sequenceAck = UpstreamMessage.SequenceAckMessage.create({\n sequenceId: message.sequenceId,\n } as UpstreamMessage.ISequenceAckMessage);\n upstream = UpstreamMessage.create({ sequenceAckMessage: sequenceAck } as IUpstreamMessage);\n break;\n }\n default:\n throw new TypeError(`kind is not supported: ${message.kind}`);\n }\n\n return UpstreamMessage.encode(upstream).finish();\n }\n\n private static _getIMessageData(\n data: JSONTypes | ArrayBuffer,\n dataType: WebPubSubDataType,\n ): IMessageData {\n switch (dataType) {\n case \"binary\":\n if (!(data instanceof ArrayBuffer)) {\n throw new TypeError(\"Message must be a ArrayBuffer.\");\n }\n return MessageData.create({ binaryData: new Uint8Array(data) } as IMessageData);\n case \"protobuf\":\n if (WebPubSubProtobufProtocolBase._isIAny(data)) {\n return MessageData.create({\n protobufData: google.protobuf.Any.create({\n type_url: data.type_url!,\n value: new Uint8Array(data.value!),\n } as google.protobuf.IAny),\n } as IMessageData);\n }\n throw new TypeError(\"Message must be a google.protobuf.Any.\");\n case \"text\":\n if (typeof data !== \"string\") {\n throw new TypeError(\"Message must be a string.\");\n }\n return MessageData.create({ textData: data } as IMessageData);\n case \"json\":\n return MessageData.create({ jsonData: JSON.stringify(data) } as IMessageData);\n default:\n throw new TypeError(`dataType is not supported: ${dataType}`);\n }\n }\n\n private static _getNumber(value: number | Long | null | undefined): number | null | undefined {\n if (value === null || value === undefined || typeof value === \"number\") {\n return value;\n }\n return value.toNumber();\n }\n\n private static _isIAny(obj: any): obj is google.protobuf.IAny {\n return \"type_url\" in obj && \"value\" in obj;\n }\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import type { WebPubSubMessage, WebPubSubClientProtocol } from "@azure/web-pubsub-client";
2
+ /**
3
+ * The "protobuf.reliable.webpubsub.azure.v1" protocol
4
+ */
5
+ export declare class WebPubSubProtobufReliableProtocolImpl implements WebPubSubClientProtocol {
6
+ /**
7
+ * True if the protocol supports reliable features
8
+ */
9
+ readonly isReliableSubProtocol = true;
10
+ /**
11
+ * The name of subprotocol. Name will be used in websocket subprotocol
12
+ */
13
+ readonly name = "protobuf.reliable.webpubsub.azure.v1";
14
+ /**
15
+ * Creates WebPubSubMessage objects from the specified serialized representation.
16
+ * @param input - The serialized representation
17
+ */
18
+ parseMessages(input: ArrayBuffer): WebPubSubMessage | null;
19
+ /**
20
+ * Write WebPubSubMessage to string
21
+ * @param message - The message to be written
22
+ */
23
+ writeMessage(message: WebPubSubMessage): ArrayBuffer;
24
+ }
25
+ //# sourceMappingURL=webPubSubProtobufReliableProtocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webPubSubProtobufReliableProtocol.d.ts","sourceRoot":"","sources":["../../src/webPubSubProtobufReliableProtocol.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAG1F;;GAEG;AACH,qBAAa,qCAAsC,YAAW,uBAAuB;IACnF;;OAEG;IACH,SAAgB,qBAAqB,QAAQ;IAE7C;;OAEG;IACH,SAAgB,IAAI,0CAA0C;IAE9D;;;OAGG;IACI,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,gBAAgB,GAAG,IAAI;IAIjE;;;OAGG;IACI,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,WAAW;CAG5D"}
@@ -1,20 +1,18 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { WebPubSubProtobufProtocolBase } from "./webPubSubProtobufProtocolBase";
2
+ // Licensed under the MIT License.
3
+ import { WebPubSubProtobufProtocolBase } from "./webPubSubProtobufProtocolBase.js";
4
4
  /**
5
5
  * The "protobuf.reliable.webpubsub.azure.v1" protocol
6
6
  */
7
7
  export class WebPubSubProtobufReliableProtocolImpl {
8
- constructor() {
9
- /**
10
- * True if the protocol supports reliable features
11
- */
12
- this.isReliableSubProtocol = true;
13
- /**
14
- * The name of subprotocol. Name will be used in websocket subprotocol
15
- */
16
- this.name = "protobuf.reliable.webpubsub.azure.v1";
17
- }
8
+ /**
9
+ * True if the protocol supports reliable features
10
+ */
11
+ isReliableSubProtocol = true;
12
+ /**
13
+ * The name of subprotocol. Name will be used in websocket subprotocol
14
+ */
15
+ name = "protobuf.reliable.webpubsub.azure.v1";
18
16
  /**
19
17
  * Creates WebPubSubMessage objects from the specified serialized representation.
20
18
  * @param input - The serialized representation
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webPubSubProtobufReliableProtocol.js","sourceRoot":"","sources":["../../src/webPubSubProtobufReliableProtocol.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF;;GAEG;AACH,MAAM,OAAO,qCAAqC;IAChD;;OAEG;IACa,qBAAqB,GAAG,IAAI,CAAC;IAE7C;;OAEG;IACa,IAAI,GAAG,sCAAsC,CAAC;IAE9D;;;OAGG;IACI,aAAa,CAAC,KAAkB;QACrC,OAAO,6BAA6B,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IAED;;;OAGG;IACI,YAAY,CAAC,OAAyB;QAC3C,OAAO,6BAA6B,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC7D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { WebPubSubMessage, WebPubSubClientProtocol } from \"@azure/web-pubsub-client\";\nimport { WebPubSubProtobufProtocolBase } from \"./webPubSubProtobufProtocolBase.js\";\n\n/**\n * The \"protobuf.reliable.webpubsub.azure.v1\" protocol\n */\nexport class WebPubSubProtobufReliableProtocolImpl implements WebPubSubClientProtocol {\n /**\n * True if the protocol supports reliable features\n */\n public readonly isReliableSubProtocol = true;\n\n /**\n * The name of subprotocol. Name will be used in websocket subprotocol\n */\n public readonly name = \"protobuf.reliable.webpubsub.azure.v1\";\n\n /**\n * Creates WebPubSubMessage objects from the specified serialized representation.\n * @param input - The serialized representation\n */\n public parseMessages(input: ArrayBuffer): WebPubSubMessage | null {\n return WebPubSubProtobufProtocolBase.parseMessages(input);\n }\n\n /**\n * Write WebPubSubMessage to string\n * @param message - The message to be written\n */\n public writeMessage(message: WebPubSubMessage): ArrayBuffer {\n return WebPubSubProtobufProtocolBase.writeMessage(message);\n }\n}\n"]}