@opengis/fcore 0.0.1-beta.2 → 0.0.1-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -3
- package/README.md +71 -71
- package/dist/config.d.ts +2 -10
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/context.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/fastify.d.ts +2 -5
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fcore.js +1 -1
- package/dist/index.js +1 -1
- package/dist/migrations/cli.js +1 -1
- package/dist/migrations/runner.js +1 -1
- package/dist/modules/auth/adduser-cli.d.ts +3 -0
- package/dist/modules/auth/adduser-cli.d.ts.map +1 -0
- package/dist/modules/auth/adduser-cli.js +2 -0
- package/dist/modules/auth/passwd-cli.d.ts +3 -0
- package/dist/modules/auth/passwd-cli.d.ts.map +1 -0
- package/dist/modules/auth/passwd-cli.js +2 -0
- package/dist/modules/auth/permission-cli.d.ts +3 -0
- package/dist/modules/auth/permission-cli.d.ts.map +1 -0
- package/dist/modules/auth/permission-cli.js +2 -0
- package/dist/modules/auth/route.d.ts.map +1 -1
- package/dist/modules/auth/route.js +1 -1
- package/dist/modules/auth/schema.d.ts +10 -1
- package/dist/modules/auth/schema.d.ts.map +1 -1
- package/dist/modules/auth/schema.js +1 -1
- package/dist/modules/auth/services/change-password.d.ts +9 -0
- package/dist/modules/auth/services/change-password.d.ts.map +1 -0
- package/dist/modules/auth/services/change-password.js +1 -0
- package/dist/modules/auth/services/get-current-user.d.ts +1 -0
- package/dist/modules/auth/services/get-current-user.d.ts.map +1 -1
- package/dist/modules/auth/services/get-current-user.js +1 -1
- package/dist/modules/auth/services/registration.d.ts +14 -0
- package/dist/modules/auth/services/registration.d.ts.map +1 -0
- package/dist/modules/auth/services/registration.js +1 -0
- package/dist/modules/auth/services/verify-two-factor.js +1 -1
- package/dist/modules/file/mime.d.ts +3 -0
- package/dist/modules/file/mime.d.ts.map +1 -0
- package/dist/modules/file/mime.js +1 -0
- package/dist/modules/file/route.d.ts.map +1 -1
- package/dist/modules/file/route.js +1 -1
- package/dist/modules/file/schema.d.ts +3 -0
- package/dist/modules/file/schema.d.ts.map +1 -1
- package/dist/modules/file/schema.js +1 -1
- package/dist/modules/file/services/get-file.js +1 -1
- package/dist/modules/file/services/resize-file.d.ts.map +1 -1
- package/dist/modules/file/services/resize-file.js +1 -1
- package/dist/modules/file/services/upload-file.d.ts +4 -6
- package/dist/modules/file/services/upload-file.d.ts.map +1 -1
- package/dist/modules/file/services/upload-file.js +1 -1
- package/dist/modules/resource/route.d.ts +0 -3
- package/dist/modules/resource/route.d.ts.map +1 -1
- package/dist/modules/resource/route.js +1 -1
- package/dist/modules/resource/schema.d.ts +3 -0
- package/dist/modules/resource/schema.d.ts.map +1 -1
- package/dist/modules/resource/schema.js +1 -1
- package/dist/modules/resource/services/add-note.js +1 -1
- package/dist/modules/resource/services/add-resource-file.js +1 -1
- package/dist/modules/resource/services/create-resource-relation.d.ts +8 -2
- package/dist/modules/resource/services/create-resource-relation.d.ts.map +1 -1
- package/dist/modules/resource/services/create-resource-relation.js +1 -1
- package/dist/modules/resource/services/create-resource.js +1 -1
- package/dist/modules/resource/services/delete-resource-relation.d.ts +8 -1
- package/dist/modules/resource/services/delete-resource-relation.d.ts.map +1 -1
- package/dist/modules/resource/services/delete-resource-relation.js +1 -1
- package/dist/modules/resource/services/delete-resource.js +1 -1
- package/dist/modules/resource/services/export-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/export-resource.js +1 -1
- package/dist/modules/resource/services/get-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/get-resource.js +1 -1
- package/dist/modules/resource/services/list-resource-relation.d.ts +9 -2
- package/dist/modules/resource/services/list-resource-relation.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resource-relation.js +1 -1
- package/dist/modules/resource/services/list-resources.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resources.js +1 -1
- package/dist/modules/resource/services/search-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/search-resource.js +1 -1
- package/dist/modules/resource/services/suggest-resource.d.ts +10 -4
- package/dist/modules/resource/services/suggest-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/suggest-resource.js +1 -1
- package/dist/modules/resource/services/update-resource-relation.d.ts +10 -0
- package/dist/modules/resource/services/update-resource-relation.d.ts.map +1 -0
- package/dist/modules/resource/services/update-resource-relation.js +1 -0
- package/dist/modules/resource/services/update-resource.js +1 -1
- package/dist/modules/resource/services/upload-resource-file.js +1 -1
- package/dist/modules/system/route.d.ts +2 -1
- package/dist/modules/system/route.d.ts.map +1 -1
- package/dist/modules/system/route.js +1 -1
- package/dist/modules/system/schema.d.ts +23 -1
- package/dist/modules/system/schema.d.ts.map +1 -1
- package/dist/modules/system/schema.js +1 -1
- package/dist/modules/system/services/check-system.d.ts.map +1 -1
- package/dist/modules/system/services/check-system.js +1 -1
- package/dist/modules/system/services/get-access.d.ts +15 -0
- package/dist/modules/system/services/get-access.d.ts.map +1 -0
- package/dist/modules/system/services/get-access.js +1 -0
- package/dist/modules/system/services/get-api-list.d.ts +4 -1
- package/dist/modules/system/services/get-api-list.d.ts.map +1 -1
- package/dist/modules/system/services/get-api-list.js +1 -1
- package/dist/modules/system/services/get-audit-log.d.ts.map +1 -1
- package/dist/modules/system/services/get-audit-log.js +1 -1
- package/dist/modules/system/services/get-dictionary.js +1 -1
- package/dist/modules/system/services/get-system-log.d.ts +9 -5
- package/dist/modules/system/services/get-system-log.d.ts.map +1 -1
- package/dist/modules/system/services/get-system-log.js +1 -1
- package/dist/modules/system/services/get-system-settings.d.ts.map +1 -1
- package/dist/modules/system/services/get-system-settings.js +1 -1
- package/dist/modules/system/services/list-dictionaries.js +1 -1
- package/dist/modules/system/services/set-access.d.ts +17 -0
- package/dist/modules/system/services/set-access.d.ts.map +1 -0
- package/dist/modules/system/services/set-access.js +1 -0
- package/dist/modules/system/services/update-dictionary.d.ts +13 -0
- package/dist/modules/system/services/update-dictionary.d.ts.map +1 -0
- package/dist/modules/system/services/update-dictionary.js +1 -0
- package/dist/modules/system/services/update-system-settings.d.ts.map +1 -1
- package/dist/modules/system/services/update-system-settings.js +1 -1
- package/dist/modules/utils/require-admin.js +1 -1
- package/dist/modules/utils/safe-user.js +1 -1
- package/dist/modules/utils/unsupported.js +1 -1
- package/dist/plugins/audit/audit.js +1 -1
- package/dist/plugins/audit/audit.types.d.ts +1 -1
- package/dist/plugins/audit/audit.types.d.ts.map +1 -1
- package/dist/plugins/audit/index.js +1 -1
- package/dist/plugins/audit/services/write-audit.js +1 -1
- package/dist/plugins/auth/get-user-permissions.d.ts +3 -0
- package/dist/plugins/auth/get-user-permissions.d.ts.map +1 -0
- package/dist/plugins/auth/get-user-permissions.js +1 -0
- package/dist/plugins/auth/index.d.ts +4 -0
- package/dist/plugins/auth/index.d.ts.map +1 -1
- package/dist/plugins/auth/index.js +1 -1
- package/dist/plugins/auth/verifyUser.d.ts +9 -0
- package/dist/plugins/auth/verifyUser.d.ts.map +1 -0
- package/dist/plugins/auth/verifyUser.js +1 -0
- package/dist/plugins/dictionary.d.ts +3 -0
- package/dist/plugins/dictionary.d.ts.map +1 -1
- package/dist/plugins/dictionary.js +1 -1
- package/dist/plugins/file.d.ts +3 -6
- package/dist/plugins/file.d.ts.map +1 -1
- package/dist/plugins/file.js +1 -1
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/jwt.d.ts +4 -0
- package/dist/plugins/jwt.d.ts.map +1 -0
- package/dist/plugins/jwt.js +1 -0
- package/dist/plugins/logger/index.js +1 -1
- package/dist/plugins/logger/transport.js +1 -1
- package/dist/plugins/pg.d.ts +4 -2
- package/dist/plugins/pg.d.ts.map +1 -1
- package/dist/plugins/pg.js +1 -1
- package/dist/plugins/redis.js +1 -1
- package/dist/plugins/resource/index.js +1 -1
- package/dist/plugins/resource/resource.d.ts.map +1 -1
- package/dist/plugins/resource/resource.js +1 -1
- package/dist/plugins/resource/resource.registry.js +1 -1
- package/dist/plugins/resource/resource.types.d.ts +73 -15
- package/dist/plugins/resource/resource.types.d.ts.map +1 -1
- package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts +3 -0
- package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-dictionary-lookup-data.js +1 -0
- package/dist/plugins/resource/services/add-file-token.d.ts +3 -0
- package/dist/plugins/resource/services/add-file-token.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-file-token.js +1 -0
- package/dist/plugins/resource/services/add-table-lookup-data.d.ts +4 -0
- package/dist/plugins/resource/services/add-table-lookup-data.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-table-lookup-data.js +1 -0
- package/dist/plugins/resource/services/create-relation.d.ts +16 -0
- package/dist/plugins/resource/services/create-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/create-relation.js +1 -0
- package/dist/plugins/resource/services/create.d.ts +5 -2
- package/dist/plugins/resource/services/create.d.ts.map +1 -1
- package/dist/plugins/resource/services/create.js +1 -1
- package/dist/plugins/resource/services/delete-relation.d.ts +18 -0
- package/dist/plugins/resource/services/delete-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/delete-relation.js +1 -0
- package/dist/plugins/resource/services/delete.d.ts +9 -2
- package/dist/plugins/resource/services/delete.d.ts.map +1 -1
- package/dist/plugins/resource/services/delete.js +1 -1
- package/dist/plugins/resource/services/find-one.d.ts +3 -2
- package/dist/plugins/resource/services/find-one.d.ts.map +1 -1
- package/dist/plugins/resource/services/find-one.js +1 -1
- package/dist/plugins/resource/services/find-relation.d.ts +13 -0
- package/dist/plugins/resource/services/find-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/find-relation.js +1 -0
- package/dist/plugins/resource/services/find.d.ts.map +1 -1
- package/dist/plugins/resource/services/find.js +1 -1
- package/dist/plugins/resource/services/update-relation.d.ts +14 -0
- package/dist/plugins/resource/services/update-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/update-relation.js +1 -0
- package/dist/plugins/resource/services/update.d.ts +9 -2
- package/dist/plugins/resource/services/update.d.ts.map +1 -1
- package/dist/plugins/resource/services/update.js +1 -1
- package/dist/plugins/resource/utils/auto-index.d.ts +4 -0
- package/dist/plugins/resource/utils/auto-index.d.ts.map +1 -0
- package/dist/plugins/resource/utils/auto-index.js +1 -0
- package/dist/plugins/resource/utils/fields.d.ts +8 -1
- package/dist/plugins/resource/utils/fields.d.ts.map +1 -1
- package/dist/plugins/resource/utils/fields.js +1 -1
- package/dist/plugins/resource/utils/filters.d.ts +3 -2
- package/dist/plugins/resource/utils/filters.d.ts.map +1 -1
- package/dist/plugins/resource/utils/filters.js +1 -1
- package/dist/plugins/resource/utils/permissions.d.ts.map +1 -1
- package/dist/plugins/resource/utils/permissions.js +1 -1
- package/dist/plugins/resource/utils/sort.d.ts +1 -1
- package/dist/plugins/resource/utils/sort.d.ts.map +1 -1
- package/dist/plugins/resource/utils/sort.js +1 -1
- package/dist/plugins/resource/utils/sql.d.ts +1 -1
- package/dist/plugins/resource/utils/sql.d.ts.map +1 -1
- package/dist/plugins/resource/utils/sql.js +1 -1
- package/dist/shared/getIP.js +1 -1
- package/dist/type.d.ts +14 -0
- package/dist/type.d.ts.map +1 -1
- package/migrations/20260903120000_core_schema.sql +27 -21
- package/migrations/20260903130000_move_notes_files_to_admin.sql +17 -17
- package/migrations/20260903130001_add_file_fields.sql +5 -0
- package/migrations/20260903140000_settings_nulls_not_distinct.sql +18 -18
- package/migrations/20260905120000_add_user_foreign_keys.sql +43 -0
- package/migrations/20260907090000_core_schema.sql +32 -0
- package/package.json +93 -88
- package/dist/modules/auth/index.d.ts +0 -9
- package/dist/modules/auth/index.d.ts.map +0 -1
- package/dist/modules/auth/index.js +0 -1
- package/dist/modules/auth/services/login.d.ts +0 -10
- package/dist/modules/auth/services/login.d.ts.map +0 -1
- package/dist/modules/auth/services/login.js +0 -1
- package/dist/modules/auth/services/logout.d.ts +0 -9
- package/dist/modules/auth/services/logout.d.ts.map +0 -1
- package/dist/modules/auth/services/logout.js +0 -1
- package/dist/modules/auth/services/verifyPassword.d.ts +0 -11
- package/dist/modules/auth/services/verifyPassword.d.ts.map +0 -1
- package/dist/modules/auth/services/verifyPassword.js +0 -1
- package/dist/modules/file/index.d.ts +0 -8
- package/dist/modules/file/index.d.ts.map +0 -1
- package/dist/modules/file/index.js +0 -1
- package/dist/modules/resource/index.d.ts +0 -20
- package/dist/modules/resource/index.d.ts.map +0 -1
- package/dist/modules/resource/index.js +0 -1
- package/dist/modules/resource/services/list-children.d.ts +0 -6
- package/dist/modules/resource/services/list-children.d.ts.map +0 -1
- package/dist/modules/resource/services/list-children.js +0 -1
- package/dist/modules/system/index.d.ts +0 -13
- package/dist/modules/system/index.d.ts.map +0 -1
- package/dist/modules/system/index.js +0 -1
- package/dist/modules/utils/get-user-permissions.d.ts +0 -3
- package/dist/modules/utils/get-user-permissions.d.ts.map +0 -1
- package/dist/modules/utils/get-user-permissions.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{safeUser}from'../../utils/safe-user.js';export default async function getCurrentUser(n){const J=r,{user:k}=n;if(!k)return{};if(n['token']){const {jwtSignToken:Z}=await import(J(0x1d2)),K=await Z(k);k['token']=K;}return k['resources']=[...new Set(k?.['permissions'][J(0x1d3)](d=>d['split'](':')[0x0]))],safeUser(k);}function r(n,k){n=n-0x1d2;const Z=g();let K=Z[n];return K;}function g(){const B=['../../../plugins/jwt.js','map'];g=function(){return B;};return g();}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ContextDependencies } from "../../../context.js";
|
|
2
|
+
type params = {
|
|
3
|
+
user: string;
|
|
4
|
+
password: string;
|
|
5
|
+
type?: string;
|
|
6
|
+
};
|
|
7
|
+
export default function registration({ user, password, type }: params, { pg }: Pick<ContextDependencies, "pg">): Promise<{
|
|
8
|
+
user: {
|
|
9
|
+
id: string;
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=registration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/services/registration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,KAAK,MAAM,GAAG;IACV,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAA8B,YAAY,CACtC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,MAAM,EAChC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC;;YAGH,MAAM;cAAQ,MAAM;;GAc3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ConflictError}from'../../../errors.js';import{hashPassword}from'../../../plugins/auth/index.js';export default async function registration({user:n,password:k,type:Z},{pg:K}){const d=await hashPassword(k),J=await K['query']('INSERT\x20INTO\x20admin.users\x20(login,\x20password_hash,\x20user_type)\x0a\x20\x20\x20\x20\x20SELECT\x20$1,\x20$2,\x20$3\x0a\x20\x20\x20\x20\x20WHERE\x20NOT\x20EXISTS\x20(SELECT\x201\x20FROM\x20admin.users\x20WHERE\x20login\x20=\x20$1)\x0a\x20\x20\x20\x20\x20RETURNING\x20uid\x20AS\x20id,\x20user_type\x20AS\x20type',[n,d,Z||'regular']),B=J['rows'][0x0];if(!B)throw new ConflictError('Login\x20is\x20already\x20in\x20use');return{'user':B};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{unsupported}from'../../utils/unsupported.js';export default async function verifyTwoFactor(n,k){return unsupported('Two-factor\x20provider');}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime.d.ts","sourceRoot":"","sources":["../../../src/modules/file/mime.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=r;function r(n,k){n=n-0x10f;var Z=g();var K=Z[n];return K;}export default new Set(['image/jpeg','image/png','image/gif','image/webp','image/bmp','image/tiff','image/svg+xml',n(0x10f),'image/avif',n(0x110),'application/msword',n(0x111),'application/vnd.ms-excel',n(0x112),n(0x113),'application/vnd.openxmlformats-officedocument.presentationml.presentation','application/vnd.oasis.opendocument.text','application/vnd.oasis.opendocument.spreadsheet','application/vnd.oasis.opendocument.presentation','text/plain',n(0x114),n(0x115),'application/json','application/xml','text/xml',n(0x116),'application/vnd.google-earth.kml+xml',n(0x117),n(0x118),'application/x-zip-compressed','application/x-7z-compressed','application/x-rar-compressed','application/vnd.rar','application/gzip',n(0x119),n(0x11a),'audio/mpeg',n(0x11b),'audio/ogg','audio/webm','audio/mp4',n(0x11c),n(0x11d),'video/webm','video/quicktime',n(0x11e),n(0x11f)]);function g(){var k=['image/x-icon','application/pdf','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/vnd.ms-powerpoint','text/csv','text/markdown','application/geo+json','application/vnd.google-earth.kmz','application/zip','application/x-gzip','application/x-tar','audio/wav','video/mp4','video/mpeg','video/x-msvideo','application/octet-stream'];g=function(){return k;};return g();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/file/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/file/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAMnD,wBAAgB,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,kBAAkB,CA8F9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function r(n,k){n=n-0xde;const Z=g();let K=Z[n];return K;}import{fileTypeFromBuffer}from'file-type';import{getFile}from'./services/get-file.js';import{uploadFile}from'./services/upload-file.js';function g(){const O=['/api/file/:token','file','fileToken','application/octet-stream','startsWith','split','type','attachment','inline','header','Cache-Control','post','user','value','resource','resourceId','get'];g=function(){return O;};return g();}import{resizeFile}from'./services/resize-file.js';import{fileSchemas}from'./schema.js';export function fileRoutes(n){return async k=>{const a=r;k['get'](a(0xde),{'schema':{'tags':['fcore',a(0xdf)],'summary':'Get\x20file\x20by\x20token','description':'Returns\x20a\x20file\x20after\x20verifying\x20its\x20signed\x20access\x20token.','access':'public','permissions':[],'params':fileSchemas[a(0xe0)],'querystring':fileSchemas['fileDownloadQuery']}},async(Z,K)=>{const H=a,d=n['file']['verify'](Z['params']['token']),J=await getFile({'pathOrToken':d},n),B=await fileTypeFromBuffer(J),l=B?.['mime']??H(0xe1),f=Z['query']['download']===!![],R=l[H(0xe2)]('image/')||l==='application/pdf',Q=d[H(0xe3)]('/')['pop']()?.['replace'](/[^A-Za-z0-9._-]/g,'_')??'file';return K[H(0xe4)](l),K['header']('Content-Disposition',(f||!R?H(0xe5):H(0xe6))+';\x20filename=\x22'+Q+'\x22')[H(0xe7)](H(0xe8),'public,\x20max-age=86400,\x20immutable'),K['send'](J);}),k[a(0xe9)]('/api/file/upload',{'schema':{'tags':['fcore','file'],'summary':'Upload\x20file','description':'Uploads\x20a\x20file\x20and\x20stores\x20its\x20metadata.','access':a(0xea),'permissions':['files:create']}},async Z=>{const A=a,K=await Z[A(0xdf)]();if(!K)throw new Error('File\x20is\x20required');return uploadFile({'file':K,'metadata':{'name':K['filename'],'path':K['fields']['path']?.[A(0xeb)],'resource':K['fields'][A(0xec)]?.['value'],'resourceId':K['fields'][A(0xed)]?.['value']},'user':Z['user']},n);}),k[a(0xee)]('/api/file/:token/resize',{'schema':{'tags':['fcore',a(0xdf)],'summary':'Resize\x20file','description':'Returns\x20a\x20resized\x20image\x20file.','access':'user','permissions':['files:read'],'params':fileSchemas['fileToken'],'querystring':fileSchemas['resizeQuery']}},async(Z,K)=>{const I=a,d=await resizeFile({'pathOrToken':n[I(0xdf)]?.['verify'](Z['params']['token']),...Z['query']},n),J=await fileTypeFromBuffer(d);return K[I(0xe4)](J?.['mime']??'image/png'),K['header']('Content-Disposition',I(0xe6))['header']('Cache-Control','public,\x20max-age=86400,\x20immutable'),K['send'](d);});};}
|
|
@@ -5,6 +5,9 @@ export declare const fileSchemas: {
|
|
|
5
5
|
fileToken: import("@sinclair/typebox").TObject<{
|
|
6
6
|
token: import("@sinclair/typebox").TString;
|
|
7
7
|
}>;
|
|
8
|
+
fileDownloadQuery: import("@sinclair/typebox").TObject<{
|
|
9
|
+
download: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
10
|
+
}>;
|
|
8
11
|
filePath: import("@sinclair/typebox").TObject<{
|
|
9
12
|
"*": import("@sinclair/typebox").TString;
|
|
10
13
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/file/schema.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW;IACvB,MAAM;;;IAGN,SAAS;;;IAGT,QAAQ;;;IAGR,MAAM;;;;;;;;;IASN,SAAS;;;;IAIT,WAAW;;;;;CAWX,CAAC"}
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/file/schema.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW;IACvB,MAAM;;;IAGN,SAAS;;;IAGT,iBAAiB;;;IAGjB,QAAQ;;;IAGR,MAAM;;;;;;;;;IASN,SAAS;;;;IAIT,WAAW;;;;;CAWX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const n=r;function r(n,k){n=n-0x1b8;const Z=g();let K=Z[n];return K;}function g(){const k=['String','Optional','Boolean','Object','Any','Integer','Union','Literal'];g=function(){return k;};return g();}import{Type}from'@sinclair/typebox';export const fileSchemas={'fileId':Type['Object']({'id':Type[n(0x1b8)]({'minLength':0x1,'maxLength':0x80})}),'fileToken':Type['Object']({'token':Type['String']({'minLength':0x1,'maxLength':0x800})}),'fileDownloadQuery':Type['Object']({'download':Type[n(0x1b9)](Type[n(0x1ba)]())}),'filePath':Type[n(0x1bb)]({'*':Type['String']({'minLength':0x1,'maxLength':0x400})}),'upload':Type['Object']({'file':Type[n(0x1bc)](),'metadata':Type[n(0x1bb)]({'name':Type['Optional'](Type['String']({'minLength':0x1})),'path':Type['Optional'](Type['String']({'minLength':0x1})),'entityType':Type[n(0x1b9)](Type[n(0x1b8)]({'minLength':0x1})),'entityId':Type[n(0x1b9)](Type['String']({'minLength':0x1}))})}),'filePatch':Type['Object']({'entityType':Type[n(0x1b9)](Type['String']({'minLength':0x1})),'entityId':Type['Optional'](Type['String']({'minLength':0x1}))}),'resizeQuery':Type['Object']({'width':Type[n(0x1b9)](Type[n(0x1bd)]({'minimum':0x1,'default':0xc8})),'height':Type[n(0x1b9)](Type['Integer']({'minimum':0x1})),'fit':Type[n(0x1b9)](Type[n(0x1be)]([Type['Literal']('cover'),Type['Literal']('contain'),Type[n(0x1bf)]('fill'),Type['Literal']('inside'),Type['Literal']('outside')]))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{NotFoundError}from'../../../errors.js';function r(n,k){n=n-0x174;var Z=g();var K=Z[n];return K;}function g(){var K=['pathOrToken','file'];g=function(){return K;};return g();}export async function getFile(n,k){var Z=r;if(!k['file'])throw new Error('empty\x20file');if(!await k['file']['exists'](n['pathOrToken']))throw new NotFoundError('File\x20not\x20found'+n[Z(0x174)]);return k[Z(0x175)]['get'](n['pathOrToken']);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resize-file.d.ts","sourceRoot":"","sources":["../../../../src/modules/file/services/resize-file.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"resize-file.d.ts","sourceRoot":"","sources":["../../../../src/modules/file/services/resize-file.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAQtD,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;CAC3D;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,MAAM,CAAC,CAuCjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{NotFoundError,ValidationError}from'../../../errors.js';import{fileTypeFromBuffer}from'file-type';function g(){const O=['path','height','digest','logs','code','ENOENT','file','exists','File\x20not\x20found','get','startsWith'];g=function(){return O;};return g();}import{createHash}from'node:crypto';import{mkdir,readFile,writeFile}from'node:fs/promises';import n from'node:path';import k from'sharp';function r(n,k){n=n-0x168;const Z=g();let K=Z[n];return K;}export async function resizeFile(Z,K){const I=r,d=Z['pathOrToken']??Z[I(0x168)];if(!d)throw new ValidationError('File\x20path\x20is\x20required');const J=parseDimension(Z['width'],'width')??0xc8,B=parseDimension(Z['height'],I(0x169)),l=createHash('sha256')['update'](d+':'+J+':'+(B??'auto')+':'+(Z['fit']??'cover'))[I(0x16a)]('hex'),f=n['resolve'](I(0x16b),'resize'),R=n['join'](f,l+'.jpg');try{return await readFile(R);}catch(A){if(A[I(0x16c)]!==I(0x16d))throw A;}if(!await K[I(0x16e)][I(0x16f)](d))throw new NotFoundError(I(0x170));const Q=await K['file'][I(0x171)](d),a=await fileTypeFromBuffer(Q);if(!a?.['mime'][I(0x172)]('image/'))throw new ValidationError('Only\x20image\x20files\x20can\x20be\x20resized');const H=await k(Q)['resize']({'width':J,'height':B,'fit':Z['fit']??'cover'})['toBuffer']();return await mkdir(f,{'recursive':!![]}),await writeFile(R,H),H;}function parseDimension(Z,K){if(Z===undefined||Z==='')return undefined;const d=Number(Z);if(!Number['isInteger'](d)||d<=0x0)throw new ValidationError(K+'\x20must\x20be\x20a\x20positive\x20integer');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 g(){const A=['name','replace','getMonth','padStart','metadata','resource','resourceId','file','mime','bytesRead','split','pop','user'];g=function(){return A;};return g();}import{fileTypeFromBuffer}from'file-type';function r(n,k){n=n-0x124;const Z=g();let K=Z[n];return K;}import n from'../mime.js';import{randomUUID}from'node:crypto';export async function uploadFile(k,Z){const H=r,K=(k['metadata'][H(0x124)]??randomUUID())[H(0x125)](/[^a-zA-Z0-9._-]/g,'_'),d=new Date(),J=String(d['getFullYear']())['slice'](-0x2),B=String(d[H(0x126)]()+0x1)[H(0x127)](0x2,'0'),l=String(d['getDate']())['padStart'](0x2,'0'),f=k['metadata']['path']??(k[H(0x128)][H(0x129)]?k['metadata']['resource']+'/'+(k[H(0x128)][H(0x12a)]??randomUUID())+'/'+K:null)??'uploads/'+J+'/'+B+'-'+l+'/'+K,R=await k[H(0x12b)]['toBuffer'](),Q=await fileTypeFromBuffer(R);if(!n['has'](k['file']['mimetype'])&&(Q?.[H(0x12c)]?!n['has'](Q[H(0x12c)]):!![]))throw new Error('Unsupported\x20file\x20type:\x20'+k['file']['mimetype']);await Z['file']['put'](f,R);const a=await Z['pg']['query']('\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',[k[H(0x128)]['resource']??null,k['metadata']['resourceId']??null,f,k[H(0x12b)]['mimetype'],k['file']['file'][H(0x12d)],k[H(0x128)]['name'],K,k[H(0x12b)]['mimetype'][H(0x12e)]('/')[H(0x12f)]()??null,k[H(0x130)]?.['id']??null]);return a['rows'][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;AAoBnD,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,kBAAkB,CAoTlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x51485a=_0x22e5;(function(_0x410c08,_0x9ff2e9){const _0x5d5590=_0x22e5,_0x3641c4=_0x410c08();while(!![]){try{const _0x9e95a0=parseInt(_0x5d5590(0xcb))/0x1*(-parseInt(_0x5d5590(0xd5))/0x2)+-parseInt(_0x5d5590(0x111))/0x3+-parseInt(_0x5d5590(0x113))/0x4+parseInt(_0x5d5590(0x114))/0x5+parseInt(_0x5d5590(0xf9))/0x6*(-parseInt(_0x5d5590(0x10c))/0x7)+-parseInt(_0x5d5590(0x104))/0x8+parseInt(_0x5d5590(0x11b))/0x9;if(_0x9e95a0===_0x9ff2e9)break;else _0x3641c4['push'](_0x3641c4['shift']());}catch(_0xc1e4e6){_0x3641c4['push'](_0x3641c4['shift']());}}}(_0x1a6c,0x21fff));import{listResources}from'./services/list-resources.js';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';import{searchResource}from'./services/search-resource.js';import{exportResource}from'./services/export-resource.js';function _0x1a6c(){const _0x397d2b=['Returns\x20related\x20records\x20for\x20a\x20resource\x20record.','EHJDC','KUYKG','526hMONiI','LGbKJ','split','body','rMlAW','query','resource:update','Adds\x20a\x20file\x20to\x20a\x20resource\x20record.','/api/resource/:resource/search','mACSK','422QHxjnI','resourceIdRelationId','VBMZb','ZvgLU','post','delete','resource','Add\x20resource\x20file','Returns\x20notes\x20related\x20to\x20a\x20resource\x20record.','Returns\x20files\x20related\x20to\x20a\x20resource\x20record.','dAtpZ','Updates\x20a\x20record\x20in\x20a\x20registered\x20resource.','FLSGw','fcore','/api/resource/:resource/:id/:relation','tFdCf','Search\x20resource','Deletes\x20a\x20record\x20from\x20a\x20registered\x20resource.','iJRYD','DrQQm','Upload\x20resource\x20file','tags','List\x20resource\x20records','Export\x20resource\x20records','Removes\x20a\x20file\x20relation\x20from\x20a\x20resource\x20record.','Searches\x20records\x20in\x20a\x20registered\x20resource.','params','qEAdr','List\x20resource\x20relations','get','xmcqZ','uploadResourceFile','querystring','resourceIdRelation','Create\x20resource\x20relation','/api/resource/:resource/:id/files','1038QCdHcW','Returns\x20one\x20record\x20from\x20a\x20registered\x20resource.','wHJCb','gjxiz','7|5|8|3|13|12|14|15|9|4|1|11|2|16|0|6|10','HYBUt','/api/resource/:resource/:id/notes','schema','Add\x20resource\x20note','Returns\x20records\x20from\x20a\x20registered\x20resource.','Delete\x20resource\x20record','624672rLxlZa','/api/resource/:resource/suggest/:field','*:read','/api/resource/:resource/:id','Delete\x20resource\x20file','Create\x20resource\x20record','/api/resource/:resource/:id/files/:relationId','NCdtg','2338kaLoJA','Deletes\x20a\x20relation\x20from\x20a\x20resource\x20record.','user','kpxJN','NkWAS','641772DLAGSR','suggestQuery','504968iGoziJ','701960SPfAey','xnGRH','Get\x20resource\x20record','resourceField','resourceId','KPmOf','JUGgE','5273001cOGnNW','Delete\x20resource\x20relation','Update\x20resource\x20record','/api/resource/:resource/:id/:relation/:relationId','access','exportResource','eJKzp','description','GnwjR','uploadResourceFileBody','Creates\x20a\x20relation\x20for\x20a\x20resource\x20record.','/api/resource/:resource','notes','Creates\x20a\x20record\x20in\x20a\x20registered\x20resource.','Suggest\x20resource\x20values','iiDUG','CjgCs','exportResourceQuery','cUUlR','YtKeL','NCRes','tNeBr','EwIiB','DFVTq','Returns\x20suggested\x20values\x20for\x20a\x20resource\x20field.','/api/resource/:resource/export','files','qHgKq','List\x20resource\x20files','Exports\x20readable\x20records\x20from\x20a\x20registered\x20resource.','wKRjq','Adds\x20a\x20note\x20to\x20a\x20resource\x20record.','nyUGJ','/api/resource/:resource/:id/upload','List\x20resource\x20notes','Uploads\x20a\x20file\x20to\x20a\x20Resource\x20record\x20and\x20stores\x20its\x20metadata.','permissions','summary','patch'];_0x1a6c=function(){return _0x397d2b;};return _0x1a6c();}import{suggestResource}from'./services/suggest-resource.js';function _0x22e5(_0x47571c,_0x1e0dbc){_0x47571c=_0x47571c-0xa3;const _0x1a6cbe=_0x1a6c();let _0x22e57f=_0x1a6cbe[_0x47571c];return _0x22e57f;}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=_0x1025ab=>_0x1025ab[_0x51485a(0x10e)];export function resourceRoutes(_0x46320e){const _0xa1801=_0x51485a,_0xe713f8={};_0xe713f8[_0xa1801(0xb5)]=_0xa1801(0xe2),_0xe713f8[_0xa1801(0x110)]=_0xa1801(0xdb),_0xe713f8[_0xa1801(0xa9)]=_0xa1801(0xf1),_0xe713f8[_0xa1801(0xb6)]=_0xa1801(0xc8),_0xe713f8[_0xa1801(0xb4)]=_0xa1801(0xf8),_0xe713f8[_0xa1801(0xdf)]=_0xa1801(0xc2),_0xe713f8[_0xa1801(0xfb)]=_0xa1801(0xc4),_0xe713f8[_0xa1801(0x10f)]=_0xa1801(0x10e),_0xe713f8[_0xa1801(0xca)]=_0xa1801(0xd1),_0xe713f8[_0xa1801(0xb3)]=_0xa1801(0xac),_0xe713f8[_0xa1801(0xd4)]=_0xa1801(0xeb),_0xe713f8[_0xa1801(0xe8)]=_0xa1801(0x102),_0xe713f8[_0xa1801(0xf3)]=_0xa1801(0xff),_0xe713f8[_0xa1801(0xcc)]=_0xa1801(0x101),_0xe713f8[_0xa1801(0xd8)]=_0xa1801(0xc0),_0xe713f8[_0xa1801(0x10b)]=_0xa1801(0xaf),_0xe713f8[_0xa1801(0x11a)]=_0xa1801(0xe3),_0xe713f8[_0xa1801(0xe4)]=_0xa1801(0xab),_0xe713f8[_0xa1801(0xc9)]=_0xa1801(0xd3),_0xe713f8[_0xa1801(0xb1)]=_0xa1801(0xe5),_0xe713f8[_0xa1801(0x119)]=_0xa1801(0xee),_0xe713f8[_0xa1801(0xcf)]=_0xa1801(0xba),_0xe713f8[_0xa1801(0xe1)]=_0xa1801(0xec),_0xe713f8[_0xa1801(0xb8)]=_0xa1801(0xdd),_0xe713f8[_0xa1801(0xfe)]=_0xa1801(0xa4),_0xe713f8[_0xa1801(0xbf)]=_0xa1801(0x11c),_0xe713f8[_0xa1801(0xe7)]=_0xa1801(0x10d),_0xe713f8[_0xa1801(0xc1)]=_0xa1801(0xd2),_0xe713f8[_0xa1801(0xbc)]=_0xa1801(0xfa),_0xe713f8[_0xa1801(0xf0)]=_0xa1801(0x109),_0xe713f8[_0xa1801(0xb7)]=_0xa1801(0xae),_0xe713f8[_0xa1801(0xb0)]=_0xa1801(0x107),_0xe713f8[_0xa1801(0xd7)]=_0xa1801(0xa3),_0xe713f8[_0xa1801(0xa7)]=_0xa1801(0xe0),_0xe713f8[_0xa1801(0x115)]=_0xa1801(0x103),_0xe713f8[_0xa1801(0xfc)]=_0xa1801(0x108);const _0x1c1b43=_0xe713f8;return async _0x1a3b15=>{const _0x1f9d3d=_0xa1801,_0x4ae304=_0x1f9d3d(0xfd)[_0x1f9d3d(0xcd)]('|');let _0x12d522=0x0;while(!![]){switch(_0x4ae304[_0x12d522++]){case'0':const _0x220712={};_0x220712[_0x1f9d3d(0xea)]=[_0x1c1b43[_0x1f9d3d(0xb5)],_0x1c1b43[_0x1f9d3d(0x110)]],_0x220712[_0x1f9d3d(0xc6)]=_0x1c1b43[_0x1f9d3d(0xa9)],_0x220712[_0x1f9d3d(0xa8)]=_0x1c1b43[_0x1f9d3d(0xb6)],_0x220712[_0x1f9d3d(0xa5)]=_0x1f9d3d(0x10e),_0x220712[_0x1f9d3d(0xc5)]=[],_0x220712[_0x1f9d3d(0xef)]=resourceSchemas[_0x1f9d3d(0xf6)];const _0x1c2417={};_0x1c2417[_0x1f9d3d(0x100)]=_0x220712,_0x1a3b15[_0x1f9d3d(0xf2)](_0x1f9d3d(0xe3),_0x1c2417,async _0x30de00=>listResourceRelation({..._0x30de00[_0x1f9d3d(0xd0)],..._0x30de00[_0x1f9d3d(0xef)],'user':user(_0x30de00)},_0x46320e));continue;case'1':_0x1a3b15[_0x1f9d3d(0xf2)](_0x1c1b43[_0x1f9d3d(0xb4)],{'schema':{'tags':[_0x1c1b43[_0x1f9d3d(0xb5)],_0x1c1b43[_0x1f9d3d(0x110)]],'summary':_0x1f9d3d(0xbd),'description':_0x1f9d3d(0xde),'access':_0x1f9d3d(0x10e),'permissions':[],'params':resourceSchemas[_0x1f9d3d(0x118)]}},async _0x51d004=>listResourceRelation({..._0x51d004[_0x1f9d3d(0xef)],'relation':_0x1f9d3d(0xbb),'user':user(_0x51d004)},_0x46320e));continue;case'2':_0x1a3b15[_0x1f9d3d(0xd9)](_0x1c1b43[_0x1f9d3d(0xdf)],{'schema':{'tags':[_0x1f9d3d(0xe2),_0x1c1b43[_0x1f9d3d(0x110)]],'summary':_0x1f9d3d(0xe9),'description':_0x1c1b43[_0x1f9d3d(0xfb)],'access':_0x1c1b43[_0x1f9d3d(0x10f)],'permissions':[_0x1c1b43[_0x1f9d3d(0xca)]],'params':resourceSchemas[_0x1f9d3d(0xf4)],'body':resourceSchemas[_0x1f9d3d(0xaa)]}},async _0x4ef707=>uploadResourceFile({..._0x4ef707[_0x1f9d3d(0xef)],..._0x4ef707[_0x1f9d3d(0xce)],'user':user(_0x4ef707)},_0x46320e));continue;case'3':_0x1a3b15[_0x1f9d3d(0xf2)](_0x1c1b43[_0x1f9d3d(0xb3)],{'schema':{'tags':[_0x1c1b43[_0x1f9d3d(0xb5)],_0x1c1b43[_0x1f9d3d(0x110)]],'summary':_0x1c1b43[_0x1f9d3d(0xd4)],'description':_0x1c1b43[_0x1f9d3d(0xe8)],'access':_0x1c1b43[_0x1f9d3d(0x10f)],'permissions':[],'params':resourceSchemas[_0x1f9d3d(0xdb)]}},async _0x1757cd=>listResources({..._0x1757cd[_0x1f9d3d(0xd0)],..._0x1757cd[_0x1f9d3d(0xef)],'user':user(_0x1757cd)},_0x46320e));continue;case'4':_0x1a3b15[_0x1f9d3d(0xd9)](_0x1c1b43[_0x1f9d3d(0xf3)],{'schema':{'tags':[_0x1c1b43[_0x1f9d3d(0xb5)],_0x1f9d3d(0xdb)],'summary':_0x1c1b43[_0x1f9d3d(0xcc)],'description':_0x1c1b43[_0x1f9d3d(0xd8)],'access':_0x1f9d3d(0x10e),'permissions':[],'params':resourceSchemas[_0x1f9d3d(0x118)]}},async _0x306d17=>addNote({..._0x306d17[_0x1f9d3d(0xef)],..._0x306d17[_0x1f9d3d(0xce)],'user':user(_0x306d17)},_0x46320e));continue;case'5':const _0x4c6d97={};_0x4c6d97[_0x1f9d3d(0xea)]=[_0x1c1b43[_0x1f9d3d(0xb5)],_0x1c1b43[_0x1f9d3d(0x110)]],_0x4c6d97[_0x1f9d3d(0xc6)]=_0x1c1b43[_0x1f9d3d(0x10b)],_0x4c6d97[_0x1f9d3d(0xa8)]=_0x1f9d3d(0xb9),_0x4c6d97[_0x1f9d3d(0xa5)]=_0x1c1b43[_0x1f9d3d(0x10f)],_0x4c6d97[_0x1f9d3d(0xc5)]=[],_0x4c6d97[_0x1f9d3d(0xef)]=resourceSchemas[_0x1f9d3d(0x117)],_0x4c6d97[_0x1f9d3d(0xf5)]=resourceSchemas[_0x1f9d3d(0x112)];const _0x50281d={};_0x50281d[_0x1f9d3d(0x100)]=_0x4c6d97,_0x1a3b15[_0x1f9d3d(0xf2)](_0x1f9d3d(0x105),_0x50281d,async _0x1d4a88=>suggestResource({..._0x1d4a88[_0x1f9d3d(0xd0)],..._0x1d4a88[_0x1f9d3d(0xef)],'user':user(_0x1d4a88)},_0x46320e));continue;case'6':_0x1a3b15[_0x1f9d3d(0xd9)](_0x1c1b43[_0x1f9d3d(0x11a)],{'schema':{'tags':[_0x1c1b43[_0x1f9d3d(0xb5)],_0x1c1b43[_0x1f9d3d(0x110)]],'summary':_0x1f9d3d(0xf7),'description':_0x1c1b43[_0x1f9d3d(0xe4)],'access':_0x1f9d3d(0x10e),'permissions':[],'params':resourceSchemas[_0x1f9d3d(0xf6)]}},async _0x5d64d0=>createResourceRelation({..._0x5d64d0[_0x1f9d3d(0xef)],'data':_0x5d64d0[_0x1f9d3d(0xce)],'user':user(_0x5d64d0)},_0x46320e));continue;case'7':_0x1a3b15[_0x1f9d3d(0xf2)](_0x1c1b43[_0x1f9d3d(0xc9)],{'schema':{'tags':[_0x1f9d3d(0xe2),_0x1c1b43[_0x1f9d3d(0x110)]],'summary':_0x1c1b43[_0x1f9d3d(0xb1)],'description':_0x1c1b43[_0x1f9d3d(0x119)],'access':_0x1f9d3d(0x10e),'permissions':[],'params':resourceSchemas[_0x1f9d3d(0xdb)]}},async _0x333341=>searchResource({..._0x333341[_0x1f9d3d(0xd0)],..._0x333341[_0x1f9d3d(0xef)],'user':user(_0x333341)},_0x46320e));continue;case'8':_0x1a3b15[_0x1f9d3d(0xf2)](_0x1c1b43[_0x1f9d3d(0xcf)],{'schema':{'tags':[_0x1c1b43[_0x1f9d3d(0xb5)],_0x1f9d3d(0xdb)],'summary':_0x1c1b43[_0x1f9d3d(0xe1)],'description':_0x1f9d3d(0xbe),'access':_0x1c1b43[_0x1f9d3d(0x10f)],'permissions':[_0x1f9d3d(0x106)],'params':resourceSchemas[_0x1f9d3d(0xa6)],'querystring':resourceSchemas[_0x1f9d3d(0xb2)]}},async _0x504419=>exportResource({..._0x504419[_0x1f9d3d(0xd0)],..._0x504419[_0x1f9d3d(0xef)],'user':user(_0x504419)},_0x46320e));continue;case'9':const _0x58eccf={};_0x58eccf[_0x1f9d3d(0xea)]=[_0x1f9d3d(0xe2),_0x1c1b43[_0x1f9d3d(0x110)]],_0x58eccf[_0x1f9d3d(0xc6)]=_0x1f9d3d(0xc3),_0x58eccf[_0x1f9d3d(0xa8)]=_0x1c1b43[_0x1f9d3d(0xb8)],_0x58eccf[_0x1f9d3d(0xa5)]=_0x1c1b43[_0x1f9d3d(0x10f)],_0x58eccf[_0x1f9d3d(0xc5)]=[],_0x58eccf[_0x1f9d3d(0xef)]=resourceSchemas[_0x1f9d3d(0x118)];const _0xab9f25={};_0xab9f25[_0x1f9d3d(0x100)]=_0x58eccf,_0x1a3b15[_0x1f9d3d(0xf2)](_0x1f9d3d(0xff),_0xab9f25,async _0x4b4d0f=>listResourceRelation({..._0x4b4d0f[_0x1f9d3d(0xef)],'relation':_0x1f9d3d(0xad),'user':user(_0x4b4d0f)},_0x46320e));continue;case'10':_0x1a3b15[_0x1f9d3d(0xda)](_0x1c1b43[_0x1f9d3d(0xfe)],{'schema':{'tags':[_0x1f9d3d(0xe2),_0x1c1b43[_0x1f9d3d(0x110)]],'summary':_0x1c1b43[_0x1f9d3d(0xbf)],'description':_0x1c1b43[_0x1f9d3d(0xe7)],'access':_0x1c1b43[_0x1f9d3d(0x10f)],'permissions':[],'params':resourceSchemas[_0x1f9d3d(0xd6)]}},async _0x214961=>deleteResourceRelation({..._0x214961[_0x1f9d3d(0xef)],'user':user(_0x214961)},_0x46320e));continue;case'11':_0x1a3b15[_0x1f9d3d(0xd9)](_0x1c1b43[_0x1f9d3d(0xb4)],{'schema':{'tags':[_0x1f9d3d(0xe2),_0x1c1b43[_0x1f9d3d(0x110)]],'summary':_0x1f9d3d(0xdc),'description':_0x1c1b43[_0x1f9d3d(0xc1)],'access':_0x1c1b43[_0x1f9d3d(0x10f)],'permissions':[],'params':resourceSchemas[_0x1f9d3d(0x118)]}},async _0x35b150=>addResourceFile({..._0x35b150[_0x1f9d3d(0xef)],..._0x35b150[_0x1f9d3d(0xce)],'user':user(_0x35b150)},_0x46320e));continue;case'12':const _0x1c3936={};_0x1c3936[_0x1f9d3d(0xea)]=[_0x1f9d3d(0xe2),_0x1c1b43[_0x1f9d3d(0x110)]],_0x1c3936[_0x1f9d3d(0xc6)]=_0x1f9d3d(0x116),_0x1c3936[_0x1f9d3d(0xa8)]=_0x1c1b43[_0x1f9d3d(0xbc)],_0x1c3936[_0x1f9d3d(0xa5)]=_0x1c1b43[_0x1f9d3d(0x10f)],_0x1c3936[_0x1f9d3d(0xc5)]=[],_0x1c3936[_0x1f9d3d(0xef)]=resourceSchemas[_0x1f9d3d(0x118)];const _0x1d47be={};_0x1d47be[_0x1f9d3d(0x100)]=_0x1c3936,_0x1a3b15[_0x1f9d3d(0xf2)](_0x1f9d3d(0x107),_0x1d47be,async _0x2636ca=>getResource({..._0x2636ca[_0x1f9d3d(0xef)],'user':user(_0x2636ca)},_0x46320e));continue;case'13':_0x1a3b15[_0x1f9d3d(0xd9)](_0x1c1b43[_0x1f9d3d(0xb3)],{'schema':{'tags':[_0x1f9d3d(0xe2),_0x1c1b43[_0x1f9d3d(0x110)]],'summary':_0x1c1b43[_0x1f9d3d(0xf0)],'description':_0x1c1b43[_0x1f9d3d(0xb7)],'access':_0x1c1b43[_0x1f9d3d(0x10f)],'permissions':[],'params':resourceSchemas[_0x1f9d3d(0xdb)]}},async _0x3aabb2=>createResource({..._0x3aabb2[_0x1f9d3d(0xef)],'data':_0x3aabb2[_0x1f9d3d(0xce)],'user':user(_0x3aabb2)},_0x46320e));continue;case'14':_0x1a3b15[_0x1f9d3d(0xc7)](_0x1c1b43[_0x1f9d3d(0xb0)],{'schema':{'tags':[_0x1f9d3d(0xe2),_0x1c1b43[_0x1f9d3d(0x110)]],'summary':_0x1c1b43[_0x1f9d3d(0xd7)],'description':_0x1c1b43[_0x1f9d3d(0xa7)],'access':_0x1c1b43[_0x1f9d3d(0x10f)],'permissions':[],'params':resourceSchemas[_0x1f9d3d(0x118)]}},async _0x3e4bde=>updateResource({..._0x3e4bde[_0x1f9d3d(0xef)],'patch':_0x3e4bde[_0x1f9d3d(0xce)],'user':user(_0x3e4bde)},_0x46320e));continue;case'15':const _0x2fbf60={};_0x2fbf60[_0x1f9d3d(0xea)]=[_0x1c1b43[_0x1f9d3d(0xb5)],_0x1f9d3d(0xdb)],_0x2fbf60[_0x1f9d3d(0xc6)]=_0x1c1b43[_0x1f9d3d(0x115)],_0x2fbf60[_0x1f9d3d(0xa8)]=_0x1f9d3d(0xe6),_0x2fbf60[_0x1f9d3d(0xa5)]=_0x1f9d3d(0x10e),_0x2fbf60[_0x1f9d3d(0xc5)]=[],_0x2fbf60[_0x1f9d3d(0xef)]=resourceSchemas[_0x1f9d3d(0x118)];const _0x100238={};_0x100238[_0x1f9d3d(0x100)]=_0x2fbf60,_0x1a3b15[_0x1f9d3d(0xda)](_0x1f9d3d(0x107),_0x100238,async _0x17458d=>deleteResource({..._0x17458d[_0x1f9d3d(0xef)],'user':user(_0x17458d)},_0x46320e));continue;case'16':const _0x3a950a={};_0x3a950a[_0x1f9d3d(0xea)]=[_0x1c1b43[_0x1f9d3d(0xb5)],_0x1c1b43[_0x1f9d3d(0x110)]],_0x3a950a[_0x1f9d3d(0xc6)]=_0x1c1b43[_0x1f9d3d(0xfc)],_0x3a950a[_0x1f9d3d(0xa8)]=_0x1f9d3d(0xed),_0x3a950a[_0x1f9d3d(0xa5)]=_0x1c1b43[_0x1f9d3d(0x10f)],_0x3a950a[_0x1f9d3d(0xc5)]=[],_0x3a950a[_0x1f9d3d(0xef)]=resourceSchemas[_0x1f9d3d(0xd6)];const _0x51ad2c={};_0x51ad2c[_0x1f9d3d(0x100)]=_0x3a950a,_0x1a3b15[_0x1f9d3d(0xda)](_0x1f9d3d(0x10a),_0x51ad2c,async _0x2c38e7=>deleteResourceRelation({..._0x2c38e7[_0x1f9d3d(0xef)],'relation':_0x1f9d3d(0xbb),'user':user(_0x2c38e7)},_0x46320e));continue;}break;}};}
|
|
1
|
+
const B=r;import{ForbiddenError}from'../../errors.js';import{listResources}from'./services/list-resources.js';function r(n,k){n=n-0x10e;const Z=g();let K=Z[n];return K;}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';function g(){const R=['user','get','Search\x20resource','resource','query','params','/api/suggest/:resource/:field','Returns\x20suggested\x20values\x20for\x20a\x20resource\x20field.','resourceField','config','/api/resource/:resource/export','fcore','/api/resource/:resource','auth','post','/api/resource/:resource/:id','Update\x20resource\x20record','resourceId','Deletes\x20a\x20record\x20from\x20a\x20registered\x20resource.','Upload\x20resource\x20file','permissions','includes',':update','Missing\x20permission:\x20','fields','value','List\x20resource\x20relations','Returns\x20related\x20records\x20for\x20a\x20resource\x20record.','$resource:create','resourceIdRelation','body','/api/resource/:resource/:id/:relation/:relationId','put'];g=function(){return R;};return g();}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=n=>n[B(0x10e)];export function resourceRoutes(n){return async k=>{const l=r;k[l(0x10f)]('/api/resource/:resource/search',{'schema':{'tags':['fcore','resource'],'summary':l(0x110),'description':'Searches\x20records\x20in\x20a\x20registered\x20resource.','access':l(0x10e),'permissions':['$resource:read'],'params':resourceSchemas[l(0x111)]}},async Z=>searchResource({...Z[l(0x112)],...Z[l(0x113)],'user':user(Z)||n['config']?.['auth']?.['user']},n)),k['get'](l(0x114),{'schema':{'tags':['fcore','resource'],'summary':'Suggest\x20resource\x20values','description':l(0x115),'access':l(0x10e),'permissions':['$resource:read'],'params':resourceSchemas[l(0x116)],'querystring':resourceSchemas['suggestQuery']}},async Z=>suggestResource({...Z['query'],...Z['params'],'user':user(Z)||n[l(0x117)]?.['auth']?.['user']},n)),k['get'](l(0x118),{'schema':{'tags':[l(0x119),l(0x111)],'summary':'Export\x20resource\x20records','description':'Exports\x20readable\x20records\x20from\x20a\x20registered\x20resource.','access':'user','permissions':['$resource:read'],'params':resourceSchemas['exportResource'],'querystring':resourceSchemas['exportResourceQuery']}},async Z=>exportResource({...Z['query'],...Z[l(0x113)],'user':user(Z)||n[l(0x117)]?.['auth']?.['user']},n)),k[l(0x10f)](l(0x11a),{'schema':{'tags':['fcore','resource'],'summary':'List\x20resource\x20records','description':'Returns\x20records\x20from\x20a\x20registered\x20resource.','access':'user','permissions':['$resource:read'],'params':resourceSchemas['resource']}},async Z=>listResources({...Z['query'],...Z['params'],'user':user(Z)||n[l(0x117)]?.[l(0x11b)]?.['user']},n)),k[l(0x11c)]('/api/resource/:resource',{'schema':{'tags':[l(0x119),'resource'],'summary':'Create\x20resource\x20record','description':'Creates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':'user','permissions':['$resource:create'],'params':resourceSchemas['resource']}},async Z=>createResource({...Z[l(0x113)],'data':Z['body'],'user':user(Z)||n['config']?.['auth']?.['user']},n)),k[l(0x10f)]('/api/resource/:resource/:id',{'schema':{'tags':['fcore','resource'],'summary':'Get\x20resource\x20record','description':'Returns\x20one\x20record\x20from\x20a\x20registered\x20resource.','access':'user','permissions':['$resource:read'],'params':resourceSchemas['resourceId'],'querystring':resourceSchemas['resourceIncludeQuery']}},async Z=>getResource({...Z['query'],...Z['params'],'user':user(Z)||n['config']?.['auth']?.['user']},n)),k['put'](l(0x11d),{'schema':{'tags':['fcore',l(0x111)],'summary':l(0x11e),'description':'Updates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':l(0x10e),'permissions':['$resource:update'],'params':resourceSchemas[l(0x11f)]}},async Z=>updateResource({...Z['params'],'patch':Z['body'],'user':user(Z)||n[l(0x117)]?.['auth']?.[l(0x10e)]},n)),k['delete']('/api/resource/:resource/:id',{'schema':{'tags':[l(0x119),'resource'],'summary':'Delete\x20resource\x20record','description':l(0x120),'access':l(0x10e),'permissions':['$resource:delete'],'params':resourceSchemas[l(0x11f)]}},async Z=>deleteResource({...Z[l(0x113)],'user':user(Z)||n['config']?.['auth']?.['user']},n)),k['post']('/api/resource/:resource/:id/upload',{'schema':{'tags':[l(0x119),'resource'],'summary':l(0x121),'description':'Uploads\x20a\x20file\x20to\x20a\x20Resource\x20record\x20and\x20stores\x20its\x20metadata.','access':'user','permissions':['$resource:update'],'params':resourceSchemas['uploadResourceFile']}},async Z=>{const f=l,K=await Z['file']();if(!K)throw new Error('File\x20is\x20required');const d=Z['params'][f(0x111)],J=Z['params']['id'];if(Z['user']?.['type']!=='admin'&&!Z['user']?.[f(0x122)][f(0x123)](d+f(0x124)))throw new ForbiddenError(f(0x125)+d+':update');return uploadFile({'file':K,'metadata':{'name':K['filename'],'path':K[f(0x126)]['path']?.[f(0x127)],'resource':d,'resourceId':J},'user':Z['user']},n);}),k[l(0x10f)]('/api/resource/:resource/:id/:relation',{'schema':{'tags':['fcore','resource'],'summary':l(0x128),'description':l(0x129),'access':'user','params':resourceSchemas['resourceIdRelation'],'permissions':['$resource:read']}},async Z=>listResourceRelation({...Z[l(0x112)],...Z[l(0x113)],'user':user(Z)||n['config']?.['auth']?.['user']},n)),k['post']('/api/resource/:resource/:id/:relation',{'schema':{'tags':[l(0x119),'resource'],'summary':'Create\x20resource\x20relation','description':'Creates\x20a\x20relation\x20for\x20a\x20resource\x20record.','access':l(0x10e),'permissions':[l(0x12a)],'params':resourceSchemas[l(0x12b)]}},async Z=>createResourceRelation({...Z['params'],'data':Z[l(0x12c)],'user':user(Z)||n['config']?.['auth']?.['user']},n)),k['delete'](l(0x12d),{'schema':{'tags':['fcore','resource'],'summary':'Delete\x20resource\x20relation','description':'Deletes\x20a\x20relation\x20from\x20a\x20resource\x20record.','access':'user','permissions':['$resource:delete'],'params':resourceSchemas['resourceIdRelationId']}},async Z=>deleteResourceRelation({...Z['params'],'user':user(Z)||n['config']?.['auth']?.['user']},n)),k[l(0x12e)](l(0x12d),{'schema':{'tags':['fcore',l(0x111)],'summary':'Update\x20resource\x20relation','description':'Updates\x20a\x20related\x20resource\x20record.','access':l(0x10e),'permissions':['$resource:update'],'params':resourceSchemas['resourceIdRelationId']}},async Z=>updateResourceRelation({...Z[l(0x113)],'data':Z['body'],'user':user(Z)||n[l(0x117)]?.['auth']?.[l(0x10e)]},n));};}
|
|
@@ -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 n=r;import{Type}from'@sinclair/typebox';export const identifier=Type['String']({'minLength':0x1,'maxLength':0x80,'pattern':n(0x145)});export const resourceSchemas={'dictionaryName':Type['Object']({'name':identifier}),'resource':Type[n(0x146)]({'resource':identifier}),'exportResource':Type[n(0x146)]({'resource':identifier}),'resourceField':Type['Object']({'resource':identifier,'field':identifier}),'suggestQuery':Type[n(0x146)]({'q':Type['Optional'](Type['String']()),'search':Type[n(0x147)](Type['String']()),'limit':Type['Optional'](Type['Integer']({'minimum':0x1,'maximum':0xc8}))}),'resourceId':Type[n(0x146)]({'resource':identifier,'id':identifier}),'resourceIncludeQuery':Type['Object']({'include':Type[n(0x147)](Type['String']({'minLength':0x1}))}),'resourceIdRelation':Type['Object']({'resource':identifier,'id':identifier,'relation':identifier}),'resourceIdRelationId':Type['Object']({'resource':identifier,'id':identifier,'relation':identifier,'relationId':identifier}),'uploadResourceFile':Type['Object']({'resource':identifier,'id':identifier}),'uploadResourceFileBody':Type[n(0x146)]({'file':Type[n(0x148)](),'fileName':Type['String']({'minLength':0x1,'maxLength':0xff})}),'exportResourceQuery':Type['Object']({'filter':Type['Optional'](Type['Record'](Type[n(0x149)](),Type['Unknown']())),'sort':Type['Optional'](Type[n(0x14a)](Type['String']({'minLength':0x1}))),'search':Type['Optional'](Type['String']()),'limit':Type['Optional'](Type['Integer']({'minimum':0x1,'maximum':0xc8})),'offset':Type['Optional'](Type['Integer']({'minimum':0x0})),'fields':Type[n(0x147)](Type['Array'](identifier))})};function r(n,k){n=n-0x145;const Z=g();let K=Z[n];return K;}function g(){const k=['^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$','Object','Optional','Any','String','Array'];g=function(){return k;};return g();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function g(){const d=['query','rows'];g=function(){return d;};return g();}function r(n,k){n=n-0x191;const Z=g();let K=Z[n];return K;}export async function addNote(n,k){const K=r,Z=await k['pg'][K(0x191)]('INSERT\x20INTO\x20admin.notes(resource,resource_id,body)\x20VALUES\x20($1,$2,$3)\x20RETURNING\x20*',[n['resource'],String(n['id']),n['body']]);return Z[K(0x192)][0x0];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function r(n,k){n=n-0xf7;const Z=g();let K=Z[n];return K;}function g(){const d=['size'];g=function(){return d;};return g();}export async function addResourceFile(n,k){const K=r,Z=await k['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\x20\x20',[n['resource'],String(n['id']),n['filePath'],n[K(0xf7)]??null]);return Z['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(n,k){const {resource:Z,id:K,relation:d,data:J,user:B}=n;return k['resource']['createRelation']({'name':Z,'id':K,'relation':d,'data':J,'user':B});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function createResource(n,k){return k['resource']['create']({'name':n['resource'],'data':n['data'],'user':n['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
|
-
function
|
|
1
|
+
export async function deleteResourceRelation(n,k){const {resource:Z,id:K,relation:d,relationId:J}=n;return k['resource']['deleteRelation']({'name':Z,'id':K,'relation':d,'relationId':J});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function deleteResource(n,k){return k['resource']['delete']({'name':n['resource'],'id':n['id'],'user':n['user']});}
|
|
@@ -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
|
+
import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';function r(n,k){n=n-0x127;const Z=g();let K=Z[n];return K;}function g(){const d=['offset','fields','rows'];g=function(){return d;};return g();}export async function exportResource(n,k){const K=r,Z=await k['resource']['find']({'name':n['resource'],'query':{'filter':parseFilterQuery(n),'sort':n['sort'],'search':n['search'],'limit':n['limit'],'offset':n[K(0x127)],'fields':n[K(0x128)]},'user':n['user']});return Z[K(0x129)];}
|
|
@@ -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
|
+
export async function getResource(n,k){var Z=r;return k['resource'][Z(0x118)]({'name':n[Z(0x119)],'id':n['id'],'query':{'include':n[Z(0x11a)]},'user':n['user']});}function r(n,k){n=n-0x118;var Z=g();var K=Z[n];return K;}function g(){var K=['findOne','resource','include'];g=function(){return K;};return g();}
|
|
@@ -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
|
-
function
|
|
1
|
+
export async function listResourceRelation(n,k){const {resource:Z,id:K,relation:d,query:J,user:B}=n;return k['resource']['findRelation']({'name':Z,'id':K,'relation':d,'query':J,'user':B});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-resources.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"list-resources.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAY9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';function r(n,k){n=n-0x152;var Z=g();var K=Z[n];return K;}export async function listResources(n,k){var Z=r;return k['resource'][Z(0x152)]({'name':n['resource'],'query':{'filter':parseFilterQuery(n),'sort':n['sort'],'search':n[Z(0x153)],'limit':n[Z(0x154)],'offset':n['offset']??(n['page']?Math['max'](n['page']-0x1,0x0):0x0)*(n['limit']??0x14)},'user':n[Z(0x155)]});}function g(){var K=['find','search','limit','user'];g=function(){return K;};return g();}
|
|
@@ -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(n,k){return k['resource']['find']({'name':n['resource'],'query':{...n,'filter':parseFilterQuery(n)},'user':n['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
|