🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@robinpath/api

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@robinpath/api - npm Package Compare versions

Comparing version
0.1.2
to
0.3.0
+35
dist/api.d.ts
/**
* RobinPath API Module (Node port)
*
* Generic HTTP API wrapper with **named credential profiles**. Unlike the
* `http` module which is stateless, this module pulls reusable auth/base-URL
* config from the RobinPath credential vault so scripts can reference a
* credential slug once and call `api.get "/users"` etc. without repeating
* Authorization headers on every call.
*
* Mirror of packages/php/api/src/index.php — shares the same credential
* contract, metadata shape, and error taxonomy so the visual editor can
* render both identically.
*
* Two calling styles are supported:
* 1. **Credential-first:** pass the credential slug as first argument and a
* path (relative to the credential's `base_url`) as the URL. Auth headers
* are injected automatically based on the credential's `auth_type`.
* 2. **Ad-hoc:** pass an absolute URL and let `options.headers` supply auth.
* Credential slug may be empty in this case.
*
* Credential type declared by this module:
* - api : { base_url, auth_type, token?, username?, password?, headers? }
* auth_type ∈ bearer | basic | api_key | none
*
* All handlers return a normalized envelope or an error envelope — they never
* throw for API-level errors (non-2xx responses). Transport failures (DNS,
* TLS, timeout) are also caught and returned as `{error, code: 'transport'}`.
*/
import type { BuiltinHandler, CredentialTypeSchema, FunctionMetadata, ModuleHost, ModuleMetadata } from "@robinpath/core";
export declare function configureApi(h: ModuleHost): void;
export declare const ApiFunctions: Record<string, BuiltinHandler>;
export declare const ApiCredentialTypes: CredentialTypeSchema[];
export declare const ApiFunctionMetadata: Record<string, FunctionMetadata>;
export declare const ApiModuleMetadata: ModuleMetadata;
//# sourceMappingURL=api.d.ts.map
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,cAAc,EAEf,MAAM,iBAAiB,CAAC;AAiBzB,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAEhD;AA+dD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAUvD,CAAC;AAIF,eAAO,MAAM,kBAAkB,EAAE,oBAAoB,EAuDpD,CAAC;AAwEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAwOhE,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,cAoB/B,CAAC"}
/**
* RobinPath API Module (Node port)
*
* Generic HTTP API wrapper with **named credential profiles**. Unlike the
* `http` module which is stateless, this module pulls reusable auth/base-URL
* config from the RobinPath credential vault so scripts can reference a
* credential slug once and call `api.get "/users"` etc. without repeating
* Authorization headers on every call.
*
* Mirror of packages/php/api/src/index.php — shares the same credential
* contract, metadata shape, and error taxonomy so the visual editor can
* render both identically.
*
* Two calling styles are supported:
* 1. **Credential-first:** pass the credential slug as first argument and a
* path (relative to the credential's `base_url`) as the URL. Auth headers
* are injected automatically based on the credential's `auth_type`.
* 2. **Ad-hoc:** pass an absolute URL and let `options.headers` supply auth.
* Credential slug may be empty in this case.
*
* Credential type declared by this module:
* - api : { base_url, auth_type, token?, username?, password?, headers? }
* auth_type ∈ bearer | basic | api_key | none
*
* All handlers return a normalized envelope or an error envelope — they never
* throw for API-level errors (non-2xx responses). Transport failures (DNS,
* TLS, timeout) are also caught and returned as `{error, code: 'transport'}`.
*/
import { readFileSync, writeFileSync } from "node:fs";
import { basename } from "node:path";
// ── Module-local state (populated by configure hook) ────────────────────
const state = {};
function host() {
if (!state.host) {
throw new Error("API module not initialized. Pass the adapter to rp.registerModule() via loadModule so its configure() hook runs first.");
}
return state.host;
}
export function configureApi(h) {
state.host = h;
}
// ── Constants ──────────────────────────────────────────────────────────
const CREDENTIAL_TYPE = "api";
const DEFAULT_TIMEOUT_MS = 30_000;
function errorReturn(error, code, extra = {}) {
return { error, code, ...extra };
}
function isErr(x) {
return typeof x === "object" && x !== null && "error" in x && "code" in x;
}
function blankAuth() {
return {
baseUrl: "",
authType: "none",
token: "",
username: "",
password: "",
defaultHeaders: {},
};
}
async function resolveAuth(credentialSlug) {
// Empty slug is allowed — ad-hoc mode (absolute URLs only, no injected auth).
if (!credentialSlug)
return blankAuth();
let fields;
try {
fields = await host().credentials.get(credentialSlug);
}
catch (e) {
return errorReturn(e instanceof Error ? e.message : String(e), "credential_not_found");
}
if (!fields) {
return errorReturn(`Credential '${credentialSlug}' not found.`, "credential_not_found");
}
const rawAuthType = String(fields.auth_type ?? "none").toLowerCase();
const authType = rawAuthType === "bearer" || rawAuthType === "basic" || rawAuthType === "api_key" || rawAuthType === "none"
? rawAuthType
: "none";
const defaultHeaders = {};
if (fields.headers && typeof fields.headers === "object" && !Array.isArray(fields.headers)) {
for (const [k, v] of Object.entries(fields.headers)) {
defaultHeaders[String(k)] = String(v);
}
}
return {
baseUrl: String(fields.base_url ?? ""),
authType,
token: String(fields.token ?? ""),
username: String(fields.username ?? ""),
password: String(fields.password ?? ""),
defaultHeaders,
};
}
// ── URL + header helpers ───────────────────────────────────────────────
function resolveUrl(urlOrPath, baseUrl) {
if (/^https?:\/\//i.test(urlOrPath))
return urlOrPath;
if (!baseUrl)
return urlOrPath;
const base = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
const path = urlOrPath.startsWith("/") ? urlOrPath.slice(1) : urlOrPath;
return base + path;
}
function applyAuth(headers, auth, opts) {
switch (auth.authType) {
case "bearer": {
if (auth.token)
headers["Authorization"] = `Bearer ${auth.token}`;
break;
}
case "basic": {
const u = auth.username;
const p = auth.password;
if (u || p) {
headers["Authorization"] = `Basic ${Buffer.from(`${u}:${p}`).toString("base64")}`;
}
break;
}
case "api_key": {
if (auth.token) {
const headerName = typeof opts.apiKeyHeader === "string" && opts.apiKeyHeader !== ""
? opts.apiKeyHeader
: "X-API-Key";
headers[headerName] = auth.token;
}
break;
}
case "none":
default:
break;
}
}
function mergeHeaders(defaults, opts) {
const out = { ...defaults };
if (opts.headers && typeof opts.headers === "object" && !Array.isArray(opts.headers)) {
for (const [k, v] of Object.entries(opts.headers)) {
out[String(k)] = String(v);
}
}
return out;
}
function hasHeader(headers, name) {
const needle = name.toLowerCase();
for (const k of Object.keys(headers)) {
if (k.toLowerCase() === needle)
return true;
}
return false;
}
async function http(auth, method, urlOrPath, body, opts) {
const resolvedUrl = resolveUrl(urlOrPath, auth.baseUrl);
const headers = mergeHeaders(auth.defaultHeaders, opts);
applyAuth(headers, auth, opts);
let requestBody;
if (body !== undefined && body !== null) {
if (body instanceof FormData) {
requestBody = body;
}
else if (typeof body === "object") {
if (!hasHeader(headers, "Content-Type"))
headers["Content-Type"] = "application/json";
requestBody = JSON.stringify(body);
}
else {
requestBody = String(body);
}
}
const timeout = typeof opts.timeout === "number" ? opts.timeout : DEFAULT_TIMEOUT_MS;
let response;
try {
response = await fetch(resolvedUrl, {
method: method.toUpperCase(),
headers,
body: requestBody,
signal: AbortSignal.timeout(timeout),
});
}
catch (e) {
return errorReturn(e instanceof Error ? e.message : String(e), "transport");
}
const contentType = response.headers.get("content-type") ?? "";
let respBody;
const raw = await response.text();
if (raw === "") {
respBody = null;
}
else if (contentType.includes("json")) {
try {
respBody = JSON.parse(raw);
}
catch {
respBody = raw;
}
}
else {
respBody = raw;
}
const envelope = {
ok: response.ok,
status: response.status,
statusText: response.statusText,
headers: Object.fromEntries(response.headers.entries()),
body: respBody,
url: response.url || resolvedUrl,
};
if (!response.ok) {
let message = `API returned HTTP ${response.status}.`;
if (respBody && typeof respBody === "object" && "message" in respBody) {
const m = respBody.message;
if (typeof m === "string")
message = m;
}
else if (typeof respBody === "string" && respBody !== "") {
message = respBody.slice(0, 500);
}
let code = "api_error";
if (response.status === 429)
code = "rate_limited";
else if (response.status === 404)
code = "not_found";
else if (response.status === 401 || response.status === 403)
code = "permission_denied";
return errorReturn(message, code, {
status: response.status,
api_error: respBody,
});
}
return opts.fullResponse === true ? envelope : envelope.body;
}
// ── Handlers ───────────────────────────────────────────────────────────
function asOpts(v) {
return v && typeof v === "object" && !Array.isArray(v) ? v : {};
}
const get = async (args) => {
const cred = String(args[0] ?? "");
const url = String(args[1] ?? "");
const opts = asOpts(args[2]);
if (!url)
return errorReturn("URL is required.", "url_missing");
const auth = await resolveAuth(cred);
if (isErr(auth))
return auth;
return (await http(auth, "GET", url, undefined, opts));
};
const post = async (args) => {
const cred = String(args[0] ?? "");
const url = String(args[1] ?? "");
const body = args[2];
const opts = asOpts(args[3]);
if (!url)
return errorReturn("URL is required.", "url_missing");
const auth = await resolveAuth(cred);
if (isErr(auth))
return auth;
return (await http(auth, "POST", url, body, opts));
};
const put = async (args) => {
const cred = String(args[0] ?? "");
const url = String(args[1] ?? "");
const body = args[2];
const opts = asOpts(args[3]);
if (!url)
return errorReturn("URL is required.", "url_missing");
const auth = await resolveAuth(cred);
if (isErr(auth))
return auth;
return (await http(auth, "PUT", url, body, opts));
};
const patch = async (args) => {
const cred = String(args[0] ?? "");
const url = String(args[1] ?? "");
const body = args[2];
const opts = asOpts(args[3]);
if (!url)
return errorReturn("URL is required.", "url_missing");
const auth = await resolveAuth(cred);
if (isErr(auth))
return auth;
return (await http(auth, "PATCH", url, body, opts));
};
const del = async (args) => {
const cred = String(args[0] ?? "");
const url = String(args[1] ?? "");
const opts = asOpts(args[2]);
if (!url)
return errorReturn("URL is required.", "url_missing");
const auth = await resolveAuth(cred);
if (isErr(auth))
return auth;
return (await http(auth, "DELETE", url, undefined, opts));
};
const head = async (args) => {
const cred = String(args[0] ?? "");
const url = String(args[1] ?? "");
const opts = asOpts(args[2]);
if (!url)
return errorReturn("URL is required.", "url_missing");
const auth = await resolveAuth(cred);
if (isErr(auth))
return auth;
const resolvedUrl = resolveUrl(url, auth.baseUrl);
const headers = mergeHeaders(auth.defaultHeaders, opts);
applyAuth(headers, auth, opts);
const timeout = typeof opts.timeout === "number" ? opts.timeout : DEFAULT_TIMEOUT_MS;
try {
const response = await fetch(resolvedUrl, {
method: "HEAD",
headers,
signal: AbortSignal.timeout(timeout),
});
return {
status: response.status,
ok: response.ok,
headers: Object.fromEntries(response.headers.entries()),
};
}
catch (e) {
return errorReturn(e instanceof Error ? e.message : String(e), "transport");
}
};
const request = async (args) => {
const cred = String(args[0] ?? "");
const method = String(args[1] ?? "GET");
const url = String(args[2] ?? "");
const opts = asOpts(args[3]);
if (!url)
return errorReturn("URL is required.", "url_missing");
const auth = await resolveAuth(cred);
if (isErr(auth))
return auth;
const body = opts.body;
return (await http(auth, method, url, body, opts));
};
const download = async (args) => {
const cred = String(args[0] ?? "");
const url = String(args[1] ?? "");
const filePath = String(args[2] ?? "");
const opts = asOpts(args[3]);
if (!url)
return errorReturn("URL is required.", "url_missing");
if (!filePath)
return errorReturn("File path is required.", "path_missing");
const auth = await resolveAuth(cred);
if (isErr(auth))
return auth;
const resolvedUrl = resolveUrl(url, auth.baseUrl);
const headers = mergeHeaders(auth.defaultHeaders, opts);
applyAuth(headers, auth, opts);
const timeout = typeof opts.timeout === "number" ? opts.timeout : DEFAULT_TIMEOUT_MS;
let response;
try {
response = await fetch(resolvedUrl, {
method: "GET",
headers,
signal: AbortSignal.timeout(timeout),
});
}
catch (e) {
return errorReturn(e instanceof Error ? e.message : String(e), "transport");
}
if (!response.ok) {
return errorReturn(`Download failed: HTTP ${response.status}.`, "api_error", {
status: response.status,
});
}
const arrayBuffer = await response.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
try {
writeFileSync(filePath, buffer);
}
catch (e) {
return errorReturn(e instanceof Error ? e.message : String(e), "write_failed");
}
return {
path: filePath,
size: buffer.length,
contentType: response.headers.get("content-type") ?? "application/octet-stream",
status: response.status,
};
};
const upload = async (args) => {
const cred = String(args[0] ?? "");
const url = String(args[1] ?? "");
const filePath = String(args[2] ?? "");
const fieldName = typeof args[3] === "string" && args[3] !== "" ? args[3] : "file";
const opts = asOpts(args[4]);
if (!url)
return errorReturn("URL is required.", "url_missing");
if (!filePath)
return errorReturn("File path is required.", "path_missing");
const auth = await resolveAuth(cred);
if (isErr(auth))
return auth;
const resolvedUrl = resolveUrl(url, auth.baseUrl);
const headers = mergeHeaders(auth.defaultHeaders, opts);
applyAuth(headers, auth, opts);
const timeout = typeof opts.timeout === "number" ? opts.timeout : DEFAULT_TIMEOUT_MS;
let fileBuffer;
try {
fileBuffer = readFileSync(filePath);
}
catch (e) {
return errorReturn(e instanceof Error ? e.message : String(e), "read_failed");
}
const fileName = basename(filePath);
const blob = new Blob([new Uint8Array(fileBuffer)]);
const formData = new FormData();
formData.append(fieldName, blob, fileName);
if (opts.fields && typeof opts.fields === "object" && !Array.isArray(opts.fields)) {
for (const [k, v] of Object.entries(opts.fields)) {
formData.append(k, String(v));
}
}
// fetch must set the multipart boundary automatically.
for (const k of Object.keys(headers)) {
if (k.toLowerCase() === "content-type")
delete headers[k];
}
let response;
try {
response = await fetch(resolvedUrl, {
method: "POST",
headers,
body: formData,
signal: AbortSignal.timeout(timeout),
});
}
catch (e) {
return errorReturn(e instanceof Error ? e.message : String(e), "transport");
}
const contentType = response.headers.get("content-type") ?? "";
const raw = await response.text();
let respBody;
if (raw === "") {
respBody = null;
}
else if (contentType.includes("json")) {
try {
respBody = JSON.parse(raw);
}
catch {
respBody = raw;
}
}
else {
respBody = raw;
}
if (!response.ok) {
return errorReturn(`Upload failed: HTTP ${response.status}.`, "api_error", {
status: response.status,
api_error: respBody,
});
}
return {
status: response.status,
ok: response.ok,
body: respBody,
};
};
// ── Exports: functions map ─────────────────────────────────────────────
export const ApiFunctions = {
get,
post,
put,
patch,
delete: del,
head,
download,
upload,
request,
};
// ── Exports: credential types ──────────────────────────────────────────
export const ApiCredentialTypes = [
{
slug: CREDENTIAL_TYPE,
title: "Generic API",
icon: "globe",
fields: [
{
name: "base_url",
title: "Base URL",
type: "text",
required: true,
placeholder: "https://api.example.com/v1",
description: "Root URL that relative paths (e.g. `/users`) will be joined onto.",
},
{
name: "auth_type",
title: "Auth type",
type: "text",
required: true,
placeholder: "bearer",
description: "One of `bearer`, `basic`, `api_key`, or `none`.",
pattern: "^(bearer|basic|api_key|none)$",
},
{
name: "token",
title: "Token / API key",
type: "password",
required: false,
placeholder: "sk-… or ghp-…",
description: "Used for `bearer` and `api_key` auth. Leave blank for `basic` / `none`.",
},
{
name: "username",
title: "Username",
type: "text",
required: false,
description: "Used for `basic` auth only.",
},
{
name: "password",
title: "Password",
type: "password",
required: false,
description: "Used for `basic` auth only.",
},
{
name: "headers",
title: "Default headers (JSON)",
type: "textarea",
required: false,
placeholder: '{"Accept": "application/json"}',
description: "Optional. JSON object of default headers merged on every request.",
},
],
},
];
// ── Exports: metadata ──────────────────────────────────────────────────
const credentialParam = {
name: "credential",
title: "Credential",
description: "Slug of a saved `api` credential. Pass an empty string to call absolute URLs with no injected auth.",
dataType: "string",
formInputType: "resource",
required: false,
allowExpression: true,
placeholder: "my_api",
resource: {
type: "credential",
listFn: "credential.list",
modes: ["list", "expression"],
searchable: true,
filter: { type: CREDENTIAL_TYPE },
},
};
const urlParam = {
name: "url",
title: "URL or path",
description: "Absolute URL, or path relative to the credential's `base_url`.",
dataType: "string",
formInputType: "text",
required: true,
allowExpression: true,
placeholder: "/users",
};
const optionsParam = {
name: "options",
title: "Options",
description: "Recognized keys:\n headers : object merged into the request headers\n timeout : ms, default 30000\n fullResponse : bool — return {ok,status,statusText,headers,body,url} instead of just body\n apiKeyHeader : string — header name for `api_key` auth (default `X-API-Key`)",
dataType: "object",
formInputType: "json",
required: false,
allowExpression: true,
language: "json",
rows: 4,
advanced: true,
};
const bodyParam = {
name: "body",
title: "Body",
description: "Request body. Objects are auto-serialized as JSON; strings are sent as-is.",
dataType: "any",
formInputType: "json",
required: false,
allowExpression: true,
language: "json",
rows: 5,
};
const commonErrors = {
credential_not_found: "No credential with that slug exists in the vault.",
url_missing: "The URL argument was empty.",
transport: "Network failure — DNS / TLS / timeout.",
api_error: "Upstream API returned a non-2xx status.",
rate_limited: "Upstream returned HTTP 429 (rate limit).",
not_found: "Upstream returned HTTP 404.",
permission_denied: "Upstream returned HTTP 401/403.",
path_missing: "File path argument was empty.",
read_failed: "Failed to read the file on disk.",
write_failed: "Failed to write the file on disk.",
};
export const ApiFunctionMetadata = {
get: {
title: "GET",
summary: "HTTP GET (auto-parses JSON)",
description: "Calls `GET {base_url}{url}`. Injects auth headers from the credential.",
group: "requests",
action: "read",
icon: "download",
capability: "manage_options",
sideEffects: ["makes_http_call"],
idempotent: true,
since: "1.0.0",
tags: ["api", "http", "get"],
parameters: [credentialParam, urlParam, optionsParam],
returnType: "any",
returnDescription: "Parsed response body, or a full envelope when `options.fullResponse` is true.",
errors: commonErrors,
example: 'api.get "my_api" "/users"',
},
post: {
title: "POST",
summary: "HTTP POST with JSON body",
description: "Calls `POST {base_url}{url}` with the supplied body.",
group: "requests",
action: "write",
icon: "upload",
capability: "manage_options",
sideEffects: ["makes_http_call"],
idempotent: false,
since: "1.0.0",
tags: ["api", "http", "post"],
parameters: [credentialParam, urlParam, bodyParam, optionsParam],
returnType: "any",
errors: commonErrors,
example: 'api.post "my_api" "/users" {name: "Ada"}',
},
put: {
title: "PUT",
summary: "HTTP PUT with JSON body",
description: "Calls `PUT {base_url}{url}` with the supplied body.",
group: "requests",
action: "write",
icon: "refresh-cw",
capability: "manage_options",
sideEffects: ["makes_http_call"],
idempotent: true,
since: "1.0.0",
tags: ["api", "http", "put"],
parameters: [credentialParam, urlParam, bodyParam, optionsParam],
returnType: "any",
errors: commonErrors,
example: 'api.put "my_api" "/users/1" {name: "Ada"}',
},
patch: {
title: "PATCH",
summary: "HTTP PATCH with JSON body",
description: "Calls `PATCH {base_url}{url}` with a partial body.",
group: "requests",
action: "write",
icon: "edit-3",
capability: "manage_options",
sideEffects: ["makes_http_call"],
idempotent: true,
since: "1.0.0",
tags: ["api", "http", "patch"],
parameters: [credentialParam, urlParam, bodyParam, optionsParam],
returnType: "any",
errors: commonErrors,
example: 'api.patch "my_api" "/users/1" {email: "new@x.com"}',
},
delete: {
title: "DELETE",
summary: "HTTP DELETE",
description: "Calls `DELETE {base_url}{url}`.",
group: "requests",
action: "delete",
icon: "trash-2",
capability: "manage_options",
sideEffects: ["makes_http_call"],
idempotent: true,
since: "1.0.0",
tags: ["api", "http", "delete"],
parameters: [credentialParam, urlParam, optionsParam],
returnType: "any",
errors: commonErrors,
example: 'api.delete "my_api" "/users/1"',
},
head: {
title: "HEAD",
summary: "HTTP HEAD (headers only)",
description: "Returns `{status, ok, headers}` — response body is discarded.",
group: "requests",
action: "read",
icon: "info",
capability: "manage_options",
sideEffects: ["makes_http_call"],
idempotent: true,
since: "1.0.0",
tags: ["api", "http", "head"],
parameters: [credentialParam, urlParam, optionsParam],
returnType: "object",
errors: commonErrors,
example: 'api.head "my_api" "/users/1"',
},
download: {
title: "Download file",
summary: "Stream a URL to a local file",
description: "GETs the URL and writes the response body to `filePath`.",
group: "files",
action: "read",
icon: "download",
capability: "manage_options",
sideEffects: ["makes_http_call", "writes_filesystem"],
idempotent: true,
since: "1.0.0",
tags: ["api", "http", "download", "file"],
parameters: [
credentialParam,
urlParam,
{
name: "filePath",
title: "Destination path",
dataType: "string",
description: "Local path to write the downloaded bytes.",
formInputType: "text",
required: true,
allowExpression: true,
placeholder: "/tmp/report.pdf",
},
optionsParam,
],
returnType: "object",
returnDescription: "{path, size, contentType, status}",
errors: commonErrors,
example: 'api.download "my_api" "/reports/latest.pdf" "/tmp/latest.pdf"',
},
upload: {
title: "Upload file (multipart)",
summary: "POST a file as multipart/form-data",
description: "Reads `filePath` and POSTs it as a multipart/form-data field.",
group: "files",
action: "upload",
icon: "upload",
capability: "manage_options",
sideEffects: ["makes_http_call", "reads_filesystem"],
idempotent: false,
since: "1.0.0",
tags: ["api", "http", "upload", "file"],
parameters: [
credentialParam,
urlParam,
{
name: "filePath",
title: "Source path",
dataType: "string",
description: "Local path of the file to upload.",
formInputType: "text",
required: true,
allowExpression: true,
placeholder: "/tmp/photo.jpg",
},
{
name: "fieldName",
title: "Form field name",
dataType: "string",
description: "Multipart form field name (default: `file`).",
formInputType: "text",
required: false,
allowExpression: true,
placeholder: "file",
},
{
name: "options",
title: "Options",
description: "Recognized keys:\n headers : object\n timeout : ms\n fields : object of extra form fields\n apiKeyHeader : string",
dataType: "object",
formInputType: "json",
required: false,
allowExpression: true,
language: "json",
rows: 4,
advanced: true,
},
],
returnType: "object",
returnDescription: "{status, ok, body}",
errors: commonErrors,
example: 'api.upload "my_api" "/upload" "/tmp/photo.jpg" "image"',
},
request: {
title: "Request (generic)",
summary: "HTTP with an explicit method",
description: "Calls `{method} {base_url}{url}` with `options.body` (if provided).",
group: "requests",
action: "write",
icon: "globe",
capability: "manage_options",
sideEffects: ["makes_http_call"],
idempotent: false,
since: "1.0.0",
tags: ["api", "http", "request"],
parameters: [
credentialParam,
{
name: "method",
title: "Method",
dataType: "string",
description: "HTTP method (GET, POST, PUT, PATCH, DELETE, OPTIONS, …).",
formInputType: "text",
required: true,
allowExpression: true,
placeholder: "OPTIONS",
},
urlParam,
{
name: "options",
title: "Options",
description: "Recognized keys:\n body : request body (auto JSON-serialized if object)\n headers : object merged into request headers\n timeout : ms\n fullResponse : bool\n apiKeyHeader : string",
dataType: "object",
formInputType: "json",
required: false,
allowExpression: true,
language: "json",
rows: 5,
advanced: true,
},
],
returnType: "any",
errors: commonErrors,
example: 'api.request "my_api" "OPTIONS" "/resource"',
},
};
export const ApiModuleMetadata = {
slug: "api",
title: "API",
summary: "Generic REST client with reusable credential profiles (bearer / basic / api_key).",
description: "The `api` module is a thin wrapper around `fetch()` with an injected auth scheme pulled from the credential vault. Unlike `http` (stateless / ad-hoc), `api` lets you save a base URL + auth once, reference it by slug, and make short relative calls.\n\nCalling styles:\n • Credential-first: pass the slug and a path (`/users`). Auth headers are injected.\n • Ad-hoc: pass an empty slug and an absolute URL. No auth is injected.\n\nEvery handler returns a normalized envelope when `options.fullResponse` is true, otherwise just the parsed body. Errors are returned as `{error, code, status?, api_error?}` — they are never thrown.",
category: "web",
icon: "icon.svg",
color: "#3B82F6",
version: "0.2.0",
docsUrl: "https://docs.robinpath.com/modules/api",
status: "stable",
requires: [],
minNodeVersion: "18.0.0",
credentialsType: CREDENTIAL_TYPE,
operationGroups: {
requests: { title: "Requests", description: "Standard HTTP methods.", order: 1 },
files: { title: "Files", description: "Download / multipart upload.", order: 2 },
},
methods: Object.keys(ApiFunctions),
};
//# sourceMappingURL=api.js.map
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAUH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,2EAA2E;AAE3E,MAAM,KAAK,GAA0B,EAAE,CAAC;AAExC,SAAS,IAAI;IACX,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,wHAAwH,CACzH,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAa;IACxC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;AACjB,CAAC;AAED,0EAA0E;AAE1E,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAWlC,SAAS,WAAW,CAClB,KAAa,EACb,IAAY,EACZ,QAAiC,EAAE;IAEnC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,KAAK,EAAiB,CAAC;AAClD,CAAC;AAED,SAAS,KAAK,CAAC,CAAU;IACvB,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,IAAK,CAAY,IAAI,MAAM,IAAK,CAAY,CAAC;AACpG,CAAC;AAaD,SAAS,SAAS;IAChB,OAAO;QACL,OAAO,EAA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core";
declare const ApiModule: ModuleAdapter;
export default ApiModule;
export { ApiModule };
export { ApiFunctions, ApiFunctionMetadata, ApiModuleMetadata, ApiCredentialTypes, configureApi, } from "./api.js";
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AASrD,QAAA,MAAM,SAAS,EAAE,aAQhB,CAAC;AAEF,eAAe,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,GACb,MAAM,UAAU,CAAC"}
import { ApiFunctions, ApiFunctionMetadata, ApiModuleMetadata, ApiCredentialTypes, configureApi, } from "./api.js";
const ApiModule = {
name: "api",
functions: ApiFunctions,
functionMetadata: ApiFunctionMetadata,
moduleMetadata: ApiModuleMetadata,
credentialTypes: ApiCredentialTypes,
configure: configureApi,
global: false,
};
export default ApiModule;
export { ApiModule };
export { ApiFunctions, ApiFunctionMetadata, ApiModuleMetadata, ApiCredentialTypes, configureApi, } from "./api.js";
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,GACb,MAAM,UAAU,CAAC;AAElB,MAAM,SAAS,GAAkB;IAC/B,IAAI,EAAE,KAAK;IACX,SAAS,EAAE,YAAY;IACvB,gBAAgB,EAAE,mBAAmB;IACrC,cAAc,EAAE,iBAAiB;IACjC,eAAe,EAAE,kBAAkB;IACnC,SAAS,EAAE,YAAY;IACvB,MAAM,EAAE,KAAK;CACd,CAAC;AAEF,eAAe,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,GACb,MAAM,UAAU,CAAC"}
+22
-8
{
"name": "@robinpath/api",
"version": "0.1.2",
"version": "0.3.0",
"publishConfig": {

@@ -23,12 +23,19 @@ "access": "public"

"peerDependencies": {
"@robinpath/core": ">=0.20.0"
"@robinpath/core": ">=0.40.0"
},
"devDependencies": {
"@robinpath/core": "^0.30.1",
"@robinpath/core": "^0.40.0",
"typescript": "^5.6.0"
},
"description": "HTTP client for making requests to external APIs with profiles, auth, download/upload, and auto-JSON parsing",
"description": "Generic REST client with named credential profiles (bearer / basic / api_key). Wraps fetch() with base-URL resolution, structured error envelopes, and download/upload helpers.",
"keywords": [
"api",
"web"
"http",
"rest",
"fetch",
"client",
"credentials",
"bearer",
"basic-auth",
"api-key"
],

@@ -38,6 +45,13 @@ "license": "MIT",

"category": "web",
"type": "utility",
"auth": "api-key",
"functionCount": 12
"type": "module",
"auth": "credential-vault",
"credentialType": "api",
"functionCount": 9,
"language": "nodejs",
"platforms": [
"cloud",
"cli",
"desktop"
]
}
}

@@ -22,3 +22,3 @@ # @robinpath/api

```bash
npm install @robinpath/api
robinpath add @robinpath/api
```

@@ -25,0 +25,0 @@