@opencitylabs/formio-sdk
v1.0.0
Published
Node/browser SDK helper for Form.io APIs
Readme
formio-sdk
Node/browser helper utilities for Form.io APIs.
Install
npm install formio-sdkQuick start (Node)
const { FormioHelper } = require("formio-sdk");
const helper = new FormioHelper({
baseUrl: "https://servizi.example.it/lang",
token: process.env.AUTH_TOKEN,
locale: "it",
siteUrl: "https://servizi.example.it",
applicationId: "12345"
});
async function run() {
const tenant = await helper.getTenantInfo();
console.log("tenant:", tenant);
const profile = await helper.authenticatedCall("users/me");
console.log("profile:", profile);
}
run().catch(console.error);API notes
getFieldApplication(getParams, applicationId): in Node passapplicationIdas argument or constructor option.getFieldMeta(getParams): returns parsed tenant meta (or nested key via lodash path).authenticatedCall,authenticatedPOSTCall,authenticatedRequest: returnundefinedwhen token is missing (same behavior as original helper).
Constructor options
baseUrl: Formio backend base URL.token: auth token string (or function returning token).locale: locale string (defaults toit).siteUrl: optional site URL used bygetBookingConfig.applicationId: fallback id used bygetFieldApplication.origin: base origin for relative URLs inaddLimitParam.storage: custom storage adapter (getItem) to readauth-token.httpClient: custom axios-like client.logger: custom logger witherror/warnmethods.getBaseUrl,getCurrentToken,getCurrentLocale,getSiteUrl: override functions for full control.
