@solfacil/plasma-utils
Version:
- 💚 [Nuxt 3](https://nuxt.com/) - Compatible with Nuxt 3 - 🍞 [BUN](https://bun.sh/) - A fast JavaScript all-in-one toolkit (runtime, bundler, test runner, package manager). - 🔑 [Keycloak](https://www.keycloak.org/) integration. - ⚡️ Vite - Instant HMR.
68 lines (67 loc) • 1.71 kB
TypeScript
import { Router } from "vue-router";
export type AvailableConnection = 'dev' | 'stg' | 'prod';
export interface GraphQLConnection {
url: string;
}
export interface KeycloakConnection {
url: string;
realm: string;
client_id: string;
}
export interface RestConnection {
url: string;
key?: string;
}
export type GraphQLConnections = {
[key in AvailableConnection]: GraphQLConnection;
};
export type KeycloakConnections = {
[key in AvailableConnection]: KeycloakConnection;
};
export type RestConnections = {
[key in AvailableConnection]: RestConnection;
};
export interface DefinedGraphQLConnections {
default: GraphQLConnections;
[key: string]: GraphQLConnections;
}
export interface DefinedRestConnections {
[key: string]: RestConnections;
}
export interface Connections {
graphql?: DefinedGraphQLConnections;
rest?: DefinedRestConnections;
keycloak?: KeycloakConnections;
}
export interface NormalizedConnections {
graphql: {
[key: string]: GraphQLConnection;
};
rest: {
[key: string]: RestConnection;
};
keycloak: KeycloakConnection;
}
export interface Configuration {
enableKeycloak: boolean;
hostProduction: string;
hostStaging: string;
router: Router;
onAuthenticate?(): void;
onObtainToken?(token: AuthToken): void;
}
export interface AuthToken {
access_token: string;
expires_in: number;
refresh_expires_in: number;
refresh_token: string;
token_type: string;
id_token: string;
session_state: string;
scope: string;
}
export interface PlasmaContext {
configuration: Configuration;
connections: Connections;
environment: AvailableConnection;
}