@opengis/fcore 0.0.1-beta.5 → 0.0.1-beta.6
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/config.js +1 -1
- package/dist/context.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fcore.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/migrations/cli.js +1 -1
- package/dist/migrations/runner.js +1 -1
- package/dist/modules/auth/adduser-cli.js +1 -1
- package/dist/modules/auth/passwd-cli.js +1 -1
- package/dist/modules/auth/permission-cli.js +1 -1
- package/dist/modules/auth/route.js +1 -1
- package/dist/modules/auth/schema.js +1 -1
- package/dist/modules/auth/services/change-password.js +1 -1
- package/dist/modules/auth/services/get-current-user.js +1 -1
- package/dist/modules/auth/services/registration.js +1 -1
- package/dist/modules/auth/services/verify-two-factor.js +1 -1
- package/dist/modules/file/route.js +1 -1
- package/dist/modules/file/schema.js +1 -1
- package/dist/modules/file/services/get-file.js +1 -1
- package/dist/modules/file/services/resize-file.js +1 -1
- package/dist/modules/file/services/upload-file.js +1 -1
- package/dist/modules/resource/route.js +1 -1
- package/dist/modules/resource/schema.js +1 -1
- package/dist/modules/resource/services/add-note.js +1 -1
- package/dist/modules/resource/services/add-resource-file.js +1 -1
- package/dist/modules/resource/services/create-resource-relation.js +1 -1
- package/dist/modules/resource/services/create-resource.js +1 -1
- package/dist/modules/resource/services/delete-resource-relation.js +1 -1
- package/dist/modules/resource/services/delete-resource.js +1 -1
- package/dist/modules/resource/services/export-resource.js +1 -1
- package/dist/modules/resource/services/get-resource.js +1 -1
- package/dist/modules/resource/services/list-resource-relation.js +1 -1
- package/dist/modules/resource/services/list-resources.js +1 -1
- package/dist/modules/resource/services/search-resource.js +1 -1
- package/dist/modules/resource/services/suggest-resource.js +1 -1
- package/dist/modules/resource/services/update-resource.js +1 -1
- package/dist/modules/resource/services/upload-resource-file.js +1 -1
- package/dist/modules/system/route.js +1 -1
- package/dist/modules/system/schema.js +1 -1
- package/dist/modules/system/services/check-system.js +1 -1
- package/dist/modules/system/services/get-access.js +1 -1
- package/dist/modules/system/services/get-api-list.js +1 -1
- package/dist/modules/system/services/get-audit-log.js +1 -1
- package/dist/modules/system/services/get-dictionary.js +1 -1
- package/dist/modules/system/services/get-system-log.js +1 -1
- package/dist/modules/system/services/get-system-settings.js +1 -1
- package/dist/modules/system/services/list-dictionaries.js +1 -1
- package/dist/modules/system/services/set-access.js +1 -1
- package/dist/modules/system/services/update-dictionary.js +1 -1
- package/dist/modules/system/services/update-system-settings.js +1 -1
- package/dist/modules/utils/require-admin.js +1 -1
- package/dist/modules/utils/safe-user.js +1 -1
- package/dist/modules/utils/unsupported.js +1 -1
- package/dist/plugins/audit/audit.js +1 -1
- package/dist/plugins/audit/index.js +1 -1
- package/dist/plugins/audit/services/write-audit.js +1 -1
- package/dist/plugins/auth/get-user-permissions.js +1 -1
- package/dist/plugins/auth/index.js +1 -1
- package/dist/plugins/auth/verifyUser.js +1 -1
- package/dist/plugins/dictionary.js +1 -1
- package/dist/plugins/file.js +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/logger/index.js +1 -1
- package/dist/plugins/logger/transport.js +1 -1
- package/dist/plugins/pg.js +1 -1
- package/dist/plugins/redis.js +1 -1
- package/dist/plugins/resource/index.js +1 -1
- package/dist/plugins/resource/resource.js +1 -1
- package/dist/plugins/resource/resource.registry.js +1 -1
- package/dist/plugins/resource/services/create-relation.js +1 -1
- package/dist/plugins/resource/services/create.js +1 -1
- package/dist/plugins/resource/services/delete-relation.js +1 -1
- package/dist/plugins/resource/services/delete.js +1 -1
- package/dist/plugins/resource/services/find-one.js +1 -1
- package/dist/plugins/resource/services/find-relation.js +1 -1
- package/dist/plugins/resource/services/find.js +1 -1
- package/dist/plugins/resource/services/update.js +1 -1
- package/dist/plugins/resource/utils/fields.js +1 -1
- package/dist/plugins/resource/utils/filters.js +1 -1
- package/dist/plugins/resource/utils/permissions.js +1 -1
- package/dist/plugins/resource/utils/sort.js +1 -1
- package/dist/plugins/resource/utils/sql.js +1 -1
- package/dist/shared/getIP.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function addResourceFile(r,u){const o=T,G=await u['pg']['query']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.files\x20(resource,\x20resource_id,\x20file_path,\x20size)\x0a\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4)\x0a\x20\x20\x20\x20\x20\x20\x20\x20RETURNING\x20*\x0a\x20\x20\x20\x20\x20\x20',[r['resource'],String(r['id']),r[o(0x1b4)],r['size']??null]);return G[o(0x1b5)][0x0];}function T(r,u){r=r-0x1b4;const G=H();let o=G[r];return o;}function H(){const X=['filePath','rows'];H=function(){return X;};return H();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function createResourceRelation(r,u){const q=T,{resource:G,id:o,relation:X,data:w,user:a}=r;return u[q(0x1f3)]['createRelation']({'name':G,'id':o,'relation':X,'data':w,'user':a});}function T(r,u){r=r-0x1f3;const G=H();let o=G[r];return o;}function H(){const p=['resource'];H=function(){return p;};return H();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function T(r,u){r=r-0xf5;var G=H();var o=G[r];return o;}function H(){var o=['data'];H=function(){return o;};return H();}export async function createResource(r,u){var G=T;return u['resource']['create']({'name':r['resource'],'data':r[G(0xf5)],'user':r['user']});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function H(){const q=['deleteRelation'];H=function(){return q;};return H();}function T(r,u){r=r-0xee;const G=H();let o=G[r];return o;}export async function deleteResourceRelation(r,u){const a=T,{resource:G,id:o,relation:X,relationId:w}=r;return u['resource'][a(0xee)]({'name':G,'id':o,'relation':X,'relationId':w});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function deleteResource(r,u){var G=T;return u[G(0xb1)]['delete']({'name':r[G(0xb1)],'id':r['id'],'user':r['user']});}function T(r,u){r=r-0xb1;var G=H();var o=G[r];return o;}function H(){var o=['resource'];H=function(){return o;};return H();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function T(r,u){r=r-0x150;const G=H();let o=G[r];return o;}function H(){const X=['resource'];H=function(){return X;};return H();}export async function exportResource(r,u){const o=T,G=await u['resource']['find']({'name':r[o(0x150)],'query':{'filter':r['filter'],'sort':r['sort'],'search':r['search'],'limit':r['limit'],'offset':r['offset'],'fields':r['fields']},'user':r['user']});return G['rows'];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function H(){var o=['resource','findOne','user'];H=function(){return o;};return H();}function T(r,u){r=r-0xb9;var G=H();var o=G[r];return o;}export async function getResource(r,u){var G=T;return u[G(0xb9)][G(0xba)]({'name':r[G(0xb9)],'id':r['id'],'user':r[G(0xbb)]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function listResourceRelation(r,u){const {resource:G,id:o,relation:X,user:w}=r;return u['resource']['findRelation']({'name':G,'id':o,'relation':X,'user':w});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function H(){var o=['find','limit','offset','page','user'];H=function(){return o;};return H();}function T(r,u){r=r-0x1cd;var G=H();var o=G[r];return o;}export async function listResources(r,u){var G=T;return u['resource'][G(0x1cd)]({'name':r['resource'],'query':{'filter':r['filter'],'sort':r['sort'],'search':r['search'],'limit':r[G(0x1ce)],'offset':r[G(0x1cf)]??(r['page']?Math['max'](r[G(0x1d0)]-0x1,0x0):0x0)*(r[G(0x1ce)]??0x14)},'user':r[G(0x1d1)]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function searchResource(r,u){return u['resource']['find']({'name':r['resource'],'query':{...r,'filter':r['filter']},'user':r['user']});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{ValidationError}from'../../../errors.js';function H(){const P=['search','min','max','limit','lookup','query','\x20WHERE\x20lower(','toLowerCase','rows','Field\x20has\x20no\x20lookup\x20dictionary:\x20','filter','startsWith','now'];H=function(){return P;};return H();}function T(r,u){r=r-0x172;const G=H();let o=G[r];return o;}export async function suggestResource(r,u){const h=T,G=u['resource']['get'](r['resource']),o=String(r[h(0x172)]??r['q']??'')['toLowerCase'](),X=Math[h(0x173)](Math[h(0x174)](Number(r[h(0x175)]??0x14),0x1),0xc8),w=Date['now'](),a=G['fields'][r['field']],q=a?.['lookup']?.['dictionary'],p=a?.[h(0x176)]?.['table'];if(p){const Y=a?.['lookup']?.['textField'],S=a?.['lookup']?.['valueField'],I=await u['pg'][h(0x177)]('SELECT\x20'+S+'\x20as\x20id,\x20'+Y+'\x20as\x20text\x20FROM\x20'+p+h(0x178)+Y+')\x20~\x20$1\x20LIMIT\x20$2',[''+o[h(0x179)](),X])['then'](c=>c[h(0x17a)]);return{'limit':X,'count':I['length'],'search':o,'time':Date['now']()-w,'data':I};}if(!q)throw new ValidationError(h(0x17b)+r['field']);const F=await u['dictionary']['get'](q),E=F[h(0x17c)](c=>!o||c['code'][h(0x17d)](o)||c['name'][h(0x17d)](o))['slice'](0x0,X);return{'search':o,'limit':X,'count':E['length'],'time':Date[h(0x17e)]()-w,'data':E};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function updateResource(r,u){return u['resource']['update']({'name':r['resource'],'id':r['id'],'data':r['patch'],'user':r['user']});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{ForbiddenError,NotFoundError,ValidationError}from'../../../errors.js';export async function uploadResourceFile(r,u){const a=T,G=u[a(0xf3)]['get'](r['resource']);if(G[a(0xf4)]==='admin'&&r['user']?.['type']!=='admin')throw new ForbiddenError('Admin\x20access\x20required');if(r['user']?.[a(0xf5)]!==a(0xf6)&&!r[a(0xf7)]?.['permissions']?.['includes']((G['permission']??G['name'])+':update'))throw new ForbiddenError('Missing\x20permission:\x20'+(G['permission']??G['name'])+':update');if(!Buffer['isBuffer'](r['file'])||r[a(0xf8)]['length']===0x0)throw new ValidationError(a(0xf9));const o=r['fileName'][a(0xfa)](/[^A-Za-z0-9._-]/g,'_');if(!o)throw new ValidationError(a(0xfb));const X='files/'+r['resource']+'/'+String(r['id'])+'/'+o;await u['file']['put'](X,r['file']);if(!await u['file']['exists'](X))throw new NotFoundError('Uploaded\x20file\x20not\x20found');const w=await u['pg'][a(0xfc)]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.files\x20(resource,\x20resource_id,\x20file_path,\x20size)\x0a\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4)\x0a\x20\x20\x20\x20\x20\x20\x20\x20RETURNING\x20*\x0a\x20\x20\x20\x20',[r['resource'],String(r['id']),X,r['file'][a(0xfd)]]);return w['rows'][0x0];}function T(r,u){r=r-0xf3;const G=H();let o=G[r];return o;}function H(){const q=['resource','access','type','admin','user','file','File\x20is\x20required','replace','File\x20name\x20is\x20required','query','length'];H=function(){return q;};return H();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0xc32977=_0xa56a;(function(_0x5230bc,_0x437178){const _0x38ecda=_0xa56a,_0x28d318=_0x5230bc();while(!![]){try{const _0x553941=parseInt(_0x38ecda(0xcd))/0x1*(parseInt(_0x38ecda(0xe9))/0x2)+-parseInt(_0x38ecda(0xdb))/0x3*(-parseInt(_0x38ecda(0xc4))/0x4)+parseInt(_0x38ecda(0xf9))/0x5*(-parseInt(_0x38ecda(0xf7))/0x6)+parseInt(_0x38ecda(0xe3))/0x7*(parseInt(_0x38ecda(0xd4))/0x8)+parseInt(_0x38ecda(0xb3))/0x9+-parseInt(_0x38ecda(0x9d))/0xa*(-parseInt(_0x38ecda(0xb8))/0xb)+parseInt(_0x38ecda(0xb1))/0xc;if(_0x553941===_0x437178)break;else _0x28d318['push'](_0x28d318['shift']());}catch(_0x4b21ec){_0x28d318['push'](_0x28d318['shift']());}}}(_0x2b73,0xcee9e));import{getSystemSettings}from'./services/get-system-settings.js';import{updateSystemSettings}from'./services/update-system-settings.js';import{getAuditLog}from'./services/get-audit-log.js';import{checkSystem}from'./services/check-system.js';import{getApiList}from'./services/get-api-list.js';import{getSystemLog}from'./services/get-system-log.js';function _0x2b73(){const _0x28a048=['356311jGqlOI','post','system','system:dictionaries','Get\x20access\x20rules','send','List\x20platform\x20dictionaries','8PcNqaV','Checks\x20the\x20availability\x20of\x20system\x20dependencies.','schema','RVDOU','system:access','AxZQJ','iCCMK','3OGKHsw','Returns\x20a\x20registered\x20platform\x20dictionary\x20by\x20name.','IoUhg','NRraR','BYEtd','koQuF','hQmOX','AgFHI','4519018sAnGWf','system:settings','Returns\x20the\x20list\x20of\x20registered\x20platform\x20APIs.','access','/api/dictionaries','shzcU','2pgglil','zASBG','PlOLn','Set\x20access\x20rules','nsCPm','/api/dictionaries/:name','Returns\x20all\x20available\x20dictionaries\x20registered\x20by\x20the\x20platform.','apiListQuery','Returns\x20system\x20logger\x20entries\x20for\x20the\x20requested\x20path.','system:audit','summary','Returns\x20system\x20settings\x20as\x20nested\x20JSON.','OPqFJ','yCtep','750LONwTK','HtIGu','36865mxiasX','accessTarget','description','/api/system/audit','type','CEFpx','deOXW','get','tags','Get\x20platform\x20dictionary','permissions','Replaces\x20direct\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','dictionaryName','admin','1356070VczYbf','LWdrM','FzNIm','system:check','TamHJ','fcore','DqJUM','Get\x20system\x20settings','/api/system/settings','Update\x20platform\x20dictionary','UIHGT','params','logger','sXXEq','lqGEa','JcFva','Returns\x20direct\x20and\x20role-based\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','wTDKb','LejfZ','Get\x20audit\x20log','1752vZLPdd','/api/system/logger','2219175ngbRYc','Returns\x20the\x20system\x20audit\x20log\x20entries.','/api/system/check','/api/access/:type/:id','system:logs','11BXtBzC','query','List\x20APIs','Update\x20system\x20settings','dictionaryItems','QOCso','Get\x20system\x20log','Replaces\x20the\x20items\x20of\x20a\x20registered\x20platform\x20dictionary.','hLQGh','Check\x20system\x20health','XiKmy','JvhLi','1539720BIWSTk','body','rdYRH','/api/system/list','yqPCH','settings','Updates\x20system\x20settings\x20using\x20flat\x20dot-notation\x20keys.','user','querystring'];_0x2b73=function(){return _0x28a048;};return _0x2b73();}import{listDictionaries}from'./services/list-dictionaries.js';import{getDictionary}from'./services/get-dictionary.js';import{updateDictionary}from'./services/update-dictionary.js';import{getAccess}from'./services/get-access.js';function _0xa56a(_0x1fccdf,_0x393dbe){_0x1fccdf=_0x1fccdf-0x99;const _0x2b7339=_0x2b73();let _0xa56a46=_0x2b7339[_0x1fccdf];return _0xa56a46;}import{setAccess}from'./services/set-access.js';import{systemSchemas}from'./schema.js';const u=_0x93714a=>_0x93714a[_0xc32977(0xcb)];export function systemRoutes(_0x40c68c,_0x33b2fc=new Map()){const _0x1fd71b=_0xc32977,_0x121b41={'zASBG':function(_0x2b1b07,_0x50595b,_0x493432){return _0x2b1b07(_0x50595b,_0x493432);},'rdYRH':_0x1fd71b(0xa2),'RVDOU':_0x1fd71b(0xd3),'IoUhg':_0x1fd71b(0xef),'sXXEq':_0x1fd71b(0xd0),'JvhLi':_0x1fd71b(0xee),'deOXW':_0x1fd71b(0xcf),'lqGEa':_0x1fd71b(0x102),'nsCPm':_0x1fd71b(0x9c),'yqPCH':_0x1fd71b(0xa6),'CEFpx':_0x1fd71b(0xbf),'TamHJ':_0x1fd71b(0xb6),'LWdrM':_0x1fd71b(0xd1),'koQuF':_0x1fd71b(0xec),'hQmOX':_0x1fd71b(0x9a),'PlOLn':_0x1fd71b(0xd8),'LejfZ':_0x1fd71b(0xa5),'yCtep':_0x1fd71b(0xf4),'OPqFJ':_0x1fd71b(0xbb),'AgFHI':_0x1fd71b(0xca),'BYEtd':_0x1fd71b(0xe4),'DqJUM':_0x1fd71b(0xb2),'AxZQJ':_0x1fd71b(0xbe),'HtIGu':_0x1fd71b(0xf1),'iCCMK':_0x1fd71b(0xb7),'NRraR':_0x1fd71b(0xfc),'XiKmy':_0x1fd71b(0xb0),'UIHGT':_0x1fd71b(0xb4),'QOCso':_0x1fd71b(0xc1),'JcFva':_0x1fd71b(0xd5),'wTDKb':_0x1fd71b(0xa0),'hLQGh':_0x1fd71b(0xba),'FzNIm':_0x1fd71b(0xe5)};return async _0x5c37fc=>{const _0xfc0ace=_0x1fd71b,_0x3d15c1={'shzcU':function(_0x5c276c,_0x43069c,_0x50644d){const _0x3045e2=_0xa56a;return _0x121b41[_0x3045e2(0xea)](_0x5c276c,_0x43069c,_0x50644d);}},_0x65628a={};_0x65628a[_0xfc0ace(0x101)]=[_0x121b41[_0xfc0ace(0xc6)],_0xfc0ace(0xcf)],_0x65628a[_0xfc0ace(0xf3)]=_0x121b41[_0xfc0ace(0xd7)],_0x65628a[_0xfc0ace(0xfb)]=_0x121b41[_0xfc0ace(0xdd)],_0x65628a[_0xfc0ace(0xe6)]=_0xfc0ace(0x9c),_0x65628a[_0xfc0ace(0x99)]=[_0x121b41[_0xfc0ace(0xaa)]];const _0x3f8f56={};_0x3f8f56[_0xfc0ace(0xd6)]=_0x65628a,_0x5c37fc[_0xfc0ace(0x100)](_0xfc0ace(0xe7),_0x3f8f56,async _0x1dcce3=>listDictionaries({'user':u(_0x1dcce3)},_0x40c68c)),_0x5c37fc[_0xfc0ace(0x100)](_0x121b41[_0xfc0ace(0xc3)],{'schema':{'tags':[_0x121b41[_0xfc0ace(0xc6)],_0x121b41[_0xfc0ace(0xff)]],'summary':_0x121b41[_0xfc0ace(0xab)],'description':_0xfc0ace(0xdc),'access':_0x121b41[_0xfc0ace(0xed)],'permissions':[_0x121b41[_0xfc0ace(0xaa)]],'params':systemSchemas[_0xfc0ace(0x9b)]}},async _0x4a14a5=>getDictionary({..._0x4a14a5[_0xfc0ace(0xa8)],'user':u(_0x4a14a5)},_0x40c68c)),_0x5c37fc[_0xfc0ace(0xce)](_0x121b41[_0xfc0ace(0xc3)],{'schema':{'tags':[_0xfc0ace(0xa2),_0x121b41[_0xfc0ace(0xff)]],'summary':_0x121b41[_0xfc0ace(0xc8)],'description':_0x121b41[_0xfc0ace(0xfe)],'access':_0xfc0ace(0x9c),'permissions':[_0x121b41[_0xfc0ace(0xaa)]],'params':systemSchemas[_0xfc0ace(0x9b)],'body':systemSchemas[_0xfc0ace(0xbc)]}},async _0x543019=>updateDictionary({..._0x543019[_0xfc0ace(0xa8)],..._0x543019[_0xfc0ace(0xc5)],'user':u(_0x543019)},_0x40c68c));const _0x3780be=async _0x3cdc7b=>getAccess({..._0x3cdc7b[_0xfc0ace(0xa8)],'user':u(_0x3cdc7b)},_0x40c68c);_0x5c37fc[_0xfc0ace(0x100)](_0x121b41[_0xfc0ace(0xa1)],{'schema':{'tags':[_0xfc0ace(0xa2),_0x121b41[_0xfc0ace(0xff)]],'summary':_0x121b41[_0xfc0ace(0x9e)],'description':_0xfc0ace(0xad),'access':_0x121b41[_0xfc0ace(0xed)],'permissions':[_0xfc0ace(0xd8)],'params':systemSchemas[_0xfc0ace(0xfa)]}},_0x3780be);const _0x433ce4={};_0x433ce4[_0xfc0ace(0x101)]=[_0x121b41[_0xfc0ace(0xc6)],_0x121b41[_0xfc0ace(0xff)]],_0x433ce4[_0xfc0ace(0xf3)]=_0x121b41[_0xfc0ace(0xe0)],_0x433ce4[_0xfc0ace(0xfb)]=_0x121b41[_0xfc0ace(0xe1)],_0x433ce4[_0xfc0ace(0xe6)]=_0x121b41[_0xfc0ace(0xed)],_0x433ce4[_0xfc0ace(0x99)]=[_0x121b41[_0xfc0ace(0xeb)]],_0x433ce4[_0xfc0ace(0xa8)]=systemSchemas[_0xfc0ace(0xfa)],_0x433ce4[_0xfc0ace(0xc5)]=systemSchemas[_0xfc0ace(0xe6)];const _0x58cbdf={};_0x58cbdf[_0xfc0ace(0xd6)]=_0x433ce4,_0x5c37fc[_0xfc0ace(0xce)](_0xfc0ace(0xb6),_0x58cbdf,async _0x391f7d=>setAccess({..._0x391f7d[_0xfc0ace(0xa8)],..._0x391f7d[_0xfc0ace(0xc5)],'user':u(_0x391f7d)},_0x40c68c)),_0x5c37fc[_0xfc0ace(0x100)](_0x121b41[_0xfc0ace(0xaf)],{'schema':{'tags':[_0x121b41[_0xfc0ace(0xc6)],_0x121b41[_0xfc0ace(0xff)]],'summary':_0xfc0ace(0xa4),'description':_0x121b41[_0xfc0ace(0xf6)],'access':_0xfc0ace(0x9c),'permissions':[_0xfc0ace(0xe4)]}},async _0x3ff9a4=>getSystemSettings({..._0x3ff9a4[_0xfc0ace(0xa8)],'user':u(_0x3ff9a4)},_0x40c68c));const _0x1d6fcc={};_0x1d6fcc[_0xfc0ace(0x101)]=[_0xfc0ace(0xa2),_0x121b41[_0xfc0ace(0xff)]],_0x1d6fcc[_0xfc0ace(0xf3)]=_0x121b41[_0xfc0ace(0xf5)],_0x1d6fcc[_0xfc0ace(0xfb)]=_0x121b41[_0xfc0ace(0xe2)],_0x1d6fcc[_0xfc0ace(0xe6)]=_0x121b41[_0xfc0ace(0xed)],_0x1d6fcc[_0xfc0ace(0x99)]=[_0x121b41[_0xfc0ace(0xdf)]],_0x1d6fcc[_0xfc0ace(0xc5)]=systemSchemas[_0xfc0ace(0xc9)];const _0x53fddf={};_0x53fddf[_0xfc0ace(0xd6)]=_0x1d6fcc,_0x5c37fc[_0xfc0ace(0xce)](_0xfc0ace(0xa5),_0x53fddf,async _0x1da9cf=>updateSystemSettings({..._0x1da9cf[_0xfc0ace(0xa8)],'patch':_0x1da9cf[_0xfc0ace(0xc5)],'user':u(_0x1da9cf)},_0x40c68c)),_0x5c37fc[_0xfc0ace(0x100)](_0x121b41[_0xfc0ace(0xa3)],{'schema':{'tags':[_0x121b41[_0xfc0ace(0xc6)],_0x121b41[_0xfc0ace(0xff)]],'summary':_0x121b41[_0xfc0ace(0xd9)],'description':_0x121b41[_0xfc0ace(0xf8)],'access':_0x121b41[_0xfc0ace(0xed)],'permissions':[_0x121b41[_0xfc0ace(0xda)]],'querystring':systemSchemas[_0xfc0ace(0xa9)]}},async(_0x183912,_0x32ccc2)=>{const _0x5a7368=_0xfc0ace,{contentType:_0x24531e,body:_0x1535bf}=await _0x3d15c1[_0x5a7368(0xe8)](getSystemLog,{..._0x183912[_0x5a7368(0xb9)],'user':u(_0x183912)},_0x40c68c);return _0x32ccc2[_0x5a7368(0xfd)](_0x24531e)[_0x5a7368(0xd2)](_0x1535bf);}),_0x5c37fc[_0xfc0ace(0x100)](_0x121b41[_0xfc0ace(0xde)],{'schema':{'tags':[_0xfc0ace(0xa2),_0x121b41[_0xfc0ace(0xff)]],'summary':_0x121b41[_0xfc0ace(0xc2)],'description':_0x121b41[_0xfc0ace(0xa7)],'access':_0x121b41[_0xfc0ace(0xed)],'permissions':[_0xfc0ace(0xf2)]}},async _0x3b880b=>getAuditLog({..._0x3b880b[_0xfc0ace(0xb9)],'user':u(_0x3b880b)},_0x40c68c));const _0x23d856={};_0x23d856[_0xfc0ace(0x101)]=[_0xfc0ace(0xa2),_0x121b41[_0xfc0ace(0xff)]],_0x23d856[_0xfc0ace(0xf3)]=_0x121b41[_0xfc0ace(0xbd)],_0x23d856[_0xfc0ace(0xfb)]=_0x121b41[_0xfc0ace(0xac)],_0x23d856[_0xfc0ace(0xe6)]=_0x121b41[_0xfc0ace(0xed)],_0x23d856[_0xfc0ace(0x99)]=[_0x121b41[_0xfc0ace(0xae)]];const _0x456306={};_0x456306[_0xfc0ace(0xd6)]=_0x23d856,_0x5c37fc[_0xfc0ace(0x100)](_0xfc0ace(0xb5),_0x456306,async _0x25ed84=>checkSystem({'user':u(_0x25ed84)},_0x40c68c));const _0x243706={};_0x243706[_0xfc0ace(0x101)]=[_0x121b41[_0xfc0ace(0xc6)],_0x121b41[_0xfc0ace(0xff)]],_0x243706[_0xfc0ace(0xf3)]=_0x121b41[_0xfc0ace(0xc0)],_0x243706[_0xfc0ace(0xfb)]=_0x121b41[_0xfc0ace(0x9f)],_0x243706[_0xfc0ace(0xe6)]=_0x121b41[_0xfc0ace(0xed)],_0x243706[_0xfc0ace(0x99)]=[],_0x243706[_0xfc0ace(0xcc)]=systemSchemas[_0xfc0ace(0xf0)];const _0x33af13={};_0x33af13[_0xfc0ace(0xd6)]=_0x243706,_0x5c37fc[_0xfc0ace(0x100)](_0xfc0ace(0xc7),_0x33af13,async _0x4e136b=>getApiList({'user':u(_0x4e136b),'apiRoutes':_0x33b2fc,..._0x4e136b[_0xfc0ace(0xb9)]},_0x40c68c));};}
|
|
1
|
+
import{getSystemSettings}from'./services/get-system-settings.js';import{updateSystemSettings}from'./services/update-system-settings.js';import{getAuditLog}from'./services/get-audit-log.js';function T(r,u){r=r-0x163;const G=H();let o=G[r];return o;}import{checkSystem}from'./services/check-system.js';import{getApiList}from'./services/get-api-list.js';import{getSystemLog}from'./services/get-system-log.js';import{listDictionaries}from'./services/list-dictionaries.js';import{getDictionary}from'./services/get-dictionary.js';function H(){const Y=['get','system:dictionaries','fcore','system','Update\x20platform\x20dictionary','admin','dictionaryItems','params','accessTarget','post','Set\x20access\x20rules','access','/api/system/settings','system:settings','logger','query','type','send','system:audit','Checks\x20the\x20availability\x20of\x20system\x20dependencies.','Returns\x20the\x20list\x20of\x20registered\x20platform\x20APIs.','apiListQuery'];H=function(){return Y;};return H();}import{updateDictionary}from'./services/update-dictionary.js';import{getAccess}from'./services/get-access.js';import{setAccess}from'./services/set-access.js';import{systemSchemas}from'./schema.js';const u=G=>G['user'];export function systemRoutes(r,G=new Map()){return async o=>{const F=T;o['get']('/api/dictionaries',{'schema':{'tags':['fcore','system'],'summary':'List\x20platform\x20dictionaries','description':'Returns\x20all\x20available\x20dictionaries\x20registered\x20by\x20the\x20platform.','access':'admin','permissions':['system:dictionaries']}},async w=>listDictionaries({'user':u(w)},r)),o[F(0x163)]('/api/dictionaries/:name',{'schema':{'tags':['fcore','system'],'summary':'Get\x20platform\x20dictionary','description':'Returns\x20a\x20registered\x20platform\x20dictionary\x20by\x20name.','access':'admin','permissions':[F(0x164)],'params':systemSchemas['dictionaryName']}},async w=>getDictionary({...w['params'],'user':u(w)},r)),o['post']('/api/dictionaries/:name',{'schema':{'tags':[F(0x165),F(0x166)],'summary':F(0x167),'description':'Replaces\x20the\x20items\x20of\x20a\x20registered\x20platform\x20dictionary.','access':F(0x168),'permissions':[F(0x164)],'params':systemSchemas['dictionaryName'],'body':systemSchemas[F(0x169)]}},async w=>updateDictionary({...w[F(0x16a)],...w['body'],'user':u(w)},r));const X=async w=>getAccess({...w['params'],'user':u(w)},r);o[F(0x163)]('/api/access/:type/:id',{'schema':{'tags':['fcore','system'],'summary':'Get\x20access\x20rules','description':'Returns\x20direct\x20and\x20role-based\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','access':'admin','permissions':['system:access'],'params':systemSchemas[F(0x16b)]}},X),o[F(0x16c)]('/api/access/:type/:id',{'schema':{'tags':['fcore','system'],'summary':F(0x16d),'description':'Replaces\x20direct\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','access':F(0x168),'permissions':['system:access'],'params':systemSchemas[F(0x16b)],'body':systemSchemas[F(0x16e)]}},async w=>setAccess({...w['params'],...w['body'],'user':u(w)},r)),o['get'](F(0x16f),{'schema':{'tags':[F(0x165),'system'],'summary':'Get\x20system\x20settings','description':'Returns\x20system\x20settings\x20as\x20nested\x20JSON.','access':'admin','permissions':[F(0x170)]}},async w=>getSystemSettings({...w['params'],'user':u(w)},r)),o[F(0x16c)]('/api/system/settings',{'schema':{'tags':[F(0x165),'system'],'summary':'Update\x20system\x20settings','description':'Updates\x20system\x20settings\x20using\x20flat\x20dot-notation\x20keys.','access':F(0x168),'permissions':['system:settings'],'body':systemSchemas['settings']}},async w=>updateSystemSettings({...w['params'],'patch':w['body'],'user':u(w)},r)),o[F(0x163)]('/api/system/logger',{'schema':{'tags':['fcore',F(0x166)],'summary':'Get\x20system\x20log','description':'Returns\x20system\x20logger\x20entries\x20for\x20the\x20requested\x20path.','access':'admin','permissions':['system:logs'],'querystring':systemSchemas[F(0x171)]}},async(w,a)=>{const E=F,{contentType:q,body:p}=await getSystemLog({...w[E(0x172)],'user':u(w)},r);return a[E(0x173)](q)[E(0x174)](p);}),o['get']('/api/system/audit',{'schema':{'tags':['fcore','system'],'summary':'Get\x20audit\x20log','description':'Returns\x20the\x20system\x20audit\x20log\x20entries.','access':'admin','permissions':[F(0x175)]}},async w=>getAuditLog({...w[F(0x172)],'user':u(w)},r)),o['get']('/api/system/check',{'schema':{'tags':[F(0x165),'system'],'summary':'Check\x20system\x20health','description':F(0x176),'access':F(0x168),'permissions':['system:check']}},async w=>checkSystem({'user':u(w)},r)),o['get']('/api/system/list',{'schema':{'tags':['fcore',F(0x166)],'summary':'List\x20APIs','description':F(0x177),'access':'admin','permissions':[],'querystring':systemSchemas[F(0x178)]}},async w=>getApiList({'user':u(w),'apiRoutes':G,...w['query']},r));};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const r=T;import{Type}from'@sinclair/typebox';function T(r,u){r=r-0xd0;const G=H();let o=G[r];return o;}export const identifier=Type['String']({'minLength':0x1,'maxLength':0x80,'pattern':r(0xd0)});export const systemSchemas={'dictionaryName':Type[r(0xd1)]({'name':identifier}),'dictionaryItems':Type[r(0xd1)]({'items':Type[r(0xd2)](Type[r(0xd1)]({'id':Type[r(0xd3)](Type[r(0xd4)]([Type['String'](),Type[r(0xd5)]()])),'code':Type[r(0xd6)]({'minLength':0x1}),'name':Type[r(0xd6)]({'minLength':0x1}),'parentId':Type[r(0xd3)](Type['Union']([Type['String'](),Type['Number'](),Type['Null']()]))},{'additionalProperties':!![]}))}),'accessTarget':Type[r(0xd1)]({'type':Type['Union']([Type['Literal']('user'),Type[r(0xd7)](r(0xd8))]),'id':identifier}),'access':Type['Object']({'access':Type['Array'](Type['Object']({'resource':Type['String']({'minLength':0x1,'maxLength':0x80}),'actions':Type['Array'](Type['String']({'minLength':0x1,'maxLength':0x80}),{'minItems':0x1})}))}),'apiListQuery':Type['Object']({'format':Type['Optional'](Type['Union']([Type['Literal'](r(0xd9)),Type['Literal']('extended')]))}),'settingsEntity':Type[r(0xd1)]({'entity':Type['Optional'](identifier)}),'settings':Type['Record'](Type[r(0xd6)]({'minLength':0x1}),Type['Unknown']()),'logger':Type['Object']({'path':Type[r(0xd3)](Type['String']({'maxLength':0x100,'pattern':'^[A-Za-z0-9_.\x5c-/]*$'}))})};function H(){const u=['^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$','Object','Array','Optional','Union','Number','String','Literal','role','short'];H=function(){return u;};return H();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function T(r,u){r=r-0xfc;const G=H();let o=G[r];return o;}function H(){const w=['query','redis','status','fulfilled'];H=function(){return w;};return H();}import{requireAdmin}from'../../utils/require-admin.js';export async function checkSystem(r,u){const X=T;requireAdmin(r['user'],'system:check');const [G,o]=await Promise['allSettled']([u['pg'][X(0xfc)]('SELECT\x201'),u[X(0xfd)]['ping']()]);return{'status':G[X(0xfe)]===X(0xff)&&o['status']==='fulfilled'?'ok':'degraded','pg':G[X(0xfe)],'redis':o[X(0xfe)]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{requireAdmin}from'../../utils/require-admin.js';function H(){const w=['system:access'];H=function(){return w;};return H();}function T(r,u){r=r-0x15e;const G=H();let o=G[r];return o;}export async function getAccess(r,u){const X=T;requireAdmin(r['user'],X(0x15e));const G=r['type']==='user'?'\x0a\x20\x20\x20\x20\x20\x20\x20\x20SELECT\x20ra.resource,\x20ra.actions,\x20ra.role_id\x20AS\x20role\x0a\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20admin.role_access\x20ra\x0a\x20\x20\x20\x20\x20\x20\x20\x20LEFT\x20JOIN\x20admin.user_roles\x20ur\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20ur.role_id\x20=\x20ra.role_id\x20AND\x20ur.user_uid\x20=\x20$1\x0a\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20ra.user_uid\x20=\x20$1\x20OR\x20ur.user_uid\x20=\x20$1\x0a\x20\x20\x20\x20\x20\x20':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20SELECT\x20ra.resource,\x20ra.actions,\x20ra.role_id\x20AS\x20role\x0a\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20admin.role_access\x20ra\x0a\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20ra.role_id\x20=\x20$1\x0a\x20\x20\x20\x20\x20\x20',o=await u['pg']['query'](G,[r['id']]);return{'access':o['rows']};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function T(r,u){r=r-0xa6;const G=H();let o=G[r];return o;}function H(){const p=['user','apiRoutes','sort','endpoint','format','short'];H=function(){return p;};return H();}import{requireAdmin}from'../../utils/require-admin.js';export async function getApiList(r,u){const q=T;requireAdmin(r[q(0xa6)],'system:list');const G=[...r[q(0xa7)]['values']()][q(0xa8)]((o,X)=>(o['endpoint']+'\x20'+o['method'])['localeCompare'](X[q(0xa9)]+'\x20'+X['method']));if(r[q(0xaa)]!==q(0xab))return G;return G['map'](({method:o,endpoint:X,access:w,permissions:a})=>o+'\x20'+X);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function T(r,u){r=r-0x15f;const G=H();let o=G[r];return o;}import{requireAdmin}from'../../utils/require-admin.js';export async function getAuditLog(u,G){const a=T;requireAdmin(u[a(0x15f)],a(0x160));const o=Math['min'](Math['max'](u[a(0x161)]??0x32,0x1),0xc8),X=Math['max']((u['page']??0x1)-0x1,0x0)*o,w=await G['pg']['query']('SELECT\x20*\x20FROM\x20admin.audit_log\x20ORDER\x20BY\x20id\x20DESC\x20LIMIT\x20$1\x20OFFSET\x20$2',[o,X]);return{'rows':w[a(0x162)],'page':u['page']??0x1,'limit':o};}function H(){const q=['user','system:audit','limit','rows'];H=function(){return q;};return H();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function getDictionary(r,u){return u['dictionary']['get'](r['name']);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x12b9ea=_0x4541;(function(_0xed251a,_0x1b76b9){const _0x137c2e=_0x4541,_0x2f6df2=_0xed251a();while(!![]){try{const _0x383d1e=-parseInt(_0x137c2e(0xc4))/0x1+parseInt(_0x137c2e(0xa0))/0x2+-parseInt(_0x137c2e(0x7e))/0x3*(parseInt(_0x137c2e(0xa9))/0x4)+-parseInt(_0x137c2e(0x8f))/0x5*(-parseInt(_0x137c2e(0x9e))/0x6)+-parseInt(_0x137c2e(0xe0))/0x7+parseInt(_0x137c2e(0x9f))/0x8*(-parseInt(_0x137c2e(0xdf))/0x9)+parseInt(_0x137c2e(0x9a))/0xa;if(_0x383d1e===_0x1b76b9)break;else _0x2f6df2['push'](_0x2f6df2['shift']());}catch(_0x5301fb){_0x2f6df2['push'](_0x2f6df2['shift']());}}}(_0x462f,0x7139f));import _0x108ef6 from'node:fs/promises';import _0x1d6e59 from'node:path';import{requireAdmin}from'../../utils/require-admin.js';function _0x462f(){const _0x4dda9d=['withFileTypes','cwd','isDirectory','<li><a\x20href=\x22','jenWB','>','some','&','GyaQa','bKeqS','type','rtycy','rchkr','uTXvJ','directory','304886QerFox','uBFSd','resolve','</a></li>','cgVhM','lTBnH','FLByh','KOlev','toISOString','join','dkMHL','close','logs','Yrfiq','FqEyf','utf8','system:logs','twBtV','open','<!DOCTYPE\x20html>\x0a<html>\x0a<head><meta\x20charset=\x22utf-8\x22><title>','tTsXP','</title></head>\x0a<body>\x0a<h1>','catch','concat','sep','vYjok','logs/','4513302QEmOEK','1646463qIAgfr','MvtFV','min','map','AgTTA','xkDmL','Log\x20path\x20not\x20found','Sqpwn','toString','hPmvV','name','startsWith','512514RBAfRq','ijNYo','pPyYL','BnIQa','iXJuC','text/html;\x20charset=utf-8','\x0a</ul>\x0a</body>\x0a</html>','KbbZl','split','EHfbr','user','file','fXDVN','localeCompare','aGGdY','reverse','</h1>\x0a<ul>\x0a','3165570oapBPQ','GPVPA','Invalid\x20log\x20path','read','kLvtB','replace','readdir','gxczO','pJKRc','text/plain;\x20charset=utf-8','bKNfk','8881570riCBnD','all','length','lQeuQ','6myxame','8LtFjSc','993182jxcMxp','CddKP','filter','<','BaKfz','slice','sort','mtime','alloc','12aYXTGW','nzOGj','Rfzlr','unshift','?path=','KJpWP','fsOlA','path','fRRDF','"','size','stat'];_0x462f=function(){return _0x4dda9d;};return _0x462f();}import{NotFoundError,ValidationError}from'../../../errors.js';const LOGS_ROOT=_0x1d6e59[_0x12b9ea(0xc6)](process[_0x12b9ea(0xb6)](),_0x12b9ea(0xd0)),TAIL_LINES=0x64;export async function getSystemLog(_0x5a66df,_0x196496){const _0x185761=_0x12b9ea,_0x54ad3b={'kLvtB':function(_0x40a8dd,_0x2b3d13){return _0x40a8dd===_0x2b3d13;},'pPyYL':function(_0x237e3c,_0x4f6849){return _0x237e3c??_0x4f6849;},'iXJuC':_0x185761(0x91),'GPVPA':function(_0x54d4d,_0x389c20){return _0x54d4d===_0x389c20;},'gxczO':_0x185761(0xd1),'cgVhM':_0x185761(0xc3),'rtycy':function(_0xaf40a5,_0x3a3eb1,_0x102bc3){return _0xaf40a5(_0x3a3eb1,_0x102bc3);},'FqEyf':function(_0x488047,_0x2727b1){return _0x488047!==_0x2727b1;},'lTBnH':function(_0x418fb9,_0x546738){return _0x418fb9!==_0x546738;},'xkDmL':_0x185761(0x9d),'fRRDF':_0x185761(0xe6),'GyaQa':function(_0x57d32c,_0x1df25b){return _0x57d32c===_0x1df25b;},'ijNYo':_0x185761(0xce),'BaKfz':_0x185761(0x83),'rchkr':function(_0x55bb74,_0x4f9eaa,_0x4b059f){return _0x55bb74(_0x4f9eaa,_0x4b059f);},'FLByh':function(_0x2ab187,_0x3b02d8,_0x27456f){return _0x2ab187(_0x3b02d8,_0x27456f);},'EHfbr':_0x185761(0x98)};_0x54ad3b[_0x185761(0xc0)](requireAdmin,_0x5a66df[_0x185761(0x88)],_0x185761(0xd4));const _0x585d1e=normalizePath(_0x5a66df[_0x185761(0xb0)]),_0x7704ec=_0x1d6e59[_0x185761(0xc6)](LOGS_ROOT,_0x585d1e);if(_0x54ad3b[_0x185761(0xd2)](_0x7704ec,LOGS_ROOT)&&!_0x7704ec[_0x185761(0xeb)](LOGS_ROOT+_0x1d6e59[_0x185761(0xdc)])){if(_0x54ad3b[_0x185761(0xc9)](_0x54ad3b[_0x185761(0xe5)],_0x54ad3b[_0x185761(0xe5)])){if(_0x54ad3b[_0x185761(0x93)](_0xfe1c89,0xa))_0x336081++;}else throw new ValidationError(_0x54ad3b[_0x185761(0x82)]);}const _0x11f746=await _0x108ef6[_0x185761(0xb4)](_0x7704ec)[_0x185761(0xda)](()=>null);if(!_0x11f746){if(_0x54ad3b[_0x185761(0xc9)](_0x185761(0xe1),_0x185761(0x97)))throw new NotFoundError(_0x54ad3b[_0x185761(0xb1)]);else throw new _0x4ac0b9(_0x185761(0xe6));}if(_0x11f746[_0x185761(0xb7)]()){const _0x5930ae={};_0x5930ae[_0x185761(0xb5)]=!![];const _0x4987c0=await _0x108ef6[_0x185761(0x95)](_0x7704ec,_0x5930ae),_0x4a60fa=await Promise[_0x185761(0x9b)](_0x4987c0[_0x185761(0xe3)](async _0x52e1ab=>{const _0x2c36cb=_0x185761;if(_0x54ad3b[_0x2c36cb(0x90)](_0x2c36cb(0xd1),_0x54ad3b[_0x2c36cb(0x96)])){const _0x40342f=await _0x108ef6[_0x2c36cb(0xb4)](_0x1d6e59[_0x2c36cb(0xcd)](_0x7704ec,_0x52e1ab[_0x2c36cb(0xea)]));return{'name':_0x52e1ab[_0x2c36cb(0xea)],'path':_0x585d1e?_0x585d1e+'/'+_0x52e1ab[_0x2c36cb(0xea)]:_0x52e1ab[_0x2c36cb(0xea)],'type':_0x52e1ab[_0x2c36cb(0xb7)]()?_0x54ad3b[_0x2c36cb(0xc8)]:_0x2c36cb(0x89),'size':_0x52e1ab[_0x2c36cb(0xb7)]()?undefined:_0x40342f[_0x2c36cb(0xb3)],'modified':_0x40342f[_0x2c36cb(0xa7)][_0x2c36cb(0xcc)]()};}else{const _0x2004f1=_0x54ad3b[_0x2c36cb(0x80)](_0x3931ae,'')[_0x2c36cb(0x94)](/\\/g,'/')[_0x2c36cb(0x94)](/^\/+|\/+$/g,'');if(_0x2004f1[_0x2c36cb(0x86)]('/')[_0x2c36cb(0xbb)](_0x269c09=>_0x269c09==='..'))throw new _0x3ff7ff(_0x54ad3b[_0x2c36cb(0x82)]);return _0x2004f1;}}));_0x4a60fa[_0x185761(0xa6)]((_0x3e5b3f,_0x3f3c4b)=>_0x3e5b3f[_0x185761(0xea)][_0x185761(0x8b)](_0x3f3c4b[_0x185761(0xea)]));if(_0x585d1e){if(_0x54ad3b[_0x185761(0xbd)](_0x54ad3b[_0x185761(0x7f)],_0x54ad3b[_0x185761(0x7f)])){const _0x184ec8=_0x585d1e[_0x185761(0x86)]('/')[_0x185761(0xa5)](0x0,-0x1)[_0x185761(0xcd)]('/'),_0x482653={};_0x482653[_0x185761(0xea)]='..',_0x482653[_0x185761(0xb0)]=_0x184ec8,_0x482653[_0x185761(0xbf)]=_0x54ad3b[_0x185761(0xc8)],_0x4a60fa[_0x185761(0xac)](_0x482653);}else{let _0x4b3598=0x0;for(const _0xef434e of _0x33c98d){if(_0x54ad3b[_0x185761(0x90)](_0xef434e,0xa))_0x4b3598++;}return _0x4b3598;}}return{'contentType':_0x54ad3b[_0x185761(0xa4)],'body':_0x54ad3b[_0x185761(0xc1)](renderDirectory,_0x585d1e,_0x4a60fa)};}const _0x13ed0f=await _0x54ad3b[_0x185761(0xca)](tailFile,_0x7704ec,TAIL_LINES);return{'contentType':_0x54ad3b[_0x185761(0x87)],'body':_0x13ed0f[_0x185761(0xcd)]('\x0a')};}function renderDirectory(_0x3d7f2a,_0x56dad2){const _0x45c75d=_0x12b9ea,_0x8cf59b={'fsOlA':function(_0xcfb37f,_0x57db2d){return _0xcfb37f(_0x57db2d);},'twBtV':_0x45c75d(0xc3),'nzOGj':function(_0xf65482,_0x44b20d){return _0xf65482(_0x44b20d);}},_0x3cbb89=_0x56dad2[_0x45c75d(0xe3)](_0x53347e=>{const _0x54fa05=_0x45c75d,_0x1c8741=_0x54fa05(0xad)+_0x8cf59b[_0x54fa05(0xaf)](encodeURIComponent,_0x53347e[_0x54fa05(0xb0)]),_0x2bc520=_0x53347e[_0x54fa05(0xbf)]===_0x8cf59b[_0x54fa05(0xd5)]?_0x53347e[_0x54fa05(0xea)]+'/':_0x53347e[_0x54fa05(0xea)];return _0x54fa05(0xb8)+_0x1c8741+'\x22>'+_0x8cf59b[_0x54fa05(0xaf)](escapeHtml,_0x2bc520)+_0x54fa05(0xc7);})[_0x45c75d(0xcd)]('\x0a'),_0x5153ee=_0x8cf59b[_0x45c75d(0xaa)](escapeHtml,_0x45c75d(0xde)+_0x3d7f2a);return _0x45c75d(0xd7)+_0x5153ee+_0x45c75d(0xd9)+_0x5153ee+_0x45c75d(0x8e)+_0x3cbb89+_0x45c75d(0x84);}function escapeHtml(_0x2f6fe0){const _0x3592f1=_0x12b9ea,_0x9162d9={};_0x9162d9[_0x3592f1(0xc2)]=_0x3592f1(0xbc),_0x9162d9[_0x3592f1(0xbe)]=_0x3592f1(0xa3),_0x9162d9[_0x3592f1(0xe4)]=_0x3592f1(0xba),_0x9162d9[_0x3592f1(0xe9)]=_0x3592f1(0xb2);const _0x4a6be0=_0x9162d9;return _0x2f6fe0[_0x3592f1(0x94)](/&/g,_0x4a6be0[_0x3592f1(0xc2)])[_0x3592f1(0x94)](/</g,_0x4a6be0[_0x3592f1(0xbe)])[_0x3592f1(0x94)](/>/g,_0x4a6be0[_0x3592f1(0xe4)])[_0x3592f1(0x94)](/"/g,_0x4a6be0[_0x3592f1(0xe9)]);}function normalizePath(_0x3a08aa){const _0x19201d=_0x12b9ea,_0x2ebbb6={};_0x2ebbb6[_0x19201d(0x8c)]=_0x19201d(0xc3),_0x2ebbb6[_0x19201d(0x8a)]=_0x19201d(0xe7);const _0x2d9960=_0x2ebbb6,_0x359f0d=(_0x3a08aa??'')[_0x19201d(0x94)](/\\/g,'/')[_0x19201d(0x94)](/^\/+|\/+$/g,'');if(_0x359f0d[_0x19201d(0x86)]('/')[_0x19201d(0xbb)](_0x287368=>_0x287368==='..')){if(_0x2d9960[_0x19201d(0x8a)]!==_0x2d9960[_0x19201d(0x8a)]){const _0x262a19=_0x42ee39[_0x19201d(0x86)]('/')[_0x19201d(0xa5)](0x0,-0x1)[_0x19201d(0xcd)]('/'),_0x4c9905={};_0x4c9905[_0x19201d(0xea)]='..',_0x4c9905[_0x19201d(0xb0)]=_0x262a19,_0x4c9905[_0x19201d(0xbf)]=PwfGab[_0x19201d(0x8c)],_0x512d4b[_0x19201d(0xac)](_0x4c9905);}else throw new ValidationError(_0x19201d(0x91));}return _0x359f0d;}async function tailFile(_0x28c30d,_0x33fddb){const _0x1ce0c5=_0x12b9ea,_0x59b01c={};_0x59b01c[_0x1ce0c5(0xdd)]=function(_0x17171d,_0x587491){return _0x17171d*_0x587491;},_0x59b01c[_0x1ce0c5(0xb9)]=function(_0x2246f4,_0x5c7903){return _0x2246f4>_0x5c7903;},_0x59b01c[_0x1ce0c5(0x85)]=function(_0x2a9b0e,_0x28c2d3){return _0x2a9b0e<=_0x28c2d3;},_0x59b01c[_0x1ce0c5(0xd8)]=_0x1ce0c5(0x81);const _0x3f6abc=_0x59b01c,_0x4e1b56=await _0x108ef6[_0x1ce0c5(0xd6)](_0x28c30d,'r');try{const {size:_0x320d04}=await _0x4e1b56[_0x1ce0c5(0xb4)](),_0x5a348c=_0x3f6abc[_0x1ce0c5(0xdd)](0x40,0x400);let _0x505176=_0x320d04,_0x22d925=Buffer[_0x1ce0c5(0xa8)](0x0),_0x4775d4=0x0;while(_0x3f6abc[_0x1ce0c5(0xb9)](_0x505176,0x0)&&_0x3f6abc[_0x1ce0c5(0x85)](_0x4775d4,_0x33fddb)){if(_0x3f6abc[_0x1ce0c5(0xd8)]===_0x3f6abc[_0x1ce0c5(0xd8)]){const _0x1357dc=Math[_0x1ce0c5(0xe2)](_0x5a348c,_0x505176);_0x505176-=_0x1357dc;const _0x5960cc=Buffer[_0x1ce0c5(0xa8)](_0x1357dc);await _0x4e1b56[_0x1ce0c5(0x92)](_0x5960cc,0x0,_0x1357dc,_0x505176),_0x22d925=Buffer[_0x1ce0c5(0xdb)]([_0x5960cc,_0x22d925]),_0x4775d4+=countNewlines(_0x5960cc);}else throw new _0x224a1b(_0x1ce0c5(0x91));}const _0x36bca8=_0x22d925[_0x1ce0c5(0xe8)](_0x1ce0c5(0xd3))[_0x1ce0c5(0x86)]('\x0a')[_0x1ce0c5(0xa2)](_0x2e8438=>_0x2e8438[_0x1ce0c5(0x9c)]>0x0);return _0x36bca8[_0x1ce0c5(0xa5)](-_0x33fddb)[_0x1ce0c5(0x8d)]();}finally{await _0x4e1b56[_0x1ce0c5(0xcf)]();}}function _0x4541(_0x6ad5cc,_0x117a17){_0x6ad5cc=_0x6ad5cc-0x7e;const _0x462f75=_0x462f();let _0x454106=_0x462f75[_0x6ad5cc];return _0x454106;}function countNewlines(_0x22f042){const _0x59b57=_0x12b9ea,_0x684a65={'bKNfk':function(_0x53e5f2,_0xcf06b0){return _0x53e5f2(_0xcf06b0);},'CddKP':function(_0x34d26c,_0x440259){return _0x34d26c===_0x440259;},'KOlev':_0x59b57(0xc3),'Rfzlr':function(_0x53e4fd,_0x4c5fc4){return _0x53e4fd!==_0x4c5fc4;},'uBFSd':_0x59b57(0xae)};let _0x2a90d1=0x0;for(const _0x375a21 of _0x22f042){if(_0x684a65[_0x59b57(0xab)](_0x684a65[_0x59b57(0xc5)],_0x684a65[_0x59b57(0xc5)])){const _0x4dff68=_0x59b57(0xad)+JrLeKX[_0x59b57(0x99)](_0x3aff8b,_0x4311c3[_0x59b57(0xb0)]),_0x517f84=JrLeKX[_0x59b57(0xa1)](_0x110403[_0x59b57(0xbf)],JrLeKX[_0x59b57(0xcb)])?_0x17ae19[_0x59b57(0xea)]+'/':_0x30dce4[_0x59b57(0xea)];return _0x59b57(0xb8)+_0x4dff68+'\x22>'+JrLeKX[_0x59b57(0x99)](_0x308fd7,_0x517f84)+_0x59b57(0xc7);}else{if(_0x684a65[_0x59b57(0xa1)](_0x375a21,0xa))_0x2a90d1++;}}return _0x2a90d1;}
|
|
1
|
+
import r from'node:fs/promises';import u from'node:path';import{requireAdmin}from'../../utils/require-admin.js';import{NotFoundError,ValidationError}from'../../../errors.js';const LOGS_ROOT=u['resolve'](process['cwd'](),'logs'),TAIL_LINES=0x64;function T(r,u){r=r-0xfe;const G=H();let o=G[r];return o;}export async function getSystemLog(G,o){const c=T;requireAdmin(G['user'],'system:logs');const X=normalizePath(G['path']),w=u['resolve'](LOGS_ROOT,X);if(w!==LOGS_ROOT&&!w['startsWith'](LOGS_ROOT+u[c(0xfe)]))throw new ValidationError('Invalid\x20log\x20path');const a=await r[c(0xff)](w)['catch'](()=>null);if(!a)throw new NotFoundError('Log\x20path\x20not\x20found');if(a[c(0x100)]()){const p=await r[c(0x101)](w,{'withFileTypes':!![]}),F=await Promise['all'](p['map'](async E=>{const h=c,Y=await r['stat'](u[h(0x102)](w,E[h(0x103)]));return{'name':E['name'],'path':X?X+'/'+E['name']:E['name'],'type':E['isDirectory']()?'directory':'file','size':E['isDirectory']()?undefined:Y['size'],'modified':Y[h(0x104)]['toISOString']()};}));F['sort']((E,Y)=>E['name']['localeCompare'](Y[c(0x103)]));if(X){const E=X['split']('/')['slice'](0x0,-0x1)['join']('/');F['unshift']({'name':'..','path':E,'type':'directory'});}return{'contentType':'text/html;\x20charset=utf-8','body':renderDirectory(X,F)};}const q=await tailFile(w,TAIL_LINES);return{'contentType':'text/plain;\x20charset=utf-8','body':q['join']('\x0a')};}function renderDirectory(G,o){const P=T,X=o[P(0x105)](a=>{const q='?path='+encodeURIComponent(a['path']),p=a['type']==='directory'?a['name']+'/':a['name'];return'<li><a\x20href=\x22'+q+'\x22>'+escapeHtml(p)+'</a></li>';})[P(0x102)]('\x0a'),w=escapeHtml('logs/'+G);return'<!DOCTYPE\x20html>\x0a<html>\x0a<head><meta\x20charset=\x22utf-8\x22><title>'+w+'</title></head>\x0a<body>\x0a<h1>'+w+'</h1>\x0a<ul>\x0a'+X+'\x0a</ul>\x0a</body>\x0a</html>';}function escapeHtml(G){const l=T;return G[l(0x106)](/&/g,'&')[l(0x106)](/</g,'<')[l(0x106)](/>/g,'>')[l(0x106)](/"/g,'"');}function normalizePath(G){const Q=T,o=(G??'')['replace'](/\\/g,'/')[Q(0x106)](/^\/+|\/+$/g,'');if(o['split']('/')[Q(0x107)](X=>X==='..'))throw new ValidationError(Q(0x108));return o;}async function tailFile(G,o){const J=T,X=await r[J(0x109)](G,'r');try{const {size:w}=await X['stat'](),a=0x40*0x400;let q=w,p=Buffer['alloc'](0x0),F=0x0;while(q>0x0&&F<=o){const Y=Math['min'](a,q);q-=Y;const S=Buffer['alloc'](Y);await X['read'](S,0x0,Y,q),p=Buffer['concat']([S,p]),F+=countNewlines(S);}const E=p['toString']('utf8')['split']('\x0a')[J(0x10a)](I=>I['length']>0x0);return E['slice'](-o)['reverse']();}finally{await X['close']();}}function H(){const O=['sep','stat','isDirectory','readdir','join','name','mtime','map','replace','some','Invalid\x20log\x20path','open','filter'];H=function(){return O;};return H();}function countNewlines(G){let o=0x0;for(const X of G){if(X===0xa)o++;}return o;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{requireAdmin}from'../../utils/require-admin.js';function T(r,u){r=r-0x163;const G=H();let o=G[r];return o;}export async function getSystemSettings(r,u){const p=T;requireAdmin(r[p(0x163)],'system:settings');const G=await u['pg']['query']('\x0a\x20\x20\x20\x20\x20\x20SELECT\x20key,\x20value\x0a\x20\x20\x20\x20\x20\x20FROM\x20admin.settings\x0a\x20\x20\x20\x20\x20\x20WHERE\x20resource\x20=\x20\x27system\x27\x20AND\x20resource_id\x20IS\x20NULL\x0a\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20key\x0a\x20\x20\x20\x20');return G[p(0x164)][p(0x165)]((o,X)=>{const F=p,w=String(X['key'])[F(0x166)]('.');let a=o;for(const q of w['slice'](0x0,-0x1)){a[q]??={},a=a[q];}return a[w['at'](-0x1)]=X[F(0x167)],o;},{});}function H(){const E=['user','rows','reduce','split','value'];H=function(){return E;};return H();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function listDictionaries(r,u){return u['dictionary']['list']();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{requireAdmin}from'../../utils/require-admin.js';function T(r,u){r=r-0x13d;const G=H();let o=G[r];return o;}import{getAccess}from'./get-access.js';export async function setAccess(r,u){const w=T;requireAdmin(r['user'],'system:access');const G=await u['pg']['connect']();try{await G['query']('BEGIN');r[w(0x13d)]===w(0x13e)?await G['query'](w(0x13f),[r['id']]):await G['query']('DELETE\x20FROM\x20admin.role_access\x20WHERE\x20role_id\x20=\x20$1\x20AND\x20user_uid\x20IS\x20NULL',[r['id']]);for(const o of r['access']){r['type']===w(0x13e)?await G['query']('INSERT\x20INTO\x20admin.role_access\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(\x20resource,\x20actions,\x20user_uid,\x20created_by,\x20updated_by)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4,\x20$5)',[o[w(0x140)],o[w(0x141)],r['id'],r[w(0x13e)]['id'],r[w(0x13e)]['id']]):await G['query']('INSERT\x20INTO\x20admin.role_access\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(\x20resource,\x20actions,\x20role_id,\x20created_by,\x20updated_by)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4,\x20$5)',[o['resource'],o[w(0x141)],r['id'],r['user']['id'],r['user']['id']]);}await G['query']('COMMIT');}catch(X){await G['query']('ROLLBACK');throw X;}finally{G['release']();}return getAccess(r,u);}function H(){const a=['type','user','DELETE\x20FROM\x20admin.role_access\x20WHERE\x20user_uid\x20=\x20$1\x20AND\x20role_id\x20IS\x20NULL','resource','actions'];H=function(){return a;};return H();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function T(r,u){r=r-0xed;var G=H();var o=G[r];return o;}function H(){var o=['name'];H=function(){return o;};return H();}import{requireAdmin}from'../../utils/require-admin.js';export async function updateDictionary(r,u){var G=T;return requireAdmin(r['user'],'system:dictionaries'),await u['dictionary']['put'](r[G(0xed)],r['items']),{'success':!![]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{requireAdmin}from'../../utils/require-admin.js';function T(r,u){r=r-0x183;const G=H();let o=G[r];return o;}import{ValidationError}from'../../../errors.js';function H(){const w=['system:settings','entries','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.settings\x20(resource,\x20resource_id,\x20key,\x20value,\x20updated_by)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(\x27system\x27,\x20NULL,\x20$1,\x20$2::jsonb,\x20$3)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20CONFLICT\x20(resource,\x20resource_id,\x20key)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20DO\x20UPDATE\x20SET\x20value\x20=\x20EXCLUDED.value,\x20updated_by\x20=\x20EXCLUDED.updated_by,\x20updated_at\x20=\x20now()\x0a\x20\x20\x20\x20\x20\x20\x20\x20','user'];H=function(){return w;};return H();}export async function updateSystemSettings(r,u){const X=T;requireAdmin(r['user'],X(0x183));if(!Object['keys'](r['patch'])['length'])throw new ValidationError('Settings\x20patch\x20is\x20empty');for(const [G,o]of Object[X(0x184)](r['patch'])){if(!G['trim']()||G['includes']('..'))throw new ValidationError('Invalid\x20setting\x20key:\x20'+G);await u['pg']['query'](X(0x185),[G,JSON['stringify'](o),r[X(0x186)]['id']]);}return{'success':!![]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function H(){var o=['type','admin'];H=function(){return o;};return H();}import{ForbiddenError}from'../../errors.js';function T(r,u){r=r-0xab;var G=H();var o=G[r];return o;}export function requireAdmin(r,u){var G=T;if(!r)throw new ForbiddenError('User\x20required');if(r[G(0xab)]!=='admin')throw new ForbiddenError('Admin\x20access\x20required');if(r['type']!==G(0xac)&&u&&!r['permissions']?.['includes'](u))throw new ForbiddenError('Missing\x20permission:\x20'+u);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function T(r,u){r=r-0x139;const G=H();let o=G[r];return o;}function H(){const w=['token','entries'];H=function(){return w;};return H();}export const safeUser=r=>{const X=T,u=['password','salt',X(0x139),'secret','credentials'];return Object['fromEntries'](Object[X(0x13a)](r)['filter'](([G])=>!u['some'](o=>G['toLowerCase']()['includes'](o))));};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{UnsupportedError}from'../../errors.js';export function unsupported(r){throw new UnsupportedError(r+'\x20requires\x20a\x20project/provider\x20implementation');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{writeAudit}from'./services/write-audit.js';export function createAudit(r){const u=writeAudit(r);return{'write':u};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export*from'./audit.types.js';export*from'./audit.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const secretPattern=/password|token|secret|credential|salt/i;function clean(r){const F=T;if(Array['isArray'](r))return r[F(0xcf)](clean);if(r&&typeof r===F(0xd0))return Object[F(0xd1)](Object['entries'](r)['map'](([u,G])=>[u,secretPattern['test'](u)?'[REDACTED]':clean(G)]));return r;}function T(r,u){r=r-0xcf;const G=H();let o=G[r];return o;}function H(){const c=['map','object','fromEntries','query','then','rows','audit_log_data','admin.audit_log','Audit\x20tables\x20are\x20unavailable;\x20audit\x20writes\x20are\x20disabled','catch','logger','changes','oldValue','audit','empty\x20pg','\x0a\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.audit_log\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20user_id,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20module,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20resource,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20resource_id,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20fields,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20action,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20request_id,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ip_address,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20metadata\x0a\x20\x20\x20\x20\x20\x20\x20\x20)\x0a\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4,\x20$5,\x20$6,\x20$7,\x20$8,\x20$9)\x0a\x20\x20\x20\x20\x20\x20\x20\x20RETURNING\x20id\x0a\x20\x20\x20\x20\x20\x20','userId','action','metadata','field'];H=function(){return c;};return H();}export function writeAudit(r){let u,G;async function o(){const E=T;if(!r['pg'])return![];if(u!==undefined)return u;return G??=r['pg'][E(0xd2)]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20SELECT\x20table_name\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20information_schema.tables\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20table_schema\x20=\x20\x27admin\x27\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20table_name\x20IN\x20(\x27audit_log\x27,\x20\x27audit_log_data\x27)\x0a\x20\x20\x20\x20\x20\x20\x20\x20')[E(0xd3)](X=>{const Y=E,w=new Set(X[Y(0xd4)]['map'](a=>a['table_name']));return u=w['has']('audit_log')&&w['has'](Y(0xd5)),!u&&r['logger']['warn']({'expectedTables':[Y(0xd6),'admin.audit_log_data'],'foundTables':[...w]},Y(0xd7)),u;})[E(0xd8)](X=>{const S=E;return u=![],r[S(0xd9)]['warn']({'err':X},'Unable\x20to\x20check\x20audit\x20tables;\x20audit\x20writes\x20are\x20disabled'),![];}),G;}return async function X(w){const I=T;if(!await o())return r['logger']['info']({'auditFallback':!![],'event':clean({...w,'changes':w[I(0xda)]?.['map'](p=>({...p,'oldValue':clean(p[I(0xdb)]),'newValue':clean(p['newValue'])}))})},I(0xdc)),0x0;if(!r['pg'])throw new Error(I(0xdd));const a=await r['pg'][I(0xd2)](I(0xde),[w[I(0xdf)]??null,w['module'],w['resource'],w['resourceId']==null?null:String(w['resourceId']),w['fields']??null,w[I(0xe0)],w['requestId']??null,w['ipAddress']??null,clean(w[I(0xe1)]??{})]),q=a[I(0xd4)][0x0]['id'];for(const p of w['changes']??[]){if(secretPattern['test'](p['field']))continue;await r['pg']['query']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.audit_log_data\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20audit_log_id,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20field,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20old_value,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20new_value\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4)\x0a\x20\x20\x20\x20\x20\x20\x20\x20',[q,p[I(0xe2)],JSON['stringify'](clean(p['oldValue'])),JSON['stringify'](clean(p['newValue']))]);}return q;};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function H(){const w=['query'];H=function(){return w;};return H();}function T(r,u){r=r-0x19d;const G=H();let o=G[r];return o;}export async function getUserPermissions(r,u){const X=T,G=await u['pg'][X(0x19d)]('\x0a\x20\x20\x20\x20\x20\x20SELECT\x20DISTINCT\x20ra.resource\x20||\x20\x27:\x27\x20||\x20action\x20AS\x20permission\x0a\x20\x20\x20\x20\x20\x20FROM\x20admin.role_access\x20ra\x0a\x20\x20\x20\x20\x20\x20LEFT\x20JOIN\x20admin.user_roles\x20ur\x20ON\x20ur.role_id\x20=\x20ra.role_id\x0a\x20\x20\x20\x20\x20\x20CROSS\x20JOIN\x20LATERAL\x20unnest(COALESCE(ra.actions,\x20\x27{}\x27::text[]))\x20AS\x20action\x0a\x20\x20\x20\x20\x20\x20WHERE\x20ra.user_uid\x20=\x20$1\x20OR\x20ur.user_uid\x20=\x20$1\x0a\x20\x20\x20\x20',[r]);return G['rows']['map'](o=>o['permission']);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export*from'./auth.types.js';import{randomBytes,scrypt as r,timingSafeEqual}from'node:crypto';import{promisify}from'node:util';const scrypt=promisify(r);import u from'@fastify/cookie';function T(r,u){r=r-0x76;const G=H();let o=G[r];return o;}function H(){const P=['scrypt$','toString','split','scrypt','hex','length','warn','cookieOptions','user'];H=function(){return P;};return H();}import G from'@fastify/session';import{Authenticator}from'@fastify/passport';import o from'fastify-session-redis-store';import{getUserPermissions}from'./get-user-permissions.js';const fastifyPassport=new Authenticator();export*from'./verifyUser.js';export*from'./get-user-permissions.js';export async function hashPassword(X){const S=T,w=randomBytes(0x10),a=await scrypt(X,w,0x40);return S(0x76)+w[S(0x77)]('hex')+'$'+a[S(0x77)]('hex');}export async function verifyPassword(X,w){const I=T,[a,q,p]=w[I(0x78)]('$');if(a!==I(0x79)||!q||!p)return![];const F=Buffer['from'](q,I(0x7a)),E=Buffer['from'](p,'hex'),Y=await scrypt(X,F,E[I(0x7b)]);return timingSafeEqual(Y,E);}export async function createSessionStore(X,w){const c=T,{config:a,redis:q}=w;if(!a||!q){console[c(0x7c)]('Missing\x20config\x20or\x20redis\x20-\x20skipping\x20session\x20store\x20creation');return;}if(process.env.NODE_ENV==='test'||process.env.VITEST)return;await X['register'](u,{'parseOptions':a['auth'][c(0x7d)]}),await X['register'](G,{'secret':a['auth']['secret'],'cookieName':a['auth']['cookieName'],'cookie':a['auth'][c(0x7d)],'store':new o({'prefix':a['auth']['cookieName']+':'+(a['pg']?.['database']||'db')+':','client':q})}),await X['register'](fastifyPassport['initialize']()),await X['register'](fastifyPassport['secureSession']()),fastifyPassport['registerUserSerializer'](async p=>({'user':p})),fastifyPassport['registerUserDeserializer'](async p=>{const h=c,F=p?.[h(0x7e)]||p;return F?.['id']&&(F['permissions']=await getUserPermissions(F['id'],w)),F;});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{BadRequestError}from'../../errors.js';function H(){const Y=['user.login','password_hash','info','auth/warn'];H=function(){return Y;};return H();}import{verifyPassword}from'./index.js';function T(r,u){r=r-0x78;const G=H();let o=G[r];return o;}export async function verifyUser({user:r,password:u,ip:G},{pg:o,logger:X}){const E=T;if(!r||r==='')throw new BadRequestError('not\x20enough\x20params:\x20user');if(!u||u==='')throw new BadRequestError('not\x20enough\x20params:\x20password');X['metrics'](E(0x78));const w='select\x20uid\x20as\x20id,\x20user_type\x20as\x20type,\x20password_hash,\x20twofa\x20from\x20admin.users\x20where\x20$1\x20in\x20(login,email,phone)\x20and\x20enabled\x20limit\x201',a=await o['query'](w,[r])['then'](p=>p['rows']?.[0x0]);if(!a){const p='user\x20not\x20found';X['info']({'file':'auth/warn','error':p,'user':r,'ip':G});throw new BadRequestError(p);}const q=await verifyPassword(u,a[E(0x79)]);if(!q){const F='Wrong\x20password';X[E(0x7a)]({'file':E(0x7b),'error':F,'user':r,'ip':G});throw new BadRequestError(F);}return delete a['password_hash'],a;}
|