@opengis/fcore 0.0.28 → 0.0.29

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 (102) hide show
  1. package/dist/config.js +1 -1
  2. package/dist/context.js +1 -1
  3. package/dist/errors.js +1 -1
  4. package/dist/fastify.js +1 -1
  5. package/dist/fcore.js +1 -1
  6. package/dist/migrations/cli.js +1 -1
  7. package/dist/migrations/runner.js +1 -1
  8. package/dist/modules/auth/adduser-cli.js +1 -1
  9. package/dist/modules/auth/passwd-cli.js +1 -1
  10. package/dist/modules/auth/permission-cli.js +1 -1
  11. package/dist/modules/auth/route.js +1 -1
  12. package/dist/modules/auth/schema.js +1 -1
  13. package/dist/modules/auth/services/change-password.js +1 -1
  14. package/dist/modules/auth/services/get-current-user.js +1 -1
  15. package/dist/modules/auth/services/registration.js +1 -1
  16. package/dist/modules/auth/services/verify-two-factor.js +1 -1
  17. package/dist/modules/file/mime.js +1 -1
  18. package/dist/modules/file/route.js +1 -1
  19. package/dist/modules/file/schema.js +1 -1
  20. package/dist/modules/file/services/get-file.js +1 -1
  21. package/dist/modules/file/services/resize-file.js +1 -1
  22. package/dist/modules/file/services/upload-file.js +1 -1
  23. package/dist/modules/resource/route.js +1 -1
  24. package/dist/modules/resource/schema.js +1 -1
  25. package/dist/modules/resource/services/add-note.js +1 -1
  26. package/dist/modules/resource/services/add-resource-file.js +1 -1
  27. package/dist/modules/resource/services/create-resource-relation.js +1 -1
  28. package/dist/modules/resource/services/create-resource.js +1 -1
  29. package/dist/modules/resource/services/delete-resource-relation.js +1 -1
  30. package/dist/modules/resource/services/delete-resource.js +1 -1
  31. package/dist/modules/resource/services/export-resource.js +1 -1
  32. package/dist/modules/resource/services/generate-resource-code.js +1 -1
  33. package/dist/modules/resource/services/get-resource-schema.js +1 -1
  34. package/dist/modules/resource/services/get-resource.js +1 -1
  35. package/dist/modules/resource/services/list-resource-as-user.js +1 -1
  36. package/dist/modules/resource/services/list-resource-list.js +1 -1
  37. package/dist/modules/resource/services/list-resource-relation.js +1 -1
  38. package/dist/modules/resource/services/list-resources.js +1 -1
  39. package/dist/modules/resource/services/search-resource.js +1 -1
  40. package/dist/modules/resource/services/suggest-resource.js +1 -1
  41. package/dist/modules/resource/services/update-resource-relation.js +1 -1
  42. package/dist/modules/resource/services/update-resource.js +1 -1
  43. package/dist/modules/resource/services/upload-resource-file.js +1 -1
  44. package/dist/modules/system/route.js +1 -1
  45. package/dist/modules/system/schema.js +1 -1
  46. package/dist/modules/system/services/check-system.js +1 -1
  47. package/dist/modules/system/services/get-access.js +1 -1
  48. package/dist/modules/system/services/get-api-list.js +1 -1
  49. package/dist/modules/system/services/get-audit-log.js +1 -1
  50. package/dist/modules/system/services/get-dictionary.js +1 -1
  51. package/dist/modules/system/services/get-resource-access.js +1 -1
  52. package/dist/modules/system/services/get-resource-scopes.js +1 -1
  53. package/dist/modules/system/services/get-system-log.js +1 -1
  54. package/dist/modules/system/services/get-system-settings.js +1 -1
  55. package/dist/modules/system/services/list-dictionaries.js +1 -1
  56. package/dist/modules/system/services/set-access.js +1 -1
  57. package/dist/modules/system/services/set-resource-access.js +1 -1
  58. package/dist/modules/system/services/set-resource-scopes.js +1 -1
  59. package/dist/modules/system/services/update-dictionary.js +1 -1
  60. package/dist/modules/system/services/update-system-settings.js +1 -1
  61. package/dist/modules/utils/require-admin.js +1 -1
  62. package/dist/modules/utils/safe-user.js +1 -1
  63. package/dist/modules/utils/unsupported.js +1 -1
  64. package/dist/plugins/audit/audit.js +1 -1
  65. package/dist/plugins/audit/services/write-audit.js +1 -1
  66. package/dist/plugins/auth/get-user-permissions.js +1 -1
  67. package/dist/plugins/auth/index.js +1 -1
  68. package/dist/plugins/auth/verifyUser.js +1 -1
  69. package/dist/plugins/dictionary.js +1 -1
  70. package/dist/plugins/file.js +1 -1
  71. package/dist/plugins/jwt.js +1 -1
  72. package/dist/plugins/logger/index.js +1 -1
  73. package/dist/plugins/logger/transport.js +1 -1
  74. package/dist/plugins/pg.js +1 -1
  75. package/dist/plugins/redis.js +1 -1
  76. package/dist/plugins/resource/resource.js +1 -1
  77. package/dist/plugins/resource/resource.registry.js +1 -1
  78. package/dist/plugins/resource/services/add-dictionary-lookup-data.js +1 -1
  79. package/dist/plugins/resource/services/add-file-token.js +1 -1
  80. package/dist/plugins/resource/services/add-table-lookup-data.js +1 -1
  81. package/dist/plugins/resource/services/create-relation.js +1 -1
  82. package/dist/plugins/resource/services/create.js +1 -1
  83. package/dist/plugins/resource/services/delete-relation.js +1 -1
  84. package/dist/plugins/resource/services/delete.js +1 -1
  85. package/dist/plugins/resource/services/find-one.js +1 -1
  86. package/dist/plugins/resource/services/find-relation.js +1 -1
  87. package/dist/plugins/resource/services/find.js +1 -1
  88. package/dist/plugins/resource/services/get-table-columns.js +1 -1
  89. package/dist/plugins/resource/services/update-relation.js +1 -1
  90. package/dist/plugins/resource/services/update.js +1 -1
  91. package/dist/plugins/resource/utils/auto-index.js +1 -1
  92. package/dist/plugins/resource/utils/fields.js +1 -1
  93. package/dist/plugins/resource/utils/filters.js +1 -1
  94. package/dist/plugins/resource/utils/permissions.js +1 -1
  95. package/dist/plugins/resource/utils/scope.js +1 -1
  96. package/dist/plugins/resource/utils/sort.js +1 -1
  97. package/dist/plugins/resource/utils/sql.js +1 -1
  98. package/dist/plugins/resource/utils/summary.js +1 -1
  99. package/dist/shared/getIP.js +1 -1
  100. package/migrations/20260903140000_settings_nulls_not_distinct.sql +1 -1
  101. package/migrations/20260905120000_add_user_foreign_keys.sql +15 -0
  102. package/package.json +1 -1
@@ -1 +1 @@
1
- function f(p,Z){p=p-0x1ce;const A=s();let I=A[p];return I;}function s(){const a=['aggregate','where','))::int\x20AS\x20\x22',')\x20AS\x20\x22',')\x20FILTER\x20(where\x20','true','MIN(','max','filter','\x20AND\x20','default','keys','searchable','push','sql','values','item','map','SELECT\x20'];s=function(){return a;};return s();}import{buildFilters}from'./filters.js';import{qt}from'./sql.js';const defaultSummary={'count':{'aggregate':'count'}};export function buildSummary(p,Z,A,I){const E=f,j={...defaultSummary,...p['summary']??{}},D=Object['entries'](j)['map'](([g,N])=>{const h=f;if('sql'in N)return'('+N['sql']+')\x20AS\x20\x22'+g+'\x22';switch(N[h(0x1ce)]){case'count':return'(COUNT(*)\x20FILTER\x20(where\x20'+(N[h(0x1cf)]??'true')+h(0x1d0)+g+'\x22';case'countDistinct':return'(COUNT(DISTINCT\x20t.'+qt(N['field'])+')\x20FILTER\x20(where\x20'+(N['where']??'true')+'))::int\x20AS\x20\x22'+g+'\x22';case'sum':return'SUM('+N['field']+')\x20FILTER\x20(where\x20'+(N['where']??'true')+h(0x1d1)+g+'\x22';case'avg':return'AVG('+N['field']+h(0x1d2)+(N['where']??h(0x1d3))+h(0x1d1)+g+'\x22';case'min':return h(0x1d4)+N['field']+')\x20FILTER\x20(where\x20'+(N['where']??'true')+h(0x1d1)+g+'\x22';case h(0x1d5):return'MAX('+N['field']+')\x20FILTER\x20(where\x20'+(N['where']??'true')+h(0x1d1)+g+'\x22';}}),o=buildFilters(p,Z[E(0x1d6)]);p['where']&&(o['sql']+=(o['sql']?E(0x1d7):'\x20WHERE\x20')+('('+p['where']+')'));const R=Z['scope']||(p['scopes']?.[E(0x1d8)]?'default':undefined);R&&(o['sql']+=(o['sql']?'\x20AND\x20':'\x20WHERE\x20')+('('+(p['scopes']?.[R]||'true')+')'));const B=p['searchable']||Object[E(0x1d9)](p['fields'])[E(0x1d6)](g=>p['fields'][g]?.[E(0x1da)]);Z['search']&&B['length']&&(o['values'][E(0x1db)](Z['search']['toLowerCase']()+'%'),o[E(0x1dc)]+=(o[E(0x1dc)]?E(0x1d7):'\x20WHERE\x20')+('\x20('+B['map'](g=>'lower('+qt(g)+')\x20LIKE\x20$'+o[E(0x1dd)]['length'])['join']('\x20OR\x20')+')'));I?.['sql']&&(o['sql']+=(o[E(0x1dc)]?E(0x1d7):'\x20WHERE\x20')+('('+I[E(0x1dc)]+')'),o['values']['push'](...I['values']));const H=p['joins']?.['filter'](g=>g['scope']!==E(0x1de))[E(0x1df)](g=>g['sql']+'\x20')['join']('\x20')||'',e=E(0x1e0)+D['join'](',\x20')+'\x20'+('FROM\x20'+qt(p['table'])+'\x20t\x20')+(H+'\x20'+o[E(0x1dc)]['replace'](/:uid/g,'\x27'+(A?.['id']??'NULL')+'\x27'));return{'sql':e,'values':o['values']};}
1
+ import{buildFilters}from'./filters.js';function c(S,Z){S=S-0x16b;const h=O();let U=h[S];return U;}import{qt}from'./sql.js';const defaultSummary={'count':{'aggregate':'count'}};export function buildSummary(S,Z,h,U){const X=c,D={...defaultSummary,...S['summary']??{}},u=Object[X(0x16b)](D)[X(0x16c)](([o,j])=>{const i=X;if('sql'in j)return'('+j['sql']+')\x20AS\x20\x22'+o+'\x22';switch(j['aggregate']){case'count':return'(COUNT(*)\x20FILTER\x20(where\x20'+(j[i(0x16d)]??'true')+'))::int\x20AS\x20\x22'+o+'\x22';case'countDistinct':return'(COUNT(DISTINCT\x20t.'+qt(j[i(0x16e)])+')\x20FILTER\x20(where\x20'+(j['where']??'true')+'))::int\x20AS\x20\x22'+o+'\x22';case'sum':return i(0x16f)+j['field']+')\x20FILTER\x20(where\x20'+(j['where']??i(0x170))+')\x20AS\x20\x22'+o+'\x22';case i(0x171):return i(0x172)+j['field']+')\x20FILTER\x20(where\x20'+(j['where']??'true')+')\x20AS\x20\x22'+o+'\x22';case'min':return'MIN('+j['field']+')\x20FILTER\x20(where\x20'+(j['where']??'true')+')\x20AS\x20\x22'+o+'\x22';case'max':return i(0x173)+j['field']+i(0x174)+(j[i(0x16d)]??'true')+')\x20AS\x20\x22'+o+'\x22';}}),e=buildFilters(S,Z['filter']);S['where']&&(e[X(0x175)]+=(e['sql']?'\x20AND\x20':X(0x176))+('('+S['where']+')'));const q=Z['scope']||(S['scopes']?.[X(0x177)]?'default':undefined);q&&(e[X(0x175)]+=(e['sql']?X(0x178):'\x20WHERE\x20')+('('+(S['scopes']?.[q]||'true')+')'));const x=S['searchable']||Object['keys'](S['fields'])[X(0x179)](o=>S[X(0x17a)][o]?.['searchable']);Z['search']&&x[X(0x17b)]&&(e['values']['push'](Z[X(0x17c)]['toLowerCase']()+'%'),e['sql']+=(e['sql']?'\x20AND\x20':'\x20WHERE\x20')+('\x20('+x['map'](o=>X(0x17d)+qt(o)+X(0x17e)+e['values']['length'])['join']('\x20OR\x20')+')'));U?.['sql']&&(e['sql']+=(e['sql']?X(0x178):'\x20WHERE\x20')+('('+U['sql']+')'),e['values']['push'](...U['values']));const n=S['joins']?.['filter'](o=>o[X(0x17f)]!=='item')['map'](o=>o[X(0x175)]+'\x20')['join']('\x20')||'',N='SELECT\x20'+u[X(0x180)](',\x20')+'\x20'+('FROM\x20'+qt(S['table'])+'\x20t\x20')+(n+'\x20'+e['sql']['replace'](/:uid/g,'\x27'+(h?.['id']??'NULL')+'\x27'));return{'sql':N,'values':e['values']};}function O(){const l=['entries','map','where','field','SUM(','true','avg','AVG(','MAX(',')\x20FILTER\x20(where\x20','sql','\x20WHERE\x20','default','\x20AND\x20','filter','fields','length','search','lower(',')\x20LIKE\x20$','scope','join'];O=function(){return l;};return O();}
@@ -1 +1 @@
1
- function f(p,Z){p=p-0xb7;const A=s();let I=A[p];return I;}const Z=f,getIP=p=>(p['headers']?.['x-real-ip']||p[Z(0xb7)]?.[Z(0xb8)]||p['ip']||p[Z(0xb9)]?.[Z(0xba)]||'')['split'](':')['pop']();function s(){const A=['headers','x-forwarded-for','connection','remoteAddress'];s=function(){return A;};return s();}export default getIP;
1
+ const Z=c,getIP=S=>(S['headers']?.['x-real-ip']||S['headers']?.['x-forwarded-for']||S['ip']||S[Z(0x1c3)]?.['remoteAddress']||'')['split'](':')[Z(0x1c4)]();function c(S,Z){S=S-0x1c3;const h=O();let U=h[S];return U;}export default getIP;function O(){const h=['connection','pop'];O=function(){return h;};return O();}
@@ -14,6 +14,6 @@ CREATE TABLE IF NOT EXISTS admin.settings (
14
14
 
15
15
  DROP INDEX IF EXISTS settings_resource_key_uidx;
16
16
 
17
- CREATE UNIQUE INDEX settings_resource_key_uidx
17
+ CREATE UNIQUE INDEX if not exists settings_resource_key_uidx
18
18
  ON admin.settings (resource, resource_id, key)
19
19
  NULLS NOT DISTINCT;
@@ -1,16 +1,23 @@
1
1
  ALTER TABLE admin.users
2
+ DROP CONSTRAINT IF EXISTS users_created_by_fkey,
3
+ DROP CONSTRAINT IF EXISTS users_updated_by_fkey,
2
4
  ADD CONSTRAINT users_created_by_fkey
3
5
  FOREIGN KEY (created_by) REFERENCES admin.users(uid) ON DELETE SET NULL,
4
6
  ADD CONSTRAINT users_updated_by_fkey
5
7
  FOREIGN KEY (updated_by) REFERENCES admin.users(uid) ON DELETE SET NULL;
6
8
 
7
9
  ALTER TABLE admin.user_roles
10
+ DROP CONSTRAINT IF EXISTS user_roles_created_by_fkey,
11
+ DROP CONSTRAINT IF EXISTS user_roles_updated_by_fkey,
8
12
  ADD CONSTRAINT user_roles_created_by_fkey
9
13
  FOREIGN KEY (created_by) REFERENCES admin.users(uid) ON DELETE SET NULL,
10
14
  ADD CONSTRAINT user_roles_updated_by_fkey
11
15
  FOREIGN KEY (updated_by) REFERENCES admin.users(uid) ON DELETE SET NULL;
12
16
 
13
17
  ALTER TABLE admin.role_access
18
+ DROP CONSTRAINT IF EXISTS role_access_user_uid_fkey,
19
+ DROP CONSTRAINT IF EXISTS role_access_created_by_fkey,
20
+ DROP CONSTRAINT IF EXISTS role_access_updated_by_fkey,
14
21
  ADD CONSTRAINT role_access_user_uid_fkey
15
22
  FOREIGN KEY (user_uid) REFERENCES admin.users(uid) ON DELETE CASCADE,
16
23
  ADD CONSTRAINT role_access_created_by_fkey
@@ -19,24 +26,32 @@ ALTER TABLE admin.role_access
19
26
  FOREIGN KEY (updated_by) REFERENCES admin.users(uid) ON DELETE SET NULL;
20
27
 
21
28
  ALTER TABLE admin.dictionaries
29
+ DROP CONSTRAINT IF EXISTS dictionaries_created_by_fkey,
30
+ DROP CONSTRAINT IF EXISTS dictionaries_updated_by_fkey,
22
31
  ADD CONSTRAINT dictionaries_created_by_fkey
23
32
  FOREIGN KEY (created_by) REFERENCES admin.users(uid) ON DELETE SET NULL,
24
33
  ADD CONSTRAINT dictionaries_updated_by_fkey
25
34
  FOREIGN KEY (updated_by) REFERENCES admin.users(uid) ON DELETE SET NULL;
26
35
 
27
36
  ALTER TABLE admin.notes
37
+ DROP CONSTRAINT IF EXISTS notes_created_by_fkey,
38
+ DROP CONSTRAINT IF EXISTS notes_updated_by_fkey,
28
39
  ADD CONSTRAINT notes_created_by_fkey
29
40
  FOREIGN KEY (created_by) REFERENCES admin.users(uid) ON DELETE SET NULL,
30
41
  ADD CONSTRAINT notes_updated_by_fkey
31
42
  FOREIGN KEY (updated_by) REFERENCES admin.users(uid) ON DELETE SET NULL;
32
43
 
33
44
  ALTER TABLE admin.files
45
+ DROP CONSTRAINT IF EXISTS files_created_by_fkey,
46
+ DROP CONSTRAINT IF EXISTS files_updated_by_fkey,
34
47
  ADD CONSTRAINT files_created_by_fkey
35
48
  FOREIGN KEY (created_by) REFERENCES admin.users(uid) ON DELETE SET NULL,
36
49
  ADD CONSTRAINT files_updated_by_fkey
37
50
  FOREIGN KEY (updated_by) REFERENCES admin.users(uid) ON DELETE SET NULL;
38
51
 
39
52
  ALTER TABLE admin.settings
53
+ DROP CONSTRAINT IF EXISTS settings_created_by_fkey,
54
+ DROP CONSTRAINT IF EXISTS settings_updated_by_fkey,
40
55
  ADD CONSTRAINT settings_created_by_fkey
41
56
  FOREIGN KEY (created_by) REFERENCES admin.users(uid) ON DELETE SET NULL,
42
57
  ADD CONSTRAINT settings_updated_by_fkey
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fcore",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "Reusable backend foundation for OpenGIS Node.js applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",