Fix jackson build error (#7641)
* Fixing prettier build issue with jackson * Refactor to clean up code * Now using globalThis to reference jackson objectspull/7662/head
parent
e24f1d8bdb
commit
f3360e6476
|
@ -6,7 +6,7 @@ import type {
|
|||
ISPSAMLConfig,
|
||||
} from "@boxyhq/saml-jackson";
|
||||
|
||||
import {WEBAPP_URL} from "@calcom/lib/constants";
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
|
||||
import { samlDatabaseUrl, samlAudience, samlPath, oidcPath, clientSecretVerifier } from "./saml";
|
||||
|
||||
|
@ -26,38 +26,25 @@ const opts: JacksonOption = {
|
|||
clientSecretVerifier,
|
||||
};
|
||||
|
||||
let connectionController: IConnectionAPIController;
|
||||
let oauthController: IOAuthController;
|
||||
let samlSPConfig: ISPSAMLConfig;
|
||||
|
||||
const g = global;
|
||||
|
||||
declare global {
|
||||
/* eslint-disable no-var */
|
||||
var connectionController: IConnectionAPIController | undefined;
|
||||
var oauthController: IOAuthController | undefined;
|
||||
var samlSPConfig: ISPSAMLConfig | undefined;
|
||||
/* eslint-enable no-var */
|
||||
}
|
||||
|
||||
export default async function init() {
|
||||
if (!g.connectionController || !g.oauthController || !g.samlSPConfig) {
|
||||
if (!globalThis.connectionController || !globalThis.oauthController || !globalThis.samlSPConfig) {
|
||||
const ret = await jackson(opts);
|
||||
|
||||
connectionController = ret.connectionAPIController;
|
||||
oauthController = ret.oauthController;
|
||||
samlSPConfig = ret.spConfig;
|
||||
|
||||
g.connectionController = connectionController;
|
||||
g.oauthController = oauthController;
|
||||
g.samlSPConfig = samlSPConfig;
|
||||
} else {
|
||||
connectionController = g.connectionController;
|
||||
oauthController = g.oauthController;
|
||||
samlSPConfig = g.samlSPConfig;
|
||||
globalThis.connectionController = ret.connectionAPIController;
|
||||
globalThis.oauthController = ret.oauthController;
|
||||
globalThis.samlSPConfig = ret.spConfig;
|
||||
}
|
||||
|
||||
return {
|
||||
connectionController,
|
||||
oauthController,
|
||||
samlSPConfig,
|
||||
connectionController: globalThis.connectionController,
|
||||
oauthController: globalThis.oauthController,
|
||||
samlSPConfig: globalThis.samlSPConfig,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue