@nocios/crudify-components 1.0.0 → 1.0.1
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/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/coverage-final.json +0 -85
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -506
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
package/dist/index.d.mts
CHANGED
|
@@ -10,8 +10,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
10
10
|
import { ThemeOptions } from '@mui/material';
|
|
11
11
|
export { A as AutoGenerateConfig, G as GlobalNotificationProvider, a as GlobalNotificationProviderProps, N as Notification, b as NotificationSeverity, d as UseAutoGenerateOptions, U as UseAutoGenerateReturn, c as useAutoGenerate, u as useGlobalNotification } from './GlobalNotificationProvider-Zq18OkpI.mjs';
|
|
12
12
|
export { E as ERROR_CODES, j as ERROR_SEVERITY_MAP, n as ErrorCode, o as ErrorSeverity, q as ErrorTranslationConfig, P as ParsedError, m as createErrorTranslator, d as decodeJwtSafely, a as getCookie, g as getCurrentUserEmail, f as getErrorMessage, h as handleCrudifyError, i as isTokenExpired, p as parseApiError, e as parseJavaScriptError, c as parseTransactionError, b as secureLocalStorage, s as secureSessionStorage, l as translateError, t as translateErrorCode, k as translateErrorCodes } from './errorTranslation-qwwQTvCO.mjs';
|
|
13
|
-
import { ApiResponse, IModule, ModuleCreateInput, ModuleEditInput, ActionListFilters, IAction, ActionCreateInput, ActionEditInput, UpdateActionsProfilesInput, UpdateActionsProfilesResponse, CalculatePermissionsInput, CalculatePermissionsResponse } from '@nocios/crudify-admin';
|
|
14
|
-
export { ActionCreateInput, ActionEditInput, ActionListFilters, ApiResponse, IAction, IModule, ModuleCreateInput, ModuleEditInput, UpdateActionsProfilesInput, UpdateActionsProfilesResponse } from '@nocios/crudify-admin';
|
|
13
|
+
import { ApiResponse, IModule, ModuleCreateInput, ModuleEditInput, ActionListFilters, IAction, ActionCreateInput, ActionEditInput, UpdateActionsProfilesInput, UpdateActionsProfilesResponse, CalculatePermissionsInput, CalculatePermissionsResponse } from '@nocios/crudify-admin-sdk';
|
|
14
|
+
export { ActionCreateInput, ActionEditInput, ActionListFilters, ApiResponse, IAction, IModule, ModuleCreateInput, ModuleEditInput, UpdateActionsProfilesInput, UpdateActionsProfilesResponse } from '@nocios/crudify-admin-sdk';
|
|
15
15
|
|
|
16
16
|
interface CrudifyContextValue {
|
|
17
17
|
crudify: typeof crudify__default | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
10
10
|
import { ThemeOptions } from '@mui/material';
|
|
11
11
|
export { A as AutoGenerateConfig, G as GlobalNotificationProvider, a as GlobalNotificationProviderProps, N as Notification, b as NotificationSeverity, d as UseAutoGenerateOptions, U as UseAutoGenerateReturn, c as useAutoGenerate, u as useGlobalNotification } from './GlobalNotificationProvider-Zq18OkpI.js';
|
|
12
12
|
export { E as ERROR_CODES, j as ERROR_SEVERITY_MAP, n as ErrorCode, o as ErrorSeverity, q as ErrorTranslationConfig, P as ParsedError, m as createErrorTranslator, d as decodeJwtSafely, a as getCookie, g as getCurrentUserEmail, f as getErrorMessage, h as handleCrudifyError, i as isTokenExpired, p as parseApiError, e as parseJavaScriptError, c as parseTransactionError, b as secureLocalStorage, s as secureSessionStorage, l as translateError, t as translateErrorCode, k as translateErrorCodes } from './errorTranslation-DGdrMidg.js';
|
|
13
|
-
import { ApiResponse, IModule, ModuleCreateInput, ModuleEditInput, ActionListFilters, IAction, ActionCreateInput, ActionEditInput, UpdateActionsProfilesInput, UpdateActionsProfilesResponse, CalculatePermissionsInput, CalculatePermissionsResponse } from '@nocios/crudify-admin';
|
|
14
|
-
export { ActionCreateInput, ActionEditInput, ActionListFilters, ApiResponse, IAction, IModule, ModuleCreateInput, ModuleEditInput, UpdateActionsProfilesInput, UpdateActionsProfilesResponse } from '@nocios/crudify-admin';
|
|
13
|
+
import { ApiResponse, IModule, ModuleCreateInput, ModuleEditInput, ActionListFilters, IAction, ActionCreateInput, ActionEditInput, UpdateActionsProfilesInput, UpdateActionsProfilesResponse, CalculatePermissionsInput, CalculatePermissionsResponse } from '@nocios/crudify-admin-sdk';
|
|
14
|
+
export { ActionCreateInput, ActionEditInput, ActionListFilters, ApiResponse, IAction, IModule, ModuleCreateInput, ModuleEditInput, UpdateActionsProfilesInput, UpdateActionsProfilesResponse } from '@nocios/crudify-admin-sdk';
|
|
15
15
|
|
|
16
16
|
interface CrudifyContextValue {
|
|
17
17
|
crudify: typeof crudify__default | null;
|
package/dist/index.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
0% { transform: rotate(0deg); }
|
|
4
4
|
100% { transform: rotate(360deg); }
|
|
5
5
|
}
|
|
6
|
-
`});function g({stage:e="loading",message:r}){let o=r||{initializing:"Initializing application...","validating-session":"Validating session...",loading:"Loading..."}[e];return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, ur,{}),_jsxruntime.jsxs.call(void 0, "div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",width:"100vw",backgroundColor:"#f0f2f5",fontFamily:'"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',color:"#333",textAlign:"center",boxSizing:"border-box",padding:"20px",background:"#fff"},children:[_jsxruntime.jsx.call(void 0, "div",{style:pr}),_jsxruntime.jsx.call(void 0, "p",{style:{fontSize:"1.25em",fontWeight:"500",marginTop:"24px",color:"#1f2937"},children:o})]})]})}var lr=/^[a-zA-Z0-9\-_./\?=&%#]+$/,dr=[/^https?:\/\//i,/^ftp:\/\//i,/^\/\//,/javascript:/i,/data:/i,/vbscript:/i,/about:/i,/\.\.\//,/\.\.\\/,/%2e%2e%2f/i,/%2e%2e%5c/i,/%2f%2f/i,/%5c%5c/i,/[\x00-\x1f\x7f-\x9f]/,/\\/],k= exports.validateInternalRedirect =(e,r="/")=>{if(!e||typeof e!="string")return r;let t=e.trim();if(!t)return r;if(!t.startsWith("/"))return _chunkMFYHD6S5js.a.warn("Open redirect blocked (relative path)",{path:e}),r;if(!lr.test(t))return _chunkMFYHD6S5js.a.warn("Open redirect blocked (invalid characters)",{path:e}),r;let o=t.toLowerCase();for(let i of dr)if(i.test(o))return _chunkMFYHD6S5js.a.warn("Open redirect blocked (dangerous pattern)",{path:e}),r;let n=t.split("?")[0].split("/").filter(Boolean);if(n.length===0)return t;for(let i of n)if(i===".."||i.includes(":")||i.length>100)return _chunkMFYHD6S5js.a.warn("Open redirect blocked (suspicious path part)",{part:i}),r;return t},M= exports.extractSafeRedirectFromUrl =(e,r="/")=>{try{let o=(typeof e=="string"?new URLSearchParams(e):e).get("redirect");if(!o)return r;let n=decodeURIComponent(o);return k(n,r)}catch(t){return _chunkMFYHD6S5js.a.warn("Error parsing redirect parameter",t instanceof Error?{errorMessage:t.message}:{message:String(t)}),r}};function V({children:e,loadingComponent:r,loginPath:t="/login"}){let{isAuthenticated:o,isLoading:n,isLoggingOut:i,isInitialized:y,tokens:c,error:f}=_chunkCHDM7KGHjs.l.call(void 0, ),u=_reactrouterdom.useLocation.call(void 0, );if(!y||n&&!i)return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:r||_jsxruntime.jsx.call(void 0, g,{stage:"validating-session"})});let l=o&&_optionalChain([c, 'optionalAccess', _2 => _2.accessToken])&&c.accessToken.length>0;if(f||!o||!l){if(i)return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:t,replace:!0});let R=u.pathname+u.search;if(u.pathname===t||u.pathname.startsWith(t))return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:t,replace:!0});let S=k(R),w=encodeURIComponent(S);return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:`${t}?redirect=${w}`,replace:!0})}return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e})}var L="crudify_tokens",mr="crudify_enc_key";function B(){try{let e=localStorage.getItem(L);return e?e.startsWith("v2:")&&e.length>50:!1}catch (e2){return!1}}function W(){try{let e=localStorage.getItem(mr);return e!==null&&e.length>=32}catch (e3){return!1}}function U(){return B()&&W()}function H(){try{let e=localStorage.getItem(L);return e?!e.startsWith("v2:")||e.length<50:!1}catch (e4){return!1}}function gr(){try{H()&&localStorage.removeItem(L)}catch (e5){}}function Y({children:e,redirectTo:r="/",loadingComponent:t,initTimeout:o=3e3}){let{isAuthenticated:n,isInitialized:i}=_chunkCHDM7KGHjs.l.call(void 0, ),y=_reactrouterdom.useLocation.call(void 0, ),[c]=_react.useState.call(void 0, ()=>U()),[f,u]=_react.useState.call(void 0, !1);if(_react.useEffect.call(void 0, ()=>{if(!i&&c){let l=setTimeout(()=>{u(!0)},o);return()=>clearTimeout(l)}},[i,c,o]),i&&n){let l=new URLSearchParams(y.search),R=M(l,r);return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:R,replace:!0})}return i&&!n?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):c&&!f?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:t||_jsxruntime.jsx.call(void 0, g,{stage:"validating-session"})}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e})}function J({children:e,behavior:r="redirect-if-authenticated",redirectTo:t="/",loadingComponent:o}){let{isAuthenticated:n,isInitialized:i}=_chunkCHDM7KGHjs.l.call(void 0, );return i?r==="allow-all"?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):n?_jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:t,replace:!0}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:o||_jsxruntime.jsx.call(void 0, g,{stage:"validating-session"})})}var Q=_react.createContext.call(void 0, void 0),hr= exports.CrudifyInitializer =({config:e,children:r,fallback:t=null,onInitialized:o,onError:n})=>{let[i,y]=_react.useState.call(void 0, !1),[c,f]=_react.useState.call(void 0, !1),[u,l]=_react.useState.call(void 0, null),R=_react.useRef.call(void 0, !1),S=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>{R.current||(_chunkCHDM7KGHjs.q.registerHighPriorityInitializer(),R.current=!0),S.current||(S.current=!0,(async()=>{f(!0),l(null);try{let d=_chunkMFYHD6S5js.c.call(void 0, {publicApiKey:_optionalChain([e, 'optionalAccess', _3 => _3.publicApiKey]),env:_optionalChain([e, 'optionalAccess', _4 => _4.env]),enableDebug:_optionalChain([e, 'optionalAccess', _5 => _5.enableLogging])});if(!d.publicApiKey)throw new Error("Crudify configuration missing. Please provide publicApiKey via props or ensure cookies are set by Lambda.");let v=d.env||"prod";_chunkMFYHD6S5js.a.setEnvironment(v),await _chunkCHDM7KGHjs.q.initialize({priority:"HIGH",publicApiKey:d.publicApiKey,env:d.env||"prod",enableLogging:_optionalChain([e, 'optionalAccess', _6 => _6.enableLogging]),requestedBy:"CrudifyInitializer"}),y(!0),f(!1),o&&o()}catch(d){let v=d instanceof Error?d:new Error(String(d));l(v),f(!1),n&&n(v)}})())},[_optionalChain([e, 'optionalAccess', _7 => _7.publicApiKey]),_optionalChain([e, 'optionalAccess', _8 => _8.env]),_optionalChain([e, 'optionalAccess', _9 => _9.enableLogging]),o,n]);let w={isInitialized:i,isInitializing:c,error:u};return c&&t?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:t}):(u&&_chunkMFYHD6S5js.a.error("[CrudifyInitializer] Initialization failed",u),_jsxruntime.jsx.call(void 0, Q.Provider,{value:w,children:r}))},Sr= exports.useCrudifyInitializer =()=>{let e=_react.useContext.call(void 0, Q);if(!e)throw new Error("useCrudifyInitializer must be used within CrudifyInitializer");return e};var _crudifyadmin = require('@nocios/crudify-admin'); var _crudifyadmin2 = _interopRequireDefault(_crudifyadmin);var X=!1,I=null,h=null;async function Tr(){let r=await _chunkCHDM7KGHjs.d.getInstance().getTokenInfo(),t=_optionalChain([r, 'optionalAccess', _10 => _10.apiEndpointAdmin]),o=_optionalChain([r, 'optionalAccess', _11 => _11.apiKeyEndpointAdmin]);return t&&o?{apiUrl:t,apiKey:o}:_chunkCHDM7KGHjs.h.waitForCredentials()}async function Er(){if(!X)return I||(I=(async()=>{try{let e=_chunkCHDM7KGHjs.d.getInstance(),{apiUrl:r,apiKey:t}=await Tr();h=await _asyncOptionalChain([(await e.getTokenInfo()), 'optionalAccess', async _12 => _12.crudifyTokens, 'optionalAccess', async _13 => _13.accessToken])||null,_crudifyadmin2.default.init({url:r,apiKey:t,getAdditionalHeaders:()=>h?{Authorization:`Bearer ${h}`}:{}}),X=!0}catch(e){throw I=null,_chunkMFYHD6S5js.a.error("[crudifyAdminWrapper] Initialization failed",e instanceof Error?e:{message:String(e)}),e}})(),I)}async function a(e){try{await Er();let r=_chunkCHDM7KGHjs.d.getInstance();h=await _asyncOptionalChain([(await r.getTokenInfo()), 'optionalAccess', async _14 => _14.crudifyTokens, 'optionalAccess', async _15 => _15.accessToken])||null;let o=await e(),n=o.errors&&(typeof o.errors=="string"&&o.errors.includes("401")||Array.isArray(o.errors)&&o.errors.some(i=>typeof i=="string"&&i.includes("401")));return!o.success&&n?await r.refreshTokens()?(h=await _asyncOptionalChain([(await r.getTokenInfo()), 'optionalAccess', async _16 => _16.crudifyTokens, 'optionalAccess', async _17 => _17.accessToken])||null,await e()):(_chunkMFYHD6S5js.a.error("[crudifyAdmin] Token refresh failed"),typeof window<"u"&&(window.location.href="/login"),o):o}catch(r){return _chunkMFYHD6S5js.a.error("[crudifyAdmin] Operation error",r instanceof Error?r:{message:String(r)}),{success:!1,errors:r instanceof Error?r.message:"Unknown error"}}}var kr={listModules:()=>a(()=>_crudifyadmin2.default.listModules()),getModule:e=>a(()=>_crudifyadmin2.default.getModule(e)),createModule:e=>a(()=>_crudifyadmin2.default.createModule(e)),editModule:(e,r)=>a(()=>_crudifyadmin2.default.editModule(e,r)),deleteModule:e=>a(()=>_crudifyadmin2.default.deleteModule(e)),activateModule:e=>a(()=>_crudifyadmin2.default.activateModule(e)),deactivateModule:e=>a(()=>_crudifyadmin2.default.deactivateModule(e)),getModuleVersions:e=>a(()=>_crudifyadmin2.default.getModuleVersions(e)),listActions:e=>a(()=>_crudifyadmin2.default.listActions(e)),getAction:e=>a(()=>_crudifyadmin2.default.getAction(e)),createAction:e=>a(()=>_crudifyadmin2.default.createAction(e)),editAction:(e,r)=>a(()=>_crudifyadmin2.default.editAction(e,r)),deleteAction:e=>a(()=>_crudifyadmin2.default.deleteAction(e)),activateAction:e=>a(()=>_crudifyadmin2.default.activateAction(e)),deactivateAction:e=>a(()=>_crudifyadmin2.default.deactivateAction(e)),getActionVersions:e=>a(()=>_crudifyadmin2.default.getActionVersions(e)),getActionsByProfile:e=>a(()=>_crudifyadmin2.default.getActionsByProfile(e)),updateActionsProfiles:e=>a(()=>_crudifyadmin2.default.updateActionsProfiles(e)),calculatePermissions:e=>a(()=>_crudifyadmin2.default.calculatePermissions(e))};exports.AuthRoute = Y; exports.CRITICAL_TRANSLATIONS = _chunkPNI3ZBZVjs.a; exports.CrossTabSyncManager = _chunkCHDM7KGHjs.b; exports.CrudiaAutoGenerate = _chunkPNI3ZBZVjs.s; exports.CrudiaFileField = _chunkPNI3ZBZVjs.t; exports.CrudiaMarkdownField = _chunkPNI3ZBZVjs.u; exports.CrudifyInitializationManager = _chunkCHDM7KGHjs.p; exports.CrudifyInitializer = hr; exports.CrudifyLogin = _chunkPNI3ZBZVjs.l; exports.CrudifyProvider = _chunkCHDM7KGHjs.i; exports.CrudifyThemeProvider = nr; exports.DEFAULT_PASSWORD_RULES = _chunkPNI3ZBZVjs.k; exports.ERROR_CODES = _chunkNSV6ECYOjs.a; exports.ERROR_SEVERITY_MAP = _chunkNSV6ECYOjs.b; exports.GlobalNotificationProvider = _chunkCHDM7KGHjs.f; exports.GuestRoute = J; exports.LoginComponent = _chunkPNI3ZBZVjs.q; exports.POLICY_ACTIONS = _chunkPNI3ZBZVjs.n; exports.PREFERRED_POLICY_ORDER = _chunkPNI3ZBZVjs.o; exports.PasswordRequirements = _chunkPNI3ZBZVjs.h; exports.Policies = _chunkPNI3ZBZVjs.p; exports.ProtectedRoute = V; exports.SessionDebugInfo = _chunkCHDM7KGHjs.m; exports.SessionLoadingScreen = g; exports.SessionManager = _chunkCHDM7KGHjs.d; exports.SessionProvider = _chunkCHDM7KGHjs.k; exports.SessionStatus = _chunkPNI3ZBZVjs.r; exports.TokenStorage = _chunkCHDM7KGHjs.a; exports.TranslationService = _chunkPNI3ZBZVjs.d; exports.TranslationsProvider = _chunkPNI3ZBZVjs.f; exports.UserProfileDisplay = _chunkPNI3ZBZVjs.m; exports.allPasswordRulesPassed = _chunkPNI3ZBZVjs.j; exports.clearCorruptedTokens = gr; exports.createErrorTranslator = _chunkMFYHD6S5js.o; exports.crossTabSync = _chunkCHDM7KGHjs.c; exports.crudify = _crudifysdk2.default; exports.crudifyAdmin = kr; exports.crudifyInitManager = _chunkCHDM7KGHjs.q; exports.decodeJwtSafely = _chunkMFYHD6S5js.q; exports.evaluatePasswordRules = _chunkPNI3ZBZVjs.i; exports.extractSafeRedirectFromUrl = M; exports.getCookie = _chunkMFYHD6S5js.b; exports.getCriticalLanguages = _chunkPNI3ZBZVjs.b; exports.getCriticalTranslations = _chunkPNI3ZBZVjs.c; exports.getCurrentUserEmail = _chunkMFYHD6S5js.r; exports.getErrorMessage = _chunkNSV6ECYOjs.e; exports.handleCrudifyError = _chunkNSV6ECYOjs.g; exports.hasCorruptedTokens = H; exports.hasEncryptionKeyHash = W; exports.hasStoredTokens = B; exports.isTokenExpired = _chunkMFYHD6S5js.s; exports.logger = _chunkMFYHD6S5js.a; exports.parseApiError = _chunkNSV6ECYOjs.c; exports.parseJavaScriptError = _chunkNSV6ECYOjs.f; exports.parseTransactionError = _chunkNSV6ECYOjs.d; exports.secureLocalStorage = _chunk5HFI5CZ5js.b; exports.secureSessionStorage = _chunk5HFI5CZ5js.a; exports.shouldWaitForInitialization = U; exports.translateError = _chunkMFYHD6S5js.n; exports.translateErrorCode = _chunkMFYHD6S5js.l; exports.translateErrorCodes = _chunkMFYHD6S5js.m; exports.translationService = _chunkPNI3ZBZVjs.e; exports.useAuth = _chunk2XOTIEKSjs.b; exports.useAutoGenerate = _chunkCHDM7KGHjs.o; exports.useCrudify = _chunkCHDM7KGHjs.j; exports.useCrudifyInitializer = Sr; exports.useCrudifyWithNotifications = _chunk2XOTIEKSjs.d; exports.useData = _chunk2XOTIEKSjs.c; exports.useFileUpload = _chunkCHDM7KGHjs.r; exports.useGlobalNotification = _chunkCHDM7KGHjs.g; exports.useSession = _chunkCHDM7KGHjs.e; exports.useSessionContext = _chunkCHDM7KGHjs.l; exports.useTranslations = _chunkPNI3ZBZVjs.g; exports.useUserData = _chunk2XOTIEKSjs.a; exports.useUserProfile = _chunkCHDM7KGHjs.n; exports.validateInternalRedirect = k;
|
|
6
|
+
`});function g({stage:e="loading",message:r}){let o=r||{initializing:"Initializing application...","validating-session":"Validating session...",loading:"Loading..."}[e];return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, ur,{}),_jsxruntime.jsxs.call(void 0, "div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",width:"100vw",backgroundColor:"#f0f2f5",fontFamily:'"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',color:"#333",textAlign:"center",boxSizing:"border-box",padding:"20px",background:"#fff"},children:[_jsxruntime.jsx.call(void 0, "div",{style:pr}),_jsxruntime.jsx.call(void 0, "p",{style:{fontSize:"1.25em",fontWeight:"500",marginTop:"24px",color:"#1f2937"},children:o})]})]})}var lr=/^[a-zA-Z0-9\-_./\?=&%#]+$/,dr=[/^https?:\/\//i,/^ftp:\/\//i,/^\/\//,/javascript:/i,/data:/i,/vbscript:/i,/about:/i,/\.\.\//,/\.\.\\/,/%2e%2e%2f/i,/%2e%2e%5c/i,/%2f%2f/i,/%5c%5c/i,/[\x00-\x1f\x7f-\x9f]/,/\\/],E= exports.validateInternalRedirect =(e,r="/")=>{if(!e||typeof e!="string")return r;let t=e.trim();if(!t)return r;if(!t.startsWith("/"))return _chunkMFYHD6S5js.a.warn("Open redirect blocked (relative path)",{path:e}),r;if(!lr.test(t))return _chunkMFYHD6S5js.a.warn("Open redirect blocked (invalid characters)",{path:e}),r;let o=t.toLowerCase();for(let i of dr)if(i.test(o))return _chunkMFYHD6S5js.a.warn("Open redirect blocked (dangerous pattern)",{path:e}),r;let n=t.split("?")[0].split("/").filter(Boolean);if(n.length===0)return t;for(let i of n)if(i===".."||i.includes(":")||i.length>100)return _chunkMFYHD6S5js.a.warn("Open redirect blocked (suspicious path part)",{part:i}),r;return t},M= exports.extractSafeRedirectFromUrl =(e,r="/")=>{try{let o=(typeof e=="string"?new URLSearchParams(e):e).get("redirect");if(!o)return r;let n=decodeURIComponent(o);return E(n,r)}catch(t){return _chunkMFYHD6S5js.a.warn("Error parsing redirect parameter",t instanceof Error?{errorMessage:t.message}:{message:String(t)}),r}};function V({children:e,loadingComponent:r,loginPath:t="/login"}){let{isAuthenticated:o,isLoading:n,isLoggingOut:i,isInitialized:y,tokens:c,error:f}=_chunkCHDM7KGHjs.l.call(void 0, ),u=_reactrouterdom.useLocation.call(void 0, );if(!y||n&&!i)return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:r||_jsxruntime.jsx.call(void 0, g,{stage:"validating-session"})});let l=o&&_optionalChain([c, 'optionalAccess', _2 => _2.accessToken])&&c.accessToken.length>0;if(f||!o||!l){if(i)return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:t,replace:!0});let R=u.pathname+u.search;if(u.pathname===t||u.pathname.startsWith(t))return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:t,replace:!0});let S=E(R),w=encodeURIComponent(S);return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:`${t}?redirect=${w}`,replace:!0})}return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e})}var L="crudify_tokens",mr="crudify_enc_key";function B(){try{let e=localStorage.getItem(L);return e?e.startsWith("v2:")&&e.length>50:!1}catch (e2){return!1}}function W(){try{let e=localStorage.getItem(mr);return e!==null&&e.length>=32}catch (e3){return!1}}function U(){return B()&&W()}function H(){try{let e=localStorage.getItem(L);return e?!e.startsWith("v2:")||e.length<50:!1}catch (e4){return!1}}function gr(){try{H()&&localStorage.removeItem(L)}catch (e5){}}function Y({children:e,redirectTo:r="/",loadingComponent:t,initTimeout:o=3e3}){let{isAuthenticated:n,isInitialized:i}=_chunkCHDM7KGHjs.l.call(void 0, ),y=_reactrouterdom.useLocation.call(void 0, ),[c]=_react.useState.call(void 0, ()=>U()),[f,u]=_react.useState.call(void 0, !1);if(_react.useEffect.call(void 0, ()=>{if(!i&&c){let l=setTimeout(()=>{u(!0)},o);return()=>clearTimeout(l)}},[i,c,o]),i&&n){let l=new URLSearchParams(y.search),R=M(l,r);return _jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:R,replace:!0})}return i&&!n?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):c&&!f?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:t||_jsxruntime.jsx.call(void 0, g,{stage:"validating-session"})}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e})}function J({children:e,behavior:r="redirect-if-authenticated",redirectTo:t="/",loadingComponent:o}){let{isAuthenticated:n,isInitialized:i}=_chunkCHDM7KGHjs.l.call(void 0, );return i?r==="allow-all"?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):n?_jsxruntime.jsx.call(void 0, _reactrouterdom.Navigate,{to:t,replace:!0}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:e}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:o||_jsxruntime.jsx.call(void 0, g,{stage:"validating-session"})})}var Q=_react.createContext.call(void 0, void 0),hr= exports.CrudifyInitializer =({config:e,children:r,fallback:t=null,onInitialized:o,onError:n})=>{let[i,y]=_react.useState.call(void 0, !1),[c,f]=_react.useState.call(void 0, !1),[u,l]=_react.useState.call(void 0, null),R=_react.useRef.call(void 0, !1),S=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>{R.current||(_chunkCHDM7KGHjs.q.registerHighPriorityInitializer(),R.current=!0),S.current||(S.current=!0,(async()=>{f(!0),l(null);try{let d=_chunkMFYHD6S5js.c.call(void 0, {publicApiKey:_optionalChain([e, 'optionalAccess', _3 => _3.publicApiKey]),env:_optionalChain([e, 'optionalAccess', _4 => _4.env]),enableDebug:_optionalChain([e, 'optionalAccess', _5 => _5.enableLogging])});if(!d.publicApiKey)throw new Error("Crudify configuration missing. Please provide publicApiKey via props or ensure cookies are set by Lambda.");let v=d.env||"prod";_chunkMFYHD6S5js.a.setEnvironment(v),await _chunkCHDM7KGHjs.q.initialize({priority:"HIGH",publicApiKey:d.publicApiKey,env:d.env||"prod",enableLogging:_optionalChain([e, 'optionalAccess', _6 => _6.enableLogging]),requestedBy:"CrudifyInitializer"}),y(!0),f(!1),o&&o()}catch(d){let v=d instanceof Error?d:new Error(String(d));l(v),f(!1),n&&n(v)}})())},[_optionalChain([e, 'optionalAccess', _7 => _7.publicApiKey]),_optionalChain([e, 'optionalAccess', _8 => _8.env]),_optionalChain([e, 'optionalAccess', _9 => _9.enableLogging]),o,n]);let w={isInitialized:i,isInitializing:c,error:u};return c&&t?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:t}):(u&&_chunkMFYHD6S5js.a.error("[CrudifyInitializer] Initialization failed",u),_jsxruntime.jsx.call(void 0, Q.Provider,{value:w,children:r}))},Sr= exports.useCrudifyInitializer =()=>{let e=_react.useContext.call(void 0, Q);if(!e)throw new Error("useCrudifyInitializer must be used within CrudifyInitializer");return e};var _crudifyadminsdk = require('@nocios/crudify-admin-sdk'); var _crudifyadminsdk2 = _interopRequireDefault(_crudifyadminsdk);var X=!1,I=null,h=null;async function Tr(){let r=await _chunkCHDM7KGHjs.d.getInstance().getTokenInfo(),t=_optionalChain([r, 'optionalAccess', _10 => _10.apiEndpointAdmin]),o=_optionalChain([r, 'optionalAccess', _11 => _11.apiKeyEndpointAdmin]);return t&&o?{apiUrl:t,apiKey:o}:_chunkCHDM7KGHjs.h.waitForCredentials()}async function kr(){if(!X)return I||(I=(async()=>{try{let e=_chunkCHDM7KGHjs.d.getInstance(),{apiUrl:r,apiKey:t}=await Tr();h=await _asyncOptionalChain([(await e.getTokenInfo()), 'optionalAccess', async _12 => _12.crudifyTokens, 'optionalAccess', async _13 => _13.accessToken])||null,_crudifyadminsdk2.default.init({url:r,apiKey:t,getAdditionalHeaders:()=>h?{Authorization:`Bearer ${h}`}:{}}),X=!0}catch(e){throw I=null,_chunkMFYHD6S5js.a.error("[crudifyAdminWrapper] Initialization failed",e instanceof Error?e:{message:String(e)}),e}})(),I)}async function a(e){try{await kr();let r=_chunkCHDM7KGHjs.d.getInstance();h=await _asyncOptionalChain([(await r.getTokenInfo()), 'optionalAccess', async _14 => _14.crudifyTokens, 'optionalAccess', async _15 => _15.accessToken])||null;let o=await e(),n=o.errors&&(typeof o.errors=="string"&&o.errors.includes("401")||Array.isArray(o.errors)&&o.errors.some(i=>typeof i=="string"&&i.includes("401")));return!o.success&&n?await r.refreshTokens()?(h=await _asyncOptionalChain([(await r.getTokenInfo()), 'optionalAccess', async _16 => _16.crudifyTokens, 'optionalAccess', async _17 => _17.accessToken])||null,await e()):(_chunkMFYHD6S5js.a.error("[crudifyAdmin] Token refresh failed"),typeof window<"u"&&(window.location.href="/login"),o):o}catch(r){return _chunkMFYHD6S5js.a.error("[crudifyAdmin] Operation error",r instanceof Error?r:{message:String(r)}),{success:!1,errors:r instanceof Error?r.message:"Unknown error"}}}var Er={listModules:()=>a(()=>_crudifyadminsdk2.default.listModules()),getModule:e=>a(()=>_crudifyadminsdk2.default.getModule(e)),createModule:e=>a(()=>_crudifyadminsdk2.default.createModule(e)),editModule:(e,r)=>a(()=>_crudifyadminsdk2.default.editModule(e,r)),deleteModule:e=>a(()=>_crudifyadminsdk2.default.deleteModule(e)),activateModule:e=>a(()=>_crudifyadminsdk2.default.activateModule(e)),deactivateModule:e=>a(()=>_crudifyadminsdk2.default.deactivateModule(e)),getModuleVersions:e=>a(()=>_crudifyadminsdk2.default.getModuleVersions(e)),listActions:e=>a(()=>_crudifyadminsdk2.default.listActions(e)),getAction:e=>a(()=>_crudifyadminsdk2.default.getAction(e)),createAction:e=>a(()=>_crudifyadminsdk2.default.createAction(e)),editAction:(e,r)=>a(()=>_crudifyadminsdk2.default.editAction(e,r)),deleteAction:e=>a(()=>_crudifyadminsdk2.default.deleteAction(e)),activateAction:e=>a(()=>_crudifyadminsdk2.default.activateAction(e)),deactivateAction:e=>a(()=>_crudifyadminsdk2.default.deactivateAction(e)),getActionVersions:e=>a(()=>_crudifyadminsdk2.default.getActionVersions(e)),getActionsByProfile:e=>a(()=>_crudifyadminsdk2.default.getActionsByProfile(e)),updateActionsProfiles:e=>a(()=>_crudifyadminsdk2.default.updateActionsProfiles(e)),calculatePermissions:e=>a(()=>_crudifyadminsdk2.default.calculatePermissions(e))};exports.AuthRoute = Y; exports.CRITICAL_TRANSLATIONS = _chunkPNI3ZBZVjs.a; exports.CrossTabSyncManager = _chunkCHDM7KGHjs.b; exports.CrudiaAutoGenerate = _chunkPNI3ZBZVjs.s; exports.CrudiaFileField = _chunkPNI3ZBZVjs.t; exports.CrudiaMarkdownField = _chunkPNI3ZBZVjs.u; exports.CrudifyInitializationManager = _chunkCHDM7KGHjs.p; exports.CrudifyInitializer = hr; exports.CrudifyLogin = _chunkPNI3ZBZVjs.l; exports.CrudifyProvider = _chunkCHDM7KGHjs.i; exports.CrudifyThemeProvider = nr; exports.DEFAULT_PASSWORD_RULES = _chunkPNI3ZBZVjs.k; exports.ERROR_CODES = _chunkNSV6ECYOjs.a; exports.ERROR_SEVERITY_MAP = _chunkNSV6ECYOjs.b; exports.GlobalNotificationProvider = _chunkCHDM7KGHjs.f; exports.GuestRoute = J; exports.LoginComponent = _chunkPNI3ZBZVjs.q; exports.POLICY_ACTIONS = _chunkPNI3ZBZVjs.n; exports.PREFERRED_POLICY_ORDER = _chunkPNI3ZBZVjs.o; exports.PasswordRequirements = _chunkPNI3ZBZVjs.h; exports.Policies = _chunkPNI3ZBZVjs.p; exports.ProtectedRoute = V; exports.SessionDebugInfo = _chunkCHDM7KGHjs.m; exports.SessionLoadingScreen = g; exports.SessionManager = _chunkCHDM7KGHjs.d; exports.SessionProvider = _chunkCHDM7KGHjs.k; exports.SessionStatus = _chunkPNI3ZBZVjs.r; exports.TokenStorage = _chunkCHDM7KGHjs.a; exports.TranslationService = _chunkPNI3ZBZVjs.d; exports.TranslationsProvider = _chunkPNI3ZBZVjs.f; exports.UserProfileDisplay = _chunkPNI3ZBZVjs.m; exports.allPasswordRulesPassed = _chunkPNI3ZBZVjs.j; exports.clearCorruptedTokens = gr; exports.createErrorTranslator = _chunkMFYHD6S5js.o; exports.crossTabSync = _chunkCHDM7KGHjs.c; exports.crudify = _crudifysdk2.default; exports.crudifyAdmin = Er; exports.crudifyInitManager = _chunkCHDM7KGHjs.q; exports.decodeJwtSafely = _chunkMFYHD6S5js.q; exports.evaluatePasswordRules = _chunkPNI3ZBZVjs.i; exports.extractSafeRedirectFromUrl = M; exports.getCookie = _chunkMFYHD6S5js.b; exports.getCriticalLanguages = _chunkPNI3ZBZVjs.b; exports.getCriticalTranslations = _chunkPNI3ZBZVjs.c; exports.getCurrentUserEmail = _chunkMFYHD6S5js.r; exports.getErrorMessage = _chunkNSV6ECYOjs.e; exports.handleCrudifyError = _chunkNSV6ECYOjs.g; exports.hasCorruptedTokens = H; exports.hasEncryptionKeyHash = W; exports.hasStoredTokens = B; exports.isTokenExpired = _chunkMFYHD6S5js.s; exports.logger = _chunkMFYHD6S5js.a; exports.parseApiError = _chunkNSV6ECYOjs.c; exports.parseJavaScriptError = _chunkNSV6ECYOjs.f; exports.parseTransactionError = _chunkNSV6ECYOjs.d; exports.secureLocalStorage = _chunk5HFI5CZ5js.b; exports.secureSessionStorage = _chunk5HFI5CZ5js.a; exports.shouldWaitForInitialization = U; exports.translateError = _chunkMFYHD6S5js.n; exports.translateErrorCode = _chunkMFYHD6S5js.l; exports.translateErrorCodes = _chunkMFYHD6S5js.m; exports.translationService = _chunkPNI3ZBZVjs.e; exports.useAuth = _chunk2XOTIEKSjs.b; exports.useAutoGenerate = _chunkCHDM7KGHjs.o; exports.useCrudify = _chunkCHDM7KGHjs.j; exports.useCrudifyInitializer = Sr; exports.useCrudifyWithNotifications = _chunk2XOTIEKSjs.d; exports.useData = _chunk2XOTIEKSjs.c; exports.useFileUpload = _chunkCHDM7KGHjs.r; exports.useGlobalNotification = _chunkCHDM7KGHjs.g; exports.useSession = _chunkCHDM7KGHjs.e; exports.useSessionContext = _chunkCHDM7KGHjs.l; exports.useTranslations = _chunkPNI3ZBZVjs.g; exports.useUserData = _chunk2XOTIEKSjs.a; exports.useUserProfile = _chunkCHDM7KGHjs.n; exports.validateInternalRedirect = E;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as j,b as ee,c as re,d as te,e as oe,f as ie,g as ne,h as be,i as Me,j as ze,k as Le,l as Ue,m as Fe,n as Ne,o as Ge,p as De,q as Ke,r as _e,s as Be,t as qe,u as Ye}from"./chunk-HVTRRU4W.mjs";import{a as Je,b as $e,c as Ze,d as je}from"./chunk-U4RS66TB.mjs";import{a as se,b as le,c as de,d as A,e as fe,f as Re,g as xe,h as D,i as Ae,j as Ce,k as Pe,l as m,m as Ie,n as Oe,o as Ve,p as We,q as T,r as He}from"./chunk-NBQH6QOU.mjs";import{a as Qe,b as Xe}from"./chunk-JNEWPO2J.mjs";import{a as he,b as Se,c as ve,d as Te,e as
|
|
1
|
+
import{a as j,b as ee,c as re,d as te,e as oe,f as ie,g as ne,h as be,i as Me,j as ze,k as Le,l as Ue,m as Fe,n as Ne,o as Ge,p as De,q as Ke,r as _e,s as Be,t as qe,u as Ye}from"./chunk-HVTRRU4W.mjs";import{a as Je,b as $e,c as Ze,d as je}from"./chunk-U4RS66TB.mjs";import{a as se,b as le,c as de,d as A,e as fe,f as Re,g as xe,h as D,i as Ae,j as Ce,k as Pe,l as m,m as Ie,n as Oe,o as Ve,p as We,q as T,r as He}from"./chunk-NBQH6QOU.mjs";import{a as Qe,b as Xe}from"./chunk-JNEWPO2J.mjs";import{a as he,b as Se,c as ve,d as Te,e as ke,f as Ee,g as we}from"./chunk-JAPL7EZJ.mjs";import{a as p,b,c as G,l as ae,m as pe,n as ue,o as ce,q as me,r as ge,s as ye}from"./chunk-MGJZTOEM.mjs";import{default as Tt}from"@nocios/crudify-sdk";export*from"@nocios/crudify-sdk";import{useMemo as er}from"react";import{ThemeProvider as rr,createTheme as tr,CssBaseline as or}from"@mui/material";import{jsx as sr,jsxs as ar}from"react/jsx-runtime";var ir=(e={})=>{try{let r=b("theme");if(r){let t=JSON.parse(decodeURIComponent(r));return{...e,...t}}}catch(r){p.warn("Error parsing theme from cookie",r instanceof Error?{errorMessage:r.message}:{message:String(r)})}return e};function nr({children:e,defaultTheme:r={},disableCssBaseline:t=!1}){let o=er(()=>{let n=ir(r);return tr(n)},[r]);return ar(rr,{theme:o,children:[!t&&sr(or,{}),e]})}import{Navigate as z,useLocation as fr}from"react-router-dom";import{Fragment as cr,jsx as k,jsxs as K}from"react/jsx-runtime";var pr={border:"5px solid rgba(0, 0, 0, 0.1)",borderTopColor:"#3B82F6",borderRadius:"50%",width:"50px",height:"50px",animation:"spin 1s linear infinite"},ur=()=>k("style",{children:`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
0% { transform: rotate(0deg); }
|
|
4
4
|
100% { transform: rotate(360deg); }
|
|
5
5
|
}
|
|
6
|
-
`});function g({stage:e="loading",message:r}){let o=r||{initializing:"Initializing application...","validating-session":"Validating session...",loading:"Loading..."}[e];return K(cr,{children:[
|
|
6
|
+
`});function g({stage:e="loading",message:r}){let o=r||{initializing:"Initializing application...","validating-session":"Validating session...",loading:"Loading..."}[e];return K(cr,{children:[k(ur,{}),K("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",width:"100vw",backgroundColor:"#f0f2f5",fontFamily:'"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',color:"#333",textAlign:"center",boxSizing:"border-box",padding:"20px",background:"#fff"},children:[k("div",{style:pr}),k("p",{style:{fontSize:"1.25em",fontWeight:"500",marginTop:"24px",color:"#1f2937"},children:o})]})]})}var lr=/^[a-zA-Z0-9\-_./\?=&%#]+$/,dr=[/^https?:\/\//i,/^ftp:\/\//i,/^\/\//,/javascript:/i,/data:/i,/vbscript:/i,/about:/i,/\.\.\//,/\.\.\\/,/%2e%2e%2f/i,/%2e%2e%5c/i,/%2f%2f/i,/%5c%5c/i,/[\x00-\x1f\x7f-\x9f]/,/\\/],E=(e,r="/")=>{if(!e||typeof e!="string")return r;let t=e.trim();if(!t)return r;if(!t.startsWith("/"))return p.warn("Open redirect blocked (relative path)",{path:e}),r;if(!lr.test(t))return p.warn("Open redirect blocked (invalid characters)",{path:e}),r;let o=t.toLowerCase();for(let i of dr)if(i.test(o))return p.warn("Open redirect blocked (dangerous pattern)",{path:e}),r;let n=t.split("?")[0].split("/").filter(Boolean);if(n.length===0)return t;for(let i of n)if(i===".."||i.includes(":")||i.length>100)return p.warn("Open redirect blocked (suspicious path part)",{part:i}),r;return t},M=(e,r="/")=>{try{let o=(typeof e=="string"?new URLSearchParams(e):e).get("redirect");if(!o)return r;let n=decodeURIComponent(o);return E(n,r)}catch(t){return p.warn("Error parsing redirect parameter",t instanceof Error?{errorMessage:t.message}:{message:String(t)}),r}};import{Fragment as _,jsx as x}from"react/jsx-runtime";function V({children:e,loadingComponent:r,loginPath:t="/login"}){let{isAuthenticated:o,isLoading:n,isLoggingOut:i,isInitialized:y,tokens:c,error:f}=m(),u=fr();if(!y||n&&!i)return x(_,{children:r||x(g,{stage:"validating-session"})});let l=o&&c?.accessToken&&c.accessToken.length>0;if(f||!o||!l){if(i)return x(z,{to:t,replace:!0});let R=u.pathname+u.search;if(u.pathname===t||u.pathname.startsWith(t))return x(z,{to:t,replace:!0});let S=E(R),w=encodeURIComponent(S);return x(z,{to:`${t}?redirect=${w}`,replace:!0})}return x(_,{children:e})}import{useState as q,useEffect as yr}from"react";import{Navigate as Rr,useLocation as xr}from"react-router-dom";var L="crudify_tokens",mr="crudify_enc_key";function B(){try{let e=localStorage.getItem(L);return e?e.startsWith("v2:")&&e.length>50:!1}catch{return!1}}function W(){try{let e=localStorage.getItem(mr);return e!==null&&e.length>=32}catch{return!1}}function U(){return B()&&W()}function H(){try{let e=localStorage.getItem(L);return e?!e.startsWith("v2:")||e.length<50:!1}catch{return!1}}function gr(){try{H()&&localStorage.removeItem(L)}catch{}}import{Fragment as O,jsx as C}from"react/jsx-runtime";function Y({children:e,redirectTo:r="/",loadingComponent:t,initTimeout:o=3e3}){let{isAuthenticated:n,isInitialized:i}=m(),y=xr(),[c]=q(()=>U()),[f,u]=q(!1);if(yr(()=>{if(!i&&c){let l=setTimeout(()=>{u(!0)},o);return()=>clearTimeout(l)}},[i,c,o]),i&&n){let l=new URLSearchParams(y.search),R=M(l,r);return C(Rr,{to:R,replace:!0})}return i&&!n?C(O,{children:e}):c&&!f?C(O,{children:t||C(g,{stage:"validating-session"})}):C(O,{children:e})}import{Navigate as Ar}from"react-router-dom";import{Fragment as F,jsx as P}from"react/jsx-runtime";function J({children:e,behavior:r="redirect-if-authenticated",redirectTo:t="/",loadingComponent:o}){let{isAuthenticated:n,isInitialized:i}=m();return i?r==="allow-all"?P(F,{children:e}):n?P(Ar,{to:t,replace:!0}):P(F,{children:e}):P(F,{children:o||P(g,{stage:"validating-session"})})}import{createContext as Cr,useContext as Pr,useEffect as Ir,useRef as $,useState as N}from"react";import{Fragment as vr,jsx as Z}from"react/jsx-runtime";var Q=Cr(void 0),hr=({config:e,children:r,fallback:t=null,onInitialized:o,onError:n})=>{let[i,y]=N(!1),[c,f]=N(!1),[u,l]=N(null),R=$(!1),S=$(!1);Ir(()=>{R.current||(T.registerHighPriorityInitializer(),R.current=!0),S.current||(S.current=!0,(async()=>{f(!0),l(null);try{let d=G({publicApiKey:e?.publicApiKey,env:e?.env,enableDebug:e?.enableLogging});if(!d.publicApiKey)throw new Error("Crudify configuration missing. Please provide publicApiKey via props or ensure cookies are set by Lambda.");let v=d.env||"prod";p.setEnvironment(v),await T.initialize({priority:"HIGH",publicApiKey:d.publicApiKey,env:d.env||"prod",enableLogging:e?.enableLogging,requestedBy:"CrudifyInitializer"}),y(!0),f(!1),o&&o()}catch(d){let v=d instanceof Error?d:new Error(String(d));l(v),f(!1),n&&n(v)}})())},[e?.publicApiKey,e?.env,e?.enableLogging,o,n]);let w={isInitialized:i,isInitializing:c,error:u};return c&&t?Z(vr,{children:t}):(u&&p.error("[CrudifyInitializer] Initialization failed",u),Z(Q.Provider,{value:w,children:r}))},Sr=()=>{let e=Pr(Q);if(!e)throw new Error("useCrudifyInitializer must be used within CrudifyInitializer");return e};import s from"@nocios/crudify-admin-sdk";var X=!1,I=null,h=null;async function Tr(){let r=await A.getInstance().getTokenInfo(),t=r?.apiEndpointAdmin,o=r?.apiKeyEndpointAdmin;return t&&o?{apiUrl:t,apiKey:o}:D.waitForCredentials()}async function kr(){if(!X)return I||(I=(async()=>{try{let e=A.getInstance(),{apiUrl:r,apiKey:t}=await Tr();h=(await e.getTokenInfo())?.crudifyTokens?.accessToken||null,s.init({url:r,apiKey:t,getAdditionalHeaders:()=>h?{Authorization:`Bearer ${h}`}:{}}),X=!0}catch(e){throw I=null,p.error("[crudifyAdminWrapper] Initialization failed",e instanceof Error?e:{message:String(e)}),e}})(),I)}async function a(e){try{await kr();let r=A.getInstance();h=(await r.getTokenInfo())?.crudifyTokens?.accessToken||null;let o=await e(),n=o.errors&&(typeof o.errors=="string"&&o.errors.includes("401")||Array.isArray(o.errors)&&o.errors.some(i=>typeof i=="string"&&i.includes("401")));return!o.success&&n?await r.refreshTokens()?(h=(await r.getTokenInfo())?.crudifyTokens?.accessToken||null,await e()):(p.error("[crudifyAdmin] Token refresh failed"),typeof window<"u"&&(window.location.href="/login"),o):o}catch(r){return p.error("[crudifyAdmin] Operation error",r instanceof Error?r:{message:String(r)}),{success:!1,errors:r instanceof Error?r.message:"Unknown error"}}}var Er={listModules:()=>a(()=>s.listModules()),getModule:e=>a(()=>s.getModule(e)),createModule:e=>a(()=>s.createModule(e)),editModule:(e,r)=>a(()=>s.editModule(e,r)),deleteModule:e=>a(()=>s.deleteModule(e)),activateModule:e=>a(()=>s.activateModule(e)),deactivateModule:e=>a(()=>s.deactivateModule(e)),getModuleVersions:e=>a(()=>s.getModuleVersions(e)),listActions:e=>a(()=>s.listActions(e)),getAction:e=>a(()=>s.getAction(e)),createAction:e=>a(()=>s.createAction(e)),editAction:(e,r)=>a(()=>s.editAction(e,r)),deleteAction:e=>a(()=>s.deleteAction(e)),activateAction:e=>a(()=>s.activateAction(e)),deactivateAction:e=>a(()=>s.deactivateAction(e)),getActionVersions:e=>a(()=>s.getActionVersions(e)),getActionsByProfile:e=>a(()=>s.getActionsByProfile(e)),updateActionsProfiles:e=>a(()=>s.updateActionsProfiles(e)),calculatePermissions:e=>a(()=>s.calculatePermissions(e))};export{Y as AuthRoute,j as CRITICAL_TRANSLATIONS,le as CrossTabSyncManager,Be as CrudiaAutoGenerate,qe as CrudiaFileField,Ye as CrudiaMarkdownField,We as CrudifyInitializationManager,hr as CrudifyInitializer,Ue as CrudifyLogin,Ae as CrudifyProvider,nr as CrudifyThemeProvider,Le as DEFAULT_PASSWORD_RULES,he as ERROR_CODES,Se as ERROR_SEVERITY_MAP,Re as GlobalNotificationProvider,J as GuestRoute,Ke as LoginComponent,Ne as POLICY_ACTIONS,Ge as PREFERRED_POLICY_ORDER,be as PasswordRequirements,De as Policies,V as ProtectedRoute,Ie as SessionDebugInfo,g as SessionLoadingScreen,A as SessionManager,Pe as SessionProvider,_e as SessionStatus,se as TokenStorage,te as TranslationService,ie as TranslationsProvider,Fe as UserProfileDisplay,ze as allPasswordRulesPassed,gr as clearCorruptedTokens,ce as createErrorTranslator,de as crossTabSync,Tt as crudify,Er as crudifyAdmin,T as crudifyInitManager,me as decodeJwtSafely,Me as evaluatePasswordRules,M as extractSafeRedirectFromUrl,b as getCookie,ee as getCriticalLanguages,re as getCriticalTranslations,ge as getCurrentUserEmail,ke as getErrorMessage,we as handleCrudifyError,H as hasCorruptedTokens,W as hasEncryptionKeyHash,B as hasStoredTokens,ye as isTokenExpired,p as logger,ve as parseApiError,Ee as parseJavaScriptError,Te as parseTransactionError,Xe as secureLocalStorage,Qe as secureSessionStorage,U as shouldWaitForInitialization,ue as translateError,ae as translateErrorCode,pe as translateErrorCodes,oe as translationService,$e as useAuth,Ve as useAutoGenerate,Ce as useCrudify,Sr as useCrudifyInitializer,je as useCrudifyWithNotifications,Ze as useData,He as useFileUpload,xe as useGlobalNotification,fe as useSession,m as useSessionContext,ne as useTranslations,Je as useUserData,Oe as useUserProfile,E as validateInternalRedirect};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocios/crudify-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=24.12.0"
|
|
6
6
|
},
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@mdxeditor/editor": "^3.52.0",
|
|
45
|
-
"@nocios/crudify-admin": "^
|
|
45
|
+
"@nocios/crudify-admin-sdk": "^1.0.0",
|
|
46
46
|
"@nocios/crudify-sdk": "^1.0.0",
|
|
47
47
|
"dompurify": "^3.2.7",
|
|
48
48
|
"uuid": "^13.0.0"
|
package/coverage/base.css
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
body, html {
|
|
2
|
-
margin:0; padding: 0;
|
|
3
|
-
height: 100%;
|
|
4
|
-
}
|
|
5
|
-
body {
|
|
6
|
-
font-family: Helvetica Neue, Helvetica, Arial;
|
|
7
|
-
font-size: 14px;
|
|
8
|
-
color:#333;
|
|
9
|
-
}
|
|
10
|
-
.small { font-size: 12px; }
|
|
11
|
-
*, *:after, *:before {
|
|
12
|
-
-webkit-box-sizing:border-box;
|
|
13
|
-
-moz-box-sizing:border-box;
|
|
14
|
-
box-sizing:border-box;
|
|
15
|
-
}
|
|
16
|
-
h1 { font-size: 20px; margin: 0;}
|
|
17
|
-
h2 { font-size: 14px; }
|
|
18
|
-
pre {
|
|
19
|
-
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
|
20
|
-
margin: 0;
|
|
21
|
-
padding: 0;
|
|
22
|
-
-moz-tab-size: 2;
|
|
23
|
-
-o-tab-size: 2;
|
|
24
|
-
tab-size: 2;
|
|
25
|
-
}
|
|
26
|
-
a { color:#0074D9; text-decoration:none; }
|
|
27
|
-
a:hover { text-decoration:underline; }
|
|
28
|
-
.strong { font-weight: bold; }
|
|
29
|
-
.space-top1 { padding: 10px 0 0 0; }
|
|
30
|
-
.pad2y { padding: 20px 0; }
|
|
31
|
-
.pad1y { padding: 10px 0; }
|
|
32
|
-
.pad2x { padding: 0 20px; }
|
|
33
|
-
.pad2 { padding: 20px; }
|
|
34
|
-
.pad1 { padding: 10px; }
|
|
35
|
-
.space-left2 { padding-left:55px; }
|
|
36
|
-
.space-right2 { padding-right:20px; }
|
|
37
|
-
.center { text-align:center; }
|
|
38
|
-
.clearfix { display:block; }
|
|
39
|
-
.clearfix:after {
|
|
40
|
-
content:'';
|
|
41
|
-
display:block;
|
|
42
|
-
height:0;
|
|
43
|
-
clear:both;
|
|
44
|
-
visibility:hidden;
|
|
45
|
-
}
|
|
46
|
-
.fl { float: left; }
|
|
47
|
-
@media only screen and (max-width:640px) {
|
|
48
|
-
.col3 { width:100%; max-width:100%; }
|
|
49
|
-
.hide-mobile { display:none!important; }
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.quiet {
|
|
53
|
-
color: #7f7f7f;
|
|
54
|
-
color: rgba(0,0,0,0.5);
|
|
55
|
-
}
|
|
56
|
-
.quiet a { opacity: 0.7; }
|
|
57
|
-
|
|
58
|
-
.fraction {
|
|
59
|
-
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
|
60
|
-
font-size: 10px;
|
|
61
|
-
color: #555;
|
|
62
|
-
background: #E8E8E8;
|
|
63
|
-
padding: 4px 5px;
|
|
64
|
-
border-radius: 3px;
|
|
65
|
-
vertical-align: middle;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
div.path a:link, div.path a:visited { color: #333; }
|
|
69
|
-
table.coverage {
|
|
70
|
-
border-collapse: collapse;
|
|
71
|
-
margin: 10px 0 0 0;
|
|
72
|
-
padding: 0;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
table.coverage td {
|
|
76
|
-
margin: 0;
|
|
77
|
-
padding: 0;
|
|
78
|
-
vertical-align: top;
|
|
79
|
-
}
|
|
80
|
-
table.coverage td.line-count {
|
|
81
|
-
text-align: right;
|
|
82
|
-
padding: 0 5px 0 20px;
|
|
83
|
-
}
|
|
84
|
-
table.coverage td.line-coverage {
|
|
85
|
-
text-align: right;
|
|
86
|
-
padding-right: 10px;
|
|
87
|
-
min-width:20px;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
table.coverage td span.cline-any {
|
|
91
|
-
display: inline-block;
|
|
92
|
-
padding: 0 5px;
|
|
93
|
-
width: 100%;
|
|
94
|
-
}
|
|
95
|
-
.missing-if-branch {
|
|
96
|
-
display: inline-block;
|
|
97
|
-
margin-right: 5px;
|
|
98
|
-
border-radius: 3px;
|
|
99
|
-
position: relative;
|
|
100
|
-
padding: 0 4px;
|
|
101
|
-
background: #333;
|
|
102
|
-
color: yellow;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.skip-if-branch {
|
|
106
|
-
display: none;
|
|
107
|
-
margin-right: 10px;
|
|
108
|
-
position: relative;
|
|
109
|
-
padding: 0 4px;
|
|
110
|
-
background: #ccc;
|
|
111
|
-
color: white;
|
|
112
|
-
}
|
|
113
|
-
.missing-if-branch .typ, .skip-if-branch .typ {
|
|
114
|
-
color: inherit !important;
|
|
115
|
-
}
|
|
116
|
-
.coverage-summary {
|
|
117
|
-
border-collapse: collapse;
|
|
118
|
-
width: 100%;
|
|
119
|
-
}
|
|
120
|
-
.coverage-summary tr { border-bottom: 1px solid #bbb; }
|
|
121
|
-
.keyline-all { border: 1px solid #ddd; }
|
|
122
|
-
.coverage-summary td, .coverage-summary th { padding: 10px; }
|
|
123
|
-
.coverage-summary tbody { border: 1px solid #bbb; }
|
|
124
|
-
.coverage-summary td { border-right: 1px solid #bbb; }
|
|
125
|
-
.coverage-summary td:last-child { border-right: none; }
|
|
126
|
-
.coverage-summary th {
|
|
127
|
-
text-align: left;
|
|
128
|
-
font-weight: normal;
|
|
129
|
-
white-space: nowrap;
|
|
130
|
-
}
|
|
131
|
-
.coverage-summary th.file { border-right: none !important; }
|
|
132
|
-
.coverage-summary th.pct { }
|
|
133
|
-
.coverage-summary th.pic,
|
|
134
|
-
.coverage-summary th.abs,
|
|
135
|
-
.coverage-summary td.pct,
|
|
136
|
-
.coverage-summary td.abs { text-align: right; }
|
|
137
|
-
.coverage-summary td.file { white-space: nowrap; }
|
|
138
|
-
.coverage-summary td.pic { min-width: 120px !important; }
|
|
139
|
-
.coverage-summary tfoot td { }
|
|
140
|
-
|
|
141
|
-
.coverage-summary .sorter {
|
|
142
|
-
height: 10px;
|
|
143
|
-
width: 7px;
|
|
144
|
-
display: inline-block;
|
|
145
|
-
margin-left: 0.5em;
|
|
146
|
-
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
|
|
147
|
-
}
|
|
148
|
-
.coverage-summary .sorted .sorter {
|
|
149
|
-
background-position: 0 -20px;
|
|
150
|
-
}
|
|
151
|
-
.coverage-summary .sorted-desc .sorter {
|
|
152
|
-
background-position: 0 -10px;
|
|
153
|
-
}
|
|
154
|
-
.status-line { height: 10px; }
|
|
155
|
-
/* yellow */
|
|
156
|
-
.cbranch-no { background: yellow !important; color: #111; }
|
|
157
|
-
/* dark red */
|
|
158
|
-
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
|
|
159
|
-
.low .chart { border:1px solid #C21F39 }
|
|
160
|
-
.highlighted,
|
|
161
|
-
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
|
|
162
|
-
background: #C21F39 !important;
|
|
163
|
-
}
|
|
164
|
-
/* medium red */
|
|
165
|
-
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
|
|
166
|
-
/* light red */
|
|
167
|
-
.low, .cline-no { background:#FCE1E5 }
|
|
168
|
-
/* light green */
|
|
169
|
-
.high, .cline-yes { background:rgb(230,245,208) }
|
|
170
|
-
/* medium green */
|
|
171
|
-
.cstat-yes { background:rgb(161,215,106) }
|
|
172
|
-
/* dark green */
|
|
173
|
-
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
|
|
174
|
-
.high .chart { border:1px solid rgb(77,146,33) }
|
|
175
|
-
/* dark yellow (gold) */
|
|
176
|
-
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
|
|
177
|
-
.medium .chart { border:1px solid #f9cd0b; }
|
|
178
|
-
/* light yellow */
|
|
179
|
-
.medium { background: #fff4c2; }
|
|
180
|
-
|
|
181
|
-
.cstat-skip { background: #ddd; color: #111; }
|
|
182
|
-
.fstat-skip { background: #ddd; color: #111 !important; }
|
|
183
|
-
.cbranch-skip { background: #ddd !important; color: #111; }
|
|
184
|
-
|
|
185
|
-
span.cline-neutral { background: #eaeaea; }
|
|
186
|
-
|
|
187
|
-
.coverage-summary td.empty {
|
|
188
|
-
opacity: .5;
|
|
189
|
-
padding-top: 4px;
|
|
190
|
-
padding-bottom: 4px;
|
|
191
|
-
line-height: 1;
|
|
192
|
-
color: #888;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.cover-fill, .cover-empty {
|
|
196
|
-
display:inline-block;
|
|
197
|
-
height: 12px;
|
|
198
|
-
}
|
|
199
|
-
.chart {
|
|
200
|
-
line-height: 0;
|
|
201
|
-
}
|
|
202
|
-
.cover-empty {
|
|
203
|
-
background: white;
|
|
204
|
-
}
|
|
205
|
-
.cover-full {
|
|
206
|
-
border-right: none !important;
|
|
207
|
-
}
|
|
208
|
-
pre.prettyprint {
|
|
209
|
-
border: none !important;
|
|
210
|
-
padding: 0 !important;
|
|
211
|
-
margin: 0 !important;
|
|
212
|
-
}
|
|
213
|
-
.com { color: #999 !important; }
|
|
214
|
-
.ignore-none { color: #999; font-weight: normal; }
|
|
215
|
-
|
|
216
|
-
.wrapper {
|
|
217
|
-
min-height: 100%;
|
|
218
|
-
height: auto !important;
|
|
219
|
-
height: 100%;
|
|
220
|
-
margin: 0 auto -48px;
|
|
221
|
-
}
|
|
222
|
-
.footer, .push {
|
|
223
|
-
height: 48px;
|
|
224
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
var jumpToCode = (function init() {
|
|
3
|
-
// Classes of code we would like to highlight in the file view
|
|
4
|
-
var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
|
|
5
|
-
|
|
6
|
-
// Elements to highlight in the file listing view
|
|
7
|
-
var fileListingElements = ['td.pct.low'];
|
|
8
|
-
|
|
9
|
-
// We don't want to select elements that are direct descendants of another match
|
|
10
|
-
var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
|
|
11
|
-
|
|
12
|
-
// Selector that finds elements on the page to which we can jump
|
|
13
|
-
var selector =
|
|
14
|
-
fileListingElements.join(', ') +
|
|
15
|
-
', ' +
|
|
16
|
-
notSelector +
|
|
17
|
-
missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
|
|
18
|
-
|
|
19
|
-
// The NodeList of matching elements
|
|
20
|
-
var missingCoverageElements = document.querySelectorAll(selector);
|
|
21
|
-
|
|
22
|
-
var currentIndex;
|
|
23
|
-
|
|
24
|
-
function toggleClass(index) {
|
|
25
|
-
missingCoverageElements
|
|
26
|
-
.item(currentIndex)
|
|
27
|
-
.classList.remove('highlighted');
|
|
28
|
-
missingCoverageElements.item(index).classList.add('highlighted');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function makeCurrent(index) {
|
|
32
|
-
toggleClass(index);
|
|
33
|
-
currentIndex = index;
|
|
34
|
-
missingCoverageElements.item(index).scrollIntoView({
|
|
35
|
-
behavior: 'smooth',
|
|
36
|
-
block: 'center',
|
|
37
|
-
inline: 'center'
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function goToPrevious() {
|
|
42
|
-
var nextIndex = 0;
|
|
43
|
-
if (typeof currentIndex !== 'number' || currentIndex === 0) {
|
|
44
|
-
nextIndex = missingCoverageElements.length - 1;
|
|
45
|
-
} else if (missingCoverageElements.length > 1) {
|
|
46
|
-
nextIndex = currentIndex - 1;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
makeCurrent(nextIndex);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function goToNext() {
|
|
53
|
-
var nextIndex = 0;
|
|
54
|
-
|
|
55
|
-
if (
|
|
56
|
-
typeof currentIndex === 'number' &&
|
|
57
|
-
currentIndex < missingCoverageElements.length - 1
|
|
58
|
-
) {
|
|
59
|
-
nextIndex = currentIndex + 1;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
makeCurrent(nextIndex);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return function jump(event) {
|
|
66
|
-
if (
|
|
67
|
-
document.getElementById('fileSearch') === document.activeElement &&
|
|
68
|
-
document.activeElement != null
|
|
69
|
-
) {
|
|
70
|
-
// if we're currently focused on the search input, we don't want to navigate
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
switch (event.which) {
|
|
75
|
-
case 78: // n
|
|
76
|
-
case 74: // j
|
|
77
|
-
goToNext();
|
|
78
|
-
break;
|
|
79
|
-
case 66: // b
|
|
80
|
-
case 75: // k
|
|
81
|
-
case 80: // p
|
|
82
|
-
goToPrevious();
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
})();
|
|
87
|
-
window.addEventListener('keydown', jumpToCode);
|