Files
yaak/src-tauri/vendored/plugins/template-function-encode/build/index.js
2025-05-25 20:39:14 -07:00

70 lines
2.3 KiB
JavaScript
Generated

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
plugin: () => plugin
});
module.exports = __toCommonJS(src_exports);
var plugin = {
templateFunctions: [
{
name: "base64.encode",
description: "Encode a value to base64",
args: [{ label: "Plain Text", type: "text", name: "value", multiLine: true }],
async onRender(_ctx, args) {
return Buffer.from(args.values.value ?? "").toString("base64");
}
},
{
name: "base64.decode",
description: "Decode a value from base64",
args: [{ label: "Encoded Value", type: "text", name: "value", multiLine: true }],
async onRender(_ctx, args) {
return Buffer.from(args.values.value ?? "", "base64").toString("utf-8");
}
},
{
name: "url.encode",
description: "Encode a value for use in a URL (percent-encoding)",
args: [{ label: "Plain Text", type: "text", name: "value", multiLine: true }],
async onRender(_ctx, args) {
return encodeURIComponent(args.values.value ?? "");
}
},
{
name: "url.decode",
description: "Decode a percent-encoded URL value",
args: [{ label: "Encoded Value", type: "text", name: "value", multiLine: true }],
async onRender(_ctx, args) {
try {
return decodeURIComponent(args.values.value ?? "");
} catch {
return "";
}
}
}
]
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
plugin
});