@opengis/fcore 0.0.1-beta.6 → 0.0.1-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.js +1 -1
- package/dist/context.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/fastify.d.ts +2 -1
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fcore.js +1 -1
- package/dist/migrations/cli.js +1 -1
- package/dist/migrations/runner.js +1 -1
- package/dist/modules/auth/adduser-cli.js +1 -1
- package/dist/modules/auth/passwd-cli.js +1 -1
- package/dist/modules/auth/permission-cli.js +1 -1
- package/dist/modules/auth/route.d.ts.map +1 -1
- package/dist/modules/auth/route.js +1 -1
- package/dist/modules/auth/schema.d.ts +3 -0
- 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.js +1 -1
- 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.js +1 -1
- 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.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.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 +2 -0
- 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.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.map +1 -1
- package/dist/modules/system/route.js +1 -1
- package/dist/modules/system/schema.js +1 -1
- package/dist/modules/system/services/check-system.d.ts.map +1 -1
- package/dist/modules/system/services/check-system.js +1 -1
- 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.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.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.map +1 -1
- package/dist/modules/system/services/set-access.js +1 -1
- package/dist/modules/system/services/update-dictionary.d.ts.map +1 -1
- package/dist/modules/system/services/update-dictionary.js +1 -1
- 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/services/write-audit.js +1 -1
- package/dist/plugins/auth/get-user-permissions.js +1 -1
- package/dist/plugins/auth/index.js +1 -1
- package/dist/plugins/auth/verifyUser.js +1 -1
- package/dist/plugins/dictionary.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 +1 -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.js +1 -1
- 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/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 +18 -3
- 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.js +1 -1
- 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.js +1 -1
- 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 +3 -2
- 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/update-relation.d.ts +11 -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.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.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.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/migrations/20260905120000_add_user_foreign_keys.sql +42 -42
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function deleteResourceRelation(C,N){const m=z,{resource:r,id:p,relation:c,relationId:x}=C;return N['resource'][m(0x144)]({'name':r,'id':p,'relation':c,'relationId':x});}function z(C,N){C=C-0x144;const r=U();let p=r[C];return p;}function U(){const Q=['deleteRelation'];U=function(){return Q;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function deleteResource(
|
|
1
|
+
export async function deleteResource(C,N){var r=z;return N['resource']['delete']({'name':C['resource'],'id':C['id'],'user':C[r(0x12e)]});}function z(C,N){C=C-0x12e;var r=U();var p=r[C];return p;}function U(){var p=['user'];U=function(){return p;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/export-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"export-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/export-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,wBAAsB,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAcrG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function z(C,N){C=C-0x1e1;const r=U();let p=r[C];return p;}import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';function U(){const c=['find','sort','limit'];U=function(){return c;};return U();}export async function exportResource(C,N){const p=z,r=await N['resource'][p(0x1e1)]({'name':C['resource'],'query':{'filter':parseFilterQuery(C),'sort':C[p(0x1e2)],'search':C['search'],'limit':C[p(0x1e3)],'offset':C['offset'],'fields':C['fields']},'user':C['user']});return r['rows'];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/get-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,wBAAsB,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"get-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/get-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,wBAAsB,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAO5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function U(){var p=['resource','findOne','include'];U=function(){return p;};return U();}function z(C,N){C=C-0xa4;var r=U();var p=r[C];return p;}export async function getResource(C,N){var r=z;return N[r(0xa4)][r(0xa5)]({'name':C['resource'],'id':C['id'],'query':{'include':C[r(0xa6)]},'user':C['user']});}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
* Implements the list resource relation application service for its module.
|
|
3
3
|
*/
|
|
4
4
|
import type { AppContext, User } from '../../../context.js';
|
|
5
|
+
import type { ResourceQuery } from '../../../plugins/resource/resource.types.js';
|
|
5
6
|
export declare function listResourceRelation(params: {
|
|
6
7
|
resource: string;
|
|
7
8
|
id: string;
|
|
8
9
|
relation: string;
|
|
10
|
+
query?: ResourceQuery;
|
|
9
11
|
user?: User;
|
|
10
12
|
}, ctx: AppContext): Promise<any>;
|
|
11
13
|
//# sourceMappingURL=list-resource-relation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"list-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF,wBAAsB,oBAAoB,CACxC,MAAM,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function listResourceRelation(
|
|
1
|
+
export async function listResourceRelation(C,N){const {resource:r,id:p,relation:c,query:x,user:m}=C;return N['resource']['findRelation']({'name':r,'id':p,'relation':c,'query':x,'user':m});}
|
|
@@ -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;
|
|
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,CAY9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';function z(C,N){C=C-0x1d5;var r=U();var p=r[C];return p;}function U(){var p=['resource','offset','page','limit'];U=function(){return p;};return U();}export async function listResources(C,N){var r=z;return N['resource']['find']({'name':C[r(0x1d5)],'query':{'filter':parseFilterQuery(C),'sort':C['sort'],'search':C['search'],'limit':C['limit'],'offset':C[r(0x1d6)]??(C['page']?Math['max'](C[r(0x1d7)]-0x1,0x0):0x0)*(C[r(0x1d8)]??0x14)},'user':C['user']});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/search-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"search-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/search-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAE/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function searchResource(
|
|
1
|
+
import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';function z(C,N){C=C-0x121;var r=U();var p=r[C];return p;}function U(){var p=['user'];U=function(){return p;};return U();}export async function searchResource(C,N){var r=z;return N['resource']['find']({'name':C['resource'],'query':{...C,'filter':parseFilterQuery(C)},'user':C[r(0x121)]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/suggest-resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"suggest-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/suggest-resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,KAAK,qBAAqB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAElB,CAAC;AAEF,wBAAsB,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA4ClG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ValidationError}from'../../../errors.js';function
|
|
1
|
+
import{ValidationError}from'../../../errors.js';function U(){const D=['resource','toLowerCase','min','max','fields','lookup','query','SELECT\x20','now','field','name','startsWith','map','code','text'];U=function(){return D;};return U();}import{autoIndex}from'../../../plugins/resource/utils/auto-index.js';function z(C,N){C=C-0x11f;const r=U();let p=r[C];return p;}export async function suggestResource(C,N){const h=z,r=N[h(0x11f)]['get'](C['resource']),p=String(C['search']??C['q']??'')[h(0x120)](),c=Math[h(0x121)](Math[h(0x122)](Number(C['limit']??0x14),0x1),0xc8),x=Date['now'](),m=r[h(0x123)][C['field']],Q=m?.[h(0x124)]?.['dictionary'],u=m?.['lookup']?.['table'];if(u){const Y=m[h(0x124)]?.['textField']??'name',f=m['lookup']?.['valueField']??'id';autoIndex(u,Y,'text',N['pg']);const F=await N['pg'][h(0x125)](h(0x126)+f+'\x20as\x20id,\x20'+Y+'\x20as\x20text\x20FROM\x20'+u+'\x20WHERE\x20lower('+Y+')\x20~\x20$1\x20LIMIT\x20$2',[''+p[h(0x120)](),c])['then'](t=>t['rows']);return{'limit':c,'count':F['length'],'search':p,'time':Date[h(0x127)]()-x,'data':F};}if(!Q)throw new ValidationError('Field\x20has\x20no\x20lookup\x20dictionary:\x20'+C[h(0x128)]);const L=await N['dictionary']['get'](Q),T=L['filter'](t=>!p||t['code']['startsWith'](p)||t[h(0x129)][h(0x12a)](p))['slice'](0x0,c)[h(0x12b)](t=>({'id':t[h(0x12c)]||t['id'],'text':t['name']||t[h(0x12d)]}));return{'search':p,'limit':c,'count':T['length'],'time':Date['now']()-x,'data':T};}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AppContext, User } from "../../../context.js";
|
|
2
|
+
export declare function updateResourceRelation(params: {
|
|
3
|
+
resource: string;
|
|
4
|
+
id: string;
|
|
5
|
+
relation: string;
|
|
6
|
+
relationId: string;
|
|
7
|
+
data: Record<string, unknown>;
|
|
8
|
+
user?: User;
|
|
9
|
+
}, ctx: AppContext): Promise<Record<string, unknown>>;
|
|
10
|
+
//# sourceMappingURL=update-resource-relation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/update-resource-relation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,sBAAsB,CACxC,MAAM,EAAE;IACJ,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,IAAI,CAAC;CACf,EACD,GAAG,EAAE,UAAU,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAUlC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export async function updateResourceRelation(C,N){const {resource:r,id:p,relation:c,relationId:x,data:m,user:Q}=C;return N['resource']['updateRelation']({'name':r,'id':p,'relation':c,'relationId':x,'data':m,'user':Q});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function updateResource(
|
|
1
|
+
function U(){var p=['resource','user'];U=function(){return p;};return U();}function z(C,N){C=C-0x1a8;var r=U();var p=r[C];return p;}export async function updateResource(C,N){var r=z;return N[r(0x1a8)]['update']({'name':C['resource'],'id':C['id'],'data':C['patch'],'user':C[r(0x1a9)]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ForbiddenError,NotFoundError,ValidationError}from'../../../errors.js';export async function uploadResourceFile(
|
|
1
|
+
import{ForbiddenError,NotFoundError,ValidationError}from'../../../errors.js';export async function uploadResourceFile(C,N){const m=z,r=N[m(0x1bf)][m(0x1c0)](C['resource']);if(r['access']==='admin'&&C['user']?.['type']!=='admin')throw new ForbiddenError(m(0x1c1));if(C['user']?.[m(0x1c2)]!=='admin'&&!C[m(0x1c3)]?.['permissions']?.[m(0x1c4)]((r[m(0x1c5)]??r['name'])+m(0x1c6)))throw new ForbiddenError('Missing\x20permission:\x20'+(r['permission']??r[m(0x1c7)])+':update');if(!Buffer[m(0x1c8)](C['file'])||C['file']['length']===0x0)throw new ValidationError('File\x20is\x20required');const p=C[m(0x1c9)][m(0x1ca)](/[^A-Za-z0-9._-]/g,'_');if(!p)throw new ValidationError('File\x20name\x20is\x20required');const c='files/'+C[m(0x1bf)]+'/'+String(C['id'])+'/'+p;await N[m(0x1cb)]['put'](c,C[m(0x1cb)]);if(!await N['file']['exists'](c))throw new NotFoundError('Uploaded\x20file\x20not\x20found');const x=await N['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',[C['resource'],String(C['id']),c,C['file']['length']]);return x['rows'][0x0];}function z(C,N){C=C-0x1bf;const r=U();let p=r[C];return p;}function U(){const Q=['resource','get','Admin\x20access\x20required','type','user','includes','permission',':update','name','isBuffer','fileName','replace','file'];U=function(){return Q;};return U();}
|
|
@@ -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;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,
|
|
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
|
-
import{getSystemSettings}from'./services/get-system-settings.js';import{updateSystemSettings}from'./services/update-system-settings.js';import{getAuditLog}from'./services/get-audit-log.js';function
|
|
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';import{getSystemLog}from'./services/get-system-log.js';function z(C,N){C=C-0x181;const r=U();let p=r[C];return p;}import{getDictionary}from'./services/get-dictionary.js';import{updateDictionary}from'./services/update-dictionary.js';import{getAccess}from'./services/get-access.js';import{setAccess}from'./services/set-access.js';import{systemSchemas}from'./schema.js';function U(){const Y=['system','Get\x20platform\x20dictionary','user','system:dictionaries','dictionaryName','params','Replaces\x20direct\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','admin','get','/api/system/settings','Get\x20system\x20log','logger','type','/api/system/check','fcore','apiListQuery'];U=function(){return Y;};return U();}const u=C=>C['user'];export function systemRoutes(C,N=new Map()){return async r=>{const L=z;r['get']('/api/dictionary/:name',{'schema':{'tags':['fcore',L(0x181)],'summary':L(0x182),'description':'Returns\x20a\x20registered\x20platform\x20dictionary\x20by\x20name.','access':'user','permissions':['system:dictionaries'],'params':systemSchemas['dictionaryName']}},async c=>({'items':await getDictionary({...c['params'],'user':u(c)},C)})),r['post']('/api/dictionary/:name',{'schema':{'tags':['fcore',L(0x181)],'summary':'Update\x20platform\x20dictionary','description':'Replaces\x20the\x20items\x20of\x20a\x20registered\x20platform\x20dictionary.','access':L(0x183),'permissions':[L(0x184)],'params':systemSchemas[L(0x185)],'body':systemSchemas['dictionaryItems']}},async c=>updateDictionary({...c[L(0x186)],...c['body'],'user':u(c)},C));const p=async c=>getAccess({...c['params'],'user':u(c)},C);r['get']('/api/access/:type/:id',{'schema':{'tags':['fcore','system'],'summary':'Get\x20access\x20rules','description':'Returns\x20direct\x20and\x20role-based\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','access':'admin','permissions':['system:access'],'params':systemSchemas['accessTarget']}},p),r['post']('/api/access/:type/:id',{'schema':{'tags':['fcore','system'],'summary':'Set\x20access\x20rules','description':L(0x187),'access':L(0x188),'permissions':['system:access'],'params':systemSchemas['accessTarget'],'body':systemSchemas['access']}},async c=>setAccess({...c['params'],...c['body'],'user':u(c)},C)),r[L(0x189)](L(0x18a),{'schema':{'tags':['fcore','system'],'summary':'Get\x20system\x20settings','description':'Returns\x20system\x20settings\x20as\x20nested\x20JSON.','access':'admin','permissions':['system:settings']}},async c=>getSystemSettings({...c['params'],'user':u(c)},C)),r['post']('/api/system/settings',{'schema':{'tags':['fcore','system'],'summary':'Update\x20system\x20settings','description':'Updates\x20system\x20settings\x20using\x20flat\x20dot-notation\x20keys.','access':'admin','permissions':['system:settings'],'body':systemSchemas['settings']}},async c=>updateSystemSettings({...c['params'],'patch':c['body'],'user':u(c)},C)),r[L(0x189)]('/api/system/logger',{'schema':{'tags':['fcore','system'],'summary':L(0x18b),'description':'Returns\x20system\x20logger\x20entries\x20for\x20the\x20requested\x20path.','access':L(0x183),'permissions':['system:logs'],'querystring':systemSchemas[L(0x18c)]}},async(c,x)=>{const T=L,{contentType:m,body:Q}=await getSystemLog({...c['query'],'user':u(c)},C);return x[T(0x18d)](m)['send'](Q);}),r[L(0x189)]('/api/system/audit',{'schema':{'tags':['fcore','system'],'summary':'Get\x20audit\x20log','description':'Returns\x20the\x20system\x20audit\x20log\x20entries.','access':L(0x183),'permissions':['system:audit']}},async c=>getAuditLog({...c['query'],'user':u(c)},C)),r['get'](L(0x18e),{'schema':{'tags':['fcore','system'],'summary':'Check\x20system\x20health','description':'Checks\x20the\x20availability\x20of\x20system\x20dependencies.','access':L(0x183),'permissions':['system:check']}},async c=>checkSystem({'user':u(c)},C)),r[L(0x189)]('/api/system/list',{'schema':{'tags':[L(0x18f),'system'],'summary':'List\x20APIs','description':'Returns\x20the\x20list\x20of\x20registered\x20platform\x20APIs.','access':L(0x188),'permissions':[],'querystring':systemSchemas[L(0x190)]}},async c=>getApiList({'user':u(c),'apiRoutes':N,...c['query']},C));};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const C=z;function U(){const N=['Object','Array','Union','Null','Literal','short'];U=function(){return N;};return U();}function z(C,N){C=C-0x7e;const r=U();let p=r[C];return p;}import{Type}from'@sinclair/typebox';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['Object']({'name':identifier}),'dictionaryItems':Type[C(0x7e)]({'items':Type[C(0x7f)](Type['Object']({'id':Type['Optional'](Type[C(0x80)]([Type['String'](),Type['Number']()])),'code':Type['String']({'minLength':0x1}),'name':Type['String']({'minLength':0x1}),'parentId':Type['Optional'](Type['Union']([Type['String'](),Type['Number'](),Type[C(0x81)]()]))},{'additionalProperties':!![]}))}),'accessTarget':Type[C(0x7e)]({'type':Type[C(0x80)]([Type['Literal']('user'),Type[C(0x82)]('role')]),'id':identifier}),'access':Type['Object']({'access':Type[C(0x7f)](Type['Object']({'resource':Type['String']({'minLength':0x1,'maxLength':0x80}),'actions':Type[C(0x7f)](Type['String']({'minLength':0x1,'maxLength':0x80}),{'minItems':0x1})}))}),'apiListQuery':Type[C(0x7e)]({'format':Type['Optional'](Type['Union']([Type['Literal'](C(0x83)),Type[C(0x82)]('extended')]))}),'settingsEntity':Type['Object']({'entity':Type['Optional'](identifier)}),'settings':Type['Record'](Type['String']({'minLength':0x1}),Type['Unknown']()),'logger':Type[C(0x7e)]({'path':Type['Optional'](Type['String']({'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 z(C,N){C=C-0x199;const r=U();let p=r[C];return p;}export async function checkSystem(C,N){const c=z,[r,p]=await Promise['allSettled']([N['pg']['query']('SELECT\x201'),N['redis'][c(0x199)]()]);return{'status':r[c(0x19a)]==='fulfilled'&&p['status']===c(0x19b)?'ok':c(0x19c),'pg':r['status'],'redis':p['status']};}function U(){const x=['ping','status','fulfilled','degraded'];U=function(){return x;};return U();}
|
|
@@ -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;
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function getAccess(C,N){const c=z,r=C['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',p=await N['pg'][c(0x118)](r,[C['id']]);return{'access':p[c(0x119)]};}function z(C,N){C=C-0x118;const r=U();let p=r[C];return p;}function U(){const x=['query','rows'];U=function(){return x;};return U();}
|
|
@@ -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;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,
|
|
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 U(){const u=['values','endpoint','method','format'];U=function(){return u;};return U();}function z(C,N){C=C-0x140;const r=U();let p=r[C];return p;}export async function getApiList(C,N){const Q=z,r=[...C['apiRoutes'][Q(0x140)]()]['sort']((p,c)=>(p[Q(0x141)]+'\x20'+p['method'])['localeCompare'](c[Q(0x141)]+'\x20'+c[Q(0x142)]));if(C[Q(0x143)]!=='short')return r;return r['map'](({method:p,endpoint:c,access:x,permissions:m})=>p+'\x20'+c);}
|
|
@@ -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
|
-
function
|
|
1
|
+
function z(C,N){C=C-0x103;const r=U();let p=r[C];return p;}export async function getAuditLog(C,N){const m=z,p=Math['min'](Math['max'](C['limit']??0x32,0x1),0xc8),c=Math['max']((C['page']??0x1)-0x1,0x0)*p,x=await N['pg']['query']('SELECT\x20*\x20FROM\x20admin.audit_log\x20ORDER\x20BY\x20id\x20DESC\x20LIMIT\x20$1\x20OFFSET\x20$2',[p,c]);return{'rows':x['rows'],'page':C[m(0x103)]??0x1,'limit':p};}function U(){const Q=['page'];U=function(){return Q;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function getDictionary(
|
|
1
|
+
export async function getDictionary(C,N){return N['dictionary']['get'](C['name']);}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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
|
-
import
|
|
1
|
+
const t=z;import C from'node:fs/promises';function z(C,N){C=C-0x8e;const r=U();let p=r[C];return p;}import N from'node:path';import{NotFoundError,ValidationError}from'../../../errors.js';function U(){const a=['resolve','sep','stat','join','name','file','size','sort','directory','path','type','</a></li>','<!DOCTYPE\x20html>\x0a<html>\x0a<head><meta\x20charset=\x22utf-8\x22><title>','replace','"','split','Invalid\x20log\x20path','filter','slice','reverse'];U=function(){return a;};return U();}const LOGS_ROOT=N[t(0x8e)](process['cwd'](),'logs'),TAIL_LINES=0x64;export async function getSystemLog(r,p){const h=t,c=normalizePath(r['path']),x=N['resolve'](LOGS_ROOT,c);if(x!==LOGS_ROOT&&!x['startsWith'](LOGS_ROOT+N[h(0x8f)]))throw new ValidationError('Invalid\x20log\x20path');const m=await C[h(0x90)](x)['catch'](()=>null);if(!m)throw new NotFoundError('Log\x20path\x20not\x20found');if(m['isDirectory']()){const u=await C['readdir'](x,{'withFileTypes':!![]}),L=await Promise['all'](u['map'](async T=>{const D=h,Y=await C['stat'](N[D(0x91)](x,T['name']));return{'name':T['name'],'path':c?c+'/'+T['name']:T[D(0x92)],'type':T['isDirectory']()?'directory':D(0x93),'size':T['isDirectory']()?undefined:Y[D(0x94)],'modified':Y['mtime']['toISOString']()};}));L[h(0x95)]((T,Y)=>T['name']['localeCompare'](Y['name']));if(c){const T=c['split']('/')['slice'](0x0,-0x1)['join']('/');L['unshift']({'name':'..','path':T,'type':h(0x96)});}return{'contentType':'text/html;\x20charset=utf-8','body':renderDirectory(c,L)};}const Q=await tailFile(x,TAIL_LINES);return{'contentType':'text/plain;\x20charset=utf-8','body':Q['join']('\x0a')};}function renderDirectory(r,p){const V=t,c=p['map'](m=>{const d=z,Q='?path='+encodeURIComponent(m[d(0x97)]),u=m[d(0x98)]==='directory'?m[d(0x92)]+'/':m['name'];return'<li><a\x20href=\x22'+Q+'\x22>'+escapeHtml(u)+d(0x99);})['join']('\x0a'),x=escapeHtml('logs/'+r);return V(0x9a)+x+'</title></head>\x0a<body>\x0a<h1>'+x+'</h1>\x0a<ul>\x0a'+c+'\x0a</ul>\x0a</body>\x0a</html>';}function escapeHtml(r){const q=t;return r[q(0x9b)](/&/g,'&')[q(0x9b)](/</g,'<')['replace'](/>/g,'>')[q(0x9b)](/"/g,q(0x9c));}function normalizePath(r){const w=t,p=(r??'')['replace'](/\\/g,'/')['replace'](/^\/+|\/+$/g,'');if(p[w(0x9d)]('/')['some'](c=>c==='..'))throw new ValidationError(w(0x9e));return p;}async function tailFile(r,p){const O=t,c=await C['open'](r,'r');try{const {size:x}=await c[O(0x90)](),m=0x40*0x400;let Q=x,u=Buffer['alloc'](0x0),L=0x0;while(Q>0x0&&L<=p){const Y=Math['min'](m,Q);Q-=Y;const f=Buffer['alloc'](Y);await c['read'](f,0x0,Y,Q),u=Buffer['concat']([f,u]),L+=countNewlines(f);}const T=u['toString']('utf8')['split']('\x0a')[O(0x9f)](F=>F['length']>0x0);return T[O(0xa0)](-p)[O(0xa1)]();}finally{await c['close']();}}function countNewlines(r){let p=0x0;for(const c of r){if(c===0xa)p++;}return p;}
|
|
@@ -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
|
+
function U(){const L=['reduce'];U=function(){return L;};return U();}function z(C,N){C=C-0x174;const r=U();let p=r[C];return p;}export async function getSystemSettings(C,N){const u=z,r=await N['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 r['rows'][u(0x174)]((p,c)=>{const x=String(c['key'])['split']('.');let m=p;for(const Q of x['slice'](0x0,-0x1)){m[Q]??={},m=m[Q];}return m[x['at'](-0x1)]=c['value'],p;},{});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function listDictionaries(
|
|
1
|
+
function z(C,N){C=C-0x1c0;var r=U();var p=r[C];return p;}export async function listDictionaries(C,N){var r=z;return N[r(0x1c0)]['list']();}function U(){var p=['dictionary'];U=function(){return p;};return U();}
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getAccess}from'./get-access.js';function z(C,N){C=C-0x1d4;const r=U();let p=r[C];return p;}export async function setAccess(C,N){const x=z,r=await N['pg']['connect']();try{await r['query']('BEGIN');C[x(0x1d4)]==='user'?await r[x(0x1d5)](x(0x1d6),[C['id']]):await r['query']('DELETE\x20FROM\x20admin.role_access\x20WHERE\x20role_id\x20=\x20$1\x20AND\x20user_uid\x20IS\x20NULL',[C['id']]);for(const p of C['access']){C['type']===x(0x1d7)?await r[x(0x1d5)]('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)',[p[x(0x1d8)],p['actions'],C['id'],C['user']['id'],C[x(0x1d7)]['id']]):await r[x(0x1d5)](x(0x1d9),[p['resource'],p['actions'],C['id'],C['user']['id'],C['user']['id']]);}await r['query']('COMMIT');}catch(c){await r['query']('ROLLBACK');throw c;}finally{r['release']();}return getAccess(C,N);}function U(){const m=['type','query','DELETE\x20FROM\x20admin.role_access\x20WHERE\x20user_uid\x20=\x20$1\x20AND\x20role_id\x20IS\x20NULL','user','resource','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)'];U=function(){return m;};return U();}
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function updateDictionary(C,N){return await N['dictionary']['put'](C['name'],C['items']),{'success':!![]};}
|
|
@@ -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 z(C,N){C=C-0x18a;const r=U();let p=r[C];return p;}function U(){const x=['patch','length','includes','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','stringify'];U=function(){return x;};return U();}import{ValidationError}from'../../../errors.js';export async function updateSystemSettings(C,N){const c=z;if(!Object['keys'](C[c(0x18a)])[c(0x18b)])throw new ValidationError('Settings\x20patch\x20is\x20empty');for(const [r,p]of Object['entries'](C['patch'])){if(!r['trim']()||r[c(0x18c)]('..'))throw new ValidationError('Invalid\x20setting\x20key:\x20'+r);await N['pg'][c(0x18d)](c(0x18e),[r,JSON[c(0x18f)](p),C['user']['id']]);}return{'success':!![]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{ForbiddenError}from'../../errors.js';function z(C,N){C=C-0x188;var r=U();var p=r[C];return p;}function U(){var p=['admin','Admin\x20access\x20required','includes'];U=function(){return p;};return U();}export function requireAdmin(C,N){var r=z;if(!C)throw new ForbiddenError('User\x20required');if(C['type']!==r(0x188))throw new ForbiddenError(r(0x189));if(C['type']!=='admin'&&N&&!C['permissions']?.[r(0x18a)](N))throw new ForbiddenError('Missing\x20permission:\x20'+N);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function U(){const x=['salt','credentials','fromEntries','toLowerCase'];U=function(){return x;};return U();}function z(C,N){C=C-0x16a;const r=U();let p=r[C];return p;}export const safeUser=C=>{const c=z,N=['password',c(0x16a),'secret',c(0x16b)];return Object[c(0x16c)](Object['entries'](C)['filter'](([r])=>!N['some'](p=>r[c(0x16d)]()['includes'](p))));};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{UnsupportedError}from'../../errors.js';export function unsupported(
|
|
1
|
+
import{UnsupportedError}from'../../errors.js';export function unsupported(C){throw new UnsupportedError(C+'\x20requires\x20a\x20project/provider\x20implementation');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{writeAudit}from'./services/write-audit.js';export function createAudit(
|
|
1
|
+
import{writeAudit}from'./services/write-audit.js';export function createAudit(C){const N=writeAudit(C);return{'write':N};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function U(){const F=['test','map','has','warn','catch','logger','newValue','\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','resourceId','metadata','changes','query','stringify'];U=function(){return F;};return U();}const secretPattern=/password|token|secret|credential|salt/i;function z(C,N){C=C-0xd6;const r=U();let p=r[C];return p;}function clean(C){const L=z;if(Array['isArray'](C))return C['map'](clean);if(C&&typeof C==='object')return Object['fromEntries'](Object['entries'](C)['map'](([N,r])=>[N,secretPattern[L(0xd6)](N)?'[REDACTED]':clean(r)]));return C;}export function writeAudit(C){let N,r;async function p(){const Y=z;if(!C['pg'])return![];if(N!==undefined)return N;return r??=C['pg']['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'](c=>{const T=z,x=new Set(c['rows'][T(0xd7)](m=>m['table_name']));return N=x[T(0xd8)]('audit_log')&&x[T(0xd8)]('audit_log_data'),!N&&C['logger'][T(0xd9)]({'expectedTables':['admin.audit_log','admin.audit_log_data'],'foundTables':[...x]},'Audit\x20tables\x20are\x20unavailable;\x20audit\x20writes\x20are\x20disabled'),N;})[Y(0xda)](c=>{return N=![],C['logger']['warn']({'err':c},'Unable\x20to\x20check\x20audit\x20tables;\x20audit\x20writes\x20are\x20disabled'),![];}),r;}return async function c(x){const f=z;if(!await p())return C[f(0xdb)]['info']({'auditFallback':!![],'event':clean({...x,'changes':x['changes']?.[f(0xd7)](u=>({...u,'oldValue':clean(u['oldValue']),'newValue':clean(u[f(0xdc)])}))})},'audit'),0x0;if(!C['pg'])throw new Error('empty\x20pg');const m=await C['pg']['query'](f(0xdd),[x['userId']??null,x['module'],x['resource'],x['resourceId']==null?null:String(x[f(0xde)]),x['fields']??null,x['action'],x['requestId']??null,x['ipAddress']??null,clean(x[f(0xdf)]??{})]),Q=m['rows'][0x0]['id'];for(const u of x[f(0xe0)]??[]){if(secretPattern['test'](u['field']))continue;await C['pg'][f(0xe1)]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.audit_log_data\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20audit_log_id,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20field,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20old_value,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20new_value\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4)\x0a\x20\x20\x20\x20\x20\x20\x20\x20',[Q,u['field'],JSON['stringify'](clean(u['oldValue'])),JSON[f(0xe2)](clean(u['newValue']))]);}return Q;};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function z(C,N){C=C-0x1a9;const r=U();let p=r[C];return p;}export async function getUserPermissions(C,N){const c=z,r=await N['pg']['query']('\x0a\x20\x20\x20\x20\x20\x20SELECT\x20DISTINCT\x20ra.resource\x20||\x20\x27:\x27\x20||\x20action\x20AS\x20permission\x0a\x20\x20\x20\x20\x20\x20FROM\x20admin.role_access\x20ra\x0a\x20\x20\x20\x20\x20\x20LEFT\x20JOIN\x20admin.user_roles\x20ur\x20ON\x20ur.role_id\x20=\x20ra.role_id\x0a\x20\x20\x20\x20\x20\x20CROSS\x20JOIN\x20LATERAL\x20unnest(COALESCE(ra.actions,\x20\x27{}\x27::text[]))\x20AS\x20action\x0a\x20\x20\x20\x20\x20\x20WHERE\x20ra.user_uid\x20=\x20$1\x20OR\x20ur.user_uid\x20=\x20$1\x0a\x20\x20\x20\x20',[C]);return r['rows'][c(0x1a9)](p=>p['permission']);}function U(){const x=['map'];U=function(){return x;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from'./auth.types.js';import{randomBytes,scrypt as
|
|
1
|
+
export*from'./auth.types.js';import{randomBytes,scrypt as C,timingSafeEqual}from'node:crypto';import{promisify}from'node:util';const scrypt=promisify(C);function U(){const D=['scrypt$','toString','scrypt','hex','from','auth','database','register','initialize','registerUserDeserializer','user'];U=function(){return D;};return U();}import N from'@fastify/cookie';function z(C,N){C=C-0x12f;const r=U();let p=r[C];return p;}import r from'@fastify/session';import{Authenticator}from'@fastify/passport';import p from'fastify-session-redis-store';import{getUserPermissions}from'./get-user-permissions.js';const fastifyPassport=new Authenticator();export*from'./verifyUser.js';export*from'./get-user-permissions.js';export async function hashPassword(c){const f=z,x=randomBytes(0x10),m=await scrypt(c,x,0x40);return f(0x12f)+x['toString']('hex')+'$'+m[f(0x130)]('hex');}export async function verifyPassword(c,x){const F=z,[m,Q,u]=x['split']('$');if(m!==F(0x131)||!Q||!u)return![];const L=Buffer['from'](Q,F(0x132)),T=Buffer[F(0x133)](u,F(0x132)),Y=await scrypt(c,L,T['length']);return timingSafeEqual(Y,T);}export async function createSessionStore(c,x){const t=z,{config:m,redis:Q}=x;if(!m||!Q){console['warn']('Missing\x20config\x20or\x20redis\x20-\x20skipping\x20session\x20store\x20creation');return;}if(process.env.NODE_ENV==='test'||process.env.VITEST)return;await c['register'](N,{'parseOptions':m['auth']['cookieOptions']}),await c['register'](r,{'secret':m[t(0x134)]['secret'],'cookieName':m['auth']['cookieName'],'cookie':m['auth']['cookieOptions'],'store':new p({'prefix':m['auth']['cookieName']+':'+(m['pg']?.[t(0x135)]||'db')+':','client':Q})}),await c[t(0x136)](fastifyPassport[t(0x137)]()),await c['register'](fastifyPassport['secureSession']()),fastifyPassport['registerUserSerializer'](async u=>({'user':u})),fastifyPassport[t(0x138)](async u=>{const h=t,L=u?.[h(0x139)]||u;return L?.['id']&&(L['permissions']=await getUserPermissions(L['id'],x)),L;});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BadRequestError}from'../../errors.js';function
|
|
1
|
+
import{BadRequestError}from'../../errors.js';function z(C,N){C=C-0x10d;const r=U();let p=r[C];return p;}import{verifyPassword}from'./index.js';function U(){const Y=['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'];U=function(){return Y;};return U();}export async function verifyUser({user:C,password:N,ip:r},{pg:p,logger:c}){const T=z;if(!C||C==='')throw new BadRequestError('not\x20enough\x20params:\x20user');if(!N||N==='')throw new BadRequestError('not\x20enough\x20params:\x20password');c['metrics']('user.login');const x=T(0x10d),m=await p['query'](x,[C])['then'](u=>u['rows']?.[0x0]);if(!m){const u='user\x20not\x20found';c['info']({'file':'auth/warn','error':u,'user':C,'ip':r});throw new BadRequestError(u);}const Q=await verifyPassword(N,m['password_hash']);if(!Q){const L='Wrong\x20password';c['info']({'file':'auth/warn','error':L,'user':C,'ip':r});throw new BadRequestError(L);}return delete m['password_hash'],m;}
|
|
@@ -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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../src/plugins/dictionary.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAMD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,GAAG,IAAI,CAAC;IACrE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7C,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,IAAI,IAAI,OAAO,CACb,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;KAAE,CAAC,CACrE,CAAC;CACH;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,eAAe,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACvC;AAID,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,YAAiB,GAClB,EAAE,sBAAsB,GAAG,gBAAgB,
|
|
1
|
+
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../src/plugins/dictionary.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAMD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,GAAG,IAAI,CAAC;IACrE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7C,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,IAAI,IAAI,OAAO,CACb,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;KAAE,CAAC,CACrE,CAAC;CACH;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,eAAe,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACvC;AAID,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,YAAiB,GAClB,EAAE,sBAAsB,GAAG,gBAAgB,CAkN3C"}
|