@opengis/fcore 0.0.1-beta.9 → 0.0.28
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 +1 -0
- 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 +0 -3
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fcore.d.ts.map +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.d.ts.map +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.d.ts +2 -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.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.d.ts.map +1 -1
- package/dist/modules/file/services/upload-file.js +1 -1
- 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 +19 -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.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/generate-resource-code.d.ts +16 -0
- package/dist/modules/resource/services/generate-resource-code.d.ts.map +1 -0
- package/dist/modules/resource/services/generate-resource-code.js +1 -0
- package/dist/modules/resource/services/get-resource-schema.d.ts +6 -0
- package/dist/modules/resource/services/get-resource-schema.d.ts.map +1 -0
- package/dist/modules/resource/services/get-resource-schema.js +1 -0
- package/dist/modules/resource/services/get-resource.js +1 -1
- package/dist/modules/resource/services/list-resource-as-user.d.ts +8 -0
- package/dist/modules/resource/services/list-resource-as-user.d.ts.map +1 -0
- package/dist/modules/resource/services/list-resource-as-user.js +1 -0
- package/dist/modules/resource/services/list-resource-list.d.ts +20 -0
- package/dist/modules/resource/services/list-resource-list.d.ts.map +1 -0
- package/dist/modules/resource/services/list-resource-list.js +1 -0
- 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.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.d.ts.map +1 -1
- package/dist/modules/system/route.js +1 -1
- package/dist/modules/system/schema.d.ts +25 -2
- 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.js +1 -1
- package/dist/modules/system/services/get-access.d.ts +1 -0
- package/dist/modules/system/services/get-access.d.ts.map +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.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-resource-access.d.ts +23 -0
- package/dist/modules/system/services/get-resource-access.d.ts.map +1 -0
- package/dist/modules/system/services/get-resource-access.js +1 -0
- package/dist/modules/system/services/get-resource-scopes.d.ts +16 -0
- package/dist/modules/system/services/get-resource-scopes.d.ts.map +1 -0
- package/dist/modules/system/services/get-resource-scopes.js +1 -0
- 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.d.ts +3 -1
- package/dist/modules/system/services/set-access.d.ts.map +1 -1
- package/dist/modules/system/services/set-access.js +1 -1
- package/dist/modules/system/services/set-resource-access.d.ts +18 -0
- package/dist/modules/system/services/set-resource-access.d.ts.map +1 -0
- package/dist/modules/system/services/set-resource-access.js +1 -0
- package/dist/modules/system/services/set-resource-scopes.d.ts +10 -0
- package/dist/modules/system/services/set-resource-scopes.d.ts.map +1 -0
- package/dist/modules/system/services/set-resource-scopes.js +1 -0
- 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/audit.types.d.ts +1 -1
- package/dist/plugins/audit/audit.types.d.ts.map +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.d.ts.map +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.d.ts +7 -3
- package/dist/plugins/file.d.ts.map +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.d.ts +4 -2
- package/dist/plugins/pg.d.ts.map +1 -1
- package/dist/plugins/pg.js +1 -1
- package/dist/plugins/redis.d.ts.map +1 -1
- package/dist/plugins/redis.js +1 -1
- package/dist/plugins/resource/resource.d.ts +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.d.ts +3 -2
- package/dist/plugins/resource/resource.registry.d.ts.map +1 -1
- package/dist/plugins/resource/resource.registry.js +1 -1
- package/dist/plugins/resource/resource.types.d.ts +66 -14
- package/dist/plugins/resource/resource.types.d.ts.map +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.d.ts +5 -2
- package/dist/plugins/resource/services/create-relation.d.ts.map +1 -1
- package/dist/plugins/resource/services/create-relation.js +1 -1
- 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 +6 -3
- package/dist/plugins/resource/services/delete-relation.d.ts.map +1 -1
- package/dist/plugins/resource/services/delete-relation.js +1 -1
- 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.map +1 -1
- package/dist/plugins/resource/services/find-one.js +1 -1
- package/dist/plugins/resource/services/find-relation.d.ts.map +1 -1
- package/dist/plugins/resource/services/find-relation.js +1 -1
- 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/get-table-columns.d.ts +8 -0
- package/dist/plugins/resource/services/get-table-columns.d.ts.map +1 -0
- package/dist/plugins/resource/services/get-table-columns.js +1 -0
- package/dist/plugins/resource/services/update-relation.d.ts +5 -2
- package/dist/plugins/resource/services/update-relation.d.ts.map +1 -1
- package/dist/plugins/resource/services/update-relation.js +1 -1
- 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.js +1 -1
- package/dist/plugins/resource/utils/fields.js +1 -1
- package/dist/plugins/resource/utils/filters.d.ts +2 -1
- 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.js +1 -1
- package/dist/plugins/resource/utils/scope.d.ts +10 -0
- package/dist/plugins/resource/utils/scope.d.ts.map +1 -0
- package/dist/plugins/resource/utils/scope.js +1 -0
- package/dist/plugins/resource/utils/sort.d.ts +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.d.ts +1 -1
- package/dist/plugins/resource/utils/sql.d.ts.map +1 -1
- package/dist/plugins/resource/utils/sql.js +1 -1
- package/dist/plugins/resource/utils/summary.d.ts +7 -0
- package/dist/plugins/resource/utils/summary.d.ts.map +1 -0
- package/dist/plugins/resource/utils/summary.js +1 -0
- package/dist/shared/getIP.js +1 -1
- package/migrations/20260903120000_core_schema.sql +5 -2
- 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/20260910170000_core_schema.sql +22 -0
- package/migrations/20260929120000_allow_user_only_role_scopes.sql +2 -0
- package/migrations/20260929_role_scope.sql +32 -0
- package/package.json +93 -93
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/route.ts"],"names":[],"mappings":"AAIA,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/resource/route.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAwBnD,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,kBAAkB,CAoblE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const h=c;function L(){const D=['user','get','/api/resource/:resource/search','fcore','Search\x20resource','resource','query','/api/resource/:resource','/api/resource/:resource/:id','Returns\x20one\x20record\x20from\x20a\x20registered\x20resource.','resourceIncludeQuery','params','body','Deletes\x20a\x20record\x20from\x20a\x20registered\x20resource.','post','/api/resource/:resource/:id/upload','file','path','Returns\x20related\x20records\x20for\x20a\x20resource\x20record.','resourceIdRelation','delete','Deletes\x20a\x20relation\x20from\x20a\x20resource\x20record.','resourceIdRelationId','put','/api/resource/:resource/:id/:relation/:relationId','Update\x20resource\x20relation','Updates\x20a\x20related\x20resource\x20record.'];L=function(){return D;};return L();}import{ForbiddenError}from'../../errors.js';import{listResources}from'./services/list-resources.js';import{getResource}from'./services/get-resource.js';import{createResource}from'./services/create-resource.js';import{updateResource}from'./services/update-resource.js';import{deleteResource}from'./services/delete-resource.js';function c(J,e){J=J-0x1ef;const p=L();let b=p[J];return b;}import{listResourceRelation}from'./services/list-resource-relation.js';import{createResourceRelation}from'./services/create-resource-relation.js';import{updateResourceRelation}from'./services/update-resource-relation.js';import{deleteResourceRelation}from'./services/delete-resource-relation.js';import{searchResource}from'./services/search-resource.js';import{exportResource}from'./services/export-resource.js';import{suggestResource}from'./services/suggest-resource.js';import{resourceSchemas}from'./schema.js';import{uploadFile}from'../file/services/upload-file.js';const user=J=>J[h(0x1ef)];export function resourceRoutes(J){return async e=>{const u=c;e[u(0x1f0)](u(0x1f1),{'schema':{'tags':[u(0x1f2),'resource'],'summary':u(0x1f3),'description':'Searches\x20records\x20in\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas[u(0x1f4)]}},async p=>searchResource({...p['query'],...p['params'],'user':user(p)},J)),e['get']('/api/suggest/:resource/:field',{'schema':{'tags':[u(0x1f2),'resource'],'summary':'Suggest\x20resource\x20values','description':'Returns\x20suggested\x20values\x20for\x20a\x20resource\x20field.','access':'user','permissions':[],'params':resourceSchemas['resourceField'],'querystring':resourceSchemas['suggestQuery']}},async p=>suggestResource({...p[u(0x1f5)],...p['params'],'user':user(p)},J)),e[u(0x1f0)]('/api/resource/:resource/export',{'schema':{'tags':[u(0x1f2),u(0x1f4)],'summary':'Export\x20resource\x20records','description':'Exports\x20readable\x20records\x20from\x20a\x20registered\x20resource.','access':u(0x1ef),'permissions':['*:read'],'params':resourceSchemas['exportResource'],'querystring':resourceSchemas['exportResourceQuery']}},async p=>exportResource({...p['query'],...p['params'],'user':user(p)},J)),e[u(0x1f0)](u(0x1f6),{'schema':{'tags':[u(0x1f2),u(0x1f4)],'summary':'List\x20resource\x20records','description':'Returns\x20records\x20from\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas['resource']}},async p=>listResources({...p[u(0x1f5)],...p['params'],'user':user(p)},J)),e['post']('/api/resource/:resource',{'schema':{'tags':['fcore',u(0x1f4)],'summary':'Create\x20resource\x20record','description':'Creates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas[u(0x1f4)]}},async p=>createResource({...p['params'],'data':p['body'],'user':user(p)},J)),e['get'](u(0x1f7),{'schema':{'tags':['fcore','resource'],'summary':'Get\x20resource\x20record','description':u(0x1f8),'access':'user','permissions':[],'params':resourceSchemas['resourceId'],'querystring':resourceSchemas[u(0x1f9)]}},async p=>getResource({...p[u(0x1f5)],...p[u(0x1fa)],'user':user(p)},J)),e['put'](u(0x1f7),{'schema':{'tags':['fcore','resource'],'summary':'Update\x20resource\x20record','description':'Updates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas['resourceId']}},async p=>updateResource({...p['params'],'patch':p[u(0x1fb)],'user':user(p)},J)),e['delete']('/api/resource/:resource/:id',{'schema':{'tags':['fcore','resource'],'summary':'Delete\x20resource\x20record','description':u(0x1fc),'access':u(0x1ef),'permissions':[],'params':resourceSchemas['resourceId']}},async p=>deleteResource({...p['params'],'user':user(p)},J)),e[u(0x1fd)](u(0x1fe),{'schema':{'tags':[u(0x1f2),'resource'],'summary':'Upload\x20resource\x20file','description':'Uploads\x20a\x20file\x20to\x20a\x20Resource\x20record\x20and\x20stores\x20its\x20metadata.','access':'user','permissions':[],'params':resourceSchemas['uploadResourceFile']}},async p=>{const H=u,b=await p[H(0x1ff)]();if(!b)throw new Error('File\x20is\x20required');const F=p['params']['resource'],P=p['params']['id'];if(p['user']?.['type']!=='admin'&&!p['user']?.['permissions']['includes'](F+':update'))throw new ForbiddenError('Missing\x20permission:\x20'+F+':update');return uploadFile({'file':b,'metadata':{'name':b['filename'],'path':b['fields'][H(0x200)]?.['value'],'resource':F,'resourceId':P},'user':p['user']},J);}),e[u(0x1f0)]('/api/resource/:resource/:id/:relation',{'schema':{'tags':['fcore','resource'],'summary':'List\x20resource\x20relations','description':u(0x201),'access':'user','permissions':[],'schema':{'params':resourceSchemas[u(0x202)]}}},async p=>listResourceRelation({...p['query'],...p['params'],'user':user(p)},J)),e['post']('/api/resource/:resource/:id/:relation',{'schema':{'tags':['fcore','resource'],'summary':'Create\x20resource\x20relation','description':'Creates\x20a\x20relation\x20for\x20a\x20resource\x20record.','access':u(0x1ef),'permissions':[],'params':resourceSchemas['resourceIdRelation']}},async p=>createResourceRelation({...p['params'],'data':p[u(0x1fb)],'user':user(p)},J)),e[u(0x203)]('/api/resource/:resource/:id/:relation/:relationId',{'schema':{'tags':['fcore','resource'],'summary':'Delete\x20resource\x20relation','description':u(0x204),'access':'user','permissions':[],'params':resourceSchemas[u(0x205)]}},async p=>deleteResourceRelation({...p['params'],'user':user(p)},J)),e[u(0x206)](u(0x207),{'schema':{'tags':['fcore','resource'],'summary':u(0x208),'description':u(0x209),'access':u(0x1ef),'permissions':[],'params':resourceSchemas['resourceIdRelationId']}},async p=>updateResourceRelation({...p['params'],'data':p['body'],'user':user(p)},J));};}
|
|
1
|
+
import{listResources}from'./services/list-resources.js';import{listResourceAsUser}from'./services/list-resource-as-user.js';import{getResource}from'./services/get-resource.js';import{createResource}from'./services/create-resource.js';function s(){const N=['Search\x20resource','user','query','/api/suggest/:resource/:field','fcore','Returns\x20suggested\x20values\x20for\x20a\x20resource\x20field.','$resource:read','config','resource','Export\x20resource\x20records','exportResourceQuery','params','Returns\x20the\x20resource\x20variables\x20and\x20nested\x20relation\x20schema.','Generates\x20a\x20code\x20from\x20an\x20explicit\x20template\x20or\x20a\x20field\x20code_template.','/api/resource/:resource/scope/:user','List\x20resource\x20as\x20a\x20user\x20for\x20scope\x20testing','system:access','get','/api/resource/:resource','List\x20resource\x20records','auth','post','Create\x20resource\x20record','$resource:create','resourceIncludeQuery','Updates\x20a\x20record\x20in\x20a\x20registered\x20resource.','resourceId','body','/api/resource/:resource/:id','Delete\x20resource\x20record','Uploads\x20a\x20file\x20to\x20a\x20Resource\x20record\x20and\x20stores\x20its\x20metadata.','$resource:update','uploadResourceFile','fields','value','Deletes\x20a\x20file\x20linked\x20to\x20a\x20resource\x20record\x20after\x20validating\x20it\x20belongs\x20to\x20this\x20resource\x20and\x20record.','rowCount','file','delete','resourceIdRelation','/api/resource/:resource/:id/:relation','Create\x20resource\x20relation','Updates\x20a\x20related\x20resource\x20record.','resourceIdRelationId'];s=function(){return N;};return s();}import{updateResource}from'./services/update-resource.js';import{deleteResource}from'./services/delete-resource.js';import{listResourceRelation}from'./services/list-resource-relation.js';import{createResourceRelation}from'./services/create-resource-relation.js';import{updateResourceRelation}from'./services/update-resource-relation.js';import{deleteResourceRelation}from'./services/delete-resource-relation.js';import{searchResource}from'./services/search-resource.js';import{exportResource}from'./services/export-resource.js';import{suggestResource}from'./services/suggest-resource.js';import{listResourceList}from'./services/list-resource-list.js';function f(p,Z){p=p-0x1a2;const A=s();let I=A[p];return I;}import{getResourceSchema}from'./services/get-resource-schema.js';import{generateResourceCode}from'./services/generate-resource-code.js';import{resourceSchemas}from'./schema.js';import{uploadFile}from'../file/services/upload-file.js';const user=p=>p['user'];export function resourceRoutes(p){return async Z=>{const H=f;Z['get']('/api/resource/:resource/search',{'schema':{'tags':['fcore','resource'],'summary':H(0x1a2),'description':'Searches\x20records\x20in\x20a\x20registered\x20resource.','access':H(0x1a3),'permissions':['$resource:read'],'params':resourceSchemas['resource']}},async A=>searchResource({...A[H(0x1a4)],...A['params'],'user':user(A)||p['config']?.['auth']?.['user']},p)),Z['get'](H(0x1a5),{'schema':{'tags':[H(0x1a6),'resource'],'summary':'Suggest\x20resource\x20values','description':H(0x1a7),'access':'user','permissions':[H(0x1a8)],'params':resourceSchemas['resourceField'],'querystring':resourceSchemas['suggestQuery']}},async A=>suggestResource({...A['query'],...A['params'],'user':user(A)||p[H(0x1a9)]?.['auth']?.['user']},p)),Z['get']('/api/resource/:resource/export',{'schema':{'tags':[H(0x1a6),H(0x1aa)],'summary':H(0x1ab),'description':'Exports\x20readable\x20records\x20from\x20a\x20registered\x20resource.','access':H(0x1a3),'permissions':['$resource:read'],'params':resourceSchemas['exportResource'],'querystring':resourceSchemas[H(0x1ac)]}},async A=>exportResource({...A[H(0x1a4)],...A[H(0x1ad)],'user':user(A)||p['config']?.['auth']?.[H(0x1a3)]},p)),Z['get']('/api/resource/:resource/schema',{'schema':{'tags':['fcore',H(0x1aa)],'summary':'Get\x20resource\x20schema','description':H(0x1ae),'access':'user','permissions':[H(0x1a8)],'params':resourceSchemas[H(0x1aa)]}},async A=>getResourceSchema(A[H(0x1ad)],p)),Z['get']('/api/resource/:resource/code',{'schema':{'tags':['fcore','resource'],'summary':'Generate\x20a\x20resource\x20code','description':H(0x1af),'access':'user','permissions':['$resource:read'],'params':resourceSchemas[H(0x1aa)],'querystring':resourceSchemas['resourceCodeQuery']}},async A=>generateResourceCode({...A['params'],...A[H(0x1a4)]},p)),Z['get'](H(0x1b0),{'schema':{'tags':['fcore','resource'],'summary':H(0x1b1),'description':'Returns\x20resource\x20records\x20using\x20the\x20specified\x20user\x27s\x20permissions\x20and\x20access\x20scopes.\x20Admin\x20only.','access':'admin','permissions':[H(0x1b2)],'params':resourceSchemas['resourceScopeTarget']}},async A=>listResourceAsUser({...A['params'],...A['query'],'requester':user(A)},p)),Z[H(0x1b3)](H(0x1b4),{'schema':{'tags':['fcore',H(0x1aa)],'summary':H(0x1b5),'description':'Returns\x20records\x20from\x20a\x20registered\x20resource.','access':'user','permissions':['$resource:read'],'params':resourceSchemas[H(0x1aa)]}},async A=>listResources({...A['query'],...A[H(0x1ad)],'user':user(A)||p['config']?.[H(0x1b6)]?.['user']},p)),Z[H(0x1b7)](H(0x1b4),{'schema':{'tags':[H(0x1a6),'resource'],'summary':H(0x1b8),'description':'Creates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':H(0x1a3),'permissions':[H(0x1b9)],'params':resourceSchemas['resource']}},async A=>createResource({...A[H(0x1ad)],'data':A['body'],'user':user(A)||p['config']?.['auth']?.['user']},p)),Z['get']('/api/resource/:resource/:id',{'schema':{'tags':['fcore','resource'],'summary':'Get\x20resource\x20record','description':'Returns\x20one\x20record\x20from\x20a\x20registered\x20resource.','access':'user','permissions':[H(0x1a8)],'params':resourceSchemas['resourceId'],'querystring':resourceSchemas[H(0x1ba)]}},async A=>getResource({...A['query'],...A[H(0x1ad)],'user':user(A)||p['config']?.['auth']?.[H(0x1a3)]},p)),Z['put']('/api/resource/:resource/:id',{'schema':{'tags':['fcore','resource'],'summary':'Update\x20resource\x20record','description':H(0x1bb),'access':H(0x1a3),'permissions':['$resource:update'],'params':resourceSchemas[H(0x1bc)]}},async A=>updateResource({...A['params'],'patch':A[H(0x1bd)],'user':user(A)||p[H(0x1a9)]?.['auth']?.['user']},p)),Z['delete'](H(0x1be),{'schema':{'tags':['fcore',H(0x1aa)],'summary':H(0x1bf),'description':'Deletes\x20a\x20record\x20from\x20a\x20registered\x20resource.','access':H(0x1a3),'permissions':['$resource:delete'],'params':resourceSchemas['resourceId']}},async A=>deleteResource({...A['params'],'user':user(A)||p[H(0x1a9)]?.[H(0x1b6)]?.['user']},p)),Z['post']('/api/resource/:resource/:id/upload',{'schema':{'tags':[H(0x1a6),H(0x1aa)],'summary':'Upload\x20resource\x20file','description':H(0x1c0),'access':'user','permissions':[H(0x1c1)],'params':resourceSchemas[H(0x1c2)]}},async A=>{const e=H,I=await A['file']();if(!I)throw new Error('File\x20is\x20required');const j=A['params']['resource'],D=A['params']['id'];return uploadFile({'file':I,'metadata':{'name':I['filename'],'path':I[e(0x1c3)]['path']?.[e(0x1c4)],'resource':j,'resourceId':D},'user':A['user']},p);}),Z['delete']('/api/resource/:resource/:id/file/:fid',{'schema':{'tags':['fcore','resource'],'summary':'Delete\x20resource\x20file','description':H(0x1c5),'access':H(0x1a3),'permissions':['$resource:update'],'params':resourceSchemas['resourceIdFileId']}},async A=>{const g=H,{resource:I,id:j,fid:D}=A['params'],o=await p['pg']['query']('SELECT\x20file_path\x20FROM\x20admin.files\x20WHERE\x20file_id\x20=\x20$1\x20AND\x20resource\x20=\x20$2\x20AND\x20resource_id\x20=\x20$3\x20LIMIT\x201',[D,I,String(j)]);if(!o[g(0x1c6)])throw new Error('File\x20not\x20found\x20for\x20this\x20resource\x20and\x20record');const R=o['rows'][0x0]?.['file_path'],B=await p['pg']['query']('DELETE\x20FROM\x20admin.files\x20WHERE\x20file_id\x20=\x20$1\x20AND\x20resource\x20=\x20$2\x20AND\x20resource_id\x20=\x20$3',[D,I,String(j)]);return await p[g(0x1c7)][g(0x1c8)](R),{'success':(B['rowCount']??0x0)>0x0,'resource':I,'resourceId':j,'fileId':D};}),Z['get']('/api/resource/:resource/list',{'schema':{'tags':['fcore',H(0x1aa)],'summary':'List\x20resource\x20items','description':'Returns\x20resource\x20identifiers\x20and\x20display\x20text,\x20optionally\x20filtered\x20by\x20searchable\x20fields.','access':H(0x1a3),'permissions':['$resource:read'],'params':resourceSchemas['resource'],'querystring':resourceSchemas['resourceListQuery']}},async A=>listResourceList({...A['params'],...A[H(0x1a4)],'user':user(A)||p['config']?.['auth']?.['user']},p)),Z[H(0x1b3)]('/api/resource/:resource/:id/:relation',{'schema':{'tags':['fcore','resource'],'summary':'List\x20resource\x20relations','description':'Returns\x20related\x20records\x20for\x20a\x20resource\x20record.','access':H(0x1a3),'params':resourceSchemas[H(0x1c9)],'permissions':['$resource:read']}},async A=>listResourceRelation({...A[H(0x1a4)],...A['params'],'user':user(A)||p['config']?.['auth']?.['user']},p)),Z['post'](H(0x1ca),{'schema':{'tags':[H(0x1a6),'resource'],'summary':H(0x1cb),'description':'Creates\x20a\x20relation\x20for\x20a\x20resource\x20record.','access':H(0x1a3),'permissions':['$resource:create'],'params':resourceSchemas[H(0x1c9)]}},async A=>createResourceRelation({...A['params'],'data':A[H(0x1bd)],'user':user(A)||p[H(0x1a9)]?.['auth']?.[H(0x1a3)]},p)),Z[H(0x1c8)]('/api/resource/:resource/:id/:relation/:relationId',{'schema':{'tags':['fcore','resource'],'summary':'Delete\x20resource\x20relation','description':'Deletes\x20a\x20relation\x20from\x20a\x20resource\x20record.','access':'user','permissions':['$resource:delete'],'params':resourceSchemas['resourceIdRelationId']}},async A=>deleteResourceRelation({...A['params'],'user':user(A)||p[H(0x1a9)]?.['auth']?.['user']},p)),Z['put']('/api/resource/:resource/:id/:relation/:relationId',{'schema':{'tags':['fcore','resource'],'summary':'Update\x20resource\x20relation','description':H(0x1cc),'access':'user','permissions':[H(0x1c1)],'params':resourceSchemas[H(0x1cd)]}},async A=>updateResourceRelation({...A['params'],'data':A[H(0x1bd)],'user':user(A)||p[H(0x1a9)]?.['auth']?.[H(0x1a3)]},p));};}
|
|
@@ -20,6 +20,10 @@ export declare const resourceSchemas: {
|
|
|
20
20
|
resource: import("@sinclair/typebox").TObject<{
|
|
21
21
|
resource: import("@sinclair/typebox").TString;
|
|
22
22
|
}>;
|
|
23
|
+
resourceScopeTarget: import("@sinclair/typebox").TObject<{
|
|
24
|
+
resource: import("@sinclair/typebox").TString;
|
|
25
|
+
user: import("@sinclair/typebox").TString;
|
|
26
|
+
}>;
|
|
23
27
|
exportResource: import("@sinclair/typebox").TObject<{
|
|
24
28
|
resource: import("@sinclair/typebox").TString;
|
|
25
29
|
}>;
|
|
@@ -32,6 +36,15 @@ export declare const resourceSchemas: {
|
|
|
32
36
|
search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
33
37
|
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
34
38
|
}>;
|
|
39
|
+
resourceListQuery: import("@sinclair/typebox").TObject<{
|
|
40
|
+
search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
41
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
42
|
+
}>;
|
|
43
|
+
resourceCodeQuery: import("@sinclair/typebox").TObject<{
|
|
44
|
+
id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
45
|
+
field: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
46
|
+
template: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
47
|
+
}>;
|
|
35
48
|
resourceId: import("@sinclair/typebox").TObject<{
|
|
36
49
|
resource: import("@sinclair/typebox").TString;
|
|
37
50
|
id: import("@sinclair/typebox").TString;
|
|
@@ -50,6 +63,11 @@ export declare const resourceSchemas: {
|
|
|
50
63
|
relation: import("@sinclair/typebox").TString;
|
|
51
64
|
relationId: import("@sinclair/typebox").TString;
|
|
52
65
|
}>;
|
|
66
|
+
resourceIdFileId: import("@sinclair/typebox").TObject<{
|
|
67
|
+
resource: import("@sinclair/typebox").TString;
|
|
68
|
+
id: import("@sinclair/typebox").TString;
|
|
69
|
+
fid: import("@sinclair/typebox").TString;
|
|
70
|
+
}>;
|
|
53
71
|
uploadResourceFile: import("@sinclair/typebox").TObject<{
|
|
54
72
|
resource: import("@sinclair/typebox").TString;
|
|
55
73
|
id: import("@sinclair/typebox").TString;
|
|
@@ -62,6 +80,7 @@ export declare const resourceSchemas: {
|
|
|
62
80
|
filter: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
63
81
|
sort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
64
82
|
search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
83
|
+
scope: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
65
84
|
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
66
85
|
offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
67
86
|
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,aAAa;QACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;QACrC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB;CACF;AAED,eAAO,MAAM,UAAU,qCAIrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD,eAAO,MAAM,eAAe;IAC1B,cAAc;;;IACd,QAAQ;;;IACR,cAAc;;;IACd,aAAa;;;;IACb,YAAY;;;;;IAKZ,UAAU;;;;IACV,oBAAoB;;;IAGpB,kBAAkB;;;;;IAKlB,oBAAoB;;;;;;IAMpB,kBAAkB;;;;IAIlB,sBAAsB;;;;IAItB,mBAAmB
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,aAAa;QACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;QACrC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB;CACF;AAED,eAAO,MAAM,UAAU,qCAIrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD,eAAO,MAAM,eAAe;IAC1B,cAAc;;;IACd,QAAQ;;;IACR,mBAAmB;;;;IACnB,cAAc;;;IACd,aAAa;;;;IACb,YAAY;;;;;IAKZ,iBAAiB;;;;IAIjB,iBAAiB;;;;;IAKjB,UAAU;;;;IACV,oBAAoB;;;IAGpB,kBAAkB;;;;;IAKlB,oBAAoB;;;;;;IAMpB,gBAAgB;;;;;IAKhB,kBAAkB;;;;IAIlB,sBAAsB;;;;IAItB,mBAAmB;;;;;;;;;CASpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function f(p,Z){p=p-0x15b;const A=s();let I=A[p];return I;}function s(){const Z=['String','^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$','Object','Integer','Optional','Array'];s=function(){return Z;};return s();}const p=f;import{Type}from'@sinclair/typebox';export const identifier=Type[p(0x15b)]({'minLength':0x1,'maxLength':0x80,'pattern':p(0x15c)});export const resourceSchemas={'dictionaryName':Type['Object']({'name':identifier}),'resource':Type[p(0x15d)]({'resource':identifier}),'resourceScopeTarget':Type['Object']({'resource':identifier,'user':identifier}),'exportResource':Type['Object']({'resource':identifier}),'resourceField':Type['Object']({'resource':identifier,'field':identifier}),'suggestQuery':Type['Object']({'q':Type['Optional'](Type['String']()),'search':Type['Optional'](Type[p(0x15b)]()),'limit':Type['Optional'](Type[p(0x15e)]({'minimum':0x1,'maximum':0xc8}))}),'resourceListQuery':Type['Object']({'search':Type['Optional'](Type['String']()),'limit':Type['Optional'](Type['Integer']({'minimum':0x1,'maximum':0xc8}))}),'resourceCodeQuery':Type['Object']({'id':Type[p(0x15f)](Type[p(0x15b)]({'minLength':0x1,'maxLength':0x80})),'field':Type[p(0x15f)](identifier),'template':Type['Optional'](Type['String']({'maxLength':0x3e8}))}),'resourceId':Type['Object']({'resource':identifier,'id':identifier}),'resourceIncludeQuery':Type['Object']({'include':Type['Optional'](Type['String']({'minLength':0x1}))}),'resourceIdRelation':Type['Object']({'resource':identifier,'id':identifier,'relation':identifier}),'resourceIdRelationId':Type['Object']({'resource':identifier,'id':identifier,'relation':identifier,'relationId':identifier}),'resourceIdFileId':Type['Object']({'resource':identifier,'id':identifier,'fid':identifier}),'uploadResourceFile':Type[p(0x15d)]({'resource':identifier,'id':identifier}),'uploadResourceFileBody':Type['Object']({'file':Type['Any'](),'fileName':Type['String']({'minLength':0x1,'maxLength':0xff})}),'exportResourceQuery':Type[p(0x15d)]({'filter':Type['Optional'](Type['Record'](Type[p(0x15b)](),Type['Unknown']())),'sort':Type[p(0x15f)](Type['Array'](Type['String']({'minLength':0x1}))),'search':Type[p(0x15f)](Type['String']()),'scope':Type['Optional'](Type['String']()),'limit':Type[p(0x15f)](Type[p(0x15e)]({'minimum':0x1,'maximum':0xc8})),'offset':Type['Optional'](Type['Integer']({'minimum':0x0})),'fields':Type[p(0x15f)](Type[p(0x160)](identifier))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function addNote(p,Z){const A=await Z['pg']['query']('INSERT\x20INTO\x20admin.notes(resource,resource_id,body)\x20VALUES\x20($1,$2,$3)\x20RETURNING\x20*',[p['resource'],String(p['id']),p['body']]);return A['rows'][0x0];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function addResourceFile(p,Z){const I=f,A=await Z['pg'][I(0xe1)]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.files\x20(resource,\x20resource_id,\x20file_path,\x20size)\x0a\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4)\x0a\x20\x20\x20\x20\x20\x20\x20\x20RETURNING\x20*\x0a\x20\x20\x20\x20\x20\x20',[p[I(0xe2)],String(p['id']),p[I(0xe3)],p['size']??null]);return A['rows'][0x0];}function f(p,Z){p=p-0xe1;const A=s();let I=A[p];return I;}function s(){const j=['query','resource','filePath'];s=function(){return j;};return s();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function createResourceRelation(
|
|
1
|
+
function f(p,Z){p=p-0x1c8;const A=s();let I=A[p];return I;}export async function createResourceRelation(p,Z){const R=f,{resource:A,id:I,relation:j,data:D,user:o}=p;return Z[R(0x1c8)][R(0x1c9)]({'name':A,'id':I,'relation':j,'data':D,'user':o});}function s(){const B=['resource','createRelation'];s=function(){return B;};return s();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(p,Z){p=p-0xae;var A=s();var I=A[p];return I;}export async function createResource(p,Z){var A=f;return Z[A(0xae)]['create']({'name':p[A(0xae)],'data':p['data'],'user':p['user']});}function s(){var I=['resource'];s=function(){return I;};return s();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function deleteResourceRelation(
|
|
1
|
+
export async function deleteResourceRelation(p,Z){const {resource:A,id:I,relation:j,relationId:D}=p;return Z['resource']['deleteRelation']({'name':A,'id':I,'relation':j,'relationId':D});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(p,Z){p=p-0x13b;var A=s();var I=A[p];return I;}function s(){var I=['resource'];s=function(){return I;};return s();}export async function deleteResource(p,Z){var A=f;return Z['resource']['delete']({'name':p[A(0x13b)],'id':p['id'],'user':p['user']});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(p,Z){p=p-0x8e;const A=s();let I=A[p];return I;}function s(){const j=['resource','limit','offset','rows'];s=function(){return j;};return s();}import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';export async function exportResource(p,Z){const I=f,A=await Z[I(0x8e)]['find']({'name':p[I(0x8e)],'query':{'filter':parseFilterQuery(p),'sort':p['sort'],'search':p['search'],'limit':p[I(0x8f)],'offset':p[I(0x90)],'fields':p['fields']},'user':p['user']});return A[I(0x91)];}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AppContext } from "../../../context.js";
|
|
2
|
+
type CodeParams = {
|
|
3
|
+
resource: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
field?: string;
|
|
6
|
+
template?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function generateResourceCode(params: CodeParams, ctx: AppContext): Promise<{
|
|
9
|
+
resource: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
field?: string;
|
|
12
|
+
template: string | null;
|
|
13
|
+
code: string | null;
|
|
14
|
+
}>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=generate-resource-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-resource-code.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/generate-resource-code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKtD,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AA2GF,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC,CAyED"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function s(){const V=['key','column','query','SELECT\x20*\x20FROM\x20','table','where','\x20<>\x20$','length','\x20AND\x20','created_at','SELECT\x20count(*)::int\x20+\x201\x20AS\x20num,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20count(*)\x20FILTER\x20(WHERE\x20','\x20>=\x20',')::int\x20+\x201\x20AS\x20ynum,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20count(*)\x20FILTER\x20(WHERE\x20','\x20t\x20','rows','mnum','num','field','code_template','has','resource','set'];s=function(){return V;};return s();}function f(p,Z){p=p-0xfb;const A=s();let I=A[p];return I;}import{ValidationError}from'../../../errors.js';import{qi,qt}from'../../../plugins/resource/utils/sql.js';function relationValue(p,Z,A){const I=Z['fields'][A]?.['column']??A;return p[I]??p[A];}async function resolvePath(p,Z,A,I){const K=f,[j,...D]=p['split']('.');if(!j)return undefined;const o=A['relations']?.[j];if(!o||!D['length']||!o['resource'])return relationValue(Z,A,p);const R=I['resource']['get'](o['resource']),B=R[K(0xfb)];let H,e;if(o['localKey'])H=relationValue(Z,A,o['localKey']),e=B;else{if(o['foreignKey'])H=relationValue(Z,A,A['key']),e=o['foreignKey'];else return undefined;}if(H===null||H===undefined)return undefined;const g=R['fields'][e]?.[K(0xfc)]??e,N=await I['pg'][K(0xfd)](K(0xfe)+qt(R[K(0xff)])+'\x20t\x20WHERE\x20t.'+qi(g)+'\x20=\x20$1'+(o['where']?'\x20AND\x20('+o['where']+')':'')+'\x20LIMIT\x201',[H]),h=N['rows'][0x0];if(!h)return undefined;const E=D[0x0];if(!E)return undefined;if(D['length']===0x1)return relationValue(h,R,E);return resolvePath(D['join']('.'),h,R,I);}async function countValues(p,Z,A,I){const Q=f,j=[],D=p['where']?['('+p[Q(0x100)]+')']:[];Z!==undefined&&(j['push'](Z),D['push']('t.'+qi(p[Q(0xfb)])+Q(0x101)+j['length']));const o=D[Q(0x102)]?'WHERE\x20'+D['join'](Q(0x103)):'',R=p['fields'][Q(0x104)],B=R?'t.'+qi(R['column']??'created_at'):undefined,H=new Date(I['getFullYear'](),0x0,0x1),e=new Date(I['getFullYear'](),I['getMonth'](),0x1);if(B){j['push'](H,e);const h='$'+(j['length']-0x1),E='$'+j['length'],a=await A['pg']['query'](Q(0x105)+B+Q(0x106)+h+Q(0x107)+B+'\x20>=\x20'+E+')::int\x20+\x201\x20AS\x20mnum\x0a\x20\x20\x20\x20\x20\x20\x20FROM\x20'+qt(p['table'])+Q(0x108)+o,j),X=a[Q(0x109)][0x0];return{'num':Number(X?.['num']??0x1),'ynum':Number(X?.['ynum']??0x1),'mnum':Number(X?.[Q(0x10a)]??0x1)};}const g=await A['pg']['query']('SELECT\x20count(*)::int\x20+\x201\x20AS\x20num\x20FROM\x20'+qt(p['table'])+'\x20t\x20'+o,j),N=Number(g['rows'][0x0]?.[Q(0x10b)]??0x1);return{'num':N,'ynum':N,'mnum':N};}export async function generateResourceCode(p,Z){const G=f,A=Z['resource']['get'](p['resource']);if(p['field']&&!A['fields'][p['field']])throw new ValidationError('Unknown\x20resource\x20field:\x20'+p[G(0x10c)]);const I=p['template']??(p['field']?A['fields'][p['field']]?.[G(0x10d)]:undefined);if(!I)return{'resource':A['name'],...p['id']!==undefined?{'id':p['id']}:{},...p['field']?{'field':p[G(0x10c)]}:{},'template':null,'code':null};const j=new Date(),D=await countValues(A,p['id'],Z,j);let o={};if(p['id']!==undefined){const e=await Z['pg']['query'](G(0xfe)+qt(A[G(0xff)])+'\x20t\x0a\x20\x20\x20\x20\x20\x20\x20WHERE\x20t.'+qi(A['key'])+'\x20=\x20$1'+(A['where']?'\x20AND\x20('+A[G(0x100)]+')':'')+'\x0a\x20\x20\x20\x20\x20\x20\x20LIMIT\x201',[p['id']]);o=e[G(0x109)][0x0]??{};}const R=[...I['matchAll'](/\{([A-Za-z_][A-Za-z0-9_.]*)(?::(\d+))?\}/g)],B=new Map();for(const g of R){const N=g[0x1];if(!N||B[G(0x10e)](g[0x0]))continue;const h=Number(g[0x2]??0x0);let E;switch(N){case G(0x10b):E=D['num'];break;case'ynum':E=D['ynum'];break;case G(0x10a):E=D['mnum'];break;case'yyyy':E=String(j['getFullYear']());break;case'yy':E=String(j['getFullYear']())['slice'](-0x2);break;case'mm':E=String(j['getMonth']()+0x1)['padStart'](0x2,'0');break;case'dd':E=String(j['getDate']())['padStart'](0x2,'0');break;case G(0x10f):E=A['name'];break;case'resource_id':E=p['id'];break;default:E=p['id']===undefined?undefined:await resolvePath(N,o,A,Z);}if(E===null||E===undefined||E==='')throw new ValidationError('Cannot\x20resolve\x20code\x20template\x20variable:\x20{'+N+'}');const a=String(E);B[G(0x110)](g[0x0],h&&/^\d+$/['test'](a)?a['padStart'](h,'0'):a);}const H=I['replace'](/\{([A-Za-z_][A-Za-z0-9_.]*)(?::(\d+))?\}/g,X=>B['get'](X)??X);return{'resource':A['name'],...p['id']!==undefined?{'id':p['id']}:{},...p['field']?{'field':p['field']}:{},'template':I,'code':H};}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AppContext } from "../../../context.js";
|
|
2
|
+
import type { ResourceSchemaDto } from "../../../plugins/resource/resource.types.js";
|
|
3
|
+
export declare function getResourceSchema(params: {
|
|
4
|
+
resource: string;
|
|
5
|
+
}, ctx: AppContext): ResourceSchemaDto;
|
|
6
|
+
//# sourceMappingURL=get-resource-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-resource-schema.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/get-resource-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,6CAA6C,CAAC;AAyDrD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,EAC5B,GAAG,EAAE,UAAU,GACd,iBAAiB,CAOnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function f(p,Z){p=p-0xf0;const A=s();let I=A[p];return I;}function s(){const K=['geometry','string','add','name','fields','read','resource','get','type','array','title'];s=function(){return K;};return s();}function variableType(p){const E=f;switch(p){case'number':case'integer':return'number';case'boolean':return'boolean';case'json':case E(0xf0):case'geom':return'object';default:return E(0xf1);}}function buildVariables(p,Z,A='',I=new Set()){const a=f,j=new Set(I)[a(0xf2)](p[a(0xf3)]),D=[];for(const [o,R]of Object['entries'](p[a(0xf4)])){if(R[a(0xf5)]===![]||R['readable']===![])continue;D['push']({'key':o,'path':A?A+'.'+o:o,'type':variableType(R['type'])});}for(const [B,H]of Object['entries'](p['relations']??{})){if(!H['resource']||!Z[a(0xf6)]['has'](H['resource']))continue;const e=Z['resource'][a(0xf7)](H['resource']),g=A?A+'.'+B:B,N=H[a(0xf8)]==='many',h={'key':B,'path':g,'type':N?a(0xf9):'object','resource':H['resource'],'variables':j['has'](e['name'])?[]:buildVariables(e,Z,g,j)};D['push'](h);}return D;}export function getResourceSchema(p,Z){const X=f,A=Z[X(0xf6)]['get'](p['resource']);return{'resource':A['name'],...A['title']?{'title':A[X(0xfa)]}:{},'variables':buildVariables(A,Z)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function getResource(
|
|
1
|
+
function f(p,Z){p=p-0x10f;var A=s();var I=A[p];return I;}function s(){var I=['findOne','resource'];s=function(){return I;};return s();}export async function getResource(p,Z){var A=f;return Z['resource'][A(0x10f)]({'name':p[A(0x110)],'id':p['id'],'query':{'include':p['include']},'user':p['user']});}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AppContext, User } from "../../../context.js";
|
|
2
|
+
export declare function listResourceAsUser(params: {
|
|
3
|
+
resource: string;
|
|
4
|
+
user: string;
|
|
5
|
+
requester?: User;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}, ctx: AppContext): Promise<unknown>;
|
|
8
|
+
//# sourceMappingURL=list-resource-as-user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-resource-as-user.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resource-as-user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAM5D,wBAAsB,kBAAkB,CACtC,MAAM,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,OAAO,CAAC,CAyClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ForbiddenError,NotFoundError}from'../../../errors.js';import{getUserPermissions}from'../../../plugins/auth/get-user-permissions.js';function s(){const B=['query','user','User\x20not\x20found:\x20','scope','resource'];s=function(){return B;};return s();}function f(p,Z){p=p-0x15f;const A=s();let I=A[p];return I;}import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';import{getUserResourceScopes}from'../../../plugins/resource/utils/scope.js';export async function listResourceAsUser(p,Z){const R=f;if(p['requester']?.['type']!=='admin')throw new ForbiddenError('Only\x20admins\x20can\x20test\x20resource\x20scopes\x20for\x20another\x20user');const A=await Z['pg'][R(0x15f)]('SELECT\x20uid,\x20user_type\x20AS\x20type\x20FROM\x20admin.users\x20WHERE\x20uid\x20=\x20$1\x20OR\x20login\x20=\x20$1\x20LIMIT\x201',[p[R(0x160)]]),I=A['rows'][0x0];if(!I)throw new NotFoundError(R(0x161)+p['user']);const j={'id':I['uid'],'type':I['type'],'permissions':await getUserPermissions(I['uid'],Z)},[D,o]=await Promise['all']([Z['resource']['find']({'name':p['resource'],'query':{'filter':parseFilterQuery(p),'sort':p['sort'],'search':p['search'],'include':p['include'],'scope':p[R(0x162)],'limit':p['limit'],'offset':p['offset']??(p['page']?Math['max'](Number(p['page'])-0x1,0x0):0x0)*Number(p['limit']??0x14)},'user':j}),getUserResourceScopes(j['id'],p[R(0x163)],Z['pg'])]);return{...D,'scopes':o};}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AppContext } from "../../../context.js";
|
|
2
|
+
import type { ResourceUser } from "../../../plugins/resource/resource.types.js";
|
|
3
|
+
type ResourceListItem = {
|
|
4
|
+
id: unknown;
|
|
5
|
+
text: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function listResourceList(params: {
|
|
8
|
+
resource: string;
|
|
9
|
+
search?: string;
|
|
10
|
+
limit?: number;
|
|
11
|
+
user?: ResourceUser;
|
|
12
|
+
}, ctx: AppContext): Promise<{
|
|
13
|
+
search: string;
|
|
14
|
+
limit: number;
|
|
15
|
+
count: number;
|
|
16
|
+
time: number;
|
|
17
|
+
data: ResourceListItem[];
|
|
18
|
+
}>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=list-resource-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-resource-list.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resource-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAItD,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAElG,KAAK,gBAAgB,GAAG;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAkDtD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,gBAAgB,EAAE,CAAC;CAC1B,CAAC,CA2CD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function f(p,Z){p=p-0x79;const A=s();let I=A[p];return I;}import{ValidationError}from'../../../errors.js';import{assertOperation}from'../../../plugins/resource/utils/permissions.js';import{quoteIdentifier,quoteTable}from'../../../plugins/resource/utils/sql.js';function columnExpression(p,Z){const a=f;if(Z!==p['key']&&!p['fields'][Z])throw new ValidationError('Unknown\x20display/search\x20field:\x20'+Z);const A=p[a(0x79)][Z]?.[a(0x7a)]??Z;return A['split']('.')['map'](I=>quoteIdentifier(I))[a(0x7b)]('.');}function displayExpression(p){const X=f,Z=p[X(0x7c)];if(!Z||Array['isArray'](Z)&&Z[X(0x7d)]===0x0)throw new ValidationError(X(0x7e)+p['name']);if(Array['isArray'](Z))return X(0x7f)+Z[X(0x80)](D=>X(0x81)+columnExpression(p,D)+X(0x82))['join'](',\x20')+')';const A=[],I=/\{([^{}]+)\}/g;let j=0x0;for(const D of Z['matchAll'](I)){const o=D[X(0x83)]??0x0,R=D[0x1];if(!R)throw new ValidationError('Invalid\x20display\x20template\x20for\x20resource:\x20'+p['name']);o>j&&A['push']('\x27'+Z[X(0x84)](j,o)['replace'](/'/g,'\x27\x27')+'\x27'),A['push']('COALESCE('+columnExpression(p,R)+'::text,\x20\x27\x27)'),j=o+D[0x0]['length'];}j<Z['length']&&A[X(0x85)]('\x27'+Z[X(0x84)](j)['replace'](/'/g,'\x27\x27')+'\x27');if(A[X(0x7d)]===0x0)throw new ValidationError('Invalid\x20display\x20template\x20for\x20resource:\x20'+p['name']);return'concat('+A['join'](',\x20')+')';}export async function listResourceList(p,Z){const K=f,A=Date['now'](),I=Z['resource']['get'](p['resource']);assertOperation(I,K(0x86),p['user']);const j=p['search']??'',D=Math['min'](Math['max'](Number(p['limit']??0x14),0x1),0xc8),o=I['searchable']??Object['entries'](I[K(0x79)])['filter'](([,h])=>h['searchable'])[K(0x80)](([h])=>h);if(j&&o[K(0x7d)]===0x0)throw new ValidationError('Resource\x20has\x20no\x20searchable\x20fields:\x20'+I['name']);const R=displayExpression(I),B=[],H=[];if(I['where'])B[K(0x85)]('('+I['where']+')');if(j){const h=o[K(0x80)](E=>columnExpression(I,E)+K(0x87));B['push']('('+h[K(0x7b)]('\x20OR\x20')+')'),H['push']('%'+j+'%');}H[K(0x85)](D);const e=B[K(0x7d)]?'WHERE\x20'+B['join'](K(0x88)):'',g=I['joins']?.['map'](E=>E[K(0x89)])[K(0x7b)]('\x20')??'',N=await Z['pg']['query']('SELECT\x20'+quoteIdentifier(I[K(0x8a)])+'\x20AS\x20id,\x20'+R+'\x20AS\x20text\x0a\x20\x20\x20\x20\x20FROM\x20'+quoteTable(I[K(0x8b)])+'\x20t\x20'+g+K(0x8c)+e+'\x0a\x20\x20\x20\x20\x20LIMIT\x20$'+H['length'],H);return{'search':j,'limit':D,'count':N[K(0x8d)][K(0x7d)],'time':Date['now']()-A,'data':N[K(0x8d)]};}function s(){const Q=['fields','column','join','display','length','Resource\x20has\x20no\x20display\x20fields:\x20','concat_ws(\x27\x20\x27,\x20','map','COALESCE(','::text,\x20\x27\x27)','index','slice','push','read','::text\x20ILIKE\x20$1','\x20AND\x20','sql','key','table','\x0a\x20\x20\x20\x20\x20','rows'];s=function(){return Q;};return s();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function listResourceRelation(
|
|
1
|
+
export async function listResourceRelation(p,Z){const {resource:A,id:I,relation:j,query:D,user:o}=p;return Z['resource']['findRelation']({'name':A,'id':I,'relation':j,'query':D,'user':o});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-resources.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"list-resources.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAgB9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';function f(p,Z){p=p-0x13a;const A=s();let I=A[p];return I;}function s(){const j=['user','resource','sort','search','scope','offset','page','limit'];s=function(){return j;};return s();}export async function listResources(p,Z){const I=f,A=p[I(0x13a)];return Z['resource']['find']({'name':p[I(0x13b)],'query':{'filter':parseFilterQuery(p),'sort':p[I(0x13c)],'search':p[I(0x13d)],'include':p['include'],'scope':p[I(0x13e)],'limit':p['limit'],'offset':p[I(0x13f)]??(p[I(0x140)]?Math['max'](p['page']-0x1,0x0):0x0)*(p[I(0x141)]??0x14)},'user':A});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';function
|
|
1
|
+
import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';function s(){var I=['user'];s=function(){return I;};return s();}function f(p,Z){p=p-0x1cc;var A=s();var I=A[p];return I;}export async function searchResource(p,Z){var A=f;return Z['resource']['find']({'name':p['resource'],'query':{...p,'filter':parseFilterQuery(p)},'user':p[A(0x1cc)]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{ValidationError}from'../../../errors.js';function f(p,Z){p=p-0x15b;const A=s();let I=A[p];return I;}import{autoIndex}from'../../../plugins/resource/utils/auto-index.js';function s(){const X=['resource','search','min','dictionary','lookup','value','text','\x20as\x20id,\x20','\x20as\x20text\x20FROM\x20','\x20WHERE\x20lower(','then','startsWith','slice','name','length'];s=function(){return X;};return s();}export async function suggestResource(p,Z){const a=f,A=Z['resource']['get'](p[a(0x15b)]),I=String(p[a(0x15c)]??p['q']??'')['toLowerCase'](),j=Math[a(0x15d)](Math['max'](Number(p['limit']??0x14),0x1),0xc8),D=Date['now'](),o=A['fields'][p['field']],R=o?.[a(0x15e)],B=o?.[a(0x15f)]?.['table'];if(B){const g=o[a(0x15f)]?.['text']??'name',N=o['lookup']?.[a(0x160)]??'id';autoIndex(B,g,a(0x161),Z['pg']);const h=await Z['pg']['query']('SELECT\x20'+N+a(0x162)+g+a(0x163)+B+a(0x164)+g+')\x20~\x20$1\x20LIMIT\x20$2',[''+I['toLowerCase'](),j])[a(0x165)](E=>E['rows']);return{'limit':j,'count':h['length'],'search':I,'time':Date['now']()-D,'data':h};}if(!R)throw new ValidationError('Field\x20has\x20no\x20lookup\x20dictionary:\x20'+p['field']);const H=await Z['dictionary']['get'](R),e=H['filter'](E=>!I||E['code'][a(0x166)](I)||E['name']['startsWith'](I))[a(0x167)](0x0,j)['map'](E=>({'id':E['code']||E['id'],'text':E[a(0x168)]||E['text']}));return{'search':I,'limit':j,'count':e[a(0x169)],'time':Date['now']()-D,'data':e};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function updateResourceRelation(p,Z){const {resource:A,id:I,relation:j,relationId:D,data:o,user:R}=p;return Z['resource']['updateRelation']({'name':A,'id':I,'relation':j,'relationId':D,'data':o,'user':R});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function updateResource(
|
|
1
|
+
export async function updateResource(p,Z){var A=f;return Z[A(0x8e)]['update']({'name':p[A(0x8e)],'id':p['id'],'data':p[A(0x8f)],'user':p['user']});}function f(p,Z){p=p-0x8e;var A=s();var I=A[p];return I;}function s(){var I=['resource','patch'];s=function(){return I;};return s();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ForbiddenError,NotFoundError,ValidationError}from'../../../errors.js';function
|
|
1
|
+
import{ForbiddenError,NotFoundError,ValidationError}from'../../../errors.js';function f(p,Z){p=p-0x1d3;const A=s();let I=A[p];return I;}function s(){const R=['resource','type','user','permission','name','replace','File\x20name\x20is\x20required','files/'];s=function(){return R;};return s();}export async function uploadResourceFile(p,Z){const o=f,A=Z[o(0x1d3)]['get'](p[o(0x1d3)]);if(A['access']==='admin'&&p['user']?.[o(0x1d4)]!=='admin')throw new ForbiddenError('Admin\x20access\x20required');if(p[o(0x1d5)]?.['type']!=='admin'&&!p['user']?.['permissions']?.['includes']((A[o(0x1d6)]??A[o(0x1d7)])+':update'))throw new ForbiddenError('Missing\x20permission:\x20'+(A['permission']??A['name'])+':update');if(!Buffer['isBuffer'](p['file'])||p['file']['length']===0x0)throw new ValidationError('File\x20is\x20required');const I=p['fileName'][o(0x1d8)](/[^A-Za-z0-9._-]/g,'_');if(!I)throw new ValidationError(o(0x1d9));const j=o(0x1da)+p['resource']+'/'+String(p['id'])+'/'+I;await Z['file']['put'](j,p['file']);if(!await Z['file']['exists'](j))throw new NotFoundError('Uploaded\x20file\x20not\x20found');const D=await Z['pg']['query']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.files\x20(resource,\x20resource_id,\x20file_path,\x20size)\x0a\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4)\x0a\x20\x20\x20\x20\x20\x20\x20\x20RETURNING\x20*\x0a\x20\x20\x20\x20',[p['resource'],String(p['id']),j,p['file']['length']]);return D['rows'][0x0];}
|
|
@@ -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;AAiBnD,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,CAsOpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getSystemSettings}from'./services/get-system-settings.js';import{updateSystemSettings}from'./services/update-system-settings.js';import{getAuditLog}from'./services/get-audit-log.js';import{checkSystem}from'./services/check-system.js';import{getApiList}from'./services/get-api-list.js';function
|
|
1
|
+
const B=f;import{getSystemSettings}from'./services/get-system-settings.js';import{updateSystemSettings}from'./services/update-system-settings.js';import{getAuditLog}from'./services/get-audit-log.js';import{checkSystem}from'./services/check-system.js';import{getApiList}from'./services/get-api-list.js';import{getSystemLog}from'./services/get-system-log.js';function f(p,Z){p=p-0xde;const A=s();let I=A[p];return I;}import{getDictionary}from'./services/get-dictionary.js';import{updateDictionary}from'./services/update-dictionary.js';import{getAccess}from'./services/get-access.js';import{getResourceAccess}from'./services/get-resource-access.js';function s(){const g=['user','Get\x20platform\x20dictionary','dictionaryName','/api/dictionary/:name','system','Update\x20platform\x20dictionary','Replaces\x20the\x20items\x20of\x20a\x20registered\x20platform\x20dictionary.','system:dictionaries','params','/api/access/scope/:resource','fcore','Set\x20resource\x20access\x20scopes','Replaces\x20scopes\x20for\x20a\x20role,\x20optionally\x20for\x20a\x20specific\x20user.','admin','get','Get\x20user\x20access\x20for\x20a\x20resource','Returns\x20direct\x20user\x20access\x20rules\x20for\x20the\x20specified\x20resource.','Replaces\x20direct\x20user\x20access\x20rules\x20for\x20the\x20specified\x20resource.','resourceAccess','Get\x20access\x20rules','Returns\x20direct\x20and\x20role-based\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','post','Replaces\x20direct\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','system:access','system:settings','/api/system/settings','Update\x20system\x20settings','Updates\x20system\x20settings\x20using\x20flat\x20dot-notation\x20keys.','system:logs','logger','query','send','Returns\x20the\x20system\x20audit\x20log\x20entries.','system:audit','List\x20APIs'];s=function(){return g;};return s();}import{setAccess}from'./services/set-access.js';import{setResourceAccess}from'./services/set-resource-access.js';import{getResourceScopes}from'./services/get-resource-scopes.js';import{setResourceScopes}from'./services/set-resource-scopes.js';import{systemSchemas}from'./schema.js';const u=p=>p[B(0xde)];export function systemRoutes(p,Z=new Map()){return async A=>{const H=f;A['get']('/api/dictionary/:name',{'schema':{'tags':['fcore','system'],'summary':H(0xdf),'description':'Returns\x20a\x20registered\x20platform\x20dictionary\x20by\x20name.','access':'user','permissions':['system:dictionaries'],'params':systemSchemas[H(0xe0)]}},async j=>({'items':await getDictionary({...j['params'],'user':u(j)},p)})),A['post'](H(0xe1),{'schema':{'tags':['fcore',H(0xe2)],'summary':H(0xe3),'description':H(0xe4),'access':'user','permissions':[H(0xe5)],'params':systemSchemas['dictionaryName'],'body':systemSchemas['dictionaryItems']}},async j=>updateDictionary({...j['params'],...j['body'],'user':u(j)},p));const I=async j=>getAccess({...j[H(0xe6)],'user':u(j)},p);A['get'](H(0xe7),{'schema':{'tags':['fcore',H(0xe2)],'summary':'Get\x20resource\x20access\x20scopes','description':'Returns\x20user-specific\x20and\x20role-level\x20scopes\x20for\x20a\x20resource.','access':'admin','permissions':['system:access'],'params':systemSchemas['resourceScope']}},async j=>getResourceScopes(j['params'],p)),A['post']('/api/access/scope/:resource',{'schema':{'tags':[H(0xe8),'system'],'summary':H(0xe9),'description':H(0xea),'access':H(0xeb),'permissions':['system:access'],'params':systemSchemas['resourceScope'],'body':systemSchemas['resourceScopeBody']}},async j=>setResourceScopes({...j['params'],...j['body'],'user':u(j)},p)),A[H(0xec)]('/api/access/resource/:resource',{'schema':{'tags':['fcore',H(0xe2)],'summary':H(0xed),'description':H(0xee),'access':H(0xeb),'permissions':['system:access'],'params':systemSchemas['accessResourceParams']}},async j=>getResourceAccess(j['params'],p)),A['post']('/api/access/resource/:resource',{'schema':{'tags':[H(0xe8),'system'],'summary':'Set\x20user\x20access\x20for\x20a\x20resource','description':H(0xef),'access':'admin','permissions':['system:access'],'params':systemSchemas['accessResourceParams'],'body':systemSchemas[H(0xf0)]}},async j=>setResourceAccess({...j['params'],...j['body'],'user':u(j)},p)),A[H(0xec)]('/api/access/:type/:id',{'schema':{'tags':['fcore','system'],'summary':H(0xf1),'description':H(0xf2),'access':'admin','permissions':['system:access'],'params':systemSchemas['accessTarget']}},I),A[H(0xf3)]('/api/access/:type/:id',{'schema':{'tags':['fcore','system'],'summary':'Set\x20access\x20rules','description':H(0xf4),'access':'admin','permissions':[H(0xf5)],'params':systemSchemas['accessTarget'],'body':systemSchemas['access']}},async j=>setAccess({...j['params'],...j['body'],'user':u(j)},p)),A['get']('/api/system/settings',{'schema':{'tags':[H(0xe8),H(0xe2)],'summary':'Get\x20system\x20settings','description':'Returns\x20system\x20settings\x20as\x20nested\x20JSON.','access':'admin','permissions':[H(0xf6)]}},async j=>getSystemSettings({...j[H(0xe6)],'user':u(j)},p)),A['post'](H(0xf7),{'schema':{'tags':['fcore','system'],'summary':H(0xf8),'description':H(0xf9),'access':'admin','permissions':['system:settings'],'body':systemSchemas['settings']}},async j=>updateSystemSettings({...j['params'],'patch':j['body'],'user':u(j)},p)),A['get']('/api/system/logger',{'schema':{'tags':['fcore','system'],'summary':'Get\x20system\x20log','description':'Returns\x20system\x20logger\x20entries\x20for\x20the\x20requested\x20path.','access':'user','permissions':[H(0xfa)],'querystring':systemSchemas[H(0xfb)]}},async(j,D)=>{const e=H,{contentType:o,body:R}=await getSystemLog({...j[e(0xfc)],'user':u(j)},p);return D['type'](o)[e(0xfd)](R);}),A[H(0xec)]('/api/system/audit',{'schema':{'tags':['fcore','system'],'summary':'Get\x20audit\x20log','description':H(0xfe),'access':'user','permissions':[H(0xff)]}},async j=>getAuditLog({...j['query'],'user':u(j)},p)),A[H(0xec)]('/api/system/check',{'schema':{'tags':['fcore','system'],'summary':'Check\x20system\x20health','description':'Checks\x20the\x20availability\x20of\x20system\x20dependencies.','access':'user','permissions':['system:check']}},async j=>checkSystem({'user':u(j)},p)),A['get']('/api/system/list',{'schema':{'tags':['fcore','system'],'summary':H(0x100),'description':'Returns\x20the\x20list\x20of\x20registered\x20platform\x20APIs.','access':H(0xeb),'permissions':[],'querystring':systemSchemas['apiListQuery']}},async j=>getApiList({'user':u(j),'apiRoutes':Z,...j['query']},p));};}
|
|
@@ -15,11 +15,34 @@ export declare const systemSchemas: {
|
|
|
15
15
|
type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"user">, import("@sinclair/typebox").TLiteral<"role">]>;
|
|
16
16
|
id: import("@sinclair/typebox").TString;
|
|
17
17
|
}>;
|
|
18
|
+
accessResourceParams: import("@sinclair/typebox").TObject<{
|
|
19
|
+
resource: import("@sinclair/typebox").TString;
|
|
20
|
+
}>;
|
|
21
|
+
resourceScope: import("@sinclair/typebox").TObject<{
|
|
22
|
+
resource: import("@sinclair/typebox").TString;
|
|
23
|
+
}>;
|
|
24
|
+
resourceScopeBody: import("@sinclair/typebox").TObject<{
|
|
25
|
+
user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
26
|
+
role_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
27
|
+
scopes: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnknown>, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>>;
|
|
28
|
+
}>;
|
|
29
|
+
resourceAccess: import("@sinclair/typebox").TObject<{
|
|
30
|
+
users: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
31
|
+
uid: import("@sinclair/typebox").TString;
|
|
32
|
+
actions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
33
|
+
}>>>;
|
|
34
|
+
roles: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
35
|
+
role_id: import("@sinclair/typebox").TString;
|
|
36
|
+
actions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
37
|
+
}>>>;
|
|
38
|
+
}>;
|
|
18
39
|
access: import("@sinclair/typebox").TObject<{
|
|
19
|
-
|
|
40
|
+
roles: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
41
|
+
permissions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
42
|
+
access: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
20
43
|
resource: import("@sinclair/typebox").TString;
|
|
21
44
|
actions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
22
|
-
}
|
|
45
|
+
}>>>;
|
|
23
46
|
}>;
|
|
24
47
|
apiListQuery: import("@sinclair/typebox").TObject<{
|
|
25
48
|
format: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"short">, import("@sinclair/typebox").TLiteral<"extended">]>>;
|
|
@@ -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,eAAe;;;;;;;;IAef,YAAY;;;;IAIZ,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,oBAAoB;;;IAGpB,aAAa;;;IAGb,iBAAiB;;;;;IAcjB,cAAc;;;;;;;;;;IAcd,MAAM;;;;;;;;IAcN,YAAY;;;IAGZ,cAAc;;;IACd,QAAQ;IACR,MAAM;;;CAKP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const p=f;import{Type}from'@sinclair/typebox';export const identifier=Type[p(0x1a0)]({'minLength':0x1,'maxLength':0x80,'pattern':'^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$'});function f(p,Z){p=p-0x1a0;const A=s();let I=A[p];return I;}function s(){const Z=['String','Object','Number','Union','Literal','user','role','Optional','Array','Unknown','^[A-Za-z0-9_.\x5c-/]*$'];s=function(){return Z;};return s();}export const systemSchemas={'dictionaryName':Type['Object']({'name':identifier}),'dictionaryItems':Type['Object']({'items':Type['Array'](Type[p(0x1a1)]({'id':Type['Optional'](Type['Union']([Type[p(0x1a0)](),Type[p(0x1a2)]()])),'code':Type[p(0x1a0)]({'minLength':0x1}),'name':Type['String']({'minLength':0x1}),'parentId':Type['Optional'](Type['Union']([Type['String'](),Type['Number'](),Type['Null']()]))},{'additionalProperties':!![]}))}),'accessTarget':Type['Object']({'type':Type[p(0x1a3)]([Type[p(0x1a4)](p(0x1a5)),Type['Literal'](p(0x1a6))]),'id':identifier}),'accessResourceParams':Type['Object']({'resource':identifier}),'resourceScope':Type['Object']({'resource':identifier}),'resourceScopeBody':Type['Object']({'user_id':Type['Optional'](identifier),'role_id':Type['Optional'](identifier),'scopes':Type['Record'](identifier,Type[p(0x1a3)]([Type['Array'](Type['Unknown']()),Type['String'](),Type[p(0x1a2)](),Type['Boolean'](),Type['Null']()]))}),'resourceAccess':Type['Object']({'users':Type[p(0x1a7)](Type['Array'](Type['Object']({'uid':identifier,'actions':Type['Array'](Type[p(0x1a0)]({'minLength':0x1,'maxLength':0x80}))}))),'roles':Type['Optional'](Type[p(0x1a8)](Type['Object']({'role_id':identifier,'actions':Type['Array'](Type[p(0x1a0)]({'minLength':0x1,'maxLength':0x80}))})))},{'minProperties':0x1}),'access':Type['Object']({'roles':Type['Optional'](Type[p(0x1a8)](identifier)),'permissions':Type['Optional'](Type['Array'](Type['String']({'minLength':0x1,'maxLength':0x80,'pattern':'^[A-Za-z0-9_-]+(?::[A-Za-z0-9_-]+)?$'}))),'access':Type['Optional'](Type['Array'](Type['Object']({'resource':Type['String']({'minLength':0x1,'maxLength':0x80}),'actions':Type['Array'](Type['String']({'minLength':0x1,'maxLength':0x80}),{'minItems':0x1})})))}),'apiListQuery':Type['Object']({'format':Type['Optional'](Type[p(0x1a3)]([Type[p(0x1a4)]('short'),Type['Literal']('extended')]))}),'settingsEntity':Type['Object']({'entity':Type['Optional'](identifier)}),'settings':Type['Record'](Type[p(0x1a0)]({'minLength':0x1}),Type[p(0x1a9)]()),'logger':Type[p(0x1a1)]({'path':Type['Optional'](Type['String']({'maxLength':0x100,'pattern':p(0x1aa)}))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(p,Z){p=p-0x1c6;const A=s();let I=A[p];return I;}export async function checkSystem(p,Z){const j=f,[A,I]=await Promise['allSettled']([Z['pg']['query']('SELECT\x201'),Z[j(0x1c6)][j(0x1c7)]()]);return{'status':A['status']==='fulfilled'&&I['status']==='fulfilled'?'ok':'degraded','pg':A['status'],'redis':I['status']};}function s(){const D=['redis','ping'];s=function(){return D;};return s();}
|
|
@@ -1 +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,
|
|
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,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAwB1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(p,Z){p=p-0x1a0;const A=s();let I=A[p];return I;}export async function getAccess(p,Z){const o=f,A=p['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',I=await Z['pg']['query'](A,[p['id']]),j=[...new Set(I['rows'][o(0x1a0)](D=>D['resource'])[o(0x1a1)](D=>D!==null))];return{'access':I['rows'],'resources':j};}function s(){const R=['map','filter'];s=function(){return R;};return s();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(p,Z){p=p-0x66;const A=s();let I=A[p];return I;}export async function getApiList(p,Z){const R=f,A=[...p[R(0x66)][R(0x67)]()][R(0x68)]((I,j)=>(I['endpoint']+'\x20'+I[R(0x69)])['localeCompare'](j['endpoint']+'\x20'+j['method']));if(p['format']!=='short')return A;return A['map'](({method:I,endpoint:j,access:D,permissions:o})=>I+'\x20'+j);}function s(){const B=['apiRoutes','values','sort','method'];s=function(){return B;};return s();}
|
|
@@ -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;
|
|
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;AAG5D,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,CAmBd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function getAuditLog(
|
|
1
|
+
export async function getAuditLog(p,Z){const D=f,A=Math[D(0xd7)](Math[D(0xd8)](p['limit']??0x32,0x1),0xc8),I=Math['max']((p['page']??0x1)-0x1,0x0)*A,j=await Z['pg']['query']('SELECT\x0a\x20\x20\x20\x20\x20\x20l.*,\x0a\x20\x20\x20\x20\x20\x20case\x20when\x20u.first_name\x20is\x20not\x20null\x20then\x20coalesce(u.last_name,\x27\x27)||coalesce(\x27\x20\x27||u.first_name,\x27\x27)\x20else\x20coalesce(u.login,\x20u.email,\x27\x27)\x20end\x20as\x20user_id_text\x0a\x20\x20\x20\x20FROM\x20admin.audit_log\x20l\x0a\x20\x20\x20\x20JOIN\x20admin.users\x20u\x20ON\x20l.user_id=u.uid\x0a\x20\x20\x20\x20ORDER\x20BY\x20id\x20DESC\x20LIMIT\x20$1\x20OFFSET\x20$2',[A,I]);return{'rows':j['rows'],'page':p['page']??0x1,'limit':A};}function f(p,Z){p=p-0xd7;const A=s();let I=A[p];return I;}function s(){const o=['min','max'];s=function(){return o;};return s();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function getDictionary(p,Z){return Z['dictionary']['get'](p['name']);}
|