@opengis/fcore 0.0.1-beta.0 → 0.0.1-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -3
- package/README.md +71 -71
- package/dist/config.d.ts +3 -10
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/context.d.ts +4 -4
- package/dist/context.d.ts.map +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.d.ts.map +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.d.ts.map +1 -1
- package/dist/modules/resource/services/add-note.js +1 -1
- package/dist/modules/resource/services/add-resource-file.d.ts.map +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.d.ts.map +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.d.ts +1 -1
- package/dist/modules/utils/require-admin.d.ts.map +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.d.ts +2 -2
- package/dist/plugins/audit/audit.d.ts.map +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.d.ts +2 -2
- package/dist/plugins/audit/services/write-audit.d.ts.map +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 +4 -7
- 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.d.ts +9 -4
- package/dist/plugins/logger/index.d.ts.map +1 -1
- 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 +62 -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 +5 -2
- package/dist/plugins/resource/services/delete.d.ts.map +1 -1
- package/dist/plugins/resource/services/delete.js +1 -1
- package/dist/plugins/resource/services/find-one.d.ts +3 -2
- package/dist/plugins/resource/services/find-one.d.ts.map +1 -1
- package/dist/plugins/resource/services/find-one.js +1 -1
- package/dist/plugins/resource/services/find-relation.d.ts +13 -0
- package/dist/plugins/resource/services/find-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/find-relation.js +1 -0
- package/dist/plugins/resource/services/find.d.ts.map +1 -1
- package/dist/plugins/resource/services/find.js +1 -1
- package/dist/plugins/resource/services/update-relation.d.ts +14 -0
- package/dist/plugins/resource/services/update-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/update-relation.js +1 -0
- package/dist/plugins/resource/services/update.d.ts +5 -2
- package/dist/plugins/resource/services/update.d.ts.map +1 -1
- package/dist/plugins/resource/services/update.js +1 -1
- package/dist/plugins/resource/utils/auto-index.d.ts +4 -0
- package/dist/plugins/resource/utils/auto-index.d.ts.map +1 -0
- package/dist/plugins/resource/utils/auto-index.js +1 -0
- package/dist/plugins/resource/utils/fields.d.ts +8 -1
- package/dist/plugins/resource/utils/fields.d.ts.map +1 -1
- package/dist/plugins/resource/utils/fields.js +1 -1
- package/dist/plugins/resource/utils/filters.d.ts +3 -2
- package/dist/plugins/resource/utils/filters.d.ts.map +1 -1
- package/dist/plugins/resource/utils/filters.js +1 -1
- package/dist/plugins/resource/utils/permissions.d.ts.map +1 -1
- package/dist/plugins/resource/utils/permissions.js +1 -1
- package/dist/plugins/resource/utils/sort.d.ts.map +1 -1
- package/dist/plugins/resource/utils/sort.js +1 -1
- package/dist/plugins/resource/utils/sql.js +1 -1
- package/dist/shared/getIP.js +1 -1
- package/dist/type.d.ts +37 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +1 -0
- package/migrations/20260903120000_core_schema.sql +259 -0
- package/migrations/20260903130000_move_notes_files_to_admin.sql +18 -0
- package/migrations/20260903140000_settings_nulls_not_distinct.sql +19 -0
- package/migrations/20260905120000_add_user_foreign_keys.sql +43 -0
- package/migrations/20260907090000_core_schema.sql +32 -0
- package/package.json +93 -87
- 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
- package/dist/plugins/logger/checkUserAccess.d.ts +0 -11
- package/dist/plugins/logger/checkUserAccess.d.ts.map +0 -1
- package/dist/plugins/logger/checkUserAccess.js +0 -1
- package/dist/plugins/logger/createFileStream.d.ts +0 -3
- package/dist/plugins/logger/createFileStream.d.ts.map +0 -1
- package/dist/plugins/logger/createFileStream.js +0 -1
- package/dist/plugins/logger/createLogger.d.ts +0 -9
- package/dist/plugins/logger/createLogger.d.ts.map +0 -1
- package/dist/plugins/logger/createLogger.js +0 -1
- package/dist/plugins/logger/errorStatus.d.ts +0 -2
- package/dist/plugins/logger/errorStatus.d.ts.map +0 -1
- package/dist/plugins/logger/errorStatus.js +0 -1
- package/dist/plugins/logger/getHooks.d.ts +0 -5
- package/dist/plugins/logger/getHooks.d.ts.map +0 -1
- package/dist/plugins/logger/getHooks.js +0 -1
- package/dist/plugins/logger/getRootDir.d.ts +0 -3
- package/dist/plugins/logger/getRootDir.d.ts.map +0 -1
- package/dist/plugins/logger/getRootDir.js +0 -1
- package/dist/plugins/logger/labels.d.ts +0 -3
- package/dist/plugins/logger/labels.d.ts.map +0 -1
- package/dist/plugins/logger/labels.js +0 -1
- package/dist/plugins/logger/serializers.d.ts +0 -14
- package/dist/plugins/logger/serializers.d.ts.map +0 -1
- package/dist/plugins/logger/serializers.js +0 -1
- package/dist/plugins/logger/timestampWithTimeZone.d.ts +0 -2
- package/dist/plugins/logger/timestampWithTimeZone.d.ts.map +0 -1
- package/dist/plugins/logger/timestampWithTimeZone.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-current-user.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/services/get-current-user.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,wBAA8B,cAAc,CAAC,MAAM,EAAE;IACnD,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"get-current-user.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/services/get-current-user.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,wBAA8B,cAAc,CAAC,MAAM,EAAE;IACnD,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IACvB,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;CAC5B,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAenC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function S(d,h){d=d-0x1dc;const p=v();let Z=p[d];return Z;}import{safeUser}from'../../utils/safe-user.js';function v(){const n=['split'];v=function(){return n;};return v();}export default async function getCurrentUser(d){const u=S,{user:h}=d;if(!h)return{};if(d['token']){const {jwtSignToken:p}=await import('../../../plugins/jwt.js'),Z=await p(h);h['token']=Z;}return h['resources']=[...new Set(h?.['permissions']['map'](D=>D[u(0x1dc)](':')[0x0]))],safeUser(h);}
|
|
@@ -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 v(){const Y=['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','Login\x20is\x20already\x20in\x20use'];v=function(){return Y;};return v();}import{ConflictError}from'../../../errors.js';function S(d,h){d=d-0x140;const p=v();let Z=p[d];return Z;}import{hashPassword}from'../../../plugins/auth/index.js';export default async function registration({user:d,password:h,type:p},{pg:Z}){const X=S,D=await hashPassword(h),u=await Z['query'](X(0x140),[d,D,p||'regular']),n=u['rows'][0x0];if(!n)throw new ConflictError(X(0x141));return{'user':n};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{unsupported}from'../../utils/unsupported.js';export default async function verifyTwoFactor(d,h){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 d=S;export default new Set([d(0xcc),'image/png','image/gif','image/webp','image/bmp','image/tiff','image/svg+xml','image/x-icon','image/avif','application/pdf','application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document',d(0xcd),'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/vnd.ms-powerpoint',d(0xce),'application/vnd.oasis.opendocument.text','application/vnd.oasis.opendocument.spreadsheet',d(0xcf),'text/plain','text/csv','text/markdown',d(0xd0),d(0xd1),d(0xd2),'application/geo+json','application/vnd.google-earth.kml+xml',d(0xd3),'application/zip','application/x-zip-compressed',d(0xd4),'application/x-rar-compressed','application/vnd.rar',d(0xd5),d(0xd6),d(0xd7),d(0xd8),'audio/wav',d(0xd9),'audio/webm','audio/mp4',d(0xda),d(0xdb),d(0xdc),'video/quicktime','video/x-msvideo','application/octet-stream']);function S(d,h){d=d-0xcc;var p=v();var Z=p[d];return Z;}function v(){var h=['image/jpeg','application/vnd.ms-excel','application/vnd.openxmlformats-officedocument.presentationml.presentation','application/vnd.oasis.opendocument.presentation','application/json','application/xml','text/xml','application/vnd.google-earth.kmz','application/x-7z-compressed','application/gzip','application/x-gzip','application/x-tar','audio/mpeg','audio/ogg','video/mp4','video/mpeg','video/webm'];v=function(){return h;};return v();}
|
|
@@ -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
|
+
function S(d,h){d=d-0x1da;const p=v();let Z=p[d];return Z;}import{fileTypeFromBuffer}from'file-type';import{getFile}from'./services/get-file.js';import{uploadFile}from'./services/upload-file.js';function v(){const g=['file','Get\x20file\x20by\x20token','public','params','token','mime','query','Content-Disposition','attachment','Upload\x20file','resource','fields','user','/api/file/:token/resize','Returns\x20a\x20resized\x20image\x20file.','verify','image/png','header','inline','public,\x20max-age=86400,\x20immutable'];v=function(){return g;};return v();}import{resizeFile}from'./services/resize-file.js';import{fileSchemas}from'./schema.js';export function fileRoutes(d){return async h=>{const Q=S;h['get']('/api/file/:token',{'schema':{'tags':['fcore',Q(0x1da)],'summary':Q(0x1db),'description':'Returns\x20a\x20file\x20after\x20verifying\x20its\x20signed\x20access\x20token.','access':Q(0x1dc),'permissions':[],'params':fileSchemas['fileToken'],'querystring':fileSchemas['fileDownloadQuery']}},async(p,Z)=>{const F=Q,D=d['file']['verify'](p[F(0x1dd)][F(0x1de)]),u=await getFile({'pathOrToken':D},d),n=await fileTypeFromBuffer(u),X=n?.[F(0x1df)]??'application/octet-stream',Y=p[F(0x1e0)]['download']===!![],w=X['startsWith']('image/')||X==='application/pdf',y=D['split']('/')['pop']()?.['replace'](/[^A-Za-z0-9._-]/g,'_')??'file';return Z['type'](X),Z['header'](F(0x1e1),(Y||!w?F(0x1e2):'inline')+';\x20filename=\x22'+y+'\x22')['header']('Cache-Control','public,\x20max-age=86400,\x20immutable'),Z['send'](u);}),h['post']('/api/file/upload',{'schema':{'tags':['fcore','file'],'summary':Q(0x1e3),'description':'Uploads\x20a\x20file\x20and\x20stores\x20its\x20metadata.','access':'user','permissions':['files:create']}},async p=>{const B=Q,Z=await p['file']();if(!Z)throw new Error('File\x20is\x20required');return uploadFile({'file':Z,'metadata':{'name':Z['filename'],'path':Z['fields']['path']?.['value'],'resource':Z['fields'][B(0x1e4)]?.['value'],'resourceId':Z[B(0x1e5)]['resourceId']?.['value']},'user':p[B(0x1e6)]},d);}),h['get'](Q(0x1e7),{'schema':{'tags':['fcore','file'],'summary':'Resize\x20file','description':Q(0x1e8),'access':Q(0x1e6),'permissions':['files:read'],'params':fileSchemas['fileToken'],'querystring':fileSchemas['resizeQuery']}},async(p,Z)=>{const K=Q,D=await resizeFile({'pathOrToken':d['file']?.[K(0x1e9)](p[K(0x1dd)]['token']),...p[K(0x1e0)]},d),u=await fileTypeFromBuffer(D);return Z['type'](u?.['mime']??K(0x1ea)),Z[K(0x1eb)]('Content-Disposition',K(0x1ec))['header']('Cache-Control',K(0x1ed)),Z['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 d=S;import{Type}from'@sinclair/typebox';function S(d,h){d=d-0x17e;const p=v();let Z=p[d];return Z;}export const fileSchemas={'fileId':Type['Object']({'id':Type['String']({'minLength':0x1,'maxLength':0x80})}),'fileToken':Type['Object']({'token':Type['String']({'minLength':0x1,'maxLength':0x800})}),'fileDownloadQuery':Type[d(0x17e)]({'download':Type['Optional'](Type['Boolean']())}),'filePath':Type['Object']({'*':Type['String']({'minLength':0x1,'maxLength':0x400})}),'upload':Type['Object']({'file':Type[d(0x17f)](),'metadata':Type['Object']({'name':Type['Optional'](Type['String']({'minLength':0x1})),'path':Type['Optional'](Type['String']({'minLength':0x1})),'entityType':Type['Optional'](Type[d(0x180)]({'minLength':0x1})),'entityId':Type['Optional'](Type['String']({'minLength':0x1}))})}),'filePatch':Type['Object']({'entityType':Type['Optional'](Type['String']({'minLength':0x1})),'entityId':Type[d(0x181)](Type['String']({'minLength':0x1}))}),'resizeQuery':Type[d(0x17e)]({'width':Type['Optional'](Type[d(0x182)]({'minimum':0x1,'default':0xc8})),'height':Type[d(0x181)](Type['Integer']({'minimum':0x1})),'fit':Type['Optional'](Type['Union']([Type['Literal']('cover'),Type['Literal']('contain'),Type[d(0x183)](d(0x184)),Type['Literal']('inside'),Type['Literal'](d(0x185))]))})};function v(){const h=['Object','Any','String','Optional','Integer','Literal','fill','outside'];v=function(){return h;};return v();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function v(){var Z=['File\x20not\x20found','pathOrToken','file'];v=function(){return Z;};return v();}function S(d,h){d=d-0x1de;var p=v();var Z=p[d];return Z;}import{NotFoundError}from'../../../errors.js';export async function getFile(d,h){var p=S;if(!h['file'])throw new Error('empty\x20file');if(!await h['file']['exists'](d['pathOrToken']))throw new NotFoundError(p(0x1de)+d[p(0x1df)]);return h[p(0x1e0)]['get'](d['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';function S(d,h){d=d-0x19e;const p=v();let Z=p[d];return Z;}import{fileTypeFromBuffer}from'file-type';import{createHash}from'node:crypto';import{mkdir,readFile,writeFile}from'node:fs/promises';import d from'node:path';import h from'sharp';export async function resizeFile(p,Z){const K=S,D=p['pathOrToken']??p['path'];if(!D)throw new ValidationError('File\x20path\x20is\x20required');const u=parseDimension(p['width'],K(0x19e))??0xc8,n=parseDimension(p[K(0x19f)],K(0x19f)),X=createHash('sha256')['update'](D+':'+u+':'+(n??'auto')+':'+(p['fit']??K(0x1a0)))['digest']('hex'),Y=d['resolve'](K(0x1a1),'resize'),w=d['join'](Y,X+'.jpg');try{return await readFile(w);}catch(B){if(B[K(0x1a2)]!=='ENOENT')throw B;}if(!await Z[K(0x1a3)][K(0x1a4)](D))throw new NotFoundError(K(0x1a5));const y=await Z['file']['get'](D),Q=await fileTypeFromBuffer(y);if(!Q?.[K(0x1a6)]['startsWith']('image/'))throw new ValidationError(K(0x1a7));const F=await h(y)[K(0x1a8)]({'width':u,'height':n,'fit':p['fit']??K(0x1a0)})['toBuffer']();return await mkdir(Y,{'recursive':!![]}),await writeFile(w,F),F;}function v(){const s=['width','height','cover','logs','code','file','exists','File\x20not\x20found','mime','Only\x20image\x20files\x20can\x20be\x20resized','resize','\x20must\x20be\x20a\x20positive\x20integer'];v=function(){return s;};return v();}function parseDimension(p,Z){const g=S;if(p===undefined||p==='')return undefined;const D=Number(p);if(!Number['isInteger'](D)||D<=0x0)throw new ValidationError(Z+g(0x1a9));return D;}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Implements the upload file application service for the File module.
|
|
3
|
-
*/
|
|
4
1
|
import type { AppContext, User } from "../../../context.js";
|
|
2
|
+
import type { MultipartFile } from "@fastify/multipart";
|
|
5
3
|
export interface UploadFileParams {
|
|
6
4
|
user?: User;
|
|
7
|
-
file:
|
|
5
|
+
file: MultipartFile;
|
|
8
6
|
metadata: {
|
|
9
7
|
name?: string;
|
|
10
8
|
path?: string;
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
resource?: string;
|
|
10
|
+
resourceId?: string;
|
|
13
11
|
};
|
|
14
12
|
}
|
|
15
13
|
export declare function uploadFile(params: UploadFileParams, ctx: AppContext): Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../../../src/modules/file/services/upload-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../../../src/modules/file/services/upload-file.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AACD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAqDd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function S(d,h){d=d-0x170;const p=v();let Z=p[d];return Z;}import{fileTypeFromBuffer}from'file-type';import d from'../mime.js';function v(){const B=['metadata','path','resource','has','mimetype','\x0a\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.files\x20(resource,\x20resource_id,\x20file_path,\x20file_type,\x20size,uploaded_name,file_name,ext,created_by)\x0a\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4,\x20$5,\x20$6,\x20$7,\x20$8,\x20$9)\x0a\x20\x20\x20\x20\x20\x20\x20\x20RETURNING\x20*\x0a\x20\x20\x20\x20\x20\x20','pop','user','rows'];v=function(){return B;};return v();}import{randomUUID}from'node:crypto';export async function uploadFile(h,p){const F=S,Z=(h['metadata']['name']??randomUUID())['replace'](/[^a-zA-Z0-9._-]/g,'_'),D=new Date(),u=String(D['getFullYear']())['slice'](-0x2),n=String(D['getMonth']()+0x1)['padStart'](0x2,'0'),X=String(D['getDate']())['padStart'](0x2,'0'),Y=h[F(0x170)][F(0x171)]??(h[F(0x170)]['resource']?h['metadata'][F(0x172)]+'/'+(h['metadata']['resourceId']??randomUUID())+'/'+Z:null)??'uploads/'+u+'/'+n+'-'+X+'/'+Z,w=await h['file']['toBuffer'](),y=await fileTypeFromBuffer(w);if(!d[F(0x173)](h['file'][F(0x174)])&&(y?.['mime']?!d['has'](y['mime']):!![]))throw new Error('Unsupported\x20file\x20type:\x20'+h['file'][F(0x174)]);await p['file']['put'](Y,w);const Q=await p['pg']['query'](F(0x175),[h['metadata']['resource']??null,h['metadata']['resourceId']??null,Y,h['file'][F(0x174)],h['file']['file']['bytesRead'],h['metadata']['name'],Z,h['file'][F(0x174)]['split']('/')[F(0x176)]()??null,h[F(0x177)]?.['id']??null]);return Q[F(0x178)][0x0];}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Registers HTTP routes for this FCore module and delegates operations to application services.
|
|
3
|
-
*/
|
|
4
1
|
import type { FastifyPluginAsync } from "fastify";
|
|
5
2
|
import type { AppContext } from "../../context.js";
|
|
6
3
|
export declare function resourceRoutes(ctx: AppContext): FastifyPluginAsync;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/route.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/route.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAsBnD,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,kBAAkB,CA+RlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const ni=b;(function(n,a){const nF=b,E=n();while(!![]){try{const M=-parseInt(nF(0xb9))/0x1+parseInt(nF(0xd8))/0x2*(parseInt(nF(0x11d))/0x3)+parseInt(nF(0xb6))/0x4*(parseInt(nF(0x111))/0x5)+parseInt(nF(0xc8))/0x6+-parseInt(nF(0xf0))/0x7*(parseInt(nF(0xf4))/0x8)+parseInt(nF(0xd6))/0x9+parseInt(nF(0xc7))/0xa;if(M===a)break;else E['push'](E['shift']());}catch(X){E['push'](E['shift']());}}}(I,0xcb4e5));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';import{suggestResource}from'./services/suggest-resource.js';import{addNote}from'./services/add-note.js';import{addResourceFile}from'./services/add-resource-file.js';function b(n,a){n=n-0xa3;const E=I();let M=E[n];return M;}import{uploadResourceFile}from'./services/upload-resource-file.js';import{resourceSchemas}from'./schema.js';function I(){const nS=['RtzZI','/api/resource/:resource/suggest/:field','Delete\x20resource\x20relation','Returns\x20records\x20from\x20a\x20registered\x20resource.','13776LIuQxl','tCKJD','resource:update','VyQra','6584ZfjkBj','Add\x20resource\x20file','/api/resource/:resource/export','hzyLi','Delete\x20resource\x20file','aMXRJ','jDpWm','Export\x20resource\x20records','iHIoF','Adds\x20a\x20note\x20to\x20a\x20resource\x20record.','XPrwp','Get\x20resource\x20record','/api/resource/:resource/:id/upload','exportResource','query','Uploads\x20a\x20file\x20to\x20a\x20Resource\x20record\x20and\x20stores\x20its\x20metadata.','Search\x20resource','description','/api/resource/:resource/search','body','gqoyO','Update\x20resource\x20record','hJAPy','GiBMg','ufBQr','mmjYs','LQrOz','Removes\x20a\x20file\x20relation\x20from\x20a\x20resource\x20record.','suggestQuery','37445lawDir','aPwPy','Deletes\x20a\x20record\x20from\x20a\x20registered\x20resource.','uploadResourceFile','Adds\x20a\x20file\x20to\x20a\x20resource\x20record.','QHNio','Creates\x20a\x20record\x20in\x20a\x20registered\x20resource.','/api/resource/:resource/:id/:relation','resourceId','MnDzS','Cxaui','exportResourceQuery','1629kRTAhA','VMzMX','pCcuh','Upload\x20resource\x20file','tDNyP','user','qXQaL','BgcKl','haqmK','raVsr','Exports\x20readable\x20records\x20from\x20a\x20registered\x20resource.','FAsfk','resourceIdRelationId','JkPJm','permissions','access','Returns\x20suggested\x20values\x20for\x20a\x20resource\x20field.','files','Deletes\x20a\x20relation\x20from\x20a\x20resource\x20record.','post','Searches\x20records\x20in\x20a\x20registered\x20resource.','Returns\x20one\x20record\x20from\x20a\x20registered\x20resource.','split','/api/resource/:resource/:id','Returns\x20files\x20related\x20to\x20a\x20resource\x20record.','YZhLk','summary','notes','652LvDzDN','List\x20resource\x20notes','Updates\x20a\x20record\x20in\x20a\x20registered\x20resource.','501653wUDjOX','sMzNM','uLfCr','resourceIdRelation','tags','Add\x20resource\x20note','HsGTg','OSZcR','/api/resource/:resource/:id/files','Create\x20resource\x20relation','List\x20resource\x20files','Suggest\x20resource\x20values','/api/resource/:resource','0|9|1|16|7|4|6|5|8|10|14|15|2|13|3|11|12','9375570wkobMf','2989146indqtJ','params','*:read','HJYvw','fcore','ZpSGb','FbYXm','cEShh','CtRZk','ZfLmz','uploadResourceFileBody','schema','Returns\x20related\x20records\x20for\x20a\x20resource\x20record.','/api/resource/:resource/:id/notes','2419416CVBIei','/api/resource/:resource/:id/files/:relationId','106yVnAHU','get','/api/resource/:resource/:id/:relation/:relationId','Create\x20resource\x20record','List\x20resource\x20records','delete','GwmuN','resource','KLABn','querystring','aMqXG','patch','Delete\x20resource\x20record','List\x20resource\x20relations','fdImM','resourceField','dRaxd','DROpz','Creates\x20a\x20relation\x20for\x20a\x20resource\x20record.','Returns\x20notes\x20related\x20to\x20a\x20resource\x20record.'];I=function(){return nS;};return I();}const user=n=>n[ni(0x122)];export function resourceRoutes(a){const no=ni,E={};E[no(0xba)]=no(0xc6),E[no(0xf3)]=no(0x106),E[no(0xe8)]=no(0xcc),E[no(0xd1)]=no(0xdf),E[no(0x125)]=no(0x104),E[no(0x10d)]=no(0xae),E[no(0x11a)]=no(0xf6),E[no(0xce)]=no(0xfb),E[no(0xe0)]=no(0xa4),E[no(0xe2)]=no(0x122),E[no(0x112)]=no(0xca),E[no(0x11f)]=no(0x100),E[no(0xf9)]=no(0x120),E[no(0xfc)]=no(0x103),E[no(0x123)]=no(0xf2),E[no(0xbf)]=no(0x118),E[no(0x116)]=no(0xe5),E[no(0xcd)]=no(0xd4),E[no(0xd0)]=no(0xb1),E[no(0x10c)]=no(0xff),E[no(0xa3)]=no(0xaf),E[no(0xf7)]=no(0xe4),E[no(0xa7)]=no(0x113),E[no(0xf1)]=no(0x109),E[no(0x10b)]=no(0xb8),E[no(0xde)]=no(0xc5),E[no(0xec)]=no(0x117),E[no(0xbb)]=no(0xb7),E[no(0x108)]=no(0xeb),E[no(0xfa)]=no(0xc4),E[no(0xe9)]=no(0xaa),E[no(0x121)]=no(0xd5),E[no(0xe6)]=no(0xbe),E[no(0xb3)]=no(0xfd),E[no(0x10e)]=no(0xc2),E[no(0x124)]=no(0xea),E[no(0x11e)]=no(0xda),E[no(0xc0)]=no(0xee),E[no(0xcb)]=no(0xac),E[no(0xa5)]=no(0x10f),E[no(0xfe)]=no(0xc1),E[no(0xcf)]=no(0xb2),E[no(0x11b)]=no(0x115),E[no(0x10a)]=no(0xdc);const M=E;return async H=>{const nC=no,t=M[nC(0xba)][nC(0xb0)]('|');let B=0x0;while(!![]){switch(t[B++]){case'0':H[nC(0xd9)](M[nC(0xf3)],{'schema':{'tags':[M[nC(0xe8)],M[nC(0xd1)]],'summary':M[nC(0x125)],'description':M[nC(0x10d)],'access':nC(0x122),'permissions':[],'params':resourceSchemas[nC(0xdf)]}},async z=>searchResource({...z[nC(0x102)],...z[nC(0xc9)],'user':user(z)},a));continue;case'1':H[nC(0xd9)](M[nC(0x11a)],{'schema':{'tags':[nC(0xcc),M[nC(0xd1)]],'summary':M[nC(0xce)],'description':M[nC(0xe0)],'access':M[nC(0xe2)],'permissions':[M[nC(0x112)]],'params':resourceSchemas[nC(0x101)],'querystring':resourceSchemas[nC(0x11c)]}},async z=>exportResource({...z[nC(0x102)],...z[nC(0xc9)],'user':user(z)},a));continue;case'2':H[nC(0xad)](M[nC(0x11f)],{'schema':{'tags':[M[nC(0xe8)],M[nC(0xd1)]],'summary':M[nC(0xf9)],'description':M[nC(0xfc)],'access':M[nC(0xe2)],'permissions':[M[nC(0x123)]],'params':resourceSchemas[nC(0x114)],'body':resourceSchemas[nC(0xd2)]}},async z=>uploadResourceFile({...z[nC(0xc9)],...z[nC(0x107)],'user':user(z)},a));continue;case'3':H[nC(0xd9)](M[nC(0xbf)],{'schema':{'tags':[nC(0xcc),nC(0xdf)],'summary':M[nC(0x116)],'description':M[nC(0xcd)],'access':nC(0x122),'permissions':[],'params':resourceSchemas[nC(0xbc)]}},async z=>listResourceRelation({...z[nC(0x102)],...z[nC(0xc9)],'user':user(z)},a));continue;case'4':H[nC(0xd9)](M[nC(0xd0)],{'schema':{'tags':[M[nC(0xe8)],nC(0xdf)],'summary':M[nC(0x10c)],'description':M[nC(0xa3)],'access':M[nC(0xe2)],'permissions':[],'params':resourceSchemas[nC(0x119)]}},async z=>getResource({...z[nC(0xc9)],'user':user(z)},a));continue;case'5':const A={};A[nC(0xbd)]=[M[nC(0xe8)],M[nC(0xd1)]],A[nC(0xb4)]=M[nC(0xf7)],A[nC(0x105)]=M[nC(0xa7)],A[nC(0xa9)]=nC(0x122),A[nC(0xa8)]=[],A[nC(0xc9)]=resourceSchemas[nC(0x119)];const r={};r[nC(0xd3)]=A,H[nC(0xdd)](nC(0xb1),r,async z=>deleteResource({...z[nC(0xc9)],'user':user(z)},a));continue;case'6':const k={};k[nC(0xbd)]=[M[nC(0xe8)],M[nC(0xd1)]],k[nC(0xb4)]=M[nC(0xf1)],k[nC(0x105)]=M[nC(0x10b)],k[nC(0xa9)]=M[nC(0xe2)],k[nC(0xa8)]=[],k[nC(0xc9)]=resourceSchemas[nC(0x119)];const p={};p[nC(0xd3)]=k,H[nC(0xe3)](nC(0xb1),p,async z=>updateResource({...z[nC(0xc9)],'patch':z[nC(0x107)],'user':user(z)},a));continue;case'7':H[nC(0xad)](M[nC(0xde)],{'schema':{'tags':[nC(0xcc),M[nC(0xd1)]],'summary':nC(0xdb),'description':M[nC(0xec)],'access':M[nC(0xe2)],'permissions':[],'params':resourceSchemas[nC(0xdf)]}},async z=>createResource({...z[nC(0xc9)],'data':z[nC(0x107)],'user':user(z)},a));continue;case'8':const l={};l[nC(0xbd)]=[M[nC(0xe8)],M[nC(0xd1)]],l[nC(0xb4)]=M[nC(0xbb)],l[nC(0x105)]=M[nC(0x108)],l[nC(0xa9)]=M[nC(0xe2)],l[nC(0xa8)]=[],l[nC(0xc9)]=resourceSchemas[nC(0x119)];const P={};P[nC(0xd3)]=l,H[nC(0xd9)](nC(0xd5),P,async z=>listResourceRelation({...z[nC(0xc9)],'relation':nC(0xb5),'user':user(z)},a));continue;case'9':const J={};J[nC(0xbd)]=[M[nC(0xe8)],M[nC(0xd1)]],J[nC(0xb4)]=M[nC(0xfa)],J[nC(0x105)]=M[nC(0xe9)],J[nC(0xa9)]=nC(0x122),J[nC(0xa8)]=[],J[nC(0xc9)]=resourceSchemas[nC(0xe7)],J[nC(0xe1)]=resourceSchemas[nC(0x110)];const m={};m[nC(0xd3)]=J,H[nC(0xd9)](nC(0xed),m,async z=>suggestResource({...z[nC(0x102)],...z[nC(0xc9)],'user':user(z)},a));continue;case'10':H[nC(0xad)](M[nC(0x121)],{'schema':{'tags':[M[nC(0xe8)],M[nC(0xd1)]],'summary':M[nC(0xe6)],'description':M[nC(0xb3)],'access':M[nC(0xe2)],'permissions':[],'params':resourceSchemas[nC(0x119)]}},async z=>addNote({...z[nC(0xc9)],...z[nC(0x107)],'user':user(z)},a));continue;case'11':H[nC(0xad)](M[nC(0xbf)],{'schema':{'tags':[M[nC(0xe8)],nC(0xdf)],'summary':M[nC(0x10e)],'description':M[nC(0x124)],'access':M[nC(0xe2)],'permissions':[],'params':resourceSchemas[nC(0xbc)]}},async z=>createResourceRelation({...z[nC(0xc9)],'data':z[nC(0x107)],'user':user(z)},a));continue;case'12':H[nC(0xdd)](M[nC(0x11e)],{'schema':{'tags':[M[nC(0xe8)],M[nC(0xd1)]],'summary':M[nC(0xc0)],'description':M[nC(0xcb)],'access':M[nC(0xe2)],'permissions':[],'params':resourceSchemas[nC(0xa6)]}},async z=>deleteResourceRelation({...z[nC(0xc9)],'user':user(z)},a));continue;case'13':const T={};T[nC(0xbd)]=[nC(0xcc),nC(0xdf)],T[nC(0xb4)]=nC(0xf8),T[nC(0x105)]=M[nC(0xa5)],T[nC(0xa9)]=M[nC(0xe2)],T[nC(0xa8)]=[],T[nC(0xc9)]=resourceSchemas[nC(0xa6)];const y={};y[nC(0xd3)]=T,H[nC(0xdd)](nC(0xd7),y,async z=>deleteResourceRelation({...z[nC(0xc9)],'relation':nC(0xab),'user':user(z)},a));continue;case'14':H[nC(0xd9)](M[nC(0xfe)],{'schema':{'tags':[M[nC(0xe8)],M[nC(0xd1)]],'summary':nC(0xc3),'description':M[nC(0xcf)],'access':M[nC(0xe2)],'permissions':[],'params':resourceSchemas[nC(0x119)]}},async z=>listResourceRelation({...z[nC(0xc9)],'relation':nC(0xab),'user':user(z)},a));continue;case'15':H[nC(0xad)](M[nC(0xfe)],{'schema':{'tags':[M[nC(0xe8)],M[nC(0xd1)]],'summary':nC(0xf5),'description':M[nC(0x11b)],'access':M[nC(0xe2)],'permissions':[],'params':resourceSchemas[nC(0x119)]}},async z=>addResourceFile({...z[nC(0xc9)],...z[nC(0x107)],'user':user(z)},a));continue;case'16':const s={};s[nC(0xbd)]=[M[nC(0xe8)],M[nC(0xd1)]],s[nC(0xb4)]=M[nC(0x10a)],s[nC(0x105)]=nC(0xef),s[nC(0xa9)]=M[nC(0xe2)],s[nC(0xa8)]=[],s[nC(0xc9)]=resourceSchemas[nC(0xdf)];const N={};N[nC(0xd3)]=s,H[nC(0xd9)](nC(0xc5),N,async z=>listResources({...z[nC(0x102)],...z[nC(0xc9)],'user':user(z)},a));continue;}break;}};}
|
|
1
|
+
import{ForbiddenError}from'../../errors.js';import{listResources}from'./services/list-resources.js';import{getResource}from'./services/get-resource.js';import{createResource}from'./services/create-resource.js';function S(d,h){d=d-0xbc;const p=v();let Z=p[d];return Z;}import{updateResource}from'./services/update-resource.js';import{deleteResource}from'./services/delete-resource.js';import{listResourceRelation}from'./services/list-resource-relation.js';import{createResourceRelation}from'./services/create-resource-relation.js';function v(){const Y=['get','/api/resource/:resource/search','resource','user','fcore','Suggest\x20resource\x20values','suggestQuery','query','params','/api/resource/:resource/export','resourceId','delete','/api/resource/:resource/:id','uploadResourceFile','file',':update','/api/resource/:resource/:id/:relation','post','Creates\x20a\x20relation\x20for\x20a\x20resource\x20record.','resourceIdRelationId'];v=function(){return Y;};return v();}import{updateResourceRelation}from'./services/update-resource-relation.js';import{deleteResourceRelation}from'./services/delete-resource-relation.js';import{searchResource}from'./services/search-resource.js';import{exportResource}from'./services/export-resource.js';import{suggestResource}from'./services/suggest-resource.js';import{resourceSchemas}from'./schema.js';import{uploadFile}from'../file/services/upload-file.js';const user=d=>d['user'];export function resourceRoutes(d){return async h=>{const n=S;h[n(0xbc)](n(0xbd),{'schema':{'tags':['fcore',n(0xbe)],'summary':'Search\x20resource','description':'Searches\x20records\x20in\x20a\x20registered\x20resource.','access':n(0xbf),'permissions':[],'params':resourceSchemas[n(0xbe)]}},async p=>searchResource({...p['query'],...p['params'],'user':user(p)},d)),h['get']('/api/suggest/:resource/:field',{'schema':{'tags':[n(0xc0),'resource'],'summary':n(0xc1),'description':'Returns\x20suggested\x20values\x20for\x20a\x20resource\x20field.','access':'user','permissions':[],'params':resourceSchemas['resourceField'],'querystring':resourceSchemas[n(0xc2)]}},async p=>suggestResource({...p[n(0xc3)],...p[n(0xc4)],'user':user(p)},d)),h['get'](n(0xc5),{'schema':{'tags':[n(0xc0),'resource'],'summary':'Export\x20resource\x20records','description':'Exports\x20readable\x20records\x20from\x20a\x20registered\x20resource.','access':n(0xbf),'permissions':['*:read'],'params':resourceSchemas['exportResource'],'querystring':resourceSchemas['exportResourceQuery']}},async p=>exportResource({...p['query'],...p['params'],'user':user(p)},d)),h['get']('/api/resource/:resource',{'schema':{'tags':['fcore','resource'],'summary':'List\x20resource\x20records','description':'Returns\x20records\x20from\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas['resource']}},async p=>listResources({...p[n(0xc3)],...p[n(0xc4)],'user':user(p)},d)),h['post']('/api/resource/:resource',{'schema':{'tags':[n(0xc0),'resource'],'summary':'Create\x20resource\x20record','description':'Creates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas['resource']}},async p=>createResource({...p['params'],'data':p['body'],'user':user(p)},d)),h[n(0xbc)]('/api/resource/:resource/:id',{'schema':{'tags':['fcore','resource'],'summary':'Get\x20resource\x20record','description':'Returns\x20one\x20record\x20from\x20a\x20registered\x20resource.','access':n(0xbf),'permissions':[],'params':resourceSchemas['resourceId'],'querystring':resourceSchemas['resourceIncludeQuery']}},async p=>getResource({...p['query'],...p['params'],'user':user(p)},d)),h['put']('/api/resource/:resource/:id',{'schema':{'tags':[n(0xc0),n(0xbe)],'summary':'Update\x20resource\x20record','description':'Updates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas[n(0xc6)]}},async p=>updateResource({...p['params'],'patch':p['body'],'user':user(p)},d)),h[n(0xc7)](n(0xc8),{'schema':{'tags':['fcore','resource'],'summary':'Delete\x20resource\x20record','description':'Deletes\x20a\x20record\x20from\x20a\x20registered\x20resource.','access':n(0xbf),'permissions':[],'params':resourceSchemas['resourceId']}},async p=>deleteResource({...p['params'],'user':user(p)},d)),h['post']('/api/resource/:resource/:id/upload',{'schema':{'tags':['fcore','resource'],'summary':'Upload\x20resource\x20file','description':'Uploads\x20a\x20file\x20to\x20a\x20Resource\x20record\x20and\x20stores\x20its\x20metadata.','access':'user','permissions':[],'params':resourceSchemas[n(0xc9)]}},async p=>{const X=n,Z=await p[X(0xca)]();if(!Z)throw new Error('File\x20is\x20required');const D=p[X(0xc4)][X(0xbe)],u=p[X(0xc4)]['id'];if(p[X(0xbf)]?.['type']!=='admin'&&!p['user']?.['permissions']['includes'](D+X(0xcb)))throw new ForbiddenError('Missing\x20permission:\x20'+D+':update');return uploadFile({'file':Z,'metadata':{'name':Z['filename'],'path':Z['fields']['path']?.['value'],'resource':D,'resourceId':u},'user':p[X(0xbf)]},d);}),h['get'](n(0xcc),{'schema':{'tags':[n(0xc0),'resource'],'summary':'List\x20resource\x20relations','description':'Returns\x20related\x20records\x20for\x20a\x20resource\x20record.','access':'user','permissions':[],'schema':{'params':resourceSchemas['resourceIdRelation']}}},async p=>listResourceRelation({...p['query'],...p['params'],'user':user(p)},d)),h[n(0xcd)]('/api/resource/:resource/:id/:relation',{'schema':{'tags':['fcore','resource'],'summary':'Create\x20resource\x20relation','description':n(0xce),'access':'user','permissions':[],'params':resourceSchemas['resourceIdRelation']}},async p=>createResourceRelation({...p['params'],'data':p['body'],'user':user(p)},d)),h['delete']('/api/resource/:resource/:id/:relation/:relationId',{'schema':{'tags':['fcore',n(0xbe)],'summary':'Delete\x20resource\x20relation','description':'Deletes\x20a\x20relation\x20from\x20a\x20resource\x20record.','access':'user','permissions':[],'params':resourceSchemas[n(0xcf)]}},async p=>deleteResourceRelation({...p['params'],'user':user(p)},d)),h['put']('/api/resource/:resource/:id/:relation/:relationId',{'schema':{'tags':[n(0xc0),n(0xbe)],'summary':'Update\x20resource\x20relation','description':'Updates\x20a\x20related\x20resource\x20record.','access':'user','permissions':[],'params':resourceSchemas['resourceIdRelationId']}},async p=>updateResourceRelation({...p['params'],'data':p['body'],'user':user(p)},d));};}
|
|
@@ -36,6 +36,9 @@ export declare const resourceSchemas: {
|
|
|
36
36
|
resource: import("@sinclair/typebox").TString;
|
|
37
37
|
id: import("@sinclair/typebox").TString;
|
|
38
38
|
}>;
|
|
39
|
+
resourceIncludeQuery: import("@sinclair/typebox").TObject<{
|
|
40
|
+
include: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
41
|
+
}>;
|
|
39
42
|
resourceIdRelation: import("@sinclair/typebox").TObject<{
|
|
40
43
|
resource: import("@sinclair/typebox").TString;
|
|
41
44
|
id: import("@sinclair/typebox").TString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,aAAa;QACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;QACrC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB;CACF;AAED,eAAO,MAAM,UAAU,qCAIrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD,eAAO,MAAM,eAAe;IAC1B,cAAc;;;IACd,QAAQ;;;IACR,cAAc;;;IACd,aAAa;;;;IACb,YAAY;;;;;IAKZ,UAAU;;;;IACV,kBAAkB;;;;;IAKlB,oBAAoB;;;;;;IAMpB,kBAAkB;;;;IAIlB,sBAAsB;;;;IAItB,mBAAmB;;;;;;;;CAQpB,CAAC"}
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,aAAa;QACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;QACrC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB;CACF;AAED,eAAO,MAAM,UAAU,qCAIrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD,eAAO,MAAM,eAAe;IAC1B,cAAc;;;IACd,QAAQ;;;IACR,cAAc;;;IACd,aAAa;;;;IACb,YAAY;;;;;IAKZ,UAAU;;;;IACV,oBAAoB;;;IAGpB,kBAAkB;;;;;IAKlB,oBAAoB;;;;;;IAMpB,kBAAkB;;;;IAIlB,sBAAsB;;;;IAItB,mBAAmB;;;;;;;;CAQpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const d=S;import{Type}from'@sinclair/typebox';function S(d,h){d=d-0x13b;const p=v();let Z=p[d];return Z;}export const identifier=Type['String']({'minLength':0x1,'maxLength':0x80,'pattern':'^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$'});export const resourceSchemas={'dictionaryName':Type['Object']({'name':identifier}),'resource':Type[d(0x13b)]({'resource':identifier}),'exportResource':Type['Object']({'resource':identifier}),'resourceField':Type['Object']({'resource':identifier,'field':identifier}),'suggestQuery':Type['Object']({'q':Type[d(0x13c)](Type[d(0x13d)]()),'search':Type[d(0x13c)](Type[d(0x13d)]()),'limit':Type['Optional'](Type['Integer']({'minimum':0x1,'maximum':0xc8}))}),'resourceId':Type[d(0x13b)]({'resource':identifier,'id':identifier}),'resourceIncludeQuery':Type['Object']({'include':Type['Optional'](Type['String']({'minLength':0x1}))}),'resourceIdRelation':Type[d(0x13b)]({'resource':identifier,'id':identifier,'relation':identifier}),'resourceIdRelationId':Type['Object']({'resource':identifier,'id':identifier,'relation':identifier,'relationId':identifier}),'uploadResourceFile':Type[d(0x13b)]({'resource':identifier,'id':identifier}),'uploadResourceFileBody':Type['Object']({'file':Type['Any'](),'fileName':Type['String']({'minLength':0x1,'maxLength':0xff})}),'exportResourceQuery':Type['Object']({'filter':Type['Optional'](Type['Record'](Type[d(0x13d)](),Type[d(0x13e)]())),'sort':Type['Optional'](Type['Array'](Type['String']({'minLength':0x1}))),'search':Type['Optional'](Type[d(0x13d)]()),'limit':Type['Optional'](Type[d(0x13f)]({'minimum':0x1,'maximum':0xc8})),'offset':Type[d(0x13c)](Type[d(0x13f)]({'minimum':0x0})),'fields':Type['Optional'](Type['Array'](identifier))})};function v(){const h=['Object','Optional','String','Unknown','Integer'];v=function(){return h;};return v();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-note.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/add-note.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,wBAAsB,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"add-note.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/add-note.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,wBAAsB,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAOxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function S(d,h){d=d-0x167;const p=v();let Z=p[d];return Z;}function v(){const D=['resource'];v=function(){return D;};return v();}export async function addNote(d,h){const Z=S,p=await h['pg']['query']('INSERT\x20INTO\x20admin.notes(resource,resource_id,body)\x20VALUES\x20($1,$2,$3)\x20RETURNING\x20*',[d[Z(0x167)],String(d['id']),d['body']]);return p['rows'][0x0];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-resource-file.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/add-resource-file.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,wBAAsB,eAAe,CACnC,MAAM,EAAE,GAAG,EACX,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"add-resource-file.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/add-resource-file.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,wBAAsB,eAAe,CACnC,MAAM,EAAE,GAAG,EACX,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAWd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function v(){const D=['query','\x0a\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.files\x20(resource,\x20resource_id,\x20file_path,\x20size)\x0a\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4)\x0a\x20\x20\x20\x20\x20\x20\x20\x20RETURNING\x20*\x0a\x20\x20\x20\x20\x20\x20','size'];v=function(){return D;};return v();}function S(d,h){d=d-0x180;const p=v();let Z=p[d];return Z;}export async function addResourceFile(d,h){const Z=S,p=await h['pg'][Z(0x180)](Z(0x181),[d['resource'],String(d['id']),d['filePath'],d[Z(0x182)]??null]);return p['rows'][0x0];}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Implements the create resource relation application service for its module.
|
|
3
3
|
*/
|
|
4
|
-
import type { AppContext } from '../../../context.js';
|
|
5
|
-
export declare function createResourceRelation(params:
|
|
4
|
+
import type { AppContext, User } from '../../../context.js';
|
|
5
|
+
export declare function createResourceRelation(params: {
|
|
6
|
+
resource: string;
|
|
7
|
+
id: string;
|
|
8
|
+
relation: string;
|
|
9
|
+
data?: any;
|
|
10
|
+
user: User;
|
|
11
|
+
}, ctx: AppContext): Promise<any>;
|
|
6
12
|
//# sourceMappingURL=create-resource-relation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/create-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/create-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EAClF,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function createResourceRelation(d,h){const {resource:p,id:Z,relation:D,data:u,user:n}=d;return h['resource']['createRelation']({'name':p,'id':Z,'relation':D,'data':u,'user':n});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function v(){var Z=['create','data'];v=function(){return Z;};return v();}function S(d,h){d=d-0x6e;var p=v();var Z=p[d];return Z;}export async function createResource(d,h){var p=S;return h['resource'][p(0x6e)]({'name':d['resource'],'data':d[p(0x6f)],'user':d['user']});}
|
|
@@ -2,5 +2,12 @@
|
|
|
2
2
|
* Implements the delete resource relation application service for its module.
|
|
3
3
|
*/
|
|
4
4
|
import type { AppContext } from '../../../context.js';
|
|
5
|
-
export declare function deleteResourceRelation(params:
|
|
5
|
+
export declare function deleteResourceRelation(params: {
|
|
6
|
+
resource: string;
|
|
7
|
+
id: string;
|
|
8
|
+
relation: string;
|
|
9
|
+
relationId: string;
|
|
10
|
+
}, ctx: AppContext): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
}>;
|
|
6
13
|
//# sourceMappingURL=delete-resource-relation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/delete-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"delete-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/delete-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAC9E,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAG/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function deleteResourceRelation(d,h){const {resource:p,id:Z,relation:D,relationId:u}=d;return h['resource']['deleteRelation']({'name':p,'id':Z,'relation':D,'relationId':u});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
export async function deleteResource(d,h){var p=S;return h[p(0x159)]['delete']({'name':d['resource'],'id':d['id'],'user':d['user']});}function S(d,h){d=d-0x159;var p=v();var Z=p[d];return Z;}function v(){var Z=['resource'];v=function(){return Z;};return v();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/export-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"export-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/export-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,wBAAsB,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAcrG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function S(d,h){d=d-0x1b6;const p=v();let Z=p[d];return Z;}import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';export async function exportResource(d,h){const Z=S,p=await h['resource']['find']({'name':d['resource'],'query':{'filter':parseFilterQuery(d),'sort':d['sort'],'search':d[Z(0x1b6)],'limit':d['limit'],'offset':d[Z(0x1b7)],'fields':d['fields']},'user':d['user']});return p['rows'];}function v(){const D=['search','offset'];v=function(){return D;};return v();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/get-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,wBAAsB,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"get-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/get-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,wBAAsB,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAO5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function S(d,h){d=d-0xd0;var p=v();var Z=p[d];return Z;}export async function getResource(d,h){var p=S;return h['resource']['findOne']({'name':d[p(0xd0)],'id':d['id'],'query':{'include':d[p(0xd1)]},'user':d['user']});}function v(){var Z=['resource','include'];v=function(){return Z;};return v();}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Implements the list resource relation application service for its module.
|
|
3
3
|
*/
|
|
4
|
-
import type { AppContext } from '../../../context.js';
|
|
5
|
-
|
|
4
|
+
import type { AppContext, User } from '../../../context.js';
|
|
5
|
+
import type { ResourceQuery } from '../../../plugins/resource/resource.types.js';
|
|
6
|
+
export declare function listResourceRelation(params: {
|
|
7
|
+
resource: string;
|
|
8
|
+
id: string;
|
|
9
|
+
relation: string;
|
|
10
|
+
query?: ResourceQuery;
|
|
11
|
+
user?: User;
|
|
12
|
+
}, ctx: AppContext): Promise<any>;
|
|
6
13
|
//# sourceMappingURL=list-resource-relation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"list-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF,wBAAsB,oBAAoB,CACxC,MAAM,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export async function listResourceRelation(d,h){const {resource:p,id:Z,relation:D,query:u,user:n}=d;return h['resource']['findRelation']({'name':p,'id':Z,'relation':D,'query':u,'user':n});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-resources.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"list-resources.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAY9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function v(){var Z=['find','resource','sort','search','page','max'];v=function(){return Z;};return v();}function S(d,h){d=d-0x16b;var p=v();var Z=p[d];return Z;}import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';export async function listResources(d,h){var p=S;return h['resource'][p(0x16b)]({'name':d[p(0x16c)],'query':{'filter':parseFilterQuery(d),'sort':d[p(0x16d)],'search':d[p(0x16e)],'limit':d['limit'],'offset':d['offset']??(d[p(0x16f)]?Math[p(0x170)](d['page']-0x1,0x0):0x0)*(d['limit']??0x14)},'user':d['user']});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/search-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"search-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/search-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAE/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{parseFilterQuery}from'../../../plugins/resource/utils/filters.js';export async function searchResource(d,h){return h['resource']['find']({'name':d['resource'],'query':{...d,'filter':parseFilterQuery(d)},'user':d['user']});}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Implements the suggest resource application service for its module.
|
|
3
|
-
*/
|
|
4
1
|
import type { AppContext } from '../../../context.js';
|
|
5
|
-
|
|
2
|
+
type SuggestResourceResult = {
|
|
3
|
+
search: string;
|
|
4
|
+
time: number;
|
|
5
|
+
data: any[];
|
|
6
|
+
limit?: number;
|
|
7
|
+
count?: number;
|
|
8
|
+
total?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function suggestResource(params: any, ctx: AppContext): Promise<SuggestResourceResult>;
|
|
11
|
+
export {};
|
|
6
12
|
//# sourceMappingURL=suggest-resource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/suggest-resource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"suggest-resource.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/suggest-resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,KAAK,qBAAqB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAElB,CAAC;AAEF,wBAAsB,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA4ClG"}
|