@opengis/fcore 0.0.1-beta.6 → 0.0.1-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.js +1 -1
- package/dist/context.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/fastify.d.ts +2 -1
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fcore.js +1 -1
- package/dist/migrations/cli.js +1 -1
- package/dist/migrations/runner.js +1 -1
- package/dist/modules/auth/adduser-cli.js +1 -1
- package/dist/modules/auth/passwd-cli.js +1 -1
- package/dist/modules/auth/permission-cli.js +1 -1
- package/dist/modules/auth/route.d.ts.map +1 -1
- package/dist/modules/auth/route.js +1 -1
- package/dist/modules/auth/schema.d.ts +3 -0
- package/dist/modules/auth/schema.d.ts.map +1 -1
- package/dist/modules/auth/schema.js +1 -1
- package/dist/modules/auth/services/change-password.js +1 -1
- package/dist/modules/auth/services/get-current-user.d.ts +1 -0
- package/dist/modules/auth/services/get-current-user.d.ts.map +1 -1
- package/dist/modules/auth/services/get-current-user.js +1 -1
- package/dist/modules/auth/services/registration.js +1 -1
- package/dist/modules/auth/services/verify-two-factor.js +1 -1
- package/dist/modules/file/mime.d.ts +3 -0
- package/dist/modules/file/mime.d.ts.map +1 -0
- package/dist/modules/file/mime.js +1 -0
- package/dist/modules/file/route.d.ts.map +1 -1
- package/dist/modules/file/route.js +1 -1
- package/dist/modules/file/schema.d.ts +3 -0
- package/dist/modules/file/schema.d.ts.map +1 -1
- package/dist/modules/file/schema.js +1 -1
- package/dist/modules/file/services/get-file.js +1 -1
- package/dist/modules/file/services/resize-file.d.ts.map +1 -1
- package/dist/modules/file/services/resize-file.js +1 -1
- package/dist/modules/file/services/upload-file.d.ts +4 -6
- package/dist/modules/file/services/upload-file.d.ts.map +1 -1
- package/dist/modules/file/services/upload-file.js +1 -1
- package/dist/modules/resource/route.d.ts +0 -3
- package/dist/modules/resource/route.d.ts.map +1 -1
- package/dist/modules/resource/route.js +1 -1
- package/dist/modules/resource/schema.d.ts +3 -0
- package/dist/modules/resource/schema.d.ts.map +1 -1
- package/dist/modules/resource/schema.js +1 -1
- package/dist/modules/resource/services/add-note.js +1 -1
- package/dist/modules/resource/services/add-resource-file.js +1 -1
- package/dist/modules/resource/services/create-resource-relation.js +1 -1
- package/dist/modules/resource/services/create-resource.js +1 -1
- package/dist/modules/resource/services/delete-resource-relation.js +1 -1
- package/dist/modules/resource/services/delete-resource.js +1 -1
- package/dist/modules/resource/services/export-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/export-resource.js +1 -1
- package/dist/modules/resource/services/get-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/get-resource.js +1 -1
- package/dist/modules/resource/services/list-resource-relation.d.ts +2 -0
- package/dist/modules/resource/services/list-resource-relation.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resource-relation.js +1 -1
- package/dist/modules/resource/services/list-resources.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resources.js +1 -1
- package/dist/modules/resource/services/search-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/search-resource.js +1 -1
- package/dist/modules/resource/services/suggest-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/suggest-resource.js +1 -1
- package/dist/modules/resource/services/update-resource-relation.d.ts +10 -0
- package/dist/modules/resource/services/update-resource-relation.d.ts.map +1 -0
- package/dist/modules/resource/services/update-resource-relation.js +1 -0
- package/dist/modules/resource/services/update-resource.js +1 -1
- package/dist/modules/resource/services/upload-resource-file.js +1 -1
- package/dist/modules/system/route.d.ts.map +1 -1
- package/dist/modules/system/route.js +1 -1
- package/dist/modules/system/schema.js +1 -1
- package/dist/modules/system/services/check-system.d.ts.map +1 -1
- package/dist/modules/system/services/check-system.js +1 -1
- package/dist/modules/system/services/get-access.d.ts.map +1 -1
- package/dist/modules/system/services/get-access.js +1 -1
- package/dist/modules/system/services/get-api-list.d.ts.map +1 -1
- package/dist/modules/system/services/get-api-list.js +1 -1
- package/dist/modules/system/services/get-audit-log.d.ts.map +1 -1
- package/dist/modules/system/services/get-audit-log.js +1 -1
- package/dist/modules/system/services/get-dictionary.js +1 -1
- package/dist/modules/system/services/get-system-log.d.ts.map +1 -1
- package/dist/modules/system/services/get-system-log.js +1 -1
- package/dist/modules/system/services/get-system-settings.d.ts.map +1 -1
- package/dist/modules/system/services/get-system-settings.js +1 -1
- package/dist/modules/system/services/list-dictionaries.js +1 -1
- package/dist/modules/system/services/set-access.d.ts.map +1 -1
- package/dist/modules/system/services/set-access.js +1 -1
- package/dist/modules/system/services/update-dictionary.d.ts.map +1 -1
- package/dist/modules/system/services/update-dictionary.js +1 -1
- package/dist/modules/system/services/update-system-settings.d.ts.map +1 -1
- package/dist/modules/system/services/update-system-settings.js +1 -1
- package/dist/modules/utils/require-admin.js +1 -1
- package/dist/modules/utils/safe-user.js +1 -1
- package/dist/modules/utils/unsupported.js +1 -1
- package/dist/plugins/audit/audit.js +1 -1
- package/dist/plugins/audit/services/write-audit.js +1 -1
- package/dist/plugins/auth/get-user-permissions.js +1 -1
- package/dist/plugins/auth/index.d.ts.map +1 -1
- package/dist/plugins/auth/index.js +1 -1
- package/dist/plugins/auth/verifyUser.js +1 -1
- package/dist/plugins/dictionary.d.ts +3 -0
- package/dist/plugins/dictionary.d.ts.map +1 -1
- package/dist/plugins/dictionary.js +1 -1
- package/dist/plugins/file.d.ts +3 -6
- package/dist/plugins/file.d.ts.map +1 -1
- package/dist/plugins/file.js +1 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/jwt.d.ts +4 -0
- package/dist/plugins/jwt.d.ts.map +1 -0
- package/dist/plugins/jwt.js +1 -0
- package/dist/plugins/logger/index.js +1 -1
- package/dist/plugins/logger/transport.js +1 -1
- package/dist/plugins/pg.d.ts.map +1 -1
- package/dist/plugins/pg.js +1 -1
- package/dist/plugins/redis.js +1 -1
- package/dist/plugins/resource/resource.d.ts.map +1 -1
- package/dist/plugins/resource/resource.js +1 -1
- package/dist/plugins/resource/resource.registry.js +1 -1
- package/dist/plugins/resource/resource.types.d.ts +18 -3
- package/dist/plugins/resource/resource.types.d.ts.map +1 -1
- package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts +3 -0
- package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-dictionary-lookup-data.js +1 -0
- package/dist/plugins/resource/services/add-file-token.d.ts +3 -0
- package/dist/plugins/resource/services/add-file-token.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-file-token.js +1 -0
- package/dist/plugins/resource/services/add-table-lookup-data.d.ts +4 -0
- package/dist/plugins/resource/services/add-table-lookup-data.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-table-lookup-data.js +1 -0
- package/dist/plugins/resource/services/create-relation.js +1 -1
- package/dist/plugins/resource/services/create.d.ts.map +1 -1
- package/dist/plugins/resource/services/create.js +1 -1
- package/dist/plugins/resource/services/delete-relation.js +1 -1
- package/dist/plugins/resource/services/delete.d.ts.map +1 -1
- package/dist/plugins/resource/services/delete.js +1 -1
- package/dist/plugins/resource/services/find-one.d.ts +3 -2
- package/dist/plugins/resource/services/find-one.d.ts.map +1 -1
- package/dist/plugins/resource/services/find-one.js +1 -1
- package/dist/plugins/resource/services/find-relation.d.ts +3 -2
- package/dist/plugins/resource/services/find-relation.d.ts.map +1 -1
- package/dist/plugins/resource/services/find-relation.js +1 -1
- package/dist/plugins/resource/services/find.d.ts.map +1 -1
- package/dist/plugins/resource/services/find.js +1 -1
- package/dist/plugins/resource/services/update-relation.d.ts +11 -0
- package/dist/plugins/resource/services/update-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/update-relation.js +1 -0
- package/dist/plugins/resource/services/update.d.ts.map +1 -1
- package/dist/plugins/resource/services/update.js +1 -1
- package/dist/plugins/resource/utils/auto-index.d.ts +4 -0
- package/dist/plugins/resource/utils/auto-index.d.ts.map +1 -0
- package/dist/plugins/resource/utils/auto-index.js +1 -0
- package/dist/plugins/resource/utils/fields.js +1 -1
- package/dist/plugins/resource/utils/filters.d.ts +3 -2
- package/dist/plugins/resource/utils/filters.d.ts.map +1 -1
- package/dist/plugins/resource/utils/filters.js +1 -1
- package/dist/plugins/resource/utils/permissions.js +1 -1
- package/dist/plugins/resource/utils/sort.d.ts.map +1 -1
- package/dist/plugins/resource/utils/sort.js +1 -1
- package/dist/plugins/resource/utils/sql.js +1 -1
- package/dist/shared/getIP.js +1 -1
- package/migrations/20260907090000_core_schema.sql +2 -0
- package/package.json +93 -92
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NotFoundError,ValidationError}from'../../../errors.js';import{assertOperation}from'../utils/permissions.js';import{qi,qt,readableFields,writableData}from'../utils/sql.js';function
|
|
1
|
+
import{NotFoundError,ValidationError}from'../../../errors.js';import{assertOperation}from'../utils/permissions.js';import{qi,qt,readableFields,writableData}from'../utils/sql.js';function A(z,j){z=z-0x1d8;const c=U();let p=c[z];return p;}import{validateInputData}from'../utils/fields.js';import{clearTableLookupCache}from'./add-table-lookup-data.js';function U(){const t=['get','length','No\x20writable\x20fields','map','WHERE\x20','write'];U=function(){return t;};return U();}export function createUpdate(z,j){return async function c({name:p,id:M,data:H,user:i}){const P=A,b=j[P(0x1d8)](p);assertOperation(b,'update',i);const n=writableData(b,H);if(!n[P(0x1d9)])throw new ValidationError(P(0x1da));if(!z['pg'])throw new Error('empty\x20pg');validateInputData({'resource':b,'data':H,'update':!![]}),delete H['user_type'];const v=n['map'](([e],o)=>qi(e)+'\x20=\x20$'+(o+0x1)),r=[...n[P(0x1db)](([,e])=>e),M],q=await z['pg']['query']('UPDATE\x20'+qt(b['table'])+'\x20'+('SET\x20'+v['join'](',\x20')+'\x20')+(P(0x1dc)+qi(b['key'])+'\x20=\x20$'+(n['length']+0x1)+'\x20')+('RETURNING\x20'+readableFields(b)['join'](',\x20')),r),Z=q['rows'][0x0];if(!Z)throw new NotFoundError(p+':'+M);return clearTableLookupCache(b['table'],z['pg']),await z['audit']?.[P(0x1dd)]({'userId':i?.['id'],'module':b['module'],'resource':b['name'],'resourceId':M,'action':'update','fields':Object['keys'](H)}),Z;};}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DatabaseAdapter } from "../../pg.js";
|
|
2
|
+
export type AutoIndexType = "text" | "btree" | "gist";
|
|
3
|
+
export declare function autoIndex(table: string, column: string, type: AutoIndexType | undefined, pg: DatabaseAdapter): void;
|
|
4
|
+
//# sourceMappingURL=auto-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/resource/utils/auto-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAItD,wBAAgB,SAAS,CACrB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,aAAa,YAAU,EAC7B,EAAE,EAAE,eAAe,GACpB,IAAI,CAWN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=A;import{qi,qt}from'./sql.js';const requestedIndexes=new WeakMap();function A(z,j){z=z-0xb8;const c=U();let p=c[z];return p;}export function autoIndex(z,j,c=n(0xb8),p){const v=n,M=requestedIndexes['get'](p)??new Set();requestedIndexes[v(0xb9)](p,M);const H=z+':'+j+':'+c;if(M['has'](H))return;M['add'](H),void ensureIndex(z,j,c,p)['catch'](()=>{M['delete'](H);});}function U(){const q=['btree','set','public','replace','query','text','CREATE\x20EXTENSION\x20IF\x20NOT\x20EXISTS\x20pg_trgm','CREATE\x20INDEX\x20IF\x20NOT\x20EXISTS\x20','\x20ON\x20'];U=function(){return q;};return U();}async function ensureIndex(z,j,c,p){const r=n,M=z['split']('.'),H=M['length']===0x2?M[0x0]:r(0xba),i=(z+'_'+j+'_'+c+'_idx')[r(0xbb)](/[^A-Za-z0-9_]/g,'_'),b=await p[r(0xbc)]('SELECT\x201\x20FROM\x20pg_indexes\x20WHERE\x20schemaname\x20=\x20$1\x20AND\x20indexname\x20=\x20$2',[H,i]);if(b['rowCount'])return;if(c===r(0xbd)){await p['query'](r(0xbe)),await p['query']('CREATE\x20INDEX\x20IF\x20NOT\x20EXISTS\x20'+qi(i+'_l')+'\x20ON\x20'+qt(z)+'\x20USING\x20btree\x20(lower('+qi(j)+')\x20text_pattern_ops)'),await p['query']('CREATE\x20INDEX\x20IF\x20NOT\x20EXISTS\x20'+qi(i)+'\x20ON\x20'+qt(z)+'\x20USING\x20gin\x20(lower('+qi(j)+')\x20gin_trgm_ops)');return;}await p['query'](r(0xbf)+qi(i)+r(0xc0)+qt(z)+'\x20USING\x20'+c+'\x20('+qi(j)+')');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{ValidationError}from'../../../errors.js';function U(){const H=['entries','fields','required','writable','string','maxLength\x20exceeded:\x20','minimum','maximum','\x20should\x20be\x20<=\x20','\x20should\x20be\x20one\x20of\x20(','enum','pattern'];U=function(){return H;};return U();}function A(z,j){z=z-0x11c;const c=U();let p=c[z];return p;}export{readableFields,writableData,fieldColumn}from'./sql.js';const validateInputData=({resource:z,data:j,update:update=![]})=>{const M=A;for(const [c,p]of Object[M(0x11c)](z[M(0x11d)])){if(p[M(0x11e)]&&p['writable']!==![]&&(j[c]===undefined||j[c]===null)&&!update)throw new ValidationError('Required\x20field:\x20'+c);if(p['required']&&p[M(0x11f)]!==![]&&Object['hasOwn'](j,c)&&(j[c]===undefined||j[c]===null)&&update)throw new ValidationError('Required\x20field:\x20'+c);if(p['minLength']&&typeof j[c]===M(0x120)&&j[c]['length']<p['minLength'])throw new ValidationError('minLength\x20not\x20met:\x20'+c);if(p['maxLength']&&typeof j[c]==='string'&&j[c]['length']>p['maxLength'])throw new ValidationError(M(0x121)+c);if(p[M(0x122)]&&typeof j[c]==='number'&&j[c]<p['minimum'])throw new ValidationError(c+'\x20should\x20be\x20>=\x20'+p['minimum']);if(p[M(0x123)]&&typeof j[c]==='number'&&j[c]>p['maximum'])throw new ValidationError(c+M(0x124)+p['maximum']);if(p['enum']&&j[c]&&!p['enum']['includes'](j[c]))throw new ValidationError(c+M(0x125)+p[M(0x126)]['join'](',\x20')+')');if(p[M(0x127)]&&typeof j[c]===M(0x120)&&!new RegExp(p[M(0x127)])['test'](j[c]))throw new ValidationError(c+'\x20should\x20match\x20regular\x20expression\x20('+p['pattern']+')');}};export{validateInputData};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Provides Resource helpers for filters handling.
|
|
3
3
|
*/
|
|
4
|
-
import type { ResourceContract } from '../resource.types.js';
|
|
5
|
-
export declare function
|
|
4
|
+
import type { ResourceContract, ResourceDependencies } from '../resource.types.js';
|
|
5
|
+
export declare function parseFilterQuery(query: Record<string, unknown>): Record<string, unknown> | undefined;
|
|
6
|
+
export declare function buildFilters(resource: ResourceContract, filter: Record<string, unknown> | undefined, start?: number, pg?: ResourceDependencies['pg']): {
|
|
6
7
|
sql: string;
|
|
7
8
|
values: unknown[];
|
|
8
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../../src/plugins/resource/utils/filters.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../../src/plugins/resource/utils/filters.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AASnF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CA2BpG;AAED,wBAAgB,YAAY,CACxB,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,KAAK,SAAI,EACT,EAAE,CAAC,EAAE,oBAAoB,CAAC,IAAI,CAAC;;;EAgElC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fieldColumn,qi}from'./sql.js';
|
|
1
|
+
const t=A;import{fieldColumn,qi}from'./sql.js';import{ValidationError}from'../../../errors.js';import{autoIndex}from'./auto-index.js';const filterOperators=new Set(['eq','ne','gt',t(0x72),'lt','lte','in','nin','like','ilike','null']);function U(){const R=['gte','filter','keys','fields','Field\x20is\x20not\x20filterable:\x20','entries','Unsupported\x20filter\x20operator:\x20','like','ilike','\x20requires\x20a\x20text\x20field:\x20','null','push','=\x20ANY','length','isArray','true','text','geom','geometry','btree'];U=function(){return R;};return U();}export function parseFilterQuery(z){const g=t,j={...isRecord(z[g(0x73)])?z[g(0x73)]:{}};for(const [c,p]of Object['entries'](z)){const M=/^filter\[([^\]]+)\](?:\[([^\]]+)\])?$/['exec'](c);if(!M)continue;const [,H,i]=M;if(!H)continue;if(!i){j[H]=p;continue;}if(!filterOperators['has'](i))throw new ValidationError('Unsupported\x20filter\x20operator:\x20'+i);const b=isRecord(j[H])?j[H]:{};b[i]=(i==='in'||i==='nin')&&typeof p==='string'?p['split'](','):p,j[H]=b;}return Object[g(0x74)](j)['length']?j:undefined;}export function buildFilters(z,j,c=0x1,p){const y=t,M=[],H=[];for(const [i,b]of Object['entries'](j??{})){const n=z[y(0x75)][i];if(!n||n['filter']!==!![]&&n['filterable']!==!![])throw new ValidationError(y(0x76)+i);const v=qi(fieldColumn(z,i)),r=isRecord(b)?b:{'eq':b};for(const [q,Z]of Object[y(0x77)](r)){if(!filterOperators['has'](q))throw new ValidationError(y(0x78)+q);if((q===y(0x79)||q===y(0x7a))&&n['type']!=='string'&&n['type']!=='text')throw new ValidationError('Operator\x20'+q+y(0x7b)+i);p&&autoIndex(z['table'],fieldColumn(z,i),indexTypeFor(n['type'],q),p);if(q===y(0x7c)){M['push'](v+'\x20IS\x20'+(isTruthy(Z)?'':'NOT\x20')+'NULL');continue;}if(q==='in'||q==='nin'){const P=Array['isArray'](Z)?Z:[Z];if(P['length']===0x0){M['push'](q==='in'?'FALSE':'TRUE');continue;}H['push'](P),M[y(0x7d)](v+'\x20'+(q==='in'?y(0x7e):'<>\x20ALL')+'($'+(c+H['length']-0x1)+')');continue;}const e={'eq':'=','ne':'<>','gt':'>','gte':'>=','lt':'<','lte':'<=','like':y(0x79)},o='$'+(c+H['length']);if(q==='like'){H[y(0x7d)](Z+'%'),M['push']('lower('+v+')\x20like\x20lower('+o+')');continue;}H['push'](Z),M[y(0x7d)](v+'\x20'+e[q]+'\x20'+o);}}return{'sql':M[y(0x7f)]?'\x20WHERE\x20'+M['join']('\x20AND\x20'):'','values':H};}function isRecord(z){const B=t;return typeof z==='object'&&z!==null&&!Array[B(0x80)](z);}function A(z,j){z=z-0x72;const c=U();let p=c[z];return p;}function isTruthy(z){const Y=t;return z===!![]||z===Y(0x81)||z==='1'||z===0x1;}function indexTypeFor(z,j){const s=t;if(j==='like'||j==='ilike')return s(0x82);if(z===s(0x83)||z===s(0x84))return'gist';return s(0x85);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ForbiddenError}from'../../../errors.js';function
|
|
1
|
+
import{ForbiddenError}from'../../../errors.js';function A(z,j){z=z-0x1d7;const c=U();let p=c[z];return p;}function U(){const i=['name','public','Authentication\x20required','admin','type','permissions','Missing\x20permission:\x20'];U=function(){return i;};return U();}import{getContext}from'../../../index.js';export function assertOperation(z,j,c){const H=A,p=getContext()['config'];if(p['debug'])return;if(!z['operations']['includes'](j))throw new ForbiddenError(z[H(0x1d7)]+'.'+j+'\x20is\x20disabled');if(z['access']!==H(0x1d8)&&c===undefined)throw new ForbiddenError(H(0x1d9));if(z['access']===H(0x1da)&&c?.[H(0x1db)]!=='admin')throw new ForbiddenError('Admin\x20access\x20required');if(c?.['type']!=='admin'){const M=(z['permission']??z[H(0x1d7)])+':'+j;if(!c?.[H(0x1dc)]?.['includes'](M))throw new ForbiddenError(H(0x1dd)+M);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../../../src/plugins/resource/utils/sort.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,wBAAgB,SAAS,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../../../src/plugins/resource/utils/sort.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,wBAAgB,SAAS,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,UAgBpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fieldColumn,qi}from'./sql.js';function
|
|
1
|
+
import{fieldColumn,qi}from'./sql.js';function A(z,j){z=z-0xef;const c=U();let p=c[z];return p;}import{ValidationError}from'../../../errors.js';export function buildSort(z,j){if(!j?.['length'])return'';typeof j==='string'&&(j=[j]);const c=j['map'](p=>{const b=A,M=p['startsWith']('-'),H=M?p['slice'](0x1):p,i=z[b(0xef)][H];if(!i||i['sort']!==!![]&&i[b(0xf0)]!==!![])throw new ValidationError('Field\x20is\x20not\x20sortable:\x20'+H);return qi(fieldColumn(z,H))+'\x20'+(M?'DESC':b(0xf1));});return'\x20ORDER\x20BY\x20'+c['join'](',\x20');}function U(){const n=['fields','sortable','ASC'];U=function(){return n;};return U();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const i=A;function U(){const v=['split','join','entries','fields','key','unshift','Field\x20is\x20not\x20writable:\x20'];U=function(){return v;};return U();}import{ValidationError}from'../../../errors.js';export const quoteIdentifier=z=>'\x22'+z['replace'](/"/g,'\x22\x22')+'\x22';export const quoteTable=z=>z[i(0xa5)]('.')['map'](quoteIdentifier)[i(0xa6)]('.');export function fieldColumn(z,j){if(j===z['key'])return z['key'];const c=z['fields'][j];if(!c)throw new ValidationError('Unknown\x20field:\x20'+j);return c['column']??j;}export function readableFields(z){const b=i,j=Object[b(0xa7)](z[b(0xa8)])['filter'](([,c])=>c['read']!==![]&&c['readable']!==![])['map'](([c,p])=>quoteIdentifier(p['column']??c)+'\x20AS\x20'+quoteIdentifier(c));return!z[b(0xa8)][z[b(0xa9)]]&&j[b(0xaa)](quoteIdentifier(z[b(0xa9)])),j;}function A(z,j){z=z-0xa5;const c=U();let p=c[z];return p;}export function writableData(z,j){const n=i,c=[];for(const [p,M]of Object['entries'](j)){const H=z['fields'][p];if(!H||H['write']===![]||H['writable']===![])throw new ValidationError(n(0xab)+p);c['push']([H['column']??p,M]);}return c;}export const qi=quoteIdentifier;export const qt=quoteTable;
|
package/dist/shared/getIP.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function U(){const c=['headers','pop'];U=function(){return c;};return U();}function A(z,j){z=z-0x99;const c=U();let p=c[z];return p;}const j=A,getIP=z=>(z['headers']?.['x-real-ip']||z[j(0x99)]?.['x-forwarded-for']||z['ip']||z['connection']?.['remoteAddress']||'')['split'](':')[j(0x9a)]();export default getIP;
|
package/package.json
CHANGED
|
@@ -1,92 +1,93 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@opengis/fcore",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
4
|
-
"description": "Reusable backend foundation for OpenGIS Node.js applications",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist",
|
|
10
|
-
"migrations",
|
|
11
|
-
"README.md",
|
|
12
|
-
"LICENSE"
|
|
13
|
-
],
|
|
14
|
-
"exports": {
|
|
15
|
-
".": {
|
|
16
|
-
"types": "./dist/index.d.ts",
|
|
17
|
-
"import": "./dist/index.js"
|
|
18
|
-
},
|
|
19
|
-
"./fastify": {
|
|
20
|
-
"types": "./dist/fastify.d.ts",
|
|
21
|
-
"import": "./dist/fastify.js"
|
|
22
|
-
},
|
|
23
|
-
"./migrate": {
|
|
24
|
-
"types": "./dist/migrations/runner.d.ts",
|
|
25
|
-
"import": "./dist/migrations/runner.js"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"bin": {
|
|
29
|
-
"fcore-migrate": "./dist/migrations/cli.js",
|
|
30
|
-
"fcore-adduser": "./dist/modules/auth/adduser-cli.js",
|
|
31
|
-
"fcore-passwd": "./dist/modules/auth/passwd-cli.js",
|
|
32
|
-
"fcore-permission": "./dist/modules/auth/permission-cli.js"
|
|
33
|
-
},
|
|
34
|
-
"scripts": {
|
|
35
|
-
"clean": "rm -rf dist",
|
|
36
|
-
"build": "npm run clean && tsc -p tsconfig.json && node scripts/obfuscate.mjs",
|
|
37
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
38
|
-
"test": "node --test --import tsx test/**/*.test.ts",
|
|
39
|
-
"test-env": "node --env-file=.env.test --test --import tsx test/**/env.test.ts",
|
|
40
|
-
"dev": "bun ./server.ts",
|
|
41
|
-
"adduser": "node --import tsx ./src/modules/auth/adduser-cli.ts",
|
|
42
|
-
"passwd": "node --import tsx ./src/modules/auth/passwd-cli.ts",
|
|
43
|
-
"permission": "node --import tsx ./src/modules/auth/permission-cli.ts",
|
|
44
|
-
"migrate": "node --import tsx src/migrations/cli.ts",
|
|
45
|
-
"migration-test": "node --env-file=.env.test --import tsx src/migrations/cli.ts",
|
|
46
|
-
"prepublishOnly": "npm run build",
|
|
47
|
-
"prepublishOnly1": "npm run build && npm test",
|
|
48
|
-
"patch": "npm version patch && git push && npm publish",
|
|
49
|
-
"minor": "npm version minor && git push && npm publish",
|
|
50
|
-
"major": "npm version major && git push && npm publish"
|
|
51
|
-
},
|
|
52
|
-
"engines": {
|
|
53
|
-
"node": ">=20"
|
|
54
|
-
},
|
|
55
|
-
"dependencies": {
|
|
56
|
-
"@
|
|
57
|
-
"@aws-sdk/
|
|
58
|
-
"@
|
|
59
|
-
"@fastify/
|
|
60
|
-
"@fastify/
|
|
61
|
-
"@fastify/
|
|
62
|
-
"@fastify/
|
|
63
|
-
"@
|
|
64
|
-
"apache-crypt": "1.2.6",
|
|
65
|
-
"dotenv": "17.4.2",
|
|
66
|
-
"fastify-session-redis-store": "7.1.2",
|
|
67
|
-
"file-type": "22.0.2",
|
|
68
|
-
"ioredis": "6.0.0",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"pino
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"@types/
|
|
82
|
-
"@types/passport
|
|
83
|
-
"@types/
|
|
84
|
-
"@types/
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@opengis/fcore",
|
|
3
|
+
"version": "0.0.1-beta.8",
|
|
4
|
+
"description": "Reusable backend foundation for OpenGIS Node.js applications",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"migrations",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./fastify": {
|
|
20
|
+
"types": "./dist/fastify.d.ts",
|
|
21
|
+
"import": "./dist/fastify.js"
|
|
22
|
+
},
|
|
23
|
+
"./migrate": {
|
|
24
|
+
"types": "./dist/migrations/runner.d.ts",
|
|
25
|
+
"import": "./dist/migrations/runner.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"fcore-migrate": "./dist/migrations/cli.js",
|
|
30
|
+
"fcore-adduser": "./dist/modules/auth/adduser-cli.js",
|
|
31
|
+
"fcore-passwd": "./dist/modules/auth/passwd-cli.js",
|
|
32
|
+
"fcore-permission": "./dist/modules/auth/permission-cli.js"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"clean": "rm -rf dist",
|
|
36
|
+
"build": "npm run clean && tsc -p tsconfig.json && node scripts/obfuscate.mjs",
|
|
37
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
38
|
+
"test": "node --test --import tsx test/**/*.test.ts",
|
|
39
|
+
"test-env": "node --env-file=.env.test --test --import tsx test/**/env.test.ts",
|
|
40
|
+
"dev": "bun ./server.ts",
|
|
41
|
+
"adduser": "node --import tsx ./src/modules/auth/adduser-cli.ts",
|
|
42
|
+
"passwd": "node --import tsx ./src/modules/auth/passwd-cli.ts",
|
|
43
|
+
"permission": "node --import tsx ./src/modules/auth/permission-cli.ts",
|
|
44
|
+
"migrate": "node --import tsx src/migrations/cli.ts",
|
|
45
|
+
"migration-test": "node --env-file=.env.test --import tsx src/migrations/cli.ts",
|
|
46
|
+
"prepublishOnly": "npm run build",
|
|
47
|
+
"prepublishOnly1": "npm run build && npm test",
|
|
48
|
+
"patch": "npm version patch && git push && npm publish",
|
|
49
|
+
"minor": "npm version minor && git push && npm publish",
|
|
50
|
+
"major": "npm version major && git push && npm publish"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=20"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@aws-sdk/client-s3": "3.1125.0",
|
|
57
|
+
"@aws-sdk/lib-storage": "3.1125.0",
|
|
58
|
+
"@fastify/cookie": "11.1.2",
|
|
59
|
+
"@fastify/multipart": "10.1.1",
|
|
60
|
+
"@fastify/passport": "4.0.2",
|
|
61
|
+
"@fastify/rate-limit": "11.2.0",
|
|
62
|
+
"@fastify/session": "11.1.2",
|
|
63
|
+
"@sinclair/typebox": "^0.34.52",
|
|
64
|
+
"apache-crypt": "1.2.6",
|
|
65
|
+
"dotenv": "17.4.2",
|
|
66
|
+
"fastify-session-redis-store": "7.1.2",
|
|
67
|
+
"file-type": "22.0.2",
|
|
68
|
+
"ioredis": "6.0.0",
|
|
69
|
+
"jose": "^6.2.12",
|
|
70
|
+
"otplib": "13.5.0",
|
|
71
|
+
"pg": "8.23.0",
|
|
72
|
+
"pino": "10.3.1",
|
|
73
|
+
"pino-abstract-transport": "3.0.0",
|
|
74
|
+
"qrcode": "1.5.4",
|
|
75
|
+
"sharp": "0.35.4"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"fastify": ">=5.12.1"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@types/node": "22.20.1",
|
|
82
|
+
"@types/passport": "1.0.17",
|
|
83
|
+
"@types/passport-local": "1.0.38",
|
|
84
|
+
"@types/pg": "8.23.1",
|
|
85
|
+
"@types/qrcode": "1.5.6",
|
|
86
|
+
"fastify": "5.12.1",
|
|
87
|
+
"javascript-obfuscator": "5.6.0",
|
|
88
|
+
"tsx": "4.23.13",
|
|
89
|
+
"typescript": "7.0.2",
|
|
90
|
+
"vitest": "4.1.11"
|
|
91
|
+
},
|
|
92
|
+
"license": "UNLICENSED"
|
|
93
|
+
}
|