@opengis/fcore 0.0.1-beta.9 → 0.0.27
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.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/context.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/fastify.d.ts +0 -3
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fcore.d.ts.map +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.js +1 -1
- package/dist/modules/auth/services/change-password.js +1 -1
- package/dist/modules/auth/services/get-current-user.d.ts +2 -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.js +1 -1
- package/dist/modules/file/route.js +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.js +1 -1
- 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.map +1 -1
- package/dist/modules/resource/route.js +1 -1
- package/dist/modules/resource/schema.d.ts +19 -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.js +1 -1
- package/dist/modules/resource/services/generate-resource-code.d.ts +16 -0
- package/dist/modules/resource/services/generate-resource-code.d.ts.map +1 -0
- package/dist/modules/resource/services/generate-resource-code.js +1 -0
- package/dist/modules/resource/services/get-resource-schema.d.ts +6 -0
- package/dist/modules/resource/services/get-resource-schema.d.ts.map +1 -0
- package/dist/modules/resource/services/get-resource-schema.js +1 -0
- package/dist/modules/resource/services/get-resource.js +1 -1
- package/dist/modules/resource/services/list-resource-as-user.d.ts +8 -0
- package/dist/modules/resource/services/list-resource-as-user.d.ts.map +1 -0
- package/dist/modules/resource/services/list-resource-as-user.js +1 -0
- package/dist/modules/resource/services/list-resource-list.d.ts +20 -0
- package/dist/modules/resource/services/list-resource-list.d.ts.map +1 -0
- package/dist/modules/resource/services/list-resource-list.js +1 -0
- 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.js +1 -1
- package/dist/modules/resource/services/suggest-resource.js +1 -1
- package/dist/modules/resource/services/update-resource-relation.js +1 -1
- 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.d.ts +25 -2
- 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.js +1 -1
- package/dist/modules/system/services/get-access.d.ts +1 -0
- 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.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-resource-access.d.ts +23 -0
- package/dist/modules/system/services/get-resource-access.d.ts.map +1 -0
- package/dist/modules/system/services/get-resource-access.js +1 -0
- package/dist/modules/system/services/get-resource-scopes.d.ts +16 -0
- package/dist/modules/system/services/get-resource-scopes.d.ts.map +1 -0
- package/dist/modules/system/services/get-resource-scopes.js +1 -0
- package/dist/modules/system/services/get-system-log.js +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 +3 -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/set-resource-access.d.ts +18 -0
- package/dist/modules/system/services/set-resource-access.d.ts.map +1 -0
- package/dist/modules/system/services/set-resource-access.js +1 -0
- package/dist/modules/system/services/set-resource-scopes.d.ts +10 -0
- package/dist/modules/system/services/set-resource-scopes.d.ts.map +1 -0
- package/dist/modules/system/services/set-resource-scopes.js +1 -0
- package/dist/modules/system/services/update-dictionary.js +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/audit.types.d.ts +1 -1
- package/dist/plugins/audit/audit.types.d.ts.map +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.js +1 -1
- package/dist/plugins/file.d.ts +7 -3
- package/dist/plugins/file.d.ts.map +1 -1
- package/dist/plugins/file.js +1 -1
- package/dist/plugins/jwt.js +1 -1
- package/dist/plugins/logger/index.js +1 -1
- package/dist/plugins/logger/transport.js +1 -1
- 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.d.ts.map +1 -1
- package/dist/plugins/redis.js +1 -1
- package/dist/plugins/resource/resource.d.ts +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.d.ts +3 -2
- package/dist/plugins/resource/resource.registry.d.ts.map +1 -1
- package/dist/plugins/resource/resource.registry.js +1 -1
- package/dist/plugins/resource/resource.types.d.ts +66 -14
- package/dist/plugins/resource/resource.types.d.ts.map +1 -1
- package/dist/plugins/resource/services/add-dictionary-lookup-data.js +1 -1
- package/dist/plugins/resource/services/add-file-token.js +1 -1
- package/dist/plugins/resource/services/add-table-lookup-data.js +1 -1
- package/dist/plugins/resource/services/create-relation.d.ts +5 -2
- package/dist/plugins/resource/services/create-relation.d.ts.map +1 -1
- package/dist/plugins/resource/services/create-relation.js +1 -1
- 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 +6 -3
- package/dist/plugins/resource/services/delete-relation.d.ts.map +1 -1
- package/dist/plugins/resource/services/delete-relation.js +1 -1
- package/dist/plugins/resource/services/delete.d.ts +9 -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.map +1 -1
- package/dist/plugins/resource/services/find-one.js +1 -1
- 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/get-table-columns.d.ts +8 -0
- package/dist/plugins/resource/services/get-table-columns.d.ts.map +1 -0
- package/dist/plugins/resource/services/get-table-columns.js +1 -0
- package/dist/plugins/resource/services/update-relation.d.ts +5 -2
- package/dist/plugins/resource/services/update-relation.d.ts.map +1 -1
- package/dist/plugins/resource/services/update-relation.js +1 -1
- package/dist/plugins/resource/services/update.d.ts +9 -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.js +1 -1
- package/dist/plugins/resource/utils/fields.js +1 -1
- package/dist/plugins/resource/utils/filters.d.ts +2 -1
- 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/scope.d.ts +10 -0
- package/dist/plugins/resource/utils/scope.d.ts.map +1 -0
- package/dist/plugins/resource/utils/scope.js +1 -0
- package/dist/plugins/resource/utils/sort.d.ts +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.d.ts +1 -1
- package/dist/plugins/resource/utils/sql.d.ts.map +1 -1
- package/dist/plugins/resource/utils/sql.js +1 -1
- package/dist/plugins/resource/utils/summary.d.ts +7 -0
- package/dist/plugins/resource/utils/summary.d.ts.map +1 -0
- package/dist/plugins/resource/utils/summary.js +1 -0
- package/dist/shared/getIP.js +1 -1
- package/migrations/20260903120000_core_schema.sql +5 -2
- package/migrations/20260903130001_add_file_fields.sql +5 -0
- package/migrations/20260910170000_core_schema.sql +22 -0
- package/migrations/20260929120000_allow_user_only_role_scopes.sql +2 -0
- package/migrations/20260929_role_scope.sql +32 -0
- package/package.json +2 -2
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,KAAK,qBAAqB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAIvD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE;QACT,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE;QACN,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;QAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC;IACF,EAAE,EAAE;QACF,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IACF,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;IACF,EAAE,EAAE;QACF,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,IAAI,EAAE;QACJ,IAAI,EAAE,IAAI,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,aAAa,EAAE;YACb,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,qBAAqB,CAAC;SAC5C,CAAC;KACH,CAAC;CACH;AAED,iBAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAItC;AAED,wBAAgB,UAAU,CAAC,SAAS,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,KAAK,qBAAqB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAIvD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE;QACT,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE;QACN,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;QAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC;IACF,EAAE,EAAE;QACF,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IACF,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;IACF,EAAE,EAAE;QACF,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,IAAI,EAAE;QACJ,IAAI,EAAE,IAAI,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,aAAa,EAAE;YACb,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,qBAAqB,CAAC;SAC5C,CAAC;KACH,CAAC;CACH;AAED,iBAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAItC;AAED,wBAAgB,UAAU,CAAC,SAAS,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CAoG5E;AACD,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function m(){const q=['local','./storage','cwd','/log','us-east-1','Ch7QR4e73Jg0wx0xOjm','parse','x5y30KBsEKCENT04tu6549Vxx3No1ztJ2q2K8r79S59420RaZ5','0ua4b1Tz21m47z13U3EO0uN9e0WE7hqRFbcZ72cbdWqZBzemf9cAU865xan1s81TdNpUKKfF','lax','strict','includes','logger','redis','auth'];m=function(){return q;};return m();}import'dotenv/config';const DEFAULT_LOG_RESPONSE_STATUS_CODES=[0x193,0x199,0x19d,0x19f,0x1ad];function required(P){const G=process.env[P];if(!G)throw new Error('Missing\x20environment\x20variable:\x20'+P);return G;}export function loadConfig(P={}){const Z=C,G={'env':process.env.NODE_ENV??'development','debug':process.env.DEBUG==='true','port':Number(process.env.PORT??0xbb8),'maxFileSize':+(process.env.MAX_FILE_SIZE||0x200),'rateLimit':{'disabled':process.env.RATE_LIMIT==='false','max':+(process.env.RATE_LIMIT_MAX||0x64),'timeWindow':+(process.env.RATE_LIMIT_TIME_WINDOW||0xea60)},'storageType':(process.env.STORAGE_TYPE??'s3')['toLowerCase']()==='local'||!process.env.S3_ENDPOINT?Z(0x1ad):'s3','storagePath':process.env.STORAGE_PATH??Z(0x1ae),'redactionList':(process.env.REDACTION_LIST||'password')['split'](','),'logger':{'level':process.env.LOG_LEVEL??'info','responses':process.env.LOG_RESPONSES==='true'?!![]:![],'responseCodes':process.env.LOG_RESPONSE_STATUS_CODES?process.env.LOG_RESPONSE_STATUS_CODES['split'](',')['map'](j=>j-0x0):DEFAULT_LOG_RESPONSE_STATUS_CODES,'directory':process.env.LOG_DIRECTORY||process[Z(0x1af)]()+Z(0x1b0)},'pg':{'host':process.env.PG_HOST??'localhost','port':Number(process.env.PG_PORT??0x1538),'database':process.env.PG_DATABASE??'','user':process.env.PG_USER??'','password':process.env.PG_PASSWORD??''},'redis':{'host':process.env.REDIS_HOST??'','port':Number(process.env.REDIS_PORT??0x18eb),'password':process.env.REDIS_PASSWORD,'lazyConnect':!![],'db':process.env.REDIS_DB?Number(process.env.REDIS_DB):undefined},'s3':{'endpoint':process.env.S3_ENDPOINT,'region':process.env.S3_REGION??Z(0x1b1),'bucket':process.env.S3_BUCKET??'','accessKey':process.env.S3_ACCESS_KEY,'secretKey':process.env.S3_SECRET_KEY,'folder':process.env.S3_FOLDER,'forcePathStyle':process.env.S3_FORCE_PATH_STYLE!=='false','tokenSecret':process.env.FILE_TOKEN_SECRET,'tokenTtl':Number(process.env.FILE_TOKEN_TTL??0xe10)},'auth':{'accessToken':process.env.AUTH_ACCESS_TOKEN||Z(0x1b2),'user':process.env.AUTH_USER?JSON[Z(0x1b3)](process.env.AUTH_USER):undefined,'sessionTimeout':+(process.env.AUTH_SESSION_TIMEOUT||0x258),'secret':process.env.AUTH_SECRET??Z(0x1b4),'cookieName':process.env.AUTH_COOKIE_NAME??'session_user_auth','jwtSecret':process.env.AUTH_JWT_SECRET??Z(0x1b5),'redirect':process.env.AUTH_REDIRECT??'/','twoFactorRedirect':process.env.AUTH_TWOFACTOR_REDIRECT??'/','cookieOptions':process.env.AUTH_COOKIE_OPTIONS_DOMAIN?{'domain':process.env.AUTH_COOKIE_OPTIONS_DOMAIN,'path':process.env.AUTH_COOKIE_OPTIONS_PATH||'/','httpOnly':Boolean(process.env.AUTH_COOKIE_OPTIONS_HTTP_ONLY||'true'),'secure':Boolean(process.env.AUTH_COOKIE_OPTIONS_SECURE||'true'),'sameSite':process.env.AUTH_COOKIE_OPTIONS_SAME_SITE&&[Z(0x1b6),Z(0x1b7),'none'][Z(0x1b8)](process.env.AUTH_COOKIE_OPTIONS_SAME_SITE)?process.env.AUTH_COOKIE_OPTIONS_SAME_SITE:Boolean(process.env.AUTH_COOKIE_OPTIONS_SAME_SITE||'true')}:{'path':'/','httpOnly':!![],'secure':![],'sameSite':!![]}}};return{...G,...P,'logger':{...G[Z(0x1b9)],...P['logger']},'pg':{...G['pg'],...P['pg']},'redis':{...G[Z(0x1ba)],...P['redis']},'s3':{...G['s3'],...P['s3']},'auth':{...G['auth'],...P[Z(0x1bb)]}};}function C(P,G){P=P-0x1ad;const j=m();let Z=j[P];return Z;}export{required as requireEnv};
|
package/dist/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function m(){const j=['allSettled','redis','close'];m=function(){return j;};return m();}let defaultContext;function C(P,G){P=P-0x155;const j=m();let Z=j[P];return Z;}export function setContext(P){defaultContext=P;}export function getContext(){if(!defaultContext)throw new Error('Application\x20context\x20is\x20not\x20initialized');return defaultContext;}export function createContext(P){return{...P,async 'close'(){const G=C;await Promise[G(0x155)]([P[G(0x156)]?.[G(0x157)](),P['pg']?.['end']()]),await P['logger']['close']();}};}
|
package/dist/errors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var p=C;export class FCoreError extends Error{['code'];['statusCode'];['details'];constructor(P,G,j=0x1f4,Z){var q=C;super(G),this['code']=P,this[q(0xd3)]=j,this['details']=Z,this[q(0xd4)]=new.target.name;}}export class BadRequestError extends FCoreError{constructor(P,G){super('BAD_REQUEST_ERROR',P,0x190,G);}}export class UnauthorizedError extends FCoreError{constructor(P='Authentication\x20required'){super('UNAUTHORIZED',P,0x191);}}export class ForbiddenError extends FCoreError{constructor(P='Access\x20denied'){super('FORBIDDEN',P,0x193);}}function C(P,G){P=P-0xd3;var j=m();var Z=j[P];return Z;}export class NotFoundError extends FCoreError{constructor(P=p(0xd5)){super('NOT_FOUND',P,0x194);}}export class ConflictError extends FCoreError{constructor(P='Conflict'){super('CONFLICT',P,0x199);}}export class ValidationError extends FCoreError{constructor(P,G){super('VALIDATION_ERROR',P,0x1a6,G);}}export class UnsupportedError extends FCoreError{constructor(P=p(0xd6)){super('UNSUPPORTED',P,0x1f5);}}function m(){var X=['statusCode','name','Not\x20found','Operation\x20is\x20not\x20configured'];m=function(){return X;};return m();}
|
package/dist/fastify.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integrates FCore modules with Fastify without coupling infrastructure plugins to HTTP.
|
|
3
|
-
*/
|
|
4
1
|
import { type FastifyPluginAsync } from "fastify";
|
|
5
2
|
import type { AppContext } from "./context.js";
|
|
6
3
|
export type FCoreApiModule = "auth" | "resource" | "file" | "system";
|
package/dist/fastify.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAY/C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;AAYrE,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,GAAG,EAAE,UAAU,EACf,OAAO,CAAC,EAAE,SAAS,cAAc,EAAE,GAClC,kBAAkB,CAgJpB"}
|
package/dist/fastify.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import P from'fastify-plugin';import{FCoreError}from'./errors.js';import{authRoutes}from'./modules/auth/route.js';function C(P,G){P=P-0x132;const j=m();let Z=j[P];return Z;}import{fileRoutes}from'./modules/file/route.js';import{resourceRoutes}from'./modules/resource/route.js';import{systemRoutes}from'./modules/system/route.js';import{createSessionStore}from'./plugins/auth/index.js';import{ForbiddenError}from'./errors.js';import{jwtVerifyToken}from'./plugins/jwt.js';function m(){const L=['split','decorate','ctx','method','HEAD','fcore','access','permissions','addHook','preHandler','routeOptions','platform','config','raw','authorization','Bearer\x20','slice','user','Route\x20access\x20not\x20defined','type','admin','replace','resource','FST_ERR_VALIDATION','statusCode','code','logger','system','addContentTypeParser','@fastify/rate-limit','rateLimit'];m=function(){return L;};return m();}function urlencodedContentParser(G,j,Z){const q=decodeURIComponent(j['toString']())['split']('&')['reduce']((p,X)=>{const i=C,[F,A]=X[i(0x132)]('=');return{...p,[F]:A};},{});Z(null,q);}export default function fcoreFastify(G,j){return P(async Z=>{const y=C;Z[y(0x133)](y(0x134),G);const {config:q}=G,p=new Map();Z['addHook']('onRoute',F=>{const T=y,A=F['schema'],H=Array['isArray'](F[T(0x135)])?F[T(0x135)]:[F['method']];for(const b of H){if(b===T(0x136))continue;const E={'method':b,'endpoint':F['url'],'package':A?.['package']??T(0x137),'tags':A?.['tags']??[],'summary':A?.['summary']??'','description':A?.['description']??'','access':A?.[T(0x138)]??'public','permissions':A?.[T(0x139)]??[]};p['set'](b+'\x20'+F['url'],E);}}),Z[y(0x13a)](y(0x13b),async F=>{const D=y;if(F['routeOptions']['url']==='*')return!![];const A=p['get'](F[D(0x135)]+'\x20'+F[D(0x13c)]['url']),H=!F['user']&&process[D(0x13d)]==='win32'&&G['config']?.['auth']?.['user']?G[D(0x13e)]?.['auth']?.['user']:null,b=F[D(0x13f)]['headers']?.[D(0x140)],E=b?.['startsWith'](D(0x141))?b[D(0x142)](0x7):null,z=F[D(0x143)]??(E?await jwtVerifyToken(E):H);!F[D(0x143)]&&E&&process.env.AUTH_JWT_SECRET&&(F['user']=await jwtVerifyToken(E));if(!A?.['access'])throw new ForbiddenError(D(0x144));if(A[D(0x138)]==='public')return!![];if(!z)throw new ForbiddenError('User\x20required');if(A[D(0x138)]==='user'&&!A['permissions']?.['length'])return!![];if(z[D(0x145)]=='admin')return!![];if(A['access']===D(0x146))throw new ForbiddenError('Admin\x20access\x20required');for(const x of A['permissions']){const o=x?.[D(0x147)]('$resource',F['params'][D(0x148)]??'');if(!z[D(0x139)]?.['includes'](o))throw new ForbiddenError('Missing\x20permission:\x20'+o);}return!![];}),await createSessionStore(Z,G),await Z['register'](import('@fastify/multipart'),{'limits':{'fileSize':q['maxFileSize']*0x400*0x400}}),Z['setErrorHandler']((F,A,H)=>{const h=y;if(F instanceof FCoreError||F['code']===h(0x149)||F['statusCode']<0x1f4)return F[h(0x14a)]<0x1f4&&G['logger']['warn'](F),H[h(0x14b)](F['statusCode'])['send']({'error':F['code'],'message':F['message'],'details':F['details']});return G[h(0x14c)]['error'](F),(q['debug']||process.env.NODE_ENV==='test'||process.env.VITEST)&&console['error'](F),H['code'](0x1f4)['send']({'error':'INTERNAL_ERROR','message':'Internal\x20server\x20error'});});const X=F=>!j||j['includes'](F);if(X('auth'))await Z['register'](authRoutes(G));if(X('resource'))await Z['register'](resourceRoutes(G));if(X('file'))await Z['register'](fileRoutes(G));if(X(y(0x14d)))await Z['register'](systemRoutes(G,p));Z[y(0x14e)]('application/x-www-form-urlencoded',{'parseAs':'buffer'},urlencodedContentParser),!q['rateLimit']?.['disabled']?Z['register'](import(y(0x14f)),{'max':q[y(0x150)]?.['max']||0x64,'timeWindow':q['rateLimit']?.['timeWindow']||0xea60,'hook':'preHandler','global':!![],'keyGenerator':F=>(F['user']?.['id']||F['ip'])+'-'+F['raw']['url']['split']('?')[0x0]}):console['log']('⚠️\x20rate\x20limit\x20is\x20disabled');});}
|
package/dist/fcore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fcore.d.ts","sourceRoot":"","sources":["../src/fcore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,
|
|
1
|
+
{"version":3,"file":"fcore.d.ts","sourceRoot":"","sources":["../src/fcore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EASL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACvC;AAED,wBAAsB,WAAW,CAC/B,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,UAAU,CAAC,CAqDrB"}
|
package/dist/fcore.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function m(){const E=['accessKey','resources'];m=function(){return E;};return m();}import{loadConfig}from'./config.js';import{createContext,setContext}from'./context.js';function C(P,G){P=P-0x177;const j=m();let Z=j[P];return Z;}import{createAudit,createDatabase,createDictionary,createFileLocal,createFileS3,createLogger,createRedis,createResource}from'./plugins/index.js';export async function createFCore(P={}){const b=C,G=loadConfig(P['config']),j=createRedis(G['redis']),Z=createLogger(),q=createDatabase(G['pg']),p=G['storageType']==='local'?createFileLocal({'storagePath':G['storagePath'],'folder':G['s3']['folder'],'tokenSecret':G['s3']['tokenSecret'],'tokenTtl':G['s3']['tokenTtl']}):createFileS3({'endpoint':G['s3']['endpoint'],'region':G['s3']['region'],'bucket':G['s3']['bucket'],'accessKey':G['s3'][b(0x177)],'secretKey':G['s3']['secretKey'],'folder':G['s3']['folder'],'forcePathStyle':G['s3']['forcePathStyle'],'tokenSecret':G['s3']['tokenSecret'],'tokenTtl':G['s3']['tokenTtl']}),X=createAudit({'pg':q,'logger':Z}),F=createDictionary({'pg':q,'dictionaries':P['dictionaries']}),A=createResource({'pg':q,'logger':Z,'audit':X,'dictionary':F,'file':p});P[b(0x178)]?.['length']&&A['register'](P['resources']);const H=createContext({'config':G,'logger':Z,'redis':j,'pg':q,'file':p,'resource':A,'audit':X,'dictionary':F});return setContext(H),H;}
|
package/dist/migrations/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
function
|
|
2
|
+
const A=C;import{runMigrations}from'./runner.js';import{loadConfig}from'../config.js';import P from'node:path';import{fileURLToPath}from'node:url';const packageMigrations=fileURLToPath(new URL('../../migrations',import.meta.url));function migrationDirectory(G){const F=C,j=G['indexOf']('--dir');if(j>=0x0){const q=G[j+0x1];if(!q)throw new Error(F(0x149));return P[F(0x14a)](q);}if(G[F(0x14b)]('--fcore'))return packageMigrations;const Z=G['find'](p=>!p['startsWith']('--'));return P['resolve'](Z??'migrations');}function C(P,G){P=P-0x149;const j=m();let Z=j[P];return Z;}function m(){const H=['--dir\x20requires\x20a\x20folder\x20path','resolve','includes','slice','run','file'];m=function(){return H;};return m();}try{const config=loadConfig(),dir=migrationDirectory(process['argv'][A(0x14c)](0x2));console['log']('Loaded\x20configuration:',{...config['pg'],'user':'****','password':'****'}),console['log']('Using\x20migration\x20directory:',dir,process['argv']['slice'](0x2));for(const r of await runMigrations({'database':config['pg'],'dir':dir}))console['log']((r['status']===A(0x14d)?'OK\x20\x20':'SKIP')+'\x20'+r[A(0x14e)]);}catch(X){console['error'](X),process['exitCode']=0x1;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import P from'node:fs/promises';function m(){const i=['query','SELECT\x20version\x20FROM\x20schema_migrations','rows','version','readdir','endsWith','has','readFile','utf8','BEGIN','release'];m=function(){return i;};return m();}import G from'node:path';import{createDatabase}from'../plugins/pg.js';export async function runMigrations(j={}){const o=C,Z=G['resolve'](j['dir']??'migrations'),q=j['database']??databaseFromUrl(j['databaseUrl']??process.env.DATABASE_URL);if(!q)throw new Error('DATABASE_URL\x20or\x20database\x20config\x20is\x20required');const p=createDatabase(q);if(!p)throw new Error('empty\x20pg');const X=[];try{await p['query']('\x0a\x20\x20\x20\x20\x20\x20CREATE\x20TABLE\x20IF\x20NOT\x20EXISTS\x20schema_migrations\x20(\x0a\x20\x20\x20\x20\x20\x20\x20\x20version\x20varchar(255)\x20PRIMARY\x20KEY,\x0a\x20\x20\x20\x20\x20\x20\x20\x20applied_at\x20timestamptz\x20NOT\x20NULL\x20DEFAULT\x20now()\x0a\x20\x20\x20\x20\x20\x20)\x0a\x20\x20\x20\x20');const F=await p[o(0xb6)](o(0xb7)),A=new Set(F[o(0xb8)]['map'](b=>b[o(0xb9)])),H=(await P[o(0xba)](Z))['filter'](b=>b[o(0xbb)]('.sql'))['sort']();for(const b of H){if(A[o(0xbc)](b)){X['push']({'file':b,'status':'skip'});continue;}const E=await P[o(0xbd)](G['join'](Z,b),o(0xbe)),z=await p['connect']();try{await z['query'](o(0xbf)),await z['query'](E),await z[o(0xb6)]('INSERT\x20INTO\x20schema_migrations(version)\x20VALUES\x20($1)',[b]),await z['query']('COMMIT');}catch(x){await z['query']('ROLLBACK');throw x;}finally{z[o(0xc0)]();}X['push']({'file':b,'status':'run'});}return X;}finally{await p['end']();}}function C(P,G){P=P-0xb6;const j=m();let Z=j[P];return Z;}function databaseFromUrl(j){if(!j)return undefined;const Z=new URL(j);return{'host':Z['hostname'],'port':Number(Z['port']||0x1538),'database':Z['pathname']['slice'](0x1),'user':decodeURIComponent(Z['username']),'password':decodeURIComponent(Z['password'])};}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
2
|
+
const j=C;function C(P,G){P=P-0x12b;const j=m();let Z=j[P];return Z;}import{loadConfig}from'../../config.js';import{createDatabase}from'../../plugins/pg.js';import P from'./services/registration.js';function m(){const Z=['argv','error','exitCode','type'];m=function(){return Z;};return m();}const [user,password,type]=process[j(0x12b)]['slice'](0x2);if(!user||!password)console[j(0x12c)]('Usage:\x20fcore-registration\x20<login>\x20<password>\x20[type]'),process[j(0x12d)]=0x1;else{const pg=createDatabase(loadConfig()['pg']);try{const {user:data}=await P({'user':user,'password':password,'type':type},{'pg':pg});console['log']('Registered\x20user\x20'+data['id']+'\x20('+data[j(0x12e)]+')');}catch(G){console[j(0x12c)](G),process['exitCode']=0x1;}finally{await pg['end']();}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
2
|
+
function C(P,G){P=P-0x1d8;const j=m();let Z=j[P];return Z;}const j=C;import{loadConfig}from'../../config.js';import{createDatabase}from'../../plugins/pg.js';import P from'./services/change-password.js';const [login,password]=process[j(0x1d8)][j(0x1d9)](0x2);if(!login||!password)console['error']('Usage:\x20fcore-password\x20<login>\x20<password>'),process[j(0x1da)]=0x1;else{const pg=createDatabase(loadConfig()['pg']);try{const result=await pg['query']('SELECT\x20uid\x20AS\x20id\x20FROM\x20admin.users\x20WHERE\x20$1\x20IN\x20(login,\x20email,\x20phone)\x20LIMIT\x201',[login]),user=result['rows'][0x0];if(!user)throw new Error(j(0x1db));await P({'userId':user['id'],'password':password},{'pg':pg}),console['log']('Password\x20changed\x20for\x20'+login);}catch(G){console['error'](G),process['exitCode']=0x1;}finally{await pg['end']();}}function m(){const Z=['argv','slice','exitCode','User\x20not\x20found'];m=function(){return Z;};return m();}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
2
|
+
const A=C;function m(){const b=['logs','read','update','create','split','filter','error','exitCode','trim','clear','log','connect','query','access_id','COMMIT','ROLLBACK','release','end'];m=function(){return b;};return m();}function C(P,G){P=P-0xa3;const j=m();let Z=j[P];return Z;}import{loadConfig}from'../../config.js';import{createDatabase}from'../../plugins/pg.js';const SYSTEM_ACTIONS=[A(0xa3),'audit','list','check','access','settings','dictionaries'],RESOURCE_ACTIONS=[A(0xa4),A(0xa5),A(0xa6),'delete'],[login,permissionArg]=process['argv']['slice'](0x2);function expandPermissions(P){const H=A,G=P[H(0xa7)](',')['map'](Z=>Z['trim']())[H(0xa8)](Boolean),j=new Set();for(const Z of G){if(Z['includes'](':')){j['add'](Z);continue;}const q=Z==='system'?SYSTEM_ACTIONS:RESOURCE_ACTIONS;for(const p of q){j['add'](Z+':'+p);}}return[...j];}if(!login||!permissionArg)console[A(0xa9)]('Usage:\x20fcore-permission\x20<login>\x20<system|resource|resource:action[,...]|clear>'),process[A(0xaa)]=0x1;else{const pg=createDatabase(loadConfig()['pg']);try{const result=await pg['query']('SELECT\x20uid\x20AS\x20id\x20FROM\x20admin.users\x20WHERE\x20$1\x20IN\x20(login,\x20email,\x20phone)\x20LIMIT\x201',[login]),user=result['rows'][0x0];if(!user)throw new Error('User\x20not\x20found');if(permissionArg[A(0xab)]()===A(0xac))await pg['query']('DELETE\x20FROM\x20admin.role_access\x20WHERE\x20user_uid\x20=\x20$1\x20AND\x20role_id\x20IS\x20NULL',[user['id']]),console[A(0xad)]('Permissions\x20cleared\x20for\x20'+login);else{const permissions=expandPermissions(permissionArg),byResource=new Map();for(const permission of permissions){const [resource,action]=permission['split'](':'),actions=byResource['get'](resource)??[];actions['push'](action),byResource['set'](resource,actions);}const client=await pg[A(0xae)]();try{await client[A(0xaf)]('BEGIN');for(const [resource,actions]of byResource){const existing=await client['query']('SELECT\x20access_id,\x20actions\x20FROM\x20admin.role_access\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20user_uid\x20=\x20$1\x20AND\x20role_id\x20IS\x20NULL\x20AND\x20resource\x20=\x20$2',[user['id'],resource]),row=existing['rows'][0x0];if(row){const merged=[...new Set([...row['actions']??[],...actions])];await client['query']('UPDATE\x20admin.role_access\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20SET\x20actions\x20=\x20$1,\x20updated_by\x20=\x20$2,\x20updated_at\x20=\x20now()\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20access_id\x20=\x20$3',[merged,user['id'],row[A(0xb0)]]);}else await client['query']('INSERT\x20INTO\x20admin.role_access\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(\x20resource,\x20actions,\x20user_uid,\x20created_by,\x20updated_by)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4,\x20$4)',[resource,actions,user['id'],user['id']]);}await client['query'](A(0xb1));}catch(X){await client['query'](A(0xb2));throw X;}finally{client[A(0xb3)]();}console[A(0xad)]('Granted\x20permissions\x20for\x20'+login+':\x20'+permissions['join'](',\x20'));}}catch(F){console['error'](F),process['exitCode']=0x1;}finally{await pg[A(0xb4)]();}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,SAAS,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAYnD,wBAAgB,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/route.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,SAAS,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAYnD,wBAAgB,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,kBAAkB,CA0K9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function m(){const T=['query','body','twofa','config','auth','login','sessionTimeout','session','cookie','maxAge','permissions','get','/api/auth/login','public','post','Sign\x20in','credentials','Creates\x20a\x20regular\x20user\x20account.','admin','user:create','fcore','user','Not\x20authorized','audit','sessionId','Get\x20current\x20user','Returns\x20the\x20authenticated\x20user\x27s\x20safe\x20profile.'];m=function(){return T;};return m();}import{getUserPermissions,verifyUser}from'../../plugins/auth/index.js';import P from'./services/get-current-user.js';import G from'./services/registration.js';function C(P,G){P=P-0x1a6;const j=m();let Z=j[P];return Z;}import j from'./services/change-password.js';import{authSchemas}from'./schema.js';import Z from'../../shared/getIP.js';import{UnauthorizedError}from'../../errors.js';export function authRoutes(q){return async p=>{const o=C,X=async F=>{const x=C,A=F['method']==='GET'?F[x(0x1a6)]:F[x(0x1a7)],H=Z(F),b=await verifyUser({...A,'ip':H},q);b['permissions']=await getUserPermissions(b['id'],q);const E=b[x(0x1a8)]?q['config']['auth']['twoFactorRedirect']:q[x(0x1a9)][x(0x1aa)]['redirect'];await F[x(0x1ab)](b);const z=q[x(0x1a9)]['auth'][x(0x1ac)]*0x3e8*0x3c;return F[x(0x1ad)]?.['cookie']&&(F['session'][x(0x1ae)][x(0x1af)]=z),await F[x(0x1ad)]['save'](),await q['audit']?.['write']?.({'module':'auth','resource':'session','resourceId':F['session']['sessionId'],'action':'login','userId':b['id'],'ipAddress':H}),{'user':{'id':b['id'],'type':b['type'],'permissions':b[x(0x1b0)]},'redirectUrl':E};};p[o(0x1b1)](o(0x1b2),{'schema':{'tags':['fcore','auth'],'summary':'Sign\x20in','description':'Authenticates\x20a\x20user\x20and\x20returns\x20a\x20bearer\x20access\x20token.','access':o(0x1b3),'permissions':[],'querystring':authSchemas['credentials']}},X),p[o(0x1b4)](o(0x1b2),{'schema':{'tags':['fcore','auth'],'summary':o(0x1b5),'description':'Authenticates\x20a\x20user\x20and\x20returns\x20a\x20bearer\x20access\x20token.','access':'public','permissions':[],'body':authSchemas[o(0x1b6)]}},X),p['post']('/api/auth/registration',{'schema':{'tags':['fcore',o(0x1aa)],'summary':'Register','description':o(0x1b7),'access':o(0x1b8),'permissions':[o(0x1b9)],'body':authSchemas['credentials']}},async F=>G(F[o(0x1a7)],q)),p['post']('/api/auth/password',{'schema':{'tags':[o(0x1ba),'auth'],'summary':'Change\x20password','description':'Changes\x20the\x20password\x20for\x20the\x20current\x20user.','access':o(0x1bb),'permissions':[],'body':authSchemas['password']}},async F=>{const i=o;if(!F['user'])throw new UnauthorizedError(i(0x1bc));return await j({'userId':F['user']['id'],...F['body']},q),{'success':!![]};}),p['post']('/api/auth/logout',{'schema':{'tags':[o(0x1ba),'auth'],'summary':'Sign\x20out','description':'Terminates\x20the\x20current\x20user\x20session.','access':'user','permissions':[]}},async(F,A)=>{const y=o,H={'redirectUrl':'/'};if(!F['user'])return H;return await q[y(0x1bd)]?.['write']?.({'module':'auth','resource':y(0x1ad),'resourceId':F[y(0x1ad)][y(0x1be)],'action':'logout','userId':F[y(0x1bb)]?.['id']}),await F['session']['destroy'](),A['clearCookie'](q[y(0x1a9)]['auth']['cookieName']),Object['defineProperty'](F,'session',{'value':null,'writable':![],'configurable':![]}),H;}),p[o(0x1b1)]('/api/auth/user',{'schema':{'tags':['fcore',o(0x1aa)],'summary':o(0x1bf),'description':o(0x1c0),'access':'user','permissions':[],'querystring':authSchemas['query']}},async F=>{return P({'user':F['user'],'token':F['query']['token'],'maxAge':F['session']?.['cookie']?.['maxAge'],'originalExpires':F['session']?.['cookie']?.['originalExpires']?.['toISOString']?.()});});};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const P=C;function C(P,G){P=P-0x193;const j=m();let Z=j[P];return Z;}import{Type}from'@sinclair/typebox';function m(){const G=['Boolean','Object','String'];m=function(){return G;};return m();}export const authSchemas={'query':Type['Object']({'token':Type['Optional'](Type[P(0x193)]())}),'credentials':Type[P(0x194)]({'user':Type['String']({'minLength':0x1,'maxLength':0x64}),'password':Type[P(0x195)]({'minLength':0x1,'maxLength':0x64}),'type':Type['Optional'](Type[P(0x195)]({'minLength':0x1,'maxLength':0x64}))}),'password':Type[P(0x194)]({'password':Type[P(0x195)]({'minLength':0x1,'maxLength':0x64}),'id':Type['Optional'](Type['String']({'minLength':0x1,'maxLength':0x64}))}),'twoFactor':Type[P(0x194)]({'code':Type[P(0x195)]({'minLength':0x1})})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hashPassword}from'../../../plugins/auth/index.js';
|
|
1
|
+
import{hashPassword}from'../../../plugins/auth/index.js';function C(P,G){P=P-0x18d;const j=m();let Z=j[P];return Z;}function m(){const X=['UPDATE\x20admin.users\x0a\x20\x20\x20\x20\x20SET\x20password_hash\x20=\x20$1,\x20updated_at\x20=\x20now(),\x20updated_by\x20=\x20$3\x0a\x20\x20\x20\x20\x20WHERE\x20uid\x20=\x20$2'];m=function(){return X;};return m();}export default async function changePassword({id:P,password:G,userId:j},{pg:Z}){const p=C,q=await hashPassword(G);await Z['query'](p(0x18d),[q,P||j,j]);}
|
|
@@ -5,5 +5,7 @@ import type { User } from "../../../context.js";
|
|
|
5
5
|
export default function getCurrentUser(params: {
|
|
6
6
|
user: User | undefined;
|
|
7
7
|
token: boolean | undefined;
|
|
8
|
+
maxAge: number | undefined;
|
|
9
|
+
originalExpires: string | undefined;
|
|
8
10
|
}): Promise<Record<string, unknown>>;
|
|
9
11
|
//# sourceMappingURL=get-current-user.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-current-user.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/services/get-current-user.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,wBAA8B,cAAc,CAAC,MAAM,EAAE;IACnD,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IACvB,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"get-current-user.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/services/get-current-user.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,wBAA8B,cAAc,CAAC,MAAM,EAAE;IACnD,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IACvB,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAkBnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{safeUser}from'../../utils/safe-user.js';function C(P,G){P=P-0x187;const j=m();let Z=j[P];return Z;}export default async function getCurrentUser(P){const p=C,{user:G}=P;if(!G)return{};if(P['token']){const {jwtSignToken:j}=await import(p(0x187)),Z=await j(G);G[p(0x188)]=Z;}return G[p(0x189)]=[...new Set(G?.['permissions']['map'](q=>q[p(0x18a)](':')[0x0]))],{...safeUser(G),'session':{'maxAge':P['maxAge'],'originalExpires':P['maxAge']}};}function m(){const X=['../../../plugins/jwt.js','token','resources','split'];m=function(){return X;};return m();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ConflictError}from'../../../errors.js';
|
|
1
|
+
import{ConflictError}from'../../../errors.js';function m(){const A=['query','INSERT\x20INTO\x20admin.users\x20(login,\x20password_hash,\x20user_type)\x0a\x20\x20\x20\x20\x20SELECT\x20$1,\x20$2,\x20$3\x0a\x20\x20\x20\x20\x20WHERE\x20NOT\x20EXISTS\x20(SELECT\x201\x20FROM\x20admin.users\x20WHERE\x20login\x20=\x20$1)\x0a\x20\x20\x20\x20\x20RETURNING\x20uid\x20AS\x20id,\x20user_type\x20AS\x20type','Login\x20is\x20already\x20in\x20use'];m=function(){return A;};return m();}function C(P,G){P=P-0x10c;const j=m();let Z=j[P];return Z;}import{hashPassword}from'../../../plugins/auth/index.js';export default async function registration({user:P,password:G,type:j},{pg:Z}){const F=C,q=await hashPassword(G),p=await Z[F(0x10c)](F(0x10d),[P,q,j||'regular']),X=p['rows'][0x0];if(!X)throw new ConflictError(F(0x10e));return{'user':X};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{unsupported}from'../../utils/unsupported.js';
|
|
1
|
+
import{unsupported}from'../../utils/unsupported.js';export default async function verifyTwoFactor(P,G){return unsupported('Two-factor\x20provider');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var P=C;export default new Set(['image/jpeg','image/png',P(0x6e),'image/webp','image/bmp',P(0x6f),'image/svg+xml','image/x-icon',P(0x70),'application/pdf','application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/vnd.ms-excel',P(0x71),'application/vnd.ms-powerpoint',P(0x72),'application/vnd.oasis.opendocument.text','application/vnd.oasis.opendocument.spreadsheet','application/vnd.oasis.opendocument.presentation','text/plain','text/csv','text/markdown','application/json','application/xml',P(0x73),'application/geo+json','application/vnd.google-earth.kml+xml','application/vnd.google-earth.kmz','application/zip','application/x-zip-compressed',P(0x74),'application/x-rar-compressed','application/vnd.rar','application/gzip',P(0x75),'application/x-tar',P(0x76),'audio/wav','audio/ogg','audio/webm','audio/mp4',P(0x77),'video/mpeg','video/webm','video/quicktime','video/x-msvideo','application/octet-stream']);function C(P,G){P=P-0x6e;var j=m();var Z=j[P];return Z;}function m(){var G=['image/gif','image/tiff','image/avif','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/vnd.openxmlformats-officedocument.presentationml.presentation','text/xml','application/x-7z-compressed','application/x-gzip','audio/mpeg','video/mp4'];m=function(){return G;};return m();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fileTypeFromBuffer}from'file-type';import{getFile}from'./services/get-file.js';function
|
|
1
|
+
import{fileTypeFromBuffer}from'file-type';import{getFile}from'./services/get-file.js';import{uploadFile}from'./services/upload-file.js';function m(){const i=['file','Get\x20file\x20by\x20token','fileToken','verify','token','mime','application/octet-stream','query','startsWith','image/','split','pop','Content-Disposition','header','Uploads\x20a\x20file\x20and\x20stores\x20its\x20metadata.','File\x20is\x20required','fields','Resize\x20file','Returns\x20a\x20resized\x20image\x20file.','files:read','resizeQuery','params','inline','send'];m=function(){return i;};return m();}import{resizeFile}from'./services/resize-file.js';function C(P,G){P=P-0xb9;const j=m();let Z=j[P];return Z;}import{fileSchemas}from'./schema.js';export function fileRoutes(P){return async G=>{const E=C;G['get']('/api/file/:token',{'schema':{'tags':['fcore',E(0xb9)],'summary':E(0xba),'description':'Returns\x20a\x20file\x20after\x20verifying\x20its\x20signed\x20access\x20token.','access':'public','permissions':[],'params':fileSchemas[E(0xbb)],'querystring':fileSchemas['fileDownloadQuery']}},async(j,Z)=>{const z=E,q=P['file'][z(0xbc)](j['params'][z(0xbd)]),p=await getFile({'pathOrToken':q},P),X=await fileTypeFromBuffer(p),F=X?.[z(0xbe)]??z(0xbf),A=j[z(0xc0)]['download']===!![],H=F[z(0xc1)](z(0xc2))||F==='application/pdf',b=q[z(0xc3)]('/')[z(0xc4)]()?.['replace'](/[^A-Za-z0-9._-]/g,'_')??'file';return Z['type'](F),Z['header'](z(0xc5),(A||!H?'attachment':'inline')+';\x20filename=\x22'+b+'\x22')[z(0xc6)]('Cache-Control','public,\x20max-age=86400,\x20immutable'),Z['send'](p);}),G['post']('/api/file/upload',{'schema':{'tags':['fcore','file'],'summary':'Upload\x20file','description':E(0xc7),'access':'user','permissions':['files:create']}},async j=>{const x=E,Z=await j['file']();if(!Z)throw new Error(x(0xc8));return uploadFile({'file':Z,'metadata':{'name':Z['filename'],'path':Z[x(0xc9)]['path']?.['value'],'resource':Z[x(0xc9)]['resource']?.['value'],'resourceId':Z['fields']['resourceId']?.['value']},'user':j['user']},P);}),G['get']('/api/file/:token/resize',{'schema':{'tags':['fcore',E(0xb9)],'summary':E(0xca),'description':E(0xcb),'access':'user','permissions':[E(0xcc)],'params':fileSchemas['fileToken'],'querystring':fileSchemas[E(0xcd)]}},async(j,Z)=>{const o=E,q=await resizeFile({'pathOrToken':P['file']?.['verify'](j[o(0xce)]['token']),...j['query']},P),p=await fileTypeFromBuffer(q);return Z['type'](p?.[o(0xbe)]??'image/png'),Z['header']('Content-Disposition',o(0xcf))[o(0xc6)]('Cache-Control','public,\x20max-age=86400,\x20immutable'),Z[o(0xd0)](q);});};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const P=C;import{Type}from'@sinclair/typebox';function C(P,G){P=P-0x1df;const j=m();let Z=j[P];return Z;}function m(){const G=['Object','String','Optional','Integer','Literal','contain','outside'];m=function(){return G;};return m();}export const fileSchemas={'fileId':Type[P(0x1df)]({'id':Type[P(0x1e0)]({'minLength':0x1,'maxLength':0x80})}),'fileToken':Type['Object']({'token':Type['String']({'minLength':0x1,'maxLength':0x800})}),'fileDownloadQuery':Type['Object']({'download':Type['Optional'](Type['Boolean']())}),'filePath':Type['Object']({'*':Type[P(0x1e0)]({'minLength':0x1,'maxLength':0x400})}),'upload':Type['Object']({'file':Type['Any'](),'metadata':Type['Object']({'name':Type['Optional'](Type['String']({'minLength':0x1})),'path':Type[P(0x1e1)](Type['String']({'minLength':0x1})),'entityType':Type[P(0x1e1)](Type['String']({'minLength':0x1})),'entityId':Type['Optional'](Type['String']({'minLength':0x1}))})}),'filePatch':Type['Object']({'entityType':Type['Optional'](Type['String']({'minLength':0x1})),'entityId':Type['Optional'](Type['String']({'minLength':0x1}))}),'resizeQuery':Type['Object']({'width':Type['Optional'](Type[P(0x1e2)]({'minimum':0x1,'default':0xc8})),'height':Type['Optional'](Type['Integer']({'minimum':0x1})),'fit':Type['Optional'](Type['Union']([Type[P(0x1e3)]('cover'),Type['Literal'](P(0x1e4)),Type[P(0x1e3)]('fill'),Type['Literal']('inside'),Type['Literal'](P(0x1e5))]))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function m(){var Z=['file','exists','get','pathOrToken'];m=function(){return Z;};return m();}function C(P,G){P=P-0x12f;var j=m();var Z=j[P];return Z;}import{NotFoundError}from'../../../errors.js';export async function getFile(P,G){var j=C;if(!G['file'])throw new Error('empty\x20file');if(!await G[j(0x12f)][j(0x130)](P['pathOrToken']))throw new NotFoundError('File\x20not\x20found'+P['pathOrToken']);return G[j(0x12f)][j(0x131)](P[j(0x132)]);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NotFoundError,ValidationError}from'../../../errors.js';import{fileTypeFromBuffer}from'file-type';function
|
|
1
|
+
import{NotFoundError,ValidationError}from'../../../errors.js';import{fileTypeFromBuffer}from'file-type';import{createHash}from'node:crypto';function C(P,G){P=P-0x6b;const j=m();let Z=j[P];return Z;}import{mkdir,readFile,writeFile}from'node:fs/promises';import P from'node:path';import G from'sharp';function m(){const y=['File\x20path\x20is\x20required','width','height','digest','resolve','join','code','ENOENT','exists','File\x20not\x20found','file','image/','fit','cover','isInteger'];m=function(){return y;};return m();}export async function resizeFile(j,Z){const o=C,q=j['pathOrToken']??j['path'];if(!q)throw new ValidationError(o(0x6b));const p=parseDimension(j['width'],o(0x6c))??0xc8,X=parseDimension(j[o(0x6d)],o(0x6d)),F=createHash('sha256')['update'](q+':'+p+':'+(X??'auto')+':'+(j['fit']??'cover'))[o(0x6e)]('hex'),A=P[o(0x6f)]('logs','resize'),H=P[o(0x70)](A,F+'.jpg');try{return await readFile(H);}catch(x){if(x[o(0x71)]!==o(0x72))throw x;}if(!await Z['file'][o(0x73)](q))throw new NotFoundError(o(0x74));const b=await Z[o(0x75)]['get'](q),E=await fileTypeFromBuffer(b);if(!E?.['mime']['startsWith'](o(0x76)))throw new ValidationError('Only\x20image\x20files\x20can\x20be\x20resized');const z=await G(b)['resize']({'width':p,'height':X,'fit':j[o(0x77)]??o(0x78)})['toBuffer']();return await mkdir(A,{'recursive':!![]}),await writeFile(H,z),z;}function parseDimension(j,Z){const i=C;if(j===undefined||j==='')return undefined;const q=Number(j);if(!Number[i(0x79)](q)||q<=0x0)throw new ValidationError(Z+'\x20must\x20be\x20a\x20positive\x20integer');return q;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../../../src/modules/file/services/upload-file.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../../../src/modules/file/services/upload-file.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AACD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,GAAG,CAAC,CA0Ed"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fileTypeFromBuffer}from'file-type';
|
|
1
|
+
import{fileTypeFromBuffer}from'file-type';function C(P,G){P=P-0x69;const j=m();let Z=j[P];return Z;}import P from'../mime.js';import{randomUUID}from'node:crypto';function m(){const i=['metadata','file','toBuffer','has','mime','resourceId','query','resource','File\x20with\x20name\x20\x22','\x22\x20and\x20id\x20\x22','put','\x0a\x20\x20\x20\x20\x20\x20\x20\x20INSERT\x20INTO\x20admin.files\x20(resource,\x20resource_id,\x20file_path,\x20file_type,\x20size,\x20uploaded_name,\x20file_name,\x20ext,\x20status,\x20created_by)\x0a\x20\x20\x20\x20\x20\x20\x20\x20VALUES\x20($1,\x20$2,\x20$3,\x20$4,\x20$5,\x20$6,\x20$7,\x20$8,\x20$9,\x20$10)\x0a\x20\x20\x20\x20\x20\x20\x20\x20RETURNING\x20*\x0a\x20\x20\x20\x20\x20\x20','mimetype','pop'];m=function(){return i;};return m();}import{ValidationError}from'../../../errors.js';export async function uploadFile(G,j){const o=C,Z=(G['metadata']['name']??randomUUID())['replace'](/[^a-zA-Z0-9._-]/g,'_'),q=new Date(),p=String(q['getFullYear']())['slice'](-0x2),X=String(q['getMonth']()+0x1)['padStart'](0x2,'0'),F=String(q['getDate']())['padStart'](0x2,'0'),A=G[o(0x69)]['path']??(G['metadata']['resource']?G['metadata']['resource']+'/'+(G['metadata']['resourceId']??randomUUID())+'/'+Z:null)??'uploads/'+p+'/'+X+'-'+F+'/'+Z,H=await G[o(0x6a)][o(0x6b)](),b=await fileTypeFromBuffer(H);if(!P['has'](G[o(0x6a)]['mimetype'])&&(b?.['mime']?!P[o(0x6c)](b[o(0x6d)]):!![]))throw new Error('Unsupported\x20file\x20type:\x20'+G[o(0x6a)]['mimetype']);const E=Boolean(G['metadata']['resource']&&G['metadata'][o(0x6e)]);if(E){const x=await j['pg'][o(0x6f)]('SELECT\x20file_id\x20FROM\x20admin.files\x0a\x20\x20\x20\x20\x20\x20\x20WHERE\x20resource\x20=\x20$1\x20AND\x20resource_id\x20=\x20$2\x20AND\x20file_name\x20=\x20$3\x0a\x20\x20\x20\x20\x20\x20\x20LIMIT\x201',[G['metadata'][o(0x70)],String(G['metadata']['resourceId']),Z]);if((x['rowCount']??0x0)>0x0)throw new ValidationError(o(0x71)+Z+'\x22\x20already\x20exists\x20for\x20resource\x20\x22'+G['metadata'][o(0x70)]+o(0x72)+G['metadata'][o(0x6e)]+'\x22');}await j[o(0x6a)][o(0x73)](A,H);const z=await j['pg']['query'](o(0x74),[G['metadata']['resource']??null,G['metadata'][o(0x6e)]??null,A,G['file'][o(0x75)],G['file']['file']['bytesRead'],G['metadata']['name'],Z,G['file']['mimetype']['split']('/')[o(0x76)]()??null,E?'attached':'pending',G['user']?.['id']??null]);return{...z['rows'][0x0],'token':j['file']['create'](A)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/route.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/route.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAwBnD,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,kBAAkB,CAoblE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const h=c;function L(){const D=['user','get','/api/resource/:resource/search','fcore','Search\x20resource','resource','query','/api/resource/:resource','/api/resource/:resource/:id','Returns\x20one\x20record\x20from\x20a\x20registered\x20resource.','resourceIncludeQuery','params','body','Deletes\x20a\x20record\x20from\x20a\x20registered\x20resource.','post','/api/resource/:resource/:id/upload','file','path','Returns\x20related\x20records\x20for\x20a\x20resource\x20record.','resourceIdRelation','delete','Deletes\x20a\x20relation\x20from\x20a\x20resource\x20record.','resourceIdRelationId','put','/api/resource/:resource/:id/:relation/:relationId','Update\x20resource\x20relation','Updates\x20a\x20related\x20resource\x20record.'];L=function(){return D;};return L();}import{ForbiddenError}from'../../errors.js';import{listResources}from'./services/list-resources.js';import{getResource}from'./services/get-resource.js';import{createResource}from'./services/create-resource.js';import{updateResource}from'./services/update-resource.js';import{deleteResource}from'./services/delete-resource.js';function c(J,e){J=J-0x1ef;const p=L();let b=p[J];return b;}import{listResourceRelation}from'./services/list-resource-relation.js';import{createResourceRelation}from'./services/create-resource-relation.js';import{updateResourceRelation}from'./services/update-resource-relation.js';import{deleteResourceRelation}from'./services/delete-resource-relation.js';import{searchResource}from'./services/search-resource.js';import{exportResource}from'./services/export-resource.js';import{suggestResource}from'./services/suggest-resource.js';import{resourceSchemas}from'./schema.js';import{uploadFile}from'../file/services/upload-file.js';const user=J=>J[h(0x1ef)];export function resourceRoutes(J){return async e=>{const u=c;e[u(0x1f0)](u(0x1f1),{'schema':{'tags':[u(0x1f2),'resource'],'summary':u(0x1f3),'description':'Searches\x20records\x20in\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas[u(0x1f4)]}},async p=>searchResource({...p['query'],...p['params'],'user':user(p)},J)),e['get']('/api/suggest/:resource/:field',{'schema':{'tags':[u(0x1f2),'resource'],'summary':'Suggest\x20resource\x20values','description':'Returns\x20suggested\x20values\x20for\x20a\x20resource\x20field.','access':'user','permissions':[],'params':resourceSchemas['resourceField'],'querystring':resourceSchemas['suggestQuery']}},async p=>suggestResource({...p[u(0x1f5)],...p['params'],'user':user(p)},J)),e[u(0x1f0)]('/api/resource/:resource/export',{'schema':{'tags':[u(0x1f2),u(0x1f4)],'summary':'Export\x20resource\x20records','description':'Exports\x20readable\x20records\x20from\x20a\x20registered\x20resource.','access':u(0x1ef),'permissions':['*:read'],'params':resourceSchemas['exportResource'],'querystring':resourceSchemas['exportResourceQuery']}},async p=>exportResource({...p['query'],...p['params'],'user':user(p)},J)),e[u(0x1f0)](u(0x1f6),{'schema':{'tags':[u(0x1f2),u(0x1f4)],'summary':'List\x20resource\x20records','description':'Returns\x20records\x20from\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas['resource']}},async p=>listResources({...p[u(0x1f5)],...p['params'],'user':user(p)},J)),e['post']('/api/resource/:resource',{'schema':{'tags':['fcore',u(0x1f4)],'summary':'Create\x20resource\x20record','description':'Creates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas[u(0x1f4)]}},async p=>createResource({...p['params'],'data':p['body'],'user':user(p)},J)),e['get'](u(0x1f7),{'schema':{'tags':['fcore','resource'],'summary':'Get\x20resource\x20record','description':u(0x1f8),'access':'user','permissions':[],'params':resourceSchemas['resourceId'],'querystring':resourceSchemas[u(0x1f9)]}},async p=>getResource({...p[u(0x1f5)],...p[u(0x1fa)],'user':user(p)},J)),e['put'](u(0x1f7),{'schema':{'tags':['fcore','resource'],'summary':'Update\x20resource\x20record','description':'Updates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':'user','permissions':[],'params':resourceSchemas['resourceId']}},async p=>updateResource({...p['params'],'patch':p[u(0x1fb)],'user':user(p)},J)),e['delete']('/api/resource/:resource/:id',{'schema':{'tags':['fcore','resource'],'summary':'Delete\x20resource\x20record','description':u(0x1fc),'access':u(0x1ef),'permissions':[],'params':resourceSchemas['resourceId']}},async p=>deleteResource({...p['params'],'user':user(p)},J)),e[u(0x1fd)](u(0x1fe),{'schema':{'tags':[u(0x1f2),'resource'],'summary':'Upload\x20resource\x20file','description':'Uploads\x20a\x20file\x20to\x20a\x20Resource\x20record\x20and\x20stores\x20its\x20metadata.','access':'user','permissions':[],'params':resourceSchemas['uploadResourceFile']}},async p=>{const H=u,b=await p[H(0x1ff)]();if(!b)throw new Error('File\x20is\x20required');const F=p['params']['resource'],P=p['params']['id'];if(p['user']?.['type']!=='admin'&&!p['user']?.['permissions']['includes'](F+':update'))throw new ForbiddenError('Missing\x20permission:\x20'+F+':update');return uploadFile({'file':b,'metadata':{'name':b['filename'],'path':b['fields'][H(0x200)]?.['value'],'resource':F,'resourceId':P},'user':p['user']},J);}),e[u(0x1f0)]('/api/resource/:resource/:id/:relation',{'schema':{'tags':['fcore','resource'],'summary':'List\x20resource\x20relations','description':u(0x201),'access':'user','permissions':[],'schema':{'params':resourceSchemas[u(0x202)]}}},async p=>listResourceRelation({...p['query'],...p['params'],'user':user(p)},J)),e['post']('/api/resource/:resource/:id/:relation',{'schema':{'tags':['fcore','resource'],'summary':'Create\x20resource\x20relation','description':'Creates\x20a\x20relation\x20for\x20a\x20resource\x20record.','access':u(0x1ef),'permissions':[],'params':resourceSchemas['resourceIdRelation']}},async p=>createResourceRelation({...p['params'],'data':p[u(0x1fb)],'user':user(p)},J)),e[u(0x203)]('/api/resource/:resource/:id/:relation/:relationId',{'schema':{'tags':['fcore','resource'],'summary':'Delete\x20resource\x20relation','description':u(0x204),'access':'user','permissions':[],'params':resourceSchemas[u(0x205)]}},async p=>deleteResourceRelation({...p['params'],'user':user(p)},J)),e[u(0x206)](u(0x207),{'schema':{'tags':['fcore','resource'],'summary':u(0x208),'description':u(0x209),'access':u(0x1ef),'permissions':[],'params':resourceSchemas['resourceIdRelationId']}},async p=>updateResourceRelation({...p['params'],'data':p['body'],'user':user(p)},J));};}
|
|
1
|
+
import{listResources}from'./services/list-resources.js';import{listResourceAsUser}from'./services/list-resource-as-user.js';import{getResource}from'./services/get-resource.js';import{createResource}from'./services/create-resource.js';import{updateResource}from'./services/update-resource.js';import{deleteResource}from'./services/delete-resource.js';import{listResourceRelation}from'./services/list-resource-relation.js';function C(P,G){P=P-0x77;const j=m();let Z=j[P];return Z;}import{createResourceRelation}from'./services/create-resource-relation.js';import{updateResourceRelation}from'./services/update-resource-relation.js';import{deleteResourceRelation}from'./services/delete-resource-relation.js';import{searchResource}from'./services/search-resource.js';import{exportResource}from'./services/export-resource.js';import{suggestResource}from'./services/suggest-resource.js';import{listResourceList}from'./services/list-resource-list.js';function m(){const z=['get','fcore','Searches\x20records\x20in\x20a\x20registered\x20resource.','$resource:read','params','user','config','auth','Get\x20resource\x20schema','Returns\x20the\x20resource\x20variables\x20and\x20nested\x20relation\x20schema.','/api/resource/:resource/code','Generate\x20a\x20resource\x20code','query','/api/resource/:resource/scope/:user','Returns\x20resource\x20records\x20using\x20the\x20specified\x20user\x27s\x20permissions\x20and\x20access\x20scopes.\x20Admin\x20only.','system:access','/api/resource/:resource','$resource:create','Updates\x20a\x20record\x20in\x20a\x20registered\x20resource.','resourceId','post','/api/resource/:resource/:id/upload','resource','$resource:update','value','/api/resource/:resource/:id/file/:fid','Delete\x20resource\x20file','Deletes\x20a\x20file\x20linked\x20to\x20a\x20resource\x20record\x20after\x20validating\x20it\x20belongs\x20to\x20this\x20resource\x20and\x20record.','File\x20not\x20found\x20for\x20this\x20resource\x20and\x20record','rows','file_path','file','/api/resource/:resource/list','List\x20resource\x20items','Returns\x20resource\x20identifiers\x20and\x20display\x20text,\x20optionally\x20filtered\x20by\x20searchable\x20fields.','List\x20resource\x20relations','/api/resource/:resource/:id/:relation','body'];m=function(){return z;};return m();}import{getResourceSchema}from'./services/get-resource-schema.js';import{generateResourceCode}from'./services/generate-resource-code.js';import{resourceSchemas}from'./schema.js';import{uploadFile}from'../file/services/upload-file.js';const user=P=>P['user'];export function resourceRoutes(P){return async G=>{const H=C;G[H(0x77)]('/api/resource/:resource/search',{'schema':{'tags':[H(0x78),'resource'],'summary':'Search\x20resource','description':H(0x79),'access':'user','permissions':[H(0x7a)],'params':resourceSchemas['resource']}},async j=>searchResource({...j['query'],...j[H(0x7b)],'user':user(j)||P['config']?.['auth']?.['user']},P)),G[H(0x77)]('/api/suggest/:resource/:field',{'schema':{'tags':['fcore','resource'],'summary':'Suggest\x20resource\x20values','description':'Returns\x20suggested\x20values\x20for\x20a\x20resource\x20field.','access':H(0x7c),'permissions':['$resource:read'],'params':resourceSchemas['resourceField'],'querystring':resourceSchemas['suggestQuery']}},async j=>suggestResource({...j['query'],...j['params'],'user':user(j)||P[H(0x7d)]?.[H(0x7e)]?.['user']},P)),G['get']('/api/resource/:resource/export',{'schema':{'tags':['fcore','resource'],'summary':'Export\x20resource\x20records','description':'Exports\x20readable\x20records\x20from\x20a\x20registered\x20resource.','access':'user','permissions':[H(0x7a)],'params':resourceSchemas['exportResource'],'querystring':resourceSchemas['exportResourceQuery']}},async j=>exportResource({...j['query'],...j[H(0x7b)],'user':user(j)||P['config']?.['auth']?.['user']},P)),G['get']('/api/resource/:resource/schema',{'schema':{'tags':['fcore','resource'],'summary':H(0x7f),'description':H(0x80),'access':'user','permissions':[H(0x7a)],'params':resourceSchemas['resource']}},async j=>getResourceSchema(j[H(0x7b)],P)),G['get'](H(0x81),{'schema':{'tags':['fcore','resource'],'summary':H(0x82),'description':'Generates\x20a\x20code\x20from\x20an\x20explicit\x20template\x20or\x20a\x20field\x20code_template.','access':'user','permissions':[H(0x7a)],'params':resourceSchemas['resource'],'querystring':resourceSchemas['resourceCodeQuery']}},async j=>generateResourceCode({...j['params'],...j[H(0x83)]},P)),G['get'](H(0x84),{'schema':{'tags':['fcore','resource'],'summary':'List\x20resource\x20as\x20a\x20user\x20for\x20scope\x20testing','description':H(0x85),'access':'admin','permissions':[H(0x86)],'params':resourceSchemas['resourceScopeTarget']}},async j=>listResourceAsUser({...j['params'],...j[H(0x83)],'requester':user(j)},P)),G[H(0x77)](H(0x87),{'schema':{'tags':[H(0x78),'resource'],'summary':'List\x20resource\x20records','description':'Returns\x20records\x20from\x20a\x20registered\x20resource.','access':H(0x7c),'permissions':[H(0x7a)],'params':resourceSchemas['resource']}},async j=>listResources({...j['query'],...j['params'],'user':user(j)||P[H(0x7d)]?.['auth']?.['user']},P)),G['post']('/api/resource/:resource',{'schema':{'tags':['fcore','resource'],'summary':'Create\x20resource\x20record','description':'Creates\x20a\x20record\x20in\x20a\x20registered\x20resource.','access':H(0x7c),'permissions':[H(0x88)],'params':resourceSchemas['resource']}},async j=>createResource({...j['params'],'data':j['body'],'user':user(j)||P['config']?.['auth']?.[H(0x7c)]},P)),G['get']('/api/resource/:resource/:id',{'schema':{'tags':['fcore','resource'],'summary':'Get\x20resource\x20record','description':'Returns\x20one\x20record\x20from\x20a\x20registered\x20resource.','access':H(0x7c),'permissions':[H(0x7a)],'params':resourceSchemas['resourceId'],'querystring':resourceSchemas['resourceIncludeQuery']}},async j=>getResource({...j[H(0x83)],...j[H(0x7b)],'user':user(j)||P['config']?.['auth']?.['user']},P)),G['put']('/api/resource/:resource/:id',{'schema':{'tags':['fcore','resource'],'summary':'Update\x20resource\x20record','description':H(0x89),'access':H(0x7c),'permissions':['$resource:update'],'params':resourceSchemas[H(0x8a)]}},async j=>updateResource({...j['params'],'patch':j['body'],'user':user(j)||P['config']?.['auth']?.['user']},P)),G['delete']('/api/resource/:resource/:id',{'schema':{'tags':['fcore','resource'],'summary':'Delete\x20resource\x20record','description':'Deletes\x20a\x20record\x20from\x20a\x20registered\x20resource.','access':'user','permissions':['$resource:delete'],'params':resourceSchemas['resourceId']}},async j=>deleteResource({...j['params'],'user':user(j)||P['config']?.[H(0x7e)]?.['user']},P)),G[H(0x8b)](H(0x8c),{'schema':{'tags':['fcore',H(0x8d)],'summary':'Upload\x20resource\x20file','description':'Uploads\x20a\x20file\x20to\x20a\x20Resource\x20record\x20and\x20stores\x20its\x20metadata.','access':'user','permissions':[H(0x8e)],'params':resourceSchemas['uploadResourceFile']}},async j=>{const b=H,Z=await j['file']();if(!Z)throw new Error('File\x20is\x20required');const q=j['params'][b(0x8d)],p=j[b(0x7b)]['id'];return uploadFile({'file':Z,'metadata':{'name':Z['filename'],'path':Z['fields']['path']?.[b(0x8f)],'resource':q,'resourceId':p},'user':j[b(0x7c)]},P);}),G['delete'](H(0x90),{'schema':{'tags':['fcore','resource'],'summary':H(0x91),'description':H(0x92),'access':'user','permissions':['$resource:update'],'params':resourceSchemas['resourceIdFileId']}},async j=>{const E=H,{resource:Z,id:q,fid:p}=j[E(0x7b)],X=await P['pg'][E(0x83)]('SELECT\x20file_path\x20FROM\x20admin.files\x20WHERE\x20file_id\x20=\x20$1\x20AND\x20resource\x20=\x20$2\x20AND\x20resource_id\x20=\x20$3\x20LIMIT\x201',[p,Z,String(q)]);if(!X['rowCount'])throw new Error(E(0x93));const F=X[E(0x94)][0x0]?.[E(0x95)],A=await P['pg']['query']('DELETE\x20FROM\x20admin.files\x20WHERE\x20file_id\x20=\x20$1\x20AND\x20resource\x20=\x20$2\x20AND\x20resource_id\x20=\x20$3',[p,Z,String(q)]);return await P[E(0x96)]['delete'](F),{'success':(A['rowCount']??0x0)>0x0,'resource':Z,'resourceId':q,'fileId':p};}),G[H(0x77)](H(0x97),{'schema':{'tags':['fcore',H(0x8d)],'summary':H(0x98),'description':H(0x99),'access':H(0x7c),'permissions':['$resource:read'],'params':resourceSchemas['resource'],'querystring':resourceSchemas['resourceListQuery']}},async j=>listResourceList({...j['params'],...j[H(0x83)],'user':user(j)||P['config']?.[H(0x7e)]?.['user']},P)),G[H(0x77)]('/api/resource/:resource/:id/:relation',{'schema':{'tags':['fcore','resource'],'summary':H(0x9a),'description':'Returns\x20related\x20records\x20for\x20a\x20resource\x20record.','access':'user','params':resourceSchemas['resourceIdRelation'],'permissions':[H(0x7a)]}},async j=>listResourceRelation({...j['query'],...j[H(0x7b)],'user':user(j)||P[H(0x7d)]?.['auth']?.[H(0x7c)]},P)),G['post'](H(0x9b),{'schema':{'tags':['fcore',H(0x8d)],'summary':'Create\x20resource\x20relation','description':'Creates\x20a\x20relation\x20for\x20a\x20resource\x20record.','access':'user','permissions':['$resource:create'],'params':resourceSchemas['resourceIdRelation']}},async j=>createResourceRelation({...j['params'],'data':j['body'],'user':user(j)||P['config']?.['auth']?.['user']},P)),G['delete']('/api/resource/:resource/:id/:relation/:relationId',{'schema':{'tags':['fcore','resource'],'summary':'Delete\x20resource\x20relation','description':'Deletes\x20a\x20relation\x20from\x20a\x20resource\x20record.','access':'user','permissions':['$resource:delete'],'params':resourceSchemas['resourceIdRelationId']}},async j=>deleteResourceRelation({...j[H(0x7b)],'user':user(j)||P[H(0x7d)]?.['auth']?.['user']},P)),G['put']('/api/resource/:resource/:id/:relation/:relationId',{'schema':{'tags':[H(0x78),H(0x8d)],'summary':'Update\x20resource\x20relation','description':'Updates\x20a\x20related\x20resource\x20record.','access':H(0x7c),'permissions':['$resource:update'],'params':resourceSchemas['resourceIdRelationId']}},async j=>updateResourceRelation({...j['params'],'data':j[H(0x9c)],'user':user(j)||P[H(0x7d)]?.['auth']?.[H(0x7c)]},P));};}
|
|
@@ -20,6 +20,10 @@ export declare const resourceSchemas: {
|
|
|
20
20
|
resource: import("@sinclair/typebox").TObject<{
|
|
21
21
|
resource: import("@sinclair/typebox").TString;
|
|
22
22
|
}>;
|
|
23
|
+
resourceScopeTarget: import("@sinclair/typebox").TObject<{
|
|
24
|
+
resource: import("@sinclair/typebox").TString;
|
|
25
|
+
user: import("@sinclair/typebox").TString;
|
|
26
|
+
}>;
|
|
23
27
|
exportResource: import("@sinclair/typebox").TObject<{
|
|
24
28
|
resource: import("@sinclair/typebox").TString;
|
|
25
29
|
}>;
|
|
@@ -32,6 +36,15 @@ export declare const resourceSchemas: {
|
|
|
32
36
|
search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
33
37
|
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
34
38
|
}>;
|
|
39
|
+
resourceListQuery: import("@sinclair/typebox").TObject<{
|
|
40
|
+
search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
41
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
42
|
+
}>;
|
|
43
|
+
resourceCodeQuery: import("@sinclair/typebox").TObject<{
|
|
44
|
+
id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
45
|
+
field: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
46
|
+
template: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
47
|
+
}>;
|
|
35
48
|
resourceId: import("@sinclair/typebox").TObject<{
|
|
36
49
|
resource: import("@sinclair/typebox").TString;
|
|
37
50
|
id: import("@sinclair/typebox").TString;
|
|
@@ -50,6 +63,11 @@ export declare const resourceSchemas: {
|
|
|
50
63
|
relation: import("@sinclair/typebox").TString;
|
|
51
64
|
relationId: import("@sinclair/typebox").TString;
|
|
52
65
|
}>;
|
|
66
|
+
resourceIdFileId: import("@sinclair/typebox").TObject<{
|
|
67
|
+
resource: import("@sinclair/typebox").TString;
|
|
68
|
+
id: import("@sinclair/typebox").TString;
|
|
69
|
+
fid: import("@sinclair/typebox").TString;
|
|
70
|
+
}>;
|
|
53
71
|
uploadResourceFile: import("@sinclair/typebox").TObject<{
|
|
54
72
|
resource: import("@sinclair/typebox").TString;
|
|
55
73
|
id: import("@sinclair/typebox").TString;
|
|
@@ -62,6 +80,7 @@ export declare const resourceSchemas: {
|
|
|
62
80
|
filter: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
63
81
|
sort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
64
82
|
search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
83
|
+
scope: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
65
84
|
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
66
85
|
offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
67
86
|
fields: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,aAAa;QACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;QACrC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB;CACF;AAED,eAAO,MAAM,UAAU,qCAIrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD,eAAO,MAAM,eAAe;IAC1B,cAAc;;;IACd,QAAQ;;;IACR,cAAc;;;IACd,aAAa;;;;IACb,YAAY;;;;;IAKZ,UAAU;;;;IACV,oBAAoB;;;IAGpB,kBAAkB;;;;;IAKlB,oBAAoB;;;;;;IAMpB,kBAAkB;;;;IAIlB,sBAAsB;;;;IAItB,mBAAmB
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/resource/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,aAAa;QACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;QACrC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB;CACF;AAED,eAAO,MAAM,UAAU,qCAIrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD,eAAO,MAAM,eAAe;IAC1B,cAAc;;;IACd,QAAQ;;;IACR,mBAAmB;;;;IACnB,cAAc;;;IACd,aAAa;;;;IACb,YAAY;;;;;IAKZ,iBAAiB;;;;IAIjB,iBAAiB;;;;;IAKjB,UAAU;;;;IACV,oBAAoB;;;IAGpB,kBAAkB;;;;;IAKlB,oBAAoB;;;;;;IAMpB,gBAAgB;;;;;IAKhB,kBAAkB;;;;IAIlB,sBAAsB;;;;IAItB,mBAAmB;;;;;;;;;CASpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const P=C;import{Type}from'@sinclair/typebox';function C(P,G){P=P-0x174;const j=m();let Z=j[P];return Z;}export const identifier=Type['String']({'minLength':0x1,'maxLength':0x80,'pattern':'^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$'});export const resourceSchemas={'dictionaryName':Type['Object']({'name':identifier}),'resource':Type['Object']({'resource':identifier}),'resourceScopeTarget':Type['Object']({'resource':identifier,'user':identifier}),'exportResource':Type['Object']({'resource':identifier}),'resourceField':Type['Object']({'resource':identifier,'field':identifier}),'suggestQuery':Type['Object']({'q':Type[P(0x174)](Type[P(0x175)]()),'search':Type[P(0x174)](Type['String']()),'limit':Type['Optional'](Type['Integer']({'minimum':0x1,'maximum':0xc8}))}),'resourceListQuery':Type['Object']({'search':Type[P(0x174)](Type[P(0x175)]()),'limit':Type['Optional'](Type['Integer']({'minimum':0x1,'maximum':0xc8}))}),'resourceCodeQuery':Type['Object']({'id':Type[P(0x174)](Type[P(0x175)]({'minLength':0x1,'maxLength':0x80})),'field':Type['Optional'](identifier),'template':Type['Optional'](Type['String']({'maxLength':0x3e8}))}),'resourceId':Type['Object']({'resource':identifier,'id':identifier}),'resourceIncludeQuery':Type['Object']({'include':Type['Optional'](Type[P(0x175)]({'minLength':0x1}))}),'resourceIdRelation':Type['Object']({'resource':identifier,'id':identifier,'relation':identifier}),'resourceIdRelationId':Type['Object']({'resource':identifier,'id':identifier,'relation':identifier,'relationId':identifier}),'resourceIdFileId':Type['Object']({'resource':identifier,'id':identifier,'fid':identifier}),'uploadResourceFile':Type['Object']({'resource':identifier,'id':identifier}),'uploadResourceFileBody':Type[P(0x176)]({'file':Type[P(0x177)](),'fileName':Type[P(0x175)]({'minLength':0x1,'maxLength':0xff})}),'exportResourceQuery':Type['Object']({'filter':Type['Optional'](Type['Record'](Type[P(0x175)](),Type['Unknown']())),'sort':Type[P(0x174)](Type['Array'](Type[P(0x175)]({'minLength':0x1}))),'search':Type['Optional'](Type['String']()),'scope':Type[P(0x174)](Type['String']()),'limit':Type[P(0x174)](Type['Integer']({'minimum':0x1,'maximum':0xc8})),'offset':Type[P(0x174)](Type['Integer']({'minimum':0x0})),'fields':Type[P(0x174)](Type[P(0x178)](identifier))})};function m(){const G=['Optional','String','Object','Any','Array'];m=function(){return G;};return m();}
|