-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for base64 encoded buffer properties #22
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -11,7 +11,9 @@ import { | |||||
export function <%- ex.name %>(): number { | ||||||
<% if (ex.input) { -%> | ||||||
<% if (isJsonEncoded(ex.input)) { -%> | ||||||
<% if (isPrimitive(ex.input)) { -%> | ||||||
<% if (isBuffer(ex.input)) { -%> | ||||||
const input: <%- toTypeScriptType(ex.input) %> = Host.base64ToArrayBuffer(JSON.parse(Host.inputString())) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depending on if you think it'd be confusing for folks to get the
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, i'm not sure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, both (A useful litmus test would be whether we think users expect There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's follow back up on this discussion. it feels like a broader change than just this PR. I'll file an issue. |
||||||
<% } else if (isPrimitive(ex.input)) { -%> | ||||||
const input: <%- toTypeScriptType(ex.input) %> = JSON.parse(Host.inputString()) | ||||||
<% } else { -%> | ||||||
const untypedInput = JSON.parse(Host.inputString()) | ||||||
|
@@ -38,7 +40,9 @@ export function <%- ex.name %>(): number { | |||||
|
||||||
<% if (ex.output) { -%> | ||||||
<% if (isJsonEncoded(ex.output)) { -%> | ||||||
<% if (isPrimitive(ex.output)) { -%> | ||||||
<% if (isBuffer(ex.output)) { -%> | ||||||
Host.outputString(JSON.stringify(Host.arrayBufferToBase64(output))) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto here – we can unwrap views:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Actually, I take this back – the view has a |
||||||
<% } else if (isPrimitive(ex.output)) { -%> | ||||||
Host.outputString(JSON.stringify(output)) | ||||||
<% } else { -%> | ||||||
const untypedOutput = <%- toTypeScriptType(ex.output) %>.toJson(output) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this ended up being redundant logic and i think i wrote it when i was experiencing a little brain fog