@opengis/fcore 0.0.1-beta.6 → 0.0.1-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.js +1 -1
- package/dist/context.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/fastify.d.ts +2 -1
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fcore.js +1 -1
- package/dist/migrations/cli.js +1 -1
- package/dist/migrations/runner.js +1 -1
- package/dist/modules/auth/adduser-cli.js +1 -1
- package/dist/modules/auth/passwd-cli.js +1 -1
- package/dist/modules/auth/permission-cli.js +1 -1
- package/dist/modules/auth/route.d.ts.map +1 -1
- package/dist/modules/auth/route.js +1 -1
- package/dist/modules/auth/schema.d.ts +3 -0
- package/dist/modules/auth/schema.d.ts.map +1 -1
- package/dist/modules/auth/schema.js +1 -1
- package/dist/modules/auth/services/change-password.js +1 -1
- package/dist/modules/auth/services/get-current-user.d.ts +1 -0
- package/dist/modules/auth/services/get-current-user.d.ts.map +1 -1
- package/dist/modules/auth/services/get-current-user.js +1 -1
- package/dist/modules/auth/services/registration.js +1 -1
- package/dist/modules/auth/services/verify-two-factor.js +1 -1
- package/dist/modules/file/mime.d.ts +3 -0
- package/dist/modules/file/mime.d.ts.map +1 -0
- package/dist/modules/file/mime.js +1 -0
- package/dist/modules/file/route.d.ts.map +1 -1
- package/dist/modules/file/route.js +1 -1
- package/dist/modules/file/schema.d.ts +3 -0
- package/dist/modules/file/schema.d.ts.map +1 -1
- package/dist/modules/file/schema.js +1 -1
- package/dist/modules/file/services/get-file.js +1 -1
- package/dist/modules/file/services/resize-file.d.ts.map +1 -1
- package/dist/modules/file/services/resize-file.js +1 -1
- package/dist/modules/file/services/upload-file.d.ts +4 -6
- package/dist/modules/file/services/upload-file.d.ts.map +1 -1
- package/dist/modules/file/services/upload-file.js +1 -1
- package/dist/modules/resource/route.d.ts +0 -3
- package/dist/modules/resource/route.d.ts.map +1 -1
- package/dist/modules/resource/route.js +1 -1
- package/dist/modules/resource/schema.d.ts +3 -0
- package/dist/modules/resource/schema.d.ts.map +1 -1
- package/dist/modules/resource/schema.js +1 -1
- package/dist/modules/resource/services/add-note.js +1 -1
- package/dist/modules/resource/services/add-resource-file.js +1 -1
- package/dist/modules/resource/services/create-resource-relation.js +1 -1
- package/dist/modules/resource/services/create-resource.js +1 -1
- package/dist/modules/resource/services/delete-resource-relation.js +1 -1
- package/dist/modules/resource/services/delete-resource.js +1 -1
- package/dist/modules/resource/services/export-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/export-resource.js +1 -1
- package/dist/modules/resource/services/get-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/get-resource.js +1 -1
- package/dist/modules/resource/services/list-resource-relation.d.ts +2 -0
- package/dist/modules/resource/services/list-resource-relation.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resource-relation.js +1 -1
- package/dist/modules/resource/services/list-resources.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resources.js +1 -1
- package/dist/modules/resource/services/search-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/search-resource.js +1 -1
- package/dist/modules/resource/services/suggest-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/suggest-resource.js +1 -1
- package/dist/modules/resource/services/update-resource-relation.d.ts +10 -0
- package/dist/modules/resource/services/update-resource-relation.d.ts.map +1 -0
- package/dist/modules/resource/services/update-resource-relation.js +1 -0
- package/dist/modules/resource/services/update-resource.js +1 -1
- package/dist/modules/resource/services/upload-resource-file.js +1 -1
- package/dist/modules/system/route.d.ts.map +1 -1
- package/dist/modules/system/route.js +1 -1
- package/dist/modules/system/schema.js +1 -1
- package/dist/modules/system/services/check-system.d.ts.map +1 -1
- package/dist/modules/system/services/check-system.js +1 -1
- package/dist/modules/system/services/get-access.d.ts.map +1 -1
- package/dist/modules/system/services/get-access.js +1 -1
- package/dist/modules/system/services/get-api-list.d.ts.map +1 -1
- package/dist/modules/system/services/get-api-list.js +1 -1
- package/dist/modules/system/services/get-audit-log.d.ts.map +1 -1
- package/dist/modules/system/services/get-audit-log.js +1 -1
- package/dist/modules/system/services/get-dictionary.js +1 -1
- package/dist/modules/system/services/get-system-log.d.ts.map +1 -1
- package/dist/modules/system/services/get-system-log.js +1 -1
- package/dist/modules/system/services/get-system-settings.d.ts.map +1 -1
- package/dist/modules/system/services/get-system-settings.js +1 -1
- package/dist/modules/system/services/list-dictionaries.js +1 -1
- package/dist/modules/system/services/set-access.d.ts.map +1 -1
- package/dist/modules/system/services/set-access.js +1 -1
- package/dist/modules/system/services/update-dictionary.d.ts.map +1 -1
- package/dist/modules/system/services/update-dictionary.js +1 -1
- package/dist/modules/system/services/update-system-settings.d.ts.map +1 -1
- package/dist/modules/system/services/update-system-settings.js +1 -1
- package/dist/modules/utils/require-admin.js +1 -1
- package/dist/modules/utils/safe-user.js +1 -1
- package/dist/modules/utils/unsupported.js +1 -1
- package/dist/plugins/audit/audit.js +1 -1
- package/dist/plugins/audit/services/write-audit.js +1 -1
- package/dist/plugins/auth/get-user-permissions.js +1 -1
- package/dist/plugins/auth/index.d.ts.map +1 -1
- package/dist/plugins/auth/index.js +1 -1
- package/dist/plugins/auth/verifyUser.js +1 -1
- package/dist/plugins/dictionary.d.ts +3 -0
- package/dist/plugins/dictionary.d.ts.map +1 -1
- package/dist/plugins/dictionary.js +1 -1
- package/dist/plugins/file.d.ts +3 -6
- package/dist/plugins/file.d.ts.map +1 -1
- package/dist/plugins/file.js +1 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/jwt.d.ts +4 -0
- package/dist/plugins/jwt.d.ts.map +1 -0
- package/dist/plugins/jwt.js +1 -0
- package/dist/plugins/logger/index.js +1 -1
- package/dist/plugins/logger/transport.js +1 -1
- package/dist/plugins/pg.d.ts.map +1 -1
- package/dist/plugins/pg.js +1 -1
- package/dist/plugins/redis.js +1 -1
- package/dist/plugins/resource/resource.d.ts.map +1 -1
- package/dist/plugins/resource/resource.js +1 -1
- package/dist/plugins/resource/resource.registry.js +1 -1
- package/dist/plugins/resource/resource.types.d.ts +18 -3
- package/dist/plugins/resource/resource.types.d.ts.map +1 -1
- package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts +3 -0
- package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-dictionary-lookup-data.js +1 -0
- package/dist/plugins/resource/services/add-file-token.d.ts +3 -0
- package/dist/plugins/resource/services/add-file-token.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-file-token.js +1 -0
- package/dist/plugins/resource/services/add-table-lookup-data.d.ts +4 -0
- package/dist/plugins/resource/services/add-table-lookup-data.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-table-lookup-data.js +1 -0
- package/dist/plugins/resource/services/create-relation.js +1 -1
- package/dist/plugins/resource/services/create.d.ts.map +1 -1
- package/dist/plugins/resource/services/create.js +1 -1
- package/dist/plugins/resource/services/delete-relation.js +1 -1
- package/dist/plugins/resource/services/delete.d.ts.map +1 -1
- package/dist/plugins/resource/services/delete.js +1 -1
- package/dist/plugins/resource/services/find-one.d.ts +3 -2
- package/dist/plugins/resource/services/find-one.d.ts.map +1 -1
- package/dist/plugins/resource/services/find-one.js +1 -1
- package/dist/plugins/resource/services/find-relation.d.ts +3 -2
- package/dist/plugins/resource/services/find-relation.d.ts.map +1 -1
- package/dist/plugins/resource/services/find-relation.js +1 -1
- package/dist/plugins/resource/services/find.d.ts.map +1 -1
- package/dist/plugins/resource/services/find.js +1 -1
- package/dist/plugins/resource/services/update-relation.d.ts +11 -0
- package/dist/plugins/resource/services/update-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/update-relation.js +1 -0
- package/dist/plugins/resource/services/update.d.ts.map +1 -1
- package/dist/plugins/resource/services/update.js +1 -1
- package/dist/plugins/resource/utils/auto-index.d.ts +4 -0
- package/dist/plugins/resource/utils/auto-index.d.ts.map +1 -0
- package/dist/plugins/resource/utils/auto-index.js +1 -0
- package/dist/plugins/resource/utils/fields.js +1 -1
- package/dist/plugins/resource/utils/filters.d.ts +3 -2
- package/dist/plugins/resource/utils/filters.d.ts.map +1 -1
- package/dist/plugins/resource/utils/filters.js +1 -1
- package/dist/plugins/resource/utils/permissions.js +1 -1
- package/dist/plugins/resource/utils/sort.d.ts.map +1 -1
- package/dist/plugins/resource/utils/sort.js +1 -1
- package/dist/plugins/resource/utils/sql.js +1 -1
- package/dist/shared/getIP.js +1 -1
- package/migrations/20260907090000_core_schema.sql +2 -0
- package/package.json +93 -92
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function A(z,j){z=z-0x10f;const c=U();let p=c[z];return p;}function U(){const b=['resource'];U=function(){return b;};return U();}export async function deleteResourceRelation(z,j){const i=A,{resource:c,id:p,relation:M,relationId:H}=z;return j[i(0x10f)]['deleteRelation']({'name':c,'id':p,'relation':M,'relationId':H});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function deleteResource(
|
|
1
|
+
function A(z,j){z=z-0x186;var c=U();var p=c[z];return p;}export async function deleteResource(z,j){var c=A;return j[c(0x186)]['delete']({'name':z['resource'],'id':z['id'],'user':z['user']});}function U(){var p=['resource'];U=function(){return p;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/export-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"export-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/export-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,wBAAsB,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAcrG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';function A(z,j){z=z-0x1c3;const c=U();let p=c[z];return p;}function U(){const M=['find'];U=function(){return M;};return U();}export async function exportResource(z,j){const p=A,c=await j['resource'][p(0x1c3)]({'name':z['resource'],'query':{'filter':parseFilterQuery(z),'sort':z['sort'],'search':z['search'],'limit':z['limit'],'offset':z['offset'],'fields':z['fields']},'user':z['user']});return c['rows'];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/get-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,wBAAsB,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"get-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/get-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,wBAAsB,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAO5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function getResource(z,j){var c=A;return j[c(0x183)]['findOne']({'name':z['resource'],'id':z['id'],'query':{'include':z[c(0x184)]},'user':z['user']});}function A(z,j){z=z-0x183;var c=U();var p=c[z];return p;}function U(){var p=['resource','include'];U=function(){return p;};return U();}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
* Implements the list resource relation application service for its module.
|
|
3
3
|
*/
|
|
4
4
|
import type { AppContext, User } from '../../../context.js';
|
|
5
|
+
import type { ResourceQuery } from '../../../plugins/resource/resource.types.js';
|
|
5
6
|
export declare function listResourceRelation(params: {
|
|
6
7
|
resource: string;
|
|
7
8
|
id: string;
|
|
8
9
|
relation: string;
|
|
10
|
+
query?: ResourceQuery;
|
|
9
11
|
user?: User;
|
|
10
12
|
}, ctx: AppContext): Promise<any>;
|
|
11
13
|
//# sourceMappingURL=list-resource-relation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"list-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF,wBAAsB,oBAAoB,CACxC,MAAM,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function listResourceRelation(
|
|
1
|
+
function U(){const n=['resource'];U=function(){return n;};return U();}function A(z,j){z=z-0x7b;const c=U();let p=c[z];return p;}export async function listResourceRelation(z,j){const b=A,{resource:c,id:p,relation:M,query:H,user:i}=z;return j[b(0x7b)]['findRelation']({'name':c,'id':p,'relation':M,'query':H,'user':i});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-resources.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"list-resources.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAY9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function A(z,j){z=z-0x184;var c=U();var p=c[z];return p;}import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';export async function listResources(z,j){var c=A;return j['resource']['find']({'name':z['resource'],'query':{'filter':parseFilterQuery(z),'sort':z['sort'],'search':z['search'],'limit':z[c(0x184)],'offset':z[c(0x185)]??(z[c(0x186)]?Math[c(0x187)](z['page']-0x1,0x0):0x0)*(z['limit']??0x14)},'user':z['user']});}function U(){var p=['limit','offset','page','max'];U=function(){return p;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/search-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"search-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/search-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAE/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function searchResource(
|
|
1
|
+
function A(z,j){z=z-0x1c0;var c=U();var p=c[z];return p;}import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';export async function searchResource(z,j){var c=A;return j['resource']['find']({'name':z['resource'],'query':{...z,'filter':parseFilterQuery(z)},'user':z[c(0x1c0)]});}function U(){var p=['user'];U=function(){return p;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/suggest-resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"suggest-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/suggest-resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,KAAK,qBAAqB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAElB,CAAC;AAEF,wBAAsB,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA4ClG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ValidationError}from'../../../errors.js';function
|
|
1
|
+
import{ValidationError}from'../../../errors.js';function A(z,j){z=z-0x119;const c=U();let p=c[z];return p;}import{autoIndex}from'../../../plugins/resource/utils/auto-index.js';export async function suggestResource(z,j){const P=A,c=j['resource'][P(0x119)](z[P(0x11a)]),p=String(z['search']??z['q']??'')['toLowerCase'](),M=Math['min'](Math['max'](Number(z[P(0x11b)]??0x14),0x1),0xc8),H=Date[P(0x11c)](),i=c['fields'][z['field']],b=i?.['lookup']?.['dictionary'],n=i?.['lookup']?.[P(0x11d)];if(n){const q=i['lookup']?.[P(0x11e)]??P(0x11f),Z=i[P(0x120)]?.['valueField']??'id';autoIndex(n,q,'text',j['pg']);const e=await j['pg']['query']('SELECT\x20'+Z+P(0x121)+q+P(0x122)+n+'\x20WHERE\x20lower('+q+')\x20~\x20$1\x20LIMIT\x20$2',[''+p[P(0x123)](),M])[P(0x124)](o=>o['rows']);return{'limit':M,'count':e['length'],'search':p,'time':Date['now']()-H,'data':e};}if(!b)throw new ValidationError(P(0x125)+z['field']);const v=await j['dictionary']['get'](b),r=v['filter'](o=>!p||o['code']['startsWith'](p)||o['name']['startsWith'](p))['slice'](0x0,M)[P(0x126)](o=>({'id':o[P(0x127)]||o['id'],'text':o[P(0x11f)]||o[P(0x128)]}));return{'search':p,'limit':M,'count':r['length'],'time':Date['now']()-H,'data':r};}function U(){const t=['get','resource','limit','now','table','textField','name','lookup','\x20as\x20id,\x20','\x20as\x20text\x20FROM\x20','toLowerCase','then','Field\x20has\x20no\x20lookup\x20dictionary:\x20','map','code','text'];U=function(){return t;};return U();}
|
|
@@ -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 A(z,j){z=z-0x132;const c=U();let p=c[z];return p;}export async function updateResourceRelation(z,j){const n=A,{resource:c,id:p,relation:M,relationId:H,data:i,user:b}=z;return j[n(0x132)]['updateRelation']({'name':c,'id':p,'relation':M,'relationId':H,'data':i,'user':b});}function U(){const v=['resource'];U=function(){return v;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function updateResource(
|
|
1
|
+
function A(z,j){z=z-0x6d;var c=U();var p=c[z];return p;}export async function updateResource(z,j){var c=A;return j[c(0x6d)]['update']({'name':z[c(0x6d)],'id':z['id'],'data':z['patch'],'user':z['user']});}function U(){var p=['resource'];U=function(){return p;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ForbiddenError,NotFoundError,ValidationError}from'../../../errors.js';export async function uploadResourceFile(
|
|
1
|
+
function A(z,j){z=z-0x153;const c=U();let p=c[z];return p;}import{ForbiddenError,NotFoundError,ValidationError}from'../../../errors.js';export async function uploadResourceFile(z,j){const i=A,c=j[i(0x153)]['get'](z[i(0x153)]);if(c[i(0x154)]==='admin'&&z['user']?.['type']!==i(0x155))throw new ForbiddenError(i(0x156));if(z['user']?.['type']!=='admin'&&!z['user']?.['permissions']?.['includes']((c['permission']??c['name'])+i(0x157)))throw new ForbiddenError('Missing\x20permission:\x20'+(c[i(0x158)]??c[i(0x159)])+':update');if(!Buffer['isBuffer'](z[i(0x15a)])||z['file']['length']===0x0)throw new ValidationError(i(0x15b));const p=z['fileName']['replace'](/[^A-Za-z0-9._-]/g,'_');if(!p)throw new ValidationError('File\x20name\x20is\x20required');const M=i(0x15c)+z[i(0x153)]+'/'+String(z['id'])+'/'+p;await j['file']['put'](M,z['file']);if(!await j[i(0x15a)]['exists'](M))throw new NotFoundError(i(0x15d));const H=await j['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',[z['resource'],String(z['id']),M,z['file']['length']]);return H['rows'][0x0];}function U(){const b=['resource','access','admin','Admin\x20access\x20required',':update','permission','name','file','File\x20is\x20required','files/','Uploaded\x20file\x20not\x20found'];U=function(){return b;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/system/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAanD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,wBAAgB,YAAY,CAC1B,GAAG,EAAE,UAAU,EACf,SAAS,GAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAa,GACnD,kBAAkB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/system/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAanD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,wBAAgB,YAAY,CAC1B,GAAG,EAAE,UAAU,EACf,SAAS,GAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAa,GACnD,kBAAkB,CA8JpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getSystemSettings}from'./services/get-system-settings.js';import{updateSystemSettings}from'./services/update-system-settings.js';import{getAuditLog}from'./services/get-audit-log.js';
|
|
1
|
+
const n=A;function U(){const r=['user','/api/dictionary/:name','fcore','Get\x20platform\x20dictionary','params','post','Update\x20platform\x20dictionary','Replaces\x20the\x20items\x20of\x20a\x20registered\x20platform\x20dictionary.','body','system','Get\x20access\x20rules','Returns\x20direct\x20and\x20role-based\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','accessTarget','admin','system:settings','Update\x20system\x20settings','settings','get','/api/system/logger','Get\x20system\x20log','Returns\x20system\x20logger\x20entries\x20for\x20the\x20requested\x20path.','List\x20APIs'];U=function(){return r;};return U();}import{getSystemSettings}from'./services/get-system-settings.js';import{updateSystemSettings}from'./services/update-system-settings.js';import{getAuditLog}from'./services/get-audit-log.js';import{checkSystem}from'./services/check-system.js';import{getApiList}from'./services/get-api-list.js';import{getSystemLog}from'./services/get-system-log.js';function A(z,j){z=z-0x1c8;const c=U();let p=c[z];return p;}import{getDictionary}from'./services/get-dictionary.js';import{updateDictionary}from'./services/update-dictionary.js';import{getAccess}from'./services/get-access.js';import{setAccess}from'./services/set-access.js';import{systemSchemas}from'./schema.js';const u=z=>z[n(0x1c8)];export function systemRoutes(z,j=new Map()){return async c=>{const v=A;c['get'](v(0x1c9),{'schema':{'tags':[v(0x1ca),'system'],'summary':v(0x1cb),'description':'Returns\x20a\x20registered\x20platform\x20dictionary\x20by\x20name.','access':v(0x1c8),'permissions':['system:dictionaries'],'params':systemSchemas['dictionaryName']}},async M=>({'items':await getDictionary({...M[v(0x1cc)],'user':u(M)},z)})),c[v(0x1cd)]('/api/dictionary/:name',{'schema':{'tags':['fcore','system'],'summary':v(0x1ce),'description':v(0x1cf),'access':'user','permissions':['system:dictionaries'],'params':systemSchemas['dictionaryName'],'body':systemSchemas['dictionaryItems']}},async M=>updateDictionary({...M[v(0x1cc)],...M[v(0x1d0)],'user':u(M)},z));const p=async M=>getAccess({...M['params'],'user':u(M)},z);c['get']('/api/access/:type/:id',{'schema':{'tags':[v(0x1ca),v(0x1d1)],'summary':v(0x1d2),'description':v(0x1d3),'access':'admin','permissions':['system:access'],'params':systemSchemas[v(0x1d4)]}},p),c[v(0x1cd)]('/api/access/:type/:id',{'schema':{'tags':['fcore','system'],'summary':'Set\x20access\x20rules','description':'Replaces\x20direct\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','access':'admin','permissions':['system:access'],'params':systemSchemas['accessTarget'],'body':systemSchemas['access']}},async M=>setAccess({...M['params'],...M['body'],'user':u(M)},z)),c['get']('/api/system/settings',{'schema':{'tags':['fcore','system'],'summary':'Get\x20system\x20settings','description':'Returns\x20system\x20settings\x20as\x20nested\x20JSON.','access':v(0x1d5),'permissions':[v(0x1d6)]}},async M=>getSystemSettings({...M[v(0x1cc)],'user':u(M)},z)),c[v(0x1cd)]('/api/system/settings',{'schema':{'tags':['fcore','system'],'summary':v(0x1d7),'description':'Updates\x20system\x20settings\x20using\x20flat\x20dot-notation\x20keys.','access':'admin','permissions':['system:settings'],'body':systemSchemas[v(0x1d8)]}},async M=>updateSystemSettings({...M['params'],'patch':M[v(0x1d0)],'user':u(M)},z)),c[v(0x1d9)](v(0x1da),{'schema':{'tags':['fcore','system'],'summary':v(0x1db),'description':v(0x1dc),'access':v(0x1c8),'permissions':['system:logs'],'querystring':systemSchemas['logger']}},async(M,H)=>{const {contentType:i,body:b}=await getSystemLog({...M['query'],'user':u(M)},z);return H['type'](i)['send'](b);}),c['get']('/api/system/audit',{'schema':{'tags':['fcore',v(0x1d1)],'summary':'Get\x20audit\x20log','description':'Returns\x20the\x20system\x20audit\x20log\x20entries.','access':'user','permissions':['system:audit']}},async M=>getAuditLog({...M['query'],'user':u(M)},z)),c['get']('/api/system/check',{'schema':{'tags':['fcore',v(0x1d1)],'summary':'Check\x20system\x20health','description':'Checks\x20the\x20availability\x20of\x20system\x20dependencies.','access':'user','permissions':['system:check']}},async M=>checkSystem({'user':u(M)},z)),c['get']('/api/system/list',{'schema':{'tags':[v(0x1ca),'system'],'summary':v(0x1dd),'description':'Returns\x20the\x20list\x20of\x20registered\x20platform\x20APIs.','access':'admin','permissions':[],'querystring':systemSchemas['apiListQuery']}},async M=>getApiList({'user':u(M),'apiRoutes':j,...M['query']},z));};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function A(z,j){z=z-0x110;const c=U();let p=c[z];return p;}function U(){const j=['String','^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$','Object','Union','Literal','user','Array','Unknown','Optional'];U=function(){return j;};return U();}const z=A;import{Type}from'@sinclair/typebox';export const identifier=Type[z(0x110)]({'minLength':0x1,'maxLength':0x80,'pattern':z(0x111)});export const systemSchemas={'dictionaryName':Type['Object']({'name':identifier}),'dictionaryItems':Type[z(0x112)]({'items':Type['Array'](Type[z(0x112)]({'id':Type['Optional'](Type[z(0x113)]([Type['String'](),Type['Number']()])),'code':Type['String']({'minLength':0x1}),'name':Type['String']({'minLength':0x1}),'parentId':Type['Optional'](Type['Union']([Type[z(0x110)](),Type['Number'](),Type['Null']()]))},{'additionalProperties':!![]}))}),'accessTarget':Type[z(0x112)]({'type':Type['Union']([Type[z(0x114)](z(0x115)),Type['Literal']('role')]),'id':identifier}),'access':Type['Object']({'access':Type['Array'](Type[z(0x112)]({'resource':Type['String']({'minLength':0x1,'maxLength':0x80}),'actions':Type[z(0x116)](Type['String']({'minLength':0x1,'maxLength':0x80}),{'minItems':0x1})}))}),'apiListQuery':Type['Object']({'format':Type['Optional'](Type['Union']([Type['Literal']('short'),Type['Literal']('extended')]))}),'settingsEntity':Type['Object']({'entity':Type['Optional'](identifier)}),'settings':Type['Record'](Type['String']({'minLength':0x1}),Type[z(0x117)]()),'logger':Type[z(0x112)]({'path':Type[z(0x118)](Type[z(0x110)]({'maxLength':0x100,'pattern':'^[A-Za-z0-9_.\x5c-/]*$'}))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-system.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/check-system.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,WAAW,CAC/B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;CACZ,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"check-system.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/check-system.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,WAAW,CAC/B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;CACZ,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAcd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function U(){const H=['fulfilled','degraded'];U=function(){return H;};return U();}function A(z,j){z=z-0x136;const c=U();let p=c[z];return p;}export async function checkSystem(z,j){const M=A,[c,p]=await Promise['allSettled']([j['pg']['query']('SELECT\x201'),j['redis']['ping']()]);return{'status':c['status']===M(0x136)&&p['status']==='fulfilled'?'ok':M(0x137),'pg':c['status'],'redis':p['status']};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-access.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-access.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,wBAAsB,SAAS,CAC7B,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EACzD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,MAAM,EAAE,YAAY,EAAE,CAAA;CAAE,CAAC,CAkBrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function A(z,j){z=z-0x119;const c=U();let p=c[z];return p;}export async function getAccess(z,j){const M=A,c=z[M(0x119)]===M(0x11a)?M(0x11b):M(0x11c),p=await j['pg']['query'](c,[z['id']]);return{'access':p['rows']};}function U(){const H=['type','user','\x0a\x20\x20\x20\x20\x20\x20\x20\x20SELECT\x20ra.resource,\x20ra.actions,\x20ra.role_id\x20AS\x20role\x0a\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20admin.role_access\x20ra\x0a\x20\x20\x20\x20\x20\x20\x20\x20LEFT\x20JOIN\x20admin.user_roles\x20ur\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20ur.role_id\x20=\x20ra.role_id\x20AND\x20ur.user_uid\x20=\x20$1\x0a\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20ra.user_uid\x20=\x20$1\x20OR\x20ur.user_uid\x20=\x20$1\x0a\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20SELECT\x20ra.resource,\x20ra.actions,\x20ra.role_id\x20AS\x20role\x0a\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20admin.role_access\x20ra\x0a\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20ra.role_id\x20=\x20$1\x0a\x20\x20\x20\x20\x20\x20'];U=function(){return H;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-api-list.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-api-list.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,kBAAkB,CAAC;AAEhE,wBAAsB,UAAU,CAC9B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;CAC/B,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"get-api-list.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-api-list.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,kBAAkB,CAAC;AAEhE,wBAAsB,UAAU,CAC9B,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;CAC/B,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC,CAWhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function U(){const n=['sort','endpoint','format','map'];U=function(){return n;};return U();}function A(z,j){z=z-0x184;const c=U();let p=c[z];return p;}export async function getApiList(z,j){const b=A,c=[...z['apiRoutes']['values']()][b(0x184)]((p,M)=>(p[b(0x185)]+'\x20'+p['method'])['localeCompare'](M['endpoint']+'\x20'+M['method']));if(z[b(0x186)]!=='short')return c;return c[b(0x187)](({method:p,endpoint:M,access:H,permissions:i})=>p+'\x20'+M);}
|
|
@@ -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 A(z,j){z=z-0x1be;const c=U();let p=c[z];return p;}export async function getAuditLog(z,j){const H=A,c=Math[H(0x1be)](Math[H(0x1bf)](z['limit']??0x32,0x1),0xc8),p=Math['max']((z['page']??0x1)-0x1,0x0)*c,M=await j['pg'][H(0x1c0)]('SELECT\x20*\x20FROM\x20admin.audit_log\x20ORDER\x20BY\x20id\x20DESC\x20LIMIT\x20$1\x20OFFSET\x20$2',[c,p]);return{'rows':M['rows'],'page':z['page']??0x1,'limit':c};}function U(){const i=['min','max','query'];U=function(){return i;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function getDictionary(
|
|
1
|
+
export async function getDictionary(z,j){var c=A;return j['dictionary']['get'](z[c(0x72)]);}function A(z,j){z=z-0x72;var c=U();var p=c[z];return p;}function U(){var p=['name'];U=function(){return p;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-system-log.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-system-log.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-system-log.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-system-log.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAc5D,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EACrC,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,SAAS,CAAC,CA0CpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
function U(){const R=['resolve','startsWith','sep','catch','all','join','name','directory','isDirectory','mtime','toISOString','localeCompare','slice','text/plain;\x20charset=utf-8','type','</h1>\x0a<ul>\x0a','&','<','split','stat','min','concat','length'];U=function(){return R;};return U();}function A(z,j){z=z-0x1e1;const c=U();let p=c[z];return p;}const o=A;import z from'node:fs/promises';import j from'node:path';import{NotFoundError,ValidationError}from'../../../errors.js';const LOGS_ROOT=j[o(0x1e1)](process['cwd'](),'logs'),TAIL_LINES=0x64;export async function getSystemLog(c,p){const P=o,M=normalizePath(c['path']),H=j['resolve'](LOGS_ROOT,M);if(H!==LOGS_ROOT&&!H[P(0x1e2)](LOGS_ROOT+j[P(0x1e3)]))throw new ValidationError('Invalid\x20log\x20path');const i=await z['stat'](H)[P(0x1e4)](()=>null);if(!i)throw new NotFoundError('Log\x20path\x20not\x20found');if(i['isDirectory']()){const n=await z['readdir'](H,{'withFileTypes':!![]}),v=await Promise[P(0x1e5)](n['map'](async r=>{const t=P,q=await z['stat'](j[t(0x1e6)](H,r[t(0x1e7)]));return{'name':r[t(0x1e7)],'path':M?M+'/'+r[t(0x1e7)]:r[t(0x1e7)],'type':r['isDirectory']()?t(0x1e8):'file','size':r[t(0x1e9)]()?undefined:q['size'],'modified':q[t(0x1ea)][t(0x1eb)]()};}));v['sort']((r,q)=>r[P(0x1e7)][P(0x1ec)](q['name']));if(M){const r=M['split']('/')[P(0x1ed)](0x0,-0x1)['join']('/');v['unshift']({'name':'..','path':r,'type':'directory'});}return{'contentType':'text/html;\x20charset=utf-8','body':renderDirectory(M,v)};}const b=await tailFile(H,TAIL_LINES);return{'contentType':P(0x1ee),'body':b[P(0x1e6)]('\x0a')};}function renderDirectory(c,p){const y=o,M=p['map'](i=>{const g=A,b='?path='+encodeURIComponent(i['path']),n=i[g(0x1ef)]==='directory'?i[g(0x1e7)]+'/':i['name'];return'<li><a\x20href=\x22'+b+'\x22>'+escapeHtml(n)+'</a></li>';})['join']('\x0a'),H=escapeHtml('logs/'+c);return'<!DOCTYPE\x20html>\x0a<html>\x0a<head><meta\x20charset=\x22utf-8\x22><title>'+H+'</title></head>\x0a<body>\x0a<h1>'+H+y(0x1f0)+M+'\x0a</ul>\x0a</body>\x0a</html>';}function escapeHtml(c){const B=o;return c['replace'](/&/g,B(0x1f1))['replace'](/</g,B(0x1f2))['replace'](/>/g,'>')['replace'](/"/g,'"');}function normalizePath(c){const Y=o,p=(c??'')['replace'](/\\/g,'/')['replace'](/^\/+|\/+$/g,'');if(p[Y(0x1f3)]('/')['some'](M=>M==='..'))throw new ValidationError('Invalid\x20log\x20path');return p;}async function tailFile(c,p){const s=o,M=await z['open'](c,'r');try{const {size:H}=await M[s(0x1f4)](),i=0x40*0x400;let b=H,n=Buffer['alloc'](0x0),v=0x0;while(b>0x0&&v<=p){const q=Math[s(0x1f5)](i,b);b-=q;const Z=Buffer['alloc'](q);await M['read'](Z,0x0,q,b),n=Buffer[s(0x1f6)]([Z,n]),v+=countNewlines(Z);}const r=n['toString']('utf8')[s(0x1f3)]('\x0a')['filter'](e=>e[s(0x1f7)]>0x0);return r['slice'](-p)['reverse']();}finally{await M['close']();}}function countNewlines(c){let p=0x0;for(const M of c){if(M===0xa)p++;}return p;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-system-settings.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-system-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,iBAAiB,CACrC,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;CACZ,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"get-system-settings.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/get-system-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,iBAAiB,CACrC,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;CACZ,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAkBlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function A(z,j){z=z-0x85;const c=U();let p=c[z];return p;}export async function getSystemSettings(z,j){const n=A,c=await j['pg']['query'](n(0x85));return c['rows']['reduce']((p,M)=>{const v=n,H=String(M[v(0x86)])[v(0x87)]('.');let i=p;for(const b of H['slice'](0x0,-0x1)){i[b]??={},i=i[b];}return i[H['at'](-0x1)]=M['value'],p;},{});}function U(){const r=['\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','key','split'];U=function(){return r;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function listDictionaries(
|
|
1
|
+
export async function listDictionaries(z,j){return j['dictionary']['list']();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-access.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/set-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/D,KAAK,WAAW,GAAG;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,wBAAsB,SAAS,CAC3B,MAAM,EAAE;IACJ,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,IAAI,EAAE,IAAI,CAAC;CACd,EACD,GAAG,EAAE,UAAU,GAChB,OAAO,CAAC;IAAE,MAAM,EAAE,YAAY,EAAE,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"set-access.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/set-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/D,KAAK,WAAW,GAAG;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,wBAAsB,SAAS,CAC3B,MAAM,EAAE;IACJ,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,IAAI,EAAE,IAAI,CAAC;CACd,EACD,GAAG,EAAE,UAAU,GAChB,OAAO,CAAC;IAAE,MAAM,EAAE,YAAY,EAAE,CAAA;CAAE,CAAC,CA6CrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getAccess}from'./get-access.js';function U(){const i=['user','query','type','COMMIT'];U=function(){return i;};return U();}function A(z,j){z=z-0x1d5;const c=U();let p=c[z];return p;}export async function setAccess(z,j){const H=A,c=await j['pg']['connect']();try{await c['query']('BEGIN');z['type']===H(0x1d5)?await c['query']('DELETE\x20FROM\x20admin.role_access\x20WHERE\x20user_uid\x20=\x20$1\x20AND\x20role_id\x20IS\x20NULL',[z['id']]):await c[H(0x1d6)]('DELETE\x20FROM\x20admin.role_access\x20WHERE\x20role_id\x20=\x20$1\x20AND\x20user_uid\x20IS\x20NULL',[z['id']]);for(const p of z['access']){z[H(0x1d7)]==='user'?await c['query']('INSERT\x20INTO\x20admin.role_access\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(\x20resource,\x20actions,\x20user_uid,\x20created_by,\x20updated_by)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4,\x20$5)',[p['resource'],p['actions'],z['id'],z['user']['id'],z[H(0x1d5)]['id']]):await c['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)',[p['resource'],p['actions'],z['id'],z['user']['id'],z[H(0x1d5)]['id']]);}await c['query'](H(0x1d8));}catch(M){await c['query']('ROLLBACK');throw M;}finally{c['release']();}return getAccess(z,j);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-dictionary.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/update-dictionary.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"update-dictionary.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/update-dictionary.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,wBAAsB,gBAAgB,CACpC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,cAAc,EAAE,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EAC7D,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAI/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function A(z,j){z=z-0xb5;var c=U();var p=c[z];return p;}export async function updateDictionary(z,j){var c=A;return await j['dictionary'][c(0xb5)](z['name'],z['items']),{'success':!![]};}function U(){var p=['put'];U=function(){return p;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-system-settings.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/update-system-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG5D,wBAAsB,oBAAoB,CACxC,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"update-system-settings.d.ts","sourceRoot":"","sources":["../../../../src/modules/system/services/update-system-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG5D,wBAAsB,oBAAoB,CACxC,MAAM,EAAE;IACN,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC,CAqB5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function A(z,j){z=z-0x120;const c=U();let p=c[z];return p;}import{ValidationError}from'../../../errors.js';export async function updateSystemSettings(z,j){const M=A;if(!Object[M(0x120)](z['patch'])['length'])throw new ValidationError('Settings\x20patch\x20is\x20empty');for(const [c,p]of Object['entries'](z['patch'])){if(!c['trim']()||c[M(0x121)]('..'))throw new ValidationError('Invalid\x20setting\x20key:\x20'+c);await j['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',[c,JSON[M(0x122)](p),z['user']['id']]);}return{'success':!![]};}function U(){const H=['keys','includes','stringify'];U=function(){return H;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function A(z,j){z=z-0x131;var c=U();var p=c[z];return p;}function U(){var p=['User\x20required','admin'];U=function(){return p;};return U();}import{ForbiddenError}from'../../errors.js';export function requireAdmin(z,j){var c=A;if(!z)throw new ForbiddenError(c(0x131));if(z['type']!=='admin')throw new ForbiddenError('Admin\x20access\x20required');if(z['type']!==c(0x132)&&j&&!z['permissions']?.['includes'](j))throw new ForbiddenError('Missing\x20permission:\x20'+j);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function U(){const H=['password','includes'];U=function(){return H;};return U();}function A(z,j){z=z-0x16e;const c=U();let p=c[z];return p;}export const safeUser=z=>{const M=A,j=[M(0x16e),'salt','secret','credentials'];return Object['fromEntries'](Object['entries'](z)['filter'](([c])=>!j['some'](p=>c['toLowerCase']()[M(0x16f)](p))));};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{UnsupportedError}from'../../errors.js';export function unsupported(
|
|
1
|
+
import{UnsupportedError}from'../../errors.js';export function unsupported(z){throw new UnsupportedError(z+'\x20requires\x20a\x20project/provider\x20implementation');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{writeAudit}from'./services/write-audit.js';export function createAudit(
|
|
1
|
+
import{writeAudit}from'./services/write-audit.js';export function createAudit(z){const j=writeAudit(z);return{'write':j};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const secretPattern=/password|token|secret|credential|salt/i;function clean(
|
|
1
|
+
const secretPattern=/password|token|secret|credential|salt/i;function clean(z){const v=A;if(Array['isArray'](z))return z['map'](clean);if(z&&typeof z==='object')return Object[v(0x10c)](Object['entries'](z)['map'](([j,c])=>[j,secretPattern['test'](j)?'[REDACTED]':clean(c)]));return z;}function U(){const e=['fromEntries','rows','warn','admin.audit_log','Unable\x20to\x20check\x20audit\x20tables;\x20audit\x20writes\x20are\x20disabled','audit','empty\x20pg','query','resourceId','action','field'];U=function(){return e;};return U();}function A(z,j){z=z-0x10c;const c=U();let p=c[z];return p;}export function writeAudit(z){let j,c;async function p(){if(!z['pg'])return![];if(j!==undefined)return j;return c??=z['pg']['query']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20SELECT\x20table_name\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20information_schema.tables\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20table_schema\x20=\x20\x27admin\x27\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20table_name\x20IN\x20(\x27audit_log\x27,\x20\x27audit_log_data\x27)\x0a\x20\x20\x20\x20\x20\x20\x20\x20')['then'](M=>{const r=A,H=new Set(M[r(0x10d)]['map'](i=>i['table_name']));return j=H['has']('audit_log')&&H['has']('audit_log_data'),!j&&z['logger'][r(0x10e)]({'expectedTables':[r(0x10f),'admin.audit_log_data'],'foundTables':[...H]},'Audit\x20tables\x20are\x20unavailable;\x20audit\x20writes\x20are\x20disabled'),j;})['catch'](M=>{const q=A;return j=![],z['logger']['warn']({'err':M},q(0x110)),![];}),c;}return async function M(H){const Z=A;if(!await p())return z['logger']['info']({'auditFallback':!![],'event':clean({...H,'changes':H['changes']?.['map'](n=>({...n,'oldValue':clean(n['oldValue']),'newValue':clean(n['newValue'])}))})},Z(0x111)),0x0;if(!z['pg'])throw new Error(Z(0x112));const i=await z['pg'][Z(0x113)]('\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',[H['userId']??null,H['module'],H['resource'],H[Z(0x114)]==null?null:String(H[Z(0x114)]),H['fields']??null,H[Z(0x115)],H['requestId']??null,H['ipAddress']??null,clean(H['metadata']??{})]),b=i['rows'][0x0]['id'];for(const n of H['changes']??[]){if(secretPattern['test'](n[Z(0x116)]))continue;await z['pg']['query']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.audit_log_data\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20audit_log_id,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20field,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20old_value,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20new_value\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4)\x0a\x20\x20\x20\x20\x20\x20\x20\x20',[b,n[Z(0x116)],JSON['stringify'](clean(n['oldValue'])),JSON['stringify'](clean(n['newValue']))]);}return b;};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function A(z,j){z=z-0x1ea;const c=U();let p=c[z];return p;}function U(){const H=['map','permission'];U=function(){return H;};return U();}export async function getUserPermissions(z,j){const M=A,c=await j['pg']['query']('\x0a\x20\x20\x20\x20\x20\x20SELECT\x20DISTINCT\x20ra.resource\x20||\x20\x27:\x27\x20||\x20action\x20AS\x20permission\x0a\x20\x20\x20\x20\x20\x20FROM\x20admin.role_access\x20ra\x0a\x20\x20\x20\x20\x20\x20LEFT\x20JOIN\x20admin.user_roles\x20ur\x20ON\x20ur.role_id\x20=\x20ra.role_id\x0a\x20\x20\x20\x20\x20\x20CROSS\x20JOIN\x20LATERAL\x20unnest(COALESCE(ra.actions,\x20\x27{}\x27::text[]))\x20AS\x20action\x0a\x20\x20\x20\x20\x20\x20WHERE\x20ra.user_uid\x20=\x20$1\x20OR\x20ur.user_uid\x20=\x20$1\x0a\x20\x20\x20\x20',[z]);return c['rows'][M(0x1ea)](p=>p[M(0x1eb)]);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAUhC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAO/C,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAI5D,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAE1C,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKpE;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAUhC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAO/C,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAI5D,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAE1C,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKpE;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,CAalB;AAED,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,mBAAmB,iBA6CzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from'./auth.types.js';import{randomBytes,scrypt as
|
|
1
|
+
export*from'./auth.types.js';import{randomBytes,scrypt as z,timingSafeEqual}from'node:crypto';import{promisify}from'node:util';const scrypt=promisify(z);import j from'@fastify/cookie';import c from'@fastify/session';import{Authenticator}from'@fastify/passport';import p from'fastify-session-redis-store';function U(){const o=['hex','warn','test','auth','secret','database','register'];U=function(){return o;};return U();}import{getUserPermissions}from'./get-user-permissions.js';const fastifyPassport=new Authenticator();function A(z,j){z=z-0x185;const c=U();let p=c[z];return p;}export*from'./verifyUser.js';export*from'./get-user-permissions.js';export async function hashPassword(M){const H=randomBytes(0x10),i=await scrypt(M,H,0x40);return'scrypt$'+H['toString']('hex')+'$'+i['toString']('hex');}export async function verifyPassword(M,H){const Z=A,[i,b,n]=H?.['split']('$')||[];if(i!=='scrypt'||!b||!n)return![];const v=Buffer['from'](b,Z(0x185)),r=Buffer['from'](n,'hex'),q=await scrypt(M,v,r['length']);return timingSafeEqual(q,r);}export async function createSessionStore(M,H){const e=A,{config:i,redis:b}=H;if(!i||!b){console[e(0x186)]('Missing\x20config\x20or\x20redis\x20-\x20skipping\x20session\x20store\x20creation');return;}if(process.env.NODE_ENV===e(0x187)||process.env.VITEST)return;await M['register'](j,{'parseOptions':i[e(0x188)]['cookieOptions']}),await M['register'](c,{'secret':i['auth'][e(0x189)],'cookieName':i['auth']['cookieName'],'cookie':i[e(0x188)]['cookieOptions'],'store':new p({'prefix':i['auth']['cookieName']+':'+(i['pg']?.[e(0x18a)]||'db')+':','client':b})}),await M['register'](fastifyPassport['initialize']()),await M[e(0x18b)](fastifyPassport['secureSession']()),fastifyPassport['registerUserSerializer'](async n=>({'user':n})),fastifyPassport['registerUserDeserializer'](async n=>{const v=n?.['user']||n;return v?.['id']&&(v['permissions']=await getUserPermissions(v['id'],H)),v;});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function U(){const q=['then','info','Wrong\x20password'];U=function(){return q;};return U();}import{BadRequestError}from'../../errors.js';function A(z,j){z=z-0x168;const c=U();let p=c[z];return p;}import{verifyPassword}from'./index.js';export async function verifyUser({user:z,password:j,ip:c},{pg:p,logger:M}){const r=A;if(!z||z==='')throw new BadRequestError('not\x20enough\x20params:\x20user');if(!j||j==='')throw new BadRequestError('not\x20enough\x20params:\x20password');M['metrics']('user.login');const H='select\x20uid\x20as\x20id,\x20user_type\x20as\x20type,\x20password_hash,\x20twofa\x20from\x20admin.users\x20where\x20$1\x20in\x20(login,email,phone)\x20and\x20enabled\x20limit\x201',i=await p['query'](H,[z])[r(0x168)](n=>n['rows']?.[0x0]);if(!i){const n='user\x20not\x20found';M[r(0x169)]({'file':'auth/warn','error':n,'user':z,'ip':c});throw new BadRequestError(n);}const b=await verifyPassword(j,i['password_hash']);if(!b){const v=r(0x16a);M['info']({'file':'auth/warn','error':v,'user':z,'ip':c});throw new BadRequestError(v);}return delete i['password_hash'],i;}
|
|
@@ -9,13 +9,16 @@ export interface DictionaryItem {
|
|
|
9
9
|
export interface DictionaryDefinition {
|
|
10
10
|
code: string;
|
|
11
11
|
name?: string;
|
|
12
|
+
checked?: boolean;
|
|
12
13
|
items: DictionaryItem[];
|
|
13
14
|
}
|
|
14
15
|
export interface DictionaryPlugin {
|
|
15
16
|
register(input: DictionaryDefinition | DictionaryDefinition[]): void;
|
|
17
|
+
has(name: string): boolean;
|
|
16
18
|
get(name: string): Promise<DictionaryItem[]>;
|
|
17
19
|
put(name: string, items: DictionaryItem[]): Promise<void>;
|
|
18
20
|
clear(name: string): boolean;
|
|
21
|
+
revision(name: string): number;
|
|
19
22
|
list(): Promise<Array<{
|
|
20
23
|
code: string;
|
|
21
24
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../src/plugins/dictionary.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAMD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,GAAG,IAAI,CAAC;IACrE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7C,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,IAAI,IAAI,OAAO,CACb,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;KAAE,CAAC,CACrE,CAAC;CACH;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,eAAe,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACvC;AAID,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,YAAiB,GAClB,EAAE,sBAAsB,GAAG,gBAAgB,
|
|
1
|
+
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../src/plugins/dictionary.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAMD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,GAAG,IAAI,CAAC;IACrE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7C,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,IAAI,IAAI,OAAO,CACb,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;KAAE,CAAC,CACrE,CAAC;CACH;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,eAAe,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACvC;AAID,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,YAAiB,GAClB,EAAE,sBAAsB,GAAG,gBAAgB,CAkN3C"}
|