@opengis/fcore 0.0.1-beta.1 → 0.0.1-beta.11
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 +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 +65 -8
- 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.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 +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 +12 -7
- 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
|
@@ -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
|
+
function G(){const y=['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','rows'];G=function(){return y;};return G();}import{ConflictError}from'../../../errors.js';import{hashPassword}from'../../../plugins/auth/index.js';function q(R,t){R=R-0x176;const X=G();let g=X[R];return g;}export default async function registration({user:R,password:t,type:X},{pg:g}){const l=q,m=await hashPassword(t),Z=await g[l(0x176)](l(0x177),[R,m,X||'regular']),z=Z[l(0x178)][0x0];if(!z)throw new ConflictError('Login\x20is\x20already\x20in\x20use');return{'user':z};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function G(){var g=['Two-factor\x20provider'];G=function(){return g;};return G();}import{unsupported}from'../../utils/unsupported.js';function q(R,t){R=R-0xd7;var X=G();var g=X[R];return g;}export default async function verifyTwoFactor(R,t){var X=q;return unsupported(X(0xd7));}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime.d.ts","sourceRoot":"","sources":["../../../src/modules/file/mime.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var R=q;function q(R,t){R=R-0xaf;var X=G();var g=X[R];return g;}export default new Set(['image/jpeg',R(0xaf),'image/gif','image/webp','image/bmp','image/tiff',R(0xb0),'image/x-icon','image/avif','application/pdf','application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/vnd.ms-excel','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/vnd.ms-powerpoint','application/vnd.openxmlformats-officedocument.presentationml.presentation','application/vnd.oasis.opendocument.text','application/vnd.oasis.opendocument.spreadsheet',R(0xb1),R(0xb2),'text/csv','text/markdown',R(0xb3),R(0xb4),'text/xml','application/geo+json','application/vnd.google-earth.kml+xml','application/vnd.google-earth.kmz','application/zip','application/x-zip-compressed','application/x-7z-compressed','application/x-rar-compressed',R(0xb5),R(0xb6),'application/x-gzip',R(0xb7),'audio/mpeg','audio/wav','audio/ogg','audio/webm',R(0xb8),'video/mp4','video/mpeg','video/webm','video/quicktime','video/x-msvideo',R(0xb9)]);function G(){var t=['image/png','image/svg+xml','application/vnd.oasis.opendocument.presentation','text/plain','application/json','application/xml','application/vnd.rar','application/gzip','application/x-tar','audio/mp4','application/octet-stream'];G=function(){return t;};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
|
-
|
|
1
|
+
import{fileTypeFromBuffer}from'file-type';import{getFile}from'./services/get-file.js';function q(R,t){R=R-0x154;const X=G();let g=X[R];return g;}import{uploadFile}from'./services/upload-file.js';import{resizeFile}from'./services/resize-file.js';import{fileSchemas}from'./schema.js';function G(){const U=['get','file','public','token','application/octet-stream','image/','application/pdf','Content-Disposition','inline','header','public,\x20max-age=86400,\x20immutable','post','/api/file/upload','fcore','filename','resource','fields','user','query'];G=function(){return U;};return G();}export function fileRoutes(R){return async t=>{const E=q;t[E(0x154)]('/api/file/:token',{'schema':{'tags':['fcore',E(0x155)],'summary':'Get\x20file\x20by\x20token','description':'Returns\x20a\x20file\x20after\x20verifying\x20its\x20signed\x20access\x20token.','access':E(0x156),'permissions':[],'params':fileSchemas['fileToken'],'querystring':fileSchemas['fileDownloadQuery']}},async(X,g)=>{const C=E,m=R[C(0x155)]['verify'](X['params'][C(0x157)]),Z=await getFile({'pathOrToken':m},R),z=await fileTypeFromBuffer(Z),l=z?.['mime']??C(0x158),y=X['query']['download']===!![],h=l['startsWith'](C(0x159))||l===C(0x15a),P=m['split']('/')['pop']()?.['replace'](/[^A-Za-z0-9._-]/g,'_')??C(0x155);return g['type'](l),g['header'](C(0x15b),(y||!h?'attachment':C(0x15c))+';\x20filename=\x22'+P+'\x22')[C(0x15d)]('Cache-Control',C(0x15e)),g['send'](Z);}),t[E(0x15f)](E(0x160),{'schema':{'tags':[E(0x161),'file'],'summary':'Upload\x20file','description':'Uploads\x20a\x20file\x20and\x20stores\x20its\x20metadata.','access':'user','permissions':['files:create']}},async X=>{const L=E,g=await X['file']();if(!g)throw new Error('File\x20is\x20required');return uploadFile({'file':g,'metadata':{'name':g[L(0x162)],'path':g['fields']['path']?.['value'],'resource':g['fields'][L(0x163)]?.['value'],'resourceId':g[L(0x164)]['resourceId']?.['value']},'user':X[L(0x165)]},R);}),t['get']('/api/file/:token/resize',{'schema':{'tags':['fcore','file'],'summary':'Resize\x20file','description':'Returns\x20a\x20resized\x20image\x20file.','access':'user','permissions':['files:read'],'params':fileSchemas['fileToken'],'querystring':fileSchemas['resizeQuery']}},async(X,g)=>{const O=E,m=await resizeFile({'pathOrToken':R['file']?.['verify'](X['params'][O(0x157)]),...X[O(0x166)]},R),Z=await fileTypeFromBuffer(m);return g['type'](Z?.['mime']??'image/png'),g['header']('Content-Disposition','inline')[O(0x15d)]('Cache-Control',O(0x15e)),g['send'](m);});};}
|
|
@@ -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
|
-
|
|
1
|
+
function G(){const t=['Object','String','Optional','Union','cover','contain','fill'];G=function(){return t;};return G();}function q(R,t){R=R-0x197;const X=G();let g=X[R];return g;}const R=q;import{Type}from'@sinclair/typebox';export const fileSchemas={'fileId':Type[R(0x197)]({'id':Type['String']({'minLength':0x1,'maxLength':0x80})}),'fileToken':Type['Object']({'token':Type['String']({'minLength':0x1,'maxLength':0x800})}),'fileDownloadQuery':Type[R(0x197)]({'download':Type['Optional'](Type['Boolean']())}),'filePath':Type['Object']({'*':Type[R(0x198)]({'minLength':0x1,'maxLength':0x400})}),'upload':Type['Object']({'file':Type['Any'](),'metadata':Type[R(0x197)]({'name':Type['Optional'](Type['String']({'minLength':0x1})),'path':Type['Optional'](Type['String']({'minLength':0x1})),'entityType':Type[R(0x199)](Type[R(0x198)]({'minLength':0x1})),'entityId':Type['Optional'](Type['String']({'minLength':0x1}))})}),'filePatch':Type['Object']({'entityType':Type[R(0x199)](Type['String']({'minLength':0x1})),'entityId':Type['Optional'](Type['String']({'minLength':0x1}))}),'resizeQuery':Type[R(0x197)]({'width':Type['Optional'](Type['Integer']({'minimum':0x1,'default':0xc8})),'height':Type['Optional'](Type['Integer']({'minimum':0x1})),'fit':Type[R(0x199)](Type[R(0x19a)]([Type['Literal'](R(0x19b)),Type['Literal'](R(0x19c)),Type['Literal'](R(0x19d)),Type['Literal']('inside'),Type['Literal']('outside')]))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{NotFoundError}from'../../../errors.js';export async function getFile(R,t){var X=q;if(!t[X(0xb6)])throw new Error(X(0xb7));if(!await t[X(0xb6)]['exists'](R['pathOrToken']))throw new NotFoundError('File\x20not\x20found'+R[X(0xb8)]);return t['file']['get'](R[X(0xb8)]);}function q(R,t){R=R-0xb6;var X=G();var g=X[R];return g;}function G(){var g=['file','empty\x20file','pathOrToken'];G=function(){return g;};return G();}
|
|
@@ -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';import{createHash}from'node:crypto';import{mkdir,readFile,writeFile}from'node:fs/promises';import R from'node:path';import t from'sharp';function q(R,t){R=R-0xce;const X=G();let g=X[R];return g;}function G(){const e=['pathOrToken','fit','hex','logs','resize','code','ENOENT','file','mime','startsWith','cover','toBuffer','\x20must\x20be\x20a\x20positive\x20integer'];G=function(){return e;};return G();}export async function resizeFile(X,g){const O=q,m=X[O(0xce)]??X['path'];if(!m)throw new ValidationError('File\x20path\x20is\x20required');const Z=parseDimension(X['width'],'width')??0xc8,z=parseDimension(X['height'],'height'),l=createHash('sha256')['update'](m+':'+Z+':'+(z??'auto')+':'+(X[O(0xcf)]??'cover'))['digest'](O(0xd0)),y=R['resolve'](O(0xd1),O(0xd2)),h=R['join'](y,l+'.jpg');try{return await readFile(h);}catch(L){if(L[O(0xd3)]!==O(0xd4))throw L;}if(!await g['file']['exists'](m))throw new NotFoundError('File\x20not\x20found');const P=await g[O(0xd5)]['get'](m),E=await fileTypeFromBuffer(P);if(!E?.[O(0xd6)][O(0xd7)]('image/'))throw new ValidationError('Only\x20image\x20files\x20can\x20be\x20resized');const C=await t(P)['resize']({'width':Z,'height':z,'fit':X[O(0xcf)]??O(0xd8)})[O(0xd9)]();return await mkdir(y,{'recursive':!![]}),await writeFile(h,C),C;}function parseDimension(X,g){const U=q;if(X===undefined||X==='')return undefined;const m=Number(X);if(!Number['isInteger'](m)||m<=0x0)throw new ValidationError(g+U(0xda));return m;}
|
|
@@ -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
|
+
import{fileTypeFromBuffer}from'file-type';import R from'../mime.js';import{randomUUID}from'node:crypto';function q(R,t){R=R-0x147;const X=G();let g=X[R];return g;}function G(){const L=['padStart','metadata','has','mime','resource','name','file','rows'];G=function(){return L;};return G();}export async function uploadFile(t,X){const C=q,g=(t['metadata']['name']??randomUUID())['replace'](/[^a-zA-Z0-9._-]/g,'_'),m=new Date(),Z=String(m['getFullYear']())['slice'](-0x2),z=String(m['getMonth']()+0x1)[C(0x147)](0x2,'0'),l=String(m['getDate']())['padStart'](0x2,'0'),y=t['metadata']['path']??(t[C(0x148)]['resource']?t['metadata']['resource']+'/'+(t['metadata']['resourceId']??randomUUID())+'/'+g:null)??'uploads/'+Z+'/'+z+'-'+l+'/'+g,h=await t['file']['toBuffer'](),P=await fileTypeFromBuffer(h);if(!R['has'](t['file']['mimetype'])&&(P?.['mime']?!R[C(0x149)](P[C(0x14a)]):!![]))throw new Error('Unsupported\x20file\x20type:\x20'+t['file']['mimetype']);await X['file']['put'](y,h);const E=await X['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',[t['metadata'][C(0x14b)]??null,t['metadata']['resourceId']??null,y,t['file']['mimetype'],t['file']['file']['bytesRead'],t['metadata'][C(0x14c)],g,t[C(0x14d)]['mimetype']['split']('/')['pop']()??null,t['user']?.['id']??null]);return E[C(0x14e)][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';function G(){const y=['fcore','resource','params','resourceField','suggestQuery','get','/api/resource/:resource/export','query','/api/resource/:resource','user','body','/api/resource/:resource/:id','Update\x20resource\x20record','post','Uploads\x20a\x20file\x20to\x20a\x20Resource\x20record\x20and\x20stores\x20its\x20metadata.','file','type','permissions','fields','List\x20resource\x20relations','Delete\x20resource\x20relation'];G=function(){return y;};return G();}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{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';function q(R,t){R=R-0x141;const X=G();let g=X[R];return g;}const user=R=>R['user'];export function resourceRoutes(R){return async t=>{const z=q;t['get']('/api/resource/:resource/search',{'schema':{'tags':[z(0x141),z(0x142)],'summary':'Search\x20resource','description':'Searches\x20records\x20in\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas['resource']}},async X=>searchResource({...X['query'],...X[z(0x143)],'user':user(X)},R)),t['get']('/api/suggest/:resource/:field',{'schema':{'tags':['fcore','resource'],'summary':'Suggest\x20resource\x20values','description':'Returns\x20suggested\x20values\x20for\x20a\x20resource\x20field.','access':'user','permissions':[],'params':resourceSchemas[z(0x144)],'querystring':resourceSchemas[z(0x145)]}},async X=>suggestResource({...X['query'],...X[z(0x143)],'user':user(X)},R)),t[z(0x146)](z(0x147),{'schema':{'tags':['fcore',z(0x142)],'summary':'Export\x20resource\x20records','description':'Exports\x20readable\x20records\x20from\x20a\x20registered\x20resource.','access':'user','permissions':['*:read'],'params':resourceSchemas['exportResource'],'querystring':resourceSchemas['exportResourceQuery']}},async X=>exportResource({...X[z(0x148)],...X[z(0x143)],'user':user(X)},R)),t['get'](z(0x149),{'schema':{'tags':[z(0x141),z(0x142)],'summary':'List\x20resource\x20records','description':'Returns\x20records\x20from\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas['resource']}},async X=>listResources({...X['query'],...X['params'],'user':user(X)},R)),t['post']('/api/resource/:resource',{'schema':{'tags':['fcore','resource'],'summary':'Create\x20resource\x20record','description':'Creates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':z(0x14a),'permissions':[],'params':resourceSchemas[z(0x142)]}},async X=>createResource({...X[z(0x143)],'data':X[z(0x14b)],'user':user(X)},R)),t[z(0x146)](z(0x14c),{'schema':{'tags':['fcore','resource'],'summary':'Get\x20resource\x20record','description':'Returns\x20one\x20record\x20from\x20a\x20registered\x20resource.','access':z(0x14a),'permissions':[],'params':resourceSchemas['resourceId'],'querystring':resourceSchemas['resourceIncludeQuery']}},async X=>getResource({...X['query'],...X['params'],'user':user(X)},R)),t['put'](z(0x14c),{'schema':{'tags':['fcore','resource'],'summary':z(0x14d),'description':'Updates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas['resourceId']}},async X=>updateResource({...X['params'],'patch':X['body'],'user':user(X)},R)),t['delete']('/api/resource/:resource/:id',{'schema':{'tags':['fcore','resource'],'summary':'Delete\x20resource\x20record','description':'Deletes\x20a\x20record\x20from\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas['resourceId']}},async X=>deleteResource({...X[z(0x143)],'user':user(X)},R)),t[z(0x14e)]('/api/resource/:resource/:id/upload',{'schema':{'tags':['fcore','resource'],'summary':'Upload\x20resource\x20file','description':z(0x14f),'access':z(0x14a),'permissions':[],'params':resourceSchemas['uploadResourceFile']}},async X=>{const l=z,g=await X[l(0x150)]();if(!g)throw new Error('File\x20is\x20required');const m=X['params']['resource'],Z=X['params']['id'];if(X['user']?.[l(0x151)]!=='admin'&&!X['user']?.[l(0x152)]['includes'](m+':update'))throw new ForbiddenError('Missing\x20permission:\x20'+m+':update');return uploadFile({'file':g,'metadata':{'name':g['filename'],'path':g[l(0x153)]['path']?.['value'],'resource':m,'resourceId':Z},'user':X[l(0x14a)]},R);}),t['get']('/api/resource/:resource/:id/:relation',{'schema':{'tags':[z(0x141),z(0x142)],'summary':z(0x154),'description':'Returns\x20related\x20records\x20for\x20a\x20resource\x20record.','access':z(0x14a),'permissions':[],'schema':{'params':resourceSchemas['resourceIdRelation']}}},async X=>listResourceRelation({...X['query'],...X[z(0x143)],'user':user(X)},R)),t[z(0x14e)]('/api/resource/:resource/:id/:relation',{'schema':{'tags':[z(0x141),z(0x142)],'summary':'Create\x20resource\x20relation','description':'Creates\x20a\x20relation\x20for\x20a\x20resource\x20record.','access':'user','permissions':[],'params':resourceSchemas['resourceIdRelation']}},async X=>createResourceRelation({...X['params'],'data':X['body'],'user':user(X)},R)),t['delete']('/api/resource/:resource/:id/:relation/:relationId',{'schema':{'tags':['fcore','resource'],'summary':z(0x155),'description':'Deletes\x20a\x20relation\x20from\x20a\x20resource\x20record.','access':'user','permissions':[],'params':resourceSchemas['resourceIdRelationId']}},async X=>deleteResourceRelation({...X['params'],'user':user(X)},R)),t['put']('/api/resource/:resource/:id/:relation/:relationId',{'schema':{'tags':['fcore',z(0x142)],'summary':'Update\x20resource\x20relation','description':'Updates\x20a\x20related\x20resource\x20record.','access':'user','permissions':[],'params':resourceSchemas['resourceIdRelationId']}},async X=>updateResourceRelation({...X['params'],'data':X['body'],'user':user(X)},R));};}
|
|
@@ -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
|
-
|
|
1
|
+
function G(){const t=['String','^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$','Object','Optional','Record'];G=function(){return t;};return G();}const R=q;function q(R,t){R=R-0x97;const X=G();let g=X[R];return g;}import{Type}from'@sinclair/typebox';export const identifier=Type[R(0x97)]({'minLength':0x1,'maxLength':0x80,'pattern':R(0x98)});export const resourceSchemas={'dictionaryName':Type['Object']({'name':identifier}),'resource':Type['Object']({'resource':identifier}),'exportResource':Type['Object']({'resource':identifier}),'resourceField':Type['Object']({'resource':identifier,'field':identifier}),'suggestQuery':Type[R(0x99)]({'q':Type['Optional'](Type[R(0x97)]()),'search':Type[R(0x9a)](Type['String']()),'limit':Type['Optional'](Type['Integer']({'minimum':0x1,'maximum':0xc8}))}),'resourceId':Type['Object']({'resource':identifier,'id':identifier}),'resourceIncludeQuery':Type['Object']({'include':Type[R(0x9a)](Type['String']({'minLength':0x1}))}),'resourceIdRelation':Type['Object']({'resource':identifier,'id':identifier,'relation':identifier}),'resourceIdRelationId':Type[R(0x99)]({'resource':identifier,'id':identifier,'relation':identifier,'relationId':identifier}),'uploadResourceFile':Type['Object']({'resource':identifier,'id':identifier}),'uploadResourceFileBody':Type['Object']({'file':Type['Any'](),'fileName':Type[R(0x97)]({'minLength':0x1,'maxLength':0xff})}),'exportResourceQuery':Type['Object']({'filter':Type['Optional'](Type[R(0x9b)](Type['String'](),Type['Unknown']())),'sort':Type['Optional'](Type['Array'](Type['String']({'minLength':0x1}))),'search':Type['Optional'](Type[R(0x97)]()),'limit':Type[R(0x9a)](Type['Integer']({'minimum':0x1,'maximum':0xc8})),'offset':Type[R(0x9a)](Type['Integer']({'minimum':0x0})),'fields':Type['Optional'](Type['Array'](identifier))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function q(R,t){R=R-0x1a6;const X=G();let g=X[R];return g;}function G(){const m=['INSERT\x20INTO\x20admin.notes(resource,resource_id,body)\x20VALUES\x20($1,$2,$3)\x20RETURNING\x20*'];G=function(){return m;};return G();}export async function addNote(R,t){const g=q,X=await t['pg']['query'](g(0x1a6),[R['resource'],String(R['id']),R['body']]);return X['rows'][0x0];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function q(R,t){R=R-0x11c;const X=G();let g=X[R];return g;}export async function addResourceFile(R,t){const g=q,X=await t['pg']['query'](g(0x11c),[R['resource'],String(R['id']),R['filePath'],R[g(0x11d)]??null]);return X[g(0x11e)][0x0];}function G(){const m=['\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','rows'];G=function(){return m;};return G();}
|
|
@@ -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(R,t){const {resource:X,id:g,relation:m,data:Z,user:z}=R;return t['resource']['createRelation']({'name':X,'id':g,'relation':m,'data':Z,'user':z});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function q(R,t){R=R-0xb7;var X=G();var g=X[R];return g;}function G(){var g=['resource','user'];G=function(){return g;};return G();}export async function createResource(R,t){var X=q;return t[X(0xb7)]['create']({'name':R['resource'],'data':R['data'],'user':R[X(0xb8)]});}
|
|
@@ -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(R,t){const z=q,{resource:X,id:g,relation:m,relationId:Z}=R;return t[z(0x1b1)]['deleteRelation']({'name':X,'id':g,'relation':m,'relationId':Z});}function q(R,t){R=R-0x1b1;const X=G();let g=X[R];return g;}function G(){const l=['resource'];G=function(){return l;};return G();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function deleteResource(R,t){var X=q;return t[X(0xd5)][X(0xd6)]({'name':R['resource'],'id':R['id'],'user':R['user']});}function q(R,t){R=R-0xd5;var X=G();var g=X[R];return g;}function G(){var g=['resource','delete'];G=function(){return g;};return G();}
|
|
@@ -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';export async function exportResource(R,t){const g=q,X=await t['resource'][g(0x93)]({'name':R[g(0x94)],'query':{'filter':parseFilterQuery(R),'sort':R['sort'],'search':R['search'],'limit':R['limit'],'offset':R[g(0x95)],'fields':R['fields']},'user':R['user']});return X['rows'];}function q(R,t){R=R-0x93;const X=G();let g=X[R];return g;}function G(){const m=['find','resource','offset'];G=function(){return m;};return G();}
|
|
@@ -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 q(R,t){R=R-0x1b3;var X=G();var g=X[R];return g;}export async function getResource(R,t){var X=q;return t[X(0x1b3)]['findOne']({'name':R['resource'],'id':R['id'],'query':{'include':R[X(0x1b4)]},'user':R['user']});}function G(){var g=['resource','include'];G=function(){return g;};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
|
-
|
|
1
|
+
export async function listResourceRelation(R,t){const {resource:X,id:g,relation:m,query:Z,user:z}=R;return t['resource']['findRelation']({'name':X,'id':g,'relation':m,'query':Z,'user':z});}
|
|
@@ -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 G(){var g=['max'];G=function(){return g;};return G();}import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';function q(R,t){R=R-0x196;var X=G();var g=X[R];return g;}export async function listResources(R,t){var X=q;return t['resource']['find']({'name':R['resource'],'query':{'filter':parseFilterQuery(R),'sort':R['sort'],'search':R['search'],'limit':R['limit'],'offset':R['offset']??(R['page']?Math[X(0x196)](R['page']-0x1,0x0):0x0)*(R['limit']??0x14)},'user':R['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';function q(R,t){R=R-0x8c;var X=G();var g=X[R];return g;}export async function searchResource(R,t){var X=q;return t['resource']['find']({'name':R[X(0x8c)],'query':{...R,'filter':parseFilterQuery(R)},'user':R[X(0x8d)]});}function G(){var g=['resource','user'];G=function(){return g;};return G();}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Implements the suggest resource application service for its module.
|
|
3
|
-
*/
|
|
4
1
|
import type { AppContext } from '../../../context.js';
|
|
5
|
-
|
|
2
|
+
type SuggestResourceResult = {
|
|
3
|
+
search: string;
|
|
4
|
+
time: number;
|
|
5
|
+
data: any[];
|
|
6
|
+
limit?: number;
|
|
7
|
+
count?: number;
|
|
8
|
+
total?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function suggestResource(params: any, ctx: AppContext): Promise<SuggestResourceResult>;
|
|
11
|
+
export {};
|
|
6
12
|
//# sourceMappingURL=suggest-resource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/suggest-resource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"suggest-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/suggest-resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,KAAK,qBAAqB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAElB,CAAC;AAEF,wBAAsB,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA4ClG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function q(R,t){R=R-0x82;const X=G();let g=X[R];return g;}function G(){const e=['resource','toLowerCase','min','max','fields','table','name','value','query','SELECT\x20','then','length','startsWith','now'];G=function(){return e;};return G();}import{ValidationError}from'../../../errors.js';import{autoIndex}from'../../../plugins/resource/utils/auto-index.js';export async function suggestResource(R,t){const U=q,X=t[U(0x82)]['get'](R['resource']),g=String(R['search']??R['q']??'')[U(0x83)](),m=Math[U(0x84)](Math[U(0x85)](Number(R['limit']??0x14),0x1),0xc8),Z=Date['now'](),z=X[U(0x86)][R['field']],l=z?.['dictionary'],y=z?.['lookup']?.[U(0x87)];if(y){const E=z['lookup']?.['text']??U(0x88),C=z['lookup']?.[U(0x89)]??'id';autoIndex(y,E,'text',t['pg']);const L=await t['pg'][U(0x8a)](U(0x8b)+C+'\x20as\x20id,\x20'+E+'\x20as\x20text\x20FROM\x20'+y+'\x20WHERE\x20lower('+E+')\x20~\x20$1\x20LIMIT\x20$2',[''+g[U(0x83)](),m])[U(0x8c)](O=>O['rows']);return{'limit':m,'count':L[U(0x8d)],'search':g,'time':Date['now']()-Z,'data':L};}if(!l)throw new ValidationError('Field\x20has\x20no\x20lookup\x20dictionary:\x20'+R['field']);const h=await t['dictionary']['get'](l),P=h['filter'](O=>!g||O['code'][U(0x8e)](g)||O['name'][U(0x8e)](g))['slice'](0x0,m)['map'](O=>({'id':O['code']||O['id'],'text':O['name']||O['text']}));return{'search':g,'limit':m,'count':P['length'],'time':Date[U(0x8f)]()-Z,'data':P};}
|
|
@@ -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"}
|