From e77a9e5d447d7f2105abf8fd62896077bbe2c36f Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 15 Oct 2024 07:48:26 -0700 Subject: [PATCH] Rebuild plugins --- src-tauri/tauri.conf.json | 2 +- .../plugins/importer-curl/build/index.js | 6 +- .../template-function-fs/build/index.js | 55 +++++++++++++++++++ .../plugins/template-function-fs/package.json | 9 +++ .../template-function-hash/build/index.js | 1 + .../template-function-prompt/build/index.js | 9 +-- .../template-function-response/build/index.js | 30 ++++++++++ 7 files changed, 103 insertions(+), 9 deletions(-) create mode 100644 src-tauri/vendored/plugins/template-function-fs/build/index.js create mode 100644 src-tauri/vendored/plugins/template-function-fs/package.json diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index f3208d23..08611ece 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -76,7 +76,7 @@ "developmentTeam": "7PU3P6ELJ8" }, "macOS": { - "minimumSystemVersion": "13.0", + "minimumSystemVersion": "15.0", "exceptionDomain": "", "entitlements": "macos/entitlements.plist", "frameworks": [] diff --git a/src-tauri/vendored/plugins/importer-curl/build/index.js b/src-tauri/vendored/plugins/importer-curl/build/index.js index 2586b29c..7241e951 100644 --- a/src-tauri/vendored/plugins/importer-curl/build/index.js +++ b/src-tauri/vendored/plugins/importer-curl/build/index.js @@ -288,7 +288,8 @@ var SUPPORTED_ARGS = [ // Request method DATA_FLAGS ].flatMap((v) => v); -function pluginHookImport(ctx, rawData) { +var BOOL_FLAGS = ["G", "get", "digest"]; +function pluginHookImport(_ctx, rawData) { if (!rawData.match(/^\s*curl /)) { return null; } @@ -359,10 +360,11 @@ function importCommand(parseEntries, workspaceId) { } let value; const nextEntry = parseEntries[i + 1]; + const hasValue = !BOOL_FLAGS.includes(name); if (isSingleDash && name.length > 1) { value = name.slice(1); name = name.slice(0, 1); - } else if (typeof nextEntry === "string" && !nextEntry.startsWith("-")) { + } else if (typeof nextEntry === "string" && hasValue && !nextEntry.startsWith("-")) { value = nextEntry; i++; } else { diff --git a/src-tauri/vendored/plugins/template-function-fs/build/index.js b/src-tauri/vendored/plugins/template-function-fs/build/index.js new file mode 100644 index 00000000..888e184b --- /dev/null +++ b/src-tauri/vendored/plugins/template-function-fs/build/index.js @@ -0,0 +1,55 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +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 import_node_fs = __toESM(require("node:fs")); +var plugin = { + templateFunctions: [{ + name: "fs.readFile", + description: "Read the contents of a file as utf-8", + args: [{ title: "Select File", type: "file", name: "path", label: "File" }], + async onRender(_ctx, args) { + if (!args.values.path) return null; + try { + return import_node_fs.default.promises.readFile(args.values.path, "utf-8"); + } catch (err) { + return null; + } + } + }] +}; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + plugin +}); diff --git a/src-tauri/vendored/plugins/template-function-fs/package.json b/src-tauri/vendored/plugins/template-function-fs/package.json new file mode 100644 index 00000000..44e59600 --- /dev/null +++ b/src-tauri/vendored/plugins/template-function-fs/package.json @@ -0,0 +1,9 @@ +{ + "name": "@yaakapp/template-function-fs", + "private": true, + "version": "0.0.1", + "scripts": { + "build": "yaakcli build ./src/index.ts", + "dev": "yaakcli dev ./src/index.js" + } +} diff --git a/src-tauri/vendored/plugins/template-function-hash/build/index.js b/src-tauri/vendored/plugins/template-function-hash/build/index.js index 5e222f6d..7fe4f9af 100644 --- a/src-tauri/vendored/plugins/template-function-hash/build/index.js +++ b/src-tauri/vendored/plugins/template-function-hash/build/index.js @@ -28,6 +28,7 @@ var algorithms = ["md5", "sha1", "sha256", "sha512"]; var plugin = { templateFunctions: algorithms.map((algorithm) => ({ name: `hash.${algorithm}`, + description: "Hash a value to its hexidecimal representation", args: [ { name: "input", diff --git a/src-tauri/vendored/plugins/template-function-prompt/build/index.js b/src-tauri/vendored/plugins/template-function-prompt/build/index.js index 26e833b0..abc91cd9 100644 --- a/src-tauri/vendored/plugins/template-function-prompt/build/index.js +++ b/src-tauri/vendored/plugins/template-function-prompt/build/index.js @@ -26,24 +26,21 @@ module.exports = __toCommonJS(src_exports); var plugin = { templateFunctions: [{ name: "prompt.text", + description: "Prompt the user for input when sending a request", args: [ { type: "text", name: "title", label: "Title" }, - { type: "text", name: "label", label: "Label", optional: true }, { type: "text", name: "defaultValue", label: "Default Value", optional: true }, { type: "text", name: "placeholder", label: "Placeholder", optional: true } ], async onRender(ctx, args) { - console.log("PROMPT", args); if (args.purpose !== "send") return null; - const value = await ctx.prompt.text({ + return await ctx.prompt.text({ id: `prompt-${args.values.label}`, - label: args.values.label ?? "", + label: args.values.title ?? "", title: args.values.title ?? "", defaultValue: args.values.defaultValue, placeholder: args.values.placeholder }); - console.log("VALUE", value); - return value; } }] }; diff --git a/src-tauri/vendored/plugins/template-function-response/build/index.js b/src-tauri/vendored/plugins/template-function-response/build/index.js index 2dec37e4..a0664c82 100644 --- a/src-tauri/vendored/plugins/template-function-response/build/index.js +++ b/src-tauri/vendored/plugins/template-function-response/build/index.js @@ -8837,6 +8837,7 @@ var plugin = { templateFunctions: [ { name: "response.header", + description: "Read the value of a response header, by name", args: [ requestArg, { @@ -8863,6 +8864,7 @@ var plugin = { }, { name: "response.body.path", + description: "Access a field of the response body using JsonPath or XPath", aliases: ["response"], args: [ requestArg, @@ -8901,6 +8903,34 @@ var plugin = { } return null; } + }, + { + name: "response.body.raw", + description: "Access the entire response body, as text", + aliases: ["response"], + args: [ + requestArg, + behaviorArg + ], + async onRender(ctx, args) { + if (!args.values.request) return null; + const response = await getResponse(ctx, { + requestId: args.values.request, + purpose: args.purpose, + behavior: args.values.behavior ?? null + }); + if (response == null) return null; + if (response.bodyPath == null) { + return null; + } + let body; + try { + body = (0, import_node_fs.readFileSync)(response.bodyPath, "utf-8"); + } catch (_) { + return null; + } + return body; + } } ] };