@opengis/fcore 0.0.1-beta.2 → 0.0.1-beta.21
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 +73 -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 +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
|
+
import{ValidationError}from'../../../errors.js';import{autoIndex}from'../../../plugins/resource/utils/auto-index.js';function r(n,k){n=n-0x17d;const Z=g();let K=Z[n];return K;}function g(){const m=['resource','field','lookup','value','text','\x20as\x20text\x20FROM\x20','\x20WHERE\x20lower(','then','length','Field\x20has\x20no\x20lookup\x20dictionary:\x20','startsWith','slice','map'];g=function(){return m;};return g();}export async function suggestResource(n,k){const O=r,Z=k[O(0x17d)]['get'](n['resource']),K=String(n['search']??n['q']??'')['toLowerCase'](),d=Math['min'](Math['max'](Number(n['limit']??0x14),0x1),0xc8),J=Date['now'](),B=Z['fields'][n[O(0x17e)]],l=B?.['dictionary'],f=B?.[O(0x17f)]?.['table'];if(f){const a=B['lookup']?.['text']??'name',H=B['lookup']?.[O(0x180)]??'id';autoIndex(f,a,O(0x181),k['pg']);const A=await k['pg']['query']('SELECT\x20'+H+'\x20as\x20id,\x20'+a+O(0x182)+f+O(0x183)+a+')\x20~\x20$1\x20LIMIT\x20$2',[''+K['toLowerCase'](),d])[O(0x184)](I=>I['rows']);return{'limit':d,'count':A[O(0x185)],'search':K,'time':Date['now']()-J,'data':A};}if(!l)throw new ValidationError(O(0x186)+n[O(0x17e)]);const R=await k['dictionary']['get'](l),Q=R['filter'](I=>!K||I['code'][O(0x187)](K)||I['name'][O(0x187)](K))[O(0x188)](0x0,d)[O(0x189)](I=>({'id':I['code']||I['id'],'text':I['name']||I['text']}));return{'search':K,'limit':d,'count':Q['length'],'time':Date['now']()-J,'data':Q};}
|
|
@@ -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 r(n,k){n=n-0x1e0;const Z=g();let K=Z[n];return K;}export async function updateResourceRelation(n,k){const f=r,{resource:Z,id:K,relation:d,relationId:J,data:B,user:l}=n;return k[f(0x1e0)][f(0x1e1)]({'name':Z,'id':K,'relation':d,'relationId':J,'data':B,'user':l});}function g(){const R=['resource','updateRelation'];g=function(){return R;};return g();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function updateResource(n,k){var Z=r;return k[Z(0x172)][Z(0x173)]({'name':n['resource'],'id':n['id'],'data':n[Z(0x174)],'user':n[Z(0x175)]});}function r(n,k){n=n-0x172;var Z=g();var K=Z[n];return K;}function g(){var K=['resource','update','patch','user'];g=function(){return K;};return g();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function g(){const l=['resource','get','access','admin','permission','length','replace','file','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'];g=function(){return l;};return g();}import{ForbiddenError,NotFoundError,ValidationError}from'../../../errors.js';function r(n,k){n=n-0xfb;const Z=g();let K=Z[n];return K;}export async function uploadResourceFile(n,k){const B=r,Z=k[B(0xfb)][B(0xfc)](n[B(0xfb)]);if(Z[B(0xfd)]===B(0xfe)&&n['user']?.['type']!=='admin')throw new ForbiddenError('Admin\x20access\x20required');if(n['user']?.['type']!=='admin'&&!n['user']?.['permissions']?.['includes']((Z[B(0xff)]??Z['name'])+':update'))throw new ForbiddenError('Missing\x20permission:\x20'+(Z['permission']??Z['name'])+':update');if(!Buffer['isBuffer'](n['file'])||n['file'][B(0x100)]===0x0)throw new ValidationError('File\x20is\x20required');const K=n['fileName'][B(0x101)](/[^A-Za-z0-9._-]/g,'_');if(!K)throw new ValidationError('File\x20name\x20is\x20required');const d='files/'+n[B(0xfb)]+'/'+String(n['id'])+'/'+K;await k['file']['put'](d,n[B(0x102)]);if(!await k['file']['exists'](d))throw new NotFoundError('Uploaded\x20file\x20not\x20found');const J=await k['pg'][B(0x103)](B(0x104),[n['resource'],String(n['id']),d,n['file']['length']]);return J['rows'][0x0];}
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { FastifyPluginAsync } from "fastify";
|
|
5
5
|
import type { AppContext } from "../../context.js";
|
|
6
|
-
|
|
6
|
+
import type { ApiRoute } from "../../type.js";
|
|
7
|
+
export declare function systemRoutes(ctx: AppContext, apiRoutes?: ReadonlyMap<string, ApiRoute>): FastifyPluginAsync;
|
|
7
8
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/system/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/system/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAanD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,wBAAgB,YAAY,CAC1B,GAAG,EAAE,UAAU,EACf,SAAS,GAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAa,GACnD,kBAAkB,CA8JpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const f=r;import{getSystemSettings}from'./services/get-system-settings.js';import{updateSystemSettings}from'./services/update-system-settings.js';import{getAuditLog}from'./services/get-audit-log.js';import{checkSystem}from'./services/check-system.js';import{getApiList}from'./services/get-api-list.js';function g(){const Q=['user','/api/dictionary/:name','fcore','params','Update\x20platform\x20dictionary','get','Get\x20access\x20rules','system:access','post','admin','accessTarget','access','body','/api/system/settings','system','Updates\x20system\x20settings\x20using\x20flat\x20dot-notation\x20keys.','settings','logger','Get\x20audit\x20log','/api/system/check','apiListQuery','query'];g=function(){return Q;};return g();}import{getSystemLog}from'./services/get-system-log.js';import{getDictionary}from'./services/get-dictionary.js';import{updateDictionary}from'./services/update-dictionary.js';import{getAccess}from'./services/get-access.js';import{setAccess}from'./services/set-access.js';function r(n,k){n=n-0xa9;const Z=g();let K=Z[n];return K;}import{systemSchemas}from'./schema.js';const u=n=>n[f(0xa9)];export function systemRoutes(n,k=new Map()){return async Z=>{const R=r;Z['get'](R(0xaa),{'schema':{'tags':[R(0xab),'system'],'summary':'Get\x20platform\x20dictionary','description':'Returns\x20a\x20registered\x20platform\x20dictionary\x20by\x20name.','access':'user','permissions':['system:dictionaries'],'params':systemSchemas['dictionaryName']}},async d=>({'items':await getDictionary({...d[R(0xac)],'user':u(d)},n)})),Z['post'](R(0xaa),{'schema':{'tags':[R(0xab),'system'],'summary':R(0xad),'description':'Replaces\x20the\x20items\x20of\x20a\x20registered\x20platform\x20dictionary.','access':R(0xa9),'permissions':['system:dictionaries'],'params':systemSchemas['dictionaryName'],'body':systemSchemas['dictionaryItems']}},async d=>updateDictionary({...d['params'],...d['body'],'user':u(d)},n));const K=async d=>getAccess({...d[R(0xac)],'user':u(d)},n);Z[R(0xae)]('/api/access/:type/:id',{'schema':{'tags':['fcore','system'],'summary':R(0xaf),'description':'Returns\x20direct\x20and\x20role-based\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','access':'admin','permissions':[R(0xb0)],'params':systemSchemas['accessTarget']}},K),Z[R(0xb1)]('/api/access/:type/:id',{'schema':{'tags':['fcore','system'],'summary':'Set\x20access\x20rules','description':'Replaces\x20direct\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','access':R(0xb2),'permissions':['system:access'],'params':systemSchemas[R(0xb3)],'body':systemSchemas[R(0xb4)]}},async d=>setAccess({...d['params'],...d[R(0xb5)],'user':u(d)},n)),Z[R(0xae)](R(0xb6),{'schema':{'tags':[R(0xab),'system'],'summary':'Get\x20system\x20settings','description':'Returns\x20system\x20settings\x20as\x20nested\x20JSON.','access':R(0xb2),'permissions':['system:settings']}},async d=>getSystemSettings({...d['params'],'user':u(d)},n)),Z['post']('/api/system/settings',{'schema':{'tags':['fcore',R(0xb7)],'summary':'Update\x20system\x20settings','description':R(0xb8),'access':'admin','permissions':['system:settings'],'body':systemSchemas[R(0xb9)]}},async d=>updateSystemSettings({...d[R(0xac)],'patch':d['body'],'user':u(d)},n)),Z['get']('/api/system/logger',{'schema':{'tags':['fcore','system'],'summary':'Get\x20system\x20log','description':'Returns\x20system\x20logger\x20entries\x20for\x20the\x20requested\x20path.','access':'user','permissions':['system:logs'],'querystring':systemSchemas[R(0xba)]}},async(d,J)=>{const {contentType:B,body:l}=await getSystemLog({...d['query'],'user':u(d)},n);return J['type'](B)['send'](l);}),Z['get']('/api/system/audit',{'schema':{'tags':[R(0xab),'system'],'summary':R(0xbb),'description':'Returns\x20the\x20system\x20audit\x20log\x20entries.','access':'user','permissions':['system:audit']}},async d=>getAuditLog({...d['query'],'user':u(d)},n)),Z['get'](R(0xbc),{'schema':{'tags':['fcore','system'],'summary':'Check\x20system\x20health','description':'Checks\x20the\x20availability\x20of\x20system\x20dependencies.','access':'user','permissions':['system:check']}},async d=>checkSystem({'user':u(d)},n)),Z['get']('/api/system/list',{'schema':{'tags':['fcore','system'],'summary':'List\x20APIs','description':'Returns\x20the\x20list\x20of\x20registered\x20platform\x20APIs.','access':'admin','permissions':[],'querystring':systemSchemas[R(0xbd)]}},async d=>getApiList({'user':u(d),'apiRoutes':k,...d[R(0xbe)]},n));};}
|
|
@@ -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
|
-
|
|
1
|
+
function r(n,k){n=n-0x13f;const Z=g();let K=Z[n];return K;}const n=r;import{Type}from'@sinclair/typebox';function g(){const k=['^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$','String','Union','Number','user','Object','^[A-Za-z0-9_-]+(?::[A-Za-z0-9_-]+)?$','Literal','extended'];g=function(){return k;};return g();}export const identifier=Type['String']({'minLength':0x1,'maxLength':0x80,'pattern':n(0x13f)});export const systemSchemas={'dictionaryName':Type['Object']({'name':identifier}),'dictionaryItems':Type['Object']({'items':Type['Array'](Type['Object']({'id':Type['Optional'](Type['Union']([Type['String'](),Type['Number']()])),'code':Type['String']({'minLength':0x1}),'name':Type[n(0x140)]({'minLength':0x1}),'parentId':Type['Optional'](Type[n(0x141)]([Type['String'](),Type[n(0x142)](),Type['Null']()]))},{'additionalProperties':!![]}))}),'accessTarget':Type['Object']({'type':Type['Union']([Type['Literal'](n(0x143)),Type['Literal']('role')]),'id':identifier}),'access':Type[n(0x144)]({'permissions':Type['Optional'](Type['Array'](Type[n(0x140)]({'minLength':0x1,'maxLength':0x80,'pattern':n(0x145)}))),'access':Type['Optional'](Type['Array'](Type['Object']({'resource':Type['String']({'minLength':0x1,'maxLength':0x80}),'actions':Type['Array'](Type[n(0x140)]({'minLength':0x1,'maxLength':0x80}),{'minItems':0x1})})))}),'apiListQuery':Type['Object']({'format':Type['Optional'](Type['Union']([Type[n(0x146)]('short'),Type['Literal'](n(0x147))]))}),'settingsEntity':Type[n(0x144)]({'entity':Type['Optional'](identifier)}),'settings':Type['Record'](Type['String']({'minLength':0x1}),Type['Unknown']()),'logger':Type[n(0x144)]({'path':Type['Optional'](Type[n(0x140)]({'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
|
-
|
|
1
|
+
export async function checkSystem(n,k){const d=r,[Z,K]=await Promise['allSettled']([k['pg']['query']('SELECT\x201'),k['redis']['ping']()]);return{'status':Z['status']===d(0x6a)&&K['status']===d(0x6a)?'ok':'degraded','pg':Z['status'],'redis':K['status']};}function r(n,k){n=n-0x6a;const Z=g();let K=Z[n];return K;}function g(){const J=['fulfilled'];g=function(){return J;};return g();}
|
|
@@ -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 r(n,k){n=n-0x170;const Z=g();let K=Z[n];return K;}function g(){const l=['type','\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','filter'];g=function(){return l;};return g();}export async function getAccess(n,k){const B=r,Z=n[B(0x170)]==='user'?B(0x171):B(0x172),K=await k['pg']['query'](Z,[n['id']]),d=[...new Set(K['rows']['map'](J=>J['resource'])[B(0x173)](J=>J!==null))];return{'access':K['rows'],'resources':d};}
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Implements the get API list application service for the System module.
|
|
3
3
|
*/
|
|
4
4
|
import type { AppContext, User } from "../../../context.js";
|
|
5
|
+
import type { ApiRoute } from "../../../type.js";
|
|
5
6
|
export declare function getApiList(params: {
|
|
6
7
|
user: User;
|
|
7
|
-
|
|
8
|
+
apiRoutes: ReadonlyMap<string, ApiRoute>;
|
|
9
|
+
format?: "short" | "extended";
|
|
10
|
+
}, ctx: AppContext): Promise<ApiRoute[] | string[]>;
|
|
8
11
|
//# sourceMappingURL=get-api-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-api-list.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-api-list.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-api-list.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-api-list.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,kBAAkB,CAAC;AAEhE,wBAAsB,UAAU,CAC9B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;CAC/B,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC,CAWhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function r(n,k){n=n-0x157;const Z=g();let K=Z[n];return K;}function g(){const f=['values','sort','format','map'];g=function(){return f;};return g();}export async function getApiList(n,k){const l=r,Z=[...n['apiRoutes'][l(0x157)]()][l(0x158)]((K,d)=>(K['endpoint']+'\x20'+K['method'])['localeCompare'](d['endpoint']+'\x20'+d['method']));if(n[l(0x159)]!=='short')return Z;return Z[l(0x15a)](({method:K,endpoint:d,access:J,permissions:B})=>K+'\x20'+d);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-audit-log.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-audit-log.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,WAAW,CAC/B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"get-audit-log.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-audit-log.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,WAAW,CAC/B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAcd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function getAuditLog(n,k){const J=r,Z=Math['min'](Math['max'](n['limit']??0x32,0x1),0xc8),K=Math[J(0x67)]((n['page']??0x1)-0x1,0x0)*Z,d=await k['pg'][J(0x68)]('SELECT\x20*\x20FROM\x20admin.audit_log\x20ORDER\x20BY\x20id\x20DESC\x20LIMIT\x20$1\x20OFFSET\x20$2',[Z,K]);return{'rows':d['rows'],'page':n['page']??0x1,'limit':Z};}function r(n,k){n=n-0x67;const Z=g();let K=Z[n];return K;}function g(){const B=['max','query'];g=function(){return B;};return g();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function getDictionary(n,k){return k['dictionary']['get'](n['name']);}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { AppContext, User } from "../../../context.js";
|
|
2
|
+
export interface LogResult {
|
|
3
|
+
contentType: string;
|
|
4
|
+
body: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function getSystemLog(params: {
|
|
7
|
+
path?: string;
|
|
8
|
+
user: User;
|
|
9
|
+
}, ctx: AppContext): Promise<LogResult>;
|
|
6
10
|
//# sourceMappingURL=get-system-log.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-system-log.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-system-log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-system-log.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-system-log.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAc5D,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EACrC,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,SAAS,CAAC,CA0CpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function g(){const b=['resolve','file','isDirectory','mtime','toISOString','text/html;\x20charset=utf-8','?path=','directory','</a></li>','join','</title></head>\x0a<body>\x0a<h1>','\x0a</ul>\x0a</body>\x0a</html>','replace','>','"','split','some','Invalid\x20log\x20path','alloc','concat','utf8','slice','reverse'];g=function(){return b;};return g();}import n from'node:fs/promises';import k from'node:path';import{NotFoundError,ValidationError}from'../../../errors.js';const LOGS_ROOT=k['resolve'](process['cwd'](),'logs'),TAIL_LINES=0x64;function r(n,k){n=n-0x8d;const Z=g();let K=Z[n];return K;}export async function getSystemLog(Z,K){const I=r,d=normalizePath(Z['path']),J=k[I(0x8d)](LOGS_ROOT,d);if(J!==LOGS_ROOT&&!J['startsWith'](LOGS_ROOT+k['sep']))throw new ValidationError('Invalid\x20log\x20path');const B=await n['stat'](J)['catch'](()=>null);if(!B)throw new NotFoundError('Log\x20path\x20not\x20found');if(B['isDirectory']()){const f=await n['readdir'](J,{'withFileTypes':!![]}),R=await Promise['all'](f['map'](async Q=>{const O=I,a=await n['stat'](k['join'](J,Q['name']));return{'name':Q['name'],'path':d?d+'/'+Q['name']:Q['name'],'type':Q['isDirectory']()?'directory':O(0x8e),'size':Q[O(0x8f)]()?undefined:a['size'],'modified':a[O(0x90)][O(0x91)]()};}));R['sort']((Q,H)=>Q['name']['localeCompare'](H['name']));if(d){const Q=d['split']('/')['slice'](0x0,-0x1)['join']('/');R['unshift']({'name':'..','path':Q,'type':'directory'});}return{'contentType':I(0x92),'body':renderDirectory(d,R)};}const l=await tailFile(J,TAIL_LINES);return{'contentType':'text/plain;\x20charset=utf-8','body':l['join']('\x0a')};}function renderDirectory(Z,K){const p=r,d=K['map'](B=>{const m=r,l=m(0x93)+encodeURIComponent(B['path']),f=B['type']===m(0x94)?B['name']+'/':B['name'];return'<li><a\x20href=\x22'+l+'\x22>'+escapeHtml(f)+m(0x95);})[p(0x96)]('\x0a'),J=escapeHtml('logs/'+Z);return'<!DOCTYPE\x20html>\x0a<html>\x0a<head><meta\x20charset=\x22utf-8\x22><title>'+J+p(0x97)+J+'</h1>\x0a<ul>\x0a'+d+p(0x98);}function escapeHtml(Z){const C=r;return Z['replace'](/&/g,'&')[C(0x99)](/</g,'<')['replace'](/>/g,C(0x9a))['replace'](/"/g,C(0x9b));}function normalizePath(Z){const T=r,K=(Z??'')[T(0x99)](/\\/g,'/')[T(0x99)](/^\/+|\/+$/g,'');if(K[T(0x9c)]('/')[T(0x9d)](d=>d==='..'))throw new ValidationError(T(0x9e));return K;}async function tailFile(Z,K){const c=r,d=await n['open'](Z,'r');try{const {size:J}=await d['stat'](),B=0x40*0x400;let l=J,f=Buffer['alloc'](0x0),R=0x0;while(l>0x0&&R<=K){const a=Math['min'](B,l);l-=a;const H=Buffer[c(0x9f)](a);await d['read'](H,0x0,a,l),f=Buffer[c(0xa0)]([H,f]),R+=countNewlines(H);}const Q=f['toString'](c(0xa1))['split']('\x0a')['filter'](A=>A['length']>0x0);return Q[c(0xa2)](-K)[c(0xa3)]();}finally{await d['close']();}}function countNewlines(Z){let K=0x0;for(const d of Z){if(d===0xa)K++;}return K;}
|
|
@@ -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 r(n,k){n=n-0xd2;const Z=g();let K=Z[n];return K;}export async function getSystemSettings(n,k){const Z=await k['pg']['query']('\x0a\x20\x20\x20\x20\x20\x20SELECT\x20key,\x20value\x0a\x20\x20\x20\x20\x20\x20FROM\x20admin.settings\x0a\x20\x20\x20\x20\x20\x20WHERE\x20resource\x20=\x20\x27system\x27\x20AND\x20resource_id\x20IS\x20NULL\x0a\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20key\x0a\x20\x20\x20\x20');return Z['rows']['reduce']((K,d)=>{const f=r,J=String(d['key'])[f(0xd2)]('.');let B=K;for(const l of J['slice'](0x0,-0x1)){B[l]??={},B=B[l];}return B[J['at'](-0x1)]=d['value'],K;},{});}function g(){const R=['split'];g=function(){return R;};return g();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function listDictionaries(n,k){return k['dictionary']['list']();}
|
|
@@ -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
|
+
import{getAccess}from'./get-access.js';const CRUD_ACTIONS=['read','update','create','delete'];function g(){const H=['update','get','add','set','connect','user','DELETE\x20FROM\x20admin.role_access\x20WHERE\x20user_uid\x20=\x20$1\x20AND\x20role_id\x20IS\x20NULL','query','permissions','access','type','INSERT\x20INTO\x20admin.role_access\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(\x20resource,\x20actions,\x20user_uid,\x20created_by,\x20updated_by)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4,\x20$5)','resource'];g=function(){return H;};return g();}function r(n,k){n=n-0x8a;const Z=g();let K=Z[n];return K;}function permissionsToAccess(n){const Q=r,k=new Map();for(const Z of n){const [K,d]=Z['split'](':');if(!K)continue;const J=d==='edit'?Q(0x8a):d,B=k[Q(0x8b)](K)??new Set();for(const l of J?[J]:CRUD_ACTIONS)B[Q(0x8c)](l);k[Q(0x8d)](K,B);}return[...k]['map'](([f,R])=>({'resource':f,'actions':[...R]}));}export async function setAccess(n,k){const a=r,Z=await k['pg'][a(0x8e)]();try{await Z['query']('BEGIN');n['type']===a(0x8f)?await Z['query'](a(0x90),[n['id']]):await Z[a(0x91)]('DELETE\x20FROM\x20admin.role_access\x20WHERE\x20role_id\x20=\x20$1\x20AND\x20user_uid\x20IS\x20NULL',[n['id']]);const K=n[a(0x92)]?permissionsToAccess(n[a(0x92)]):n[a(0x93)]??[];for(const d of K){n[a(0x94)]===a(0x8f)?await Z['query'](a(0x95),[d[a(0x96)],d['actions'],n['id'],n['user']['id'],n['user']['id']]):await Z['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)',[d[a(0x96)],d['actions'],n['id'],n[a(0x8f)]['id'],n[a(0x8f)]['id']]);}await Z['query']('COMMIT');}catch(J){await Z[a(0x91)]('ROLLBACK');throw J;}finally{Z['release']();}return getAccess(n,k);}
|
|
@@ -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 g(){var K=['put','items'];g=function(){return K;};return g();}function r(n,k){n=n-0x116;var Z=g();var K=Z[n];return K;}export async function updateDictionary(n,k){var Z=r;return await k['dictionary'][Z(0x116)](n['name'],n[Z(0x117)]),{'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
|
+
import{ValidationError}from'../../../errors.js';export async function updateSystemSettings(n,k){const d=r;if(!Object[d(0xd1)](n['patch'])['length'])throw new ValidationError('Settings\x20patch\x20is\x20empty');for(const [Z,K]of Object['entries'](n['patch'])){if(!Z['trim']()||Z['includes']('..'))throw new ValidationError('Invalid\x20setting\x20key:\x20'+Z);await k['pg']['query']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.settings\x20(resource,\x20resource_id,\x20key,\x20value,\x20updated_by)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20(\x27system\x27,\x20NULL,\x20$1,\x20$2::jsonb,\x20$3)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20CONFLICT\x20(resource,\x20resource_id,\x20key)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20DO\x20UPDATE\x20SET\x20value\x20=\x20EXCLUDED.value,\x20updated_by\x20=\x20EXCLUDED.updated_by,\x20updated_at\x20=\x20now()\x0a\x20\x20\x20\x20\x20\x20\x20\x20',[Z,JSON['stringify'](K),n['user']['id']]);}return{'success':!![]};}function r(n,k){n=n-0xd1;const Z=g();let K=Z[n];return K;}function g(){const J=['keys'];g=function(){return J;};return g();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{ForbiddenError}from'../../errors.js';function g(){var K=['User\x20required','type'];g=function(){return K;};return g();}function r(n,k){n=n-0x1a8;var Z=g();var K=Z[n];return K;}export function requireAdmin(n,k){var Z=r;if(!n)throw new ForbiddenError(Z(0x1a8));if(n[Z(0x1a9)]!=='admin')throw new ForbiddenError('Admin\x20access\x20required');if(n['type']!=='admin'&&k&&!n['permissions']?.['includes'](k))throw new ForbiddenError('Missing\x20permission:\x20'+k);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export const safeUser=n=>{const d=r,k=['password',d(0x149),'secret','credentials'];return Object['fromEntries'](Object['entries'](n)['filter'](([Z])=>!k['some'](K=>Z['toLowerCase']()['includes'](K))));};function r(n,k){n=n-0x149;const Z=g();let K=Z[n];return K;}function g(){const J=['salt'];g=function(){return J;};return g();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{UnsupportedError}from'../../errors.js';export function unsupported(n){throw new UnsupportedError(n+'\x20requires\x20a\x20project/provider\x20implementation');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{writeAudit}from'./services/write-audit.js';export function createAudit(n){const k=writeAudit(n);return{'write':k};}
|
|
@@ -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';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const secretPattern=/password|token|secret|credential|salt/i;function clean(n){if(Array['isArray'](n))return n['map'](clean);if(n&&typeof n==='object')return Object['fromEntries'](Object['entries'](n)['map'](([k,Z])=>[k,secretPattern['test'](k)?'[REDACTED]':clean(Z)]));return n;}export function writeAudit(n){let k,Z;async function K(){const R=r;if(!n['pg'])return![];if(k!==undefined)return k;return Z??=n['pg']['query'](R(0x140))['then'](d=>{const Q=R,J=new Set(d['rows']['map'](B=>B['table_name']));return k=J[Q(0x141)]('audit_log')&&J['has']('audit_log_data'),!k&&n['logger']['warn']({'expectedTables':['admin.audit_log','admin.audit_log_data'],'foundTables':[...J]},'Audit\x20tables\x20are\x20unavailable;\x20audit\x20writes\x20are\x20disabled'),k;})[R(0x142)](d=>{const a=R;return k=![],n['logger'][a(0x143)]({'err':d},'Unable\x20to\x20check\x20audit\x20tables;\x20audit\x20writes\x20are\x20disabled'),![];}),Z;}return async function d(J){const H=r;if(!await K())return n['logger'][H(0x144)]({'auditFallback':!![],'event':clean({...J,'changes':J['changes']?.['map'](f=>({...f,'oldValue':clean(f['oldValue']),'newValue':clean(f['newValue'])}))})},'audit'),0x0;if(!n['pg'])throw new Error('empty\x20pg');const B=await n['pg']['query']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.audit_log\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20user_id,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20module,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20resource,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20resource_id,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20fields,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20action,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20request_id,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ip_address,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20metadata\x0a\x20\x20\x20\x20\x20\x20\x20\x20)\x0a\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4,\x20$5,\x20$6,\x20$7,\x20$8,\x20$9)\x0a\x20\x20\x20\x20\x20\x20\x20\x20RETURNING\x20id\x0a\x20\x20\x20\x20\x20\x20',[J['userId']??null,J['module'],J[H(0x145)],J['resourceId']==null?null:String(J['resourceId']),J['fields']??null,J['action'],J['requestId']??null,J['ipAddress']??null,clean(J['metadata']??{})]),l=B['rows'][0x0]['id'];for(const f of J['changes']??[]){if(secretPattern['test'](f['field']))continue;await n['pg']['query'](H(0x146),[l,f['field'],JSON['stringify'](clean(f[H(0x147)])),JSON[H(0x148)](clean(f['newValue']))]);}return l;};}function r(n,k){n=n-0x140;const Z=g();let K=Z[n];return K;}function g(){const A=['\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','has','catch','warn','info','resource','\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','oldValue','stringify'];g=function(){return A;};return g();}
|