@asyncapi/generator 2.8.0 → 2.8.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.
- package/CHANGELOG.md +18 -0
- package/docs/api.md +1 -2
- package/lib/templates/BakedInTemplatesList.json +7 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/.ageneratorrc +21 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/README.md +12 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/ClientClass.js +42 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/ClientClass.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/ClientFields.js +21 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/ClientFields.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/Connect.js +60 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/Connect.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/Constructor.js +27 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/Constructor.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/HandleMessage.js +21 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/HandleMessage.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/RegisterErrorHandler.js +21 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/RegisterErrorHandler.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/SendEchoMessage.js +27 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/components/SendEchoMessage.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/template/client.dart.js +181 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/template/client.dart.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/template/pubspec.yaml.js +21 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/__transpiled/template/pubspec.yaml.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/components/ClientClass.js +32 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/components/ClientFields.js +12 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/components/Connect.js +49 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/components/Constructor.js +16 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/components/HandleMessage.js +14 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/components/RegisterErrorHandler.js +14 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/components/SendEchoMessage.js +20 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/example.dart +36 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/package.json +55 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/template/client.dart.js +24 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/template/pubspec.yaml.js +16 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/.ageneratorrc +25 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/README.md +28 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/ClientConnector.js +27 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/ClientConnector.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/ClientFields.js +19 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/ClientFields.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/ConnectorFields.js +22 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/ConnectorFields.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/EchoWebSocket.js +40 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/EchoWebSocket.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/HandleError.js +20 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/HandleError.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/InitConnector.js +47 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/InitConnector.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/OnClose.js +23 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/OnClose.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/OnOpen.js +25 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/OnOpen.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/OnTextMessageHandler.js +29 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/OnTextMessageHandler.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/dependencies/ClientDependencies.js +29 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/dependencies/ClientDependencies.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/dependencies/ConnectorDependencies.js +27 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/components/dependencies/ConnectorDependencies.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/template/src/main/java/com/asyncapi/client.java.js +154 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/template/src/main/java/com/asyncapi/client.java.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/template/src/main/java/com/asyncapi/connector.java.js +108 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/template/src/main/java/com/asyncapi/connector.java.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/template/src/main/java/com/asyncapi/models/model.js +52 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/template/src/main/java/com/asyncapi/models/model.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/template/src/main/resources/AppProperties.js +27 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/__transpiled/template/src/main/resources/AppProperties.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/components/ClientConnector.js +17 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/components/ClientFields.js +10 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/components/ConnectorFields.js +11 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/components/EchoWebSocket.js +27 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/components/HandleError.js +14 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/components/InitConnector.js +41 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/components/OnClose.js +16 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/components/OnOpen.js +16 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/components/OnTextMessageHandler.js +25 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/components/dependencies/ClientDependencies.js +23 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/components/dependencies/ConnectorDependencies.js +20 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/package.json +64 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/template/.dockerignore +5 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/template/.mvn/wrapper/MavenWrapperDownloader.java +93 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/template/.mvn/wrapper/maven-wrapper.properties +20 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/template/README.md +58 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/template/mvnw +332 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/template/mvnw.cmd +206 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/template/pom.xml +125 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/template/src/main/docker/Dockerfile.jvm +98 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/template/src/main/java/com/asyncapi/client.java.js +27 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/template/src/main/java/com/asyncapi/connector.java.js +16 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/template/src/main/java/com/asyncapi/models/model.js +36 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-java-quarkus/template/src/main/resources/AppProperties.js +19 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/.ageneratorrc +21 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/README.md +10 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/AvailableOperations.js +34 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/AvailableOperations.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/ClientClass.js +47 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/ClientClass.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/Connect.js +63 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/Connect.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/Constructor.js +29 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/Constructor.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/HandleMessage.js +21 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/HandleMessage.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/MessageExamples.js +29 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/MessageExamples.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/ModuleExport.js +18 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/ModuleExport.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/OperationHeader.js +19 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/OperationHeader.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/RegisterErrorHandler.js +25 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/RegisterErrorHandler.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/SendOperation.js +53 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/components/SendOperation.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/example.js +43 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/example.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/template/README.md.js +166 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/template/README.md.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/template/client.js.js +216 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/__transpiled/template/client.js.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/AvailableOperations.js +20 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/ClientClass.js +32 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/Connect.js +54 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/Constructor.js +21 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/HandleMessage.js +14 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/MessageExamples.js +25 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/ModuleExport.js +11 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/OperationHeader.js +12 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/RegisterErrorHandler.js +18 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/components/SendOperation.js +44 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/example.js +42 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/package.json +55 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/template/README.md.js +106 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-javascript/template/client.js.js +24 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/.ageneratorrc +21 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/README.md +53 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/ClientClass.js +61 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/ClientClass.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/Connect.js +58 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/Connect.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/Constructor.js +55 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/Constructor.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/HandleError.js +25 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/HandleError.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/HandleMessage.js +24 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/HandleMessage.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/InitSignature.js +34 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/InitSignature.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/QueryParamsArgumentsDocs.js +27 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/QueryParamsArgumentsDocs.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/QueryParamsVariables.js +36 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/QueryParamsVariables.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/RegisterErrorHandler.js +23 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/RegisterErrorHandler.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/RegisterOutgoingProcessor.js +26 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/RegisterOutgoingProcessor.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/Requires.js +24 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/Requires.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/Send.js +41 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/Send.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/SendOperation.js +56 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/components/SendOperation.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/template/client.py.js +379 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/template/client.py.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/template/models.js +15 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/template/models.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/template/requirements.txt.js +19 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/__transpiled/template/requirements.txt.js.map +1 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/ClientClass.js +47 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/Connect.js +49 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/Constructor.js +42 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/HandleError.js +18 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/HandleMessage.js +17 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/InitSignature.js +24 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/QueryParamsArgumentsDocs.js +19 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/QueryParamsVariables.js +27 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/RegisterErrorHandler.js +16 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/RegisterOutgoingProcessor.js +19 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/Requires.js +15 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/Send.js +33 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/components/SendOperation.js +50 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/example-slack.py +21 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/example.py +41 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/package.json +55 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/template/client.py.js +23 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/template/models.js +5 -0
- package/lib/templates/bakedInTemplates/core-template-client-websocket-python/template/requirements.txt.js +13 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @asyncapi/generator
|
|
2
2
|
|
|
3
|
+
## 2.8.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d84e110: First release of the generator including `@asyncapi/generator-components` and `@asyncapi/generator-helpers` packages.
|
|
8
|
+
|
|
9
|
+
## 2.8.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 4394d90: Ensure transpiled baked-in templates are published to npm. Fixing missing `react-sdk` build.
|
|
14
|
+
|
|
15
|
+
## 2.8.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 190ebc9: Ensure transpiled baked-in templates are published to npm.
|
|
20
|
+
|
|
3
21
|
## 2.8.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/docs/api.md
CHANGED
|
@@ -16,8 +16,7 @@ Reference API documentation for AsyncAPI Generator library.
|
|
|
16
16
|
<dl>
|
|
17
17
|
<dt><a href="#listBakedInTemplates">listBakedInTemplates</a> ⇒ <code>Array.<Object></code></dt>
|
|
18
18
|
<dd><p>List core templates, optionally filter by type, stack, protocol, or target.
|
|
19
|
-
Use name of returned templates as input for the <code>generate</code> method for template generation. Such core templates code is part of the @asyncapi/generator package.</p>
|
|
20
|
-
</dd>
|
|
19
|
+
Use name of returned templates as input for the <code>generate</code> method for template generation. Such core templates code is part of the @asyncapi/generator package.</p></dd>
|
|
21
20
|
</dl>
|
|
22
21
|
|
|
23
22
|
|
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
"protocol": "websocket",
|
|
6
6
|
"target": "dart"
|
|
7
7
|
},
|
|
8
|
+
{
|
|
9
|
+
"name": "core-template-client-websocket-java-quarkus",
|
|
10
|
+
"type": "client",
|
|
11
|
+
"protocol": "websocket",
|
|
12
|
+
"target": "java",
|
|
13
|
+
"stack": "quarkus"
|
|
14
|
+
},
|
|
8
15
|
{
|
|
9
16
|
"name": "core-template-client-websocket-javascript",
|
|
10
17
|
"type": "client",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
renderer: react
|
|
2
|
+
apiVersion: v3
|
|
3
|
+
parameters:
|
|
4
|
+
server:
|
|
5
|
+
description: The name of the server described in AsyncAPI document
|
|
6
|
+
required: true
|
|
7
|
+
clientFileName:
|
|
8
|
+
description: The name of the generated client file
|
|
9
|
+
required: false
|
|
10
|
+
default: client.dart
|
|
11
|
+
appendClientSuffix:
|
|
12
|
+
description: Add 'Client' suffix at the end of the class name. This option has no effect if 'customClientName' is specified.
|
|
13
|
+
required: false
|
|
14
|
+
default: false
|
|
15
|
+
customClientName:
|
|
16
|
+
description: The custom name for the generated client class
|
|
17
|
+
required: false
|
|
18
|
+
metadata:
|
|
19
|
+
type: client
|
|
20
|
+
protocol: websocket
|
|
21
|
+
target: dart
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
## Dart WebSocket Client
|
|
2
|
+
|
|
3
|
+
You can test this template:
|
|
4
|
+
1. Clone the project and run `npm install`
|
|
5
|
+
2. Navigate to `packages/templates/clients/websocket/test/integration-test` and run the tests with `npm run test` to generate WebSocket clients
|
|
6
|
+
3. Navigate to `packages/templates/clients/websocket/dart`
|
|
7
|
+
4. Install with `npm install` and run test with `npm run test`
|
|
8
|
+
5. Navigate to the generated Hoppscotch client folder with `cd test/temp/snapshotTestResult/custom_client_hoppscotch`
|
|
9
|
+
6. Install dependencies of the generated client: `dart pub get`
|
|
10
|
+
7. Start an example script that uses a client library generated by the test: `dart run --packages=.dart_tool/package_config.json ../../../../example.dart`
|
|
11
|
+
|
|
12
|
+
> By default, this is testing against Hoppscotch Echo service. You can modify `packages/templates/clients/websocket/dart/example.dart` and change first line to `import 'test/temp/snapshotTestResult/client_postman/client.dart';` and line 15 `final wsClient = PostmanEchoWebSocketClientClient();` and run `dart run --packages=.dart_tool/package_config.json ../../../../example.dart` again. You will see the example still works but against a different API. This is possible as both AsyncAPI documents have the same name of operation for sending messages: `sendEchoMessage` so each client generated has the same API.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('source-map-support/register');
|
|
6
|
+
var generatorReactSdk = require('@asyncapi/generator-react-sdk');
|
|
7
|
+
var Constructor = require('./Constructor.js');
|
|
8
|
+
var Connect = require('./Connect.js');
|
|
9
|
+
var RegisterErrorHandler = require('./RegisterErrorHandler.js');
|
|
10
|
+
var HandleMessage = require('./HandleMessage.js');
|
|
11
|
+
var SendEchoMessage = require('./SendEchoMessage.js');
|
|
12
|
+
var generatorComponents = require('@asyncapi/generator-components');
|
|
13
|
+
var ClientFields = require('./ClientFields.js');
|
|
14
|
+
var jsxRuntime = require('/home/runner/work/generator/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js');
|
|
15
|
+
|
|
16
|
+
function ClientClass({
|
|
17
|
+
clientName,
|
|
18
|
+
serverUrl,
|
|
19
|
+
title
|
|
20
|
+
}) {
|
|
21
|
+
return /*#__PURE__*/jsxRuntime.jsxs(generatorReactSdk.Text, {
|
|
22
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
23
|
+
newLines: 2,
|
|
24
|
+
children: `class ${clientName} {`
|
|
25
|
+
}), /*#__PURE__*/jsxRuntime.jsx(ClientFields.ClientFields, {}), /*#__PURE__*/jsxRuntime.jsx(Constructor.Constructor, {
|
|
26
|
+
clientName: clientName,
|
|
27
|
+
serverUrl: serverUrl
|
|
28
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Connect.Connect, {
|
|
29
|
+
title: title
|
|
30
|
+
}), /*#__PURE__*/jsxRuntime.jsx(generatorComponents.RegisterMessageHandler, {
|
|
31
|
+
language: "dart",
|
|
32
|
+
methodParams: ['void Function(String) handler']
|
|
33
|
+
}), /*#__PURE__*/jsxRuntime.jsx(RegisterErrorHandler.RegisterErrorHandler, {}), /*#__PURE__*/jsxRuntime.jsx(HandleMessage.HandleMessage, {}), /*#__PURE__*/jsxRuntime.jsx(SendEchoMessage.SendEchoMessage, {}), /*#__PURE__*/jsxRuntime.jsx(generatorComponents.CloseConnection, {
|
|
34
|
+
language: "dart"
|
|
35
|
+
}), /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
36
|
+
children: '}'
|
|
37
|
+
})]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.ClientClass = ClientClass;
|
|
42
|
+
//# sourceMappingURL=ClientClass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientClass.js","sources":["../../../../../../../../packages/templates/clients/websocket/dart/components/ClientClass.js"],"sourcesContent":["import { Text } from '@asyncapi/generator-react-sdk';\nimport { Constructor } from './Constructor';\nimport { Connect } from './Connect';\nimport { RegisterErrorHandler } from './RegisterErrorHandler';\nimport { HandleMessage } from './HandleMessage';\nimport { SendEchoMessage } from './SendEchoMessage';\nimport { CloseConnection, RegisterMessageHandler } from '@asyncapi/generator-components';\nimport { ClientFields } from './ClientFields';\n\nexport function ClientClass({ clientName, serverUrl, title }) {\n return (\n <Text>\n <Text newLines={2}>\n {`class ${clientName} {`}\n </Text>\n <ClientFields />\n <Constructor clientName={clientName} serverUrl={serverUrl} />\n <Connect title={title} />\n <RegisterMessageHandler \n language=\"dart\" \n methodParams={['void Function(String) handler']}\n />\n <RegisterErrorHandler />\n <HandleMessage />\n <SendEchoMessage />\n <CloseConnection language=\"dart\" />\n <Text>\n {'}'}\n </Text>\n </Text>\n );\n}\n"],"names":["ClientClass","clientName","serverUrl","title","_jsxs","Text","children","_jsx","newLines","ClientFields","Constructor","Connect","RegisterMessageHandler","language","methodParams","RegisterErrorHandler","HandleMessage","SendEchoMessage","CloseConnection"],"mappings":";;;;;;;;;;;;;;;AASO,SAASA,WAAWA,CAAC;EAAEC,UAAU;EAAEC,SAAS;AAAEC,EAAAA,KAAAA;AAAM,CAAC,EAAE;EAC5D,oBACEC,eAAA,CAACC,sBAAI,EAAA;IAAAC,QAAA,EAAA,cACHC,cAAA,CAACF,sBAAI,EAAA;AAACG,MAAAA,QAAQ,EAAE,CAAE;MAAAF,QAAA,EACf,SAASL,UAAU,CAAA,EAAA,CAAA;KAChB,CAAC,eACPM,cAAA,CAACE,yBAAY,IAAE,CAAC,eAChBF,cAAA,CAACG,uBAAW,EAAA;AAACT,MAAAA,UAAU,EAAEA,UAAW;AAACC,MAAAA,SAAS,EAAEA,SAAAA;AAAU,KAAE,CAAC,eAC7DK,cAAA,CAACI,eAAO,EAAA;AAACR,MAAAA,KAAK,EAAEA,KAAAA;AAAM,KAAE,CAAC,eACzBI,cAAA,CAACK,0CAAsB,EAAA;AACrBC,MAAAA,QAAQ,EAAC,MAAM;MACfC,YAAY,EAAE,CAAC,+BAA+B,CAAA;KAC/C,CAAC,eACFP,cAAA,CAACQ,yCAAoB,EAAE,EAAA,CAAC,eACxBR,cAAA,CAACS,2BAAa,IAAE,CAAC,eACjBT,cAAA,CAACU,+BAAe,IAAE,CAAC,eACnBV,cAAA,CAACW,mCAAe,EAAA;AAACL,MAAAA,QAAQ,EAAC,MAAA;AAAM,KAAE,CAAC,eACnCN,cAAA,CAACF,sBAAI,EAAA;AAAAC,MAAAA,QAAA,EACF,GAAA;AAAG,KACA,CAAC,CAAA;AAAA,GACH,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('source-map-support/register');
|
|
6
|
+
var generatorReactSdk = require('@asyncapi/generator-react-sdk');
|
|
7
|
+
var jsxRuntime = require('/home/runner/work/generator/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js');
|
|
8
|
+
|
|
9
|
+
function ClientFields() {
|
|
10
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
11
|
+
indent: 2,
|
|
12
|
+
newLines: 2,
|
|
13
|
+
children: `final String _url;
|
|
14
|
+
WebSocketChannel? _channel;
|
|
15
|
+
final List<void Function(String)> _messageHandlers = [];
|
|
16
|
+
final List<void Function(Object)> _errorHandlers = [];`
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.ClientFields = ClientFields;
|
|
21
|
+
//# sourceMappingURL=ClientFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientFields.js","sources":["../../../../../../../../packages/templates/clients/websocket/dart/components/ClientFields.js"],"sourcesContent":["import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function ClientFields() {\n return (\n <Text indent={2} newLines={2}>\n {`final String _url;\nWebSocketChannel? _channel;\nfinal List<void Function(String)> _messageHandlers = [];\nfinal List<void Function(Object)> _errorHandlers = [];`}\n </Text>\n );\n}\n"],"names":["ClientFields","_jsx","Text","indent","newLines","children"],"mappings":";;;;;;;;AAEO,SAASA,YAAYA,GAAG;EAC7B,oBACEC,cAAA,CAACC,sBAAI,EAAA;AAACC,IAAAA,MAAM,EAAE,CAAE;AAACC,IAAAA,QAAQ,EAAE,CAAE;AAAAC,IAAAA,QAAA,EAC1B,CAAA;AACP;AACA;AACA,sDAAA,CAAA;AAAuD,GAC7C,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('source-map-support/register');
|
|
6
|
+
var generatorReactSdk = require('@asyncapi/generator-react-sdk');
|
|
7
|
+
var jsxRuntime = require('/home/runner/work/generator/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js');
|
|
8
|
+
|
|
9
|
+
function Connect({
|
|
10
|
+
title
|
|
11
|
+
}) {
|
|
12
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
13
|
+
newLines: 2,
|
|
14
|
+
indent: 2,
|
|
15
|
+
children: `/// Method to establish a WebSocket connection
|
|
16
|
+
Future<void> connect() async {
|
|
17
|
+
if (_channel != null) {
|
|
18
|
+
print('Already connected to ${title} server');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
final wsUrl = Uri.parse(_url);
|
|
23
|
+
_channel = WebSocketChannel.connect(wsUrl);
|
|
24
|
+
print('Connected to ${title} server');
|
|
25
|
+
|
|
26
|
+
/// Listen to the incoming message stream
|
|
27
|
+
_channel?.stream.listen(
|
|
28
|
+
(message) {
|
|
29
|
+
if (_messageHandlers.isNotEmpty) {
|
|
30
|
+
for (var handler in _messageHandlers) {
|
|
31
|
+
_handleMessage(message, handler);
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
print('Message received: $message');
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
onError: (error) {
|
|
38
|
+
if (_errorHandlers.isNotEmpty) {
|
|
39
|
+
for (var handler in _errorHandlers) {
|
|
40
|
+
handler(error);
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
print('WebSocket Error: $error');
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
onDone: () {
|
|
47
|
+
_channel = null;
|
|
48
|
+
print('Disconnected from ${title} server');
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
print('Connection failed: $error');
|
|
53
|
+
rethrow;
|
|
54
|
+
}
|
|
55
|
+
}`
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
exports.Connect = Connect;
|
|
60
|
+
//# sourceMappingURL=Connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Connect.js","sources":["../../../../../../../../packages/templates/clients/websocket/dart/components/Connect.js"],"sourcesContent":["import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function Connect({ title }) {\n return (\n <Text newLines={2} indent={2}>\n {`/// Method to establish a WebSocket connection\nFuture<void> connect() async {\n if (_channel != null) {\n print('Already connected to ${title} server');\n return;\n }\n try {\n final wsUrl = Uri.parse(_url);\n _channel = WebSocketChannel.connect(wsUrl);\n print('Connected to ${title} server');\n\n /// Listen to the incoming message stream\n _channel?.stream.listen(\n (message) {\n if (_messageHandlers.isNotEmpty) {\n for (var handler in _messageHandlers) {\n _handleMessage(message, handler);\n }\n } else {\n print('Message received: $message');\n }\n },\n onError: (error) {\n if (_errorHandlers.isNotEmpty) {\n for (var handler in _errorHandlers) {\n handler(error);\n }\n } else {\n print('WebSocket Error: $error');\n }\n },\n onDone: () {\n _channel = null;\n print('Disconnected from ${title} server');\n },\n );\n } catch (error) {\n print('Connection failed: $error');\n rethrow;\n }\n}`}\n </Text>\n );\n}"],"names":["Connect","title","_jsx","Text","newLines","indent","children"],"mappings":";;;;;;;;AAEO,SAASA,OAAOA,CAAC;AAAEC,EAAAA,KAAAA;AAAM,CAAC,EAAE;EACjC,oBACEC,cAAA,CAACC,sBAAI,EAAA;AAACC,IAAAA,QAAQ,EAAE,CAAE;AAACC,IAAAA,MAAM,EAAE,CAAE;AAAAC,IAAAA,QAAA,EAC1B,CAAA;AACP;AACA;AACA,gCAAA,EAAkCL,KAAK,CAAA;AACvC;AACA;AACA;AACA;AACA;AACA,wBAAA,EAA0BA,KAAK,CAAA;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAA,EAAmCA,KAAK,CAAA;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,CAAA,CAAA;AAAE,GACQ,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('source-map-support/register');
|
|
6
|
+
var generatorReactSdk = require('@asyncapi/generator-react-sdk');
|
|
7
|
+
var jsxRuntime = require('/home/runner/work/generator/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js');
|
|
8
|
+
|
|
9
|
+
function Constructor({
|
|
10
|
+
clientName,
|
|
11
|
+
serverUrl
|
|
12
|
+
}) {
|
|
13
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
14
|
+
newLines: 2,
|
|
15
|
+
indent: 2,
|
|
16
|
+
children: `
|
|
17
|
+
/// Constructor to initialize the WebSocket client
|
|
18
|
+
///
|
|
19
|
+
/// [url] - The WebSocket server URL. Use it if the server URL is different from the default one taken from the AsyncAPI document.
|
|
20
|
+
${clientName}({String? url})
|
|
21
|
+
: _url = url ?? '${serverUrl}';
|
|
22
|
+
`
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.Constructor = Constructor;
|
|
27
|
+
//# sourceMappingURL=Constructor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constructor.js","sources":["../../../../../../../../packages/templates/clients/websocket/dart/components/Constructor.js"],"sourcesContent":["import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function Constructor({ clientName, serverUrl }) {\n return (\n <Text newLines={2} indent={2}>\n {\n `\n/// Constructor to initialize the WebSocket client\n/// \n/// [url] - The WebSocket server URL. Use it if the server URL is different from the default one taken from the AsyncAPI document.\n${clientName}({String? url})\n : _url = url ?? '${serverUrl}';\n`}\n </Text>\n );\n}\n"],"names":["Constructor","clientName","serverUrl","_jsx","Text","newLines","indent","children"],"mappings":";;;;;;;;AAEO,SAASA,WAAWA,CAAC;EAAEC,UAAU;AAAEC,EAAAA,SAAAA;AAAU,CAAC,EAAE;EACrD,oBACEC,cAAA,CAACC,sBAAI,EAAA;AAACC,IAAAA,QAAQ,EAAE,CAAE;AAACC,IAAAA,MAAM,EAAE,CAAE;AAAAC,IAAAA,QAAA,EAEzB,CAAA;AACR;AACA;AACA;AACA,EAAEN,UAAU,CAAA;AACZ,mBAAA,EAAqBC,SAAS,CAAA;AAC9B,CAAA;AAAC,GACS,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('source-map-support/register');
|
|
6
|
+
var generatorReactSdk = require('@asyncapi/generator-react-sdk');
|
|
7
|
+
var jsxRuntime = require('/home/runner/work/generator/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js');
|
|
8
|
+
|
|
9
|
+
function HandleMessage() {
|
|
10
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
11
|
+
newLines: 2,
|
|
12
|
+
indent: 2,
|
|
13
|
+
children: `/// Method to handle message with callback
|
|
14
|
+
void _handleMessage(dynamic message, void Function(String) cb) {
|
|
15
|
+
cb(message is String ? message : message.toString());
|
|
16
|
+
}`
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.HandleMessage = HandleMessage;
|
|
21
|
+
//# sourceMappingURL=HandleMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HandleMessage.js","sources":["../../../../../../../../packages/templates/clients/websocket/dart/components/HandleMessage.js"],"sourcesContent":["import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function HandleMessage() {\n return (\n <Text newLines={2} indent={2}>\n {\n `/// Method to handle message with callback\nvoid _handleMessage(dynamic message, void Function(String) cb) {\n cb(message is String ? message : message.toString());\n}`\n }\n </Text>\n );\n}\n"],"names":["HandleMessage","_jsx","Text","newLines","indent","children"],"mappings":";;;;;;;;AAEO,SAASA,aAAaA,GAAG;EAC9B,oBACEC,cAAA,CAACC,sBAAI,EAAA;AAACC,IAAAA,QAAQ,EAAE,CAAE;AAACC,IAAAA,MAAM,EAAE,CAAE;AAAAC,IAAAA,QAAA,EAEzB,CAAA;AACR;AACA;AACA,CAAA,CAAA;AAAE,GAEQ,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('source-map-support/register');
|
|
6
|
+
var generatorReactSdk = require('@asyncapi/generator-react-sdk');
|
|
7
|
+
var jsxRuntime = require('/home/runner/work/generator/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js');
|
|
8
|
+
|
|
9
|
+
function RegisterErrorHandler() {
|
|
10
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
11
|
+
newLines: 2,
|
|
12
|
+
indent: 2,
|
|
13
|
+
children: `/// Method to register custom error handlers
|
|
14
|
+
void registerErrorHandler(void Function(Object) handler) {
|
|
15
|
+
_errorHandlers.add(handler);
|
|
16
|
+
}`
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.RegisterErrorHandler = RegisterErrorHandler;
|
|
21
|
+
//# sourceMappingURL=RegisterErrorHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegisterErrorHandler.js","sources":["../../../../../../../../packages/templates/clients/websocket/dart/components/RegisterErrorHandler.js"],"sourcesContent":["import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function RegisterErrorHandler() {\n return (\n <Text newLines={2} indent={2}>\n {\n `/// Method to register custom error handlers\nvoid registerErrorHandler(void Function(Object) handler) {\n _errorHandlers.add(handler);\n}`\n }\n </Text>\n );\n}\n"],"names":["RegisterErrorHandler","_jsx","Text","newLines","indent","children"],"mappings":";;;;;;;;AAEO,SAASA,oBAAoBA,GAAG;EACrC,oBACEC,cAAA,CAACC,sBAAI,EAAA;AAACC,IAAAA,QAAQ,EAAE,CAAE;AAACC,IAAAA,MAAM,EAAE,CAAE;AAAAC,IAAAA,QAAA,EAEzB,CAAA;AACR;AACA;AACA,CAAA,CAAA;AAAE,GAEQ,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('source-map-support/register');
|
|
6
|
+
var generatorReactSdk = require('@asyncapi/generator-react-sdk');
|
|
7
|
+
var jsxRuntime = require('/home/runner/work/generator/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js');
|
|
8
|
+
|
|
9
|
+
function SendEchoMessage() {
|
|
10
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
11
|
+
newLines: 2,
|
|
12
|
+
indent: 2,
|
|
13
|
+
children: `/// Method to send an echo message to the server
|
|
14
|
+
void sendEchoMessage(dynamic message) {
|
|
15
|
+
if (_channel == null) {
|
|
16
|
+
print('Error: WebSocket is not connected.');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
final payload = message is String ? message : jsonEncode(message);
|
|
20
|
+
_channel!.sink.add(payload);
|
|
21
|
+
print('Sent message to echo server: $payload');
|
|
22
|
+
}`
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.SendEchoMessage = SendEchoMessage;
|
|
27
|
+
//# sourceMappingURL=SendEchoMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SendEchoMessage.js","sources":["../../../../../../../../packages/templates/clients/websocket/dart/components/SendEchoMessage.js"],"sourcesContent":["import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function SendEchoMessage() {\n return (\n <Text newLines={2} indent={2}>\n {\n `/// Method to send an echo message to the server\nvoid sendEchoMessage(dynamic message) {\n if (_channel == null) {\n print('Error: WebSocket is not connected.');\n return;\n }\n final payload = message is String ? message : jsonEncode(message);\n _channel!.sink.add(payload);\n print('Sent message to echo server: $payload');\n}`\n }\n </Text>\n );\n}\n"],"names":["SendEchoMessage","_jsx","Text","newLines","indent","children"],"mappings":";;;;;;;;AAEO,SAASA,eAAeA,GAAG;EAChC,oBACEC,cAAA,CAACC,sBAAI,EAAA;AAACC,IAAAA,QAAQ,EAAE,CAAE;AAACC,IAAAA,MAAM,EAAE,CAAE;AAAAC,IAAAA,QAAA,EAEzB,CAAA;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAA,CAAA;AAAE,GAEQ,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('source-map-support/register');
|
|
4
|
+
var generatorReactSdk = require('@asyncapi/generator-react-sdk');
|
|
5
|
+
var generatorHelpers = require('@asyncapi/generator-helpers');
|
|
6
|
+
var generatorComponents = require('@asyncapi/generator-components');
|
|
7
|
+
var jsxRuntime = require('/home/runner/work/generator/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js');
|
|
8
|
+
|
|
9
|
+
function Constructor({
|
|
10
|
+
clientName,
|
|
11
|
+
serverUrl
|
|
12
|
+
}) {
|
|
13
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
14
|
+
newLines: 2,
|
|
15
|
+
indent: 2,
|
|
16
|
+
children: `
|
|
17
|
+
/// Constructor to initialize the WebSocket client
|
|
18
|
+
///
|
|
19
|
+
/// [url] - The WebSocket server URL. Use it if the server URL is different from the default one taken from the AsyncAPI document.
|
|
20
|
+
${clientName}({String? url})
|
|
21
|
+
: _url = url ?? '${serverUrl}';
|
|
22
|
+
`
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function Connect({
|
|
27
|
+
title
|
|
28
|
+
}) {
|
|
29
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
30
|
+
newLines: 2,
|
|
31
|
+
indent: 2,
|
|
32
|
+
children: `/// Method to establish a WebSocket connection
|
|
33
|
+
Future<void> connect() async {
|
|
34
|
+
if (_channel != null) {
|
|
35
|
+
print('Already connected to ${title} server');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
final wsUrl = Uri.parse(_url);
|
|
40
|
+
_channel = WebSocketChannel.connect(wsUrl);
|
|
41
|
+
print('Connected to ${title} server');
|
|
42
|
+
|
|
43
|
+
/// Listen to the incoming message stream
|
|
44
|
+
_channel?.stream.listen(
|
|
45
|
+
(message) {
|
|
46
|
+
if (_messageHandlers.isNotEmpty) {
|
|
47
|
+
for (var handler in _messageHandlers) {
|
|
48
|
+
_handleMessage(message, handler);
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
print('Message received: $message');
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
onError: (error) {
|
|
55
|
+
if (_errorHandlers.isNotEmpty) {
|
|
56
|
+
for (var handler in _errorHandlers) {
|
|
57
|
+
handler(error);
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
print('WebSocket Error: $error');
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
onDone: () {
|
|
64
|
+
_channel = null;
|
|
65
|
+
print('Disconnected from ${title} server');
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
print('Connection failed: $error');
|
|
70
|
+
rethrow;
|
|
71
|
+
}
|
|
72
|
+
}`
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function RegisterErrorHandler() {
|
|
77
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
78
|
+
newLines: 2,
|
|
79
|
+
indent: 2,
|
|
80
|
+
children: `/// Method to register custom error handlers
|
|
81
|
+
void registerErrorHandler(void Function(Object) handler) {
|
|
82
|
+
_errorHandlers.add(handler);
|
|
83
|
+
}`
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function HandleMessage() {
|
|
88
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
89
|
+
newLines: 2,
|
|
90
|
+
indent: 2,
|
|
91
|
+
children: `/// Method to handle message with callback
|
|
92
|
+
void _handleMessage(dynamic message, void Function(String) cb) {
|
|
93
|
+
cb(message is String ? message : message.toString());
|
|
94
|
+
}`
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function SendEchoMessage() {
|
|
99
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
100
|
+
newLines: 2,
|
|
101
|
+
indent: 2,
|
|
102
|
+
children: `/// Method to send an echo message to the server
|
|
103
|
+
void sendEchoMessage(dynamic message) {
|
|
104
|
+
if (_channel == null) {
|
|
105
|
+
print('Error: WebSocket is not connected.');
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
final payload = message is String ? message : jsonEncode(message);
|
|
109
|
+
_channel!.sink.add(payload);
|
|
110
|
+
print('Sent message to echo server: $payload');
|
|
111
|
+
}`
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function ClientFields() {
|
|
116
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
117
|
+
indent: 2,
|
|
118
|
+
newLines: 2,
|
|
119
|
+
children: `final String _url;
|
|
120
|
+
WebSocketChannel? _channel;
|
|
121
|
+
final List<void Function(String)> _messageHandlers = [];
|
|
122
|
+
final List<void Function(Object)> _errorHandlers = [];`
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function ClientClass({
|
|
127
|
+
clientName,
|
|
128
|
+
serverUrl,
|
|
129
|
+
title
|
|
130
|
+
}) {
|
|
131
|
+
return /*#__PURE__*/jsxRuntime.jsxs(generatorReactSdk.Text, {
|
|
132
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
133
|
+
newLines: 2,
|
|
134
|
+
children: `class ${clientName} {`
|
|
135
|
+
}), /*#__PURE__*/jsxRuntime.jsx(ClientFields, {}), /*#__PURE__*/jsxRuntime.jsx(Constructor, {
|
|
136
|
+
clientName: clientName,
|
|
137
|
+
serverUrl: serverUrl
|
|
138
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Connect, {
|
|
139
|
+
title: title
|
|
140
|
+
}), /*#__PURE__*/jsxRuntime.jsx(generatorComponents.RegisterMessageHandler, {
|
|
141
|
+
language: "dart",
|
|
142
|
+
methodParams: ['void Function(String) handler']
|
|
143
|
+
}), /*#__PURE__*/jsxRuntime.jsx(RegisterErrorHandler, {}), /*#__PURE__*/jsxRuntime.jsx(HandleMessage, {}), /*#__PURE__*/jsxRuntime.jsx(SendEchoMessage, {}), /*#__PURE__*/jsxRuntime.jsx(generatorComponents.CloseConnection, {
|
|
144
|
+
language: "dart"
|
|
145
|
+
}), /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
146
|
+
children: '}'
|
|
147
|
+
})]
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function client_dart ({
|
|
152
|
+
asyncapi,
|
|
153
|
+
params
|
|
154
|
+
}) {
|
|
155
|
+
const server = generatorHelpers.getServer(asyncapi.servers(), params.server);
|
|
156
|
+
const info = generatorHelpers.getInfo(asyncapi);
|
|
157
|
+
const title = generatorHelpers.getTitle(asyncapi);
|
|
158
|
+
const clientName = generatorHelpers.getClientName(asyncapi, params.appendClientSuffix, params.customClientName);
|
|
159
|
+
const serverUrl = generatorHelpers.getServerUrl(server);
|
|
160
|
+
return (
|
|
161
|
+
/*#__PURE__*/
|
|
162
|
+
// The clientFileName default values can be found and modified under the package.json
|
|
163
|
+
jsxRuntime.jsxs(generatorReactSdk.File, {
|
|
164
|
+
name: params.clientFileName,
|
|
165
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(generatorComponents.FileHeaderInfo, {
|
|
166
|
+
info: info,
|
|
167
|
+
server: server,
|
|
168
|
+
language: "dart"
|
|
169
|
+
}), /*#__PURE__*/jsxRuntime.jsx(generatorComponents.DependencyProvider, {
|
|
170
|
+
language: "dart"
|
|
171
|
+
}), /*#__PURE__*/jsxRuntime.jsx(ClientClass, {
|
|
172
|
+
clientName: clientName,
|
|
173
|
+
serverUrl: serverUrl,
|
|
174
|
+
title: title
|
|
175
|
+
})]
|
|
176
|
+
})
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
module.exports = client_dart;
|
|
181
|
+
//# sourceMappingURL=client.dart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.dart.js","sources":["../../../../../../../../packages/templates/clients/websocket/dart/components/Constructor.js","../../../../../../../../packages/templates/clients/websocket/dart/components/Connect.js","../../../../../../../../packages/templates/clients/websocket/dart/components/RegisterErrorHandler.js","../../../../../../../../packages/templates/clients/websocket/dart/components/HandleMessage.js","../../../../../../../../packages/templates/clients/websocket/dart/components/SendEchoMessage.js","../../../../../../../../packages/templates/clients/websocket/dart/components/ClientFields.js","../../../../../../../../packages/templates/clients/websocket/dart/components/ClientClass.js","../../../../../../../../packages/templates/clients/websocket/dart/template/client.dart.js"],"sourcesContent":["import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function Constructor({ clientName, serverUrl }) {\n return (\n <Text newLines={2} indent={2}>\n {\n `\n/// Constructor to initialize the WebSocket client\n/// \n/// [url] - The WebSocket server URL. Use it if the server URL is different from the default one taken from the AsyncAPI document.\n${clientName}({String? url})\n : _url = url ?? '${serverUrl}';\n`}\n </Text>\n );\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function Connect({ title }) {\n return (\n <Text newLines={2} indent={2}>\n {`/// Method to establish a WebSocket connection\nFuture<void> connect() async {\n if (_channel != null) {\n print('Already connected to ${title} server');\n return;\n }\n try {\n final wsUrl = Uri.parse(_url);\n _channel = WebSocketChannel.connect(wsUrl);\n print('Connected to ${title} server');\n\n /// Listen to the incoming message stream\n _channel?.stream.listen(\n (message) {\n if (_messageHandlers.isNotEmpty) {\n for (var handler in _messageHandlers) {\n _handleMessage(message, handler);\n }\n } else {\n print('Message received: $message');\n }\n },\n onError: (error) {\n if (_errorHandlers.isNotEmpty) {\n for (var handler in _errorHandlers) {\n handler(error);\n }\n } else {\n print('WebSocket Error: $error');\n }\n },\n onDone: () {\n _channel = null;\n print('Disconnected from ${title} server');\n },\n );\n } catch (error) {\n print('Connection failed: $error');\n rethrow;\n }\n}`}\n </Text>\n );\n}","import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function RegisterErrorHandler() {\n return (\n <Text newLines={2} indent={2}>\n {\n `/// Method to register custom error handlers\nvoid registerErrorHandler(void Function(Object) handler) {\n _errorHandlers.add(handler);\n}`\n }\n </Text>\n );\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function HandleMessage() {\n return (\n <Text newLines={2} indent={2}>\n {\n `/// Method to handle message with callback\nvoid _handleMessage(dynamic message, void Function(String) cb) {\n cb(message is String ? message : message.toString());\n}`\n }\n </Text>\n );\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function SendEchoMessage() {\n return (\n <Text newLines={2} indent={2}>\n {\n `/// Method to send an echo message to the server\nvoid sendEchoMessage(dynamic message) {\n if (_channel == null) {\n print('Error: WebSocket is not connected.');\n return;\n }\n final payload = message is String ? message : jsonEncode(message);\n _channel!.sink.add(payload);\n print('Sent message to echo server: $payload');\n}`\n }\n </Text>\n );\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function ClientFields() {\n return (\n <Text indent={2} newLines={2}>\n {`final String _url;\nWebSocketChannel? _channel;\nfinal List<void Function(String)> _messageHandlers = [];\nfinal List<void Function(Object)> _errorHandlers = [];`}\n </Text>\n );\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\nimport { Constructor } from './Constructor';\nimport { Connect } from './Connect';\nimport { RegisterErrorHandler } from './RegisterErrorHandler';\nimport { HandleMessage } from './HandleMessage';\nimport { SendEchoMessage } from './SendEchoMessage';\nimport { CloseConnection, RegisterMessageHandler } from '@asyncapi/generator-components';\nimport { ClientFields } from './ClientFields';\n\nexport function ClientClass({ clientName, serverUrl, title }) {\n return (\n <Text>\n <Text newLines={2}>\n {`class ${clientName} {`}\n </Text>\n <ClientFields />\n <Constructor clientName={clientName} serverUrl={serverUrl} />\n <Connect title={title} />\n <RegisterMessageHandler \n language=\"dart\" \n methodParams={['void Function(String) handler']}\n />\n <RegisterErrorHandler />\n <HandleMessage />\n <SendEchoMessage />\n <CloseConnection language=\"dart\" />\n <Text>\n {'}'}\n </Text>\n </Text>\n );\n}\n","import { File } from '@asyncapi/generator-react-sdk';\nimport { getClientName, getServerUrl, getServer, getInfo, getTitle } from '@asyncapi/generator-helpers';\nimport { FileHeaderInfo, DependencyProvider } from '@asyncapi/generator-components';\nimport { ClientClass } from '../components/ClientClass';\n\nexport default function ({ asyncapi, params }) {\n const server = getServer(asyncapi.servers(), params.server);\n const info = getInfo(asyncapi);\n const title = getTitle(asyncapi);\n const clientName = getClientName(asyncapi, params.appendClientSuffix, params.customClientName);\n const serverUrl = getServerUrl(server);\n return ( \n // The clientFileName default values can be found and modified under the package.json\n <File name={params.clientFileName}>\n <FileHeaderInfo\n info={info}\n server={server}\n language=\"dart\"\n />\n <DependencyProvider language=\"dart\" />\n <ClientClass clientName={clientName} serverUrl={serverUrl} title={title} />\n </File>\n );\n}\n"],"names":["Constructor","clientName","serverUrl","_jsx","Text","newLines","indent","children","Connect","title","RegisterErrorHandler","HandleMessage","SendEchoMessage","ClientFields","ClientClass","_jsxs","RegisterMessageHandler","language","methodParams","CloseConnection","asyncapi","params","server","getServer","servers","info","getInfo","getTitle","getClientName","appendClientSuffix","customClientName","getServerUrl","File","name","clientFileName","FileHeaderInfo","DependencyProvider"],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('source-map-support/register');
|
|
4
|
+
var generatorReactSdk = require('@asyncapi/generator-react-sdk');
|
|
5
|
+
var jsxRuntime = require('/home/runner/work/generator/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js');
|
|
6
|
+
|
|
7
|
+
function pubspec_yaml () {
|
|
8
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.File, {
|
|
9
|
+
name: "pubspec.yaml",
|
|
10
|
+
children: /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
11
|
+
children: `name: wsclient
|
|
12
|
+
environment:
|
|
13
|
+
sdk: '>=3.0.0 <4.0.0'
|
|
14
|
+
dependencies:
|
|
15
|
+
web_socket_channel: ^3.0.2`
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = pubspec_yaml;
|
|
21
|
+
//# sourceMappingURL=pubspec.yaml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pubspec.yaml.js","sources":["../../../../../../../../packages/templates/clients/websocket/dart/template/pubspec.yaml.js"],"sourcesContent":["import { File, Text } from '@asyncapi/generator-react-sdk';\n\nexport default function () {\n return (\n <File name=\"pubspec.yaml\">\n <Text>\n {`name: wsclient\nenvironment:\n sdk: '>=3.0.0 <4.0.0'\ndependencies:\n web_socket_channel: ^3.0.2`\n }\n </Text>\n </File>\n );\n}\n"],"names":["_jsx","File","name","children","Text"],"mappings":";;;;;;AAEe,qBAAY,IAAA;EACzB,oBACEA,cAAA,CAACC,sBAAI,EAAA;AAACC,IAAAA,IAAI,EAAC,cAAc;IAAAC,QAAA,eACvBH,cAAA,CAACI,sBAAI,EAAA;AAAAD,MAAAA,QAAA,EACF,CAAA;AACT;AACA;AACA;AACA,4BAAA,CAAA;KAEY,CAAA;AAAC,GACH,CAAC,CAAA;AAEX;;;;"}
|
package/lib/templates/bakedInTemplates/core-template-client-websocket-dart/components/ClientClass.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Text } from '@asyncapi/generator-react-sdk';
|
|
2
|
+
import { Constructor } from './Constructor';
|
|
3
|
+
import { Connect } from './Connect';
|
|
4
|
+
import { RegisterErrorHandler } from './RegisterErrorHandler';
|
|
5
|
+
import { HandleMessage } from './HandleMessage';
|
|
6
|
+
import { SendEchoMessage } from './SendEchoMessage';
|
|
7
|
+
import { CloseConnection, RegisterMessageHandler } from '@asyncapi/generator-components';
|
|
8
|
+
import { ClientFields } from './ClientFields';
|
|
9
|
+
|
|
10
|
+
export function ClientClass({ clientName, serverUrl, title }) {
|
|
11
|
+
return (
|
|
12
|
+
<Text>
|
|
13
|
+
<Text newLines={2}>
|
|
14
|
+
{`class ${clientName} {`}
|
|
15
|
+
</Text>
|
|
16
|
+
<ClientFields />
|
|
17
|
+
<Constructor clientName={clientName} serverUrl={serverUrl} />
|
|
18
|
+
<Connect title={title} />
|
|
19
|
+
<RegisterMessageHandler
|
|
20
|
+
language="dart"
|
|
21
|
+
methodParams={['void Function(String) handler']}
|
|
22
|
+
/>
|
|
23
|
+
<RegisterErrorHandler />
|
|
24
|
+
<HandleMessage />
|
|
25
|
+
<SendEchoMessage />
|
|
26
|
+
<CloseConnection language="dart" />
|
|
27
|
+
<Text>
|
|
28
|
+
{'}'}
|
|
29
|
+
</Text>
|
|
30
|
+
</Text>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Text } from '@asyncapi/generator-react-sdk';
|
|
2
|
+
|
|
3
|
+
export function ClientFields() {
|
|
4
|
+
return (
|
|
5
|
+
<Text indent={2} newLines={2}>
|
|
6
|
+
{`final String _url;
|
|
7
|
+
WebSocketChannel? _channel;
|
|
8
|
+
final List<void Function(String)> _messageHandlers = [];
|
|
9
|
+
final List<void Function(Object)> _errorHandlers = [];`}
|
|
10
|
+
</Text>
|
|
11
|
+
);
|
|
12
|
+
}
|