@narrative.io/jsonforms-provider-protocols
Version:
Dynamic data provider capabilities for JSONForms with Vue 3 integration
50 lines (44 loc) • 1.21 kB
text/typescript
import type { App } from "vue";
import { cache as globalCache } from "./core/cache";
import { registry as globalRegistry } from "./core/registry";
import type { Protocol, AuthConfig } from "./core/types";
export { cache } from "./core/cache";
export * from "./core/jsonpath";
export { registry } from "./core/registry";
export * from "./core/templating";
// Core exports
export * from "./core/types";
// Protocol exports
export { RestApiProtocol } from "./protocols/rest_api";
// Vue exports - using named imports to avoid potential bundling issues
export {
providerRenderers,
primevueRenderers,
ProviderAutocomplete,
ProviderSelect,
ProviderMultiSelect,
useProvider,
JfText,
JfTextArea,
JfNumber,
JfEnum,
JfEnumArray,
JfBoolean,
} from "./vue";
export interface ProviderConfig {
protocols?: Protocol[];
auth?: AuthConfig;
}
export default {
install(app: App, opts?: ProviderConfig) {
const reg = globalRegistry;
if (opts?.protocols) {
for (const p of opts.protocols) {
reg.register(p);
}
}
app.provide("providerRegistry", reg);
app.provide("providerCache", globalCache);
app.provide("providerAuth", opts?.auth ?? {});
},
};