@opengis/fcore 0.0.1-beta.0 → 0.0.1-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -3
- package/README.md +71 -71
- package/dist/config.d.ts +3 -10
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/context.d.ts +4 -4
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/fastify.d.ts +5 -5
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fcore.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/migrations/cli.js +1 -1
- package/dist/migrations/runner.d.ts.map +1 -1
- package/dist/migrations/runner.js +1 -1
- package/dist/modules/auth/adduser-cli.d.ts +3 -0
- package/dist/modules/auth/adduser-cli.d.ts.map +1 -0
- package/dist/modules/auth/adduser-cli.js +2 -0
- package/dist/modules/auth/passwd-cli.d.ts +3 -0
- package/dist/modules/auth/passwd-cli.d.ts.map +1 -0
- package/dist/modules/auth/passwd-cli.js +2 -0
- package/dist/modules/auth/permission-cli.d.ts +3 -0
- package/dist/modules/auth/permission-cli.d.ts.map +1 -0
- package/dist/modules/auth/permission-cli.js +2 -0
- package/dist/modules/auth/route.d.ts.map +1 -1
- package/dist/modules/auth/route.js +1 -1
- package/dist/modules/auth/schema.d.ts +10 -1
- package/dist/modules/auth/schema.d.ts.map +1 -1
- package/dist/modules/auth/schema.js +1 -1
- package/dist/modules/auth/services/change-password.d.ts +9 -0
- package/dist/modules/auth/services/change-password.d.ts.map +1 -0
- package/dist/modules/auth/services/change-password.js +1 -0
- package/dist/modules/auth/services/get-current-user.d.ts +1 -0
- package/dist/modules/auth/services/get-current-user.d.ts.map +1 -1
- package/dist/modules/auth/services/get-current-user.js +1 -1
- package/dist/modules/auth/services/registration.d.ts +14 -0
- package/dist/modules/auth/services/registration.d.ts.map +1 -0
- package/dist/modules/auth/services/registration.js +1 -0
- package/dist/modules/auth/services/verify-two-factor.js +1 -1
- package/dist/modules/file/mime.d.ts +3 -0
- package/dist/modules/file/mime.d.ts.map +1 -0
- package/dist/modules/file/mime.js +1 -0
- package/dist/modules/file/route.d.ts.map +1 -1
- package/dist/modules/file/route.js +1 -1
- package/dist/modules/file/schema.d.ts +3 -0
- package/dist/modules/file/schema.d.ts.map +1 -1
- package/dist/modules/file/schema.js +1 -1
- package/dist/modules/file/services/get-file.js +1 -1
- package/dist/modules/file/services/resize-file.d.ts.map +1 -1
- package/dist/modules/file/services/resize-file.js +1 -1
- package/dist/modules/file/services/upload-file.d.ts +4 -6
- package/dist/modules/file/services/upload-file.d.ts.map +1 -1
- package/dist/modules/file/services/upload-file.js +1 -1
- package/dist/modules/resource/route.d.ts +0 -3
- package/dist/modules/resource/route.d.ts.map +1 -1
- package/dist/modules/resource/route.js +1 -1
- package/dist/modules/resource/schema.d.ts +3 -0
- package/dist/modules/resource/schema.d.ts.map +1 -1
- package/dist/modules/resource/schema.js +1 -1
- package/dist/modules/resource/services/add-note.d.ts.map +1 -1
- package/dist/modules/resource/services/add-note.js +1 -1
- package/dist/modules/resource/services/add-resource-file.d.ts.map +1 -1
- package/dist/modules/resource/services/add-resource-file.js +1 -1
- package/dist/modules/resource/services/create-resource-relation.d.ts +8 -2
- package/dist/modules/resource/services/create-resource-relation.d.ts.map +1 -1
- package/dist/modules/resource/services/create-resource-relation.js +1 -1
- package/dist/modules/resource/services/create-resource.js +1 -1
- package/dist/modules/resource/services/delete-resource-relation.d.ts +8 -1
- package/dist/modules/resource/services/delete-resource-relation.d.ts.map +1 -1
- package/dist/modules/resource/services/delete-resource-relation.js +1 -1
- package/dist/modules/resource/services/delete-resource.js +1 -1
- package/dist/modules/resource/services/export-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/export-resource.js +1 -1
- package/dist/modules/resource/services/get-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/get-resource.js +1 -1
- package/dist/modules/resource/services/list-resource-relation.d.ts +9 -2
- package/dist/modules/resource/services/list-resource-relation.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resource-relation.js +1 -1
- package/dist/modules/resource/services/list-resources.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resources.js +1 -1
- package/dist/modules/resource/services/search-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/search-resource.js +1 -1
- package/dist/modules/resource/services/suggest-resource.d.ts +10 -4
- package/dist/modules/resource/services/suggest-resource.d.ts.map +1 -1
- package/dist/modules/resource/services/suggest-resource.js +1 -1
- package/dist/modules/resource/services/update-resource-relation.d.ts +10 -0
- package/dist/modules/resource/services/update-resource-relation.d.ts.map +1 -0
- package/dist/modules/resource/services/update-resource-relation.js +1 -0
- package/dist/modules/resource/services/update-resource.js +1 -1
- package/dist/modules/resource/services/upload-resource-file.d.ts.map +1 -1
- package/dist/modules/resource/services/upload-resource-file.js +1 -1
- package/dist/modules/system/route.d.ts +2 -1
- package/dist/modules/system/route.d.ts.map +1 -1
- package/dist/modules/system/route.js +1 -1
- package/dist/modules/system/schema.d.ts +22 -1
- package/dist/modules/system/schema.d.ts.map +1 -1
- package/dist/modules/system/schema.js +1 -1
- package/dist/modules/system/services/check-system.d.ts.map +1 -1
- package/dist/modules/system/services/check-system.js +1 -1
- package/dist/modules/system/services/get-access.d.ts +14 -0
- package/dist/modules/system/services/get-access.d.ts.map +1 -0
- package/dist/modules/system/services/get-access.js +1 -0
- package/dist/modules/system/services/get-api-list.d.ts +4 -1
- package/dist/modules/system/services/get-api-list.d.ts.map +1 -1
- package/dist/modules/system/services/get-api-list.js +1 -1
- package/dist/modules/system/services/get-audit-log.d.ts.map +1 -1
- package/dist/modules/system/services/get-audit-log.js +1 -1
- package/dist/modules/system/services/get-dictionary.js +1 -1
- package/dist/modules/system/services/get-system-log.d.ts +9 -5
- package/dist/modules/system/services/get-system-log.d.ts.map +1 -1
- package/dist/modules/system/services/get-system-log.js +1 -1
- package/dist/modules/system/services/get-system-settings.d.ts.map +1 -1
- package/dist/modules/system/services/get-system-settings.js +1 -1
- package/dist/modules/system/services/list-dictionaries.js +1 -1
- package/dist/modules/system/services/set-access.d.ts +16 -0
- package/dist/modules/system/services/set-access.d.ts.map +1 -0
- package/dist/modules/system/services/set-access.js +1 -0
- package/dist/modules/system/services/update-dictionary.d.ts +13 -0
- package/dist/modules/system/services/update-dictionary.d.ts.map +1 -0
- package/dist/modules/system/services/update-dictionary.js +1 -0
- package/dist/modules/system/services/update-system-settings.d.ts.map +1 -1
- package/dist/modules/system/services/update-system-settings.js +1 -1
- package/dist/modules/utils/require-admin.d.ts +1 -1
- package/dist/modules/utils/require-admin.d.ts.map +1 -1
- package/dist/modules/utils/require-admin.js +1 -1
- package/dist/modules/utils/safe-user.js +1 -1
- package/dist/modules/utils/unsupported.js +1 -1
- package/dist/plugins/audit/audit.d.ts +2 -2
- package/dist/plugins/audit/audit.d.ts.map +1 -1
- package/dist/plugins/audit/audit.js +1 -1
- package/dist/plugins/audit/index.js +1 -1
- package/dist/plugins/audit/services/write-audit.d.ts +2 -2
- package/dist/plugins/audit/services/write-audit.d.ts.map +1 -1
- package/dist/plugins/audit/services/write-audit.js +1 -1
- package/dist/plugins/auth/get-user-permissions.d.ts +3 -0
- package/dist/plugins/auth/get-user-permissions.d.ts.map +1 -0
- package/dist/plugins/auth/get-user-permissions.js +1 -0
- package/dist/plugins/auth/index.d.ts +4 -0
- package/dist/plugins/auth/index.d.ts.map +1 -1
- package/dist/plugins/auth/index.js +1 -1
- package/dist/plugins/auth/verifyUser.d.ts +9 -0
- package/dist/plugins/auth/verifyUser.d.ts.map +1 -0
- package/dist/plugins/auth/verifyUser.js +1 -0
- package/dist/plugins/dictionary.d.ts +3 -0
- package/dist/plugins/dictionary.d.ts.map +1 -1
- package/dist/plugins/dictionary.js +1 -1
- package/dist/plugins/file.d.ts +4 -7
- package/dist/plugins/file.d.ts.map +1 -1
- package/dist/plugins/file.js +1 -1
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/jwt.d.ts +4 -0
- package/dist/plugins/jwt.d.ts.map +1 -0
- package/dist/plugins/jwt.js +1 -0
- package/dist/plugins/logger/index.d.ts +9 -4
- package/dist/plugins/logger/index.d.ts.map +1 -1
- package/dist/plugins/logger/index.js +1 -1
- package/dist/plugins/logger/transport.d.ts +3 -0
- package/dist/plugins/logger/transport.d.ts.map +1 -0
- package/dist/plugins/logger/transport.js +1 -0
- package/dist/plugins/pg.d.ts +4 -2
- package/dist/plugins/pg.d.ts.map +1 -1
- package/dist/plugins/pg.js +1 -1
- package/dist/plugins/redis.js +1 -1
- package/dist/plugins/resource/index.js +1 -1
- package/dist/plugins/resource/resource.d.ts.map +1 -1
- package/dist/plugins/resource/resource.js +1 -1
- package/dist/plugins/resource/resource.registry.js +1 -1
- package/dist/plugins/resource/resource.types.d.ts +62 -8
- package/dist/plugins/resource/resource.types.d.ts.map +1 -1
- package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts +3 -0
- package/dist/plugins/resource/services/add-dictionary-lookup-data.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-dictionary-lookup-data.js +1 -0
- package/dist/plugins/resource/services/add-file-token.d.ts +3 -0
- package/dist/plugins/resource/services/add-file-token.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-file-token.js +1 -0
- package/dist/plugins/resource/services/add-table-lookup-data.d.ts +4 -0
- package/dist/plugins/resource/services/add-table-lookup-data.d.ts.map +1 -0
- package/dist/plugins/resource/services/add-table-lookup-data.js +1 -0
- package/dist/plugins/resource/services/create-relation.d.ts +16 -0
- package/dist/plugins/resource/services/create-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/create-relation.js +1 -0
- package/dist/plugins/resource/services/create.d.ts +5 -2
- package/dist/plugins/resource/services/create.d.ts.map +1 -1
- package/dist/plugins/resource/services/create.js +1 -1
- package/dist/plugins/resource/services/delete-relation.d.ts +18 -0
- package/dist/plugins/resource/services/delete-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/delete-relation.js +1 -0
- package/dist/plugins/resource/services/delete.d.ts +5 -2
- package/dist/plugins/resource/services/delete.d.ts.map +1 -1
- package/dist/plugins/resource/services/delete.js +1 -1
- package/dist/plugins/resource/services/find-one.d.ts +3 -2
- package/dist/plugins/resource/services/find-one.d.ts.map +1 -1
- package/dist/plugins/resource/services/find-one.js +1 -1
- package/dist/plugins/resource/services/find-relation.d.ts +13 -0
- package/dist/plugins/resource/services/find-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/find-relation.js +1 -0
- package/dist/plugins/resource/services/find.d.ts.map +1 -1
- package/dist/plugins/resource/services/find.js +1 -1
- package/dist/plugins/resource/services/update-relation.d.ts +14 -0
- package/dist/plugins/resource/services/update-relation.d.ts.map +1 -0
- package/dist/plugins/resource/services/update-relation.js +1 -0
- package/dist/plugins/resource/services/update.d.ts +5 -2
- package/dist/plugins/resource/services/update.d.ts.map +1 -1
- package/dist/plugins/resource/services/update.js +1 -1
- package/dist/plugins/resource/utils/auto-index.d.ts +4 -0
- package/dist/plugins/resource/utils/auto-index.d.ts.map +1 -0
- package/dist/plugins/resource/utils/auto-index.js +1 -0
- package/dist/plugins/resource/utils/fields.d.ts +8 -1
- package/dist/plugins/resource/utils/fields.d.ts.map +1 -1
- package/dist/plugins/resource/utils/fields.js +1 -1
- package/dist/plugins/resource/utils/filters.d.ts +3 -2
- package/dist/plugins/resource/utils/filters.d.ts.map +1 -1
- package/dist/plugins/resource/utils/filters.js +1 -1
- package/dist/plugins/resource/utils/permissions.d.ts.map +1 -1
- package/dist/plugins/resource/utils/permissions.js +1 -1
- package/dist/plugins/resource/utils/sort.d.ts.map +1 -1
- package/dist/plugins/resource/utils/sort.js +1 -1
- package/dist/plugins/resource/utils/sql.js +1 -1
- package/dist/shared/getIP.js +1 -1
- package/dist/type.d.ts +37 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +1 -0
- package/migrations/20260903120000_core_schema.sql +259 -0
- package/migrations/20260903130000_move_notes_files_to_admin.sql +18 -0
- package/migrations/20260903140000_settings_nulls_not_distinct.sql +19 -0
- package/migrations/20260905120000_add_user_foreign_keys.sql +43 -0
- package/migrations/20260907090000_core_schema.sql +32 -0
- package/package.json +93 -87
- package/dist/modules/auth/index.d.ts +0 -9
- package/dist/modules/auth/index.d.ts.map +0 -1
- package/dist/modules/auth/index.js +0 -1
- package/dist/modules/auth/services/login.d.ts +0 -10
- package/dist/modules/auth/services/login.d.ts.map +0 -1
- package/dist/modules/auth/services/login.js +0 -1
- package/dist/modules/auth/services/logout.d.ts +0 -9
- package/dist/modules/auth/services/logout.d.ts.map +0 -1
- package/dist/modules/auth/services/logout.js +0 -1
- package/dist/modules/auth/services/verifyPassword.d.ts +0 -11
- package/dist/modules/auth/services/verifyPassword.d.ts.map +0 -1
- package/dist/modules/auth/services/verifyPassword.js +0 -1
- package/dist/modules/file/index.d.ts +0 -8
- package/dist/modules/file/index.d.ts.map +0 -1
- package/dist/modules/file/index.js +0 -1
- package/dist/modules/resource/index.d.ts +0 -20
- package/dist/modules/resource/index.d.ts.map +0 -1
- package/dist/modules/resource/index.js +0 -1
- package/dist/modules/resource/services/list-children.d.ts +0 -6
- package/dist/modules/resource/services/list-children.d.ts.map +0 -1
- package/dist/modules/resource/services/list-children.js +0 -1
- package/dist/modules/system/index.d.ts +0 -13
- package/dist/modules/system/index.d.ts.map +0 -1
- package/dist/modules/system/index.js +0 -1
- package/dist/modules/utils/get-user-permissions.d.ts +0 -3
- package/dist/modules/utils/get-user-permissions.d.ts.map +0 -1
- package/dist/modules/utils/get-user-permissions.js +0 -1
- package/dist/plugins/logger/checkUserAccess.d.ts +0 -11
- package/dist/plugins/logger/checkUserAccess.d.ts.map +0 -1
- package/dist/plugins/logger/checkUserAccess.js +0 -1
- package/dist/plugins/logger/createFileStream.d.ts +0 -3
- package/dist/plugins/logger/createFileStream.d.ts.map +0 -1
- package/dist/plugins/logger/createFileStream.js +0 -1
- package/dist/plugins/logger/createLogger.d.ts +0 -9
- package/dist/plugins/logger/createLogger.d.ts.map +0 -1
- package/dist/plugins/logger/createLogger.js +0 -1
- package/dist/plugins/logger/errorStatus.d.ts +0 -2
- package/dist/plugins/logger/errorStatus.d.ts.map +0 -1
- package/dist/plugins/logger/errorStatus.js +0 -1
- package/dist/plugins/logger/getHooks.d.ts +0 -5
- package/dist/plugins/logger/getHooks.d.ts.map +0 -1
- package/dist/plugins/logger/getHooks.js +0 -1
- package/dist/plugins/logger/getRootDir.d.ts +0 -3
- package/dist/plugins/logger/getRootDir.d.ts.map +0 -1
- package/dist/plugins/logger/getRootDir.js +0 -1
- package/dist/plugins/logger/labels.d.ts +0 -3
- package/dist/plugins/logger/labels.d.ts.map +0 -1
- package/dist/plugins/logger/labels.js +0 -1
- package/dist/plugins/logger/serializers.d.ts +0 -14
- package/dist/plugins/logger/serializers.d.ts.map +0 -1
- package/dist/plugins/logger/serializers.js +0 -1
- package/dist/plugins/logger/timestampWithTimeZone.d.ts +0 -2
- package/dist/plugins/logger/timestampWithTimeZone.d.ts.map +0 -1
- package/dist/plugins/logger/timestampWithTimeZone.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-user-permissions.d.ts","sourceRoot":"","sources":["../../../src/plugins/auth/get-user-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,GACnC,OAAO,CAAC,MAAM,EAAE,CAAC,CAenB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function v(){const u=['query'];v=function(){return u;};return v();}function S(d,h){d=d-0x170;const p=v();let Z=p[d];return Z;}export async function getUserPermissions(d,h){const D=S,p=await h['pg'][D(0x170)]('\x0a\x20\x20\x20\x20\x20\x20SELECT\x20DISTINCT\x20ra.resource\x20||\x20\x27:\x27\x20||\x20action\x20AS\x20permission\x0a\x20\x20\x20\x20\x20\x20FROM\x20admin.role_access\x20ra\x0a\x20\x20\x20\x20\x20\x20LEFT\x20JOIN\x20admin.user_roles\x20ur\x20ON\x20ur.role_id\x20=\x20ra.role_id\x0a\x20\x20\x20\x20\x20\x20CROSS\x20JOIN\x20LATERAL\x20unnest(COALESCE(ra.actions,\x20\x27{}\x27::text[]))\x20AS\x20action\x0a\x20\x20\x20\x20\x20\x20WHERE\x20ra.user_uid\x20=\x20$1\x20OR\x20ur.user_uid\x20=\x20$1\x0a\x20\x20\x20\x20',[d]);return p['rows']['map'](Z=>Z['permission']);}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export * from "./auth.types.js";
|
|
2
2
|
import { type FastifyInstance } from "fastify";
|
|
3
3
|
import { type ContextDependencies } from "../../context.js";
|
|
4
|
+
export * from "./verifyUser.js";
|
|
5
|
+
export * from "./get-user-permissions.js";
|
|
6
|
+
export declare function hashPassword(password: string): Promise<string>;
|
|
7
|
+
export declare function verifyPassword(password: string, stored: string): Promise<boolean>;
|
|
4
8
|
export declare function createSessionStore(app: FastifyInstance, ctx: ContextDependencies): Promise<void>;
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAUhC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAO/C,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAI5D,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAE1C,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKpE;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,CAalB;AAED,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,mBAAmB,iBA6CzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export*from'./auth.types.js';import{randomBytes,scrypt as d,timingSafeEqual}from'node:crypto';import{promisify}from'node:util';const scrypt=promisify(d);import h from'@fastify/cookie';import p from'@fastify/session';function S(d,h){d=d-0x97;const p=v();let Z=p[d];return Z;}import{Authenticator}from'@fastify/passport';import Z from'fastify-session-redis-store';import{getUserPermissions}from'./get-user-permissions.js';const fastifyPassport=new Authenticator();export*from'./verifyUser.js';export*from'./get-user-permissions.js';function v(){const g=['hex','split','scrypt','from','length','warn','cookieOptions','register','cookieName','auth','database'];v=function(){return g;};return v();}export async function hashPassword(D){const F=S,u=randomBytes(0x10),n=await scrypt(D,u,0x40);return'scrypt$'+u['toString'](F(0x97))+'$'+n['toString']('hex');}export async function verifyPassword(D,u){const B=S,[n,X,Y]=u?.[B(0x98)]('$')||[];if(n!==B(0x99)||!X||!Y)return![];const w=Buffer['from'](X,'hex'),y=Buffer[B(0x9a)](Y,B(0x97)),Q=await scrypt(D,w,y[B(0x9b)]);return timingSafeEqual(Q,y);}export async function createSessionStore(D,u){const K=S,{config:n,redis:X}=u;if(!n||!X){console[K(0x9c)]('Missing\x20config\x20or\x20redis\x20-\x20skipping\x20session\x20store\x20creation');return;}if(process.env.NODE_ENV==='test'||process.env.VITEST)return;await D['register'](h,{'parseOptions':n['auth'][K(0x9d)]}),await D[K(0x9e)](p,{'secret':n['auth']['secret'],'cookieName':n['auth'][K(0x9f)],'cookie':n['auth']['cookieOptions'],'store':new Z({'prefix':n[K(0xa0)]['cookieName']+':'+(n['pg']?.[K(0xa1)]||'db')+':','client':X})}),await D[K(0x9e)](fastifyPassport['initialize']()),await D['register'](fastifyPassport['secureSession']()),fastifyPassport['registerUserSerializer'](async Y=>({'user':Y})),fastifyPassport['registerUserDeserializer'](async Y=>{const w=Y?.['user']||Y;return w?.['id']&&(w['permissions']=await getUserPermissions(w['id'],u)),w;});}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContextDependencies } from "../../context.js";
|
|
2
|
+
type params = {
|
|
3
|
+
user: string;
|
|
4
|
+
password: string;
|
|
5
|
+
ip?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function verifyUser({ user, password, ip, }: params, { pg, logger }: Pick<ContextDependencies, "pg" | "logger">): Promise<import("./auth.types.js").AuthUser>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=verifyUser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyUser.d.ts","sourceRoot":"","sources":["../../../src/plugins/auth/verifyUser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAQ,MAAM,kBAAkB,CAAC;AAI7D,KAAK,MAAM,GAAG;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,wBAAsB,UAAU,CAC9B,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,MAAM,EAC/B,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,QAAQ,CAAC,+CAgC3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function v(){const Q=['not\x20enough\x20params:\x20user','user.login','select\x20uid\x20as\x20id,\x20user_type\x20as\x20type,\x20password_hash,\x20twofa\x20from\x20admin.users\x20where\x20$1\x20in\x20(login,email,phone)\x20and\x20enabled\x20limit\x201','query','rows','auth/warn','password_hash','Wrong\x20password'];v=function(){return Q;};return v();}import{BadRequestError}from'../../errors.js';import{verifyPassword}from'./index.js';function S(d,h){d=d-0x11f;const p=v();let Z=p[d];return Z;}export async function verifyUser({user:d,password:h,ip:p},{pg:Z,logger:D}){const y=S;if(!d||d==='')throw new BadRequestError(y(0x11f));if(!h||h==='')throw new BadRequestError('not\x20enough\x20params:\x20password');D['metrics'](y(0x120));const u=y(0x121),n=await Z[y(0x122)](u,[d])['then'](Y=>Y[y(0x123)]?.[0x0]);if(!n){const Y='user\x20not\x20found';D['info']({'file':y(0x124),'error':Y,'user':d,'ip':p});throw new BadRequestError(Y);}const X=await verifyPassword(h,n[y(0x125)]);if(!X){const w=y(0x126);D['info']({'file':'auth/warn','error':w,'user':d,'ip':p});throw new BadRequestError(w);}return delete n['password_hash'],n;}
|
|
@@ -9,13 +9,16 @@ export interface DictionaryItem {
|
|
|
9
9
|
export interface DictionaryDefinition {
|
|
10
10
|
code: string;
|
|
11
11
|
name?: string;
|
|
12
|
+
checked?: boolean;
|
|
12
13
|
items: DictionaryItem[];
|
|
13
14
|
}
|
|
14
15
|
export interface DictionaryPlugin {
|
|
15
16
|
register(input: DictionaryDefinition | DictionaryDefinition[]): void;
|
|
17
|
+
has(name: string): boolean;
|
|
16
18
|
get(name: string): Promise<DictionaryItem[]>;
|
|
17
19
|
put(name: string, items: DictionaryItem[]): Promise<void>;
|
|
18
20
|
clear(name: string): boolean;
|
|
21
|
+
revision(name: string): number;
|
|
19
22
|
list(): Promise<Array<{
|
|
20
23
|
code: string;
|
|
21
24
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../src/plugins/dictionary.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM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
1
|
-
|
|
1
|
+
import{ConflictError,NotFoundError,ValidationError}from'../errors.js';function S(d,h){d=d-0x8f;const p=v();let Z=p[d];return Z;}const dictionaryName=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;export function createDictionary({pg:d,dictionaries:dictionaries=[]}){const h=new Map(),p=new Map();let Z,D;async function u(){const U=S;if(Z!==undefined)return Z;if(!d)throw new Error('empty\x20pg');return D??=d['query']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20SELECT\x20table_name\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20information_schema.tables\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20table_schema\x20=\x20\x27admin\x27\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20AND\x20table_name\x20=\x20\x27dictionaries\x27\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20LIMIT\x201\x0a\x20\x20\x20\x20\x20\x20\x20\x20')[U(0x8f)](K=>{const I=U,g=K[I(0x90)][0x0]?.[I(0x91)];Z=g==='dictionaries'?g:null;}),await D,Z;}function n(K){if(!dictionaryName['test'](K))throw new ValidationError('Invalid\x20dictionary\x20name:\x20'+K);}function X(K){const k=S;for(const g of Array[k(0x92)](K)?K:[K]){n(g[k(0x93)]);if(!Array[k(0x92)](g[k(0x94)]))throw new ValidationError('Invalid\x20dictionary\x20items:\x20'+g[k(0x93)]);if(h['has'](g[k(0x93)]))throw new ConflictError(k(0x95)+g[k(0x93)]);h[k(0x96)](g['code'],{...g,'source':'static'});}}function Y(K){const c=S;return h[c(0x97)](K);}async function w(K){const q=S;n(K);const g=h[q(0x98)](K);if(g&&g['checked'])return g['items'];const s=await u();if(!s)throw new NotFoundError('Dictionary\x20table\x20not\x20found');const M=await d?.['query']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20SELECT\x20di.code,\x20di.name\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20admin.dictionary_items\x20di\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20JOIN\x20admin.dictionaries\x20d\x20ON\x20d.id\x20=\x20di.dictionary_id\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20d.code\x20=\x20$1\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20di.name\x0a\x20\x20\x20\x20\x20\x20\x20\x20',[K]);if(M?.['rows']?.['length']){const O=M?.['rows'];return h['set'](K,{'code':K,'name':K,'items':O,'source':q(0x99),'checked':!![]}),O;}if(!g?.[q(0x94)])throw new NotFoundError(q(0x9a)+K);return g[q(0x9b)]=!![],g['items'];}async function y(K,g){const j=S;n(K);if(!Array['isArray'](g))throw new ValidationError('Dictionary\x20items\x20must\x20be\x20an\x20array');const s=await u();if(!s)throw new NotFoundError(j(0x9c));if(!d)throw new Error('empty\x20pg');const M=await d[j(0x9d)]();try{await M['query']('BEGIN');const O=await M[j(0x9e)]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.dictionaries\x20(code,\x20name,\x20module,\x20source,\x20editable)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4,\x20$5)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ON\x20CONFLICT\x20(code)\x20DO\x20UPDATE\x20SET\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20name\x20=\x20EXCLUDED.name,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20module\x20=\x20EXCLUDED.module,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20source\x20=\x20EXCLUDED.source,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20editable\x20=\x20EXCLUDED.editable,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20updated_at\x20=\x20now()\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20RETURNING\x20id\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',[K,K,'fcore','custom',!![]]),R=O['rows'][0x0]['id'];await M['query'](j(0x9f),[R]);for(const E of g){await M[j(0x9e)]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.dictionary_items\x20(dictionary_id,\x20code,\x20name,\x20parent_id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',[R,E['code'],E[j(0xa0)],E['parentId']??null]);}await M['query']('COMMIT');}catch(J){await M['query'](j(0xa1));throw J;}finally{M['release']();}h['set'](K,{'items':g,'code':K,'source':'static','checked':!![]}),p[j(0x96)](K,(p['get'](K)??0x0)+0x1);}function Q(K){return n(K),p['set'](K,(p['get'](K)??0x0)+0x1),h['delete'](K);}function F(K){return p['get'](K)??0x0;}async function B(){const P=S,K=[...h['values']()][P(0xa2)](({code:M,name:O,source:R})=>({'code':M,'name':O??M,'source':R})),g=await u();if(!g)return K;if(!d)throw new Error(P(0xa3));const s=await d[P(0x9e)](P(0xa4));for(const M of s[P(0x90)]){!h['has'](M['code'])&&K['push'](M);}return K;}return X(dictionaries),{'register':X,'get':w,'put':y,'clear':Q,'revision':F,'list':B,'has':Y};}function v(){const L=['then','rows','table_name','isArray','code','items','Dictionary\x20already\x20registered:\x20','set','has','get','database','Dictionary\x20not\x20found:\x20','checked','Dictionary\x20table\x20not\x20found','connect','query','DELETE\x20FROM\x20admin.dictionary_items\x20WHERE\x20dictionary_id\x20=\x20$1','name','ROLLBACK','map','empty\x20pg','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20SELECT\x20code,\x20name,\x20\x27database\x27\x20AS\x20source\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20admin.dictionaries\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20name\x0a\x20\x20\x20\x20\x20\x20\x20\x20'];v=function(){return L;};return v();}
|
package/dist/plugins/file.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Implements the S3-compatible file storage adapter and its contracts.
|
|
3
3
|
*/
|
|
4
|
+
import type { Readable } from "node:stream";
|
|
4
5
|
export interface FileAdapter {
|
|
5
|
-
put(path: string,
|
|
6
|
+
put(path: string, body: Buffer | Readable): Promise<void>;
|
|
6
7
|
get(path: string): Promise<Buffer>;
|
|
7
8
|
exists(path: string): Promise<boolean>;
|
|
8
9
|
delete(path: string): Promise<void>;
|
|
9
10
|
create(path: string, ttl?: number): string;
|
|
10
|
-
verify(token: string):
|
|
11
|
-
}
|
|
12
|
-
export interface FileTokenPayload {
|
|
13
|
-
p: string;
|
|
14
|
-
exp: number;
|
|
11
|
+
verify(token: string): string;
|
|
15
12
|
}
|
|
16
13
|
export interface FileS3Config {
|
|
17
14
|
endpoint?: string;
|
|
@@ -26,5 +23,5 @@ export interface FileS3Config {
|
|
|
26
23
|
tokenSecret?: string;
|
|
27
24
|
tokenTtl?: number;
|
|
28
25
|
}
|
|
29
|
-
export declare function createFileS3(config: FileS3Config): FileAdapter
|
|
26
|
+
export declare function createFileS3(config: FileS3Config): FileAdapter;
|
|
30
27
|
//# sourceMappingURL=file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/plugins/file.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/plugins/file.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,WAAW;IACxB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAKD,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAgCD,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,CAiF9D"}
|
package/dist/plugins/file.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{DeleteObjectCommand,GetObjectCommand,HeadObjectCommand,PutObjectCommand,S3Client}from'@aws-sdk/client-s3';import d from'node:crypto';import{ValidationError}from'../errors.js';import{UnauthorizedError}from'../errors.js';function keyFor(h,p){const Q=S;if(!p||p['startsWith']('/')||p['includes']('..'))throw new ValidationError(Q(0xcd));const Z=p['replace'](/\\/g,'/')[Q(0xce)](/^\/+/,''),D=(h??'')[Q(0xce)](/^\/+|\/+$/g,'');return D?D+'/'+Z:Z;}function S(d,h){d=d-0xcd;const p=v();let Z=p[d];return Z;}async function bodyToBuffer(h){if(!h)return Buffer['alloc'](0x0);const p=h;if(typeof p['transformToByteArray']==='function')return Buffer['from'](await p['transformToByteArray']());const Z=[];for await(const D of h){Z['push'](Buffer['from'](D));}return Buffer['concat'](Z);}function v(){const R=['Invalid\x20file\x20path','replace','toString','region','us-east-1','forcePathStyle','accessKey','bucket','send','$metadata','from','update','timingSafeEqual','base64url'];v=function(){return R;};return v();}export function createFileS3(h){const F=S,p=h['tokenSecret']??process.env.FILE_TOKEN_SECRET??d['randomBytes'](0x20)[F(0xcf)]('hex'),Z=new S3Client({'endpoint':h['endpoint'],'region':h[F(0xd0)]??F(0xd1),'forcePathStyle':h[F(0xd2)]??!![],'credentials':h['accessKeyId']||h[F(0xd3)]?{'accessKeyId':h['accessKeyId']??h['accessKey'],'secretAccessKey':h['secretAccessKey']??h['secretKey']}:undefined}),D=u=>keyFor(h['folder'],u);return{async 'put'(u,n){const B=F;await Z['send'](new PutObjectCommand({'Bucket':h[B(0xd4)],'Key':D(u),'Body':n}));},async 'get'(u){const K=F,n=await Z[K(0xd5)](new GetObjectCommand({'Bucket':h['bucket'],'Key':D(u)}));return bodyToBuffer(n['Body']);},async 'exists'(u){const g=F;try{return await Z['send'](new HeadObjectCommand({'Bucket':h[g(0xd4)],'Key':D(u)})),!![];}catch(n){const X=n;if(X[g(0xd6)]?.['httpStatusCode']===0x194||X['name']==='NotFound')return![];throw n;}},async 'delete'(u){const s=F;await Z[s(0xd5)](new DeleteObjectCommand({'Bucket':h['bucket'],'Key':D(u)}));},'create'(u,n=h['tokenTtl']??0xe10){const M=F,X=Buffer[M(0xd7)](u)['toString']('base64url'),Y=d['createHmac']('sha256',p)[M(0xd8)](X)['digest']('base64url');return X+'.'+Y;},'verify'(u){const O=F,[n,X]=u['split']('.');if(!n||!X)throw new UnauthorizedError('Invalid\x20file\x20token');const Y=d['createHmac']('sha256',p)['update'](n)['digest'](),w=Buffer['from'](X,'base64url');if(Y['length']!==w['length']||!d[O(0xd9)](Y,w))throw new UnauthorizedError('Invalid\x20file\x20token');const y=Buffer['from'](n,O(0xda))['toString']('utf8');return y;}};}
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
export * from "./logger/index.js";
|
|
5
5
|
export * from "./redis.js";
|
|
6
6
|
export * from "./pg.js";
|
|
7
|
+
export * from "./auth/index.js";
|
|
7
8
|
export * from "./file.js";
|
|
8
9
|
export * from "./dictionary.js";
|
|
9
10
|
export * from "./audit/index.js";
|
|
10
11
|
export * from "./resource/index.js";
|
|
12
|
+
export * from './jwt.js';
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC"}
|
package/dist/plugins/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export*from'./logger/index.js';export*from'./redis.js';export*from'./pg.js';export*from'./auth/index.js';export*from'./file.js';export*from'./dictionary.js';export*from'./audit/index.js';export*from'./resource/index.js';export*from'./jwt.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/plugins/jwt.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIhD,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,+BAY/D;AACD,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,qBAKjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function S(d,h){d=d-0x1e7;const p=v();let Z=p[d];return Z;}import{SignJWT,jwtVerify}from'jose';function v(){const Y=['setProtectedHeader','catch','message'];v=function(){return Y;};return v();}const secret=new TextEncoder()['encode'](process.env.AUTH_JWT_SECRET);export async function jwtSignToken(d){const u=S;if(!process.env.AUTH_JWT_SECRET)return;const {id:h,type:p,permissions:Z}=d,D=await new SignJWT({'id':h,'type':p,'permissions':Z})[u(0x1e7)]({'alg':'HS256'})['setIssuedAt']()['setExpirationTime']('1h')['sign'](secret);return D;}export async function jwtVerifyToken(d){const n=S,h=await jwtVerify(d,secret,{'algorithms':['HS256']})[n(0x1e8)](p=>{const X=n;console['log'](p[X(0x1e9)]);});return h?.['payload'];}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type Logger } from 'pino';
|
|
2
|
+
export type Metrics = Record<string, number>;
|
|
3
|
+
export type AppLogger = Logger & {
|
|
4
|
+
close(): Promise<void>;
|
|
5
|
+
metrics(): Metrics;
|
|
6
|
+
metrics(key: string, inc?: number): void;
|
|
7
|
+
file(): void;
|
|
8
|
+
};
|
|
9
|
+
export declare function createLogger(): AppLogger;
|
|
5
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/logger/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/logger/index.ts"],"names":[],"mappings":"AAEA,OAAa,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAEzC,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAC/B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,IAAI,OAAO,CAAC;IACnB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,IAAI,IAAI,IAAI,CAAC;CACd,CAAC;AAEF,wBAAgB,YAAY,IAAI,SAAS,CA4CxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function S(d,h){d=d-0x9f;const p=v();let Z=p[d];return Z;}function v(){const Y=['app','accessToken','[REDACTED]','end'];v=function(){return Y;};return v();}import d from'pino';export function createLogger(){const X=S,h=d['transport']({'target':'./transport.js'}),p=d({'level':'info','timestamp':d['stdTimeFunctions']['isoTime'],'base':{'service':X(0x9f)},'redact':{'paths':['req.headers.authorization','password','token',X(0xa0),'refreshToken'],'censor':X(0xa1)}},h),Z={};function D(u,n){if(u===undefined)return{...Z};Z[u]=(Z[u]??0x0)+(n??0x1);}return Object['assign'](p,{'close':async()=>h[X(0xa2)](),'metrics':D,'file':()=>p['info']['bind'](p)});}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/plugins/logger/transport.js"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,yBAAyB,CAAC;AAuD5C,wBAA8B,eAAe,0DAM5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function S(d,h){d=d-0xcc;const p=v();let Z=p[d];return Z;}const X=S;import d from'node:fs';import h from'node:path';import p from'pino-abstract-transport';const LEVELS={0x1e:X(0xcc),0x28:X(0xcd),0x32:'error',0x3c:'error'},streams=new Map();function getDate(){const Y=X;return new Date()[Y(0xce)]()['slice'](0x0,0xa);}function createStream(Z,D){const w=X,u=h['resolve']('logs',Z);return d['mkdirSync'](u,{'recursive':!![]}),d['createWriteStream'](h[w(0xcf)](u,D+'.log'),{'flags':'a'});}function getStream(Z){const y=X,D=getDate(),u=streams['get'](Z);if(u&&u[y(0xd0)]===D)return u['stream'];u?.['stream']['end']();const n=createStream(Z,D);return streams['set'](Z,{'date':D,'stream':n}),n;}function v(){const B=['info','warn','toISOString','join','date','clear','level','file','stringify'];v=function(){return B;};return v();}function closeStreams(){const Q=X;for(const {stream:Z}of streams['values']()){Z['end']();}streams[Q(0xd1)]();}export default async function loggerTransport(){return p(writeLogs,{'close':async()=>{closeStreams();}});}async function writeLogs(Z){const F=X;for await(const D of Z){const u=LEVELS[D[F(0xd2)]];if(!u)continue;const n=getStream(D[F(0xd3)]||u);delete D['file'],n['write'](JSON[F(0xd4)](D)+'\x0a');}}
|
package/dist/plugins/pg.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface DatabaseConfig {
|
|
|
10
10
|
password: string;
|
|
11
11
|
max?: number;
|
|
12
12
|
}
|
|
13
|
-
export declare function createDatabase(config: DatabaseConfig):
|
|
14
|
-
export type DatabaseAdapter = pg.Pool
|
|
13
|
+
export declare function createDatabase(config: DatabaseConfig): DatabaseAdapter;
|
|
14
|
+
export type DatabaseAdapter = pg.Pool & {
|
|
15
|
+
transaction: <T>(callback: (client: pg.PoolClient) => Promise<T>) => Promise<T>;
|
|
16
|
+
};
|
|
15
17
|
//# sourceMappingURL=pg.d.ts.map
|
package/dist/plugins/pg.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pg.d.ts","sourceRoot":"","sources":["../../src/plugins/pg.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AACD,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"pg.d.ts","sourceRoot":"","sources":["../../src/plugins/pg.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AACD,wBAAgB,cAAc,CAC1B,MAAM,EAAE,cAAc,mBAiDzB;AACD,MAAM,MAAM,eAAe,GAAG,EAAE,CAAC,IAAI,GAAG;IACpC,WAAW,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;CACnF,CAAC"}
|
package/dist/plugins/pg.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import d from'pg';function v(){const B=['query','connect','BEGIN','COMMIT'];v=function(){return B;};return v();}const {Pool}=d;function S(d,h){d=d-0x180;const p=v();let Z=p[d];return Z;}export function createDatabase(h){const Q=S,p=new Pool(h),Z=p[Q(0x180)]['bind'](p);function D(u,n){const X=new Error();return Error['captureStackTrace']?.(X,D),Z(u,n)['catch'](Y=>{const w=Y;w['sql']=u,w['callerStack']=X['stack'];throw w;});}return p['query']=D,p['transaction']=async function(u){const F=Q,n=new Error();Error['captureStackTrace']?.(n,p['transaction']);const X=await p[F(0x181)]();try{await X[F(0x180)](F(0x182));const Y=await u(X);return await X[F(0x180)](F(0x183)),Y;}catch(w){await X[F(0x180)]('ROLLBACK');const y=w;y['callerStack']=n['stack'];throw y;}finally{X['release']();}},p;}
|
package/dist/plugins/redis.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function v(){const X=['del','quit','hincrby','incrby'];v=function(){return X;};return v();}import{Redis}from'ioredis';function S(d,h){d=d-0x1ac;const p=v();let Z=p[d];return Z;}export function createRedis(d){const n=S,h=new Redis(d);return{'get':p=>h['get'](p),'set':(p,Z,D,u)=>{if(u)return h['set'](p,Z,'EX',u);if(typeof D==='number')return h['set'](p,Z,'EX',D);return h['set'](p,Z);},'del':p=>h[n(0x1ac)](p),'delete':p=>h['del'](p),'close':()=>h[n(0x1ad)](),'ping':()=>h['ping'](),'hincrby':(p,Z,D)=>h[n(0x1ae)](p,Z,D),'incrby':(p,Z)=>h[n(0x1af)](p,Z)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export*from'./resource.types.js';export*from'./resource.registry.js';export*from'./resource.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/plugins/resource/resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/plugins/resource/resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAUhF,wBAAgB,cAAc,CAAC,IAAI,EAAE,oBAAoB,GAAG,cAAc,CA2BzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{ResourceRegistry}from'./resource.registry.js';import{createFind}from'./services/find.js';import{createFindOne}from'./services/find-one.js';import{createCreate}from'./services/create.js';function v(){const F=['has'];v=function(){return F;};return v();}import{createUpdate}from'./services/update.js';import{createRemove}from'./services/delete.js';import{createFindRelation}from'./services/find-relation.js';function S(d,h){d=d-0x14a;const p=v();let Z=p[d];return Z;}import{createCreateRelation}from'./services/create-relation.js';import{createDeleteRelation}from'./services/delete-relation.js';import{createUpdateRelation}from'./services/update-relation.js';export function createResource(d){const Q=S,h=new ResourceRegistry(),p=createFind(d,h),Z=createFindOne(d,h),D=createCreate(d,h),u=createUpdate(d,h),n=createRemove(d,h),X=createFindRelation(d,h),Y=createCreateRelation(d,h),w=createUpdateRelation(d,h),y=createDeleteRelation(d,h);return{'register':h['register']['bind'](h),'has':h[Q(0x14a)]['bind'](h),'get':h['get']['bind'](h),'list':h['list']['bind'](h),'find':p,'findOne':Z,'create':D,'update':u,'delete':n,'findRelation':X,'createRelation':Y,'updateRelation':w,'deleteRelation':y};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function v(){const Y=['split','has','get','Resource\x20not\x20registered:\x20','validate','version','key','column'];v=function(){return Y;};return v();}const n=S;import{ValidationError,ConflictError,NotFoundError}from'../../errors.js';const ident=/^[a-zA-Z0-9_-]*$/;function validQualified(d){const Z=S;return d['split']('.')['length']<=0x2&&d[Z(0x94)]('.')['every'](h=>ident['test'](h));}function S(d,h){d=d-0x94;const p=v();let Z=p[d];return Z;}export class ResourceRegistry{['resources']=new Map();['register'](d){const D=S;for(const h of Array['isArray'](d)?d:[d]){this['validate'](h);if(this['resources'][D(0x95)](h['name']))throw new ConflictError('Resource\x20already\x20registered:\x20'+h['name']);this['resources']['set'](h['name'],h);}}['has'](d){return this['resources']['has'](d);}['get'](d){const u=S,h=this['resources'][u(0x96)](d);if(!h)throw new NotFoundError(u(0x97)+d);return h;}['list'](){return[...this['resources']['values']()];}[n(0x98)](d){const X=n;if(d[X(0x99)]!==0x1||!ident['test'](d['name'])||!validQualified(d['table'])||!ident['test'](d[X(0x9a)]))throw new ValidationError('Invalid\x20resource\x20contract:\x20'+d['name']);for(const [h,p]of Object['entries'](d['fields'])){if(!ident['test'](h)||!ident['test'](p[X(0x9b)]??h))throw new ValidationError('Invalid\x20resource\x20field:\x20'+h);}}}
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
* Implements the generic Resource registry and CRUD infrastructure.
|
|
3
3
|
*/
|
|
4
4
|
import type { DatabaseAdapter } from "../pg.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { AppLogger } from "../logger/index.js";
|
|
6
6
|
import type { AuditPlugin } from "../audit/index.js";
|
|
7
|
+
import type { DictionaryPlugin } from "../dictionary.js";
|
|
8
|
+
import type { FileAdapter } from "../file.js";
|
|
7
9
|
import { User } from "../../context.js";
|
|
10
|
+
import type { AppContext } from "../../context.js";
|
|
8
11
|
export type ResourceOperation = "read" | "create" | "update" | "delete";
|
|
9
12
|
export interface ResourceFieldContract {
|
|
10
13
|
column?: string;
|
|
11
|
-
type?: "string" | "number" | "integer" | "boolean" | "date" | "json";
|
|
14
|
+
type?: "string" | "number" | "integer" | "boolean" | "date" | "json" | "text" | "timestamp" | "uuid" | "file" | "geometry" | "geom";
|
|
12
15
|
read?: boolean;
|
|
13
16
|
write?: boolean;
|
|
14
17
|
readable?: boolean;
|
|
@@ -21,15 +24,28 @@ export interface ResourceFieldContract {
|
|
|
21
24
|
filter?: boolean;
|
|
22
25
|
sort?: boolean;
|
|
23
26
|
search?: boolean;
|
|
27
|
+
dictionary?: string;
|
|
24
28
|
lookup?: {
|
|
25
|
-
|
|
29
|
+
table: string;
|
|
30
|
+
value: string;
|
|
31
|
+
text: string;
|
|
32
|
+
fields?: string[];
|
|
26
33
|
};
|
|
34
|
+
enum?: string[] | number[];
|
|
35
|
+
minLength?: number;
|
|
36
|
+
maxLength?: number;
|
|
37
|
+
minimum?: number;
|
|
38
|
+
maximum?: number;
|
|
39
|
+
pattern?: string;
|
|
27
40
|
}
|
|
28
41
|
export interface ResourceRelationContract {
|
|
29
42
|
resource?: string;
|
|
30
43
|
table?: string;
|
|
31
44
|
sourceField?: string;
|
|
45
|
+
foreignKey?: string;
|
|
32
46
|
targetField?: string;
|
|
47
|
+
type?: "one" | "many";
|
|
48
|
+
fields?: string[];
|
|
33
49
|
}
|
|
34
50
|
export interface ResourceContract {
|
|
35
51
|
version: 1;
|
|
@@ -39,6 +55,7 @@ export interface ResourceContract {
|
|
|
39
55
|
table: string;
|
|
40
56
|
key: string;
|
|
41
57
|
operations: ResourceOperation[];
|
|
58
|
+
capabilities?: string[];
|
|
42
59
|
permission?: string;
|
|
43
60
|
fields: Record<string, ResourceFieldContract>;
|
|
44
61
|
relations?: Record<string, ResourceRelationContract>;
|
|
@@ -46,6 +63,7 @@ export interface ResourceContract {
|
|
|
46
63
|
}
|
|
47
64
|
export interface ResourceQuery {
|
|
48
65
|
filter?: Record<string, unknown>;
|
|
66
|
+
include?: string | string[];
|
|
49
67
|
sort?: string[];
|
|
50
68
|
search?: string;
|
|
51
69
|
limit?: number;
|
|
@@ -55,13 +73,17 @@ export interface ResourceQuery {
|
|
|
55
73
|
export interface ResourceListResult<T = Record<string, unknown>> {
|
|
56
74
|
rows: T[];
|
|
57
75
|
limit: number;
|
|
76
|
+
time: number;
|
|
77
|
+
total: number | null;
|
|
58
78
|
offset: number;
|
|
59
79
|
}
|
|
60
80
|
export type ResourceUser = User;
|
|
61
81
|
export interface ResourceDependencies {
|
|
62
|
-
pg: DatabaseAdapter
|
|
63
|
-
logger?:
|
|
82
|
+
pg: DatabaseAdapter;
|
|
83
|
+
logger?: AppLogger;
|
|
64
84
|
audit?: AuditPlugin;
|
|
85
|
+
dictionary?: DictionaryPlugin;
|
|
86
|
+
file?: FileAdapter;
|
|
65
87
|
}
|
|
66
88
|
export interface ResourcePlugin {
|
|
67
89
|
register(input: ResourceContract | ResourceContract[]): void;
|
|
@@ -76,23 +98,55 @@ export interface ResourcePlugin {
|
|
|
76
98
|
findOne(params: {
|
|
77
99
|
name: string;
|
|
78
100
|
id: string | number;
|
|
101
|
+
query?: ResourceQuery;
|
|
79
102
|
user?: ResourceUser;
|
|
80
103
|
}): Promise<Record<string, unknown> | null>;
|
|
81
104
|
create(params: {
|
|
82
105
|
name: string;
|
|
83
106
|
data: Record<string, unknown>;
|
|
84
107
|
user?: ResourceUser;
|
|
85
|
-
}): Promise<Record<string, unknown>>;
|
|
108
|
+
}, ctx?: AppContext): Promise<Record<string, unknown>>;
|
|
86
109
|
update(params: {
|
|
87
110
|
name: string;
|
|
88
111
|
id: string | number;
|
|
89
112
|
data: Record<string, unknown>;
|
|
90
113
|
user?: ResourceUser;
|
|
91
|
-
}): Promise<Record<string, unknown>>;
|
|
114
|
+
}, ctx?: AppContext): Promise<Record<string, unknown>>;
|
|
92
115
|
delete(params: {
|
|
93
116
|
name: string;
|
|
94
117
|
id: string | number;
|
|
95
118
|
user?: ResourceUser;
|
|
96
|
-
}): Promise<boolean>;
|
|
119
|
+
}, ctx?: AppContext): Promise<boolean>;
|
|
120
|
+
findRelation(params: {
|
|
121
|
+
name: string;
|
|
122
|
+
id: string | number;
|
|
123
|
+
relation: string;
|
|
124
|
+
query?: ResourceQuery;
|
|
125
|
+
user?: ResourceUser;
|
|
126
|
+
}): Promise<any>;
|
|
127
|
+
createRelation(params: {
|
|
128
|
+
name: string;
|
|
129
|
+
id: string | number;
|
|
130
|
+
relation: string;
|
|
131
|
+
data?: Record<string, unknown>;
|
|
132
|
+
user?: ResourceUser;
|
|
133
|
+
}, ctx?: AppContext): Promise<any>;
|
|
134
|
+
updateRelation(params: {
|
|
135
|
+
name: string;
|
|
136
|
+
id: string | number;
|
|
137
|
+
relation: string;
|
|
138
|
+
relationId: string;
|
|
139
|
+
data: Record<string, unknown>;
|
|
140
|
+
user?: ResourceUser;
|
|
141
|
+
}, ctx?: AppContext): Promise<Record<string, unknown>>;
|
|
142
|
+
deleteRelation(params: {
|
|
143
|
+
name: string;
|
|
144
|
+
id: string | number;
|
|
145
|
+
relation: string;
|
|
146
|
+
relationId: string;
|
|
147
|
+
user?: ResourceUser;
|
|
148
|
+
}, ctx?: AppContext): Promise<{
|
|
149
|
+
success: boolean;
|
|
150
|
+
}>;
|
|
97
151
|
}
|
|
98
152
|
//# sourceMappingURL=resource.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.types.d.ts","sourceRoot":"","sources":["../../../src/plugins/resource/resource.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"resource.types.d.ts","sourceRoot":"","sources":["../../../src/plugins/resource/resource.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;A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I,CAAC,EAAE,YAAY,CAAC;KACrB,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,cAAc,CAAC,MAAM,EAAE;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAC,EAAE,YAAY,CAAC;KACrB,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,cAAc,CAAC,MAAM,EAAE;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,YAAY,CAAC;KACrB,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACrD"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ResourceContract, ResourceDependencies } from "../resource.types.js";
|
|
2
|
+
export declare function addDictionaryLookupData(rows: Record<string, unknown>[], fields: ResourceContract["fields"], dictionary: ResourceDependencies["dictionary"]): Promise<Record<string, unknown>[]>;
|
|
3
|
+
//# sourceMappingURL=add-dictionary-lookup-data.d.ts.map
|