@opengis/fcore 0.0.1-beta.1 → 0.0.1-beta.11
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/LICENSE +3 -3
- package/README.md +71 -71
- package/dist/config.d.ts +2 -10
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/context.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/fastify.d.ts +5 -5
- package/dist/fastify.d.ts.map +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.d.ts +3 -0
- package/dist/modules/auth/adduser-cli.d.ts.map +1 -0
- package/dist/modules/auth/adduser-cli.js +2 -0
- package/dist/modules/auth/passwd-cli.d.ts +3 -0
- package/dist/modules/auth/passwd-cli.d.ts.map +1 -0
- package/dist/modules/auth/passwd-cli.js +2 -0
- package/dist/modules/auth/permission-cli.d.ts +3 -0
- package/dist/modules/auth/permission-cli.d.ts.map +1 -0
- package/dist/modules/auth/permission-cli.js +2 -0
- package/dist/modules/auth/route.d.ts.map +1 -1
- package/dist/modules/auth/route.js +1 -1
- package/dist/modules/auth/schema.d.ts +10 -1
- package/dist/modules/auth/schema.d.ts.map +1 -1
- package/dist/modules/auth/schema.js +1 -1
- package/dist/modules/auth/services/change-password.d.ts +9 -0
- package/dist/modules/auth/services/change-password.d.ts.map +1 -0
- package/dist/modules/auth/services/change-password.js +1 -0
- package/dist/modules/auth/services/get-current-user.d.ts +1 -0
- package/dist/modules/auth/services/get-current-user.d.ts.map +1 -1
- package/dist/modules/auth/services/get-current-user.js +1 -1
- package/dist/modules/auth/services/registration.d.ts +14 -0
- package/dist/modules/auth/services/registration.d.ts.map +1 -0
- package/dist/modules/auth/services/registration.js +1 -0
- package/dist/modules/auth/services/verify-two-factor.js +1 -1
- package/dist/modules/file/mime.d.ts +3 -0
- package/dist/modules/file/mime.d.ts.map +1 -0
- package/dist/modules/file/mime.js +1 -0
- package/dist/modules/file/route.d.ts.map +1 -1
- package/dist/modules/file/route.js +1 -1
- package/dist/modules/file/schema.d.ts +3 -0
- package/dist/modules/file/schema.d.ts.map +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.d.ts.map +1 -1
- package/dist/modules/file/services/resize-file.js +1 -1
- package/dist/modules/file/services/upload-file.d.ts +4 -6
- package/dist/modules/file/services/upload-file.d.ts.map +1 -1
- package/dist/modules/file/services/upload-file.js +1 -1
- package/dist/modules/resource/route.d.ts +0 -3
- package/dist/modules/resource/route.d.ts.map +1 -1
- package/dist/modules/resource/route.js +1 -1
- package/dist/modules/resource/schema.d.ts +3 -0
- package/dist/modules/resource/schema.d.ts.map +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.d.ts +8 -2
- package/dist/modules/resource/services/create-resource-relation.d.ts.map +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.d.ts +8 -1
- package/dist/modules/resource/services/delete-resource-relation.d.ts.map +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.d.ts.map +1 -1
- package/dist/modules/resource/services/export-resource.js +1 -1
- package/dist/modules/resource/services/get-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/get-resource.js +1 -1
- package/dist/modules/resource/services/list-resource-relation.d.ts +9 -2
- package/dist/modules/resource/services/list-resource-relation.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resource-relation.js +1 -1
- package/dist/modules/resource/services/list-resources.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resources.js +1 -1
- package/dist/modules/resource/services/search-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/search-resource.js +1 -1
- package/dist/modules/resource/services/suggest-resource.d.ts +10 -4
- package/dist/modules/resource/services/suggest-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/suggest-resource.js +1 -1
- package/dist/modules/resource/services/update-resource-relation.d.ts +10 -0
- package/dist/modules/resource/services/update-resource-relation.d.ts.map +1 -0
- package/dist/modules/resource/services/update-resource-relation.js +1 -0
- 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.d.ts +2 -1
- package/dist/modules/system/route.d.ts.map +1 -1
- package/dist/modules/system/route.js +1 -1
- package/dist/modules/system/schema.d.ts +22 -1
- package/dist/modules/system/schema.d.ts.map +1 -1
- package/dist/modules/system/schema.js +1 -1
- package/dist/modules/system/services/check-system.d.ts.map +1 -1
- package/dist/modules/system/services/check-system.js +1 -1
- package/dist/modules/system/services/get-access.d.ts +14 -0
- package/dist/modules/system/services/get-access.d.ts.map +1 -0
- package/dist/modules/system/services/get-access.js +1 -0
- package/dist/modules/system/services/get-api-list.d.ts +4 -1
- package/dist/modules/system/services/get-api-list.d.ts.map +1 -1
- package/dist/modules/system/services/get-api-list.js +1 -1
- package/dist/modules/system/services/get-audit-log.d.ts.map +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.d.ts +9 -5
- package/dist/modules/system/services/get-system-log.d.ts.map +1 -1
- package/dist/modules/system/services/get-system-log.js +1 -1
- package/dist/modules/system/services/get-system-settings.d.ts.map +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.d.ts +16 -0
- package/dist/modules/system/services/set-access.d.ts.map +1 -0
- package/dist/modules/system/services/set-access.js +1 -0
- package/dist/modules/system/services/update-dictionary.d.ts +13 -0
- package/dist/modules/system/services/update-dictionary.d.ts.map +1 -0
- package/dist/modules/system/services/update-dictionary.js +1 -0
- package/dist/modules/system/services/update-system-settings.d.ts.map +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.d.ts +3 -0
- package/dist/plugins/auth/get-user-permissions.d.ts.map +1 -0
- package/dist/plugins/auth/get-user-permissions.js +1 -0
- package/dist/plugins/auth/index.d.ts +4 -0
- package/dist/plugins/auth/index.d.ts.map +1 -1
- package/dist/plugins/auth/index.js +1 -1
- package/dist/plugins/auth/verifyUser.d.ts +9 -0
- package/dist/plugins/auth/verifyUser.d.ts.map +1 -0
- package/dist/plugins/auth/verifyUser.js +1 -0
- package/dist/plugins/dictionary.d.ts +3 -0
- package/dist/plugins/dictionary.d.ts.map +1 -1
- package/dist/plugins/dictionary.js +1 -1
- package/dist/plugins/file.d.ts +3 -6
- package/dist/plugins/file.d.ts.map +1 -1
- package/dist/plugins/file.js +1 -1
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/jwt.d.ts +4 -0
- package/dist/plugins/jwt.d.ts.map +1 -0
- package/dist/plugins/jwt.js +1 -0
- package/dist/plugins/logger/index.js +1 -1
- package/dist/plugins/logger/transport.d.ts +3 -0
- package/dist/plugins/logger/transport.d.ts.map +1 -0
- package/dist/plugins/logger/transport.js +1 -0
- package/dist/plugins/pg.d.ts +4 -2
- package/dist/plugins/pg.d.ts.map +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.d.ts.map +1 -1
- package/dist/plugins/resource/resource.js +1 -1
- package/dist/plugins/resource/resource.registry.js +1 -1
- package/dist/plugins/resource/resource.types.d.ts +65 -8
- package/dist/plugins/resource/resource.types.d.ts.map +1 -1
- package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts +3 -0
- package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-dictionary-lookup-data.js +1 -0
- package/dist/plugins/resource/services/add-file-token.d.ts +3 -0
- package/dist/plugins/resource/services/add-file-token.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-file-token.js +1 -0
- package/dist/plugins/resource/services/add-table-lookup-data.d.ts +4 -0
- package/dist/plugins/resource/services/add-table-lookup-data.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-table-lookup-data.js +1 -0
- package/dist/plugins/resource/services/create-relation.d.ts +16 -0
- package/dist/plugins/resource/services/create-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/create-relation.js +1 -0
- package/dist/plugins/resource/services/create.d.ts +5 -2
- package/dist/plugins/resource/services/create.d.ts.map +1 -1
- package/dist/plugins/resource/services/create.js +1 -1
- package/dist/plugins/resource/services/delete-relation.d.ts +18 -0
- package/dist/plugins/resource/services/delete-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/delete-relation.js +1 -0
- package/dist/plugins/resource/services/delete.d.ts +9 -2
- package/dist/plugins/resource/services/delete.d.ts.map +1 -1
- package/dist/plugins/resource/services/delete.js +1 -1
- package/dist/plugins/resource/services/find-one.d.ts +3 -2
- package/dist/plugins/resource/services/find-one.d.ts.map +1 -1
- package/dist/plugins/resource/services/find-one.js +1 -1
- package/dist/plugins/resource/services/find-relation.d.ts +13 -0
- package/dist/plugins/resource/services/find-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/find-relation.js +1 -0
- package/dist/plugins/resource/services/find.d.ts.map +1 -1
- package/dist/plugins/resource/services/find.js +1 -1
- package/dist/plugins/resource/services/update-relation.d.ts +14 -0
- package/dist/plugins/resource/services/update-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/update-relation.js +1 -0
- package/dist/plugins/resource/services/update.d.ts +9 -2
- package/dist/plugins/resource/services/update.d.ts.map +1 -1
- package/dist/plugins/resource/services/update.js +1 -1
- package/dist/plugins/resource/utils/auto-index.d.ts +4 -0
- package/dist/plugins/resource/utils/auto-index.d.ts.map +1 -0
- package/dist/plugins/resource/utils/auto-index.js +1 -0
- package/dist/plugins/resource/utils/fields.d.ts +8 -1
- package/dist/plugins/resource/utils/fields.d.ts.map +1 -1
- package/dist/plugins/resource/utils/fields.js +1 -1
- package/dist/plugins/resource/utils/filters.d.ts +3 -2
- package/dist/plugins/resource/utils/filters.d.ts.map +1 -1
- package/dist/plugins/resource/utils/filters.js +1 -1
- package/dist/plugins/resource/utils/permissions.d.ts.map +1 -1
- package/dist/plugins/resource/utils/permissions.js +1 -1
- package/dist/plugins/resource/utils/sort.d.ts.map +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/dist/type.d.ts +37 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +1 -0
- package/migrations/20260903120000_core_schema.sql +27 -21
- package/migrations/20260903130000_move_notes_files_to_admin.sql +17 -17
- package/migrations/20260903130001_add_file_fields.sql +5 -0
- package/migrations/20260903140000_settings_nulls_not_distinct.sql +18 -18
- package/migrations/20260905120000_add_user_foreign_keys.sql +43 -0
- package/migrations/20260907090000_core_schema.sql +32 -0
- package/package.json +12 -7
- package/dist/modules/auth/index.d.ts +0 -9
- package/dist/modules/auth/index.d.ts.map +0 -1
- package/dist/modules/auth/index.js +0 -1
- package/dist/modules/auth/services/login.d.ts +0 -10
- package/dist/modules/auth/services/login.d.ts.map +0 -1
- package/dist/modules/auth/services/login.js +0 -1
- package/dist/modules/auth/services/logout.d.ts +0 -9
- package/dist/modules/auth/services/logout.d.ts.map +0 -1
- package/dist/modules/auth/services/logout.js +0 -1
- package/dist/modules/auth/services/verifyPassword.d.ts +0 -11
- package/dist/modules/auth/services/verifyPassword.d.ts.map +0 -1
- package/dist/modules/auth/services/verifyPassword.js +0 -1
- package/dist/modules/file/index.d.ts +0 -8
- package/dist/modules/file/index.d.ts.map +0 -1
- package/dist/modules/file/index.js +0 -1
- package/dist/modules/resource/index.d.ts +0 -20
- package/dist/modules/resource/index.d.ts.map +0 -1
- package/dist/modules/resource/index.js +0 -1
- package/dist/modules/resource/services/list-children.d.ts +0 -6
- package/dist/modules/resource/services/list-children.d.ts.map +0 -1
- package/dist/modules/resource/services/list-children.js +0 -1
- package/dist/modules/system/index.d.ts +0 -13
- package/dist/modules/system/index.d.ts.map +0 -1
- package/dist/modules/system/index.js +0 -1
- package/dist/modules/utils/get-user-permissions.d.ts +0 -3
- package/dist/modules/utils/get-user-permissions.d.ts.map +0 -1
- package/dist/modules/utils/get-user-permissions.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export async function updateResourceRelation(R,t){const {resource:X,id:g,relation:m,relationId:Z,data:z,user:l}=R;return t['resource']['updateRelation']({'name':X,'id':g,'relation':m,'relationId':Z,'data':z,'user':l});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function updateResource(R,t){var X=q;return t['resource']['update']({'name':R[X(0x159)],'id':R['id'],'data':R[X(0x15a)],'user':R['user']});}function q(R,t){R=R-0x159;var X=G();var g=X[R];return g;}function G(){var g=['resource','patch'];G=function(){return g;};return G();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function G(){const l=['get','resource','admin','type','user','permission',':update','length','fileName','File\x20name\x20is\x20required','put','query'];G=function(){return l;};return G();}function q(R,t){R=R-0xc3;const X=G();let g=X[R];return g;}import{ForbiddenError,NotFoundError,ValidationError}from'../../../errors.js';export async function uploadResourceFile(R,t){const z=q,X=t['resource'][z(0xc3)](R[z(0xc4)]);if(X['access']===z(0xc5)&&R['user']?.[z(0xc6)]!=='admin')throw new ForbiddenError('Admin\x20access\x20required');if(R['user']?.['type']!=='admin'&&!R[z(0xc7)]?.['permissions']?.['includes']((X[z(0xc8)]??X['name'])+z(0xc9)))throw new ForbiddenError('Missing\x20permission:\x20'+(X[z(0xc8)]??X['name'])+z(0xc9));if(!Buffer['isBuffer'](R['file'])||R['file'][z(0xca)]===0x0)throw new ValidationError('File\x20is\x20required');const g=R[z(0xcb)]['replace'](/[^A-Za-z0-9._-]/g,'_');if(!g)throw new ValidationError(z(0xcc));const m='files/'+R['resource']+'/'+String(R['id'])+'/'+g;await t['file'][z(0xcd)](m,R['file']);if(!await t['file']['exists'](m))throw new NotFoundError('Uploaded\x20file\x20not\x20found');const Z=await t['pg'][z(0xce)]('\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']),m,R['file']['length']]);return Z['rows'][0x0];}
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { FastifyPluginAsync } from "fastify";
|
|
5
5
|
import type { AppContext } from "../../context.js";
|
|
6
|
-
|
|
6
|
+
import type { ApiRoute } from "../../type.js";
|
|
7
|
+
export declare function systemRoutes(ctx: AppContext, apiRoutes?: ReadonlyMap<string, ApiRoute>): FastifyPluginAsync;
|
|
7
8
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/system/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/system/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAanD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,wBAAgB,YAAY,CAC1B,GAAG,EAAE,UAAU,EACf,SAAS,GAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAa,GACnD,kBAAkB,CA8JpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{getSystemSettings}from'./services/get-system-settings.js';import{updateSystemSettings}from'./services/update-system-settings.js';function q(R,t){R=R-0x97;const X=G();let g=X[R];return g;}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 G(){const P=['get','dictionaryName','Replaces\x20the\x20items\x20of\x20a\x20registered\x20platform\x20dictionary.','system:dictionaries','dictionaryItems','params','fcore','system:access','system','system:settings','/api/system/settings','body','user','type','send','/api/system/audit','/api/system/list','List\x20APIs','admin'];G=function(){return P;};return G();}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';const u=R=>R['user'];export function systemRoutes(R,t=new Map()){return async X=>{const y=q;X[y(0x97)]('/api/dictionary/:name',{'schema':{'tags':['fcore','system'],'summary':'Get\x20platform\x20dictionary','description':'Returns\x20a\x20registered\x20platform\x20dictionary\x20by\x20name.','access':'user','permissions':['system:dictionaries'],'params':systemSchemas[y(0x98)]}},async m=>({'items':await getDictionary({...m['params'],'user':u(m)},R)})),X['post']('/api/dictionary/:name',{'schema':{'tags':['fcore','system'],'summary':'Update\x20platform\x20dictionary','description':y(0x99),'access':'user','permissions':[y(0x9a)],'params':systemSchemas['dictionaryName'],'body':systemSchemas[y(0x9b)]}},async m=>updateDictionary({...m[y(0x9c)],...m['body'],'user':u(m)},R));const g=async m=>getAccess({...m['params'],'user':u(m)},R);X['get']('/api/access/:type/:id',{'schema':{'tags':[y(0x9d),'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['accessTarget']}},g),X['post']('/api/access/:type/:id',{'schema':{'tags':['fcore','system'],'summary':'Set\x20access\x20rules','description':'Replaces\x20direct\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','access':'admin','permissions':[y(0x9e)],'params':systemSchemas['accessTarget'],'body':systemSchemas['access']}},async m=>setAccess({...m[y(0x9c)],...m['body'],'user':u(m)},R)),X[y(0x97)]('/api/system/settings',{'schema':{'tags':[y(0x9d),y(0x9f)],'summary':'Get\x20system\x20settings','description':'Returns\x20system\x20settings\x20as\x20nested\x20JSON.','access':'admin','permissions':[y(0xa0)]}},async m=>getSystemSettings({...m[y(0x9c)],'user':u(m)},R)),X['post'](y(0xa1),{'schema':{'tags':[y(0x9d),'system'],'summary':'Update\x20system\x20settings','description':'Updates\x20system\x20settings\x20using\x20flat\x20dot-notation\x20keys.','access':'admin','permissions':['system:settings'],'body':systemSchemas['settings']}},async m=>updateSystemSettings({...m[y(0x9c)],'patch':m[y(0xa2)],'user':u(m)},R)),X['get']('/api/system/logger',{'schema':{'tags':['fcore','system'],'summary':'Get\x20system\x20log','description':'Returns\x20system\x20logger\x20entries\x20for\x20the\x20requested\x20path.','access':y(0xa3),'permissions':['system:logs'],'querystring':systemSchemas['logger']}},async(m,Z)=>{const h=y,{contentType:z,body:l}=await getSystemLog({...m['query'],'user':u(m)},R);return Z[h(0xa4)](z)[h(0xa5)](l);}),X[y(0x97)](y(0xa6),{'schema':{'tags':['fcore',y(0x9f)],'summary':'Get\x20audit\x20log','description':'Returns\x20the\x20system\x20audit\x20log\x20entries.','access':'user','permissions':['system:audit']}},async m=>getAuditLog({...m['query'],'user':u(m)},R)),X[y(0x97)]('/api/system/check',{'schema':{'tags':['fcore','system'],'summary':'Check\x20system\x20health','description':'Checks\x20the\x20availability\x20of\x20system\x20dependencies.','access':y(0xa3),'permissions':['system:check']}},async m=>checkSystem({'user':u(m)},R)),X['get'](y(0xa7),{'schema':{'tags':['fcore','system'],'summary':y(0xa8),'description':'Returns\x20the\x20list\x20of\x20registered\x20platform\x20APIs.','access':y(0xa9),'permissions':[],'querystring':systemSchemas['apiListQuery']}},async m=>getApiList({'user':u(m),'apiRoutes':t,...m['query']},R));};}
|
|
@@ -3,12 +3,33 @@ export declare const systemSchemas: {
|
|
|
3
3
|
dictionaryName: import("@sinclair/typebox").TObject<{
|
|
4
4
|
name: import("@sinclair/typebox").TString;
|
|
5
5
|
}>;
|
|
6
|
+
dictionaryItems: import("@sinclair/typebox").TObject<{
|
|
7
|
+
items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
8
|
+
id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>;
|
|
9
|
+
code: import("@sinclair/typebox").TString;
|
|
10
|
+
name: import("@sinclair/typebox").TString;
|
|
11
|
+
parentId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNull]>>;
|
|
12
|
+
}>>;
|
|
13
|
+
}>;
|
|
14
|
+
accessTarget: import("@sinclair/typebox").TObject<{
|
|
15
|
+
type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"user">, import("@sinclair/typebox").TLiteral<"role">]>;
|
|
16
|
+
id: import("@sinclair/typebox").TString;
|
|
17
|
+
}>;
|
|
18
|
+
access: import("@sinclair/typebox").TObject<{
|
|
19
|
+
access: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
20
|
+
resource: import("@sinclair/typebox").TString;
|
|
21
|
+
actions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
22
|
+
}>>;
|
|
23
|
+
}>;
|
|
24
|
+
apiListQuery: import("@sinclair/typebox").TObject<{
|
|
25
|
+
format: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"short">, import("@sinclair/typebox").TLiteral<"extended">]>>;
|
|
26
|
+
}>;
|
|
6
27
|
settingsEntity: import("@sinclair/typebox").TObject<{
|
|
7
28
|
entity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
29
|
}>;
|
|
9
30
|
settings: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
|
|
10
31
|
logger: import("@sinclair/typebox").TObject<{
|
|
11
|
-
|
|
32
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
12
33
|
}>;
|
|
13
34
|
};
|
|
14
35
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/system/schema.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,qCAIrB,CAAC;AAEH,eAAO,MAAM,aAAa;IACxB,cAAc;;;IAGd,cAAc;;;IACd,QAAQ;IACR,MAAM;;;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/system/schema.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,qCAIrB,CAAC;AAEH,eAAO,MAAM,aAAa;IACxB,cAAc;;;IAGd,eAAe;;;;;;;;IAef,YAAY;;;;IAIZ,MAAM;;;;;;IAQN,YAAY;;;IAGZ,cAAc;;;IACd,QAAQ;IACR,MAAM;;;CAKP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const R=
|
|
1
|
+
const R=q;import{Type}from'@sinclair/typebox';function G(){const t=['Object','Optional','Literal','user','Array','String','Record'];G=function(){return t;};return G();}function q(R,t){R=R-0x196;const X=G();let g=X[R];return g;}export const identifier=Type['String']({'minLength':0x1,'maxLength':0x80,'pattern':'^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$'});export const systemSchemas={'dictionaryName':Type[R(0x196)]({'name':identifier}),'dictionaryItems':Type['Object']({'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[R(0x197)](Type['Union']([Type['String'](),Type['Number'](),Type['Null']()]))},{'additionalProperties':!![]}))}),'accessTarget':Type['Object']({'type':Type['Union']([Type[R(0x198)](R(0x199)),Type['Literal']('role')]),'id':identifier}),'access':Type['Object']({'access':Type['Array'](Type['Object']({'resource':Type['String']({'minLength':0x1,'maxLength':0x80}),'actions':Type[R(0x19a)](Type[R(0x19b)]({'minLength':0x1,'maxLength':0x80}),{'minItems':0x1})}))}),'apiListQuery':Type['Object']({'format':Type['Optional'](Type['Union']([Type['Literal']('short'),Type[R(0x198)]('extended')]))}),'settingsEntity':Type['Object']({'entity':Type['Optional'](identifier)}),'settings':Type[R(0x19c)](Type['String']({'minLength':0x1}),Type['Unknown']()),'logger':Type['Object']({'path':Type[R(0x197)](Type[R(0x19b)]({'maxLength':0x100,'pattern':'^[A-Za-z0-9_.\x5c-/]*$'}))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-system.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/check-system.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,WAAW,CAC/B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;CACZ,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"check-system.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/check-system.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,WAAW,CAC/B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;CACZ,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAcd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function G(){const Z=['SELECT\x201','redis','status'];G=function(){return Z;};return G();}function q(R,t){R=R-0xd6;const X=G();let g=X[R];return g;}export async function checkSystem(R,t){const m=q,[X,g]=await Promise['allSettled']([t['pg']['query'](m(0xd6)),t[m(0xd7)]['ping']()]);return{'status':X['status']==='fulfilled'&&g['status']==='fulfilled'?'ok':'degraded','pg':X[m(0xd8)],'redis':g['status']};}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AppContext, User } from "../../../context.js";
|
|
2
|
+
export interface AccessRecord {
|
|
3
|
+
resource: string | null;
|
|
4
|
+
actions: string[] | null;
|
|
5
|
+
role: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function getAccess(params: {
|
|
8
|
+
type: "user" | "role";
|
|
9
|
+
id: string;
|
|
10
|
+
user: User;
|
|
11
|
+
}, ctx: AppContext): Promise<{
|
|
12
|
+
access: AccessRecord[];
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=get-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-access.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,wBAAsB,SAAS,CAC7B,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EACzD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,MAAM,EAAE,YAAY,EAAE,CAAA;CAAE,CAAC,CAkBrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export async function getAccess(R,t){const X=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',g=await t['pg']['query'](X,[R['id']]);return{'access':g['rows']};}
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Implements the get API list application service for the System module.
|
|
3
3
|
*/
|
|
4
4
|
import type { AppContext, User } from "../../../context.js";
|
|
5
|
+
import type { ApiRoute } from "../../../type.js";
|
|
5
6
|
export declare function getApiList(params: {
|
|
6
7
|
user: User;
|
|
7
|
-
|
|
8
|
+
apiRoutes: ReadonlyMap<string, ApiRoute>;
|
|
9
|
+
format?: "short" | "extended";
|
|
10
|
+
}, ctx: AppContext): Promise<ApiRoute[] | string[]>;
|
|
8
11
|
//# sourceMappingURL=get-api-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-api-list.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-api-list.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-api-list.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-api-list.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,kBAAkB,CAAC;AAEhE,wBAAsB,UAAU,CAC9B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;CAC/B,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC,CAWhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function q(R,t){R=R-0xb4;const X=G();let g=X[R];return g;}export async function getApiList(R,t){const l=q,X=[...R['apiRoutes']['values']()]['sort']((g,m)=>(g['endpoint']+'\x20'+g['method'])[l(0xb4)](m['endpoint']+'\x20'+m[l(0xb5)]));if(R['format']!==l(0xb6))return X;return X['map'](({method:g,endpoint:m,access:Z,permissions:z})=>g+'\x20'+m);}function G(){const y=['localeCompare','method','short'];G=function(){return y;};return G();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-audit-log.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-audit-log.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,WAAW,CAC/B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"get-audit-log.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-audit-log.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,WAAW,CAC/B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAcd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function q(R,t){R=R-0xd8;const X=G();let g=X[R];return g;}export async function getAuditLog(R,t){const Z=q,X=Math['min'](Math['max'](R[Z(0xd8)]??0x32,0x1),0xc8),g=Math['max']((R[Z(0xd9)]??0x1)-0x1,0x0)*X,m=await t['pg']['query']('SELECT\x20*\x20FROM\x20admin.audit_log\x20ORDER\x20BY\x20id\x20DESC\x20LIMIT\x20$1\x20OFFSET\x20$2',[X,g]);return{'rows':m['rows'],'page':R[Z(0xd9)]??0x1,'limit':X};}function G(){const z=['limit','page'];G=function(){return z;};return G();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function G(){var g=['get'];G=function(){return g;};return G();}function q(R,t){R=R-0x131;var X=G();var g=X[R];return g;}export async function getDictionary(R,t){var X=q;return t['dictionary'][X(0x131)](R['name']);}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { AppContext, User } from "../../../context.js";
|
|
2
|
+
export interface LogResult {
|
|
3
|
+
contentType: string;
|
|
4
|
+
body: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function getSystemLog(params: {
|
|
7
|
+
path?: string;
|
|
8
|
+
user: User;
|
|
9
|
+
}, ctx: AppContext): Promise<LogResult>;
|
|
6
10
|
//# sourceMappingURL=get-system-log.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-system-log.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-system-log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-system-log.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-system-log.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAc5D,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EACrC,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,SAAS,CAAC,CA0CpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function q(R,t){R=R-0x66;const X=G();let g=X[R];return g;}const O=q;import R from'node:fs/promises';import t from'node:path';import{NotFoundError,ValidationError}from'../../../errors.js';const LOGS_ROOT=t['resolve'](process[O(0x66)](),'logs'),TAIL_LINES=0x64;export async function getSystemLog(X,g){const U=O,m=normalizePath(X['path']),Z=t['resolve'](LOGS_ROOT,m);if(Z!==LOGS_ROOT&&!Z['startsWith'](LOGS_ROOT+t['sep']))throw new ValidationError(U(0x67));const z=await R['stat'](Z)[U(0x68)](()=>null);if(!z)throw new NotFoundError(U(0x69));if(z['isDirectory']()){const y=await R['readdir'](Z,{'withFileTypes':!![]}),h=await Promise['all'](y['map'](async P=>{const e=U,E=await R[e(0x6a)](t['join'](Z,P[e(0x6b)]));return{'name':P[e(0x6b)],'path':m?m+'/'+P['name']:P['name'],'type':P['isDirectory']()?'directory':'file','size':P['isDirectory']()?undefined:E['size'],'modified':E[e(0x6c)]['toISOString']()};}));h['sort']((P,E)=>P['name']['localeCompare'](E['name']));if(m){const P=m[U(0x6d)]('/')[U(0x6e)](0x0,-0x1)[U(0x6f)]('/');h['unshift']({'name':'..','path':P,'type':'directory'});}return{'contentType':'text/html;\x20charset=utf-8','body':renderDirectory(m,h)};}const l=await tailFile(Z,TAIL_LINES);return{'contentType':U(0x70),'body':l[U(0x6f)]('\x0a')};}function renderDirectory(X,g){const n=O,m=g['map'](z=>{const H=q,l='?path='+encodeURIComponent(z['path']),y=z['type']==='directory'?z[H(0x6b)]+'/':z[H(0x6b)];return'<li><a\x20href=\x22'+l+'\x22>'+escapeHtml(y)+'</a></li>';})['join']('\x0a'),Z=escapeHtml('logs/'+X);return n(0x71)+Z+'</title></head>\x0a<body>\x0a<h1>'+Z+n(0x72)+m+n(0x73);}function escapeHtml(X){return X['replace'](/&/g,'&')['replace'](/</g,'<')['replace'](/>/g,'>')['replace'](/"/g,'"');}function normalizePath(X){const S=O,g=(X??'')[S(0x74)](/\\/g,'/')[S(0x74)](/^\/+|\/+$/g,'');if(g['split']('/')[S(0x75)](m=>m==='..'))throw new ValidationError('Invalid\x20log\x20path');return g;}function G(){const Q=['cwd','Invalid\x20log\x20path','catch','Log\x20path\x20not\x20found','stat','name','mtime','split','slice','join','text/plain;\x20charset=utf-8','<!DOCTYPE\x20html>\x0a<html>\x0a<head><meta\x20charset=\x22utf-8\x22><title>','</h1>\x0a<ul>\x0a','\x0a</ul>\x0a</body>\x0a</html>','replace','some'];G=function(){return Q;};return G();}async function tailFile(X,g){const c=O,m=await R['open'](X,'r');try{const {size:Z}=await m[c(0x6a)](),z=0x40*0x400;let l=Z,y=Buffer['alloc'](0x0),h=0x0;while(l>0x0&&h<=g){const E=Math['min'](z,l);l-=E;const C=Buffer['alloc'](E);await m['read'](C,0x0,E,l),y=Buffer['concat']([C,y]),h+=countNewlines(C);}const P=y['toString']('utf8')['split']('\x0a')['filter'](L=>L['length']>0x0);return P[c(0x6e)](-g)['reverse']();}finally{await m['close']();}}function countNewlines(X){let g=0x0;for(const m of X){if(m===0xa)g++;}return g;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-system-settings.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-system-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,iBAAiB,CACrC,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;CACZ,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"get-system-settings.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-system-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,iBAAiB,CACrC,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;CACZ,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAkBlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function getSystemSettings(R,t){const X=await t['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 X['rows']['reduce']((g,m)=>{const Z=String(m['key'])['split']('.');let z=g;for(const l of Z['slice'](0x0,-0x1)){z[l]??={},z=z[l];}return z[Z['at'](-0x1)]=m['value'],g;},{});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function listDictionaries(R,t){return t['dictionary']['list']();}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AppContext, User } from "../../../context.js";
|
|
2
|
+
import { type AccessRecord } from "./get-access.js";
|
|
3
|
+
type AccessInput = {
|
|
4
|
+
resource: string;
|
|
5
|
+
actions: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare function setAccess(params: {
|
|
8
|
+
type: "user" | "role";
|
|
9
|
+
id: string;
|
|
10
|
+
access: AccessInput[];
|
|
11
|
+
user: User;
|
|
12
|
+
}, ctx: AppContext): Promise<{
|
|
13
|
+
access: AccessRecord[];
|
|
14
|
+
}>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=set-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-access.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/set-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/D,KAAK,WAAW,GAAG;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,wBAAsB,SAAS,CAC3B,MAAM,EAAE;IACJ,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,IAAI,EAAE,IAAI,CAAC;CACd,EACD,GAAG,EAAE,UAAU,GAChB,OAAO,CAAC;IAAE,MAAM,EAAE,YAAY,EAAE,CAAA;CAAE,CAAC,CA6CrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function q(R,t){R=R-0xa2;const X=G();let g=X[R];return g;}function G(){const z=['connect','type','DELETE\x20FROM\x20admin.role_access\x20WHERE\x20user_uid\x20=\x20$1\x20AND\x20role_id\x20IS\x20NULL','query','DELETE\x20FROM\x20admin.role_access\x20WHERE\x20role_id\x20=\x20$1\x20AND\x20user_uid\x20IS\x20NULL','user','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)','resource','ROLLBACK'];G=function(){return z;};return G();}import{getAccess}from'./get-access.js';export async function setAccess(R,t){const Z=q,X=await t['pg'][Z(0xa2)]();try{await X['query']('BEGIN');R[Z(0xa3)]==='user'?await X['query'](Z(0xa4),[R['id']]):await X[Z(0xa5)](Z(0xa6),[R['id']]);for(const g of R['access']){R['type']===Z(0xa7)?await X['query'](Z(0xa8),[g[Z(0xa9)],g['actions'],R['id'],R['user']['id'],R['user']['id']]):await X['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)',[g['resource'],g['actions'],R['id'],R['user']['id'],R['user']['id']]);}await X['query']('COMMIT');}catch(m){await X['query'](Z(0xaa));throw m;}finally{X['release']();}return getAccess(R,t);}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implements the update dictionary application service for the System module.
|
|
3
|
+
*/
|
|
4
|
+
import type { AppContext, User } from "../../../context.js";
|
|
5
|
+
import type { DictionaryItem } from "../../../plugins/dictionary.js";
|
|
6
|
+
export declare function updateDictionary(params: {
|
|
7
|
+
name: string;
|
|
8
|
+
items: DictionaryItem[];
|
|
9
|
+
user: User;
|
|
10
|
+
}, ctx: AppContext): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=update-dictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-dictionary.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/update-dictionary.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,wBAAsB,gBAAgB,CACpC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,cAAc,EAAE,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EAC7D,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAI/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export async function updateDictionary(R,t){var X=q;return await t['dictionary'][X(0x15e)](R['name'],R['items']),{'success':!![]};}function q(R,t){R=R-0x15e;var X=G();var g=X[R];return g;}function G(){var g=['put'];G=function(){return g;};return G();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-system-settings.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/update-system-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG5D,wBAAsB,oBAAoB,CACxC,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"update-system-settings.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/update-system-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG5D,wBAAsB,oBAAoB,CACxC,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC,CAqB5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function G(){const Z=['length','stringify'];G=function(){return Z;};return G();}import{ValidationError}from'../../../errors.js';function q(R,t){R=R-0xe1;const X=G();let g=X[R];return g;}export async function updateSystemSettings(R,t){const m=q;if(!Object['keys'](R['patch'])[m(0xe1)])throw new ValidationError('Settings\x20patch\x20is\x20empty');for(const [X,g]of Object['entries'](R['patch'])){if(!X['trim']()||X['includes']('..'))throw new ValidationError('Invalid\x20setting\x20key:\x20'+X);await t['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',[X,JSON[m(0xe2)](g),R['user']['id']]);}return{'success':!![]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{ForbiddenError}from'../../errors.js';export function requireAdmin(R,t){var X=q;if(!R)throw new ForbiddenError('User\x20required');if(R['type']!=='admin')throw new ForbiddenError(X(0x1d3));if(R['type']!==X(0x1d4)&&t&&!R['permissions']?.['includes'](t))throw new ForbiddenError('Missing\x20permission:\x20'+t);}function q(R,t){R=R-0x1d3;var X=G();var g=X[R];return g;}function G(){var g=['Admin\x20access\x20required','admin'];G=function(){return g;};return G();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function q(R,t){R=R-0x187;const X=G();let g=X[R];return g;}function G(){const Z=['toLowerCase'];G=function(){return Z;};return G();}export const safeUser=R=>{const m=q,t=['password','salt','secret','credentials'];return Object['fromEntries'](Object['entries'](R)['filter'](([X])=>!t['some'](g=>X[m(0x187)]()['includes'](g))));};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{UnsupportedError}from'../../errors.js';function q(R,t){R=R-0x162;var X=G();var g=X[R];return g;}export function unsupported(R){var t=q;throw new UnsupportedError(R+t(0x162));}function G(){var X=['\x20requires\x20a\x20project/provider\x20implementation'];G=function(){return X;};return G();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{writeAudit}from'./services/write-audit.js';export function createAudit(R){const t=writeAudit(R);return{'write':t};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export*from'./audit.types.js';export*from'./audit.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function G(){const L=['object','entries','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\x20IN\x20(\x27audit_log\x27,\x20\x27audit_log_data\x27)\x0a\x20\x20\x20\x20\x20\x20\x20\x20','then','rows','has','audit_log','empty\x20pg','resourceId','ipAddress','metadata','changes','field'];G=function(){return L;};return G();}function q(R,t){R=R-0x1de;const X=G();let g=X[R];return g;}const secretPattern=/password|token|secret|credential|salt/i;function clean(R){const h=q;if(Array['isArray'](R))return R['map'](clean);if(R&&typeof R===h(0x1de))return Object['fromEntries'](Object[h(0x1df)](R)['map'](([t,X])=>[t,secretPattern['test'](t)?'[REDACTED]':clean(X)]));return R;}export function writeAudit(R){let t,X;async function g(){const P=q;if(!R['pg'])return![];if(t!==undefined)return t;return X??=R['pg'][P(0x1e0)](P(0x1e1))[P(0x1e2)](m=>{const E=P,Z=new Set(m[E(0x1e3)]['map'](z=>z['table_name']));return t=Z[E(0x1e4)](E(0x1e5))&&Z['has']('audit_log_data'),!t&&R['logger']['warn']({'expectedTables':['admin.audit_log','admin.audit_log_data'],'foundTables':[...Z]},'Audit\x20tables\x20are\x20unavailable;\x20audit\x20writes\x20are\x20disabled'),t;})['catch'](m=>{return t=![],R['logger']['warn']({'err':m},'Unable\x20to\x20check\x20audit\x20tables;\x20audit\x20writes\x20are\x20disabled'),![];}),X;}return async function m(Z){const C=q;if(!await g())return R['logger']['info']({'auditFallback':!![],'event':clean({...Z,'changes':Z['changes']?.['map'](y=>({...y,'oldValue':clean(y['oldValue']),'newValue':clean(y['newValue'])}))})},'audit'),0x0;if(!R['pg'])throw new Error(C(0x1e6));const z=await R['pg'][C(0x1e0)]('\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',[Z['userId']??null,Z['module'],Z['resource'],Z['resourceId']==null?null:String(Z[C(0x1e7)]),Z['fields']??null,Z['action'],Z['requestId']??null,Z[C(0x1e8)]??null,clean(Z[C(0x1e9)]??{})]),l=z['rows'][0x0]['id'];for(const y of Z[C(0x1ea)]??[]){if(secretPattern['test'](y['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',[l,y[C(0x1eb)],JSON['stringify'](clean(y['oldValue'])),JSON['stringify'](clean(y['newValue']))]);}return l;};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-user-permissions.d.ts","sourceRoot":"","sources":["../../../src/plugins/auth/get-user-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,GACnC,OAAO,CAAC,MAAM,EAAE,CAAC,CAenB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function q(R,t){R=R-0x1d6;const X=G();let g=X[R];return g;}export async function getUserPermissions(R,t){const m=q,X=await t['pg']['query'](m(0x1d6),[R]);return X['rows'][m(0x1d7)](g=>g['permission']);}function G(){const Z=['\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','map'];G=function(){return Z;};return G();}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export * from "./auth.types.js";
|
|
2
2
|
import { type FastifyInstance } from "fastify";
|
|
3
3
|
import { type ContextDependencies } from "../../context.js";
|
|
4
|
+
export * from "./verifyUser.js";
|
|
5
|
+
export * from "./get-user-permissions.js";
|
|
6
|
+
export declare function hashPassword(password: string): Promise<string>;
|
|
7
|
+
export declare function verifyPassword(password: string, stored: string): Promise<boolean>;
|
|
4
8
|
export declare function createSessionStore(app: FastifyInstance, ctx: ContextDependencies): Promise<void>;
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAUhC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAO/C,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAI5D,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAE1C,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKpE;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,CAalB;AAED,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,mBAAmB,iBA6CzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export*from'./auth.types.js';import{randomBytes,scrypt as R,timingSafeEqual}from'node:crypto';import{promisify}from'node:util';function G(){const e=['hex','scrypt','from','auth','cookieOptions','initialize','registerUserDeserializer','user'];G=function(){return e;};return G();}const scrypt=promisify(R);import t from'@fastify/cookie';import X from'@fastify/session';import{Authenticator}from'@fastify/passport';import g from'fastify-session-redis-store';function q(R,t){R=R-0x1e3;const X=G();let g=X[R];return g;}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(m){const C=q,Z=randomBytes(0x10),z=await scrypt(m,Z,0x40);return'scrypt$'+Z['toString'](C(0x1e3))+'$'+z['toString'](C(0x1e3));}export async function verifyPassword(m,Z){const L=q,[z,l,y]=Z?.['split']('$')||[];if(z!==L(0x1e4)||!l||!y)return![];const h=Buffer[L(0x1e5)](l,L(0x1e3)),P=Buffer['from'](y,'hex'),E=await scrypt(m,h,P['length']);return timingSafeEqual(E,P);}export async function createSessionStore(m,Z){const O=q,{config:z,redis:l}=Z;if(!z||!l){console['warn']('Missing\x20config\x20or\x20redis\x20-\x20skipping\x20session\x20store\x20creation');return;}if(process.env.NODE_ENV==='test'||process.env.VITEST)return;await m['register'](t,{'parseOptions':z['auth']['cookieOptions']}),await m['register'](X,{'secret':z[O(0x1e6)]['secret'],'cookieName':z[O(0x1e6)]['cookieName'],'cookie':z[O(0x1e6)][O(0x1e7)],'store':new g({'prefix':z[O(0x1e6)]['cookieName']+':'+(z['pg']?.['database']||'db')+':','client':l})}),await m['register'](fastifyPassport[O(0x1e8)]()),await m['register'](fastifyPassport['secureSession']()),fastifyPassport['registerUserSerializer'](async y=>({'user':y})),fastifyPassport[O(0x1e9)](async y=>{const U=O,h=y?.[U(0x1ea)]||y;return h?.['id']&&(h['permissions']=await getUserPermissions(h['id'],Z)),h;});}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContextDependencies } from "../../context.js";
|
|
2
|
+
type params = {
|
|
3
|
+
user: string;
|
|
4
|
+
password: string;
|
|
5
|
+
ip?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function verifyUser({ user, password, ip, }: params, { pg, logger }: Pick<ContextDependencies, "pg" | "logger">): Promise<import("./auth.types.js").AuthUser>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=verifyUser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyUser.d.ts","sourceRoot":"","sources":["../../../src/plugins/auth/verifyUser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAQ,MAAM,kBAAkB,CAAC;AAI7D,KAAK,MAAM,GAAG;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,wBAAsB,UAAU,CAC9B,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,MAAM,EAC/B,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,QAAQ,CAAC,+CAgC3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function G(){const E=['user.login','query','info','auth/warn'];G=function(){return E;};return G();}function q(R,t){R=R-0x67;const X=G();let g=X[R];return g;}import{BadRequestError}from'../../errors.js';import{verifyPassword}from'./index.js';export async function verifyUser({user:R,password:t,ip:X},{pg:g,logger:m}){const P=q;if(!R||R==='')throw new BadRequestError('not\x20enough\x20params:\x20user');if(!t||t==='')throw new BadRequestError('not\x20enough\x20params:\x20password');m['metrics'](P(0x67));const Z='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',z=await g[P(0x68)](Z,[R])['then'](y=>y['rows']?.[0x0]);if(!z){const y='user\x20not\x20found';m[P(0x69)]({'file':P(0x6a),'error':y,'user':R,'ip':X});throw new BadRequestError(y);}const l=await verifyPassword(t,z['password_hash']);if(!l){const h='Wrong\x20password';m['info']({'file':'auth/warn','error':h,'user':R,'ip':X});throw new BadRequestError(h);}return delete z['password_hash'],z;}
|
|
@@ -9,13 +9,16 @@ export interface DictionaryItem {
|
|
|
9
9
|
export interface DictionaryDefinition {
|
|
10
10
|
code: string;
|
|
11
11
|
name?: string;
|
|
12
|
+
checked?: boolean;
|
|
12
13
|
items: DictionaryItem[];
|
|
13
14
|
}
|
|
14
15
|
export interface DictionaryPlugin {
|
|
15
16
|
register(input: DictionaryDefinition | DictionaryDefinition[]): void;
|
|
17
|
+
has(name: string): boolean;
|
|
16
18
|
get(name: string): Promise<DictionaryItem[]>;
|
|
17
19
|
put(name: string, items: DictionaryItem[]): Promise<void>;
|
|
18
20
|
clear(name: string): boolean;
|
|
21
|
+
revision(name: string): number;
|
|
19
22
|
list(): Promise<Array<{
|
|
20
23
|
code: string;
|
|
21
24
|
name: string;
|