@opengis/fcore 0.0.1-beta.2 → 0.0.1-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -3
- package/README.md +71 -71
- package/dist/config.d.ts +2 -10
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/context.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/fastify.d.ts +2 -5
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fcore.js +1 -1
- package/dist/index.js +1 -1
- package/dist/migrations/cli.js +1 -1
- package/dist/migrations/runner.js +1 -1
- package/dist/modules/auth/adduser-cli.d.ts +3 -0
- package/dist/modules/auth/adduser-cli.d.ts.map +1 -0
- package/dist/modules/auth/adduser-cli.js +2 -0
- package/dist/modules/auth/passwd-cli.d.ts +3 -0
- package/dist/modules/auth/passwd-cli.d.ts.map +1 -0
- package/dist/modules/auth/passwd-cli.js +2 -0
- package/dist/modules/auth/permission-cli.d.ts +3 -0
- package/dist/modules/auth/permission-cli.d.ts.map +1 -0
- package/dist/modules/auth/permission-cli.js +2 -0
- package/dist/modules/auth/route.d.ts.map +1 -1
- package/dist/modules/auth/route.js +1 -1
- package/dist/modules/auth/schema.d.ts +10 -1
- package/dist/modules/auth/schema.d.ts.map +1 -1
- package/dist/modules/auth/schema.js +1 -1
- package/dist/modules/auth/services/change-password.d.ts +9 -0
- package/dist/modules/auth/services/change-password.d.ts.map +1 -0
- package/dist/modules/auth/services/change-password.js +1 -0
- package/dist/modules/auth/services/get-current-user.d.ts +1 -0
- package/dist/modules/auth/services/get-current-user.d.ts.map +1 -1
- package/dist/modules/auth/services/get-current-user.js +1 -1
- package/dist/modules/auth/services/registration.d.ts +14 -0
- package/dist/modules/auth/services/registration.d.ts.map +1 -0
- package/dist/modules/auth/services/registration.js +1 -0
- package/dist/modules/auth/services/verify-two-factor.js +1 -1
- package/dist/modules/file/mime.d.ts +3 -0
- package/dist/modules/file/mime.d.ts.map +1 -0
- package/dist/modules/file/mime.js +1 -0
- package/dist/modules/file/route.d.ts.map +1 -1
- package/dist/modules/file/route.js +1 -1
- package/dist/modules/file/schema.d.ts +3 -0
- package/dist/modules/file/schema.d.ts.map +1 -1
- package/dist/modules/file/schema.js +1 -1
- package/dist/modules/file/services/get-file.js +1 -1
- package/dist/modules/file/services/resize-file.d.ts.map +1 -1
- package/dist/modules/file/services/resize-file.js +1 -1
- package/dist/modules/file/services/upload-file.d.ts +4 -6
- package/dist/modules/file/services/upload-file.d.ts.map +1 -1
- package/dist/modules/file/services/upload-file.js +1 -1
- package/dist/modules/resource/route.d.ts +0 -3
- package/dist/modules/resource/route.d.ts.map +1 -1
- package/dist/modules/resource/route.js +1 -1
- package/dist/modules/resource/schema.d.ts +3 -0
- package/dist/modules/resource/schema.d.ts.map +1 -1
- package/dist/modules/resource/schema.js +1 -1
- package/dist/modules/resource/services/add-note.js +1 -1
- package/dist/modules/resource/services/add-resource-file.js +1 -1
- package/dist/modules/resource/services/create-resource-relation.d.ts +8 -2
- package/dist/modules/resource/services/create-resource-relation.d.ts.map +1 -1
- package/dist/modules/resource/services/create-resource-relation.js +1 -1
- package/dist/modules/resource/services/create-resource.js +1 -1
- package/dist/modules/resource/services/delete-resource-relation.d.ts +8 -1
- package/dist/modules/resource/services/delete-resource-relation.d.ts.map +1 -1
- package/dist/modules/resource/services/delete-resource-relation.js +1 -1
- package/dist/modules/resource/services/delete-resource.js +1 -1
- package/dist/modules/resource/services/export-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/export-resource.js +1 -1
- package/dist/modules/resource/services/get-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/get-resource.js +1 -1
- package/dist/modules/resource/services/list-resource-relation.d.ts +9 -2
- package/dist/modules/resource/services/list-resource-relation.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resource-relation.js +1 -1
- package/dist/modules/resource/services/list-resources.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resources.js +1 -1
- package/dist/modules/resource/services/search-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/search-resource.js +1 -1
- package/dist/modules/resource/services/suggest-resource.d.ts +10 -4
- package/dist/modules/resource/services/suggest-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/suggest-resource.js +1 -1
- package/dist/modules/resource/services/update-resource-relation.d.ts +10 -0
- package/dist/modules/resource/services/update-resource-relation.d.ts.map +1 -0
- package/dist/modules/resource/services/update-resource-relation.js +1 -0
- package/dist/modules/resource/services/update-resource.js +1 -1
- package/dist/modules/resource/services/upload-resource-file.js +1 -1
- package/dist/modules/system/route.d.ts +2 -1
- package/dist/modules/system/route.d.ts.map +1 -1
- package/dist/modules/system/route.js +1 -1
- package/dist/modules/system/schema.d.ts +23 -1
- package/dist/modules/system/schema.d.ts.map +1 -1
- package/dist/modules/system/schema.js +1 -1
- package/dist/modules/system/services/check-system.d.ts.map +1 -1
- package/dist/modules/system/services/check-system.js +1 -1
- package/dist/modules/system/services/get-access.d.ts +15 -0
- package/dist/modules/system/services/get-access.d.ts.map +1 -0
- package/dist/modules/system/services/get-access.js +1 -0
- package/dist/modules/system/services/get-api-list.d.ts +4 -1
- package/dist/modules/system/services/get-api-list.d.ts.map +1 -1
- package/dist/modules/system/services/get-api-list.js +1 -1
- package/dist/modules/system/services/get-audit-log.d.ts.map +1 -1
- package/dist/modules/system/services/get-audit-log.js +1 -1
- package/dist/modules/system/services/get-dictionary.js +1 -1
- package/dist/modules/system/services/get-system-log.d.ts +9 -5
- package/dist/modules/system/services/get-system-log.d.ts.map +1 -1
- package/dist/modules/system/services/get-system-log.js +1 -1
- package/dist/modules/system/services/get-system-settings.d.ts.map +1 -1
- package/dist/modules/system/services/get-system-settings.js +1 -1
- package/dist/modules/system/services/list-dictionaries.js +1 -1
- package/dist/modules/system/services/set-access.d.ts +17 -0
- package/dist/modules/system/services/set-access.d.ts.map +1 -0
- package/dist/modules/system/services/set-access.js +1 -0
- package/dist/modules/system/services/update-dictionary.d.ts +13 -0
- package/dist/modules/system/services/update-dictionary.d.ts.map +1 -0
- package/dist/modules/system/services/update-dictionary.js +1 -0
- package/dist/modules/system/services/update-system-settings.d.ts.map +1 -1
- package/dist/modules/system/services/update-system-settings.js +1 -1
- package/dist/modules/utils/require-admin.js +1 -1
- package/dist/modules/utils/safe-user.js +1 -1
- package/dist/modules/utils/unsupported.js +1 -1
- package/dist/plugins/audit/audit.js +1 -1
- package/dist/plugins/audit/audit.types.d.ts +1 -1
- package/dist/plugins/audit/audit.types.d.ts.map +1 -1
- package/dist/plugins/audit/index.js +1 -1
- package/dist/plugins/audit/services/write-audit.js +1 -1
- package/dist/plugins/auth/get-user-permissions.d.ts +3 -0
- package/dist/plugins/auth/get-user-permissions.d.ts.map +1 -0
- package/dist/plugins/auth/get-user-permissions.js +1 -0
- package/dist/plugins/auth/index.d.ts +4 -0
- package/dist/plugins/auth/index.d.ts.map +1 -1
- package/dist/plugins/auth/index.js +1 -1
- package/dist/plugins/auth/verifyUser.d.ts +9 -0
- package/dist/plugins/auth/verifyUser.d.ts.map +1 -0
- package/dist/plugins/auth/verifyUser.js +1 -0
- package/dist/plugins/dictionary.d.ts +3 -0
- package/dist/plugins/dictionary.d.ts.map +1 -1
- package/dist/plugins/dictionary.js +1 -1
- package/dist/plugins/file.d.ts +3 -6
- package/dist/plugins/file.d.ts.map +1 -1
- package/dist/plugins/file.js +1 -1
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/jwt.d.ts +4 -0
- package/dist/plugins/jwt.d.ts.map +1 -0
- package/dist/plugins/jwt.js +1 -0
- package/dist/plugins/logger/index.js +1 -1
- package/dist/plugins/logger/transport.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.js +1 -1
- package/dist/plugins/resource/index.js +1 -1
- package/dist/plugins/resource/resource.d.ts.map +1 -1
- package/dist/plugins/resource/resource.js +1 -1
- package/dist/plugins/resource/resource.registry.js +1 -1
- package/dist/plugins/resource/resource.types.d.ts +71 -15
- package/dist/plugins/resource/resource.types.d.ts.map +1 -1
- package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts +3 -0
- package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-dictionary-lookup-data.js +1 -0
- package/dist/plugins/resource/services/add-file-token.d.ts +3 -0
- package/dist/plugins/resource/services/add-file-token.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-file-token.js +1 -0
- package/dist/plugins/resource/services/add-table-lookup-data.d.ts +4 -0
- package/dist/plugins/resource/services/add-table-lookup-data.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-table-lookup-data.js +1 -0
- package/dist/plugins/resource/services/create-relation.d.ts +16 -0
- package/dist/plugins/resource/services/create-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/create-relation.js +1 -0
- package/dist/plugins/resource/services/create.d.ts +5 -2
- package/dist/plugins/resource/services/create.d.ts.map +1 -1
- package/dist/plugins/resource/services/create.js +1 -1
- package/dist/plugins/resource/services/delete-relation.d.ts +18 -0
- package/dist/plugins/resource/services/delete-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/delete-relation.js +1 -0
- package/dist/plugins/resource/services/delete.d.ts +9 -2
- package/dist/plugins/resource/services/delete.d.ts.map +1 -1
- package/dist/plugins/resource/services/delete.js +1 -1
- package/dist/plugins/resource/services/find-one.d.ts +3 -2
- package/dist/plugins/resource/services/find-one.d.ts.map +1 -1
- package/dist/plugins/resource/services/find-one.js +1 -1
- package/dist/plugins/resource/services/find-relation.d.ts +13 -0
- package/dist/plugins/resource/services/find-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/find-relation.js +1 -0
- package/dist/plugins/resource/services/find.d.ts.map +1 -1
- package/dist/plugins/resource/services/find.js +1 -1
- package/dist/plugins/resource/services/update-relation.d.ts +14 -0
- package/dist/plugins/resource/services/update-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/update-relation.js +1 -0
- package/dist/plugins/resource/services/update.d.ts +9 -2
- package/dist/plugins/resource/services/update.d.ts.map +1 -1
- package/dist/plugins/resource/services/update.js +1 -1
- package/dist/plugins/resource/utils/auto-index.d.ts +4 -0
- package/dist/plugins/resource/utils/auto-index.d.ts.map +1 -0
- package/dist/plugins/resource/utils/auto-index.js +1 -0
- package/dist/plugins/resource/utils/fields.d.ts +8 -1
- package/dist/plugins/resource/utils/fields.d.ts.map +1 -1
- package/dist/plugins/resource/utils/fields.js +1 -1
- package/dist/plugins/resource/utils/filters.d.ts +3 -2
- package/dist/plugins/resource/utils/filters.d.ts.map +1 -1
- package/dist/plugins/resource/utils/filters.js +1 -1
- package/dist/plugins/resource/utils/permissions.d.ts.map +1 -1
- package/dist/plugins/resource/utils/permissions.js +1 -1
- package/dist/plugins/resource/utils/sort.d.ts +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/shared/getIP.js +1 -1
- package/dist/type.d.ts +14 -0
- package/dist/type.d.ts.map +1 -1
- package/migrations/20260903120000_core_schema.sql +27 -21
- package/migrations/20260903130000_move_notes_files_to_admin.sql +17 -17
- package/migrations/20260903130001_add_file_fields.sql +5 -0
- package/migrations/20260903140000_settings_nulls_not_distinct.sql +18 -18
- package/migrations/20260905120000_add_user_foreign_keys.sql +43 -0
- package/migrations/20260907090000_core_schema.sql +32 -0
- package/package.json +93 -88
- package/dist/modules/auth/index.d.ts +0 -9
- package/dist/modules/auth/index.d.ts.map +0 -1
- package/dist/modules/auth/index.js +0 -1
- package/dist/modules/auth/services/login.d.ts +0 -10
- package/dist/modules/auth/services/login.d.ts.map +0 -1
- package/dist/modules/auth/services/login.js +0 -1
- package/dist/modules/auth/services/logout.d.ts +0 -9
- package/dist/modules/auth/services/logout.d.ts.map +0 -1
- package/dist/modules/auth/services/logout.js +0 -1
- package/dist/modules/auth/services/verifyPassword.d.ts +0 -11
- package/dist/modules/auth/services/verifyPassword.d.ts.map +0 -1
- package/dist/modules/auth/services/verifyPassword.js +0 -1
- package/dist/modules/file/index.d.ts +0 -8
- package/dist/modules/file/index.d.ts.map +0 -1
- package/dist/modules/file/index.js +0 -1
- package/dist/modules/resource/index.d.ts +0 -20
- package/dist/modules/resource/index.d.ts.map +0 -1
- package/dist/modules/resource/index.js +0 -1
- package/dist/modules/resource/services/list-children.d.ts +0 -6
- package/dist/modules/resource/services/list-children.d.ts.map +0 -1
- package/dist/modules/resource/services/list-children.js +0 -1
- package/dist/modules/system/index.d.ts +0 -13
- package/dist/modules/system/index.d.ts.map +0 -1
- package/dist/modules/system/index.js +0 -1
- package/dist/modules/utils/get-user-permissions.d.ts +0 -3
- package/dist/modules/utils/get-user-permissions.d.ts.map +0 -1
- package/dist/modules/utils/get-user-permissions.js +0 -1
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Implements the suggest resource application service for its module.
|
|
3
|
-
*/
|
|
4
1
|
import type { AppContext } from '../../../context.js';
|
|
5
|
-
|
|
2
|
+
type SuggestResourceResult = {
|
|
3
|
+
search: string;
|
|
4
|
+
time: number;
|
|
5
|
+
data: any[];
|
|
6
|
+
limit?: number;
|
|
7
|
+
count?: number;
|
|
8
|
+
total?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function suggestResource(params: any, ctx: AppContext): Promise<SuggestResourceResult>;
|
|
11
|
+
export {};
|
|
6
12
|
//# sourceMappingURL=suggest-resource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/suggest-resource.ts"],"names":[],"mappings":"
|
|
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
|
-
|
|
1
|
+
function u(I,X){I=I-0x9c;const o=f();let b=o[I];return b;}import{ValidationError}from'../../../errors.js';import{autoIndex}from'../../../plugins/resource/utils/auto-index.js';export async function suggestResource(I,X){const Z=u,o=X[Z(0x9c)][Z(0x9d)](I['resource']),b=String(I['search']??I['q']??'')[Z(0x9e)](),A=Math[Z(0x9f)](Math['max'](Number(I['limit']??0x14),0x1),0xc8),t=Date['now'](),p=o['fields'][I['field']],V=p?.[Z(0xa0)],O=p?.[Z(0xa1)]?.['table'];if(O){const r=p['lookup']?.[Z(0xa2)]??Z(0xa3),B=p['lookup']?.[Z(0xa4)]??'id';autoIndex(O,r,'text',X['pg']);const s=await X['pg']['query']('SELECT\x20'+B+'\x20as\x20id,\x20'+r+'\x20as\x20text\x20FROM\x20'+O+Z(0xa5)+r+')\x20~\x20$1\x20LIMIT\x20$2',[''+b['toLowerCase'](),A])['then'](F=>F['rows']);return{'limit':A,'count':s['length'],'search':b,'time':Date[Z(0xa6)]()-t,'data':s};}if(!V)throw new ValidationError('Field\x20has\x20no\x20lookup\x20dictionary:\x20'+I[Z(0xa7)]);const P=await X['dictionary']['get'](V),M=P['filter'](F=>!b||F['code']['startsWith'](b)||F[Z(0xa3)]['startsWith'](b))['slice'](0x0,A)['map'](F=>({'id':F['code']||F['id'],'text':F['name']||F['text']}));return{'search':b,'limit':A,'count':M['length'],'time':Date['now']()-t,'data':M};}function f(){const W=['resource','get','toLowerCase','min','dictionary','lookup','text','name','value','\x20WHERE\x20lower(','now','field'];f=function(){return W;};return f();}
|
|
@@ -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
|
+
function u(I,X){I=I-0x1d3;const o=f();let b=o[I];return b;}export async function updateResourceRelation(I,X){const O=u,{resource:o,id:b,relation:A,relationId:t,data:p,user:V}=I;return X[O(0x1d3)]['updateRelation']({'name':o,'id':b,'relation':A,'relationId':t,'data':p,'user':V});}function f(){const P=['resource'];f=function(){return P;};return f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function updateResource(I,X){return X['resource']['update']({'name':I['resource'],'id':I['id'],'data':I['patch'],'user':I['user']});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{ForbiddenError,NotFoundError,ValidationError}from'../../../errors.js';function u(I,X){I=I-0x1b5;const o=f();let b=o[I];return b;}export async function uploadResourceFile(I,X){const p=u,o=X['resource']['get'](I[p(0x1b5)]);if(o[p(0x1b6)]===p(0x1b7)&&I[p(0x1b8)]?.[p(0x1b9)]!==p(0x1b7))throw new ForbiddenError(p(0x1ba));if(I['user']?.[p(0x1b9)]!=='admin'&&!I['user']?.[p(0x1bb)]?.[p(0x1bc)]((o['permission']??o[p(0x1bd)])+':update'))throw new ForbiddenError(p(0x1be)+(o['permission']??o['name'])+':update');if(!Buffer[p(0x1bf)](I[p(0x1c0)])||I[p(0x1c0)][p(0x1c1)]===0x0)throw new ValidationError('File\x20is\x20required');const b=I['fileName']['replace'](/[^A-Za-z0-9._-]/g,'_');if(!b)throw new ValidationError('File\x20name\x20is\x20required');const A='files/'+I['resource']+'/'+String(I['id'])+'/'+b;await X[p(0x1c0)]['put'](A,I['file']);if(!await X['file']['exists'](A))throw new NotFoundError('Uploaded\x20file\x20not\x20found');const t=await X['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',[I['resource'],String(I['id']),A,I['file']['length']]);return t['rows'][0x0];}function f(){const V=['resource','access','admin','user','type','Admin\x20access\x20required','permissions','includes','name','Missing\x20permission:\x20','isBuffer','file','length'];f=function(){return V;};return f();}
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { FastifyPluginAsync } from "fastify";
|
|
5
5
|
import type { AppContext } from "../../context.js";
|
|
6
|
-
|
|
6
|
+
import type { ApiRoute } from "../../type.js";
|
|
7
|
+
export declare function systemRoutes(ctx: AppContext, apiRoutes?: ReadonlyMap<string, ApiRoute>): FastifyPluginAsync;
|
|
7
8
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/system/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/system/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAanD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,wBAAgB,YAAY,CAC1B,GAAG,EAAE,UAAU,EACf,SAAS,GAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAa,GACnD,kBAAkB,CA8JpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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 f(){const r=['/api/dictionary/:name','Get\x20platform\x20dictionary','fcore','system:dictionaries','dictionaryName','dictionaryItems','/api/access/:type/:id','system','Get\x20access\x20rules','Returns\x20direct\x20and\x20role-based\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','system:access','post','Set\x20access\x20rules','get','system:settings','/api/system/settings','settings','Get\x20system\x20log','user','query','send','/api/system/audit','system:check','List\x20APIs'];f=function(){return r;};return f();}import{checkSystem}from'./services/check-system.js';import{getApiList}from'./services/get-api-list.js';import{getSystemLog}from'./services/get-system-log.js';import{getDictionary}from'./services/get-dictionary.js';import{updateDictionary}from'./services/update-dictionary.js';import{getAccess}from'./services/get-access.js';function I(u,X){u=u-0x185;const o=f();let b=o[u];return b;}import{setAccess}from'./services/set-access.js';import{systemSchemas}from'./schema.js';const u=X=>X['user'];export function systemRoutes(X,o=new Map()){return async b=>{const P=I;b['get'](P(0x185),{'schema':{'tags':['fcore','system'],'summary':P(0x186),'description':'Returns\x20a\x20registered\x20platform\x20dictionary\x20by\x20name.','access':'user','permissions':['system:dictionaries'],'params':systemSchemas['dictionaryName']}},async t=>({'items':await getDictionary({...t['params'],'user':u(t)},X)})),b['post'](P(0x185),{'schema':{'tags':[P(0x187),'system'],'summary':'Update\x20platform\x20dictionary','description':'Replaces\x20the\x20items\x20of\x20a\x20registered\x20platform\x20dictionary.','access':'user','permissions':[P(0x188)],'params':systemSchemas[P(0x189)],'body':systemSchemas[P(0x18a)]}},async t=>updateDictionary({...t['params'],...t['body'],'user':u(t)},X));const A=async t=>getAccess({...t['params'],'user':u(t)},X);b['get'](P(0x18b),{'schema':{'tags':['fcore',P(0x18c)],'summary':P(0x18d),'description':P(0x18e),'access':'admin','permissions':[P(0x18f)],'params':systemSchemas['accessTarget']}},A),b[P(0x190)]('/api/access/:type/:id',{'schema':{'tags':['fcore',P(0x18c)],'summary':P(0x191),'description':'Replaces\x20direct\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','access':'admin','permissions':['system:access'],'params':systemSchemas['accessTarget'],'body':systemSchemas['access']}},async t=>setAccess({...t['params'],...t['body'],'user':u(t)},X)),b[P(0x192)]('/api/system/settings',{'schema':{'tags':['fcore','system'],'summary':'Get\x20system\x20settings','description':'Returns\x20system\x20settings\x20as\x20nested\x20JSON.','access':'admin','permissions':[P(0x193)]}},async t=>getSystemSettings({...t['params'],'user':u(t)},X)),b[P(0x190)](P(0x194),{'schema':{'tags':['fcore','system'],'summary':'Update\x20system\x20settings','description':'Updates\x20system\x20settings\x20using\x20flat\x20dot-notation\x20keys.','access':'admin','permissions':[P(0x193)],'body':systemSchemas[P(0x195)]}},async t=>updateSystemSettings({...t['params'],'patch':t['body'],'user':u(t)},X)),b['get']('/api/system/logger',{'schema':{'tags':[P(0x187),'system'],'summary':P(0x196),'description':'Returns\x20system\x20logger\x20entries\x20for\x20the\x20requested\x20path.','access':P(0x197),'permissions':['system:logs'],'querystring':systemSchemas['logger']}},async(t,p)=>{const M=P,{contentType:V,body:O}=await getSystemLog({...t[M(0x198)],'user':u(t)},X);return p['type'](V)[M(0x199)](O);}),b['get'](P(0x19a),{'schema':{'tags':[P(0x187),'system'],'summary':'Get\x20audit\x20log','description':'Returns\x20the\x20system\x20audit\x20log\x20entries.','access':'user','permissions':['system:audit']}},async t=>getAuditLog({...t[P(0x198)],'user':u(t)},X)),b['get']('/api/system/check',{'schema':{'tags':['fcore','system'],'summary':'Check\x20system\x20health','description':'Checks\x20the\x20availability\x20of\x20system\x20dependencies.','access':'user','permissions':[P(0x19b)]}},async t=>checkSystem({'user':u(t)},X)),b['get']('/api/system/list',{'schema':{'tags':[P(0x187),'system'],'summary':P(0x19c),'description':'Returns\x20the\x20list\x20of\x20registered\x20platform\x20APIs.','access':'admin','permissions':[],'querystring':systemSchemas['apiListQuery']}},async t=>getApiList({'user':u(t),'apiRoutes':o,...t['query']},X));};}
|
|
@@ -3,12 +3,34 @@ export declare const systemSchemas: {
|
|
|
3
3
|
dictionaryName: import("@sinclair/typebox").TObject<{
|
|
4
4
|
name: import("@sinclair/typebox").TString;
|
|
5
5
|
}>;
|
|
6
|
+
dictionaryItems: import("@sinclair/typebox").TObject<{
|
|
7
|
+
items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
8
|
+
id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>;
|
|
9
|
+
code: import("@sinclair/typebox").TString;
|
|
10
|
+
name: import("@sinclair/typebox").TString;
|
|
11
|
+
parentId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNull]>>;
|
|
12
|
+
}>>;
|
|
13
|
+
}>;
|
|
14
|
+
accessTarget: import("@sinclair/typebox").TObject<{
|
|
15
|
+
type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"user">, import("@sinclair/typebox").TLiteral<"role">]>;
|
|
16
|
+
id: import("@sinclair/typebox").TString;
|
|
17
|
+
}>;
|
|
18
|
+
access: import("@sinclair/typebox").TObject<{
|
|
19
|
+
permissions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
20
|
+
access: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
21
|
+
resource: import("@sinclair/typebox").TString;
|
|
22
|
+
actions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
23
|
+
}>>>;
|
|
24
|
+
}>;
|
|
25
|
+
apiListQuery: import("@sinclair/typebox").TObject<{
|
|
26
|
+
format: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"short">, import("@sinclair/typebox").TLiteral<"extended">]>>;
|
|
27
|
+
}>;
|
|
6
28
|
settingsEntity: import("@sinclair/typebox").TObject<{
|
|
7
29
|
entity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
30
|
}>;
|
|
9
31
|
settings: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
|
|
10
32
|
logger: import("@sinclair/typebox").TObject<{
|
|
11
|
-
|
|
33
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
12
34
|
}>;
|
|
13
35
|
};
|
|
14
36
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/system/schema.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,qCAIrB,CAAC;AAEH,eAAO,MAAM,aAAa;IACxB,cAAc;;;IAGd,cAAc;;;IACd,QAAQ;IACR,MAAM;;;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/system/schema.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,qCAIrB,CAAC;AAEH,eAAO,MAAM,aAAa;IACxB,cAAc;;;IAGd,eAAe;;;;;;;;IAef,YAAY;;;;IAIZ,MAAM;;;;;;;IAaN,YAAY;;;IAGZ,cAAc;;;IACd,QAAQ;IACR,MAAM;;;CAKP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const I=u;function u(I,X){I=I-0xc2;const o=f();let b=o[I];return b;}import{Type}from'@sinclair/typebox';export const identifier=Type['String']({'minLength':0x1,'maxLength':0x80,'pattern':I(0xc2)});export const systemSchemas={'dictionaryName':Type['Object']({'name':identifier}),'dictionaryItems':Type['Object']({'items':Type['Array'](Type['Object']({'id':Type['Optional'](Type[I(0xc3)]([Type['String'](),Type['Number']()])),'code':Type['String']({'minLength':0x1}),'name':Type['String']({'minLength':0x1}),'parentId':Type[I(0xc4)](Type['Union']([Type['String'](),Type[I(0xc5)](),Type[I(0xc6)]()]))},{'additionalProperties':!![]}))}),'accessTarget':Type['Object']({'type':Type['Union']([Type['Literal']('user'),Type['Literal']('role')]),'id':identifier}),'access':Type['Object']({'permissions':Type['Optional'](Type[I(0xc7)](Type['String']({'minLength':0x1,'maxLength':0x80,'pattern':'^[A-Za-z0-9_-]+(?::[A-Za-z0-9_-]+)?$'}))),'access':Type[I(0xc4)](Type[I(0xc7)](Type[I(0xc8)]({'resource':Type['String']({'minLength':0x1,'maxLength':0x80}),'actions':Type[I(0xc7)](Type[I(0xc9)]({'minLength':0x1,'maxLength':0x80}),{'minItems':0x1})})))}),'apiListQuery':Type['Object']({'format':Type[I(0xc4)](Type['Union']([Type['Literal']('short'),Type['Literal']('extended')]))}),'settingsEntity':Type['Object']({'entity':Type[I(0xc4)](identifier)}),'settings':Type['Record'](Type['String']({'minLength':0x1}),Type['Unknown']()),'logger':Type['Object']({'path':Type['Optional'](Type['String']({'maxLength':0x100,'pattern':'^[A-Za-z0-9_.\x5c-/]*$'}))})};function f(){const X=['^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$','Union','Optional','Number','Null','Array','Object','String'];f=function(){return X;};return f();}
|
|
@@ -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
|
-
|
|
1
|
+
function f(){const t=['query','SELECT\x201','fulfilled'];f=function(){return t;};return f();}function u(I,X){I=I-0x144;const o=f();let b=o[I];return b;}export async function checkSystem(I,X){const A=u,[o,b]=await Promise['allSettled']([X['pg'][A(0x144)](A(0x145)),X['redis']['ping']()]);return{'status':o['status']==='fulfilled'&&b['status']===A(0x146)?'ok':'degraded','pg':o['status'],'redis':b['status']};}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AppContext, User } from "../../../context.js";
|
|
2
|
+
export interface AccessRecord {
|
|
3
|
+
resource: string | null;
|
|
4
|
+
actions: string[] | null;
|
|
5
|
+
role: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function getAccess(params: {
|
|
8
|
+
type: "user" | "role";
|
|
9
|
+
id: string;
|
|
10
|
+
user: User;
|
|
11
|
+
}, ctx: AppContext): Promise<{
|
|
12
|
+
access: AccessRecord[];
|
|
13
|
+
resources: string[];
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=get-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-access.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,wBAAsB,SAAS,CAC7B,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EACzD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,MAAM,EAAE,YAAY,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAwB1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function u(I,X){I=I-0x1d7;const o=f();let b=o[I];return b;}function f(){const V=['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\x20WHERE\x20ra.role_id\x20=\x20$1\x0a\x20\x20\x20\x20\x20\x20','rows','filter'];f=function(){return V;};return f();}export async function getAccess(I,X){const p=u,o=I[p(0x1d7)]===p(0x1d8)?'\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':p(0x1d9),b=await X['pg']['query'](o,[I['id']]),A=[...new Set(b[p(0x1da)]['map'](t=>t['resource'])[p(0x1db)](t=>t!==null))];return{'access':b['rows'],'resources':A};}
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Implements the get API list application service for the System module.
|
|
3
3
|
*/
|
|
4
4
|
import type { AppContext, User } from "../../../context.js";
|
|
5
|
+
import type { ApiRoute } from "../../../type.js";
|
|
5
6
|
export declare function getApiList(params: {
|
|
6
7
|
user: User;
|
|
7
|
-
|
|
8
|
+
apiRoutes: ReadonlyMap<string, ApiRoute>;
|
|
9
|
+
format?: "short" | "extended";
|
|
10
|
+
}, ctx: AppContext): Promise<ApiRoute[] | string[]>;
|
|
8
11
|
//# sourceMappingURL=get-api-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-api-list.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-api-list.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-api-list.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-api-list.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,kBAAkB,CAAC;AAEhE,wBAAsB,UAAU,CAC9B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;CAC/B,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC,CAWhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function getApiList(I,X){const V=u,o=[...I['apiRoutes'][V(0x70)]()]['sort']((b,A)=>(b['endpoint']+'\x20'+b['method'])[V(0x71)](A[V(0x72)]+'\x20'+A['method']));if(I['format']!==V(0x73))return o;return o['map'](({method:b,endpoint:A,access:t,permissions:p})=>b+'\x20'+A);}function u(I,X){I=I-0x70;const o=f();let b=o[I];return b;}function f(){const O=['values','localeCompare','endpoint','short'];f=function(){return O;};return f();}
|
|
@@ -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 u(I,X){I=I-0x7a;const o=f();let b=o[I];return b;}export async function getAuditLog(I,X){const t=u,o=Math['min'](Math['max'](I['limit']??0x32,0x1),0xc8),b=Math[t(0x7a)]((I[t(0x7b)]??0x1)-0x1,0x0)*o,A=await X['pg'][t(0x7c)](t(0x7d),[o,b]);return{'rows':A['rows'],'page':I[t(0x7b)]??0x1,'limit':o};}function f(){const p=['max','page','query','SELECT\x20*\x20FROM\x20admin.audit_log\x20ORDER\x20BY\x20id\x20DESC\x20LIMIT\x20$1\x20OFFSET\x20$2'];f=function(){return p;};return f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function getDictionary(I,X){var o=u;return X['dictionary'][o(0xa5)](I['name']);}function u(I,X){I=I-0xa5;var o=f();var b=o[I];return b;}function f(){var b=['get'];f=function(){return b;};return f();}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { AppContext, User } from "../../../context.js";
|
|
2
|
+
export interface LogResult {
|
|
3
|
+
contentType: string;
|
|
4
|
+
body: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function getSystemLog(params: {
|
|
7
|
+
path?: string;
|
|
8
|
+
user: User;
|
|
9
|
+
}, ctx: AppContext): Promise<LogResult>;
|
|
6
10
|
//# sourceMappingURL=get-system-log.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-system-log.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-system-log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-system-log.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-system-log.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAc5D,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EACrC,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,SAAS,CAAC,CA0CpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import I from'node:fs/promises';import X from'node:path';function f(){const q=['resolve','stat','join','isDirectory','toISOString','slice','text/plain;\x20charset=utf-8','?path=','name','</a></li>','<!DOCTYPE\x20html>\x0a<html>\x0a<head><meta\x20charset=\x22utf-8\x22><title>','replace','"','split','alloc','min','concat','toString'];f=function(){return q;};return f();}import{NotFoundError,ValidationError}from'../../../errors.js';const LOGS_ROOT=X['resolve'](process['cwd'](),'logs'),TAIL_LINES=0x64;export async function getSystemLog(o,b){const F=u,A=normalizePath(o['path']),t=X[F(0x121)](LOGS_ROOT,A);if(t!==LOGS_ROOT&&!t['startsWith'](LOGS_ROOT+X['sep']))throw new ValidationError('Invalid\x20log\x20path');const p=await I['stat'](t)['catch'](()=>null);if(!p)throw new NotFoundError('Log\x20path\x20not\x20found');if(p['isDirectory']()){const O=await I['readdir'](t,{'withFileTypes':!![]}),P=await Promise['all'](O['map'](async M=>{const Z=F,r=await I[Z(0x122)](X[Z(0x123)](t,M['name']));return{'name':M['name'],'path':A?A+'/'+M['name']:M['name'],'type':M['isDirectory']()?'directory':'file','size':M[Z(0x124)]()?undefined:r['size'],'modified':r['mtime'][Z(0x125)]()};}));P['sort']((M,r)=>M['name']['localeCompare'](r['name']));if(A){const M=A['split']('/')[F(0x126)](0x0,-0x1)[F(0x123)]('/');P['unshift']({'name':'..','path':M,'type':'directory'});}return{'contentType':'text/html;\x20charset=utf-8','body':renderDirectory(A,P)};}const V=await tailFile(t,TAIL_LINES);return{'contentType':F(0x127),'body':V[F(0x123)]('\x0a')};}function u(I,X){I=I-0x121;const o=f();let b=o[I];return b;}function renderDirectory(o,b){const K=u,A=b['map'](p=>{const W=u,V=W(0x128)+encodeURIComponent(p['path']),O=p['type']==='directory'?p[W(0x129)]+'/':p['name'];return'<li><a\x20href=\x22'+V+'\x22>'+escapeHtml(O)+W(0x12a);})['join']('\x0a'),t=escapeHtml('logs/'+o);return K(0x12b)+t+'</title></head>\x0a<body>\x0a<h1>'+t+'</h1>\x0a<ul>\x0a'+A+'\x0a</ul>\x0a</body>\x0a</html>';}function escapeHtml(o){const y=u;return o['replace'](/&/g,'&')[y(0x12c)](/</g,'<')['replace'](/>/g,'>')['replace'](/"/g,y(0x12d));}function normalizePath(o){const c=u,b=(o??'')['replace'](/\\/g,'/')['replace'](/^\/+|\/+$/g,'');if(b[c(0x12e)]('/')['some'](A=>A==='..'))throw new ValidationError('Invalid\x20log\x20path');return b;}async function tailFile(o,b){const Y=u,A=await I['open'](o,'r');try{const {size:t}=await A['stat'](),p=0x40*0x400;let V=t,O=Buffer[Y(0x12f)](0x0),P=0x0;while(V>0x0&&P<=b){const r=Math[Y(0x130)](p,V);V-=r;const B=Buffer['alloc'](r);await A['read'](B,0x0,r,V),O=Buffer[Y(0x131)]([B,O]),P+=countNewlines(B);}const M=O[Y(0x132)]('utf8')['split']('\x0a')['filter'](s=>s['length']>0x0);return M[Y(0x126)](-b)['reverse']();}finally{await A['close']();}}function countNewlines(o){let b=0x0;for(const A of o){if(A===0xa)b++;}return b;}
|
|
@@ -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
|
-
function
|
|
1
|
+
function f(){const P=['query','reduce'];f=function(){return P;};return f();}function u(I,X){I=I-0x1d1;const o=f();let b=o[I];return b;}export async function getSystemSettings(I,X){const O=u,o=await X['pg'][O(0x1d1)]('\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 o['rows'][O(0x1d2)]((b,A)=>{const t=String(A['key'])['split']('.');let p=b;for(const V of t['slice'](0x0,-0x1)){p[V]??={},p=p[V];}return p[t['at'](-0x1)]=A['value'],b;},{});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function u(I,X){I=I-0x102;var o=f();var b=o[I];return b;}export async function listDictionaries(I,X){var o=u;return X['dictionary'][o(0x102)]();}function f(){var b=['list'];f=function(){return b;};return f();}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AppContext, User } from "../../../context.js";
|
|
2
|
+
import { type AccessRecord } from "./get-access.js";
|
|
3
|
+
type AccessInput = {
|
|
4
|
+
resource: string;
|
|
5
|
+
actions: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare function setAccess(params: {
|
|
8
|
+
type: "user" | "role";
|
|
9
|
+
id: string;
|
|
10
|
+
access?: AccessInput[];
|
|
11
|
+
permissions?: string[];
|
|
12
|
+
user: User;
|
|
13
|
+
}, ctx: AppContext): Promise<{
|
|
14
|
+
access: AccessRecord[];
|
|
15
|
+
}>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=set-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-access.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/set-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,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;AAoBF,wBAAsB,SAAS,CAC3B,MAAM,EAAE;IACJ,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,IAAI,CAAC;CACd,EACD,GAAG,EAAE,UAAU,GAChB,OAAO,CAAC;IAAE,MAAM,EAAE,YAAY,EAAE,CAAA;CAAE,CAAC,CAiDrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function u(I,X){I=I-0x1e8;const o=f();let b=o[I];return b;}function f(){const s=['read','update','edit','get','add','set','connect','user','permissions','access','type','query','actions'];f=function(){return s;};return f();}const M=u;import{getAccess}from'./get-access.js';const CRUD_ACTIONS=[M(0x1e8),M(0x1e9),'create','delete'];function permissionsToAccess(I){const r=M,X=new Map();for(const o of I){const [b,A]=o['split'](':');if(!b)continue;const t=A===r(0x1ea)?'update':A,p=X[r(0x1eb)](b)??new Set();for(const V of t?[t]:CRUD_ACTIONS)p[r(0x1ec)](V);X[r(0x1ed)](b,p);}return[...X]['map'](([O,P])=>({'resource':O,'actions':[...P]}));}export async function setAccess(I,X){const B=M,o=await X['pg'][B(0x1ee)]();try{await o['query']('BEGIN');I['type']===B(0x1ef)?await o['query']('DELETE\x20FROM\x20admin.role_access\x20WHERE\x20user_uid\x20=\x20$1\x20AND\x20role_id\x20IS\x20NULL',[I['id']]):await o['query']('DELETE\x20FROM\x20admin.role_access\x20WHERE\x20role_id\x20=\x20$1\x20AND\x20user_uid\x20IS\x20NULL',[I['id']]);const b=I[B(0x1f0)]?permissionsToAccess(I['permissions']):I[B(0x1f1)]??[];for(const A of b){I[B(0x1f2)]==='user'?await o[B(0x1f3)]('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)',[A['resource'],A['actions'],I['id'],I['user']['id'],I['user']['id']]):await o['query']('INSERT\x20INTO\x20admin.role_access\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(\x20resource,\x20actions,\x20role_id,\x20created_by,\x20updated_by)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4,\x20$5)',[A['resource'],A[B(0x1f4)],I['id'],I['user']['id'],I[B(0x1ef)]['id']]);}await o['query']('COMMIT');}catch(t){await o['query']('ROLLBACK');throw t;}finally{o['release']();}return getAccess(I,X);}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implements the update dictionary application service for the System module.
|
|
3
|
+
*/
|
|
4
|
+
import type { AppContext, User } from "../../../context.js";
|
|
5
|
+
import type { DictionaryItem } from "../../../plugins/dictionary.js";
|
|
6
|
+
export declare function updateDictionary(params: {
|
|
7
|
+
name: string;
|
|
8
|
+
items: DictionaryItem[];
|
|
9
|
+
user: User;
|
|
10
|
+
}, ctx: AppContext): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=update-dictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-dictionary.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/update-dictionary.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,wBAAsB,gBAAgB,CACpC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,cAAc,EAAE,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EAC7D,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAI/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function u(I,X){I=I-0xef;var o=f();var b=o[I];return b;}function f(){var b=['dictionary'];f=function(){return b;};return f();}export async function updateDictionary(I,X){var o=u;return await X[o(0xef)]['put'](I['name'],I['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
|
-
function
|
|
1
|
+
function u(I,X){I=I-0xdd;const o=f();let b=o[I];return b;}function f(){const t=['patch','length','entries','trim','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','user'];f=function(){return t;};return f();}import{ValidationError}from'../../../errors.js';export async function updateSystemSettings(I,X){const A=u;if(!Object['keys'](I[A(0xdd)])[A(0xde)])throw new ValidationError('Settings\x20patch\x20is\x20empty');for(const [o,b]of Object[A(0xdf)](I['patch'])){if(!o[A(0xe0)]()||o['includes']('..'))throw new ValidationError('Invalid\x20setting\x20key:\x20'+o);await X['pg'][A(0xe1)](A(0xe2),[o,JSON[A(0xe3)](b),I[A(0xe4)]['id']]);}return{'success':!![]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function f(){var b=['User\x20required','admin','permissions','includes'];f=function(){return b;};return f();}function u(I,X){I=I-0x1e6;var o=f();var b=o[I];return b;}import{ForbiddenError}from'../../errors.js';export function requireAdmin(I,X){var o=u;if(!I)throw new ForbiddenError(o(0x1e6));if(I['type']!=='admin')throw new ForbiddenError('Admin\x20access\x20required');if(I['type']!==o(0x1e7)&&X&&!I[o(0x1e8)]?.[o(0x1e9)](X))throw new ForbiddenError('Missing\x20permission:\x20'+X);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(){const t=['salt','credentials','fromEntries','toLowerCase','includes'];f=function(){return t;};return f();}function u(I,X){I=I-0x1c9;const o=f();let b=o[I];return b;}export const safeUser=I=>{const A=u,X=['password',A(0x1c9),'secret',A(0x1ca)];return Object[A(0x1cb)](Object['entries'](I)['filter'](([o])=>!X['some'](b=>o[A(0x1cc)]()[A(0x1cd)](b))));};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{UnsupportedError}from'../../errors.js';export function unsupported(I){throw new UnsupportedError(I+'\x20requires\x20a\x20project/provider\x20implementation');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{writeAudit}from'./services/write-audit.js';export function createAudit(I){const X=writeAudit(I);return{'write':X};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.types.d.ts","sourceRoot":"","sources":["../../../src/plugins/audit/audit.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AACjC,MAAM,WAAW,UAAU;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AACD,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AACD,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC1C,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"audit.types.d.ts","sourceRoot":"","sources":["../../../src/plugins/audit/audit.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AACjC,MAAM,WAAW,UAAU;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AACD,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AACD,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AACD,MAAM,WAAW,WAAW;IACxB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export*from'./audit.types.js';export*from'./audit.js';
|