@asyncapi/generator 2.7.1 → 2.8.2
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 +44 -0
- package/docs/api.md +32 -0
- package/docs/baked-in-templates.md +100 -0
- package/docs/configuration-file.md +49 -31
- package/docs/template.md +22 -3
- package/lib/generator.js +31 -3
- package/lib/templates/BakedInTemplatesList.json +27 -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 +54 -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 +63 -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 +54 -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 +54 -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/lib/templates/bakedInTemplates.js +53 -0
- package/package.json +8 -3
- package/test/__mocks__/@npmcli/arborist.js +0 -11
- package/test/__mocks__/@npmcli/config.js +0 -3
- package/test/__mocks__/fs.extra.js +0 -3
- package/test/__mocks__/loglevel.js +0 -3
- package/test/__mocks__/resolve-from.js +0 -8
- package/test/__mocks__/resolve-pkg.js +0 -8
- package/test/__snapshots__/integration.test.js.snap +0 -419
- package/test/docs/apiwithref.json +0 -41
- package/test/docs/dummy.yml +0 -390
- package/test/docs/dummyV3.yml +0 -31
- package/test/docs/shared.json +0 -27
- package/test/docs/ws.yml +0 -36
- package/test/generator.test.js +0 -629
- package/test/hooksRegistry.test.js +0 -173
- package/test/integration.test.js +0 -203
- package/test/parser.test.js +0 -205
- package/test/renderer.test.js +0 -62
- package/test/templateConfigValidator.test.js +0 -294
- package/test/test-project/.yarncr.yml +0 -3
- package/test/test-project/README.md +0 -8
- package/test/test-project/docker-compose.yml +0 -16
- package/test/test-project/package.json +0 -24
- package/test/test-project/test-global.test.js +0 -37
- package/test/test-project/test-project.test.js +0 -102
- package/test/test-project/test-registry.test.js +0 -62
- package/test/test-project/test.sh +0 -104
- package/test/test-project/verdaccio/config.yaml +0 -22
- package/test/test-project/verdaccio/htpasswd +0 -1
- package/test/test-templates/nunjucks-template/package-lock.json +0 -4062
- package/test/test-templates/nunjucks-template/package.json +0 -21
- package/test/test-templates/nunjucks-template/template/test-file.md +0 -5
- package/test/test-templates/react-template/.ageneratorrc +0 -33
- package/test/test-templates/react-template/package.json +0 -14
- package/test/test-templates/react-template/template/conditionalFile.txt +0 -0
- package/test/test-templates/react-template/template/conditionalFolder/conditionalFile.txt +0 -0
- package/test/test-templates/react-template/template/conditionalFolder2/input.txt +0 -0
- package/test/test-templates/react-template/template/models.js +0 -6
- package/test/test-templates/react-template/template/test-file.md.js +0 -11
- package/test/utils.test.js +0 -129
|
@@ -0,0 +1,26 @@
|
|
|
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 RegisterOutgoingProcessor() {
|
|
10
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
11
|
+
newLines: 2,
|
|
12
|
+
indent: 2,
|
|
13
|
+
children: `def register_outgoing_processor(self, processor):
|
|
14
|
+
"""
|
|
15
|
+
Register a callable that processes outgoing messages automatically.
|
|
16
|
+
These processors run in sequence before each message is sent.
|
|
17
|
+
"""
|
|
18
|
+
if callable(processor):
|
|
19
|
+
self.outgoing_processors.append(processor)
|
|
20
|
+
else:
|
|
21
|
+
print("Outgoing processor must be callable")`
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.RegisterOutgoingProcessor = RegisterOutgoingProcessor;
|
|
26
|
+
//# sourceMappingURL=RegisterOutgoingProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegisterOutgoingProcessor.js","sources":["../../../../../../../../packages/templates/clients/websocket/python/components/RegisterOutgoingProcessor.js"],"sourcesContent":["import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function RegisterOutgoingProcessor() {\n return (\n <Text newLines={2} indent={2}>\n {\n `def register_outgoing_processor(self, processor):\n \"\"\"\n Register a callable that processes outgoing messages automatically.\n These processors run in sequence before each message is sent.\n \"\"\"\n if callable(processor):\n self.outgoing_processors.append(processor)\n else:\n print(\"Outgoing processor must be callable\")`\n }\n </Text>\n );\n}\n"],"names":["RegisterOutgoingProcessor","_jsx","Text","newLines","indent","children"],"mappings":";;;;;;;;AAEO,SAASA,yBAAyBA,GAAG;EAC1C,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,oDAAA,CAAA;AAAqD,GAE3C,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('source-map-support/register');
|
|
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 Requires({
|
|
10
|
+
query
|
|
11
|
+
}) {
|
|
12
|
+
const additionalDependencies = [];
|
|
13
|
+
if (query) {
|
|
14
|
+
additionalDependencies.push('import os');
|
|
15
|
+
additionalDependencies.push('from urllib.parse import urlencode');
|
|
16
|
+
}
|
|
17
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorComponents.DependencyProvider, {
|
|
18
|
+
language: "python",
|
|
19
|
+
additionalDependencies: additionalDependencies
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.Requires = Requires;
|
|
24
|
+
//# sourceMappingURL=Requires.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Requires.js","sources":["../../../../../../../../packages/templates/clients/websocket/python/components/Requires.js"],"sourcesContent":["import { DependencyProvider } from '@asyncapi/generator-components';\n\nexport function Requires({ query }) {\n const additionalDependencies = [];\n if (query) {\n additionalDependencies.push('import os');\n additionalDependencies.push('from urllib.parse import urlencode');\n }\n return (\n <DependencyProvider\n language=\"python\"\n additionalDependencies={additionalDependencies}\n />\n );\n}"],"names":["Requires","query","additionalDependencies","push","_jsx","DependencyProvider","language"],"mappings":";;;;;;;;AAEO,SAASA,QAAQA,CAAC;AAAEC,EAAAA,KAAAA;AAAM,CAAC,EAAE;EAClC,MAAMC,sBAAsB,GAAG,EAAE,CAAA;AACjC,EAAA,IAAID,KAAK,EAAE;AACTC,IAAAA,sBAAsB,CAACC,IAAI,CAAC,WAAW,CAAC,CAAA;AACxCD,IAAAA,sBAAsB,CAACC,IAAI,CAAC,oCAAoC,CAAC,CAAA;AACnE,GAAA;EACA,oBACEC,cAAA,CAACC,sCAAkB,EAAA;AACjBC,IAAAA,QAAQ,EAAC,QAAQ;AACjBJ,IAAAA,sBAAsB,EAAEA,sBAAAA;AAAuB,GAChD,CAAC,CAAA;AAEN;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 Send({
|
|
10
|
+
sendOperations
|
|
11
|
+
}) {
|
|
12
|
+
if (!sendOperations || sendOperations.length === 0) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
16
|
+
newLines: 2,
|
|
17
|
+
indent: 2,
|
|
18
|
+
children: `
|
|
19
|
+
@staticmethod
|
|
20
|
+
async def _send(message, socket):
|
|
21
|
+
"""
|
|
22
|
+
Internal helper to handle the actual sending logic.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
message (dict or str): The message to send.
|
|
26
|
+
socket (websockets.WebSocketCommonProtocol): The WebSocket to send through.
|
|
27
|
+
|
|
28
|
+
Notes:
|
|
29
|
+
If message is a dictionary, it will be automatically converted to JSON.
|
|
30
|
+
"""
|
|
31
|
+
try:
|
|
32
|
+
if isinstance(message, dict):
|
|
33
|
+
message = json.dumps(message)
|
|
34
|
+
await socket.send(message)
|
|
35
|
+
except Exception as e:
|
|
36
|
+
print("Error sending:", e)`
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.Send = Send;
|
|
41
|
+
//# sourceMappingURL=Send.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Send.js","sources":["../../../../../../../../packages/templates/clients/websocket/python/components/Send.js"],"sourcesContent":["import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function Send({ sendOperations }) {\n if (!sendOperations || sendOperations.length === 0) {\n return null;\n }\n\n return (\n <Text newLines={2} indent={2}>\n {\n `\n@staticmethod\nasync def _send(message, socket):\n \"\"\"\n Internal helper to handle the actual sending logic.\n\n Args:\n message (dict or str): The message to send.\n socket (websockets.WebSocketCommonProtocol): The WebSocket to send through.\n\n Notes:\n If message is a dictionary, it will be automatically converted to JSON.\n \"\"\"\n try:\n if isinstance(message, dict):\n message = json.dumps(message)\n await socket.send(message)\n except Exception as e:\n print(\"Error sending:\", e)`\n }\n </Text>\n );\n}\n"],"names":["Send","sendOperations","length","_jsx","Text","newLines","indent","children"],"mappings":";;;;;;;;AAEO,SAASA,IAAIA,CAAC;AAAEC,EAAAA,cAAAA;AAAe,CAAC,EAAE;EACvC,IAAI,CAACA,cAAc,IAAIA,cAAc,CAACC,MAAM,KAAK,CAAC,EAAE;AAClD,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;EAEA,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAA,CAAA;AAAmC,GAEzB,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 generatorHelpers = require('@asyncapi/generator-helpers');
|
|
8
|
+
var jsxRuntime = require('/home/runner/work/generator/generator/node_modules/react/cjs/react-jsx-runtime.production.min.js');
|
|
9
|
+
|
|
10
|
+
function SendOperation({
|
|
11
|
+
sendOperations,
|
|
12
|
+
clientName
|
|
13
|
+
}) {
|
|
14
|
+
if (!sendOperations || sendOperations.length === 0) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
18
|
+
children: sendOperations.map(operation => {
|
|
19
|
+
const methodName = generatorHelpers.toSnakeCase(operation.id());
|
|
20
|
+
const staticMethodName = `${methodName}_static`;
|
|
21
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
22
|
+
newLines: 2,
|
|
23
|
+
indent: 2,
|
|
24
|
+
children: `async def ${methodName}(self, message):
|
|
25
|
+
"""
|
|
26
|
+
Send a ${methodName} message using the WebSocket connection attached to this instance.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
message (dict or str): The message to send. Will be serialized to JSON if it's a dictionary.
|
|
30
|
+
|
|
31
|
+
Raises:
|
|
32
|
+
Exception: If sending fails or the socket is not connected.
|
|
33
|
+
"""
|
|
34
|
+
await self._send(message, self.ws_app)
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
async def ${staticMethodName}(message, socket):
|
|
38
|
+
"""
|
|
39
|
+
Send a ${methodName} message using a provided WebSocket connection, without needing an instance.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
message (dict or str): The message to send.
|
|
43
|
+
socket (websockets.WebSocketCommonProtocol): The WebSocket to send through.
|
|
44
|
+
|
|
45
|
+
Raises:
|
|
46
|
+
Exception: If sending fails or the socket is not connected.
|
|
47
|
+
"""
|
|
48
|
+
await ${clientName}._send(message, socket)
|
|
49
|
+
`
|
|
50
|
+
});
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
exports.SendOperation = SendOperation;
|
|
56
|
+
//# sourceMappingURL=SendOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SendOperation.js","sources":["../../../../../../../../packages/templates/clients/websocket/python/components/SendOperation.js"],"sourcesContent":["import { Text } from '@asyncapi/generator-react-sdk';\nimport { toSnakeCase } from '@asyncapi/generator-helpers';\n\nexport function SendOperation({ sendOperations, clientName }) {\n if (!sendOperations || sendOperations.length === 0) {\n return null;\n }\n\n return (\n <>\n {\n sendOperations.map((operation) => {\n const methodName = toSnakeCase(operation.id());\n const staticMethodName = `${methodName}_static`;\n \n return (\n <Text newLines={2} indent={2}>\n {`async def ${methodName}(self, message):\n \"\"\"\n Send a ${methodName} message using the WebSocket connection attached to this instance.\n\n Args:\n message (dict or str): The message to send. Will be serialized to JSON if it's a dictionary.\n\n Raises:\n Exception: If sending fails or the socket is not connected.\n \"\"\"\n await self._send(message, self.ws_app)\n\n@staticmethod\nasync def ${staticMethodName}(message, socket):\n \"\"\"\n Send a ${methodName} message using a provided WebSocket connection, without needing an instance.\n\n Args:\n message (dict or str): The message to send.\n socket (websockets.WebSocketCommonProtocol): The WebSocket to send through.\n\n Raises:\n Exception: If sending fails or the socket is not connected.\n \"\"\"\n await ${clientName}._send(message, socket)\n`}\n </Text>\n );\n })\n }\n </>\n );\n}"],"names":["SendOperation","sendOperations","clientName","length","_jsx","_Fragment","children","map","operation","methodName","toSnakeCase","id","staticMethodName","Text","newLines","indent"],"mappings":";;;;;;;;;AAGO,SAASA,aAAaA,CAAC;EAAEC,cAAc;AAAEC,EAAAA,UAAAA;AAAW,CAAC,EAAE;EAC5D,IAAI,CAACD,cAAc,IAAIA,cAAc,CAACE,MAAM,KAAK,CAAC,EAAE;AAClD,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;EAEA,oBACEC,cAAA,CAAAC,mBAAA,EAAA;AAAAC,IAAAA,QAAA,EAEIL,cAAc,CAACM,GAAG,CAAEC,SAAS,IAAK;MAChC,MAAMC,UAAU,GAAGC,4BAAW,CAACF,SAAS,CAACG,EAAE,EAAE,CAAC,CAAA;AAC9C,MAAA,MAAMC,gBAAgB,GAAG,CAAGH,EAAAA,UAAU,CAAS,OAAA,CAAA,CAAA;MAE/C,oBACEL,cAAA,CAACS,sBAAI,EAAA;AAACC,QAAAA,QAAQ,EAAE,CAAE;AAACC,QAAAA,MAAM,EAAE,CAAE;QAAAT,QAAA,EAC1B,aAAaG,UAAU,CAAA;AACtC;AACA,WAAA,EAAaA,UAAU,CAAA;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAA,EAAYG,gBAAgB,CAAA;AAC5B;AACA,WAAA,EAAaH,UAAU,CAAA;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAA,EAAYP,UAAU,CAAA;AACtB,CAAA;AAAC,OACiB,CAAC,CAAA;KAEV,CAAA;AAAC,GAEJ,CAAC,CAAA;AAEP;;;;"}
|
|
@@ -0,0 +1,379 @@
|
|
|
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 Requires({
|
|
10
|
+
query
|
|
11
|
+
}) {
|
|
12
|
+
const additionalDependencies = [];
|
|
13
|
+
if (query) {
|
|
14
|
+
additionalDependencies.push('import os');
|
|
15
|
+
additionalDependencies.push('from urllib.parse import urlencode');
|
|
16
|
+
}
|
|
17
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorComponents.DependencyProvider, {
|
|
18
|
+
language: "python",
|
|
19
|
+
additionalDependencies: additionalDependencies
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function QueryParamsVariables({
|
|
24
|
+
queryParams
|
|
25
|
+
}) {
|
|
26
|
+
if (!queryParams) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return queryParams.map(param => {
|
|
30
|
+
const paramName = param[0];
|
|
31
|
+
const variableDefinition = `${paramName} = ${paramName} or os.getenv("${paramName.toUpperCase()}")`;
|
|
32
|
+
const ifQueryProvided = `if ${paramName} is not None:`;
|
|
33
|
+
const assignment = `params["${paramName}"] = ${paramName}`;
|
|
34
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
35
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
36
|
+
indent: 8,
|
|
37
|
+
children: variableDefinition
|
|
38
|
+
}), /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
39
|
+
indent: 8,
|
|
40
|
+
children: ifQueryProvided
|
|
41
|
+
}), /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
42
|
+
indent: 10,
|
|
43
|
+
children: assignment
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function QueryParamsArgumentsDocs({
|
|
50
|
+
queryParams
|
|
51
|
+
}) {
|
|
52
|
+
if (!queryParams) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return queryParams.map(param => {
|
|
56
|
+
const paramName = param[0];
|
|
57
|
+
const firstLine = `${paramName} (str, optional):`;
|
|
58
|
+
const secondLine = `If provided (or if ${paramName.toUpperCase()} environment variable is set), added as ?${paramName}=… to URL`;
|
|
59
|
+
return /*#__PURE__*/jsxRuntime.jsxs(generatorReactSdk.Text, {
|
|
60
|
+
indent: 1,
|
|
61
|
+
children: [firstLine, secondLine]
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function InitSignature({
|
|
67
|
+
queryParams,
|
|
68
|
+
serverUrl
|
|
69
|
+
}) {
|
|
70
|
+
if (!queryParams) {
|
|
71
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
72
|
+
indent: 2,
|
|
73
|
+
newLines: 2,
|
|
74
|
+
children: `def __init__(self, url: str = "${serverUrl}"):`
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const queryParamsArguments = queryParams === null || queryParams === void 0 ? void 0 : queryParams.map(param => {
|
|
78
|
+
const paramName = param[0];
|
|
79
|
+
const paramDefaultValue = param[1];
|
|
80
|
+
const defaultValue = paramDefaultValue ? `"${paramDefaultValue}"` : 'None';
|
|
81
|
+
return `${paramName}: str = ${defaultValue}`;
|
|
82
|
+
}).join(', ');
|
|
83
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
84
|
+
indent: 2,
|
|
85
|
+
newLines: 2,
|
|
86
|
+
children: `def __init__(self, url: str = "${serverUrl}", ${queryParamsArguments}):`
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function Constructor({
|
|
91
|
+
serverUrl,
|
|
92
|
+
query
|
|
93
|
+
}) {
|
|
94
|
+
const queryParamsArray = query && Array.from(query.entries());
|
|
95
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
96
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(InitSignature, {
|
|
97
|
+
queryParams: queryParamsArray,
|
|
98
|
+
serverUrl: serverUrl
|
|
99
|
+
}), /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
100
|
+
indent: 2,
|
|
101
|
+
children: `
|
|
102
|
+
"""
|
|
103
|
+
Constructor to initialize the WebSocket client.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
url (str, optional): The WebSocket server URL. Use it if the server URL is
|
|
107
|
+
different from the default one taken from the AsyncAPI document.`
|
|
108
|
+
}), /*#__PURE__*/jsxRuntime.jsx(QueryParamsArgumentsDocs, {
|
|
109
|
+
queryParams: queryParamsArray
|
|
110
|
+
}), /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
111
|
+
indent: 2,
|
|
112
|
+
children: `
|
|
113
|
+
"""
|
|
114
|
+
self.ws_app = None # Instance of WebSocketApp
|
|
115
|
+
self.message_handlers = [] # Callables for incoming messages
|
|
116
|
+
self.error_handlers = [] # Callables for errors
|
|
117
|
+
self.outgoing_processors = [] # Callables to process outgoing messages
|
|
118
|
+
self._stop_event = threading.Event()
|
|
119
|
+
|
|
120
|
+
${query ? 'params = {}' : ''}`
|
|
121
|
+
}), /*#__PURE__*/jsxRuntime.jsx(QueryParamsVariables, {
|
|
122
|
+
queryParams: queryParamsArray
|
|
123
|
+
}), /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
124
|
+
newLines: 2,
|
|
125
|
+
children: `
|
|
126
|
+
${query ? 'qs = urlencode(params) if params else ""' : ''}
|
|
127
|
+
${query ? 'self.url = f"{url}{f\'?{qs}\' if qs else \'\'}"' : 'self.url = url'}`
|
|
128
|
+
})]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function Connect({
|
|
133
|
+
title
|
|
134
|
+
}) {
|
|
135
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
136
|
+
newLines: 2,
|
|
137
|
+
indent: 2,
|
|
138
|
+
children: `def on_open(self, ws):
|
|
139
|
+
print("Connected to ${title} server")
|
|
140
|
+
|
|
141
|
+
def on_message(self, ws, message):
|
|
142
|
+
self.handle_message(message)
|
|
143
|
+
|
|
144
|
+
def on_error(self, ws, error):
|
|
145
|
+
print("WebSocket Error:", error)
|
|
146
|
+
self.handle_error(error)
|
|
147
|
+
|
|
148
|
+
def on_close(self, ws, close_status_code, close_msg):
|
|
149
|
+
print("Disconnected from ${title}", close_status_code, close_msg)
|
|
150
|
+
|
|
151
|
+
def connect(self):
|
|
152
|
+
"""Establish the connection and start the run_forever loop in a background thread."""
|
|
153
|
+
ssl_opts = {"ca_certs": certifi.where()}
|
|
154
|
+
self.ws_app = websocket.WebSocketApp(
|
|
155
|
+
self.url,
|
|
156
|
+
on_open=self.on_open,
|
|
157
|
+
on_message=self.on_message,
|
|
158
|
+
on_error=self.on_error,
|
|
159
|
+
on_close=self.on_close
|
|
160
|
+
)
|
|
161
|
+
# Run the WebSocketApp's run_forever in a separate thread with multithreading enabled.
|
|
162
|
+
def run():
|
|
163
|
+
|
|
164
|
+
retry = 0
|
|
165
|
+
max_retries = 5
|
|
166
|
+
|
|
167
|
+
while not self._stop_event.is_set() and retry < max_retries:
|
|
168
|
+
try:
|
|
169
|
+
retry += 1
|
|
170
|
+
print("Starting WebSocket thread...")
|
|
171
|
+
self.ws_app.run_forever(sslopt=ssl_opts)
|
|
172
|
+
except Exception as e:
|
|
173
|
+
print(f"Exception in WebSocket thread: {e}") # Print full error details
|
|
174
|
+
|
|
175
|
+
thread = threading.Thread(target=run, daemon=True)
|
|
176
|
+
thread.start()`
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function RegisterErrorHandler() {
|
|
181
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
182
|
+
newLines: 2,
|
|
183
|
+
indent: 2,
|
|
184
|
+
children: `def register_error_handler(self, handler):
|
|
185
|
+
"""Register a callable to process errors."""
|
|
186
|
+
if callable(handler):
|
|
187
|
+
self.error_handlers.append(handler)
|
|
188
|
+
else:
|
|
189
|
+
print("Error handler must be callable")`
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function HandleMessage() {
|
|
194
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
195
|
+
newLines: 2,
|
|
196
|
+
indent: 2,
|
|
197
|
+
children: `def handle_message(self, message):
|
|
198
|
+
"""Pass the incoming message to all registered message handlers. """
|
|
199
|
+
if len(self.message_handlers) == 0:
|
|
200
|
+
print("\\033[94mReceived raw message:\\033[0m", message)
|
|
201
|
+
else:
|
|
202
|
+
for handler in self.message_handlers:
|
|
203
|
+
handler(message)`
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function SendOperation({
|
|
208
|
+
sendOperations,
|
|
209
|
+
clientName
|
|
210
|
+
}) {
|
|
211
|
+
if (!sendOperations || sendOperations.length === 0) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
215
|
+
children: sendOperations.map(operation => {
|
|
216
|
+
const methodName = generatorHelpers.toSnakeCase(operation.id());
|
|
217
|
+
const staticMethodName = `${methodName}_static`;
|
|
218
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
219
|
+
newLines: 2,
|
|
220
|
+
indent: 2,
|
|
221
|
+
children: `async def ${methodName}(self, message):
|
|
222
|
+
"""
|
|
223
|
+
Send a ${methodName} message using the WebSocket connection attached to this instance.
|
|
224
|
+
|
|
225
|
+
Args:
|
|
226
|
+
message (dict or str): The message to send. Will be serialized to JSON if it's a dictionary.
|
|
227
|
+
|
|
228
|
+
Raises:
|
|
229
|
+
Exception: If sending fails or the socket is not connected.
|
|
230
|
+
"""
|
|
231
|
+
await self._send(message, self.ws_app)
|
|
232
|
+
|
|
233
|
+
@staticmethod
|
|
234
|
+
async def ${staticMethodName}(message, socket):
|
|
235
|
+
"""
|
|
236
|
+
Send a ${methodName} message using a provided WebSocket connection, without needing an instance.
|
|
237
|
+
|
|
238
|
+
Args:
|
|
239
|
+
message (dict or str): The message to send.
|
|
240
|
+
socket (websockets.WebSocketCommonProtocol): The WebSocket to send through.
|
|
241
|
+
|
|
242
|
+
Raises:
|
|
243
|
+
Exception: If sending fails or the socket is not connected.
|
|
244
|
+
"""
|
|
245
|
+
await ${clientName}._send(message, socket)
|
|
246
|
+
`
|
|
247
|
+
});
|
|
248
|
+
})
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function Send({
|
|
253
|
+
sendOperations
|
|
254
|
+
}) {
|
|
255
|
+
if (!sendOperations || sendOperations.length === 0) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
259
|
+
newLines: 2,
|
|
260
|
+
indent: 2,
|
|
261
|
+
children: `
|
|
262
|
+
@staticmethod
|
|
263
|
+
async def _send(message, socket):
|
|
264
|
+
"""
|
|
265
|
+
Internal helper to handle the actual sending logic.
|
|
266
|
+
|
|
267
|
+
Args:
|
|
268
|
+
message (dict or str): The message to send.
|
|
269
|
+
socket (websockets.WebSocketCommonProtocol): The WebSocket to send through.
|
|
270
|
+
|
|
271
|
+
Notes:
|
|
272
|
+
If message is a dictionary, it will be automatically converted to JSON.
|
|
273
|
+
"""
|
|
274
|
+
try:
|
|
275
|
+
if isinstance(message, dict):
|
|
276
|
+
message = json.dumps(message)
|
|
277
|
+
await socket.send(message)
|
|
278
|
+
except Exception as e:
|
|
279
|
+
print("Error sending:", e)`
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function RegisterOutgoingProcessor() {
|
|
284
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
285
|
+
newLines: 2,
|
|
286
|
+
indent: 2,
|
|
287
|
+
children: `def register_outgoing_processor(self, processor):
|
|
288
|
+
"""
|
|
289
|
+
Register a callable that processes outgoing messages automatically.
|
|
290
|
+
These processors run in sequence before each message is sent.
|
|
291
|
+
"""
|
|
292
|
+
if callable(processor):
|
|
293
|
+
self.outgoing_processors.append(processor)
|
|
294
|
+
else:
|
|
295
|
+
print("Outgoing processor must be callable")`
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function HandleError() {
|
|
300
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
301
|
+
newLines: 2,
|
|
302
|
+
indent: 2,
|
|
303
|
+
children: `def handle_error(self, error):
|
|
304
|
+
"""Pass the error to all registered error handlers. Generic log message is printed if no handlers are registered."""
|
|
305
|
+
if len(self.error_handlers) == 0:
|
|
306
|
+
print("\\033[91mError occurred:\\033[0m", error)
|
|
307
|
+
else:
|
|
308
|
+
# Call custom error handlers
|
|
309
|
+
for handler in self.error_handlers:
|
|
310
|
+
handler(error)`
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function ClientClass({
|
|
315
|
+
asyncapi,
|
|
316
|
+
params
|
|
317
|
+
}) {
|
|
318
|
+
const server = generatorHelpers.getServer(asyncapi.servers(), params.server);
|
|
319
|
+
const title = generatorHelpers.getTitle(asyncapi);
|
|
320
|
+
const queryParams = generatorHelpers.getQueryParams(asyncapi.channels());
|
|
321
|
+
const clientName = generatorHelpers.getClientName(asyncapi, params.appendClientSuffix, params.customClientName);
|
|
322
|
+
const serverUrl = generatorHelpers.getServerUrl(server);
|
|
323
|
+
const operations = asyncapi.operations();
|
|
324
|
+
const sendOperations = operations.filterBySend();
|
|
325
|
+
return /*#__PURE__*/jsxRuntime.jsxs(generatorReactSdk.Text, {
|
|
326
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
327
|
+
newLines: 2,
|
|
328
|
+
children: `class ${clientName}:`
|
|
329
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Constructor, {
|
|
330
|
+
serverUrl: serverUrl,
|
|
331
|
+
query: queryParams
|
|
332
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Connect, {
|
|
333
|
+
title: title
|
|
334
|
+
}), /*#__PURE__*/jsxRuntime.jsx(generatorComponents.RegisterMessageHandler, {
|
|
335
|
+
language: "python",
|
|
336
|
+
methodName: "register_message_handler",
|
|
337
|
+
methodParams: ['self', 'handler'],
|
|
338
|
+
preExecutionCode: "\"\"\"Register a callable to process incoming messages.\"\"\""
|
|
339
|
+
}), /*#__PURE__*/jsxRuntime.jsx(RegisterErrorHandler, {}), /*#__PURE__*/jsxRuntime.jsx(RegisterOutgoingProcessor, {}), /*#__PURE__*/jsxRuntime.jsx(HandleMessage, {}), /*#__PURE__*/jsxRuntime.jsx(HandleError, {}), /*#__PURE__*/jsxRuntime.jsx(SendOperation, {
|
|
340
|
+
sendOperations: sendOperations,
|
|
341
|
+
clientName: clientName
|
|
342
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Send, {
|
|
343
|
+
sendOperations: sendOperations
|
|
344
|
+
}), /*#__PURE__*/jsxRuntime.jsx(generatorComponents.CloseConnection, {
|
|
345
|
+
language: "python",
|
|
346
|
+
methodParams: ['self'],
|
|
347
|
+
preExecutionCode: "\"\"\"Cleanly close the WebSocket connection.\"\"\""
|
|
348
|
+
})]
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function client_py ({
|
|
353
|
+
asyncapi,
|
|
354
|
+
params
|
|
355
|
+
}) {
|
|
356
|
+
const server = generatorHelpers.getServer(asyncapi.servers(), params.server);
|
|
357
|
+
const info = generatorHelpers.getInfo(asyncapi);
|
|
358
|
+
const queryParams = generatorHelpers.getQueryParams(asyncapi.channels());
|
|
359
|
+
return (
|
|
360
|
+
/*#__PURE__*/
|
|
361
|
+
// The clientFileName default values can be found and modified under the .ageneratorrc
|
|
362
|
+
jsxRuntime.jsxs(generatorReactSdk.File, {
|
|
363
|
+
name: params.clientFileName,
|
|
364
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(generatorComponents.FileHeaderInfo, {
|
|
365
|
+
info: info,
|
|
366
|
+
server: server,
|
|
367
|
+
language: "python"
|
|
368
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Requires, {
|
|
369
|
+
query: queryParams
|
|
370
|
+
}), /*#__PURE__*/jsxRuntime.jsx(ClientClass, {
|
|
371
|
+
asyncapi: asyncapi,
|
|
372
|
+
params: params
|
|
373
|
+
})]
|
|
374
|
+
})
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
module.exports = client_py;
|
|
379
|
+
//# sourceMappingURL=client.py.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.py.js","sources":["../../../../../../../../packages/templates/clients/websocket/python/components/Requires.js","../../../../../../../../packages/templates/clients/websocket/python/components/QueryParamsVariables.js","../../../../../../../../packages/templates/clients/websocket/python/components/QueryParamsArgumentsDocs.js","../../../../../../../../packages/templates/clients/websocket/python/components/InitSignature.js","../../../../../../../../packages/templates/clients/websocket/python/components/Constructor.js","../../../../../../../../packages/templates/clients/websocket/python/components/Connect.js","../../../../../../../../packages/templates/clients/websocket/python/components/RegisterErrorHandler.js","../../../../../../../../packages/templates/clients/websocket/python/components/HandleMessage.js","../../../../../../../../packages/templates/clients/websocket/python/components/SendOperation.js","../../../../../../../../packages/templates/clients/websocket/python/components/Send.js","../../../../../../../../packages/templates/clients/websocket/python/components/RegisterOutgoingProcessor.js","../../../../../../../../packages/templates/clients/websocket/python/components/HandleError.js","../../../../../../../../packages/templates/clients/websocket/python/components/ClientClass.js","../../../../../../../../packages/templates/clients/websocket/python/template/client.py.js"],"sourcesContent":["import { DependencyProvider } from '@asyncapi/generator-components';\n\nexport function Requires({ query }) {\n const additionalDependencies = [];\n if (query) {\n additionalDependencies.push('import os');\n additionalDependencies.push('from urllib.parse import urlencode');\n }\n return (\n <DependencyProvider\n language=\"python\"\n additionalDependencies={additionalDependencies}\n />\n );\n}","import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function QueryParamsVariables({ queryParams }) {\n if (!queryParams) {\n return null;\n }\n\n return queryParams.map((param) => {\n const paramName = param[0];\n const variableDefinition = `${paramName} = ${paramName} or os.getenv(\"${paramName.toUpperCase()}\")`;\n const ifQueryProvided = `if ${paramName} is not None:`;\n const assignment = `params[\"${paramName}\"] = ${paramName}`;\n return (\n <>\n <Text indent={8}>\n {variableDefinition}\n </Text>\n <Text indent={8}>\n {ifQueryProvided}\n </Text>\n <Text indent={10}>\n {assignment}\n </Text>\n </>\n );\n });\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function QueryParamsArgumentsDocs({ queryParams }) {\n if (!queryParams) {\n return null;\n }\n\n return queryParams.map((param) => {\n const paramName = param[0];\n const firstLine = `${paramName} (str, optional):`;\n const secondLine = `If provided (or if ${paramName.toUpperCase()} environment variable is set), added as ?${paramName}=… to URL`;\n return (\n <Text indent={1}>\n {firstLine}\n {secondLine}\n </Text>\n );\n });\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function InitSignature({ queryParams, serverUrl }) {\n if (!queryParams) {\n return (\n <Text indent={2} newLines={2}>\n {`def __init__(self, url: str = \"${serverUrl}\"):`}\n </Text>\n );\n }\n \n const queryParamsArguments = queryParams?.map((param) => {\n const paramName = param[0];\n const paramDefaultValue = param[1];\n const defaultValue = paramDefaultValue ? `\"${paramDefaultValue}\"` : 'None';\n return `${paramName}: str = ${defaultValue}`;\n }).join(', ');\n \n return (\n <Text indent={2} newLines={2}>\n {`def __init__(self, url: str = \"${serverUrl}\", ${queryParamsArguments}):`}\n </Text>\n );\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\nimport { QueryParamsVariables } from './QueryParamsVariables';\nimport { QueryParamsArgumentsDocs } from './QueryParamsArgumentsDocs';\nimport { InitSignature } from './InitSignature';\n\nexport function Constructor({ serverUrl, query}) {\n const queryParamsArray = query && Array.from(query.entries());\n \n return (\n <>\n <InitSignature queryParams={queryParamsArray} serverUrl={serverUrl} />\n <Text indent={2}>\n {`\n \"\"\"\n Constructor to initialize the WebSocket client.\n\n Args:\n url (str, optional): The WebSocket server URL. Use it if the server URL is \n different from the default one taken from the AsyncAPI document.`}\n </Text>\n <QueryParamsArgumentsDocs queryParams={queryParamsArray} />\n <Text indent={2}>\n {`\n \"\"\"\n self.ws_app = None # Instance of WebSocketApp\n self.message_handlers = [] # Callables for incoming messages\n self.error_handlers = [] # Callables for errors\n self.outgoing_processors = [] # Callables to process outgoing messages\n self._stop_event = threading.Event()\n \n ${ query ? 'params = {}' : ''}`\n }\n </Text>\n <QueryParamsVariables queryParams={queryParamsArray} />\n <Text newLines={2}>\n {`\n ${query ? 'qs = urlencode(params) if params else \"\"' : ''}\n ${query ? 'self.url = f\"{url}{f\\'?{qs}\\' if qs else \\'\\'}\"' : 'self.url = url'}`}\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 {\n `def on_open(self, ws):\n print(\"Connected to ${title} server\")\n\ndef on_message(self, ws, message):\n self.handle_message(message)\n\ndef on_error(self, ws, error):\n print(\"WebSocket Error:\", error)\n self.handle_error(error)\n\ndef on_close(self, ws, close_status_code, close_msg):\n print(\"Disconnected from ${title}\", close_status_code, close_msg)\n\ndef connect(self):\n \"\"\"Establish the connection and start the run_forever loop in a background thread.\"\"\"\n ssl_opts = {\"ca_certs\": certifi.where()}\n self.ws_app = websocket.WebSocketApp(\n self.url,\n on_open=self.on_open,\n on_message=self.on_message,\n on_error=self.on_error,\n on_close=self.on_close\n )\n # Run the WebSocketApp's run_forever in a separate thread with multithreading enabled.\n def run():\n\n retry = 0\n max_retries = 5\n \n while not self._stop_event.is_set() and retry < max_retries:\n try:\n retry += 1\n print(\"Starting WebSocket thread...\")\n self.ws_app.run_forever(sslopt=ssl_opts)\n except Exception as e:\n print(f\"Exception in WebSocket thread: {e}\") # Print full error details\n\n thread = threading.Thread(target=run, daemon=True)\n thread.start()`\n }\n </Text>\n );\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function RegisterErrorHandler() {\n return (\n <Text newLines={2} indent={2}>\n {\n `def register_error_handler(self, handler):\n \"\"\"Register a callable to process errors.\"\"\"\n if callable(handler):\n self.error_handlers.append(handler)\n else:\n print(\"Error handler must be callable\")`\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 `def handle_message(self, message):\n \"\"\"Pass the incoming message to all registered message handlers. \"\"\"\n if len(self.message_handlers) == 0:\n print(\"\\\\033[94mReceived raw message:\\\\033[0m\", message)\n else:\n for handler in self.message_handlers:\n handler(message)`\n }\n </Text>\n );\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\nimport { toSnakeCase } from '@asyncapi/generator-helpers';\n\nexport function SendOperation({ sendOperations, clientName }) {\n if (!sendOperations || sendOperations.length === 0) {\n return null;\n }\n\n return (\n <>\n {\n sendOperations.map((operation) => {\n const methodName = toSnakeCase(operation.id());\n const staticMethodName = `${methodName}_static`;\n \n return (\n <Text newLines={2} indent={2}>\n {`async def ${methodName}(self, message):\n \"\"\"\n Send a ${methodName} message using the WebSocket connection attached to this instance.\n\n Args:\n message (dict or str): The message to send. Will be serialized to JSON if it's a dictionary.\n\n Raises:\n Exception: If sending fails or the socket is not connected.\n \"\"\"\n await self._send(message, self.ws_app)\n\n@staticmethod\nasync def ${staticMethodName}(message, socket):\n \"\"\"\n Send a ${methodName} message using a provided WebSocket connection, without needing an instance.\n\n Args:\n message (dict or str): The message to send.\n socket (websockets.WebSocketCommonProtocol): The WebSocket to send through.\n\n Raises:\n Exception: If sending fails or the socket is not connected.\n \"\"\"\n await ${clientName}._send(message, socket)\n`}\n </Text>\n );\n })\n }\n </>\n );\n}","import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function Send({ sendOperations }) {\n if (!sendOperations || sendOperations.length === 0) {\n return null;\n }\n\n return (\n <Text newLines={2} indent={2}>\n {\n `\n@staticmethod\nasync def _send(message, socket):\n \"\"\"\n Internal helper to handle the actual sending logic.\n\n Args:\n message (dict or str): The message to send.\n socket (websockets.WebSocketCommonProtocol): The WebSocket to send through.\n\n Notes:\n If message is a dictionary, it will be automatically converted to JSON.\n \"\"\"\n try:\n if isinstance(message, dict):\n message = json.dumps(message)\n await socket.send(message)\n except Exception as e:\n print(\"Error sending:\", e)`\n }\n </Text>\n );\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function RegisterOutgoingProcessor() {\n return (\n <Text newLines={2} indent={2}>\n {\n `def register_outgoing_processor(self, processor):\n \"\"\"\n Register a callable that processes outgoing messages automatically.\n These processors run in sequence before each message is sent.\n \"\"\"\n if callable(processor):\n self.outgoing_processors.append(processor)\n else:\n print(\"Outgoing processor must be callable\")`\n }\n </Text>\n );\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\n\nexport function HandleError() {\n return (\n <Text newLines={2} indent={2}>\n {\n `def handle_error(self, error):\n \"\"\"Pass the error to all registered error handlers. Generic log message is printed if no handlers are registered.\"\"\"\n if len(self.error_handlers) == 0:\n print(\"\\\\033[91mError occurred:\\\\033[0m\", error)\n else:\n # Call custom error handlers\n for handler in self.error_handlers:\n handler(error)`\n }\n </Text>\n );\n}\n","import { Text } from '@asyncapi/generator-react-sdk';\nimport { getClientName, getServerUrl, getServer, getQueryParams, getTitle } from '@asyncapi/generator-helpers';\nimport { Constructor } from './Constructor';\nimport { Connect } from './Connect';\nimport { RegisterErrorHandler } from './RegisterErrorHandler';\nimport { HandleMessage } from './HandleMessage';\nimport { SendOperation } from './SendOperation';\nimport { Send } from './Send';\nimport { CloseConnection, RegisterMessageHandler } from '@asyncapi/generator-components';\nimport { RegisterOutgoingProcessor } from './RegisterOutgoingProcessor';\nimport { HandleError } from './HandleError';\n\nexport function ClientClass({ asyncapi, params }) {\n const server = getServer(asyncapi.servers(), params.server);\n const title = getTitle(asyncapi);\n const queryParams = getQueryParams(asyncapi.channels());\n const clientName = getClientName(asyncapi, params.appendClientSuffix, params.customClientName);\n const serverUrl = getServerUrl(server);\n const operations = asyncapi.operations();\n const sendOperations = operations.filterBySend();\n return (\n <Text>\n <Text newLines={2}>\n {`class ${clientName}:`}\n </Text>\n <Constructor serverUrl={serverUrl} query={queryParams} />\n <Connect title={title} />\n <RegisterMessageHandler\n language=\"python\"\n methodName='register_message_handler'\n methodParams={['self', 'handler']}\n preExecutionCode='\"\"\"Register a callable to process incoming messages.\"\"\"'\n />\n <RegisterErrorHandler />\n <RegisterOutgoingProcessor />\n <HandleMessage />\n <HandleError />\n <SendOperation sendOperations={sendOperations} clientName={clientName} />\n <Send sendOperations={sendOperations} />\n <CloseConnection \n language=\"python\" \n methodParams={['self']}\n preExecutionCode='\"\"\"Cleanly close the WebSocket connection.\"\"\"'\n />\n </Text>\n );\n}\n","import { File } from '@asyncapi/generator-react-sdk';\nimport { getServer, getQueryParams, getInfo } from '@asyncapi/generator-helpers';\nimport { FileHeaderInfo } from '@asyncapi/generator-components';\nimport { Requires } from '../components/Requires';\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 queryParams = getQueryParams(asyncapi.channels());\n return (\n // The clientFileName default values can be found and modified under the .ageneratorrc\n <File name={params.clientFileName}>\n <FileHeaderInfo\n info={info}\n server={server}\n language=\"python\"\n />\n <Requires query={queryParams} />\n <ClientClass asyncapi={asyncapi} params={params} />\n </File>\n );\n}\n"],"names":["Requires","query","additionalDependencies","push","_jsx","DependencyProvider","language","QueryParamsVariables","queryParams","map","param","paramName","variableDefinition","toUpperCase","ifQueryProvided","assignment","_jsxs","_Fragment","children","Text","indent","QueryParamsArgumentsDocs","firstLine","secondLine","InitSignature","serverUrl","newLines","queryParamsArguments","paramDefaultValue","defaultValue","join","Constructor","queryParamsArray","Array","from","entries","Connect","title","RegisterErrorHandler","HandleMessage","SendOperation","sendOperations","clientName","length","operation","methodName","toSnakeCase","id","staticMethodName","Send","RegisterOutgoingProcessor","HandleError","ClientClass","asyncapi","params","server","getServer","servers","getTitle","getQueryParams","channels","getClientName","appendClientSuffix","customClientName","getServerUrl","operations","filterBySend","RegisterMessageHandler","methodParams","preExecutionCode","CloseConnection","info","getInfo","File","name","clientFileName","FileHeaderInfo"],"mappings":";;;;;;;;AAEO,SAASA,QAAQA,CAAC;AAAEC,EAAAA,KAAAA;AAAM,CAAC,EAAE;EAClC,MAAMC,sBAAsB,GAAG,EAAE,CAAA;AACjC,EAAA,IAAID,KAAK,EAAE;AACTC,IAAAA,sBAAsB,CAACC,IAAI,CAAC,WAAW,CAAC,CAAA;AACxCD,IAAAA,sBAAsB,CAACC,IAAI,CAAC,oCAAoC,CAAC,CAAA;AACnE,GAAA;EACA,oBACEC,cAAA,CAACC,sCAAkB,EAAA;AACjBC,IAAAA,QAAQ,EAAC,QAAQ;AACjBJ,IAAAA,sBAAsB,EAAEA,sBAAAA;AAAuB,GAChD,CAAC,CAAA;AAEN;;ACZO,SAASK,oBAA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xCe,kBAAU,EAAA;EAAEhB,QAAQ;AAAEC,EAAAA,MAAAA;AAAO,CAAC,EAAE;AAC7C,EAAA,MAAMC,MAAM,GAAGC,0BAAS,CAACH,QAAQ,CAACI,OAAO,EAAE,EAAEH,MAAM,CAACC,MAAM,CAAC,CAAA;AAC3D,EAAA,MAAMgB,IAAI,GAAGC,wBAAO,CAACnB,QAAQ,CAAC,CAAA;EAC9B,MAAM7C,WAAW,GAAGmD,+BAAc,CAACN,QAAQ,CAACO,QAAQ,EAAE,CAAC,CAAA;AACvD,EAAA;AAAA;AACE;AACA5C,IAAAA,eAAA,CAACyD,sBAAI,EAAA;MAACC,IAAI,EAAEpB,MAAM,CAACqB,cAAe;MAAAzD,QAAA,EAAA,cAChCd,cAAA,CAACwE,kCAAc,EAAA;AACbL,QAAAA,IAAI,EAAEA,IAAK;AACXhB,QAAAA,MAAM,EAAEA,MAAO;AACfjD,QAAAA,QAAQ,EAAC,QAAA;AAAQ,OAClB,CAAC,eACFF,cAAA,CAACJ,QAAQ,EAAA;AAACC,QAAAA,KAAK,EAAEO,WAAAA;AAAY,OAAE,CAAC,eAChCJ,cAAA,CAACgD,WAAW,EAAA;AAACC,QAAAA,QAAQ,EAAEA,QAAS;AAACC,QAAAA,MAAM,EAAEA,MAAAA;AAAO,OAAE,CAAC,CAAA;KAC/C,CAAA;AAAC,IAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('source-map-support/register');
|
|
4
|
+
var generatorComponents = require('@asyncapi/generator-components');
|
|
5
|
+
|
|
6
|
+
async function models ({
|
|
7
|
+
asyncapi
|
|
8
|
+
}) {
|
|
9
|
+
return await generatorComponents.Models({
|
|
10
|
+
asyncapi
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = models;
|
|
15
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sources":["../../../../../../../../packages/templates/clients/websocket/python/template/models.js"],"sourcesContent":["import { Models } from '@asyncapi/generator-components';\n\nexport default async function({ asyncapi }) {\n return await Models({ asyncapi });\n}"],"names":["asyncapi","Models"],"mappings":";;;;;AAEe,qBAAe,EAAA;AAAEA,EAAAA,QAAAA;AAAS,CAAC,EAAE;EAC1C,OAAO,MAAMC,0BAAM,CAAC;AAAED,IAAAA,QAAAA;AAAS,GAAC,CAAC,CAAA;AACnC;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 requirements_txt () {
|
|
8
|
+
return /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.File, {
|
|
9
|
+
name: "requirements.txt",
|
|
10
|
+
children: /*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, {
|
|
11
|
+
children: `websocket-client==1.8.0
|
|
12
|
+
certifi==2025.1.31
|
|
13
|
+
requests==2.32.3`
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports = requirements_txt;
|
|
19
|
+
//# sourceMappingURL=requirements.txt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requirements.txt.js","sources":["../../../../../../../../packages/templates/clients/websocket/python/template/requirements.txt.js"],"sourcesContent":["import { File, Text } from '@asyncapi/generator-react-sdk';\n\nexport default function () {\n return (\n <File name=\"requirements.txt\">\n <Text>\n {`websocket-client==1.8.0\ncertifi==2025.1.31\nrequests==2.32.3`}\n </Text>\n </File>\n );\n}\n"],"names":["_jsx","File","name","children","Text"],"mappings":";;;;;;AAEe,yBAAY,IAAA;EACzB,oBACEA,cAAA,CAACC,sBAAI,EAAA;AAACC,IAAAA,IAAI,EAAC,kBAAkB;IAAAC,QAAA,eAC3BH,cAAA,CAACI,sBAAI,EAAA;AAAAD,MAAAA,QAAA,EACF,CAAA;AACT;AACA,gBAAA,CAAA;KACY,CAAA;AAAC,GACH,CAAC,CAAA;AAEX;;;;"}
|