@cobaltcore-dev/aurora 0.20.2 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/AuthProvider-p1e1DuKU.mjs +69 -0
- package/dist/client/AuthProvider-p1e1DuKU.mjs.map +1 -0
- package/dist/client/DeleteFlavorModal-lFMExcq_.mjs +713 -0
- package/dist/client/DeleteFlavorModal-lFMExcq_.mjs.map +1 -0
- package/dist/client/{DeletePcaModal-YUlNw8cw.mjs → DeletePcaModal-Dg9dej-H.mjs} +2 -2
- package/dist/client/{DeletePcaModal-YUlNw8cw.mjs.map → DeletePcaModal-Dg9dej-H.mjs.map} +1 -1
- package/dist/client/{DetailsInfo-Cv3oke-R.mjs → DetailsInfo-DwCo9P1o.mjs} +2 -2
- package/dist/client/{DetailsInfo-Cv3oke-R.mjs.map → DetailsInfo-DwCo9P1o.mjs.map} +1 -1
- package/dist/client/{FloatingIpActionModals-PLN6CWZ9.mjs → FloatingIpActionModals-CDF8LVtX.mjs} +2 -2
- package/dist/client/{FloatingIpActionModals-PLN6CWZ9.mjs.map → FloatingIpActionModals-CDF8LVtX.mjs.map} +1 -1
- package/dist/client/{ImageToastNotifications-BQM7HOyE.mjs → ImageToastNotifications-Dzq6jNTm.mjs} +2 -2
- package/dist/client/{ImageToastNotifications-BQM7HOyE.mjs.map → ImageToastNotifications-Dzq6jNTm.mjs.map} +1 -1
- package/dist/client/{_auth-BtRCgHQe.mjs → _auth-Dut7CaMR.mjs} +2 -2
- package/dist/client/{_auth-BtRCgHQe.mjs.map → _auth-Dut7CaMR.mjs.map} +1 -1
- package/dist/client/{_flavorId-BaNJ1CDY.mjs → _flavorId-BsIWL0XK.mjs} +2 -2
- package/dist/client/{_flavorId-BaNJ1CDY.mjs.map → _flavorId-BsIWL0XK.mjs.map} +1 -1
- package/dist/client/{_flavorId-BMX239RH.mjs → _flavorId-Cu1nWwOq.mjs} +13 -14
- package/dist/client/{_flavorId-BMX239RH.mjs.map → _flavorId-Cu1nWwOq.mjs.map} +1 -1
- package/dist/client/{_floatingIpId-DQFtZNeg.mjs → _floatingIpId-8-UPUV8M.mjs} +2 -2
- package/dist/client/{_floatingIpId-DQFtZNeg.mjs.map → _floatingIpId-8-UPUV8M.mjs.map} +1 -1
- package/dist/client/{_floatingIpId-E6x99cmW.mjs → _floatingIpId-B_M3gyMA.mjs} +4 -4
- package/dist/client/{_floatingIpId-E6x99cmW.mjs.map → _floatingIpId-B_M3gyMA.mjs.map} +1 -1
- package/dist/client/{_imageId-C2662dZr.mjs → _imageId-D1Z0xIco.mjs} +2 -2
- package/dist/client/{_imageId-C2662dZr.mjs.map → _imageId-D1Z0xIco.mjs.map} +1 -1
- package/dist/client/{_pcaId-CNbmhUF8.mjs → _pcaId-BcwGho7g.mjs} +4 -4
- package/dist/client/{_pcaId-CNbmhUF8.mjs.map → _pcaId-BcwGho7g.mjs.map} +1 -1
- package/dist/client/{_securityGroupId-ju2ZSIYe.mjs → _securityGroupId-B5-gJe1u.mjs} +3 -3
- package/dist/client/{_securityGroupId-ju2ZSIYe.mjs.map → _securityGroupId-B5-gJe1u.mjs.map} +1 -1
- package/dist/client/{_securityGroupId-a46ExjsA.mjs → _securityGroupId-fPJWtDPU.mjs} +2 -2
- package/dist/client/{_securityGroupId-a46ExjsA.mjs.map → _securityGroupId-fPJWtDPU.mjs.map} +1 -1
- package/dist/client/{_storageType-DsbBodWF.mjs → _storageType-BkhbKG_G.mjs} +2 -2
- package/dist/client/{_storageType-DsbBodWF.mjs.map → _storageType-BkhbKG_G.mjs.map} +1 -1
- package/dist/client/{_storageType-WwAATdsa.mjs → _storageType-ByLL106s.mjs} +113 -115
- package/dist/client/_storageType-ByLL106s.mjs.map +1 -0
- package/dist/client/{aurora-Owys0YMN.mjs → aurora-Dp_NPGe8.mjs} +2 -2
- package/dist/client/{aurora-Owys0YMN.mjs.map → aurora-Dp_NPGe8.mjs.map} +1 -1
- package/dist/client/components/Auth/LoginForm.d.ts +1 -0
- package/dist/client/{flavors-Bwjig3k2.mjs → flavors-CT1bHP61.mjs} +11 -12
- package/dist/client/{flavors-Bwjig3k2.mjs.map → flavors-CT1bHP61.mjs.map} +1 -1
- package/dist/client/{flavors-C7PVJUqZ.mjs → flavors-q1j-y3e-.mjs} +2 -2
- package/dist/client/{flavors-C7PVJUqZ.mjs.map → flavors-q1j-y3e-.mjs.map} +1 -1
- package/dist/client/{floatingips-D98DrjA0.mjs → floatingips-DC5OrR8h.mjs} +3 -3
- package/dist/client/{floatingips-D98DrjA0.mjs.map → floatingips-DC5OrR8h.mjs.map} +1 -1
- package/dist/client/{hooks-BsbKkpZc.mjs → hooks-D0wGUhRF.mjs} +2 -2
- package/dist/client/{hooks-BsbKkpZc.mjs.map → hooks-D0wGUhRF.mjs.map} +1 -1
- package/dist/client/{images-CfBrglGJ.mjs → images-BklcxYWi.mjs} +4 -4
- package/dist/client/{images-CfBrglGJ.mjs.map → images-BklcxYWi.mjs.map} +1 -1
- package/dist/client/{images-CD7DNwru.mjs → images-CPYewah0.mjs} +2 -2
- package/dist/client/{images-CD7DNwru.mjs.map → images-CPYewah0.mjs.map} +1 -1
- package/dist/client/index.js +291 -492
- package/dist/client/index.js.map +1 -1
- package/dist/client/{pca-ZgGU0UPF.mjs → pca-BAuZA0K3.mjs} +2 -2
- package/dist/client/{pca-ZgGU0UPF.mjs.map → pca-BAuZA0K3.mjs.map} +1 -1
- package/dist/client/{pca-CpMqoF00.mjs → pca-Ddk0YfgK.mjs} +4 -4
- package/dist/client/{pca-CpMqoF00.mjs.map → pca-Ddk0YfgK.mjs.map} +1 -1
- package/dist/client/routes-BzBTVAjK.mjs +105 -0
- package/dist/client/routes-BzBTVAjK.mjs.map +1 -0
- package/dist/client/routes-DsisKFfG.mjs +10 -0
- package/dist/client/routes-DsisKFfG.mjs.map +1 -0
- package/dist/client/{securitygroups-BwhVyNmZ.mjs → securitygroups-JMvcJLpb.mjs} +2 -2
- package/dist/client/{securitygroups-BwhVyNmZ.mjs.map → securitygroups-JMvcJLpb.mjs.map} +1 -1
- package/dist/client/store/AuthProvider.d.ts +10 -11
- package/dist/server/index.js +1 -10
- package/package.json +3 -4
- package/dist/client/AuthProvider-Cj_Btfnc.mjs +0 -56
- package/dist/client/AuthProvider-Cj_Btfnc.mjs.map +0 -1
- package/dist/client/DeleteFlavorModal-Dwm0Hh84.mjs +0 -638
- package/dist/client/DeleteFlavorModal-Dwm0Hh84.mjs.map +0 -1
- package/dist/client/_storageType-WwAATdsa.mjs.map +0 -1
- package/dist/client/useErrorTranslation-Dc0eE8Zt.mjs +0 -83
- package/dist/client/useErrorTranslation-Dc0eE8Zt.mjs.map +0 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { n as e } from "./trpcClient-BxcNKnhv.mjs";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import n, { useEffect as r, useState as i } from "react";
|
|
4
|
+
//#region src/client/store/AuthProvider.tsx
|
|
5
|
+
var a = /*#__PURE__*/ n.createContext(null);
|
|
6
|
+
function o({ children: n }) {
|
|
7
|
+
let [o, s] = i(null), [c, l] = i(!0), [u, d] = i(null), [f, p] = i(null), m = (e = !1) => {
|
|
8
|
+
if (window.location.pathname !== "/") {
|
|
9
|
+
let t = e ? `/?redirect=${encodeURIComponent(window.location.pathname + window.location.search)}` : "/";
|
|
10
|
+
window.location.href = t;
|
|
11
|
+
}
|
|
12
|
+
}, h = () => {
|
|
13
|
+
s(null), p(null);
|
|
14
|
+
};
|
|
15
|
+
return r(() => {
|
|
16
|
+
e.auth.getCurrentUserSession.query().then((e) => {
|
|
17
|
+
e && (s(e.user), p(e.expires_at));
|
|
18
|
+
}).catch((e) => {
|
|
19
|
+
d(e instanceof Error ? e.message : "Could not load session");
|
|
20
|
+
}).finally(() => l(!1));
|
|
21
|
+
}, []), r(() => {
|
|
22
|
+
if (!o || !f) return;
|
|
23
|
+
let e = new Date(f).getTime() - Date.now(), t = () => {
|
|
24
|
+
h(), m(!0);
|
|
25
|
+
};
|
|
26
|
+
if (e <= 0) {
|
|
27
|
+
t();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let n = setTimeout(t, e);
|
|
31
|
+
return () => clearTimeout(n);
|
|
32
|
+
}, [o, f]), /*#__PURE__*/ t(a.Provider, {
|
|
33
|
+
value: {
|
|
34
|
+
user: o,
|
|
35
|
+
isAuthenticated: !!o,
|
|
36
|
+
isLoading: c,
|
|
37
|
+
error: u,
|
|
38
|
+
login: async ({ domain: t, user: n, password: r }) => {
|
|
39
|
+
d(null), l(!0);
|
|
40
|
+
try {
|
|
41
|
+
let i = await e.auth.createUserSession.mutate({
|
|
42
|
+
domainName: t,
|
|
43
|
+
user: n,
|
|
44
|
+
password: r
|
|
45
|
+
});
|
|
46
|
+
return s(i.user), p(i.expires_at), { success: !0 };
|
|
47
|
+
} catch (e) {
|
|
48
|
+
return d(e instanceof Error ? e.message : `Could not create session: ${e}`), { success: !1 };
|
|
49
|
+
} finally {
|
|
50
|
+
l(!1);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
logout: async () => {
|
|
54
|
+
l(!0), await e.auth.terminateUserSession.mutate().catch(() => {}), h(), m(!1), window.location.pathname === "/" && l(!1);
|
|
55
|
+
},
|
|
56
|
+
expiresAt: f ? new Date(f) : void 0
|
|
57
|
+
},
|
|
58
|
+
children: n
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function s() {
|
|
62
|
+
let e = n.useContext(a);
|
|
63
|
+
if (!e) throw Error("useAuth must be used within an AuthProvider");
|
|
64
|
+
return e;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { s as n, o as t };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=AuthProvider-p1e1DuKU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthProvider-p1e1DuKU.mjs","names":["React","useEffect","useState","trpcClient","AuthContext","createContext","AuthProvider","children","user","setUser","isLoading","setIsLoading","error","setError","expiresAt","setExpiresAt","redirectToLogin","saveReturnUrl","window","location","pathname","returnUrl","encodeURIComponent","search","href","clearLocalSession","auth","getCurrentUserSession","query","then","session","expires_at","catch","err","Error","message","finally","timeUntilExpiry","Date","getTime","now","handleExpiry","timer","setTimeout","clearTimeout","login","domain","password","createUserSession","mutate","domainName","success","logout","terminateUserSession","Provider","value","isAuthenticated","undefined","useAuth","context","useContext"],"sources":["../../src/client/store/AuthProvider.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\"\nimport { TokenData } from \"../../server/Authentication/types/models\"\nimport { trpcClient } from \"../trpcClient\"\n\nexport type User = TokenData[\"user\"] | null\n\nexport interface AuthContext {\n isAuthenticated: boolean\n isLoading: boolean\n error: string | null\n login: (credentials: { domain: string; user: string; password: string }) => Promise<{ success: boolean }>\n logout: () => Promise<void>\n user?: User\n expiresAt?: Date\n}\n\nconst AuthContext = React.createContext<AuthContext | null>(null)\n\nexport function AuthProvider({ children }: { children: React.ReactNode }) {\n const [user, setUser] = useState<User | null>(null)\n const [isLoading, setIsLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n const [expiresAt, setExpiresAt] = useState<string | null>(null)\n\n // Redirect to login, optionally with return URL\n const redirectToLogin = (saveReturnUrl: boolean = false) => {\n if (window.location.pathname !== \"/\") {\n const returnUrl = saveReturnUrl\n ? `/?redirect=${encodeURIComponent(window.location.pathname + window.location.search)}`\n : \"/\"\n window.location.href = returnUrl\n }\n }\n\n // Clear local session state\n const clearLocalSession = () => {\n setUser(null)\n setExpiresAt(null)\n }\n\n // Get current session on mount\n useEffect(() => {\n trpcClient.auth.getCurrentUserSession\n .query()\n .then((session) => {\n if (session) {\n setUser(session.user)\n setExpiresAt(session.expires_at)\n }\n })\n .catch((err) => {\n setError(err instanceof Error ? err.message : \"Could not load session\")\n })\n .finally(() => setIsLoading(false))\n }, [])\n\n // Auto-logout when session expires\n useEffect(() => {\n if (!user || !expiresAt) return\n\n const timeUntilExpiry = new Date(expiresAt).getTime() - Date.now()\n\n const handleExpiry = () => {\n clearLocalSession()\n redirectToLogin(true)\n }\n\n if (timeUntilExpiry <= 0) {\n handleExpiry()\n return\n }\n\n const timer = setTimeout(handleExpiry, timeUntilExpiry)\n return () => clearTimeout(timer)\n }, [user, expiresAt])\n\n const login = async ({ domain, user, password }: { domain: string; user: string; password: string }) => {\n setError(null)\n setIsLoading(true)\n try {\n const session = await trpcClient.auth.createUserSession.mutate({ domainName: domain, user, password })\n setUser(session.user)\n setExpiresAt(session.expires_at)\n return { success: true }\n } catch (err) {\n setError(err instanceof Error ? err.message : `Could not create session: ${err}`)\n return { success: false }\n } finally {\n setIsLoading(false)\n }\n }\n\n const logout = async () => {\n setIsLoading(true)\n await trpcClient.auth.terminateUserSession.mutate().catch(() => {})\n clearLocalSession()\n redirectToLogin(false) // Don't save return URL on manual logout\n // If already on login page, no redirect happens - reset loading state\n if (window.location.pathname === \"/\") {\n setIsLoading(false)\n }\n }\n\n return (\n <AuthContext.Provider\n value={{\n user,\n isAuthenticated: !!user,\n isLoading,\n error,\n login,\n logout,\n expiresAt: expiresAt ? new Date(expiresAt) : undefined,\n }}\n >\n {children}\n </AuthContext.Provider>\n )\n}\n\nexport function useAuth() {\n const context = React.useContext(AuthContext)\n if (!context) {\n throw new Error(\"useAuth must be used within an AuthProvider\")\n }\n return context\n}\n"],"mappings":";;;;AAgBA,IAAMI,IAAcJ,gBAAMK,cAAkC,IAAA;AAE5D,SAAgBC,EAAa,EAAEC,eAAyC;CACtE,IAAM,CAACC,GAAMC,KAAWP,EAAsB,IAAA,GACxC,CAACQ,GAAWC,KAAgBT,EAAS,EAAA,GACrC,CAACU,GAAOC,KAAYX,EAAwB,IAAA,GAC5C,CAACY,GAAWC,KAAgBb,EAAwB,IAAA,GAGpDc,KAAmBC,IAAyB,OAAK;EACrD,IAAIC,OAAOC,SAASC,aAAa,KAAK;GACpC,IAAMC,IAAYJ,IACd,cAAcK,mBAAmBJ,OAAOC,S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