From 46132810ac5e5b0a8b9baa22903cb8a367b46f63 Mon Sep 17 00:00:00 2001 From: kpears201 Date: Wed, 29 Nov 2023 16:09:23 -0800 Subject: [PATCH] feat: Improve generated doc formatting (#155) --- languages/javascript/templates/examples/default.md | 6 ++---- .../templates/examples/polymorphic-pull-event.md | 9 ++++----- .../javascript/templates/examples/polymorphic-pull.md | 6 ++---- languages/javascript/templates/examples/setter.md | 6 ++---- languages/javascript/templates/examples/subscriber.md | 7 +++---- languages/markdown/templates/codeblocks/provider.md | 2 +- 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/languages/javascript/templates/examples/default.md b/languages/javascript/templates/examples/default.md index ecc979ba..8a407397 100644 --- a/languages/javascript/templates/examples/default.md +++ b/languages/javascript/templates/examples/default.md @@ -1,6 +1,4 @@ import { ${module} } from '${package.name}' -${module}.${method.name}(${example.params}) - .then(${method.result.name} => { - console.log(${method.result.name}) - }) \ No newline at end of file +let ${method.result.name} = await ${module}.${method.name}(${example.params}) +console.log(${method.result.name}) \ No newline at end of file diff --git a/languages/javascript/templates/examples/polymorphic-pull-event.md b/languages/javascript/templates/examples/polymorphic-pull-event.md index 7bc2baa7..5881ac08 100644 --- a/languages/javascript/templates/examples/polymorphic-pull-event.md +++ b/languages/javascript/templates/examples/polymorphic-pull-event.md @@ -1,9 +1,8 @@ import { ${module} } from '${package.name}' -${module}.${method.pulls.for}(function(parameters) { +let success = await ${module}.${method.pulls.for}(async parameters => { console.log(parameters.entityId) console.log(parameters.assetId) - return Promise.resolve(${originator.params[1].example.value}) -}).then(success => { - console.log(success) -}) \ No newline at end of file + return ${originator.params[1].example.value} +}) +console.log(success) \ No newline at end of file diff --git a/languages/javascript/templates/examples/polymorphic-pull.md b/languages/javascript/templates/examples/polymorphic-pull.md index 7c53080c..d754217d 100644 --- a/languages/javascript/templates/examples/polymorphic-pull.md +++ b/languages/javascript/templates/examples/polymorphic-pull.md @@ -1,6 +1,4 @@ import { ${module} } from '${package.name}' -${module}.${method.name}(${method.params[1].example.value}) - .then(success => { - console.log(success) - }) \ No newline at end of file +let success = await ${module}.${method.name}(${method.params[1].example.value}) +console.log(success) \ No newline at end of file diff --git a/languages/javascript/templates/examples/setter.md b/languages/javascript/templates/examples/setter.md index c258314a..85c2bcff 100644 --- a/languages/javascript/templates/examples/setter.md +++ b/languages/javascript/templates/examples/setter.md @@ -1,6 +1,4 @@ import { ${module} } from '${package.name}' -${module}.${method.setter.for}(${example.params}) - .then(${method.result.name} => { - console.log(${method.result.name}) - }) \ No newline at end of file +let ${method.result.name} = await ${module}.${method.setter.for}(${example.params}) +console.log(${method.result.name}) \ No newline at end of file diff --git a/languages/javascript/templates/examples/subscriber.md b/languages/javascript/templates/examples/subscriber.md index 99c0516f..0dd6a7a3 100644 --- a/languages/javascript/templates/examples/subscriber.md +++ b/languages/javascript/templates/examples/subscriber.md @@ -1,7 +1,6 @@ import { ${module} } from '${package.name}' -${method.alternative}(value => { +let listenerId = await ${method.alternative}(value => { console.log(value) -}).then(listenerId => { - console.log(listenerId) -}) \ No newline at end of file +}) +console.log(listenerId) \ No newline at end of file diff --git a/languages/markdown/templates/codeblocks/provider.md b/languages/markdown/templates/codeblocks/provider.md index 32823cb0..e30d3a19 100644 --- a/languages/markdown/templates/codeblocks/provider.md +++ b/languages/markdown/templates/codeblocks/provider.md @@ -23,7 +23,7 @@ import { ${info.title} } from '${package.name}' class My${provider} { ${provider.interface.start} async ${provider.interface.name}(parameters, session) { - return await Promise.resolve(${provider.interface.example.result}) + return ${provider.interface.example.result} } ${provider.interface.end} }