@opengis/fcore 0.0.1-beta.14 → 0.0.1-beta.15
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.d.ts.map +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fcore.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/mime.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-relation.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/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/jwt.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/resource.js +1 -1
- package/dist/plugins/resource/resource.registry.js +1 -1
- package/dist/plugins/resource/services/add-dictionary-lookup-data.js +1 -1
- package/dist/plugins/resource/services/add-file-token.js +1 -1
- package/dist/plugins/resource/services/add-table-lookup-data.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-relation.js +1 -1
- package/dist/plugins/resource/services/update.js +1 -1
- package/dist/plugins/resource/utils/auto-index.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
|
-
import{getSystemSettings}from'./services/get-system-settings.js';
|
|
1
|
+
const I=f;import{getSystemSettings}from'./services/get-system-settings.js';function t(){const w=['user','system:dictionaries','dictionaryName','/api/dictionary/:name','system','dictionaryItems','/api/access/:type/:id','Get\x20access\x20rules','post','Replaces\x20direct\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','system:access','accessTarget','admin','Updates\x20system\x20settings\x20using\x20flat\x20dot-notation\x20keys.','params','fcore','get','Get\x20audit\x20log','system:audit','/api/system/check','Checks\x20the\x20availability\x20of\x20system\x20dependencies.','system:check','Returns\x20the\x20list\x20of\x20registered\x20platform\x20APIs.','query'];t=function(){return w;};return t();}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';import{getDictionary}from'./services/get-dictionary.js';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';function f(x,K){x=x-0x1be;const Z=t();let b=Z[x];return b;}const u=x=>x[I(0x1be)];export function systemRoutes(x,K=new Map()){return async Z=>{const Y=f;Z['get']('/api/dictionary/:name',{'schema':{'tags':['fcore','system'],'summary':'Get\x20platform\x20dictionary','description':'Returns\x20a\x20registered\x20platform\x20dictionary\x20by\x20name.','access':'user','permissions':[Y(0x1bf)],'params':systemSchemas[Y(0x1c0)]}},async Q=>({'items':await getDictionary({...Q['params'],'user':u(Q)},x)})),Z['post'](Y(0x1c1),{'schema':{'tags':['fcore',Y(0x1c2)],'summary':'Update\x20platform\x20dictionary','description':'Replaces\x20the\x20items\x20of\x20a\x20registered\x20platform\x20dictionary.','access':'user','permissions':['system:dictionaries'],'params':systemSchemas['dictionaryName'],'body':systemSchemas[Y(0x1c3)]}},async Q=>updateDictionary({...Q['params'],...Q['body'],'user':u(Q)},x));const b=async Q=>getAccess({...Q['params'],'user':u(Q)},x);Z['get'](Y(0x1c4),{'schema':{'tags':['fcore','system'],'summary':Y(0x1c5),'description':'Returns\x20direct\x20and\x20role-based\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','access':'admin','permissions':['system:access'],'params':systemSchemas['accessTarget']}},b),Z[Y(0x1c6)]('/api/access/:type/:id',{'schema':{'tags':['fcore','system'],'summary':'Set\x20access\x20rules','description':Y(0x1c7),'access':'admin','permissions':[Y(0x1c8)],'params':systemSchemas[Y(0x1c9)],'body':systemSchemas['access']}},async Q=>setAccess({...Q['params'],...Q['body'],'user':u(Q)},x)),Z['get']('/api/system/settings',{'schema':{'tags':['fcore','system'],'summary':'Get\x20system\x20settings','description':'Returns\x20system\x20settings\x20as\x20nested\x20JSON.','access':Y(0x1ca),'permissions':['system:settings']}},async Q=>getSystemSettings({...Q['params'],'user':u(Q)},x)),Z[Y(0x1c6)]('/api/system/settings',{'schema':{'tags':['fcore','system'],'summary':'Update\x20system\x20settings','description':Y(0x1cb),'access':Y(0x1ca),'permissions':['system:settings'],'body':systemSchemas['settings']}},async Q=>updateSystemSettings({...Q[Y(0x1cc)],'patch':Q['body'],'user':u(Q)},x)),Z['get']('/api/system/logger',{'schema':{'tags':[Y(0x1cd),'system'],'summary':'Get\x20system\x20log','description':'Returns\x20system\x20logger\x20entries\x20for\x20the\x20requested\x20path.','access':'user','permissions':['system:logs'],'querystring':systemSchemas['logger']}},async(Q,J)=>{const {contentType:a,body:U}=await getSystemLog({...Q['query'],'user':u(Q)},x);return J['type'](a)['send'](U);}),Z[Y(0x1ce)]('/api/system/audit',{'schema':{'tags':['fcore','system'],'summary':Y(0x1cf),'description':'Returns\x20the\x20system\x20audit\x20log\x20entries.','access':Y(0x1be),'permissions':[Y(0x1d0)]}},async Q=>getAuditLog({...Q['query'],'user':u(Q)},x)),Z['get'](Y(0x1d1),{'schema':{'tags':['fcore','system'],'summary':'Check\x20system\x20health','description':Y(0x1d2),'access':'user','permissions':[Y(0x1d3)]}},async Q=>checkSystem({'user':u(Q)},x)),Z[Y(0x1ce)]('/api/system/list',{'schema':{'tags':[Y(0x1cd),Y(0x1c2)],'summary':'List\x20APIs','description':Y(0x1d4),'access':'admin','permissions':[],'querystring':systemSchemas['apiListQuery']}},async Q=>getApiList({'user':u(Q),'apiRoutes':K,...Q[Y(0x1d5)]},x));};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(x,K){x=x-0x12c;const Z=t();let b=Z[x];return b;}function t(){const K=['String','Object','Null','Array','short','Optional'];t=function(){return K;};return t();}const x=f;import{Type}from'@sinclair/typebox';export const identifier=Type[x(0x12c)]({'minLength':0x1,'maxLength':0x80,'pattern':'^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$'});export const systemSchemas={'dictionaryName':Type['Object']({'name':identifier}),'dictionaryItems':Type[x(0x12d)]({'items':Type['Array'](Type['Object']({'id':Type['Optional'](Type['Union']([Type['String'](),Type['Number']()])),'code':Type['String']({'minLength':0x1}),'name':Type['String']({'minLength':0x1}),'parentId':Type['Optional'](Type['Union']([Type['String'](),Type['Number'](),Type[x(0x12e)]()]))},{'additionalProperties':!![]}))}),'accessTarget':Type[x(0x12d)]({'type':Type['Union']([Type['Literal']('user'),Type['Literal']('role')]),'id':identifier}),'access':Type['Object']({'access':Type[x(0x12f)](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'](x(0x130)),Type['Literal']('extended')]))}),'settingsEntity':Type['Object']({'entity':Type['Optional'](identifier)}),'settings':Type['Record'](Type[x(0x12c)]({'minLength':0x1}),Type['Unknown']()),'logger':Type['Object']({'path':Type[x(0x131)](Type['String']({'maxLength':0x100,'pattern':'^[A-Za-z0-9_.\x5c-/]*$'}))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function checkSystem(
|
|
1
|
+
function f(x,K){x=x-0xf2;const Z=t();let b=Z[x];return b;}function t(){const J=['allSettled','query','ping','fulfilled','status'];t=function(){return J;};return t();}export async function checkSystem(x,K){const Q=f,[Z,b]=await Promise[Q(0xf2)]([K['pg'][Q(0xf3)]('SELECT\x201'),K['redis'][Q(0xf4)]()]);return{'status':Z['status']===Q(0xf5)&&b[Q(0xf6)]==='fulfilled'?'ok':'degraded','pg':Z[Q(0xf6)],'redis':b['status']};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function getAccess(x,K){const Q=f,Z=x['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',b=await K['pg'][Q(0x180)](Z,[x['id']]);return{'access':b[Q(0x181)]};}function f(x,K){x=x-0x180;const Z=t();let b=Z[x];return b;}function t(){const J=['query','rows'];t=function(){return J;};return t();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(x,K){x=x-0x1a5;const Z=t();let b=Z[x];return b;}export async function getApiList(x,K){const U=f,Z=[...x['apiRoutes'][U(0x1a5)]()]['sort']((b,Q)=>(b['endpoint']+'\x20'+b['method'])[U(0x1a6)](Q[U(0x1a7)]+'\x20'+Q['method']));if(x['format']!=='short')return Z;return Z[U(0x1a8)](({method:b,endpoint:Q,access:J,permissions:a})=>b+'\x20'+Q);}function t(){const I=['values','localeCompare','endpoint','map'];t=function(){return I;};return t();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function t(){const a=['min'];t=function(){return a;};return t();}function f(x,K){x=x-0x6d;const Z=t();let b=Z[x];return b;}export async function getAuditLog(x,K){const J=f,Z=Math[J(0x6d)](Math['max'](x['limit']??0x32,0x1),0xc8),b=Math['max']((x['page']??0x1)-0x1,0x0)*Z,Q=await K['pg']['query']('SELECT\x20*\x20FROM\x20admin.audit_log\x20ORDER\x20BY\x20id\x20DESC\x20LIMIT\x20$1\x20OFFSET\x20$2',[Z,b]);return{'rows':Q['rows'],'page':x['page']??0x1,'limit':Z};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function getDictionary(x,K){return K['dictionary']['get'](x['name']);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
const P=f;import x from'node:fs/promises';import K from'node:path';import{NotFoundError,ValidationError}from'../../../errors.js';const LOGS_ROOT=K[P(0x13a)](process['cwd'](),P(0x13b)),TAIL_LINES=0x64;export async function getSystemLog(Z,b){const S=P,Q=normalizePath(Z[S(0x13c)]),J=K['resolve'](LOGS_ROOT,Q);if(J!==LOGS_ROOT&&!J['startsWith'](LOGS_ROOT+K['sep']))throw new ValidationError('Invalid\x20log\x20path');const a=await x[S(0x13d)](J)[S(0x13e)](()=>null);if(!a)throw new NotFoundError('Log\x20path\x20not\x20found');if(a[S(0x13f)]()){const I=await x['readdir'](J,{'withFileTypes':!![]}),Y=await Promise['all'](I['map'](async w=>{const k=S,C=await x['stat'](K[k(0x140)](J,w['name']));return{'name':w['name'],'path':Q?Q+'/'+w['name']:w[k(0x141)],'type':w['isDirectory']()?'directory':'file','size':w['isDirectory']()?undefined:C['size'],'modified':C['mtime']['toISOString']()};}));Y['sort']((w,C)=>w[S(0x141)]['localeCompare'](C['name']));if(Q){const w=Q[S(0x142)]('/')['slice'](0x0,-0x1)[S(0x140)]('/');Y['unshift']({'name':'..','path':w,'type':'directory'});}return{'contentType':'text/html;\x20charset=utf-8','body':renderDirectory(Q,Y)};}const U=await tailFile(J,TAIL_LINES);return{'contentType':'text/plain;\x20charset=utf-8','body':U['join']('\x0a')};}function renderDirectory(Z,b){const l=P,Q=b['map'](a=>{const y=f,U='?path='+encodeURIComponent(a[y(0x13c)]),I=a['type']==='directory'?a['name']+'/':a[y(0x141)];return'<li><a\x20href=\x22'+U+'\x22>'+escapeHtml(I)+y(0x143);})[l(0x140)]('\x0a'),J=escapeHtml('logs/'+Z);return l(0x144)+J+l(0x145)+J+l(0x146)+Q+'\x0a</ul>\x0a</body>\x0a</html>';}function escapeHtml(Z){const W=P;return Z['replace'](/&/g,'&')[W(0x147)](/</g,'<')['replace'](/>/g,'>')[W(0x147)](/"/g,'"');}function normalizePath(Z){const h=P,b=(Z??'')[h(0x147)](/\\/g,'/')[h(0x147)](/^\/+|\/+$/g,'');if(b[h(0x142)]('/')['some'](Q=>Q==='..'))throw new ValidationError('Invalid\x20log\x20path');return b;}async function tailFile(Z,b){const R=P,Q=await x['open'](Z,'r');try{const {size:J}=await Q[R(0x13d)](),a=0x40*0x400;let U=J,I=Buffer['alloc'](0x0),Y=0x0;while(U>0x0&&Y<=b){const C=Math['min'](a,U);U-=C;const V=Buffer['alloc'](C);await Q[R(0x148)](V,0x0,C,U),I=Buffer['concat']([V,I]),Y+=countNewlines(V);}const w=I['toString']('utf8')['split']('\x0a')['filter'](z=>z['length']>0x0);return w['slice'](-b)['reverse']();}finally{await Q['close']();}}function f(x,K){x=x-0x13a;const Z=t();let b=Z[x];return b;}function countNewlines(Z){let b=0x0;for(const Q of Z){if(Q===0xa)b++;}return b;}function t(){const O=['resolve','logs','path','stat','catch','isDirectory','join','name','split','</a></li>','<!DOCTYPE\x20html>\x0a<html>\x0a<head><meta\x20charset=\x22utf-8\x22><title>','</title></head>\x0a<body>\x0a<h1>','</h1>\x0a<ul>\x0a','replace','read'];t=function(){return O;};return t();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(x,K){x=x-0x1d4;const Z=t();let b=Z[x];return b;}function t(){const Y=['value'];t=function(){return Y;};return t();}export async function getSystemSettings(x,K){const Z=await K['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 Z['rows']['reduce']((b,Q)=>{const I=f,J=String(Q['key'])['split']('.');let a=b;for(const U of J['slice'](0x0,-0x1)){a[U]??={},a=a[U];}return a[J['at'](-0x1)]=Q[I(0x1d4)],b;},{});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function listDictionaries(x,K){var Z=f;return K['dictionary'][Z(0x84)]();}function f(x,K){x=x-0x84;var Z=t();var b=Z[x];return b;}function t(){var b=['list'];t=function(){return b;};return t();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{getAccess}from'./get-access.js';function t(){const a=['query','access','resource','user'];t=function(){return a;};return t();}function f(x,K){x=x-0xce;const Z=t();let b=Z[x];return b;}export async function setAccess(x,K){const J=f,Z=await K['pg']['connect']();try{await Z['query']('BEGIN');x['type']==='user'?await Z['query']('DELETE\x20FROM\x20admin.role_access\x20WHERE\x20user_uid\x20=\x20$1\x20AND\x20role_id\x20IS\x20NULL',[x['id']]):await Z[J(0xce)]('DELETE\x20FROM\x20admin.role_access\x20WHERE\x20role_id\x20=\x20$1\x20AND\x20user_uid\x20IS\x20NULL',[x['id']]);for(const b of x[J(0xcf)]){x['type']==='user'?await Z['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)',[b[J(0xd0)],b['actions'],x['id'],x[J(0xd1)]['id'],x['user']['id']]):await Z[J(0xce)]('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)',[b['resource'],b['actions'],x['id'],x['user']['id'],x[J(0xd1)]['id']]);}await Z['query']('COMMIT');}catch(Q){await Z[J(0xce)]('ROLLBACK');throw Q;}finally{Z['release']();}return getAccess(x,K);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function updateDictionary(x,K){var Z=f;return await K[Z(0x16f)]['put'](x['name'],x['items']),{'success':!![]};}function f(x,K){x=x-0x16f;var Z=t();var b=Z[x];return b;}function t(){var b=['dictionary'];t=function(){return b;};return t();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ValidationError}from'../../../errors.js';export async function updateSystemSettings(
|
|
1
|
+
function f(x,K){x=x-0x1c0;const Z=t();let b=Z[x];return b;}import{ValidationError}from'../../../errors.js';function t(){const J=['patch','Settings\x20patch\x20is\x20empty','user'];t=function(){return J;};return t();}export async function updateSystemSettings(x,K){const Q=f;if(!Object['keys'](x[Q(0x1c0)])['length'])throw new ValidationError(Q(0x1c1));for(const [Z,b]of Object['entries'](x['patch'])){if(!Z['trim']()||Z['includes']('..'))throw new ValidationError('Invalid\x20setting\x20key:\x20'+Z);await K['pg']['query']('\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',[Z,JSON['stringify'](b),x[Q(0x1c2)]['id']]);}return{'success':!![]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{ForbiddenError}from'../../errors.js';function f(x,K){x=x-0x18e;var Z=t();var b=Z[x];return b;}export function requireAdmin(x,K){var Z=f;if(!x)throw new ForbiddenError(Z(0x18e));if(x[Z(0x18f)]!=='admin')throw new ForbiddenError('Admin\x20access\x20required');if(x['type']!=='admin'&&K&&!x['permissions']?.['includes'](K))throw new ForbiddenError(Z(0x190)+K);}function t(){var b=['User\x20required','type','Missing\x20permission:\x20'];t=function(){return b;};return t();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export const safeUser=x=>{const K=['password','salt','secret','credentials'];return Object['fromEntries'](Object['entries'](x)['filter'](([Z])=>!K['some'](b=>Z['toLowerCase']()['includes'](b))));};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{UnsupportedError}from'../../errors.js';export function unsupported(
|
|
1
|
+
import{UnsupportedError}from'../../errors.js';export function unsupported(x){throw new UnsupportedError(x+'\x20requires\x20a\x20project/provider\x20implementation');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{writeAudit}from'./services/write-audit.js';export function createAudit(
|
|
1
|
+
import{writeAudit}from'./services/write-audit.js';export function createAudit(x){const K=writeAudit(x);return{'write':K};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const secretPattern=/password|token|secret|credential|salt/i;function
|
|
1
|
+
const secretPattern=/password|token|secret|credential|salt/i;function clean(x){const Y=f;if(Array['isArray'](x))return x['map'](clean);if(x&&typeof x==='object')return Object['fromEntries'](Object[Y(0x1eb)](x)['map'](([K,Z])=>[K,secretPattern['test'](K)?'[REDACTED]':clean(Z)]));return x;}function t(){const P=['entries','query','table_name','audit_log','audit_log_data','warn','admin.audit_log_data','catch','logger','changes','oldValue','module','resourceId','action'];t=function(){return P;};return t();}function f(x,K){x=x-0x1eb;const Z=t();let b=Z[x];return b;}export function writeAudit(x){let K,Z;async function b(){const w=f;if(!x['pg'])return![];if(K!==undefined)return K;return Z??=x['pg'][w(0x1ec)]('\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')['then'](Q=>{const C=w,J=new Set(Q['rows']['map'](a=>a[C(0x1ed)]));return K=J['has'](C(0x1ee))&&J['has'](C(0x1ef)),!K&&x['logger'][C(0x1f0)]({'expectedTables':['admin.audit_log',C(0x1f1)],'foundTables':[...J]},'Audit\x20tables\x20are\x20unavailable;\x20audit\x20writes\x20are\x20disabled'),K;})[w(0x1f2)](Q=>{const V=w;return K=![],x['logger'][V(0x1f0)]({'err':Q},'Unable\x20to\x20check\x20audit\x20tables;\x20audit\x20writes\x20are\x20disabled'),![];}),Z;}return async function Q(J){const z=f;if(!await b())return x[z(0x1f3)]['info']({'auditFallback':!![],'event':clean({...J,'changes':J[z(0x1f4)]?.['map'](I=>({...I,'oldValue':clean(I[z(0x1f5)]),'newValue':clean(I['newValue'])}))})},'audit'),0x0;if(!x['pg'])throw new Error('empty\x20pg');const a=await x['pg']['query']('\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',[J['userId']??null,J[z(0x1f6)],J['resource'],J[z(0x1f7)]==null?null:String(J['resourceId']),J['fields']??null,J[z(0x1f8)],J['requestId']??null,J['ipAddress']??null,clean(J['metadata']??{})]),U=a['rows'][0x0]['id'];for(const I of J['changes']??[]){if(secretPattern['test'](I['field']))continue;await x['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',[U,I['field'],JSON['stringify'](clean(I['oldValue'])),JSON['stringify'](clean(I['newValue']))]);}return U;};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function getUserPermissions(x,K){const Z=await K['pg']['query']('\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',[x]);return Z['rows']['map'](b=>b['permission']);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from'./auth.types.js';import{randomBytes,scrypt as
|
|
1
|
+
function t(){const k=['toString','hex','length','test','auth','registerUserSerializer','registerUserDeserializer','user'];t=function(){return k;};return t();}function f(x,K){x=x-0x1c8;const Z=t();let b=Z[x];return b;}export*from'./auth.types.js';import{randomBytes,scrypt as x,timingSafeEqual}from'node:crypto';import{promisify}from'node:util';const scrypt=promisify(x);import K from'@fastify/cookie';import Z from'@fastify/session';import{Authenticator}from'@fastify/passport';import b 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(Q){const V=f,J=randomBytes(0x10),a=await scrypt(Q,J,0x40);return'scrypt$'+J['toString']('hex')+'$'+a[V(0x1c8)]('hex');}export async function verifyPassword(Q,J){const z=f,[a,U,I]=J?.['split']('$')||[];if(a!=='scrypt'||!U||!I)return![];const Y=Buffer['from'](U,z(0x1c9)),w=Buffer['from'](I,'hex'),C=await scrypt(Q,Y,w[z(0x1ca)]);return timingSafeEqual(C,w);}export async function createSessionStore(Q,J){const P=f,{config:a,redis:U}=J;if(!a||!U){console['warn']('Missing\x20config\x20or\x20redis\x20-\x20skipping\x20session\x20store\x20creation');return;}if(process.env.NODE_ENV===P(0x1cb)||process.env.VITEST)return;await Q['register'](K,{'parseOptions':a[P(0x1cc)]['cookieOptions']}),await Q['register'](Z,{'secret':a[P(0x1cc)]['secret'],'cookieName':a[P(0x1cc)]['cookieName'],'cookie':a['auth']['cookieOptions'],'store':new b({'prefix':a[P(0x1cc)]['cookieName']+':'+(a['pg']?.['database']||'db')+':','client':U})}),await Q['register'](fastifyPassport['initialize']()),await Q['register'](fastifyPassport['secureSession']()),fastifyPassport[P(0x1cd)](async I=>({'user':I})),fastifyPassport[P(0x1ce)](async I=>{const S=P,Y=I?.[S(0x1cf)]||I;return Y?.['id']&&(Y['permissions']=await getUserPermissions(Y['id'],J)),Y;});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BadRequestError}from'../../errors.js';
|
|
1
|
+
function f(x,K){x=x-0xaf;const Z=t();let b=Z[x];return b;}import{BadRequestError}from'../../errors.js';function t(){const C=['metrics','query'];t=function(){return C;};return t();}import{verifyPassword}from'./index.js';export async function verifyUser({user:x,password:K,ip:Z},{pg:b,logger:Q}){const w=f;if(!x||x==='')throw new BadRequestError('not\x20enough\x20params:\x20user');if(!K||K==='')throw new BadRequestError('not\x20enough\x20params:\x20password');Q[w(0xaf)]('user.login');const J='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 b[w(0xb0)](J,[x])['then'](I=>I['rows']?.[0x0]);if(!a){const I='user\x20not\x20found';Q['info']({'file':'auth/warn','error':I,'user':x,'ip':Z});throw new BadRequestError(I);}const U=await verifyPassword(K,a['password_hash']);if(!U){const Y='Wrong\x20password';Q['info']({'file':'auth/warn','error':Y,'user':x,'ip':Z});throw new BadRequestError(Y);}return delete a['password_hash'],a;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function t(){const M=['test','code','Dictionary\x20already\x20registered:\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20SELECT\x20di.code,\x20di.name\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20admin.dictionary_items\x20di\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20JOIN\x20admin.dictionaries\x20d\x20ON\x20d.id\x20=\x20di.dictionary_id\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20d.code\x20=\x20$1\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20di.name\x0a\x20\x20\x20\x20\x20\x20\x20\x20','rows','database','items','Dictionary\x20table\x20not\x20found','empty\x20pg','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.dictionaries\x20(code,\x20name,\x20module,\x20source,\x20editable)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4,\x20$5)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20CONFLICT\x20(code)\x20DO\x20UPDATE\x20SET\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20name\x20=\x20EXCLUDED.name,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20module\x20=\x20EXCLUDED.module,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20source\x20=\x20EXCLUDED.source,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20editable\x20=\x20EXCLUDED.editable,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20updated_at\x20=\x20now()\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20RETURNING\x20id\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','custom','query','name','ROLLBACK','delete','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20SELECT\x20code,\x20name,\x20\x27database\x27\x20AS\x20source\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20admin.dictionaries\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20name\x0a\x20\x20\x20\x20\x20\x20\x20\x20','has'];t=function(){return M;};return t();}import{ConflictError,NotFoundError,ValidationError}from'../errors.js';function f(x,K){x=x-0x1a0;const Z=t();let b=Z[x];return b;}const dictionaryName=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;export function createDictionary({pg:x,dictionaries:dictionaries=[]}){const K=new Map(),Z=new Map();let b,Q;async function J(){if(b!==undefined)return b;if(!x)throw new Error('empty\x20pg');return Q??=x['query']('\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\x20=\x20\x27dictionaries\x27\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20LIMIT\x201\x0a\x20\x20\x20\x20\x20\x20\x20\x20')['then'](P=>{const S=P['rows'][0x0]?.['table_name'];b=S==='dictionaries'?S:null;}),await Q,b;}function a(P){const O=f;if(!dictionaryName[O(0x1a0)](P))throw new ValidationError('Invalid\x20dictionary\x20name:\x20'+P);}function U(P){const X=f;for(const S of Array['isArray'](P)?P:[P]){a(S[X(0x1a1)]);if(!Array['isArray'](S['items']))throw new ValidationError('Invalid\x20dictionary\x20items:\x20'+S['code']);if(K['has'](S['code']))throw new ConflictError(X(0x1a2)+S['code']);K['set'](S['code'],{...S,'source':'static'});}}function I(P){return K['has'](P);}async function Y(P){const v=f;a(P);const S=K['get'](P);if(S&&S['checked'])return S['items'];const k=await J();if(!k)throw new NotFoundError('Dictionary\x20table\x20not\x20found');const y=await x?.['query'](v(0x1a3),[P]);if(y?.[v(0x1a4)]?.['length']){const l=y?.['rows'];return K['set'](P,{'code':P,'name':P,'items':l,'source':v(0x1a5),'checked':!![]}),l;}if(!S?.['items'])throw new NotFoundError('Dictionary\x20not\x20found:\x20'+P);return S['checked']=!![],S[v(0x1a6)];}async function w(P,S){const H=f;a(P);if(!Array['isArray'](S))throw new ValidationError('Dictionary\x20items\x20must\x20be\x20an\x20array');const k=await J();if(!k)throw new NotFoundError(H(0x1a7));if(!x)throw new Error(H(0x1a8));const y=await x['connect']();try{await y['query']('BEGIN');const l=await y['query'](H(0x1a9),[P,P,'fcore',H(0x1aa),!![]]),W=l['rows'][0x0]['id'];await y[H(0x1ab)]('DELETE\x20FROM\x20admin.dictionary_items\x20WHERE\x20dictionary_id\x20=\x20$1',[W]);for(const h of S){await y[H(0x1ab)]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.dictionary_items\x20(dictionary_id,\x20code,\x20name,\x20parent_id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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\x20\x20\x20\x20\x20\x20\x20\x20',[W,h['code'],h[H(0x1ac)],h['parentId']??null]);}await y[H(0x1ab)]('COMMIT');}catch(R){await y['query'](H(0x1ad));throw R;}finally{y['release']();}K['set'](P,{'items':S,'code':P,'source':'static','checked':!![]}),Z['set'](P,(Z['get'](P)??0x0)+0x1);}function C(P){const L=f;return a(P),Z['set'](P,(Z['get'](P)??0x0)+0x1),K[L(0x1ae)](P);}function V(P){return Z['get'](P)??0x0;}async function z(){const F=f,P=[...K['values']()]['map'](({code:y,name:l,source:W})=>({'code':y,'name':l??y,'source':W})),S=await J();if(!S)return P;if(!x)throw new Error('empty\x20pg');const k=await x['query'](F(0x1af));for(const y of k['rows']){!K[F(0x1b0)](y['code'])&&P['push'](y);}return P;}return U(dictionaries),{'register':U,'get':Y,'put':w,'clear':C,'revision':V,'list':z,'has':I};}
|
package/dist/plugins/file.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{DeleteObjectCommand,GetObjectCommand,HeadObjectCommand,PutObjectCommand,S3Client}from'@aws-sdk/client-s3';import x from'node:crypto';import{ValidationError}from'../errors.js';import{UnauthorizedError}from'../errors.js';function f(x,K){x=x-0x89;const Z=t();let b=Z[x];return b;}function keyFor(K,Z){const C=f;if(!Z||Z[C(0x89)]('/')||Z['includes']('..'))throw new ValidationError('Invalid\x20file\x20path');const b=Z[C(0x8a)](/\\/g,'/')['replace'](/^\/+/,''),Q=(K??'')[C(0x8a)](/^\/+|\/+$/g,'');return Q?Q+'/'+b:b;}async function bodyToBuffer(K){const V=f;if(!K)return Buffer['alloc'](0x0);const Z=K;if(typeof Z['transformToByteArray']==='function')return Buffer[V(0x8b)](await Z['transformToByteArray']());const b=[];for await(const Q of K){b[V(0x8c)](Buffer['from'](Q));}return Buffer['concat'](b);}function t(){const W=['startsWith','replace','from','push','tokenSecret','hex','us-east-1','accessKey','secretAccessKey','bucket','send','Body','name','tokenTtl','base64url','sha256','length','Invalid\x20file\x20token'];t=function(){return W;};return t();}export function createFileS3(K){const z=f,Z=K[z(0x8d)]??process.env.FILE_TOKEN_SECRET??x['randomBytes'](0x20)['toString'](z(0x8e)),b=new S3Client({'endpoint':K['endpoint'],'region':K['region']??z(0x8f),'forcePathStyle':K['forcePathStyle']??!![],'credentials':K['accessKeyId']||K['accessKey']?{'accessKeyId':K['accessKeyId']??K[z(0x90)],'secretAccessKey':K[z(0x91)]??K['secretKey']}:undefined}),Q=J=>keyFor(K['folder'],J);return{async 'put'(J,a){const P=z;await b['send'](new PutObjectCommand({'Bucket':K[P(0x92)],'Key':Q(J),'Body':a}));},async 'get'(J){const S=z,a=await b[S(0x93)](new GetObjectCommand({'Bucket':K['bucket'],'Key':Q(J)}));return bodyToBuffer(a[S(0x94)]);},async 'exists'(J){const k=z;try{return await b['send'](new HeadObjectCommand({'Bucket':K['bucket'],'Key':Q(J)})),!![];}catch(a){const U=a;if(U['$metadata']?.['httpStatusCode']===0x194||U[k(0x95)]==='NotFound')return![];throw a;}},async 'delete'(J){await b['send'](new DeleteObjectCommand({'Bucket':K['bucket'],'Key':Q(J)}));},'create'(J,a=K[z(0x96)]??0xe10){const y=z,U=Buffer['from'](J)['toString'](y(0x97)),I=x['createHmac']('sha256',Z)['update'](U)['digest'](y(0x97));return U+'.'+I;},'verify'(J){const l=z,[a,U]=J['split']('.');if(!a||!U)throw new UnauthorizedError('Invalid\x20file\x20token');const I=x['createHmac'](l(0x98),Z)['update'](a)['digest'](),Y=Buffer[l(0x8b)](U,'base64url');if(I[l(0x99)]!==Y[l(0x99)]||!x['timingSafeEqual'](I,Y))throw new UnauthorizedError(l(0x9a));const w=Buffer['from'](a,'base64url')['toString']('utf8');return w;}};}
|
package/dist/plugins/jwt.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(x,K){x=x-0x165;const Z=t();let b=Z[x];return b;}import{SignJWT,jwtVerify}from'jose';const secret=new TextEncoder()['encode'](process.env.AUTH_JWT_SECRET);export async function jwtSignToken(x){if(!process.env.AUTH_JWT_SECRET)return;const {id:K,type:Z,permissions:b}=x,Q=await new SignJWT({'id':K,'type':Z,'permissions':b})['setProtectedHeader']({'alg':'HS256'})['setIssuedAt']()['setExpirationTime']('1h')['sign'](secret);return Q;}function t(){const a=['catch','payload'];t=function(){return a;};return t();}export async function jwtVerifyToken(x){const J=f,K=await jwtVerify(x,secret,{'algorithms':['HS256']})[J(0x165)](Z=>{console['log'](Z['message']);});return K?.[J(0x166)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
function f(x,K){x=x-0x1ab;const Z=t();let b=Z[x];return b;}function t(){const I=['transport','assign'];t=function(){return I;};return t();}import x from'pino';export function createLogger(){const U=f,K=x[U(0x1ab)]({'target':'./transport.js'}),Z=x({'level':'info','timestamp':x['stdTimeFunctions']['isoTime'],'base':{'service':'app'},'redact':{'paths':['req.headers.authorization','password','token','accessToken','refreshToken'],'censor':'[REDACTED]'}},K),b={};function Q(J,a){if(J===undefined)return{...b};b[J]=(b[J]??0x0)+(a??0x1);}return Object[U(0x1ac)](Z,{'close':async()=>K['end'](),'metrics':Q,'file':()=>Z['info']['bind'](Z)});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function t(){const V=['info','warn','logs','mkdirSync','end','stringify'];t=function(){return V;};return t();}const U=f;import x from'node:fs';import K from'node:path';import Z from'pino-abstract-transport';const LEVELS={0x1e:U(0xb4),0x28:U(0xb5),0x32:'error',0x3c:'error'},streams=new Map();function getDate(){return new Date()['toISOString']()['slice'](0x0,0xa);}function createStream(b,Q){const I=U,J=K['resolve'](I(0xb6),b);return x[I(0xb7)](J,{'recursive':!![]}),x['createWriteStream'](K['join'](J,Q+'.log'),{'flags':'a'});}function f(x,K){x=x-0xb4;const Z=t();let b=Z[x];return b;}function getStream(b){const Y=U,Q=getDate(),J=streams['get'](b);if(J&&J['date']===Q)return J['stream'];J?.['stream'][Y(0xb8)]();const a=createStream(b,Q);return streams['set'](b,{'date':Q,'stream':a}),a;}function closeStreams(){const w=U;for(const {stream:b}of streams['values']()){b[w(0xb8)]();}streams['clear']();}export default async function loggerTransport(){return Z(writeLogs,{'close':async()=>{closeStreams();}});}async function writeLogs(b){const C=U;for await(const Q of b){const J=LEVELS[Q['level']];if(!J)continue;const a=getStream(Q['file']||J);delete Q['file'],a['write'](JSON[C(0xb9)](Q)+'\x0a');}}
|
package/dist/plugins/pg.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import x from'pg';function f(x,K){x=x-0x11e;const Z=t();let b=Z[x];return b;}const {Pool}=x;function t(){const S=['captureStackTrace','catch','stack','query','callerStack'];t=function(){return S;};return t();}export function createDatabase(K){const z=f,Z=new Pool(K),b=Z['query']['bind'](Z);function Q(J,a){const C=f,U=new Error();return Error[C(0x11e)]?.(U,Q),b(J,a)[C(0x11f)](I=>{const V=C,Y=I;Y['sql']=J,Y['callerStack']=U[V(0x120)];throw Y;});}return Z[z(0x121)]=Q,Z['transaction']=async function(J){const P=z,a=new Error();Error[P(0x11e)]?.(a,Z['transaction']);const U=await Z['connect']();try{await U[P(0x121)]('BEGIN');const I=await J(U);return await U[P(0x121)]('COMMIT'),I;}catch(Y){await U['query']('ROLLBACK');const w=Y;w[P(0x122)]=a['stack'];throw w;}finally{U['release']();}},Z;}
|
package/dist/plugins/redis.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{Redis}from'ioredis';function f(x,K){x=x-0x97;const Z=t();let b=Z[x];return b;}function t(){const U=['del','hincrby'];t=function(){return U;};return t();}export function createRedis(x){const a=f,K=new Redis(x);return{'get':Z=>K['get'](Z),'set':(Z,b,Q,J)=>{if(J)return K['set'](Z,b,'EX',J);if(typeof Q==='number')return K['set'](Z,b,'EX',Q);return K['set'](Z,b);},'del':Z=>K[a(0x97)](Z),'delete':Z=>K['del'](Z),'close':()=>K['quit'](),'ping':()=>K['ping'](),'hincrby':(Z,b,Q)=>K[a(0x98)](Z,b,Q),'incrby':(Z,b)=>K['incrby'](Z,b)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ResourceRegistry}from'./resource.registry.js';
|
|
1
|
+
import{ResourceRegistry}from'./resource.registry.js';import{createFind}from'./services/find.js';import{createFindOne}from'./services/find-one.js';function f(x,K){x=x-0xe1;const Z=t();let b=Z[x];return b;}import{createCreate}from'./services/create.js';import{createUpdate}from'./services/update.js';import{createRemove}from'./services/delete.js';function t(){const V=['register','bind','get'];t=function(){return V;};return t();}import{createFindRelation}from'./services/find-relation.js';import{createCreateRelation}from'./services/create-relation.js';import{createDeleteRelation}from'./services/delete-relation.js';import{createUpdateRelation}from'./services/update-relation.js';export function createResource(x){const C=f,K=new ResourceRegistry(),Z=createFind(x,K),b=createFindOne(x,K),Q=createCreate(x,K),J=createUpdate(x,K),a=createRemove(x,K),U=createFindRelation(x,K),I=createCreateRelation(x,K),Y=createUpdateRelation(x,K),w=createDeleteRelation(x,K);return{'register':K[C(0xe1)]['bind'](K),'has':K['has'][C(0xe2)](K),'get':K[C(0xe3)]['bind'](K),'list':K['list'][C(0xe2)](K),'find':Z,'findOne':b,'create':Q,'update':J,'delete':a,'findRelation':U,'createRelation':I,'updateRelation':Y,'deleteRelation':w};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a=f;import{ValidationError,ConflictError,NotFoundError}from'../../errors.js';const ident=/^[a-zA-Z0-9_-]*$/;function f(x,K){x=x-0xcb;const Z=t();let b=Z[x];return b;}function t(){const w=['every','test','validate','name','Resource\x20already\x20registered:\x20','has','get','Resource\x20not\x20registered:\x20','list','resources','entries'];t=function(){return w;};return t();}function validQualified(x){const b=f;return x['split']('.')['length']<=0x2&&x['split']('.')[b(0xcb)](K=>ident[b(0xcc)](K));}export class ResourceRegistry{['resources']=new Map();['register'](x){const Q=f;for(const K of Array['isArray'](x)?x:[x]){this[Q(0xcd)](K);if(this['resources']['has'](K[Q(0xce)]))throw new ConflictError(Q(0xcf)+K['name']);this['resources']['set'](K[Q(0xce)],K);}}['has'](x){const J=f;return this['resources'][J(0xd0)](x);}[a(0xd1)](x){const U=a,K=this['resources']['get'](x);if(!K)throw new NotFoundError(U(0xd2)+x);return K;}[a(0xd3)](){const I=a;return[...this[I(0xd4)]['values']()];}[a(0xcd)](x){const Y=a;if(x['version']!==0x1||!ident['test'](x[Y(0xce)])||!validQualified(x['table'])||!ident['test'](x['key']))throw new ValidationError('Invalid\x20resource\x20contract:\x20'+x[Y(0xce)]);for(const [K,Z]of Object[Y(0xd5)](x['fields'])){if(!ident['test'](K)||!ident['test'](Z['column']??K))throw new ValidationError('Invalid\x20resource\x20field:\x20'+K);}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const dictionaryIndexesCache=new WeakMap(),dictionaryRevisionsCache=new WeakMap();async function getDictionaryIndexes(
|
|
1
|
+
const dictionaryIndexesCache=new WeakMap(),dictionaryRevisionsCache=new WeakMap();function t(){const S=['code','text','set','revision','length','flatMap','dictionary','map','_data','get'];t=function(){return S;};return t();}function f(x,K){x=x-0x6b;const Z=t();let b=Z[x];return b;}async function getDictionaryIndexes(x,K){const V=f,Z=dictionaryIndexesCache['get'](K)??new Map(),b=dictionaryRevisionsCache['get'](K)??new Map();dictionaryIndexesCache['set'](K,Z),dictionaryRevisionsCache['set'](K,b);const Q=x['filter'](a=>b['get'](a)!==K['revision'](a));if(Q['length']===0x0)return Z;const J=await Promise['all'](Q['map'](async a=>{const C=f;if(!K['has'](a))return[a,new Map()];const U=await K['get'](a),I=new Map();for(const Y of U){const w=Y[C(0x6b)]??Y['id'];if(w==null)continue;I['set'](String(w),{'id':w,'text':Y['name']??Y[C(0x6c)],...Y['color']!==undefined?{'color':Y['color']}:{},...Y['icon']!==undefined?{'icon':Y['icon']}:{}});}return[a,I];}));for(const [a,U]of J){Z[V(0x6d)](a,U),b['set'](a,K[V(0x6e)](a));}return Z;}export async function addDictionaryLookupData(x,K,Z){const z=f;if(!Z||x[z(0x6f)]===0x0)return x;const b=Object['entries'](K)[z(0x70)](([J,a])=>{const P=z,U=a[P(0x71)];return U?[{'field':J,'dictionaryName':U}]:[];});if(b[z(0x6f)]===0x0)return x;const Q=await getDictionaryIndexes([...new Set(b[z(0x72)](({dictionaryName:J})=>J))],Z);for(const J of x){for(const {field:a,dictionaryName:U}of b){const I=J[a];J[a+z(0x73)]=I==null?null:Q['get'](U)?.[z(0x74)](String(I))??null;}}return x;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export function addFileToken(x,K,Z){const U=f;if(!Z||x[U(0x69)]===0x0)return x;const b=Object['entries'](K)['filter'](([,Q])=>Q['type']===U(0x6a))[U(0x6b)](([Q])=>Q);for(const Q of x){for(const J of b){const a=Q[J];typeof a==='string'&&a['length']>0x0&&(Q[J]=Z['create'](a));}}return x;}function f(x,K){x=x-0x69;const Z=t();let b=Z[x];return b;}function t(){const I=['length','file','map'];t=function(){return I;};return t();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{qi,qt}from'../utils/sql.js';function f(x,K){x=x-0x140;const Z=t();let b=Z[x];return b;}const tableLookupCache=new WeakMap();export function clearTableLookupCache(x,K){const Z=tableLookupCache['get'](K);if(!Z)return;for(const b of Z['keys']()){b['startsWith'](x+':')&&Z['delete'](b);}}function t(){const W=['length','entries','lookup','field','number','set','filter','has','SELECT\x20','value','\x20AS\x20id,\x20','text','\x20=\x20ANY($1)'];t=function(){return W;};return t();}export async function addTableLookupData(x,K,Z){const y=f;if(!Z||x[y(0x140)]===0x0)return x;const b=tableLookupCache['get'](Z)??new Map();tableLookupCache['set'](Z,b);const Q=Object[y(0x141)](K)['flatMap'](([J,a])=>{const l=y,{table:U,value:value='id',text:text='name'}=a[l(0x142)]??{};return U?[{'field':J,'table':U,'value':value,'text':text}]:[];});for(const J of Q){const a=new Map();for(const w of x){const C=w[J[y(0x143)]];(typeof C==='string'||typeof C===y(0x144))&&a[y(0x145)](String(C),C);}const U=J['table']+':'+J['value']+':'+J['text'],I=b['get'](U)??new Map();b['set'](U,I);const Y=[...a['entries']()][y(0x146)](([V])=>!I[y(0x147)](V))['map'](([,V])=>V);if(Y[y(0x140)]>0x0){const V=await Z['query'](y(0x148)+qi(J[y(0x149)])+y(0x14a)+qi(J[y(0x14b)])+'\x20AS\x20text\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20'+qt(J['table'])+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20'+qi(J[y(0x149)])+y(0x14c),[Y]);for(const z of V['rows']){I['set'](String(z['id']),z);}for(const P of Y){!I['has'](String(P))&&I['set'](String(P),null);}}for(const S of x){const k=S[J['field']];S[J[y(0x143)]+'_data']=k==null?null:I['get'](String(k))??null;}}return x;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function f(x,K){x=x-0xce;const Z=t();let b=Z[x];return b;}import{UnsupportedError}from'../../../errors.js';import{createCreate}from'./create.js';export function createCreateRelation(x,K){const Z=createCreate(x,K);return async function b({name:Q,id:J,relation:a,data:U,user:I},Y){const k=f,w=Y?.['pg']??x['pg'],C=K[k(0xce)](Q);if(['notes',k(0xcf)]['includes'](a)&&!C['capabilities']?.[k(0xd0)](a))throw new UnsupportedError('Generic\x20Resource\x20relation\x20\x22'+a+'\x22\x20requires\x20a\x20capabilities\x20\x22'+a+'\x22');if(a===k(0xd1)){const P=await w['query'](k(0xd2),[Q,String(J),U?.['body']]);return P['rows'][0x0];}if(a==='files'){const S=await w['query']('INSERT\x20INTO\x20admin.files\x20(resource,\x20resource_id,\x20file_path,\x20size)\x0a\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\x20RETURNING\x20*',[Q,String(J),U?.[k(0xd3)],U?.['size']??null]);return S['rows'][0x0];}const V=C['relations']?.[a];if(!V?.['foreignKey']||!V['resource']&&!V['table'])throw new UnsupportedError('Generic\x20Resource\x20relation\x20\x22'+a+k(0xd4));if(!U)throw new UnsupportedError('No\x20data\x20provided\x20for\x20relation:\x20'+U);if(!V[k(0xd5)])throw new UnsupportedError('Relation\x20update\x20is\x20not\x20configured:\x20'+a);U[V['foreignKey']]=J;const z=await Z({'name':V['resource'],'data':U??{},'user':I});return z;};}function t(){const y=['get','files','includes','notes','INSERT\x20INTO\x20admin.notes(resource,resource_id,body)\x20VALUES\x20($1,$2,$3)\x20RETURNING\x20*','filePath','\x22\x20requires\x20a\x20project/provider\x20implementation','resource'];t=function(){return y;};return t();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ValidationError}from'../../../errors.js';import{assertOperation}from'../utils/permissions.js';import{qi,qt,writableData}from'../utils/sql.js';
|
|
1
|
+
import{ValidationError}from'../../../errors.js';function f(x,K){x=x-0x17c;const Z=t();let b=Z[x];return b;}import{assertOperation}from'../utils/permissions.js';import{qi,qt,writableData}from'../utils/sql.js';import{validateInputData}from'../utils/fields.js';function t(){const l=['get','create','fields','created_at','created_by','length','map','query','table','VALUES\x20(','rows','write','name'];t=function(){return l;};return t();}import{clearTableLookupCache}from'./add-table-lookup-data.js';export function createCreate(x,K){return async function Z({name:b,data:Q,user:J},a){const y=f,U=K[y(0x17c)](b);assertOperation(U,y(0x17d),J),validateInputData({'resource':U,'data':Q});const I=writableData(U,Q);U[y(0x17e)]['created_at']&&I['push']([y(0x17f),new Date()]);U[y(0x17e)][y(0x180)]&&I['push'](['created_by',J?.['id']]);if(!I[y(0x181)])throw new ValidationError('No\x20writable\x20fields');const Y=I['map'](([S])=>qi(S)),w=I[y(0x182)]((S,k)=>'$'+(k+0x1)),C=I['map'](([,S])=>S),V=a?.['pg']??x['pg'],z=await V[y(0x183)]('INSERT\x20INTO\x20'+qt(U[y(0x184)])+'\x20('+Y['join'](',\x20')+')\x20'+(y(0x185)+w['join'](',\x20')+')\x20')+'RETURNING\x20*',C),P=z[y(0x186)][0x0];return clearTableLookupCache(U['table'],V),await(a?.['audit']??x['audit'])?.[y(0x187)]({'userId':J?.['id'],'module':U['module'],'resource':U[y(0x188)],'resourceId':P[U['key']],'action':y(0x17d),'fields':Object['keys'](Q)}),P;};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{UnsupportedError}from'../../../errors.js';
|
|
1
|
+
import{UnsupportedError}from'../../../errors.js';function f(x,K){x=x-0x14c;const Z=t();let b=Z[x];return b;}function t(){const S=['capabilities','DELETE\x20FROM\x20admin.files\x20WHERE\x20file_id\x20=\x20$1\x20AND\x20resource\x20=\x20$2\x20AND\x20resource_id\x20=\x20$3','relations','foreignKey'];t=function(){return S;};return t();}import{createRemove}from'./delete.js';export function createDeleteRelation(x,K){const Z=createRemove(x,K);return async function b({name:Q,id:J,relation:a,relationId:U,user:I},Y){const P=f,w=Y?.['pg']??x['pg'],C=K['get'](Q);if(['notes','files']['includes'](a)&&!C[P(0x14c)]?.['includes'](a))throw new UnsupportedError('Generic\x20Resource\x20relation\x20\x22'+a+'\x22\x20requires\x20a\x20capabilities\x20\x22'+a+'\x22');if(a==='notes')return await w['query']('DELETE\x20FROM\x20admin.notes\x20WHERE\x20note_id\x20=\x20$1\x20AND\x20resource\x20=\x20$2\x20AND\x20resource_id\x20=\x20$3',[U,Q,String(J)]),{'success':!![]};if(a==='files')return await w['query'](P(0x14d),[U,Q,String(J)]),{'success':!![]};const V=C[P(0x14e)]?.[a];if(!V?.['resource']||!V['foreignKey'])throw new UnsupportedError('Generic\x20Resource\x20relation\x20\x22'+a+'\x22\x20requires\x20a\x20project/provider\x20implementation');const z=await Z({'name':V['resource'],'id':U,'user':I,'where':{'column':V[P(0x14f)],'value':J}},Y);return{'success':z};};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{assertOperation}from'../utils/permissions.js';import{qt,qi}from'../utils/sql.js';import{clearTableLookupCache}from'./add-table-lookup-data.js';function
|
|
1
|
+
import{assertOperation}from'../utils/permissions.js';import{qt,qi}from'../utils/sql.js';import{clearTableLookupCache}from'./add-table-lookup-data.js';function t(){const P=['WHERE\x20','key','column','table','write','name','delete'];t=function(){return P;};return t();}function f(x,K){x=x-0x1bc;const Z=t();let b=Z[x];return b;}export function createRemove(x,K){return async function Z({name:b,id:Q,user:J,where:a},U){const z=f,I=K['get'](b);assertOperation(I,'delete',J);const Y=U?.['pg']??x['pg'],w=[Q];let C=z(0x1bc)+qi(I[z(0x1bd)])+'\x20=\x20$1';a&&(w['push'](a['value']),C+='\x20AND\x20'+qi(a[z(0x1be)])+'\x20=\x20$'+w['length']);const V=await Y['query']('DELETE\x20FROM\x20'+qt(I[z(0x1bf)])+'\x20'+C,w);if((V['rowCount']??0x0)>0x0)clearTableLookupCache(I['table'],Y);if((V['rowCount']??0x0)>0x0)await(U?.['audit']??x['audit'])?.[z(0x1c0)]({'module':I['module'],'resource':I[z(0x1c1)],'resourceId':Q,'action':z(0x1c2)});return(V['rowCount']??0x0)>0x0;};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ValidationError}from'../../../errors.js';
|
|
1
|
+
import{ValidationError}from'../../../errors.js';function f(x,K){x=x-0xee;const Z=t();let b=Z[x];return b;}import{assertOperation}from'../utils/permissions.js';import{qt,qi,readableFields}from'../utils/sql.js';import{addDictionaryLookupData}from'./add-dictionary-lookup-data.js';import{addTableLookupData}from'./add-table-lookup-data.js';import{addFileToken}from'./add-file-token.js';function t(){const R=['key','type','joins','sql','join','\x20t\x20','fields','include','relations','resource','get','\x20FROM\x20','query','file','time'];t=function(){return R;};return t();}export function createFindOne(x,K){return async function Z({name:b,id:Q,query:query={},user:J}){const h=f,a=Date['now'](),U=K['get'](b);assertOperation(U,'read',J);if(U['fields'][U[h(0xee)]]?.[h(0xef)]==='integer'&&!Number['isInteger'](Number(Q)))throw new ValidationError('Invalid\x20id:\x20'+Q+'\x20name:'+b);const I=U[h(0xf0)]?.['map'](V=>V[h(0xf1)]+'\x20')[h(0xf2)]('\x20')||'',Y=await x['pg']['query']('SELECT\x20'+readableFields(U)['join'](',\x20')+'\x20FROM\x20'+qt(U['table'])+h(0xf3)+I+'\x20WHERE\x20'+qi(U['key'])+'=$1\x20LIMIT\x201',[Q]),w=Y['rows'][0x0];if(!w)return null;await addDictionaryLookupData([w],U[h(0xf4)],x['dictionary']),await addTableLookupData([w],U[h(0xf4)],x['pg']),addFileToken([w],U['fields'],x['file']);const C=Array['isArray'](query['include'])?query[h(0xf5)]:query['include']?.['split'](',')??[];for(const V of C){const z=U[h(0xf6)]?.[V];if(!z?.['foreignKey']||!z['resource']&&!z['table'])throw new ValidationError('Unknown\x20relation:\x20'+V);const P=z[h(0xf7)]?K[h(0xf8)](z['resource']):undefined,S=z['table']??P['table'],k=P?.[h(0xee)]??'id',y=P?readableFields(P)['join'](',\x20'):'*',l='SELECT\x20'+y+h(0xf9)+qt(S)+'\x20WHERE\x20'+qi(k)+'\x20=\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20SELECT\x20'+qi(z['foreignKey'])+'\x20FROM\x20'+qt(U['table'])+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20'+qi(U['key'])+'\x20=\x20$1\x20LIMIT\x201\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20)',W=(await x['pg'][h(0xfa)](l,[Q]))['rows'];P&&(await addDictionaryLookupData(W,P[h(0xf4)],x['dictionary']),await addTableLookupData(W,P['fields'],x['pg']),addFileToken(W,P[h(0xf4)],x[h(0xfb)])),w[V]=W;}return w[h(0xfc)]=Date['now']()-a,w;};}
|