@opengis/fcore 0.0.1-beta.1 → 0.0.1-beta.10
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.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 +5 -5
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fcore.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +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 +22 -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 +14 -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 +16 -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/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.d.ts +3 -0
- package/dist/plugins/logger/transport.d.ts.map +1 -0
- package/dist/plugins/logger/transport.js +1 -0
- 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 +60 -6
- 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 +5 -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 +5 -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.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/dist/type.d.ts +37 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +1 -0
- package/migrations/20260903120000_core_schema.sql +22 -19
- package/migrations/20260905120000_add_user_foreign_keys.sql +43 -0
- package/migrations/20260907090000_core_schema.sql +32 -0
- package/package.json +13 -8
- 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
|
-
|
|
1
|
+
import{NotFoundError,ValidationError}from'../../../errors.js';function S(d,h){d=d-0x19e;const p=v();let Z=p[d];return Z;}import{fileTypeFromBuffer}from'file-type';import{createHash}from'node:crypto';import{mkdir,readFile,writeFile}from'node:fs/promises';import d from'node:path';import h from'sharp';export async function resizeFile(p,Z){const K=S,D=p['pathOrToken']??p['path'];if(!D)throw new ValidationError('File\x20path\x20is\x20required');const u=parseDimension(p['width'],K(0x19e))??0xc8,n=parseDimension(p[K(0x19f)],K(0x19f)),X=createHash('sha256')['update'](D+':'+u+':'+(n??'auto')+':'+(p['fit']??K(0x1a0)))['digest']('hex'),Y=d['resolve'](K(0x1a1),'resize'),w=d['join'](Y,X+'.jpg');try{return await readFile(w);}catch(B){if(B[K(0x1a2)]!=='ENOENT')throw B;}if(!await Z[K(0x1a3)][K(0x1a4)](D))throw new NotFoundError(K(0x1a5));const y=await Z['file']['get'](D),Q=await fileTypeFromBuffer(y);if(!Q?.[K(0x1a6)]['startsWith']('image/'))throw new ValidationError(K(0x1a7));const F=await h(y)[K(0x1a8)]({'width':u,'height':n,'fit':p['fit']??K(0x1a0)})['toBuffer']();return await mkdir(Y,{'recursive':!![]}),await writeFile(w,F),F;}function v(){const s=['width','height','cover','logs','code','file','exists','File\x20not\x20found','mime','Only\x20image\x20files\x20can\x20be\x20resized','resize','\x20must\x20be\x20a\x20positive\x20integer'];v=function(){return s;};return v();}function parseDimension(p,Z){const g=S;if(p===undefined||p==='')return undefined;const D=Number(p);if(!Number['isInteger'](D)||D<=0x0)throw new ValidationError(Z+g(0x1a9));return D;}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Implements the upload file application service for the File module.
|
|
3
|
-
*/
|
|
4
1
|
import type { AppContext, User } from "../../../context.js";
|
|
2
|
+
import type { MultipartFile } from "@fastify/multipart";
|
|
5
3
|
export interface UploadFileParams {
|
|
6
4
|
user?: User;
|
|
7
|
-
file:
|
|
5
|
+
file: MultipartFile;
|
|
8
6
|
metadata: {
|
|
9
7
|
name?: string;
|
|
10
8
|
path?: string;
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
resource?: string;
|
|
10
|
+
resourceId?: string;
|
|
13
11
|
};
|
|
14
12
|
}
|
|
15
13
|
export declare function uploadFile(params: UploadFileParams, ctx: AppContext): Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../../../src/modules/file/services/upload-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../../../src/modules/file/services/upload-file.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AACD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAqDd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function S(d,h){d=d-0x170;const p=v();let Z=p[d];return Z;}import{fileTypeFromBuffer}from'file-type';import d from'../mime.js';function v(){const B=['metadata','path','resource','has','mimetype','\x0a\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.files\x20(resource,\x20resource_id,\x20file_path,\x20file_type,\x20size,uploaded_name,file_name,ext,created_by)\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\x20*\x0a\x20\x20\x20\x20\x20\x20','pop','user','rows'];v=function(){return B;};return v();}import{randomUUID}from'node:crypto';export async function uploadFile(h,p){const F=S,Z=(h['metadata']['name']??randomUUID())['replace'](/[^a-zA-Z0-9._-]/g,'_'),D=new Date(),u=String(D['getFullYear']())['slice'](-0x2),n=String(D['getMonth']()+0x1)['padStart'](0x2,'0'),X=String(D['getDate']())['padStart'](0x2,'0'),Y=h[F(0x170)][F(0x171)]??(h[F(0x170)]['resource']?h['metadata'][F(0x172)]+'/'+(h['metadata']['resourceId']??randomUUID())+'/'+Z:null)??'uploads/'+u+'/'+n+'-'+X+'/'+Z,w=await h['file']['toBuffer'](),y=await fileTypeFromBuffer(w);if(!d[F(0x173)](h['file'][F(0x174)])&&(y?.['mime']?!d['has'](y['mime']):!![]))throw new Error('Unsupported\x20file\x20type:\x20'+h['file'][F(0x174)]);await p['file']['put'](Y,w);const Q=await p['pg']['query'](F(0x175),[h['metadata']['resource']??null,h['metadata']['resourceId']??null,Y,h['file'][F(0x174)],h['file']['file']['bytesRead'],h['metadata']['name'],Z,h['file'][F(0x174)]['split']('/')[F(0x176)]()??null,h[F(0x177)]?.['id']??null]);return Q[F(0x178)][0x0];}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Registers HTTP routes for this FCore module and delegates operations to application services.
|
|
3
|
-
*/
|
|
4
1
|
import type { FastifyPluginAsync } from "fastify";
|
|
5
2
|
import type { AppContext } from "../../context.js";
|
|
6
3
|
export declare function resourceRoutes(ctx: AppContext): FastifyPluginAsync;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/route.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/route.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAsBnD,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,kBAAkB,CA+RlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const Dn=p;(function(D,L){const Dv=p,s=D();while(!![]){try{const X=parseInt(Dv(0x1d9))/0x1+parseInt(Dv(0x1f9))/0x2+parseInt(Dv(0x239))/0x3+parseInt(Dv(0x23d))/0x4+parseInt(Dv(0x1dd))/0x5+-parseInt(Dv(0x20c))/0x6*(-parseInt(Dv(0x1d4))/0x7)+-parseInt(Dv(0x1eb))/0x8;if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0xefad3));import{listResources}from'./services/list-resources.js';function p(D,L){D=D-0x1bd;const s=m();let X=s[D];return X;}import{getResource}from'./services/get-resource.js';import{createResource}from'./services/create-resource.js';import{updateResource}from'./services/update-resource.js';import{deleteResource}from'./services/delete-resource.js';import{listResourceRelation}from'./services/list-resource-relation.js';import{createResourceRelation}from'./services/create-resource-relation.js';import{deleteResourceRelation}from'./services/delete-resource-relation.js';function m(){const DN=['ngIpW','user','DPbEK','Adds\x20a\x20file\x20to\x20a\x20resource\x20record.','790621Knjwpl','tags','resource','Exports\x20readable\x20records\x20from\x20a\x20registered\x20resource.','7036100CEMBar','/api/resource/:resource/export','VBnis','GqfqW','vIUfl','/api/resource/:resource/:id/:relation','Ghpnr','VfVXX','GSQUE','split','wTKiA','uCnbI','Uploads\x20a\x20file\x20to\x20a\x20Resource\x20record\x20and\x20stores\x20its\x20metadata.','List\x20resource\x20relations','55217632ZGZCNX','tnuze','ZUYqA','BXsim','resourceId','ZpfEQ','Delete\x20resource\x20relation','params','get','resource:update','Delete\x20resource\x20record','Suggest\x20resource\x20values','Returns\x20files\x20related\x20to\x20a\x20resource\x20record.','tIvMU','2589930eHMxUv','Export\x20resource\x20records','6|11|5|10|13|8|16|15|12|1|7|2|3|14|9|4|0','Returns\x20one\x20record\x20from\x20a\x20registered\x20resource.','zMfjO','query','uploadResourceFileBody','access','resourceField','exportResource','schema','/api/resource/:resource/:id/files','TdmSp','fcore','wqlaq','KYsTa','GVRKc','Cacha','/api/resource/:resource/:id/upload','2711622BXTXVk','resourceIdRelation','/api/resource/:resource/:id/files/:relationId','zkhgO','suggestQuery','oQHZa','/api/resource/:resource/suggest/:field','qcoEn','QPhdp','/api/resource/:resource','UFlRu','jizBV','Returns\x20related\x20records\x20for\x20a\x20resource\x20record.','LPYCO','Upload\x20resource\x20file','List\x20resource\x20records','patch','/api/resource/:resource/search','permissions','body','Get\x20resource\x20record','delete','notes','Returns\x20records\x20from\x20a\x20registered\x20resource.','ZnMvY','Searches\x20records\x20in\x20a\x20registered\x20resource.','description','Deletes\x20a\x20record\x20from\x20a\x20registered\x20resource.','files','yqcKd','Returns\x20notes\x20related\x20to\x20a\x20resource\x20record.','cuPen','/api/resource/:resource/:id/:relation/:relationId','uploadResourceFile','Creates\x20a\x20relation\x20for\x20a\x20resource\x20record.','/api/resource/:resource/:id','NnJAS','oexFB','post','SlPdu','qPYTz','exportResourceQuery','NgXLI','HNUhe','resourceIdRelationId','2844792wlQhlo','Add\x20resource\x20file','zBXHn','Returns\x20suggested\x20values\x20for\x20a\x20resource\x20field.','6540404ZkaFWj','Search\x20resource','Adds\x20a\x20note\x20to\x20a\x20resource\x20record.','XmelE','DMMVO','Update\x20resource\x20record','List\x20resource\x20notes','List\x20resource\x20files','*:read','Create\x20resource\x20record','summary','ErOYe','dcLge','Create\x20resource\x20relation','Delete\x20resource\x20file','SuqxU','bFNPY','kGswh','Add\x20resource\x20note','Updates\x20a\x20record\x20in\x20a\x20registered\x20resource.','UYeeq','/api/resource/:resource/:id/notes','Removes\x20a\x20file\x20relation\x20from\x20a\x20resource\x20record.','Deletes\x20a\x20relation\x20from\x20a\x20resource\x20record.','hXhJN','Creates\x20a\x20record\x20in\x20a\x20registered\x20resource.','28pMiNJO'];m=function(){return DN;};return m();}import{searchResource}from'./services/search-resource.js';import{exportResource}from'./services/export-resource.js';import{suggestResource}from'./services/suggest-resource.js';import{addNote}from'./services/add-note.js';import{addResourceFile}from'./services/add-resource-file.js';import{uploadResourceFile}from'./services/upload-resource-file.js';import{resourceSchemas}from'./schema.js';const user=D=>D[Dn(0x1d6)];export function resourceRoutes(L){const DZ=Dn,s={};s[DZ(0x1f0)]=DZ(0x1fb),s[DZ(0x1cb)]=DZ(0x22c),s[DZ(0x217)]=DZ(0x206),s[DZ(0x1c6)]=DZ(0x1db),s[DZ(0x1ce)]=DZ(0x1f1),s[DZ(0x1c9)]=DZ(0x1d1),s[DZ(0x23b)]=DZ(0x1cf),s[DZ(0x20a)]=DZ(0x1cc),s[DZ(0x1e1)]=DZ(0x23f),s[DZ(0x219)]=DZ(0x1d6),s[DZ(0x1fd)]=DZ(0x204),s[DZ(0x234)]=DZ(0x23a),s[DZ(0x209)]=DZ(0x20b),s[DZ(0x216)]=DZ(0x21a),s[DZ(0x236)]=DZ(0x1e9),s[DZ(0x1e4)]=DZ(0x1f4),s[DZ(0x22b)]=DZ(0x1e2),s[DZ(0x211)]=DZ(0x1c7),s[DZ(0x207)]=DZ(0x22e),s[DZ(0x1f8)]=DZ(0x1de),s[DZ(0x208)]=DZ(0x1fa),s[DZ(0x224)]=DZ(0x1c2),s[DZ(0x1d7)]=DZ(0x21d),s[DZ(0x1e7)]=DZ(0x23e),s[DZ(0x1d2)]=DZ(0x225),s[DZ(0x1e8)]=DZ(0x1c1),s[DZ(0x1df)]=DZ(0x220),s[DZ(0x1bd)]=DZ(0x1fc),s[DZ(0x1ed)]=DZ(0x1ea),s[DZ(0x1e0)]=DZ(0x218),s[DZ(0x1be)]=DZ(0x215),s[DZ(0x231)]=DZ(0x21b),s[DZ(0x1e5)]=DZ(0x223),s[DZ(0x1ee)]=DZ(0x212),s[DZ(0x230)]=DZ(0x1f6),s[DZ(0x229)]=DZ(0x23c),s[DZ(0x214)]=DZ(0x1c0),s[DZ(0x205)]=DZ(0x22a),s[DZ(0x1ec)]=DZ(0x1c3),s[DZ(0x1c5)]=DZ(0x1d3),s[DZ(0x233)]=DZ(0x20e),s[DZ(0x1d5)]=DZ(0x1c8),s[DZ(0x1ca)]=DZ(0x1d0),s[DZ(0x213)]=DZ(0x22f),s[DZ(0x1e3)]=DZ(0x1f5),s[DZ(0x20f)]=DZ(0x227),s[DZ(0x237)]=DZ(0x1bf);const X=s;return async M=>{const Dx=DZ,u=X[Dx(0x1f0)][Dx(0x1e6)]('|');let o=0x0;while(!![]){switch(u[o++]){case'0':M[Dx(0x221)](X[Dx(0x1cb)],{'schema':{'tags':[X[Dx(0x217)],X[Dx(0x1c6)]],'summary':X[Dx(0x1ce)],'description':X[Dx(0x1c9)],'access':Dx(0x1d6),'permissions':[],'params':resourceSchemas[Dx(0x238)]}},async q=>deleteResourceRelation({...q[Dx(0x1f2)],'user':user(q)},L));continue;case'1':M[Dx(0x232)](X[Dx(0x23b)],{'schema':{'tags':[X[Dx(0x217)],Dx(0x1db)],'summary':X[Dx(0x20a)],'description':X[Dx(0x1e1)],'access':X[Dx(0x219)],'permissions':[],'params':resourceSchemas[Dx(0x1ef)]}},async q=>addNote({...q[Dx(0x1f2)],...q[Dx(0x21f)],'user':user(q)},L));continue;case'2':M[Dx(0x232)](X[Dx(0x1fd)],{'schema':{'tags':[Dx(0x206),X[Dx(0x1c6)]],'summary':X[Dx(0x234)],'description':Dx(0x1d8),'access':X[Dx(0x219)],'permissions':[],'params':resourceSchemas[Dx(0x1ef)]}},async q=>addResourceFile({...q[Dx(0x1f2)],...q[Dx(0x21f)],'user':user(q)},L));continue;case'3':M[Dx(0x232)](X[Dx(0x209)],{'schema':{'tags':[X[Dx(0x217)],X[Dx(0x1c6)]],'summary':X[Dx(0x216)],'description':X[Dx(0x236)],'access':X[Dx(0x219)],'permissions':[X[Dx(0x1e4)]],'params':resourceSchemas[Dx(0x22d)],'body':resourceSchemas[Dx(0x1ff)]}},async q=>uploadResourceFile({...q[Dx(0x1f2)],...q[Dx(0x21f)],'user':user(q)},L));continue;case'4':M[Dx(0x232)](X[Dx(0x22b)],{'schema':{'tags':[X[Dx(0x217)],X[Dx(0x1c6)]],'summary':X[Dx(0x211)],'description':X[Dx(0x207)],'access':X[Dx(0x219)],'permissions':[],'params':resourceSchemas[Dx(0x20d)]}},async q=>createResourceRelation({...q[Dx(0x1f2)],'data':q[Dx(0x21f)],'user':user(q)},L));continue;case'5':M[Dx(0x1f3)](X[Dx(0x1f8)],{'schema':{'tags':[X[Dx(0x217)],X[Dx(0x1c6)]],'summary':X[Dx(0x208)],'description':Dx(0x1dc),'access':Dx(0x1d6),'permissions':[X[Dx(0x224)]],'params':resourceSchemas[Dx(0x202)],'querystring':resourceSchemas[Dx(0x235)]}},async q=>exportResource({...q[Dx(0x1fe)],...q[Dx(0x1f2)],'user':user(q)},L));continue;case'6':M[Dx(0x1f3)](X[Dx(0x1d7)],{'schema':{'tags':[X[Dx(0x217)],X[Dx(0x1c6)]],'summary':X[Dx(0x1e7)],'description':X[Dx(0x1d2)],'access':Dx(0x1d6),'permissions':[],'params':resourceSchemas[Dx(0x1db)]}},async q=>searchResource({...q[Dx(0x1fe)],...q[Dx(0x1f2)],'user':user(q)},L));continue;case'7':M[Dx(0x1f3)](X[Dx(0x1fd)],{'schema':{'tags':[X[Dx(0x217)],X[Dx(0x1c6)]],'summary':X[Dx(0x1e8)],'description':Dx(0x1f7),'access':X[Dx(0x219)],'permissions':[],'params':resourceSchemas[Dx(0x1ef)]}},async q=>listResourceRelation({...q[Dx(0x1f2)],'relation':Dx(0x228),'user':user(q)},L));continue;case'8':const r={};r[Dx(0x1da)]=[X[Dx(0x217)],Dx(0x1db)],r[Dx(0x1c4)]=X[Dx(0x1df)],r[Dx(0x226)]=X[Dx(0x1bd)],r[Dx(0x200)]=X[Dx(0x219)],r[Dx(0x21e)]=[],r[Dx(0x1f2)]=resourceSchemas[Dx(0x1ef)];const i={};i[Dx(0x203)]=r,M[Dx(0x1f3)](Dx(0x22f),i,async q=>getResource({...q[Dx(0x1f2)],'user':user(q)},L));continue;case'9':M[Dx(0x1f3)](X[Dx(0x22b)],{'schema':{'tags':[X[Dx(0x217)],X[Dx(0x1c6)]],'summary':X[Dx(0x1ed)],'description':X[Dx(0x1e0)],'access':X[Dx(0x219)],'permissions':[],'params':resourceSchemas[Dx(0x20d)]}},async q=>listResourceRelation({...q[Dx(0x1fe)],...q[Dx(0x1f2)],'user':user(q)},L));continue;case'10':M[Dx(0x1f3)](X[Dx(0x1be)],{'schema':{'tags':[X[Dx(0x217)],Dx(0x1db)],'summary':X[Dx(0x231)],'description':X[Dx(0x1e5)],'access':X[Dx(0x219)],'permissions':[],'params':resourceSchemas[Dx(0x1db)]}},async q=>listResources({...q[Dx(0x1fe)],...q[Dx(0x1f2)],'user':user(q)},L));continue;case'11':M[Dx(0x1f3)](X[Dx(0x1ee)],{'schema':{'tags':[Dx(0x206),X[Dx(0x1c6)]],'summary':X[Dx(0x230)],'description':X[Dx(0x229)],'access':X[Dx(0x219)],'permissions':[],'params':resourceSchemas[Dx(0x201)],'querystring':resourceSchemas[Dx(0x210)]}},async q=>suggestResource({...q[Dx(0x1fe)],...q[Dx(0x1f2)],'user':user(q)},L));continue;case'12':M[Dx(0x1f3)](X[Dx(0x23b)],{'schema':{'tags':[X[Dx(0x217)],Dx(0x1db)],'summary':X[Dx(0x214)],'description':X[Dx(0x205)],'access':X[Dx(0x219)],'permissions':[],'params':resourceSchemas[Dx(0x1ef)]}},async q=>listResourceRelation({...q[Dx(0x1f2)],'relation':Dx(0x222),'user':user(q)},L));continue;case'13':M[Dx(0x232)](X[Dx(0x1be)],{'schema':{'tags':[X[Dx(0x217)],X[Dx(0x1c6)]],'summary':X[Dx(0x1ec)],'description':X[Dx(0x1c5)],'access':X[Dx(0x219)],'permissions':[],'params':resourceSchemas[Dx(0x1db)]}},async q=>createResource({...q[Dx(0x1f2)],'data':q[Dx(0x21f)],'user':user(q)},L));continue;case'14':M[Dx(0x221)](X[Dx(0x233)],{'schema':{'tags':[X[Dx(0x217)],X[Dx(0x1c6)]],'summary':X[Dx(0x1d5)],'description':X[Dx(0x1ca)],'access':Dx(0x1d6),'permissions':[],'params':resourceSchemas[Dx(0x238)]}},async q=>deleteResourceRelation({...q[Dx(0x1f2)],'relation':Dx(0x228),'user':user(q)},L));continue;case'15':M[Dx(0x221)](X[Dx(0x213)],{'schema':{'tags':[X[Dx(0x217)],X[Dx(0x1c6)]],'summary':X[Dx(0x1e3)],'description':X[Dx(0x20f)],'access':Dx(0x1d6),'permissions':[],'params':resourceSchemas[Dx(0x1ef)]}},async q=>deleteResource({...q[Dx(0x1f2)],'user':user(q)},L));continue;case'16':M[Dx(0x21c)](X[Dx(0x213)],{'schema':{'tags':[X[Dx(0x217)],Dx(0x1db)],'summary':X[Dx(0x237)],'description':Dx(0x1cd),'access':X[Dx(0x219)],'permissions':[],'params':resourceSchemas[Dx(0x1ef)]}},async q=>updateResource({...q[Dx(0x1f2)],'patch':q[Dx(0x21f)],'user':user(q)},L));continue;}break;}};}
|
|
1
|
+
import{ForbiddenError}from'../../errors.js';import{listResources}from'./services/list-resources.js';import{getResource}from'./services/get-resource.js';import{createResource}from'./services/create-resource.js';function S(d,h){d=d-0xbc;const p=v();let Z=p[d];return Z;}import{updateResource}from'./services/update-resource.js';import{deleteResource}from'./services/delete-resource.js';import{listResourceRelation}from'./services/list-resource-relation.js';import{createResourceRelation}from'./services/create-resource-relation.js';function v(){const Y=['get','/api/resource/:resource/search','resource','user','fcore','Suggest\x20resource\x20values','suggestQuery','query','params','/api/resource/:resource/export','resourceId','delete','/api/resource/:resource/:id','uploadResourceFile','file',':update','/api/resource/:resource/:id/:relation','post','Creates\x20a\x20relation\x20for\x20a\x20resource\x20record.','resourceIdRelationId'];v=function(){return Y;};return v();}import{updateResourceRelation}from'./services/update-resource-relation.js';import{deleteResourceRelation}from'./services/delete-resource-relation.js';import{searchResource}from'./services/search-resource.js';import{exportResource}from'./services/export-resource.js';import{suggestResource}from'./services/suggest-resource.js';import{resourceSchemas}from'./schema.js';import{uploadFile}from'../file/services/upload-file.js';const user=d=>d['user'];export function resourceRoutes(d){return async h=>{const n=S;h[n(0xbc)](n(0xbd),{'schema':{'tags':['fcore',n(0xbe)],'summary':'Search\x20resource','description':'Searches\x20records\x20in\x20a\x20registered\x20resource.','access':n(0xbf),'permissions':[],'params':resourceSchemas[n(0xbe)]}},async p=>searchResource({...p['query'],...p['params'],'user':user(p)},d)),h['get']('/api/suggest/:resource/:field',{'schema':{'tags':[n(0xc0),'resource'],'summary':n(0xc1),'description':'Returns\x20suggested\x20values\x20for\x20a\x20resource\x20field.','access':'user','permissions':[],'params':resourceSchemas['resourceField'],'querystring':resourceSchemas[n(0xc2)]}},async p=>suggestResource({...p[n(0xc3)],...p[n(0xc4)],'user':user(p)},d)),h['get'](n(0xc5),{'schema':{'tags':[n(0xc0),'resource'],'summary':'Export\x20resource\x20records','description':'Exports\x20readable\x20records\x20from\x20a\x20registered\x20resource.','access':n(0xbf),'permissions':['*:read'],'params':resourceSchemas['exportResource'],'querystring':resourceSchemas['exportResourceQuery']}},async p=>exportResource({...p['query'],...p['params'],'user':user(p)},d)),h['get']('/api/resource/:resource',{'schema':{'tags':['fcore','resource'],'summary':'List\x20resource\x20records','description':'Returns\x20records\x20from\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas['resource']}},async p=>listResources({...p[n(0xc3)],...p[n(0xc4)],'user':user(p)},d)),h['post']('/api/resource/:resource',{'schema':{'tags':[n(0xc0),'resource'],'summary':'Create\x20resource\x20record','description':'Creates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas['resource']}},async p=>createResource({...p['params'],'data':p['body'],'user':user(p)},d)),h[n(0xbc)]('/api/resource/:resource/:id',{'schema':{'tags':['fcore','resource'],'summary':'Get\x20resource\x20record','description':'Returns\x20one\x20record\x20from\x20a\x20registered\x20resource.','access':n(0xbf),'permissions':[],'params':resourceSchemas['resourceId'],'querystring':resourceSchemas['resourceIncludeQuery']}},async p=>getResource({...p['query'],...p['params'],'user':user(p)},d)),h['put']('/api/resource/:resource/:id',{'schema':{'tags':[n(0xc0),n(0xbe)],'summary':'Update\x20resource\x20record','description':'Updates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas[n(0xc6)]}},async p=>updateResource({...p['params'],'patch':p['body'],'user':user(p)},d)),h[n(0xc7)](n(0xc8),{'schema':{'tags':['fcore','resource'],'summary':'Delete\x20resource\x20record','description':'Deletes\x20a\x20record\x20from\x20a\x20registered\x20resource.','access':n(0xbf),'permissions':[],'params':resourceSchemas['resourceId']}},async p=>deleteResource({...p['params'],'user':user(p)},d)),h['post']('/api/resource/:resource/:id/upload',{'schema':{'tags':['fcore','resource'],'summary':'Upload\x20resource\x20file','description':'Uploads\x20a\x20file\x20to\x20a\x20Resource\x20record\x20and\x20stores\x20its\x20metadata.','access':'user','permissions':[],'params':resourceSchemas[n(0xc9)]}},async p=>{const X=n,Z=await p[X(0xca)]();if(!Z)throw new Error('File\x20is\x20required');const D=p[X(0xc4)][X(0xbe)],u=p[X(0xc4)]['id'];if(p[X(0xbf)]?.['type']!=='admin'&&!p['user']?.['permissions']['includes'](D+X(0xcb)))throw new ForbiddenError('Missing\x20permission:\x20'+D+':update');return uploadFile({'file':Z,'metadata':{'name':Z['filename'],'path':Z['fields']['path']?.['value'],'resource':D,'resourceId':u},'user':p[X(0xbf)]},d);}),h['get'](n(0xcc),{'schema':{'tags':[n(0xc0),'resource'],'summary':'List\x20resource\x20relations','description':'Returns\x20related\x20records\x20for\x20a\x20resource\x20record.','access':'user','permissions':[],'schema':{'params':resourceSchemas['resourceIdRelation']}}},async p=>listResourceRelation({...p['query'],...p['params'],'user':user(p)},d)),h[n(0xcd)]('/api/resource/:resource/:id/:relation',{'schema':{'tags':['fcore','resource'],'summary':'Create\x20resource\x20relation','description':n(0xce),'access':'user','permissions':[],'params':resourceSchemas['resourceIdRelation']}},async p=>createResourceRelation({...p['params'],'data':p['body'],'user':user(p)},d)),h['delete']('/api/resource/:resource/:id/:relation/:relationId',{'schema':{'tags':['fcore',n(0xbe)],'summary':'Delete\x20resource\x20relation','description':'Deletes\x20a\x20relation\x20from\x20a\x20resource\x20record.','access':'user','permissions':[],'params':resourceSchemas[n(0xcf)]}},async p=>deleteResourceRelation({...p['params'],'user':user(p)},d)),h['put']('/api/resource/:resource/:id/:relation/:relationId',{'schema':{'tags':[n(0xc0),n(0xbe)],'summary':'Update\x20resource\x20relation','description':'Updates\x20a\x20related\x20resource\x20record.','access':'user','permissions':[],'params':resourceSchemas['resourceIdRelationId']}},async p=>updateResourceRelation({...p['params'],'data':p['body'],'user':user(p)},d));};}
|
|
@@ -36,6 +36,9 @@ export declare const resourceSchemas: {
|
|
|
36
36
|
resource: import("@sinclair/typebox").TString;
|
|
37
37
|
id: import("@sinclair/typebox").TString;
|
|
38
38
|
}>;
|
|
39
|
+
resourceIncludeQuery: import("@sinclair/typebox").TObject<{
|
|
40
|
+
include: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
41
|
+
}>;
|
|
39
42
|
resourceIdRelation: import("@sinclair/typebox").TObject<{
|
|
40
43
|
resource: import("@sinclair/typebox").TString;
|
|
41
44
|
id: import("@sinclair/typebox").TString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,aAAa;QACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;QACrC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB;CACF;AAED,eAAO,MAAM,UAAU,qCAIrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD,eAAO,MAAM,eAAe;IAC1B,cAAc;;;IACd,QAAQ;;;IACR,cAAc;;;IACd,aAAa;;;;IACb,YAAY;;;;;IAKZ,UAAU;;;;IACV,kBAAkB;;;;;IAKlB,oBAAoB;;;;;;IAMpB,kBAAkB;;;;IAIlB,sBAAsB;;;;IAItB,mBAAmB;;;;;;;;CAQpB,CAAC"}
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,aAAa;QACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;QACrC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB;CACF;AAED,eAAO,MAAM,UAAU,qCAIrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD,eAAO,MAAM,eAAe;IAC1B,cAAc;;;IACd,QAAQ;;;IACR,cAAc;;;IACd,aAAa;;;;IACb,YAAY;;;;;IAKZ,UAAU;;;;IACV,oBAAoB;;;IAGpB,kBAAkB;;;;;IAKlB,oBAAoB;;;;;;IAMpB,kBAAkB;;;;IAIlB,sBAAsB;;;;IAItB,mBAAmB;;;;;;;;CAQpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const d=S;import{Type}from'@sinclair/typebox';function S(d,h){d=d-0x13b;const p=v();let Z=p[d];return Z;}export const identifier=Type['String']({'minLength':0x1,'maxLength':0x80,'pattern':'^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$'});export const resourceSchemas={'dictionaryName':Type['Object']({'name':identifier}),'resource':Type[d(0x13b)]({'resource':identifier}),'exportResource':Type['Object']({'resource':identifier}),'resourceField':Type['Object']({'resource':identifier,'field':identifier}),'suggestQuery':Type['Object']({'q':Type[d(0x13c)](Type[d(0x13d)]()),'search':Type[d(0x13c)](Type[d(0x13d)]()),'limit':Type['Optional'](Type['Integer']({'minimum':0x1,'maximum':0xc8}))}),'resourceId':Type[d(0x13b)]({'resource':identifier,'id':identifier}),'resourceIncludeQuery':Type['Object']({'include':Type['Optional'](Type['String']({'minLength':0x1}))}),'resourceIdRelation':Type[d(0x13b)]({'resource':identifier,'id':identifier,'relation':identifier}),'resourceIdRelationId':Type['Object']({'resource':identifier,'id':identifier,'relation':identifier,'relationId':identifier}),'uploadResourceFile':Type[d(0x13b)]({'resource':identifier,'id':identifier}),'uploadResourceFileBody':Type['Object']({'file':Type['Any'](),'fileName':Type['String']({'minLength':0x1,'maxLength':0xff})}),'exportResourceQuery':Type['Object']({'filter':Type['Optional'](Type['Record'](Type[d(0x13d)](),Type[d(0x13e)]())),'sort':Type['Optional'](Type['Array'](Type['String']({'minLength':0x1}))),'search':Type['Optional'](Type[d(0x13d)]()),'limit':Type['Optional'](Type[d(0x13f)]({'minimum':0x1,'maximum':0xc8})),'offset':Type[d(0x13c)](Type[d(0x13f)]({'minimum':0x0})),'fields':Type['Optional'](Type['Array'](identifier))})};function v(){const h=['Object','Optional','String','Unknown','Integer'];v=function(){return h;};return v();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function S(d,h){d=d-0x167;const p=v();let Z=p[d];return Z;}function v(){const D=['resource'];v=function(){return D;};return v();}export async function addNote(d,h){const Z=S,p=await h['pg']['query']('INSERT\x20INTO\x20admin.notes(resource,resource_id,body)\x20VALUES\x20($1,$2,$3)\x20RETURNING\x20*',[d[Z(0x167)],String(d['id']),d['body']]);return p['rows'][0x0];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function v(){const D=['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\x20\x20','size'];v=function(){return D;};return v();}function S(d,h){d=d-0x180;const p=v();let Z=p[d];return Z;}export async function addResourceFile(d,h){const Z=S,p=await h['pg'][Z(0x180)](Z(0x181),[d['resource'],String(d['id']),d['filePath'],d[Z(0x182)]??null]);return p['rows'][0x0];}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Implements the create resource relation application service for its module.
|
|
3
3
|
*/
|
|
4
|
-
import type { AppContext } from '../../../context.js';
|
|
5
|
-
export declare function createResourceRelation(params:
|
|
4
|
+
import type { AppContext, User } from '../../../context.js';
|
|
5
|
+
export declare function createResourceRelation(params: {
|
|
6
|
+
resource: string;
|
|
7
|
+
id: string;
|
|
8
|
+
relation: string;
|
|
9
|
+
data?: any;
|
|
10
|
+
user: User;
|
|
11
|
+
}, ctx: AppContext): Promise<any>;
|
|
6
12
|
//# sourceMappingURL=create-resource-relation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/create-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/create-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EAClF,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function createResourceRelation(d,h){const {resource:p,id:Z,relation:D,data:u,user:n}=d;return h['resource']['createRelation']({'name':p,'id':Z,'relation':D,'data':u,'user':n});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function v(){var Z=['create','data'];v=function(){return Z;};return v();}function S(d,h){d=d-0x6e;var p=v();var Z=p[d];return Z;}export async function createResource(d,h){var p=S;return h['resource'][p(0x6e)]({'name':d['resource'],'data':d[p(0x6f)],'user':d['user']});}
|
|
@@ -2,5 +2,12 @@
|
|
|
2
2
|
* Implements the delete resource relation application service for its module.
|
|
3
3
|
*/
|
|
4
4
|
import type { AppContext } from '../../../context.js';
|
|
5
|
-
export declare function deleteResourceRelation(params:
|
|
5
|
+
export declare function deleteResourceRelation(params: {
|
|
6
|
+
resource: string;
|
|
7
|
+
id: string;
|
|
8
|
+
relation: string;
|
|
9
|
+
relationId: string;
|
|
10
|
+
}, ctx: AppContext): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
}>;
|
|
6
13
|
//# sourceMappingURL=delete-resource-relation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/delete-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"delete-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/delete-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAC9E,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAG/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function deleteResourceRelation(d,h){const {resource:p,id:Z,relation:D,relationId:u}=d;return h['resource']['deleteRelation']({'name':p,'id':Z,'relation':D,'relationId':u});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function deleteResource(d,h){var p=S;return h[p(0x159)]['delete']({'name':d['resource'],'id':d['id'],'user':d['user']});}function S(d,h){d=d-0x159;var p=v();var Z=p[d];return Z;}function v(){var Z=['resource'];v=function(){return Z;};return v();}
|
|
@@ -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
|
-
|
|
1
|
+
function S(d,h){d=d-0x1b6;const p=v();let Z=p[d];return Z;}import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';export async function exportResource(d,h){const Z=S,p=await h['resource']['find']({'name':d['resource'],'query':{'filter':parseFilterQuery(d),'sort':d['sort'],'search':d[Z(0x1b6)],'limit':d['limit'],'offset':d[Z(0x1b7)],'fields':d['fields']},'user':d['user']});return p['rows'];}function v(){const D=['search','offset'];v=function(){return D;};return v();}
|
|
@@ -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
|
-
|
|
1
|
+
function S(d,h){d=d-0xd0;var p=v();var Z=p[d];return Z;}export async function getResource(d,h){var p=S;return h['resource']['findOne']({'name':d[p(0xd0)],'id':d['id'],'query':{'include':d[p(0xd1)]},'user':d['user']});}function v(){var Z=['resource','include'];v=function(){return Z;};return v();}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Implements the list resource relation application service for its module.
|
|
3
3
|
*/
|
|
4
|
-
import type { AppContext } from '../../../context.js';
|
|
5
|
-
|
|
4
|
+
import type { AppContext, User } from '../../../context.js';
|
|
5
|
+
import type { ResourceQuery } from '../../../plugins/resource/resource.types.js';
|
|
6
|
+
export declare function listResourceRelation(params: {
|
|
7
|
+
resource: string;
|
|
8
|
+
id: string;
|
|
9
|
+
relation: string;
|
|
10
|
+
query?: ResourceQuery;
|
|
11
|
+
user?: User;
|
|
12
|
+
}, ctx: AppContext): Promise<any>;
|
|
6
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,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
|
-
|
|
1
|
+
export async function listResourceRelation(d,h){const {resource:p,id:Z,relation:D,query:u,user:n}=d;return h['resource']['findRelation']({'name':p,'id':Z,'relation':D,'query':u,'user':n});}
|
|
@@ -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 v(){var Z=['find','resource','sort','search','page','max'];v=function(){return Z;};return v();}function S(d,h){d=d-0x16b;var p=v();var Z=p[d];return Z;}import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';export async function listResources(d,h){var p=S;return h['resource'][p(0x16b)]({'name':d[p(0x16c)],'query':{'filter':parseFilterQuery(d),'sort':d[p(0x16d)],'search':d[p(0x16e)],'limit':d['limit'],'offset':d['offset']??(d[p(0x16f)]?Math[p(0x170)](d['page']-0x1,0x0):0x0)*(d['limit']??0x14)},'user':d['user']});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/search-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"search-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/search-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAE/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';export async function searchResource(d,h){return h['resource']['find']({'name':d['resource'],'query':{...d,'filter':parseFilterQuery(d)},'user':d['user']});}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Implements the suggest resource application service for its module.
|
|
3
|
-
*/
|
|
4
1
|
import type { AppContext } from '../../../context.js';
|
|
5
|
-
|
|
2
|
+
type SuggestResourceResult = {
|
|
3
|
+
search: string;
|
|
4
|
+
time: number;
|
|
5
|
+
data: any[];
|
|
6
|
+
limit?: number;
|
|
7
|
+
count?: number;
|
|
8
|
+
total?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function suggestResource(params: any, ctx: AppContext): Promise<SuggestResourceResult>;
|
|
11
|
+
export {};
|
|
6
12
|
//# sourceMappingURL=suggest-resource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/suggest-resource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"suggest-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/suggest-resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,KAAK,qBAAqB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAElB,CAAC;AAEF,wBAAsB,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA4ClG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{ValidationError}from'../../../errors.js';import{autoIndex}from'../../../plugins/resource/utils/auto-index.js';function S(d,h){d=d-0x93;const p=v();let Z=p[d];return Z;}function v(){const s=['toLowerCase','fields','dictionary','name','SELECT\x20','\x20as\x20id,\x20','field','get','slice','now'];v=function(){return s;};return v();}export async function suggestResource(d,h){const g=S,p=h['resource']['get'](d['resource']),Z=String(d['search']??d['q']??'')[g(0x93)](),D=Math['min'](Math['max'](Number(d['limit']??0x14),0x1),0xc8),u=Date['now'](),n=p[g(0x94)][d['field']],X=n?.[g(0x95)],Y=n?.['lookup']?.['table'];if(Y){const Q=n['lookup']?.['text']??g(0x96),F=n['lookup']?.['value']??'id';autoIndex(Y,Q,'text',h['pg']);const B=await h['pg']['query'](g(0x97)+F+g(0x98)+Q+'\x20as\x20text\x20FROM\x20'+Y+'\x20WHERE\x20lower('+Q+')\x20~\x20$1\x20LIMIT\x20$2',[''+Z[g(0x93)](),D])['then'](K=>K['rows']);return{'limit':D,'count':B['length'],'search':Z,'time':Date['now']()-u,'data':B};}if(!X)throw new ValidationError('Field\x20has\x20no\x20lookup\x20dictionary:\x20'+d[g(0x99)]);const w=await h[g(0x95)][g(0x9a)](X),y=w['filter'](K=>!Z||K['code']['startsWith'](Z)||K[g(0x96)]['startsWith'](Z))[g(0x9b)](0x0,D)['map'](K=>({'id':K['code']||K['id'],'text':K['name']||K['text']}));return{'search':Z,'limit':D,'count':y['length'],'time':Date[g(0x9c)]()-u,'data':y};}
|
|
@@ -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 S(d,h){d=d-0x15d;const p=v();let Z=p[d];return Z;}export async function updateResourceRelation(d,h){const Y=S,{resource:p,id:Z,relation:D,relationId:u,data:n,user:X}=d;return h[Y(0x15d)]['updateRelation']({'name':p,'id':Z,'relation':D,'relationId':u,'data':n,'user':X});}function v(){const w=['resource'];v=function(){return w;};return v();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function updateResource(d,h){return h['resource']['update']({'name':d['resource'],'id':d['id'],'data':d['patch'],'user':d['user']});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function S(d,h){d=d-0x111;const p=v();let Z=p[d];return Z;}import{ForbiddenError,NotFoundError,ValidationError}from'../../../errors.js';export async function uploadResourceFile(d,h){const n=S,p=h['resource'][n(0x111)](d['resource']);if(p['access']==='admin'&&d['user']?.[n(0x112)]!==n(0x113))throw new ForbiddenError(n(0x114));if(d['user']?.['type']!=='admin'&&!d['user']?.['permissions']?.['includes']((p['permission']??p['name'])+':update'))throw new ForbiddenError(n(0x115)+(p['permission']??p['name'])+':update');if(!Buffer['isBuffer'](d['file'])||d['file']['length']===0x0)throw new ValidationError('File\x20is\x20required');const Z=d['fileName']['replace'](/[^A-Za-z0-9._-]/g,'_');if(!Z)throw new ValidationError('File\x20name\x20is\x20required');const D='files/'+d[n(0x116)]+'/'+String(d['id'])+'/'+Z;await h['file']['put'](D,d[n(0x117)]);if(!await h['file']['exists'](D))throw new NotFoundError('Uploaded\x20file\x20not\x20found');const u=await h['pg']['query'](n(0x118),[d[n(0x116)],String(d['id']),D,d['file']['length']]);return u['rows'][0x0];}function v(){const X=['get','type','admin','Admin\x20access\x20required','Missing\x20permission:\x20','resource','file','\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'];v=function(){return X;};return v();}
|
|
@@ -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
|
-
function
|
|
1
|
+
const w=S;function v(){const Q=['user','Get\x20platform\x20dictionary','/api/dictionary/:name','system:dictionaries','Returns\x20direct\x20and\x20role-based\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','/api/access/:type/:id','system','accessTarget','params','body','admin','system:settings','/api/system/settings','Update\x20system\x20settings','get','fcore','Returns\x20system\x20logger\x20entries\x20for\x20the\x20requested\x20path.','logger','system:audit','Check\x20system\x20health','Checks\x20the\x20availability\x20of\x20system\x20dependencies.','/api/system/list','apiListQuery'];v=function(){return Q;};return v();}import{getSystemSettings}from'./services/get-system-settings.js';function S(d,h){d=d-0x141;const p=v();let Z=p[d];return Z;}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';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=d=>d[w(0x141)];export function systemRoutes(d,h=new Map()){return async p=>{const y=S;p['get']('/api/dictionary/:name',{'schema':{'tags':['fcore','system'],'summary':y(0x142),'description':'Returns\x20a\x20registered\x20platform\x20dictionary\x20by\x20name.','access':'user','permissions':['system:dictionaries'],'params':systemSchemas['dictionaryName']}},async D=>({'items':await getDictionary({...D['params'],'user':u(D)},d)})),p['post'](y(0x143),{'schema':{'tags':['fcore','system'],'summary':'Update\x20platform\x20dictionary','description':'Replaces\x20the\x20items\x20of\x20a\x20registered\x20platform\x20dictionary.','access':'user','permissions':[y(0x144)],'params':systemSchemas['dictionaryName'],'body':systemSchemas['dictionaryItems']}},async D=>updateDictionary({...D['params'],...D['body'],'user':u(D)},d));const Z=async D=>getAccess({...D['params'],'user':u(D)},d);p['get']('/api/access/:type/:id',{'schema':{'tags':['fcore','system'],'summary':'Get\x20access\x20rules','description':y(0x145),'access':'admin','permissions':['system:access'],'params':systemSchemas['accessTarget']}},Z),p['post'](y(0x146),{'schema':{'tags':['fcore',y(0x147)],'summary':'Set\x20access\x20rules','description':'Replaces\x20direct\x20access\x20rules\x20for\x20a\x20user\x20or\x20role.','access':'admin','permissions':['system:access'],'params':systemSchemas[y(0x148)],'body':systemSchemas['access']}},async D=>setAccess({...D[y(0x149)],...D[y(0x14a)],'user':u(D)},d)),p['get']('/api/system/settings',{'schema':{'tags':['fcore','system'],'summary':'Get\x20system\x20settings','description':'Returns\x20system\x20settings\x20as\x20nested\x20JSON.','access':y(0x14b),'permissions':[y(0x14c)]}},async D=>getSystemSettings({...D[y(0x149)],'user':u(D)},d)),p['post'](y(0x14d),{'schema':{'tags':['fcore','system'],'summary':y(0x14e),'description':'Updates\x20system\x20settings\x20using\x20flat\x20dot-notation\x20keys.','access':y(0x14b),'permissions':['system:settings'],'body':systemSchemas['settings']}},async D=>updateSystemSettings({...D[y(0x149)],'patch':D['body'],'user':u(D)},d)),p[y(0x14f)]('/api/system/logger',{'schema':{'tags':[y(0x150),'system'],'summary':'Get\x20system\x20log','description':y(0x151),'access':y(0x141),'permissions':['system:logs'],'querystring':systemSchemas[y(0x152)]}},async(D,n)=>{const {contentType:X,body:Y}=await getSystemLog({...D['query'],'user':u(D)},d);return n['type'](X)['send'](Y);}),p['get']('/api/system/audit',{'schema':{'tags':['fcore',y(0x147)],'summary':'Get\x20audit\x20log','description':'Returns\x20the\x20system\x20audit\x20log\x20entries.','access':'user','permissions':[y(0x153)]}},async D=>getAuditLog({...D['query'],'user':u(D)},d)),p['get']('/api/system/check',{'schema':{'tags':['fcore','system'],'summary':y(0x154),'description':y(0x155),'access':'user','permissions':['system:check']}},async D=>checkSystem({'user':u(D)},d)),p[y(0x14f)](y(0x156),{'schema':{'tags':[y(0x150),'system'],'summary':'List\x20APIs','description':'Returns\x20the\x20list\x20of\x20registered\x20platform\x20APIs.','access':'admin','permissions':[],'querystring':systemSchemas[y(0x157)]}},async D=>getApiList({'user':u(D),'apiRoutes':h,...D['query']},d));};}
|
|
@@ -3,12 +3,33 @@ 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
|
+
access: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
20
|
+
resource: import("@sinclair/typebox").TString;
|
|
21
|
+
actions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
22
|
+
}>>;
|
|
23
|
+
}>;
|
|
24
|
+
apiListQuery: import("@sinclair/typebox").TObject<{
|
|
25
|
+
format: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"short">, import("@sinclair/typebox").TLiteral<"extended">]>>;
|
|
26
|
+
}>;
|
|
6
27
|
settingsEntity: import("@sinclair/typebox").TObject<{
|
|
7
28
|
entity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
29
|
}>;
|
|
9
30
|
settings: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
|
|
10
31
|
logger: import("@sinclair/typebox").TObject<{
|
|
11
|
-
|
|
32
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
12
33
|
}>;
|
|
13
34
|
};
|
|
14
35
|
//# 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;;;;;;IAQN,YAAY;;;IAGZ,cAAc;;;IACd,QAAQ;IACR,MAAM;;;CAKP,CAAC"}
|