gRPC request actions and "copy as gRPCurl" (#232)

This commit is contained in:
Gregory Schier
2025-07-05 15:40:41 -07:00
committed by GitHub
parent ad4d6d9720
commit 19ffcd18a6
59 changed files with 1490 additions and 320 deletions

View File

@@ -1,4 +1,4 @@
import { CallTemplateFunctionArgs, Context, PluginDefinition } from '@yaakapp/api';
import type { CallTemplateFunctionArgs, Context, PluginDefinition } from '@yaakapp/api';
export const plugin: PluginDefinition = {
templateFunctions: [
@@ -7,7 +7,7 @@ export const plugin: PluginDefinition = {
description: 'Encode a value to base64',
args: [{ label: 'Plain Text', type: 'text', name: 'value', multiLine: true }],
async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null> {
return Buffer.from(args.values.value ?? '').toString('base64');
return Buffer.from(String(args.values.value ?? '')).toString('base64');
},
},
{
@@ -15,7 +15,7 @@ export const plugin: PluginDefinition = {
description: 'Decode a value from base64',
args: [{ label: 'Encoded Value', type: 'text', name: 'value', multiLine: true }],
async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null> {
return Buffer.from(args.values.value ?? '', 'base64').toString('utf-8');
return Buffer.from(String(args.values.value ?? ''), 'base64').toString('utf-8');
},
},
{
@@ -23,7 +23,7 @@ export const plugin: PluginDefinition = {
description: 'Encode a value for use in a URL (percent-encoding)',
args: [{ label: 'Plain Text', type: 'text', name: 'value', multiLine: true }],
async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null> {
return encodeURIComponent(args.values.value ?? '');
return encodeURIComponent(String(args.values.value ?? ''));
},
},
{
@@ -32,7 +32,7 @@ export const plugin: PluginDefinition = {
args: [{ label: 'Encoded Value', type: 'text', name: 'value', multiLine: true }],
async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null> {
try {
return decodeURIComponent(args.values.value ?? '');
return decodeURIComponent(String(args.values.value ?? ''));
} catch {
return '';
}