@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.
Files changed (248) hide show
  1. package/LICENSE +3 -3
  2. package/README.md +71 -71
  3. package/dist/config.d.ts +2 -10
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/config.js +1 -1
  6. package/dist/context.js +1 -1
  7. package/dist/errors.js +1 -1
  8. package/dist/fastify.d.ts +5 -5
  9. package/dist/fastify.d.ts.map +1 -1
  10. package/dist/fastify.js +1 -1
  11. package/dist/fcore.js +1 -1
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/migrations/cli.js +1 -1
  16. package/dist/migrations/runner.js +1 -1
  17. package/dist/modules/auth/adduser-cli.d.ts +3 -0
  18. package/dist/modules/auth/adduser-cli.d.ts.map +1 -0
  19. package/dist/modules/auth/adduser-cli.js +2 -0
  20. package/dist/modules/auth/passwd-cli.d.ts +3 -0
  21. package/dist/modules/auth/passwd-cli.d.ts.map +1 -0
  22. package/dist/modules/auth/passwd-cli.js +2 -0
  23. package/dist/modules/auth/permission-cli.d.ts +3 -0
  24. package/dist/modules/auth/permission-cli.d.ts.map +1 -0
  25. package/dist/modules/auth/permission-cli.js +2 -0
  26. package/dist/modules/auth/route.d.ts.map +1 -1
  27. package/dist/modules/auth/route.js +1 -1
  28. package/dist/modules/auth/schema.d.ts +10 -1
  29. package/dist/modules/auth/schema.d.ts.map +1 -1
  30. package/dist/modules/auth/schema.js +1 -1
  31. package/dist/modules/auth/services/change-password.d.ts +9 -0
  32. package/dist/modules/auth/services/change-password.d.ts.map +1 -0
  33. package/dist/modules/auth/services/change-password.js +1 -0
  34. package/dist/modules/auth/services/get-current-user.d.ts +1 -0
  35. package/dist/modules/auth/services/get-current-user.d.ts.map +1 -1
  36. package/dist/modules/auth/services/get-current-user.js +1 -1
  37. package/dist/modules/auth/services/registration.d.ts +14 -0
  38. package/dist/modules/auth/services/registration.d.ts.map +1 -0
  39. package/dist/modules/auth/services/registration.js +1 -0
  40. package/dist/modules/auth/services/verify-two-factor.js +1 -1
  41. package/dist/modules/file/mime.d.ts +3 -0
  42. package/dist/modules/file/mime.d.ts.map +1 -0
  43. package/dist/modules/file/mime.js +1 -0
  44. package/dist/modules/file/route.d.ts.map +1 -1
  45. package/dist/modules/file/route.js +1 -1
  46. package/dist/modules/file/schema.d.ts +3 -0
  47. package/dist/modules/file/schema.d.ts.map +1 -1
  48. package/dist/modules/file/schema.js +1 -1
  49. package/dist/modules/file/services/get-file.js +1 -1
  50. package/dist/modules/file/services/resize-file.d.ts.map +1 -1
  51. package/dist/modules/file/services/resize-file.js +1 -1
  52. package/dist/modules/file/services/upload-file.d.ts +4 -6
  53. package/dist/modules/file/services/upload-file.d.ts.map +1 -1
  54. package/dist/modules/file/services/upload-file.js +1 -1
  55. package/dist/modules/resource/route.d.ts +0 -3
  56. package/dist/modules/resource/route.d.ts.map +1 -1
  57. package/dist/modules/resource/route.js +1 -1
  58. package/dist/modules/resource/schema.d.ts +3 -0
  59. package/dist/modules/resource/schema.d.ts.map +1 -1
  60. package/dist/modules/resource/schema.js +1 -1
  61. package/dist/modules/resource/services/add-note.js +1 -1
  62. package/dist/modules/resource/services/add-resource-file.js +1 -1
  63. package/dist/modules/resource/services/create-resource-relation.d.ts +8 -2
  64. package/dist/modules/resource/services/create-resource-relation.d.ts.map +1 -1
  65. package/dist/modules/resource/services/create-resource-relation.js +1 -1
  66. package/dist/modules/resource/services/create-resource.js +1 -1
  67. package/dist/modules/resource/services/delete-resource-relation.d.ts +8 -1
  68. package/dist/modules/resource/services/delete-resource-relation.d.ts.map +1 -1
  69. package/dist/modules/resource/services/delete-resource-relation.js +1 -1
  70. package/dist/modules/resource/services/delete-resource.js +1 -1
  71. package/dist/modules/resource/services/export-resource.d.ts.map +1 -1
  72. package/dist/modules/resource/services/export-resource.js +1 -1
  73. package/dist/modules/resource/services/get-resource.d.ts.map +1 -1
  74. package/dist/modules/resource/services/get-resource.js +1 -1
  75. package/dist/modules/resource/services/list-resource-relation.d.ts +9 -2
  76. package/dist/modules/resource/services/list-resource-relation.d.ts.map +1 -1
  77. package/dist/modules/resource/services/list-resource-relation.js +1 -1
  78. package/dist/modules/resource/services/list-resources.d.ts.map +1 -1
  79. package/dist/modules/resource/services/list-resources.js +1 -1
  80. package/dist/modules/resource/services/search-resource.d.ts.map +1 -1
  81. package/dist/modules/resource/services/search-resource.js +1 -1
  82. package/dist/modules/resource/services/suggest-resource.d.ts +10 -4
  83. package/dist/modules/resource/services/suggest-resource.d.ts.map +1 -1
  84. package/dist/modules/resource/services/suggest-resource.js +1 -1
  85. package/dist/modules/resource/services/update-resource-relation.d.ts +10 -0
  86. package/dist/modules/resource/services/update-resource-relation.d.ts.map +1 -0
  87. package/dist/modules/resource/services/update-resource-relation.js +1 -0
  88. package/dist/modules/resource/services/update-resource.js +1 -1
  89. package/dist/modules/resource/services/upload-resource-file.js +1 -1
  90. package/dist/modules/system/route.d.ts +2 -1
  91. package/dist/modules/system/route.d.ts.map +1 -1
  92. package/dist/modules/system/route.js +1 -1
  93. package/dist/modules/system/schema.d.ts +22 -1
  94. package/dist/modules/system/schema.d.ts.map +1 -1
  95. package/dist/modules/system/schema.js +1 -1
  96. package/dist/modules/system/services/check-system.d.ts.map +1 -1
  97. package/dist/modules/system/services/check-system.js +1 -1
  98. package/dist/modules/system/services/get-access.d.ts +14 -0
  99. package/dist/modules/system/services/get-access.d.ts.map +1 -0
  100. package/dist/modules/system/services/get-access.js +1 -0
  101. package/dist/modules/system/services/get-api-list.d.ts +4 -1
  102. package/dist/modules/system/services/get-api-list.d.ts.map +1 -1
  103. package/dist/modules/system/services/get-api-list.js +1 -1
  104. package/dist/modules/system/services/get-audit-log.d.ts.map +1 -1
  105. package/dist/modules/system/services/get-audit-log.js +1 -1
  106. package/dist/modules/system/services/get-dictionary.js +1 -1
  107. package/dist/modules/system/services/get-system-log.d.ts +9 -5
  108. package/dist/modules/system/services/get-system-log.d.ts.map +1 -1
  109. package/dist/modules/system/services/get-system-log.js +1 -1
  110. package/dist/modules/system/services/get-system-settings.d.ts.map +1 -1
  111. package/dist/modules/system/services/get-system-settings.js +1 -1
  112. package/dist/modules/system/services/list-dictionaries.js +1 -1
  113. package/dist/modules/system/services/set-access.d.ts +16 -0
  114. package/dist/modules/system/services/set-access.d.ts.map +1 -0
  115. package/dist/modules/system/services/set-access.js +1 -0
  116. package/dist/modules/system/services/update-dictionary.d.ts +13 -0
  117. package/dist/modules/system/services/update-dictionary.d.ts.map +1 -0
  118. package/dist/modules/system/services/update-dictionary.js +1 -0
  119. package/dist/modules/system/services/update-system-settings.d.ts.map +1 -1
  120. package/dist/modules/system/services/update-system-settings.js +1 -1
  121. package/dist/modules/utils/require-admin.js +1 -1
  122. package/dist/modules/utils/safe-user.js +1 -1
  123. package/dist/modules/utils/unsupported.js +1 -1
  124. package/dist/plugins/audit/audit.js +1 -1
  125. package/dist/plugins/audit/index.js +1 -1
  126. package/dist/plugins/audit/services/write-audit.js +1 -1
  127. package/dist/plugins/auth/get-user-permissions.d.ts +3 -0
  128. package/dist/plugins/auth/get-user-permissions.d.ts.map +1 -0
  129. package/dist/plugins/auth/get-user-permissions.js +1 -0
  130. package/dist/plugins/auth/index.d.ts +4 -0
  131. package/dist/plugins/auth/index.d.ts.map +1 -1
  132. package/dist/plugins/auth/index.js +1 -1
  133. package/dist/plugins/auth/verifyUser.d.ts +9 -0
  134. package/dist/plugins/auth/verifyUser.d.ts.map +1 -0
  135. package/dist/plugins/auth/verifyUser.js +1 -0
  136. package/dist/plugins/dictionary.d.ts +3 -0
  137. package/dist/plugins/dictionary.d.ts.map +1 -1
  138. package/dist/plugins/dictionary.js +1 -1
  139. package/dist/plugins/file.d.ts +3 -6
  140. package/dist/plugins/file.d.ts.map +1 -1
  141. package/dist/plugins/file.js +1 -1
  142. package/dist/plugins/index.d.ts +2 -0
  143. package/dist/plugins/index.d.ts.map +1 -1
  144. package/dist/plugins/index.js +1 -1
  145. package/dist/plugins/jwt.d.ts +4 -0
  146. package/dist/plugins/jwt.d.ts.map +1 -0
  147. package/dist/plugins/jwt.js +1 -0
  148. package/dist/plugins/logger/index.js +1 -1
  149. package/dist/plugins/logger/transport.d.ts +3 -0
  150. package/dist/plugins/logger/transport.d.ts.map +1 -0
  151. package/dist/plugins/logger/transport.js +1 -0
  152. package/dist/plugins/pg.d.ts +4 -2
  153. package/dist/plugins/pg.d.ts.map +1 -1
  154. package/dist/plugins/pg.js +1 -1
  155. package/dist/plugins/redis.js +1 -1
  156. package/dist/plugins/resource/index.js +1 -1
  157. package/dist/plugins/resource/resource.d.ts.map +1 -1
  158. package/dist/plugins/resource/resource.js +1 -1
  159. package/dist/plugins/resource/resource.registry.js +1 -1
  160. package/dist/plugins/resource/resource.types.d.ts +65 -8
  161. package/dist/plugins/resource/resource.types.d.ts.map +1 -1
  162. package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts +3 -0
  163. package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts.map +1 -0
  164. package/dist/plugins/resource/services/add-dictionary-lookup-data.js +1 -0
  165. package/dist/plugins/resource/services/add-file-token.d.ts +3 -0
  166. package/dist/plugins/resource/services/add-file-token.d.ts.map +1 -0
  167. package/dist/plugins/resource/services/add-file-token.js +1 -0
  168. package/dist/plugins/resource/services/add-table-lookup-data.d.ts +4 -0
  169. package/dist/plugins/resource/services/add-table-lookup-data.d.ts.map +1 -0
  170. package/dist/plugins/resource/services/add-table-lookup-data.js +1 -0
  171. package/dist/plugins/resource/services/create-relation.d.ts +16 -0
  172. package/dist/plugins/resource/services/create-relation.d.ts.map +1 -0
  173. package/dist/plugins/resource/services/create-relation.js +1 -0
  174. package/dist/plugins/resource/services/create.d.ts +5 -2
  175. package/dist/plugins/resource/services/create.d.ts.map +1 -1
  176. package/dist/plugins/resource/services/create.js +1 -1
  177. package/dist/plugins/resource/services/delete-relation.d.ts +18 -0
  178. package/dist/plugins/resource/services/delete-relation.d.ts.map +1 -0
  179. package/dist/plugins/resource/services/delete-relation.js +1 -0
  180. package/dist/plugins/resource/services/delete.d.ts +9 -2
  181. package/dist/plugins/resource/services/delete.d.ts.map +1 -1
  182. package/dist/plugins/resource/services/delete.js +1 -1
  183. package/dist/plugins/resource/services/find-one.d.ts +3 -2
  184. package/dist/plugins/resource/services/find-one.d.ts.map +1 -1
  185. package/dist/plugins/resource/services/find-one.js +1 -1
  186. package/dist/plugins/resource/services/find-relation.d.ts +13 -0
  187. package/dist/plugins/resource/services/find-relation.d.ts.map +1 -0
  188. package/dist/plugins/resource/services/find-relation.js +1 -0
  189. package/dist/plugins/resource/services/find.d.ts.map +1 -1
  190. package/dist/plugins/resource/services/find.js +1 -1
  191. package/dist/plugins/resource/services/update-relation.d.ts +14 -0
  192. package/dist/plugins/resource/services/update-relation.d.ts.map +1 -0
  193. package/dist/plugins/resource/services/update-relation.js +1 -0
  194. package/dist/plugins/resource/services/update.d.ts +9 -2
  195. package/dist/plugins/resource/services/update.d.ts.map +1 -1
  196. package/dist/plugins/resource/services/update.js +1 -1
  197. package/dist/plugins/resource/utils/auto-index.d.ts +4 -0
  198. package/dist/plugins/resource/utils/auto-index.d.ts.map +1 -0
  199. package/dist/plugins/resource/utils/auto-index.js +1 -0
  200. package/dist/plugins/resource/utils/fields.d.ts +8 -1
  201. package/dist/plugins/resource/utils/fields.d.ts.map +1 -1
  202. package/dist/plugins/resource/utils/fields.js +1 -1
  203. package/dist/plugins/resource/utils/filters.d.ts +3 -2
  204. package/dist/plugins/resource/utils/filters.d.ts.map +1 -1
  205. package/dist/plugins/resource/utils/filters.js +1 -1
  206. package/dist/plugins/resource/utils/permissions.d.ts.map +1 -1
  207. package/dist/plugins/resource/utils/permissions.js +1 -1
  208. package/dist/plugins/resource/utils/sort.d.ts.map +1 -1
  209. package/dist/plugins/resource/utils/sort.js +1 -1
  210. package/dist/plugins/resource/utils/sql.js +1 -1
  211. package/dist/shared/getIP.js +1 -1
  212. package/dist/type.d.ts +37 -0
  213. package/dist/type.d.ts.map +1 -0
  214. package/dist/type.js +1 -0
  215. package/migrations/20260903120000_core_schema.sql +27 -21
  216. package/migrations/20260903130000_move_notes_files_to_admin.sql +17 -17
  217. package/migrations/20260903130001_add_file_fields.sql +5 -0
  218. package/migrations/20260903140000_settings_nulls_not_distinct.sql +18 -18
  219. package/migrations/20260905120000_add_user_foreign_keys.sql +43 -0
  220. package/migrations/20260907090000_core_schema.sql +32 -0
  221. package/package.json +12 -7
  222. package/dist/modules/auth/index.d.ts +0 -9
  223. package/dist/modules/auth/index.d.ts.map +0 -1
  224. package/dist/modules/auth/index.js +0 -1
  225. package/dist/modules/auth/services/login.d.ts +0 -10
  226. package/dist/modules/auth/services/login.d.ts.map +0 -1
  227. package/dist/modules/auth/services/login.js +0 -1
  228. package/dist/modules/auth/services/logout.d.ts +0 -9
  229. package/dist/modules/auth/services/logout.d.ts.map +0 -1
  230. package/dist/modules/auth/services/logout.js +0 -1
  231. package/dist/modules/auth/services/verifyPassword.d.ts +0 -11
  232. package/dist/modules/auth/services/verifyPassword.d.ts.map +0 -1
  233. package/dist/modules/auth/services/verifyPassword.js +0 -1
  234. package/dist/modules/file/index.d.ts +0 -8
  235. package/dist/modules/file/index.d.ts.map +0 -1
  236. package/dist/modules/file/index.js +0 -1
  237. package/dist/modules/resource/index.d.ts +0 -20
  238. package/dist/modules/resource/index.d.ts.map +0 -1
  239. package/dist/modules/resource/index.js +0 -1
  240. package/dist/modules/resource/services/list-children.d.ts +0 -6
  241. package/dist/modules/resource/services/list-children.d.ts.map +0 -1
  242. package/dist/modules/resource/services/list-children.js +0 -1
  243. package/dist/modules/system/index.d.ts +0 -13
  244. package/dist/modules/system/index.d.ts.map +0 -1
  245. package/dist/modules/system/index.js +0 -1
  246. package/dist/modules/utils/get-user-permissions.d.ts +0 -3
  247. package/dist/modules/utils/get-user-permissions.d.ts.map +0 -1
  248. 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 p(D,L){D=D-0x130;var s=m();var X=s[D];return X;}(function(D,L){var u=p,s=D();while(!![]){try{var X=-parseInt(u(0x133))/0x1*(parseInt(u(0x136))/0x2)+parseInt(u(0x13b))/0x3*(parseInt(u(0x135))/0x4)+-parseInt(u(0x13c))/0x5*(parseInt(u(0x139))/0x6)+-parseInt(u(0x13a))/0x7+parseInt(u(0x138))/0x8*(-parseInt(u(0x130))/0x9)+parseInt(u(0x13d))/0xa+parseInt(u(0x137))/0xb;if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0xae4c0));import{unsupported}from'../../utils/unsupported.js';function m(){var r=['16tNscSx','6nwmfCN','6719958evxViO','14943bVdmYK','304745wIXcYL','525730AsvilZ','5313519SSLQxW','jSiFH','KWeED','82963zyxyes','Two-factor\x20provider','724rUcIPJ','2xKHYfC','22489214DRqdcd'];m=function(){return r;};return m();}export default async function verifyTwoFactor(D,L){var o=p,s={'jSiFH':function(X,M){return X(M);},'KWeED':o(0x134)};return s[o(0x131)](unsupported,s[o(0x132)]);}
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,3 @@
1
+ declare const _default: Set<string>;
2
+ export default _default;
3
+ //# sourceMappingURL=mime.d.ts.map
@@ -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;AAInD,wBAAgB,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,kBAAkB,CAyD9D"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/file/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAMnD,wBAAgB,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,kBAAkB,CA8F9D"}
@@ -1 +1 @@
1
- (function(D,L){var r=p,s=D();while(!![]){try{var X=parseInt(r(0xf1))/0x1*(-parseInt(r(0xde))/0x2)+-parseInt(r(0xf3))/0x3*(-parseInt(r(0xea))/0x4)+parseInt(r(0xfa))/0x5*(-parseInt(r(0xd5))/0x6)+-parseInt(r(0xf9))/0x7*(parseInt(r(0xef))/0x8)+parseInt(r(0xf5))/0x9*(-parseInt(r(0xf6))/0xa)+-parseInt(r(0xdc))/0xb*(-parseInt(r(0xf2))/0xc)+parseInt(r(0xee))/0xd;if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0xd26ae));import{uploadFile}from'./services/upload-file.js';function m(){var R=['query','send','Returns\x20a\x20file\x20after\x20verifying\x20its\x20signed\x20access\x20token.','token','params','144089PzSWdQ','lYCYS','897344SHWqPs','Upload\x20file','Returns\x20a\x20resized\x20image\x20file.','EHfbg','/api/file/upload','resizeQuery','Resize\x20file','user','arIqR','dWItv','/api/file/:token/resize','Uploads\x20a\x20file\x20and\x20stores\x20its\x20metadata.','44lvUuQJ','LTpzB','files:create','fcore','25326756fbjOIy','8wtnKKV','public','2gpFSMX','588FuTvws','259347IAKBej','file','9AUUobZ','2509770cfFNjK','post','ElytD','9801022gDySzS','155LZCPhL','verify','body','fileToken','oUFsW','get','files:read','CFSRG','MmEFg','gMdXz','TcxUA','/api/file/:token','uEUrq','Get\x20file\x20by\x20token','upload','25290oHDieI','TAvbq'];m=function(){return R;};return m();}function p(D,L){D=D-0xca;var s=m();var X=s[D];return X;}import{resizeFile}from'./services/resize-file.js';import{fileSchemas}from'./schema.js';export function fileRoutes(L){var i=p,s={};s[i(0xe1)]=i(0xd1),s[i(0xe7)]=i(0xed),s[i(0xce)]=i(0xf4),s[i(0xca)]=i(0xd3),s[i(0xd0)]=i(0xf0),s[i(0xf8)]=i(0xe2),s[i(0xcf)]=i(0xdf),s[i(0xe6)]=i(0xe9),s[i(0xd6)]=i(0xec),s[i(0xdd)]=i(0xe8),s[i(0xd2)]=i(0xe0),s[i(0xeb)]=i(0xe5),s[i(0xcd)]=i(0xcc);var X=s;return async M=>{var q=i;M[q(0xcb)](X[q(0xe1)],{'schema':{'tags':[X[q(0xe7)],X[q(0xce)]],'summary':X[q(0xca)],'description':q(0xd9),'access':X[q(0xd0)],'permissions':[],'params':fileSchemas[q(0xfd)]}},async(u,o)=>o[q(0xd8)](await L[q(0xf4)]?.[q(0xcb)](L[q(0xf4)][q(0xfb)](u[q(0xdb)][q(0xda)])['p']))),M[q(0xf7)](X[q(0xf8)],{'schema':{'tags':[X[q(0xe7)],X[q(0xce)]],'summary':X[q(0xcf)],'description':X[q(0xe6)],'access':q(0xe5),'permissions':[X[q(0xd6)]],'body':fileSchemas[q(0xd4)]}},async u=>uploadFile(u[q(0xfc)],L)),M[q(0xcb)](X[q(0xdd)],{'schema':{'tags':[X[q(0xe7)],X[q(0xce)]],'summary':q(0xe4),'description':X[q(0xd2)],'access':X[q(0xeb)],'permissions':[X[q(0xcd)]],'params':fileSchemas[q(0xfd)],'querystring':fileSchemas[q(0xe3)]}},async u=>resizeFile({'pathOrToken':L[q(0xf4)]?.[q(0xfb)](u[q(0xdb)][q(0xda)])['p'],...u[q(0xd7)]},L));};}
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
- const z=p;(function(B,O){const S=p,h=B();while(!![]){try{const g=parseInt(S(0x12b))/0x1+parseInt(S(0x134))/0x2*(-parseInt(S(0x136))/0x3)+-parseInt(S(0x133))/0x4*(-parseInt(S(0x13a))/0x5)+parseInt(S(0x127))/0x6*(-parseInt(S(0x123))/0x7)+-parseInt(S(0x125))/0x8+parseInt(S(0x13b))/0x9*(-parseInt(S(0x12c))/0xa)+-parseInt(S(0x12d))/0xb*(-parseInt(S(0x138))/0xc);if(g===O)break;else h['push'](h['shift']());}catch(J){h['push'](h['shift']());}}}(m,0x4e183));import{Type}from'@sinclair/typebox';const D={};D[z(0x12f)]=0x1,D[z(0x126)]=0x80;const L={};L[z(0x12f)]=0x1,L[z(0x126)]=0x800;const s={};s[z(0x12f)]=0x1,s[z(0x126)]=0x400;const X={};X[z(0x12f)]=0x1;const M={};M[z(0x12f)]=0x1;const u={};u[z(0x12f)]=0x1;const o={};function p(D,L){D=D-0x121;const s=m();let X=s[D];return X;}o[z(0x12f)]=0x1;const r={};r[z(0x12f)]=0x1;const i={};i[z(0x12f)]=0x1;function m(){const l=['69633VHybnD','outside','Any','32816uwuVfn','inside','2068040dvIfmg','maxLength','762dDuyAd','Literal','contain','Integer','606132eoQUWw','270GziVdm','939257qAxogJ','String','minLength','Union','fill','minimum','4GfsWlt','2358BKNSFa','Object','939JxLAcf','Optional','108NPLYDs','cover','1885335szufau'];m=function(){return l;};return m();}const q={};q[z(0x132)]=0x1;const R={};R[z(0x132)]=0x1;export const fileSchemas={'fileId':Type[z(0x135)]({'id':Type[z(0x12e)](D)}),'fileToken':Type[z(0x135)]({'token':Type[z(0x12e)](L)}),'filePath':Type[z(0x135)]({'*':Type[z(0x12e)](s)}),'upload':Type[z(0x135)]({'file':Type[z(0x122)](),'metadata':Type[z(0x135)]({'name':Type[z(0x137)](Type[z(0x12e)](X)),'path':Type[z(0x137)](Type[z(0x12e)](M)),'entityType':Type[z(0x137)](Type[z(0x12e)](u)),'entityId':Type[z(0x137)](Type[z(0x12e)](o))})}),'filePatch':Type[z(0x135)]({'entityType':Type[z(0x137)](Type[z(0x12e)](r)),'entityId':Type[z(0x137)](Type[z(0x12e)](i))}),'resizeQuery':Type[z(0x135)]({'width':Type[z(0x137)](Type[z(0x12a)](q)),'height':Type[z(0x137)](Type[z(0x12a)](R)),'fit':Type[z(0x137)](Type[z(0x130)]([Type[z(0x128)](z(0x139)),Type[z(0x128)](z(0x129)),Type[z(0x128)](z(0x131)),Type[z(0x128)](z(0x124)),Type[z(0x128)](z(0x121))]))})};
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
- (function(D,L){var u=p,s=D();while(!![]){try{var X=parseInt(u(0x1d0))/0x1+-parseInt(u(0x1cc))/0x2*(-parseInt(u(0x1d5))/0x3)+parseInt(u(0x1c6))/0x4+-parseInt(u(0x1cd))/0x5+-parseInt(u(0x1d3))/0x6*(-parseInt(u(0x1cb))/0x7)+-parseInt(u(0x1c7))/0x8+parseInt(u(0x1ce))/0x9*(parseInt(u(0x1d4))/0xa);if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0x4d5a6));function m(){var r=['42gGPxBu','10ioqyZQ','13977ngQzJQ','get','342564KeoSMW','1477960SaKLda','File\x20not\x20found','file','empty\x20file','167951AALtMt','8xCTuav','2448985HDJyBz','6170589DckLzR','exists','33531LaOCKm','jiAXf','pathOrToken'];m=function(){return r;};return m();}function p(D,L){D=D-0x1c5;var s=m();var X=s[D];return X;}import{NotFoundError}from'../../../errors.js';export async function getFile(L,s){var o=p,X={};X[o(0x1d1)]=o(0x1ca);var M=X;if(!s[o(0x1c9)])throw new Error(M[o(0x1d1)]);if(!await s[o(0x1c9)][o(0x1cf)](L[o(0x1d2)]))throw new NotFoundError(o(0x1c8));return s[o(0x1c9)][o(0x1c5)](L[o(0x1d2)]);}
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;AAItD,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,CAwBjB"}
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
- (function(D,L){const H=p,s=D();while(!![]){try{const X=-parseInt(H(0x12e))/0x1+-parseInt(H(0x10b))/0x2*(parseInt(H(0x126))/0x3)+parseInt(H(0x10c))/0x4*(-parseInt(H(0x115))/0x5)+-parseInt(H(0x12c))/0x6+parseInt(H(0x121))/0x7*(-parseInt(H(0x122))/0x8)+-parseInt(H(0x10a))/0x9*(-parseInt(H(0x124))/0xa)+parseInt(H(0x12b))/0xb;if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0x60fa4));import{NotFoundError,ValidationError}from'../../../errors.js';function p(D,L){D=D-0x106;const s=m();let X=s[D];return X;}import c from'sharp';export async function resizeFile(L,s){const A=p,X={'SEKJn':function(i,q){return i===q;},'Nqpny':function(i,q){return i===q;},'mgiVo':function(i,q){return i(q);},'Tdzfy':function(i,q){return i<=q;},'vxUJf':function(i,q){return i===q;},'skYDg':A(0x11b),'LXXvb':A(0x12f),'gAhll':function(i,q,R){return i(q,R);},'zgvIo':A(0x131),'FkPEG':A(0x125),'zAgZp':function(i,q){return i(q);}};if(!s[A(0x11f)]){if(X[A(0x11e)](X[A(0x114)],A(0x11b)))throw new Error(X[A(0x128)]);else return L;}const M=L[A(0x12d)]??L[A(0x109)];if(!M)throw new ValidationError(A(0x107));const u=X[A(0x12a)](parseDimension,L[A(0x106)],A(0x106)),o=parseDimension(L[A(0x132)],A(0x132));if(!u&&!o){if(A(0x10d)!==X[A(0x119)])throw new ValidationError(X[A(0x120)]);else{if(X[A(0x116)](q,R)||X[A(0x11d)](B,''))return l;const R=X[A(0x108)](h,g);if(!J[A(0x117)](R)||X[A(0x127)](R,0x0))throw new t(y+A(0x11a));return R;}}if(!await s[A(0x11f)][A(0x123)](M))throw new NotFoundError(A(0x11c));const r={};return r[A(0x106)]=u,r[A(0x132)]=o,r[A(0x10f)]=L[A(0x10f)]??A(0x10e),X[A(0x111)](c,await s[A(0x11f)][A(0x129)](M))[A(0x112)](r)[A(0x110)]();}function m(){const a=['File\x20path\x20is\x20required','mgiVo','path','171LZLaob','1487218AgsLya','52SiDyFg','FNfSg','cover','fit','toBuffer','zAgZp','resize','WaCSa','skYDg','103135iOXfTR','SEKJn','isInteger','xAQFe','zgvIo','\x20must\x20be\x20a\x20positive\x20integer','rhGAx','File\x20not\x20found','Nqpny','vxUJf','file','FkPEG','1593354uHcuXK','24wXzLxp','exists','82860HeAQaN','Width\x20or\x20height\x20is\x20required','3FUgOuH','Tdzfy','LXXvb','get','gAhll','33230285nktsNG','2896890ABzHAd','pathOrToken','603708DuuAKS','empty\x20file','MFymn','iNetD','height','width'];m=function(){return a;};return m();}function parseDimension(D,L){const V=p,s={'MFymn':function(M,u){return M===u;},'xAQFe':function(M,u){return M(u);},'WaCSa':function(M,u){return M<=u;}};if(s[V(0x130)](D,undefined)||D==='')return undefined;const X=s[V(0x118)](Number,D);if(!Number[V(0x117)](X)||s[V(0x113)](X,0x0))throw new ValidationError(L+V(0x11a));return X;}
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: Buffer;
5
+ file: MultipartFile;
8
6
  metadata: {
9
7
  name?: string;
10
8
  path?: string;
11
- entityType?: string;
12
- entityId?: string;
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":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AACD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CA0Bd"}
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
- (function(D,L){const r=p,s=D();while(!![]){try{const X=parseInt(r(0xd6))/0x1*(-parseInt(r(0xc5))/0x2)+parseInt(r(0xd1))/0x3*(-parseInt(r(0xd4))/0x4)+-parseInt(r(0xcc))/0x5+parseInt(r(0xc9))/0x6*(-parseInt(r(0xc2))/0x7)+parseInt(r(0xd3))/0x8+parseInt(r(0xc3))/0x9+-parseInt(r(0xd0))/0xa*(-parseInt(r(0xd7))/0xb);if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0xf402e));function p(D,L){D=D-0xc2;const s=m();let X=s[D];return X;}function m(){const q=['path','2515315wGtNoZ','metadata','name','\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','14822840fHxjXZ','6YHXqKd','entityType','5041688fKqLFb','3587132ixznjn','query','19cedAkU','22iiqMVe','entityId','rows','BWfCU','5926130UAwEYY','10621899JkBUeW','replace','66558pVgamo','length','file','uploads/','6LMEHXP','put'];m=function(){return q;};return m();}import{randomUUID}from'node:crypto';export async function uploadFile(D,L){const i=p,s={'BWfCU':function(o){return o();}},X=(D[i(0xcd)][i(0xce)]??i(0xc7))[i(0xc4)](/[^a-zA-Z0-9._-]/g,'_'),M=D[i(0xcd)][i(0xcb)]??i(0xc8)+s[i(0xda)](randomUUID)+'-'+X;await L[i(0xc7)][i(0xca)](M,D[i(0xc7)]);const u=await L['pg'][i(0xd5)](i(0xcf),[D[i(0xcd)][i(0xd2)]??null,D[i(0xcd)][i(0xd8)]??null,M,D[i(0xc7)][i(0xc6)]]);return u[i(0xd9)][0x0];}
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":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAoBnD,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,kBAAkB,CA0WlE"}
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
- const y=p;(function(g,J){const t=p,S=g();while(!![]){try{const z=parseInt(t(0x17a))/0x1*(-parseInt(t(0x17c))/0x2)+-parseInt(t(0x174))/0x3+parseInt(t(0x169))/0x4*(parseInt(t(0x170))/0x5)+parseInt(t(0x17b))/0x6*(parseInt(t(0x164))/0x7)+-parseInt(t(0x17f))/0x8+parseInt(t(0x179))/0x9*(parseInt(t(0x16a))/0xa)+parseInt(t(0x173))/0xb;if(z===J)break;else S['push'](S['shift']());}catch(l){S['push'](S['shift']());}}}(m,0xc9c85));import{Type}from'@sinclair/typebox';const D={};D[y(0x166)]=0x1,D[y(0x17d)]=0x80,D[y(0x178)]=y(0x167);export const identifier=Type[y(0x16b)](D);const L={};L[y(0x180)]=identifier;const s={};s[y(0x171)]=identifier;const X={};X[y(0x171)]=identifier;function m(){const E=['String','maximum','Array','Unknown','relation','60szbeeW','resource','Integer','9710998FEDyRF','2054844HmTkDL','field','relationId','Any','pattern','1645236houUlA','73VbuJeZ','936498qMbzGP','15970yvWrjw','maxLength','Object','8511000hkSqqC','name','Optional','63PTNACe','Record','minLength','^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$','minimum','168352wnehKE','20LLniVj'];m=function(){return E;};return m();}const M={};M[y(0x171)]=identifier,M[y(0x175)]=identifier;const u={};u[y(0x168)]=0x1,u[y(0x16c)]=0xc8;const o={};o[y(0x171)]=identifier,o['id']=identifier;const r={};r[y(0x171)]=identifier,r['id']=identifier,r[y(0x16f)]=identifier;const i={};i[y(0x171)]=identifier,i['id']=identifier,i[y(0x16f)]=identifier,i[y(0x176)]=identifier;const q={};q[y(0x171)]=identifier,q['id']=identifier;const R={};R[y(0x166)]=0x1,R[y(0x17d)]=0xff;const B={};B[y(0x166)]=0x1;const O={};function p(D,L){D=D-0x164;const s=m();let X=s[D];return X;}O[y(0x168)]=0x1,O[y(0x16c)]=0xc8;const h={};h[y(0x168)]=0x0;export const resourceSchemas={'dictionaryName':Type[y(0x17e)](L),'resource':Type[y(0x17e)](s),'exportResource':Type[y(0x17e)](X),'resourceField':Type[y(0x17e)](M),'suggestQuery':Type[y(0x17e)]({'q':Type[y(0x181)](Type[y(0x16b)]()),'search':Type[y(0x181)](Type[y(0x16b)]()),'limit':Type[y(0x181)](Type[y(0x172)](u))}),'resourceId':Type[y(0x17e)](o),'resourceIdRelation':Type[y(0x17e)](r),'resourceIdRelationId':Type[y(0x17e)](i),'uploadResourceFile':Type[y(0x17e)](q),'uploadResourceFileBody':Type[y(0x17e)]({'file':Type[y(0x177)](),'fileName':Type[y(0x16b)](R)}),'exportResourceQuery':Type[y(0x17e)]({'filter':Type[y(0x181)](Type[y(0x165)](Type[y(0x16b)](),Type[y(0x16e)]())),'sort':Type[y(0x181)](Type[y(0x16d)](Type[y(0x16b)](B))),'search':Type[y(0x181)](Type[y(0x16b)]()),'limit':Type[y(0x181)](Type[y(0x172)](O)),'offset':Type[y(0x181)](Type[y(0x172)](h)),'fields':Type[y(0x181)](Type[y(0x16d)](identifier))})};
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
- (function(D,L){const u=p,s=D();while(!![]){try{const X=-parseInt(u(0x169))/0x1+parseInt(u(0x168))/0x2*(-parseInt(u(0x164))/0x3)+parseInt(u(0x16c))/0x4*(-parseInt(u(0x170))/0x5)+-parseInt(u(0x167))/0x6+-parseInt(u(0x16e))/0x7+parseInt(u(0x163))/0x8+parseInt(u(0x16b))/0x9*(parseInt(u(0x162))/0xa);if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0x8e0a4));function p(D,L){D=D-0x162;const s=m();let X=s[D];return X;}export async function addNote(D,L){const o=p,s=await L['pg'][o(0x16a)](o(0x16f),[D[o(0x16d)],String(D['id']),D[o(0x166)]]);return s[o(0x165)][0x0];}function m(){const r=['39777IvepPs','rows','body','5790630BikJIu','2QCnzNc','895890IdHfbx','query','18sYogZm','1244YIMbuM','resource','3837799hNkysO','INSERT\x20INTO\x20admin.notes(resource,resource_id,body)\x20VALUES\x20($1,$2,$3)\x20RETURNING\x20*','17295Irvmne','15310760SkcyER','8143232FdeBoM'];m=function(){return r;};return m();}
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 p(D,L){D=D-0x151;const s=m();let X=s[D];return X;}(function(D,L){const o=p,s=D();while(!![]){try{const X=parseInt(o(0x15d))/0x1+parseInt(o(0x151))/0x2*(parseInt(o(0x15c))/0x3)+parseInt(o(0x156))/0x4+parseInt(o(0x153))/0x5+-parseInt(o(0x152))/0x6+-parseInt(o(0x159))/0x7*(-parseInt(o(0x158))/0x8)+-parseInt(o(0x15b))/0x9;if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0x73a72));function m(){const i=['893613WVmFGl','size','12176685ywzyqG','20649RURoMQ','648544LQREKI','resource','YPKbZ','query','142VAWDPh','4413552aVlmbM','1655245rsqzYG','\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','rows','2333396EkKtXm','filePath','32nzRCCd'];m=function(){return i;};return m();}export async function addResourceFile(D,L){const r=p,s={'YPKbZ':function(M,u){return M(u);}},X=await L['pg'][r(0x160)](r(0x154),[D[r(0x15e)],s[r(0x15f)](String,D['id']),D[r(0x157)],D[r(0x15a)]??null]);return X[r(0x155)][0x0];}
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: any, ctx: AppContext): Promise<never>;
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;AAEtD,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAEzF"}
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
- (function(D,L){var u=p,s=D();while(!![]){try{var X=parseInt(u(0x142))/0x1+parseInt(u(0x139))/0x2*(parseInt(u(0x13e))/0x3)+parseInt(u(0x13a))/0x4*(-parseInt(u(0x138))/0x5)+-parseInt(u(0x13b))/0x6+-parseInt(u(0x140))/0x7+-parseInt(u(0x137))/0x8*(-parseInt(u(0x13d))/0x9)+-parseInt(u(0x141))/0xa;if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0x37da7));import{unsupported}from'../../utils/unsupported.js';export async function createResourceRelation(D,L){var o=p,s={'aYEoR':function(X,M){return X(M);}};return s[o(0x13f)](unsupported,o(0x13c));}function p(D,L){D=D-0x137;var s=m();var X=s[D];return X;}function m(){var r=['aYEoR','645512DWihkR','2277790iYdkbV','230210gmHsYr','2185680CSalML','1114395amlZJy','6036hGaEof','4RGwoXr','817098UdLbkF','Generic\x20Resource\x20relations','9lHDQOG','402lcTkqd'];m=function(){return r;};return m();}
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
- (function(D,L){var i=p,s=D();while(!![]){try{var X=-parseInt(i(0x18a))/0x1+parseInt(i(0x189))/0x2+-parseInt(i(0x18f))/0x3+-parseInt(i(0x192))/0x4*(-parseInt(i(0x18d))/0x5)+parseInt(i(0x18b))/0x6*(-parseInt(i(0x188))/0x7)+parseInt(i(0x187))/0x8+-parseInt(i(0x18c))/0x9;if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0xd2dbc));function p(D,L){D=D-0x187;var s=m();var X=s[D];return X;}export async function createResource(L,s){var q=p,X={};return X[q(0x191)]=L[q(0x194)],X[q(0x190)]=L[q(0x190)],X[q(0x193)]=L[q(0x193)],s[q(0x194)][q(0x18e)](X);}function m(){var R=['create','577728RvVade','data','name','8JrcEVo','user','resource','2578872lKMQQt','6058829WUXGoD','2784216XaSWtT','110361IsGsMr','6dkBIZN','12433023yEJHnC','4247850ZYdyRb'];m=function(){return R;};return m();}
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: any, ctx: AppContext): Promise<never>;
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,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAEzF"}
1
+ {"version":3,"file":"delete-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/delete-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAC9E,GAAG,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAG/B"}
@@ -1 +1 @@
1
- (function(D,L){var u=p,s=D();while(!![]){try{var X=parseInt(u(0xf5))/0x1*(parseInt(u(0xfa))/0x2)+parseInt(u(0xfe))/0x3*(-parseInt(u(0x100))/0x4)+parseInt(u(0xff))/0x5*(parseInt(u(0xfb))/0x6)+-parseInt(u(0xf7))/0x7+parseInt(u(0xfd))/0x8+-parseInt(u(0xf8))/0x9*(-parseInt(u(0xf6))/0xa)+parseInt(u(0xfc))/0xb;if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0xb0952));import{unsupported}from'../../utils/unsupported.js';function p(D,L){D=D-0xf4;var s=m();var X=s[D];return X;}export async function deleteResourceRelation(L,s){var o=p,X={};X[o(0xf4)]=o(0xf9);var M=X;return unsupported(M[o(0xf4)]);}function m(){var r=['47849bbOIat','370YCjVAk','8367121NyhtEN','53523ahLWoi','Generic\x20Resource\x20relations','24oXrJkz','635364rMVtcv','459833pOOaye','11211696cGOFor','144735CWQMuO','10DGITjM','44wQwEwp','VNjtc'];m=function(){return r;};return m();}
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
- function m(){var R=['746300sIThCn','4114wQLjfO','6330YAsxby','353432LaXFbM','13311VZnHDa','1886442sloxNY','323968uQuoPw','186kStaYH','user','462483yJYyLN','delete','21tsCSts','name','resource'];m=function(){return R;};return m();}(function(D,L){var i=p,s=D();while(!![]){try{var X=-parseInt(i(0x1d4))/0x1*(parseInt(i(0x1ce))/0x2)+parseInt(i(0x1c8))/0x3+parseInt(i(0x1d0))/0x4+-parseInt(i(0x1cd))/0x5+-parseInt(i(0x1d2))/0x6+parseInt(i(0x1ca))/0x7*(-parseInt(i(0x1d3))/0x8)+-parseInt(i(0x1d1))/0x9*(-parseInt(i(0x1cf))/0xa);if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0x33819));function p(D,L){D=D-0x1c7;var s=m();var X=s[D];return X;}export async function deleteResource(L,s){var q=p,X={};return X[q(0x1cb)]=L[q(0x1cc)],X['id']=L['id'],X[q(0x1c7)]=L[q(0x1c7)],s[q(0x1cc)][q(0x1c9)](X);}
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;AAEtD,wBAAsB,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAcrG"}
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(D,L){const u=p,s=D();while(!![]){try{const X=parseInt(u(0xe5))/0x1*(-parseInt(u(0xec))/0x2)+parseInt(u(0xf2))/0x3*(parseInt(u(0xef))/0x4)+parseInt(u(0xe1))/0x5*(parseInt(u(0xde))/0x6)+parseInt(u(0xe3))/0x7*(parseInt(u(0xe9))/0x8)+-parseInt(u(0xe8))/0x9+parseInt(u(0xf3))/0xa+-parseInt(u(0xe6))/0xb;if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0x6ec37));export async function exportResource(L,s){const o=p,X={};X[o(0xee)]=L[o(0xe4)],X[o(0xea)]={},X[o(0xdd)]=L[o(0xdd)],X[o(0xea)][o(0xe2)]=L[o(0xe2)],X[o(0xea)][o(0xf0)]=L[o(0xf0)],X[o(0xea)][o(0xe7)]=L[o(0xe7)],X[o(0xea)][o(0xeb)]=L[o(0xeb)],X[o(0xea)][o(0xe0)]=L[o(0xe0)],X[o(0xea)][o(0xdf)]=L[o(0xdf)];const M=await s[o(0xe4)][o(0xf1)](X);return M[o(0xed)];}function p(D,L){D=D-0xdd;const s=m();let X=s[D];return X;}function m(){const r=['resource','373249EKfJsn','3373073iAWKlW','search','6444918cIiiFw','3334256fGAoPU','query','limit','2jftcqK','rows','name','4JQzjUJ','sort','find','452784cvobli','533740njTxnD','user','4870890FvuhUr','fields','offset','5tUAzJD','filter','14RIpTaL'];m=function(){return r;};return m();}
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,CAE5E"}
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(D,L){var i=p,s=D();while(!![]){try{var X=-parseInt(i(0x1f4))/0x1*(parseInt(i(0x1f7))/0x2)+-parseInt(i(0x1fd))/0x3+parseInt(i(0x1f3))/0x4*(-parseInt(i(0x1fa))/0x5)+-parseInt(i(0x200))/0x6+parseInt(i(0x1ff))/0x7*(parseInt(i(0x1f9))/0x8)+parseInt(i(0x1f8))/0x9*(-parseInt(i(0x1fc))/0xa)+parseInt(i(0x1fe))/0xb*(parseInt(i(0x1f2))/0xc);if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0x3ab40));function p(D,L){D=D-0x1f1;var s=m();var X=s[D];return X;}function m(){var R=['1224GoSYLe','3821eNWbat','findOne','resource','10TALTye','9svejnn','56dMwpjH','1565SfeVES','user','228070VQsXbx','34656HzxAEa','100001YnVaRQ','157003NNtDgk','1167540ocxXDS','name','564DFiiPl'];m=function(){return R;};return m();}export async function getResource(L,s){var q=p,X={};return X[q(0x1f1)]=L[q(0x1f6)],X['id']=L['id'],X[q(0x1fb)]=L[q(0x1fb)],s[q(0x1f6)][q(0x1f5)](X);}
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
- export declare function listResourceRelation(params: any, ctx: AppContext): Promise<never>;
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;AAEtD,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAEvF"}
1
+ {"version":3,"file":"list-resource-relation.d.ts","sourceRoot":"","sources":["../../../../src/modules/resource/services/list-resource-relation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF,wBAAsB,oBAAoB,CACxC,MAAM,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,EACD,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CAGd"}
@@ -1 +1 @@
1
- (function(D,L){var u=p,s=D();while(!![]){try{var X=parseInt(u(0x199))/0x1*(parseInt(u(0x19c))/0x2)+-parseInt(u(0x1a4))/0x3*(-parseInt(u(0x19d))/0x4)+parseInt(u(0x19b))/0x5*(parseInt(u(0x198))/0x6)+-parseInt(u(0x19e))/0x7*(parseInt(u(0x19f))/0x8)+-parseInt(u(0x19a))/0x9+-parseInt(u(0x1a3))/0xa+-parseInt(u(0x1a0))/0xb;if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0xa427e));function p(D,L){D=D-0x197;var s=m();var X=s[D];return X;}import{unsupported}from'../../utils/unsupported.js';export async function listResourceRelation(D,L){var o=p,s={'zxplA':function(X,M){return X(M);},'agWsY':o(0x197)};return s[o(0x1a1)](unsupported,s[o(0x1a2)]);}function m(){var r=['10BaYPlo','455618dEglzk','4iKCMNU','21Ofnunw','941152sWZQyI','2686233zCOIrN','zxplA','agWsY','4779580xazoZM','2966349Qyzrjx','Generic\x20Resource\x20relations','1935432EsFEhH','2jAawVJ','3078630qxseLy'];m=function(){return r;};return m();}
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;AACtD,wBAAsB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAY9E"}
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 p(D,L){D=D-0x188;var s=m();var X=s[D];return X;}function m(){var a=['1688506HIZRww','page','3581181ziKjTB','search','30sJyQmi','474748VsTcne','user','resource','offset','2175124bFWJtT','filter','2087948IkXLtK','liwCl','7070125DPqcXk','22620170lWusjU','6dLTTCV','sort','IZpnK','40gHrLca','max','limit','find'];m=function(){return a;};return m();}(function(D,L){var A=p,s=D();while(!![]){try{var X=-parseInt(A(0x196))/0x1+-parseInt(A(0x18b))/0x2+parseInt(A(0x19a))/0x3*(-parseInt(A(0x19b))/0x4)+-parseInt(A(0x18d))/0x5*(-parseInt(A(0x18f))/0x6)+parseInt(A(0x189))/0x7*(parseInt(A(0x192))/0x8)+-parseInt(A(0x198))/0x9+parseInt(A(0x18e))/0xa;if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0xdec3b));export async function listResources(L,s){var V=p,X={};X[V(0x18c)]=function(u,o){return u*o;},X[V(0x191)]=function(u,o){return u-o;};var M=X;return s[V(0x19d)][V(0x195)]({'name':L[V(0x19d)],'query':{'filter':L[V(0x18a)],'sort':L[V(0x190)],'search':L[V(0x199)],'limit':L[V(0x194)],'offset':L[V(0x188)]??M[V(0x18c)](L[V(0x197)]?Math[V(0x193)](M[V(0x191)](L[V(0x197)],0x1),0x0):0x0,L[V(0x194)]??0x14)},'user':L[V(0x19c)]});}
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;AACtD,wBAAsB,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAE/E"}
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
- (function(D,L){var R=p,s=D();while(!![]){try{var X=-parseInt(R(0x1a2))/0x1*(-parseInt(R(0x1ad))/0x2)+-parseInt(R(0x1a4))/0x3*(parseInt(R(0x1a9))/0x4)+parseInt(R(0x1a5))/0x5+parseInt(R(0x1ac))/0x6+-parseInt(R(0x1a8))/0x7+parseInt(R(0x1a7))/0x8+-parseInt(R(0x1a6))/0x9;if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0x6ea2d));function p(D,L){D=D-0x1a1;var s=m();var X=s[D];return X;}export async function searchResource(L,s){var B=p,X={};return X[B(0x1af)]=L[B(0x1aa)],X[B(0x1a1)]={...L},X[B(0x1ae)]=L[B(0x1ae)],X[B(0x1a1)][B(0x1ab)]=L[B(0x1ab)],s[B(0x1aa)][B(0x1a3)](X);}function m(){var O=['3525384zbUord','2TiRFpg','user','name','query','901373qgJBHG','find','6pOuueA','778450apYyXC','5387103mHcGxg','3341080KCxrqU','3332812yhtSAZ','1068828fQcRhO','resource','filter'];m=function(){return O;};return m();}
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
- export declare function suggestResource(params: any, ctx: AppContext): Promise<any[]>;
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":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,wBAAsB,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAclF"}
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
- (function(D,L){const B=p,s=D();while(!![]){try{const X=-parseInt(B(0xc3))/0x1+-parseInt(B(0xbb))/0x2+parseInt(B(0xc9))/0x3*(parseInt(B(0xc4))/0x4)+-parseInt(B(0xb0))/0x5+parseInt(B(0xb6))/0x6*(-parseInt(B(0xc6))/0x7)+parseInt(B(0xbe))/0x8*(parseInt(B(0xc2))/0x9)+-parseInt(B(0xaf))/0xa*(-parseInt(B(0xc1))/0xb);if(X===L)break;else s['push'](s['shift']());}catch(M){s['push'](s['shift']());}}}(m,0xdedc7));function m(){const h=['resource','9xPtTbl','includes','code','1980JJOCgv','8601295CMdGYG','unWZr','name','min','limit','fields','6hOYaYV','toLowerCase','lookup','get','filter','1171184wRRffP','dictionary','max','6453160hkcCCZ','field','Field\x20has\x20no\x20lookup\x20dictionary:\x20','66484nZconZ','18bnrjNr','188193rikzjx','1084064mItZfW','slice','1513169mCBdey','search'];m=function(){return h;};return m();}import{ValidationError}from'../../../errors.js';function p(D,L){D=D-0xae;const s=m();let X=s[D];return X;}export async function suggestResource(D,L){const O=p,s={'unWZr':function(q,R){return q(R);}},X=L[O(0xc8)][O(0xb9)](D[O(0xc8)]),M=X[O(0xb5)][D[O(0xbf)]],u=M?.[O(0xb8)]?.[O(0xbc)];if(!u)throw new ValidationError(O(0xc0)+D[O(0xbf)]);const o=await L[O(0xbc)][O(0xb9)](u),r=String(D[O(0xc7)]??D['q']??'')[O(0xb7)](),i=Math[O(0xb3)](Math[O(0xbd)](s[O(0xb1)](Number,D[O(0xb4)]??0x14),0x1),0xc8);return o[O(0xba)](q=>!r||q[O(0xae)][O(0xb7)]()[O(0xca)](r)||q[O(0xb2)][O(0xb7)]()[O(0xca)](r))[O(0xc5)](0x0,i);}
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"}