Commit Graph

398 Commits

Author SHA1 Message Date
Alice Gaudon d925237233 Move pagination to common, add serialization, update BackendController 2021-06-01 16:04:43 +02:00
Alice Gaudon 7174097388 Add scss assets handling 2021-06-01 16:03:07 +02:00
Alice Gaudon dffbf296ed [TO SQUASH] Add missing src/assets/ts/tsconfig.json 2021-06-01 14:42:58 +02:00
Alice Gaudon 0f415144dc Reorganize many root config parameters 2021-06-01 14:38:53 +02:00
Alice Gaudon 7ccd335649 Move route building to common subproject, fix Time export 2021-06-01 14:34:10 +02:00
Alice Gaudon 2da637f51d svelte backend calls: stop matching on ',' 2021-05-31 15:34:37 +02:00
Alice Gaudon 4d2dda3615 svelte_layout.html: fix localStore import name 2021-05-31 11:18:46 +02:00
Alice Gaudon 166d1c1458 Swaf export regexp: remove unnecessary escapements 2021-05-31 11:18:04 +02:00
Alice Gaudon a85d899a21 locals: handle ignored properties, ignore ModelRelation.model 2021-05-31 11:16:46 +02:00
Alice Gaudon eb6ed8f2d2 Make css properly passed from children to parents with cache and dedup 2021-05-31 11:14:56 +02:00
Alice Gaudon c6b8c48a72 Move all sources to src folder, add common ts subproject 2021-05-27 15:26:19 +02:00
Alice Gaudon c36e4c0fbe Make locals override globals instead of the inverse 2021-05-13 17:39:20 +02:00
Alice Gaudon 13bd933b0b svelte: allow locals function calls with no parameter 2021-05-13 17:38:48 +02:00
Alice Gaudon c9fed2d873 Use maintenance component to throw 503s when some components are unavailable 2021-05-13 16:26:27 +02:00
Alice Gaudon a3ebf46b54 Add ApplicationComponent init lifecycle step and unstatic globals
This renames ApplicationComponent (previous) init to initRoutes and handle to handleRoutes
2021-05-13 16:03:59 +02:00
Alice Gaudon cdf95c0c0b Add has and require methods to Extendable 2021-05-13 15:58:41 +02:00
Alice Gaudon c896accdfa svelte: backend calls: make localStore import .js extension optional 2021-05-13 15:57:31 +02:00
Alice Gaudon 76fa44c245 Convert errors pages to svelte
Fallback non-existing error views to generic Error svelte component
2021-05-13 15:55:56 +02:00
Alice Gaudon 66a696f40e Application: fix isInNodeModules is inverted 2021-05-13 14:13:45 +02:00
Alice Gaudon 26140d2028 svelte: don't eat conditional chains question marks 2021-05-13 14:12:40 +02:00
Alice Gaudon fac59e12d6 views: delete target file or re-precompile on file remove 2021-05-13 14:11:23 +02:00
Alice Gaudon d423d78f2a esm: fix jest not running
following 82ab0b963c
2021-05-12 14:33:18 +02:00
Alice Gaudon 1167e99c30 Svelte view engine: backend calls: don't match dots and quotes 2021-05-12 14:02:58 +02:00
Alice Gaudon c60bd442e8 Svelte view engine: preprocess dependencies recursively 2021-05-12 14:02:58 +02:00
Alice Gaudon e851630be4 SvelteViewEngine: update backend calls prefix to $locals (store) 2021-05-12 14:02:58 +02:00
Alice Gaudon 85b4b39dd2 Svelte view engine: also compile backend calls on SSR
Add local to determine whether render is SSR or not
2021-05-12 14:02:58 +02:00
Alice Gaudon b247d73fcb Use clear-module to clear require cache of dependencies 2021-05-11 15:47:42 +02:00
Alice Gaudon 423f19de68 Only crash when not watching after everything is pre-compiled 2021-05-11 15:14:51 +02:00
Alice Gaudon 076cda8008 Fix localStore set to a function that fetches pre-executed backend calls 2021-05-11 15:13:32 +02:00
Alice Gaudon 8884f70a24 AssetPreCompiler: watch all view directories instead of the first one 2021-05-11 13:54:08 +02:00
Alice Gaudon 42f7ebba05 Svelte: write fully preprocessed code to pre-compiled files 2021-05-11 13:52:48 +02:00
Alice Gaudon 50e1b287a9 Catch command line errors and force exit with error code 2021-05-04 17:28:02 +02:00
Alice Gaudon 6aa37eb9e4 Add two step pre-compile/compile asset processing
Reorganize views into new "assets" folder structure
Turn locals into a store so locals don't have to be passed through files that don't need them
Some fixes to previous commit (esm) 82ab0b963c
Remove afs in favor of fs.promises (renamed afs.exists to Utils.doesFileExist
Rename Utils.readdirRecursively to Utils.listFilesRecursively
2021-05-04 17:14:32 +02:00
Alice Gaudon 82ab0b963c Switch to esm and add import auto format 2021-05-03 20:52:52 +02:00
Alice Gaudon 238bbec429 Cancel replaces on ssr html todo 2021-04-30 14:04:42 +02:00
Alice Gaudon 05d112a3b3 Remove NunjucksComponent 2021-04-30 13:59:22 +02:00
Alice Gaudon e385986aca Svelte: refactor many symbols and safe eval backend calls arguments
Also allow dumping function contents by outputing them directly
2021-04-29 16:13:31 +02:00
Alice Gaudon bd2b7e7579 svelte render: simplify replaces 2021-04-28 17:03:27 +02:00
Alice Gaudon 05069b15d8 Properly use promises in ViewEngine.render(), use ViewEngine for mail and add NunjucksViewEngine 2021-04-28 17:02:49 +02:00
Alice Gaudon a7f421d2f8 Move request context locals definition to FrontendToolsComponent 2021-04-28 14:10:29 +02:00
Alice Gaudon c93ea7691e ViewEngine: demote buildDir and publicDir fields 2021-04-28 14:09:02 +02:00
Alice Gaudon c4f71e569f Move globals to static ViewEngine and add setGlobal() 2021-04-28 14:05:06 +02:00
Alice Gaudon 0c178955ec Fix svelte template replace would recursively replace 2021-04-28 11:00:51 +02:00
Alice Gaudon fd7a6af98d Remove useless type definitions 2021-04-27 15:43:51 +02:00
Alice Gaudon 58ea522593 Reorganize config params and use view.cache for caching instead of view.dev 2021-04-27 15:08:41 +02:00
Alice Gaudon 91410b1a15 App startup: add http:// before listen address for conveniance 2021-04-27 14:43:27 +02:00
Alice Gaudon 7b2cdb8269 Clear require cache for watch recompiling 2021-04-23 18:20:22 +02:00
Alice Gaudon 053313002c Move svelte compilation to external rollup and add pre-compile-views cli 2021-04-23 15:56:39 +02:00
Alice Gaudon e5a9b9908d Refactor and make it nicer codewise 2021-04-23 15:56:39 +02:00
Alice Gaudon 29fa5f4e38 Make svelte work 2021-04-23 15:56:06 +02:00
Alice Gaudon 5f0e11efed Add svelte pre-compilation 2021-04-23 15:56:06 +02:00
Alice Gaudon df59795489 Remove mail spammy log 2021-04-22 18:01:52 +02:00
Alice Gaudon cfc632ba1a Approval mode: revoke unapproved users auth proofs
Also add tests for auth approval mode
2021-04-22 18:01:13 +02:00
Alice Gaudon 93aa8579c3 Pagination: don't throw on first page when totalCount=0, validate params 2021-04-22 11:42:47 +02:00
Alice Gaudon 12ec9b55f9 Handle SIGTERM exit signals (allows clean exit with systemd) 2021-04-21 13:52:52 +02:00
Alice Gaudon 6973b2600c Upgrade dependencies 2021-03-30 12:10:49 +02:00
Alice Gaudon 9ff832fb6f TestApp: don't ignore commands by default 2021-03-30 12:03:26 +02:00
Alice Gaudon 714e747d6e Application: make start/stop sturdier, catch more stop signals 2021-03-30 12:03:26 +02:00
Alice Gaudon 4cbc73a25f Fix ServeStaticDirectoryComponent while developping swaf
Also move core version detection to Application
2021-03-30 12:03:26 +02:00
Alice Gaudon 69e9f3ce9c Controller: fix route() parsing with regexp params
Also allow numbers in route param names
2021-03-30 12:03:26 +02:00
Alice Gaudon 4692a23696 Properly implement pagination 2021-03-30 12:02:57 +02:00
Alice Gaudon caae753d74 Allow users to change their username every configurable period of time
Closes #22
2021-02-23 17:43:11 +01:00
Alice Gaudon dcfb0b8f1c Add Time util class 2021-02-23 17:42:32 +01:00
Alice Gaudon 562431449b Allow users to remove their password in case they forget it
Closes #23
2021-02-20 20:18:03 +01:00
Alice Gaudon dbf6128747 Fix AddNameToUsersMigration not calling callbacks 2021-01-26 17:56:57 +01:00
Alice Gaudon d96de4874a Add IF EXISTS to DropNameFromUsers migration to not fail in new installs 2021-01-25 17:45:11 +01:00
Alice Gaudon aed825c4d6 FormHelperComponent: don't flash empty previous form data 2021-01-25 17:26:42 +01:00
Alice Gaudon 5caa0be862 FormHelperComponent: add field ID prefix to prevent conflicts
Fixes #20
2021-01-25 17:26:42 +01:00
Alice Gaudon 4745ae4e17 Fix session id not available in websocket listeners
Fixes #21
2021-01-25 16:36:15 +01:00
Alice Gaudon 8b98c8cc59 AddNameToUsersMigration: fix can't work when db already has users 2021-01-25 16:22:51 +01:00
Alice Gaudon 4817563dc1 Make models and components available immediately after their migration 2021-01-25 16:21:24 +01:00
Alice Gaudon 8a25f214ab AuthGuard: always provide a string to pending account mail username 2021-01-25 14:37:50 +01:00
Alice Gaudon b211845f57 Mail: also debug log data 2021-01-25 14:36:27 +01:00
Alice Gaudon b9ac4d0f05 AddUsedToMagicLinksMigration: delete all magic links after install 2021-01-25 14:07:20 +01:00
Alice Gaudon 449922490f MagicLinkAuthMethod: do not interrupt auth with used magic links 2021-01-25 14:02:58 +01:00
Alice Gaudon 359485170d UserNameComponent: ensure usage of user.name is optional
Fixes #19
2021-01-25 12:47:18 +01:00
Alice Gaudon 2a184e4ff5 Fix published npm package folder structure 2021-01-25 12:37:41 +01:00
Alice Gaudon f1a8a4ba07 Express.d.ts: normalize session fields case 2021-01-25 10:53:43 +01:00
Alice Gaudon e4768141bc Simplify RedirectBackComponent into PreviousUrlComponent
Closes #12
2021-01-24 22:42:20 +01:00
Alice Gaudon 19c8b86ff8 Fix express body parsing middlewares corrupting AsyncLocalStorage
Closes #17
2021-01-24 16:35:33 +01:00
Alice Gaudon 1b8ff1428f Add persist session checkbox on login
Makes session not persistent by default
Closes #11
2021-01-24 16:33:33 +01:00
Alice Gaudon 5897b6bf36 Code cleanup: remove debug log from AccountController 2021-01-24 16:33:14 +01:00
Alice Gaudon 1c71f66150 Clean logs from unwanted info and use \t as a delimiter to align
Closes #6
2021-01-22 16:07:27 +01:00
Alice Gaudon 94cb157520 Remove connect-redis that breaks context with RedisStore 2021-01-22 15:55:06 +01:00
Alice Gaudon 8fab93e709 Use AsyncLocalStorage to provide requestId context 2021-01-22 15:54:26 +01:00
Alice Gaudon 49168b5391 Add account management (email addresses management, password management)
Closes #8
Closes #9
2021-01-22 12:22:11 +01:00
Alice Gaudon 784f2c976c Rename base_url setting to public_url 2021-01-21 17:13:05 +01:00
Alice Gaudon 3e0a25874e Auth: fix middleware applied globally and explicitly log them 2021-01-21 15:45:20 +01:00
Alice Gaudon 2c66c66a39 logging: add status code description for redirections 2021-01-21 15:45:20 +01:00
Alice Gaudon 4db7217876 Controller: add useMiddleware method 2020-12-30 14:10:58 +01:00
Alice Gaudon 87b4facea0 Upgrade dependencies and update to express session new typings 2020-12-04 15:24:22 +01:00
Alice Gaudon 70d80d1f0a AuthMethod: add weight to choose when no method was specified 2020-11-16 11:43:14 +01:00
Alice Gaudon 35129cd4f1 PasswordAuthMethod: simplify bad password throw 2020-11-15 15:50:19 +01:00
Alice Gaudon f99c62a5d9 Increase login fail per ip throttle limit and jail time 2020-11-15 15:49:40 +01:00
Alice Gaudon 124bc8785f MagicLinkUserNameComponent: allow null username 2020-11-15 15:21:26 +01:00
Alice Gaudon 6a65ec723d AuthController: use Validator system for unknown user on login 2020-11-15 15:18:57 +01:00
Alice Gaudon 6eacfdcffa Throttler: log jail triggers 2020-11-15 15:18:49 +01:00
Alice Gaudon 683fe7262b MagicLinkAuthMethod: do not allow register for already existing email 2020-11-15 14:14:56 +01:00
Alice Gaudon c08d03c8fb MagicLinkUserNameComponent: fix validator property name for "username" 2020-11-15 14:13:57 +01:00
Alice Gaudon cecf28502e ModelComponent: fix validators not transferred to attached model 2020-11-15 14:13:35 +01:00
Alice Gaudon 42da8a68bb Validation: respond with http 400 instead of 401 2020-11-15 14:12:45 +01:00
Alice Gaudon b28e2b75b7 Authentication: Improve registration tests and fix register/login overlap 2020-11-15 12:20:57 +01:00
Alice Gaudon f8c4906a51 PasswordAuthMethod: fix findUserByIdentifier() 2020-11-14 18:16:05 +01:00
Alice Gaudon b75b227ca1 Add required username to magic link authentication and fix many errors 2020-11-14 17:24:57 +01:00
Alice Gaudon acc5233185 Error handling: transform single validation errors into a validation bag 2020-11-14 16:25:18 +01:00
Alice Gaudon 9d50c5cc5f Rename project to swaf 2020-11-12 16:11:16 +01:00
Alice Gaudon efdd81b650 Auth: refactor to support multiple auth factors and add password factor 2020-11-11 19:30:30 +01:00
Alice Gaudon 1fce157104 logging: prevent full logging of errors for silent logs 2020-11-11 19:29:23 +01:00
Alice Gaudon 24d83c73ad Add basic development environment for testing purposes 2020-11-11 19:29:23 +01:00
Alice Gaudon b8905ea02b Move Controller.validate to static Validator.validate 2020-11-11 19:29:23 +01:00
Alice Gaudon bb8b44b5a3 ModelFactory: add hasComponent method 2020-11-11 19:29:23 +01:00
Alice Gaudon ead3c8ce1e Controller: wrap use() middlewares to handle async 2020-11-11 19:29:23 +01:00
Alice Gaudon 79c2f33000 Deprecate legacy migrations
Fix CreateUsersAndUserEmailsTableMigration


sq
2020-11-11 19:29:23 +01:00
Alice Gaudon 03d9826f93 Migration: remove `connection` parameter from query() method
Closes #5
2020-11-11 19:29:23 +01:00
Alice Gaudon f20da06d43 logging: also log ip address 2020-11-11 19:29:23 +01:00
Alice Gaudon a09e92dd96 logging: make silent errors actually silent 2020-11-04 12:52:07 +01:00
Alice Gaudon 570a831172 Mail: remove usage of non-existent config property 2020-11-04 12:11:30 +01:00
Alice Gaudon d741517cb9 AuthGuard: add separate before and after registration callbacks 2020-11-04 11:55:34 +01:00
Alice Gaudon c966536950 NunjucksComponent: fix view loaders using cache when in dev env 2020-11-03 17:46:04 +01:00
Alice Gaudon 7c2572cddc Fix validation errors not being flashed correctly 2020-11-03 11:14:13 +01:00
Alice Gaudon 4d0c714dbd Render emails using NunjucksComponent's environment 2020-11-03 10:29:36 +01:00
Alice Gaudon cfb7bddca6 DropLegacyLogsTable: fix sql syntax 2020-11-02 19:32:56 +01:00
Alice Gaudon 88e5e19730 Replace custom logging system with tslog 2020-11-02 17:50:12 +01:00
Alice Gaudon 93bff1fdca Nunjucks/globals: fix route() context 2020-10-02 12:13:48 +02:00
Alice Gaudon 595a6d4066 ModelQuery: add create() and fix boolean serialization 2020-10-02 12:08:01 +02:00
Alice Gaudon 00c806aa0a Fix log level output 2020-10-02 11:11:01 +02:00
Alice Gaudon e37184e5ee Add user model to RequireAuth middlewares 2020-10-01 13:59:19 +02:00
Alice Gaudon f41a456524 Improve typing precision of CacheProvider.get() 2020-10-01 13:58:50 +02:00
Alice Gaudon 79d704083a Add many eslint rules and fix all linting issues 2020-09-28 14:15:22 +02:00
Alice Gaudon 8210642684 Improve logging configuration structure 2020-09-25 22:19:13 +02:00
Alice Gaudon b736f5f6cb Improve middleware definition and cleanup code 2020-09-25 22:15:57 +02:00
Alice Gaudon 5dc0bd710a Make nunjucks and static file server compatible with pkg 2020-09-24 22:42:55 +02:00
Alice Gaudon 87aae6bb33 Fix some nunjucks globals not properly set and make getCSRFToken dynamic 2020-09-23 16:11:51 +02:00
Alice Gaudon 47e0756930 Add websocketUrl view local 2020-09-23 12:31:19 +02:00
Alice Gaudon 79d3b51f90 Pass a whole Session to WebSocketListeners 2020-09-23 08:55:35 +02:00
Alice Gaudon 2effaf13eb Add AuthComponent.getAuthGuard() 2020-09-23 08:46:37 +02:00
Alice Gaudon 75c2b72f57 Add Application.getComponent() 2020-09-23 08:46:21 +02:00
Alice Gaudon dfee2645e1 Express: add custom bind address setting 2020-09-17 21:15:37 +02:00
Alice Gaudon 3a473dd24e Fix error when saving models in transaction when it needs a full update 2020-09-15 15:40:58 +02:00
Alice Gaudon fec607da20 ModelQuery: add offset parameter to union() 2020-09-11 15:15:15 +02:00
Alice Gaudon fd6e384a12 Logging: improve legibility of sql queries when verbose mode enabled 2020-09-11 15:14:40 +02:00
Alice Gaudon 15678e0381 Fix relation reducing mistakenly using "in" instead of indexOf >= 0 2020-09-10 19:11:32 +02:00
Alice Gaudon b12d104c78 ModelRelations: deduplicate recursive relations on populate() 2020-09-08 19:24:05 +02:00
Alice Gaudon 969ab18b96 ModelRelation: sort recursive relations by tree 2020-09-08 19:11:19 +02:00
Alice Gaudon 892b830dc4 Code formatting and cleanup, dependencies upgrade and version 0.22.0-rc.8 2020-09-07 14:38:30 +02:00
Alice Gaudon 2f822aa61c ModelRelation: simplify foreign model constructor parameter 2020-09-07 14:30:11 +02:00
Alice Gaudon b88f4e1b64 ModelRelation: deduplicate eagerloaded models 2020-09-07 14:02:43 +02:00
Alice Gaudon 0e37014667 ModelQuery: add nested eagerloading 2020-09-07 13:43:02 +02:00
Alice Gaudon e86356ae74 ModelQuery.union(): fix missing subquery variables 2020-09-06 16:02:53 +02:00
Alice Gaudon 17685a44be Improve field disambiguation to allow raw values when starting with ",',` 2020-09-06 15:44:37 +02:00